schiers@imdm.uke.uni-hamburg.dbp.de (Carsten Schiers) (02/09/90)
I was wondering whether the users/who commands did no work. Here is the explanation to what happend. I heared that new STV1.5.0 postings have been made, maybe they include this and the previous qsort/ls bug fixes. I don't know, because the DFNet/BITNET link seems to be down. It was reported the /usr/src/lib/ansi/strncpy function would copy one more character than it should do. Something else happens. Look at the following code fragment: > while (count > 0 && (*dscan++ = *sscan++) != '\0') count--; > while (count > 0) { > *dscan++ = '\0'; count--; > } When the first while loop is terminated because of an \0 in the source string, it wants to fill up the leaving places with additional \0's. Since the source string's end test copies the first \0 itself, count is not propperly updated and one more \0 than neccessary is copied. This causes an error in the two continuous strncpy's in the routine wtmp() in login.c, and therefore invalid tty entries in the /usr/adm/wtmp file. But before this can happen, you have to include the formal argument specification of this wtmp() function, it is missing. Two cdiff's are included. Carsten Schiers --------------------------------------------- DFNet: schiers@imdm.uke.uni-hamburg.dbp.de Usenet: unido!imdm.uke.uni-hamburg.dbp.de!schiers Bitnet: schiers%imdm.uke.uni-hamburg.dbp.de@dfngate Internet: schiers%imdm.uke.uni-hamburg.dbp.de@relay.cs.net ----------------------- strncpy.c.cdiff ---------------------- -------------------------- cut here -------------------------- *** strncpy.c.150 Wed Feb 7 19:10:58 1990 --- strncpy.c Fri Feb 9 01:21:55 1990 *************** *** 16,21 **** --- 16,22 ---- sscan = src; count = n; while (count > 0 && (*dscan++ = *sscan++) != '\0') count--; + count--; while (count > 0) { *dscan++ = '\0'; count--; } ----------------------- login.c.cdiff ------------------------ -------------------------- cut here -------------------------- *** login.c.150 Thu Feb 8 20:23:16 1990 --- login.c Fri Feb 9 01:18:57 1990 *************** *** 170,175 **** --- 170,177 ---- } wtmp(tty, name) + char *tty; + char *name; { /* Make an entry in /usr/adm/wtmp. */