Fixed coverity warnings for targets folder. Also fixed one bug while copying sim.

pull/6496/head
Teppo Järvelin 2018-03-21 11:34:12 +02:00
parent fa61f094db
commit 54ab974846
3 changed files with 9 additions and 3 deletions

View File

@ -136,7 +136,7 @@ bool CellularConnectionFSM::power_on()
void CellularConnectionFSM::set_sim_pin(const char * sim_pin)
{
strncpy(_sim_pin, sim_pin, sizeof(_sim_pin));
_sim_pin[sizeof(_sim_pin)] = '\0';
_sim_pin[sizeof(_sim_pin)-1] = '\0';
}
bool CellularConnectionFSM::open_sim()

View File

@ -310,6 +310,7 @@ nsapi_error_t AT_CellularNetwork::connect()
nsapi_error_t AT_CellularNetwork::open_data_channel()
{
#if NSAPI_PPP_AVAILABLE
tr_info("Open data channel in PPP mode");
_at.cmd_start("AT+CGDATA=\"PPP\",");
_at.write_int(_cid);
@ -323,6 +324,9 @@ nsapi_error_t AT_CellularNetwork::open_data_channel()
* If blocking: mbed_ppp_init() is a blocking call, it will block until
connected, or timeout after 30 seconds*/
return nsapi_ppp_connect(_at.get_file_handle(), callback(this, &AT_CellularNetwork::ppp_status_cb), NULL, NULL, _ip_stack_type);
#else
return NSAPI_ERROR_OK;
#endif // #if NSAPI_PPP_AVAILABLE
}
/**

View File

@ -99,7 +99,7 @@ void QUECTEL_BG96_CellularStack::handle_open_socket_response(int &modem_connect_
}
nsapi_error_t QUECTEL_BG96_CellularStack::create_socket_impl(CellularSocket *socket)
{
int modem_connect_id;
int modem_connect_id = -1;
int request_connect_id = socket->id;
int remote_port = 0;
int err = -1;
@ -246,7 +246,9 @@ nsapi_size_or_error_t QUECTEL_BG96_CellularStack::socket_recvfrom_impl(CellularS
recv_len = _at.read_int();
_at.read_string(ip_address, sizeof(ip_address));
port = _at.read_int();
_at.read_bytes((uint8_t*)buffer, recv_len);
if (recv_len > 0) {
_at.read_bytes((uint8_t*)buffer, recv_len);
}
_at.resp_stop();
if (!recv_len || (_at.get_last_error() != NSAPI_ERROR_OK)) {