summaryrefslogtreecommitdiffstats
path: root/package/ead
diff options
context:
space:
mode:
authornbd <nbd@3c298f89-4303-0410-b956-a3cf2f4a3e73>2009-01-02 23:51:57 +0000
committernbd <nbd@3c298f89-4303-0410-b956-a3cf2f4a3e73>2009-01-02 23:51:57 +0000
commit7619ddb0a299ecde33f5dbaf89bcf6c875507d7f (patch)
treedb39ea28c22360cc737b14f17fa5c139e83d98f3 /package/ead
parent8db97c0089bb54abe422c2b8b7739a670044a915 (diff)
ead: message handling fixes
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@13828 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'package/ead')
-rw-r--r--package/ead/src/ead-client.c5
-rw-r--r--package/ead/src/ead.c2
2 files changed, 5 insertions, 2 deletions
diff --git a/package/ead/src/ead-client.c b/package/ead/src/ead-client.c
index 111dc8ac6..14e04c40b 100644
--- a/package/ead/src/ead-client.c
+++ b/package/ead/src/ead-client.c
@@ -143,7 +143,10 @@ static bool
handle_pong(void)
{
struct ead_msg_pong *pong = EAD_DATA(msg, pong);
- int len = msg->len - sizeof(struct ead_msg_pong);
+ int len = ntohl(msg->len) - sizeof(struct ead_msg_pong);
+
+ if (len <= 0)
+ return false;
pong->name[len] = 0;
auth_type = ntohs(pong->auth_type);
diff --git a/package/ead/src/ead.c b/package/ead/src/ead.c
index 7367c3865..c4d3dd9f4 100644
--- a/package/ead/src/ead.c
+++ b/package/ead/src/ead.c
@@ -330,7 +330,7 @@ handle_ping(struct ead_packet *pkt, int len, int *nstate)
msg->len = htonl(sizeof(struct ead_msg_pong) + slen);
strncpy(pong->name, dev_name, slen);
- pong->name[len] = 0;
+ pong->name[slen] = 0;
pong->auth_type = htons(EAD_AUTH_MD5);
return true;