cgiDebug(3)

πŸ“¦ version 0.6, in ubuntu jammy

πŸŽ€ cgiDebug(3) πŸŽ€

ok so bestie, welcome to the cgiDebug(3) page β€” yes the title says debug, but the actual function living here is cgiEscape, we love a plot twist, it's giving "the page and the function have different names and that's just how the library is" πŸ’…. Anyway, it's part of the CGI Library and it's short, sweet, and honestly iconic.


✨ NAME ✨

cgiEscape β€” HTML escape certain characters in a string πŸ¦‹


🌸 SYNOPSYS 🌸

(yes, it's spelled that way in the original, no I will not be fixing it, it's part of the vibe now πŸ™ˆ)

#include <cgi.h>

char *cgiEscape (char *string);

πŸ’– DESCRIPTION πŸ’–

okay so here's the tea. cgiEscape returns a pointer to a sanitised string. What it does is take <, & and > and convert them into HTML entities, so that when the result gets displayed, there's zero danger of cross-site scripting happening in a browser. no cap, that's the whole point 🫢

After you're done with it, the result can be passed to free(3). So like, you own that memory now, bestie, be responsible with it.

The big rule: this routine is meant to be called before any user-provided strings get returned to the browser. Do that. Every time. Periodt. πŸ‘‘


⭐ RETURN VALUE ⭐

  • cgiEscape() returns a pointer to the sanitised string ✨
  • or NULL if something went wrong (in case of error) 😭

πŸ‘‘ AUTHOR πŸ‘‘

This CGI library was written by Martin Schulze <joey@infodrom.org>. If you've got additions or improvements, please get in touch with him β€” he literally wants to hear from you πŸ’Œ


🌈 SEE ALSO 🌈


fr fr, the whole function is basically "escape the scary characters before you hand anything to the browser." that's it. that's the slay. πŸŽ€

and that's a wrap on the page, bestie!! this was the CGI Library manual, dated 6 April 2008 β€” thank you for reading, mwah πŸ’–πŸ§šβœ¨

πŸ“¦ where this page comes from
  • ubuntu jammy: cgilib 0.6-1.1
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms