We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 2d561e0 + 85b4a65 commit a78eaddCopy full SHA for a78eadd
ext/fileinfo/libmagic/print.c
@@ -59,15 +59,18 @@ protected void
59
file_magwarn(struct magic_set *ms, const char *f, ...)
60
{
61
va_list va;
62
- char *expanded_format;
+ char *expanded_format = NULL;
63
+ int expanded_len;
64
65
va_start(va, f);
- if (vasprintf(&expanded_format, f, va)); /* silence */
66
+ expanded_len = vasprintf(&expanded_format, f, va);
67
va_end(va);
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);
71
- free(expanded_format);
72
+ free(expanded_format);
73
+ }
74
}
75
76
protected const char *
0 commit comments