icinga2 icon indicating copy to clipboard operation
icinga2 copied to clipboard

Integer overflow in command argument set_if

Open julianbrost opened this issue 2 years ago • 2 comments

Config snippet:

object CheckCommand "set-if-overflow" {
	command = ["echo"]
	arguments = {
		"42" = {
			set_if = 42
		}
		"4294967296" = {
			set_if = 4294967296
		}
	}
}

object Host "set-if-overflow" {
	check_command = "set-if-overflow"
}

Executed the following command:

                "last_check_result": {
                    "active": true,
                    "check_source": "master-2",
                    "command": [
                        "echo",
                        "42"
                    ],

Using both numbers shouldn't make a difference, however it's casted to int here, which overflows with the value above: https://github.com/Icinga/icinga2/blob/32c7f7730db154ba0dff5856a8985d125791c73e/lib/icinga/macroprocessor.cpp#L480-L488

julianbrost avatar Jul 20 '22 11:07 julianbrost

Hello @Al2Klimov @julianbrost . If this issue is still available, can you please assign it to me? It will be my first stint at open source contribution.

sourav25998 avatar Sep 10 '22 08:09 sourav25998

I doubt it's an issue, but...

Al2Klimov avatar Sep 12 '22 10:09 Al2Klimov