summaryrefslogtreecommitdiff
path: root/source3/smbd/notify_inotify.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2010-04-19 13:42:55 -0700
committerJeremy Allison <jra@samba.org>2010-04-19 14:35:33 -0700
commiteacf5b235dd27ef844ebee80ded37ec7ecdf8ab2 (patch)
tree79b47258f5ab21b6f21c9f6c89480ce68680bfd1 /source3/smbd/notify_inotify.c
parent4fc59089c81b251b4fab17f170e96bd6dac02490 (diff)
downloadsamba-eacf5b235dd27ef844ebee80ded37ec7ecdf8ab2.tar.gz
samba-eacf5b235dd27ef844ebee80ded37ec7ecdf8ab2.tar.bz2
samba-eacf5b235dd27ef844ebee80ded37ec7ecdf8ab2.zip
Fix valgrind error where a strdup of name reads one byte beyond the end. Ensure buffer returned from inotify is null terminated.
Jeremy.
Diffstat (limited to 'source3/smbd/notify_inotify.c')
-rw-r--r--source3/smbd/notify_inotify.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/source3/smbd/notify_inotify.c b/source3/smbd/notify_inotify.c
index 61599456c6..b1d424d7f1 100644
--- a/source3/smbd/notify_inotify.c
+++ b/source3/smbd/notify_inotify.c
@@ -246,8 +246,9 @@ static void inotify_handler(struct event_context *ev, struct fd_event *fde,
return;
}
- e0 = e = (struct inotify_event *)TALLOC_SIZE(in, bufsize);
+ e0 = e = (struct inotify_event *)TALLOC_SIZE(in, bufsize + 1);
if (e == NULL) return;
+ ((uint8_t *)e)[bufsize] = '\0';
status = read_data(in->fd, (char *)e0, bufsize);
if (!NT_STATUS_IS_OK(status)) {