Skip to content

Commit

Permalink
Ensure the MakerNote data pointers are initialized with NULL.
Browse files Browse the repository at this point in the history
This ensures that an uninitialized pointer isn't dereferenced later in
the case where the number of components (and therefore size) is 0.

This fixes the second issue reported at
https://sourceforge.net/p/libexif/bugs/125/

CVE-2020-13113
  • Loading branch information
dfandrich authored and msmeissn committed May 16, 2020
1 parent 435e21f commit ec412aa
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions libexif/canon/exif-mnote-data-canon.c
Expand Up @@ -236,6 +236,7 @@ exif_mnote_data_canon_load (ExifMnoteData *ne,
for (i = c, o = datao; i; --i, o += 12) {
size_t s;

memset(&n->entries[tcount], 0, sizeof(MnoteCanonEntry));
if (CHECKOVERFLOW(o,buf_size,12)) {
exif_log (ne->log, EXIF_LOG_CODE_CORRUPT_DATA,
"ExifMnoteCanon", "Short MakerNote");
Expand Down
1 change: 1 addition & 0 deletions libexif/fuji/exif-mnote-data-fuji.c
Expand Up @@ -198,6 +198,7 @@ exif_mnote_data_fuji_load (ExifMnoteData *en,
for (i = c, o = datao; i; --i, o += 12) {
size_t s;

memset(&n->entries[tcount], 0, sizeof(MnoteFujiEntry));
if (CHECKOVERFLOW(o, buf_size, 12)) {
exif_log (en->log, EXIF_LOG_CODE_CORRUPT_DATA,
"ExifMnoteDataFuji", "Short MakerNote");
Expand Down
1 change: 1 addition & 0 deletions libexif/olympus/exif-mnote-data-olympus.c
Expand Up @@ -425,6 +425,7 @@ exif_mnote_data_olympus_load (ExifMnoteData *en,
tcount = 0;
for (i = c, o = o2; i; --i, o += 12) {
size_t s;
memset(&n->entries[tcount], 0, sizeof(MnoteOlympusEntry));
if (CHECKOVERFLOW(o, buf_size, 12)) {
exif_log (en->log, EXIF_LOG_CODE_CORRUPT_DATA,
"ExifMnoteOlympus", "Short MakerNote");
Expand Down
1 change: 1 addition & 0 deletions libexif/pentax/exif-mnote-data-pentax.c
Expand Up @@ -280,6 +280,7 @@ exif_mnote_data_pentax_load (ExifMnoteData *en,
for (i = c, o = datao; i; --i, o += 12) {
size_t s;

memset(&n->entries[tcount], 0, sizeof(MnotePentaxEntry));
if (CHECKOVERFLOW(o,buf_size,12)) {
exif_log (en->log, EXIF_LOG_CODE_CORRUPT_DATA,
"ExifMnoteDataPentax", "Short MakerNote");
Expand Down

0 comments on commit ec412aa

Please sign in to comment.