diff options
Diffstat (limited to 'contrib/wpa_supplicant/wpa_ctrl.c')
-rw-r--r-- | contrib/wpa_supplicant/wpa_ctrl.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/contrib/wpa_supplicant/wpa_ctrl.c b/contrib/wpa_supplicant/wpa_ctrl.c index 631c628..3c79fc4 100644 --- a/contrib/wpa_supplicant/wpa_ctrl.c +++ b/contrib/wpa_supplicant/wpa_ctrl.c @@ -10,6 +10,8 @@ * license. * * See README and COPYING for more details. + * + * $FreeBSD$ */ #include <stdlib.h> @@ -88,7 +90,7 @@ struct wpa_ctrl * wpa_ctrl_open(const char *ctrl_path) } ctrl->local.sun_family = AF_UNIX; - snprintf(ctrl->local.sun_path, sizeof(ctrl->local.sun_path), + snprintf(ctrl->local.sun_path, sizeof(ctrl->local.sun_path) - 1, "/tmp/wpa_ctrl_%d-%d", getpid(), counter++); if (bind(ctrl->s, (struct sockaddr *) &ctrl->local, sizeof(ctrl->local)) < 0) { @@ -98,8 +100,7 @@ struct wpa_ctrl * wpa_ctrl_open(const char *ctrl_path) } ctrl->dest.sun_family = AF_UNIX; - snprintf(ctrl->dest.sun_path, sizeof(ctrl->dest.sun_path), "%s", - ctrl_path); + strncpy(ctrl->dest.sun_path, ctrl_path, sizeof(ctrl->dest.sun_path) - 1); if (connect(ctrl->s, (struct sockaddr *) &ctrl->dest, sizeof(ctrl->dest)) < 0) { close(ctrl->s); |