Hi tech@, as requested by nicm@, xstrdup just wrappes strdup(3).
Regards, --F. Index: xmalloc.c =================================================================== RCS file: /cvs/src/usr.bin/ssh/xmalloc.c,v retrieving revision 1.32 diff -u -p -r1.32 xmalloc.c --- xmalloc.c 24 Apr 2015 01:36:01 -0000 1.32 +++ xmalloc.c 17 Jun 2015 18:42:43 -0000 @@ -13,6 +13,7 @@ * called by a name other than "ssh" or "Secure Shell". */ +#include <errno.h> #include <stdarg.h> #include <stdint.h> #include <stdio.h> @@ -66,12 +67,10 @@ xreallocarray(void *ptr, size_t nmemb, s char * xstrdup(const char *str) { - size_t len; char *cp; - len = strlen(str) + 1; - cp = xmalloc(len); - strlcpy(cp, str, len); + if ((cp = strdup(str)) == NULL) + fatal("xstrdup: %s", strerror(errno)); return cp; }