Skip to content

Commit a22194d

Browse files
committed
LDAP extended operation error path may leak response allocations
If decode_response() fails, the code jumps to free_bv without freeing data attached to response. Ensure response is cleaned up on error to leave no partial allocations.
1 parent 9eea4bf commit a22194d

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

audisp/plugins/zos-remote/zos-remote-ldap.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -335,10 +335,11 @@ int submit_xop_s(ZOS_REMOTE *zos_remote, struct berval *bv)
335335
audit_response_t response;
336336
int rc, errcode, msgId;
337337
unsigned int i;
338-
char *errmsg, *oid;
339-
struct berval *bv_response;
338+
char *errmsg, *oid = NULL;
339+
struct berval *bv_response = NULL;
340340
struct timeval t;
341341

342+
memset(&response, 0, sizeof(response));
342343
if (zos_remote->connected == 0) {
343344
rc = zos_remote_connect(zos_remote);
344345
if (rc != ICTX_SUCCESS)
@@ -432,7 +433,7 @@ int submit_xop_s(ZOS_REMOTE *zos_remote, struct berval *bv)
432433
rc = decode_response(&response, bv_response);
433434
if (rc != ICTX_SUCCESS) {
434435
log_err("Error decoding extended operation response");
435-
goto free_bv;
436+
goto free_response;
436437
}
437438

438439
if (response.respMajor == ZOS_REMOTE_MAJOR_SUCCESS) {

0 commit comments

Comments
 (0)