mirror of
https://github.com/espressif/esp-idf.git
synced 2026-08-09 00:30:11 +03:00
fix(esp_http_server): fix ws server subprotocol match
This commit is contained in:
@@ -509,6 +509,8 @@ static int read_block(httpd_req_t *req, http_parser *parser, size_t offset, size
|
||||
if (new_scratch == NULL) {
|
||||
free(raux->scratch);
|
||||
raux->scratch = NULL;
|
||||
/* Set last.at to NULL to avoid accidental dereference of dangling pointer */
|
||||
parser_data->last.at = NULL;
|
||||
ESP_LOGE(TAG, "Unable to allocate the scratch buffer");
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -83,7 +83,7 @@ static bool httpd_ws_get_response_subprotocol(const char *supported_subprotocol,
|
||||
char *rest = NULL;
|
||||
char *s = strtok_r(subprotocol, ", ", &rest);
|
||||
do {
|
||||
if (strncmp(s, supported_subprotocol, sizeof(subprotocol)) == 0) {
|
||||
if (strncmp(s, supported_subprotocol, strlen(supported_subprotocol)) == 0) {
|
||||
ESP_LOGD(TAG, "Requested subprotocol supported: %s", s);
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user