]> git.openfabrics.org - ~emulex/infiniband.git/commitdiff
mkregtable: Fix sscanf handling
authorAlan <gnomes@lxorguk.ukuu.org.uk>
Tue, 17 Dec 2013 15:05:39 +0000 (15:05 +0000)
committerJiri Kosina <jkosina@suse.cz>
Fri, 10 Jan 2014 14:28:10 +0000 (15:28 +0100)
If you feed the tool a suitable bogus register map you can break it
in arbitary (code executing) ways. While this isn't a particularly
exciting or probable attack vector we still ought to fix it.

One of a set of sscanf issues reported by Jackie Chang

Signed-off-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
drivers/gpu/drm/radeon/mkregtable.c

index af85299f212673afd9ce61997aa98b2f286fd2a7..4a85bb644e24036302256ad1f590f4afd5a60850 100644 (file)
@@ -655,7 +655,7 @@ static int parser_auth(struct table *t, const char *filename)
 
        /* first line will contain the last register
         * and gpu name */
-       sscanf(buf, "%s %s", gpu_name, last_reg_s);
+       sscanf(buf, "%9s %9s", gpu_name, last_reg_s);
        t->gpu_prefix = gpu_name;
        last_reg = strtol(last_reg_s, NULL, 16);