aboutsummaryrefslogtreecommitdiff
path: root/contrib/wpa_supplicant
diff options
context:
space:
mode:
authorSam Leffler <sam@FreeBSD.org>2005-06-05 21:13:08 +0000
committerSam Leffler <sam@FreeBSD.org>2005-06-05 21:13:08 +0000
commitb1bb8b168443ee311d91e5e6bee583ae88236385 (patch)
tree5c6c0829c4ac4527ddf7736ec7a4c695daf68fb1 /contrib/wpa_supplicant
parent75c61a94a43bd8d81ecad4b59971624eb9c5fcf5 (diff)
downloadsrc-b1bb8b168443ee311d91e5e6bee583ae88236385.tar.gz
src-b1bb8b168443ee311d91e5e6bee583ae88236385.zip
fix for ctrl interface socket setup
Submitted by: brooks
Notes
Notes: svn path=/head/; revision=147018
Diffstat (limited to 'contrib/wpa_supplicant')
-rw-r--r--contrib/wpa_supplicant/wpa_ctrl.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/contrib/wpa_supplicant/wpa_ctrl.c b/contrib/wpa_supplicant/wpa_ctrl.c
index 16cef5f83548..8e3511648059 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.sun_family) +
@@ -99,10 +101,9 @@ struct wpa_ctrl * wpa_ctrl_open(const char *ctrl_path)
}
ctrl->dest.sun_family = AF_UNIX;
- strncpy(ctrl->dest.sun_path, ctrl_path, sizeof(ctrl->dest.sun_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.sun_family) +
- strlen(ctrl->dest.sun_path)) < 0) {
+ sizeof(ctrl->dest)) < 0) {
close(ctrl->s);
unlink(ctrl->local.sun_path);
free(ctrl);