2114697ef0
from William Yodlowsky (MAINTAINER)
85 lines
3.0 KiB
Plaintext
85 lines
3.0 KiB
Plaintext
$OpenBSD: patch-transcript_c,v 1.4 2007/09/04 20:52:13 jasper Exp $
|
|
--- transcript.c.orig Thu May 31 17:26:47 2007
|
|
+++ transcript.c Wed Jul 18 09:41:17 2007
|
|
@@ -108,7 +108,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 ] ) {
|
|
@@ -178,7 +178,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 */
|
|
@@ -200,7 +200,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:
|
|
@@ -631,7 +631,7 @@ transcript( char *path, struct stat *st, char *type, s
|
|
* exhausted, to consume any remaining transcripts.
|
|
*/
|
|
if ( path != NULL ) {
|
|
- strcpy( pi.pi_name, path );
|
|
+ (void)strlcpy( pi.pi_name, path, sizeof( pi.pi_name ) );
|
|
pi.pi_stat = *st;
|
|
pi.pi_type = *type;
|
|
pi.pi_afinfo = *afinfo;
|
|
@@ -640,11 +640,11 @@ transcript( char *path, struct stat *st, char *type, s
|
|
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 */
|
|
@@ -655,7 +655,7 @@ transcript( char *path, struct stat *st, char *type, s
|
|
}
|
|
|
|
/* initialize cksum field. */
|
|
- strcpy( pi.pi_cksum_b64, "-" );
|
|
+ (void)strlcpy( pi.pi_cksum_b64, "-", sizeof( pi.pi_cksum_b64 ) );
|
|
}
|
|
|
|
for (;;) {
|
|
@@ -708,9 +708,9 @@ t_new( int type, char *fullname, char *shortname, char
|
|
case T_SPECIAL :
|
|
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 );
|
|
@@ -844,7 +844,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" );
|
|
}
|
|
|