From b13fce25f7de6f9319fd609bb0fa262c974c1c98 Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Mon, 21 Jun 2010 10:40:29 +0200 Subject: [PATCH] src/utils_cgi.c: Fix minor problems with the HTML escape functions. --- src/utils_cgi.c | 5 ++++- src/utils_cgi.h | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) 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 */ -- 2.11.0