Skip to content

Commit 091ea62

Browse files
committed
Merge branch 'PHP-5.5' into PHP-5.6
* PHP-5.5: Fixed bug #68671 incorrect expression in libmagic
2 parents 3ef6e37 + d92a87d commit 091ea62

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

ext/fileinfo/libmagic/print.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,16 +59,19 @@ protected void
5959
file_magwarn(struct magic_set *ms, const char *f, ...)
6060
{
6161
va_list va;
62-
char *expanded_format;
62+
char *expanded_format = NULL;
63+
int expanded_len;
6364
TSRMLS_FETCH();
6465

6566
va_start(va, f);
66-
if (vasprintf(&expanded_format, f, va)); /* silence */
67+
expanded_len = vasprintf(&expanded_format, f, va);
6768
va_end(va);
6869

69-
php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Warning: %s", expanded_format);
70+
if (expanded_len >= 0 && expanded_format) {
71+
php_error_docref(NULL TSRMLS_CC, E_NOTICE, "Warning: %s", expanded_format);
7072

71-
free(expanded_format);
73+
free(expanded_format);
74+
}
7275
}
7376

7477
protected const char *

0 commit comments

Comments
 (0)