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 --- smtp.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'smtp.c') diff --git a/smtp.c b/smtp.c index 703b10fd..530d17e4 100644 --- a/smtp.c +++ b/smtp.c @@ -97,11 +97,21 @@ int SMTP_from(int sock, const char *from, const char *opts) char buf[MSGBUFSIZE]; if (strchr(from, '<')) - sprintf(buf, "MAIL FROM: %s", from); +#ifdef HAVE_SNPRINTF + snprintf(buf, sizeof(buf), +#else + sprintf(buf, +#endif /* HAVE_SNPRINTF */ + "MAIL FROM: %s", from); else - sprintf(buf, "MAIL FROM:<%s>", from); +#ifdef HAVE_SNPRINTF + snprintf(buf, sizeof(buf), +#else + sprintf(buf, +#endif /* HAVE_SNPRINTF */ + "MAIL FROM:<%s>", from); if (opts) - strcat(buf, opts); + strncat(buf, opts, sizeof(buf)); SockPrintf(sock,"%s\r\n", buf); if (outlevel >= O_MONITOR) report(stdout, "%cMTP> %s\n", smtp_mode, buf); -- cgit v1.2.3