summaryrefslogtreecommitdiff
path: root/src/or/eventdns.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2007-01-15 23:56:38 +0000
committerNick Mathewson <nickm@torproject.org>2007-01-15 23:56:38 +0000
commit093d71762c9a80cccdd759c83731c014b53c4435 (patch)
tree5cd8454691ac044b68fa144ae51fa539664dbc45 /src/or/eventdns.c
parent11ed4500ded3270ea376d75269200bb99574026e (diff)
downloadtor-093d71762c9a80cccdd759c83731c014b53c4435.tar.gz
tor-093d71762c9a80cccdd759c83731c014b53c4435.zip
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
Diffstat (limited to 'src/or/eventdns.c')
-rw-r--r--src/or/eventdns.c8
1 files changed, 4 insertions, 4 deletions
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;