summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcus Meissner <marcus@jet.franken.de>2019-05-12 10:22:04 +0200
committerMarcus Meissner <marcus@jet.franken.de>2019-05-12 10:22:04 +0200
commit1a60b35aa34261f26b10b96864b44ded84fc4011 (patch)
tree57657809249d76ab9b2bb78a7f8a5b4cfb4342b5
parenta11a83b29c6b5755679a0a22ccd5f686c0c1a9d6 (diff)
downloadlibgphoto2-1a60b35aa34261f26b10b96864b44ded84fc4011.tar.gz
avoid nevative reads (AFL)
-rw-r--r--camlibs/ricoh/g3.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/camlibs/ricoh/g3.c b/camlibs/ricoh/g3.c
index 073cb8edf..af37467d8 100644
--- a/camlibs/ricoh/g3.c
+++ b/camlibs/ricoh/g3.c
@@ -89,6 +89,8 @@ g3_channel_read(GPPort *port, int *channel, char **buffer, unsigned int *len)
int toread = 0x800;
if (toread + curlen > *len + 1 + 0x800)
toread = *len + 1 + 0x800 - curlen;
+ if (toread <= 0)
+ break;
ret = gp_port_read(port, *buffer + curlen, toread);
if (ret < GP_OK) {