Skip to content

Fix undeterminate values and return#15

Open
dfateyev wants to merge 2 commits into
halon:masterfrom
dfateyev:fix-uninit-returns
Open

Fix undeterminate values and return#15
dfateyev wants to merge 2 commits into
halon:masterfrom
dfateyev:fix-uninit-returns

Conversation

@dfateyev

Copy link
Copy Markdown
Contributor
  • Fix two indeterminate values read
  • Fix missing return in resolver on Windows

dfateyev and others added 2 commits July 12, 2026 01:40
Two indeterminate values were read on error paths:

- SMTPReadLine() inspected buf[0] outside the `r > 0` guard, so a
  recv() that failed or disconnected on the first iteration read the
  uninitialized one-byte buffer. Move the newline handling inside the
  `r > 0` block.

- main() declared `size_t ret;` without initializing it; if the very
  first SMTPReadLine() (the banner) failed, the error message printed
  ret before it was ever assigned. Initialize it to 0.

Both are undefined behavior with no functional payoff; the fixes are
purely defensive.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
On the __WIN32__ build the method had no return statement, so control
fell off the end of a non-void function (undefined behavior, and a
-Wreturn-type warning). The Windows path keeps no res_state, so return
-1 there; the POSIX path is unchanged.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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