undefined4 configure_pdconf(int *param_1)
{
undefined4 *__s;
int iVar1;
uint *puVar2;
char *pcVar3;
uint uVar4;
uint uVar5;
int *piVar6;
dprintf(7,"configure_pdconf","called");
if (param_1 != (int *)0x0) {
do {
__s = (undefined4 *)malloc(0x40) //possible issue identified - semgrep
if (__s == (undefined4 *)0x0) {
iVar1 = param_1[1];
pcVar3 = "memory allocation failed for pd %s";
LAB_0041393c:
dprintf(3,"configure_pdconf",pcVar3,iVar1);
return 0xffffffff;
}
memset(__s,0,0x40) //possible issue identified - semgrep
pcVar3 = (char *)param_1[1];
*__s = DAT_0043cd1c;
__s[2] = 0;
__s[3] = __s + 2;
DAT_0043cd1c = __s;
pcVar3 = strdup(pcVar3);
__s[1] = pcVar3;
if (pcVar3 == (char *)0x0) {
iVar1 = param_1[1];
pcVar3 = "failed to copy pd name: %s";
goto LAB_0041393c;
}
for (piVar6 = (int *)param_1[3]; piVar6 != (int *)0x0; piVar6 = (int *)*piVar6) {
iVar1 = piVar6[2];
if (iVar1 == 0xc) {
iVar1 = piVar6[4];
__s[4] = iVar1;
if (0x1f < iVar1 - 1U) {
dprintf(6,"configure_pdconf","%s:%d invalid segment value",configfilename,piVar6[3]);
return 0xffffffff;
}
}
else if (iVar1 == 0xd) {
puVar2 = (uint *)piVar6[7];
if ((int)__s[4] < 1) {
pcVar3 = "write segment_bits before pd_range";
LAB_004139cc:
dprintf(6,"configure_pdconf",pcVar3);
return 0xffffffff;
}
uVar5 = *puVar2;
uVar4 = puVar2[1];
if (((uVar4 < uVar5) || (0x100 < (uVar4 + 1) - uVar5)) ||
((uint)(1 << (__s[4] & 0x1f)) < uVar4)) {
pcVar3 = "invalid pd_range";
goto LAB_004139cc;
}
__s[5] = uVar5;
iVar1 = (puVar2[1] + 1) - *puVar2;
__s[7] = iVar1;
__s[6] = iVar1;
}
else {
if (iVar1 != 5) {
dprintf(3,"configure_pdconf","%s:%d invalid host configuration for %s",configfilename,
piVar6[3],param_1[1]);
return 0xffffffff;
}
iVar1 = add_prefix(__s + 2,__s[1],5,piVar6[7]);
if (iVar1 != 0) {
iVar1 = param_1[1];
pcVar3 = "failed to configure prefix for %s";
goto LAB_0041393c;
}
}
}
param_1 = (int *)*param_1;
} while (param_1 != (int *)0x0);
}
return 0;
}