summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStef Walter <stef@thewalter.net>2013-07-03 12:45:11 +0200
committerStef Walter <stef@thewalter.net>2013-07-03 12:45:11 +0200
commit4bbb7038816d3664c92cb442e3d1ccac8f92f83c (patch)
treed7df8046074b59bd386ea95ecf3eb917c59ffe58
parent6f212d25c6e03705d58137a2ffa0ccb59bf944ff (diff)
trust: Correctly handle persisting OIDs with zero length
-rw-r--r--trust/persist.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/trust/persist.c b/trust/persist.c
index 0e98b46..f70240a 100644
--- a/trust/persist.c
+++ b/trust/persist.c
@@ -39,6 +39,7 @@
#include "constants.h"
#include "debug.h"
#include "lexer.h"
+#include "message.h"
#include "pem.h"
#include "persist.h"
#include "pkcs11.h"
@@ -445,7 +446,7 @@ format_oid (p11_persist *persist,
int len;
int ret;
- if (attr->type != CKA_OBJECT_ID)
+ if (attr->type != CKA_OBJECT_ID || attr->ulValueLen == 0)
return false;
if (!persist->asn1_defs) {
@@ -466,7 +467,7 @@ format_oid (p11_persist *persist,
ret = asn1_der_decoding (&asn, attr->pValue, attr->ulValueLen, message);
if (ret != ASN1_SUCCESS) {
- p11_debug_precond ("invalid oid value: %s", message);
+ p11_message ("invalid oid value: %s", message);
return false;
}