From 21abfc85b0e8afcbb4e1397e1a11564336fedc71 Mon Sep 17 00:00:00 2001 From: Stef Walter Date: Mon, 20 Sep 2004 21:38:15 +0000 Subject: Better processing of result messages --- common/smtppass.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'common/smtppass.c') 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) -- cgit v1.2.3