x86Decode: avoid NULL-dereference upon questionable input

* 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].
This commit is contained in:
Jim Meyering 2010-02-28 13:34:06 +01:00
parent 23e93d95b5
commit e749d77619

View 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;
}