]> granicus.if.org Git - php/commitdiff
- Fixed bug #62227 (Invalid phar stream path causes crash)
authorFelipe Pena <felipensp@gmail.com>
Mon, 4 Jun 2012 23:07:14 +0000 (20:07 -0300)
committerFelipe Pena <felipensp@gmail.com>
Mon, 4 Jun 2012 23:07:14 +0000 (20:07 -0300)
ext/phar/phar.c

index 4ab2b863765e46782db6d3e6768a432b648630cb..8a0ebfae188673b44d5bd3a07b3112946214b8ce 100644 (file)
@@ -1799,7 +1799,11 @@ static int phar_analyze_path(const char *fname, const char *ext, int ext_len, in
 #ifdef PHP_WIN32
                                phar_unixify_path_separators(realpath, strlen(realpath));
 #endif
-                               a = strstr(realpath, fname) + ((ext - fname) + ext_len);
+                               if ((a = strstr(realpath, fname)) == NULL) {
+                                       return FAILURE;
+                               }
+                               
+                               a += ((ext - fname) + ext_len);
                                *a = '\0';
                                slash = strrchr(realpath, '/');