Closed ZeroChaos- closed 1 year ago
Describe the bug reading 31 bytes from a region of size 26
To Reproduce Steps to reproduce the behavior: -Wstringop-overread
Expected behavior The code should not read more bytes than are stored
Screenshots
x86_64-pc-linux-gnu-g++ -Os -march=native -mtune=native -pipe -frecord-gcc-switches -ggdb3 -Werror=odr -Werror=lto-type-mismatch -Werror=strict-aliasing -flto -Werror=strict-aliasing -flto -Werror=strict-aliasing -flto -Werror=strict-aliasing -flto -Werror=strict-aliasing -flto -Werror=strict-aliasing -flto -Werror=strict-aliasing -flto -g -I./src -I./include -I../include -I../common -I../common_fpga -I./deps/amiitool -I./deps/cliparser -I./deps/hardnested -I./deps/liblua -I../common/mbedtls -I./deps/reveng -I./deps/tinycbor -I./deps/whereami -DHAVE_READLINE -DHAVE_BLUEZ -DHAVE_LUA_SWIG -DHAVE_SNPRINTF -Wl,-O1 -Wl,--as-needed -Wl,--defsym=__gentoo_check_ldflags__=0 obj/mifare/aiddesfire.o obj/aidsearch.o obj/atrs.o obj/cmdanalyse.o obj/cmdcrc.o obj/cmddata.o obj/cmdflashmem.o obj/cmdflashmemspiffs.o obj/cmdhf.o obj/cmdhf14a.o obj/cmdhf14b.o obj/cmdhf15.o obj/cmdhfcryptorf.o obj/cmdhfepa.o obj/cmdhfemrtd.o obj/cmdhffelica.o obj/cmdhffido.o obj/cmdhffudan.o obj/cmdhfgallagher.o obj/cmdhfksx6924.o obj/cmdhfcipurse.o obj/cmdhficlass.o obj/cmdhflegic.o obj/cmdhfjooki.o obj/cmdhflist.o obj/cmdhflto.o obj/cmdhfmf.o obj/cmdhfmfdes.o obj/cmdhfmfhard.o obj/cmdhfmfu.o obj/cmdhfmfp.o obj/cmdhfntag424.o obj/cmdhfseos.o obj/cmdhfst.o obj/cmdhfst25ta.o obj/cmdhftesla.o obj/cmdhfthinfilm.o obj/cmdhftopaz.o obj/cmdhftexkom.o obj/cmdhfvas.o obj/cmdhfwaveshare.o obj/cmdhfxerox.o obj/cmdhw.o obj/cmdlf.o obj/cmdlfawid.o obj/cmdlfcotag.o obj/cmdlfdestron.o obj/cmdlfem.o obj/cmdlfem410x.o obj/cmdlfem4x05.o obj/cmdlfem4x50.o obj/cmdlfem4x70.o obj/cmdlffdxb.o obj/cmdlfguard.o obj/cmdlfgallagher.o obj/cmdlfhid.o obj/cmdlfhitag.o obj/cmdlfidteck.o obj/cmdlfindala.o obj/cmdlfio.o obj/cmdlfjablotron.o obj/cmdlfkeri.o obj/cmdlfmotorola.o obj/cmdlfnedap.o obj/cmdlfnexwatch.o obj/cmdlfnoralsy.o obj/cmdlfpac.o obj/cmdlfparadox.o obj/cmdlfpcf7931.o obj/cmdlfpresco.o obj/cmdlfpyramid.o obj/cmdlfsecurakey.o obj/cmdlft55xx.o obj/cmdlfti.o obj/cmdlfviking.o obj/cmdlfvisa2000.o obj/cmdlfzx8211.o obj/cmdmain.o obj/cmdnfc.o obj/cmdparser.o obj/cmdpiv.o obj/cmdscript.o obj/cmdsmartcard.o obj/cmdtrace.o obj/cmdusart.o obj/cmdwiegand.o obj/comms.o obj/crypto/asn1dump.o obj/crypto/asn1utils.o obj/crypto/libpcrypto.o obj/emv/cmdemv.o obj/emv/crypto.o obj/emv/crypto_polarssl.o obj/emv/dol.o obj/emv/emv_pk.o obj/emv/emv_pki.o obj/emv/emv_pki_priv.o obj/emv/emv_roca.o obj/emv/emv_tags.o obj/emv/emvcore.o obj/emv/emvjson.o obj/emv/tlv.o obj/emv/test/crypto_test.o obj/emv/test/cryptotest.o obj/emv/test/cda_test.o obj/emv/test/dda_test.o obj/emv/test/sda_test.o obj/fido/additional_ca.o obj/fido/cose.o obj/fido/cbortools.o obj/fido/fidocore.o obj/ksx6924/ksx6924core.o obj/cipurse/cipursecore.o obj/cipurse/cipursecrypto.o obj/cipurse/cipursetest.o obj/fileutils.o obj/flash.o obj/generator.o obj/graph.o obj/jansson_path.o obj/iso4217.o obj/iso7816/apduinfo.o obj/iso7816/iso7816core.o obj/loclass/cipher.o obj/loclass/cipherutils.o obj/loclass/elite_crack.o obj/loclass/ikeys.o obj/mifare/lrpcrypto.o obj/mifare/desfirecrypto.o obj/mifare/desfirecore.o obj/mifare/desfiresecurechan.o obj/mifare/desfiretest.o obj/mifare/gallaghercore.o obj/mifare/mad.o obj/mifare/mfkey.o obj/mifare/mifare4.o obj/mifare/mifaredefault.o obj/mifare/mifarehost.o obj/nfc/ndef.o obj/pm3.o obj/pm3_binlib.o obj/pm3_bitlib.o obj/preferences.o obj/pm3line.o obj/proxmark3.o obj/scandir.o obj/uart/uart_posix.o obj/uart/uart_win32.o obj/scripting.o obj/ui.o obj/util.o obj/version_pm3.o obj/wiegand_formats.o obj/wiegand_formatutils.o obj/bucketsort.o obj/cardhelper.o obj/crapto1/crapto1.o obj/crapto1/crypto1.o obj/crc.o obj/crc16.o obj/crc32.o obj/crc64.o obj/commonutil.o obj/iso15693tools.o obj/legic_prng.o obj/lfdemod.o obj/util_posix.o obj/pm3_luawrap.o obj/guidummy.o ./deps/amiitool/libamiibo.a ./deps/cliparser/libcliparser.a ./deps/hardnested/libhardnested.a ./deps/liblua/liblua.a obj/libmbedtls.a ./deps/reveng/libreveng.a ./deps/tinycbor/tinycbor.a ./deps/whereami/libwhereami.a -ldl -ljansson -Wl,--as-needed -latomic -Wl,--no-as-needed -lbz2 -llz4 -lbluetooth -lm -lpthread -lreadline -o proxmark3 In function ‘memcpy’, inlined from ‘mfCheckKeys_file’ at src/mifare/mifarehost.c:315:5, inlined from ‘mfStaticNested’ at src/mifare/mifarehost.c:826:19: /usr/include/bits/string_fortified.h:29:10: warning: ‘__builtin_memcpy’ reading 31 bytes from a region of size 26 [-Wstringop-overread] 29 | return __builtin___memcpy_chk (__dest, __src, __len, | ^ src/mifare/mifarehost.c: In function ‘mfStaticNested’: src/mifare/mifarehost.c:790:13: note: source object ‘fn’ of size 26 790 | uint8_t fn[26] = "static_nested_000.bin"; | ^ In function ‘memcpy’, inlined from ‘mfCheckKeys_file’ at src/mifare/mifarehost.c:315:5, inlined from ‘mfStaticNested’ at src/mifare/mifarehost.c:826:19: /usr/include/bits/string_fortified.h:29:10: warning: ‘__builtin_memcpy’ reading 31 bytes from a region of size 26 [-Wstringop-overread] 29 | return __builtin___memcpy_chk (__dest, __src, __len, | ^ src/mifare/mifarehost.c: In function ‘mfStaticNested’: src/mifare/mifarehost.c:790:13: note: source object ‘fn’ of size 26 790 | uint8_t fn[26] = "static_nested_000.bin"; | ^
Desktop (please complete the following information):
Good catch! Thanks for the fix!
Describe the bug reading 31 bytes from a region of size 26
To Reproduce Steps to reproduce the behavior: -Wstringop-overread
Expected behavior The code should not read more bytes than are stored
Screenshots
Desktop (please complete the following information):