Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor 'CMarkup::Format' and 'CMarkup::x_TextToDoc' #51

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

OliverGlandberger
Copy link
Contributor

@OliverGlandberger OliverGlandberger commented Nov 8, 2024

push2312 observed in THIS issue that building with CMake MinGW Makefiles produces errors (Microsoft-specific strcpy_s and _vsnprintf_s functions not being "declared in this scope").

cktii observed in THIS issue that CMarkup::x_TextToDoc contains a vulnerability.

This PR refactors CMarkup::Format to resolve those issues and includes minor improvements:

  • Replaced _vscprintf with vsnprintf for buffer size calculation on non-MSVC platforms, enhancing cross-platform compatibility
  • Used va_copy to safely duplicate the va_list when determining buffer size, preventing potential undefined behavior from double evaluation
  • Update x_TextToDoc to use std::string

@OliverGlandberger
Copy link
Contributor Author

An additional issue was observed during testing; more investigation required before proceeding.

@OliverGlandberger OliverGlandberger changed the title Refactor 'CMarkup::Format' Refactor 'CMarkup::Format' and 'CMarkup::x_TextToDoc' Nov 15, 2024
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.

2 participants