[net.notes] bug in 'buildmap'

root@inmet.UUCP (10/10/84)

#N:inmet:7400003:000:615
inmet!root    Oct  9 00:03:00 1984

Users of Jeff Donnely's "buildmap" program -- you're in for some
trouble with the latest usenet map -- it contains a one-letter
name which causes the hash function in lookup() to screw up:


    len = strlen (sys_name);
    hash = (sys_name[0] - '0');
    hash = hash * 75 + (sys_name[1] - '0');
    hash = hash * 75 + (sys_name[len-1] -'0');
	/* Notice that this one reaches into nowhere if len < 2  -- nrh */
    hash = hash * 75 + (sys_name[len-2] - '0');
    
The fix is to test to be sure that len > 1 before using a value
like sys_name[len -2].  Sometimes, ada'd be better....

					Nat Howard
					inmet!nrh

donnelly@uiucdcsb.UUCP (10/12/84)

Sorry for the bug.

Who'd have thought of one letter site names?