agetty: do not use atol()
Addresses: https://github.com/karelzak/util-linux/issues/1358 Signed-off-by: Karel Zak <kzak@redhat.com>
This commit is contained in:
parent
cb75cf88b8
commit
c0617de5a4
|
@ -2424,7 +2424,14 @@ static int caps_lock(char *s)
|
||||||
static speed_t bcode(char *s)
|
static speed_t bcode(char *s)
|
||||||
{
|
{
|
||||||
const struct Speedtab *sp;
|
const struct Speedtab *sp;
|
||||||
long speed = atol(s);
|
char *end = NULL;
|
||||||
|
long speed;
|
||||||
|
|
||||||
|
errno = 0;
|
||||||
|
speed = strtol(s, &end, 10);
|
||||||
|
|
||||||
|
if (errno || !end || end == s)
|
||||||
|
return 0;
|
||||||
|
|
||||||
for (sp = speedtab; sp->speed; sp++)
|
for (sp = speedtab; sp->speed; sp++)
|
||||||
if (sp->speed == speed)
|
if (sp->speed == speed)
|
||||||
|
|
Loading…
Reference in New Issue