Uploaded image for project: 'Hadoop HDFS'
  1. Hadoop HDFS
  2. HDFS-8707 Implement an async pure c++ HDFS client
  3. HDFS-10527

libhdfs++: hdfsGetBlockLocations doesn't null terminate ip address strings

    XMLWordPrintableJSON

Details

    • Sub-task
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • None
    • hdfs-client
    • None

    Description

      Code looks like this

      strncpy(buf, ipaddr.c_str(),ipaddr.size());
      

      But should be

      strncpy(buf, ipaddr.c_str(),ipaddr.size()+1);
      

      In order to make sure there is at least 1 null terminating byte. If we could run the minidfscluster an another process and run valgrind on the libhdfs++ tests this would show up really quickly as a sequence of invalid reads when that const char* was passed to std::string::string(const char*), strlen, or strcpy.

      Attachments

        1. HDFS-10527.HDFS-8707.000.patch
          1 kB
          James Clampffer

        Activity

          People

            James C James Clampffer
            James C James Clampffer
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: