diff options
author | Marcus Meissner <marcus@jet.franken.de> | 2016-10-29 11:47:05 +0200 |
---|---|---|
committer | Marcus Meissner <marcus@jet.franken.de> | 2016-10-29 11:47:05 +0200 |
commit | 4f94f072d79b1a4560087d768f4b5123baac155e (patch) | |
tree | a8e5c8e83dcda017aa5a919d635f5b58dc24d177 /libgphoto2_port/vusb | |
parent | 83c04703bb72f2a5d56a542273cdc101d191efc7 (diff) | |
download | libgphoto2-4f94f072d79b1a4560087d768f4b5123baac155e.tar.gz |
in fuzz mode be less strict with opcodes
fixed read from file mode
Diffstat (limited to 'libgphoto2_port/vusb')
-rw-r--r-- | libgphoto2_port/vusb/vcamera.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/libgphoto2_port/vusb/vcamera.c b/libgphoto2_port/vusb/vcamera.c index 0114ec61f..bf3980d46 100644 --- a/libgphoto2_port/vusb/vcamera.c +++ b/libgphoto2_port/vusb/vcamera.c @@ -1763,7 +1763,12 @@ vcam_process_output(vcamera *cam) { } } gp_log (GP_LOG_ERROR,__FUNCTION__,"received an unsupported opcode 0x%04x", ptp.code); +#ifdef FUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION + /* in fuzzing mode, be less strict with unknown opcodes */ ptp_response (cam, PTP_RC_OperationNotSupported, 0); +#else + ptp_response (cam, PTP_RC_OK, 0); +#endif } static int @@ -1773,11 +1778,12 @@ vcam_read(vcamera*cam, int ep, char *data, int bytes) { if (toread > cam->nrinbulk) toread = cam->nrinbulk; if (cam->fuzzf) { - int i, hasread; + int hasread; memset(data,0,toread); if (cam->fuzzmode == FUZZMODE_PROTOCOL) { - fwrite(cam->inbulk[i], 1, toread, cam->fuzzf); + fwrite(cam->inbulk, 1, toread, cam->fuzzf); + memcpy (data, cam->inbulk, toread); } else { hasread = fread(data, 1, toread, cam->fuzzf); |