mirror of https://github.com/Icinga/icinga2.git
Fix crash when specifying invalid argument for --autocomplete
Coverity Bug ID: 1167734
This commit is contained in:
parent
3e12bfef25
commit
ba6b92a929
|
@ -96,7 +96,15 @@ int Main(void)
|
|||
|
||||
if (argc >= 4 && strcmp(argv[1], "--autocomplete") == 0) {
|
||||
autocomplete = true;
|
||||
autoindex = Convert::ToLong(argv[2]);
|
||||
|
||||
try {
|
||||
autoindex = Convert::ToLong(argv[2]);
|
||||
} catch (const std::invalid_argument& ex) {
|
||||
Log(LogCritical, "icinga-app")
|
||||
<< "Invalid index for --autocomplete: " << argv[2];
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
||||
argc -= 3;
|
||||
argv += 3;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue