Fix SVACE/Coverity issues 61/319261/3 accepted/tizen_unified accepted/tizen_unified_x tizen accepted/tizen/unified/20250218.161805 accepted/tizen/unified/x/20250221.042201
authorMohammed Arshad <md.arshad@samsung.com>
Thu, 6 Feb 2025 12:03:50 +0000 (17:33 +0530)
committerMohammed Arshad <md.arshad@samsung.com>
Thu, 6 Feb 2025 13:00:21 +0000 (18:30 +0530)
SVACE issue ID: 256096
Coverity issue ID: 1021422

Change-Id: I0efcd24beedf0212750a58500d79165b47a8b8ed

include/NanConfig.h
packaging/nan-manager.spec
src/NanDbusHandler.cpp
src/NanHal.cpp

index 46e7a976d2fdccd8bfd2137558c590f1e3d7a34a..d8391f76e790f10db623ae8abe52a6362eda4c11 100644 (file)
@@ -45,7 +45,7 @@ struct NanSecurityConfig
     uint32_t keyLen;
     // need to unify array for pmk and passphrase?
     uint8_t pmk[NAN_MAX_PMK_LEN];
-    uint8_t passphrase[NAN_MAX_PASSPHRASE_LEN];
+    uint8_t passphrase[NAN_MAX_PASSPHRASE_LEN + 1];
 };
 
 class NanConfig
index 89fb01a87646dc2eded0e730a042f505ef879c06..9bc5441ac18b9a8814d62904e95475d5cd2092c7 100644 (file)
@@ -2,7 +2,7 @@
 
 Name:          nan-manager
 Summary:       NAN (Neighbor Awareness Networking) manager (Wi-Fi Aware)
-Version:       0.2.1
+Version:       0.2.2
 Release:       1
 Group:         Network & Connectivity
 License:       Apache-2.0
index 6e1f08cb2617b3ebde316e26d1ce4f5378568ecf..d4de5c5c1491862fde1babcf3e315c7cb1e9fe8b 100644 (file)
@@ -381,7 +381,7 @@ gboolean NanDbusHandler::openDataPathPskHandler(NanDbusDiscovery *object,
                return false;
        }
        config->securityConfig.keyLen = len;
-       memcpy(config->securityConfig.passphrase, psk, config->securityConfig.keyLen);
+       memcpy(config->securityConfig.passphrase, psk, config->securityConfig.keyLen + 1);
 
        NanError ret = serviceProvider->openDataPath(config,
                        clientId, pubSubId, peerId, (NanDataPathRole)role);
index 6e4a461bccf3fcb05765911ebad7c20cf26c5e6f..21b7e0fa035d466688b0862351f8418d2108d608 100644 (file)
@@ -83,7 +83,12 @@ NanError NanHal::init(void)
                return NAN_ERROR_OPERATION_FAILED;
        }
 
-       std::thread(&NanHal::runEventLoop, this).detach();
+       try {
+               std::thread(&NanHal::runEventLoop, this).detach();
+       } catch (const std::exception& err) {
+               NAN_LOGE("Failed to create event loop and detach it %s", err.what());
+               return NAN_ERROR_OPERATION_FAILED;
+       }
 
        NAN_LOGI("Success to initialize NAN");