]> git.sesse.net Git - plocate/blobdiff - plocate.cpp
Disallow limit <= 0.
[plocate] / plocate.cpp
index 9f3928b1a8349e8db0e57d82bb31fd8df59171ef..c914002ff87b3bcbd61b0ad02d9d0cd81da03554 100644 (file)
@@ -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;