e is the first _invalid_ location in q N.B. returns the terminating NUL. */
| 120 | N.B. returns the terminating NUL. |
| 121 | */ |
| 122 | static char *log_escape(char *q, const char *e, const char *p) |
| 123 | { |
| 124 | for ( ; *p ; ++p) { |
| 125 | ap_assert(q < e); |
| 126 | if (TEST_CHAR(*p, T_ESCAPE_FORENSIC)) { |
| 127 | ap_assert(q+2 < e); |
| 128 | *q++ = '%'; |
| 129 | ap_bin2hex(p, 1, q); |
| 130 | q += 2; |
| 131 | } |
| 132 | else |
| 133 | *q++ = *p; |
| 134 | } |
| 135 | ap_assert(q < e); |
| 136 | *q = '\0'; |
| 137 | |
| 138 | return q; |
| 139 | } |
| 140 | |
| 141 | typedef struct hlog { |
| 142 | char *log; |
no test coverage detected