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:
parent
56bd6fac14
commit
4e31e22787
|
@ -360,6 +360,7 @@ cidr_match(struct sockaddr *sa, socklen_t salen, char *allowed)
|
||||||
plen = -1;
|
plen = -1;
|
||||||
if ((p = strchr(buf, '/')) != NULL)
|
if ((p = strchr(buf, '/')) != NULL)
|
||||||
{
|
{
|
||||||
|
errno = 0;
|
||||||
plen = strtoul(p + 1, &ep, 10);
|
plen = strtoul(p + 1, &ep, 10);
|
||||||
if (errno != 0 || ep == NULL || *ep != '\0' || plen < 0)
|
if (errno != 0 || ep == NULL || *ep != '\0' || plen < 0)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue