From: djm Date: Fri, 29 Apr 2022 04:55:07 +0000 (+0000) Subject: be stricter in which characters will be accepted in specifying a mask X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=1f8040da2867dfb4ab58498af5622dc9b22ffe62;p=openbsd be stricter in which characters will be accepted in specifying a mask length; allow only 0-9. From khaleesicodes via GHPR#278; ok dtucker@ --- 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; }