From 093d71762c9a80cccdd759c83731c014b53c4435 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Mon, 15 Jan 2007 23:56:38 +0000 Subject: r11978@Kushana: nickm | 2007-01-15 18:54:25 -0500 Apparently, the OpenBSD linker thinks it knows C better than I do, and gets to call me names for having strcat and strcpy and sprintf in my code--whether I use them safely or not. All right, OpenBSD. You win... this round. svn:r9360 --- src/or/eventdns.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/or/eventdns.c') diff --git a/src/or/eventdns.c b/src/or/eventdns.c index 34767a4276..35efbff00a 100644 --- a/src/or/eventdns.c +++ b/src/or/eventdns.c @@ -373,7 +373,7 @@ debug_ntoa(u32 address) { static char buf[32]; u32 a = ntohl(address); - sprintf(buf, "%d.%d.%d.%d", + snprintf(buf, sizeof(buf), "%d.%d.%d.%d", (int)(u8)((a>>24)&0xff), (int)(u8)((a>>16)&0xff), (int)(u8)((a>>8 )&0xff), @@ -1515,7 +1515,7 @@ evdns_server_request_add_ptr_reply(struct evdns_server_request *req, struct in_a assert(!(in && inaddr_name)); if (in) { a = ntohl(in->s_addr); - sprintf(buf, "%d.%d.%d.%d.in-addr.arpa", + snprintf(buf, sizeof(buf), "%d.%d.%d.%d.in-addr.arpa", (int)(u8)((a )&0xff), (int)(u8)((a>>8 )&0xff), (int)(u8)((a>>16)&0xff), @@ -2214,7 +2214,7 @@ int evdns_resolve_reverse(struct in_addr *in, int flags, evdns_callback_type cal u32 a; assert(in); a = ntohl(in->s_addr); - sprintf(buf, "%d.%d.%d.%d.in-addr.arpa", + snprintf(buf, sizeof(buf), "%d.%d.%d.%d.in-addr.arpa", (int)(u8)((a )&0xff), (int)(u8)((a>>8 )&0xff), (int)(u8)((a>>16)&0xff), @@ -2241,7 +2241,7 @@ int evdns_resolve_reverse_ipv6(struct in6_addr *in, int flags, evdns_callback_ty *cp++ = '.'; } assert(cp + strlen(".ip6.arpa") < buf+sizeof(buf)); - strcpy(cp, ".ip6.arpa"); + memcpy(cp, ".ip6.arpa", strlen(".ip6.arpa")+1); log(EVDNS_LOG_DEBUG, "Resolve requested for %s (reverse)", buf); req = request_new(TYPE_PTR, buf, flags, callback, ptr); if (!req) return 1; -- cgit v1.2.3-54-g00ecf