- 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.
This commit is contained in:
christos 2019-10-03 17:56:17 +00:00
parent f1768a45f2
commit d3574aa770
1 changed files with 4 additions and 4 deletions

View File

@ -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, int mode)
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 != ':') {