lkml.org 
[lkml]   [2009]   [Aug]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] fat: Read buffer overflow
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;

\
 
 \ /
  Last update: 2009-08-08 00:47    [W:0.048 / U:0.044 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site