Fix incorrect std::string object usage
Modifed the code to pass string data pointer
instead of the string object reference
Tested:
user password were tested with IPMI
commands and no crash were observed
Signed-off-by: gokulsanker <gokul.sanker.v.g@intel.com>
Change-Id: I12d96965cd8c91d6aa1d925ac55b22f31d08d2fe
diff --git a/user_channel/usercommands.cpp b/user_channel/usercommands.cpp
index 9a23ac3..2ef6b87 100644
--- a/user_channel/usercommands.cpp
+++ b/user_channel/usercommands.cpp
@@ -419,15 +419,15 @@
log<level::DEBUG>("Test password failed",
entry("USER-ID=%d", (uint8_t)req->userId));
// Clear sensitive data
- OPENSSL_cleanse(&testPassword, testPassword.length());
- OPENSSL_cleanse(&password, password.length());
+ OPENSSL_cleanse(testPassword.data(), testPassword.length());
+ OPENSSL_cleanse(password.data(), password.length());
return static_cast<Cc>(
IPMISetPasswordReturnCodes::ipmiCCPasswdFailMismatch);
}
// Clear sensitive data
- OPENSSL_cleanse(&testPassword, testPassword.length());
- OPENSSL_cleanse(&password, password.length());
+ OPENSSL_cleanse(testPassword.data(), testPassword.length());
+ OPENSSL_cleanse(password.data(), password.length());
return ccSuccess;
}