diff options
author | Ondřej Surý <ondrej@sury.org> | 2010-10-21 08:52:46 +0200 |
---|---|---|
committer | Ondřej Surý <ondrej@sury.org> | 2010-10-21 08:52:46 +0200 |
commit | 01fcdff3849c3691d9aaeaab735846ab6d8895ca (patch) | |
tree | 6460876d356113fa7053df36f2aa00baa7db24a9 /ext/phar/tar.c | |
parent | 855a09f4eded707941180c9d90acd17c25e29447 (diff) | |
download | php-upstream/5.3.3.tar.gz |
Imported Upstream version 5.3.3upstream/5.3.3
Diffstat (limited to 'ext/phar/tar.c')
-rw-r--r-- | ext/phar/tar.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/ext/phar/tar.c b/ext/phar/tar.c index 53255b1d2..a0b6f511f 100644 --- a/ext/phar/tar.c +++ b/ext/phar/tar.c @@ -911,7 +911,8 @@ int phar_tar_flush(phar_archive_data *phar, char *user_stub, long len, int defau php_stream *oldfile, *newfile, *stubfile; int closeoldfile, free_user_stub, signature_length; struct _phar_pass_tar_info pass; - char *buf, *signature, sigbuf[8]; + char *buf, *signature, *tmp, sigbuf[8]; + char halt_stub[] = "__HALT_COMPILER();"; entry.flags = PHAR_ENT_PERM_DEF_FILE; entry.timestamp = time(NULL); @@ -990,7 +991,9 @@ int phar_tar_flush(phar_archive_data *phar, char *user_stub, long len, int defau free_user_stub = 0; } - if ((pos = strstr(user_stub, "__HALT_COMPILER();")) == NULL) { + tmp = estrndup(user_stub, len); + if ((pos = php_stristr(tmp, halt_stub, len, sizeof(halt_stub) - 1)) == NULL) { + efree(tmp); if (error) { spprintf(error, 0, "illegal stub for tar-based phar \"%s\"", phar->fname); } @@ -999,6 +1002,8 @@ int phar_tar_flush(phar_archive_data *phar, char *user_stub, long len, int defau } return EOF; } + pos = user_stub + (pos - tmp); + efree(tmp); len = pos - user_stub + 18; entry.fp = php_stream_fopen_tmpfile(); |