Open MIvanchev opened 2 weeks ago
#ifndef HAVE_STRNDUPA static inline char *strndupa(const char *old, size_t n) { size_t len = strnlen(old, n); char *tmp = alloca(len + 1); tmp[len] = 0; return memcpy(tmp, old, len); } #endif
This code is undefined behavior, a pointer to stack memory is returned but the stack memory is reclaimed immediately. See our build for Void Linux https://github.com/void-linux/void-packages/pull/50666
This code is undefined behavior, a pointer to stack memory is returned but the stack memory is reclaimed immediately. See our build for Void Linux https://github.com/void-linux/void-packages/pull/50666