Skip to content
Permalink
Browse files Browse the repository at this point in the history
Avoid potentially dangerous signed to unsigned conversion
We make sure to never pass a negative `rlen` as size to memcpy(). See
also <https://bugs.php.net/bug.php?id=73280>.

Patch provided by Emmanuel Law.
  • Loading branch information
cmb69 committed Oct 12, 2016
1 parent 4a03b38 commit 5311087
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/gd_io_dp.c
Expand Up @@ -276,7 +276,7 @@ static int dynamicGetbuf(gdIOCtxPtr ctx, void *buf, int len)
if(remain >= len) {
rlen = len;
} else {
if(remain == 0) {
if(remain <= 0) {
/* 2.0.34: EOF is incorrect. We use 0 for
* errors and EOF, just like fileGetbuf,
* which is a simple fread() wrapper.
Expand Down

0 comments on commit 5311087

Please sign in to comment.