memcmp compared 3 bytes against "\r\n", which required a trailing NUL on the wire.
Compare 2 bytes and consume 2 so valid headers are accepted and connections are not dropped.
This bug was found by ZeroPath
Signed-off-by: Joshua Rogers <MegaManSec@users.noreply.github.com>
}
if (*p < ' ') {
- if ((end - p) < 3) goto fail;
+ if ((end - p) < 2) goto fail;
- if (memcmp(p, "\r\n", 3) != 0) goto fail;
+ if (memcmp(p, "\r\n", 2) != 0) goto fail;
*p = '\0';
- end = p + 3;
+ end = p + 2;
rcode = 0;
break;
}
*(p++) = '\0';
}
-
+
/*
* Didn't end with CRLF and zero.
*/