coverity 226254... - printf

This commit is contained in:
iceman1001 2019-10-09 14:25:13 +02:00
parent 16f1866943
commit 55c33e75ef

View file

@ -391,7 +391,7 @@ static int CmdUsartBtFactory(const char *Cmd) {
if (strcmp((char *)data, "OK+ROLE:S") == 0) { if (strcmp((char *)data, "OK+ROLE:S") == 0) {
PrintAndLogEx(SUCCESS, "Role set to " _GREEN_("Slave")); PrintAndLogEx(SUCCESS, "Role set to " _GREEN_("Slave"));
} else { } else {
PrintAndLogEx(WARNING, "Unexpected response to AT+ROLE=S: " _YELLOW_("%.*s"), len, data); PrintAndLogEx(WARNING, "Unexpected response to AT+ROLE=S: " _YELLOW_("%.*s"), (int)len, data);
} }
} else { } else {
PrintAndLogEx(WARNING, "Lost contact with add-on, please try again"); PrintAndLogEx(WARNING, "Lost contact with add-on, please try again");
@ -505,30 +505,33 @@ static int CmdUsartBtPin(const char *Cmd) {
break; break;
} }
} }
//Validations //Validations
if (errors || cmdp == 0) { if (errors || cmdp == 0) {
usage_usart_bt_pin(); usage_usart_bt_pin();
return PM3_EINVARG; return PM3_EINVARG;
} }
char string[6 + sizeof(pin)] = {0}; char string[6 + sizeof(pin)] = {0};
sprintf(string, "AT+PIN%s", pin); sprintf(string, "AT+PIN%s", pin);
uint8_t data[PM3_CMD_DATA_SIZE] = {0x00}; uint8_t data[PM3_CMD_DATA_SIZE] = {0x00};
size_t len = 0; size_t len = 0;
// PrintAndLogEx(NORMAL, "TX (%3zu):%.*s", strlen(string), (int)strlen(string), string);
int ret = usart_txrx((uint8_t *)string, strlen(string), data, &len, 600); int ret = usart_txrx((uint8_t *)string, strlen(string), data, &len, 600);
if (ret == PM3_ENODATA) { if (ret == PM3_ENODATA) {
PrintAndLogEx(FAILED, "No response from add-on, is it ON and blinking?"); PrintAndLogEx(FAILED, "No response from add-on, is it ON and blinking?");
return ret; return ret;
} }
if (ret != PM3_SUCCESS) { if (ret != PM3_SUCCESS) {
PrintAndLogEx(FAILED, "Command failed, ret=%i", ret); PrintAndLogEx(FAILED, "Command failed, ret=%i", ret);
return ret; return ret;
} }
// PrintAndLogEx(NORMAL, "RX (%3zu):%.*s", len, (int)len, data);
if (strcmp((char *)data, "OKsetPIN") == 0) { if (strcmp((char *)data, "OKsetPIN") == 0) {
PrintAndLogEx(NORMAL, "PIN changed " _GREEN_("successfully")); PrintAndLogEx(NORMAL, "PIN changed " _GREEN_("successfully"));
} else { } else {
PrintAndLogEx(WARNING, "Unexpected answer: %.*s", len, data); PrintAndLogEx(WARNING, "Unexpected answer: %.*s", (int)len, data);
} }
return PM3_SUCCESS; return PM3_SUCCESS;
} }
@ -621,7 +624,7 @@ static int CmdUsartRX(const char *Cmd) {
int ret = usart_rx(data, &len, waittime); int ret = usart_rx(data, &len, waittime);
if (ret != PM3_SUCCESS) if (ret != PM3_SUCCESS)
return ret; return ret;
PrintAndLogEx(NORMAL, "RX:%.*s", len, data); PrintAndLogEx(NORMAL, "RX:%.*s", (int)len, data);
return PM3_SUCCESS; return PM3_SUCCESS;
} }