summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStef Walter <stef@memberwebs.com>2005-03-20 20:58:19 +0000
committerStef Walter <stef@memberwebs.com>2005-03-20 20:58:19 +0000
commit64b0625d3187ef665cd5441bf4635caa0bc338c7 (patch)
tree68db6cb1bb6242e8cf5e3372e09b9d6b41476853
parent795bf2eb48104bade902d11b88a956d4d2ebae9f (diff)
Fixes for header symbols.
-rw-r--r--common/smtppass.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/common/smtppass.c b/common/smtppass.c
index 6189262..dfa0176 100644
--- a/common/smtppass.c
+++ b/common/smtppass.c
@@ -1387,7 +1387,6 @@ static int make_header(spctx_t* ctx, const char* format_str, char* header)
break;
}
- ++f;
++p;
--remaining;
}
@@ -1422,24 +1421,28 @@ static int make_header(spctx_t* ctx, const char* format_str, char* header)
remaining -= l;
p += l;
break;
+ case '%':
+ *p = '%';
+ ++p;
+ break;
default:
- sp_message(ctx, LOG_WARNING, "invalid header symbol: %%%c", *f);
+ sp_messagex(ctx, LOG_WARNING, "invalid header symbol: %%%c", *f);
break;
};
}
else
{
- *(p++) = *(f++);
+ *(p++) = *f;
remaining--;
}
}
- if(p < header + MAX_HEADER_LENGTH)
- *p = 0;
+ if((p + 1) < (header + MAX_HEADER_LENGTH))
+ p[1] = 0;
header[MAX_HEADER_LENGTH - 1] = 0;
l = p - header;
- return (l > MAX_HEADER_LENGTH ? MAX_HEADER_LENGTH : l) - 1;
+ return l >= MAX_HEADER_LENGTH ? MAX_HEADER_LENGTH - 1 : l;
}
int sp_done_data(spctx_t* ctx)
@@ -1875,7 +1878,7 @@ int sp_parse_option(const char* name, const char* value)
g_state.header = trim_start(value);
if(strlen(g_state.header) == 0)
g_state.header = NULL;
- else if(is_first_word(RCVD_HEADER, g_state.header, KL(RCVD_HEADER)) == 0)
+ else if(is_first_word(RCVD_HEADER, g_state.header, KL(RCVD_HEADER)))
g_state.header_prepend = 1;
ret = 1;
}