CVS update: php4
| From: | zeev | Date: | Sat, 26 Jun 1999 12:27:50 +0000 |
| Subject: | CVS update: php4 | ||
| Groups: | php.version4 | ||
| Request: | Send a blank email to php-version4+get-1683@lists.php.net to get a copy of this message | ||
Date: Saturday June 26, 1999 @ 8:27
Author: zeev
Update of /repository/php4
In directory php:/tmp/cvs-serv17142
Modified Files:
main.c
Log Message:
Protect against NULL arguments in filename
Index: php4/main.c
diff -u php4/main.c:1.77 php4/main.c:1.78
--- php4/main.c:1.77 Tue Jun 22 15:07:01 1999
+++ php4/main.c Sat Jun 26 08:27:49 1999
@@ -29,7 +29,7 @@
+----------------------------------------------------------------------+
*/
-/* $Id: main.c,v 1.77 1999/06/22 19:07:01 zeev Exp $ */
+/* $Id: main.c,v 1.78 1999/06/26 12:27:49 zeev Exp $ */
#include <stdio.h>
@@ -115,6 +115,8 @@
#endif
+#define SAFE_FILENAME(f) ((f)?(f):"-")
+
static PHP_INI_MH(OnSetPrecision)
{
ELS_FETCH();
@@ -603,9 +605,9 @@
void *ptr = (void *)((char *)t+sizeof(mem_header)+PLATFORM_PADDING);
#if WIN32||WINNT
- snprintf(memory_leak_buf, 512, "%s(%d) : Freeing 0x%0.8X (%d bytes), script=%s\n",
t->filename, t->lineno, (unsigned long)ptr, t->size, SG(request_info).path_translated);
+ snprintf(memory_leak_buf, 512, "%s(%d) : Freeing 0x%0.8X (%d bytes), script=%s\n",
t->filename, t->lineno, (unsigned long)ptr, t->size,
SAFE_FILENAME(SG(request_info).path_translated));
#else
- snprintf(memory_leak_buf, 512, "%s: Freeing 0x%0.8lX (%d bytes), allocated in %s on
line %d<br>\n", SG(request_info).path_translated, (unsigned long)ptr,
t->size,t->filename,t->lineno);
+ snprintf(memory_leak_buf, 512, "%s: Freeing 0x%0.8lX (%d bytes), allocated in %s on
line %d<br>\n", SAFE_FILENAME(SG(request_info).path_translated), (unsigned long)ptr,
t->size,t->filename,t->lineno);
#endif
} else {
unsigned long leak_count = (unsigned long) data;
@@ -613,7 +615,7 @@
#if WIN32||WINNT
snprintf(memory_leak_buf, 512, "Last leak repeated %ld time%s\n", leak_count,
(leak_count>1?"s":""));
#else
- snprintf(memory_leak_buf, 512, "%s: Last leak repeated %ld time%s\n",
SG(request_info).path_translated, leak_count, (leak_count>1?"s":""));
+ snprintf(memory_leak_buf, 512, "%s: Last leak repeated %ld time%s\n",
SAFE_FILENAME(SG(request_info).path_translated), leak_count,
(leak_count>1?"s":""));
#endif
}
# if WIN32||WINNT
@@ -628,7 +630,7 @@
case ZMSG_LOG_SCRIPT_NAME: {
SLS_FETCH();
- fprintf(stderr, "Script: '%s'\n", SG(request_info).path_translated);
+ fprintf(stderr, "Script: '%s'\n",
SAFE_FILENAME(SG(request_info).path_translated));
}
break;
}