On 25/04/2022 16:51, Shuah Khan wrote:
On 4/24/22 3:15 PM, Colin Ian King wrote:
Currently if opening /dev/null fails to open then file pointer fp
is null and further access to fp via fprintf will cause a null
pointer dereference. Fix this by returning a negative error value
when a null fp is detected.
How did you find this problem and how can it be reproduced? Is there
a case where test fails to open "/dev/null"?
Found with static analysis, cppcheck. Open on /dev/null is unlikely to fail, but it's good to fail reliably rather than have a SIGSEGV :-)