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:
Karel Zak 2021-06-22 17:26:11 +02:00
parent 24c17c6294
commit b4533177ae
1 changed files with 8 additions and 1 deletions

View File

@ -2424,7 +2424,14 @@ static int caps_lock(char *s)
static speed_t bcode(char *s)
{
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++)
if (sp->speed == speed)