From 4d845619c3f21fe19dd7f7b16815281b34de9e33 Mon Sep 17 00:00:00 2001 From: Mark Wooding Date: Sat, 26 May 2018 23:31:00 +0100 Subject: [PATCH] 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. --- codec/url.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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; -- 2.11.0