input
stringlengths
26
172k
output
stringlengths
18
318k
repo_name
stringclasses
23 values
decompiler
stringclasses
5 values
void remove_trailing_whitespace(string) char *string; { register int i; i = strlen(string) - 1; while (i > 0 && (((string[i]) == ' ') || ((string[i]) == '\t'))) i--; string[++i] = '\0'; }
const char *remove_trailing_whitespace(const char *a1) { int i; const char *result; for (i = strlen(a1) - 1; i > 0 && (a1[i] == 32 || a1[i] == 9); --i) ; result = &a1[i + 1]; *result = 0; return result; }
bash
ida
static int compare_ts(struct timespec ts1, struct timespec ts2) { if ((ts1.tv_sec == ts2.tv_sec) && (ts1.tv_nsec == ts2.tv_nsec)) { return 0; } else { double diff = ts_difference(ts1, ts2); return diff < 0.0 ? -1 : +1; } }
undefined8 compare_ts(long param_1, long param_2, long param_3, long param_4) { undefined8 uVar1; double extraout_XMM0_Qa; if ((param_1 == param_3) && (param_2 == param_4)) { uVar1 = 0; } else { ts_difference(param_1, param_2, param_3, param_4); if (0.0 <= extraout_XMM0_Qa) { uVar1 = 1; } else { uVar1 = 0xffffffff; } } return uVar1; }
findutils
ghidra
int rl_getc(FILE *stream) { int result; unsigned char c; int fd; sigset_t empty_set; fd_set readfds; fd = fileno(stream); while (1) { do { if (_rl_caught_signal) _rl_signal_handler(_rl_caught_signal); } while (0); result = 0; do { unsigned int __i; fd_set *__arr = (&readfds); for (__i = 0; __i < sizeof(fd_set) / sizeof(__fd_mask); ++__i) ((__arr)->fds_bits)[__i] = 0; } while (0); ((void)(((&readfds)->fds_bits)[((fd) / (8 * (int)sizeof(__fd_mask)))] |= ((__fd_mask)(1UL << ((fd) % (8 * (int)sizeof(__fd_mask))))))); result = _rl_timeout_select(fd + 1, &readfds, ((void *)0), ((void *)0), ((void *)0), &_rl_orig_sigset); if (result == 0) _rl_timeout_handle(); if (result >= 0) result = read(fd, &c, sizeof(unsigned char)); if (result == sizeof(unsigned char)) return (c); if (result == 0) return ((-1)); if ((*__errno_location()) == 11 || (*__errno_location()) == 11) { if (sh_unset_nodelay_mode(fd) < 0) return ((-1)); continue; } handle_error: if ((*__errno_location()) != 4) return ((rl_readline_state & (0x0000008)) ? (-2) : (-1)); else if (_rl_caught_signal == 1 || _rl_caught_signal == 15) return ((rl_readline_state & (0x0000008)) ? (-2) : (-1)); else if (_rl_caught_signal == 2 || _rl_caught_signal == 3) do { if (_rl_caught_signal) _rl_signal_handler(_rl_caught_signal); } while (0); else if (_rl_caught_signal == 20) do { if (_rl_caught_signal) _rl_signal_handler(_rl_caught_signal); } while (0); else if (_rl_caught_signal == 28) do { if (_rl_caught_signal) _rl_signal_handler(_rl_caught_signal); } while (0); else if (_rl_caught_signal == 14 || _rl_caught_signal == 26 ) do { if (_rl_caught_signal) _rl_signal_handler(_rl_caught_signal); } while (0); if (rl_signal_event_hook) (*rl_signal_event_hook)(); } }
long rl_getc(FILE *a1) { unsigned char buf; int v3; unsigned int i; int fd; fd_set *v6; fd_set v7; unsigned long v8; v8 = __readfsqword(0x28u); fd = fileno(a1); while (1) { while (1) { if (rl_caught_signal) rl_signal_handler(rl_caught_signal); v3 = 0; v6 = &v7; for (i = 0; i <= 0xF; ++i) v6->fds_bits[i] = 0LL; v7.fds_bits[fd / 64] |= 1LL << (fd % 64); v3 = rl_timeout_select((unsigned int)(fd + 1), &v7, 0LL, 0LL, 0LL, &rl_orig_sigset); if (!v3) rl_timeout_handle(); if (v3 >= 0) v3 = read(fd, &buf, 1uLL); if (v3 == 1) return buf; if (!v3) return 0xFFFFFFFFLL; if (*_errno_location() != 11 && *_errno_location() != 11) break; if ((int)sh_unset_nodelay_mode((unsigned int)fd) < 0) return 0xFFFFFFFFLL; } if (*_errno_location() != 4) { if ((rl_readline_state & 8) != 0) return 4294967294LL; else return 0xFFFFFFFFLL; } if (rl_caught_signal == 1 || rl_caught_signal == 15) break; switch (rl_caught_signal) { case 2: case 3: if (rl_caught_signal) goto LABEL_41; break; case 0x14: if (rl_caught_signal) goto LABEL_41; break; case 0x1C: if (rl_caught_signal) goto LABEL_41; break; default: if ((rl_caught_signal == 14 || rl_caught_signal == 26) && rl_caught_signal) LABEL_41: rl_signal_handler(rl_caught_signal); break; } if (rl_signal_event_hook) rl_signal_event_hook(); } if ((rl_readline_state & 8) != 0) return 4294967294LL; else return 0xFFFFFFFFLL; }
bash
ida
extern inline _Bool c_isprint(int c) { switch (c) { case ' ': case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': case 'a' + (0): case 'b' + (0): case 'c' + (0): case 'd' + (0): case 'e' + (0): case 'f' + (0): case 'g' + (0): case 'h' + (0): case 'i' + (0): case 'j' + (0): case 'k' + (0): case 'l' + (0): case 'm' + (0): case 'n' + (0): case 'o' + (0): case 'p' + (0): case 'q' + (0): case 'r' + (0): case 's' + (0): case 't' + (0): case 'u' + (0): case 'v' + (0): case 'w' + (0): case 'x' + (0): case 'y' + (0): case 'z' + (0): case '!': case '"': case '#': case '$': case '%': case '&': case '\'': case '(': case ')': case '*': case '+': case ',': case '-': case '.': case '/': case ':': case ';': case '<': case '=': case '>': case '?': case '@': case '[': case '\\': case ']': case '^': case '_': case '`': case '{': case '|': case '}': case '~': case 'a' + ('A' - 'a'): case 'b' + ('A' - 'a'): case 'c' + ('A' - 'a'): case 'd' + ('A' - 'a'): case 'e' + ('A' - 'a'): case 'f' + ('A' - 'a'): case 'g' + ('A' - 'a'): case 'h' + ('A' - 'a'): case 'i' + ('A' - 'a'): case 'j' + ('A' - 'a'): case 'k' + ('A' - 'a'): case 'l' + ('A' - 'a'): case 'm' + ('A' - 'a'): case 'n' + ('A' - 'a'): case 'o' + ('A' - 'a'): case 'p' + ('A' - 'a'): case 'q' + ('A' - 'a'): case 'r' + ('A' - 'a'): case 's' + ('A' - 'a'): case 't' + ('A' - 'a'): case 'u' + ('A' - 'a'): case 'v' + ('A' - 'a'): case 'w' + ('A' - 'a'): case 'x' + ('A' - 'a'): case 'y' + ('A' - 'a'): case 'z' + ('A' - 'a'): return 1; default: return 0; } }
long long c_isprint(unsigned long a0) { unsigned long long v1; if (a0 - 32 <= 94) v1 = 1; else v1 = 0; return v1; }
gnutls
angr_dream
static char *copy_string_unquote(const char *str) { char *output = xstrdup(str); size_t len = strlen(output); if ((*output == '"' || *output == '\'') && output[len - 1] == *output) { memmove(output, output + 1, len - 2); output[len - 2] = 0; } unquote_string(output); return output; }
char *copy_string_unquote(undefined8 param_1) { char *__s; size_t sVar1; __s = (char *)xstrdup(param_1); sVar1 = strlen(__s); if (((*__s == '\"') || (*__s == '\'')) && (__s[sVar1 - 1] == *__s)) { memmove(__s, __s + 1, sVar1 - 2); __s[sVar1 - 2] = '\0'; } unquote_string(__s); return __s; }
tar
ghidra
void sigpipe(sig) int sig; { fprintf(stderr, "%d\n", nw); exit(0); }
long long sigpipe(unsigned long a0) { unsigned int v0; v0 = a0; fprintf(stderr, "%d\n", 3850979413); exit(0x0); }
bash
angr_phoenix
int _rl_rubout_char(int count, int key) { int orig_point; unsigned char c; if (count < 0) return (rl_delete(-count, key)); if (rl_point == 0) { rl_ding(); return 1; } orig_point = rl_point; if (count > 1 || rl_explicit_arg) { rl_backward_char(count, key); rl_kill_text(orig_point, rl_point); } else if ((__ctype_get_mb_cur_max()) == 1 || rl_byte_oriented) { c = rl_line_buffer[--rl_point]; rl_delete_text(rl_point, orig_point); if (rl_point == rl_end && (1 && ((*__ctype_b_loc())[(int)(((unsigned char)(unsigned char)c))] & (unsigned short int)_ISprint)) && _rl_last_c_pos) { int l; l = rl_character_len(c, rl_point); _rl_erase_at_end_of_line(l); } } else { rl_point = _rl_find_prev_mbchar(rl_line_buffer, rl_point, 0x01); rl_delete_text(rl_point, orig_point); } return 0; }
void _rl_rubout_char(unsigned long a0, unsigned long a1, unsigned long a2, unsigned long long a3) { unsigned int v0; char v1; unsigned int v2; unsigned int v3; unsigned long long v5; unsigned long long v6; unsigned int v8; void *v9; v0 = a0; if (a0 < 0) { v5 = rl_delete(-(v0), a1, -(v0), a3); } else if (!rl_point) { rl_ding(); v6 = 1; } else { v2 = rl_point; if (a0 > 1) { LABEL_401ad4: rl_backward_char(a0, a1); rl_kill_text(v2, rl_point, rl_point); } else { if (!(!rl_explicit_arg)) goto LABEL_401ad4; if (__ctype_get_mb_cur_max() == 1) { LABEL_401b13: rl_point = rl_point - 1; v1 = *((rl_point + *(&rl_line_buffer))); rl_delete_text(rl_point, v2); if (rl_point == rl_end) { v8 = *((*(__ctype_b_loc()) + v1 * 2)) & 0x4000; if (v8 && _rl_last_c_pos) { v3 = rl_character_len(v1, rl_point, rl_point, a3); _rl_erase_at_end_of_line(v3); } } } else { if (!(!rl_byte_oriented)) goto LABEL_401b13; rl_point = _rl_find_prev_mbchar(*(&rl_line_buffer), rl_point, 0x1, rl_point); rl_delete_text(rl_point, v2); } } v9 = 0; } return; }
bash
angr_phoenix
vi_repeat_search_next(EditLine *el, wint_t c __attribute__((__unused__))) { if (el->el_search.patlen == 0) return 6; else return cv_repeat_srch(el, el->el_search.patdir); }
undefined8 vi_repeat_search_next(long param_1) { undefined8 uVar1; if (*(long *)(param_1 + 0x4a0) == 0) { uVar1 = 6; } else { uVar1 = cv_repeat_srch(param_1, *(undefined4 *)(param_1 + 0x4a8)); } return uVar1; }
libedit
ghidra
static int sig_verify(const char *signature, const char *sig_namespace, const char *principal, const char *allowed_keys, const char *revoked_keys, char *const *opts, size_t nopts) { int r, ret = -1; int print_pubkey = 0; struct sshbuf *sigbuf = ((void *)0), *abuf = ((void *)0); struct sshkey *sign_key = ((void *)0); char *fp = ((void *)0); struct sshkey_sig_details *sig_details = ((void *)0); uint64_t verify_time = 0; if (sig_process_opts(opts, nopts, ((void *)0), &verify_time, &print_pubkey) != 0) goto done; memset(&sig_details, 0, sizeof(sig_details)); if ((r = sshbuf_load_file(signature, &abuf)) != 0) { sshlog("ssh-keygen.c", __func__, 2788, 0, SYSLOG_LEVEL_ERROR, ssh_err(r), "Couldn't read signature file"); goto done; } if ((r = sshsig_dearmor(abuf, &sigbuf)) != 0) { sshlog("ssh-keygen.c", __func__, 2793, 1, SYSLOG_LEVEL_ERROR, ssh_err(r), "sshsig_armor"); goto done; } if ((r = sshsig_verify_fd(sigbuf, 0, sig_namespace, &sign_key, &sig_details)) != 0) goto done; if ((fp = sshkey_fingerprint(sign_key, fingerprint_hash, SSH_FP_DEFAULT)) == ((void *)0)) sshfatal("ssh-keygen.c", __func__, 2802, 1, SYSLOG_LEVEL_FATAL, ((void *)0), "sshkey_fingerprint failed"); sshlog("ssh-keygen.c", __func__, 2803, 0, SYSLOG_LEVEL_DEBUG1, ((void *)0), "Valid (unverified) signature from key %s", fp); if (sig_details != ((void *)0)) { sshlog("ssh-keygen.c", __func__, 2805, 1, SYSLOG_LEVEL_DEBUG2, ((void *)0), "signature details: counter = %u, flags = 0x%02x", sig_details->sk_counter, sig_details->sk_flags); } free(fp); fp = ((void *)0); if (revoked_keys != ((void *)0)) { if ((r = sshkey_check_revoked(sign_key, revoked_keys)) != 0) { sshlog("ssh-keygen.c", __func__, 2813, 1, SYSLOG_LEVEL_DEBUG3, ssh_err(r), "sshkey_check_revoked"); goto done; } } if (allowed_keys != ((void *)0) && (r = sshsig_check_allowed_keys(allowed_keys, sign_key, principal, sig_namespace, verify_time)) != 0) { sshlog("ssh-keygen.c", __func__, 2820, 1, SYSLOG_LEVEL_DEBUG3, ssh_err(r), "sshsig_check_allowed_keys"); goto done; } ret = 0; done: if (!quiet) { if (ret == 0) { if ((fp = sshkey_fingerprint(sign_key, fingerprint_hash, SSH_FP_DEFAULT)) == ((void *)0)) sshfatal("ssh-keygen.c", __func__, 2830, 1, SYSLOG_LEVEL_FATAL, ((void *)0), "sshkey_fingerprint failed"); if (principal == ((void *)0)) { printf("Good \"%s\" signature with %s key %s\n", sig_namespace, sshkey_type(sign_key), fp); } else { printf("Good \"%s\" signature for %s with %s key %s\n", sig_namespace, principal, sshkey_type(sign_key), fp); } } else { printf("Could not verify signature.\n"); } } if (ret == 0 && print_pubkey && sign_key != ((void *)0)) { if ((r = sshkey_write(sign_key, stdout)) == 0) fputc('\n', stdout); else { sshlog("ssh-keygen.c", __func__, 2849, 0, SYSLOG_LEVEL_ERROR, ssh_err(r), "Could not print public key.\n"); ret = -1; } } sshbuf_free(sigbuf); sshbuf_free(abuf); sshkey_free(sign_key); sshkey_sig_details_free(sig_details); free(fp); return ret; }
void sig_verify(unsigned long long a0, unsigned long long a1, unsigned long long a2, unsigned long long a3, unsigned long long a4, void *a5, unsigned long v13) { char v0; unsigned int v1; unsigned int v2; unsigned int v3; void *v4; void *v5; void *v6; void *v7; unsigned long long v8; void *v9; unsigned long long v10; unsigned long v11; char v12; unsigned long long v15; v2 = -1; v1 = 0; v4 = 0; v5 = 0; v6 = 0; v9 = 0; v7 = 0; v8 = 0; if (!sig_process_opts(a5, v13, NULL, &v8, &v1)) { memset(&v7, 0x0, 0x8); v3 = sshbuf_load_file(a0, &v5, &v5); if (v3) { sshlog("ssh-keygen.c", "sig_verify", 0xae4, 0x0, 0x2, ssh_err(v3), "Couldn't read signature file", *(&v0)); } else { v3 = sshsig_dearmor(v5, &v4, &v4); if (v3) { sshlog("ssh-keygen.c", "sig_verify", 0xae9, 0x1, 0x2, ssh_err(v3), "sshsig_armor", *(&v0)); } else { v3 = sshsig_verify_fd(v4, 0x0, a1, &v6, &v7); if (!v3) { v9 = sshkey_fingerprint(v6, fingerprint_hash, 0x0, fingerprint_hash); if (!v9) sshfatal("ssh-keygen.c", "sig_verify", 0xaf2, 0x1, 0x1, 0x0, "sshkey_fingerprint failed"); v11 = v9; v10 = "Valid (unverified) signature from key %s"; sshlog("ssh-keygen.c", "sig_verify", 0xaf3, 0x0, 0x5, 0x0, *(&v12), v13); if (v7) { v10 = v7[4]; v9 = *(v7); v8 = "signature details: counter = %u, flags = 0x%02x"; sshlog("ssh-keygen.c", "sig_verify", 0xaf5, 0x1, 0x6, 0x0, *(&v12), v13); } free(v9); v9 = 0; if (a4) { v3 = sshkey_check_revoked(v6, a4, a4); if (v3) { v10 = "sshkey_check_revoked"; sshlog("ssh-keygen.c", "sig_verify", 0xafd, 0x1, 0x7, ssh_err(v3), *(&v12), v13); } } if (!v3 || !a4) { if (a3) { v3 = sshsig_check_allowed_keys(a3, v6, a2, a1, v8); if (v3) { v10 = "sshsig_check_allowed_keys"; sshlog("ssh-keygen.c", "sig_verify", 0xb04, 0x1, 0x7, ssh_err(v3), *(&v12), v13); } } if (!a3 || !v3) v2 = 0; } } } } } if (!quiet) { if (!v2) { v9 = sshkey_fingerprint(v6, fingerprint_hash, 0x0, fingerprint_hash); if (!v9) { v10 = "sshkey_fingerprint failed"; sshfatal("ssh-keygen.c", "sig_verify", 0xb0e, 0x1, 0x1, 0x0, *(&v12)); } if (!a2) printf("Good \"%s\" signature with %s key %s\n", a1, sshkey_type(v6), v9); else printf("Good \"%s\" signature for %s with %s key %s\n", a1, a2, sshkey_type(v6), v9); } else { printf("Could not verify signature.\n"); } } if (!v2 && v1 && v6) { v3 = sshkey_write(v6, stdout, stdout); if (!v3) { fputc(0xa, stdout); } else { v10 = "Could not print public key.\n"; sshlog("ssh-keygen.c", "sig_verify", 0xb21, 0x0, 0x2, ssh_err(v3), *(&v12), v13); v2 = -1; } } sshbuf_free(v4); sshbuf_free(v5); sshkey_free(v6); sshkey_sig_details_free(v7); free(v9); v15 = v2; return; }
openssh-portable
angr_dream
int match_pattern_wchar(pat, string, flags) wchar_t *pat, *string; int flags; { wchar_t c; if (*string == 0) return (*pat == L'*'); switch (c = *pat++) { default: return (((flags & (1 << 4)) && iswupper(*string) ? towlower(*string) : (*string)) == ((flags & (1 << 4)) && iswupper(c) ? towlower(c) : (c))); case L'\\': return (((flags & (1 << 4)) && iswupper(*string) ? towlower(*string) : (*string)) == ((flags & (1 << 4)) && iswupper(*pat) ? towlower(*pat) : (*pat))); case L'?': return (*pat == L'(' ? 1 : (*string != L'\0')); case L'*': return (1); case L'+': case L'!': case L'@': return (*pat == L'(' ? 1 : (((flags & (1 << 4)) && iswupper(*string) ? towlower(*string) : (*string)) == ((flags & (1 << 4)) && iswupper(c) ? towlower(c) : (c)))); case L'[': return (*string != L'\0'); } }
long long match_pattern_wchar(unsigned long a0, unsigned int *a1, unsigned long a2) { unsigned int *v0; int tmp_11; unsigned int v1; unsigned long long v3; unsigned int v4; unsigned long v5; unsigned int v6; unsigned int v7; unsigned long v8; unsigned long v9; v0 = a0; if (!*(a1)) { v3 = *(v0) == 42; } else { tmp_11 = v0; v0 += 1; v1 = *(tmp_11); if (v1 == 92) { if ((a2 & 16) && iswupper(*(a1))) { v4 = towlower(*(a1)); goto LABEL_4007e1; } v4 = *(a1); LABEL_4007e1: if ((a2 & 16) && iswupper(*(v0))) { v5 = towlower(*(v0)); goto LABEL_400811; } v5 = *(v0); LABEL_400811: v3 = v4 == v5; } else { if (!(v1 <= 92)) goto LABEL_400745; if (v1 > 64) { if (!(v1 == 91)) goto LABEL_400745; v3 = *(a1); } else { if (v1 < 33) goto LABEL_400745; switch (v1) { case 33: case 43: case 64: if (*(v0) == 40) { LABEL_4008bb: v3 = 1; break; } else { if ((a2 & 16) && iswupper(*(a1))) { v6 = towlower(*(a1)); goto LABEL_400890; } v6 = *(a1); LABEL_400890: if ((a2 & 16) && iswupper(v1)) { v9 = towlower(v1); goto LABEL_4008b7; } v9 = v1; LABEL_4008b7: if (v6 == v9) goto LABEL_4008bb; v3 = 0; break; } case 42: v3 = 1; break; case 63: if (*(v0) == 40) { LABEL_400833: v3 = 1; break; } else { if (!(!*(a1))) goto LABEL_400833; v3 = 0; break; } default: LABEL_400745: if ((a2 & 16) && iswupper(*(a1))) { v7 = towlower(*(a1)); goto LABEL_400779; } v7 = *(a1); LABEL_400779: if ((a2 & 16) && iswupper(v1)) { v8 = towlower(v1); goto LABEL_4007a0; } v8 = v1; LABEL_4007a0: v3 = v7 == v8; break; } } } } return v3; }
bash
angr_phoenix
static _Bool du_files(char **files, int bit_flags) { _Bool ok = 1; if (*files) { FTS *fts = xfts_open(files, bit_flags, ((void *)0)); while (1) { FTSENT *ent; ent = rpl_fts_read(fts); if (ent == ((void *)0)) { if ((*__errno_location()) != 0) { error(0, (*__errno_location()), gettext("fts_read failed: %s"), quotearg_n_style_colon(0, shell_escape_quoting_style, fts->fts_path)); ok = 0; } prev_level = 0; break; }; ok &= process_file(fts, ent); } if (rpl_fts_close(fts) != 0) { error(0, (*__errno_location()), gettext("fts_close failed")); ok = 0; } } return ok; }
_BOOL8 du_files(_QWORD *a1, unsigned int a2) { long v2; char *v3; int *v4; char *v5; int *v6; bool v8; long i; long v10; v8 = 1; if (*a1) { for (i = xfts_open(a1, a2, 0LL);; v8 = (v8 & (unsigned char)process_file(i, v10)) != 0) { v10 = rpl_fts_read(i); if (!v10) break; } if (*_errno_location()) { v2 = quotearg_n_style_colon(0LL, 3LL, *(_QWORD *)(i + 32)); v3 = gettext("fts_read failed: %s"); v4 = _errno_location(); error(0, *v4, v3, v2); v8 = 0; } prev_level = 0LL; if ((unsigned int)rpl_fts_close(i)) { v5 = gettext("fts_close failed"); v6 = _errno_location(); error(0, *v6, v5); return 0; } } return v8; }
coreutils
ida
static inline int ila_ident_name2type(char *name) { if (!strcmp(name, "luid")) return ILA_ATYPE_LUID; else if (!strcmp(name, "use-format")) return ILA_ATYPE_USE_FORMAT; else return -1; }
int ila_ident_name2type(char *a0) { unsigned int v1; if (!strcmp(a0, "luid")) { v1 = 1; } else if (!strcmp(a0, "use-format")) { v1 = 32; } else { v1 = -1; } return v1; }
iproute2-6.0.0
angr_phoenix
static void process_sign_request2(SocketEntry *e) { u_char *signature = ((void *)0); size_t slen = 0; u_int compat = 0, flags; int r, ok = -1, retried = 0; char *fp = ((void *)0), *pin = ((void *)0), *prompt = ((void *)0); char *user = ((void *)0), *sig_dest = ((void *)0); const char *fwd_host = ((void *)0), *dest_host = ((void *)0); struct sshbuf *msg = ((void *)0), *data = ((void *)0), *sid = ((void *)0); struct sshkey *key = ((void *)0), *hostkey = ((void *)0); struct identity *id; struct notifier_ctx *notifier = ((void *)0); sshlog("ssh-agent.c", __func__, 736, 1, SYSLOG_LEVEL_DEBUG1, ((void *)0), "entering"); if ((msg = sshbuf_new()) == ((void *)0) || (data = sshbuf_new()) == ((void *)0)) sshfatal("ssh-agent.c", __func__, 739, 1, SYSLOG_LEVEL_FATAL, ((void *)0), "sshbuf_new failed"); if ((r = sshkey_froms(e->request, &key)) != 0 || (r = sshbuf_get_stringb(e->request, data)) != 0 || (r = sshbuf_get_u32(e->request, &flags)) != 0) { sshlog("ssh-agent.c", __func__, 743, 1, SYSLOG_LEVEL_ERROR, ssh_err(r), "parse"); goto send; } if ((id = lookup_identity(key)) == ((void *)0)) { sshlog("ssh-agent.c", __func__, 748, 1, SYSLOG_LEVEL_VERBOSE, ((void *)0), "%s key not found", sshkey_type(key)); goto send; } if ((fp = sshkey_fingerprint(key, 2, SSH_FP_DEFAULT)) == ((void *)0)) sshfatal("ssh-agent.c", __func__, 753, 1, SYSLOG_LEVEL_FATAL, ((void *)0), "fingerprint failed"); if (id->ndest_constraints != 0) { if (e->nsession_ids == 0) { sshlog("ssh-agent.c", __func__, 757, 1, SYSLOG_LEVEL_INFO, ((void *)0), "refusing use of destination-constrained key " "to sign on unbound connection"); goto send; } if (parse_userauth_request(data, key, &user, &sid, &hostkey) != 0) { sshlog("ssh-agent.c", __func__, 763, 1, SYSLOG_LEVEL_INFO, ((void *)0), "refusing use of destination-constrained key " "to sign an unidentified signature"); goto send; } sshlog("ssh-agent.c", __func__, 768, 1, SYSLOG_LEVEL_DEBUG1, ((void *)0), "user=%s", user); if (identity_permitted(id, e, user, &fwd_host, &dest_host) != 0) goto send; if (buf_equal(sid, e->session_ids[e->nsession_ids - 1].sid) != 0) { sshlog("ssh-agent.c", __func__, 779, 1, SYSLOG_LEVEL_ERROR, ((void *)0), "unexpected session ID (%zu listed) on " "signature request for target user %s with " "key %s %s", e->nsession_ids, user, sshkey_type(id->key), fp) ; goto send; } if (e->nsession_ids > 1 && hostkey == ((void *)0)) { sshlog("ssh-agent.c", __func__, 791, 1, SYSLOG_LEVEL_ERROR, ((void *)0), "refusing use of destination-constrained key: " "no hostkey recorded in signature for forwarded " "connection") ; goto send; } if (hostkey != ((void *)0) && !sshkey_equal(hostkey, e->session_ids[e->nsession_ids - 1].key)) { sshlog("ssh-agent.c", __func__, 798, 1, SYSLOG_LEVEL_ERROR, ((void *)0), "refusing use of destination-constrained key: " "mismatch between hostkey in request and most " "recently bound session") ; goto send; } xasprintf(&sig_dest, "public key authentication request for " "user \"%s\" to listed host", user); } if (id->confirm && confirm_key(id, sig_dest) != 0) { sshlog("ssh-agent.c", __func__, 807, 1, SYSLOG_LEVEL_VERBOSE, ((void *)0), "user refused key"); goto send; } if (sshkey_is_sk(id->key)) { if (restrict_websafe && strncmp(id->key->sk_application, "ssh:", 4) != 0 && !check_websafe_message_contents(key, data)) { goto send; } if (id->key->sk_flags & 0x01) { notifier = notify_start(0, "Confirm user presence for key %s %s%s%s", sshkey_type(id->key), fp, sig_dest == ((void *)0) ? "" : "\n", sig_dest == ((void *)0) ? "" : sig_dest); } } retry_pin: if ((r = sshkey_sign(id->key, &signature, &slen, sshbuf_ptr(data), sshbuf_len(data), agent_decode_alg(key, flags), id->sk_provider, pin, compat)) != 0) { sshlog("ssh-agent.c", __func__, 829, 1, SYSLOG_LEVEL_DEBUG1, ssh_err(r), "sshkey_sign"); if (pin == ((void *)0) && !retried && sshkey_is_sk(id->key) && r == -43) { notify_complete(notifier, ((void *)0)); notifier = ((void *)0); xasprintf(&prompt, "Enter PIN%sfor %s key %s: ", (id->key->sk_flags & 0x01) ? " and confirm user presence " : " ", sshkey_type(id->key), fp); pin = read_passphrase(prompt, 0x0008); retried = 1; goto retry_pin; } sshlog("ssh-agent.c", __func__, 843, 1, SYSLOG_LEVEL_ERROR, ssh_err(r), "sshkey_sign"); goto send; } ok = 0; send: sshlog("ssh-agent.c", __func__, 849, 1, SYSLOG_LEVEL_DEBUG1, ((void *)0), "good signature"); notify_complete(notifier, "User presence confirmed"); if (ok == 0) { if ((r = sshbuf_put_u8(msg, 14)) != 0 || (r = sshbuf_put_string(msg, signature, slen)) != 0) sshfatal("ssh-agent.c", __func__, 855, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "compose"); } else if ((r = sshbuf_put_u8(msg, 5)) != 0) sshfatal("ssh-agent.c", __func__, 857, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "compose failure"); if ((r = sshbuf_put_stringb(e->output, msg)) != 0) sshfatal("ssh-agent.c", __func__, 860, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "enqueue"); sshbuf_free(sid); sshbuf_free(data); sshbuf_free(msg); sshkey_free(key); sshkey_free(hostkey); free(fp); free(signature); free(sig_dest); free(user); free(prompt); if (pin != ((void *)0)) freezero(pin, strlen(pin)); }
unsigned long process_sign_request2(long a1) { long v1; const char *v2; const char *v3; const char *v4; const char *v5; const char *v6; long v7; const char *v8; long v9; long v10; long v11; const char *v12; const char *v13; long v14; long v15; long v16; long v17; size_t v18; int v20; unsigned int stringb; int v22; int v23; unsigned int v24; void *v25; long v26; void *v27; void *v28; void *v29; long v30; long v31; long v32; _DWORD *v33; long v34; void *ptr; char *s; long v37; long v38; long v39; _QWORD *v40; unsigned long v41; v41 = __readfsqword(0x28u); v25 = 0LL; v26 = 0LL; v24 = 0; v22 = -1; v23 = 0; ptr = 0LL; s = 0LL; v27 = 0LL; v28 = 0LL; v29 = 0LL; v30 = 0LL; v31 = 0LL; v39 = 0LL; v32 = 0LL; v33 = 0LL; v34 = 0LL; v37 = 0LL; sshlog("ssh-agent.c", "process_sign_request2", 736LL, 1LL, 5LL, 0LL, "entering"); v38 = sshbuf_new(); if (!v38 || (v39 = sshbuf_new()) == 0) sshfatal("ssh-agent.c", "process_sign_request2", 739LL, 1LL, 1LL, 0LL, "sshbuf_new failed"); stringb = sshkey_froms(*(_QWORD *)(a1 + 24), &v33); if (stringb || (stringb = sshbuf_get_stringb(*(_QWORD *)(a1 + 24), v39)) != 0 || (stringb = sshbuf_get_u32(*(_QWORD *)(a1 + 24), &v20)) != 0) { v1 = ssh_err(stringb); sshlog("ssh-agent.c", "process_sign_request2", 743LL, 1LL, 2LL, v1, "parse"); goto LABEL_53; } v40 = lookup_identity((long)v33); if (!v40) { v2 = (const char *)sshkey_type(v33); sshlog("ssh-agent.c", "process_sign_request2", 748LL, 1LL, 4LL, 0LL, "%s key not found", v2); goto LABEL_53; } ptr = (void *)sshkey_fingerprint(v33, 2LL, 0LL); if (!ptr) sshfatal("ssh-agent.c", "process_sign_request2", 753LL, 1LL, 1LL, 0LL, "fingerprint failed"); if (!v40[9]) { LABEL_27: if (*((_DWORD *)v40 + 12) && (unsigned int)confirm_key((long)v40, (const char *)v29)) { sshlog("ssh-agent.c", "process_sign_request2", 807LL, 1LL, 4LL, 0LL, "user refused key"); } else { if (!(unsigned int)sshkey_is_sk(v40[2])) goto LABEL_42; if (!restrict_websafe || !strncmp(*(const char **)(v40[2] + 96LL), "ssh:", 4uLL) || (unsigned int)check_websafe_message_contents(v33, v39)) { if ((*(_BYTE *)(v40[2] + 104LL) & 1) != 0) { if (v29) v4 = (const char *)v29; else v4 = (const char *)&unk_7FB9; if (v29) v5 = "\n"; else v5 = (const char *)&unk_7FB9; v6 = (const char *)sshkey_type(v40[2]); v37 = notify_start(0LL, "Confirm user presence for key %s %s%s%s", v6, (const char *)ptr, v5, v4); } LABEL_42: while (1) { v7 = v40[7]; v8 = agent_decode_alg(v33, v20); v9 = sshbuf_len(v39); v10 = sshbuf_ptr(v39); stringb = sshkey_sign(v40[2], &v25, &v26, v10, v9, v8, v7, s, v24); if (!stringb) break; v11 = ssh_err(stringb); sshlog("ssh-agent.c", "process_sign_request2", 829LL, 1LL, 5LL, v11, "sshkey_sign"); if (s || v23 || !(unsigned int)sshkey_is_sk(v40[2]) || stringb != -43) { v14 = ssh_err(stringb); sshlog("ssh-agent.c", "process_sign_request2", 843LL, 1LL, 2LL, v14, "sshkey_sign"); goto LABEL_53; } notify_complete(v37, 0LL); v37 = 0LL; v12 = (const char *)sshkey_type(v40[2]); if ((*(_BYTE *)(v40[2] + 104LL) & 1) != 0) v13 = " and confirm user presence "; else v13 = " "; xasprintf(&v27, "Enter PIN%sfor %s key %s: ", v13, v12, (const char *)ptr); s = (char *)read_passphrase(v27, 8LL); v23 = 1; } v22 = 0; } } goto LABEL_53; } if (!*(_QWORD *)(a1 + 32)) { sshlog("ssh-agent.c", "process_sign_request2", 757LL, 1LL, 3LL, 0LL, "refusing use of destination-constrained key to sign on unbound " "connection"); goto LABEL_53; } if ((unsigned int)parse_userauth_request(v39, v33, &v28, &v32, &v34)) { sshlog("ssh-agent.c", "process_sign_request2", 763LL, 1LL, 3LL, 0LL, "refusing use of destination-constrained key to sign an " "unidentified signature"); goto LABEL_53; } sshlog("ssh-agent.c", "process_sign_request2", 768LL, 1LL, 5LL, 0LL, "user=%s", (const char *)v28); if (!(unsigned int)identity_permitted(v40, (unsigned int *)a1, (const char *)v28, &v30, &v31)) { if ((unsigned int)buf_equal(v32, *(_QWORD *)(*(_QWORD *)(a1 + 40) + 24LL * *(_QWORD *)(a1 + 32) - 24 + 8))) { v3 = (const char *)sshkey_type(v40[2]); sshlog("ssh-agent.c", "process_sign_request2", 779LL, 1LL, 2LL, 0LL, "unexpected session ID (%zu listed) on signature request for " "target user %s with key %s %s", *(_QWORD *)(a1 + 32), (const char *)v28, v3, (const char *)ptr); goto LABEL_53; } if (*(_QWORD *)(a1 + 32) > 1uLL && !v34) { sshlog("ssh-agent.c", "process_sign_request2", 791LL, 1LL, 2LL, 0LL, "refusing use of destination-constrained key: no hostkey recorded " "in signature for forwarded connection"); goto LABEL_53; } if (v34 && !(unsigned int)sshkey_equal( v34, *(_QWORD *)(*(_QWORD *)(a1 + 40) + 24LL * *(_QWORD *)(a1 + 32) - 24))) { sshlog("ssh-agent.c", "process_sign_request2", 798LL, 1LL, 2LL, 0LL, "refusing use of destination-constrained key: mismatch between " "hostkey in request and most recently bound session"); goto LABEL_53; } xasprintf( &v29, "public key authentication request for user \"%s\" to listed host", (const char *)v28); goto LABEL_27; } LABEL_53: sshlog("ssh-agent.c", "process_sign_request2", 849LL, 1LL, 5LL, 0LL, "good signature"); notify_complete(v37, "User presence confirmed"); if (!v22) { stringb = sshbuf_put_u8(v38, 14LL); if (!stringb) { stringb = sshbuf_put_string(v38, v25, v26); if (!stringb) goto LABEL_59; } v15 = ssh_err(stringb); sshfatal("ssh-agent.c", "process_sign_request2", 855LL, 1LL, 1LL, v15, "compose"); } stringb = sshbuf_put_u8(v38, 5LL); if (stringb) { v16 = ssh_err(stringb); sshfatal("ssh-agent.c", "process_sign_request2", 857LL, 1LL, 1LL, v16, "compose failure"); } LABEL_59: stringb = sshbuf_put_stringb(*(_QWORD *)(a1 + 16), v38); if (stringb) { v17 = ssh_err(stringb); sshfatal("ssh-agent.c", "process_sign_request2", 860LL, 1LL, 1LL, v17, "enqueue"); } sshbuf_free(v32); sshbuf_free(v39); sshbuf_free(v38); sshkey_free(v33); sshkey_free(v34); free(ptr); free(v25); free(v29); free(v28); free(v27); if (s) { v18 = strlen(s); freezero(s, v18); } return __readfsqword(0x28u) ^ v41; }
openssh-portable
ida
void phash_create() { if (hashed_filenames == 0) hashed_filenames = hash_create(256); }
long phash_create() { long result; result = hashed_filenames; if (!hashed_filenames) { result = hash_create(256LL); hashed_filenames = result; } return result; }
bash
ida
static _Bool process_path(char const *fname, int can_mode) { char *can_fname = realpath_canon(fname, can_mode); if (!can_fname) { if (verbose) error(0, (*__errno_location()), "%s", quotearg_n_style_colon(0, shell_escape_quoting_style, fname)); return 0; } if (!can_relative_to || (can_relative_base && !path_prefix(can_relative_base, can_fname)) || (can_relative_to && !relpath(can_fname, can_relative_to, ((void *)0), 0))) fputs_unlocked(can_fname, stdout); putchar_unlocked(use_nuls ? '\0' : '\n'); free(can_fname); return 1; }
int process_path(unsigned long long a0, unsigned long a1) { unsigned long v0; unsigned long long v2; char v3; unsigned int v5; unsigned int v6; v0 = realpath_canon(a0, a1); if (!v0) { if (verbose) { v2 = quotearg_n_style_colon(0x0, 0x3, a0); error(0x0, *(__errno_location()), "%s"); } v6 = 0; } else { if (can_relative_to && can_relative_base) v3 = path_prefix(can_relative_base, v0) ^ 1; if (!can_relative_to || (relpath(v0, can_relative_to, 0x0, 0x0) ^ 1) || can_relative_base && v3) fputs_unlocked(v0, stdout); if (use_nuls) v5 = 0; else v5 = 10; putchar_unlocked(v5); free(v0); v6 = 1; } return v6; }
coreutils
angr_dream
_Bool pred_delete (const char *pathname, struct stat *stat_buf, struct predicate *pred_ptr) { (void)pred_ptr; (void)stat_buf; if (strcmp(state.rel_pathname, ".")) { int flags = 0; if (state.have_stat && ((((stat_buf->st_mode)) & 0170000) == (0040000))) flags |= 0x200; if (perform_delete(flags)) { return 1; } else { if (2 == (*__errno_location()) && options.ignore_readdir_race) { (*__errno_location()) = 0; return 1; } if (21 == (*__errno_location())) { if ((flags & 0x200) == 0) { flags |= 0x200; if (perform_delete(flags)) return 1; } } } error(0, (*__errno_location()), gettext("cannot delete %s"), safely_quote_err_filename(0, pathname)); state.exit_status = 1; return 0; } else { return 1; } }
long long pred_delete(unsigned long long a0, struct_0 *a1, unsigned long a2) { unsigned long v0; unsigned int v1; unsigned long long v4; unsigned long long v5; unsigned long long v6; unsigned long long v7; v0 = a2; if (strcmp(strcmp, ".")) { v1 = 0; if (g_50002c && (a1->field_18 & 0xf000) == 0x4000) v1 |= 0x200; v5 = perform_delete(v1); if (v5) { v4 = 1; } else { *(&v5) = *(__errno_location()); if (v5 == 2 && g_500056) { *(__errno_location()) = 0; v4 = 1; } if (!g_500056 || v5 != 2) { *(&v5) = *(__errno_location()); if (v5 == 21 && !(v1 & 0x200)) { v1 |= 0x200; v6 = perform_delete(v1); if (v6) v4 = 1; } if (!v6 || (v1 & 0x200) || v5 != 21) { v7 = safely_quote_err_filename(0x0, a0); error(0x0, *(__errno_location()), gettext("cannot delete %s")); g_50004c = 1; v4 = 0; } } } } else { v4 = 1; } return v4; }
findutils
angr_dream
static inline __be16 rta_getattr_be16(const struct rtattr *rta) { return ntohs(rta_getattr_u16(rta)); }
int rta_getattr_be16(void *a0) { return ntohs(rta_getattr_u16(a0)); }
iproute2-6.0.0
angr_phoenix
static int make_ancestor(char const *dir, char const *component, void *options) { struct cp_options const *x = options; if (x->set_security_context && defaultcon(x->set_security_context, component, 0040000) < 0 && !ignorable_ctx_err((*__errno_location()))) error(0, (*__errno_location()), gettext("failed to set default creation context for %s"), quotearg_style(shell_escape_always_quoting_style, dir)); int r = mkdir(component, ((0400 | 0200 | 0100) | (0400 >> 3) | (0100 >> 3) | ((0400 >> 3) >> 3) | ((0100 >> 3) >> 3))); if (r == 0) announce_mkdir(dir, options); return r; }
int make_ancestor(undefined8 param_1, char *param_2, long param_3) { char cVar1; int iVar2; int *piVar3; undefined8 uVar4; undefined8 uVar5; if (*(long *)(param_3 + 0x28) != 0) { iVar2 = defaultcon(*(undefined8 *)(param_3 + 0x28), param_2, 0x4000); if (iVar2 < 0) { piVar3 = __errno_location(); cVar1 = ignorable_ctx_err(*piVar3); if (cVar1 != '\x01') { uVar4 = quotearg_style(4, param_1); uVar5 = gettext("failed to set default creation context for %s"); piVar3 = __errno_location(); error(0, *piVar3, uVar5, uVar4); } } } iVar2 = mkdir(param_2, 0x1ed); if (iVar2 == 0) { announce_mkdir(param_1, param_3); } return iVar2; }
coreutils
ghidra
keymacro_map_cmd(EditLine *el, int cmd) { el->el_keymacro.val.cmd = (el_action_t)cmd; return &el->el_keymacro.val; }
long keymacro_map_cmd(long a1, char a2) { *(_BYTE *)(a1 + 1104) = a2; return a1 + 1104; }
libedit
ida
static void new_pwent(struct passwd *pwent) { if (lflg) { if (pw_locate(user_newname) != ((void *)0)) { fprintf(stderr, gettext("%s: user '%s' already exists in %s\n"), Prog, user_newname, pw_dbname()); fail_exit(9); } do { char *old_locale = setlocale(6, ((void *)0)); char *saved_locale = ((void *)0); if (((void *)0) != old_locale) { saved_locale = strdup(old_locale); } if (((void *)0) != saved_locale) { (void)setlocale(6, "C"); } syslog(6, "change user name '%s' to '%s'", pwent->pw_name, user_newname); if (((void *)0) != saved_locale) { (void)setlocale(6, saved_locale); free(saved_locale); } } while (0) ; pwent->pw_name = xstrdup(user_newname); } if ((!is_shadow_pwd) || (strcmp(pwent->pw_passwd, "x") != 0)) { pwent->pw_passwd = new_pw_passwd(pwent->pw_passwd); } if (uflg) { do { char *old_locale = setlocale(6, ((void *)0)); char *saved_locale = ((void *)0); if (((void *)0) != old_locale) { saved_locale = strdup(old_locale); } if (((void *)0) != saved_locale) { (void)setlocale(6, "C"); } syslog(6, "change user '%s' UID from '%d' to '%d'", pwent->pw_name, pwent->pw_uid, user_newid); if (((void *)0) != saved_locale) { (void)setlocale(6, saved_locale); free(saved_locale); } } while (0) ; pwent->pw_uid = user_newid; } if (gflg) { do { char *old_locale = setlocale(6, ((void *)0)); char *saved_locale = ((void *)0); if (((void *)0) != old_locale) { saved_locale = strdup(old_locale); } if (((void *)0) != saved_locale) { (void)setlocale(6, "C"); } syslog(6, "change user '%s' GID from '%d' to '%d'", pwent->pw_name, pwent->pw_gid, user_newgid); if (((void *)0) != saved_locale) { (void)setlocale(6, saved_locale); free(saved_locale); } } while (0) ; pwent->pw_gid = user_newgid; } if (cflg) { pwent->pw_gecos = user_newcomment; } if (dflg) { do { char *old_locale = setlocale(6, ((void *)0)); char *saved_locale = ((void *)0); if (((void *)0) != old_locale) { saved_locale = strdup(old_locale); } if (((void *)0) != saved_locale) { (void)setlocale(6, "C"); } syslog(6, "change user '%s' home from '%s' to '%s'", pwent->pw_name, pwent->pw_dir, user_newhome); if (((void *)0) != saved_locale) { (void)setlocale(6, saved_locale); free(saved_locale); } } while (0) ; if (strlen(user_newhome) > 1 && '/' == user_newhome[strlen(user_newhome) - 1]) { user_newhome[strlen(user_newhome) - 1] = '\0'; } pwent->pw_dir = user_newhome; } if (sflg) { do { char *old_locale = setlocale(6, ((void *)0)); char *saved_locale = ((void *)0); if (((void *)0) != old_locale) { saved_locale = strdup(old_locale); } if (((void *)0) != saved_locale) { (void)setlocale(6, "C"); } syslog(6, "change user '%s' shell from '%s' to '%s'", pwent->pw_name, pwent->pw_shell, user_newshell); if (((void *)0) != saved_locale) { (void)setlocale(6, saved_locale); free(saved_locale); } } while (0) ; pwent->pw_shell = user_newshell; } }
unsigned long new_pwent(const char **a1) { long v1; char *v2; long v3; char *v4; unsigned long result; char *locale; char *v7; char *v8; char *v9; char *v10; const char *s; const char *v12; const char *v13; const char *v14; const char *v15; if (lflg) { if (pw_locate(user_newname)) { v1 = pw_dbname(); v2 = user_newname; v3 = Prog; v4 = gettext("%s: user '%s' already exists in %s\n"); fprintf(stderr, v4, v3, v2, v1); fail_exit(9); } s = setlocale(6, 0LL); locale = 0LL; if (s) locale = strdup(s); if (locale) setlocale(6, "C"); syslog(6, "change user name '%s' to '%s'", *a1, user_newname); if (locale) { setlocale(6, locale); free(locale); } *a1 = (const char *)xstrdup(user_newname); } if (is_shadow_pwd != 1 || strcmp(a1[1], "x")) a1[1] = new_pw_passwd((char *)a1[1]); if (uflg) { v12 = setlocale(6, 0LL); v7 = 0LL; if (v12) v7 = strdup(v12); if (v7) setlocale(6, "C"); syslog(6, "change user '%s' UID from '%d' to '%d'", *a1, *((unsigned int *)a1 + 4), user_newid); if (v7) { setlocale(6, v7); free(v7); } *((_DWORD *)a1 + 4) = user_newid; } if (gflg) { v13 = setlocale(6, 0LL); v8 = 0LL; if (v13) v8 = strdup(v13); if (v8) setlocale(6, "C"); syslog(6, "change user '%s' GID from '%d' to '%d'", *a1, *((unsigned int *)a1 + 5), (unsigned int)user_newgid); if (v8) { setlocale(6, v8); free(v8); } *((_DWORD *)a1 + 5) = user_newgid; } if (cflg) a1[3] = user_newcomment; if (dflg) { v14 = setlocale(6, 0LL); v9 = 0LL; if (v14) v9 = strdup(v14); if (v9) setlocale(6, "C"); syslog(6, "change user '%s' home from '%s' to '%s'", *a1, a1[4], user_newhome); if (v9) { setlocale(6, v9); free(v9); } if (strlen(user_newhome) > 1 && user_newhome[strlen(user_newhome) - 1] == 47) user_newhome[strlen(user_newhome) - 1] = 0; a1[4] = user_newhome; } result = (unsigned char)sflg; if (sflg) { v15 = setlocale(6, 0LL); v10 = 0LL; if (v15) v10 = strdup(v15); if (v10) setlocale(6, "C"); syslog(6, "change user '%s' shell from '%s' to '%s'", *a1, a1[5], user_newshell); if (v10) { setlocale(6, v10); free(v10); } result = (unsigned long)a1; a1[5] = user_newshell; } return result; }
shadow
ida
static int xfrm_state_flush_print(struct nlmsghdr *n, void *arg) { FILE *fp = (FILE *)arg; struct xfrm_usersa_flush *xsf = ((void *)(((char *)n) + ((int)(((sizeof(struct nlmsghdr)) + 4U - 1) & ~(4U - 1))))); int len = n->nlmsg_len; const char *str; len -= (((((sizeof(*xsf)) + ((int)(((sizeof(struct nlmsghdr)) + 4U - 1) & ~(4U - 1))))) + 4U - 1) & ~(4U - 1)); if (len < 0) { fprintf(stderr, "BUG: wrong nlmsg len %d\n", len); return -1; } fprintf(fp, "Flushed state "); str = strxf_xfrmproto(xsf->proto); if (str) fprintf(fp, "proto %s", str); else fprintf(fp, "proto %u", xsf->proto); fprintf(fp, "%s", _SL_); if (oneline) fprintf(fp, "\n"); fflush(fp); return 0; }
void xfrm_state_flush_print(unsigned int *a0, void *a1) { unsigned int v0; char *v1; unsigned long v2; unsigned long long v4; void *v5; v1 = &a0[4]; v0 = *(a0); v0 -= 20; if (v0 < 0) { fprintf(stderr, "BUG: wrong nlmsg len %d\n", v0); v4 = 4294967295; return; } fprintf(a1, "Flushed state "); v2 = strxf_xfrmproto(*(v1)); if (!v2) fprintf(a1, "proto %u", *(v1)); else fprintf(a1, "proto %s", v2); fprintf(a1, "%s", _SL_); if (oneline) fprintf(a1, "\n"); fflush(a1); v5 = 0; return; }
iproute2-6.0.0
angr_sailr
fs->super->s_mmp_block > fs->super->s_first_data_block && fs->super->s_mmp_block < ext2fs_blocks_count(fs->super)) ext2fs_mark_block_bitmap2(ctx->block_found_map, fs->super->s_mmp_block); (void)e2fsck_get_lost_and_found(ctx, 0); while (1) { if (ino % (fs->super->s_inodes_per_group * 4) == 1) { if (e2fsck_mmp_update(fs)) fatal_error(ctx, 0); } old_op = ehandler_operation(eop_next_inode); pctx.errcode = ext2fs_get_next_inode_full(scan, &ino, inode, inode_size); if (ino > ino_threshold) pass1_readahead(ctx, &ra_group, &ino_threshold); ehandler_operation(old_op); if (ctx->flags & (0x0001 | 0x0002)) goto endit; if (pctx.errcode == (2133571394L)) { if (ino == 1 && fix_problem(ctx, 0x01007B, &pctx)) { errcode_t err; e2fsck_clear_inode(ctx, ino, inode, 0, "pass1"); ext2fs_badblocks_list_free(ctx->fs->badblocks); ctx->fs->badblocks = ((void *)0); err = ext2fs_read_bb_inode(ctx->fs, &ctx->fs->badblocks); if (err) { fix_problem(ctx, 0x010028, &pctx); ctx->flags |= 0x0001; } else ctx->flags |= 0x0004; goto endit; } if (!ctx->inode_bb_map) alloc_bb_map(ctx); ext2fs_mark_inode_bitmap2(ctx->inode_bb_map, ino); ext2fs_mark_inode_bitmap2(ctx->inode_used_map, ino); continue; } if (pctx.errcode && pctx.errcode != (2133571474L) && pctx.errcode != (2133571497L)) { fix_problem(ctx, 0x010028, &pctx); ctx->flags |= 0x0001; goto endit; } if (!ino) break; pctx.ino = ino; pctx.inode = inode; ctx->stashed_ino = ino; if (pctx.errcode == (2133571497L) && inode->i_links_count > 0 && fix_problem(ctx, 0x010067, &pctx)) { pctx.errcode = 0; e2fsck_clear_inode(ctx, ino, inode, 0, "pass1"); } failed_csum = pctx.errcode != 0; if (inode->i_dtime && low_dtime_check && inode->i_dtime < ctx->fs->super->s_inodes_count) { if (fix_problem(ctx, 0x010036, &pctx)) { inode->i_dtime = inode->i_links_count ? 0 : ctx->now; e2fsck_write_inode(ctx, ino, inode, "pass1"); failed_csum = 0; } } if (inode->i_links_count) { pctx.errcode = ext2fs_icount_store(ctx->inode_link_info, ino, inode->i_links_count); if (pctx.errcode) { pctx.num = inode->i_links_count; fix_problem(ctx, 0x01002A, &pctx); ctx->flags |= 0x0001; goto endit; } } else if ((ino >= (((fs->super)->s_rev_level == 0) ? 11 : (fs->super)->s_first_ino)) && !quota_inum_is_reserved(fs, ino)) { if (!inode->i_dtime && inode->i_mode) { if (fix_problem(ctx, 0x010004, &pctx)) { inode->i_dtime = ctx->now; e2fsck_write_inode(ctx, ino, inode, "pass1"); failed_csum = 0; } } do { finish_processing_inode((ctx), (ino), (&pctx), (failed_csum)); if ((ctx)->flags & 0x0001) return; } while (0); continue; } if ((inode->i_flags & 0x40000000) && ((!(((inode->i_mode) & 00170000) == 0040000) && fix_problem(ctx, 0x010088, &pctx)) || (!casefold_fs && fix_problem(ctx, 0x010089, &pctx)))) { inode->i_flags &= ~0x40000000; e2fsck_write_inode(ctx, ino, inode, "pass1"); } if ((inode->i_flags & 0x10000000) && (inode->i_flags & 0x00080000)) { int res = fix_inline_data_extents_file(ctx, ino, inode, inode_size, &pctx); if (res < 0) { continue; } } if ((inode->i_flags & 0x10000000) && !inlinedata_fs && (ino >= (((fs->super)->s_rev_level == 0) ? 11 : (fs->super)->s_first_ino))) { size_t size = 0; pctx.errcode = get_inline_data_ea_size(fs, ino, &size); if (!pctx.errcode && fix_problem(ctx, 0x01006F, &pctx)) { ext2fs_set_feature_inline_data(sb); ext2fs_mark_super_dirty(fs); inlinedata_fs = 1; } else if (fix_problem(ctx, 0x010070, &pctx)) { e2fsck_clear_inode(ctx, ino, inode, 0, "pass1"); continue; } } if ((inode->i_flags & 0x10000000) && inlinedata_fs && (ino >= (((fs->super)->s_rev_level == 0) ? 11 : (fs->super)->s_first_ino))) { size_t size = 0; errcode_t err; int flags; flags = fs->flags; if (failed_csum) fs->flags |= 0x200000; err = get_inline_data_ea_size(fs, ino, &size); fs->flags = (flags & 0x200000) | (fs->flags & ~0x200000); switch (err) { case 0: break; case (2133571418L): case (2133571488L): case (2133571489L): case (2133571486L): case (2133571487L): case (2133571490L): case (2133571491L): case (2133571492L): case (2133571485L): case (2133571494L): case (2133571495L): case (2133571493L): case (2133571479L): case (2133571498L): case (2133571506L): if (fix_problem(ctx, 0x010075, &pctx)) { err = ext2fs_inode_size_set(fs, inode, 0); if (err) { pctx.errcode = err; ctx->flags |= 0x0001; goto endit; } inode->i_flags &= ~0x10000000; memset(&inode->i_block, 0, sizeof(inode->i_block)); e2fsck_write_inode(ctx, ino, inode, "pass1"); failed_csum = 0; } break; default: pctx.errcode = err; ctx->flags |= 0x0001; goto endit; } } if ((inode->i_flags & 0x00080000) && !extent_fs && (inode->i_links_count || (ino == 1) || (ino == 2) || (ino == 8))) { if ((ext2fs_extent_header_verify(inode->i_block, sizeof(inode->i_block)) == 0) && fix_problem(ctx, 0x01005B, &pctx)) { ext2fs_set_feature_extents(sb); ext2fs_mark_super_dirty(fs); extent_fs = 1; } else if (fix_problem(ctx, 0x01005A, &pctx)) { clear_inode: e2fsck_clear_inode(ctx, ino, inode, 0, "pass1"); if (ino == 1) ext2fs_mark_inode_bitmap2(ctx->inode_used_map, ino); continue; } } if (extent_fs && !(inode->i_flags & 0x00080000) && (inode->i_links_count || (ino == 1) || (ino == 2) || (ino == 8)) && ((((inode->i_mode) & 00170000) == 0100000) || (((inode->i_mode) & 00170000) == 0040000))) { void *ehp; ehp = inode->i_block; if ((ext2fs_extent_header_verify(ehp, sizeof(inode->i_block)) == 0) && (fix_problem(ctx, 0x01005C, &pctx))) { inode->i_flags |= 0x00080000; e2fsck_write_inode(ctx, ino, inode, "pass1"); failed_csum = 0; } } if (ino == 1) { struct process_block_struct pb; if ((failed_csum || inode->i_mode || inode->i_uid || inode->i_gid || inode->i_links_count || (inode->i_flags & 0x10000000) || inode->i_file_acl) && fix_problem(ctx, 0x010065, &pctx)) { memset(inode, 0, sizeof(struct ext2_inode)); e2fsck_write_inode(ctx, ino, inode, "clear bad inode"); failed_csum = 0; } pctx.errcode = ext2fs_copy_bitmap(ctx->block_found_map, &pb.fs_meta_blocks); if (pctx.errcode) { pctx.num = 4; fix_problem(ctx, 0x010025, &pctx); ctx->flags |= 0x0001; goto endit; } pb.ino = 1; pb.num_blocks = pb.last_block = 0; pb.last_db_block = -1; pb.num_illegal_blocks = 0; pb.suppress = 0; pb.clear = 0; pb.is_dir = 0; pb.is_reg = 0; pb.fragmented = 0; pb.bbcheck = 0; pb.inode = inode; pb.pctx = &pctx; pb.ctx = ctx; pctx.errcode = ext2fs_block_iterate3(fs, ino, 0, block_buf, process_bad_block, &pb); ext2fs_free_block_bitmap(pb.fs_meta_blocks); if (pctx.errcode) { fix_problem(ctx, 0x010029, &pctx); ctx->flags |= 0x0001; goto endit; } if (pb.bbcheck) if (!fix_problem(ctx, 0x010016, &pctx)) { ctx->flags |= 0x0001; goto endit; } ext2fs_mark_inode_bitmap2(ctx->inode_used_map, ino); clear_problem_context(&pctx); do { finish_processing_inode((ctx), (ino), (&pctx), (failed_csum)); if ((ctx)->flags & 0x0001) return; } while (0); continue; } else if (ino == 2) { if (!(((inode->i_mode) & 00170000) == 0040000)) { if (fix_problem(ctx, 0x010001, &pctx)) goto clear_inode; } if (inode->i_dtime && inode->i_links_count) { if (fix_problem(ctx, 0x010002, &pctx)) { inode->i_dtime = 0; e2fsck_write_inode(ctx, ino, inode, "pass1"); failed_csum = 0; } } } else if (ino == 8) { ext2fs_mark_inode_bitmap2(ctx->inode_used_map, ino); if (fs->super->s_journal_inum == 8) { if (!(((inode->i_mode) & 00170000) == 0100000) && fix_problem(ctx, 0x010035, &pctx)) { inode->i_mode = 0100000; e2fsck_write_inode(ctx, ino, inode, "pass1"); failed_csum = 0; } check_blocks(ctx, &pctx, block_buf, ((void *)0)); do { finish_processing_inode((ctx), (ino), (&pctx), (failed_csum)); if ((ctx)->flags & 0x0001) return; } while (0); continue; } if ((inode->i_links_count || inode->i_blocks || inode->i_block[0]) && fix_problem(ctx, 0x010034, &pctx)) { memset(inode, 0, inode_size); ext2fs_icount_store(ctx->inode_link_info, ino, 0); e2fsck_write_inode_full(ctx, ino, inode, inode_size, "pass1"); failed_csum = 0; } } else if (quota_inum_is_reserved(fs, ino)) { ext2fs_mark_inode_bitmap2(ctx->inode_used_map, ino); if (ext2fs_has_feature_quota(fs->super) && quota_inum_is_super(fs->super, ino)) { if (!(((inode->i_mode) & 00170000) == 0100000) && fix_problem(ctx, 0x010062, &pctx)) { inode->i_mode = 0100000; e2fsck_write_inode(ctx, ino, inode, "pass1"); failed_csum = 0; } check_blocks(ctx, &pctx, block_buf, ((void *)0)); do { finish_processing_inode((ctx), (ino), (&pctx), (failed_csum)); if ((ctx)->flags & 0x0001) return; } while (0); continue; } if ((inode->i_links_count || inode->i_blocks || inode->i_block[0]) && fix_problem(ctx, 0x010063, &pctx)) { memset(inode, 0, inode_size); ext2fs_icount_store(ctx->inode_link_info, ino, 0); e2fsck_write_inode_full(ctx, ino, inode, inode_size, "pass1"); failed_csum = 0; } } else if (ino < (((fs->super)->s_rev_level == 0) ? 11 : (fs->super)->s_first_ino)) { problem_t problem = 0; ext2fs_mark_inode_bitmap2(ctx->inode_used_map, ino); if (ino == 5) { if ((((inode->i_mode) & 00170000) == 0040000)) problem = 0x010003; } else if (ino == 7) { if (inode->i_mode && !(((inode->i_mode) & 00170000) == 0100000)) problem = 0x010003; } else { if (inode->i_mode != 0) problem = 0x010003; } if (problem) { if (fix_problem(ctx, problem, &pctx)) { inode->i_mode = 0; e2fsck_write_inode(ctx, ino, inode, "pass1"); failed_csum = 0; } } check_blocks(ctx, &pctx, block_buf, ((void *)0)); do { finish_processing_inode((ctx), (ino), (&pctx), (failed_csum)); if ((ctx)->flags & 0x0001) return; } while (0); continue; } if (!inode->i_links_count) { do { finish_processing_inode((ctx), (ino), (&pctx), (failed_csum)); if ((ctx)->flags & 0x0001) return; } while (0); continue; } if (inode->i_dtime) { if (fix_problem(ctx, 0x010005, &pctx)) { inode->i_dtime = 0; e2fsck_write_inode(ctx, ino, inode, "pass1"); failed_csum = 0; } } ext2fs_mark_inode_bitmap2(ctx->inode_used_map, ino); switch (fs->super->s_creator_os) { case 1: frag = inode->osd2.hurd2.h_i_frag; fsize = inode->osd2.hurd2.h_i_fsize; break; default: frag = fsize = 0; } if (inode->i_faddr || frag || fsize || (!ext2fs_has_feature_largedir(fs->super) && ((((inode->i_mode) & 00170000) == 0040000) && inode->i_size_high))) mark_inode_bad(ctx, ino); if ((fs->super->s_creator_os != 1) && !ext2fs_has_feature_64bit(fs->super) && inode->osd2.linux2.l_i_file_acl_high != 0) mark_inode_bad(ctx, ino); if ((fs->super->s_creator_os != 1) && !ext2fs_has_feature_huge_file(fs->super) && (inode->osd2.linux2.l_i_blocks_hi != 0)) mark_inode_bad(ctx, ino); if (inode->i_flags & 0x00002000) { if (imagic_fs) { if (!ctx->inode_imagic_map) alloc_imagic_map(ctx); ext2fs_mark_inode_bitmap2(ctx->inode_imagic_map, ino); } else { if (fix_problem(ctx, 0x01002F, &pctx)) { inode->i_flags &= ~0x00002000; e2fsck_write_inode(ctx, ino, inode, "pass1"); failed_csum = 0; } } } check_inode_extra_space(ctx, &pctx, &ea_ibody_quota); check_is_really_dir(ctx, &pctx, block_buf); if (extent_fs && (inode->i_flags & 0x00080000) && (((inode->i_mode) & 00170000) == 0120000) && !ext2fs_inode_has_valid_blocks2(fs, inode) && fix_problem(ctx, 0x01005D, &pctx)) { inode->i_flags &= ~0x00080000; e2fsck_write_inode(ctx, ino, inode, "pass1"); failed_csum = 0; } if ((inode->i_flags & 0x00000800) && add_encrypted_file(ctx, &pctx) < 0) goto clear_inode; if (casefold_fs && inode->i_flags & 0x40000000) ext2fs_mark_inode_bitmap2(ctx->inode_casefold_map, ino); if ((((inode->i_mode) & 00170000) == 0040000)) { ext2fs_mark_inode_bitmap2(ctx->inode_dir_map, ino); e2fsck_add_dir_info(ctx, ino, 0); ctx->fs_directory_count++; if (inode->i_flags & 0x40000000) add_casefolded_dir(ctx, ino); } else if ((((inode->i_mode) & 00170000) == 0100000)) { ext2fs_mark_inode_bitmap2(ctx->inode_reg_map, ino); ctx->fs_regular_count++; } else if ((((inode->i_mode) & 00170000) == 0020000) && e2fsck_pass1_check_device_inode(fs, inode)) { check_extents_inlinedata(ctx, &pctx); check_immutable(ctx, &pctx); check_size(ctx, &pctx); ctx->fs_chardev_count++; } else if ((((inode->i_mode) & 00170000) == 0060000) && e2fsck_pass1_check_device_inode(fs, inode)) { check_extents_inlinedata(ctx, &pctx); check_immutable(ctx, &pctx); check_size(ctx, &pctx); ctx->fs_blockdev_count++; } else if ((((inode->i_mode) & 00170000) == 0120000) && e2fsck_pass1_check_symlink(fs, ino, inode, block_buf)) { check_immutable(ctx, &pctx); ctx->fs_symlinks_count++; if (inode->i_flags & 0x10000000) { do { finish_processing_inode((ctx), (ino), (&pctx), (failed_csum)); if ((ctx)->flags & 0x0001) return; } while (0); continue; } else if (ext2fs_is_fast_symlink(inode)) { ctx->fs_fast_symlinks_count++; check_blocks(ctx, &pctx, block_buf, &ea_ibody_quota); do { finish_processing_inode((ctx), (ino), (&pctx), (failed_csum)); if ((ctx)->flags & 0x0001) return; } while (0); continue; } } else if ((((inode->i_mode) & 00170000) == 0010000) && e2fsck_pass1_check_device_inode(fs, inode)) { check_extents_inlinedata(ctx, &pctx); check_immutable(ctx, &pctx); check_size(ctx, &pctx); ctx->fs_fifo_count++; } else if (((((inode->i_mode) & 00170000) == 0140000)) && e2fsck_pass1_check_device_inode(fs, inode)) { check_extents_inlinedata(ctx, &pctx); check_immutable(ctx, &pctx); check_size(ctx, &pctx); ctx->fs_sockets_count++; } else mark_inode_bad(ctx, ino); if (!(inode->i_flags & 0x00080000) && !(inode->i_flags & 0x10000000)) { if (inode->i_block[12]) ctx->fs_ind_count++; if (inode->i_block[(12 + 1)]) ctx->fs_dind_count++; if (inode->i_block[((12 + 1) + 1)]) ctx->fs_tind_count++; } if (!(inode->i_flags & 0x00080000) && !(inode->i_flags & 0x10000000) && (inode->i_block[12] || inode->i_block[(12 + 1)] || inode->i_block[((12 + 1) + 1)] || ext2fs_file_acl_block(fs, inode))) { struct process_inode_block *itp; itp = &inodes_to_process[process_inode_count]; itp->ino = ino; itp->ea_ibody_quota = ea_ibody_quota; if (inode_size < sizeof(struct ext2_inode_large)) memcpy(&itp->inode, inode, inode_size); else memcpy(&itp->inode, inode, sizeof(itp->inode)); process_inode_count++; } else check_blocks(ctx, &pctx, block_buf, &ea_ibody_quota); do { finish_processing_inode((ctx), (ino), (&pctx), (failed_csum)); if ((ctx)->flags & 0x0001) return; } while (0); if (ctx->flags & (0x0001 | 0x0002)) goto endit; if (process_inode_count >= ctx->process_inode_size) { process_inodes(ctx, block_buf); if (ctx->flags & (0x0001 | 0x0002)) goto endit; } }
&& (v8 = v30, v8 < ext2fs_blocks_count(*(_QWORD *)(*(_QWORD *)a1 + 32LL))) ) { if (a4 <= v31) { if (!a5 || v26 <= a5 || v26 > a6 && ((v33 & 2) != 0 || (*(_DWORD *)(*(_QWORD *)(a2 + 24) + 32LL) & 0x100000) != 0)) { if (!v22 || v32) { if (v22 && (v9 = v30 + v32, v9 > ext2fs_blocks_count( *(_QWORD *)(*(_QWORD *)a1 + 32LL)))) { v19 = 65625; } else if (v22 && v23 && !*(_DWORD *)(*(_QWORD *)(a2 + 24) + 108LL) && !ext2fs_has_feature_largedir( *(_QWORD *)(*(_QWORD *)a1 + 32LL)) && v31 + v32 > (unsigned int)(1 << (21 - *(_BYTE *)(*(_QWORD *)(*(_QWORD *) a1 + 32LL) + 24LL)))) { v19 = 65604; } } else { v19 = 65638; } } else { v19 = 65646; } } else { v19 = 65630; } }
e2fsprogs-1.46.5
ida
int do_ioam6(int argc, char **argv) { _Bool maybe_wide = 0; if (argc < 1 || strcmp(*argv, "help") == 0) usage(); memset(&opts, 0, sizeof(opts)); if (strcmp(*argv, "namespace") == 0) { do { argv++; if (--argc <= 0) incomplete_command(); } while (0); if (strcmp(*argv, "show") == 0) { opts.cmd = IOAM6_CMD_DUMP_NAMESPACES; } else if (strcmp(*argv, "add") == 0) { do { argv++; if (--argc <= 0) incomplete_command(); } while (0); if (get_u16(&opts.ns_id, *argv, 0)) invarg("Invalid namespace ID", *argv); if ((argc - 1 > 0)) { do { argv++; argc--; } while (0); if (strcmp(*argv, "data") == 0) { do { argv++; if (--argc <= 0) incomplete_command(); } while (0); if (get_u32(&opts.ns_data, *argv, 0)) invarg("Invalid data", *argv); maybe_wide = 1; opts.has_ns_data = 1; } else if (strcmp(*argv, "wide") == 0) { do { argv++; if (--argc <= 0) incomplete_command(); } while (0); if (get_u64(&opts.ns_data_wide, *argv, 16)) invarg("Invalid wide data", *argv); opts.has_ns_data_wide = 1; } else { invarg("Invalid argument", *argv); } } if ((argc - 1 > 0)) { do { argv++; argc--; } while (0); if (!maybe_wide || strcmp(*argv, "wide") != 0) invarg("Unexpected argument", *argv); do { argv++; if (--argc <= 0) incomplete_command(); } while (0); if (get_u64(&opts.ns_data_wide, *argv, 16)) invarg("Invalid wide data", *argv); opts.has_ns_data_wide = 1; } opts.cmd = IOAM6_CMD_ADD_NAMESPACE; } else if (strcmp(*argv, "del") == 0) { do { argv++; if (--argc <= 0) incomplete_command(); } while (0); if (get_u16(&opts.ns_id, *argv, 0)) invarg("Invalid namespace ID", *argv); opts.cmd = IOAM6_CMD_DEL_NAMESPACE; } else if (strcmp(*argv, "set") == 0) { do { argv++; if (--argc <= 0) incomplete_command(); } while (0); if (get_u16(&opts.ns_id, *argv, 0)) invarg("Invalid namespace ID", *argv); do { argv++; if (--argc <= 0) incomplete_command(); } while (0); if (strcmp(*argv, "schema") != 0) invarg("Unknown", *argv); do { argv++; if (--argc <= 0) incomplete_command(); } while (0); if (strcmp(*argv, "none") == 0) { opts.sc_none = 1; } else { if (get_u32(&opts.sc_id, *argv, 0)) invarg("Invalid schema ID", *argv); opts.sc_none = 0; } opts.cmd = IOAM6_CMD_NS_SET_SCHEMA; } else { invarg("Unknown", *argv); } } else if (strcmp(*argv, "schema") == 0) { do { argv++; if (--argc <= 0) incomplete_command(); } while (0); if (strcmp(*argv, "show") == 0) { opts.cmd = IOAM6_CMD_DUMP_SCHEMAS; } else if (strcmp(*argv, "add") == 0) { do { argv++; if (--argc <= 0) incomplete_command(); } while (0); if (get_u32(&opts.sc_id, *argv, 0)) invarg("Invalid schema ID", *argv); do { argv++; if (--argc <= 0) incomplete_command(); } while (0); if (strlen(*argv) > (255 * 4)) invarg("Schema DATA too big", *argv); memcpy(opts.sc_data, *argv, strlen(*argv)); opts.cmd = IOAM6_CMD_ADD_SCHEMA; } else if (strcmp(*argv, "del") == 0) { do { argv++; if (--argc <= 0) incomplete_command(); } while (0); if (get_u32(&opts.sc_id, *argv, 0)) invarg("Invalid schema ID", *argv); opts.cmd = IOAM6_CMD_DEL_SCHEMA; } else { invarg("Unknown", *argv); } } else { invarg("Unknown", *argv); } return ioam6_do_cmd(); }
long long do_ioam6(unsigned long a0, unsigned long a1) { unsigned long long *v0; unsigned int v1; char v2; unsigned long long v4; unsigned long long v5; unsigned long long v6; unsigned long long v7; unsigned long long v8; unsigned long long v10; unsigned long long v13; unsigned long long v17; unsigned long long v20; unsigned long long v22; v1 = a0; v0 = a1; v2 = 0; if (v1 > 0) { v4 = strcmp(*(v0), "help"); if (v4) { memset(&opts, 0x0, 0x420); v5 = strcmp(*(v0), "namespace"); if (!v5) { v0 = v0 + 1; v1 -= 1; if (v1 <= 0) incomplete_command(); v6 = strcmp(*(v0), "show"); if (!v6) { opts = 3; } else { v7 = strcmp(*(v0), "add"); if (!v7) { v0 = v0 + 1; v1 -= 1; if (v1 <= 0) incomplete_command(); if (get_u16(&g_400f78, *(v0), 0x0)) invarg("Invalid namespace ID", *(v0)); if (v1 > 1) { v0 = v0 + 1; v1 -= 1; if (!strcmp(*(v0), "data")) { v0 = v0 + 1; v1 -= 1; if (v1 <= 0) incomplete_command(); if (get_u32(&g_400f68, *(v0), 0x0)) invarg("Invalid data", *(v0)); v2 = 1; g_400f7a = 1; } else if (!strcmp(*(v0), "wide")) { v0 = v0 + 1; v1 -= 1; if (v1 <= 0) incomplete_command(); if (get_u64(&g_400f70, *(v0), 0x10)) invarg("Invalid wide data", *(v0)); g_400f7b = 1; } else { invarg("Invalid argument", *(v0)); } } if (v1 > 1) { v0 = v0 + 1; v1 -= 1; if (strcmp(*(v0), "wide") || (v2 ^ 1)) invarg("Unexpected argument", *(v0)); v0 = v0 + 1; v1 -= 1; if (v1 <= 0) incomplete_command(); if (get_u64(&g_400f70, *(v0), 0x10)) invarg("Invalid wide data", *(v0)); g_400f7b = 1; } opts = 1; } else { v8 = strcmp(*(v0), "del"); if (!v8) { v0 = v0 + 1; v1 -= 1; if (v1 <= 0) incomplete_command(); if (get_u16(&g_400f78, *(v0), 0x0)) invarg("Invalid namespace ID", *(v0)); opts = 2; } else { v10 = strcmp(*(v0), "set"); if (!v10) { v0 = v0 + 1; v1 -= 1; if (v1 <= 0) incomplete_command(); if (get_u16(&g_400f78, *(v0), 0x0)) invarg("Invalid namespace ID", *(v0)); v0 = v0 + 1; v1 -= 1; if (v1 <= 0) incomplete_command(); if (strcmp(*(v0), "schema")) invarg("Unknown", *(v0)); v0 = v0 + 1; v1 -= 1; if (v1 <= 0) incomplete_command(); if (!strcmp(*(v0), "none")) { g_400f7c = 1; } else { if (get_u32(&g_400f64, *(v0), 0x0)) invarg("Invalid schema ID", *(v0)); g_400f7c = 0; } opts = 7; } else { invarg("Unknown", *(v0)); } } } } } if (v5 || v10 && v7 && v6 && v8) { v13 = strcmp(*(v0), "schema"); if (!v13) { v0 = v0 + 1; v1 -= 1; if (v1 <= 0) incomplete_command(); v17 = strcmp(*(v0), "show"); if (!v17) { opts = 6; } else { v20 = strcmp(*(v0), "add"); if (!v20) { v0 = v0 + 1; v1 -= 1; if (v1 <= 0) incomplete_command(); if (get_u32(&g_400f64, *(v0), 0x0)) invarg("Invalid schema ID", *(v0)); v0 = v0 + 1; v1 -= 1; if (v1 <= 0) incomplete_command(); if (strlen(*(v0)) > 1020) invarg("Schema DATA too big", *(v0)); memcpy(&g_400f7d, *(v0), strlen(*(v0))); opts = 4; } else { v22 = strcmp(*(v0), "del"); if (!v22) { v0 = v0 + 1; v1 -= 1; if (v1 <= 0) incomplete_command(); if (get_u32(&g_400f64, *(v0), 0x0)) invarg("Invalid schema ID", *(v0)); opts = 5; } else { invarg("Unknown", *(v0)); } } } } if (v13 || v17 && v20 && v22) invarg("Unknown", *(v0)); } return ioam6_do_cmd(); } } if (!v4 || v1 <= 0) usage(); }
iproute2-6.0.0
angr_dream
int auth_activate_options(struct ssh *ssh, struct sshauthopt *opts) { struct sshauthopt *old = auth_opts; const char *emsg = ((void *)0); sshlog("auth.c", __func__, 833, 1, SYSLOG_LEVEL_DEBUG1, ((void *)0), "setting new authentication options"); if ((auth_opts = sshauthopt_merge(old, opts, &emsg)) == ((void *)0)) { sshlog("auth.c", __func__, 835, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "Inconsistent authentication options: %s", emsg); return -1; } return 0; }
int auth_activate_options(unsigned long a0, unsigned long long a1) { void *v0; unsigned long v1; void *v2; unsigned long long v3; unsigned int v5; v1 = a0; v3 = auth_opts; v2 = 0; sshlog("auth.c", "auth_activate_options", 0x341, 0x1, 0x5, 0x0, "setting new authentication options"); auth_opts = sshauthopt_merge(v3, a1, &v2, a1); if (auth_opts) { v5 = 0; } else { v0 = v2; sshlog("auth.c", "auth_activate_options", 0x343, 0x0, 0x2, 0x0, "Inconsistent authentication options: %s"); v5 = -1; } return v5; }
openssh-portable
angr_phoenix
em_inc_search_next(EditLine *el, wint_t c __attribute__((__unused__))) { el->el_search.patlen = 0; return ce_inc_search(el, 23); }
void em_inc_search_next(long param_1) { *(undefined8 *)(param_1 + 0x4a0) = 0; ce_inc_search(param_1, 0x17); return; }
libedit
ghidra
void arc4random_stir(void) { pthread_mutex_lock(&arc4random_mtx); _rs_stir(); pthread_mutex_unlock(&arc4random_mtx); }
void arc4random_stir(void) { pthread_mutex_lock((pthread_mutex_t *)arc4random_mtx); _rs_stir(); pthread_mutex_unlock((pthread_mutex_t *)arc4random_mtx); return; }
libbsd-0.11.7
ghidra
static inline void emit_ancillary_info(char const *program) { struct infomap { char const *program; char const *node; } const infomap[] = { {"[", "test invocation"}, {"coreutils", "Multi-call invocation"}, {"sha224sum", "sha2 utilities"}, {"sha256sum", "sha2 utilities"}, {"sha384sum", "sha2 utilities"}, {"sha512sum", "sha2 utilities"}, {((void *)0), ((void *)0)}}; char const *node = program; struct infomap const *map_prog = infomap; while (map_prog->program && !(strcmp(program, map_prog->program) == 0)) map_prog++; if (map_prog->node) node = map_prog->node; printf (gettext ("\n%s online help: <%s>\n"), "GNU coreutils", "https: char const *lc_messages = setlocale ( 5 , ((void *)0) ); if (lc_messages && strncmp (lc_messages, "" "en_" "", sizeof ("en_") - 1)) { fputs_unlocked (gettext ("Report any translation bugs to " "<https: stdout ) ; } char const *url_program = (strcmp (program, "[") == 0) ? "test" : program; printf (gettext ("Full documentation <%s%s>\n"), "https: printf (gettext ("or available locally via: info '(coreutils) %s%s'\n"), node, node == program ? " invocation" : ""); }
void emit_ancillary_info(char *a0) { unsigned long long v0; unsigned long long v1[2]; char *v2; unsigned long long v3; unsigned long long v4; unsigned long long v5; unsigned long long v6; unsigned long long v7; unsigned long long v8; unsigned long long v9; unsigned long long v10; unsigned long long v11; unsigned long long v12; unsigned long long v13; unsigned long long v14; unsigned long long v15; void *v16; void *v17; char v18; unsigned long long v23; unsigned long long *v24; unsigned long long v25; v4 = "["; v5 = "test invocation"; v6 = "coreutils"; v7 = "Multi-call invocation"; v8 = "sha224sum"; v9 = "sha2 utilities"; v10 = "sha256sum"; v11 = "sha2 utilities"; v12 = "sha384sum"; v13 = "sha2 utilities"; v14 = "sha512sum"; v15 = "sha2 utilities"; v16 = 0; v17 = 0; v0 = a0; for (v1[0] = &v4; v1[0]; v1[0] = v1 + 1) { if (!strcmp(a0, v1[0])) break; } if (v1[1]) v0 = v1[1]; printf(gettext("\n%s online help: <%s>\n")); v2 = setlocale(0x5, NULL); if (v2 && strncmp(v2, "en_", 0x3)) fputs_unlocked(gettext("Report any translation bugs to <https: if (strcmp(a0, "[")) v23 = a0; else v23 = "test"; v3 = v23; printf(gettext("Full documentation <%s%s>\n")); printf(gettext("or available locally via: info '(coreutils) %s%s'\n")); v25 = *(&v18) ^ v24[5]; return; }
coreutils
angr_dream
static int process_msg(struct nlmsghdr *n, void *arg) { FILE *fp = (FILE *)arg; struct genlmsghdr *ghdr; struct rtattr *attrs[(__TCP_METRICS_ATTR_MAX - 1) + 1], *a; const char *h; int len = n->nlmsg_len; inet_prefix daddr, saddr; int atype, stype; if (n->nlmsg_type != genl_family) return -1; len -= (((((sizeof(struct genlmsghdr)) + 4U - 1) & ~(4U - 1))) + ((int)(((sizeof(struct nlmsghdr)) + 4U - 1) & ~(4U - 1)))); if (len < 0) return -1; ghdr = ((void *)(((char *)n) + ((int)(((sizeof(struct nlmsghdr)) + 4U - 1) & ~(4U - 1))))); if (ghdr->cmd != TCP_METRICS_CMD_GET) return 0; parse_rtattr( attrs, (__TCP_METRICS_ATTR_MAX - 1), (void *)ghdr + (((sizeof(struct genlmsghdr)) + 4U - 1) & ~(4U - 1)), len); if (attrs[TCP_METRICS_ATTR_ADDR_IPV4]) { if (f.daddr.family && f.daddr.family != 2) return 0; a = attrs[TCP_METRICS_ATTR_ADDR_IPV4]; daddr.family = 2; atype = TCP_METRICS_ATTR_ADDR_IPV4; } else if (attrs[TCP_METRICS_ATTR_ADDR_IPV6]) { if (f.daddr.family && f.daddr.family != 10) return 0; a = attrs[TCP_METRICS_ATTR_ADDR_IPV6]; daddr.family = 10; atype = TCP_METRICS_ATTR_ADDR_IPV6; } else { return 0; } if (get_addr_rta(&daddr, a, daddr.family)) return 0; if (f.daddr.family && f.daddr.bitlen >= 0 && inet_addr_match(&daddr, &f.daddr, f.daddr.bitlen)) return 0; if (attrs[TCP_METRICS_ATTR_SADDR_IPV4]) { if (f.saddr.family && f.saddr.family != 2) return 0; a = attrs[TCP_METRICS_ATTR_SADDR_IPV4]; saddr.family = 2; stype = TCP_METRICS_ATTR_SADDR_IPV4; } else if (attrs[TCP_METRICS_ATTR_SADDR_IPV6]) { if (f.saddr.family && f.saddr.family != 10) return 0; a = attrs[TCP_METRICS_ATTR_SADDR_IPV6]; saddr.family = 10; stype = TCP_METRICS_ATTR_SADDR_IPV6; } else { saddr.family = 0; stype = 0; } if (saddr.family) { if (get_addr_rta(&saddr, a, saddr.family)) return 0; if (f.saddr.family && f.saddr.bitlen >= 0 && inet_addr_match(&saddr, &f.saddr, f.saddr.bitlen)) return 0; } if (f.flushb) { struct nlmsghdr *fn; struct { struct nlmsghdr n; struct genlmsghdr g; char buf[(((0) + 4U - 1) & ~(4U - 1)) + (128)]; } req2 = { .n = { .nlmsg_type = (genl_family), .nlmsg_flags = (0x01), .nlmsg_len = (((((sizeof(struct genlmsghdr)) + 4U - 1) & ~(4U - 1)) + (0)) + ((int)(((sizeof(struct nlmsghdr)) + 4U - 1) & ~(4U - 1)))), }, .g = { .cmd = (TCP_METRICS_CMD_DEL), .version = (0x1), }, }; addattr_l(&req2.n, sizeof(req2), atype, daddr.data, daddr.bytelen); if (saddr.family) addattr_l(&req2.n, sizeof(req2), stype, saddr.data, saddr.bytelen); if ((((f.flushp) + 4U - 1) & ~(4U - 1)) + req2.n.nlmsg_len > f.flushe) { if (flush_update()) return -1; } fn = (struct nlmsghdr *)(f.flushb + (((f.flushp) + 4U - 1) & ~(4U - 1))); memcpy(fn, &req2.n, req2.n.nlmsg_len); fn->nlmsg_seq = ++grth.seq; f.flushp = (((char *)fn) + req2.n.nlmsg_len) - f.flushb; f.flushed++; if (show_stats < 2) return 0; } open_json_object(((void *)0)); if (f.cmd & (0x0002 | 0x0004)) print_bool(PRINT_ANY, "deleted", "Deleted ", 1); h = format_host(daddr.family, daddr.bytelen, daddr.data); print_color_string(PRINT_ANY, ifa_family_color(daddr.family), "dst", "%s", h); a = attrs[TCP_METRICS_ATTR_AGE]; if (a) { __u64 val = rta_getattr_u64(a); double age = val / 1000.; print_float(PRINT_ANY, "age", " age %.03fsec", age); } a = attrs[TCP_METRICS_ATTR_TW_TS_STAMP]; if (a) { __s32 val = (__s32)rta_getattr_u32(a); __u32 tsval; char tw_ts[64]; a = attrs[TCP_METRICS_ATTR_TW_TSVAL]; tsval = a ? rta_getattr_u32(a) : 0; snprintf(tw_ts, sizeof(tw_ts), "%u/%d", tsval, val); print_string(PRINT_ANY, "tw_ts_stamp", " tw_ts %s ago", tw_ts); } if (attrs[TCP_METRICS_ATTR_VALS]) print_tcp_metrics(attrs[TCP_METRICS_ATTR_VALS]); a = attrs[TCP_METRICS_ATTR_FOPEN_MSS]; if (a) { print_uint(PRINT_ANY, "fopen_miss", " fo_mss %u", rta_getattr_u16(a)); } a = attrs[TCP_METRICS_ATTR_FOPEN_SYN_DROPS]; if (a) { __u16 syn_loss = rta_getattr_u16(a); double ts; a = attrs[TCP_METRICS_ATTR_FOPEN_SYN_DROP_TS]; ts = a ? rta_getattr_u64(a) : 0; print_uint(PRINT_ANY, "fopen_syn_drops", " fo_syn_drops %u", syn_loss); print_float(PRINT_ANY, "fopen_syn_drop_ts", "/%.03fusec ago", ts / 1000000.); } a = attrs[TCP_METRICS_ATTR_FOPEN_COOKIE]; if (a) { char cookie[32 + 1]; unsigned char *ptr = ((void *)(((char *)(a)) + ((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0)))); int i, max = ((int)((a)->rta_len) - ((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0))); if (max > 16) max = 16; cookie[0] = 0; for (i = 0; i < max; i++) sprintf(cookie + i + i, "%02x", ptr[i]); print_string(PRINT_ANY, "fo_cookie", " fo_cookie %s", cookie); } if (saddr.family) { const char *src; src = format_host(saddr.family, saddr.bytelen, saddr.data); print_string(PRINT_ANY, "source", " source %s", src); } print_string(PRINT_FP, ((void *)0), "\n", ""); close_json_object(); fflush(fp); return 0; }
int process_msg(unsigned long a0, void *a1, unsigned long a2, unsigned long a3, unsigned long long a4, unsigned long long a5) { struct_0 *v0; unsigned short v1; unsigned int v2; unsigned int v3; unsigned int v4; unsigned int v5; unsigned int v6; unsigned long long v7; unsigned int v8; unsigned long long v9; char *v10; struct_1 *v11; unsigned long long v12; unsigned long long v13; unsigned long v14; void *v15; char *v16; unsigned long long v17; char v18; char v19; char v20; char v21; char v22; char v23; char v24; char v25; char v26; char v27; char v28; char v29; char v30; unsigned int v31; unsigned short v32; unsigned short v33; char v34; char v35; char v36; char v37; unsigned short v38; char v39; char v40; char v41; unsigned short v42; char v43; char v44; unsigned int v46; unsigned long long v47; void *v48; unsigned long v49; unsigned long long v50; unsigned long long v51; int v52; unsigned long v53; void *v54; v0 = a0; v6 = v0->field_0; if (v0->field_4 != genl_family) { v46 = -1; return v46; } v6 -= 20; if (v6 < 0) { v46 = -1; return v46; } v10 = &v0[2].field_4; if (*(v10) != 1) { v46 = 0; return v46; } parse_rtattr(&v18, 0xd, v10 + 4, v6); if (*(&v19)) { switch (*(&g_4019a2)) { case 0: case 2: v9 = *(&v19); v38 = 2; v2 = 1; break; default: v46 = 0; return v46; } } else { if (!*(&v20)) { v46 = 0; return v46; } switch (*(&g_4019a2)) { case 0: case 10: v9 = *(&v20); v38 = 10; v2 = 2; break; default: v46 = 0; return v46; } } if (get_addr_rta(&v36, v9, v38, v9)) { v46 = 0; return v46; } if (*(&g_4019a2) && g_4019a0 >= 0 && inet_addr_match(&v36, &g_40199c, g_4019a0)) { v46 = 0; return v46; } if (*(&v29)) { switch (*(&g_401aaa)) { case 0: case 2: v9 = *(&v29); v42 = 2; v3 = 11; break; default: v46 = 0; return v46; } } else if (!*(&v30)) { v42 = 0; v3 = 0; } else { switch (*(&g_401aaa)) { case 0: case 10: v9 = *(&v30); v42 = 10; v3 = 12; break; default: v46 = 0; return v46; } } if (v42) { if (get_addr_rta(&v40, v9, v42, v9)) { v46 = 0; return v46; } else if (*(&g_401aaa) && g_401aa8 >= 0 && inet_addr_match(&v40, &g_401aa4, g_401aa8)) { v46 = 0; return v46; } } if (g_401988) { v47 = 18; for (v48 = &v31; v47; v48 += v49 * 8) { v47 -= 1; v31 = 0; } *(v48) = 0; v31 = 20; v32 = genl_family; v33 = 1; v34 = 2; v35 = 1; addattr_l(&v31, 0x94, v2, &v39, *(&v37)); if (v42) addattr_l(&v31, 0x94, v3, &v43, *(&v41)); if ((g_401990 + 3 & -0x4) + v31 > g_401994 && flush_update()) { v46 = -1; return v46; } v11 = (g_401990 + 3 & -0x4) + g_401988; memcpy(v11, &v31, v31); g_40195c = g_40195c + 1; v11->field_8 = g_40195c; g_401990 = &v11->padding_0[v31 + -1 * g_401988]; f = f + 1; if (show_stats <= 1) { v46 = 0; return v46; } } open_json_object(0x0); if ((g_401998 & 6)) print_bool(0x4, "deleted", "Deleted ", 0x1); v12 = format_host(v38, *(&v37), &v39, *(&v37)); print_color_string(0x4, ifa_family_color(v38), "dst", "%s", v12); v9 = *(&v21); if (v9) { v13 = rta_getattr_u64(v9); if (v13 >= 0) { v50 = v13; } else { v51 = v13 >> 1 | v13 & 1; v50 = (v52 * 2); } v53 = v50 / 0x408f400000000000; v14 = v53; print_float(0x4, "age", " age %.03fsec"); } v9 = *(&v23); if (v9) { *(&v7) = rta_getattr_u32(v9); v9 = *(&v22); if (!v9) v46 = 0; else v46 = rta_getattr_u32(v9); v8 = v46; *(&a4) = v7; snprintf(&v44, 0x40, "%u/%d", v8, v7); print_string(0x4, "tw_ts_stamp", " tw_ts %s ago", &v44); } if (*(&v24)) print_tcp_metrics(*(&v24)); v9 = *(&v25); if (v9) print_uint(0x4, "fopen_miss", " fo_mss %u", rta_getattr_u16(v9)); v9 = *(&v26); if (v9) { v1 = rta_getattr_u16(v9); v9 = *(&v27); if (!v9) v54 = 0; else v54 = (v14 < 0 ? rta_getattr_u64(v9) : (0 CONCAT v14 >> 1 | v14 & 1) + (0 CONCAT v14 >> 1 | v14 & 1)); v15 = v54; print_uint(0x4, "fopen_syn_drops", " fo_syn_drops %u", v1); print_float(0x4, "fopen_syn_drop_ts", "/%.03fusec ago"); } v9 = *(&v28); if (v9) { v16 = v9 + 4; v5 = *(v9)-4; if (v5 > 16) v5 = 16; v44 = 0; for (v4 = 0; v4 < v5; v4 += 1) { sprintf(&(&v44)[2 * v4], "%02x", v16[v4]); } print_string(0x4, "fo_cookie", " fo_cookie %s", &v44); } if (v42) { v17 = format_host(v42, *(&v41), &v43, *(&v41)); print_string(0x4, "source", " source %s", v17); } print_string(0x1, 0x0, "\n", &g_401de9); close_json_object(0x1, 0x0, "\n", &g_401de9, a4, a5); fflush(a1); v46 = 0; return v46; }
iproute2-6.0.0
angr_sailr
int fs_proc_check(const char *fs_name) { FILE *f; char buf[80], *cp, *t; f = fopen("/proc/filesystems", "r"); if (!f) return (0); while (!feof(f)) { if (!fgets(buf, sizeof(buf), f)) break; cp = buf; if (!((*__ctype_b_loc())[(int)((*cp))] & (unsigned short int)_ISspace)) { while (*cp && !((*__ctype_b_loc())[(int)((*cp))] & (unsigned short int)_ISspace)) cp++; } while (*cp && ((*__ctype_b_loc())[(int)((*cp))] & (unsigned short int)_ISspace)) cp++; if ((t = strchr(cp, '\n')) != ((void *)0)) *t = 0; if ((t = strchr(cp, '\t')) != ((void *)0)) *t = 0; if ((t = strchr(cp, ' ')) != ((void *)0)) *t = 0; if (!strcmp(fs_name, cp)) { fclose(f); return (1); } } fclose(f); return (0); }
undefined8 fs_proc_check(char *param_1) { int iVar1; FILE *__stream; undefined8 uVar2; char *pcVar3; ushort **ppuVar4; long in_FS_OFFSET; char *local_80; char local_68[88]; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); __stream = fopen("/proc/filesystems", "r"); if (__stream == (FILE *)0x0) { uVar2 = 0; } else { do { iVar1 = feof(__stream); if ((iVar1 != 0) || (pcVar3 = fgets(local_68, 0x50, __stream), pcVar3 == (char *)0x0)) { fclose(__stream); uVar2 = 0; goto LAB_00101cd4; } local_80 = local_68; ppuVar4 = __ctype_b_loc(); if (((*ppuVar4)[local_68[0]] & 0x2000) == 0) { while ((*local_80 != '\0' && (ppuVar4 = __ctype_b_loc(), ((*ppuVar4)[*local_80] & 0x2000) == 0))) { local_80 = local_80 + 1; } } while ((*local_80 != '\0' && (ppuVar4 = __ctype_b_loc(), ((*ppuVar4)[*local_80] & 0x2000) != 0))) { local_80 = local_80 + 1; } pcVar3 = strchr(local_80, 10); if (pcVar3 != (char *)0x0) { *pcVar3 = '\0'; } pcVar3 = strchr(local_80, 9); if (pcVar3 != (char *)0x0) { *pcVar3 = '\0'; } pcVar3 = strchr(local_80, 0x20); if (pcVar3 != (char *)0x0) { *pcVar3 = '\0'; } iVar1 = strcmp(param_1, local_80); } while (iVar1 != 0); fclose(__stream); uVar2 = 1; } LAB_00101cd4: if (local_10 == *(long *)(in_FS_OFFSET + 0x28)) { return uVar2; } __stack_chk_fail(); }
e2fsprogs-1.46.5
ghidra
void crypto_sign_ed25519_ref_scalarmult_base( crypto_sign_ed25519_ref_ge25519 *r, const crypto_sign_ed25519_ref_sc25519 *s) { signed char b[85]; int i; ge25519_aff t; crypto_sign_ed25519_ref_sc25519_window3(b, s); choose_t((ge25519_aff *)r, 0, b[0]); crypto_sign_ed25519_ref_fe25519_setone(&r->z); crypto_sign_ed25519_ref_fe25519_mul(&r->t, &r->x, &r->y); for (i = 1; i < 85; i++) { choose_t(&t, (unsigned long long)i, b[i]); ge25519_mixadd2(r, &t); } }
long long crypto_sign_ed25519_ref_scalarmult_base(unsigned long long a0, unsigned long long a1) { unsigned int v0; char v1; char v2; crypto_sign_ed25519_ref_sc25519_window3(&v2, a1, a1); choose_t(a0, NULL, v2); crypto_sign_ed25519_ref_fe25519_setone(a0 + 0x100); crypto_sign_ed25519_ref_fe25519_mul(a0 + 384, a0, a0 + 128, a0 + 384); for (v0 = 1; v0 <= 84; v0 = __addvsi3(v0, 0x1)) { choose_t(&v1, v0, (&v2)[v0]); ge25519_mixadd2(a0, &v1); } return 0; }
openssh-portable
angr_sailr
static int default_scope(inet_prefix *lcl) { if (lcl->family == 2) { if (lcl->bytelen >= 1 && *(__u8 *)&lcl->data == 127) return RT_SCOPE_HOST; } return 0; }
long default_scope(long a1) { if (*(_WORD *)(a1 + 6) == 2 && *(_WORD *)(a1 + 2) && *(_BYTE *)(a1 + 8) == 127) return 254LL; else return 0LL; }
iproute2-6.0.0
ida
static char *parameter_brace_transform(varname, value, estatep, xform, rtype, quoted, pflags, flags) char *varname, *value; array_eltstate_t *estatep; char *xform; int rtype, quoted, pflags, flags; { int vtype, xc, starsub; char *temp1, *val, *oname; SHELL_VAR *v; xc = xform[0]; if (value == 0 && xc != 'A' && xc != 'a') return ((char *)((void *)0)); oname = this_command_name; this_command_name = varname; vtype = get_var_and_type(varname, value, estatep, quoted, flags, &v, &val); if (vtype == -1) { this_command_name = oname; return ((char *)((void *)0)); } if (xform[0] == 0 || valid_parameter_transform(xform) == 0) { this_command_name = oname; if (vtype == 0) do { if (val) sh_xfree((val), "subst.c", 8667); } while (0); return (interactive_shell ? &expand_param_error : &expand_param_fatal); } starsub = vtype & 128; vtype &= ~128; if ((xc == 'a' || xc == 'A') && vtype == 0 && varname && v == 0) v = find_variable(varname); temp1 = (char *)((void *)0); switch (vtype) { case 0: case 3: temp1 = string_transform(xc, v, val); if (vtype == 0) do { if (val) sh_xfree((val), "subst.c", 8686); } while (0); if (temp1) { val = (quoted & (0x002 | 0x001)) ? quote_string(temp1) : quote_escapes(temp1); sh_xfree((temp1), "subst.c", 8692); temp1 = val; } break; case 2: temp1 = array_transform(xc, v, starsub, quoted); if (temp1 && quoted == 0 && ifs_is_null) { } else if (temp1 && ((quoted & (0x002 | 0x001)) == 0)) { val = quote_escapes(temp1); sh_xfree((temp1), "subst.c", 8706); temp1 = val; } break; case 1: temp1 = parameter_list_transform(xc, varname[0], quoted); if (temp1 && quoted == 0 && ifs_is_null) { } else if (temp1 && ((quoted & (0x002 | 0x001)) == 0)) { val = quote_escapes(temp1); sh_xfree((temp1), "subst.c", 8720); temp1 = val; } break; } this_command_name = oname; return temp1; }
int parameter_brace_transform(char *a0, void *a1, void *a2, char *a3, unsigned long long a4, unsigned long a5, unsigned int v8) { unsigned int v0; unsigned int v1; unsigned int v2; unsigned int v3; unsigned long v4; void *v5; unsigned long v6; unsigned long long v7; char v9; unsigned int v10; v0 = a4; v1 = *(a3); if (!a1 && v1 != 65 && v1 != 97) { v10 = 0; goto LABEL_4149ca; } v7 = this_command_name; this_command_name = a0; v2 = get_var_and_type(a0, a1, a2, a5, *(&v9), &v5, &v4); if (v2 == -1) { this_command_name = v7; v10 = 0; } else if (!*(a3)) { LABEL_41474e: this_command_name = v7; if (!v2 && *(&v4)) sh_xfree(*(&v4), "subst.c", 0x21db); if (!interactive_shell) v10 = &expand_param_fatal; else v10 = &expand_param_error; } else { if (!valid_parameter_transform(a3)) goto LABEL_41474e; v3 = v2 & 128; v2 &= -129; if (v1 != 97 && !(v1 == 65)) goto LABEL_4147e6; if (!v2 && a0 && !v5) v5 = find_variable(a0); LABEL_4147e6: v6 = 0; if (v2 == 3) { v6 = string_transform(v1, v5, *(&v4)); if (!v2 && *(&v4)) sh_xfree(*(&v4), "subst.c", 0x21ee); if (v6) { if (!(a5 & 3)) v10 = quote_escapes(v6); else v10 = quote_string(v6); v4 = v10; sh_xfree(v6, "subst.c", 0x21f4); *(&v6) = *(&v4); } } else { if (!(v2 <= 3)) goto LABEL_4149bb; if (v2 == 2) { v6 = array_transform(v1, v5, v3, a5, a4, &v5); if (v6 && !a5 && !(!5023220010551146633)) goto LABEL_4149b7; if (v6 && !(a5 & 3)) { v4 = quote_escapes(v6); sh_xfree(v6, "subst.c", 0x2202); v6 = v4; } LABEL_4149b7: } else { if (!(v2 <= 2)) goto LABEL_4149bb; if (v2 && v2 == 1) { v6 = parameter_list_transform(v1, *(a0), a5, *(a0), a4, &v5); if (v6 && !a5 && !(!5023220010551146633)) goto LABEL_4149ba; if (v6 && !(a5 & 3)) { v4 = quote_escapes(v6); sh_xfree(v6, "subst.c", 0x2210); v6 = v4; } LABEL_4149ba: } } } LABEL_4149bb: this_command_name = v7; v10 = v6; } LABEL_4149ca: return v10; }
bash
angr_phoenix
static void collect_ids_from_glob(_ssh_compat_glob_t *g, int user, u_int **idsp, u_int *nidsp) { u_int id, i, n = 0, *ids = ((void *)0); for (i = 0; g->gl_pathv[i] != ((void *)0); i++) { if (user) { if (ruser_name(g->gl_statv[i]->st_uid) != ((void *)0)) continue; id = (u_int)g->gl_statv[i]->st_uid; } else { if (rgroup_name(g->gl_statv[i]->st_gid) != ((void *)0)) continue; id = (u_int)g->gl_statv[i]->st_gid; } if (has_id(id, ids, n)) continue; ids = xrecallocarray(ids, n, n + 1, sizeof(*ids)); ids[n++] = id; } *idsp = ids; *nidsp = n; }
unsigned int *collect_ids_from_glob(long a1, int a2, long *a3, unsigned int *a4) { _BOOL4 v4; unsigned int v5; unsigned int *result; int v9; unsigned int i; unsigned int v11; long v12; v11 = 0; v12 = 0LL; for (i = 0; *(_QWORD *)(8LL * i + *(_QWORD *)(a1 + 32)); ++i) { if (a2) { if (ruser_name( *(_DWORD *)(*(_QWORD *)(8LL * i + *(_QWORD *)(a1 + 40)) + 28LL))) continue; v9 = *(_DWORD *)(*(_QWORD *)(8LL * i + *(_QWORD *)(a1 + 40)) + 28LL); v4 = has_id(v9, v12, v11); } else { if (rgroup_name( *(_DWORD *)(*(_QWORD *)(8LL * i + *(_QWORD *)(a1 + 40)) + 32LL))) continue; v9 = *(_DWORD *)(*(_QWORD *)(8LL * i + *(_QWORD *)(a1 + 40)) + 32LL); v4 = has_id(v9, v12, v11); } if (!v4) { v12 = xrecallocarray(v12, v11, v11 + 1, 4LL); v5 = v11++; *(_DWORD *)(v12 + 4LL * v5) = v9; } } *a3 = v12; result = a4; *a4 = v11; return result; }
openssh-portable
ida
static void set_argv0() { SHELL_VAR *v; v = find_variable("BASH_ARGV0"); if (v && ((((v)->attributes) & (0x0008000)))) assign_bash_argv0(v, ((v)->value), 0, 0); }
void set_argv0() { struct_0 *v0; unsigned long long v3; unsigned long long v4; *(&v0) = find_variable("BASH_ARGV0"); if (!v0) return; v3 = v0->field_28 & 0x8000; if ((v0->field_28 & 0x8000)) { v4 = assign_bash_argv0(v0, v0->field_8, 0x0, 0x0); return; } return; }
bash
angr_sailr
void get_locality_crt_set(gnutls_x509_crt_t crt) { int ret; if (batch) { if (!cfg.locality) return; ret = gnutls_x509_crt_set_dn_by_oid(crt, "2.5.4.7", 0, cfg.locality, strlen(cfg.locality)); if (ret < 0) { fprintf(stderr, "set_dn: %s\n", gnutls_strerror(ret)); exit(1); } } else { read_crt_set(crt, "Locality name: ", "2.5.4.7"); } }
void get_locality_crt_set(undefined8 param_1) { if (*piRam000000000010524b == 0) { read_crt_set(param_1, "Locality name: ", "2.5.4.7"); } else if (*(long *)(lRam000000000010525c + 0x10) != 0) { strlen(*(char **)(lRam0000000000105270 + 0x10)); } return; }
gnutls
ghidra
static void mtime_coder(struct tar_stat_info const *st, char const *keyword, struct xheader *xhdr, void const *data) { struct timespec const *mtime = data; code_time(mtime ? *mtime : st->mtime, keyword, xhdr); }
long long mtime_coder(unsigned long long a0[33], unsigned long a1, void *a2, unsigned long long a3[2]) { void *v0; unsigned long long v2; unsigned long long v3; v0 = a2; if (!a3) { v2 = a0[32]; v3 = a0[31]; } else { v2 = a3[1]; v3 = a3[0]; } return code_time(v3, v2, a1, v0); }
tar
angr_phoenix
static inline void emit_mandatory_arg_note(void) { fputs_unlocked(gettext("\nMandatory arguments to long options are mandatory " "for short options too.\n"), stdout) ; }
void emit_mandatory_arg_note() { unsigned long long v1; v1 = fputs_unlocked(gettext("\nMandatory arguments to long options are " "mandatory for short options too.\n"), stdout); return; }
coreutils
angr_sailr
hasevery(struct tree const *a, struct tree const *b) { if (!b) return 1; if (!hasevery(a, b->llink)) return 0; if (!hasevery(a, b->rlink)) return 0; while (a && b->label != a->label) if (b->label < a->label) a = a->llink; else a = a->rlink; return !!a; }
int hasevery(unsigned long long a0, struct_0 *a1) { struct_0 *v0; unsigned int v2; v0 = a0; if (!a1) { v2 = 1; } else if ((hasevery(v0, a1->field_0) ^ 1)) { v2 = 0; } else { v2 = hasevery(v0, a1->field_8) ^ 1; if (v2) { v2 = 0; } else { while (v0) { v2 = v0->field_18; if (a1->field_18 == v0->field_18) break; if (a1->field_18 < v0->field_18) { v2 = v0->field_0; v0 = v0->field_0; } else { v2 = v0->field_8; v0 = v0->field_8; } } *(&v2) = v0; } } return v2; }
grep
angr_dream
int compopt_builtin(list) WORD_LIST *list; { int opts_on, opts_off, *opts, opt, oind, ret, Dflag, Eflag, Iflag; WORD_LIST *l, *wl; COMPSPEC *cs; opts_on = opts_off = Eflag = Dflag = Iflag = 0; ret = 0; reset_internal_getopt(); while ((opt = internal_getopt(list, "+o:DEI")) != -1) { opts = (list_opttype == '-') ? &opts_on : &opts_off; switch (opt) { case 'o': oind = find_compopt(list_optarg); if (oind < 0) { sh_invalidoptname(list_optarg); return (258); } *opts |= compopts[oind].optflag; break; case 'D': Dflag = 1; break; case 'E': Eflag = 1; break; case 'I': Iflag = 1; break; case -99: builtin_help(); return (258); default: builtin_usage(); return (258); } } list = loptend; if (Dflag) wl = make_word_list(make_bare_word("_DefaultCmD_"), (WORD_LIST *)((void *)0)); else if (Eflag) wl = make_word_list(make_bare_word("_EmptycmD_"), (WORD_LIST *)((void *)0)); else if (Iflag) wl = make_word_list(make_bare_word("_InitialWorD_"), (WORD_LIST *)((void *)0)); else wl = (WORD_LIST *)((void *)0); if (list == 0 && wl == 0) { if ((rl_readline_state & (0x0004000)) == 0 || pcomp_curcs == 0) { builtin_error(gettext("not currently executing completion function")); return (1); } cs = pcomp_curcs; if (opts_on == 0 && opts_off == 0) { print_compopts(pcomp_curcmd, cs, 1); return (sh_chkwrite(ret)); } pcomp_set_compspec_options(cs, opts_on, 1); pcomp_set_compspec_options(cs, opts_off, 0); pcomp_set_readline_variables(opts_on, 1); pcomp_set_readline_variables(opts_off, 0); return (ret); } for (l = wl ? wl : list; l; l = l->next) { cs = progcomp_search(l->word->word); if (cs == 0) { builtin_error(gettext("%s: no completion specification"), l->word->word); ret = 1; continue; } if (opts_on == 0 && opts_off == 0) { print_compopts(l->word->word, cs, 1); continue; } pcomp_set_compspec_options(cs, opts_on, 1); pcomp_set_compspec_options(cs, opts_off, 0); } if (wl) dispose_words(wl); return (ret); }
ulong compopt_builtin(undefined8 param_1) { undefined8 *puVar1; undefined8 uVar2; ulong uVar3; long in_FS_OFFSET; uint local_60; uint local_5c; uint local_58; int local_54; int local_50; int local_4c; int local_48; int local_44; undefined8 *local_40; undefined8 *local_38; long local_30; uint *local_28; long local_20; local_20 = *(long *)(in_FS_OFFSET + 0x28); local_4c = 0; local_54 = 0; local_50 = 0; local_5c = 0; local_60 = 0; local_58 = 0; reset_internal_getopt(); LAB_001017d2: local_48 = internal_getopt(param_1, "+o:DEI"); puVar1 = loptend; if (local_48 == -1) { if (local_54 == 0) { if (local_50 == 0) { if (local_4c == 0) { local_38 = (undefined8 *)0x0; } else { uVar2 = make_bare_word("_InitialWorD_"); local_38 = (undefined8 *)make_word_list(uVar2, 0); } } else { uVar2 = make_bare_word("_EmptycmD_"); local_38 = (undefined8 *)make_word_list(uVar2, 0); } } else { uVar2 = make_bare_word("_DefaultCmD_"); local_38 = (undefined8 *)make_word_list(uVar2, 0); } if ((puVar1 == (undefined8 *)0x0) && (local_38 == (undefined8 *)0x0)) { if (((rl_readline_state & 0x4000) == 0) || (pcomp_curcs == 0)) { uVar2 = gettext("not currently executing completion function"); builtin_error(uVar2); uVar3 = 1; } else { local_30 = pcomp_curcs; if ((local_60 == 0) && (local_5c == 0)) { print_compopts(pcomp_curcmd, pcomp_curcs, 1); uVar3 = sh_chkwrite(local_58); } else { pcomp_set_compspec_options(pcomp_curcs, local_60, 1); pcomp_set_compspec_options(local_30, local_5c, 0); pcomp_set_readline_variables(local_60, 1); pcomp_set_readline_variables(local_5c, 0); uVar3 = (ulong)local_58; } } } else { local_40 = puVar1; if (local_38 != (undefined8 *)0x0) { local_40 = local_38; } for (; local_40 != (undefined8 *)0x0; local_40 = (undefined8 *)*local_40) { local_30 = progcomp_search(*(undefined8 *)local_40[1]); if (local_30 == 0) { uVar2 = gettext("%s: no completion specification"); builtin_error(uVar2); local_58 = 1; } else if ((local_60 == 0) && (local_5c == 0)) { print_compopts(*(undefined8 *)local_40[1], local_30, 1); } else { pcomp_set_compspec_options(local_30, local_60, 1); pcomp_set_compspec_options(local_30, local_5c, 0); } } if (local_38 != (undefined8 *)0x0) { dispose_words(local_38); } uVar3 = (ulong)local_58; } LAB_00101a4e: if (local_20 == *(long *)(in_FS_OFFSET + 0x28)) { return uVar3; } __stack_chk_fail(); } if (list_opttype == 0x2d) { local_28 = &local_60; } else { local_28 = &local_5c; } if (local_48 == 0x6f) { local_44 = find_compopt(list_optarg); if (local_44 < 0) { sh_invalidoptname(list_optarg); uVar3 = 0x102; goto LAB_00101a4e; } *local_28 = (uint) * (undefined8 *)(compopts + (long)local_44 * 0x10 + 8) | *local_28; goto LAB_001017d2; } if (local_48 < 0x70) { if (local_48 == 0x49) { local_4c = 1; goto LAB_001017d2; } if (0x49 < local_48) goto LAB_001017c3; if (local_48 == 0x45) { local_50 = 1; goto LAB_001017d2; } if (local_48 < 0x46) { if (local_48 == -99) { builtin_help(); uVar3 = 0x102; goto LAB_00101a4e; } if (local_48 == 0x44) { local_54 = 1; goto LAB_001017d2; } } } LAB_001017c3: builtin_usage(); uVar3 = 0x102; goto LAB_00101a4e; }
bash
ghidra
static void cleanup_expansion_error() { char *to_free; int old_verify; old_verify = hist_verify; hist_verify = 0; fprintf(rl_outstream, "\r\n"); to_free = pre_process_line(rl_line_buffer, 1, 0); hist_verify = old_verify; if (to_free != rl_line_buffer) do { if (to_free) sh_xfree((to_free), "bashline.c", 2723); } while (0); putc('\r', rl_outstream); rl_forced_update_display(); }
void cleanup_expansion_error(void) { undefined4 uVar1; long lVar2; uVar1 = hist_verify; hist_verify = 0; fprintf(rl_outstream, "\r\n"); lVar2 = pre_process_line(rl_line_buffer, 1, 0); hist_verify = uVar1; if ((lVar2 != rl_line_buffer) && (lVar2 != 0)) { sh_xfree(lVar2, "bashline.c", 0xaa3); } putc(0xd, rl_outstream); rl_forced_update_display(); return; }
bash
ghidra
static void compress_block(ltree, dtree) ct_data *ltree; ct_data *dtree; { unsigned dist; int lc; unsigned lx = 0; unsigned dx = 0; unsigned fx = 0; uch flag = 0; unsigned code; int extra; if (last_lit != 0) do { if ((lx & 7) == 0) flag = flag_buf[fx++]; lc = inbuf[lx++]; if ((flag & 1) == 0) { send_bits(ltree[lc].fc.code, ltree[lc].dl.len); ; } else { code = length_code[lc]; send_bits(ltree[code + 256 + 1].fc.code, ltree[code + 256 + 1].dl.len); extra = extra_lbits[code]; if (extra != 0) { lc -= base_length[code]; send_bits(lc, extra); } dist = d_buf[dx++]; code = ((dist) < 256 ? dist_code[dist] : dist_code[256 + ((dist) >> 7)]); ; send_bits(dtree[code].fc.code, dtree[code].dl.len); extra = extra_dbits[code]; if (extra != 0) { dist -= base_dist[code]; send_bits(dist, extra); } } flag >>= 1; } while (lx < last_lit); send_bits(ltree[256].fc.code, ltree[256].dl.len); }
long compress_block(long a1, long a2) { int v2; unsigned int v3; int v4; unsigned int v5; unsigned char i; unsigned int v8; int v9; int v10; int v11; int v12; unsigned int v13; unsigned int v14; unsigned int v15; unsigned int v16; v8 = 0; v9 = 0; v10 = 0; for (i = 0; v8 < last_lit; i >>= 1) { if ((v8 & 7) == 0) { v2 = v10++; i = flag_buf[v2]; } v3 = v8++; v11 = *((unsigned char *)&inbuf + v3); if ((i & 1) != 0) { v12 = (unsigned char)length_code[*((unsigned char *)&inbuf + v3)]; send_bits(*(unsigned short *)(4LL * (unsigned int)(v12 + 257) + a1), *(unsigned short *)(4LL * (unsigned int)(v12 + 257) + a1 + 2)); v14 = extra_lbits[v12]; if (v14) send_bits((unsigned int)(v11 - base_length[v12]), v14); v4 = v9++; v16 = (unsigned short)d_buf[v4]; if (v16 > 0xFF) v5 = (unsigned char)dist_code[(v16 >> 7) + 256]; else v5 = (unsigned char)dist_code[(unsigned short)d_buf[v4]]; v13 = v5; send_bits(*(unsigned short *)(4LL * v5 + a2), *(unsigned short *)(4LL * v5 + a2 + 2)); v15 = extra_dbits[v13]; if (v15) send_bits(v16 - base_dist[v13], v15); } else { send_bits( *(unsigned short *)(4LL * *((unsigned char *)&inbuf + v3) + a1), *(unsigned short *)(4LL * *((unsigned char *)&inbuf + v3) + a1 + 2)); } } return send_bits(*(unsigned short *)(a1 + 1024), *(unsigned short *)(a1 + 1026)); }
gzip-1.12
ida
static int parse_nexthops(struct nlmsghdr *n, struct rtmsg *r, int argc, char **argv) { char buf[4096]; struct rtattr *rta = (void *)buf; struct rtnexthop *rtnh; rta->rta_type = RTA_MULTIPATH; rta->rta_len = ((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0)); rtnh = ((void *)(((char *)(rta)) + ((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0)))); while (argc > 0) { if (strcmp(*argv, "nexthop") != 0) { fprintf( stderr, "Error: \"nexthop\" or end of line is expected instead of \"%s\"\n", *argv); exit(-1); } if (argc <= 1) { fprintf(stderr, "Error: unexpected end of line after \"nexthop\"\n"); exit(-1); } memset(rtnh, 0, sizeof(*rtnh)); rtnh->rtnh_len = sizeof(*rtnh); rta->rta_len += rtnh->rtnh_len; if (parse_one_nh(n, r, rta, 4096, rtnh, &argc, &argv)) { fprintf(stderr, "Error: cannot parse nexthop\n"); exit(-1); } rtnh = ((struct rtnexthop *)(((char *)(rtnh)) + ((((rtnh)->rtnh_len) + 4 - 1) & ~(4 - 1)))); } if (rta->rta_len > ((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0))) return addattr_l( n, 4096, RTA_MULTIPATH, ((void *)(((char *)(rta)) + ((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0)))), ((int)((rta)->rta_len) - ((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0)))); return 0; }
int parse_nexthops(unsigned long a0, char *a1, unsigned long a2, unsigned long long *a3) { char v0; char v1; unsigned short *v2; unsigned short v3[2]; char v4; unsigned long long v5; unsigned int v8; v5 = *(&v5); *(&v3) = &v4; v3[1] = 9; v3[0] = 4; for (v2 = &v3[1]; a2 > 0; v2 = v2 + (*(v2) + 3 & 0xfffffffc)) { if (strcmp(*(a3), "nexthop")) { fprintf( *(&stderr), "Error: \"nexthop\" or end of line is expected instead of \"%s\"\n", *(a3)); exit(0xffffffff); } else if (a2 <= 1) { fprintf(*(&stderr), "Error: unexpected end of line after \"nexthop\"\n"); exit(0xffffffff); } else { memset(v2, 0x0, 0x8); *(v2) = 8; v3[0] = v3[0] + *(v2); v8 = parse_one_nh(a0, a1, v3, 0x1000, v2, &v1, &v0); if (v8) { fprintf(*(&stderr), "Error: cannot parse nexthop\n"); exit(0xffffffff); } } } if (v3[0] > 4) v8 = addattr_l(a0, 0x1000, 0x9, v3 + 1, v3[0] - 4); else v8 = 0; return v8; }
iproute2-6.0.0
angr_dream
int rl_vi_char_search(int count, int key) { int c; static char *target; static int tlen; if (key == ';' || key == ',') { if (_rl_cs_orig_dir == 0) return 1; if (_rl_vi_last_search_mblen == 0) return 1; _rl_cs_dir = (key == ';') ? _rl_cs_orig_dir : -_rl_cs_orig_dir; } else { switch (key) { case 't': _rl_cs_orig_dir = _rl_cs_dir = 1; break; case 'T': _rl_cs_orig_dir = _rl_cs_dir = -1; break; case 'f': _rl_cs_orig_dir = _rl_cs_dir = 2; break; case 'F': _rl_cs_orig_dir = _rl_cs_dir = -2; break; } if (_rl_vi_redoing) { } else if ((rl_readline_state & (0x0080000))) { _rl_callback_data = _rl_callback_data_alloc(count); _rl_callback_data->i1 = _rl_cs_dir; _rl_callback_data->i2 = key; _rl_callback_func = _rl_vi_callback_char_search; (rl_readline_state |= (0x0800000)); return (0); } else { c = _rl_read_mbchar(_rl_vi_last_search_mbchar, 16); if (c <= 0) return -1; _rl_vi_last_search_mblen = c; } } target = _rl_vi_last_search_mbchar; tlen = _rl_vi_last_search_mblen; return (_rl_char_search_internal(count, _rl_cs_dir, target, tlen)); }
long long rl_vi_char_search(unsigned long a0, unsigned long a1) { unsigned int v0; unsigned long long v2; unsigned int v3; if (a1 == 59) { LABEL_403a02: if (!_rl_cs_orig_dir) { v2 = 1; goto LABEL_403ba7; } if (!_rl_vi_last_search_mblen) { v2 = 1; } else { if (a1 == 59) v3 = _rl_cs_orig_dir; else v3 = -(_rl_cs_orig_dir); _rl_cs_dir = v3; goto LABEL_403b70; } } else { if (a1 == 44) goto LABEL_403a02; if (a1 == 116) { _rl_cs_dir = 1; _rl_cs_orig_dir = _rl_cs_dir; } else if (a1 <= 116) { if (a1 == 102) { _rl_cs_dir = 2; _rl_cs_orig_dir = _rl_cs_dir; } else if (a1 <= 102) { if (a1 == 70) { _rl_cs_dir = -2; _rl_cs_orig_dir = _rl_cs_dir; } else if (a1 == 84) { _rl_cs_dir = -1; _rl_cs_orig_dir = _rl_cs_dir; } } } if (false) { if ((rl_readline_state & 0x80000)) { _rl_callback_data = _rl_callback_data_alloc(a0); *((_rl_callback_data + 4)) = _rl_cs_dir; *((_rl_callback_data + 8)) = a1; _rl_callback_func = _rl_vi_callback_char_search; *(&rl_readline_state[0]) = rl_readline_state | &g_800000; v2 = 0; goto LABEL_403ba7; } v0 = _rl_read_mbchar(&_rl_vi_last_search_mbchar, 0x10); if (v0 <= 0) { v2 = 4294967295; goto LABEL_403ba7; } else { _rl_vi_last_search_mblen = v0; } } LABEL_403b70: target.6558 = &_rl_vi_last_search_mbchar; tlen.6559 = _rl_vi_last_search_mblen; v2 = _rl_char_search_internal(a0, _rl_cs_dir, target.6558, tlen.6559); } LABEL_403ba7: return v2; }
bash
angr_phoenix
intmax_t evalexp(expr, flags, validp) char *expr; int flags; int *validp; { intmax_t val; int c; sigjmp_buf oevalbuf; val = 0; noeval = 0; already_expanded = (flags & 0x01); __builtin_memcpy((oevalbuf), (evalbuf), (sizeof(evalbuf))); c = __sigsetjmp((evalbuf), 0); if (c) { do { if (tokstr) sh_xfree((tokstr), "expr.c", 425); } while (0); do { if (expression) sh_xfree((expression), "expr.c", 426); } while (0); tokstr = expression = (char *)((void *)0); expr_unwind(); expr_depth = 0; __builtin_memcpy((evalbuf), (oevalbuf), (sizeof(evalbuf))); if (validp) *validp = 0; return (0); } val = subexpr(expr); if (validp) *validp = 1; __builtin_memcpy((evalbuf), (oevalbuf), (sizeof(evalbuf))); return (val); }
long long evalexp(char *a0, unsigned long a1, unsigned int *a2, unsigned long long a3) { unsigned int v0; void *v1; unsigned long long v2; unsigned long long v3; unsigned long long v4; unsigned long long v5; unsigned long long v6; unsigned long long v7; unsigned long long v8; unsigned long long v9; unsigned long long v10; unsigned long long v11; unsigned long long v12; unsigned long long v13; unsigned long long v14; unsigned long long v15; unsigned long long v16; unsigned long long v17; unsigned long long v18; unsigned long long v19; unsigned long long v20; unsigned long long v21; unsigned long long v22; unsigned long long v23; unsigned long long v24; unsigned long long v25; unsigned long long v26; void *v28; v1 = 0; noeval = 0; already_expanded = a1 & 1; v2 = evalbuf; v3 = g_402c08; v4 = g_402c10; v5 = g_402c18; v6 = g_402c20; v7 = g_402c28; v8 = g_402c30; v9 = g_402c38; v10 = g_402c40; v11 = g_402c48; v12 = g_402c50; v13 = g_402c58; v14 = g_402c60; v15 = g_402c68; v16 = g_402c70; v17 = g_402c78; v18 = g_402c80; v19 = g_402c88; v20 = g_402c90; v21 = g_402c98; v22 = g_402ca0; v23 = g_402ca8; v24 = g_402cb0; v25 = g_402cb8; v26 = g_402cc0; v0 = __sigsetjmp(&evalbuf); if (v0) { if (tokstr) sh_xfree(tokstr, "expr.c", 0x1a9, a3); if (expression) sh_xfree(expression, "expr.c", 0x1aa, a3); expression = 0; tokstr = expression; expr_unwind(a0, a1, a2, a3); expr_depth = 0; evalbuf = v2; g_402c08 = v3; g_402c10 = v4; g_402c18 = v5; g_402c20 = v6; g_402c28 = v7; g_402c30 = v8; g_402c38 = v9; g_402c40 = v10; g_402c48 = v11; g_402c50 = v12; g_402c58 = v13; g_402c60 = v14; g_402c68 = v15; g_402c70 = v16; g_402c78 = v17; g_402c80 = v18; g_402c88 = v19; g_402c90 = v20; g_402c98 = v21; g_402ca0 = v22; g_402ca8 = v23; g_402cb0 = v24; g_402cb8 = v25; g_402cc0 = v26; if (a2) { *(a2) = 0; v28 = 0; return v28; } v28 = 0; return v28; } else { v1 = subexpr(a0, a1, a2, a3); if (a2) *(a2) = 1; evalbuf = v2; g_402c08 = v3; g_402c10 = v4; g_402c18 = v5; g_402c20 = v6; g_402c28 = v7; g_402c30 = v8; g_402c38 = v9; g_402c40 = v10; g_402c48 = v11; g_402c50 = v12; g_402c58 = v13; g_402c60 = v14; g_402c68 = v15; g_402c70 = v16; g_402c78 = v17; g_402c80 = v18; g_402c88 = v19; g_402c90 = v20; g_402c98 = v21; g_402ca0 = v22; g_402ca8 = v23; g_402cb0 = v24; g_402cb8 = v25; g_402cc0 = v26; v28 = v1; return v28; } }
bash
angr_sailr
static _Bool collect_arg_nonconst(char **argv, int *arg_ptr, char **collected_arg) { if ((argv == ((void *)0)) || (argv[*arg_ptr] == ((void *)0))) { *collected_arg = ((void *)0); return 0; } else { *collected_arg = argv[*arg_ptr]; (*arg_ptr)++; return 1; } }
int collect_arg_nonconst(unsigned long long *a0, unsigned int *a1, unsigned long long *a2) { unsigned int v1; if (a0 && a0[*(a1)]) { *(a2) = a0[*(a1)]; *(a1) = *(a1) + 1; v1 = 1; return v1; } *(a2) = 0; v1 = 0; return v1; }
findutils
angr_sailr
static _Bool errno_unsupported(int err) { return err == 95 || err == 61; }
int errno_unsupported(unsigned long a0) { unsigned int v1; unsigned int v2; switch (a0) { case 61: case 95: v1 = 1; break; default: v1 = 0; break; } v2 = v1 & 1; return v2; }
coreutils
angr_sailr
static _Bool sparse_dump_region(struct tar_sparse_file *file, size_t i) { union block *blk; off_t bytes_left = file->stat_info->sparse_map[i].numbytes; if (!lseek_or_error(file, file->stat_info->sparse_map[i].offset)) return 0; while (bytes_left > 0) { size_t bufsize = (bytes_left > 512) ? 512 : bytes_left; size_t bytes_read; blk = find_next_block(); bytes_read = safe_read(file->fd, blk->buffer, bufsize); if (bytes_read == ((size_t)-1)) { read_diag_details(file->stat_info->orig_file_name, (file->stat_info->sparse_map[i].offset + file->stat_info->sparse_map[i].numbytes - bytes_left), bufsize); return 0; } else if (bytes_read == 0) { char buf[((((((sizeof(uintmax_t) * 8) - (!((__typeof__(uintmax_t))0 < (__typeof__(uintmax_t))-1))) * 146 + 484) / 485) + (!((__typeof__(uintmax_t))0 < (__typeof__(uintmax_t))-1))) + 1)]; struct stat st; size_t n; if (fstat(file->fd, &st) == 0) n = file->stat_info->stat.st_size - st.st_size; else n = file->stat_info->stat.st_size - (file->stat_info->sparse_map[i].offset + file->stat_info->sparse_map[i].numbytes - bytes_left); do { if ((warning_option & (0x00000080))) do { if (error_hook) error_hook(); error(0, 0, ngettext("%s: File shrank by %s byte; padding with zeros", "%s: File shrank by %s bytes; padding with zeros", n), quotearg_colon(file->stat_info->orig_file_name), umaxtostr(n, buf)); } while (0); } while (0) ; if (!ignore_failed_read_option) set_exit_status(1); return 0; } memset(blk->buffer + bytes_read, 0, 512 - bytes_read); bytes_left -= bytes_read; file->dumped_size += bytes_read; set_next_block_after(blk); } return 1; }
undefined8 sparse_dump_region(int *param_1, long param_2) { char cVar1; int iVar2; undefined8 uVar3; long lVar4; long lVar5; long lVar6; undefined8 uVar7; undefined8 uVar8; long in_FS_OFFSET; long local_f0; long local_e8; stat local_c8; undefined local_38[24]; long local_20; local_20 = *(long *)(in_FS_OFFSET + 0x28); local_f0 = *(long *)(*(long *)(*(long *)(param_1 + 6) + 0x140) + param_2 * 0x10 + 8); cVar1 = lseek_or_error( param_1, *(undefined8 *)(*(long *)(*(long *)(param_1 + 6) + 0x140) + param_2 * 0x10)); if (cVar1 == '\x01') { while (0 < local_f0) { lVar4 = 0x200; if (local_f0 < 0x201) { lVar4 = local_f0; } lVar5 = find_next_block(); lVar6 = safe_read(*param_1, lVar5, lVar4); if (lVar6 == -1) { read_diag_details(**(undefined8 **)(param_1 + 6), (*(long *)(*(long *)(*(long *)(param_1 + 6) + 0x140) + param_2 * 0x10 + 8) + *(long *)(*(long *)(*(long *)(param_1 + 6) + 0x140) + param_2 * 0x10)) - local_f0, lVar4); uVar3 = 0; goto LAB_00100e19; } if (lVar6 == 0) { iVar2 = fstat(*param_1, &local_c8); if (iVar2 == 0) { local_e8 = *(long *)(*(long *)(param_1 + 6) + 0x88) - local_c8.st_size; } else { local_e8 = *(long *)(*(long *)(param_1 + 6) + 0x88) - ((*(long *)(*(long *)(*(long *)(param_1 + 6) + 0x140) + param_2 * 0x10 + 8) + *(long *)(*(long *)(*(long *)(param_1 + 6) + 0x140) + param_2 * 0x10)) - local_f0); } if ((warning_option & 0x80) != 0) { if (error_hook != (code *)0x0) { (*error_hook)(); } uVar3 = umaxtostr(local_e8, local_38); uVar7 = quotearg_colon(**(undefined8 **)(param_1 + 6)); uVar8 = ngettext("%s: File shrank by %s byte; padding with zeros", "%s: File shrank by %s bytes; padding with zeros", local_e8); error(0, 0, uVar8, uVar7, uVar3); } if (ignore_failed_read_option != '\x01') { set_exit_status(1); } uVar3 = 0; goto LAB_00100e19; } memset((void *)(lVar5 + lVar6), 0, 0x200 - lVar6); local_f0 = local_f0 - lVar6; *(long *)(param_1 + 4) = lVar6 + *(long *)(param_1 + 4); set_next_block_after(); } uVar3 = 1; } else { uVar3 = 0; } LAB_00100e19: if (local_20 != *(long *)(in_FS_OFFSET + 0x28)) { __stack_chk_fail(); } return uVar3; }
tar
ghidra
void flushall(void) { flushout(&output); }
void flushall(void) { flushout(output); return; }
dash-0.5.11+git20210903+057cd650a4ed
ghidra
ct_enc_width(wchar_t c) { mbstate_t mbs; char buf[16]; size_t size; memset(&mbs, 0, sizeof(mbs)); if ((size = wcrtomb(buf, c, &mbs)) == (size_t)-1) return 0; return size; }
size_t ct_enc_width(wchar_t a1) { size_t v2; mbstate_t s; char v4[24]; unsigned long v5; v5 = __readfsqword(0x28u); memset(&s, 0, sizeof(s)); v2 = wcrtomb(v4, a1, &s); if (v2 == -1LL) return 0LL; else return v2; }
libedit
ida
_Bool pred_perm (const char *pathname, struct stat *stat_buf, struct predicate *pred_ptr) { mode_t mode = stat_buf->st_mode; mode_t perm_val = pred_ptr->args.perm.val[((((mode)) & 0170000) == (0040000)) != 0]; (void)pathname; switch (pred_ptr->args.perm.kind) { case PERM_AT_LEAST: return (mode & perm_val) == perm_val; break; case PERM_ANY: if (0 == perm_val) return 1; else return (mode & perm_val) != 0; break; case PERM_EXACT: return (mode & (04000 | 02000 | 01000 | (0100 | (0100 >> 3) | ((0100 >> 3) >> 3) | (0200 | (0200 >> 3) | ((0200 >> 3) >> 3) | (0400 | (0400 >> 3) | ((0400 >> 3) >> 3)))))) == perm_val; break; default: abort(); break; } }
long long pred_perm(unsigned long a0, struct_2 *a1, struct_1 *a2) { unsigned long v0; unsigned int v1; unsigned int v2; unsigned long long v4; v0 = a0; v1 = a1->field_18; v2 = *(&a2[1].padding_0[4 * ((v1 & 0xf000) == 0x4000)]); if (a2->field_38 != 2) { if (a2->field_38 <= 2) { if (!a2->field_38) { v4 = v1 & v2; *(&v4) = v2 == (v1 & v2); goto LABEL_401571; } if (a2->field_38 == 1) { if (!v2) { v4 = 1; goto LABEL_401571; } else { v4 = v1 & v2; *(&v4) = (v1 & v2); goto LABEL_401571; } } } abort(); } else { v4 = v1 & 4095; *(&v4) = v2 == (v1 & 4095); LABEL_401571: return v4; } }
findutils
angr_phoenix
static _Bool apply_time_suffix(double *x, char suffix_char) { int multiplier; switch (suffix_char) { case 0: case 's': multiplier = 1; break; case 'm': multiplier = 60; break; case 'h': multiplier = 60 * 60; break; case 'd': multiplier = 60 * 60 * 24; break; default: return 0; } *x *= multiplier; return 1; }
undefined8 apply_time_suffix(double *param_1, char param_2) { undefined8 uVar1; int local_c; if (param_2 == 's') { LAB_00100812: local_c = 1; LAB_0010083d: *param_1 = (double)local_c * *param_1; uVar1 = 1; } else { if (param_2 < 't') { if (param_2 == 'm') { local_c = 0x3c; goto LAB_0010083d; } if (param_2 < 'n') { if (param_2 == 'h') { local_c = 0xe10; goto LAB_0010083d; } if (param_2 < 'i') { if (param_2 == '\0') goto LAB_00100812; if (param_2 == 'd') { local_c = 0x15180; goto LAB_0010083d; } } } } uVar1 = 0; } return uVar1; }
coreutils
ghidra
static acl_t perms2acl(int perms) { char val[] = "user::---,group::---,other::---"; if (perms & 0400) val[6] = 'r'; if (perms & 0200) val[7] = 'w'; if (perms & 0100) val[8] = 'x'; if (perms & 0040) val[17] = 'r'; if (perms & 0020) val[18] = 'w'; if (perms & 0010) val[19] = 'x'; if (perms & 0004) val[28] = 'r'; if (perms & 0002) val[29] = 'w'; if (perms & 0001) val[30] = 'x'; return acl_from_text(val); }
int perms2acl(unsigned long a0) { unsigned long long v0; char v1; char v2; char v3; unsigned long long v4; char v5; char v6; char v7; unsigned long long v8; char v9; char v10; char v11; v0 = 3255322128360502133; v3 = 4210994773112597549; v4 = 7526763112770121018; v8 = 12716046225666661; if ((a0 & 0x100)) v1 = 114; if ((a0 & 128)) v2 = 119; if ((a0 & 64)) v3 = 120; if ((a0 & 32)) v5 = 114; if ((a0 & 16)) v6 = 119; if ((a0 & 8)) v7 = 120; if ((a0 & 4)) v9 = 114; if ((a0 & 2)) v10 = 119; if ((a0 & 1)) v11 = 120; return acl_from_text(&v0); }
tar
angr_phoenix
void e2fsck_read_bitmaps(e2fsck_t ctx) { ext2_filsys fs = ctx->fs; errcode_t retval; const char *old_op; unsigned int save_type; int flags; if (ctx->invalid_bitmaps) { com_err(ctx->program_name, 0, (gettext("e2fsck_read_bitmaps: illegal bitmap block(s) for %s")), ctx->device_name); fatal_error(ctx, 0); } old_op = ehandler_operation((gettext("reading inode and block bitmaps"))); e2fsck_set_bitmap_type(fs, 2, "fs_bitmaps", &save_type); flags = ctx->fs->flags; ctx->fs->flags |= 0x200000; retval = ext2fs_read_bitmaps(fs); ctx->fs->flags = (flags & 0x200000) | (ctx->fs->flags & ~0x200000); fs->default_bitmap_type = save_type; ehandler_operation(old_op); if (retval) { com_err(ctx->program_name, retval, (gettext("while retrying to read bitmaps for %s")), ctx->device_name); fatal_error(ctx, 0); } }
void e2fsck_read_bitmaps(long *param_1) { uint uVar1; long lVar2; long lVar3; undefined8 uVar4; long lVar5; long in_FS_OFFSET; undefined2 local_40; lVar2 = *(long *)(in_FS_OFFSET + 0x28); lVar3 = *param_1; if (*(int *)(param_1 + 0x41) != 0) { lVar5 = param_1[3]; uVar4 = gettext("e2fsck_read_bitmaps: illegal bitmap block(s) for %s"); com_err(param_1[1], 0, uVar4, lVar5); fatal_error(param_1, 0); } uVar4 = gettext("reading inode and block bitmaps"); uVar4 = ehandler_operation(uVar4); e2fsck_set_bitmap_type(lVar3, 2, "fs_bitmaps"); uVar1 = *(uint *)(*param_1 + 0x10); *(uint *)(*param_1 + 0x10) = *(uint *)(*param_1 + 0x10) | 0x200000; lVar5 = ext2fs_read_bitmaps(lVar3); *(uint *)(*param_1 + 0x10) = *(uint *)(*param_1 + 0x10) & 0xffdfffff | uVar1 & 0x200000; *(undefined2 *)(lVar3 + 0xc4) = local_40; ehandler_operation(uVar4); if (lVar5 != 0) { lVar3 = param_1[3]; uVar4 = gettext("while retrying to read bitmaps for %s"); com_err(param_1[1], lVar5, uVar4, lVar3); fatal_error(param_1, 0); } if (lVar2 != *(long *)(in_FS_OFFSET + 0x28)) { __stack_chk_fail(); } return; }
e2fsprogs-1.46.5
ghidra
int sh_mbsnlen(src, srclen, maxlen) const char *src; size_t srclen; int maxlen; { int count; int sind; mbstate_t state; memset(&state, '\0', sizeof(mbstate_t)); for (sind = count = 0; src[sind];) { count++; do { if (locale_mb_cur_max > 1) { mbstate_t state_bak; size_t mblength; int _f; _f = is_basic((src)[sind]); if (_f) mblength = 1; else if (locale_utf8locale && (((src)[sind] & 0x80) == 0)) mblength = (src)[sind] != 0; else { state_bak = state; mblength = mbrlen((src) + (sind), (srclen) - (sind), &state); } if (mblength == (size_t)-2 || mblength == (size_t)-1) { state = state_bak; (sind)++; } else if (mblength == 0) (sind)++; else (sind) += mblength; } else (sind)++; } while (0); if (sind > maxlen) break; } return count; }
int sh_mbsnlen(long param_1, long param_2, int param_3) { int iVar1; long in_FS_OFFSET; int local_34; int local_30; ulong local_28; mbstate_t local_20; mbstate_t local_18; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); memset(&local_20, 0, 8); local_34 = 0; local_30 = 0; do { if (*(char *)(param_1 + local_30) == '\0') break; local_34 = local_34 + 1; if (locale_mb_cur_max < 2) { local_30 = local_30 + 1; } else { iVar1 = is_basic((int)*(char *)(param_1 + local_30)); if (iVar1 == 0) { if ((locale_utf8locale == 0) || (*(char *)(param_1 + local_30) < '\0')) { local_18 = local_20; local_28 = mbrlen((char *)(local_30 + param_1), param_2 - local_30, &local_20); } else { local_28 = (ulong)(*(char *)(param_1 + local_30) != '\0'); } } else { local_28 = 1; } if ((local_28 == 0xfffffffffffffffe) || (local_28 == 0xffffffffffffffff)) { local_20 = local_18; local_30 = local_30 + 1; } else if (local_28 == 0) { local_30 = local_30 + 1; } else { local_30 = local_30 + (int)local_28; } } } while (local_30 <= param_3); if (local_10 == *(long *)(in_FS_OFFSET + 0x28)) { return local_34; } __stack_chk_fail(); }
bash
ghidra
|| *strsize == '\0' || (dhg->size = (int)strtonum(strsize, 0, 64*1024, &errstr)) == 0 || errstr) { sshlog("dh.c", __func__, 112, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "moduli:%d: invalid prime length", linenum); goto fail; }
void strtonum(void) { halt_baddata(); }
openssh-portable
ghidra
static inline void emit_mandatory_arg_note(void) { fputs_unlocked(gettext("\nMandatory arguments to long options are mandatory " "for short options too.\n"), stdout) ; }
int emit_mandatory_arg_note() { FILE *v0; char *v1; v0 = stdout; v1 = gettext("\nMandatory arguments to long options are mandatory for short " "options too.\n"); return fputs_unlocked(v1, v0); }
coreutils
ida
struct coproc *getcoprocbyname(name) const char *name; { return ((sh_coproc.c_name && ((sh_coproc.c_name)[0] == (name)[0] && strcmp(sh_coproc.c_name, name) == 0)) ? &sh_coproc : 0); }
char **getcoprocbyname(const char *a1) { if (sh_coproc && *sh_coproc == *a1 && !strcmp(sh_coproc, a1)) return &sh_coproc; else return 0LL; }
bash
ida
int main(int argc, char **argv) { uid_t ruid, euid; gid_t rgid, egid; long sys_ngroups; gid_t *groups; int ngroups; _Bool aflg = 0; struct passwd *pw; struct group *gr; (void)setlocale(6, ""); (void)bindtextdomain("shadow", "/usr/share/locale"); (void)textdomain("shadow"); sys_ngroups = sysconf(_SC_NGROUPS_MAX); groups = (gid_t *)malloc(sizeof(gid_t) * sys_ngroups); if (argc > 1) { if ((argc > 2) || (strcmp(argv[1], "-a") != 0)) { usage(); } else { aflg = 1; } } ruid = getuid(); euid = geteuid(); rgid = getgid(); egid = getegid(); pw = getpwuid(ruid); if (((void *)0) != pw) { (void)printf("UID=%lu(%s)", (unsigned long)ruid, pw->pw_name); } else { (void)printf("UID=%lu", (unsigned long)ruid); } gr = getgrgid(rgid); ; if (((void *)0) != gr) { (void)printf(" GID=%lu(%s)", (unsigned long)rgid, gr->gr_name); } else { (void)printf(" GID=%lu", (unsigned long)rgid); } if (ruid != euid) { pw = getpwuid(euid); if (((void *)0) != pw) { (void)printf(" EUID=%lu(%s)", (unsigned long)euid, pw->pw_name); } else { (void)printf(" EUID=%lu", (unsigned long)euid); } } if (rgid != egid) { gr = getgrgid(egid); if (((void *)0) != gr) { (void)printf(" EGID=%lu(%s)", (unsigned long)egid, gr->gr_name); } else { (void)printf(" EGID=%lu", (unsigned long)egid); } } if (aflg && (ngroups = getgroups(sys_ngroups, groups)) != -1) { int i; (void)puts(gettext(" groups=")); for (i = 0; i < ngroups; i++) { if (0 != i) (void)putchar(','); gr = getgrgid(groups[i]); if (((void *)0) != gr) { (void)printf("%lu(%s)", (unsigned long)groups[i], gr->gr_name); } else { (void)printf("%lu", (unsigned long)groups[i]); } } } free(groups); (void)putchar('\n'); return 0; }
int main(int argc, const char **argv, const char **envp) { char *v3; char v5; int i; __uid_t uid; __uid_t v8; __gid_t gid; __gid_t v10; int v11; long size; __gid_t *list; struct passwd *v14; struct passwd *v15; struct group *v16; struct group *v17; struct group *v18; v5 = 0; setlocale(6, &locale); bindtextdomain("shadow", "/usr/share/locale"); textdomain("shadow"); size = sysconf(3); list = (__gid_t *)malloc(4 * size); if (argc > 1) { if (argc > 2 || strcmp(argv[1], "-a")) usage(); v5 = 1; } uid = getuid(); v8 = geteuid(); gid = getgid(); v10 = getegid(); v14 = getpwuid(uid); if (v14) printf("UID=%lu(%s)", uid, v14->pw_name); else printf("UID=%lu", uid); v16 = getgrgid(gid); if (v16) printf(" GID=%lu(%s)", gid, v16->gr_name); else printf(" GID=%lu", gid); if (uid != v8) { v15 = getpwuid(v8); if (v15) printf(" EUID=%lu(%s)", v8, v15->pw_name); else printf(" EUID=%lu", v8); } if (gid != v10) { v17 = getgrgid(v10); if (v17) printf(" EGID=%lu(%s)", v10, v17->gr_name); else printf(" EGID=%lu", v10); } if (v5) { v11 = getgroups(size, list); if (v11 != -1) { v3 = gettext(" groups="); puts(v3); for (i = 0; i < v11; ++i) { if (i) putchar(44); v18 = getgrgid(list[i]); if (v18) printf("%lu(%s)", list[i], v18->gr_name); else printf("%lu", list[i]); } } } free(list); putchar(10); return 0; }
shadow
ida
int umac_delete(struct umac_ctx *ctx) { if (ctx) { if (16) ctx = (struct umac_ctx *)ctx->free_ptr; freezero(ctx, sizeof(*ctx) + 16); } return (1); }
long umac_delete(long a1) { if (a1) freezero(*(_QWORD *)(a1 + 1520), 1544LL); return 1LL; }
openssh-portable
ida
static _Bool parse_regex(const struct parser_table *entry, char **argv, int *arg_ptr) { return insert_regex(argv, arg_ptr, entry, options.regex_options); }
long parse_regex(long a1, long a2, int *a3, __m128i a4) { return insert_regex(a2, a3, a1, HIDWORD(options[11]), a4); }
findutils
ida
static int glob1(Char *pattern, Char *pattern_last, _ssh_compat_glob_t *pglob, struct glob_lim *limitp) { Char pathbuf[4096]; if (*pattern == '\0') return (0); return (glob2(pathbuf, pathbuf + 4096 - 1, pathbuf, pathbuf + 4096 - 1, pattern, pattern_last, pglob, limitp)); }
undefined8 glob1(short *param_1, undefined8 param_2, undefined8 param_3, undefined8 param_4) { undefined8 uVar1; long in_FS_OFFSET; undefined local_2018[8190]; undefined auStack26[10]; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); if (*param_1 == 0) { uVar1 = 0; } else { uVar1 = glob2(local_2018, auStack26, local_2018, auStack26, param_1, param_2, param_3, param_4); } if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) { __stack_chk_fail(); } return uVar1; }
openssh-portable
ghidra
int match_usergroup_pattern_list(const char *string, const char *pattern) { return match_pattern_list(string, pattern, 0); }
long long match_usergroup_pattern_list(unsigned long long a0, char *a1) { return match_pattern_list(a0, a1, 0x0); }
openssh-portable
angr_dream
void rl_reset_after_signal(void) { if (rl_prep_term_function) (*rl_prep_term_function)(_rl_meta_flag); rl_set_signals(); }
void rl_reset_after_signal(unsigned long a0, unsigned long long a1, unsigned long a2, unsigned long long a3) { unsigned long long v1; if (rl_prep_term_function) rl_prep_term_function(_rl_meta_flag); v1 = rl_set_signals(_rl_meta_flag, a1, rl_prep_term_function, a3); return; }
bash
angr_dream
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; }
uint ssh_packet_set_maxsize(long *param_1, uint param_2) { long lVar1; lVar1 = *param_1; if (*(int *)(lVar1 + 0x1e8) == 0) { if ((param_2 < 0x1000) || (0x100000 < param_2)) { sshlog("packet.c", "ssh_packet_set_maxsize", 0x843, 1, 3, 0, "bad size %d", param_2); param_2 = 0xffffffff; } else { *(undefined4 *)(lVar1 + 0x1e8) = 1; sshlog("packet.c", "ssh_packet_set_maxsize", 0x847, 1, 5, 0, "setting to %d", param_2); *(uint *)(lVar1 + 0x138) = param_2; } } else { sshlog("packet.c", "ssh_packet_set_maxsize", 0x83e, 1, 3, 0, "called twice: old %d new %d", *(undefined4 *)(lVar1 + 0x138), param_2); param_2 = 0xffffffff; } return param_2; }
openssh-portable
ghidra
static _Bool revert_tz(timezone_t tz) { if (tz == local_tz) return 1; else { int saved_errno = (*__errno_location()); _Bool ok = change_env(tz); if (!ok) saved_errno = (*__errno_location()); tzfree(tz); (*__errno_location()) = saved_errno; return ok; } }
char revert_tz(long param_1) { char cVar1; int *piVar2; int local_c; if (param_1 == 1) { cVar1 = '\x01'; } else { piVar2 = __errno_location(); local_c = *piVar2; cVar1 = change_env(param_1); if (cVar1 != '\x01') { piVar2 = __errno_location(); local_c = *piVar2; } tzfree(param_1); piVar2 = __errno_location(); *piVar2 = local_c; } return cVar1; }
gnutls
ghidra
static inline struct ext2_inode * EXT2_INODE(struct ext2_inode_large *large_inode) { return (struct ext2_inode *)large_inode; }
int EXT2_INODE(unsigned long a0) { return a0; }
e2fsprogs-1.46.5
angr_dream
int el_cursor(EditLine *el, int n) { if (n == 0) goto out; el->el_line.cursor += n; if (el->el_line.cursor < el->el_line.buffer) el->el_line.cursor = el->el_line.buffer; if (el->el_line.cursor > el->el_line.lastchar) el->el_line.cursor = el->el_line.lastchar; out: return (int)(el->el_line.cursor - el->el_line.buffer); }
long long el_cursor(unsigned long long a0[13], unsigned long a1) { if (a1) { a0[11] = a1 * 4 + a0[11]; if (a0[11] < a0[10]) a0[11] = a0[10]; if (a0[11] > a0[12]) a0[11] = a0[12]; } return a0[11] - a0[10] >> 2; }
libedit
angr_dream
void exitshell(void) { struct jmploc loc; char *p; savestatus = exitstatus; ; if (_setjmp(loc.loc)) goto out; handler = &loc; if ((p = trap[0])) { trap[0] = ((void *)0); evalskip = 0; evalstring(p, 0); evalskip = (1 << 3); } out: exitreset(); if (__builtin_expect(!!(!_setjmp(loc.loc)), 1)) setjobctl(0); flushall(); _exit(exitstatus); }
void exitshell(void) { long lVar1; int iVar2; long in_FS_OFFSET; __jmp_buf_tag local_d8; undefined8 local_10; local_10 = *(undefined8 *)(in_FS_OFFSET + 0x28); savestatus = exitstatus; iVar2 = _setjmp(&local_d8); lVar1 = trap._0_8_; if ((iVar2 == 0) && (_handler = &local_d8, trap._0_8_ != 0)) { trap._0_8_ = 0; evalskip = 0; evalstring(lVar1, 0); evalskip = 8; } exitreset(); iVar2 = _setjmp(&local_d8); if (iVar2 == 0) { setjobctl(); } flushall(); _exit(exitstatus); }
dash-0.5.11+git20210903+057cd650a4ed
ghidra
) { fprintf(stderr, "%s not set, cannot kill agent\n", "SSH_AGENT_PID"); exit(1); }
int fprintf(FILE *__stream, char *__format, ...) { halt_baddata(); }
openssh-portable
ghidra
static unsigned syncsearch(have, buf, len) unsigned *have; const unsigned char *buf; unsigned len; { unsigned got; unsigned next; got = *have; next = 0; while (next < len && got < 4) { if ((int)(buf[next]) == (got < 2 ? 0 : 0xff)) got++; else if (buf[next]) got = 0; else got = 4 - got; next++; } *have = got; return next; }
long syncsearch(unsigned int *a1, long a2, unsigned int a3) { int v3; unsigned int v6; unsigned int i; v6 = *a1; for (i = 0; i < a3 && v6 <= 3; ++i) { if (v6 > 1) v3 = 255; else v3 = 0; if (v3 == *(unsigned char *)(i + a2)) { ++v6; } else if (*(_BYTE *)(i + a2)) { v6 = 0; } else { v6 = 4 - v6; } } *a1 = v6; return i; }
zlib
ida
static void retop(struct bitmap *b) { if (b->top >= b->len) return; while (b->top > 0 && b->d[b->top] == 0) b->top--; }
unsigned long retop(_QWORD *a1) { unsigned long result; result = a1[1]; if (a1[2] < result) { while (1) { result = a1[2]; if (!result) break; result = *(unsigned int *)(*a1 + 4LL * a1[2]); if ((_DWORD)result) break; --a1[2]; } } return result; }
openssh-portable
ida
void rl_tty_unset_default_bindings(Keymap kmap) { if ((rl_readline_state & (0x0040000)) == 0) return; if (_rl_tty_chars.t_erase != (unsigned char)'\0' && kmap[_rl_tty_chars.t_erase].type == 0) kmap[_rl_tty_chars.t_erase].function = rl_insert; ; if (_rl_tty_chars.t_kill != (unsigned char)'\0' && kmap[_rl_tty_chars.t_kill].type == 0) kmap[_rl_tty_chars.t_kill].function = rl_insert; ; if (_rl_tty_chars.t_lnext != (unsigned char)'\0' && kmap[_rl_tty_chars.t_lnext].type == 0) kmap[_rl_tty_chars.t_lnext].function = rl_insert; ; if (_rl_tty_chars.t_werase != (unsigned char)'\0' && kmap[_rl_tty_chars.t_werase].type == 0) kmap[_rl_tty_chars.t_werase].function = rl_insert; ; }
void rl_tty_unset_default_bindings(char *a0) { unsigned long long v1; unsigned long long v2; unsigned long long v3; unsigned long long v4; v1 = rl_readline_state & 0x40000; if ((rl_readline_state & 0x40000)) { if (g_400e13 && !a0[16 * g_400e13]) *(&a0[8 + 16 * g_400e13]) = got.rl_insert; if (g_400e15 && !a0[16 * g_400e15]) *(&a0[8 + 16 * g_400e15]) = got.rl_insert; if (g_400e1d && !a0[16 * g_400e1d]) *(&a0[8 + 16 * g_400e1d]) = got.rl_insert; v2 = g_400e14; if (g_400e14) { v3 = a0[16 * g_400e14]; if (!a0[16 * g_400e14]) { v4 = &a0[16 * g_400e14]; *(&a0[8 + 16 * g_400e14]) = got.rl_insert; } } } return; }
bash
angr_dream
char *filename_completion_function(const char *name, int state) { return fn_filename_completion_function(name, state); }
void filename_completion_function(undefined8 param_1, undefined4 param_2) { fn_filename_completion_function(param_1, param_2); return; }
libedit
ghidra
struct ssh *ssh_packet_set_connection(struct ssh *ssh, int fd_in, int fd_out) { struct session_state *state; const struct sshcipher *none = cipher_by_name("none"); int r; if (none == ((void *)0)) { sshlog("packet.c", __func__, 300, 1, SYSLOG_LEVEL_ERROR, ((void *)0), "cannot load cipher 'none'"); return ((void *)0); } if (ssh == ((void *)0)) ssh = ssh_alloc_session_state(); if (ssh == ((void *)0)) { sshlog("packet.c", __func__, 306, 1, SYSLOG_LEVEL_ERROR, ((void *)0), "could not allocate state"); return ((void *)0); } state = ssh->state; state->connection_in = fd_in; state->connection_out = fd_out; if ((r = cipher_init(&state->send_context, none, (const u_char *)"", 0, ((void *)0), 0, 1)) != 0 || (r = cipher_init(&state->receive_context, none, (const u_char *)"", 0, ((void *)0), 0, 0)) != 0) { sshlog("packet.c", __func__, 316, 1, SYSLOG_LEVEL_ERROR, ssh_err(r), "cipher_init failed"); free(ssh); return ((void *)0); } state->newkeys[MODE_IN] = state->newkeys[MODE_OUT] = ((void *)0); (void)ssh_remote_ipaddr(ssh); return ssh; }
long *ssh_packet_set_connection(long *param_1, undefined4 param_2, undefined4 param_3) { undefined4 *puVar1; long lVar2; undefined8 uVar3; undefined8 uVar4; long *local_30; int local_1c; uVar3 = 0x100309; lVar2 = cipher_by_name(&DAT_00107020); if (lVar2 == 0) { sshlog("packet.c", "ssh_packet_set_connection", 300, 1, 2, 0, "cannot load cipher \'none\'"); } else { local_30 = param_1; if (param_1 == (long *)0x0) { uVar3 = 0x100368; local_30 = (long *)ssh_alloc_session_state(); } if (local_30 == (long *)0x0) { sshlog("packet.c", "ssh_packet_set_connection", 0x132, 1, 2, 0, "could not allocate state"); } else { puVar1 = (undefined4 *)*local_30; *puVar1 = param_2; puVar1[1] = param_3; local_1c = cipher_init(puVar1 + 6, lVar2, &DAT_00107061, 0, 0, 0, 1, uVar3); if ((local_1c == 0) && (local_1c = cipher_init(puVar1 + 4, lVar2, &DAT_00107061, 0, 0, 0, 0, uVar3), local_1c == 0)) { *(undefined8 *)(puVar1 + 0x58) = 0; *(undefined8 *)(puVar1 + 0x56) = *(undefined8 *)(puVar1 + 0x58); ssh_remote_ipaddr(local_30); return local_30; } uVar4 = 0x100461; uVar3 = ssh_err(local_1c); sshlog("packet.c", "ssh_packet_set_connection", 0x13c, 1, 2, uVar3, "cipher_init failed", uVar4); free(local_30); } } return (long *)0x0; }
openssh-portable
ghidra
int do_netns(int argc, char **argv) { netns_nsid_socket_init(); if (argc < 1) { netns_map_init(); return netns_list(0, ((void *)0)); } if (!do_all && argc > 1 && invalid_name(argv[1])) { fprintf(stderr, "Invalid netns name \"%s\"\n", argv[1]); exit(-1); } if ((matches(*argv, "list") == 0) || (matches(*argv, "show") == 0) || (matches(*argv, "lst") == 0)) { netns_map_init(); return netns_list(argc - 1, argv + 1); } if ((matches(*argv, "list-id") == 0)) { netns_map_init(); return netns_list_id(argc - 1, argv + 1); } if (matches(*argv, "help") == 0) return usage(); if (matches(*argv, "add") == 0) return netns_add(argc - 1, argv + 1, 1); if (matches(*argv, "set") == 0) return netns_set(argc - 1, argv + 1); if (matches(*argv, "delete") == 0) return netns_delete(argc - 1, argv + 1); if (matches(*argv, "identify") == 0) return netns_identify(argc - 1, argv + 1); if (matches(*argv, "pids") == 0) return netns_pids(argc - 1, argv + 1); if (matches(*argv, "exec") == 0) return netns_exec(argc - 1, argv + 1); if (matches(*argv, "monitor") == 0) return netns_monitor(argc - 1, argv + 1); if (matches(*argv, "attach") == 0) return netns_add(argc - 1, argv + 1, 0); fprintf(stderr, "Command \"%s\" is unknown, try \"ip netns help\".\n", *argv); exit(-1); }
long long do_netns(unsigned long a0, unsigned long long a1[2], unsigned int a2, unsigned int a3, unsigned long long a4, unsigned long long a5) { unsigned long long v1; netns_nsid_socket_init(); if (a0 <= 0) { netns_map_init(); v1 = netns_list(0x0, 0x0, a2, a3, a4, a5); return v1; } if ((do_all ^ 1) && a0 > 1 && invalid_name(a1[1])) { fprintf(*(&stderr), "Invalid netns name \"%s\"\n", a1[1]); exit(0xffffffff); } if (!(matches(a1[0], "list") ^ 1) && !(matches(a1[0], "show") ^ 1) && !(matches(a1[0], "lst") ^ 1)) { if ((matches(a1[0], "list-id") ^ 1)) { netns_map_init(); v1 = netns_list_id(a0 - 1, &a1[1], &a1[1], a3, a4, a5); return v1; } else if ((matches(a1[0], "help") ^ 1)) { usage(); } else if ((matches(a1[0], "add") ^ 1)) { v1 = netns_add(a0 - 1, &a1[1], 0x1); return v1; } else if ((matches(a1[0], "set") ^ 1)) { v1 = netns_set(a0 - 1, &a1[1]); return v1; } else if ((matches(a1[0], "delete") ^ 1)) { v1 = netns_delete(a0 - 1, &a1[1]); return v1; } else if ((matches(a1[0], "identify") ^ 1)) { v1 = netns_identify(a0 - 1, &a1[1]); return v1; } else if ((matches(a1[0], "pids") ^ 1)) { v1 = netns_pids(a0 - 1, &a1[1]); return v1; } else if ((matches(a1[0], "exec") ^ 1)) { v1 = netns_exec(a0 - 1, &a1[1]); return v1; } else if ((matches(a1[0], "monitor") ^ 1)) { v1 = netns_monitor(a0 - 1, &a1[1]); return v1; } else if (!(matches(a1[0], "attach") ^ 1)) { fprintf(*(&stderr), "Command \"%s\" is unknown, try \"ip netns help\".\n", a1[0]); exit(0xffffffff); } else { v1 = netns_add(a0 - 1, &a1[1], 0x0); return v1; } } netns_map_init(); v1 = netns_list(a0 - 1, &a1[1], &a1[1], a3, a4, a5); return v1; }
iproute2-6.0.0
angr_sailr
static int netns_add(int argc, char **argv, _Bool create) { char netns_path[4096], proc_path[4096]; const char *name; pid_t pid; int fd; int lock; int made_netns_run_dir_mount = 0; if (create) { if (argc < 1) { fprintf(stderr, "No netns name specified\n"); return -1; } } else { if (argc < 2) { fprintf(stderr, "No netns name and PID specified\n"); return -1; } if (get_s32(&pid, argv[1], 0) || !pid) { fprintf(stderr, "Invalid PID: %s\n", argv[1]); return -1; } } name = argv[0]; snprintf(netns_path, sizeof(netns_path), "%s/%s", "/var/run/netns", name); if (create_netns_dir()) return -1; lock = open("/var/run/netns", 00 | 0200000, 0); if (lock < 0) { fprintf(stderr, "Cannot open netns runtime directory \"%s\": %s\n", "/var/run/netns", strerror((*__errno_location()))); return -1; } if (flock(lock, 2) < 0) { fprintf(stderr, "Warning: could not flock netns runtime directory \"%s\": %s\n", "/var/run/netns", strerror((*__errno_location()))); close(lock); lock = -1; } while (mount("", "/var/run/netns", "none", MS_SHARED | MS_REC, ((void *)0))) { if ((*__errno_location()) != 22 || made_netns_run_dir_mount) { fprintf(stderr, "mount --make-shared %s failed: %s\n", "/var/run/netns", strerror((*__errno_location()))); if (lock != -1) { flock(lock, 8); close(lock); } return -1; } if (mount("/var/run/netns", "/var/run/netns", "none", MS_BIND | MS_REC, ((void *)0))) { fprintf(stderr, "mount --bind %s %s failed: %s\n", "/var/run/netns", "/var/run/netns", strerror((*__errno_location()))); if (lock != -1) { flock(lock, 8); close(lock); } return -1; } made_netns_run_dir_mount = 1; } if (lock != -1) { flock(lock, 8); close(lock); } fd = open(netns_path, 00 | 0100 | 0200, 0); if (fd < 0) { fprintf(stderr, "Cannot create namespace file \"%s\": %s\n", netns_path, strerror((*__errno_location()))); return -1; } close(fd); if (create) { netns_save(); if (unshare(0x40000000) < 0) { fprintf(stderr, "Failed to create a new network namespace \"%s\": %s\n", name, strerror((*__errno_location()))); goto out_delete; } strcpy(proc_path, "/proc/self/ns/net"); } else { snprintf(proc_path, sizeof(proc_path), "/proc/%d/ns/net", pid); } if (mount(proc_path, netns_path, "none", MS_BIND, ((void *)0)) < 0) { fprintf(stderr, "Bind %s -> %s failed: %s\n", proc_path, netns_path, strerror((*__errno_location()))); goto out_delete; } netns_restore(); return 0; out_delete: if (create) { netns_restore(); netns_delete(argc, argv); } else if (unlink(netns_path) < 0) { fprintf(stderr, "Cannot remove namespace file \"%s\": %s\n", netns_path, strerror((*__errno_location()))); } return -1; }
void netns_add(unsigned long a0, unsigned long long a1[2], unsigned long a2) { char v0; unsigned int v1; unsigned int v2; unsigned int v3; unsigned long v4; char v5; unsigned long long v6; char v7; unsigned long long v8; unsigned long long v10; unsigned long long v11; unsigned long long v12; unsigned long long v13; unsigned long long v14; unsigned int v16; unsigned long long v17; unsigned long long v18; unsigned long long v19; void *v20; unsigned long long v21; v8 = *(&v8); v6 = *(&v6); v2 = 0; if (a2) { if (a0 <= 0) { fprintf(*(&stderr), "No netns name specified\n"); v11 = 4294967295; return; } } else { if (a0 <= 1) { fprintf(*(&stderr), "No netns name and PID specified\n"); v10 = 4294967295; return; } else if (!(!get_s32(&v0, a1[1], 0x0, a1[1])) || !(*(&v0))) { fprintf(*(&stderr), "Invalid PID: %s\n", a1[1]); v12 = 4294967295; return; } } v4 = a1[0]; snprintf(&v5, 0x1000, "%s/%s", &g_40385e, v4); if (create_netns_dir()) { v13 = 4294967295; return; } v1 = open64("/var/run/netns", 0x10000, 0x0); if (v1 < 0) { fprintf(*(&stderr), "Cannot open netns runtime directory \"%s\": %s\n", &g_40385e, strerror(*(__errno_location()))); v14 = 4294967295; return; } if (flock(v1, 0x2) < 0) { fprintf(*(&stderr), "Warning: could not flock netns runtime directory \"%s\": %s\n", &g_40385e, strerror(*(__errno_location()))); close(v1); v1 = -1; } for (; mount(&g_403ca7, "/var/run/netns", "none", 0x104000, NULL); v2 = 1) { if (!(*(__errno_location()) == 22) || !(!v2)) { fprintf(*(&stderr), "mount --make-shared %s failed: %s\n", &g_40385e, strerror(*(__errno_location()))); if (v1 != -1) { flock(v1, 0x8); close(v1); } v17 = 4294967295; return; } if (mount("/var/run/netns", "/var/run/netns", "none", 0x5000, NULL)) { fprintf(*(&stderr), "mount --bind %s %s failed: %s\n", &g_40385e, &g_40385e, strerror(*(__errno_location()))); if (v1 != -1) { flock(v1, 0x8); close(v1); } v18 = 4294967295; return; } } if (v1 != -1) { flock(v1, 0x8); close(v1); } v16 = 192; v3 = open64(&v5, 0xc0, 0x0); if (v3 < 0) { fprintf(*(&stderr), "Cannot create namespace file \"%s\": %s\n", &v5, strerror(*(__errno_location()))); v19 = 4294967295; return; } close(v3); if (!a2) { snprintf(&v7, 0x1000, "/proc/%d/ns/net", *(&v0)); } else { netns_save(v3, reg_64, 64 CONCAT 0); if (unshare(0x40000000) < 0) { fprintf(*(&stderr), "Failed to create a new network namespace \"%s\": %s\n", v4, strerror(*(__errno_location()))); goto LABEL_402309; } else { strcpy(&v7, "/proc/self/ns/net"); } } if (mount(&v7, &v5, "none", 0x1000, NULL) >= 0) { netns_restore(); v20 = 0; return; } fprintf(*(&stderr), "Bind %s -> %s failed: %s\n", &v7, &v5, strerror(*(__errno_location()))); LABEL_402309: if (a2) { netns_restore(); netns_delete(a0, a1); } else if (unlink(&v5) < 0) { fprintf(*(&stderr), "Cannot remove namespace file \"%s\": %s\n", &v5, strerror(*(__errno_location()))); } v21 = 4294967295; return; }
iproute2-6.0.0
angr_sailr
void platform_pledge_mux(void) {}
void platform_pledge_mux(void) { return; }
openssh-portable
ghidra
static void process_flags(int argc, char **argv) { int c; static struct option long_options[] = { {"append", 0, ((void *)0), 'a'}, {"gid", 1, ((void *)0), 'g'}, {"help", 0, ((void *)0), 'h'}, {"new-name", 1, ((void *)0), 'n'}, {"non-unique", 0, ((void *)0), 'o'}, {"password", 1, ((void *)0), 'p'}, {"root", 1, ((void *)0), 'R'}, {"prefix", 1, ((void *)0), 'P'}, {"users", 1, ((void *)0), 'U'}, {((void *)0), 0, ((void *)0), '\0'}}; while ((c = getopt_long(argc, argv, "ag:hn:op:R:P:U:", long_options, ((void *)0))) != -1) { switch (c) { case 'a': aflg = 1; break; case 'g': gflg = 1; if ((get_gid(optarg, &group_newid) == 0) || (group_newid == (gid_t)-1)) { fprintf(stderr, gettext("%s: invalid group ID '%s'\n"), Prog, optarg); exit(3); } break; case 'h': usage(0); break; case 'n': nflg = 1; group_newname = optarg; break; case 'o': oflg = 1; break; case 'p': group_passwd = optarg; pflg = 1; break; case 'R': break; case 'P': break; case 'U': user_list = optarg; break; default: usage(2); } } if (oflg && !gflg) { usage(2); } if (optind != (argc - 1)) { usage(2); } group_name = argv[argc - 1]; }
void process_flags(int param_1, long param_2) { undefined8 uVar1; undefined8 uVar2; int iVar3; char *__format; do { iVar3 = getopt_long(param_1, param_2, "ag:hn:op:R:P:U:", long_options_5835, 0); if (iVar3 == -1) { if ((oflg != '\0') && (gflg != '\x01')) { usage(2); } if (param_1 + -1 != optind) { usage(2); } group_name = *(undefined8 *)(param_2 + (long)param_1 * 8 + -8); return; } switch (iVar3) { case 0x50: case 0x52: break; default: usage(); break; case 0x55: user_list = optarg; break; case 0x61: aflg = 1; break; case 0x67: gflg = '\x01'; iVar3 = get_gid(optarg, &group_newid); uVar2 = optarg; uVar1 = Prog; if ((iVar3 == 0) || (group_newid == -1)) { __format = (char *)gettext("%s: invalid group ID \'%s\'\n"); fprintf(stderr, __format, uVar1, uVar2); exit(3); } break; case 0x68: usage(); break; case 0x6e: nflg = 1; group_newname = optarg; break; case 0x6f: oflg = '\x01'; break; case 0x70: group_passwd = optarg; pflg = 1; } } while (true); }
shadow
ghidra
static void pkg_remove_backup_files(struct pkginfo *pkg, struct fsys_namenode_list *newfileslist) { struct fsys_namenode_list *cfile; for (cfile = newfileslist; cfile; cfile = cfile->next) { struct fsys_namenode *usenode; if (cfile->namenode->flags & FNNF_NEW_CONFF) continue; usenode = namenodetouse(cfile->namenode, pkg, &pkg->installed); if (strcmp(usenode->name, "/.") == 0) continue; varbuf_rollback(&fnametmpvb, &fname_state); varbuf_add_buf(&fnametmpvb, usenode->name, strlen(usenode->name)); varbuf_add_buf(&fnametmpvb, ".dpkg-tmp", strlen(".dpkg-tmp")); varbuf_end_str(&fnametmpvb); path_remove_tree(fnametmpvb.buf); } }
void pkg_remove_backup_files(unsigned long long a0, unsigned long long a1) { struct_1 *v0; struct_0 *v1; unsigned long long v3; unsigned long long v5; unsigned long long v6; unsigned long long v7; v3 = a1; for (v0 = a1; v0; v0 = v0->field_0) { if (!(v0->field_8->field_30 & 1)) { v1 = namenodetouse(v0->field_8, a0, a0 + 72, a0); if (strcmp(v1->field_8, "/.")) { varbuf_rollback(0x5003a8, 0x5002e8, v5); varbuf_add_buf(0x5003a8, v1->field_8, strlen(v1->field_8), v6); varbuf_add_buf(0x5003a8, ".dpkg-tmp", strlen(".dpkg-tmp"), v6); varbuf_end_str(0x5003a8); path_remove_tree(cleanup_pkg_failed); } } v7 = v0->field_0; } return; }
dpkg
angr_dream
static int history_save(HistoryW *h, const char *fname) { FILE *fp; int i; if ((fp = fopen(fname, "w")) == ((void *)0)) return -1; i = history_save_fp(h, (size_t)-1, fp); (void)fclose(fp); return i; }
undefined4 history_save(undefined8 param_1, char *param_2) { undefined4 uVar1; FILE *__stream; __stream = fopen(param_2, "w"); if (__stream == (FILE *)0x0) { uVar1 = 0xffffffff; } else { uVar1 = history_save_fp(param_1, 0xffffffffffffffff, __stream); fclose(__stream); } return uVar1; }
libedit
ghidra
static void dump_cfg_int(ServerOpCodes code, int val) { printf("%s %d\n", lookup_opcode_name(code), val); }
void dump_cfg_int(unsigned long a0, unsigned long a1) { unsigned long long v1; v1 = printf("%s %d\n", lookup_opcode_name(a0), a1); return; }
openssh-portable
angr_dream
int sshkey_read(struct sshkey *ret, char **cpp) { struct sshkey *k; char *cp, *blobcopy; size_t space; int r, type, curve_nid = -1; struct sshbuf *blob; if (ret == ((void *)0)) return -10; switch (ret->type) { case KEY_UNSPEC: case KEY_RSA: case KEY_DSA: case KEY_ECDSA: case KEY_ECDSA_SK: case KEY_ED25519: case KEY_ED25519_SK: case KEY_DSA_CERT: case KEY_ECDSA_CERT: case KEY_ECDSA_SK_CERT: case KEY_RSA_CERT: case KEY_ED25519_CERT: case KEY_ED25519_SK_CERT: break; default: return -10; } cp = *cpp; space = strcspn(cp, " \t"); if (space == strlen(cp)) return -4; if ((type = peek_type_nid(cp, space, &curve_nid)) == KEY_UNSPEC) return -4; for (cp += space; *cp == ' ' || *cp == '\t'; cp++) ; if (*cp == '\0') return -4; if (ret->type != KEY_UNSPEC && ret->type != type) return -13; if ((blob = sshbuf_new()) == ((void *)0)) return -2; space = strcspn(cp, " \t"); if ((blobcopy = strndup(cp, space)) == ((void *)0)) { sshbuf_free(blob); return -2; } if ((r = sshbuf_b64tod(blob, blobcopy)) != 0) { free(blobcopy); sshbuf_free(blob); return r; } free(blobcopy); if ((r = sshkey_fromb(blob, &k)) != 0) { sshbuf_free(blob); return r; } sshbuf_free(blob); for (cp += space; *cp == ' ' || *cp == '\t'; cp++) ; if (k->type != type) { sshkey_free(k); return -13; } if (key_type_is_ecdsa_variant(type) && curve_nid != k->ecdsa_nid) { sshkey_free(k); return -15; } ret->type = type; if (sshkey_is_cert(ret)) { if (!sshkey_is_cert(k)) { sshkey_free(k); return -16; } if (ret->cert != ((void *)0)) cert_free(ret->cert); ret->cert = k->cert; k->cert = ((void *)0); } switch (sshkey_type_plain(ret->type)) { case KEY_RSA: RSA_free(ret->rsa); ret->rsa = k->rsa; k->rsa = ((void *)0); break; case KEY_DSA: DSA_free(ret->dsa); ret->dsa = k->dsa; k->dsa = ((void *)0); break; case KEY_ECDSA: EC_KEY_free(ret->ecdsa); ret->ecdsa = k->ecdsa; ret->ecdsa_nid = k->ecdsa_nid; k->ecdsa = ((void *)0); k->ecdsa_nid = -1; break; case KEY_ECDSA_SK: EC_KEY_free(ret->ecdsa); ret->ecdsa = k->ecdsa; ret->ecdsa_nid = k->ecdsa_nid; ret->sk_application = k->sk_application; k->ecdsa = ((void *)0); k->ecdsa_nid = -1; k->sk_application = ((void *)0); break; case KEY_ED25519: freezero(ret->ed25519_pk, 32U); ret->ed25519_pk = k->ed25519_pk; k->ed25519_pk = ((void *)0); break; case KEY_ED25519_SK: freezero(ret->ed25519_pk, 32U); ret->ed25519_pk = k->ed25519_pk; ret->sk_application = k->sk_application; k->ed25519_pk = ((void *)0); k->sk_application = ((void *)0); break; default: sshkey_free(k); return -1; } sshkey_free(k); *cpp = cp; return 0; }
long long sshkey_read(struct_0 *a0, unsigned long long *a1) { unsigned int v0; unsigned int v1; unsigned int v2; char v3; char *v4; unsigned long v5; unsigned long long v6; void *v7; unsigned long long v9; unsigned long long v11; unsigned long long v12; unsigned long long v13; struct_1 *v14; unsigned long long v15; v0 = -1; if (!a0) { v9 = 4294967286; } else { if (a0->field_0 < 0 && a0->field_0 <= 7 || a0->field_0 - 10 > 4 && a0->field_0 > 7) v9 = 4294967286; if (a0->field_0 - 10 <= 4 && a0->field_0 > 7 || a0->field_0 <= 7 && a0->field_0 >= 0) { v4 = *(a1); v5 = strcspn(v4, " \t"); if (v5 == strlen(v4)) { v9 = 0xfffffffc; } else { v1 = peek_type_nid(v4, v5, &v0); if (v1 == 14) { v9 = 0xfffffffc; } else { v4 = v4 + v5; while (true) { if (*(v4) != 32) { if (*(v4) != 9) break; } v4 += 1; } if (!*(v4)) { v9 = 0xfffffffc; } else { if (a0->field_0 != 14 && v1 != a0->field_0) v9 = 4294967283; if (a0->field_0 == 14 || v1 == a0->field_0) { v6 = sshbuf_new(); if (!v6) { v9 = 4294967294; } else { *(&v5) = strcspn(v4, " \t"); v7 = strndup(v4, *(&v5)); if (!v7) { sshbuf_free(v6); v9 = 4294967294; } else { v2 = sshbuf_b64tod(v6, v7, v7); if (v2) { free(v7); sshbuf_free(v6); v9 = v2; } else { free(v7); v2 = sshkey_fromb(v6, &v3); if (v2) { sshbuf_free(v6); v9 = v2; } else { sshbuf_free(v6); v4 = v4 + v5; while (true) { if (*(v4) != 32) { if (*(v4) != 9) break; } v4 += 1; } if (v1 != *(*(&v3))) { sshkey_free(*(&v3)); v9 = 4294967283; } else { v11 = key_type_is_ecdsa_variant(v1); if (v11 && *((*(&v3) + 24)) != v0) { sshkey_free(*(&v3)); v9 = 4294967281; } if (!v11 || *((*(&v3) + 24)) == v0) { a0->field_0 = v1; v12 = sshkey_is_cert(a0); if (v12) { v13 = sshkey_is_cert(*(&v3)); if (!v13) { sshkey_free(*(&v3)); v9 = 0xfffffff0; } else { if (a0->field_80) cert_free(a0->field_80); a0->field_80 = *((*(&v3) + 128)); *((*(&v3) + 128)) = 0; } } if (!v12 || v13) { v14 = sshkey_type_plain(a0->field_0); switch (v14) { case 0: RSA_free(a0->field_8); a0->field_8 = *((*(&v3) + 8)); *((*(&v3) + 8)) = 0; break; case 1: DSA_free(a0->field_10); a0->field_10 = *((*(&v3) + 16)); *((*(&v3) + 16)) = 0; break; case 2: EC_KEY_free(a0->field_20); a0->field_20 = *((*(&v3) + 32)); a0->field_18 = *((*(&v3) + 24)); *((*(&v3) + 32)) = 0; *((*(&v3) + 24)) = -1; break; case 3: freezero(a0->field_30, 0x20); a0->field_30 = *((*(&v3) + 48)); *((*(&v3) + 48)) = 0; break; case 10: EC_KEY_free(a0->field_20); a0->field_20 = *((*(&v3) + 32)); a0->field_18 = *((*(&v3) + 24)); a0->field_60 = *((*(&v3) + 96)); *((*(&v3) + 32)) = 0; *((*(&v3) + 24)) = -1; *((*(&v3) + 96)) = 0; break; sshkey_free(*(&v3)); *(a1) = v4; v9 = 0; case 12: freezero(a0->field_30, 0x20); a0->field_30 = *((*(&v3) + 48)); a0->field_60 = *((*(&v3) + 96)); *((*(&v3) + 48)) = 0; *((*(&v3) + 96)) = 0; break; default: sshkey_free(*(&v3)); v9 = 4294967295; } if (v14 <= 12) v15 = *((0x4 * &v14->padding_0[0] + &g_40c114)) + &g_40c114; } } } } } } } } } } } } } return v9; }
openssh-portable
angr_dream
static inline void statx_to_stat(struct statx *stx, struct stat *stat) { stat->st_dev = gnu_dev_makedev(stx->stx_dev_major, stx->stx_dev_minor); stat->st_ino = stx->stx_ino; stat->st_mode = stx->stx_mode; stat->st_nlink = stx->stx_nlink; stat->st_uid = stx->stx_uid; stat->st_gid = stx->stx_gid; stat->st_rdev = gnu_dev_makedev(stx->stx_rdev_major, stx->stx_rdev_minor); stat->st_size = stx->stx_size; stat->st_blksize = stx->stx_blksize; stat->st_blocks = stx->stx_blocks; stat->st_atim = statx_timestamp_to_timespec(stx->stx_atime); stat->st_mtim = statx_timestamp_to_timespec(stx->stx_mtime); stat->st_ctim = statx_timestamp_to_timespec(stx->stx_ctime); }
void statx_to_stat(struct_1 *a0, struct_0 *a1) { struct_3 *v1; unsigned long v2; struct_0 *v3; struct_2 *v4; a1->field_0 = gnu_dev_makedev(a0->field_88, a0->field_8c, a0->field_8c); a1->field_8 = a0->field_20; a1->field_18 = a0->field_1c; a1->field_10 = a0->field_10; a1->field_1c = a0->field_14; a1->field_20 = a0->field_18; a1->field_28 = gnu_dev_makedev(a0->field_80, a0->field_84, a0->field_84); a1->field_30 = a0->field_28; a1->field_38 = a0->field_4; a1->field_40 = a0->field_30; v1 = a1; v1->field_48 = statx_timestamp_to_timespec(a0->field_40, a0->field_48); v1->field_50 = v2; v3 = a1; v3->field_58 = statx_timestamp_to_timespec(a0->field_70, a0->field_78); v3->field_60 = v2; v4 = a1; *(&v4->field_68) = statx_timestamp_to_timespec(a0->field_60, a0->field_68); v4->field_70 = v2; return; }
coreutils
angr_sailr
static void Round(Fq *out, const Fq *a) { int i; for (i = 0; i < 761; ++i) out[i] = a[i] - F3_freeze(a[i]); }
void Round(long a1, long a2) { short v2; int i; for (i = 0; i <= 760; ++i) { v2 = *(_WORD *)(2LL * i + a2); *(_WORD *)(2LL * i + a1) = v2 - (char)F3_freeze(v2); } }
openssh-portable
ida
static void kwsmusts(struct dfa_comp *dc) { struct dfamust *dm = dfamust(dc->dfa); if (!dm) return; dc->kwset = kwsinit(0); if (dm->exact) { ++dc->kwset_exact_matches; idx_t old_len = strlen(dm->must); idx_t new_len = old_len + dm->begline + dm->endline; char *must = ximalloc(new_len); char *mp = must; *mp = eolbyte; mp += dm->begline; dc->begline |= dm->begline; memcpy(mp, dm->must, old_len); if (dm->endline) mp[old_len] = eolbyte; kwsincr(dc->kwset, must, new_len); free(must); } else { kwsincr(dc->kwset, dm->must, strlen(dm->must)); } kwsprep(dc->kwset); dfamustfree(dm); }
void kwsmusts(struct_0 *a0) { char v0[3]; char *v1; unsigned long long v2; void *v3; char *v4; unsigned long long v7; *(&v0) = dfamust(a0->field_8); if (v0) { a0->field_0 = kwsinit(0x0); if (v0[0]) { a0->field_38 = a0->field_38 + 1; v1 = strlen(v0 + 1); v2 = &v1[v0[1] + v0[2]]; v3 = ximalloc(v2); v4 = v3; *(v4) = eolbyte; v4 = &v4[v0[1]]; a0->field_40 = (v0[1] | a0->field_40); memcpy(v4, v0 + 1, v1); if (v0[2]) *((v1 + v4)) = eolbyte; kwsincr(a0->field_0, v3, v2, v3); free(v3); } else { kwsincr(a0->field_0, v0 + 1, strlen(v0 + 1), v0 + 1); } kwsprep(a0->field_0); v7 = dfamustfree(v0); } return; }
grep
angr_dream
void fatal_exit(void) { if (fatal_exit_hook) fatal_exit_hook(); error(2, 0, gettext("Error is not recoverable: exiting now")); abort(); }
void fatal_exit() { 5260204364651662152(); error(0x2, 0x0, gettext("Error is not recoverable: exiting now")); }
tar
angr_phoenix
static int bash_ignore_everything(names) char **names; { _ignore_completion_names(names, return_zero); return 0; }
long long bash_ignore_everything(unsigned long long a0) { _ignore_completion_names(a0, return_zero); return 0; }
bash
angr_phoenix
static _Bool compare_directory_canonical_names(void const *entry1, void const *entry2) { struct directory const *directory1 = entry1; struct directory const *directory2 = entry2; return strcmp(directory1->caname, directory2->caname) == 0; }
long long compare_directory_canonical_names(struct_0 *a0, struct_0 *a1) { unsigned long long v1; v1 = strcmp(a0->field_50, a1->field_50); *(&v1) = !v1; return v1; }
tar
angr_dream
static int serialise_array(struct sshbuf *m, char **a, size_t n) { struct sshbuf *b; size_t i; int r; if (n > 0x7fffffff) return -1; if ((b = sshbuf_new()) == ((void *)0)) { return -2; } for (i = 0; i < n; i++) { if ((r = sshbuf_put_cstring(b, a[i])) != 0) { sshbuf_free(b); return r; } } if ((r = sshbuf_put_u32(m, n)) != 0 || (r = sshbuf_put_stringb(m, b)) != 0) { sshbuf_free(b); return r; } return 0; }
int serialise_array(unsigned long long a0, void *a1, unsigned long long a2) { unsigned int v0; void *v1; unsigned long long v2; unsigned int v4; if (a2 >= 0x80000000) { v4 = -1; return v4; } v2 = sshbuf_new(); if (!v2) { v4 = -2; return v4; } for (v1 = 0; v1 < a2; v1 += 1) { v0 = sshbuf_put_cstring(v2, *((a1 + 0x8 * v1)), *((a1 + 0x8 * v1))); if (v0) { sshbuf_free(v2); v4 = v0; return v4; } } v0 = sshbuf_put_u32(a0, a2, a2); if (!v0) { v0 = sshbuf_put_stringb(a0, v2, v2); if (!v0) { v4 = 0; return v4; } } sshbuf_free(v2); v4 = v0; return v4; }
openssh-portable
angr_sailr
char *user_command_matches(name, flags, state) const char *name; int flags, state; { register int i; int path_index, name_len; char *path_list, *path_element, *match; struct stat dotinfo; static char **match_list = ((void *)0); static int match_list_size = 0; static int match_index = 0; if (state == 0) { if (match_list == 0) { match_list_size = 5; match_list = strvec_create(match_list_size); } for (i = 0; i < match_list_size; i++) match_list[i] = 0; match_index = 0; if (absolute_program(name)) { match_list[0] = find_absolute_program(name, flags); match_list[1] = (char *)((void *)0); path_list = (char *)((void *)0); } else { name_len = strlen(name); file_to_lose_on = (char *)((void *)0); dot_found_in_search = 0; if (stat(".", &dotinfo) < 0) dotinfo.st_dev = dotinfo.st_ino = 0; path_list = get_string_value("PATH"); path_index = 0; } while (path_list && path_list[path_index]) { path_element = get_next_path_element(path_list, &path_index); if (path_element == 0) break; match = find_in_path_element(name, path_element, flags, name_len, &dotinfo, (int *)0); sh_xfree((path_element), "findcmd.c", 471); if (match == 0) continue; if (match_index + 1 == match_list_size) { match_list_size += 10; match_list = strvec_resize(match_list, (match_list_size + 1)); } match_list[match_index++] = match; match_list[match_index] = (char *)((void *)0); do { if (file_to_lose_on) sh_xfree((file_to_lose_on), "findcmd.c", 484); } while (0); file_to_lose_on = (char *)((void *)0); } match_index = 0; } match = match_list[match_index]; if (match) match_index++; return (match); }
long long user_command_matches(char *a0, unsigned long a1, unsigned long a2) { unsigned int v0; int tmp_32; unsigned int v1; void *v2; unsigned long v3; unsigned long v4; char v5; void *v6; void *v8; if (!a2) { if (!match_list.7740) { match_list_size.7741 = 5; match_list.7740 = strvec_create(match_list_size.7741); } for (v8 = 0; v8 < match_list_size.7741; v8 = v8 + 1) { *((match_list.7740 + v8 * 8)) = 0; } match_index.7742 = 0; if (absolute_program(a0)) { *(match_list.7740) = find_absolute_program(a0, a1); *((match_list.7740 + 8)) = 0; v2 = 0; } else { v1 = strlen(a0); file_to_lose_on = 0; dot_found_in_search = 0; if (stat(".", &v5) < 0) { v6 = 0; v5 = v6; } v2 = get_string_value("PATH"); v0 = 0; } while (true) { if (!v2) { LABEL_40098d: match_index.7742 = 0; break; } else { if (!*(v2 + v0)) goto LABEL_40098d; v3 = get_next_path_element(v2, &v0); if (!v3) goto LABEL_40098d; v4 = find_in_path_element(a0, v3, a1, v1, &v5, NULL); sh_xfree(v3, "findcmd.c", 0x1d7); if (v4) { if (match_index.7742 + 1 == match_list_size.7741) { match_list_size.7741 = match_list_size.7741 + 10; match_list.7740 = strvec_resize(match_list.7740, match_list_size.7741 + 1, match_list_size.7741 + 1); } tmp_32 = match_index.7742; match_index.7742 = match_index.7742 + 1; *((match_list.7740 + tmp_32 * 8)) = v4; *((match_list.7740 + match_index.7742 * 8)) = 0; if (file_to_lose_on) sh_xfree(file_to_lose_on, "findcmd.c", 0x1e4); file_to_lose_on = 0; } } } } v4 = *((match_list.7740 + match_index.7742 * 8)); if (v4) match_index.7742 = match_index.7742 + 1; return v4; }
bash
angr_phoenix
static int read_conf_values(gnutls_datum_t *g, gnutls_datum_t *n, char *str) { char *p; int len; int index, ret; gnutls_datum_t dat; index = atoi(str); p = strrchr(str, ':'); if (p == ((void *)0)) { return -1; } *p = '\0'; p++; len = strlen(p); if (p[len - 1] == '\n') len--; dat.data = (void *)p; dat.size = len; ret = gnutls_srp_base64_decode2(&dat, g); if (ret < 0) { fprintf(stderr, "Decoding error\n"); return -1; } p = strrchr(str, ':'); if (p == ((void *)0)) { return -1; } *p = '\0'; p++; dat.data = (void *)p; dat.size = strlen(p); ret = gnutls_srp_base64_decode2(&dat, n); if (ret < 0) { fprintf(stderr, "Decoding error\n"); free(g->data); return -1; } return index; }
int read_conf_values(void **param_1, undefined8 param_2, char *param_3) { int iVar1; int iVar2; char *pcVar3; size_t sVar4; long in_FS_OFFSET; int local_3c; char *local_28; int local_20; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); iVar1 = atoi(param_3); pcVar3 = strrchr(param_3, 0x3a); if (pcVar3 == (char *)0x0) { iVar1 = -1; } else { *pcVar3 = '\0'; local_28 = pcVar3 + 1; sVar4 = strlen(local_28); local_3c = (int)sVar4; if (local_28[(long)local_3c + -1] == '\n') { local_3c = local_3c + -1; } local_20 = local_3c; iVar2 = gnutls_srp_base64_decode2(&local_28, param_1); if (iVar2 < 0) { fprintf(stderr, "Decoding error\n"); iVar1 = -1; } else { pcVar3 = strrchr(param_3, 0x3a); if (pcVar3 == (char *)0x0) { iVar1 = -1; } else { *pcVar3 = '\0'; local_28 = pcVar3 + 1; sVar4 = strlen(local_28); local_20 = (int)sVar4; iVar2 = gnutls_srp_base64_decode2(&local_28, param_2); if (iVar2 < 0) { fprintf(stderr, "Decoding error\n"); free(*param_1); iVar1 = -1; } } } } if (local_10 == *(long *)(in_FS_OFFSET + 0x28)) { return iVar1; } __stack_chk_fail(); }
gnutls
ghidra
static void read_dh_params(void) { char tmpdata[2048]; int size; gnutls_datum_t params; FILE *fp; if (gnutls_dh_params_init(&dh_params) < 0) { fprintf(stderr, "Error in dh parameter initialization\n"); exit(1); } fp = fopen(dh_params_file, "r"); if (fp == ((void *)0)) { fprintf(stderr, "Could not open %s\n", dh_params_file); exit(1); } size = fread(tmpdata, 1, sizeof(tmpdata) - 1, fp); tmpdata[size] = 0; fclose(fp); params.data = (unsigned char *)tmpdata; params.size = size; size = gnutls_dh_params_import_pkcs3(dh_params, &params, GNUTLS_X509_FMT_PEM); if (size < 0) { fprintf(stderr, "Error parsing dh params: %s\n", safe_strerror(size)); exit(1); } printf("Read Diffie-Hellman parameters.\n"); fflush(stdout); }
void read_dh_params() { unsigned int v0; void *v1; char *v2; unsigned int v3; char v4; char v5; unsigned long long *v7; unsigned long long v8; if (gnutls_dh_params_init(&dh_params) < 0) { fprintf(*(&stderr), "Error in dh parameter initialization\n"); exit(0x1); } v1 = fopen(dh_params_file, "r"); if (!v1) { fprintf(*(&stderr), "Could not open %s\n", dh_params_file); exit(0x1); } v0 = fread(&v4, 0x1, 0x7ff, v1); (&v4)[v0] = 0; fclose(v1); v2 = &v4; v3 = v0; v0 = gnutls_dh_params_import_pkcs3(dh_params, &v2, 0x1, &v2); if (v0 >= 0) { printf("Read Diffie-Hellman parameters.\n"); fflush(stdout); v8 = *(&v5) ^ v7[5]; return; } fprintf(*(&stderr), "Error parsing dh params: %s\n", safe_strerror(v0)); exit(0x1); }
gnutls
angr_sailr
compute_bucket_size(size_t candidate, const Hash_tuning *tuning) { if (!tuning->is_n_buckets) { float new_candidate = candidate / tuning->growth_threshold; if ((float)(18446744073709551615UL) <= new_candidate) return 0; candidate = new_candidate; } candidate = next_prime(candidate); if (__builtin_mul_overflow_p(candidate, sizeof(struct hash_entry *), (ptrdiff_t)1)) return 0; return candidate; }
ulong compute_bucket_size(ulong param_1, long param_2) { ulong uVar1; float fVar2; ulong local_20; local_20 = param_1; if (*(char *)(param_2 + 0x10) != '\x01') { if ((long)param_1 < 0) { fVar2 = (float)(param_1 >> 1 | (ulong)((uint)param_1 & 1)); fVar2 = fVar2 + fVar2; } else { fVar2 = (float)param_1; } fVar2 = fVar2 / *(float *)(param_2 + 8); if (_DAT_00101ab0 <= fVar2) { return 0; } if (DAT_00101ab4 <= fVar2) { local_20 = (long)(fVar2 - DAT_00101ab4) ^ 0x8000000000000000; } else { local_20 = (ulong)fVar2; } } uVar1 = next_prime(local_20); if ((long)(uVar1 << 3) < 0 || uVar1 >> 0x3d != 0) { uVar1 = 0; } return uVar1; }
gnutls
ghidra
static int compare_random(char *__restrict__ texta, size_t lena, char *__restrict__ textb, size_t lenb) { int xfrm_diff = 0; char stackbuf[4000]; char *buf = stackbuf; size_t bufsize = sizeof stackbuf; void *allocated = ((void *)0); uint32_t dig[2][16 / sizeof(uint32_t)]; struct md5_ctx s[2]; s[0] = s[1] = random_md5_state; if (hard_LC_COLLATE) { char const *lima = texta + lena; char const *limb = textb + lenb; while (1) { size_t guess_bufsize = 3 * (lena + lenb) + 2; if (bufsize < guess_bufsize) { bufsize = (((guess_bufsize) > (bufsize * 3 / 2)) ? (guess_bufsize) : (bufsize * 3 / 2)); free(allocated); buf = allocated = malloc(bufsize); if (!buf) { buf = stackbuf; bufsize = sizeof stackbuf; } } size_t sizea = (texta < lima ? xstrxfrm(buf, texta, bufsize) + 1 : 0); _Bool a_fits = sizea <= bufsize; size_t sizeb = (textb < limb ? (xstrxfrm((a_fits ? buf + sizea : ((void *)0)), textb, (a_fits ? bufsize - sizea : 0)) + 1) : 0); if (!(a_fits && sizea + sizeb <= bufsize)) { bufsize = sizea + sizeb; if (bufsize < (18446744073709551615UL) / 3) bufsize = bufsize * 3 / 2; free(allocated); buf = allocated = xmalloc(bufsize); if (texta < lima) strxfrm(buf, texta, sizea); if (textb < limb) strxfrm(buf + sizea, textb, sizeb); } if (texta < lima) texta += strlen(texta) + 1; if (textb < limb) textb += strlen(textb) + 1; if (!(texta < lima || textb < limb)) { lena = sizea; texta = buf; lenb = sizeb; textb = buf + sizea; break; } md5_process_bytes(buf, sizea, &s[0]); md5_process_bytes(buf + sizea, sizeb, &s[1]); if (!xfrm_diff) { xfrm_diff = memcmp(buf, buf + sizea, (((sizea) < (sizeb)) ? (sizea) : (sizeb))); if (!xfrm_diff) xfrm_diff = (sizea > sizeb) - (sizea < sizeb); } } } md5_process_bytes(texta, lena, &s[0]); md5_finish_ctx(&s[0], dig[0]); md5_process_bytes(textb, lenb, &s[1]); md5_finish_ctx(&s[1], dig[1]); int diff = memcmp(dig[0], dig[1], sizeof dig[0]); if (!diff) { if (!xfrm_diff) { xfrm_diff = memcmp(texta, textb, (((lena) < (lenb)) ? (lena) : (lenb))); if (!xfrm_diff) xfrm_diff = (lena > lenb) - (lena < lenb); } diff = xfrm_diff; } free(allocated); return diff; }
int compare_random(char *a0, unsigned long a1, void *a2, unsigned long a3) { void *v0; void *v1; unsigned long v2; void *v3; char v4; unsigned int v5; unsigned int v6; void *v7; unsigned long long v8; void *v9; unsigned long v10; unsigned long v11; unsigned long long v12; unsigned long v13; void *v14; char v15; char v16; unsigned long v17; unsigned long v18; unsigned long v19; unsigned long v20; unsigned long v21; unsigned long v22; unsigned long v23; unsigned long v24; unsigned long v25; unsigned long v26; unsigned long v27; unsigned int v28; unsigned long v29; unsigned long v30; unsigned long v31; unsigned long long v32; unsigned long v33; unsigned long v34; unsigned long v35; unsigned long v36; unsigned long v37; unsigned long v38; unsigned long v39; unsigned long v40; unsigned int v41; char v42; unsigned long long v44; unsigned long v45; void *v46; unsigned long long v47; void *v48; unsigned long v51; unsigned long v52; v32 = *(&v32); v3 = a0; v2 = a1; v1 = a2; v0 = a3; v5 = 0; v7 = &v42; v8 = 4000; v9 = 0; v29 = random_md5_state; v30 = g_40b888; v31 = g_40b890; v33 = g_40b898; v34 = g_40b8a0; v35 = g_40b8a8; v36 = g_40b8b0; v37 = g_40b8b8; v38 = g_40b8c0; v39 = g_40b8c8; v40 = g_40b8d0; v41 = g_40b8d8; v17 = v29; v18 = v30; v19 = v31; v20 = v33; v21 = v34; v22 = v35; v23 = v36; v24 = v37; v25 = v38; v26 = v39; v27 = v40; v28 = v41; if (hard_LC_COLLATE) { v10 = v2 + v3; v11 = v0 + v1; while (true) { v12 = (v2 + v0) * 3 + 2; if (v8 < v12) { v44 = v8 * 3 >> 1; if ((v8 << 1) + v8 >> 1 <= v12) v44 = v12; v8 = v44; free(v9); v9 = malloc(v8); v7 = v9; if (!v7) { v7 = &v42; v8 = 4000; } } if (v3 >= v10) v45 = 0; else v45 = xstrxfrm(v7, v3, v8) + 1; v13 = v45; v4 = v13 <= v8; if (v1 >= v11) { v48 = 0; } else { if (!v4) *(&v45) = 0; else *(&v45) = v8 - v13; if (!v4) v46 = 0; else v46 = v7 + v13; v47 = xstrxfrm(v46, v1, v45); v48 = v47 + 1; } v14 = v48; if (!(v4 ^ 1) && !(v8 < v14 + v13)) goto LABEL_403ada; v8 = v14 + v13; if (v8 <= 6148914691236517204) v8 = v8 * 3 >> 1; free(v9); v9 = xmalloc(v8); v7 = v9; if (v3 < v10) strxfrm(v7, v3, v13); if (v1 < v11) strxfrm(v7 + v13, v1, v14); LABEL_403ada: if (v3 < v10) v3 += strlen(v3) + 1; if (v1 < v11) v1 += strlen(v1) + 1; if (v3 >= v10 && v1 >= v11) { v2 = v13; v3 = v7; v0 = v14; v1 = v13 + v7; break; } md5_process_bytes(v7, v13, &v17); md5_process_bytes(v7 + v13, v14, &v29); if (!v5) { v51 = v13; if (v14 <= v13) v51 = v14; v5 = memcmp(v51, v7 + v51, v51); if (!v5) v5 = !(v13 <= v14) - (v13 < v14); } } } md5_process_bytes(v3, v2, &v17); md5_finish_ctx(&v17, &v15, &v15); md5_process_bytes(v1, v0, &v29); md5_finish_ctx(&v29, &v16, &v16); v6 = memcmp(&v15, &v16, 0x10); if (!v6) { if (!v5) { v52 = v2; if (v0 <= v2) v52 = v0; v5 = memcmp(v52, v1, v52); if (!v5) v5 = !(v2 <= v0) - (v2 < v0); } v6 = v5; } free(v9); return v6; }
coreutils
angr_phoenix
static char *format_key(const struct sshkey *key) { char *ret, *fp = sshkey_fingerprint(key, options.fingerprint_hash, SSH_FP_DEFAULT); xasprintf(&ret, "%s %s", sshkey_type(key), fp); free(fp); return ret; }
int format_key(unsigned long long a0) { char v0; void *v1; v1 = sshkey_fingerprint(a0, *(5250728), 0x0, *(5250728)); xasprintf(&v0, "%s %s", sshkey_type(a0), v1); free(v1); return *(&v0); }
openssh-portable
angr_dream
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"; } }
int gtp_role_to_string(unsigned long a0) { unsigned int v1; if (!a0) { v1 = &g_400675; } else if (a0 == 1) { v1 = &g_400670; } else { v1 = &g_40072f; } return v1; }
iproute2-6.0.0
angr_dream
struct sshauthopt *sshauthopt_new_with_keys_defaults(void) { struct sshauthopt *ret = ((void *)0); if ((ret = sshauthopt_new()) == ((void *)0)) return ((void *)0); ret->permit_port_forwarding_flag = 1; ret->permit_agent_forwarding_flag = 1; ret->permit_x11_forwarding_flag = 1; ret->permit_pty_flag = 1; ret->permit_user_rc = 1; return ret; }
int sshauthopt_new_with_keys_defaults() { void *v0; unsigned int v2; v0 = 0; *(&v0[0]) = sshauthopt_new(); if (!v0) { v2 = 0; } else { v0[0] = 1; v0[1] = 1; v0[2] = 1; v0[3] = 1; v0[4] = 1; v2 = v0; } return v2; }
openssh-portable
angr_dream
char *redirection_expand(word) WORD_DESC *word; { char *result; WORD_LIST *tlist1, *tlist2; WORD_DESC *w; int old; w = copy_word(word); if (posixly_correct) w->flags |= (1 << 4); tlist1 = make_word_list(w, (WORD_LIST *)((void *)0)); expanding_redir = 1; sv_ifs("IFS"); tlist2 = expand_words_no_vars(tlist1); expanding_redir = 0; old = executing_builtin; executing_builtin = 1; sv_ifs("IFS"); executing_builtin = old; dispose_words(tlist1); if (tlist2 == 0 || tlist2->next) { if (tlist2) dispose_words(tlist2); return ((char *)((void *)0)); } result = string_list(tlist2); dispose_words(tlist2); return (result); }
undefined8 redirection_expand(undefined8 param_1) { undefined4 uVar1; long lVar2; undefined8 uVar3; long *plVar4; lVar2 = copy_word(param_1); if (posixly_correct != 0) { *(uint *)(lVar2 + 8) = *(uint *)(lVar2 + 8) | 0x10; } uVar3 = make_word_list(lVar2, 0); expanding_redir = 1; sv_ifs(&DAT_001028fc); plVar4 = (long *)expand_words_no_vars(uVar3); uVar1 = executing_builtin; expanding_redir = 0; executing_builtin = 1; sv_ifs(&DAT_001028fc); executing_builtin = uVar1; dispose_words(uVar3); if ((plVar4 == (long *)0x0) || (*plVar4 != 0)) { if (plVar4 != (long *)0x0) { dispose_words(plVar4); } uVar3 = 0; } else { uVar3 = string_list(plVar4); dispose_words(plVar4); } return uVar3; }
bash
ghidra
static void tar_list_quoting_styles(struct obstack *stk, char const *prefix) { int i; size_t prefixlen = strlen(prefix); for (i = 0; quoting_style_args[i]; i++) { __extension__({ struct obstack *__o = (stk); size_t __len = (prefixlen); if (__extension__({ struct obstack const *__o1 = (__o); (size_t)(__o1->chunk_limit - __o1->next_free); }) < __len) _obstack_newchunk(__o, __len); memcpy(__o->next_free, prefix, __len); __o->next_free += __len; (void)0; }); __extension__({ struct obstack *__o = (stk); size_t __len = (strlen(quoting_style_args[i])); if (__extension__({ struct obstack const *__o1 = (__o); (size_t)(__o1->chunk_limit - __o1->next_free); }) < __len) _obstack_newchunk(__o, __len); memcpy(__o->next_free, quoting_style_args[i], __len); __o->next_free += __len; (void)0; }); __extension__({ struct obstack *__o = (stk); if (__extension__({ struct obstack const *__o1 = (__o); (size_t)(__o1->chunk_limit - __o1->next_free); }) < 1) _obstack_newchunk(__o, 1); ((void)(*((__o)->next_free)++ = ('\n'))); }); } }
void tar_list_quoting_styles(unsigned long long a0, void *a1) { unsigned int v0; unsigned long v1; struct_0 *v2; unsigned long v3; unsigned long long v4[5]; struct_0 *v5; unsigned long v6; unsigned long long v7[5]; struct_0 *v8; unsigned long long v9[5]; unsigned long long v11; char *v12; v1 = strlen(a1); v0 = 0; while (true) { v11 = quoting_style_args[v0]; if (!quoting_style_args[v0]) break; v2 = a0; v3 = v1; v4[0] = v2; if (v4[4] - v4[3] < v3) _obstack_newchunk(v2, v3, v3); memcpy(v2->field_18, a1, v3); v2->field_18 = v2->field_18 + v3; v5 = a0; v6 = strlen(quoting_style_args[v0]); v7[0] = v5; if (v7[4] - v7[3] < v6) _obstack_newchunk(v5, v6, v6); memcpy(v5->field_18, quoting_style_args[v0], v6); v5->field_18 = v5->field_18 + v6; v8 = a0; v9[0] = v8; if (!v9[4] - v9[3]) _obstack_newchunk(v8, 0x1, v9[4] - v9[3]); v12 = v8->field_18; v8->field_18 = v8->field_18 + 1; *(v12) = 10; v0 += 1; } return; }
tar
angr_dream
static void monitor_permit(struct mon_table *ent, enum monitor_reqtype type, int permit) { while (ent->f != ((void *)0)) { if (ent->type == type) { ent->flags &= ~0x1000; ent->flags |= permit ? 0x1000 : 0; return; } ent++; } }
void monitor_permit(unsigned long long a0, unsigned long a1, unsigned long a2) { struct_0 *v0; int tmp_23; unsigned long long v2; unsigned long long v3; unsigned int v4; struct_0 *v5; v0 = a0; while (true) { v2 = v0->field_8; if (!v0->field_8) break; if (a1 != v0->field_0) { v0 += 1; } else { v3 = v0->field_4; *(&v3) = (v0->field_4 >> 8) & 239; tmp_23 = v3; v0->field_4 = tmp_23; if (a2) v4 = 0x1000; else v4 = 0; v5 = v0; v0->field_4 = v4 | v0->field_4; break; } } return; }
openssh-portable
angr_phoenix