mirror of
https://github.com/samba-team/samba.git
synced 2025-02-02 09:47:23 +03:00
CVE-2023-0614 ldb: Add function to remove excess capacity from an ldb message
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15270 Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
parent
b18ed9ae97
commit
721493f4bd
@ -197,6 +197,7 @@ ldb_msg_remove_element: void (struct ldb_message *, struct ldb_message_element *
|
||||
ldb_msg_remove_inaccessible: void (struct ldb_message *)
|
||||
ldb_msg_rename_attr: int (struct ldb_message *, const char *, const char *)
|
||||
ldb_msg_sanity_check: int (struct ldb_context *, const struct ldb_message *)
|
||||
ldb_msg_shrink_to_fit: void (struct ldb_message *)
|
||||
ldb_msg_sort_elements: void (struct ldb_message *)
|
||||
ldb_next_del_trans: int (struct ldb_module *)
|
||||
ldb_next_end_trans: int (struct ldb_module *)
|
||||
|
@ -1537,6 +1537,22 @@ void ldb_msg_remove_attr(struct ldb_message *msg, const char *attr)
|
||||
msg->num_elements -= num_del;
|
||||
}
|
||||
|
||||
/* Reallocate elements to drop any excess capacity. */
|
||||
void ldb_msg_shrink_to_fit(struct ldb_message *msg)
|
||||
{
|
||||
if (msg->num_elements > 0) {
|
||||
struct ldb_message_element *elements = talloc_realloc(msg,
|
||||
msg->elements,
|
||||
struct ldb_message_element,
|
||||
msg->num_elements);
|
||||
if (elements != NULL) {
|
||||
msg->elements = elements;
|
||||
}
|
||||
} else {
|
||||
TALLOC_FREE(msg->elements);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
return a LDAP formatted GeneralizedTime string
|
||||
*/
|
||||
|
@ -317,6 +317,9 @@ int ldb_match_message(struct ldb_context *ldb,
|
||||
const struct ldb_parse_tree *tree,
|
||||
enum ldb_scope scope, bool *matched);
|
||||
|
||||
/* Reallocate elements to drop any excess capacity. */
|
||||
void ldb_msg_shrink_to_fit(struct ldb_message *msg);
|
||||
|
||||
/**
|
||||
* @brief Convert a character to uppercase with ASCII precedence.
|
||||
*
|
||||
|
Loading…
x
Reference in New Issue
Block a user