summaryrefslogtreecommitdiff
path: root/src/lib/ecore_file/ecore_file_monitor_inotify.c
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2014-10-27 22:57:53 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2014-10-28 10:54:51 +0900
commit8d9c6c0a00a25dae580f3ee0cfaa84abcb911611 (patch)
treedd9d2eb6e531a0568c7592a742ed3af42c73b1c5 /src/lib/ecore_file/ecore_file_monitor_inotify.c
parent6ace8313728b31f602af8af90dbcb686031be562 (diff)
inotify: Fix safety after read in 3 places
Fixes Coverity issues: - CID 1039565 - CID 1039566
Diffstat (limited to 'src/lib/ecore_file/ecore_file_monitor_inotify.c')
-rw-r--r--src/lib/ecore_file/ecore_file_monitor_inotify.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/lib/ecore_file/ecore_file_monitor_inotify.c b/src/lib/ecore_file/ecore_file_monitor_inotify.c
index e21e41c8c4..067a2814ff 100644
--- a/src/lib/ecore_file/ecore_file_monitor_inotify.c
+++ b/src/lib/ecore_file/ecore_file_monitor_inotify.c
@@ -162,10 +162,11 @@ _ecore_file_monitor_inotify_handler(void *data EINA_UNUSED, Ecore_Fd_Handler *fd
162 if (fd < 0) return ECORE_CALLBACK_RENEW; 162 if (fd < 0) return ECORE_CALLBACK_RENEW;
163 163
164 size = read(fd, buffer, sizeof(buffer)); 164 size = read(fd, buffer, sizeof(buffer));
165 while (i < size) 165 while ((i + (int) sizeof(struct inotify_event)) <= (int) size)
166 { 166 {
167 event = (struct inotify_event *)&buffer[i]; 167 event = (struct inotify_event *)&buffer[i];
168 event_size = sizeof(struct inotify_event) + event->len; 168 event_size = sizeof(struct inotify_event) + event->len;
169 if ((event_size + i) > size) break ;
169 i += event_size; 170 i += event_size;
170 171
171 em = _ecore_file_monitor_inotify_monitor_find(event->wd); 172 em = _ecore_file_monitor_inotify_monitor_find(event->wd);