libc: implement __strndup

Reviewed-by: Glauber Costa <glommer@cloudius-systems.com>
Signed-off-by: Jiao Xiang <jxwr.cn@gmail.com>
Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com>