#define        strdupa(x)      strcpy(alloca(strlen(x)+1),x)
+#define        strndupa(x, n)  strlcpy(alloca(strnlen((x), (n)), (x), (n))

This causes the parameters to be evaluated multiple times -- and that is also a problem with the existing strdupa. Unfortunately it's impossible to implement these macros without multiple-evaluation, unless you use the GCC statement-expression language extension (as glibc does).

IMO, musl should either use that extension, despite the general policy of avoiding such non-standard language extensions, or simply not implement these functions at all. Implementing them, but having them incorrectly multiply-evaluate the parameters seems like the worst of the options...