]> git.proxmox.com Git - mirror_lxc.git/commitdiff
fix segfault when an unsupported personality is set
authorDaniel Lezcano <daniel.lezcano@free.fr>
Thu, 11 Aug 2011 23:34:49 +0000 (01:34 +0200)
committerDaniel Lezcano <dlezcano@fr.ibm.com>
Thu, 11 Aug 2011 23:34:49 +0000 (01:34 +0200)
Bad array len computation.

Signed-off-by: Daniel Lezcano <dlezcano@fr.ibm.com>
src/lxc/confile.c

index d632404b1c841aaf85ea95630c5927ea994dfd27..6363965d4921376d6af30cf0185145455eac8d92 100644 (file)
@@ -515,10 +515,11 @@ static int config_personality(const char *key, char *value,
                { "x86_64", PER_LINUX },
                { "amd64", PER_LINUX },
        };
+       size_t len = sizeof(pername) / sizeof(pername[0]);
 
        int i;
 
-       for (i = 0; i < sizeof(pername); i++) {
+       for (i = 0; i < len; i++) {
 
                if (strcmp(pername[i].name, value))
                    continue;