netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 net] dns_resolver: Null-terminate the right string
@ 2014-07-20 23:06 Ben Hutchings
  2014-07-21  5:34 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Ben Hutchings @ 2014-07-20 23:06 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, Manuel Schölling

[-- Attachment #1: Type: text/plain, Size: 883 bytes --]

*_result[len] is parsed as *(_result[len]) which is not at all what we
want to touch here.

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Fixes: 84a7c0b1db1c ("dns_resolver: assure that dns_query() result is null-terminated")
---
v2: Add the Fixes header

 net/dns_resolver/dns_query.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/net/dns_resolver/dns_query.c b/net/dns_resolver/dns_query.c
index 9acec61f..dd8696a 100644
--- a/net/dns_resolver/dns_query.c
+++ b/net/dns_resolver/dns_query.c
@@ -150,7 +150,7 @@ int dns_query(const char *type, const char *name, size_t namelen,
 		goto put;
 
 	memcpy(*_result, upayload->data, len);
-	*_result[len] = '\0';
+	(*_result)[len] = '\0';
 
 	if (_expiry)
 		*_expiry = rkey->expiry;


-- 
Ben Hutchings
Make three consecutive correct guesses and you will be considered an expert.

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 811 bytes --]

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2 net] dns_resolver: Null-terminate the right string
  2014-07-20 23:06 [PATCH v2 net] dns_resolver: Null-terminate the right string Ben Hutchings
@ 2014-07-21  5:34 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2014-07-21  5:34 UTC (permalink / raw)
  To: ben; +Cc: netdev, manuel.schoelling

From: Ben Hutchings <ben@decadent.org.uk>
Date: Mon, 21 Jul 2014 00:06:48 +0100

> *_result[len] is parsed as *(_result[len]) which is not at all what we
> want to touch here.
> 
> Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
> Fixes: 84a7c0b1db1c ("dns_resolver: assure that dns_query() result is null-terminated")
> ---
> v2: Add the Fixes header

Applied, thanks Ben.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-07-21  5:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-20 23:06 [PATCH v2 net] dns_resolver: Null-terminate the right string Ben Hutchings
2014-07-21  5:34 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).