Icinga / icinga2

The core of our monitoring platform with a powerful configuration language and REST API.
https://icinga.com/docs/icinga2/latest
GNU General Public License v2.0
2.03k stars 578 forks source link

Integer overflow in command argument set_if #9448

Open julianbrost opened 2 years ago

julianbrost commented 2 years ago

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

sourav25998 commented 2 years ago

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.

Al2Klimov commented 2 years ago

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