Merge pull request #1 from wllm-rbnt/csloop

Fix for infinite loop in Ciphers Suite decoding
This commit is contained in:
Alexandre Dulaunoy 2015-03-31 23:04:28 +02:00
commit ad0961874e

View file

@ -174,7 +174,7 @@ static int decode_HandshakeType_ClientHello(ssl,dir,seg,data)
{ {
UINT4 vj,vn,cs,cslen,complen,comp; UINT4 vj,vn,cs,cslen,complen,comp,odd;
Data session_id,random; Data session_id,random;
int r; int r;
@ -204,6 +204,12 @@ static int decode_HandshakeType_ClientHello(ssl,dir,seg,data)
SSL_DECODE_UINT16(ssl,"cipher Suites len",0,data,&cslen); SSL_DECODE_UINT16(ssl,"cipher Suites len",0,data,&cslen);
explain(ssl,"cipher suites\n"); explain(ssl,"cipher suites\n");
odd = cslen % 2;
if(odd) {
printf("Wrong cipher suites length, fixing ...\n");
cslen -= odd;
}
for(;cslen;cslen-=2){ for(;cslen;cslen-=2){
ssl_decode_enum(ssl,0,2,cipher_suite_decoder, ssl_decode_enum(ssl,0,2,cipher_suite_decoder,
0,data,&cs); 0,data,&cs);