The binary protocol stores the column and parameter counts in a 16-bit unsigned integer. One would assume that prepared statements that have more columns or parameters than that would fail but the server allows them to be prepared. What this means is that the column and parameter counts cannot be trusted and the only way to know when a prepared statement ends is to count the EOF packets.
The current method in MaxScale counts the total number of packets expected after the initial OK packet for the COM_STMT_PREPARE. This won't work due to the aforementioned problems in the protocol. The fix to this is to count how many EOF packets are expected and count those.