840325
From d1a00ae92b2cf09298615cf3aba474d8fec7380f Mon Sep 17 00:00:00 2001
840325
From: Christos Zoulas <christos@zoulas.com>
840325
Date: Mon, 18 Apr 2022 21:46:43 +0000
840325
Subject: [PATCH] From Dirk Mueller:
840325
840325
when name/use was used, the regex caching table was incorrectly
840325
initialized, which led to false or missing matches.
840325
---
840325
 src/apprentice.c | 4 ++--
840325
 1 file changed, 2 insertions(+), 2 deletions(-)
840325
840325
diff --git a/src/apprentice.c b/src/apprentice.c
840325
index 804c0e33e..992102b4e 100644
840325
--- a/src/apprentice.c
840325
+++ b/src/apprentice.c
840325
@@ -3678,11 +3678,11 @@ file_magicfind(struct magic_set *ms, const char *name, struct mlist *v)
840325
 				continue;
840325
 			if (strcmp(ma[i].value.s, name) == 0) {
840325
 				v->magic = &ma[i];
840325
+				v->magic_rxcomp = &(ml->magic_rxcomp[i]);
840325
 				for (j = i + 1; j < ml->nmagic; j++)
840325
 				    if (ma[j].cont_level == 0)
840325
 					    break;
840325
 				v->nmagic = j - i;
840325
-				v->magic_rxcomp = ml->magic_rxcomp;
840325
 				return 0;
840325
 			}
840325
 		}