summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorAlejandro Colomar <alx.manpages@gmail.com>2022-05-17 11:18:58 +0200
committerAlejandro Colomar <alx.manpages@gmail.com>2022-05-17 12:39:41 +0200
commitba20fa3939c1505866d715a5a1a43f61a4f8de17 (patch)
tree0be833c7ee1f047e3703588a76ca87ebb600a1f6 /src
parentb512eff4acb97955ba48797d1299c27070a57e1a (diff)
downloadunit-ba20fa3939c1505866d715a5a1a43f61a4f8de17.tar.gz
unit-ba20fa3939c1505866d715a5a1a43f61a4f8de17.tar.bz2
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.
Diffstat (limited to 'src')
-rw-r--r--src/nxt_http_return.c2
1 files changed, 1 insertions, 1 deletions
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);