Skip to content

Commit

Permalink
Exit gracefully if conf.intf.ifname does not exist
Browse files Browse the repository at this point in the history
horst will only work if there is a wlan interface. But if any user
tries horst on a system where there is no wifi hardware then it results
in a segfault.
As an added benifit this will also protect the user against any
misconfiguration of the wlan interface name.

The segfault has been reported in Ubuntu.

Signed-off-by: Sudip Mukherjee <[email protected]>
  • Loading branch information
sudipm-mukherjee committed Jan 10, 2024
1 parent a6691ae commit 88dcc70
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -612,6 +612,10 @@ int main(int argc, char** argv)
conf.intf.sock = net_open_client_socket(conf.serveraddr, conf.port);
cc_list_head_init(&conf.intf.wlan_nodes);
} else {
if (!netdev_check_if_exists(conf.intf.ifname)) {
fprintf(stderr, "invalid interface name, please check configuration\n");
return(-EINVAL);
}
ifctrl_init();
ifctrl_iwget_interface_info(&conf.intf);

Expand Down

0 comments on commit 88dcc70

Please sign in to comment.