Fix a number of buffer overflow conditions.
Fix a number of buffer overflow conditions.

PR:		bin/4610
Submitted by:	David Holland (dholland@burgundy.eecs.harvard.edu)

jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase