summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcus Meissner <meissner@suse.de>2020-02-14 12:59:19 +0100
committerMarcus Meissner <meissner@suse.de>2020-02-14 12:59:19 +0100
commit5963aa4c3d30395605e24384114403024049353d (patch)
treeb4e6e771d15dbb45931863430db6b179d0961700
parent739b75da570faf031856d0a0765cf06ed8b09a86 (diff)
downloadlibgphoto2-5963aa4c3d30395605e24384114403024049353d.tar.gz
error checking during file retrieval (AFL)
-rw-r--r--camlibs/kodak/dc240/library.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/camlibs/kodak/dc240/library.c b/camlibs/kodak/dc240/library.c
index a77d0999c..61e806ad6 100644
--- a/camlibs/kodak/dc240/library.c
+++ b/camlibs/kodak/dc240/library.c
@@ -708,16 +708,21 @@ int dc240_get_status (Camera *camera, DC240StatusTable *table, GPContext *contex
retval = dc240_packet_exchange(camera, file, p, NULL, &size, 256, context);
if (retval == GP_OK) {
- gp_file_get_data_and_size (file, &fdata, &fsize);
+ retval = gp_file_get_data_and_size (file, &fdata, &fsize);
+ if (retval != GP_OK) goto exit;
if (fsize != 256) {
GP_DEBUG ("wrong status packet size ! Size is %ld", fsize);
+ retval = GP_ERROR;
+ goto exit;
}
if (fdata [0] != 0x01) { /* see 2.6 for why 0x01 */
GP_DEBUG ("not a status table. Is %d", fdata [0]);
+ retval = GP_ERROR;
+ goto exit;
}
dc240_load_status_data_to_table ((uint8_t *)fdata, table);
}
-
+exit:
gp_file_free(file);
free (p);