From 9c28303a2b9f5415b9695d967092a03226764c01 Mon Sep 17 00:00:00 2001 From: Marcus Meissner Date: Fri, 9 Dec 2016 19:47:55 +0100 Subject: handle short reads --- libgphoto2_port/vusb/vcamera.c | 3 +++ 1 file changed, 3 insertions(+) (limited to 'libgphoto2_port/vusb') diff --git a/libgphoto2_port/vusb/vcamera.c b/libgphoto2_port/vusb/vcamera.c index c452e1143..360f4e6d8 100644 --- a/libgphoto2_port/vusb/vcamera.c +++ b/libgphoto2_port/vusb/vcamera.c @@ -1805,6 +1805,9 @@ vcam_read(vcamera*cam, int ep, unsigned char *data, int bytes) { cam->fuzzpending = toread - bytes; toread = bytes; } + if (toread <= 4) + return toread; + toread -= 4; hasread = fread(data + 4, 1, toread, cam->fuzzf); -- cgit v1.2.1