Skip to content

Error parsing HTTP POST parameters bug in src/WebRequest.cpp #51

@igorfi

Description

@igorfi

Parsing of received HTTP POST parameters is incorrectly processed.

I found the error specifically in src/WebRequest.cpp where the followed macro is used.

#define __is_param_char(c) ((c) && ((c) != '{') && ((c) != '[') && ((c) != '&') && ((c) != '='))

This macro is fine, but the parameter inserted into the macro is used inappropriately in this case, because when this parameter is used in the macro 5 times, the variable i is always increased by +5 instead of +1.

This is where it's used incorrectly:

while (i < len && __is_param_char(((char *)buf)[i++]));

Correctly used, it should be like this

char ch; do {ch = ((char *)buf)[i];} while (i++ < len && __is_param_char(ch));

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions