Skip to content

Commit 80bb649

Browse files
committed
phar module, unsignedness check changes.
while at it, correcting seemingly subtle bug when checking extension validity.
1 parent 84d7d4e commit 80bb649

File tree

2 files changed

+3
-10
lines changed

2 files changed

+3
-10
lines changed

ext/phar/phar.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1853,14 +1853,14 @@ static int phar_check_str(const char *fname, const char *ext_str, size_t ext_len
18531853
char test[51];
18541854
const char *pos;
18551855

1856-
if (ext_len < 0 || ext_len >= 50) {
1856+
if (ext_len >= 50) {
18571857
return FAILURE;
18581858
}
18591859

18601860
if (executable == 1) {
18611861
/* copy "." as well */
1862-
memcpy(test, ext_str - 1, ext_len + 1);
1863-
test[ext_len + 1] = '\0';
1862+
strlcpy(test, ext_str, ext_len + 1);
1863+
18641864
/* executable phars must contain ".phar" as a valid extension (phar://.pharmy/oops is invalid) */
18651865
/* (phar://hi/there/.phar/oops is also invalid) */
18661866
pos = strstr(test, ".phar");

ext/phar/phar_object.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -389,13 +389,6 @@ static void phar_postprocess_ru_web(char *fname, size_t fname_len, char **entry,
389389
u[0] = '\0';
390390
u_len = strlen(u + 1);
391391
e_len -= u_len + 1;
392-
393-
if (e_len < 0) {
394-
if (saveu) {
395-
saveu[0] = '/';
396-
}
397-
return;
398-
}
399392
} while (1);
400393
}
401394
/* }}} */

0 commit comments

Comments
 (0)