Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/librmt - user (an alias to the login buffer should be NU...
details: https://anonhg.NetBSD.org/src/rev/31569fbd487d
branches: trunk
changeset: 459980:31569fbd487d
user: christos <christos%NetBSD.org@localhost>
date: Thu Oct 03 17:56:17 2019 +0000
description:
- 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.
diffstat:
lib/librmt/rmtlib.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diffs (36 lines):
diff -r 5a82d0f62f31 -r 31569fbd487d lib/librmt/rmtlib.c
--- a/lib/librmt/rmtlib.c Thu Oct 03 17:46:56 2019 +0000
+++ b/lib/librmt/rmtlib.c Thu Oct 03 17:56:17 2019 +0000
@@ -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 @@
_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 @@
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 != ':') {
Home |
Main Index |
Thread Index |
Old Index