[riot-commits] [RIOT-OS/RIOT] b068d9: uri_parser: constify result

Martine Lenders noreply at github.com
Thu Aug 5 15:55:58 CEST 2021


  Branch: refs/heads/master
  Home:   https://github.com/RIOT-OS/RIOT
  Commit: b068d9245d7b003a4b0031325b6243bb424db1f6
      https://github.com/RIOT-OS/RIOT/commit/b068d9245d7b003a4b0031325b6243bb424db1f6
  Author: Benjamin Valentin <benjamin.valentin at ml-pa.com>
  Date:   2021-08-04 (Wed, 04 Aug 2021)

  Changed paths:
    M sys/include/uri_parser.h
    M sys/uri_parser/uri_parser.c

  Log Message:
  -----------
  uri_parser: constify result

`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.


  Commit: 9bce87d6da93c93bd25fcc0af1da103ba6a81be2
      https://github.com/RIOT-OS/RIOT/commit/9bce87d6da93c93bd25fcc0af1da103ba6a81be2
  Author: Benjamin Valentin <benjamin.valentin at ml-pa.com>
  Date:   2021-08-05 (Thu, 05 Aug 2021)

  Changed paths:
    M pkg/wakaama/contrib/lwm2m_client_connection.c

  Log Message:
  -----------
  pkg/wakaama: don't modify result of uri_parser


  Commit: 17b9c5adbbd5a93ffc194f7b1c5117f46ceb0984
      https://github.com/RIOT-OS/RIOT/commit/17b9c5adbbd5a93ffc194f7b1c5117f46ceb0984
  Author: Martine Lenders <m.lenders at fu-berlin.de>
  Date:   2021-08-05 (Thu, 05 Aug 2021)

  Changed paths:
    M pkg/wakaama/contrib/lwm2m_client_connection.c
    M sys/include/uri_parser.h
    M sys/uri_parser/uri_parser.c

  Log Message:
  -----------
  Merge pull request #16707 from benpicco/sys/uri_parser-constify

uri_parser: constify result


Compare: https://github.com/RIOT-OS/RIOT/compare/ba3eb5fc3f5a...17b9c5adbbd5


More information about the commits mailing list