[PATCH] dns_name_length does not account for the terminating \0.

2015-09-09 Thread Frank Stevers
Hello,

When testing dnsproxy of connman, I noticed when sending a cached response, 
that the TTL field and CLASS field might be incorrect.

When looking into this, I found that the TTL value might be written one or two 
characters earlier in the DNS answer.

When looking in the send_cached_response() response routine, I saw 
update_cached_ttl() is called,
which uses dns_name_length to shift the pointer for the name of DNS Question 
and the name of DNS answer. When looking in dns_name_length, I see that strlen 
is used to determine the length of the name. However, strlen is excluding the 
terminating null character '\0', so 1 should be added to strlen for the length 
of the name.
dns_name_length is also used in reply_query_type, here 1 is added to 
dns_name_length.

Therefore, I propose the included patch in dnsproxy.c:

Frank Stevers (1):
  dns_name_length incorrectly returns the length

 src/dnsproxy.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

-- 
2.1.4

___
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman


[PATCH] dns_name_length incorrectly returns the length

2015-09-09 Thread Frank Stevers
dns_name_length does not account for the terminating \0.

Signed-off-by: Frank Stevers <f.stev...@ultimaker.com>
---
 src/dnsproxy.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/dnsproxy.c b/src/dnsproxy.c
index a1eda55..c37eee9 100644
--- a/src/dnsproxy.c
+++ b/src/dnsproxy.c
@@ -355,7 +355,7 @@ static int dns_name_length(unsigned char *buf)
 {
if ((buf[0] & NS_CMPRSFLGS) == NS_CMPRSFLGS) /* compressed name */
return 2;
-   return strlen((char *)buf);
+   return strlen((char *)buf) + 1;
 }
 
 static void update_cached_ttl(unsigned char *buf, int len, int new_ttl)
@@ -1357,7 +1357,7 @@ static int reply_query_type(unsigned char *msg, int len)
return 0;
 
/* now the query, which is a name and 2 16 bit words */
-   l = dns_name_length(c) + 1;
+   l = dns_name_length(c);
c += l;
type = c[0] << 8 | c[1];
 
-- 
2.1.4

___
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman


Setting Tethering to True without setting TetheringPassphrase generates an exception

2015-06-04 Thread Frank Stevers
Kind regards,

Frank Stevers
Ultimaker BV

www.ultimaker.com

*A:* Burgemeester R. van der Venlaan 11, 4191 PLGeldermalsen

-- 


IMAGINE IT  MAKE IT

Meet us online at Twitter http://twitter.com/ultimaker, Facebook 
http://facebook.com/ultimaker, Google+ http://google.com/+Ultimaker

www.ultimaker.com
___
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman