SSH Agent: Check writeString() return value in OpenSSHKey

Validate `stream.writeString(m_certificateType)` success and set m_error on
failure, consistent with other write*() calls. Prevents partial stream writes
This commit is contained in:
Alexandre Petit 2026-03-09 16:36:13 +01:00
parent 963bbd0c17
commit 3f497f2eed
No known key found for this signature in database

View file

@ -724,7 +724,10 @@ bool OpenSSHKey::writeCertificate(BinaryStream& stream, const bool addCertificat
return true;
}
stream.writeString(m_certificateType);
if (!stream.writeString(m_certificateType)) {
m_error = tr("Unexpected EOF when writing certificate");
return false;
}
if (!stream.writeString(m_rawCertificateData)) {
m_error = tr("Unexpected EOF when writing certificate");