[CRIU] [PATCH 1/2] mnt: typo fix

Tycho Andersen tycho.andersen at canonical.com
Tue Apr 14 16:23:25 PDT 2015


We only malloc() size amount of space, so we shouldn't snprintf past that.

Signed-off-by: Tycho Andersen <tycho.andersen at canonical.com>
---
 mount.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mount.c b/mount.c
index 1d8f486..381c483 100644
--- a/mount.c
+++ b/mount.c
@@ -769,7 +769,7 @@ static int resolve_external_mounts(struct mount_info *info)
 		if (!p)
 			return -1;
 
-		ret = snprintf(p, size+1, "%s%s", match->mountpoint + 1, m->root);
+		ret = snprintf(p, size, "%s%s", match->mountpoint + 1, m->root);
 		if (ret < 0 || ret >= size) {
 			free(p);
 			return -1;
-- 
2.1.4



More information about the CRIU mailing list