From a88a677f54e855c0453f06e0347904e4144e1c2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20F=C3=A4rber?= Date: Tue, 17 Apr 2012 16:15:15 +0200 Subject: target-i386: Add range check for -cpu ,family=x MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Eduardo Habkost Reviewed-by: Igor Mammedov --- target-i386/cpu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'target-i386') diff --git a/target-i386/cpu.c b/target-i386/cpu.c index 3dc0f80..5cebb3d 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; } -- cgit v1.1