Skip to content

bug: import XML text emptiness check trims boolean instead of payload #269

@somethingwithproof

Description

@somethingwithproof

Description

The XML import handlers in three files check import_text with:

if (trim(get_nfilter_request_var('import_text') != '')) {

Because of operator precedence, this evaluates the comparison first and passes a boolean to trim(). So the condition is effectively checking get_nfilter_request_var('import_text') != '' and does not trim the actual payload.

Affected locations:

  • syslog_alerts.php (around line 942)
  • syslog_reports.php (around line 804)
  • syslog_removal.php (around line 742)

Impact

Whitespace-only payloads are treated as non-empty and continue into import parsing, producing avoidable parse/validation failures instead of being treated as empty input.

Expected

Trim the payload string first, then compare:

if (trim(get_nfilter_request_var('import_text')) != '') {

This should be applied consistently in all three import handlers.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions