examples/apache: instrumentation of string cmp functions
@@ -108,6 +108,63 @@ index bda60827c..2e4abccfe 100644
char c;
int showcompile = 0, showdirectives = 0;
const char *confname = SERVER_CONFIG_FILE;
+diff --git a/server/util.c b/server/util.c
+index d302764e3..e4848b2c8 100644
+--- a/server/util.c
++++ b/server/util.c
+@@ -27,6 +27,8 @@
+ * #define DEBUG_CFG_LINES to trace every line read from the config files
+ */
+
++#include <libhfuzz.h>
++
+ #include "apr.h"
+ #include "apr_strings.h"
+ #include "apr_lib.h"
+@@ -3408,6 +3410,7 @@ static const short ucharmap[] = {
+
+ AP_DECLARE(int) ap_cstr_casecmp(const char *s1, const char *s2)
+ {
++ unsigned int z = 0;
+ const unsigned char *str1 = (const unsigned char *)s1;
+ const unsigned char *str2 = (const unsigned char *)s2;
+ for (;;)
+@@ -3416,15 +3419,19 @@ AP_DECLARE(int) ap_cstr_casecmp(const char *s1, const char *s2)
+ const int c2 = (int)(*str2);
+ const int cmp = ucharmap[c1] - ucharmap[c2];
+ /* Not necessary to test for !c2, this is caught by cmp */
+- if (cmp || !c1)
++ if (cmp || !c1) {
++ instrumentCmpMap(__builtin_return_address(0), z);
+ return cmp;
++ }
+ str1++;
+ str2++;
++ z++;
+ }
+ }
+
+ AP_DECLARE(int) ap_cstr_casecmpn(const char *s1, const char *s2, apr_size_t n)
+ {
++ unsigned int z = 0;
+ const unsigned char *str1 = (const unsigned char *)s1;
+ const unsigned char *str2 = (const unsigned char *)s2;
+ while (n--)
+@@ -3433,10 +3440,13 @@ AP_DECLARE(int) ap_cstr_casecmpn(const char *s1, const char *s2, apr_size_t n)
+ const int c2 = (int)(*str2);
+ const int cmp = ucharmap[c1] - ucharmap[c2];
+ /* Not necessary to test for !c2, this is caught by cmp */
+- if (cmp || !c1)
++ if (cmp || !c1) {
++ instrumentCmpMap(__builtin_return_address(0), z);
+ return cmp;
++ }
+ str1++;
+ str2++;
++ z++;
+ }
+ return 0;
+ }
diff --git a/support/ab.c b/support/ab.c
index 58769a9c8..ddf141bcc 100644
--- a/support/ab.c
