rohrpost

A commandline mail client to change the world as we see it.
git clone git://r-36.net/rohrpost
Log | Files | Refs | LICENSE

commit e564bee669d6957b144d2e36f7938ec3a9a43c75
parent 612b4635f36c5ad16c9c651416a3c85111dce99a
Author: Christoph Lohmann <20h@r-36.net>
Date:   Sun, 28 Oct 2018 18:30:41 +0100

Remove whitespace characters from header values.

Keeping for example newline in headers will break and is unexpected.

Diffstat:
ind.c | 12++++++++++++
ind.h | 1+
mime.c | 3+++
3 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/ind.c b/ind.c @@ -500,6 +500,18 @@ strisascii(char *str) return 1; } +void +strnormalizespace(char *str) +{ + int len, i; + + len = strlen(str); + for (i = 0; i < len; i++) { + if (isspace(str[i])) + str[i] = ' '; + } +} + /* * Find a whitespace character in a certain limit. This is used for formatting * mail to a certain width. diff --git a/ind.h b/ind.h @@ -46,6 +46,7 @@ char *strcsh(char *p, char *chars); char *strncsh(char *p, char *chars); char *strrlnspn(char *p, char *chars, int limit); int strisascii(char *str); +void strnormalizespace(char *str); char *findlimitws(char *str, int limit); char *mktmpfile(char *prefix, char *suffix, int *fd); diff --git a/mime.c b/mime.c @@ -307,6 +307,9 @@ mime_decodeheader(char *value) ret = memdupcat(ret, rlen, extp, strlen(extp)+1); free(work); + /* Remove any space character, like newline. */ + strnormalizespace(ret); + return ret; }