Skip to content

Commit a78eadd

Browse files
committed
Merge branch 'PHP-5.6'
* PHP-5.6: updated NEWS Fixed bug #68671 incorrect expression in libmagic Conflicts: ext/fileinfo/libmagic/print.c
2 parents 2d561e0 + 85b4a65 commit a78eadd

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,15 +59,18 @@ 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

6465
va_start(va, f);
65-
if (vasprintf(&expanded_format, f, va)); /* silence */
66+
expanded_len = vasprintf(&expanded_format, f, va);
6667
va_end(va);
6768

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

70-
free(expanded_format);
72+
free(expanded_format);
73+
}
7174
}
7275

7376
protected const char *

0 commit comments

Comments
 (0)