[lxc-devel] [PATCH 1/3] Bad checking of getconfig key

Clement Calmels clement.calmels at fr.ibm.com
Thu Sep 16 14:05:44 UTC 2010


Without this patch all false config key that looks like a real one are
valid. For example:

 lxc-execute -n foo -s 'lxc.utsnamebug= bar'

With this patch it now raises an error:

$ lxc-execute -n foo -s 'lxc.utsnamebug= bar' -- uname -a
lxc-execute: unknow key lxc.utsnamebug

Signed-off-by: Clement Calmels <clement.calmels at fr.ibm.com>
---

 src/lxc/confile.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/src/lxc/confile.c b/src/lxc/confile.c
index 610ca15..76fa9ac 100644
--- a/src/lxc/confile.c
+++ b/src/lxc/confile.c
@@ -107,8 +107,7 @@ static struct config *getconfig(const char *key)
 	int i;
 
 	for (i = 0; i < config_size; i++)
-		if (!strncmp(config[i].name, key,
-			     strlen(config[i].name)))
+		if (!strcmp(config[i].name, key))
 			return &config[i];
 	return NULL;
 }





More information about the lxc-devel mailing list