From e9481f7fe1bdd47b1df75c96654c88a606730a2f Mon Sep 17 00:00:00 2001 From: LiFeng Date: Fri, 29 Nov 2019 22:16:05 -0500 Subject: [PATCH 125/138] lxc: fix strcat bug in cleanpath Signed-off-by: LiFeng --- 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 --- 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