fix invalid memory access in event_bsd.c webdav

Sun, 08 May 2022 11:52:52 +0200

author
Olaf Wintermann <olaf.wintermann@gmail.com>
date
Sun, 08 May 2022 11:52:52 +0200
branch
webdav
changeset 342
ebd1e67c3d5f
parent 341
52831b82b3fd
child 343
78ce9733a54f

fix invalid memory access in event_bsd.c

src/server/daemon/event_bsd.c file | annotate | diff | comparison | revisions
--- a/src/server/daemon/event_bsd.c	Sun May 08 10:46:56 2022 +0200
+++ b/src/server/daemon/event_bsd.c	Sun May 08 11:52:52 2022 +0200
@@ -92,6 +92,7 @@
                 
                 continue;
             }
+            int event_events = event->events;
             
             if(event->fn) {
                 int saved_ev = event->events;
@@ -102,12 +103,14 @@
                         event->finish(ev, event);
                     }
                     
-                    event->events = 0;
+                    event_events = 0;
+                } else {
+                    event_events = event->events;
                 }
                 
                 // if events have changed, we need to add/remove filters
-                if(saved_ev != event->events) {
-                    int e = event->events;
+                if(saved_ev != event_events) {
+                    int e = event_events;
                     int e_fd = events[i].ident;
                     if((e & EVENT_POLLIN) != (saved_ev & EVENT_POLLIN)) {
                         if((e & EVENT_POLLIN) == EVENT_POLLIN) {

mercurial