[PATCH] radeonfb: Fix static array overrun
authorAntonino A. Daplas <adaplas@gmail.com>
Sat, 11 Mar 2006 11:27:28 +0000 (03:27 -0800)
committerLinus Torvalds <torvalds@g5.osdl.org>
Sat, 11 Mar 2006 17:19:36 +0000 (09:19 -0800)
radeonfb_parse_monitor_layout() will produce an array overrun if passed with a
substring of length higher than 4 (ie, "XXXXX,YYYYYY").

Coverity Bug 494

Signed-off-by: Antonino Daplas <adaplas@pol.net>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
drivers/video/aty/radeon_monitor.c

index 7f9838dceab50f05421f7d3a53064e54db6bbd56..98c05bc0de44ac88c1e979d047c6f493b2d7ab0b 100644 (file)
@@ -396,6 +396,10 @@ static int __devinit radeon_parse_monitor_layout(struct radeonfb_info *rinfo,
                                s1[i] = *s;
                        i++;
                }
+
+               if (i > 4)
+                       i = 4;
+
        } while (*s++);
        if (second)
                s2[i] = 0;