From 4e83c2369a9f674cfacd0a1f6ba4d35d276b7b81 Mon Sep 17 00:00:00 2001 From: Tom Yu Date: Wed, 5 Nov 1997 02:20:18 +0000 Subject: [PATCH] * krlogind.c (doit): Fix up potential buffer overrun. [krb5-appl/488] * krlogin.c (main): Fix up potential buffer overrun. * krcp.c (hosteq): Fix up potential buffer overrun. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@10267 dc483132-0cff-0310-8789-dd5450dbe970 --- src/appl/bsd/ChangeLog | 9 +++++++++ src/appl/bsd/krcp.c | 3 ++- src/appl/bsd/krlogin.c | 6 ++++-- src/appl/bsd/krlogind.c | 5 ++++- 4 files changed, 19 insertions(+), 4 deletions(-) diff --git a/src/appl/bsd/ChangeLog b/src/appl/bsd/ChangeLog index 214dc07e1..e0ff846b2 100644 --- a/src/appl/bsd/ChangeLog +++ b/src/appl/bsd/ChangeLog @@ -1,3 +1,12 @@ +Mon Nov 3 15:25:48 1997 Tom Yu + + * krlogind.c (doit): Fix up potential buffer overrun. + [krb5-appl/488] + + * krlogin.c (main): Fix up potential buffer overrun. + + * krcp.c (hosteq): Fix up potential buffer overrun. + Tue Oct 7 18:01:15 1997 Theodore Y. Ts'o * v4rcp.M: Removed useless .so to a non-existent macro file. diff --git a/src/appl/bsd/krcp.c b/src/appl/bsd/krcp.c index 10819afb6..5da0fadc0 100644 --- a/src/appl/bsd/krcp.c +++ b/src/appl/bsd/krcp.c @@ -1203,7 +1203,8 @@ int hosteq(h1, h2) if ((h_ptr = gethostbyname(h1)) == NULL) return(0); - strcpy(hname1, h_ptr->h_name); + strncpy(hname1, h_ptr->h_name, sizeof (hname1)); + hname1[sizeof (hname1) - 1] = '\0'; if ((h_ptr = gethostbyname(h2)) == NULL) return(0); diff --git a/src/appl/bsd/krlogin.c b/src/appl/bsd/krlogin.c index 9fa7aa20c..ada567013 100644 --- a/src/appl/bsd/krlogin.c +++ b/src/appl/bsd/krlogin.c @@ -509,8 +509,10 @@ main(argc, argv) if (cp == (char *) NULL) cp = getenv("TERM"); - if (cp) - (void) strcpy(term, cp); + if (cp) { + (void) strncpy(term, cp, sizeof (term)); + term[sizeof (term) - 1] = '\0'; + } #ifdef POSIX_TERMIOS if (tcgetattr(0, &ttyb) == 0) { int ospeed = cfgetospeed (&ttyb); diff --git a/src/appl/bsd/krlogind.c b/src/appl/bsd/krlogind.c index 167d98f67..00421cf59 100644 --- a/src/appl/bsd/krlogind.c +++ b/src/appl/bsd/krlogind.c @@ -596,7 +596,10 @@ int syncpipe[2]; } /* Save hostent information.... */ - else strcpy(rhost_name,hp->h_name); + else { + strncpy(rhost_name,hp->h_name,sizeof (rhost_name)); + rhost_name[sizeof (rhost_name) - 1] = '\0'; + } if (fromp->sin_family != AF_INET) fatal(f, "Permission denied - Malformed from address\n"); -- 2.26.2