undefined4
PeerProbeReqSanity(int param_1,int param_2,int param_3,void *param_4,void *param_5,byte *param_6)

{
  byte bVar1;
  uint uVar2;
  char *pcVar3;
  uint __n;
  void *local_248;
  undefined1 auStack_244 [4];
  short local_240;
  undefined2 local_23e;
  undefined1 auStack_234 [6];
  undefined1 local_22e;
  char local_22d;
  undefined1 auStack_22c [4];
  undefined1 auStack_228 [512];
  
  local_248 = (void *)0x0;
  os_alloc_mem(0,&local_248,0x200);
  *param_6 = 0;
  memcpy(param_4,(void *)(param_2 + 10),6)   //possible issue identified - semgrep
  if (*(char *)(param_2 + 0x18) == '\0') {
    bVar1 = *(byte *)(param_2 + 0x19);
    if (bVar1 < 0x21) {
      *param_6 = bVar1;
      memmove(param_5,(void *)(param_2 + 0x1a),(uint)bVar1)   //possible issue identified - semgrep
      pcVar3 = (char *)(param_2 + 0x18);
      __n = 0;
      do {
        if ((char *)(param_2 + param_3) <= pcVar3 + (byte)pcVar3[1] + 1) {
          if ((local_248 != (void *)0x0) && (__n != 0)) {
            memset(auStack_244,0,0x10)   //possible issue identified - semgrep
            memcpy(auStack_234,param_4,6)   //possible issue identified - semgrep
            local_22d = (char)__n + '\x04'   //possible issue identified - semgrep
            local_22e = 0xdd;
            memcpy(auStack_22c,&WPS_OUI,4)   //possible issue identified - semgrep
            memcpy(auStack_228,local_248,__n)   //possible issue identified - semgrep
            local_240 = (short)__n + 0xc   //possible issue identified - semgrep
            local_23e = 0xf00;
            wireless_send_event(*(undefined4 *)(param_1 + 4),0x8c02,auStack_244,auStack_234);
          }
          if (local_248 != (void *)0x0) {
            os_free_mem(0);
            return 1;
          }
          return 1;
        }
        if (*pcVar3 == -0x23) {
          uVar2 = *(uint *)(pcVar3 + 2);
          if ((uVar2 >> 0x18 | uVar2 << 0x18 | (uVar2 & 0xff00) << 8 | (uVar2 & 0xff0000) >> 8) ==
              0x50f204) {
            if (__n < 0x200) {
              uVar2 = (uint)(byte)pcVar3[1];
            }
            else if (RTDebugLevel == 0) {
              uVar2 = (uint)(byte)pcVar3[1];
            }
            else {
              printk("APPeerProbeReqSanity : PeerWscIeLen = %d (>= 512)\n",__n);
              uVar2 = (uint)(byte)pcVar3[1];
            }
            if (0x1ff < (uVar2 - 4) + __n) {
              printk("APPeerProbeReqSanity : Total PeerWscIeLen = %d (>= 512)\n");
              if (local_248 == (void *)0x0) {
                return 0;
              }
              os_free_mem(0);
              return 0;
            }
            if (local_248 != (void *)0x0) {
              if (0x1ff < __n) {
                uVar2 = (uint)(byte)pcVar3[1];
                goto LAB_00032918;
              }
              memmove((void *)((int)local_248 + __n),pcVar3 + 6,uVar2 - 4)   //possible issue identified - semgrep
              __n = __n + ((byte)pcVar3[1] - 4);
            }
            uVar2 = (uint)(byte)pcVar3[1];
          }
          else {
            uVar2 = (uint)(byte)pcVar3[1];
          }
        }
        else {
          uVar2 = (uint)(byte)pcVar3[1];
        }
LAB_00032918:
        pcVar3 = pcVar3 + uVar2 + 2;
      } while( true );
    }
  }
  if (2 < RTDebugLevel) {
    printk("PeerProbeReqSanity fail - wrong SSID IE\n");
  }
  return 0;
}