]> git.proxmox.com Git - mirror_qemu.git/commitdiff
target-i386: Add range check for -cpu ,family=x
authorAndreas Färber <afaerber@suse.de>
Tue, 17 Apr 2012 14:15:15 +0000 (16:15 +0200)
committerAndreas Färber <afaerber@suse.de>
Wed, 25 Apr 2012 08:51:35 +0000 (10:51 +0200)
A family field value of 0xf and extended family field value of 0xff is
the maximum representable unsigned family number.
All other CPUID property values are bounds-checked, so add a check here
for symmetry before we adopt it in a property setter.

Signed-off-by: Andreas Färber <afaerber@suse.de>
Reviewed-by: Eduardo Habkost <ehabkost@redhat.com>
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
target-i386/cpu.c

index 3dc0f80c9afd8af8050de10f893b1ffd53b8fd78..5cebb3dd9bac1feb30ad00eb0af7b4df0f5a1520 100644 (file)
@@ -691,7 +691,7 @@ static int cpu_x86_find_by_name(x86_def_t *x86_cpu_def, const char *cpu_model)
             if (!strcmp(featurestr, "family")) {
                 char *err;
                 numvalue = strtoul(val, &err, 0);
-                if (!*val || *err) {
+                if (!*val || *err || numvalue > 0xff + 0xf) {
                     fprintf(stderr, "bad numerical value %s\n", val);
                     goto error;
                 }