mirror of
https://github.com/nmap/nmap.git
synced 2025-12-27 09:59:04 +00:00
Fix off-by-one issue in last change. Fixes #2107
This commit is contained in:
6
tcpip.cc
6
tcpip.cc
@@ -1365,14 +1365,14 @@ static bool validateTCPhdr(const u8 *tcpc, unsigned len) {
|
|||||||
optlen = hdrlen - sizeof(struct tcp_hdr);
|
optlen = hdrlen - sizeof(struct tcp_hdr);
|
||||||
|
|
||||||
#define OPTLEN_IS(expected) do { \
|
#define OPTLEN_IS(expected) do { \
|
||||||
if (expected == 0 || optlen < (expected) || hdrlen != (expected)) \
|
if ((expected) == 0 || optlen < (expected) || hdrlen != (expected)) \
|
||||||
return false; \
|
return false; \
|
||||||
optlen -= (expected); \
|
optlen -= (expected); \
|
||||||
tcpc += (expected) - 1; \
|
tcpc += (expected); \
|
||||||
} while(0);
|
} while(0);
|
||||||
|
|
||||||
while (optlen > 0) {
|
while (optlen > 0) {
|
||||||
hdrlen = *++tcpc;
|
hdrlen = *(tcpc + 1);
|
||||||
switch (*tcpc) {
|
switch (*tcpc) {
|
||||||
case 0: // EOL
|
case 0: // EOL
|
||||||
/* Options processing is over. */
|
/* Options processing is over. */
|
||||||
|
|||||||
Reference in New Issue
Block a user