open-iscsi/6008-Buffer-not-null-terminated-Calling-strncpy.patch
2020-01-09 16:49:50 +08:00

28 lines
890 B
Diff

From 26bfa31349c410cacd22f9e8ea2ef4a82b221f13 Mon Sep 17 00:00:00 2001
From: Chris Leech <cleech@redhat.com>
Date: Wed, 30 Oct 2019 11:44:18 -0700
Subject: [PATCH 22/43] Buffer not null terminated: Calling strncpy with a
maximum size argument on destination array might leave the destination string
unterminated
---
usr/iscsi_sysfs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/usr/iscsi_sysfs.c b/usr/iscsi_sysfs.c
index f79a1af..418f51b 100644
--- a/usr/iscsi_sysfs.c
+++ b/usr/iscsi_sysfs.c
@@ -464,7 +464,7 @@ int iscsi_sysfs_get_flashnode_info(struct flashnode_rec *fnode,
log_debug(7, "could not get transport name for host%d",
host_no);
else
- strncpy(fnode->transport_name, t->name,
+ strlcpy(fnode->transport_name, t->name,
ISCSI_TRANSPORT_NAME_MAXLEN);
snprintf(sess_id, sizeof(sess_id), ISCSI_FLASHNODE_SESS, host_no,
--
2.21.0