]> granicus.if.org Git - php/commitdiff
- MFB: Fixed snprintf() usage
authorPierre Joye <pajoye@php.net>
Sat, 24 Feb 2007 19:09:18 +0000 (19:09 +0000)
committerPierre Joye <pajoye@php.net>
Sat, 24 Feb 2007 19:09:18 +0000 (19:09 +0000)
ext/zip/lib/zip_close.c

index bd6b59dcfa016b70ec97f07c7192afcaeb302b53..61d75837290df574ba60f796e8ee59e06548eb17 100644 (file)
@@ -528,12 +528,14 @@ _zip_create_temp_output(struct zip *za, FILE **outp)
     int tfd;
     FILE *tfp;
 
-    if ((temp=(char *)malloc(strlen(za->zn)+8)) == NULL) {
+    int len = strlen(za->zn) + 8;
+
+    if ((temp=(char *)malloc(len)) == NULL) {
        _zip_error_set(&za->error, ZIP_ER_MEMORY, 0);
        return NULL;
     }
 
-    snprintf(temp, sizeof(temp), "%s.XXXXXX", za->zn);
+    snprintf(temp, len, "%s.XXXXXX", za->zn);
 
     if ((tfd=mkstemp(temp)) == -1) {
        _zip_error_set(&za->error, ZIP_ER_TMPOPEN, errno);