summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVedansh Bhartia <vedanshbhartia@gmail.com>2023-07-13 13:47:06 +0200
committerVedansh Bhartia <vedanshbhartia@gmail.com>2023-07-24 19:21:36 +0200
commitf2b5f0727401fd3ab975976555864c21860f3579 (patch)
tree345ac4b3823d8de610f5afca236f056857258130
parentMerge pull request #52390 from xxhdx1985126/wip-61952 (diff)
downloadceph-f2b5f0727401fd3ab975976555864c21860f3579.tar.xz
ceph-f2b5f0727401fd3ab975976555864c21860f3579.zip
rgw: Fix potential null dereference in rgw/driver/dbstore/sqlite/statement.cc
Signed-off-by: Vedansh Bhartia <vedanshbhartia@gmail.com>
-rw-r--r--src/rgw/driver/dbstore/sqlite/statement.cc12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/rgw/driver/dbstore/sqlite/statement.cc b/src/rgw/driver/dbstore/sqlite/statement.cc
index 3e44f4c0b6e..199774f4d9a 100644
--- a/src/rgw/driver/dbstore/sqlite/statement.cc
+++ b/src/rgw/driver/dbstore/sqlite/statement.cc
@@ -118,10 +118,10 @@ void eval0(const DoutPrefixProvider* dpp, const stmt_execution& stmt)
if (ec != sqlite::errc::done) {
const char* errmsg = ::sqlite3_errmsg(db);
ldpp_dout(dpp, 20) << "evaluation failed: " << errmsg
- << " (" << ec << ")\nstatement: " << sql.get() << dendl;
+ << " (" << ec << ")\nstatement: " << (sql ? sql.get() : "") << dendl;
throw sqlite::error(errmsg, ec);
}
- ldpp_dout(dpp, 20) << "evaluation succeeded: " << sql.get() << dendl;
+ ldpp_dout(dpp, 20) << "evaluation succeeded: " << (sql ? sql.get() : "") << dendl;
}
void eval1(const DoutPrefixProvider* dpp, const stmt_execution& stmt)
@@ -137,10 +137,10 @@ void eval1(const DoutPrefixProvider* dpp, const stmt_execution& stmt)
sqlite3* db = ::sqlite3_db_handle(stmt.get());
const char* errmsg = ::sqlite3_errmsg(db);
ldpp_dout(dpp, 1) << "evaluation failed: " << errmsg << " (" << ec
- << ")\nstatement: " << sql.get() << dendl;
+ << ")\nstatement: " << (sql ? sql.get() : "") << dendl;
throw sqlite::error(errmsg, ec);
}
- ldpp_dout(dpp, 20) << "evaluation succeeded: " << sql.get() << dendl;
+ ldpp_dout(dpp, 20) << "evaluation succeeded: " << (sql ? sql.get() : "") << dendl;
}
int column_int(const stmt_execution& stmt, int column)
@@ -181,14 +181,14 @@ auto read_text_rows(const DoutPrefixProvider* dpp,
sqlite3* db = ::sqlite3_db_handle(stmt.get());
const char* errmsg = ::sqlite3_errmsg(db);
ldpp_dout(dpp, 1) << "evaluation failed: " << errmsg << " (" << ec
- << ")\nstatement: " << sql.get() << dendl;
+ << ")\nstatement: " << (sql ? sql.get() : "") << dendl;
throw sqlite::error(errmsg, ec);
}
entries[count] = column_text(stmt, 0);
++count;
}
ldpp_dout(dpp, 20) << "statement evaluation produced " << count
- << " results: " << sql.get() << dendl;
+ << " results: " << (sql ? sql.get() : "") << dendl;
return entries.first(count);
}