]> git.ipfire.org Git - thirdparty/squid.git/commit
Bug 4843 pt1: ext_edirectory_userip_acl refactoring for GCC-8 (#204)
authorAmos Jeffries <yadij@users.noreply.github.com>
Sun, 13 May 2018 06:57:41 +0000 (06:57 +0000)
committerSquid Anubis <squid-anubis@squid-cache.org>
Mon, 14 May 2018 02:55:35 +0000 (02:55 +0000)
commitd08caf47eb8b24faad9a578b4dc05e54451bd326
tree9cae323824f2e5411826afb3554616a2de014167
parentcb365059899d555e825d3f4d749cad8cf1c62482
Bug 4843 pt1: ext_edirectory_userip_acl refactoring for GCC-8 (#204)

Proposed changes to this helper to fix strcat / strncat buffer
overread / overflow issues.

The approach takes three parts:

* adds a makeHexString function to replace many for-loops
  catenating bits of strings together with hex conversion into a
  second buffer. Replacing with a snprintf() and buffer overflow
  handling.

* a copy of Ip::Address::lookupHostIp to convert the input
  string into IP address binary format, then generate the hex
  string using the above new hex function instead of looped
  sub-string concatenations across several buffers.
  This removes all the "00" and "0000" strncat() calls and
  allows far simpler code even with added buffer overflow
  handling.

* replace multiple string part concatenations with a few simpler
  calls to snprintf() for all the search_ip buffer constructions.
  Adding buffer overflow handling as needed for the new calls.
src/acl/external/eDirectory_userip/ext_edirectory_userip_acl.cc