summaryrefslogtreecommitdiff
path: root/source4/heimdal
diff options
context:
space:
mode:
authorAndreas Schneider <asn@samba.org>2018-03-21 13:02:26 +0100
committerJeremy Allison <jra@samba.org>2018-04-03 20:20:10 +0200
commitaa17db1f4061920512396032fcd3c7c8a4a8f38f (patch)
treea6a60550a92298d1ba4d184c0256fd128308c8b6 /source4/heimdal
parent28dec65cc26c4b53c1e1c9077edcdb540fb29551 (diff)
downloadsamba-aa17db1f4061920512396032fcd3c7c8a4a8f38f.tar.gz
heimdal: Fix size types and array access
This fixes compilation with -Wstrict-overflow=2. Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
Diffstat (limited to 'source4/heimdal')
-rw-r--r--source4/heimdal/lib/gssapi/mech/gss_set_cred_option.c2
-rw-r--r--source4/heimdal/lib/krb5/addr_families.c29
2 files changed, 18 insertions, 13 deletions
diff --git a/source4/heimdal/lib/gssapi/mech/gss_set_cred_option.c b/source4/heimdal/lib/gssapi/mech/gss_set_cred_option.c
index d33453d92fe..653565b856d 100644
--- a/source4/heimdal/lib/gssapi/mech/gss_set_cred_option.c
+++ b/source4/heimdal/lib/gssapi/mech/gss_set_cred_option.c
@@ -41,7 +41,7 @@ gss_set_cred_option (OM_uint32 *minor_status,
struct _gss_cred *cred = (struct _gss_cred *) *cred_handle;
OM_uint32 major_status = GSS_S_COMPLETE;
struct _gss_mechanism_cred *mc;
- int one_ok = 0;
+ OM_uint32 one_ok = 0;
*minor_status = 0;
diff --git a/source4/heimdal/lib/krb5/addr_families.c b/source4/heimdal/lib/krb5/addr_families.c
index 5d321a7e917..1f7b7266608 100644
--- a/source4/heimdal/lib/krb5/addr_families.c
+++ b/source4/heimdal/lib/krb5/addr_families.c
@@ -803,7 +803,7 @@ static struct addr_operations at[] = {
}
};
-static int num_addrs = sizeof(at) / sizeof(at[0]);
+static size_t num_addrs = sizeof(at) / sizeof(at[0]);
static size_t max_sockaddr_size = 0;
@@ -814,22 +814,26 @@ static size_t max_sockaddr_size = 0;
static struct addr_operations *
find_af(int af)
{
- struct addr_operations *a;
+ size_t i;
- for (a = at; a < at + num_addrs; ++a)
- if (af == a->af)
- return a;
+ for (i = 0; i < num_addrs; i++) {
+ if (af == at[i].af) {
+ return &at[i];
+ }
+ }
return NULL;
}
static struct addr_operations *
find_atype(krb5_address_type atype)
{
- struct addr_operations *a;
+ size_t i;
- for (a = at; a < at + num_addrs; ++a)
- if (atype == a->atype)
- return a;
+ for (i = 0; i < num_addrs; i++) {
+ if (atype == at[i].atype) {
+ return &at[i];
+ }
+ }
return NULL;
}
@@ -949,10 +953,11 @@ KRB5_LIB_FUNCTION size_t KRB5_LIB_CALL
krb5_max_sockaddr_size (void)
{
if (max_sockaddr_size == 0) {
- struct addr_operations *a;
+ size_t i;
- for(a = at; a < at + num_addrs; ++a)
- max_sockaddr_size = max(max_sockaddr_size, a->max_sockaddr_size);
+ for (i = 0; i < num_addrs; i++) {
+ max_sockaddr_size = max(max_sockaddr_size, at[i].max_sockaddr_size);
+ }
}
return max_sockaddr_size;
}