diff mbox

[13/42] Incorrect inquiry vendor length in hds prioritizer

Message ID 1357653259-62650-14-git-send-email-hare@suse.de (mailing list archive)
State Deferred, archived
Headers show

Commit Message

Hannes Reinecke Jan. 8, 2013, 1:53 p.m. UTC
The inquiry vendor length is 8 bytes, but snprintf writes
the given number of bytes _including_ the NULL byte. So
we need to supply a 9 byte buffer here.

Signed-off-by: Hannes Reinecke <hare@suse.de>
---
 libmultipath/prioritizers/hds.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
diff mbox

Patch

diff --git a/libmultipath/prioritizers/hds.c b/libmultipath/prioritizers/hds.c
index 5d75f84..f748707 100644
--- a/libmultipath/prioritizers/hds.c
+++ b/libmultipath/prioritizers/hds.c
@@ -87,7 +87,7 @@ 
 int hds_modular_prio (const char *dev, int fd)
 {
 	int k;
-	char vendor[8];
+	char vendor[9];
 	char product[32];
 	char serial[32];
 	char ldev[32];
@@ -125,7 +125,7 @@  int hds_modular_prio (const char *dev, int fd)
 		return -1;
 	}
 
-	snprintf (vendor, 8, "%.8s", inqBuffp + 8);
+	snprintf (vendor, 9, "%.8s", inqBuffp + 8);
 	snprintf (product, 17, "%.16s", inqBuffp + 16);
 	snprintf (serial, 5, "%.4s", inqBuffp + 40);
 	snprintf (ldev, 5, "%.4s", inqBuffp + 44);