From 9577a20b3b0ee61e72218393f30c535d06b77ede Mon Sep 17 00:00:00 2001 From: Anatol Belski Date: Fri, 6 Mar 2015 16:41:57 +0100 Subject: [PATCH] fix invalid write --- win32/registry.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/win32/registry.c b/win32/registry.c index 30278fa0b2..f44e71a436 100644 --- a/win32/registry.c +++ b/win32/registry.c @@ -240,7 +240,7 @@ void UpdateIniFromRegistry(char *path) } zend_str_tolower(path, path_len); - while (path_len >= 0) { + while (path_len > 0) { HashTable *ht = (HashTable *)zend_hash_str_find_ptr(PW32G(registry_directories), path, path_len); if (ht != NULL) { @@ -252,11 +252,9 @@ void UpdateIniFromRegistry(char *path) } ZEND_HASH_FOREACH_END(); } - if (--path_len > 0) { - while (path_len > 0 && path[path_len] != '/') { - path_len--; - } - } + do { + path_len--; + } while (path_len > 0 && path[path_len] != '/'); path[path_len] = 0; } -- 2.49.0