* checks an encoded ftp string for bad characters, namely, CR, LF or * non-ascii character */
| 179 | * non-ascii character |
| 180 | */ |
| 181 | static 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 |
no test coverage detected