aboutsummaryrefslogtreecommitdiffstats
path: root/wpa_supplicant/wpa_priv.c
diff options
context:
space:
mode:
authorJouni Malinen <j@w1.fi>2013-04-27 20:44:59 (GMT)
committerJouni Malinen <j@w1.fi>2013-04-27 20:44:59 (GMT)
commit5e24dc8a4bc8297dee3b95594457a51d36fde00d (patch)
tree4a97b61e2333269d577fee2187ea03c4dec603d1 /wpa_supplicant/wpa_priv.c
parent8b44ad7e162203db56056503d806246ee6a2ad0f (diff)
downloadhostap-5e24dc8a4bc8297dee3b95594457a51d36fde00d.zip
hostap-5e24dc8a4bc8297dee3b95594457a51d36fde00d.tar.gz
hostap-5e24dc8a4bc8297dee3b95594457a51d36fde00d.tar.bz2
Add dup_binstr() to help common binary string tasks
There are quite a few places in the current implementation where a nul terminated string is generated from binary data. Add a helper function to simplify the code a bit. Signed-hostap: Jouni Malinen <j@w1.fi>
Diffstat (limited to 'wpa_supplicant/wpa_priv.c')
-rw-r--r--wpa_supplicant/wpa_priv.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/wpa_supplicant/wpa_priv.c b/wpa_supplicant/wpa_priv.c
index ad6a080..4afaae9 100644
--- a/wpa_supplicant/wpa_priv.c
+++ b/wpa_supplicant/wpa_priv.c
@@ -573,13 +573,11 @@ wpa_priv_interface_init(const char *dir, const char *params)
iface->fd = -1;
len = pos - params;
- iface->driver_name = os_malloc(len + 1);
+ iface->driver_name = dup_binstr(params, len);
if (iface->driver_name == NULL) {
wpa_priv_interface_deinit(iface);
return NULL;
}
- os_memcpy(iface->driver_name, params, len);
- iface->driver_name[len] = '\0';
for (i = 0; wpa_drivers[i]; i++) {
if (os_strcmp(iface->driver_name,