]> granicus.if.org Git - php/commitdiff
make sure the slash is actually thre before reading past it
authorAntony Dovgal <tony2001@php.net>
Wed, 12 Nov 2008 09:05:48 +0000 (09:05 +0000)
committerAntony Dovgal <tony2001@php.net>
Wed, 12 Nov 2008 09:05:48 +0000 (09:05 +0000)
Zend/zend_execute_API.c

index 10f0ad5056c31da7dabc196e1cf9c31bee7eafb5..50a8598df11c77ad322c46775188ae63a4641e43 100644 (file)
@@ -517,10 +517,10 @@ ZEND_API int zval_update_constant_ex(zval **pp, void *arg, zend_class_entry *sco
                                        Z_STRVAL_P(p) = colon + 1;
                                }
                        } else {
-                               char *save = actual;
+                               char *save = actual, *slash;
                                int actual_len = Z_STRLEN_P(p);
-                               if (Z_TYPE_P(p) & IS_CONSTANT_UNQUALIFIED) {
-                                       actual = (char *)zend_memrchr(actual, '\\', actual_len) + 1;
+                               if ((Z_TYPE_P(p) & IS_CONSTANT_UNQUALIFIED) && (slash = (char *)zend_memrchr(actual, '\\', actual_len))) {
+                                       actual = slash + 1;
                                        actual_len -= (actual - Z_STRVAL_P(p));
                                        if (inline_change) {
                                                actual = estrndup(actual, actual_len);