[lxc-devel] [lxc/master] caps: fix illegal access to array bound

2xsec on Github lxc-bot at linuxcontainers.org
Mon Sep 3 05:19:46 UTC 2018


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 404 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20180903/180bf7f4/attachment.bin>
-------------- next part --------------
From 55af38876ff7e869172c1c4c50fe06a182c6a69b Mon Sep 17 00:00:00 2001
From: 2xsec <dh48.jeong at samsung.com>
Date: Mon, 3 Sep 2018 14:18:36 +0900
Subject: [PATCH] caps: fix illegal access to array bound

Signed-off-by: 2xsec <dh48.jeong at samsung.com>
---
 src/lxc/caps.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/lxc/caps.c b/src/lxc/caps.c
index 8ca47bf66..22f230210 100644
--- a/src/lxc/caps.c
+++ b/src/lxc/caps.c
@@ -303,7 +303,7 @@ static long int _real_caps_last_cap(void)
 		if (n < 0 && errno == EINTR) {
 			goto again;
 		} else if (n >= 0) {
-			buf[n] = '\0';
+			buf[n-1] = '\0';
 
 			errno = 0;
 			result = strtol(buf, &ptr, 10);


More information about the lxc-devel mailing list