Date: Wed, 25 May 2016 23:26:03 +0200 From: Ed Schouten <ed@nuxi.nl> To: Don Lewis <truckman@freebsd.org> Cc: freebsd-arch@freebsd.org Subject: Re: is ut_user[] in struct utmpx NUL terminated? Message-ID: <CABh_MKkY_puFRj8VX3eX2A3RJ8GeAQb%2BT8NhUEVOKohTmOWdhg@mail.gmail.com> In-Reply-To: <201605252114.u4PLE1NA007337@gw.catspoiler.org> References: <CABh_MKn20ABaQ=N2s44jscsDUZ6n2s8nWX5DdYa4jGNfUqAf=g@mail.gmail.com> <201605252114.u4PLE1NA007337@gw.catspoiler.org>
next in thread | previous in thread | raw e-mail | index | archive | help
Hi Don, 2016-05-25 23:14 GMT+02:00 Don Lewis <truckman@freebsd.org>: > Going in the other direction, getutxent() > calls futx_to_utx(), which uses the FTOU_STRING() macro, which in turn > uses strncpy() to copy the data back out. Keep in mind that strcpy() is called with a size that is at most one less than sizeof(ut->ut_user). The final byte in the array is never overwritten. -- Ed Schouten <ed@nuxi.nl> Nuxi, 's-Hertogenbosch, the Netherlands KvK-nr.: 62051717
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CABh_MKkY_puFRj8VX3eX2A3RJ8GeAQb%2BT8NhUEVOKohTmOWdhg>