diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2010-08-27 06:41:08 +0000 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2010-08-27 06:41:08 +0000 |
commit | f1e790d439c9621b3f1a3310f6cf648e7fbbb640 (patch) | |
tree | 50eac9cb714728557261741a61403369c13155a0 /cpukit | |
parent | 2010-08-26 Sebastian Huber <sebastian.huber@embedded-brains.de> (diff) | |
download | rtems-f1e790d439c9621b3f1a3310f6cf648e7fbbb640.tar.bz2 |
2010-08-26 Sebastian Huber <sebastian.huber@embedded-brains.de>
* libcsupport/src/mount.c, libcsupport/src/mount-mgr.c: Avoid
strcpy().
Diffstat (limited to 'cpukit')
-rw-r--r-- | cpukit/ChangeLog | 3 | ||||
-rw-r--r-- | cpukit/libcsupport/src/mount-mgr.c | 7 |
2 files changed, 6 insertions, 4 deletions
diff --git a/cpukit/ChangeLog b/cpukit/ChangeLog index cc56e3cb93..aa4d88bba4 100644 --- a/cpukit/ChangeLog +++ b/cpukit/ChangeLog @@ -1,6 +1,7 @@ 2010-08-26 Sebastian Huber <sebastian.huber@embedded-brains.de> - * libcsupport/src/mount.c: Avoid strcpy(). + * libcsupport/src/mount.c, libcsupport/src/mount-mgr.c: Avoid + strcpy(). 2010-08-26 Joel Sherrill <joel.sherrill@oarcorp.com> diff --git a/cpukit/libcsupport/src/mount-mgr.c b/cpukit/libcsupport/src/mount-mgr.c index 755532aa0d..c610ff6998 100644 --- a/cpukit/libcsupport/src/mount-mgr.c +++ b/cpukit/libcsupport/src/mount-mgr.c @@ -110,14 +110,15 @@ rtems_filesystem_register( rtems_filesystem_fsmount_me_t mount_h ) { - size_t fsn_size = sizeof( filesystem_node ) + strlen(type) + 1; + size_t type_size = strlen(type) + 1; + size_t fsn_size = sizeof( filesystem_node ) + type_size; filesystem_node *fsn = malloc( fsn_size ); - char *type_storage = (char *) fsn + sizeof( filesystem_node ); + char *type_storage = (char *) fsn + sizeof( *fsn ); if ( fsn == NULL ) rtems_set_errno_and_return_minus_one( ENOMEM ); - strcpy(type_storage, type); + memcpy(type_storage, type, type_size); fsn->entry.type = type_storage; fsn->entry.mount_h = mount_h; |