aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGravatar Arun Prakash Jana <engineerarun@gmail.com>2019-06-04 22:41:48 +0530
committerGravatar Arun Prakash Jana <engineerarun@gmail.com>2019-06-04 22:41:48 +0530
commitfcb29fa57899afa76cad085ccaf512309190f57e (patch)
tree8d6a44de4b0e7779bf67882940ff89c9b510d8c3 /src
parentf269be5802130433a1fbf90c1ce460cdd6500933 (diff)
downloadnnn-fcb29fa57899afa76cad085ccaf512309190f57e.tar.gz
Fix #276
Diffstat (limited to 'src')
-rw-r--r--src/nnn.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/nnn.c b/src/nnn.c
index b2f6d5f..e00d0d0 100644
--- a/src/nnn.c
+++ b/src/nnn.c
@@ -1489,10 +1489,11 @@ static int nextsel(int presel)
const uint len = LEN(bindings);
#ifdef LINUX_INOTIFY
struct inotify_event *event;
- static char inotify_buf[EVENT_BUF_LEN]
- __attribute__ ((aligned(__alignof__(struct inotify_event))));
+ char *inotify_buf = alloca(EVENT_BUF_LEN);
+ memset((void *)inotify_buf, 0x0, EVENT_BUF_LEN);
#elif defined(BSD_KQUEUE)
- static struct kevent event_data[NUM_EVENT_SLOTS];
+ struct kevent *event_data = alloca(sizeof(struct kevent) * NUM_EVENT_SLOTS);
+ memset((void *)event_data, 0x0, sizeof(struct kevent) * NUM_EVENT_SLOTS);
#endif
if (c == 0 || c == MSGWAIT) {
@@ -1521,7 +1522,8 @@ static int nextsel(int presel)
if (i > 0) {
char *ptr;
- for (ptr = inotify_buf; ptr < inotify_buf + i;
+ for (ptr = inotify_buf;
+ ptr + ((struct inotify_event *)ptr)->len < inotify_buf + i;
ptr += sizeof(struct inotify_event) + event->len) {
event = (struct inotify_event *) ptr;
DPRINTF_D(event->wd);