Skip to content

Conversation

@wangkuiyi
Copy link

@wangkuiyi wangkuiyi commented Mar 7, 2023

On macOS, sprintf has been deprecated. Building dumper.c will error if -Werror,-Wdeprecated-declaration is set.

/Users/y/w/libyaml/src/dumper.c:254:5: 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((char *)anchor, ANCHOR_TEMPLATE, anchor_id);
    ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.1.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.1.sdk/usr/include/sys/cdefs.h:215:48: note: expanded from macro '__deprecated_msg'
        #define __deprecated_msg(_msg) __attribute__((__deprecated__(_msg)))

On macOS, sprintf has been deprecated. Building dumper.c will error if `-Werror,-Wdeprecated-declaration` is set.
@wangkuiyi
Copy link
Author

A complete fix should cover unit tests and examples. If such fixes are welcome, I can do it in a separate pull request.

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.

1 participant