gnutls/gnutls-3.6.12-fix-echo-server.patch

38 lines
1.1 KiB
Diff
Raw Normal View History

From 10950c613c490bd33d6f489f5f61f8368730f7de Mon Sep 17 00:00:00 2001
From: Anderson Toshiyuki Sasaki <ansasaki@redhat.com>
Date: Tue, 24 Mar 2020 09:55:08 +0100
Subject: [PATCH] gnutls-serv: Do not exit when a message to be echoed is
received
Previously, when gnutls-serv was executed with the --echo option, it
would exit when a message to be echoed was received. Moreover, the
server would output "Memory error" although no error occurred.
Signed-off-by: Anderson Toshiyuki Sasaki <ansasaki@redhat.com>
---
src/serv.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/serv.c b/src/serv.c
index a4dd445da..414cd0546 100644
--- a/src/serv.c
+++ b/src/serv.c
@@ -1071,12 +1071,12 @@ get_response(gnutls_session_t session, char *request,
*response_length = strlen(*response);
return 1;
} else if (ret == 0) {
+ *response = strdup(request);
if (*response == NULL) {
fprintf(stderr, "Memory error\n");
return 0;
}
- *response = strdup(request);
- *response_length = ((*response) ? strlen(*response) : 0);
+ *response_length = strlen(*response);
} else {
*response = NULL;
do {
--
2.24.1