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

JDWP: Unforseen output truncation in logging

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      b11

      Backports

        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:
                7 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved: