about summary refs log tree commit diff
path: root/nis/nisplus-parser.h
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2017-11-22 18:44:23 +0000
committerJoseph Myers <joseph@codesourcery.com>2017-11-22 18:44:23 +0000
commit4bae615022cb5a5da79ccda83cc6c9ba9f2d479c (patch)
tree30b4650b346806f305c0578299a5abae88d11eca /nis/nisplus-parser.h
parent4b7af5fca7db9fe1f4c078c57f20a08e2a1e2404 (diff)
downloadglibc-4bae615022cb5a5da79ccda83cc6c9ba9f2d479c.tar.gz
glibc-4bae615022cb5a5da79ccda83cc6c9ba9f2d479c.tar.xz
glibc-4bae615022cb5a5da79ccda83cc6c9ba9f2d479c.zip
Avoid use of strlen in getlogin_r (bug 22447).
Building glibc with current mainline GCC fails, among other reasons,
because of an error for use of strlen on the nonstring ut_user field.
This patch changes the problem code in getlogin_r to use __strnlen
instead.  It also needs to set the trailing NUL byte of the result
explicitly, because of the case where ut_user does not have such a
trailing NUL byte (but the result should always have one).

Tested for x86_64.  Also tested that, in conjunction with
<https://sourceware.org/ml/libc-alpha/2017-11/msg00797.html>, it fixes
the build for arm with mainline GCC.

	[BZ #22447]
	* sysdeps/unix/getlogin_r.c (__getlogin_r): Use __strnlen not
	strlen to compute length of ut_user and set trailing NUL byte of
	result explicitly.
Diffstat (limited to 'nis/nisplus-parser.h')
0 files changed, 0 insertions, 0 deletions