Valhalla Legends Forums Archive | Battle.net Bot Development | [SOLVED] nls_check_signature

AuthorMessageTime
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)

[code]
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");
}
}
[/code]

it prints that the check failed.
May 20, 2005, 6:17 AM
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. :)
May 20, 2005, 3:41 PM
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.
May 21, 2005, 1:54 AM

Search