diff options
| author | Mark A. Hershberger <mah@debian.(none)> | 2009-03-25 00:37:27 -0400 |
|---|---|---|
| committer | Mark A. Hershberger <mah@debian.(none)> | 2009-03-25 00:37:27 -0400 |
| commit | 2d4e5b09576bb4f0ba716cc82cdf29ea04d9184b (patch) | |
| tree | 41ccc042009cba53e4ce43e727fcba4c1cfbf7f3 /ext/zip/lib/zip_close.c | |
| parent | d29a4fd2dd3b5d4cf6e80b602544d7b71d794e76 (diff) | |
| download | php-upstream/5.2.2.tar.gz | |
Imported Upstream version 5.2.2upstream/5.2.2
Diffstat (limited to 'ext/zip/lib/zip_close.c')
| -rw-r--r-- | ext/zip/lib/zip_close.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/ext/zip/lib/zip_close.c b/ext/zip/lib/zip_close.c index 3cb324d9c..e701321a8 100644 --- a/ext/zip/lib/zip_close.c +++ b/ext/zip/lib/zip_close.c @@ -247,7 +247,7 @@ zip_close(struct zip *za) chmod(za->zn, 0666&~mask); _zip_free(za); - + free(temp); return 0; } @@ -527,13 +527,14 @@ _zip_create_temp_output(struct zip *za, FILE **outp) char *temp; int tfd; FILE *tfp; + int len = strlen(za->zn) + 8; - if ((temp=(char *)malloc(strlen(za->zn)+8)) == NULL) { + if ((temp=(char *)malloc(len)) == NULL) { _zip_error_set(&za->error, ZIP_ER_MEMORY, 0); return NULL; } - sprintf(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); @@ -548,6 +549,9 @@ _zip_create_temp_output(struct zip *za, FILE **outp) free(temp); return NULL; } +#ifdef PHP_WIN32 + _setmode(_fileno(tfp), _O_BINARY ); +#endif *outp = tfp; return temp; |
