summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Herrmann <dh.herrmann@gmail.com>2013-10-24 18:27:28 +0200
committerDavid Herrmann <dh.herrmann@gmail.com>2013-10-24 18:27:28 +0200
commitb92b41a468e638f021a6ff970d1476a5adf24257 (patch)
tree880fc7f2e54b6811f82c6f431cf2846699180761
parent4c6a61f17008092bc28a3e2dc6a3078123635044 (diff)
owfd: wpa_ctrl: correctly init bufsize on internal reqs
If we send internal reqs, the reply-bufsize needs to be initialized to the actual buffer size. Otherwise, we might write to invalid memory. Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
-rw-r--r--src/wpa_ctrl.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/wpa_ctrl.c b/src/wpa_ctrl.c
index 0155824..f4c7770 100644
--- a/src/wpa_ctrl.c
+++ b/src/wpa_ctrl.c
@@ -233,7 +233,7 @@ int owfd_wpa_ctrl_open(struct owfd_wpa_ctrl *wpa, const char *ctrl_path,
{
int r;
char buf[10] = { 0 };
- size_t len = 10;
+ size_t len = sizeof(buf);
if (owfd_wpa_ctrl_is_open(wpa))
return -EALREADY;
@@ -535,7 +535,7 @@ static int wpa_request(int fd, const void *cmd, size_t cmd_len,
void *reply, size_t *reply_len, int64_t *t2)
{
char buf[REQ_REPLY_MAX];
- size_t l;
+ size_t l = REQ_REPLY_MAX;
int64_t *t, t1 = -1;
int r;