Repository : ssh://git@diktynna/alfred
On branch : master
commit 6beca03bdafd24cc46b4aa7ff2b87612471bdab0 Author: Sven Eckelmann sven@narfation.org Date: Sat Feb 19 08:51:28 2022 +0100
alfred: Ensure processed change_bat_iface packet is 0-terminated
A client sending a alfred_change_bat_iface_v0 packet to the alfred server might have forgotten to 0-terminate the string. In this case, strdup in alfred_change_bat_iface_v0 might read outside of the available buffer.
Fixes: b96cc742ef3e ("alfred: introduce 'change batman-adv interface' IPC call") Signed-off-by: Sven Eckelmann sven@narfation.org
6beca03bdafd24cc46b4aa7ff2b87612471bdab0 unix_sock.c | 1 + 1 file changed, 1 insertion(+)
diff --git a/unix_sock.c b/unix_sock.c index e9355ba..3894736 100644 --- a/unix_sock.c +++ b/unix_sock.c @@ -360,6 +360,7 @@ unix_sock_change_bat_iface(struct globals *globals, goto err;
free(globals->mesh_iface); + change_bat_iface->bat_iface[sizeof(change_bat_iface->bat_iface) - 1] = '\0'; globals->mesh_iface = strdup(change_bat_iface->bat_iface);
ret = 0;