httpd: stop the GET request line walk at the end of the buffer

The POST path tests for a NUL before it looks at a byte. The GET path did not,
and is_separator() counts only space, tab, question mark and equals, so a request
line carrying none of those walks past the end of uip_buf and writes its
terminator into whatever xdata it happens to stop on.

Everything that is not a POST reaches that walk. The pointer advances past the
method before anything checks that the method was GET, so a TLS record sent to
port 80 by a browser trying https first is enough on its own, as is a port
scanner or a malformed line. The stop is wherever the first space, tab, question
mark or equals turns up in memory, which is why the symptoms are erratic.

Two bytes of BANK1. BANK2 and xdata do not move.
This commit is contained in:
d00f
2026-08-12 03:22:01 +02:00
parent 5e30f8e6c0
commit 43845b911b
+1 -1
View File
@@ -640,7 +640,7 @@ void httpd_appcall(void)
p += 4; p += 4;
scan_header(p); scan_header(p);
__xdata uint8_t *q = p; __xdata uint8_t *q = p;
while (!is_separator(*p)) while (*p && !is_separator(*p))
p++; p++;
*p = '\0'; *p = '\0';
dbg_string_x(q); dbg_string_x(q);