Bug fix
authoryuseok.jeon <yuseok.jeon@samsung.com>
Thu, 5 Jun 2014 01:15:38 +0000 (10:15 +0900)
committerBartlomiej Grzelewski <b.grzelewski@samsung.com>
Fri, 12 Sep 2014 12:57:08 +0000 (14:57 +0200)
Change-Id: I1bb23b4d1cee0479926a0c521b59593fd43a5d3d
Signed-off-by: yuseok.jeon <yuseok.jeon@samsung.com>
src/manager/common/client-key-impl.cpp

index 684049a..9d960a5 100644 (file)
@@ -60,7 +60,7 @@ KeyImpl& KeyImpl::operator=(KeyImpl &&second) {
 KeyImpl::KeyImpl(const RawBuffer &data, KeyType type, const std::string &password)
   : m_type(KeyType::KEY_NONE)
 {
-    int size = 0;
+    int ret = 0;
     RSA *rsa = NULL;
     char *pass = NULL;
     std::string passtmp(password);
@@ -97,14 +97,14 @@ KeyImpl::KeyImpl(const RawBuffer &data, KeyType type, const std::string &passwor
     BIO *bio = BIO_new(BIO_s_mem());
 
     if (type == KeyType::KEY_RSA_PUBLIC) {
-        size = i2d_RSAPublicKey_bio(bio, rsa);
+        ret = i2d_RSAPublicKey_bio(bio, rsa);
     } else {
-        size = i2d_RSAPrivateKey_bio(bio, rsa);
+        ret = i2d_RSAPrivateKey_bio(bio, rsa);
     }
 
-    if (size > 0) {
-        m_key.resize(size);
-        BIO_read(bio, m_key.data(), m_key.size());
+    if (ret > 0) {
+        m_key.resize(data.size());
+        BIO_read(bio, m_key.data(), data.size());
         m_type = type;
     }
     BIO_free_all(bio);