Fix potential buffer overflow.
Along the way improve port Makefile
PR: 252321 Submitted by: daniel.engberg.lists@pyret.net