summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/account/indication_common.c10
-rw-r--r--src/service-dbus/LMI_ServiceProvider.c2
2 files changed, 9 insertions, 3 deletions
diff --git a/src/account/indication_common.c b/src/account/indication_common.c
index 22391e3..88d16a0 100644
--- a/src/account/indication_common.c
+++ b/src/account/indication_common.c
@@ -159,14 +159,20 @@ bool watcher(AccountIndication *ind, void **data)
do {
int len = 0, i = 0;
- if ((len = read(ind->inotify_fd, buffer, BUF_LEN)) < 0) {
+ if ((len = read(ind->inotify_fd, buffer, BUF_LEN)) < 0 || len > (int) BUF_LEN) {
warn("account watcher: error reading from inotify fd: %s", strerror(errno));
watcher_destroy(ind);
watcher_init(ind);
return false;
}
- while (i < len) {
+ while (i + (ssize_t) EVENT_SIZE < len) {
struct inotify_event *event = (struct inotify_event *) &buffer[i];
+ if (i + (ssize_t) EVENT_SIZE + event->len >= len) {
+ error("Unable to create watcher, inotify initialization failed");
+ watcher_destroy(ind);
+ watcher_init(ind);
+ return false;
+ }
switch (event->mask) {
case IN_MODIFY:
case IN_CLOSE_WRITE:
diff --git a/src/service-dbus/LMI_ServiceProvider.c b/src/service-dbus/LMI_ServiceProvider.c
index eaf5ec5..0bc2e77 100644
--- a/src/service-dbus/LMI_ServiceProvider.c
+++ b/src/service-dbus/LMI_ServiceProvider.c
@@ -63,7 +63,7 @@ static CMPIStatus LMI_ServiceEnumInstanceNames(
LMI_ServiceRef_Set_SystemName(&w, get_system_name());
LMI_ServiceRef_Set_Name(&w, slist->name[i]);
- KReturnObjectPath(cr, w);
+ CMReturnObjectPath(cr, LMI_ServiceRef_ToObjectPath(&w, NULL));
}
service_free_slist(slist);