summaryrefslogtreecommitdiff
path: root/source4/kdc/db-glue.c
diff options
context:
space:
mode:
Diffstat (limited to 'source4/kdc/db-glue.c')
-rw-r--r--source4/kdc/db-glue.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/source4/kdc/db-glue.c b/source4/kdc/db-glue.c
index d7bba3d35e4..bf55befddf8 100644
--- a/source4/kdc/db-glue.c
+++ b/source4/kdc/db-glue.c
@@ -236,10 +236,8 @@ static int samba_kdc_sort_encryption_keys(struct sdb_entry_ex *entry_ex)
for (j = 0; j < keys_size; j++) {
const struct sdb_key skey = keys[j];
- /* Paranoia: Do not overflow the key_data array */
- if (idx > keys_size) {
- free(sorted_keys);
- return -1;
+ if (idx == keys_size) {
+ break;
}
if (KRB5_KEY_TYPE(&skey.key) == etype_list[i]) {
@@ -250,7 +248,7 @@ static int samba_kdc_sort_encryption_keys(struct sdb_entry_ex *entry_ex)
}
/* Paranoia: Something went wrong during data copy */
- if (idx < keys_size) {
+ if (idx != keys_size) {
free(sorted_keys);
return -1;
}