mirror of
https://github.com/bol-van/zapret2.git
synced 2026-10-29 06:02:05 +00:00
AI fixes
This commit is contained in:
1 parent
2809f8d7e4
commit
a621edf898
4 files changed
+9
-8
No files matched your search
+1
-1
@@ -434,7 +434,7 @@ function string2hex(s)
|
|||||||
return ss
|
return ss
|
||||||
end
|
end
|
||||||
function has_nonprintable(s)
|
function has_nonprintable(s)
|
||||||
return s:match("[^ -\\r\\n\\t]")
|
return s:match("[^ -\r\n\t]")
|
||||||
end
|
end
|
||||||
function make_readable(v)
|
function make_readable(v)
|
||||||
if type(v)=="string" then
|
if type(v)=="string" then
|
||||||
|
|||||||
+5
-5
@@ -504,7 +504,7 @@ uint8_t *proto_find_ip6_exthdr(struct ip6_hdr *ip6, size_t len, uint8_t proto)
|
|||||||
bool fr=false;
|
bool fr=false;
|
||||||
uint16_t fr_off=0;
|
uint16_t fr_off=0;
|
||||||
|
|
||||||
if (len<sizeof(struct ip6_hdr)) return false;
|
if (len<sizeof(struct ip6_hdr)) return NULL;
|
||||||
plen = ntohs(ip6->ip6_ctlun.ip6_un1.ip6_un1_plen);
|
plen = ntohs(ip6->ip6_ctlun.ip6_un1.ip6_un1_plen);
|
||||||
last_proto = ip6->ip6_ctlun.ip6_un1.ip6_un1_nxt;
|
last_proto = ip6->ip6_ctlun.ip6_un1.ip6_un1_nxt;
|
||||||
data = (uint8_t*)(ip6+1);
|
data = (uint8_t*)(ip6+1);
|
||||||
@@ -521,18 +521,18 @@ uint8_t *proto_find_ip6_exthdr(struct ip6_hdr *ip6, size_t len, uint8_t proto)
|
|||||||
case IPPROTO_MH: // mobility header
|
case IPPROTO_MH: // mobility header
|
||||||
case IPPROTO_HIP: // Host Identity Protocol Version v2
|
case IPPROTO_HIP: // Host Identity Protocol Version v2
|
||||||
case IPPROTO_SHIM6:
|
case IPPROTO_SHIM6:
|
||||||
if (len < 2) return false; // error
|
if (len < 2) return NULL; // error
|
||||||
hdrlen = 8 + (data[1] << 3);
|
hdrlen = 8 + (data[1] << 3);
|
||||||
break;
|
break;
|
||||||
case IPPROTO_FRAGMENT: // fragment. length fixed to 8, hdrlen field defined as reserved
|
case IPPROTO_FRAGMENT: // fragment. length fixed to 8, hdrlen field defined as reserved
|
||||||
hdrlen = 8;
|
hdrlen = 8;
|
||||||
if (len < hdrlen) return false; // error
|
if (len < hdrlen) return NULL; // error
|
||||||
fr_off = ntohs(((struct ip6_frag*)data)->ip6f_offlg & IP6F_OFF_MASK);
|
fr_off = ntohs(((struct ip6_frag*)data)->ip6f_offlg & IP6F_OFF_MASK);
|
||||||
fr = ((struct ip6_frag*)data)->ip6f_offlg & (IP6F_OFF_MASK|IP6F_MORE_FRAG);
|
fr = ((struct ip6_frag*)data)->ip6f_offlg & (IP6F_OFF_MASK|IP6F_MORE_FRAG);
|
||||||
break;
|
break;
|
||||||
case IPPROTO_AH:
|
case IPPROTO_AH:
|
||||||
// special case. length in ah header is in 32-bit words minus 2
|
// special case. length in ah header is in 32-bit words minus 2
|
||||||
if (len < 2) return false; // error
|
if (len < 2) return NULL; // error
|
||||||
hdrlen = 8 + (data[1] << 2);
|
hdrlen = 8 + (data[1] << 2);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@@ -540,7 +540,7 @@ uint8_t *proto_find_ip6_exthdr(struct ip6_hdr *ip6, size_t len, uint8_t proto)
|
|||||||
// exthdr was not found
|
// exthdr was not found
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
if (len < hdrlen) return false; // error
|
if (len < hdrlen) return NULL; // error
|
||||||
last_proto = *data;
|
last_proto = *data;
|
||||||
len -= hdrlen; data += hdrlen;
|
len -= hdrlen; data += hdrlen;
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-1
@@ -3180,6 +3180,7 @@ static int lua_get_ifaddrs(lua_State *L)
|
|||||||
#ifdef HAS_FILTER_SSID
|
#ifdef HAS_FILTER_SSID
|
||||||
lua_pushf_str(L, "ssid", wlan_ssid_search_ifname(ifname));
|
lua_pushf_str(L, "ssid", wlan_ssid_search_ifname(ifname));
|
||||||
#endif
|
#endif
|
||||||
|
memset(ifr.ifr_name,0,sizeof(ifr.ifr_name));
|
||||||
strncpy(ifr.ifr_name, ifname, IFNAMSIZ - 1);
|
strncpy(ifr.ifr_name, ifname, IFNAMSIZ - 1);
|
||||||
if (sock>=0 && !ioctl(sock, SIOCGIFMTU, &ifr))
|
if (sock>=0 && !ioctl(sock, SIOCGIFMTU, &ifr))
|
||||||
lua_pushf_int(L, "mtu", ifr.ifr_mtu);
|
lua_pushf_int(L, "mtu", ifr.ifr_mtu);
|
||||||
@@ -3518,7 +3519,7 @@ static void z_free(voidpf opaque, voidpf address)
|
|||||||
static int luacall_gzip_init(lua_State *L)
|
static int luacall_gzip_init(lua_State *L)
|
||||||
{
|
{
|
||||||
// gzip_init(windowBits, level, memlevel) return zstream
|
// gzip_init(windowBits, level, memlevel) return zstream
|
||||||
lua_check_argc_range(L,"gunzip_init",0,3);
|
lua_check_argc_range(L,"gzip_init",0,3);
|
||||||
|
|
||||||
LUA_STACK_GUARD_ENTER(L)
|
LUA_STACK_GUARD_ENTER(L)
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -183,7 +183,7 @@ static void fuzzPacketData(unsigned int count)
|
|||||||
*packet = *packet ? (*packet & 1) ? 0x40 : 0x60 | (*packet & 0x0F) : (uint8_t)random();
|
*packet = *packet ? (*packet & 1) ? 0x40 : 0x60 | (*packet & 0x0F) : (uint8_t)random();
|
||||||
}
|
}
|
||||||
modlen = random()%(sizeof(mod)+1);
|
modlen = random()%(sizeof(mod)+1);
|
||||||
verdict = processPacketData(&mark,random()%1 ? "ifin" : NULL,random()%1 ? "ifout" : NULL,packet,len,mod,&modlen);
|
verdict = processPacketData(&mark,(random() & 1) ? "ifin" : NULL,(random() & 1) ? "ifout" : NULL,packet,len,mod,&modlen);
|
||||||
free(packet);
|
free(packet);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user