MFH: r453586
This update fixes a potential buffer overflow and a memory corruption bug.
Approved by: ports-secteam (swills)