Commit 35ec9443 authored by Andrey Vagin's avatar Andrey Vagin Committed by Pavel Emelyanov

file: reserve one byte in a string buffer for the null byte

*** CID 139492:  Memory - illegal accesses  (BUFFER_SIZE_WARNING)
Signed-off-by: 's avatarPavel Emelyanov <xemul@parallels.com>
parent f62fd617
...@@ -197,7 +197,7 @@ static int fixup_overlayfs(struct fd_parms *p, struct fd_link *link) ...@@ -197,7 +197,7 @@ static int fixup_overlayfs(struct fd_parms *p, struct fd_link *link)
char buf[PATH_MAX]; char buf[PATH_MAX];
int n; int n;
strncpy(buf, link->name, PATH_MAX); strncpy(buf, link->name, PATH_MAX - 1);
n = snprintf(link->name, PATH_MAX, "%s/%s", m->mountpoint, buf + 2); n = snprintf(link->name, PATH_MAX, "%s/%s", m->mountpoint, buf + 2);
if (n >= PATH_MAX) { if (n >= PATH_MAX) {
pr_err("Not enough space to replace %s\n", buf); pr_err("Not enough space to replace %s\n", buf);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment