From: Florian Forster Date: Mon, 21 Jun 2010 08:40:29 +0000 (+0200) Subject: src/utils_cgi.c: Fix minor problems with the HTML escape functions. X-Git-Tag: v4.0.0~218 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=b13fce25f7de6f9319fd609bb0fa262c974c1c98;p=collection4.git src/utils_cgi.c: Fix minor problems with the HTML escape functions. --- diff --git a/src/utils_cgi.c b/src/utils_cgi.c index 9efa01f..fb9a1fb 100644 --- a/src/utils_cgi.c +++ b/src/utils_cgi.c @@ -328,7 +328,7 @@ char *html_escape_copy (char *dest, const char *src, size_t n) /* {{{ */ break; } - return (src); + return (dest); } /* }}} char *html_escape_copy */ #undef COPY_ENTITY @@ -347,6 +347,9 @@ char *html_escape (const char *string) /* {{{ */ { char buffer[4096]; + if (string == NULL) + return (NULL); + html_escape_copy (buffer, string, sizeof (buffer)); return (strdup (buffer)); diff --git a/src/utils_cgi.h b/src/utils_cgi.h index b9b8c09..3204b62 100644 --- a/src/utils_cgi.h +++ b/src/utils_cgi.h @@ -18,4 +18,5 @@ char *html_escape (const char *string); char *html_escape_buffer (char *buffer, size_t buffer_size); char *html_escape_copy (char *dest, const char *src, size_t n); +/* vim: set sw=2 sts=2 et fdm=marker : */ #endif /* UTILS_CGI_H */