mqtt: reject control bytes in the topic

Closes #22112
This commit is contained in:
alhudz 2026-06-19 22:15:20 +05:30 committed by Daniel Stenberg
parent c10a7aa259
commit f746780a1e
No known key found for this signature in database
GPG key ID: 5CC908FDB71E12C2
3 changed files with 52 additions and 2 deletions

View file

@ -438,7 +438,7 @@ static CURLcode mqtt_get_topic(struct Curl_easy *data,
const char *path = data->state.up.path;
CURLcode result = CURLE_URL_MALFORMAT;
if(strlen(path) > 1) {
result = Curl_urldecode(path + 1, 0, topic, topiclen, REJECT_NADA);
result = Curl_urldecode(path + 1, 0, topic, topiclen, REJECT_CTRL);
if(!result && (*topiclen > 0xffff)) {
failf(data, "Too long MQTT topic");
result = CURLE_URL_MALFORMAT;