Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH] package/libpam-tacplus: fix compilation with GCC 8
@ 2018-12-11 11:21 Carlos Santos
  2018-12-13 21:12 ` Thomas Petazzoni
  2018-12-16 21:30 ` Peter Korsgaard
  0 siblings, 2 replies; 4+ messages in thread
From: Carlos Santos @ 2018-12-11 11:21 UTC (permalink / raw)
  To: buildroot

GCC 8 demands that the size of the string copied by strncpy be smaller
than the size of the destination to keep space for the trailibg '\0'.
This causes a compilation error in pam_tacplus, so add a patch already
sent uptream to fix it.

Fixes:
  http://autobuild.buildroot.net/results/da6d150e470046c03c5f7463de045604e15e4a30/

Signed-off-by: Carlos Santos <casantos@datacom.com.br>
---
 ...0002-Fix-compilation-of-tacc.c-with-GCC-8.patch | 39 ++++++++++++++++++++++
 1 file changed, 39 insertions(+)
 create mode 100644 package/libpam-tacplus/0002-Fix-compilation-of-tacc.c-with-GCC-8.patch

diff --git a/package/libpam-tacplus/0002-Fix-compilation-of-tacc.c-with-GCC-8.patch b/package/libpam-tacplus/0002-Fix-compilation-of-tacc.c-with-GCC-8.patch
new file mode 100644
index 0000000000..2f87b92767
--- /dev/null
+++ b/package/libpam-tacplus/0002-Fix-compilation-of-tacc.c-with-GCC-8.patch
@@ -0,0 +1,39 @@
+From 4c9635b03d0acf140f65004be9d4822297ee5a35 Mon Sep 17 00:00:00 2001
+From: Carlos Santos <casantos@datacom.com.br>
+Date: Mon, 10 Dec 2018 17:27:16 -0200
+Subject: [PATCH] Fix compilation of tacc.c with GCC 8
+
+GCC 8 demands that the size of the string copied by strncpy be smaller
+than the size of the destination to keep space for the trailibg '\0':
+
+tacc.c:378:3: error: 'strncpy' specified bound 4 equals destination size [-Werror=stringop-truncation]
+   strncpy(utmpx.ut_id, tty + C_STRLEN("tty"), sizeof(utmpx.ut_id));
+
+Ensure that no more than sizeof(utmpx.ut_id) - 1 characters are copied
+and that a trailing '\0' is stored.
+
+Fixes:
+  http://autobuild.buildroot.net/results/da6d150e470046c03c5f7463de045604e15e4a30/
+
+Signed-off-by: Carlos Santos <casantos@datacom.com.br>
+---
+ tacc.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/tacc.c b/tacc.c
+index f61e2d7..3c1a40c 100644
+--- a/tacc.c
++++ b/tacc.c
+@@ -375,7 +375,8 @@ int main(int argc, char **argv) {
+ 		utmpx.ut_type = USER_PROCESS;
+ 		utmpx.ut_pid = getpid();
+ 		xstrcpy(utmpx.ut_line, tty, sizeof(utmpx.ut_line));
+-		strncpy(utmpx.ut_id, tty + C_STRLEN("tty"), sizeof(utmpx.ut_id));
++		strncpy(utmpx.ut_id, tty + C_STRLEN("tty"), sizeof(utmpx.ut_id) - 1);
++		utmpx.ut_id[sizeof(utmpx.ut_id) - 1] = '\0';
+ 		xstrcpy(utmpx.ut_host, "dialup", sizeof(utmpx.ut_host));
+ 		utmpx.ut_tv.tv_sec = tv.tv_sec;
+ 		utmpx.ut_tv.tv_usec = tv.tv_usec;
+-- 
+2.14.5
+
-- 
2.14.5

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [Buildroot] [PATCH] package/libpam-tacplus: fix compilation with GCC 8
  2018-12-11 11:21 [Buildroot] [PATCH] package/libpam-tacplus: fix compilation with GCC 8 Carlos Santos
@ 2018-12-13 21:12 ` Thomas Petazzoni
  2018-12-15  0:53   ` Carlos Santos
  2018-12-16 21:30 ` Peter Korsgaard
  1 sibling, 1 reply; 4+ messages in thread
From: Thomas Petazzoni @ 2018-12-13 21:12 UTC (permalink / raw)
  To: buildroot

Hello,

On Tue, 11 Dec 2018 09:21:13 -0200, Carlos Santos wrote:
> GCC 8 demands that the size of the string copied by strncpy be smaller
> than the size of the destination to keep space for the trailibg '\0'.
> This causes a compilation error in pam_tacplus, so add a patch already
> sent uptream to fix it.
> 
> Fixes:
>   http://autobuild.buildroot.net/results/da6d150e470046c03c5f7463de045604e15e4a30/
> 
> Signed-off-by: Carlos Santos <casantos@datacom.com.br>
> ---
>  ...0002-Fix-compilation-of-tacc.c-with-GCC-8.patch | 39 ++++++++++++++++++++++
>  1 file changed, 39 insertions(+)
>  create mode 100644 package/libpam-tacplus/0002-Fix-compilation-of-tacc.c-with-GCC-8.patch

Applied to master, thanks. Please submit the patch upstream. Thanks!

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Buildroot] [PATCH] package/libpam-tacplus: fix compilation with GCC 8
  2018-12-13 21:12 ` Thomas Petazzoni
@ 2018-12-15  0:53   ` Carlos Santos
  0 siblings, 0 replies; 4+ messages in thread
From: Carlos Santos @ 2018-12-15  0:53 UTC (permalink / raw)
  To: buildroot

> From: "Thomas Petazzoni" <thomas.petazzoni@bootlin.com>
> To: "Carlos Santos" <casantos@datacom.com.br>
> Cc: "buildroot" <buildroot@buildroot.org>
> Sent: Quinta-feira, 13 de dezembro de 2018 19:12:12
> Subject: Re: [Buildroot] [PATCH] package/libpam-tacplus: fix compilation with GCC 8

> Hello,
> 
> On Tue, 11 Dec 2018 09:21:13 -0200, Carlos Santos wrote:
>> GCC 8 demands that the size of the string copied by strncpy be smaller
>> than the size of the destination to keep space for the trailibg '\0'.
>> This causes a compilation error in pam_tacplus, so add a patch already
>> sent uptream to fix it.
>> 
>> Fixes:
>>   http://autobuild.buildroot.net/results/da6d150e470046c03c5f7463de045604e15e4a30/
>> 
>> Signed-off-by: Carlos Santos <casantos@datacom.com.br>
>> ---
>>  ...0002-Fix-compilation-of-tacc.c-with-GCC-8.patch | 39 ++++++++++++++++++++++
>>  1 file changed, 39 insertions(+)
>>  create mode 100644
>>  package/libpam-tacplus/0002-Fix-compilation-of-tacc.c-with-GCC-8.patch
> 
> Applied to master, thanks. Please submit the patch upstream. Thanks!

It's already on master, upstream.

-- 
Carlos Santos (Casantos) - DATACOM, P&D

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [Buildroot] [PATCH] package/libpam-tacplus: fix compilation with GCC 8
  2018-12-11 11:21 [Buildroot] [PATCH] package/libpam-tacplus: fix compilation with GCC 8 Carlos Santos
  2018-12-13 21:12 ` Thomas Petazzoni
@ 2018-12-16 21:30 ` Peter Korsgaard
  1 sibling, 0 replies; 4+ messages in thread
From: Peter Korsgaard @ 2018-12-16 21:30 UTC (permalink / raw)
  To: buildroot

>>>>> "Carlos" == Carlos Santos <casantos@datacom.com.br> writes:

 > GCC 8 demands that the size of the string copied by strncpy be smaller
 > than the size of the destination to keep space for the trailibg '\0'.
 > This causes a compilation error in pam_tacplus, so add a patch already
 > sent uptream to fix it.

 > Fixes:
 >   http://autobuild.buildroot.net/results/da6d150e470046c03c5f7463de045604e15e4a30/

 > Signed-off-by: Carlos Santos <casantos@datacom.com.br>

Committed to 2018.11.x, thanks.

-- 
Bye, Peter Korsgaard

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-12-16 21:30 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-12-11 11:21 [Buildroot] [PATCH] package/libpam-tacplus: fix compilation with GCC 8 Carlos Santos
2018-12-13 21:12 ` Thomas Petazzoni
2018-12-15  0:53   ` Carlos Santos
2018-12-16 21:30 ` Peter Korsgaard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox