summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoel Sherrill <joel.sherrill@OARcorp.com>2000-11-20 13:30:03 +0000
committerJoel Sherrill <joel.sherrill@OARcorp.com>2000-11-20 13:30:03 +0000
commite5aeae7b3008b61e8acb842c87007780ac862c0a (patch)
tree18333d9ffeae16aee7b471ec2d156c38acd0866f
parent2000-09-20 Joel Sherrill <joel@OARcorp.com> (diff)
downloadrtems-e5aeae7b3008b61e8acb842c87007780ac862c0a.tar.bz2
2000-11-20 Dmitry Kargapolov <dk@gentex.ru>
* libc/mount.c: Make sure there is space allocated for a device name in the mount table entry.
-rw-r--r--c/src/lib/libc/mount.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/c/src/lib/libc/mount.c b/c/src/lib/libc/mount.c
index 578404ecdc..5e64d1a996 100644
--- a/c/src/lib/libc/mount.c
+++ b/c/src/lib/libc/mount.c
@@ -95,6 +95,7 @@ int mount(
rtems_filesystem_location_info_t loc;
rtems_filesystem_mount_table_entry_t *temp_mt_entry;
rtems_filesystem_location_info_t *loc_to_free = NULL;
+ size_t size;
/* XXX add code to check for required operations */
@@ -121,7 +122,10 @@ int mount(
* Allocate a mount table entry
*/
- temp_mt_entry = malloc( sizeof(rtems_filesystem_mount_table_entry_t) );
+ size = sizeof(rtems_filesystem_mount_table_entry_t);
+ if ( device )
+ size += strlen( device ) + 1;
+ temp_mt_entry = malloc( size );
if ( !temp_mt_entry ) {
errno = ENOMEM;
@@ -130,9 +134,11 @@ int mount(
temp_mt_entry->mt_fs_root.mt_entry = temp_mt_entry;
temp_mt_entry->options = options;
- if ( device )
+ if ( device ) {
+ temp_mt_entry->dev =
+ (char *)temp_mt_entry + sizeof( rtems_filesystem_mount_table_entry_t );
strcpy( temp_mt_entry->dev, device );
- else
+ } else
temp_mt_entry->dev = 0;
/*