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 <j...@apache.org> Authored: Thu Jun 16 13:21:22 2016 -0400 Committer: James <j...@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-unsubscr...@hadoop.apache.org For additional commands, e-mail: common-commits-h...@hadoop.apache.org