Patchwork [03/15] target-i386: Add range check for -cpu , family=x

login
register
mail settings
Submitter Andreas Färber
Date April 17, 2012, 11:11 p.m.
Message ID <1334704279-11708-4-git-send-email-afaerber@suse.de>
Download mbox | patch
Permalink /patch/153336/
State New
Headers show

Comments

Andreas Färber - April 17, 2012, 11:11 p.m.
Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 target-i386/cpu.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Patch

diff --git a/target-i386/cpu.c b/target-i386/cpu.c
index e95a1d8..d30185b 100644
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
@@ -693,7 +693,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;
                 }