From a2114371e8e4e12e4fd67f3932a843cfc0d2fb99 Mon Sep 17 00:00:00 2001 From: Mark Wooding Date: Sat, 5 Jun 2010 14:45:01 +0100 Subject: [PATCH] noip.c: Make sure it's an AF_UNIX address before counting the length. --- noip.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/noip.c b/noip.c index bcba77f..06a07c6 100644 --- a/noip.c +++ b/noip.c @@ -352,7 +352,7 @@ static int decode_inet_addr(struct sockaddr_in *sin, { char buf[INET_ADDRSTRLEN + 16]; char *p; - size_t n = strlen(sockdir), nn = strlen(sun->sun_path); + size_t n = strlen(sockdir), nn; struct sockaddr_in sin_mine; unsigned long port; @@ -360,6 +360,7 @@ static int decode_inet_addr(struct sockaddr_in *sin, sin = &sin_mine; if (sun->sun_family != AF_UNIX) return (-1); + nn = strlen(sun->sun_path); if (len < sizeof(sun)) ((char *)sun)[len] = 0; D( fprintf(stderr, "noip: decode (%d) `%s'", *sun->sun_path, sun->sun_path); ) -- 2.11.0