From: <and...@us...> - 2009-02-09 10:47:40
|
Revision: 9479 http://plplot.svn.sourceforge.net/plplot/?rev=9479&view=rev Author: andrewross Date: 2009-02-09 10:47:34 +0000 (Mon, 09 Feb 2009) Log Message: ----------- Modify plsnprintf so that plplot will abort if a buffer overrun occurs. This is only used if snprintf is not natively available, and instead it calls sprintf. We can detect when an overflow occurs, but not prevent it, so the safest thing is probably to abort. Modified Paths: -------------- trunk/src/plctrl.c Modified: trunk/src/plctrl.c =================================================================== --- trunk/src/plctrl.c 2009-02-09 09:41:11 UTC (rev 9478) +++ trunk/src/plctrl.c 2009-02-09 10:47:34 UTC (rev 9479) @@ -2151,6 +2151,10 @@ va_start(args, format); ret=vsprintf(buffer, fmt, args); va_end( argptr ); + + /* Check if overrun occured */ + if (ret > n-1) + plabort("plsnprintf: buffer overrun"); return ret; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |