You are viewing a plain text version of this content. The canonical link for it is here.
Posted to hdfs-issues@hadoop.apache.org by "James Clampffer (JIRA)" <ji...@apache.org> on 2016/06/14 19:28:09 UTC

[jira] [Created] (HDFS-10527) libhdfs++: hdfsGetBlockLocations doesn't null terminate ip address strings

James Clampffer created HDFS-10527:
--------------------------------------

             Summary: libhdfs++: hdfsGetBlockLocations doesn't null terminate ip address strings
                 Key: HDFS-10527
                 URL: https://issues.apache.org/jira/browse/HDFS-10527
             Project: Hadoop HDFS
          Issue Type: Sub-task
            Reporter: James Clampffer
            Assignee: James Clampffer


Code looks like this
{code}
strncpy(buf, ipaddr.c_str(),ipaddr.size());
{code}

But should be
{code}
strncpy(buf, ipaddr.c_str(),ipaddr.size()+1);
{code}

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.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: hdfs-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: hdfs-issues-help@hadoop.apache.org