Skip to content

[BUG] Logger Must Always NUL-Terminate on No-Arg Path #43

Description

@k8ika0s

Proposed PR branch: qe/issue-04-logger-nul-termination

Category: Bug (potential memory disclosure / UB hardening)

Problem

  • Logger path when log_message() is called without extra args must guarantee
    NUL termination to avoid undefined reads and garbage/log leakage.

Justification / why this is needed

  • Unterminated strings can cause reads past the intended buffer, which is UB
    and can leak memory contents into logs (a confidentiality concern).
  • Logging code is often enabled during failures; that’s the worst time to risk
    adding more instability or leaking unrelated memory.

Proposed change

  • Guarantee NUL termination on the no-arg path.
  • Add a regression test that would fail if truncation/untermination occurs.

Acceptance criteria

  • Log strings are always NUL-terminated regardless of arg path.
  • Regression test covers the fixed behavior.

Test plan

  • make test (expects tests/testDriver_logger_nul_termination.c to pass).

References

  • Key files: zdnn/logger.c, tests/testDriver_logger_nul_termination.c.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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