diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2018-07-01 14:48:30 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-01 14:48:30 +0200 |
commit | 22d95e462ec32e1b6c28b310e80c9c001edc0fe1 (patch) | |
tree | 0c36c4b46fc055a31e2ed1a0cda85de714b48484 | |
parent | 40911e435e8aa4d568b5b9892272505509058063 (diff) | |
download | rneovim-22d95e462ec32e1b6c28b310e80c9c001edc0fe1.tar.gz rneovim-22d95e462ec32e1b6c28b310e80c9c001edc0fe1.tar.bz2 rneovim-22d95e462ec32e1b6c28b310e80c9c001edc0fe1.zip |
coverity/108274: tty-test.c: Insecure data handling (#8666)
-rw-r--r-- | test/functional/fixtures/tty-test.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/test/functional/fixtures/tty-test.c b/test/functional/fixtures/tty-test.c index 4f0858acdb..5f1f5cb91c 100644 --- a/test/functional/fixtures/tty-test.c +++ b/test/functional/fixtures/tty-test.c @@ -150,7 +150,12 @@ int main(int argc, char **argv) } if (argc > 1) { - int count = atoi(argv[1]); + errno = 0; + int count = (int)strtol(argv[1], NULL, 10); + if (errno != 0) { + abort(); + } + count = (count < 0 || count > 99999) ? 0 : count; for (int i = 0; i < count; i++) { printf("line%d\n", i); } |