diff lib/pty.c @ 249:094e83b55cb1

2003-8-7 Brian Masney <masneyb@gftp.org> * lib/cache.c lib/misc.c lib/protocols.c lib/pty.c - make sure a NUL byte appears at the end of the buffer after the call to strncpy * lib/rfc959.c - increased buffer size to directory parsing routine
author masneyb
date Fri, 08 Aug 2003 02:24:54 +0000
parents 1638e32e6a35
children 656a0b3d1403
line wrap: on
line diff
--- a/lib/pty.c	Fri Aug 08 01:38:12 2003 +0000
+++ b/lib/pty.c	Fri Aug 08 02:24:54 2003 +0000
@@ -40,6 +40,7 @@
     return (GFTP_ERETRYABLE);
 
   strncpy (pts_name, new_pts_name, len);
+  pts_name[len - 1] = '\0';
 
   return (fdm);
 }
@@ -141,6 +142,7 @@
     }
 
   strncpy (pts_name, new_pts_name, len);
+  pts_name[len - 1] = '\0';
 
   return (fdm);
 }
@@ -187,6 +189,8 @@
   g_return_val_if_fail (len >= 10, GFTP_EFATAL);
 
   strncpy (pts_name, "/dev/ptyXY", len);
+  pts_name[len - 1] = '\0';
+
   for (pos1 = "pqrstuvwxyzPQRST"; *pos1 != '\0'; pos1++) 
     {
       pts_name[8] = *pos1;