Re: [PATCH 4/4] lib/sysfs: fix format overflow

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, May 31, 2017 at 10:28:08PM +0300, Yuriy M. Kaminskiy wrote:
> > For some reason I thought d_name would be allocated, in which case
> > strlen() would be
> > more appropriate. Thank you for pointing out it is very static 255
> > buffer, so added the
> 
> Is this *defined by standard*? I believe not.
> === man dirent.h ===
>        The character array d_name is of unspecified size, but  the  number  of
>        bytes preceding the terminating null byte shall not exceed {NAME_MAX}.

I don't read this as sizeof(d->d_name) is wrong thing as it's array.
Anyway, use NAME_MAX seems like the most robust solution.

    Karel


-- 
 Karel Zak  <kzak@xxxxxxxxxx>
 http://karelzak.blogspot.com
--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux