]> git.ipfire.org Git - thirdparty/tor.git/commitdiff
ext/eventdns.c multiple replacements of snprintf() with tor_snprintf() which always...
authorJeremy <jeremy@sturgix.com>
Tue, 1 Dec 2015 17:29:08 +0000 (12:29 -0500)
committerJeremy <jeremy@sturgix.com>
Tue, 1 Dec 2015 17:29:08 +0000 (12:29 -0500)
src/ext/eventdns.c

index a0c7ff29fa595199f7741c9d84d48a14f49e240d..1894cbea533619c6a3cd4f0d963b6736ca8d4b65 100644 (file)
@@ -388,7 +388,7 @@ debug_ntoa(u32 address)
 {
        static char buf[32];
        u32 a = ntohl(address);
-       snprintf(buf, sizeof(buf), "%d.%d.%d.%d",
+       tor_snprintf(buf, sizeof(buf), "%d.%d.%d.%d",
                        (int)(u8)((a>>24)&0xff),
                        (int)(u8)((a>>16)&0xff),
                        (int)(u8)((a>>8 )&0xff),
@@ -436,12 +436,7 @@ evdns_log(int warn, const char *fmt, ...)
        if (!evdns_log_fn)
                return;
        va_start(args,fmt);
-#ifdef _WIN32
-       _vsnprintf(buf, sizeof(buf), fmt, args);
-#else
-       vsnprintf(buf, sizeof(buf), fmt, args);
-#endif
-       buf[sizeof(buf)-1] = '\0';
+       tor_vsnprintf(buf, sizeof(buf), fmt, args);
        evdns_log_fn(warn, buf);
        va_end(args);
 }
@@ -762,7 +757,7 @@ reply_handle(struct evdns_request *const req, u16 flags, u32 ttl, struct reply *
                        /* we regard these errors as marking a bad nameserver */
                        if (req->reissue_count < global_max_reissues) {
                                char msg[64];
-                               snprintf(msg, sizeof(msg), "Bad response %d (%s)",
+                               tor_snprintf(msg, sizeof(msg), "Bad response %d (%s)",
                                                 error, evdns_err_to_string(error));
                                nameserver_failed(req->ns, msg);
                                if (!request_reissue(req)) return;
@@ -1705,7 +1700,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);
-               snprintf(buf, sizeof(buf), "%d.%d.%d.%d.in-addr.arpa",
+               tor_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),
@@ -2638,7 +2633,7 @@ int evdns_resolve_reverse(const struct in_addr *in, int flags, evdns_callback_ty
        u32 a;
        assert(in);
        a = ntohl(in->s_addr);
-       snprintf(buf, sizeof(buf), "%d.%d.%d.%d.in-addr.arpa",
+       tor_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),