[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tencent_75B1444EF772776526D9B369A374097A6305@qq.com>
Date: Sun, 22 Dec 2024 21:59:56 +0800
From: Edward Adam Davis <eadavis@...com>
To: viro@...iv.linux.org.uk
Cc: devel@...ts.orangefs.org,
eadavis@...com,
hubcap@...ibond.com,
linux-kernel@...r.kernel.org,
martin@...ibond.com,
syzbot+fc519d7875f2d9186c1f@...kaller.appspotmail.com,
syzkaller-bugs@...glegroups.com
Subject: Re: [PATCH] orangefs: fix a oob in orangefs_debug_write
On Sun, 22 Dec 2024 10:35:22 +0000, Al Viro wrote:
> > syzbot report a slab-out-of-bounds Read in orangefs_debug_write. [1]
> >
> > The string passed in from userspace is not terminated with a NULL character,
> > which causes strlen to go out of bounds.
> >
> > Use kstrndup to replace kstrdup.
>
> Better to replace
> if (count > ORANGEFS_MAX_DEBUG_STRING_LEN + 1) {
> silly = count;
> count = ORANGEFS_MAX_DEBUG_STRING_LEN + 1;
> }
> with
> if (count > ORANGEFS_MAX_DEBUG_STRING_LEN) {
> silly = count;
> count = ORANGEFS_MAX_DEBUG_STRING_LEN;
> }
> instead, so that we wouldn't have to deal with lack of NUL anywhere.
Yes, you are right.
Powered by blists - more mailing lists