public inbox for libc-stable@sourceware.org
 help / color / mirror / Atom feed
From: Florian Weimer <fweimer@redhat.com>
To: libc-stable@sourceware.org
Subject: [2.30 COMMITTED] login: Add nonstring attributes to struct utmp, struct utmpx [BZ #24899]
Date: Wed, 01 Jan 2020 00:00:00 -0000	[thread overview]
Message-ID: <20200117140436.684468299EE3@oldenburg2.str.redhat.com> (raw)

Commit 7532837d7b03b3ca5b9a63d77a5bd81dd23f3d9c ("The
-Wstringop-truncation option new in GCC 8 detects common misuses")
added __attribute_nonstring__ to bits/utmp.h, but it did not update
the parallel bits/utmpx.h header.  In struct utmp, the nonstring
attribute for ut_id was missing.

(cherry picked from commit c2adefbafcdd2519ff43eca6891c77cd7b29ab62)

2019-08-15  Florian Weimer  <fweimer@redhat.com>

	[BZ #24899]
	* sysdeps/gnu/bits/utmpx.h (struct utmpx): Add
	__attribute_nonstring__ to ut_line, ut_id, ut_user, ut_host.
	* sysdeps/unix/sysv/linux/s390/bits/utmpx.h (struct utmpx):
	Likewise.
	* sysdeps/gnu/bits/utmp.h (struct utmp): Add
	__attribute_nonstring__ to ut_id.
	* sysdeps/unix/sysv/linux/s390/bits/utmpx.h (struct utmp):
	Likewise.

diff --git a/NEWS b/NEWS
index b0ab63a83b..ae6c815515 100644
--- a/NEWS
+++ b/NEWS
@@ -25,6 +25,7 @@ The following bugs are resolved with this release:
   [24880] login: Use struct flock64 in utmp
   [24986] alpha: new getegid, geteuid and getppid syscalls used
     unconditionally
+  [24899] login: Add nonstring attributes to struct utmp, struct utmpx
   [24902] login: pututxline could fail to overwrite existing entries
   [25189] Don't use a custom wrapper macro around __has_include
   [25203] libio: Disable vtable validation for pre-2.1 interposed handles
diff --git a/bits/utmp.h b/bits/utmp.h
index 3c02dd4f3f..854b342164 100644
--- a/bits/utmp.h
+++ b/bits/utmp.h
@@ -61,7 +61,8 @@ struct utmp
   pid_t ut_pid;			/* Process ID of login process.  */
   char ut_line[UT_LINESIZE]
     __attribute_nonstring__;	/* Devicename.  */
-  char ut_id[4];		/* Inittab ID.  */
+  char ut_id[4]
+    __attribute_nonstring__;	/* Inittab ID.  */
   char ut_user[UT_NAMESIZE]
     __attribute_nonstring__;	/* Username.  */
   char ut_host[UT_HOSTSIZE]
diff --git a/sysdeps/gnu/bits/utmpx.h b/sysdeps/gnu/bits/utmpx.h
index 472a7d57d3..2beadbf587 100644
--- a/sysdeps/gnu/bits/utmpx.h
+++ b/sysdeps/gnu/bits/utmpx.h
@@ -56,10 +56,14 @@ struct utmpx
 {
   short int ut_type;		/* Type of login.  */
   __pid_t ut_pid;		/* Process ID of login process.  */
-  char ut_line[__UT_LINESIZE];	/* Devicename.  */
-  char ut_id[4];		/* Inittab ID. */
-  char ut_user[__UT_NAMESIZE];	/* Username.  */
-  char ut_host[__UT_HOSTSIZE];	/* Hostname for remote login.  */
+  char ut_line[__UT_LINESIZE]
+    __attribute_nonstring__;	/* Devicename.  */
+  char ut_id[4]
+    __attribute_nonstring__;	/* Inittab ID.  */
+  char ut_user[__UT_NAMESIZE]
+    __attribute_nonstring__;	/* Username.  */
+  char ut_host[__UT_HOSTSIZE]
+    __attribute_nonstring__;	/* Hostname for remote login.  */
   struct __exit_status ut_exit;	/* Exit status of a process marked
 				   as DEAD_PROCESS.  */
 
diff --git a/sysdeps/unix/sysv/linux/s390/bits/utmp.h b/sysdeps/unix/sysv/linux/s390/bits/utmp.h
index 862115c6f8..0569c3b784 100644
--- a/sysdeps/unix/sysv/linux/s390/bits/utmp.h
+++ b/sysdeps/unix/sysv/linux/s390/bits/utmp.h
@@ -61,7 +61,8 @@ struct utmp
   pid_t ut_pid;			/* Process ID of login process.  */
   char ut_line[UT_LINESIZE]
      __attribute_nonstring__;	/* Devicename.  */
-  char ut_id[4];		/* Inittab ID.  */
+  char ut_id[4]
+    __attribute_nonstring__;	/* Inittab ID.  */
   char ut_user[UT_NAMESIZE]
      __attribute_nonstring__;	/* Username.  */
   char ut_host[UT_HOSTSIZE]
diff --git a/sysdeps/unix/sysv/linux/s390/bits/utmpx.h b/sysdeps/unix/sysv/linux/s390/bits/utmpx.h
index ea3e860a2d..737d9dca05 100644
--- a/sysdeps/unix/sysv/linux/s390/bits/utmpx.h
+++ b/sysdeps/unix/sysv/linux/s390/bits/utmpx.h
@@ -56,10 +56,14 @@ struct utmpx
 {
   short int ut_type;		/* Type of login.  */
   __pid_t ut_pid;		/* Process ID of login process.  */
-  char ut_line[__UT_LINESIZE];	/* Devicename.  */
-  char ut_id[4];		/* Inittab ID. */
-  char ut_user[__UT_NAMESIZE];	/* Username.  */
-  char ut_host[__UT_HOSTSIZE];	/* Hostname for remote login.  */
+  char ut_line[__UT_LINESIZE]
+    __attribute_nonstring__;	/* Devicename.  */
+  char ut_id[4]
+    __attribute_nonstring__;	/* Inittab ID.  */
+  char ut_user[__UT_NAMESIZE]
+    __attribute_nonstring__;	/* Username.  */
+  char ut_host[__UT_HOSTSIZE]
+    __attribute_nonstring__;	/* Hostname for remote login.  */
   struct __exit_status ut_exit;	/* Exit status of a process marked
 				   as DEAD_PROCESS.  */
 

                 reply	other threads:[~2020-01-17 14:04 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200117140436.684468299EE3@oldenburg2.str.redhat.com \
    --to=fweimer@redhat.com \
    --cc=libc-stable@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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 read-only IMAP folder(s) and NNTP newsgroup(s).