[openssh-commits] [openssh] 08/14: upstream: for parse_ipqos(), use strtonum() instead of mostly
git+noreply at mindrot.org
git+noreply at mindrot.org
Tue Apr 30 12:39:45 AEST 2024
This is an automated email from the git hooks/post-receive script.
djm pushed a commit to branch master
in repository openssh.
commit ec78c31409590ad74efc194f886273ed080a545a
Author: deraadt at openbsd.org <deraadt at openbsd.org>
AuthorDate: Tue Apr 2 10:02:08 2024 +0000
upstream: for parse_ipqos(), use strtonum() instead of mostly
idiomatic strtoul(), but wow it's so gross. ok djm
OpenBSD-Commit-ID: cec14a76af2eb7b225300c80fc0e21052be67b05
---
misc.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/misc.c b/misc.c
index fe6c4a51..7a42d498 100644
--- a/misc.c
+++ b/misc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: misc.c,v 1.192 2024/04/02 09:56:58 deraadt Exp $ */
+/* $OpenBSD: misc.c,v 1.193 2024/04/02 10:02:08 deraadt Exp $ */
/*
* Copyright (c) 2000 Markus Friedl. All rights reserved.
* Copyright (c) 2005-2020 Damien Miller. All rights reserved.
@@ -1873,9 +1873,9 @@ static const struct {
int
parse_ipqos(const char *cp)
{
+ const char *errstr;
u_int i;
- char *ep;
- long val;
+ int val;
if (cp == NULL)
return -1;
@@ -1884,8 +1884,8 @@ parse_ipqos(const char *cp)
return ipqos[i].value;
}
/* Try parsing as an integer */
- val = strtol(cp, &ep, 0);
- if (*cp == '\0' || *ep != '\0' || val < 0 || val > 255)
+ val = (int)strtonum(cp, 0, 255, &errstr);
+ if (errstr)
return -1;
return val;
}
--
To stop receiving notification emails like this one, please contact
djm at mindrot.org.
More information about the openssh-commits
mailing list