Summary: Wrong SSI tag handling if tag places on the edge of
2920 buffer and LWIP_HTTPD_SSI_INCLUDE_TAG = 0
Project: lwIP - A Lightweight TCP/IP stack
Submitted by: gdi
Submitted on: Fri 23 Oct 2020 02:03:41 PM UTC
Severity: 3 - Normal
Item Group: None
Assigned to: None
Discussion Lock: Any
Planned Release: None
lwIP version: 2.0.0
Issue related to Bugs #50844 & #50845 which I reported earlier.
I found new issue here.
Settings on test system:
#define LWIP_HTTPD_DYNAMIC_FILE_READ 1
#define LWIP_HTTPD_SSI_INCLUDE_TAG 0
HTML files are placed on SD-Card using FatFs
'val' variable returns 0.000000 text in my case.
If starting tag '<' of any regular HTML tag will be the last symbol in 2920
bytes buffer we will think that it is starting tag for SSI inclusion. And this
symbol will be lost when the buffer will be re loaded with next data. Thus
HTML tag will be broken.
will be replaced with
<div value="0.000000>">/div> <-- broken closing DIV
The same situation if we have comment tags (<!-- -->) in HTML code. Actually I
didn't test it on initial code, but after my first patch comment
can be replaced with
depending on a position of this tag in a file. This is fixed in second patch.
I've made test.shtml file (see attachments) which cover all possible cases
(from my point of view). You'll need to check the source of page in browser.
And also I've attached two patches which fix the issue.