From 74fbb7f3032b8c9c95ab0af03bf40669c4078e67 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Wed, 9 Jun 2010 09:15:50 +0000 Subject: 2010-06-09 Sebastian Huber * libcsupport/src/mount.c: Fixed NULL pointer access. --- cpukit/ChangeLog | 4 ++++ cpukit/libcsupport/src/mount.c | 17 +++++++++-------- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/cpukit/ChangeLog b/cpukit/ChangeLog index f7c3bd17ae..bb153c7b2e 100644 --- a/cpukit/ChangeLog +++ b/cpukit/ChangeLog @@ -1,3 +1,7 @@ +2010-06-09 Sebastian Huber + + * libcsupport/src/mount.c: Fixed NULL pointer access. + 2010-06-09 Ralf Corsépius * Makefile.am, configure.ac: Remove support for shttpd. diff --git a/cpukit/libcsupport/src/mount.c b/cpukit/libcsupport/src/mount.c index 07f41f2ee4..c73ce89e35 100644 --- a/cpukit/libcsupport/src/mount.c +++ b/cpukit/libcsupport/src/mount.c @@ -93,30 +93,31 @@ static bool Is_node_fs_root( } static rtems_filesystem_mount_table_entry_t *alloc_mount_table_entry( - const char *source, - const char *target, + const char *source_or_null, + const char *target_or_null, const char *filesystemtype, size_t *target_length_ptr ) { - const char *target_str = target ? target : "/"; + const char *target = target_or_null != NULL ? target_or_null : "/"; size_t filesystemtype_size = strlen( filesystemtype ) + 1; - size_t source_size = source ? strlen( source ) + 1 : 0; - size_t target_length = strlen( target_str ); + size_t source_size = source_or_null != NULL ? + strlen( source_or_null ) + 1 : 0; + size_t target_length = strlen( target ); size_t size = sizeof( rtems_filesystem_mount_table_entry_t ) + filesystemtype_size + source_size + target_length + 1; rtems_filesystem_mount_table_entry_t *mt_entry = calloc( 1, size ); - if ( mt_entry ) { + if ( mt_entry != NULL ) { char *str = (char *) mt_entry + sizeof( *mt_entry ); mt_entry->type = str; strcpy( str, filesystemtype ); - if ( source ) { + if ( source_or_null != NULL ) { str += filesystemtype_size; mt_entry->dev = str; - strcpy( str, source ); + strcpy( str, source_or_null ); } str += source_size; -- cgit v1.2.3