diff options
author | Holger Weiss <holger@zedat.fu-berlin.de> | 2009-06-01 23:09:18 (GMT) |
---|---|---|
committer | Holger Weiss <holger@zedat.fu-berlin.de> | 2009-06-01 23:09:18 (GMT) |
commit | bc827c9083cdf7e6b4e6931f2eecfa7192baa48f (patch) | |
tree | dc328feaf33cfdec48fc884ef84c13a9ea3cb8af /plugins-root/check_icmp.c | |
parent | aff6140989777cbf128e9e4d6e35531372c284c1 (diff) | |
download | monitoring-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>
Diffstat (limited to 'plugins-root/check_icmp.c')
-rw-r--r-- | plugins-root/check_icmp.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/plugins-root/check_icmp.c b/plugins-root/check_icmp.c index 845fc95..ecf3d08 100644 --- a/plugins-root/check_icmp.c +++ b/plugins-root/check_icmp.c | |||
@@ -184,14 +184,14 @@ static u_int get_timevar(const char *); | |||
184 | static u_int get_timevaldiff(struct timeval *, struct timeval *); | 184 | static u_int get_timevaldiff(struct timeval *, struct timeval *); |
185 | static in_addr_t get_ip_address(const char *); | 185 | static in_addr_t get_ip_address(const char *); |
186 | static int wait_for_reply(int, u_int); | 186 | static int wait_for_reply(int, u_int); |
187 | static int recvfrom_wto(int, char *, unsigned int, struct sockaddr *, u_int *); | 187 | static int recvfrom_wto(int, void *, unsigned int, struct sockaddr *, u_int *); |
188 | static int send_icmp_ping(int, struct rta_host *); | 188 | static int send_icmp_ping(int, struct rta_host *); |
189 | static int get_threshold(char *str, threshold *th); | 189 | static int get_threshold(char *str, threshold *th); |
190 | static void run_checks(void); | 190 | static void run_checks(void); |
191 | static void set_source_ip(char *); | 191 | static void set_source_ip(char *); |
192 | static int add_target(char *); | 192 | static int add_target(char *); |
193 | static int add_target_ip(char *, struct in_addr *); | 193 | static int add_target_ip(char *, struct in_addr *); |
194 | static int handle_random_icmp(char *, struct sockaddr_in *); | 194 | static int handle_random_icmp(unsigned char *, struct sockaddr_in *); |
195 | static unsigned short icmp_checksum(unsigned short *, int); | 195 | static unsigned short icmp_checksum(unsigned short *, int); |
196 | static void finish(int); | 196 | static void finish(int); |
197 | static void crash(const char *, ...); | 197 | static void crash(const char *, ...); |
@@ -300,7 +300,7 @@ get_icmp_error_msg(unsigned char icmp_type, unsigned char icmp_code) | |||
300 | } | 300 | } |
301 | 301 | ||
302 | static int | 302 | static int |
303 | handle_random_icmp(char *packet, struct sockaddr_in *addr) | 303 | handle_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 | |||
694 | wait_for_reply(int sock, u_int t) | 694 | wait_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 | |||
814 | send_icmp_ping(int sock, struct rta_host *host) | 814 | send_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 | ||
869 | static int | 869 | static int |
870 | recvfrom_wto(int sock, char *buf, unsigned int len, struct sockaddr *saddr, | 870 | recvfrom_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; |