From a0005e9dad1ac064354c1d49c386481b267ae871 Mon Sep 17 00:00:00 2001 From: Matteo Cypriani Date: Thu, 26 Jan 2012 10:15:10 +0100 Subject: [PATCH] Don't use inet_ntoa() any more --- TODO | 3 --- owlps-aggregator/owlps-aggregatord.c | 2 +- owlps-listener/owlps-listenerd.c | 2 +- 3 files changed, 2 insertions(+), 5 deletions(-) diff --git a/TODO b/TODO index a8a7ab8..6f5dca1 100644 --- a/TODO +++ b/TODO @@ -43,9 +43,6 @@ - Refactor: ° monitor_requests() ° got_request() -- inet_ntoa() is not secure with threads - (But it is currently used by only one thread.) Use inet_ntop() - instead? - Use the type of a request to identify it? (along with the mobile MAC address and the request time) - got_request(): option for the maximal difference time diff --git a/owlps-aggregator/owlps-aggregatord.c b/owlps-aggregator/owlps-aggregatord.c index ac4547c..1c62dd5 100644 --- a/owlps-aggregator/owlps-aggregatord.c +++ b/owlps-aggregator/owlps-aggregatord.c @@ -942,7 +942,7 @@ void* listen_for_aps(void *NULL_value) continue ; } - strncpy(ap_ip_addr, inet_ntoa(client.sin_addr), INET_ADDRSTRLEN) ; + inet_ntop(AF_INET, &client.sin_addr, ap_ip_addr, INET_ADDRSTRLEN) ; if (VERBOSE_INFO) fprintf(stderr, diff --git a/owlps-listener/owlps-listenerd.c b/owlps-listener/owlps-listenerd.c index a0fd6f0..a0a4e7e 100644 --- a/owlps-listener/owlps-listenerd.c +++ b/owlps-listener/owlps-listenerd.c @@ -1272,7 +1272,7 @@ void get_ip_addr(char *eth, char ip[INET_ADDRSTRLEN]) memcpy(&ip_addr, &ifr.ifr_addr.sa_data[sizeof(sa.sin_port)], sizeof(ip_addr)) ; - strncpy(ip, inet_ntoa(ip_addr), INET_ADDRSTRLEN) ; + inet_ntop(AF_INET, &ip_addr, ip, INET_ADDRSTRLEN) ; }