diff options
Diffstat (limited to 'hw')
-rw-r--r-- | hw/usb/dev-mtp.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/hw/usb/dev-mtp.c b/hw/usb/dev-mtp.c index c2750e4..a95298b 100644 --- a/hw/usb/dev-mtp.c +++ b/hw/usb/dev-mtp.c @@ -702,7 +702,10 @@ static MTPData *usb_mtp_get_partial_object(MTPState *s, MTPControl *c, if (offset > o->stat.st_size) { offset = o->stat.st_size; } - lseek(d->fd, offset, SEEK_SET); + if (lseek(d->fd, offset, SEEK_SET) < 0) { + usb_mtp_data_free(d); + return NULL; + } d->length = c->argv[2]; if (d->length > o->stat.st_size - offset) { |