가능한 중복 :
Preventing SQL Injection in CC에서 SQL 쿼리를 어떻게 위생 처리합니까?
내가 PHP가 어떤 쿼리를 소독하는 데 도움이 기능이 내장되어 알고 있지만, C가 같은 것을해야합니까?
snprintf(&buff[0],1023,"UPDATE grades SET grade='%c' WHERE username='%s'",choice,&uname[0]);
if (mysql_query(connect,&buff[0]) != 0) {
// If it failed, tell the user
printf("Error: %s!\n", mysql_error(connect));
return;
}
저는 준비된 문장을 지원하는 API가 거의 있다고 확신합니다. – cHao
@cHao가 말했듯이, 입력 "sanitization"을 피하고 준비된 문으로 가면 C API [지원합니다] (http://dev.mysql.com/doc/refman/5.0/en/c-api-prepared-statements .html). –