From 4eee19decc2ca693b1f0c98f913eacda91c93010 Mon Sep 17 00:00:00 2001 From: Alexander Sulfrian Date: Wed, 6 Jun 2012 20:37:17 +0200 Subject: dev-util/nfcutils: fix segfault with patch --- dev-util/nfcutils/Manifest | 3 ++- .../nfcutils/files/nfcutils-fix-segfault.patch | 30 ++++++++++++++++++++++ dev-util/nfcutils/nfcutils-9999.ebuild | 7 ++--- 3 files changed, 36 insertions(+), 4 deletions(-) create mode 100644 dev-util/nfcutils/files/nfcutils-fix-segfault.patch diff --git a/dev-util/nfcutils/Manifest b/dev-util/nfcutils/Manifest index 4bac912..2a6ab74 100644 --- a/dev-util/nfcutils/Manifest +++ b/dev-util/nfcutils/Manifest @@ -1,3 +1,4 @@ +AUX nfcutils-fix-segfault.patch 1787 RMD160 e46b4bed7d89eeeda9cf9d196fb19dc5c56ee6cf SHA1 7cd85f1ecbf03c9388715cfd039192010904ef68 SHA256 0ca9114197858f35fdcdb898a3f89b810f835e0fc182f09d4e0c5fe962eb9e7e DIST nfcutils-0.3.0.tar.gz 107469 RMD160 c817737e776a92342603234e5347d45f07b74b52 SHA1 7a9371b3df8daf3f43bad8f75810dc052d7c2c83 SHA256 14aa1bce319fa37e0179725a118eea78f28ef19763b8f70ae7a24fa1569c06bc EBUILD nfcutils-0.3.0.ebuild 530 RMD160 97d8ce375bd4d2cd9b07485a6935e69c4cd1f6f4 SHA1 ccb0fd7e4a20dab385a27d1191c63c03f283fd77 SHA256 21d83b19a4924c780827d796ecb6f076598308f4c2a0d59fee4431c7ad7c5cb1 -EBUILD nfcutils-9999.ebuild 645 RMD160 8cdf907c4602ed6715dd6305559c684d442ddc41 SHA1 86c261c15c51fa75e84f37652f16ebdb93295540 SHA256 81c2832123f8fb70eda29c06b498d355ba70173b9405a988b886cff8c2a99748 +EBUILD nfcutils-9999.ebuild 686 RMD160 1ca2ee8bdc7ba448033f1dd1e0e4a2b404f41e34 SHA1 ff605f22ba0f4001475615be61f615fe8b0c2a6c SHA256 923996e808f6ce7b80301dc2e8a596edab95926ec90a8a502b71bae2e291b5f6 diff --git a/dev-util/nfcutils/files/nfcutils-fix-segfault.patch b/dev-util/nfcutils/files/nfcutils-fix-segfault.patch new file mode 100644 index 0000000..91e381c --- /dev/null +++ b/dev-util/nfcutils/files/nfcutils-fix-segfault.patch @@ -0,0 +1,30 @@ +--- src/lsnfc.c (revision 1072) ++++ src/lsnfc.c (working copy) +@@ -88,7 +88,8 @@ + }; + if((res = nfc_initiator_select_passive_target(pnd, nm, nai.abtUid, nai.szUidLen, NULL)) >= 0 ) { + nfc_device_set_property_bool (pnd, NP_EASY_FRAMING, false); +- if ((res = nfc_initiator_transceive_bytes(pnd, abtCmd,sizeof(abtCmd), abtRx, sizeof(abtRx), 0)) >= 0) { ++ szRxLen = sizeof(abtRx); ++ if ((res = nfc_initiator_transceive_bytes(pnd, abtCmd,sizeof(abtCmd), abtRx, &szRxLen, 0)) >= 0) { + // AUTH step1 command success, so it's a Ultralight C + nfc_device_set_property_bool (pnd, NP_EASY_FRAMING, true); + nfc_initiator_deselect_target(pnd); +@@ -126,12 +127,14 @@ + .nbr = NBR_106 + }; + if((nfcRes = nfc_initiator_select_passive_target(pnd, nm, nai.abtUid, nai.szUidLen, NULL)) >= 0 ) { +- if ((nfcRes = nfc_initiator_transceive_bytes(pnd, abtCmd, sizeof(abtCmd), abtRx, sizeof(abtRx), 0)) >= 0) { ++ szRxLen = sizeof(abtRx); ++ if ((nfcRes = nfc_initiator_transceive_bytes(pnd, abtCmd, sizeof(abtCmd), abtRx, &szRxLen, 0)) >= 0) { + // MIFARE DESFire GetVersion command success, decoding... + if( nfcRes == 8 ) { // GetVersion should reply 8 bytes + memcpy( abtDESFireVersion, abtRx + 1, 7 ); + abtCmd[0] = 0xAF; // ask for GetVersion next bytes +- if ((nfcRes = nfc_initiator_transceive_bytes(pnd, abtCmd, sizeof(abtCmd), abtRx, sizeof(abtRx), 0)) >= 0) { ++ szRxLen = sizeof(abtRx); ++ if ((nfcRes = nfc_initiator_transceive_bytes(pnd, abtCmd, sizeof(abtCmd), abtRx, &szRxLen, 0)) >= 0) { + if( nfcRes == 8 ) { // GetVersion should reply 8 bytes + memcpy( abtDESFireVersion + 7, abtRx + 1, 7 ); + res = malloc(16); // We can alloc res: we will be able to provide information + diff --git a/dev-util/nfcutils/nfcutils-9999.ebuild b/dev-util/nfcutils/nfcutils-9999.ebuild index a8bebbe..66a9cd8 100644 --- a/dev-util/nfcutils/nfcutils-9999.ebuild +++ b/dev-util/nfcutils/nfcutils-9999.ebuild @@ -19,10 +19,11 @@ CDEPEND=">=dev-libs/libnfc-1.5.1" RDEPEND="${CDEPEND}" src_prepare() { - eautoreconf || die "autoreconf failed" + epatch "${FILESDIR}/nfcutils-fix-segfault.patch" + eautoreconf || die "autoreconf failed" } src_install() { - emake DESTDIR="${D}" install || die "Install failed" - dodoc README ChangeLog AUTHORS NEWS || die + emake DESTDIR="${D}" install || die "Install failed" + dodoc README ChangeLog AUTHORS NEWS || die } -- cgit v1.2.3