|
|
|
|
|
by comex
4090 days ago
|
|
Writing completely secure C is hard, but this code is littered with extremely basic bugs like unchecked sprintf and not sanitizing arguments to system. Like, it's a basic rule that you should use snprintf instead of sprintf, possibly with exceptions for cases where you're absolutely sure the result fits in the provided buffer, and in this case there is sprintf everywhere and no checks on the input size whatsoever. |
|
A funny analogy I've heard is "programmers who don't know the size of their buffers are like drivers who don't know the size of their cars."