From c7c48e2a1ebcb56fb7a726380076c8239c73b76c Mon Sep 17 00:00:00 2001 From: Kory Draughn Date: Sun, 16 Jun 2024 21:22:12 -0400 Subject: [PATCH] [?] Update lsUtil to encode single quotes (as hex). --- lib/core/src/lsUtil.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/core/src/lsUtil.cpp b/lib/core/src/lsUtil.cpp index d28c276cd1..6dd151279a 100644 --- a/lib/core/src/lsUtil.cpp +++ b/lib/core/src/lsUtil.cpp @@ -9,6 +9,7 @@ #include "irods/rcGlobalExtern.h" #include "irods/filesystem.hpp" #include "irods/irods_query.hpp" +#include "irods/escape_utilities.hpp" #include @@ -59,8 +60,10 @@ int lsUtil(rcComm_t *conn, return status; } + const auto escaped_data_name = irods::single_quotes_to_hex(data_name); + const auto escaped_coll_name = irods::single_quotes_to_hex(coll_name); const std::string query_str{(boost::format( - "select DATA_ID where DATA_NAME = '%s' and COLL_NAME = '%s'") % data_name % coll_name).str()}; + "select DATA_ID where DATA_NAME = '%s' and COLL_NAME = '%s'") % escaped_data_name % escaped_coll_name).str()}; irods::query qobj{conn, query_str}; if (qobj.size() > 0) { if (const auto id = qobj.front()[0]; !id.empty()) {