From f54b57d9872a565e2c707aacb90e8d78c4c5d1cf Mon Sep 17 00:00:00 2001 From: Markus Makela Date: Mon, 16 Feb 2015 12:10:48 +0200 Subject: [PATCH] Fixed modutil_replace_SQL not modifying the packet length when the replacement was shorter. --- server/core/modutil.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/server/core/modutil.c b/server/core/modutil.c index 269c66635..9ba57bdf6 100644 --- a/server/core/modutil.c +++ b/server/core/modutil.c @@ -206,6 +206,10 @@ GWBUF *addition; /* New SQL is shorter */ memcpy(ptr, sql, newlength); GWBUF_RTRIM(orig, (length - 1) - newlength); + ptr = GWBUF_DATA(orig); + *ptr++ = (newlength + 1) & 0xff; + *ptr++ = ((newlength + 1) >> 8) & 0xff; + *ptr++ = ((newlength + 1) >> 16) & 0xff; } else {