[Nagiosplug-checkins] SF.net SVN: nagiosplug:[2210] nagiosplug/trunk/plugins-root/check_icmp.c

dermoth at users.sourceforge.net dermoth at users.sourceforge.net
Sat Jun 6 07:56:17 CEST 2009


Revision: 2210
          http://nagiosplug.svn.sourceforge.net/nagiosplug/?rev=2210&view=rev
Author:   dermoth
Date:     2009-06-06 05:56:17 +0000 (Sat, 06 Jun 2009)

Log Message:
-----------
Don't use the plain char type for data buffers

Buffers which are used for holding arbitrary data should be referenced
using pointers to void and accessed using pointers to unsigned char.

Signed-off-by: Holger Weiss <holger at zedat.fu-berlin.de>

Modified Paths:
--------------
    nagiosplug/trunk/plugins-root/check_icmp.c

Modified: nagiosplug/trunk/plugins-root/check_icmp.c
===================================================================
--- nagiosplug/trunk/plugins-root/check_icmp.c	2009-06-06 05:56:08 UTC (rev 2209)
+++ nagiosplug/trunk/plugins-root/check_icmp.c	2009-06-06 05:56:17 UTC (rev 2210)
@@ -184,14 +184,14 @@
 static u_int get_timevaldiff(struct timeval *, struct timeval *);
 static in_addr_t get_ip_address(const char *);
 static int wait_for_reply(int, u_int);
-static int recvfrom_wto(int, char *, unsigned int, struct sockaddr *, u_int *);
+static int recvfrom_wto(int, void *, unsigned int, struct sockaddr *, u_int *);
 static int send_icmp_ping(int, struct rta_host *);
 static int get_threshold(char *str, threshold *th);
 static void run_checks(void);
 static void set_source_ip(char *);
 static int add_target(char *);
 static int add_target_ip(char *, struct in_addr *);
-static int handle_random_icmp(char *, struct sockaddr_in *);
+static int handle_random_icmp(unsigned char *, struct sockaddr_in *);
 static unsigned short icmp_checksum(unsigned short *, int);
 static void finish(int);
 static void crash(const char *, ...);
@@ -300,7 +300,7 @@
 }
 
 static int
-handle_random_icmp(char *packet, struct sockaddr_in *addr)
+handle_random_icmp(unsigned char *packet, struct sockaddr_in *addr)
 {
 	struct icmp p, sent_icmp;
 	struct rta_host *host = NULL;
@@ -694,7 +694,7 @@
 wait_for_reply(int sock, u_int t)
 {
 	int n, hlen;
-	static char buf[4096];
+	static unsigned char buf[4096];
 	struct sockaddr_in resp_addr;
 	struct ip *ip;
 	struct icmp icp;
@@ -814,7 +814,7 @@
 send_icmp_ping(int sock, struct rta_host *host)
 {
 	static union {
-		char *buf; /* re-use so we prevent leaks */
+		void *buf; /* re-use so we prevent leaks */
 		struct icmp *icp;
 		u_short *cksum_in;
 	} packet = { NULL };
@@ -867,7 +867,7 @@
 }
 
 static int
-recvfrom_wto(int sock, char *buf, unsigned int len, struct sockaddr *saddr,
+recvfrom_wto(int sock, void *buf, unsigned int len, struct sockaddr *saddr,
 			 u_int *timo)
 {
 	u_int slen;


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Commits mailing list