[bug #59325] Wrong SSI tag handling if tag places on the edge of 2920 buffer and LWIP_HTTPD_SSI_INCLUDE_TAG = 0

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[bug #59325] Wrong SSI tag handling if tag places on the edge of 2920 buffer and LWIP_HTTPD_SSI_INCLUDE_TAG = 0

yuanjianmin
URL:
  <https://savannah.nongnu.org/bugs/?59325>

                 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
                Category: Contrib
                Severity: 3 - Normal
              Item Group: None
                  Status: None
                 Privacy: Public
             Assigned to: None
             Open/Closed: Open
         Discussion Lock: Any
         Planned Release: None
            lwIP version: 2.0.0

    _______________________________________________________

Details:

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.
<div value="<!--#val-->"></div>
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
<!--comment-->
can be replaced with
<!--!--comment-->
or
<!----comment-->
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.



    _______________________________________________________

File Attachments:


-------------------------------------------------------
Date: Fri 23 Oct 2020 02:03:41 PM UTC  Name: test.shtml  Size: 60KiB   By: gdi

<http://savannah.nongnu.org/bugs/download.php?file_id=50072>
-------------------------------------------------------
Date: Fri 23 Oct 2020 02:03:41 PM UTC  Name:
0001-Fix-HTML-tag-on-the-edge-of-2920-buffer-issue.patch  Size: 2KiB   By: gdi

<http://savannah.nongnu.org/bugs/download.php?file_id=50073>
-------------------------------------------------------
Date: Fri 23 Oct 2020 02:03:41 PM UTC  Name:
0002-Fix-SSI-tag-handling-in-case-of-tag-starts-at-the-ed.patch  Size: 1KiB  
By: gdi

<http://savannah.nongnu.org/bugs/download.php?file_id=50074>

    _______________________________________________________

Reply to this item at:

  <https://savannah.nongnu.org/bugs/?59325>

_______________________________________________
  Message sent via Savannah
  https://savannah.nongnu.org/


_______________________________________________
lwip-devel mailing list
[hidden email]
https://lists.nongnu.org/mailman/listinfo/lwip-devel