--- pool_process_query.c	2009-09-24 01:56:59.000000000 -0400
+++ pool_process_query.c.new	2009-09-25 03:00:23.000000000 -0400
@@ -2619,6 +2619,12 @@
 				return POOL_END;
 			}
 			len = ntohl(len) - 4;
+			
+			if (kind != 'N' && kind != 'E' && kind != 'C')
+			{
+				pool_error("do_command: error, kind is not N, E or C");
+				return POOL_END;
+			}
 			string = pool_read2(backend, len);
 			if (string == NULL)
 			{
