Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

maage: fix: use memchr to scan ngx_string #11

Merged
merged 1 commit into from Aug 12, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/ngx_http_eval_module.c
Expand Up @@ -514,7 +514,8 @@ ngx_http_eval_parse_param(ngx_http_request_t *r, ngx_http_eval_ctx_t *ctx,
ngx_str_t name;
ngx_str_t value;

p = (u_char *) ngx_strchr(param->data, '=');
/* param->data is not \0 terminated */
p = (u_char *) memchr(param->data, '=', param->len);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
p = (u_char *) memchr(param->data, '=', param->len);
p = (u_char *) ngx_strlchr(param->data, param->data + param->len, '=');


if (p == NULL) {
ngx_log_error(NGX_LOG_ERR, r->connection->log, 0,
Expand Down