From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751429Ab1ITOZT (ORCPT ); Tue, 20 Sep 2011 10:25:19 -0400 Received: from e32.co.us.ibm.com ([32.97.110.150]:58311 "EHLO e32.co.us.ibm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750797Ab1ITOZP (ORCPT ); Tue, 20 Sep 2011 10:25:15 -0400 Subject: Re: [PATCH 2/3] trusted-keys: check hex2bin result From: Mimi Zohar To: Andy Shevchenko Cc: linux-security-module@vger.kernel.org, Tetsuo Handa , linux-kernel@vger.kernel.org, Andrew Morton , James Morris , David Safford In-Reply-To: References: <1316524505-27272-1-git-send-email-zohar@linux.vnet.ibm.com> <1316524505-27272-2-git-send-email-zohar@linux.vnet.ibm.com> Content-Type: text/plain; charset="UTF-8" Date: Tue, 20 Sep 2011 10:12:40 -0400 Message-ID: <1316527960.3189.9.camel@localhost.localdomain> Mime-Version: 1.0 X-Mailer: Evolution 2.30.3 (2.30.3-1.fc13) Content-Transfer-Encoding: 7bit x-cbid: 11092014-3270-0000-0000-0000004C6A81 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 2011-09-20 at 16:57 +0300, Andy Shevchenko wrote: > On Tue, Sep 20, 2011 at 4:15 PM, Mimi Zohar wrote: > > From: Tetsuo Handa > > > > For each hex2bin call in trusted keys, check that the ascii hex string is > > valid. On failure, return -EINVAL. > > > > Signed-off-by: Tetsuo Handa > > Signed-off-by: Mimi Zohar > > --- > > security/keys/trusted.c | 15 +++++++++++---- > > 1 files changed, 11 insertions(+), 4 deletions(-) > > > > diff --git a/security/keys/trusted.c b/security/keys/trusted.c > > index 0c33e2e..9b847e1 100644 > > --- a/security/keys/trusted.c > > +++ b/security/keys/trusted.c > > @@ -779,7 +779,9 @@ 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); > > + if (!hex2bin(opt->pcrinfo, args[0].from, > > + opt->pcrinfo_len)) > > + return -EINVAL; > if (hex2bin(...) < 0) > > Everywhere in Patch 2 and 3. thanks, Mimi