4 ms·
All it does is confuse programmers ...programmers who don't know C? None of this is particularly tricky C code. While these functions can be used safely by ca
by userbinator 12y ago
All it does is confuse programmers
...programmers who don't know C? None of this is particularly tricky C code.
While these functions can be used safely by careful programmers, it's simply better to ban their use altogether.
"If there's a chance something could be dangerous, ban it"? This feels like the same sort of reasoning that the government uses to deprive people of personal freedoms... all in the name of "security". It's not unexpected given these people are in the security industry, but sometimes I wonder what kind of world they really want...
The whole article has the feel to it of being written by someone to whom "best practices" are the gospel, and misses the extremely simple reason behind the bug: accidentally reusing a function that does both command parsing and execution to evaluate function definitions. The reason for this misuse could be because command execution is being conflated with evaluating function definitions, but more importantly, none of the complaints raised in the article matter; neither changing function definitions to C89+, removing global variables, rewriting the style of loops and renaming their variables, nor using "safer" string functions would've eliminated the bug. Without all of these, the same mistake could be made. It's a little amusing that one of the gripes is about variable naming, when I think one of the functions involved in the bug couldn't be named any clearer: parse_and_execute().
There is a certain allure to ticking off some list of "best practices" and thinking that it'll somehow solve everything, but as this bug shows, there's simply no replacement for thinking carefully about the code and what it does when implementing functionality.
- yuhong 12y agoNot by themselves, but there has been more than one bug in this code: http://lcamtuf.blogspot.ca/2014/09/bash-bug-apply-unofficial-patch-now.html http://lcamtuf.blogspot.ca/2014/09/bash-bug-apply-unofficial...