diff --git a/UNITTESTS/features/cellular/framework/AT/at_cellularnetwork/at_cellularnetworktest.cpp b/UNITTESTS/features/cellular/framework/AT/at_cellularnetwork/at_cellularnetworktest.cpp index 4ff0837b16..e54a8d2844 100644 --- a/UNITTESTS/features/cellular/framework/AT/at_cellularnetwork/at_cellularnetworktest.cpp +++ b/UNITTESTS/features/cellular/framework/AT/at_cellularnetwork/at_cellularnetworktest.cpp @@ -227,9 +227,8 @@ TEST_F(TestAT_CellularNetwork, test_AT_CellularNetwork_activate_context) ATHandler_stub::resp_stop_success_count = 2; ATHandler_stub::nsapi_error_value = NSAPI_ERROR_OK; ATHandler_stub::bool_value = false; - EXPECT_TRUE(NSAPI_ERROR_OK == cn.set_credentials("apn", CellularNetwork::CHAP, "user", "passwd")); - EXPECT_TRUE(NSAPI_ERROR_AUTH_FAILURE == cn.activate_context()); - + EXPECT_TRUE(NSAPI_ERROR_OK == my_cn.set_credentials("apn", CellularNetwork::CHAP, "user", "passwd")); + EXPECT_TRUE(NSAPI_ERROR_AUTH_FAILURE == my_cn.activate_context()); // get_context return true and new context created, also do_user_authentication called with success. // Now there is stack. diff --git a/UNITTESTS/features/cellular/framework/common/util/utiltest.cpp b/UNITTESTS/features/cellular/framework/common/util/utiltest.cpp index 18cb36cb5f..4c00da93c2 100644 --- a/UNITTESTS/features/cellular/framework/common/util/utiltest.cpp +++ b/UNITTESTS/features/cellular/framework/common/util/utiltest.cpp @@ -126,14 +126,14 @@ TEST_F(Testutil, separate_ip_addresses) char ip[64] = {0}; char subnet[64] = {0}; - strncpy(s, "32.1.20.187.1.112.139.245.251.136.232.110.123.51.230.138.0.1.2.3.4.5.6.7.8.9.10.11.12.13.14.15", 94); + strncpy(s, "32.1.20.187.1.112.139.245.251.136.232.110.123.51.230.138.0.1.2.3.4.5.6.7.8.9.10.11.12.13.14.15\0", 95); separate_ip_addresses(NULL, ip, sizeof(ip), subnet, sizeof(subnet)); separate_ip_addresses(s, ip, sizeof(ip), subnet, sizeof(subnet)); EXPECT_STREQ("2001:14BB:170:8BF5:FB88:E86E:7B33:E68A", ip); EXPECT_STREQ("001:203:405:607:809:A0B:C0D:E0F", subnet); - strncpy(s, "32:1:20:187:1:112:139:245:251:136:232:110:123:51:230:138 0:1:2:3:4:5:6:7:8:9:10:11:12:13:14:15", 94); + strncpy(s, "32:1:20:187:1:112:139:245:251:136:232:110:123:51:230:138 0:1:2:3:4:5:6:7:8:9:10:11:12:13:14:15\0", 95); separate_ip_addresses(s, ip, sizeof(ip), subnet, sizeof(subnet)); EXPECT_STREQ("32:1:20:187:1:112:139:245:251:136:232:110:123:51:230:138", ip); EXPECT_STREQ("0:1:2:3:4:5:6:7:8:9:10:11:12:13:14:15", subnet); diff --git a/features/cellular/framework/API/CellularNetwork.h b/features/cellular/framework/API/CellularNetwork.h index 6600c17167..609ccd844a 100644 --- a/features/cellular/framework/API/CellularNetwork.h +++ b/features/cellular/framework/API/CellularNetwork.h @@ -150,6 +150,9 @@ public: op_status = Unknown; op_rat = RAT_UNKNOWN; next = NULL; + op_long[0] = NULL; + op_short[0] = NULL; + op_num[0] = NULL; } }; diff --git a/features/cellular/framework/AT/AT_CellularNetwork.cpp b/features/cellular/framework/AT/AT_CellularNetwork.cpp index 09aaa15877..4c6a960c56 100644 --- a/features/cellular/framework/AT/AT_CellularNetwork.cpp +++ b/features/cellular/framework/AT/AT_CellularNetwork.cpp @@ -316,9 +316,10 @@ nsapi_error_t AT_CellularNetwork::activate_context() if (!_is_context_active) { // authenticate before activating or modifying context - if (do_user_authentication() != NSAPI_ERROR_OK) { + nsapi_error_t err = do_user_authentication(); + if (err != NSAPI_ERROR_OK) { tr_error("Cellular authentication failed!"); - return _at.unlock_return_error(); + return err; } tr_info("Activate PDP context %d", _cid);