diff options
author | Greg Hudson <ghudson@mit.edu> | 2008-10-20 21:14:47 +0000 |
---|---|---|
committer | Greg Hudson <ghudson@mit.edu> | 2008-10-20 21:14:47 +0000 |
commit | ae423f53214830de1367627180031283de998746 (patch) | |
tree | f3268a5a9d718d570883bf296c52c117e0dfc709 /src/clients/kpasswd | |
parent | cdea7397975a960e3c02479f8aa4ede0bc349105 (diff) | |
download | krb5-ae423f53214830de1367627180031283de998746.zip krb5-ae423f53214830de1367627180031283de998746.tar.gz krb5-ae423f53214830de1367627180031283de998746.tar.bz2 |
Use asprintf instead of malloc/strcpy/strcat in many places
ticket: 6200
status: open
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@20901 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/clients/kpasswd')
-rw-r--r-- | src/clients/kpasswd/ksetpwd.c | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/clients/kpasswd/ksetpwd.c b/src/clients/kpasswd/ksetpwd.c index 41500dd..45f782f 100644 --- a/src/clients/kpasswd/ksetpwd.c +++ b/src/clients/kpasswd/ksetpwd.c @@ -3,6 +3,7 @@ #include <unistd.h> #include <stdio.h> #include <time.h> +#include <k5-platform.h> #define TKTTIMELEFT 60*10 /* ten minutes */ @@ -69,14 +70,11 @@ static kbrccache_t userinitcontext( krb5_unparse_name( kcontext, kme, &pName ); if( cachename ) { - pCacheName = malloc( strlen( pName ) + strlen( cachename ) + 1 ); - if( pCacheName == NULL ) + if (asprintf(&pCacheName, "%s%s", cachename, pName) < 0) { kres = KRB5_CC_NOMEM; goto fail; } - strcpy( pCacheName, cachename ); - strcat( pCacheName, pName ); kres = krb5_cc_resolve( kcontext, pCacheName, &kcache ); if( kres ) { |