Compare commits

...

1 Commits

Author SHA1 Message Date
5215be2901 [readline] Silence spurious null pointer dereference Coverity warning
Coverity reported a potential null pointer dereference in readline.c,
which was fixed in commit b01781a ("[hci] Fix semantics of
replace_string() to match code comments").  With the fix in place,
Coverity still reports a potential null pointer dereference, even
though this cannot now happen.

Add an assertion to inform Coverity that the allocated string cannot
be NULL after a successful call to replace_string().

Signed-off-by: Michael Brown <mcb30@ipxe.org>
2024-04-18 11:25:58 +01:00

View File

@ -278,6 +278,7 @@ int readline_history ( const char *prompt, const char *prefill,
/* Prefill string */
if ( ( rc = replace_string ( &string, prefill ) ) != 0 )
goto error;
assert ( *line != NULL );
sync_console ( &string );
while ( 1 ) {