From: Sami Kerola Date: Thu, 29 Sep 2016 18:26:45 +0000 (+0100) Subject: warnings: ensure printf will not overflow X-Git-Tag: v0.88~24^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=da054c40d72e293261f3fcd97c6fb82625d94511;p=thirdparty%2Fmtr.git warnings: ensure printf will not overflow Overflow in here should be only a theoretical possibility, but making even such impossible cannot be a bad thing. Signed-off-by: Sami Kerola --- diff --git a/dns.c b/dns.c index 92e9fb7..6a325ab 100644 --- a/dns.c +++ b/dns.c @@ -285,7 +285,7 @@ extern char *dns_lookup2(struct mtr_ctl *ctl, ip_t * ip) //printf ("lookup: %s\n", strlongip (ctl, ip)); - sprintf (buf, "%s\n", strlongip (ctl, ip)); + snprintf (buf, sizeof(buf), "%s\n", strlongip (ctl, ip)); rv = write (todns[1], buf, strlen (buf)); if (rv < 0) error (0, errno, "couldn't write to resolver process");