From 75b1a90747d6fa2d0d2962856c2875b92ebcfe7b Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Sat, 23 Jun 2001 14:50:12 +0000 Subject: strncat/snprintf cleanup. svn path=/trunk/; revision=3366 --- driver.c | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) (limited to 'driver.c') diff --git a/driver.c b/driver.c index 812bab62..998d9b94 100644 --- a/driver.c +++ b/driver.c @@ -40,6 +40,7 @@ #endif /* KERBEROS_V4 */ #include "i18n.h" +#include "socket.h" #include "fetchmail.h" #include "tunable.h" @@ -333,7 +334,12 @@ static void mark_oversized(int num, struct query *ctl, int *msgsizes) int cnt; /* convert sz to string */ - sprintf(size, "%d", msgsizes[num-1]); +#ifdef HAVE_SNPRINTF + snprintf(size, sizeof(size), +#else + sprintf(size, +#endif /* HAVE_SNPRINTF */ + "%d", msgsizes[num-1]); /* build a list of skipped messages * val.id = size of msg (string cnvt) @@ -831,7 +837,12 @@ const int maxfetch; /* maximum number of messages to fetch */ else if (h_errno == TRY_AGAIN) strcpy(errbuf, _("temporary name server error.")); else - sprintf(errbuf, _("unknown DNS error %d."), h_errno); +#ifdef HAVE_SNPRINTF + snprintf(errbuf, sizeof(errbuf), +#else + sprintf(errbuf, +#endif /* HAVE_SNPRINTF */ + _("unknown DNS error %d."), h_errno); } else #endif /* HAVE_RES_SEARCH */ @@ -1065,10 +1076,20 @@ is restored.")); /* show user how many messages we downloaded */ if (idp->id) - (void) sprintf(buf, _("%s at %s (folder %s)"), +#ifdef HAVE_SNPRINTF + (void) snprintf(buf, sizeof(buf), +#else + (void) sprintf(buf, +#endif /* HAVE_SNPRINTF */ + _("%s at %s (folder %s)"), ctl->remotename, ctl->server.truename, idp->id); else - (void) sprintf(buf, _("%s at %s"), +#ifdef HAVE_SNPRINTF + (void) snprintf(buf, sizeof(buf), +#else + (void) sprintf(buf, +#endif /* HAVE_SNPRINTF */ + _("%s at %s"), ctl->remotename, ctl->server.truename); if (outlevel > O_SILENT) { -- cgit v1.2.3