Skip to content

Commit

Permalink
naxsi_request_id() returns an empty string and not NULL
Browse files Browse the repository at this point in the history
  • Loading branch information
lubomudr committed Jun 29, 2024
1 parent ae9b887 commit c40b6e4
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions naxsi_src/naxsi_skeleton.c
Original file line number Diff line number Diff line change
Expand Up @@ -2113,7 +2113,7 @@ naxsi_request_id(ngx_http_request_t* req)
{
ngx_http_request_ctx_t* ctx = recover_request_ctx(req);
if (!ctx)
return NULL;
return (u_char*)"";

if (ctx->request_id[0] != 0)
return ctx->request_id;
Expand All @@ -2130,8 +2130,10 @@ naxsi_request_id(ngx_http_request_t* req)
/* NGINX request_id variable does not defined */
u_char bytes[NAXSI_REQUEST_ID_SIZE];
#if (NGX_OPENSSL)
if (RAND_bytes(bytes, NAXSI_REQUEST_ID_SIZE) != 1)
return NULL;
if (RAND_bytes(bytes, NAXSI_REQUEST_ID_SIZE) != 1) {
ngx_hex_dump(ctx->request_id, bytes, NAXSI_REQUEST_ID_SIZE);
return ctx->request_id;
}
#else
uint32_t* bytes32 = (uint32_t*)bytes;
const size_t len = (NAXSI_REQUEST_ID_SIZE / sizeof(uint32_t));
Expand Down

0 comments on commit c40b6e4

Please sign in to comment.