29 lines
981 B
Plaintext
29 lines
981 B
Plaintext
$OpenBSD: patch-hardlink_c,v 1.3 2007/09/04 20:52:13 jasper Exp $
|
|
--- hardlink.c.orig Tue May 20 18:23:11 2003
|
|
+++ hardlink.c Wed Jul 18 09:41:16 2007
|
|
@@ -79,6 +79,7 @@ d_insert( struct devlist **dev_head, struct pathinfo *
|
|
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, struct pathinfo *p
|
|
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;
|
|
|