#if defined(_WIN32)
#include <stdlib.h>
+#include <string.h>
#include "strndup.h"
char *
if (!str)
return NULL;
- n = strlen(str);
- if (n > max)
- n = max;
-
+ n = strnlen(str, max);
ptr = (char *) calloc(n + 1, sizeof(char));
if (!ptr)
return NULL;