A logic flaw is resulting in the last NULL after the max length is reached to be printed.
When the strnlen() calculates the length and the calculated length is the requested max length, the subsequent line attempts to print any NULLs.
This is normally fine, except that it needs to check to make sure that "i" is less than the requested max length.