change log for rtems (2010-08-27)
Gedare Bloom
gedare at gwmail.gwu.edu
Fri Aug 27 16:12:36 UTC 2010
For strings, shouldn't you still use strncpy? I think it is better to use
the strncpy because it will not copy beyond the \0 regardless of the value
of n.
On Fri, Aug 27, 2010 at 3:10 AM, rtems-vc at rtems.org <rtems-vc at rtems.org>wrote:
> *sh*
>
> 2010-08-26 Sebastian Huber <sebastian.huber at embedded-brains.de>
>
> * libcsupport/src/mount.c: Avoid strcpy().
>
> M<http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/cpukit/ChangeLog.diff?r1=text&tr1=1.2608&r2=text&tr2=1.2609&diff_format=h>
> 1.2609cpukit/ChangeLog M<http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/cpukit/libcsupport/src/mount.c.diff?r1=text&tr1=1.40&r2=text&tr2=1.41&diff_format=h>
> 1.41cpukit/libcsupport/src/mount.c
>
> diff -u rtems/cpukit/ChangeLog:1.2608 rtems/cpukit/ChangeLog:1.2609
> --- rtems/cpukit/ChangeLog:1.2608 Thu Aug 26 16:42:21 2010
> +++ rtems/cpukit/ChangeLog Fri Aug 27 01:29:25 2010@@ -1,3 +1,7 @@+2010-08-26 Sebastian Huber <sebastian.huber at embedded-brains.de>
> +
> + * libcsupport/src/mount.c: Avoid strcpy().
> + 2010-08-26 Joel Sherrill <joel.sherrill at oarcorp.com>
>
> * libcsupport/src/sync.c: Add comment explaining why the return value
> diff -u rtems/cpukit/libcsupport/src/mount.c:1.40 rtems/cpukit/libcsupport/src/mount.c:1.41
> --- rtems/cpukit/libcsupport/src/mount.c:1.40 Sun Jul 4 09:53:44 2010
> +++ rtems/cpukit/libcsupport/src/mount.c Fri Aug 27 01:29:26 2010@@ -74,29 +74,27 @@ size_t filesystemtype_size = strlen( filesystemtype ) + 1;
> size_t source_size = source_or_null != NULL ?
> strlen( source_or_null ) + 1 : 0;- size_t target_length = strlen( target );+ size_t target_size = strlen( target ) + 1; size_t size = sizeof( rtems_filesystem_mount_table_entry_t )- + filesystemtype_size + source_size + target_length + 1;+ + filesystemtype_size + source_size + target_size; rtems_filesystem_mount_table_entry_t *mt_entry = calloc( 1, size );
>
> if ( mt_entry != NULL ) {
> char *str = (char *) mt_entry + sizeof( *mt_entry );
> - strcpy( str, filesystemtype );+ memcpy( str, filesystemtype, filesystemtype_size ); mt_entry->type = str;
> str += filesystemtype_size;
> - if ( source_or_null != NULL ) {
> - strcpy( str, source_or_null );
> - mt_entry->dev = str;
> - str += source_size;
> - }+ memcpy( str, source_or_null, source_size );
> + mt_entry->dev = str;
> + str += source_size; - strcpy( str, target );+ memcpy( str, target, target_size ); mt_entry->target = str;
> }
> - *target_length_ptr = target_length;+ *target_length_ptr = target_size - 1;
> return mt_entry;
> }
>
>
> *sh*
>
> 2010-08-26 Sebastian Huber <sebastian.huber at embedded-brains.de>
>
> * libcsupport/src/mount.c, libcsupport/src/mount-mgr.c: Avoid
> strcpy().
>
> M<http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/cpukit/ChangeLog.diff?r1=text&tr1=1.2609&r2=text&tr2=1.2610&diff_format=h>
> 1.2610cpukit/ChangeLog M<http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/cpukit/libcsupport/src/mount-mgr.c.diff?r1=text&tr1=1.5&r2=text&tr2=1.6&diff_format=h>
> 1.6cpukit/libcsupport/src/mount-mgr.c
>
> diff -u rtems/cpukit/ChangeLog:1.2609 rtems/cpukit/ChangeLog:1.2610
> --- rtems/cpukit/ChangeLog:1.2609 Fri Aug 27 01:29:25 2010
> +++ rtems/cpukit/ChangeLog Fri Aug 27 01:41:07 2010@@ -1,6 +1,7 @@ 2010-08-26 Sebastian Huber <sebastian.huber at 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 at oarcorp.com>
>
> diff -u rtems/cpukit/libcsupport/src/mount-mgr.c:1.5 rtems/cpukit/libcsupport/src/mount-mgr.c:1.6
> --- rtems/cpukit/libcsupport/src/mount-mgr.c:1.5 Sun Jul 4 09:53:44 2010
> +++ rtems/cpukit/libcsupport/src/mount-mgr.c Fri Aug 27 01:41:08 2010@@ -110,14 +110,15 @@ 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;
>
>
>
> *sh*
>
> 2010-08-26 Sebastian Huber <sebastian.huber at embedded-brains.de>
>
> * libfs/src/defaults/default_evalpath.c,
> libfs/src/defaults/default_evaluate_link.c: Removed superfluous
> assignment.
>
> M<http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/cpukit/ChangeLog.diff?r1=text&tr1=1.2610&r2=text&tr2=1.2611&diff_format=h>
> 1.2611cpukit/ChangeLog M<http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/cpukit/libfs/src/defaults/default_evalpath.c.diff?r1=text&tr1=1.3&r2=text&tr2=1.4&diff_format=h>
> 1.4cpukit/libfs/src/defaults/default_evalpath.c M<http://www.rtems.com/cgi-bin/viewcvs.cgi//rtems/cpukit/libfs/src/defaults/default_evaluate_link.c.diff?r1=text&tr1=1.1&r2=text&tr2=1.2&diff_format=h>
> 1.2cpukit/libfs/src/defaults/default_evaluate_link.c
>
> diff -u rtems/cpukit/ChangeLog:1.2610 rtems/cpukit/ChangeLog:1.2611
> --- rtems/cpukit/ChangeLog:1.2610 Fri Aug 27 01:41:07 2010
> +++ rtems/cpukit/ChangeLog Fri Aug 27 01:42:45 2010@@ -1,5 +1,11 @@ 2010-08-26 Sebastian Huber <sebastian.huber at embedded-brains.de>
> + * libfs/src/defaults/default_evalpath.c,
> + libfs/src/defaults/default_evaluate_link.c: Removed superfluous
> + assignment.
> +
> +2010-08-26 Sebastian Huber <sebastian.huber at embedded-brains.de>
> + * libcsupport/src/mount.c, libcsupport/src/mount-mgr.c: Avoid
> strcpy().
>
> diff -u rtems/cpukit/libfs/src/defaults/default_evalpath.c:1.3 rtems/cpukit/libfs/src/defaults/default_evalpath.c:1.4
> --- rtems/cpukit/libfs/src/defaults/default_evalpath.c:1.3 Tue Jun 29 14:37:28 2010
> +++ rtems/cpukit/libfs/src/defaults/default_evalpath.c Fri Aug 27 01:42:45 2010@@ -20,7 +20,6 @@ rtems_filesystem_location_info_t *pathloc /* IN/OUT */
> )
> {- pathloc = NULL; rtems_set_errno_and_return_minus_one( ENOTSUP );
> }
>
> diff -u rtems/cpukit/libfs/src/defaults/default_evaluate_link.c:1.1 rtems/cpukit/libfs/src/defaults/default_evaluate_link.c:1.2
> --- rtems/cpukit/libfs/src/defaults/default_evaluate_link.c:1.1 Tue Jun 29 14:37:28 2010
> +++ rtems/cpukit/libfs/src/defaults/default_evaluate_link.c Fri Aug 27 01:42:46 2010@@ -18,7 +18,6 @@ int flags /* IN */
> )
> {- pathloc = NULL; rtems_set_errno_and_return_minus_one( ENOTSUP );
> }
>
>
>
>
> --
> Generated by Deluxe Loginfo<http://www.codewiz.org/projects/index.html#loginfo>2.122 by Bernardo Innocenti <
> bernie at develer.com>
>
> _______________________________________________
> rtems-vc mailing list
> rtems-vc at rtems.org
> http://www.rtems.org/mailman/listinfo/rtems-vc
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/vc/attachments/20100827/dafcc955/attachment-0001.html>
More information about the vc
mailing list