Uploaded image for project: 'Hadoop Common'
  1. Hadoop Common
  2. HADOOP-9635

Fix Potential Stack Overflow in DomainSocket.c

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.3.0
    • Fix Version/s: 2.3.0
    • Component/s: native
    • Labels:
    • Environment:

      OSX 10.8

    • Target Version/s:

      Description

      When I was running on OSX, the DataNode was segfaulting. On investigation, it was tracked down to this code. A potential stack overflow was also identified.

         utfLength = (*env)->GetStringUTFLength(env, jstr);
         if (utfLength > sizeof(path)) {
           jthr = newIOException(env, "path is too long!  We expected a path "
               "no longer than %zd UTF-8 bytes.", sizeof(path));
           goto done;
         }
        // GetStringUTFRegion does not pad with NUL
         (*env)->GetStringUTFRegion(env, jstr, 0, utfLength, path);
      
      ...
      
        //strtok_r can set rest pointer to NULL when no tokens found.
        //Causes JVM to crash in rest[0]
         for (check[0] = '/', check[1] = '\0', rest = path, token = "";
             token && rest[0];
              token = strtok_r(rest, "/", &rest)) {
      

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              guilt V. Karthik Kumar
            • Votes:
              0 Vote for this issue
              Watchers:
              8 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: