From: Steinar H. Gunderson Date: Sun, 11 Oct 2020 09:48:43 +0000 (+0200) Subject: Disallow limit <= 0. X-Git-Tag: 1.0.0~6 X-Git-Url: https://git.sesse.net/?p=plocate;a=commitdiff_plain;h=8c2030fd894ac1539a46a976fe0e551b143a6140 Disallow limit <= 0. --- diff --git a/plocate.cpp b/plocate.cpp index 9f3928b..c914002 100644 --- a/plocate.cpp +++ b/plocate.cpp @@ -668,6 +668,10 @@ int main(int argc, char **argv) case 'l': case 'n': limit_matches = atoll(optarg); + if (limit_matches <= 0) { + fprintf(stderr, "Error: limit must be a strictly positive number.\n"); + exit(1); + } break; case '0': print_nul = true;