Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8231600

Avoid GCC 8 strncpy error in jdk.jdwp.agent

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 13, 14
    • Fix Version/s: 14
    • Component/s: core-svc
    • Labels:
      None
    • Subcomponent:
    • Resolved In Build:
      b17
    • CPU:
      generic
    • OS:
      generic

      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 ===

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              fweimer Florian Weimer
              Reporter:
              fweimer Florian Weimer
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: