http_7239_extract_nodeport() reads the first byte of the passed string
but the caller doesn't check that it's not empty, which can happen if
passed as 'host="127.0.0.1:"'. In that case the function would read and
return garbage that is present in the buffer after the colon. Let's just
check the remaining length before reading.
This can be backported to 2.8 as it was introduced with commit
b2bb9257d2
("MINOR: proxy/http_ext: introduce proxy forwarded option").
if (!quoted)
return 0; /* not supported */
*input = istnext(*input);
- if (!http_7239_extract_nodeport(input, nodeport))
+ if (!istlen(*input) || !http_7239_extract_nodeport(input, nodeport))
return 0; /* invalid nodeport */
out:
/* ok */