mirror of
https://github.com/samba-team/samba.git
synced 2025-02-23 09:57:40 +03:00
s4-kdc: Fix Coverity ID #1373385 (OVERRUN)
Guenther Pair-Programmed-With: Volker Lendecke <vl@samba.org> Pair-Programmed-With: Andreas Schneider <asn@samba.org> Signed-off-by: Guenther Deschner <gd@samba.org> Signed-off-by: Andreas Schneider <asn@samba.org> Signed-off-by: Volker Lendecke <vl@samba.org> Autobuild-User(master): Günther Deschner <gd@samba.org> Autobuild-Date(master): Thu Sep 29 22:16:52 CEST 2016 on sn-devel-144
This commit is contained in:
parent
9ad014ea4f
commit
f85b233a3e
@ -236,10 +236,8 @@ static int samba_kdc_sort_encryption_keys(struct sdb_entry_ex *entry_ex)
|
|||||||
for (j = 0; j < keys_size; j++) {
|
for (j = 0; j < keys_size; j++) {
|
||||||
const struct sdb_key skey = keys[j];
|
const struct sdb_key skey = keys[j];
|
||||||
|
|
||||||
/* Paranoia: Do not overflow the key_data array */
|
if (idx == keys_size) {
|
||||||
if (idx > keys_size) {
|
break;
|
||||||
free(sorted_keys);
|
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (KRB5_KEY_TYPE(&skey.key) == etype_list[i]) {
|
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 */
|
/* Paranoia: Something went wrong during data copy */
|
||||||
if (idx < keys_size) {
|
if (idx != keys_size) {
|
||||||
free(sorted_keys);
|
free(sorted_keys);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user