summaryrefslogtreecommitdiff
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
commitfa4db20222c78c1fd347a231fae3139d99f52f90 (patch)
tree0cd28958c99f749b6e5693b7bdbe7330afc17fd5
parentdd90660cc1d49f9ff54c0d9333efa67e30fd4ddd (diff)
Better processing of result messages
-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)