Skip to content

Commit 5f9c82d

Browse files
committed
Fix #80366: Return Value of zend_fstat() not Checked
In the somewhat unlikely case that `zend_fstat()` fails, we must not proceed executing the function, but return `false` instead. Patch based on the patch contributed by sagpant at microsoft dot com. Closes GH-6432.
1 parent fa713ec commit 5f9c82d

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ PHP NEWS
1111
. Fixed bug #80362 (Running dtrace scripts can cause php to crash).
1212
(al at coralnet dot name)
1313

14+
- Standard:
15+
. Fixed bug #80366 (Return Value of zend_fstat() not Checked). (sagpant, cmb)
16+
1417
- Tidy:
1518
. Fixed bug #77594 (ob_tidyhandler is never reset). (cmb)
1619

ext/standard/iptc.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,7 +217,9 @@ PHP_FUNCTION(iptcembed)
217217
}
218218

219219
if (spool < 2) {
220-
zend_fstat(fileno(fp), &sb);
220+
if (zend_fstat(fileno(fp), &sb) != 0) {
221+
RETURN_FALSE;
222+
}
221223

222224
spoolbuf = zend_string_safe_alloc(1, iptcdata_len + sizeof(psheader) + 1024 + 1, sb.st_size, 0);
223225
poi = (unsigned char*)ZSTR_VAL(spoolbuf);

0 commit comments

Comments
 (0)