Changeset 74fbb7f3 in rtems


Ignore:
Timestamp:
Jun 9, 2010, 9:15:50 AM (9 years ago)
Author:
Sebastian Huber <sebastian.huber@…>
Branches:
4.11, master
Children:
14fc3a7
Parents:
ec6f27c2
Message:

2010-06-09 Sebastian Huber <sebastian.huber@…>

  • libcsupport/src/mount.c: Fixed NULL pointer access.
Location:
cpukit
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • cpukit/ChangeLog

    rec6f27c2 r74fbb7f3  
     12010-06-09      Sebastian Huber <sebastian.huber@embedded-brains.de>
     2
     3        * libcsupport/src/mount.c: Fixed NULL pointer access.
     4
    152010-06-09      Ralf Corsépius <ralf.corsepius@rtems.org>
    26
  • cpukit/libcsupport/src/mount.c

    rec6f27c2 r74fbb7f3  
    9494
    9595static rtems_filesystem_mount_table_entry_t *alloc_mount_table_entry(
    96   const char *source,
    97   const char *target,
     96  const char *source_or_null,
     97  const char *target_or_null,
    9898  const char *filesystemtype,
    9999  size_t *target_length_ptr
    100100)
    101101{
    102   const char *target_str = target ? target : "/";
     102  const char *target = target_or_null != NULL ? target_or_null : "/";
    103103  size_t filesystemtype_size = strlen( filesystemtype ) + 1;
    104   size_t source_size = source ? strlen( source ) + 1 : 0;
    105   size_t target_length = strlen( target_str );
     104  size_t source_size = source_or_null != NULL ?
     105    strlen( source_or_null ) + 1 : 0;
     106  size_t target_length = strlen( target );
    106107  size_t size = sizeof( rtems_filesystem_mount_table_entry_t )
    107108    + filesystemtype_size + source_size + target_length + 1;
    108109  rtems_filesystem_mount_table_entry_t *mt_entry = calloc( 1, size );
    109110
    110   if ( mt_entry ) {
     111  if ( mt_entry != NULL ) {
    111112    char *str = (char *) mt_entry + sizeof( *mt_entry );
    112113
     
    114115    strcpy( str, filesystemtype );
    115116
    116     if ( source ) {
     117    if ( source_or_null != NULL ) {
    117118      str += filesystemtype_size;
    118119      mt_entry->dev = str;
    119       strcpy( str, source );
     120      strcpy( str, source_or_null );
    120121    }
    121122
Note: See TracChangeset for help on using the changeset viewer.