Skip to content

Instantly share code, notes, and snippets.

  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save piscisaureus/583103 to your computer and use it in GitHub Desktop.
Subject: [PATCH] Fix parser state bug causing field-value misalignment
---
lib/mysql/parser.js | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/lib/mysql/parser.js b/lib/mysql/parser.js
index 077a0e8..f397752 100644
--- a/lib/mysql/parser.js
+++ b/lib/mysql/parser.js
@@ -515,7 +515,7 @@ Parser.prototype.write = function(buffer) {
break;
case Parser.COLUMN_VALUE_STRING:
var remaining = packet.columnLength - packet.index, read;
- if (i + remaining >= buffer.length) {
+ if (i + remaining > buffer.length) {
read = buffer.length - i;
packet.emit('data', buffer.slice(i, buffer.length), remaining - read);
packet.index += read;
--
1.7.0.2.msysgit.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment