]> git.ipfire.org Git - thirdparty/cups.git/commit
cgi: Fix showing query string in Help 977/head
authorZdenek Dohnal <zdohnal@redhat.com>
Thu, 6 Jun 2024 15:28:59 +0000 (17:28 +0200)
committerZdenek Dohnal <zdohnal@redhat.com>
Thu, 6 Jun 2024 15:28:59 +0000 (17:28 +0200)
commitc0e2e975462b3890ad3d426942a9000987a2bdb8
treef674b5a66ba38d1ec9f221f6188af1e6974f23b2
parentceac03d5129d2bb25d05f686069ecafae491d3e0
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.
cgi-bin/help.c