diff mbox

libkmod-signature: pkcs#7: fix crash when signer info is not present.

Message ID 20180608171015.2211-1-msuchanek@suse.de (mailing list archive)
State New, archived
Headers show

Commit Message

Michal Suchánek June 8, 2018, 5:10 p.m. UTC
Reported-by: Kazuya Saito <saito.kazuya@jp.fujitsu.com>
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
---
 libkmod/libkmod-signature.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Lucas De Marchi June 11, 2018, 5:12 p.m. UTC | #1
On Fri, Jun 8, 2018 at 10:10 AM Michal Suchanek <msuchanek@suse.de> wrote:
>
> Reported-by: Kazuya Saito <saito.kazuya@jp.fujitsu.com>
> Signed-off-by: Michal Suchanek <msuchanek@suse.de>
> ---
>  libkmod/libkmod-signature.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/libkmod/libkmod-signature.c b/libkmod/libkmod-signature.c
> index fae074e6dd1d..782e96f69fef 100644
> --- a/libkmod/libkmod-signature.c
> +++ b/libkmod/libkmod-signature.c
> @@ -166,7 +166,7 @@ kmod_module_signature_info_pkcs7(const char *mem,

What's this based on? There's no such function in upstream


Lucas De Marchi

>         sig_info->key_id_len = cert->key_id_size;
>
>         sig_info->signer = cert->signer;
> -       sig_info->signer_len = strlen(cert->signer);
> +       sig_info->signer_len = cert->signer ? strlen(cert->signer) : 0;
>
>         sig_info->algo = NULL;
>         sig_info->hash_algo = cert->hash_algo;
> --
> 2.13.6
>
Michal Suchánek June 11, 2018, 5:42 p.m. UTC | #2
On Mon, 11 Jun 2018 10:12:10 -0700
Lucas De Marchi <lucas.de.marchi@gmail.com> wrote:

> On Fri, Jun 8, 2018 at 10:10 AM Michal Suchanek <msuchanek@suse.de>
> wrote:
> >
> > Reported-by: Kazuya Saito <saito.kazuya@jp.fujitsu.com>
> > Signed-off-by: Michal Suchanek <msuchanek@suse.de>
> > ---
> >  libkmod/libkmod-signature.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/libkmod/libkmod-signature.c
> > b/libkmod/libkmod-signature.c index fae074e6dd1d..782e96f69fef
> > 100644 --- a/libkmod/libkmod-signature.c
> > +++ b/libkmod/libkmod-signature.c
> > @@ -166,7 +166,7 @@ kmod_module_signature_info_pkcs7(const char
> > *mem,  
> 
> What's this based on? There's no such function in upstream
> 

The patchset it replies to 

[PATCH RFC PKCS7 asn1c 0/2] asn1c version of PKCS#7 parser
<20180308135810.4309-1-yauheni.kaliuta@redhat.com>

Thanks

Michal
--
To unsubscribe from this list: send the line "unsubscribe linux-modules" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/libkmod/libkmod-signature.c b/libkmod/libkmod-signature.c
index fae074e6dd1d..782e96f69fef 100644
--- a/libkmod/libkmod-signature.c
+++ b/libkmod/libkmod-signature.c
@@ -166,7 +166,7 @@  kmod_module_signature_info_pkcs7(const char *mem,
 	sig_info->key_id_len = cert->key_id_size;
 
 	sig_info->signer = cert->signer;
-	sig_info->signer_len = strlen(cert->signer);
+	sig_info->signer_len = cert->signer ? strlen(cert->signer) : 0;
 
 	sig_info->algo = NULL;
 	sig_info->hash_algo = cert->hash_algo;