mirror of
https://github.com/bol-van/zapret2.git
synced 2026-03-14 06:13:09 +00:00
AI fixes
This commit is contained in:
@@ -8,6 +8,8 @@ static bool addpool(hostlist_pool **hostlist, char **s, const char *end, int *ct
|
|||||||
{
|
{
|
||||||
char *p=*s;
|
char *p=*s;
|
||||||
|
|
||||||
|
for (; p<end && (*p==' ' || *p=='\t') ; p++);
|
||||||
|
*s = p;
|
||||||
// comment line ?
|
// comment line ?
|
||||||
if ( *p != '#' && *p != ';' && *p != '/' && *p != '\r' && *p != '\n')
|
if ( *p != '#' && *p != ';' && *p != '/' && *p != '\r' && *p != '\n')
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -11,7 +11,9 @@ static bool addpool(ipset *ips, char **s, const char *end, int *ct)
|
|||||||
struct cidr4 c4;
|
struct cidr4 c4;
|
||||||
struct cidr6 c6;
|
struct cidr6 c6;
|
||||||
|
|
||||||
for (p=*s; p<end && *p && *p!=' ' && *p!='\t' && *p!='\r' && *p != '\n'; p++);
|
for (p=*s; p<end && (*p==' ' || *p=='\t') ; p++);
|
||||||
|
*s=p;
|
||||||
|
for (; p<end && *p && *p!=' ' && *p!='\t' && *p!='\r' && *p != '\n'; p++);
|
||||||
|
|
||||||
// comment line
|
// comment line
|
||||||
if (!(**s == '#' || **s == ';' || **s == '/' || **s == '\r' || **s == '\n' ))
|
if (!(**s == '#' || **s == ';' || **s == '/' || **s == '\r' || **s == '\n' ))
|
||||||
|
|||||||
@@ -1445,7 +1445,7 @@ bool IsStunMessage(const uint8_t *data, size_t len)
|
|||||||
(data[0]&0xC0)==0 && // 2 most significant bits must be zeroes
|
(data[0]&0xC0)==0 && // 2 most significant bits must be zeroes
|
||||||
(data[3]&3)==0 && // length must be a multiple of 4
|
(data[3]&3)==0 && // length must be a multiple of 4
|
||||||
pntoh32(data+4)==0x2112A442 && // magic cookie
|
pntoh32(data+4)==0x2112A442 && // magic cookie
|
||||||
pntoh16(data+2)==(len-20);
|
pntoh16(data+2)<=(len-20);
|
||||||
}
|
}
|
||||||
#if defined(__GNUC__) && !defined(__llvm__)
|
#if defined(__GNUC__) && !defined(__llvm__)
|
||||||
__attribute__((optimize ("no-strict-aliasing")))
|
__attribute__((optimize ("no-strict-aliasing")))
|
||||||
@@ -1460,7 +1460,7 @@ bool IsMTProto(const uint8_t *data, size_t len)
|
|||||||
return !memcmp(decrypt+56,"\xEF\xEF\xEF\xEF",4);
|
return !memcmp(decrypt+56,"\xEF\xEF\xEF\xEF",4);
|
||||||
*/
|
*/
|
||||||
// this way requires only one AES instead of 4
|
// this way requires only one AES instead of 4
|
||||||
uint8_t decrypt[16] __attribute__((aligned)), iv[16];
|
uint8_t decrypt[16] __attribute__((aligned(16))), iv[16] __attribute__((aligned(16)));
|
||||||
aes_context ctx;
|
aes_context ctx;
|
||||||
|
|
||||||
memcpy(iv, data+40, 16);
|
memcpy(iv, data+40, 16);
|
||||||
|
|||||||
Reference in New Issue
Block a user