aboutsummaryrefslogtreecommitdiffstats
path: root/libqpdf/QPDF_encryption.cc
diff options
context:
space:
mode:
authorm-holger <m-holger@kubitscheck.org>2023-11-16 17:26:04 +0100
committerm-holger <m-holger@kubitscheck.org>2023-11-18 17:34:17 +0100
commit3237ef70fb77ce323394de1e2793abdb5ae85384 (patch)
tree2b8e132b26017507db151174944651741d3b71d1 /libqpdf/QPDF_encryption.cc
parentd11622b6fd8a2d050414c3e6110f3ad68f7502af (diff)
downloadqpdf-3237ef70fb77ce323394de1e2793abdb5ae85384.tar.zst
Add new method Pl_Buffer::getString
Diffstat (limited to 'libqpdf/QPDF_encryption.cc')
-rw-r--r--libqpdf/QPDF_encryption.cc9
1 files changed, 3 insertions, 6 deletions
diff --git a/libqpdf/QPDF_encryption.cc b/libqpdf/QPDF_encryption.cc
index b5cc44ee..d405b4dd 100644
--- a/libqpdf/QPDF_encryption.cc
+++ b/libqpdf/QPDF_encryption.cc
@@ -229,13 +229,11 @@ process_with_aes(
aes.writeString(data);
}
aes.finish();
- auto bufp = buffer.getBufferSharedPointer();
if (outlength == 0) {
- outlength = bufp->getSize();
+ return buffer.getString();
} else {
- outlength = std::min(outlength, bufp->getSize());
+ return buffer.getString().substr(0, outlength);
}
- return {reinterpret_cast<char*>(bufp->getBuffer()), outlength};
}
static std::string
@@ -1021,8 +1019,7 @@ QPDF::decryptString(std::string& str, QPDFObjGen const& og)
key.length());
pl.writeString(str);
pl.finish();
- auto buf = bufpl.getBufferSharedPointer();
- str = std::string(reinterpret_cast<char*>(buf->getBuffer()), buf->getSize());
+ str = bufpl.getString();
} else {
QTC::TC("qpdf", "QPDF_encryption rc4 decode string");
size_t vlen = str.length();