summaryrefslogtreecommitdiff
path: root/src/bin/evas/evas_cserve2_main_loop_linux.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/bin/evas/evas_cserve2_main_loop_linux.c
parent6ace8313728b31f602af8af90dbcb686031be562 (diff)
inotify: Fix safety after read in 3 places
Fixes Coverity issues: - CID 1039565 - CID 1039566
Diffstat (limited to 'src/bin/evas/evas_cserve2_main_loop_linux.c')
-rw-r--r--src/bin/evas/evas_cserve2_main_loop_linux.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/bin/evas/evas_cserve2_main_loop_linux.c b/src/bin/evas/evas_cserve2_main_loop_linux.c
index e213cc476c..33a9955c10 100644
--- a/src/bin/evas/evas_cserve2_main_loop_linux.c
+++ b/src/bin/evas/evas_cserve2_main_loop_linux.c
@@ -328,7 +328,7 @@ _inotifyfd_handler(int fd, Fd_Flags flags, void *data EINA_UNUSED)
328 } 328 }
329 329
330 size = read(fd, buffer, sizeof(buffer)); 330 size = read(fd, buffer, sizeof(buffer));
331 while (i < size) 331 while ((i + (int) sizeof(struct inotify_event)) <= (int) size)
332 { 332 {
333 struct inotify_event *event; 333 struct inotify_event *event;
334 int event_size; 334 int event_size;
@@ -338,6 +338,7 @@ _inotifyfd_handler(int fd, Fd_Flags flags, void *data EINA_UNUSED)
338 338
339 event = (struct inotify_event *)&buffer[i]; 339 event = (struct inotify_event *)&buffer[i];
340 event_size = sizeof(struct inotify_event) + event->len; 340 event_size = sizeof(struct inotify_event) + event->len;
341 if ((event_size + i) > size) break ;
341 i += event_size; 342 i += event_size;
342 343
343 ids = eina_hash_find(inotify_id_hash, &event->wd); 344 ids = eina_hash_find(inotify_id_hash, &event->wd);