[PATCHES] avoid memory errors with ldb client cookies
Volker Lendecke
Volker.Lendecke at SerNet.DE
Tue Mar 22 06:54:25 UTC 2016
On Tue, Mar 22, 2016 at 01:47:25PM +1300, Douglas Bagnall wrote:
> On 18/03/16 22:33, Volker Lendecke wrote:
> > On Fri, Mar 18, 2016 at 03:53:22PM +1300, Douglas Bagnall wrote:
> >
> >> The second patch checks if the same talloc_memdup()s fail in mundane ways.
> >
> > Doesn't that require a ldb_oom in the failure cases?
>
> This one should be better. Thanks for noticing that Volker.
R-b: me.
Volker
>
> Douglas
>
> From 69ee3afd26cd1540676ead6b481ccb892dc40b73 Mon Sep 17 00:00:00 2001
> From: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
> Date: Tue, 22 Mar 2016 13:32:12 +1300
> Subject: [PATCH] ldb client controls: don't ignore failed memdup
>
> Signed-off-by: Douglas Bagnall <douglas.bagnall at catalyst.net.nz>
> ---
> lib/ldb/common/ldb_controls.c | 12 ++++++++++++
> 1 file changed, 12 insertions(+)
>
> diff --git a/lib/ldb/common/ldb_controls.c b/lib/ldb/common/ldb_controls.c
> index ba813ea..da7381b 100644
> --- a/lib/ldb/common/ldb_controls.c
> +++ b/lib/ldb/common/ldb_controls.c
> @@ -520,6 +520,10 @@ struct ldb_control *ldb_parse_control_from_string(struct ldb_context *ldb, TALLO
> control->ctxid_len = len;
> control->contextId = talloc_memdup(control, ctxid,
> control->ctxid_len);
> + if (control->contextId == NULL) {
> + ldb_oom(ldb);
> + return NULL;
> + }
> } else {
> control->ctxid_len = 0;
> control->contextId = NULL;
> @@ -572,6 +576,10 @@ struct ldb_control *ldb_parse_control_from_string(struct ldb_context *ldb, TALLO
> }
> control->cookie_len = len;
> control->cookie = (char *)talloc_memdup(control, cookie, control->cookie_len);
> + if (control->cookie == NULL) {
> + ldb_oom(ldb);
> + return NULL;
> + }
> } else {
> control->cookie = NULL;
> control->cookie_len = 0;
> @@ -625,6 +633,10 @@ struct ldb_control *ldb_parse_control_from_string(struct ldb_context *ldb, TALLO
> }
> control->cookie_len = len;
> control->cookie = (char *)talloc_memdup(control, cookie, control->cookie_len);
> + if (control->cookie == NULL) {
> + ldb_oom(ldb);
> + return NULL;
> + }
> } else {
> control->cookie = NULL;
> control->cookie_len = 0;
> --
> 2.5.0
>
--
SerNet GmbH, Bahnhofsallee 1b, 37081 Göttingen
phone: +49-551-370000-0, fax: +49-551-370000-9
AG Göttingen, HRB 2816, GF: Dr. Johannes Loxen
http://www.sernet.de, mailto:kontakt at sernet.de
More information about the samba-technical
mailing list