smbfs: read buffer overflow
authorRoel Kluin <roel.kluin@gmail.com>
Tue, 22 Sep 2009 23:43:28 +0000 (16:43 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 23 Sep 2009 14:39:27 +0000 (07:39 -0700)
This function uses signed integers for the unix_date and local variables -
if a negative number is supplied and the leap-year condition is not met,
month will be 0, leading to a read of day_n[-1]

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/smbfs/proc.c

index 9468168b9af5e6f22bdbcfb178d91d98d15a75d0..71c29b6670b402719f8475ed34b39a306bda807d 100644 (file)
@@ -509,7 +509,7 @@ date_unix2dos(struct smb_sb_info *server,
                month = 2;
        } else {
                nl_day = (year & 3) || day <= 59 ? day : day - 1;
-               for (month = 0; month < 12; month++)
+               for (month = 1; month < 12; month++)
                        if (day_n[month] > nl_day)
                                break;
        }