lwip-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lwip-users] SSI: error codes not handled


From: Jan Menzel
Subject: [lwip-users] SSI: error codes not handled
Date: Mon, 19 Feb 2018 13:07:34 +0100
User-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0

Hi all!
        I just discovered a mismatch between documentation and implementation
of the SSI support in the httpd application (version 2.0.3): The
documentation of tSSIHandler says

"The handler returns the number of characters written to pcInsert
excluding any terminating NULL or a negative number to indicate a
failure (tag not recognized, for example)."

        First of all, tSSIHandler is defined to return a u16_t, which is
unsigned and hence generates signed/unsigned warnings in case an error
is to be returned.
        Then, in httpd.c line 783, the return value of the SSI handler is
directly stored in tag_insert_len and in line 793 compared against
HTTPD_SSI_TAG_UNKNOWN. If this special value is set (defined as 0xffff
in httpd.h line 172), the httpd inserts an error message indicating that
the requested tag is not recognized, which overwrites tag_insert_len to
a value number. If the SSI handler returns any other values between
iInsertLen and HTTPD_SSI_TAG_UNKNOWN, I see all types of strange errors
including hardfaults (probably more related to my memory map) while
sending data and no indication that the SSI handler is the root cause.
        As a quick-fix I'd add an assertion in httpd.c just before the return
statement in line 796 to capture this problem. On long term one could
probably add an error message like "unknown tag" to inform the user.

        Jan



reply via email to

[Prev in Thread] Current Thread [Next in Thread]