diff options
author | Camil Staps | 2020-03-28 10:27:00 +0100 |
---|---|---|
committer | Camil Staps | 2020-03-28 10:27:00 +0100 |
commit | 6eb13a8760d49bd98c564d30d846ecb07301e8db (patch) | |
tree | 41911cd72d3ac20909eb0832dd49c7eefecc5e95 | |
parent | Expose Inotify type itself in callbacks to allow adding/removing watches (diff) |
Fix #1 (in some cases string garbage was read for file names)
-rw-r--r-- | inotify_c.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/inotify_c.c b/inotify_c.c index ab8f319..28432f2 100644 --- a/inotify_c.c +++ b/inotify_c.c @@ -102,11 +102,10 @@ void clean_inotify_check(int fd, wds_ptr += sizeof(int); CleanStringLength(wds_string) += sizeof(int); - int len = strlen(ev->name); - memcpy(names_ptr, &ev->name, len); - names_ptr += len + 1; - *(names_ptr - 1) = '\00'; - CleanStringLength(names_string) += len + 1; + memcpy (names_ptr,&ev->name,ev->len); + names_ptr+=ev->len+1; + *(names_ptr-1)='\0'; + CleanStringLength (names_string)+=ev->len+1; } } |