Browse Source

hostapd_cli: Fix segmentation fault with interface command

ctrl_ifname was not being freed and allocated consistently by using
proper functions: os_free() and os_strdup(). This can result in
segmentation fault when these OS specific wrappers use different
implementation (e.g., with CONFIG_WPA_TRACE=y).

Signed-off-by: Eduardo Abinader <eduardo.abinader@openbossa.org>
Eduardo Abinader 10 years ago
parent
commit
cc0b7cb188
1 changed files with 2 additions and 2 deletions
  1. 2 2
      hostapd/hostapd_cli.c

+ 2 - 2
hostapd/hostapd_cli.c

@@ -842,8 +842,8 @@ static int hostapd_cli_cmd_interface(struct wpa_ctrl *ctrl, int argc,
 	}
 	}
 
 
 	hostapd_cli_close_connection();
 	hostapd_cli_close_connection();
-	free(ctrl_ifname);
-	ctrl_ifname = strdup(argv[0]);
+	os_free(ctrl_ifname);
+	ctrl_ifname = os_strdup(argv[0]);
 
 
 	if (hostapd_cli_open_connection(ctrl_ifname)) {
 	if (hostapd_cli_open_connection(ctrl_ifname)) {
 		printf("Connected to interface '%s.\n", ctrl_ifname);
 		printf("Connected to interface '%s.\n", ctrl_ifname);