On Thu, 2002-01-17 at 08:33, Robin Ericsson wrote:
> On Wed, 2002-01-16 at 21:19, Ilia A. wrote:
> > I've tested your code on 4.1.1 release with the recent SHMOP patch that is 
> > already part of the latest CVS. The code worked fine and did not generate any 
> > warning or errors.
> > 
> > I did however commented out the sem_* functions.
> > 
> 
> That's funny, I've just downloaded php from cvs today (08.00 CET) and
> this script:
> 

[snip]

> 
> generates the following error:
> Unknown(0) : Warning - String is not zero-terminated (0) (source:
> zend_execute_API.c:274)
> 

Using this fix, it works for me, but I don't know if this is the right
way to go..

diff -u -u -r1.21 shmop.c
--- shmop.c     9 Jan 2002 08:02:21 -0000       1.21
+++ shmop.c     17 Jan 2002 10:11:02 -0000
@@ -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);
 }





-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to