Skip to content

cleanup va_start/va_end and introduce vasprintf#826

Open
gottfriedleibniz wants to merge 2 commits intoSDL-Hercules-390:developfrom
gottfriedleibniz:refactor/vasprintf
Open

cleanup va_start/va_end and introduce vasprintf#826
gottfriedleibniz wants to merge 2 commits intoSDL-Hercules-390:developfrom
gottfriedleibniz:refactor/vasprintf

Conversation

@gottfriedleibniz
Copy link
Copy Markdown

Individual commit messages provide additional detail, but in general:

  1. Fix instances in the source where va_start/va_end pairings are incorrect or missing, which is technically undefined behavior.
  2. Replace BFR_VSNPRINTF with the more idiomatic vasprintf (a GNU extension, with a polyfill for build systems that do not support it) to avoid the current brute-force approach.

- Missing va_end statements;
- Incorrect va_copy ordering in BFR_VSNPRINTF;
- Sanitize snprintf results or ensure buffer is initially \0'd.
Replace dynamic format string allocation (i.e., incrementing a buffer by
a fixed amount until vsnprintf returns success) with vasprintf.
Polyfill'ing for builds that do not include the GNU extension.
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