]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
cgi-bin/var.c: Fix return value if the text is invalid 961/head
authorZdenek Dohnal <zdohnal@redhat.com>
Thu, 16 May 2024 13:29:34 +0000 (15:29 +0200)
committerZdenek Dohnal <zdohnal@redhat.com>
Thu, 16 May 2024 13:29:34 +0000 (15:29 +0200)
If the original value contains double quote, which is forbidden for
text, we free the variable and move the next variable from array to its
place. However, the return value still contains the original value of
freed pointer.

Set it NULL, since we don't have any value to return for the requested
name.

cgi-bin/var.c

index 5cfdb72d4d0bea491845a29e53fdfb424b0d05c4..822f8b93c90d666f30c598c762e6a8bff2174c56 100644 (file)
@@ -284,6 +284,8 @@ cgiGetTextfield(const char *name)   /* I - Name of form field */
 
     if (i < form_count)
       memmove(var, var + 1, (size_t)(form_count - i) * sizeof(_cgi_var_t));
+
+    value = NULL;
   }
 
   return (value);