HPCC-10557  Fix potential buffer overrun

Signed-off-by: Gleb Aronsky <gleb.aronsky@lexisnexis.com>
Merge pull request #5237 from garonsky/HPCC-10557

HPCC-10557  Fix potential buffer overrun

Reviewed-by: Gavin Halliday <ghalliday@hpccsystems.com>