Allocate and duplicate a string up to n bytes.
string to duplicate (or NULL).
maximum number of bytes to copy (excluding the terminating zero).
a pointer to newly allocated memory initialized to string s up to the first n bytes (and always zero terminated), or NULL if either out of memory or if s is NULL.
Replacement for the standard strndup() such that mi_free() can be used on the returned result.