input
stringlengths
26
172k
output
stringlengths
18
318k
repo_name
stringclasses
23 values
decompiler
stringclasses
5 values
int ssh_packet_set_maxsize(struct ssh *ssh, u_int s) { struct session_state *state = ssh->state; if (state->set_maxsize_called) { sshlog("packet.c", __func__, 2110, 1, SYSLOG_LEVEL_INFO, ((void *)0), "called twice: old %d new %d", state->max_packet_size, s); return -1; } if (s < 4 * 1024 || s > 1024 * 1024) { sshlog("packet.c", __func__, 2115, 1, SYSLOG_LEVEL_INFO, ((void *)0), "bad size %d", s); return -1; } state->set_maxsize_called = 1; sshlog("packet.c", __func__, 2119, 1, SYSLOG_LEVEL_DEBUG1, ((void *)0), "setting to %d", s); state->max_packet_size = s; return s; }
long ssh_packet_set_maxsize(long *a1, unsigned int a2) { long v3; v3 = *a1; if (*(_DWORD *)(*a1 + 488)) { sshlog("packet.c", "ssh_packet_set_maxsize", 2110LL, 1LL, 3LL, 0LL, "called twice: old %d new %d", *(unsigned int *)(v3 + 312), a2); return 0xFFFFFFFFLL; } else if (a2 > 0xFFF && a2 <= 0x100000) { *(_DWORD *)(v3 + 488) = 1; sshlog("packet.c", "ssh_packet_set_maxsize", 2119LL, 1LL, 5LL, 0LL, "setting to %d", a2); *(_DWORD *)(v3 + 312) = a2; return a2; } else { sshlog("packet.c", "ssh_packet_set_maxsize", 2115LL, 1LL, 3LL, 0LL, "bad size %d", a2); return 0xFFFFFFFFLL; } }
openssh-portable
ida
static void show_diff(const char *old, const char *new) { struct pager *pager; pid_t pid; pager = pager_spawn(gettext("conffile difference visualizer")); pid = subproc_fork(); if (!pid) { struct command cmd; command_init(&cmd, "diff", gettext("conffile difference visualizer")); command_add_arg(&cmd, "diff"); command_add_arg(&cmd, "-Nu"); command_add_arg(&cmd, old); command_add_arg(&cmd, new); command_exec(&cmd); } subproc_reap(pid, gettext("conffile difference visualizer"), SUBPROC_NOCHECK); pager_reap(pager); }
void show_diff(undefined8 param_1, undefined8 param_2) { int iVar1; undefined8 uVar2; undefined8 uVar3; long in_FS_OFFSET; undefined local_38[40]; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); uVar2 = gettext("conffile difference visualizer"); uVar2 = pager_spawn(uVar2); iVar1 = subproc_fork(); if (iVar1 == 0) { uVar3 = gettext("conffile difference visualizer"); command_init(local_38, &DAT_0010268f, uVar3); command_add_arg(local_38, &DAT_0010268f); command_add_arg(local_38, &DAT_00102694); command_add_arg(local_38, param_1); command_add_arg(local_38, param_2); command_exec(local_38); } uVar3 = gettext("conffile difference visualizer"); subproc_reap(iVar1, uVar3, 4); pager_reap(uVar2); if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) { __stack_chk_fail(); } return; }
dpkg
ghidra
char *cleanhostname(char *host) { if (*host == '[' && host[strlen(host) - 1] == ']') { host[strlen(host) - 1] = '\0'; return (host + 1); } else return host; }
int cleanhostname(char *a0) { char v1; unsigned int v2; if (*(a0) == 91) { v1 = a0[1 + strlen(a0)]; if (v1 == 93) { a0[1 + strlen(a0)] = 0; v2 = a0 + 1; } } if (*(a0) != 91 || v1 != 93) v2 = a0; return v2; }
openssh-portable
angr_dream
static void format_user(uid_t u, int width, _Bool stat_ok) { format_user_or_group( !stat_ok ? "?" : (numeric_ids ? ((void *)0) : getuser(u)), u, width); }
void format_user(unsigned long a0, unsigned long a1, unsigned long a2) { unsigned long long v1; unsigned long long v2; if ((a2 ^ 1)) { v1 = "?"; } else if (numeric_ids) { v1 = 0; } else { v1 = getuser(a0); } v2 = format_user_or_group(v1, a0, a1); return; }
coreutils
angr_sailr
printversion(const struct cmdinfo *ci, const char *value) { if (f_robot) { printf("%s", "1.20.12"); } else { printf(gettext("Debian '%s' package management program version %s.\n"), "dpkg", "1.20.12" " (" "amd64" ")"); printf(gettext("This is free software; see the GNU General Public License " "version 2 or\n" "later for copying conditions. There is NO warranty.\n") ); } m_output(stdout, gettext("<standard output>")); exit(0); }
long long printversion() { unsigned long v0; unsigned long v1; unsigned long v3; unsigned long v4; unsigned long long v5; v1 = v3; v0 = v4; if (f_robot) { printf("%s", &g_401340); } else { printf(gettext("Debian '%s' package management program version %s.\n")); printf(gettext( "This is free software; see the GNU General Public License version 2 " "or\nlater for copying conditions. There is NO warranty.\n")); } v5 = gettext("<standard output>"); m_output(stdout, v5, v5); exit(0x0); }
dpkg
angr_phoenix
static void print_heredoc_body(redirect) REDIRECT *redirect; { cprintf("%s%s", redirect->redirectee.filename->word, redirect->here_doc_eof); }
void print_heredoc_body(unsigned long a0) { unsigned long v0; unsigned long long v2; v0 = a0; v2 = cprintf("%s%s"); return; }
bash
angr_dream
int sshpkt_disconnect(struct ssh *ssh, const char *fmt, ...) { char buf[1024]; va_list args; int r; __builtin_va_start(args, fmt); vsnprintf(buf, sizeof(buf), fmt, args); __builtin_va_end(args); if ((r = sshpkt_start(ssh, 1)) != 0 || (r = sshpkt_put_u32(ssh, 2)) != 0 || (r = sshpkt_put_cstring(ssh, buf)) != 0 || (r = sshpkt_put_cstring(ssh, "")) != 0 || (r = sshpkt_send(ssh)) != 0) return r; return 0; }
int sshpkt_disconnect(undefined4 param_1, undefined4 param_2, undefined4 param_3, undefined4 param_4, undefined4 param_5, undefined4 param_6, undefined4 param_7, undefined4 param_8, undefined8 param_9, char *param_10, undefined8 param_11, undefined8 param_12, undefined8 param_13, undefined8 param_14) { char in_AL; int iVar1; long in_FS_OFFSET; undefined4 local_4e0; undefined4 local_4dc; undefined *local_4d8; undefined *local_4d0; char local_4c8[1032]; long local_c0; undefined local_b8[16]; undefined8 local_a8; undefined8 local_a0; undefined8 local_98; undefined8 local_90; undefined4 local_88; undefined4 local_78; undefined4 local_68; undefined4 local_58; undefined4 local_48; undefined4 local_38; undefined4 local_28; undefined4 local_18; if (in_AL != '\0') { local_88 = param_1; local_78 = param_2; local_68 = param_3; local_58 = param_4; local_48 = param_5; local_38 = param_6; local_28 = param_7; local_18 = param_8; } local_c0 = *(long *)(in_FS_OFFSET + 0x28); local_4e0 = 0x10; local_4dc = 0x30; local_4d8 = &stack0x00000008; local_4d0 = local_b8; local_a8 = param_11; local_a0 = param_12; local_98 = param_13; local_90 = param_14; vsnprintf(local_4c8, 0x400, param_10, &local_4e0); iVar1 = sshpkt_start(param_9, 1); if ((((iVar1 == 0) && (iVar1 = sshpkt_put_u32(param_9, 2), iVar1 == 0)) && (iVar1 = sshpkt_put_cstring(param_9, local_4c8), iVar1 == 0)) && ((iVar1 = sshpkt_put_cstring(param_9, &DAT_00107061), iVar1 == 0 && (iVar1 = sshpkt_send(param_9), iVar1 == 0)))) { iVar1 = 0; } if (local_c0 == *(long *)(in_FS_OFFSET + 0x28)) { return iVar1; } __stack_chk_fail(); }
openssh-portable
ghidra
void ssh_sandbox_child(struct ssh_sandbox *box) { struct rlimit rl_zero, rl_one = {.rlim_cur = 1, .rlim_max = 1}; int nnp_failed = 0; rl_zero.rlim_cur = rl_zero.rlim_max = 0; if (setrlimit(RLIMIT_FSIZE, &rl_zero) == -1) sshfatal("sandbox-seccomp-filter.c", __func__, 412, 0, SYSLOG_LEVEL_FATAL, ((void *)0), "%s: setrlimit(RLIMIT_FSIZE, { 0, 0 }): %s", __func__, strerror((*__errno_location()))); if (setrlimit(RLIMIT_NOFILE, &rl_one) == -1) sshfatal("sandbox-seccomp-filter.c", __func__, 419, 0, SYSLOG_LEVEL_FATAL, ((void *)0), "%s: setrlimit(RLIMIT_NOFILE, { 0, 0 }): %s", __func__, strerror((*__errno_location()))); if (setrlimit(__RLIMIT_NPROC, &rl_zero) == -1) sshfatal("sandbox-seccomp-filter.c", __func__, 422, 0, SYSLOG_LEVEL_FATAL, ((void *)0), "%s: setrlimit(RLIMIT_NPROC, { 0, 0 }): %s", __func__, strerror((*__errno_location()))); ssh_sandbox_child_debugging(); sshlog("sandbox-seccomp-filter.c", __func__, 429, 0, SYSLOG_LEVEL_DEBUG3, ((void *)0), "%s: setting PR_SET_NO_NEW_PRIVS", __func__); if (prctl(38, 1, 0, 0, 0) == -1) { sshlog("sandbox-seccomp-filter.c", __func__, 431, 0, SYSLOG_LEVEL_DEBUG1, ((void *)0), "%s: prctl(PR_SET_NO_NEW_PRIVS): %s", __func__, strerror((*__errno_location()))); nnp_failed = 1; } sshlog("sandbox-seccomp-filter.c", __func__, 435, 0, SYSLOG_LEVEL_DEBUG3, ((void *)0), "%s: attaching seccomp filter program", __func__); if (prctl(22, 2, &preauth_program) == -1) sshlog("sandbox-seccomp-filter.c", __func__, 437, 0, SYSLOG_LEVEL_DEBUG1, ((void *)0), "%s: prctl(PR_SET_SECCOMP): %s", __func__, strerror((*__errno_location()))); else if (nnp_failed) sshfatal("sandbox-seccomp-filter.c", __func__, 440, 0, SYSLOG_LEVEL_FATAL, ((void *)0), "%s: SECCOMP_MODE_FILTER activated but " "PR_SET_NO_NEW_PRIVS failed", __func__); }
long long ssh_sandbox_child(unsigned long a0) { unsigned long v0; unsigned long v1; unsigned int v2; void *v3; void *v4; unsigned long long v5; unsigned long long v6; unsigned long long v7; unsigned long v8; unsigned long long v9; char v10; unsigned long long v11; v1 = a0; v5 = 1; v6 = 1; v2 = 0; v4 = 0; v3 = v4; if (setrlimit(0x1, &v3) == -1) { v0 = strerror(*(__errno_location())); sshfatal("sandbox-seccomp-filter.c", "ssh_sandbox_child", 0x19c, 0x0, 0x1, 0x0, "%s: setrlimit(RLIMIT_FSIZE, { 0, 0 }): %s", "ssh_sandbox_child"); } if (setrlimit(0x7, &v5) == -1) { v8 = strerror(*(__errno_location())); v7 = "ssh_sandbox_child"; v6 = "%s: setrlimit(RLIMIT_NOFILE, { 0, 0 }): %s"; sshfatal("sandbox-seccomp-filter.c", "ssh_sandbox_child", 0x1a3, 0x0, 0x1, 0x0, *(&v10), v11); } if (setrlimit(0x6, &v3) == -1) { v8 = strerror(*(__errno_location())); v7 = "ssh_sandbox_child"; v6 = "%s: setrlimit(RLIMIT_NPROC, { 0, 0 }): %s"; sshfatal("sandbox-seccomp-filter.c", "ssh_sandbox_child", 0x1a6, 0x0, 0x1, 0x0, *(&v10), v11); } ssh_sandbox_child_debugging(); v9 = "ssh_sandbox_child"; v8 = "%s: setting PR_SET_NO_NEW_PRIVS"; sshlog("sandbox-seccomp-filter.c", "ssh_sandbox_child", 0x1ad, 0x0, 0x7, 0x0, *(&v10)); if (prctl(0x26, 0x1, 0x0, 0x0, 0x0) == -1) { v8 = strerror(*(__errno_location())); v7 = "ssh_sandbox_child"; v6 = "%s: prctl(PR_SET_NO_NEW_PRIVS): %s"; sshlog("sandbox-seccomp-filter.c", "ssh_sandbox_child", 0x1af, 0x0, 0x5, 0x0, *(&v10)); v2 = 1; } v9 = "ssh_sandbox_child"; v8 = "%s: attaching seccomp filter program"; sshlog("sandbox-seccomp-filter.c", "ssh_sandbox_child", 0x1b3, 0x0, 0x7, 0x0, *(&v10)); if (prctl(0x16, 0x2, "a", 0x0, 0x7) == -1) { v8 = strerror(*(__errno_location())); v7 = "ssh_sandbox_child"; v6 = "%s: prctl(PR_SET_SECCOMP): %s"; sshlog("sandbox-seccomp-filter.c", "ssh_sandbox_child", 0x1b5, 0x0, 0x5, 0x0, *(&v10)); return 0; } if (v2) { v9 = "ssh_sandbox_child"; v8 = "%s: SECCOMP_MODE_FILTER activated but PR_SET_NO_NEW_PRIVS failed"; sshfatal("sandbox-seccomp-filter.c", "ssh_sandbox_child", 0x1b8, 0x0, 0x1, 0x0, *(&v10), v11); } return 0; }
openssh-portable
angr_sailr
static void summarize_regexp_list(struct regexp_list *reglist) { if (reglist->regexps) { reglist->buf->fastmap = xmalloc(1 << 8); if (reglist->multiple_regexps) { char const *m = re_compile_pattern(reglist->regexps, reglist->len, reglist->buf); if (m) ((!!sizeof(struct { _Static_assert( 2, "verify_expr (" "2" ", " "(error (2, 0, \"%s: %s\", reglist->regexps, m), assume (false))" ")"); int _gl_dummy; })) ? ((error(2, 0, "%s: %s", reglist->regexps, m), ((0) ? (void)0 : __builtin_unreachable()))) : ((error(2, 0, "%s: %s", reglist->regexps, m), ((0) ? (void)0 : __builtin_unreachable())))); } } }
void summarize_regexp_list(const char **a1) { const char *v1; const char *v2; if (*a1) { v1 = a1[4]; *((_QWORD *)v1 + 4) = xmalloc(256LL); if (*((_BYTE *)a1 + 24)) { v2 = re_compile_pattern(*a1, (size_t)a1[1], (struct re_pattern_buffer *)a1[4]); if (v2) error(2, 0, "%s: %s", *a1, v2); } } }
diffutils
ida
static void volume_offset_coder(struct tar_stat_info const *st, char const *keyword, struct xheader *xhdr, void const *data) { off_t const *v = data; code_num(*v, keyword, xhdr); }
long long volume_offset_coder(unsigned long a0, unsigned int a1, void *a2, unsigned long long *a3) { unsigned long v0; v0 = a0; return code_num(*(a3), a1, a2); }
tar
angr_sailr
int rl_on_new_line(void) { return 0; }
undefined8 rl_on_new_line(void) { return 0; }
libedit
ghidra
char *last_history_line() { HIST_ENTRY *he; he = last_history_entry(); if (he == 0) return ((char *)((void *)0)); return he->line; }
long long last_history_line(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 long long *v0; v0 = last_history_entry(a0, a1, a2, a3, a4, a5); return (!v0 ? *(v0) : 0); }
bash
angr_sailr
const char *sshkey_type(const struct sshkey *k) { const struct keytype *kt; for (kt = keytypes; kt->type != -1; kt++) { if (kt->type == k->type) return kt->shortname; } return "unknown"; }
int sshkey_type(unsigned int *a0) { unsigned long long v0; unsigned int v2; v0 = &keytypes; while (true) { if (*((v0 + 24)) == -1) { v2 = &g_40bf52; return v2; } else if (*((v0 + 24)) != *(a0)) { v0 += 40; } else { v2 = *((v0 + 8)); return v2; } } }
openssh-portable
angr_sailr
static char *option_list(char **optionvec, int count) { int i; size_t size = 1; char *result; char *p; for (i = 0; i < count; i++) size += 1 + shell_quote_length(optionvec[i]); p = result = xmalloc(size); for (i = 0; i < count; i++) { *p++ = ' '; p = shell_quote_copy(p, optionvec[i]); } *p = '\0'; return result; }
int option_list(unsigned long long *a0, unsigned long a1) { unsigned int v0; int tmp_16; unsigned long long v1; char *v2; unsigned long v3; v1 = 1; for (v0 = 0; v0 < a1; v0 += 1) { v1 += shell_quote_length(a0[v0]) + 1; } v3 = xmalloc(v1); v2 = v3; for (v0 = 0; v0 < a1; v0 += 1) { tmp_16 = v2; v2 += 1; *(tmp_16) = 32; v2 = shell_quote_copy(v2, a0[v0], a0[v0]); } *(v2) = 0; return v3; }
diffutils
angr_dream
void rtrim(char *s) { size_t i; if ((i = strlen(s)) == 0) return; for (i--; i > 0; i--) { if (((*__ctype_b_loc())[(int)(((int)s[i]))] & (unsigned short int)_ISspace)) s[i] = '\0'; } }
long long rtrim(char *a0) { char *v0; unsigned long long v2; v2 = strlen(a0); v0 = v2; if (v0) { for (v0 -= 1; v0; v0 -= 1) { *(&v2) = *((*(__ctype_b_loc()) + *((v0 + a0)) * 2)); v2 = v2 & 0x2000; if (v2) { v2 = v0 + a0; *((v0 + a0)) = 0; } } } return v2; }
openssh-portable
angr_phoenix
int crypto_sign_ed25519_ref_sc25519_iszero_vartime( const crypto_sign_ed25519_ref_sc25519 *x) { int i; for (i = 0; i < 32; i++) if (x->v[i] != 0) return 0; return 1; }
long crypto_sign_ed25519_ref_sc25519_iszero_vartime(long a1) { int i; for (i = 0; i <= 31; ++i) { if (*(_DWORD *)(a1 + 4LL * i)) return 0LL; } return 1LL; }
openssh-portable
ida
void xheader_decode(struct tar_stat_info *st) { run_override_list(keyword_global_override_list, st); run_override_list(global_header_override_list, st); if (st->xhdr.size) { char *p = st->xhdr.buffer + 512; while (decode_record(&st->xhdr, &p, decx, st)) continue; } run_override_list(keyword_override_list, st); st->archive_file_size = st->stat.st_size; if (st->real_size_set) st->stat.st_size = st->real_size; }
long long xheader_decode(struct_0 *a0) { unsigned long v0; run_override_list(keyword_global_override_list, a0); run_override_list(global_header_override_list, a0); if (a0->field_170) { v0 = a0->field_178 + 0x200; do { } while (decode_record(&a0->padding_151[23], &v0, decx, a0)); } run_override_list(keyword_override_list, a0); a0->field_118 = a0->field_88; if (a0->field_150) a0->field_88 = a0->field_148; return 0; }
tar
angr_phoenix
char **env_set(char **envp, const char *envstr) { size_t count, found; char **p, *envtmp; found = (size_t)-1; for (count = 0; envp[count] != ((void *)0); count++) { if (!strcmp_until(envp[count], envstr, '=')) found = count; } count++; if (found != (size_t)-1) { if ((envtmp = strdup(envstr)) == ((void *)0)) return (((void *)0)); free(envp[found]); envp[found] = envtmp; return (envp); } if ((envtmp = strdup(envstr)) == ((void *)0)) return (((void *)0)); p = (char **)realloc((void *)envp, (count + 1) * sizeof(char *)); if (p == ((void *)0)) { free(envtmp); return (((void *)0)); } p[count] = p[count - 1]; p[count - 1] = envtmp; return (p); }
int env_set(unsigned long long a0, char *a1) { void *v0; unsigned long long v1; void *v2; void *v3; unsigned int v5; v1 = -1; for (v0 = 0; *((a0 + (v0 << 3))); v0 += 1) { if (!strcmp_until(*((a0 + (v0 << 3))), a1, 0x3d, a1)) v1 = v0; } v0 += 1; if (v1 != -1) { v2 = strdup(a1); if (!v2) { v5 = 0; } else { free(*((a0 + v1 * 8))); *((v1 * 8 + a0)) = v2; v5 = a0; } } else { v2 = strdup(a1); if (!v2) { v5 = 0; } else { v3 = realloc(a0, (v0 + 1) * 8); if (v3) { *((v3 + 0x8 * v0)) = *((-8 + v3 + 0x8 * v0)); *((-8 + 0x8 * v0 + v3)) = v2; v5 = v3; } else { free(v2); v5 = 0; } } } return v5; }
cronie
angr_phoenix
static inline char *string_extract_single_quoted(string, sindex, allowesc) char *string; int *sindex; int allowesc; { register int i; size_t slen; char *t; int pass_next; mbstate_t state; memset(&state, '\0', sizeof(mbstate_t)); slen = ((__ctype_get_mb_cur_max()) > 1) ? strlen(string + *sindex) + *sindex : 0; i = *sindex; pass_next = 0; while (string[i]) { if (pass_next) { pass_next = 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; } if (allowesc && string[i] == '\\') pass_next++; else if (string[i] == '\'') break; 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); } t = substring(string, *sindex, i); if (string[i]) i++; *sindex = i; return (t); }
long string_extract_single_quoted(long a1, signed int *a2, int a3) { size_t v3; signed int v4; int v7; size_t v8; size_t v9; size_t v10; long v11; long s; long v13; unsigned long v14; v14 = __readfsqword(0x28u); memset(&s, 0, sizeof(s)); if (_ctype_get_mb_cur_max() <= 1) v3 = 0LL; else v3 = *a2 + strlen((const char *)(*a2 + a1)); v10 = v3; v4 = *a2; v7 = 0; while (*(_BYTE *)(v4 + a1)) { if (v7) { v7 = 0; if (locale_mb_cur_max <= 1) { ++v4; } else { if ((unsigned int)is_basic(*(_BYTE *)(v4 + a1))) { v8 = 1LL; } else if (locale_utf8locale && *(char *)(v4 + a1) >= 0) { v8 = *(_BYTE *)(v4 + a1) != 0; } else { v13 = s; v8 = mbrlen((const char *)(v4 + a1), v10 - v4, (mbstate_t *)&s); } if (v8 < 0xFFFFFFFFFFFFFFFELL) { if (v8) v4 += v8; else ++v4; } else { s = v13; ++v4; } } } else { if (a3 && *(_BYTE *)(v4 + a1) == 92) { v7 = 1; } else if (*(_BYTE *)(v4 + a1) == 39) { break; } if (locale_mb_cur_max <= 1) { ++v4; } else { if ((unsigned int)is_basic(*(_BYTE *)(v4 + a1))) { v9 = 1LL; } else if (locale_utf8locale && *(char *)(v4 + a1) >= 0) { v9 = *(_BYTE *)(v4 + a1) != 0; } else { v13 = s; v9 = mbrlen((const char *)(v4 + a1), v10 - v4, (mbstate_t *)&s); } if (v9 < 0xFFFFFFFFFFFFFFFELL) { if (v9) v4 += v9; else ++v4; } else { s = v13; ++v4; } } } } v11 = substring(a1, (unsigned int)*a2, (unsigned int)v4); if (*(_BYTE *)(v4 + a1)) ++v4; *a2 = v4; return v11; }
bash
ida
char *localetrans(string, len, lenp) char *string; int len, *lenp; { char *locale, *t; char *translated; int tlen; if (string == 0 || *string == 0) { if (lenp) *lenp = 0; return ((char *)((void *)0)); } locale = get_locale_var("LC_MESSAGES"); if (locale == 0 || locale[0] == '\0' || (locale[0] == 'C' && locale[1] == '\0') || ((locale)[0] == ("POSIX")[0] && strcmp(locale, "POSIX") == 0)) { t = (char *)sh_xmalloc((len + 1), "locale.c", 433); strcpy(t, string); if (lenp) *lenp = len; return (t); } if (default_domain && *default_domain) translated = dgettext(default_domain, string); else translated = string; if (translated == string) { t = (char *)sh_xmalloc((len + 1), "locale.c", 448); strcpy(t, string); if (lenp) *lenp = len; } else { tlen = strlen(translated); t = (char *)sh_xmalloc((tlen + 1), "locale.c", 456); strcpy(t, translated); if (lenp) *lenp = tlen; } return (t); }
int localetrans(char *a0, unsigned long a1, unsigned int *a2) { unsigned int v0; char *v1; char *v2; char v3[2]; unsigned int v5; if (!a0) { LABEL_400d33: if (a2) *(a2) = 0; v5 = 0; } else { if (!*(a0)) goto LABEL_400d33; *(&v3) = get_locale_var("LC_MESSAGES"); if (!v3) { LABEL_400db1: v1 = sh_xmalloc(a1 + 1, "locale.c", 0x1b1); strcpy(v1, a0); if (a2) *(a2) = a1; v5 = v1; } else { if (!v3[0]) goto LABEL_400db1; if (v3[0] == 67 && !v3[1]) goto LABEL_400db1; if (v3[0] != 80) { LABEL_400dfd: if (default_domain && *(default_domain)) { v2 = dgettext(default_domain, a0); goto LABEL_400e3b; } v2 = a0; LABEL_400e3b: if (v2 == a0) { v1 = sh_xmalloc(a1 + 1, "locale.c", 0x1c0); strcpy(v1, a0); if (a2) *(a2) = a1; } else { v0 = strlen(v2); v1 = sh_xmalloc(v0 + 1, "locale.c", 0x1c8); strcpy(v1, v2); if (a2) *(a2) = v0; } v5 = v1; } else { if (!(!strcmp(v3, "POSIX"))) goto LABEL_400dfd; goto LABEL_400db1; } } } return v5; }
bash
angr_phoenix
static void cfg_exclude_free(struct cfg_exclude *exc) { free(exc); }
void cfg_exclude_free(void *a0) { unsigned long long v1; v1 = free(a0); return; }
kmod
angr_sailr
char *fparseln(FILE *fp, size_t *size, size_t *lineno, const char str[3], int flags) { static const char dstr[3] = {'\\', '\\', '#'}; ssize_t s; size_t len, ptrlen; char *buf; char *ptr, *cp; int cnt; char esc, con, nl, com; ; len = 0; buf = ((void *)0); ptrlen = 0; ptr = ((void *)0); cnt = 1; if (str == ((void *)0)) str = dstr; esc = str[0]; con = str[1]; com = str[2]; nl = '\n'; flockfile(fp); while (cnt) { cnt = 0; if (lineno) (*lineno)++; s = getline(&ptr, &ptrlen, fp); if (s < 0) break; if (s && com) { for (cp = ptr; cp < ptr + s; cp++) if (*cp == com && !isescaped(ptr, cp, esc)) { s = cp - ptr; cnt = s == 0 && buf == ((void *)0); break; } } if (s && nl) { cp = &ptr[s - 1]; if (*cp == nl) s--; } if (s && con) { cp = &ptr[s - 1]; if (*cp == con && !isescaped(ptr, cp, esc)) { s--; cnt = 1; } } if (s == 0) { if (cnt || buf != ((void *)0)) continue; } if ((cp = realloc(buf, len + s + 1)) == ((void *)0)) { funlockfile(fp); free(buf); free(ptr); return ((void *)0); } buf = cp; (void)memcpy(buf + len, ptr, s); len += s; buf[len] = '\0'; } funlockfile(fp); free(ptr); if ((flags & 0x0f) != 0 && esc && buf != ((void *)0) && strchr(buf, esc) != ((void *)0)) { ptr = cp = buf; while (cp[0] != '\0') { int skipesc; while (cp[0] != '\0' && cp[0] != esc) *ptr++ = *cp++; if (cp[0] == '\0' || cp[1] == '\0') break; skipesc = 0; if (cp[1] == com) skipesc += (flags & 0x04); if (cp[1] == con) skipesc += (flags & 0x02); if (cp[1] == esc) skipesc += (flags & 0x01); if (cp[1] != com && cp[1] != con && cp[1] != esc) skipesc = (flags & 0x08); if (skipesc) cp++; else *ptr++ = *cp++; *ptr++ = *cp++; } *ptr = '\0'; len = strlen(buf); } if (size) *size = len; return buf; }
void *fparseln(FILE *a1, size_t *a2, _QWORD *a3, char *a4, char a5) { _BOOL4 v5; char *v7; char *v8; char *v9; char *v10; char *v11; char *v12; char *v14; char v16; char v17; char v18; int v19; int v20; size_t n; char *lineptr; size_t v23; size_t v24; void *ptr; char *i; unsigned long v27; v14 = a4; v27 = __readfsqword(0x28u); v24 = 0LL; ptr = 0LL; n = 0LL; lineptr = 0LL; v19 = 1; if (!a4) v14 = (char *)&dstr_3175; v16 = *v14; v17 = v14[1]; v18 = v14[2]; flockfile(a1); while (v19) { v19 = 0; if (a3) ++*a3; v23 = getline(&lineptr, &n, a1); if ((v23 & 0x8000000000000000LL) != 0LL) break; if (v23 && v18) { for (i = lineptr; i < &lineptr[v23]; ++i) { if (v18 == *i && !isescaped((unsigned long)lineptr, i, v16)) { v23 = i - lineptr; v5 = i == lineptr && !ptr; v19 = v5; break; } } } if (v23) { i = &lineptr[v23 - 1]; if (*i == 10) --v23; } if (v23) { if (v17) { i = &lineptr[v23 - 1]; if (v17 == *i && !isescaped((unsigned long)lineptr, i, v16)) { --v23; v19 = 1; } } } if (v23 || !v19 && !ptr) { i = (char *)realloc(ptr, v23 + v24 + 1); if (!i) { funlockfile(a1); free(ptr); free(lineptr); return 0LL; } ptr = i; memcpy(&i[v24], lineptr, v23); v24 += v23; *((_BYTE *)ptr + v24) = 0; } } funlockfile(a1); free(lineptr); if ((a5 & 0xF) != 0 && v16 && ptr && strchr((const char *)ptr, v16)) { i = (char *)ptr; lineptr = (char *)ptr; while (*i) { while (*i && v16 != *i) { v7 = i++; v8 = lineptr++; *v8 = *v7; } if (!*i || !i[1]) break; v20 = 0; if (v18 == i[1]) v20 = a5 & 4; if (v17 == i[1]) v20 += a5 & 2; if (v16 == i[1]) v20 += a5 & 1; if (v18 != i[1] && v17 != i[1] && v16 != i[1]) v20 = a5 & 8; if (v20) { ++i; } else { v9 = i++; v10 = lineptr++; *v10 = *v9; } v11 = i++; v12 = lineptr++; *v12 = *v11; } *lineptr = 0; v24 = strlen((const char *)ptr); } if (a2) *a2 = v24; return ptr; }
libbsd-0.11.7
ida
static int struct_month_cmp(void const *m1, void const *m2) { struct month const *month1 = m1; struct month const *month2 = m2; return strcmp(month1->name, month2->name); }
long long struct_month_cmp(unsigned long long *a0, unsigned long long *a1) { return strcmp(*(a0), *(a1)); }
coreutils
angr_sailr
static int lwt_parse_bpf(struct rtattr *rta, size_t len, int *argcp, char ***argvp, int attr, const enum bpf_prog_type bpf_type) { struct bpf_cfg_in cfg = { .type = bpf_type, .argc = *argcp, .argv = *argvp, }; struct lwt_x x = { .rta = rta, .len = len, }; struct rtattr *nest; int err; nest = rta_nest(rta, len, attr); err = bpf_parse_and_load_common(&cfg, &bpf_cb_ops, &x); if (err < 0) { fprintf(stderr, "Failed to parse eBPF program: %s\n", strerror(-err)); return -1; } rta_nest_end(rta, nest); *argcp = cfg.argc; *argvp = cfg.argv; return 0; }
int lwt_parse_bpf(unsigned long long a0, unsigned long long a1, unsigned int *a2, unsigned long long *a3, unsigned long a4, unsigned long a5) { unsigned int v0; unsigned long long v1; unsigned long v2; unsigned long v3; char v4; unsigned int v5; unsigned int v6; unsigned long v7; char v8; unsigned long long v9; unsigned long v10; unsigned long long *v12; unsigned int v13; do { v9 = v9; } while (&v9 != &v8); v10 = v12[5]; memset(&v4, 0x0, 0x8048); v5 = a5; v6 = *(a2); v7 = *(a3); v2 = a0; v3 = a1; v1 = rta_nest(a0, a1, a4, a1); v0 = bpf_parse_and_load_common(&v4, &bpf_cb_ops, &v2); if (v0 < 0) { fprintf(stderr, "Failed to parse eBPF program: %s\n", strerror(-(v0))); v13 = -1; } else { rta_nest_end(a0, v1, v1); *(a2) = v6; *(a3) = v7; v13 = 0; } if ((v10 ^ v12[5])) __stack_chk_fail(); return v13; }
iproute2-6.0.0
angr_sailr
static int handle_from_string(const u_char *handle, u_int hlen) { int val; if (hlen != sizeof(int32_t)) return -1; val = get_u32(handle); if (handle_is_ok(val, HANDLE_FILE) || handle_is_ok(val, HANDLE_DIR)) return val; return -1; }
long handle_from_string(long a1, int a2) { unsigned int u32; if (a2 != 4) return 0xFFFFFFFFLL; u32 = get_u32(a1); if (handle_is_ok(u32, 2) || handle_is_ok(u32, 1)) return u32; else return 0xFFFFFFFFLL; }
openssh-portable
ida
static void process_open(u_int32_t id) { u_int32_t pflags; Attrib a; char *name; int r, handle, fd, flags, mode, status = 4; if ((r = sshbuf_get_cstring(iqueue, &name, ((void *)0))) != 0 || (r = sshbuf_get_u32(iqueue, &pflags)) != 0 || (r = decode_attrib(iqueue, &a)) != 0) sshfatal("sftp-server.c", __func__, 752, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "parse"); sshlog("sftp-server.c", __func__, 754, 0, SYSLOG_LEVEL_DEBUG3, ((void *)0), "request %u: open flags %d", id, pflags); flags = flags_from_portable(pflags); mode = (a.flags & 0x00000004) ? a.perm : 0666; sshlog("sftp-server.c", __func__, 757, 0, SYSLOG_LEVEL_INFO, ((void *)0), "open \"%s\" flags %s mode 0%o", name, string_from_portable(pflags), mode); if (readonly && ((flags & 0003) != 00 || (flags & (0100 | 01000)) != 0)) { sshlog("sftp-server.c", __func__, 762, 0, SYSLOG_LEVEL_VERBOSE, ((void *)0), "Refusing open request in read-only mode"); status = 3; } else { fd = open(name, flags, mode); if (fd == -1) { status = errno_to_portable((*__errno_location())); } else { handle = handle_new(HANDLE_FILE, name, fd, flags, ((void *)0)); if (handle < 0) { close(fd); } else { send_handle(id, handle); status = 0; } } } if (status != 0) send_status(id, status); free(name); }
void process_open(unsigned long a0) { unsigned long long v0; unsigned int v1; char v2; unsigned int v3; unsigned int v4; unsigned int v5; unsigned int v6; unsigned int v7; unsigned int v8; char v9; char v10; unsigned long long v11; unsigned long v12; unsigned long long v13; unsigned long v14; char v15; unsigned long long v18; unsigned long long *v19; unsigned long long v20; v1 = a0; v4 = 4; v3 = sshbuf_get_cstring(0xe87d894820ec8348, &v9, 0x0, &v9); if (v3) { LABEL_401eda: v0 = "parse"; sshfatal("sftp-server.c", "process_open", 0x2f0, 0x1, 0x1, ssh_err(v3)); } else { v3 = sshbuf_get_u32(0xe87d894820ec8348, &v2); if (v3 || (v3 = decode_attrib(0xe87d894820ec8348, &v10, &v10), v3)) goto LABEL_401eda; } v13 = *(&v2); v12 = v1; v11 = "request %u: open flags %d"; sshlog("sftp-server.c", "process_open", 0x2f2, 0x0, 0x7, 0x0, *(&v15)); v5 = flags_from_portable(*(&v2)); v6 = (!(*(&v10) & 4) ? v11 : 438); v18 = *(&v2); v14 = v6; v13 = string_from_portable(v18); v12 = *(&v9); v11 = "open \"%s\" flags %s mode 0%o"; sshlog("sftp-server.c", "process_open", 0x2f5, 0x0, 0x3, 0x0, *(&v15)); if (!readonly || !(v5 & 3) && !(v5 & 576)) { v7 = open(*(&v9), v5, v6); if (v7 == -1) { v4 = errno_to_portable(*(__errno_location())); } else { v8 = handle_new(0x2, *(&v9), v7, v5, 0x0); if (v8 < 0) { close(v7); } else { send_handle(v1, v8); v4 = 0; } } } else { v13 = "Refusing open request in read-only mode"; sshlog("sftp-server.c", "process_open", 0x2fa, 0x0, 0x4, 0x0, *(&v15)); v4 = 3; } if (v4) send_status(v1, v4); free(*(&v9)); v20 = v13 ^ v19[5]; return; }
openssh-portable
angr_sailr
static void predlist_merge_sort(struct predlist *list, struct predicate **last) { struct predlist new_list; struct predicate *p, *q; if (((void *)0) == list->head) return; if (options.debug_options & DebugTreeOpt) { fprintf(stderr, "%s:\n", "predlist before merge sort"); print_tree(stderr, list->head, 2); } calculate_derived_rates(list->head); predlist_init(&new_list); while (list->head) { q = list->head; list->head = list->head->pred_left; q->pred_left = ((void *)0); for (p = new_list.head; p; p = p->pred_left) { const _Bool wantfailure = (OR_PREC != p->p_prec); if (pred_cost_compare(p->pred_right, q->pred_right, wantfailure) >= 0) break; } if (p) { q->pred_left = p->pred_left; if (((void *)0) == q->pred_left) new_list.tail = q; p->pred_left = q; } else { q->pred_left = new_list.head; new_list.head = q; if (((void *)0) == new_list.tail) new_list.tail = q; } } if (options.debug_options & DebugTreeOpt) { fprintf(stderr, "%s:\n", "predlist after merge sort"); print_tree(stderr, new_list.head, 2); } calculate_derived_rates(new_list.head); merge_pred(new_list.head, new_list.tail, last); predlist_init(list); }
unsigned long predlist_merge_sort(long *a1, _QWORD *a2) { long i; long v4; long v5; long v6; unsigned long v7; v7 = __readfsqword(0x28u); if (*a1) { if ((options[8] & 8LL) != 0) { fprintf(stderr, "%s:\n", "predlist before merge sort"); print_tree(stderr, *a1, 2); } calculate_derived_rates(*a1); predlist_init(&v5); while (*a1) { v4 = *a1; *a1 = *(_QWORD *)(*a1 + 272); *(_QWORD *)(v4 + 272) = 0LL; for (i = v5; i && (int)pred_cost_compare(*(_QWORD *)(i + 280), *(_QWORD *)(v4 + 280), *(_DWORD *)(i + 20) != 2) < 0; i = *(_QWORD *)(i + 272)) { ; } if (i) { *(_QWORD *)(v4 + 272) = *(_QWORD *)(i + 272); if (!*(_QWORD *)(v4 + 272)) v6 = v4; *(_QWORD *)(i + 272) = v4; } else { *(_QWORD *)(v4 + 272) = v5; v5 = v4; if (!v6) v6 = v4; } } if ((options[8] & 8LL) != 0) { fprintf(stderr, "%s:\n", "predlist after merge sort"); print_tree(stderr, v5, 2); } calculate_derived_rates(v5); merge_pred(v5, v6, a2); predlist_init(a1); } return __readfsqword(0x28u) ^ v7; }
findutils
ida
static void zero_pad(UINT8 *p, int nbytes) { if (nbytes >= (int)sizeof(UWORD)) { while ((ptrdiff_t)p % sizeof(UWORD)) { *p = 0; nbytes--; p++; } while (nbytes >= (int)sizeof(UWORD)) { *(UWORD *)p = 0; nbytes -= sizeof(UWORD); p += sizeof(UWORD); } } while (nbytes) { *p = 0; nbytes--; p++; } }
void zero_pad(undefined4 *param_1, int param_2) { int local_14; undefined4 *local_10; local_14 = param_2; local_10 = param_1; if (3 < param_2) { for (; ((ulong)local_10 & 3) != 0; local_10 = (undefined4 *)((long)local_10 + 1)) { *(undefined *)local_10 = 0; local_14 = __addvsi3(local_14, 0xffffffff); } for (; 3 < local_14; local_14 = local_14 + -4) { *local_10 = 0; local_10 = local_10 + 1; } } while (local_14 != 0) { *(undefined *)local_10 = 0; local_14 = __addvsi3(local_14, 0xffffffff); local_10 = (undefined4 *)((long)local_10 + 1); } return; }
openssh-portable
ghidra
static struct nh_entry *ipnh_cache_get(__u32 nh_id) { struct hlist_head *head = ipnh_cache_head(nh_id); struct nh_entry *nhe; struct hlist_node *n; for (n = (head)->first; n; n = n->next) { nhe = ({ const typeof(((struct nh_entry *)0)->nh_hash) *__mptr = (n); (struct nh_entry *)((char *)__mptr - __builtin_offsetof(struct nh_entry, nh_hash)); }); if (nhe->nh_id == nh_id) return nhe; } return ((void *)0); }
undefined8 *ipnh_cache_get(int param_1) { undefined8 *local_28; local_28 = (undefined8 *)ipnh_cache_head(param_1); local_28 = (undefined8 *)*local_28; while (true) { if (local_28 == (undefined8 *)0x0) { return (undefined8 *)0x0; } if (param_1 == *(int *)(local_28 + 2)) break; local_28 = (undefined8 *)*local_28; } return local_28; }
iproute2-6.0.0
ghidra
static void tok_finish(Tokenizer *tok) { *tok->wptr = '\0'; if ((tok->flags & 1) || tok->wptr != tok->wstart) { tok->argv[tok->argc++] = tok->wstart; tok->argv[tok->argc] = ((void *)0); tok->wstart = ++tok->wptr; } tok->flags &= ~1; }
void tok_finish(long param_1) { long lVar1; **(undefined **)(param_1 + 0x20) = 0; if (((*(uint *)(param_1 + 0x44) & 1) != 0) || (*(long *)(param_1 + 0x20) != *(long *)(param_1 + 0x30))) { lVar1 = *(long *)(param_1 + 8); *(long *)(param_1 + 8) = lVar1 + 1; *(undefined8 *)(*(long *)(param_1 + 0x18) + lVar1 * 8) = *(undefined8 *)(param_1 + 0x30); *(undefined8 *)(*(long *)(param_1 + 8) * 8 + *(long *)(param_1 + 0x18)) = 0; *(long *)(param_1 + 0x20) = *(long *)(param_1 + 0x20) + 1; *(undefined8 *)(param_1 + 0x30) = *(undefined8 *)(param_1 + 0x20); } *(uint *)(param_1 + 0x44) = *(uint *)(param_1 + 0x44) & 0xfffffffe; return; }
libedit
ghidra
static inline int _rl_wcwidth(wchar_t wc) { switch (wc) { case ' ': case '!': case '"': case '#': case '%': case '&': case '\'': case '(': case ')': case '*': case '+': case ',': case '-': case '.': case '/': case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': case ':': case ';': case '<': case '=': case '>': case '?': case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': case 'G': case 'H': case 'I': case 'J': case 'K': case 'L': case 'M': case 'N': case 'O': case 'P': case 'Q': case 'R': case 'S': case 'T': case 'U': case 'V': case 'W': case 'X': case 'Y': case 'Z': case '[': case '\\': case ']': case '^': case '_': case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': case 'g': case 'h': case 'i': case 'j': case 'k': case 'l': case 'm': case 'n': case 'o': case 'p': case 'q': case 'r': case 's': case 't': case 'u': case 'v': case 'w': case 'x': case 'y': case 'z': case '{': case '|': case '}': case '~': return 1; default: return wcwidth(wc); } }
int _rl_wcwidth(unsigned long a0) { unsigned int v1; if (a0 > 126) { LABEL_400043: v1 = wcwidth(a0); } else { if (a0 < 97) { if (!(a0 <= 95)) goto LABEL_400043; if (a0 < 65) { if (a0 > 35) { if (a0 - 37 <= 26) goto LABEL_40003c; goto LABEL_400043; } else if (a0 < 32) { goto LABEL_400043; } } } LABEL_40003c: v1 = 1; } return v1; }
bash
angr_phoenix
int file_read(buf, size) char *buf; unsigned size; { unsigned len; ; len = read_buffer(ifd, buf, size); if (len == 0) return (int)len; if (len == (unsigned)-1) { read_error(); } updcrc((uch *)buf, len); bytes_in += (off_t)len; return (int)len; }
uint file_read(undefined8 param_1, undefined4 param_2) { uint uVar1; uVar1 = read_buffer(ifd, param_1, param_2); if (uVar1 != 0) { if (uVar1 == 0xffffffff) { read_error(); } updcrc(param_1, uVar1); bytes_in = bytes_in + (ulong)uVar1; } return uVar1; }
gzip-1.12
ghidra
struct timeval *multimeval(d, m) struct timeval *d; int m; { time_t t; t = d->tv_usec * m; d->tv_sec = d->tv_sec * m + t / 1000000; d->tv_usec = t % 1000000; return d; }
long long multimeval(unsigned long long a0[2], unsigned long a1) { unsigned long v0; v0 = a0[1] * a1; a0[0] = a1 * a0[0] + (v0 * 4835703278458516699 >> 64 >> 18) - (v0 >> 63); a0[1] = v0 - ((v0 * 4835703278458516699 >> 64 >> 18) - (v0 >> 63)) * 1000000; return a0; }
bash
angr_dream
static void hdlr_sigchld(void) { pthread_mutex_lock(&mutChildDied); bChildDied = 1; pthread_mutex_unlock(&mutChildDied); }
long long hdlr_sigchld() { pthread_mutex_lock(&mutChildDied); bChildDied = 1; return pthread_mutex_unlock(&mutChildDied); }
rsyslog-8.2210.0
angr_sailr
static inline int ila_csum_name2mode(char *name) { if (strcmp(name, "adj-transport") == 0) return ILA_CSUM_ADJUST_TRANSPORT; else if (strcmp(name, "neutral-map") == 0) return ILA_CSUM_NEUTRAL_MAP; else if (strcmp(name, "neutral-map-auto") == 0) return ILA_CSUM_NEUTRAL_MAP_AUTO; else if (strcmp(name, "no-action") == 0) return ILA_CSUM_NO_ACTION; else if (strcmp(name, "neutral-map-auto") == 0) return ILA_CSUM_NEUTRAL_MAP_AUTO; else return -1; }
int ila_csum_name2mode(char *a0) { return (!strcmp(a0, "adj-transport") ? (!strcmp(a0, "neutral-map") ? (!strcmp(a0, "neutral-map-auto") ? (!strcmp(a0, "no-action") ? (!strcmp(a0, "neutral-map-auto") ? -1 : 3) : 2) : 3) : 1) : 0); }
iproute2-6.0.0
angr_sailr
static void set_debug(const struct cmdinfo *cpi, const char *value) { char *endp; long mask; const struct debuginfo *dip; if (*value == 'h') { printf(gettext("%s debugging option, --debug=<octal> or -D<octal>:\n" "\n" " Number Ref. in source Description\n") , "dpkg"); for (dip = debuginfos; dip->name; dip++) printf(" %6o %-16s %s\n", dip->flag, dip->name, gettext(dip->desc)); printf(gettext("\n" "Debugging options can be mixed using bitwise-or.\n" "Note that the meanings and values are subject to change.\n") ); m_output(stdout, gettext("<standard output>")); exit(0); } (*__errno_location()) = 0; mask = strtol(value, &endp, 8); if (value == endp || *endp || mask < 0 || (*__errno_location()) == 34) badusage(gettext("--%s requires a positive octal argument"), cpi->olong); debug_set_mask(mask); }
long long set_debug(unsigned long long *a0, char *a1) { char v0; unsigned long long v1; unsigned long long v2; unsigned long long v5; if (*(a1) != 104) { *(__errno_location()) = 0; v2 = strtol(a1, &v0, 0x8); if (a1 != *(&v0) && !*(*(&v0)) && !((v2 - 0 >> 63)) && !(*(__errno_location()) == 34)) goto LABEL_400350; badusage(gettext("--%s requires a positive octal argument"), *(a0)); LABEL_400350: debug_set_mask(v2); return 0; } else { printf(gettext("%s debugging option, --debug=<octal> or -D<octal>:\n\n " "Number Ref. in source Description\n")); for (v1 = &debuginfos; *((v1 + 8)); v1 += 24) { gettext(*((v1 + 16))); printf(" %6o %-16s %s\n", *(v1), *((v1 + 8))); } printf(gettext("\nDebugging options can be mixed using bitwise-or.\nNote " "that the meanings and values are subject to change.\n")); v5 = gettext("<standard output>"); m_output(stdout, v5, v5); exit(0x0); } }
dpkg
angr_phoenix
void mac_clear(struct sshmac *mac) { if (mac->type == 2) { if (mac->umac_ctx != ((void *)0)) umac_delete(mac->umac_ctx); } else if (mac->type == 3) { if (mac->umac_ctx != ((void *)0)) umac128_delete(mac->umac_ctx); } else if (mac->hmac_ctx != ((void *)0)) ssh_hmac_free(mac->hmac_ctx); mac->hmac_ctx = ((void *)0); mac->umac_ctx = ((void *)0); }
long mac_clear(long a1) { long result; if (*(_DWORD *)(a1 + 28) == 2) { if (*(_QWORD *)(a1 + 48)) umac_delete(*(_QWORD *)(a1 + 48)); } else if (*(_DWORD *)(a1 + 28) == 3) { if (*(_QWORD *)(a1 + 48)) umac128_delete(*(_QWORD *)(a1 + 48)); } else if (*(_QWORD *)(a1 + 40)) { ssh_hmac_free(*(_QWORD *)(a1 + 40)); } *(_QWORD *)(a1 + 40) = 0LL; result = a1; *(_QWORD *)(a1 + 48) = 0LL; return result; }
openssh-portable
ida
static void cron_sleep(int target, cron_db *db) { time_t t1, t2; int seconds_to_wait; t1 = time(((void *)0)) + GMToff; seconds_to_wait = (int)(target * 60 - t1) + 1; if ((DebugFlags & (0x0002)) != 0) printf("[%ld] Target time=%ld, sec-to-wait=%d\n", (long)getpid(), (long)target * 60, seconds_to_wait) ; while (seconds_to_wait > 0 && seconds_to_wait < 65) { sleep((unsigned int)seconds_to_wait); if (got_sigintterm) return; handle_signals(db); t2 = time(((void *)0)) + GMToff; seconds_to_wait -= (int)(t2 - t1); t1 = t2; } }
void cron_sleep(unsigned long a0, void *a1) { unsigned int v0; unsigned long v1; unsigned long long v2; unsigned long long v4; unsigned long long v5; unsigned long long v6; unsigned long long v7; v1 = time(NULL) + GMToff; v0 = a0 * 60 - v1 + 1; v4 = DebugFlags & 2; if ((DebugFlags & 2)) v5 = printf("[%ld] Target time=%ld, sec-to-wait=%d\n", getpid(), (a0 * 60), v0); for (; v0 > 0; v1 = v2) { if (v0 > 64) break; if (v0 <= 64) { sleep(v0); v6 = got_sigintterm; if (got_sigintterm) break; } handle_signals(a1); v2 = time(NULL) + GMToff; v0 -= (v2 - v1); v7 = v2; } return; }
cronie
angr_dream
int client_x11_get_proto(struct ssh *ssh, const char *display, const char *xauth_path, u_int trusted, u_int timeout, char **_proto, char **_data) { char *cmd, line[512], xdisplay[512]; char xauthfile[4096], xauthdir[4096]; static char proto[512], data[512]; FILE *f; int got_data = 0, generated = 0, do_unlink = 0, r; struct stat st; u_int now, x11_timeout_real; *_proto = proto; *_data = data; proto[0] = data[0] = xauthfile[0] = xauthdir[0] = '\0'; if (!client_x11_display_valid(display)) { if (display != ((void *)0)) sshlog("clientloop.c", __func__, 304, 0, SYSLOG_LEVEL_INFO, ((void *)0), "DISPLAY \"%s\" invalid; disabling X11 forwarding", display); return -1; } if (xauth_path != ((void *)0) && stat(xauth_path, &st) == -1) { sshlog("clientloop.c", __func__, 309, 0, SYSLOG_LEVEL_DEBUG1, ((void *)0), "No xauth program."); xauth_path = ((void *)0); } if (xauth_path != ((void *)0)) { if (strncmp(display, "localhost:", 10) == 0) { if ((r = snprintf(xdisplay, sizeof(xdisplay), "unix:%s", display + 10)) < 0 || (size_t)r >= sizeof(xdisplay)) { sshlog("clientloop.c", __func__, 325, 1, SYSLOG_LEVEL_ERROR, ((void *)0), "display name too long"); return -1; } display = xdisplay; } if (trusted == 0) { mktemp_proto(xauthdir, sizeof(xauthdir)); if (mkdtemp(xauthdir) == ((void *)0)) { sshlog("clientloop.c", __func__, 340, 1, SYSLOG_LEVEL_ERROR, ((void *)0), "mkdtemp: %s", strerror((*__errno_location()))); return -1; } do_unlink = 1; if ((r = snprintf(xauthfile, sizeof(xauthfile), "%s/xauthfile", xauthdir)) < 0 || (size_t)r >= sizeof(xauthfile)) { sshlog("clientloop.c", __func__, 347, 1, SYSLOG_LEVEL_ERROR, ((void *)0), "xauthfile path too long"); rmdir(xauthdir); return -1; } if (timeout == 0) { xasprintf(&cmd, "%s -f %s generate %s %s " "untrusted 2>%s", xauth_path, xauthfile, display, "MIT-MAGIC-COOKIE-1", "/dev/null"); } else { if (timeout < (0x7fffffff * 2U + 1U) - 60) x11_timeout_real = timeout + 60; else { x11_timeout_real = (0x7fffffff * 2U + 1U); } xasprintf(&cmd, "%s -f %s generate %s %s " "untrusted timeout %u 2>%s", xauth_path, xauthfile, display, "MIT-MAGIC-COOKIE-1", x11_timeout_real, "/dev/null"); } sshlog("clientloop.c", __func__, 373, 1, SYSLOG_LEVEL_DEBUG2, ((void *)0), "xauth command: %s", cmd); if (timeout != 0 && x11_refuse_time == 0) { now = monotime() + 1; if ((0x7fffffff * 2U + 1U) - timeout < now) x11_refuse_time = (0x7fffffff * 2U + 1U); else x11_refuse_time = now + timeout; channel_set_x11_refuse_time(ssh, x11_refuse_time); } if (system(cmd) == 0) generated = 1; free(cmd); } if (trusted || generated) { xasprintf(&cmd, "%s %s%s list %s 2>" "/dev/null", xauth_path, generated ? "-f " : "", generated ? xauthfile : "", display); sshlog("clientloop.c", __func__, 401, 0, SYSLOG_LEVEL_DEBUG2, ((void *)0), "x11_get_proto: %s", cmd); f = popen(cmd, "r"); if (f && fgets(line, sizeof(line), f) && sscanf(line, "%*s %511s %511s", proto, data) == 2) got_data = 1; if (f) pclose(f); free(cmd); } } if (do_unlink) { unlink(xauthfile); rmdir(xauthdir); } if (!trusted && !got_data) { sshlog("clientloop.c", __func__, 419, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "Warning: untrusted X11 forwarding setup failed: " "xauth key data not generated"); return -1; } if (!got_data) { u_int8_t rnd[16]; u_int i; sshlog("clientloop.c", __func__, 436, 0, SYSLOG_LEVEL_INFO, ((void *)0), "Warning: No xauth data; " "using fake authentication data for X11 forwarding."); strlcpy(proto, "MIT-MAGIC-COOKIE-1", sizeof proto); arc4random_buf(rnd, sizeof(rnd)); for (i = 0; i < sizeof(rnd); i++) { snprintf(data + 2 * i, sizeof data - 2 * i, "%02x", rnd[i]); } } return 0; }
long long client_x11_get_proto(unsigned long long a0, void *a1, char *a2, unsigned long a3, unsigned long a4, unsigned long long *a5, unsigned long v23) { unsigned long long v0; unsigned long long v1; unsigned long long *v2; unsigned int v3; void *v4; void *v5; unsigned int v6; unsigned int v7; unsigned int v8; unsigned int v9; unsigned int v10; unsigned int v11; unsigned int v12; char v13; void *v14; char v15; char v16; char v17; char v18; char v19; unsigned long long v20; char v21; unsigned long long v22; unsigned long long v26; unsigned long long v27; unsigned long long v28; unsigned long long v30; unsigned long long v31; v22 = *(&v22); v20 = *(&v20); v5 = a1; v4 = a2; v3 = a4; v2 = v23; v6 = 0; v7 = 0; v8 = 0; *(a5) = &proto.20208; *(v2) = &data.20209; v21 = 0; v19 = v21; data.20209 = v19; proto.20208 = data.20209; if (!client_x11_display_valid(v5)) { if (v5) { v1 = v5; v0 = "DISPLAY \"%s\" invalid; disabling X11 forwarding"; sshlog("clientloop.c", "client_x11_get_proto", 0x130, 0x0, 0x3, 0x0); } v26 = 4294967295; } else { if (v4 && stat(v4, &v15) == -1) { v0 = "No xauth program."; sshlog("clientloop.c", "client_x11_get_proto", 0x135, 0x0, 0x5, 0x0); v4 = 0; } if (v4) { v27 = strncmp(v5, "localhost:", 0xa); if (!v27) { v11 = snprintf(&v18, 0x200, "unix:%s", (v5 + 10)); if (v11 >= 0 && v11 <= 511) v5 = &v18; if (v11 < 0 || v11 > 511) { v0 = "display name too long"; sshlog("clientloop.c", "client_x11_get_proto", 0x145, 0x1, 0x2, 0x0); v26 = 4294967295; } } if (v27 || v11 <= 511 && v11 >= 0) { if (!a3) { mktemp_proto(&v21, 0x1000); v28 = mkdtemp(&v21); if (!v28) { v1 = strerror(*(__errno_location())); v0 = "mkdtemp: %s"; sshlog("clientloop.c", "client_x11_get_proto", 0x154, 0x1, 0x2, 0x0); v26 = 4294967295; } else { v8 = 1; v11 = snprintf(&v19, 0x1000, "%s/xauthfile", &v21); if (v11 >= 0 && v11 <= 4095) { if (!a4) { v0 = "/dev/null"; xasprintf(&v13, "%s -f %s generate %s %s untrusted 2>%s", v4, &v19, v5, "MIT-MAGIC-COOKIE-1"); } else { if (a4 <= -62) v9 = a4 + 60; else v9 = -1; v1 = "/dev/null"; v0 = v9; xasprintf(&v13, "%s -f %s generate %s %s untrusted timeout %u 2>%s", v4, &v19, v5, "MIT-MAGIC-COOKIE-1"); } v1 = *(&v13); v0 = "xauth command: %s"; sshlog("clientloop.c", "client_x11_get_proto", 0x175, 0x1, 0x6, 0x0); if (a4 && !x11_refuse_time) { v12 = monotime() + 1; if (v12 > !(v3)) x11_refuse_time = -1; else x11_refuse_time = a4 + v12; channel_set_x11_refuse_time(a0, x11_refuse_time, x11_refuse_time); } if (!system(*(&v13))) v7 = 1; free(*(&v13)); } if (v11 < 0 || v11 > 4095) { v0 = "xauthfile path too long"; sshlog("clientloop.c", "client_x11_get_proto", 0x15b, 0x1, 0x2, 0x0); rmdir(&v21); v26 = 4294967295; } } } if ((v11 <= 4095 || a3) && (v11 >= 0 || a3) && (a3 || v28) && (v7 || a3)) { if (v7) v30 = &v19; else v30 = &g_408c6c; if (v7) v31 = "-f "; else v31 = &g_408c6c; xasprintf(&v13, "%s %s%s list %s 2>/dev/null", v4, v31, v30, v5); v1 = *(&v13); v0 = "x11_get_proto: %s"; sshlog("clientloop.c", "client_x11_get_proto", 0x191, 0x0, 0x6, 0x0); v14 = popen(*(&v13), "r"); if (v14 && fgets(&v17, 0x200, v14) && __isoc99_sscanf(&v17, "%*s %511s %511s", &proto.20208, &data.20209) == 2) v6 = 1; if (v14) pclose(v14); free(*(&v13)); } } } if (!v4 || v27 && a3 || v11 <= 511 && v11 >= 0 && a3 || v11 <= 4095 && v11 >= 0 && v27 && v28 || v11 <= 511 && v11 <= 4095 && v11 >= 0 && v11 >= 0 && v28) { if (v8) { unlink(&v19); rmdir(&v21); } if (!a3 && !v6) { v0 = "Warning: untrusted X11 forwarding setup failed: xauth key data " "not generated"; sshlog("clientloop.c", "client_x11_get_proto", 0x1a3, 0x0, 0x2, 0x0); v26 = 4294967295; } if (v6 || a3) { if (!v6) { v0 = "Warning: No xauth data; using fake authentication data for X11 " "forwarding."; sshlog("clientloop.c", "client_x11_get_proto", 0x1b4, 0x0, 0x3, 0x0); strlcpy(&proto.20208, "MIT-MAGIC-COOKIE-1", 0x200); arc4random_buf(&v16, 0x10); for (v10 = 0; v10 <= 15; v10 += 1) { snprintf(&(&data.20209)[2 * v10], 0x200 - v10 * 2, "%02x", (&v16)[v10]); } } v26 = 0; } } } return v26; }
openssh-portable
angr_dream
void sh_free(mem, file, line) void *mem; const char *file; int line; { internal_free(mem, file, line, 0x01); }
long long sh_free(unsigned int a0, unsigned long long a1, unsigned long a2) { return internal_free(a0, a1, a2, 0x1); }
bash
angr_dream
void warning(char const *m) { { if (!quiet) fprintf(stderr, "%s: %s: warning: %s\n", program_name, ifname, m); if (exit_code == 0) exit_code = 2; }; }
long long warning(unsigned long a0) { unsigned long long v1; if (!quiet) fprintf(stderr, "%s: %s: warning: %s\n", program_name, &ifname, a0); v1 = exit_code; if (!exit_code) exit_code = 2; return v1; }
gzip-1.12
angr_dream
vi_substitute_char(EditLine *el, wint_t c __attribute__((__unused__))) { c_delafter(el, el->el_state.argument); el->el_map.current = el->el_map.key; return 4; }
long long vi_substitute_char(struct_0 *a0, unsigned long a1) { unsigned int v0; v0 = a1; c_delafter(a0, a0->field_78, a0->field_78); a0->field_400 = a0->field_3f8; return 4; }
libedit
angr_phoenix
char const *quote_n_colon(int n, char const *arg) { return quotearg_n_style_colon(n, get_quoting_style(((void *)0)), arg); }
long long quote_n_colon(unsigned long a0, unsigned long long a1) { unsigned long long v1; v1 = get_quoting_style(0x0); return quotearg_n_style_colon(a0, v1, a1, v1); }
tar
angr_sailr
int glob_char_p(s) const char *s; { switch (*s) { case '*': case '[': case ']': case '?': case '\\': return 1; case '+': case '@': case '!': if (s[1] == '(') return 1; break; } return 0; }
int glob_char_p(char a0[2]) { unsigned int v1; if (a0[0] <= 64 && a0[0] >= 33) { switch (a0[0]) { case 33: case 43: case 64: if (a0[1] == 40) { v1 = 1; break; } case 42: case 63: v1 = 1; break; default: v1 = 0; break; } } return v1; }
bash
angr_dream
static int history_next_event(History *h, HistEvent *ev, int num) { int retval; for (retval = (*(h)->h_curr)((h)->h_ref, ev); retval != -1; retval = (*(h)->h_next)((h)->h_ref, ev)) if (ev->num == num) return 0; { ev->num = 9; ev->str = he_errlist[9]; }; return -1; }
int history_next_event(unsigned long long a0[7], struct_0 *a1, unsigned long a2) { unsigned int v0; unsigned int v2; for (v0 = a0[6](a0[0], a1, a1, a0[6]); v0 != -1; v0 = a0[3](a0[0], a1, a1, a0[3])) { if (a2 == a1->field_0) { v2 = 0; return v2; } } a1->field_0 = 9; a1->field_8 = "event not found"; v2 = -1; return v2; }
libedit
angr_sailr
SHELL_VAR **all_exported_variables() { return (vapply(visible_and_exported)); }
void *all_exported_variables() { return vapply((long (*)(const char **))visible_and_exported); }
bash
ida
void usage(int status) { if (status != 0) do { fprintf(stderr, gettext("Try '%s --help' for more information.\n"), program_name); } while (0); else { printf(gettext("Usage: %s [OPTION]... NAME TYPE [MAJOR MINOR]\n"), program_name); fputs_unlocked(gettext("Create the special file NAME of the given TYPE.\n"), stdout) ; emit_mandatory_arg_note(); fputs_unlocked(gettext(" -m, --mode=MODE set file permission bits to " "MODE, not a=rw - umask\n"), stdout) ; fputs_unlocked( gettext(" -Z set the SELinux security context to " "default type\n --context[=CTX] like -Z, or if CTX is " "specified then set the SELinux\n or " "SMACK security context to CTX\n"), stdout) ; fputs_unlocked(gettext(" --help display this help and exit\n"), stdout); fputs_unlocked( gettext(" --version output version information and exit\n"), stdout); fputs_unlocked( gettext("\nBoth MAJOR and MINOR must be specified when TYPE is b, c, " "or u, and they\nmust be omitted when TYPE is p. If MAJOR or " "MINOR begins with 0x or 0X,\nit is interpreted as " "hexadecimal; otherwise, if it begins with 0, as " "octal;\notherwise, as decimal. TYPE may be:\n"), stdout) ; fputs_unlocked(gettext("\n b create a block (buffered) special " "file\n c, u create a character (unbuffered) " "special file\n p create a FIFO\n"), stdout) ; printf(gettext("\n" "NOTE: your shell may have its own version of %s, which " "usually supersedes\n" "the version described here. Please refer to your shell's " "documentation\n" "for details about the options it supports.\n"), "mknod"); emit_ancillary_info("mknod"); } exit(status); }
void usage(unsigned long a0) { unsigned long v0; unsigned long v2; v0 = v2; if (a0) { fprintf(stderr, gettext("Try '%s --help' for more information.\n")); } else { printf(gettext("Usage: %s [OPTION]... NAME TYPE [MAJOR MINOR]\n")); fputs_unlocked(gettext("Create the special file NAME of the given TYPE.\n"), stdout); emit_mandatory_arg_note(); fputs_unlocked(gettext(" -m, --mode=MODE set file permission bits to " "MODE, not a=rw - umask\n"), stdout); fputs_unlocked( gettext(" -Z set the SELinux security context to " "default type\n --context[=CTX] like -Z, or if CTX is " "specified then set the SELinux\n or " "SMACK security context to CTX\n"), stdout); fputs_unlocked(gettext(" --help display this help and exit\n"), stdout); fputs_unlocked( gettext(" --version output version information and exit\n"), stdout); fputs_unlocked( gettext("\nBoth MAJOR and MINOR must be specified when TYPE is b, c, " "or u, and they\nmust be omitted when TYPE is p. If MAJOR or " "MINOR begins with 0x or 0X,\nit is interpreted as " "hexadecimal; otherwise, if it begins with 0, as " "octal;\notherwise, as decimal. TYPE may be:\n"), stdout); fputs_unlocked(gettext("\n b create a block (buffered) special " "file\n c, u create a character (unbuffered) " "special file\n p create a FIFO\n"), stdout); printf(gettext( "\nNOTE: your shell may have its own version of %s, which usually " "supersedes\nthe version described here. Please refer to your shell's " "documentation\nfor details about the options it supports.\n")); emit_ancillary_info("mknod"); } exit(a0); }
coreutils
angr_phoenix
static SHELL_VAR *find_nameref_at_context(v, vc) SHELL_VAR *v; VAR_CONTEXT *vc; { SHELL_VAR *nv, *nv2; char *newname; int level; nv = v; level = 1; while (nv && ((((nv)->attributes) & (0x0000800)))) { level++; if (level > 8) return (&nameref_maxloop_value); newname = ((nv)->value); if (newname == 0 || *newname == '\0') return ((SHELL_VAR *)((void *)0)); nv2 = hash_lookup(newname, vc->table); if (nv2 == 0) break; nv = nv2; } return nv; }
int find_nameref_at_context(unsigned long a0, struct_0 *a1) { unsigned int v0; struct_1 *v1; char *v2; unsigned long v3; unsigned int v5; v1 = a0; v0 = 1; while (true) { if (!(v1) || !((v1->field_28 & 0x800))) break; v0 += 1; if (v0 > 8) { v5 = &nameref_maxloop_value; return v5; } v2 = v1->field_8; if (!v2) { v5 = 0; return v5; } if (!*(v2)) { v5 = 0; return v5; } v3 = hash_lookup(v2, a1->field_20); if (!v3) break; v1 = v3; } v5 = v1; return v5; }
bash
angr_sailr
cv_next_word(EditLine *el, wchar_t *p, wchar_t *high, int n, int (*wtest)(wint_t)) { int test; while (n--) { test = (*wtest)(*p); while ((p < high) && (*wtest)(*p) == test) p++; if (n || el->el_chared.c_vcmd.action != (0x01 | 0x02)) while ((p < high) && iswspace(*p)) p++; } if (p > high) return high; else return p; }
long long cv_next_word(struct_0 *a0, unsigned long a1, unsigned long a2, unsigned long a3, unsigned long a4) { unsigned long v0; int tmp_9; unsigned int v1; unsigned int *v2; unsigned int v3; v2 = a1; v1 = a3; v0 = a4; while (true) { tmp_9 = v1; v1 -= 1; if (!tmp_9) break; for (v3 = (stack_base)[64](*(v2)); v2 < a2 && v3 == (stack_base)[64](*(v2)); v2 = v2 + 1) ; if (!(v1) && !(a0->field_3c0 != 3)) continue; for (; v2 < a2 && iswspace(*(v2)); v2 = v2 + 1) ; } return (v2 <= a2 ? a2 : v2); }
libedit
angr_sailr
int delete_var(name, vc) const char *name; VAR_CONTEXT *vc; { BUCKET_CONTENTS *elt; SHELL_VAR *old_var; VAR_CONTEXT *v; for (elt = (BUCKET_CONTENTS *)((void *)0), v = vc; v; v = v->down) if (elt = hash_remove(name, v->table, 0)) break; if (elt == 0) return (-1); old_var = (SHELL_VAR *)elt->data; sh_xfree((elt->key), "variables.c", 3965); sh_xfree((elt), "variables.c", 3966); dispose_variable(old_var); return (0); }
long long delete_var(unsigned long long a0, unsigned long a1) { void *v0; unsigned long long v1[5]; void *v2; unsigned long long v4; v0 = 0; for (v1[0] = a1; v1; v1[0] = v1[3]) { v0 = hash_remove(a0, v1[4], 0x0, v1[4]); if (v0) break; } if (!v0) { v4 = 4294967295; } else { v2 = v0[16]; sh_xfree(v0[8], "variables.c", 0xf7d); sh_xfree(v0, "variables.c", 0xf7e); dispose_variable(v2); v4 = 0; } return v4; }
bash
angr_dream
void malloc_set_tracefp(fp) FILE *fp; { }
void malloc_set_tracefp() { ; }
bash
ida
static struct permission_set *permission_set_get(struct ssh *ssh, int where) { struct ssh_channels *sc = ssh->chanctxt; switch (where) { case (1 << 1): return &sc->local_perms; break; case (1): return &sc->remote_perms; break; default: sshfatal("channels.c", __func__, 522, 1, SYSLOG_LEVEL_FATAL, ((void *)0), "invalid forwarding direction %d", where); } }
long permission_set_get(long a1, unsigned int a2) { long v3; v3 = *(_QWORD *)(a1 + 2152); if (a2 == 1) return v3 + 72; if (a2 == 2) return v3 + 32; return sshfatal("channels.c", "permission_set_get", 522LL, 1LL, 1LL, 0LL, "invalid forwarding direction %d", a2); }
openssh-portable
ida
static int iproute_restore(void) { int pos, prio; if (route_dump_check_magic()) return -1; pos = ftell(stdin); if (pos == -1) { perror("Failed to restore: ftell"); return -1; } for (prio = 0; prio < 3; prio++) { int err; err = rtnl_from_file(stdin, &restore_handler, &prio); if (err) return -2; if (fseek(stdin, pos, 0) == -1) { perror("Failed to restore: fseek"); return -1; } } return 0; }
void iproute_restore() { unsigned int v0; unsigned int v1; unsigned int v2; unsigned long long v4; unsigned long long v5; void *v6; unsigned long long v7; unsigned long long v8; if (route_dump_check_magic()) { v4 = 4294967295; return; } v1 = ftell(stdin); if (v1 == -1) { perror("Failed to restore: ftell"); v5 = 4294967295; return; } v0 = 0; while (v0 > 2) { LABEL_408837: v6 = 0; return; } v2 = rtnl_from_file(stdin, restore_handler, &v0); if (v2) { v7 = 4294967294; return; } if (fseek(stdin, v1, 0x0) == -1) { perror("Failed to restore: fseek"); v8 = 4294967295; return; } v0 += 1; goto LABEL_408837; }
iproute2-6.0.0
angr_sailr
void xtrace_print_arith_cmd(list) WORD_LIST *list; { WORD_LIST *w; xtrace_fp = (xtrace_fp ? xtrace_fp : stderr); fprintf(xtrace_fp, "%s", indirection_level_string()); fprintf(xtrace_fp, "(( "); for (w = list; w; w = w->next) fprintf(xtrace_fp, "%s%s", w->word->word, w->next ? " " : ""); fprintf(xtrace_fp, " ))\n"); fflush(xtrace_fp); }
long long xtrace_print_arith_cmd(unsigned long a0) { struct_0 *v0; unsigned int v2; v2 = (!*(&xtrace_fp) ? *(&xtrace_fp) : stderr); *(&xtrace_fp) = v2; fprintf(*(&xtrace_fp), "%s", indirection_level_string()); fprintf(*(&xtrace_fp), "(( "); for (v0 = a0; v0; v0 = v0->field_0) { if (!v0->field_0) v2 = &g_403583; else v2 = " "; fprintf(*(&xtrace_fp), "%s%s", v0->field_8->field_0, v2); } fprintf(*(&xtrace_fp), " ))\n"); return fflush(*(&xtrace_fp)); }
bash
angr_sailr
void print_clock_t(fp, t) FILE *fp; clock_t t; { time_t timestamp; long minutes; int seconds, seconds_fraction; clock_t_to_secs(t, &timestamp, &seconds_fraction); minutes = timestamp / 60; seconds = timestamp % 60; fprintf(fp, "%ldm%d%c%03ds", minutes, seconds, locale_decpoint(), seconds_fraction); }
unsigned long print_clock_t(FILE *a1, long a2) { unsigned int v2; unsigned int v3; unsigned int v5; unsigned int v6; long v7; long v8; unsigned long v9; v9 = __readfsqword(0x28u); clock_t_to_secs(a2, &v7, &v5); v8 = v7 / 60; v6 = v7 % 60; v2 = v5; v3 = locale_decpoint(a2); fprintf(a1, "%ldm%d%c%03ds", v8, v6, v3, v2); return __readfsqword(0x28u) ^ v9; }
bash
ida
static int do_rmmod(int argc, char *argv[]) { struct kmod_ctx *ctx; const char *null_config = ((void *)0); int flags = 0; int i, err, r = 0; for (;;) { int c, idx = 0; c = getopt_long(argc, argv, cmdopts_s, cmdopts, &idx); if (c == -1) break; switch (c) { case 'f': flags |= KMOD_REMOVE_FORCE; break; case 's': use_syslog = 1; break; case 'v': verbose++; break; case 'h': help(); return 0; case 'V': puts("kmod" " version " "30"); puts("-ZSTD -XZ -ZLIB -LIBCRYPTO -EXPERIMENTAL"); return 0; case '?': return 1; default: log_printf(3, "unexpected getopt_long() value '%c'.\n", c); return 1; } } log_open(use_syslog); if (optind >= argc) { log_printf(3, "missing module name.\n"); r = 1; goto done; } ctx = kmod_new(((void *)0), &null_config); if (!ctx) { log_printf(3, "kmod_new() failed!\n"); r = 1; goto done; } log_setup_kmod_log(ctx, verbose); for (i = optind; i < argc; i++) { struct kmod_module *mod; const char *arg = argv[i]; struct stat st; if (stat(arg, &st) == 0) err = kmod_module_new_from_path(ctx, arg, &mod); else err = kmod_module_new_from_name(ctx, arg, &mod); if (err < 0) { log_printf(3, "could not use module %s: %s\n", arg, strerror(-err)); break; } if (!(flags & KMOD_REMOVE_FORCE) && check_module_inuse(mod) < 0) { r++; goto next; } err = kmod_module_remove_module(mod, flags); if (err < 0) { log_printf(3, "could not remove module %s: %s\n", arg, strerror(-err)); r++; } next: kmod_module_unref(mod); } kmod_unref(ctx); done: log_close(); return r == 0 ? 0 : 1; }
bool do_rmmod(int param_1, long param_2) { int iVar1; char *pcVar2; long in_FS_OFFSET; bool bVar3; int local_dc; int local_d8; int local_d4; int local_d0; undefined8 local_c8; undefined4 local_c0; undefined4 uStack188; long local_b8; char *local_b0; stat local_a8; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); local_c8 = 0; local_dc = 0; local_d0 = 0; while (true) { local_c0 = 0; iVar1 = getopt_long(param_1, param_2, "fsvVwh", cmdopts, &local_c0); if (iVar1 == -1) break; if (iVar1 == 0x3f) { bVar3 = true; goto LAB_001009e0; } if (((iVar1 < 0x3f) || (0x76 < iVar1)) || (iVar1 < 0x56)) { switchD_00100707_caseD_57: log_printf(3, "unexpected getopt_long() value \'%c\'.\n", iVar1); bVar3 = true; goto LAB_001009e0; } switch (iVar1) { case 0x56: puts("kmod version 30"); puts("-ZSTD -XZ -ZLIB -LIBCRYPTO -EXPERIMENTAL"); bVar3 = false; goto LAB_001009e0; default: goto switchD_00100707_caseD_57; case 0x66: local_dc = 0x200; break; case 0x68: help(); bVar3 = false; goto LAB_001009e0; case 0x73: use_syslog = 1; break; case 0x76: verbose = verbose + 1; } } log_open(use_syslog != 0); if (optind < param_1) { local_b8 = kmod_new(0, &local_c8); if (local_b8 == 0) { log_printf(3, "kmod_new() failed!\n"); local_d0 = 1; } else { log_setup_kmod_log(local_b8, verbose); for (local_d8 = optind; local_d8 < param_1; local_d8 = local_d8 + 1) { local_b0 = *(char **)(param_2 + (long)local_d8 * 8); iVar1 = stat(local_b0, &local_a8); if (iVar1 == 0) { local_d4 = kmod_module_new_from_path(local_b8, local_b0, &local_c0); } else { local_d4 = kmod_module_new_from_name(local_b8, local_b0, &local_c0); } if (local_d4 < 0) { pcVar2 = strerror(-local_d4); log_printf(3, "could not use module %s: %s\n", local_b0, pcVar2); break; } if ((local_dc == 0) && (iVar1 = check_module_inuse(CONCAT44(uStack188, local_c0)), iVar1 < 0)) { local_d0 = local_d0 + 1; } else { iVar1 = kmod_module_remove_module(CONCAT44(uStack188, local_c0), local_dc); if (iVar1 < 0) { pcVar2 = strerror(-iVar1); log_printf(3, "could not remove module %s: %s\n", local_b0, pcVar2); local_d0 = local_d0 + 1; } } kmod_module_unref(CONCAT44(uStack188, local_c0)); } kmod_unref(local_b8); } } else { log_printf(3, "missing module name.\n"); local_d0 = 1; } log_close(); bVar3 = local_d0 != 0; LAB_001009e0: if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) { __stack_chk_fail(); } return bVar3; }
kmod
ghidra
static STRINGLIST *gen_matches_from_itemlist(itp, text) ITEMLIST *itp; const char *text; { STRINGLIST *ret, *sl; int tlen, i, n; char *ntxt; if ((itp->flags & (0x002 | 0x001)) || (itp->flags & 0x004) == 0) { if (itp->flags & (0x002 | 0x001)) clean_itemlist(itp); if ((itp->flags & 0x004) == 0) initialize_itemlist(itp); } if (itp->slist == 0) return ((STRINGLIST *)((void *)0)); ret = strlist_create(itp->slist->list_len + 1); sl = itp->slist; ntxt = bash_dequote_text(text); tlen = (((ntxt) && (ntxt)[0]) ? ((ntxt)[1] ? ((ntxt)[2] ? strlen(ntxt) : 2) : 1) : 0); for (i = n = 0; i < sl->list_len; i++) { if (tlen == 0 || ((tlen == 0) ? (1) : ((sl->list[i])[0] == (ntxt)[0] && strncmp(sl->list[i], ntxt, tlen) == 0))) ret->list[n++] = ((sl->list[i]) ? (char *)strcpy(sh_xmalloc((1 + strlen(sl->list[i])), "pcomplete.c", 719), (sl->list[i])) : (char *)((void *)0)); } ret->list[ret->list_len = n] = (char *)((void *)0); do { if (ntxt) sh_xfree((ntxt), "pcomplete.c", 723); } while (0); return ret; }
int gen_matches_from_itemlist(struct_0 *a0, unsigned long long a1) { unsigned int v0; int tmp_22; unsigned int v1; unsigned int v2; struct_1 *v3; struct_1 *v4; char v5[3]; unsigned int v7; unsigned long v8; unsigned long long *v9; if ((a0->field_0 & 3) || !(a0->field_0 & 4)) { if ((a0->field_0 & 3)) clean_itemlist(a0); if (!(a0->field_0 & 4)) initialize_itemlist(a0); } if (!a0->field_10) { v7 = 0; return v7; } v3 = strlist_create(a0->field_10->field_c + 1); v4 = a0->field_10; *(&v5) = bash_dequote_text(a1); if (!v5 || !v5[0]) { v7 = 0; } else if (!v5[1]) { v7 = 1; } else if (!v5[2]) { v7 = 2; } else { v7 = strlen(v5); } v2 = v7; v1 = 0; for (v0 = v1; v0 < v4->field_c; v0 += 1) { if (!v2 || *(*((v4->field_0 + (v0 << 3)))) == v5[0] && !strncmp(*((v4->field_0 + (v0 << 3))), v5, v2)) { v8 = (!*((v4->field_0 + (v0 << 3))) ? strcpy(sh_xmalloc(strlen(*((v4->field_0 + v0 * 8))) + 1, "pcomplete.c", 0x2cf), *((v4->field_0 + v0 * 8))) : 0); tmp_22 = v1; v1 += 1; *((tmp_22 * 8 + v3->field_0)) = v8; } } v9 = v3->field_0; v3->field_c = v1; v9[v3->field_c] = 0; if (v5) sh_xfree(v5, "pcomplete.c", 0x2d3); v7 = v3; return v7; }
bash
angr_sailr
static int file_has_acl_cache(char const *file, struct fileinfo *f) { static dev_t unsupported_device; if (f->stat.st_dev == unsupported_device) { (*__errno_location()) = 95; return 0; } (*__errno_location()) = 0; int n = file_has_acl(file, &f->stat); if (n <= 0 && errno_unsupported((*__errno_location()))) unsupported_device = f->stat.st_dev; return n; }
int file_has_acl_cache(unsigned long long a0, struct_0 *a1) { unsigned int v0; unsigned int v2; if (a1->field_18 == unsupported_device.9567) { *(__errno_location()) = 95; v2 = 0; return v2; } *(__errno_location()) = 0; v0 = file_has_acl(a0, &a1->field_18, &a1->field_18); if (v0 <= 0 && errno_unsupported(*(__errno_location()))) unsupported_device.9567 = a1->field_18; v2 = v0; return v2; }
coreutils
angr_sailr
static void usage(FILE *f) { fprintf( f, "Usage: ... macsec [ [ address <lladdr> ] port { 1..2^16-1 } | sci <u64> " "]\n" " [ cipher { default | gcm-aes-128 | gcm-aes-256 } ]\n" " [ icvlen { 8..16 } ]\n" " [ encrypt { on | off } ]\n" " [ send_sci { on | off } ]\n" " [ end_station { on | off } ]\n" " [ scb { on | off } ]\n" " [ protect { on | off } ]\n" " [ replay { on | off} window { 0..2^32-1 } ]\n" " [ validate { strict | check | disabled } ]\n" " [ encodingsa { 0..3 } ]\n" " [ offload { mac | phy | off } ]\n"); }
int usage(FILE *a1) { return fprintf( a1, "Usage: ... macsec [ [ address <lladdr> ] port { 1..2^16-1 } | sci <u64> " "]\n" " [ cipher { default | gcm-aes-128 | gcm-aes-256 } ]\n" " [ icvlen { 8..16 } ]\n" " [ encrypt { on | off } ]\n" " [ send_sci { on | off } ]\n" " [ end_station { on | off } ]\n" " [ scb { on | off } ]\n" " [ protect { on | off } ]\n" " [ replay { on | off} window { 0..2^32-1 } ]\n" " [ validate { strict | check | disabled } ]\n" " [ encodingsa { 0..3 } ]\n" " [ offload { mac | phy | off } ]\n"); }
iproute2-6.0.0
ida
void print_var_list(list) register SHELL_VAR **list; { register int i; register SHELL_VAR *var; for (i = 0; list && (var = list[i]); i++) if (((((var)->attributes) & (0x0001000))) == 0) print_assignment(var); }
long long print_var_list(void *a0) { void *v1; void *v2; unsigned long long v3; v1 = a0; for (v2 = 0; a0; v2 = v2 + 1) { v3 = v2 * 8 + v1; if (!*((0x8 * v2 + v1))) break; if (*((0x8 * v2 + v1))) { v3 = a0[40] & 0x1000; if (!(a0[40] & 0x1000)) { a0 = *((0x8 * v2 + a0)); v3 = print_assignment(a0); } } } return v3; }
bash
angr_dream
struct timespec current_timespec(void) { struct timespec ts; gettime(&ts); return ts; }
long long current_timespec() { char v0; gettime(&v0); return *(&v0); }
gnutls
angr_dream
int deflateSetHeader(strm, head) z_streamp strm; gz_headerp head; { if (deflateStateCheck(strm) || strm->state->wrap != 2) return (-2); strm->state->gzhead = head; return 0; }
long long deflateSetHeader(struct_0 *a0, unsigned long a1) { unsigned long long v1; if (deflateStateCheck(a0)) { LABEL_400bc1: v1 = 4294967294; } else { if (!(a0->field_38->field_30 == 2)) goto LABEL_400bc1; a0->field_38->field_38 = a1; v1 = 0; } return v1; }
zlib
angr_phoenix
static inline int parser_eof(void) { return tokpushback && lasttoken == 0; }
int parser_eof() { unsigned int v1; if (tokpushback && !lasttoken) { v1 = 1; goto LABEL_400049; } v1 = 0; LABEL_400049: return v1; }
dash-0.5.11+git20210903+057cd650a4ed
angr_phoenix
static void Hash_prefix(unsigned char *out, int b, const unsigned char *in, int inlen) { unsigned char x[inlen + 1]; unsigned char h[64]; int i; x[0] = b; for (i = 0; i < inlen; ++i) x[i + 1] = in[i]; crypto_hash_sha512(h, x, inlen + 1); for (i = 0; i < 32; ++i) out[i] = h[i]; }
unsigned long Hash_prefix(long a1, int a2, long a3, int a4) { unsigned long v4; void *v5; long v7[3]; long v8; int v9; int v10; long v11; int i; long v13; long *v14; char v15[72]; unsigned long v16; v11 = a1; v10 = a2; v8 = a3; v9 = a4; v16 = __readfsqword(0x28u); v13 = a4 + 1 - 1LL; v7[0] = a4 + 1; v7[1] = 0LL; v4 = 16 * ((v7[0] + 15) / 0x10uLL); while (v7 != (long *)((char *)v7 - (v4 & 0xFFFFFFFFFFFFF000LL))) ; v5 = alloca(v4 & 0xFFF); if ((v4 & 0xFFF) != 0) *(long *)((char *)&v7[-1] + (v4 & 0xFFF)) = *(long *)((char *)&v7[-1] + (v4 & 0xFFF)); v14 = v7; LOBYTE(v7[0]) = v10; for (i = 0; i < v9; ++i) *((_BYTE *)v14 + i + 1) = *(_BYTE *)(i + v8); crypto_hash_sha512(v15, v14, v9 + 1); for (i = 0; i <= 31; ++i) *(_BYTE *)(v11 + i) = v15[i]; return __readfsqword(0x28u) ^ v16; }
openssh-portable
ida
static _Bool extra_mode(mode_t input) { mode_t mask = ((0400 | 0200 | 0100) | ((0400 | 0200 | 0100) >> 3) | (((0400 | 0200 | 0100) >> 3) >> 3)) | 0170000; return !!(input & ~mask); }
uint extra_mode(uint param_1) { return param_1 & 0xffff0e00 | (uint)((param_1 & 0xffff0e00) != 0); }
coreutils
ghidra
static int arch_remove(const char *const *argv) { const char *archname = *argv++; struct dpkg_arch *arch; struct pkg_hash_iter *iter; struct pkginfo *pkg; if (archname == ((void *)0) || *argv) badusage(gettext("--%s takes exactly one argument"), cipaction->olong); modstatdb_open(msdbrw_readonly); arch = dpkg_arch_find(archname); if (arch->type != DPKG_ARCH_FOREIGN) { warning(gettext("cannot remove non-foreign architecture '%s'"), arch->name); return 0; } iter = pkg_hash_iter_new(); while ((pkg = pkg_hash_iter_next_pkg(iter))) { if (pkg->status < PKG_STAT_HALFINSTALLED) continue; if (pkg->installed.arch == arch) { if (in_force(FORCE_ARCHITECTURE)) warning( gettext("removing architecture '%s' currently in use by database"), arch->name); else ohshit(gettext("cannot remove architecture '%s' currently in use by " "the database"), arch->name); break; } } pkg_hash_iter_free(iter); dpkg_arch_unmark(arch); dpkg_arch_save_list(); modstatdb_shutdown(); return 0; }
long arch_remove(long *a1) { long v1; char *v2; long v3; char *v4; long i; long v7; char *v8; long v9; char *v10; long v11; long v12; long v13; long v14; v12 = *a1; if (!*a1 || a1[1]) { v1 = *cipaction; v2 = gettext("--%s takes exactly one argument"); badusage(v2, v1); } modstatdb_open(0LL); v13 = dpkg_arch_find(v12); if (*(_DWORD *)(v13 + 16) == 6) { v14 = pkg_hash_iter_new(); for (i = pkg_hash_iter_next_pkg(v14); i; i = pkg_hash_iter_next_pkg(v14)) { if (*(_DWORD *)(i + 24) > 1u && v13 == *(_QWORD *)(i + 88)) { if ((unsigned char)in_force(1LL)) { v7 = *(_QWORD *)(v13 + 8); v8 = gettext( "removing architecture '%s' currently in use by database"); warning(v8, v7); break; } v9 = *(_QWORD *)(v13 + 8); v10 = gettext( "cannot remove architecture '%s' currently in use by the database"); ohshit(v10, v9, v11); } } pkg_hash_iter_free(v14); dpkg_arch_unmark(v13); dpkg_arch_save_list(); modstatdb_shutdown(); return 0LL; } else { v3 = *(_QWORD *)(v13 + 8); v4 = gettext("cannot remove non-foreign architecture '%s'"); warning(v4, v3); return 0LL; } }
dpkg
ida
static _Bool buf_has_nulls(char *buf, idx_t size) { buf[size] = 0; return strlen(buf) != size; }
int buf_has_nulls(char *a0, char *a1) { unsigned long long v1; *((a0 + a1)) = 0; v1 = strlen(a0); *(&v1) = v1 != a1; return v1; }
grep
angr_phoenix
int check_zipfile(in) int in; { uch *h = inbuf + inptr; ifd = in; inptr += 30 + ((ush)(uch)((h + 26)[0]) | ((ush)(uch)((h + 26)[1]) << 8)) + ((ush)(uch)((h + 28)[0]) | ((ush)(uch)((h + 28)[1]) << 8)); if (inptr > insize || ((ulg)(((ush)(uch)((h)[0]) | ((ush)(uch)((h)[1]) << 8))) | ((ulg)(((ush)(uch)(((h) + 2)[0]) | ((ush)(uch)(((h) + 2)[1]) << 8))) << 16)) != 0x04034b50L) { fprintf(stderr, "\n%s: %s: not a valid zip file\n", program_name, ifname); exit_code = 1; return 1; } method = h[8]; if (method != 0 && method != 8) { fprintf(stderr, "\n%s: %s: first entry not deflated or stored -- use unzip\n", program_name, ifname); exit_code = 1; return 1; } if ((decrypt = h[6] & 1) != 0) { fprintf(stderr, "\n%s: %s: encrypted file -- use unzip\n", program_name, ifname); exit_code = 1; return 1; } ext_header = (h[6] & 8) != 0; pkzip = 1; return 0; }
long long check_zipfile(unsigned long a0) { char v0[30]; unsigned long long v2; *(&v0[0]) = &inbuf + inptr; ifd = a0; inptr = inptr + (v0[28] | (v0[29] * 0x100)) + (v0[26] | (v0[27] * 0x100)) + 30; if (inptr > insize) { LABEL_4000e7: fprintf(*(&stderr), "\n%s: %s: not a valid zip file\n", *(&program_name), &ifname); exit_code = 1; v2 = 1; } else { if (!((v0[0] | (v0[1] << 8) | (v0[2] | (v0[3] << 8)) << 16) == 67324752)) goto LABEL_4000e7; method = v0[8]; if (method && method != 8) { fprintf(*(&stderr), "\n%s: %s: first entry not deflated or stored -- use unzip\n", *(&program_name), &ifname); exit_code = 1; v2 = 1; goto LABEL_400213; } decrypt = v0[6] & 1; if (!decrypt) { ext_header = (v0[6] & 8); pkzip = 1; v2 = 0; } else { fprintf(*(&stderr), "\n%s: %s: encrypted file -- use unzip\n", *(&program_name), &ifname); exit_code = 1; v2 = 1; } } LABEL_400213: return v2; }
gzip-1.12
angr_phoenix
static inline void inet_prefix_reset(inet_prefix *p) { p->flags = 0; }
void inet_prefix_reset(unsigned short *a0) { char v0; unsigned short *v2; unsigned long long v3; v2 = a0; *(a0) = 0; v3 = *(&v0); return; }
iproute2-6.0.0
angr_sailr
void __new_obj_p_here(int magic, void *here) { obj_prefix *obj_p = here; obj_p->p_magic = (long)magic; obj_p->p_flags = 0; }
void __new_obj_p_here(undefined2 param_1, undefined2 *param_2) { *param_2 = param_1; param_2[1] = 0; return; }
acl-2.3.1
ghidra
static SHELL_VAR *null_array_assign(self, value, ind, key) SHELL_VAR *self; char *value; arrayind_t ind; char *key; { return (self); }
long long null_array_assign(unsigned long a0, unsigned long a1, unsigned long a2, unsigned long a3) { unsigned long v0; unsigned long v1; unsigned long v2; v2 = a1; v1 = a2; v0 = a3; return a0; }
bash
angr_dream
static inline void emit_ancillary_info(char const *program) { struct infomap { char const *program; char const *node; } const infomap[] = { {"[", "test invocation"}, {"coreutils", "Multi-call invocation"}, {"sha224sum", "sha2 utilities"}, {"sha256sum", "sha2 utilities"}, {"sha384sum", "sha2 utilities"}, {"sha512sum", "sha2 utilities"}, {((void *)0), ((void *)0)}}; char const *node = program; struct infomap const *map_prog = infomap; while (map_prog->program && !(strcmp(program, map_prog->program) == 0)) map_prog++; if (map_prog->node) node = map_prog->node; printf (gettext ("\n%s online help: <%s>\n"), "GNU coreutils", "https: char const *lc_messages = setlocale ( 5 , ((void *)0) ); if (lc_messages && strncmp (lc_messages, "" "en_" "", sizeof ("en_") - 1)) { fputs_unlocked (gettext ("Report any translation bugs to " "<https: stdout ) ; } char const *url_program = (strcmp (program, "[") == 0) ? "test" : program; printf (gettext ("Full documentation <%s%s>\n"), "https: printf (gettext ("or available locally via: info '(coreutils) %s%s'\n"), node, node == program ? " invocation" : ""); }
void emit_ancillary_info(char *a0) { unsigned long v0; unsigned long long v1[2]; char *v2; unsigned long v3; unsigned long long v4; unsigned long long v5; unsigned long long v6; unsigned long long v7; unsigned long long v8; unsigned long long v9; unsigned long long v10; unsigned long long v11; unsigned long long v12; unsigned long long v13; unsigned long long v14; unsigned long long v15; void *v16; void *v17; char v18; unsigned long long *v21; unsigned long long v22; v4 = "["; v5 = "test invocation"; v6 = "coreutils"; v7 = "Multi-call invocation"; v8 = "sha224sum"; v9 = "sha2 utilities"; v10 = "sha256sum"; v11 = "sha2 utilities"; v12 = "sha384sum"; v13 = "sha2 utilities"; v14 = "sha512sum"; v15 = "sha2 utilities"; v16 = 0; v17 = 0; v0 = a0; for (v1[0] = &v4; v1[0] && strcmp(a0, v1[0]); v1[0] = v1 + 1) ; if (v1[1]) v0 = v1[1]; printf(gettext("\n%s online help: <%s>\n")); v2 = setlocale(0x5, NULL); if (v2 && strncmp(v2, "en_", 0x3)) fputs_unlocked(gettext("Report any translation bugs to <https: *(&v3) = (!strcmp(a0, "[") ? a0 : "test"); printf(gettext("Full documentation <%s%s>\n")); printf(gettext("or available locally via: info '(coreutils) %s%s'\n")); v22 = *(&v18) ^ v21[5]; return; }
coreutils
angr_sailr
static void set_home_var() { SHELL_VAR *temp_var; temp_var = find_variable("HOME"); if (temp_var == 0) temp_var = bind_variable("HOME", sh_get_home_dir(), 0); }
void set_home_var(void) { long lVar1; undefined8 uVar2; lVar1 = find_variable(&DAT_0010bc42); if (lVar1 == 0) { uVar2 = sh_get_home_dir(); bind_variable(&DAT_0010bc42, uVar2, 0); } return; }
bash
ghidra
static int sshsk_add_option(struct sk_option ***optsp, size_t *noptsp, const char *name, const char *value, uint8_t required) { struct sk_option **opts = *optsp; size_t nopts = *noptsp; if ((opts = recallocarray(opts, nopts, nopts + 2, sizeof(*opts))) == ((void *)0)) { sshlog("ssh-sk.c", __func__, 389, 1, SYSLOG_LEVEL_ERROR, ((void *)0), "array alloc failed"); return -2; } *optsp = opts; *noptsp = nopts + 1; if ((opts[nopts] = calloc(1, sizeof(**opts))) == ((void *)0)) { sshlog("ssh-sk.c", __func__, 395, 1, SYSLOG_LEVEL_ERROR, ((void *)0), "alloc failed"); return -2; } if ((opts[nopts]->name = strdup(name)) == ((void *)0) || (opts[nopts]->value = strdup(value)) == ((void *)0)) { sshlog("ssh-sk.c", __func__, 400, 1, SYSLOG_LEVEL_ERROR, ((void *)0), "alloc failed"); return -2; } opts[nopts]->required = required; return 0; }
int sshsk_add_option(unsigned long long *a0, unsigned long long *a1, char *a2, char *a3, unsigned long a4) { unsigned long long v0; struct struct_0 **v1; struct struct_0 **v2; unsigned long long *v4; unsigned int v5; struct_0 *v6; struct_0 *v7; v1 = *(a0); v2 = *(a1); v1 = recallocarray(v1, v2, v2 + 2, 0x8); if (!v1) { v0 = "array alloc failed"; sshlog("ssh-sk.c", "sshsk_add_option", 0x185, 0x1, 0x2, 0x0); v5 = -2; } else { *(a0) = v1; *(a1) = v2 + 1; v4 = 0x8 * v2 + v1; *(v4) = calloc(0x1, 0x18); if (!*(v4)) { v0 = "alloc failed"; sshlog("ssh-sk.c", "sshsk_add_option", 0x18b, 0x1, 0x2, 0x0); v5 = -2; } else { v6 = *((v1 + 0x8 * v2)); *(*((v1 + 0x8 * v2))) = strdup(a2); if (v6->field_0) { v7 = *((v1 + 0x8 * v2)); *((*((v1 + 0x8 * v2)) + 8)) = strdup(a3); if (v7->field_8) { *((*((v1 + 0x8 * v2)) + 16)) = a4; v5 = 0; } } if (!v7->field_8 || !v6->field_0) { v0 = "alloc failed"; sshlog("ssh-sk.c", "sshsk_add_option", 0x190, 0x1, 0x2, 0x0); v5 = -2; } } } return v5; }
openssh-portable
angr_dream
static errcode_t e2fsck_get_journal(e2fsck_t ctx, journal_t **ret_journal) { struct process_block_struct pb; struct ext2_super_block *sb = ctx->fs->super; struct ext2_super_block jsuper; struct problem_context pctx; struct buffer_head *bh; struct inode *j_inode = ((void *)0); struct kdev_s *dev_fs = ((void *)0), *dev_journal; const char *journal_name = 0; journal_t *journal = ((void *)0); errcode_t retval = 0; io_manager io_ptr = 0; unsigned long long start = 0; int ret; int ext_journal = 0; int tried_backup_jnl = 0; clear_problem_context(&pctx); journal = e2fsck_allocate_memory(ctx, sizeof(journal_t), "journal"); if (!journal) { return (2133571398L); } dev_fs = e2fsck_allocate_memory(ctx, 2 * sizeof(struct kdev_s), "kdev"); if (!dev_fs) { retval = (2133571398L); goto errout; } dev_journal = dev_fs + 1; dev_fs->k_ctx = dev_journal->k_ctx = ctx; dev_fs->k_dev = 1; dev_journal->k_dev = 2; journal->j_dev = dev_journal; journal->j_fs_dev = dev_fs; journal->j_inode = ((void *)0); journal->j_blocksize = ctx->fs->blocksize; if (uuid_is_null(sb->s_journal_uuid)) { if (!sb->s_journal_inum) { retval = (2133571369L); goto errout; } j_inode = e2fsck_allocate_memory(ctx, sizeof(*j_inode), "journal inode"); if (!j_inode) { retval = (2133571398L); goto errout; } j_inode->i_ctx = ctx; j_inode->i_ino = sb->s_journal_inum; if ((retval = ext2fs_read_inode(ctx->fs, sb->s_journal_inum, &j_inode->i_ext2))) { try_backup_journal: if (sb->s_jnl_backup_type != 1 || tried_backup_jnl) goto errout; memset(&j_inode->i_ext2, 0, sizeof(struct ext2_inode)); memcpy(&j_inode->i_ext2.i_block[0], sb->s_jnl_blocks, (((12 + 1) + 1) + 1) * 4); j_inode->i_ext2.i_size_high = sb->s_jnl_blocks[15]; j_inode->i_ext2.i_size = sb->s_jnl_blocks[16]; j_inode->i_ext2.i_links_count = 1; j_inode->i_ext2.i_mode = 0100000 | 0600; e2fsck_use_inode_shortcuts(ctx, 1); ctx->stashed_ino = j_inode->i_ino; ctx->stashed_inode = &j_inode->i_ext2; tried_backup_jnl++; } if (!j_inode->i_ext2.i_links_count || !(((j_inode->i_ext2.i_mode) & 00170000) == 0100000)) { retval = (2133571416L); goto try_backup_journal; } if (((&j_inode->i_ext2)->i_size | ((__u64)(&j_inode->i_ext2)->i_size_high << 32)) / journal->j_blocksize < 1024) { retval = (2133571413L); goto try_backup_journal; } pb.last_block = -1; retval = ext2fs_block_iterate3(ctx->fs, j_inode->i_ino, 1, 0, process_journal_block, &pb); if ((pb.last_block + 1) * ctx->fs->blocksize < (int)((&j_inode->i_ext2)->i_size | ((__u64)(&j_inode->i_ext2)->i_size_high << 32))) { retval = (2133571413L); goto try_backup_journal; } if (tried_backup_jnl && !(ctx->options & 0x0001)) { retval = ext2fs_write_inode(ctx->fs, sb->s_journal_inum, &j_inode->i_ext2); if (retval) goto errout; } journal->j_total_len = ((&j_inode->i_ext2)->i_size | ((__u64)(&j_inode->i_ext2)->i_size_high << 32)) / journal->j_blocksize; journal->j_inode = j_inode; ctx->journal_io = ctx->fs->io; if ((ret = jbd2_journal_bmap(journal, 0, &start)) != 0) { retval = (errcode_t)(-1 * ret); goto errout; } } else { ext_journal = 1; if (!ctx->journal_name) { char uuid[37]; uuid_unparse(sb->s_journal_uuid, uuid); ctx->journal_name = blkid_get_devname(ctx->blkid, "UUID", uuid); if (!ctx->journal_name) ctx->journal_name = blkid_devno_to_devname(sb->s_journal_dev); } journal_name = ctx->journal_name; if (!journal_name) { fix_problem(ctx, 0x000011, &pctx); retval = (2133571415L); goto errout; } do { if ((1) <= (-1)) { printf("" "(%s, %d): %s: ", "journal.c", 1089, __FUNCTION__); printf("Using journal file %s\n", journal_name); } } while (0); io_ptr = unix_io_manager; } if (ext_journal) { int flags = 0x0001; if (!(ctx->mount_flags & 2 && ctx->mount_flags & 4)) flags |= 0x0002; if ((ctx->mount_flags & 4) && (ctx->options & 0x0100)) flags &= ~0x0002; retval = io_ptr->open(journal_name, flags, &ctx->journal_io); } if (retval) goto errout; ((ctx->journal_io) ->manager->set_blksize((ctx->journal_io), ctx->fs->blocksize)); if (ext_journal) { blk64_t maxlen; start = ext2fs_journal_sb_start(ctx->fs->blocksize) - 1; bh = getblk(dev_journal, start, ctx->fs->blocksize); if (!bh) { retval = (2133571398L); goto errout; } ll_rw_block(0, 0, 1, &bh); if ((retval = bh->b_err) != 0) { brelse(bh); goto errout; } memcpy(&jsuper, start ? bh->b_data : bh->b_data + 1024, sizeof(jsuper)); if (jsuper.s_magic != 0xEF53 || !ext2fs_has_feature_journal_dev(&jsuper)) { fix_problem(ctx, 0x000012, &pctx); retval = (2133571415L); brelse(bh); goto errout; } if (memcmp(jsuper.s_uuid, ctx->fs->super->s_journal_uuid, sizeof(jsuper.s_uuid))) { fix_problem(ctx, 0x000013, &pctx); retval = (2133571415L); brelse(bh); goto errout; } if (ext2fs_has_feature_metadata_csum(&jsuper)) { struct struct_ext2_filsys fsx; struct ext2_super_block superx; void *p; p = start ? bh->b_data : bh->b_data + 1024; memcpy(&fsx, ctx->fs, sizeof(fsx)); memcpy(&superx, ctx->fs->super, sizeof(superx)); fsx.super = &superx; ext2fs_set_feature_metadata_csum(fsx.super); if (!ext2fs_superblock_csum_verify(&fsx, p) && fix_problem(ctx, 0x00004A, &pctx)) { ext2fs_superblock_csum_set(&fsx, p); mark_buffer_dirty(bh); } } brelse(bh); maxlen = ext2fs_blocks_count(&jsuper); journal->j_total_len = (maxlen < 1ULL << 32) ? maxlen : (1ULL << 32) - 1; start++; } if (!(bh = getblk(dev_journal, start, journal->j_blocksize))) { retval = (2133571398L); goto errout; } journal->j_sb_buffer = bh; journal->j_superblock = (journal_superblock_t *)bh->b_data; if (ext2fs_has_feature_fast_commit(ctx->fs->super)) journal->j_fc_replay_callback = ext4_fc_replay; else journal->j_fc_replay_callback = ((void *)0); *ret_journal = journal; e2fsck_use_inode_shortcuts(ctx, 0); return 0; errout: e2fsck_use_inode_shortcuts(ctx, 0); if (dev_fs) ext2fs_free_mem(&dev_fs); if (j_inode) ext2fs_free_mem(&j_inode); if (journal) ext2fs_free_mem(&journal); return retval; }
long e2fsck_get_journal(const void **a1, _QWORD *a2) { const void *v3; long v4; int v5; int v6; int v7; unsigned int v8; int v9; long v10; int *v11; long v12; long v13; long memory; long v15; const void *v16; long inode; long v18; long v19; _DWORD *v20; long v21; unsigned long v22; char v23[112]; long v24[46]; short dest[512]; char v26[1024]; char v27[40]; unsigned long v28; v28 = __readfsqword(0x28u); v19 = *((_QWORD *)*a1 + 4); v12 = 0LL; v13 = 0LL; v16 = 0LL; inode = 0LL; v18 = 0LL; v15 = 0LL; v6 = 0; v7 = 0; clear_problem_context(v23); memory = e2fsck_allocate_memory(a1, 208LL, "journal"); if (!memory) return 2133571398LL; v13 = e2fsck_allocate_memory(a1, 32LL, "kdev"); if (v13) { v20 = (_DWORD *)(v13 + 16); *(_QWORD *)(v13 + 16) = a1; *(_QWORD *)v13 = *(_QWORD *)v20; *(_DWORD *)(v13 + 8) = 1; v20[2] = 2; *(_QWORD *)(memory + 104) = v20; *(_QWORD *)(memory + 112) = v13; *(_QWORD *)(memory + 136) = 0LL; *(_DWORD *)(memory + 120) = *((_DWORD *)*a1 + 10); if ((unsigned int)uuid_is_null(v19 + 208)) { if (*(_DWORD *)(v19 + 224)) { v12 = e2fsck_allocate_memory(a1, 144LL, "journal inode"); if (v12) { *(_QWORD *)v12 = a1; *(_DWORD *)(v12 + 8) = *(_DWORD *)(v19 + 224); inode = ext2fs_read_inode(*a1, *(unsigned int *)(v19 + 224), v12 + 12); if (!inode) goto LABEL_14; while (*(_BYTE *)(v19 + 253) == 1 && !v7) { memset((void *)(v12 + 12), 0, 0x80uLL); memcpy((void *)(v12 + 52), (const void *)(v19 + 268), 0x3CuLL); *(_DWORD *)(v12 + 120) = *(_DWORD *)(v19 + 328); *(_DWORD *)(v12 + 16) = *(_DWORD *)(v19 + 332); *(_WORD *)(v12 + 38) = 1; *(_WORD *)(v12 + 12) = -32384; e2fsck_use_inode_shortcuts(a1, 1LL); *((_DWORD *)a1 + 134) = *(_DWORD *)(v12 + 8); a1[68] = (const void *)(v12 + 12); v7 = 1; LABEL_14: if (*(_WORD *)(v12 + 38) && (*(_WORD *)(v12 + 12) & 0xF000) == 0x8000) { if ((((unsigned long)*(unsigned int *)(v12 + 120) << 32) | *(unsigned int *)(v12 + 16)) / *(int *)(memory + 120) > 0x3FF) { v10 = -1LL; inode = ext2fs_block_iterate3(*a1, *(unsigned int *)(v12 + 8), 1LL, 0LL, process_journal_block, &v10); if (*((unsigned int *)*a1 + 10) * (v10 + 1) >= *(int *)(v12 + 16)) { if (!v7 || (*((_DWORD *)a1 + 19) & 1) != 0 || (inode = ext2fs_write_inode( *a1, *(unsigned int *)(v19 + 224), v12 + 12)) == 0) { *(_DWORD *)(memory + 128) = (((unsigned long)*(unsigned int *)(v12 + 120) << 32) | *(unsigned int *)(v12 + 16)) / *(int *)(memory + 120); *(_QWORD *)(memory + 136) = v12; a1[77] = (const void *)*((_QWORD *)*a1 + 1); v9 = jbd2_journal_bmap(memory, 0LL, &v15); if (!v9) goto LABEL_32; inode = -v9; } goto LABEL_70; } inode = 2133571413LL; } else { inode = 2133571413LL; } } else { inode = 2133571416LL; } } } else { inode = 2133571398LL; } } else { inode = 2133571369LL; } goto LABEL_70; } v6 = 1; if (!a1[78]) { uuid_unparse(v19 + 208, v27); a1[78] = (const void *)blkid_get_devname(a1[17], "UUID", v27); if (!a1[78]) a1[78] = (const void *)blkid_devno_to_devname(*(unsigned int *)(v19 + 228)); } v16 = a1[78]; if (v16) { v18 = unix_io_manager; LABEL_32: if (v6) { v8 = 1; if ((*((_DWORD *)a1 + 31) & 2) == 0 || (*((_DWORD *)a1 + 31) & 4) == 0) v8 = 3; if ((*((_DWORD *)a1 + 31) & 4) != 0 && (*((_DWORD *)a1 + 19) & 0x100) != 0) v8 &= ~2u; inode = (*(long (**)(const void *, _QWORD, const void **))(v18 + 16))( v16, v8, a1 + 77); } if (inode) goto LABEL_70; (*(void (**)(const void *, _QWORD))(*((_QWORD *)a1[77] + 1) + 32LL))( a1[77], *((unsigned int *)*a1 + 10)); if (v6) { v15 = (int)(ext2fs_journal_sb_start(*((unsigned int *)*a1 + 10)) - 1); v11 = (int *)getblk(v20, v15, *((_DWORD *)*a1 + 10)); if (!v11) { inode = 2133571398LL; goto LABEL_70; } ll_rw_block(0, 0LL, 1, (long *)&v11); inode = v11[5]; if (inode) { brelse((long)v11); goto LABEL_70; } if (v15) v3 = v11 + 10; else v3 = v11 + 266; memcpy(dest, v3, sizeof(dest)); if (dest[28] != -4269 || !ext2fs_has_feature_journal_dev((long)dest)) { fix_problem(a1, 18LL, v23); inode = 2133571415LL; brelse((long)v11); goto LABEL_70; } if (memcmp(&dest[52], (const void *)(*((_QWORD *)*a1 + 4) + 208LL), 0x10uLL)) { fix_problem(a1, 19LL, v23); inode = 2133571415LL; brelse((long)v11); goto LABEL_70; } if (ext2fs_has_feature_metadata_csum((long)dest)) { v4 = (long)(v15 ? v11 + 10 : v11 + 266); v21 = v4; memcpy(v24, *a1, sizeof(v24)); memcpy(v26, *((const void **)*a1 + 4), sizeof(v26)); v24[4] = (long)v26; ext2fs_set_feature_metadata_csum((long)v26); if (!(unsigned int)ext2fs_superblock_csum_verify(v24, v21)) { if ((unsigned int)fix_problem(a1, 74LL, v23)) { ext2fs_superblock_csum_set(v24, v21); mark_buffer_dirty((long)v11); } } } brelse((long)v11); v22 = ext2fs_blocks_count(dest); v5 = -1; if (v22 <= 0xFFFFFFFF) v5 = v22; *(_DWORD *)(memory + 128) = v5; ++v15; } v11 = (int *)getblk(v20, v15, *(_DWORD *)(memory + 120)); if (v11) { *(_QWORD *)(memory + 16) = v11; *(_QWORD *)(memory + 24) = v11 + 10; if (ext2fs_has_feature_fast_commit(*((_QWORD *)*a1 + 4))) *(_QWORD *)(memory + 200) = ext4_fc_replay; else *(_QWORD *)(memory + 200) = 0LL; *a2 = memory; e2fsck_use_inode_shortcuts(a1, 0LL); return 0LL; } inode = 2133571398LL; } else { fix_problem(a1, 17LL, v23); inode = 2133571415LL; } } else { inode = 2133571398LL; } LABEL_70: e2fsck_use_inode_shortcuts(a1, 0LL); if (v13) ext2fs_free_mem(&v13); if (v12) ext2fs_free_mem(&v12); if (memory) ext2fs_free_mem(&memory); return inode; }
e2fsprogs-1.46.5
ida
static int do_globbed_ls(struct sftp_conn *conn, const char *path, const char *strip_path, int lflag) { char *fname, *lname; _ssh_compat_glob_t g; int err, r; struct winsize ws; u_int i, j, nentries, *indices = ((void *)0), c = 1; u_int colspace = 0, columns = 1, m = 0, width = 80; memset(&g, 0, sizeof(g)); if ((r = remote_glob(conn, path, 0x0008 | 0x0010 | 0x0080 | 0x4000 | 0x0020, ((void *)0), &g)) != 0 || (g.gl_pathc && !g.gl_matchc)) { if (g.gl_pathc) _ssh__compat_globfree(&g); if (r == (-1)) { sshlog("sftp.c", __func__, 973, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "Can't ls: Too many matches for \"%s\"", path); } else { sshlog("sftp.c", __func__, 975, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "Can't ls: \"%s\" not found", path); } return -1; } if (interrupted) goto out; if (g.gl_matchc == 1 && g.gl_statv[0] != ((void *)0) && ((((g.gl_statv[0]->st_mode)) & 0170000) == (0040000))) { err = do_ls_dir(conn, g.gl_pathv[0], strip_path, lflag); _ssh__compat_globfree(&g); return err; } if (ioctl(fileno(stdin), 0x5413, &ws) != -1) width = ws.ws_col; if (!(lflag & 0x0002)) { for (i = 0; g.gl_pathv[i]; i++) m = (((m) > (strlen(g.gl_pathv[i]))) ? (m) : (strlen(g.gl_pathv[i]))); columns = width / (m + 2); columns = (((columns) > (1)) ? (columns) : (1)); colspace = width / columns; } for (nentries = 0; g.gl_pathv[nentries] != ((void *)0); nentries++) ; indices = calloc(nentries, sizeof(*indices)); for (i = 0; i < nentries; i++) indices[i] = i; if (lflag & (0x0008 | 0x0010 | 0x0020)) { sort_glob = &g; sort_flag = lflag & ((0x0008 | 0x0010 | 0x0020) | 0x0040); qsort(indices, nentries, sizeof(*indices), sglob_comp); sort_glob = ((void *)0); } get_remote_user_groups_from_glob(conn, &g); for (j = 0; j < nentries && !interrupted; j++) { i = indices[j]; fname = path_strip(g.gl_pathv[i], strip_path); if (lflag & 0x0001) { if (g.gl_statv[i] == ((void *)0)) { sshlog("sftp.c", __func__, 1031, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "no stat information for %s", fname); continue; } lname = ls_file(fname, g.gl_statv[i], 1, (lflag & 0x0100), ruser_name(g.gl_statv[i]->st_uid), rgroup_name(g.gl_statv[i]->st_gid)); mprintf("%s\n", lname); free(lname); } else { mprintf("%-*s", colspace, fname); if (c >= columns) { printf("\n"); c = 1; } else c++; } free(fname); } if (!(lflag & 0x0001) && (c != 1)) printf("\n"); out: if (g.gl_pathc) _ssh__compat_globfree(&g); free(indices); return 0; }
int do_globbed_ls(unsigned long long a0, unsigned long 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; void *v10; void *v11; void *v12; char v13; char v14; char v15; char v16; char v17; unsigned int v19; v10 = 0; v3 = 1; v4 = 0; v5 = 1; v6 = 0; v7 = 80; memset(&v14, 0x0, 0x60); v8 = remote_glob(a0, a1, 0x40b8, 0x0, &v14); if (!v8 && (!(*(&v14)) || !(!*(&v15)))) { if (!interrupted) { if (*(&v15) == 1 && *(*(&v17)) && (*((*(*(&v17)) + 24)) & 0xf000) == 0x4000) { v9 = do_ls_dir(a0, *(*(&v16)), a2, a3); _ssh__compat_globfree(&v14); v19 = v9; return v19; } if (ioctl(fileno(stdin), 0x5413) != -1) v7 = *(&v13); if (!(a3 & 2)) { for (v0 = 0; *((*(&v16) + (v0 << 3))); v0 += 1) { if (v6 > strlen(*((*(&v16) + (v0 << 3))))) v19 = v6; else v19 = strlen(*((*(&v16) + v0 * 8))); v6 = v19; } v5 = (0 CONCAT v7) / m(v6 + 2); v19 = (v5 ? 1 : v5); v5 = v19; v4 = (0 CONCAT v7) / m v5; } for (v2 = 0; *((*(&v16) + (v2 << 3))); v2 += 1) ; v10 = calloc(v2, 0x4); for (v0 = 0; v0 < v2; v0 += 1) { *((4 * v0 + v10)) = v0; } if ((a3 & 56)) { sort_glob = &v14; sort_flag = a3 & 120; qsort(v10, v2, 0x4, sglob_comp); sort_glob = 0; } get_remote_user_groups_from_glob(a0, &v14, &v14); for (v1 = 0; v1 < v2 && !interrupted; v1 += 1) { v0 = *((v10 + 4 * v1)); v11 = path_strip(*((*(&v16) + v0 * 8)), a2); if (!(a3 & 1)) { mprintf("%-*s", v4, v11); if (v3 >= v5) { printf("\n"); v3 = 1; free(v11); } else { v3 += 1; free(v11); } } else if (!*((*(&v17) + (v0 << 3)))) { sshlog("sftp.c", "do_globbed_ls", 0x407, 0x0, 0x2, 0x0, "no stat information for %s", v11); } else { v12 = ls_file(v11, *((*(&v17) + v0 * 8)), 0x1, a3 & 0x100, ruser_name(*((*((*(&v17) + v0 * 8)) + 28))), rgroup_name(*((*((*(&v17) + v0 * 8)) + 32)))); mprintf("%s\n", v12, 0x1); free(v12); free(v11); } } if (!((a3 & 1) || v3 == 1)) printf("\n"); } if (*(&v14)) _ssh__compat_globfree(&v14); free(v10); v19 = 0; return v19; } if (*(&v14)) _ssh__compat_globfree(&v14); if (v8 == -1) { sshlog("sftp.c", "do_globbed_ls", 0x3cd, 0x0, 0x2, 0x0, "Can\'t ls: Too many matches for \"%s\"", a1); v19 = -1; return v19; } sshlog("sftp.c", "do_globbed_ls", 0x3cf, 0x0, 0x2, 0x0, "Can\'t ls: \"%s\" not found", a1); v19 = -1; return v19; }
openssh-portable
angr_sailr
int sh_openpipe(pv) int *pv; { int r; if ((r = pipe(pv)) < 0) return r; pv[0] = move_to_high_fd(pv[0], 1, 64); pv[1] = move_to_high_fd(pv[1], 1, 64); return 0; }
int sh_openpipe(int *param_1) { int iVar1; iVar1 = pipe(param_1); if (-1 < iVar1) { iVar1 = move_to_high_fd(*param_1, 1, 0x40); *param_1 = iVar1; iVar1 = move_to_high_fd(param_1[1], 1, 0x40); param_1[1] = iVar1; iVar1 = 0; } return iVar1; }
bash
ghidra
static void pkcs11_provider_unref(struct pkcs11_provider *p) { sshlog("ssh-pkcs11.c", __func__, 138, 1, SYSLOG_LEVEL_DEBUG1, ((void *)0), "provider \"%s\" refcount %d", p->name, p->refcount); if (--p->refcount <= 0) { if (p->valid) sshlog("ssh-pkcs11.c", __func__, 141, 1, SYSLOG_LEVEL_ERROR, ((void *)0), "provider \"%s\" still valid", p->name); free(p->name); free(p->slotlist); free(p->slotinfo); free(p); } }
void pkcs11_provider_unref(void **param_1) { undefined4 uVar1; sshlog("ssh-pkcs11.c", "pkcs11_provider_unref", 0x8a, 1, 5, 0, "provider \"%s\" refcount %d", *param_1, *(undefined4 *)((long)param_1 + 0x8c)); uVar1 = __addvsi3(*(undefined4 *)((long)param_1 + 0x8c), 0xffffffff); *(undefined4 *)((long)param_1 + 0x8c) = uVar1; if (*(int *)((long)param_1 + 0x8c) < 1) { if (*(int *)(param_1 + 0x11) != 0) { sshlog("ssh-pkcs11.c", "pkcs11_provider_unref", 0x8d, 1, 2, 0, "provider \"%s\" still valid", *param_1); } free(*param_1); free(param_1[0xf]); free(param_1[0x10]); free(param_1); } return; }
openssh-portable
ghidra
static int sign_one(struct sshkey *signkey, const char *filename, int fd, const char *sig_namespace, const char *hashalg, sshsig_signer *signer, void *signer_ctx) { struct sshbuf *sigbuf = ((void *)0), *abuf = ((void *)0); int r = -1, wfd = -1, oerrno; char *wfile = ((void *)0), *asig = ((void *)0), *fp = ((void *)0); char *pin = ((void *)0), *prompt = ((void *)0); if (!quiet) { if (fd == 0) fprintf(stderr, "Signing data on standard input\n"); else fprintf(stderr, "Signing file %s\n", filename); } if (signer == ((void *)0) && sshkey_is_sk(signkey)) { if ((signkey->sk_flags & 0x04)) { xasprintf(&prompt, "Enter PIN for %s key: ", sshkey_type(signkey)); if ((pin = read_passphrase(prompt, 0x0002)) == ((void *)0)) sshfatal("ssh-keygen.c", __func__, 2573, 1, SYSLOG_LEVEL_FATAL, ((void *)0), "couldn't read PIN"); } if ((signkey->sk_flags & 0x01)) { if ((fp = sshkey_fingerprint(signkey, fingerprint_hash, SSH_FP_DEFAULT)) == ((void *)0)) sshfatal("ssh-keygen.c", __func__, 2578, 1, SYSLOG_LEVEL_FATAL, ((void *)0), "fingerprint failed"); fprintf(stderr, "Confirm user presence for key %s %s\n", sshkey_type(signkey), fp); free(fp); } } if ((r = sshsig_sign_fd(signkey, hashalg, sk_provider, pin, fd, sig_namespace, &sigbuf, signer, signer_ctx)) != 0) { sshlog("ssh-keygen.c", __func__, 2586, 0, SYSLOG_LEVEL_ERROR, ssh_err(r), "Signing %s failed", filename); goto out; } if ((r = sshsig_armor(sigbuf, &abuf)) != 0) { sshlog("ssh-keygen.c", __func__, 2590, 1, SYSLOG_LEVEL_ERROR, ssh_err(r), "sshsig_armor"); goto out; } if ((asig = sshbuf_dup_string(abuf)) == ((void *)0)) { sshlog("ssh-keygen.c", __func__, 2594, 1, SYSLOG_LEVEL_ERROR, ((void *)0), "buffer error"); r = -2; goto out; } if (fd == 0) { fputs(asig, stdout); fflush(stdout); } else { xasprintf(&wfile, "%s.sig", filename); if (confirm_overwrite(wfile)) { if ((wfd = open(wfile, 01 | 0100 | 01000, 0666)) == -1) { oerrno = (*__errno_location()); sshlog("ssh-keygen.c", __func__, 2608, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "Cannot open %s: %s", wfile, strerror((*__errno_location()))); (*__errno_location()) = oerrno; r = -24; goto out; } if (atomicio((ssize_t (*)(int, void *, size_t))write, wfd, asig, strlen(asig)) != strlen(asig)) { oerrno = (*__errno_location()); sshlog("ssh-keygen.c", __func__, 2617, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "Cannot write to %s: %s", wfile, strerror((*__errno_location()))); (*__errno_location()) = oerrno; r = -24; goto out; } if (!quiet) { fprintf(stderr, "Write signature to %s\n", wfile); } } } r = 0; out: free(wfile); free(prompt); free(asig); if (pin != ((void *)0)) freezero(pin, strlen(pin)); sshbuf_free(abuf); sshbuf_free(sigbuf); if (wfd != -1) close(wfd); return r; }
int sign_one(struct_0 *a0, unsigned long long a1, unsigned long a2, unsigned long long a3, unsigned long long a4, unsigned long a5, unsigned long long v16) { unsigned long long v0; unsigned int v1; unsigned int v2; unsigned int v3; void *v4; void *v5; void *v6; void *v7; void *v8; void *v9; void *v10; unsigned long long v11; unsigned long v12; unsigned long long v13; unsigned long v14; char v15; unsigned long long v17; v0 = v16; v4 = 0; v5 = 0; v1 = -1; v2 = -1; v6 = 0; v8 = 0; v10 = 0; v9 = 0; v7 = 0; if (!quiet) { if (a2) fprintf(*(&stderr), "Signing file %s\n", a1); else fprintf(*(&stderr), "Signing data on standard input\n"); } if (!a5 && sshkey_is_sk(a0)) { if ((a0->field_68 & 4)) { xasprintf(&v7, "Enter PIN for %s key: ", sshkey_type(a0), a3); v9 = read_passphrase(v7, 0x2); if (!v9) sshfatal("ssh-keygen.c", "sign_one", 0xa0d, 0x1, 0x1, 0x0, "couldn't read PIN"); } if ((a0->field_68 & 1)) { v10 = sshkey_fingerprint(a0, fingerprint_hash, 0x0, fingerprint_hash); if (!v10) { v13 = "fingerprint failed"; sshfatal("ssh-keygen.c", "sign_one", 0xa12, 0x1, 0x1, 0x0, *(&v15)); } fprintf(*(&stderr), "Confirm user presence for key %s %s\n", sshkey_type(a0), v10); free(v10); } } v13 = v0; v12 = a5; v11 = &v4; v1 = sshsig_sign_fd(a0, a4, sk_provider, v9, a2, a3, *(&v15), v16); if (v1) { v14 = a1; v13 = "Signing %s failed"; sshlog("ssh-keygen.c", "sign_one", 0xa1a, 0x0, 0x2, ssh_err(v1), *(&v15), v16); } else { v1 = sshsig_armor(v4, &v5, &v5); if (v1) { v13 = "sshsig_armor"; sshlog("ssh-keygen.c", "sign_one", 0xa1e, 0x1, 0x2, ssh_err(v1), *(&v15), v16); } else { v8 = sshbuf_dup_string(v5); if (!v8) { v13 = "buffer error"; sshlog("ssh-keygen.c", "sign_one", 0xa22, 0x1, 0x2, 0x0, *(&v15), v16); v1 = -2; } else if (a2) { xasprintf(&v6, "%s.sig", a1, a3); if (!confirm_overwrite(v6)) { v1 = 0; } else { v2 = open(v6, 0x241, 0x1b6); if (v2 == -1 || atomicio(got.write, v2, v8, strlen(v8)) != strlen(v8)) { v3 = *(__errno_location()); v13 = strerror(*(__errno_location())); v12 = v6; if (v2 == -1) { v11 = "Cannot open %s: %s"; sshlog("ssh-keygen.c", "sign_one", 0xa30, 0x0, 0x2, 0x0, *(&v15), v16); *(__errno_location()) = v3; v1 = -24; } else { v11 = "Cannot write to %s: %s"; sshlog("ssh-keygen.c", "sign_one", 0xa39, 0x0, 0x2, 0x0, *(&v15), v16); *(__errno_location()) = v3; v1 = -24; } } else if (quiet) { v1 = 0; } else { fprintf(*(&stderr), "Write signature to %s\n", v6); v1 = 0; } } } else { fputs(v8, stdout); fflush(stdout); v1 = 0; } } } free(v6); free(v7); free(v8); if (v9) { v17 = strlen(v9); freezero(v9, v17, v17); } sshbuf_free(v5); sshbuf_free(v4); if (v2 != -1) close(v2); return v1; }
openssh-portable
angr_sailr
static int vflopenat(int dirfd, const char *path, int flags, va_list ap) { int fd, operation, serrno, trunc; struct stat sb, fsb; mode_t mode; mode = 0; if (flags & 0100) { mode = (mode_t) __builtin_va_arg(ap, int); } operation = 2; if (flags & 04000) operation |= 4; trunc = (flags & 01000); flags &= ~01000; for (;;) { if ((fd = openat(dirfd, path, flags, mode)) == -1) return (-1); if (flock(fd, operation) == -1) { serrno = (*__errno_location()); (void)close(fd); (*__errno_location()) = serrno; return (-1); } if (fstatat(dirfd, path, &sb, 0) == -1) { (void)close(fd); continue; } if (fstat(fd, &fsb) == -1) { serrno = (*__errno_location()); (void)close(fd); (*__errno_location()) = serrno; return (-1); } if (sb.st_dev != fsb.st_dev || sb.st_ino != fsb.st_ino) { (void)close(fd); continue; } if (trunc && ftruncate(fd, 0) != 0) { serrno = (*__errno_location()); (void)close(fd); (*__errno_location()) = serrno; return (-1); } return (fd); } }
long vflopenat(int a1, const char *a2, int a3, unsigned int *a4) { unsigned int *v4; unsigned int oflag; int operation; unsigned int v8; int v9; unsigned int v10; int v11; struct stat buf; struct stat v13; unsigned long v14; v14 = __readfsqword(0x28u); v8 = 0; if ((a3 & 0x40) != 0) { if (*a4 > 0x2F) { v4 = (unsigned int *)*((_QWORD *)a4 + 1); *((_QWORD *)a4 + 1) = v4 + 2; } else { v4 = (unsigned int *)(*((_QWORD *)a4 + 2) + *a4); *a4 += 8; } v8 = *v4; } operation = 2; if ((a3 & 0x800) != 0) operation = 6; v9 = a3 & 0x200; oflag = a3 & 0xFFFFFDFF; while (1) { v10 = openat(a1, a2, oflag, v8); if (v10 == -1) return 0xFFFFFFFFLL; if (flock(v10, operation) == -1) goto LABEL_21; if (fstatat(a1, a2, &buf, 0) != -1) { if (fstat(v10, &v13) == -1) goto LABEL_21; if (buf.st_dev == v13.st_dev && buf.st_ino == v13.st_ino) break; } close(v10); } if (v9 && ftruncate(v10, 0LL)) { LABEL_21: v11 = *_errno_location(); close(v10); *_errno_location() = v11; return 0xFFFFFFFFLL; } return v10; }
libbsd-0.11.7
ida
static void left_dir(void) { if (ftsoptions & 0x0200) { if (curr_fd >= 0) { close(curr_fd); curr_fd = -1; } } else { } }
void left_dir(void) { if (((ftsoptions & 0x200) != 0) && (-1 < curr_fd)) { close(curr_fd); curr_fd = -1; } return; }
findutils
ghidra
static inline _Bool is_addrtype_inet_not_unspec(const inet_prefix *p) { return (p->flags & ADDRTYPE_INET_UNSPEC) == ADDRTYPE_INET; }
bool is_addrtype_inet_not_unspec(_WORD *a1) { return (*a1 & 6) == 2; }
iproute2-6.0.0
ida
int kex_derive_keys(struct ssh *ssh, u_char *hash, u_int hashlen, const struct sshbuf *shared_secret) { struct kex *kex = ssh->kex; u_char *keys[6]; u_int i, j, mode, ctos; int r; if ((kex->flags & 0x0002) != 0) { if (sshbuf_len(kex->session_id) != 0) { sshlog("kex.c", __func__, 1114, 1, SYSLOG_LEVEL_ERROR, ((void *)0), "already have session ID at kex"); return -1; } if ((r = sshbuf_put(kex->session_id, hash, hashlen)) != 0) return r; } else if (sshbuf_len(kex->session_id) == 0) { sshlog("kex.c", __func__, 1120, 1, SYSLOG_LEVEL_ERROR, ((void *)0), "no session ID in rekex"); return -1; } for (i = 0; i < 6; i++) { if ((r = derive_key(ssh, 'A' + i, kex->we_need, hash, hashlen, shared_secret, &keys[i])) != 0) { for (j = 0; j < i; j++) free(keys[j]); return r; } } for (mode = 0; mode < MODE_MAX; mode++) { ctos = (!kex->server && mode == MODE_OUT) || (kex->server && mode == MODE_IN); kex->newkeys[mode]->enc.iv = keys[ctos ? 0 : 1]; kex->newkeys[mode]->enc.key = keys[ctos ? 2 : 3]; kex->newkeys[mode]->mac.key = keys[ctos ? 4 : 5]; } return 0; }
long long kex_derive_keys(struct_0 *a0, unsigned long long a1, unsigned long a2, unsigned long long a3) { unsigned long long v0; unsigned int v1; unsigned int v2; unsigned int v3; unsigned int v4; unsigned int v5; struct_1 *v6; char v7; unsigned long long v9; unsigned int v10; v0 = a3; v6 = a0->field_8; if ((v6->field_8c & 2)) { if (sshbuf_len(v6->field_70)) { sshlog("kex.c", "kex_derive_keys", 0x45a, 0x1, 0x2, 0x0, "already have session ID at kex"); v9 = 4294967295; return v9; } v4 = sshbuf_put(v6->field_70, a1, a2, a1); if (v4) { v9 = v4; return v9; } } else { if (!sshbuf_len(v6->field_70)) { sshlog("kex.c", "kex_derive_keys", 0x460, 0x1, 0x2, 0x0, "no session ID in rekex"); v9 = 4294967295; return v9; } } v1 = 0; while (true) { if (v1 <= 5) { v4 = derive_key(a0, v1 + 65, v6->field_10, a1, a2, v0, &(&v7)[8 * v1]); if (!v4) { v1 += 1; } else { for (v2 = 0; v2 < v1; v2 += 1) { free(*(&(&v7)[8 * v2])); } v9 = v4; return v9; } } else { for (v3 = 0; v3 <= 1; v3 += 1) { if (!v6->field_18 && v3 == 1 || v6->field_18 && !v3) v10 = 1; else v10 = 0; v5 = v10; (&v6->field_0)[v3]->field_28 = *(&(&v7)[8 * (!v5)]); (&v6->field_0)[v3]->field_20 = *(&(&v7)[8 * (!v5 ? 2 : 3)]); (&v6->field_0)[v3]->field_40 = *(&(&v7)[8 * (!v5 ? 4 : 5)]); } v9 = 0; return v9; } } }
openssh-portable
angr_sailr
History *history_init(void) { HistEvent ev; History *h = (History *)malloc(sizeof(*h)); if (h == ((void *)0)) return ((void *)0); if (history_def_init(&h->h_ref, &ev, 0) == -1) { free(h); return ((void *)0); } h->h_ent = -1; h->h_next = history_def_next; h->h_first = history_def_first; h->h_last = history_def_last; h->h_prev = history_def_prev; h->h_curr = history_def_curr; h->h_set = history_def_set; h->h_clear = history_def_clear; h->h_enter = history_def_enter; h->h_add = history_def_add; h->h_del = history_def_del; return h; }
long long history_init() { void *v0; char v1; void *v3; v0 = malloc(0x60); if (!v0) { v3 = 0; return v3; } else if (history_def_init(v0, &v1, 0x0) == -1) { free(v0); v3 = 0; return v3; } else { *(&v0[8]) = -1; *(&v0[24]) = history_def_next; *(&v0[16]) = history_def_first; *(&v0[32]) = history_def_last; *(&v0[40]) = history_def_prev; *(&v0[48]) = history_def_curr; *(&v0[56]) = history_def_set; *(&v0[72]) = history_def_clear; *(&v0[80]) = history_def_enter; *(&v0[88]) = history_def_add; *(&v0[64]) = history_def_del; v3 = v0; return v3; } }
libedit
angr_sailr
static void default_bzfree(void *opaque, void *addr) { if (addr != ((void *)0)) free(addr); }
long long default_bzfree(unsigned long a0, void *a1) { unsigned long v0; v0 = a0; return free(a1); }
bzip2
angr_sailr
static void set_signal_proc_mask(void) { sigset_t set; char const *debug_act; sigemptyset(&set); if (sigprocmask(0, ((void *)0), &set)) ((!!sizeof(struct { _Static_assert(EXIT_CANCELED, "verify_expr (" "EXIT_CANCELED" ", " "(error (EXIT_CANCELED, (*__errno_location ()), gettext " "(\"failed to get signal process mask\")), assume (false))" ")"); int _gl_dummy; })) ? ((error(EXIT_CANCELED, (*__errno_location()), gettext("failed to get signal process mask")), ((0) ? (void)0 : __builtin_unreachable()))) : ((error(EXIT_CANCELED, (*__errno_location()), gettext("failed to get signal process mask")), ((0) ? (void)0 : __builtin_unreachable())))); for (int i = 1; i <= ((64 + 1) - 1); i++) { if (sigismember(&block_signals, i)) { sigaddset(&set, i); debug_act = "BLOCK"; } else if (sigismember(&unblock_signals, i)) { sigdelset(&set, i); debug_act = "UNBLOCK"; } else { debug_act = ((void *)0); } if (dev_debug && debug_act) { char signame[(sizeof "SIGRTMAX" + (((((sizeof(int) * 8) - (!((__typeof__(int))0 < (__typeof__(int))-1))) * 146 + 484) / 485) + (!((__typeof__(int))0 < (__typeof__(int))-1))) - 1)]; sig2str(i, signame); do { if (dev_debug) fprintf(stderr, "signal %s (%d) mask set to %s\n", signame, i, debug_act); } while (0); } } if (sigprocmask(2, &set, ((void *)0))) ((!!sizeof(struct { _Static_assert(EXIT_CANCELED, "verify_expr (" "EXIT_CANCELED" ", " "(error (EXIT_CANCELED, (*__errno_location ()), gettext " "(\"failed to set signal process mask\")), assume (false))" ")"); int _gl_dummy; })) ? ((error(EXIT_CANCELED, (*__errno_location()), gettext("failed to set signal process mask")), ((0) ? (void)0 : __builtin_unreachable()))) : ((error(EXIT_CANCELED, (*__errno_location()), gettext("failed to set signal process mask")), ((0) ? (void)0 : __builtin_unreachable())))); }
void set_signal_proc_mask(void) { int iVar1; undefined8 uVar2; int *piVar3; long in_FS_OFFSET; uint local_c4; char *local_c0; sigset_t local_b8; undefined local_38[24]; long local_20; local_20 = *(long *)(in_FS_OFFSET + 0x28); sigemptyset(&local_b8); iVar1 = sigprocmask(0, (sigset_t *)0x0, &local_b8); if (iVar1 != 0) { uVar2 = gettext("failed to get signal process mask"); piVar3 = __errno_location(); error(0x7d, *piVar3, uVar2); } for (local_c4 = 1; (int)local_c4 < 0x41; local_c4 = local_c4 + 1) { iVar1 = sigismember((sigset_t *)block_signals, local_c4); if (iVar1 == 0) { iVar1 = sigismember((sigset_t *)unblock_signals, local_c4); if (iVar1 == 0) { local_c0 = (char *)0x0; } else { sigdelset(&local_b8, local_c4); local_c0 = "UNBLOCK"; } } else { sigaddset(&local_b8, local_c4); local_c0 = "BLOCK"; } if ((dev_debug != '\0') && (local_c0 != (char *)0x0)) { sig2str(local_c4); if (dev_debug != '\0') { fprintf(stderr, "signal %s (%d) mask set to %s\n", local_38, (ulong)local_c4, local_c0); } } } iVar1 = sigprocmask(2, &local_b8, (sigset_t *)0x0); if (iVar1 != 0) { uVar2 = gettext("failed to set signal process mask"); piVar3 = __errno_location(); error(0x7d, *piVar3, uVar2); } if (local_20 != *(long *)(in_FS_OFFSET + 0x28)) { __stack_chk_fail(); } return; }
coreutils
ghidra
struct tm *localtime_rz(timezone_t tz, time_t const *t, struct tm *tm) { if (!tz) return gmtime_r(t, tm); else { timezone_t old_tz = set_tz(tz); if (old_tz) { _Bool abbr_saved = localtime_r(t, tm) && save_abbr(tz, tm); if (revert_tz(old_tz) && abbr_saved) return tm; } return ((void *)0); } }
long long localtime_rz(unsigned long a0, unsigned int *a1, void *a2) { char v0; void *v1; void *v3; char v4; if (!a0) { v3 = gmtime_r(a1, a2); } else { v1 = set_tz(a0); if (v1) { if (localtime_r(a1, a2) && save_abbr(a0, a2)) { v4 = 1; goto LABEL_40053c; } v4 = 0; LABEL_40053c: v0 = v4; v0 &= 1; if (revert_tz(v1) && v0) { v3 = a2; goto LABEL_400564; } } v3 = 0; } LABEL_400564: return v3; }
gnutls
angr_phoenix
void urandom_close() { if (urandfd >= 0) close(urandfd); urandfd = -1; }
void urandom_close(void) { if (-1 < urandfd) { close(urandfd); } urandfd = 0xffffffff; return; }
bash
ghidra
int rl_delete(int count, int key) { int xpoint; if (count < 0) return (_rl_rubout_char(-count, key)); if (rl_point == rl_end) { rl_ding(); return 1; } if (count > 1 || rl_explicit_arg) { xpoint = rl_point; if ((__ctype_get_mb_cur_max()) > 1 && rl_byte_oriented == 0) rl_forward_char(count, key); else rl_forward_byte(count, key); rl_kill_text(xpoint, rl_point); rl_point = xpoint; } else { xpoint = (((__ctype_get_mb_cur_max()) > 1 && rl_byte_oriented == 0) ? _rl_find_next_mbchar((rl_line_buffer), (rl_point), (1), (0x01)) : ((rl_point) + (1))); rl_delete_text(rl_point, xpoint); } return 0; }
undefined8 rl_delete(int param_1, undefined4 param_2) { int iVar1; undefined8 uVar2; size_t sVar3; iVar1 = rl_point; if (param_1 < 0) { uVar2 = _rl_rubout_char(-param_1, param_2); } else if (rl_point == rl_end) { rl_ding(); uVar2 = 1; } else { if ((param_1 < 2) && (rl_explicit_arg == 0)) { sVar3 = __ctype_get_mb_cur_max(); if ((sVar3 < 2) || (rl_byte_oriented != 0)) { iVar1 = rl_point + 1; } else { iVar1 = _rl_find_next_mbchar(rl_line_buffer, rl_point, 1, 1); } rl_delete_text(rl_point, iVar1); } else { sVar3 = __ctype_get_mb_cur_max(); if ((sVar3 < 2) || (rl_byte_oriented != 0)) { rl_forward_byte(param_1, param_2); } else { rl_forward_char(param_1, param_2); } rl_kill_text(iVar1, rl_point); rl_point = iVar1; } uVar2 = 0; } return uVar2; }
bash
ghidra
static void server_alive_check(struct ssh *ssh) { int r; if (ssh_packet_inc_alive_timeouts(ssh) > options.server_alive_count_max) { sshlog("clientloop.c", __func__, 497, 0, SYSLOG_LEVEL_INFO, ((void *)0), "Timeout, server %s not responding.", host); cleanup_exit(255); } if ((r = sshpkt_start(ssh, 80)) != 0 || (r = sshpkt_put_cstring(ssh, "keepalive@openssh.com")) != 0 || (r = sshpkt_put_u8(ssh, 1)) != 0 || (r = sshpkt_send(ssh)) != 0) sshfatal("clientloop.c", __func__, 504, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "send packet"); client_register_global_confirm(((void *)0), ((void *)0)); schedule_server_alive_check(); }
long server_alive_check(long a1) { long v1; unsigned int v3; if ((int)ssh_packet_inc_alive_timeouts(a1) > (int)options[1232]) { sshlog("clientloop.c", "server_alive_check", 497LL, 0LL, 3LL, 0LL, "Timeout, server %s not responding.", host); cleanup_exit(255); } v3 = sshpkt_start(a1, 80LL); if (v3 || (v3 = sshpkt_put_cstring(a1, "keepalive@openssh.com")) != 0 || (v3 = sshpkt_put_u8(a1, 1LL)) != 0 || (v3 = sshpkt_send(a1)) != 0) { v1 = ssh_err(v3); sshfatal("clientloop.c", "server_alive_check", 504LL, 1LL, 1LL, v1, "send packet"); } client_register_global_confirm(0LL, 0LL); return schedule_server_alive_check(); }
openssh-portable
ida
static const char *gtp_role_to_string(__u32 role) { switch (role) { case GTP_ROLE_GGSN: return "ggsn"; case GTP_ROLE_SGSN: return "sgsn"; default: return "unknown"; } }
char *gtp_role_to_string(int param_1) { char *pcVar1; if (param_1 == 0) { pcVar1 = "ggsn"; } else if (param_1 == 1) { pcVar1 = "sgsn"; } else { pcVar1 = "unknown"; } return pcVar1; }
iproute2-6.0.0
ghidra
static int gz_decomp(state) gz_statep state; { int ret = 0; unsigned had; z_streamp strm = &(state->strm); had = strm->avail_out; do { if (strm->avail_in == 0 && gz_avail(state) == -1) return -1; if (strm->avail_in == 0) { gz_error(state, (-5), "unexpected end of file"); break; } ret = inflate(strm, 0); if (ret == (-2) || ret == 2) { gz_error(state, (-2), "internal error: inflate stream corrupt"); return -1; } if (ret == (-4)) { gz_error(state, (-4), "out of memory"); return -1; } if (ret == (-3)) { gz_error(state, (-3), strm->msg == ((void *)0) ? "compressed data error" : strm->msg); return -1; } } while (strm->avail_out && ret != 1); state->x.have = had - strm->avail_out; state->x.next = strm->next_out - state->x.have; if (ret == 1) state->how = 0; return 0; }
undefined8 gz_decomp(uint *param_1) { uint uVar1; int iVar2; char *pcVar3; int local_18; local_18 = 0; uVar1 = param_1[0x28]; while (true) { if ((param_1[0x22] == 0) && (iVar2 = gz_avail(param_1), iVar2 == -1)) { return 0xffffffff; } if (param_1[0x22] == 0) break; local_18 = inflate(param_1 + 0x20, 0); if ((local_18 == -2) || (local_18 == 2)) { gz_error(param_1, 0xfffffffe, "internal error: inflate stream corrupt"); return 0xffffffff; } if (local_18 == -4) { gz_error(param_1, 0xfffffffc, "out of memory"); return 0xffffffff; } if (local_18 == -3) { if (*(long *)(param_1 + 0x2c) == 0) { pcVar3 = "compressed data error"; } else { pcVar3 = *(char **)(param_1 + 0x2c); } gz_error(param_1, 0xfffffffd, pcVar3); return 0xffffffff; } if ((param_1[0x28] == 0) || (local_18 == 1)) goto LAB_00100601; } gz_error(param_1, 0xfffffffb, "unexpected end of file"); LAB_00100601: *param_1 = uVar1 - param_1[0x28]; *(ulong *)(param_1 + 2) = *(long *)(param_1 + 0x26) - (ulong)*param_1; if (local_18 == 1) { param_1[0x11] = 0; } return 0; }
zlib
ghidra
static void print_session(struct l2tp_data *data) { struct l2tp_parm *p = &data->config; open_json_object(((void *)0)); print_uint(PRINT_ANY, "session_id", "Session %u", p->session_id); print_uint(PRINT_ANY, "tunnel_id", " in tunnel %u", p->tunnel_id); print_nl(); print_uint(PRINT_ANY, "peer_session_id", " Peer session %u,", p->peer_session_id); print_uint(PRINT_ANY, "peer_tunnel_id", " tunnel %u", p->peer_tunnel_id); print_nl(); if (p->ifname != ((void *)0)) { print_color_string(PRINT_ANY, COLOR_IFNAME, "interface", " interface name: %s", p->ifname); print_nl(); } print_uint(PRINT_FP, "offset", " offset %u,", 0); print_uint(PRINT_FP, "peer_offset", " peer offset %u\n", 0); if (p->cookie_len > 0) print_cookie("cookie", " cookie %s", p->cookie, p->cookie_len); if (p->peer_cookie_len > 0) print_cookie("peer_cookie", " peer cookie %s", p->peer_cookie, p->peer_cookie_len); if (p->reorder_timeout != 0) print_uint(PRINT_ANY, "reorder_timeout", " reorder timeout: %u", p->reorder_timeout); if (p->send_seq || p->recv_seq) { print_string(PRINT_FP, ((void *)0), "%s sequence numbering:", _SL_); if (p->send_seq) print_null(PRINT_ANY, "send_seq", " send", ((void *)0)); if (p->recv_seq) print_null(PRINT_ANY, "recv_seq", " recv", ((void *)0)); } print_string(PRINT_FP, ((void *)0), "\n", ((void *)0)); close_json_object(); }
void print_session(undefined4 *param_1) { open_json_object(0); print_uint(4, "session_id", "Session %u", param_1[2]); print_uint(4, "tunnel_id", " in tunnel %u", *param_1); print_nl(); print_uint(4, "peer_session_id", " Peer session %u,", param_1[3]); print_uint(4, "peer_tunnel_id", " tunnel %u", param_1[1]); print_nl(); if (*(long *)(param_1 + 0x92) != 0) { print_color_string(4, 0, "interface", " interface name: %s", *(undefined8 *)(param_1 + 0x92)); print_nl(); } print_uint(1, "offset", " offset %u,", 0); print_uint(1, "peer_offset", " peer offset %u\n", 0); if (0 < (int)param_1[6]) { print_cookie("cookie", " cookie %s", param_1 + 7, param_1[6]); } if (0 < (int)param_1[9]) { print_cookie("peer_cookie", " peer cookie %s", param_1 + 10, param_1[9]); } if (param_1[0x91] != 0) { print_uint(4, "reorder_timeout", " reorder timeout: %u", param_1[0x91]); } if (((*(byte *)((long)param_1 + 0x242) & 0x10) != 0) || ((*(byte *)((long)param_1 + 0x242) & 8) != 0)) { print_string(1, 0, "%s sequence numbering:", _SL_); if ((*(byte *)((long)param_1 + 0x242) & 0x10) != 0) { print_null(4, "send_seq", " send", 0); } if ((*(byte *)((long)param_1 + 0x242) & 8) != 0) { print_null(4, "recv_seq", " recv", 0); } } print_string(1, 0, &DAT_0010306f, 0); close_json_object(); return; }
iproute2-6.0.0
ghidra
static void process_extended_get_users_groups_by_id(u_int32_t id) { struct passwd *user_pw; struct group *gr; struct sshbuf *uids, *gids, *usernames, *groupnames, *msg; int r; u_int n, nusers = 0, ngroups = 0; const char *name; if ((usernames = sshbuf_new()) == ((void *)0) || (groupnames = sshbuf_new()) == ((void *)0) || (msg = sshbuf_new()) == ((void *)0)) sshfatal("sftp-server.c", __func__, 1735, 1, SYSLOG_LEVEL_FATAL, ((void *)0), "sshbuf_new failed"); if ((r = sshbuf_froms(iqueue, &uids)) != 0 || (r = sshbuf_froms(iqueue, &gids)) != 0) sshfatal("sftp-server.c", __func__, 1738, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "parse"); sshlog("sftp-server.c", __func__, 1739, 1, SYSLOG_LEVEL_DEBUG1, ((void *)0), "uids len = %zu, gids len = %zu", sshbuf_len(uids), sshbuf_len(gids)); while (sshbuf_len(uids) != 0) { if ((r = sshbuf_get_u32(uids, &n)) != 0) sshfatal("sftp-server.c", __func__, 1743, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "parse inner uid"); user_pw = getpwuid((uid_t)n); name = user_pw == ((void *)0) ? "" : user_pw->pw_name; sshlog("sftp-server.c", __func__, 1746, 1, SYSLOG_LEVEL_DEBUG3, ((void *)0), "uid %u => \"%s\"", n, name); if ((r = sshbuf_put_cstring(usernames, name)) != 0) sshfatal("sftp-server.c", __func__, 1748, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "assemble gid reply"); nusers++; } while (sshbuf_len(gids) != 0) { if ((r = sshbuf_get_u32(gids, &n)) != 0) sshfatal("sftp-server.c", __func__, 1753, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "parse inner gid"); gr = getgrgid((gid_t)n); name = gr == ((void *)0) ? "" : gr->gr_name; sshlog("sftp-server.c", __func__, 1756, 1, SYSLOG_LEVEL_DEBUG3, ((void *)0), "gid %u => \"%s\"", n, name); if ((r = sshbuf_put_cstring(groupnames, name)) != 0) sshfatal("sftp-server.c", __func__, 1758, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "assemble gid reply"); nusers++; } sshlog("sftp-server.c", __func__, 1761, 0, SYSLOG_LEVEL_VERBOSE, ((void *)0), "users-groups-by-id: %u users, %u groups", nusers, ngroups); if ((r = sshbuf_put_u8(msg, 201)) != 0 || (r = sshbuf_put_u32(msg, id)) != 0 || (r = sshbuf_put_stringb(msg, usernames)) != 0 || (r = sshbuf_put_stringb(msg, groupnames)) != 0) sshfatal("sftp-server.c", __func__, 1767, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "compose"); send_msg(msg); sshbuf_free(uids); sshbuf_free(gids); sshbuf_free(usernames); sshbuf_free(groupnames); sshbuf_free(msg); }
void process_extended_get_users_groups_by_id(undefined4 param_1) { undefined8 uVar1; undefined8 uVar2; long lVar3; char **ppcVar4; undefined *puVar5; undefined *puVar6; long in_FS_OFFSET; char *apcStack208[9]; undefined auStack136[12]; undefined4 local_7c; __uid_t local_70; int local_6c; uint local_68; uint local_64; undefined8 local_60; undefined8 local_58; long local_50; long local_48; long local_40; group *local_38; char *local_30; passwd *local_28; long local_20; ppcVar4 = (char **)auStack136; local_20 = *(long *)(in_FS_OFFSET + 0x28); local_68 = 0; local_64 = 0; apcStack208[8] = (char *)0x1062b4; local_7c = param_1; local_50 = sshbuf_new(); if (local_50 == 0) { LAB_001062df: ppcVar4 = apcStack208 + 7; apcStack208[7] = "sshbuf_new failed"; sshfatal("sftp-server.c", "process_extended_get_users_groups_by_id", 0x6c7, 1, 1, 0); } else { apcStack208[8] = (char *)0x1062c4; local_48 = sshbuf_new(); if (local_48 == 0) goto LAB_001062df; apcStack208[8] = (char *)0x1062d4; local_40 = sshbuf_new(); if (local_40 == 0) goto LAB_001062df; } *(undefined8 *)((long)ppcVar4 + -8) = 0x10632f; local_6c = sshbuf_froms(iqueue, &local_60); if (local_6c == 0) { *(undefined8 *)((long)ppcVar4 + -8) = 0x10634e; local_6c = sshbuf_froms(iqueue, &local_58); puVar5 = (undefined *)ppcVar4; if (local_6c != 0) goto LAB_00106357; } else { LAB_00106357: *(undefined8 *)((long)ppcVar4 + -8) = 0x106361; uVar1 = ssh_err(local_6c); puVar5 = (undefined *)((long)ppcVar4 + -0x10); *(char **)((long)ppcVar4 + -0x10) = "parse"; *(undefined8 *)((long)ppcVar4 + -0x18) = 0x106398; sshfatal("sftp-server.c", "process_extended_get_users_groups_by_id", 0x6ca, 1, 1, uVar1); } *(undefined8 *)(puVar5 + -8) = 0x1063a4; uVar1 = sshbuf_len(local_58); *(undefined8 *)(puVar5 + -8) = 0x1063b3; uVar2 = sshbuf_len(local_60); *(undefined8 *)(puVar5 + -0x10) = uVar1; *(undefined8 *)(puVar5 + -0x18) = uVar2; *(char **)(puVar5 + -0x20) = "uids len = %zu, gids len = %zu"; *(undefined8 *)(puVar5 + -0x28) = 0x1063ef; sshlog("sftp-server.c", "process_extended_get_users_groups_by_id", 0x6cb, 1, 5, 0); while (true) { *(undefined8 *)(puVar5 + -8) = 0x106530; lVar3 = sshbuf_len(local_60); if (lVar3 == 0) break; *(undefined8 *)(puVar5 + -8) = 0x10640b; local_6c = sshbuf_get_u32(local_60, &local_70); puVar6 = puVar5; if (local_6c != 0) { *(undefined8 *)(puVar5 + -8) = 0x10641e; uVar1 = ssh_err(local_6c); puVar6 = puVar5 + -0x10; *(char **)(puVar5 + -0x10) = "parse inner uid"; *(undefined8 *)(puVar5 + -0x18) = 0x106455; sshfatal("sftp-server.c", "process_extended_get_users_groups_by_id", 0x6cf, 1, 1, uVar1); } *(undefined8 *)(puVar6 + -8) = 0x10645f; local_28 = getpwuid(local_70); if (local_28 == (passwd *)0x0) { local_30 = ""; } else { local_30 = local_28->pw_name; } *(char **)(puVar6 + -0x10) = local_30; *(ulong *)(puVar6 + -0x18) = (ulong)local_70; *(char **)(puVar6 + -0x20) = "uid %u => \"%s\""; *(undefined8 *)(puVar6 + -0x28) = 0x1064bf; sshlog("sftp-server.c", "process_extended_get_users_groups_by_id", 0x6d2, 1, 7, 0); *(undefined8 *)(puVar6 + -8) = 0x1064d6; local_6c = sshbuf_put_cstring(local_50, local_30); puVar5 = puVar6; if (local_6c != 0) { *(undefined8 *)(puVar6 + -8) = 0x1064e9; uVar1 = ssh_err(local_6c); puVar5 = puVar6 + -0x10; *(char **)(puVar6 + -0x10) = "assemble gid reply"; *(undefined8 *)(puVar6 + -0x18) = 0x106520; sshfatal("sftp-server.c", "process_extended_get_users_groups_by_id", 0x6d4, 1, 1, uVar1); } local_68 = local_68 + 1; } while (true) { *(undefined8 *)(puVar5 + -8) = 0x106676; lVar3 = sshbuf_len(local_58); if (lVar3 == 0) break; *(undefined8 *)(puVar5 + -8) = 0x106551; local_6c = sshbuf_get_u32(local_58, &local_70); puVar6 = puVar5; if (local_6c != 0) { *(undefined8 *)(puVar5 + -8) = 0x106564; uVar1 = ssh_err(local_6c); puVar6 = puVar5 + -0x10; *(char **)(puVar5 + -0x10) = "parse inner gid"; *(undefined8 *)(puVar5 + -0x18) = 0x10659b; sshfatal("sftp-server.c", "process_extended_get_users_groups_by_id", 0x6d9, 1, 1, uVar1); } *(undefined8 *)(puVar6 + -8) = 0x1065a5; local_38 = getgrgid(local_70); if (local_38 == (group *)0x0) { local_30 = ""; } else { local_30 = local_38->gr_name; } *(char **)(puVar6 + -0x10) = local_30; *(ulong *)(puVar6 + -0x18) = (ulong)local_70; *(char **)(puVar6 + -0x20) = "gid %u => \"%s\""; *(undefined8 *)(puVar6 + -0x28) = 0x106605; sshlog("sftp-server.c", "process_extended_get_users_groups_by_id", 0x6dc, 1, 7, 0); *(undefined8 *)(puVar6 + -8) = 0x10661c; local_6c = sshbuf_put_cstring(local_48, local_30); puVar5 = puVar6; if (local_6c != 0) { *(undefined8 *)(puVar6 + -8) = 0x10662f; uVar1 = ssh_err(local_6c); puVar5 = puVar6 + -0x10; *(char **)(puVar6 + -0x10) = "assemble gid reply"; *(undefined8 *)(puVar6 + -0x18) = 0x106666; sshfatal("sftp-server.c", "process_extended_get_users_groups_by_id", 0x6de, 1, 1, uVar1); } local_68 = local_68 + 1; } *(ulong *)(puVar5 + -0x10) = (ulong)local_64; *(ulong *)(puVar5 + -0x18) = (ulong)local_68; *(char **)(puVar5 + -0x20) = "users-groups-by-id: %u users, %u groups"; *(undefined8 *)(puVar5 + -0x28) = 0x1066c1; sshlog("sftp-server.c", "process_extended_get_users_groups_by_id", 0x6e1, 0, 4, 0); *(undefined8 *)(puVar5 + -8) = 0x1066d6; local_6c = sshbuf_put_u8(local_40, 0xc9); if (local_6c == 0) { *(undefined8 *)(puVar5 + -8) = 0x1066f0; local_6c = sshbuf_put_u32(local_40, local_7c); if (local_6c == 0) { *(undefined8 *)(puVar5 + -8) = 0x10670c; local_6c = sshbuf_put_stringb(local_40, local_50); if (local_6c == 0) { *(undefined8 *)(puVar5 + -8) = 0x106728; local_6c = sshbuf_put_stringb(local_40, local_48); puVar6 = puVar5; if (local_6c == 0) goto LAB_00106772; } } } *(undefined8 *)(puVar5 + -8) = 0x10673b; uVar1 = ssh_err(local_6c); puVar6 = puVar5 + -0x10; *(char **)(puVar5 + -0x10) = "compose"; *(undefined8 *)(puVar5 + -0x18) = 0x106772; sshfatal("sftp-server.c", "process_extended_get_users_groups_by_id", 0x6e7, 1, 1, uVar1); LAB_00106772: lVar3 = local_40; *(undefined8 *)(puVar6 + -8) = 0x10677e; send_msg(lVar3); *(undefined8 *)(puVar6 + -8) = 0x10678a; sshbuf_free(local_60); *(undefined8 *)(puVar6 + -8) = 0x106796; sshbuf_free(local_58); lVar3 = local_50; *(undefined8 *)(puVar6 + -8) = 0x1067a2; sshbuf_free(lVar3); lVar3 = local_48; *(undefined8 *)(puVar6 + -8) = 0x1067ae; sshbuf_free(lVar3); lVar3 = local_40; *(undefined8 *)(puVar6 + -8) = 0x1067ba; sshbuf_free(lVar3); if (local_20 == *(long *)(in_FS_OFFSET + 0x28)) { return; } *(undefined8 *)(puVar6 + -8) = 0x1067cf; __stack_chk_fail(); }
openssh-portable
ghidra
static int write_protected_non_symlink(int fd_cwd, char const *file, struct stat *buf) { if (can_write_any_file()) return 0; if (cache_fstatat(fd_cwd, file, buf, 0x100) != 0) return -1; if (((((buf->st_mode)) & 0170000) == (0120000))) return 0; { if (faccessat(fd_cwd, file, 2, 0x200) == 0) return 0; return (*__errno_location()) == 13 ? 1 : -1; } }
long write_protected_non_symlink(int a1, const char *a2, struct stat *a3) { if ((unsigned char)can_write_any_file()) return 0LL; if ((unsigned int)cache_fstatat(a1, a2, a3, 256)) return 0xFFFFFFFFLL; if ((a3->st_mode & 0xF000) == 40960) return 0LL; if (!faccessat(a1, a2, 2, 512)) return 0LL; if (*_errno_location() == 13) return 1LL; return 0xFFFFFFFFLL; }
coreutils
ida
static int is_addr(const char *name) { char strport[32]; struct addrinfo hints, *res; if (is_addr_fast(name)) return 1; snprintf(strport, sizeof strport, "%u", default_ssh_port()); memset(&hints, 0, sizeof(hints)); hints.ai_family = options.address_family == -1 ? 0 : options.address_family; hints.ai_socktype = SOCK_STREAM; hints.ai_flags = 0x0004 | 0x0400; if (getaddrinfo(name, strport, &hints, &res) != 0) return 0; if (res == ((void *)0) || res->ai_next != ((void *)0)) { freeaddrinfo(res); return 0; } freeaddrinfo(res); return 1; }
int is_addr(char *a0) { char v0; char v1; unsigned int v2; unsigned int v3; char v4; unsigned int v6; v6 = is_addr_fast(a0); if (v6) { v6 = 1; } else { snprintf(&v4, 0x20, "%u", default_ssh_port()); memset(&v1, 0x0, 0x30); if (false) v6 = 0; v6 = 8278818138817399553; v2 = v6; v3 = 1; v1 = 1028; v6 = getaddrinfo(a0, &v4, &v1, &v0); if (v6) { v6 = 0; } else { if (*(&v0) && !*((*(&v0) + 40))) { freeaddrinfo(*(&v0)); v6 = 1; } if (!*(&v0) || *((*(&v0) + 40))) { freeaddrinfo(*(&v0)); v6 = 0; } } } return v6; }
openssh-portable
angr_dream
static void fail_exit(int status) { if (spw_locked) { if (spw_unlock() == 0) { fprintf(stderr, gettext("%s: failed to unlock %s\n"), Prog, spw_dbname()); do { char *old_locale = setlocale(6, ((void *)0)); char *saved_locale = ((void *)0); if (((void *)0) != old_locale) { saved_locale = strdup(old_locale); } if (((void *)0) != saved_locale) { (void)setlocale(6, "C"); } syslog(3, "failed to unlock %s", spw_dbname()); if (((void *)0) != saved_locale) { (void)setlocale(6, saved_locale); free(saved_locale); } } while (0); } } if (pw_locked) { if (pw_unlock() == 0) { fprintf(stderr, gettext("%s: failed to unlock %s\n"), Prog, pw_dbname()); do { char *old_locale = setlocale(6, ((void *)0)); char *saved_locale = ((void *)0); if (((void *)0) != old_locale) { saved_locale = strdup(old_locale); } if (((void *)0) != saved_locale) { (void)setlocale(6, "C"); } syslog(3, "failed to unlock %s", pw_dbname()); if (((void *)0) != saved_locale) { (void)setlocale(6, saved_locale); free(saved_locale); } } while (0); } } exit(status); }
void fail_exit(int a1) { long v1; long v2; char *v3; const char *v4; long v5; long v6; char *v7; const char *v8; char *locale; char *v10; const char *s; const char *v12; if (spw_locked && !(unsigned int)spw_unlock()) { v1 = spw_dbname(); v2 = Prog; v3 = gettext("%s: failed to unlock %s\n"); fprintf(stderr, v3, v2, v1); s = setlocale(6, 0LL); locale = 0LL; if (s) locale = strdup(s); if (locale) setlocale(6, "C"); v4 = (const char *)spw_dbname(); syslog(3, "failed to unlock %s", v4); if (locale) { setlocale(6, locale); free(locale); } } if (pw_locked && !(unsigned int)pw_unlock()) { v5 = pw_dbname(); v6 = Prog; v7 = gettext("%s: failed to unlock %s\n"); fprintf(stderr, v7, v6, v5); v12 = setlocale(6, 0LL); v10 = 0LL; if (v12) v10 = strdup(v12); if (v10) setlocale(6, "C"); v8 = (const char *)pw_dbname(); syslog(3, "failed to unlock %s", v8); if (v10) { setlocale(6, v10); free(v10); } } exit(a1); }
shadow
ida
test_code_t test_dhe(gnutls_session_t session) { int ret; sprintf(prio_str, "NONE:" "+CIPHER-ALL:+ARCFOUR-128:+3DES-CBC" ":+GOST28147-TC26Z-CNT" ":" "+COMP-NULL" ":%s:" "+MAC-ALL:+MD5:+SHA1" ":+GOST28147-TC26Z-IMIT" ":+DHE-RSA:+DHE-DSS:%s", protocol_str, rest); { int _ret; if ((_ret = __gnutls_priority_set_direct(session, prio_str, 220)) != TEST_SUCCEED) { return _ret; } }; gnutls_credentials_set(session, GNUTLS_CRD_CERTIFICATE, xcred); ret = test_do_handshake(session); gnutls_dh_get_pubkey(session, &pubkey); return ret; return TEST_IGNORE; }
int test_dhe(undefined8 param_1) { int iVar1; sprintf( prio_str, "NONE:+CIPHER-ALL:+ARCFOUR-128:+3DES-CBC:+GOST28147-TC26Z-CNT:+COMP-NULL:" "%s:+MAC-ALL:+MD5:+SHA1:+GOST28147-TC26Z-IMIT:+DHE-RSA:+DHE-DSS:%s", protocol_str, rest); iVar1 = __gnutls_priority_set_direct(param_1, prio_str, 0xdc); if (iVar1 == 0) { gnutls_credentials_set(param_1, 1, xcred); iVar1 = test_do_handshake(param_1); gnutls_dh_get_pubkey(param_1, pubkey); } return iVar1; }
gnutls
ghidra
int unsetcmd(int argc, char **argv) { char **ap; int i; int flag = 0; while ((i = nextopt("vf")) != '\0') { flag = i; } for (ap = argptr; *ap; ap++) { if (flag != 'f') { unsetvar(*ap); continue; } if (flag != 'v') unsetfunc(*ap); } return 0; }
long long unsetcmd(unsigned long a0, unsigned long a1) { unsigned long v0; unsigned int v1; unsigned int v2; unsigned int v3; unsigned long long *v4; v1 = a0; v0 = a1; v2 = 0; while (true) { v3 = nextopt("vf"); if (!v3) break; v2 = v3; } for (v4 = argptr; *(v4); v4 += 1) { if (v2 != 102) { unsetvar(*(v4)); } else if (v2 != 118) { unsetfunc(*(v4)); } } return 0; }
dash-0.5.11+git20210903+057cd650a4ed
angr_phoenix
static const char *tmp_path(void) { const char *tmpdir = ((void *)0); if ((getuid() == geteuid()) && (getgid() == getegid())) { tmpdir = getenv("TMPDIR"); } return tmpdir ? tmpdir : "/tmp"; }
char *tmp_path(void) { __uid_t _Var1; __uid_t _Var2; __gid_t _Var3; __gid_t _Var4; char *local_20; local_20 = (char *)0x0; _Var1 = getuid(); _Var2 = geteuid(); if (_Var1 == _Var2) { _Var3 = getgid(); _Var4 = getegid(); if (_Var3 == _Var4) { local_20 = getenv("TMPDIR"); } } if (local_20 == (char *)0x0) { local_20 = "/tmp"; } return local_20; }
cronie
ghidra