* Are ut_user and ut_host in struct utmp NUL-terminated?
@ 2018-08-13 12:10 Florian Weimer
2018-08-13 12:44 ` Andreas Schwab
2018-08-21 8:47 ` Michael Kerrisk (man-pages)
0 siblings, 2 replies; 4+ messages in thread
From: Florian Weimer @ 2018-08-13 12:10 UTC (permalink / raw)
To: GNU C Library, linux-man@vger.kernel.org
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.
Thanks,
Florian
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Are ut_user and ut_host in struct utmp NUL-terminated?
2018-08-13 12:10 Are ut_user and ut_host in struct utmp NUL-terminated? Florian Weimer
@ 2018-08-13 12:44 ` Andreas Schwab
2018-08-21 8:47 ` Michael Kerrisk (man-pages)
1 sibling, 0 replies; 4+ messages in thread
From: Andreas Schwab @ 2018-08-13 12:44 UTC (permalink / raw)
To: Florian Weimer; +Cc: GNU C Library, linux-man@vger.kernel.org
On Aug 13 2018, Florian Weimer <fweimer@redhat.com> wrote:
> Can ut_user be exactly UT_NAMESIZE bytes long? Or is it necessary to set
> aside a byte with the NUL terminator?
login from util-linux doesn't null terminate.
Andreas.
--
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Are ut_user and ut_host in struct utmp NUL-terminated?
2018-08-13 12:10 Are ut_user and ut_host in struct utmp NUL-terminated? Florian Weimer
2018-08-13 12:44 ` Andreas Schwab
@ 2018-08-21 8:47 ` Michael Kerrisk (man-pages)
2018-08-21 11:06 ` Florian Weimer
1 sibling, 1 reply; 4+ messages in thread
From: Michael Kerrisk (man-pages) @ 2018-08-21 8:47 UTC (permalink / raw)
To: Florian Weimer, GNU C Library, linux-man@vger.kernel.org; +Cc: mtk.manpages
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.
Thanks,
Michael
--
Michael Kerrisk
Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/
Linux/UNIX System Programming Training: http://man7.org/training/
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Are ut_user and ut_host in struct utmp NUL-terminated?
2018-08-21 8:47 ` Michael Kerrisk (man-pages)
@ 2018-08-21 11:06 ` Florian Weimer
0 siblings, 0 replies; 4+ messages in thread
From: Florian Weimer @ 2018-08-21 11:06 UTC (permalink / raw)
To: Michael Kerrisk (man-pages), GNU C Library,
linux-man@vger.kernel.org
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
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-08-21 11:06 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-08-13 12:10 Are ut_user and ut_host in struct utmp NUL-terminated? Florian Weimer
2018-08-13 12:44 ` Andreas Schwab
2018-08-21 8:47 ` Michael Kerrisk (man-pages)
2018-08-21 11:06 ` Florian Weimer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).