Skip to content

Commit e656657

Browse files
krish2718rlubos
authored andcommitted
modules: wfa-qt: Fix handling failures
The response handler doesn't check for failures and they will be ignored, add a check for failures and return failure. Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
1 parent 2815774 commit e656657

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

modules/wfa-qt/src/indigo_api_callback_dut.c

+6-4
Original file line numberDiff line numberDiff line change
@@ -104,23 +104,25 @@ void register_apis(void)
104104

105105
static int handle_response(char *buffer, char *response)
106106
{
107-
if (strncmp(buffer, "ADD_CRED", strlen("ADD_CRED")) == 0) {
107+
if (strncmp(buffer, "FAIL", strlen("FAIL")) == 0) {
108+
goto err;
109+
} else if (strncmp(buffer, "ADD_CRED", strlen("ADD_CRED")) == 0) {
108110
cred_id = atoi(response);
109111
} else if ((strstr(buffer, "WPS_AP_PIN")) ||
110112
(strstr(buffer, "WPS_PIN")) ||
111113
(strstr(buffer, "WPS_PBC"))) {
112114
memset(wsc_pin, 0, sizeof(wsc_pin));
113115
if (strncpy(wsc_pin, response, sizeof(wsc_pin)) == NULL) {
114-
goto done;
116+
goto err;
115117
}
116118
} else if (strncmp(buffer, "STATUS", strlen("STATUS") == 0)) {
117119
memset(status_res, 0, sizeof(status_res));
118120
if (strncpy(status_res, response, sizeof(status_res)) == NULL) {
119-
goto done;
121+
goto err;
120122
}
121123
}
122124
return 0;
123-
done:
125+
err:
124126
return -1;
125127
}
126128

0 commit comments

Comments
 (0)