buffer overflow patches from mhpower@mit.edu (Matt Power)