RFR: 8214776: Avoid GCC 8.X strncpy() errors in JFR code

Severin Gehwolf sgehwolf at redhat.com
Tue Dec 11 11:01:18 UTC 2018


Hi Simon,

I'll sponsor this for you.

Thanks,
Severin

On Mon, 2018-12-10 at 07:31 -0800, Markus Gronlund wrote:
> Hi Simon,
> 
> Looks good, thanks for fixing.
> 
> Markus
> 
> -----Original Message-----
> From: Simon Tooke <stooke at redhat.com> 
> Sent: den 10 december 2018 16:25
> To: hotspot-jfr-dev at openjdk.java.net
> Subject: RFR: 8214776: Avoid GCC 8.X strncpy() errors in JFR code
> 
> This small patch fixes some simple warnings in JFR code, found by GCC 8.1 Essentially, any code sequence of the pattern
> 
>     int l = strlen(somestring)
>     char* buffer = malloc(l + 1)
>     strncpy(buffer, somestring, l)
>     buffer[l] = 0
> 
> is replaced by
> 
>     int len = strlen(somestring)
>     char* buffer = malloc(len + 1)
>     strncpy(buffer, somestring, len + 1)
> 
> Bug: https://bugs.openjdk.java.net/browse/JDK-8214776
> Webrev:
> http://cr.openjdk.java.net/~sgehwolf/webrevs/stooke/JDK-8214776/02/webrev/



More information about the hotspot-jfr-dev mailing list