Skip to content

Commit

Permalink
Issue #6562 - Prevent undefined behaviour in in filter_stuff_func (#6563
Browse files Browse the repository at this point in the history
)

Bug Description:

Undefined behaviour caused by escaping null character.

Fix Description:

Add simple check when ldap_bv2escaped_filter_value return null terminator.

relates: #6562

Reviewed by:  @progier389 (Thanks!)

Co-authored-by: Sergey Zhidkih <[email protected]>
  • Loading branch information
Rx1513 and Sergey Zhidkih authored Feb 20, 2025
1 parent 4c5eb87 commit c27fe45
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions ldap/servers/slapd/util.c
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,10 @@ filter_stuff_func(void *arg, const char *val, PRUint32 slen)
} else {
filter_len = escaped_filter.bv_len;
buf = escaped_filter.bv_val;
if (buf == NULL) {
slapi_log_err(SLAPI_LOG_TRACE, "filter_stuff_func", "Attempt to copy from NULL pointer\n");
return -1;
}
}
}

Expand Down

0 comments on commit c27fe45

Please sign in to comment.