From e46b8a8dde202a3cd03589f98981c6b7589c88d6 Mon Sep 17 00:00:00 2001 From: Rahim Kanji Date: Tue, 27 Aug 2024 16:46:36 +0500 Subject: [PATCH] Handled commit and rollback command with and without semicolon --- lib/PgSQL_Session.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/PgSQL_Session.cpp b/lib/PgSQL_Session.cpp index 322eb38ca..cf588b3d5 100644 --- a/lib/PgSQL_Session.cpp +++ b/lib/PgSQL_Session.cpp @@ -713,7 +713,7 @@ bool PgSQL_Session::handler_CommitRollback(PtrSize_t* pkt) { char c = ((char*)pkt->ptr)[5]; bool ret = false; if (c == 'c' || c == 'C') { - if (pkt->size == strlen("commit") + 5 + 2) { + if (pkt->size >= sizeof("commit") + 5) { if (strncasecmp((char*)"commit", (char*)pkt->ptr + 5, 6) == 0) { __sync_fetch_and_add(&PgHGM->status.commit_cnt, 1); ret = true; @@ -722,7 +722,7 @@ bool PgSQL_Session::handler_CommitRollback(PtrSize_t* pkt) { } else { if (c == 'r' || c == 'R') { - if (pkt->size == strlen("rollback") + 5 + 2) { + if (pkt->size >= sizeof("rollback") + 5) { if (strncasecmp((char*)"rollback", (char*)pkt->ptr + 5, 8) == 0) { __sync_fetch_and_add(&PgHGM->status.rollback_cnt, 1); ret = true;