Fix potential missing '\0' when wrapping to legacy
am: 2b275704bc

Change-Id: Ie1ba5bdb79310bbb00a5b63690f2d2edebd4001d