Skip to content

Use snprintf instead of sprintf#11605

Merged
xavierleroy merged 1 commit into
ocaml:trunkfrom
kit-ty-kate:no-sprintf
Oct 5, 2022
Merged

Use snprintf instead of sprintf#11605
xavierleroy merged 1 commit into
ocaml:trunkfrom
kit-ty-kate:no-sprintf

Conversation

@kit-ty-kate

Copy link
Copy Markdown
Member

Noticed while porting ocaml-solo5 to OCaml 5.0. It looks more safe this way in case the message somehow gets bigger than 512 bytes.

@xavierleroy xavierleroy left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well spotted, thanks!

(Aside: I had to read the original code several times to understand what it does, but I managed.)

@xavierleroy xavierleroy merged commit 85df591 into ocaml:trunk Oct 5, 2022
xavierleroy pushed a commit that referenced this pull request Oct 5, 2022
@xavierleroy

Copy link
Copy Markdown
Contributor

Cherry-picked to 5.0: 5925908

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants