fsp/leds: improve string operations bounds checking
fsp/leds: improve string operations bounds checking

The current code has a few possible issues with string handling, and
gcc flags a number of string / buffer warnings when enabling more
checking.

Some of the issues in the file:

- Mixing of null-terminated arrays (in most cases), and non-null in the
  input/output buffer format. memcpy generally should be used when the
  length is known.
- Lack of input data length bounds checking. Malformed input could
  cause overruns.
- String copying from same sized source and destination array sizes,
  where the source is a NUL terminated string, so the strncpy copies
  the string without its NUL terminator, which becomes NUL terminated
  at the zeroed destination array. Compiler does not like this, and
  it only works if the destination has been zeroed, so not a great
  pattern.
- Attemping to NUL terminate string using strcat, which will overwrite
  a byte past the end of the array if the string length is at maximum,
  or worse if the input was malformed.

This patch fixes several of these issues and fixes a number of compiler
warnings. In general, the buffer and string handling could probably
benefit from a more in-depth audit.

Reviewed-by: Vasant Hegde <a6d753843573f7bfed5075c1e875b0be8007a0ab@linux.vnet.ibm.com>
Tested-by: Vasant Hegde <a6d753843573f7bfed5075c1e875b0be8007a0ab@linux.vnet.ibm.com>
Signed-off-by: Nicholas Piggin <24829078df5003d9dd1dd871ca2aeb0b1cf95ef4@gmail.com>
Signed-off-by: Stewart Smith <ec31ab75ddf977353c8f660f92ea8b23f64aef25@linux.ibm.com>

stewart-ibm/skiboot,legoater/skiboot,qemu/skiboot,stewart-ibm/skiboot,open-power/skiboot,legoater/skiboot,qemu/skiboot,open-power/skiboot,open-power/skiboot,stewart-ibm/skiboot,shenki/skiboot,shenki/skiboot,open-power/skiboot,legoater/skiboot,open-power/skiboot,qemu/skiboot,legoater/skiboot,qemu/skiboot,shenki/skiboot,shenki/skiboot,legoater/skiboot,qemu/skiboot,shenki/skiboot