From 74dac77adba17937fb79f5b0c98a92c2912f9e57 Mon Sep 17 00:00:00 2001 From: uNetworkingAB <110806833+uNetworkingAB@users.noreply.github.com> Date: Mon, 24 Oct 2022 19:02:04 +0200 Subject: [PATCH] Never accept whitespace between key and colon --- src/HttpParser.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/HttpParser.h b/src/HttpParser.h index b53bca5..deb043d 100644 --- a/src/HttpParser.h +++ b/src/HttpParser.h @@ -229,6 +229,10 @@ private: if (postPaddedBuffer[0] == ':' && postPaddedBuffer[1] == ' ') { postPaddedBuffer += 2; } else { + /* We should not accept whitespace between key and colon */ + if (postPaddedBuffer[0] != ':') { + return 0; + } /* Trim until value starts */ for (; (*postPaddedBuffer == ':' || *(unsigned char *)postPaddedBuffer < 33) && *postPaddedBuffer != '\r'; postPaddedBuffer++); }