mirror of
https://github.com/nmap/nmap.git
synced 2025-12-06 04:31:29 +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);
|
||||
|
||||
#define OPTLEN_IS(expected) do { \
|
||||
if (expected == 0 || optlen < (expected) || hdrlen != (expected)) \
|
||||
if ((expected) == 0 || optlen < (expected) || hdrlen != (expected)) \
|
||||
return false; \
|
||||
optlen -= (expected); \
|
||||
tcpc += (expected) - 1; \
|
||||
tcpc += (expected); \
|
||||
} while(0);
|
||||
|
||||
while (optlen > 0) {
|
||||
hdrlen = *++tcpc;
|
||||
hdrlen = *(tcpc + 1);
|
||||
switch (*tcpc) {
|
||||
case 0: // EOL
|
||||
/* Options processing is over. */
|
||||
|
||||
Reference in New Issue
Block a user