deprecating sprintf(9)

From: <mdf_at_FreeBSD.org>
Date: Wed, 8 Sep 2010 08:51:57 -0700
Looking at the uses of kvprintf(9), only [v]sprintf(9) doesn't have a
callback function.  It seems a little sketchy to me to be doing unsafe
sprintf in the kernel anyways.

Should we (and by we, I mean me) deprecate sprintf(9) and convert the
existing 1200+ uses to strcpy(9) for fixed strings (also potentially
bad, but a different beast), or snprintf(9) where the size of the
buffer is known?

It seems like a large project, but OTOH sprintf(9) is mighty unsafe in
the kernel.  It's disapproved of for user-space as being unsafe for
security reasons as well, but the potential downsides aren't the same,
and we'll never clean up ports anyways. :-)

Thoughts?
matthew
Received on Wed Sep 08 2010 - 13:51:59 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:40:07 UTC