aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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);
}