diff options
author | Stef Walter <stef@memberwebs.com> | 2005-11-15 16:40:11 +0000 |
---|---|---|
committer | Stef Walter <stef@memberwebs.com> | 2005-11-15 16:40:11 +0000 |
commit | 2278c77507c0659229cbb6b622be0e30c1743c79 (patch) | |
tree | d16e9a2b7a64500d74e830793ac084344a5d22eb | |
parent | e36d27a2a68afae0792f1808e13b2863f5c7dff9 (diff) |
Possible fix for crasher when in debug mode. (Try not using alloca).
-rw-r--r-- | common/smtppass.c | 42 | ||||
-rw-r--r-- | configure.in | 4 |
2 files changed, 20 insertions, 26 deletions
diff --git a/common/smtppass.c b/common/smtppass.c index f8129ed..677277f 100644 --- a/common/smtppass.c +++ b/common/smtppass.c @@ -1710,13 +1710,12 @@ void sp_setup_forked(spctx_t* ctx, int file) */ const char kMsgDelimiter[] = ": "; -#define MAX_MSGLEN 256 +#define MAX_MSGLEN 1024 static void vmessage(spctx_t* ctx, int level, int err, const char* msg, va_list ap) { - size_t len; - char* m; + char buf[MAX_MSGLEN]; int e = errno; if(g_state.daemonized) @@ -1732,35 +1731,30 @@ static void vmessage(spctx_t* ctx, int level, int err, ASSERT(msg); - len = strlen(msg) + 20 + MAX_MSGLEN; - m = (char*)alloca(len); + if(ctx) + snprintf(buf, MAX_MSGLEN, "%06X: %s%s", ctx->id, msg, err ? ": " : ""); + else + snprintf(buf, MAX_MSGLEN, "%s%s", msg, err ? ": " : ""); - if(m) + if(err) { - if(ctx) - snprintf(m, len, "%06X: %s%s", ctx->id, msg, err ? ": " : ""); - else - snprintf(m, len, "%s%s", msg, err ? ": " : ""); - - if(err) - { - /* strerror_r doesn't want to work for us for some reason - strerror_r(e, m + strlen(m), MAX_MSGLEN); */ + /* strerror_r doesn't want to work for us for some reason + len = strlen(buf); + strerror_r(e, buf + len, MAX_MSGLEN - len); */ - sp_lock(); - strncat(m, strerror(e), len); - sp_unlock(); - } - - m[len - 1] = 0; - msg = m; + sp_lock(); + strncat(buf, strerror(e), MAX_MSGLEN); + sp_unlock(); } + /* As a precaution */ + buf[MAX_MSGLEN - 1] = 0; + /* Either to syslog or stderr */ if(g_state.daemonized) - vsyslog(level, msg, ap); + vsyslog(level, buf, ap); else - vwarnx(msg, ap); + vwarnx(buf, ap); } void sp_messagex(spctx_t* ctx, int level, const char* msg, ...) diff --git a/configure.in b/configure.in index e56a9b4..2d983d6 100644 --- a/configure.in +++ b/configure.in @@ -36,8 +36,8 @@ dnl Nate Nielsen <nielsen@memberwebs.com> dnl dnl Process this file with autoconf to produce a configure script. -AC_INIT(proxsmtp, 1.3, nielsen@memberwebs.com) -AM_INIT_AUTOMAKE(proxsmtp, 1.3) +AC_INIT(proxsmtp, 1.3.91, nielsen@memberwebs.com) +AM_INIT_AUTOMAKE(proxsmtp, 1.3.91) LDFLAGS="$LDFLAGS -L/usr/local/lib" CFLAGS="$CFLAGS -I/usr/local/include" |