summaryrefslogtreecommitdiff
path: root/ext/shmop
diff options
context:
space:
mode:
authorIlia Alshanetsky <iliaa@php.net>2002-01-17 19:58:53 (GMT)
committerIlia Alshanetsky <iliaa@php.net>2002-01-17 19:58:53 (GMT)
commit5b20d4c06774dbb622a814c83a665430759ea2d3 (patch)
tree0cc74fe0ba36fe0a9922bf9f792a61d41c7aafb9 /ext/shmop
parent53f8b2d28b2d38da4eb6e08069c13fa85aa7a0ed (diff)
downloadphp-5b20d4c06774dbb622a814c83a665430759ea2d3.tar.gz
Fixed shmop_read to append \0 to returned string in shmop_read to eliminate Zend warnings
Diffstat (limited to 'ext/shmop')
-rw-r--r--ext/shmop/shmop.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/ext/shmop/shmop.c b/ext/shmop/shmop.c
index 0c8c0c2..7e4fa3d 100644
--- a/ext/shmop/shmop.c
+++ b/ext/shmop/shmop.c
@@ -242,8 +242,9 @@ PHP_FUNCTION(shmop_read)
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);
}