mirror of
https://github.com/PowerShell/openssh-portable.git
synced 2025-07-29 08:44:52 +02:00
upstream: for parse_ipqos(), use strtonum() instead of mostly
idiomatic strtoul(), but wow it's so gross. ok djm OpenBSD-Commit-ID: cec14a76af2eb7b225300c80fc0e21052be67b05
This commit is contained in:
parent
8176e1a6c2
commit
ec78c31409
10
misc.c
10
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) 2000 Markus Friedl. All rights reserved.
|
||||||
* Copyright (c) 2005-2020 Damien Miller. All rights reserved.
|
* Copyright (c) 2005-2020 Damien Miller. All rights reserved.
|
||||||
@ -1873,9 +1873,9 @@ static const struct {
|
|||||||
int
|
int
|
||||||
parse_ipqos(const char *cp)
|
parse_ipqos(const char *cp)
|
||||||
{
|
{
|
||||||
|
const char *errstr;
|
||||||
u_int i;
|
u_int i;
|
||||||
char *ep;
|
int val;
|
||||||
long val;
|
|
||||||
|
|
||||||
if (cp == NULL)
|
if (cp == NULL)
|
||||||
return -1;
|
return -1;
|
||||||
@ -1884,8 +1884,8 @@ parse_ipqos(const char *cp)
|
|||||||
return ipqos[i].value;
|
return ipqos[i].value;
|
||||||
}
|
}
|
||||||
/* Try parsing as an integer */
|
/* Try parsing as an integer */
|
||||||
val = strtol(cp, &ep, 0);
|
val = (int)strtonum(cp, 0, 255, &errstr);
|
||||||
if (*cp == '\0' || *ep != '\0' || val < 0 || val > 255)
|
if (errstr)
|
||||||
return -1;
|
return -1;
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user