linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] snic: correctly check for array overrun on overly long version number
@ 2016-02-25 22:58 Colin King
  2016-03-01  5:33 ` Seymour, Shane M
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Colin King @ 2016-02-25 22:58 UTC (permalink / raw)
  To: Narsimhulu Musini, Sesidhar Baddela, James E . J . Bottomley,
	Martin K . Petersen, linux-scsi
  Cc: linux-kernel

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');
-- 
2.7.0

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-03-02  8:54 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2016-03-02  1:09 ` Martin K. Petersen
2016-03-02  8:54 ` Narsimhulu Musini (nmusini)

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).