From 84b182f83193a15fb93e0dd8d215cf9b69230f42 Mon Sep 17 00:00:00 2001 From: florian Date: Tue, 27 Aug 2024 06:06:14 +0000 Subject: [PATCH] Mechanically change inet_aton to inet_pton. Documentation says IP addresses are not truncated, so the parser can be stricter and only accept dotted IP addresses. OK yasuoka --- usr.sbin/radiusd/radiusd_ipcp.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/usr.sbin/radiusd/radiusd_ipcp.c b/usr.sbin/radiusd/radiusd_ipcp.c index 55c0332f939..4f0200f3966 100644 --- a/usr.sbin/radiusd/radiusd_ipcp.c +++ b/usr.sbin/radiusd/radiusd_ipcp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: radiusd_ipcp.c,v 1.13 2024/08/23 01:23:50 jsg Exp $ */ +/* $OpenBSD: radiusd_ipcp.c,v 1.14 2024/08/27 06:06:14 florian Exp $ */ /* * Copyright (c) 2024 Internet Initiative Japan Inc. @@ -447,7 +447,7 @@ ipcp_config_set(void *ctx, const char *name, int argc, char * const * argv) SYNTAX_ASSERT(argc == 1 || argc == 2, "specify 1 or 2 addresses for `name-server'"); for (i = 0; i < argc; i++) { - if (inet_aton(argv[i], &ina) != 1) { + if (inet_pton(AF_INET, argv[i], &ina) != 1) { module_send_message(module->base, IMSG_NG, "Invalid IP address: %s", argv[i]); return; @@ -464,7 +464,7 @@ ipcp_config_set(void *ctx, const char *name, int argc, char * const * argv) SYNTAX_ASSERT(argc == 1 || argc == 2, "specify 1 or 2 addresses for `name-server'"); for (i = 0; i < argc; i++) { - if (inet_aton(argv[i], &ina) != 1) { + if (inet_pton(AF_INET, argv[i], &ina) != 1) { module_send_message(module->base, IMSG_NG, "Invalid IP address: %s", argv[i]); return; @@ -1735,22 +1735,22 @@ parse_address_range(const char *range) goto error; if ((sep = strchr(buf, '-')) != NULL) { *sep = '\0'; - if (inet_aton(buf, &start) != 1) + if (inet_pton(AF_INET, buf, &start) != 1) goto error; - else if (inet_aton(++sep, &end) != 1) + else if (inet_pton(AF_INET, ++sep, &end) != 1) goto error; start.s_addr = ntohl(start.s_addr); end.s_addr = ntohl(end.s_addr); } else { if ((sep = strchr(buf, '/')) != NULL) { *sep = '\0'; - if (inet_aton(buf, &start) != 1) + if (inet_pton(AF_INET, buf, &start) != 1) goto error; masklen = strtonum(++sep, 0, 32, &errstr); if (errstr != NULL) goto error; } else { - if (inet_aton(buf, &start) != 1) + if (inet_pton(AF_INET, buf, &start) != 1) goto error; masklen = 32; } -- 2.20.1