input
stringlengths
26
172k
output
stringlengths
18
318k
repo_name
stringclasses
23 values
decompiler
stringclasses
5 values
const char *rgroup_name(uid_t gid) { return idname_lookup(&group_idname, (u_int)gid); }
long rgroup_name(int a1) { return idname_lookup(&group_idname, a1); }
openssh-portable
ida
test_code_t test_tls1_1(gnutls_session_t session) { int ret; sprintf(prio_str, "NONE:" "+CIPHER-ALL:+ARCFOUR-128:+3DES-CBC" ":+GOST28147-TC26Z-CNT" ":" "+COMP-NULL" ":+VERS-TLS1.1:" "+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, 1161)) != TEST_SUCCEED) { return _ret; } }; gnutls_credentials_set(session, GNUTLS_CRD_CERTIFICATE, xcred); ret = test_do_handshake(session); if (ret == TEST_SUCCEED) tls1_1_ok = 1; return ret; }
long test_tls1_1(long a1) { unsigned int v2; unsigned int v3; sprintf(prio_str, "NONE:+CIPHER-ALL:+ARCFOUR-128:+3DES-CBC:+GOST28147-TC26Z-CNT:+COMP-" "NULL:+VERS-TLS1.1:+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); v2 = _gnutls_priority_set_direct(a1, prio_str, 0x489u); if (v2) return v2; gnutls_credentials_set(a1, 1LL, xcred); v3 = test_do_handshake(a1); if (!v3) tls1_1_ok = 1; return v3; }
gnutls
ida
static struct sshbuf *process_enroll(struct sshbuf *req) { int r; u_int type; char *provider, *application, *pin, *device, *userid; uint8_t flags; struct sshbuf *challenge, *attest, *kbuf, *resp; struct sshkey *key; if ((attest = sshbuf_new()) == ((void *)0) || (kbuf = sshbuf_new()) == ((void *)0)) sshfatal("ssh-sk-helper.c", __func__, 161, 0, SYSLOG_LEVEL_FATAL, ((void *)0), "%s: sshbuf_new failed", __progname); if ((r = sshbuf_get_u32(req, &type)) != 0 || (r = sshbuf_get_cstring(req, &provider, ((void *)0))) != 0 || (r = sshbuf_get_cstring(req, &device, ((void *)0))) != 0 || (r = sshbuf_get_cstring(req, &application, ((void *)0))) != 0 || (r = sshbuf_get_cstring(req, &userid, ((void *)0))) != 0 || (r = sshbuf_get_u8(req, &flags)) != 0 || (r = sshbuf_get_cstring(req, &pin, ((void *)0))) != 0 || (r = sshbuf_froms(req, &challenge)) != 0) sshfatal("ssh-sk-helper.c", __func__, 171, 0, SYSLOG_LEVEL_FATAL, ssh_err(r), "%s: parse", __progname); if (sshbuf_len(req) != 0) sshfatal("ssh-sk-helper.c", __func__, 173, 0, SYSLOG_LEVEL_FATAL, ((void *)0), "%s: trailing data in request", __progname); if (type > 0x7fffffff) sshfatal("ssh-sk-helper.c", __func__, 176, 0, SYSLOG_LEVEL_FATAL, ((void *)0), "%s: bad type %u", __progname, type); if (sshbuf_len(challenge) == 0) { sshbuf_free(challenge); challenge = ((void *)0); } null_empty(&device); null_empty(&userid); null_empty(&pin); if ((r = sshsk_enroll((int)type, provider, device, application, userid, flags, pin, challenge, &key, attest)) != 0) { resp = reply_error(r, "Enrollment failed: %s", ssh_err(r)); goto out; } if ((resp = sshbuf_new()) == ((void *)0)) sshfatal("ssh-sk-helper.c", __func__, 192, 0, SYSLOG_LEVEL_FATAL, ((void *)0), "%s: sshbuf_new failed", __progname); if ((r = sshkey_private_serialize(key, kbuf)) != 0) sshfatal("ssh-sk-helper.c", __func__, 194, 0, SYSLOG_LEVEL_FATAL, ssh_err(r), "%s: encode key", __progname); if ((r = sshbuf_put_u32(resp, 2)) != 0 || (r = sshbuf_put_stringb(resp, kbuf)) != 0 || (r = sshbuf_put_stringb(resp, attest)) != 0) sshfatal("ssh-sk-helper.c", __func__, 198, 0, SYSLOG_LEVEL_FATAL, ssh_err(r), "%s: compose", __progname); out: sshkey_free(key); sshbuf_free(kbuf); sshbuf_free(attest); sshbuf_free(challenge); free(provider); free(application); if (pin != ((void *)0)) freezero(pin, strlen(pin)); return resp; }
int process_enroll(unsigned long long a0) { unsigned long v0; char v1; char v2; unsigned int v3; char v4; char v5; char v6; char v7; char v8; void *v9; char v10; unsigned long long v11; unsigned long long v12; unsigned long long v13; unsigned long long v14; unsigned long v15; unsigned long long v16; unsigned long v17; char v18; unsigned long long v19; char v20; unsigned int v21; unsigned int v22; unsigned int v23; unsigned long long v24; v12 = sshbuf_new(); if (!v12 || (v13 = sshbuf_new(), !v13)) { v0 = __progname; sshfatal("ssh-sk-helper.c", "process_enroll", 0xa1, 0x0, 0x1, 0x0, "%s: sshbuf_new failed"); } v3 = sshbuf_get_u32(a0, &v2, &v2); if (!(!v3) || !((v3 = sshbuf_get_cstring(a0, &v4, 0x0, &v4), !v3))) { LABEL_4008e7: v17 = __progname; v16 = "%s: parse"; sshfatal("ssh-sk-helper.c", "process_enroll", 0xab, 0x0, 0x1, ssh_err(v3), *(&v18)); } else { v3 = sshbuf_get_cstring(a0, &v7, 0x0, &v7); if (!(!v3) || !((v3 = sshbuf_get_cstring(a0, &v5, 0x0, &v5), !v3))) goto LABEL_4008e7; v3 = sshbuf_get_cstring(a0, &v8, 0x0, &v8); if (!(!v3) || !((v3 = sshbuf_get_u8(a0, &v1, &v1), !v3))) goto LABEL_4008e7; v3 = sshbuf_get_cstring(a0, &v6, 0x0, &v6); if (v3 || (v3 = sshbuf_froms(a0, &v9, &v9), v3)) goto LABEL_4008e7; } if (sshbuf_len(a0)) { v17 = __progname; v16 = "%s: trailing data in request"; sshfatal("ssh-sk-helper.c", "process_enroll", 0xad, 0x0, 0x1, 0x0, *(&v18)); } if (*(&v2) < 0) { v16 = *(&v2); v15 = __progname; v14 = "%s: bad type %u"; sshfatal("ssh-sk-helper.c", "process_enroll", 0xb0, 0x0, 0x1, 0x0, *(&v18)); } if (!sshbuf_len(v9)) { sshbuf_free(v9); v9 = 0; } null_empty(&v7); null_empty(&v8); null_empty(&v6); v17 = v12; v16 = &v10; v15 = v9; v14 = *(&v6); v3 = sshsk_enroll(*(&v2), *(&v4), *(&v7), *(&v5), *(&v8), v1, *(&v18), v19, *(&v20)); if (v3) { v11 = reply_error(v3, "Enrollment failed: %s", ssh_err(v3), v21, v22, v23); } else { v11 = sshbuf_new(); if (!v11) { v17 = __progname; v16 = "%s: sshbuf_new failed"; sshfatal("ssh-sk-helper.c", "process_enroll", 0xc0, 0x0, 0x1, 0x0, *(&v18)); } v3 = sshkey_private_serialize(*(&v10), v13, v13); if (v3) { v17 = __progname; v16 = "%s: encode key"; sshfatal("ssh-sk-helper.c", "process_enroll", 0xc2, 0x0, 0x1, ssh_err(v3), *(&v18)); } v3 = sshbuf_put_u32(v11, 0x2); if (v3) { LABEL_400b8e: v17 = __progname; v16 = "%s: compose"; sshfatal("ssh-sk-helper.c", "process_enroll", 0xc6, 0x0, 0x1, ssh_err(v3), *(&v18)); } else { v3 = sshbuf_put_stringb(v11, v13, v13); if (v3 || (v3 = sshbuf_put_stringb(v11, v12, v12), v3)) goto LABEL_400b8e; } } sshkey_free(*(&v10)); sshbuf_free(v13); sshbuf_free(v12); sshbuf_free(v9); free(*(&v4)); free(*(&v5)); if (*(&v6)) { v24 = strlen(*(&v6)); freezero(*(&v6), v24, v24); return v11; } return v11; }
openssh-portable
angr_sailr
struct sshauthopt *sshauthopt_from_cert(struct sshkey *k) { struct sshauthopt *ret; if (k == ((void *)0) || !sshkey_type_is_cert(k->type) || k->cert == ((void *)0) || k->cert->type != 1) return ((void *)0); if ((ret = sshauthopt_new()) == ((void *)0)) return ((void *)0); if (cert_option_list(ret, k->cert->critical, 1, 1) == -1) { sshauthopt_free(ret); return ((void *)0); } if (cert_option_list(ret, k->cert->extensions, 2, 0) == -1) { sshauthopt_free(ret); return ((void *)0); } return ret; }
long sshauthopt_from_cert(undefined4 *param_1) { int iVar1; long lVar2; if ((((param_1 == (undefined4 *)0x0) || (iVar1 = sshkey_type_is_cert(*param_1), iVar1 == 0)) || (*(long *)(param_1 + 0x20) == 0)) || (*(int *)(*(long *)(param_1 + 0x20) + 8) != 1)) { lVar2 = 0; } else { lVar2 = sshauthopt_new(); if (lVar2 == 0) { lVar2 = 0; } else { iVar1 = cert_option_list( lVar2, *(undefined8 *)(*(long *)(param_1 + 0x20) + 0x40), 1, 1); if (iVar1 == -1) { sshauthopt_free(lVar2); lVar2 = 0; } else { iVar1 = cert_option_list( lVar2, *(undefined8 *)(*(long *)(param_1 + 0x20) + 0x48), 2, 0); if (iVar1 == -1) { sshauthopt_free(lVar2); lVar2 = 0; } } } } return lVar2; }
openssh-portable
ghidra
void termsig_handler(sig) int sig; { static int handling_termsig = 0; int i, core; sigset_t mask; if (handling_termsig) return; handling_termsig = 1; terminating_signal = 0; if (sig == 2 && signal_is_trapped(2)) run_interrupt_trap(0); if (interactive_shell && interactive && (sig == 1 || sig == 15) && remember_on_history) maybe_save_shell_history(); if (this_shell_builtin == read_builtin) read_tty_cleanup(); if (sig == 1 && (interactive || (subshell_environment & (0x04 | 0x20)))) hangup_all_jobs(); if ((subshell_environment & (0x04 | 0x20)) == 0) end_job_control(); unlink_all_fifos(); procsub_clear(); loop_level = continuing = breaking = funcnest = 0; executing_list = comsub_ignore_return = return_catch_flag = wait_intr_flag = 0; run_exit_trap(); restore_sigmask(); set_signal_handler(sig, ((__sighandler_t)0)); kill(getpid(), sig); if (dollar_dollar_pid != 1) exit(128 + sig); sigprocmask(2, (sigset_t *)((void *)0), &mask); for (i = core = 0; i < (sizeof(terminating_signals) / sizeof(struct termsig)); i++) { set_signal_handler((terminating_signals[i].signum), ((__sighandler_t)0)); sigdelset(&mask, (terminating_signals[i].signum)); if (sig == (terminating_signals[i].signum)) core = (terminating_signals[i].core_dump); } sigprocmask(2, &mask, (sigset_t *)((void *)0)); if (core) *((volatile unsigned long *)((void *)0)) = 0xdead0000 + sig; exit(128 + sig); }
void termsig_handler(unsigned long long a0, unsigned long long a1, unsigned long long a2, unsigned long long a3, unsigned long long a4, unsigned long long a5) { unsigned int v0; unsigned int v1; char v2; char v3; unsigned long long *v5; unsigned long long v6; if (!handling_termsig.9257) { *(&handling_termsig.9257) = &g_0; *(&terminating_signal) = &g_0; if (a0 == 2 && signal_is_trapped(0x2)) run_interrupt_trap(0x0); if (interactive_shell && interactive) { if (a0 != 1 && !(a0 == 15)) goto LABEL_40099b; if (remember_on_history) maybe_save_shell_history(); } LABEL_40099b: if (this_shell_builtin == got.read_builtin) read_tty_cleanup(); if (a0 == 1) { if (!interactive && (subshell_environment & 36) == &g_0) goto LABEL_4009d8; hangup_all_jobs(); } LABEL_4009d8: if (!(subshell_environment & 36)) end_job_control(); unlink_all_fifos(); procsub_clear(a0, a1, a2, a3, a4, a5); *(&funcnest) = &g_0; breaking = funcnest; continuing = breaking; loop_level = continuing; *(&wait_intr_flag) = &g_0; return_catch_flag = wait_intr_flag; comsub_ignore_return = return_catch_flag; executing_list = comsub_ignore_return; run_exit_trap(a0, a1, a2, a3, a4, a5); restore_sigmask(); set_signal_handler(a0, 0x0); kill(getpid(), a0); if (dollar_dollar_pid != 1) exit(a0 - -128); sigprocmask(0x2, &g_0, &v2); *(&v1) = &g_0; for (v0 = v1; v0 <= 16; *(&v0) = v0 + &g_0) { set_signal_handler(terminating_signals[6 * v0], 0x0); sigdelset(&v2, terminating_signals[6 * v0]); if (a0 == *((((v0 << &g_0) + v0 << &g_0) + &terminating_signals[0]))) v1 = (&g_400e54)[3 * v0]; } sigprocmask(0x2, &v2, &g_0); if (v1) g_0 = a0 - 0x21530000; exit(a0 - -128); } else { v6 = *(&v3) ^ v5[5]; return; } }
bash
angr_phoenix
static int find_unit_order(char const *number) { _Bool minus_sign = (*number == '-'); char const *p = number + minus_sign; char max_digit = traverse_raw_number(&p); if ('0' < max_digit) { unsigned char ch = *p; int order = unit_order[ch]; return (minus_sign ? -order : order); } else return 0; }
int find_unit_order(char *a0) { char v0; char v1; char v2; unsigned int v3; char *v4; unsigned int v6; v0 = *(a0) == 45; v4 = &a0[v0]; v1 = traverse_raw_number(&v4); if (v1 > 48) { v2 = *(v4); v3 = *(v2 + &unit_order); if (v0) v6 = -(v3); else v6 = v3; } else { v6 = 0; } return v6; }
coreutils
angr_dream
static enum char_class is_valid_cclass(name) const char *name; { enum char_class ret; int i; ret = CC_NO_CLASS; for (i = 1; i < (sizeof(cclass_name) / sizeof(cclass_name[0])); i++) { if (((name)[0] == (cclass_name[i])[0] && strcmp(name, cclass_name[i]) == 0)) { ret = (enum char_class)i; break; } } return ret; }
int is_valid_cclass(char *a0) { unsigned int v0; unsigned int v1; v0 = 0; for (v1 = 1; v1 <= 14; v1 += 1) { if (*(a0) == *(cclass_name[v1]) && !strcmp(a0, cclass_name[v1])) { v0 = v1; return v0; } } return v0; }
bash
angr_sailr
static _Bool is_feasible_path_argument(const char *arg, _Bool foldcase) { const char *last = strrchr(arg, '/'); if (last && !last[1]) { if (matches_start_point(arg, foldcase)) { return 1; } else { return 0; } } return 1; }
undefined8 is_feasible_path_argument(char *param_1, undefined param_2) { char cVar1; char *pcVar2; undefined8 uVar3; pcVar2 = strrchr(param_1, 0x2f); if ((pcVar2 == (char *)0x0) || (pcVar2[1] != '\0')) { uVar3 = 1; } else { cVar1 = matches_start_point(param_1, param_2); if (cVar1 == '\0') { uVar3 = 0; } else { uVar3 = 1; } } return uVar3; }
findutils
ghidra
static _Bool all_zeros(char const *buf, idx_t size) { for (char const *p = buf; p < buf + size; p++) if (*p) return 0; return 1; }
undefined8 all_zeros(char *param_1, long param_2) { char *local_10; local_10 = param_1; while (true) { if (param_1 + param_2 <= local_10) { return 1; } if (*local_10 != '\0') break; local_10 = local_10 + 1; } return 0; }
grep
ghidra
int main(int argc, char **argv) { int ret; int i; char portname[6]; socket_st hd; _Bool socket_opened = 0; char app_proto[32] = ""; cmd_parser(argc, argv); signal(13, ((__sighandler_t)1)); sockets_init(); if (gnutls_global_init() < 0) { fprintf(stderr, "global state initialization error\n"); exit(1); } gnutls_global_set_log_function(tls_log_func); gnutls_global_set_log_level(debug); snprintf(portname, sizeof(portname), "%d", port); if (gnutls_certificate_allocate_credentials(&xcred) < 0) { fprintf(stderr, "memory error\n"); exit(1); } if (gnutls_srp_allocate_client_credentials(&srp_cred) < 0) { fprintf(stderr, "memory error\n"); exit(1); } if (gnutls_anon_allocate_client_credentials(&anon_cred) < 0) { fprintf(stderr, "memory error\n"); exit(1); } if (gnutls_cli_debug_options.present.starttls_proto) { snprintf(app_proto, sizeof(app_proto), "%s", gnutls_cli_debug_options.arg.starttls_proto); } if (app_proto[0] == 0) { snprintf(app_proto, sizeof(app_proto), "%s", port_to_service(portname, "tcp")); } sockets_init(); printf("GnuTLS debug client %s\n", gnutls_check_version(((void *)0))); canonicalize_host(hostname, portname, sizeof(portname)); printf("Checking %s:%s\n", hostname, portname); for (i = 0; tls_tests[i].test_name != ((void *)0); i++) { if (strcmp(app_proto, "https") != 0 && tls_tests[i].https_only != 0) { continue; } if (!socket_opened) { socket_open2(&hd, hostname, portname, app_proto, (1 << 2) | (1 << 3), ((void *)0), ((void *)0), ((void *)0), ((void *)0), ((void *)0)); hd.verbose = verbose; socket_opened = 1; } ret = tls_tests[i].func(hd.session); if ((ret != TEST_IGNORE && ret != TEST_IGNORE2) || verbose) { printf("%58s...", tls_tests[i].test_name); fflush(stdout); } if (ret == TEST_SUCCEED) { if (tls_tests[i].suc_str == ((void *)0)) printf(" %s\n", ext_text); else printf(" %s\n", tls_tests[i].suc_str); } else if (ret == TEST_FAILED) printf(" %s\n", tls_tests[i].fail_str); else if (ret == TEST_UNSURE) printf(" %s\n", tls_tests[i].unsure_str); else if ((ret == TEST_IGNORE || ret == TEST_IGNORE2) && verbose) { printf(" skipped\n"); } if (ret != TEST_IGNORE) { socket_bye(&hd, 1); socket_opened = 0; } if (ret == TEST_FAILED && tls_tests[i].fatal_failure) break; } gnutls_srp_free_client_credentials(srp_cred); gnutls_certificate_free_credentials(xcred); gnutls_anon_free_client_credentials(anon_cred); gnutls_global_deinit(); return 0; }
int main(unsigned long long a0, unsigned long long a1, unsigned long a2, unsigned long long a3, unsigned long long a4, unsigned long long a5) { void *v0; char v1; unsigned int v2; unsigned int v3; char v4; char v5; unsigned int v6; char v7; void *v8; void *v9; void *v10; void *v11; unsigned int v13; unsigned int v14; v1 = 0; v8 = 0; v9 = 0; v10 = 0; v11 = 0; cmd_parser(a0, a1); signal(0xd, 0x1); sockets_init(0xd, 0x1, a2, a3, a4, a5); if (gnutls_global_init(0xd, 0x1, a2, a3, a4, a5) < 0) { fprintf(*(&stderr), "global state initialization error\n"); exit(0x1); } gnutls_global_set_log_function(tls_log_func); gnutls_global_set_log_level(debug); v13 = port; snprintf(&v7, 0x6, "%d", port); if (gnutls_certificate_allocate_credentials(&xcred) < 0) { fprintf(*(&stderr), "memory error\n"); exit(0x1); } else if (gnutls_srp_allocate_client_credentials(&srp_cred) < 0) { fprintf(*(&stderr), "memory error\n"); exit(0x1); } else if (gnutls_anon_allocate_client_credentials(&anon_cred) < 0) { fprintf(*(&stderr), "memory error\n"); exit(0x1); } else { if (g_500093) { v13 = printf; snprintf(&v8, 0x20, "%s", printf); } if (!v8) { v13 = port_to_service(&v7, "tcp"); snprintf(&v8, 0x20, "%s", v13); } sockets_init(a0, a1, a2, *(&v13), a4, a5); printf("GnuTLS debug client %s\n", gnutls_check_version(0x0)); canonicalize_host(hostname, &v7, 0x6, &v7); a2 = &v7; v14 = hostname; printf("Checking %s:%s\n", hostname, &v7); v2 = 0; while (true) { if (!tls_tests[4 * v2 + 2 * v2]) break; if (strcmp(&v8, "https") && !(!g_401368[8 * v2 + 4 * v2])) goto LABEL_40068d; if ((v1 ^ 1)) { v0 = 0; socket_open2(&v4, hostname, &v7, &v8, 0xc, 0x0, 0x0, 0x0, 0x0); v6 = verbose; v1 = 1; } a2 = (&g_401348)[6 * v2]; v3 = (&g_401348)[6 * v2](*(&v5)); if (v3 != 3 && !(v3 == 4)) goto LABEL_4004a9; if (!verbose) goto LABEL_4004f0; LABEL_4004a9: a2 = v2 * 48; v14 = tls_tests[6 * v2]; printf("%58s...", tls_tests[6 * v2]); fflush(stdout); LABEL_4004f0: if (!v3) { a2 = v2 * 48; if (!g_401350[4 * v2 + 2 * v2]) { v14 = ext_text; printf(" %s\n", ext_text); } else { a2 = v2 * 48; v14 = g_401350[6 * v2]; printf(" %s\n", g_401350[6 * v2]); } } else if (v3 == 1) { a2 = v2 * 48; v14 = (&g_401358)[6 * v2]; printf(" %s\n", (&g_401358)[6 * v2]); } else if (v3 == 2) { a2 = v2 * 48; v14 = (&g_401360)[6 * v2]; printf(" %s\n", (&g_401360)[6 * v2]); } else { if (v3 != 3 && !(v3 == 4)) goto LABEL_400636; if (verbose) printf(" skipped\n"); } LABEL_400636: if (v3 != 3) { socket_bye(&v4, 0x1); v1 = 0; } if (v3 == 1 && g_40136c[8 * v2 + 4 * v2]) break; LABEL_40068d: v2 += 1; } gnutls_srp_free_client_credentials(srp_cred); gnutls_certificate_free_credentials(xcred); gnutls_anon_free_client_credentials(anon_cred); gnutls_global_deinit(a0, *(&v14), a2, *(&v13), 0xc, 0x0); return 0; } }
gnutls
angr_phoenix
int mm_is_monitor(void) { return (pmonitor && pmonitor->m_pid > 0); }
long long mm_is_monitor() { unsigned long long v1; if (pmonitor && *((pmonitor + 24)) > 0) { v1 = 1; goto LABEL_4002e5; } v1 = 0; LABEL_4002e5: return v1; }
openssh-portable
angr_phoenix
int ssh_packet_process_read(struct ssh *ssh, int fd) { struct session_state *state = ssh->state; int r; size_t rlen; if ((r = sshbuf_read(fd, state->input, (256 * 1024), &rlen)) != 0) return r; if (state->packet_discard) { if ((r = sshbuf_consume_end(state->input, rlen)) != 0) return r; state->keep_alive_timeouts = 0; if (rlen >= state->packet_discard) { if ((r = ssh_packet_stop_discard(ssh)) != 0) return r; } state->packet_discard -= rlen; return 0; } return 0; }
long long ssh_packet_process_read(unsigned long long *a0, unsigned long a1) { unsigned int v0; char v1; struct_0 *v2; void *v4; v2 = *(a0); v0 = sshbuf_read(a1, v2->field_20, 0x40000, &v1); if (v0) { v4 = v0; } else if (!v2->field_1c4) { v4 = 0; } else { v0 = sshbuf_consume_end(v2->field_20, *(&v1), *(&v1)); if (v0) { v4 = v0; } else { v2->field_14c = 0; if (v2->field_1c4 <= *(&v1)) { v0 = ssh_packet_stop_discard(a0); if (v0) { v4 = v0; goto LABEL_404558; } } v2->field_1c4 = v2->field_1c4 - *(&v1); v4 = 0; } } LABEL_404558: return v4; }
openssh-portable
angr_phoenix
int heapsort(void *vbase, size_t nmemb, size_t size, int (*compar)(const void *, const void *)) { size_t cnt, i, j, l; char tmp, *tmp1, *tmp2; char *base, *k, *p, *t; if (nmemb <= 1) return (0); if (!size) { (*__errno_location()) = 22; return (-1); } if ((k = malloc(size)) == ((void *)0)) return (-1); base = (char *)vbase - size; for (l = nmemb / 2 + 1; --l;) { for (i = l; (j = i * 2) <= nmemb; i = j) { p = base + j * size; if (j < nmemb && compar(p, p + size) < 0) { p += size; ++j; } t = base + i * size; if (compar(p, t) <= 0) break; { cnt = size; do { tmp = *t; *t++ = *p; *p++ = tmp; } while (--cnt); }; } }; while (nmemb > 1) { { cnt = size; tmp1 = k; tmp2 = base + nmemb * size; do { *tmp1++ = *tmp2++; } while (--cnt); }; { cnt = size; tmp1 = base + nmemb * size; tmp2 = base + size; do { *tmp1++ = *tmp2++; } while (--cnt); }; --nmemb; { for (i = 1; (j = i * 2) <= nmemb; i = j) { p = base + j * size; if (j < nmemb && compar(p, p + size) < 0) { p += size; ++j; } t = base + i * size; { cnt = size; tmp1 = t; tmp2 = p; do { *tmp1++ = *tmp2++; } while (--cnt); }; } for (;;) { j = i; i = j / 2; p = base + j * size; t = base + i * size; if (j == 1 || compar(k, t) < 0) { { cnt = size; tmp1 = p; tmp2 = k; do { *tmp1++ = *tmp2++; } while (--cnt); }; break; } { cnt = size; tmp1 = p; tmp2 = t; do { *tmp1++ = *tmp2++; } while (--cnt); }; } }; } free(k); return (0); }
long heapsort(_BYTE *a1, unsigned long a2, size_t a3, int (*a4)(char *, char *)) { char *v5; char *v6; char *v7; char *v8; _BYTE *v9; _BYTE *v10; char *v11; char *v12; char *v13; char *v14; _BYTE *v15; _BYTE *v16; unsigned long v19; char v20; size_t v21; size_t v22; size_t v23; size_t v24; size_t v25; size_t v26; unsigned long i; unsigned long j; unsigned long v29; unsigned long v30; unsigned long v31; unsigned long v32; char *v33; _BYTE *v34; char *v35; char *v36; _BYTE *v37; char *v38; _BYTE *v39; char *v40; char *v41; _BYTE *v42; char *v43; char *v44; char *v45; char *ptr; _BYTE *v47; v19 = a2; if (a2 <= 1) return 0LL; if (a3) { ptr = (char *)malloc(a3); if (ptr) { v47 = &a1[-a3]; v32 = (a2 >> 1) + 1; while (--v32) { for (i = v32;; i = v29) { v29 = 2 * i; if (2 * i > a2) break; v43 = &v47[a3 * v29]; if (v29 < a2 && a4(v43, &v43[a3]) < 0) { v43 += a3; ++v29; } v45 = &v47[a3 * i]; if (a4(v43, v45) <= 0) break; v21 = a3; do { v20 = *v45; v5 = v45++; *v5 = *v43; v6 = v43++; *v6 = v20; --v21; } while (v21); } } while (v19 > 1) { v22 = a3; v33 = ptr; v38 = &v47[a3 * v19]; do { v7 = v38++; v8 = v33++; *v8 = *v7; --v22; } while (v22); v23 = a3; v34 = &v47[a3 * v19]; v39 = a1; do { v9 = v39++; v10 = v34++; *v10 = *v9; --v23; } while (v23); --v19; for (j = 1LL;; j = v30) { v30 = 2 * j; if (2 * j > v19) break; v44 = &v47[a3 * v30]; if (v30 < v19 && a4(v44, &v44[a3]) < 0) { v44 += a3; ++v30; } v24 = a3; v35 = &v47[a3 * j]; v40 = v44; do { v11 = v40++; v12 = v35++; *v12 = *v11; --v24; } while (v24); } while (1) { v31 = j; j >>= 1; if (v31 == 1 || a4(ptr, &v47[a3 * j]) < 0) break; v26 = a3; v37 = &v47[a3 * v31]; v42 = &v47[a3 * j]; do { v15 = v42++; v16 = v37++; *v16 = *v15; --v26; } while (v26); } v25 = a3; v36 = &v47[a3 * v31]; v41 = ptr; do { v13 = v41++; v14 = v36++; *v14 = *v13; --v25; } while (v25); } free(ptr); return 0LL; } else { return 0xFFFFFFFFLL; } } else { *_errno_location() = 22; return 0xFFFFFFFFLL; } }
libbsd-0.11.7
ida
int skip_to_histexp(string, start, delims, flags) char *string; int start; char *delims; int flags; { int i, pass_next, backq, dquote, c, oldjmp; int histexp_comsub, histexp_backq, old_dquote; size_t slen; mbstate_t state; memset(&state, '\0', sizeof(mbstate_t)); slen = strlen(string + start) + start; oldjmp = no_longjmp_on_fatal_error; if (flags & 0x001) no_longjmp_on_fatal_error = 1; histexp_comsub = histexp_backq = old_dquote = 0; i = start; pass_next = backq = dquote = 0; while (c = string[i]) { if (pass_next) { pass_next = 0; if (c == 0) do { no_longjmp_on_fatal_error = oldjmp; return (i); } while (0); do { if (locale_mb_cur_max > 1) { mbstate_t state_bak; size_t mblength; int _f; _f = is_basic((string)[i]); if (_f) mblength = 1; else if (locale_utf8locale && (((string)[i] & 0x80) == 0)) mblength = (string)[i] != 0; else { state_bak = state; mblength = mbrlen((string) + (i), (slen) - (i), &state); } if (mblength == (size_t)-2 || mblength == (size_t)-1) { state = state_bak; (i)++; } else if (mblength == 0) (i)++; else (i) += mblength; } else (i)++; } while (0); continue; } else if (c == '\\') { pass_next = 1; i++; continue; } else if (backq && c == '`') { backq = 0; histexp_backq--; dquote = old_dquote; i++; continue; } else if (c == '`') { backq = 1; histexp_backq++; old_dquote = dquote; dquote = 0; i++; continue; } else if (dquote && c == delims[0] && string[i + 1] == '"') { i++; continue; } else if (c == delims[0]) break; else if (dquote && c == '\'') { i++; continue; } else if (c == '\'') i = skip_single_quoted(string, slen, ++i, 0); else if (posixly_correct == 0 && c == '"') { dquote = 1 - dquote; i++; continue; } else if (c == '"') i = skip_double_quoted(string, slen, ++i, 0); else if ((c == '$' || c == '<' || c == '>') && string[i + 1] == '(' && string[i + 2] != '(') { if (string[i + 2] == '\0') do { no_longjmp_on_fatal_error = oldjmp; return (i + 2); } while (0); i += 2; histexp_comsub++; old_dquote = dquote; dquote = 0; } else if (histexp_comsub && c == ')') { histexp_comsub--; dquote = old_dquote; i++; continue; } else if (backq) { do { if (locale_mb_cur_max > 1) { mbstate_t state_bak; size_t mblength; int _f; _f = is_basic((string)[i]); if (_f) mblength = 1; else if (locale_utf8locale && (((string)[i] & 0x80) == 0)) mblength = (string)[i] != 0; else { state_bak = state; mblength = mbrlen((string) + (i), (slen) - (i), &state); } if (mblength == (size_t)-2 || mblength == (size_t)-1) { state = state_bak; (i)++; } else if (mblength == 0) (i)++; else (i) += mblength; } else (i)++; } while (0); continue; } else do { if (locale_mb_cur_max > 1) { mbstate_t state_bak; size_t mblength; int _f; _f = is_basic((string)[i]); if (_f) mblength = 1; else if (locale_utf8locale && (((string)[i] & 0x80) == 0)) mblength = (string)[i] != 0; else { state_bak = state; mblength = mbrlen((string) + (i), (slen) - (i), &state); } if (mblength == (size_t)-2 || mblength == (size_t)-1) { state = state_bak; (i)++; } else if (mblength == 0) (i)++; else (i) += mblength; } else (i)++; } while (0); } do { no_longjmp_on_fatal_error = oldjmp; return (i); } while (0); }
long long skip_to_histexp(char *a0, unsigned long a1, char *a2, unsigned long a3) { unsigned int v0; unsigned int v1; unsigned int v2; unsigned int v3; unsigned int v4; unsigned int v5; unsigned int v6; unsigned int v7; unsigned int v8; unsigned int v9; unsigned int v10; unsigned int v11; unsigned long long v12; unsigned long long v13; unsigned long long v14; unsigned int v15; unsigned long long v16; unsigned long long v17; unsigned long long v19; memset(&v16, 0x0, 0x8); *(&v15) = strlen(&a0[a1]) + a1; v7 = no_longjmp_on_fatal_error; if ((a3 & 1)) no_longjmp_on_fatal_error = 1; v6 = 0; v5 = v6; v4 = v5; v0 = a1; v3 = 0; v2 = v3; v1 = v2; while (true) { v8 = a0[v0]; if (!v8) break; if (v1) { v1 = 0; if (!v8) { no_longjmp_on_fatal_error = v7; v19 = v0; return v19; } if (*(&locale_mb_cur_max) <= 1) { v0 += 1; } else { v11 = is_basic(a0[v0]); if (v11) { v12 = 1; } else { if (!*(&locale_utf8locale) || a0[v0] < 0) { v17 = v16; v12 = mbrlen(&a0[v0], *(&v15) - v0, &v16, &a0[v0]); } else { v12 = a0[v0]; } } if (v12 == -2 || v12 == -1) { v16 = v17; v0 += 1; } else { if (v12) { v0 = v0 + v12; continue; } else { v0 += 1; } continue; } } } else if (v8 == 92) { v1 = 1; v0 += 1; } else if (v2 && v8 == 96) { v2 = 0; v5 -= 1; v3 = v6; v0 += 1; } else if (v8 == 96) { v2 = 1; v5 += 1; v6 = v3; v3 = 0; v0 += 1; } else if (v3 && v8 == *(a2) && a0[1 + v0] == 34) { v0 += 1; } else { if (v8 == *(a2)) break; if (v3 && v8 == 39) { v0 += 1; } else if (v8 == 39) { v0 += 1; v0 = skip_single_quoted(a0, *(&v15), v0, 0x0); } else if (!posixly_correct && v8 == 34) { v3 = 1 - v3; v0 += 1; } else { switch (v8) { case 34: v0 += 1; v0 = skip_double_quoted(a0, *(&v15), v0, 0x0); continue; case 36: case 60: case 62: if (!(a0[1 + v0] == 40)) goto LABEL_405c86; switch (a0[2 + v0]) { case 40: LABEL_405c86: if (v4 && v8 == 41) { v4 -= 1; v3 = v6; v0 += 1; continue; } else if (!v2) { if (*(&locale_mb_cur_max) <= 1) { v0 += 1; break; } else { v9 = is_basic(a0[v0]); if (v9) { v14 = 1; break; } else if (!*(&locale_utf8locale) || a0[v0] < 0) { v17 = v16; v14 = mbrlen(&a0[v0], *(&v15) - v0, &v16, &a0[v0]); break; } else { v14 = a0[v0]; break; } if (v14 == -2 || v14 == -1) { v16 = v17; v0 += 1; break; } else if (v14) { v0 = v0 + v14; break; } else { v0 += 1; } } continue; } else { if (*(&locale_mb_cur_max) <= 1) { v0 += 1; } else { v10 = is_basic(a0[v0]); if (v10) { v13 = 1; } else if (!*(&locale_utf8locale) || a0[v0] < 0) { v17 = v16; v13 = mbrlen(&a0[v0], *(&v15) - v0, &v16, &a0[v0]); } else { v13 = a0[v0]; } if (v13 == -2 || v13 == -1) { v16 = v17; v0 += 1; } else { if (v13) { v0 = v0 + v13; break; } else { v0 += 1; } continue; } } break; } case 0: no_longjmp_on_fatal_error = v7; v19 = v0 + 2; return v19; default: v0 += 2; v4 += 1; v6 = v3; v3 = 0; continue; } default: goto LABEL_405c86; } } } } no_longjmp_on_fatal_error = v7; v19 = v0; return v19; }
bash
angr_sailr
static void pdf_init(pdf_ctx *pc, aes_int_key prf_key) { UINT8 buf[16]; kdf(buf, prf_key, 0, 16); AES_set_encrypt_key((const u_char *)(buf), 16 * 8, pc->prf_key); memset(pc->nonce, 0, sizeof(pc->nonce)); AES_encrypt((u_char *)(pc->nonce), (u_char *)(pc->cache), (AES_KEY *)pc->prf_key); explicit_bzero(buf, sizeof(buf)); }
unsigned long pdf_init(long a1, long a2) { char v3[24]; unsigned long v4; v4 = __readfsqword(0x28u); kdf(v3, a2, 0, 16); AES_set_encrypt_key(v3, 128LL, a1 + 32); memset((void *)(a1 + 16), 0, 0x10uLL); AES_encrypt(a1 + 16, a1, a1 + 32); explicit_bzero(v3, 16LL); return __readfsqword(0x28u) ^ v4; }
openssh-portable
ida
static void dump_lsyntax(fp) FILE *fp; { int i; fprintf(fp, "int sh_syntabsiz = %d;\n", 256); fprintf(fp, "int sh_syntaxtab[%d] = {\n", 256); for (i = 0; i < 256; i++) { putc('\t', fp); dump_lflags(fp, i); putc(',', fp); wcomment(fp, i); putc('\n', fp); } fprintf(fp, "};\n"); }
void dump_lsyntax(FILE *param_1) { int local_c; fprintf(param_1, "int sh_syntabsiz = %d;\n", 0x100); fprintf(param_1, "int sh_syntaxtab[%d] = {\n", 0x100); for (local_c = 0; local_c < 0x100; local_c = local_c + 1) { putc(9, param_1); dump_lflags(param_1, local_c); putc(0x2c, param_1); wcomment(param_1, local_c); putc(10, param_1); } fprintf(param_1, "};\n"); return; }
bash
ghidra
int sshkey_verify(const struct sshkey *key, const u_char *sig, size_t siglen, const u_char *data, size_t dlen, const char *alg, u_int compat, struct sshkey_sig_details **detailsp) { if (detailsp != ((void *)0)) *detailsp = ((void *)0); if (siglen == 0 || dlen > (1 << 20)) return -10; switch (key->type) { case KEY_DSA_CERT: case KEY_DSA: return ssh_dss_verify(key, sig, siglen, data, dlen, compat); case KEY_ECDSA_CERT: case KEY_ECDSA: return ssh_ecdsa_verify(key, sig, siglen, data, dlen, compat); case KEY_ECDSA_SK_CERT: case KEY_ECDSA_SK: return ssh_ecdsa_sk_verify(key, sig, siglen, data, dlen, compat, detailsp); case KEY_RSA_CERT: case KEY_RSA: return ssh_rsa_verify(key, sig, siglen, data, dlen, alg); case KEY_ED25519: case KEY_ED25519_CERT: return ssh_ed25519_verify(key, sig, siglen, data, dlen, compat); case KEY_ED25519_SK: case KEY_ED25519_SK_CERT: return ssh_ed25519_sk_verify(key, sig, siglen, data, dlen, compat, detailsp); default: return -14; } }
int sshkey_verify(unsigned int *a0, unsigned long long a1, unsigned long long a2, unsigned long long a3, unsigned long long a4, unsigned long long a5, unsigned int v1, unsigned long long *a6) { unsigned long long *v0; unsigned int v2; if (a6) *(a6) = 0; if (!a2) { LABEL_4066d4: v2 = -10; } else { if (!(a4 <= 0x100000)) goto LABEL_4066d4; switch (*(a0)) { case 0: case 4: v2 = ssh_rsa_verify(a0, a1, a2, a3, a4, a5); break; case 1: case 5: v2 = ssh_dss_verify(a0, a1, a2, a3, a4, v1); break; case 2: case 6: v2 = ssh_ecdsa_verify(a0, a1, a2, a3, a4, v1); break; case 3: case 7: v2 = ssh_ed25519_verify(a0, a1, a2, a3, a4, v1); break; case 10: case 11: v0 = a6; v2 = ssh_ecdsa_sk_verify(a0, a1, a2, a3, a4, v1); break; case 12: case 13: v0 = a6; v2 = ssh_ed25519_sk_verify(a0, a1, a2, a3, a4, v1); break; default: v2 = -14; break; } } return v2; }
openssh-portable
angr_phoenix
BUCKET_CONTENTS *hash_search(string, table, flags) const char *string; HASH_TABLE *table; int flags; { BUCKET_CONTENTS *list; int bucket; unsigned int hv; if (table == 0 || ((flags & 0x02) == 0 && ((table) ? (table)->nentries : 0) == 0)) return (BUCKET_CONTENTS *)((void *)0); bucket = (((hv) = hash_string(string)) & ((table)->nbuckets - 1)); for (list = table->bucket_array ? table->bucket_array[bucket] : 0; list; list = list->next) { if (hv == list->khash && ((list->key)[0] == (string)[0] && strcmp(list->key, string) == 0)) { list->times_found++; return (list); } } if (flags & 0x02) { if (((table)->nentries >= (table)->nbuckets * 2)) { hash_grow(table); bucket = (((hv) = hash_string(string)) & ((table)->nbuckets - 1)); } list = (BUCKET_CONTENTS *)sh_xmalloc((sizeof(BUCKET_CONTENTS)), "hashlib.c", 280); list->next = table->bucket_array[bucket]; table->bucket_array[bucket] = list; list->data = ((void *)0); list->key = (char *)string; list->khash = hv; list->times_found = 0; table->nentries++; return (list); } return (BUCKET_CONTENTS *)((void *)0); }
int hash_search(char *a0, struct_0 *a1, unsigned long a2) { unsigned int v0; unsigned int v1; unsigned long v2; unsigned int v4; if (!a1) { v4 = 0; return v4; } if (!(a2 & 2)) { if (!a1) { v4 = 0; return v4; } else if (!a1->field_c) { v4 = 0; return v4; } } v1 = hash_string(a0); v0 = a1->field_8 - 1 & v1; v4 = (!a1->field_0 ? *((a1->field_0 + v0 * 8)) : 0); for (*(&v2) = v4; v2; v2 = *(v2)) { if (v1 == *((v2 + 24)) && *(*((v2 + 8))) == *(a0) && !strcmp(*((v2 + 8)), a0)) { *((v2 + 28)) = *((v2 + 28)) + 1; v4 = v2; return v4; } } if (!(a2 & 2)) { v4 = 0; return v4; } if (a1->field_c >= a1->field_8 << 1) { hash_grow(a1); v1 = hash_string(a0); v0 = a1->field_8 - 1 & v1; } v2 = sh_xmalloc(0x20, "hashlib.c", 0x118); v2->field_0 = *((a1->field_0 + v0 * 8)); *((v0 * 8 + a1->field_0)) = v2; v2->field_10 = 0; v2->field_8 = a0; v2->field_18 = v1; *((v2 + 28)) = 0; a1->field_c = a1->field_c + 1; v4 = v2; return v4; }
bash
angr_sailr
static int channel_handle_efd_write(struct ssh *ssh, Channel *c) { int r; ssize_t len; if ((c->io_ready & 0x08) == 0) return 1; if (sshbuf_len(c->extended) == 0) return 1; len = write(c->efd, sshbuf_ptr(c->extended), sshbuf_len(c->extended)); sshlog("channels.c", __func__, 2112, 0, SYSLOG_LEVEL_DEBUG2, ((void *)0), "channel %d: written %zd to efd %d", c->self, len, c->efd); if (len == -1 && ((*__errno_location()) == 4 || (*__errno_location()) == 11 || (*__errno_location()) == 11)) return 1; if (len <= 0) { sshlog("channels.c", __func__, 2117, 0, SYSLOG_LEVEL_DEBUG2, ((void *)0), "channel %d: closing write-efd %d", c->self, c->efd); channel_close_fd(ssh, c, &c->efd); } else { if ((r = sshbuf_consume(c->extended, len)) != 0) sshfatal("channels.c", __func__, 2121, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "channel %i: consume", c->self); c->local_consumed += len; } return 1; }
void channel_handle_efd_write(unsigned int a0, struct_0 *a1) { unsigned long v0; unsigned long v1; unsigned long v2; unsigned int v3; unsigned long long v4; unsigned long long v6; unsigned long long v7; unsigned long long v11; unsigned long long v12; if (!(a1->field_30 & 8)) { v6 = 1; } else if (!sshbuf_len(a1->field_78)) { v7 = 1; } else { v4 = write(a1->field_24, sshbuf_ptr(a1->field_78), sshbuf_len(a1->field_78)); v2 = a1->field_24; v1 = v4; v0 = a1->field_4; sshlog("channels.c", "channel_handle_efd_write", 0x840, 0x0, 0x6, 0x0, "channel %d: written %zd to efd %d"); if (v4 != -1) { LABEL_406d04: if (v4 <= 0) { v1 = a1->field_24; v0 = a1->field_4; sshlog("channels.c", "channel_handle_efd_write", 0x845, 0x0, 0x6, 0x0, "channel %d: closing write-efd %d"); channel_close_fd(a0, a1, &a1->field_24); } else { v3 = sshbuf_consume(a1->field_78, v4, v4); if (v3) { v2 = a1->field_4; v1 = "channel %i: consume"; sshfatal("channels.c", "channel_handle_efd_write", 0x849, 0x1, 0x1, ssh_err(v3)); } a1->field_b8 = v4 + a1->field_b8; } v12 = 1; } else { if (*(__errno_location()) != 4 && *(__errno_location()) != 11 && !(*(__errno_location()) == 11)) goto LABEL_406d04; v11 = 1; } } return; }
openssh-portable
angr_phoenix
static int cluster_host_is_local(void) { char filename[255 + 1]; int is_local; FILE *f; char hostname[64], myhostname[64]; if (!EnableClustering) return (1); is_local = 0; if (glue_strings(filename, sizeof filename, "/usr/local/var/spool/cron", ".cron.hostname", '/')) { if ((f = fopen(filename, "r"))) { if ((-1) != get_string(hostname, 64, f, "\n") && gethostname(myhostname, 64) == 0) { is_local = (strcmp(myhostname, hostname) == 0); } else { if ((DebugFlags & (0x0010)) != 0) printf("cluster: hostname comparison error\n"); } fclose(f); } else { if ((DebugFlags & (0x0010)) != 0) printf("cluster: file %s not found\n", filename); } } return (is_local); }
int cluster_host_is_local() { unsigned int v0; void *v1; char v2; char v3; char v4; unsigned int v6; if (!EnableClustering) { v6 = 1; } else { v0 = 0; if (glue_strings(&v4, 0x100, "/usr/local/var/spool/cron", ".cron.hostname", 0x2f)) { v1 = fopen(&v4, "r"); if (v1) { if (get_string(&v2, 0x40, v1, "\n") != -1 && !gethostname(&v3, 0x40)) { v0 = !strcmp(&v3, &v2); goto LABEL_400a1d; } if ((*(&DebugFlags) & 16)) printf("cluster: hostname comparison error\n"); LABEL_400a1d: fclose(v1); } else if ((*(&DebugFlags) & 16)) { printf("cluster: file %s not found\n", &v4); } } v6 = v0; } return v6; }
cronie
angr_phoenix
void set_exit_status(int val) { if (val > exit_status) exit_status = val; }
long set_exit_status(unsigned int a1) { long result; result = exit_status; if ((int)a1 > exit_status) { result = a1; exit_status = a1; } return result; }
tar
ida
static int _rl_vi_callback_change_char(_rl_callback_generic_arg *data) { int c; char mb[16 + 1]; c = _rl_vi_callback_getchar(mb, 16); if (c < 0) return -1; if ((__ctype_get_mb_cur_max()) > 1 && rl_byte_oriented == 0) strncpy(_rl_vi_last_replacement, mb, 16); else _rl_vi_last_replacement[0] = c; _rl_vi_last_replacement[16] = '\0'; _rl_callback_func = 0; _rl_want_redisplay = 1; return (_rl_vi_change_char(data->count, c, mb)); }
long long _rl_vi_callback_change_char(unsigned int *a0, unsigned long a1, unsigned long a2, unsigned long a3, unsigned long long a4, unsigned long long a5) { unsigned int v0; char v1; unsigned long long v3; v0 = _rl_vi_callback_getchar(&v1, 0x10); if (v0 < 0) { v3 = 4294967295; } else { if (__ctype_get_mb_cur_max() > 1 && !rl_byte_oriented) { strncpy(&_rl_vi_last_replacement, &v1, 0x10); goto LABEL_404012; } _rl_vi_last_replacement = v0; LABEL_404012: g_4049a0 = 0; _rl_callback_func = 0; _rl_want_redisplay = 1; v3 = _rl_vi_change_char(*(a0), v0, &v1, v0, a4, a5); } return v3; }
bash
angr_phoenix
static int rmnet_parse_opt(struct link_util *lu, int argc, char **argv, struct nlmsghdr *n) { __u16 mux_id; while (argc > 0) { if (matches(*argv, "mux_id") == 0) { do { argv++; if (--argc <= 0) incomplete_command(); } while (0); if (get_u16(&mux_id, *argv, 0)) invarg("mux_id is invalid", *argv); addattr16(n, 1024, IFLA_RMNET_MUX_ID, mux_id); } else if (matches(*argv, "help") == 0) { explain(); return -1; } else { fprintf(stderr, "rmnet: unknown command \"%s\"?\n", *argv); explain(); return -1; } argc--, argv++; } return 0; }
long rmnet_parse_opt(long a1, int a2, const char **a3, long a4) { const char **v7; int v9; unsigned short v10; unsigned long v11; v11 = __readfsqword(0x28u); while (1) { if (a2 <= 0) return 0LL; if ((unsigned char)matches(*a3, "mux_id") == 1) break; v7 = a3 + 1; v9 = a2 - 1; if (v9 <= 0) incomplete_command(); if ((unsigned int)get_u16(&v10, *v7, 0LL)) invarg("mux_id is invalid", *v7); addattr16(a4, 1024LL, 1LL, v10); a2 = v9 - 1; a3 = v7 + 1; } if ((unsigned char)matches(*a3, "help") == 1) fprintf(stderr, "rmnet: unknown command \"%s\"?\n", *a3); explain(); return 0xFFFFFFFFLL; }
iproute2-6.0.0
ida
static int cert_option_list(struct sshauthopt *opts, struct sshbuf *oblob, u_int which, int crit) { char *command, *allowed; char *name = ((void *)0); struct sshbuf *c = ((void *)0), *data = ((void *)0); int r, ret = -1, found; if ((c = sshbuf_fromb(oblob)) == ((void *)0)) { sshlog("auth-options.c", __func__, 82, 1, SYSLOG_LEVEL_ERROR, ((void *)0), "sshbuf_fromb failed"); goto out; } while (sshbuf_len(c) > 0) { sshbuf_free(data); data = ((void *)0); if ((r = sshbuf_get_cstring(c, &name, ((void *)0))) != 0 || (r = sshbuf_froms(c, &data)) != 0) { sshlog("auth-options.c", __func__, 91, 0, SYSLOG_LEVEL_ERROR, ssh_err(r), "Unable to parse certificate options"); goto out; } sshlog("auth-options.c", __func__, 94, 0, SYSLOG_LEVEL_DEBUG3, ((void *)0), "found certificate option \"%.100s\" len %zu", name, sshbuf_len(data)); found = 0; if ((which & 2) != 0) { if (strcmp(name, "no-touch-required") == 0) { opts->no_require_user_presence = 1; found = 1; } else if (strcmp(name, "permit-X11-forwarding") == 0) { opts->permit_x11_forwarding_flag = 1; found = 1; } else if (strcmp(name, "permit-agent-forwarding") == 0) { opts->permit_agent_forwarding_flag = 1; found = 1; } else if (strcmp(name, "permit-port-forwarding") == 0) { opts->permit_port_forwarding_flag = 1; found = 1; } else if (strcmp(name, "permit-pty") == 0) { opts->permit_pty_flag = 1; found = 1; } else if (strcmp(name, "permit-user-rc") == 0) { opts->permit_user_rc = 1; found = 1; } } if (!found && (which & 1) != 0) { if (strcmp(name, "verify-required") == 0) { opts->require_verify = 1; found = 1; } else if (strcmp(name, "force-command") == 0) { if ((r = sshbuf_get_cstring(data, &command, ((void *)0))) != 0) { sshlog("auth-options.c", __func__, 127, 0, SYSLOG_LEVEL_ERROR, ssh_err(r), "Unable to parse \"%s\" " "section", name); goto out; } if (opts->force_command != ((void *)0)) { sshlog("auth-options.c", __func__, 132, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "Certificate has multiple " "force-command options"); free(command); goto out; } opts->force_command = command; found = 1; } else if (strcmp(name, "source-address") == 0) { if ((r = sshbuf_get_cstring(data, &allowed, ((void *)0))) != 0) { sshlog("auth-options.c", __func__, 142, 0, SYSLOG_LEVEL_ERROR, ssh_err(r), "Unable to parse \"%s\" " "section", name); goto out; } if (opts->required_from_host_cert != ((void *)0)) { sshlog("auth-options.c", __func__, 147, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "Certificate has multiple " "source-address options"); free(allowed); goto out; } if (addr_match_cidr_list(((void *)0), allowed) == -1) { sshlog("auth-options.c", __func__, 154, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "Certificate source-address " "contents invalid"); goto out; } opts->required_from_host_cert = allowed; found = 1; } } if (!found) { if (crit) { sshlog("auth-options.c", __func__, 165, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "Certificate critical option \"%s\" " "is not supported", name); goto out; } else { sshlog("auth-options.c", __func__, 169, 0, SYSLOG_LEVEL_INFO, ((void *)0), "Certificate extension \"%s\" " "is not supported", name); } } else if (sshbuf_len(data) != 0) { sshlog("auth-options.c", __func__, 173, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "Certificate option \"%s\" corrupt " "(extra data)", name); goto out; } free(name); name = ((void *)0); } ret = 0; out: free(name); sshbuf_free(data); sshbuf_free(c); return ret; }
long cert_option_list(long a1, long a2, char a3, int a4) { long v4; long v5; char *v6; long v7; char *v8; long v9; unsigned int cstring; unsigned int v14; unsigned int v15; unsigned int v16; int v17; void *ptr; void *v19; char *s1; long v21; long v22; unsigned long v23; v23 = __readfsqword(0x28u); s1 = 0LL; v21 = 0LL; v16 = -1; v22 = sshbuf_fromb(a2); if (v22) { while (sshbuf_len(v22)) { sshbuf_free(v21); v21 = 0LL; cstring = sshbuf_get_cstring(v22, &s1, 0LL); if (cstring || (cstring = sshbuf_froms(v22, &v21)) != 0) { v4 = ssh_err(cstring); sshlog("auth-options.c", "cert_option_list", 91LL, 0LL, 2LL, v4, "Unable to parse certificate options"); goto LABEL_46; } v5 = sshbuf_len(v21); sshlog("auth-options.c", "cert_option_list", 94LL, 0LL, 7LL, 0LL, "found certificate option \"%.100s\" len %zu", s1, v5); v17 = 0; if ((a3 & 2) != 0) { if (!strcmp(s1, "no-touch-required")) { *(_DWORD *)(a1 + 128) = 1; v17 = 1; } else if (!strcmp(s1, "permit-X11-forwarding")) { *(_DWORD *)(a1 + 8) = 1; v17 = 1; } else if (!strcmp(s1, "permit-agent-forwarding")) { *(_DWORD *)(a1 + 4) = 1; v17 = 1; } else if (!strcmp(s1, "permit-port-forwarding")) { *(_DWORD *)a1 = 1; v17 = 1; } else if (!strcmp(s1, "permit-pty")) { *(_DWORD *)(a1 + 12) = 1; v17 = 1; } else if (!strcmp(s1, "permit-user-rc")) { *(_DWORD *)(a1 + 16) = 1; v17 = 1; } } if (!v17 && (a3 & 1) != 0) { if (!strcmp(s1, "verify-required")) { *(_DWORD *)(a1 + 132) = 1; v17 = 1; } else if (!strcmp(s1, "force-command")) { v14 = sshbuf_get_cstring(v21, &ptr, 0LL); if (v14) { v6 = s1; v7 = ssh_err(v14); sshlog("auth-options.c", "cert_option_list", 127LL, 0LL, 2LL, v7, "Unable to parse \"%s\" section", v6); goto LABEL_46; } if (*(_QWORD *)(a1 + 56)) { sshlog("auth-options.c", "cert_option_list", 132LL, 0LL, 2LL, 0LL, "Certificate has multiple force-command options"); free(ptr); goto LABEL_46; } *(_QWORD *)(a1 + 56) = ptr; v17 = 1; } else if (!strcmp(s1, "source-address")) { v15 = sshbuf_get_cstring(v21, &v19, 0LL); if (v15) { v8 = s1; v9 = ssh_err(v15); sshlog("auth-options.c", "cert_option_list", 142LL, 0LL, 2LL, v9, "Unable to parse \"%s\" section", v8); goto LABEL_46; } if (*(_QWORD *)(a1 + 112)) { sshlog("auth-options.c", "cert_option_list", 147LL, 0LL, 2LL, 0LL, "Certificate has multiple source-address options"); free(v19); goto LABEL_46; } if ((unsigned int)addr_match_cidr_list(0LL, v19) == -1) { sshlog("auth-options.c", "cert_option_list", 154LL, 0LL, 2LL, 0LL, "Certificate source-address contents invalid"); goto LABEL_46; } *(_QWORD *)(a1 + 112) = v19; v17 = 1; } } if (v17) { if (sshbuf_len(v21)) { sshlog("auth-options.c", "cert_option_list", 173LL, 0LL, 2LL, 0LL, "Certificate option \"%s\" corrupt (extra data)", s1); goto LABEL_46; } } else { if (a4) { sshlog("auth-options.c", "cert_option_list", 165LL, 0LL, 2LL, 0LL, "Certificate critical option \"%s\" is not supported", s1); goto LABEL_46; } sshlog("auth-options.c", "cert_option_list", 169LL, 0LL, 3LL, 0LL, "Certificate extension \"%s\" is not supported", s1); } free(s1); s1 = 0LL; } v16 = 0; } else { sshlog("auth-options.c", "cert_option_list", 82LL, 1LL, 2LL, 0LL, "sshbuf_fromb failed"); } LABEL_46: free(s1); sshbuf_free(v21); sshbuf_free(v22); return v16; }
openssh-portable
ida
uLong adler32_combine(adler1, adler2, len2) uLong adler1; uLong adler2; off_t len2; { return adler32_combine_(adler1, adler2, len2); }
long long adler32_combine(unsigned int a0, unsigned int a1, unsigned int a2) { return adler32_combine_(a0, a1, a2); }
zlib
angr_phoenix
static idx_t iwrite(int fd, char const *buf, idx_t size) { idx_t total_written = 0; if ((output_flags & 040000) && size < output_blocksize) { int old_flags = rpl_fcntl(1, 3); if (rpl_fcntl(1, 4, old_flags & ~040000) != 0 && status_level != STATUS_NONE) nl_error( 0, (*__errno_location()), gettext("failed to turn off O_DIRECT: %s"), quotearg_n_style_colon(0, shell_escape_quoting_style, output_file)); o_nocache_eof = 1; invalidate_cache(1, 0); conversions_mask |= C_FSYNC; } while (total_written < size) { ssize_t nwritten = 0; process_signals(); final_op_was_seek = 0; if ((conversions_mask & C_SPARSE) && is_nul(buf, size)) { if (lseek(fd, size, 1) < 0) { conversions_mask &= ~C_SPARSE; } else { final_op_was_seek = 1; nwritten = size; } } if (!nwritten) nwritten = write(fd, buf + total_written, size - total_written); if (nwritten < 0) { if ((*__errno_location()) != 4) break; } else if (nwritten == 0) { (*__errno_location()) = 28; break; } else total_written += nwritten; } if (o_nocache && total_written) invalidate_cache(fd, total_written); return total_written; }
int iwrite(unsigned long a0, unsigned int a1, unsigned int a2, unsigned long a3, unsigned int a4, unsigned int a5) { unsigned int v0; int tmp_9; void *v1; unsigned long v2; unsigned long v4; unsigned long long v5; v1 = 0; if ((output_flags & 0x4000) && a2 < output_blocksize) { v0 = rpl_fcntl(0x1, 0x3); if (rpl_fcntl(0x1, 0x4) && status_level != 1) { v4 = quotearg_n_style_colon(0x0, 0x3, output_file); nl_error(0x0, *(__errno_location()), gettext("failed to turn off O_DIRECT: %s"), v4, a4, a5); } o_nocache_eof = 1; a1 = 0; invalidate_cache(0x1, 0x0); v5 = conversions_mask; *(&v5) = (conversions_mask >> 8) | 128; tmp_9 = v5; conversions_mask = tmp_9; } while (true) { if (v1 >= a2) break; v2 = 0; process_signals(a0, a1, a2, v4, a4, a5); final_op_was_seek = 0; if ((conversions_mask & 0x10000)) { a1 = a2; v5 = is_nul(a1, a2); if (v5) { a2 = 1; v5 = lseek(a0, a2, 0x1); if (v5 < 0) { conversions_mask = conversions_mask & -65537; } else { final_op_was_seek = 1; *(&v2) = a2; } } } if (!v2) { v5 = write(a0, v1 + a1, a2 - v1); v2 = v5; } if ((v2 - 0 >> 63)) { *(&v5) = *(__errno_location()); if (v5 != 4) break; } else if (v2) { v1 += v2; } else { *(__errno_location()) = 28; break; } } if (o_nocache && v1) invalidate_cache(a0, v1); return v1; }
coreutils
angr_sailr
static inline void emit_ancillary_info(char const *program) { struct infomap { char const *program; char const *node; } const infomap[] = { {"[", "test invocation"}, {"coreutils", "Multi-call invocation"}, {"sha224sum", "sha2 utilities"}, {"sha256sum", "sha2 utilities"}, {"sha384sum", "sha2 utilities"}, {"sha512sum", "sha2 utilities"}, {((void *)0), ((void *)0)}}; char const *node = program; struct infomap const *map_prog = infomap; while (map_prog->program && !(strcmp(program, map_prog->program) == 0)) map_prog++; if (map_prog->node) node = map_prog->node; printf (gettext ("\n%s online help: <%s>\n"), "GNU coreutils", "https: char const *lc_messages = setlocale ( 5 , ((void *)0) ); if (lc_messages && strncmp (lc_messages, "" "en_" "", sizeof ("en_") - 1)) { fputs_unlocked (gettext ("Report any translation bugs to " "<https: stdout ) ; } char const *url_program = (strcmp (program, "[") == 0) ? "test" : program; printf (gettext ("Full documentation <%s%s>\n"), "https: printf (gettext ("or available locally via: info '(coreutils) %s%s'\n"), node, node == program ? " invocation" : ""); }
void emit_ancillary_info(char *a0) { unsigned long long v0; unsigned long long v1[2]; char *v2; unsigned long long v3; unsigned long long v4; unsigned long long v5; unsigned long long v6; unsigned long long v7; unsigned long long v8; unsigned long long v9; unsigned long long v10; unsigned long long v11; unsigned long long v12; unsigned long long v13; unsigned long long v14; unsigned long long v15; void *v16; void *v17; char v18; unsigned long long v23; unsigned long long *v24; unsigned long long v25; 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]; v1[0] = v1 + 1) { if (!strcmp(a0, v1[0])) break; } if (v1[1]) v0 = v1[1]; printf(gettext("\n%s online help: <%s>\n")); v2 = setlocale(0x5, NULL); if (v2 && strncmp(v2, "en_", 0x3)) fputs_unlocked(gettext("Report any translation bugs to <https: if (strcmp(a0, "[")) v23 = a0; else v23 = "test"; v3 = v23; printf(gettext("Full documentation <%s%s>\n")); printf(gettext("or available locally via: info '(coreutils) %s%s'\n")); v25 = *(&v18) ^ v24[5]; return; }
coreutils
angr_dream
unsigned int login_get_lastlog_time(const uid_t uid) { struct logininfo li; if (login_get_lastlog(&li, uid)) return (li.tv_sec); else return (0); }
undefined4 login_get_lastlog_time(undefined4 param_1) { long lVar1; long in_FS_OFFSET; undefined local_438[920]; undefined4 local_a0; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); lVar1 = login_get_lastlog(local_438, param_1); if (lVar1 == 0) { local_a0 = 0; } if (local_10 == *(long *)(in_FS_OFFSET + 0x28)) { return local_a0; } __stack_chk_fail(); }
openssh-portable
ghidra
static int compare_files(struct comparison const *parent, char const *name0, char const *name1) { struct comparison cmp; register int f; int status = 0; _Bool same_files; char *free0; char *free1; if (!((name0 && name1) || (unidirectional_new_file && name1) || new_file)) { char const *name = name0 ? name0 : name1; char const *dir = parent->file[!name0].name; message("Only in %s: %s\n", dir, name); return 1; } memset(cmp.file, 0, sizeof cmp.file); cmp.parent = parent; cmp.file[0].desc = name0 ? (-2) : (-1); cmp.file[1].desc = name1 ? (-2) : (-1); if (!name0) name0 = name1; if (!name1) name1 = name0; if (!parent) { free0 = ((void *)0); free1 = ((void *)0); cmp.file[0].name = name0; cmp.file[1].name = name1; } else { cmp.file[0].name = free0 = file_name_concat(parent->file[0].name, name0, ((void *)0)); cmp.file[1].name = free1 = file_name_concat(parent->file[1].name, name1, ((void *)0)); } for (f = 0; f < 2; f++) { if (cmp.file[f].desc != (-1)) { if (f && strcmp(cmp.file[f].name, cmp.file[0].name) == 0) { cmp.file[f].desc = cmp.file[0].desc; cmp.file[f].stat = cmp.file[0].stat; } else if ((strcmp(cmp.file[f].name, "-") == 0)) { cmp.file[f].desc = 0; if (binary && !isatty(0)) set_binary_mode(0, 0); if (fstat(0, &cmp.file[f].stat) != 0) cmp.file[f].desc = (-3 - ((*__errno_location()))); else { if (((((cmp.file[f].stat.st_mode)) & 0170000) == (0100000))) { off_t pos = lseek(0, 0, 1); if (pos < 0) cmp.file[f].desc = (-3 - ((*__errno_location()))); else cmp.file[f].stat.st_size = ((0) >= (cmp.file[f].stat.st_size - pos) ? (0) : (cmp.file[f].stat.st_size - pos)); } set_mtime_to_now(&cmp.file[f].stat); } } else if ((no_dereference_symlinks ? lstat(cmp.file[f].name, &cmp.file[f].stat) : stat(cmp.file[f].name, &cmp.file[f].stat)) != 0) cmp.file[f].desc = (-3 - ((*__errno_location()))); } } for (f = 0; f < 2; f++) if ((new_file || (f == 0 && unidirectional_new_file)) && (cmp.file[f].desc == (-2) ? (((((cmp.file[f].stat.st_mode)) & 0170000) == (0100000)) && !(cmp.file[f].stat.st_mode & ((0400 | 0200 | 0100) | ((0400 | 0200 | 0100) >> 3) | (((0400 | 0200 | 0100) >> 3) >> 3))) && cmp.file[f].stat.st_size == 0) : ((cmp.file[f].desc == (-3 - (2)) || cmp.file[f].desc == (-3 - (9))) && !parent && (cmp.file[1 - f].desc == (-2) || cmp.file[1 - f].desc == 0)))) cmp.file[f].desc = (-1); for (f = 0; f < 2; f++) if (cmp.file[f].desc == (-1)) { memset(&cmp.file[f].stat, 0, sizeof cmp.file[f].stat); cmp.file[f].stat.st_mode = cmp.file[1 - f].stat.st_mode; } for (f = 0; f < 2; f++) { int e = (-3 - (cmp.file[f].desc)); if (0 <= e) { (*__errno_location()) = e; perror_with_name(cmp.file[f].name); status = 2; } } if (status == 0 && !parent && (((((cmp.file[0].stat.st_mode)) & 0170000) == (0040000)) != 0) != (((((cmp.file[1].stat.st_mode)) & 0170000) == (0040000)) != 0)) { int fnm_arg = (((((cmp.file[0].stat.st_mode)) & 0170000) == (0040000)) != 0); int dir_arg = 1 - fnm_arg; char const *fnm = cmp.file[fnm_arg].name; char const *dir = cmp.file[dir_arg].name; char const *filename = cmp.file[dir_arg].name = free0 = find_dir_file_pathname(dir, last_component(fnm)); if ((strcmp(fnm, "-") == 0)) fatal("cannot compare '-' to a directory"); if ((no_dereference_symlinks ? lstat(filename, &cmp.file[dir_arg].stat) : stat(filename, &cmp.file[dir_arg].stat)) != 0) { perror_with_name(filename); status = 2; } } if (status != 0) { } else if (cmp.file[0].desc == (-1) && cmp.file[1].desc == (-1)) { } else if ((same_files = (cmp.file[0].desc != (-1) && cmp.file[1].desc != (-1) && 0 < ((((&cmp.file[0].stat)->st_ino == (&cmp.file[1].stat)->st_ino) && ((&cmp.file[0].stat)->st_dev == (&cmp.file[1].stat)->st_dev)) || ((((((((&cmp.file[0].stat)->st_mode)) & 0170000) == (0060000)) && (((((&cmp.file[1].stat)->st_mode)) & 0170000) == (0060000))) || ((((((&cmp.file[0].stat)->st_mode)) & 0170000) == (0020000)) && (((((&cmp.file[1].stat)->st_mode)) & 0170000) == (0020000)))) && (&cmp.file[0].stat)->st_rdev == (&cmp.file[1].stat)->st_rdev)) && ((&cmp.file[0].stat)->st_mode == (&cmp.file[1].stat)->st_mode && (&cmp.file[0].stat)->st_nlink == (&cmp.file[1].stat)->st_nlink && (&cmp.file[0].stat)->st_uid == (&cmp.file[1].stat)->st_uid && (&cmp.file[0].stat)->st_gid == (&cmp.file[1].stat)->st_gid && (&cmp.file[0].stat)->st_size == (&cmp.file[1].stat)->st_size && (&cmp.file[0].stat)->st_mtim.tv_sec == (&cmp.file[1].stat)->st_mtim.tv_sec && (&cmp.file[0].stat)->st_ctim.tv_sec == (&cmp.file[1].stat)->st_ctim.tv_sec))) && no_diff_means_no_output) { } else if ((((((cmp.file[0].stat.st_mode)) & 0170000) == (0040000)) != 0) & (((((cmp.file[1].stat.st_mode)) & 0170000) == (0040000)) != 0)) { if (output_style == OUTPUT_IFDEF) fatal("-D option not supported with directories"); if (parent && !recursive) { message("Common subdirectories: %s and %s\n", cmp.file[0].name, cmp.file[1].name); } else status = diff_dirs(&cmp, compare_files); } else if (((((((cmp.file[0].stat.st_mode)) & 0170000) == (0040000)) != 0) | (((((cmp.file[1].stat.st_mode)) & 0170000) == (0040000)) != 0)) || (parent && !((((((cmp.file[0].stat.st_mode)) & 0170000) == (0100000)) || ((((cmp.file[0].stat.st_mode)) & 0170000) == (0120000))) && (((((cmp.file[1].stat.st_mode)) & 0170000) == (0100000)) || ((((cmp.file[1].stat.st_mode)) & 0170000) == (0120000)))))) { if (cmp.file[0].desc == (-1) || cmp.file[1].desc == (-1)) { if (((((((cmp.file[0].stat.st_mode)) & 0170000) == (0040000)) != 0) | (((((cmp.file[1].stat.st_mode)) & 0170000) == (0040000)) != 0)) && recursive && (new_file || (unidirectional_new_file && cmp.file[0].desc == (-1)))) status = diff_dirs(&cmp, compare_files); else { char const *dir; ((void)sizeof((parent) ? 1 : 0), __extension__({ if (parent) ; else __assert_fail("parent", "diff.c", 1325, __extension__ __PRETTY_FUNCTION__); })); dir = parent->file[cmp.file[0].desc == (-1)].name; message("Only in %s: %s\n", dir, name0); status = 1; } } else { message5("File %s is a %s while file %s is a %s\n", file_label[0] ? file_label[0] : cmp.file[0].name, file_type(&cmp.file[0].stat), file_label[1] ? file_label[1] : cmp.file[1].name, file_type(&cmp.file[1].stat)); status = 1; } } else if (((((cmp.file[0].stat.st_mode)) & 0170000) == (0120000)) || ((((cmp.file[1].stat.st_mode)) & 0170000) == (0120000))) { ((void)sizeof((no_dereference_symlinks) ? 1 : 0), __extension__({ if (no_dereference_symlinks) ; else __assert_fail("no_dereference_symlinks", "diff.c", 1353, __extension__ __PRETTY_FUNCTION__); })); if (((((cmp.file[0].stat.st_mode)) & 0170000) == (0120000)) && ((((cmp.file[1].stat.st_mode)) & 0170000) == (0120000))) { char *link_value[2] = {((void *)0), ((void *)0)}; for (f = 0; f < 2; f++) { link_value[f] = xreadlink(cmp.file[f].name); if (link_value[f] == ((void *)0)) { perror_with_name(cmp.file[f].name); status = 2; break; } } if (status == 0) { if (!(strcmp(link_value[0], link_value[1]) == 0)) { message("Symbolic links %s and %s differ\n", cmp.file[0].name, cmp.file[1].name); status = 1; } } for (f = 0; f < 2; f++) free(link_value[f]); } else { message5("File %s is a %s while file %s is a %s\n", file_label[0] ? file_label[0] : cmp.file[0].name, file_type(&cmp.file[0].stat), file_label[1] ? file_label[1] : cmp.file[1].name, file_type(&cmp.file[1].stat)); status = 1; } } else if (files_can_be_treated_as_binary && ((((cmp.file[0].stat.st_mode)) & 0170000) == (0100000)) && ((((cmp.file[1].stat.st_mode)) & 0170000) == (0100000)) && cmp.file[0].stat.st_size != cmp.file[1].stat.st_size && 0 < cmp.file[0].stat.st_size && 0 < cmp.file[1].stat.st_size) { message("Files %s and %s differ\n", file_label[0] ? file_label[0] : cmp.file[0].name, file_label[1] ? file_label[1] : cmp.file[1].name); status = 1; } else { int oflags = 00 | (binary ? 0 : 0); if (cmp.file[0].desc == (-2)) if ((cmp.file[0].desc = open(cmp.file[0].name, oflags, 0)) < 0) { perror_with_name(cmp.file[0].name); status = 2; } if (cmp.file[1].desc == (-2)) { if (same_files) cmp.file[1].desc = cmp.file[0].desc; else if ((cmp.file[1].desc = open(cmp.file[1].name, oflags, 0)) < 0) { perror_with_name(cmp.file[1].name); status = 2; } } if (status == 0) status = diff_2_files(&cmp); if (0 <= cmp.file[0].desc && close(cmp.file[0].desc) != 0) { perror_with_name(cmp.file[0].name); status = 2; } if (0 <= cmp.file[1].desc && cmp.file[0].desc != cmp.file[1].desc && close(cmp.file[1].desc) != 0) { perror_with_name(cmp.file[1].name); status = 2; } } if (status == 0) { if (report_identical_files && !(((((cmp.file[0].stat.st_mode)) & 0170000) == (0040000)) != 0)) message("Files %s and %s are identical\n", file_label[0] ? file_label[0] : cmp.file[0].name, file_label[1] ? file_label[1] : cmp.file[1].name); } else { if (fflush_unlocked(stdout) != 0) pfatal_with_name(gettext("standard output")); } free(free0); free(free1); return status; }
int compare_files(unsigned long long a0, void *a1, void *a2) { unsigned long v0; unsigned long v1; char v2; unsigned int v3; unsigned int v4; unsigned int v5; unsigned int v6; unsigned int v7; void *v8; unsigned long v9; unsigned long v10; unsigned long long v11; char *v12; unsigned long long v13; char *v14; unsigned long long v15; unsigned long v16; void *v17; void *v18; unsigned int v19; unsigned long v20; unsigned long long v21; unsigned long long v22; char v23; unsigned long long v24; char v25; unsigned long long v26; void *v27; unsigned long long v28; unsigned long long v29; unsigned long long v30; unsigned long long v31; char v32; unsigned long long v33; unsigned long long v34; char v35; unsigned long long v36; unsigned long long v37; unsigned long long v38; unsigned int v39; unsigned long v40; char v41; char v42; char v43; char v44; char v45; char v46; char v47; char v48; char v49; char v50; unsigned long long v51[40]; char v52; unsigned int v54; unsigned long v55; unsigned int v56; void *v57; void *v58; void *v59; unsigned long long v60; void *v61; void *v62; unsigned long v63; void *v64; unsigned long v65; v1 = a1; v0 = a2; v3 = 0; if (v1 && !(!v0)) goto LABEL_401974; if (!(unidirectional_new_file ^ 1) && !(!v0)) goto LABEL_401974; if ((new_file ^ 1)) { if (v1) v55 = v1; else v55 = v0; v10 = v55; v11 = *(((!v1) * 304 + a0 + 8)); message("Only in %s: %s\n", v11, v10, a0); *(&v55) = 1; goto LABEL_402ea8; } LABEL_401974: v54 = 0; memset(&v19, 0x0, 0x260); v51[0] = a0; if (!v1) v56 = -1; else v56 = -2; v19 = v56; if (!v0) v55 = -1; else v55 = -2; v39 = v55; if (!v1) v1 = v0; if (!v0) v0 = v1; if (!a0) { v8 = 0; v9 = 0; v20 = v1; v40 = v0; } else { v8 = file_name_concat(*((a0 + 8)), v1, 0x0, v1); v20 = v8; v9 = file_name_concat(*((a0 + 312)), v0, 0x0, v0); v40 = v9; } v57 = 0; while (true) { if (v57 > 1) break; a2 = v57; if (v19 != -1) { if (v57 && !strcmp(v20, v20)) { v60 = v19; v19 = v19; a2 = v57; v21 = v21; v22 = v22; v23 = *(&v23); v24 = *(&v24); v25 = *(&v25); v26 = *(&v26); v27 = v27; v28 = *(&v28); v29 = *(&v29); v30 = *(&v30); v31 = v31; v32 = *(&v32); v33 = v33; v34 = v34; v35 = *(&v35); v36 = *(&v36); v37 = *(&v37); v38 = *(&v38); goto LABEL_401f6f; } if (strcmp(v20, "-")) { if (false) *(&v55) = stat(v20, &v21 + 0x100 * v57 + 0x20 * v57 + 0x10 * v57); else *(&v55) = lstat(v20, &v21 + 0x100 * v57 + 0x20 * v57 + 0x10 * v57); if (v55) { v55 = __errno_location(); v60 = -3 - *(v55); a2 = v57; v19 = -3 - *(v55); } } else { v19 = 0; if (!isatty(0x0)) set_binary_mode(0x0, 0x0); if (fstat(0x0, &v21 + 0x100 * v57 + 0x20 * v57 + 0x10 * v57)) { v55 = __errno_location(); v60 = -3 - *(v55); a2 = v57; v19 = -3 - *(v55); } else { if ((v24 & 0xf000) == 0x8000) { *(&a2) = 1; v16 = lseek(0x0, 0x0, 0x1); if ((v16 - 0 >> 63)) { v19 = -3 - *(__errno_location()); } else { if ([D] amd64g_calculate_condition( 0x9 < 64 >, 0x14 < 64 >, Sub(Load(addr = (stack_base - 584 + (((((rbx<8> << 0x3 < 8 >) + rbx<8>) << 0x1 < 8 >) + rbx<8>) << 0x4 < 8 >)), size = 8, endness = Iend_LE), Load(addr = stack_base - 672, size = 8, endness = Iend_LE)), 0x0 < 64 >, cc_ndep<8>)) v60 = v27 - v16; else v60 = 0; v27 = v60; } } set_mtime_to_now(&v21 + 0x130 * v57); } } } LABEL_401f6f: v57 = v57 + 1; } v58 = 0; while (true) { if (v58 > 1) break; if (!new_file) { if (!(!v58)) goto LABEL_402177; if (!unidirectional_new_file) goto LABEL_402177; } v60 = &v52; if (v19 == -2) { a2 = v58; v60 = &v52; if ((v24 & 0xf000) == 0x8000) { a2 = v58; if (!(v24 & 511)) { a2 = v58; v60 = &v52; if (!v27) { *(&v55) = 1; goto LABEL_40206f; } } } *(&v55) = 0; LABEL_40206f: *(&v55) = v55 & 1; goto LABEL_402149; } a2 = v58; if (v19 != -5) { a2 = v58; if (!(v19 == -12)) goto LABEL_402141; } if (a0) { LABEL_402141: *(&v55) = 0; LABEL_402146: *(&v55) = v55 & 1; LABEL_402149: if (v55) { a2 = v58; v19 = -1; } LABEL_402177: v58 = v58 + 1; } else { a2 = 1 - v58; v60 = &v52; if (*((304 + &v19 + -0x100 * v58 + -0x20 * v58 + -0x10 * v58)) != -2) { a2 = 1 - v58; if (!(!*((304 + &v19 + -0x100 * v58 + -0x20 * v58 + -0x10 * v58)))) goto LABEL_402141; } *(&v55) = 1; goto LABEL_402146; } } for (v59 = 0; v59 <= 1; v59 = v59 + 1) { a2 = v59; v60 = &v52; if (v19 == -1) { v54 = 0; memset(&v21 + 0x130 * v59, 0x0, 0x90); v60 = *((304 + &v24 + -0x130 * v59)); a2 = v59; v24 = *((304 + &v24 + -0x130 * v59)); } } for (v61 = 0; v61 <= 1; v61 = v61 + 1) { v60 = &v52; a2 = -3 - v19; v7 = -3 - v19; if (v7 >= 0) { *(__errno_location()) = v7; perror_with_name(v20, &v52, v61); v3 = 2; } } if (!v3 && !a0) { *(&a2) = (v24 & 0xf000) == 0x4000; *(&v55) = *(&v44) & 0xf000; *(&v55) = (*(&v44) & 0xf000) == 0x4000; *(&v55) = v55 ^ a2; if (v55) { v4 = (v24 & 0xf000) == 0x4000; v5 = 1 - v4; v12 = (&v20)[38 * v4]; v13 = (&v20)[38 * v5]; v55 = last_component(v12); v8 = find_dir_file_pathname(v13, v55, v55); (&v20)[38 * v5] = v8; v14 = (&v20)[38 * v5]; if (!strcmp(v12, "-")) fatal("cannot compare '-' to a directory"); if (false) *(&v55) = stat(v14, &(&v21)[0x100 * v5 + 32 * v5 + 16 * v5]); else *(&v55) = lstat(v14, &(&v21)[0x100 * v5 + 32 * v5 + 16 * v5]); if (v55) { perror_with_name(v14, *(&v54), a2); v3 = 2; } } } if (v3) { LABEL_402dea: if (v3) { if (fflush_unlocked(stdout)) pfatal_with_name(gettext("standard output")); } else { if (report_identical_files && (v24 & 0xf000) != 0x4000) { if (true) v65 = 0xe445c7000000; else v65 = v40; if (true) v55 = 137436510857491849; else v55 = v20; message("Files %s and %s are identical\n", v55, v65, v60); } } free(v8); free(v9); *(&v55) = v3; LABEL_402ea8: return v55; } if (v19 == -1 && v39 == -1) goto LABEL_402dea; if (v19 != -1 && v39 != -1) { a2 = v22; if (v22 == *(&v42)) { a2 = v21; if (v21 == *(&v41)) goto LABEL_4025fc; } if ((v24 & 0xf000) == 0x6000 && (*(&v44) & 0xf000) == 0x6000) goto LABEL_4025e9; if (!((v24 & 0xf000) == 0x2000)) goto LABEL_402603; if (!((*(&v44) & 0xf000) == 0x2000)) goto LABEL_402603; LABEL_4025e9: a2 = v26; if (v26 == *(&v47)) { LABEL_4025fc: *(&v55) = 1; goto LABEL_402608; } LABEL_402603: *(&v55) = 0; LABEL_402608: if (v55 > 0) { a2 = v24; if (v24 == *(&v44)) { a2 = v23; if (v23 == *(&v43)) { a2 = *((&v24 + 4)); if (*((&v24 + 4)) == *(&v45)) { a2 = v25; if (v25 == *(&v46)) { a2 = v27; if (v27 == *(&v48)) { a2 = v32; if (v32 == *(&v49)) { *(&a2) = v34; if (v34 == *(&v50)) { *(&v55) = 1; goto LABEL_402698; } } } } } } } } } *(&v55) = 0; LABEL_402698: v2 = v55; v2 &= 1; if (v2 && !(!15)) goto LABEL_402dea; *(&a2) = (v24 & 0xf000) == 0x4000; *(&v55) = *(&v44) & 0xf000; *(&v55) = (*(&v44) & 0xf000) == 0x4000; *(&v55) = v55 & a2; if (v55) { if (false) fatal("-D option not supported with directories"); if (a0 && (recursive ^ 1)) { message("Common subdirectories: %s and %s\n", v20, v40, v60); goto LABEL_402dea; } v3 = diff_dirs(&v19, compare_files); goto LABEL_402dea; } *(&a2) = (v24 & 0xf000) == 0x4000; *(&v55) = *(&v44) & 0xf000; *(&v55) = (*(&v44) & 0xf000) == 0x4000; *(&v55) = v55 | a2; if (v55) { LABEL_4027e5: if (v19 != -1 && v39 != -1) { file_type(&v41); file_type(&v21); if (true) v55 = 137436510857491849; else v55 = v20; message5("File %s is a %s while file %s is a %s\n", v55); v3 = 1; goto LABEL_402dea; } *(&a2) = (v24 & 0xf000) == 0x4000; *(&v55) = *(&v44) & 0xf000; *(&v55) = (*(&v44) & 0xf000) == 0x4000; *(&v55) = v55 | a2; if (v55 && recursive) { if (new_file) { LABEL_402857: v3 = diff_dirs(&v19, compare_files); goto LABEL_402996; } else if (unidirectional_new_file) { if (!(v19 == -1)) goto LABEL_402879; goto LABEL_402857; } } LABEL_402879: if (!a0) __assert_fail(); v15 = *(((v19 == -1) * 304 + a0 + 8)); message("Only in %s: %s\n", v15, v1, a0); v3 = 1; LABEL_402996: goto LABEL_402dea; } else { if (a0) { if ((v24 & 0xf000) != 0x8000 && !((v24 & 0xf000) == 0xa000)) goto LABEL_4027e5; if ((*(&v44) & 0xf000) != 0x8000) { if ((*(&v44) & 0xf000) == 0xa000) goto LABEL_40299b; goto LABEL_4027e5; } } LABEL_40299b: if ((v24 & 0xf000) != 0xa000 && (*(&v44) & 0xf000) != 0xa000) { if ((v24 & 0xf000) == 0x8000 && (*(&v44) & 0xf000) == 0x8000 && v27 != *(&v48) && v27 > 0 && *(&v48) > 0) { if (true) v63 = 0xe445c7000000; else v63 = v40; if (true) v55 = 137436510857491849; else v55 = v20; message("Files %s and %s differ\n", v55, v63, v60); v3 = 1; goto LABEL_402dea; } v6 = 0; if (v19 == -2) { *(&a2) = 0; v54 = v6; v19 = open(v20, v6, 0x0); if (v19 < 0) { perror_with_name(v20, reg_64, a2); v3 = 2; } } if (v39 == -2) { if (v2) { v39 = v19; } else { *(&a2) = 0; v54 = v6; v39 = open(v40, v6, 0x0); if (v39 < 0) { perror_with_name(v40, reg_64, a2); v3 = 2; } } } if (!v3) v3 = diff_2_files(&v19); if (v19 >= 0 && close(v19)) { perror_with_name(v20, *(&v54), a2); v3 = 2; } if (v39 >= 0 && v19 != v39 && close(v39)) { perror_with_name(v40, *(&v54), a2); v3 = 2; goto LABEL_402dea; } } if (false) __assert_fail(); if ((v24 & 0xf000) == 0xa000 && (*(&v44) & 0xf000) == 0xa000) { v17 = 0; v18 = 0; v62 = 0; while (true) { if (v62 > 1) break; v17 = xreadlink(v20); if (v17) { v62 = v62 + 1; } else { perror_with_name(*((&v20 + 0x130 * v62)), *(&v54), v62); v3 = 2; break; } } if (!v3 && strcmp(v17, v18)) { message("Symbolic links %s and %s differ\n", v20, v40, v60); v3 = 1; } for (v64 = 0; v64 <= 1; v64 = v64 + 1) { free(v17); } goto LABEL_402dea; } file_type(&v41); file_type(&v21); if (true) v55 = 137436510857491849; else v55 = v20; message5("File %s is a %s while file %s is a %s\n", v55); v3 = 1; goto LABEL_402dea; goto LABEL_402dea; } }
diffutils
angr_phoenix
BUILTIN_DESC *copy_builtin(builtin) BUILTIN_DESC *builtin; { BUILTIN_DESC *new; new = (BUILTIN_DESC *)xmalloc(sizeof(BUILTIN_DESC)); new->name = strcpy(xmalloc(1 + strlen(builtin->name)), (builtin->name)); new->shortdoc = strcpy(xmalloc(1 + strlen(builtin->shortdoc)), (builtin->shortdoc)); new->longdoc = copy_string_array(builtin->longdoc); new->dependencies = copy_string_array(builtin->dependencies); new->function = builtin->function ? strcpy(xmalloc(1 + strlen(builtin->function)), (builtin->function)) : (char *)((void *)0); new->docname = builtin->docname ? strcpy(xmalloc(1 + strlen(builtin->docname)), (builtin->docname)) : (char *)((void *)0); return (new); }
_QWORD *copy_builtin(long a1) { const char *v1; int v2; char *v3; const char *v4; int v5; char *v6; const char *v7; int v8; char *v9; char *v10; const char *v11; int v12; char *v13; char *v14; _QWORD *v16; v16 = xmalloc(56); v1 = *(const char **)a1; v2 = strlen(*(const char **)a1); v3 = (char *)xmalloc(v2 + 1); *v16 = strcpy(v3, v1); v4 = *(const char **)(a1 + 16); v5 = strlen(v4); v6 = (char *)xmalloc(v5 + 1); v16[2] = strcpy(v6, v4); v16[4] = copy_string_array(*(_QWORD *)(a1 + 32)); v16[5] = copy_string_array(*(_QWORD *)(a1 + 40)); if (*(_QWORD *)(a1 + 8)) { v7 = *(const char **)(a1 + 8); v8 = strlen(v7); v9 = (char *)xmalloc(v8 + 1); v10 = strcpy(v9, v7); } else { v10 = 0LL; } v16[1] = v10; if (*(_QWORD *)(a1 + 24)) { v11 = *(const char **)(a1 + 24); v12 = strlen(v11); v13 = (char *)xmalloc(v12 + 1); v14 = strcpy(v13, v11); } else { v14 = 0LL; } v16[3] = v14; return v16; }
bash
ida
static z_word_t byte_swap(word) z_word_t word; { return (word & 0xff00000000000000) >> 56 | (word & 0xff000000000000) >> 40 | (word & 0xff0000000000) >> 24 | (word & 0xff00000000) >> 8 | (word & 0xff000000) << 8 | (word & 0xff0000) << 24 | (word & 0xff00) << 40 | (word & 0xff) << 56; }
int byte_swap(unsigned long a0) { return a0 * 0x100000000000000 | a0 / 0x100000000000000 | a0 / 0x10000000000 & 0xff00 | a0 / 0x1000000 & 0xff0000 | a0 / 0x100 & -0x1000000 | 0xff00000000 & a0 * 0x100 | 0xff0000000000 & a0 * 0x1000000 | 0xff000000000000 & a0 * 0x10000000000; }
zlib
angr_sailr
int c_strcasecmp(const char *s1, const char *s2) { register const unsigned char *p1 = (const unsigned char *)s1; register const unsigned char *p2 = (const unsigned char *)s2; unsigned char c1, c2; if (p1 == p2) return 0; do { c1 = c_tolower(*p1); c2 = c_tolower(*p2); if (c1 == '\0') break; ++p1; ++p2; } while (c1 == c2); if ((0x7f * 2 + 1) <= 0x7fffffff) return c1 - c2; else return (((c1) > (c2)) - ((c1) < (c2))); }
long long c_strcasecmp(unsigned long long a0, unsigned long long a1) { char v0; char v1; char *v3; char *v4; void *v5; v3 = a0; v4 = a1; if (a0 == a1) { v5 = 0; return v5; } do { v0 = c_tolower(*(v3)); v1 = c_tolower(*(v4)); if (!(v0) || !((v3 += 1, v4 += 1, v0 == v1))) break; } while ((v3 += 1, v4 += 1, v0 == v1)); v5 = v0 - v1; return v5; }
gnutls
angr_sailr
test_code_t test_aes_ccm_8(gnutls_session_t session) { int ret; sprintf(prio_str, "NONE:" "+AES-128-CCM-8:+AES-256-CCM-8:" "+COMP-NULL" ":%s:" "+MAC-ALL:+MD5:+SHA1" ":+GOST28147-TC26Z-IMIT" ":" "+RSA:+DHE-RSA:+DHE-DSS:+ANON-DH:+ECDHE-RSA:+ECDHE-ECDSA:+ANON-ECDH" ":+VKO-GOST-12" ":%s", protocol_all_str, rest); { int _ret; if ((_ret = __gnutls_priority_set_direct(session, prio_str, 798)) != TEST_SUCCEED) { return _ret; } }; gnutls_credentials_set(session, GNUTLS_CRD_CERTIFICATE, xcred); ret = test_do_handshake(session); return ret; }
long test_aes_ccm_8(long a1) { unsigned int v2; sprintf(prio_str, "NONE:+AES-128-CCM-8:+AES-256-CCM-8:+COMP-NULL:%s:+MAC-ALL:+MD5:+" "SHA1:+GOST28147-TC26Z-IMIT:+RSA:+DHE-RSA:+DHE-DSS:+A" "NON-DH:+ECDHE-RSA:+ECDHE-ECDSA:+ANON-ECDH:+VKO-GOST-12:%s", protocol_all_str, rest); v2 = _gnutls_priority_set_direct(a1, prio_str, 0x31Eu); if (v2) return v2; gnutls_credentials_set(a1, 1LL, xcred); return (unsigned int)test_do_handshake(a1); }
gnutls
ida
void setjobctl(int on) { int fd; int pgrp; if (on == jobctl || (!shlvl) == 0) return; if (on) { int ofd; ofd = fd = sh_open("/dev/tty", 02, 1); if (fd < 0) { fd += 3; while (!isatty(fd)) if (--fd < 0) goto out; } fd = savefd(fd, ofd); do { if ((pgrp = tcgetpgrp(fd)) < 0) { out: sh_warnx("can't access tty; job control turned off"); optlist[4] = on = 0; goto close; } if (pgrp == getpgrp()) break; killpg(0, 21); } while (1); initialpgrp = pgrp; setsignal(20); setsignal(22); setsignal(21); pgrp = rootpid; setpgid(0, pgrp); xtcsetpgrp(fd, pgrp); } else { fd = ttyfd; pgrp = initialpgrp; xtcsetpgrp(fd, pgrp); setpgid(0, pgrp); setsignal(20); setsignal(22); setsignal(21); close: close(fd); fd = -1; } ttyfd = fd; jobctl = on; }
long long setjobctl(unsigned long a0) { unsigned int v0; unsigned int v1; unsigned int v2; unsigned int v3; unsigned long long v5; v0 = a0; v5 = -3685562976304961; if (v0 != 191) { v5 = shlvl; if (!shlvl) { if (!v0) { v1 = ttyfd; v2 = initialpgrp; xtcsetpgrp(v1, v2); setpgid(0x0, v2); setsignal(0x14); setsignal(0x16); setsignal(0x15); } else { v1 = sh_open("/dev/tty", 0x2, 0x1); v3 = v1; if (v1 < 0) { v1 += 3; while (true) { if (isatty(v1)) break; v1 -= 1; if (v1 < 0) goto LABEL_400167; } } v1 = savefd(v1, v3, v3); while (true) { v2 = tcgetpgrp(v1); if (v2 < 0) break; if (v2 != getpgrp()) { killpg(0x0, 0x15); } else { initialpgrp = v2; setsignal(0x14); setsignal(0x16); setsignal(0x15); v2 = rootpid; setpgid(0x0, v2); xtcsetpgrp(v1, v2); goto LABEL_400256; } } LABEL_400167: sh_warnx("can't access tty; job control turned off"); v0 = 0; g_50003c = 0; } close(v1); v1 = -1; LABEL_400256: ttyfd = v1; v5 = v0; job_warning = v0; } } return v5; }
dash-0.5.11+git20210903+057cd650a4ed
angr_phoenix
void _rl_keyseq_cxt_dispose(_rl_keyseq_cxt *cxt) { xfree(cxt); }
void _rl_keyseq_cxt_dispose(unsigned long long a0) { unsigned long long v1; v1 = xfree(a0); return; }
bash
angr_dream
static _Bool excluded_fstype(char const *fstype) { const struct fs_type_list *fsp; if (fs_exclude_list == ((void *)0) || fstype == ((void *)0)) return 0; for (fsp = fs_exclude_list; fsp; fsp = fsp->fs_next) if ((strcmp(fstype, fsp->fs_name) == 0)) return 1; return 0; }
long excluded_fstype(const char *a1) { long i; if (!fs_exclude_list || !a1) return 0LL; for (i = fs_exclude_list; i; i = *(_QWORD *)(i + 8)) { if (!strcmp(a1, *(const char **)i)) return 1LL; } return 0LL; }
coreutils
ida
gl_list_nx_add_first(gl_list_t list, const void *elt) { return ((const struct gl_list_impl_base *)list) ->vtable->nx_add_first(list, elt); }
void gl_list_nx_add_first(void) { halt_baddata(); }
gnutls
ghidra
int rl_on_new_line(void) { return 0; }
long long rl_on_new_line() { return 0; }
libedit
angr_sailr
void bash_initialize_history() { history_quotes_inhibit_expansion = 1; history_search_delimiter_chars = ";&()|<>"; history_inhibit_expansion_function = bash_history_inhibit_expansion; sv_histchars("histchars"); }
long long bash_initialize_history() { history_quotes_inhibit_expansion = 1; history_search_delimiter_chars = ";&()|<>"; history_inhibit_expansion_function = bash_history_inhibit_expansion; return sv_histchars("histchars"); }
bash
angr_phoenix
static void bytes_chunk_extract(uintmax_t k, uintmax_t n, char *buf, size_t bufsize, size_t initial_read, off_t file_size) { off_t start; off_t end; ((void)sizeof((k && n && k <= n && n <= file_size) ? 1 : 0), __extension__({ if (k && n && k <= n && n <= file_size) ; else __assert_fail("k && n && k <= n && n <= file_size", "src/split.c", 996, __extension__ __PRETTY_FUNCTION__); })); start = (k - 1) * (file_size / n); end = (k == n) ? file_size : k * (file_size / n); if (start < initial_read) { memmove(buf, buf + start, initial_read - start); initial_read -= start; } else { if (lseek(0, start - initial_read, 1) < 0) ((!!sizeof(struct { _Static_assert( 1, "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), \"%s\", quotearg_n_style_colon " "(0, shell_escape_quoting_style, infile)), assume (false))" ")"); int _gl_dummy; })) ? ((error(1, (*__errno_location()), "%s", quotearg_n_style_colon(0, shell_escape_quoting_style, infile)), ((0) ? (void)0 : __builtin_unreachable()))) : ((error(1, (*__errno_location()), "%s", quotearg_n_style_colon(0, shell_escape_quoting_style, infile)), ((0) ? (void)0 : __builtin_unreachable())))); initial_read = (18446744073709551615UL); } while (start < end) { size_t n_read; if (initial_read != (18446744073709551615UL)) { n_read = initial_read; initial_read = (18446744073709551615UL); } else { n_read = safe_read(0, buf, bufsize); if (n_read == ((size_t)-1)) ((!!sizeof(struct { _Static_assert(1, "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), \"%s\", " "quotearg_n_style_colon (0, " "shell_escape_quoting_style, infile)), assume (false))" ")"); int _gl_dummy; })) ? ((error(1, (*__errno_location()), "%s", quotearg_n_style_colon(0, shell_escape_quoting_style, infile)), ((0) ? (void)0 : __builtin_unreachable()))) : ((error(1, (*__errno_location()), "%s", quotearg_n_style_colon(0, shell_escape_quoting_style, infile)), ((0) ? (void)0 : __builtin_unreachable())))); } if (n_read == 0) break; n_read = (((n_read) < (end - start)) ? (n_read) : (end - start)); if (full_write(1, buf, n_read) != n_read && !ignorable((*__errno_location()))) ((!!sizeof(struct { _Static_assert( 1, "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), \"%s\", quotearg_n_style_colon " "(0, shell_escape_quoting_style, \"-\")), assume (false))" ")"); int _gl_dummy; })) ? ((error( 1, (*__errno_location()), "%s", quotearg_n_style_colon(0, shell_escape_quoting_style, "-")), ((0) ? (void)0 : __builtin_unreachable()))) : ((error( 1, (*__errno_location()), "%s", quotearg_n_style_colon(0, shell_escape_quoting_style, "-")), ((0) ? (void)0 : __builtin_unreachable())))); start += n_read; } }
void bytes_chunk_extract(unsigned long long a0, unsigned long a1, void *a2, unsigned long long a3, unsigned long a4, unsigned long long a5) { unsigned long long v0; unsigned long long v1; unsigned long long v2; unsigned long v3; unsigned long long v5; unsigned long long v6; unsigned long long v7; unsigned long long v9; unsigned long long v10; unsigned long long v11; unsigned long long v12; v0 = a4; if (a0 && a1 && a0 <= a1 && a1 <= a5) { v1 = (a0 - 1) * (0 CONCAT a5) / m a1; if (a0 == a1) v5 = a5; else v5 = a0 * (0 CONCAT a5) / m a1; v3 = v5; if (v0 > v1) { memmove(a2, v1 + a2, v0 - v1); v0 -= v1; } else if (lseek(0x0, v1 - v0, 0x1) >= 0) { v0 = -1; } else { v10 = quotearg_n_style_colon(0x0, 0x3, *(&infile)); error(0x1, *(__errno_location()), "%s"); } while (true) { v6 = v1; if (v1 >= v3) break; if (v0 != -1) { v7 = v0; v2 = v0; v0 = -1; } else { *(&v2) = safe_read(0x0, a2, a3, a3); if (v2 == -1) { v11 = quotearg_n_style_colon(0x0, 0x3, *(&infile)); error(0x1, *(__errno_location()), "%s"); } } if (!v2) break; v9 = v3 - v1; if (v2 <= v3 - v1) v9 = v2; v2 = v9; if (v2 != full_write(0x1, a2, v2, a3)) { *(&v9) = ignorable(*(__errno_location())) ^ 1; if (v9) { v12 = quotearg_n_style_colon(0x0, 0x3, "-"); error(0x1, *(__errno_location()), "%s"); } } v1 = v2 + v1; } return; } __assert_fail(); }
coreutils
angr_phoenix
static wchar_t *find_word_to_complete(const wchar_t *cursor, const wchar_t *buffer, const wchar_t *word_break, const wchar_t *special_prefixes, size_t *length, int do_unescape) { const wchar_t *ctemp = cursor; wchar_t *temp; size_t len; if (ctemp > buffer) { switch (ctemp[-1]) { case '\\': case '\'': case '"': ctemp--; break; default: break; } } for (;;) { if (ctemp <= buffer) break; if (ctemp - buffer >= 2 && ctemp[-2] == '\\' && needs_escaping(ctemp[-1])) { ctemp -= 2; continue; } if (wcschr(word_break, ctemp[-1])) break; if (special_prefixes && wcschr(special_prefixes, ctemp[-1])) break; ctemp--; } len = (size_t)(cursor - ctemp); if (len == 1 && (ctemp[0] == '\'' || ctemp[0] == '"')) { len = 0; ctemp++; } *length = len; if (do_unescape) { wchar_t *unescaped_word = unescape_string(ctemp, len); if (unescaped_word == ((void *)0)) return ((void *)0); return unescaped_word; } temp = malloc((len + 1) * sizeof(*temp)); (void)wcsncpy(temp, ctemp, len); temp[len] = '\0'; return temp; }
int find_word_to_complete(void *a0, unsigned long a1, unsigned short *a2, unsigned short *a3, unsigned long long *a4, unsigned long a5) { unsigned int *v0; unsigned long long v1; unsigned long long v2; unsigned long v3; unsigned int v5; v0 = a0; if (v0 > a1 && 58 >= v0[1] - 34 && (288230376151711777 & 1 << ((v0[1] - 34) & 63))) v0 += 1; for (; v0 > a1; v0 += 1) { if (v0 + -1 * a1 > 4 && v0[2] == 92) { v5 = needs_escaping(v0[1]); if (v5) v0 += 2; } if (!v5 || v0 + -1 * a1 <= 4 || v0[2] != 92) { v5 = wcschr(a2, v0[1]); if (v5) break; if (!v5) { if (a3) { v5 = wcschr(a3, v0[1]); if (v5) break; } } } } v1 = a0 - v0 >> 2; if (v1 == 1 && (*(v0) == 34 || *(v0) == 39)) { v1 = 0; v0 += 1; } *(a4) = v1; if (a5) { v3 = unescape_string(v0, v1); if (!v3) v5 = 0; else v5 = v3; } else { v2 = malloc((v1 + 1) * 4); wcsncpy(v2, v0, v1); *((v2 + v1 * 4)) = 0; v5 = v2; } return v5; }
libedit
angr_dream
static float estimate_pattern_match_rate(const char *pattern, int is_regex) { if (strpbrk(pattern, "*?[") || (is_regex && strpbrk(pattern, "."))) { return 0.8f; } else { return 0.1f; } }
void estimate_pattern_match_rate(char *a0, unsigned long a1) { if (strpbrk(a0, "*?[")) { LABEL_40176b: } else if (!a1) { LABEL_401775: } else { if (!strpbrk(a0, ".")) goto LABEL_401775; goto LABEL_40176b; } return; }
findutils
angr_phoenix
void coproc_rclose(cp, fd) struct coproc *cp; int fd; { if (cp->c_rfd >= 0 && cp->c_rfd == fd) { close(cp->c_rfd); cp->c_rfd = -1; } }
void coproc_rclose(long param_1, int param_2) { if ((-1 < *(int *)(param_1 + 0xc)) && (param_2 == *(int *)(param_1 + 0xc))) { close(*(int *)(param_1 + 0xc)); *(undefined4 *)(param_1 + 0xc) = 0xffffffff; } return; }
bash
ghidra
int strsvisx(char *mbdst, const char *mbsrc, size_t len, int flags, const char *mbextra) { return istrsenvisxna(mbdst, ((void *)0), mbsrc, len, flags, mbextra, ((void *)0)); }
long long strsvisx(unsigned int a0, char *a1, unsigned long a2, unsigned long a3, void *a4) { return istrsenvisxna(a0, NULL, a1, a2, a3, a4, NULL); }
libbsd-0.11.7
angr_sailr
static void set_use_compress_program_option(const char *string, struct option_locus *loc) { struct option_locus *p = optloc_save(OC_COMPRESS, loc); if (use_compress_program_option && strcmp(use_compress_program_option, string) != 0 && p->source == OPTS_COMMAND_LINE) do { if (error_hook) error_hook(); error(0, 0, gettext("Conflicting compression options")); usage(2); } while (0); use_compress_program_option = string; }
void set_use_compress_program_option(char *a0, void *a1) { unsigned int *v0; unsigned long long v2; v0 = optloc_save(0x0, a1); if (strcmp(0x5dc0950fc085000f, a0) && *(v0) == 1) { if (error_hook) *(5242888)(); error(0x0, 0x0, gettext("Conflicting compression options")); usage(0x2); } v2 = a0; root_device = a0; return; }
tar
angr_phoenix
static _Bool dotlines(FILE *outputfile, struct diff3_block *b, int filenum) { lin i; _Bool leading_dot = 0; for (i = 0; i < (((b)->ranges[filenum][1]) - ((b)->ranges[filenum][0]) + 1); i++) { char *line = ((b)->lines[filenum][i]); if (line[0] == '.') { leading_dot = 1; fputc_unlocked('.', outputfile); } fwrite_unlocked(line, sizeof(char), ((b)->lengths[filenum][i]), outputfile); } return leading_dot; }
int dotlines(void *a0, unsigned long long *a1, unsigned long a2) { char v0; void *v1; char *v2; v0 = 0; for (v1 = 0; v1 <= a1[2 + 2 * a2] - a1[1 + 2 * a2]; v1 += 1) { v2 = *((a1[7 + a2] + v1 * 8)); if (*(v2) == 46) { v0 = 1; fputc_unlocked(0x2e, a0); } fwrite_unlocked(v2, 0x1, *((a1[10 + a2] + v1 * 8)), a0); } return v0; }
diffutils
angr_phoenix
static _Bool compare_line_list(char *const list1[], size_t const lengths1[], char *const list2[], size_t const lengths2[], lin nl) { char *const *l1 = list1; char *const *l2 = list2; size_t const *lgths1 = lengths1; size_t const *lgths2 = lengths2; while (nl--) if (!*l1 || !*l2 || *lgths1 != *lgths2++ || memcmp(*l1++, *l2++, *lgths1++) != 0) return 0; return 1; }
int compare_line_list(unsigned long a0, unsigned long a1, unsigned long a2, unsigned long a3, unsigned long long a4) { unsigned long long v0; int tmp_15; int tmp_16; int tmp_25; int tmp_34; unsigned long v1; unsigned long v2; unsigned long v3; unsigned long long *v4; unsigned long long *v5; unsigned long long *v6; unsigned long long *v7; unsigned int v9; unsigned long v10; v3 = a0; v2 = a1; v1 = a2; v0 = a4; v4 = v3; v5 = v1; v6 = v2; v7 = a3; while (true) { v9 = v0; v0 -= 1; if (!v9) { v9 = 1; break; } if (!*(v4)) { LABEL_40181d: v9 = 0; break; } else { if (!*(v5)) goto LABEL_40181d; tmp_15 = v7; v7 += 1; if (!(*(v6) == *(tmp_15))) goto LABEL_40181d; tmp_16 = v6; v6 += 1; v10 = *(tmp_16); tmp_25 = v5; v5 += 1; tmp_34 = v4; v4 += 1; if (!(!memcmp(*(tmp_34), *(tmp_25), v10))) goto LABEL_40181d; } } return v9; }
diffutils
angr_phoenix
vi_history_word(EditLine *el, wint_t c __attribute__((__unused__))) { const wchar_t *wp = (((el)->el_flags & 0x040) ? hist_convert(el, 3, ((void *)0)) : ((((*(el)->el_history.fun)((el)->el_history.ref, &(el)->el_history.ev, 3, ((void *)0))) == -1) ? ((void *)0) : (el)->el_history.ev.str)); const wchar_t *wep, *wsp; int len; wchar_t *cp; const wchar_t *lim; if (wp == ((void *)0)) return 6; wep = wsp = ((void *)0); do { while (iswspace(*wp)) wp++; if (*wp == 0) break; wsp = wp; while (*wp && !iswspace(*wp)) wp++; wep = wp; } while ((!el->el_state.doingarg || --el->el_state.argument > 0) && *wp != 0); if (wsp == ((void *)0) || (el->el_state.doingarg && el->el_state.argument != 0)) return 6; cv_undo(el); len = (int)(wep - wsp); if (el->el_line.cursor < el->el_line.lastchar) el->el_line.cursor++; c_insert(el, len + 1); cp = el->el_line.cursor; lim = el->el_line.limit; if (cp < lim) *cp++ = ' '; while (wsp < wep && cp < lim) *cp++ = *wsp++; el->el_line.cursor = cp; el->el_map.current = el->el_map.key; return 4; }
long vi_history_word(long a1) { long v1; wint_t *v3; wint_t *v4; wint_t *v5; wint_t *v6; wint_t *v7; wint_t *v8; unsigned long v9; if ((*(_DWORD *)(a1 + 44) & 0x40) != 0) { v1 = hist_convert(a1, 3LL, 0LL); } else if ((*(unsigned int (**)(_QWORD, long, long, _QWORD))(a1 + 1152))( *(_QWORD *)(a1 + 1144), a1 + 1160, 3LL, 0LL) == -1) { v1 = 0LL; } else { v1 = *(_QWORD *)(a1 + 1168); } v5 = (wint_t *)v1; if (!v1) return 6LL; v7 = 0LL; v6 = 0LL; do { while (iswspace(*v5)) ++v5; if (!*v5) break; v7 = v5; while (*v5 && !iswspace(*v5)) ++v5; v6 = v5; if (*(_DWORD *)(a1 + 116)) { if ((int)--*(_DWORD *)(a1 + 120) <= 0) break; } } while (*v5); if (!v7 || *(_DWORD *)(a1 + 116) && *(_DWORD *)(a1 + 120)) return 6LL; cv_undo(a1); if (*(_QWORD *)(a1 + 88) < *(_QWORD *)(a1 + 96)) *(_QWORD *)(a1 + 88) += 4LL; c_insert(a1, (unsigned int)(v6 - v7) + 1); v8 = *(wint_t **)(a1 + 88); v9 = *(_QWORD *)(a1 + 104); if ((unsigned long)v8 < v9) { ++v8; **(_DWORD **)(a1 + 88) = 32; } while (v7 < v6 && (unsigned long)v8 < v9) { v3 = v7++; v4 = v8++; *v4 = *v3; } *(_QWORD *)(a1 + 88) = v8; *(_QWORD *)(a1 + 1024) = *(_QWORD *)(a1 + 1016); return 4LL; }
libedit
ida
void init_freeenv(char **e) { int n; for (n = 0; e[n]; n++) free(e[n]); free(e); }
void init_freeenv(unsigned long long *a0) { unsigned int v0; unsigned long long v2; for (v0 = 0; a0[v0]; v0 += 1) { free(a0[v0]); } v2 = free(a0); return; }
sysvinit
angr_sailr
int do_assignment(string) char *string; { WORD_DESC td; td.flags = (1 << 2); td.word = string; return do_assignment_internal(&td, 1); }
long long do_assignment(unsigned long a0, unsigned long a1, unsigned int a2, unsigned long long a3, unsigned long long a4, unsigned long long a5) { unsigned long v0; unsigned int v1; v1 = 4; v0 = a0; return do_assignment_internal(&v0, 0x1, a2, a3, a4, a5); }
bash
angr_dream
static int ext4_fc_handle_add_extent(e2fsck_t ctx, __u8 *val) { struct ext2fs_extent extent; struct ext4_fc_add_range add_range; ino_t ino; int ret = 0; memcpy(&add_range, val, sizeof(add_range)); ino = ((__u32)(__le32)(add_range.fc_ino)); ext4_fc_flush_extents(ctx, ino); ret = ext4_fc_read_extents(ctx, ino); if (ret) return ret; memset(&extent, 0, sizeof(extent)); ret = __errcode_to_errno(ext2fs_decode_extent(&extent, (void *)add_range.fc_ex, sizeof(add_range.fc_ex)), __func__, 814) ; if (ret) return ret; return ext4_add_extent_to_list(ctx, &ctx->fc_replay_state.fc_extent_list, &extent); }
ulong ext4_fc_handle_add_extent(long param_1, void *param_2) { uint uVar1; undefined8 uVar2; ulong uVar3; long in_FS_OFFSET; undefined local_48[32]; undefined4 local_28; undefined local_24[20]; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); memcpy(&local_28, param_2, 0x10); ext4_fc_flush_extents(param_1, local_28); uVar1 = ext4_fc_read_extents(param_1, local_28); if (uVar1 == 0) { memset(local_48, 0, 0x18); uVar2 = ext2fs_decode_extent(local_48, local_24, 0xc); uVar1 = __errcode_to_errno(uVar2, "ext4_fc_handle_add_extent", 0x32e); if (uVar1 == 0) { uVar3 = ext4_add_extent_to_list(param_1, param_1 + 0x3b0, local_48); } else { uVar3 = (ulong)uVar1; } } else { uVar3 = (ulong)uVar1; } if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) { __stack_chk_fail(); } return uVar3; }
e2fsprogs-1.46.5
ghidra
static int collapse_escapes(char const *strptr) { char *strout = xstrdup(strptr); _Bool backslash_at_end = 0; delims = strout; while (*strptr) { if (*strptr != '\\') *strout++ = *strptr++; else { switch (*++strptr) { case '0': *strout++ = '\0'; break; case 'b': *strout++ = '\b'; break; case 'f': *strout++ = '\f'; break; case 'n': *strout++ = '\n'; break; case 'r': *strout++ = '\r'; break; case 't': *strout++ = '\t'; break; case 'v': *strout++ = '\v'; break; case '\\': *strout++ = '\\'; break; case '\0': backslash_at_end = 1; goto done; default: *strout++ = *strptr; break; } strptr++; } } done: delim_end = strout; return backslash_at_end ? 1 : 0; }
undefined collapse_escapes(char *param_1) { char cVar1; int iVar2; char *local_20; char *local_10; delims = (char *)xstrdup(param_1); local_20 = param_1; local_10 = delims; do { while (true) { if (*local_20 == '\0') { delim_end = local_10; return 0; } if (*local_20 == '\\') break; *local_10 = *local_20; local_20 = local_20 + 1; local_10 = local_10 + 1; } cVar1 = local_20[1]; iVar2 = (int)cVar1; if (iVar2 < 0x77) { if (iVar2 < 0x5c) { if (cVar1 == '\0') { delim_end = local_10; return 1; } if (iVar2 != 0x30) goto switchD_001003a5_caseD_5d; *local_10 = '\0'; } else { switch (iVar2) { case 0x5c: *local_10 = '\\'; break; default: goto switchD_001003a5_caseD_5d; case 0x62: *local_10 = '\b'; break; case 0x66: *local_10 = '\f'; break; case 0x6e: *local_10 = '\n'; break; case 0x72: *local_10 = '\r'; break; case 0x74: *local_10 = '\t'; break; case 0x76: *local_10 = '\v'; } } } else { switchD_001003a5_caseD_5d: *local_10 = local_20[1]; } local_10 = local_10 + 1; local_20 = local_20 + 2; } while (true); }
coreutils
ghidra
void get_new_window_size(from_sig, rp, cp) int from_sig; int *rp, *cp; { struct winsize win; int tty; tty = (shell_tty != -1) ? shell_tty : fileno(stderr); if (tty >= 0 && (ioctl(tty, 0x5413, &win) == 0) && win.ws_row > 0 && win.ws_col > 0) { sh_set_lines_and_columns(win.ws_row, win.ws_col); if ((interactive_shell && no_line_editing == 0) || bash_readline_initialized) rl_set_screen_size(win.ws_row, win.ws_col); if (rp) *rp = win.ws_row; if (cp) *cp = win.ws_col; } }
long long get_new_window_size(unsigned long a0, unsigned int *a1, unsigned int *a2) { unsigned int v0; unsigned int v1; char v2; char v3; unsigned long v5; v0 = a0; if (shell_tty == -1) v5 = fileno(stderr); else v5 = shell_tty; v1 = v5; if (v1 >= 0 && !ioctl(v1, 0x5413) && *(&v2) && *(&v3)) { sh_set_lines_and_columns(*(&v2), *(&v3), *(&v3)); if (bash_readline_initialized || !no_line_editing && interactive_shell) rl_set_screen_size(*(&v2), *(&v3), *(&v3)); if (a1) *(a1) = *(&v2); if (a2) *(a2) = *(&v3); } return 0; }
bash
angr_dream
) { sshlog("servconf.c", __func__, 1005, 0, SYSLOG_LEVEL_DEBUG1, ((void *)0), "Can't match group at line %d " "because user %.100s does " "not exist", line, user); } else if (ga_init(pw->pw_name, pw->pw_gid) == 0) {
void sshlog(void) { halt_baddata(); }
openssh-portable
ghidra
static int check_history_control(line) char *line; { HIST_ENTRY *temp; int r; if (history_control == 0) return 1; if ((history_control & 0x01) && *line == ' ') return 0; if (history_control & 0x02) { using_history(); temp = previous_history(); r = (temp == 0 || ((temp->line)[0] == (line)[0] && strcmp(temp->line, line) == 0) == 0); using_history(); if (r == 0) return r; } return 1; }
int check_history_control(char *a0, unsigned long long a1, unsigned long long a2, unsigned long long a3, unsigned long long a4, unsigned long long a5) { unsigned int v0; char **v1; unsigned int v3; if (false) v3 = 1; if (*(a0) == 32) { v3 = 0; } else { if (false) { using_history(a0, a1, a2, a3, a4, a5); v1 = previous_history(a0, a1, a2, a3, a4, a5); if (v1) { if (*(*(v1)) == *(a0)) { v3 = strcmp(*(v1), a0); if (!v3) v3 = 1; } if (v3 || *(*(v1)) != *(a0)) v3 = 0; if (v3) v3 = 0; } if (!v1 || !v3) v3 = 1; v0 = v3; using_history(a0, a1, *(*(v1)), a3, a4, a5); v3 = v0; } v3 = 1; } return v3; }
bash
angr_dream
int sshbuf_find(const struct sshbuf *b, size_t start_offset, const void *s, size_t len, size_t *offsetp) { void *p; if (offsetp != ((void *)0)) *offsetp = 0; if (sshbuf_ptr(b) == ((void *)0)) return -1; if (start_offset > 0x8000000 || len > 0x8000000 || len == 0) return -10; if (start_offset > sshbuf_len(b) || start_offset + len > sshbuf_len(b)) return -3; if ((p = memmem(sshbuf_ptr(b) + start_offset, sshbuf_len(b) - start_offset, s, len)) == ((void *)0)) return -4; if (offsetp != ((void *)0)) *offsetp = (const u_char *)p - sshbuf_ptr(b); return 0; }
long long sshbuf_find(unsigned long long a0, unsigned long a1, void *a2, unsigned int a3, unsigned long long *a4) { unsigned long long v0; unsigned long long v3; unsigned long long v4; unsigned long long v5; if (a4) *(a4) = 0; if (!sshbuf_ptr(a0)) { v3 = 4294967295; } else { if (a1 <= 0x8000000 && a3 <= 0x8000000 && a3) { v4 = sshbuf_len(a0); if (a1 <= v4) { v5 = sshbuf_len(a0); if (a1 + a3 <= v5) { v0 = memmem(sshbuf_ptr(a0) + a1, sshbuf_len(a0) - a1, a2, a3); if (!v0) { v3 = 0xfffffffc; } else { if (a4) *(a4) = __subvdi3(v0, sshbuf_ptr(a0)); v3 = 0; } } } if (a1 + a3 > v5 || a1 > v4) v3 = 4294967293; } if (!a3 || a3 > 0x8000000 || a1 > 0x8000000) v3 = 4294967286; } return v3; }
openssh-portable
angr_dream
== grp) { fprintf(stderr, gettext("%s: group '%s' does not exist\n"), Prog, list); errors++; }
int fprintf(FILE *__stream, char *__format, ...) { halt_baddata(); }
shadow
ghidra
static void process_regexp(struct control *p, intmax_t repetition) { struct cstring *line; idx_t line_len; intmax_t break_line; _Bool ignore = p->ignore; regoff_t ret; if (!ignore) create_output_file(); if (p->offset >= 0) { while (1) { line = find_line(++current_line); if (line == ((void *)0)) { if (p->repeat_forever) { if (!ignore) { dump_rest_of_file(); close_output_file(); } exit(0); } else regexp_error(p, repetition, ignore); } line_len = line->len; if (line->str[line_len - 1] == '\n') line_len--; ret = re_search(&p->re_compiled, line->str, line_len, 0, line_len, ((void *)0)); if (ret == -2) { error(0, 0, gettext("error in regular expression search")); cleanup_fatal(); } if (ret == -1) { line = remove_line(); if (!ignore) save_line_to_file(line); } else break; } } else { while (1) { line = find_line(++current_line); if (line == ((void *)0)) { if (p->repeat_forever) { if (!ignore) { dump_rest_of_file(); close_output_file(); } exit(0); } else regexp_error(p, repetition, ignore); } line_len = line->len; if (line->str[line_len - 1] == '\n') line_len--; ret = re_search(&p->re_compiled, line->str, line_len, 0, line_len, ((void *)0)); if (ret == -2) { error(0, 0, gettext("error in regular expression search")); cleanup_fatal(); } if (ret != -1) break; } } break_line = current_line + p->offset; write_to_file(break_line, ignore, p->argnum); if (!ignore) close_output_file(); if (p->offset > 0) current_line = break_line; if (suppress_matched) remove_line(); }
void process_regexp(struct_0 *a0, unsigned long long a1) { char v0; unsigned int v1; unsigned long long v2; unsigned long long v3[2]; unsigned long v4; unsigned long long v6; unsigned long long v7; v0 = a0->field_1d; if ((v0 ^ 1)) create_output_file(); if (a0->field_0 < 0) { do { current_line = current_line + 1; v3[0] = find_line(current_line); if (!v3) { if (!a0->field_1c) regexp_error(a0, a1, v0); if ((v0 ^ 1)) { dump_rest_of_file(); close_output_file(); } exit(0x0); } v2 = v3[0]; if (*((v3[1] + v2 - 1)) == 10) v2 -= 1; v1 = re_search(&a0[1].field_0 + 2, v3[1], v2, 0x0, v2, 0x0); if (v1 == -2) { error(0x0, 0x0, gettext("error in regular expression search")); cleanup_fatal(); } } while (v1 == -1); } else { while (true) { current_line = current_line + 1; v3[0] = find_line(current_line); if (!v3) { if (!a0->field_1c) regexp_error(a0, a1, v0); if ((v0 ^ 1)) { dump_rest_of_file(); close_output_file(); } exit(0x0); } v2 = v3[0]; if (*((v3[1] + v2 - 1)) == 10) v2 -= 1; v1 = re_search(&a0[1].field_0 + 2, v3[1], v2, 0x0, v2, 0x0); if (v1 == -2) { error(0x0, 0x0, gettext("error in regular expression search")); cleanup_fatal(); } if (v1 != -1) break; v3 = remove_line(); if ((v0 ^ 1)) save_line_to_file(v3); } } v4 = current_line + a0->field_0; write_to_file(v4, v0, a0->field_18); if ((v0 ^ 1)) close_output_file(); if (a0->field_0 > 0) current_line = v4; v6 = suppress_matched; if (suppress_matched) v7 = remove_line(); return; }
coreutils
angr_phoenix
struct kex *kex_new(void) { struct kex *kex; if ((kex = calloc(1, sizeof(*kex))) == ((void *)0) || (kex->peer = sshbuf_new()) == ((void *)0) || (kex->my = sshbuf_new()) == ((void *)0) || (kex->client_version = sshbuf_new()) == ((void *)0) || (kex->server_version = sshbuf_new()) == ((void *)0) || (kex->session_id = sshbuf_new()) == ((void *)0)) { kex_free(kex); return ((void *)0); } return kex; }
long long kex_new() { unsigned long long v0[15]; void *v2; v0[0] = calloc(0x1, 0x870); if (v0) { v0[11] = sshbuf_new(); if (v0[11]) { v0[10] = sshbuf_new(); if (v0[10]) { v0[12] = sshbuf_new(); if (v0[12]) { v0[13] = sshbuf_new(); if (v0[13]) { v0[14] = sshbuf_new(); if (v0[14]) v2 = v0; } } } } } if (!v0 || !v0[10] || !v0[14] || !v0[11] || !v0[13] || !v0[12]) { kex_free(v0); v2 = 0; } return v2; }
openssh-portable
angr_dream
void print_arith_command(arith_cmd_list) WORD_LIST *arith_cmd_list; { cprintf("(("); command_print_word_list(arith_cmd_list, " "); cprintf("))"); }
void print_arith_command(unsigned long long a0) { unsigned long long v1; cprintf("(("); command_print_word_list(a0, " "); v1 = cprintf("))"); return; }
bash
angr_dream
static inline void emit_mandatory_arg_note(void) { fputs_unlocked(gettext("\nMandatory arguments to long options are mandatory " "for short options too.\n"), stdout) ; }
void emit_mandatory_arg_note(void) { char *__s; FILE *__stream; __stream = stdout; __s = (char *)gettext("\nMandatory arguments to long options are mandatory " "for short options too.\n"); fputs_unlocked(__s, __stream); return; }
coreutils
ghidra
static inline int frh_get_table(struct fib_rule_hdr *frh, struct rtattr **tb) { __u32 table = frh->table; if (tb[RTA_TABLE]) table = rta_getattr_u32(tb[RTA_TABLE]); return table; }
long frh_get_table(long a1, long a2) { unsigned int v3; v3 = *(unsigned char *)(a1 + 4); if (*(_QWORD *)(a2 + 120)) return (unsigned int)rta_getattr_u32(*(_QWORD *)(a2 + 120)); return v3; }
iproute2-6.0.0
ida
static _Bool audit_status(struct pkginfo *pkg, const struct audit_problem *problem) { if (pkg->eflag & PKG_EFLAG_REINSTREQ) return 0; return (int)pkg->status == problem->value.number; }
long long audit_status(unsigned int a0[7], struct_0 *a1) { void *v1; if ((a0[5] & 1)) { v1 = 0; } else { v1 = a1->field_8; *(&v1) = a0[6] == a1->field_8; } return v1; }
dpkg
angr_phoenix
static int ipvrf_identify(int argc, char **argv) { char vrf[32]; int rc; unsigned int pid; if (argc < 1) pid = getpid(); else if (argc > 1) invarg("Extra arguments specified\n", argv[1]); else if (get_unsigned(&pid, argv[0], 10)) invarg("Invalid pid\n", argv[0]); rc = vrf_identify(pid, vrf, sizeof(vrf)); if (!rc) { if (vrf[0] != '\0') printf("%s\n", vrf); } else { fprintf(stderr, "Failed to lookup vrf association: %s\n", strerror((*__errno_location()))); } return rc; }
void ipvrf_identify(unsigned long a0, unsigned long long a1[2]) { unsigned int v0; unsigned int v1; char v2; unsigned long long v4; if (a0 <= 0) { v0 = getpid(); } else { if (a0 > 1) invarg("Extra arguments specified\n", a1[1]); if (get_unsigned(&v0, a1[0], 0xa, a1[0])) invarg("Invalid pid\n", a1[0]); } v1 = vrf_identify(v0, &v2, 0x20); if (v1) { fprintf(stderr, "Failed to lookup vrf association: %s\n", strerror(*(__errno_location()))); } else if (v2) { printf("%s\n", &v2); } v4 = v1; return; }
iproute2-6.0.0
angr_phoenix
SHELL_VAR **all_array_variables() { return (vapply(visible_array_vars)); }
void *all_array_variables() { return vapply((long (*)(const char **))visible_array_vars); }
bash
ida
int do_iptoken(int argc, char **argv) { ll_init_map(&rth); if (argc < 1) { return iptoken_list(0, ((void *)0)); } else if (matches(argv[0], "list") == 0 || matches(argv[0], "lst") == 0 || matches(argv[0], "show") == 0) { return iptoken_list(argc - 1, argv + 1); } else if (matches(argv[0], "set") == 0 || matches(argv[0], "add") == 0) { return iptoken_set(argc - 1, argv + 1, 0); } else if (matches(argv[0], "delete") == 0) { return iptoken_set(argc - 1, argv + 1, 1); } else if (matches(argv[0], "get") == 0) { return iptoken_list(argc - 1, argv + 1); } else if (matches(argv[0], "help") == 0) usage(); fprintf(stderr, "Command \"%s\" is unknown, try \"ip token help\".\n", *argv); exit(-1); }
long do_iptoken(int a1, const char **a2) { ll_init_map(&rth); if (a1 <= 0) return iptoken_list(0, 0LL); if ((unsigned char)matches(*a2, "list") == 1 && (unsigned char)matches(*a2, "lst") == 1 && (unsigned char)matches(*a2, "show") == 1) { if ((unsigned char)matches(*a2, "set") != 1 || (unsigned char)matches(*a2, "add") != 1) return iptoken_set(a1 - 1, a2 + 1, 0); if ((unsigned char)matches(*a2, "delete") != 1) return iptoken_set(a1 - 1, a2 + 1, 1); if ((unsigned char)matches(*a2, "get") == 1) { if ((unsigned char)matches(*a2, "help") != 1) usage(); fprintf(stderr, "Command \"%s\" is unknown, try \"ip token help\".\n", *a2); exit(-1); } } return iptoken_list(a1 - 1, a2 + 1); }
iproute2-6.0.0
ida
static int execute_select_command(select_command) SELECT_COM *select_command; { WORD_LIST *releaser, *list; SHELL_VAR *v; char *identifier, *ps3_prompt, *selection; int retval, list_len, show_menu, save_line_number; if (check_identifier(select_command->name, 1) == 0) return (1); save_line_number = line_number; line_number = select_command->line; command_string_index = 0; print_select_command_head(select_command); if (echo_command_at_execute) xtrace_print_select_command_head(select_command); if (signal_in_progress((64 + 1)) == 0 && running_trap == 0) { do { if (the_printed_command_except_trap) sh_xfree((the_printed_command_except_trap), "execute_cmd.c", 3415); } while (0); the_printed_command_except_trap = (char *)strcpy( sh_xmalloc((1 + strlen(the_printed_command)), "execute_cmd.c", 3416), (the_printed_command)); } retval = run_debug_trap(); if (debugging_mode && retval != 0) return (0); this_command_name = (char *)0; loop_level++; identifier = select_command->name->word; list = releaser = expand_words_no_vars(select_command->map_list); list_len = list_length(list); if (list == 0 || list_len == 0) { if (list) dispose_words(list); line_number = save_line_number; return (0); } begin_unwind_frame("select"); add_unwind_protect(dispose_words, releaser); if (select_command->flags & 0x08) select_command->action->flags |= 0x08; retval = 0; show_menu = 1; while (1) { line_number = select_command->line; ps3_prompt = get_string_value("PS3"); if (ps3_prompt == 0) ps3_prompt = "#? "; do { if (terminating_signal) termsig_handler(terminating_signal); if (interrupt_state) throw_to_top_level(); } while (0); selection = select_query(list, list_len, ps3_prompt, show_menu); do { if (terminating_signal) termsig_handler(terminating_signal); if (interrupt_state) throw_to_top_level(); } while (0); if (selection == 0) { retval = 1; break; } v = bind_variable(identifier, selection, 0); if (v == 0 || ((((v)->attributes) & (0x0000002))) || ((((v)->attributes) & (0x0004000)))) { if (v && ((((v)->attributes) & (0x0000002))) && interactive_shell == 0 && posixly_correct) { last_command_exit_value = 1; jump_to_top_level(1); } else { dispose_words(releaser); discard_unwind_frame("select"); loop_level--; line_number = save_line_number; return (1); } } stupidly_hack_special_variables(identifier); retval = execute_command(select_command->action); do { if (job_control == 0 || interactive_shell == 0) reap_dead_jobs(); } while (0); do { if (terminating_signal) termsig_handler(terminating_signal); if (interrupt_state) throw_to_top_level(); } while (0); if (breaking) { breaking--; break; } if (continuing) { continuing--; if (continuing) break; } show_menu = 0; selection = get_string_value("REPLY"); if (selection && *selection == '\0') show_menu = 1; } loop_level--; line_number = save_line_number; dispose_words(releaser); discard_unwind_frame("select"); return (retval); }
long long execute_select_command(struct_0 *a0, unsigned int a1, unsigned long a2, unsigned int a3, unsigned int a4, unsigned long long a5) { unsigned int v0; unsigned int v1; unsigned int v2; unsigned int v3; unsigned long long v4; unsigned long long v5; unsigned long long v6; unsigned long long v7; char *v8; struct_3 *v9; unsigned long long v11; if (!check_identifier(a0->field_8, 0x1)) { v11 = 1; } else { v2 = line_number; line_number = a0->field_4; command_string_index = 0; print_select_command_head(a0); if (echo_command_at_execute) xtrace_print_select_command_head(a0); if (!signal_in_progress(0x41) && !running_trap) { sh_xfree(0xbaec7d8920ec8348, "execute_cmd.c", 0xd57); this_shell_function = strcpy( sh_xmalloc(strlen(the_printed_command) + 1, "execute_cmd.c", 0xd58), the_printed_command); } v0 = run_debug_trap(); if (debugging_mode && v0) { v11 = 0; goto LABEL_405e3d; } this_shell_function = 0; loop_level = loop_level + 1; v5 = a0->field_8->field_0; v6 = expand_words_no_vars(a0->field_10); v7 = v6; v3 = list_length(v7); if (!v7) { LABEL_405b4f: if (v7) dispose_words(v7); line_number = v2; v11 = 0; } else { if (!v3) goto LABEL_405b4f; begin_unwind_frame("select"); add_unwind_protect(got.dispose_words, v6); if ((a0->field_0 & 8)) a0->field_18->field_4 = a0->field_18->field_4 | 8; v0 = 0; v1 = 1; while (true) { line_number = a0->field_4; v4 = get_string_value("PS3"); if (!v4) v4 = "#? "; if (terminating_signal) termsig_handler(terminating_signal); if (interrupt_state) throw_to_top_level(); v8 = select_query(v7, v3, v4, v1); if (terminating_signal) termsig_handler(terminating_signal); if (interrupt_state) throw_to_top_level(); if (!v8) { v0 = 1; goto LABEL_405e0a; } v9 = bind_variable(v5, v8, 0x0, v8); if (!v9) { LABEL_405cb9: if (v9 && (v9->field_28 & 2) && !interactive_shell && posixly_correct) { line_number_for_err_trap = 1; jump_to_top_level(0x1); } dispose_words(v6); discard_unwind_frame("select"); loop_level = loop_level - 1; line_number = v2; v11 = 1; break; } else { if (!(!(v9->field_28 & 2))) goto LABEL_405cb9; if (!(!(v9->field_28 & 0x4000))) goto LABEL_405cb9; stupidly_hack_special_variables(v5); v0 = execute_command(a0->field_18, a1, 0x0, a3, a4, a5); if (job_control && !(!interactive_shell)) goto LABEL_405d68; reap_dead_jobs(); LABEL_405d68: if (terminating_signal) termsig_handler(terminating_signal); if (interrupt_state) throw_to_top_level(); if (!breaking) { if (continuing) { continuing = continuing - 1; if (!(!continuing)) goto LABEL_405e0a; } v1 = 0; v8 = get_string_value("REPLY"); if (v8 && !*(v8)) v1 = 1; } else { breaking = breaking - 1; LABEL_405e0a: loop_level = loop_level - 1; line_number = v2; dispose_words(v6); discard_unwind_frame("select"); v11 = v0; break; } } } } } LABEL_405e3d: return v11; }
bash
angr_phoenix
static int identity_sign(struct identity *id, u_char **sigp, size_t *lenp, const u_char *data, size_t datalen, u_int compat, const char *alg) { struct sshkey *sign_key = ((void *)0), *prv = ((void *)0); int is_agent = 0, retried = 0, r = -1; struct notifier_ctx *notifier = ((void *)0); char *fp = ((void *)0), *pin = ((void *)0), *prompt = ((void *)0); *sigp = ((void *)0); *lenp = 0; if (id->key != ((void *)0) && id->agent_fd != -1) { return ssh_agent_sign(id->agent_fd, id->key, sigp, lenp, data, datalen, alg, compat); } if (id->key != ((void *)0) && (id->isprivate || (id->key->flags & 0x0001))) { sign_key = id->key; is_agent = 1; } else { if ((prv = load_identity_file(id)) == ((void *)0)) return -46; if (id->key != ((void *)0) && !sshkey_equal_public(prv, id->key)) { sshlog("sshconnect2.c", __func__, 1269, 1, SYSLOG_LEVEL_ERROR, ((void *)0), "private key %s contents do not match public", id->filename); r = -46; goto out; } sign_key = prv; } retry_pin: if (!is_agent && sshkey_is_sk(sign_key) && (sign_key->sk_flags & 0x01)) { if ((fp = sshkey_fingerprint(sign_key, options.fingerprint_hash, SSH_FP_DEFAULT)) == ((void *)0)) sshfatal("sshconnect2.c", __func__, 1283, 1, SYSLOG_LEVEL_FATAL, ((void *)0), "fingerprint failed"); notifier = notify_start(options.batch_mode, "Confirm user presence for key %s %s", sshkey_type(sign_key), fp); free(fp); } if ((r = sshkey_sign(sign_key, sigp, lenp, data, datalen, alg, options.sk_provider, pin, compat)) != 0) { sshlog("sshconnect2.c", __func__, 1291, 1, SYSLOG_LEVEL_DEBUG1, ssh_err(r), "sshkey_sign"); if (!retried && pin == ((void *)0) && !is_agent && sshkey_is_sk(sign_key) && r == -43) { notify_complete(notifier, ((void *)0)); notifier = ((void *)0); xasprintf(&prompt, "Enter PIN for %s key %s: ", sshkey_type(sign_key), id->filename); pin = read_passphrase(prompt, 0); retried = 1; goto retry_pin; } goto out; } if ((r = sshkey_check_sigtype(*sigp, *lenp, alg)) != 0) { sshlog("sshconnect2.c", __func__, 1311, 1, SYSLOG_LEVEL_DEBUG1, ssh_err(r), "sshkey_check_sigtype"); goto out; } r = 0; out: free(prompt); if (pin != ((void *)0)) freezero(pin, strlen(pin)); notify_complete(notifier, r == 0 ? "User presence confirmed" : ((void *)0)); sshkey_free(prv); return r; }
int identity_sign(struct_0 *a0, unsigned long long *a1, unsigned long long a2, unsigned long long a3, unsigned long long a4, unsigned long a5, unsigned long long v16) { unsigned long v0; unsigned long long v1; unsigned long long *v2; unsigned int v3; unsigned int v4; unsigned int v5; void *v6; struct_1 *v7; unsigned long long v8; void *v9; void *v10; void *v11; unsigned long v12; void *v13; unsigned long long v14; char v15; unsigned int v17; unsigned long long v18; v2 = a2; v1 = v16; v7 = 0; v8 = 0; v3 = 0; v4 = 0; v5 = -1; v9 = 0; v11 = 0; v10 = 0; v6 = 0; *(a1) = 0; *(v2) = 0; if (a0->field_18 && a0->field_10 != -1) { v0 = a5; v17 = ssh_agent_sign(a0->field_10, a0->field_18, a1, v2, a3, a4, v1); goto LABEL_402d89; } if (!a0->field_18) { LABEL_4029ee: v8 = load_identity_file(a0); if (!v8) { v17 = -46; goto LABEL_402d89; } if (a0->field_18 && !sshkey_equal_public(v8, a0->field_18, a0->field_18)) { v0 = a0->field_20; sshlog("sshconnect2.c", "identity_sign", 0x4f5, 0x1, 0x2, 0x0, "private key %s contents do not match public"); v5 = -46; goto LABEL_402d21; } v7 = v8; while (true) { LABEL_402a8e: if (!v3 && sshkey_is_sk(v7) && (v7->field_68 & 1)) { v11 = sshkey_fingerprint(v7, *(5248728), 0x0, *(5248728)); if (!v11) { v14 = "fingerprint failed"; sshfatal("sshconnect2.c", "identity_sign", 0x503, 0x1, 0x1, 0x0); } v9 = notify_start(sshkey_ecdsa_nid_from_name, "Confirm user presence for key %s %s", sshkey_type(v7), v11); free(v11); } v14 = a5; v13 = v10; v12 = __errno_location; v5 = sshkey_sign(v7, a1, v2, a3, a4, v1, *(&v15), v16); if (!v5) { v5 = sshkey_check_sigtype(*(a1), *(v2), v1, *(v2)); if (!v5) { v5 = 0; break; } else { v14 = "sshkey_check_sigtype"; sshlog("sshconnect2.c", "identity_sign", 0x51f, 0x1, 0x5, ssh_err(v5), *(&v15)); break; } } v14 = "sshkey_sign"; sshlog("sshconnect2.c", "identity_sign", 0x50b, 0x1, 0x5, ssh_err(v5), *(&v15)); if (v4) { LABEL_402d20: break; } else { if (!(!v10)) goto LABEL_402d20; if (!(!v3)) goto LABEL_402d20; if (!sshkey_is_sk(v7)) goto LABEL_402d20; if (!(v5 == -43)) goto LABEL_402d20; notify_complete(v9, 0x0); v9 = 0; xasprintf(&v6, "Enter PIN for %s key %s: ", sshkey_type(v7), a0->field_20, 0x5); v10 = read_passphrase(v6, 0x0); v4 = 1; } } LABEL_402d21: free(v6); if (v10) { v17 = strlen(v10); freezero(v10, v17, v17); } if (!v5) v18 = "User presence confirmed"; else v18 = 0; notify_complete(v9, v18); sshkey_free(v8); v17 = v5; } else { if (!a0->field_2c && !(a0->field_18->field_4 & 1)) goto LABEL_4029ee; v7 = a0->field_18; v3 = 1; goto LABEL_402a8e; } LABEL_402d89: return v17; }
openssh-portable
angr_phoenix
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 long v0; unsigned long long v1[2]; char *v2; unsigned long long v3; unsigned long long v4; unsigned long long v5; unsigned long long v6; unsigned long long v7; unsigned long long v8; unsigned long long v9; unsigned long long v10; unsigned long long v11; unsigned long long v12; unsigned long long v13; unsigned long long v14; unsigned long long v15; void *v16; void *v17; char v18; unsigned long long v20; unsigned long long *v21; unsigned long long v22; v4 = "["; v5 = "test invocation"; v6 = "coreutils"; v7 = "Multi-call invocation"; v8 = "sha224sum"; v9 = "sha2 utilities"; v10 = "sha256sum"; v11 = "sha2 utilities"; v12 = "sha384sum"; v13 = "sha2 utilities"; v14 = "sha512sum"; v15 = "sha2 utilities"; v16 = 0; v17 = 0; v0 = a0; v1[0] = &v4; while (true) { if (!v1[0]) break; if (!strcmp(a0, v1[0])) break; v1[0] = v1 + 1; } if (v1[1]) v0 = v1[1]; printf(gettext("\n%s online help: <%s>\n")); v2 = setlocale(0x5, NULL); if (v2 && strncmp(v2, "en_", 0x3)) fputs_unlocked(gettext("Report any translation bugs to <https: if (!strcmp(a0, "[")) v20 = "test"; else v20 = a0; v3 = v20; printf(gettext("Full documentation <%s%s>\n")); printf(gettext("or available locally via: info '(coreutils) %s%s'\n")); v22 = *(&v18) ^ v21[5]; return; }
coreutils
angr_phoenix
static int insert_serial_range(struct revoked_serial_tree *rt, u_int64_t lo, u_int64_t hi) { struct revoked_serial rs, *ers, *crs, *irs; ; memset(&rs, 0, sizeof(rs)); rs.lo = lo; rs.hi = hi; ers = revoked_serial_tree_RB_NFIND(rt, &rs); if (ers == ((void *)0) || serial_cmp(ers, &rs) != 0) { if ((irs = malloc(sizeof(rs))) == ((void *)0)) return -2; memcpy(irs, &rs, sizeof(*irs)); ers = revoked_serial_tree_RB_INSERT(rt, irs); if (ers != ((void *)0)) { ; free(irs); return -1; } ers = irs; } else { ; if (ers->lo > lo) ers->lo = lo; if (ers->hi < hi) ers->hi = hi; } while ((crs = revoked_serial_tree_RB_PREV(ers)) != ((void *)0)) { ; if (ers->lo != 0 && crs->hi < ers->lo - 1) break; if (crs->lo < ers->lo) { ers->lo = crs->lo; ; } revoked_serial_tree_RB_REMOVE(rt, crs); free(crs); } while ((crs = revoked_serial_tree_RB_NEXT(ers)) != ((void *)0)) { ; if (ers->hi != (u_int64_t)-1 && crs->lo > ers->hi + 1) break; if (crs->hi > ers->hi) { ers->hi = crs->hi; ; } revoked_serial_tree_RB_REMOVE(rt, crs); free(crs); }; return 0; }
void insert_serial_range(unsigned long long *a0, unsigned long a1, unsigned long a2) { unsigned long long v0[2]; void *v1; unsigned long long v2[2]; unsigned long v3; unsigned long v4; unsigned long long v6; unsigned long long v7; void *v8; memset(&v3, 0x0, 0x30); v3 = a1; v4 = a2; v0[0] = revoked_serial_tree_RB_NFIND(a0, &v3); if (!v0) { LABEL_403a79: v1 = malloc(0x30); if (!v1) { v6 = 4294967294; goto LABEL_403c2f; } memcpy(v1, &v3, 0x30); v0 = revoked_serial_tree_RB_INSERT(a0, v1); if (!v0) { v0 = v1; goto LABEL_403b20; } else { free(v1); v7 = 4294967295; } } else { if (!(!serial_cmp(v0, &v3))) goto LABEL_403a79; if (a1 < v0[0]) v0[0] = a1; if (a2 <= v0[1]) goto LABEL_403b86; v0[1] = a2; LABEL_403b20: while (true) { LABEL_403b86: v2[0] = revoked_serial_tree_RB_PREV(v0); if (!v2) break; if (v0[0] && v2[1] < v0[0] - 1) break; if (v2[0] < v0[0]) v0[0] = v2[0]; revoked_serial_tree_RB_REMOVE(a0, v2); free(v2); } while (true) { v2[0] = revoked_serial_tree_RB_NEXT(v0); if (!v2) break; if (v0[1] != -1 && v2[0] > v0[1] + 1) break; if (v2[1] > v0[1]) v0[1] = v2[1]; revoked_serial_tree_RB_REMOVE(a0, v2); free(v2); } v8 = 0; } LABEL_403c2f: return; }
openssh-portable
angr_phoenix
static _Bool portable_chars_only(char const *file, size_t filelen) { size_t validlen = strspn(file, ("/" "ABCDEFGHIJKLMNOPQRSTUVWXYZ" "abcdefghijklmnopqrstuvwxyz" "0123456789._-")); char const *invalid = file + validlen; if (*invalid) { mbstate_t mbstate = { 0, }; size_t charlen = rpl_mbrlen(invalid, filelen - validlen, &mbstate); error(0, 0, gettext("nonportable character %s in file name %s"), quotearg_n_style_mem(1, locale_quoting_style, invalid, (charlen <= 16 ? charlen : 1)), quotearg_n_style(0, shell_escape_always_quoting_style, file)); return 0; } return 1; }
int portable_chars_only(char *a0, unsigned long a1) { unsigned long v0; char *v1; unsigned long v2; void *v3; unsigned int v5; unsigned long long v6; unsigned long long v7; v0 = strspn( a0, "/ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789._-"); v1 = &a0[v0]; if (!*(v1)) { v5 = 1; return v5; } v3 = 0; v2 = rpl_mbrlen(v1, a1 - v0, &v3, a1 - v0); v6 = quotearg_n_style(0x0, 0x4, a0); v5 = (v2 <= 16 ? 1 : v2); v7 = quotearg_n_style_mem(0x1, 0x8, v1, v5); error(0x0, 0x0, gettext("nonportable character %s in file name %s")); v5 = 0; return v5; }
coreutils
angr_sailr
void chan_write_failed(struct ssh *ssh, Channel *c) { sshlog("nchan.c", __func__, 310, 0, SYSLOG_LEVEL_DEBUG2, ((void *)0), "channel %d: write failed", c->self); switch (c->ostate) { case 0: case 1: chan_shutdown_write(ssh, c); if (strcmp(c->ctype, "session") == 0) chan_send_eow2(ssh, c); chan_set_ostate(c, 3); break; default: sshlog("nchan.c", __func__, 320, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "channel %d: chan_write_failed for ostate %d", c->self, c->ostate); break; } }
long long chan_write_failed(void *a0, struct_0 *a1) { unsigned long long v1; sshlog("nchan.c", "chan_write_failed", 0x136, 0x0, 0x6, 0x0, "channel %d: write failed", a1->field_4, a1); if (a1->field_14 > 1) { v1 = sshlog("nchan.c", "chan_write_failed", 0x140, 0x0, 0x2, 0x0, "channel %d: chan_write_failed for ostate %d", a1->field_4, a1->field_14); } else { chan_shutdown_write(a0, a1); if (!strcmp(a1->field_c8, "session")) chan_send_eow2(a0, a1); v1 = chan_set_ostate(a1, 0x3); } return v1; }
openssh-portable
angr_phoenix
static void yespackage(const char *awname) { trigdef_update_printf(" %s", awname); }
long yespackage(const char *a1) { return trigdef_update_printf(" %s", a1); }
dpkg
ida
int sshbuf_put_eckey(struct sshbuf *buf, const EC_KEY *v) { return sshbuf_put_ec(buf, EC_KEY_get0_public_key(v), EC_KEY_get0_group(v)); }
long long sshbuf_put_eckey(unsigned long long a0, unsigned long long a1) { return sshbuf_put_ec(a0, EC_KEY_get0_public_key(a1), EC_KEY_get0_group(a1)); }
openssh-portable
angr_dream
void _rl_enable_paren_matching(int on_or_off) { if (on_or_off) { rl_bind_key_in_map(')', rl_insert_close, emacs_standard_keymap); rl_bind_key_in_map(']', rl_insert_close, emacs_standard_keymap); rl_bind_key_in_map('}', rl_insert_close, emacs_standard_keymap); rl_bind_key_in_map(')', rl_insert_close, vi_insertion_keymap); rl_bind_key_in_map(']', rl_insert_close, vi_insertion_keymap); rl_bind_key_in_map('}', rl_insert_close, vi_insertion_keymap);
long long _rl_enable_paren_matching(unsigned long a0) { unsigned long long v1; if (!a0) { rl_bind_key_in_map(0x29, got.rl_insert, 0x500000); rl_bind_key_in_map(0x5d, got.rl_insert, 0x500000); rl_bind_key_in_map(0x7d, got.rl_insert, 0x500000); rl_bind_key_in_map(0x29, got.rl_insert, 0x500010); rl_bind_key_in_map(0x5d, got.rl_insert, 0x500010); v1 = rl_bind_key_in_map(0x7d, got.rl_insert, 0x500010); } else { rl_bind_key_in_map(0x29, rl_insert_close, 0x500000); rl_bind_key_in_map(0x5d, rl_insert_close, 0x500000); rl_bind_key_in_map(0x7d, rl_insert_close, 0x500000); rl_bind_key_in_map(0x29, rl_insert_close, 0x500010); rl_bind_key_in_map(0x5d, rl_insert_close, 0x500010); v1 = rl_bind_key_in_map(0x7d, rl_insert_close, 0x500010); } return v1; }
bash
angr_phoenix
int channel_request_remote_forwarding(struct ssh *ssh, struct Forward *fwd) { int r, success = 0, idx = -1; char *host_to_connect, *listen_host, *listen_path; int port_to_connect, listen_port; if (fwd->listen_path != ((void *)0)) { if ((r = sshpkt_start(ssh, 80)) != 0 || (r = sshpkt_put_cstring(ssh, "streamlocal-forward@openssh.com")) != 0 || (r = sshpkt_put_u8(ssh, 1)) != 0 || (r = sshpkt_put_cstring(ssh, fwd->listen_path)) != 0 || (r = sshpkt_send(ssh)) != 0 || (r = ssh_packet_write_wait(ssh)) != 0) sshfatal("channels.c", __func__, 4096, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "request streamlocal"); } else { if ((r = sshpkt_start(ssh, 80)) != 0 || (r = sshpkt_put_cstring(ssh, "tcpip-forward")) != 0 || (r = sshpkt_put_u8(ssh, 1)) != 0 || (r = sshpkt_put_cstring( ssh, channel_rfwd_bind_host(fwd->listen_host))) != 0 || (r = sshpkt_put_u32(ssh, fwd->listen_port)) != 0 || (r = sshpkt_send(ssh)) != 0 || (r = ssh_packet_write_wait(ssh)) != 0) sshfatal("channels.c", __func__, 4106, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "request tcpip-forward"); } success = 1; if (success) { host_to_connect = listen_host = listen_path = ((void *)0); port_to_connect = listen_port = 0; if (fwd->connect_path != ((void *)0)) { host_to_connect = xstrdup(fwd->connect_path); port_to_connect = -2; } else { host_to_connect = xstrdup(fwd->connect_host); port_to_connect = fwd->connect_port; } if (fwd->listen_path != ((void *)0)) { listen_path = xstrdup(fwd->listen_path); listen_port = -2; } else { if (fwd->listen_host != ((void *)0)) listen_host = xstrdup(fwd->listen_host); listen_port = fwd->listen_port; } idx = permission_set_add(ssh, 0x101, (1 << 1), host_to_connect, port_to_connect, listen_host, listen_path, listen_port, ((void *)0)); } return idx; }
long channel_request_remote_forwarding(long a1, _QWORD *a2) { long v2; const char *v3; long v4; long result; unsigned int v6; unsigned int v7; int v8; long v9; long v10; long v11; if (a2[2]) { v6 = sshpkt_start(a1, 80LL); if (!v6) { v6 = sshpkt_put_cstring(a1, "streamlocal-forward@openssh.com"); if (!v6) { v6 = sshpkt_put_u8(a1, 1LL); if (!v6) { v6 = sshpkt_put_cstring(a1, a2[2]); if (!v6) { v6 = sshpkt_send(a1); if (!v6) { v6 = ssh_packet_write_wait(a1); if (!v6) goto LABEL_17; } } } } } v2 = ssh_err(v6); sshfatal("channels.c", "channel_request_remote_forwarding", 4096LL, 1LL, 1LL, v2, "request streamlocal"); } v7 = sshpkt_start(a1, 80LL); if (v7 || (v7 = sshpkt_put_cstring(a1, "tcpip-forward")) != 0 || (v7 = sshpkt_put_u8(a1, 1LL)) != 0 || (v3 = channel_rfwd_bind_host((const char *)*a2), (v7 = sshpkt_put_cstring(a1, v3)) != 0) || (v7 = sshpkt_put_u32(a1, *((unsigned int *)a2 + 2))) != 0 || (v7 = sshpkt_send(a1)) != 0 || (v7 = ssh_packet_write_wait(a1)) != 0) { v4 = ssh_err(v7); sshfatal("channels.c", "channel_request_remote_forwarding", 4106LL, 1LL, 1LL, v4, "request tcpip-forward"); } LABEL_17: v10 = 0LL; if (a2[5]) { v9 = xstrdup(a2[5]); v8 = -2; } else { v9 = xstrdup(a2[3]); v8 = *((_DWORD *)a2 + 8); } if (a2[2]) { v11 = xstrdup(a2[2]); LODWORD(result) = permission_set_add(a1, 0x101u, 2u, v9, v8, 0LL, v11, -2, 0LL); } else { if (*a2) v10 = xstrdup(*a2); LODWORD(result) = permission_set_add(a1, 0x101u, 2u, v9, v8, v10, 0LL, *((_DWORD *)a2 + 2), 0LL); } return (unsigned int)result; }
openssh-portable
ida
_Bool pred_fls (const char *pathname, struct stat *stat_buf, struct predicate *pred_ptr) { FILE *stream = pred_ptr->args.printf_vec.stream; list_file(pathname, state.cwd_dir_fd, state.rel_pathname, stat_buf, options.start_time.tv_sec, options.output_block_size, pred_ptr->literal_control_chars, stream); return 1; }
long pred_fls(long a1, long a2, long a3) { list_file(a1, LODWORD(state[3]), state[2], a2, options[3], HIDWORD(options[7]), *(unsigned char *)(a3 + 40), *(_QWORD *)(a3 + 64)); return 1LL; }
findutils
ida
ARRAY *array_from_argv(a, vec, count) ARRAY *a; char **vec; int count; { arrayind_t i; ARRAY_ELEMENT *ae; char *t; if (a == 0 || ((a)->num_elements) == 0) { for (i = 0; i < count; i++) array_insert(a, i, t); return a; } if (((a)->num_elements) == count && count == 1) { ae = ((a->head)->next); t = vec[0] ? (char *)strcpy( sh_xmalloc((1 + strlen(vec[0])), "array.c", 878), (vec[0])) : 0; do { sh_xfree(((ae)->value), "array.c", 879); (ae)->value = (t); } while (0); } else if (((a)->num_elements) <= count) { ae = a->head; for (i = 0; i < ((a)->num_elements); i++) { ae = ((ae)->next); t = vec[0] ? (char *)strcpy(sh_xmalloc((1 + strlen(vec[0])), "array.c", 888), (vec[0])) : 0; do { sh_xfree(((ae)->value), "array.c", 889); (ae)->value = (t); } while (0); } for (; i < count; i++) array_insert(a, i, vec[i]); } else { array_flush(a); for (i = 0; i < count; i++) array_insert(a, i, vec[i]); } return a; }
long array_from_argv(long param_1, char **param_2, int param_3) { long lVar1; size_t sVar2; char *pcVar3; char *pcVar4; long local_30; long local_28; undefined8 local_20; if ((param_1 == 0) || (*(long *)(param_1 + 8) == 0)) { for (local_30 = 0; local_30 < param_3; local_30 = local_30 + 1) { array_insert(param_1, local_30, local_20); } } else if ((*(long *)(param_1 + 8) == (long)param_3) && (param_3 == 1)) { lVar1 = *(long *)(*(long *)(param_1 + 0x10) + 0x10); if (*param_2 == (char *)0x0) { pcVar4 = (char *)0x0; } else { pcVar4 = *param_2; sVar2 = strlen(*param_2); pcVar3 = (char *)sh_xmalloc(sVar2 + 1, "array.c", 0x36e); pcVar4 = strcpy(pcVar3, pcVar4); } sh_xfree(*(undefined8 *)(lVar1 + 8), "array.c", 0x36f); *(char **)(lVar1 + 8) = pcVar4; } else if ((long)param_3 < *(long *)(param_1 + 8)) { array_flush(param_1); for (local_30 = 0; local_30 < param_3; local_30 = local_30 + 1) { array_insert(param_1, local_30, param_2[local_30]); } } else { local_28 = *(long *)(param_1 + 0x10); for (local_30 = 0; local_30 < *(long *)(param_1 + 8); local_30 = local_30 + 1) { local_28 = *(long *)(local_28 + 0x10); if (*param_2 == (char *)0x0) { pcVar4 = (char *)0x0; } else { pcVar4 = *param_2; sVar2 = strlen(*param_2); pcVar3 = (char *)sh_xmalloc(sVar2 + 1, "array.c", 0x378); pcVar4 = strcpy(pcVar3, pcVar4); } sh_xfree(*(undefined8 *)(local_28 + 8), "array.c", 0x379); *(char **)(local_28 + 8) = pcVar4; } for (; local_30 < param_3; local_30 = local_30 + 1) { array_insert(param_1, local_30, param_2[local_30]); } } return param_1; }
bash
ghidra
static double ts_difference(struct timespec ts1, struct timespec ts2) { double d = difftime(ts1.tv_sec, ts2.tv_sec) + (1.0e-9 * (ts1.tv_nsec - ts2.tv_nsec)); return d; }
void ts_difference(unsigned int a0, unsigned long a1, unsigned int a2, unsigned long a3) { unsigned long v0; unsigned long long v2; unsigned long long v3; int v4; int v5; difftime(a0, a2); v2 = a1 - a3; v3 = a1 - a3; v0 = (v4 + 4472406533629990549 * v5); return; }
findutils
angr_sailr
static inline char *ila_ident_type2name(__u8 ident_type) { switch (ident_type) { case ILA_ATYPE_IID: return "iid"; case ILA_ATYPE_LUID: return "luid"; case ILA_ATYPE_VIRT_V4: return "virt-v4"; case ILA_ATYPE_VIRT_UNI_V6: return "virt-uni-v6"; case ILA_ATYPE_VIRT_MULTI_V6: return "virt-multi-v6"; case ILA_ATYPE_NONLOCAL_ADDR: return "nonlocal-addr"; case ILA_ATYPE_USE_FORMAT: return "use-format"; default: return "unknown"; } }
int ila_ident_type2name(unsigned long a0) { unsigned int v1; switch (a0) { case 0: v1 = &g_406b85; break; case 1: v1 = &g_406b89; break; case 2: v1 = &g_406b8e; break; case 3: v1 = &g_406b96; break; case 4: v1 = &g_406ba2; break; case 5: v1 = &g_406bb0; break; case 32: v1 = &g_406bbe; break; default: v1 = &g_406b7d; break; } return v1; }
iproute2-6.0.0
angr_phoenix
static int special_dir_block_cmp(const void *a, const void *b) { const struct ext2_db_entry2 *db_a = (const struct ext2_db_entry2 *)a; const struct ext2_db_entry2 *db_b = (const struct ext2_db_entry2 *)b; if (db_a->blockcnt && !db_b->blockcnt) return 1; if (!db_a->blockcnt && db_b->blockcnt) return -1; if (db_a->blk != db_b->blk) return (int)(db_a->blk - db_b->blk); if (db_a->ino != db_b->ino) return (int)(db_a->ino - db_b->ino); return (int)(db_a->blockcnt - db_b->blockcnt); }
long special_dir_block_cmp(long a1, long a2) { if (*(_QWORD *)(a1 + 16) && !*(_QWORD *)(a2 + 16)) return 1LL; if (!*(_QWORD *)(a1 + 16) && *(_QWORD *)(a2 + 16)) return 0xFFFFFFFFLL; if (*(_QWORD *)(a1 + 8) != *(_QWORD *)(a2 + 8)) return (unsigned int)*(_QWORD *)(a1 + 8) - (unsigned int)*(_QWORD *)(a2 + 8); if (*(_DWORD *)a1 == *(_DWORD *)a2) return (unsigned int)*(_QWORD *)(a1 + 16) - (unsigned int)*(_QWORD *)(a2 + 16); return (unsigned int)(*(_DWORD *)a1 - *(_DWORD *)a2); }
e2fsprogs-1.46.5
ida
static void chan_send_eow2(struct ssh *ssh, Channel *c) { int r; sshlog("nchan.c", __func__, 234, 0, SYSLOG_LEVEL_DEBUG2, ((void *)0), "channel %d: send eow", c->self); if (c->ostate == 3) { sshlog("nchan.c", __func__, 236, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "channel %d: must not sent eow on closed output", c->self); return; } if (!(ssh->compat & 0x04000000)) return; if (!c->have_remote_id) sshfatal("nchan.c", __func__, 243, 1, SYSLOG_LEVEL_FATAL, ((void *)0), "channel %d: no remote_id", c->self); if ((r = sshpkt_start(ssh, 98)) != 0 || (r = sshpkt_put_u32(ssh, c->remote_id)) != 0 || (r = sshpkt_put_cstring(ssh, "eow@openssh.com")) != 0 || (r = sshpkt_put_u8(ssh, 0)) != 0 || (r = sshpkt_send(ssh)) != 0) sshfatal("nchan.c", __func__, 249, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "send CHANNEL_EOF"); }
void chan_send_eow2(struct_0 *a0, unsigned int a1[6]) { unsigned long long v0; unsigned int v1; char v2; unsigned long long v3; unsigned long long v4; unsigned long long v5; unsigned long long v7; unsigned long long v8; sshlog("nchan.c", "chan_send_eow2", 0xea, 0x0, 0x6, 0x0, "channel %d: send eow", a1[1], a1); if (a1[5] == 3) { v5 = sshlog("nchan.c", "chan_send_eow2", 0xec, 0x0, 0x2, 0x0, "channel %d: must not sent eow on closed output", a1[1], a1); return; } v4 = a0->field_83c & 0x4000000; if (!(a0->field_83c & 0x4000000)) return; if (!a1[3]) sshfatal("nchan.c", "chan_send_eow2", 0xf3, 0x1, 0x1, 0x0, "channel %d: no remote_id", a1[1]); v1 = sshpkt_start(a0, 0x62); if (!v1) { v1 = sshpkt_put_u32(a0, a1[2], a1[2]); if (!v1) { v1 = sshpkt_put_cstring(a0, "eow@openssh.com"); if (!v1) { v1 = sshpkt_put_u8(a0, 0x0); if (!v1) { v1 = sshpkt_send(a0); if (!v1) return; } } } } v7 = ssh_err(v1); v0 = "send CHANNEL_EOF"; v8 = sshfatal("nchan.c", "chan_send_eow2", 0xf9, 0x1, 0x1, v7, *(&v2), v3); return; }
openssh-portable
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)))); }
long rta_getattr_u32(long a1) { return *(unsigned int *)(a1 + 4); }
iproute2-6.0.0
ida
static test_code_t test_ecdhe_curve(gnutls_session_t session, const char *curve, unsigned id) { int ret; if (tls_ext_ok == 0) return TEST_IGNORE; sprintf(prio_str, "NONE:" "+CIPHER-ALL:+ARCFOUR-128:+3DES-CBC" ":+GOST28147-TC26Z-CNT" ":" "+COMP-NULL" ":%s:" "+MAC-ALL:+MD5:+SHA1" ":+GOST28147-TC26Z-IMIT" ":+ECDHE-RSA:+ECDHE-ECDSA:%s:%s", protocol_all_str, curve, rest); { int _ret; if ((_ret = __gnutls_priority_set_direct(session, prio_str, 339)) != TEST_SUCCEED) { return _ret; } }; gnutls_credentials_set(session, GNUTLS_CRD_CERTIFICATE, xcred); ret = test_do_handshake(session); if (ret < 0) return TEST_FAILED; if (gnutls_ecc_curve_get(session) != id) return TEST_FAILED; return TEST_SUCCEED; }
void test_ecdhe_curve(unsigned long long a0, unsigned long a1, unsigned long a2) { unsigned int v0; unsigned int v1; unsigned long long v3; unsigned long long v4; unsigned long v5; if (!tls_ext_ok) { v3 = 3; return; } sprintf(&prio_str, "NONE:+CIPHER-ALL:+ARCFOUR-128:+3DES-CBC:+GOST28147-TC26Z-CNT:+COMP-" "NULL:%s:+MAC-ALL:+MD5:+SHA1:+GOST28147-TC26Z-IMIT:+ECDHE-RSA:+ECDHE-" "ECDSA:%s:%s", &protocol_all_str, a1, &rest); v0 = __gnutls_priority_set_direct(a0, &prio_str, 0x153); if (v0) { v4 = v0; return; } gnutls_credentials_set(a0, 0x1, xcred); v1 = test_do_handshake(a0); v5 = (v1 < 0 ? (a2 == gnutls_ecc_curve_get(a0) ? 1 : 0) : 1); return; }
gnutls
angr_sailr
!auth_root_allowed(ssh, auth_method)) authenticated = 0; } if (ent->flags & (0x0008 | 0x0020)) { auth_log(ssh, authenticated, partial, auth_method, auth_submethod); if (!partial && !authenticated) authctxt->failures++; if (authenticated || partial) { auth2_update_session_info(authctxt, auth_method, auth_submethod); } }
void auth_root_allowed(void) { halt_baddata(); }
openssh-portable
ghidra
static inline __be32 rta_getattr_be32(const struct rtattr *rta) { return ntohl(rta_getattr_u32(rta)); }
void rta_getattr_be32(void) { uint32_t __netlong; __netlong = rta_getattr_u32(); ntohl(__netlong); return; }
iproute2-6.0.0
ghidra
static Bool unRLE_obuf_to_output_SMALL(DState *s) { UChar k1; if (s->blockRandomised) { while (((Bool)1)) { while (((Bool)1)) { if (s->strm->avail_out == 0) return ((Bool)0); if (s->state_out_len == 0) break; *((UChar *)(s->strm->next_out)) = s->state_out_ch; { s->calculatedBlockCRC = (s->calculatedBlockCRC << 8) ^ BZ2_crc32Table[(s->calculatedBlockCRC >> 24) ^ ((UChar)s->state_out_ch)]; }; s->state_out_len--; s->strm->next_out++; s->strm->avail_out--; s->strm->total_out_lo32++; if (s->strm->total_out_lo32 == 0) s->strm->total_out_hi32++; } if (s->nblock_used == s->save_nblock + 1) return ((Bool)0); if (s->nblock_used > s->save_nblock + 1) return ((Bool)1); s->state_out_len = 1; s->state_out_ch = s->k0; if (s->tPos >= (UInt32)100000 * (UInt32)s->blockSize100k) return ((Bool)1); k1 = BZ2_indexIntoF(s->tPos, s->cftab); s->tPos = (((UInt32)s->ll16[s->tPos]) | (((((UInt32)(s->ll4[(s->tPos) >> 1])) >> (((s->tPos) << 2) & 0x4)) & 0xF) << 16)); ; if (s->rNToGo == 0) { s->rNToGo = BZ2_rNums[s->rTPos]; s->rTPos++; if (s->rTPos == 512) s->rTPos = 0; } s->rNToGo--; ; k1 ^= ((s->rNToGo == 1) ? 1 : 0); s->nblock_used++; if (s->nblock_used == s->save_nblock + 1) continue; if (k1 != s->k0) { s->k0 = k1; continue; }; s->state_out_len = 2; if (s->tPos >= (UInt32)100000 * (UInt32)s->blockSize100k) return ((Bool)1); k1 = BZ2_indexIntoF(s->tPos, s->cftab); s->tPos = (((UInt32)s->ll16[s->tPos]) | (((((UInt32)(s->ll4[(s->tPos) >> 1])) >> (((s->tPos) << 2) & 0x4)) & 0xF) << 16)); ; if (s->rNToGo == 0) { s->rNToGo = BZ2_rNums[s->rTPos]; s->rTPos++; if (s->rTPos == 512) s->rTPos = 0; } s->rNToGo--; ; k1 ^= ((s->rNToGo == 1) ? 1 : 0); s->nblock_used++; if (s->nblock_used == s->save_nblock + 1) continue; if (k1 != s->k0) { s->k0 = k1; continue; }; s->state_out_len = 3; if (s->tPos >= (UInt32)100000 * (UInt32)s->blockSize100k) return ((Bool)1); k1 = BZ2_indexIntoF(s->tPos, s->cftab); s->tPos = (((UInt32)s->ll16[s->tPos]) | (((((UInt32)(s->ll4[(s->tPos) >> 1])) >> (((s->tPos) << 2) & 0x4)) & 0xF) << 16)); ; if (s->rNToGo == 0) { s->rNToGo = BZ2_rNums[s->rTPos]; s->rTPos++; if (s->rTPos == 512) s->rTPos = 0; } s->rNToGo--; ; k1 ^= ((s->rNToGo == 1) ? 1 : 0); s->nblock_used++; if (s->nblock_used == s->save_nblock + 1) continue; if (k1 != s->k0) { s->k0 = k1; continue; }; if (s->tPos >= (UInt32)100000 * (UInt32)s->blockSize100k) return ((Bool)1); k1 = BZ2_indexIntoF(s->tPos, s->cftab); s->tPos = (((UInt32)s->ll16[s->tPos]) | (((((UInt32)(s->ll4[(s->tPos) >> 1])) >> (((s->tPos) << 2) & 0x4)) & 0xF) << 16)); ; if (s->rNToGo == 0) { s->rNToGo = BZ2_rNums[s->rTPos]; s->rTPos++; if (s->rTPos == 512) s->rTPos = 0; } s->rNToGo--; ; k1 ^= ((s->rNToGo == 1) ? 1 : 0); s->nblock_used++; s->state_out_len = ((Int32)k1) + 4; if (s->tPos >= (UInt32)100000 * (UInt32)s->blockSize100k) return ((Bool)1); s->k0 = BZ2_indexIntoF(s->tPos, s->cftab); s->tPos = (((UInt32)s->ll16[s->tPos]) | (((((UInt32)(s->ll4[(s->tPos) >> 1])) >> (((s->tPos) << 2) & 0x4)) & 0xF) << 16)); ; if (s->rNToGo == 0) { s->rNToGo = BZ2_rNums[s->rTPos]; s->rTPos++; if (s->rTPos == 512) s->rTPos = 0; } s->rNToGo--; ; s->k0 ^= ((s->rNToGo == 1) ? 1 : 0); s->nblock_used++; } } else { while (((Bool)1)) { while (((Bool)1)) { if (s->strm->avail_out == 0) return ((Bool)0); if (s->state_out_len == 0) break; *((UChar *)(s->strm->next_out)) = s->state_out_ch; { s->calculatedBlockCRC = (s->calculatedBlockCRC << 8) ^ BZ2_crc32Table[(s->calculatedBlockCRC >> 24) ^ ((UChar)s->state_out_ch)]; }; s->state_out_len--; s->strm->next_out++; s->strm->avail_out--; s->strm->total_out_lo32++; if (s->strm->total_out_lo32 == 0) s->strm->total_out_hi32++; } if (s->nblock_used == s->save_nblock + 1) return ((Bool)0); if (s->nblock_used > s->save_nblock + 1) return ((Bool)1); s->state_out_len = 1; s->state_out_ch = s->k0; if (s->tPos >= (UInt32)100000 * (UInt32)s->blockSize100k) return ((Bool)1); k1 = BZ2_indexIntoF(s->tPos, s->cftab); s->tPos = (((UInt32)s->ll16[s->tPos]) | (((((UInt32)(s->ll4[(s->tPos) >> 1])) >> (((s->tPos) << 2) & 0x4)) & 0xF) << 16)); ; s->nblock_used++; if (s->nblock_used == s->save_nblock + 1) continue; if (k1 != s->k0) { s->k0 = k1; continue; }; s->state_out_len = 2; if (s->tPos >= (UInt32)100000 * (UInt32)s->blockSize100k) return ((Bool)1); k1 = BZ2_indexIntoF(s->tPos, s->cftab); s->tPos = (((UInt32)s->ll16[s->tPos]) | (((((UInt32)(s->ll4[(s->tPos) >> 1])) >> (((s->tPos) << 2) & 0x4)) & 0xF) << 16)); ; s->nblock_used++; if (s->nblock_used == s->save_nblock + 1) continue; if (k1 != s->k0) { s->k0 = k1; continue; }; s->state_out_len = 3; if (s->tPos >= (UInt32)100000 * (UInt32)s->blockSize100k) return ((Bool)1); k1 = BZ2_indexIntoF(s->tPos, s->cftab); s->tPos = (((UInt32)s->ll16[s->tPos]) | (((((UInt32)(s->ll4[(s->tPos) >> 1])) >> (((s->tPos) << 2) & 0x4)) & 0xF) << 16)); ; s->nblock_used++; if (s->nblock_used == s->save_nblock + 1) continue; if (k1 != s->k0) { s->k0 = k1; continue; }; if (s->tPos >= (UInt32)100000 * (UInt32)s->blockSize100k) return ((Bool)1); k1 = BZ2_indexIntoF(s->tPos, s->cftab); s->tPos = (((UInt32)s->ll16[s->tPos]) | (((((UInt32)(s->ll4[(s->tPos) >> 1])) >> (((s->tPos) << 2) & 0x4)) & 0xF) << 16)); ; s->nblock_used++; s->state_out_len = ((Int32)k1) + 4; if (s->tPos >= (UInt32)100000 * (UInt32)s->blockSize100k) return ((Bool)1); s->k0 = BZ2_indexIntoF(s->tPos, s->cftab); s->tPos = (((UInt32)s->ll16[s->tPos]) | (((((UInt32)(s->ll4[(s->tPos) >> 1])) >> (((s->tPos) << 2) & 0x4)) & 0xF) << 16)); ; s->nblock_used++; } } }
int unRLE_obuf_to_output_SMALL(struct_0 *a0) { char v0; unsigned int v2; unsigned int v3; unsigned int v4; unsigned int v5; unsigned int v6; if (a0->field_14) { while (true) { if (!a0->field_0->field_20) { v6 = 0; break; } else if (a0->field_10) { *(a0->field_0->field_18) = a0->field_c; a0->field_c70 = (a0->field_c70 * 0x100) ^ *(&(&BZ2_crc32Table)[4 * (a0->field_c ^ (a0->field_c70 >> 24))]); a0->field_10 = a0->field_10 - 1; a0->field_0->field_18 = a0->field_0->field_18 + 1; a0->field_0->field_20 = a0->field_0->field_20 - 1; a0->field_0->field_24 = a0->field_0->field_24 + 1; if (a0->field_0->field_24) continue; a0->field_0->field_28 = a0->field_0->field_28 + 1; } else if (a0->field_444 == a0->field_fa50 + 1) { v6 = 0; break; } else if (a0->field_444 > a0->field_fa50 + 1) { v6 = 1; break; } else { a0->field_10 = 1; a0->field_c = a0->field_40; if (a0->field_3c >= a0->field_28 * 100000) { v6 = 1; break; } else { v0 = BZ2_indexIntoF(a0->field_3c, &a0->padding_448); a0->field_3c = *((a0->field_3c * 2 + a0->field_c58)) | ((*(((a0->field_3c >> 1) + a0->field_c60)) >> (((a0->field_3c * 4) & 4) & 31)) * 0x10000) & 0xf0000; if (!a0->field_18) { a0->field_18 = *((4 * a0->field_1c + &BZ2_rNums)); a0->field_1c = a0->field_1c + 1; if (a0->field_1c == 0x200) a0->field_1c = 0; } a0->field_18 = a0->field_18 - 1; v2 = a0->field_18; *(&v2) = a0->field_18 == 1; *(&v2) = v0 ^ v2; v0 = v2; a0->field_444 = a0->field_444 + 1; if (a0->field_444 == a0->field_fa50 + 1) continue; if (v0 != a0->field_40) { a0->field_40 = v0; } else { a0->field_10 = 2; if (a0->field_3c >= a0->field_28 * 100000) { v6 = 1; break; } else { v0 = BZ2_indexIntoF(a0->field_3c, &a0->padding_448); a0->field_3c = *((a0->field_3c * 2 + a0->field_c58)) | ((*(((a0->field_3c >> 1) + a0->field_c60)) >> (((a0->field_3c * 4) & 4) & 31)) * 0x10000) & 0xf0000; if (!a0->field_18) { a0->field_18 = *((4 * a0->field_1c + &BZ2_rNums)); a0->field_1c = a0->field_1c + 1; if (a0->field_1c == 0x200) a0->field_1c = 0; } a0->field_18 = a0->field_18 - 1; v3 = a0->field_18; *(&v3) = a0->field_18 == 1; *(&v3) = v0 ^ v3; v0 = v3; a0->field_444 = a0->field_444 + 1; if (a0->field_444 == a0->field_fa50 + 1) continue; if (a0->field_444 != a0->field_fa50 + 1) { if (v0 != a0->field_40) { a0->field_40 = v0; } else { a0->field_10 = 3; if (a0->field_3c >= a0->field_28 * 100000) { v6 = 1; break; } else { v0 = BZ2_indexIntoF(a0->field_3c, &a0->padding_448); a0->field_3c = *((a0->field_3c * 2 + a0->field_c58)) | ((*(((a0->field_3c >> 1) + a0->field_c60)) >> (((a0->field_3c * 4) & 4) & 31)) * 0x10000) & 0xf0000; if (!a0->field_18) { a0->field_18 = *((4 * a0->field_1c + &BZ2_rNums)); a0->field_1c = a0->field_1c + 1; if (a0->field_1c == 0x200) a0->field_1c = 0; } a0->field_18 = a0->field_18 - 1; v4 = a0->field_18; *(&v4) = a0->field_18 == 1; *(&v4) = v0 ^ v4; v0 = v4; a0->field_444 = a0->field_444 + 1; if (a0->field_444 != a0->field_fa50 + 1) { if (v0 != a0->field_40) { a0->field_40 = v0; } else if (a0->field_3c >= a0->field_28 * 100000) { v6 = 1; break; } else { v0 = BZ2_indexIntoF(a0->field_3c, &a0->padding_448); a0->field_3c = *((a0->field_3c * 2 + a0->field_c58)) | ((*(((a0->field_3c >> 1) + a0->field_c60)) >> (((a0->field_3c * 4) & 4) & 31)) * 0x10000) & 0xf0000; if (!a0->field_18) { a0->field_18 = *((4 * a0->field_1c + &BZ2_rNums)); a0->field_1c = a0->field_1c + 1; if (a0->field_1c == 0x200) a0->field_1c = 0; } a0->field_18 = a0->field_18 - 1; v5 = a0->field_18; *(&v5) = a0->field_18 == 1; *(&v5) = v0 ^ v5; v0 = v5; a0->field_444 = a0->field_444 + 1; a0->field_10 = v0 + 4; if (a0->field_3c >= a0->field_28 * 100000) { v6 = 1; break; } else { a0->field_40 = BZ2_indexIntoF(a0->field_3c, &a0->padding_448); a0->field_3c = *((a0->field_3c * 2 + a0->field_c58)) | ((*(((a0->field_3c >> 1) + a0->field_c60)) >> (((a0->field_3c * 4) & 4) & 31)) * 0x10000) & 0xf0000; if (!a0->field_18) { a0->field_18 = *((4 * a0->field_1c + &BZ2_rNums)); a0->field_1c = a0->field_1c + 1; if (a0->field_1c == 0x200) a0->field_1c = 0; } a0->field_18 = a0->field_18 - 1; a0->field_40 = a0->field_40 ^ a0->field_18 == 1; a0->field_444 = a0->field_444 + 1; continue; } } } } } } } } } } } } else { while (true) { if (!a0->field_0->field_20) { v6 = 0; break; } else if (a0->field_10) { *(a0->field_0->field_18) = a0->field_c; a0->field_c70 = (a0->field_c70 * 0x100) ^ *(&(&BZ2_crc32Table)[4 * (a0->field_c ^ (a0->field_c70 >> 24))]); a0->field_10 = a0->field_10 - 1; a0->field_0->field_18 = a0->field_0->field_18 + 1; a0->field_0->field_20 = a0->field_0->field_20 - 1; a0->field_0->field_24 = a0->field_0->field_24 + 1; if (a0->field_0->field_24) continue; a0->field_0->field_28 = a0->field_0->field_28 + 1; } else if (a0->field_444 == a0->field_fa50 + 1) { v6 = 0; break; } else if (a0->field_444 > a0->field_fa50 + 1) { v6 = 1; break; } else { a0->field_10 = 1; a0->field_c = a0->field_40; if (a0->field_3c >= a0->field_28 * 100000) { v6 = 1; break; } else { v0 = BZ2_indexIntoF(a0->field_3c, &a0->padding_448); a0->field_3c = *((a0->field_3c * 2 + a0->field_c58)) | ((*(((a0->field_3c >> 1) + a0->field_c60)) >> (((a0->field_3c * 4) & 4) & 31)) * 0x10000) & 0xf0000; a0->field_444 = a0->field_444 + 1; if (a0->field_444 == a0->field_fa50 + 1) continue; if (v0 != a0->field_40) { a0->field_40 = v0; } else { a0->field_10 = 2; if (a0->field_3c >= a0->field_28 * 100000) { v6 = 1; break; } else { v0 = BZ2_indexIntoF(a0->field_3c, &a0->padding_448); a0->field_3c = *((a0->field_3c * 2 + a0->field_c58)) | ((*(((a0->field_3c >> 1) + a0->field_c60)) >> (((a0->field_3c * 4) & 4) & 31)) * 0x10000) & 0xf0000; a0->field_444 = a0->field_444 + 1; if (a0->field_444 == a0->field_fa50 + 1) continue; if (a0->field_444 != a0->field_fa50 + 1) { if (v0 != a0->field_40) { a0->field_40 = v0; } else { a0->field_10 = 3; if (a0->field_3c >= a0->field_28 * 100000) { v6 = 1; break; } else { v0 = BZ2_indexIntoF(a0->field_3c, &a0->padding_448); a0->field_3c = *((a0->field_3c * 2 + a0->field_c58)) | ((*(((a0->field_3c >> 1) + a0->field_c60)) >> (((a0->field_3c * 4) & 4) & 31)) * 0x10000) & 0xf0000; a0->field_444 = a0->field_444 + 1; if (a0->field_444 != a0->field_fa50 + 1) { if (v0 != a0->field_40) { a0->field_40 = v0; } else if (a0->field_3c >= a0->field_28 * 100000) { v6 = 1; break; } else { v0 = BZ2_indexIntoF(a0->field_3c, &a0->padding_448); a0->field_3c = *((a0->field_3c * 2 + a0->field_c58)) | ((*(((a0->field_3c >> 1) + a0->field_c60)) >> (((a0->field_3c * 4) & 4) & 31)) * 0x10000) & 0xf0000; a0->field_444 = a0->field_444 + 1; a0->field_10 = v0 + 4; if (a0->field_3c >= a0->field_28 * 100000) { v6 = 1; break; } else { a0->field_40 = BZ2_indexIntoF(a0->field_3c, &a0->padding_448); a0->field_3c = *((a0->field_3c * 2 + a0->field_c58)) | ((*(((a0->field_3c >> 1) + a0->field_c60)) >> (((a0->field_3c * 4) & 4) & 31)) * 0x10000) & 0xf0000; a0->field_444 = a0->field_444 + 1; continue; } } } } } } } } } } } } return v6; }
bzip2
angr_dream
static void restore_default_color(void) { put_indicator(&color_indicator[C_LEFT]); put_indicator(&color_indicator[C_RIGHT]); }
void restore_default_color() { unsigned long long v1; put_indicator(&color_indicator); v1 = put_indicator(&g_410710); return; }
coreutils
angr_phoenix
static int on_off(const char *msg, const char *arg) { fprintf(stderr, "Error: argument of \"%s\" must be \"on\" or \"off\", not \"%s\"\n", msg, arg); return -1; }
void on_off(unsigned long a0, unsigned long a1) { unsigned long long v1; fprintf(stderr, "Error: argument of \"%s\" must be \"on\" or \"off\", not \"%s\"\n", a0, a1); v1 = 4294967295; return; }
iproute2-6.0.0
angr_dream
int ssh_local_cmd(const char *args) { char *shell; pid_t pid; int status; void (*osighand)(int); if (!options.permit_local_command || args == ((void *)0) || !*args) return (1); if ((shell = getenv("SHELL")) == ((void *)0) || *shell == '\0') shell = "/bin/sh"; osighand = ssh_signal(17, ((__sighandler_t)0)); pid = fork(); if (pid == 0) { ssh_signal(13, ((__sighandler_t)0)); sshlog("sshconnect.c", __func__, 1659, 0, SYSLOG_LEVEL_DEBUG3, ((void *)0), "Executing %s -c \"%s\"", shell, args); execl(shell, shell, "-c", args, (char *)((void *)0)); sshlog("sshconnect.c", __func__, 1661, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "Couldn't execute %s -c \"%s\": %s", shell, args, strerror((*__errno_location()))); _exit(1); } else if (pid == -1) sshfatal("sshconnect.c", __func__, 1665, 0, SYSLOG_LEVEL_FATAL, ((void *)0), "fork failed: %.100s", strerror((*__errno_location()))); while (waitpid(pid, &status, 0) == -1) if ((*__errno_location()) != 4) sshfatal("sshconnect.c", __func__, 1668, 0, SYSLOG_LEVEL_FATAL, ((void *)0), "Couldn't wait for child: %s", strerror((*__errno_location()))); ssh_signal(17, osighand); if (!(((status) & 0x7f) == 0)) return (1); return ((((status) & 0xff00) >> 8)); }
uint ssh_local_cmd(char *param_1) { int __errnum; __pid_t _Var1; uint uVar2; int *piVar3; char *pcVar4; char **ppcVar5; undefined *puVar6; long in_FS_OFFSET; char *pcStack72; char *pcStack64; undefined auStack56[8]; char *local_30; uint local_28; __pid_t local_24; char *local_20; undefined8 local_18; long local_10; puVar6 = auStack56; local_30 = param_1; local_10 = *(long *)(in_FS_OFFSET + 0x28); if (((_DAT_00109390 == 0) || (param_1 == (char *)0x0)) || (*param_1 == '\0')) { uVar2 = 1; } else { pcStack64 = (char *)0x10560f; local_20 = getenv("SHELL"); if ((local_20 == (char *)0x0) || (*local_20 == '\0')) { local_20 = "/bin/sh"; } pcStack64 = (char *)0x10563f; local_18 = ssh_signal(0x11, 0); pcStack64 = (char *)0x105648; local_24 = fork(); if (local_24 == 0) { pcStack64 = (char *)0x105664; ssh_signal(0xd, 0); pcStack72 = local_30; sshlog("sshconnect.c", "ssh_local_cmd", 0x67b, 0, 7, 0, "Executing %s -c \"%s\"", local_20); pcStack64 = (char *)0x1056d1; execl(local_20, local_20, &DAT_00105b3b, local_30, 0); pcStack64 = (char *)0x1056d6; piVar3 = __errno_location(); pcStack64 = (char *)0x1056df; pcStack64 = strerror(*piVar3); pcStack72 = local_30; sshlog("sshconnect.c", "ssh_local_cmd", 0x67d, 0, 2, 0, "Couldn\'t execute %s -c \"%s\": %s", local_20); pcStack64 = (char *)0x10572a; _exit(1); } puVar6 = auStack56; if (local_24 != -1) goto LAB_001057ca; pcStack64 = (char *)0x105739; piVar3 = __errno_location(); pcStack64 = (char *)0x105742; pcStack64 = strerror(*piVar3); pcStack72 = "fork failed: %.100s"; sshfatal("sshconnect.c", "ssh_local_cmd", 0x681, 0, 1, 0); ppcVar5 = &pcStack72; do { *(undefined8 *)((long)ppcVar5 + -8) = 0x10577e; piVar3 = __errno_location(); puVar6 = (undefined *)ppcVar5; if (*piVar3 != 4) { *(undefined8 *)((long)ppcVar5 + -8) = 0x10578a; piVar3 = __errno_location(); __errnum = *piVar3; *(undefined8 *)((long)ppcVar5 + -8) = 0x105793; pcVar4 = strerror(__errnum); *(char **)((long)ppcVar5 + -8) = pcVar4; puVar6 = (undefined *)((long)ppcVar5 + -0x10); *(char **)((long)ppcVar5 + -0x10) = "Couldn\'t wait for child: %s"; *(undefined8 *)((long)ppcVar5 + -0x18) = 0x1057ca; sshfatal("sshconnect.c", "ssh_local_cmd", 0x684, 0, 1, 0); } LAB_001057ca: *(undefined8 *)(puVar6 + -8) = 0x1057e0; _Var1 = waitpid(local_24, (int *)&local_28, 0); ppcVar5 = (char **)puVar6; } while (_Var1 == -1); *(undefined8 *)(puVar6 + -8) = 0x1057f6; ssh_signal(0x11, local_18); if ((local_28 & 0x7f) == 0) { uVar2 = (int)local_28 >> 8 & 0xff; } else { uVar2 = 1; } } if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) { *(undefined8 *)(puVar6 + -8) = 0x105824; __stack_chk_fail(); } return uVar2; }
openssh-portable
ghidra
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 long v0; unsigned long long v1[2]; char *v2; unsigned long long v3; unsigned long long v4; unsigned long long v5; unsigned long long v6; unsigned long long v7; unsigned long long v8; unsigned long long v9; unsigned long long v10; unsigned long long v11; unsigned long long v12; unsigned long long v13; unsigned long long v14; unsigned long long v15; void *v16; void *v17; char v18; unsigned long long v23; unsigned long long *v24; unsigned long long v25; 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]; v1[0] = v1 + 1) { if (!strcmp(a0, v1[0])) break; } if (v1[1]) v0 = v1[1]; printf(gettext("\n%s online help: <%s>\n")); v2 = setlocale(0x5, NULL); if (v2 && strncmp(v2, "en_", 0x3)) fputs_unlocked(gettext("Report any translation bugs to <https: if (strcmp(a0, "[")) v23 = a0; else v23 = "test"; v3 = v23; printf(gettext("Full documentation <%s%s>\n")); printf(gettext("or available locally via: info '(coreutils) %s%s'\n")); v25 = *(&v18) ^ v24[5]; return; }
coreutils
angr_dream
static _Bool dump_hard_link(struct tar_stat_info *st) { if (link_table && (trivial_link_count < st->stat.st_nlink || remove_files_option)) { struct link lp; struct link *duplicate; off_t block_ordinal; union block *blk; lp.ino = st->stat.st_ino; lp.dev = st->stat.st_dev; if ((duplicate = hash_lookup(link_table, &lp))) { char const *link_name = safer_name_suffix(duplicate->name, 1, absolute_names_option); if (duplicate->nlink) duplicate->nlink--; block_ordinal = current_block_ordinal(); assign_string(&st->link_name, link_name); if (100 - (archive_format == OLDGNU_FORMAT) < strlen(link_name)) write_long_link(st); st->stat.st_size = 0; blk = start_header(st); if (!blk) return 0; tar_copy_str(blk->header.linkname, link_name, 100); blk->header.typeflag = '1'; finish_header(st, blk, block_ordinal); if (remove_files_option) queue_deferred_unlink(st->orig_file_name, 0); return 1; } } return 0; }
int dump_hard_link(unsigned long long a0[18]) { struct_1 *v0; void *v1; unsigned long long v2; struct_0 *v3; unsigned long v4; unsigned long v5; unsigned int v7; unsigned long long v8; if (link_table && (a0[13] > trivial_link_count || remove_files_option)) { v5 = a0[12]; v4 = a0[11]; v0 = hash_lookup(link_table, &v4, &v4); if (v0) { v1 = safer_name_suffix(v0 + 1, 0x1, absolute_names_option, v0 + 1); if (v0->field_10) v0->field_10 = v0->field_10 - 1; v2 = current_block_ordinal(); assign_string(&a0[3], v1, &a0[3]); if (archive_format == 2) v8 = 99; else v8 = 100; v7 = strlen(v1); if (v8 < v7) write_long_link(a0); a0[17] = 0; v3 = start_header(a0); if (!v3) { v7 = 0; } else { tar_copy_str(v3 + 1, v1, 0x64); v3->field_9c = 49; finish_header(a0, v3, v2); if (remove_files_option) queue_deferred_unlink(a0[0], 0x0); v7 = 1; } } } if (!link_table || !v0 || a0[13] <= trivial_link_count && !remove_files_option) v7 = 0; return v7; }
tar
angr_dream
SHELL_VAR **all_local_variables(visible_only) int visible_only; { VARLIST *vlist; SHELL_VAR **ret; VAR_CONTEXT *vc; vc = shell_variables; for (vc = shell_variables; vc; vc = vc->down) if ((((vc)->flags & 0x04) != 0) && vc->scope == variable_context) break; if (vc == 0) { internal_error( gettext("all_local_variables: no function context at current scope")); return (SHELL_VAR **)((void *)0); } if (vc->table == 0 || ((vc->table) ? (vc->table)->nentries : 0) == 0 || (((vc)->flags & 0x01) != 0) == 0) return (SHELL_VAR **)((void *)0); vlist = vlist_alloc(((vc->table) ? (vc->table)->nentries : 0)); if (visible_only) flatten(vc->table, visible_variable_in_context, vlist, 0); else flatten(vc->table, variable_in_context, vlist, 0); ret = vlist->list; sh_xfree((vlist), "variables.c", 4461); if (ret) sort_variables(ret); return ret; }
long long all_local_variables(unsigned long a0) { struct_0 *v0; unsigned long long *v1; unsigned long long v2; void *v4; void *v5; v0 = shell_variables; v0 = shell_variables; while (true) { if (!v0) break; if ((v0->field_c & 4) && v0->field_8 == variable_context) break; v0 = v0->field_18; } if (!v0) { internal_error( gettext("all_local_variables: no function context at current scope")); v4 = 0; } else if (!v0->field_20) { LABEL_407d12: v4 = 0; } else { if (!v0->field_20) goto LABEL_407d12; if (!v0->field_20->field_c) goto LABEL_407d12; if (!(v0->field_c & 1)) goto LABEL_407d12; if (!v0->field_20) v5 = 0; else v5 = v0->field_20->field_c; v1 = vlist_alloc(v5); if (!a0) flatten(v0->field_20, variable_in_context, v1, 0x0); else flatten(v0->field_20, visible_variable_in_context, v1, 0x0); v2 = *(v1); sh_xfree(v1, "variables.c", 0x116d); if (v2) sort_variables(v2); v4 = v2; } return v4; }
bash
angr_phoenix
int radixsort(const unsigned char **a, int n, const unsigned char *tab, unsigned int endch) { const unsigned char *tr; unsigned int c; unsigned char tr0[256]; { if (tab == ((void *)0)) { tr = tr0; for (c = 0; c < endch; c++) tr0[c] = c + 1; tr0[c] = 0; for (c++; c < 256; c++) tr0[c] = c; endch = 0; } else { endch = tab[endch]; tr = tab; if (endch != 0 && endch != 255) { (*__errno_location()) = 22; return (-1); } } }; r_sort_a(a, n, 0, tr, endch); return (0); }
undefined8 radixsort(undefined8 param_1, undefined4 param_2, char *param_3, uint param_4) { char cVar1; int *piVar2; undefined8 uVar3; long in_FS_OFFSET; uint local_124; char *local_120; char local_118[264]; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); if (param_3 == (char *)0x0) { local_120 = local_118; for (local_124 = 0; local_124 < param_4; local_124 = local_124 + 1) { local_118[local_124] = (char)local_124 + '\x01'; } local_118[local_124] = '\0'; while (local_124 = local_124 + 1, local_124 < 0x100) { local_118[local_124] = (char)local_124; } cVar1 = '\0'; } else { cVar1 = param_3[param_4]; local_120 = param_3; if ((cVar1 != '\0') && (cVar1 != -1)) { piVar2 = __errno_location(); *piVar2 = 0x16; uVar3 = 0xffffffff; goto LAB_00100159; } } r_sort_a(param_1, param_2, 0, local_120, cVar1); uVar3 = 0; LAB_00100159: if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) { __stack_chk_fail(); } return uVar3; }
libbsd-0.11.7
ghidra
void usage(int status) { if (status != 0) { fprintf(stderr, gettext("Usage: %s [OPTION]... PATTERNS [FILE]...\n"), getprogname()); fprintf(stderr, gettext("Try '%s --help' for more information.\n"), getprogname()); } else { printf(gettext("Usage: %s [OPTION]... PATTERNS [FILE]...\n"), getprogname()); printf(gettext("Search for PATTERNS in each FILE.\n")); printf(gettext("Example: %s -i 'hello world' menu.h main.c\nPATTERNS can " "contain multiple patterns separated by " "newlines.\n\nPattern selection and interpretation:\n") , getprogname()); printf(gettext( " -E, --extended-regexp PATTERNS are extended regular " "expressions\n -F, --fixed-strings PATTERNS are strings\n -G, " "--basic-regexp PATTERNS are basic regular expressions\n -P, " "--perl-regexp PATTERNS are Perl regular expressions\n") ); printf(gettext( " -e, --regexp=PATTERNS use PATTERNS for matching\n -f, " "--file=FILE take PATTERNS from FILE\n -i, --ignore-case " " ignore case distinctions in patterns and data\n " "--no-ignore-case do not ignore case distinctions (default)\n " "-w, --word-regexp match only whole words\n -x, --line-regexp " " match only whole lines\n -z, --null-data a data " "line ends in 0 byte, not newline\n") ); printf(gettext( "\nMiscellaneous:\n -s, --no-messages suppress error " "messages\n -v, --invert-match select non-matching lines\n " "-V, --version display version information and exit\n " "--help display this help text and exit\n") ); printf( gettext("\nOutput control:\n -m, --max-count=NUM stop after NUM " "selected lines\n -b, --byte-offset print the byte " "offset with output lines\n -n, --line-number print " "line number with output lines\n --line-buffered " "flush output on every line\n -H, --with-filename print " "file name with output lines\n -h, --no-filename " "suppress the file name prefix on output\n --label=LABEL " " use LABEL as the standard input file name prefix\n")); printf(gettext( " -o, --only-matching show only nonempty parts of lines that " "match\n -q, --quiet, --silent suppress all normal output\n " "--binary-files=TYPE assume that binary files are TYPE;\n " " TYPE is 'binary', 'text', or 'without-match'\n -a, " "--text equivalent to --binary-files=text\n") ); printf( gettext(" -I equivalent to " "--binary-files=without-match\n -d, --directories=ACTION how " "to handle directories;\n ACTION is " "'read', 'recurse', or 'skip'\n -D, --devices=ACTION how " "to handle devices, FIFOs and sockets;\n " " ACTION is 'read' or 'skip'\n -r, --recursive " "like --directories=recurse\n -R, --dereference-recursive " "likewise, but follow all symlinks\n") ); printf(gettext( " --include=GLOB search only files that match GLOB (a file " "pattern)" "\n --exclude=GLOB skip files that match GLOB\n " "--exclude-from=FILE skip files that match any file pattern from " "FILE\n --exclude-dir=GLOB skip directories that match GLOB\n") ); printf(gettext(" -L, --files-without-match print only names of FILEs " "with no selected lines\n -l, --files-with-matches print " "only names of FILEs with selected lines\n -c, --count " " print only a count of selected lines per FILE\n " "-T, --initial-tab make tabs line up (if needed)\n " "-Z, --null print 0 byte after FILE name\n") ); printf(gettext("\nContext control:\n -B, --before-context=NUM print NUM " "lines of leading context\n -A, --after-context=NUM " "print NUM lines of trailing context\n -C, --context=NUM " " print NUM lines of output context\n") ); printf(gettext( " -NUM same as --context=NUM\n " "--group-separator=SEP print SEP on line between matches with " "context\n --no-group-separator do not print separator for " "matches with context\n --color[=WHEN],\n --colour[=WHEN] " " use markers to highlight the matching strings;\n " " WHEN is 'always', 'never', or 'auto'\n -U, --binary " " do not strip CR characters at EOL (MSDOS/Windows)\n\n") ); printf(gettext( "When FILE is '-', read standard input. With no FILE, read '.' " "if\nrecursive, '-' otherwise. With fewer than two FILEs, assume " "-h.\nExit status is 0 if any line is selected, 1 otherwise;\nif any " "error occurs and -q is not given, the exit status is 2.\n") ); emit_bug_reporting_address(); } exit(status); }
void usage(unsigned long long a0) { unsigned long v0; unsigned long v2; unsigned long long v3; unsigned long long v4; unsigned long long v5; unsigned long long v7; unsigned long long v8; unsigned long long v9; unsigned long long v10; v0 = v2; if (a0) { v4 = getprogname(); fprintf(stderr, gettext("Usage: %s [OPTION]... PATTERNS [FILE]...\n")); v5 = getprogname(); fprintf(stderr, gettext("Try '%s --help' for more information.\n")); } else { v3 = getprogname(); printf(gettext("Usage: %s [OPTION]... PATTERNS [FILE]...\n")); printf(gettext("Search for PATTERNS in each FILE.\n")); printf(gettext("Example: %s -i 'hello world' menu.h main.c\nPATTERNS can " "contain multiple patterns separated by " "newlines.\n\nPattern selection and interpretation:\n")); printf(gettext( " -E, --extended-regexp PATTERNS are extended regular " "expressions\n -F, --fixed-strings PATTERNS are strings\n -G, " "--basic-regexp PATTERNS are basic regular expressions\n -P, " "--perl-regexp PATTERNS are Perl regular expressions\n")); printf(gettext( " -e, --regexp=PATTERNS use PATTERNS for matching\n -f, " "--file=FILE take PATTERNS from FILE\n -i, --ignore-case " " ignore case distinctions in patterns and data\n " "--no-ignore-case do not ignore case distinctions (default)\n " "-w, --word-regexp match only whole words\n -x, --line-regexp " " match only whole lines\n -z, --null-data a data " "line ends in 0 byte, not newline\n")); printf(gettext( "\nMiscellaneous:\n -s, --no-messages suppress error " "messages\n -v, --invert-match select non-matching lines\n " "-V, --version display version information and exit\n " "--help display this help text and exit\n")); printf( gettext("\nOutput control:\n -m, --max-count=NUM stop after NUM " "selected lines\n -b, --byte-offset print the byte " "offset with output lines\n -n, --line-number print " "line number with output lines\n --line-buffered " "flush output on every line\n -H, --with-filename print " "file name with output lines\n -h, --no-filename " "suppress the file name prefix on output\n --label=LABEL " " use LABEL as the standard input file name prefix\n")); printf(gettext( " -o, --only-matching show only nonempty parts of lines that " "match\n -q, --quiet, --silent suppress all normal output\n " "--binary-files=TYPE assume that binary files are TYPE;\n " " TYPE is 'binary', 'text', or 'without-match'\n -a, " "--text equivalent to --binary-files=text\n")); printf( gettext(" -I equivalent to " "--binary-files=without-match\n -d, --directories=ACTION how " "to handle directories;\n ACTION is " "'read', 'recurse', or 'skip'\n -D, --devices=ACTION how " "to handle devices, FIFOs and sockets;\n " " ACTION is 'read' or 'skip'\n -r, --recursive " "like --directories=recurse\n -R, --dereference-recursive " "likewise, but follow all symlinks\n")); printf(gettext(" --include=GLOB search only files that match " "GLOB (a file pattern)\n --exclude=GLOB skip " "files that match GLOB\n --exclude-from=FILE skip " "files that match any file pattern from FILE\n " "--exclude-dir=GLOB skip directories that match GLOB\n")); printf(gettext(" -L, --files-without-match print only names of FILEs " "with no selected lines\n -l, --files-with-matches print " "only names of FILEs with selected lines\n -c, --count " " print only a count of selected lines per FILE\n " "-T, --initial-tab make tabs line up (if needed)\n " "-Z, --null print 0 byte after FILE name\n")); printf(gettext("\nContext control:\n -B, --before-context=NUM print NUM " "lines of leading context\n -A, --after-context=NUM " "print NUM lines of trailing context\n -C, --context=NUM " " print NUM lines of output context\n")); printf(gettext( " -NUM same as --context=NUM\n " "--group-separator=SEP print SEP on line between matches with " "context\n --no-group-separator do not print separator for " "matches with context\n --color[=WHEN],\n --colour[=WHEN] " " use markers to highlight the matching strings;\n " " WHEN is 'always', 'never', or 'auto'\n -U, --binary " " do not strip CR characters at EOL (MSDOS/Windows)\n\n")); printf(gettext( "When FILE is '-', read standard input. With no FILE, read '.' " "if\nrecursive, '-' otherwise. With fewer than two FILEs, assume " "-h.\nExit status is 0 if any line is selected, 1 otherwise;\nif any " "error occurs and -q is not given, the exit status is 2.\n")); emit_bug_reporting_address(a0, getprogname(), v7, v8, v9, v10); } exit(a0); }
grep
angr_phoenix
static int iprule_modify(int cmd, int argc, char **argv) { int l3mdev_rule = 0; int table_ok = 0; __u32 tid = 0; struct { struct nlmsghdr n; struct fib_rule_hdr frh; char buf[1024]; } req = { .n.nlmsg_type = cmd, .n.nlmsg_len = ((sizeof(struct fib_rule_hdr)) + ((int)(((sizeof(struct nlmsghdr)) + 4U - 1) & ~(4U - 1)))), .n.nlmsg_flags = 0x01, .frh.family = preferred_family, .frh.action = FR_ACT_UNSPEC, }; if (cmd == RTM_NEWRULE) { if (argc == 0) { fprintf(stderr, "\"ip rule add\" requires arguments.\n"); return -1; } req.n.nlmsg_flags |= 0x400 | 0x200; req.frh.action = FR_ACT_TO_TBL; } if (cmd == RTM_DELRULE && argc == 0) { fprintf(stderr, "\"ip rule del\" requires arguments.\n"); return -1; } while (argc > 0) { if (strcmp(*argv, "not") == 0) { req.frh.flags |= 0x00000002; } else if (strcmp(*argv, "from") == 0) { inet_prefix dst; do { argv++; if (--argc <= 0) incomplete_command(); } while (0); get_prefix(&dst, *argv, req.frh.family); req.frh.src_len = dst.bitlen; addattr_l(&req.n, sizeof(req), FRA_SRC, &dst.data, dst.bytelen); } else if (strcmp(*argv, "to") == 0) { inet_prefix dst; do { argv++; if (--argc <= 0) incomplete_command(); } while (0); get_prefix(&dst, *argv, req.frh.family); req.frh.dst_len = dst.bitlen; addattr_l(&req.n, sizeof(req), FRA_DST, &dst.data, dst.bytelen); } else if (matches(*argv, "preference") == 0 || matches(*argv, "order") == 0 || matches(*argv, "priority") == 0) { __u32 pref; do { argv++; if (--argc <= 0) incomplete_command(); } while (0); if (get_u32(&pref, *argv, 0)) invarg("preference value is invalid\n", *argv); addattr32(&req.n, sizeof(req), FRA_PRIORITY, pref); } else if (strcmp(*argv, "tos") == 0 || matches(*argv, "dsfield") == 0) { __u32 tos; do { argv++; if (--argc <= 0) incomplete_command(); } while (0); if (rtnl_dsfield_a2n(&tos, *argv)) invarg("TOS value is invalid\n", *argv); req.frh.tos = tos; } else if (strcmp(*argv, "fwmark") == 0) { char *slash; __u32 fwmark, fwmask; do { argv++; if (--argc <= 0) incomplete_command(); } while (0); slash = strchr(*argv, '/'); if (slash != ((void *)0)) *slash = '\0'; if (get_u32(&fwmark, *argv, 0)) invarg("fwmark value is invalid\n", *argv); addattr32(&req.n, sizeof(req), FRA_FWMARK, fwmark); if (slash) { if (get_u32(&fwmask, slash + 1, 0)) invarg("fwmask value is invalid\n", slash + 1); addattr32(&req.n, sizeof(req), FRA_FWMASK, fwmask); } } else if (matches(*argv, "realms") == 0) { __u32 realm; do { argv++; if (--argc <= 0) incomplete_command(); } while (0); if (get_rt_realms_or_raw(&realm, *argv)) invarg("invalid realms\n", *argv); addattr32(&req.n, sizeof(req), FRA_FLOW, realm); } else if (matches(*argv, "protocol") == 0) { __u32 proto; do { argv++; if (--argc <= 0) incomplete_command(); } while (0); if (rtnl_rtprot_a2n(&proto, *argv)) invarg("\"protocol\" value is invalid\n", *argv); addattr8(&req.n, sizeof(req), FRA_PROTOCOL, proto); } else if (matches(*argv, "tun_id") == 0) { __u64 tun_id; do { argv++; if (--argc <= 0) incomplete_command(); } while (0); if (get_be64(&tun_id, *argv, 0)) invarg("\"tun_id\" value is invalid\n", *argv); addattr64(&req.n, sizeof(req), FRA_TUN_ID, tun_id); } else if (matches(*argv, "table") == 0 || strcmp(*argv, "lookup") == 0) { do { argv++; if (--argc <= 0) incomplete_command(); } while (0); if (rtnl_rttable_a2n(&tid, *argv)) invarg("invalid table ID\n", *argv); if (tid < 256) req.frh.table = tid; else { req.frh.table = RT_TABLE_UNSPEC; addattr32(&req.n, sizeof(req), FRA_TABLE, tid); } table_ok = 1; } else if (matches(*argv, "suppress_prefixlength") == 0 || strcmp(*argv, "sup_pl") == 0) { int pl; do { argv++; if (--argc <= 0) incomplete_command(); } while (0); if (get_s32(&pl, *argv, 0) || pl < 0) invarg("suppress_prefixlength value is invalid\n", *argv); addattr32(&req.n, sizeof(req), FRA_SUPPRESS_PREFIXLEN, pl); } else if (matches(*argv, "suppress_ifgroup") == 0 || strcmp(*argv, "sup_group") == 0) { do { argv++; if (--argc <= 0) incomplete_command(); } while (0); int group; if (rtnl_group_a2n(&group, *argv)) invarg("Invalid \"suppress_ifgroup\" value\n", *argv); addattr32(&req.n, sizeof(req), FRA_SUPPRESS_IFGROUP, group); } else if (strcmp(*argv, "dev") == 0 || strcmp(*argv, "iif") == 0) { do { argv++; if (--argc <= 0) incomplete_command(); } while (0); if (check_ifname(*argv)) invarg("\"iif\"/\"dev\" not a valid ifname", *argv); addattr_l(&req.n, sizeof(req), FRA_IIFNAME, *argv, strlen(*argv) + 1); } else if (strcmp(*argv, "oif") == 0) { do { argv++; if (--argc <= 0) incomplete_command(); } while (0); if (check_ifname(*argv)) invarg("\"oif\" not a valid ifname", *argv); addattr_l(&req.n, sizeof(req), FRA_OIFNAME, *argv, strlen(*argv) + 1); } else if (strcmp(*argv, "l3mdev") == 0) { addattr8(&req.n, sizeof(req), FRA_L3MDEV, 1); table_ok = 1; l3mdev_rule = 1; } else if (strcmp(*argv, "uidrange") == 0) { struct fib_rule_uid_range r; do { argv++; if (--argc <= 0) incomplete_command(); } while (0); if (sscanf(*argv, "%u-%u", &r.start, &r.end) != 2) invarg("invalid UID range\n", *argv); addattr_l(&req.n, sizeof(req), FRA_UID_RANGE, &r, sizeof(r)); } else if (strcmp(*argv, "nat") == 0 || matches(*argv, "map-to") == 0) { do { argv++; if (--argc <= 0) incomplete_command(); } while (0); fprintf(stderr, "Warning: route NAT is deprecated\n"); addattr32(&req.n, sizeof(req), RTA_GATEWAY, get_addr32(*argv)); req.frh.action = RTN_NAT; } else if (strcmp(*argv, "ipproto") == 0) { int ipproto; do { argv++; if (--argc <= 0) incomplete_command(); } while (0); ipproto = inet_proto_a2n(*argv); if (ipproto < 0) invarg("Invalid \"ipproto\" value\n", *argv); addattr8(&req.n, sizeof(req), FRA_IP_PROTO, ipproto); } else if (strcmp(*argv, "sport") == 0) { struct fib_rule_port_range r; int ret = 0; do { argv++; if (--argc <= 0) incomplete_command(); } while (0); ret = sscanf(*argv, "%hu-%hu", &r.start, &r.end); if (ret == 1) r.end = r.start; else if (ret != 2) invarg("invalid port range\n", *argv); addattr_l(&req.n, sizeof(req), FRA_SPORT_RANGE, &r, sizeof(r)); } else if (strcmp(*argv, "dport") == 0) { struct fib_rule_port_range r; int ret = 0; do { argv++; if (--argc <= 0) incomplete_command(); } while (0); ret = sscanf(*argv, "%hu-%hu", &r.start, &r.end); if (ret == 1) r.end = r.start; else if (ret != 2) invarg("invalid dport range\n", *argv); addattr_l(&req.n, sizeof(req), FRA_DPORT_RANGE, &r, sizeof(r)); } else { int type; if (strcmp(*argv, "type") == 0) do { argv++; if (--argc <= 0) incomplete_command(); } while (0); if (matches(*argv, "help") == 0) usage(); else if (matches(*argv, "goto") == 0) { __u32 target; type = FR_ACT_GOTO; do { argv++; if (--argc <= 0) incomplete_command(); } while (0); if (get_u32(&target, *argv, 0)) invarg("invalid target\n", *argv); addattr32(&req.n, sizeof(req), FRA_GOTO, target); } else if (matches(*argv, "nop") == 0) type = FR_ACT_NOP; else if (rtnl_rtntype_a2n(&type, *argv)) invarg("Failed to parse rule type", *argv); req.frh.action = type; table_ok = 1; } argc--; argv++; } if (l3mdev_rule && tid != 0) { fprintf(stderr, "table can not be specified for l3mdev rules\n"); return -22; } if (req.frh.family == 0) req.frh.family = 2; if (!table_ok && cmd == RTM_NEWRULE) req.frh.table = RT_TABLE_MAIN; if (rtnl_talk(&rth, &req.n, ((void *)0)) < 0) return -2; return 0; }
long iprule_modify(int a1, int a2, const char **a3) { short v4; int v5; int v6; unsigned int addr32; int v9; unsigned int v10; unsigned int v11; int v12; int v13; int v14; int v15; int v16; char *v17; long v18; char v19[2]; unsigned short v20; short v21; _BYTE v22[264]; int v23[266]; unsigned long v24; v9 = a2; v24 = __readfsqword(0x28u); v12 = 0; v13 = 0; v10 = 0; memset(v23, 0, 1052); v23[0] = 28; LOWORD(v23[1]) = a1; HIWORD(v23[1]) = 1; LOBYTE(v23[4]) = preferred_family; if (a1 == 32) { if (!a2) { fprintf(stderr, "\"ip rule add\" requires arguments.\n"); return 0xFFFFFFFFLL; } LOBYTE(v4) = BYTE2(v23[1]); HIBYTE(v4) = HIBYTE(v23[1]) | 6; HIWORD(v23[1]) = v4; HIBYTE(v23[5]) = 1; } if (a1 != 33 || a2) { while (v9 > 0) { if (!strcmp(*a3, "not")) { v23[6] |= 2u; } else if (!strcmp(*a3, "from")) { ++a3; if (--v9 <= 0) incomplete_command(); get_prefix(v19, *a3, LOBYTE(v23[4])); BYTE2(v23[4]) = v21; addattr_l(v23, 1052LL, 2LL, v22, v20); } else if (!strcmp(*a3, "to")) { ++a3; if (--v9 <= 0) incomplete_command(); get_prefix(v19, *a3, LOBYTE(v23[4])); BYTE1(v23[4]) = v21; addattr_l(v23, 1052LL, 1LL, v22, v20); } else if ((unsigned char)matches(*a3, "preference") != 1 || (unsigned char)matches(*a3, "order") != 1 || (unsigned char)matches(*a3, "priority") != 1) { ++a3; if (--v9 <= 0) incomplete_command(); if ((unsigned int)get_u32(&v18, *a3, 0LL)) invarg("preference value is invalid\n", *a3); addattr32(v23, 1052LL, 6LL, (unsigned int)v18); } else if (!strcmp(*a3, "tos") || (unsigned char)matches(*a3, "dsfield") != 1) { ++a3; if (--v9 <= 0) incomplete_command(); if ((unsigned int)rtnl_dsfield_a2n(&v18, *a3)) invarg("TOS value is invalid\n", *a3); HIBYTE(v23[4]) = v18; } else if (!strcmp(*a3, "fwmark")) { ++a3; if (--v9 <= 0) incomplete_command(); v17 = strchr(*a3, 47); if (v17) *v17 = 0; if ((unsigned int)get_u32(&v11, *a3, 0LL)) invarg("fwmark value is invalid\n", *a3); addattr32(v23, 1052LL, 10LL, v11); if (v17) { if ((unsigned int)get_u32(&v18, v17 + 1, 0LL)) invarg("fwmask value is invalid\n", v17 + 1); addattr32(v23, 1052LL, 16LL, (unsigned int)v18); } } else if ((unsigned char)matches(*a3, "realms") != 1) { ++a3; if (--v9 <= 0) incomplete_command(); if ((unsigned int)get_rt_realms_or_raw(&v18, *a3)) invarg("invalid realms\n", *a3); addattr32(v23, 1052LL, 11LL, (unsigned int)v18); } else if ((unsigned char)matches(*a3, "protocol") != 1) { ++a3; if (--v9 <= 0) incomplete_command(); if ((unsigned int)rtnl_rtprot_a2n(&v18, *a3)) invarg("\"protocol\" value is invalid\n", *a3); addattr8(v23, 1052LL, 21LL, (unsigned char)v18); } else if ((unsigned char)matches(*a3, "tun_id") != 1) { ++a3; if (--v9 <= 0) incomplete_command(); if ((unsigned int)get_be64(&v18, *a3, 0LL)) invarg("\"tun_id\" value is invalid\n", *a3); addattr64(v23, 1052LL, 12LL, v18); } else if ((unsigned char)matches(*a3, "table") != 1 || !strcmp(*a3, "lookup")) { ++a3; if (--v9 <= 0) incomplete_command(); if ((unsigned int)rtnl_rttable_a2n(&v10, *a3)) invarg("invalid table ID\n", *a3); if (v10 > 0xFF) { LOBYTE(v23[5]) = 0; addattr32(v23, 1052LL, 15LL, v10); } else { LOBYTE(v23[5]) = v10; } v13 = 1; } else if ((unsigned char)matches(*a3, "suppress_prefixlength") != 1 || !strcmp(*a3, "sup_pl")) { ++a3; if (--v9 <= 0) incomplete_command(); if ((unsigned int)get_s32(&v18, *a3, 0LL) || (int)v18 < 0) invarg("suppress_prefixlength value is invalid\n", *a3); addattr32(v23, 1052LL, 14LL, (unsigned int)v18); } else if ((unsigned char)matches(*a3, "suppress_ifgroup") != 1 || !strcmp(*a3, "sup_group")) { ++a3; if (--v9 <= 0) incomplete_command(); if ((unsigned int)rtnl_group_a2n(&v18, *a3)) invarg("Invalid \"suppress_ifgroup\" value\n", *a3); addattr32(v23, 1052LL, 13LL, (unsigned int)v18); } else if (!strcmp(*a3, "dev") || !strcmp(*a3, "iif")) { ++a3; if (--v9 <= 0) incomplete_command(); if ((unsigned int)check_ifname(*a3)) invarg("\"iif\"/\"dev\" not a valid ifname", *a3); v5 = strlen(*a3); addattr_l(v23, 1052LL, 3LL, *a3, (unsigned int)(v5 + 1)); } else if (!strcmp(*a3, "oif")) { ++a3; if (--v9 <= 0) incomplete_command(); if ((unsigned int)check_ifname(*a3)) invarg("\"oif\" not a valid ifname", *a3); v6 = strlen(*a3); addattr_l(v23, 1052LL, 17LL, *a3, (unsigned int)(v6 + 1)); } else if (!strcmp(*a3, "l3mdev")) { addattr8(v23, 1052LL, 19LL, 1LL); v13 = 1; v12 = 1; } else if (!strcmp(*a3, "uidrange")) { ++a3; if (--v9 <= 0) incomplete_command(); if ((unsigned int)_isoc99_sscanf(*a3, "%u-%u", &v18, (char *)&v18 + 4) != 2) invarg("invalid UID range\n", *a3); addattr_l(v23, 1052LL, 20LL, &v18, 8LL); } else if (!strcmp(*a3, "nat") || (unsigned char)matches(*a3, "map-to") != 1) { ++a3; if (--v9 <= 0) incomplete_command(); fprintf(stderr, "Warning: route NAT is deprecated\n"); addr32 = get_addr32(*a3); addattr32(v23, 1052LL, 5LL, addr32); HIBYTE(v23[5]) = 10; } else if (!strcmp(*a3, "ipproto")) { ++a3; if (--v9 <= 0) incomplete_command(); v16 = inet_proto_a2n(*a3); if (v16 < 0) invarg("Invalid \"ipproto\" value\n", *a3); addattr8(v23, 1052LL, 22LL, (unsigned char)v16); } else if (!strcmp(*a3, "sport")) { v15 = 0; ++a3; if (--v9 <= 0) incomplete_command(); v15 = _isoc99_sscanf(*a3, "%hu-%hu", &v18, (char *)&v18 + 2); if (v15 == 1) { WORD1(v18) = v18; } else if (v15 != 2) { invarg("invalid port range\n", *a3); } addattr_l(v23, 1052LL, 23LL, &v18, 4LL); } else if (!strcmp(*a3, "dport")) { v14 = 0; ++a3; if (--v9 <= 0) incomplete_command(); v14 = _isoc99_sscanf(*a3, "%hu-%hu", &v18, (char *)&v18 + 2); if (v14 == 1) { WORD1(v18) = v18; } else if (v14 != 2) { invarg("invalid dport range\n", *a3); } addattr_l(v23, 1052LL, 24LL, &v18, 4LL); } else { if (!strcmp(*a3, "type")) { ++a3; if (--v9 <= 0) incomplete_command(); } if ((unsigned char)matches(*a3, "help") != 1) usage(); if ((unsigned char)matches(*a3, "goto") != 1) { v11 = 2; ++a3; if (--v9 <= 0) incomplete_command(); if ((unsigned int)get_u32(&v18, *a3, 0LL)) invarg("invalid target\n", *a3); addattr32(v23, 1052LL, 4LL, (unsigned int)v18); } else if ((unsigned char)matches(*a3, "nop") != 1) { v11 = 3; } else if ((unsigned int)rtnl_rtntype_a2n(&v11, *a3)) { invarg("Failed to parse rule type", *a3); } HIBYTE(v23[5]) = v11; v13 = 1; } --v9; ++a3; } if (v12 && v10) { fprintf(stderr, "table can not be specified for l3mdev rules\n"); return 4294967274LL; } else { if (!LOBYTE(v23[4])) LOBYTE(v23[4]) = 2; if (!v13 && a1 == 32) LOBYTE(v23[5]) = -2; if ((int)rtnl_talk(&rth, v23, 0LL) >= 0) return 0LL; else return 4294967294LL; } } else { fprintf(stderr, "\"ip rule del\" requires arguments.\n"); return 0xFFFFFFFFLL; } }
iproute2-6.0.0
ida
strlen (tspec->fmt_string) < FMT_BYTES_ALLOCATED ) ? 1 : 0), __extension__ ({ if (strlen(tspec->fmt_string) < FMT_BYTES_ALLOCATED) ; else __assert_fail("strlen (tspec->fmt_string) < FMT_BYTES_ALLOCATED", "src/od.c", 747, __extension__ __PRETTY_FUNCTION__); }))
size_t strlen(char *__s) { halt_baddata(); }
coreutils
ghidra
char *svis(char *mbdst, int c, int flags, int nextc, const char *mbextra) { char cc[2]; int ret; cc[0] = c; cc[1] = nextc; ret = istrsenvisx(&mbdst, ((void *)0), cc, 1, flags, mbextra, ((void *)0)); if (ret < 0) return ((void *)0); return mbdst + ret; }
long long svis(unsigned long a0, unsigned long a1, unsigned long a2, unsigned long a3, void *a4) { char v0; unsigned int v1; char v2; char v3; void *v5; v2 = a1; v3 = a3; v1 = istrsenvisx(&v0, NULL, &v2, 0x1, a2, a4, 0x0); if (v1 < 0) v5 = 0; else v5 = v1 + a0; return v5; }
libedit
angr_phoenix
static void socket_starttls(socket_st *socket) { char buf[512]; if (socket->secure) return; if (socket->app_proto == ((void *)0) || strcasecmp(socket->app_proto, "https") == 0) return; if (strcasecmp(socket->app_proto, "smtp") == 0 || strcasecmp(socket->app_proto, "submission") == 0) { if (socket->verbose) log_msg(stdout, "Negotiating SMTP STARTTLS\n"); wait_for_text(socket, "220 ", 4); snprintf(buf, sizeof(buf), "EHLO %s\r\n", socket->hostname); send_line(socket, buf); wait_for_text(socket, "250 ", 4); send_line(socket, "STARTTLS\r\n"); wait_for_text(socket, "220 ", 4); } else if (strcasecmp(socket->app_proto, "imap") == 0 || strcasecmp(socket->app_proto, "imap2") == 0) { if (socket->verbose) log_msg(stdout, "Negotiating IMAP STARTTLS\n"); send_line(socket, "a CAPABILITY\r\n"); wait_for_text(socket, "a OK", 4); send_line(socket, "a STARTTLS\r\n"); wait_for_text(socket, "a OK", 4); } else if (strcasecmp(socket->app_proto, "xmpp") == 0) { if (socket->verbose) log_msg(stdout, "Negotiating XMPP STARTTLS\n"); snprintf(buf, sizeof(buf), "<stream:stream xmlns:stream='http: send_line(socket, buf); wait_for_text(socket, "<?", 2); send_line(socket, "<starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>"); wait_for_text(socket, "<proceed", 8); } else if (strcasecmp(socket->app_proto, "ldap") == 0) { if (socket->verbose) log_msg(stdout, "Negotiating LDAP STARTTLS\n"); send(socket->fd, "\x30\x1d\x02\x01\x01\x77\x18\x80\x16\x31\x2e\x33\x2e\x36\x2e\x31\x2e" "\x34\x2e\x31\x2e\x31\x34\x36\x36\x2e\x32\x30\x30\x33\x37", sizeof( "\x30\x1d\x02\x01\x01\x77\x18\x80\x16\x31\x2e\x33\x2e\x36\x2e\x31" "\x2e\x34\x2e\x31\x2e\x31\x34\x36\x36\x2e\x32\x30\x30\x33\x37") - 1, 0); wait_for_text(socket, ((void *)0), 0); } else if (strcasecmp(socket->app_proto, "ftp") == 0 || strcasecmp(socket->app_proto, "ftps") == 0) { if (socket->verbose) log_msg(stdout, "Negotiating FTP STARTTLS\n"); send_line(socket, "FEAT\r\n"); wait_for_text(socket, "211 ", 4); send_line(socket, "AUTH TLS\r\n"); wait_for_text(socket, "234", 3); } else if (strcasecmp(socket->app_proto, "lmtp") == 0) { if (socket->verbose) log_msg(stdout, "Negotiating LMTP STARTTLS\n"); wait_for_text(socket, "220 ", 4); snprintf(buf, sizeof(buf), "LHLO %s\r\n", socket->hostname); send_line(socket, buf); wait_for_text(socket, "250 ", 4); send_line(socket, "STARTTLS\r\n"); wait_for_text(socket, "220 ", 4); } else if (strcasecmp(socket->app_proto, "pop3") == 0) { if (socket->verbose) log_msg(stdout, "Negotiating POP3 STARTTLS\n"); wait_for_text(socket, "+OK", 3); send_line(socket, "STLS\r\n"); wait_for_text(socket, "+OK", 3); } else if (strcasecmp(socket->app_proto, "nntp") == 0) { if (socket->verbose) log_msg(stdout, "Negotiating NNTP STARTTLS\n"); wait_for_text(socket, "200 ", 4); send_line(socket, "STARTTLS\r\n"); wait_for_text(socket, "382 ", 4); } else if (strcasecmp(socket->app_proto, "sieve") == 0) { if (socket->verbose) log_msg(stdout, "Negotiating Sieve STARTTLS\n"); wait_for_text(socket, "OK ", 3); send_line(socket, "STARTTLS\r\n"); wait_for_text(socket, "OK ", 3); } else if (strcasecmp(socket->app_proto, "postgres") == 0 || strcasecmp(socket->app_proto, "postgresql") == 0) { if (socket->verbose) log_msg(stdout, "Negotiating PostgreSQL STARTTLS\n"); send(socket->fd, "\x00\x00\x00\x08\x04\xD2\x16\x2F", sizeof("\x00\x00\x00\x08\x04\xD2\x16\x2F") - 1, 0); wait_for_text(socket, ((void *)0), 0); } else { if (!c_isdigit(socket->app_proto[0])) { static int warned = 0; if (warned == 0) { fprintf(stderr, "unknown protocol '%s'\n", socket->app_proto); warned = 1; } } } return; }
void socket_starttls(int *param_1) { char cVar1; int iVar2; long in_FS_OFFSET; char local_218[520]; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); if (((param_1[4] == 0) && (*(long *)(param_1 + 8) != 0)) && (iVar2 = strcasecmp(*(char **)(param_1 + 8), "https"), iVar2 != 0)) { iVar2 = strcasecmp(*(char **)(param_1 + 8), "smtp"); if ((iVar2 == 0) || (iVar2 = strcasecmp(*(char **)(param_1 + 8), "submission"), iVar2 == 0)) { if (param_1[0x12] != 0) { log_msg(stdout, "Negotiating SMTP STARTTLS\n"); } wait_for_text(param_1, &DAT_00102090, 4); snprintf(local_218, 0x200, "EHLO %s\r\n", *(undefined8 *)(param_1 + 6)); send_line(param_1, local_218); wait_for_text(param_1, &DAT_0010209f, 4); send_line(param_1, "STARTTLS\r\n"); wait_for_text(param_1, &DAT_00102090, 4); } else { iVar2 = strcasecmp(*(char **)(param_1 + 8), "imap"); if ((iVar2 == 0) || (iVar2 = strcasecmp(*(char **)(param_1 + 8), "imap2"), iVar2 == 0)) { if (param_1[0x12] != 0) { log_msg(stdout, "Negotiating IMAP STARTTLS\n"); } send_line(param_1, "a CAPABILITY\r\n"); wait_for_text(param_1, &DAT_001020e4, 4); send_line(param_1, "a STARTTLS\r\n"); wait_for_text(param_1, &DAT_001020e4, 4); } else { iVar2 = strcasecmp(*(char **)(param_1 + 8), "xmpp"); if (iVar2 == 0) { if (param_1[0x12] != 0) { log_msg(stdout, "Negotiating XMPP STARTTLS\n"); } snprintf(local_218, 0x200, "<stream:stream xmlns:stream=\'http: , *(undefined8 *)(param_1 + 6)); send_line(param_1, local_218); wait_for_text(param_1, &DAT_00102185, 2); send_line(param_1, "<starttls xmlns=\'urn:ietf:params:xml:ns:xmpp-tls\'/>"); wait_for_text(param_1, "<proceed", 8); } else { iVar2 = strcasecmp(*(char **)(param_1 + 8), "ldap"); if (iVar2 == 0) { if (param_1[0x12] != 0) { log_msg(stdout, "Negotiating LDAP STARTTLS\n"); } send(*param_1, &DAT_001021e8, 0x1f, 0); wait_for_text(param_1, 0, 0); } else { iVar2 = strcasecmp(*(char **)(param_1 + 8), "ftp"); if ((iVar2 == 0) || (iVar2 = strcasecmp(*(char **)(param_1 + 8), "ftps"), iVar2 == 0)) { if (param_1[0x12] != 0) { log_msg(stdout, "Negotiating FTP STARTTLS\n"); } send_line(param_1, "FEAT\r\n"); wait_for_text(param_1, &DAT_00102232, 4); send_line(param_1, "AUTH TLS\r\n"); wait_for_text(param_1, &DAT_00102242, 3); } else { iVar2 = strcasecmp(*(char **)(param_1 + 8), "lmtp"); if (iVar2 == 0) { if (param_1[0x12] != 0) { log_msg(stdout, "Negotiating LMTP STARTTLS\n"); } wait_for_text(param_1, &DAT_00102090, 4); snprintf(local_218, 0x200, "LHLO %s\r\n", *(undefined8 *)(param_1 + 6)); send_line(param_1, local_218); wait_for_text(param_1, &DAT_0010209f, 4); send_line(param_1, "STARTTLS\r\n"); wait_for_text(param_1, &DAT_00102090, 4); } else { iVar2 = strcasecmp(*(char **)(param_1 + 8), "pop3"); if (iVar2 == 0) { if (param_1[0x12] != 0) { log_msg(stdout, "Negotiating POP3 STARTTLS\n"); } wait_for_text(param_1, &DAT_00102290, 3); send_line(param_1, "STLS\r\n"); wait_for_text(param_1, &DAT_00102290, 3); } else { iVar2 = strcasecmp(*(char **)(param_1 + 8), "nntp"); if (iVar2 == 0) { if (param_1[0x12] != 0) { log_msg(stdout, "Negotiating NNTP STARTTLS\n"); } wait_for_text(param_1, &DAT_001022bb, 4); send_line(param_1, "STARTTLS\r\n"); wait_for_text(param_1, &DAT_001022c0, 4); } else { iVar2 = strcasecmp(*(char **)(param_1 + 8), "sieve"); if (iVar2 == 0) { if (param_1[0x12] != 0) { log_msg(stdout, "Negotiating Sieve STARTTLS\n"); } wait_for_text(param_1, &DAT_001022e7, 3); send_line(param_1, "STARTTLS\r\n"); wait_for_text(param_1, &DAT_001022e7, 3); } else { iVar2 = strcasecmp(*(char **)(param_1 + 8), "postgres"); if ((iVar2 == 0) || (iVar2 = strcasecmp(*(char **)(param_1 + 8), "postgresql"), iVar2 == 0)) { if (param_1[0x12] != 0) { log_msg(stdout, "Negotiating PostgreSQL STARTTLS\n"); } send(*param_1, &DAT_00102321, 8, 0); wait_for_text(param_1, 0, 0); } else { cVar1 = c_isdigit((int)**(char **)(param_1 + 8)); if ((cVar1 != '\x01') && (warned_11693 == 0)) { fprintf(stderr, "unknown protocol \'%s\'\n", *(undefined8 *)(param_1 + 8)); warned_11693 = 1; } } } } } } } } } } } } if (local_10 == *(long *)(in_FS_OFFSET + 0x28)) { return; } __stack_chk_fail(); }
gnutls
ghidra
void clean_itemlist(itp) ITEMLIST *itp; { STRINGLIST *sl; sl = itp->slist; if (sl) { if ((itp->flags & (0x020 | 0x010)) == 0) strvec_flush(sl->list); if ((itp->flags & 0x010) == 0) sh_xfree((sl->list), "pcomplete.c", 249); sh_xfree((sl), "pcomplete.c", 250); } itp->slist = (STRINGLIST *)((void *)0); itp->flags &= ~(0x010 | 0x020 | 0x004 | 0x002); }
void clean_itemlist(uint *param_1) { undefined8 *puVar1; puVar1 = *(undefined8 **)(param_1 + 4); if (puVar1 != (undefined8 *)0x0) { if ((*param_1 & 0x30) == 0) { strvec_flush(*puVar1); } if ((*param_1 & 0x10) == 0) { sh_xfree(*puVar1, "pcomplete.c", 0xf9); } sh_xfree(puVar1, "pcomplete.c", 0xfa); } *(undefined8 *)(param_1 + 4) = 0; *param_1 = *param_1 & 0xffffffc9; return; }
bash
ghidra