What about diff and ssh and file? They all use the a copy of the same xmalloc.c.
On Mon, Jun 15, 2015 at 10:00:01AM +0200, Fritjof Bornebusch wrote: > Hi, > > thanks for the hint. > This one should do the trick. > > > > > Index: xmalloc.c > =================================================================== > RCS file: /cvs/src/usr.bin/rcs/xmalloc.c,v > retrieving revision 1.9 > diff -u -p -r1.9 xmalloc.c > --- xmalloc.c 13 Jun 2015 20:15:21 -0000 1.9 > +++ xmalloc.c 15 Jun 2015 07:52:15 -0000 > @@ -68,13 +68,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); > - if (strlcpy(cp, str, len) >= len) > - errx(1, "xstrdup: string truncated"); > + > + if ((cp = strdup(str)) == NULL) > + err(1, "xstrdup"); > return cp; > } >