When parsing SMB LanManager packets with invalid protocol ID and the
default set of Squid supported protocols. It may access memory outside
the buffer storing protocol names.
smblib is only used by already deprecated helpers which are deprecated
due to far more significant NTLM protocol issues. It will also only
result in packets being rejected later with invalid protocol names. So
this is a minor bug rather than a vulnerability.
Detected by Coverity Scan. Issue
1256165
{
int i;
- if (dialects == SMB_Prots) { /* The jobs is easy, just index into table */
+ // prot_index may be a value outside the table SMB_Types[]
+ // which holds data at offsets 0 to 11
+ int ourType = (prot_index < 0 || prot_index > 11);
+
+ if (ourType && dialects == SMB_Prots) { /* The jobs is easy, just index into table */
return(SMB_Types[prot_index]);
} else { /* Search through SMB_Prots looking for a match */