tillmannw / honeytrap

a low-interaction honeypot
GNU General Public License v2.0
95 stars 18 forks source link

Error when trying to build #4

Open t3chn0m4g3 opened 4 years ago

t3chn0m4g3 commented 4 years ago

When I try to build honeytrap in Debian Buster I get the following error ...

/bin/bash ../../libtool  --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I. -I../.. -I../   -Wall -Werror -g -O2 -c -o htm_SaveFile.lo htm_SaveFile.c
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I../.. -I../ -Wall -Werror -g -O2 -c htm_SaveFile.c  -fPIC -DPIC -o .libs/htm_SaveFile.o
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I../.. -I../ -Wall -Werror -g -O2 -c htm_SaveFile.c -o htm_SaveFile.o >/dev/null 2>&1
/bin/bash ../../libtool  --tag=CC   --mode=link gcc -Wall -Werror -g -O2 -module -no-undefined -avoid-version -Wl,--export-dynamic -o htm_SaveFile.la -rpath //opt/honeytrap/etc/honeytrap/plugins htm_SaveFile.lo  -lnfnetlink -lnetfilter_queue -ldl  -ldl
libtool: link: gcc -shared  -fPIC -DPIC  .libs/htm_SaveFile.o   -lnfnetlink -lnetfilter_queue -ldl  -g -O2 -Wl,--export-dynamic   -Wl,-soname -Wl,htm_SaveFile.so -o .libs/htm_SaveFile.so
libtool: link: ar cru .libs/htm_SaveFile.a  htm_SaveFile.o
ar: `u' modifier ignored since `D' is the default (see `U')
libtool: link: ranlib .libs/htm_SaveFile.a
libtool: link: ( cd ".libs" && rm -f "htm_SaveFile.la" && ln -s "../htm_SaveFile.la" "htm_SaveFile.la" )
/bin/bash ../../libtool  --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I. -I../.. -I../   -Wall -Werror -g -O2 -c -o htm_ftpDownload.lo htm_ftpDownload.c
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I../.. -I../ -Wall -Werror -g -O2 -c htm_ftpDownload.c  -fPIC -DPIC -o .libs/htm_ftpDownload.o
htm_ftpDownload.c: In function 'plugin_register_confopts':
htm_ftpDownload.c:81:2: error: 'strncpy' output truncated before terminating nul copying 7 bytes from a string of the same length [-Werror=stringop-truncation]
  strncpy(full_name, "plugin-", 7);
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
htm_ftpDownload.c:82:2: error: 'strncpy' output truncated before terminating nul copying 11 bytes from a string of the same length [-Werror=stringop-truncation]
  strncpy(&full_name[7], module_name, 256 < strlen(module_name) ? 256 : strlen(module_name));
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make[4]: *** [Makefile:681: htm_ftpDownload.lo] Error 1
make[4]: Leaving directory '/root/honeytrap/src/modules'
make[3]: *** [Makefile:696: all-recursive] Error 1
make[3]: Leaving directory '/root/honeytrap/src/modules'
make[2]: *** [Makefile:486: all-recursive] Error 1
make[2]: Leaving directory '/root/honeytrap/src'
make[1]: *** [Makefile:402: all-recursive] Error 1
make[1]: Leaving directory '/root/honeytrap'
make: *** [Makefile:334: all] Error 2

Any ideas?

UPDATE: Builds without problem in Debian Stretch.

tillmannw commented 4 years ago

Hey Marcus,

htm_ftpDownload.c:81:2: error: 'strncpy' output truncated before terminating nul copying 7 bytes from a string of the same length [-Werror=stringop-truncation] strncpy(full_name, "plugin-", 7); ^~~~~~~~ htm_ftpDownload.c:82:2: error: 'strncpy' output truncated before terminating nul copying 11 bytes from a string of the same length [-Werror=stringop-truncation] strncpy(&full_name[7], module_name, 256 < strlen(module_name) ? 256 : strlen(module_name)); ^~~~~~~~~~~~~~~~~~~~~~ cc1: all warnings being treated as errors make[4]: *** [Makefile:681: htm_ftpDownload.lo] Your compiler complains about the fact that strncpy() does not copy any null bytes. The two instances are fine, though.

Try the attached patch or edit src/modules/Makefile.am and add -Wno-stringop-truncation to AM_CFLAGS.

Let me know if this helps.

Tillmann

t3chn0m4g3 commented 4 years ago

Hi Tillmann,

thanks for the explanation and the swift feedback 😄 Github seems to have blocked the attachment, no patch here.

However, based on your info I managed to build it, once adding -Werror -Wno-stringop-truncation -Wno-stringop-overflow to both the Makefile.am in src and src/modules.

Without -Wno-stringop-overflow I run into ...

/bin/bash ../../libtool  --tag=CC   --mode=compile gcc -DHAVE_CONFIG_H -I. -I../..  -I../  -Wall -Werror -Wno-stringop-truncation -g -O2 -c -o htm_tftpDownload.lo htm_tftpDownload.c
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I../.. -I../ -Wall -Werror -Wno-stringop-truncation -g -O2 -c htm_tftpDownload.c  -fPIC -DPIC -o .libs/htm_tftpDownload.o
htm_tftpDownload.c: In function 'get_tftp_resource':
htm_tftpDownload.c:218:2: error: 'strncpy' specified bound depends on the length of the source argument [-Werror=stringop-overflow=]
  strncpy(tftp_command+2, save_file, strlen(save_file));
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
make[4]: *** [Makefile:695: htm_tftpDownload.lo] Error 1
make[4]: Leaving directory '/root/honeytrap/src/modules'
make[3]: *** [Makefile:710: all-recursive] Error 1
make[3]: Leaving directory '/root/honeytrap/src/modules'
make[2]: *** [Makefile:486: all-recursive] Error 1
make[2]: Leaving directory '/root/honeytrap/src'
make[1]: Leaving directory '/root/honeytrap'
make[1]: *** [Makefile:402: all-recursive] Error 1
make: *** [Makefile:334: all] Error 2

Thanks for your help, appreciate if you could apply the patch.

Best regards, Marco.