summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnatol Belski <ab@php.net>2015-03-06 16:41:57 +0100
committerAnatol Belski <ab@php.net>2015-03-06 16:42:31 +0100
commit9577a20b3b0ee61e72218393f30c535d06b77ede (patch)
tree6422f7228974669517bce222731c4ae18a277b19
parent66f5a1e8b4de3c691a5de84fb08715c78401bf6b (diff)
downloadphp-git-9577a20b3b0ee61e72218393f30c535d06b77ede.tar.gz
fix invalid write
-rw-r--r--win32/registry.c10
1 files 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;
}