pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/net/nagios-plugins Crash fix: initialize variable, che...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/24bd5e7e7dad
branches:  trunk
changeset: 311157:24bd5e7e7dad
user:      manu <manu%pkgsrc.org@localhost>
date:      Fri Aug 03 14:03:09 2018 +0000

description:
Crash fix: initialize variable, check bounds on string copy.

diffstat:

 net/nagios-plugins/distinfo                             |   3 +-
 net/nagios-plugins/patches/patch-plugins_check_nagios.c |  29 +++++++++++++++++
 2 files changed, 31 insertions(+), 1 deletions(-)

diffs (47 lines):

diff -r f0f19a7973f4 -r 24bd5e7e7dad net/nagios-plugins/distinfo
--- a/net/nagios-plugins/distinfo       Fri Aug 03 09:19:56 2018 +0000
+++ b/net/nagios-plugins/distinfo       Fri Aug 03 14:03:09 2018 +0000
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.23 2017/11/08 03:20:48 taca Exp $
+$NetBSD: distinfo,v 1.24 2018/08/03 14:03:09 manu Exp $
 
 SHA1 (nagios-plugins-2.2.1.tar.gz) = 0d3fc8876343a906f0dcc2c00850e4ad956a150a
 RMD160 (nagios-plugins-2.2.1.tar.gz) = 39c364ac08854a1829d47562d4add1ae58a49334
@@ -15,3 +15,4 @@
 SHA1 (patch-plugins-scripts_check__wave.pl) = 535b008877cad780afa2ed3429ffb84e7da3ec28
 SHA1 (patch-plugins__check_swap.c) = b822de3488ecace977a739ebcfc56229763cd945
 SHA1 (patch-plugins_check__radius.c) = 3f86bac4f7aa52931bad46d9ee4a421c2ee744f3
+SHA1 (patch-plugins_check_nagios.c) = a137ba674b2b61daa3af9a7be705d30af4a48aa8
diff -r f0f19a7973f4 -r 24bd5e7e7dad net/nagios-plugins/patches/patch-plugins_check_nagios.c
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/net/nagios-plugins/patches/patch-plugins_check_nagios.c   Fri Aug 03 14:03:09 2018 +0000
@@ -0,0 +1,29 @@
+$NetBSD: patch-plugins_check_nagios.c,v 1.1 2018/08/03 14:03:09 manu Exp $
+
+Crash fix: initialize variable, check bounds on string copy.
+
+--- plugins/check_nagios.c.orig
++++ plugins/check_nagios.c
+@@ -71,9 +71,9 @@
+       char procstat[8];
+ #ifdef PS_USES_PROCETIME
+       char procetime[MAX_INPUT_BUFFER];
+ #endif /* PS_USES_PROCETIME */
+-      char procprog[MAX_INPUT_BUFFER];
++      char procprog[MAX_INPUT_BUFFER] = { '\0' };
+       char *procargs;
+       int pos, cols;
+       int expected_cols = PS_COLS - 1;
+       const char *zombie = "Z";
+@@ -143,9 +143,10 @@
+ 
+                       /* Some ps return full pathname for command. This removes path */
+                       temp_string = strtok ((char *)procprog, "/");
+                       while (temp_string) {
+-                              strcpy(procprog, temp_string);
++                              strncpy(procprog, temp_string, sizeof(procprog));
++                              procprog[sizeof(procprog) - 1] = '\0';
+                               temp_string = strtok (NULL, "/");
+                       }
+ 
+                       /* May get empty procargs */



Home | Main Index | Thread Index | Old Index