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 aa...@apache.org on 2021/08/07 02:28:07 UTC
[hadoop] branch branch-3.3 updated: Fix potential heap buffer
overflow in hdfs.c. Contributed by Igor Chervatyuk.
This is an automated email from the ASF dual-hosted git repository.
aajisaka pushed a commit to branch branch-3.3
in repository https://gitbox.apache.org/repos/asf/hadoop.git
The following commit(s) were added to refs/heads/branch-3.3 by this push:
new 00c382d Fix potential heap buffer overflow in hdfs.c. Contributed by Igor Chervatyuk.
00c382d is described below
commit 00c382d118b2b7a8860a6f2cd068eff20c656018
Author: Akira Ajisaka <aa...@apache.org>
AuthorDate: Thu Jul 22 10:31:32 2021 +0900
Fix potential heap buffer overflow in hdfs.c. Contributed by Igor Chervatyuk.
(cherry picked from commit 4972e7a246f4aab665fd04ce72d1848bc5da9d4e)
---
.../hadoop-hdfs-native-client/src/main/native/libhdfs/hdfs.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs/hdfs.c b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs/hdfs.c
index 840e5b2..60f2826 100644
--- a/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs/hdfs.c
+++ b/hadoop-hdfs-project/hadoop-hdfs-native-client/src/main/native/libhdfs/hdfs.c
@@ -956,9 +956,14 @@ struct hdfsStreamBuilder {
struct hdfsStreamBuilder *hdfsStreamBuilderAlloc(hdfsFS fs,
const char *path, int flags)
{
- int path_len = strlen(path);
+ size_t path_len = strlen(path);
struct hdfsStreamBuilder *bld;
+ // Check for overflow in path_len
+ if (path_len > SIZE_MAX - sizeof(struct hdfsStreamBuilder)) {
+ errno = EOVERFLOW;
+ return NULL;
+ }
// sizeof(hdfsStreamBuilder->path) includes one byte for the string
// terminator
bld = malloc(sizeof(struct hdfsStreamBuilder) + path_len);
---------------------------------------------------------------------
To unsubscribe, e-mail: common-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-commits-help@hadoop.apache.org