Skip to content

Fix SMTP rejection check, dropped news posts, and format-string defects - #3

Merged
brainx merged 1 commit into
mainfrom
fix/smtp-and-news-bugs
Jun 18, 2026
Merged

Fix SMTP rejection check, dropped news posts, and format-string defects#3
brainx merged 1 commit into
mainfrom
fix/smtp-and-news-bugs

Conversation

@brainx

@brainx brainx commented Jun 17, 2026

Copy link
Copy Markdown
Owner

Summary

Three compiler-flagged bugs found in the Mixmaster source and fixed:

  • Src/mail.c — SMTP MAIL FROM rejection never detected. The check
    if (!line->data[0] == '2') is parsed as (!line->data[0]) == '2', i.e.
    comparing a boolean (0/1) to '2' (50) — always false. A non-2xx reply to
    MAIL FROM was therefore never treated as an error and delivery proceeded
    anyway. Changed to line->data[0] != '2'.
  • Src/menusend.c — non-anonymous local news posting silently dropped.
    The post/news branch did f = openpipe(NEWS) but never wrote the message or
    closed the pipe, so the article was never injected and the descriptor leaked.
    Now writes the message and closes the pipe (matching the logmail() pattern).
  • Src/menustats.c / Src/rem.c — format-string defects (-Wformat-security).
    printw(ALLPINGERSURL) uses a config-controlled string as a format string;
    fprintf(mbox, line) likewise. Both routed through "%s".

Test plan

  • ./scripts/build-macos.sh builds bin/mixmaster + bin/mixremailer cleanly
  • Targeted warnings (-Wlogical-not-parentheses, -Wtautological-constant-out-of-range-compare, -Wformat-security, news-pipe set but not used) no longer emitted
  • ./bin/mixmaster --version and ./bin/mixremailer -V run
  • parse_yearmonthday unit test passes

Made with Cursor

- mail.c: `!line->data[0] == '2'` parsed as `(!line->data[0]) == '2'`
  (always false), so a non-2xx reply to SMTP MAIL FROM was never treated
  as an error. Use `line->data[0] != '2'` so relay rejections are caught.
- menusend.c: non-anonymous local news posting opened a pipe to NEWS but
  never wrote the message or closed it, silently dropping the post and
  leaking the descriptor. Write the message and close the pipe.
- menustats.c / rem.c: pass non-literal strings through "%s" to avoid
  format-string interpretation (config-controlled ALLPINGERSURL, mbox
  From-line), fixing -Wformat-security warnings.
@brainx
brainx force-pushed the fix/smtp-and-news-bugs branch from 23bcc7e to e7373c7 Compare June 17, 2026 18:24
@brainx
brainx merged commit 5ecc790 into main Jun 18, 2026
1 check passed
@brainx
brainx deleted the fix/smtp-and-news-bugs branch July 26, 2026 00:38
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