cvs: php4(PHP_4_3) /ext/pgsql pgsql.c
| From: | Yasuo Ohgaki | Date: | Tue, 26 Nov 2002 02:15:59 +0000 |
| Subject: | cvs: php4(PHP_4_3) /ext/pgsql pgsql.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-16650@lists.php.net to get a copy of this message | ||
yohgaki Mon Nov 25 21:15:59 2002 EDT
Modified files: (Branch: PHP_4_3)
/php4/ext/pgsql pgsql.c
Log:
MFH
Index: php4/ext/pgsql/pgsql.c
diff -u php4/ext/pgsql/pgsql.c:1.244 php4/ext/pgsql/pgsql.c:1.244.2.1
--- php4/ext/pgsql/pgsql.c:1.244 Tue Nov 12 04:07:36 2002
+++ php4/ext/pgsql/pgsql.c Mon Nov 25 21:15:58 2002
@@ -19,7 +19,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: pgsql.c,v 1.244 2002/11/12 09:07:36 yohgaki Exp $ */
+/* $Id: pgsql.c,v 1.244.2.1 2002/11/26 02:15:58 yohgaki Exp $ */
#include <stdlib.h>
@@ -2710,15 +2710,13 @@
case 3:
if (isdigit(*sp)) /* state=4 */
{
- unsigned int v,i;
- unsigned char buf[4]; /* 000 + '\0' */
-
+ unsigned char *start, *end, buf[4]; /* 000 + '\0' */
+
bp -= 3;
- for (i = 0; i < 3; i++)
- buf[i] = *((sp-2)+i);
- buf[i] = '\0';
- sscanf(buf, "%03o", &v);
- *bp = v;
+ memcpy(buf, sp-2, 3);
+ buf[3] = '\0';
+ start = buf;
+ *bp = (unsigned char)strtoul(start, (char **)&end, 8);
buflen -= 3;
state = 0;
}
@@ -2730,9 +2728,8 @@
break;
}
}
- buffer = erealloc(buffer, buflen);
- if (buffer == NULL)
- return NULL;
+ buffer = erealloc(buffer, buflen+1);
+ buffer[buflen] = '\0';
*retbuflen = buflen;
return buffer;