cvs: php4 /ext/shmop shmop.c
| From: | Ilia Alshanetsky | Date: | Thu, 17 Jan 2002 19:58:53 +0000 |
| Subject: | cvs: php4 /ext/shmop shmop.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-9080@lists.php.net to get a copy of this message | ||
iliaa Thu Jan 17 14:58:53 2002 EDT
Modified files:
/php4/ext/shmop shmop.c
Log:
Fixed shmop_read to append \0 to returned string in shmop_read to eliminate Zend warnings
Index: php4/ext/shmop/shmop.c
diff -u php4/ext/shmop/shmop.c:1.21 php4/ext/shmop/shmop.c:1.22
--- php4/ext/shmop/shmop.c:1.21 Wed Jan 9 03:02:21 2002
+++ php4/ext/shmop/shmop.c Thu Jan 17 14:58:53 2002
@@ -16,7 +16,7 @@
| Ilia Alshanetsky (ilia@prohost.org) |
+----------------------------------------------------------------------+
*/
-/* $Id: shmop.c,v 1.21 2002/01/09 08:02:21 yohgaki Exp $ */
+/* $Id: shmop.c,v 1.22 2002/01/17 19:58:53 iliaa Exp $ */
#ifdef HAVE_CONFIG_H
#include "config.h"
@@ -242,8 +242,9 @@
startaddr = shmop->addr + (*start)->value.lval;
bytes = (*count)->value.lval ? (*count)->value.lval :
shmop->size-(*start)->value.lval;
- return_string = emalloc(bytes);
+ return_string = emalloc(bytes+1);
memcpy(return_string, startaddr, bytes);
+ return_string[bytes] = 0;
RETURN_STRINGL(return_string, bytes, 0);
}