From: Ilia Alshanetsky Date: Thu, 17 Jan 2002 19:58:53 +0000 (+0000) Subject: Fixed shmop_read to append \0 to returned string in shmop_read to eliminate Zend... X-Git-Tag: PRE_ISSET_PATCH~176 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=5b20d4c06774dbb622a814c83a665430759ea2d3;p=php Fixed shmop_read to append \0 to returned string in shmop_read to eliminate Zend warnings --- diff --git a/ext/shmop/shmop.c b/ext/shmop/shmop.c index 0c8c0c2cc5..7e4fa3df0e 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); }