Avoid potential non-terminated string

The method strncpy() does not null-terminated the destination in
the event that the source doesn't fit.  So we assure our 'name'
is null-terminated before we take its length.

We also change another strncpy() call to memcpy(), to represent
exactly what it is (the copy of an exactly known number of bytes,
since we've already determined the string length).

Test: Treehugger
Change-Id: I55152c57b06f5a1f7322e6d36c73b3a582fd5e49
1 file changed