summaryrefslogtreecommitdiff
path: root/libudev
diff options
context:
space:
mode:
authorFlorian Zumbiehl <florz@florz.de>2009-09-01 12:38:16 +0200
committerKay Sievers <kay.sievers@vrfy.org>2009-09-01 12:38:16 +0200
commit32ecabb15d76bd9db8f7d15dcd39807383a93934 (patch)
treefeeafc722a31102dda7aed9b64bf088097090164 /libudev
parent9257ecfc191ede0029e3486fd50c85b080927d0b (diff)
util_resolve_sys_link(): fix possible buffer overflow
Diffstat (limited to 'libudev')
-rw-r--r--libudev/libudev-util.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libudev/libudev-util.c b/libudev/libudev-util.c
index dcc4a0fd16..61cd963421 100644
--- a/libudev/libudev-util.c
+++ b/libudev/libudev-util.c
@@ -56,13 +56,13 @@ int util_resolve_sys_link(struct udev *udev, char *syspath, size_t size)
{
char link_target[UTIL_PATH_SIZE];
- int len;
+ ssize_t len;
int i;
int back;
char *base;
len = readlink(syspath, link_target, sizeof(link_target));
- if (len <= 0)
+ if (len <= 0 || len == (ssize_t)sizeof(link_target))
return -1;
link_target[len] = '\0';
dbg(udev, "path link '%s' points to '%s'\n", syspath, link_target);