]> xenbits.xensource.com Git - libvirt.git/commitdiff
x86Decode: avoid NULL-dereference upon questionable input
authorJim Meyering <meyering@redhat.com>
Sun, 28 Feb 2010 12:34:06 +0000 (13:34 +0100)
committerJim Meyering <meyering@redhat.com>
Tue, 2 Mar 2010 07:58:45 +0000 (08:58 +0100)
* src/cpu/cpu_x86.c (x86Decode): Don't dereference NULL when passed
a NULL "models" pointer, or when passed a nonzero "nmodels" value
and a corresponding NULL models[i].

src/cpu/cpu_x86.c

index 2194c32730e9a62984e83462db88ea7bc0021802..b263629a0dafc4f85ddc7af090a3b995c61f999e 100644 (file)
@@ -998,7 +998,7 @@ x86Decode(virCPUDefPtr cpu,
         }
 
         for (i = 0; i < nmodels; i++) {
-            if (STREQ(models[i], candidate->name)) {
+            if (models && models[i] && STREQ(models[i], candidate->name)) {
                 allowed = true;
                 break;
             }