aboutsummaryrefslogtreecommitdiffstats
path: root/libqpdf/QPDF_encryption.cc
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2022-01-22 23:33:53 +0100
committerJay Berkenbilt <ejb@ql.org>2022-01-30 19:11:03 +0100
commit76c4f78b5cfd786b90069f7256252229444fdecd (patch)
treeb84a4a401b26fc84846343f28c28a91c35e9fa87 /libqpdf/QPDF_encryption.cc
parent67f9d0b7d5857a73c974f5a54cd1abbe65231fce (diff)
downloadqpdf-76c4f78b5cfd786b90069f7256252229444fdecd.tar.zst
Add QUtil::make_shared_cstr
Replace most of the calls to QUtil::copy_string with this instead.
Diffstat (limited to 'libqpdf/QPDF_encryption.cc')
-rw-r--r--libqpdf/QPDF_encryption.cc6
1 files changed, 3 insertions, 3 deletions
diff --git a/libqpdf/QPDF_encryption.cc b/libqpdf/QPDF_encryption.cc
index 9607a598..d5289ad3 100644
--- a/libqpdf/QPDF_encryption.cc
+++ b/libqpdf/QPDF_encryption.cc
@@ -1211,10 +1211,10 @@ QPDF::decryptString(std::string& str, int objid, int generation)
size_t vlen = str.length();
// Using PointerHolder guarantees that tmp will
// be freed even if rc4.process throws an exception.
- PointerHolder<char> tmp(true, QUtil::copy_string(str));
+ auto tmp = QUtil::make_shared_cstr(str);
RC4 rc4(QUtil::unsigned_char_pointer(key), toI(key.length()));
- rc4.process(QUtil::unsigned_char_pointer(tmp.getPointer()), vlen);
- str = std::string(tmp.getPointer(), vlen);
+ rc4.process(QUtil::unsigned_char_pointer(tmp.get()), vlen);
+ str = std::string(tmp.get(), vlen);
}
}
catch (QPDFExc&)