=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/ftp/complete.c,v retrieving revision 1.10 retrieving revision 1.11 diff -c -r1.10 -r1.11 *** src/usr.bin/ftp/complete.c 2001/03/09 17:01:02 1.10 --- src/usr.bin/ftp/complete.c 2001/06/26 23:44:00 1.11 *************** *** 1,4 **** ! /* $OpenBSD: complete.c,v 1.10 2001/03/09 17:01:02 millert Exp $ */ /* $NetBSD: complete.c,v 1.10 1997/08/18 10:20:18 lukem Exp $ */ /*- --- 1,4 ---- ! /* $OpenBSD: complete.c,v 1.11 2001/06/26 23:44:00 lebel Exp $ */ /* $NetBSD: complete.c,v 1.10 1997/08/18 10:20:18 lukem Exp $ */ /*- *************** *** 39,45 **** #ifndef SMALL #ifndef lint ! static char rcsid[] = "$OpenBSD: complete.c,v 1.10 2001/03/09 17:01:02 millert Exp $"; #endif /* not lint */ /* --- 39,45 ---- #ifndef SMALL #ifndef lint ! static char rcsid[] = "$OpenBSD: complete.c,v 1.11 2001/06/26 23:44:00 lebel Exp $"; #endif /* not lint */ /* *************** *** 113,120 **** matchlen = j; } if (matchlen > wordlen) { ! (void)strncpy(insertstr, lastmatch, matchlen); ! insertstr[matchlen] = '\0'; if (el_insertstr(el, insertstr + wordlen) == -1) return (CC_ERROR); else --- 113,119 ---- matchlen = j; } if (matchlen > wordlen) { ! (void)strlcpy(insertstr, lastmatch, matchlen+1); if (el_insertstr(el, insertstr + wordlen) == -1) return (CC_ERROR); else *************** *** 183,190 **** dir[0] = '/'; dir[1] = '\0'; } else { ! (void)strncpy(dir, word, (size_t)(file - word)); ! dir[file - word] = '\0'; } file++; } --- 182,188 ---- dir[0] = '/'; dir[1] = '\0'; } else { ! (void)strlcpy(dir, word, (size_t)(file - word) + 1); } file++; } *************** *** 241,248 **** cp = file; while (*cp == '/' && cp > word) cp--; ! (void)strncpy(dir, word, (size_t)(cp - word + 1)); ! dir[cp - word + 1] = '\0'; file++; } --- 239,245 ---- cp = file; while (*cp == '/' && cp > word) cp--; ! (void)strlcpy(dir, word, (size_t)(cp - word + 2)); file++; } *************** *** 317,324 **** len = lf->lastchar - lf->buffer; if (len >= sizeof(line)) return (CC_ERROR); ! (void)strncpy(line, lf->buffer, len); ! line[len] = '\0'; cursor_pos = line + (lf->cursor - lf->buffer); lastc_argc = cursor_argc; /* remember last cursor pos */ lastc_argo = cursor_argo; --- 314,320 ---- len = lf->lastchar - lf->buffer; if (len >= sizeof(line)) return (CC_ERROR); ! (void)strlcpy(line, lf->buffer, len+1); cursor_pos = line + (lf->cursor - lf->buffer); lastc_argc = cursor_argc; /* remember last cursor pos */ lastc_argo = cursor_argo; *************** *** 333,340 **** && strncmp(word, margv[cursor_argc], cursor_argo) == 0) dolist = 1; else ! (void)strncpy(word, margv[cursor_argc], cursor_argo); ! word[cursor_argo] = '\0'; if (cursor_argc == 0) return (complete_command(word, dolist)); --- 329,335 ---- && strncmp(word, margv[cursor_argc], cursor_argo) == 0) dolist = 1; else ! (void)strlcpy(word, margv[cursor_argc], cursor_argo+1); if (cursor_argc == 0) return (complete_command(word, dolist));