[Nagiosplug-devel] several problems with 1.4 plugins
Nikolay Sturm
sturm at erisiandiscord.de
Sat Apr 2 05:59:13 CEST 2005
Hi!
I have several problems with the 1.4 plugins on OpenBSD.
1)
check_swap.c: In function `process_arguments':
check_swap.c:386: warning: unknown conversion type character `.' in format
check_swap.c:386: warning: int format, float arg (arg 3)
check_swap.c:386: warning: too many arguments for format
check_swap.c:403: warning: unknown conversion type character `.' in format
check_swap.c:403: warning: int format, float arg (arg 3)
check_swap.c:403: warning: too many arguments for format
Is this '.' intentional?
2) You happen to still use sprintf(), strcpy(), strcat() and friends all
the time. It is widely accepted, that these functions are insecure and
shouldn't be used. Personally, I'd like to see the nagios-plugins use
snprintf(), strlcpy(), strlcat() and friends instead, would you accept a
patch testing for these functions existence in configure and using them
if available?
3) At least on OpenBSD, the crypto library is called libcrypto and not
libcrypt.
4) ${PGINCLUDE} is missing from check_pqsql's build rule, so that header
files in /usr/include/postgresql are not found.
5) check_smtp is misusing static buffers, diff attached.
Nikolay
-------------- next part --------------
$OpenBSD: patch-plugins_check_smtp_c,v 1.1.1.1 2005/02/14 14:00:34 sturm Exp $
--- plugins/check_smtp.c.orig Mon Jan 24 17:35:52 2005
+++ plugins/check_smtp.c Mon Jan 24 17:35:18 2005
@@ -76,7 +76,7 @@ int my_close(void);
char regex_expect[MAX_INPUT_BUFFER] = "";
regex_t preg;
regmatch_t pmatch[10];
-char timestamp[10] = "";
+char timestamp[20] = "";
char errbuf[MAX_INPUT_BUFFER];
int cflags = REG_EXTENDED | REG_NOSUB | REG_NEWLINE;
int eflags = 0;
@@ -668,7 +668,7 @@ check_certificate (X509 ** certificate)
days_left = (mktime (&stamp) - time (NULL)) / 86400;
snprintf
- (timestamp, 16, "%02d/%02d/%04d %02d:%02d",
+ (timestamp, sizeof(timestamp), "%02d/%02d/%04d %02d:%02d",
stamp.tm_mon + 1,
stamp.tm_mday, stamp.tm_year + 1900, stamp.tm_hour, stamp.tm_min);
More information about the Devel
mailing list