summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfumingwei <[email protected]>2023-04-06 16:13:58 +0800
committerfumingwei <[email protected]>2023-04-06 16:13:58 +0800
commit81d5013aefdc8fb2b5612eb395ee27929d034717 (patch)
treec72080ccb3611b7d511589c1818d1ab5c923490a
parentf16d50d28c701f6fcc7de327b37adeb637a3ba70 (diff)
bugfix:TSG-14542:修复因拦截无sni的流导致sapp产生coredump的问题v5.1.1
-rw-r--r--entry/src/kni_entry.cpp18
1 files changed, 12 insertions, 6 deletions
diff --git a/entry/src/kni_entry.cpp b/entry/src/kni_entry.cpp
index e1097e6..aab72c2 100644
--- a/entry/src/kni_entry.cpp
+++ b/entry/src/kni_entry.cpp
@@ -1706,15 +1706,21 @@ char first_data_process(struct streaminfo *stream, struct pme_info *pmeinfo, str
pmeinfo->protocol = srt_process_context_get_protocol(session_context);
const char *domain = srt_process_context_get_domain(session_context);
- pmeinfo->domain_len = MIN(strlen(domain), (int)sizeof(pmeinfo->domain) - 1);
-
- if(pmeinfo->protocol == PROTO_HTTP)
+ if(domain != NULL)
{
- strncpy(pmeinfo->domain.host, domain, pmeinfo->domain_len);
+ pmeinfo->domain_len = MIN(strlen(domain), (int)sizeof(pmeinfo->domain) - 1);
+ if(pmeinfo->protocol == PROTO_HTTP)
+ {
+ strncpy(pmeinfo->domain.host, domain, pmeinfo->domain_len);
+ }
+ if(pmeinfo->protocol == PROTO_SSL)
+ {
+ strncpy(pmeinfo->domain.sni, domain, pmeinfo->domain_len);
+ }
}
- if(pmeinfo->protocol == PROTO_SSL)
+ else
{
- strncpy(pmeinfo->domain.sni, domain, pmeinfo->domain_len);
+ pmeinfo->domain_len = 0;
}
pmeinfo->action = KNI_ACTION_INTERCEPT;