]> granicus.if.org Git - php/commitdiff
Fix #73280: Stack Buffer Overflow in GD dynamicGetbuf
authorChristoph M. Becker <cmbecker69@gmx.de>
Thu, 13 Oct 2016 09:10:02 +0000 (11:10 +0200)
committerAnatol Belski <ab@php.net>
Fri, 14 Oct 2016 00:02:42 +0000 (02:02 +0200)
We make sure to never pass a negative `rlen` as size to memcpy().

Cf. <https://github.com/libgd/libgd/commit/53110871>.

(cherry picked from commit cc08cbc84d46933c1e9e0149633f1ed5d19e45e9)

ext/gd/libgd/gd_io_dp.c

index bfeb4cb4bb9aa59bbab842df5294fb05849822b6..4dcedde8ccbc4afa7825d0abdffe4ab948bebe1a 100644 (file)
@@ -237,7 +237,7 @@ static int dynamicGetbuf (gdIOCtxPtr ctx, void *buf, int len)
        if (remain >= len) {
                rlen = len;
        } else {
-               if (remain == 0) {
+               if (remain <= 0) {
                        return EOF;
                }
                rlen = remain;