Module Name: src Committed By: christos Date: Thu Oct 3 17:56:17 UTC 2019
Modified Files: src/lib/librmt: rmtlib.c Log Message: - user (an alias to the login buffer should be NUL terminated so use strlcpy - double the size of the resulting buffer so that it can fit a copy of the same sized buffer + more. To generate a diff of this commit: cvs rdiff -u -r1.26 -r1.27 src/lib/librmt/rmtlib.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/lib/librmt/rmtlib.c diff -u src/lib/librmt/rmtlib.c:1.26 src/lib/librmt/rmtlib.c:1.27 --- src/lib/librmt/rmtlib.c:1.26 Wed Mar 21 06:10:37 2012 +++ src/lib/librmt/rmtlib.c Thu Oct 3 13:56:17 2019 @@ -1,4 +1,4 @@ -/* $NetBSD: rmtlib.c,v 1.26 2012/03/21 10:10:37 matt Exp $ */ +/* $NetBSD: rmtlib.c,v 1.27 2019/10/03 17:56:17 christos Exp $ */ /* * rmt --- remote tape emulator subroutines @@ -28,7 +28,7 @@ */ #include <sys/cdefs.h> -__RCSID("$NetBSD: rmtlib.c,v 1.26 2012/03/21 10:10:37 matt Exp $"); +__RCSID("$NetBSD: rmtlib.c,v 1.27 2019/10/03 17:56:17 christos Exp $"); #define RMTIOCTL 1 /* #define USE_REXEC 1 */ /* rexec code courtesy of Dan Kegel, srs!dan */ @@ -249,7 +249,7 @@ static int _rmt_open(const char *path, int oflag, int mode) { int i; - char buffer[BUFMAGIC]; + char buffer[2 * BUFMAGIC]; char host[MAXHOSTLEN]; char device[BUFMAGIC]; char login[BUFMAGIC]; @@ -292,7 +292,7 @@ _rmt_open(const char *path, int oflag, i path++; if (*(path - 1) == '@') { - (void)strncpy(user, host, sizeof(login) - 1); + (void)strlcpy(user, host, sizeof(login)); /* saw user part of user@host */ sys = host; /* start over */ while (*path != ':') {