netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Ahern <dsahern@gmail.com>
To: Andrea Claudi <aclaudi@redhat.com>,
	netdev@vger.kernel.org, Tuong Lien <tuong.t.lien@dektech.com.au>
Cc: stephen@networkplumber.org
Subject: Re: [PATCH iproute2 1/2] tipc: bail out if algname is abnormally long
Date: Mon, 3 May 2021 08:50:48 -0600	[thread overview]
Message-ID: <2448f15e-7813-f754-dbac-3b870d6ae87b@gmail.com> (raw)
In-Reply-To: <0615f30dc0e11d25d61b48a65dfcb9e9f1136188.1619886329.git.aclaudi@redhat.com>

[ cc author of Fixes commit ]

On 5/1/21 10:32 AM, Andrea Claudi wrote:
> tipc segfaults when called with an abnormally long algname:
> 
> $ tipc node set key 0x1234 algname supercalifragilistichespiralidososupercalifragilistichespiralidoso
> *** buffer overflow detected ***: terminated
> 
> Fix this returning an error if provided algname is longer than
> TIPC_AEAD_ALG_NAME.
> 
> Fixes: 24bee3bf9752 ("tipc: add new commands to set TIPC AEAD key")
> Signed-off-by: Andrea Claudi <aclaudi@redhat.com>
> ---
>  tipc/node.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/tipc/node.c b/tipc/node.c
> index ae75bfff..bf592a07 100644
> --- a/tipc/node.c
> +++ b/tipc/node.c
> @@ -236,10 +236,15 @@ get_ops:
>  
>  	/* Get algorithm name, default: "gcm(aes)" */
>  	opt_algname = get_opt(opts, "algname");
> -	if (!opt_algname)
> +	if (!opt_algname) {
>  		strcpy(input.key.alg_name, "gcm(aes)");
> -	else
> +	} else {
> +		if (strlen(opt_algname->val) > TIPC_AEAD_ALG_NAME) {
> +			fprintf(stderr, "error, invalid algname\n");
> +			return -EINVAL;
> +		}
>  		strcpy(input.key.alg_name, opt_algname->val);
> +	}
>  
>  	/* Get node identity */
>  	opt_nodeid = get_opt(opts, "nodeid");
> 


  reply	other threads:[~2021-05-03 14:50 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-01 16:32 [PATCH iproute2 0/2] tipc: input validation Andrea Claudi
2021-05-01 16:32 ` [PATCH iproute2 1/2] tipc: bail out if algname is abnormally long Andrea Claudi
2021-05-03 14:50   ` David Ahern [this message]
2021-05-09 22:10   ` David Ahern
2021-05-01 16:32 ` [PATCH iproute2 2/2] tipc: bail out if key " Andrea Claudi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2448f15e-7813-f754-dbac-3b870d6ae87b@gmail.com \
    --to=dsahern@gmail.com \
    --cc=aclaudi@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=stephen@networkplumber.org \
    --cc=tuong.t.lien@dektech.com.au \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).