com php-src: make it safer for an array underrun: ext/zip/php _zip.c
| From: | Anatol Belski | Date: | Sun, 14 Sep 2014 13:03:52 +0000 |
| Subject: | com php-src: make it safer for an array underrun: ext/zip/php _zip.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-81598@lists.php.net to get a copy of this message | ||
Commit: 454548e44032d40ba49e2041c552bedbff49a468
Author: Anatol Belski <ab@php.net> Sun, 14 Sep 2014 15:03:52 +0200
Parents: 6a92d321050eebbbd959f5b98cf9eff122faf91e
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=454548e44032d40ba49e2041c552bedbff49a468
Log:
make it safer for an array underrun
Changed paths:
M ext/zip/php_zip.c
Diff:
diff --git a/ext/zip/php_zip.c b/ext/zip/php_zip.c
index 0f6a6bf..4cac8b3 100644
--- a/ext/zip/php_zip.c
+++ b/ext/zip/php_zip.c
@@ -1610,9 +1610,9 @@ static void php_zip_add_from_pattern(INTERNAL_FUNCTION_PARAMETERS, int type)
/*
}
if (remove_path && remove_path_len > 1) {
- int tmp_idx = (int)strlen(remove_path) - 1;
- if (remove_path[tmp_idx] == '/' || remove_path[tmp_idx] == '\\') {
- remove_path[tmp_idx] = '\0';
+ size_t real_len = strlen(remove_path);
+ if (real_len > 1 && remove_path[real_len - 1] == '/' || remove_path[real_len
- 1] == '\\') {
+ remove_path[real_len - 1] = '\0';
}
}