Blame SOURCES/fcoe-utils-v1.0.31-2-fcoeadm-Fix-possible-buffer-overflows.patch

d5ef94
From 5dfd3e4fab6cc4261112ad6a6839d4eb584cacfc Mon Sep 17 00:00:00 2001
d5ef94
From: Johannes Thumshirn <jthumshirn@suse.de>
d5ef94
Date: Wed, 15 Jun 2016 22:47:41 +0000
d5ef94
Subject: [PATCH] fcoeadm: Fix possible buffer overflows
d5ef94
d5ef94
Fix 3 possible buffer overflows when strncat()ing strings together.
d5ef94
d5ef94
Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
d5ef94
Signed-off-by: Vasu Dev <vasu.dev@intel.com>
d5ef94
---
d5ef94
 fcoeadm_display.c | 6 +++---
d5ef94
 1 file changed, 3 insertions(+), 3 deletions(-)
d5ef94
d5ef94
diff --git a/fcoeadm_display.c b/fcoeadm_display.c
d5ef94
index 16ccb6b..7b95aa4 100644
d5ef94
--- a/fcoeadm_display.c
d5ef94
+++ b/fcoeadm_display.c
d5ef94
@@ -267,13 +267,13 @@ static void show_full_lun_info(unsigned int hba, unsigned int port,
d5ef94
 	if (!port_attrs)
d5ef94
 		goto free_rport;
d5ef94
 
d5ef94
-	strncat(path, "/device/", sizeof(path));
d5ef94
+	strncat(path, "/device/", sizeof(path) - strlen(path) - 1);
d5ef94
 
d5ef94
 	sa_sys_read_line(path, "rev", rev, sizeof(rev));
d5ef94
 	sa_sys_read_line(path, "model", model, sizeof(model));
d5ef94
 	sa_sys_read_line(path, "vendor", vendor, sizeof(vendor));
d5ef94
 
d5ef94
-	strncat(path, "block", sizeof(path));
d5ef94
+	strncat(path, "block", sizeof(path) - strlen(path) - 1);
d5ef94
 
d5ef94
 	dir = opendir(path);
d5ef94
 	if (!dir)
d5ef94
@@ -349,7 +349,7 @@ static void show_short_lun_info(unsigned int hba, unsigned int port,
d5ef94
 	sa_sys_read_line(path, "model", model, sizeof(model));
d5ef94
 	sa_sys_read_line(path, "vendor", vendor, sizeof(vendor));
d5ef94
 
d5ef94
-	strncat(path, "block", sizeof(path));
d5ef94
+	strncat(path, "block", sizeof(path) - strlen(path) - 1);
d5ef94
 
d5ef94
 	dir = opendir(path);
d5ef94
 	if (!dir)
d5ef94
-- 
d5ef94
2.5.5
d5ef94