可能重复: 防止C中的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;
}发布于 2011-10-02 22:04:47
发布于 2011-10-02 22:02:46
C语言和运行时没有这样的例程。您的特定数据库的特定客户端库可能有一些内容。
https://stackoverflow.com/questions/7629501
复制相似问题