You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@guacamole.apache.org by GitBox <gi...@apache.org> on 2022/10/12 20:27:45 UTC

[GitHub] [guacamole-server] jmuehlner commented on a diff in pull request #395: GUACAMOLE-1682: Normalize clipboard for ssh sessions.

jmuehlner commented on code in PR #395:
URL: https://github.com/apache/guacamole-server/pull/395#discussion_r993867430


##########
src/terminal/terminal.c:
##########
@@ -2165,11 +2166,21 @@ void guac_terminal_clipboard_reset(guac_terminal* terminal,
 
 void guac_terminal_clipboard_append(guac_terminal* terminal,
         const char* data, int length) {
-    guac_common_clipboard_append(terminal->clipboard, data, length);
+
+    /* Allocate and clear space for the converted data */
+    char output_data[GUAC_COMMON_CLIPBOARD_MAX_LENGTH];
+    memset(output_data, '\0', GUAC_COMMON_CLIPBOARD_MAX_LENGTH);

Review Comment:
   From the documentation of `guac_iconv()`
   > The input and output string pointers will be updated based on the number of bytes read or written.
   
   Looks like you could just check how many characters the string pointer has been incremented to get your answer.
   
   Also probably want to make sure that you handle the case where `guac_iconv()` returns `0`. (You wouldn't want to call `strlen()` in that case).



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@guacamole.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org