diff options
author | Andreas Färber <afaerber@suse.de> | 2012-04-17 16:15:15 +0200 |
---|---|---|
committer | Andreas Färber <afaerber@suse.de> | 2012-04-25 10:51:35 +0200 |
commit | a88a677f54e855c0453f06e0347904e4144e1c2b (patch) | |
tree | 903d68a28434f3ed2c9d040f14b2a20e3f3cca87 /target-i386/cpu.c | |
parent | 61dcd775785b07a5e0c3858b67aa356b87543710 (diff) |
target-i386: Add range check for -cpu ,family=x
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>
Diffstat (limited to 'target-i386/cpu.c')
-rw-r--r-- | target-i386/cpu.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/target-i386/cpu.c b/target-i386/cpu.c index 3dc0f80c9a..5cebb3dd9b 100644 --- a/target-i386/cpu.c +++ b/target-i386/cpu.c @@ -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; } |