Skip to content

Commit a216ee3

Browse files
GauthamBanasandrajojochuang
authored andcommitted
HDFS-15910. Improve security with explicit_bzero (#2793)
(cherry picked from commit 714427c)
1 parent e9b06d9 commit a216ee3

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/lib/bindings/c/hdfs.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1402,7 +1402,7 @@ int hdfsGetBlockLocations(hdfsFS fs, const char *path, struct hdfsBlockLocations
14021402
hdfsBlockLocations *locations = new struct hdfsBlockLocations();
14031403
(*locations_out) = locations;
14041404

1405-
bzero(locations, sizeof(*locations));
1405+
explicit_bzero(locations, sizeof(*locations));
14061406
locations->fileLength = ppLocations->getFileLength();
14071407
locations->isLastBlockComplete = ppLocations->isLastBlockComplete();
14081408
locations->isUnderConstruction = ppLocations->isUnderConstruction();

hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/tests/hdfs_ext_test.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,7 @@ TEST_F(HdfsExtTest, TestReadStats) {
475475
hdfsFile file = hdfsOpenFile(fs, path.c_str(), O_WRONLY, 0, 0, 0);
476476
EXPECT_NE(nullptr, file);
477477
void * buf = malloc(size);
478-
bzero(buf, size);
478+
explicit_bzero(buf, size);
479479
EXPECT_EQ(size, hdfsWrite(fs, file, buf, size));
480480
free(buf);
481481
EXPECT_EQ(0, hdfsCloseFile(fs, file));

hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfspp/tests/hdfspp_mini_dfs.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ class HdfsHandle {
9292
hdfsFile file = hdfsOpenFile(*this, path.c_str(), O_WRONLY, 0, 0, 0);
9393
EXPECT_NE(nullptr, file);
9494
void * buf = malloc(size);
95-
bzero(buf, size);
95+
explicit_bzero(buf, size);
9696
EXPECT_EQ(1024, hdfsWrite(*this, file, buf, size));
9797
EXPECT_EQ(0, hdfsCloseFile(*this, file));
9898
free(buf);

0 commit comments

Comments
 (0)