Skip to content

Commit e524658

Browse files
committed
Fix bug #73773 - Seg fault when loading hostile phar
1 parent 16b3003 commit e524658

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

ext/phar/phar.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1054,7 +1054,7 @@ static int phar_parse_pharfile(php_stream *fp, char *fname, int fname_len, char
10541054
entry.is_persistent = mydata->is_persistent;
10551055

10561056
for (manifest_index = 0; manifest_index < manifest_count; ++manifest_index) {
1057-
if (buffer + 24 > endbuffer) {
1057+
if (buffer + 28 > endbuffer) {
10581058
MAPPHAR_FAIL("internal corruption of phar \"%s\" (truncated manifest entry)")
10591059
}
10601060

@@ -1068,7 +1068,7 @@ static int phar_parse_pharfile(php_stream *fp, char *fname, int fname_len, char
10681068
entry.manifest_pos = manifest_index;
10691069
}
10701070

1071-
if (entry.filename_len > endbuffer - buffer - 20) {
1071+
if (entry.filename_len > endbuffer - buffer - 24) {
10721072
MAPPHAR_FAIL("internal corruption of phar \"%s\" (truncated manifest entry)");
10731073
}
10741074

0 commit comments

Comments
 (0)