summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorliuxueli <[email protected]>2021-06-23 14:34:46 +0800
committerliuxueli <[email protected]>2021-06-23 14:34:46 +0800
commite9ecf1449d33479c40e075043489dd84dabcc0dd (patch)
treebc9ff516fa337b0f697d5f9544e00d930d3c06b4
parent8c22b4dd998c5e92f0efffaf5accdaf593249cd9 (diff)
TSG-6617: 异常数据包返回-1,导致内存泄漏
-rw-r--r--src/gquic_process.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/gquic_process.c b/src/gquic_process.c
index 4f0b721..cee031e 100644
--- a/src/gquic_process.c
+++ b/src/gquic_process.c
@@ -515,7 +515,7 @@ enum _QUIC_VERSION is_quic_protocol(struct streaminfo *pstream, struct _quic_con
int parse_extension_tag(struct streaminfo *pstream, struct _quic_stream **quic_stream, void *a_packet, char *payload, int payload_len, int *used_len, int tag_num)
{
- int ret=0,tag_used_num=0;
+ int tag_used_num=0;
int tag_type,skip_tsg=0;
int total_tag_len=0,tag_len=0;
int tag_offset_end=0,pre_tag_offset_end=0;
@@ -606,7 +606,7 @@ int parse_extension_tag(struct streaminfo *pstream, struct _quic_stream **quic_s
*used_len += total_tag_len;
- return ret;
+ return 0;
}
int gquic_frame_type_ack(struct streaminfo *pstream, struct _quic_context* _context, char *payload, int payload_len, int *used_len, char frame_type, void *a_packet)
@@ -662,6 +662,7 @@ int gquic_frame_type_ack(struct streaminfo *pstream, struct _quic_context* _cont
int gquic_frame_type_stream(struct streaminfo *pstream, struct _quic_context* _context, char *payload, int payload_len, int *used_len, char frame_type, void *a_packet)
{
int ret=0;
+ char state=APP_STATE_GIVEME;
unsigned short tag_num = 0;
unsigned int stream_id, message_tag;
@@ -680,28 +681,28 @@ int gquic_frame_type_stream(struct streaminfo *pstream, struct _quic_context* _c
ret=parse_extension_tag(pstream, &(_context->quic_info.client_hello), a_packet, payload, payload_len, used_len, tag_num);
if(ret>=0 && _context->call_business)
{
- ret=quic_callPlugins(pstream, _context, (void *)(_context->quic_info.client_hello), sizeof(void *), QUIC_CLIENT_HELLO_MASK, a_packet);
+ state=quic_callPlugins(pstream, _context, (void *)(_context->quic_info.client_hello), sizeof(void *), QUIC_CLIENT_HELLO_MASK, a_packet);
}
break;
case SHLO: //MTAG_SHLO;
ret=parse_extension_tag(pstream, &(_context->quic_info.server_hello), a_packet, payload, payload_len, used_len, tag_num);
if(ret>=0 && _context->call_business)
{
- ret=quic_callPlugins(pstream, _context, (void *)(_context->quic_info.server_hello), sizeof(void *), QUIC_SERVER_HELLO_MASK, a_packet);
+ state=quic_callPlugins(pstream, _context, (void *)(_context->quic_info.server_hello), sizeof(void *), QUIC_SERVER_HELLO_MASK, a_packet);
}
break;
case REJ: //MTAG_REJ;
ret=parse_extension_tag(pstream, &(_context->quic_info.rejection), a_packet, payload, payload_len, used_len, tag_num);
if(ret>=0 && _context->call_business)
{
- ret=quic_callPlugins(pstream, _context, (void *)(_context->quic_info.rejection), sizeof(void *), QUIC_REJECTION_MASK, a_packet);
+ state=quic_callPlugins(pstream, _context, (void *)(_context->quic_info.rejection), sizeof(void *), QUIC_REJECTION_MASK, a_packet);
}
break;
default:
break;
}
- return ret;
+ return state;
}
//frame type->stream->offset->data length
@@ -972,7 +973,7 @@ int quic_protocol_identify(struct streaminfo *a_stream, void *a_packet, char *ou
_context=(struct _quic_context *)pme;
ret=quic_process(a_stream, _context, a_stream->threadnum, a_packet);
- if(ret!=PROT_STATE_DROPME)
+ if(ret!=PROT_STATE_DROPME && _context->is_quic!=QUIC_VERSION_UNKNOWN)
{
if(_context->quic_info.client_hello!=NULL)
{