com php-src: improve the check, avoid strlen on NULL: ext/exif/exif.c
| From: | Anatol Belski | Date: | Wed, 03 Aug 2016 16:26:29 +0000 |
| Subject: | com php-src: improve the check, avoid strlen on NULL: ext/exif/exif.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-93584@lists.php.net to get a copy of this message | ||
Commit: 9667ee4f72c7dafce993b71104a52beb7c3aff15
Author: Anatol Belski <ab@php.net> Wed, 3 Aug 2016 18:26:29 +0200
Parents: f15c1553635ccb33c5f24d8ffe7a1cd05de5fe91
Branches: PHP-5.6 PHP-7.0 PHP-7.1 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=9667ee4f72c7dafce993b71104a52beb7c3aff15
Log:
improve the check, avoid strlen on NULL
Changed paths:
M ext/exif/exif.c
Diff:
diff --git a/ext/exif/exif.c b/ext/exif/exif.c
index 94652e9..f95de3a 100644
--- a/ext/exif/exif.c
+++ b/ext/exif/exif.c
@@ -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;