A string sample cannot contain a \0 byte, but ssl_fc_npn returned the
NPN protocol name as sent by the client, which OpenSSL stores without
checking it against the configured list, so a client could put a \0 in
it. Such a value was then matched by "-m str" on its prefix.
Fail the fetch when the name holds a \0 byte. This only applies when
"npn" is set on the bind line.
This must be backported to all stable branches.
if (!smp->data.u.str.area)
return 0;
+ /* a string sample cannot contain a NUL byte */
+ if (memchr(smp->data.u.str.area, 0, len))
+ return 0;
+
smp->data.u.str.data = len;
return 1;
}