com php-src: improve the check, avoid strlen on NULL: ext/exif/exif.c
| From: | Anatol Belski | Date: | Wed, 03 Aug 2016 16:31: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-93587@lists.php.net to get a copy of this message | ||
Commit: 8889b13853481c31b2c652b1c1bbc8d42468542e
Author: Anatol Belski <ab@php.net> Wed, 3 Aug 2016 18:26:29 +0200
Parents: e0e2323e7d06738155c2657cc34707cb5ea139c5
Branches: PHP-7.0.10
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=8889b13853481c31b2c652b1c1bbc8d42468542e
Log:
improve the check, avoid strlen on NULL
(cherry picked from commit 9667ee4f72c7dafce993b71104a52beb7c3aff15)
Changed paths:
M ext/exif/exif.c
Diff:
diff --git a/ext/exif/exif.c b/ext/exif/exif.c
index a745218..611b106 100644
--- a/ext/exif/exif.c
+++ b/ext/exif/exif.c
@@ -1702,11 +1702,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;