Fix protocol code handling new licenses
s_seek() is a macro, so it is dangerous to use complex expressions in it as they may be evaluated multiple times and at incorrect times. In this case we ended up trying to jump to an incorrect offset. Work around this by having a dedicated variable for the target offset.
This commit is contained in:
parent
a88cd226bb
commit
aa5164ede4
@ -278,6 +278,7 @@ static void
|
||||
licence_process_new_license(STREAM s)
|
||||
{
|
||||
unsigned char *data;
|
||||
size_t before;
|
||||
RDSSL_RC4 crypt_key;
|
||||
uint32 length;
|
||||
int i;
|
||||
@ -287,12 +288,13 @@ licence_process_new_license(STREAM s)
|
||||
if (!s_check_rem(s, length))
|
||||
return;
|
||||
|
||||
before = s_tell(s);
|
||||
inout_uint8p(s, data, length);
|
||||
|
||||
rdssl_rc4_set_key(&crypt_key, g_licence_key, 16);
|
||||
rdssl_rc4_crypt(&crypt_key, data, data, length);
|
||||
|
||||
s_seek(s, s_tell(s) - length);
|
||||
s_seek(s, before);
|
||||
|
||||
/* Parse NEW_LICENSE_INFO block */
|
||||
in_uint8s(s, 4); // skip dwVersion
|
||||
|
Loading…
Reference in New Issue
Block a user