/* WARNING: Type propagation algorithm not settling */
void FUN_00403fe8(int param_1,undefined4 param_2,undefined4 param_3,undefined1 *param_4,
ushort param_5)
{
byte bVar1;
ushort uVar2;
int iVar3;
char *pcVar4;
byte *pbVar5;
undefined4 uVar6;
byte *pbVar7;
byte *pbVar8;
uint uVar9;
int iVar10;
byte *pbVar11;
int iVar12;
byte *pbVar13;
int local_b0 [5];
char acStack_9c [48];
undefined1 auStack_6c [52];
byte *local_38;
char *local_34;
int *local_30;
int *local_2c;
local_b0[0] = 0;
pbVar13 = (byte *)(uint)param_5;
pbVar11 = (byte *)((*(ushort *)(param_4 + 6) & 0xff) << 8 | (uint)(*(ushort *)(param_4 + 6) >> 8))
;
int_set_mld_version(param_1,2);
dolog(7,"Received a ICMPv6 MLDv2 Report (%u) on %s (grec\'s: %u)\n",*param_4,(byte *)(param_1 + 4)
,pbVar11);
local_34 = acStack_9c;
if (pbVar13 < (byte *)((int)pbVar11 * 0x14 + 8)) {
dolog(3,"Ignoring packet with invalid number of Group Records (would exceed packetlength)\n");
}
else {
memset(local_34,0,0x2e) //possible issue identified - semgrep
memset(auStack_6c,0,0x2e) //possible issue identified - semgrep
local_2c = local_b0 + 1;
local_b0[2] = 0;
local_b0[3] = 0;
local_b0[4] = 0;
pbVar8 = param_4 + 8;
local_38 = param_4 + (int)pbVar13;
local_30 = local_b0;
local_b0[1] = 0;
for (; pbVar11 != (byte *)0x0; pbVar11 = pbVar11 + -1) {
if (local_38 < pbVar8) {
pcVar4 = "Reached outside the packet (ngrec=%u) received on %s, length %u -> ignoring\n";
pbVar5 = pbVar11;
pbVar8 = (byte *)(param_1 + 4);
pbVar11 = pbVar13;
LAB_0040418c:
dolog(3,pcVar4,pbVar5,pbVar8,pbVar11);
return;
}
pbVar5 = (byte *)(uint)*pbVar8;
uVar2 = *(ushort *)(pbVar8 + 2);
if (5 < ((uint)(pbVar5 + -1) & 0xff)) {
pcVar4 = "Unknown Group Record Type %u/0x%x (ngrec=%u) on %s -> Ignoring Report\n";
pbVar8 = pbVar5;
goto LAB_0040418c;
}
if ((pbVar8[4] != 0xff) || (iVar10 = 0, 1 < (pbVar8[5] & 0xf) - 1)) {
pbVar5 = pbVar8 + 4;
inet_ntop(10,pbVar5,local_34,0x2e) //possible issue identified - semgrep
iVar10 = groupint_get(pbVar5,param_1,local_30);
if (iVar10 == 0) {
FUN_00401448(4,
"L4:IPv6:ICMPv6:MLD2_Report Couldn\'t find or create new group for %s on %s/%u\n"
,pbVar5,param_1);
}
}
uVar9 = (uVar2 & 0xff) << 8 | (uint)(uVar2 >> 8);
pbVar5 = pbVar8 + 0x14;
if (uVar9 == 0) {
if (iVar10 != 0) {
bVar1 = *pbVar8;
if (((bVar1 == 2) || (bVar1 == 4)) || (uVar6 = 2, bVar1 == 6)) {
uVar6 = 1;
}
iVar10 = grpint_refresh(iVar10,local_2c,uVar6);
if (iVar10 == 0) {
FUN_00401448(4,"Couldn\'t refresh subscription to %s for %s/%u\n",pbVar8 + 4,param_1);
return;
}
}
}
else {
iVar12 = uVar9 * 0x10;
pbVar7 = pbVar5;
if (pbVar13 < pbVar5 + (iVar12 - (int)param_4)) {
dolog(3,
"Ignoring packet with invalid number (%u) of sources (would exceed packetlength)\n",
uVar9);
return;
}
do {
uVar9 = uVar9 - 1;
if (iVar10 != 0) {
bVar1 = *pbVar8;
uVar6 = 1;
if (((bVar1 == 2) || (bVar1 == 4)) || (bVar1 == 6)) {
uVar6 = 2;
}
iVar3 = grpint_refresh(iVar10,pbVar7,uVar6);
if (iVar3 == 0) {
FUN_00401448(3,"Couldn\'t subscribe sourced from %s on %s/%u\n",pbVar7,param_1);
}
}
pbVar7 = pbVar7 + 0x10;
} while (uVar9 != 0);
pbVar5 = pbVar5 + iVar12;
}
if (local_b0[0] != 0) {
FUN_00403ef4(param_1,pbVar8 + 4);
}
pbVar8 = pbVar5 + pbVar8[1];
}
}
return;
}