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

Improve readdir_r buffer handling in TimeZone_md.c

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P5
    • Resolution: Won't Fix
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: core-libs
    • Labels:
      None

      Description

      JDK-8165936 fixed a potential buffer overflow in TimeZone_md.c, but broke Solaris, which was fixed with JDK-8166148. The code now imposes a minimum buffer size of 1024 bytes for the readdir_r buffer.

      A better way would be to just rely on pathconf():
      - if pathconf() returns an error, return an error as well
      - Otherwise use the length pathconf() returned, but use a canary at the end of the buffer to check for buffer overflows.

      The latter point is important because readdir_r in combination with pathconf is unsafe, see e.g. https://womble.decadent.org.uk/readdir_r-advisory.html

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                naoto Naoto Sato
                Reporter:
                stuefe Thomas Stuefe
              • Votes:
                0 Vote for this issue
                Watchers:
                6 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: