input
stringlengths
26
172k
output
stringlengths
18
318k
repo_name
stringclasses
23 values
decompiler
stringclasses
5 values
static void print_explain(FILE *f) { fprintf(f, "Usage: ... batadv [ ra ROUTING_ALG ]\n" "\n" "Where: ROUTING_ALG := { BATMAN_IV | BATMAN_V }\n"); }
void print_explain(void *a0) { unsigned long long v1; v1 = fprintf(a0, "Usage: ... batadv [ ra ROUTING_ALG ]\n\nWhere: ROUTING_ALG " ":= { BATMAN_IV | BATMAN_V }\n"); return; }
iproute2-6.0.0
angr_sailr
static void usage(void) { fprintf(stderr, "usage: ssh-agent [-c | -s] [-Dd] [-a bind_address] [-E " "fingerprint_hash]\n" " [-P allowed_providers] [-t life]\n" " ssh-agent [-a bind_address] [-E fingerprint_hash] " "[-P allowed_providers]\n" " [-t life] command [arg ...]\n" " ssh-agent [-c | -s] -k\n"); exit(1); }
void usage() { fprintf(stderr, "usage: ssh-agent [-c | -s] [-Dd] [-a bind_address] [-E " "fingerprint_hash]\n" " [-P allowed_providers] [-t life]\n" " ssh-agent [-a bind_address] [-E fingerprint_hash] " "[-P allowed_providers]\n" " [-t life] command [arg ...]\n" " ssh-agent [-c | -s] -k\n"); exit(1); }
openssh-portable
ida
void trigproc_install_hooks(void) { trig_override_hooks(&trig_our_hooks); }
long long trigproc_install_hooks() { return trig_override_hooks(&trig_our_hooks); }
dpkg
angr_dream
static void KeyGen(Fq *h, small *f, small *ginv) { small g[761]; Fq finv[761]; for (;;) { Small_random(g); if (R3_recip(ginv, g) == 0) break; } Short_random(f); Rq_recip3(finv, f); Rq_mult_small(h, finv, g); }
void KeyGen(unsigned short *a0, unsigned long a1, unsigned int a2) { char v0; char v1; char v2; unsigned long long *v5; unsigned long long v6; while (true) { Small_random(&v1); if (!R3_recip(a2, &v1, &v1)) break; } Short_random(a1); Rq_recip3(&v0, a1, a1); Rq_mult_small(a0, &v0, &v1); v6 = *(&v2) ^ v5[5]; return; }
openssh-portable
angr_dream
void chdir_do(int i) { if (chdir_current != i) { struct wd *curr = &wd[i]; int fd = curr->fd; if (!fd) { if (!(((curr->name)[0]) == '/')) chdir_do(i - 1); fd = openat(chdir_fd, curr->name, open_searchdir_flags & ~0400000); if (fd < 0) open_fatal(curr->name); curr->fd = fd; if (wdcache_count < CHDIR_CACHE_SIZE) wdcache[wdcache_count++] = i; else { struct wd *stale = &wd[wdcache[CHDIR_CACHE_SIZE - 1]]; if (close(stale->fd) != 0) close_diag(stale->name); stale->fd = 0; wdcache[CHDIR_CACHE_SIZE - 1] = i; } } if (0 < fd) { size_t ci; int prev = wdcache[0]; for (ci = 1; prev != i; ci++) { int cur = wdcache[ci]; wdcache[ci] = prev; if (cur == i) break; prev = cur; } wdcache[0] = i; } chdir_current = i; chdir_fd = fd; } }
void chdir_do(unsigned long a0) { unsigned int v0; int tmp_7; unsigned int v1; unsigned int v2; unsigned long long v3; struct_1 *v4; struct_0 *v5; unsigned long long v7; unsigned long long v8; v7 = 16752697135069743189; if (a0 != 3850979413) { v4 = a0 * 24 + wd; v0 = v4->field_10; if (!v0) { if (v4->field_0->field_0 != 47) chdir_do(a0 - 1); v0 = openat(chdir_fd, v4->field_0, open_searchdir_flags & -131073, v4->field_0); if (v0 < 0) open_fatal(v4->field_0); v4->field_10 = v0; if (wdcache_count <= 15) { tmp_7 = wdcache_count; wdcache_count = wdcache_count + 1; *((4 * tmp_7 + &wdcache)) = a0; } else { v5 = g_40259c * 24 + wd; if (close(v5->field_10)) close_diag(v5->field_0); v5->field_10 = 0; g_40259c = a0; } } if (v0 > 0) { v1 = wdcache; v3 = 1; while (true) { if (v1 == a0) break; v2 = *((4 * v3 + &wdcache)); *((4 * v3 + &wdcache)) = v1; if (v2 == a0) break; v1 = v2; v3 += 1; } wdcache = a0; } chdir_current = a0; v8 = v0; chdir_fd = v0; } return; }
tar
angr_phoenix
void get_tlsfeatures_set(int type, void *crt) { int ret, i; unsigned int feature; if (batch) { if (!cfg.tls_features) return; gnutls_x509_tlsfeatures_t features; ret = gnutls_x509_tlsfeatures_init(&features); if (ret < 0) { fprintf(stderr, "gnutls_x509_tlsfeatures_init: %s\n", gnutls_strerror(ret)); exit(1); } for (i = 0; cfg.tls_features[i]; ++i) { feature = strtoul(cfg.tls_features[i], 0, 10); ret = gnutls_x509_tlsfeatures_add(features, feature); if (ret < 0) { fprintf(stderr, "gnutls_x509_tlsfeatures_add: %s\n", gnutls_strerror(ret)); exit(1); } } if (type == 1) { ret = gnutls_x509_crt_set_tlsfeatures(crt, features); if (ret < 0) { fprintf(stderr, "gnutls_x509_crt_set_tlsfeatures: %s\n", gnutls_strerror(ret)); exit(1); } } else { ret = gnutls_x509_crq_set_tlsfeatures(crt, features); if (ret < 0) { fprintf(stderr, "gnutls_x509_crq_set_tlsfeatures: %s\n", gnutls_strerror(ret)); exit(1); } } gnutls_x509_tlsfeatures_deinit(features); } }
unsigned long get_tlsfeatures_set(int a1, long a2) { const char *v2; const char *v3; const char *v4; const char *v5; int i; int v8; int v9; int v10; int v11; unsigned int v12; long v13; unsigned long v14; v14 = __readfsqword(0x28u); if (batch && *(_QWORD *)&cfg[168]) { v8 = gnutls_x509_tlsfeatures_init(&v13); if (v8 < 0) { v2 = (const char *)gnutls_strerror((unsigned int)v8); fprintf(stderr, "gnutls_x509_tlsfeatures_init: %s\n", v2); exit(1); } for (i = 0; *(_QWORD *)(8LL * i + *(_QWORD *)&cfg[168]); ++i) { v12 = strtoul(*(const char **)(8LL * i + *(_QWORD *)&cfg[168]), 0LL, 10); v9 = gnutls_x509_tlsfeatures_add(v13, v12); if (v9 < 0) { v3 = (const char *)gnutls_strerror((unsigned int)v9); fprintf(stderr, "gnutls_x509_tlsfeatures_add: %s\n", v3); exit(1); } } if (a1 == 1) { v10 = gnutls_x509_crt_set_tlsfeatures(a2, v13); if (v10 < 0) { v4 = (const char *)gnutls_strerror((unsigned int)v10); fprintf(stderr, "gnutls_x509_crt_set_tlsfeatures: %s\n", v4); exit(1); } } else { v11 = gnutls_x509_crq_set_tlsfeatures(a2, v13); if (v11 < 0) { v5 = (const char *)gnutls_strerror((unsigned int)v11); fprintf(stderr, "gnutls_x509_crq_set_tlsfeatures: %s\n", v5); exit(1); } } gnutls_x509_tlsfeatures_deinit(v13); } return __readfsqword(0x28u) ^ v14; }
gnutls
ida
static void send_status(u_int32_t id, u_int32_t status) { send_status_errmsg(id, status, ((void *)0)); }
long send_status(unsigned int a1, unsigned int a2) { return send_status_errmsg(a1, a2, 0LL); }
openssh-portable
ida
static _Bool compare_links(void const *entry1, void const *entry2) { struct link const *link1 = entry1; struct link const *link2 = entry2; return ((link1->dev ^ link2->dev) | (link1->ino ^ link2->ino)) == 0; }
ulong compare_links(ulong *param_1, ulong *param_2) { ulong uVar1; uVar1 = param_2[1] ^ param_1[1] | *param_1 ^ *param_2; return uVar1 & 0xffffffffffffff00 | (ulong)(uVar1 == 0); }
tar
ghidra
int rpl_fcntl (int fd, int action, ...) { va_list arg; int result = -1; __builtin_va_start(arg, action); switch (action) { case 0: { int target = __builtin_va_arg(arg, int); result = rpl_fcntl_DUPFD(fd, target); break; } case 1030: { int target = __builtin_va_arg(arg, int); result = rpl_fcntl_DUPFD_CLOEXEC(fd, target); break; } default: { switch (action) { case 1: case 3: case 1025: case 9: case 1032: case 1034: case 11: result = fcntl(fd, action); break; case 1033: case 0: case 1030: case 1026: case 2: case 4: case 1024: case 8: case 1031: case 10: { int x = __builtin_va_arg(arg, int); result = fcntl(fd, action, x); } break; default: { void *p = __builtin_va_arg(arg, void *); result = fcntl(fd, action, p); } break; } break; } } __builtin_va_end(arg); return result; }
int rpl_fcntl(int param_1, int param_2) { long lVar1; long in_FS_OFFSET; int local_f0; ulong local_a8; lVar1 = *(long *)(in_FS_OFFSET + 0x28); if (param_2 == 0) { local_f0 = rpl_fcntl_DUPFD(param_1, (undefined4)local_a8); goto LAB_0010033d; } if (param_2 == 0x406) { local_f0 = rpl_fcntl_DUPFD_CLOEXEC(param_1, (undefined4)local_a8); goto LAB_0010033d; } if (param_2 < 0xc) { switch (param_2) { case 0: case 2: case 4: case 8: case 10: LAB_0010029a: local_f0 = fcntl(param_1, param_2, local_a8 & 0xffffffff); goto LAB_0010033d; case 1: case 3: case 9: case 0xb: switchD_001001d9_caseD_401: local_f0 = fcntl(param_1, param_2); goto LAB_0010033d; } } else if ((param_2 < 0x40b) && (0x3ff < param_2)) { switch (param_2) { case 0x400: case 0x402: case 0x406: case 0x407: case 0x409: goto LAB_0010029a; case 0x401: case 0x408: case 0x40a: goto switchD_001001d9_caseD_401; } } local_f0 = fcntl(param_1, param_2, local_a8); LAB_0010033d: if (lVar1 == *(long *)(in_FS_OFFSET + 0x28)) { return local_f0; } __stack_chk_fail(); }
gnutls
ghidra
char **completion_matches(const char *text, char *(*genfunc)(const char *, int)) { char **match_list = ((void *)0), *retstr, *prevstr; size_t match_list_len, max_equal, which, i; size_t matches; matches = 0; match_list_len = 1; while ((retstr = (*genfunc)(text, (int)matches)) != ((void *)0)) { if (matches + 3 >= match_list_len) { char **nmatch_list; while (matches + 3 >= match_list_len) match_list_len <<= 1; nmatch_list = realloc(match_list, match_list_len * sizeof(*nmatch_list)); if (nmatch_list == ((void *)0)) { free(match_list); return ((void *)0); } match_list = nmatch_list; } match_list[++matches] = retstr; } if (!match_list) return ((void *)0); which = 2; prevstr = match_list[1]; max_equal = strlen(prevstr); for (; which <= matches; which++) { for (i = 0; i < max_equal && prevstr[i] == match_list[which][i]; i++) continue; max_equal = i; } retstr = calloc(max_equal + 1, sizeof(*retstr)); if (retstr == ((void *)0)) { free(match_list); return ((void *)0); } (void)strlcpy(retstr, match_list[1], max_equal + 1); match_list[0] = retstr; match_list[matches + 1] = ((void *)0); return match_list; }
const char **completion_matches(long a1, long (*a2)(long, _QWORD)) { long i; const char **ptr; unsigned long v5; size_t v6; unsigned long v7; size_t j; unsigned long v9; const char *v10; const char *v11; const char **v12; ptr = 0LL; v9 = 0LL; v5 = 1LL; for (i = a2(a1, 0LL);; i = a2(a1, (unsigned int)v9)) { v10 = (const char *)i; if (!i) break; if (v5 <= v9 + 3) { while (v5 <= v9 + 3) v5 *= 2LL; v12 = (const char **)realloc(ptr, 8 * v5); if (!v12) goto LABEL_7; ptr = v12; } ptr[++v9] = v10; } if (!ptr) return 0LL; v7 = 2LL; v6 = strlen(ptr[1]); while (v7 <= v9) { for (j = 0LL; j < v6 && ptr[1][j] == ptr[v7][j]; ++j) ; v6 = j; ++v7; } v11 = (const char *)calloc(v6 + 1, 1uLL); if (!v11) { LABEL_7: free(ptr); return 0LL; } strlcpy(v11, ptr[1], v6 + 1); *ptr = v11; ptr[v9 + 1] = 0LL; return ptr; }
libedit
ida
void checkpath(void) { static const char *const prog_list[] = {"sh", "rm", "tar", "diff", "dpkg-deb", "ldconfig", "start-stop-daemon", ((void *)0) }; const char *const *prog; int warned = 0; for (prog = prog_list; *prog; prog++) { if (!find_command(*prog)) { warning(gettext("'%s' not found in PATH or not executable"), *prog); warned++; } } if (warned) forcibleerr( FORCE_BAD_PATH, ngettext("%d expected program not found in PATH or not executable\n%s", "%d expected programs not found in PATH or not executable\n%s", warned) , warned, gettext("Note: root's PATH should usually contain " "/usr/local/sbin, /usr/sbin and /sbin")); }
long long checkpath() { unsigned int v0; unsigned long long v1; unsigned long long v3; v0 = 0; v1 = &prog_list.5174; while (true) { v3 = *(v1); if (!*(v1)) break; *(&v3) = find_command(*(v1)) ^ 1; if (v3) { warning(gettext("'%s' not found in PATH or not executable"), *(v1)); v0 += 1; } v1 += 8; } if (v0) { v3 = forcibleerr( 0x2, ngettext("%d expected program not found in PATH or not executable\n%s", "%d expected programs not found in PATH or not executable\n%s", v0), v0, gettext("Note: root's PATH should usually contain /usr/local/sbin, " "/usr/sbin and /sbin")); return v3; } return v3; }
dpkg
angr_sailr
ssize_t zreadretry(fd, buf, len) int fd; char *buf; size_t len; { ssize_t r; int nintr; for (nintr = 0;;) { r = read(fd, buf, len); if (r >= 0) return r; if (r == -1 && (*__errno_location()) == 4) { if (++nintr >= 3) return -1; continue; } return r; } }
long long zreadretry(unsigned long a0, void *a1, unsigned int a2) { unsigned int v0; unsigned long long v1; unsigned long long v4; v0 = 0; do { v1 = read(a0, a1, a2); if (!((v1 - 0 >> 63))) { v4 = v1; goto LABEL_4000ff; } if (v1 != -1) { LABEL_4000fb: v4 = v1; goto LABEL_4000ff; } if (!(*(__errno_location()) == 4)) goto LABEL_4000fb; v0 += 1; } while (v0 <= 2); v4 = -1; LABEL_4000ff: return v4; }
bash
angr_phoenix
|| ((long int)(short) lmax != lmax)) { fprintf(stderr, gettext("%s: invalid numeric argument '%s'\n"), Prog, optarg); exit(3); }
int fprintf(FILE *__stream, char *__format, ...) { halt_baddata(); }
shadow
ghidra
static void new_sgent(struct sgrp *sgent) { explicit_bzero((sgent), (sizeof *sgent)); sgent->sg_name = group_name; if (pflg) { sgent->sg_passwd = group_passwd; } else { sgent->sg_passwd = "!"; } sgent->sg_adm = &empty_list; sgent->sg_mem = &empty_list; }
long long new_sgent(unsigned long long a0[4]) { explicit_bzero(a0, 0x20); a0[0] = group_name; if (pflg) a0[1] = group_passwd; else a0[1] = "!"; a0[2] = &empty_list; a0[3] = &empty_list; return a0; }
shadow
angr_sailr
int conffderef(struct pkginfo *pkg, struct varbuf *result, const char *in) { static struct varbuf target = {0, 0, ((void *)0)}; struct stat stab; ssize_t r; int loopprotect; varbuf_reset(result); varbuf_add_buf(result, instdir, strlen(instdir)); varbuf_add_buf(result, in, strlen(in)); varbuf_end_str(result); loopprotect = 0; for (;;) { debug(dbg_conffdetail, "conffderef in='%s' current working='%s'", in, result->buf); if (lstat(result->buf, &stab)) { if ((*__errno_location()) != 2) warning(gettext("%s: unable to stat config file '%s'\n" " (= '%s'): %s"), pkg_name(pkg, pnaw_nonambig), in, result->buf, strerror((*__errno_location()))); debug(dbg_conffdetail, "conffderef nonexistent"); return 0; } else if (((((stab.st_mode)) & 0170000) == (0100000))) { debug(dbg_conff, "conffderef in='%s' result='%s'", in, result->buf); return 0; } else if (((((stab.st_mode)) & 0170000) == (0120000))) { debug(dbg_conffdetail, "conffderef symlink loopprotect=%d", loopprotect); if (loopprotect++ >= 25) { warning(gettext("%s: config file '%s' is a circular link\n" " (= '%s')"), pkg_name(pkg, pnaw_nonambig), in, result->buf); return -1; } varbuf_reset(&target); varbuf_grow(&target, stab.st_size + 1); r = readlink(result->buf, target.buf, target.size); if (r < 0) { warning(gettext("%s: unable to readlink conffile '%s'\n" " (= '%s'): %s"), pkg_name(pkg, pnaw_nonambig), in, result->buf, strerror((*__errno_location()))); return -1; } else if (r != stab.st_size) { warning(gettext("symbolic link '%.250s' size has " "changed from %jd to %zd"), result->buf, (intmax_t)stab.st_size, r); if (r > stab.st_size) return -1; } varbuf_trunc(&target, r); varbuf_end_str(&target); debug(dbg_conffdetail, "conffderef readlink gave %zd, '%s'", r, target.buf); if (target.buf[0] == '/') { varbuf_reset(result); varbuf_add_buf(result, instdir, strlen(instdir)); debug(dbg_conffdetail, "conffderef readlink absolute"); } else { for (r = result->used - 1; r > 0 && result->buf[r] != '/'; r--) ; if (r < 0) { warning( gettext("%s: conffile '%.250s' resolves to degenerate filename\n" " ('%s' is a symlink to '%s')"), pkg_name(pkg, pnaw_nonambig), in, result->buf, target.buf); return -1; } if (result->buf[r] == '/') r++; varbuf_trunc(result, r); debug(dbg_conffdetail, "conffderef readlink relative to '%.*s'", (int)result->used, result->buf); } varbuf_add_buf(result, target.buf, target.used); varbuf_end_str(result); } else { warning( gettext( "%s: conffile '%.250s' is not a plain file or symlink (= '%s')"), pkg_name(pkg, pnaw_nonambig), in, result->buf); return -1; } } }
int conffderef(unsigned long long a0, unsigned long long a1[3], char *a2, unsigned long long a3, unsigned long long a4, unsigned long long a5) { unsigned int v0; char *v1; char v2; char v3; char v4; unsigned int v6; varbuf_reset(a1); varbuf_add_buf(a1, instdir, strlen(instdir), instdir); varbuf_add_buf(a1, a2, strlen(a2), a2); varbuf_end_str(a1); v0 = 0; while (true) { debug(0x80, "conffderef in='%s' current working='%s'", a2, a1[2], a4, a5); v6 = lstat(a1[2], &v2); if (v6) { v6 = *(__errno_location()); if (v6 != 2) { strerror(*(__errno_location())); warning(gettext("%s: unable to stat config file '%s'\n (= '%s'): %s"), pkg_name(a0, 0x1), a2, a1[2]); } debug(0x80, "conffderef nonexistent", a2, a3, a4, a5); v6 = 0; break; } else if ((*(&v3) & 0xf000) == 0x8000) { debug(0x10, "conffderef in='%s' result='%s'", a2, a1[2], a4, a5); v6 = 0; break; } else if ((*(&v3) & 0xf000) == 0xa000) { debug(0x80, "conffderef symlink loopprotect=%d", v0, a3, a4, a5); v6 = v0; v0 += 1; if (v6 > 24) { warning(gettext("%s: config file '%s' is a circular link\n (= '%s')"), pkg_name(a0, 0x1), a2, a1[2]); v6 = -1; break; } else { varbuf_reset(&target.6492); varbuf_grow(&target.6492, *(&v4) + 1); v1 = readlink(a1[2], g_402170, g_402168); if ((v1 - 0 >> 63)) { strerror(*(__errno_location())); warning( gettext("%s: unable to readlink conffile '%s'\n (= '%s'): %s"), pkg_name(a0, 0x1), a2, a1[2]); v6 = -1; break; } else { if (v1 != *(&v4)) { warning( gettext( "symbolic link '%.250s' size has changed from %jd to %zd"), a1[2], *(&v4), v1); if (v1 > *(&v4)) { v6 = -1; break; } } if (v1 <= *(&v4) || v1 == *(&v4)) { varbuf_trunc(&target.6492, v1); varbuf_end_str(&target.6492); debug(0x80, "conffderef readlink gave %zd, '%s'", v1, g_402170, a4, a5); if (*(g_402170) == 47) { varbuf_reset(a1); varbuf_add_buf(a1, instdir, strlen(instdir), instdir); debug(0x80, "conffderef readlink absolute", a2, a3, a4, a5); } else { for (v1 = a1[0] - 1; v1 > 0; v1 += 1) { if (v1[a1[2]] == 47) break; } if ((v1 >> 63)) { warning(gettext("%s: conffile '%.250s' resolves to degenerate " "filename\n ('%s' is a symlink to '%s')"), pkg_name(a0, 0x1), a2, a1[2]); v6 = -1; break; } else { if (v1[a1[2]] == 47) v1 += 1; varbuf_trunc(a1, v1); debug(0x80, "conffderef readlink relative to '%.*s'", a1[0], a1[2], a4, a5); } } if (!((v1 >> 63))) { varbuf_add_buf(a1, g_402170, target.6492, g_402170); varbuf_end_str(a1); } } } } } else { warning( gettext( "%s: conffile '%.250s' is not a plain file or symlink (= '%s')"), pkg_name(a0, 0x1), a2, a1[2]); v6 = -1; break; } } return v6; }
dpkg
angr_dream
, "fork: %s", strerror( (*__errno_location ()) )); return (-1); } else if (pid == 0) {
char *strerror(int __errnum) { halt_baddata(); }
openssh-portable
ghidra
static WORD_LIST *assoc_to_word_list_internal(h, t) HASH_TABLE *h; int t; { WORD_LIST *list; int i; BUCKET_CONTENTS *tlist; char *w; if (h == 0 || ((h)->nentries == 0)) return ((WORD_LIST *)((void *)0)); list = (WORD_LIST *)((void *)0); for (i = 0; i < h->nbuckets; i++) for (tlist = ((h && (i < h->nbuckets)) ? h->bucket_array[i] : (BUCKET_CONTENTS *)((void *)0)); tlist; tlist = tlist->next) { w = (t == 0) ? (char *)tlist->data : (char *)tlist->key; list = make_word_list(make_bare_word(w), list); } return (((list && list->next) ? (WORD_LIST *)list_reverse((GENERIC_LIST *)list) : (WORD_LIST *)(list))); }
_QWORD *assoc_to_word_list_internal(long a1, int a2) { long v3; long bare_word; int i; _QWORD *word_list; _QWORD *j; if (!a1 || !*(_DWORD *)(a1 + 12)) return 0LL; word_list = 0LL; for (i = 0; i < *(_DWORD *)(a1 + 8); ++i) { for (j = *(_QWORD **)(8LL * i + *(_QWORD *)a1); j; j = (_QWORD *)*j) { if (a2) v3 = j[1]; else v3 = j[2]; bare_word = make_bare_word(v3); word_list = (_QWORD *)make_word_list(bare_word, word_list); } } if (word_list && *word_list) return (_QWORD *)list_reverse(word_list); else return word_list; }
bash
ida
static int xfrm_spd_setdefault(int argc, char **argv) { struct rtnl_handle rth; struct { struct nlmsghdr n; struct xfrm_userpolicy_default up; } req = { .n.nlmsg_len = ((sizeof(struct xfrm_userpolicy_default)) + ((int)(((sizeof(struct nlmsghdr)) + 4U - 1) & ~(4U - 1)))), .n.nlmsg_flags = 0x01, .n.nlmsg_type = XFRM_MSG_SETDEFAULT, }; while (argc > 0) { if (strcmp(*argv, "in") == 0) { if (req.up.in) duparg("in", *argv); do { argv++; if (--argc <= 0) incomplete_command(); } while (0); if (xfrm_str_to_policy(*argv, &req.up.in) < 0) invarg("in policy value is invalid", *argv); } else if (strcmp(*argv, "fwd") == 0) { if (req.up.fwd) duparg("fwd", *argv); do { argv++; if (--argc <= 0) incomplete_command(); } while (0); if (xfrm_str_to_policy(*argv, &req.up.fwd) < 0) invarg("fwd policy value is invalid", *argv); } else if (strcmp(*argv, "out") == 0) { if (req.up.out) duparg("out", *argv); do { argv++; if (--argc <= 0) incomplete_command(); } while (0); if (xfrm_str_to_policy(*argv, &req.up.out) < 0) invarg("out policy value is invalid", *argv); } else { invarg("unknown direction", *argv); } argc--; argv++; } if (rtnl_open_byproto(&rth, 0, 6) < 0) exit(1); if (rtnl_talk(&rth, &req.n, ((void *)0)) < 0) exit(2); rtnl_close(&rth); return 0; }
long xfrm_spd_setdefault(int a1, const char **a2) { long v5[2]; int v6[4]; char v7[56]; unsigned long v8; v8 = __readfsqword(0x28u); v5[0] = 0x1002700000013LL; v5[1] = 0LL; v6[0] = 0; while (a1 > 0) { if (!strcmp(*a2, "in")) { if (LOBYTE(v6[0])) duparg("in", *a2); ++a2; if (--a1 <= 0) incomplete_command(); if ((int)xfrm_str_to_policy(*a2, v6) >= 0) goto LABEL_24; invarg("in policy value is invalid", *a2); } if (!strcmp(*a2, "fwd")) { if (BYTE1(v6[0])) duparg("fwd", *a2); ++a2; if (--a1 <= 0) incomplete_command(); if ((int)xfrm_str_to_policy(*a2, (_BYTE *)v6 + 1) >= 0) goto LABEL_24; invarg("fwd policy value is invalid", *a2); } if (strcmp(*a2, "out")) goto LABEL_23; if (BYTE2(v6[0])) duparg("out", *a2); ++a2; if (--a1 <= 0) incomplete_command(); if ((int)xfrm_str_to_policy(*a2, (_BYTE *)v6 + 2) < 0) { invarg("out policy value is invalid", *a2); LABEL_23: invarg("unknown direction", *a2); } LABEL_24: --a1; ++a2; } if ((int)rtnl_open_byproto(v7, 0LL, 6LL) < 0) exit(1); if ((int)rtnl_talk(v7, v5, 0LL) < 0) exit(2); rtnl_close(v7); return 0LL; }
iproute2-6.0.0
ida
int el_wget(EditLine *el, int op, ...) { va_list ap; int rv; if (el == ((void *)0)) return -1; __builtin_va_start(ap, op); switch (op) { case 0: case 12: { el_pfunc_t *p = __builtin_va_arg(ap, el_pfunc_t *); rv = prompt_get(el, p, 0, op); break; } case 21: case 22: { el_pfunc_t *p = __builtin_va_arg(ap, el_pfunc_t *); wchar_t *c = __builtin_va_arg(ap, wchar_t *); rv = prompt_get(el, p, c, op); break; } case 2: rv = map_get_editor(el, __builtin_va_arg(ap, const wchar_t **)); break; case 3: *__builtin_va_arg(ap, int *) = (el->el_flags & 0x001); rv = 0; break; case 11: *__builtin_va_arg(ap, int *) = !(el->el_flags & 0x004); rv = 0; break; case 25: *__builtin_va_arg(ap, int *) = (el->el_flags & 0x100); rv = 0; break; case 1: terminal_get(el, __builtin_va_arg(ap, const char **)); rv = 0; break; case 17: { static char name[] = "gettc"; char *argv[3]; argv[0] = name; argv[1] = __builtin_va_arg(ap, char *); argv[2] = __builtin_va_arg(ap, void *); rv = terminal_gettc(el, 3, argv); break; } case 13: *__builtin_va_arg(ap, el_rfunc_t *) = el_read_getfn(el->el_read); rv = 0; break; case 14: *__builtin_va_arg(ap, void **) = el->el_data; rv = 0; break; case 15: *__builtin_va_arg(ap, int *) = (el->el_flags & 0x008) != 0; rv = 0; break; case 18: { int what; FILE **fpp; what = __builtin_va_arg(ap, int); fpp = __builtin_va_arg(ap, FILE **); rv = 0; switch (what) { case 0: *fpp = el->el_infile; break; case 1: *fpp = el->el_outfile; break; case 2: *fpp = el->el_errfile; break; default: rv = -1; break; } break; } default: rv = -1; break; } __builtin_va_end(ap); return rv; }
long long el_wget(struct_0 *a0, unsigned long a1, unsigned long a2, unsigned long a3, unsigned long a4, unsigned long a5) { unsigned int v0; unsigned int v1; unsigned long long v2; unsigned long long v3; unsigned long long *v4; unsigned long long v5; unsigned long long v6; unsigned long v7; unsigned long v8; unsigned int v9; unsigned int v10; unsigned long v11; unsigned long v12; unsigned long v13; char v14; unsigned long v15; unsigned long v16; unsigned long v17; int v18; int v19; int v20; int v21; int v22; int v23; int v24; int v25; unsigned long v26; char v27; int v28; int v29; int v30; int v31; int v32; int v33; int v34; int v35; unsigned long long *v36; unsigned long long v37; unsigned long long *v38; unsigned long long *v39; unsigned long long *v40; unsigned long long *v41; unsigned long long *v42; unsigned int *v43; unsigned long long *v44; unsigned long long **v45; unsigned long long *v46; unsigned long long *v47; unsigned long long *v48; unsigned long long *v49; unsigned long long *v50; unsigned int *v51; unsigned int *v52; unsigned int *v53; unsigned int *v54; v15 = a2; v16 = a4; v17 = a5; if (v27) { v18 = v28; v19 = v29; v20 = v30; v21 = v31; v22 = v32; v23 = v33; v24 = v34; v25 = v35; } v13 = v36[5]; if (!a0) { v37 = 4294967295; } else { v9 = 16; v10 = 48; v11 = &v26; v12 = &v14; switch (a1) { case 0: case 12: if (v9 <= 47) { v39 = v12 + v9; v9 += 8; } else { v39 = v11; v11 += 8; } v5 = *(v39); v0 = prompt_get(a0, v5, 0x0, a1); break; case 1: if (v9 <= 47) { v42 = v12 + v9; v9 += 8; } else { v42 = v11; v11 += 8; } terminal_get(a0, *(v42), *(v42)); v0 = 0; break; case 2: if (v9 <= 47) { v38 = v12 + v9; v9 += 8; } else { v38 = v11; v11 += 8; } v0 = map_get_editor(a0, *(v38), *(v38)); break; case 3: if (v9 <= 47) { v48 = v12 + v9; v9 += 8; } else { v48 = v11; v11 += 8; } v53 = *(v48); *(v53) = a0->field_2c & 1; v0 = 0; break; case 11: if (v9 <= 47) { v46 = v12 + v9; v9 += 8; } else { v46 = v11; v11 += 8; } v51 = *(v46); *(v51) = !(a0->field_2c & 4); v0 = 0; break; case 13: if (v9 <= 47) { v45 = v12 + v9; v9 += 8; } else { v45 = v11; v11 += 8; } *(*(v45)) = el_read_getfn(a0->field_4c0); v0 = 0; break; case 14: if (v9 <= 47) { v40 = v12 + v9; v9 += 8; } else { v40 = v11; v11 += 8; } v50 = *(v40); *(v50) = a0->field_48; v0 = 0; break; case 15: if (v9 <= 47) { v47 = v12 + v9; v9 += 8; } else { v47 = v11; v11 += 8; } v52 = *(v47); *(v52) = (a0->field_2c & 8); v0 = 0; break; case 17: v6 = "gettc"; if (v9 <= 47) { v44 = v12 + v9; v9 += 8; } else { v44 = v11; v11 += 8; } v7 = *(v44); if (v9 <= 47) v9 += 8; else v11 += 8; v8 = a3; v0 = terminal_gettc(a0, 0x3, &v6); break; case 18: if (v9 <= 47) { v43 = v12 + v9; v9 += 8; } else { v43 = v11; v11 += 8; } v1 = *(v43); if (v9 <= 47) v9 += 8; else v11 += 8; v4 = a3; v0 = 0; switch (v1) { case 2: *(v4) = a0->field_18; break; case 0: *(v4) = a0->field_8; break; case 1: *(v4) = a0->field_10; break; default: v0 = -1; break; } break; case 21: case 22: if (v9 <= 47) { v41 = v12 + v9; v9 += 8; } else { v41 = v11; v11 += 8; } v2 = *(v41); if (v9 <= 47) v9 += 8; else v11 += 8; v3 = a3; v0 = prompt_get(a0, v2, v3, a1); break; case 25: if (v9 <= 47) { v49 = v12 + v9; v9 += 8; } else { v49 = v11; v11 += 8; } v54 = *(v49); *(v54) = a0->field_2c & 0x100; v0 = 0; break; default: v0 = -1; break; } v37 = v0; } if ((v13 ^ v36[5])) __stack_chk_fail(); return v37; }
libedit
angr_sailr
int rl_stuff_char(int key) { if (ibuffer_space() == 0) return 0; if (key == (-1)) { key = '\n'; rl_pending_input = (-1); (rl_readline_state |= (0x0020000)); } ibuffer[push_index++] = key; if (push_index > ibuffer_len) push_index = 0; return 1; }
long rl_stuff_char(int a1) { int v2; unsigned char v3; v3 = a1; if (!(unsigned int)ibuffer_space()) return 0LL; if (a1 == -1) { v3 = 10; rl_pending_input = -1; rl_readline_state |= 0x20000uLL; } v2 = push_index++; ibuffer[v2] = v3; if (push_index > ibuffer_len) push_index = 0; return 1LL; }
bash
ida
static int preadbuffer(void) { char *q; int more; char savec; if (__builtin_expect(!!(parsefile->strpush), 0)) { popstring(); return __pgetc(); } if (__builtin_expect( !!(parsefile->nleft == -99 || parsefile->buf == ((void *)0)), 0)) return -129; flushall(); more = parsefile->lleft; if (more <= 0) { again: if ((more = preadfd()) <= 0) { parsefile->lleft = parsefile->nleft = -99; return -129; } } q = parsefile->nextc; for (;;) { int c; more--; c = *q; if (!c) memmove(q, q + 1, more); else { q++; if (c == '\n') { parsefile->nleft = q - parsefile->nextc - 1; break; } } if (more <= 0) { parsefile->nleft = q - parsefile->nextc - 1; if (parsefile->nleft < 0) goto again; break; } } parsefile->lleft = more; savec = *q; *q = '\0'; if (optlist[8]) { outstr((parsefile->nextc), out2); } *q = savec; return (signed char)*parsefile->nextc++; }
ulong preadbuffer(void) { char cVar1; char *pcVar2; undefined *puVar3; ulong uVar4; int local_18; char *local_10; if (*(long *)(parsefile + 0x28) == 0) { if ((*(int *)(parsefile + 0x10) == -99) || (*(long *)(parsefile + 0x20) == 0)) { uVar4 = 0xffffff7f; } else { flushall(); local_18 = *(int *)(parsefile + 0x14); if (0 < local_18) goto LAB_0010037b; do { local_18 = preadfd(); puVar3 = parsefile; if (local_18 < 1) { *(undefined4 *)(parsefile + 0x10) = 0xffffff9d; *(undefined4 *)(parsefile + 0x14) = *(undefined4 *)(puVar3 + 0x10); return 0xffffff7f; } LAB_0010037b: local_10 = *(char **)(parsefile + 0x18); do { local_18 = local_18 + -1; cVar1 = *local_10; if (cVar1 == '\0') { memmove(local_10, local_10 + 1, (long)local_18); } else { local_10 = local_10 + 1; if (cVar1 == '\n') { *(int *)(parsefile + 0x10) = ((int)local_10 - (int)*(undefined8 *)(parsefile + 0x18)) + -1; goto LAB_0010042b; } } } while (0 < local_18); *(int *)(parsefile + 0x10) = ((int)local_10 - (int)*(undefined8 *)(parsefile + 0x18)) + -1; } while (*(int *)(parsefile + 0x10) < 0); LAB_0010042b: *(int *)(parsefile + 0x14) = local_18; cVar1 = *local_10; *local_10 = '\0'; if (strlen != (code)0x0) { outstr(*(undefined8 *)(parsefile + 0x18), out2); } *local_10 = cVar1; pcVar2 = *(char **)(parsefile + 0x18); *(char **)(parsefile + 0x18) = pcVar2 + 1; uVar4 = (ulong)(uint)(int)*pcVar2; } } else { popstring(); uVar4 = __pgetc(); } return uVar4; }
dash-0.5.11+git20210903+057cd650a4ed
ghidra
ed_next_char(EditLine *el, wint_t c __attribute__((__unused__))) { wchar_t *lim = el->el_line.lastchar; if (el->el_line.cursor >= lim || (el->el_line.cursor == lim - 1 && el->el_map.type == 1 && el->el_chared.c_vcmd.action == 0x00)) return 6; el->el_line.cursor += el->el_state.argument; if (el->el_line.cursor > lim) el->el_line.cursor = lim; if (el->el_map.type == 1) if (el->el_chared.c_vcmd.action != 0x00) { cv_delfini(el); return 4; } return 5; }
long long ed_next_char(struct_0 *a0, unsigned long a1) { unsigned int v0; unsigned long v1; unsigned long long v3; v0 = a1; v1 = a0->field_60; if (v1 <= a0->field_58) { LABEL_4005fe: v3 = 6; } else { if (a0->field_58 == v1 - 4 && a0->field_420 == 1) { if (!(!a0->field_3c0)) goto LABEL_400605; goto LABEL_4005fe; } LABEL_400605: a0->field_58 = a0->field_58 + a0->field_78 * 4; if (v1 < a0->field_58) a0->field_58 = v1; if (a0->field_420 == 1 && a0->field_3c0) { cv_delfini(a0); v3 = 4; goto LABEL_400674; } v3 = 5; } LABEL_400674: return v3; }
libedit
angr_phoenix
static gnutls_datum_t wrap_db_fetch(void *dbf, gnutls_datum_t key) { gnutls_datum_t res = {((void *)0), 0}; time_t now = time(0); int i; for (i = 0; i < cache_db_ptr; i++) { if (key.size == cache_db[i].session_id_size && memcmp(key.data, cache_db[i].session_id, key.size) == 0 && now < gnutls_db_check_entry_expire_time(&cache_db[i].session_data)) { res.size = cache_db[i].session_data.size; res.data = malloc(res.size); if (res.data == ((void *)0)) return res; memcpy(res.data, cache_db[i].session_data.data, res.size); return res; } } return res; }
long long wrap_db_fetch(unsigned long a0, void *a1, unsigned long a2) { unsigned long v0; unsigned long v1; unsigned int v2; unsigned long v3; void *v4; unsigned int v5; void *v7; v1 = a0; v0 = a2; v4 = 0; v5 = 0; v3 = time(NULL); v2 = 0; while (true) { if (v2 >= cache_db_ptr) { v7 = v4; break; } else { if (v0 == *(((((v2 << 3) + v2 << 1) + v2 << 3) + cache_db + 128)) && !memcmp(a1, (((v2 << 3) + v2 << 1) + v2 << 3) + cache_db, v0) && v3 < gnutls_db_check_entry_expire_time( (((v2 << 3) + v2 << 1) + v2 << 3) + cache_db + 136)) { v5 = *((v2 * 152 + cache_db + 144)); v4 = malloc(v5); if (!v4) { v7 = v4; break; } else { memcpy(v4, *((v2 * 152 + cache_db + 136)), v5); v7 = v4; break; } } v2 += 1; } } return v7; }
gnutls
angr_phoenix
static char *extract_delimited_string(string, sindex, opener, alt_opener, closer, flags) char *string; int *sindex; char *opener, *alt_opener, *closer; int flags; { int i, c, si; size_t slen; char *t, *result; int pass_character, nesting_level, in_comment; int len_closer, len_opener, len_alt_opener; mbstate_t state; memset(&state, '\0', sizeof(mbstate_t)); slen = strlen(string + *sindex) + *sindex; len_opener = (((opener) && (opener)[0]) ? ((opener)[1] ? ((opener)[2] ? strlen(opener) : 2) : 1) : 0); len_alt_opener = (((alt_opener) && (alt_opener)[0]) ? ((alt_opener)[1] ? ((alt_opener)[2] ? strlen(alt_opener) : 2) : 1) : 0); len_closer = (((closer) && (closer)[0]) ? ((closer)[1] ? ((closer)[2] ? strlen(closer) : 2) : 1) : 0); pass_character = in_comment = 0; nesting_level = 1; i = *sindex; while (nesting_level) { c = string[i]; if (i > slen) { i = slen; c = string[i = slen]; break; } if (c == 0) break; if (in_comment) { if (c == '\n') in_comment = 0; do { if (locale_mb_cur_max > 1) { mbstate_t state_bak; size_t mblength; int _f; _f = is_basic((string)[i]); if (_f) mblength = 1; else if (locale_utf8locale && (((string)[i] & 0x80) == 0)) mblength = (string)[i] != 0; else { state_bak = state; mblength = mbrlen((string) + (i), (slen) - (i), &state); } if (mblength == (size_t)-2 || mblength == (size_t)-1) { state = state_bak; (i)++; } else if (mblength == 0) (i)++; else (i) += mblength; } else (i)++; } while (0); continue; } if (pass_character) { pass_character = 0; do { if (locale_mb_cur_max > 1) { mbstate_t state_bak; size_t mblength; int _f; _f = is_basic((string)[i]); if (_f) mblength = 1; else if (locale_utf8locale && (((string)[i] & 0x80) == 0)) mblength = (string)[i] != 0; else { state_bak = state; mblength = mbrlen((string) + (i), (slen) - (i), &state); } if (mblength == (size_t)-2 || mblength == (size_t)-1) { state = state_bak; (i)++; } else if (mblength == 0) (i)++; else (i) += mblength; } else (i)++; } while (0); continue; } if ((flags & 0x0008) && c == '#' && (i == 0 || string[i - 1] == '\n' || (sh_syntaxtab[(unsigned char)(string[i - 1])] & 0x2000))) { in_comment = 1; do { if (locale_mb_cur_max > 1) { mbstate_t state_bak; size_t mblength; int _f; _f = is_basic((string)[i]); if (_f) mblength = 1; else if (locale_utf8locale && (((string)[i] & 0x80) == 0)) mblength = (string)[i] != 0; else { state_bak = state; mblength = mbrlen((string) + (i), (slen) - (i), &state); } if (mblength == (size_t)-2 || mblength == (size_t)-1) { state = state_bak; (i)++; } else if (mblength == 0) (i)++; else (i) += mblength; } else (i)++; } while (0); continue; } if (c == '\001' || c == '\\') { pass_character++; i++; continue; } if ((flags & 0x0008) && string[i] == '$' && string[i + 1] == '(') { si = i + 2; t = extract_command_subst(string, &si, flags | 0x0001); if (si >= slen) { i = slen; c = 0; break; } else ; i = si + 1; continue; } if (((len_opener == 0) ? (1) : ((string + i)[0] == (opener)[0] && strncmp(string + i, opener, len_opener) == 0))) { si = i + len_opener; t = extract_delimited_string(string, &si, opener, alt_opener, closer, flags | 0x0001); if (si >= slen) { i = slen; c = 0; break; } else ; i = si + 1; continue; } if (len_alt_opener && ((len_alt_opener == 0) ? (1) : ((string + i)[0] == (alt_opener)[0] && strncmp(string + i, alt_opener, len_alt_opener) == 0))) { si = i + len_alt_opener; t = extract_delimited_string(string, &si, alt_opener, alt_opener, closer, flags | 0x0001); if (si >= slen) { i = slen; c = 0; break; } else ; i = si + 1; continue; } if (((len_closer == 0) ? (1) : ((string + i)[0] == (closer)[0] && strncmp(string + i, closer, len_closer) == 0))) { i += len_closer - 1; nesting_level--; if (nesting_level == 0) break; } if (c == '`') { si = i + 1; t = string_extract(string, &si, "`", flags | 0x0001); if (si >= slen) { i = slen; c = 0; break; } else ; i = si + 1; continue; } if (c == '\'' || c == '"') { si = i + 1; i = (c == '\'') ? skip_single_quoted(string, slen, si, 0) : skip_double_quoted(string, slen, si, 0); continue; } do { if (locale_mb_cur_max > 1) { mbstate_t state_bak; size_t mblength; int _f; _f = is_basic((string)[i]); if (_f) mblength = 1; else if (locale_utf8locale && (((string)[i] & 0x80) == 0)) mblength = (string)[i] != 0; else { state_bak = state; mblength = mbrlen((string) + (i), (slen) - (i), &state); } if (mblength == (size_t)-2 || mblength == (size_t)-1) { state = state_bak; (i)++; } else if (mblength == 0) (i)++; else (i) += mblength; } else (i)++; } while (0); } if (c == 0 && nesting_level) { if (no_longjmp_on_fatal_error == 0) { last_command_exit_value = 1; report_error(gettext("bad substitution: no closing `%s' in %s"), closer, string); exp_jump_to_top_level(2); } else { *sindex = i; return (char *)((void *)0); } } si = i - *sindex - len_closer + 1; if (flags & 0x0001) result = (char *)((void *)0); else { result = (char *)sh_xmalloc((1 + si), "subst.c", 1513); strncpy(result, string + *sindex, si); result[si] = '\0'; } *sindex = i; return (result); }
char *extract_delimited_string(long param_1, int *param_2, char *param_3, char *param_4, char *param_5, uint param_6) { int iVar1; size_t sVar2; undefined8 uVar3; char *pcVar4; long in_FS_OFFSET; int local_8c; int local_88; int local_84; int local_80; int local_7c; int local_78; int local_74; int local_70; int local_6c; int local_68; int local_64; int local_60; int local_5c; char *local_58; ulong local_50; ulong local_48; ulong local_40; ulong local_38; ulong local_30; undefined8 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); sVar2 = strlen((char *)(param_1 + *param_2)); local_30 = sVar2 + (long)*param_2; if ((param_3 == (char *)0x0) || (*param_3 == '\0')) { local_74 = 0; } else if (param_3[1] == '\0') { local_74 = 1; } else if (param_3[2] == '\0') { local_74 = 2; } else { sVar2 = strlen(param_3); local_74 = (int)sVar2; } if ((param_4 == (char *)0x0) || (*param_4 == '\0')) { local_70 = 0; } else if (param_4[1] == '\0') { local_70 = 1; } else if (param_4[2] == '\0') { local_70 = 2; } else { sVar2 = strlen(param_4); local_70 = (int)sVar2; } if ((param_5 == (char *)0x0) || (*param_5 == '\0')) { local_6c = 0; } else if (param_5[1] == '\0') { local_6c = 1; } else if (param_5[2] == '\0') { local_6c = 2; } else { sVar2 = strlen(param_5); local_6c = (int)sVar2; } local_78 = 0; local_80 = 0; local_7c = 1; local_88 = *param_2; LAB_00102583: if (local_7c != 0) { local_84 = (int)*(char *)(param_1 + local_88); if (local_30 < (ulong)(long)local_88) { local_88 = (int)local_30; local_84 = (int)*(char *)(param_1 + local_88); goto LAB_00102593; } if (local_84 == 0) goto LAB_00102593; if (local_78 == 0) { if (local_80 == 0) { if ((((param_6 & 8) == 0) || (local_84 != 0x23)) || ((local_88 != 0 && ((*(char *)(param_1 + (long)local_88 + -1) != '\n' && ((*(uint *)(&sh_syntaxtab + (long)(int)(uint) * (byte *)(param_1 + (long)local_88 + -1) * 4) & 0x2000) == 0)))))) { if ((local_84 == 1) || (local_84 == 0x5c)) { local_80 = 1; local_88 = local_88 + 1; } else if ((((param_6 & 8) == 0) || (*(char *)(param_1 + local_88) != '$')) || (*(char *)(param_1 + (long)local_88 + 1) != '(')) { if ((local_74 == 0) || ((*(char *)(param_1 + local_88) == *param_3 && (iVar1 = strncmp((char *)(local_88 + param_1), param_3, (long)local_74), iVar1 == 0)))) { local_8c = local_74 + local_88; local_28 = extract_delimited_string( param_1, &local_8c, param_3, param_4, param_5, param_6 | 1); if (local_30 <= (ulong)(long)local_8c) { local_88 = (int)local_30; local_84 = 0; goto LAB_00102593; } local_88 = local_8c + 1; } else if ((local_70 == 0) || ((local_70 != 0 && ((*(char *)(param_1 + local_88) != *param_4 || (iVar1 = strncmp((char *)(local_88 + param_1), param_4, (long)local_70), iVar1 != 0)))))) { if ((local_6c == 0) || ((*(char *)(param_1 + local_88) == *param_5 && (iVar1 = strncmp((char *)(local_88 + param_1), param_5, (long)local_6c), iVar1 == 0)))) { local_88 = local_88 + local_6c + -1; local_7c = local_7c + -1; if (local_7c == 0) goto LAB_00102593; } if (local_84 == 0x60) { local_8c = local_88 + 1; local_28 = string_extract(param_1, &local_8c, &DAT_0011fa1e, param_6 | 1); if (local_30 <= (ulong)(long)local_8c) { local_88 = (int)local_30; local_84 = 0; goto LAB_00102593; } local_88 = local_8c + 1; } else if ((local_84 == 0x27) || (local_84 == 0x22)) { local_8c = local_88 + 1; if (local_84 == 0x27) { local_88 = skip_single_quoted(param_1, local_30, local_8c, 0); } else { local_88 = skip_double_quoted(param_1, local_30, local_8c, 0); } } else if (locale_mb_cur_max < 2) { local_88 = local_88 + 1; } else { local_64 = is_basic((int)*(char *)(param_1 + local_88)); if (local_64 == 0) { if ((locale_utf8locale == 0) || (*(char *)(param_1 + local_88) < '\0')) { local_18 = local_20; local_38 = mbrlen((char *)(local_88 + param_1), local_30 - (long)local_88, &local_20); } else { local_38 = (ulong)(*(char *)(param_1 + local_88) != '\0'); } } else { local_38 = 1; } if ((local_38 == 0xfffffffffffffffe) || (local_38 == 0xffffffffffffffff)) { local_20 = local_18; local_88 = local_88 + 1; } else if (local_38 == 0) { local_88 = local_88 + 1; } else { local_88 = local_88 + (int)local_38; } } } else { local_8c = local_70 + local_88; local_28 = extract_delimited_string( param_1, &local_8c, param_4, param_4, param_5, param_6 | 1); if (local_30 <= (ulong)(long)local_8c) { local_88 = (int)local_30; local_84 = 0; goto LAB_00102593; } local_88 = local_8c + 1; } } else { local_8c = local_88 + 2; local_28 = extract_command_subst(param_1, &local_8c, param_6 | 1); if (local_30 <= (ulong)(long)local_8c) { local_88 = (int)local_30; local_84 = 0; goto LAB_00102593; } local_88 = local_8c + 1; } goto LAB_00102583; } local_78 = 1; if (1 < locale_mb_cur_max) { local_68 = is_basic((int)*(char *)(param_1 + local_88)); if (local_68 == 0) { if ((locale_utf8locale == 0) || (*(char *)(param_1 + local_88) < '\0')) { local_18 = local_20; local_40 = mbrlen((char *)(local_88 + param_1), local_30 - (long)local_88, &local_20); } else { local_40 = (ulong)(*(char *)(param_1 + local_88) != '\0'); } } else { local_40 = 1; } if ((local_40 != 0xfffffffffffffffe) && (local_40 != 0xffffffffffffffff)) { if (local_40 == 0) { local_88 = local_88 + 1; } else { local_88 = local_88 + (int)local_40; } goto LAB_00102583; } local_20 = local_18; } local_88 = local_88 + 1; goto LAB_00102583; } local_80 = 0; if (1 < locale_mb_cur_max) { local_60 = is_basic((int)*(char *)(param_1 + local_88)); if (local_60 == 0) { if ((locale_utf8locale == 0) || (*(char *)(param_1 + local_88) < '\0')) { local_18 = local_20; local_48 = mbrlen((char *)(local_88 + param_1), local_30 - (long)local_88, &local_20); } else { local_48 = (ulong)(*(char *)(param_1 + local_88) != '\0'); } } else { local_48 = 1; } if ((local_48 != 0xfffffffffffffffe) && (local_48 != 0xffffffffffffffff)) { if (local_48 == 0) { local_88 = local_88 + 1; } else { local_88 = local_88 + (int)local_48; } goto LAB_00102583; } local_20 = local_18; } local_88 = local_88 + 1; goto LAB_00102583; } if (local_84 == 10) { local_78 = 0; } if (locale_mb_cur_max < 2) { LAB_00101e29: local_88 = local_88 + 1; } else { local_5c = is_basic((int)*(char *)(param_1 + local_88)); if (local_5c == 0) { if ((locale_utf8locale == 0) || (*(char *)(param_1 + local_88) < '\0')) { local_18 = local_20; local_50 = mbrlen((char *)(local_88 + param_1), local_30 - (long)local_88, &local_20); } else { local_50 = (ulong)(*(char *)(param_1 + local_88) != '\0'); } } else { local_50 = 1; } if ((local_50 == 0xfffffffffffffffe) || (local_50 == 0xffffffffffffffff)) { local_20 = local_18; goto LAB_00101e29; } if (local_50 == 0) { local_88 = local_88 + 1; } else { local_88 = local_88 + (int)local_50; } } goto LAB_00102583; } LAB_00102593: if ((local_84 == 0) && (local_7c != 0)) { if (no_longjmp_on_fatal_error != 0) { *param_2 = local_88; pcVar4 = (char *)0x0; goto LAB_001026a9; } last_command_exit_value = 1; uVar3 = gettext("bad substitution: no closing `%s\' in %s"); report_error(uVar3, param_5, param_1); exp_jump_to_top_level(2); } iVar1 = (local_88 - *param_2) - local_6c; local_8c = iVar1 + 1; if ((param_6 & 1) == 0) { local_58 = (char *)sh_xmalloc((long)(iVar1 + 2), "subst.c", 0x5e9); strncpy(local_58, (char *)(*param_2 + param_1), (long)local_8c); local_58[local_8c] = '\0'; } else { local_58 = (char *)0x0; } *param_2 = local_88; pcVar4 = local_58; LAB_001026a9: if (local_10 == *(long *)(in_FS_OFFSET + 0x28)) { return pcVar4; } __stack_chk_fail(); }
bash
ghidra
void name_init(void) { name_buffer = xmalloc(100 + 2); name_buffer_length = 100; name_list_adjust(); }
long name_init() { name_buffer = (char *)xmalloc(102LL); name_buffer_length = 100LL; return name_list_adjust(); }
tar
ida
static void load_rawpk_keys(void) { int ret; gnutls_datum_t data = {((void *)0), 0}; if (rawpk_file != ((void *)0) && rawpk_keyfile != ((void *)0)) { ret = gnutls_load_file(rawpk_file, &data); if (ret < 0) { fprintf(stderr, "*** Error loading cert file.\n"); exit(1); } ret = gnutls_pcert_import_rawpk_raw(&rawpk, &data, x509ctype, 0, 0); if (ret < 0) { fprintf(stderr, "*** Error importing rawpk to pcert: %s\n", gnutls_strerror(ret)); exit(1); } gnutls_free((void *)(data.data)), data.data = ((void *)0); load_priv_key(&rawpk_key, rawpk_keyfile); log_msg(stdout, "Processed %d client raw public key pair...\n", 1); } }
void load_rawpk_keys(void) { int iVar1; undefined8 uVar2; long in_FS_OFFSET; undefined8 local_28; undefined4 local_20; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); local_28 = 0; local_20 = 0; if ((rawpk_file != 0) && (rawpk_keyfile != 0)) { iVar1 = gnutls_load_file(rawpk_file, &local_28); if (iVar1 < 0) { fprintf(stderr, "*** Error loading cert file.\n"); exit(1); } iVar1 = gnutls_pcert_import_rawpk_raw(rawpk, &local_28, x509ctype, 0, 0); if (iVar1 < 0) { uVar2 = gnutls_strerror(iVar1); fprintf(stderr, "*** Error importing rawpk to pcert: %s\n", uVar2); exit(1); } (*gnutls_free)(local_28); local_28 = 0; load_priv_key(&rawpk_key, rawpk_keyfile); log_msg(stdout, "Processed %d client raw public key pair...\n", 1); } if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) { __stack_chk_fail(); } return; }
gnutls
ghidra
static int show_handler(struct rtnl_ctrl_data *ctrl, struct nlmsghdr *n, void *arg) { struct ifaddrmsg *ifa = ((void *)(((char *)n) + ((int)(((sizeof(struct nlmsghdr)) + 4U - 1) & ~(4U - 1))))); open_json_object(((void *)0)); print_int(PRINT_ANY, "index", "if%d:", ifa->ifa_index); print_nl(); print_addrinfo(n, stdout); close_json_object(); return 0; }
undefined8 show_handler(undefined8 param_1, long param_2) { open_json_object(0); print_int(4, "index", "if%d:", *(undefined4 *)(param_2 + 0x14)); print_nl(); print_addrinfo(param_2, stdout); close_json_object(); return 0; }
iproute2-6.0.0
ghidra
static enum found_status found_forced_on(enum dependtry dependtry_forced) { if (dependtry >= dependtry_forced) return FOUND_FORCED; else return FOUND_DEFER; }
long found_forced_on(unsigned int a1) { if (a1 > dependtry) return 1LL; else return 2LL; }
dpkg
ida
void builtin_warning (const char *format, ...) { va_list args; builtin_error_prolog(); fprintf(stderr, gettext("warning: ")); __builtin_va_start(args, format); vfprintf(stderr, format, args); __builtin_va_end(args); fprintf(stderr, "\n"); }
long long builtin_warning() { unsigned int v0; unsigned int v1; unsigned long v2; unsigned long v3; unsigned long v4; char v5; unsigned long v6; unsigned long v7; unsigned long v8; unsigned long v9; unsigned long v10; int v11; int v12; int v13; int v14; int v15; int v16; int v17; int v18; unsigned long v19; unsigned long v20; unsigned long v21; unsigned long v22; unsigned long v23; unsigned long v24; char v25; int v26; int v27; int v28; int v29; int v30; int v31; int v32; int v33; unsigned long long *v34; char *v35; v6 = v20; v7 = v21; v8 = v22; v9 = v23; v10 = v24; if (v25) { v11 = v26; v12 = v27; v13 = v28; v14 = v29; v15 = v30; v16 = v31; v17 = v32; v18 = v33; } v4 = v34[5]; builtin_error_prolog(); fprintf(stderr, gettext("warning: ")); v0 = 8; v1 = 48; v2 = &v19; v3 = &v5; vfprintf(stderr, v35, &v0); fprintf(stderr, "\n"); if (!(v4 ^ v34[5])) return 0; __stack_chk_fail(); }
bash
angr_phoenix
static void explain(void) { print_explain(stderr); }
void explain(void) { print_explain(stderr); return; }
iproute2-6.0.0
ghidra
static void *xmalloc(size_t bytes) { void *p; if ((p = malloc(bytes)) == ((void *)0)) { if (sent_sigstop) kill(-1, 18); nsyslog(3, "out of memory"); exit(1); } return p; }
void *xmalloc(size_t param_1) { void *pvVar1; pvVar1 = malloc(param_1); if (pvVar1 == (void *)0x0) { if (sent_sigstop != 0) { kill(-1, 0x12); } nsyslog(3, "out of memory"); exit(1); } return pvVar1; }
sysvinit
ghidra
static inline __u64 rta_getattr_u64(const struct rtattr *rta) { __u64 tmp; memcpy(&tmp, ((void *)(((char *)(rta)) + ((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0)))), sizeof(__u64)); return tmp; }
undefined8 rta_getattr_u64(long param_1) { long in_FS_OFFSET; undefined8 local_18; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); memcpy(&local_18, (void *)(param_1 + 4), 8); if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) { __stack_chk_fail(); } return local_18; }
iproute2-6.0.0
ghidra
struct termios *ttattr(fd) int fd; { if (ttsaved == 0) return ((struct termios *)0); if (fd == 0) return &ttin; else if (fd == 1) return &ttout; else return ((struct termios *)0); }
long long ttattr(unsigned long a0) { unsigned long long v1; if (!ttsaved) { v1 = 0; } else if (!a0) { v1 = &ttin; } else if (a0 == 1) { v1 = &ttout; } else { v1 = 0; } return v1; }
bash
angr_phoenix
static void usage(void) { (void)fputs(gettext("Usage: id [-a]\n"), stderr); exit(1); }
void usage() { unsigned long v0; unsigned long v2; v0 = v2; fputs(gettext("Usage: id [-a]\n"), stderr); exit(0x1); }
shadow
angr_sailr
static GROUP_COM *copy_group_command(com) GROUP_COM *com; { GROUP_COM *new_group; new_group = (GROUP_COM *)sh_xmalloc((sizeof(GROUP_COM)), "copy_cmd.c", 218); new_group->command = copy_command(com->command); return (new_group); }
int copy_group_command(struct_0 *a0) { struct_0 *v0; v0 = sh_xmalloc(0x10, "copy_cmd.c", 0xda); v0->field_8 = copy_command(a0->field_8); return v0; }
bash
angr_dream
static _Bool star_get_sparse_info(struct tar_sparse_file *file) { size_t i; union block *h = current_header; int ext_p; enum oldgnu_add_status rc = add_ok; file->stat_info->sparse_map_avail = 0; if (h->star_in_header.prefix[0] == '\0' && h->star_in_header.sp[0].offset[10] != '\0') { for (i = 0; i < 4; i++) { rc = oldgnu_add_sparse(file, &h->star_in_header.sp[i]); if (rc != add_ok) break; } ext_p = h->star_in_header.isextended; } else ext_p = 1; for (; rc == add_ok && ext_p; ext_p = h->star_ext_header.isextended) { h = find_next_block(); if (!h) { do { if (error_hook) error_hook(); error(0, 0, gettext("Unexpected EOF in archive")); exit_status = 2; } while (0); return 0; } set_next_block_after(h); for (i = 0; i < 21 && rc == add_ok; i++) rc = oldgnu_add_sparse(file, &h->star_ext_header.sp[i]); file->dumped_size += 512; } if (rc == add_fail) { do { if (error_hook) error_hook(); error(0, 0, gettext("%s: invalid sparse archive member"), file->stat_info->orig_file_name); exit_status = 2; } while (0); return 0; } return 1; }
long star_get_sparse_info(long a1) { char *v1; long v3; char *v4; int v5; int v6; unsigned long i; unsigned long j; _BYTE *v9; long next_block; v9 = (_BYTE *)current_header; v6 = 0; *(_QWORD *)(*(_QWORD *)(a1 + 24) + 304LL) = 0LL; if (v9[345] || !v9[366]) { v5 = 1; } else { for (i = 0LL; i <= 3; ++i) { v6 = oldgnu_add_sparse(a1, (long)&v9[24 * i + 356]); if (v6) break; } v5 = (char)v9[355]; } while (1) { if (v6 || !v5) { if (v6 != 2) return 1LL; if (error_hook) error_hook(); v3 = **(_QWORD **)(a1 + 24); v4 = gettext("%s: invalid sparse archive member"); error(0, 0, v4, v3); exit_status = 2; return 0LL; } next_block = find_next_block(); if (!next_block) break; set_next_block_after(next_block); for (j = 0LL; j <= 0x14 && !v6; ++j) v6 = oldgnu_add_sparse(a1, 24 * j + next_block); *(_QWORD *)(a1 + 16) += 512LL; v5 = *(char *)(next_block + 504); } if (error_hook) error_hook(); v1 = gettext("Unexpected EOF in archive"); error(0, 0, v1); exit_status = 2; return 0LL; }
tar
ida
static void copyFileName(Char *to, Char *from) { if (strlen(from) > 1034 - 10) { fprintf( stderr, "bzip2: file name\n`%s'\n" "is suspiciously (more than %d chars) long.\n" "Try using a reasonable file name instead. Sorry! :-)\n", from, 1034 - 10); setExit(1); exit(exitValue); } strncpy(to, from, 1034 - 10); to[1034 - 10] = '\0'; }
char *copyFileName(char *a1, const char *a2) { char *result; if (strlen(a2) > 0x400) { fprintf(stderr, "bzip2: file name\n" "`%s'\n" "is suspiciously (more than %d chars) long.\n" "Try using a reasonable file name instead. Sorry! :-)\n", a2, 1024LL); setExit(1u); exit(exitValue); } strncpy(a1, a2, 0x400uLL); result = a1 + 1024; a1[1024] = 0; return result; }
bzip2
ida
int set_reuseaddr(int fd) { int on = 1; if (setsockopt(fd, 1, 2, &on, sizeof(on)) == -1) { sshlog("misc.c", __func__, 189, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "setsockopt SO_REUSEADDR fd %d: %s", fd, strerror((*__errno_location()))); return -1; } return 0; }
undefined8 set_reuseaddr(int param_1) { int iVar1; int *piVar2; char *pcVar3; long in_FS_OFFSET; undefined8 uVar4; undefined4 local_14; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); local_14 = 1; iVar1 = setsockopt(param_1, 1, 2, &local_14, 4); if (iVar1 == -1) { piVar2 = __errno_location(); uVar4 = 0x100645; pcVar3 = strerror(*piVar2); sshlog("misc.c", "set_reuseaddr", 0xbd, 0, 2, 0, "setsockopt SO_REUSEADDR fd %d: %s", param_1, pcVar3, uVar4); uVar4 = 0xffffffff; } else { uVar4 = 0; } if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) { __stack_chk_fail(); } return uVar4; }
openssh-portable
ghidra
int ssh_packet_write_poll(struct ssh *ssh) { struct session_state *state = ssh->state; int len = sshbuf_len(state->output); int r; if (len > 0) { len = write(state->connection_out, sshbuf_ptr(state->output), len); if (len == -1) { if ((*__errno_location()) == 4 || (*__errno_location()) == 11 || (*__errno_location()) == 11) return 0; return -24; } if (len == 0) return -52; if ((r = sshbuf_consume(state->output, len)) != 0) return r; } return 0; }
int ssh_packet_write_poll(unsigned long long *a0) { unsigned int v0; unsigned int v1; struct_0 *v2; unsigned int v4; v2 = *(a0); v0 = sshbuf_len(v2->field_28); if (v0 <= 0) { v4 = 0; return v4; } v0 = write(v2->field_4, sshbuf_ptr(v2->field_28), v0); if (v0 == -1) { if (*(__errno_location()) == 4) { v4 = 0; return v4; } else if (*(__errno_location()) == 11) { v4 = 0; return v4; } else if (*(__errno_location()) == 11) { v4 = 0; return v4; } else { v4 = -24; return v4; } } else { if (v0) { v1 = sshbuf_consume(v2->field_28, v0); if (v1) { v4 = v1; return v4; } v4 = 0; return v4; } else { v4 = -52; return v4; } } }
openssh-portable
angr_sailr
static inline void emit_mandatory_arg_note(void) { fputs_unlocked(gettext("\nMandatory arguments to long options are mandatory " "for short options too.\n"), stdout) ; }
void emit_mandatory_arg_note(void) { char *__s; FILE *__stream; __stream = stdout; __s = (char *)gettext("\nMandatory arguments to long options are mandatory " "for short options too.\n"); fputs_unlocked(__s, __stream); return; }
coreutils
ghidra
static int it_init_helptopics(itp) ITEMLIST *itp; { STRINGLIST *sl; register int i, n; sl = strlist_create(num_shell_builtins); for (i = n = 0; i < num_shell_builtins; i++) sl->list[n++] = shell_builtins[i].name; sl->list[sl->list_len = n] = (char *)((void *)0); itp->flags |= 0x020; itp->slist = sl; return 0; }
undefined8 it_init_helptopics(uint *param_1) { long *plVar1; int iVar2; int iVar3; plVar1 = (long *)strlist_create(num_shell_builtins); iVar2 = 0; for (iVar3 = 0; iVar3 < num_shell_builtins; iVar3 = iVar3 + 1) { *(undefined8 *)(*plVar1 + (long)iVar2 * 8) = *(undefined8 *)(shell_builtins + (long)iVar3 * 0x30); iVar2 = iVar2 + 1; } *(int *)((long)plVar1 + 0xc) = iVar2; *(undefined8 *)((long)*(int *)((long)plVar1 + 0xc) * 8 + *plVar1) = 0; *param_1 = *param_1 | 0x20; *(long **)(param_1 + 4) = plVar1; return 0; }
bash
ghidra
gl_list_node_nx_set_value(gl_list_t list, gl_list_node_t node, const void *elt) { return ((const struct gl_list_impl_base *)list) ->vtable->node_nx_set_value(list, node, elt); }
void gl_list_node_nx_set_value(void) { halt_baddata(); }
gnutls
ghidra
static void uname_coder(struct tar_stat_info const *st, char const *keyword, struct xheader *xhdr, void const *data __attribute__((unused))) { code_string(st->uname, keyword, xhdr); }
void uname_coder(long param_1, undefined8 param_2, undefined8 param_3) { code_string(*(undefined8 *)(param_1 + 0x20), param_2, param_3); return; }
tar
ghidra
time_t nextmatch(entry *e, time_t start, time_t end) { time_t time; struct tm current; for (time = start; time <= end;) { localtime_r(&time, &current); if (!((e->month)[((current.tm_mon) >> 3)] & (1 << ((current.tm_mon) & 0x7)))) { current.tm_mon++; if (current.tm_mon >= 12) { current.tm_year++; current.tm_mon = 0; } current.tm_mday = 1; current.tm_hour = 0; current.tm_min = 0; time = mktime(&current); continue; } if (!matchday(e, time) && !matchday(e, time + 24 * 60 * 60)) { time += 24 * 60 * 60; continue; } if (((e->month)[((current.tm_mon) >> 3)] & (1 << ((current.tm_mon) & 0x7))) && matchday(e, time) && ((e->hour)[((current.tm_hour) >> 3)] & (1 << ((current.tm_hour) & 0x7))) && ((e->minute)[((current.tm_min) >> 3)] & (1 << ((current.tm_min) & 0x7)))) return time; time += 60; } return -1; }
time_t nextmatch(long a1, time_t a2, time_t a3) { time_t timer; struct tm tp; unsigned long v7; v7 = __readfsqword(0x28u); timer = a2; while (a3 >= timer) { localtime_r(&timer, &tp); if ((((int)*(unsigned char *)(a1 + (tp.tm_mon >> 3) + 47) >> (tp.tm_mon & 7)) & 1) != 0) { if ((unsigned int)matchday(a1, timer) || (unsigned int)matchday(a1, timer + 86400)) { if ((((int)*(unsigned char *)(a1 + (tp.tm_mon >> 3) + 47) >> (tp.tm_mon & 7)) & 1) != 0 && (unsigned int)matchday(a1, timer) && (((int)*(unsigned char *)(a1 + (tp.tm_hour >> 3) + 40) >> (tp.tm_hour & 7)) & 1) != 0 && (((int)*(unsigned char *)(a1 + (tp.tm_min >> 3) + 32) >> (tp.tm_min & 7)) & 1) != 0) { return timer; } timer += 60LL; } else { timer += 86400LL; } } else { if (++tp.tm_mon > 11) { ++tp.tm_year; tp.tm_mon = 0; } tp.tm_mday = 1; tp.tm_hour = 0; tp.tm_min = 0; timer = mktime(&tp); } } return -1LL; }
cronie
ida
static struct sftp_conn *do_sftp_connect(char *host, char *user, int port, char *sftp_direct, int *reminp, int *remoutp, int *pidp) { if (sftp_direct == ((void *)0)) { if (do_cmd(ssh_program, host, user, port, 1, "sftp", reminp, remoutp, pidp) < 0) return ((void *)0); } else { freeargs(&args); addargs(&args, "sftp-server"); if (do_cmd(sftp_direct, host, ((void *)0), -1, 0, "sftp", reminp, remoutp, pidp) < 0) return ((void *)0); } return do_init(*reminp, *remoutp, 32768, 64, limit_kbps); }
int do_sftp_connect(unsigned int a0, unsigned int a1, unsigned long a2, char *a3, unsigned int *a4, unsigned int a5, unsigned int v0) { unsigned int v1; if (a3) { freeargs(&remote_remote_args); addargs(&remote_remote_args, "sftp-server"); if (do_cmd(a3, a0, 0x0, 0xffffffff, 0x0, "sftp", a4, a5, *(&v0)) < 0) { v1 = 0; return v1; } } else if (do_cmd(ssh_program, a0, a1, a2, 0x1, "sftp", a4, a5, *(&v0)) < 0) { v1 = 0; return v1; } v1 = do_init(*(a4), *(a5), 0x8000, 0x40, limit_kbps); return v1; }
openssh-portable
angr_sailr
void optimize_subshell_command(command) COMMAND *command; { if (should_optimize_fork(command, 0)) { command->flags |= 0x40; command->value.Simple->flags |= 0x40; } else if (command->type == cm_connection && (command->value.Connection->connector == 288 || command->value.Connection->connector == 289 || command->value.Connection->connector == ';') && command->value.Connection->second->type == cm_simple && parser_expanding_alias() == 0) { command->value.Connection->second->flags |= 0x8000; command->value.Connection->second->value.Simple->flags |= 0x8000; } }
long long optimize_subshell_command(struct_0 *a0) { int tmp_50; int tmp_79; struct_1 *v1; unsigned long long v2; unsigned long long v3; if (should_optimize_fork(a0, 0x0)) { a0->field_4 = a0->field_4 | 64; v1 = a0->field_18; a0->field_18->field_0 = a0->field_18->field_0 | 64; } else { v1 = a0->field_0; if (a0->field_0 == 6) { if (a0->field_18->field_18 != 288 && a0->field_18->field_18 != 289) { v1 = a0->field_18->field_18; if (!(a0->field_18->field_18 == 59)) goto LABEL_4003f6; } v1 = *(a0->field_18->field_10); if (*(a0->field_18->field_10) == 4) { v1 = parser_expanding_alias(); if (!v1) { v2 = *((a0->field_18->field_10 + 4)); *(&v2) = (*((a0->field_18->field_10 + 4)) >> 8) | 128; tmp_50 = v2; *((a0->field_18->field_10 + 4)) = tmp_50; v3 = *(*((a0->field_18->field_10 + 24))); v1 = *((a0->field_18->field_10 + 24)); *(&v3) = (*(*((a0->field_18->field_10 + 24))) >> 8) | 128; tmp_79 = v3; *(*((a0->field_18->field_10 + 24))) = tmp_79; } } } } LABEL_4003f6: return v1; }
bash
angr_phoenix
) { snprintf(prompt, sizeof(prompt), "Enter %.30s@%.128s's new password: ", authctxt->server_user, host); password = read_passphrase(prompt, 0x0004); if (password == ((void *)0)) { r = 0; goto out; } snprintf(prompt, sizeof(prompt), "Retype %.30s@%.128s's new password: ", authctxt->server_user, host); retype = read_passphrase(prompt, 0); if (strcmp(password, retype) != 0) { freezero(password, strlen(password)); sshlog("sshconnect2.c", __func__, 1161, 0, SYSLOG_LEVEL_INFO, ((void *)0), "Mismatch; try again, EOF to quit."); password = ((void *)0); } freezero(retype, strlen(retype)); }
int snprintf(char *__s, size_t __maxlen, char *__format, ...) { halt_baddata(); }
openssh-portable
ghidra
static inline int masklen_valid(int af, u_int masklen) { switch (af) { case 2: return masklen <= 32 ? 0 : -1; case 10: return masklen <= 128 ? 0 : -1; default: return -1; } }
int masklen_valid(unsigned long a0, unsigned long a1) { unsigned int v1; if (a0 != 2) { if (a0 != 10) { v1 = -1; } else if (a1 <= 128) { v1 = 0; } else { v1 = -1; } } else { if (a1 <= 32) v1 = 0; else v1 = -1; } return v1; }
openssh-portable
angr_dream
void rl_cleanup_after_signal(void) { _rl_clean_up_for_exit(); if (rl_deprep_term_function) (*rl_deprep_term_function)(); rl_clear_pending_input(); rl_clear_signals(); }
long rl_cleanup_after_signal() { rl_clean_up_for_exit(); if (rl_deprep_term_function) rl_deprep_term_function(); rl_clear_pending_input(); return rl_clear_signals(); }
bash
ida
size_t hash_get_entries(const Hash_table *table, void **buffer, size_t buffer_size) { size_t counter = 0; struct hash_entry const *bucket; struct hash_entry const *cursor; for (bucket = table->bucket; bucket < table->bucket_limit; bucket++) { if (bucket->data) { for (cursor = bucket; cursor; cursor = cursor->next) { if (counter >= buffer_size) return counter; buffer[counter++] = cursor->data; } } } return counter; }
long long hash_get_entries(unsigned long long a0[2], void *a1, unsigned long a2) { void *v0; int tmp_16; unsigned long long v1[2]; unsigned long long v2[2]; void *v4; v0 = 0; v1[0] = a0[0]; while (true) { if (v1 < a0[1]) { if (v1[0]) { for (v2[0] = v1; v2; v2[0] = v2[1]) { if (v0 >= a2) { v4 = v0; break; } else { tmp_16 = v0; v0 += 1; *((8 * tmp_16 + a1)) = v2[0]; } } if (v0 >= a2 && v2) break; } if (v0 < a2 || !v2) v1[0] = v1 + 1; } else { v4 = v0; break; } } return v4; }
gnutls
angr_dream
static void open_files(void) { if (gr_open(0100 | 02) == 0) { fprintf(stderr, gettext("%s: cannot open %s\n"), Prog, gr_dbname()); do { char *old_locale = setlocale(6, ((void *)0)); char *saved_locale = ((void *)0); if (((void *)0) != old_locale) { saved_locale = strdup(old_locale); } if (((void *)0) != saved_locale) { (void)setlocale(6, "C"); } syslog(4, "cannot open %s", gr_dbname()); if (((void *)0) != saved_locale) { (void)setlocale(6, saved_locale); free(saved_locale); } } while (0); exit(10); } if (is_shadow_grp && (pflg || nflg)) { if (sgr_open(0100 | 02) == 0) { fprintf(stderr, gettext("%s: cannot open %s\n"), Prog, sgr_dbname()); do { char *old_locale = setlocale(6, ((void *)0)); char *saved_locale = ((void *)0); if (((void *)0) != old_locale) { saved_locale = strdup(old_locale); } if (((void *)0) != saved_locale) { (void)setlocale(6, "C"); } syslog(4, "cannot open %s", sgr_dbname()); if (((void *)0) != saved_locale) { (void)setlocale(6, saved_locale); free(saved_locale); } } while (0); exit(10); } } if (gflg) { if (pw_open(0100 | 02) == 0) { fprintf(stderr, gettext("%s: cannot open %s\n"), Prog, pw_dbname()); do { char *old_locale = setlocale(6, ((void *)0)); char *saved_locale = ((void *)0); if (((void *)0) != old_locale) { saved_locale = strdup(old_locale); } if (((void *)0) != saved_locale) { (void)setlocale(6, "C"); } syslog(4, "cannot open %s", gr_dbname()); if (((void *)0) != saved_locale) { (void)setlocale(6, saved_locale); free(saved_locale); } } while (0); exit(10); } } }
long open_files() { long v0; long v1; char *v2; const char *v3; long v4; long v5; char *v6; const char *v7; long result; long v9; long v10; char *v11; const char *v12; char *locale; char *v14; char *v15; const char *v16; const char *v17; const char *s; if (!(unsigned int)gr_open(66LL)) { v0 = gr_dbname(); v1 = Prog; v2 = gettext("%s: cannot open %s\n"); fprintf(stderr, v2, v1, v0); s = setlocale(6, 0LL); locale = 0LL; if (s) locale = strdup(s); if (locale) setlocale(6, "C"); v3 = (const char *)gr_dbname(); syslog(4, "cannot open %s", v3); if (locale) { setlocale(6, locale); free(locale); } exit(10); } if (is_shadow_grp && (pflg || nflg) && !(unsigned int)sgr_open(66LL)) { v4 = sgr_dbname(); v5 = Prog; v6 = gettext("%s: cannot open %s\n"); fprintf(stderr, v6, v5, v4); v16 = setlocale(6, 0LL); v14 = 0LL; if (v16) v14 = strdup(v16); if (v14) setlocale(6, "C"); v7 = (const char *)sgr_dbname(); syslog(4, "cannot open %s", v7); if (v14) { setlocale(6, v14); free(v14); } exit(10); } result = (unsigned char)gflg; if (gflg) { result = pw_open(66LL); if (!(_DWORD)result) { v9 = pw_dbname(); v10 = Prog; v11 = gettext("%s: cannot open %s\n"); fprintf(stderr, v11, v10, v9); v17 = setlocale(6, 0LL); v15 = 0LL; if (v17) v15 = strdup(v17); if (v15) setlocale(6, "C"); v12 = (const char *)gr_dbname(); syslog(4, "cannot open %s", v12); if (v15) { setlocale(6, v15); free(v15); } exit(10); } } return result; }
shadow
ida
_Bool hash_rehash (Hash_table *table, size_t candidate) { Hash_table storage; Hash_table *new_table; size_t new_size = compute_bucket_size(candidate, table->tuning); if (!new_size) return 0; if (new_size == table->n_buckets) return 1; new_table = &storage; new_table->bucket = calloc(new_size, sizeof *new_table->bucket); if (new_table->bucket == ((void *)0)) return 0; new_table->n_buckets = new_size; new_table->bucket_limit = new_table->bucket + new_size; new_table->n_buckets_used = 0; new_table->n_entries = 0; new_table->tuning = table->tuning; new_table->hasher = table->hasher; new_table->comparator = table->comparator; new_table->data_freer = table->data_freer; new_table->free_entry_list = table->free_entry_list; if (transfer_entries(new_table, table, 0)) { free(table->bucket); table->bucket = new_table->bucket; table->bucket_limit = new_table->bucket_limit; table->n_buckets = new_table->n_buckets; table->n_buckets_used = new_table->n_buckets_used; table->free_entry_list = new_table->free_entry_list; return 1; } table->free_entry_list = new_table->free_entry_list; if (!(transfer_entries(table, new_table, 1) && transfer_entries(table, new_table, 0))) abort(); free(new_table->bucket); return 0; }
int hash_rehash(unsigned long long a0[10], unsigned long long a1) { unsigned int v0; unsigned long long v1[10]; char v2; unsigned int v4; *(&v0) = compute_bucket_size(a1, a0[5]); if (!*(&v0)) { v4 = 0; } else if (*(&v0) == a0[2]) { v4 = 1; } else { v1[0] = &v2; v1[0] = calloc(*(&v0), 0x10); if (!v1[0]) { v4 = 0; } else { v1[2] = *(&v0); v1[1] = *(&v0) * 16 + v1[0]; v1[3] = 0; v1[4] = 0; v1[5] = a0[5]; v1[6] = a0[6]; v1[7] = a0[7]; v1[8] = a0[8]; v1[9] = a0[9]; v4 = transfer_entries(v1, a0, 0x0); if (v4) { free(a0[0]); a0[0] = v1[0]; a0[1] = v1[1]; a0[2] = v1[2]; a0[3] = v1[3]; a0[9] = v1[9]; v4 = 1; } else { a0[9] = v1[9]; *(&v4) = transfer_entries(a0, v1, 0x1) ^ 1; *(&v4) = transfer_entries(a0, v1, 0x0) ^ 1; free(v1[0]); v4 = 0; } } } if (false) abort(); return v4; }
gnutls
angr_dream
int asmprintf(char **outp, size_t sz, int *wp, const char *fmt, ...) { va_list ap; int ret; *outp = ((void *)0); __builtin_va_start(ap, fmt); ret = vasnmprintf(outp, sz, wp, fmt, ap); __builtin_va_end(ap); return ret; }
long long asmprintf() { unsigned int v0; unsigned int v1; unsigned int v2; unsigned long v3; unsigned long v4; unsigned long v5; char v6; unsigned long v7; unsigned long v8; int v9; int v10; int v11; int v12; int v13; int v14; int v15; int v16; unsigned long v17; unsigned long v18; unsigned long v19; char v20; int v21; int v22; int v23; int v24; int v25; int v26; int v27; int v28; unsigned long long *v29; unsigned long long *v30; unsigned long long v31; unsigned int *v32; char *v33; v7 = v18; v8 = v19; if (v20) { v9 = v21; v10 = v22; v11 = v23; v12 = v24; v13 = v25; v14 = v26; v15 = v27; v16 = v28; } v5 = v29[5]; *(v30) = 0; v1 = 32; v2 = 48; v3 = &v17; v4 = &v6; v0 = vasnmprintf(v30, v31, v32, v33, &v1); if ((v5 ^ v29[5])) __stack_chk_fail(); return v0; }
openssh-portable
angr_sailr
u_int ssh_packet_get_protocol_flags(struct ssh *ssh) { return ssh->state->remote_protocol_flags; }
long ssh_packet_get_protocol_flags(long a1) { return *(unsigned int *)(*(_QWORD *)a1 + 8LL); }
openssh-portable
ida
void e2fsck_set_bitmap_type(ext2_filsys fs, unsigned int default_type, const char *profile_name, unsigned int *old_type) { unsigned type; e2fsck_t ctx = (e2fsck_t)fs->priv_data; if (old_type) *old_type = fs->default_bitmap_type; profile_get_uint(ctx->profile, "bitmaps", profile_name, 0, default_type, &type); profile_get_uint(ctx->profile, "bitmaps", "all", 0, type, &type); fs->default_bitmap_type = type ? type : default_type; }
void e2fsck_set_bitmap_type(long param_1, int param_2, undefined8 param_3, uint *param_4) { long in_FS_OFFSET; int local_1c; long local_18; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); local_18 = *(long *)(param_1 + 0xe0); if (param_4 != (uint *)0x0) { *param_4 = (uint) * (ushort *)(param_1 + 0xc4); } profile_get_uint(*(undefined8 *)(local_18 + 0x360), "bitmaps", param_3, 0, param_2, &local_1c); profile_get_uint(*(undefined8 *)(local_18 + 0x360), "bitmaps", &DAT_001029ab, 0, local_1c, &local_1c); if (local_1c != 0) { param_2 = local_1c; } *(short *)(param_1 + 0xc4) = (short)param_2; if (local_10 == *(long *)(in_FS_OFFSET + 0x28)) { return; } __stack_chk_fail(); }
e2fsprogs-1.46.5
ghidra
static struct dumpdir *dumpdir_create(const char *contents) { return dumpdir_create0(contents, "YND"); }
void dumpdir_create(undefined8 param_1) { dumpdir_create0(param_1, &DAT_00104c10); return; }
tar
ghidra
void verify_crl(common_info_st *cinfo) { size_t size; gnutls_datum_t dn; unsigned int output; int ret, rc; gnutls_datum_t pem, pout; gnutls_x509_crl_t crl; gnutls_x509_crt_t issuer; issuer = load_ca_cert(1, cinfo); fprintf(outfile, "\nCA certificate:\n"); ret = gnutls_x509_crt_get_dn3(issuer, &dn, 0); if (ret < 0) { fprintf(stderr, "crt_get_dn: %s\n", gnutls_strerror(ret)); app_exit(1); } fprintf(outfile, "\tSubject: %s\n\n", dn.data); ret = gnutls_x509_crl_init(&crl); if (ret < 0) { fprintf(stderr, "crl_init: %s\n", gnutls_strerror(ret)); app_exit(1); } pem.data = (void *)_gnutls_fread_file(infile, 0, &size); pem.size = size; if (!pem.data) { fprintf(stderr, "%s", infile ? "file" : "standard input"); app_exit(1); } ret = gnutls_x509_crl_import(crl, &pem, incert_format); free(pem.data); if (ret < 0) { fprintf(stderr, "import error: %s\n", gnutls_strerror(ret)); app_exit(1); } print_crl_info(crl, outfile, cinfo); ret = gnutls_x509_crl_verify(crl, &issuer, 1, 0, &output); if (ret < 0) { fprintf(stderr, "verification error: %s\n", gnutls_strerror(ret)); app_exit(1); } fprintf(outfile, "Verification output: "); if (output) { fprintf(outfile, "Not verified. "); rc = 1; } else { fprintf(outfile, "Verified."); rc = 0; } ret = gnutls_certificate_verification_status_print(output, GNUTLS_CRT_X509, &pout, 0); if (ret < 0) { fprintf(stderr, "error: %s\n", gnutls_strerror(ret)); app_exit(1); } fprintf(outfile, " %s", pout.data); gnutls_free((void *)(pout.data)), pout.data = ((void *)0); fprintf(outfile, "\n"); app_exit(rc); }
void verify_crl(long a1) { const char *v1; const char *v2; const char *v3; const char *v4; const char *v5; const char *v6; unsigned int v7; int v8; unsigned int dn3; long v10; long v11; long ca_cert; const char *v13; void *ptr; int v15; const char *v16[4]; v16[3] = (const char *)__readfsqword(0x28u); ca_cert = load_ca_cert(1LL, a1); fprintf(outfile, "\nCA certificate:\n"); dn3 = gnutls_x509_crt_get_dn3(ca_cert, &v13, 0LL); if ((dn3 & 0x80000000) != 0) { v1 = (const char *)gnutls_strerror(dn3); fprintf(stderr, "crt_get_dn: %s\n", v1); app_exit(1); } fprintf(outfile, "\tSubject: %s\n\n", v13); dn3 = gnutls_x509_crl_init(&v11); if ((dn3 & 0x80000000) != 0) { v2 = (const char *)gnutls_strerror(dn3); fprintf(stderr, "crl_init: %s\n", v2); app_exit(1); } ptr = (void *)gnutls_fread_file(infile, 0LL, &v10); v15 = v10; if (!ptr) { if (infile) v3 = "file"; else v3 = "standard input"; fprintf(stderr, "%s", v3); app_exit(1); } dn3 = gnutls_x509_crl_import(v11, &ptr, (unsigned int)incert_format); free(ptr); if ((dn3 & 0x80000000) != 0) { v4 = (const char *)gnutls_strerror(dn3); fprintf(stderr, "import error: %s\n", v4); app_exit(1); } print_crl_info(v11, outfile, a1); dn3 = gnutls_x509_crl_verify(v11, &ca_cert, 1LL, 0LL, &v7); if ((dn3 & 0x80000000) != 0) { v5 = (const char *)gnutls_strerror(dn3); fprintf(stderr, "verification error: %s\n", v5); app_exit(1); } fprintf(outfile, "Verification output: "); if (v7) { fprintf(outfile, "Not verified. "); v8 = 1; } else { fprintf(outfile, "Verified."); v8 = 0; } dn3 = gnutls_certificate_verification_status_print(v7, 1LL, v16, 0LL); if ((dn3 & 0x80000000) != 0) { v6 = (const char *)gnutls_strerror(dn3); fprintf(stderr, "error: %s\n", v6); app_exit(1); } fprintf(outfile, " %s", v16[0]); gnutls_free(v16[0]); v16[0] = 0LL; fprintf(outfile, "\n"); app_exit(v8); }
gnutls
ida
int maybe_unsave_line(void) { return rl_maybe_unsave_line(); }
long long maybe_unsave_line() { return rl_maybe_unsave_line(); }
bash
angr_phoenix
static void check_perms(void) {}
void check_perms() { char v0; unsigned long long v2; v2 = *(&v0); return; }
shadow
angr_dream
static void open_files(void) { if (pw_lock() == 0) { fprintf(stderr, gettext("%s: cannot lock %s; try again later.\n"), Prog, pw_dbname()); fail_exit(1); } pw_locked = 1; if (pw_open(0100 | 02) == 0) { fprintf(stderr, gettext("%s: cannot open %s\n"), Prog, pw_dbname()); fail_exit(1); } if (is_shadow_pwd && (spw_lock() == 0)) { fprintf(stderr, gettext("%s: cannot lock %s; try again later.\n"), Prog, spw_dbname()); fail_exit(1); } spw_locked = 1; if (is_shadow_pwd && (spw_open(0100 | 02) == 0)) { fprintf(stderr, gettext("%s: cannot open %s\n"), Prog, spw_dbname()); fail_exit(1); } if (Gflg || lflg) { if (gr_lock() == 0) { fprintf(stderr, gettext("%s: cannot lock %s; try again later.\n"), Prog, gr_dbname()); fail_exit(10); } gr_locked = 1; if (gr_open(0100 | 02) == 0) { fprintf(stderr, gettext("%s: cannot open %s\n"), Prog, gr_dbname()); fail_exit(10); } if (is_shadow_grp && (sgr_lock() == 0)) { fprintf(stderr, gettext("%s: cannot lock %s; try again later.\n"), Prog, sgr_dbname()); fail_exit(10); } sgr_locked = 1; if (is_shadow_grp && (sgr_open(0100 | 02) == 0)) { fprintf(stderr, gettext("%s: cannot open %s\n"), Prog, sgr_dbname()); fail_exit(10); } } if (vflg || Vflg) { if (sub_uid_lock() == 0) { fprintf(stderr, gettext("%s: cannot lock %s; try again later.\n"), Prog, sub_uid_dbname()); fail_exit(16); } sub_uid_locked = 1; if (sub_uid_open(0100 | 02) == 0) { fprintf(stderr, gettext("%s: cannot open %s\n"), Prog, sub_uid_dbname()); fail_exit(16); } } if (wflg || Wflg) { if (sub_gid_lock() == 0) { fprintf(stderr, gettext("%s: cannot lock %s; try again later.\n"), Prog, sub_gid_dbname()); fail_exit(18); } sub_gid_locked = 1; if (sub_gid_open(0100 | 02) == 0) { fprintf(stderr, gettext("%s: cannot open %s\n"), Prog, sub_gid_dbname()); fail_exit(18); } } }
void open_files() { unsigned long long 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 v13; unsigned long long v14; if (!pw_lock()) { v1 = pw_dbname(); fprintf(*(&stderr), gettext("%s: cannot lock %s; try again later.\n")); fail_exit(0x1); } pw_locked = 1; if (!pw_open(0x42)) { v2 = pw_dbname(); fprintf(*(&stderr), gettext("%s: cannot open %s\n")); fail_exit(0x1); } if (is_shadow_pwd && !spw_lock()) { v3 = spw_dbname(); fprintf(*(&stderr), gettext("%s: cannot lock %s; try again later.\n")); fail_exit(0x1); } spw_locked = 1; if (is_shadow_pwd && !spw_open(0x42)) { v4 = spw_dbname(); fprintf(*(&stderr), gettext("%s: cannot open %s\n")); fail_exit(0x1); } if (Gflg || lflg) { if (!gr_lock()) { v5 = gr_dbname(); fprintf(*(&stderr), gettext("%s: cannot lock %s; try again later.\n")); fail_exit(0xa); } gr_locked = 1; if (!gr_open(0x42)) { v6 = gr_dbname(); fprintf(*(&stderr), gettext("%s: cannot open %s\n")); fail_exit(0xa); } if (is_shadow_grp && !sgr_lock()) { v7 = sgr_dbname(); fprintf(*(&stderr), gettext("%s: cannot lock %s; try again later.\n")); fail_exit(0xa); } sgr_locked = 1; if (is_shadow_grp && !sgr_open(0x42)) { v8 = sgr_dbname(); fprintf(*(&stderr), gettext("%s: cannot open %s\n")); fail_exit(0xa); } } if (vflg || Vflg) { if (!sub_uid_lock()) { v9 = sub_uid_dbname(); fprintf(*(&stderr), gettext("%s: cannot lock %s; try again later.\n")); fail_exit(0x10); } sub_uid_locked = 1; if (!sub_uid_open(0x42)) { v11 = sub_uid_dbname(); fprintf(*(&stderr), gettext("%s: cannot open %s\n")); fail_exit(0x10); } } if (!wflg) { v10 = Wflg; if (!Wflg) return; } if (!sub_gid_lock()) { v13 = sub_gid_dbname(); fprintf(*(&stderr), gettext("%s: cannot lock %s; try again later.\n")); fail_exit(0x12); } sub_gid_locked = 1; if (!sub_gid_open(0x42)) { v14 = sub_gid_dbname(); fprintf(*(&stderr), gettext("%s: cannot open %s\n")); fail_exit(0x12); } return; }
shadow
angr_sailr
static gnutls_x509_trust_list_t load_tl(common_info_st *cinfo) { gnutls_x509_trust_list_t list; int ret; ret = gnutls_x509_trust_list_init(&list, 0); if (ret < 0) { fprintf(stderr, "gnutls_x509_trust_list_init: %s\n", gnutls_strerror(ret)); app_exit(1); } if (cinfo->ca == ((void *)0)) { ret = gnutls_x509_trust_list_add_system_trust(list, 0, 0); if (ret < 0) { fprintf(stderr, "Error loading system trust: %s\n", gnutls_strerror(ret)); app_exit(1); } fprintf(stderr, "Loaded system trust (%d CAs available)\n", ret); } else if (cinfo->ca != ((void *)0)) { ret = gnutls_x509_trust_list_add_trust_file(list, cinfo->ca, cinfo->crl, cinfo->incert_format, 0, 0); if (ret < 0) { int ret2 = gnutls_x509_trust_list_add_trust_file( list, cinfo->ca, cinfo->crl, GNUTLS_X509_FMT_PEM, 0, 0); if (ret2 >= 0) ret = ret2; } if (ret < 0) { fprintf(stderr, "gnutls_x509_trust_add_trust_file: %s\n", gnutls_strerror(ret)); app_exit(1); } fprintf(stderr, "Loaded CAs (%d available)\n", ret); } return list; }
long load_tl(long a1) { const char *v1; const char *v2; const char *v3; int v5; int v6; int v7; int v8; long v9[2]; v9[1] = __readfsqword(0x28u); v5 = gnutls_x509_trust_list_init(v9, 0LL); if (v5 < 0) { v1 = (const char *)gnutls_strerror((unsigned int)v5); fprintf(stderr, "gnutls_x509_trust_list_init: %s\n", v1); app_exit(1); } if (*(_QWORD *)(a1 + 64)) { v7 = gnutls_x509_trust_list_add_trust_file( v9[0], *(_QWORD *)(a1 + 64), *(_QWORD *)(a1 + 56), *(unsigned int *)(a1 + 28), 0LL, 0LL); if (v7 < 0) { v8 = gnutls_x509_trust_list_add_trust_file( v9[0], *(_QWORD *)(a1 + 64), *(_QWORD *)(a1 + 56), 1LL, 0LL, 0LL); if (v8 >= 0) v7 = v8; } if (v7 < 0) { v3 = (const char *)gnutls_strerror((unsigned int)v7); fprintf(stderr, "gnutls_x509_trust_add_trust_file: %s\n", v3); app_exit(1); } fprintf(stderr, "Loaded CAs (%d available)\n", (unsigned int)v7); } else { v6 = gnutls_x509_trust_list_add_system_trust(v9[0], 0LL, 0LL); if (v6 < 0) { v2 = (const char *)gnutls_strerror((unsigned int)v6); fprintf(stderr, "Error loading system trust: %s\n", v2); app_exit(1); } fprintf(stderr, "Loaded system trust (%d CAs available)\n", (unsigned int)v6); } return v9[0]; }
gnutls
ida
static errcode_t recheck_bad_inode_checksum(ext2_filsys fs, ext2_ino_t ino, e2fsck_t ctx, struct problem_context *pctx) { errcode_t retval; struct ext2_inode_large inode; ctx->stashed_ino = 0; retval = ext2fs_read_inode_full(fs, ino, (struct ext2_inode *)&inode, sizeof(inode)); if (retval && retval != (2133571474L)) return retval; if (!retval) return 0; if (!fix_problem(ctx, 0x010068, pctx)) return 0; retval = ext2fs_write_inode_full(fs, ino, (struct ext2_inode *)&inode, sizeof(inode)); return retval; }
long recheck_bad_inode_checksum(undefined8 param_1, undefined4 param_2, long param_3, undefined8 param_4) { int iVar1; long lVar2; long in_FS_OFFSET; undefined local_b8[168]; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); *(undefined4 *)(param_3 + 0x218) = 0; lVar2 = ext2fs_read_inode_full(param_1, param_2, local_b8, 0xa0); if ((lVar2 == 0) || (lVar2 == 0x7f2bb792)) { if (lVar2 == 0) { lVar2 = 0; } else { iVar1 = fix_problem(param_3, 0x10068, param_4); if (iVar1 == 0) { lVar2 = 0; } else { lVar2 = ext2fs_write_inode_full(param_1, param_2, local_b8, 0xa0); } } } if (local_10 == *(long *)(in_FS_OFFSET + 0x28)) { return lVar2; } __stack_chk_fail(); }
e2fsprogs-1.46.5
ghidra
) { sshfatal("loginrec.c", __func__, 390, 0, SYSLOG_LEVEL_FATAL, ((void *)0), "%s: Cannot find user \"%s\"", __func__, li->username); }
void sshfatal(void) { halt_baddata(); }
openssh-portable
ghidra
void sshsk_free_resident_keys(struct sshsk_resident_key **srks, size_t nsrks) { size_t i; if (srks == ((void *)0) || nsrks == 0) return; for (i = 0; i < nsrks; i++) sshsk_free_resident_key(srks[i]); free(srks); }
void sshsk_free_resident_keys(void *a0, unsigned long a1) { void *v0; unsigned long long v2; if (a0 && a1) { for (v0 = 0; v0 < a1; v0 += 1) { sshsk_free_resident_key(*((a0 + 0x8 * v0))); } v2 = free(a0); } return; }
openssh-portable
angr_phoenix
static inline void mark_blocks_used(e2fsck_t ctx, blk64_t block, unsigned int num) { if (ext2fs_test_block_bitmap_range2(ctx->block_found_map, block, num)) ext2fs_mark_block_bitmap_range2(ctx->block_found_map, block, num); else { unsigned int i; for (i = 0; i < num; i += (1 << (ctx->fs)->cluster_ratio_bits)) mark_block_used(ctx, block + i); } }
void mark_blocks_used(struct_0 *a0, unsigned long long a1, unsigned long a2) { unsigned int v0; unsigned long long v3; unsigned long long v4; if (ext2fs_test_block_bitmap_range2(a0->field_1a0, a1, a2, a1)) { v3 = ext2fs_mark_block_bitmap_range2(a0->field_1a0, a1, a2, a1); } else { v0 = 0; while (true) { v4 = v0; if (v0 >= a2) break; mark_block_used(a0, v0 + a1); v0 += (1 << (a0->field_0->field_c0 & 31)); } } return; }
e2fsprogs-1.46.5
angr_dream
timezone_t tzalloc(char const *name) { size_t name_size = name ? strlen(name) + 1 : 0; size_t abbr_size = name_size < ABBR_SIZE_MIN ? ABBR_SIZE_MIN : name_size + 1; timezone_t tz = malloc(((__builtin_offsetof(struct tm_zone, abbrs) + _Alignof(struct tm_zone) - 1 + (abbr_size)) & ~(_Alignof(struct tm_zone) - 1))); if (tz) { tz->next = ((void *)0); tz->tz_is_set = !!name; tz->abbrs[0] = '\0'; if (name) extend_abbrs(tz->abbrs, name, name_size); } return tz; }
undefined8 *tzalloc(char *param_1) { size_t sVar1; ulong uVar2; ulong uVar3; undefined8 *puVar4; if (param_1 == (char *)0x0) { uVar2 = 0; } else { sVar1 = strlen(param_1); uVar2 = sVar1 + 1; } uVar3 = 0x76; if (0x75 < uVar2) { uVar3 = uVar2; } puVar4 = (undefined8 *)malloc(uVar3 + 0x11 & 0xfffffffffffffff8); if (puVar4 != (undefined8 *)0x0) { *puVar4 = 0; *(bool *)(puVar4 + 1) = param_1 != (char *)0x0; *(undefined *)((long)puVar4 + 9) = 0; if (param_1 != (char *)0x0) { extend_abbrs((long)puVar4 + 9, param_1, uVar2); } } return puVar4; }
gnutls
ghidra
__explicit_bzero_hook(void *buf, size_t len) {}
void __explicit_bzero_hook(unsigned long a0, unsigned long a1) { unsigned long v0; unsigned long v1; char v2; unsigned long long v4; v1 = a0; v0 = a1; v4 = *(&v2); return; }
libbsd-0.11.7
angr_sailr
void ssh_clear_newkeys(struct ssh *ssh, int mode) { if (ssh->kex && ssh->kex->newkeys[mode]) { kex_free_newkeys(ssh->kex->newkeys[mode]); ssh->kex->newkeys[mode] = ((void *)0); } }
void ssh_clear_newkeys(struct_0 *a0, unsigned long a1) { unsigned long long v1; unsigned long v2; unsigned long long v3; v1 = a0->field_8; if (!a0->field_8) return; v2 = *((a0->field_8 + a1 * 8)); if (*((a0->field_8 + (a1 << 3)))) { kex_free_newkeys(*((a0->field_8 + a1 * 8))); v3 = a0->field_8; *((a0->field_8 + a1 * 8)) = 0; return; } return; }
openssh-portable
angr_sailr
int cron_set_job_security_context(entry *e, user *u __attribute__((__unused__)), char ***jobenv) { time_t minutely_time = 0; if ((e->flags & 0x01) == 0x01) { minutely_time = time(((void *)0)); if ((DebugFlags & (0x0002)) != 0) printf("Minute-ly job. Recording time %lld\n", (long long)minutely_time); } if (cron_change_groups(e->pwd) != 0) { return -1; } *jobenv = build_env(e->envp); time_t job_run_time = time(((void *)0)); if ((minutely_time > 0) && ((job_run_time / 60) != (minutely_time / 60))) { struct tm tmS, tmN; char buf[256]; localtime_r(&job_run_time, &tmN); localtime_r(&minutely_time, &tmS); snprintf( buf, sizeof(buf), "Job execution of per-minute job scheduled for " "%.2u:%.2u delayed into subsequent minute %.2u:%.2u. Skipping job run.", tmS.tm_hour, tmS.tm_min, tmN.tm_hour, tmN.tm_min); log_it(e->pwd->pw_name, getpid(), "INFO", buf, 0); return -1; } return 0; }
long long cron_set_job_security_context(struct_0 *a0, unsigned long a1, unsigned long long *a2) { unsigned long v0; void *v1; unsigned long v2; char v3; char v4; char v5; char v6; char v7; char v8; char v9; unsigned long long v12; v0 = a1; v1 = 0; if ((a0->field_34 & 1)) { v1 = time(NULL); if ((DebugFlags & 2)) printf("Minute-ly job. Recording time %lld\n", v1); } if (cron_change_groups(a0->field_8)) { v12 = 4294967295; } else { *(a2) = build_env(a0->field_10); v2 = time(NULL); if (v1 > 0 && ((v2 * 9838263505978427529 >> 64) + v2 >> 5) - (v2 >> 63) != ((v1 * 9838263505978427529 >> 64) + v1 >> 5) - (v1 >> 63)) { localtime_r(&v2, &v6); localtime_r(&v1, &v3); snprintf(&v9, 0x100, "Job execution of per-minute job scheduled for %.2u:%.2u " "delayed into subsequent minute %.2u:%.2u. Skipping job run.", *(&v5), *(&v4), *(&v8), *(&v7)); log_it(a0->field_8->field_0, getpid(), "INFO", &v9, 0x0); v12 = 4294967295; } if (v1 <= 0 || ((v2 * 9838263505978427529 >> 64) + v2 >> 5) - (v2 >> 63) == ((v1 * 9838263505978427529 >> 64) + v1 >> 5) - (v1 >> 63)) v12 = 0; } return v12; }
cronie
angr_dream
void clear_hostname_list() { register int i; if (hostname_list_initialized == 0) return; for (i = 0; i < hostname_list_length; i++) sh_xfree((hostname_list[i]), "bashline.c", 882); hostname_list_length = hostname_list_initialized = 0; }
long clear_hostname_list() { long result; int i; result = (unsigned int)hostname_list_initialized; if (hostname_list_initialized) { for (i = 0; i < hostname_list_length; ++i) sh_xfree(*(_QWORD *)(8LL * i + hostname_list), "bashline.c", 882LL); hostname_list_initialized = 0; result = 0LL; hostname_list_length = 0; } return result; }
bash
ida
static void usage(void) { fprintf(stderr, "%s, %s\n", "OpenSSH_9.1" "p1", OpenSSL_version(0)); fprintf(stderr, "usage: sshd [-46DdeiqTt] [-C connection_spec] [-c host_cert_file]\n" " [-E log_file] [-f config_file] [-g login_grace_time]\n" " [-h host_key_file] [-o option] [-p port] [-u len]\n"); exit(1); }
void usage() { const char *v0; v0 = (const char *)OpenSSL_version(0LL); fprintf(stderr, "%s, %s\n", "OpenSSH_9.1p1", v0); fprintf(stderr, "usage: sshd [-46DdeiqTt] [-C connection_spec] [-c host_cert_file]\n" " [-E log_file] [-f config_file] [-g login_grace_time]\n" " [-h host_key_file] [-o option] [-p port] [-u len]\n"); exit(1); }
openssh-portable
ida
static int do_switch(void *arg) { char *netns = arg; vrf_reset(); return netns_switch(netns); }
long do_switch(long a1) { vrf_reset(); return netns_switch(a1); }
iproute2-6.0.0
ida
int zip(in, out) int in, out; { uch flags = 0; ush attr = 0; ush deflate_flags = 0; ulg stamp; ifd = in; ofd = out; outcnt = 0; method = 8; { outbuf[outcnt++] = (uch)("\037\213"[0]); if (outcnt == 0x40000) flush_outbuf(); }; { outbuf[outcnt++] = (uch)("\037\213"[1]); if (outcnt == 0x40000) flush_outbuf(); }; { outbuf[outcnt++] = (uch)(8); if (outcnt == 0x40000) flush_outbuf(); }; if (save_orig_name) { flags |= 0x08; } { outbuf[outcnt++] = (uch)(flags); if (outcnt == 0x40000) flush_outbuf(); }; if (time_stamp.tv_nsec < 0) stamp = 0; else if (0 < time_stamp.tv_sec && time_stamp.tv_sec <= 0xffffffff) stamp = time_stamp.tv_sec; else { warning("file timestamp out of range for gzip format"); stamp = 0; } { { if (outcnt < 0x40000 - 2) { outbuf[outcnt++] = (uch)(((stamp) & 0xffff) & 0xff); outbuf[outcnt++] = (uch)((ush)((stamp) & 0xffff) >> 8); } else { { outbuf[outcnt++] = (uch)((uch)(((stamp) & 0xffff) & 0xff)); if (outcnt == 0x40000) flush_outbuf(); }; { outbuf[outcnt++] = (uch)((uch)((ush)((stamp) & 0xffff) >> 8)); if (outcnt == 0x40000) flush_outbuf(); }; } }; { if (outcnt < 0x40000 - 2) { outbuf[outcnt++] = (uch)((((ulg)(stamp)) >> 16) & 0xff); outbuf[outcnt++] = (uch)((ush)(((ulg)(stamp)) >> 16) >> 8); } else { { outbuf[outcnt++] = (uch)((uch)((((ulg)(stamp)) >> 16) & 0xff)); if (outcnt == 0x40000) flush_outbuf(); }; { outbuf[outcnt++] = (uch)((uch)((ush)(((ulg)(stamp)) >> 16) >> 8)); if (outcnt == 0x40000) flush_outbuf(); }; } }; }; updcrc(((void *)0), 0); bi_init(out); ct_init(&attr, &method); if (level == 1) deflate_flags |= FAST; else if (level == 9) deflate_flags |= SLOW; { outbuf[outcnt++] = (uch)((uch)deflate_flags); if (outcnt == 0x40000) flush_outbuf(); }; { outbuf[outcnt++] = (uch)(0x03); if (outcnt == 0x40000) flush_outbuf(); }; if (save_orig_name) { char *p = gzip_base_name(ifname); do { { outbuf[outcnt++] = (uch)(*p); if (outcnt == 0x40000) flush_outbuf(); }; } while (*p++); } header_bytes = (off_t)outcnt; deflate(level); if (ifile_size != -1L && bytes_in != ifile_size) { fprintf(stderr, "%s: %s: file size changed while zipping\n", program_name, ifname); } { { if (outcnt < 0x40000 - 2) { outbuf[outcnt++] = (uch)(((getcrc()) & 0xffff) & 0xff); outbuf[outcnt++] = (uch)((ush)((getcrc()) & 0xffff) >> 8); } else { { outbuf[outcnt++] = (uch)((uch)(((getcrc()) & 0xffff) & 0xff)); if (outcnt == 0x40000) flush_outbuf(); }; { outbuf[outcnt++] = (uch)((uch)((ush)((getcrc()) & 0xffff) >> 8)); if (outcnt == 0x40000) flush_outbuf(); }; } }; { if (outcnt < 0x40000 - 2) { outbuf[outcnt++] = (uch)((((ulg)(getcrc())) >> 16) & 0xff); outbuf[outcnt++] = (uch)((ush)(((ulg)(getcrc())) >> 16) >> 8); } else { { outbuf[outcnt++] = (uch)((uch)((((ulg)(getcrc())) >> 16) & 0xff)); if (outcnt == 0x40000) flush_outbuf(); }; { outbuf[outcnt++] = (uch)((uch)((ush)(((ulg)(getcrc())) >> 16) >> 8)); if (outcnt == 0x40000) flush_outbuf(); }; } }; }; { { if (outcnt < 0x40000 - 2) { outbuf[outcnt++] = (uch)((((ulg)bytes_in) & 0xffff) & 0xff); outbuf[outcnt++] = (uch)((ush)(((ulg)bytes_in) & 0xffff) >> 8); } else { { outbuf[outcnt++] = (uch)((uch)((((ulg)bytes_in) & 0xffff) & 0xff)); if (outcnt == 0x40000) flush_outbuf(); }; { outbuf[outcnt++] = (uch)((uch)((ush)(((ulg)bytes_in) & 0xffff) >> 8)); if (outcnt == 0x40000) flush_outbuf(); }; } }; { if (outcnt < 0x40000 - 2) { outbuf[outcnt++] = (uch)((((ulg)((ulg)bytes_in)) >> 16) & 0xff); outbuf[outcnt++] = (uch)((ush)(((ulg)((ulg)bytes_in)) >> 16) >> 8); } else { { outbuf[outcnt++] = (uch)((uch)((((ulg)((ulg)bytes_in)) >> 16) & 0xff)); if (outcnt == 0x40000) flush_outbuf(); }; { outbuf[outcnt++] = (uch)((uch)((ush)(((ulg)((ulg)bytes_in)) >> 16) >> 8)); if (outcnt == 0x40000) flush_outbuf(); }; } }; }; header_bytes += 2 * 4; flush_outbuf(); return 0; }
long zip(int a1, unsigned int a2) { int v2; int v3; int v4; int v5; int v6; int v7; int v8; int v9; int v10; int v11; int v12; int v13; char v14; int v15; char *v16; char v17; int v18; char v19; int v20; char v21; int v22; char v23; int v24; char v25; int v26; char v27; int v28; unsigned long v29; int v30; char v31; int v32; int v33; int v34; int v35; int v36; int v37; int v38; int v39; int v40; char v42; short v43; short v44; long v45; char *v46; unsigned long v47; v47 = __readfsqword(0x28u); v42 = 0; v43 = 0; v44 = 0; ifd = a1; ofd = a2; method = 8; outbuf[0] = 31; outcnt = 2; outbuf[1] = -117; if (outcnt == 0x40000) flush_outbuf(); v2 = outcnt++; outbuf[v2] = 8; if (outcnt == 0x40000) flush_outbuf(); if (save_orig_name) v42 = 8; v3 = outcnt++; outbuf[v3] = v42; if (outcnt == 0x40000) flush_outbuf(); if (*((long *)&time_stamp + 1) >= 0) { if (time_stamp <= 0 || time_stamp > 0xFFFFFFFFLL) { warning("file timestamp out of range for gzip format"); v45 = 0LL; } else { v45 = time_stamp; } } else { v45 = 0LL; } if (outcnt > 0x3FFFDu) { v6 = outcnt++; outbuf[v6] = v45; if (outcnt == 0x40000) flush_outbuf(); v7 = outcnt++; outbuf[v7] = BYTE1(v45); if (outcnt == 0x40000) flush_outbuf(); } else { v4 = outcnt++; outbuf[v4] = v45; v5 = outcnt++; outbuf[v5] = BYTE1(v45); } if (outcnt > 0x3FFFDu) { v10 = outcnt++; outbuf[v10] = BYTE2(v45); if (outcnt == 0x40000) flush_outbuf(); v11 = outcnt++; outbuf[v11] = BYTE3(v45); if (outcnt == 0x40000) flush_outbuf(); } else { v8 = outcnt++; outbuf[v8] = BYTE2(v45); v9 = outcnt++; outbuf[v9] = BYTE3(v45); } updcrc(0LL, 0LL); bi_init(a2); ct_init(&v43, &method); if (level == 1) { v44 |= 4u; } else if (level == 9) { v44 |= 2u; } v12 = outcnt++; outbuf[v12] = v44; if (outcnt == 0x40000) flush_outbuf(); v13 = outcnt++; outbuf[v13] = 3; if (outcnt == 0x40000) flush_outbuf(); if (save_orig_name) { v46 = (char *)gzip_base_name(&ifname); do { v14 = *v46; v15 = outcnt++; outbuf[v15] = v14; if (outcnt == 0x40000) flush_outbuf(); v16 = v46++; } while (*v16); } header_bytes = outcnt; deflate(level); if (ifile_size != -1LL && bytes_in != ifile_size) fprintf(stderr, "%s: %s: file size changed while zipping\n", program_name, (const char *)&ifname); if (outcnt > 0x3FFFDu) { v21 = getcrc(); v22 = outcnt++; outbuf[v22] = v21; if (outcnt == 0x40000) flush_outbuf(); v23 = (unsigned short)getcrc() >> 8; v24 = outcnt++; outbuf[v24] = v23; if (outcnt == 0x40000) flush_outbuf(); } else { v17 = getcrc(); v18 = outcnt++; outbuf[v18] = v17; v19 = (unsigned short)getcrc() >> 8; v20 = outcnt++; outbuf[v20] = v19; } if (outcnt > 0x3FFFDu) { v29 = (unsigned long)getcrc() >> 16; v30 = outcnt++; outbuf[v30] = v29; if (outcnt == 0x40000) flush_outbuf(); v31 = (unsigned int)getcrc() >> 24; v32 = outcnt++; outbuf[v32] = v31; if (outcnt == 0x40000) flush_outbuf(); } else { v25 = (unsigned int)getcrc() >> 16; v26 = outcnt++; outbuf[v26] = v25; v27 = (unsigned int)getcrc() >> 24; v28 = outcnt++; outbuf[v28] = v27; } if (outcnt > 0x3FFFDu) { v35 = outcnt++; outbuf[v35] = bytes_in; if (outcnt == 0x40000) flush_outbuf(); v36 = outcnt++; outbuf[v36] = *(&bytes_in + 1); if (outcnt == 0x40000) flush_outbuf(); } else { v33 = outcnt++; outbuf[v33] = bytes_in; v34 = outcnt++; outbuf[v34] = *(&bytes_in + 1); } if (outcnt > 0x3FFFDu) { v39 = outcnt++; outbuf[v39] = *(&bytes_in + 2); if (outcnt == 0x40000) flush_outbuf(); v40 = outcnt++; outbuf[v40] = *(&bytes_in + 3); if (outcnt == 0x40000) flush_outbuf(); } else { v37 = outcnt++; outbuf[v37] = *(&bytes_in + 2); v38 = outcnt++; outbuf[v38] = *(&bytes_in + 3); } header_bytes += 8LL; flush_outbuf(); return 0LL; }
gzip-1.12
ida
static _Bool wc_lines(char const *file, int fd, uintmax_t *lines_out, uintmax_t *bytes_out) { size_t bytes_read; uintmax_t lines, bytes; char buf[(16 * 1024) + 1]; _Bool long_lines = 0; if (!lines_out || !bytes_out) { return 0; } lines = bytes = 0; while ((bytes_read = safe_read(fd, buf, (16 * 1024))) > 0) { if (bytes_read == ((size_t)-1)) { error(0, (*__errno_location()), "%s", quotearg_n_style_colon(0, shell_escape_quoting_style, file)); return 0; } bytes += bytes_read; char *p = buf; char *end = buf + bytes_read; uintmax_t plines = lines; if (!long_lines) { while (p != end) lines += *p++ == '\n'; } else { *end = '\n'; while ((p = rawmemchr(p, '\n')) < end) { ++p; ++lines; } } if (lines - plines <= bytes_read / 15) long_lines = 1; else long_lines = 0; } *bytes_out = bytes; *lines_out = lines; return 1; }
int wc_lines() { char v0; int tmp_14; void *v1; void *v2; char *v3; unsigned long v4; char *v5; void *v6; char v7; char v8; unsigned long long v9; unsigned long v10; unsigned long v11; char v13; char v14; unsigned long v15; unsigned long long *v16; unsigned long long *v17; unsigned long long *v18; unsigned int v19; unsigned long v21; unsigned long long v22; unsigned long long v23; unsigned long long v24; unsigned long long v25; v11 = v15; do { v9 = *(&v9); } while (&v9 != &v8); v10 = v16[5]; v0 = 0; if (!v17) { LABEL_4009e0: } else { if (!v18) goto LABEL_4009e0; v2 = 0; v1 = v2; while (true) { v4 = safe_read(v19, &v7, 0x4000, &v7); if (!v4) { *(v18) = v2; *(v17) = v1; break; } else if (v4 != -1) { v2 += v4; v3 = &v7; v5 = &(&v7)[v4]; if (!(v0 ^ 1)) { *(v5) = 10; while (true) { v3 = rawmemchr(v3, 0xa); if (v3 >= v5) break; v3 += 1; v1 += 1; } } else { for (v6 = v1; v3 != v5; v1 += v21) { tmp_14 = v3; v3 += 1; v21 = *(tmp_14) == 10; } } if (v1 - v6 <= v4 * 9838263505978427529 >> 64 >> 3) v0 = 1; else v0 = 0; } else { v23 = quotearg_n_style_colon(0x0, 0x3, v22); error(0x0, *(__errno_location()), "%s"); break; } } } if (!(v10 ^ v16[5])) { v24 = *(&v13); v25 = *(&v14); return; } __stack_chk_fail(); }
coreutils
angr_phoenix
static _Bool make_dir_parents_private(char const *const_dir, size_t src_offset, int dst_dirfd, char const *verbose_fmt_string, struct dir_attr **attr_list, _Bool *new_dst, const struct cp_options *x) { struct stat stats; char *dir; char *src; char *dst_dir; idx_t dirlen = dir_len(const_dir); *attr_list = ((void *)0); if (dirlen <= src_offset) return 1; do { dir = (__extension__({ const char *__old = (const_dir); size_t __len = strlen(__old) + 1; char *__new = (char *)__builtin_alloca(__len); (char *)memcpy(__new, __old, __len); })); } while (0); src = dir + src_offset; dst_dir = __builtin_alloca(dirlen + 1); memcpy(dst_dir, dir, dirlen); dst_dir[dirlen] = '\0'; char const *dst_reldir = dst_dir + src_offset; while (*dst_reldir == '/') dst_reldir++; if (fstatat(dst_dirfd, dst_reldir, &stats, 0) != 0) { char *slash; slash = src; while (*slash == '/') slash++; dst_reldir = slash; while ((slash = strchr(slash, '/'))) { struct dir_attr *new; _Bool missing_dir; *slash = '\0'; missing_dir = fstatat(dst_dirfd, dst_reldir, &stats, 0) != 0; if (missing_dir || x->preserve_ownership || x->preserve_mode || x->preserve_timestamps) { struct stat src_st; int src_errno = (stat(src, &src_st) != 0 ? (*__errno_location()) : ((((src_st.st_mode)) & 0170000) == (0040000)) ? 0 : 20); if (src_errno) { error(0, src_errno, gettext("failed to get attributes of %s"), quotearg_style(shell_escape_always_quoting_style, src)); return 0; } new = xmalloc(sizeof *new); new->st = src_st; new->slash_offset = slash - dir; new->restore_mode = 0; new->next = *attr_list; *attr_list = new; } if (!set_process_security_ctx(src, dir, missing_dir ? new->st.st_mode : 0, missing_dir, x)) return 0; if (missing_dir) { mode_t src_mode; mode_t omitted_permissions; mode_t mkdir_mode; *new_dst = 1; src_mode = new->st.st_mode; omitted_permissions = (src_mode & (x->preserve_ownership ? ((0400 | 0200 | 0100) >> 3) | (((0400 | 0200 | 0100) >> 3) >> 3) : x->preserve_mode ? (0200 >> 3) | ((0200 >> 3) >> 3) : 0)); mkdir_mode = x->explicit_no_preserve_mode ? ((0400 | 0200 | 0100) | ((0400 | 0200 | 0100) >> 3) | (((0400 | 0200 | 0100) >> 3) >> 3)) : src_mode; mkdir_mode &= (04000 | 02000 | 01000 | (0400 | 0200 | 0100) | ((0400 | 0200 | 0100) >> 3) | (((0400 | 0200 | 0100) >> 3) >> 3)) & ~omitted_permissions; if (mkdirat(dst_dirfd, dst_reldir, mkdir_mode) != 0) { error(0, (*__errno_location()), gettext("cannot make directory %s"), quotearg_style(shell_escape_always_quoting_style, dir)); return 0; } else { if (verbose_fmt_string != ((void *)0)) printf(verbose_fmt_string, src, dir); } if (fstatat(dst_dirfd, dst_reldir, &stats, 0x100)) { error(0, (*__errno_location()), gettext("failed to get attributes of %s"), quotearg_style(shell_escape_always_quoting_style, dir)); return 0; } if (!x->preserve_mode) { if (omitted_permissions & ~stats.st_mode) omitted_permissions &= ~cached_umask(); if (omitted_permissions & ~stats.st_mode || (stats.st_mode & (0400 | 0200 | 0100)) != (0400 | 0200 | 0100)) { new->st.st_mode = stats.st_mode | omitted_permissions; new->restore_mode = 1; } } mode_t accessible = stats.st_mode | (0400 | 0200 | 0100); if (stats.st_mode != accessible) { if (lchmodat(dst_dirfd, dst_reldir, accessible) != 0) { error(0, (*__errno_location()), gettext("setting permissions for %s"), quotearg_style(shell_escape_always_quoting_style, dir)); return 0; } } } else if (!((((stats.st_mode)) & 0170000) == (0040000))) { error(0, 0, gettext("%s exists but is not a directory"), quotearg_style(shell_escape_always_quoting_style, dir)); return 0; } else *new_dst = 0; if (!*new_dst && (x->set_security_context || x->preserve_security_context)) { if (!set_file_security_ctx(dir, 0, x) && x->require_preserve_context) return 0; } *slash++ = '/'; while (*slash == '/') slash++; } } else if (!((((stats.st_mode)) & 0170000) == (0040000))) { error(0, 0, gettext("%s exists but is not a directory"), quotearg_style(shell_escape_always_quoting_style, dst_dir)); return 0; } else { *new_dst = 0; } return 1; }
int make_dir_parents_private(void *a0, unsigned long a1, unsigned long a2, char *a3, unsigned long long *a4, char *a5, unsigned long long v39) { char v0; struct_1 *v1; char v2; unsigned int v3; unsigned int v4; unsigned int v5; unsigned int v6; unsigned int v7; char *v8; char *v9; struct_0 *v10; unsigned long long v11; unsigned int v12; unsigned long long v13; void *v14; char *v15; unsigned long long v16; char 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; char v31; char v32; char v33; char v34; char v35; char v36; unsigned long long v37; char v38; unsigned long v40; unsigned long long v41; unsigned long v42; unsigned long long v43; unsigned long long v44; unsigned long long v45; unsigned long long v46; unsigned long long v47; v1 = v39; v11 = dir_len(a0); *(a4) = 0; if (a1 >= v11) { v40 = 1; } else { for (*(&v12) = strlen(a0) + 1; &v38 != &(&v0)[-1 * ((0 CONCAT 15 + *(&v12) + 8) / m 16 * 16 & -0x1000)]; v37 = v37) ; if ((((0 CONCAT 15 + *(&v12) + 8) / m 16 * 16) & 4095)) *((&v37 + (((0 CONCAT 15 + *(&v12) + 8) / m 16 * 16) & 4095))) = *((&v37 + (((0 CONCAT 15 + *(&v12) + 8) / m 16 * 16) & 4095))); v13 = (&v39 >> 4) * 16; v14 = memcpy(v13, a0, *(&v12)); for (v15 = a1 + v14; &v38 != &(&v38)[-1 * ((0 CONCAT 15 + v11 + 9) / m 16 * 16 & -0x1000)]; v37 = v37) ; if ((((0 CONCAT 15 + v11 + 9) / m 16 * 16) & 4095)) *((&v37 + (((0 CONCAT 15 + v11 + 9) / m 16 * 16) & 4095))) = *((&v37 + (((0 CONCAT 15 + v11 + 9) / m 16 * 16) & 4095))); v16 = (&v39 >> 4) * 16; memcpy(v16, v14, v11); *((v16 + v11)) = 0; for (v8 = a1 + v16; *(v8) == 47; v8 += 1) ; if (fstatat(a2, v8, &v17, 0x0)) { for (v9 = v15; *(v9) == 47; v9 += 1) ; v8 = v9; while (true) { v40 = strchr(v9, 0x2f); v9 = v40; if (!v9) break; *(v9) = 0; *(&v40) = fstatat(a2, v8, &v17, 0x0); v2 = *(&v40); if (!v2 && !v1->field_1d && !v1->field_1e && !v1->field_1f) goto LABEL_400e5c; if (stat(v15, &v19)) { *(&v40) = *(__errno_location()); } else { if ((*(&v22) & 0xf000) != 0x4000) *(&v40) = 20; else *(&v40) = 0; } v4 = v40; if (v4) { v44 = quotearg_style(0x4, v15); error(0x0, v4, gettext("failed to get attributes of %s")); *(&v40) = 0; goto LABEL_4012fd; } else { v10 = xmalloc(0xa8); v10->field_0 = *(&v19); v10->field_8 = *(&v20); v10->field_10 = *(&v21); *(&v10->field_18) = *(&v22); v10->field_20 = *(&v23); v10->field_28 = *(&v24); v10->field_30 = *(&v25); v10->field_38 = *(&v26); v10->field_40 = *(&v27); v10->field_48 = *(&v28); v10->field_50 = *(&v29); v10->field_58 = *(&v30); v10->field_60 = *(&v31); v10->field_68 = *(&v32); v10->field_70 = *(&v33); v10->field_78 = *(&v34); v10->field_80 = *(&v35); v10->field_88 = *(&v36); v10->field_98 = v9 - v14; v10->field_90 = 0; v10->field_a0 = *(a4); *(a4) = v10; } LABEL_400e5c: if (v2) v40 = *(&v10->field_18); else v40 = 0; *(&v40) = set_process_security_ctx(v15, v14, v40, v2, v1) ^ 1; if (v40) { *(&v40) = 0; goto LABEL_4012fd; } if (!v2) { if ((*(&v18) & 0xf000) == 0x4000) { *(a5) = 0; } else { v43 = quotearg_style(0x4, v14); error(0x0, 0x0, gettext("%s exists but is not a directory")); *(&v40) = 0; goto LABEL_4012fd; } if ((*(a5) ^ 1)) { if (!v1->field_28 && !v1->field_33) goto LABEL_401240; *(&v40) = set_file_security_ctx(v14, 0x0, v1) ^ 1; if (v40 && v1->field_34) { *(&v40) = 0; goto LABEL_4012fd; } } LABEL_401240: v42 = v9; v9 += 1; for (*(v42) = 47; *(v9) == 47; v9 += 1) ; } else { *(a5) = 1; v5 = *(&v10->field_18); if (!(v1->field_1d ^ 1)) { *(&v40) = 63; } else { if (!v1->field_1e) *(&v40) = 0; else *(&v40) = 18; } v3 = v40 & v5; if (!v1->field_20) *(&v40) = v5; else *(&v40) = 511; v6 = v40; v6 = !(v3)&v6 & 4095; if (mkdirat(a2, v8, v6, v8)) { v45 = quotearg_style(0x4, v14); error(0x0, *(__errno_location()), gettext("cannot make directory %s")); *(&v40) = 0; goto LABEL_4012fd; } if (a3) printf(a3); if (fstatat(a2, v8, &v17, 0x100)) { v46 = quotearg_style(0x4, v14); error(0x0, *(__errno_location()), gettext("failed to get attributes of %s")); *(&v40) = 0; goto LABEL_4012fd; } if ((v1->field_1e ^ 1)) { if ((!(*(&v18)) & v3)) { *(&v40) = !(cached_umask()); v3 &= v40; } if (!(!(*(&v18)) & v3) && (*(&v18) & 448) == 448) goto LABEL_4010dc; *(&v10->field_18) = *(&v18) | v3; v10->field_90 = 1; } LABEL_4010dc: v7 = *(&v18) | 448; if (v7 != *(&v18) && lchmodat(a2, v8, v7, v8)) { v47 = quotearg_style(0x4, v14); error(0x0, *(__errno_location()), gettext("setting permissions for %s")); *(&v40) = 0; goto LABEL_4012fd; } } } } else if ((*(&v18) & 0xf000) == 0x4000) { *(a5) = 0; } else { v41 = quotearg_style(0x4, v16); error(0x0, 0x0, gettext("%s exists but is not a directory")); v40 = 0; goto LABEL_4012fd; } *(&v40) = 1; } LABEL_4012fd: return v40; }
coreutils
angr_phoenix
uintmax_t strtou(const char *__restrict nptr, char **__restrict endptr, int base, uintmax_t lo, uintmax_t hi, int *rstatus) { int serrno; uintmax_t im; char *ep; int rep; ; ; if (endptr == ((void *)0)) endptr = &ep; if (rstatus == ((void *)0)) rstatus = &rep; serrno = (*__errno_location()); (*__errno_location()) = 0; im = strtoumax(nptr, endptr, base); *rstatus = (*__errno_location()); (*__errno_location()) = serrno; if (*rstatus == 0) { if (nptr == *endptr) *rstatus = 125; else if (**endptr != '\0') *rstatus = 95; } if (im < lo) { if (*rstatus == 0) *rstatus = 34; return lo; } if (im > hi) { if (*rstatus == 0) *rstatus = 34; return hi; } return im; }
long long strtou(char *a0, char **a1, unsigned long a2, unsigned long long a3, unsigned long long a4, unsigned long a5) { unsigned int *v0; char **v1; char v2; unsigned int v3; char v4; unsigned long long v5; unsigned long long v7; v1 = a1; v0 = a5; if (!v1) v1 = &v4; if (!v0) v0 = &v2; v3 = *(__errno_location()); *(__errno_location()) = 0; v5 = strtoumax(a0, v1, a2); *(v0) = *(__errno_location()); *(__errno_location()) = v3; if (!*(v0)) { if (a0 == *(v1)) { *(v0) = 125; } else if (*(*(v1))) { *(v0) = 95; } } if (v5 < a3) { if (!*(v0)) *(v0) = 34; v7 = a3; return v7; } else if (v5 > a4) { if (!*(v0)) *(v0) = 34; v7 = a4; return v7; } else { v7 = v5; return v7; } }
libbsd-0.11.7
angr_sailr
void rl_add_undo(enum undo_code what, int start, int end, char *text) { UNDO_LIST *temp; temp = alloc_undo_entry(what, start, end, text); temp->next = rl_undo_list; rl_undo_list = temp; }
void rl_add_undo(undefined4 param_1, undefined4 param_2, undefined4 param_3, undefined8 param_4) { undefined8 *puVar1; puVar1 = (undefined8 *)alloc_undo_entry(param_1, param_2, param_3, param_4); *puVar1 = rl_undo_list; rl_undo_list = puVar1; return; }
bash
ghidra
WORD_LIST *array_keys_to_word_list(a) ARRAY *a; { WORD_LIST *list; ARRAY_ELEMENT *ae; char *t; if (a == 0 || ((a)->num_elements == 0)) return ((WORD_LIST *)((void *)0)); list = (WORD_LIST *)((void *)0); for (ae = ((a->head)->next); ae != a->head; ae = ((ae)->next)) { t = itos(((ae)->ind)); list = make_word_list(make_bare_word(t), list); sh_xfree((t), "array.c", 791); } return (((list && list->next) ? (WORD_LIST *)list_reverse((GENERIC_LIST *)list) : (WORD_LIST *)(list))); }
long long array_keys_to_word_list(struct_0 *a0) { void *v0; unsigned long long v1[3]; unsigned long long v2; void *v4; unsigned long long v5; if (!a0) { LABEL_40166b: v4 = 0; } else { if (!a0->field_8) goto LABEL_40166b; v0 = 0; for (v1[0] = a0->field_10->field_10; v1 != a0->field_10; v1[0] = v1[2]) { v2 = itos(v1[0]); v5 = make_bare_word(v2); v0 = make_word_list(v5, v0, v5); sh_xfree(v2, "array.c", 0x317); } if (v0 && *(v0)) { v4 = list_reverse(v0); goto LABEL_401720; } v4 = v0; } LABEL_401720: return v4; }
bash
angr_phoenix
static void free_dest_constraint_hop(struct dest_constraint_hop *dch) { u_int i; if (dch == ((void *)0)) return; free(dch->user); free(dch->hostname); for (i = 0; i < dch->nkeys; i++) sshkey_free(dch->keys[i]); free(dch->keys); free(dch->key_is_ca); }
void free_dest_constraint_hop(long a1) { unsigned int i; if (a1) { free(*(void **)a1); free(*(void **)(a1 + 8)); for (i = 0; i < *(_DWORD *)(a1 + 20); ++i) sshkey_free(*(_QWORD *)(8LL * i + *(_QWORD *)(a1 + 24))); free(*(void **)(a1 + 24)); free(*(void **)(a1 + 32)); } }
openssh-portable
ida
int do_xfrm_monitor(int argc, char **argv) { char *file = ((void *)0); unsigned int groups = ~((unsigned)0); int lacquire = 0; int lexpire = 0; int laevent = 0; int lpolicy = 0; int lsa = 0; int lreport = 0; rtnl_close(&rth); while (argc > 0) { if (matches(*argv, "file") == 0) { do { argv++; if (--argc <= 0) incomplete_command(); } while (0); file = *argv; } else if (strcmp(*argv, "nokeys") == 0) { nokeys = 1; } else if (strcmp(*argv, "all") == 0) { } else if (matches(*argv, "all-nsid") == 0) { listen_all_nsid = 1; } else if (matches(*argv, "acquire") == 0) { lacquire = 1; groups = 0; } else if (matches(*argv, "expire") == 0) { lexpire = 1; groups = 0; } else if (matches(*argv, "SA") == 0) { lsa = 1; groups = 0; } else if (matches(*argv, "aevent") == 0) { laevent = 1; groups = 0; } else if (matches(*argv, "policy") == 0) { lpolicy = 1; groups = 0; } else if (matches(*argv, "report") == 0) { lreport = 1; groups = 0; } else if (matches(*argv, "help") == 0) { usage(); } else { fprintf(stderr, "Argument \"%s\" is unknown, try \"ip xfrm monitor help\".\n", *argv); exit(-1); } argc--; argv++; } if (lacquire) groups |= nl_mgrp(XFRMNLGRP_ACQUIRE); if (lexpire) groups |= nl_mgrp(XFRMNLGRP_EXPIRE); if (lsa) groups |= nl_mgrp(XFRMNLGRP_SA); if (lpolicy) groups |= nl_mgrp(XFRMNLGRP_POLICY); if (laevent) groups |= nl_mgrp(XFRMNLGRP_AEVENTS); if (lreport) groups |= nl_mgrp(XFRMNLGRP_REPORT); if (file) { FILE *fp; int err; fp = fopen(file, "r"); if (fp == ((void *)0)) { perror("Cannot fopen"); exit(-1); } err = rtnl_from_file(fp, xfrm_accept_msg, stdout); fclose(fp); return err; } if (rtnl_open_byproto(&rth, groups, 6) < 0) exit(1); if (listen_all_nsid && rtnl_listen_all_nsid(&rth) < 0) exit(1); if (rtnl_listen(&rth, xfrm_accept_msg, (void *)stdout) < 0) exit(2); return 0; }
long do_xfrm_monitor(int a1, char **a2) { unsigned int v5; int v6; int v7; int v8; int v9; int v10; int v11; unsigned int v12; char *filename; FILE *stream; filename = 0LL; v5 = -1; v6 = 0; v7 = 0; v8 = 0; v9 = 0; v10 = 0; v11 = 0; rtnl_close(&rth); while (a1 > 0) { if ((unsigned char)matches(*a2, "file") != 1) { ++a2; if (--a1 <= 0) incomplete_command(); filename = *a2; } else if (!strcmp(*a2, "nokeys")) { nokeys = 1; } else if (strcmp(*a2, "all")) { if ((unsigned char)matches(*a2, "all-nsid") != 1) { listen_all_nsid = 1; } else if ((unsigned char)matches(*a2, "acquire") != 1) { v6 = 1; v5 = 0; } else if ((unsigned char)matches(*a2, "expire") != 1) { v7 = 1; v5 = 0; } else if ((unsigned char)matches(*a2, "SA") != 1) { v10 = 1; v5 = 0; } else if ((unsigned char)matches(*a2, "aevent") != 1) { v8 = 1; v5 = 0; } else if ((unsigned char)matches(*a2, "policy") != 1) { v9 = 1; v5 = 0; } else { if ((unsigned char)matches(*a2, "report") == 1) { if ((unsigned char)matches(*a2, "help") != 1) usage(); fprintf(stderr, "Argument \"%s\" is unknown, try \"ip xfrm monitor help\".\n", *a2); exit(-1); } v11 = 1; v5 = 0; } } --a1; ++a2; } if (v6) v5 |= nl_mgrp(1u); if (v7) v5 |= nl_mgrp(2u); if (v10) v5 |= nl_mgrp(3u); if (v9) v5 |= nl_mgrp(4u); if (v8) v5 |= nl_mgrp(5u); if (v11) v5 |= nl_mgrp(6u); if (filename) { stream = fopen64(filename, "r"); if (!stream) { perror("Cannot fopen"); exit(-1); } v12 = rtnl_from_file(stream, xfrm_accept_msg, stdout); fclose(stream); return v12; } else { if ((int)rtnl_open_byproto(&rth, v5, 6LL) < 0) exit(1); if (listen_all_nsid && (int)rtnl_listen_all_nsid(&rth) < 0) exit(1); if ((int)rtnl_listen(&rth, xfrm_accept_msg, stdout) < 0) exit(2); return 0LL; } }
iproute2-6.0.0
ida
static void print_progress(unsigned long start_lineno, unsigned long current_lineno, unsigned long end_lineno) { static time_t time_start, time_prev; time_t time_now, elapsed; unsigned long num_to_process, processed, remaining, percent, eta; double time_per_line; char *eta_str; time_now = monotime(); if (time_start == 0) { time_start = time_prev = time_now; return; } if (time_now - time_prev < 5 * 60) return; time_prev = time_now; elapsed = time_now - time_start; processed = current_lineno - start_lineno; remaining = end_lineno - current_lineno; num_to_process = end_lineno - start_lineno; time_per_line = (double)elapsed / processed; time(&time_now); if (end_lineno == (0x7fffffffffffffffL * 2UL + 1UL)) { sshlog("moduli.c", __func__, 557, 0, SYSLOG_LEVEL_INFO, ((void *)0), "%.24s processed %lu in %s", ctime(&time_now), processed, fmt_time(elapsed)); return; } percent = 100 * processed / num_to_process; eta = time_per_line * remaining; eta_str = xstrdup(fmt_time(eta)); sshlog("moduli.c", __func__, 564, 0, SYSLOG_LEVEL_INFO, ((void *)0), "%.24s processed %lu of %lu (%lu%%) in %s, ETA %s", ctime(&time_now), processed, num_to_process, percent, fmt_time(elapsed), eta_str) ; free(eta_str); }
unsigned long print_progress(long a1, long a2, long a3) { long v3; unsigned long v4; double v5; char *v6; char *v7; double v8; double v9; char *v10; char *v11; char *v12; time_t timer; long v17; long v18; unsigned long v19; unsigned long v20; double v21; unsigned long v22; long v23; void *ptr; unsigned long v25; v25 = __readfsqword(0x28u); timer = monotime(); if (time_start_17760) { if (timer - time_prev_17761 > 299) { time_prev_17761 = timer; v17 = timer - time_start_17760; v18 = a2 - a1; v19 = a3 - a2; v20 = a3 - a1; v4 = a2 - a1; if (a2 - a1 < 0) v5 = (double)(int)(v4 & 1 | (v4 >> 1)) + (double)(int)(v4 & 1 | (v4 >> 1)); else v5 = (double)(int)v4; v21 = (double)((int)timer - (int)time_start_17760) / v5; time(&timer); if (a3 == -1) { v6 = fmt_time(v17); v7 = ctime(&timer); sshlog("moduli.c", "print_progress", 557LL, 0LL, 3LL, 0LL, "%.24s processed %lu in %s", v7, v18, v6); } else { v22 = 100 * v18 / v20; if ((v19 & 0x8000000000000000LL) != 0LL) v8 = (double)(int)(v19 & 1 | (v19 >> 1)) + (double)(int)(v19 & 1 | (v19 >> 1)); else v8 = (double)(int)v19; v9 = v8 * v21; if (v9 >= 9.223372036854776e18) { v23 = (unsigned int)(int)(v9 - 9.223372036854776e18); v23 ^= 0x8000000000000000LL; } else { v23 = (unsigned int)(int)v9; } v10 = fmt_time(v23); ptr = (void *)xstrdup(v10, v3); v11 = fmt_time(v17); v12 = ctime(&timer); sshlog("moduli.c", "print_progress", 564LL, 0LL, 3LL, 0LL, "%.24s processed %lu of %lu (%lu%%) in %s, ETA %s", v12, v18, v20, v22, v11, (const char *)ptr); free(ptr); } } } else { time_prev_17761 = timer; time_start_17760 = timer; } return __readfsqword(0x28u) ^ v25; }
openssh-portable
ida
enum RM_status rm(char *const *file, struct rm_options const *x) { enum RM_status rm_status = RM_OK; if (*file) { int bit_flags = (0x0200 | 0x0008 | 0x0010); if (x->one_file_system) bit_flags |= 0x0040; FTS *fts = xfts_open(file, 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")); rm_status = RM_ERROR; } break; } enum RM_status s = rm_fts(fts, ent, x); ((void)sizeof( (((s) == RM_OK || (s) == RM_USER_DECLINED || (s) == RM_ERROR)) ? 1 : 0), __extension__({ if (((s) == RM_OK || (s) == RM_USER_DECLINED || (s) == RM_ERROR)) ; else __assert_fail("VALID_STATUS (s)", "src/remove.c", 611, __extension__ __PRETTY_FUNCTION__); })); do { if ((s) == RM_ERROR || ((s) == RM_USER_DECLINED && (rm_status) == RM_OK)) (rm_status) = (s); } while (0); } if (rpl_fts_close(fts) != 0) { error(0, (*__errno_location()), gettext("fts_close failed")); rm_status = RM_ERROR; } } return rm_status; }
long rm(_QWORD *a1, long a2) { char *v2; int *v3; char *v4; int *v5; unsigned int v7; unsigned int v8; unsigned int v9; long v10; long v11; v7 = 2; if (*a1) { v8 = 536; if (*(_BYTE *)(a2 + 8)) v8 = 600; v10 = xfts_open(a1, v8, 0LL); while (1) { v11 = rpl_fts_read(v10); if (!v11) break; v9 = rm_fts(v10, v11, a2); if (v9 != 2 && v9 != 3 && v9 != 4) _assert_fail("VALID_STATUS (s)", "src/remove.c", 0x263u, "rm"); if (v9 == 4 || v9 == 3 && v7 == 2) v7 = v9; } if (*_errno_location()) { v2 = gettext("fts_read failed"); v3 = _errno_location(); error(0, *v3, v2); v7 = 4; } if ((unsigned int)rpl_fts_close(v10)) { v4 = gettext("fts_close failed"); v5 = _errno_location(); error(0, *v5, v4); return 4; } } return v7; }
coreutils
ida
static void code_string(char const *string, char const *keyword, struct xheader *xhdr) { char *outstr; if (!utf8_convert(1, string, &outstr)) { outstr = xstrdup(string); } xheader_print(xhdr, keyword, outstr); free(outstr); }
void code_string(undefined8 param_1, undefined8 param_2, undefined8 param_3) { char cVar1; long in_FS_OFFSET; void *local_18; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); cVar1 = utf8_convert(1, param_1, &local_18); if (cVar1 != '\x01') { local_18 = (void *)xstrdup(param_1); } xheader_print(param_3, param_2, local_18); free(local_18); if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) { __stack_chk_fail(); } return; }
tar
ghidra
void _rl_add_macro_char(int c) { if (current_macro_index + 1 >= current_macro_size) { if (current_macro == 0) current_macro = (char *)xmalloc(current_macro_size = 25); else current_macro = (char *)xrealloc(current_macro, current_macro_size += 25); } current_macro[current_macro_index++] = c; current_macro[current_macro_index] = '\0'; }
long long _rl_add_macro_char(unsigned long a0) { int tmp_21; if (current_macro_index + 1 >= current_macro_size) { if (!current_macro) { current_macro_size = 25; current_macro = xmalloc(0x19); } else { current_macro_size = current_macro_size + 25; current_macro = xrealloc(current_macro, current_macro_size, current_macro_size); } } tmp_21 = current_macro_index; current_macro_index = current_macro_index + 1; *((tmp_21 + current_macro)) = a0; *((current_macro_index + current_macro)) = 0; return current_macro_index + current_macro; }
bash
angr_phoenix
static inline long double absld(long double val) { return val < 0 ? -val : val; }
long double absld(long double a1) { if (a1 >= 0.0) return a1; else return -a1; }
coreutils
ida
void ssh_set_app_data(struct ssh *ssh, void *app_data) { ssh->app_data = app_data; }
long long ssh_set_app_data(struct_0 *a0, unsigned long a1) { a0->field_870 = a1; return a0; }
openssh-portable
angr_dream
static char *human_access(struct stat const *statbuf) { static char modebuf[12]; filemodestring(statbuf, modebuf); modebuf[10] = 0; return modebuf; }
undefined1 *human_access(undefined8 param_1) { filemodestring(param_1, modebuf_6648); modebuf_6648[10] = 0; return modebuf_6648; }
coreutils
ghidra
vi_change_to_eol(EditLine *el, wint_t c __attribute__((__unused__))) { cv_undo(el); cv_yank(el, el->el_line.cursor, (int)(el->el_line.lastchar - el->el_line.cursor)); (void)ed_kill_line(el, 0); el->el_map.current = el->el_map.key; return 4; }
undefined8 vi_change_to_eol(long param_1) { cv_undo(param_1); cv_yank(param_1, *(undefined8 *)(param_1 + 0x58), *(long *)(param_1 + 0x60) - *(long *)(param_1 + 0x58) >> 2 & 0xffffffff); ed_kill_line(param_1, 0); *(undefined8 *)(param_1 + 0x400) = *(undefined8 *)(param_1 + 0x3f8); return 4; }
libedit
ghidra
static void chan_shutdown_write(struct ssh *ssh, Channel *c) { sshbuf_reset(c->output); if (c->type == 10) return; sshlog("nchan.c", __func__, 381, 1, SYSLOG_LEVEL_DEBUG2, ((void *)0), "channel %d: (i%d o%d sock %d wfd %d efd %d [%s])", c->self, c->istate, c->ostate, c->sock, c->wfd, c->efd, channel_format_extended_usage(c)) ; if (c->sock != -1) { if (shutdown(c->sock, SHUT_WR) == -1) { sshlog("nchan.c", __func__, 386, 1, SYSLOG_LEVEL_DEBUG2, ((void *)0), "channel %d: shutdown() failed for " "fd %d [i%d o%d]: %.100s", c->self, c->sock, c->istate, c->ostate, strerror((*__errno_location()))) ; } } else { if (channel_close_fd(ssh, c, &c->wfd) < 0) { sshlog("nchan.c", __func__, 392, 1, SYSLOG_LEVEL_INFO, ((void *)0), "channel %d: close() failed for " "fd %d [i%d o%d]: %.100s", c->self, c->wfd, c->istate, c->ostate, strerror((*__errno_location()))) ; } } }
void chan_shutdown_write(unsigned long long a0, struct_0 *a1) { unsigned long v0; unsigned long v1; unsigned long v2; unsigned long long v4; unsigned long long v7; unsigned long long v8; sshbuf_reset(a1->field_70); v4 = a1->field_0; if (a1->field_0 == 10) return; v2 = channel_format_extended_usage(a1); v1 = a1->field_24; v0 = a1->field_20; sshlog("nchan.c", "chan_shutdown_write", 0x17d, 0x1, 0x6, 0x0, "channel %d: (i%d o%d sock %d wfd %d efd %d [%s])", a1->field_4, a1->field_10); if (a1->field_28 != -1) { if (shutdown(a1->field_28, 0x1) != -1) return; v2 = strerror(*(__errno_location())); v1 = a1->field_14; v0 = a1->field_10; v8 = sshlog("nchan.c", "chan_shutdown_write", 0x182, 0x1, 0x6, 0x0, "channel %d: shutdown() failed for fd %d [i%d o%d]: %.100s", a1->field_4, a1->field_28); return; } else { if (channel_close_fd(a0, a1, &a1->field_20, a1) >= 0) return; v2 = strerror(*(__errno_location())); v1 = a1->field_14; v0 = a1->field_10; v7 = sshlog("nchan.c", "chan_shutdown_write", 0x188, 0x1, 0x3, 0x0, "channel %d: close() failed for fd %d [i%d o%d]: %.100s", a1->field_4, a1->field_20); return; } }
openssh-portable
angr_sailr
void sshsigopt_free(struct sshsigopt *opts) { if (opts == ((void *)0)) return; free(opts->namespaces); free(opts); }
void sshsigopt_free(void **a1) { if (a1) { free(a1[1]); free(a1); } }
openssh-portable
ida
static void configError(void) { fprintf(stderr, "bzip2: I'm not configured correctly for this platform!\n" "\tI require Int32, Int16 and Char to have sizes\n" "\tof 4, 2 and 1 bytes to run properly, and they don't.\n" "\tProbably you can fix this by defining them correctly,\n" "\tand recompiling. Bye!\n"); setExit(3); exit(exitValue); }
void configError(void) { fprintf(stderr, "bzip2: I\'m not configured correctly for this platform!\n\tI " "require Int32, Int16 and Char to have sizes\n\tof 4, 2 and 1 bytes " "to run properly, and they don\'t.\n\tProbably you can fix this by " "defining them correctly,\n\tand recompiling. Bye!\n"); setExit(); exit(exitValue); }
bzip2
ghidra
int dotcmd(int argc, char **argv) { int status = 0; nextopt(nullstr); argv = argptr; if (*argv) { char *fullname; fullname = find_dot_file(*argv); setinputfile(fullname, INPUT_PUSH_FILE); commandname = fullname; status = cmdloop(0); popfile(); } return status; }
long long dotcmd(unsigned long a0, unsigned long a1, unsigned long long a2, unsigned long long a3, unsigned long long a4, unsigned long long a5) { unsigned long long *v0; unsigned int v1; unsigned int v2; unsigned long long v3; v1 = a0; v0 = a1; v2 = 0; nextopt(0x500158); v0 = argptr; if (*(v0)) { v3 = find_dot_file(*(v0)); setinputfile(v3, 0x1); commandname = v3; v2 = cmdloop(0x0); popfile(0x0, 0x1, a2, a3, a4, a5); } return v2; }
dash-0.5.11+git20210903+057cd650a4ed
angr_phoenix
static int agent_signer(struct sshkey *key, u_char **sigp, size_t *lenp, const u_char *data, size_t datalen, const char *alg, const char *provider, const char *pin, u_int compat, void *ctx) { int *agent_fdp = (int *)ctx; return ssh_agent_sign(*agent_fdp, key, sigp, lenp, data, datalen, alg, compat); }
void agent_signer(undefined8 param_1, undefined8 param_2, undefined8 param_3, undefined8 param_4, undefined8 param_5, undefined8 param_6, undefined8 param_7, undefined8 param_8, undefined4 param_9, undefined4 *param_10) { ssh_agent_sign(*param_10, param_1, param_2, param_3, param_4, param_5, param_6, param_9); return; }
openssh-portable
ghidra
int sshkey_private_serialize_opt(struct sshkey *key, struct sshbuf *buf, enum sshkey_serialize_rep opts) { int r = -1; int was_shielded = sshkey_is_shielded(key); struct sshbuf *b = ((void *)0); const BIGNUM *rsa_n, *rsa_e, *rsa_d, *rsa_iqmp, *rsa_p, *rsa_q; const BIGNUM *dsa_p, *dsa_q, *dsa_g, *dsa_pub_key, *dsa_priv_key; if ((r = sshkey_unshield_private(key)) != 0) return r; if ((b = sshbuf_new()) == ((void *)0)) return -2; if ((r = sshbuf_put_cstring(b, sshkey_ssh_name(key))) != 0) goto out; switch (key->type) { case KEY_RSA: RSA_get0_key(key->rsa, &rsa_n, &rsa_e, &rsa_d); RSA_get0_factors(key->rsa, &rsa_p, &rsa_q); RSA_get0_crt_params(key->rsa, ((void *)0), ((void *)0), &rsa_iqmp); if ((r = sshbuf_put_bignum2(b, rsa_n)) != 0 || (r = sshbuf_put_bignum2(b, rsa_e)) != 0 || (r = sshbuf_put_bignum2(b, rsa_d)) != 0 || (r = sshbuf_put_bignum2(b, rsa_iqmp)) != 0 || (r = sshbuf_put_bignum2(b, rsa_p)) != 0 || (r = sshbuf_put_bignum2(b, rsa_q)) != 0) goto out; break; case KEY_RSA_CERT: if (key->cert == ((void *)0) || sshbuf_len(key->cert->certblob) == 0) { r = -10; goto out; } RSA_get0_key(key->rsa, ((void *)0), ((void *)0), &rsa_d); RSA_get0_factors(key->rsa, &rsa_p, &rsa_q); RSA_get0_crt_params(key->rsa, ((void *)0), ((void *)0), &rsa_iqmp); if ((r = sshbuf_put_stringb(b, key->cert->certblob)) != 0 || (r = sshbuf_put_bignum2(b, rsa_d)) != 0 || (r = sshbuf_put_bignum2(b, rsa_iqmp)) != 0 || (r = sshbuf_put_bignum2(b, rsa_p)) != 0 || (r = sshbuf_put_bignum2(b, rsa_q)) != 0) goto out; break; case KEY_DSA: DSA_get0_pqg(key->dsa, &dsa_p, &dsa_q, &dsa_g); DSA_get0_key(key->dsa, &dsa_pub_key, &dsa_priv_key); if ((r = sshbuf_put_bignum2(b, dsa_p)) != 0 || (r = sshbuf_put_bignum2(b, dsa_q)) != 0 || (r = sshbuf_put_bignum2(b, dsa_g)) != 0 || (r = sshbuf_put_bignum2(b, dsa_pub_key)) != 0 || (r = sshbuf_put_bignum2(b, dsa_priv_key)) != 0) goto out; break; case KEY_DSA_CERT: if (key->cert == ((void *)0) || sshbuf_len(key->cert->certblob) == 0) { r = -10; goto out; } DSA_get0_key(key->dsa, ((void *)0), &dsa_priv_key); if ((r = sshbuf_put_stringb(b, key->cert->certblob)) != 0 || (r = sshbuf_put_bignum2(b, dsa_priv_key)) != 0) goto out; break; case KEY_ECDSA: if ((r = sshbuf_put_cstring(b, sshkey_curve_nid_to_name(key->ecdsa_nid))) != 0 || (r = sshbuf_put_eckey(b, key->ecdsa)) != 0 || (r = sshbuf_put_bignum2(b, EC_KEY_get0_private_key(key->ecdsa))) != 0) goto out; break; case KEY_ECDSA_CERT: if (key->cert == ((void *)0) || sshbuf_len(key->cert->certblob) == 0) { r = -10; goto out; } if ((r = sshbuf_put_stringb(b, key->cert->certblob)) != 0 || (r = sshbuf_put_bignum2(b, EC_KEY_get0_private_key(key->ecdsa))) != 0) goto out; break; case KEY_ECDSA_SK: if ((r = sshbuf_put_cstring(b, sshkey_curve_nid_to_name(key->ecdsa_nid))) != 0 || (r = sshbuf_put_eckey(b, key->ecdsa)) != 0 || (r = sshbuf_put_cstring(b, key->sk_application)) != 0 || (r = sshbuf_put_u8(b, key->sk_flags)) != 0 || (r = sshbuf_put_stringb(b, key->sk_key_handle)) != 0 || (r = sshbuf_put_stringb(b, key->sk_reserved)) != 0) goto out; break; case KEY_ECDSA_SK_CERT: if (key->cert == ((void *)0) || sshbuf_len(key->cert->certblob) == 0) { r = -10; goto out; } if ((r = sshbuf_put_stringb(b, key->cert->certblob)) != 0 || (r = sshbuf_put_cstring(b, key->sk_application)) != 0 || (r = sshbuf_put_u8(b, key->sk_flags)) != 0 || (r = sshbuf_put_stringb(b, key->sk_key_handle)) != 0 || (r = sshbuf_put_stringb(b, key->sk_reserved)) != 0) goto out; break; case KEY_ED25519: if ((r = sshbuf_put_string(b, key->ed25519_pk, 32U)) != 0 || (r = sshbuf_put_string(b, key->ed25519_sk, 64U)) != 0) goto out; break; case KEY_ED25519_CERT: if (key->cert == ((void *)0) || sshbuf_len(key->cert->certblob) == 0) { r = -10; goto out; } if ((r = sshbuf_put_stringb(b, key->cert->certblob)) != 0 || (r = sshbuf_put_string(b, key->ed25519_pk, 32U)) != 0 || (r = sshbuf_put_string(b, key->ed25519_sk, 64U)) != 0) goto out; break; case KEY_ED25519_SK: if ((r = sshbuf_put_string(b, key->ed25519_pk, 32U)) != 0 || (r = sshbuf_put_cstring(b, key->sk_application)) != 0 || (r = sshbuf_put_u8(b, key->sk_flags)) != 0 || (r = sshbuf_put_stringb(b, key->sk_key_handle)) != 0 || (r = sshbuf_put_stringb(b, key->sk_reserved)) != 0) goto out; break; case KEY_ED25519_SK_CERT: if (key->cert == ((void *)0) || sshbuf_len(key->cert->certblob) == 0) { r = -10; goto out; } if ((r = sshbuf_put_stringb(b, key->cert->certblob)) != 0 || (r = sshbuf_put_string(b, key->ed25519_pk, 32U)) != 0 || (r = sshbuf_put_cstring(b, key->sk_application)) != 0 || (r = sshbuf_put_u8(b, key->sk_flags)) != 0 || (r = sshbuf_put_stringb(b, key->sk_key_handle)) != 0 || (r = sshbuf_put_stringb(b, key->sk_reserved)) != 0) goto out; break; default: r = -10; goto out; } r = 0; out: if (was_shielded) r = sshkey_shield_private(key); if (r == 0) r = sshbuf_putb(buf, b); sshbuf_free(b); return r; }
int sshkey_private_serialize_opt(struct_0 *a0, unsigned long long a1, unsigned long a2, unsigned long long a3) { unsigned int v0; unsigned int v1; unsigned int v2; char v3; char v4; char v5; char v6; char v7; char v8; char v9; char v10; char v11; char v12; char v13; unsigned long long v14; unsigned long long v16; v0 = a2; v1 = -1; v2 = sshkey_is_shielded(a0); v14 = 0; v1 = sshkey_unshield_private(a0); if (v1) { v16 = v1; } else { v14 = sshbuf_new(); if (!v14) { v16 = -2; } else { v16 = sshkey_ssh_name(a0); v1 = sshbuf_put_cstring(v14, v16, v16); if (!v1) { switch (a0->field_0) { case 0: RSA_get0_key(a0->field_8, &v3, &v4, &v5); RSA_get0_factors(a0->field_8, &v7, &v8, &v7); RSA_get0_crt_params(a0->field_8, 0x0, 0x0, &v6); v1 = sshbuf_put_bignum2(v14, *(&v3), *(&v3)); if (!v1) { v1 = sshbuf_put_bignum2(v14, *(&v4), *(&v4)); if (!v1) { v1 = sshbuf_put_bignum2(v14, *(&v5), *(&v5)); if (!v1) { v1 = sshbuf_put_bignum2(v14, *(&v6), *(&v6)); if (!v1) { v1 = sshbuf_put_bignum2(v14, *(&v7), *(&v7)); if (!v1) { v1 = sshbuf_put_bignum2(v14, *(&v8), *(&v8)); if (!v1) goto LABEL_408376; } } } } } break; case 1: DSA_get0_pqg(a0->field_10, &v9, &v10, &v11); DSA_get0_key(a0->field_10, &v12, &v13, &v12); v1 = sshbuf_put_bignum2(v14, *(&v9), *(&v9)); if (!v1) { v1 = sshbuf_put_bignum2(v14, *(&v10), *(&v10)); if (!v1) { v1 = sshbuf_put_bignum2(v14, *(&v11), *(&v11)); if (!v1) { v1 = sshbuf_put_bignum2(v14, *(&v12), *(&v12)); if (!v1) { v1 = sshbuf_put_bignum2(v14, *(&v13), *(&v13)); if (!v1) goto LABEL_408376; } } } } break; case 2: v16 = sshkey_curve_nid_to_name(a0->field_18); v1 = sshbuf_put_cstring(v14, v16, v16); if (!v1) { v1 = sshbuf_put_eckey(v14, a0->field_20, a0->field_20); if (!v1) { v16 = EC_KEY_get0_private_key(a0->field_20); v1 = sshbuf_put_bignum2(v14, v16, v16); if (!v1) goto LABEL_408376; } } break; case 3: v1 = sshbuf_put_string(v14, a0->field_30, 0x20, a0->field_30); if (!v1) { v1 = sshbuf_put_string(v14, a0->field_28, 0x40, a0->field_28); if (!v1) goto LABEL_408376; } break; case 4: if (a0->field_80 && sshbuf_len(a0->field_80->field_0)) { RSA_get0_key(a0->field_8, 0x0, 0x0, &v5); RSA_get0_factors(a0->field_8, &v7, &v8, &v7); RSA_get0_crt_params(a0->field_8, 0x0, 0x0, &v6); v1 = sshbuf_put_stringb(v14, a0->field_80->field_0, a0->field_80->field_0); if (!v1) { v1 = sshbuf_put_bignum2(v14, *(&v5), *(&v5)); if (!v1) { v1 = sshbuf_put_bignum2(v14, *(&v6), *(&v6)); if (!v1) { v1 = sshbuf_put_bignum2(v14, *(&v7), *(&v7)); if (!v1) { v1 = sshbuf_put_bignum2(v14, *(&v8), *(&v8)); if (!v1) goto LABEL_408376; } } } } break; } v1 = -10; break; case 5: if (a0->field_80 && sshbuf_len(a0->field_80->field_0)) { DSA_get0_key(a0->field_10, 0x0, &v13, a3); v1 = sshbuf_put_stringb(v14, a0->field_80->field_0, a0->field_80->field_0); if (!v1) { v1 = sshbuf_put_bignum2(v14, *(&v13), *(&v13)); if (!v1) goto LABEL_408376; } break; } v1 = -10; break; case 6: if (a0->field_80 && sshbuf_len(a0->field_80->field_0)) { v1 = sshbuf_put_stringb(v14, a0->field_80->field_0, a0->field_80->field_0); if (!v1) { v16 = EC_KEY_get0_private_key(a0->field_20); v1 = sshbuf_put_bignum2(v14, v16, v16); if (!v1) goto LABEL_408376; } break; } v1 = -10; break; case 7: if (a0->field_80 && sshbuf_len(a0->field_80->field_0)) { v1 = sshbuf_put_stringb(v14, a0->field_80->field_0, a0->field_80->field_0); if (!v1) { v1 = sshbuf_put_string(v14, a0->field_30, 0x20, a0->field_30); if (!v1) { v1 = sshbuf_put_string(v14, a0->field_28, 0x40, a0->field_28); if (!v1) goto LABEL_408376; } } break; } v1 = -10; break; case 10: v16 = sshkey_curve_nid_to_name(a0->field_18); v1 = sshbuf_put_cstring(v14, v16, v16); if (!v1) { v1 = sshbuf_put_eckey(v14, a0->field_20, a0->field_20); if (!v1) { v1 = sshbuf_put_cstring(v14, a0->field_60, a0->field_60); if (!v1) { v1 = sshbuf_put_u8(v14, a0->field_68, a0->field_68); if (!v1) { v1 = sshbuf_put_stringb(v14, a0->field_70, a0->field_70); if (!v1) { v1 = sshbuf_put_stringb(v14, a0->field_78, a0->field_78); if (!v1) goto LABEL_408376; } } } } } break; case 11: if (a0->field_80 && sshbuf_len(a0->field_80->field_0)) { v1 = sshbuf_put_stringb(v14, a0->field_80->field_0, a0->field_80->field_0); if (!v1) { v1 = sshbuf_put_cstring(v14, a0->field_60, a0->field_60); if (!v1) { v1 = sshbuf_put_u8(v14, a0->field_68, a0->field_68); if (!v1) { v1 = sshbuf_put_stringb(v14, a0->field_70, a0->field_70); if (!v1) { v1 = sshbuf_put_stringb(v14, a0->field_78, a0->field_78); if (!v1) goto LABEL_408376; } } } } break; } v1 = -10; break; case 12: v1 = sshbuf_put_string(v14, a0->field_30, 0x20, a0->field_30); if (!v1) { v1 = sshbuf_put_cstring(v14, a0->field_60, a0->field_60); if (!v1) { v1 = sshbuf_put_u8(v14, a0->field_68, a0->field_68); if (!v1) { v1 = sshbuf_put_stringb(v14, a0->field_70, a0->field_70); if (!v1) { v1 = sshbuf_put_stringb(v14, a0->field_78, a0->field_78); if (!v1) goto LABEL_408376; } } } } break; case 13: if (!a0->field_80) { LABEL_408260: v1 = -10; break; } else { if (!sshbuf_len(a0->field_80->field_0)) goto LABEL_408260; v1 = sshbuf_put_stringb(v14, a0->field_80->field_0, a0->field_80->field_0); if (!v1) { v1 = sshbuf_put_string(v14, a0->field_30, 0x20, a0->field_30); if (!v1) { v1 = sshbuf_put_cstring(v14, a0->field_60, a0->field_60); if (!v1) { v1 = sshbuf_put_u8(v14, a0->field_68, a0->field_68); if (!v1) { v1 = sshbuf_put_stringb(v14, a0->field_70, a0->field_70); if (!v1) { v1 = sshbuf_put_stringb(v14, a0->field_78, a0->field_78); if (!v1) { LABEL_408376: v1 = 0; break; } } } } } } break; } default: v1 = -10; break; } } if (v2) v1 = sshkey_shield_private(a0); if (!v1) v1 = sshbuf_putb(a1, v14, v14); sshbuf_free(v14); v16 = v1; } } return v16; }
openssh-portable
angr_phoenix
(r = sshbuf_put_u32(msg, nkeys)) != 0) sshfatal("ssh-pkcs11-helper.c", __func__, 138, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "compose"); for (i = 0; i < nkeys; i++) { if ((r = sshkey_to_blob(keys[i], &blob, &blen)) != 0) { sshlog("ssh-pkcs11-helper.c", __func__, 141, 1, SYSLOG_LEVEL_DEBUG1, ssh_err(r), "encode key"); continue; } if ((r = sshbuf_put_string(msg, blob, blen)) != 0 || (r = sshbuf_put_cstring(msg, labels[i])) != 0) sshfatal("ssh-pkcs11-helper.c", __func__, 146, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "compose key"); free(blob); add_key(keys[i], name, labels[i]); free(labels[i]); }
void sshbuf_put_u32(void) { halt_baddata(); }
openssh-portable
ghidra
void chacha_encrypt_bytes(chacha_ctx *x, const u8 *m, u8 *c, u32 bytes) { u32 x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15; u32 j0, j1, j2, j3, j4, j5, j6, j7, j8, j9, j10, j11, j12, j13, j14, j15; u8 *ctarget = ((void *)0); u8 tmp[64]; u_int i; if (!bytes) return; j0 = x->input[0]; j1 = x->input[1]; j2 = x->input[2]; j3 = x->input[3]; j4 = x->input[4]; j5 = x->input[5]; j6 = x->input[6]; j7 = x->input[7]; j8 = x->input[8]; j9 = x->input[9]; j10 = x->input[10]; j11 = x->input[11]; j12 = x->input[12]; j13 = x->input[13]; j14 = x->input[14]; j15 = x->input[15]; for (;;) { if (bytes < 64) { for (i = 0; i < bytes; ++i) tmp[i] = m[i]; m = tmp; ctarget = c; c = tmp; } x0 = j0; x1 = j1; x2 = j2; x3 = j3; x4 = j4; x5 = j5; x6 = j6; x7 = j7; x8 = j8; x9 = j9; x10 = j10; x11 = j11; x12 = j12; x13 = j13; x14 = j14; x15 = j15; for (i = 20; i > 0; i -= 2) { x0 = (((u32)((x0) + (x4)) & (0xFFFFFFFFU))); x12 = ((((u32)((((x12) ^ (x0))) << (16)) & (0xFFFFFFFFU)) | ((((x12) ^ (x0))) >> (32 - (16))))); x8 = (((u32)((x8) + (x12)) & (0xFFFFFFFFU))); x4 = ((((u32)((((x4) ^ (x8))) << (12)) & (0xFFFFFFFFU)) | ((((x4) ^ (x8))) >> (32 - (12))))); x0 = (((u32)((x0) + (x4)) & (0xFFFFFFFFU))); x12 = ((((u32)((((x12) ^ (x0))) << (8)) & (0xFFFFFFFFU)) | ((((x12) ^ (x0))) >> (32 - (8))))); x8 = (((u32)((x8) + (x12)) & (0xFFFFFFFFU))); x4 = ((((u32)((((x4) ^ (x8))) << (7)) & (0xFFFFFFFFU)) | ((((x4) ^ (x8))) >> (32 - (7))))); x1 = (((u32)((x1) + (x5)) & (0xFFFFFFFFU))); x13 = ((((u32)((((x13) ^ (x1))) << (16)) & (0xFFFFFFFFU)) | ((((x13) ^ (x1))) >> (32 - (16))))); x9 = (((u32)((x9) + (x13)) & (0xFFFFFFFFU))); x5 = ((((u32)((((x5) ^ (x9))) << (12)) & (0xFFFFFFFFU)) | ((((x5) ^ (x9))) >> (32 - (12))))); x1 = (((u32)((x1) + (x5)) & (0xFFFFFFFFU))); x13 = ((((u32)((((x13) ^ (x1))) << (8)) & (0xFFFFFFFFU)) | ((((x13) ^ (x1))) >> (32 - (8))))); x9 = (((u32)((x9) + (x13)) & (0xFFFFFFFFU))); x5 = ((((u32)((((x5) ^ (x9))) << (7)) & (0xFFFFFFFFU)) | ((((x5) ^ (x9))) >> (32 - (7))))); x2 = (((u32)((x2) + (x6)) & (0xFFFFFFFFU))); x14 = ((((u32)((((x14) ^ (x2))) << (16)) & (0xFFFFFFFFU)) | ((((x14) ^ (x2))) >> (32 - (16))))); x10 = (((u32)((x10) + (x14)) & (0xFFFFFFFFU))); x6 = ((((u32)((((x6) ^ (x10))) << (12)) & (0xFFFFFFFFU)) | ((((x6) ^ (x10))) >> (32 - (12))))); x2 = (((u32)((x2) + (x6)) & (0xFFFFFFFFU))); x14 = ((((u32)((((x14) ^ (x2))) << (8)) & (0xFFFFFFFFU)) | ((((x14) ^ (x2))) >> (32 - (8))))); x10 = (((u32)((x10) + (x14)) & (0xFFFFFFFFU))); x6 = ((((u32)((((x6) ^ (x10))) << (7)) & (0xFFFFFFFFU)) | ((((x6) ^ (x10))) >> (32 - (7))))); x3 = (((u32)((x3) + (x7)) & (0xFFFFFFFFU))); x15 = ((((u32)((((x15) ^ (x3))) << (16)) & (0xFFFFFFFFU)) | ((((x15) ^ (x3))) >> (32 - (16))))); x11 = (((u32)((x11) + (x15)) & (0xFFFFFFFFU))); x7 = ((((u32)((((x7) ^ (x11))) << (12)) & (0xFFFFFFFFU)) | ((((x7) ^ (x11))) >> (32 - (12))))); x3 = (((u32)((x3) + (x7)) & (0xFFFFFFFFU))); x15 = ((((u32)((((x15) ^ (x3))) << (8)) & (0xFFFFFFFFU)) | ((((x15) ^ (x3))) >> (32 - (8))))); x11 = (((u32)((x11) + (x15)) & (0xFFFFFFFFU))); x7 = ((((u32)((((x7) ^ (x11))) << (7)) & (0xFFFFFFFFU)) | ((((x7) ^ (x11))) >> (32 - (7))))); x0 = (((u32)((x0) + (x5)) & (0xFFFFFFFFU))); x15 = ((((u32)((((x15) ^ (x0))) << (16)) & (0xFFFFFFFFU)) | ((((x15) ^ (x0))) >> (32 - (16))))); x10 = (((u32)((x10) + (x15)) & (0xFFFFFFFFU))); x5 = ((((u32)((((x5) ^ (x10))) << (12)) & (0xFFFFFFFFU)) | ((((x5) ^ (x10))) >> (32 - (12))))); x0 = (((u32)((x0) + (x5)) & (0xFFFFFFFFU))); x15 = ((((u32)((((x15) ^ (x0))) << (8)) & (0xFFFFFFFFU)) | ((((x15) ^ (x0))) >> (32 - (8))))); x10 = (((u32)((x10) + (x15)) & (0xFFFFFFFFU))); x5 = ((((u32)((((x5) ^ (x10))) << (7)) & (0xFFFFFFFFU)) | ((((x5) ^ (x10))) >> (32 - (7))))); x1 = (((u32)((x1) + (x6)) & (0xFFFFFFFFU))); x12 = ((((u32)((((x12) ^ (x1))) << (16)) & (0xFFFFFFFFU)) | ((((x12) ^ (x1))) >> (32 - (16))))); x11 = (((u32)((x11) + (x12)) & (0xFFFFFFFFU))); x6 = ((((u32)((((x6) ^ (x11))) << (12)) & (0xFFFFFFFFU)) | ((((x6) ^ (x11))) >> (32 - (12))))); x1 = (((u32)((x1) + (x6)) & (0xFFFFFFFFU))); x12 = ((((u32)((((x12) ^ (x1))) << (8)) & (0xFFFFFFFFU)) | ((((x12) ^ (x1))) >> (32 - (8))))); x11 = (((u32)((x11) + (x12)) & (0xFFFFFFFFU))); x6 = ((((u32)((((x6) ^ (x11))) << (7)) & (0xFFFFFFFFU)) | ((((x6) ^ (x11))) >> (32 - (7))))); x2 = (((u32)((x2) + (x7)) & (0xFFFFFFFFU))); x13 = ((((u32)((((x13) ^ (x2))) << (16)) & (0xFFFFFFFFU)) | ((((x13) ^ (x2))) >> (32 - (16))))); x8 = (((u32)((x8) + (x13)) & (0xFFFFFFFFU))); x7 = ((((u32)((((x7) ^ (x8))) << (12)) & (0xFFFFFFFFU)) | ((((x7) ^ (x8))) >> (32 - (12))))); x2 = (((u32)((x2) + (x7)) & (0xFFFFFFFFU))); x13 = ((((u32)((((x13) ^ (x2))) << (8)) & (0xFFFFFFFFU)) | ((((x13) ^ (x2))) >> (32 - (8))))); x8 = (((u32)((x8) + (x13)) & (0xFFFFFFFFU))); x7 = ((((u32)((((x7) ^ (x8))) << (7)) & (0xFFFFFFFFU)) | ((((x7) ^ (x8))) >> (32 - (7))))); x3 = (((u32)((x3) + (x4)) & (0xFFFFFFFFU))); x14 = ((((u32)((((x14) ^ (x3))) << (16)) & (0xFFFFFFFFU)) | ((((x14) ^ (x3))) >> (32 - (16))))); x9 = (((u32)((x9) + (x14)) & (0xFFFFFFFFU))); x4 = ((((u32)((((x4) ^ (x9))) << (12)) & (0xFFFFFFFFU)) | ((((x4) ^ (x9))) >> (32 - (12))))); x3 = (((u32)((x3) + (x4)) & (0xFFFFFFFFU))); x14 = ((((u32)((((x14) ^ (x3))) << (8)) & (0xFFFFFFFFU)) | ((((x14) ^ (x3))) >> (32 - (8))))); x9 = (((u32)((x9) + (x14)) & (0xFFFFFFFFU))); x4 = ((((u32)((((x4) ^ (x9))) << (7)) & (0xFFFFFFFFU)) | ((((x4) ^ (x9))) >> (32 - (7))))); } x0 = (((u32)((x0) + (j0)) & (0xFFFFFFFFU))); x1 = (((u32)((x1) + (j1)) & (0xFFFFFFFFU))); x2 = (((u32)((x2) + (j2)) & (0xFFFFFFFFU))); x3 = (((u32)((x3) + (j3)) & (0xFFFFFFFFU))); x4 = (((u32)((x4) + (j4)) & (0xFFFFFFFFU))); x5 = (((u32)((x5) + (j5)) & (0xFFFFFFFFU))); x6 = (((u32)((x6) + (j6)) & (0xFFFFFFFFU))); x7 = (((u32)((x7) + (j7)) & (0xFFFFFFFFU))); x8 = (((u32)((x8) + (j8)) & (0xFFFFFFFFU))); x9 = (((u32)((x9) + (j9)) & (0xFFFFFFFFU))); x10 = (((u32)((x10) + (j10)) & (0xFFFFFFFFU))); x11 = (((u32)((x11) + (j11)) & (0xFFFFFFFFU))); x12 = (((u32)((x12) + (j12)) & (0xFFFFFFFFU))); x13 = (((u32)((x13) + (j13)) & (0xFFFFFFFFU))); x14 = (((u32)((x14) + (j14)) & (0xFFFFFFFFU))); x15 = (((u32)((x15) + (j15)) & (0xFFFFFFFFU))); x0 = ((x0) ^ ((((u32)((m + 0)[0])) | ((u32)((m + 0)[1]) << 8) | ((u32)((m + 0)[2]) << 16) | ((u32)((m + 0)[3]) << 24)))); x1 = ((x1) ^ ((((u32)((m + 4)[0])) | ((u32)((m + 4)[1]) << 8) | ((u32)((m + 4)[2]) << 16) | ((u32)((m + 4)[3]) << 24)))); x2 = ((x2) ^ ((((u32)((m + 8)[0])) | ((u32)((m + 8)[1]) << 8) | ((u32)((m + 8)[2]) << 16) | ((u32)((m + 8)[3]) << 24)))); x3 = ((x3) ^ ((((u32)((m + 12)[0])) | ((u32)((m + 12)[1]) << 8) | ((u32)((m + 12)[2]) << 16) | ((u32)((m + 12)[3]) << 24)))); x4 = ((x4) ^ ((((u32)((m + 16)[0])) | ((u32)((m + 16)[1]) << 8) | ((u32)((m + 16)[2]) << 16) | ((u32)((m + 16)[3]) << 24)))); x5 = ((x5) ^ ((((u32)((m + 20)[0])) | ((u32)((m + 20)[1]) << 8) | ((u32)((m + 20)[2]) << 16) | ((u32)((m + 20)[3]) << 24)))); x6 = ((x6) ^ ((((u32)((m + 24)[0])) | ((u32)((m + 24)[1]) << 8) | ((u32)((m + 24)[2]) << 16) | ((u32)((m + 24)[3]) << 24)))); x7 = ((x7) ^ ((((u32)((m + 28)[0])) | ((u32)((m + 28)[1]) << 8) | ((u32)((m + 28)[2]) << 16) | ((u32)((m + 28)[3]) << 24)))); x8 = ((x8) ^ ((((u32)((m + 32)[0])) | ((u32)((m + 32)[1]) << 8) | ((u32)((m + 32)[2]) << 16) | ((u32)((m + 32)[3]) << 24)))); x9 = ((x9) ^ ((((u32)((m + 36)[0])) | ((u32)((m + 36)[1]) << 8) | ((u32)((m + 36)[2]) << 16) | ((u32)((m + 36)[3]) << 24)))); x10 = ((x10) ^ ((((u32)((m + 40)[0])) | ((u32)((m + 40)[1]) << 8) | ((u32)((m + 40)[2]) << 16) | ((u32)((m + 40)[3]) << 24)))); x11 = ((x11) ^ ((((u32)((m + 44)[0])) | ((u32)((m + 44)[1]) << 8) | ((u32)((m + 44)[2]) << 16) | ((u32)((m + 44)[3]) << 24)))); x12 = ((x12) ^ ((((u32)((m + 48)[0])) | ((u32)((m + 48)[1]) << 8) | ((u32)((m + 48)[2]) << 16) | ((u32)((m + 48)[3]) << 24)))); x13 = ((x13) ^ ((((u32)((m + 52)[0])) | ((u32)((m + 52)[1]) << 8) | ((u32)((m + 52)[2]) << 16) | ((u32)((m + 52)[3]) << 24)))); x14 = ((x14) ^ ((((u32)((m + 56)[0])) | ((u32)((m + 56)[1]) << 8) | ((u32)((m + 56)[2]) << 16) | ((u32)((m + 56)[3]) << 24)))); x15 = ((x15) ^ ((((u32)((m + 60)[0])) | ((u32)((m + 60)[1]) << 8) | ((u32)((m + 60)[2]) << 16) | ((u32)((m + 60)[3]) << 24)))); j12 = ((((u32)(((j12)) + (1)) & (0xFFFFFFFFU)))); if (!j12) { j13 = ((((u32)(((j13)) + (1)) & (0xFFFFFFFFU)))); } do { (c + 0)[0] = ((u8)((x0)) & (0xFFU)); (c + 0)[1] = ((u8)((x0) >> 8) & (0xFFU)); (c + 0)[2] = ((u8)((x0) >> 16) & (0xFFU)); (c + 0)[3] = ((u8)((x0) >> 24) & (0xFFU)); } while (0); do { (c + 4)[0] = ((u8)((x1)) & (0xFFU)); (c + 4)[1] = ((u8)((x1) >> 8) & (0xFFU)); (c + 4)[2] = ((u8)((x1) >> 16) & (0xFFU)); (c + 4)[3] = ((u8)((x1) >> 24) & (0xFFU)); } while (0); do { (c + 8)[0] = ((u8)((x2)) & (0xFFU)); (c + 8)[1] = ((u8)((x2) >> 8) & (0xFFU)); (c + 8)[2] = ((u8)((x2) >> 16) & (0xFFU)); (c + 8)[3] = ((u8)((x2) >> 24) & (0xFFU)); } while (0); do { (c + 12)[0] = ((u8)((x3)) & (0xFFU)); (c + 12)[1] = ((u8)((x3) >> 8) & (0xFFU)); (c + 12)[2] = ((u8)((x3) >> 16) & (0xFFU)); (c + 12)[3] = ((u8)((x3) >> 24) & (0xFFU)); } while (0); do { (c + 16)[0] = ((u8)((x4)) & (0xFFU)); (c + 16)[1] = ((u8)((x4) >> 8) & (0xFFU)); (c + 16)[2] = ((u8)((x4) >> 16) & (0xFFU)); (c + 16)[3] = ((u8)((x4) >> 24) & (0xFFU)); } while (0); do { (c + 20)[0] = ((u8)((x5)) & (0xFFU)); (c + 20)[1] = ((u8)((x5) >> 8) & (0xFFU)); (c + 20)[2] = ((u8)((x5) >> 16) & (0xFFU)); (c + 20)[3] = ((u8)((x5) >> 24) & (0xFFU)); } while (0); do { (c + 24)[0] = ((u8)((x6)) & (0xFFU)); (c + 24)[1] = ((u8)((x6) >> 8) & (0xFFU)); (c + 24)[2] = ((u8)((x6) >> 16) & (0xFFU)); (c + 24)[3] = ((u8)((x6) >> 24) & (0xFFU)); } while (0); do { (c + 28)[0] = ((u8)((x7)) & (0xFFU)); (c + 28)[1] = ((u8)((x7) >> 8) & (0xFFU)); (c + 28)[2] = ((u8)((x7) >> 16) & (0xFFU)); (c + 28)[3] = ((u8)((x7) >> 24) & (0xFFU)); } while (0); do { (c + 32)[0] = ((u8)((x8)) & (0xFFU)); (c + 32)[1] = ((u8)((x8) >> 8) & (0xFFU)); (c + 32)[2] = ((u8)((x8) >> 16) & (0xFFU)); (c + 32)[3] = ((u8)((x8) >> 24) & (0xFFU)); } while (0); do { (c + 36)[0] = ((u8)((x9)) & (0xFFU)); (c + 36)[1] = ((u8)((x9) >> 8) & (0xFFU)); (c + 36)[2] = ((u8)((x9) >> 16) & (0xFFU)); (c + 36)[3] = ((u8)((x9) >> 24) & (0xFFU)); } while (0); do { (c + 40)[0] = ((u8)((x10)) & (0xFFU)); (c + 40)[1] = ((u8)((x10) >> 8) & (0xFFU)); (c + 40)[2] = ((u8)((x10) >> 16) & (0xFFU)); (c + 40)[3] = ((u8)((x10) >> 24) & (0xFFU)); } while (0); do { (c + 44)[0] = ((u8)((x11)) & (0xFFU)); (c + 44)[1] = ((u8)((x11) >> 8) & (0xFFU)); (c + 44)[2] = ((u8)((x11) >> 16) & (0xFFU)); (c + 44)[3] = ((u8)((x11) >> 24) & (0xFFU)); } while (0); do { (c + 48)[0] = ((u8)((x12)) & (0xFFU)); (c + 48)[1] = ((u8)((x12) >> 8) & (0xFFU)); (c + 48)[2] = ((u8)((x12) >> 16) & (0xFFU)); (c + 48)[3] = ((u8)((x12) >> 24) & (0xFFU)); } while (0); do { (c + 52)[0] = ((u8)((x13)) & (0xFFU)); (c + 52)[1] = ((u8)((x13) >> 8) & (0xFFU)); (c + 52)[2] = ((u8)((x13) >> 16) & (0xFFU)); (c + 52)[3] = ((u8)((x13) >> 24) & (0xFFU)); } while (0); do { (c + 56)[0] = ((u8)((x14)) & (0xFFU)); (c + 56)[1] = ((u8)((x14) >> 8) & (0xFFU)); (c + 56)[2] = ((u8)((x14) >> 16) & (0xFFU)); (c + 56)[3] = ((u8)((x14) >> 24) & (0xFFU)); } while (0); do { (c + 60)[0] = ((u8)((x15)) & (0xFFU)); (c + 60)[1] = ((u8)((x15) >> 8) & (0xFFU)); (c + 60)[2] = ((u8)((x15) >> 16) & (0xFFU)); (c + 60)[3] = ((u8)((x15) >> 24) & (0xFFU)); } while (0); if (bytes <= 64) { if (bytes < 64) { for (i = 0; i < bytes; ++i) ctarget[i] = c[i]; } x->input[12] = j12; x->input[13] = j13; return; } bytes -= 64; c += 64; m += 64; } }
void chacha_encrypt_bytes(uint *param_1, uint *param_2, uint *param_3, uint param_4) { uint uVar1; uint uVar2; uint uVar3; uint uVar4; uint uVar5; uint uVar6; uint uVar7; uint uVar8; uint uVar9; uint uVar10; uint uVar11; uint uVar12; uint uVar13; uint uVar14; uint uVar15; uint uVar16; uint uVar17; uint uVar18; uint uVar19; uint uVar20; uint uVar21; uint uVar22; uint uVar23; uint uVar24; uint uVar25; uint uVar26; uint uVar27; uint uVar28; uint uVar29; uint uVar30; long in_FS_OFFSET; uint local_104; uint *local_100; uint *local_f8; uint local_e4; uint local_e0; uint local_dc; uint local_d8; uint local_d4; uint local_d0; uint local_cc; uint local_c8; uint local_c4; uint local_c0; uint local_bc; uint local_b8; uint local_b4; uint local_b0; uint local_ac; uint local_a8; uint local_a4; uint local_a0; uint local_9c; uint *local_60; uint local_58[18]; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); local_60 = (uint *)0x0; if (param_4 != 0) { uVar1 = *param_1; uVar2 = param_1[1]; uVar3 = param_1[2]; uVar4 = param_1[3]; uVar5 = param_1[4]; uVar6 = param_1[5]; uVar7 = param_1[6]; uVar8 = param_1[7]; uVar9 = param_1[8]; uVar10 = param_1[9]; uVar11 = param_1[10]; uVar12 = param_1[0xb]; local_a4 = param_1[0xc]; local_a0 = param_1[0xd]; uVar13 = param_1[0xe]; uVar14 = param_1[0xf]; local_104 = param_4; local_100 = param_3; local_f8 = param_2; while (true) { if (local_104 < 0x40) { for (local_9c = 0; local_9c < local_104; local_9c = local_9c + 1) { *(undefined *)((long)local_58 + (ulong)local_9c) = *(undefined *)((long)local_f8 + (ulong)local_9c); } local_f8 = local_58; local_60 = local_100; local_100 = local_58; } local_b4 = local_a4; local_b0 = local_a0; local_e4 = uVar1; local_e0 = uVar2; local_dc = uVar3; local_d8 = uVar4; local_d4 = uVar5; local_d0 = uVar6; local_cc = uVar7; local_c8 = uVar8; local_c4 = uVar9; local_c0 = uVar10; local_bc = uVar11; local_b8 = uVar12; local_ac = uVar13; local_a8 = uVar14; for (local_9c = 0x14; local_9c != 0; local_9c = local_9c + -2) { local_b4 = local_b4 ^ local_e4 + local_d4; uVar22 = local_b4 << 0x10 | local_b4 >> 0x10; local_c4 = local_c4 + uVar22; uVar23 = local_d4 ^ local_c4; uVar23 = uVar23 << 0xc | uVar23 >> 0x14; local_e4 = local_e4 + local_d4 + uVar23; uVar22 = uVar22 ^ local_e4; uVar24 = uVar22 << 8 | uVar22 >> 0x18; local_c4 = local_c4 + uVar24; uVar23 = uVar23 ^ local_c4; uVar25 = uVar23 << 7 | uVar23 >> 0x19; local_b0 = local_b0 ^ local_e0 + local_d0; uVar22 = local_b0 << 0x10 | local_b0 >> 0x10; local_c0 = local_c0 + uVar22; uVar23 = local_d0 ^ local_c0; uVar23 = uVar23 << 0xc | uVar23 >> 0x14; local_e0 = local_e0 + local_d0 + uVar23; uVar22 = uVar22 ^ local_e0; uVar26 = uVar22 << 8 | uVar22 >> 0x18; local_c0 = local_c0 + uVar26; uVar23 = uVar23 ^ local_c0; uVar27 = uVar23 << 7 | uVar23 >> 0x19; local_ac = local_ac ^ local_dc + local_cc; uVar22 = local_ac << 0x10 | local_ac >> 0x10; local_bc = local_bc + uVar22; uVar23 = local_cc ^ local_bc; uVar23 = uVar23 << 0xc | uVar23 >> 0x14; local_dc = local_dc + local_cc + uVar23; uVar22 = uVar22 ^ local_dc; uVar28 = uVar22 << 8 | uVar22 >> 0x18; local_bc = local_bc + uVar28; uVar23 = uVar23 ^ local_bc; uVar29 = uVar23 << 7 | uVar23 >> 0x19; local_a8 = local_a8 ^ local_d8 + local_c8; uVar22 = local_a8 << 0x10 | local_a8 >> 0x10; local_b8 = local_b8 + uVar22; uVar23 = local_c8 ^ local_b8; uVar23 = uVar23 << 0xc | uVar23 >> 0x14; local_d8 = local_d8 + local_c8 + uVar23; uVar22 = uVar22 ^ local_d8; uVar22 = uVar22 << 8 | uVar22 >> 0x18; local_b8 = local_b8 + uVar22; uVar23 = uVar23 ^ local_b8; uVar30 = uVar23 << 7 | uVar23 >> 0x19; local_e4 = local_e4 + uVar27; uVar22 = uVar22 ^ local_e4; uVar23 = uVar22 << 0x10 | uVar22 >> 0x10; local_bc = local_bc + uVar23; uVar27 = uVar27 ^ local_bc; uVar22 = uVar27 << 0xc | uVar27 >> 0x14; local_e4 = local_e4 + uVar22; uVar23 = uVar23 ^ local_e4; local_a8 = uVar23 << 8 | uVar23 >> 0x18; local_bc = local_bc + local_a8; uVar22 = uVar22 ^ local_bc; local_d0 = uVar22 << 7 | uVar22 >> 0x19; local_e0 = local_e0 + uVar29; uVar24 = uVar24 ^ local_e0; uVar23 = uVar24 << 0x10 | uVar24 >> 0x10; local_b8 = local_b8 + uVar23; uVar29 = uVar29 ^ local_b8; uVar22 = uVar29 << 0xc | uVar29 >> 0x14; local_e0 = local_e0 + uVar22; uVar23 = uVar23 ^ local_e0; local_b4 = uVar23 << 8 | uVar23 >> 0x18; local_b8 = local_b8 + local_b4; uVar22 = uVar22 ^ local_b8; local_cc = uVar22 << 7 | uVar22 >> 0x19; local_dc = local_dc + uVar30; uVar26 = uVar26 ^ local_dc; uVar23 = uVar26 << 0x10 | uVar26 >> 0x10; local_c4 = local_c4 + uVar23; uVar30 = uVar30 ^ local_c4; uVar22 = uVar30 << 0xc | uVar30 >> 0x14; local_dc = local_dc + uVar22; uVar23 = uVar23 ^ local_dc; local_b0 = uVar23 << 8 | uVar23 >> 0x18; local_c4 = local_c4 + local_b0; uVar22 = uVar22 ^ local_c4; local_c8 = uVar22 << 7 | uVar22 >> 0x19; local_d8 = local_d8 + uVar25; uVar28 = uVar28 ^ local_d8; uVar23 = uVar28 << 0x10 | uVar28 >> 0x10; local_c0 = local_c0 + uVar23; uVar25 = uVar25 ^ local_c0; uVar22 = uVar25 << 0xc | uVar25 >> 0x14; local_d8 = local_d8 + uVar22; uVar23 = uVar23 ^ local_d8; local_ac = uVar23 << 8 | uVar23 >> 0x18; local_c0 = local_c0 + local_ac; uVar22 = uVar22 ^ local_c0; local_d4 = uVar22 << 7 | uVar22 >> 0x19; } uVar23 = local_e4 + uVar1 ^ *local_f8; uVar22 = local_e0 + uVar2 ^ local_f8[1]; uVar27 = local_dc + uVar3 ^ local_f8[2]; uVar24 = local_d8 + uVar4 ^ local_f8[3]; uVar29 = local_d4 + uVar5 ^ local_f8[4]; uVar26 = local_d0 + uVar6 ^ local_f8[5]; uVar30 = local_cc + uVar7 ^ local_f8[6]; uVar28 = local_c8 + uVar8 ^ local_f8[7]; uVar25 = local_c4 + uVar9 ^ local_f8[8]; uVar15 = local_c0 + uVar10 ^ local_f8[9]; uVar16 = local_bc + uVar11 ^ local_f8[10]; uVar17 = local_b8 + uVar12 ^ local_f8[0xb]; uVar18 = local_b4 + local_a4 ^ local_f8[0xc]; uVar19 = local_b0 + local_a0 ^ local_f8[0xd]; uVar20 = local_ac + uVar13 ^ local_f8[0xe]; uVar21 = local_a8 + uVar14 ^ local_f8[0xf]; local_a4 = local_a4 + 1; if (local_a4 == 0) { local_a0 = local_a0 + 1; } *(char *)local_100 = (char)uVar23; *(char *)((long)local_100 + 1) = (char)(uVar23 >> 8); *(char *)((long)local_100 + 2) = (char)(uVar23 >> 0x10); *(char *)((long)local_100 + 3) = (char)(uVar23 >> 0x18); *(char *)(local_100 + 1) = (char)uVar22; *(char *)((long)local_100 + 5) = (char)(uVar22 >> 8); *(char *)((long)local_100 + 6) = (char)(uVar22 >> 0x10); *(char *)((long)local_100 + 7) = (char)(uVar22 >> 0x18); *(char *)(local_100 + 2) = (char)uVar27; *(char *)((long)local_100 + 9) = (char)(uVar27 >> 8); *(char *)((long)local_100 + 10) = (char)(uVar27 >> 0x10); *(char *)((long)local_100 + 0xb) = (char)(uVar27 >> 0x18); *(char *)(local_100 + 3) = (char)uVar24; *(char *)((long)local_100 + 0xd) = (char)(uVar24 >> 8); *(char *)((long)local_100 + 0xe) = (char)(uVar24 >> 0x10); *(char *)((long)local_100 + 0xf) = (char)(uVar24 >> 0x18); *(char *)(local_100 + 4) = (char)uVar29; *(char *)((long)local_100 + 0x11) = (char)(uVar29 >> 8); *(char *)((long)local_100 + 0x12) = (char)(uVar29 >> 0x10); *(char *)((long)local_100 + 0x13) = (char)(uVar29 >> 0x18); *(char *)(local_100 + 5) = (char)uVar26; *(char *)((long)local_100 + 0x15) = (char)(uVar26 >> 8); *(char *)((long)local_100 + 0x16) = (char)(uVar26 >> 0x10); *(char *)((long)local_100 + 0x17) = (char)(uVar26 >> 0x18); *(char *)(local_100 + 6) = (char)uVar30; *(char *)((long)local_100 + 0x19) = (char)(uVar30 >> 8); *(char *)((long)local_100 + 0x1a) = (char)(uVar30 >> 0x10); *(char *)((long)local_100 + 0x1b) = (char)(uVar30 >> 0x18); *(char *)(local_100 + 7) = (char)uVar28; *(char *)((long)local_100 + 0x1d) = (char)(uVar28 >> 8); *(char *)((long)local_100 + 0x1e) = (char)(uVar28 >> 0x10); *(char *)((long)local_100 + 0x1f) = (char)(uVar28 >> 0x18); *(char *)(local_100 + 8) = (char)uVar25; *(char *)((long)local_100 + 0x21) = (char)(uVar25 >> 8); *(char *)((long)local_100 + 0x22) = (char)(uVar25 >> 0x10); *(char *)((long)local_100 + 0x23) = (char)(uVar25 >> 0x18); *(char *)(local_100 + 9) = (char)uVar15; *(char *)((long)local_100 + 0x25) = (char)(uVar15 >> 8); *(char *)((long)local_100 + 0x26) = (char)(uVar15 >> 0x10); *(char *)((long)local_100 + 0x27) = (char)(uVar15 >> 0x18); *(char *)(local_100 + 10) = (char)uVar16; *(char *)((long)local_100 + 0x29) = (char)(uVar16 >> 8); *(char *)((long)local_100 + 0x2a) = (char)(uVar16 >> 0x10); *(char *)((long)local_100 + 0x2b) = (char)(uVar16 >> 0x18); *(char *)(local_100 + 0xb) = (char)uVar17; *(char *)((long)local_100 + 0x2d) = (char)(uVar17 >> 8); *(char *)((long)local_100 + 0x2e) = (char)(uVar17 >> 0x10); *(char *)((long)local_100 + 0x2f) = (char)(uVar17 >> 0x18); *(char *)(local_100 + 0xc) = (char)uVar18; *(char *)((long)local_100 + 0x31) = (char)(uVar18 >> 8); *(char *)((long)local_100 + 0x32) = (char)(uVar18 >> 0x10); *(char *)((long)local_100 + 0x33) = (char)(uVar18 >> 0x18); *(char *)(local_100 + 0xd) = (char)uVar19; *(char *)((long)local_100 + 0x35) = (char)(uVar19 >> 8); *(char *)((long)local_100 + 0x36) = (char)(uVar19 >> 0x10); *(char *)((long)local_100 + 0x37) = (char)(uVar19 >> 0x18); *(char *)(local_100 + 0xe) = (char)uVar20; *(char *)((long)local_100 + 0x39) = (char)(uVar20 >> 8); *(char *)((long)local_100 + 0x3a) = (char)(uVar20 >> 0x10); *(char *)((long)local_100 + 0x3b) = (char)(uVar20 >> 0x18); *(char *)(local_100 + 0xf) = (char)uVar21; *(char *)((long)local_100 + 0x3d) = (char)(uVar21 >> 8); *(char *)((long)local_100 + 0x3e) = (char)(uVar21 >> 0x10); *(char *)((long)local_100 + 0x3f) = (char)(uVar21 >> 0x18); if (local_104 < 0x41) break; local_104 = local_104 - 0x40; local_100 = local_100 + 0x10; local_f8 = local_f8 + 0x10; } if (local_104 < 0x40) { for (local_9c = 0; local_9c < local_104; local_9c = local_9c + 1) { *(undefined *)((long)local_60 + (ulong)local_9c) = *(undefined *)((long)local_100 + (ulong)local_9c); } } param_1[0xc] = local_a4; param_1[0xd] = local_a0; } if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) { __stack_chk_fail(); } return; }
openssh-portable
ghidra
static struct vertex *vertex_new(struct mod *mod, struct vertex *parent) { struct vertex *v; v = malloc(sizeof(*v)); if (v == ((void *)0)) return ((void *)0); v->parent = parent; v->mod = mod; return v; }
undefined8 *vertex_new(undefined8 param_1, undefined8 param_2) { undefined8 *puVar1; puVar1 = (undefined8 *)malloc(0x10); if (puVar1 == (undefined8 *)0x0) { puVar1 = (undefined8 *)0x0; } else { *puVar1 = param_2; puVar1[1] = param_1; } return puVar1; }
kmod
ghidra
static char **splitbuf_finishup(struct splitbuf *ss) { int argc = ss->argc; char **argv = ss->argv; char *stringbase = (char *)(ss->argv + ss->half_alloc); for (int i = 1; i < argc; i++) argv[i] = stringbase + (intptr_t)argv[i]; return argv; }
long splitbuf_finishup(long *param_1) { int iVar1; long lVar2; long lVar3; long lVar4; int local_20; iVar1 = *(int *)(param_1 + 1); lVar2 = *param_1; lVar3 = *param_1; lVar4 = param_1[2]; for (local_20 = 1; local_20 < iVar1; local_20 = local_20 + 1) { *(long *)(lVar2 + (long)local_20 * 8) = lVar4 * 8 + lVar3 + *(long *)(lVar2 + (long)local_20 * 8); } return lVar2; }
coreutils
ghidra
static void print_rtax_features(FILE *fp, unsigned int features) { unsigned int of = features; if (features & (1 << 0)) { print_null(PRINT_ANY, "ecn", "ecn ", ((void *)0)); features &= ~(1 << 0); } if (features) print_0xhex(PRINT_ANY, "features", "%#llx ", of); }
void print_rtax_features(unsigned long a0, unsigned long a1) { unsigned int v0; unsigned long v1; unsigned int v2; unsigned long long v4; unsigned long long v5; unsigned long long v7; v1 = a0; v0 = a1; v2 = v0; v4 = v0 & 1; if ((v0 & 1)) { v5 = print_null(0x4, "ecn", "ecn ", 0x0); v0 &= -2; } if (v0) v7 = print_0xhex(0x4, "features", "%#llx ", v2); return; }
iproute2-6.0.0
angr_dream
static _Bool parse_newer(const struct parser_table *entry, char **argv, int *arg_ptr) { struct predicate *our_pred; struct stat stat_newer; const char *arg; set_stat_placeholders(&stat_newer); if (collect_arg_stat_info(argv, arg_ptr, &stat_newer, &arg)) { our_pred = insert_primary(entry, arg); our_pred->args.reftime.ts = get_stat_mtime(&stat_newer); our_pred->args.reftime.xval = XVAL_MTIME; our_pred->args.reftime.kind = COMP_GT; our_pred->est_success_rate = estimate_timestamp_success_rate(stat_newer.st_mtim.tv_sec); return 1; } return 0; }
long long parse_newer(unsigned long long a0, unsigned long long a1, unsigned long long a2) { char v0; struct_0 *v1; char v2; char v3; unsigned long long v5; struct_0 *v6; unsigned int v7; set_stat_placeholders(&v2); if (!collect_arg_stat_info(a1, a2, &v2, &v0)) { v5 = 0; return v5; } v1 = insert_primary(a0, *(&v0), *(&v0)); v6 = v1; v6->field_40 = get_stat_mtime(&v2); v6->field_48 = a2; v1->field_38 = 3; v1->field_3c = 0; estimate_timestamp_success_rate(*(&v3)); v1->field_24 = v7; v5 = 1; return v5; }
findutils
angr_sailr