From: <arj...@us...> - 2010-11-11 08:33:45
|
Revision: 11321 http://plplot.svn.sourceforge.net/plplot/?rev=11321&view=rev Author: arjenmarkus Date: 2010-11-11 08:33:39 +0000 (Thu, 11 Nov 2010) Log Message: ----------- Check the parsing of the .rc files to prevent the use of NULL pointers. Abort the program if no proper driver information is found. Modified Paths: -------------- trunk/src/plcore.c Modified: trunk/src/plcore.c =================================================================== --- trunk/src/plcore.c 2010-11-11 00:55:13 UTC (rev 11320) +++ trunk/src/plcore.c 2010-11-11 08:33:39 UTC (rev 11321) @@ -3008,6 +3008,12 @@ seqstr = strtok( 0, ":" ); tag = strtok( 0, "\n" ); + if ( devnam == NULL || devdesc == NULL || devtype == NULL || driver == NULL || + seqstr == NULL || tag == NULL ) + { + continue; // Ill-formatted line, most probably not a valid driver information file + } + seq = atoi( seqstr ); n = npldrivers++; @@ -3066,6 +3072,12 @@ #endif + if ( npldrivers == 0 ) + { + npldynamicdevices = 0; + plexit( "No device drivers found - please check the environment variable PLPLOT_DRV_DIR" ); + } + // Finally, we need to sort the list into presentation order, based on the // sequence number in the dispatch ttable entries. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |