MCPcopy Create free account
hub / github.com/apache/httpd / ftp_check_string

Function ftp_check_string

modules/proxy/mod_proxy_ftp.c:181–206  ·  view source on GitHub ↗

* checks an encoded ftp string for bad characters, namely, CR, LF or * non-ascii character */

Source from the content-addressed store, hash-verified

179 * non-ascii character
180 */
181static int ftp_check_string(const char *x)
182{
183 int i, ch = 0;
184#if APR_CHARSET_EBCDIC
185 char buf[1];
186#endif
187
188 for (i = 0; x[i] != '\0'; i++) {
189 ch = x[i];
190 if (ch == '%' && apr_isxdigit(x[i + 1]) && apr_isxdigit(x[i + 2])) {
191 ch = ap_proxy_hex2c(&x[i + 1]);
192 i += 2;
193 }
194#if !APR_CHARSET_EBCDIC
195 if (ch == '\015' || ch == '\012' || (ch & 0x80))
196#else /* APR_CHARSET_EBCDIC */
197 if (ch == '\r' || ch == '\n')
198 return 0;
199 buf[0] = ch;
200 ap_xlate_proto_to_ascii(buf, 1);
201 if (buf[0] & 0x80)
202#endif /* APR_CHARSET_EBCDIC */
203 return 0;
204 }
205 return 1;
206}
207
208/*
209 * converts a series of buckets into a string

Callers 2

proxy_ftp_canonFunction · 0.85
proxy_ftp_handlerFunction · 0.85

Calls 2

ap_proxy_hex2cFunction · 0.85
ap_xlate_proto_to_asciiFunction · 0.85

Tested by

no test coverage detected