Skip to content

Conversation

@librick
Copy link

@librick librick commented Dec 4, 2025

The function snmpd_sink_add() has a guard clause that tests the literal string "section", not the variable value "$section".

The test [ -n "section" ] always evaluates to true because the string literal "section" is non-empty, making the check useless.

This function is only called internally with hardcoded arguments, so the bug has no actual impact currently. For the same reason, this change should not break existing configurations. However, I think it should be fixed so future callers do not have a false sense of security.

📦 Package Details

Maintainer: @stintel
(You can find this by checking the history of the package Makefile.)

Description:

This modifies the snmpd_sink_add function, used to create SNMP configuration directives including trapsink, trap2sink, and informsink, to fix a semantically useless non-empty string literal test.


🧪 Run Testing Details

  • OpenWrt Version: 21.02-SNAPSHOT
  • OpenWrt Target/Subtarget: Redacted for privacy reasons (bug isn't platform-specific)
  • OpenWrt Device: Redacted for privacy reasons (bug isn't platform-specific)

✅ Formalities

  • I have reviewed the CONTRIBUTING.md file for detailed contributing guidelines.

The function snmpd_sink_add() has a guard clause that tests the literal
string "section", not the variable value "$section".

The test `[ -n "section" ]` always evaluates to true because the string
literal "section" is non-empty, making the check useless.

This function is only called internally with hardcoded arguments, so the
bug has no actual impact currently. For the same reason, this change
should not break existing configurations. However, I think it should be
fixed so future callers do not have a false sense of security.

Signed-off-by: Eric McDonald <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant