chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
selinux: set context for real file name not the temp name
[elogind.git]
/
udev_sysfs.c
diff --git
a/udev_sysfs.c
b/udev_sysfs.c
index 34ae9ac14fd400758d5d3a618dc527d19a9bbd54..e8909f94f1f6166249fbcad8f571d7c0baa2b790 100644
(file)
--- a/
udev_sysfs.c
+++ b/
udev_sysfs.c
@@
-355,6
+355,8
@@
char *sysfs_attr_get_value(const char *devpath, const char *attr_name)
dbg("open '%s'/'%s'", devpath, attr_name);
sysfs_len = strlcpy(path_full, sysfs_path, sizeof(path_full));
dbg("open '%s'/'%s'", devpath, attr_name);
sysfs_len = strlcpy(path_full, sysfs_path, sizeof(path_full));
+ if(sysfs_len >= sizeof(path_full))
+ sysfs_len = sizeof(path_full) - 1;
path = &path_full[sysfs_len];
strlcat(path_full, devpath, sizeof(path_full));
strlcat(path_full, "/", sizeof(path_full));
path = &path_full[sysfs_len];
strlcat(path_full, devpath, sizeof(path_full));
strlcat(path_full, "/", sizeof(path_full));
@@
-413,7
+415,7
@@
char *sysfs_attr_get_value(const char *devpath, const char *attr_name)
/* read attribute value */
fd = open(path_full, O_RDONLY);
if (fd < 0) {
/* read attribute value */
fd = open(path_full, O_RDONLY);
if (fd < 0) {
- dbg("attribute '%s'
does not exist
", path_full);
+ dbg("attribute '%s'
can not be opened
", path_full);
goto out;
}
size = read(fd, value, sizeof(value));
goto out;
}
size = read(fd, value, sizeof(value));