All of lore.kernel.org
 help / color / mirror / Atom feed
From: Denis Kirjanov <dkirjanov@suse.de>
To: "jiangheng (H)" <jiangheng12@huawei.com>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>
Cc: "Chenxiang (EulerOS)" <rose.chen@huawei.com>
Subject: Re: [PATCH iproute2] lnstat:fix buffer overflow in lnstat lnstat segfaults when called the following command: $ lnstat -w 1
Date: Mon, 15 Nov 2021 16:36:43 +0300	[thread overview]
Message-ID: <9ca467b0-0f6e-81ec-c629-69f35cdce542@suse.de> (raw)
In-Reply-To: <6cc4b6c9c31e49508c07df7334831a73@huawei.com>



11/15/21 2:27 PM, jiangheng (H) пишет:
>  From d797c268003919f6e83c1bbdccebf62805dc2581 Mon Sep 17 00:00:00 2001
> From: jiangheng <jiangheng12@huawei.com>
> Date: Thu, 11 Nov 2021 18:20:26 +0800
> Subject: [PATCH iproute2] lnstat:fix buffer overflow in lnstat lnstat
Please adjust the subject line (lnstat is typed twice)

> segfaults when called the following command: $ lnstat -w 1
> 
> [root@pm-104 conf.d]# lnstat -w 1
> Segmentation fault (core dumped)
> 
> The maximum  value of th.num_lines is HDR_LINES(10),  h should not be equal to th.num_lines, array th.hdr may be out of bounds.
> 
> Signed-off-by jiangheng <jiangheng12@huawei.com>
> ---
> misc/lnstat.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/misc/lnstat.c b/misc/lnstat.c
> index 89cb0e7e..26be852d 100644
> --- a/misc/lnstat.c
> +++ b/misc/lnstat.c
> @@ -211,7 +211,7 @@ static struct table_hdr *build_hdr_string(struct lnstat_file *lnstat_files,
>   		ofs += width+1;
>   	}
>   	/* fill in spaces */
> -	for (h = 1; h <= th.num_lines; h++) {
> +	for (h = 1; h < th.num_lines; h++) {
>   		for (i = 0; i < ofs; i++) {
>   			if (th.hdr[h][i] == '\0')
>   				th.hdr[h][i] = ' ';
> --
> 2.27.0
> 

      reply	other threads:[~2021-11-15 13:36 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-15 11:27 [PATCH iproute2] lnstat:fix buffer overflow in lnstat lnstat segfaults when called the following command: $ lnstat -w 1 jiangheng (H)
2021-11-15 13:36 ` Denis Kirjanov [this message]

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=9ca467b0-0f6e-81ec-c629-69f35cdce542@suse.de \
    --to=dkirjanov@suse.de \
    --cc=jiangheng12@huawei.com \
    --cc=netdev@vger.kernel.org \
    --cc=rose.chen@huawei.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.