Re: cvs: php4 /ext/pgsql pgsql.c

From: Date: Sun, 24 Nov 2002 15:08:12 +0000
Subject: Re: cvs: php4 /ext/pgsql pgsql.c
References: 1  Groups: php.cvs 
Request: Send a blank email to php-cvs+get-16615@lists.php.net to get a copy of this message
At 08:45 24.11.2002, Yasuo Ohgaki wrote:
yohgaki         Sun Nov 24 02:45:27 2002 EDT
Modified files:
    /php4/ext/pgsql     pgsql.c
Log: Added missing '\0' Index: php4/ext/pgsql/pgsql.c diff -u php4/ext/pgsql/pgsql.c:1.244 php4/ext/pgsql/pgsql.c:1.245
--- php4/ext/pgsql/pgsql.c:1.244        Tue Nov 12 04:07:36 2002
+++ php4/ext/pgsql/pgsql.c      Sun Nov 24 02:45:26 2002
@@ -19,7 +19,7 @@
    +----------------------------------------------------------------------+
*/ -/* $Id: pgsql.c,v 1.244 2002/11/12 09:07:36 yohgaki Exp $ */ +/* $Id: pgsql.c,v 1.245 2002/11/24 07:45:26 yohgaki Exp $ */ #include <stdlib.h> @@ -2730,7 +2730,8 @@
                                break;
                }
        }
-       buffer = erealloc(buffer, buflen);
+       buffer[buflen] = '\0';
+       buffer = erealloc(buffer, buflen+1);
        if (buffer == NULL)
                return NULL;
Erm shoudln't this better read:
+       buffer = erealloc(buffer, buflen+1);
+       buffer[buflen] = '\0';
as i understand the could it is possible that buflen will not be decremented and then you would write zero behind the allocated buffer. marcus

« previous php.cvs (#16615) next »