RFR: 8373475: Unintentional format string in logString of AccessInfo.cpp [v2]

Phil Race prr at openjdk.org
Tue Dec 23 19:57:09 UTC 2025


On Tue, 23 Dec 2025 17:22:08 GMT, Alexey Ivanov <aivanov at openjdk.org> wrote:

>> Damon Nguyen has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Combine fprintf
>
> src/jdk.accessibility/windows/native/toolscommon/AccessInfo.cpp line 100:
> 
>> 98:     vsnprintf(tmpbuf, sizeof(tmpbuf), msg, argprt);
>> 99: 
>> 100:     fprintf(logfile, "%s\n", tmpbuf);
> 
> Why can't we use [`fputs`](https://en.cppreference.com/w/c/io/fputs.html) and avoid all the format string logic and ambiguity altogether?
> 
> Alternatively, *use `vfprintf` directly* instead of first formatting the arguments into a temporary buffer with `vsnprintf` and then sending the result to the output.

A similar pattern is used elsewhere in this file. And I don't want this fix to become a reworking of this code, because that isn't a goal here.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/28950#discussion_r2644143842


More information about the client-libs-dev mailing list