com php-src: Fixed bug #68671 incorrect expression in libmagic: NEWS ext/fileinfo/libmagic/print.c
| From: | Anatol Belski | Date: | Tue, 30 Dec 2014 18:37:27 +0000 |
| Subject: | com php-src: Fixed bug #68671 incorrect expression in libmagic: NEWS ext/fileinfo/libmagic/print.c | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-83943@lists.php.net to get a copy of this message | ||
Commit: d92a87d7cb81f94b8705cdbeaa1b3836dc145549
Author: Anatol Belski <ab@php.net> Tue, 30 Dec 2014 19:37:27 +0100
Parents: 211f4ceeaec62929eb1e217ceadaac037b1cb799
Branches: PHP-5.5 PHP-5.6 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=d92a87d7cb81f94b8705cdbeaa1b3836dc145549
Log:
Fixed bug #68671 incorrect expression in libmagic
Bugs:
https://bugs.php.net/68671
Changed paths:
M NEWS
M ext/fileinfo/libmagic/print.c
Diff:
diff --git a/NEWS b/NEWS
index f91a555..af21bb4 100644
--- a/NEWS
+++ b/NEWS
@@ -25,6 +25,10 @@ PHP NEWS
. Fixed bug #67643 (curl_multi_getcontent returns '' when
CURLOPT_RETURNTRANSFER isn't set). (Jille Timmermans)
+- Fileinfo:
+ . Fixed bug #68671 (incorrect expression in libmagic).
+ (Joshua Rogers, Anatol Belski)
+
- GD:
. Fixed bug #68601 (buffer read overflow in gd_gif_in.c). (Jan Bee, Remi)
diff --git a/ext/fileinfo/libmagic/print.c b/ext/fileinfo/libmagic/print.c
index eb4e6e8..26bb2f7 100644
--- a/ext/fileinfo/libmagic/print.c
+++ b/ext/fileinfo/libmagic/print.c
@@ -59,16 +59,19 @@ protected void
file_magwarn(struct magic_set *ms, const char *f, ...)
{
va_list va;
- char *expanded_format;
+ char *expanded_format = NULL;
+ int expanded_len;
TSRMLS_FETCH();
va_start(va, f);
- if (vasprintf(&expanded_format, f, va)); /* silence */
+ expanded_len = vasprintf(&expanded_format, f, va);
va_end(va);
- php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Warning: %s", expanded_format);
+ if (expanded_len >= 0 && expanded_format) {
+ php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Warning: %s", expanded_format);
- free(expanded_format);
+ free(expanded_format);
+ }
}
protected const char *