From: <and...@us...> - 2009-12-09 23:08:54
|
Revision: 10716 http://plplot.svn.sourceforge.net/plplot/?rev=10716&view=rev Author: andrewross Date: 2009-12-09 23:08:42 +0000 (Wed, 09 Dec 2009) Log Message: ----------- Alternative neater approach to fixing problem with overlapping data buffer. Modified Paths: -------------- trunk/src/plcore.c Modified: trunk/src/plcore.c =================================================================== --- trunk/src/plcore.c 2009-12-09 22:49:12 UTC (rev 10715) +++ trunk/src/plcore.c 2009-12-09 23:08:42 UTC (rev 10716) @@ -961,9 +961,11 @@ if ( ptr == NULL ) { char buf[BUFFER_SIZE]; - strncpy( buf, "UTF-8 string is malformed: ", BUFFER_SIZE ); - strncat( buf, string, 30 ); - if ( strlen( string ) > 30 ) strncat( buf, "[...]", 5 ); + char tmpstring[31]; + strncpy( tmpstring, string, 30 ); + tmpstring[30] = '\0'; + snprintf( buf, BUFFER_SIZE, "UTF-8 string is malformed: %s%s", + tmpstring, strlen( string ) > 30 ? "[...]" : "" ); plabort( buf ); return; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |