aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2018-07-01 14:48:30 +0200
committerGitHub <noreply@github.com>2018-07-01 14:48:30 +0200
commit22d95e462ec32e1b6c28b310e80c9c001edc0fe1 (patch)
tree0c36c4b46fc055a31e2ed1a0cda85de714b48484
parent40911e435e8aa4d568b5b9892272505509058063 (diff)
downloadrneovim-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.c7
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);
}