{"author":"Viktor Szakats","author_email":"commit@vsz.me","author_time":1753466079,"commit_time":1753530130,"committer":"Viktor Szakats","committer_email":"commit@vsz.me","hash":"054f69ffb79fc916a3f0a278eb8e45b407f815b2","message":"http: silence `-Warray-bounds` with gcc 13+\n\nThis became an issue after promoting curl compiler warnings to errors in\ncurl-for-win. The code is correct. It over-allocates a struct to store\nvariable sized data past its length. Similar code is present in\n`lib/smb.c`, silenced earlier.\n\nSeen in linux-musl-debian-testing-gcc curl-for-win builds, gcc 14.2.0,\nRISC-V (but not amd64/aarch64), unity, debian:testing (trixie):\n\nmusl:\n```\nIn file included from /curl/_r64-linux-musl-bld/lib/CMakeFiles/libcurl_object.dir/Unity/unity_0_c.c:184:\nIn function 'Curl_http_req_make',\n    inlined from 'Curl_http_proxy_create_CONNECT' at /curl/lib/http_proxy.c:252:12:\n/curl/lib/http.c:4373:3: error: 'memcpy' offset [137, 142] from the object at 'req' is out of the bounds of\nreferenced subobject 'method' with type 'char[1]' at offset 136 [-Werror=array-bounds=]\n 4373 |   memcpy(req->method, method, m_len);\n      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\nIn file included from /curl/lib/urldata.h:182,\n                 from /curl/lib/altsvc.c:32,\n                 from /curl/_r64-linux-musl-bld/lib/CMakeFiles/libcurl_object.dir/Unity/unity_0_c.c:4:\n/curl/lib/http.h: In function 'Curl_http_proxy_create_CONNECT':\n/curl/lib/http.h:230:8: note: subobject 'method' declared here\n  230 |   char method[1];\n      |        ^~~~~~\n```\nRef: https://github.com/curl/curl/actions/runs/16527769182/job/46745369844?pr=18025#step:3:5798\nRef: https://github.com/curl/curl-for-win/actions/runs/16525969694/job/46739239206#step:3:5958\n\nglibc (with unity batch):\n```\nIn file included from /usr/riscv64-linux-gnu/include/string.h:548,\n                 from /curl/lib/curl_setup_once.h:33,\n                 from /curl/lib/curl_setup.h:823,\n                 from /curl/lib/http.c:25,\n                 from /curl/_r64-linux-gnu-bld/lib/CMakeFiles/libcurl_object.dir/Unity/unity_2_c.c:4:\nIn function 'memcpy',\n    inlined from 'Curl_http_req_make' at /curl/lib/http.c:4373:3,\n    inlined from 'Curl_http_proxy_create_CONNECT' at /curl/lib/http_proxy.c:252:12:\n/usr/riscv64-linux-gnu/include/bits/string_fortified.h:29:10: error: '__builtin_memcpy' offset [137, 142]\nfrom the object at 'req' is out of the bounds of\nreferenced subobject 'method' with type 'char[1]' at offset 136 [-Werror=array-bounds=]\n   29 |   return __builtin___memcpy_chk (__dest, __src, __len,\n      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n   30 |                                  __glibc_objsize0 (__dest));\n      |                                  ~~~~~~~~~~~~~~~~~~~~~~~~~~\nIn file included from /curl/lib/urldata.h:182,\n                 from /curl/lib/http.c:50:\n/curl/lib/http.h: In function 'Curl_http_proxy_create_CONNECT':\n/curl/lib/http.h:230:8: note: subobject 'method' declared here\n  230 |   char method[1];\n      |        ^~~~~~\n```\nRef: https://github.com/curl/curl-for-win/actions/runs/16538174468/job/46775731055#step:3:5936\n\nRef: https://github.com/curl/curl-for-win/commit/f45df099f38f83f2def8344e335f73cc33eea51b\nFollow-up to 14f26f5ee78204c15bf906f3cf7480308e2feb28 #16187\nCherry-picked from #18025\nCloses #18030\n","parents":["99500660af19f89069e71c2251c13963401b3806"],"tree_hash":"ed02a2b366f85b0d0bbf7b7937554ed80271edc2"}