public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] fat: Read buffer overflow
@ 2009-08-07 22:48 Roel Kluin
  2009-08-07 23:06 ` OGAWA Hirofumi
  0 siblings, 1 reply; 7+ messages in thread
From: Roel Kluin @ 2009-08-07 22:48 UTC (permalink / raw)
  To: OGAWA Hirofumi, Andrew Morton, LKML

If len is less or equal to 0, this results in a read of s[-1].

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
---
diff --git a/fs/fat/namei_vfat.c b/fs/fat/namei_vfat.c
index 6f27853..114ff6d 100644
--- a/fs/fat/namei_vfat.c
+++ b/fs/fat/namei_vfat.c
@@ -202,6 +202,9 @@ static inline int vfat_is_used_badchars(const wchar_t *s, int len)
 {
 	int i;
 
+	if (len <= 0)
+		return -EINVAL;
+
 	for (i = 0; i < len; i++)
 		if (vfat_bad_char(s[i]))
 			return -EINVAL;

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2009-08-08 13:00 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <d6Gqb-2HX-3@gated-at.bofh.it>
2009-08-08 13:01 ` [PATCH] fat: Read buffer overflow Alexander Koeppe
2009-08-07 22:48 Roel Kluin
2009-08-07 23:06 ` OGAWA Hirofumi
2009-08-08  6:56   ` Pekka Enberg
2009-08-08 10:10     ` OGAWA Hirofumi
2009-08-08 10:12       ` Pekka Enberg
2009-08-08 10:18       ` OGAWA Hirofumi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox