From: Andrew Morton <akpm@linux-foundation.org>
To: Roel Kluin <roel.kluin@gmail.com>
Cc: linux-kernel@vger.kernel.org, Zhaolei <zhaolei@cn.fujitsu.com>
Subject: Re: [PATCH] smbfs: Read buffer overflow
Date: Fri, 24 Jul 2009 16:49:09 -0700 [thread overview]
Message-ID: <20090724164909.b3f6cf2b.akpm@linux-foundation.org> (raw)
In-Reply-To: <4A688661.9040506@gmail.com>
On Thu, 23 Jul 2009 17:48:49 +0200
Roel Kluin <roel.kluin@gmail.com> wrote:
> 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>
> ---
> This is the easiest way to prevent the buffer overflow, but it produces a date.
> Maybe a magic date would be better? What should we choose?
>
> Credits to Parfait and Nathan Keynes,
>
> diff --git a/fs/smbfs/proc.c b/fs/smbfs/proc.c
> index 9468168..71c29b6 100644
> --- a/fs/smbfs/proc.c
> +++ b/fs/smbfs/proc.c
> @@ -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;
> }
Again, fixable by switching to the kernel/time/timeconv.c functions.
prev parent reply other threads:[~2009-07-24 23:49 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-23 15:48 [PATCH] smbfs: Read buffer overflow Roel Kluin
2009-07-24 23:49 ` Andrew Morton [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090724164909.b3f6cf2b.akpm@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=roel.kluin@gmail.com \
--cc=zhaolei@cn.fujitsu.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.