aboutsummaryrefslogtreecommitdiff
path: root/src/common/crypto_s2k.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/common/crypto_s2k.c')
-rw-r--r--src/common/crypto_s2k.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/common/crypto_s2k.c b/src/common/crypto_s2k.c
index 93c96e74ae..aef8436ad9 100644
--- a/src/common/crypto_s2k.c
+++ b/src/common/crypto_s2k.c
@@ -392,6 +392,9 @@ secret_to_key_new(uint8_t *buf,
type = buf[0];
key_len = secret_to_key_key_len(type);
+ if (key_len < 0)
+ return key_len;
+
if ((int)buf_len < key_len + spec_len)
return S2K_TRUNCATED;