src/utils_cgi.c: Fix minor problems with the HTML escape functions.
[collection4.git] / src / utils_cgi.c
index 9efa01f..fb9a1fb 100644 (file)
@@ -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));