From e896e9fa29dca143fbe2773ab56305ba381ce405 Mon Sep 17 00:00:00 2001 From: Marcus Meissner Date: Sun, 26 Jan 2020 15:18:41 +0100 Subject: added size checking (AFL) --- camlibs/kodak/dc240/library.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/camlibs/kodak/dc240/library.c b/camlibs/kodak/dc240/library.c index d9949687b..f5d0d644e 100644 --- a/camlibs/kodak/dc240/library.c +++ b/camlibs/kodak/dc240/library.c @@ -760,6 +760,11 @@ int dc240_get_directory_list (Camera *camera, CameraList *list, const char *fold num_of_entries = be16atoh(&fdata [0]) + 1; total_size = 2 + (num_of_entries * 20); GP_DEBUG ("number of file entries : %d, size = %ld", num_of_entries, fsize); + if (total_size > fsize) { + GP_DEBUG ("total_size %d > fsize %ld", total_size, fsize); + gp_file_free (file); + return GP_ERROR; + } for (x = 2; x < total_size; x += 20) { if ((fdata[x] != '.') && (attrib == (unsigned char)fdata[x+11])) { /* Files have attrib 0x00, Folders have attrib 0x10 */ -- cgit v1.2.1