go to bug id or search bugs for
65 if (vasprintf(&expanded_format, f, va)); /* silence */
I believe line 65 is incorrect. Why is there an if() aroudn it, then is ended by a semi-colon?
Add a Patch
Add a Pull Request
The expression seems to be an attempt to silence the compiler which was pointing out a bug in the code, instead of fixing the bug. Introduced by commit cdc1a637.
The bug is:
68 php_error_docref(NULL, E_NOTICE, "Warning: %s", expanded_format);
in both of these expressions `expected_format` may have undefined value. Additionally line 68 may be leaking memory contents to the client.
Anatol, can you have a look at this, please? It appears to be related to your fix for bug #64713.
Automatic comment on behalf of ab
Log: Fixed bug #68671 incorrect expression in libmagic
Hi Adam, yeah, the "if()" fix was just to hide the warning about the ignored return value. Despite there's currently no use case in the core, where file_magwarn() could be used a dangerous way ... What Joshua suggests would just make it robuster.