summaryrefslogtreecommitdiff
path: root/common/smtppass.c
diff options
context:
space:
mode:
authorStef Walter <stef@memberwebs.com>2004-09-20 21:38:15 +0000
committerStef Walter <stef@memberwebs.com>2004-09-20 21:38:15 +0000
commit21abfc85b0e8afcbb4e1397e1a11564336fedc71 (patch)
tree661a520cfa1e5403056caaf5516b1f2d926b21fe /common/smtppass.c
parentc23c9695d944e7f42569cb3d1859b0f333cb1618 (diff)
Better processing of result messages
Diffstat (limited to 'common/smtppass.c')
-rw-r--r--common/smtppass.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/common/smtppass.c b/common/smtppass.c
index 72ca71c..468991a 100644
--- a/common/smtppass.c
+++ b/common/smtppass.c
@@ -1314,6 +1314,7 @@ cleanup:
int sp_fail_data(spctx_t* ctx, const char* smtp_status)
{
+ char buf[256 + KL(SMTP_REJPREFIX) + KL(CRLF) + 1];
char* t = NULL;
int len, x;
int pref = 0;
@@ -1335,14 +1336,11 @@ int sp_fail_data(spctx_t* ctx, const char* smtp_status)
if(pref || crlf)
{
- x = (len > 256 ? 256 : len) + KL(SMTP_REJPREFIX) + KL(CRLF) + 1;
- t = (char*)alloca(x + 1);
-
/* Note that we truncate long lines */
- snprintf(t, x, "%s%.256s%s", pref ? SMTP_REJPREFIX : "",
+ snprintf(buf, sizeof(buf), "%s%.256s%s", pref ? SMTP_REJPREFIX : "",
smtp_status, crlf ? CRLF : "");
- t[x] = 0;
- smtp_status = t;
+ buf[sizeof(buf) - 1] = 0;
+ smtp_status = buf;
}
if(spio_write_data(ctx, &(ctx->client), smtp_status) == -1)