openbsd-ports/sysutils/radmind/patches/patch-transcript_c
2007-04-01 07:08:39 +00:00

83 lines
2.8 KiB
Plaintext

$OpenBSD: patch-transcript_c,v 1.3 2007/04/01 07:08:39 steven Exp $
--- transcript.c.orig Thu Jan 20 23:44:35 2005
+++ transcript.c Sun Apr 1 08:18:32 2007
@@ -105,7 +105,7 @@ transcript_parse( struct transcript *tran )
exit( 2 );
}
- strcpy( tran->t_pinfo.pi_name, epath );
+ (void)strlcpy( tran->t_pinfo.pi_name, epath, sizeof( tran->t_pinfo.pi_name ) );
/* reading and parsing the line */
switch( *argv[ 0 ] ) {
@@ -175,7 +175,7 @@ transcript_parse( struct transcript *tran )
tran->t_fullname, tran->t_linenum );
exit( 2 );
}
- strcpy( tran->t_pinfo.pi_link, epath );
+ (void)strlcpy( tran->t_pinfo.pi_link, epath, sizeof( tran->t_pinfo.pi_link ) );
break;
case 'a': /* hfs applefile */
@@ -197,7 +197,7 @@ transcript_parse( struct transcript *tran )
exit( 2 );
}
}
- strcpy( tran->t_pinfo.pi_cksum_b64, argv[ 7 ] );
+ (void)strlcpy( tran->t_pinfo.pi_cksum_b64, argv[ 7 ], sizeof( tran->t_pinfo.pi_cksum_b64 ) );
break;
default:
@@ -615,17 +615,17 @@ transcript( char *path )
}
}
- strcpy( pi.pi_name, path );
+ (void)strlcpy( pi.pi_name, path, sizeof( pi.pi_name ) );
/* if it's multiply referenced, check if it's a hardlink */
if ( !S_ISDIR( pi.pi_stat.st_mode ) && ( pi.pi_stat.st_nlink > 1 ) &&
(( linkpath = hardlink( &pi )) != NULL )) {
pi.pi_type = 'h';
- strcpy( pi.pi_link, linkpath );
+ (void)strlcpy( pi.pi_link, linkpath, sizeof( pi.pi_link ) );
} else if ( S_ISLNK( pi.pi_stat.st_mode )) {
len = readlink( pi.pi_name, epath, MAXPATHLEN );
epath[ len ] = '\0';
- strcpy( pi.pi_link, epath );
+ (void)strlcpy( pi.pi_link, epath, sizeof( pi.pi_link ) );
}
/* By default, go into directories */
@@ -636,7 +636,7 @@ transcript( char *path )
}
/* initialize cksum field. */
- strcpy( pi.pi_cksum_b64, "-" );
+ (void)strlcpy( pi.pi_cksum_b64, "-", sizeof( pi.pi_cksum_b64 ) );
}
for (;;) {
@@ -685,9 +685,9 @@ t_new( int type, char *fullname, char *shortname, char
} else {
new->t_eof = 0;
new->t_linenum = 0;
- strcpy( new->t_shortname, shortname );
- strcpy( new->t_fullname, fullname );
- strcpy( new->t_kfile, kfile );
+ (void)strlcpy( new->t_shortname, shortname, sizeof( new->t_shortname ) );
+ (void)strlcpy( new->t_fullname, fullname, sizeof( new->t_fullname ) );
+ (void)strlcpy( new->t_kfile, kfile, sizeof( new->t_kfile ) );
if (( new->t_in = fopen( fullname, "r" )) == NULL ) {
perror( fullname );
exit( 2 );
@@ -752,7 +752,7 @@ transcript_init( char *kfile, int location )
"special path too long: %s%s\n", kdir, special );
exit( 2 );
}
- sprintf( fullpath, "%s%s", kdir, special );
+ (void)snprintf( fullpath, sizeof( fullpath ), "%s%s", kdir, special );
t_new( T_SPECIAL, fullpath, special, "special" );
}