diff options
author | Stanislav Malyshev <stas@php.net> | 2016-11-03 20:45:13 -0700 |
---|---|---|
committer | Stanislav Malyshev <stas@php.net> | 2016-11-03 20:46:25 -0700 |
commit | 6e12e49b5be06b4346e3d7802ea9b09f9f1abd7b (patch) | |
tree | 4f1594c43a95c5ddd99b28098d60241bd4fff9bd /ext/zip/php_zip.c | |
parent | 7f2b7a4950bf30e6a13e89456275f53e5b66eb1f (diff) | |
parent | ea9fac94bbae150a81fde0e6542e6b45965772cd (diff) | |
download | php-git-6e12e49b5be06b4346e3d7802ea9b09f9f1abd7b.tar.gz |
Merge branch 'PHP-5.6' into PHP-7.0
* PHP-5.6:
More string length checks & fixes
Diffstat (limited to 'ext/zip/php_zip.c')
-rw-r--r-- | ext/zip/php_zip.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/ext/zip/php_zip.c b/ext/zip/php_zip.c index cfac566506..473e231b46 100644 --- a/ext/zip/php_zip.c +++ b/ext/zip/php_zip.c @@ -1590,7 +1590,7 @@ static ZIPARCHIVE_METHOD(addEmptyDir) } if (dirname[dirname_len-1] != '/') { - s=(char *)emalloc(dirname_len+2); + s=(char *)safe_emalloc(dirname_len, 1, 2); strcpy(s, dirname); s[dirname_len] = '/'; s[dirname_len+1] = '\0'; @@ -1805,14 +1805,14 @@ static ZIPARCHIVE_METHOD(addFromString) ze_obj = Z_ZIP_P(self); if (ze_obj->buffers_cnt) { - ze_obj->buffers = (char **)erealloc(ze_obj->buffers, sizeof(char *) * (ze_obj->buffers_cnt+1)); + ze_obj->buffers = (char **)safe_erealloc(ze_obj->buffers, sizeof(char *), (ze_obj->buffers_cnt+1), 0); pos = ze_obj->buffers_cnt++; } else { ze_obj->buffers = (char **)emalloc(sizeof(char *)); ze_obj->buffers_cnt++; pos = 0; } - ze_obj->buffers[pos] = (char *)emalloc(ZSTR_LEN(buffer) + 1); + ze_obj->buffers[pos] = (char *)safe_emalloc(ZSTR_LEN(buffer), 1, 1); memcpy(ze_obj->buffers[pos], ZSTR_VAL(buffer), ZSTR_LEN(buffer) + 1); zs = zip_source_buffer(intern, ze_obj->buffers[pos], ZSTR_LEN(buffer), 0); |