input
stringlengths
26
172k
output
stringlengths
18
318k
repo_name
stringclasses
23 values
decompiler
stringclasses
5 values
void usage(int status) { if (status != 0) do { fprintf(stderr, gettext("Try '%s --help' for more information.\n"), program_name); } while (0); else { printf(gettext("Usage: %s [OPTION] NAME...\n") , program_name); fputs_unlocked( gettext("Output each NAME with its last non-slash component and " "trailing slashes\nremoved; if NAME contains no /'s, output " "'.' (meaning the current directory).\n\n"), stdout) ; fputs_unlocked( gettext( " -z, --zero end each output line with NUL, not newline\n"), stdout) ; fputs_unlocked(gettext(" --help display this help and exit\n"), stdout); fputs_unlocked( gettext(" --version output version information and exit\n"), stdout); printf(gettext("\nExamples:\n %s /usr/bin/ -> \"/usr\"\n %s " "dir1/str dir2/str -> \"dir1\" followed by \"dir2\"\n %s " "stdio.h -> \".\"\n") , program_name, program_name, program_name); emit_ancillary_info("dirname"); } exit(status); }
void usage(unsigned long a0) { unsigned long v0; unsigned long v1; unsigned long v2; unsigned long v4; unsigned long v5; unsigned long v6; v2 = v4; v1 = v5; v0 = v6; if (a0) { fprintf(stderr, gettext("Try '%s --help' for more information.\n")); } else { printf(gettext("Usage: %s [OPTION] NAME...\n")); fputs_unlocked( gettext("Output each NAME with its last non-slash component and " "trailing slashes\nremoved; if NAME contains no /'s, output " "'.' (meaning the current directory).\n\n"), stdout); fputs_unlocked( gettext( " -z, --zero end each output line with NUL, not newline\n"), stdout); fputs_unlocked(gettext(" --help display this help and exit\n"), stdout); fputs_unlocked( gettext(" --version output version information and exit\n"), stdout); printf(gettext("\nExamples:\n %s /usr/bin/ -> \"/usr\"\n %s " "dir1/str dir2/str -> \"dir1\" followed by \"dir2\"\n %s " "stdio.h -> \".\"\n")); emit_ancillary_info("dirname"); } exit(a0); }
coreutils
angr_dream
off_t off_from_header(const char *p, size_t s) { return from_header( p, s, "off_t", 0, ((off_t)(!(!((off_t)0 < (off_t)-1)) ? (off_t)-1 : ((((off_t)1 << ((sizeof(off_t) * 8) - 2)) - 1) * 2 + 1))), 0, 0); }
long off_from_header(_BYTE *a1, size_t a2) { return from_header(a1, a2, (long)"off_t", 0LL, 0x7FFFFFFFFFFFFFFFuLL, 0, 0); }
tar
ida
static void print_deferred_heredocs(cstring) const char *cstring; { if (cstring && cstring[0] && (cstring[0] != ';' || cstring[1])) cprintf("%s", cstring); if (deferred_heredocs) { print_heredoc_bodies(deferred_heredocs); if (cstring && cstring[0] && (cstring[0] != ';' || cstring[1])) cprintf(" "); dispose_redirects(deferred_heredocs); was_heredoc = 1; } deferred_heredocs = (REDIRECT *)((void *)0); }
void print_deferred_heredocs(char a0[2]) { unsigned long long v1; unsigned long long v2; if (a0 && a0[0] && (a0[1] || a0[0] != 59)) cprintf("%s"); v1 = deferred_heredocs; if (deferred_heredocs) { print_heredoc_bodies(deferred_heredocs); if (a0 && a0[0] && (a0[1] || a0[0] != 59)) cprintf(" "); v2 = dispose_redirects(deferred_heredocs); was_heredoc = 1; } deferred_heredocs = 0; return; }
bash
angr_dream
void xfrm_xfrma_print(struct rtattr *tb[], __u16 family, FILE *fp, const char *prefix, _Bool nokeys) { if (tb[XFRMA_MARK]) { struct rtattr *rta = tb[XFRMA_MARK]; struct xfrm_mark *m = ((void *)(((char *)(rta)) + ((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0)))); fprintf(fp, "\tmark %#x/%#x ", m->v, m->m); if (tb[XFRMA_SET_MARK]) xfrm_output_mark_print(tb, fp); fprintf(fp, "%s", _SL_); } else if (tb[XFRMA_SET_MARK]) { fprintf(fp, "\t"); xfrm_output_mark_print(tb, fp); fprintf(fp, "%s", _SL_); } if (tb[XFRMA_ALG_AUTH] && !tb[XFRMA_ALG_AUTH_TRUNC]) { struct rtattr *rta = tb[XFRMA_ALG_AUTH]; xfrm_algo_print( ((void *)(((char *)(rta)) + ((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0)))), XFRMA_ALG_AUTH, ((int)((rta)->rta_len) - ((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0))), fp, prefix, nokeys); } if (tb[XFRMA_ALG_AUTH_TRUNC]) { struct rtattr *rta = tb[XFRMA_ALG_AUTH_TRUNC]; xfrm_auth_trunc_print( ((void *)(((char *)(rta)) + ((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0)))), ((int)((rta)->rta_len) - ((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0))), fp, prefix, nokeys); } if (tb[XFRMA_ALG_AEAD]) { struct rtattr *rta = tb[XFRMA_ALG_AEAD]; xfrm_aead_print( ((void *)(((char *)(rta)) + ((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0)))), ((int)((rta)->rta_len) - ((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0))), fp, prefix, nokeys); } if (tb[XFRMA_ALG_CRYPT]) { struct rtattr *rta = tb[XFRMA_ALG_CRYPT]; xfrm_algo_print( ((void *)(((char *)(rta)) + ((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0)))), XFRMA_ALG_CRYPT, ((int)((rta)->rta_len) - ((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0))), fp, prefix, nokeys); } if (tb[XFRMA_ALG_COMP]) { struct rtattr *rta = tb[XFRMA_ALG_COMP]; xfrm_algo_print( ((void *)(((char *)(rta)) + ((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0)))), XFRMA_ALG_COMP, ((int)((rta)->rta_len) - ((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0))), fp, prefix, nokeys); } if (tb[XFRMA_ENCAP]) { struct xfrm_encap_tmpl *e; if (prefix) fputs(prefix, fp); fprintf(fp, "encap "); if (((int)((tb[XFRMA_ENCAP])->rta_len) - ((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0))) < sizeof(*e)) { fprintf(fp, "(ERROR truncated)"); fprintf(fp, "%s", _SL_); return; } e = ((void *)(((char *)(tb[XFRMA_ENCAP])) + ((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0)))); fprintf(fp, "type "); switch (e->encap_type) { case 1: fprintf(fp, "espinudp-nonike "); break; case 2: fprintf(fp, "espinudp "); break; case 7: fprintf(fp, "espintcp "); break; default: fprintf(fp, "%u ", e->encap_type); break; } fprintf(fp, "sport %u ", ntohs(e->encap_sport)); fprintf(fp, "dport %u ", ntohs(e->encap_dport)); fprintf(fp, "addr %s", rt_addr_n2a(family, sizeof(e->encap_oa), &e->encap_oa)); fprintf(fp, "%s", _SL_); } if (tb[XFRMA_TMPL]) { struct rtattr *rta = tb[XFRMA_TMPL]; xfrm_tmpl_print( ((void *)(((char *)(rta)) + ((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0)))), ((int)((rta)->rta_len) - ((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0))), fp, prefix); } if (tb[XFRMA_COADDR]) { const xfrm_address_t *coa; if (prefix) fputs(prefix, fp); fprintf(fp, "coa "); coa = ((void *)(((char *)(tb[XFRMA_COADDR])) + ((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0)))); if (((int)((tb[XFRMA_COADDR])->rta_len) - ((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0))) < sizeof(*coa)) { fprintf(fp, "(ERROR truncated)"); fprintf(fp, "%s", _SL_); return; } fprintf(fp, "%s", rt_addr_n2a(family, sizeof(*coa), coa)); fprintf(fp, "%s", _SL_); } if (tb[XFRMA_LASTUSED]) { __u64 lastused; if (prefix) fputs(prefix, fp); fprintf(fp, "lastused "); if (((int)((tb[XFRMA_LASTUSED])->rta_len) - ((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0))) < sizeof(lastused)) { fprintf(fp, "(ERROR truncated)"); fprintf(fp, "%s", _SL_); return; } lastused = rta_getattr_u64(tb[XFRMA_LASTUSED]); fprintf(fp, "%s", strxf_time(lastused)); fprintf(fp, "%s", _SL_); } if (tb[XFRMA_REPLAY_VAL]) { struct xfrm_replay_state *replay; if (prefix) fputs(prefix, fp); fprintf(fp, "anti-replay context: "); if (((int)((tb[XFRMA_REPLAY_VAL])->rta_len) - ((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0))) < sizeof(*replay)) { fprintf(fp, "(ERROR truncated)"); fprintf(fp, "%s", _SL_); return; } replay = ((void *)(((char *)(tb[XFRMA_REPLAY_VAL])) + ((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0)))); fprintf(fp, "seq 0x%x, oseq 0x%x, bitmap 0x%08x", replay->seq, replay->oseq, replay->bitmap); fprintf(fp, "%s", _SL_); } if (tb[XFRMA_REPLAY_ESN_VAL]) { struct xfrm_replay_state_esn *replay; unsigned int i, j; if (prefix) fputs(prefix, fp); fprintf(fp, "anti-replay esn context:"); if (((int)((tb[XFRMA_REPLAY_ESN_VAL])->rta_len) - ((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0))) < sizeof(*replay)) { fprintf(fp, "(ERROR truncated)"); fprintf(fp, "%s", _SL_); return; } fprintf(fp, "%s", _SL_); replay = ((void *)(((char *)(tb[XFRMA_REPLAY_ESN_VAL])) + ((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0)))); if (prefix) fputs(prefix, fp); fprintf(fp, " seq-hi 0x%x, seq 0x%x, oseq-hi 0x%0x, oseq 0x%0x", replay->seq_hi, replay->seq, replay->oseq_hi, replay->oseq); fprintf(fp, "%s", _SL_); if (prefix) fputs(prefix, fp); fprintf(fp, " replay_window %u, bitmap-length %u", replay->replay_window, replay->bmp_len); for (i = replay->bmp_len, j = 0; i; i--) { if (j++ % 8 == 0) { fprintf(fp, "%s", _SL_); if (prefix) fputs(prefix, fp); fprintf(fp, " "); } fprintf(fp, "%08x ", replay->bmp[i - 1]); } fprintf(fp, "%s", _SL_); } if (tb[XFRMA_OFFLOAD_DEV]) { struct xfrm_user_offload *xuo; if (prefix) fputs(prefix, fp); fprintf(fp, "crypto offload parameters: "); if (((int)((tb[XFRMA_OFFLOAD_DEV])->rta_len) - ((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0))) < sizeof(*xuo)) { fprintf(fp, "(ERROR truncated)"); fprintf(fp, "%s", _SL_); return; } xuo = (struct xfrm_user_offload *)(( void *)(((char *)(tb[XFRMA_OFFLOAD_DEV])) + ((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0)))); fprintf(fp, "dev %s dir %s", ll_index_to_name(xuo->ifindex), (xuo->flags & 2) ? "in" : "out"); fprintf(fp, "%s", _SL_); } if (tb[XFRMA_IF_ID]) { __u32 if_id = rta_getattr_u32(tb[XFRMA_IF_ID]); if (prefix) fputs(prefix, fp); fprintf(fp, "if_id %#x", if_id); fprintf(fp, "%s", _SL_); } if (tb[XFRMA_TFCPAD]) { __u32 tfcpad = rta_getattr_u32(tb[XFRMA_TFCPAD]); if (prefix) fputs(prefix, fp); fprintf(fp, "tfcpad %u", tfcpad); fprintf(fp, "%s", _SL_); } }
void xfrm_xfrma_print(struct_0 *a0, unsigned long a1, void *a2, char *a3, unsigned long long a4) { unsigned int v0; int tmp_11; unsigned int v1; unsigned int v2; unsigned int v3; unsigned long v4; unsigned long v5; unsigned short *v6; unsigned short *v7; unsigned short *v8; unsigned short *v9; unsigned short *v10; unsigned short v11[3]; unsigned short *v12; unsigned long long v13; unsigned long long v14; unsigned int v15[3]; unsigned int v16[6]; struct_3 *v17; unsigned long long v19; unsigned long long v20; unsigned long long v21; unsigned long long v22; unsigned long long v23; unsigned int v24; unsigned long long v25; unsigned long long v26; unsigned long long v27; if (a0->field_a8) { v4 = a0->field_a8; v5 = v4 + 4; fprintf(a2, "\tmark %#x/%#x "); if (a0->field_e8) xfrm_output_mark_print(a0, a2); fprintf(a2, "%s", *(&_SL_)); } else if (a0->field_e8) { fprintf(a2, "\t"); xfrm_output_mark_print(a0, a2); fprintf(a2, "%s", *(&_SL_)); } if (a0->field_8 && !a0->field_a0) { v6 = a0->field_8; xfrm_algo_print(v6 + 2, 0x1, *(v6)-4, a2, a3, a4); } if (a0->field_a0) { v7 = a0->field_a0; xfrm_auth_trunc_print(v7 + 2, *(v7)-4, a2, a3, a4); } if (a0->field_90) { v8 = a0->field_90; xfrm_aead_print(v8 + 2, *(v8)-4, a2, a3, a4); } if (a0->field_10) { v9 = a0->field_10; xfrm_algo_print(v9 + 2, 0x2, *(v9)-4, a2, a3, a4); } if (a0->field_18) { v10 = a0->field_18; xfrm_algo_print(v10 + 2, 0x3, *(v10)-4, a2, a3, a4); } if (a0->field_20) { if (a3) fputs(a3, a2); fprintf(a2, "encap "); if (a0->field_20->field_0 - 4 <= 23) { fprintf(a2, "(ERROR truncated)"); v19 = fprintf(a2, "%s", *(&_SL_)); return; } *(&v11) = a0->field_20 + 2; fprintf(a2, "type "); switch (v11[0]) { case 7: fprintf(a2, "espintcp "); break; case 1: fprintf(a2, "espinudp-nonike "); break; case 2: fprintf(a2, "espinudp "); break; default: fprintf(a2, "%u ", v11[0]); break; } fprintf(a2, "sport %u ", ntohs(v11[1])); fprintf(a2, "dport %u ", ntohs(v11[2])); fprintf(a2, "addr %s", rt_addr_n2a(a1, 0x10, &v11[1 + 1])); fprintf(a2, "%s", *(&_SL_)); } if (a0->field_28) { v12 = a0->field_28; xfrm_tmpl_print(v12 + 2, *(v12)-4, a2, a3); } if (a0->field_70) { if (a3) fputs(a3, a2); fprintf(a2, "coa "); v13 = a0->field_70 + 2; if (a0->field_70->field_0 - 4 <= 15) { fprintf(a2, "(ERROR truncated)"); v20 = fprintf(a2, "%s", *(&_SL_)); return; } fprintf(a2, "%s", rt_addr_n2a(a1, 0x10, v13)); fprintf(a2, "%s", *(&_SL_)); } if (a0->field_78) { if (a3) fputs(a3, a2); fprintf(a2, "lastused "); if (a0->field_78->field_0 - 4 <= 7) { fprintf(a2, "(ERROR truncated)"); v21 = fprintf(a2, "%s", *(&_SL_)); return; } v14 = rta_getattr_u64(a0->field_78); fprintf(a2, "%s", strxf_time(v14)); fprintf(a2, "%s", *(&_SL_)); } if (a0->field_50) { if (a3) fputs(a3, a2); fprintf(a2, "anti-replay context: "); if (a0->field_50->field_0 - 4 <= 11) { fprintf(a2, "(ERROR truncated)"); v22 = fprintf(a2, "%s", *(&_SL_)); return; } *(&v15[0]) = a0->field_50 + 2; fprintf(a2, "seq 0x%x, oseq 0x%x, bitmap 0x%08x", v15[1], v15[0], v15[2]); fprintf(a2, "%s", *(&_SL_)); } if (a0->field_b8) { if (a3) fputs(a3, a2); fprintf(a2, "anti-replay esn context:"); if (a0->field_b8->field_0 - 4 <= 23) { fprintf(a2, "(ERROR truncated)"); v23 = fprintf(a2, "%s", *(&_SL_)); return; } fprintf(a2, "%s", *(&_SL_)); *(&v16[0]) = a0->field_b8 + 2; if (a3) fputs(a3, a2); fprintf(a2, " seq-hi 0x%x, seq 0x%x, oseq-hi 0x%0x, oseq 0x%0x", v16[4], v16[2], v16[3], v16[1]); fprintf(a2, "%s", *(&_SL_)); if (a3) fputs(a3, a2); fprintf(a2, " replay_window %u, bitmap-length %u", v16[5], v16[0]); v0 = v16[0]; for (v1 = 0; v0; v0 -= 1) { tmp_11 = v1; v1 += 1; if (!(tmp_11 & 7)) { fprintf(a2, "%s", *(&_SL_)); if (a3) fputs(a3, a2); fprintf(a2, " "); } fprintf(a2, "%08x ", v16[5 + v0]); } fprintf(a2, "%s", *(&_SL_)); } if (a0->field_e0) { if (a3) fputs(a3, a2); fprintf(a2, "crypto offload parameters: "); if (a0->field_e0->field_0 - 4 <= 7) { fprintf(a2, "(ERROR truncated)"); v25 = fprintf(a2, "%s", *(&_SL_)); return; } v17 = &a0->field_e0[2]; if (!(v17->field_4 & 2)) v24 = &g_405751; else v24 = "in"; fprintf(a2, "dev %s dir %s", ll_index_to_name(v17->field_0), v24); fprintf(a2, "%s", *(&_SL_)); } if (a0->field_f8) { v2 = rta_getattr_u32(a0->field_f8); if (a3) fputs(a3, a2); fprintf(a2, "if_id %#x"); fprintf(a2, "%s", *(&_SL_)); } v26 = a0->field_b0; if (!a0->field_b0) return; v3 = rta_getattr_u32(a0->field_b0); if (a3) fputs(a3, a2); fprintf(a2, "tfcpad %u", v3); v27 = fprintf(a2, "%s", *(&_SL_)); return; }
iproute2-6.0.0
angr_sailr
static int dowait(int block, struct job *jp) { int gotchld = *(volatile int *)&gotsigchld; int rpid; int pid; if (jp && jp->state != 0) block = 0; if (block == 0 && !gotchld) return 1; rpid = 1; do { pid = waitone(block, jp); rpid &= !!pid; block &= ~4; if (!pid || (jp && jp->state != 0)) block = 0; } while (pid >= 0); return rpid; }
long dowait(int a1, long a2) { unsigned int v4; int v5; if (a2 && *(_BYTE *)(a2 + 30)) a1 = 0; if (!a1 && !gotsigchld) return 1LL; LOBYTE(v4) = 1; do { v5 = waitone(a1, a2); v4 = (v5 != 0) & (unsigned char)v4; a1 &= ~4u; if (!v5 || a2 && *(_BYTE *)(a2 + 30)) a1 = 0; } while (v5 >= 0); return v4; }
dash-0.5.11+git20210903+057cd650a4ed
ida
static void Rq_encode(unsigned char *s, const Fq *r) { crypto_uint16 R[761], M[761]; int i; for (i = 0; i < 761; ++i) R[i] = r[i] + ((4591 - 1) / 2); for (i = 0; i < 761; ++i) M[i] = 4591; Encode(s, R, M, 761); }
void Rq_encode(unsigned long long a0, unsigned short *a1) { unsigned int v0; char v1; char v2; char v3; unsigned long long v5; unsigned long long *v6; unsigned long long v7; for (v0 = 0; v0 <= 760; v0 = __addvsi3(v0, 0x1, a1[v0] + 2295)) { v5 = a1[v0] + 2295; *(&(&v1)[2 * v0]) = a1[v0] + 2295; } for (v0 = 0; v0 <= 760; v0 = __addvsi3(v0, 0x1, v5)) { *(&(&v2)[2 * v0]) = 4591; } Encode(a0, &v1, &v2, 0x2f9); v7 = *(&v3) ^ v6[5]; return; }
openssh-portable
angr_dream
static void catch_signals(__attribute__((unused)) int sig) { _exit(10); }
void catch_signals(void) { _exit(10); }
shadow
ghidra
void sys_spawn_shell(void) { pid_t child; const char *shell = getenv("SHELL"); if (!shell) shell = "/bin/sh"; child = xfork(); if (child == 0) { priv_set_restore_linkdir(); execlp(shell, "-sh", "-i", ((void *)0)); exec_fatal(shell); } else { int wait_status; while (waitpid(child, &wait_status, 0) == -1) if ((*__errno_location()) != 4) { waitpid_error(shell); break; } } }
long long sys_spawn_shell() { char v0; unsigned int v1; unsigned long long v2; v2 = getenv("SHELL"); if (!v2) v2 = "/bin/sh"; v1 = xfork(); if (!v1) { priv_set_restore_linkdir(); execlp(v2, "-sh"); exec_fatal(v2); } while (true) { if (waitpid(v1, &v0, 0x0) != -1) break; if (*(__errno_location()) == 4) continue; waitpid_error(v2); break; } return 0; }
tar
angr_dream
const struct parser_table *find_parser(const char *search_name) { int i; const char *original_arg = search_name; if (0 == strncmp("-newer", search_name, 6) && (8 == strlen(search_name))) { return found_parser(original_arg, &parse_entry_newerXY); } if (*search_name == '-') search_name++; for (i = 0; parse_table[i].parser_name != ((void *)0); i++) { if (strcmp(parse_table[i].parser_name, search_name) == 0) { return found_parser(original_arg, &parse_table[i]); } } return ((void *)0); }
_DWORD *find_parser(char *a1) { char *s2; int i; s2 = a1; if (!strncmp("-newer", a1, 6uLL) && strlen(a1) == 8) return found_parser((long)a1, parse_entry_newerXY); if (*a1 == 45) s2 = a1 + 1; for (i = 0; (&off_6EE8)[4 * i]; ++i) { if (!strcmp((&off_6EE8)[4 * i], s2)) return found_parser((long)a1, (_DWORD *)&parse_table + 8 * i); } return 0LL; }
findutils
ida
const char *kex_default_pk_alg(void) { static char *pkalgs; if (pkalgs == ((void *)0)) { char *all_key; all_key = sshkey_alg_list(0, 0, 1, ','); pkalgs = match_filter_allowlist("ssh-ed25519-cert-v01@openssh.com," "ecdsa-sha2-nistp256-cert-v01@openssh.com," "ecdsa-sha2-nistp384-cert-v01@openssh.com," "ecdsa-sha2-nistp521-cert-v01@openssh.com," "sk-ssh-ed25519-cert-v01@openssh.com," "sk-ecdsa-sha2-nistp256-cert-v01@openssh.com," "rsa-sha2-512-cert-v01@openssh.com," "rsa-sha2-256-cert-v01@openssh.com," "ssh-ed25519," "ecdsa-sha2-nistp256," "ecdsa-sha2-nistp384," "ecdsa-sha2-nistp521," "sk-ssh-ed25519@openssh.com," "sk-ecdsa-sha2-nistp256@openssh.com," "rsa-sha2-512," "rsa-sha2-256", all_key); free(all_key); } return pkalgs; }
long kex_default_pk_alg(void) { void *__ptr; if (pkalgs_19152 == 0) { __ptr = (void *)sshkey_alg_list(0, 0, 1, 0x2c); pkalgs_19152 = match_filter_allowlist( "ssh-ed25519-cert-v01@openssh.com,ecdsa-sha2-nistp256-cert-v01@openssh." "com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-" "v01@openssh.com,sk-ssh-ed25519-cert-v01@openssh.com,sk-ecdsa-sha2-" "nistp256-cert-v01@openssh.com,rsa-sha2-512-cert-v01@openssh.com,rsa-" "sha2-256-cert-v01@openssh.com,ssh-ed25519,ecdsa-sha2-nistp256,ecdsa-" "sha2-nistp384,ecdsa-sha2-nistp521,sk-ssh-ed25519@openssh.com,sk-ecdsa-" "sha2-nistp256@openssh.com,rsa-sha2-512,rsa-sha2-256", __ptr); free(__ptr); } return pkalgs_19152; }
openssh-portable
ghidra
static void idname_free(struct idname *idname) { if (idname == ((void *)0)) return; free(idname->name); free(idname); }
void idname_free(struct_0 *a0) { unsigned long long v1; if (a0) { free(a0->field_8); v1 = free(a0); } return; }
openssh-portable
angr_dream
static void feputs(const char *line, FILE *fp) { unsigned char *p; for (p = (unsigned char *)line; *p; p++) { if (strchr("\t\r\n", *p) || (*p >= 32 && *p <= 127) || (*p >= 160)) { fputc(*p, fp); } else { fprintf(fp, "^%c", (*p & 0x1f) + 'A' - 1); } } fflush(fp); }
int feputs(char *a1, FILE *a2) { while (*a1) { if (strchr("\t\r\n", (unsigned char)*a1) || *a1 > 31 || (unsigned char)*a1 > 0x9Fu) fputc((unsigned char)*a1, a2); else fprintf(a2, "^%c", (*a1 & 0x1Fu) + 64); ++a1; } return fflush(a2); }
sysvinit
ida
static int history_def_insert(history_t *h, HistEventW *ev, const wchar_t *str) { hentry_t *c; c = malloc(sizeof(*c)); if (c == ((void *)0)) goto oomem; if ((c->ev.str = wcsdup(str)) == ((void *)0)) { free(c); goto oomem; } c->data = ((void *)0); c->ev.num = ++h->eventid; c->next = h->list.next; c->prev = &h->list; h->list.next->prev = c; h->list.next = c; h->cur++; h->cursor = c; *ev = c->ev; return 0; oomem: { ev->num = 2; ev->str = he_errlist[2]; }; return -1; }
long history_def_insert(long a1, _QWORD *a2, const wchar_t *a3) { long v3; _QWORD *ptr; ptr = malloc(0x28uLL); if (ptr) { ptr[1] = wcsdup(a3); if (ptr[1]) { ptr[2] = 0LL; *(_DWORD *)ptr = ++*(_DWORD *)(a1 + 56); ptr[3] = *(_QWORD *)(a1 + 24); ptr[4] = a1; *(_QWORD *)(*(_QWORD *)(a1 + 24) + 32LL) = ptr; *(_QWORD *)(a1 + 24) = ptr; ++*(_DWORD *)(a1 + 52); *(_QWORD *)(a1 + 40) = ptr; v3 = ptr[1]; *a2 = *ptr; a2[1] = v3; return 0LL; } free(ptr); } *(_DWORD *)a2 = 2; a2[1] = "m"; return 0xFFFFFFFFLL; }
libedit
ida
BZFILE *BZ2_bzWriteOpen(int *bzerror, FILE *f, int blockSize100k, int verbosity, int workFactor) { Int32 ret; bzFile *bzf = ((void *)0); { if (bzerror != ((void *)0)) *bzerror = 0; if (bzf != ((void *)0)) bzf->lastErr = 0; }; if (f == ((void *)0) || (blockSize100k < 1 || blockSize100k > 9) || (workFactor < 0 || workFactor > 250) || (verbosity < 0 || verbosity > 4)) { { if (bzerror != ((void *)0)) *bzerror = (-2); if (bzf != ((void *)0)) bzf->lastErr = (-2); }; return ((void *)0); }; if (ferror(f)) { { if (bzerror != ((void *)0)) *bzerror = (-6); if (bzf != ((void *)0)) bzf->lastErr = (-6); }; return ((void *)0); }; bzf = malloc(sizeof(bzFile)); if (bzf == ((void *)0)) { { if (bzerror != ((void *)0)) *bzerror = (-3); if (bzf != ((void *)0)) bzf->lastErr = (-3); }; return ((void *)0); }; { if (bzerror != ((void *)0)) *bzerror = 0; if (bzf != ((void *)0)) bzf->lastErr = 0; }; bzf->initialisedOk = ((Bool)0); bzf->bufN = 0; bzf->handle = f; bzf->writing = ((Bool)1); bzf->strm.bzalloc = ((void *)0); bzf->strm.bzfree = ((void *)0); bzf->strm.opaque = ((void *)0); if (workFactor == 0) workFactor = 30; ret = BZ2_bzCompressInit(&(bzf->strm), blockSize100k, verbosity, workFactor); if (ret != 0) { { if (bzerror != ((void *)0)) *bzerror = ret; if (bzf != ((void *)0)) bzf->lastErr = ret; }; free(bzf); return ((void *)0); }; bzf->strm.avail_in = 0; bzf->initialisedOk = ((Bool)1); return bzf; }
int BZ2_bzWriteOpen(unsigned int *a0, void *a1, unsigned long a2, unsigned long a3, unsigned long a4) { unsigned int v0; unsigned int v1; void *v2; unsigned int v4; v0 = a4; v2 = 0; if (a0) *(a0) = 0; if (v2) *(&v2[5096]) = 0; if (a1 && a2 > 0 && a2 <= 9 && v0 >= 0 && v0 <= 250 && a3 >= 0 && a3 <= 4) { if (ferror(a1)) { if (a0) *(a0) = -6; if (v2) *(&v2[5096]) = -6; v4 = 0; return v4; } else { v2 = malloc(0x13f0); if (v2) { if (a0) *(a0) = 0; if (v2) *(&v2[5096]) = 0; v2->field_13ec = 0; v2->field_1390 = 0; v2->field_0 = a1; v2->field_1394 = 1; v2->field_13d0 = 0; v2->field_13d8 = 0; v2->field_13e0 = 0; if (!v0) v0 = 30; v1 = BZ2_bzCompressInit(&v2->padding_1395[3], a2, a3, v0); if (!v1) { v2->field_13a0 = 0; v2->field_13ec = 1; v4 = v2; return v4; } if (a0) *(a0) = v1; if (v2) *(&v2[5096]) = v1; free(v2); v4 = 0; return v4; } else { if (a0) *(a0) = -3; if (v2) *(&v2[5096]) = -3; v4 = 0; return v4; } } } if (a0) *(a0) = -2; if (v2) *(&v2[5096]) = -2; v4 = 0; return v4; }
bzip2
angr_sailr
static crypto_uint32 ge(crypto_uint32 a, crypto_uint32 b) { unsigned int x = a; x -= (unsigned int)b; x >>= 31; x ^= 1; return x; }
int ge(unsigned long a0, unsigned long a1) { unsigned int v0; v0 = a0; v0 -= a1; v0 >>= 31; v0 ^= 1; return v0; }
openssh-portable
angr_dream
static int gl_linked_node_nx_set_value(gl_list_t list __attribute__((__unused__)), gl_list_node_t node, const void *elt) { node->value = elt; return 0; }
long long gl_linked_node_nx_set_value(unsigned long a0, struct_0 *a1, unsigned long a2) { char v0; unsigned long v1; v1 = a0; a1->field_10 = *(&v0); return 0; }
gnutls
angr_sailr
2 ) { get_addr(&daddr, "default", 2); addattr_l(n, 1024, IFLA_VXLAN_GROUP, daddr.data, daddr.bytelen); } else if (preferred_family ==
void get_addr(void) { halt_baddata(); }
iproute2-6.0.0
ghidra
static void shorten_name(name) char *name; { int len; char *trunc = ((void *)0); int plen; int min_part = 3; char *p; len = strlen(name); if (decompress) { if (len <= 1) gzip_error("name too short"); name[len - 1] = '\0'; return; } p = get_suffix(name); if (!p) gzip_error("can't recover suffix\n"); *p = '\0'; save_orig_name = 1; if (len > 4 && (strcmp((p - 4), (".tar")) == 0)) { strcpy(p - 4, ".tgz"); return; } do { p = last_component(name); while (*p) { plen = strcspn(p, "."); p += plen; if (plen > min_part) trunc = p - 1; if (*p) p++; } } while (trunc == ((void *)0) && --min_part != 0); if (trunc != ((void *)0)) { do { trunc[0] = trunc[1]; } while (*trunc++); trunc--; } else { trunc = strrchr(name, "."[0]); if (!trunc) gzip_error("internal error in shorten_name"); if (trunc[1] == '\0') trunc--; } strcpy(trunc, z_suffix); }
void shorten_name(char *a0) { unsigned int v0; int tmp_25; unsigned int v1; unsigned int v2; struct_0 *v3; char *v4; unsigned long long v6; unsigned long long v7; unsigned long long v8; unsigned long long v9; v3 = 0; v0 = 3; v1 = strlen(a0); if (decompress) { if (v1 <= 1) gzip_error("name too short"); v6 = &a0[1 + v1]; a0[1 + v1] = 0; } else { v4 = get_suffix(a0); if (!v4) gzip_error("can't recover suffix\n"); *(v4) = 0; outcnt = 1; if (v1 > 4) { v7 = strcmp(v4 + 4, ".tar"); if (!v7) v8 = strcpy(v4 + 4, ".tgz"); } if (v1 <= 4 || v7) { do { for (v4 = last_component(a0); *(v4); v4 += 1) { v2 = strcspn(v4, "."); v4 = &v4[v2]; if (v2 > v0) v3 = v4 + 1; if (!*(v4)) continue; } if (v3) break; v0 -= 1; } while (v0); if (v3) { do { *(v3) = v3[1]; tmp_25 = v3; v3 += 1; *(&v7) = *(tmp_25); } while (v7); v3 -= 1; } else { v3 = &strrchr(a0, 0x2e); if (!v3) gzip_error("internal error in shorten_name"); if (!v3->field_1) v3 -= 1; } v9 = strcpy(v3, z_suffix); } } return; }
gzip-1.12
angr_dream
ch_enlargebufs(EditLine *el, size_t addlen) { size_t sz, newsz; wchar_t *newbuffer, *oldbuf, *oldkbuf; sz = (size_t)(el->el_line.limit - el->el_line.buffer + 2); newsz = sz * 2; if (addlen > sz) { while (newsz - sz < addlen) newsz *= 2; } newbuffer = realloc(el->el_line.buffer, newsz * sizeof(*newbuffer)); if (!newbuffer) return 0; (void)memset(&newbuffer[sz], 0, (newsz - sz) * sizeof(*newbuffer)); oldbuf = el->el_line.buffer; el->el_line.buffer = newbuffer; el->el_line.cursor = newbuffer + (el->el_line.cursor - oldbuf); el->el_line.lastchar = newbuffer + (el->el_line.lastchar - oldbuf); el->el_line.limit = &newbuffer[sz - 2]; newbuffer = realloc(el->el_chared.c_kill.buf, newsz * sizeof(*newbuffer)); if (!newbuffer) return 0; (void)memset(&newbuffer[sz], 0, (newsz - sz) * sizeof(*newbuffer)); oldkbuf = el->el_chared.c_kill.buf; el->el_chared.c_kill.buf = newbuffer; el->el_chared.c_kill.last = newbuffer + (el->el_chared.c_kill.last - oldkbuf); el->el_chared.c_kill.mark = el->el_line.buffer + (el->el_chared.c_kill.mark - oldbuf); newbuffer = realloc(el->el_chared.c_undo.buf, newsz * sizeof(*newbuffer)); if (!newbuffer) return 0; (void)memset(&newbuffer[sz], 0, (newsz - sz) * sizeof(*newbuffer)); el->el_chared.c_undo.buf = newbuffer; newbuffer = realloc(el->el_chared.c_redo.buf, newsz * sizeof(*newbuffer)); if (!newbuffer) return 0; el->el_chared.c_redo.pos = newbuffer + (el->el_chared.c_redo.pos - el->el_chared.c_redo.buf); el->el_chared.c_redo.lim = newbuffer + (el->el_chared.c_redo.lim - el->el_chared.c_redo.buf); el->el_chared.c_redo.buf = newbuffer; if (!hist_enlargebuf(el, sz, newsz)) return 0; el->el_line.limit = &el->el_line.buffer[newsz - 2]; if (el->el_chared.c_resizefun) (*el->el_chared.c_resizefun)(el, el->el_chared.c_resizearg); return 1; }
int ch_enlargebufs(unsigned long long a0[125], unsigned long a1) { unsigned long v0; unsigned long v1; unsigned long v2; unsigned long v3; unsigned long v4; unsigned int v6; v1 = (a0[13] - a0[10] >> 2) + 2; if (a1 > v1) { for (v0 = v1 * 2; a1 > v0 - v1; v0 *= 2) ; } v2 = realloc(a0[10], v0 * 4); if (!v2) { v6 = 0; } else { memset(v2 + v1 * 4, 0x0, (v0 - v1) * 4); v3 = a0[10]; a0[10] = v2; a0[11] = a0[11] - v3 + v2; a0[12] = a0[12] - v3 + v2; a0[13] = v1 * 4 - 8 + v2; v2 = realloc(a0[112], v0 * 4); if (!v2) { v6 = 0; } else { memset(v2 + v1 * 4, 0x0, (v0 - v1) * 4); v4 = a0[112]; a0[112] = v2; a0[113] = a0[113] - v4 + v2; a0[114] = a0[10] + a0[114] - v3; v2 = realloc(a0[111], v0 * 4); if (!v2) { v6 = 0; } else { memset(v2 + v1 * 4, 0x0, (v0 - v1) * 4); a0[111] = v2; v2 = realloc(a0[115], v0 * 4); if (!v2) { v6 = 0; } else { a0[116] = a0[116] - a0[115] + v2; a0[117] = a0[117] - a0[115] + v2; a0[115] = v2; v6 = hist_enlargebuf(a0, v1, v0, v1); if (!v6) { v6 = 0; } else { a0[13] = v0 * 4 - 8 + a0[10]; if (a0[122]) a0[122](a0, a0[124], a0[124], a0[122]); v6 = 1; } } } } } return v6; }
libedit
angr_dream
static Channel *connect_to(struct ssh *ssh, const char *host, int port, char *ctype, char *rname) { struct channel_connect cctx; Channel *c; int sock; memset(&cctx, 0, sizeof(cctx)); sock = connect_to_helper(ssh, host, port, SOCK_STREAM, ctype, rname, &cctx, ((void *)0), ((void *)0)); if (sock == -1) { channel_connect_ctx_free(&cctx); return ((void *)0); } c = channel_new(ssh, ctype, 12, sock, sock, -1, (64 * (32 * 1024)), (32 * 1024), 0, rname, 1); c->host_port = port; c->path = xstrdup(host); c->connect_ctx = cctx; return c; }
void connect_to(void *a0, unsigned long a1, unsigned long a2, unsigned int a3, unsigned long a4) { unsigned int v0; struct_0 *v1; char v2; char v3; char v4; char v5; void *v8; struct_0 *v9; memset(&v2, 0x0, 0x20); v0 = connect_to_helper(a0, a1, a2, 0x1, a3, a4, &v2, 0x0, 0x0); if (v0 == -1) { channel_connect_ctx_free(&v2); v8 = 0; } else { *(&v1) = channel_new(a0, a3, 0xc, v0, v0, 0xffffffff, 0x200000, 0x8000, 0x0, a4, 0x1); v1->field_98 = a2; v1->field_80 = xstrdup(a1); v1->field_128 = *(&v2); v1->field_130 = *(&v3); v1->field_138 = *(&v4); v1->field_140 = *(&v5); v9 = v1; } return; }
openssh-portable
angr_phoenix
int crypto_kem_sntrup761_enc(unsigned char *c, unsigned char *k, const unsigned char *pk) { Encap(c, k, pk); return 0; }
long long crypto_kem_sntrup761_enc(char *a0, char *a1, unsigned int a2) { Encap(a0, a1, a2); return 0; }
openssh-portable
angr_sailr
static inline void emit_ancillary_info(char const *program) { struct infomap { char const *program; char const *node; } const infomap[] = { {"[", "test invocation"}, {"coreutils", "Multi-call invocation"}, {"sha224sum", "sha2 utilities"}, {"sha256sum", "sha2 utilities"}, {"sha384sum", "sha2 utilities"}, {"sha512sum", "sha2 utilities"}, {((void *)0), ((void *)0)}}; char const *node = program; struct infomap const *map_prog = infomap; while (map_prog->program && !(strcmp(program, map_prog->program) == 0)) map_prog++; if (map_prog->node) node = map_prog->node; printf (gettext ("\n%s online help: <%s>\n"), "GNU coreutils", "https: char const *lc_messages = setlocale ( 5 , ((void *)0) ); if (lc_messages && strncmp (lc_messages, "" "en_" "", sizeof ("en_") - 1)) { fputs_unlocked (gettext ("Report any translation bugs to " "<https: stdout ) ; } char const *url_program = (strcmp (program, "[") == 0) ? "test" : program; printf (gettext ("Full documentation <%s%s>\n"), "https: printf (gettext ("or available locally via: info '(coreutils) %s%s'\n"), node, node == program ? " invocation" : ""); }
void emit_ancillary_info(char *a0) { unsigned long v0; unsigned long long v1[2]; char *v2; unsigned long long v3; unsigned long long v4; unsigned long long v5; unsigned long long v6; unsigned long long v7; unsigned long long v8; unsigned long long v9; unsigned long long v10; unsigned long long v11; unsigned long long v12; unsigned long long v13; unsigned long long v14; unsigned long long v15; void *v16; void *v17; char v18; unsigned long long v20; unsigned long long *v21; unsigned long long v22; v4 = "["; v5 = "test invocation"; v6 = "coreutils"; v7 = "Multi-call invocation"; v8 = "sha224sum"; v9 = "sha2 utilities"; v10 = "sha256sum"; v11 = "sha2 utilities"; v12 = "sha384sum"; v13 = "sha2 utilities"; v14 = "sha512sum"; v15 = "sha2 utilities"; v16 = 0; v17 = 0; v0 = a0; v1[0] = &v4; while (true) { if (!v1[0]) break; if (!strcmp(a0, v1[0])) break; v1[0] = v1 + 1; } if (v1[1]) v0 = v1[1]; printf(gettext("\n%s online help: <%s>\n")); v2 = setlocale(0x5, NULL); if (v2 && strncmp(v2, "en_", 0x3)) fputs_unlocked(gettext("Report any translation bugs to <https: if (!strcmp(a0, "[")) v20 = "test"; else v20 = a0; v3 = v20; printf(gettext("Full documentation <%s%s>\n")); printf(gettext("or available locally via: info '(coreutils) %s%s'\n")); v22 = *(&v18) ^ v21[5]; return; }
coreutils
angr_phoenix
static void update_gecos(const char *user, char *gecos) { const struct passwd *pw; struct passwd pwent; if (setuid(0) != 0) { fputs(gettext("Cannot change ID to root.\n"), stderr); do { char *old_locale = setlocale(6, ((void *)0)); char *saved_locale = ((void *)0); if (((void *)0) != old_locale) { saved_locale = strdup(old_locale); } if (((void *)0) != saved_locale) { (void)setlocale(6, "C"); } syslog(3, "can't setuid(0)"); if (((void *)0) != saved_locale) { (void)setlocale(6, saved_locale); free(saved_locale); } } while (0); fail_exit(1); } pwd_init(); if (pw_lock() == 0) { fprintf(stderr, gettext("%s: cannot lock %s; try again later.\n"), Prog, pw_dbname()); fail_exit(1); } pw_locked = 1; if (pw_open(0100 | 02) == 0) { fprintf(stderr, gettext("%s: cannot open %s\n"), Prog, pw_dbname()); fail_exit(1); } pw = pw_locate(user); if (((void *)0) == pw) { fprintf(stderr, gettext("%s: user '%s' does not exist in %s\n"), Prog, user, pw_dbname()); fail_exit(1); } pwent = *pw; pwent.pw_gecos = gecos; if (pw_update(&pwent) == 0) { fprintf(stderr, gettext("%s: failed to prepare the new %s entry '%s'\n"), Prog, pw_dbname(), pwent.pw_name); fail_exit(1); } if (pw_close() == 0) { fprintf(stderr, gettext("%s: failure while writing changes to %s\n"), Prog, pw_dbname()); do { char *old_locale = setlocale(6, ((void *)0)); char *saved_locale = ((void *)0); if (((void *)0) != old_locale) { saved_locale = strdup(old_locale); } if (((void *)0) != saved_locale) { (void)setlocale(6, "C"); } syslog(3, "failure while writing changes to %s", pw_dbname()); if (((void *)0) != saved_locale) { (void)setlocale(6, saved_locale); free(saved_locale); } } while (0); fail_exit(1); } if (pw_unlock() == 0) { fprintf(stderr, gettext("%s: failed to unlock %s\n"), Prog, pw_dbname()); do { char *old_locale = setlocale(6, ((void *)0)); char *saved_locale = ((void *)0); if (((void *)0) != old_locale) { saved_locale = strdup(old_locale); } if (((void *)0) != saved_locale) { (void)setlocale(6, "C"); } syslog(3, "failed to unlock %s", pw_dbname()); if (((void *)0) != saved_locale) { (void)setlocale(6, saved_locale); free(saved_locale); } } while (0); } pw_locked = 0; }
unsigned long update_gecos(long a1, long a2) { FILE *v2; char *v3; long v4; long v5; char *v6; long v7; long v8; char *v9; long v10; long v11; char *v12; long v13; long v14; long v15; long v16; long v17; long v18; char *v19; long v20; long v21; char *v22; const char *v23; long v24; long v25; char *v26; const char *v27; char *locale; char *v30; char *v31; const char *s; long *v33; const char *v34; const char *v35; long v36[3]; long v37; long v38; long v39; unsigned long v40; v40 = __readfsqword(0x28u); if (setuid(0)) { v2 = stderr; v3 = gettext("Cannot change ID to root.\n"); fputs(v3, v2); s = setlocale(6, 0LL); locale = 0LL; if (s) locale = strdup(s); if (locale) setlocale(6, "C"); syslog(3, "can't setuid(0)"); if (locale) { setlocale(6, locale); free(locale); } fail_exit(1); } pwd_init(); if (!(unsigned int)pw_lock()) { v4 = pw_dbname(); v5 = Prog; v6 = gettext("%s: cannot lock %s; try again later.\n"); fprintf(stderr, v6, v5, v4); fail_exit(1); } pw_locked = 1; if (!(unsigned int)pw_open(66LL)) { v7 = pw_dbname(); v8 = Prog; v9 = gettext("%s: cannot open %s\n"); fprintf(stderr, v9, v8, v7); fail_exit(1); } v33 = (long *)pw_locate(a1); if (!v33) { v10 = pw_dbname(); v11 = Prog; v12 = gettext("%s: user '%s' does not exist in %s\n"); fprintf(stderr, v12, v11, a1, v10); fail_exit(1); } v13 = v33[1]; v36[0] = *v33; v36[1] = v13; v14 = v33[3]; v36[2] = v33[2]; v37 = v14; v15 = v33[5]; v38 = v33[4]; v39 = v15; v37 = a2; if (!(unsigned int)pw_update(v36)) { v16 = v36[0]; v17 = pw_dbname(); v18 = Prog; v19 = gettext("%s: failed to prepare the new %s entry '%s'\n"); fprintf(stderr, v19, v18, v17, v16); fail_exit(1); } if (!(unsigned int)pw_close()) { v20 = pw_dbname(); v21 = Prog; v22 = gettext("%s: failure while writing changes to %s\n"); fprintf(stderr, v22, v21, v20); v34 = setlocale(6, 0LL); v30 = 0LL; if (v34) v30 = strdup(v34); if (v30) setlocale(6, "C"); v23 = (const char *)pw_dbname(); syslog(3, "failure while writing changes to %s", v23); if (v30) { setlocale(6, v30); free(v30); } fail_exit(1); } if (!(unsigned int)pw_unlock()) { v24 = pw_dbname(); v25 = Prog; v26 = gettext("%s: failed to unlock %s\n"); fprintf(stderr, v26, v25, v24); v35 = setlocale(6, 0LL); v31 = 0LL; if (v35) v31 = strdup(v35); if (v31) setlocale(6, "C"); v27 = (const char *)pw_dbname(); syslog(3, "failed to unlock %s", v27); if (v31) { setlocale(6, v31); free(v31); } } pw_locked = 0; return __readfsqword(0x28u) ^ v40; }
shadow
ida
void rtrim(char *s) { size_t i; if ((i = strlen(s)) == 0) return; for (i--; i > 0; i--) { if (((*__ctype_b_loc())[(int)(((int)s[i]))] & (unsigned short int)_ISspace)) s[i] = '\0'; } }
void rtrim(char *param_1) { ushort **ppuVar1; size_t local_10; local_10 = strlen(param_1); if (local_10 != 0) { while (local_10 = local_10 - 1, local_10 != 0) { ppuVar1 = __ctype_b_loc(); if (((*ppuVar1)[param_1[local_10]] & 0x2000) != 0) { param_1[local_10] = '\0'; } } } return; }
openssh-portable
ghidra
(__ctype_get_mb_cur_max ()) > 1) ? (((t) && (t)[0]) ? ((t)[1] ? mbstrlen (t) : 1) : 0) : (((t) && (t)[0]) ? ((t)[1] ? ((t)[2] ? strlen(t) : 2) : 1) : 0)); do { if (t) sh_xfree((t), "subst.c", 8026); } while (0);
size_t __ctype_get_mb_cur_max(void) { halt_baddata(); }
bash
ghidra
int local_is_dir(const char *path) { struct stat sb; if (stat(path, &sb) == -1) return (0); return (((((sb.st_mode)) & 0170000) == (0040000))); }
long long local_is_dir(char *a0) { char v0; char v1; void *v3; if (stat(a0, &v0) == -1) v3 = 0; else v3 = (*(&v1) & 0xf000) == 0x4000; return v3; }
openssh-portable
angr_phoenix
void initialize_itemlist(itp) ITEMLIST *itp; { (*itp->list_getter)(itp); itp->flags |= 0x004; itp->flags &= ~0x002; }
void initialize_itemlist(uint *param_1) { (**(code **)(param_1 + 2))(param_1); *param_1 = *param_1 | 4; *param_1 = *param_1 & 0xfffffffd; return; }
bash
ghidra
static void locale_setblanks() { int x; for (x = 0; x < sh_syntabsiz; x++) { if (((*__ctype_b_loc())[(int)(((unsigned char)x))] & (unsigned short int)_ISblank)) sh_syntaxtab[x] |= 0x0002 | 0x2000; else if (((x) ? ((char *)mbschr(("()<>;&| \t\n"), (x)) != (char *)((void *)0)) : 0)) { sh_syntaxtab[x] |= 0x0002; sh_syntaxtab[x] &= ~0x2000; } else sh_syntaxtab[x] &= ~(0x0002 | 0x2000); } }
void locale_setblanks() { unsigned int v0; int tmp_80; unsigned long long v2; unsigned long long v3; v0 = 0; while (true) { v2 = sh_syntabsiz; if (v0 >= sh_syntabsiz) break; *(&v2) = *((*(__ctype_b_loc()) + v0 * 2)); *(&v2) = v2 & 1; if (v2) { *(&(&sh_syntaxtab)[4 * v0]) = *(&(&sh_syntaxtab)[4 * v0]) | 8194; } else if (!v0 || !mbschr("()<>;&| \t\n", v0)) { *(&(&sh_syntaxtab)[4 * v0]) = *(&(&sh_syntaxtab)[4 * v0]) & -8195; } else { *(&(&sh_syntaxtab)[4 * v0]) = *(&(&sh_syntaxtab)[4 * v0]) | 2; v3 = *(&(&sh_syntaxtab)[4 * v0]); *(&v3) = (*(&(&sh_syntaxtab)[4 * v0]) >> 8) & 223; tmp_80 = v3; *(&(&sh_syntaxtab)[4 * v0]) = tmp_80; } v0 += 1; } return; }
bash
angr_sailr
static void user_cancel(const char *user) { const char *cmd; const char *argv[3]; int status; cmd = getdef_str("USERDEL_CMD"); if (((void *)0) == cmd) { return; } argv[0] = cmd; argv[1] = user; argv[2] = (char *)0; (void)run_command(cmd, argv, ((void *)0), &status); }
void user_cancel(unsigned long a0) { char v0; unsigned long long v1; unsigned long v2; unsigned long v3; void *v4; char v5; unsigned long long *v7; unsigned long long v8; v1 = getdef_str("USERDEL_CMD"); if (v1) { v2 = v1; v3 = a0; v4 = 0; run_command(v1, &v2, 0x0, &v0); } v8 = *(&v5) ^ v7[5]; return; }
shadow
angr_phoenix
int do_redirections(list, flags) REDIRECT *list; int flags; { int error; REDIRECT *temp; char *fn; if (flags & 0x02) { if (redirection_undo_list) { dispose_redirects(redirection_undo_list); redirection_undo_list = (REDIRECT *)((void *)0); } if (exec_redirection_undo_list) dispose_exec_redirects(); } for (temp = list; temp; temp = temp->next) { fn = 0; error = do_redirection_internal(temp, flags, &fn); if (error) { redirection_error(temp, error, fn); do { if (fn) sh_xfree((fn), "redir.c", 267); } while (0); return (error); } do { if (fn) sh_xfree((fn), "redir.c", 270); } while (0); } return (0); }
long long do_redirections(void *a0, unsigned long a1) { unsigned int v0; void *v1; unsigned long long *v2; void *v4; if ((a1 & 2)) { if (redirection_undo_list) { dispose_redirects(redirection_undo_list); redirection_undo_list = 0; } if (exec_redirection_undo_list) dispose_exec_redirects(); } v2 = a0; while (true) { if (v2) { v1 = 0; v0 = do_redirection_internal(v2, a1, &v1); if (v0) { redirection_error(v2, v0, v1); if (v1) sh_xfree(v1, "redir.c", 0x10b); v4 = v0; break; } else { if (v1) sh_xfree(v1, "redir.c", 0x10e); v2 = *(v2); } } else { v4 = 0; break; } } return v4; }
bash
angr_dream
void initlog(int loglevel, char *s, ...) { va_list va_alist; char buf[256]; sigset_t nmask, omask; __builtin_va_start(va_alist, s); vsnprintf(buf, sizeof(buf), s, va_alist); __builtin_va_end(va_alist); if (loglevel & 2) { sigfillset(&nmask); sigprocmask(0, &nmask, &omask); openlog("init", 0, (3 << 3)); syslog(6, "%s", buf); closelog(); sigprocmask(2, &omask, ((void *)0)); } if (loglevel & 1) { print("\rINIT: "); print(buf); print("\r\n"); } }
void initlog(unsigned long a0, char *a1, unsigned long a2, unsigned long a3, unsigned long a4, unsigned long a5) { unsigned int v0; unsigned int v1; unsigned long v2; unsigned long v3; char v4; char v5; char v6; unsigned long long v7; char v8; unsigned long v9; unsigned long v10; unsigned long v11; unsigned long v12; int v13; int v14; int v15; int v16; int v17; int v18; int v19; int v20; unsigned long v21; char v22; int v23; int v24; int v25; int v26; int v27; int v28; int v29; int v30; unsigned long long *v31; unsigned long long v32; v9 = a2; v10 = a3; v11 = a4; v12 = a5; if (v22) { v13 = v23; v14 = v24; v15 = v25; v16 = v26; v17 = v27; v18 = v28; v19 = v29; v20 = v30; } v7 = v31[5]; v0 = 16; v1 = 48; v2 = &v21; v3 = &v8; vsnprintf(&v6, 0x100, a1, &v0); if ((a0 & 2)) { sigfillset(&v4); sigprocmask(0x0, &v4, &v5); openlog("init", 0x0, 0x18); syslog(0x6, "%s"); closelog(); sigprocmask(0x2, &v5, NULL); } if ((a0 & 1)) { print("\rINIT: "); print(&v6); print("\r\n"); } v32 = v7 ^ v31[5]; if ((v7 ^ v31[5])) __stack_chk_fail(); return; }
sysvinit
angr_dream
static _Bool apply_suffix(double *x, char suffix_char) { int multiplier; switch (suffix_char) { case 0: case 's': multiplier = 1; break; case 'm': multiplier = 60; break; case 'h': multiplier = 60 * 60; break; case 'd': multiplier = 60 * 60 * 24; break; default: return 0; } *x *= multiplier; return 1; }
int apply_suffix(unsigned long long *a0, unsigned long a1) { unsigned int v0; unsigned int v2; unsigned long long v3; int v4; if (a1 == 115) { LABEL_400384: v0 = 1; goto LABEL_4003af; } else { if (a1 > 115) { LABEL_4003a8: v2 = 0; goto LABEL_4003cd; } if (a1 == 109) { v0 = 60; goto LABEL_4003af; } if (!(a1 <= 109)) goto LABEL_4003a8; if (a1 == 104) { v0 = 3600; goto LABEL_4003af; } if (!(a1 <= 104)) goto LABEL_4003a8; if (!a1) goto LABEL_400384; if (!(a1 == 100)) goto LABEL_4003a8; v0 = 86400; LABEL_4003af: v3 = v0; STORE(addr = rdi<8>, data = Conv(128->64, (xmm0<16> * Conv(64->128, Load(addr = rdi<8>, size = 8, endness = Iend_LE)))), size = 8, endness = Iend_LE, guard = None) v2 = 1; } LABEL_4003cd: return v2; }
coreutils
angr_phoenix
static void append_to_list(struct gnutls_cli_list *list, const char *name, const char *arg) { const char **tmp; size_t new_count = xsum(list->count, 1); if (((new_count) == (18446744073709551615UL))) error(1, 0, "too many arguments for %s", name); tmp = reallocarray(list->args, new_count, sizeof(char *)); if (!tmp) error(1, 0, "unable to allocate memory for %s", name); list->args = tmp; list->args[list->count] = optarg; list->count = new_count; }
void append_to_list(struct_0 *a0, unsigned long a1, unsigned long a2) { unsigned long v0; unsigned long v1; unsigned int v2; unsigned long v3; struct_0 *v5; v1 = a1; v0 = a2; *(&v2) = xsum(a0->field_8, 0x1); if (*(&v2) == -1) error(0x1, 0x0, "too many arguments for %s"); v3 = reallocarray(a0->field_0, *(&v2), 0x8); if (!v3) error(0x1, 0x0, "unable to allocate memory for %s"); a0->field_0 = v3; *((a0->field_0 + a0->field_8 * 8)) = *(got.optarg); v5 = a0; a0->field_8 = *(&v2); return; }
gnutls
angr_dream
static void clear_pass(void) { if (pass) { freezero(pass, strlen(pass)); pass = ((void *)0); } }
void clear_pass() { unsigned long long v1; unsigned long long v2; unsigned long long v3; v1 = pass; if (pass) { v2 = strlen(pass); v3 = freezero(pass, v2, v2); pass = 0; return; } return; }
openssh-portable
angr_sailr
static _Bool change_attributes(char const *name, int dirfd, char const *relname) { _Bool ok = 0; if (!(owner_id == (uid_t)-1 && group_id == (gid_t)-1) && lchownat(dirfd, relname, owner_id, group_id) != 0) error(0, (*__errno_location()), gettext("cannot change ownership of %s"), quotearg_style(shell_escape_always_quoting_style, name)); else if (chmodat(dirfd, relname, mode) != 0) error(0, (*__errno_location()), gettext("cannot change permissions of %s"), quotearg_style(shell_escape_always_quoting_style, name)); else ok = 1; if (use_default_selinux_context) setdefaultfilecon(name); return ok; }
void change_attributes(unsigned long long a0, unsigned long a1, unsigned long long a2) { char v0; unsigned long long v2; unsigned long long v4; unsigned long long v5; unsigned long long v6; v0 = 0; if (owner_id != -1 || group_id != -1) { v2 = lchownat(a1, a2, owner_id, group_id); if (v2) { v4 = quotearg_style(0x4, a0); error(0x0, *(__errno_location()), gettext("cannot change ownership of %s")); } } if (!v2 || owner_id == -1 && group_id == -1) { if (chmodat(a1, a2, mode, a2)) { v5 = quotearg_style(0x4, a0); error(0x0, *(__errno_location()), gettext("cannot change permissions of %s")); } else { v0 = 1; } } if (use_default_selinux_context) setdefaultfilecon(a0); v6 = v0; return; }
coreutils
angr_dream
static int check_host_key(char *hostname, const struct ssh_conn_info *cinfo, struct sockaddr *hostaddr, u_short port, struct sshkey *host_key, int readonly, int clobber_port, char **user_hostfiles, u_int num_user_hostfiles, char **system_hostfiles, u_int num_system_hostfiles, const char *hostfile_command) { HostStatus host_status = -1, ip_status = -1; struct sshkey *raw_key = ((void *)0); char *ip = ((void *)0), *host = ((void *)0); char hostline[1000], *hostp, *fp, *ra; char msg[1024]; const char *type, *fail_reason; const struct hostkey_entry *host_found = ((void *)0), *ip_found = ((void *)0); int len, cancelled_forwarding = 0, confirmed; int local = sockaddr_is_local(hostaddr); int r, want_cert = sshkey_is_cert(host_key), host_ip_differ = 0; int hostkey_trusted = 0; struct hostkeys *host_hostkeys, *ip_hostkeys; u_int i; if (options.no_host_authentication_for_localhost == 1 && local && options.host_key_alias == ((void *)0)) { sshlog("sshconnect.c", __func__, 957, 0, SYSLOG_LEVEL_DEBUG1, ((void *)0), "Forcing accepting of host key for " "loopback/localhost."); options.update_hostkeys = 0; return 0; } get_hostfile_hostname_ipaddr(hostname, hostaddr, clobber_port ? 0 : port, &host, &ip); if (options.check_host_ip && (local || strcmp(hostname, ip) == 0 || options.proxy_command != ((void *)0))) options.check_host_ip = 0; host_hostkeys = init_hostkeys(); for (i = 0; i < num_user_hostfiles; i++) load_hostkeys(host_hostkeys, host, user_hostfiles[i], 0); for (i = 0; i < num_system_hostfiles; i++) load_hostkeys(host_hostkeys, host, system_hostfiles[i], 0); if (hostfile_command != ((void *)0) && !clobber_port) { load_hostkeys_command(host_hostkeys, hostfile_command, "HOSTNAME", cinfo, host_key, host); } ip_hostkeys = ((void *)0); if (!want_cert && options.check_host_ip) { ip_hostkeys = init_hostkeys(); for (i = 0; i < num_user_hostfiles; i++) load_hostkeys(ip_hostkeys, ip, user_hostfiles[i], 0); for (i = 0; i < num_system_hostfiles; i++) load_hostkeys(ip_hostkeys, ip, system_hostfiles[i], 0); if (hostfile_command != ((void *)0) && !clobber_port) { load_hostkeys_command(ip_hostkeys, hostfile_command, "ADDRESS", cinfo, host_key, ip); } } retry: want_cert = sshkey_is_cert(host_key); type = sshkey_type(host_key); host_status = check_key_in_hostkeys(host_hostkeys, host_key, &host_found); if (!readonly && (num_user_hostfiles == 0 || (host_found != ((void *)0) && host_found->note != 0))) readonly = 1; if (!want_cert && ip_hostkeys != ((void *)0)) { ip_status = check_key_in_hostkeys(ip_hostkeys, host_key, &ip_found); if (host_status == HOST_CHANGED && (ip_status != HOST_CHANGED || (ip_found != ((void *)0) && !sshkey_equal(ip_found->key, host_found->key)))) host_ip_differ = 1; } else ip_status = host_status; switch (host_status) { case HOST_OK: sshlog("sshconnect.c", __func__, 1040, 0, SYSLOG_LEVEL_DEBUG1, ((void *)0), "Host '%.200s' is known and matches the %s host %s.", host, type, want_cert ? "certificate" : "key"); sshlog("sshconnect.c", __func__, 1042, 0, SYSLOG_LEVEL_DEBUG1, ((void *)0), "Found %s in %s:%lu", want_cert ? "CA key" : "key", host_found->file, host_found->line); if (want_cert) { if (sshkey_cert_check_host( host_key, options.host_key_alias == ((void *)0) ? hostname : options.host_key_alias, 0, options.ca_sign_algorithms, &fail_reason) != 0) { sshlog("sshconnect.c", __func__, 1049, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "%s", fail_reason); goto fail; } if (options.update_hostkeys != 0) { options.update_hostkeys = 0; sshlog("sshconnect.c", __func__, 1058, 1, SYSLOG_LEVEL_DEBUG3, ((void *)0), "certificate host key in use; " "disabling UpdateHostkeys"); } } if (options.update_hostkeys != 0 && (path_in_hostfiles(host_found->file, system_hostfiles, num_system_hostfiles) || (ip_status == HOST_OK && ip_found != ((void *)0) && path_in_hostfiles(ip_found->file, system_hostfiles, num_system_hostfiles)))) { options.update_hostkeys = 0; sshlog("sshconnect.c", __func__, 1070, 1, SYSLOG_LEVEL_DEBUG3, ((void *)0), "host key found in GlobalKnownHostsFile; " "disabling UpdateHostkeys"); } if (options.update_hostkeys != 0 && host_found->note) { options.update_hostkeys = 0; sshlog("sshconnect.c", __func__, 1075, 1, SYSLOG_LEVEL_DEBUG3, ((void *)0), "host key found via KnownHostsCommand; " "disabling UpdateHostkeys"); } if (options.check_host_ip && ip_status == HOST_NEW) { if (readonly || want_cert) sshlog("sshconnect.c", __func__, 1080, 0, SYSLOG_LEVEL_INFO, ((void *)0), "%s host key for IP address " "'%.128s' not in list of known hosts.", type, ip) ; else if (!add_host_to_hostfile(user_hostfiles[0], ip, host_key, options.hash_known_hosts)) sshlog("sshconnect.c", __func__, 1085, 0, SYSLOG_LEVEL_INFO, ((void *)0), "Failed to add the %s host key for IP " "address '%.128s' to the list of known " "hosts (%.500s).", type, ip, user_hostfiles[0]) ; else sshlog("sshconnect.c", __func__, 1090, 0, SYSLOG_LEVEL_INFO, ((void *)0), "Warning: Permanently added the %s host " "key for IP address '%.128s' to the list " "of known hosts.", type, ip) ; } else if (options.visual_host_key) { fp = sshkey_fingerprint(host_key, options.fingerprint_hash, SSH_FP_DEFAULT); ra = sshkey_fingerprint(host_key, options.fingerprint_hash, SSH_FP_RANDOMART); if (fp == ((void *)0) || ra == ((void *)0)) sshfatal("sshconnect.c", __func__, 1099, 1, SYSLOG_LEVEL_FATAL, ((void *)0), "sshkey_fingerprint failed"); sshlog("sshconnect.c", __func__, 1100, 0, SYSLOG_LEVEL_INFO, ((void *)0), "Host key fingerprint is %s\n%s", fp, ra); free(ra); free(fp); } hostkey_trusted = 1; break; case HOST_NEW: if (options.host_key_alias == ((void *)0) && port != 0 && port != 22 && !clobber_port) { sshlog("sshconnect.c", __func__, 1109, 0, SYSLOG_LEVEL_DEBUG1, ((void *)0), "checking without port identifier"); if (check_host_key(hostname, cinfo, hostaddr, 0, host_key, 2, 1, user_hostfiles, num_user_hostfiles, system_hostfiles, num_system_hostfiles, hostfile_command) == 0) { sshlog("sshconnect.c", __func__, 1115, 0, SYSLOG_LEVEL_DEBUG1, ((void *)0), "found matching key w/out port"); break; } } if (readonly || want_cert) goto fail; if (options.strict_host_key_checking == 2) { sshlog("sshconnect.c", __func__, 1129, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "No %s host key is known for %.200s and you " "have requested strict checking.", type, host); goto fail; } else if (options.strict_host_key_checking == 3) { char *msg1 = ((void *)0), *msg2 = ((void *)0); xasprintf(&msg1, "The authenticity of host " "'%.200s (%s)' can't be established", host, ip); if (show_other_keys(host_hostkeys, host_key)) { xextendf(&msg1, "\n", "but keys of different " "type are already known for this host."); } else xextendf(&msg1, "", "."); fp = sshkey_fingerprint(host_key, options.fingerprint_hash, SSH_FP_DEFAULT); ra = sshkey_fingerprint(host_key, options.fingerprint_hash, SSH_FP_RANDOMART); if (fp == ((void *)0) || ra == ((void *)0)) sshfatal("sshconnect.c", __func__, 1150, 1, SYSLOG_LEVEL_FATAL, ((void *)0), "sshkey_fingerprint failed"); xextendf(&msg1, "\n", "%s key fingerprint is %s.", type, fp); if (options.visual_host_key) xextendf(&msg1, "\n", "%s", ra); if (options.verify_host_key_dns) { xextendf(&msg1, "\n", "%s host key fingerprint found in DNS.", matching_host_key_dns ? "Matching" : "No matching"); } if ((msg2 = other_hostkeys_message(host, ip, host_key, user_hostfiles, num_user_hostfiles, system_hostfiles, num_system_hostfiles)) != ((void *)0)) xextendf(&msg1, "\n", "%s", msg2); xextendf(&msg1, "\n", "Are you sure you want to continue connecting " "(yes/no/[fingerprint])? "); confirmed = confirm(msg1, fp); free(ra); free(fp); free(msg1); free(msg2); if (!confirmed) goto fail; hostkey_trusted = 1; } if (options.check_host_ip && ip_status == HOST_NEW) { snprintf(hostline, sizeof(hostline), "%s,%s", host, ip); hostp = hostline; if (options.hash_known_hosts) { r = add_host_to_hostfile(user_hostfiles[0], host, host_key, options.hash_known_hosts) && add_host_to_hostfile(user_hostfiles[0], ip, host_key, options.hash_known_hosts); } else { r = add_host_to_hostfile(user_hostfiles[0], hostline, host_key, options.hash_known_hosts); } } else { r = add_host_to_hostfile(user_hostfiles[0], host, host_key, options.hash_known_hosts); hostp = host; } if (!r) sshlog("sshconnect.c", __func__, 1206, 0, SYSLOG_LEVEL_INFO, ((void *)0), "Failed to add the host to the list of known " "hosts (%.500s).", user_hostfiles[0]); else sshlog("sshconnect.c", __func__, 1209, 0, SYSLOG_LEVEL_INFO, ((void *)0), "Warning: Permanently added '%.200s' (%s) to the " "list of known hosts.", hostp, type); break; case HOST_REVOKED: sshlog("sshconnect.c", __func__, 1213, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"); sshlog("sshconnect.c", __func__, 1214, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "@ WARNING: REVOKED HOST KEY DETECTED! @"); sshlog("sshconnect.c", __func__, 1215, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"); sshlog("sshconnect.c", __func__, 1216, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "The %s host key for %s is marked as revoked.", type, host); sshlog("sshconnect.c", __func__, 1217, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "This could mean that a stolen key is being used to"); sshlog("sshconnect.c", __func__, 1218, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "impersonate this host."); if (options.strict_host_key_checking != 0) { sshlog("sshconnect.c", __func__, 1226, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "%s host key for %.200s was revoked and you have " "requested strict checking.", type, host); goto fail; } goto continue_unsafe; case HOST_CHANGED: if (want_cert) { sshlog("sshconnect.c", __func__, 1239, 0, SYSLOG_LEVEL_DEBUG1, ((void *)0), "Host certificate authority does not " "match %s in %s:%lu", "@cert-authority", host_found->file, host_found->line) ; goto fail; } if (readonly == 2) goto fail; if (options.check_host_ip && host_ip_differ) { char *key_msg; if (ip_status == HOST_NEW) key_msg = "is unknown"; else if (ip_status == HOST_OK) key_msg = "is unchanged"; else key_msg = "has a different value"; sshlog("sshconnect.c", __func__, 1254, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"); sshlog("sshconnect.c", __func__, 1255, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "@ WARNING: POSSIBLE DNS SPOOFING DETECTED! @"); sshlog("sshconnect.c", __func__, 1256, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"); sshlog("sshconnect.c", __func__, 1257, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "The %s host key for %s has changed,", type, host); sshlog("sshconnect.c", __func__, 1258, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "and the key for the corresponding IP address %s", ip); sshlog("sshconnect.c", __func__, 1259, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "%s. This could either mean that", key_msg); sshlog("sshconnect.c", __func__, 1260, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "DNS SPOOFING is happening or the IP address for the host"); sshlog("sshconnect.c", __func__, 1261, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "and its host key have changed at the same time."); if (ip_status != HOST_NEW) sshlog("sshconnect.c", __func__, 1263, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "Offending key for IP in %s:%lu", ip_found->file, ip_found->line); } warn_changed_key(host_key); sshlog("sshconnect.c", __func__, 1268, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "Add correct host key in %.100s to get rid of this message.", user_hostfiles[0]); sshlog("sshconnect.c", __func__, 1270, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "Offending %s key in %s:%lu", sshkey_type(host_found->key), host_found->file, host_found->line) ; if (options.strict_host_key_checking != 0) { sshlog("sshconnect.c", __func__, 1280, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "Host key for %.200s has changed and you have " "requested strict checking.", host); goto fail; } continue_unsafe: if (options.password_authentication) { sshlog("sshconnect.c", __func__, 1292, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "Password authentication is disabled to avoid " "man-in-the-middle attacks."); options.password_authentication = 0; cancelled_forwarding = 1; } if (options.kbd_interactive_authentication) { sshlog("sshconnect.c", __func__, 1298, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "Keyboard-interactive authentication is disabled" " to avoid man-in-the-middle attacks."); options.kbd_interactive_authentication = 0; cancelled_forwarding = 1; } if (options.forward_agent) { sshlog("sshconnect.c", __func__, 1304, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "Agent forwarding is disabled to avoid " "man-in-the-middle attacks."); options.forward_agent = 0; cancelled_forwarding = 1; } if (options.forward_x11) { sshlog("sshconnect.c", __func__, 1310, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "X11 forwarding is disabled to avoid " "man-in-the-middle attacks."); options.forward_x11 = 0; cancelled_forwarding = 1; } if (options.num_local_forwards > 0 || options.num_remote_forwards > 0) { sshlog("sshconnect.c", __func__, 1317, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "Port forwarding is disabled to avoid " "man-in-the-middle attacks."); options.num_local_forwards = options.num_remote_forwards = 0; cancelled_forwarding = 1; } if (options.tun_open != 0x00) { sshlog("sshconnect.c", __func__, 1324, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "Tunnel forwarding is disabled to avoid " "man-in-the-middle attacks."); options.tun_open = 0x00; cancelled_forwarding = 1; } if (options.update_hostkeys != 0) { sshlog("sshconnect.c", __func__, 1330, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "UpdateHostkeys is disabled because the host " "key is not trusted."); options.update_hostkeys = 0; } if (options.exit_on_forward_failure && cancelled_forwarding) sshfatal("sshconnect.c", __func__, 1335, 0, SYSLOG_LEVEL_FATAL, ((void *)0), "Error: forwarding disabled due to host key " "check failure"); break; case HOST_FOUND: sshfatal("sshconnect.c", __func__, 1347, 0, SYSLOG_LEVEL_FATAL, ((void *)0), "internal error"); break; } if (options.check_host_ip && host_status != HOST_CHANGED && ip_status == HOST_CHANGED) { snprintf(msg, sizeof(msg), "Warning: the %s host key for '%.200s' " "differs from the key for the IP address '%.128s'" "\nOffending key for IP in %s:%lu", type, host, ip, ip_found->file, ip_found->line); if (host_status == HOST_OK) { len = strlen(msg); snprintf(msg + len, sizeof(msg) - len, "\nMatching host key in %s:%lu", host_found->file, host_found->line); } if (options.strict_host_key_checking == 3) { strlcat(msg, "\nAre you sure you want " "to continue connecting (yes/no)? ", sizeof(msg)); if (!confirm(msg, ((void *)0))) goto fail; } else if (options.strict_host_key_checking != 0) { sshlog("sshconnect.c", __func__, 1372, 0, SYSLOG_LEVEL_INFO, ((void *)0), "%s", msg); sshlog("sshconnect.c", __func__, 1373, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "Exiting, you have requested strict checking."); goto fail; } else { sshlog("sshconnect.c", __func__, 1376, 0, SYSLOG_LEVEL_INFO, ((void *)0), "%s", msg); } } if (!hostkey_trusted && options.update_hostkeys) { sshlog("sshconnect.c", __func__, 1381, 1, SYSLOG_LEVEL_DEBUG1, ((void *)0), "hostkey not known or explicitly trusted: " "disabling UpdateHostkeys"); options.update_hostkeys = 0; } free(ip); free(host); if (host_hostkeys != ((void *)0)) free_hostkeys(host_hostkeys); if (ip_hostkeys != ((void *)0)) free_hostkeys(ip_hostkeys); return 0; fail: if (want_cert && host_status != HOST_REVOKED) { sshlog("sshconnect.c", __func__, 1400, 0, SYSLOG_LEVEL_DEBUG1, ((void *)0), "No matching CA found. Retry with plain key"); if ((r = sshkey_from_private(host_key, &raw_key)) != 0) sshfatal("sshconnect.c", __func__, 1402, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "decode key"); if ((r = sshkey_drop_cert(raw_key)) != 0) sshfatal("sshconnect.c", __func__, 1404, 0, SYSLOG_LEVEL_FATAL, ssh_err(r), "Couldn't drop certificate"); host_key = raw_key; goto retry; } sshkey_free(raw_key); free(ip); free(host); if (host_hostkeys != ((void *)0)) free_hostkeys(host_hostkeys); if (ip_hostkeys != ((void *)0)) free_hostkeys(ip_hostkeys); return -1; }
undefined8 check_host_key(char *param_1, undefined8 param_2, undefined8 param_3, short param_4, undefined8 param_5, int param_6, int param_7, undefined8 *param_8, uint param_9, long param_10, uint param_11, long param_12) { undefined8 uVar1; short sVar2; int iVar3; char *pcVar4; undefined8 uVar5; size_t sVar6; undefined *puVar7; long *plVar8; long in_FS_OFFSET; undefined8 uVar9; long local_908; long local_900; undefined8 *local_8f8; undefined8 local_8f0; int local_8e8; short local_8e4; undefined8 local_8e0; undefined8 local_8d8; char *local_8d0; int local_8bc; int local_8b8; int local_8b4; int local_8b0; int local_8ac; uint local_8a8; int local_8a4; int local_8a0; int local_89c; int local_898; int local_894; undefined8 local_890; char *local_888; char *local_880; undefined8 local_878; long local_870; long local_868; void *local_860; char *local_858; long local_850; char *local_848; long local_840; undefined8 local_838; void *local_830; void *local_828; void *local_820; char local_818[1008]; char local_428[1032]; long local_20; plVar8 = &local_908; local_8f8 = param_8; local_900 = param_10; local_908 = param_12; local_20 = *(long *)(in_FS_OFFSET + 0x28); local_8a4 = -1; local_8bc = -1; local_890 = 0; local_888 = (char *)0x0; local_880 = (char *)0x0; local_870 = 0; local_868 = 0; local_8b8 = 0; local_8f0 = param_5; local_8e8 = param_6; local_8e4 = param_4; local_8e0 = param_3; local_8d8 = param_2; local_8d0 = param_1; local_8a0 = sockaddr_is_local(param_3); uVar9 = 0x102abc; local_89c = sshkey_is_cert(local_8f0); local_8b0 = 0; local_8ac = 0; if (((_DAT_00109334 != 1) || (local_8a0 == 0)) || (___addvsi3 != (char *)0x0)) { sVar2 = local_8e4; if (param_7 != 0) { sVar2 = 0; } get_hostfile_hostname_ipaddr(local_8d0, local_8e0, sVar2, &local_880, &local_888); if ((DAT_0010805c != 0) && (((local_8a0 != 0 || (iVar3 = strcmp(local_8d0, local_888), iVar3 == 0)) || (_strcmp != 0)))) { DAT_0010805c = 0; } local_840 = init_hostkeys(); for (local_8a8 = 0; local_8a8 < param_9; local_8a8 = local_8a8 + 1) { load_hostkeys(local_840, local_880, local_8f8[local_8a8], 0); } for (local_8a8 = 0; local_8a8 < param_11; local_8a8 = local_8a8 + 1) { load_hostkeys(local_840, local_880, *(undefined8 *)(local_900 + (ulong)local_8a8 * 8), 0); } if ((local_908 != 0) && (param_7 == 0)) { load_hostkeys_command(local_840, local_908, "HOSTNAME", local_8d8, local_8f0, local_880); } local_850 = 0; plVar8 = &local_908; if ((local_89c == 0) && (plVar8 = &local_908, DAT_0010805c != 0)) { local_850 = init_hostkeys(); for (local_8a8 = 0; local_8a8 < param_9; local_8a8 = local_8a8 + 1) { load_hostkeys(local_850, local_888, local_8f8[local_8a8], 0); } for (local_8a8 = 0; local_8a8 < param_11; local_8a8 = local_8a8 + 1) { load_hostkeys(local_850, local_888, *(undefined8 *)(local_900 + (ulong)local_8a8 * 8), 0); } plVar8 = &local_908; if ((local_908 != 0) && (plVar8 = &local_908, param_7 == 0)) { load_hostkeys_command(local_850, local_908, "ADDRESS", local_8d8, local_8f0, local_888); plVar8 = &local_908; } } do { *(undefined8 *)((long)plVar8 + -8) = 0x102e01; local_89c = sshkey_is_cert(local_8f0); *(undefined8 *)((long)plVar8 + -8) = 0x102e16; local_838 = sshkey_type(local_8f0); *(undefined8 *)((long)plVar8 + -8) = 0x102e3d; local_8a4 = check_key_in_hostkeys(local_840, local_8f0, &local_870); if ((local_8e8 == 0) && ((param_9 == 0 || ((local_870 != 0 && (*(int *)(local_870 + 0x24) != 0)))))) { local_8e8 = 1; } if ((local_89c == 0) && (local_850 != 0)) { *(undefined8 *)((long)plVar8 + -8) = 0x102ea9; local_8bc = check_key_in_hostkeys(local_850, local_8f0, &local_868); if (local_8a4 == 2) { if (local_8bc == 2) { if (local_868 != 0) { uVar9 = *(undefined8 *)(local_870 + 0x18); uVar1 = *(undefined8 *)(local_868 + 0x18); *(undefined8 *)((long)plVar8 + -8) = 0x102eee; iVar3 = sshkey_equal(uVar1, uVar9); if (iVar3 == 0) goto LAB_00102ef2; } } else { LAB_00102ef2: local_8b0 = 1; } } } else { local_8bc = local_8a4; } puVar7 = (undefined *)plVar8; switch (local_8a4) { case 0: if (local_89c == 0) { pcVar4 = "key"; } else { pcVar4 = "certificate"; } *(char **)((long)plVar8 + -8) = pcVar4; *(undefined8 *)((long)plVar8 + -0x10) = local_838; *(char **)((long)plVar8 + -0x18) = local_880; *(char **)((long)plVar8 + -0x20) = "Host \'%.200s\' is known and matches the %s host %s."; *(undefined8 *)((long)plVar8 + -0x28) = 0x102f9f; sshlog("sshconnect.c", "check_host_key", 0x410, 0, 5, 0); uVar9 = *(undefined8 *)(local_870 + 8); if (local_89c == 0) { pcVar4 = "key"; } else { pcVar4 = "CA key"; } *(undefined8 *)((long)plVar8 + -8) = *(undefined8 *)(local_870 + 0x10); *(undefined8 *)((long)plVar8 + -0x10) = uVar9; *(char **)((long)plVar8 + -0x18) = pcVar4; *(char **)((long)plVar8 + -0x20) = "Found %s in %s:%lu"; *(undefined8 *)((long)plVar8 + -0x28) = 0x10300b; sshlog("sshconnect.c", "check_host_key", 0x412, 0, 5, 0); if (local_89c != 0) { pcVar4 = local_8d0; if (___addvsi3 != (char *)0x0) { pcVar4 = ___addvsi3; } *(undefined8 *)((long)plVar8 + -8) = 0x103060; iVar3 = sshkey_cert_check_host(local_8f0, pcVar4, 0, _ssh_signal, &local_878); if (iVar3 != 0) { *(undefined8 *)((long)plVar8 + -8) = local_878; *(undefined **)((long)plVar8 + -0x10) = &DAT_0010611d; *(undefined8 *)((long)plVar8 + -0x18) = 0x1030a2; sshlog("sshconnect.c", "check_host_key", 0x419, 0, 2, 0); break; } if (_DAT_001096dc != 0) { _DAT_001096dc = 0; *(char **)((long)plVar8 + -0x10) = "certificate host key in use; disabling UpdateHostkeys"; *(undefined8 *)((long)plVar8 + -0x18) = 0x1030f9; sshlog("sshconnect.c", "check_host_key", 0x422, 1, 7, 0); } } if (_DAT_001096dc != 0) { uVar9 = *(undefined8 *)(local_870 + 8); *(undefined8 *)((long)plVar8 + -8) = 0x10312b; iVar3 = path_in_hostfiles(uVar9, local_900, param_11); if (iVar3 == 0) { if ((local_8bc == 0) && (local_868 != 0)) { uVar9 = *(undefined8 *)(local_868 + 8); *(undefined8 *)((long)plVar8 + -8) = 0x103164; iVar3 = path_in_hostfiles(uVar9, local_900, param_11); if (iVar3 != 0) goto LAB_00103168; } } else { LAB_00103168: _DAT_001096dc = 0; *(char **)((long)plVar8 + -0x10) = "host key found in GlobalKnownHostsFile; disabling " "UpdateHostkeys"; *(undefined8 *)((long)plVar8 + -0x18) = 0x1031ac; sshlog("sshconnect.c", "check_host_key", 0x42e, 1, 7, 0); } } if ((_DAT_001096dc != 0) && (*(int *)(local_870 + 0x24) != 0)) { _DAT_001096dc = 0; *(char **)((long)plVar8 + -0x10) = "host key found via KnownHostsCommand; disabling UpdateHostkeys"; *(undefined8 *)((long)plVar8 + -0x18) = 0x10320c; sshlog("sshconnect.c", "check_host_key", 0x433, 1, 7, 0); } if ((DAT_0010805c == 0) || (local_8bc != 1)) { if (_DAT_001093a0 != 0) { *(undefined8 *)((long)plVar8 + -8) = 0x10338b; local_828 = (void *)sshkey_fingerprint(local_8f0, _DAT_001096d8, 0); *(undefined8 *)((long)plVar8 + -8) = 0x1033ae; local_820 = (void *)sshkey_fingerprint(local_8f0, _DAT_001096d8, 4); if ((local_828 == (void *)0x0) || (local_820 == (void *)0x0)) { *(char **)((long)plVar8 + -0x10) = "sshkey_fingerprint failed"; *(undefined8 *)((long)plVar8 + -0x18) = 0x103403; sshfatal("sshconnect.c", "check_host_key", 1099, 1, 1, 0); plVar8 = (long *)((long)plVar8 + -0x10); } *(void **)((long)plVar8 + -0x10) = local_820; *(void **)((long)plVar8 + -0x18) = local_828; *(char **)((long)plVar8 + -0x20) = "Host key fingerprint is %s\n%s"; *(undefined8 *)((long)plVar8 + -0x28) = 0x103449; sshlog("sshconnect.c", "check_host_key", 0x44c, 0, 3, 0); *(undefined8 *)((long)plVar8 + -8) = 0x10345c; free(local_820); *(undefined8 *)((long)plVar8 + -8) = 0x10346b; free(local_828); } } else if ((local_8e8 == 0) && (local_89c == 0)) { uVar9 = *local_8f8; *(undefined8 *)((long)plVar8 + -8) = 0x1032b4; iVar3 = add_host_to_hostfile(uVar9, local_888, local_8f0, _DAT_00109374); if (iVar3 == 0) { *(undefined8 *)((long)plVar8 + -8) = *local_8f8; *(char **)((long)plVar8 + -0x10) = local_888; *(undefined8 *)((long)plVar8 + -0x18) = local_838; *(char **)((long)plVar8 + -0x20) = "Failed to add the %s host key for IP address \'%.128s\' to " "the list of known hosts (%.500s)."; *(undefined8 *)((long)plVar8 + -0x28) = 0x103307; sshlog("sshconnect.c", "check_host_key", 0x43d, 0, 3, 0); } else { *(char **)((long)plVar8 + -0x10) = local_888; *(undefined8 *)((long)plVar8 + -0x18) = local_838; *(char **)((long)plVar8 + -0x20) = "Warning: Permanently added the %s host key for IP address " "\'%.128s\' to the list of known hosts."; *(undefined8 *)((long)plVar8 + -0x28) = 0x103358; sshlog("sshconnect.c", "check_host_key", 0x442, 0, 3, 0); } } else { *(char **)((long)plVar8 + -0x10) = local_888; *(undefined8 *)((long)plVar8 + -0x18) = local_838; *(char **)((long)plVar8 + -0x20) = "%s host key for IP address \'%.128s\' not in list of known " "hosts."; *(undefined8 *)((long)plVar8 + -0x28) = 0x103285; sshlog("sshconnect.c", "check_host_key", 0x438, 0, 3, 0); } local_8ac = 1; default: switchD_00102f3e_caseD_5: if (((DAT_0010805c == 0) || (local_8a4 == 2)) || (local_8bc != 2)) { LAB_00104623: if ((local_8ac == 0) && (_DAT_001096dc != 0)) { *(char **)((long)plVar8 + -0x10) = "hostkey not known or explicitly trusted: disabling " "UpdateHostkeys"; *(undefined8 *)((long)plVar8 + -0x18) = 0x104670; sshlog("sshconnect.c", "check_host_key", 0x565, 1, 5, 0); _DAT_001096dc = 0; } *(undefined8 *)((long)plVar8 + -8) = 0x10468d; free(local_888); *(undefined8 *)((long)plVar8 + -8) = 0x10469c; free(local_880); if (local_840 != 0) { *(undefined8 *)((long)plVar8 + -8) = 0x1046b5; free_hostkeys(local_840); } if (local_850 != 0) { *(undefined8 *)((long)plVar8 + -8) = 0x1046ce; free_hostkeys(local_850); } uVar9 = 0; goto LAB_0010487c; } uVar9 = *(undefined8 *)(local_868 + 8); *(undefined8 *)((long)plVar8 + -8) = *(undefined8 *)(local_868 + 0x10); *(undefined8 *)((long)plVar8 + -0x10) = uVar9; *(undefined8 *)((long)plVar8 + -0x18) = 0x104493; snprintf( local_428, 0x400, "Warning: the %s host key for \'%.200s\' differs from the key for " "the IP address \'%.128s\'\nOffending key for IP in %s:%lu", local_838, local_880, local_888); if (local_8a4 == 0) { *(undefined8 *)((long)plVar8 + -8) = 0x1044af; sVar6 = strlen(local_428); local_894 = (int)sVar6; uVar9 = *(undefined8 *)(local_870 + 0x10); uVar1 = *(undefined8 *)(local_870 + 8); *(undefined8 *)((long)plVar8 + -8) = 0x104507; snprintf(local_428 + local_894, 0x400 - (long)local_894, "\nMatching host key in %s:%lu", uVar1, uVar9); } if (_fork == 3) { *(undefined8 *)((long)plVar8 + -8) = 0x10452d; strlcat(local_428, "\nAre you sure you want to continue connecting (yes/no)? ", 0x400); *(undefined8 *)((long)plVar8 + -8) = 0x104541; iVar3 = confirm(local_428, 0); if (iVar3 != 0) goto LAB_00104623; } else { if (_fork == 0) { *(char **)((long)plVar8 + -8) = local_428; *(undefined **)((long)plVar8 + -0x10) = &DAT_0010611d; *(undefined8 *)((long)plVar8 + -0x18) = 0x10461f; sshlog("sshconnect.c", "check_host_key", 0x560, 0, 3, 0); goto LAB_00104623; } *(char **)((long)plVar8 + -8) = local_428; *(undefined **)((long)plVar8 + -0x10) = &DAT_0010611d; *(undefined8 *)((long)plVar8 + -0x18) = 0x10459a; sshlog("sshconnect.c", "check_host_key", 0x55c, 0, 3, 0); *(char **)((long)plVar8 + -0x10) = "Exiting, you have requested strict checking."; *(undefined8 *)((long)plVar8 + -0x18) = 0x1045d8; sshlog("sshconnect.c", "check_host_key", 0x55d, 0, 2, 0); } break; case 1: if ((((___addvsi3 == (char *)0x0) && (local_8e4 != 0)) && (local_8e4 != 0x16)) && (param_7 == 0)) { *(char **)((long)plVar8 + -0x10) = "checking without port identifier"; *(undefined8 *)((long)plVar8 + -0x18) = 0x1034ea; sshlog("sshconnect.c", "check_host_key", 0x455, 0, 5, 0); *(long *)((long)plVar8 + -8) = local_908; *(ulong *)((long)plVar8 + -0x10) = (ulong)param_11; *(long *)((long)plVar8 + -0x18) = local_900; *(ulong *)((long)plVar8 + -0x20) = (ulong)param_9; *(undefined8 **)((long)plVar8 + -0x28) = local_8f8; *(undefined8 *)((long)plVar8 + -0x30) = 1; *(undefined8 *)((long)plVar8 + -0x38) = 0x10353c; iVar3 = check_host_key(local_8d0, local_8d8, local_8e0, 0, local_8f0, 2); if (iVar3 == 0) { *(char **)((long)plVar8 + -0x10) = "found matching key w/out port"; *(undefined8 *)((long)plVar8 + -0x18) = 0x10357e; sshlog("sshconnect.c", "check_host_key", 0x45b, 0, 5, 0); goto switchD_00102f3e_caseD_5; } } if ((local_8e8 == 0) && (local_89c == 0)) { if (_fork != 2) { if (_fork == 3) { local_860 = (void *)0x0; local_830 = (void *)0x0; *(undefined8 *)((long)plVar8 + -8) = 0x10364b; xasprintf(&local_860, "The authenticity of host \'%.200s (%s)\' can\'t be " "established", local_880, local_888); *(undefined8 *)((long)plVar8 + -8) = 0x103664; iVar3 = show_other_keys(local_840, local_8f0); if (iVar3 == 0) { *(undefined8 *)((long)plVar8 + -8) = 0x1036ae; xextendf(&local_860, &DAT_0010640e, &DAT_0010640c); } else { *(undefined8 *)((long)plVar8 + -8) = 0x10368a; xextendf(&local_860, &DAT_00105f7e, "but keys of different type are already known for " "this host."); } *(undefined8 *)((long)plVar8 + -8) = 0x1036ca; local_828 = (void *)sshkey_fingerprint(local_8f0, _DAT_001096d8, 0); *(undefined8 *)((long)plVar8 + -8) = 0x1036ed; local_820 = (void *)sshkey_fingerprint(local_8f0, _DAT_001096d8, 4); if ((local_828 == (void *)0x0) || (local_820 == (void *)0x0)) { *(char **)((long)plVar8 + -0x10) = "sshkey_fingerprint failed"; *(undefined8 *)((long)plVar8 + -0x18) = 0x103742; sshfatal("sshconnect.c", "check_host_key", 0x47e, 1, 1, 0); plVar8 = (long *)((long)plVar8 + -0x10); } *(undefined8 *)((long)plVar8 + -8) = 0x103778; xextendf(&local_860, &DAT_00105f7e, "%s key fingerprint is %s.", local_838, local_828); if (_DAT_001093a0 != 0) { *(undefined8 *)((long)plVar8 + -8) = 0x1037ae; xextendf(&local_860, &DAT_00105f7e, &DAT_0010611d, local_820); } if (_DAT_00108320 != 0) { if (matching_host_key_dns == 0) { pcVar4 = "No matching"; } else { pcVar4 = "Matching"; } *(undefined8 *)((long)plVar8 + -8) = 0x1037f4; xextendf(&local_860, &DAT_00105f7e, "%s host key fingerprint found in DNS.", pcVar4); } *(ulong *)((long)plVar8 + -0x10) = (ulong)param_11; *(undefined8 *)((long)plVar8 + -0x18) = 0x10382b; local_830 = (void *)other_hostkeys_message(local_880, local_888, local_8f0, local_8f8, param_9, local_900); if (local_830 != (void *)0x0) { *(undefined8 *)((long)plVar8 + -8) = 0x10386c; xextendf(&local_860, &DAT_00105f7e, &DAT_0010611d, local_830); } *(undefined8 *)((long)plVar8 + -8) = 0x10388e; xextendf(&local_860, &DAT_00105f7e, "Are you sure you want to continue connecting " "(yes/no/[fingerprint])? "); *(undefined8 *)((long)plVar8 + -8) = 0x1038a7; local_898 = confirm(local_860, local_828); *(undefined8 *)((long)plVar8 + -8) = 0x1038bc; free(local_820); *(undefined8 *)((long)plVar8 + -8) = 0x1038cb; free(local_828); *(undefined8 *)((long)plVar8 + -8) = 0x1038da; free(local_860); *(undefined8 *)((long)plVar8 + -8) = 0x1038e9; free(local_830); if (local_898 == 0) break; local_8ac = 1; } if ((DAT_0010805c == 0) || (local_8bc != 1)) { uVar9 = *local_8f8; *(undefined8 *)((long)plVar8 + -8) = 0x103a23; local_8b4 = add_host_to_hostfile(uVar9, local_880, local_8f0, _DAT_00109374); local_858 = local_880; } else { *(undefined8 *)((long)plVar8 + -8) = 0x10394f; snprintf(local_818, 1000, "%s,%s", local_880, local_888); local_858 = local_818; if (_DAT_00109374 == 0) { uVar9 = *local_8f8; *(undefined8 *)((long)plVar8 + -8) = 0x1039f5; local_8b4 = add_host_to_hostfile(uVar9, local_818, local_8f0, 0); } else { uVar9 = *local_8f8; *(undefined8 *)((long)plVar8 + -8) = 0x10398d; iVar3 = add_host_to_hostfile(uVar9, local_880, local_8f0, _DAT_00109374); if (iVar3 == 0) { LAB_001039c2: local_8b4 = 0; } else { uVar9 = *local_8f8; *(undefined8 *)((long)plVar8 + -8) = 0x1039b7; iVar3 = add_host_to_hostfile(uVar9, local_888, local_8f0, _DAT_00109374); if (iVar3 == 0) goto LAB_001039c2; local_8b4 = 1; } } } if (local_8b4 == 0) { *(undefined8 *)((long)plVar8 + -8) = *local_8f8; *(char **)((long)plVar8 + -0x10) = "Failed to add the host to the list of known hosts (%.500s)."; *(undefined8 *)((long)plVar8 + -0x18) = 0x103a81; sshlog("sshconnect.c", "check_host_key", 0x4b6, 0, 3, 0); } else { *(undefined8 *)((long)plVar8 + -0x10) = local_838; *(char **)((long)plVar8 + -0x18) = local_858; *(char **)((long)plVar8 + -0x20) = "Warning: Permanently added \'%.200s\' (%s) to the list of " "known hosts."; *(undefined8 *)((long)plVar8 + -0x28) = 0x103ad0; sshlog("sshconnect.c", "check_host_key", 0x4b9, 0, 3, 0); } goto switchD_00102f3e_caseD_5; } *(char **)((long)plVar8 + -0x10) = local_880; *(undefined8 *)((long)plVar8 + -0x18) = local_838; *(char **)((long)plVar8 + -0x20) = "No %s host key is known for %.200s and you have requested " "strict checking."; *(undefined8 *)((long)plVar8 + -0x28) = 0x1035f4; sshlog("sshconnect.c", "check_host_key", 0x469, 0, 2, 0); } break; case 2: if (local_89c == 0) { if (local_8e8 != 2) { if ((DAT_0010805c != 0) && (local_8b0 != 0)) { if (local_8bc == 1) { local_848 = "is unknown"; } else if (local_8bc == 0) { local_848 = "is unchanged"; } else { local_848 = "has a different value"; } *(char **)((long)plVar8 + -0x10) = "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"; *(undefined8 *)((long)plVar8 + -0x18) = 0x103dc4; sshlog("sshconnect.c", "check_host_key", 0x4e6, 0, 2, 0); *(char **)((long)plVar8 + -0x10) = "@ WARNING: POSSIBLE DNS SPOOFING DETECTED! @"; *(undefined8 *)((long)plVar8 + -0x18) = 0x103e02; sshlog("sshconnect.c", "check_host_key", 0x4e7, 0, 2, 0); *(char **)((long)plVar8 + -0x10) = "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"; *(undefined8 *)((long)plVar8 + -0x18) = 0x103e40; sshlog("sshconnect.c", "check_host_key", 0x4e8, 0, 2, 0); *(char **)((long)plVar8 + -0x10) = local_880; *(undefined8 *)((long)plVar8 + -0x18) = local_838; *(char **)((long)plVar8 + -0x20) = "The %s host key for %s has changed,"; *(undefined8 *)((long)plVar8 + -0x28) = 0x103e8c; sshlog("sshconnect.c", "check_host_key", 0x4e9, 0, 2, 0); *(char **)((long)plVar8 + -8) = local_888; *(char **)((long)plVar8 + -0x10) = "and the key for the corresponding IP address %s"; *(undefined8 *)((long)plVar8 + -0x18) = 0x103ece; sshlog("sshconnect.c", "check_host_key", 0x4ea, 0, 2, 0); *(char **)((long)plVar8 + -8) = local_848; *(char **)((long)plVar8 + -0x10) = "%s. This could either mean that"; *(undefined8 *)((long)plVar8 + -0x18) = 0x103f0e; sshlog("sshconnect.c", "check_host_key", 0x4eb, 0, 2, 0); *(char **)((long)plVar8 + -0x10) = "DNS SPOOFING is happening or the IP address for the host"; *(undefined8 *)((long)plVar8 + -0x18) = 0x103f4c; sshlog("sshconnect.c", "check_host_key", 0x4ec, 0, 2, 0); *(char **)((long)plVar8 + -0x10) = "and its host key have changed at the same time."; *(undefined8 *)((long)plVar8 + -0x18) = 0x103f8a; sshlog("sshconnect.c", "check_host_key", 0x4ed, 0, 2, 0); if (local_8bc != 1) { uVar9 = *(undefined8 *)(local_868 + 8); *(undefined8 *)((long)plVar8 + -0x10) = *(undefined8 *)(local_868 + 0x10); *(undefined8 *)((long)plVar8 + -0x18) = uVar9; *(char **)((long)plVar8 + -0x20) = "Offending key for IP in %s:%lu"; *(undefined8 *)((long)plVar8 + -0x28) = 0x103fe9; sshlog("sshconnect.c", "check_host_key", 0x4ef, 0, 2, 0); } } *(undefined8 *)((long)plVar8 + -8) = 0x103ffc; warn_changed_key(local_8f0); *(undefined8 *)((long)plVar8 + -8) = *local_8f8; *(char **)((long)plVar8 + -0x10) = "Add correct host key in %.100s to get rid of this message."; *(undefined8 *)((long)plVar8 + -0x18) = 0x10403d; sshlog("sshconnect.c", "check_host_key", 0x4f4, 0, 2, 0); uVar9 = *(undefined8 *)(local_870 + 0x10); uVar1 = *(undefined8 *)(local_870 + 8); uVar5 = *(undefined8 *)(local_870 + 0x18); *(undefined8 *)((long)plVar8 + -8) = 0x10406a; uVar5 = sshkey_type(uVar5); *(undefined8 *)((long)plVar8 + -8) = uVar9; *(undefined8 *)((long)plVar8 + -0x10) = uVar1; *(undefined8 *)((long)plVar8 + -0x18) = uVar5; *(char **)((long)plVar8 + -0x20) = "Offending %s key in %s:%lu"; *(undefined8 *)((long)plVar8 + -0x28) = 0x1040a4; sshlog("sshconnect.c", "check_host_key", 0x4f6, 0, 2, 0); if (_fork == 0) goto LAB_001040fd; *(char **)((long)plVar8 + -8) = local_880; *(char **)((long)plVar8 + -0x10) = "Host key for %.200s has changed and you have requested strict " "checking."; *(undefined8 *)((long)plVar8 + -0x18) = 0x1040f0; sshlog("sshconnect.c", "check_host_key", 0x500, 0, 2, 0); } } else { uVar9 = *(undefined8 *)(local_870 + 8); *(undefined8 *)((long)plVar8 + -8) = *(undefined8 *)(local_870 + 0x10); *(undefined8 *)((long)plVar8 + -0x10) = uVar9; *(char **)((long)plVar8 + -0x18) = "@cert-authority"; *(char **)((long)plVar8 + -0x20) = "Host certificate authority does not match %s in %s:%lu"; *(undefined8 *)((long)plVar8 + -0x28) = 0x103d19; sshlog("sshconnect.c", "check_host_key", 0x4d7, 0, 5, 0); } break; case 3: *(char **)((long)plVar8 + -0x10) = "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"; *(undefined8 *)((long)plVar8 + -0x18) = 0x103b13; sshlog("sshconnect.c", "check_host_key", 0x4bd, 0, 2, 0); *(char **)((long)plVar8 + -0x10) = "@ WARNING: REVOKED HOST KEY DETECTED! @"; *(undefined8 *)((long)plVar8 + -0x18) = 0x103b51; sshlog("sshconnect.c", "check_host_key", 0x4be, 0, 2, 0); *(char **)((long)plVar8 + -0x10) = "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"; *(undefined8 *)((long)plVar8 + -0x18) = 0x103b8f; sshlog("sshconnect.c", "check_host_key", 0x4bf, 0, 2, 0); *(char **)((long)plVar8 + -0x10) = local_880; *(undefined8 *)((long)plVar8 + -0x18) = local_838; *(char **)((long)plVar8 + -0x20) = "The %s host key for %s is marked as revoked."; *(undefined8 *)((long)plVar8 + -0x28) = 0x103bdb; sshlog("sshconnect.c", "check_host_key", 0x4c0, 0, 2, 0); *(char **)((long)plVar8 + -0x10) = "This could mean that a stolen key is being used to"; *(undefined8 *)((long)plVar8 + -0x18) = 0x103c19; sshlog("sshconnect.c", "check_host_key", 0x4c1, 0, 2, 0); *(char **)((long)plVar8 + -0x10) = "impersonate this host."; *(undefined8 *)((long)plVar8 + -0x18) = 0x103c57; sshlog("sshconnect.c", "check_host_key", 0x4c2, 0, 2, 0); if (_fork == 0) { LAB_001040fd: if (DAT_00108044 != 0) { *(char **)((long)plVar8 + -0x10) = "Password authentication is disabled to avoid " "man-in-the-middle attacks."; *(undefined8 *)((long)plVar8 + -0x18) = 0x104141; sshlog("sshconnect.c", "check_host_key", 0x50c, 0, 2, 0); DAT_00108044 = 0; local_8b8 = 1; } if (_strerror != 0) { *(char **)((long)plVar8 + -0x10) = "Keyboard-interactive authentication is disabled to avoid " "man-in-the-middle attacks."; *(undefined8 *)((long)plVar8 + -0x18) = 0x10419d; sshlog("sshconnect.c", "check_host_key", 0x512, 0, 2, 0); _strerror = 0; local_8b8 = 1; } if (options != 0) { *(char **)((long)plVar8 + -0x10) = "Agent forwarding is disabled to avoid man-in-the-middle " "attacks."; *(undefined8 *)((long)plVar8 + -0x18) = 0x1041f9; sshlog("sshconnect.c", "check_host_key", 0x518, 0, 2, 0); options = 0; local_8b8 = 1; } if (_xasprintf != 0) { *(char **)((long)plVar8 + -0x10) = "X11 forwarding is disabled to avoid man-in-the-middle " "attacks."; *(undefined8 *)((long)plVar8 + -0x18) = 0x104255; sshlog("sshconnect.c", "check_host_key", 0x51e, 0, 2, 0); _xasprintf = 0; local_8b8 = 1; } if ((0 < _DAT_001092e0) || (0 < _DAT_001092f0)) { *(char **)((long)plVar8 + -0x10) = "Port forwarding is disabled to avoid man-in-the-middle " "attacks."; *(undefined8 *)((long)plVar8 + -0x18) = 0x1042bb; sshlog("sshconnect.c", "check_host_key", 0x525, 0, 2, 0); _DAT_001092f0 = 0; _DAT_001092e0 = 0; local_8b8 = 1; } if (_DAT_00109378 != 0) { *(char **)((long)plVar8 + -0x10) = "Tunnel forwarding is disabled to avoid man-in-the-middle " "attacks."; *(undefined8 *)((long)plVar8 + -0x18) = 0x104323; sshlog("sshconnect.c", "check_host_key", 0x52c, 0, 2, 0); _DAT_00109378 = 0; local_8b8 = 1; } if (_DAT_001096dc != 0) { *(char **)((long)plVar8 + -0x10) = "UpdateHostkeys is disabled because the host key is not " "trusted."; *(undefined8 *)((long)plVar8 + -0x18) = 0x10437f; sshlog("sshconnect.c", "check_host_key", 0x532, 0, 2, 0); _DAT_001096dc = 0; } if ((DAT_0010801c != 0) && (local_8b8 != 0)) { puVar7 = (undefined *)((long)plVar8 + -0x10); *(char **)((long)plVar8 + -0x10) = "Error: forwarding disabled due to host key check failure"; *(undefined8 *)((long)plVar8 + -0x18) = 0x1043da; sshfatal("sshconnect.c", "check_host_key", 0x537, 0, 1, 0); goto switchD_00102f3e_caseD_4; } goto switchD_00102f3e_caseD_5; } *(char **)((long)plVar8 + -0x10) = local_880; *(undefined8 *)((long)plVar8 + -0x18) = local_838; *(char **)((long)plVar8 + -0x20) = "%s host key for %.200s was revoked and you have requested strict " "checking."; *(undefined8 *)((long)plVar8 + -0x28) = 0x103cb1; sshlog("sshconnect.c", "check_host_key", 0x4ca, 0, 2, 0); break; case 4: switchD_00102f3e_caseD_4: plVar8 = (long *)(puVar7 + -0x10); *(char **)(puVar7 + -0x10) = "internal error"; *(undefined8 *)(puVar7 + -0x18) = 0x104414; sshfatal("sshconnect.c", "check_host_key", 0x543, 0, 1, 0); goto switchD_00102f3e_caseD_5; } if ((local_89c == 0) || (local_8a4 == 3)) goto LAB_00104818; *(char **)((long)plVar8 + -0x10) = "No matching CA found. Retry with plain key"; *(undefined8 *)((long)plVar8 + -0x18) = 0x104733; sshlog("sshconnect.c", "check_host_key", 0x578, 0, 5, 0); *(undefined8 *)((long)plVar8 + -8) = 0x104750; local_8b4 = sshkey_from_private(local_8f0, &local_890); puVar7 = (undefined *)plVar8; if (local_8b4 != 0) { *(undefined8 *)((long)plVar8 + -8) = 0x10476c; uVar9 = ssh_err(local_8b4); puVar7 = (undefined *)((long)plVar8 + -0x10); *(char **)((long)plVar8 + -0x10) = "decode key"; *(undefined8 *)((long)plVar8 + -0x18) = 0x1047a3; sshfatal("sshconnect.c", "check_host_key", 0x57a, 1, 1, uVar9); } *(undefined8 *)(puVar7 + -8) = 0x1047b2; local_8b4 = sshkey_drop_cert(local_890); plVar8 = (long *)puVar7; if (local_8b4 != 0) { *(undefined8 *)(puVar7 + -8) = 0x1047ce; uVar9 = ssh_err(local_8b4); plVar8 = (long *)(puVar7 + -0x10); *(char **)(puVar7 + -0x10) = "Couldn\'t drop certificate"; *(undefined8 *)(puVar7 + -0x18) = 0x104805; sshfatal("sshconnect.c", "check_host_key", 0x57c, 0, 1, uVar9); } local_8f0 = local_890; } while (true); } sshlog("sshconnect.c", "check_host_key", 0x3bd, 0, 5, 0, "Forcing accepting of host key for loopback/localhost.", uVar9); _DAT_001096dc = 0; uVar9 = 0; LAB_0010487c: if (local_20 != *(long *)(in_FS_OFFSET + 0x28)) { *(undefined8 *)((long)plVar8 + -8) = 0x104890; __stack_chk_fail(); } return uVar9; LAB_00104818: *(undefined8 *)((long)plVar8 + -8) = 0x104827; sshkey_free(local_890); *(undefined8 *)((long)plVar8 + -8) = 0x104836; free(local_888); *(undefined8 *)((long)plVar8 + -8) = 0x104845; free(local_880); if (local_840 != 0) { *(undefined8 *)((long)plVar8 + -8) = 0x10485e; free_hostkeys(local_840); } if (local_850 != 0) { *(undefined8 *)((long)plVar8 + -8) = 0x104877; free_hostkeys(local_850); } uVar9 = 0xffffffff; goto LAB_0010487c; }
openssh-portable
ghidra
static inline struct dirent const *readdir_ignoring_dot_and_dotdot(DIR *dirp) { while (1) { struct dirent const *dp = readdir(dirp); if (dp == ((void *)0) || !dot_or_dotdot(dp->d_name)) return dp; } }
dirent *readdir_ignoring_dot_and_dotdot(DIR *param_1) { char cVar1; dirent *pdVar2; do { pdVar2 = readdir(param_1); if (pdVar2 == (dirent *)0x0) { return (dirent *)0x0; } cVar1 = dot_or_dotdot(pdVar2->d_name); } while (cVar1 == '\x01'); return pdVar2; }
coreutils
ghidra
time_t monotime(void) { struct timespec ts; monotime_ts(&ts); return ts.tv_sec; }
long long monotime() { char v0; monotime_ts(&v0); return *(&v0); }
openssh-portable
angr_phoenix
static void print_ascii(size_t fields, size_t blank, void const *block, __attribute__((__unused__)) char const *unused_fmt_string, int width, int pad) { unsigned char const *p = block; uintmax_t i; int pad_remaining = pad; for (i = fields; blank < i; i--) { int next_pad = pad * (i - 1) / fields; unsigned char c = *p++; char const *s; char buf[4]; switch (c) { case '\0': s = "\\0"; break; case '\a': s = "\\a"; break; case '\b': s = "\\b"; break; case '\f': s = "\\f"; break; case '\n': s = "\\n"; break; case '\r': s = "\\r"; break; case '\t': s = "\\t"; break; case '\v': s = "\\v"; break; default: sprintf(buf, (((*__ctype_b_loc())[(int)((c))] & (unsigned short int)_ISprint) ? "%c" : "%03o"), c); s = buf; } xprintf("%*s", pad_remaining - next_pad + width, s); pad_remaining = next_pad; } }
long long print_ascii(unsigned long a0, unsigned long a1, unsigned long a2, unsigned long a3, unsigned long a4, unsigned long a5) { unsigned long v0; int tmp_47; char v1; unsigned int v2; unsigned int v3; char *v4; unsigned long v5; unsigned long long v6; char v7; unsigned int v11; unsigned long long v12; v0 = a3; v4 = a2; v2 = a5; for (v5 = a0; a1 < v5; v5 -= 1) { v3 = (0 CONCAT(v5 - 1) * a5) / m a0; tmp_47 = v4; v4 += 1; v1 = *(tmp_47); switch (v1) { case 0: v6 = "\\0"; break; case 7: v6 = "\\a"; break; case 8: v6 = "\\b"; break; case 9: v6 = "\\t"; break; case 10: v6 = "\\n"; break; case 11: v6 = "\\v"; break; case 12: v6 = "\\f"; break; case 13: v6 = "\\r"; break; default: v11 = *((*(__ctype_b_loc()) + v1 * 2)) & 0x4000; if (v11) v12 = "%c"; else v12 = "%03o"; sprintf(&v7, v12); v6 = &v7; break; } xprintf("%*s", v2 - v3 + a4, v6, v2 - v3 + a4); v2 = v3; } return 0; }
coreutils
angr_dream
GNUTLS_SIGN_UNKNOWN) { tmp = (gnutls_sign_get_name( gnutls_sign_algorithm_get_client(session)) != ((void *)0) ? gnutls_sign_get_name( gnutls_sign_algorithm_get_client(session)) : "Unknown"); log_msg(stdout, "- Client Signature: %s\n", tmp); }
void gnutls_sign_get_name(void) { halt_baddata(); }
gnutls
ghidra
static void norm_face(char *face, int n) { memset(face, '0', n); }
long long norm_face(void *a0, unsigned long a1) { return memset(a0, 0x30, a1); }
bash
angr_dream
static inline __u32 rta_getattr_u32(const struct rtattr *rta) { return *(__u32 *)(( void *)(((char *)(rta)) + ((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0)))); }
undefined4 rta_getattr_u32(long param_1) { return *(undefined4 *)(param_1 + 4); }
iproute2-6.0.0
ghidra
static void usage(void) { fprintf( stderr, "Usage: ip route { list | flush } SELECTOR\n" " ip route save SELECTOR\n" " ip route restore\n" " ip route showdump\n" " ip route get [ ROUTE_GET_FLAGS ] ADDRESS\n" " [ from ADDRESS iif STRING ]\n" " [ oif STRING ] [ tos TOS ]\n" " [ mark NUMBER ] [ vrf NAME ]\n" " [ uid NUMBER ] [ ipproto PROTOCOL ]\n" " [ sport NUMBER ] [ dport NUMBER ]\n" " ip route { add | del | change | append | replace } ROUTE\n" "SELECTOR := [ root PREFIX ] [ match PREFIX ] [ exact PREFIX ]\n" " [ table TABLE_ID ] [ vrf NAME ] [ proto RTPROTO ]\n" " [ type TYPE ] [ scope SCOPE ]\n" "ROUTE := NODE_SPEC [ INFO_SPEC ]\n" "NODE_SPEC := [ TYPE ] PREFIX [ tos TOS ]\n" " [ table TABLE_ID ] [ proto RTPROTO ]\n" " [ scope SCOPE ] [ metric METRIC ]\n" " [ ttl-propagate { enabled | disabled } ]\n" "INFO_SPEC := { NH | nhid ID } OPTIONS FLAGS [ nexthop NH ]...\n" "NH := [ encap ENCAPTYPE ENCAPHDR ] [ via [ FAMILY ] ADDRESS ]\n" " [ dev STRING ] [ weight NUMBER ] NHFLAGS\n" "FAMILY := [ inet | inet6 | mpls | bridge | link ]\n" "OPTIONS := FLAGS [ mtu NUMBER ] [ advmss NUMBER ] [ as [ to ] ADDRESS " "]\n" " [ rtt TIME ] [ rttvar TIME ] [ reordering NUMBER ]\n" " [ window NUMBER ] [ cwnd NUMBER ] [ initcwnd NUMBER ]\n" " [ ssthresh NUMBER ] [ realms REALM ] [ src ADDRESS ]\n" " [ rto_min TIME ] [ hoplimit NUMBER ] [ initrwnd NUMBER ]\n" " [ features FEATURES ] [ quickack BOOL ] [ congctl NAME ]\n" " [ pref PREF ] [ expires TIME ] [ fastopen_no_cookie BOOL ]\n" "TYPE := { unicast | local | broadcast | multicast | throw |\n" " unreachable | prohibit | blackhole | nat }\n" "TABLE_ID := [ local | main | default | all | NUMBER ]\n" "SCOPE := [ host | link | global | NUMBER ]\n" "NHFLAGS := [ onlink | pervasive ]\n" "RTPROTO := [ kernel | boot | static | NUMBER ]\n" "PREF := [ low | medium | high ]\n" "TIME := NUMBER[s|ms]\n" "BOOL := [1|0]\n" "FEATURES := ecn\n" "ENCAPTYPE := [ mpls | ip | ip6 | seg6 | seg6local | rpl | ioam6 ]\n" "ENCAPHDR := [ MPLSLABEL | SEG6HDR | SEG6LOCAL | IOAM6HDR ]\n" "SEG6HDR := [ mode SEGMODE ] segs ADDR1,ADDRi,ADDRn [hmac HMACKEYID] " "[cleanup]\n" "SEGMODE := [ encap | encap.red | inline | l2encap | l2encap.red ]\n" "SEG6LOCAL := action ACTION [ OPTIONS ] [ count ]\n" "ACTION := { End | End.X | End.T | End.DX2 | End.DX6 | End.DX4 |\n" " End.DT6 | End.DT4 | End.DT46 | End.B6 | End.B6.Encaps |\n" " End.BM | End.S | End.AS | End.AM | End.BPF }\n" "OPTIONS := OPTION [ OPTIONS ]\n" "OPTION := { srh SEG6HDR | nh4 ADDR | nh6 ADDR | iif DEV | oif DEV |\n" " table TABLEID | vrftable TABLEID | endpoint PROGNAME }\n" "IOAM6HDR := trace prealloc type IOAM6_TRACE_TYPE ns IOAM6_NAMESPACE " "size IOAM6_TRACE_SIZE\n" "ROUTE_GET_FLAGS := [ fibmatch ]\n"); exit(-1); }
void usage() { fprintf(stderr, "Usage: ip route { list | flush } SELECTOR\n ip route save " "SELECTOR\n ip route restore\n ip route showdump\n " "ip route get [ ROUTE_GET_FLAGS ] ADDRESS\n " " [ from ADDRESS iif STRING ]\n [ oif " "STRING ] [ tos TOS ]\n [ mark NUMBER ] [ " "vrf NAME ]\n [ uid NUMBER ] [ ipproto " "PROTOCOL ]\n [ sport NUMBER ] [ dport " "NUMBER ]\n ip route { add | del | change | append | replace } " "ROUTE\nSELECTOR := [ root PREFIX ] [ match PREFIX ] [ exact PREFIX " "]\n [ table TABLE_ID ] [ vrf NAME ] [ proto RTPROTO ]\n " " [ type TYPE ] [ scope SCOPE ]\nROUTE := NODE_SPEC [ " "INFO_SPEC ]\nNODE_SPEC := [ TYPE ] PREFIX [ tos TOS ]\n " "[ table TABLE_ID ] [ proto RTPROTO ]\n [ scope SCOPE ] " "[ metric METRIC ]\n [ ttl-propagate { enabled | " "disabled } ]\nINFO_SPEC := { NH | nhid ID } OPTIONS FLAGS [ nexthop " "NH ]...\nNH := [ encap ENCAPTYPE ENCAPHDR ] [ via [ F"); exit(0xffffffff); }
iproute2-6.0.0
angr_phoenix
static int tty__getcharindex(int i) { switch (i) { case 0: return 0; case 1: return 1; case 2: return 2; case 3: return 3; case 4: return 4; case 5: return 11; case 6: return 16; case 10: return 8; case 11: return 9; case 12: return 14; case 13: return 10; case 15: return 12; case 16: return 13; case 17: return 15; case 23: return 6; case 24: return 5; default: return -1; } }
undefined8 tty__getcharindex(undefined4 param_1) { undefined8 uVar1; switch (param_1) { case 0: uVar1 = 0; break; case 1: uVar1 = 1; break; case 2: uVar1 = 2; break; case 3: uVar1 = 3; break; case 4: uVar1 = 4; break; case 5: uVar1 = 0xb; break; case 6: uVar1 = 0x10; break; default: uVar1 = 0xffffffff; break; case 10: uVar1 = 8; break; case 0xb: uVar1 = 9; break; case 0xc: uVar1 = 0xe; break; case 0xd: uVar1 = 10; break; case 0xf: uVar1 = 0xc; break; case 0x10: uVar1 = 0xd; break; case 0x11: uVar1 = 0xf; break; case 0x17: uVar1 = 6; break; case 0x18: uVar1 = 5; } return uVar1; }
libedit
ghidra
(p->num_bad == 1 && !check_if_fs_block(ctx, block))) { if (check_if_fs_cluster(ctx, ((block) >> (ctx->fs)->cluster_ratio_bits))) return; ext2fs_unmark_block_bitmap2(ctx->block_dup_map, block); }
long check_if_fs_block(long *a1, unsigned long a2) { unsigned int i; unsigned long v4; long v5; v5 = *a1; v4 = *(unsigned int *)(*(_QWORD *)(*a1 + 32) + 20LL); for (i = 0; i < *(_DWORD *)(v5 + 48); ++i) { if ((unsigned int)ext2fs_bg_has_super(v5, i) && a2 >= v4 && a2 <= *(_QWORD *)(v5 + 56) + v4) return 1LL; if (ext2fs_inode_table_loc(v5, i) && a2 >= ext2fs_inode_table_loc(v5, i) && a2 < (unsigned long)*(unsigned int *)(v5 + 72) + ext2fs_inode_table_loc(v5, i)) { return 1LL; } if (a2 == ext2fs_block_bitmap_loc(v5, i) || a2 == ext2fs_inode_bitmap_loc(v5, i)) return 1LL; v4 += *(unsigned int *)(*(_QWORD *)(v5 + 32) + 32LL); } return 0LL; }
e2fsprogs-1.46.5
ida
static void pad_down(unsigned int lines) { if (use_form_feed) putchar_unlocked('\f'); else for (unsigned int i = lines; i; --i) putchar_unlocked('\n'); }
void pad_down(int param_1) { int local_c; local_c = param_1; if (use_form_feed == '\0') { for (; local_c != 0; local_c = local_c + -1) { putchar_unlocked(10); } } else { putchar_unlocked(0xc); } return; }
coreutils
ghidra
static inline int have_traps(void) { return trapcnt; }
int have_traps() { return trapcnt; }
dash-0.5.11+git20210903+057cd650a4ed
angr_sailr
static int pkcs11_key_included(struct sshkey ***keysp, int *nkeys, struct sshkey *key) { int i; for (i = 0; i < *nkeys; i++) if (sshkey_equal(key, (*keysp)[i])) return (1); return (0); }
int pkcs11_key_included(unsigned long long *a0, unsigned int *a1, unsigned long long a2) { unsigned int v0; unsigned int v2; v0 = 0; while (true) { if (v0 < *(a1)) { v2 = sshkey_equal(a2, *((*(a0) + v0 * 8)), *((*(a0) + v0 * 8))); if (v2) { v2 = 1; break; } else { v0 = __addvsi3(v0, 0x1); } } else { v2 = 0; break; } } return v2; }
openssh-portable
angr_dream
void *sh_memalign(alignment, size, file, line) size_t alignment; size_t size; const char *file; int line; { return internal_memalign(alignment, size, file, line, 0x01); }
long sh_memalign(long a1, long a2, char *a3, unsigned int a4) { return internal_memalign(a1, a2, a3, a4); }
bash
ida
static _Bool skip_to_page(uintmax_t page) { for (uintmax_t n = 1; n < page; ++n) { COLUMN *p; int j; for (int i = 1; i < lines_per_body; ++i) { for (j = 1, p = column_vector; j <= columns; ++j, ++p) if (p->status == OPEN) skip_read(p, j); } last_line = 1; for (j = 1, p = column_vector; j <= columns; ++j, ++p) if (p->status == OPEN) skip_read(p, j); if (storing_columns) for (j = 1, p = column_vector; j <= columns; ++j, ++p) if (p->status != CLOSED) p->status = ON_HOLD; reset_status(); last_line = 0; if (files_ready_to_read < 1) { error(0, 0, gettext("starting page number %" "l" "u" " exceeds page count %" "l" "u"), page, n); break; } } return files_ready_to_read > 0; }
int skip_to_page(unsigned long a0) { unsigned int v0; unsigned int v1; unsigned long long v2; struct_0 *v3; unsigned int v5; for (v2 = 1; v2 < a0; v2 += 1) { for (v1 = 1; v1 < lines_per_body; v1 += 1) { v0 = 1; for (v3 = column_vector; v0 <= columns; v3 = &v3[3].padding_0[4]) { if (!v3->field_10) skip_read(v3, v0); v0 += 1; } } last_line = 1; v0 = 1; for (v3 = column_vector; v0 <= columns; v3 = &v3[3].padding_0[4]) { if (!v3->field_10) skip_read(v3, v0); v0 += 1; } if (storing_columns) { v0 = 1; for (v3 = column_vector; v0 <= columns; v3 = &v3[3].padding_0[4]) { if (v3->field_10 != 3) v3->field_10 = 2; v0 += 1; } } reset_status(); last_line = 0; if (files_ready_to_read <= 0) { error(0x0, 0x0, gettext("starting page number %lu exceeds page count %lu")); break; } } v5 = files_ready_to_read; *(&v5) = files_ready_to_read > 0; return v5; }
coreutils
angr_dream
static void fail_exit(int code) { if (home_added) { if (rmdir(prefix_user_home) != 0) { fprintf(stderr, gettext("%s: %s was created, but could not be removed\n"), Prog, prefix_user_home); do { char *old_locale = setlocale(6, ((void *)0)); char *saved_locale = ((void *)0); if (((void *)0) != old_locale) { saved_locale = strdup(old_locale); } if (((void *)0) != saved_locale) { (void)setlocale(6, "C"); } syslog(3, "failed to remove %s", prefix_user_home); if (((void *)0) != saved_locale) { (void)setlocale(6, saved_locale); free(saved_locale); } } while (0); } } if (spw_locked) { if (spw_unlock() == 0) { fprintf(stderr, gettext("%s: failed to unlock %s\n"), Prog, spw_dbname()); do { char *old_locale = setlocale(6, ((void *)0)); char *saved_locale = ((void *)0); if (((void *)0) != old_locale) { saved_locale = strdup(old_locale); } if (((void *)0) != saved_locale) { (void)setlocale(6, "C"); } syslog(3, "failed to unlock %s", spw_dbname()); if (((void *)0) != saved_locale) { (void)setlocale(6, saved_locale); free(saved_locale); } } while (0); } } if (pw_locked) { if (pw_unlock() == 0) { fprintf(stderr, gettext("%s: failed to unlock %s\n"), Prog, pw_dbname()); do { char *old_locale = setlocale(6, ((void *)0)); char *saved_locale = ((void *)0); if (((void *)0) != old_locale) { saved_locale = strdup(old_locale); } if (((void *)0) != saved_locale) { (void)setlocale(6, "C"); } syslog(3, "failed to unlock %s", pw_dbname()); if (((void *)0) != saved_locale) { (void)setlocale(6, saved_locale); free(saved_locale); } } while (0); } } if (gr_locked) { if (gr_unlock() == 0) { fprintf(stderr, gettext("%s: failed to unlock %s\n"), Prog, gr_dbname()); do { char *old_locale = setlocale(6, ((void *)0)); char *saved_locale = ((void *)0); if (((void *)0) != old_locale) { saved_locale = strdup(old_locale); } if (((void *)0) != saved_locale) { (void)setlocale(6, "C"); } syslog(3, "failed to unlock %s", gr_dbname()); if (((void *)0) != saved_locale) { (void)setlocale(6, saved_locale); free(saved_locale); } } while (0); } } if (sgr_locked) { if (sgr_unlock() == 0) { fprintf(stderr, gettext("%s: failed to unlock %s\n"), Prog, sgr_dbname()); do { char *old_locale = setlocale(6, ((void *)0)); char *saved_locale = ((void *)0); if (((void *)0) != old_locale) { saved_locale = strdup(old_locale); } if (((void *)0) != saved_locale) { (void)setlocale(6, "C"); } syslog(3, "failed to unlock %s", sgr_dbname()); if (((void *)0) != saved_locale) { (void)setlocale(6, saved_locale); free(saved_locale); } } while (0); } } if (sub_uid_locked) { if (sub_uid_unlock() == 0) { fprintf(stderr, gettext("%s: failed to unlock %s\n"), Prog, sub_uid_dbname()); do { char *old_locale = setlocale(6, ((void *)0)); char *saved_locale = ((void *)0); if (((void *)0) != old_locale) { saved_locale = strdup(old_locale); } if (((void *)0) != saved_locale) { (void)setlocale(6, "C"); } syslog(3, "failed to unlock %s", sub_uid_dbname()); if (((void *)0) != saved_locale) { (void)setlocale(6, saved_locale); free(saved_locale); } } while (0); } } if (sub_gid_locked) { if (sub_gid_unlock() == 0) { fprintf(stderr, gettext("%s: failed to unlock %s\n"), Prog, sub_gid_dbname()); do { char *old_locale = setlocale(6, ((void *)0)); char *saved_locale = ((void *)0); if (((void *)0) != old_locale) { saved_locale = strdup(old_locale); } if (((void *)0) != saved_locale) { (void)setlocale(6, "C"); } syslog(3, "failed to unlock %s", sub_gid_dbname()); if (((void *)0) != saved_locale) { (void)setlocale(6, saved_locale); free(saved_locale); } } while (0); } } do { char *old_locale = setlocale(6, ((void *)0)); char *saved_locale = ((void *)0); if (((void *)0) != old_locale) { saved_locale = strdup(old_locale); } if (((void *)0) != saved_locale) { (void)setlocale(6, "C"); } syslog(6, "failed adding user '%s', exit code: %d", user_name, code); if (((void *)0) != saved_locale) { (void)setlocale(6, saved_locale); free(saved_locale); } } while (0); exit(code); }
void fail_exit(unsigned long a0) { void *v0; void *v1; void *v2; void *v3; void *v4; void *v5; void *v6; void *v7; char *v8; char *v9; char *v10; char *v11; char *v12; char *v13; char *v14; char *v15; unsigned long v16; unsigned long v17; unsigned long v19; unsigned long v20; unsigned long long v21; unsigned long long v22; unsigned long long v23; unsigned long long v24; unsigned long long v25; unsigned long long v26; v17 = v19; v16 = v20; if (home_added && rmdir(prefix_user_home)) { fprintf(stderr, gettext("%s: %s was created, but could not be removed\n")); v8 = setlocale(0x6, NULL); v0 = 0; if (v8) v0 = strdup(v8); if (v0) setlocale(0x6, "C"); syslog(0x3, "failed to remove %s"); if (v0) { setlocale(0x6, v0); free(v0); } } if (spw_locked && !spw_unlock()) { v21 = spw_dbname(); fprintf(stderr, gettext("%s: failed to unlock %s\n")); v9 = setlocale(0x6, NULL); v1 = 0; if (v9) v1 = strdup(v9); if (v1) setlocale(0x6, "C"); spw_dbname(); syslog(0x3, "failed to unlock %s"); if (v1) { setlocale(0x6, v1); free(v1); } } if (pw_locked && !pw_unlock()) { v22 = pw_dbname(); fprintf(stderr, gettext("%s: failed to unlock %s\n")); v10 = setlocale(0x6, NULL); v2 = 0; if (v10) v2 = strdup(v10); if (v2) setlocale(0x6, "C"); pw_dbname(); syslog(0x3, "failed to unlock %s"); if (v2) { setlocale(0x6, v2); free(v2); } } if (gr_locked && !gr_unlock()) { v23 = gr_dbname(); fprintf(stderr, gettext("%s: failed to unlock %s\n")); v11 = setlocale(0x6, NULL); v3 = 0; if (v11) v3 = strdup(v11); if (v3) setlocale(0x6, "C"); gr_dbname(); syslog(0x3, "failed to unlock %s"); if (v3) { setlocale(0x6, v3); free(v3); } } if (sgr_locked && !sgr_unlock()) { v24 = sgr_dbname(); fprintf(stderr, gettext("%s: failed to unlock %s\n")); v12 = setlocale(0x6, NULL); v4 = 0; if (v12) v4 = strdup(v12); if (v4) setlocale(0x6, "C"); sgr_dbname(); syslog(0x3, "failed to unlock %s"); if (v4) { setlocale(0x6, v4); free(v4); } } if (sub_uid_locked && !sub_uid_unlock()) { v25 = sub_uid_dbname(); fprintf(stderr, gettext("%s: failed to unlock %s\n")); v13 = setlocale(0x6, NULL); v5 = 0; if (v13) v5 = strdup(v13); if (v5) setlocale(0x6, "C"); sub_uid_dbname(); syslog(0x3, "failed to unlock %s"); if (v5) { setlocale(0x6, v5); free(v5); } } if (sub_gid_locked && !sub_gid_unlock()) { v26 = sub_gid_dbname(); fprintf(stderr, gettext("%s: failed to unlock %s\n")); v14 = setlocale(0x6, NULL); v6 = 0; if (v14) v6 = strdup(v14); if (v6) setlocale(0x6, "C"); sub_gid_dbname(); syslog(0x3, "failed to unlock %s"); if (v6) { setlocale(0x6, v6); free(v6); } } v15 = setlocale(0x6, NULL); v7 = 0; if (v15) v7 = strdup(v15); if (v7) setlocale(0x6, "C"); syslog(0x6, "failed adding user '%s', exit code: %d"); if (v7) { setlocale(0x6, v7); free(v7); } exit(a0); }
shadow
angr_phoenix
static void chacha_keysetup(chacha_ctx *x, const u8 *k, u32 kbits) { const char *constants; x->input[4] = (((u32)((k + 0)[0])) | ((u32)((k + 0)[1]) << 8) | ((u32)((k + 0)[2]) << 16) | ((u32)((k + 0)[3]) << 24)); x->input[5] = (((u32)((k + 4)[0])) | ((u32)((k + 4)[1]) << 8) | ((u32)((k + 4)[2]) << 16) | ((u32)((k + 4)[3]) << 24)); x->input[6] = (((u32)((k + 8)[0])) | ((u32)((k + 8)[1]) << 8) | ((u32)((k + 8)[2]) << 16) | ((u32)((k + 8)[3]) << 24)); x->input[7] = (((u32)((k + 12)[0])) | ((u32)((k + 12)[1]) << 8) | ((u32)((k + 12)[2]) << 16) | ((u32)((k + 12)[3]) << 24)); if (kbits == 256) { k += 16; constants = sigma; } else { constants = tau; } x->input[8] = (((u32)((k + 0)[0])) | ((u32)((k + 0)[1]) << 8) | ((u32)((k + 0)[2]) << 16) | ((u32)((k + 0)[3]) << 24)); x->input[9] = (((u32)((k + 4)[0])) | ((u32)((k + 4)[1]) << 8) | ((u32)((k + 4)[2]) << 16) | ((u32)((k + 4)[3]) << 24)); x->input[10] = (((u32)((k + 8)[0])) | ((u32)((k + 8)[1]) << 8) | ((u32)((k + 8)[2]) << 16) | ((u32)((k + 8)[3]) << 24)); x->input[11] = (((u32)((k + 12)[0])) | ((u32)((k + 12)[1]) << 8) | ((u32)((k + 12)[2]) << 16) | ((u32)((k + 12)[3]) << 24)); x->input[0] = (((u32)((constants + 0)[0])) | ((u32)((constants + 0)[1]) << 8) | ((u32)((constants + 0)[2]) << 16) | ((u32)((constants + 0)[3]) << 24)); x->input[1] = (((u32)((constants + 4)[0])) | ((u32)((constants + 4)[1]) << 8) | ((u32)((constants + 4)[2]) << 16) | ((u32)((constants + 4)[3]) << 24)); x->input[2] = (((u32)((constants + 8)[0])) | ((u32)((constants + 8)[1]) << 8) | ((u32)((constants + 8)[2]) << 16) | ((u32)((constants + 8)[3]) << 24)); x->input[3] = (((u32)((constants + 12)[0])) | ((u32)((constants + 12)[1]) << 8) | ((u32)((constants + 12)[2]) << 16) | ((u32)((constants + 12)[3]) << 24)); }
void chacha_keysetup(uint *param_1, uint *param_2, int param_3) { uint *local_28; undefined1 *local_10; param_1[4] = *param_2; param_1[5] = param_2[1]; param_1[6] = param_2[2]; param_1[7] = param_2[3]; if (param_3 == 0x100) { local_28 = param_2 + 4; local_10 = sigma; } else { local_10 = tau; local_28 = param_2; } param_1[8] = *local_28; param_1[9] = local_28[1]; param_1[10] = local_28[2]; param_1[0xb] = local_28[3]; *param_1 = (int)(char)local_10[1] << 8 | (int)(char)*local_10 | (int)(char)local_10[2] << 0x10 | (int)(char)local_10[3] << 0x18; param_1[1] = (int)(char)local_10[5] << 8 | (int)(char)local_10[4] | (int)(char)local_10[6] << 0x10 | (int)(char)local_10[7] << 0x18; param_1[2] = (int)(char)local_10[9] << 8 | (int)(char)local_10[8] | (int)(char)local_10[10] << 0x10 | (int)(char)local_10[0xb] << 0x18; param_1[3] = (int)(char)local_10[0xd] << 8 | (int)(char)local_10[0xc] | (int)(char)local_10[0xe] << 0x10 | (int)(char)local_10[0xf] << 0x18; return; }
libbsd-0.11.7
ghidra
static char *last_device_for_mount(char const *mount) { struct mount_entry const *me; struct mount_entry const *le = ((void *)0); for (me = mount_list; me; me = me->me_next) { if ((strcmp(me->me_mountdir, mount) == 0)) le = me; } if (le) { char *devname = le->me_devname; char *canon_dev = canonicalize_file_name(devname); if (canon_dev && (((canon_dev)[0]) == '/')) return canon_dev; free(canon_dev); return xstrdup(le->me_devname); } else return ((void *)0); }
char *last_device_for_mount(char *param_1) { int iVar1; char *__ptr; char **local_28; char **local_20; local_20 = (char **)0x0; for (local_28 = mount_list; local_28 != (char **)0x0; local_28 = (char **)local_28[6]) { iVar1 = strcmp(local_28[1], param_1); if (iVar1 == 0) { local_20 = local_28; } } if (local_20 == (char **)0x0) { __ptr = (char *)0x0; } else { __ptr = canonicalize_file_name(*local_20); if ((__ptr == (char *)0x0) || (*__ptr != '/')) { free(__ptr); __ptr = (char *)xstrdup(*local_20); } } return __ptr; }
coreutils
ghidra
static void print_forceinfo(const struct forceinfo *fi) { char *desc, *line; desc = m_strdup(gettext(fi->desc)); line = strtok(desc, "\n"); print_forceinfo_line(fi->type, fi->name, line); while ((line = strtok(((void *)0), "\n"))) print_forceinfo_line(FORCETYPE_DISABLED, "", line); free(desc); }
void print_forceinfo(struct_0 *a0) { void *v0; unsigned int v1; unsigned long long v3; v0 = m_strdup(gettext(a0->field_10)); *(&v1) = strtok(v0, "\n"); print_forceinfo_line(a0->field_c, a0->field_0, *(&v1)); while (true) { *(&v1) = strtok(NULL, "\n"); if (!*(&v1)) break; print_forceinfo_line(0x0, &g_400ee5, *(&v1)); } v3 = free(v0); return; }
dpkg
angr_phoenix
static int find_matching_open(char *string, int from, int closer) { register int i; int opener, level, delimiter; switch (closer) { case ']': opener = '['; break; case '}': opener = '{'; break; case ')': opener = '('; break; default: return (-1); } level = 1; delimiter = 0; for (i = from; i > -1; i--) { if (delimiter && (string[i] == delimiter)) delimiter = 0; else if (rl_basic_quote_characters && strchr(rl_basic_quote_characters, string[i])) delimiter = string[i]; else if (!delimiter && (string[i] == closer)) level++; else if (!delimiter && (string[i] == opener)) level--; if (!level) break; } return (i); }
int find_matching_open(char *a0, unsigned long a1, unsigned long a2) { unsigned int v0; unsigned int v1; unsigned int v2; unsigned int v4; char *v5; switch (a2) { case 125: v0 = 123; break; case 41: v0 = 40; break; case 93: v0 = 91; break; default: v4 = -1; return v4; } v1 = 1; v2 = 0; v5 = a1; while (true) { if (v5 < 0) break; if (!(!v2 || v2 != *((a0 + v5)))) { v2 = 0; } else if (!(!rl_basic_quote_characters || !strchr(rl_basic_quote_characters, *((a0 + v5))))) { v2 = *((a0 + v5)); } else if (!(v2 || a2 != *((a0 + v5)))) { v1 += 1; } else if (!v2 && v0 == *((a0 + v5))) { v1 -= 1; } if (!v1) break; v5 = v5 - 1; } v4 = v5; return v4; }
bash
angr_sailr
!= saved_locale) { (void) setlocale ( 6 , "C"); } syslog (
char *setlocale(int __category, char *__locale) { halt_baddata(); }
shadow
ghidra
void add_certificate_file(Options *options, const char *path, int userprovided) { int i; if (options->num_certificate_files >= 100) sshfatal("readconf.c", __func__, 459, 0, SYSLOG_LEVEL_FATAL, ((void *)0), "Too many certificate files specified (max %d)", 100); for (i = 0; i < options->num_certificate_files; i++) { if (options->certificate_file_userprovided[i] == userprovided && strcmp(options->certificate_files[i], path) == 0) { sshlog("readconf.c", __func__, 466, 1, SYSLOG_LEVEL_DEBUG2, ((void *)0), "ignoring duplicate key %s", path); return; } } options->certificate_file_userprovided[options->num_certificate_files] = userprovided; options->certificate_files[options->num_certificate_files++] = xstrdup(path); }
long add_certificate_file(long a1, const char *a2, int a3) { long result; int v4; unsigned int v5; int i; if (*(int *)(a1 + 2808) > 99) sshfatal("readconf.c", "add_certificate_file", 459LL, 0LL, 1LL, 0LL, "Too many certificate files specified (max %d)", 100LL); for (i = 0; i < *(_DWORD *)(a1 + 2808); ++i) { if (a3 == *(_DWORD *)(a1 + 4 * (i + 904LL)) && !strcmp(*(const char **)(a1 + 8 * (i + 352LL)), a2)) return sshlog("readconf.c", "add_certificate_file", 466LL, 1LL, 6LL, 0LL, "ignoring duplicate key %s", a2); } *(_DWORD *)(a1 + 4 * (*(int *)(a1 + 2808) + 904LL)) = a3; v4 = *(_DWORD *)(a1 + 2808); *(_DWORD *)(a1 + 2808) = v4 + 1; result = xstrdup(a2, v5); *(_QWORD *)(a1 + 8 * (v4 + 352LL)) = result; return result; }
openssh-portable
ida
static void get_point(char const *point, const struct stat *statp) { struct stat device_stats; struct mount_entry *me; struct mount_entry const *best_match = ((void *)0); char *resolved = canonicalize_file_name(point); if (resolved && resolved[0] == '/') { size_t resolved_len = strlen(resolved); size_t best_match_len = 0; for (me = mount_list; me; me = me->me_next) { if (!(strcmp(me->me_type, "lofs") == 0) && (!best_match || best_match->me_dummy || !me->me_dummy)) { size_t len = strlen(me->me_mountdir); if (best_match_len <= len && len <= resolved_len && (len == 1 || ((len == resolved_len || resolved[len] == '/') && (strncmp(me->me_mountdir, resolved, len) == 0)))) { best_match = me; best_match_len = len; } } } } free(resolved); if (best_match && (stat(best_match->me_mountdir, &device_stats) != 0 || device_stats.st_dev != statp->st_dev)) best_match = ((void *)0); if (!best_match) for (me = mount_list; me; me = me->me_next) { if (me->me_dev == (dev_t)-1) { if (stat(me->me_mountdir, &device_stats) == 0) me->me_dev = device_stats.st_dev; else { if ((*__errno_location()) == 5) { error(0, (*__errno_location()), "%s", quotearg_n_style_colon(0, shell_escape_quoting_style, me->me_mountdir)); exit_status = 1; } me->me_dev = (dev_t)-2; } } if (statp->st_dev == me->me_dev && !(strcmp(me->me_type, "lofs") == 0) && (!best_match || best_match->me_dummy || !me->me_dummy)) { if (stat(me->me_mountdir, &device_stats) != 0 || device_stats.st_dev != me->me_dev) me->me_dev = (dev_t)-2; else best_match = me; } } if (best_match) get_dev(best_match->me_devname, best_match->me_mountdir, point, point, best_match->me_type, best_match->me_dummy, best_match->me_remote, ((void *)0), 0); else { char *mp = find_mount_point(point, statp); if (mp) { get_dev(((void *)0), mp, point, ((void *)0), ((void *)0), 0, 0, ((void *)0), 0); free(mp); } } }
unsigned long get_point(const char *a1, _QWORD *a2) { const char *v2; int *v3; long i; long j; long v7; size_t v8; char *s; size_t v10; size_t n; char *ptr; struct stat v13; unsigned long v14; v14 = __readfsqword(0x28u); v7 = 0LL; s = canonicalize_file_name(a1); if (s && *s == 47) { v10 = strlen(s); v8 = 0LL; for (i = mount_list; i; i = *(_QWORD *)(i + 48)) { if (strcmp(*(const char **)(i + 24), "lofs") && (!v7 || (*(_BYTE *)(v7 + 40) & 1) != 0 || (*(_BYTE *)(i + 40) & 1) == 0)) { n = strlen(*(const char **)(i + 8)); if (v8 <= n && n <= v10 && (n == 1 || (n == v10 || s[n] == 47) && !strncmp(*(const char **)(i + 8), s, n))) { v7 = i; v8 = n; } } } } free(s); if (v7 && (stat(*(const char **)(v7 + 8), &v13) || v13.st_dev != *a2)) v7 = 0LL; if (!v7) { for (j = mount_list; j; j = *(_QWORD *)(j + 48)) { if (*(_QWORD *)(j + 32) == -1LL) { if (stat(*(const char **)(j + 8), &v13)) { if (*_errno_location() == 5) { v2 = (const char *)quotearg_n_style_colon(0LL, 3LL, *(_QWORD *)(j + 8)); v3 = _errno_location(); error(0, *v3, "%s", v2); exit_status = 1; } *(_QWORD *)(j + 32) = -2LL; } else { *(_QWORD *)(j + 32) = v13.st_dev; } } if (*a2 == *(_QWORD *)(j + 32) && strcmp(*(const char **)(j + 24), "lofs") && (!v7 || (*(_BYTE *)(v7 + 40) & 1) != 0 || (*(_BYTE *)(j + 40) & 1) == 0)) { if (!stat(*(const char **)(j + 8), &v13) && v13.st_dev == *(_QWORD *)(j + 32)) v7 = j; else *(_QWORD *)(j + 32) = -2LL; } } } if (v7) { get_dev(*(char **)v7, *(const char **)(v7 + 8), a1, a1, *(const char **)(v7 + 24), (*(_BYTE *)(v7 + 40) & 1) != 0, (*(_BYTE *)(v7 + 40) & 2) != 0, 0LL, 0); } else { ptr = (char *)find_mount_point(a1, a2); if (ptr) { get_dev(0LL, ptr, a1, 0LL, 0LL, 0, 0, 0LL, 0); free(ptr); } } return __readfsqword(0x28u) ^ v14; }
coreutils
ida
static inline __u8 rta_getattr_u8(const struct rtattr *rta) { return *(__u8 *)(( void *)(((char *)(rta)) + ((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0)))); }
int rta_getattr_u8(struct_0 *a0) { return a0->field_4; }
iproute2-6.0.0
angr_phoenix
unsigned long long get_memory_size(void) { return (unsigned long long)sysconf(_SC_PHYS_PAGES) * (unsigned long long)sysconf(_SC_PAGESIZE); }
long long get_memory_size() { return sysconf(0x55) * sysconf(0x1e); }
e2fsprogs-1.46.5
angr_sailr
int _rl_any_typein(void) { return (push_index != pop_index); }
long long _rl_any_typein() { return push_index != pop_index; }
bash
angr_dream
static inline void __jiffies_to_tv(struct timeval *tv, unsigned long jiffies) { unsigned long long tvusec; tvusec = 10000ULL * jiffies; tv->tv_sec = tvusec / 1000000; tv->tv_usec = tvusec - 1000000 * tv->tv_sec; }
void __jiffies_to_tv(unsigned long long a0[2], unsigned long a1) { unsigned long v0; char v1; unsigned long long v3[2]; unsigned long long v4; v0 = a1 * 10000; a0[0] = v0 * 4835703278458516699 >> 64 >> 18; v3 = a0; a0[1] = v0 - a0[0] * 1000000; v4 = *(&v1); return; }
iproute2-6.0.0
angr_phoenix
static HIST_ENTRY *last_history_entry() { HIST_ENTRY *he; using_history(); he = previous_history(); using_history(); return he; }
long last_history_entry() { long v1; using_history(); v1 = previous_history(); using_history(); return v1; }
bash
ida
static void display_loginmsg(void) { int r; if (sshbuf_len(loginmsg) == 0) return; if ((r = sshbuf_put_u8(loginmsg, 0)) != 0) sshfatal("session.c", __func__, 255, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "sshbuf_put_u8"); printf("%s", (char *)sshbuf_ptr(loginmsg)); sshbuf_reset(loginmsg); }
void display_loginmsg() { unsigned long long v0; unsigned int v1; unsigned long long v4; if (sshbuf_len(loginmsg)) { v1 = sshbuf_put_u8(loginmsg, 0x0); if (v1) { v0 = "sshbuf_put_u8"; sshfatal("session.c", "display_loginmsg", 0xff, 0x1, 0x1, ssh_err(v1)); } printf("%s", sshbuf_ptr(loginmsg)); v4 = sshbuf_reset(loginmsg); } return; }
openssh-portable
angr_phoenix
void rl_forced_update_display(void) { el_set(e, 20); }
long rl_forced_update_display(long a1, long a2, long a3) { return el_set(e, 20LL, a3); }
libedit
ida
&& ((s = getenv("SSH_ASKPASS_REQUIRE")) == ((void *)0) || strcmp(s, "force") != 0)) { sshlog("readpass.c", __func__, 267, 1, SYSLOG_LEVEL_DEBUG3, ((void *)0), "cannot notify: no display"); goto out; }
char *getenv(char *__name) { halt_baddata(); }
openssh-portable
ghidra
static int iproute_restore(void) { int pos, prio; if (route_dump_check_magic()) return -1; pos = ftell(stdin); if (pos == -1) { perror("Failed to restore: ftell"); return -1; } for (prio = 0; prio < 3; prio++) { int err; err = rtnl_from_file(stdin, &restore_handler, &prio); if (err) return -2; if (fseek(stdin, pos, 0) == -1) { perror("Failed to restore: fseek"); return -1; } } return 0; }
undefined8 iproute_restore(void) { int iVar1; undefined8 uVar2; long lVar3; long in_FS_OFFSET; int local_1c; int local_18; int local_14; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); iVar1 = route_dump_check_magic(); if (iVar1 == 0) { lVar3 = ftell(stdin); local_18 = (int)lVar3; if (local_18 == -1) { perror("Failed to restore: ftell"); uVar2 = 0xffffffff; } else { for (local_1c = 0; local_1c < 3; local_1c = local_1c + 1) { local_14 = rtnl_from_file(stdin, restore_handler, &local_1c); if (local_14 != 0) { uVar2 = 0xfffffffe; goto LAB_00108844; } iVar1 = fseek(stdin, (long)local_18, 0); if (iVar1 == -1) { perror("Failed to restore: fseek"); uVar2 = 0xffffffff; goto LAB_00108844; } } uVar2 = 0; } } else { uVar2 = 0xffffffff; } LAB_00108844: if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) { __stack_chk_fail(); } return uVar2; }
iproute2-6.0.0
ghidra
ea_key_t ea_refcount_intr_next(ext2_refcount_t refcount, ea_value_t *ret) { struct ea_refcount_el *list; while (1) { if (refcount->cursor >= refcount->count) return 0; list = refcount->list; if (list[refcount->cursor].ea_value) { if (ret) *ret = list[refcount->cursor].ea_value; return list[refcount->cursor++].ea_key; } refcount->cursor++; } }
undefined8 ea_refcount_intr_next(ulong *param_1, undefined8 *param_2) { ulong uVar1; ulong uVar2; while (true) { if (*param_1 <= param_1[2]) { return 0; } uVar1 = param_1[3]; if (*(long *)(uVar1 + param_1[2] * 0x10 + 8) != 0) break; param_1[2] = param_1[2] + 1; } if (param_2 != (undefined8 *)0x0) { *param_2 = *(undefined8 *)(uVar1 + param_1[2] * 0x10 + 8); } uVar2 = param_1[2]; param_1[2] = uVar2 + 1; return *(undefined8 *)(uVar1 + uVar2 * 0x10); }
e2fsprogs-1.46.5
ghidra
static void do_chown(int fd, char const *name, uid_t uid, gid_t gid) { (__extension__({ __typeof__(fchown(fd, uid, gid)) __x = (fchown(fd, uid, gid)); (void)__x; })); }
void do_chown(unsigned long a0, unsigned long a1, unsigned long a2, unsigned long a3) { unsigned long v0; unsigned int v1; v0 = a1; v1 = fchown(a0, a2, a3); return; }
gzip-1.12
angr_sailr
static VARLIST *vlist_realloc(vlist, n) VARLIST *vlist; int n; { if (vlist == 0) return (vlist = vlist_alloc(n)); if (n > vlist->list_size) { vlist->list_size = n; vlist->list = (SHELL_VAR **)sh_xrealloc( (vlist->list), ((vlist->list_size + 1) * sizeof(SHELL_VAR *)), "variables.c", 4190); } return vlist; }
int vlist_realloc(unsigned long a0, unsigned long a1) { unsigned long v0; unsigned int v2; v0 = a0; if (!v0) { v0 = vlist_alloc(a1); v2 = v0; return v2; } if (a1 > v0->field_8) { v0->field_8 = a1; v0->field_0 = sh_xrealloc(v0->field_0, (v0->field_8 + 1) * 8, "variables.c", 0x105e); } v2 = v0; return v2; }
bash
angr_sailr
static int do_add(int argc, char **argv) { struct { struct nlmsghdr n; struct genlmsghdr g; char buf[(((0) + 4U - 1) & ~(4U - 1)) + (1024)]; } req = { .n = { .nlmsg_type = (genl_family), .nlmsg_flags = (0x01), .nlmsg_len = (((((sizeof(struct genlmsghdr)) + 4U - 1) & ~(4U - 1)) + (0)) + ((int)(((sizeof(struct nlmsghdr)) + 4U - 1) & ~(4U - 1)))), }, .g = { .cmd = (FOU_CMD_ADD), .version = (0x1), }, }; fou_parse_opt(argc, argv, &req.n, 1); if (rtnl_talk(&genl_rth, &req.n, ((void *)0)) < 0) return -2; return 0; }
void do_add(unsigned long a0, unsigned int a1) { unsigned int v0; unsigned int v1; unsigned short v2; unsigned short v3; char v4; char v5; unsigned long long v7; void *v8; unsigned long v9; unsigned long long v10; void *v11; v0 = a0; v7 = 130; for (v8 = &v1; v7; v8 += v9 * 8) { v7 -= 1; v1 = 0; } *(v8) = 0; v1 = 20; v2 = genl_family; v3 = 1; v4 = 1; v5 = 1; fou_parse_opt(v0, a1, &v1, 0x1); if (rtnl_talk(&genl_rth, &v1, 0x0) < 0) v10 = 4294967294; else v11 = 0; return; }
iproute2-6.0.0
angr_phoenix
static void pkg_array_list_item(struct pkg_array *array, struct pkginfo *pkg, void *pkg_data) { struct list_format *fmt = pkg_data; int l; const char *pdesc; list_format_init(fmt, array); list_format_print_header(fmt); pdesc = pkg_synopsis(pkg, &l); l = ((l) < (fmt->dw) ? (l) : (fmt->dw)); list_format_print(fmt, pkg_abbrev_want(pkg), pkg_abbrev_status(pkg), pkg_abbrev_eflag(pkg), pkg_name(pkg, pnaw_nonambig), versiondescribe(&pkg->installed.version, vdew_nonambig), dpkg_arch_describe(pkg->installed.arch), pdesc, l); }
void pkg_array_list_item(undefined8 param_1, long param_2, long param_3) { int iVar1; undefined4 uVar2; undefined4 uVar3; undefined4 uVar4; undefined8 uVar5; undefined8 uVar6; undefined8 uVar7; long in_FS_OFFSET; undefined8 uVar8; int local_54; long local_50; undefined8 local_48; long local_40; local_40 = *(long *)(in_FS_OFFSET + 0x28); local_50 = param_3; list_format_init(param_3, param_1); list_format_print_header(local_50); local_48 = pkg_synopsis(param_2, &local_54); iVar1 = local_54; if (*(int *)(local_50 + 0x10) <= local_54) { iVar1 = *(int *)(local_50 + 0x10); } local_54 = iVar1; uVar5 = dpkg_arch_describe(*(undefined8 *)(param_2 + 0x58)); uVar6 = versiondescribe(param_2 + 0x98, 1); uVar7 = pkg_name(param_2, 1); uVar2 = pkg_abbrev_eflag(param_2); uVar3 = pkg_abbrev_status(param_2); uVar8 = 0x10086b; uVar4 = pkg_abbrev_want(param_2); list_format_print(local_50, uVar4, uVar3, uVar2, uVar7, uVar6, uVar5, local_48, iVar1, uVar8); if (local_40 != *(long *)(in_FS_OFFSET + 0x28)) { __stack_chk_fail(); } return; }
dpkg
ghidra
void sshkey_dump_ec_point(const EC_GROUP *group, const EC_POINT *point) { BIGNUM *x = ((void *)0), *y = ((void *)0); if (point == ((void *)0)) { fputs("point=(NULL)\n", stderr); return; } if ((x = BN_new()) == ((void *)0) || (y = BN_new()) == ((void *)0)) { fprintf(stderr, "%s: BN_new failed\n", __func__); goto out; } if (EC_METHOD_get_field_type(EC_GROUP_method_of(group)) != 406) { fprintf(stderr, "%s: group is not a prime field\n", __func__); goto out; } if (EC_POINT_get_affine_coordinates_GFp(group, point, x, y, ((void *)0)) != 1) { fprintf(stderr, "%s: EC_POINT_get_affine_coordinates_GFp\n", __func__); goto out; } fputs("x=", stderr); BN_print_fp(stderr, x); fputs("\ny=", stderr); BN_print_fp(stderr, y); fputs("\n", stderr); out: BN_clear_free(x); BN_clear_free(y); }
int sshkey_dump_ec_point(long a1, long a2) { long v3; long v4; long v5; v4 = 0LL; if (!a2) return fputs("point=(NULL)\n", stderr); v5 = BN_new(); if (v5 && (v4 = BN_new()) != 0) { v3 = EC_GROUP_method_of(a1); if ((unsigned int)EC_METHOD_get_field_type(v3) == 406) { if ((unsigned int)EC_POINT_get_affine_coordinates_GFp(a1, a2, v5, v4, 0LL) == 1) { fputs("x=", stderr); BN_print_fp(stderr, v5); fputs("\ny=", stderr); BN_print_fp(stderr, v4); fputs("\n", stderr); } else { fprintf(stderr, "%s: EC_POINT_get_affine_coordinates_GFp\n", "sshkey_dump_ec_point"); } } else { fprintf(stderr, "%s: group is not a prime field\n", "sshkey_dump_ec_point"); } } else { fprintf(stderr, "%s: BN_new failed\n", "sshkey_dump_ec_point"); } BN_clear_free(v5); return BN_clear_free(v4); }
openssh-portable
ida
test_code_t test_ext_master_secret(gnutls_session_t session) { int ret; if (tls_ext_ok == 0) return TEST_IGNORE; sprintf(prio_str, "NONE:" "+CIPHER-ALL:+ARCFOUR-128:+3DES-CBC" ":+GOST28147-TC26Z-CNT" ":" "+COMP-NULL" ":%s:" "+MAC-ALL:+MD5:+SHA1" ":+GOST28147-TC26Z-IMIT" ":%s:" "+RSA:+DHE-RSA:+DHE-DSS:+ANON-DH:+ECDHE-RSA:+ECDHE-ECDSA:+ANON-ECDH" ":+VKO-GOST-12", rest, protocol_str); { int _ret; if ((_ret = __gnutls_priority_set_direct(session, prio_str, 470)) != TEST_SUCCEED) { return _ret; } }; gnutls_credentials_set(session, GNUTLS_CRD_CERTIFICATE, xcred); ret = test_do_handshake(session); if (ret < 0) return TEST_FAILED; if (gnutls_session_ext_master_secret_status(session) != 0) return TEST_SUCCEED; return TEST_FAILED; }
long long test_ext_master_secret(unsigned long long a0) { unsigned int v0; unsigned int v1; unsigned long long v3; if (!tls_ext_ok) { v3 = 3; } else { sprintf( &prio_str, "NONE:+CIPHER-ALL:+ARCFOUR-128:+3DES-CBC:+GOST28147-TC26Z-CNT:+COMP-" "NULL:%s:+MAC-ALL:+MD5:+SHA1:+GOST28147-TC26Z-IMIT:%s:+RSA:+DHE-RSA:+" "DHE-DSS:+ANON-DH:+ECDHE-RSA:+ECDHE-ECDSA:+ANON-ECDH:+VKO-GOST-12", &rest, &protocol_str); v0 = __gnutls_priority_set_direct(a0, &prio_str, 0x1d6); if (v0) { v3 = v0; } else { gnutls_credentials_set(a0, 0x1, xcred); v1 = test_do_handshake(a0); if (v1 < 0) { v3 = 1; } else if (gnutls_session_ext_master_secret_status(a0)) { v3 = 0; } else { v3 = 1; } } } return v3; }
gnutls
angr_phoenix
DH *dh_new_group16(void) { static char *gen = "2", *group16 = "FFFFFFFF" "FFFFFFFF" "C90FDAA2" "2168C234" "C4C6628B" "80DC1CD1" "29024E08" "8A67CC74" "020BBEA6" "3B139B22" "514A0879" "8E3404DD" "EF9519B3" "CD3A431B" "302B0A6D" "F25F1437" "4FE1356D" "6D51C245" "E485B576" "625E7EC6" "F44C42E9" "A637ED6B" "0BFF5CB6" "F406B7ED" "EE386BFB" "5A899FA5" "AE9F2411" "7C4B1FE6" "49286651" "ECE45B3D" "C2007CB8" "A163BF05" "98DA4836" "1C55D39A" "69163FA8" "FD24CF5F" "83655D23" "DCA3AD96" "1C62F356" "208552BB" "9ED52907" "7096966D" "670C354E" "4ABC9804" "F1746C08" "CA18217C" "32905E46" "2E36CE3B" "E39E772C" "180E8603" "9B2783A2" "EC07A28F" "B5C55DF0" "6F4C52C9" "DE2BCBF6" "95581718" "3995497C" "EA956AE5" "15D22618" "98FA0510" "15728E5A" "8AAAC42D" "AD33170D" "04507A33" "A85521AB" "DF1CBA64" "ECFB8504" "58DBEF0A" "8AEA7157" "5D060C7D" "B3970F85" "A6E1E4C7" "ABF5AE8C" "DB0933D7" "1E8C94E0" "4A25619D" "CEE3D226" "1AD2EE6B" "F12FFA06" "D98A0864" "D8760273" "3EC86A64" "521F2B18" "177B200C" "BBE11757" "7A615D6C" "770988C0" "BAD946E2" "08E24FA0" "74E5AB31" "43DB5BFC" "E0FD108E" "4B82D120" "A9210801" "1A723C12" "A787E6D7" "88719A10" "BDBA5B26" "99C32718" "6AF4E23C" "1A946834" "B6150BDA" "2583E9CA" "2AD44CE8" "DBBBC2DB" "04DE8EF9" "2E8EFC14" "1FBECAA6" "287C5947" "4E6BC05D" "99B2964F" "A090C3A2" "233BA186" "515BE7ED" "1F612970" "CEE2D7AF" "B81BDD76" "2170481C" "D0069127" "D5B05AA9" "93B4EA98" "8D8FDDC1" "86FFB7DC" "90A6C08F" "4DF435C9" "34063199" "FFFFFFFF" "FFFFFFFF"; return (dh_new_group_asc(gen, group16)); }
void dh_new_group16() { unsigned long long v1; v1 = dh_new_group_asc(gen.17691, group16.17692); return; }
openssh-portable
angr_phoenix
static crypto_uint16 int32_mod_uint14(crypto_int32 x, crypto_uint16 m) { crypto_int32 q; crypto_uint16 r; int32_divmod_uint14(&q, &r, x, m); return r; }
long int32_mod_uint14(int a1, unsigned short a2) { unsigned short v3; int v4; unsigned long v5; v5 = __readfsqword(0x28u); int32_divmod_uint14(&v4, &v3, a1, a2); return v3; }
openssh-portable
ida
char *showdate() { char *s = ctime(&lastdate); s[16] = 0; return s; }
char *showdate() { char *result; result = ctime(&lastdate); result[16] = 0; return result; }
sysvinit
ida
static void main_sigchld_handler(int sig) { int save_errno = (*__errno_location()); pid_t pid; int status; while ((pid = waitpid(-1, &status, 1)) > 0 || (pid == -1 && (*__errno_location()) == 4)) ; (*__errno_location()) = save_errno; }
void main_sigchld_handler(void) { int *piVar1; long in_FS_OFFSET; int local_1c; int local_18; __pid_t local_14; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); piVar1 = __errno_location(); local_18 = *piVar1; do { do { local_14 = waitpid(-1, &local_1c, 1); } while (0 < local_14); if (local_14 != -1) break; piVar1 = __errno_location(); } while (*piVar1 == 4); piVar1 = __errno_location(); *piVar1 = local_18; if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) { __stack_chk_fail(); } return; }
openssh-portable
ghidra
void cleanup_exit(int i) { sftp_server_cleanup_exit(i); }
long long cleanup_exit(unsigned long a0) { sftp_server_cleanup_exit(a0); }
openssh-portable
angr_sailr
Keymap rl_make_bare_keymap(void) { register int i; Keymap keymap; keymap = (Keymap)xmalloc(257 * sizeof(KEYMAP_ENTRY)); for (i = 0; i < 257; i++) { keymap[i].type = 0; keymap[i].function = (rl_command_func_t *)((void *)0); } return (keymap); }
int rl_make_bare_keymap() { void *v0; void *v2; v0 = xmalloc(0x1010); for (v2 = 0; v2 <= 0x100; v2 = v2 + 1) { *(v0 + 0x10 * v2) = 0; *((8 + v0 + 0x10 * v2)) = 0; } return v0; }
bash
angr_phoenix
static int execute_arith_for_command(arith_for_command) ARITH_FOR_COM *arith_for_command; { intmax_t expresult; int expok, body_status, arith_lineno, save_lineno; body_status = 0; loop_level++; save_lineno = line_number; if (arith_for_command->flags & 0x08) arith_for_command->action->flags |= 0x08; this_command_name = "(("; line_number = arith_lineno = arith_for_command->line; if (variable_context && interactive_shell && sourcelevel == 0) { line_number -= function_line_number - 1; if (line_number <= 0) line_number = 1; } expresult = eval_arith_for_expr(arith_for_command->init, &expok); if (expok == 0) { line_number = save_lineno; return (1); } while (1) { line_number = arith_lineno; expresult = eval_arith_for_expr(arith_for_command->test, &expok); line_number = save_lineno; if (expok == 0) { body_status = 1; break; } do { if (job_control == 0 || interactive_shell == 0) reap_dead_jobs(); } while (0); if (expresult == 0) break; do { if (terminating_signal) termsig_handler(terminating_signal); if (interrupt_state) throw_to_top_level(); } while (0); body_status = execute_command(arith_for_command->action); do { if (terminating_signal) termsig_handler(terminating_signal); if (interrupt_state) throw_to_top_level(); } while (0); if (breaking) { breaking--; break; } if (continuing) { continuing--; if (continuing) break; } line_number = arith_lineno; expresult = eval_arith_for_expr(arith_for_command->step, &expok); line_number = save_lineno; if (expok == 0) { body_status = 1; break; } } loop_level--; line_number = save_lineno; return (body_status); }
undefined4 execute_arith_for_command(uint *param_1) { undefined4 uVar1; long in_FS_OFFSET; int local_28; undefined4 local_24; undefined4 local_20; uint local_1c; long local_18; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); local_24 = 0; loop_level = loop_level + 1; local_20 = line_number; if ((*param_1 & 8) != 0) { *(uint *)(*(long *)(param_1 + 8) + 4) = *(uint *)(*(long *)(param_1 + 8) + 4) | 8; } this_command_name = &DAT_0010b34f; local_1c = param_1[1]; line_number = local_1c; if ((((variable_context != 0) && (interactive_shell != 0)) && (sourcelevel == 0)) && (line_number = local_1c - (function_line_number + -1), (int)line_number < 1)) { line_number = 1; } local_18 = eval_arith_for_expr(*(undefined8 *)(param_1 + 2), &local_28); if (local_28 == 0) { uVar1 = 1; } else { do { line_number = local_1c; local_18 = eval_arith_for_expr(*(undefined8 *)(param_1 + 4), &local_28); line_number = local_20; if (local_28 == 0) { local_24 = 1; goto LAB_00105352; } if ((job_control == 0) || (interactive_shell == 0)) { reap_dead_jobs(); } if (local_18 == 0) goto LAB_00105352; if (terminating_signal != 0) { termsig_handler(terminating_signal); } if (interrupt_state != 0) { throw_to_top_level(); } local_24 = execute_command(*(undefined8 *)(param_1 + 8)); if (terminating_signal != 0) { termsig_handler(terminating_signal); } if (interrupt_state != 0) { throw_to_top_level(); } if (breaking != 0) { breaking = breaking + -1; goto LAB_00105352; } if ((continuing != 0) && (continuing = continuing + -1, continuing != 0)) goto LAB_00105352; line_number = local_1c; local_18 = eval_arith_for_expr(*(undefined8 *)(param_1 + 6), &local_28); } while (local_28 != 0); local_24 = 1; LAB_00105352: loop_level = loop_level + -1; uVar1 = local_24; } if (local_10 == *(long *)(in_FS_OFFSET + 0x28)) { line_number = local_20; return uVar1; } line_number = local_20; __stack_chk_fail(); }
bash
ghidra
static Fq Fq_recip(Fq a1) { int i = 1; Fq ai = a1; while (i < 4591 - 2) { ai = Fq_freeze(a1 * (crypto_int32)ai); i += 1; } return ai; }
short Fq_recip(short param_1) { short local_e; int local_c; local_c = 1; local_e = param_1; while (local_c < 0x11ed) { __mulvsi3((int)param_1, (int)local_e); local_e = Fq_freeze(); local_c = __addvsi3(); } return local_e; }
openssh-portable
ghidra
static void sh_seedrand() { int d; static int seeded = 0; if (seeded == 0) { struct timeval tv; gettimeofday(&tv, ((void *)0)); srandom(tv.tv_sec ^ tv.tv_usec ^ (getpid() << 16) ^ (uintptr_t)&d); seeded = 1; } }
long long sh_seedrand() { char v0; char v1; char v2; if (!seeded.7563) { gettimeofday(&v1, NULL); srandom(&v0 ^ (getpid() * 0x10000) ^ *(&v1) ^ *(&v2)); seeded.7563 = 1; } return 0; }
bash
angr_phoenix
static char *quote_breaks(char *s) { register char *p, *r; char *ret; int len = 3; for (p = s; p && *p; p++, len++) { if (*p == '\'') len += 3; else if ((((*p) == ' ') || ((*p) == '\t')) || *p == '\n') len += 2; } r = ret = (char *)xmalloc(len); *r++ = '\''; for (p = s; p && *p;) { if (*p == '\'') { *r++ = '\''; *r++ = '\\'; *r++ = '\''; *r++ = '\''; p++; } else if ((((*p) == ' ') || ((*p) == '\t')) || *p == '\n') { *r++ = '\''; *r++ = *p++; *r++ = '\''; } else *r++ = *p++; } *r++ = '\''; *r = '\0'; return ret; }
int quote_breaks(unsigned long long a0) { unsigned int v0; int tmp_11; int tmp_4; char *v1; char *v3; char *v4; char *v5; char *v7; char v8[3]; char v9[3]; v0 = 3; v3 = a0; while (true) { if (!v3) break; if (!*(v3)) break; if (*(v3) == 39) { v0 += 3; } else { if (*(v3) != 32 && *(v3) != 9 && !(*(v3) == 10)) goto LABEL_400682; v0 += 2; } LABEL_400682: v3 += 1; v0 += 1; } v1 = xmalloc(v0); v8 = v1 + 1; *(v1) = 39; v5 = a0; while (true) { if (!v5) break; if (!*(v5)) break; if (*(v5) == 39) { v8[0] = 39; v8[1] = 92; v8[2] = 39; v4 = v8 + 1; v8 = &v8[1 + 1]; *(v4) = 39; v5 += 1; continue; } if (*(v5) == 32) { LABEL_400708: v8[0] = 39; tmp_11 = v5; v5 += 1; v8[1] = *(tmp_11); v7 = &v8[2]; v8 += 1; *(v7) = 39; } else { if (*(v5) == 9) goto LABEL_400708; if (*(v5) == 10) goto LABEL_400708; tmp_4 = v5; v5 += 1; v9 = v8; v8 = &v8[1]; v9[0] = *(tmp_4); } } v8[0] = 39; v8[1] = 0; return v1; }
bash
angr_phoenix
void xattrs_acls_set(struct tar_stat_info const *st, char const *file_name, char typeflag) { if (acls_option > 0 && typeflag != '2') { xattrs__acls_set(st, file_name, (0x8000), st->acls_a_ptr, st->acls_a_len, 0); if (typeflag == '5' || typeflag == 'D') xattrs__acls_set(st, file_name, (0x4000), st->acls_d_ptr, st->acls_d_len, 1); } }
long long xattrs_acls_set(unsigned long long a0[11], unsigned long long a1, unsigned long a2) { unsigned long long v1; v1 = acls_option; if (acls_option > 0 && a2 != 50) { v1 = xattrs__acls_set(a0, a1, 0x8000, a0[7], a0[8], 0x0); if (a2 == 53 || a2 == 68) v1 = xattrs__acls_set(a0, a1, 0x4000, a0[9], a0[10], 0x1); } return v1; }
tar
angr_dream
int _ssh__compat_glob(const char *pattern, int flags, int (*errfunc)(const char *, int), _ssh_compat_glob_t *pglob) { const u_char *patnext; int c; Char *bufnext, *bufend, patbuf[4096]; struct glob_lim limit = {0, 0, 0}; patnext = (u_char *)pattern; if (!(flags & 0x0001)) { pglob->gl_pathc = 0; pglob->gl_pathv = ((void *)0); pglob->gl_statv = ((void *)0); if (!(flags & 0x0002)) pglob->gl_offs = 0; } pglob->gl_flags = flags & ~0x0100; pglob->gl_errfunc = errfunc; pglob->gl_matchc = 0; if (strnlen(pattern, 4096) == 4096) return ((-3)); if (pglob->gl_offs >= 0x7fffffffffffffffL || pglob->gl_pathc >= 0x7fffffffffffffffL || pglob->gl_pathc >= 0x7fffffffffffffffL - pglob->gl_offs - 1) return (-1); bufnext = patbuf; bufend = bufnext + 4096 - 1; if (flags & 0x1000) while (bufnext < bufend && (c = *patnext++) != '\0') *bufnext++ = c; else { while (bufnext < bufend && (c = *patnext++) != '\0') if (c == '\\') { if ((c = *patnext++) == '\0') { c = '\\'; --patnext; } *bufnext++ = c | 0x4000; } else *bufnext++ = c; } *bufnext = '\0'; if (flags & 0x0080) return globexp1(patbuf, pglob, &limit); else return glob0(patbuf, pglob, &limit); }
long long _ssh__compat_glob(char *a0, unsigned long a1, unsigned long a2, struct_0 *a3) { unsigned int v0; int tmp_21; int tmp_11; int tmp_15; unsigned int v1; char *v2; unsigned short *v3; unsigned long v4; void *v5; void *v6; void *v7; char v8; unsigned long long v9; unsigned long long v10; unsigned long long v12; unsigned long long v13; unsigned short *v15; unsigned long long v16; unsigned short *v17; unsigned short *v19; v10 = *(&v10); v9 = *(&v9); v0 = a1; v5 = 0; v6 = 0; v7 = 0; v2 = a0; if (!(v0 & 1)) { a3->field_0 = 0; a3->field_20 = 0; a3->field_28 = 0; if (!(v0 & 2)) a3->field_10 = 0; } v12 = v0; *(&v12) = (v0 >> 8) & 254; tmp_21 = v12; a3->field_18 = tmp_21; a3->field_30 = a2; a3->field_8 = 0; if (strnlen(a0, 0x1000) == 0x1000) { v13 = 4294967293; } else if (a3->field_10 > 9223372036854775806) { LABEL_40018b: v13 = 4294967295; } else { if (!(a3->field_0 <= 9223372036854775806)) goto LABEL_40018b; if (!(a3->field_0 < 9223372036854775806 - a3->field_10)) goto LABEL_40018b; v3 = &v8; v4 = v3 + 4095; if (!(v0 & 0x1000)) { while (true) { if (v3 >= v4) break; tmp_11 = v2; v2 += 1; *(&v12) = *(tmp_11); v1 = v12; if (!v1) break; if (v1 != 92) { v15 = v3; v3 = v3 + 1; *(v15) = v1; } else { tmp_11 = v2; v2 += 1; v1 = *(tmp_11); if (!v1) { v1 = 92; v2 -= 1; } v16 = v1; *(&v16) = (v1 >> 8) | 64; tmp_15 = v16; v17 = v3; v3 += 1; *(v17) = tmp_15; } } } else { while (true) { if (v3 >= v4) break; tmp_11 = v2; v2 += 1; *(&v12) = *(tmp_11); v1 = v12; if (!v1) break; v19 = v3; v3 = v3 + 1; *(v19) = v1; } } *(v3) = 0; if (!(v0 & 128)) v13 = glob0(&v8, a3, &v5); else v13 = globexp1(&v8, a3, &v5); } return v13; }
openssh-portable
angr_phoenix
static void prepare_terminal_settings(int meta_flag, struct termios oldtio, struct termios *tiop) { int sc; Keymap kmap; _rl_echoing_p = (oldtio.c_lflag & 0000010); _rl_echoctl = (oldtio.c_lflag & 0001000); tiop->c_lflag &= ~(0000002 | 0000010); if ((unsigned char)oldtio.c_cc[4] != (unsigned char)'\0') _rl_eof_char = oldtio.c_cc[4]; if (((tiop->c_cflag & 0000060) == 0000060) || meta_flag) tiop->c_iflag &= ~(0000040 | 0000020); tiop->c_iflag &= ~(0000400 | 0000100); tiop->c_lflag |= 0000001; tiop->c_cc[6] = 1; tiop->c_cc[5] = 0; if ((tiop->c_lflag & 0010000)) { tiop->c_lflag &= ~0010000; oldtio.c_lflag &= ~0010000; } tiop->c_cc[15] = '\0'; kmap = (rl_editing_mode == 0) ? vi_insertion_keymap : _rl_keymap; sc = tiop->c_cc[13]; if (sc != '\0' && kmap[(unsigned char)sc].type == 0) tiop->c_cc[13] = '\0'; }
void prepare_terminal_settings(int param_1, uint *param_2) { undefined *puVar1; undefined8 in_stack_00000010; uint uStack0000000000000014; byte bStack000000000000001d; undefined8 in_stack_00000018; _rl_echoing_p = uStack0000000000000014 & 8; __rl_echoctl = uStack0000000000000014 & 0x200; param_2[3] = param_2[3] & 0xfffffff5; if (bStack000000000000001d != 0) { __rl_eof_char = (uint)bStack000000000000001d; } if (((param_2[2] & 0x30) == 0x30) || (param_1 != 0)) { *param_2 = *param_2 & 0xffffffcf; } *param_2 = *param_2 & 0xfffffebf; param_2[3] = param_2[3] | 1; *(undefined *)((long)param_2 + 0x17) = 1; *(undefined *)((long)param_2 + 0x16) = 0; if ((param_2[3] & 0x1000) != 0) { param_2[3] = param_2[3] & 0xffffefff; } *(undefined *)(param_2 + 8) = 0; puVar1 = _rl_keymap; if (rl_editing_mode == 0) { puVar1 = &vi_insertion_keymap; } if ((*(byte *)((long)param_2 + 0x1e) != 0) && (puVar1[(ulong)(uint) * (byte *)((long)param_2 + 0x1e) * 0x10] == '\0')) { *(undefined *)((long)param_2 + 0x1e) = 0; } return; }
bash
ghidra
static int make_room(struct extent_list *list, int i) { int ret; if (list->count == list->size) { unsigned int new_size = (list->size + 341) * sizeof(struct ext2fs_extent); ret = __errcode_to_errno(ext2fs_resize_mem(0, new_size, &list->extents), __func__, 408); if (ret) return ret; list->size += 341; } memmove(&list->extents[i + 1], &list->extents[i], sizeof(list->extents[0]) * (list->count - i)); list->count++; return 0; }
long make_room(long a1, int a2) { long v2; unsigned int v4; if (*(_DWORD *)(a1 + 16) == *(_DWORD *)(a1 + 20)) { v2 = ext2fs_resize_mem( 0LL, (unsigned int)(24 * *(_DWORD *)(a1 + 20) + 8184), a1 + 8); v4 = _errcode_to_errno(v2, "make_room", 0x198u); if (v4) return v4; *(_DWORD *)(a1 + 20) += 341; } memmove((void *)(*(_QWORD *)(a1 + 8) + 24 * (a2 + 1LL)), (const void *)(24LL * a2 + *(_QWORD *)(a1 + 8)), 24LL * (unsigned int)(*(_DWORD *)(a1 + 16) - a2)); ++*(_DWORD *)(a1 + 16); return 0LL; }
e2fsprogs-1.46.5
ida
void set_force(int flags) { force_flags |= flags; }
void set_force(uint param_1) { force_flags = force_flags | param_1; return; }
dpkg
ghidra
void attrib_to_stat(const Attrib *a, struct stat *st) { memset(st, 0, sizeof(*st)); if (a->flags & 0x00000001) st->st_size = a->size; if (a->flags & 0x00000002) { st->st_uid = a->uid; st->st_gid = a->gid; } if (a->flags & 0x00000004) st->st_mode = a->perm; if (a->flags & 0x00000008) { st->st_atim.tv_sec = a->atime; st->st_mtim.tv_sec = a->mtime; } }
void attrib_to_stat(uint *param_1, void *param_2) { memset(param_2, 0, 0x90); if ((*param_1 & 1) != 0) { *(undefined8 *)((long)param_2 + 0x30) = *(undefined8 *)(param_1 + 2); } if ((*param_1 & 2) != 0) { *(uint *)((long)param_2 + 0x1c) = param_1[4]; *(uint *)((long)param_2 + 0x20) = param_1[5]; } if ((*param_1 & 4) != 0) { *(uint *)((long)param_2 + 0x18) = param_1[6]; } if ((*param_1 & 8) != 0) { *(ulong *)((long)param_2 + 0x48) = (ulong)param_1[7]; *(ulong *)((long)param_2 + 0x58) = (ulong)param_1[8]; } return; }
openssh-portable
ghidra
rsRetVal multiSubmitFlush(multi_submit_t *pMultiSub) { rsRetVal iRet = RS_RET_OK; if (pMultiSub->nElem > 0) { iRet = multiSubmitMsg2(pMultiSub); } return iRet; }
undefined4 multiSubmitFlush(long param_1) { undefined4 local_c; local_c = 0; if (0 < *(short *)(param_1 + 2)) { local_c = multiSubmitMsg2(param_1); } return local_c; }
rsyslog-8.2210.0
ghidra
static void print_context_number_range(struct file_data const *file, lin a, lin b) { printint trans_a, trans_b; translate_range(file, a, b, &trans_a, &trans_b); if (trans_b <= trans_a) fprintf(outfile, "%" "l" "d", trans_b); else fprintf(outfile, "%" "l" "d,%" "l" "d", trans_a, trans_b); }
void print_context_number_range(unsigned long long a0, unsigned long long a1, unsigned long long a2) { char v0; char v1; char v2; unsigned long long *v4; unsigned long long v5; translate_range(a0, a1, a2, &v0, &v1); if (*(&v1) > *(&v0)) fprintf(*(&outfile), "%ld,%ld", *(&v0), *(&v1)); else fprintf(*(&outfile), "%ld", *(&v1)); v5 = *(&v2) ^ v4[5]; return; }
diffutils
angr_sailr
int sh_setlinebuf(stream) FILE *stream; { char *local_linebuf; if (stream == stdout && stdoutbuf == 0) local_linebuf = stdoutbuf = (char *)sh_xmalloc((2016), "setlinebuf.c", 50); else if (stream == stderr && stderrbuf == 0) local_linebuf = stderrbuf = (char *)sh_xmalloc((2016), "setlinebuf.c", 52); else local_linebuf = (char *)((void *)0); return (setvbuf(stream, local_linebuf, 1, 2016)); }
long long sh_setlinebuf(void *a0) { void *v0; if (a0 == stdout && !stdoutbuf) { stdoutbuf = sh_xmalloc(0x7e0, "setlinebuf.c", 0x32); v0 = stdoutbuf; } if (stdoutbuf || a0 != stdout) { if (a0 == stderr && !stderrbuf) { stderrbuf = sh_xmalloc(0x7e0, "setlinebuf.c", 0x34); v0 = stderrbuf; } if (a0 != stderr || stderrbuf) v0 = 0; } return setvbuf(a0, v0, 0x1, 0x7e0); }
bash
angr_dream
static int process_bad_block(ext2_filsys fs, blk64_t *block_nr, e2_blkcnt_t blockcnt, blk64_t ref_block __attribute__((unused)), int ref_offset __attribute__((unused)), void *priv_data) { struct process_block_struct *p; blk64_t blk = *block_nr; blk64_t first_block; dgrp_t i; struct problem_context *pctx; e2fsck_t ctx; if (!blk) return 0; p = (struct process_block_struct *)priv_data; ctx = p->ctx; pctx = p->pctx; pctx->ino = 1; pctx->blk = blk; pctx->blkcount = blockcnt; if ((blk < fs->super->s_first_data_block) || (blk >= ext2fs_blocks_count(fs->super))) { if (fix_problem(ctx, 0x010012, pctx)) { *block_nr = 0; return 1; } else return 0; } if (blockcnt < 0) { if (ext2fs_test_block_bitmap2(p->fs_meta_blocks, blk)) { p->bbcheck = 1; if (fix_problem(ctx, 0x01004D, pctx)) { *block_nr = 0; return 1; } } else if (ext2fs_test_block_bitmap2(ctx->block_found_map, blk)) { p->bbcheck = 1; if (fix_problem(ctx, 0x010015, pctx)) { *block_nr = 0; return 1; } if (ctx->flags & (0x0001 | 0x0002)) return 2; } else mark_block_used(ctx, blk); return 0; } ctx->fs_badblocks_count++; if (!ext2fs_test_block_bitmap2(ctx->block_found_map, blk)) { ext2fs_mark_block_bitmap2(ctx->block_found_map, blk); return 0; } first_block = fs->super->s_first_data_block; for (i = 0; i < fs->group_desc_count; i++) { pctx->group = i; pctx->blk = blk; if (!ext2fs_bg_has_super(fs, i)) goto skip_super; if (blk == first_block) { if (i == 0) { if (fix_problem(ctx, 0x010019, pctx)) { *block_nr = 0; return 1; } return 0; } fix_problem(ctx, 0x01001B, pctx); return 0; } if ((blk > first_block) && (blk <= first_block + fs->desc_blocks)) { if (i == 0) { pctx->blk = *block_nr; if (fix_problem(ctx, 0x01001A, pctx)) { *block_nr = 0; return 1; } return 0; } fix_problem(ctx, 0x01001C, pctx); return 0; } skip_super: if (blk == ext2fs_block_bitmap_loc(fs, i)) { if (fix_problem(ctx, 0x01000A, pctx)) { ctx->invalid_block_bitmap_flag[i]++; ctx->invalid_bitmaps++; } return 0; } if (blk == ext2fs_inode_bitmap_loc(fs, i)) { if (fix_problem(ctx, 0x01000B, pctx)) { ctx->invalid_inode_bitmap_flag[i]++; ctx->invalid_bitmaps++; } return 0; } if ((blk >= ext2fs_inode_table_loc(fs, i)) && (blk < (ext2fs_inode_table_loc(fs, i) + fs->inode_blocks_per_group))) { return 0; } first_block += fs->super->s_blocks_per_group; } if ((blk == p->inode->i_block[12]) || (blk == p->inode->i_block[(12 + 1)]) || (blk == p->inode->i_block[((12 + 1) + 1)])) { p->bbcheck = 1; if (fix_problem(ctx, 0x010015, pctx)) { *block_nr = 0; return 1; } if (ctx->flags & (0x0001 | 0x0002)) return 2; return 0; } pctx->group = -1; fix_problem(ctx, 0x01001D, pctx); return 0; }
long long process_bad_block(struct_2 *a0, unsigned long long *a1, unsigned long a2, unsigned long a3, unsigned long a4, struct_0 *a5) { unsigned int v0; unsigned long v1; unsigned int v2; unsigned long v3; unsigned long long v4; struct_5 *v5; struct_4 *v6; unsigned long long v8; v1 = a3; v0 = a4; v4 = *(a1); if (!v4) { v8 = 0; } else { v5 = a5->field_58; v6 = a5->field_48; v6->field_8 = 1; v6->field_28 = v4; v6->field_38 = a2; if (v4 < a0->field_20->field_14) { LABEL_40ad8a: if (!fix_problem(v5, 0x10012, v6)) { v8 = 0; } else { *(a1) = 0; v8 = 1; } } else { if (!(v4 < ext2fs_blocks_count(a0->field_20))) goto LABEL_40ad8a; if (!((a2 - 0 >> 63))) { v5->field_304 = v5->field_304 + 1; if (!ext2fs_test_block_bitmap2(v5->field_1a0, v4, v4)) { ext2fs_mark_block_bitmap2(v5->field_1a0, v4, v4); v8 = 0; } else { v3 = a0->field_20->field_14; v2 = 0; while (true) { if (v2 >= a0->field_30) { if (v4 != a5->field_40->field_58 && v4 != a5->field_40->field_5c && v4 != a5->field_40->field_60) { v6->field_40 = -1; fix_problem(v5, 0x1001d, v6); v8 = 0; break; } a5->field_4 = a5->field_4 | 64; if (fix_problem(v5, 0x10015, v6)) { *(a1) = 0; v8 = 1; break; } else if (!(v5->field_48 & 3)) { v8 = 0; break; } else { v8 = 2; break; } } else { v6->field_40 = v2; v6->field_28 = v4; if (ext2fs_bg_has_super(a0, v2, v2)) { if (v4 == v3) { if (v2) { fix_problem(v5, 0x1001b, v6); v8 = 0; break; } else if (!fix_problem(v5, 0x10019, v6)) { v8 = 0; break; } else { *(a1) = 0; v8 = 1; break; } } else { if (v4 > v3 && v4 <= v3 + a0->field_38) { if (v2) { fix_problem(v5, 0x1001c, v6); v8 = 0; break; } else { v6->field_28 = *(a1); if (fix_problem(v5, 0x1001a, v6)) { *(a1) = 0; v8 = 1; break; } else { v8 = 0; break; } } } } } if (v4 == ext2fs_block_bitmap_loc(a0, v2, v2)) { if (fix_problem(v5, 0x1000a, v6)) { *((v5->field_1f8 + v2 * 4)) = *((v5->field_1f8 + v2 * 4)) + 1; v5->field_208 = v5->field_208 + 1; } v8 = 0; break; } else if (v4 == ext2fs_inode_bitmap_loc(a0, v2, v2)) { if (fix_problem(v5, 0x1000b, v6)) { *((v5->field_1f0 + v2 * 4)) = *((v5->field_1f0 + v2 * 4)) + 1; v5->field_208 = v5->field_208 + 1; } v8 = 0; break; } else { if (v4 >= ext2fs_inode_table_loc(a0, v2, v2) && v4 < ext2fs_inode_table_loc(a0, v2, v2) + a0->field_48) { v8 = 0; break; } v3 += a0->field_20->field_20; v2 += 1; } } } } } else { if (ext2fs_test_block_bitmap2(a5->field_50, v4, v4)) { a5->field_4 = a5->field_4 | 64; if (fix_problem(v5, 0x1004d, v6)) { *(a1) = 0; v8 = 1; goto LABEL_40b24c; } } else if (!ext2fs_test_block_bitmap2(v5->field_1a0, v4, v4)) { mark_block_used(v5, v4); } else { a5->field_4 = a5->field_4 | 64; if (fix_problem(v5, 0x10015, v6)) { *(a1) = 0; v8 = 1; goto LABEL_40b24c; } if ((v5->field_48 & 3)) { v8 = 2; goto LABEL_40b24c; } } v8 = 0; } } } LABEL_40b24c: return v8; }
e2fsprogs-1.46.5
angr_phoenix
void assign_string_n(char **string, const char *value, size_t n) { free(*string); if (value) { size_t l = strnlen(value, n); char *p = xmalloc(l + 1); memcpy(p, value, l); p[l] = 0; *string = p; } }
long long assign_string_n(unsigned long long *a0, void *a1, unsigned int a2) { char *v0; char *v1; unsigned long long *v3; v3 = free(*(a0)); if (a1) { v0 = strnlen(a1, a2); v1 = xmalloc(v0 + 1); memcpy(v1, a1, v0); *((v0 + v1)) = 0; v3 = a0; *(a0) = v1; } return v3; }
tar
angr_phoenix
void channel_update_permission(struct ssh *ssh, int idx, int newport) { struct permission_set *pset = &ssh->chanctxt->local_perms; if (idx < 0 || (u_int)idx >= pset->num_permitted_user) { sshlog("channels.c", __func__, 4354, 1, SYSLOG_LEVEL_DEBUG1, ((void *)0), "index out of range: %d num_permitted_user %d", idx, pset->num_permitted_user); return; } sshlog("channels.c", __func__, 4358, 0, SYSLOG_LEVEL_DEBUG1, ((void *)0), "%s allowed port %d for forwarding to host %s port %d", newport > 0 ? "Updating" : "Removing", newport, pset->permitted_user[idx].host_to_connect, pset->permitted_user[idx].port_to_connect) ; if (newport <= 0) fwd_perm_clear(&pset->permitted_user[idx]); else { pset->permitted_user[idx].listen_port = (ssh->compat & 0x08000000) ? 0 : newport; } }
long long channel_update_permission(struct_0 *a0, unsigned long a1, unsigned long a2) { unsigned long long v0; unsigned long v1; unsigned long v2; struct_3 *v3; unsigned long long v5; unsigned long long v6; unsigned int v7; v3 = a0->field_868 + 32; if (a1 >= 0 && v3->field_0 > a1) { if (a2 > 0) v6 = "Updating"; else v6 = "Removing"; v2 = *((a1 * 48 + v3->field_8 + 8)); v1 = *((a1 * 48 + v3->field_8)); v0 = v6; sshlog("channels.c", "channel_update_permission", 0x1106, 0x0, 0x5, 0x0, "%s allowed port %d for forwarding to host %s port %d"); if (a2 <= 0) { v5 = fwd_perm_clear(a1 * 48 + v3->field_8); } else { if (!(a0->field_83c & 0x8000000)) v7 = a2; else v7 = 0; v5 = a1 * 48 + v3->field_8; *((a1 * 48 + v3->field_8 + 32)) = v7; } } if (a1 < 0 || v3->field_0 <= a1) { v2 = v3->field_0; v1 = a1; v5 = sshlog("channels.c", "channel_update_permission", 0x1102, 0x1, 0x5, 0x0, "index out of range: %d num_permitted_user %d"); } return v5; }
openssh-portable
angr_dream
void usage(int status) { if (status != 0) do { fprintf(stderr, gettext("Try '%s --help' for more information.\n"), program_name); } while (0); else { printf(gettext("Usage: %s [OPTION]... [+FORMAT]\n or: %s " "[-u|--utc|--universal] [MMDDhhmm[[CC]YY][.ss]]\n") , program_name, program_name); fputs_unlocked( gettext("Display date and time in the given FORMAT.\nWith -s, or with " "[MMDDhhmm[[CC]YY][.ss]], set the date and time.\n"), stdout) ; emit_mandatory_arg_note(); fputs_unlocked(gettext(" -d, --date=STRING display time " "described by STRING, not 'now'\n"), stdout) ; fputs_unlocked(gettext(" --debug annotate the parsed " "date,\n and warn " "about questionable usage to stderr\n"), stdout) ; fputs_unlocked(gettext(" -f, --file=DATEFILE like --date; once for " "each line of DATEFILE\n"), stdout) ; fputs_unlocked( gettext(" -I[FMT], --iso-8601[=FMT] output date/time in ISO 8601 " "format.\n FMT='date' for date " "only (the default),\n 'hours', " "'minutes', 'seconds', or 'ns'\n " "for date and time to the indicated precision.\n " " Example: 2006-08-14T02:34:56-06:00\n"), stdout) ; fputs_unlocked(gettext(" --resolution output the available " "resolution of timestamps\n " " Example: 0.000000001\n"), stdout) ; fputs_unlocked(gettext(" -R, --rfc-email output date and time " "in RFC 5322 format.\n " " Example: Mon, 14 Aug 2006 02:34:56 -0600\n"), stdout) ; fputs_unlocked( gettext(" --rfc-3339=FMT output date/time in RFC 3339 " "format.\n FMT='date', " "'seconds', or 'ns'\n for date " "and time to the indicated precision.\n " " Example: 2006-08-14 02:34:56-06:00\n"), stdout) ; fputs_unlocked(gettext(" -r, --reference=FILE display the last " "modification time of FILE\n"), stdout) ; fputs_unlocked(gettext(" -s, --set=STRING set time described by " "STRING\n -u, --utc, --universal print or set " "Coordinated Universal Time (UTC)\n"), stdout) ; fputs_unlocked(gettext(" --help display this help and exit\n"), stdout); fputs_unlocked( gettext(" --version output version information and exit\n"), stdout); fputs_unlocked(gettext("\nFORMAT controls the output. Interpreted " "sequences are:\n\n %% a literal %\n %a " "locale's abbreviated weekday name (e.g., Sun)\n"), stdout) ; fputs_unlocked( gettext(" %A locale's full weekday name (e.g., Sunday)\n %b " "locale's abbreviated month name (e.g., Jan)\n %B locale's " "full month name (e.g., January)\n %c locale's date and " "time (e.g., Thu Mar 3 23:05:25 2005)\n"), stdout) ; fputs_unlocked( gettext(" %C century; like %Y, except omit last two digits (e.g., " "20)\n %d day of month (e.g., 01)\n %D date; same as " "%m/%d/%y\n %e day of month, space padded; same as %_d\n"), stdout) ; fputs_unlocked( gettext(" %F full date; like %+4Y-%m-%d\n %g last two digits of " "year of ISO week number (see %G)\n %G year of ISO week " "number (see %V); normally useful only with %V\n"), stdout) ; fputs_unlocked(gettext(" %h same as %b\n %H hour (00..23)\n %I " "hour (01..12)\n %j day of year (001..366)\n"), stdout) ; fputs_unlocked(gettext(" %k hour, space padded ( 0..23); same as %_H\n " "%l hour, space padded ( 1..12); same as %_I\n " "%m month (01..12)\n %M minute (00..59)\n"), stdout) ; fputs_unlocked( gettext(" %n a newline\n %N nanoseconds (000000000..999999999)\n " " %p locale's equivalent of either AM or PM; blank if not " "known\n %P like %p, but lower case\n %q quarter of year " "(1..4)\n %r locale's 12-hour clock time (e.g., 11:11:04 " "PM)\n %R 24-hour hour and minute; same as %H:%M\n %s " "seconds since the Epoch (1970-01-01 00:00 UTC)\n"), stdout); fputs_unlocked( gettext(" %S second (00..60)\n %t a tab\n %T time; same as " "%H:%M:%S\n %u day of week (1..7); 1 is Monday\n"), stdout) ; fputs_unlocked( gettext( " %U week number of year, with Sunday as first day of week " "(00..53)\n %V ISO week number, with Monday as first day of " "week (01..53)\n %w day of week (0..6); 0 is Sunday\n %W " "week number of year, with Monday as first day of week (00..53)\n"), stdout) ; fputs_unlocked( gettext(" %x locale's date representation (e.g., 12/31/99)\n %X " "locale's time representation (e.g., 23:13:48)\n %y last " "two digits of year (00..99)\n %Y year\n"), stdout) ; fputs_unlocked( gettext(" %z +hhmm numeric time zone (e.g., -0400)\n %:z +hh:mm " "numeric time zone (e.g., -04:00)\n %::z +hh:mm:ss numeric " "time zone (e.g., -04:00:00)\n %:::z numeric time zone with " ": to necessary precision (e.g., -04, +05:30)\n %Z " "alphabetic time zone abbreviation (e.g., EDT)\n\nBy default, " "date pads numeric fields with zeroes.\n"), stdout) ; fputs_unlocked( gettext("The following optional flags may follow '%':\n\n - (hyphen) " "do not pad the field\n _ (underscore) pad with spaces\n 0 " "(zero) pad with zeros\n + pad with zeros, and put '+' " "before future years with >4 digits\n ^ use upper case if " "possible\n # use opposite case if possible\n"), stdout); fputs_unlocked( gettext("\nAfter any flags comes an optional field width, as a decimal " "number;\nthen an optional modifier, which is either\nE to use " "the locale's alternate representations if available, or\nO to " "use the locale's alternate numeric symbols if available.\n"), stdout) ; fputs_unlocked( gettext("\nExamples:\nConvert seconds since the Epoch (1970-01-01 UTC) " "to a date\n $ date --date='@2147483647'\n\nShow the time on " "the west coast of the US (use tzselect(1) to find TZ)\n $ " "TZ='America/Los_Angeles' date\n\nShow the local time for 9AM " "next Friday on the west coast of the US\n $ date " "--date='TZ=\"America/Los_Angeles\" 09:00 next Fri'\n"), stdout); emit_ancillary_info("date"); } exit(status); }
void usage(unsigned long a0) { unsigned long v0; unsigned long v1; unsigned long v3; unsigned long v4; v1 = v3; v0 = v4; if (a0) { fprintf(stderr, gettext("Try '%s --help' for more information.\n")); } else { printf(gettext("Usage: %s [OPTION]... [+FORMAT]\n or: %s " "[-u|--utc|--universal] [MMDDhhmm[[CC]YY][.ss]]\n")); fputs_unlocked( gettext("Display date and time in the given FORMAT.\nWith -s, or with " "[MMDDhhmm[[CC]YY][.ss]], set the date and time.\n"), stdout); emit_mandatory_arg_note(); fputs_unlocked(gettext(" -d, --date=STRING display time " "described by STRING, not 'now'\n"), stdout); fputs_unlocked(gettext(" --debug annotate the parsed " "date,\n and warn " "about questionable usage to stderr\n"), stdout); fputs_unlocked(gettext(" -f, --file=DATEFILE like --date; once for " "each line of DATEFILE\n"), stdout); fputs_unlocked( gettext(" -I[FMT], --iso-8601[=FMT] output date/time in ISO 8601 " "format.\n FMT='date' for date " "only (the default),\n 'hours', " "'minutes', 'seconds', or 'ns'\n " "for date and time to the indicated precision.\n " " Example: 2006-08-14T02:34:56-06:00\n"), stdout); fputs_unlocked(gettext(" --resolution output the available " "resolution of timestamps\n " " Example: 0.000000001\n"), stdout); fputs_unlocked(gettext(" -R, --rfc-email output date and time " "in RFC 5322 format.\n " " Example: Mon, 14 Aug 2006 02:34:56 -0600\n"), stdout); fputs_unlocked( gettext(" --rfc-3339=FMT output date/time in RFC 3339 " "format.\n FMT='date', " "'seconds', or 'ns'\n for date " "and time to the indicated precision.\n " " Example: 2006-08-14 02:34:56-06:00\n"), stdout); fputs_unlocked(gettext(" -r, --reference=FILE display the last " "modification time of FILE\n"), stdout); fputs_unlocked(gettext(" -s, --set=STRING set time described by " "STRING\n -u, --utc, --universal print or set " "Coordinated Universal Time (UTC)\n"), stdout); fputs_unlocked(gettext(" --help display this help and exit\n"), stdout); fputs_unlocked( gettext(" --version output version information and exit\n"), stdout); fputs_unlocked(gettext("\nFORMAT controls the output. Interpreted " "sequences are:\n\n %% a literal %\n %a " "locale's abbreviated weekday name (e.g., Sun)\n"), stdout); fputs_unlocked( gettext(" %A locale's full weekday name (e.g., Sunday)\n %b " "locale's abbreviated month name (e.g., Jan)\n %B locale's " "full month name (e.g., January)\n %c locale's date and " "time (e.g., Thu Mar 3 23:05:25 2005)\n"), stdout); fputs_unlocked( gettext(" %C century; like %Y, except omit last two digits (e.g., " "20)\n %d day of month (e.g., 01)\n %D date; same as " "%m/%d/%y\n %e day of month, space padded; same as %_d\n"), stdout); fputs_unlocked( gettext(" %F full date; like %+4Y-%m-%d\n %g last two digits of " "year of ISO week number (see %G)\n %G year of ISO week " "number (see %V); normally useful only with %V\n"), stdout); fputs_unlocked(gettext(" %h same as %b\n %H hour (00..23)\n %I " "hour (01..12)\n %j day of year (001..366)\n"), stdout); fputs_unlocked(gettext(" %k hour, space padded ( 0..23); same as %_H\n " "%l hour, space padded ( 1..12); same as %_I\n " "%m month (01..12)\n %M minute (00..59)\n"), stdout); fputs_unlocked( gettext(" %n a newline\n %N nanoseconds (000000000..999999999)\n " " %p locale's equivalent of either AM or PM; blank if not " "known\n %P like %p, but lower case\n %q quarter of year " "(1..4)\n %r locale's 12-hour clock time (e.g., 11:11:04 " "PM)\n %R 24-hour hour and minute; same as %H:%M\n %s " "seconds since the Epoch (1970-01-01 00:00 UTC)\n"), stdout); fputs_unlocked( gettext(" %S second (00..60)\n %t a tab\n %T time; same as " "%H:%M:%S\n %u day of week (1..7); 1 is Monday\n"), stdout); fputs_unlocked( gettext( " %U week number of year, with Sunday as first day of week " "(00..53)\n %V ISO week number, with Monday as first day of " "week (01..53)\n %w day of week (0..6); 0 is Sunday\n %W " "week number of year, with Monday as first day of week (00..53)\n"), stdout); fputs_unlocked( gettext(" %x locale's date representation (e.g., 12/31/99)\n %X " "locale's time representation (e.g., 23:13:48)\n %y last " "two digits of year (00..99)\n %Y year\n"), stdout); fputs_unlocked( gettext(" %z +hhmm numeric time zone (e.g., -0400)\n %:z +hh:mm " "numeric time zone (e.g., -04:00)\n %::z +hh:mm:ss numeric " "time zone (e.g., -04:00:00)\n %:::z numeric time zone with " ": to necessary precision (e.g., -04, +05:30)\n %Z " "alphabetic time zone abbreviation (e.g., EDT)\n\nBy default, " "date pads numeric fields with zeroes.\n"), stdout); fputs_unlocked( gettext("The following optional flags may follow '%':\n\n - (hyphen) " "do not pad the field\n _ (underscore) pad with spaces\n 0 " "(zero) pad with zeros\n + pad with zeros, and put '+' " "before future years with >4 digits\n ^ use upper case if " "possible\n # use opposite case if possible\n"), stdout); fputs_unlocked( gettext("\nAfter any flags comes an optional field width, as a decimal " "number;\nthen an optional modifier, which is either\nE to use " "the locale's alternate representations if available, or\nO to " "use the locale's alternate numeric symbols if available.\n"), stdout); fputs_unlocked( gettext("\nExamples:\nConvert seconds since the Epoch (1970-01-01 UTC) " "to a date\n $ date --date=\'@2147483647\'\n\nShow the time " "on the west coast of the US (use tzselect(1) to find TZ)\n $ " "TZ=\'America/Los_Angeles\' date\n\nShow the local time for " "9AM next Friday on the west coast of the US\n $ date " "--date=\'TZ=\"America/Los_Angeles\" 09:00 next Fri\'\n"), stdout); emit_ancillary_info("date"); } exit(a0); }
coreutils
angr_phoenix
static Channel *client_request_forwarded_tcpip(struct ssh *ssh, const char *request_type, int rchan, u_int rwindow, u_int rmaxpack) { Channel *c = ((void *)0); struct sshbuf *b = ((void *)0); char *listen_address, *originator_address; u_int listen_port, originator_port; int r; if ((r = sshpkt_get_cstring(ssh, &listen_address, ((void *)0))) != 0 || (r = sshpkt_get_u32(ssh, &listen_port)) != 0 || (r = sshpkt_get_cstring(ssh, &originator_address, ((void *)0))) != 0 || (r = sshpkt_get_u32(ssh, &originator_port)) != 0 || (r = sshpkt_get_end(ssh)) != 0) sshfatal("clientloop.c", __func__, 1476, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "parse packet"); sshlog("clientloop.c", __func__, 1478, 1, SYSLOG_LEVEL_DEBUG1, ((void *)0), "listen %s port %d, originator %s port %d", listen_address, listen_port, originator_address, originator_port); if (listen_port > 0xffff) sshlog("clientloop.c", __func__, 1482, 1, SYSLOG_LEVEL_ERROR, ((void *)0), "invalid listen port"); else if (originator_port > 0xffff) sshlog("clientloop.c", __func__, 1484, 1, SYSLOG_LEVEL_ERROR, ((void *)0), "invalid originator port"); else { c = channel_connect_by_listen_address(ssh, listen_address, listen_port, "forwarded-tcpip", originator_address); } if (c != ((void *)0) && c->type == 16) { if ((b = sshbuf_new()) == ((void *)0)) { sshlog("clientloop.c", __func__, 1493, 1, SYSLOG_LEVEL_ERROR, ((void *)0), "alloc reply"); goto out; } if ((r = sshbuf_put_u8(b, 0)) != 0 || (r = sshbuf_put_u8(b, 90)) != 0 || (r = sshbuf_put_cstring(b, request_type)) != 0 || (r = sshbuf_put_u32(b, rchan)) != 0 || (r = sshbuf_put_u32(b, rwindow)) != 0 || (r = sshbuf_put_u32(b, rmaxpack)) != 0 || (r = sshbuf_put_cstring(b, listen_address)) != 0 || (r = sshbuf_put_u32(b, listen_port)) != 0 || (r = sshbuf_put_cstring(b, originator_address)) != 0 || (r = sshbuf_put_u32(b, originator_port)) != 0 || (r = sshbuf_put_stringb(c->output, b)) != 0) { sshlog("clientloop.c", __func__, 1508, 1, SYSLOG_LEVEL_ERROR, ssh_err(r), "compose for muxclient"); goto out; } } out: sshbuf_free(b); free(originator_address); free(listen_address); return c; }
int client_request_forwarded_tcpip(unsigned long long a0, unsigned long long a1, unsigned long long a2, unsigned long long a3, unsigned long long a4) { unsigned long long v0; char v1; char v2; unsigned int v3; char v4; unsigned long long v5; struct_0 *v6; unsigned long long v7; unsigned long long v8; v6 = 0; v7 = 0; v3 = sshpkt_get_cstring(a0, &v4, 0x0, &v4); if (!v3) { v3 = sshpkt_get_u32(a0, &v1, &v1); if (!v3) { v3 = sshpkt_get_cstring(a0, &v5, 0x0, &v5); if (!v3) { v3 = sshpkt_get_u32(a0, &v2, &v2); if (!v3) { v3 = sshpkt_get_end(a0); if (!v3) goto LABEL_403d50; } } } } v0 = "parse packet"; sshfatal("clientloop.c", "client_request_forwarded_tcpip", 0x5c4, 0x1, 0x1, ssh_err(v3)); LABEL_403d50: v8 = *(&v2); v7 = *(&v5); v6 = *(&v1); v5 = *(&v4); v4 = "listen %s port %d, originator %s port %d"; sshlog("clientloop.c", "client_request_forwarded_tcpip", 0x5c6, 0x1, 0x5, 0x0); if (*(&v1) > 65535) { v8 = "invalid listen port"; sshlog("clientloop.c", "client_request_forwarded_tcpip", 0x5ca, 0x1, 0x2, 0x0); } else if (*(&v2) > 65535) { v8 = "invalid originator port"; sshlog("clientloop.c", "client_request_forwarded_tcpip", 0x5cc, 0x1, 0x2, 0x0); } else { v6 = channel_connect_by_listen_address(a0, v4, *(&v1), "forwarded-tcpip", v5); } if (!v6) { LABEL_404052: } else { if (!(v6->field_0 == 16)) goto LABEL_404052; v7 = sshbuf_new(a0, a1, a2, a3, a4, 0x0); if (!v7) { v8 = "alloc reply"; sshlog("clientloop.c", "client_request_forwarded_tcpip", 0x5d5, 0x1, 0x2, 0x0); goto LABEL_404053; } v3 = sshbuf_put_u8(v7, 0x0); if (!v3) { v3 = sshbuf_put_u8(v7, 0x5a); if (!v3) { v3 = sshbuf_put_cstring(v7, a1, a1); if (!v3) { v3 = sshbuf_put_u32(v7, a2, a2); if (!v3) { v3 = sshbuf_put_u32(v7, a3, a3); if (!v3) { v3 = sshbuf_put_u32(v7, a4, a4); if (!v3) { v3 = sshbuf_put_cstring(v7, v4, v4); if (!v3) { v3 = sshbuf_put_u32(v7, *(&v1), *(&v1)); if (!v3) { v3 = sshbuf_put_cstring(v7, v5, v5); if (!v3) { v3 = sshbuf_put_u32(v7, *(&v2), *(&v2)); if (!v3) { v3 = sshbuf_put_stringb(v6->field_70, v7, v7); if (!(!v3)) goto LABEL_40400b; goto LABEL_404052; } } } } } } } } } } LABEL_40400b: v8 = "compose for muxclient"; sshlog("clientloop.c", "client_request_forwarded_tcpip", 0x5e4, 0x1, 0x2, ssh_err(v3)); } LABEL_404053: sshbuf_free(v7); free(v5); free(v4); return v6; }
openssh-portable
angr_phoenix
int printf_parse(const char *format, char_directives *d, arguments *a) { const char *cp = format; size_t arg_posn = 0; size_t d_allocated; size_t a_allocated; size_t max_width_length = 0; size_t max_precision_length = 0; d->count = 0; d_allocated = 7; d->dir = d->direct_alloc_dir; a->count = 0; a_allocated = 7; a->arg = a->direct_alloc_arg; while (*cp != '\0') { char c = *cp++; if (c == '%') { size_t arg_index = (~(size_t)0); char_directive *dp = &d->dir[d->count]; dp->dir_start = cp - 1; dp->flags = 0; dp->width_start = ((void *)0); dp->width_end = ((void *)0); dp->width_arg_index = (~(size_t)0); dp->precision_start = ((void *)0); dp->precision_end = ((void *)0); dp->precision_arg_index = (~(size_t)0); dp->arg_index = (~(size_t)0); if (*cp >= '0' && *cp <= '9') { const char *np; for (np = cp; *np >= '0' && *np <= '9'; np++) ; if (*np == '$') { size_t n = 0; for (np = cp; *np >= '0' && *np <= '9'; np++) n = xsum(((n) <= (18446744073709551615UL) / (10) ? (size_t)(n) * (10) : (18446744073709551615UL)), *np - '0'); if (n == 0) goto error; if (((n) == (18446744073709551615UL))) goto error; arg_index = n - 1; cp = np + 1; } } for (;;) { if (*cp == '\'') { dp->flags |= 1; cp++; } else if (*cp == '-') { dp->flags |= 2; cp++; } else if (*cp == '+') { dp->flags |= 4; cp++; } else if (*cp == ' ') { dp->flags |= 8; cp++; } else if (*cp == '#') { dp->flags |= 16; cp++; } else if (*cp == '0') { dp->flags |= 32; cp++; } else if (*cp == 'I') { dp->flags |= 64; cp++; } else break; } if (*cp == '*') { dp->width_start = cp; cp++; dp->width_end = cp; if (max_width_length < 1) max_width_length = 1; if (*cp >= '0' && *cp <= '9') { const char *np; for (np = cp; *np >= '0' && *np <= '9'; np++) ; if (*np == '$') { size_t n = 0; for (np = cp; *np >= '0' && *np <= '9'; np++) n = xsum(((n) <= (18446744073709551615UL) / (10) ? (size_t)(n) * (10) : (18446744073709551615UL)), *np - '0'); if (n == 0) goto error; if (((n) == (18446744073709551615UL))) goto error; dp->width_arg_index = n - 1; cp = np + 1; } } if (dp->width_arg_index == (~(size_t)0)) { dp->width_arg_index = arg_posn++; if (dp->width_arg_index == (~(size_t)0)) goto error; } { size_t n = (dp->width_arg_index); if (n >= a_allocated) { size_t memory_size; argument *memory; a_allocated = ((a_allocated) <= (18446744073709551615UL) / (2) ? (size_t)(a_allocated) * (2) : (18446744073709551615UL)); if (a_allocated <= n) a_allocated = xsum(n, 1); memory_size = ((a_allocated) <= (18446744073709551615UL) / (sizeof(argument)) ? (size_t)(a_allocated) * (sizeof(argument)) : (18446744073709551615UL)); if (((memory_size) == (18446744073709551615UL))) goto out_of_memory; memory = (argument *)(a->arg != a->direct_alloc_arg ? realloc(a->arg, memory_size) : malloc(memory_size)); if (memory == ((void *)0)) goto out_of_memory; if (a->arg == a->direct_alloc_arg) memcpy(memory, a->arg, a->count * sizeof(argument)); a->arg = memory; } while (a->count <= n) a->arg[a->count++].type = TYPE_NONE; if (a->arg[n].type == TYPE_NONE) a->arg[n].type = (TYPE_INT); else if (a->arg[n].type != (TYPE_INT)) goto error; }; } else if (*cp >= '0' && *cp <= '9') { size_t width_length; dp->width_start = cp; for (; *cp >= '0' && *cp <= '9'; cp++) ; dp->width_end = cp; width_length = dp->width_end - dp->width_start; if (max_width_length < width_length) max_width_length = width_length; } if (*cp == '.') { cp++; if (*cp == '*') { dp->precision_start = cp - 1; cp++; dp->precision_end = cp; if (max_precision_length < 2) max_precision_length = 2; if (*cp >= '0' && *cp <= '9') { const char *np; for (np = cp; *np >= '0' && *np <= '9'; np++) ; if (*np == '$') { size_t n = 0; for (np = cp; *np >= '0' && *np <= '9'; np++) n = xsum(((n) <= (18446744073709551615UL) / (10) ? (size_t)(n) * (10) : (18446744073709551615UL)), *np - '0'); if (n == 0) goto error; if (((n) == (18446744073709551615UL))) goto error; dp->precision_arg_index = n - 1; cp = np + 1; } } if (dp->precision_arg_index == (~(size_t)0)) { dp->precision_arg_index = arg_posn++; if (dp->precision_arg_index == (~(size_t)0)) goto error; } { size_t n = (dp->precision_arg_index); if (n >= a_allocated) { size_t memory_size; argument *memory; a_allocated = ((a_allocated) <= (18446744073709551615UL) / (2) ? (size_t)(a_allocated) * (2) : (18446744073709551615UL)); if (a_allocated <= n) a_allocated = xsum(n, 1); memory_size = ((a_allocated) <= (18446744073709551615UL) / (sizeof(argument)) ? (size_t)(a_allocated) * (sizeof(argument)) : (18446744073709551615UL)); if (((memory_size) == (18446744073709551615UL))) goto out_of_memory; memory = (argument *)(a->arg != a->direct_alloc_arg ? realloc(a->arg, memory_size) : malloc(memory_size)); if (memory == ((void *)0)) goto out_of_memory; if (a->arg == a->direct_alloc_arg) memcpy(memory, a->arg, a->count * sizeof(argument)); a->arg = memory; } while (a->count <= n) a->arg[a->count++].type = TYPE_NONE; if (a->arg[n].type == TYPE_NONE) a->arg[n].type = (TYPE_INT); else if (a->arg[n].type != (TYPE_INT)) goto error; }; } else { size_t precision_length; dp->precision_start = cp - 1; for (; *cp >= '0' && *cp <= '9'; cp++) ; dp->precision_end = cp; precision_length = dp->precision_end - dp->precision_start; if (max_precision_length < precision_length) max_precision_length = precision_length; } } { arg_type type; { int flags = 0; for (;;) { if (*cp == 'h') { flags |= (1 << (flags & 1)); cp++; } else if (*cp == 'L') { flags |= 4; cp++; } else if (*cp == 'l') { flags += 8; cp++; } else if (*cp == 'j') { if (sizeof(intmax_t) > sizeof(long)) { flags += 16; } else if (sizeof(intmax_t) > sizeof(int)) { flags += 8; } cp++; } else if (*cp == 'z' || *cp == 'Z') { if (sizeof(size_t) > sizeof(long)) { flags += 16; } else if (sizeof(size_t) > sizeof(int)) { flags += 8; } cp++; } else if (*cp == 't') { if (sizeof(ptrdiff_t) > sizeof(long)) { flags += 16; } else if (sizeof(ptrdiff_t) > sizeof(int)) { flags += 8; } cp++; } else break; } c = *cp++; switch (c) { case 'd': case 'i': if (flags >= 16 || (flags & 4)) type = TYPE_LONGLONGINT; else if (flags >= 8) type = TYPE_LONGINT; else if (flags & 2) type = TYPE_SCHAR; else if (flags & 1) type = TYPE_SHORT; else type = TYPE_INT; break; case 'o': case 'u': case 'x': case 'X': if (flags >= 16 || (flags & 4)) type = TYPE_ULONGLONGINT; else if (flags >= 8) type = TYPE_ULONGINT; else if (flags & 2) type = TYPE_UCHAR; else if (flags & 1) type = TYPE_USHORT; else type = TYPE_UINT; break; case 'f': case 'F': case 'e': case 'E': case 'g': case 'G': case 'a': case 'A': if (flags >= 16 || (flags & 4)) type = TYPE_LONGDOUBLE; else type = TYPE_DOUBLE; break; case 'c': if (flags >= 8) type = TYPE_WIDE_CHAR; else type = TYPE_CHAR; break; case 'C': type = TYPE_WIDE_CHAR; c = 'c'; break; case 's': if (flags >= 8) type = TYPE_WIDE_STRING; else type = TYPE_STRING; break; case 'S': type = TYPE_WIDE_STRING; c = 's'; break; case 'p': type = TYPE_POINTER; break; case 'n': if (flags >= 16 || (flags & 4)) type = TYPE_COUNT_LONGLONGINT_POINTER; else if (flags >= 8) type = TYPE_COUNT_LONGINT_POINTER; else if (flags & 2) type = TYPE_COUNT_SCHAR_POINTER; else if (flags & 1) type = TYPE_COUNT_SHORT_POINTER; else type = TYPE_COUNT_INT_POINTER; break; case '%': type = TYPE_NONE; break; default: goto error; } } if (type != TYPE_NONE) { dp->arg_index = arg_index; if (dp->arg_index == (~(size_t)0)) { dp->arg_index = arg_posn++; if (dp->arg_index == (~(size_t)0)) goto error; } { size_t n = (dp->arg_index); if (n >= a_allocated) { size_t memory_size; argument *memory; a_allocated = ((a_allocated) <= (18446744073709551615UL) / (2) ? (size_t)(a_allocated) * (2) : (18446744073709551615UL)); if (a_allocated <= n) a_allocated = xsum(n, 1); memory_size = ((a_allocated) <= (18446744073709551615UL) / (sizeof(argument)) ? (size_t)(a_allocated) * (sizeof(argument)) : (18446744073709551615UL)); if (((memory_size) == (18446744073709551615UL))) goto out_of_memory; memory = (argument *)(a->arg != a->direct_alloc_arg ? realloc(a->arg, memory_size) : malloc(memory_size)); if (memory == ((void *)0)) goto out_of_memory; if (a->arg == a->direct_alloc_arg) memcpy(memory, a->arg, a->count * sizeof(argument)); a->arg = memory; } while (a->count <= n) a->arg[a->count++].type = TYPE_NONE; if (a->arg[n].type == TYPE_NONE) a->arg[n].type = (type); else if (a->arg[n].type != (type)) goto error; }; } dp->conversion = c; dp->dir_end = cp; } d->count++; if (d->count >= d_allocated) { size_t memory_size; char_directive *memory; d_allocated = ((d_allocated) <= (18446744073709551615UL) / (2) ? (size_t)(d_allocated) * (2) : (18446744073709551615UL)); memory_size = ((d_allocated) <= (18446744073709551615UL) / (sizeof(char_directive)) ? (size_t)(d_allocated) * (sizeof(char_directive)) : (18446744073709551615UL)); if (((memory_size) == (18446744073709551615UL))) goto out_of_memory; memory = (char_directive *)(d->dir != d->direct_alloc_dir ? realloc(d->dir, memory_size) : malloc(memory_size)); if (memory == ((void *)0)) goto out_of_memory; if (d->dir == d->direct_alloc_dir) memcpy(memory, d->dir, d->count * sizeof(char_directive)); d->dir = memory; } } } d->dir[d->count].dir_start = cp; d->max_width_length = max_width_length; d->max_precision_length = max_precision_length; return 0; error: if (a->arg != a->direct_alloc_arg) free(a->arg); if (d->dir != d->direct_alloc_dir) free(d->dir); (*__errno_location()) = 22; return -1; out_of_memory: if (a->arg != a->direct_alloc_arg) free(a->arg); if (d->dir != d->direct_alloc_dir) free(d->dir); (*__errno_location()) = 12; return -1; }
long printf_parse(char *a1, long a2, long a3) { char *v3; long v4; long v5; long v6; unsigned long v7; size_t v8; void *v9; long v10; long v11; long v12; long v13; unsigned long v14; size_t v15; void *v16; long v17; long v18; char *v19; long v20; unsigned long v21; size_t v22; void *v23; long v24; long v25; unsigned long v26; size_t v27; void *v28; char v32; int v33; int ii; long v36; long v37; long v38; unsigned long v39; unsigned long v40; long v41; char *i; char *jj; unsigned long v44; char *j; char *k; unsigned long v47; char *m; char *n; unsigned long v50; long v51; unsigned long v52; void *dest; unsigned long v54; void *v55; unsigned long v56; void *v57; void *v58; v36 = 0LL; v39 = 0LL; v40 = 0LL; *(_QWORD *)a2 = 0LL; v37 = 7LL; *(_QWORD *)(a2 + 8) = a2 + 32; *(_QWORD *)a3 = 0LL; v38 = 7LL; *(_QWORD *)(a3 + 8) = a3 + 16; while (1) { do { if (!*a1) { *(_QWORD *)(*(_QWORD *)(a2 + 8) + 88LL * *(_QWORD *)a2) = a1; *(_QWORD *)(a2 + 16) = v39; *(_QWORD *)(a2 + 24) = v40; return 0LL; } v3 = a1++; } while (*v3 != 37); v41 = -1LL; v51 = *(_QWORD *)(a2 + 8) + 88LL * *(_QWORD *)a2; *(_QWORD *)v51 = a1 - 1; *(_DWORD *)(v51 + 16) = 0; *(_QWORD *)(v51 + 24) = 0LL; *(_QWORD *)(v51 + 32) = 0LL; *(_QWORD *)(v51 + 40) = -1LL; *(_QWORD *)(v51 + 48) = 0LL; *(_QWORD *)(v51 + 56) = 0LL; *(_QWORD *)(v51 + 64) = -1LL; *(_QWORD *)(v51 + 80) = -1LL; if (*a1 > 47 && *a1 <= 57) { for (i = a1; *i > 47 && *i <= 57; ++i) ; if (*i == 36) break; } while (1) { while (1) { while (1) { while (1) { while (1) { while (1) { LABEL_20: while (*a1 == 39) { *(_DWORD *)(v51 + 16) |= 1u; ++a1; } if (*a1 != 45) break; *(_DWORD *)(v51 + 16) |= 2u; ++a1; } if (*a1 != 43) break; *(_DWORD *)(v51 + 16) |= 4u; ++a1; } if (*a1 != 32) break; *(_DWORD *)(v51 + 16) |= 8u; ++a1; } if (*a1 != 35) break; *(_DWORD *)(v51 + 16) |= 0x10u; ++a1; } if (*a1 != 48) break; *(_DWORD *)(v51 + 16) |= 0x20u; ++a1; } if (*a1 != 73) break; *(_DWORD *)(v51 + 16) |= 0x40u; ++a1; } if (*a1 == 42) { *(_QWORD *)(v51 + 24) = a1++; *(_QWORD *)(v51 + 32) = a1; if (!v39) v39 = 1LL; if (*a1 > 47 && *a1 <= 57) { for (j = a1; *j > 47 && *j <= 57; ++j) ; if (*j == 36) { v47 = 0LL; for (k = a1; *k > 47 && *k <= 57; ++k) { if (v47 > 0x1999999999999999LL) v5 = -1LL; else v5 = 10 * v47; v47 = xsum(v5, *k - 48); } if (!v47 || v47 == -1LL) goto LABEL_240; *(_QWORD *)(v51 + 40) = v47 - 1; a1 = k + 1; } } if (*(_QWORD *)(v51 + 40) == -1LL) { v6 = v36++; *(_QWORD *)(v51 + 40) = v6; if (*(_QWORD *)(v51 + 40) == -1LL) goto LABEL_240; } v52 = *(_QWORD *)(v51 + 40); if (v52 >= v38) { if (v38 < 0) v7 = -1LL; else v7 = 2 * v38; v38 = v7; if (v7 <= v52) v38 = xsum(v52, 1LL); if ((unsigned long)v38 > 0x7FFFFFFFFFFFFFFLL) v8 = -1LL; else v8 = 32 * v38; if (v8 == -1LL || (*(_QWORD *)(a3 + 8) == a3 + 16 ? (v9 = malloc(v8)) : (v9 = realloc(*(void **)(a3 + 8), v8)), (dest = v9) == 0LL)) { LABEL_245: if (*(_QWORD *)(a3 + 8) != a3 + 16) free(*(void **)(a3 + 8)); if (*(_QWORD *)(a2 + 8) != a2 + 32) free(*(void **)(a2 + 8)); *_errno_location() = 12; return 0xFFFFFFFFLL; } if (*(_QWORD *)(a3 + 8) == a3 + 16) memcpy(v9, *(const void **)(a3 + 8), 32LL * *(_QWORD *)a3); *(_QWORD *)(a3 + 8) = dest; } while (v52 >= *(_QWORD *)a3) { v10 = *(_QWORD *)(a3 + 8); v11 = (*(_QWORD *)a3)++; *(_DWORD *)(v10 + 32 * v11) = 0; } if (*(_DWORD *)(32 * v52 + *(_QWORD *)(a3 + 8))) { if (*(_DWORD *)(32 * v52 + *(_QWORD *)(a3 + 8)) != 5) goto LABEL_240; } else { *(_DWORD *)(32 * v52 + *(_QWORD *)(a3 + 8)) = 5; } } else if (*a1 > 47 && *a1 <= 57) { *(_QWORD *)(v51 + 24) = a1; while (*a1 > 47 && *a1 <= 57) ++a1; *(_QWORD *)(v51 + 32) = a1; if (v39 < *(_QWORD *)(v51 + 32) - *(_QWORD *)(v51 + 24)) v39 = *(_QWORD *)(v51 + 32) - *(_QWORD *)(v51 + 24); } if (*a1 == 46) { if (*++a1 == 42) { *(_QWORD *)(v51 + 48) = a1++ - 1; *(_QWORD *)(v51 + 56) = a1; if (v40 <= 1) v40 = 2LL; if (*a1 > 47 && *a1 <= 57) { for (m = a1; *m > 47 && *m <= 57; ++m) ; if (*m == 36) { v50 = 0LL; for (n = a1; *n > 47 && *n <= 57; ++n) { if (v50 > 0x1999999999999999LL) v12 = -1LL; else v12 = 10 * v50; v50 = xsum(v12, *n - 48); } if (!v50 || v50 == -1LL) goto LABEL_240; *(_QWORD *)(v51 + 64) = v50 - 1; a1 = n + 1; } } if (*(_QWORD *)(v51 + 64) == -1LL) { v13 = v36++; *(_QWORD *)(v51 + 64) = v13; if (*(_QWORD *)(v51 + 64) == -1LL) goto LABEL_240; } v54 = *(_QWORD *)(v51 + 64); if (v54 >= v38) { if (v38 < 0) v14 = -1LL; else v14 = 2 * v38; v38 = v14; if (v14 <= v54) v38 = xsum(v54, 1LL); if ((unsigned long)v38 > 0x7FFFFFFFFFFFFFFLL) v15 = -1LL; else v15 = 32 * v38; if (v15 == -1LL) goto LABEL_245; v16 = *(_QWORD *)(a3 + 8) == a3 + 16 ? malloc(v15) : realloc(*(void **)(a3 + 8), v15); v55 = v16; if (!v16) goto LABEL_245; if (*(_QWORD *)(a3 + 8) == a3 + 16) memcpy(v16, *(const void **)(a3 + 8), 32LL * *(_QWORD *)a3); *(_QWORD *)(a3 + 8) = v55; } while (v54 >= *(_QWORD *)a3) { v17 = *(_QWORD *)(a3 + 8); v18 = (*(_QWORD *)a3)++; *(_DWORD *)(v17 + 32 * v18) = 0; } if (*(_DWORD *)(32 * v54 + *(_QWORD *)(a3 + 8))) { if (*(_DWORD *)(32 * v54 + *(_QWORD *)(a3 + 8)) != 5) goto LABEL_240; } else { *(_DWORD *)(32 * v54 + *(_QWORD *)(a3 + 8)) = 5; } } else { *(_QWORD *)(v51 + 48) = a1 - 1; while (*a1 > 47 && *a1 <= 57) ++a1; *(_QWORD *)(v51 + 56) = a1; if (v40 < *(_QWORD *)(v51 + 56) - *(_QWORD *)(v51 + 48)) v40 = *(_QWORD *)(v51 + 56) - *(_QWORD *)(v51 + 48); } } for (ii = 0;; ii += 8) { while (1) { while (1) { while (1) { while (1) { while (*a1 == 104) { ii |= 1 << (ii & 1); ++a1; } if (*a1 != 76) break; ii |= 4u; ++a1; } if (*a1 != 108) break; ii += 8; ++a1; } if (*a1 != 106) break; ii += 8; ++a1; } if (*a1 != 122 && *a1 != 90) break; ii += 8; ++a1; } if (*a1 != 116) break; ++a1; } v19 = a1++; v32 = *v19; switch (*v19) { case '%': v33 = 0; break; case 'A': case 'E': case 'F': case 'G': case 'a': case 'e': case 'f': case 'g': if (ii > 15 || (ii & 4) != 0) v33 = 12; else v33 = 11; break; case 'C': v33 = 14; v32 = 99; break; case 'S': v33 = 16; v32 = 115; break; case 'X': case 'o': case 'u': case 'x': if (ii > 15 || (ii & 4) != 0) { v33 = 10; } else if (ii <= 7) { if ((ii & 2) != 0) { v33 = 2; } else if ((ii & 1) != 0) { v33 = 4; } else { v33 = 6; } } else { v33 = 8; } break; case 'c': if (ii <= 7) v33 = 13; else v33 = 14; break; case 'd': case 'i': if (ii > 15 || (ii & 4) != 0) { v33 = 9; } else if (ii <= 7) { if ((ii & 2) != 0) { v33 = 1; } else if ((ii & 1) != 0) { v33 = 3; } else { v33 = 5; } } else { v33 = 7; } break; case 'n': if (ii > 15 || (ii & 4) != 0) { v33 = 22; } else if (ii <= 7) { if ((ii & 2) != 0) { v33 = 18; } else if ((ii & 1) != 0) { v33 = 19; } else { v33 = 20; } } else { v33 = 21; } break; case 'p': v33 = 17; break; case 's': if (ii <= 7) v33 = 15; else v33 = 16; break; default: goto LABEL_240; } if (v33) { *(_QWORD *)(v51 + 80) = v41; if (*(_QWORD *)(v51 + 80) == -1LL) { v20 = v36++; *(_QWORD *)(v51 + 80) = v20; if (*(_QWORD *)(v51 + 80) == -1LL) goto LABEL_240; } v56 = *(_QWORD *)(v51 + 80); if (v56 >= v38) { if (v38 < 0) v21 = -1LL; else v21 = 2 * v38; v38 = v21; if (v21 <= v56) v38 = xsum(v56, 1LL); if ((unsigned long)v38 > 0x7FFFFFFFFFFFFFFLL) v22 = -1LL; else v22 = 32 * v38; if (v22 == -1LL) goto LABEL_245; v23 = *(_QWORD *)(a3 + 8) == a3 + 16 ? malloc(v22) : realloc(*(void **)(a3 + 8), v22); v57 = v23; if (!v23) goto LABEL_245; if (*(_QWORD *)(a3 + 8) == a3 + 16) memcpy(v23, *(const void **)(a3 + 8), 32LL * *(_QWORD *)a3); *(_QWORD *)(a3 + 8) = v57; } while (v56 >= *(_QWORD *)a3) { v24 = *(_QWORD *)(a3 + 8); v25 = (*(_QWORD *)a3)++; *(_DWORD *)(v24 + 32 * v25) = 0; } if (*(_DWORD *)(32 * v56 + *(_QWORD *)(a3 + 8))) { if (v33 != *(_DWORD *)(32 * v56 + *(_QWORD *)(a3 + 8))) goto LABEL_240; } else { *(_DWORD *)(*(_QWORD *)(a3 + 8) + 32 * v56) = v33; } } *(_BYTE *)(v51 + 72) = v32; *(_QWORD *)(v51 + 8) = a1; if ((unsigned long)v37 <= ++*(_QWORD *)a2) { if (v37 < 0) v26 = -1LL; else v26 = 2 * v37; v37 = v26; if (v26 > 0x2E8BA2E8BA2E8BALL) v27 = -1LL; else v27 = 88 * v26; if (v27 == -1LL) goto LABEL_245; v28 = *(_QWORD *)(a2 + 8) == a2 + 32 ? malloc(v27) : realloc(*(void **)(a2 + 8), v27); v58 = v28; if (!v28) goto LABEL_245; if (*(_QWORD *)(a2 + 8) == a2 + 32) memcpy(v28, *(const void **)(a2 + 8), 88LL * *(_QWORD *)a2); *(_QWORD *)(a2 + 8) = v58; } } v44 = 0LL; for (jj = a1; *jj > 47 && *jj <= 57; ++jj) { if (v44 > 0x1999999999999999LL) v4 = -1LL; else v4 = 10 * v44; v44 = xsum(v4, *jj - 48); } if (v44 && v44 != -1LL) { v41 = v44 - 1; a1 = jj + 1; goto LABEL_20; } LABEL_240: if (*(_QWORD *)(a3 + 8) != a3 + 16) free(*(void **)(a3 + 8)); if (*(_QWORD *)(a2 + 8) != a2 + 32) free(*(void **)(a2 + 8)); *_errno_location() = 22; return 0xFFFFFFFFLL; }
gnutls
ida
static void check_perms(const struct group *grp, struct passwd *pwd, const char *groupname) { _Bool needspasswd = 0; struct spwd *spwd; char *cp; const char *cpasswd; if ((grp->gr_gid != pwd->pw_gid) && !is_on_list(grp->gr_mem, pwd->pw_name)) { needspasswd = 1; } spwd = xgetspnam(pwd->pw_name); if (((void *)0) != spwd) { pwd->pw_passwd = xstrdup(spwd->sp_pwdp); spw_free(spwd); } if ((pwd->pw_passwd[0] == '\0') && (grp->gr_passwd[0] != '\0')) { needspasswd = 1; } if ((getuid() != 0) && needspasswd) { cp = getpass(gettext("Password: ")); if (((void *)0) == cp) { goto failure; } cpasswd = pw_encrypt(cp, grp->gr_passwd); explicit_bzero((cp), (strlen(cp))); if (((void *)0) == cpasswd) { fprintf(stderr, gettext("%s: failed to crypt password with previous salt: %s\n"), Prog, strerror((*__errno_location()))); do { char *old_locale = setlocale(6, ((void *)0)); char *saved_locale = ((void *)0); if (((void *)0) != old_locale) { saved_locale = strdup(old_locale); } if (((void *)0) != saved_locale) { (void)setlocale(6, "C"); } syslog(6, "Failed to crypt password with previous salt of group '%s'", groupname); if (((void *)0) != saved_locale) { (void)setlocale(6, saved_locale); free(saved_locale); } } while (0) ; goto failure; } if (grp->gr_passwd[0] == '\0' || strcmp(cpasswd, grp->gr_passwd) != 0) { do { char *old_locale = setlocale(6, ((void *)0)); char *saved_locale = ((void *)0); if (((void *)0) != old_locale) { saved_locale = strdup(old_locale); } if (((void *)0) != saved_locale) { (void)setlocale(6, "C"); } syslog(6, "Invalid password for group '%s' from '%s'", groupname, pwd->pw_name); if (((void *)0) != saved_locale) { (void)setlocale(6, saved_locale); free(saved_locale); } } while (0) ; (void)sleep(1); (void)fputs(gettext("Invalid password.\n"), stderr); goto failure; } } return; failure: closelog(); exit(1); }
__uid_t check_perms(long a1, const char **a2, const char *a3) { __uid_t result; char *v4; size_t v5; int *v6; char *v7; char *v8; char *v9; FILE *v10; char *v11; bool v13; char *locale; char *v15; long v16; const char *s; char *s1; const char *v19; const char *v20; v13 = 0; if (*(_DWORD *)(a1 + 16) != *((_DWORD *)a2 + 5)) v13 = (unsigned char)is_on_list(*(_QWORD *)(a1 + 24), *a2) != 1; v16 = xgetspnam(*a2); if (v16) { a2[1] = (const char *)xstrdup(*(_QWORD *)(v16 + 8)); spw_free(v16); } if (!*a2[1] && **(_BYTE **)(a1 + 8)) v13 = 1; result = getuid(); if (result && v13) { v4 = gettext("Password: "); s = getpass(v4); if (!s) goto LABEL_27; s1 = (char *)pw_encrypt(s, *(_QWORD *)(a1 + 8)); v5 = strlen(s); explicit_bzero(s, v5); if (!s1) { v6 = _errno_location(); v7 = strerror(*v6); v8 = Prog; v9 = gettext("%s: failed to crypt password with previous salt: %s\n"); fprintf(stderr, v9, v8, v7); v20 = setlocale(6, 0LL); locale = 0LL; if (v20) locale = strdup(v20); if (locale) setlocale(6, "C"); syslog(6, "Failed to crypt password with previous salt of group '%s'", a3); if (locale) { setlocale(6, locale); free(locale); } goto LABEL_27; } if (!**(_BYTE **)(a1 + 8) || (result = strcmp(s1, *(const char **)(a1 + 8))) != 0) { v19 = setlocale(6, 0LL); v15 = 0LL; if (v19) v15 = strdup(v19); if (v15) setlocale(6, "C"); syslog(6, "Invalid password for group '%s' from '%s'", a3, *a2); if (v15) { setlocale(6, v15); free(v15); } sleep(1u); v10 = stderr; v11 = gettext("Invalid password.\n"); fputs(v11, v10); LABEL_27: closelog(); exit(1); } } return result; }
shadow
ida