diff options
author | Doug Rabson <dfr@FreeBSD.org> | 2008-05-07 13:39:42 +0000 |
---|---|---|
committer | Doug Rabson <dfr@FreeBSD.org> | 2008-05-07 13:39:42 +0000 |
commit | c19800e8cd5640693f36f2040db4ab5e8d738146 (patch) | |
tree | 4dbb862199a916e3ffe75f1cb08703ec0e662ffc /crypto/heimdal/kadmin/random_password.c | |
parent | 8d4ba808a53020900c275b6f1cf21fc6e9f3bf36 (diff) | |
download | src-c19800e8cd5640693f36f2040db4ab5e8d738146.tar.gz src-c19800e8cd5640693f36f2040db4ab5e8d738146.zip |
Vendor import of Heimdal 1.1
Notes
Notes:
svn path=/vendor-crypto/heimdal/dist/; revision=178825
Diffstat (limited to 'crypto/heimdal/kadmin/random_password.c')
-rw-r--r-- | crypto/heimdal/kadmin/random_password.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/crypto/heimdal/kadmin/random_password.c b/crypto/heimdal/kadmin/random_password.c index 92fb2fcddb97..d56dd941f39f 100644 --- a/crypto/heimdal/kadmin/random_password.c +++ b/crypto/heimdal/kadmin/random_password.c @@ -33,7 +33,7 @@ #include "kadmin_locl.h" -RCSID("$Id: random_password.c,v 1.4 2001/02/15 04:20:53 assar Exp $"); +RCSID("$Id: random_password.c 21745 2007-07-31 16:11:25Z lha $"); /* This file defines some a function that generates a random password, that can be used when creating a large amount of principals (such @@ -123,7 +123,11 @@ generate_password(char **pw, int num_classes, ...) unsigned char rbuf[8]; /* random buffer */ int rleft = 0; + *pw = NULL; + classes = malloc(num_classes * sizeof(*classes)); + if(classes == NULL) + return; va_start(ap, num_classes); len = 0; for(i = 0; i < num_classes; i++){ @@ -134,8 +138,10 @@ generate_password(char **pw, int num_classes, ...) } va_end(ap); *pw = malloc(len + 1); - if(*pw == NULL) + if(*pw == NULL) { + free(classes); return; + } for(i = 0; i < len; i++) { int j; int x = RND(rbuf, sizeof(rbuf), &rleft) % (len - i); |