openbsd-ports/sysutils/radmind/patches/patch-hardlink_c

29 lines
978 B
Plaintext
Raw Normal View History

$OpenBSD: patch-hardlink_c,v 1.1.1.1 2004/06/26 19:00:48 sturm Exp $
--- hardlink.c.orig 2003-05-20 18:23:11.000000000 -0400
+++ hardlink.c 2004-06-12 23:03:23.000000000 -0400
@@ -79,6 +79,7 @@ d_insert( struct devlist **dev_head, str
i_insert( struct devlist *dev_head, struct pathinfo *pinfo )
{
struct inolist *new, **cur;
+ size_t buflen;
for ( cur = &dev_head->d_ilist; *cur != NULL; cur = &(*cur)->i_next ) {
if ( pinfo->pi_stat.st_ino <= (*cur)->i_ino ) {
@@ -96,13 +97,14 @@ i_insert( struct devlist *dev_head, stru
exit( 2 );
}
- if (( new->i_name = ( char * ) malloc( strlen( pinfo->pi_name ) + 1 ))
+ buflen = strlen( pinfo->pi_name ) + 1;
+ if (( new->i_name = ( char * ) malloc( buflen ))
== NULL ) {
perror( "i_insert malloc" );
exit( 2 );
}
- strcpy( new->i_name, pinfo->pi_name );
+ (void)strlcpy( new->i_name, pinfo->pi_name, buflen );
new->i_ino = pinfo->pi_stat.st_ino;
new->i_flag = 0;