chiark / gitweb /
more readlink buffer size handling
[elogind.git] / udev / udev-node.c
index 2a2c2cf0b46409de1af626d69032e5c7451b8d96..5c1b04b86c88bb150899c8c8e46d121379538c04 100644 (file)
@@ -164,7 +164,7 @@ static int node_symlink(struct udev *udev, const char *node, const char *slink)
 
                        dbg(udev, "found existing symlink '%s'\n", slink);
                        len = readlink(slink, buf, sizeof(buf));
-                       if (len > 0) {
+                       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",