diff options
author | Darryl Sokoloski <darryl@sokoloski.ca> | 2018-07-20 13:51:17 -0400 |
---|---|---|
committer | Darryl Sokoloski <darryl@sokoloski.ca> | 2018-07-20 13:51:17 -0400 |
commit | fbf6bd2be8cc6a8b1a091606e378698f7b6cdeac (patch) | |
tree | 52be17b6ba53386d30cf1dbd5b8d10e175ba051d /src/lib/protocols/tor.c | |
parent | d9c963061bbe561af4ea1e223fc4589fe333570d (diff) |
Fix end-of-line bounds handling.
The existing implementation misses ending lines and as a result, fails
to match certain protocols (SMTP for example, which needs to see at
least 3 commain/response matches). It appears from the commit history
that an attempt was made (end-1) to prevent reads past payload length.
This can be ensured by simply not reading any payload that is < 3 bytes.
The updated logic for this loop is:
- Payload length is >= 3 bytes, or return.
- Loop over payload, compare for EOL (CR + NL) sequence.
- If found, process string.
- If index 'a' plus two is less than payload length, increment 'a' by
one and continue.
- Loop return always increments index 'a' by one.
Diffstat (limited to 'src/lib/protocols/tor.c')
0 files changed, 0 insertions, 0 deletions