]> git.ipfire.org Git - thirdparty/strongswan.git/commit
fips-prf: Add explicit bound check to avoid GCC 12 compile warning
authorTobias Brunner <tobias@strongswan.org>
Thu, 16 Jun 2022 16:18:26 +0000 (18:18 +0200)
committerTobias Brunner <tobias@strongswan.org>
Mon, 27 Jun 2022 12:09:11 +0000 (14:09 +0200)
commit1c198bf22bd96abe8ee91de6f49ea2feab0d7a12
treefb1aa190406d302d1831ae75fd3ccb22acc9d8f7
parent585666aa974a4e751766c327139c982c58912090
fips-prf: Add explicit bound check to avoid GCC 12 compile warning

GCC assumes this->b is zero (or may be zero) and spits out the following
warning (or error with -Werror):

src/libstrongswan/plugins/fips_prf/fips_prf.c:124:12: error: array subscript 18446744073709551615 is above array bounds of ‘uint8_t[<U8090>]’ {aka ‘unsigned char[<U8090>]’} [-Werror=array-bounds]
  124 |         one[this->b - 1] = 0x01;
      |         ~~~^~~~~~~~~~~~~
src/libstrongswan/plugins/fips_prf/fips_prf.c