PR/57905: Mark Davies: blocklistd fails to parse ipv6 addresses.

This commit is contained in:
christos 2024-02-09 00:37:06 +00:00
parent 82caa5d69a
commit f4a9e2ba6c
1 changed files with 6 additions and 6 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: conf.c,v 1.3 2022/11/18 16:01:00 christos Exp $ */
/* $NetBSD: conf.c,v 1.4 2024/02/09 00:37:06 christos Exp $ */
/*-
* Copyright (c) 2015 The NetBSD Foundation, Inc.
@ -33,7 +33,7 @@
#endif
#include <sys/cdefs.h>
__RCSID("$NetBSD: conf.c,v 1.3 2022/11/18 16:01:00 christos Exp $");
__RCSID("$NetBSD: conf.c,v 1.4 2024/02/09 00:37:06 christos Exp $");
#include <stdio.h>
#ifdef HAVE_LIBUTIL_H
@ -261,7 +261,7 @@ conf_gethostport(const char *f, size_t l, bool local, struct conf *c,
if (debug)
(*lfun)(LOG_DEBUG, "%s: host6 %s", __func__, p);
if (strcmp(p, "*") != 0) {
if (inet_pton(AF_INET6, p, &sin6->sin6_addr) == -1)
if (inet_pton(AF_INET6, p, &sin6->sin6_addr) != 1)
goto out;
sin6->sin6_family = AF_INET6;
#ifdef HAVE_STRUCT_SOCKADDR_SA_LEN
@ -308,10 +308,10 @@ conf_gethostport(const char *f, size_t l, bool local, struct conf *c,
return -1;
if (port && c->c_port != FSTAR && c->c_port != FEQUAL)
*port = htons((in_port_t)c->c_port);
*port = htons((in_port_t)c->c_port)
return 0;
out:
(*lfun)(LOG_ERR, "%s: %s, %zu: Bad address [%s]", __func__, f, l, pstr);
(*lfun)(LOG_ERR, "%s: %s, %zu: Bad address [%s]", __func__, f, l, p);
return -1;
out1:
(*lfun)(LOG_ERR, "%s: %s, %zu: Can't specify mask %d with "
@ -1172,7 +1172,7 @@ conf_parse(const char *f)
return;
}
lineno = 1;
lineno = 0;
confset_init(&rc);
confset_init(&lc);