Skip to content

FIX: use snprintf instead of sprintf#1619

Closed
ismagilli wants to merge 1 commit into
nothings:masterfrom
ismagilli:fix_sprintf
Closed

FIX: use snprintf instead of sprintf#1619
ismagilli wants to merge 1 commit into
nothings:masterfrom
ismagilli:fix_sprintf

Conversation

@ismagilli

Copy link
Copy Markdown

Modern compilers warn that the sprintf function is deprecated. I have added a call to snprintf function.

Note. Function snprintf appeared only in C99, so I added a check that the program compiles to the C99 standard and above. The gcc and clang compilers define the constant __STDC_VERSION__. The defined(__STDC_VERSION__) check is necessary because the __STDC_VERSION__ constant may not defined.

From man snprintf:

the snprintf() and vsnprintf() functions conform to ISO/IEC 9899:1999 (“ISO C99”)

@ismagilli

Copy link
Copy Markdown
Author

Update commit text:

- FIX: use snprintf instead of sprintf
+ FIX: image_writer: use snprintf instead of sprintf

@scpeters

Copy link
Copy Markdown

is there a reason this wasn't merged?

@nothings

Copy link
Copy Markdown
Owner

is there a reason this wasn't merged?

no

(i mean, of course the answer to this specific wording is 'yes' basically by definition, but i know what you mean, and the answer to that is 'no')

@scpeters

scpeters commented Feb 5, 2026

Copy link
Copy Markdown

is there a reason this wasn't merged?

no

(i mean, of course the answer to this specific wording is 'yes' basically by definition, but i know what you mean, and the answer to that is 'no')

ok, I opened a new PR with a cherry-pick from this branch in #1887 on the chance that this could be merged

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants