diff options
author | Chris Leech <cleech@redhat.com> | 2019-10-30 11:29:56 -0700 |
---|---|---|
committer | Chris Leech <cleech@redhat.com> | 2019-10-31 15:48:08 -0700 |
commit | c03fbc1a112d3f808512351a62f4c5f593694003 (patch) | |
tree | fa18ec6c3b1bdf8b7f50a551cec96907aee53a99 | |
parent | 0db12353efea69309a6a92f30f4e063b142359c4 (diff) | |
download | open-iscsi-c03fbc1a112d3f808512351a62f4c5f593694003.tar.gz |
Out-of-bounds write: Overrunning array link_target
-rw-r--r-- | usr/sysfs.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/usr/sysfs.c b/usr/sysfs.c index b3102f0..2488160 100644 --- a/usr/sysfs.c +++ b/usr/sysfs.c @@ -225,7 +225,7 @@ struct sysfs_device *sysfs_device_get(const char *devpath) strlcpy(link_path, sysfs_path, sizeof(link_path)); strlcat(link_path, dev->devpath, sizeof(link_path)); strlcat(link_path, "/subsystem", 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) { /* get subsystem from "subsystem" link */ link_target[len] = '\0'; @@ -255,7 +255,7 @@ struct sysfs_device *sysfs_device_get(const char *devpath) strlcpy(link_path, sysfs_path, sizeof(link_path)); strlcat(link_path, dev->devpath, sizeof(link_path)); strlcat(link_path, "/driver", 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) { link_target[len] = '\0'; dbg("driver link '%s' points to '%s'", link_path, link_target); @@ -363,7 +363,7 @@ char *sysfs_attr_get_value(const char *devpath, const char *attr_name) int len; const char *pos; - len = readlink(path_full, link_target, sizeof(link_target)); + len = readlink(path_full, link_target, sizeof(link_target) - 1); if (len > 0) { link_target[len] = '\0'; pos = strrchr(link_target, '/'); |