com php-src: phar module, unsignedness check changes. while at it, correcting seemingly subtle bug when checking extension validity.: ext/phar/phar.c
ext/phar/phar_object.c
| From: | Stanislav Malyshev | Date: | Mon, 18 Jun 2018 14:08:50 +0000 |
| Subject: | com php-src: phar module, unsignedness check changes. while at it, correcting seemingly subtle bug when checking extension validity.: ext/phar/phar.c ext/phar/phar_object.c |
||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-102196@lists.php.net to get a copy of this message | ||
Commit: 80bb649ad1ce83dc55481a279a86ccc8b7de5985
Author: David Carlier <devnexen@gmail.com> Mon, 18 Jun 2018 14:08:50 +0000
Parents: 84d7d4e1cc49e657068ddd6f2c57a93165ffb1a5
Branches: master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=80bb649ad1ce83dc55481a279a86ccc8b7de5985
Log:
phar module, unsignedness check changes.
while at it, correcting seemingly subtle bug when checking
extension validity.
Changed paths:
M ext/phar/phar.c
M ext/phar/phar_object.c
Diff:
diff --git a/ext/phar/phar.c b/ext/phar/phar.c
index de3475b..5b4f798 100644
--- a/ext/phar/phar.c
+++ b/ext/phar/phar.c
@@ -1853,14 +1853,14 @@ static int phar_check_str(const char *fname, const char *ext_str, size_t
ext_len
char test[51];
const char *pos;
- if (ext_len < 0 || ext_len >= 50) {
+ if (ext_len >= 50) {
return FAILURE;
}
if (executable == 1) {
/* copy "." as well */
- memcpy(test, ext_str - 1, ext_len + 1);
- test[ext_len + 1] = '\0';
+ strlcpy(test, ext_str, ext_len + 1);
+
/* executable phars must contain ".phar" as a valid extension (phar://.pharmy/oops is
invalid) */
/* (phar://hi/there/.phar/oops is also invalid) */
pos = strstr(test, ".phar");
diff --git a/ext/phar/phar_object.c b/ext/phar/phar_object.c
index 32a7a31..5f866c6 100644
--- a/ext/phar/phar_object.c
+++ b/ext/phar/phar_object.c
@@ -389,13 +389,6 @@ static void phar_postprocess_ru_web(char *fname, size_t fname_len, char
**entry,
u[0] = '\0';
u_len = strlen(u + 1);
e_len -= u_len + 1;
-
- if (e_len < 0) {
- if (saveu) {
- saveu[0] = '/';
- }
- return;
- }
} while (1);
}
/* }}} */