cvs: php4 /ext/standard string.c
| From: | Stanislav Malyshev | Date: | Thu, 22 Feb 2001 10:36:41 +0000 |
| Subject: | cvs: php4 /ext/standard string.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-4201@lists.php.net to get a copy of this message | ||
stas Thu Feb 22 02:36:41 2001 EDT
Modified files:
/php4/ext/standard string.c
Log:
Safer bin2hex
Index: php4/ext/standard/string.c
diff -u php4/ext/standard/string.c:1.189 php4/ext/standard/string.c:1.190
--- php4/ext/standard/string.c:1.189 Sun Feb 18 10:31:31 2001
+++ php4/ext/standard/string.c Thu Feb 22 02:36:40 2001
@@ -18,7 +18,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: string.c,v 1.189 2001/02/18 18:31:31 thies Exp $ */
+/* $Id: string.c,v 1.190 2001/02/22 10:36:40 stas Exp $ */
/* Synced with php 3.0 revision 1.193 1999-06-16 [ssb] */
@@ -96,7 +96,7 @@
unsigned char *result = NULL;
size_t i, j;
- result = (char *) emalloc(oldlen * 2 * sizeof(char));
+ result = (char *) emalloc(oldlen * 2 * sizeof(char) + 1);
if(!result) {
return result;
}
@@ -105,6 +105,7 @@
result[j++] = hexconvtab[old[i] >> 4];
result[j++] = hexconvtab[old[i] & 15];
}
+ result[j] = '\0';
if(newlen) *newlen = oldlen * 2 * sizeof(char);