[CRIU] [PATCH] files: don't check uninitialized memory in create_link_remap()
Andrey Vagin
avagin at openvz.org
Tue Aug 19 12:22:16 PDT 2014
Look at this strace output:
107 linkat(45, "", 1017, "./root/git/orig/criu/test/zdtm/live/static/unlink_fstat03.test (deleted)/link_remap.4", AT_EMPTY_PATH) = -1 ENOENT (No such file or director
It's obvious, that we didn't cat the file name.
Here is an error in calculation of offset for the last symbol.
The current version of code sets this offset in strlen(),
but it's actually strlen() - 1.
Signed-off-by: Andrey Vagin <avagin at openvz.org>
---
files-reg.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/files-reg.c b/files-reg.c
index f6c32df..0ffce0e 100644
--- a/files-reg.c
+++ b/files-reg.c
@@ -433,7 +433,7 @@ static int create_link_remap(char *path, int len, int lfd,
link_name[0] = '.';
memcpy(link_name + 1, path, len);
- tmp = link_name + len + 1;
+ tmp = link_name + len;
while (*tmp != '/') {
BUG_ON(tmp == link_name);
tmp--;
--
1.9.3
More information about the CRIU
mailing list