]> granicus.if.org Git - php/commitdiff
Fixed shmop_read to append \0 to returned string in shmop_read to eliminate Zend...
authorIlia Alshanetsky <iliaa@php.net>
Thu, 17 Jan 2002 19:58:53 +0000 (19:58 +0000)
committerIlia Alshanetsky <iliaa@php.net>
Thu, 17 Jan 2002 19:58:53 +0000 (19:58 +0000)
ext/shmop/shmop.c

index 0c8c0c2cc527918ed20d2cdffae5b3e6263986e1..7e4fa3df0ea54f014c5b8b414f55a473ef0250fd 100644 (file)
@@ -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);
 }