RFR: JDK-8298248: Limit sscanf outbut width in cgroup file parsers
Thomas Stuefe
stuefe at openjdk.org
Wed Dec 7 09:46:10 UTC 2022
On Wed, 7 Dec 2022 09:20:07 GMT, David Holmes <dholmes at openjdk.org> wrote:
> This doesn't give me a good feeling - the 1023 is 1024-1 but the two are completely independent as expressed. Ideally this would be handled inside the macro but that in turn passes things to `subsystem_file_line_contents` and so there is no easy way to express that the width limit is related to the `bufsize`. :(
>
> So I reluctantly approve.
Yes, this also bugged me. Specifying buffer size twice, with -1 offset no less, seems error-prone. The thing is that the format specifier handed in is not always just "%s", sometimes its more, with suppressed matchers (e.g. "%s %*d").
With the explicit width specifiers I followed what other incarnations of this macro already do, so I did not make it worse. A code revamp would be certainly nice.
-------------
PR: https://git.openjdk.org/jdk/pull/11554
More information about the hotspot-runtime-dev
mailing list