improve the check, avoid strlen on NULL

This commit is contained in:
Anatol Belski 2016-08-03 18:26:29 +02:00
parent f15c155363
commit 9667ee4f72

View File

@ -1708,11 +1708,11 @@ static void exif_iif_add_value(image_info_type *image_info, int section_index, c
if (!length)
break;
case TAG_FMT_UNDEFINED:
if (tag == TAG_MAKER_NOTE) {
length = MIN(length, strlen(value));
}
if (value) {
if (tag == TAG_MAKER_NOTE) {
length = MIN(length, strlen(value));
}
/* do not recompute length here */
info_value->s = estrndup(value, length);
info_data->length = length;