[Mauiusers] Using MUSNPrintF() to protect against buffer overruns
ake.sandgren at hpc2n.umu.se
Fri Apr 11 09:36:56 MDT 2008
On Fri, 2008-04-11 at 09:24 -0600, Douglas Wightman wrote:
> Many patches have been submitted lately using some variation of sprintf.
> Maui has its own routine that can handle most of this work in a very
> safe, secure way, and easy to understand way. This routine is called
> MUSNPrintF(). I am going to show how it works with a short tutorial:
> All patches submitted that are protecting against any form of buffer
> overrun must be modified to use MUSNPrintF() rather than something like
> the following:
> sprintf(Buffer + strlen(Buffer),
> This will make the code consistent and easy to read. Again, if you have
> submitted a patch that fixes a buffer overrun by using sprintf you must
> modify your patch to use MUSNPrintF(). Any patches that use sprintf to
> avoid buffer overruns will be rejected (unless it's in a location of
> code that makes sense).
Please note that to use it you MUST backtrack the origin of the buffer
and use MUSNPrintF CONSISTENTLY all through its lifespan.
If not you will just screw things up even worse.
This is VERY VERY VERY important.
Ake Sandgren, HPC2N, Umea University, S-90187 Umea, Sweden
Internet: ake at hpc2n.umu.se Phone: +46 90 7866134 Fax: +46 90 7866126
Mobile: +46 70 7716134 WWW: http://www.hpc2n.umu.se
More information about the mauiusers