Commit f506b8bc authored by Albert Astals Cid's avatar Albert Astals Cid

Fix handling of Signature Info Location and Reason

We can't call GooString->getCString and just store that char *
as it belonged to us since it may very well be the inner array
of the GooString and be invalid once the GooString goes away
parent 7418616d
Pipeline #3993 passed with stage
in 4 minutes and 24 seconds
......@@ -5,7 +5,7 @@
// This file is licensed under the GPLv2 or later
//
// Copyright 2006-2008 Julien Rebetez <julienr@svn.gnome.org>
// Copyright 2007-2012, 2015-2017 Albert Astals Cid <aacid@kde.org>
// Copyright 2007-2012, 2015-2018 Albert Astals Cid <aacid@kde.org>
// Copyright 2007-2008, 2011 Carlos Garcia Campos <carlosgc@gnome.org>
// Copyright 2007, 2013, 2016 Adrian Johnson <ajohnson@redneon.com>
// Copyright 2007 Iñigo Martínez <inigomartinez@gmail.com>
......@@ -1638,12 +1638,12 @@ void FormFieldSignature::parseInfo()
const Object location_obj = sig_dict.dictLookup("Location");
if (location_obj.isString()) {
signature_info->setLocation(location_obj.getString()->copy()->getCString());
signature_info->setLocation(location_obj.getString()->getCString());
}
const Object reason_obj = sig_dict.dictLookup("Reason");
if (reason_obj.isString()) {
signature_info->setReason(reason_obj.getString()->copy()->getCString());
signature_info->setReason(reason_obj.getString()->getCString());
}
// retrieve SigningTime
......
......@@ -127,16 +127,16 @@ void SignatureInfo::setSubjectDN(const char *subjectDN)
subject_dn = strdup(subjectDN);
}
void SignatureInfo::setLocation(char *loc)
void SignatureInfo::setLocation(const char *loc)
{
free(location);
location = loc;
location = strdup(loc);
}
void SignatureInfo::setReason(char *signingReason)
void SignatureInfo::setReason(const char *signingReason)
{
free(reason);
reason = signingReason;
reason = strdup(signingReason);
}
void SignatureInfo::setHashAlgorithm(int type)
......
......@@ -61,8 +61,8 @@ public:
void setCertificateValStatus(enum CertificateValidationStatus );
void setSignerName(char *);
void setSubjectDN(const char *);
void setLocation(char *);
void setReason(char *);
void setLocation(const char *);
void setReason(const char *);
void setHashAlgorithm(int);
void setSigningTime(time_t);
void setSubFilterSupport(bool isSupported) { sig_subfilter_supported = isSupported; }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment