Skip to content

Commit

Permalink
ncpfs: read buffer overflow
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
RoelKluin authored and torvalds committed Sep 23, 2009
1 parent a7e3108 commit c5df591
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/ncpfs/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit c5df591

Please sign in to comment.