mirror of
https://github.com/curl/curl.git
synced 2026-06-08 06:54:15 +03:00
http: silence bogus gcc 13+ warning
Same case as in smb.c silenced earlier.
```
n file included from /home/runner/work/curl/curl/curl/_r64-linux-musl-bld/lib/CMakeFiles/libcurl_object.dir/Unity/unity_0_c.c:184:
In function 'Curl_http_req_make',
inlined from 'Curl_http_proxy_create_CONNECT' at /home/runner/work/curl/curl/curl/lib/http_proxy.c:252:12:
/home/runner/work/curl/curl/curl/lib/http.c:4373:3: error: 'memcpy' offset [137, 142] from the object at 'req' is out of the bounds of referenced subobject 'method' with type 'char[1]' at offset 136 [-Werror=array-bounds=]
4373 | memcpy(req->method, method, m_len);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /home/runner/work/curl/curl/curl/lib/urldata.h:182,
from /home/runner/work/curl/curl/curl/lib/altsvc.c:32,
from /home/runner/work/curl/curl/curl/_r64-linux-musl-bld/lib/CMakeFiles/libcurl_object.dir/Unity/unity_0_c.c:4:
/home/runner/work/curl/curl/curl/lib/http.h: In function 'Curl_http_proxy_create_CONNECT':
/home/runner/work/curl/curl/curl/lib/http.h:230:8: note: subobject 'method' declared here
230 | char method[1];
| ^~~~~~
```
Ref: https://github.com/curl/curl/actions/runs/16527769182/job/46745369844?pr=18025#step:3:5798
Follow-up to 14f26f5ee7 #16187
This commit is contained in:
parent
9dfd8a2d87
commit
f7c282003c
1 changed files with 10 additions and 0 deletions
10
lib/http.c
10
lib/http.c
|
|
@ -4370,7 +4370,17 @@ CURLcode Curl_http_req_make(struct httpreq **preq,
|
|||
req = calloc(1, sizeof(*req) + m_len);
|
||||
if(!req)
|
||||
goto out;
|
||||
#if defined(__GNUC__) && __GNUC__ >= 13
|
||||
#pragma GCC diagnostic push
|
||||
/* error: 'memcpy' offset [137, 142] from the object at 'req' is out of
|
||||
the bounds of referenced subobject 'method' with type 'char[1]' at
|
||||
offset 136 */
|
||||
#pragma GCC diagnostic ignored "-Warray-bounds"
|
||||
#endif
|
||||
memcpy(req->method, method, m_len);
|
||||
#if defined(__GNUC__) && __GNUC__ >= 13
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
if(scheme) {
|
||||
req->scheme = Curl_memdup0(scheme, s_len);
|
||||
if(!req->scheme)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue