diff options
Diffstat (limited to 'udev/udev-node.c')
-rw-r--r-- | udev/udev-node.c | 4 |
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", |