2
0
mirror of https://github.com/xcat2/confluent.git synced 2025-02-12 08:40:24 +00:00

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.
This commit is contained in:
Jarrod Johnson 2019-08-12 15:24:51 -04:00
parent c1abeaff04
commit aaf5aebff7

View File

@ -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);