Skip to content

An array-bounds warning on PROXY Protocol Builder #7487

Description

@masaori335

@bneradt noticed the master branch has a build issue after 1baffec.

In file included from ProxyProtocol.cc:29:
In member function ‘virtual ts::FixedBufferWriter& ts::FixedBufferWriter::write(const void*, size_t)’,
    inlined from ‘size_t {anonymous}::proxy_protocol_v1_build(uint8_t*, size_t, const ProxyProtocol&)’ at ProxyProtocol.cc:341:34,
    inlined from ‘size_t proxy_protocol_build(uint8_t*, size_t, const ProxyProtocol&, ProxyProtocolVersion)’ at ProxyProtocol.cc:492:34:
../../include/tscore/BufferWriter.h:264:20: error: ‘void* memcpy(void*, const void*, size_t)’ forming offset [47, 94] is out of the bounds [0, 46] of object ‘src_ip_buf’ with type ‘char [46]’ [-Werror=array-bounds]
         std::memcpy(_buf + _attempted, data, _capacity - _attempted);
         ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ProxyProtocol.cc: In function ‘size_t proxy_protocol_build(uint8_t*, size_t, const ProxyProtocol&, ProxyProtocolVersion)’:
ProxyProtocol.cc:337:8: note: ‘src_ip_buf’ declared here
   char src_ip_buf[INET6_ADDRSTRLEN];
        ^~~~~~~~~~
  • CentOS7 & devtoolset-8

FWIW, our CentOS 7 build for the master branch is using devtoolset-7.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Buildwork related to build configuration or environment

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions