check len before memcpying into it

valgrind + bff on sf_3e0068c9b19bb548826bed0599f65745-CrdWMI-minimized.gif

Change-Id: I74cc21609f1c97a27e13615593f678cbbc8463e3
drop unnecessary shl.hxx includes

Change-Id: Ieb984987c4a4f888a563377e0500444b12f43506