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()) {