summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHolger Weiss <holger@zedat.fu-berlin.de>2009-06-02 01:09:18 +0200
committerHolger Weiss <holger@zedat.fu-berlin.de>2009-06-02 01:09:18 +0200
commitbc827c9083cdf7e6b4e6931f2eecfa7192baa48f (patch)
treedc328feaf33cfdec48fc884ef84c13a9ea3cb8af
parentaff6140989777cbf128e9e4d6e35531372c284c1 (diff)
downloadmonitoring-plugins-bc827c9083cdf7e6b4e6931f2eecfa7192baa48f.tar.gz
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@zedat.fu-berlin.de>
-rw-r--r--plugins-root/check_icmp.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/plugins-root/check_icmp.c b/plugins-root/check_icmp.c
index 845fc95d..ecf3d08b 100644
--- a/plugins-root/check_icmp.c
+++ b/plugins-root/check_icmp.c
@@ -184,14 +184,14 @@ static u_int get_timevar(const char *);
184static u_int get_timevaldiff(struct timeval *, struct timeval *); 184static u_int get_timevaldiff(struct timeval *, struct timeval *);
185static in_addr_t get_ip_address(const char *); 185static in_addr_t get_ip_address(const char *);
186static int wait_for_reply(int, u_int); 186static int wait_for_reply(int, u_int);
187static int recvfrom_wto(int, char *, unsigned int, struct sockaddr *, u_int *); 187static int recvfrom_wto(int, void *, unsigned int, struct sockaddr *, u_int *);
188static int send_icmp_ping(int, struct rta_host *); 188static int send_icmp_ping(int, struct rta_host *);
189static int get_threshold(char *str, threshold *th); 189static int get_threshold(char *str, threshold *th);
190static void run_checks(void); 190static void run_checks(void);
191static void set_source_ip(char *); 191static void set_source_ip(char *);
192static int add_target(char *); 192static int add_target(char *);
193static int add_target_ip(char *, struct in_addr *); 193static int add_target_ip(char *, struct in_addr *);
194static int handle_random_icmp(char *, struct sockaddr_in *); 194static int handle_random_icmp(unsigned char *, struct sockaddr_in *);
195static unsigned short icmp_checksum(unsigned short *, int); 195static unsigned short icmp_checksum(unsigned short *, int);
196static void finish(int); 196static void finish(int);
197static void crash(const char *, ...); 197static void crash(const char *, ...);
@@ -300,7 +300,7 @@ get_icmp_error_msg(unsigned char icmp_type, unsigned char icmp_code)
300} 300}
301 301
302static int 302static int
303handle_random_icmp(char *packet, struct sockaddr_in *addr) 303handle_random_icmp(unsigned char *packet, struct sockaddr_in *addr)
304{ 304{
305 struct icmp p, sent_icmp; 305 struct icmp p, sent_icmp;
306 struct rta_host *host = NULL; 306 struct rta_host *host = NULL;
@@ -694,7 +694,7 @@ static int
694wait_for_reply(int sock, u_int t) 694wait_for_reply(int sock, u_int t)
695{ 695{
696 int n, hlen; 696 int n, hlen;
697 static char buf[4096]; 697 static unsigned char buf[4096];
698 struct sockaddr_in resp_addr; 698 struct sockaddr_in resp_addr;
699 struct ip *ip; 699 struct ip *ip;
700 struct icmp icp; 700 struct icmp icp;
@@ -814,7 +814,7 @@ static int
814send_icmp_ping(int sock, struct rta_host *host) 814send_icmp_ping(int sock, struct rta_host *host)
815{ 815{
816 static union { 816 static union {
817 char *buf; /* re-use so we prevent leaks */ 817 void *buf; /* re-use so we prevent leaks */
818 struct icmp *icp; 818 struct icmp *icp;
819 u_short *cksum_in; 819 u_short *cksum_in;
820 } packet = { NULL }; 820 } packet = { NULL };
@@ -867,7 +867,7 @@ send_icmp_ping(int sock, struct rta_host *host)
867} 867}
868 868
869static int 869static int
870recvfrom_wto(int sock, char *buf, unsigned int len, struct sockaddr *saddr, 870recvfrom_wto(int sock, void *buf, unsigned int len, struct sockaddr *saddr,
871 u_int *timo) 871 u_int *timo)
872{ 872{
873 u_int slen; 873 u_int slen;