Re: Are ut_user and ut_host in struct utmp NUL-terminated?

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

 



On 08/21/2018 10:47 AM, Michael Kerrisk (man-pages) wrote:
On 08/13/2018 02:10 PM, Florian Weimer wrote:
Can ut_user be exactly UT_NAMESIZE bytes long?  Or is it necessary to
set aside a byte with the NUL terminator?

I'm not sure what POSIX says about struct utmpx.  It never says “string”
in the context of ut_user, so I don't think it clarifies this matter.

Each of the char fields in utmp/utmpx can be completely filled with
characters. (I.e., there may not be a terminating null byte.)
As you note, POSIX does not say much here, but perhaps the fact that
the term "string" is not mentioned is a clue.

And indeed we already use __attribute__ ((__nonstring__)) for those. I should have checked the current sources.

Thanks,
Florian



[Index of Archives]     [Kernel Documentation]     [Netdev]     [Linux 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