Previous 15994 Revisions Next

r7736 Tuesday 6th April, 2010 at 17:27:17 UTC by Wilbert Pol
Added some more safety checks when parsing software list xml files.
[src/mess]softlist.c

src/mess/softlist.c
r7735r7736
356356
357357               /* Handle the supported flag */
358358               elem->info.supported = SOFTWARE_SUPPORTED_YES;
359               if ( ! strcmp( supported, "partial" ) )
359               if ( supported && ! strcmp( supported, "partial" ) )
360360                  elem->info.supported = SOFTWARE_SUPPORTED_PARTIAL;
361               if ( ! strcmp( supported, "no" ) )
361               if ( supported && ! strcmp( supported, "no" ) )
362362                  elem->info.supported = SOFTWARE_SUPPORTED_NO;
363363
364364               /* Add the entry to the end of the list */
r7735r7736
533533                  UINT32 offset = strtol( str_offset, NULL, 16 );
534534                  char *s_name = (char *)pool_malloc_lib(swlist->pool, ( strlen( str_name ) + 1 ) * sizeof(char) );
535535                  char *hashdata = (char *)pool_malloc_lib( swlist->pool, sizeof(char) * ( strlen(str_crc) + strlen(str_sha1) + 7 ) );
536                  int baddump = ( !strcmp(str_status,"baddump") ) ? 1 : 0;
537                  int nodump = ( !strcmp(str_status,"nodump" ) ) ? 1 : 0;
536                  int baddump = ( str_status && !strcmp(str_status,"baddump") ) ? 1 : 0;
537                  int nodump = ( str_status && !strcmp(str_status,"nodump" ) ) ? 1 : 0;
538538
539539                  if ( !s_name || !hashdata )
540540                     return;

Previous 15994 Revisions Next


© 1998-2018 The MESS Team