From ba20fa3939c1505866d715a5a1a43f61a4f8de17 Mon Sep 17 00:00:00 2001 From: Alejandro Colomar Date: Tue, 17 May 2022 11:18:58 +0200 Subject: [PATCH] Fixed memcpy(dest, NULL, 0) Undefined Behavior. nxt_str_null() setted the loc.start pointer to NULL, which was being passed to memcpy(3) through nxt_debug(). That caused Undefined Behavior, so we now pass an empty string. --- src/nxt_http_return.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/nxt_http_return.c b/src/nxt_http_return.c index e3dd02ad..8832941f 100644 --- a/src/nxt_http_return.c +++ b/src/nxt_http_return.c @@ -80,7 +80,7 @@ nxt_http_return(nxt_task_t *task, nxt_http_request_t *r, conf = action->u.conf; if (conf->location == NULL) { - nxt_str_null(&loc); + nxt_str_set(&loc, ""); } else { nxt_var_raw(conf->location, &loc);