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

Xue-Lei Andrew Fan xuelei at openjdk.org
Wed Dec 7 21:25:11 UTC 2022


On Wed, 7 Dec 2022 16:00:04 GMT, Laurent Bourgès <lbourges at openjdk.org> wrote:

>> src/hotspot/os/bsd/attachListener_bsd.cpp line 260:
>> 
>>> 258:   // name ("load", "datadump", ...), and <arg> is an argument
>>> 259:   int expected_str_count = 2 + AttachOperation::arg_count_max;
>>> 260:   const int max_len = (ver_str_len + 1) + (AttachOperation::name_length_max + 1) +
>> 
>> This makes `max_len` a runtime variable, before it was a compile time constant. Below, we use it to create the buf array. IIRC creating an array with a variable runtime length is a non-standard compiler extension. I am surprised this even builds.
>
> better to keep sizeof(ver_str) here (const)

Updated to use sizeof.

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

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


More information about the hotspot-dev mailing list