SSH Agent: use SSH_MAX_LOCAL_KEY_SIZE define for cert+key size checks

- Add #define SSH_MAX_LOCAL_KEY_SIZE (1 MiB) in KeeAgentSettings.h
- Replace magic value "1024 * 1024" with this constant
This commit is contained in:
Alexandre Petit 2026-03-09 12:25:29 +01:00
parent b7168f6c4e
commit 3d9ef5c4ed
No known key found for this signature in database
2 changed files with 4 additions and 2 deletions

View file

@ -568,7 +568,7 @@ bool KeeAgentSettings::toOpenSSHKey(const QString& username,
return false;
}
if (localFile.size() > 1024 * 1024) {
if (localFile.size() > SSH_MAX_LOCAL_KEY_SIZE) {
m_error = QCoreApplication::translate("KeeAgentSettings", "File too large to be a private key");
return false;
}
@ -634,7 +634,7 @@ bool KeeAgentSettings::toOpenSSHKey(const QString& username,
return false;
}
if (localCertificateFile.size() > 1024 * 1024) {
if (localCertificateFile.size() > SSH_MAX_LOCAL_KEY_SIZE) {
m_error = QCoreApplication::translate("KeeAgentSettings", "File too large to be a certificate");
return false;
}

View file

@ -21,6 +21,8 @@
#include <QProcessEnvironment>
#define SSH_MAX_LOCAL_KEY_SIZE (1024 * 1024)
class Entry;
class EntryAttachments;
class OpenSSHKey;