]> granicus.if.org Git - php/commitdiff
improve the check, avoid strlen on NULL
authorAnatol Belski <ab@php.net>
Wed, 3 Aug 2016 16:26:29 +0000 (18:26 +0200)
committerAnatol Belski <ab@php.net>
Wed, 3 Aug 2016 16:26:29 +0000 (18:26 +0200)
ext/exif/exif.c

index 94652e909b35f3d9ea3b2c1bdebee7278aaeb6e7..f95de3a14f199068ed7b83c424019f9a6ea7c581 100644 (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;