Skip to content

Commit

Permalink
Fix: possible segmentation fault on win_cmd_exec
Browse files Browse the repository at this point in the history
When the reverse lookup of a target failed the host can still be empty
which leads to segmentation fault because strlen tries to access that.
  • Loading branch information
nichtsfrei committed Jan 14, 2025
1 parent 9678b81 commit 9489cbf
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions nasl/nasl_smb.c
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,11 @@ nasl_win_cmd_exec (lex_ctxt *lexic)
g_free (gvm_host);
}
}
if (host == NULL)
{
g_message ("win_cmd_exec: host must not be empty.");
return NULL;
}
if ((strlen (password) == 0) || (strlen (username) == 0)
|| strlen (host) == 0)
{
Expand Down

0 comments on commit 9489cbf

Please sign in to comment.