summaryrefslogtreecommitdiffstats
path: root/src/lib/kdb
diff options
context:
space:
mode:
authorAlexandra Ellwood <lxs@mit.edu>2008-07-01 17:50:30 +0000
committerAlexandra Ellwood <lxs@mit.edu>2008-07-01 17:50:30 +0000
commit029ae503dcb57af5d7389c0e3790eaec2c3ae9c3 (patch)
treef7be2e902bb5f1535a85470775e71e081f79fa19 /src/lib/kdb
parent721fff549af239baeebca23dcbed1fb15fdec0d0 (diff)
downloadkrb5-029ae503dcb57af5d7389c0e3790eaec2c3ae9c3.tar.gz
krb5-029ae503dcb57af5d7389c0e3790eaec2c3ae9c3.tar.xz
krb5-029ae503dcb57af5d7389c0e3790eaec2c3ae9c3.zip
Added type checking for 64-bit platforms
ticket: 6001 git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@20495 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/lib/kdb')
-rw-r--r--src/lib/kdb/kdb_default.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/lib/kdb/kdb_default.c b/src/lib/kdb/kdb_default.c
index 093bbc4bc8..22d3af2424 100644
--- a/src/lib/kdb/kdb_default.c
+++ b/src/lib/kdb/kdb_default.c
@@ -143,7 +143,7 @@ krb5_def_store_mkey(context, keyfile, mname, key, master_pwd)
FILE *kf;
krb5_error_code retval = 0;
krb5_ui_2 enctype;
- unsigned long keylength;
+ krb5_ui_4 keylength;
char defkeyfile[MAXPATHLEN+1];
krb5_data *realm = krb5_princ_realm(context, mname);
#if HAVE_UMASK
@@ -179,8 +179,8 @@ krb5_def_store_mkey(context, keyfile, mname, key, master_pwd)
}
set_cloexec_file(kf);
#if BIG_ENDIAN_MASTER_KEY
- enctype = htons(key->enctype);
- keylength = htonl(key->length);
+ enctype = htons((uint16_t) key->enctype);
+ keylength = htonl((uint32_t) key->length);
#else
enctype = key->enctype;
keylength = key->length;
@@ -212,6 +212,7 @@ krb5_db_def_fetch_mkey( krb5_context context,
{
krb5_error_code retval;
krb5_ui_2 enctype;
+ krb5_ui_4 keylength;
char defkeyfile[MAXPATHLEN+1];
krb5_data *realm = krb5_princ_realm(context, mname);
FILE *kf = NULL;
@@ -238,7 +239,7 @@ krb5_db_def_fetch_mkey( krb5_context context,
}
#if BIG_ENDIAN_MASTER_KEY
- enctype = ntohs(enctype);
+ enctype = ntohs((uint16_t) enctype);
#endif
if (key->enctype == ENCTYPE_UNKNOWN)
@@ -248,14 +249,16 @@ krb5_db_def_fetch_mkey( krb5_context context,
goto errout;
}
- if (fread((krb5_pointer) &key->length,
- sizeof(key->length), 1, kf) != 1) {
+ if (fread((krb5_pointer) &keylength,
+ sizeof(keylength), 1, kf) != 1) {
retval = KRB5_KDB_CANTREAD_STORED;
goto errout;
}
#if BIG_ENDIAN_MASTER_KEY
- key->length = ntohl(key->length);
+ key->length = ntohl((uint32_t) keylength);
+#else
+ key->length = keylength;
#endif
if (!key->length || ((int) key->length) < 0) {