[PATCH 1/2] main: Accept interface names as a parameter
Jouni Malinen
j at w1.fi
Sun Jun 12 15:25:17 PDT 2016
On Fri, Jun 10, 2016 at 11:04:25AM -0700, Tim Kourt wrote:
> The introduction of a parameter ‘-i’ to override the value of
> ‘interface’ attribute in hostapd.conf files. This change enables
> the reuse of the configuration files for the concurrent instances
> of hostapd. An ability to dynamically assign the interface names
> simplifies the usages of hostapd service in the automated
> emulations of the wireless environments.
Thanks, both patches applied. I fixed some issues with this first patch:
> + if (if_name) {
> + strncpy(iface->conf->bss[0]->iface, if_name, strlen(if_name));
> + iface->conf->bss[0]->iface[strlen(if_name)] = '\0';
> + }
Should use os_strlcpy() instead of strncpy() and especially that
strlen(if_name) part would make this not do any bounds checking on the
destination, i.e., this would allow buffer write overflow from the
command line.
> + *if_names = os_realloc_array(*if_names, ++(*if_names_size),
> + sizeof(char *));
realloc functions cannot be used in that manner cleanly, i.e., this
would leak memory if realloc returns NULL. A temporary variable is
needed to allow the original (and still allocated) pointer to be freed
in case of such a failure.
--
Jouni Malinen PGP id EFC895FA
More information about the Hostap
mailing list