1 /* $FreeBSD: src/contrib/libpam/libpam_misc/xstrdup.c,v 1.2.6.2 2001/06/11 15:28:15 markm Exp $ */
2 /* $Header: /home/morgan/pam/Linux-PAM-0.53/libpam_misc/RCS/xstrdup.c,v 1.4 1996/11/10 20:10:56 morgan Exp $ */
6 * Revision 1.4 1996/11/10 20:10:56 morgan
7 * modification for stack paranoia
12 #include <security/pam_misc.h>
15 * Safe duplication of character strings. "Paranoid"; don't leave
16 * evidence of old token around for later stack analysis.
19 char *xstrdup(const char *x)
21 register char *new=NULL;
26 for (i=0; x[i]; ++i); /* length of string */
27 if ((new = malloc(++i)) == NULL) {
37 return new; /* return the duplicate or NULL on error */