=================================================================== RCS file: /cvs/mandoc/mandoc_aux.c,v retrieving revision 1.10 retrieving revision 1.12 diff -u -p -r1.10 -r1.12 --- mandoc/mandoc_aux.c 2017/06/12 19:05:47 1.10 +++ mandoc/mandoc_aux.c 2022/04/14 16:43:44 1.12 @@ -1,7 +1,7 @@ -/* $Id: mandoc_aux.c,v 1.10 2017/06/12 19:05:47 schwarze Exp $ */ +/* $Id: mandoc_aux.c,v 1.12 2022/04/14 16:43:44 schwarze Exp $ */ /* + * Copyright (c) 2014, 2015, 2017, 2018 Ingo Schwarze * Copyright (c) 2009, 2011 Kristaps Dzonsons - * Copyright (c) 2014, 2015, 2017 Ingo Schwarze * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above @@ -27,6 +27,7 @@ #include #include +#define DEBUG_NODEF 1 #include "mandoc.h" #include "mandoc_aux.h" @@ -111,8 +112,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; }