1
0
Fork 0

dns_resolver: assure that dns_query() result is null-terminated

dns_query() credulously assumes that keys are null-terminated and
returns a copy of a memory block that is off by one.

Signed-off-by: Manuel Schölling <manuel.schoelling@gmx.de>
Signed-off-by: David S. Miller <davem@davemloft.net>
wifi-calibration
Manuel Schölling 2014-06-07 23:57:25 +02:00 committed by David S. Miller
parent 2346829e64
commit 84a7c0b1db
1 changed files with 3 additions and 1 deletions

View File

@ -149,7 +149,9 @@ int dns_query(const char *type, const char *name, size_t namelen,
if (!*_result)
goto put;
memcpy(*_result, upayload->data, len + 1);
memcpy(*_result, upayload->data, len);
*_result[len] = '\0';
if (_expiry)
*_expiry = rkey->expiry;