[mapserver-commits] [MapServer/MapServer] 53bcfe: cgiutil: fix handling of malformed percent-encodin...

Stefan Gloor noreply at github.com
Tue May 26 07:28:12 PDT 2026


  Branch: refs/heads/main
  Home:   https://github.com/MapServer/MapServer
  Commit: 53bcfe60457672539ed296b66faf5b63ea15b150
      https://github.com/MapServer/MapServer/commit/53bcfe60457672539ed296b66faf5b63ea15b150
  Author: Stefan Gloor <48062150+stgloorious at users.noreply.github.com>
  Date:   2026-05-26 (Tue, 26 May 2026)

  Changed paths:
    M src/cgiutil.c
    M src/cgiutil.h

  Log Message:
  -----------
  cgiutil: fix handling of malformed percent-encoding (#7511)

* cgiutil: fix handling of malformed percent-encoding

unescape_url() implicitly assumed that two hex digits
follow the percent sign without any checks.
This lead to an out-of-bounds read on malformed
percent-encoded URLs, such as "/?foo=bar%", and
undefined behavior if non-hex digits were supplied.

Fix this by verifying that two hex digits follow
the percent sign and only unescape it in this case.
In the malformed case, leave the percent-sign and
the following digits as-is.

Signed-off-by: Stefan Gloor <code at stefan-gloor.ch>

* Apply suggestions from code review

Co-authored-by: Even Rouault <even.rouault at spatialys.com>

* Formatting fix

* Apply suggestions from code review

Co-authored-by: Even Rouault <even.rouault at spatialys.com>

---------

Signed-off-by: Stefan Gloor <code at stefan-gloor.ch>
Co-authored-by: Even Rouault <even.rouault at spatialys.com>



To unsubscribe from these emails, change your notification settings at https://github.com/MapServer/MapServer/settings/notifications


More information about the MapServer-commits mailing list