[php-maint] Bug#361855: patch
Allard Hoeve
allard at byte.nl
Wed Apr 12 08:47:02 UTC 2006
tags patch
thanks
The patch from CVS (adapted to fit 4:4.3.10-16) is attached.
CVS commit:
http://cvs.php.net/viewcvs.cgi/php-src/ext/standard/file.c?r1=1.279.2.70.2.4&r2=1.279.2.70.2.6&pathrev=PHP_4_4
Regards,
Allard
-------------- next part --------------
Index: file.c
===================================================================
--- file.c (revision 61)
+++ file.c (working copy)
@@ -555,7 +555,7 @@
pval **arg1, **arg2;
char *d;
char *opened_path;
- char p[64];
+ char *p;
FILE *fp;
if (ZEND_NUM_ARGS() != 2 || zend_get_parameters_ex(2, &arg1, &arg2) == FAILURE) {
@@ -569,14 +569,19 @@
}
d = estrndup(Z_STRVAL_PP(arg1), Z_STRLEN_PP(arg1));
- strlcpy(p, Z_STRVAL_PP(arg2), sizeof(p));
+ p = php_basename(Z_STRVAL_PP(arg2), Z_STRLEN_PP(arg2), NULL, 0);
+ if (strlen(p) > 64) {
+ p[63] = '\0';
+ }
+
if ((fp = php_open_temporary_file(d, p, &opened_path TSRMLS_CC))) {
fclose(fp);
RETVAL_STRING(opened_path, 0);
} else {
RETVAL_FALSE;
}
+ efree(p);
efree(d);
}
/* }}} */
More information about the pkg-php-maint
mailing list