From aaf5aebff799f43537876f65a9370cfa54eb1c5d Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Mon, 12 Aug 2019 15:24:51 -0400 Subject: [PATCH] Fix for tokens with null bytes Since the server may employ the full range of byte values in the echo token, use that length and the buffer to avoid nulls truncating the token. --- misc/clortho.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/misc/clortho.c b/misc/clortho.c index 69fdaa65..73753fd2 100644 --- a/misc/clortho.c +++ b/misc/clortho.c @@ -109,7 +109,9 @@ int main(int argc, char* argv[]) { read(sock, buffer, currlen); // Max is 255, well under MAX_PACKET } if (currtype == 2) { - dprintf(sock, "\x03%c%s\x04%c%s", strlen(buffer), buffer, strlen(cryptedpass), cryptedpass); + dprintf(sock, "\x03%c", currlen); + write(sock, buffer, currlen); + dprintf(sock, "\x04%c%s", strlen(cryptedpass), cryptedpass); write(sock, "\x00\x00", 2); } else if (currtype == 5) { printf(passwd);