Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
libbpftune: ensure we only init ".so" objects
Need to ensure suffix is ".so" without additional following
chars.

Reported-by: Bernd Zeimetz <[email protected]>
Signed-off-by: Alan Maguire <[email protected]>
  • Loading branch information
alan-maguire committed Dec 2, 2024
commit 410583fac1ec6d4b75c7993378dd2f3564070a81
8 changes: 6 additions & 2 deletions src/bpftune.c
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,13 @@ void *inotify_thread(void *arg)

for (i = 0; i < len; i += sizeof(struct inotify_event)) {
struct inotify_event *event = (struct inotify_event *)&buf[i];
char *suffix;

if (event->mask & IN_ISDIR ||
!strstr(event->name, ".so"))
if (event->mask & IN_ISDIR)
continue;
/* ensure suffix is ".so" with no additional chars following */
suffix = strstr(event->name, ".so");
if (!suffix || strlen(suffix) != strlen(".so"))
continue;
snprintf(library_path, sizeof(library_path), "%s/%s",
library_dir, event->name);
Expand Down