Skip to content

Commit 91fbf35

Browse files
Hide testing override functions from symbol table
1 parent d19f58b commit 91fbf35

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

src/operators/libinjection_adapter.h

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,16 +22,25 @@
2222

2323
namespace modsecurity::operators {
2424

25+
// Keep testing override hooks out of the shared-library dynamic symbol table.
26+
#if defined(__GNUC__) || defined(__clang__)
27+
#define MODSEC_HIDDEN __attribute__((visibility("hidden")))
28+
#else
29+
#define MODSEC_HIDDEN
30+
#endif
31+
2532
using DetectSQLiFn = injection_result_t (*)(const char *, size_t, char *);
2633
using DetectXSSFn = injection_result_t (*)(const char *, size_t);
2734

2835
injection_result_t runLibinjectionSQLi(const char *input, size_t len,
2936
char *fingerprint);
3037
injection_result_t runLibinjectionXSS(const char *input, size_t len);
3138

32-
void setLibinjectionSQLiOverrideForTesting(DetectSQLiFn fn);
33-
void setLibinjectionXSSOverrideForTesting(DetectXSSFn fn);
34-
void clearLibinjectionOverridesForTesting();
39+
MODSEC_HIDDEN void setLibinjectionSQLiOverrideForTesting(DetectSQLiFn fn);
40+
MODSEC_HIDDEN void setLibinjectionXSSOverrideForTesting(DetectXSSFn fn);
41+
MODSEC_HIDDEN void clearLibinjectionOverridesForTesting();
42+
43+
#undef MODSEC_HIDDEN
3544

3645
} // namespace modsecurity::operators
3746

0 commit comments

Comments
 (0)