82806daf7d
from maintainer William Yodlowsky <bsd@openbsd.rutgers.edu>
83 lines
2.7 KiB
Plaintext
83 lines
2.7 KiB
Plaintext
$OpenBSD: patch-transcript_c,v 1.2 2005/01/26 00:33:30 pvalchev Exp $
|
|
--- transcript.c.orig Thu Jan 6 08:37:55 2005
|
|
+++ transcript.c Thu Jan 20 13:02:32 2005
|
|
@@ -99,7 +99,7 @@ transcript_parse( struct transcript *tra
|
|
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 ] ) {
|
|
@@ -169,7 +169,7 @@ transcript_parse( struct transcript *tra
|
|
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 */
|
|
@@ -191,7 +191,7 @@ transcript_parse( struct transcript *tra
|
|
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:
|
|
@@ -598,17 +598,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 */
|
|
@@ -619,7 +619,7 @@ transcript( char *path )
|
|
}
|
|
|
|
/* initialize cksum field. */
|
|
- strcpy( pi.pi_cksum_b64, "-" );
|
|
+ (void)strlcpy( pi.pi_cksum_b64, "-", sizeof( pi.pi_cksum_b64 ) );
|
|
}
|
|
|
|
for (;;) {
|
|
@@ -668,9 +668,9 @@ t_new( int type, char *fullname, char *s
|
|
} 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 );
|
|
@@ -735,7 +735,7 @@ transcript_init( char *kfile, int locati
|
|
"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" );
|
|
}
|
|
|