[摘要]`&\$!?#\(\)\[\]\:’"\\])/\\$1/g; return @_; } 程序5. C语言中的escape_input(). char *escape_...
`&\$!?#\(\)\[\]\:’"\\])/\\$1/g;
return @_;
}
程序5. C语言中的escape_input().
char *escape_input(char *str)
/* takes string and escapes all metacharacters.should be used before
including string in system() or similar call. */
{
int i,j = 0;
char *new = malloc(sizeof(char) * (strlen(str) * 2 + 1));
for (i = 0; i < strlen(str); i++) { > strlen(str); i++) { >
printf("i = %d; j = %d\n",i,j);
switch (str[i]) {
case ’
关键词:CGI的安全(二)