Fix unreachable code in URL output handler (#19056)

Since `ZSTR_LEN()` returns a `size_t` (unsigned integer), the value can only be either "not equal to 0" or "equal to 0". The third `else` branch was unreachable, making the `*handled_output = NULL;` assignment dead code.
This commit is contained in:
Zheng Yu 2025-07-07 05:57:43 -04:00 committed by GitHub
parent 3b45b9d74e
commit b068ee307f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -701,7 +701,7 @@ static inline void php_url_scanner_session_handler_impl(char *output, size_t out
len = UINT_MAX; len = UINT_MAX;
} }
*handled_output_len = len; *handled_output_len = len;
} else if (ZSTR_LEN(url_state->url_app.s) == 0) { } else {
url_adapt_state_ex_t *ctx = url_state; url_adapt_state_ex_t *ctx = url_state;
if (ctx->buf.s && ZSTR_LEN(ctx->buf.s)) { if (ctx->buf.s && ZSTR_LEN(ctx->buf.s)) {
smart_str_append(&ctx->result, ctx->buf.s); smart_str_append(&ctx->result, ctx->buf.s);
@ -715,8 +715,6 @@ static inline void php_url_scanner_session_handler_impl(char *output, size_t out
} else { } else {
*handled_output = estrndup(output, *handled_output_len = output_len); *handled_output = estrndup(output, *handled_output_len = output_len);
} }
} else {
*handled_output = NULL;
} }
} }