[riot-notifications] [RIOT-OS/RIOT] uri_parser: constify result (#16707)

benpicco notifications at github.com
Wed Aug 4 14:08:16 CEST 2021

The RIOT community cares a lot about code quality.
Therefore, before describing what your contribution is about, we would like
you to make sure that your modifications are compliant with the RIOT
coding conventions, see https://github.com/RIOT-OS/RIOT/wiki/Coding-conventions.

### Contribution description

`uri_parser_process()` takes a `const char *` as input parameter but the result is a struct of `char *` to the original string.

This may lead a user to modifying the strings in `uri_parser_result_t` which will cause a crash if the original string resides in read-only memory (and violates the no-modifications promise of the const parameter in `uri_parser_process()`).

To fix this, make the resulting strings `const` as well, so nobody dares to touch them in a writing way.

### Testing procedure

    make -C tests/unittests tests-uri_parser all term

### Issues/PRs references


You can view, comment on, or merge this pull request online at:


-- Commit Summary --

  * uri_parser: constify result

-- File Changes --

    M sys/include/uri_parser.h (20)
    M sys/uri_parser/uri_parser.c (56)

-- Patch Links --


You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.riot-os.org/pipermail/notifications/attachments/20210804/75bff1eb/attachment.htm>

More information about the notifications mailing list