summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNick Hainke <vincent@systemli.org>2021-08-31 11:09:19 +0200
committerDaniel Golle <daniel@makrotopia.org>2021-08-31 12:24:14 +0100
commit773e8da41532b23888511cd864fbd251ecadc577 (patch)
tree424b24a9a7c3c5271aedb3edfd0d76a5a1279444
parent20adf538b33c9b38b7ca3951f3c2ff4192e57660 (diff)
downloadprocd-773e8da41532b23888511cd864fbd251ecadc577.tar.gz
initd: fix off-by-one error in mkdev.c
Substract 1 from bufsize so len can not be out of bounds. Same hanling as in "udevtrigger.c" in "sysfs_resolve_link". Replaces: 8eb1d783 Coverity CID: 1330087 Readlink used insecurely Signed-off-by: Nick Hainke <vincent@systemli.org>
-rw-r--r--initd/mkdev.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/initd/mkdev.c b/initd/mkdev.c
index 44101aa..f0a1e84 100644
--- a/initd/mkdev.c
+++ b/initd/mkdev.c
@@ -82,7 +82,7 @@ static void find_devs(bool block)
continue;
strcpy(path, dp->d_name);
- len = readlink(buf2, buf, sizeof(buf));
+ len = readlink(buf2, buf, sizeof(buf) - 1);
if (len <= 0)
continue;