pg: do not use atoi()

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-25 10:24:35 +02:00
parent 1d5c14ae1a
commit 0461279ab3
1 changed files with 2 additions and 5 deletions

View File

@ -597,11 +597,8 @@ static int getcount(char *cmdstr)
}
if (buf[0] == '-' && buf[1] == '\0') {
i = -1;
} else {
if (*buf == '+')
i = atoi(buf + 1);
else
i = atoi(buf);
} else if (ul_strtos32(*buf == '+' ? buf + 1 : buf, &i, 10) != 0) {
i = -1;
}
free(buf);
return i;