Skip to content

Commit 8889b13

Browse files
committed
improve the check, avoid strlen on NULL
(cherry picked from commit 9667ee4)
1 parent e0e2323 commit 8889b13

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

ext/exif/exif.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1702,11 +1702,11 @@ static void exif_iif_add_value(image_info_type *image_info, int section_index, c
17021702
if (!length)
17031703
break;
17041704
case TAG_FMT_UNDEFINED:
1705-
if (tag == TAG_MAKER_NOTE) {
1706-
length = MIN(length, strlen(value));
1707-
}
1708-
17091705
if (value) {
1706+
if (tag == TAG_MAKER_NOTE) {
1707+
length = MIN(length, strlen(value));
1708+
}
1709+
17101710
/* do not recompute length here */
17111711
info_value->s = estrndup(value, length);
17121712
info_data->length = length;

0 commit comments

Comments
 (0)