Fix undefined value access in cork_strndup

The `cork_strndup` function lets you duplicate a string that you provide
the length of (as opposed to `cork_strdup` which uses `strlen` to
calculate the length of the string).  That means that the string to be
copied doesn't need to be NUL-terminated.  However, when actually
performing the copy, we were assuming that it is NUL-terminated, giving
us an undefined value access error in valgrind.