diff options
-rw-r--r-- | camlibs/gsmart300/gsmart300.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/camlibs/gsmart300/gsmart300.c b/camlibs/gsmart300/gsmart300.c index c3709a31e..590262605 100644 --- a/camlibs/gsmart300/gsmart300.c +++ b/camlibs/gsmart300/gsmart300.c @@ -146,6 +146,11 @@ gsmart300_request_file (CameraPrivateLibrary * lib, CameraFile *file, file_size = data_size + GSMART_JPG_DEFAULT_HEADER_LENGTH + 1024 * 10; + if (flash_size < data_size) { + GP_DEBUG("flash_size %d is smaller than data_size %d\n", flash_size, data_size); + return GP_ERROR_CORRUPTED_DATA; + } + /* slurp in the image */ mybuf = malloc (flash_size); if (!mybuf) |