29 lines
765 B
Diff
29 lines
765 B
Diff
From b6bbee74d4021f0063fabf64be0dae7fcc6a480e Mon Sep 17 00:00:00 2001
|
|
From: LiFeng <lifeng68@huawei.com>
|
|
Date: Fri, 29 Nov 2019 22:16:05 -0500
|
|
Subject: [PATCH 125/131] lxc: fix strcat bug in cleanpath
|
|
|
|
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 7a5dce95..083893e7 100644
|
|
--- 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 {
|
|
--
|
|
2.23.0
|
|
|