Fix Klocwork errors in liblight

1. Fix null pointer de-reference klocwork error in liblight.
2. sprintf is part of ScanBan function. Replace sprintf with snprintf.

Change-Id: If408be6040481f5edda78cfeed477b30ab5b5e73