From 6ca602c58dd24a3e0088e5ea91c2d4e03ab74918 Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Wed, 2 Apr 2014 09:46:35 +0000 Subject: [PATCH] sru_z3950: fix facet response (memory corruption) MP-532 --- src/filter_sru_to_z3950.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/filter_sru_to_z3950.cpp b/src/filter_sru_to_z3950.cpp index 26a6ad2..a4f7ebe 100644 --- a/src/filter_sru_to_z3950.cpp +++ b/src/filter_sru_to_z3950.cpp @@ -95,6 +95,7 @@ namespace metaproxy_1 { bool z3950_search_request( mp::Package &package, + mp::Package &z3950_package, mp::odr &odr_en, Z_SRW_PDU *sru_pdu_res, Z_SRW_searchRetrieveRequest const *sr_req, @@ -278,6 +279,9 @@ void yf::SRUtoZ3950::Impl::sru(mp::Package &package, Z_GDU *zgdu_req) assert(sru_pdu_req); + Package z3950_package(package.session(), package.origin()); + z3950_package.copy_filter(package); + // filter acts as sink for SRU explain requests if (sru_pdu_req->which == Z_SRW_explain_request) { @@ -303,7 +307,7 @@ void yf::SRUtoZ3950::Impl::sru(mp::Package &package, Z_GDU *zgdu_req) if (ok && z3950_init_request(package, odr_en, zurl, sru_pdu_res, sru_pdu_req)) { - ok = z3950_search_request(package, odr_en, + ok = z3950_search_request(package, z3950_package, odr_en, sru_pdu_res, sr_req, zurl, dbargs); if (ok @@ -593,6 +597,7 @@ bool yf::SRUtoZ3950::Impl::z3950_close_request(mp::Package &package) const } bool yf::SRUtoZ3950::Impl::z3950_search_request(mp::Package &package, + mp::Package &z3950_package, mp::odr &odr_en, Z_SRW_PDU *sru_pdu_res, Z_SRW_searchRetrieveRequest @@ -603,9 +608,6 @@ bool yf::SRUtoZ3950::Impl::z3950_search_request(mp::Package &package, assert(sru_pdu_res->u.response); - Package z3950_package(package.session(), package.origin()); - z3950_package.copy_filter(package); - Z_APDU *apdu = zget_APDU(odr_en, Z_APDU_searchRequest); Z_SearchRequest *z_searchRequest = apdu->u.searchRequest; -- 1.7.10.4