Skip to contentSkip to conversation

mkregtable: Fix sscanf handling

PATCH RESEND New Alan 1 participant 1 message Dec 17, 2013

Subsystems (2)
lore
Share & tools
lore

Alan

author
#0 lore raw

PATCH RESEND 1/1 mkregtable: Fix sscanf handling

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

---
 drivers/gpu/drm/radeon/mkregtable.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpu/drm/radeon/mkregtable.c +1 -1
index af85299..4a85bb6 100644
@@ -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);