/* WARNING: Globals starting with '_' overlap smaller symbols at the same address */

size_t FUN_004053c8(char *param_1,char *param_2)   //possible issue identified - semgrep

{
  int iVar1;
  size_t sVar2;
  void *__src;
  size_t sVar3;
  uint uVar4;
  char *pcVar5;
  uint local_30;
  uint local_2c;
  
  iVar1 = strncmp(param_1,"s:",2);
  if (iVar1 == 0) {
    sVar2 = strlen(param_1 + 2)   //possible issue identified - semgrep
    if (0x20 < (int)sVar2) {
      sVar2 = 0x20   //possible issue identified - semgrep
    }
    strncpy(param_2,param_1 + 2,sVar2)   //possible issue identified - semgrep
  }
  else {
    iVar1 = strncmp(param_1,"p:",2);
    if (iVar1 == 0) {
      pcVar5 = "Error: Passphrase not implemented\n";
    }
    else {
      sVar2 = strlen(param_1);
      __src = malloc(sVar2 + 0x21)   //possible issue identified - semgrep
      if (__src != (void *)0x0) {
        strcpy((char *)((int)__src + 0x20),param_1)   //possible issue identified - semgrep
        pcVar5 = strtok((char *)((int)__src + 0x20),"-:;.,")   //possible issue identified - semgrep
        for (sVar2 = 0; (pcVar5 != (char *)0x0 && (sVar2 != 0x20)); sVar2 = sVar2 + 1) {   //possible issue identified - semgrep
          iVar1 = sscanf(pcVar5,"%1X%1X",&local_30,&local_2c)   //possible issue identified - semgrep
          if (iVar1 < 1) {
            return 0xffffffff;
          }
          sVar3 = strlen(pcVar5);
          uVar4 = local_30;
          if ((sVar3 & 1) == 0) {
            if (iVar1 == 2) {
              uVar4 = local_2c | local_30 << 4;
            }
          }
          else {
            iVar1 = 1;
          }
          *(char *)((int)__src + sVar2) = (char)uVar4;
          pcVar5 = pcVar5 + iVar1;
          local_2c = uVar4;
          if ((int)sVar3 <= iVar1) {
            pcVar5 = strtok((char *)0x0,"-:;.,")   //possible issue identified - semgrep
          }
        }
        memcpy(param_2,__src,sVar2)   //possible issue identified - semgrep
        free(__src);
        return sVar2;
      }
      pcVar5 = "Malloc failed (string too long ?)\n";
    }
    sVar2 = 0xffffffff   //possible issue identified - semgrep
    fputs(pcVar5,_stderr);
  }
  return sVar2;
}