summaryrefslogtreecommitdiff
path: root/src/libstrongswan/plugins/pem/pem_builder.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstrongswan/plugins/pem/pem_builder.c')
-rw-r--r--src/libstrongswan/plugins/pem/pem_builder.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/libstrongswan/plugins/pem/pem_builder.c b/src/libstrongswan/plugins/pem/pem_builder.c
index 9b9777031..08e81b3c5 100644
--- a/src/libstrongswan/plugins/pem/pem_builder.c
+++ b/src/libstrongswan/plugins/pem/pem_builder.c
@@ -27,7 +27,7 @@
#include <sys/mman.h>
#include <sys/stat.h>
-#include <debug.h>
+#include <utils/debug.h>
#include <library.h>
#include <utils/lexparser.h>
#include <asn1/asn1.h>
@@ -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 */