From: Ewan Milne <emilne@redhat.com>
To: Colin King <colin.king@canonical.com>
Cc: Narsimhulu Musini <nmusini@cisco.com>,
Sesidhar Baddela <sebaddel@cisco.com>,
"James E . J . Bottomley" <JBottomley@odin.com>,
"Martin K . Petersen" <martin.petersen@oracle.com>,
linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] snic: correctly check for array overrun on overly long version number
Date: Tue, 01 Mar 2016 12:29:38 -0500 [thread overview]
Message-ID: <1456853378.16707.46.camel@localhost.localdomain> (raw)
In-Reply-To: <1456441105-19042-1-git-send-email-colin.king@canonical.com>
On Thu, 2016-02-25 at 22:58 +0000, Colin King wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> The snic version number is expected to be 4 decimals in the form like
> a netmask string with each number stored in an element in array v.
> However, there is an off-by-one check on the number of elements in v
> allowing one to pass a 5 decimal version number causing v[4] to be
> referenced, causing a buffer overrun. Fix the off-by-one error by
> comparing to i > 3 rather than 4.
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
> drivers/scsi/snic/snic_ctl.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/scsi/snic/snic_ctl.c b/drivers/scsi/snic/snic_ctl.c
> index aebe753..ab0e06b 100644
> --- a/drivers/scsi/snic/snic_ctl.c
> +++ b/drivers/scsi/snic/snic_ctl.c
> @@ -75,7 +75,7 @@ snic_ver_enc(const char *s)
> continue;
> }
>
> - if (i > 4 || !isdigit(c))
> + if (i > 3 || !isdigit(c))
> goto end;
>
> v[i] = v[i] * 10 + (c - '0');
int v[4] = {0};
So clearly the i > 4 test is wrong and should be i > 3.
Reviewed-by: Ewan D. Milne <emilne@redhat.com>
next prev parent reply other threads:[~2016-03-01 17:29 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-25 22:58 [PATCH] snic: correctly check for array overrun on overly long version number Colin King
2016-03-01 5:33 ` Seymour, Shane M
2016-03-01 17:29 ` Ewan Milne [this message]
2016-03-02 1:09 ` Martin K. Petersen
2016-03-02 8:54 ` Narsimhulu Musini (nmusini)
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=1456853378.16707.46.camel@localhost.localdomain \
--to=emilne@redhat.com \
--cc=JBottomley@odin.com \
--cc=colin.king@canonical.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=martin.petersen@oracle.com \
--cc=nmusini@cisco.com \
--cc=sebaddel@cisco.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 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).