CtdlAllocUserData(SYM_SMTP, sizeof(struct citsmtp));
CtdlAllocUserData(SYM_SMTP_RECPS, SIZ);
CtdlAllocUserData(SYM_SMTP_ROOMS, SIZ);
- sprintf(SMTP_RECPS, "%s", "");
- sprintf(SMTP_ROOMS, "%s", "");
+ snprintf(SMTP_RECPS, SIZ, "%s", "");
+ snprintf(SMTP_ROOMS, SIZ, "%s", "");
cprintf("220 %s ESMTP Citadel/UX server ready.\r\n", config.c_fqdn);
}
* Called by smtp_do_procmsg() to attempt delivery to one SMTP host
*
*/
-void smtp_try(char *key, char *addr, int *status, char *dsn, long msgnum)
+void smtp_try(const char *key, const char *addr, int *status,
+ char *dsn, size_t n, long msgnum)
{
int sock = (-1);
char mxhosts[1024];
msg_fp = tmpfile();
if (msg_fp == NULL) {
*status = 4;
- sprintf(dsn, "Error creating temporary file");
+ snprintf(dsn, n, "Error creating temporary file");
return;
}
else {
--i;
--lines;
lprintf(9, "SMTP: Trying <%s>\n", addr);
- smtp_try(key, addr, &status, dsn, text_msgid);
+ smtp_try(key, addr, &status, dsn, sizeof dsn, text_msgid);
if (status != 2) {
if (results == NULL) {
results = mallok(1024);
results = reallok(results,
strlen(results) + 1024);
}
- sprintf(&results[strlen(results)],
+ snprintf(&results[strlen(results)], 1024,
"%s|%s|%d|%s\n",
key, addr, status, dsn);
}