• Welcome to Valhalla Legends Archive.
 

[SOLVED] nls_check_signature

Started by Okee, May 20, 2005, 01:17 AM

Previous topic - Next topic

Okee

Hey guys. I know I just posted with another problem but it's just one of those things.

I don't really understand why I'm failing the server signature check. It's probably becuase I'm extracting it from the data wrong. Check out my code, and see if you can tell if im doing something wrong.

buf = string containing entire packet contents including FF and packet ID
PACKET_HEAD = 4 (the header information)


char ChecksumFormula[256];
strcpy(ChecksumFormula, (char *)buf + (PACKET_HEAD + 33));

char ServerSignature[128];
if(UseNLS) {
strncpy(ServerSignature, buf + (PACKET_HEAD + 33 + strlen(ChecksumFormula)), 128);
if(!nls_check_signature(rsin.sin_addr.s_addr, ServerSignature)) {
print("Server signature check failed!\n");
}
}


it prints that the check failed.

Kp

IIRC, the server signature is a 128byte raw block, so using strncpy to move it might not always copy all of it.  Use memcpy instead.  Also, don't use an unchecked strcpy to grab the ChecksumFormula. :)
[19:20:23] (BotNet) <[vL]Kp> Any idiot can make a bot with CSB, and many do!

Okee

Alright, this has been solved. I changed the strncpy to memcpy, thanks Kp. It still didnt pass, though - the problem was that strlen doesnt include the null terminator of the string, so I had to change the +33 in the memcpy, to +34, so that it moved to the right spot in the recieved packet.