[GitHub] [guacamole-server] aleitner commented on a diff in pull request #395: GUACAMOLE-1682: Normalize clipboard for ssh sessions.
aleitner commented on code in PR #395:
URL: https://github.com/apache/guacamole-server/pull/395#discussion_r995957402
##
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:
I completely overlooked that the pointer gets incremented. Thanks!
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
[GitHub] [guacamole-server] aleitner commented on a diff in pull request #395: GUACAMOLE-1682: Normalize clipboard for ssh sessions.
aleitner commented on code in PR #395:
URL: https://github.com/apache/guacamole-server/pull/395#discussion_r992638672
##
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:
I'm not certain of the length of the converted data so I had set the entire
string to null. Is there a better know to knowing the converted length?
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
[GitHub] [guacamole-server] aleitner commented on a diff in pull request #395: GUACAMOLE-1682: Normalize clipboard for ssh sessions.
aleitner commented on code in PR #395:
URL: https://github.com/apache/guacamole-server/pull/395#discussion_r992614896
##
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:
I added this memset back in because I was seeing junk bytes at the end of my
pasted messages.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
[GitHub] [guacamole-server] aleitner commented on a diff in pull request #395: GUACAMOLE-1682: Normalize clipboard for ssh sessions.
aleitner commented on code in PR #395: URL: https://github.com/apache/guacamole-server/pull/395#discussion_r990499154 ## src/common/clipboard.c: ## @@ -154,13 +155,20 @@ void guac_common_clipboard_append(guac_common_clipboard* clipboard, const char* if (remaining < length) length = remaining; +char output_data[length]; +memset(output_data, '\0', length); Review Comment: I put it in when I was debugging the variable. Removed -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
[GitHub] [guacamole-server] aleitner commented on a diff in pull request #395: GUACAMOLE-1682: Normalize clipboard for ssh sessions.
aleitner commented on code in PR #395: URL: https://github.com/apache/guacamole-server/pull/395#discussion_r990498794 ## src/common/clipboard.c: ## @@ -154,13 +155,20 @@ void guac_common_clipboard_append(guac_common_clipboard* clipboard, const char* if (remaining < length) length = remaining; +char output_data[length]; +memset(output_data, '\0', length); +char* output = output_data; + +/* Convert clipboard contents */ +guac_iconv(GUAC_READ_UTF8_NORMALIZED, &data, length, + GUAC_WRITE_UTF8, &output, length); + /* Append to buffer */ -memcpy(clipboard->buffer + clipboard->length, data, length); +memcpy(clipboard->buffer + clipboard->length, output_data, length); Review Comment: Ahh that's true, moved to terminal -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
