-
Notifications
You must be signed in to change notification settings - Fork 72
dahdi-base: fix potential underflow of unsigned type #90
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Compile fails on newer kernels due to better fortification of memcpy calls. In function 'strncat', inlined from 'dahdi_ioctl_get_version' at dahdi-linux-3.4.0/drivers/dahdi/dahdi-base.c:5405:3: ./include/linux/fortify-string.h:114:33: error: '__builtin_memcpy' accessing 4294967295 bytes at offsets [80, 238] and 0 overlaps 6442450943 bytes at offset -2147483648 [-Werror=restrict] 114 | #define __underlying_memcpy __builtin_memcpy | ^ ./include/linux/fortify-string.h:457:9: note: in expansion of macro '__underlying_memcpy' 457 | __underlying_memcpy(p + p_len, q, copy_len); | ^~~~~~~~~~~~~~~~~~~ Fix this by avoiding a potential underflow of unsigned type size_t. Signed-off-by: Daniel Golle <[email protected]>
7b3984b
to
6bfd233
Compare
Just curious, what kernels are you seeing this on? I haven't encountered this yet. |
I found this issue when trying to build DAHDI on Linux 6.12 with GCC 14 and fortify headers. It probably won't trigger an error without using fortify headers. |
That would explain it. |
Set |
Thanks, I still haven't been able to reproduce this, with either gcc 13 or gcc 15. I'm trying against
|
I noticed this error when building for a MIPS32-based embedded platform, which obviously changes |
Hmm... that's probably it then. My builds are only testing x86 since that's all GitHub supports. |
Compile fails on newer kernels due to better fortification of memcpy calls.
Fix this by avoiding a potential underflow of unsigned type
size_t
.