From eacf5b235dd27ef844ebee80ded37ec7ecdf8ab2 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Mon, 19 Apr 2010 13:42:55 -0700 Subject: Fix valgrind error where a strdup of name reads one byte beyond the end. Ensure buffer returned from inotify is null terminated. Jeremy. --- source3/smbd/notify_inotify.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'source3/smbd/notify_inotify.c') 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)) { -- cgit