Icinga / Icinga/icinga2

Integer overflow in command argument set_if

Open
#9,448 2 comments 0 reactions 1 assignee View on GitHub

@sourav25998 is already working on this.

Since Sep 12, 2022.

area/checks area/configuration bug good first issue
Dominant language
C++
Stars
2.2k
Forks
616
Avg merge
5d 6h
Merged PRs (30d)
10

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.