From 90ef9dc0e29059e05f54194e5dec8c510f87bba3 Mon Sep 17 00:00:00 2001 From: SJ Date: Sat, 3 Nov 2012 23:44:09 +0100 Subject: [PATCH] fixed a bug causing for certain messages to rewrite the first byte to NUL-byte --- src/parser_utils.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/parser_utils.c b/src/parser_utils.c index 88c818bc..35c52f7b 100644 --- a/src/parser_utils.c +++ b/src/parser_utils.c @@ -338,13 +338,9 @@ void fixupSoftBreakInQuotedPritableLine(char *buf, struct _state *state){ char *p, puf[MAXBUFSIZE]; if(strlen(state->qpbuf) > 0){ - memset(puf, 0, MAXBUFSIZE); - strncpy(puf, state->qpbuf, MAXBUFSIZE-1); - strncat(puf, buf, MAXBUFSIZE-1); - - memset(buf, 0, MAXBUFSIZE); - memcpy(buf, puf, MAXBUFSIZE); - + memset(puf, 0, sizeof(puf)); + snprintf(puf, sizeof(puf)-1, "%s%s", state->qpbuf, buf); + snprintf(buf, MAXBUFSIZE-1, "%s", puf); memset(state->qpbuf, 0, MAX_TOKEN_LEN); }