ncpfs: read buffer overflow
authorRoel Kluin <[email protected]>
Tue, 22 Sep 2009 23:45:54 +0000 (16:45 -0700)
committerLinus Torvalds <[email protected]>
Wed, 23 Sep 2009 14:39:42 +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 later read of day_n[-1]

Signed-off-by: Roel Kluin <[email protected]>
Cc: Petr Vandrovec <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
fs/ncpfs/dir.c

index 9c590722d87ea87fd458041815da3cd8a519b3d1..b8b5b30d53f0c03a8c11c580bf29470225246293 100644 (file)
@@ -1241,7 +1241,7 @@ ncp_date_unix2dos(int unix_date, __le16 *time, __le16 *date)
                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;
        }