lkml.org 
[lkml]   [2018]   [May]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] xfs: mark sb_fname as nonstring
From
Date
On 5/25/18 3:16 PM, Arnd Bergmann wrote:

> On Fri, May 25, 2018 at 6:53 PM, Eric Sandeen <sandeen@redhat.com> wrote:
>> On 5/25/18 10:14 AM, Arnd Bergmann wrote:
...

>>> @@ -1860,7 +1860,7 @@ xfs_ioc_setlabel(
>>> spin_lock(&mp->m_sb_lock);
>>> memset(sbp->sb_fname, 0, sizeof(sbp->sb_fname));
>>> - strncpy(sbp->sb_fname, label, sizeof(sbp->sb_fname));
>>> + memcpy(sbp->sb_fname, label, len);
>>
>>
>> Hm but len = strnlen(label, XFSLABEL_MAX + 1);
>> which could be one longer than sbp->sb_fname, no?
>
> We have an explicit check for that, so I think it's ok:
>
> if (len > sizeof(sbp->sb_fname))
> return -EINVAL;

Ah so we do; I wrote this at least 2 weeks ago, you're asking a lot for
me to remember it. (or to even read it, apparently). ;)

Thanks,
-Eric

\
 
 \ /
  Last update: 2018-05-25 22:22    [W:0.641 / U:0.392 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site