Skip to content

Commit 18b3d55

Browse files
author
Katsutoshi Ikenoya
authored
fix: check whether a protocol is enabled during the length calculation in create_npn_advertisement (#10381)
1 parent 1f407a6 commit 18b3d55

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

iocore/net/SSLNextProtocolSet.cc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,10 @@ SSLNextProtocolSet::create_npn_advertisement(const SessionProtocolSet &enabled,
5454
*len = 0;
5555

5656
for (ep = endpoints.head; ep != nullptr; ep = endpoints.next(ep)) {
57-
ink_release_assert((strlen(ep->protocol) > 0));
58-
*len += (strlen(ep->protocol) + 1);
57+
if (enabled.contains(globalSessionProtocolNameRegistry.toIndex(swoc::TextView{ep->protocol, strlen(ep->protocol)}))) {
58+
ink_release_assert((strlen(ep->protocol) > 0));
59+
*len += (strlen(ep->protocol) + 1);
60+
}
5961
}
6062

6163
*npn = advertised = static_cast<unsigned char *>(ats_malloc(*len));

0 commit comments

Comments
 (0)