From 4e31e227872e088291020bdd9d02b8b6572b708d Mon Sep 17 00:00:00 2001 From: Stefan Gehn Date: Sun, 5 Oct 2014 13:14:15 +0200 Subject: [PATCH] gkrellmd: Fix IPv6 prefix length error detection Parsing an IPv6 prefix length has to reset errno prior to calling strtoul() to reliably detect errors (the return value is not suitable for detecting errors). Patch taken straight from Debian BTS #764023. Thanks for Peter Denison for spotting this and providing a patch. --- server/main.c | 1 + 1 file changed, 1 insertion(+) diff --git a/server/main.c b/server/main.c index 6bc05e1..3c1be09 100644 --- a/server/main.c +++ b/server/main.c @@ -360,6 +360,7 @@ cidr_match(struct sockaddr *sa, socklen_t salen, char *allowed) plen = -1; if ((p = strchr(buf, '/')) != NULL) { + errno = 0; plen = strtoul(p + 1, &ep, 10); if (errno != 0 || ep == NULL || *ep != '\0' || plen < 0) {