summaryrefslogtreecommitdiffstats
path: root/source4
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2013-11-12 22:00:54 +0100
committerAndreas Schneider <asn@cryptomilk.org>2013-11-13 11:05:44 +0100
commit55b3d870361684a1eedc215fdb68b3051079047e (patch)
treeaff3ce38d8675852d009fbdf5ada551399c3c6bc /source4
parent91b04f708f790447552dc196e2bc0d2ae2e4379d (diff)
downloadsamba-55b3d870361684a1eedc215fdb68b3051079047e.tar.gz
samba-55b3d870361684a1eedc215fdb68b3051079047e.tar.xz
samba-55b3d870361684a1eedc215fdb68b3051079047e.zip
heimdal: Fix CID 240779 Allocation size mismatch
The error Coverity complains about is in the malloc. krb5_enctypes is an enum, so it is usually smaller than the size of a pointer. So we overallocate, but in the memcpy further down we copy from potentially invalid memory. Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Andreas Schneider <asn@samba.org> Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org> Autobuild-Date(master): Wed Nov 13 11:05:44 CET 2013 on sn-devel-104
Diffstat (limited to 'source4')
-rw-r--r--source4/heimdal/lib/krb5/context.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/source4/heimdal/lib/krb5/context.c b/source4/heimdal/lib/krb5/context.c
index 99bf1b419b..4290b71bb6 100644
--- a/source4/heimdal/lib/krb5/context.c
+++ b/source4/heimdal/lib/krb5/context.c
@@ -450,13 +450,13 @@ copy_etypes (krb5_context context,
;
i++;
- *ret_enctypes = malloc(sizeof(ret_enctypes[0]) * i);
+ *ret_enctypes = malloc(sizeof(enctypes[0]) * i);
if (*ret_enctypes == NULL) {
krb5_set_error_message(context, ENOMEM,
N_("malloc: out of memory", ""));
return ENOMEM;
}
- memcpy(*ret_enctypes, enctypes, sizeof(ret_enctypes[0]) * i);
+ memcpy(*ret_enctypes, enctypes, sizeof(enctypes[0]) * i);
return 0;
}