executor: fix sigsegv for default USB string response

This commit is contained in:
Andrey Konovalov 2019-09-05 19:01:29 +02:00 committed by Andrey Konovalov
parent bf6bcce4f2
commit c16be727a6
2 changed files with 2 additions and 2 deletions

View File

@ -199,7 +199,7 @@ static bool lookup_connect_response(struct vusb_connect_descriptors* descs, stru
return true;
case USB_DT_STRING:
str_idx = (uint8)ctrl->wValue;
if (str_idx >= descs->strs_len) {
if (!descs || str_idx >= descs->strs_len) {
// Use the default string if we ran out.
*response_data = (char*)default_string;
*response_length = strlen(default_string);

View File

@ -1947,7 +1947,7 @@ static bool lookup_connect_response(struct vusb_connect_descriptors* descs, stru
return true;
case USB_DT_STRING:
str_idx = (uint8)ctrl->wValue;
if (str_idx >= descs->strs_len) {
if (!descs || str_idx >= descs->strs_len) {
*response_data = (char*)default_string;
*response_length = strlen(default_string);
} else {