summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorGreg Hudson <ghudson@mit.edu>2009-02-23 18:28:48 +0000
committerGreg Hudson <ghudson@mit.edu>2009-02-23 18:28:48 +0000
commit2a9338e7c91af8337b91fc870e4bfbd98923c170 (patch)
tree34be66a6c353bbe45706387eadaf163a073d6cac /src
parent27552066f38b01e491fb92be86fab69c554351ae (diff)
downloadkrb5-2a9338e7c91af8337b91fc870e4bfbd98923c170.tar.gz
krb5-2a9338e7c91af8337b91fc870e4bfbd98923c170.tar.xz
krb5-2a9338e7c91af8337b91fc870e4bfbd98923c170.zip
Kill an odd (but harmless) use of strncpy in
krb5_get_in_tkt_with_password, by using the construction from krb5_get_init_creds_password. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@22045 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src')
-rw-r--r--src/lib/krb5/krb/gic_pwd.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/lib/krb5/krb/gic_pwd.c b/src/lib/krb5/krb/gic_pwd.c
index 5b3469ea15..ef2b7f0964 100644
--- a/src/lib/krb5/krb/gic_pwd.c
+++ b/src/lib/krb5/krb/gic_pwd.c
@@ -483,16 +483,13 @@ krb5_get_in_tkt_with_password(krb5_context context, krb5_flags options,
int use_master = 0;
krb5_gic_opt_ext *opte = NULL;
- pw0array[0] = '\0';
pw0.data = pw0array;
- if (password) {
- pw0.length = strlen(password);
- if (pw0.length > sizeof(pw0array))
+ if (password && password[0]) {
+ if (strlcpy(pw0.data, password, sizeof(pw0array)) >= sizeof(pw0array))
return EINVAL;
- strncpy(pw0.data, password, sizeof(pw0array));
- if (pw0.length == 0)
- pw0.length = sizeof(pw0array);
+ pw0.length = strlen(password);
} else {
+ pw0.data[0] = '\0';
pw0.length = sizeof(pw0array);
}
retval = krb5int_populate_gic_opt(context, &opte,