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

Clang warning: deprecated sprintf usage in json_reader (Version: 1.11) #4569

Closed
ckeshava opened this issue Jun 12, 2023 · 0 comments · Fixed by #4747
Closed

Clang warning: deprecated sprintf usage in json_reader (Version: 1.11) #4569

ckeshava opened this issue Jun 12, 2023 · 0 comments · Fixed by #4747

Comments

@ckeshava
Copy link
Collaborator

Issue Description

Clang compiler throws the following warning regarding the usage of sprintf function.

/Users/ckeshavabs/personal-code/rippled/src/ripple/json/impl/json_reader.cpp:928:5: warning: '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. [-Wdeprecated-declarations]
    sprintf(buffer, "Line %d, Column %d", line, column);
    ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.3.sdk/usr/include/stdio.h:188:1: note: 'sprintf' has been explicitly marked deprecated here
__deprecated_msg("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.")
^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.3.sdk/usr/include/sys/cdefs.h:215:48: note: expanded from macro '__deprecated_msg'
        #define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg)))

Steps to Reproduce

Compiling the latest version of rippled codebase throws this warning.

Environment

Here is the version details of the clang compiler:

Apple clang version 14.0.3 (clang-1403.0.22.14.1)
Target: arm64-apple-darwin22.5.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

I'm not sure if this warning is benign and could be ignored. Putting it out here for reference.

ckeshava added a commit to ckeshava/rippled that referenced this issue Jun 12, 2023
Instead of sprintf use the suggested snprintf function
@ckeshava ckeshava changed the title [Clang warning: deprecated sprintf usage in json_reader] (Version: 1.11) Clang warning: deprecated sprintf usage in json_reader (Version: 1.11) Jun 12, 2023
ckeshava added a commit to ckeshava/rippled that referenced this issue Jul 3, 2023
Instead of sprintf use the suggested snprintf function
ckeshava added a commit to ckeshava/rippled that referenced this issue Jul 3, 2023
Instead of sprintf use the suggested snprintf function
ckeshava added a commit to ckeshava/rippled that referenced this issue Jul 10, 2023
Instead of sprintf use the suggested snprintf function
ckeshava added a commit to ckeshava/rippled that referenced this issue Sep 22, 2023
Instead of sprintf use the suggested snprintf function
ckeshava added a commit to ckeshava/rippled that referenced this issue Oct 4, 2023
ckeshava added a commit to ckeshava/rippled that referenced this issue Oct 4, 2023
intelliot pushed a commit that referenced this issue Jan 16, 2024
Resolves a warning that was emitted from the clang compiler. Switches
usage of the sprintf function to the recommended snprintf function.

Warning was observed in Apple clang version 15.0.0 (clang-1500.0.40.1).

Fix #4569
sophiax851 pushed a commit to sophiax851/rippled that referenced this issue Jun 12, 2024
Resolves a warning that was emitted from the clang compiler. Switches
usage of the sprintf function to the recommended snprintf function.

Warning was observed in Apple clang version 15.0.0 (clang-1500.0.40.1).

Fix XRPLF#4569
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant