Skip to content

Commit b187778

Browse files
authored
realip: Add null check for netvc (#12554)
1 parent 274b266 commit b187778

File tree

1 file changed

+2
-1
lines changed
  • plugins/experimental/realip

1 file changed

+2
-1
lines changed

plugins/experimental/realip/pp.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ ProxyProtocolAddressSource::get_address(TSHttpTxn txnp, struct sockaddr_storage
3838
int pp_addr_len;
3939

4040
TSVConn vconn = TSHttpSsnClientVConnGet(TSHttpTxnSsnGet(txnp));
41-
if (TSVConnPPInfoGet(vconn, TS_PP_INFO_SRC_ADDR, reinterpret_cast<const char **>(&pp_addr), &pp_addr_len) == TS_SUCCESS) {
41+
if (vconn != nullptr &&
42+
TSVConnPPInfoGet(vconn, TS_PP_INFO_SRC_ADDR, reinterpret_cast<const char **>(&pp_addr), &pp_addr_len) == TS_SUCCESS) {
4243
if (pp_addr->sa_family == AF_INET) {
4344
memcpy(addr, pp_addr, sizeof(struct sockaddr_in));
4445
ret = reinterpret_cast<struct sockaddr *>(addr);

0 commit comments

Comments
 (0)