Skip to content
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

Compile failure on Debian 11 #9

Open
coppice-git opened this issue Aug 7, 2023 · 1 comment
Open

Compile failure on Debian 11 #9

coppice-git opened this issue Aug 7, 2023 · 1 comment

Comments

@coppice-git
Copy link

Compiling the current repo code for fretdm with the current repo code for freeswitch fails with the following error:

CC src/libfreetdm_la-ftdm_io.lo
In file included from src/ftdm_io.c:40:
src/ftdm_io.c: In function ‘ftdm_channel_clear_token’:
./src/include/private/ftdm_core.h:134:33: error: ‘strncpy’ output may be truncated copying 127 bytes from a string of length 1279 [-Werror=stringop-truncation]
134 | #define ftdm_copy_string(x,y,z) strncpy(x, y, z - 1)
| ^~~~~~~~~~~~~~~~~~~~
src/ftdm_io.c:1338:5: note: in expansion of macro ‘ftdm_copy_string’
1338 | ftdm_copy_string(ftdmchan->tokens[ftdmchan->token_count], tokens[i], sizeof(ftdmchan->tokens[ftdmchan->token_count]));
| ^~~~~~~~~~~~~~~~

Its really a warning, but the build files treat warnings as errors, so the compile fails. I haven't yet investigated to see what is really going on.

@coppice-git
Copy link
Author

coppice-git commented Aug 14, 2023

Looking into this it seems like a compiler bug. strncpy if being used to copy an element of an array, where each element is 128 bytes. The error says the source is 1279 bytes, which is one byte less than the size of the entire array. If I modify the code to work past this error the rest of freetdm and mod_freetdm seems to build OK.

make install has another small issue. It installs the actual module but not the ftmod_*.so files. When I manually copy those to /usr/local/freeswitch/mod things seem to be running OK.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant