openbsd-ports/net/bitlbee/patches/patch-utils_bitlbeed_c

32 lines
1.2 KiB
Plaintext

$OpenBSD: patch-utils_bitlbeed_c,v 1.3 2006/04/11 15:11:33 naddy Exp $
--- utils/bitlbeed.c.orig Wed Jul 7 23:27:38 2004
+++ utils/bitlbeed.c Tue Nov 1 22:07:23 2005
@@ -120,8 +120,7 @@ int main( int argc, char *argv[] )
fcntl( serv_fd, F_SETFD, FD_CLOEXEC );
if (set->local) {
local_addr.sun_family = AF_LOCAL;
- strncpy( local_addr.sun_path, set->interface, sizeof( local_addr.sun_path ) - 1 );
- local_addr.sun_path[sizeof( local_addr.sun_path ) - 1] = '\0';
+ strlcpy( local_addr.sun_path, set->interface, sizeof( local_addr.sun_path ) );
/* warning - don't let untrusted users run this program if it
is setuid/setgid! Arbitrary file deletion risk! */
@@ -408,14 +407,14 @@ void do_log( char *fmt, ... )
memset( line, 0, MAX_LOG_LEN );
tm = time( NULL );
- strcpy( line, ctime( &tm ) );
+ strlcpy( line, ctime( &tm ), sizeof(line) );
l = strlen( line );
line[l-1] = ' ';
va_start( params, fmt );
- vsnprintf( line + l, MAX_LOG_LEN - l - 2, fmt, params );
+ vsnprintf( line + l, sizeof(line) - l - 2, fmt, params );
va_end( params );
- strcat( line, "\n" );
+ strlcat( line, "\n", sizeof(line) );
fprintf( logfile, "%s", line );
}