summaryrefslogtreecommitdiff
path: root/key.c
diff options
context:
space:
mode:
Diffstat (limited to 'key.c')
-rw-r--r--key.c13
1 files changed, 4 insertions, 9 deletions
diff --git a/key.c b/key.c
index e4aa25c03..aed4678cb 100644
--- a/key.c
+++ b/key.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: key.c,v 1.90 2010/07/13 23:13:16 djm Exp $ */ 1/* $OpenBSD: key.c,v 1.91 2010/08/31 09:58:37 djm Exp $ */
2/* 2/*
3 * read_bignum(): 3 * read_bignum():
4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland 4 * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland
@@ -1067,7 +1067,7 @@ cert_parse(Buffer *b, Key *key, const u_char *blob, u_int blen)
1067 principals = exts = critical = sig_key = sig = NULL; 1067 principals = exts = critical = sig_key = sig = NULL;
1068 if ((!v00 && buffer_get_int64_ret(&key->cert->serial, b) != 0) || 1068 if ((!v00 && buffer_get_int64_ret(&key->cert->serial, b) != 0) ||
1069 buffer_get_int_ret(&key->cert->type, b) != 0 || 1069 buffer_get_int_ret(&key->cert->type, b) != 0 ||
1070 (key->cert->key_id = buffer_get_string_ret(b, &kidlen)) == NULL || 1070 (key->cert->key_id = buffer_get_cstring_ret(b, &kidlen)) == NULL ||
1071 (principals = buffer_get_string_ret(b, &plen)) == NULL || 1071 (principals = buffer_get_string_ret(b, &plen)) == NULL ||
1072 buffer_get_int64_ret(&key->cert->valid_after, b) != 0 || 1072 buffer_get_int64_ret(&key->cert->valid_after, b) != 0 ||
1073 buffer_get_int64_ret(&key->cert->valid_before, b) != 0 || 1073 buffer_get_int64_ret(&key->cert->valid_before, b) != 0 ||
@@ -1105,15 +1105,10 @@ cert_parse(Buffer *b, Key *key, const u_char *blob, u_int blen)
1105 error("%s: Too many principals", __func__); 1105 error("%s: Too many principals", __func__);
1106 goto out; 1106 goto out;
1107 } 1107 }
1108 if ((principal = buffer_get_string_ret(&tmp, &plen)) == NULL) { 1108 if ((principal = buffer_get_cstring_ret(&tmp, &plen)) == NULL) {
1109 error("%s: Principals data invalid", __func__); 1109 error("%s: Principals data invalid", __func__);
1110 goto out; 1110 goto out;
1111 } 1111 }
1112 if (strlen(principal) != plen) {
1113 error("%s: Principal contains \\0 character",
1114 __func__);
1115 goto out;
1116 }
1117 key->cert->principals = xrealloc(key->cert->principals, 1112 key->cert->principals = xrealloc(key->cert->principals,
1118 key->cert->nprincipals + 1, sizeof(*key->cert->principals)); 1113 key->cert->nprincipals + 1, sizeof(*key->cert->principals));
1119 key->cert->principals[key->cert->nprincipals++] = principal; 1114 key->cert->principals[key->cert->nprincipals++] = principal;
@@ -1200,7 +1195,7 @@ key_from_blob(const u_char *blob, u_int blen)
1200#endif 1195#endif
1201 buffer_init(&b); 1196 buffer_init(&b);
1202 buffer_append(&b, blob, blen); 1197 buffer_append(&b, blob, blen);
1203 if ((ktype = buffer_get_string_ret(&b, NULL)) == NULL) { 1198 if ((ktype = buffer_get_cstring_ret(&b, NULL)) == NULL) {
1204 error("key_from_blob: can't read key type"); 1199 error("key_from_blob: can't read key type");
1205 goto out; 1200 goto out;
1206 } 1201 }