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

Function ap_escape_shell_cmd

server/util.c:1812–1843  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1810}
1811
1812AP_DECLARE(char *) ap_escape_shell_cmd(apr_pool_t *p, const char *str)
1813{
1814 char *cmd;
1815 unsigned char *d;
1816 const unsigned char *s;
1817
1818 cmd = apr_palloc(p, 2 * strlen(str) + 1); /* Be safe */
1819 d = (unsigned char *)cmd;
1820 s = (const unsigned char *)str;
1821 for (; *s; ++s) {
1822
1823#if defined(OS2) || defined(WIN32)
1824 /*
1825 * Newlines to Win32/OS2 CreateProcess() are ill advised.
1826 * Convert them to spaces since they are effectively white
1827 * space to most applications
1828 */
1829 if (*s == '\r' || *s == '\n') {
1830 *d++ = ' ';
1831 continue;
1832 }
1833#endif
1834
1835 if (TEST_CHAR(*s, T_ESCAPE_SHELL_CMD)) {
1836 *d++ = '\\';
1837 }
1838 *d++ = *s;
1839 }
1840 *d = '\0';
1841
1842 return cmd;
1843}
1844
1845static char x2c(const char *what)
1846{

Callers 8

split_argvFunction · 0.85
create_argvFunction · 0.85
add_ssi_varsFunction · 0.85
add_ssi_varsFunction · 0.85
default_build_commandFunction · 0.85
add_include_varsFunction · 0.85
includes_filterFunction · 0.85
init_ext_filter_processFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected