1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-08 21:18:16 +03:00

ldb:ldb_sqlite3: Access correct member of union

Accessing the wrong member of a union invokes undefined behaviour.

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
This commit is contained in:
Joseph Sutton 2023-08-02 15:31:29 +12:00 committed by Andrew Bartlett
parent 993ff0353b
commit 578c1d39f5

View File

@ -380,12 +380,12 @@ static char *parsetree_to_sql(struct ldb_module *module,
value.data);
case LDB_OP_GREATER:
attr = ldb_attr_casefold(mem_ctx, t->u.equality.attr);
attr = ldb_attr_casefold(mem_ctx, t->u.comparison.attr);
if (attr == NULL) return NULL;
a = ldb_schema_attribute_by_name(ldb, attr);
/* Get a canonicalised copy of the data */
a->syntax->canonicalise_fn(ldb, mem_ctx, &(t->u.equality.value), &value);
a->syntax->canonicalise_fn(ldb, mem_ctx, &(t->u.comparison.value), &value);
if (value.data == NULL) {
return NULL;
}
@ -399,12 +399,12 @@ static char *parsetree_to_sql(struct ldb_module *module,
attr);
case LDB_OP_LESS:
attr = ldb_attr_casefold(mem_ctx, t->u.equality.attr);
attr = ldb_attr_casefold(mem_ctx, t->u.comparison.attr);
if (attr == NULL) return NULL;
a = ldb_schema_attribute_by_name(ldb, attr);
/* Get a canonicalised copy of the data */
a->syntax->canonicalise_fn(ldb, mem_ctx, &(t->u.equality.value), &value);
a->syntax->canonicalise_fn(ldb, mem_ctx, &(t->u.comparison.value), &value);
if (value.data == NULL) {
return NULL;
}
@ -431,12 +431,12 @@ static char *parsetree_to_sql(struct ldb_module *module,
attr);
case LDB_OP_APPROX:
attr = ldb_attr_casefold(mem_ctx, t->u.equality.attr);
attr = ldb_attr_casefold(mem_ctx, t->u.comparison.attr);
if (attr == NULL) return NULL;
a = ldb_schema_attribute_by_name(ldb, attr);
/* Get a canonicalised copy of the data */
a->syntax->canonicalise_fn(ldb, mem_ctx, &(t->u.equality.value), &value);
a->syntax->canonicalise_fn(ldb, mem_ctx, &(t->u.comparison.value), &value);
if (value.data == NULL) {
return NULL;
}