summaryrefslogtreecommitdiff
path: root/common
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
commit45ed6073097ba4081d52fd2667e47d82d5d6d3ad (patch)
treeaf12d4c850b8db7559ee6b1c549d741283935fe8 /common
parentce202a4ed31dcc847a29daa4bdd232978e7939a6 (diff)
Fixes for header symbols.
Diffstat (limited to 'common')
-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;
}