| commit | 14f26f5ee78204c15bf906f3cf7480308e2feb28 | [log] [tgz] |
|---|---|---|
| author | Viktor Szakats <commit@vsz.me> | Wed Feb 05 13:52:06 2025 +0100 |
| committer | Viktor Szakats <commit@vsz.me> | Wed Feb 05 16:29:03 2025 +0100 |
| tree | d53339736fce9af25d5b32e4149c1021a88e579f | |
| parent | e4557573464ce7fd66ae8fe9723dc7c3dce1f349 [diff] |
smb: silence `-Warray-bounds` with gcc 13+
The code look correct. The compiler gets confused by the `byte[1]`
struct member mapped into a memory buffer with a variable-sized
payload starting at this member. Perhaps there is a cleaner way
to silence this by changing the code.
First seen with gcc 13.2.0 in curl-for-win builds. Then with 13.2.1 and
the latest 14.2.0.
```
curl/lib/smb.c: In function 'smb_connection_state':
curl/lib/smb.c:895:5: warning: 'memcpy' offset [74, 80] from the object at 'buf' is out of the bounds of referenced subobject 'bytes' with type 'char[1]' at offset 73 [-Warray-bounds=]
895 | memcpy(smbc->challenge, nrsp->bytes, sizeof(smbc->challenge));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
curl/lib/smb.c:130:8: note: subobject 'bytes' declared here
130 | char bytes[1];
| ^~~~~
```
gcc 14.2.0 debian:testing musl riscv64: https://github.com/curl/curl/actions/runs/13157579253/job/36718140035?pr=16182#step:3:5576
gcc 13.2.1 alpine amd64: https://github.com/curl/curl-for-win/actions/runs/9370491111/job/25797582549#step:3:4869
gcc 13.2.0 debian:testing glibc aarch64: https://github.com/curl/curl-for-win/actions/runs/9370491111/job/25797581315#step:3:6054
gcc 13.2.0 debian:testing glibc amd64: https://github.com/curl/curl-for-win/actions/runs/9370491111/job/25797581315#step:3:10959
gcc 13.2.0 debian:sid glibc riscv64: https://github.com/curl/curl-for-win/actions/runs/9370491111/job/25797580697#step:3:6122
gcc 13.2.0 debian:sid musl riscv64: https://github.com/curl/curl-for-win/actions/runs/9370491111/job/25797583450#step:3:6227
Closes #16187
curl is a command-line tool for transferring data specified with URL syntax. Learn how to use curl by reading the manpage or everything curl.
Find out how to install curl by reading the INSTALL document.
libcurl is the library curl is using to do its job. It is readily available to be used by your software. Read the libcurl manpage to learn how.
curl is Open Source and is distributed under an MIT-like license.
Contact us on a suitable mailing list or use GitHub issues/ pull requests/ discussions.
All contributors to the project are listed in the THANKS document.
For commercial support, maybe private and dedicated help with your problems or applications using (lib)curl visit the support page.
Visit the curl website for the latest news and downloads.
Download the latest source from the Git server:
git clone https://github.com/curl/curl.git
Report suspected security problems via our HackerOne page and not in public.
curl contains pieces of source code that is Copyright (c) 1998, 1999 Kungliga Tekniska Högskolan. This notice is included here to comply with the distribution terms.
Thank you to all our backers 🙏 Become a backer.
Support this project by becoming a sponsor.