[PATCH] fix for ldb_msg_add_string() to increase value lifetime

Andrew Bartlett abartlet at samba.org
Mon Sep 3 11:48:30 GMT 2007

On Mon, 2007-09-03 at 21:35 +1000, Tim Potter wrote:
> Hey ldb people - I would like to propose this patch to take a copy of
> the string value when calling ldb_msg_add_string().  It's actually
> pretty easy to find garbage in your attribute values if the lifetime of
> the const char *str parameter is less than the lifetime of the
> ldb_message.
> Comments?  It looks OK to me.  (-:

The main problem is that much of the current code assumes the current
lifetime semantics, and we don't want too much copies of the string
around 'just in case'.  We should also watch for failures of the memory

Andrew Bartlett

Andrew Bartlett
Authentication Developer, Samba Team           http://samba.org
Samba Developer, Red Hat Inc.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://lists.samba.org/archive/samba-technical/attachments/20070903/07804069/attachment.bin

More information about the samba-technical mailing list