mirror of
https://github.com/bol-van/zapret2.git
synced 2026-03-13 22:03:09 +00:00
AI fixes
This commit is contained in:
@@ -434,7 +434,7 @@ function string2hex(s)
|
||||
return ss
|
||||
end
|
||||
function has_nonprintable(s)
|
||||
return s:match("[^ -\\r\\n\\t]")
|
||||
return s:match("[^ -\r\n\t]")
|
||||
end
|
||||
function make_readable(v)
|
||||
if type(v)=="string" then
|
||||
|
||||
@@ -504,7 +504,7 @@ uint8_t *proto_find_ip6_exthdr(struct ip6_hdr *ip6, size_t len, uint8_t proto)
|
||||
bool fr=false;
|
||||
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);
|
||||
last_proto = ip6->ip6_ctlun.ip6_un1.ip6_un1_nxt;
|
||||
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_HIP: // Host Identity Protocol Version v2
|
||||
case IPPROTO_SHIM6:
|
||||
if (len < 2) return false; // error
|
||||
if (len < 2) return NULL; // error
|
||||
hdrlen = 8 + (data[1] << 3);
|
||||
break;
|
||||
case IPPROTO_FRAGMENT: // fragment. length fixed to 8, hdrlen field defined as reserved
|
||||
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 = ((struct ip6_frag*)data)->ip6f_offlg & (IP6F_OFF_MASK|IP6F_MORE_FRAG);
|
||||
break;
|
||||
case IPPROTO_AH:
|
||||
// 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);
|
||||
break;
|
||||
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
|
||||
return NULL;
|
||||
}
|
||||
if (len < hdrlen) return false; // error
|
||||
if (len < hdrlen) return NULL; // error
|
||||
last_proto = *data;
|
||||
len -= hdrlen; data += hdrlen;
|
||||
}
|
||||
|
||||
@@ -3180,6 +3180,7 @@ static int lua_get_ifaddrs(lua_State *L)
|
||||
#ifdef HAS_FILTER_SSID
|
||||
lua_pushf_str(L, "ssid", wlan_ssid_search_ifname(ifname));
|
||||
#endif
|
||||
memset(ifr.ifr_name,0,sizeof(ifr.ifr_name));
|
||||
strncpy(ifr.ifr_name, ifname, IFNAMSIZ - 1);
|
||||
if (sock>=0 && !ioctl(sock, SIOCGIFMTU, &ifr))
|
||||
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)
|
||||
{
|
||||
// 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)
|
||||
|
||||
|
||||
@@ -183,7 +183,7 @@ static void fuzzPacketData(unsigned int count)
|
||||
*packet = *packet ? (*packet & 1) ? 0x40 : 0x60 | (*packet & 0x0F) : (uint8_t)random();
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user