open-iscsi/0005-Out-of-bounds-write-Overrunning-array-link_target.patch

26 lines
774 B
Diff
Raw Normal View History

2020-01-09 16:12:53 +08:00
From 007d7832c631409e41bf5c473ca5dc7d114a67cb Mon Sep 17 00:00:00 2001
From: Chris Leech <cleech@redhat.com>
Date: Wed, 30 Oct 2019 11:13:44 -0700
Subject: [PATCH 19/43] Out-of-bounds-write: Overrunning array link_target
---
usr/sysfs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/usr/sysfs.c b/usr/sysfs.c
index 48f3825..b3102f0 100644
--- a/usr/sysfs.c
+++ b/usr/sysfs.c
@@ -134,7 +134,7 @@ int sysfs_resolve_link(char *devpath, size_t size)
strlcpy(link_path, sysfs_path, sizeof(link_path));
strlcat(link_path, devpath, sizeof(link_path));
- len = readlink(link_path, link_target, sizeof(link_target));
+ len = readlink(link_path, link_target, sizeof(link_target) - 1);
if (len <= 0)
return -1;
link_target[len] = '\0';
--
2.21.0