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.
This commit is contained in:
Stefan Gehn 2014-10-05 13:14:15 +02:00
parent 56bd6fac14
commit 4e31e22787
1 changed files with 1 additions and 0 deletions

View File

@ -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)
{