[net.notes] newsinput.c problem for long names.

dan@ciprico.UUCP (02/07/85)

There is another problem with newsinput.c....When receiving an article from
a path:  xx!yy!uu!user   The author's system & name are put into the correct
arrays, but the loops have the wrong termination variables.  The system
name terminates when it overflows NAMESZ  &  the author names terminates
when it overflows SYSSZ.   What I did was to simply change the code, thus:
-------------------Start of Code-----------
		/* 
		 * TEMPORARY KLUDGE...
		 * throw out domain part until host
		 * name length increased
		 */
		if ((c = line[j + i]) == '\0' || c == '.')
		    break;
		origsys[i] = c;
	    }
	    origsys[i] = '\0';
	}
	else
	{						/* host!user */
	    int     delim = j;

	    line[delim] = '\0';				/* drop uucp route */
	    for (i = delim - 1; i > 0; i--)
	    {
		if (line[i] == '!' || line[i] == ':')
		{
		    i++;
		    break;
		}
	    }
	    j = i;					/* copy host */
+	    for (i = 0; i < (SYSSZ - 1); i++)
	    {
		if ((c = line[j + i]) == '\0')
		    break;
		origsys[i] = c;
	    }
	    origsys[i] = '\0';
	    j = delim + 1;				/* copy user */
+	    for (i = 0; i < (NAMESZ - 1); i++)
	    {
		if ((c = line[j + i]) == '\0')
		    break;
		authname[i] = c;
	    }
	    authname[i] = '\0';
	}
    /* 
     * get fromsys, which is the first host in path
     */
    if (p = index (line, '!'))
    {
	*p = '\0';
	strncpy (fromsys, line, SYSSZ - 1);
    }
    else
	strcpy (fromsys, origsys);
}
-----------End of change, also the EOF of newsinput.c---------
Note: the + lines are the only ones that actually changed.  -Dan A. Dickey