mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-27 07:34:15 +02:00
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) {
|
if (argc >= 4 && strcmp(argv[1], "--autocomplete") == 0) {
|
||||||
autocomplete = true;
|
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;
|
argc -= 3;
|
||||||
argv += 3;
|
argv += 3;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user