You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-commits@hadoop.apache.org by jh...@apache.org on 2016/06/16 17:21:52 UTC

hadoop git commit: HDFS-10527: libhdfs++: hdfsGetBlockLocations doesn't null terminate ip address strings. Contributed by James Clampffer.

Repository: hadoop
Updated Branches:
  refs/heads/HDFS-8707 7c1d5df03 -> 6c264b1cb


HDFS-10527: libhdfs++: hdfsGetBlockLocations doesn't null terminate ip address strings. Contributed by James Clampffer.


Project: http://git-wip-us.apache.org/repos/asf/hadoop/repo
Commit: http://git-wip-us.apache.org/repos/asf/hadoop/commit/6c264b1c
Tree: http://git-wip-us.apache.org/repos/asf/hadoop/tree/6c264b1c
Diff: http://git-wip-us.apache.org/repos/asf/hadoop/diff/6c264b1c

Branch: refs/heads/HDFS-8707
Commit: 6c264b1cbe1b521f0b5345820f1258b02be244c3
Parents: 7c1d5df
Author: James <jh...@apache.org>
Authored: Thu Jun 16 13:21:22 2016 -0400
Committer: James <jh...@apache.org>
Committed: Thu Jun 16 13:21:22 2016 -0400

----------------------------------------------------------------------
 .../src/main/native/libhdfspp/lib/bindings/c/hdfs.cc             | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hadoop/blob/6c264b1c/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/bindings/c/hdfs.cc
----------------------------------------------------------------------
diff --git a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/bindings/c/hdfs.cc b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/bindings/c/hdfs.cc
index 14c56c4..458d56e 100644
--- a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/bindings/c/hdfs.cc
+++ b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/bindings/c/hdfs.cc
@@ -741,11 +741,11 @@ int hdfsGetBlockLocations(hdfsFS fs, const char *path, struct hdfsBlockLocations
 
         char * buf;
         buf = new char[ppDNInfo.getHostname().size() + 1];
-        strncpy(buf, ppDNInfo.getHostname().c_str(), ppDNInfo.getHostname().size());
+        strncpy(buf, ppDNInfo.getHostname().c_str(), ppDNInfo.getHostname().size() + 1);
         dn_info->hostname = buf;
 
         buf = new char[ppDNInfo.getIPAddr().size() + 1];
-        strncpy(buf, ppDNInfo.getIPAddr().c_str(), ppDNInfo.getIPAddr().size());
+        strncpy(buf, ppDNInfo.getIPAddr().c_str(), ppDNInfo.getIPAddr().size() + 1);
         dn_info->ip_address = buf;
       }
     }


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