Changeset e5aeae7b in rtems


Ignore:
Timestamp:
Nov 20, 2000, 1:30:03 PM (20 years ago)
Author:
Joel Sherrill <joel.sherrill@…>
Children:
99cfdc2d
Parents:
0b18036
Message:

2000-11-20 Dmitry Kargapolov <dk@…>

  • libc/mount.c: Make sure there is space allocated for a device name in the mount table entry.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • c/src/lib/libc/mount.c

    r0b18036 re5aeae7b  
    9696  rtems_filesystem_mount_table_entry_t *temp_mt_entry;
    9797  rtems_filesystem_location_info_t     *loc_to_free = NULL;
     98  size_t size;
    9899
    99100/* XXX add code to check for required operations */
     
    122123   */
    123124
    124    temp_mt_entry = malloc( sizeof(rtems_filesystem_mount_table_entry_t) );
     125   size = sizeof(rtems_filesystem_mount_table_entry_t);
     126   if ( device )
     127     size += strlen( device ) + 1;
     128   temp_mt_entry = malloc( size );
    125129
    126130   if ( !temp_mt_entry ) {
     
    131135   temp_mt_entry->mt_fs_root.mt_entry = temp_mt_entry;
    132136   temp_mt_entry->options = options;
    133    if ( device )
     137   if ( device ) {
     138     temp_mt_entry->dev =
     139       (char *)temp_mt_entry + sizeof( rtems_filesystem_mount_table_entry_t );
    134140     strcpy( temp_mt_entry->dev, device );
    135    else
     141   } else
    136142     temp_mt_entry->dev = 0;
    137143
Note: See TracChangeset for help on using the changeset viewer.