summaryrefslogtreecommitdiff
path: root/udev/udev-node.c
diff options
context:
space:
mode:
authorKay Sievers <kay.sievers@vrfy.org>2010-04-21 14:44:33 +0200
committerKay Sievers <kay.sievers@vrfy.org>2010-04-21 14:44:33 +0200
commit60067cc75ac7dd583beea584f87f2f6d3358f3c1 (patch)
tree79e2b1cc2ebc5d2f7a8c6b99a3b75cf72a4e3719 /udev/udev-node.c
parente925018786d85fb3aed3b62a0a89309f9a7d5e4f (diff)
more readlink buffer size handling
Diffstat (limited to 'udev/udev-node.c')
-rw-r--r--udev/udev-node.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/udev/udev-node.c b/udev/udev-node.c
index ceb1d52ea7..5c1b04b86c 100644
--- a/udev/udev-node.c
+++ b/udev/udev-node.c
@@ -163,8 +163,8 @@ static int node_symlink(struct udev *udev, const char *node, const char *slink)
int len;
dbg(udev, "found existing symlink '%s'\n", slink);
- len = readlink(slink, buf, sizeof(buf) - 1);
- if (len > 0) {
+ len = readlink(slink, buf, sizeof(buf));
+ if (len > 0 && len < (int)sizeof(buf)) {
buf[len] = '\0';
if (strcmp(target, buf) == 0) {
info(udev, "preserve already existing symlink '%s' to '%s'\n",