Skip to content

Change sprintf to snprintf#73

Merged
shineseth-rk merged 1 commit intorockchip-linux:masterfrom
quanghd96:master
Mar 7, 2025
Merged

Change sprintf to snprintf#73
shineseth-rk merged 1 commit intorockchip-linux:masterfrom
quanghd96:master

Conversation

@quanghd96
Copy link
Copy Markdown
Contributor

I found sprintf is deprecated now. So i can not build on some devices. I fixed it by changing sprintf to snprintf. It work fine!

main.cpp:90:3: error: 'sprintf' is deprecated: This function is provided for compatibility reasons only.  Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Werror,-Wdeprecated-declarations]
                sprintf(szText, "Tag Bad Block total %lld, current %lld", totalValue, currentValue);

Tested on Linux and MacOS

@sammcj
Copy link
Copy Markdown

sammcj commented Feb 7, 2023

Thanks so much - this saved me!

@rockchip-linux this fixes builds.

@lukas
Copy link
Copy Markdown

lukas commented Aug 24, 2023

thank you so much - I would have been stuck without this

@christian-tsmx
Copy link
Copy Markdown

@keveryang @Caesar-github please merge this important PR

@timblechmann
Copy link
Copy Markdown

could this patch potentially be merged? it is listed in the radxa's official build instructions: https://docs.radxa.com/en/compute-module/cm5/radxa-os/low-level-dev/rkdeveloptool?host-os=debian

@shineseth-rk shineseth-rk merged commit 054028e into rockchip-linux:master Mar 7, 2025
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.

6 participants