fixed classic off-by-one error in miget_attr_values()

For strings, the code is always forcing null termination
but was writing just after the last byte of the buffer.

Caught by clang address sanitizer, which detected the buffer overrun
in the "minc2-grpattr-test" test.

Added additional test too, that exercises truncation by 1 byte.