AGI: Fix buffer overrun. CID 1004030
AGI: Fix buffer overrun. CID 1004033
AGI: Fix potential buffer overrun. CID 1004028