提交 b1843c52 编写于 作者: V Vidar Holen

Warn when using read without -r

上级 d406ba99
......@@ -206,6 +206,7 @@ nodeChecks = [
,checkReturn
,checkMaskedReturns
,checkInjectableFindSh
,checkReadWithoutR
]
......@@ -3453,6 +3454,13 @@ checkInjectableFindSh _ = checkCommand "find" (const check)
when ("{}" `isInfixOf` arg) $
warn id 2156 "Injecting filenames is fragile and insecure. Use parameters."
prop_checkReadWithoutR1 = verify checkReadWithoutR "read -a foo"
prop_checkReadWithoutR2 = verifyNot checkReadWithoutR "read -ar foo"
checkReadWithoutR _ t@(T_SimpleCommand {}) | t `isUnqualifiedCommand` "read" =
unless ("r" `elem` map snd (getAllFlags t)) $
info (getId t) 2162 "read without -r will mangle backslashes."
checkReadWithoutR _ _ = return ()
return []
runTests = $( [| $(forAllProperties) (quickCheckWithResult (stdArgs { maxSuccess = 1 }) ) |])
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册