diff options
Diffstat (limited to 'ext/phar/zip.c')
-rw-r--r-- | ext/phar/zip.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/ext/phar/zip.c b/ext/phar/zip.c index e4883d3533..7f294c2de2 100644 --- a/ext/phar/zip.c +++ b/ext/phar/zip.c @@ -159,7 +159,7 @@ static void phar_zip_u2d_time(time_t time, char *dtime, char *ddate) /* {{{ */ * * Parse a new one and add it to the cache, returning either SUCCESS or * FAILURE, and setting pphar to the pointer to the manifest entry - * + * * This is used by phar_open_from_fp to process a zip-based phar, but can be called * directly. */ @@ -199,7 +199,7 @@ int phar_parse_zipfile(php_stream *fp, char *fname, int fname_len, char *alias, } while ((p=(char *) memchr(p + 1, 'P', (size_t) (size - (p + 1 - buf)))) != NULL) { - if (!memcmp(p + 1, "K\5\6", 3)) { + if ((p - buf) + sizeof(locator) <= size && !memcmp(p + 1, "K\5\6", 3)) { memcpy((void *)&locator, (void *) p, sizeof(locator)); if (PHAR_GET_16(locator.centraldisk) != 0 || PHAR_GET_16(locator.disknumber) != 0) { /* split archives not handled */ @@ -1161,7 +1161,7 @@ int phar_zip_flush(phar_archive_data *phar, char *user_stub, long len, int defau static const char newstub[] = "<?php // zip-based phar archive stub file\n__HALT_COMPILER();"; char halt_stub[] = "__HALT_COMPILER();"; char *tmp; - + php_stream *stubfile, *oldfile; php_serialize_data_t metadata_hash; int free_user_stub, closeoldfile = 0; |