JDK-8231600 : Avoid GCC 8 strncpy error in jdk.jdwp.agent
  • Type: Bug
  • Component: core-svc
  • Sub-Component: debugger
  • Affected Version: 13,14
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: generic
  • Submitted: 2019-09-28
  • Updated: 2019-10-12
  • Resolved: 2019-10-01
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 14
14 b17Fixed
Related Reports
Relates :  
Relates :  
Description
There is an unnecessary use of strncpy in JDWP agent:

make[3]: *** [Lib-jdk.jdwp.agent.gmk:32: .../build/linux-x86_64-server-release/support/native/jdk.jdwp.agent/libdt_socket/socketTransport.o] Error 1
make[2]: *** [make/Main.gmk:211: jdk.jdwp.agent-libs] Error 2
make[2]: *** Waiting for unfinished jobs....

ERROR: Build failed for target 'default (exploded-image)' in configuration 'linux-x86_64-server-release' (exit code 2) 
Stopping sjavac server

=== Output from failing command(s) repeated here ===
* For target support_native_jdk.jdwp.agent_libdt_socket_socketTransport.o:
In function 'parseAllowedPeers',
    inlined from 'socketTransport_setConfiguration' at .../src/jdk.jdwp.agent/share/native/libdt_socket/socketTransport.c:1177:23:
.../src/jdk.jdwp.agent/share/native/libdt_socket/socketTransport.c:514:5: error: 'strncpy' output truncated before terminating nul copying as many bytes from a string as its length [-Werror=stringop-truncation]
     strncpy(buffer, allowed_peers, len);
     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.../src/jdk.jdwp.agent/share/native/libdt_socket/socketTransport.c: In function 'socketTransport_setConfiguration':
.../src/jdk.jdwp.agent/share/native/libdt_socket/socketTransport.c:1165:22: note: length computed here
         size_t len = strlen(allowed_peers);
                      ^~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors

* All command lines available in .../build/linux-x86_64-server-release/make-support/failure-logs.
=== End of repeated output ===

Comments
Introduced by JDK-8184770 in 13.
02-10-2019

URL: https://hg.openjdk.java.net/jdk/jdk/rev/a7c95e2f8814 User: cjplummer Date: 2019-10-01 21:24:06 +0000
01-10-2019