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

JDWP: Unforseen output truncation in logging

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 13
    • Component/s: core-svc
    • Labels:
    • Subcomponent:
    • Resolved In Build:
      b11

      Description

      GCC 8 reports an error:

      src/jdk.jdwp.agent/share/native/libjdwp/log_messages.c:75:24: error: '%.3d' directive output may be truncated writing between 3 and 11 bytes into a region of size between 0 and 80 [-Werror=format-truncation=]
                          "%s.%.3d %s", timestamp_prefix,
                              ^~~~
      The call is:
          (void)snprintf(tbuf, ltbuf,
                         "%s.%.3d %s", timestamp_prefix,
                         (int)(millisecs), timestamp_postfix);

      It can be fixed by making prefix and postfix reasonably short, like:

      char timestamp_prefix[MAXLEN_TIMESTAMP / 2 - 4];
      char timestamp_postfix[MAXLEN_TIMESTAMP / 2];

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                dchuyko Dmitry Chuyko
                Reporter:
                dchuyko Dmitry Chuyko
              • Votes:
                0 Vote for this issue
                Watchers:
                5 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: