RFR: 8296812: sprintf is deprecated in Xcode 14 [v2]

David Holmes dholmes at openjdk.org
Mon Nov 14 01:57:23 UTC 2022


On Sun, 13 Nov 2022 22:55:30 GMT, Xue-Lei Andrew Fan <xuelei at openjdk.org> wrote:

>> Hi,
>> 
>> May I have this update reviewed?
>> 
>> The sprintf is deprecated in Xcode 14 because of security concerns, and the use of it causing building failure.  The build could pass if warnings are disabled for codes that use sprintf method.  For the long run, the sprintf could be replaced with snprintf.  This patch is trying to check if snprintf could be used.
>> 
>> Thanks,
>> Xuelei
>
> Xue-Lei Andrew Fan has updated the pull request incrementally with two additional commits since the last revision:
> 
>  - use os::snprintf for desktop update
>  - use os::snprintf

The hotspot changes seem okay using os::snprint. The adlc changes to use raw snprintf also seem okay for now - I'm not sure whether the platform differences for snprintf affect adlc.

The desktop change is wrong - you can't use os::snprintf there.

Thanks.

src/java.desktop/macosx/native/libjsound/PLATFORM_API_MacOSX_Ports.cpp line 638:

> 636:                         return;
> 637:                     }
> 638:                     os::snprintf(channelName, 16, "Ch %d", ch);

You can't use this here - this is not hotspot code!

-------------

Changes requested by dholmes (Reviewer).

PR: https://git.openjdk.org/jdk/pull/11115



More information about the client-libs-dev mailing list