* krlogind.c (doit): Fix up potential buffer overrun.
authorTom Yu <tlyu@mit.edu>
Wed, 5 Nov 1997 02:20:18 +0000 (02:20 +0000)
committerTom Yu <tlyu@mit.edu>
Wed, 5 Nov 1997 02:20:18 +0000 (02:20 +0000)
[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
src/appl/bsd/krcp.c
src/appl/bsd/krlogin.c
src/appl/bsd/krlogind.c

index 214dc07e16d45b3cc648c0bd9daed258203ba994..e0ff846b265fd02923d98029fa6b1b85b6908c4b 100644 (file)
@@ -1,3 +1,12 @@
+Mon Nov  3 15:25:48 1997  Tom Yu  <tlyu@mit.edu>
+
+       * 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  <tytso@mit.edu>
 
        * v4rcp.M: Removed useless .so to a non-existent macro file.
index 10819afb603af0fef8af643548ce014f03958f16..5da0fadc009bfff2d966582d759c65ffe69aa23e 100644 (file)
@@ -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);
     
index 9fa7aa20cb17e4a1c9b4c65500a34f869060aab4..ada567013b286157081979103b4b0f639a9a3afe 100644 (file)
@@ -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);
index 167d98f6795b6b2280ff527da1395d4d076b4231..00421cf59a299cb0198edbc84fd8ff9c341e5876 100644 (file)
@@ -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");