Github user changkun commented on a diff in the pull request:
https://github.com/apache/guacamole-server/pull/183#discussion_r217142797
--- Diff: src/libguac/parser.c ---
@@ -222,7 +222,11 @@ int guac_parser_read(guac_parser* parser, guac_socket*
socket, int usec_timeout)
retval = guac_socket_select(socket, usec_timeout);
if (retval <= 0)
return -1;
-
+
+ /* Reset pointers if instruction buf len is less than max
instruction len */
+ if (buffer_end - unparsed_end < GUAC_INSTRUCTION_MAX_LENGTH)
+ unparsed_end = unparsed_start = parser->__instructionbuf;
--- End diff --
As expected and as same as what I wrote before.
Two suggestions if you do what make changes from this PR:
1. Carefully handling conditions when instruction incomplete, for example,
reconstruction mechanism in a transmission context.
2. Redesigning protocol, add probably one instruction which allows
`client/server` retransmission, as far as I see, there is no error handling for
transmission. Also, `LENGTH.VALUE` is a redundant design and it can be
simplified with `VALUE` only.
---