undefined4 Set_ACLAddEntry_Proc(int *param_1,char *param_2)
{
bool bVar1;
bool bVar2;
undefined4 uVar3;
size_t sVar4;
byte *__s;
char *pcVar5;
int iVar6;
undefined1 *puVar7;
uint uVar8;
int iVar9;
char *local_res4 [3];
void *local_38;
undefined1 local_34 [4];
undefined1 local_30;
undefined1 local_2f;
iVar9 = *param_1;
local_38 = (void *)0x0;
local_res4[0] = param_2;
if ((uint)param_1[*(int *)(iVar9 + 0xfc) * 0x450 + 0x164b] < 0x3f) {
os_alloc_mem(0,&local_38,0x208);
if (local_38 == (void *)0x0) {
if (RTDebugLevel == 0) {
uVar3 = 0;
}
else {
printk("%s: Allocate memory fail!!!\n","Set_ACLAddEntry_Proc");
uVar3 = 0;
}
}
else {
memset(local_38,0,0x208) //possible issue identified - semgrep
memmove(local_38,param_1 + *(int *)(iVar9 + 0xfc) * 0x450 + 0x164a,0x208) //possible issue identified - semgrep
LAB_0008b4f8:
do {
do {
while( true ) {
pcVar5 = strsep(local_res4,";");
if (pcVar5 == (char *)0x0) goto LAB_0008b518;
if (*pcVar5 != '\0') break;
if (1 < RTDebugLevel) {
pcVar5 = "An unnecessary delimiter entered!\n";
LAB_0008b28c:
printk(pcVar5);
}
}
sVar4 = strlen(pcVar5);
if (sVar4 != 0x11) {
if (RTDebugLevel != 0) {
pcVar5 = "illegal MAC address length!\n";
goto LAB_0008b28c;
}
goto LAB_0008b4f8;
}
__s = (byte *)rstrtok(pcVar5,&_LC182) //possible issue identified - semgrep
iVar6 = 0;
while (__s != (byte *)0x0) {
sVar4 = strlen((char *)__s);
puVar7 = local_34 + iVar6;
if (((sVar4 != 2) || (((&_ctype)[*__s] & 0x44) == 0)) ||
(((&_ctype)[__s[1]] & 0x44) == 0)) {
if (RTDebugLevel != 0) {
printk("illegal MAC address format or octet!\n");
}
break;
}
iVar6 = iVar6 + 1;
AtoH(__s,puVar7,1);
__s = (byte *)rstrtok(0,&_LC182) //possible issue identified - semgrep
}
} while (iVar6 != 6);
uVar8 = 0;
bVar2 = false;
while( true ) {
iVar6 = uVar8 + 1;
bVar1 = *(uint *)((int)local_38 + 4) <= uVar8;
uVar8 = uVar8 + 1;
if (bVar1) break;
iVar6 = memcmp((void *)((int)local_38 + iVar6 * 8),local_34,6);
if (iVar6 == 0) {
bVar2 = true;
if (1 < RTDebugLevel) {
printk("You have added an entry before :\n");
}
if (1 < RTDebugLevel) {
printk("The duplicate entry is %02x:%02x:%02x:%02x:%02x:%02x\n",local_34[0],
local_34[1],local_34[2],local_34[3],local_30,local_2f);
bVar2 = true;
}
}
}
if (!bVar2) {
iVar6 = *(uint *)((int)local_38 + 4) + 1;
*(int *)((int)local_38 + 4) = iVar6;
memmove((void *)((int)local_38 + iVar6 * 8),local_34,6) //possible issue identified - semgrep
}
} while (*(int *)((int)local_38 + 4) != 0x40);
if (1 < RTDebugLevel) {
printk("The AccessControlList is full, and no more entry can join the list!\n");
}
if (1 < RTDebugLevel) {
printk("The last entry of ACL is %02x:%02x:%02x:%02x:%02x:%02x\n",local_34[0],local_34[1],
local_34[2],local_34[3],local_30,local_2f);
}
LAB_0008b518:
if (*(uint *)((int)local_38 + 4) < 0x40) {
iVar6 = *(int *)(iVar9 + 0xfc);
}
else {
printk("<4>/home/eric/release/dir600b5/progs.priv/rt2860v2/build/rt2860v2_ap/../rt2860v2/ap/ap_cfg.c:%d assert pacl->Num < MAX_NUM_OF_ACL_LISTfailed\n"
,0x1576);
iVar6 = *(int *)(iVar9 + 0xfc);
}
memset(param_1 + iVar6 * 0x450 + 0x164a,0,0x208) //possible issue identified - semgrep
memmove(param_1 + *(int *)(iVar9 + 0xfc) * 0x450 + 0x164a,local_38,0x208) //possible issue identified - semgrep
ApUpdateAccessControlList(param_1,*(undefined1 *)(iVar9 + 0xfc));
if (2 < RTDebugLevel) {
printk("Set::%s(Policy=%ld, Entry#=%ld)\n","Set_ACLAddEntry_Proc",
param_1[*(int *)(iVar9 + 0xfc) * 0x450 + 0x164a],
param_1[*(int *)(iVar9 + 0xfc) * 0x450 + 0x164b]);
}
if (2 < RTDebugLevel) {
printk("=============== Entry ===============\n");
}
uVar8 = 0;
while (uVar8 < (uint)param_1[*(int *)(iVar9 + 0xfc) * 0x450 + 0x164b]) {
printk("Entry #%02d: ",uVar8 + 1);
printk("%02X ",(char)param_1[(*(int *)(iVar9 + 0xfc) * 0x228 + uVar8 + 0xb25) * 2 + 2]);
printk("%02X ",*(undefined1 *)
((int)param_1 + (*(int *)(iVar9 + 0xfc) * 0x228 + uVar8) * 8 + 0x5931));
printk("%02X ",*(undefined1 *)
((int)param_1 + (*(int *)(iVar9 + 0xfc) * 0x228 + uVar8) * 8 + 0x5932));
printk("%02X ",*(undefined1 *)
((int)param_1 + (*(int *)(iVar9 + 0xfc) * 0x228 + uVar8) * 8 + 0x5933));
printk("%02X ",(char)param_1[(*(int *)(iVar9 + 0xfc) * 0x228 + uVar8) * 2 + 0x164d]);
printk("%02X ",*(undefined1 *)
((int)param_1 + (*(int *)(iVar9 + 0xfc) * 0x228 + uVar8) * 8 + 0x5935));
printk(&_LC71) //possible issue identified - semgrep
uVar8 = uVar8 + 1;
}
uVar3 = 1;
if (local_38 != (void *)0x0) {
os_free_mem(0);
uVar3 = 1;
}
}
}
else if (RTDebugLevel < 2) {
uVar3 = 0;
}
else {
printk("The AccessControlList is full, and no more entry can join the list!\n");
uVar3 = 0;
}
return uVar3;
}