From 8a9673191e0a8e2a4475b00ee750c36d5bb4c55c Mon Sep 17 00:00:00 2001 From: Matthieu Gautier Date: Wed, 28 Sep 2016 17:10:49 +0200 Subject: [PATCH] Do not loop infinitely if there is no argument passed to kiwix-serve. If there is no argument, optind==argc==1. We must not try to look into argv[1] but we need to break the loop anyway. --- src/server/kiwix-serve.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/server/kiwix-serve.cpp b/src/server/kiwix-serve.cpp index 3fd3931..71d6b5a 100644 --- a/src/server/kiwix-serve.cpp +++ b/src/server/kiwix-serve.cpp @@ -517,7 +517,7 @@ int main(int argc, char **argv) { break; } } else { - if (optind < argc) { + if (optind <= argc) { if (libraryFlag) { libraryPath = argv[optind++];