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.
This commit is contained in:
Alejandro Colomar
2022-05-17 11:18:58 +02:00
parent b512eff4ac
commit ba20fa3939

View File

@@ -80,7 +80,7 @@ nxt_http_return(nxt_task_t *task, nxt_http_request_t *r,
conf = action->u.conf; conf = action->u.conf;
if (conf->location == NULL) { if (conf->location == NULL) {
nxt_str_null(&loc); nxt_str_set(&loc, "");
} else { } else {
nxt_var_raw(conf->location, &loc); nxt_var_raw(conf->location, &loc);