void RTMPAPIoctlE2PROM(int param_1,undefined4 *param_2)
{
char cVar1;
bool bVar2;
short sVar3;
ushort uVar4;
char *pcVar5;
size_t sVar6;
uint uVar7;
size_t sVar8;
uint uVar9;
ushort uVar10;
char *pcVar11;
char *pcVar12;
char *__s;
short local_58 [2];
int local_54;
char *local_50;
byte local_4c;
byte local_4b;
char acStack_3d [21];
os_alloc_mem(0,&local_54,0x110c);
if (local_54 != 0) {
__s = (char *)(local_54 + 3U & 0xfffffffc);
pcVar12 = __s + 0x1000;
memset(__s,0,0x1000) //possible issue identified - semgrep
memset(pcVar12,0,0x100) //possible issue identified - semgrep
uVar9 = (uint)*(ushort *)(param_2 + 1);
if (1 < uVar9) {
sVar8 = 0xff //possible issue identified - semgrep
if (uVar9 < 0x100) {
sVar8 = uVar9;
}
memmove(pcVar12,(void *)*param_2,sVar8) //possible issue identified - semgrep
local_50 = pcVar12;
sprintf(__s,"\n") //possible issue identified - semgrep
LAB_00087c60:
do {
pcVar12 = strsep(&local_50,",");
if (pcVar12 == (char *)0x0) goto LAB_00087ce0;
if (*pcVar12 != '\0') {
pcVar5 = strchr(pcVar12,0x3d);
if (pcVar5 == (char *)0x0) {
LAB_0008792c:
sVar8 = strlen(pcVar12);
if (4 < sVar8) goto LAB_00087ce0;
sVar8 = strlen(pcVar12);
pcVar5 = pcVar12 + sVar8;
while (0 < (int)sVar8) {
pcVar11 = pcVar5 + -1;
sVar8 = sVar8 - 1 //possible issue identified - semgrep
pcVar5 = pcVar5 + -1;
if (0x36 < (byte)(*pcVar11 - 0x30U)) goto LAB_00087d2c;
}
sVar6 = strlen(pcVar12);
pcVar11 = pcVar12 + sVar6;
sVar8 = sVar6;
pcVar5 = pcVar12;
while( true ) {
pcVar11 = pcVar11 + -1;
if ((int)sVar8 < 1) break;
sVar8 = sVar8 - 1 //possible issue identified - semgrep
pcVar5[3] = *pcVar11;
pcVar5 = pcVar5 + -1;
}
pcVar5 = pcVar12 + (3 - sVar6);
while (bVar2 = (int)sVar6 < 4, sVar6 = sVar6 + 1, bVar2) { //possible issue identified - semgrep
*pcVar5 = '0';
pcVar5 = pcVar5 + -1;
}
pcVar12[4] = '\0';
sVar8 = strlen(pcVar12);
if (sVar8 != 4) goto LAB_00087c60;
AtoH(pcVar12,&local_4c,2);
sVar3 = (ushort)local_4c * 0x100 + (ushort)local_4b //possible issue identified - semgrep
if (sVar3 == -1) goto LAB_00087ce0;
(**(code **)(param_1 + 0x10))(param_1,sVar3,local_58);
sVar8 = strlen(__s);
pcVar12 = "[0x%04X]:0x%04X ";
}
else {
pcVar11 = pcVar5 + 1;
*pcVar5 = '\0';
if ((pcVar11 == (char *)0x0) || (pcVar5[1] == '\0')) goto LAB_0008792c;
sVar8 = strlen(pcVar11);
memmove(acStack_3d + 1,pcVar11,sVar8) //possible issue identified - semgrep
sVar8 = strlen(pcVar11);
acStack_3d[sVar8 + 1] = '\0';
sVar8 = strlen(pcVar12);
if ((4 < sVar8) || (sVar8 = strlen(acStack_3d + 1), 8 < sVar8)) goto LAB_00087ce0 //possible issue identified - semgrep
sVar8 = strlen(pcVar12);
pcVar5 = pcVar12 + sVar8;
while (0 < (int)sVar8) {
pcVar11 = pcVar5 + -1;
sVar8 = sVar8 - 1 //possible issue identified - semgrep
pcVar5 = pcVar5 + -1;
if (0x36 < (byte)(*pcVar11 - 0x30U)) goto LAB_00087d2c;
}
sVar8 = strlen(acStack_3d + 1) //possible issue identified - semgrep
pcVar5 = acStack_3d + 1 + (sVar8 - 1);
while (0 < (int)sVar8) {
cVar1 = *pcVar5;
sVar8 = sVar8 - 1 //possible issue identified - semgrep
pcVar5 = pcVar5 + -1;
if (0x36 < (byte)(cVar1 - 0x30U)) goto LAB_00087d2c;
}
sVar6 = strlen(pcVar12);
pcVar11 = pcVar12 + sVar6;
sVar8 = sVar6;
pcVar5 = pcVar12;
while( true ) {
pcVar11 = pcVar11 + -1;
if ((int)sVar8 < 1) break;
sVar8 = sVar8 - 1 //possible issue identified - semgrep
pcVar5[3] = *pcVar11;
pcVar5 = pcVar5 + -1;
}
pcVar5 = pcVar12 + (3 - sVar6);
while (bVar2 = (int)sVar6 < 4, sVar6 = sVar6 + 1, bVar2) { //possible issue identified - semgrep
*pcVar5 = '0';
pcVar5 = pcVar5 + -1;
}
pcVar12[4] = '\0';
sVar6 = strlen(acStack_3d + 1) //possible issue identified - semgrep
pcVar11 = acStack_3d + 1 + (sVar6 - 1);
pcVar5 = acStack_3d + 4;
for (sVar8 = sVar6; 0 < (int)sVar8; sVar8 = sVar8 - 1) { //possible issue identified - semgrep
*pcVar5 = *pcVar11;
pcVar11 = pcVar11 + -1;
pcVar5 = pcVar5 + -1;
}
pcVar5 = acStack_3d + (4 - sVar6);
while (bVar2 = (int)sVar6 < 4, sVar6 = sVar6 + 1, bVar2) { //possible issue identified - semgrep
*pcVar5 = '0';
pcVar5 = pcVar5 + -1;
}
acStack_3d[5] = 0;
AtoH(pcVar12,&local_4c,2);
uVar10 = (ushort)local_4c;
uVar4 = (ushort)local_4b;
AtoH(acStack_3d + 1,&local_4c,2);
local_58[0] = (ushort)local_4c * 0x100 + (ushort)local_4b;
(**(code **)(param_1 + 0x14))(param_1,uVar10 * 0x100 + uVar4,local_58[0]);
sVar8 = strlen(__s);
pcVar12 = "[0x%02X]:%02X ";
}
sprintf(__s + sVar8,pcVar12) //possible issue identified - semgrep
}
} while( true );
}
sprintf(__s,"\n") //possible issue identified - semgrep
uVar9 = 0;
do {
(**(code **)(param_1 + 0x10))(param_1,uVar9,local_58);
sVar8 = strlen(__s);
sprintf(__s + sVar8,"[0x%04X]:%04X ") //possible issue identified - semgrep
uVar7 = uVar9 & 6;
uVar9 = uVar9 + 2;
if (uVar7 == 6) {
sVar8 = strlen(__s);
sprintf(__s + sVar8,"\n") //possible issue identified - semgrep
}
} while (uVar9 != 0x200);
LAB_00087ce0:
sVar8 = strlen(__s);
if (sVar8 == 1) {
sVar8 = strlen(__s);
sprintf(__s + sVar8,"===>Error command format!") //possible issue identified - semgrep
}
AP_E2PROM_IOCTL_PostCtrl(param_2,__s);
LAB_00087d2c:
os_free_mem(0,local_54);
if ((*(short *)((int)param_2 + 6) != 0x525) && (2 < RTDebugLevel)) {
printk("<==RTMPIoctlE2PROM\n");
}
}
return;
}