maskit commented on a change in pull request #6972:
URL: https://github.com/apache/trafficserver/pull/6972#discussion_r451871100
##########
File path: src/traffic_server/InkAPI.cc
##########
@@ -9670,6 +9696,27 @@ TSHttpSsnClientProtocolStackGet(TSHttpSsn ssnp, int n,
const char **result, int
return TS_SUCCESS;
}
+// Return information about the protocols used by the server
+TSReturnCode
+TSHttpTxnServerProtocolStackGet(TSHttpTxn txnp, int n, const char **result,
int *actual)
+{
+ sdk_assert(sdk_sanity_check_txn(txnp) == TS_SUCCESS);
+ sdk_assert(n == 0 || result != nullptr);
+ HttpSM *sm = reinterpret_cast<HttpSM *>(txnp);
+ int count = 0;
+ if (sm && n > 0) {
+ auto mem = static_cast<std::string_view *>(alloca(sizeof(std::string_view)
* n));
Review comment:
Aha, sorry I mistook alloca for calloc. I wasn't worried about
use-after-free, but uninitialized string_view. I'm ok with it as it is for now
since the logic is not new, but I think classes should not be used like this.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]