diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2024-04-02 10:02:09 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2024-04-02 10:02:09 +0000 |
commit | baf19c280e4191c126ed5ba03c6f9962b14940ed (patch) | |
tree | ea778033417924d498aad25ddd4b42f1d323df2b | |
parent | 86a7691f6a9c5f952c70b8e4e218e65776f61695 (diff) |
for parse_ipqos(), use strtonum() instead of mostly idiomatic strtoul(),
but wow it's so gross.
ok djm
-rw-r--r-- | usr.bin/ssh/misc.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/usr.bin/ssh/misc.c b/usr.bin/ssh/misc.c index 67e33d5e299..36b1cbb478f 100644 --- a/usr.bin/ssh/misc.c +++ b/usr.bin/ssh/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. @@ -1790,9 +1790,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; @@ -1801,8 +1801,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; } |