Skip to content

MDEV-39173 Replace sprintf with snprintf#4869

Open
Pochatkin wants to merge 1 commit intoMariaDB:mainfrom
Pochatkin:MDEV-39173
Open

MDEV-39173 Replace sprintf with snprintf#4869
Pochatkin wants to merge 1 commit intoMariaDB:mainfrom
Pochatkin:MDEV-39173

Conversation

@Pochatkin
Copy link
Copy Markdown

@Pochatkin Pochatkin commented Mar 27, 2026

https://jira.mariadb.org/browse/MDEV-39173

Remove the unscoped #pragma GCC diagnostic ignored "-Wdeprecated-declarations" from include/violite.h. The pragma was originally added to suppress OpenSSL deprecation warnings on macOS, but is no longer needed as modern macOS builds use bundled WolfSSL or external OpenSSL without deprecated declarations.

The pragma also silently suppressed ~100 "sprintf is deprecated" warnings on macOS. Replace all sprintf/vsprintf calls with snprintf/vsnprintf across the codebase (118 files), excluding vendored third-party code (readline, wolfssl, wsrep-lib, libmariadb, groonga, zlib).

…f with snprintf

Remove the unscoped #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
from include/violite.h. The pragma was originally added to suppress OpenSSL
deprecation warnings on macOS, but is no longer needed as modern macOS builds
use bundled WolfSSL or external OpenSSL without deprecated declarations.

The pragma also silently suppressed ~100 "sprintf is deprecated" warnings on
macOS. Replace all sprintf/vsprintf calls with snprintf/vsnprintf across the
codebase (118 files), excluding vendored third-party code (readline, wolfssl,
wsrep-lib, libmariadb, groonga, zlib).
@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Mar 27, 2026

CLA assistant check
All committers have signed the CLA.

@Pochatkin
Copy link
Copy Markdown
Author

@gkodinov Could you please take a look as ticket reporter?

@gkodinov gkodinov added the External Contribution All PRs from entities outside of MariaDB Foundation, Corporation, Codership agreements. label Mar 27, 2026
Copy link
Copy Markdown
Member

@gkodinov gkodinov left a comment

Choose a reason for hiding this comment

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

Thank you for attempting to fix this.
Unfortunately, it's not as simple as letting some AI do it.
You will need to find the actual size of the buffer and then set that as a limit.
In some cases the AI actually managed (mostly when the buffer is a local stack variable). But that's unfortunately not easy in cases where a bigger context is needed.
And it's especially impossible when certain assumptions are made couple of layers up.

Also, please resolve the merge conflicts. And any resulting buildbot failures.

One final thing: please rebase this to 10.11. This was the version decided as the best starting point after some deliberation.

if (histfile)
{
sprintf(histfile,"%s/.mariadb_history", home);
snprintf(histfile,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

That's not how you do this! It's about the size of the receiving buffer.

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

Labels

External Contribution All PRs from entities outside of MariaDB Foundation, Corporation, Codership agreements.

Development

Successfully merging this pull request may close these issues.

3 participants