From: Mark Wooding Date: Sat, 26 May 2018 22:31:00 +0000 (+0100) Subject: codec/url.c: Always encode whitespace characters. X-Git-Tag: 2.3.0~2 X-Git-Url: https://git.distorted.org.uk/~mdw/mLib/commitdiff_plain/4d845619c3f21fe19dd7f7b16815281b34de9e33 codec/url.c: Always encode whitespace characters. Vertical whitespace is obviously bad, so this is a longstanding bug; but all whitespace should really be escaped. --- diff --git a/codec/url.c b/codec/url.c index f502f7c..4e7f190 100644 --- a/codec/url.c +++ b/codec/url.c @@ -67,7 +67,8 @@ static void encode(url_ectx *ctx, dstr *d, const char *p) DPUTC(d, '+'); break; default: - if ((ctx->f & URLF_LAX) || isalnum((unsigned char)*p)) + if (!isspace((unsigned char)*p) && + ((ctx->f & URLF_LAX) || isalnum((unsigned char)*p))) goto safe; else goto unsafe;