Merge "pal: check for buffer overflow"