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 3ef6e37 + d92a87d commit 091ea62Copy full SHA for 091ea62
ext/fileinfo/libmagic/print.c
@@ -59,16 +59,19 @@ 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
TSRMLS_FETCH();
65
66
va_start(va, f);
- if (vasprintf(&expanded_format, f, va)); /* silence */
67
+ expanded_len = vasprintf(&expanded_format, f, va);
68
va_end(va);
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);
72
- free(expanded_format);
73
+ free(expanded_format);
74
+ }
75
}
76
77
protected const char *
0 commit comments