Fix buffer to which inotify events are read to be large enough,
according to inotify(7) manual page.
---
 src/inotify.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/inotify.c b/src/inotify.c
index 1ab3807..12fcb7d 100644
--- a/src/inotify.c
+++ b/src/inotify.c
@@ -48,7 +48,7 @@ static gboolean inotify_data(GIOChannel *channel, 
GIOCondition cond,
                                                        gpointer user_data)
 {
        struct connman_inotify *inotify = user_data;
-       char buffer[256];
+       char buffer[sizeof(struct inotify_event) + NAME_MAX + 1];
        char *next_event;
        gsize bytes_read;
        GIOStatus status;
@@ -60,7 +60,7 @@ static gboolean inotify_data(GIOChannel *channel, 
GIOCondition cond,
        }
 
        status = g_io_channel_read_chars(channel, buffer,
-                                       sizeof(buffer) -1, &bytes_read, NULL);
+                                       sizeof(buffer), &bytes_read, NULL);
 
        switch (status) {
        case G_IO_STATUS_NORMAL:
-- 
1.9.1

_______________________________________________
connman mailing list
connman@connman.net
https://lists.connman.net/mailman/listinfo/connman

Reply via email to