diff --git a/vvp/config.h.in b/vvp/config.h.in index 981907ecf..d3dc260c6 100644 --- a/vvp/config.h.in +++ b/vvp/config.h.in @@ -1,7 +1,7 @@ #ifndef IVL_config_H #define IVL_config_H /* - * Copyright (c) 2001-2014 Stephen Williams (steve@icarus.com) + * Copyright (c) 2001-2022 Stephen Williams (steve@icarus.com) * * This source code is free software; you can redistribute it * and/or modify it in source code form under the terms of the GNU @@ -204,9 +204,9 @@ inline int64_t i64round(double x) static inline char*strndup(const char*s, size_t n) { if (strlen(s) < n) return strdup(s); - char*tmp = (char*)malloc(n); + char*tmp = (char*)malloc(n+1); strncpy(tmp, s, n); - tmp[n-1] = 0; + tmp[n] = 0; return tmp; } #endif