]> git.ipfire.org Git - thirdparty/cups.git/commit
cgi: Fix showing query string in Help
authorZdenek Dohnal <zdohnal@redhat.com>
Mon, 10 Jun 2024 06:49:39 +0000 (08:49 +0200)
committerZdenek Dohnal <zdohnal@redhat.com>
Mon, 10 Jun 2024 06:49:39 +0000 (08:49 +0200)
commit6eba4c04c8c56bbabfbf1f7f318968e6517826a4
tree6ac9e61af1f00d41984a5896917e4092d1a39c77
parent0d8542c5c02874999f9297e244f742b4302c934d
cgi: Fix showing query string in Help

If a string was searched on CUPS Web UI help page, garbage was printed
out in search box. It was because text field pointer was freed before
and contained garbage - previously it was variable value which was
allocated, so the string survived `cgCleanVariables(()`, but the text
field is a pointer into form variables which gets cleaned up.

Fix is to use `strdup()` if `cgiGetTextfield()` returns non-NULL
pointer. The binary exits shortly after either way, so memory is taken
care of by OS.
CHANGES.md
cgi-bin/help.c