In message <AANLkTikO1v7YMFKVZkHZDmurcyfq0QbTkPxG=LNBdKSp_at_mail.gmail.com>, mdf_at_ FreeBSD.org writes: >It seems like a large project, but OTOH sprintf(9) is mighty unsafe in >the kernel. Well, it is only unsafe if people used it without knowing what they are doing, so I think a wholesale automated replacement is both unwarranted and inadvisable. I can recommend the following macro for the static buffer cases, it checks if people know what they are doing with an assert. #define bprintf(buf, fmt, ...) \ do { \ assert(snprintf(buf, sizeof buf, fmt, __VA_ARGS__) \ < sizeof buf); \ } while (0) Poul-Henning -- Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 phk_at_FreeBSD.ORG | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe Never attribute to malice what can adequately be explained by incompetence.Received on Wed Sep 08 2010 - 14:39:08 UTC
This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:07 UTC