From f18b9b05b57875fea9aa133621f09730ff409a20 Mon Sep 17 00:00:00 2001 From: Mimi Zohar Date: Tue, 20 Sep 2011 11:23:52 -0400 Subject: [PATCH] --- yaml --- r: 264553 b: refs/heads/master c: 2684bf7f29cfb13ef2c60f3b3a53ee47d0db7022 h: refs/heads/master i: 264551: bc719f83446738332c311d8af75b12eb9e3c4438 v: v3 --- [refs] | 2 +- trunk/security/keys/trusted.c | 19 +++++++++++++++---- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/[refs] b/[refs] index 7070268f6495..1389102402f4 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: b78049831ffed65f0b4e61f69df14f3ab17922cb +refs/heads/master: 2684bf7f29cfb13ef2c60f3b3a53ee47d0db7022 diff --git a/trunk/security/keys/trusted.c b/trunk/security/keys/trusted.c index 0c33e2ea1f3c..0964fc236946 100644 --- a/trunk/security/keys/trusted.c +++ b/trunk/security/keys/trusted.c @@ -779,7 +779,10 @@ static int getoptions(char *c, struct trusted_key_payload *pay, opt->pcrinfo_len = strlen(args[0].from) / 2; if (opt->pcrinfo_len > MAX_PCRINFO_SIZE) return -EINVAL; - hex2bin(opt->pcrinfo, args[0].from, opt->pcrinfo_len); + res = hex2bin(opt->pcrinfo, args[0].from, + opt->pcrinfo_len); + if (res < 0) + return -EINVAL; break; case Opt_keyhandle: res = strict_strtoul(args[0].from, 16, &handle); @@ -791,12 +794,18 @@ static int getoptions(char *c, struct trusted_key_payload *pay, case Opt_keyauth: if (strlen(args[0].from) != 2 * SHA1_DIGEST_SIZE) return -EINVAL; - hex2bin(opt->keyauth, args[0].from, SHA1_DIGEST_SIZE); + res = hex2bin(opt->keyauth, args[0].from, + SHA1_DIGEST_SIZE); + if (res < 0) + return -EINVAL; break; case Opt_blobauth: if (strlen(args[0].from) != 2 * SHA1_DIGEST_SIZE) return -EINVAL; - hex2bin(opt->blobauth, args[0].from, SHA1_DIGEST_SIZE); + res = hex2bin(opt->blobauth, args[0].from, + SHA1_DIGEST_SIZE); + if (res < 0) + return -EINVAL; break; case Opt_migratable: if (*args[0].from == '0') @@ -860,7 +869,9 @@ static int datablob_parse(char *datablob, struct trusted_key_payload *p, p->blob_len = strlen(c) / 2; if (p->blob_len > MAX_BLOB_SIZE) return -EINVAL; - hex2bin(p->blob, c, p->blob_len); + ret = hex2bin(p->blob, c, p->blob_len); + if (ret < 0) + return -EINVAL; ret = getoptions(datablob, p, o); if (ret < 0) return ret;