Fixed null dereferencing 36/232436/1 accepted/tizen/unified/20200507.052341 submit/tizen/20200504.152605 submit/tizen/20200506.120225
authorJaehyun Kim <jeik01.kim@samsung.com>
Mon, 4 May 2020 15:05:53 +0000 (00:05 +0900)
committerJaehyun Kim <jeik01.kim@samsung.com>
Mon, 4 May 2020 15:05:53 +0000 (00:05 +0900)
Change-Id: Ie0a6e25b568109369d36041f68a4a0dcb3e13688
Signed-off-by: Jaehyun Kim <jeik01.kim@samsung.com>
src/connection_profile.c

index 8122d25..4f884ea 100755 (executable)
@@ -2702,6 +2702,12 @@ EXPORT_API int connection_profile_enable_ethernet_eap(connection_profile_h profi
        net_profile_info_t *profile_info = profile;
        net_dev_info_t *net_info = __profile_get_net_info(profile_info);
 
+       if (!net_info) {
+               CONNECTION_LOG(CONNECTION_ERROR, "Invalid operation");
+               CONN_UNLOCK;
+               return CONNECTION_ERROR_INVALID_OPERATION;
+       }
+
        int ret = _connection_libnet_enable_ethernet_eap(enable, net_info->ProfileName);
        if (ret != CONNECTION_ERROR_NONE) {
                CONNECTION_LOG(CONNECTION_ERROR, "Failed to enable EAP over ethernet");
@@ -2732,7 +2738,7 @@ EXPORT_API int connection_profile_set_ethernet_eap_type(connection_profile_h pro
        net_profile_info_t *profile_info = profile;
        net_dev_info_t *net_info = __profile_get_net_info(profile_info);
 
-       if (net_info->use_eapol == false) {
+       if (!net_info || net_info->use_eapol == false) {
                CONNECTION_LOG(CONNECTION_ERROR, "Invalid operation");
                CONN_UNLOCK;
                return CONNECTION_ERROR_INVALID_OPERATION;
@@ -2760,7 +2766,7 @@ EXPORT_API int connection_profile_get_ethernet_eap_type(connection_profile_h pro
        net_profile_info_t *profile_info = profile;
        net_dev_info_t *net_info = __profile_get_net_info(profile_info);
 
-       if (net_info->use_eapol == false) {
+       if (!net_info || net_info->use_eapol == false) {
                CONNECTION_LOG(CONNECTION_ERROR, "Invalid operation");
                CONN_UNLOCK;
                return CONNECTION_ERROR_INVALID_OPERATION;
@@ -2790,7 +2796,7 @@ EXPORT_API int connection_profile_set_ethernet_eap_passphrase(connection_profile
        net_profile_info_t *profile_info = profile;
        net_dev_info_t *net_info = __profile_get_net_info(profile_info);
 
-        if (false == __profile_ethernet_validate_eap_passphrase(net_info)) {
+        if (!net_info || false == __profile_ethernet_validate_eap_passphrase(net_info)) {
                CONNECTION_LOG(CONNECTION_ERROR, "Invalid operation");
                CONN_UNLOCK;
                return CONNECTION_ERROR_INVALID_OPERATION;
@@ -2821,7 +2827,7 @@ EXPORT_API int connection_profile_get_ethernet_eap_passphrase(connection_profile
        net_profile_info_t *profile_info = profile;
        net_dev_info_t *net_info = __profile_get_net_info(profile_info);
 
-        if (false == __profile_ethernet_validate_eap_passphrase(net_info)) {
+        if (!net_info || false == __profile_ethernet_validate_eap_passphrase(net_info)) {
                CONNECTION_LOG(CONNECTION_ERROR, "Invalid operation");
                CONN_UNLOCK;
                return CONNECTION_ERROR_INVALID_OPERATION;
@@ -2860,7 +2866,7 @@ EXPORT_API int connection_profile_set_ethernet_eap_identity(connection_profile_h
         net_profile_info_t *profile_info = profile;
         net_dev_info_t *net_info = __profile_get_net_info(profile_info);
 
-        if (false == __profile_ethernet_validate_eap_identity(net_info)) {
+        if (!net_info || false == __profile_ethernet_validate_eap_identity(net_info)) {
                 CONNECTION_LOG(CONNECTION_ERROR, "Invalid operation");
                 CONN_UNLOCK;
                 return CONNECTION_ERROR_INVALID_OPERATION;
@@ -2890,7 +2896,7 @@ EXPORT_API int connection_profile_get_ethernet_eap_identity(connection_profile_h
         net_profile_info_t *profile_info = profile;
         net_dev_info_t *net_info = __profile_get_net_info(profile_info);
 
-        if (false == __profile_ethernet_validate_eap_identity(net_info)) {
+        if (!net_info || false == __profile_ethernet_validate_eap_identity(net_info)) {
                 CONNECTION_LOG(CONNECTION_ERROR, "Invalid operation");
                 CONN_UNLOCK;
                 return CONNECTION_ERROR_INVALID_OPERATION;
@@ -2924,7 +2930,7 @@ EXPORT_API int connection_profile_set_ethernet_eap_ca_cert_file(connection_profi
         net_profile_info_t *profile_info = profile;
         net_dev_info_t *net_info = __profile_get_net_info(profile_info);
 
-        if (false == __profile_ethernet_validate_eap_ca_cert_file(net_info)) {
+        if (!net_info || false == __profile_ethernet_validate_eap_ca_cert_file(net_info)) {
                 CONNECTION_LOG(CONNECTION_ERROR, "Invalid operation");
                 CONN_UNLOCK;
                 return CONNECTION_ERROR_INVALID_OPERATION;
@@ -2954,7 +2960,7 @@ EXPORT_API int connection_profile_get_ethernet_eap_ca_cert_file(connection_profi
         net_profile_info_t *profile_info = profile;
         net_dev_info_t *net_info = __profile_get_net_info(profile_info);
 
-        if (false == __profile_ethernet_validate_eap_ca_cert_file(net_info)) {
+        if (!net_info || false == __profile_ethernet_validate_eap_ca_cert_file(net_info)) {
                 CONNECTION_LOG(CONNECTION_ERROR, "Invalid operation");
                 CONN_UNLOCK;
                 return CONNECTION_ERROR_INVALID_OPERATION;
@@ -2988,7 +2994,7 @@ EXPORT_API int connection_profile_set_ethernet_eap_client_cert_file(connection_p
         net_profile_info_t *profile_info = profile;
         net_dev_info_t *net_info = __profile_get_net_info(profile_info);
 
-        if (false == __profile_ethernet_validate_eap_client_cert_file(net_info)) {
+        if (!net_info || false == __profile_ethernet_validate_eap_client_cert_file(net_info)) {
                 CONNECTION_LOG(CONNECTION_ERROR, "Invalid operation");
                 CONN_UNLOCK;
                 return CONNECTION_ERROR_INVALID_OPERATION;
@@ -3018,7 +3024,7 @@ EXPORT_API int connection_profile_get_ethernet_eap_client_cert_file(connection_p
         net_profile_info_t *profile_info = profile;
         net_dev_info_t *net_info = __profile_get_net_info(profile_info);
 
-        if (false == __profile_ethernet_validate_eap_client_cert_file(net_info)) {
+        if (!net_info || false == __profile_ethernet_validate_eap_client_cert_file(net_info)) {
                 CONNECTION_LOG(CONNECTION_ERROR, "Invalid operation");
                 CONN_UNLOCK;
                 return CONNECTION_ERROR_INVALID_OPERATION;
@@ -3052,7 +3058,7 @@ EXPORT_API int connection_profile_get_ethernet_eap_private_key_file(connection_p
         net_profile_info_t *profile_info = profile;
         net_dev_info_t *net_info = __profile_get_net_info(profile_info);
 
-        if (false == __profile_ethernet_validate_eap_private_key_file(net_info)) {
+        if (!net_info || false == __profile_ethernet_validate_eap_private_key_file(net_info)) {
                 CONNECTION_LOG(CONNECTION_ERROR, "Invalid operation");
                 CONN_UNLOCK;
                 return CONNECTION_ERROR_INVALID_OPERATION;
@@ -3086,7 +3092,7 @@ EXPORT_API int connection_profile_set_ethernet_eap_private_key_info(connection_p
         net_profile_info_t *profile_info = profile;
         net_dev_info_t *net_info = __profile_get_net_info(profile_info);
 
-        if (false == __profile_ethernet_validate_eap_private_key_file(net_info)) {
+        if (!net_info || false == __profile_ethernet_validate_eap_private_key_file(net_info)) {
                 CONNECTION_LOG(CONNECTION_ERROR, "Invalid operation");
                 CONN_UNLOCK;
                 return CONNECTION_ERROR_INVALID_OPERATION;
@@ -3117,7 +3123,7 @@ EXPORT_API int connection_profile_set_ethernet_eap_anonymous_identity(connection
         net_profile_info_t *profile_info = profile;
         net_dev_info_t *net_info = __profile_get_net_info(profile_info);
 
-        if (false == __profile_ethernet_validate_eap_anonymous_identity(net_info)) {
+        if (!net_info || false == __profile_ethernet_validate_eap_anonymous_identity(net_info)) {
                 CONNECTION_LOG(CONNECTION_ERROR, "Invalid operation");
                 CONN_UNLOCK;
                 return CONNECTION_ERROR_INVALID_OPERATION;
@@ -3147,7 +3153,7 @@ EXPORT_API int connection_profile_get_ethernet_eap_anonymous_identity(connection
         net_profile_info_t *profile_info = profile;
         net_dev_info_t *net_info = __profile_get_net_info(profile_info);
 
-        if (false == __profile_ethernet_validate_eap_anonymous_identity(net_info)) {
+        if (!net_info || false == __profile_ethernet_validate_eap_anonymous_identity(net_info)) {
                 CONNECTION_LOG(CONNECTION_ERROR, "Invalid operation");
                 CONN_UNLOCK;
                 return CONNECTION_ERROR_INVALID_OPERATION;
@@ -3181,7 +3187,7 @@ EXPORT_API int connection_profile_set_ethernet_eap_pac_file(connection_profile_h
         net_profile_info_t *profile_info = profile;
         net_dev_info_t *net_info = __profile_get_net_info(profile_info);
 
-        if (false == __profile_ethernet_validate_eap_pac_file(net_info)) {
+        if (!net_info || false == __profile_ethernet_validate_eap_pac_file(net_info)) {
                 CONNECTION_LOG(CONNECTION_ERROR, "Invalid operation");
                 CONN_UNLOCK;
                 return CONNECTION_ERROR_INVALID_OPERATION;
@@ -3211,7 +3217,7 @@ EXPORT_API int connection_profile_get_ethernet_eap_pac_file(connection_profile_h
         net_profile_info_t *profile_info = profile;
         net_dev_info_t *net_info = __profile_get_net_info(profile_info);
 
-        if (false == __profile_ethernet_validate_eap_pac_file(net_info)) {
+        if (!net_info || false == __profile_ethernet_validate_eap_pac_file(net_info)) {
                 CONNECTION_LOG(CONNECTION_ERROR, "Invalid operation");
                 CONN_UNLOCK;
                 return CONNECTION_ERROR_INVALID_OPERATION;
@@ -3244,7 +3250,7 @@ EXPORT_API int connection_profile_set_ethernet_eap_auth_type(connection_profile_
        net_profile_info_t *profile_info = profile;
        net_dev_info_t *net_info = __profile_get_net_info(profile_info);
 
-       if (false == __profile_ethernet_validate_eap_auth_type(net_info)) {
+       if (!net_info || false == __profile_ethernet_validate_eap_auth_type(net_info)) {
                CONNECTION_LOG(CONNECTION_ERROR, "Invalid operation");
                CONN_UNLOCK;
                return CONNECTION_ERROR_INVALID_OPERATION;
@@ -3273,7 +3279,7 @@ EXPORT_API int connection_profile_get_ethernet_eap_auth_type(connection_profile_
        net_profile_info_t *profile_info = profile;
        net_dev_info_t *net_info = __profile_get_net_info(profile_info);
 
-       if (false == __profile_ethernet_validate_eap_auth_type(net_info)) {
+       if (!net_info || false == __profile_ethernet_validate_eap_auth_type(net_info)) {
                CONNECTION_LOG(CONNECTION_ERROR, "Invalid operation");
                CONN_UNLOCK;
                return CONNECTION_ERROR_INVALID_OPERATION;
@@ -3302,7 +3308,7 @@ EXPORT_API int connection_profile_set_ethernet_eap_peap_version(connection_profi
        net_profile_info_t *profile_info = profile;
        net_dev_info_t *net_info = __profile_get_net_info(profile_info);
 
-        if (false == __profile_ethernet_validate_eap_peap_version(net_info)) {
+        if (!net_info || false == __profile_ethernet_validate_eap_peap_version(net_info)) {
                CONNECTION_LOG(CONNECTION_ERROR, "Invalid operation");
                CONN_UNLOCK;
                return CONNECTION_ERROR_INVALID_OPERATION;
@@ -3330,7 +3336,7 @@ EXPORT_API int connection_profile_get_ethernet_eap_peap_version(connection_profi
        net_profile_info_t *profile_info = profile;
        net_dev_info_t *net_info = __profile_get_net_info(profile_info);
 
-        if (false == __profile_ethernet_validate_eap_peap_version(net_info)) {
+        if (!net_info || false == __profile_ethernet_validate_eap_peap_version(net_info)) {
                CONNECTION_LOG(CONNECTION_ERROR, "Invalid operation");
                CONN_UNLOCK;
                return CONNECTION_ERROR_INVALID_OPERATION;