lxc/0125-lxc-fix-strcat-bug-in-cleanpath.patch

29 lines
764 B
Diff
Raw Normal View History

From e9481f7fe1bdd47b1df75c96654c88a606730a2f Mon Sep 17 00:00:00 2001
2019-12-25 15:57:42 +08:00
From: LiFeng <lifeng68@huawei.com>
Date: Fri, 29 Nov 2019 22:16:05 -0500
Subject: [PATCH 125/138] lxc: fix strcat bug in cleanpath
2019-12-25 15:57:42 +08:00
Signed-off-by: LiFeng <lifeng68@huawei.com>
---
src/lxc/path.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/lxc/path.c b/src/lxc/path.c
index 7a5dce9..083893e 100644
2019-12-25 15:57:42 +08:00
--- a/src/lxc/path.c
+++ b/src/lxc/path.c
@@ -200,6 +200,10 @@ char *cleanpath(const char *path, char *realpath, size_t realpath_len)
ERROR("Failed to get the end of respath");
goto error;
}
+ if (strlen(path) > (PATH_MAX - strlen(respath) - 1)) {
+ ERROR("Path is too long");
+ goto error;
+ }
strcat(respath, path);
stpos = path;
} else {
--
1.8.3.1
2019-12-25 15:57:42 +08:00