lkml.org 
[lkml]   [2018]   [May]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] ext4: prefer strlcpy to strncpy
On Mon, May 28, 2018 at 11:21:53PM -0700, Nick Desaulniers wrote:
> Fixes a stringop-truncation warning from gcc-8.
>
> Signed-off-by: Nick Desaulniers <nick.desaulniers@gmail.com>

I'll note that the ext4 superblock fields are *not* guaranteed to be
NULL terminated. Code that references them must, and do, deal with
this appropriately. See for example:

https://git.kernel.org/pub/scm/fs/ext2/e2fsprogs.git/tree/lib/e2p/ls.c#n436

GCC-8 may whine about it, but the whine is, in fact, not correct.
It's making assumptions about all strings being null terminated, which
is often, but not always, the case.

Cheers,

- Ted

\
 
 \ /
  Last update: 2018-05-30 07:15    [W:0.076 / U:0.548 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site