From 1f8040da2867dfb4ab58498af5622dc9b22ffe62 Mon Sep 17 00:00:00 2001 From: djm Date: Fri, 29 Apr 2022 04:55:07 +0000 Subject: [PATCH] be stricter in which characters will be accepted in specifying a mask length; allow only 0-9. From khaleesicodes via GHPR#278; ok dtucker@ --- usr.bin/ssh/addr.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/usr.bin/ssh/addr.c b/usr.bin/ssh/addr.c index ac0ef96c041..8774764ce58 100644 --- a/usr.bin/ssh/addr.c +++ b/usr.bin/ssh/addr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: addr.c,v 1.4 2021/10/22 10:51:57 dtucker Exp $ */ +/* $OpenBSD: addr.c,v 1.5 2022/04/29 04:55:07 djm Exp $ */ /* * Copyright (c) 2004-2008 Damien Miller @@ -393,7 +393,7 @@ addr_pton_cidr(const char *p, struct xaddr *n, u_int *l) *mp = '\0'; mp++; masklen = strtoul(mp, &cp, 10); - if (*mp == '\0' || *cp != '\0' || masklen > 128) + if (*mp < '0' || *mp > '9' || *cp != '\0' || masklen > 128) return -1; } -- 2.20.1