Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/bin/rcp misuse of strncpy. PR 21201 from Christian Biere.



details:   https://anonhg.NetBSD.org/src/rev/cca8eaa76ea1
branches:  trunk
changeset: 545735:cca8eaa76ea1
user:      itojun <itojun%NetBSD.org@localhost>
date:      Wed Apr 16 07:10:00 2003 +0000

description:
misuse of strncpy.  PR 21201 from Christian Biere.

diffstat:

 bin/rcp/rcp.c |  8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diffs (29 lines):

diff -r 2495862f456b -r cca8eaa76ea1 bin/rcp/rcp.c
--- a/bin/rcp/rcp.c     Wed Apr 16 03:16:38 2003 +0000
+++ b/bin/rcp/rcp.c     Wed Apr 16 07:10:00 2003 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: rcp.c,v 1.30 2002/11/22 21:46:02 ragge Exp $   */
+/*     $NetBSD: rcp.c,v 1.31 2003/04/16 07:10:00 itojun Exp $  */
 
 /*
  * Copyright (c) 1983, 1990, 1992, 1993
@@ -43,7 +43,7 @@
 #if 0
 static char sccsid[] = "@(#)rcp.c      8.2 (Berkeley) 4/2/94";
 #else
-__RCSID("$NetBSD: rcp.c,v 1.30 2002/11/22 21:46:02 ragge Exp $");
+__RCSID("$NetBSD: rcp.c,v 1.31 2003/04/16 07:10:00 itojun Exp $");
 #endif
 #endif /* not lint */
 
@@ -135,7 +135,9 @@
 #ifdef KERBEROS
                case 'k':
                        dest_realm = dst_realm_buf;
-                       (void)strncpy(dst_realm_buf, optarg, REALM_SZ);
+                       if (strlcpy(dst_realm_buf, optarg,
+                           sizeof(dst_realm_buf)) >= sizeof(dst_realm_buf))
+                               errx(1, "Argument `realm' is too long");
                        break;
 #ifdef CRYPT
                case 'x':



Home | Main Index | Thread Index | Old Index