diff options
author | Thorsten Kukuk <kukuk@thkukuk.de> | 2006-06-14 21:20:48 +0000 |
---|---|---|
committer | Thorsten Kukuk <kukuk@thkukuk.de> | 2006-06-14 21:20:48 +0000 |
commit | f1ab2098f913a9f200787a9e9011cb80f11a30f2 (patch) | |
tree | bd518baa97e3b705f1307fb6be0837006506115c | |
parent | 7597e78f848298021aada04b50ced316d3e12837 (diff) | |
download | pam-f1ab2098f913a9f200787a9e9011cb80f11a30f2.tar.gz pam-f1ab2098f913a9f200787a9e9011cb80f11a30f2.tar.bz2 pam-f1ab2098f913a9f200787a9e9011cb80f11a30f2.zip |
Relevant BUGIDs:
Purpose of commit: cleanup
Commit summary:
---------------
2006-06-14 Thorsten Kukuk <kukuk@thkukuk.de>
* libpam/pam_misc.c (_pam_strdup): Use strlen and strcpy.
-rw-r--r-- | ChangeLog | 2 | ||||
-rw-r--r-- | libpam/pam_misc.c | 12 |
2 files changed, 7 insertions, 7 deletions
@@ -1,5 +1,7 @@ 2006-06-14 Thorsten Kukuk <kukuk@thkukuk.de> + * libpam/pam_misc.c (_pam_strdup): Use strlen and strcpy. + * configure.in: Remove --enable-memory-debug, add option to disable prelude if installed. diff --git a/libpam/pam_misc.c b/libpam/pam_misc.c index 78e317f7..770c9cce 100644 --- a/libpam/pam_misc.c +++ b/libpam/pam_misc.c @@ -122,16 +122,14 @@ char *_pam_strdup(const char *x) register char *new=NULL; if (x != NULL) { - register int i; + register int len; - for (i=0; x[i]; ++i); /* length of string */ - if ((new = malloc(++i)) == NULL) { - i = 0; + len = strlen (x) + 1; /* length of string including NUL */ + if ((new = malloc(len)) == NULL) { + len = 0; pam_syslog(NULL, LOG_CRIT, "_pam_strdup: failed to get memory"); } else { - while (i-- > 0) { - new[i] = x[i]; - } + strcpy (new, x); } x = NULL; } |