input
stringlengths
26
172k
output
stringlengths
18
318k
repo_name
stringclasses
23 values
decompiler
stringclasses
5 values
static char *readline_internal(void) { readline_internal_setup(); rl_eof_found = readline_internal_charloop(); return (readline_internal_teardown(rl_eof_found)); }
void readline_internal(void) { readline_internal_setup(); rl_eof_found = readline_internal_charloop(); readline_internal_teardown(rl_eof_found); return; }
bash
ghidra
char *utf8_mbschr(s, c) const char *s; int c; { return strchr(s, c); }
void utf8_mbschr(char *param_1, int param_2) { strchr(param_1, param_2); return; }
bash
ghidra
int sshpkt_get_u8(struct ssh *ssh, u_char *valp) { return sshbuf_get_u8(ssh->state->incoming_packet, valp); }
int sshpkt_get_u8(struct struct_0 **a0, unsigned long long a1) { return sshbuf_get_u8(*(a0)->field_38, a1); }
openssh-portable
angr_sailr
static void check_parent_exists(void) { if (parent_pid != -1 && getppid() != parent_pid) { cleanup_socket(); _exit(2); } }
void check_parent_exists(unsigned int a0, unsigned int a1, unsigned long a2, unsigned int a3, unsigned int a4, unsigned int a5) { char v0; unsigned long long v2; unsigned long long v3; v2 = parent_pid; if (parent_pid != -1) { v3 = getppid(); if (v3 != parent_pid) { cleanup_socket(a0, a1, parent_pid, a3, a4, a5, *(&v0)); _exit(0x2); } } if (v3 == parent_pid || parent_pid == -1) return; }
openssh-portable
angr_dream
static int check_woffset(struct sshbuf *buf, size_t offset, size_t len, u_char **p) { int r; *p = ((void *)0); if ((r = check_offset(buf, 1, offset, len)) != 0) return r; if (sshbuf_mutable_ptr(buf) == ((void *)0)) return -49; *p = sshbuf_mutable_ptr(buf) + offset; return 0; }
int check_woffset(undefined8 param_1, long param_2, undefined8 param_3, long *param_4) { int iVar1; long lVar2; *param_4 = 0; iVar1 = check_offset(param_1, 1, param_2, param_3); if (iVar1 == 0) { lVar2 = sshbuf_mutable_ptr(param_1); if (lVar2 == 0) { iVar1 = -0x31; } else { lVar2 = sshbuf_mutable_ptr(param_1); *param_4 = param_2 + lVar2; iVar1 = 0; } } return iVar1; }
openssh-portable
ghidra
void shtimer_clear(sh_timer *t) { shtimer_unset(t); shtimer_dispose(t); }
long long shtimer_clear(void *a0, unsigned int a1, unsigned long long a2, unsigned long long a3) { shtimer_unset(a0, a1, a2, a3); return shtimer_dispose(a0); }
bash
angr_sailr
void channel_register_open_confirm(struct ssh *ssh, int id, channel_open_fn *fn, void *ctx) { Channel *c = channel_lookup(ssh, id); if (c == ((void *)0)) { sshlog("channels.c", __func__, 1026, 1, SYSLOG_LEVEL_INFO, ((void *)0), "%d: bad id", id); return; } c->open_confirm = fn; c->open_confirm_ctx = ctx; }
long long channel_register_open_confirm(void *a0, unsigned long a1, unsigned long a2, unsigned long a3) { unsigned long v0; unsigned long long v1[28]; unsigned long long v3[28]; v1[0] = channel_lookup(a0, a1); if (!v1) { v0 = a1; v3 = sshlog("channels.c", "channel_register_open_confirm", 0x402, 0x1, 0x3, 0x0, "%d: bad id"); } else { v1[26] = a2; v3 = v1; v1[27] = a3; } return v3; }
openssh-portable
angr_dream
static char const *visible(cc_t ch) { static char buf[10]; char *bpout = buf; if (ch == '\0') return "<undef>"; if (ch >= 32) { if (ch < 127) *bpout++ = ch; else if (ch == 127) { *bpout++ = '^'; *bpout++ = '?'; } else { *bpout++ = 'M'; *bpout++ = '-'; if (ch >= 128 + 32) { if (ch < 128 + 127) *bpout++ = ch - 128; else { *bpout++ = '^'; *bpout++ = '?'; } } else { *bpout++ = '^'; *bpout++ = ch - 128 + 64; } } } else { *bpout++ = '^'; *bpout++ = ch + 64; } *bpout = '\0'; return (char const *)buf; }
int visible(unsigned long a0) { char *v0; int tmp_12; int tmp_29; int tmp_10; int tmp_18; int tmp_14; int tmp_22; unsigned int v2; v0 = &buf.6240; if (!a0) { v2 = &g_406445; return v2; } if (a0 <= 31) { tmp_12 = v0; v0 += 1; *(tmp_12) = 94; tmp_29 = v0; v0 += 1; *(tmp_29) = a0 + 64; } else if (a0 <= 126) { v2 = v0; v0 += 1; *(v2) = a0; } else if (a0 == 127) { tmp_10 = v0; v0 += 1; *(tmp_10) = 94; tmp_18 = v0; v0 += 1; *(tmp_18) = 63; } else { tmp_14 = v0; v0 += 1; *(tmp_14) = 77; tmp_22 = v0; v0 += 1; *(tmp_22) = 45; if (a0 <= 159) { tmp_12 = v0; v0 += 1; *(tmp_12) = 94; tmp_29 = v0; v0 += 1; *(tmp_29) = a0 - 64; } else if (a0 == 255) { tmp_10 = v0; v0 += 1; *(tmp_10) = 94; tmp_18 = v0; v0 += 1; *(tmp_18) = 63; } else { v2 = v0; v0 += 1; *(v2) = a0 - 128; } } *(v0) = 0; v2 = &buf.6240; return v2; }
coreutils
angr_sailr
test_code_t test_record_padding(gnutls_session_t session) { int ret; sprintf( prio_str, "NONE:" "+3DES-CBC:+AES-128-CBC:+CAMELLIA-128-CBC:+AES-256-CBC:+CAMELLIA-256-CBC" ":" "+COMP-NULL" ":+VERS-TLS1.2:+VERS-TLS1.1:+VERS-TLS1.0:-VERS-SSL3.0:" "+MAC-ALL:+MD5:+SHA1" ":+GOST28147-TC26Z-IMIT" ":" "+RSA:+DHE-RSA:+DHE-DSS:+ANON-DH:+ECDHE-RSA:+ECDHE-ECDSA:+ANON-ECDH" ":+VKO-GOST-12" ":%s", rest); { int _ret; if ((_ret = __gnutls_priority_set_direct(session, prio_str, 1045)) != TEST_SUCCEED) { return _ret; } }; gnutls_credentials_set(session, GNUTLS_CRD_CERTIFICATE, xcred); ret = test_do_handshake(session); if (ret == TEST_SUCCEED) { tls1_ok = 1; } else { sprintf(prio_str, "NONE:" "+3DES-CBC:+AES-128-CBC:+CAMELLIA-128-CBC:+AES-256-CBC:+CAMELLIA-" "256-CBC" ":" "+COMP-NULL" ":+VERS-TLS1.2:+VERS-TLS1.1:+VERS-TLS1.0:-VERS-SSL3.0:" "+MAC-ALL:+MD5:+SHA1" ":+GOST28147-TC26Z-IMIT" ":" "+RSA:+DHE-RSA:+DHE-DSS:+ANON-DH:+ECDHE-RSA:+ECDHE-ECDSA:+ANON-ECDH" ":+VKO-GOST-12" ":%%COMPAT:%s", rest); { int _ret; if ((_ret = __gnutls_priority_set_direct(session, prio_str, 1055)) != TEST_SUCCEED) { return _ret; } }; gnutls_credentials_set(session, GNUTLS_CRD_CERTIFICATE, xcred); ret = test_do_handshake(session); if (ret == TEST_SUCCEED) { tls1_ok = 1; strcat(rest, ":%COMPAT"); } else ret = TEST_IGNORE2; } return ret; }
long long test_record_padding(unsigned long long a0) { unsigned int v0; unsigned int v1; unsigned int v2; unsigned long long v4; sprintf( &prio_str, "NONE:+3DES-CBC:+AES-128-CBC:+CAMELLIA-128-CBC:+AES-256-CBC:+CAMELLIA-" "256-CBC:+COMP-NULL:+VERS-TLS1.2:+VERS-TLS1.1:+VERS-TLS1.0:-VERS-SSL3.0:+" "MAC-ALL:+MD5:+SHA1:+GOST28147-TC26Z-IMIT:+RSA:+DHE-RSA:+DHE-DSS:+ANON-" "DH:+ECDHE-RSA:+ECDHE-ECDSA:+ANON-ECDH:+VKO-GOST-12:%s", &rest); v1 = __gnutls_priority_set_direct(a0, &prio_str, 0x415); if (v1) { v4 = v1; } else { gnutls_credentials_set(a0, 0x1, xcred); v0 = test_do_handshake(a0); if (!v0) { tls1_ok = 1; } else { sprintf(&prio_str, "NONE:+3DES-CBC:+AES-128-CBC:+CAMELLIA-128-CBC:+AES-256-CBC:+" "CAMELLIA-256-CBC:+COMP-NULL:+VERS-TLS1.2:+VERS-TLS1.1:+VERS-" "TLS1.0:-VERS-SSL3.0:+MAC-ALL:+MD5:+SHA1:+GOST28147-TC26Z-IMIT:+" "RSA:+DHE-RSA:+DHE-DSS:+ANON-DH:+ECDHE-RSA:+ECDHE-ECDSA:+ANON-" "ECDH:+VKO-GOST-12:%%COMPAT:%s", &rest); v2 = __gnutls_priority_set_direct(a0, &prio_str, 0x41f); if (v2) { v4 = v2; } else { gnutls_credentials_set(a0, 0x1, xcred); v0 = test_do_handshake(a0); if (!v0) { tls1_ok = 1; strcat("%UNSAFE_RENEGOTIATION:+SIGN-ALL:+GROUP-ALL:+SIGN-GOSTR341012-" "512:+SIGN-GOSTR341012-256:+SIGN-GOSTR341001:+GROUP-GOST-ALL", ":%COMPAT"); } else { v0 = 4; } } } if (!v0 || !v2) v4 = v0; } return v4; }
gnutls
angr_dream
static void file_stat(struct file *f) { int ret; if (f->stat_state != FILE_STAT_INVALID) return; ret = lstat(f->name, &f->stat); if (ret && (*__errno_location()) != 2) ohshite(gettext("cannot stat file '%s'"), f->name); if (ret == 0) f->stat_state = FILE_STAT_VALID; else f->stat_state = FILE_STAT_NOFILE; }
void file_stat(char **param_1) { char *pcVar1; int iVar2; int *piVar3; undefined8 uVar4; if (*(int *)(param_1 + 1) == 0) { iVar2 = lstat(*param_1, (stat *)(param_1 + 2)); if (iVar2 != 0) { piVar3 = __errno_location(); if (*piVar3 != 2) { pcVar1 = *param_1; uVar4 = gettext("cannot stat file \'%s\'"); ohshite(uVar4, pcVar1); } } if (iVar2 == 0) { *(undefined4 *)(param_1 + 1) = 1; } else { *(undefined4 *)(param_1 + 1) = 2; } } return; }
dpkg
ghidra
static struct hash_entry *allocate_entry(Hash_table *table) { struct hash_entry *new; if (table->free_entry_list) { new = table->free_entry_list; table->free_entry_list = new->next; } else { new = malloc(sizeof *new); } return new; }
void *allocate_entry(long param_1) { void *local_10; if (*(long *)(param_1 + 0x48) == 0) { local_10 = malloc(0x10); } else { local_10 = *(void **)(param_1 + 0x48); *(undefined8 *)(param_1 + 0x48) = *(undefined8 *)((long)local_10 + 8); } return local_10; }
gnutls
ghidra
terminal_set(EditLine *el, const char *term) { int i; char buf[((size_t)2048)]; char *area; const struct termcapstr *t; sigset_t oset, nset; int lins, cols; (void)sigemptyset(&nset); (void)sigaddset(&nset, 28); (void)sigprocmask(0, &nset, &oset); area = buf; if (term == ((void *)0)) term = getenv("TERM"); if (!term || !term[0]) term = "dumb"; if (strcmp(term, "emacs") == 0) el->el_flags |= 0x004; (void)memset(el->el_terminal.t_cap, 0, ((size_t)2048)); i = tgetent(el->el_terminal.t_cap, term); if (i <= 0) { if (i == -1) (void)fprintf(el->el_errfile, "Cannot read termcap database;\n"); else if (i == 0) (void)fprintf(el->el_errfile, "No entry for terminal type \"%s\";\n", term); (void)fprintf(el->el_errfile, "using dumb terminal settings.\n"); el->el_terminal.t_val[3] = 80; el->el_terminal.t_val[1] = el->el_terminal.t_val[4] = el->el_terminal.t_val[2] = 0; el->el_terminal.t_val[5] = el->el_terminal.t_val[7]; for (t = tstr; t->name != ((void *)0); t++) terminal_alloc(el, t, ((void *)0)); } else { el->el_terminal.t_val[0] = tgetflag("am"); el->el_terminal.t_val[6] = tgetflag("xn"); el->el_terminal.t_val[1] = tgetflag("pt"); el->el_terminal.t_val[5] = tgetflag("xt"); el->el_terminal.t_val[4] = tgetflag("km"); el->el_terminal.t_val[7] = tgetflag("MT"); el->el_terminal.t_val[3] = tgetnum("co"); el->el_terminal.t_val[2] = tgetnum("li"); for (t = tstr; t->name != ((void *)0); t++) { terminal_alloc(el, t, tgetstr(strchr(t->name, *t->name), &area)); } } if (el->el_terminal.t_val[3] < 2) el->el_terminal.t_val[3] = 80; if (el->el_terminal.t_val[2] < 1) el->el_terminal.t_val[2] = 24; el->el_terminal.t_size.v = el->el_terminal.t_val[3]; el->el_terminal.t_size.h = el->el_terminal.t_val[2]; terminal_setflags(el); (void)terminal_get_size(el, &lins, &cols); if (terminal_change_size(el, lins, cols) == -1) return -1; (void)sigprocmask(2, &oset, ((void *)0)); terminal_bind_arrow(el); el->el_terminal.t_name = term; return i <= 0 ? -1 : 0; }
undefined8 terminal_set(long param_1, char *param_2) { undefined4 *puVar1; long lVar2; int iVar3; undefined4 uVar4; undefined4 *puVar5; char *pcVar6; undefined8 uVar7; long in_FS_OFFSET; char *local_958; undefined4 local_944; undefined4 local_940; int local_93c; undefined *local_938; undefined1 *local_930; sigset_t local_928; sigset_t local_8a8; undefined local_828[2056]; long local_20; local_20 = *(long *)(in_FS_OFFSET + 0x28); sigemptyset(&local_8a8); sigaddset(&local_8a8, 0x1c); sigprocmask(0, &local_8a8, &local_928); local_938 = local_828; local_958 = param_2; if (param_2 == (char *)0x0) { local_958 = getenv("TERM"); } if ((local_958 == (char *)0x0) || (*local_958 == '\0')) { local_958 = "dumb"; } iVar3 = strcmp(local_958, "emacs"); if (iVar3 == 0) { *(uint *)(param_1 + 0x2c) = *(uint *)(param_1 + 0x2c) | 4; } memset(*(void **)(param_1 + 0xc0), 0, 0x800); local_93c = tgetent(*(undefined8 *)(param_1 + 0xc0)); if (local_93c < 1) { if (local_93c == -1) { fprintf(*(FILE **)(param_1 + 0x18), "Cannot read termcap database;\n"); } else if (local_93c == 0) { fprintf(*(FILE **)(param_1 + 0x18), "No entry for terminal type \"%s\";\n", local_958); } fprintf(*(FILE **)(param_1 + 0x18), "using dumb terminal settings.\n"); *(undefined4 *)(*(long *)(param_1 + 0xb8) + 0xc) = 0x50; puVar1 = (undefined4 *)(*(long *)(param_1 + 0xb8) + 8); *puVar1 = 0; puVar5 = (undefined4 *)(*(long *)(param_1 + 0xb8) + 0x10); *puVar5 = *puVar1; *(undefined4 *)(*(long *)(param_1 + 0xb8) + 4) = *puVar5; *(undefined4 *)(*(long *)(param_1 + 0xb8) + 0x14) = *(undefined4 *)(*(long *)(param_1 + 0xb8) + 0x1c); for (local_930 = tstr; *(char **)local_930 != (char *)0x0; local_930 = (undefined1 *)((long)local_930 + 0x10)) { terminal_alloc(param_1, local_930, 0); } } else { puVar1 = *(undefined4 **)(param_1 + 0xb8); uVar4 = tgetflag(&DAT_001048a9); *puVar1 = uVar4; lVar2 = *(long *)(param_1 + 0xb8); uVar4 = tgetflag(&DAT_00104928); *(undefined4 *)(lVar2 + 0x18) = uVar4; lVar2 = *(long *)(param_1 + 0xb8); uVar4 = tgetflag(&DAT_001048c2); *(undefined4 *)(lVar2 + 4) = uVar4; lVar2 = *(long *)(param_1 + 0xb8); uVar4 = tgetflag(&DAT_0010490f); *(undefined4 *)(lVar2 + 0x14) = uVar4; lVar2 = *(long *)(param_1 + 0xb8); uVar4 = tgetflag(&DAT_001048ff); *(undefined4 *)(lVar2 + 0x10) = uVar4; lVar2 = *(long *)(param_1 + 0xb8); uVar4 = tgetflag(&DAT_00104950); *(undefined4 *)(lVar2 + 0x1c) = uVar4; lVar2 = *(long *)(param_1 + 0xb8); uVar4 = tgetnum(&DAT_001048ea); *(undefined4 *)(lVar2 + 0xc) = uVar4; lVar2 = *(long *)(param_1 + 0xb8); uVar4 = tgetnum(&DAT_001048d7); *(undefined4 *)(lVar2 + 8) = uVar4; for (local_930 = tstr; *(char **)local_930 != (char *)0x0; local_930 = (undefined1 *)((long)local_930 + 0x10)) { pcVar6 = strchr(*(char **)local_930, (int)**(char **)local_930); uVar7 = tgetstr(pcVar6, &local_938); terminal_alloc(param_1, local_930, uVar7); } } if (*(int *)(*(long *)(param_1 + 0xb8) + 0xc) < 2) { *(undefined4 *)(*(long *)(param_1 + 0xb8) + 0xc) = 0x50; } if (*(int *)(*(long *)(param_1 + 0xb8) + 8) < 1) { *(undefined4 *)(*(long *)(param_1 + 0xb8) + 8) = 0x18; } *(undefined4 *)(param_1 + 0x94) = *(undefined4 *)(*(long *)(param_1 + 0xb8) + 0xc); *(undefined4 *)(param_1 + 0x90) = *(undefined4 *)(*(long *)(param_1 + 0xb8) + 8); terminal_setflags(param_1); terminal_get_size(param_1, &local_944, &local_940); iVar3 = terminal_change_size(param_1, local_944, local_940); if (iVar3 == -1) { uVar7 = 0xffffffff; } else { sigprocmask(2, &local_928, (sigset_t *)0x0); terminal_bind_arrow(param_1); *(char **)(param_1 + 0x88) = local_958; if (local_93c < 1) { uVar7 = 0xffffffff; } else { uVar7 = 0; } } if (local_20 == *(long *)(in_FS_OFFSET + 0x28)) { return uVar7; } __stack_chk_fail(); }
libedit
ghidra
int acl_delete_entry(acl_t acl, acl_entry_t entry_d) { acl_obj *acl_obj_p = ((acl_obj *)__ext2int_and_check(acl, (0x712C))); acl_entry_obj *entry_obj_p = ((acl_entry_obj *)__ext2int_and_check(entry_d, (0x9D6B))); if (!acl_obj_p || !entry_obj_p) return -1; if (acl_obj_p->i.a_curr == entry_obj_p) acl_obj_p->i.a_curr = acl_obj_p->i.a_curr->i.e_prev; entry_obj_p->i.e_prev->i.e_next = entry_obj_p->i.e_next; entry_obj_p->i.e_next->i.e_prev = entry_obj_p->i.e_prev; (__free_obj_p((obj_prefix *)(entry_obj_p))); acl_obj_p->i.a_used--; return 0; }
long long acl_delete_entry(unsigned long long a0, unsigned long long a1) { struct_0 *v0; struct_2 *v1; unsigned long long v3; v0 = __ext2int_and_check(a0, 0x712c); v1 = __ext2int_and_check(a1, 0x9d6b); if (v0 && v1) { if (v1 == v0->field_18) v0->field_18 = v0->field_18->field_8; v1->field_8->field_10 = v1->field_10; v1->field_10->field_8 = v1->field_8; __free_obj_p(v1); v0->field_30 = v0->field_30 - 1; v3 = 0; } if (!v0 || !v1) v3 = 4294967295; return v3; }
acl-2.3.1
angr_dream
static off_t deflate_fast() { IPos hash_head; int flush = 0; unsigned match_length = 0; prev_length = 3 - 1; while (lookahead != 0) { ((ins_h = (((ins_h) << ((15 + 3 - 1) / 3)) ^ (window[(strstart) + 3 - 1])) & ((unsigned)(1 << 15) - 1)), prev[(strstart) & (0x8000 - 1)] = hash_head = (prev + 0x8000)[ins_h], (prev + 0x8000)[ins_h] = (strstart)); if (hash_head != 0 && strstart - hash_head <= (0x8000 - (258 + 3 + 1)) && strstart <= window_size - (258 + 3 + 1)) { match_length = longest_match(hash_head); if (match_length > lookahead) match_length = lookahead; } if (match_length >= 3) { ; flush = ct_tally(strstart - match_start, match_length - 3); lookahead -= match_length; do { if (rsync) rsync_roll((strstart), (match_length)); } while (0); if (match_length <= max_lazy_match) { match_length--; do { strstart++; ((ins_h = (((ins_h) << ((15 + 3 - 1) / 3)) ^ (window[(strstart) + 3 - 1])) & ((unsigned)(1 << 15) - 1)), prev[(strstart) & (0x8000 - 1)] = hash_head = (prev + 0x8000)[ins_h], (prev + 0x8000)[ins_h] = (strstart)); } while (--match_length != 0); strstart++; } else { strstart += match_length; match_length = 0; ins_h = window[strstart]; (ins_h = (((ins_h) << ((15 + 3 - 1) / 3)) ^ (window[strstart + 1])) & ((unsigned)(1 << 15) - 1)); } } else { ; flush = ct_tally(0, window[strstart]); do { if (rsync) rsync_roll((strstart), (1)); } while (0); lookahead--; strstart++; } if (rsync && strstart > rsync_chunk_end) { rsync_chunk_end = 0xFFFFFFFFUL; flush = 2; } if (flush) flush_block(block_start >= 0L ? (char *)&window[(unsigned)block_start] : (char *)((void *)0), (long)strstart - block_start, flush - 1, (0)), block_start = strstart; while (lookahead < (258 + 3 + 1) && !eofile) fill_window(); } return flush_block(block_start >= 0L ? (char *)&window[(unsigned)block_start] : (char *)((void *)0), (long)strstart - block_start, flush - 1, (1)); }
void deflate_fast() { unsigned int v0; unsigned int v1; unsigned int v2; unsigned long long v6; v0 = 0; v1 = 0; good_match = 2; while (lookahead) { ins_h = (*(3856222327) ^ (ins_h * 32)) & 32767; v2 = *((0x10000 + &prev + 2 * ins_h)); g_5090b2 = v2; *((0x10000 + &prev + 2 * ins_h)) = 18517; if (v2 && 3850979413 - v2 <= 32506 && 17042544940070553685 <= window_size - 262) { v1 = longest_match(v2); if (v1 > lookahead) v1 = lookahead; } if (v1 <= 2) { v0 = ct_tally(0x0, *(17042544940075796597), 0xec834853e5894855, (ins_h + 0x8000) * 2); if (*(&rsync)) rsync_roll(0xec834853e5894855, 0x1); lookahead = lookahead - 1; good_match = 3850979414; } else { v0 = ct_tally(0x0, v1 - 3, 0x0, v1 - 3); lookahead = lookahead - v1; if (*(&rsync)) rsync_roll(0xec834853e5894855, v1); if (v1 > max_lazy_match) { good_match = v1 + 17042544940070553685; v1 = 0; ins_h = *(17042544940075796597); ins_h = (*(3856222326) ^ (ins_h * 32)) & 32767; } else { v1 -= 1; do { good_match = 3850979414; ins_h = (*(3856222327) ^ (ins_h * 32)) & 32767; v2 = *((0x10000 + &prev + 2 * ins_h)); g_5090b2 = v2; *((0x10000 + &prev + 2 * ins_h)) = 18517; v1 -= 1; } while (v1); good_match = 3850979414; } } if (*(&rsync) && 17042544940070553685 > rsync_chunk_end) { rsync_chunk_end = 4294967295; v0 = 2; } if (v0) { flush_block((17040927305180072019 < 0 ? 17040927305185314931 : 0)); block_start = 17042544940070553685; } while (lookahead <= 261 && !eofile) { fill_window(); } } v6 = flush_block((17040927305180072019 < 0 ? 17040927305185314931 : 0)); return; }
gzip-1.12
angr_sailr
static void next_file_name(void) { static size_t *sufindex; static size_t outbase_length; static size_t outfile_length; static size_t addsuf_length; if (!outfile) { _Bool widen; new_name: widen = !!outfile_length; if (!widen) { outbase_length = strlen(outbase); addsuf_length = additional_suffix ? strlen(additional_suffix) : 0; outfile_length = outbase_length + suffix_length + addsuf_length; } else { outfile_length += 2; suffix_length++; } if (outfile_length + 1 < outbase_length) xalloc_die(); outfile = xrealloc(outfile, outfile_length + 1); if (!widen) memcpy(outfile, outbase, outbase_length); else { outfile[outbase_length] = suffix_alphabet[sufindex[0]]; outbase_length++; } outfile_mid = outfile + outbase_length; memset(outfile_mid, suffix_alphabet[0], suffix_length); if (additional_suffix) memcpy(outfile_mid + suffix_length, additional_suffix, addsuf_length); outfile[outfile_length] = 0; free(sufindex); sufindex = xcalloc(suffix_length, sizeof *sufindex); if (numeric_suffix_start) { ((void)sizeof((!widen) ? 1 : 0), __extension__({ if (!widen) ; else __assert_fail("! widen", "src/split.c", 409, __extension__ __PRETTY_FUNCTION__); })); size_t i = strlen(numeric_suffix_start); memcpy(outfile_mid + suffix_length - i, numeric_suffix_start, i); size_t *sufindex_end = sufindex + suffix_length; while (i-- != 0) *--sufindex_end = numeric_suffix_start[i] - '0'; } } else { size_t i = suffix_length; while (i-- != 0) { sufindex[i]++; if (suffix_auto && i == 0 && !suffix_alphabet[sufindex[0] + 1]) goto new_name; outfile_mid[i] = suffix_alphabet[sufindex[i]]; if (outfile_mid[i]) return; sufindex[i] = 0; outfile_mid[i] = suffix_alphabet[sufindex[i]]; } ((!!sizeof(struct { _Static_assert(1, "verify_expr (" "1" ", " "(error (1, 0, gettext (\"output file suffixes " "exhausted\")), assume (false))" ")"); int _gl_dummy; })) ? ((error(1, 0, gettext("output file suffixes exhausted")), ((0) ? (void)0 : __builtin_unreachable()))) : ((error(1, 0, gettext("output file suffixes exhausted")), ((0) ? (void)0 : __builtin_unreachable())))); } }
void next_file_name() { char v0; char *v1; unsigned long long *v2; void *v3; void *v5; unsigned long long v6; void *v7; void *v8; char *v9; if (outfile) { v3 = suffix_length; while (true) { v5 = v3; v3 -= 1; if (!v5) error(0x1, 0x0, gettext("output file suffixes exhausted")); *((sufindex.5983 + v3 * 8)) = *((sufindex.5983 + v3 * 8)) + 1; if (suffix_auto && !v3 && !*((*(sufindex.5983) + 1 + suffix_alphabet))) break; *(v3 + outfile_mid) = *((*((sufindex.5983 + v3 * 8)) + suffix_alphabet)); v6 = *(v3 + outfile_mid); if (!(!*(v3 + outfile_mid))) goto LABEL_400cfa; *((sufindex.5983 + v3 * 8)) = 0; *(v3 + outfile_mid) = *((*((sufindex.5983 + v3 * 8)) + suffix_alphabet)); } } v0 = outfile_length.5985; if (!(v0 ^ 1)) { outfile_length.5985 = outfile_length.5985 + 2; suffix_length = suffix_length + 1; } else { outbase_length.5984 = strlen(outbase); if (!additional_suffix) v7 = 0; else v7 = strlen(additional_suffix); addsuf_length.5986 = v7; outfile_length.5985 = addsuf_length.5986 + outbase_length.5984 + suffix_length; } if (outfile_length.5985 + 1 < outbase_length.5984) xalloc_die(); outfile = xrealloc(outfile, outfile_length.5985 + 1, outfile_length.5985 + 1); if (!(v0 ^ 1)) { *((outbase_length.5984 + outfile)) = *((*(sufindex.5983) + suffix_alphabet)); outbase_length.5984 = outbase_length.5984 + 1; } else { memcpy(outfile, outbase, outbase_length.5984); } outfile_mid = outbase_length.5984 + outfile; memset(outfile_mid, *(suffix_alphabet), suffix_length); if (additional_suffix) memcpy(suffix_length + outfile_mid, additional_suffix, addsuf_length.5986); *((outfile_length.5985 + outfile)) = 0; free(sufindex.5983); sufindex.5983 = xcalloc(suffix_length, 0x8); v8 = numeric_suffix_start; if (numeric_suffix_start) { if (!(v0 ^ 1)) __assert_fail(); v1 = strlen(numeric_suffix_start); memcpy(outfile_mid + suffix_length + -0x1 * v1, numeric_suffix_start, v1); v2 = sufindex.5983 + suffix_length * 8; while (true) { v9 = v1; v1 += 1; if (!v9) break; v2 += 1; *(v2) = v1[numeric_suffix_start] - 48; } } LABEL_400cfa: return; }
coreutils
angr_phoenix
struct predicate *build_expression_tree(int argc, char *argv[], int end_of_leading_options) { const struct parser_table *parse_entry; char *predicate_name; struct predicate *cur_pred; const struct parser_table *entry_close, *entry_print, *entry_open; int i, oldi; predicates = ((void *)0); start_points = argv + end_of_leading_options; for (i = end_of_leading_options; i < argc && !looks_like_expression(argv[i], 1); i++) { ++num_start_points; } entry_open = find_parser("("); entry_close = find_parser(")"); entry_print = find_parser("print"); ((void)sizeof((entry_open != ((void *)0)) ? 1 : 0), __extension__({ if (entry_open != ((void *)0)) ; else __assert_fail("entry_open != NULL", "tree.c", 1270, __extension__ __PRETTY_FUNCTION__); })); ((void)sizeof((entry_close != ((void *)0)) ? 1 : 0), __extension__({ if (entry_close != ((void *)0)) ; else __assert_fail("entry_close != NULL", "tree.c", 1271, __extension__ __PRETTY_FUNCTION__); })); ((void)sizeof((entry_print != ((void *)0)) ? 1 : 0), __extension__({ if (entry_print != ((void *)0)) ; else __assert_fail("entry_print != NULL", "tree.c", 1272, __extension__ __PRETTY_FUNCTION__); })); parse_openparen(entry_open, argv, &argc); last_pred->p_name = "("; predicates->artificial = 1; parse_begin_user_args(argv, argc, last_pred, predicates); pred_sanity_check(last_pred); while (i < argc) { state.already_issued_stat_error_msg = 0; if (!looks_like_expression(argv[i], 0)) { error(0, 0, gettext("paths must precede expression: `%s'"), argv[i]); if (access(argv[i], 0) == 0) error(0, 0, gettext("possible unquoted pattern after predicate `%s'?"), last_pred->p_name); exit(1); } predicate_name = argv[i]; parse_entry = find_parser(predicate_name); if (parse_entry == ((void *)0)) { ((!!sizeof(struct { _Static_assert(1, "verify_expr (" "1" ", " "(error (1, 0, gettext (\"unknown predicate `%s'\"), " "predicate_name), assume (false))" ")"); int _gl_dummy; })) ? ((error(1, 0, gettext("unknown predicate `%s'"), predicate_name), ((0) ? (void)0 : __builtin_unreachable()))) : ((error(1, 0, gettext("unknown predicate `%s'"), predicate_name), ((0) ? (void)0 : __builtin_unreachable())))); } if (parse_entry->type != ARG_SPECIAL_PARSE) { i++; } oldi = i; if (!(*(parse_entry->parser_func))(parse_entry, argv, &i)) { if (argv[i]) { if ((ARG_SPECIAL_PARSE == parse_entry->type) && (i == oldi)) { ((!!sizeof(struct { _Static_assert(1, "verify_expr (" "1" ", " "(error (1, 0, gettext (\"invalid predicate " "`%s'\"), predicate_name), assume (false))" ")"); int _gl_dummy; })) ? ((error(1, 0, gettext("invalid predicate `%s'"), predicate_name), ((0) ? (void)0 : __builtin_unreachable()))) : ((error(1, 0, gettext("invalid predicate `%s'"), predicate_name), ((0) ? (void)0 : __builtin_unreachable())))); } else { ((!!sizeof(struct { _Static_assert(1, "verify_expr (" "1" ", " "(error (1, 0, gettext (\"invalid argument `%s' to " "`%s'\"), argv[i], predicate_name), assume (false))" ")"); int _gl_dummy; })) ? ((error(1, 0, gettext("invalid argument `%s' to `%s'"), argv[i], predicate_name), ((0) ? (void)0 : __builtin_unreachable()))) : ((error(1, 0, gettext("invalid argument `%s' to `%s'"), argv[i], predicate_name), ((0) ? (void)0 : __builtin_unreachable())))); } } else { ((!!sizeof(struct { _Static_assert(1, "verify_expr (" "1" ", " "(error (1, 0, gettext (\"missing argument to " "`%s'\"), predicate_name), assume (false))" ")"); int _gl_dummy; })) ? ((error(1, 0, gettext("missing argument to `%s'"), predicate_name), ((0) ? (void)0 : __builtin_unreachable()))) : ((error(1, 0, gettext("missing argument to `%s'"), predicate_name), ((0) ? (void)0 : __builtin_unreachable())))); } } else { last_pred->p_name = predicate_name; if (i != oldi) last_pred->arg_text = argv[oldi]; else last_pred->arg_text = ((void *)0); } pred_sanity_check(last_pred); pred_sanity_check(predicates); } parse_end_user_args(argv, argc, last_pred, predicates); if (predicates->pred_next == ((void *)0)) { cur_pred = predicates; predicates = last_pred = predicates->pred_next; free(cur_pred); parse_print(entry_print, argv, &argc); last_pred->p_name = "-print"; pred_sanity_check(last_pred); pred_sanity_check(predicates); } else if (!default_prints(predicates->pred_next)) { cur_pred = predicates; predicates = predicates->pred_next; pred_sanity_check(predicates); free(cur_pred); } else { parse_closeparen(entry_close, argv, &argc); last_pred->p_name = ")"; last_pred->artificial = 1; pred_sanity_check(last_pred); parse_print(entry_print, argv, &argc); last_pred->p_name = "-print"; last_pred->artificial = 1; pred_sanity_check(last_pred); pred_sanity_check(predicates); } if (options.debug_options & (DebugExpressionTree | DebugTreeOpt)) { fprintf(stderr, "Predicate List:\n"); print_list(stderr, predicates); } check_option_combinations(predicates); pred_sanity_check(predicates); cur_pred = predicates; eval_tree = get_expr(&cur_pred, NO_PREC, ((void *)0)); calculate_derived_rates(eval_tree); if (cur_pred != ((void *)0)) { if ((((cur_pred)->pred_func) == (pred_closeparen))) { ((!!sizeof(struct { _Static_assert(1, "verify_expr (" "1" ", " "(error (1, 0, gettext (\"you have too many ')'\")), " "assume (false))" ")"); int _gl_dummy; })) ? ((error(1, 0, gettext("you have too many ')'")), ((0) ? (void)0 : __builtin_unreachable()))) : ((error(1, 0, gettext("you have too many ')'")), ((0) ? (void)0 : __builtin_unreachable())))); } else { if (cur_pred->p_name) ((!!sizeof(struct { _Static_assert(1, "verify_expr (" "1" ", " "(error (1, 0, gettext (\"unexpected extra predicate " "'%s'\"), cur_pred->p_name), assume (false))" ")"); int _gl_dummy; })) ? ((error(1, 0, gettext("unexpected extra predicate '%s'"), cur_pred->p_name), ((0) ? (void)0 : __builtin_unreachable()))) : ((error(1, 0, gettext("unexpected extra predicate '%s'"), cur_pred->p_name), ((0) ? (void)0 : __builtin_unreachable())))); else ((!!sizeof(struct { _Static_assert(1, "verify_expr (" "1" ", " "(error (1, 0, gettext (\"unexpected extra " "predicate\")), assume (false))" ")"); int _gl_dummy; })) ? ((error(1, 0, gettext("unexpected extra predicate")), ((0) ? (void)0 : __builtin_unreachable()))) : ((error(1, 0, gettext("unexpected extra predicate")), ((0) ? (void)0 : __builtin_unreachable())))); } } if (options.debug_options & (DebugExpressionTree | DebugTreeOpt)) { fprintf(stderr, "Eval Tree:\n"); print_tree(stderr, eval_tree, 0); } estimate_costs(eval_tree); opt_expr(&eval_tree); check_normalization(eval_tree, 1); do_arm_swaps(eval_tree); check_normalization(eval_tree, 1); if (options.debug_options & (DebugExpressionTree | DebugTreeOpt)) { fprintf(stderr, "Optimized Eval Tree:\n"); print_tree(stderr, eval_tree, 0); fprintf(stderr, "Optimized command line:\n"); print_optlist(stderr, eval_tree); fprintf(stderr, "\n"); } return eval_tree; }
undefined8 build_expression_tree(int param_1, long param_2, int param_3) { long lVar1; long *__ptr; char cVar2; int iVar3; undefined8 uVar4; undefined8 uVar5; long in_FS_OFFSET; int local_5c; int local_58; int local_54; long *local_50; long local_48; long local_40; long local_38; long local_30; int *local_28; long local_20; local_20 = *(long *)(in_FS_OFFSET + 0x28); predicates = (long *)0x0; start_points = param_2 + (long)param_3 * 8; local_5c = param_1; for (local_58 = param_3; local_58 < local_5c; local_58 = local_58 + 1) { cVar2 = looks_like_expression(*(undefined8 *)(param_2 + (long)local_58 * 8), 1); if (cVar2 == '\x01') break; num_start_points = num_start_points + 1; } local_48 = find_parser(&DAT_001037c5); local_40 = find_parser(&DAT_001037c7); local_38 = find_parser("print"); if (local_48 == 0) { __assert_fail("entry_open != NULL", "tree.c", 0x4f6, "build_expression_tree"); } if (local_40 == 0) { __assert_fail("entry_close != NULL", "tree.c", 0x4f7, "build_expression_tree"); } if (local_38 == 0) { __assert_fail("entry_print != NULL", "tree.c", 0x4f8, "build_expression_tree"); } parse_openparen(local_48, param_2, &local_5c); last_pred[1] = (long)&DAT_001037c5; *(undefined *)((long)predicates + 0x29) = 1; parse_begin_user_args(param_2, local_5c, last_pred, predicates); pred_sanity_check(last_pred); while (local_58 < local_5c) { parse_closeparen = (code)0x0; cVar2 = looks_like_expression(*(undefined8 *)(param_2 + (long)local_58 * 8), 0); if (cVar2 != '\x01') { uVar5 = *(undefined8 *)(param_2 + (long)local_58 * 8); uVar4 = gettext("paths must precede expression: `%s\'"); error(0, 0, uVar4, uVar5); iVar3 = access(*(char **)(param_2 + (long)local_58 * 8), 0); if (iVar3 == 0) { lVar1 = last_pred[1]; uVar5 = gettext("possible unquoted pattern after predicate `%s\'?"); error(0, 0, uVar5, lVar1); } exit(1); } local_30 = *(long *)(param_2 + (long)local_58 * 8); local_28 = (int *)find_parser(local_30); if (local_28 == (int *)0x0) { uVar5 = gettext("unknown predicate `%s\'"); error(1, 0, uVar5, local_30); } if (*local_28 != 4) { local_58 = local_58 + 1; } local_54 = local_58; cVar2 = (**(code **)(local_28 + 4))(local_28, param_2, &local_58); if (cVar2 != '\x01') { if (*(long *)(param_2 + (long)local_58 * 8) != 0) { if ((*local_28 == 4) && (local_54 == local_58)) { uVar5 = gettext("invalid predicate `%s\'"); error(1, 0, uVar5, local_30); } uVar5 = *(undefined8 *)(param_2 + (long)local_58 * 8); uVar4 = gettext("invalid argument `%s\' to `%s\'"); error(1, 0, uVar4, uVar5, local_30); } uVar5 = gettext("missing argument to `%s\'"); error(1, 0, uVar5, local_30); } last_pred[1] = local_30; if (local_54 == local_58) { last_pred[6] = 0; } else { last_pred[6] = *(long *)((long)local_54 * 8 + param_2); } pred_sanity_check(last_pred); pred_sanity_check(predicates); } parse_end_user_args(param_2, local_5c, last_pred, predicates); __ptr = predicates; if (predicates[0x21] == 0) { local_50 = predicates; predicates = (long *)predicates[0x21]; last_pred = predicates; free(__ptr); parse_print(local_38, param_2, &local_5c); last_pred[1] = (long)"-print"; pred_sanity_check(last_pred); pred_sanity_check(predicates); } else { cVar2 = default_prints(predicates[0x21]); if (cVar2 == '\x01') { parse_closeparen(local_40, param_2, &local_5c); last_pred[1] = (long)&DAT_001037c7; *(undefined *)((long)last_pred + 0x29) = 1; pred_sanity_check(last_pred); parse_print(local_38, param_2, &local_5c); last_pred[1] = (long)"-print"; *(undefined *)((long)last_pred + 0x29) = 1; pred_sanity_check(last_pred); pred_sanity_check(predicates); } else { local_50 = predicates; predicates = (long *)predicates[0x21]; pred_sanity_check(predicates); free(local_50); } } if ((pred_regex & 9) != 0) { fprintf(stderr, "Predicate List:\n"); print_list(stderr, predicates); } check_option_combinations(predicates); pred_sanity_check(predicates); local_50 = predicates; eval_tree = get_expr(&local_50, 0, 0); calculate_derived_rates(eval_tree); if (local_50 != (long *)0x0) { if (*local_50 == lRam0000000000102748) { uVar5 = gettext("you have too many \')\'"); error(1, 0, uVar5); } if (local_50[1] != 0) { lVar1 = local_50[1]; uVar5 = gettext("unexpected extra predicate \'%s\'"); error(1, 0, uVar5, lVar1); } uVar5 = gettext("unexpected extra predicate"); error(1, 0, uVar5); } if ((pred_regex & 9) != 0) { fprintf(stderr, "Eval Tree:\n"); print_tree(stderr, eval_tree, 0); } estimate_costs(eval_tree); opt_expr(&eval_tree); check_normalization(eval_tree, 1); do_arm_swaps(eval_tree); check_normalization(eval_tree, 1); if ((pred_regex & 9) != 0) { fprintf(stderr, "Optimized Eval Tree:\n"); print_tree(stderr, eval_tree, 0); fprintf(stderr, "Optimized command line:\n"); print_optlist(stderr, eval_tree); fprintf(stderr, "\n"); } if (local_20 != *(long *)(in_FS_OFFSET + 0x28)) { __stack_chk_fail(); } return eval_tree; }
findutils
ghidra
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]... STRING1 [STRING2]\n") , program_name); fputs_unlocked( gettext( "Translate, squeeze, and/or delete characters from standard " "input,\nwriting to standard output. STRING1 and STRING2 specify " "arrays of\ncharacters ARRAY1 and ARRAY2 that control the " "action.\n\n -c, -C, --complement use the complement of " "ARRAY1\n -d, --delete delete characters in ARRAY1, do " "not translate\n -s, --squeeze-repeats replace each sequence of " "a repeated character\n that is listed " "in the last specified ARRAY,\n with a " "single occurrence of that character\n -t, --truncate-set1 " "first truncate ARRAY1 to length of ARRAY2\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("\nARRAYs are specified as strings of characters. Most " "represent themselves.\nInterpreted sequences are:\n\n \\NNN " " character with octal value NNN (1 to 3 octal " "digits)\n \\\\ backslash\n \\a " "audible BEL\n \\b backspace\n \\f " "form feed\n \\n new line\n \\r " "return\n \\t horizontal tab\n"), stdout); fputs_unlocked( gettext( " \\v vertical tab\n CHAR1-CHAR2 all characters " "from CHAR1 to CHAR2 in ascending order\n [CHAR*] in " "ARRAY2, copies of CHAR until length of ARRAY1\n [CHAR*REPEAT] " "REPEAT copies of CHAR, REPEAT octal if starting with 0\n " "[:alnum:] all letters and digits\n [:alpha:] all " "letters\n [:blank:] all horizontal whitespace\n [:cntrl:] " " all control characters\n [:digit:] all digits\n"), stdout); fputs_unlocked( gettext( " [:graph:] all printable characters, not including space\n " " [:lower:] all lower case letters\n [:print:] all " "printable characters, including space\n [:punct:] all " "punctuation characters\n [:space:] all horizontal or " "vertical whitespace\n [:upper:] all upper case letters\n " "[:xdigit:] all hexadecimal digits\n [=CHAR=] all " "characters which are equivalent to CHAR\n"), stdout); fputs_unlocked( gettext( "\nTranslation occurs if -d is not given and both STRING1 and " "STRING2 appear.\n-t may be used only when translating. ARRAY2 is " "extended to length of\nARRAY1 by repeating its last character as " "necessary. Excess characters\nof ARRAY2 are ignored. Character " "classes expand in unspecified order;\nwhile translating, " "[:lower:] and [:upper:] may be used in pairs to\nspecify case " "conversion. Squeezing occurs after translation or deletion.\n"), stdout) ; emit_ancillary_info("tr"); } exit(status); }
void usage(int a1) { long v1; char *v2; char *v3; FILE *v4; char *v5; FILE *v6; char *v7; FILE *v8; char *v9; FILE *v10; char *v11; FILE *v12; char *v13; FILE *v14; char *v15; FILE *v16; char *v17; v1 = program_name; if (a1) { v2 = gettext("Try '%s --help' for more information.\n"); fprintf(stderr, v2, v1); } else { v3 = gettext("Usage: %s [OPTION]... STRING1 [STRING2]\n"); printf(v3, v1); v4 = stdout; v5 = gettext( "Translate, squeeze, and/or delete characters from standard input,\n" "writing to standard output. STRING1 and STRING2 specify arrays of\n" "characters ARRAY1 and ARRAY2 that control the action.\n" "\n" " -c, -C, --complement use the complement of ARRAY1\n" " -d, --delete delete characters in ARRAY1, do not " "translate\n" " -s, --squeeze-repeats replace each sequence of a repeated " "character\n" " that is listed in the last specified " "ARRAY,\n" " with a single occurrence of that " "character\n" " -t, --truncate-set1 first truncate ARRAY1 to length of " "ARRAY2\n"); fputs_unlocked(v5, v4); v6 = stdout; v7 = gettext(" --help display this help and exit\n"); fputs_unlocked(v7, v6); v8 = stdout; v9 = gettext(" --version output version information and exit\n"); fputs_unlocked(v9, v8); v10 = stdout; v11 = gettext("\n" "ARRAYs are specified as strings of characters. Most " "represent themselves.\n" "Interpreted sequences are:\n" "\n" " \\NNN character with octal value NNN (1 to 3 " "octal digits)\n" " \\\\ backslash\n" " \\a audible BEL\n" " \\b backspace\n" " \\f form feed\n" " \\n new line\n" " \\r return\n" " \\t horizontal tab\n"); fputs_unlocked(v11, v10); v12 = stdout; v13 = gettext( " \\v vertical tab\n" " CHAR1-CHAR2 all characters from CHAR1 to CHAR2 in ascending " "order\n" " [CHAR*] in ARRAY2, copies of CHAR until length of ARRAY1\n" " [CHAR*REPEAT] REPEAT copies of CHAR, REPEAT octal if starting " "with 0\n" " [:alnum:] all letters and digits\n" " [:alpha:] all letters\n" " [:blank:] all horizontal whitespace\n" " [:cntrl:] all control characters\n" " [:digit:] all digits\n"); fputs_unlocked(v13, v12); v14 = stdout; v15 = gettext( " [:graph:] all printable characters, not including space\n" " [:lower:] all lower case letters\n" " [:print:] all printable characters, including space\n" " [:punct:] all punctuation characters\n" " [:space:] all horizontal or vertical whitespace\n" " [:upper:] all upper case letters\n" " [:xdigit:] all hexadecimal digits\n" " [=CHAR=] all characters which are equivalent to CHAR\n"); fputs_unlocked(v15, v14); v16 = stdout; v17 = gettext( "\n" "Translation occurs if -d is not given and both STRING1 and STRING2 " "appear.\n" "-t may be used only when translating. ARRAY2 is extended to length " "of\n" "ARRAY1 by repeating its last character as necessary. Excess " "characters\n" "of ARRAY2 are ignored. Character classes expand in unspecified " "order;\n" "while translating, [:lower:] and [:upper:] may be used in pairs to\n" "specify case conversion. Squeezing occurs after translation or " "deletion.\n"); fputs_unlocked(v17, v16); emit_ancillary_info("tr"); } exit(a1); }
coreutils
ida
static void shtimer_zero(sh_timer *t) { t->tmout.tv_sec = 0; t->tmout.tv_usec = 0; t->fd = -1; t->flags = t->alrmflag = 0; t->alrm_handler = t->old_handler = 0; memset(t->jmpenv, '\0', sizeof(t->jmpenv)); t->tm_handler = 0; t->data = 0; }
void shtimer_zero(undefined8 *param_1) { *param_1 = 0; param_1[1] = 0; *(undefined4 *)(param_1 + 2) = 0xffffffff; *(undefined4 *)(param_1 + 3) = 0; *(undefined4 *)((long)param_1 + 0x14) = *(undefined4 *)(param_1 + 3); param_1[5] = 0; param_1[4] = param_1[5]; memset(param_1 + 6, 0, 200); param_1[0x1f] = 0; param_1[0x20] = 0; return; }
bash
ghidra
static int rmmod_all(struct kmod_ctx *ctx, char **args, int nargs) { int i, err = 0; for (i = 0; i < nargs; i++) { int r = rmmod(ctx, args[i]); if (r < 0) err = r; } return err; }
int rmmod_all(unsigned long long a0, unsigned long long *a1, unsigned long a2) { unsigned int v0; unsigned int v1; unsigned int v2; v1 = 0; for (v0 = 0; v0 < a2; v0 += 1) { v2 = rmmod(a0, a1[v0]); if (v2 < 0) v1 = v2; } return v1; }
kmod
angr_dream
static void process_add_smartcard_key(SocketEntry *e) { char *provider = ((void *)0), *pin = ((void *)0), canonical_provider[4096]; char **comments = ((void *)0); int r, i, count = 0, success = 0, confirm = 0; u_int seconds = 0; time_t death = 0; struct sshkey **keys = ((void *)0), *k; Identity *id; struct dest_constraint *dest_constraints = ((void *)0); size_t ndest_constraints = 0; sshlog("ssh-agent.c", __func__, 1385, 1, SYSLOG_LEVEL_DEBUG2, ((void *)0), "entering"); if ((r = sshbuf_get_cstring(e->request, &provider, ((void *)0))) != 0 || (r = sshbuf_get_cstring(e->request, &pin, ((void *)0))) != 0) { sshlog("ssh-agent.c", __func__, 1388, 1, SYSLOG_LEVEL_ERROR, ssh_err(r), "parse"); goto send; } if (parse_key_constraints(e->request, ((void *)0), &death, &seconds, &confirm, ((void *)0), &dest_constraints, &ndest_constraints) != 0) { sshlog("ssh-agent.c", __func__, 1393, 1, SYSLOG_LEVEL_ERROR, ((void *)0), "failed to parse constraints"); goto send; } if (realpath(provider, canonical_provider) == ((void *)0)) { sshlog("ssh-agent.c", __func__, 1397, 0, SYSLOG_LEVEL_VERBOSE, ((void *)0), "failed PKCS#11 add of \"%.100s\": realpath: %s", provider, strerror((*__errno_location()))); goto send; } if (match_pattern_list(canonical_provider, allowed_providers, 0) != 1) { sshlog("ssh-agent.c", __func__, 1402, 0, SYSLOG_LEVEL_VERBOSE, ((void *)0), "refusing PKCS#11 add of \"%.100s\": " "provider not allowed", canonical_provider); goto send; } sshlog("ssh-agent.c", __func__, 1406, 1, SYSLOG_LEVEL_DEBUG1, ((void *)0), "add %.100s", canonical_provider); if (lifetime && !death) death = monotime() + lifetime; count = pkcs11_add_provider(canonical_provider, pin, &keys, &comments); for (i = 0; i < count; i++) { k = keys[i]; if (lookup_identity(k) == ((void *)0)) { id = xcalloc(1, sizeof(Identity)); id->key = k; keys[i] = ((void *)0); id->provider = xstrdup(canonical_provider); if (*comments[i] != '\0') { id->comment = comments[i]; comments[i] = ((void *)0); } else { id->comment = xstrdup(canonical_provider); } id->death = death; id->confirm = confirm; id->dest_constraints = dest_constraints; id->ndest_constraints = ndest_constraints; dest_constraints = ((void *)0); ndest_constraints = 0; do { (id)->next.tqe_next = ((void *)0); (id)->next.tqe_prev = (&idtab->idlist)->tqh_last; *(&idtab->idlist)->tqh_last = (id); (&idtab->idlist)->tqh_last = &(id)->next.tqe_next; } while (0); idtab->nentries++; success = 1; } sshkey_free(keys[i]); free(comments[i]); } send: free(pin); free(provider); free(keys); free(comments); free_dest_constraints(dest_constraints, ndest_constraints); send_status(e, success); }
void process_add_smartcard_key(struct_1 *a0) { char v0; char v1; unsigned int v2; unsigned int v3; unsigned int v4; unsigned int v5; unsigned int v6; unsigned int v7; void *v8; void *v9; void *v10; void *v11; void *v12; void *v13; void *v14; unsigned long long v15; struct_0 *v16; char v17; char v18; char v19; unsigned long long v21; unsigned long long *v22; unsigned long long v23; v18 = *(&v18); v8 = 0; v9 = 0; v10 = 0; v7 = 0; v6 = 0; v2 = 0; v3 = 0; v11 = 0; v12 = 0; v13 = 0; v14 = 0; sshlog("ssh-agent.c", "process_add_smartcard_key", 0x569, 0x1, 0x6, 0x0, "entering", *(&v0), *(&v1), a0, *(&v2)); v4 = sshbuf_get_cstring(a0->field_18, &v8, 0x0, &v8); if (v4) { LABEL_404a83: sshlog("ssh-agent.c", "process_add_smartcard_key", 0x56c, 0x1, 0x2, ssh_err(v4), "parse", *(&v0), *(&v1), a0, *(&v2)); } else { v4 = sshbuf_get_cstring(a0->field_18, &v9, 0x0, &v9); if (!(!v4)) goto LABEL_404a83; if (parse_key_constraints(a0->field_18, 0x0, &v11, &v3, &v2, 0x0, &v13, &v14)) { sshlog("ssh-agent.c", "process_add_smartcard_key", 0x571, 0x1, 0x2, 0x0, "failed to parse constraints", &v14, *(&v1), a0, *(&v2)); } else if (!realpath(v8, &v17)) { sshlog("ssh-agent.c", "process_add_smartcard_key", 0x575, 0x0, 0x4, 0x0, "failed PKCS#11 add of \"%.100s\": realpath: %s", v8, strerror(*(__errno_location())), &v14, *(&v1)); } else if (match_pattern_list(&v17, allowed_providers, 0x0, allowed_providers) != 1) { sshlog("ssh-agent.c", "process_add_smartcard_key", 0x57a, 0x0, 0x4, 0x0, "refusing PKCS#11 add of \"%.100s\": provider not allowed", &v17, *(&v1), a0, *(&v2)); } else { sshlog("ssh-agent.c", "process_add_smartcard_key", 0x57e, 0x1, 0x5, 0x0, "add %.100s", &v17, *(&v1), a0, *(&v2)); if (lifetime && !v11) { v21 = monotime(); v11 = __addvdi3(v21, lifetime, v21); } v7 = pkcs11_add_provider(&v17, v9, &v12, &v10); for (v5 = 0; v5 < v7; v5 = __addvsi3(v5, 0x1)) { v15 = *((v12 + 8 * v5)); if (!lookup_identity(v15)) { v16 = xcalloc(0x1, 0x50); v16->field_10 = v15; *((v12 + 8 * v5)) = 0; v16->field_20 = xstrdup(&v17); if (*(*((v10 + 8 * v5)))) { v16->field_18 = *((v10 + 8 * v5)); *((v10 + 8 * v5)) = 0; } else { v16->field_18 = xstrdup(&v17); } v16->field_28 = v11; v16->field_30 = v2; v16->field_40 = v13; v16->field_48 = v14; v13 = 0; v14 = 0; v16->field_0 = 0; v16->field_8 = g_e87d894820ec8358; g_e87d894820ec8358->field_0 = v16; g_e87d894820ec8358 = v16; g_e87d894820ec8348 = __addvsi3(g_e87d894820ec8348, 0x1); v6 = 1; } sshkey_free(*((v12 + 8 * v5))); free(*((v10 + 8 * v5))); } } } free(v9); free(v8); free(v12); free(v10); free_dest_constraints(v13, v14); send_status(a0, v6); v23 = *(&v19) ^ v22[5]; return; }
openssh-portable
angr_phoenix
static int input_service_request(int type, u_int32_t seq, struct ssh *ssh) { Authctxt *authctxt = ssh->authctxt; char *service = ((void *)0); int r, acceptit = 0; if ((r = sshpkt_get_cstring(ssh, &service, ((void *)0))) != 0 || (r = sshpkt_get_end(ssh)) != 0) goto out; if (authctxt == ((void *)0)) sshfatal("auth2.c", __func__, 194, 0, SYSLOG_LEVEL_FATAL, ((void *)0), "input_service_request: no authctxt"); if (strcmp(service, "ssh-userauth") == 0) { if (!authctxt->success) { acceptit = 1; ssh_dispatch_set(ssh, 50, &input_userauth_request); } } if (acceptit) { if ((r = sshpkt_start(ssh, 6)) != 0 || (r = sshpkt_put_cstring(ssh, service)) != 0 || (r = sshpkt_send(ssh)) != 0 || (r = ssh_packet_write_wait(ssh)) != 0) goto out; } else { sshlog("auth2.c", __func__, 213, 0, SYSLOG_LEVEL_DEBUG1, ((void *)0), "bad service request %s", service); ssh_packet_disconnect(ssh, "bad service request %s", service); } r = 0; out: free(service); return r; }
long long input_service_request(unsigned long a0, unsigned long a1, struct_0 *a2) { unsigned long long v0; unsigned int v1; unsigned int v2; unsigned int v3; unsigned int v4; void *v5; unsigned int *v6; unsigned long long v7; void *v8; char v9; v2 = a0; v1 = a1; v6 = a2->field_860; v5 = 0; v4 = 0; v3 = sshpkt_get_cstring(a2, &v5, 0x0, &v5); if (!v3) { v3 = sshpkt_get_end(a2); if (!v3) { if (!v6) { v0 = "input_service_request: no authctxt"; sshfatal("auth2.c", "input_service_request", 0xc2, 0x0, 0x1, 0x0); } if (!strcmp(v5, "ssh-userauth") && !*(v6)) { v4 = 1; ssh_dispatch_set(a2, 0x32, input_userauth_request); } if (v4) { v3 = sshpkt_start(a2, 0x6); if (!v3) { v3 = sshpkt_put_cstring(a2, v5, v5); if (!v3) { v3 = sshpkt_send(a2); if (!v3) v3 = ssh_packet_write_wait(a2); } } } else { v8 = v5; v7 = "bad service request %s"; sshlog("auth2.c", "input_service_request", 0xd5, 0x0, 0x5, 0x0, *(&v9)); ssh_packet_disconnect(a2, "bad service request %s", v5); } if (!v4 || !v3 && !v3 && !v3 && !v3) v3 = 0; } } free(v5); return v3; }
openssh-portable
angr_dream
static inline __u16 rta_getattr_u16(const struct rtattr *rta) { return *(__u16 *)(( void *)(((char *)(rta)) + ((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0)))); }
long rta_getattr_u16(long a1) { return *(unsigned short *)(a1 + 4); }
iproute2-6.0.0
ida
static inline void setInstParamDefaults(instanceData *pData) { pData->bIsWall = 0; pData->tplName = ((void *)0); }
long setInstParamDefaults(long a1) { long result; *(_DWORD *)a1 = 0; result = a1; *(_QWORD *)(a1 + 664) = 0LL; return result; }
rsyslog-8.2210.0
ida
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 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 *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; for (v1[0] = &v4; v1[0] && strcmp(a0, v1[0]); 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: *(&v3) = (!strcmp(a0, "[") ? a0 : "test"); 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_sailr
static int do_lsreaddir(struct sftp_conn *conn, const char *path, int print_flag, SFTP_DIRENT ***dir) { struct sshbuf *msg; u_int count, id, i, expected_id, ents = 0; size_t handle_len; u_char type, *handle; int status = 4; int r; if (dir) *dir = ((void *)0); id = conn->msg_id++; if ((msg = sshbuf_new()) == ((void *)0)) sshfatal("sftp-client.c", __func__, 707, 1, SYSLOG_LEVEL_FATAL, ((void *)0), "sshbuf_new failed"); if ((r = sshbuf_put_u8(msg, 11)) != 0 || (r = sshbuf_put_u32(msg, id)) != 0 || (r = sshbuf_put_cstring(msg, path)) != 0) sshfatal("sftp-client.c", __func__, 711, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "compose OPENDIR"); send_msg(conn, msg); handle = get_handle(conn, id, &handle_len, "remote readdir(\"%s\")", path); if (handle == ((void *)0)) { sshbuf_free(msg); return -1; } if (dir) { ents = 0; *dir = xcalloc(1, sizeof(**dir)); (*dir)[0] = ((void *)0); } for (; !interrupted;) { id = expected_id = conn->msg_id++; sshlog("sftp-client.c", __func__, 730, 0, SYSLOG_LEVEL_DEBUG3, ((void *)0), "Sending SSH2_FXP_READDIR I:%u", id); sshbuf_reset(msg); if ((r = sshbuf_put_u8(msg, 12)) != 0 || (r = sshbuf_put_u32(msg, id)) != 0 || (r = sshbuf_put_string(msg, handle, handle_len)) != 0) sshfatal("sftp-client.c", __func__, 736, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "compose READDIR"); send_msg(conn, msg); sshbuf_reset(msg); get_msg(conn, msg); if ((r = sshbuf_get_u8(msg, &type)) != 0 || (r = sshbuf_get_u32(msg, &id)) != 0) sshfatal("sftp-client.c", __func__, 745, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "parse"); sshlog("sftp-client.c", __func__, 747, 0, SYSLOG_LEVEL_DEBUG3, ((void *)0), "Received reply T:%u I:%u", type, id); if (id != expected_id) sshfatal("sftp-client.c", __func__, 750, 0, SYSLOG_LEVEL_FATAL, ((void *)0), "ID mismatch (%u != %u)", id, expected_id); if (type == 101) { u_int rstatus; if ((r = sshbuf_get_u32(msg, &rstatus)) != 0) sshfatal("sftp-client.c", __func__, 756, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "parse status"); sshlog("sftp-client.c", __func__, 757, 0, SYSLOG_LEVEL_DEBUG3, ((void *)0), "Received SSH2_FXP_STATUS %d", rstatus); if (rstatus == 1) break; sshlog("sftp-client.c", __func__, 760, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "Couldn't read directory: %s", fx2txt(rstatus)); goto out; } else if (type != 104) sshfatal("sftp-client.c", __func__, 763, 0, SYSLOG_LEVEL_FATAL, ((void *)0), "Expected SSH2_FXP_NAME(%u) packet, got %u", 104, type); if ((r = sshbuf_get_u32(msg, &count)) != 0) sshfatal("sftp-client.c", __func__, 767, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "parse count"); if (count > 0x8000000) sshfatal("sftp-client.c", __func__, 769, 1, SYSLOG_LEVEL_FATAL, ((void *)0), "nonsensical number of entries"); if (count == 0) break; sshlog("sftp-client.c", __func__, 772, 0, SYSLOG_LEVEL_DEBUG3, ((void *)0), "Received %d SSH2_FXP_NAME responses", count); for (i = 0; i < count; i++) { char *filename, *longname; Attrib a; if ((r = sshbuf_get_cstring(msg, &filename, ((void *)0))) != 0 || (r = sshbuf_get_cstring(msg, &longname, ((void *)0))) != 0) sshfatal("sftp-client.c", __func__, 781, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "parse filenames"); if ((r = decode_attrib(msg, &a)) != 0) { sshlog("sftp-client.c", __func__, 783, 1, SYSLOG_LEVEL_ERROR, ssh_err(r), "couldn't decode attrib"); free(filename); free(longname); goto out; } if (print_flag) mprintf("%s\n", longname); if (strpbrk(filename, "/") != ((void *)0)) { sshlog("sftp-client.c", __func__, 798, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "Server sent suspect path \"%s\" " "during readdir of \"%s\"", filename, path); } else if (dir) { *dir = xreallocarray(*dir, ents + 2, sizeof(**dir)); (*dir)[ents] = xcalloc(1, sizeof(***dir)); (*dir)[ents]->filename = xstrdup(filename); (*dir)[ents]->longname = xstrdup(longname); memcpy(&(*dir)[ents]->a, &a, sizeof(a)); (*dir)[++ents] = ((void *)0); } free(filename); free(longname); } } status = 0; out: sshbuf_free(msg); do_close(conn, handle, handle_len); free(handle); if (status != 0 && dir != ((void *)0)) { free_sftp_dirents(*dir); *dir = ((void *)0); } else if (interrupted && dir != ((void *)0) && *dir != ((void *)0)) { free_sftp_dirents(*dir); *dir = xcalloc(1, sizeof(**dir)); **dir = ((void *)0); } return status == 0 ? 0 : -1; }
void do_lsreaddir(struct_1 *a0, unsigned long a1, unsigned long a2, unsigned long long **a3) { struct_1 *v0; int tmp_13; int tmp_23; char v1; char v2; unsigned int v3; unsigned int v4; unsigned int v5; unsigned int v6; unsigned int v7; unsigned int v8; char v9; char v10; char v11; unsigned long long v12; void *v13; char v14; unsigned long long v15; unsigned long long v16; unsigned long long v17; unsigned long v18; char v19; unsigned int v21; unsigned long long v22; unsigned long v23; v0 = a0; v5 = 0; v6 = 4; if (a3) *(a3) = 0; tmp_13 = a0->field_18; a0->field_18 = a0->field_18 + 1; v3 = tmp_13; v12 = sshbuf_new(); if (!v12) sshfatal("sftp-client.c", "do_lsreaddir", 0x2c3, 0x1, 0x1, 0x0, "sshbuf_new failed"); v7 = sshbuf_put_u8(v12, 0xb, 0x2c3); if (v7) { LABEL_4029ad: v17 = "compose OPENDIR"; sshfatal("sftp-client.c", "do_lsreaddir", 0x2c7, 0x1, 0x1, ssh_err(v7), *(&v19)); } else { v7 = sshbuf_put_u32(v12, v3, v3); if (v7) { v17 = "compose OPENDIR"; sshfatal("sftp-client.c", "do_lsreaddir", 0x2c7, 0x1, 0x1, ssh_err(v7), *(&v19)); } else { v7 = sshbuf_put_cstring(v12, a1); if (!v7) goto LABEL_4029ee; goto LABEL_4029ad; } } LABEL_4029ee: send_msg(a0, v12); v13 = get_handle(a0, v3, &v9, "remote readdir(\"%s\")", a1, v21); if (!v13) { sshbuf_free(v12); v22 = 4294967295; return; } if (a3) { v5 = 0; *(a3) = xcalloc(0x1, 0x8); *(*(a3)) = 0; } while (true) { if (interrupted) { v6 = 0; break; } else { tmp_23 = a0->field_18; a0->field_18 = a0->field_18 + 1; v8 = tmp_23; v3 = v8; v18 = v3; v17 = "Sending SSH2_FXP_READDIR I:%u"; sshlog("sftp-client.c", "do_lsreaddir", 0x2da, 0x0, 0x7, 0x0, *(&v19)); sshbuf_reset(v12); v7 = sshbuf_put_u8(v12, 0xc, 0x2da); if (v7) { v17 = "compose READDIR"; sshfatal("sftp-client.c", "do_lsreaddir", 0x2e0, 0x1, 0x1, ssh_err(v7), *(&v19)); goto LABEL_402b94; } v7 = sshbuf_put_u32(v12, v3, v3); if (!v7) { v7 = sshbuf_put_string(v12, v13, *(&v9), v13); if (!v7) goto LABEL_402b94; } v17 = "compose READDIR"; sshfatal("sftp-client.c", "do_lsreaddir", 0x2e0, 0x1, 0x1, ssh_err(v7), *(&v19)); LABEL_402b94: send_msg(a0, v12); sshbuf_reset(v12); get_msg(a0, v12); v7 = sshbuf_get_u8(v12, &v1, &v1); if (v7 || (v7 = sshbuf_get_u32(v12, &v3, &v3), v7)) { v17 = "parse"; sshfatal("sftp-client.c", "do_lsreaddir", 0x2e9, 0x1, 0x1, ssh_err(v7), *(&v19)); } v17 = v3; v16 = v1; v15 = "Received reply T:%u I:%u"; sshlog("sftp-client.c", "do_lsreaddir", 0x2eb, 0x0, 0x7, 0x0, *(&v19)); if (v8 != v3) { v17 = v8; v16 = v3; v15 = "ID mismatch (%u != %u)"; sshfatal("sftp-client.c", "do_lsreaddir", 0x2ee, 0x0, 0x1, 0x0, *(&v19)); } switch (v1) { case 101: v7 = sshbuf_get_u32(v12, &v14, &v14); if (v7) { v17 = "parse status"; sshfatal("sftp-client.c", "do_lsreaddir", 0x2f4, 0x1, 0x1, ssh_err(v7), *(&v19)); } v18 = *(&v14); v17 = "Received SSH2_FXP_STATUS %d"; sshlog("sftp-client.c", "do_lsreaddir", 0x2f5, 0x0, 0x7, 0x0, *(&v19)); if (*(&v14) != 1) { v18 = fx2txt(*(&v14)); v17 = "Couldn't read directory: %s"; sshlog("sftp-client.c", "do_lsreaddir", 0x2f8, 0x0, 0x2, 0x0, *(&v19)); break; } case 104: LABEL_402e31: v7 = sshbuf_get_u32(v12, &v2, &v2); if (v7) { v17 = "parse count"; sshfatal("sftp-client.c", "do_lsreaddir", 0x2ff, 0x1, 0x1, ssh_err(v7), *(&v19)); } if (*(&v2) > 0x8000000) { v17 = "nonsensical number of entries"; sshfatal("sftp-client.c", "do_lsreaddir", 0x301, 0x1, 0x1, 0x0, *(&v19)); } if (*(&v2)) { v18 = *(&v2); v17 = "Received %d SSH2_FXP_NAME responses"; sshlog("sftp-client.c", "do_lsreaddir", 0x304, 0x0, 0x7, 0x0, *(&v19)); v4 = 0; while (true) { if (v4 >= *(&v2)) break; v7 = sshbuf_get_cstring(v12, &v10, 0x0, &v10); if (v7 || (v7 = sshbuf_get_cstring(v12, &v11, 0x0, &v11), v7)) { v17 = "parse filenames"; sshfatal("sftp-client.c", "do_lsreaddir", 0x30d, 0x1, 0x1, ssh_err(v7), *(&v19)); } v7 = decode_attrib(v12, &v14); if (v7) { v17 = "couldn't decode attrib"; sshlog("sftp-client.c", "do_lsreaddir", 0x30f, 0x1, 0x2, ssh_err(v7), *(&v19)); free(*(&v10)); free(*(&v11)); break; } else { if (a2) mprintf("%s\n", *(&v11)); if (strpbrk(*(&v10), "/")) { v17 = a1; v16 = *(&v10); v15 = "Server sent suspect path \"%s\" during readdir of \"%s\""; sshlog("sftp-client.c", "do_lsreaddir", 0x31e, 0x0, 0x2, 0x0, *(&v19)); } else if (a3) { *(a3) = xreallocarray(*(a3), v5 + 2, 0x8, v5 + 2); (*(a3))[v5] = xcalloc(0x1, 0x38); *((*(a3))[v5]) = xstrdup(*(&v10)); *(((*(a3))[v5] + 8)) = xstrdup(*(&v11)); memcpy((*(a3))[v5] + 16, &v14, 0x28); v5 += 1; (*(a3))[v5] = 0; } free(*(&v10)); free(*(&v11)); v4 += 1; } } } else { v6 = 0; break; } default: v17 = v1; v16 = 104; v15 = "Expected SSH2_FXP_NAME(%u) packet, got %u"; sshfatal("sftp-client.c", "do_lsreaddir", 0x2fb, 0x0, 0x1, 0x0, *(&v19)); goto LABEL_402e31; } } } sshbuf_free(v12); do_close(a0, v13, *(&v9)); free(v13); if (!(!v6 || !a3)) { free_sftp_dirents(*(a3)); *(a3) = 0; } else if (interrupted && a3 && *(a3)) { free_sftp_dirents(*(a3)); *(a3) = xcalloc(0x1, 0x8); *(*(a3)) = 0; } v23 = (!v6 ? 4294967295 : 0); return; }
openssh-portable
angr_sailr
sshbuf_ptr(state->input) + aadlen + need + authlen, maclen)) != 0) { if (r == -30) sshlog("packet.c", __func__, 1598, 0, SYSLOG_LEVEL_INFO, ((void *)0), "Corrupted MAC on input."); goto out; }
|| (v4 = sshbuf_ptr(*(_QWORD *)(v23 + 48)), (v14 = mac_compute(v21, *(unsigned int *)(v23 + 384), v4, v18, v24, 64LL)) == 0) ) { v5 = sshbuf_len(*(_QWORD *)(v23 + 48)); v14 = sshbuf_reserve(*(_QWORD *)(v23 + 40), v5 + v13, &v19); if (!v14) { v6 = sshbuf_ptr(*(_QWORD *)(v23 + 48)); v14 = cipher_crypt(*(_QWORD *)(v23 + 24), *(unsigned int *)(v23 + 384), v19, v6, v18 - v15, v15, v13); if (!v14 && (!v21 || !v21[2] || (!v21[8] || (v14 = mac_compute( v21, *(unsigned int *)(v23 + 384), v19, v18, v24, 64LL)) == 0) && (v14 = sshbuf_put(*(_QWORD *)(v23 + 40), v24, (unsigned int)v21[3])) == 0)) { if (!++*(_DWORD *)(v23 + 384)) sshlog("packet.c", "ssh_packet_send2_wrapped", 1209LL, 0LL, 3LL, 0LL, "outgoing seqnr wraps around"); if (!++*(_DWORD *)(v23 + 388) && (*(_DWORD *)(a1 + 2108) & 0x8000) == 0) return 4294967257LL; *(_QWORD *)(v23 + 392) += v18 / v16; *(_QWORD *)(v23 + 400) += v18; sshbuf_reset(*(_QWORD *)(v23 + 48)); if (v9 == 21) { return (unsigned int)ssh_set_newkeys((long *)a1, 1); } else if (v9 == 52 && *(_DWORD *)(v23 + 324)) { return (unsigned int)ssh_packet_enable_delayed_compress( (long *)a1); } else { return 0; } } } }
openssh-portable
ida
static size_t string_to_join_field(char const *str) { size_t result; uintmax_t val; strtol_error s_err = xstrtoumax(str, ((void *)0), 10, &val, ""); if (s_err == LONGINT_OVERFLOW || (s_err == LONGINT_OK && (18446744073709551615UL) < val)) val = (18446744073709551615UL); else if (s_err != LONGINT_OK || val == 0) ((!!sizeof(struct { _Static_assert(1, "verify_expr (" "1" ", " "(error (1, 0, gettext (\"invalid field number: %s\"), " "quote (str)), assume (false))" ")"); int _gl_dummy; })) ? ((error(1, 0, gettext("invalid field number: %s"), quote(str)), ((0) ? (void)0 : __builtin_unreachable()))) : ((error(1, 0, gettext("invalid field number: %s"), quote(str)), ((0) ? (void)0 : __builtin_unreachable())))); result = val - 1; return result; }
long string_to_join_field(long a1) { long v1; char *v2; int v4; long v5[5]; v5[2] = __readfsqword(0x28u); v4 = xstrtoumax(a1, 0LL, 10LL, v5, locale); if (v4 == 1) { v5[0] = -1LL; } else if (v4 || !v5[0]) { v1 = quote(a1); v2 = gettext("invalid field number: %s"); error(1, 0, v2, v1); } return v5[0] - 1; }
coreutils
ida
static void collect_ids_from_glob(_ssh_compat_glob_t *g, int user, u_int **idsp, u_int *nidsp) { u_int id, i, n = 0, *ids = ((void *)0); for (i = 0; g->gl_pathv[i] != ((void *)0); i++) { if (user) { if (ruser_name(g->gl_statv[i]->st_uid) != ((void *)0)) continue; id = (u_int)g->gl_statv[i]->st_uid; } else { if (rgroup_name(g->gl_statv[i]->st_gid) != ((void *)0)) continue; id = (u_int)g->gl_statv[i]->st_gid; } if (has_id(id, ids, n)) continue; ids = xrecallocarray(ids, n, n + 1, sizeof(*ids)); ids[n++] = id; } *idsp = ids; *nidsp = n; }
void collect_ids_from_glob(long param_1, int param_2, long *param_3, uint *param_4) { int iVar1; long lVar2; undefined4 local_1c; uint local_18; uint local_14; long local_10; local_14 = 0; local_10 = 0; local_18 = 0; do { if (*(long *)(*(long *)(param_1 + 0x20) + (ulong)local_18 * 8) == 0) { *param_3 = local_10; *param_4 = local_14; return; } if (param_2 == 0) { lVar2 = rgroup_name(*(undefined4 *)(*(long *)(*(long *)(param_1 + 0x28) + (ulong)local_18 * 8) + 0x20)); if (lVar2 == 0) { local_1c = *(undefined4 *)(*(long *)(*(long *)(param_1 + 0x28) + (ulong)local_18 * 8) + 0x20); goto LAB_00101788; } } else { lVar2 = ruser_name(); if (lVar2 == 0) { local_1c = *(undefined4 *)(*(long *)(*(long *)(param_1 + 0x28) + (ulong)local_18 * 8) + 0x1c); LAB_00101788: iVar1 = has_id(local_1c, local_10, local_14); if (iVar1 == 0) { local_10 = xrecallocarray(local_10, local_14, local_14 + 1, 4); *(undefined4 *)((ulong)local_14 * 4 + local_10) = local_1c; local_14 = local_14 + 1; } } } local_18 = local_18 + 1; } while (true); }
openssh-portable
ghidra
static _Bool print_factors(char const *input) { char const *str = input; while (*str == ' ') str++; str += *str == '+'; uintmax_t t1, t0; strtol_error err = strto2uintmax(&t1, &t0, str); switch (err) { case LONGINT_OK: if (((t1 << 1) >> 1) == t1) { do { if (dev_debug) fprintf(stderr, "[using single-precision arithmetic] "); } while (0); print_factors_single(t1, t0); return 1; } break; case LONGINT_OVERFLOW: break; default: error(0, 0, gettext("%s is not a valid positive integer"), quote(input)); return 0; } do { if (dev_debug) fprintf(stderr, "[using arbitrary-precision arithmetic] "); } while (0); mpz_t t; struct mp_factors factors; __gmpz_init_set_str(t, str, 10); __gmpz_out_str(stdout, 10, t); putchar_unlocked(':'); mp_factor(t, &factors); for (unsigned int j = 0; j < factors.nfactors; j++) for (unsigned int k = 0; k < factors.e[j]; k++) { putchar_unlocked(' '); __gmpz_out_str(stdout, 10, factors.p[j]); } mp_factor_clear(&factors); __gmpz_clear(t); putchar_unlocked('\n'); fflush_unlocked(stdout); return 1; }
long print_factors(_BYTE *a1) { long v1; char *v2; unsigned int j; unsigned int k; int v6; unsigned long v7; unsigned long v8; _BYTE *i; long v10[4]; char v11[24]; unsigned long v12; v12 = __readfsqword(0x28u); for (i = a1; *i == 32; ++i) ; i += *i == 43; v6 = strto2uintmax(&v7, &v8, i); if (v6) { if (v6 != 1) { v1 = quote(a1); v2 = gettext("%s is not a valid positive integer"); error(0, 0, v2, v1); return 0LL; } goto LABEL_11; } if ((v7 & 0x7FFFFFFFFFFFFFFFLL) != v7) { LABEL_11: if (dev_debug) fprintf(stderr, "[using arbitrary-precision arithmetic] "); _gmpz_init_set_str(v11, i, 10LL); _gmpz_out_str(stdout, 10LL, v11); putchar_unlocked(58); mp_factor((long)v11, v10); for (j = 0; (unsigned long)j < v10[2]; ++j) { for (k = 0; (unsigned long)k < *(_QWORD *)(8LL * j + v10[1]); ++k) { putchar_unlocked(32); _gmpz_out_str(stdout, 10LL, v10[0] + 16LL * j); } } mp_factor_clear((long)v10); _gmpz_clear(v11); putchar_unlocked(10); fflush_unlocked(stdout); return 1LL; } if (dev_debug) fprintf(stderr, "[using single-precision arithmetic] "); print_factors_single(v7, v8); return 1LL; }
coreutils
ida
static Session *session_by_channel(int id) { int i; for (i = 0; i < sessions_nalloc; i++) { Session *s = &sessions[i]; if (s->used && s->chanid == id) { sshlog("session.c", __func__, 1836, 0, SYSLOG_LEVEL_DEBUG1, ((void *)0), "session_by_channel: session %d channel %d", i, id); return s; } } sshlog("session.c", __func__, 1841, 0, SYSLOG_LEVEL_DEBUG1, ((void *)0), "session_by_channel: unknown channel %d", id); session_dump(); return ((void *)0); }
int session_by_channel(unsigned long a0) { unsigned long long v0; unsigned long v1; unsigned long long v2; unsigned long v3; unsigned int v4; unsigned int v5[48]; unsigned int v7; for (v4 = 0; v4 < sessions_nalloc; v4 = __addvsi3(v4, 0x1)) { *(&v5[0]) = v4 * 232 + sessions; if (v5[0] && a0 == v5[47]) { v2 = a0; v1 = v4; v0 = "session_by_channel: session %d channel %d"; sshlog("session.c", "session_by_channel", 0x72c, 0x0, 0x5, 0x0); v7 = v5; return v7; } } v3 = a0; v2 = "session_by_channel: unknown channel %d"; sshlog("session.c", "session_by_channel", 0x731, 0x0, 0x5, 0x0); session_dump(); v7 = 0; return v7; }
openssh-portable
angr_sailr
int mm_answer_authserv(struct ssh *ssh, int sock, struct sshbuf *m) { int r; monitor_permit_authentications(1); if ((r = sshbuf_get_cstring(m, &authctxt->service, ((void *)0))) != 0 || (r = sshbuf_get_cstring(m, &authctxt->style, ((void *)0))) != 0) sshfatal("monitor.c", __func__, 835, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "parse"); sshlog("monitor.c", __func__, 836, 1, SYSLOG_LEVEL_DEBUG3, ((void *)0), "service=%s, style=%s", authctxt->service, authctxt->style); if (strlen(authctxt->style) == 0) { free(authctxt->style); authctxt->style = ((void *)0); } return (0); }
undefined8 mm_answer_authserv(undefined8 param_1, undefined8 param_2, undefined8 param_3) { size_t sVar1; undefined8 uVar2; undefined8 uVar3; int local_c; monitor_permit_authentications(1); local_c = sshbuf_get_cstring(param_3, authctxt + 0x28, 0); if (local_c == 0) { uVar2 = 0x102d29; local_c = sshbuf_get_cstring(param_3, authctxt + 0x38, 0); if (local_c == 0) { sshlog("monitor.c", "mm_answer_authserv", 0x344, 1, 7, 0, "service=%s, style=%s", *(undefined8 *)(authctxt + 0x28), *(undefined8 *)(authctxt + 0x38), uVar2); sVar1 = strlen(*(char **)(authctxt + 0x38)); if (sVar1 == 0) { free(*(void **)(authctxt + 0x38)); *(undefined8 *)(authctxt + 0x38) = 0; } return 0; } } uVar3 = 0x102d3c; uVar2 = ssh_err(local_c); sshfatal("monitor.c", "mm_answer_authserv", 0x343, 1, 1, uVar2, "parse", uVar3); }
openssh-portable
ghidra
int _rl_find_prev_mbchar(char *string, int seed, int flags) { return _rl_find_prev_mbchar_internal(string, seed, flags); }
long long _rl_find_prev_mbchar(unsigned long long a0, unsigned long a1, unsigned long a2) { return _rl_find_prev_mbchar_internal(a0, a1, a2); }
bash
angr_phoenix
static int card_of_complement(struct Spec_list *s) { int c; int cardinality = N_CHARS; _Bool in_set[N_CHARS] = { 0, }; s->state = ((18446744073709551615UL) - 1); while ((c = get_next(s, ((void *)0))) != -1) { cardinality -= (!in_set[c]); in_set[c] = 1; } return cardinality; }
long card_of_complement(_QWORD *a1) { unsigned int v2; int next; char v4[264]; unsigned long v5; v5 = __readfsqword(0x28u); v2 = 256; memset(v4, 0, 0x100uLL); a1[2] = -2LL; while (1) { next = get_next(a1, 0LL); if (next == -1) break; v2 -= (unsigned char)v4[next] ^ 1; v4[next] = 1; } return v2; }
coreutils
ida
int snmprintf(char *str, size_t sz, int *wp, const char *fmt, ...) { va_list ap; char *cp = ((void *)0); int ret; __builtin_va_start(ap, fmt); ret = vasnmprintf(&cp, sz, wp, fmt, ap); __builtin_va_end(ap); if (cp != ((void *)0)) { (void)strlcpy(str, cp, sz); free(cp); } else *str = '\0'; return ret; }
undefined4 snmprintf(undefined4 param_1, undefined4 param_2, undefined4 param_3, undefined4 param_4, undefined4 param_5, undefined4 param_6, undefined4 param_7, undefined4 param_8, undefined *param_9, undefined8 param_10, undefined8 param_11, undefined8 param_12, undefined8 param_13, undefined8 param_14) { char in_AL; undefined4 uVar1; long in_FS_OFFSET; void *local_e0; undefined4 local_d8; undefined4 local_d4; undefined *local_d0; undefined *local_c8; long local_c0; undefined local_b8[32]; undefined8 local_98; undefined8 local_90; undefined4 local_88; undefined4 local_78; undefined4 local_68; undefined4 local_58; undefined4 local_48; undefined4 local_38; undefined4 local_28; undefined4 local_18; if (in_AL != '\0') { local_88 = param_1; local_78 = param_2; local_68 = param_3; local_58 = param_4; local_48 = param_5; local_38 = param_6; local_28 = param_7; local_18 = param_8; } local_c0 = *(long *)(in_FS_OFFSET + 0x28); local_e0 = (void *)0x0; local_d8 = 0x20; local_d4 = 0x30; local_d0 = &stack0x00000008; local_c8 = local_b8; local_98 = param_13; local_90 = param_14; uVar1 = vasnmprintf(&local_e0, param_10, param_11, param_12, &local_d8); if (local_e0 == (void *)0x0) { *param_9 = 0; } else { strlcpy(param_9, local_e0, param_10); free(local_e0); } if (local_c0 != *(long *)(in_FS_OFFSET + 0x28)) { __stack_chk_fail(); } return uVar1; }
openssh-portable
ghidra
static void xheader_set_single_keyword(char *kw) { do { if (error_hook) error_hook(); error(0, 0, gettext("Keyword %s is unknown or not yet implemented"), kw); usage(2); } while (0); }
void xheader_set_single_keyword(unsigned long a0) { unsigned long v0; v0 = a0; if (error_hook) *(5242936)(); error(0x0, 0x0, gettext("Keyword %s is unknown or not yet implemented")); usage(0x2); }
tar
angr_phoenix
int rl_reset_line_state(void) { rl_on_new_line(); rl_display_prompt = rl_prompt ? rl_prompt : ""; forced_display = 1; return 0; }
long long rl_reset_line_state() { unsigned long long v1; rl_on_new_line(); if (rl_prompt) v1 = rl_prompt; else v1 = &g_407d8e; rl_display_prompt = v1; forced_display = 1; return 0; }
bash
angr_dream
int strunvis(char *dst, const char *src) { return strnunvisx(dst, (size_t)~0, src, 0); }
long long strunvis(unsigned long long a0, unsigned int a1) { return strnunvisx(a0, 0xffffffffffffffff, a1, 0x0); }
libbsd-0.11.7
angr_phoenix
static _Bool zero_block_p(char const *buffer, size_t size) { while (size--) if (*buffer++) return 0; return 1; }
int zero_block_p(unsigned long a0, unsigned long long a1) { unsigned long long v0; int tmp_9; char *v1; unsigned int v3; v1 = a0; v0 = a1; while (true) { v3 = v0; v0 -= 1; if (v3) { tmp_9 = v1; v1 += 1; *(&v3) = *(tmp_9); if (!v3) continue; v3 = 0; break; } else { v3 = 1; break; } } return v3; }
tar
angr_dream
static int try_rekey(socket_st *hd, unsigned peer) { int ret; do { ret = gnutls_session_key_update(hd->session, peer ? 1 : 0); } while (ret == -28 || ret == -52); if (ret < 0) { fprintf(stderr, "*** Rekey has failed: %s\n", gnutls_strerror(ret)); return ret; } else { log_msg(stdout, "- Rekey was completed\n"); return 0; } }
void try_rekey(struct_0 *a0, unsigned long a1) { unsigned int v0; unsigned long long v2; void *v3; unsigned long long v4; do { v0 = gnutls_session_key_update(a0->field_8, a1, a1); if (v0 == -28) continue; } while (v0 == -52); if (v0 < 0) { fprintf(stderr, "*** Rekey has failed: %s\n", gnutls_strerror(v0)); v4 = v0; } else { log_msg(stdout, "- Rekey was completed\n", v2); v3 = 0; } return; }
gnutls
angr_dream
static size_t get_format_specifer_length(char ch) { if (strchr("abcdDfFgGhHiklmMnpPsStuUyYZ%", ch)) { return 1; } else if (strchr("ABCT", ch)) { return 2; } else { return 0; } }
undefined8 get_format_specifer_length(char param_1) { char *pcVar1; undefined8 uVar2; pcVar1 = strchr("abcdDfFgGhHiklmMnpPsStuUyYZ%", (int)param_1); if (pcVar1 == (char *)0x0) { pcVar1 = strchr("ABCT", (int)param_1); if (pcVar1 == (char *)0x0) { uVar2 = 0; } else { uVar2 = 2; } } else { uVar2 = 1; } return uVar2; }
findutils
ghidra
int timingsafe_bcmp(const void *b1, const void *b2, size_t n) { const unsigned char *p1 = b1, *p2 = b2; int ret = 0; for (; n > 0; n--) ret |= *p1++ ^ *p2++; return (ret != 0); }
long long timingsafe_bcmp(unsigned long a0, unsigned long a1, unsigned long a2) { unsigned long v0; int tmp_21; int tmp_32; unsigned int v1; char *v2; char *v3; v0 = a2; v2 = a0; v3 = a1; for (v1 = 0; v0; v0 -= 1) { tmp_21 = v2; v2 += 1; tmp_32 = v3; v3 += 1; v1 |= *(tmp_32) ^ *(tmp_21); } return v1; }
openssh-portable
angr_sailr
static _Bool insert_regex(char **argv, int *arg_ptr, const struct parser_table *entry, int regex_options) { const char *rx; if (collect_arg(argv, arg_ptr, &rx)) { struct re_pattern_buffer *re; const char *error_message; struct predicate *our_pred = insert_primary_withpred(entry, pred_regex, rx); our_pred->need_stat = our_pred->need_type = 0; re = xmalloc(sizeof(struct re_pattern_buffer)); our_pred->args.regex = re; re->allocated = 100; re->buffer = xmalloc(re->allocated); re->fastmap = ((void *)0); re_set_syntax(regex_options); re->syntax = regex_options; re->translate = ((void *)0); error_message = re_compile_pattern(rx, strlen(rx), re); if (error_message) ((!!sizeof(struct { _Static_assert( 1, "verify_expr (" "1" ", " "(error (1, 0, gettext (\"failed to compile regular expression " "'%s': %s\"), rx, error_message), assume (false))" ")"); int _gl_dummy; })) ? ((error(1, 0, gettext("failed to compile regular expression '%s': %s"), rx, error_message), ((0) ? (void)0 : __builtin_unreachable()))) : ((error(1, 0, gettext("failed to compile regular expression '%s': %s"), rx, error_message), ((0) ? (void)0 : __builtin_unreachable())))) ; our_pred->est_success_rate = estimate_pattern_match_rate(rx, 1); return 1; } return 0; }
void insert_regex(unsigned long long *a0, unsigned int *a1, unsigned long long a2, unsigned long a3) { char v0; struct_0 *v1; unsigned long long v2[6]; unsigned long v3; unsigned long long v5; void *v6; unsigned long long v7; unsigned int v8; unsigned long long v9; v5 = collect_arg(a0, a1, &v0); if (v5) { v1 = insert_primary_withpred(a2, got.pred_regex, *(&v0), got.pred_regex); v1->field_1b = 0; v1->field_1a = v1->field_1b; v2[0] = xmalloc(0x40); v1->field_38 = v2; v2[1] = 100; v2[0] = xmalloc(v2[1]); v2[4] = 0; re_set_syntax(a3); v2[3] = a3; v2[5] = 0; v7 = strlen(*(&v0)); v3 = re_compile_pattern(*(&v0), v7, v2, v7); if (v3) error(0x1, 0x0, gettext("failed to compile regular expression '%s': %s")); estimate_pattern_match_rate(*(&v0), 0x1); v1->field_24 = v8; v9 = 1; } else { v6 = 0; } if (!v3 || !v5) return; }
findutils
angr_dream
void do_authentication2(struct ssh *ssh) { Authctxt *authctxt = ssh->authctxt; ssh_dispatch_init(ssh, &dispatch_protocol_error); ssh_dispatch_set(ssh, 5, &input_service_request); ssh_dispatch_run_fatal(ssh, DISPATCH_BLOCK, &authctxt->success); ssh->authctxt = ((void *)0); }
long long do_authentication2(struct_0 *a0) { unsigned long long v0; v0 = a0->field_860; ssh_dispatch_init(a0, got.dispatch_protocol_error, got.dispatch_protocol_error); ssh_dispatch_set(a0, 0x5, input_service_request); ssh_dispatch_run_fatal(a0, 0x0, v0); a0->field_860 = 0; return a0; }
openssh-portable
angr_phoenix
int ssh_remove_all_identities(int sock, int version) { struct sshbuf *msg; u_char type = (version == 1) ? 9 : 19; int r; if ((msg = sshbuf_new()) == ((void *)0)) return -2; if ((r = sshbuf_put_u8(msg, type)) != 0) goto out; if ((r = ssh_request_reply_decode(sock, msg)) != 0) goto out; r = 0; out: sshbuf_free(msg); return r; }
int ssh_remove_all_identities(undefined4 param_1, int param_2) { undefined uVar1; long lVar2; int local_14; if (param_2 == 1) { uVar1 = 9; } else { uVar1 = 0x13; } lVar2 = sshbuf_new(); if (lVar2 == 0) { local_14 = -2; } else { local_14 = sshbuf_put_u8(lVar2, uVar1); if ((local_14 == 0) && (local_14 = ssh_request_reply_decode(param_1, lVar2), local_14 == 0)) { local_14 = 0; } sshbuf_free(lVar2); } return local_14; }
openssh-portable
ghidra
void pkcs8_info_int(gnutls_datum_t *data, unsigned format, unsigned ignore_err, FILE *out, const char *tab) { int ret; unsigned schema; unsigned cipher; unsigned char salt[32]; char hex[64 + 1]; unsigned salt_size = sizeof(salt); unsigned iter_count; gnutls_datum_t bin; size_t hex_size = sizeof(hex); const char *str; char *oid = ((void *)0); ret = gnutls_pkcs8_info(data, format, &schema, &cipher, salt, &salt_size, &iter_count, &oid); if (ret == -6) { fprintf(out, "PKCS #8 information:\n"); fprintf(out, "\tSchema: unsupported (%s)\n", oid); goto cleanup; } else if (ret == -50) { fprintf(out, "PKCS #8 information:\n"); fprintf(out, "\tSchema: unencrypted key\n"); goto cleanup; } if (ret < 0) { if (ignore_err) return; fprintf(stderr, "PKCS #8 read error: %s\n", gnutls_strerror(ret)); app_exit(1); } fprintf(out, "%sPKCS #8 information:\n", tab); fprintf(out, "%s\tCipher: %s\n", tab, gnutls_cipher_get_name(cipher)); str = gnutls_pkcs_schema_get_name(schema); if (str != ((void *)0)) { fprintf(out, "%s\tSchema: %s (%s)\n", tab, str, gnutls_pkcs_schema_get_oid(schema)); } bin.data = salt; bin.size = salt_size; ret = gnutls_hex_encode(&bin, hex, &hex_size); if (ret < 0) { fprintf(stderr, "hex encode error: %s\n", gnutls_strerror(ret)); app_exit(1); } fprintf(out, "%s\tSalt: %s\n", tab, hex); fprintf(out, "%s\tSalt size: %u\n", tab, salt_size); fprintf(out, "%s\tIteration count: %u\n\n", tab, iter_count); cleanup: gnutls_free((void *)(oid)), oid = ((void *)0); }
void pkcs8_info_int(unsigned long long a0, unsigned long a1, unsigned long a2, void *a3, unsigned long long a4) { unsigned int v0; unsigned int v1; unsigned long long v2; char v3; char v4; unsigned int v5; char v6; unsigned int v7; unsigned long long v8; void *v9; unsigned long v10; unsigned long v11; unsigned int v12; char v13; char v14; char v15; unsigned long long *v18; unsigned long long v19; v2 = a0; v1 = a1; v0 = a2; v5 = 32; v8 = 65; v9 = 0; v7 = gnutls_pkcs8_info(v2, v1, &v3, &v4, &v13, &v5, &v6, &v9, a4, a3, *(&v0)); if (v7 == -6) { fprintf(a3, "PKCS #8 information:\n"); fprintf(a3, "\tSchema: unsupported (%s)\n", v9); } else if (v7 != -50) { if (v7 >= 0) { fprintf(a3, "%sPKCS #8 information:\n", a4); fprintf(a3, "%s\tCipher: %s\n", a4, gnutls_cipher_get_name(*(&v4))); v10 = gnutls_pkcs_schema_get_name(*(&v3)); if (v10) fprintf(a3, "%s\tSchema: %s (%s)\n", a4, v10, gnutls_pkcs_schema_get_oid(*(&v3))); v11 = &v13; v12 = v5; v7 = gnutls_hex_encode(&v11, &v14, &v8, &v14); if (v7 < 0) { fprintf(*(&stderr), "hex encode error: %s\n", gnutls_strerror(v7)); app_exit(0x1); } fprintf(a3, "%s\tSalt: %s\n", a4, &v14); fprintf(a3, "%s\tSalt size: %u\n", a4, v5); fprintf(a3, "%s\tIteration count: %u\n\n", a4, *(&v6)); } else if (!v0) { fprintf(*(&stderr), "PKCS #8 read error: %s\n", gnutls_strerror(v7)); app_exit(0x1); } } if (v7 == -50) { fprintf(a3, "PKCS #8 information:\n"); fprintf(a3, "\tSchema: unencrypted key\n"); } if (v7 == -50 || v7 == -6 || v7 >= 0 && v7 >= 0) { *(5243720)(v9); v9 = 0; } if (v7 == -50 || v7 == -6 || v7 < 0 && v0 || v7 >= 0 && v7 >= 0) { v19 = *(&v15) ^ v18[5]; return; } }
gnutls
angr_dream
static inline void initialize_exit_failure(int status) { if (status != 1) exit_failure = status; }
void initialize_exit_failure(unsigned long long a0) { unsigned long long v1; if (a0 != 1) { v1 = a0; exit_failure = a0; } return; }
coreutils
angr_sailr
static void pubkey_reset(Authctxt *authctxt) { Identity *id; for ((id) = ((&authctxt->keys)->tqh_first); (id) != ((void *)0); (id) = ((id)->next.tqe_next)) id->tried = 0; }
void pubkey_reset(struct_0 *a0) { struct_1 *v0; unsigned long long v2; unsigned long long v3; v2 = a0->field_38; for (v0 = a0->field_38; v0; v0 = v0->field_0) { v0->field_28 = 0; v3 = v0->field_0; } return; }
openssh-portable
angr_dream
static char *next_line(char *line, char eolbyte) { char *p = rawmemchr(line, eolbyte); return p + 1; }
long next_line(void *param_1, char param_2) { void *pvVar1; pvVar1 = rawmemchr(param_1, (int)param_2); return (long)pvVar1 + 1; }
coreutils
ghidra
struct var *setvar(const char *name, const char *val, int flags) { char *p, *q; size_t namelen; char *nameeq; size_t vallen; struct var *vp; q = endofname(name); p = strchrnul(q, '='); namelen = p - name; if (!namelen || p != q) sh_error("%.*s: bad variable name", namelen, name); vallen = 0; if (val == ((void *)0)) { flags |= 0x20; } else { vallen = strlen(val); } ({ suppressint++; ({ __asm__ __volatile__("" : : : "memory"); }); 0; }); p = mempcpy(nameeq = ckmalloc(namelen + vallen + 2), name, namelen); if (val) { *p++ = '='; p = mempcpy(p, val, vallen); } *p = '\0'; vp = setvareq(nameeq, flags | 0x100); ({ ({ __asm__ __volatile__("" : : : "memory"); }); if (--suppressint == 0 && intpending) onint(); 0; }); return vp; }
int setvar(void *a0, void *a1, unsigned long a2) { unsigned int v0; int tmp_11; int tmp_19; void *v1; char *v2; void *v3; char *v4; unsigned long v5; void *v6; unsigned long v7; unsigned long v9; v1 = a1; v0 = a2; v4 = endofname(a0); v2 = strchrnul(v4, 0x3d); v5 = v2 - a0; if (v5 && v2 == v4) goto LABEL_400153; sh_error("%.*s: bad variable name", v5, a0); LABEL_400153: v3 = 0; if (!v1) v0 |= 32; else v3 = strlen(v1); suppressint = suppressint + 1; v6 = ckmalloc(v3 + v5 + 2); v2 = mempcpy(v6, a0, v5); if (v1) { tmp_11 = v2; v2 += 1; *(tmp_11) = 61; v2 = mempcpy(v2, v1, v3); } *(v2) = 0; v9 = v0; *(&v9) = (v0 >> 8) | 1; tmp_19 = v9; v7 = setvareq(v6, tmp_19); suppressint = suppressint - 1; if (!suppressint && intpending) onint(); return v7; }
dash-0.5.11+git20210903+057cd650a4ed
angr_phoenix
static void queue_insert(struct merge_node_queue *queue, struct merge_node *node) { pthread_mutex_lock(&queue->mutex); heap_insert(queue->priority_queue, node); node->queued = 1; pthread_cond_signal(&queue->cond); pthread_mutex_unlock(&queue->mutex); }
void queue_insert(undefined8 *param_1, long param_2) { pthread_mutex_lock((pthread_mutex_t *)(param_1 + 1)); heap_insert(*param_1, param_2); *(undefined *)(param_2 + 0x54) = 1; pthread_cond_signal((pthread_cond_t *)(param_1 + 6)); pthread_mutex_unlock((pthread_mutex_t *)(param_1 + 1)); return; }
coreutils
ghidra
static void free_dns_rr(struct dns_rr *p) { if (p == ((void *)0)) return; if (p->name) free(p->name); if (p->rdata) free(p->rdata); free_dns_rr(p->next); free(p); }
void free_dns_rr(unsigned long long a0[4]) { unsigned long long v1; if (!a0) return; if (a0[0]) free(a0[0]); if (a0[2]) free(a0[2]); free_dns_rr(a0[3]); v1 = free(a0); return; }
openssh-portable
angr_sailr
static char *make_absolute_pwd_glob(const char *p, const char *pwd) { char *ret, *escpwd; escpwd = escape_glob(pwd); if (p == ((void *)0)) return escpwd; ret = make_absolute(xstrdup(p), escpwd); free(escpwd); return ret; }
int make_absolute_pwd_glob(unsigned long long a0, void *a1) { void *v0; unsigned long v1; unsigned long v3; v0 = escape_glob(a1); if (!a0) { v3 = v0; return v3; } v3 = xstrdup(a0); v1 = make_absolute(v3, v0, v3); free(v0); *(&v3) = v1; return v3; }
openssh-portable
angr_sailr
static int cfg_kernel_matches(const struct cfg *cfg, const char *pattern) { regex_t re; int status; if ((strcmp((pattern), ("*")) == 0)) return 1; if (regcomp(&re, pattern, 1 | (1 << 3)) != 0) return 0; status = regexec(&re, cfg->kversion, 0, ((void *)0), 0); regfree(&re); return status == 0; }
bool cfg_kernel_matches(char **param_1, char *param_2) { int iVar1; long in_FS_OFFSET; bool bVar2; regex_t local_58; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); iVar1 = strcmp(param_2, "*"); if (iVar1 == 0) { bVar2 = true; } else { iVar1 = regcomp(&local_58, param_2, 9); if (iVar1 == 0) { iVar1 = regexec(&local_58, *param_1, 0, (regmatch_t *)0x0, 0); regfree(&local_58); bVar2 = iVar1 == 0; } else { bVar2 = false; } } if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) { __stack_chk_fail(); } return bVar2; }
kmod
ghidra
static unsigned char rl_bind_wrapper(EditLine *el __attribute__((__unused__)), unsigned char c) { if (map[c] == ((void *)0)) return 6; _rl_update_pos(); (*map[c])(1, c); if (rl_done) return 2; return 0; }
long long rl_bind_wrapper(unsigned long a0, unsigned long a1) { unsigned long v0; unsigned long long v2; v0 = a0; if (!map[a1]) { v2 = 6; } else { _rl_update_pos(); map[a1](1, a1, map[a1]); if (*(got.rl_done)) v2 = 2; else v2 = 0; } return v2; }
libedit
angr_phoenix
int ssh_ecdsa_verify(const struct sshkey *key, const u_char *signature, size_t signaturelen, const u_char *data, size_t datalen, u_int compat) { ECDSA_SIG *sig = ((void *)0); BIGNUM *sig_r = ((void *)0), *sig_s = ((void *)0); int hash_alg; u_char digest[64]; size_t dlen; int ret = -1; struct sshbuf *b = ((void *)0), *sigbuf = ((void *)0); char *ktype = ((void *)0); if (key == ((void *)0) || key->ecdsa == ((void *)0) || sshkey_type_plain(key->type) != KEY_ECDSA || signature == ((void *)0) || signaturelen == 0) return -10; if ((hash_alg = sshkey_ec_nid_to_hash_alg(key->ecdsa_nid)) == -1 || (dlen = ssh_digest_bytes(hash_alg)) == 0) return -1; if ((b = sshbuf_from(signature, signaturelen)) == ((void *)0)) return -2; if (sshbuf_get_cstring(b, &ktype, ((void *)0)) != 0 || sshbuf_froms(b, &sigbuf) != 0) { ret = -4; goto out; } if (strcmp(sshkey_ssh_name_plain(key), ktype) != 0) { ret = -13; goto out; } if (sshbuf_len(b) != 0) { ret = -23; goto out; } if (sshbuf_get_bignum2(sigbuf, &sig_r) != 0 || sshbuf_get_bignum2(sigbuf, &sig_s) != 0) { ret = -4; goto out; } if ((sig = ECDSA_SIG_new()) == ((void *)0)) { ret = -2; goto out; } if (!ECDSA_SIG_set0(sig, sig_r, sig_s)) { ret = -22; goto out; } sig_r = sig_s = ((void *)0); if (sshbuf_len(sigbuf) != 0) { ret = -23; goto out; } if ((ret = ssh_digest_memory(hash_alg, data, datalen, digest, sizeof(digest))) != 0) goto out; switch (ECDSA_do_verify(digest, dlen, sig, key->ecdsa)) { case 1: ret = 0; break; case 0: ret = -21; goto out; default: ret = -22; goto out; } out: explicit_bzero(digest, sizeof(digest)); sshbuf_free(sigbuf); sshbuf_free(b); ECDSA_SIG_free(sig); BN_clear_free(sig_r); BN_clear_free(sig_s); free(ktype); return ret; }
long long ssh_ecdsa_verify(struct_0 *a0, unsigned long long a1, unsigned long long a2, unsigned long long a3, unsigned long long a4, unsigned long a5) { unsigned int v0; unsigned int v1; unsigned int v2; void *v3; void *v4; void *v5; void *v6; void *v7; unsigned long long v8; unsigned long long v9; char v10; unsigned long long v12; unsigned long long v13; v0 = a5; v7 = 0; v3 = 0; v4 = 0; v1 = -1; v8 = 0; v5 = 0; v6 = 0; if (!a0) { LABEL_400439: v12 = 4294967286; } else { if (!a0->field_20) goto LABEL_400439; if (!(sshkey_type_plain(a0->field_0) == 2)) goto LABEL_400439; if (!a1) goto LABEL_400439; if (!a2) goto LABEL_400439; v2 = sshkey_ec_nid_to_hash_alg(a0->field_18); if (v2 == -1) { LABEL_40047b: v12 = 4294967295; } else { v9 = ssh_digest_bytes(v2); if (!v9) goto LABEL_40047b; v8 = sshbuf_from(a1, a2, a2); if (!v8) { v12 = 4294967294; } else { if (sshbuf_get_cstring(v8, &v6, 0x0, &v6)) { LABEL_4004e9: v1 = -0x4; } else { if (!(!sshbuf_froms(v8, &v5, &v5))) goto LABEL_4004e9; if (strcmp(sshkey_ssh_name_plain(a0), v6)) { v1 = -13; } else if (sshbuf_len(v8)) { v1 = -23; } else if (sshbuf_get_bignum2(v5, &v3, &v3)) { LABEL_400583: v1 = -0x4; } else { if (!(!sshbuf_get_bignum2(v5, &v4, &v4))) goto LABEL_400583; v7 = ECDSA_SIG_new(); if (!v7) { v1 = -2; } else if (!ECDSA_SIG_set0(v7, v3, v4, v3)) { v1 = -22; } else { v4 = 0; v3 = v4; if (sshbuf_len(v5)) { v1 = -23; } else { v1 = ssh_digest_memory(v2, a3, a4, &v10, 0x40); if (!v1) { v13 = ECDSA_do_verify(&v10, v9, v7, a0->field_20); if (!v13) { v1 = -21; } else if (v13 == 1) { v1 = 0; } else { v1 = -22; } } } } } } explicit_bzero(&v10, 0x40); sshbuf_free(v5); sshbuf_free(v8); ECDSA_SIG_free(v7); BN_clear_free(v3); BN_clear_free(v4); free(v6); v12 = v1; } } } return v12; }
openssh-portable
angr_phoenix
int addr_sa_pton(const char *h, const char *s, struct sockaddr *sa, socklen_t slen) { struct addrinfo hints, *ai; memset(&hints, '\0', sizeof(hints)); hints.ai_flags = 0x0004; if (h == ((void *)0) || getaddrinfo(h, s, &hints, &ai) != 0) return -1; if (ai == ((void *)0)) return -1; if (ai->ai_addr == ((void *)0)) { freeaddrinfo(ai); return -1; } if (sa != ((void *)0)) { if (slen < ai->ai_addrlen) { freeaddrinfo(ai); return -1; } memcpy(sa, &ai->ai_addr, ai->ai_addrlen); } freeaddrinfo(ai); return 0; }
long long addr_sa_pton(unsigned long long a0, unsigned long long a1, void *a2, unsigned long a3) { char v0; char v1; unsigned long long v3; memset(&v1, 0x0, 0x30); v1 = 4; if (!a0) { LABEL_4009c6: v3 = 4294967295; } else { if (!(!getaddrinfo(a0, a1, &v1, &v0))) goto LABEL_4009c6; if (!*(&v0)) { v3 = 4294967295; } else if (!*((*(&v0) + 24))) { freeaddrinfo(*(&v0)); v3 = 4294967295; } else { if (a2) { if (a3 >= *((*(&v0) + 16))) { memcpy(a2, *(&v0) + 24, *((*(&v0) + 16))); } else { freeaddrinfo(*(&v0)); v3 = 4294967295; goto LABEL_400a57; } } freeaddrinfo(*(&v0)); v3 = 0; } } LABEL_400a57: return v3; }
openssh-portable
angr_phoenix
static void bridge_slave_parse_on_off(char *arg_name, char *arg_val, struct nlmsghdr *n, int type) { int ret; __u8 val = parse_on_off(arg_name, arg_val, &ret); if (ret) exit(1); addattr8(n, 1024, type, val); }
void bridge_slave_parse_on_off(unsigned long long a0, unsigned long long a1, unsigned long long a2, unsigned long a3) { char v0; char v1; char v2; unsigned long long *v4; unsigned long long v5; v0 = parse_on_off(a0, a1, &v1, a1); if (!*(&v1)) { addattr8(a2, 0x400, a3, v0); v5 = *(&v2) ^ v4[5]; return; } exit(0x1); }
iproute2-6.0.0
angr_sailr
static void progerror(char const *string) { int e = (*__errno_location()); fprintf(stderr, "%s: ", program_name); (*__errno_location()) = e; perror(string); exit_code = 1; }
void progerror(char *a0) { unsigned int v0; unsigned long long v2; v0 = *(__errno_location()); fprintf(stderr, "%s: ", -116028600); *(__errno_location()) = v0; v2 = perror(a0); exit_code = 1; return; }
gzip-1.12
angr_phoenix
static int compare_collated(char const *name1, char const *name2) { int r; (*__errno_location()) = 0; if (ignore_file_name_case) r = strcasecmp(name1, name2); else r = strcoll(name1, name2); if ((*__errno_location())) { error(0, (*__errno_location()), gettext("cannot compare file names '%s' and '%s'"), name1, name2); longjmp(failed_locale_specific_sorting, 1); } return r; }
int compare_collated(char *a0, char *a1) { unsigned int v0; *(__errno_location()) = 0; if (ignore_file_name_case) v0 = strcasecmp(a0, a1); else v0 = strcoll(a0, a1); if (*(__errno_location())) { error(0x0, *(__errno_location()), gettext("cannot compare file names '%s' and '%s'")); longjmp(&failed_locale_specific_sorting, 0x1); } return v0; }
diffutils
angr_dream
static char get_type_indicator(_Bool stat_ok, mode_t mode, enum filetype type) { char c; if (stat_ok ? ((((mode)) & 0170000) == (0100000)) : type == normal) { if (stat_ok && indicator_style == classify && (mode & (0100 | (0100 >> 3) | ((0100 >> 3) >> 3)))) c = '*'; else c = 0; } else { if (stat_ok ? ((((mode)) & 0170000) == (0040000)) : type == directory || type == arg_directory) c = '/'; else if (indicator_style == slash) c = 0; else if (stat_ok ? ((((mode)) & 0170000) == (0120000)) : type == symbolic_link) c = '@'; else if (stat_ok ? ((((mode)) & 0170000) == (0010000)) : type == fifo) c = '|'; else if (stat_ok ? ((((mode)) & 0170000) == (0140000)) : type == sock) c = '='; else if (stat_ok && 0) c = '>'; else c = 0; } return c; }
int get_type_indicator(unsigned long a0, unsigned long a1, unsigned long a2) { char v0; unsigned int v3; if (!(!a0 ? (a1 & 0xf000) == 0x8000 : a2 == 5)) { if (a0) { v3 = (a1 & 0xf000) == 0x4000; } else { switch (a2) { case 3: case 9: v3 = 1; break; default: v3 = 0; break; } *(&v3) = v3 & 1; } if (v3) { v0 = 47; return v0; } else if (*(&indicator_style) != 1) { *(&v3) = (!a0 ? (a1 & 0xf000) == 0xa000 : a2 == 6); if (v3) { v0 = 64; return v0; } *(&v3) = (!a0 ? (a1 & 0xf000) == 0x1000 : a2 == 1); if (v3) { v0 = 124; return v0; } *(&v3) = (!a0 ? (a1 & 0xf000) == 0xc000 : a2 == 7); if (v3) { v0 = 61; return v0; } v0 = 0; return v0; } else { v0 = 0; return v0; } } else { if (a0 && *(&indicator_style) == 3 && (a1 & 73)) { v0 = 42; return v0; } v0 = 0; return v0; } }
coreutils
angr_sailr
void generate_pkcs12(common_info_st *cinfo) { gnutls_pkcs12_t pkcs12; gnutls_x509_crl_t *crls; gnutls_x509_crt_t *crts, ca_crt; gnutls_x509_privkey_t *keys; gnutls_mac_algorithm_t mac; int result; size_t size; gnutls_datum_t data; const char *pass; const char *name; unsigned int flags = 0, i; gnutls_datum_t key_id; unsigned char _key_id[64]; int indx; size_t ncrts; size_t nkeys; size_t ncrls; fprintf(stderr, "Generating a PKCS #12 structure...\n"); keys = load_privkey_list(0, &nkeys, cinfo); crts = load_cert_list(0, &ncrts, cinfo); ca_crt = load_ca_cert(0, cinfo); crls = load_crl_list(0, &ncrls, cinfo); if (keys == ((void *)0) && crts == ((void *)0) && ca_crt == ((void *)0) && crls == ((void *)0)) { fprintf(stderr, "You must specify one " "of\n\t--load-privkey\n\t--load-certificate\n\t--load-ca-" "certificate\n\t--load-crl\n"); app_exit(1); } if (cinfo->hash != GNUTLS_DIG_UNKNOWN) mac = (gnutls_mac_algorithm_t)cinfo->hash; else mac = GNUTLS_MAC_SHA256; if (certtool_options.present.p12_name) { name = certtool_options.arg.p12_name; } else { name = get_pkcs12_key_name(); } result = gnutls_pkcs12_init(&pkcs12); if (result < 0) { fprintf(stderr, "pkcs12_init: %s\n", gnutls_strerror(result)); app_exit(1); } pass = get_password(cinfo, &flags, 1); flags |= cipher_to_flags(cinfo->pkcs_cipher); for (i = 0; i < ncrts; i++) { gnutls_pkcs12_bag_t bag; result = gnutls_pkcs12_bag_init(&bag); if (result < 0) { fprintf(stderr, "bag_init: %s\n", gnutls_strerror(result)); app_exit(1); } ((void)sizeof((crts != ((void *)0) && crts[i] != ((void *)0)) ? 1 : 0), __extension__({ if (crts != ((void *)0) && crts[i] != ((void *)0)) ; else __assert_fail("crts != NULL && crts[i] != NULL", "certtool.c", 3003, __extension__ __PRETTY_FUNCTION__); })); result = gnutls_pkcs12_bag_set_crt(bag, crts[i]); if (result < 0) { fprintf(stderr, "set_crt[%d]: %s\n", i, gnutls_strerror(result)); app_exit(1); } indx = result; if (i == 0) { result = gnutls_pkcs12_bag_set_friendly_name(bag, indx, name); if (result < 0) { fprintf(stderr, "bag_set_friendly_name: %s\n", gnutls_strerror(result)); app_exit(1); } } size = sizeof(_key_id); result = gnutls_x509_crt_get_key_id(crts[i], GNUTLS_KEYID_USE_SHA1, _key_id, &size); if (result < 0) { fprintf(stderr, "key_id[%d]: %s\n", i, gnutls_strerror(result)); app_exit(1); } key_id.data = _key_id; key_id.size = size; result = gnutls_pkcs12_bag_set_key_id(bag, indx, &key_id); if (result < 0) { fprintf(stderr, "bag_set_key_id: %s\n", gnutls_strerror(result)); app_exit(1); } if (!(flags & GNUTLS_PKCS_PLAIN) || cinfo->empty_password) result = gnutls_pkcs12_bag_encrypt(bag, pass, flags); if (result < 0) { fprintf(stderr, "bag_encrypt: %s\n", gnutls_strerror(result)); app_exit(1); } result = gnutls_pkcs12_set_bag(pkcs12, bag); if (result < 0) { fprintf(stderr, "set_bag: %s\n", gnutls_strerror(result)); app_exit(1); } gnutls_pkcs12_bag_deinit(bag); } for (i = 0; i < ncrls; i++) { gnutls_pkcs12_bag_t bag; result = gnutls_pkcs12_bag_init(&bag); if (result < 0) { fprintf(stderr, "bag_init: %s\n", gnutls_strerror(result)); app_exit(1); } result = gnutls_pkcs12_bag_set_crl(bag, crls[i]); if (result < 0) { fprintf(stderr, "set_crl[%d]: %s\n", i, gnutls_strerror(result)); app_exit(1); } result = gnutls_pkcs12_bag_encrypt(bag, pass, flags); if (result < 0) { fprintf(stderr, "bag_encrypt: %s\n", gnutls_strerror(result)); app_exit(1); } result = gnutls_pkcs12_set_bag(pkcs12, bag); if (result < 0) { fprintf(stderr, "set_bag: %s\n", gnutls_strerror(result)); app_exit(1); } gnutls_pkcs12_bag_deinit(bag); } if (ca_crt) { gnutls_pkcs12_bag_t bag; result = gnutls_pkcs12_bag_init(&bag); if (result < 0) { fprintf(stderr, "bag_init: %s\n", gnutls_strerror(result)); app_exit(1); } result = gnutls_pkcs12_bag_set_crt(bag, ca_crt); if (result < 0) { fprintf(stderr, "set_crt[%d]: %s\n", i, gnutls_strerror(result)); app_exit(1); } result = gnutls_pkcs12_bag_encrypt(bag, pass, flags); if (result < 0) { fprintf(stderr, "bag_encrypt: %s\n", gnutls_strerror(result)); app_exit(1); } result = gnutls_pkcs12_set_bag(pkcs12, bag); if (result < 0) { fprintf(stderr, "set_bag: %s\n", gnutls_strerror(result)); app_exit(1); } gnutls_pkcs12_bag_deinit(bag); } for (i = 0; i < nkeys; i++) { gnutls_pkcs12_bag_t kbag; result = gnutls_pkcs12_bag_init(&kbag); if (result < 0) { fprintf(stderr, "bag_init: %s\n", gnutls_strerror(result)); app_exit(1); } ((void)sizeof((keys != ((void *)0) && keys[i] != ((void *)0)) ? 1 : 0), __extension__({ if (keys != ((void *)0) && keys[i] != ((void *)0)) ; else __assert_fail("keys != NULL && keys[i] != NULL", "certtool.c", 3139, __extension__ __PRETTY_FUNCTION__); })); size = lbuffer_size; result = gnutls_x509_privkey_export_pkcs8(keys[i], GNUTLS_X509_FMT_DER, pass, flags, lbuffer, &size); if (result < 0) { fprintf(stderr, "key_export[%d]: %s\n", i, gnutls_strerror(result)); app_exit(1); } data.data = lbuffer; data.size = size; result = gnutls_pkcs12_bag_set_data(kbag, GNUTLS_BAG_PKCS8_ENCRYPTED_KEY, &data); if (result < 0) { fprintf(stderr, "bag_set_data: %s\n", gnutls_strerror(result)); app_exit(1); } indx = result; result = gnutls_pkcs12_bag_set_friendly_name(kbag, indx, name); if (result < 0) { fprintf(stderr, "bag_set_friendly_name: %s\n", gnutls_strerror(result)); app_exit(1); } size = sizeof(_key_id); result = gnutls_x509_privkey_get_key_id(keys[i], GNUTLS_KEYID_USE_SHA1, _key_id, &size); if (result < 0) { fprintf(stderr, "key_id[%d]: %s\n", i, gnutls_strerror(result)); app_exit(1); } key_id.data = _key_id; key_id.size = size; result = gnutls_pkcs12_bag_set_key_id(kbag, indx, &key_id); if (result < 0) { fprintf(stderr, "bag_set_key_id: %s\n", gnutls_strerror(result)); app_exit(1); } result = gnutls_pkcs12_set_bag(pkcs12, kbag); if (result < 0) { fprintf(stderr, "set_bag: %s\n", gnutls_strerror(result)); app_exit(1); } gnutls_pkcs12_bag_deinit(kbag); } result = gnutls_pkcs12_generate_mac2(pkcs12, mac, pass); if (result < 0) { fprintf(stderr, "generate_mac: %s\n", gnutls_strerror(result)); app_exit(1); } size = lbuffer_size; result = gnutls_pkcs12_export(pkcs12, outcert_format, lbuffer, &size); if (result < 0) { fprintf(stderr, "pkcs12_export: %s\n", gnutls_strerror(result)); app_exit(1); } fwrite(lbuffer, 1, size, outfile); for (i = 0; i < ncrts; i++) gnutls_x509_crt_deinit(crts[i]); gnutls_free((void *)(crts)), crts = ((void *)0); gnutls_x509_crt_deinit(ca_crt); gnutls_pkcs12_deinit(pkcs12); }
void generate_pkcs12(struct_0 *a0) { unsigned int v0; unsigned int v1; unsigned int v2; unsigned int v3; unsigned int v4; char v5; unsigned long long v6; char v7; char v8; char v9; char v10; unsigned long long v11; unsigned long long *v12; unsigned long long *v13; unsigned long long v14; unsigned long long *v15; unsigned long long v16; unsigned long v17; unsigned int v18; unsigned long v19; unsigned int v20; char v21; char v22; unsigned long long *v24; unsigned long long v25; v0 = 0; fprintf(stderr, "Generating a PKCS #12 structure...\n"); v12 = load_privkey_list(0x0, &v8, a0); v13 = load_cert_list(0x0, &v7, a0); v14 = load_ca_cert(0x0, a0); v15 = load_crl_list(0x0, &v9, a0); if (!v12 && !v13 && !v14 && !v15) { fprintf(stderr, "You must specify one " "of\n\t--load-privkey\n\t--load-certificate\n\t--load-ca-" "certificate\n\t--load-crl\n"); app_exit(0x1); } if (!a0->field_b0) v1 = 6; else v1 = a0->field_b0; if (g_500083) v11 = load_request; else v11 = get_pkcs12_key_name(); v2 = gnutls_pkcs12_init(&v5); if (v2 < 0) { fprintf(stderr, "pkcs12_init: %s\n", gnutls_strerror(v2)); app_exit(0x1); } v16 = get_password(a0, &v0, 0x1, &v0); v0 |= cipher_to_flags(a0->field_68); v3 = 0; while (true) { if (v3 >= *(&v7)) { for (v3 = 0; v3 < *(&v9); v3 += 1) { v2 = gnutls_pkcs12_bag_init(&v17); if (v2 < 0) { fprintf(stderr, "bag_init: %s\n", gnutls_strerror(v2)); app_exit(0x1); } v2 = gnutls_pkcs12_bag_set_crl(*(&v17), v15[v3], v15[v3]); if (v2 < 0) { fprintf(stderr, "set_crl[%d]: %s\n", v3, gnutls_strerror(v2)); app_exit(0x1); } v2 = gnutls_pkcs12_bag_encrypt(*(&v17), v16, v0, v16); if (v2 < 0) { fprintf(stderr, "bag_encrypt: %s\n", gnutls_strerror(v2)); app_exit(0x1); } v2 = gnutls_pkcs12_set_bag(*(&v5), *(&v17), *(&v17)); if (v2 >= 0) { gnutls_pkcs12_bag_deinit(*(&v17)); } else { fprintf(stderr, "set_bag: %s\n", gnutls_strerror(v2)); app_exit(0x1); } } if (v14) { v2 = gnutls_pkcs12_bag_init(&v17); if (v2 < 0) { fprintf(stderr, "bag_init: %s\n", gnutls_strerror(v2)); app_exit(0x1); } v2 = gnutls_pkcs12_bag_set_crt(*(&v17), v14, v14); if (v2 < 0) { fprintf(stderr, "set_crt[%d]: %s\n", v3, gnutls_strerror(v2)); app_exit(0x1); } v2 = gnutls_pkcs12_bag_encrypt(*(&v17), v16, v0, v16); if (v2 < 0) { fprintf(stderr, "bag_encrypt: %s\n", gnutls_strerror(v2)); app_exit(0x1); } v2 = gnutls_pkcs12_set_bag(*(&v5), *(&v17), *(&v17)); if (v2 >= 0) { gnutls_pkcs12_bag_deinit(*(&v17)); break; } else { fprintf(stderr, "set_bag: %s\n", gnutls_strerror(v2)); app_exit(0x1); } } } v2 = gnutls_pkcs12_bag_init(&v17); if (v2 < 0) { fprintf(stderr, "bag_init: %s\n", gnutls_strerror(v2)); app_exit(0x1); } if (!v13) { LABEL_4079b3: __assert_fail(); } if (!v13[v3]) goto LABEL_4079b3; v2 = gnutls_pkcs12_bag_set_crt(*(&v17), v13[v3], v13[v3]); if (v2 < 0) { fprintf(stderr, "set_crt[%d]: %s\n", v3, gnutls_strerror(v2)); app_exit(0x1); } v4 = v2; if (!v3) { v2 = gnutls_pkcs12_bag_set_friendly_name(*(&v17), v4, v11, v4); if (v2 < 0) { fprintf(stderr, "bag_set_friendly_name: %s\n", gnutls_strerror(v2)); app_exit(0x1); } } v6 = 64; v2 = gnutls_x509_crt_get_key_id(v13[v3], 0x0, &v21, &v6); if (v2 < 0) { fprintf(stderr, "key_id[%d]: %s\n", v3, gnutls_strerror(v2)); app_exit(0x1); } v19 = &v21; v20 = v6; v2 = gnutls_pkcs12_bag_set_key_id(*(&v17), v4, &v19, v4); if (v2 < 0) { fprintf(stderr, "bag_set_key_id: %s\n", gnutls_strerror(v2)); app_exit(0x1); } if ((v0 & 1) && !a0->field_7c) goto LABEL_407bea; v2 = gnutls_pkcs12_bag_encrypt(*(&v17), v16, v0, v16); LABEL_407bea: if (v2 < 0) { fprintf(stderr, "bag_encrypt: %s\n", gnutls_strerror(v2)); app_exit(0x1); } v2 = gnutls_pkcs12_set_bag(*(&v5), *(&v17), *(&v17)); if (v2 >= 0) { gnutls_pkcs12_bag_deinit(*(&v17)); v3 += 1; } else { fprintf(stderr, "set_bag: %s\n", gnutls_strerror(v2)); app_exit(0x1); } } v3 = 0; while (true) { if (v3 >= *(&v8)) { v2 = gnutls_pkcs12_generate_mac2(*(&v5), v1, v16, v1); if (v2 < 0) { fprintf(stderr, "generate_mac: %s\n", gnutls_strerror(v2)); app_exit(0x1); } *(&v6) = lbuffer_size; v2 = gnutls_pkcs12_export(*(&v5), outcert_format, lbuffer, &v6); if (v2 >= 0) { fwrite(lbuffer, 0x1, *(&v6), outfile); v3 = 0; break; } else { fprintf(stderr, "pkcs12_export: %s\n", gnutls_strerror(v2)); app_exit(0x1); } } v2 = gnutls_pkcs12_bag_init(&v10); if (v2 < 0) { fprintf(stderr, "bag_init: %s\n", gnutls_strerror(v2)); app_exit(0x1); } if (!v12) { LABEL_408068: __assert_fail(); } if (!v12[v3]) goto LABEL_408068; v6 = lbuffer_size; v2 = gnutls_x509_privkey_export_pkcs8(v12[v3], 0x0, v16, v0, lbuffer, &v6); if (v2 < 0) { fprintf(stderr, "key_export[%d]: %s\n", v3, gnutls_strerror(v2)); app_exit(0x1); } v17 = lbuffer; v18 = v6; v2 = gnutls_pkcs12_bag_set_data(*(&v10), 0x1, &v17); if (v2 < 0) { fprintf(stderr, "bag_set_data: %s\n", gnutls_strerror(v2)); app_exit(0x1); } v4 = v2; v2 = gnutls_pkcs12_bag_set_friendly_name(*(&v10), v4, v11, v4); if (v2 < 0) { fprintf(stderr, "bag_set_friendly_name: %s\n", gnutls_strerror(v2)); app_exit(0x1); } v6 = 64; v2 = gnutls_x509_privkey_get_key_id(v12[v3], 0x0, &v21, &v6); if (v2 < 0) { fprintf(stderr, "key_id[%d]: %s\n", v3, gnutls_strerror(v2)); app_exit(0x1); } v19 = &v21; v20 = v6; v2 = gnutls_pkcs12_bag_set_key_id(*(&v10), v4, &v19, v4); if (v2 < 0) { fprintf(stderr, "bag_set_key_id: %s\n", gnutls_strerror(v2)); app_exit(0x1); } v2 = gnutls_pkcs12_set_bag(*(&v5), *(&v10), *(&v10)); if (v2 >= 0) { gnutls_pkcs12_bag_deinit(*(&v10)); v3 += 1; } else { fprintf(stderr, "set_bag: %s\n", gnutls_strerror(v2)); app_exit(0x1); } } for (; v3 < *(&v7); v3 += 1) { gnutls_x509_crt_deinit(v13[v3]); } *(5243720)(v13); v13 = 0; gnutls_x509_crt_deinit(v14); gnutls_pkcs12_deinit(*(&v5)); v25 = *(&v22) ^ v24[5]; return; }
gnutls
angr_phoenix
int rl_character_len(int c, int pos) { unsigned char uc; uc = (unsigned char)c; if (((uc) > 0x07f && (uc) <= 255)) return ((_rl_output_meta_chars == 0) ? 4 : 1); if (uc == '\t') { return (((pos | 7) + 1) - pos); } if (((c) < 0x020 && (((c) & 0x80) == 0)) || c == 0x7f) return (2); return (((1 && ((*__ctype_b_loc())[(int)(((unsigned char)uc))] & (unsigned short int)_ISprint))) ? 1 : 2); }
long long rl_character_len(unsigned long a0, unsigned long a1) { unsigned long long v1; unsigned int v3; if (a0 >= 0) { if (a0 == 9) { v1 = (a1 | 7) + 1 - a1; } else { if (a0 <= 31 && !(a0 & 128)) goto LABEL_4069cc; if (a0 == 127) { LABEL_4069cc: v1 = 2; } else { v3 = *((*(__ctype_b_loc()) + a0 * 2)) & 0x4000; if (v3) v1 = 1; else v1 = 2; } } } else { if (!_rl_output_meta_chars) v1 = 4; else v1 = 1; } return v1; }
bash
angr_phoenix
__inline__ Int32 BZ2_indexIntoF(Int32 indx, Int32 *cftab) { Int32 nb, na, mid; nb = 0; na = 256; do { mid = (nb + na) >> 1; if (indx >= cftab[mid]) nb = mid; else na = mid; } while (na - nb != 1); return nb; }
int BZ2_indexIntoF(unsigned long a0, unsigned int *a1) { unsigned int v0; unsigned int v1; unsigned int v2; v0 = 0; v1 = 0x100; do { v2 = v1 + v0 >> 1; if (a0 < a1[v2]) v1 = v2; else v0 = v2; } while (v1 - v0 != 1); return v0; }
bzip2
angr_sailr
int sshsig_sign_fd(struct sshkey *key, const char *hashalg, const char *sk_provider, const char *sk_pin, int fd, const char *sig_namespace, struct sshbuf **out, sshsig_signer *signer, void *signer_ctx) { struct sshbuf *b = ((void *)0); int r = -1; if (hashalg == ((void *)0)) hashalg = "sha512"; if (out != ((void *)0)) *out = ((void *)0); if ((r = hash_file(fd, hashalg, &b)) != 0) { sshlog("sshsig.c", __func__, 573, 1, SYSLOG_LEVEL_ERROR, ssh_err(r), "hash_file"); return r; } if ((r = sshsig_wrap_sign(key, hashalg, sk_provider, sk_pin, b, sig_namespace, out, signer, signer_ctx)) != 0) goto out; r = 0; out: sshbuf_free(b); return r; }
int sshsig_sign_fd(undefined8 param_1, char *param_2, undefined8 param_3, undefined8 param_4, undefined4 param_5, undefined8 param_6, undefined8 *param_7, undefined8 param_8, undefined8 param_9) { long in_FS_OFFSET; undefined8 uVar1; undefined8 uVar2; char *local_38; int local_1c; undefined8 local_18; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); local_18 = 0; local_38 = param_2; if (param_2 == (char *)0x0) { local_38 = "sha512"; } if (param_7 != (undefined8 *)0x0) { *param_7 = 0; } uVar1 = 0x1020a2; local_1c = hash_file(param_5, local_38, &local_18); if (local_1c == 0) { local_1c = sshsig_wrap_sign(param_1, local_38, param_3, param_4, local_18, param_6, param_7, param_8, param_9, uVar1); if (local_1c == 0) { local_1c = 0; } sshbuf_free(local_18); } else { uVar2 = 0x1020b5; uVar1 = ssh_err(local_1c); sshlog("sshsig.c", "sshsig_sign_fd", 0x23d, 1, 2, uVar1, "hash_file", uVar2); } if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) { __stack_chk_fail(); } return local_1c; }
openssh-portable
ghidra
static void integer_overflow(void) { ((!!sizeof(struct { _Static_assert( 1, "verify_expr (" "1" ", " "(error (1, 0, gettext (\"integer overflow\")), assume (false))" ")"); int _gl_dummy; })) ? ((error(1, 0, gettext("integer overflow")), ((0) ? (void)0 : __builtin_unreachable()))) : ((error(1, 0, gettext("integer overflow")), ((0) ? (void)0 : __builtin_unreachable())))); }
void integer_overflow() { error(0x1, 0x0, gettext("integer overflow")); }
coreutils
angr_sailr
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
unsigned char crypto_sign_ed25519_ref_fe25519_getparity( const crypto_sign_ed25519_ref_fe25519 *x) { crypto_sign_ed25519_ref_fe25519 t = *x; crypto_sign_ed25519_ref_fe25519_freeze(&t); return t.v[0] & 1; }
long long crypto_sign_ed25519_ref_fe25519_getparity(unsigned long long a0[16]) { unsigned long v0; unsigned long v1; unsigned long v2; unsigned long v3; unsigned long v4; unsigned long v5; unsigned long v6; unsigned long v7; unsigned long v8; unsigned long v9; unsigned long v10; unsigned long v11; unsigned long v12; unsigned long v13; unsigned long v14; unsigned long v15; v0 = a0[0]; v1 = a0[1]; v2 = a0[2]; v3 = a0[3]; v4 = a0[4]; v5 = a0[5]; v6 = a0[6]; v7 = a0[7]; v8 = a0[8]; v9 = a0[9]; v10 = a0[10]; v11 = a0[11]; v12 = a0[12]; v13 = a0[13]; v14 = a0[14]; v15 = a0[15]; crypto_sign_ed25519_ref_fe25519_freeze(&v0); return v0 & 1; }
openssh-portable
angr_dream
int main(int argc, const char *const *argv) { const char *badname; enum trigdef_update_flags tduf; enum trigdef_update_status tdus; dpkg_locales_init("dpkg"); dpkg_program_init("dpkg-trigger"); dpkg_options_parse(&argv, cmdinfos, printforhelp); admindir = dpkg_db_set_dir(admindir); if (f_check) { if (*argv) badusage(gettext("--%s takes no arguments"), "check-supported"); return do_check(); } if (!*argv || argv[1]) badusage(gettext("takes one argument, the trigger name")); badname = parse_awaiter_package(); if (badname) badusage(gettext("illegal awaited package name '%.250s': %.250s"), bypackage, badname); activate = argv[0]; badname = trig_name_is_illegal(activate); if (badname) badusage(gettext("invalid trigger name '%.250s': %.250s"), activate, badname); trigdef_set_methods(&tdm_add); tduf = TDUF_NO_LOCK_OK; if (!f_noact) tduf |= TDUF_WRITE | TDUF_WRITE_IF_EMPTY; tdus = trigdef_update_start(tduf); if (tdus >= 0) { trigdef_parse(); if (!done_trig) trigdef_update_printf("%s %s\n", activate, bypackage); trigdef_process_done(); } dpkg_program_done(); dpkg_locales_done(); return 0; }
undefined8 main(undefined4 param_1, long *param_2) { long lVar1; undefined8 uVar2; undefined8 uVar3; long *local_38; undefined4 local_2c; undefined4 local_28; int local_24; long local_20; local_38 = param_2; local_2c = param_1; dpkg_locales_init(&DAT_00100bb0); dpkg_program_init("dpkg-trigger"); dpkg_options_parse(&local_38, cmdinfos, "Type dpkg-trigger --help for help about this utility."); admindir = dpkg_db_set_dir(admindir); if (f_check == 0) { if ((*local_38 == 0) || (local_38[1] != 0)) { uVar2 = gettext("takes one argument, the trigger name"); badusage(uVar2); } local_20 = parse_awaiter_package(); uVar2 = bypackage; if (local_20 != 0) { uVar3 = gettext("illegal awaited package name \'%.250s\': %.250s"); badusage(uVar3, uVar2, local_20); } activate = *local_38; local_20 = trig_name_is_illegal(activate); lVar1 = activate; if (local_20 != 0) { uVar2 = gettext("invalid trigger name \'%.250s\': %.250s"); badusage(uVar2, lVar1, local_20); } trigdef_set_methods(tdm_add); local_28 = 1; if (f_noact == 0) { local_28 = 0xb; } local_24 = trigdef_update_start(local_28); if (-1 < local_24) { trigdef_parse(); if (done_trig != '\x01') { trigdef_update_printf("%s %s\n", activate, bypackage); } trigdef_process_done(); } dpkg_program_done(); dpkg_locales_done(); uVar2 = 0; } else { if (*local_38 != 0) { uVar2 = gettext("--%s takes no arguments"); badusage(uVar2, "check-supported"); } uVar2 = do_check(); } return uVar2; }
dpkg
ghidra
static void send_msg(struct sshbuf *m) { u_char buf[4]; size_t mlen = sshbuf_len(m); int r; do { const u_int32_t __v = (mlen); ((u_char *)(buf))[0] = (__v >> 24) & 0xff; ((u_char *)(buf))[1] = (__v >> 16) & 0xff; ((u_char *)(buf))[2] = (__v >> 8) & 0xff; ((u_char *)(buf))[3] = __v & 0xff; } while (0); if (atomicio((ssize_t (*)(int, void *, size_t))write, fd, buf, 4) != 4 || atomicio((ssize_t (*)(int, void *, size_t))write, fd, sshbuf_mutable_ptr(m), sshbuf_len(m)) != sshbuf_len(m)) sshlog("ssh-pkcs11-client.c", __func__, 66, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "write to helper failed"); if ((r = sshbuf_consume(m, mlen)) != 0) sshfatal("ssh-pkcs11-client.c", __func__, 68, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "consume"); }
void send_msg(unsigned long long a0) { unsigned long long v0; unsigned int v1; unsigned int v2; unsigned long long v3; char v4; char v5; char v6; char v7; char v8; unsigned long long *v10; unsigned long long v11; v3 = sshbuf_len(a0); v1 = v3; v4 = v1 >> 24; v5 = v1 >> 16; v6 = v1 >> 8; v7 = v1; if (atomicio(got.write, fd, &v4, 0x4) == 4 && atomicio(got.write, fd, sshbuf_mutable_ptr(a0), sshbuf_len(a0)) == sshbuf_len(a0)) goto LABEL_400108; v0 = "write to helper failed"; sshlog("ssh-pkcs11-client.c", "send_msg", 0x42, 0x0, 0x2, 0x0); LABEL_400108: v2 = sshbuf_consume(a0, v3, v3); if (v2) { v0 = "consume"; sshfatal("ssh-pkcs11-client.c", "send_msg", 0x44, 0x1, 0x1, ssh_err(v2)); } v11 = *(&v8) ^ v10[5]; return; }
openssh-portable
angr_phoenix
static int bash_backward_shellword(count, key) int count, key; { size_t slen; int c, p, prev_p; mbstate_t state; memset(&state, '\0', sizeof(mbstate_t)); if (count < 0) return (bash_forward_shellword(-count, key)); p = rl_point; slen = rl_end; while (count) { if (p == 0) { rl_point = 0; return 0; } do { if (locale_mb_cur_max > 1) { mbstate_t state_bak; size_t mblength; int _x, _p; _x = _p = 0; while (_x < (p)) { state_bak = state; mblength = mbrlen((rl_line_buffer) + (_x), (slen) - (_x), &state); if (mblength == (size_t)-2 || mblength == (size_t)-1) { state = state_bak; _x++; } else if (mblength == 0) _x++; else { _p = _x; _x += mblength; } } (p) = _p; } else (p)--; } while (0); while (p > 0) { c = rl_line_buffer[p]; if (((sh_syntaxtab[(unsigned char)(c)] & 0x0001) || (sh_syntaxtab[(unsigned char)(c)] & 0x2000)) == 0 || char_is_quoted(rl_line_buffer, p)) break; do { if (locale_mb_cur_max > 1) { mbstate_t state_bak; size_t mblength; int _x, _p; _x = _p = 0; while (_x < (p)) { state_bak = state; mblength = mbrlen((rl_line_buffer) + (_x), (slen) - (_x), &state); if (mblength == (size_t)-2 || mblength == (size_t)-1) { state = state_bak; _x++; } else if (mblength == 0) _x++; else { _p = _x; _x += mblength; } } (p) = _p; } else (p)--; } while (0); } if (p == 0) { rl_point = 0; return 0; } prev_p = p; while (p > 0) { c = rl_line_buffer[p]; if (((sh_syntaxtab[(unsigned char)(c)] & 0x0001) || (sh_syntaxtab[(unsigned char)(c)] & 0x2000)) && char_is_quoted(rl_line_buffer, p) == 0) { p = prev_p; break; } prev_p = p; do { if (locale_mb_cur_max > 1) { mbstate_t state_bak; size_t mblength; int _x, _p; _x = _p = 0; while (_x < (p)) { state_bak = state; mblength = mbrlen((rl_line_buffer) + (_x), (slen) - (_x), &state); if (mblength == (size_t)-2 || mblength == (size_t)-1) { state = state_bak; _x++; } else if (mblength == 0) _x++; else { _p = _x; _x += mblength; } } (p) = _p; } else (p)--; } while (0); } count--; } rl_point = p; return 0; }
long bash_backward_shellword(int a1, unsigned int a2) { _BOOL4 v3; int v4; int v5; int v6; int v7; int v8; int v9; int v10; int v11; int v12; unsigned char v13; unsigned char v14; long v15; size_t v16; size_t v17; size_t v18; long s; long v20; unsigned long v21; v4 = a1; v21 = __readfsqword(0x28u); memset(&s, 0, sizeof(s)); if (a1 < 0) return bash_forward_shellword(-a1, a2); v5 = rl_point; v15 = rl_end; while (v4) { if (!v5) { rl_point = 0; return 0LL; } if (locale_mb_cur_max <= 1) { --v5; } else { v8 = 0; v7 = 0; while (v7 < v5) { v20 = s; v16 = mbrlen(&rl_line_buffer[v7], v15 - v7, (mbstate_t *)&s); if (v16 < 0xFFFFFFFFFFFFFFFELL) { if (v16) { v8 = v7; v7 += v16; } else { ++v7; } } else { s = v20; ++v7; } } v5 = v8; } while (v5 > 0) { v13 = rl_line_buffer[v5]; v3 = (sh_syntaxtab[v13] & 1) != 0 || (sh_syntaxtab[v13] & 0x2000) != 0; if (!v3 || (unsigned int)char_is_quoted(rl_line_buffer, (unsigned int)v5)) break; if (locale_mb_cur_max <= 1) { --v5; } else { v10 = 0; v9 = 0; while (v9 < v5) { v20 = s; v17 = mbrlen(&rl_line_buffer[v9], v15 - v9, (mbstate_t *)&s); if (v17 < 0xFFFFFFFFFFFFFFFELL) { if (v17) { v10 = v9; v9 += v17; } else { ++v9; } } else { s = v20; ++v9; } } v5 = v10; } } if (!v5) { rl_point = 0; return 0LL; } v6 = v5; while (v5 > 0) { v14 = rl_line_buffer[v5]; if (((sh_syntaxtab[v14] & 1) != 0 || (sh_syntaxtab[v14] & 0x2000) != 0) && !(unsigned int)char_is_quoted(rl_line_buffer, (unsigned int)v5)) { v5 = v6; break; } v6 = v5; if (locale_mb_cur_max <= 1) { --v5; } else { v12 = 0; v11 = 0; while (v11 < v5) { v20 = s; v18 = mbrlen(&rl_line_buffer[v11], v15 - v11, (mbstate_t *)&s); if (v18 < 0xFFFFFFFFFFFFFFFELL) { if (v18) { v12 = v11; v11 += v18; } else { ++v11; } } else { s = v20; ++v11; } } v5 = v12; } } --v4; } rl_point = v5; return 0LL; }
bash
ida
static void open_files(void) { if (!list) { if (gr_lock() == 0) { fprintf(stderr, gettext("%s: cannot lock %s; try again later.\n"), Prog, gr_dbname()); fail_exit(2); } gr_locked = 1; if (is_shadowgrp) { if (sgr_lock() == 0) { fprintf(stderr, gettext("%s: cannot lock %s; try again later.\n"), Prog, sgr_dbname()); fail_exit(2); } sgr_locked = 1; } } if (gr_open(list ? 00 : 0100 | 02) == 0) { fprintf(stderr, gettext("%s: cannot open %s\n"), Prog, gr_dbname()); fail_exit(2); } if (is_shadowgrp) { if (sgr_open(list ? 00 : 0100 | 02) == 0) { fprintf(stderr, gettext("%s: cannot open %s\n"), Prog, sgr_dbname()); fail_exit(2); } } }
void open_files(void) { undefined8 uVar1; int iVar2; undefined4 uVar3; undefined8 uVar4; char *pcVar5; if (list != '\x01') { iVar2 = gr_lock(); if (iVar2 == 0) { uVar4 = gr_dbname(); uVar1 = Prog; pcVar5 = (char *)gettext("%s: cannot lock %s; try again later.\n"); fprintf(stderr, pcVar5, uVar1, uVar4); fail_exit(2); } gr_locked = 1; if (is_shadowgrp != '\0') { iVar2 = sgr_lock(); if (iVar2 == 0) { uVar4 = sgr_dbname(); uVar1 = Prog; pcVar5 = (char *)gettext("%s: cannot lock %s; try again later.\n"); fprintf(stderr, pcVar5, uVar1, uVar4); fail_exit(2); } sgr_locked = 1; } } if (list == '\0') { uVar3 = 0x42; } else { uVar3 = 0; } iVar2 = gr_open(uVar3); if (iVar2 == 0) { uVar4 = gr_dbname(); uVar1 = Prog; pcVar5 = (char *)gettext("%s: cannot open %s\n"); fprintf(stderr, pcVar5, uVar1, uVar4); fail_exit(2); } if (is_shadowgrp != '\0') { if (list == '\0') { uVar3 = 0x42; } else { uVar3 = 0; } iVar2 = sgr_open(uVar3); if (iVar2 == 0) { uVar4 = sgr_dbname(); uVar1 = Prog; pcVar5 = (char *)gettext("%s: cannot open %s\n"); fprintf(stderr, pcVar5, uVar1, uVar4); fail_exit(2); } } return; }
shadow
ghidra
static int parse_principals_key_and_options(const char *path, u_long linenum, char *line, const char *required_principal, char **principalsp, struct sshkey **keyp, struct sshsigopt **sigoptsp) { char *opts = ((void *)0), *tmp, *cp, *principals = ((void *)0); const char *reason = ((void *)0); struct sshsigopt *sigopts = ((void *)0); struct sshkey *key = ((void *)0); int r = -1; if (principalsp != ((void *)0)) *principalsp = ((void *)0); if (sigoptsp != ((void *)0)) *sigoptsp = ((void *)0); if (keyp != ((void *)0)) *keyp = ((void *)0); cp = line; cp = cp + strspn(cp, " \t"); if (*cp == '#' || *cp == '\0') return -46; if ((tmp = strdelimw(&cp)) == ((void *)0) || cp == ((void *)0)) { sshlog("sshsig.c", __func__, 744, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "%s:%lu: invalid line", path, linenum); r = -4; goto out; } if ((principals = strdup(tmp)) == ((void *)0)) { sshlog("sshsig.c", __func__, 749, 1, SYSLOG_LEVEL_ERROR, ((void *)0), "strdup failed"); r = -2; goto out; } if (required_principal != ((void *)0)) { if (match_pattern_list(required_principal, principals, 0) != 1) { r = -46; goto out; } sshlog("sshsig.c", __func__, 764, 1, SYSLOG_LEVEL_DEBUG1, ((void *)0), "%s:%lu: matched principal \"%s\"", path, linenum, required_principal); } if ((key = sshkey_new(KEY_UNSPEC)) == ((void *)0)) { sshlog("sshsig.c", __func__, 769, 1, SYSLOG_LEVEL_ERROR, ((void *)0), "sshkey_new failed"); r = -2; goto out; } if (sshkey_read(key, &cp) != 0) { opts = cp; if (sshkey_advance_past_options(&cp) != 0) { sshlog("sshsig.c", __func__, 777, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "%s:%lu: invalid options", path, linenum); r = -4; goto out; } if (cp == ((void *)0) || *cp == '\0') { sshlog("sshsig.c", __func__, 782, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "%s:%lu: missing key", path, linenum); r = -4; goto out; } *cp++ = '\0'; skip_space(&cp); if (sshkey_read(key, &cp) != 0) { sshlog("sshsig.c", __func__, 789, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "%s:%lu: invalid key", path, linenum); r = -4; goto out; } } sshlog("sshsig.c", __func__, 794, 0, SYSLOG_LEVEL_DEBUG3, ((void *)0), "%s:%lu: options %s", path, linenum, opts == ((void *)0) ? "" : opts); if ((sigopts = sshsigopt_parse(opts, path, linenum, &reason)) == ((void *)0)) { sshlog("sshsig.c", __func__, 796, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "%s:%lu: bad options: %s", path, linenum, reason); r = -4; goto out; } if (principalsp != ((void *)0)) { *principalsp = principals; principals = ((void *)0); } if (sigoptsp != ((void *)0)) { *sigoptsp = sigopts; sigopts = ((void *)0); } if (keyp != ((void *)0)) { *keyp = key; key = ((void *)0); } r = 0; out: free(principals); sshsigopt_free(sigopts); sshkey_free(key); return r; }
int parse_principals_key_and_options(unsigned int a0, unsigned int a1, char *a2, unsigned long long a3, unsigned long long *a4, unsigned long long *a5, unsigned long v13) { unsigned long long v0; int tmp_9; unsigned long v1; unsigned long v2; unsigned long long v3; unsigned long long *v4; unsigned int v5; unsigned long v6; void *v7; unsigned long long v8; void *v9; void *v10; void *v11; char *v12; unsigned long long v14; unsigned long long v15; v4 = v13; v8 = 0; v9 = 0; v7 = 0; v10 = 0; v11 = 0; v5 = -1; if (a4) *(a4) = 0; if (v4) *(v4) = 0; if (a5) *(a5) = 0; v6 = a2; v6 = &v6[strspn(v6, " \t")]; if (*(v6) != 35 && *(v6)) { v12 = strdelimw(&v6); if (v12 && v6) { v9 = strdup(v12); if (!v9) { v2 = "strdup failed"; sshlog("sshsig.c", "parse_principals_key_and_options", 0x2ed, 0x1, 0x2, 0x0); v5 = -2; } else { if (a3) { v14 = match_pattern_list(a3, v9, 0x0); if (v14 != 1) { v5 = -46; } else { v3 = a3; *(&v2) = a1; *(&v1) = a0; v0 = "%s:%lu: matched principal \"%s\""; sshlog("sshsig.c", "parse_principals_key_and_options", 0x2fc, 0x1, 0x5, 0x0); } } if (v14 == 1 || !a3) { v11 = sshkey_new(0xe); if (!v11) { v2 = "sshkey_new failed"; sshlog("sshsig.c", "parse_principals_key_and_options", 0x301, 0x1, 0x2, 0x0); v5 = -2; } else { v15 = sshkey_read(v11, &v6, &v6); if (v15) { v8 = v6; v14 = sshkey_advance_past_options(&v6); if (v14) { *(&v2) = a1; *(&v1) = a0; v0 = "%s:%lu: invalid options"; sshlog("sshsig.c", "parse_principals_key_and_options", 0x309, 0x0, 0x2, 0x0); v5 = -0x4; } else { if (v6 && *(v6)) { tmp_9 = v6; v6 += 1; *(tmp_9) = 0; skip_space(&v6); v14 = sshkey_read(v11, &v6, &v6); if (v14) { *(&v2) = a1; *(&v1) = a0; v0 = "%s:%lu: invalid key"; sshlog("sshsig.c", "parse_principals_key_and_options", 0x315, 0x0, 0x2, 0x0); v5 = -0x4; } } if (!*(v6) || !v6) { *(&v2) = a1; *(&v1) = a0; v0 = "%s:%lu: missing key"; sshlog("sshsig.c", "parse_principals_key_and_options", 0x30e, 0x0, 0x2, 0x0); v5 = -0x4; } } } if (!v15 || !v14 && !v14 && *(v6) && v6) { if (v8) v14 = v8; else v14 = &g_404419; v3 = v14; *(&v2) = a1; *(&v1) = a0; v0 = "%s:%lu: options %s"; sshlog("sshsig.c", "parse_principals_key_and_options", 0x31a, 0x0, 0x7, 0x0); v10 = sshsigopt_parse(v8, a0, a1, &v7); if (!v10) { v3 = v7; *(&v2) = a1; *(&v1) = a0; v0 = "%s:%lu: bad options: %s"; sshlog("sshsig.c", "parse_principals_key_and_options", 0x31c, 0x0, 0x2, 0x0); v5 = -0x4; } else { if (a4) { *(a4) = v9; v9 = 0; } if (v4) { *(v4) = v10; v10 = 0; } if (a5) { *(a5) = v11; v11 = 0; } v5 = 0; } } } } } } if (!v12 || !v6) { *(&v2) = a1; *(&v1) = a0; v0 = "%s:%lu: invalid line"; sshlog("sshsig.c", "parse_principals_key_and_options", 0x2e8, 0x0, 0x2, 0x0); v5 = -0x4; } free(v9); sshsigopt_free(v10); sshkey_free(v11); v14 = v5; } if (!*(v6) || *(v6) == 35) v14 = -46; return v14; }
openssh-portable
angr_dream
static _Bool usable_st_size(struct stat const *st) { return ((((st->st_mode)) & 0170000) == (0100000)) || ((st)->st_mode - (st)->st_mode) || 0; }
bool usable_st_size(long a1) { return (*(_DWORD *)(a1 + 24) & 0xF000) == 0x8000; }
grep
ida
static speed_t tty__getspeed(struct termios *td) { speed_t spd; if ((spd = cfgetispeed(td)) == 0) spd = cfgetospeed(td); return spd; }
speed_t tty__getspeed(termios *param_1) { speed_t local_c; local_c = cfgetispeed(param_1); if (local_c == 0) { local_c = cfgetospeed(param_1); } return local_c; }
libedit
ghidra
static void pubkey_reset(Authctxt *authctxt) { Identity *id; for ((id) = ((&authctxt->keys)->tqh_first); (id) != ((void *)0); (id) = ((id)->next.tqe_next)) id->tried = 0; }
long *pubkey_reset(long a1) { long *result; long *i; result = *(long **)(a1 + 56); for (i = result; i; i = (long *)*i) { *((_DWORD *)i + 10) = 0; result = (long *)*i; } return result; }
openssh-portable
ida
static int sshsig_wrap_verify(struct sshbuf *signature, const char *hashalg, const struct sshbuf *h_message, const char *expect_namespace, struct sshkey **sign_keyp, struct sshkey_sig_details **sig_details) { int r = -1; struct sshbuf *buf = ((void *)0), *toverify = ((void *)0); struct sshkey *key = ((void *)0); const u_char *sig; char *got_namespace = ((void *)0), *sigtype = ((void *)0), *sig_hashalg = ((void *)0); size_t siglen; sshlog("sshsig.c", __func__, 300, 1, SYSLOG_LEVEL_DEBUG1, ((void *)0), "verify message length %zu", sshbuf_len(h_message)); if (sig_details != ((void *)0)) *sig_details = ((void *)0); if (sign_keyp != ((void *)0)) *sign_keyp = ((void *)0); if ((toverify = sshbuf_new()) == ((void *)0)) { sshlog("sshsig.c", __func__, 307, 1, SYSLOG_LEVEL_ERROR, ((void *)0), "sshbuf_new failed"); r = -2; goto done; } if ((r = sshbuf_put(toverify, "SSHSIG", (sizeof("SSHSIG") - 1))) != 0 || (r = sshbuf_put_cstring(toverify, expect_namespace)) != 0 || (r = sshbuf_put_string(toverify, ((void *)0), 0)) != 0 || (r = sshbuf_put_cstring(toverify, hashalg)) != 0 || (r = sshbuf_put_stringb(toverify, h_message)) != 0) { sshlog("sshsig.c", __func__, 317, 1, SYSLOG_LEVEL_ERROR, ssh_err(r), "assemble message to verify"); goto done; } if ((r = sshsig_parse_preamble(signature)) != 0) goto done; if ((r = sshkey_froms(signature, &key)) != 0 || (r = sshbuf_get_cstring(signature, &got_namespace, ((void *)0))) != 0 || (r = sshbuf_get_string(signature, ((void *)0), ((void *)0))) != 0 || (r = sshbuf_get_cstring(signature, &sig_hashalg, ((void *)0))) != 0 || (r = sshbuf_get_string_direct(signature, &sig, &siglen)) != 0) { sshlog("sshsig.c", __func__, 329, 1, SYSLOG_LEVEL_ERROR, ssh_err(r), "parse signature object"); goto done; } if (sshbuf_len(signature) != 0) { sshlog("sshsig.c", __func__, 334, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "Signature contains trailing data"); r = -4; goto done; } if (strcmp(expect_namespace, got_namespace) != 0) { sshlog("sshsig.c", __func__, 340, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "Couldn't verify signature: namespace does not match"); sshlog("sshsig.c", __func__, 341, 1, SYSLOG_LEVEL_DEBUG1, ((void *)0), "expected namespace \"%s\" received \"%s\"", expect_namespace, got_namespace); r = -21; goto done; } if (strcmp(hashalg, sig_hashalg) != 0) { sshlog("sshsig.c", __func__, 347, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "Couldn't verify signature: hash algorithm mismatch"); sshlog("sshsig.c", __func__, 348, 1, SYSLOG_LEVEL_DEBUG1, ((void *)0), "expected algorithm \"%s\" received \"%s\"", hashalg, sig_hashalg); r = -21; goto done; } if (sshkey_type_plain(key->type) == KEY_RSA) { if ((r = sshkey_get_sigtype(sig, siglen, &sigtype)) != 0) { sshlog("sshsig.c", __func__, 356, 0, SYSLOG_LEVEL_ERROR, ssh_err(r), "Couldn't verify signature: unable to get " "signature type"); goto done; } if (match_pattern_list(sigtype, "rsa-sha2-512,rsa-sha2-256", 0) != 1) { sshlog("sshsig.c", __func__, 361, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "Couldn't verify signature: unsupported RSA " "signature algorithm %s", sigtype); r = -58; goto done; } } if ((r = sshkey_verify(key, sig, siglen, sshbuf_ptr(toverify), sshbuf_len(toverify), ((void *)0), 0, sig_details)) != 0) { sshlog("sshsig.c", __func__, 369, 0, SYSLOG_LEVEL_ERROR, ssh_err(r), "Signature verification failed"); goto done; } r = 0; if (sign_keyp != ((void *)0)) { *sign_keyp = key; key = ((void *)0); } done: free(got_namespace); free(sigtype); free(sig_hashalg); sshbuf_free(buf); sshbuf_free(toverify); sshkey_free(key); return r; }
int sshsig_wrap_verify(unsigned long long a0, char *a1, unsigned long long a2, char *a3, unsigned long long *a4, unsigned long long *a5) { unsigned long long v0; unsigned long v1; unsigned long long *v2; unsigned int v3; void *v4; char v5; void *v6; void *v7; void *v8; char v9; void *v10; void *v11; v3 = -1; v10 = 0; v11 = 0; v4 = 0; v6 = 0; v7 = 0; v8 = 0; v2 = sshbuf_len(a2); sshlog("sshsig.c", "sshsig_wrap_verify", 0x12c, 0x1, 0x5, 0x0); if (a5) *(a5) = 0; if (a4) *(a4) = 0; v11 = sshbuf_new(); if (!v11) { sshlog("sshsig.c", "sshsig_wrap_verify", 0x133, 0x1, 0x2, 0x0); v3 = -2; } else { v3 = sshbuf_put(v11, "SSHSIG", 0x6); if (v3) { sshlog("sshsig.c", "sshsig_wrap_verify", 0x13d, 0x1, 0x2, ssh_err(v3)); } else { v3 = sshbuf_put_cstring(v11, a3, a3); if (v3) { sshlog("sshsig.c", "sshsig_wrap_verify", 0x13d, 0x1, 0x2, ssh_err(v3)); } else { v3 = sshbuf_put_string(v11, 0x0, 0x0); if (v3) { sshlog("sshsig.c", "sshsig_wrap_verify", 0x13d, 0x1, 0x2, ssh_err(v3)); } else { v3 = sshbuf_put_cstring(v11, a1, a1); if (v3) { sshlog("sshsig.c", "sshsig_wrap_verify", 0x13d, 0x1, 0x2, ssh_err(v3)); } else { v3 = sshbuf_put_stringb(v11, a2, a2); if (v3) { sshlog("sshsig.c", "sshsig_wrap_verify", 0x13d, 0x1, 0x2, ssh_err(v3)); } else { v3 = sshsig_parse_preamble(a0); if (!v3) { v3 = sshkey_froms(a0, &v4, &v4); if (v3) { sshlog("sshsig.c", "sshsig_wrap_verify", 0x149, 0x1, 0x2, ssh_err(v3)); } else { v3 = sshbuf_get_cstring(a0, &v6, 0x0, &v6); if (v3) { sshlog("sshsig.c", "sshsig_wrap_verify", 0x149, 0x1, 0x2, ssh_err(v3)); } else { v3 = sshbuf_get_string(a0, 0x0, 0x0); if (v3) { sshlog("sshsig.c", "sshsig_wrap_verify", 0x149, 0x1, 0x2, ssh_err(v3)); } else { v3 = sshbuf_get_cstring(a0, &v8, 0x0, &v8); if (v3) { sshlog("sshsig.c", "sshsig_wrap_verify", 0x149, 0x1, 0x2, ssh_err(v3)); } else { v3 = sshbuf_get_string_direct(a0, &v5, &v9); if (v3) { sshlog("sshsig.c", "sshsig_wrap_verify", 0x149, 0x1, 0x2, ssh_err(v3)); } else if (sshbuf_len(a0)) { sshlog("sshsig.c", "sshsig_wrap_verify", 0x14e, 0x0, 0x2, 0x0); v3 = -0x4; } else if (strcmp(a3, v6)) { sshlog("sshsig.c", "sshsig_wrap_verify", 0x154, 0x0, 0x2, 0x0); v1 = a3; v0 = "expected namespace \"%s\" received \"%s\""; sshlog("sshsig.c", "sshsig_wrap_verify", 0x155, 0x1, 0x5, 0x0); v3 = -21; } else if (strcmp(a1, v8)) { sshlog("sshsig.c", "sshsig_wrap_verify", 0x15b, 0x0, 0x2, 0x0); v1 = a1; v0 = "expected algorithm \"%s\" received \"%s\""; sshlog("sshsig.c", "sshsig_wrap_verify", 0x15c, 0x1, 0x5, 0x0); v3 = -21; } else { if (!sshkey_type_plain(*(v4))) { v3 = sshkey_get_sigtype(*(&v5), *(&v9), &v7, *(&v9)); if (v3) { sshlog("sshsig.c", "sshsig_wrap_verify", 0x164, 0x0, 0x2, ssh_err(v3)); goto LABEL_401483; } if (match_pattern_list(v7, "rsa-sha2-512,rsa-sha2-256", 0x0) != 1) { v2 = v7; sshlog("sshsig.c", "sshsig_wrap_verify", 0x169, 0x0, 0x2, 0x0); v3 = -58; goto LABEL_401483; } } v2 = a5; v3 = sshkey_verify(v4, *(&v5), *(&v9), sshbuf_ptr(v11), sshbuf_len(v11), 0x0, 0x0); if (v3) { sshlog("sshsig.c", "sshsig_wrap_verify", 0x171, 0x0, 0x2, ssh_err(v3)); } else { v3 = 0; if (a4) { *(a4) = v4; v4 = 0; } } } } } } } } } } } } } } LABEL_401483: free(v6); free(v7); free(v8); sshbuf_free(v10); sshbuf_free(v11); sshkey_free(v4); return v3; }
openssh-portable
angr_sailr
void xalloc_die(void) { error(0, 0, "%s", gettext("memory exhausted")); fatal_exit(); }
void xalloc_die() { char *v0; v0 = gettext("memory exhausted"); error(0, 0, "%s", v0); fatal_exit(); }
tar
ida
static SHELL_VAR *get_bashpid(var) SHELL_VAR *var; { int pid; pid = getpid(); return (set_int_value(var, pid, 1)); }
long long get_bashpid(void *a0) { unsigned int v0; v0 = getpid(); return set_int_value(a0, v0, 0x1); }
bash
angr_dream
wchar_t _rl_char_value(char *buf, int ind) { size_t tmp; wchar_t wc; mbstate_t ps; int l; if (16 == 1 || rl_byte_oriented) return ((wchar_t)buf[ind]); if (_rl_utf8locale && (((buf[ind]) & 0x80) == 0)) return ((wchar_t)buf[ind]); l = strlen(buf); if (ind >= l - 1) return ((wchar_t)buf[ind]); if (l < ind) l = strlen(buf + ind); memset(&ps, 0, sizeof(mbstate_t)); tmp = mbrtowc(&wc, buf + ind, l - ind, &ps); if (((tmp) == (size_t)-1 || (tmp) == (size_t)-2) || ((tmp) == 0)) return ((wchar_t)buf[ind]); return wc; }
long long _rl_char_value(char *a0, unsigned long a1) { char v0; unsigned int v1; unsigned long v2; char v3; unsigned long long v5; if (rl_byte_oriented) { v5 = a0[a1]; } else { if (_rl_utf8locale && a0[a1] >= 0) v5 = a0[a1]; if (!_rl_utf8locale || a0[a1] < 0) { v1 = strlen(a0); if (a1 >= v1 - 1) { v5 = a0[a1]; } else { if (v1 < a1) v1 = strlen(&a0[a1]); memset(&v3, 0x0, 0x8); v2 = mbrtowc(&v0, &a0[a1], v1 - a1, &v3); if (v2 != -1 && v2 != -2 && v2) v5 = *(&v0); if (v2 == -1 || !v2 || v2 == -2) v5 = a0[a1]; } } } return v5; }
bash
angr_dream
static int uhash_reset(uhash_ctx_t pc) { nh_reset(&pc->hash); pc->msg_len = 0; pc->poly_accum[0] = 1; pc->poly_accum[1] = 1; pc->poly_accum[2] = 1; pc->poly_accum[3] = 1; return 1; }
void uhash_reset(struct_0 *a0) { unsigned long long v1; nh_reset(a0); a0->field_568 = 0; a0->field_4b8 = 1; a0->field_4c0 = 1; a0->field_4c8 = 1; a0->field_4d0 = 1; v1 = 1; return; }
openssh-portable
angr_dream
static int try_symlink(char *dest, void *arg) { struct symlink_arg *a = arg; return symlinkat(a->srcname, a->dstdir, dest); }
void try_symlink(char *param_1, char **param_2) { symlinkat(*param_2, *(int *)(param_2 + 1), param_1); return; }
coreutils
ghidra
int do_hardlink(struct sftp_conn *conn, const char *oldpath, const char *newpath) { struct sshbuf *msg; u_int status, id; int r; if ((conn->exts & 0x00000008) == 0) { sshlog("sftp-client.c", __func__, 1260, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "Server does not support hardlink@openssh.com extension"); return -1; } sshlog("sftp-client.c", __func__, 1263, 0, SYSLOG_LEVEL_DEBUG2, ((void *)0), "Sending SSH2_FXP_EXTENDED(hardlink@openssh.com) " "\"%s\" to \"%s\"", oldpath, newpath); if ((msg = sshbuf_new()) == ((void *)0)) sshfatal("sftp-client.c", __func__, 1267, 1, SYSLOG_LEVEL_FATAL, ((void *)0), "sshbuf_new failed"); id = conn->msg_id++; if ((r = sshbuf_put_u8(msg, 200)) != 0 || (r = sshbuf_put_u32(msg, id)) != 0 || (r = sshbuf_put_cstring(msg, "hardlink@openssh.com")) != 0 || (r = sshbuf_put_cstring(msg, oldpath)) != 0 || (r = sshbuf_put_cstring(msg, newpath)) != 0) sshfatal("sftp-client.c", __func__, 1276, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "compose"); send_msg(conn, msg); sshlog("sftp-client.c", __func__, 1278, 0, SYSLOG_LEVEL_DEBUG3, ((void *)0), "Sent message hardlink@openssh.com \"%s\" -> \"%s\"", oldpath, newpath); sshbuf_free(msg); status = get_status(conn, id); if (status != 0) sshlog("sftp-client.c", __func__, 1284, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "remote link \"%s\" to \"%s\": %s", oldpath, newpath, fx2txt(status)); return status == 0 ? 0 : -1; }
long long do_hardlink(unsigned int a0[8], unsigned long long a1, unsigned long long a2) { unsigned long v0; int tmp_14; unsigned int v1[8]; unsigned long long v2; unsigned int v3; unsigned long v4; unsigned int v5; unsigned long long v6; unsigned long v7; char v8; unsigned long long v10; *(&v1[0]) = a0; if (!(a0[7] & 8)) { sshlog("sftp-client.c", "do_hardlink", 0x4ec, 0x0, 0x2, 0x0, "Server does not support hardlink@openssh.com extension"); v10 = 4294967295; } else { v0 = a1; sshlog("sftp-client.c", "do_hardlink", 0x4ef, 0x0, 0x6, 0x0, "Sending SSH2_FXP_EXTENDED(hardlink@openssh.com) \"%s\" to \"%s\""); v6 = sshbuf_new(); if (!v6) sshfatal("sftp-client.c", "do_hardlink", 0x4f3, 0x1, 0x1, 0x0, "sshbuf_new failed"); tmp_14 = a0[6]; a0[6] = a0[6] + 1; v4 = tmp_14; v3 = sshbuf_put_u8(v6, 0xc8, a0); if (!v3) { v3 = sshbuf_put_u32(v6, v4, v4); if (!v3) { v3 = sshbuf_put_cstring(v6, "hardlink@openssh.com"); if (!v3) { v3 = sshbuf_put_cstring(v6, a1); if (!v3) { v3 = sshbuf_put_cstring(v6, a2); if (!v3) goto LABEL_404f09; } } } } v6 = "compose"; sshfatal("sftp-client.c", "do_hardlink", 0x4fc, 0x1, 0x1, ssh_err(v3), *(&v8)); LABEL_404f09: send_msg(a0, v6); v6 = a2; v4 = a1; v2 = "Sent message hardlink@openssh.com \"%s\" -> \"%s\""; sshlog("sftp-client.c", "do_hardlink", 0x4fe, 0x0, 0x7, 0x0, *(&v8)); sshbuf_free(v6); v5 = get_status(a0, v4); if (v5) { v7 = fx2txt(v5); v6 = a2; v4 = a1; v2 = "remote link \"%s\" to \"%s\": %s"; sshlog("sftp-client.c", "do_hardlink", 0x504, 0x0, 0x2, 0x0, *(&v8)); } if (!*((&v4 + 4))) v10 = 0; else v10 = 4294967295; } return v10; }
openssh-portable
angr_phoenix
static void fail_check(void) { CHILD *ch; time_t t; time_t next_alarm = 0; time(&t); for (ch = family; ch; ch = ch->next) { if (ch->flags & 16) { if (ch->tm + 300 < t) { ch->flags &= ~16; ch->count = 0; ch->tm = 0; } else { if (next_alarm == 0 || ch->tm + 300 > next_alarm) next_alarm = ch->tm + 300; } } } if (next_alarm) { next_alarm -= t; if (next_alarm < 1) next_alarm = 1; alarm(next_alarm); } }
unsigned long fail_check() { time_t v1; long i; unsigned int seconds[2]; unsigned long v4; v4 = __readfsqword(0x28u); *(_QWORD *)seconds = 0LL; time(&v1); for (i = family; i; i = *(_QWORD *)(i + 192)) { if ((*(_DWORD *)i & 0x10) != 0) { if (*(_QWORD *)(i + 16) + 300LL >= v1) { if (!*(_QWORD *)seconds || *(long *)seconds <= *(_QWORD *)(i + 16) + 299LL) *(_QWORD *)seconds = *(_QWORD *)(i + 16) + 300LL; } else { *(_DWORD *)i &= ~0x10u; *(_DWORD *)(i + 24) = 0; *(_QWORD *)(i + 16) = 0LL; } } } if (*(_QWORD *)seconds) { *(_QWORD *)seconds -= v1; if (*(long *)seconds <= 0) *(_QWORD *)seconds = 1LL; alarm(seconds[0]); } return __readfsqword(0x28u) ^ v4; }
sysvinit
ida
static void fail_cancel(void) { CHILD *ch; for (ch = family; ch; ch = ch->next) { ch->count = 0; ch->tm = 0; ch->flags &= ~16; } }
void fail_cancel() { struct_0 *v0; unsigned long long v2; unsigned long long v3; v2 = family; for (v0 = family; v0; v0 = v0->field_c0) { v0->field_18 = 0; v0->field_10 = 0; v0->field_0 = v0->field_0 & -17; v3 = v0->field_c0; } return; }
sysvinit
angr_dream
static WORD_LIST *list_quote_escapes(list) WORD_LIST *list; { register WORD_LIST *w; char *t; for (w = list; w; w = w->next) { t = w->word->word; w->word->word = quote_escapes(t); sh_xfree((t), "subst.c", 4731); } return list; }
int list_quote_escapes(unsigned long long a0) { unsigned long long v0; struct_0 *v2; for (v2 = a0; v2; v2 = v2->field_0) { v0 = v2->field_8->field_0; v2->field_8->field_0 = quote_escapes(v0); sh_xfree(v0, "subst.c", 0x127b); } return a0; }
bash
angr_dream
void channel_set_fds(struct ssh *ssh, int id, int rfd, int wfd, int efd, int extusage, int nonblock, int is_tty, u_int window_max) { Channel *c = channel_lookup(ssh, id); int r; if (c == ((void *)0) || c->type != 10) sshfatal("channels.c", __func__, 1084, 0, SYSLOG_LEVEL_FATAL, ((void *)0), "channel_activate for non-larval channel %d.", id); if (!c->have_remote_id) sshfatal("channels.c", __func__, 1086, 1, SYSLOG_LEVEL_FATAL, ((void *)0), "channel %d: no remote id", c->self); channel_register_fds(ssh, c, rfd, wfd, efd, extusage, nonblock, is_tty); c->type = 4; c->local_window = c->local_window_max = window_max; if ((r = sshpkt_start(ssh, 93)) != 0 || (r = sshpkt_put_u32(ssh, c->remote_id)) != 0 || (r = sshpkt_put_u32(ssh, c->local_window)) != 0 || (r = sshpkt_send(ssh)) != 0) sshfatal("channels.c", __func__, 1096, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "channel %i", c->self); }
long long channel_set_fds(unsigned long a0, unsigned long a1, unsigned long a2, unsigned long a3, unsigned long a4, unsigned long a5, unsigned int v7, unsigned int a6, unsigned int a7) { unsigned long long v0; unsigned long v1; unsigned int v2; unsigned int v3[46]; unsigned long long v4; unsigned long v5; char v6; unsigned long long v8; *(&v3[0]) = channel_lookup(a0, a1); if (v3 && v3[0] == 10) goto LABEL_402780; v1 = a1; v0 = "channel_activate for non-larval channel %d."; sshfatal("channels.c", "channel_set_fds", 0x43c, 0x0, 0x1, 0x0); LABEL_402780: if (!v3[3]) { v5 = v3[1]; v4 = "channel %d: no remote id"; sshfatal("channels.c", "channel_set_fds", 0x43e, 0x1, 0x1, 0x0); } v5 = a6; v4 = v7; channel_register_fds(a0, v3, a2, a3, a4, a5, *(&v6), v7); v3[0] = 4; v3[45] = a7; v3[44] = v3[45]; v2 = sshpkt_start(a0, 0x5d); if (!v2) { v2 = sshpkt_put_u32(a0, v3[2], v3[2]); if (!v2) { v2 = sshpkt_put_u32(a0, v3[44], v3[44]); if (!v2) { v8 = sshpkt_send(a0); v2 = v8; if (!v2) goto LABEL_4028d1; } } } v5 = v3[1]; v4 = "channel %i"; v8 = sshfatal("channels.c", "channel_set_fds", 0x448, 0x1, 0x1, ssh_err(v2)); LABEL_4028d1: return v8; }
openssh-portable
angr_phoenix
static int check_inode_extra_negative_epoch(__u32 xtime, __u32 extra) { return (xtime & (1U << 31)) != 0 && (extra & ((1 << 2) - 1)) == ((1 << 2) - 1); }
int check_inode_extra_negative_epoch(unsigned long a0, unsigned long a1) { unsigned int v1; if (a0 < 0 && (a1 & 3) == 3) v1 = 1; if ((a1 & 3) != 3 || a0 >= 0) v1 = 0; return v1; }
e2fsprogs-1.46.5
angr_dream
get_stat_atime(struct stat const *st) { return ((st)->st_atim); }
void get_stat_atime(void) { halt_baddata(); }
tar
ghidra
void kill_all_local_variables() { VAR_CONTEXT *vc; for (vc = shell_variables; vc; vc = vc->down) if ((((vc)->flags & 0x04) != 0) && vc->scope == variable_context) break; if (vc == 0) return; if (vc->table && (((vc)->flags & 0x01) != 0)) { delete_all_variables(vc->table); hash_dispose(vc->table); } vc->table = (HASH_TABLE *)((void *)0); }
void kill_all_local_variables(void) { long local_10; for (local_10 = shell_variables; (local_10 != 0 && (((*(uint *)(local_10 + 0xc) & 4) == 0 || (*(int *)(local_10 + 8) != variable_context)))); local_10 = *(long *)(local_10 + 0x18)) { } if (local_10 != 0) { if ((*(long *)(local_10 + 0x20) != 0) && ((*(uint *)(local_10 + 0xc) & 1) != 0)) { delete_all_variables(*(undefined8 *)(local_10 + 0x20)); hash_dispose(*(undefined8 *)(local_10 + 0x20)); } *(undefined8 *)(local_10 + 0x20) = 0; } return; }
bash
ghidra
static Authmethod *authmethod_byname(const char *name) { int i; if (name == ((void *)0)) sshfatal("auth2.c", __func__, 517, 1, SYSLOG_LEVEL_FATAL, ((void *)0), "NULL authentication method name"); for (i = 0; authmethods[i] != ((void *)0); i++) { if (strcmp(name, authmethods[i]->name) == 0 || (authmethods[i]->synonym != ((void *)0) && strcmp(name, authmethods[i]->synonym) == 0)) return authmethods[i]; } sshlog("auth2.c", __func__, 524, 1, SYSLOG_LEVEL_DEBUG1, ((void *)0), "unrecognized authentication method name: %s", name); return ((void *)0); }
int authmethod_byname(char *a0) { unsigned long long v0; unsigned long long v1; unsigned int v2; unsigned long v3; char v4; unsigned int v6; if (!a0) { v0 = "NULL authentication method name"; sshfatal("auth2.c", "authmethod_byname", 0x205, 0x1, 0x1, 0x0); } v2 = 0; while (true) { if (!authmethods[v2]) { v3 = a0; v1 = "unrecognized authentication method name: %s"; sshlog("auth2.c", "authmethod_byname", 0x20c, 0x1, 0x5, 0x0, *(&v4)); v6 = 0; return v6; } if (!(strcmp(a0, *(authmethods[v2]))) || !(!*((authmethods[v2] + 8))) && !(strcmp(a0, *((authmethods[v2] + 8))))) break; v2 = __addvsi3(v2, 0x1); } v6 = authmethods[v2]; return v6; }
openssh-portable
angr_sailr
void wall(const char *text, int remote) { FILE *tp; struct sigaction sa; struct utmp *utmp; time_t t; char term[32 + strlen("/dev/") + 1]; char line[256]; char hostname[64 + 1]; char *date, *p; char *user, *tty; int fd, flags; (void)&tp; (void)&fd; getuidtty(&user, &tty); if (0 != gethostname(hostname, sizeof(hostname))) { strncpy(hostname, "[unknown]", sizeof(hostname) - 1); } hostname[sizeof(hostname) - 1] = 0; time(&t); date = ctime(&t); for (p = date; *p && *p != '\n'; p++) ; *p = 0; if (remote) { snprintf(line, sizeof(line), "\r\nRemote broadcast message (%s):\r\n\r\n", date); } else { snprintf(line, sizeof(line), "\r\nBroadcast message from %s@%s %s(%s):\r\n\r\n", user, hostname, tty, date); } if (fork() != 0) return; memset(&sa, 0, sizeof(sa)); sa.__sigaction_handler.sa_handler = handler; sa.sa_flags = 0; sigemptyset(&sa.sa_mask); sigaction(14, &sa, ((void *)0)); setutent(); while ((utmp = getutent()) != ((void *)0)) { if (utmp->ut_type != 7 || utmp->ut_user[0] == 0) continue; if (strncmp(utmp->ut_line, "/dev/", strlen("/dev/")) == 0) { term[0] = 0; strncat(term, utmp->ut_line, sizeof(term) - 1); } else snprintf(term, sizeof(term), "/dev/" "%.*s", 32, utmp->ut_line); if (strstr(term, "/../")) continue; fd = -1; tp = ((void *)0); if (__sigsetjmp(jbuf, 1) == 0) { alarm(2); flags = 01 | 04000 | 0400; if (file_isatty(term) && (fd = open(term, flags)) >= 0) { if (isatty(fd) && (tp = fdopen(fd, "w")) != ((void *)0)) { fputs(line, tp); feputs(text, tp); fflush(tp); } } } alarm(0); if (fd >= 0) close(fd); if (tp != ((void *)0)) fclose(tp); } endutent(); exit(0); }
long long wall(unsigned int a0, unsigned long a1) { char v0; unsigned int v1; unsigned int v2; unsigned int v3; void *v4; char v5; char v6; char v7; char *v8; unsigned long v9; char *v10; unsigned long v11; struct_0 *v12; char v13; char v14; unsigned int v15; char v16; char v17; char v18; unsigned long v19; unsigned long v20; unsigned long long v21; char v22; unsigned long long *v24; unsigned long long v25; unsigned long v26; v19 = v24[5]; v25 = strlen("/dev/"); *(&v1) = v25 + 33; v9 = v25 - -32; for (v26 = (0 CONCAT 15 + v25 + 33) / m 16 * 16; &v22 != &(&v0)[-1 * (v26 & -0x1000)]; v21 = v21) ; if ((v26 & 4095)) *((&v21 + (v26 & 4095))) = *((&v21 + (v26 & 4095))); v10 = &v22; getuidtty(&v6, &v7); if (gethostname(&v16, 0x41)) strncpy(&v16, "[unknown]", 0x40); v17 = 0; time(&v5); v11 = ctime(&v5); v8 = v11; while (true) { switch (*(v8)) { case 0: case 10: break; default: v8 += 1; continue; } } *(v8) = 0; if (!a1) { v20 = v11; snprintf(&v18, 0x100, "\r\nBroadcast message from %s@%s %s(%s):\r\n\r\n", *(&v6), &v16, *(&v7), *(&v22)); } else { snprintf(&v18, 0x100, "\r\nRemote broadcast message (%s):\r\n\r\n", v11); } if (!fork()) { memset(&v13, 0x0, 0x98); v13 = handler; v15 = 0; sigemptyset(&v14); sigaction(0xe, &v13, 0x0); setutent(); while (true) { do { do { do { do { v12 = &getutent()->ut_type; if (!v12) { endutent(); exit(0x0); } } while (v12->field_0 != 7); } while (!v12->field_2c); if (strncmp(&v12->padding_2[6], "/dev/", strlen("/dev/"))) { snprintf(v10, *(&v1), "/dev/%.*s", 32); } else { *(v10) = 0; strncat(v10, &v12->padding_2[6], *(&v1) - 1); } } while (strstr(v10, "/../")); v2 = -1; v4 = 0; if (!__sigsetjmp(&jbuf, 0x1)) { alarm(0x2); v3 = 2305; if (file_isatty(v10)) { v2 = open(v10, v3, v3); if (v2 >= 0 && isatty(v2)) { v4 = fdopen(v2, "w"); if (v4) { fputs(&v18, v4); feputs(a0, v4); fflush(v4); } } } } alarm(0x0); if (v2 >= 0) close(v2); } while (!v4); fclose(v4); } } else if (!(v19 ^ v24[5])) { return 0; } else { __stack_chk_fail(); } }
sysvinit
angr_sailr
int rl_newline(int count, int key) { if (rl_mark_active_p()) { rl_deactivate_mark(); (*rl_redisplay_function)(); _rl_want_redisplay = 0; } rl_done = 1; if (_rl_history_preserve_point) _rl_history_saved_point = (rl_point == rl_end) ? -1 : rl_point; (rl_readline_state |= (0x2000000)); if (rl_editing_mode == 0) { _rl_vi_done_inserting(); if (_rl_vi_textmod_command(_rl_vi_last_command) == 0) _rl_vi_reset_last(); } if (rl_erase_empty_line && rl_point == 0 && rl_end == 0) return 0; if (_rl_echoing_p) _rl_update_final(); return 0; }
long rl_newline() { int v0; if ((unsigned int)rl_mark_active_p()) { rl_deactivate_mark(); rl_redisplay_function(); rl_want_redisplay = 0; } rl_done = 1; if (rl_history_preserve_point) { if (rl_point == rl_end) v0 = -1; else v0 = rl_point; rl_history_saved_point = v0; } rl_readline_state |= 0x2000000uLL; if (!rl_editing_mode) { rl_vi_done_inserting(); if (!(unsigned int)rl_vi_textmod_command(rl_vi_last_command)) rl_vi_reset_last(); } if (rl_erase_empty_line && !rl_point && !rl_end) return 0LL; if (rl_echoing_p) rl_update_final(); return 0LL; }
bash
ida
size_t atomicio(ssize_t (*f)(int, void *, size_t), int fd, void *_s, size_t n) { return atomicio6(f, fd, _s, n, ((void *)0), ((void *)0)); }
long long atomicio(unsigned long long a0, unsigned long a1, unsigned int a2, unsigned int a3) { return atomicio6(a0, a1, a2, a3, 0x0, 0x0); }
openssh-portable
angr_sailr
int rl_vi_insert_beg(int count, int key) { rl_beg_of_line(1, key); rl_vi_insert_mode(1, key); return (0); }
long long rl_vi_insert_beg(unsigned long a0, unsigned long a1, unsigned int a2, unsigned long long a3, unsigned long long a4, unsigned long long a5) { unsigned int v0; v0 = a0; rl_beg_of_line(0x1, a1); rl_vi_insert_mode(0x1, a1, a2, a3, a4, a5); return 0; }
bash
angr_phoenix
static int rev_xstrcoll_df_version(V a, V b) { return dirfirst_check(a, b, rev_xstrcoll_version); }
long long rev_xstrcoll_df_version(void *a0, void *a1) { return dirfirst_check(a0, a1, rev_xstrcoll_version); }
coreutils
angr_sailr
void netns_nsid_socket_init(void) { if (rtnsh.fd > -1 || !ipnetns_have_nsid()) return; if (rtnl_open(&rtnsh, 0) < 0) { fprintf(stderr, "Cannot open rtnetlink\n"); exit(1); } }
void netns_nsid_socket_init(void) { int iVar1; if (rtnsh._0_4_ < 0) { iVar1 = ipnetns_have_nsid(); if (iVar1 != 0) { iVar1 = rtnl_open(rtnsh, 0); if (iVar1 < 0) { fprintf(stderr, "Cannot open rtnetlink\n"); exit(1); } } } return; }
iproute2-6.0.0
ghidra
skip_easy_bytes(char const *buf) { char const *p; uword const *s; for (p = buf; (uintptr_t)p % uword_size != 0; p++) if (to_uchar(*p) & unibyte_mask) return p; for (s = ({ __typeof__(p) val_ = p; (uword const *)val_; }); !(*s & unibyte_mask); s++) continue; for (p = (char const *)s; !(to_uchar(*p) & unibyte_mask); p++) continue; return p; }
int skip_easy_bytes(unsigned long a0) { void *v0; void *v1; void *v2; unsigned long long v4; v0 = a0; while (true) { if ((v0 & 7)) { v4 = unibyte_mask & to_uchar(*(v0)); if (v4) { *(&v4) = v0; break; } else { v0 += 1; } } else { v2 = v0; for (v1 = v2; !(unibyte_mask & *(v1)); v1 += 8) ; v0 = v1; while (true) { v4 = unibyte_mask & to_uchar(*(v0)); if (v4) break; v0 += 1; } *(&v4) = v0; break; } } return v4; }
grep
angr_dream
int mm_bsdauth_respond(void *ctx, u_int numresponses, char **responses) { struct sshbuf *m; int r, authok; sshlog("monitor_wrap.c", __func__, 865, 1, SYSLOG_LEVEL_DEBUG3, ((void *)0), "entering"); if (numresponses != 1) return (-1); if ((m = sshbuf_new()) == ((void *)0)) sshfatal("monitor_wrap.c", __func__, 870, 1, SYSLOG_LEVEL_FATAL, ((void *)0), "sshbuf_new failed"); if ((r = sshbuf_put_cstring(m, responses[0])) != 0) sshfatal("monitor_wrap.c", __func__, 872, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "assemble"); mm_request_send(pmonitor->m_recvfd, MONITOR_REQ_BSDAUTHRESPOND, m); mm_request_receive_expect(pmonitor->m_recvfd, MONITOR_ANS_BSDAUTHRESPOND, m); if ((r = sshbuf_get_u32(m, &authok)) != 0) sshfatal("monitor_wrap.c", __func__, 879, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "parse"); sshbuf_free(m); return ((authok == 0) ? -1 : 0); }
long long mm_bsdauth_respond(unsigned long a0, unsigned long a1, unsigned long long *a2) { unsigned long v0; char v1; unsigned int v2; unsigned long long v3; unsigned long long v4; unsigned long long v6; v0 = a0; sshlog("monitor_wrap.c", "mm_bsdauth_respond", 0x361, 0x1, 0x7, 0x0, "entering"); if (a1 != 1) { v6 = 4294967295; return v6; } v3 = sshbuf_new(); if (!v3) sshfatal("monitor_wrap.c", "mm_bsdauth_respond", 0x366, 0x1, 0x1, 0x0); v2 = sshbuf_put_cstring(v3, *(a2), *(a2)); if (v2) { v4 = "assemble"; sshfatal("monitor_wrap.c", "mm_bsdauth_respond", 0x368, 0x1, 0x1, ssh_err(v2)); } mm_request_send(*(pmonitor), 0x10, v3); mm_request_receive_expect(*(pmonitor), 0x11, v3); v2 = sshbuf_get_u32(v3, &v1, &v1); if (v2) { v4 = "parse"; sshfatal("monitor_wrap.c", "mm_bsdauth_respond", 0x36f, 0x1, 0x1, ssh_err(v2)); } sshbuf_free(v3); v6 = (!*(&v1) ? 0 : 4294967295); return v6; }
openssh-portable
angr_sailr
static void output_primes(const struct prime *primes, unsigned nprimes) { unsigned i; unsigned p; int is_prime; unsigned wide_uint_bits = 0; wide_uint mask = -1; for (wide_uint_bits = 0; mask; wide_uint_bits++) mask >>= 1; puts("\n"); printf("#define WIDE_UINT_BITS %u\n", wide_uint_bits); for (i = 0, p = 2; i < nprimes; i++) { unsigned int d8 = i + 8 < nprimes ? primes[i + 8].p - primes[i].p : 0xff; if (255 < d8) abort(); printf("P (%u, %u,\n (", primes[i].p - p, d8); print_wide_uint(primes[i].pinv, 0, wide_uint_bits); printf("),\n UINTMAX_MAX / %u)\n", primes[i].p); p = primes[i].p; } printf("\n#undef FIRST_OMITTED_PRIME\n"); do { p += 2; for (i = 0, is_prime = 1; is_prime; i++) { if (primes[i].p * primes[i].p > p) break; if (p * primes[i].pinv <= primes[i].lim) { is_prime = 0; break; } } } while (!is_prime); printf("#define FIRST_OMITTED_PRIME %u\n", p); }
void output_primes(unsigned int *a0, unsigned long a1) { unsigned int v0; unsigned int v1; unsigned int v2; unsigned int v3; unsigned int v4; unsigned long long v5; unsigned long long v6; unsigned long long v9; v3 = 0; v5 = -1; v6 = -1; for (v3 = 0; !(!v6) || !(!v5); v3 += 1) { v5 = v5 >> 1 | v6 * 0x8000000000000000; v6 >>= 1; } puts("\n"); printf("#define WIDE_UINT_BITS %u\n", v3); v0 = 0; v1 = 2; while (true) { if (v0 < a1) { v4 = (a1 <= v0 + 8 ? a0[96 + 12 * v0] - a0[12 * v0] : 255); if (v4 > 255) abort(); printf("P (%u, %u,\n (", a0[12 * v0] - v1, v4); print_wide_uint(*(&a0[4 + 12 * v0]), *(&a0[6 + 12 * v0]), 0x0, v3); printf("),\n UINTMAX_MAX / %u)\n", a0[12 * v0]); v1 = a0[12 * v0]; v0 += 1; } else { printf("\n#undef FIRST_OMITTED_PRIME\n"); do { v1 += 2; v0 = 0; v2 = 1; while (true) { if (!(v2) || !(v1 >= a0[8 * v0 + 4 * v0] * a0[8 * v0 + 4 * v0])) break; if ([D] amd64g_calculate_condition( 0x2 < 64 >, 0x10 < 64 >, Load(addr = ((rdi<8> + (((Conv(32->64, Load(addr = stack_base - 76, size = 4, endness = Iend_LE)) << 0x1 < 8 >) + Conv(32->64, Load(addr = stack_base - 76, size = 4, endness = Iend_LE))) << 0x4 < 8 >)) + 0x28 < 64 >), size = 8, endness = Iend_LE), Xor((((Conv(32->64, Load(addr = stack_base - 72, size = 4, endness = Iend_LE)) * Load(addr = ((rdi<8> + (((Conv(32->64, Load(addr = stack_base - 76, size = 4, endness = Iend_LE)) << 0x1 < 8 >) + Conv(32->64, Load(addr = stack_base - 76, size = 4, endness = Iend_LE))) << 0x4 < 8 >)) + 0x18 < 64 >), size = 8, endness = Iend_LE)) + (Load(addr = ((rdi<8> + (((Conv(32->64, Load(addr = stack_base - 76, size = 4, endness = Iend_LE)) << 0x1 < 8 >) + Conv(32->64, Load(addr = stack_base - 76, size = 4, endness = Iend_LE))) << 0x4 < 8 >)) + 0x10 < 64 >), size = 8, endness = Iend_LE) * 0x0 < 64 >)) + Conv(128->64, ((Load(addr = ((rdi<8> + (((Conv(32->64, Load(addr = stack_base - 76, size = 4, endness = Iend_LE)) << 0x1 < 8 >) + Conv(32->64, Load(addr = stack_base - 76, size = 4, endness = Iend_LE))) << 0x4 < 8 >)) + 0x10 < 64 >), size = 8, endness = Iend_LE) Mull Conv(32->64, Load(addr = stack_base - 72, size = 4, endness = Iend_LE))) >> 0x40 < 8 >))), Conv( 1->64, (Load(addr = ((rdi<8> + (((Conv(32->64, Load(addr = stack_base - 76, size = 4, endness = Iend_LE)) << 0x1 < 8 >) + Conv(32->64, Load(addr = stack_base - 76, size = 4, endness = Iend_LE))) << 0x4 < 8 >)) + 0x20 < 64 >), size = 8, endness = Iend_LE) < Conv(128->64, (Load(addr = ((rdi<8> + (((Conv(32->64, Load(addr = stack_base - 76, size = 4, endness = Iend_LE)) << 0x1 < 8 >) + Conv(32->64, Load(addr = stack_base - 76, size = 4, endness = Iend_LE))) << 0x4 < 8 >)) + 0x10 < 64 >), size = 8, endness = Iend_LE) Mull Conv(32->64, Load(addr = stack_base - 72, size = 4, endness = Iend_LE))))))), Conv( 1->64, (Load(addr = ((rdi<8> + (((Conv(32->64, Load(addr = stack_base - 76, size = 4, endness = Iend_LE)) << 0x1 < 8 >) + Conv(32->64, Load(addr = stack_base - 76, size = 4, endness = Iend_LE))) << 0x4 < 8 >)) + 0x20 < 64 >), size = 8, endness = Iend_LE) < Conv(128->64, (Load( addr = ((rdi<8> + (((Conv(32->64, Load(addr = stack_base - 76, size = 4, endness = Iend_LE)) << 0x1 < 8 >) + Conv(32->64, Load(addr = stack_base - 76, size = 4, endness = Iend_LE))) << 0x4 < 8 >)) + 0x10 < 64 >), size = 8, endness = Iend_LE) Mull Conv(32->64, Load(addr = stack_base - 72, size = 4, endness = Iend_LE)))))))) { v0 += 1; } else { v2 = 0; break; } } } while (!v2); v9 = printf("#define FIRST_OMITTED_PRIME %u\n", v1); return; } } }
coreutils
angr_sailr
void oom_adjust_setup(void) { int i, value; FILE *fp; sshlog("port-linux.c", __func__, 266, 0, SYSLOG_LEVEL_DEBUG3, ((void *)0), "%s", __func__); for (i = 0; oom_adjust[i].path != ((void *)0); i++) { oom_adj_path = oom_adjust[i].path; value = oom_adjust[i].value; if ((fp = fopen(oom_adj_path, "r+")) != ((void *)0)) { if (fscanf(fp, "%d", &oom_adj_save) != 1) sshlog("port-linux.c", __func__, 272, 0, SYSLOG_LEVEL_VERBOSE, ((void *)0), "error reading %s: %s", oom_adj_path, strerror((*__errno_location()))); else { rewind(fp); if (fprintf(fp, "%d\n", value) <= 0) sshlog("port-linux.c", __func__, 277, 0, SYSLOG_LEVEL_VERBOSE, ((void *)0), "error writing %s: %s", oom_adj_path, strerror((*__errno_location()))); else sshlog("port-linux.c", __func__, 280, 0, SYSLOG_LEVEL_DEBUG1, ((void *)0), "Set %s from %d to %d", oom_adj_path, oom_adj_save, value); } fclose(fp); return; } } oom_adj_path = ((void *)0); }
void oom_adjust_setup(void) { uint uVar1; int iVar2; FILE *__stream; int *piVar3; char *pcVar4; undefined8 uVar5; int local_18; sshlog("port-linux.c", "oom_adjust_setup", 0x10a, 0, 7, 0, &DAT_00100409, "oom_adjust_setup"); local_18 = 0; while (true) { if (*(long *)(lRam000000000010022c + (long)local_18 * 0x10) == 0) { oom_adj_path = (char *)0x0; return; } oom_adj_path = *(char **)(lRam0000000000100061 + (long)local_18 * 0x10); uVar1 = *(uint *)(lRam000000000010007f + (long)local_18 * 0x10 + 8); __stream = fopen(oom_adj_path, "r+"); if (__stream != (FILE *)0x0) break; local_18 = __addvsi3(local_18, 1); } iVar2 = __isoc99_fscanf(__stream, &DAT_0010040f, &oom_adj_save); if (iVar2 == 1) { rewind(__stream); iVar2 = fprintf(__stream, "%d\n", (ulong)uVar1); if (iVar2 < 1) { piVar3 = __errno_location(); uVar5 = 0x100171; pcVar4 = strerror(*piVar3); sshlog("port-linux.c", "oom_adjust_setup", 0x115, 0, 4, 0, "error writing %s: %s", oom_adj_path, pcVar4, uVar5); } else { sshlog("port-linux.c", "oom_adjust_setup", 0x118, 0, 5, 0, "Set %s from %d to %d", oom_adj_path, oom_adj_save, uVar1); } } else { piVar3 = __errno_location(); uVar5 = 0x1000ec; pcVar4 = strerror(*piVar3); sshlog("port-linux.c", "oom_adjust_setup", 0x110, 0, 4, 0, "error reading %s: %s", oom_adj_path, pcVar4, uVar5); } fclose(__stream); return; }
openssh-portable
ghidra