summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--mandoc_aux.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/mandoc_aux.c b/mandoc_aux.c
index 78466d95..f1dce2e8 100644
--- a/mandoc_aux.c
+++ b/mandoc_aux.c
@@ -111,8 +111,8 @@ mandoc_strndup(const char *ptr, size_t sz)
{
char *p;
- p = mandoc_malloc(sz + 1);
- memcpy(p, ptr, sz);
- p[(int)sz] = '\0';
+ p = strndup(ptr, sz);
+ if (p == NULL)
+ err((int)MANDOCLEVEL_SYSERR, NULL);
return p;
}