From: Jouni Malinen Date: Tue, 7 Sep 2010 14:07:57 +0000 (+0300) Subject: P2P: Make sure parsed Device Name gets null terminated X-Git-Tag: hostap-1-bp~1054 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e2197af1b21ce74e9987134ef546bafd5a0e6d7a;p=thirdparty%2Fhostap.git P2P: Make sure parsed Device Name gets null terminated If the msg->device_name buffer is filled from two different sources, the copy from the P2P Device Info attribute needs to make sure that the values gets null terminated to match the length of the correct string should the other place use another string (which is not really allowed by the spec, but could happen). --- diff --git a/src/p2p/p2p_parse.c b/src/p2p/p2p_parse.c index bbd727ab9..a10389b2a 100644 --- a/src/p2p/p2p_parse.c +++ b/src/p2p/p2p_parse.c @@ -162,6 +162,7 @@ static int p2p_parse_attribute(u8 id, const u8 *data, u16 len, return -1; } os_memcpy(msg->device_name, pos, nlen); + msg->device_name[nlen] = '\0'; for (i = 0; i < nlen; i++) { if (msg->device_name[i] == '\0') break;