Re:Fixing C
by okasaki on Tuesday April 12, 2016 @06:28AM
(#11478363)
Good news. Arrays have sizeof(arr)/sizeof(arr[0]) elements and strings have strlen(str) letters.
[ Parent
| on HN ]
.. until you pass them as a function argument. And strlen() only works if your null terminator is valid, and doesn't tell you anything about available space in the string buffer for adding to the string.
This kind of thing keeps coming up in vulnerability reports.
Re:Fixing C
by ArkyBeagle on Tuesday April 12, 2016 @01:51PM
(#11481845)
This happens because people don't use the tools properly.
If different people keep chopping into themselves with a power tool it's probably wise to consider a safety guard.
Re:Fixing C
by ArkyBeagle on Tuesday April 12, 2016 @06:58PM
(#11484325)
Wrong is still wrong, and if someone did it, they did it wrong.
This really isn't complicated. It's hardly obscure. There's no excuse.
They should be using Ada instead of C, amiright /s
Re:Fixing C
by ArkyBeagle on Tuesday April 12, 2016 @06:57PM
(#11484317)
I have no way of knowing what they should use.