[Nagios-devel] Necessary patch for nagios-plugins-1.3.0-beta2

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
Guest

[Nagios-devel] Necessary patch for nagios-plugins-1.3.0-beta2

Post by Guest »

--=-Pv6qlj1h5L3DfJc70XY2
Content-Type: text/plain
Content-Transfer-Encoding: 7bit

If you don't apply this patch, most (if not all) plugins will crash if
you don't supply all parameters.

Regards
Henning

--
Dipl.-Inf. (Univ.) Henning P. Schmiedehausen -- Geschaeftsfuehrer
INTERMETA - Gesellschaft fuer Mehrwertdienste mbH hps@intermeta.de

Am Schwabachgrund 22 Fon.: 09131 / 50654-0 info@intermeta.de
D-91054 Buckenhof Fax.: 09131 / 50654-20

--=-Pv6qlj1h5L3DfJc70XY2
Content-Disposition: attachment; filename=nagios-plugins-1.3-utils.patch
Content-Type: text/plain; name=nagios-plugins-1.3-utils.patch; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

--- nagios-plugins-1.3.0-beta2/plugins/utils.c~ Mon Nov 18 08:22:28 2002
+++ nagios-plugins-1.3.0-beta2/plugins/utils.c Wed Jan 1 23:11:38 2003
@@ -165,6 +165,9 @@
int o1, o2, o3, o4;
char c[1];

+ if (!address)
+ return FALSE;
+
if (sscanf (address, "%d.%d.%d.%d%c", &o1, &o2, &o3, &o4, c) != 4)
return FALSE;
else if (o1 > 255 || o2 > 255 || o3 > 255 || o4 > 255)
@@ -185,7 +188,7 @@
int
is_hostname (char *s1)
{
- if (strlen (s1) > 63)
+ if (!s1 || strlen (s1) > 63)
return FALSE;
if (strcspn
(s1,
@@ -208,6 +211,10 @@
{
char tmp[1];
float x;
+
+ if (!number)
+ return FALSE;
+
if (sscanf (number, "%f%c", &x, tmp) == 1)
return (TRUE);
return (FALSE);
@@ -251,7 +258,7 @@
{
long int n;

- if (strspn (number, "-0123456789 ") != strlen (number))
+ if (!number || (strspn (number, "-0123456789 ") != strlen (number)))
return (FALSE);

n = strtol (number, NULL, 10);
@@ -296,6 +303,9 @@
int
is_option (char *str)
{
+ if (!str)
+ return FALSE;
+
if (strspn (str, "-") == 1 || strspn (str, "-") == 2)
return TRUE;
return FALSE;

--=-Pv6qlj1h5L3DfJc70XY2--






This post was automatically imported from historical nagios-devel mailing list archives
Original poster: hps@intermeta.de
Locked