78static int
79smp_client_hello_parse( struct sample *smp, enum client_hello_type type, unsigned char **ch_data, int *len)
80{
81 int hs_len, ext_len, bleft;
82 struct channel *chn;
83 unsigned char *data;
84
85 if (!smp->strm)
86 goto not_ssl_hello;
87
88 /* meaningless for HTX buffers */
89 if (IS_HTX_STRM(smp->strm))
90 goto not_ssl_hello;
91
92 chn = ((smp->opt & SMP_OPT_DIR) == SMP_OPT_DIR_RES) ? &smp->strm->res : &smp->strm->req;
93
94
95 bleft = ci_data(chn);
96 data = (unsigned char *)ci_head(chn);
97
98 /* Check for SSL/TLS Handshake */
99 if (!bleft)
100 goto too_short;
101 if (*data != 0x16)
102 goto not_ssl_hello;
103
104 /* Check for SSLv3 or later (SSL version >= 3.0) in the record layer*/
cond_at_least: Condition bleft < 3, taking false branch. Now the value of bleft is at least 3.
105 if (bleft < 3)
106 goto too_short;
107 if (data[1] < 0x03)
108 goto not_ssl_hello;
109
cond_at_least: Condition bleft < 5, taking false branch. Now the value of bleft is at least 5.
110 if (bleft < 5)
111 goto too_short;
112 hs_len = (data[3] << 8) + data[4];
cond_at_least: Condition hs_len < 49, taking false branch. Now the value of hs_len is at least 49.
113 if (hs_len < 1 + 3 + 2 + 32 + 1 + 2 + 2 + 1 + 1 + 2 + 2)
114 goto not_ssl_hello; /* too short to have an extension */
115
116 data += 5; /* enter TLS handshake */
assignment: Assigning: bleft -= 5.
117 bleft -= 5;
118
cond_at_least: Condition bleft < hs_len, taking false branch. Now the value of bleft is at least 49.
119 if (bleft < hs_len)
120 goto too_short;
121
122 /* Check for a complete client hello starting at <data> */
at_least: At condition bleft < 1, the value of bleft must be at least 49.
dead_error_condition: The condition bleft < 1 cannot be true.
123 if (bleft < 1)
CID 1660132: (#2 of 2): Logically dead code (DEADCODE)
dead_error_line: Execution cannot reach this statement: goto too_short;.
Tool Name and Version
coverity
Code Report
Additional Information
No response
Output of
haproxy -vv