diff options
author | Anderson Toshiyuki Sasaki <ansasaki@redhat.com> | 2020-03-24 09:55:08 +0100 |
---|---|---|
committer | Anderson Toshiyuki Sasaki <ansasaki@redhat.com> | 2020-03-24 13:52:42 +0100 |
commit | 10950c613c490bd33d6f489f5f61f8368730f7de (patch) | |
tree | 5bb98f4d06c498a8a6ade1a64ba057505cd99931 | |
parent | 783fa7f82ee1d7db52b27c1ed24141d861e36110 (diff) | |
download | gnutls-10950c613c490bd33d6f489f5f61f8368730f7de.tar.gz |
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>
-rw-r--r-- | src/serv.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/serv.c b/src/serv.c index a4dd445da8..414cd0546b 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 { |