aboutsummaryrefslogtreecommitdiffstats
path: root/src/libstrongswan/plugins/pem/pem_builder.c
diff options
context:
space:
mode:
authorAndreas Steffen <andreas.steffen@strongswan.org>2012-10-07 17:07:35 +0200
committerAndreas Steffen <andreas.steffen@strongswan.org>2012-10-07 17:07:35 +0200
commit7f5675c8e5a1131b7ac12c0724c374f4def9a0f7 (patch)
tree74dfb70bdff370cab970e010e650a7c7580ed0ec /src/libstrongswan/plugins/pem/pem_builder.c
parent41d344e8ea18fe06a4e0a4ea607e89208e3069eb (diff)
downloadstrongswan-7f5675c8e5a1131b7ac12c0724c374f4def9a0f7.tar.bz2
strongswan-7f5675c8e5a1131b7ac12c0724c374f4def9a0f7.tar.xz
check length of hex-encoded IV
Diffstat (limited to 'src/libstrongswan/plugins/pem/pem_builder.c')
-rw-r--r--src/libstrongswan/plugins/pem/pem_builder.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/libstrongswan/plugins/pem/pem_builder.c b/src/libstrongswan/plugins/pem/pem_builder.c
index 9b9777031..eefb2eb48 100644
--- a/src/libstrongswan/plugins/pem/pem_builder.c
+++ b/src/libstrongswan/plugins/pem/pem_builder.c
@@ -288,8 +288,11 @@ static status_t pem_to_bin(chunk_t *blob, bool *pgp)
" not supported", (int)dek.len, dek.ptr);
return NOT_SUPPORTED;
}
- eat_whitespace(&value);
- iv = chunk_from_hex(value, iv.ptr);
+ if (!eat_whitespace(&value) || value.len > 2*sizeof(iv_buf))
+ {
+ return PARSE_ERROR;
+ }
+ iv = chunk_from_hex(value, iv_buf);
}
}
else /* state is PEM_BODY */