Skip to content

Commit 5215be2

Browse files
committed
[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 <[email protected]>
1 parent d7e58c5 commit 5215be2

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/hci/readline.c

+1
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,7 @@ int readline_history ( const char *prompt, const char *prefill,
278278
/* Prefill string */
279279
if ( ( rc = replace_string ( &string, prefill ) ) != 0 )
280280
goto error;
281+
assert ( *line != NULL );
281282
sync_console ( &string );
282283

283284
while ( 1 ) {

0 commit comments

Comments
 (0)