From 4ddd596054d292bd6fc4d46b74a427c24ecc3e5e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Elan=20Ruusam=C3=A4e?= Date: Mon, 5 Dec 2016 22:50:22 +0200 Subject: [PATCH 1/1] fix su.c compilation https://github.com/shadow-maint/shadow/issues/32 --- shadow.spec | 2 ++ su.patch | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+) create mode 100644 su.patch diff --git a/shadow.spec b/shadow.spec index 401cf7f..99201fe 100644 --- a/shadow.spec +++ b/shadow.spec @@ -61,6 +61,7 @@ Source23: usermod.pamd Patch0: %{name}-pld.patch # allow names with upper case letters or containing dot in the middle Patch1: %{name}-goodname.patch +Patch2: su.patch URL: https://github.com/shadow-maint/shadow BuildRequires: acl-devel BuildRequires: attr-devel @@ -145,6 +146,7 @@ utilitários e senhas shadow em geral. %setup -q %patch0 -p1 %patch1 -p1 +%patch2 -p1 %build %configure \ diff --git a/su.patch b/su.patch new file mode 100644 index 0000000..832d411 --- /dev/null +++ b/su.patch @@ -0,0 +1,51 @@ + +https://github.com/shadow-maint/shadow/issues/32 + +From 67d2bb6e0a5ac124ce1f026dd5723217b1493194 Mon Sep 17 00:00:00 2001 +From: Serge Hallyn +Date: Sun, 18 Sep 2016 21:31:18 -0500 +Subject: [PATCH] su.c: fix missing length argument to snprintf + +--- + src/su.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/su.c b/src/su.c +index 0c50a94..93ffd2f 100644 +--- a/src/su.c ++++ b/src/su.c +@@ -373,8 +373,8 @@ static void prepare_pam_close_session (void) + stderr); + (void) kill (-pid_child, caught); + +- snprintf (kill_msg, _(" ...killed.\n")); +- snprintf (wait_msg, _(" ...waiting for child to terminate.\n")); ++ snprintf (kill_msg, 256, _(" ...killed.\n")); ++ snprintf (wait_msg, 256, _(" ...waiting for child to terminate.\n")); + + (void) signal (SIGALRM, kill_child); + (void) alarm (2); +From 924cc346475dea7dc394316cd7c3d5d0414e538e Mon Sep 17 00:00:00 2001 +From: Adam Sampson +Date: Thu, 15 Sep 2016 16:54:42 +0100 +Subject: [PATCH] Use sizeof rather than hardcoding snprintf's size argument. + +--- + src/su.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/su.c b/src/su.c +index 93ffd2f..d605af8 100644 +--- a/src/su.c ++++ b/src/su.c +@@ -373,8 +373,8 @@ static void prepare_pam_close_session (void) + stderr); + (void) kill (-pid_child, caught); + +- snprintf (kill_msg, 256, _(" ...killed.\n")); +- snprintf (wait_msg, 256, _(" ...waiting for child to terminate.\n")); ++ snprintf (kill_msg, sizeof kill_msg, _(" ...killed.\n")); ++ snprintf (wait_msg, sizeof wait_msg, _(" ...waiting for child to terminate.\n")); + + (void) signal (SIGALRM, kill_child); + (void) alarm (2); -- 2.44.0