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

Improve readdir_r buffer handling in TimeZone_md.c

    XMLWordPrintable

Details

    • Bug
    • Resolution: Won't Fix
    • P5
    • None
    • None
    • core-libs
    • 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

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

              Dates

                Created:
                Updated:
                Resolved: