Re: Patch for OnAccessIncludePath traversal across file systems
Arthur Ramsey <[email protected]> Thu, 10 Oct 2019 19:26:31 -0500
| Newsgroups | gmane.comp.security.virus.clamav.devel |
|---|---|
| Message-ID | <[email protected]> |
After more testing this seems better:
--- a/clamd/onaccess_hash.c 2019-10-10 19:19:06.000000000 -0500
+++ b/clamd/onaccess_hash.c 2019-10-10 19:14:23.000000000 -0500
@@ -33,6 +33,7 @@
#include <string.h>
#include <errno.h>
#include <stdbool.h>
+#include <mntent.h>
#include <sys/fanotify.h>
@@ -589,6 +590,22 @@
struct onas_hnode *hnode = NULL;
+ char buf[10240];
+ struct mntent ent;
+ struct mntent *mntent;
+ FILE *mountinfo;
+ mountinfo = setmntent("/proc/mounts", "r");
+ if (mountinfo == NULL) {
+ logg("!ScanOnAccess: setmntent failed\n");
+ return CL_EARG;
+ }
+ while ((mntent = getmntent_r(mountinfo, &ent, buf, sizeof(buf))) != NULL) {
+ if (strcmp(curr->fts_path, pathname) != 0 && strcmp(curr->fts_path, mntent->mnt_dir) == 0) {
+ onas_ht_add_hierarchy(ht, curr->fts_path);
+ }
+ }
+ endmntent(mountinfo);
+
/* May want to handle other options in the future. */
switch (curr->fts_info) {
case FTS_D:
_______________________________________________
clamav-devel mailing list
[email protected]
https://lists.clamav.net/mailman/listinfo/clamav-devel
Please submit your patches to our Bugzilla: http://bugzilla.clamav.net
Help us build a comprehensive ClamAV guide:
https://github.com/vrtadmin/clamav-faq
http://www.clamav.net/contact.html#ml