Fix coverity defects 84/173584/2 submit/tizen/20180403.094824 submit/tizen/20180413.092019 submit/tizen/20180416.041718 submit/tizen/20180418.034402
authorDongsun Lee <ds73.lee@samsung.com>
Thu, 22 Mar 2018 07:50:00 +0000 (16:50 +0900)
committerDongsun Lee <ds73.lee@samsung.com>
Fri, 30 Mar 2018 04:26:54 +0000 (13:26 +0900)
- 105284: Buffer not null terminated
- 108955: Big parameter passed by value
- 109815: Uncaught exception

Change-Id: I303a652d6ae0540f7d6daa833a30ef0fb691ffb8
Signed-off-by: Dongsun Lee <ds73.lee@samsung.com>
src/manager/client-async/connection-thread.cpp
src/manager/service/encryption-service.cpp
src/manager/service/key-provider.cpp

index 555056b..d663513 100644 (file)
@@ -57,8 +57,16 @@ ConnectionThread::ConnectionThread() :
 ConnectionThread::~ConnectionThread()
 {
        m_join = true;
-       m_pipe.notify();
-       m_thread.join();
+       try {
+               m_pipe.notify();
+               m_thread.join();
+       } catch (CKM::Exception &e) {
+               LogError("CKM::Exception::Exception " << e.DumpToString());
+       } catch (std::exception &e) {
+               LogError("STD exception " << e.what());
+       } catch (...) {
+               LogError("Unknown exception occured");
+       }
 }
 
 void ConnectionThread::run()
index f886867..e403584 100644 (file)
@@ -103,7 +103,7 @@ bool EncryptionService::ProcessOne(
 
                ProcessEncryption(conn, info.credentials, info.buffer);
                return true;
-       } catch (MessageBuffer::Exception::Base) {
+       } catch (MessageBuffer::Exception::Base &) {
                LogError("Broken protocol. Closing socket.");
        } catch (const std::exception &e) {
                LogError("Std exception:: " << e.what());
index 60cce23..15bff3d 100644 (file)
@@ -56,7 +56,7 @@ void WrappedKeyAndInfoContainer::setKeyInfoLabel(const std::string label)
        strncpy(
                wrappedKeyAndInfo->keyInfo.label,
                label.c_str(),
-               MAX_LABEL_SIZE);
+               MAX_LABEL_SIZE-1);
 }
 
 void WrappedKeyAndInfoContainer::setKeyInfoSalt(const unsigned char *salt,