mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs.git
synced 2026-11-01 23:04:54 +01:00
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 <[email protected]> Signed-off-by: David S. Miller <[email protected]>
This commit is contained in:
1 parent
2346829e64
commit
84a7c0b1db
1 file changed
+3
-1
@@ -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;
|
||||
|
||||
|
||||
Reference in new issue
Block a user