From 6af70b4a66da8e55b233acade09b2b6e12172e07 Mon Sep 17 00:00:00 2001 From: Theodore Tso Date: Sat, 23 Sep 1995 03:10:24 +0000 Subject: [PATCH] keysalt.c: 16/32 bit integer mismatch. str_conv.c: sftime_format_table is conditional upon HAVE_STRFTIME, cast some constants to long so that math wouldn't overflow, 16/32 bit integer size mismatch. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@6836 dc483132-0cff-0310-8789-dd5450dbe970 --- src/lib/kadm/ChangeLog | 7 +++++++ src/lib/kadm/keysalt.c | 6 ++++-- src/lib/kadm/str_conv.c | 19 +++++++++++-------- 3 files changed, 22 insertions(+), 10 deletions(-) diff --git a/src/lib/kadm/ChangeLog b/src/lib/kadm/ChangeLog index 815f0c11c..6eed286ae 100644 --- a/src/lib/kadm/ChangeLog +++ b/src/lib/kadm/ChangeLog @@ -1,3 +1,10 @@ +Wed Sep 13 10:45:25 1995 Keith Vetter (keithv@fusion.com) + + * keysalt.c: 16/32 bit integer mismatch. + * str_conv.c: sftime_format_table is conditional upon HAVE_STRFTIME, + cast some constants to long so that math wouldn't overflow, + 16/32 bit integer size mismatch. + Wed Sep 13 18:17:30 1995 Theodore Y. Ts'o * alt_prof.c (krb5_read_realm_params): Fix memory leak. Free the diff --git a/src/lib/kadm/keysalt.c b/src/lib/kadm/keysalt.c index 011a73747..e8b9b4a33 100644 --- a/src/lib/kadm/keysalt.c +++ b/src/lib/kadm/keysalt.c @@ -118,6 +118,7 @@ krb5_string_to_keysalts(string, tupleseps, ksaltseps, dups, ksaltp, nksaltp) const char *tseplist; const char *ksseplist; const char *septmp; + size_t len; kret = 0; kp = string; @@ -171,15 +172,16 @@ krb5_string_to_keysalts(string, tupleseps, ksaltseps, dups, ksaltp, nksaltp) /* Squirrel away old keysalt array */ savep = *ksaltp; + len = (size_t) *nksaltp; /* Get new keysalt array */ if (*ksaltp = (krb5_key_salt_tuple *) - malloc(((*nksaltp)+1) * sizeof(krb5_key_salt_tuple))) { + malloc((len + 1) * sizeof(krb5_key_salt_tuple))) { /* Copy old keysalt if appropriate */ if (savep) { memcpy(*ksaltp, savep, - (*nksaltp) * sizeof(krb5_key_salt_tuple)); + len * sizeof(krb5_key_salt_tuple)); krb5_xfree(savep); } diff --git a/src/lib/kadm/str_conv.c b/src/lib/kadm/str_conv.c index 71716ad7b..69bebda75 100644 --- a/src/lib/kadm/str_conv.c +++ b/src/lib/kadm/str_conv.c @@ -192,7 +192,7 @@ static const char sftime_short_fmt[] = "%x %X"; static const char sftime_last_fmt[] = "%d/%m/%y %R"; #endif /* HAVE_STRFTIME */ static const char sftime_default_fmt[] = "%02d/%02d/%02d %02d:%02d"; -static const int sftime_default_len = 2+1+2+1+2+1+2+1+2+1; +static const size_t sftime_default_len = 2+1+2+1+2+1+2+1+2+1; /* Delta time strings */ static const char dtscan_dhms_notext[] = "%d-%02d:%02d:%02d"; @@ -214,6 +214,7 @@ static const char dt_output_hms[] = "%d:%02d:%02d"; /* * Lookup tables. */ + static const struct enctype_lookup_entry enctype_table[] = { /* krb5_enctype input specifier output string */ /*------------- ----------------------- ------------------------*/ @@ -288,6 +289,7 @@ atime_full_text_nos /* dd-month-yyyy:hh:mm */ static const int atime_format_table_nents = sizeof(atime_format_table)/ sizeof(atime_format_table[0]); +#ifdef HAVE_STRFTIME static const char * const sftime_format_table[] = { sftime_ldep_time, /* Default locale-dependent date and time */ sftime_med_fmt, /* dd mon yy hh:mm:ss */ @@ -296,6 +298,7 @@ sftime_last_fmt /* dd/mm/yy hh:mm */ }; static const int sftime_format_table_nents = sizeof(sftime_format_table)/ sizeof(sftime_format_table[0]); +#endif /* HAVE_STRFTIME */ static const struct deltat_match_entry deltat_table[] = { /* scan format nmatch daypos hourpos minpos secpos */ @@ -506,7 +509,7 @@ krb5_string_to_flags(string, positive, negative, flagsp) for (i=0; i