Skip to content

Commit

Permalink
always check app_data before dereferencing (#761)
Browse files Browse the repository at this point in the history
  • Loading branch information
scareything authored Nov 29, 2023
1 parent 77358cb commit 9eb9e10
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/ziti-tunnel-cbs/ziti_hosting.c
Original file line number Diff line number Diff line change
Expand Up @@ -278,8 +278,8 @@ static const char *compute_dst_protocol(const host_ctx_t *service, const tunnele
dst_proto = service->proto_u.protocol;
}

if ((*protocol_number = get_protocol_id(app_data->dst_protocol)) < 0) {
snprintf(err, err_sz, "requested protocol '%s' is not supported", app_data->dst_protocol);
if ((*protocol_number = get_protocol_id(dst_proto)) < 0) {
snprintf(err, err_sz, "requested protocol '%s' is not supported", dst_proto);
return NULL;
}

Expand All @@ -306,6 +306,9 @@ static const char *compute_dst_ip_or_hn(const host_ctx_t *service, const tunnele
DST_IP_KEY, DST_HOST_KEY);
return NULL;
}
} else {
snprintf(err, sizeof(err), "config specifies 'forwardAddress', but client didn't send app_data");
return NULL;
}
} else {
ZITI_LOG(VERBOSE, "using address from config");
Expand Down

0 comments on commit 9eb9e10

Please sign in to comment.