* Whole class member should be initialized.
* Check INT_MAX size.(overflow)
* Fix memory leak.
Change-Id: I428ef256f2165f7199f601c9b4e6ae503eafeb39
Signed-off-by: sangwan.kwon <sangwan.kwon@samsung.com>
(cherry picked from commit
0145be068295e2e368007fc64fee5d2a8f1a29d2)
Signed-off-by: sangwan.kwon <sangwan.kwon@samsung.com>
result = write_to_ca_cert_crt_file("wb", cert);
else
result = write_to_ca_cert_crt_file("ab", cert);
+ free(cert);
if (result != CERTSVC_SUCCESS) {
SLOGE("Failed to write to file.");
LogDebug(buff);
}
-XmlSec::XmlSec() : m_pList(nullptr)
+XmlSec::XmlSec() :
+ m_mode(ValidateMode::NORMAL),
+ m_pList(nullptr)
{
LIBXML_TEST_VERSION
xmlLoadExtDtdDefaultValue = XML_DETECT_IDS | XML_COMPLETE_ATTRS;
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
+#include <limits.h>
#include <string>
#include <memory>
#include <functional>
fseek(fp, 0L, SEEK_END);
int len = ftell(fp);
- if (len <= 0) {
- LogError("Fail to get certificate length.");
+ if (len <= 0 || len == INT_MAX) {
+ LogError("Fail to get proper certificate.");
return std::string();
}