From f1e790d439c9621b3f1a3310f6cf648e7fbbb640 Mon Sep 17 00:00:00 2001 From: Sebastian Huber Date: Fri, 27 Aug 2010 06:41:08 +0000 Subject: 2010-08-26 Sebastian Huber * libcsupport/src/mount.c, libcsupport/src/mount-mgr.c: Avoid strcpy(). --- cpukit/ChangeLog | 3 ++- 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 - * libcsupport/src/mount.c: Avoid strcpy(). + * libcsupport/src/mount.c, libcsupport/src/mount-mgr.c: Avoid + strcpy(). 2010-08-26 Joel Sherrill 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; -- cgit v1.2.3