Open mikeblas opened 3 years ago
I've posted Pull request #24 , which addresses uses of sprintf()
where the destination buffer is the same as one of the source strings. That fixes four warnings, if I'm counting correctly.
The remaining warnings are from un-checked string lengths. These are pretty egregious -- buffer overflows in a server. Addressing them would mean writing lots of code to handle dynamically allocated buffers, or truncating messages if they don't fit in the remaining statically sized buffer space. Either way, it seems like they'd get in the way of code clarity.
This project doesn't seem particularly active, so maybe I won't get an answer: but what's the opinion on fixing them?
The concurrency-webserver directory builds, but produces about 15 warnings. The
makefile
specifies-Wall
, but there's some quite dangerous code in the examples, and the compiler rightfully complains about it.Here's the GCC version I'm using, on Ubuntu 20.04 LTS:
The errors are mostly about unchecked use of
sprintf()
:and dubious behaviour expected of
sprintf()
:Of course, those are just two of the 15 or so messages I get.
Students and readers will be baffled (or at least distracted) by these errors, so they should be fixed. It doesn't seem particularly good to present example code that allows buffer overruns.