在实践DVWA的sql盲注low级别时,发现了一个问题。
在确定表名长度时,一般会用1‘ and length(substr(select table_name from information_schema.tables where table_schema=database() limit 0,1),1)=特定长度#
但是我细细思考,substr用于截取子字符串,可由于此步骤为确定表名长度,并不需要截取子字符串,故去掉substr函数,就有了如下语句 1’ and length(select table_name from information_schema.tables where table_schema=database() limit 0,1)=特定长度# 此语句结果是报错的。
但是如果我把该语句修改一下,变成 1’ and length((select table_name from information_schema.tables where table_schema=database() limit 0,1))=特定长度# 此次结果为正确的。
而这两个语句的区别仅是在length函数里面加了一层括号,请问一下各位大佬,这层括号有什么用么?而且为什么这块内容会使用到substr函数?