mirror of
https://github.com/pi-hole/FTL.git
synced 2024-10-26 16:52:18 +02:00
Fix escape_html() crashing for NULL input
Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
@@ -524,6 +524,10 @@ void read_and_parse_payload(struct ftl_conn *api)
|
||||
// See https://www.w3.org/International/questions/qa-escapes#use
|
||||
char *__attribute__((malloc)) escape_html(const char *string)
|
||||
{
|
||||
// If the string is NULL, return NULL
|
||||
if(string == NULL)
|
||||
return NULL;
|
||||
|
||||
// Allocate memory for escaped string
|
||||
char *escaped = calloc(strlen(string) * 6 + 1, sizeof(char));
|
||||
if(!escaped)
|
||||
|
||||
Reference in New Issue
Block a user