soeren@xxxxxxxxxxxxxxxxx wrote: > xstrncpy(buf, name, namesz + 1); > + if (namesz == 0) { /* if xstrncpy didn't copy anything */ > + free(buf); > + buf = NULL; > + } This solution also has the issue that it handles the case incorrectly where xstrncpy actually calls strlen(3). I wanted to avoid that but maybe the best solution is to just change the xstrncpy API in a way that it indicates whether it has written anything through an int return value? Sorry for all the noise. Next time, I will just write a bug report... Greetings, Sören