input
stringlengths
26
172k
output
stringlengths
18
318k
repo_name
stringclasses
23 values
decompiler
stringclasses
5 values
static char *dumpdir_first(struct dumpdir *dump, int all, struct dumpdir_iter **pitr) { struct dumpdir_iter *itr = xmalloc(sizeof(*itr)); itr->dump = dump; itr->all = all; itr->next = 0; *pitr = itr; return dumpdir_next(itr); }
int dumpdir_first(unsigned long a0, unsigned long a1, unsigned long long *a2) { struct_0 *v0; v0 = xmalloc(0x18); v0->field_0 = a0; v0->field_8 = a1; v0->field_10 = 0; *(a2) = v0; return dumpdir_next(v0); }
tar
angr_sailr
static void print_explain(struct link_util *lu, FILE *f) { fprintf(f, "Usage: ... %s [ mode MODE ] [ FLAGS ]\n" "\n" "MODE: l3 | l3s | l2\n" "FLAGS: bridge | private | vepa\n" "(first values are the defaults if nothing is specified).\n", lu->id); }
void print_explain(struct_0 *a0, void *a1) { unsigned long long v1; v1 = fprintf(a1, "Usage: ... %s [ mode MODE ] [ FLAGS ]\n\nMODE: l3 | l3s | " "l2\nFLAGS: bridge | private | vepa\n(first values are the " "defaults if nothing is specified).\n", a0->field_8); return; }
iproute2-6.0.0
angr_phoenix
void *valloc(size) size_t size; { return internal_valloc(size, (char *)((void *)0), 0, 0); }
void *valloc(size_t __size) { void *pvVar1; pvVar1 = (void *)internal_valloc(__size, 0, 0, 0); return pvVar1; }
bash
ghidra
static void usage(char *s) { fprintf(stderr, "Usage: %s {-e VAR[=VAL] | [-t SECONDS] " "{0|1|2|3|4|5|6|S|s|Q|q|A|a|B|b|C|c|U|u}}\n", s); exit(1); }
void usage(unsigned long a0) { fprintf(stderr, "Usage: %s {-e VAR[=VAL] | [-t SECONDS] " "{0|1|2|3|4|5|6|S|s|Q|q|A|a|B|b|C|c|U|u}}\n", a0); exit(0x1); }
sysvinit
angr_phoenix
static char const *do_printf_spec(FILE *out, char const *spec, struct file_data const *file, lin n, struct group const *groups) { char const *f = spec; char c; char c1; f++; while ((c = *f++) == '-' || c == '\'' || c == '0') continue; while (((unsigned int)(c) - '0' <= 9)) c = *f++; if (c == '.') while (((unsigned int)(c = *f++) - '0' <= 9)) continue; c1 = *f++; switch (c) { case 'c': if (c1 != '\'') return 0; else { char value; f = scan_char_literal(f, &value); if (!f) return 0; if (out) putc_unlocked(value, out); } break; case 'd': case 'o': case 'x': case 'X': { lin value; if (file) { if (c1 != 'n') return 0; value = translate_line_number(file, n); } else { value = groups_letter_value(groups, c1); if (value < 0) return 0; } if (out) { printint print_value = value; size_t spec_prefix_len = f - spec - 2; size_t pI_len = sizeof "l" - 1; char *format = ((spec_prefix_len + pI_len + 2) < 4032 - (2 * sa_alignment_max - 1) ? (void *)(((uintptr_t)(char *)__builtin_alloca( (spec_prefix_len + pI_len + 2) + 2 * sa_alignment_max - 1) + (2 * sa_alignment_max - 1)) & ~(uintptr_t)(2 * sa_alignment_max - 1)) : xmmalloca(spec_prefix_len + pI_len + 2)); char *p = format + spec_prefix_len + pI_len; memcpy(format, spec, spec_prefix_len); memcpy(format + spec_prefix_len, "l", pI_len); *p++ = c; *p = '\0'; fprintf(out, format, print_value); freea(format); } } break; default: return 0; } return f; }
char *do_printf_spec(FILE *param_1, void *param_2, long param_3, undefined8 param_4, undefined8 param_5) { long lVar1; void *__src; FILE *__stream; char *pcVar2; size_t __n; ulong uVar3; char *pcVar4; undefined *puVar5; undefined *puVar6; undefined *puVar7; long in_FS_OFFSET; undefined auStack136[8]; undefined8 local_80; undefined8 local_78; long local_70; void *local_68; FILE *local_60; char local_4b; char local_4a; char local_49; char *local_48; long local_40; long local_38; char *local_30; size_t local_28; char *local_20; char *local_18; long local_10; puVar5 = auStack136; local_60 = param_1; local_68 = param_2; local_70 = param_3; local_78 = param_4; local_80 = param_5; local_10 = *(long *)(in_FS_OFFSET + 0x28); local_48 = (char *)((long)param_2 + 1); do { do { pcVar4 = local_48 + 1; local_4a = *local_48; local_48 = pcVar4; } while (local_4a == '-'); } while ((local_4a == '\'') || (local_4a == '0')); while ((int)local_4a - 0x30U < 10) { local_4a = *local_48; local_48 = local_48 + 1; } if (local_4a == '.') { do { pcVar4 = local_48 + 1; local_4a = *local_48; local_48 = pcVar4; } while ((int)local_4a - 0x30U < 10); } pcVar4 = local_48; local_48 = local_48 + 1; local_49 = *pcVar4; switch (local_4a) { case 'X': case 'd': case 'o': case 'x': if (param_3 == 0) { local_40 = groups_letter_value(param_5, (int)local_49); if (local_40 < 0) { pcVar4 = (char *)0x0; puVar7 = auStack136; break; } } else { if (local_49 != 'n') { pcVar4 = (char *)0x0; puVar7 = auStack136; break; } local_40 = translate_line_number(param_3, param_4); } pcVar4 = local_48; puVar7 = auStack136; if (local_60 != (FILE *)0x0) { local_38 = local_40; local_30 = local_48 + (-2 - (long)local_68); local_28 = 1; if (local_48 + (1 - (long)local_68) < (char *)0xfa1) { uVar3 = ((ulong)(local_48 + (0x37 - (long)local_68)) / 0x10) * 0x10; for (; puVar5 != auStack136 + -(uVar3 & 0xfffffffffffff000); puVar5 = puVar5 + -0x1000) { *(undefined8 *)(puVar5 + -8) = *(undefined8 *)(puVar5 + -8); } lVar1 = -(ulong)((uint)uVar3 & 0xfff); puVar6 = puVar5 + lVar1; if ((uVar3 & 0xfff) != 0) { *(undefined8 *)(puVar5 + ((ulong)((uint)uVar3 & 0xfff) - 8) + lVar1) = *(undefined8 *)(puVar5 + ((ulong)((uint)uVar3 & 0xfff) - 8) + lVar1); } pcVar4 = (char *)(((ulong)(puVar5 + lVar1 + 0xf) & 0xfffffffffffffff0) + 0x1f & 0xffffffffffffffe0); } else { pcVar4 = (char *)xmmalloca(local_48 + (1 - (long)local_68)); puVar6 = auStack136; } pcVar2 = local_30; __src = local_68; local_20 = pcVar4; local_18 = pcVar4 + (long)(local_30 + local_28); *(undefined8 *)(puVar6 + -8) = 0x100c6b; memcpy(pcVar4, __src, (size_t)pcVar2); __n = local_28; pcVar4 = local_20 + (long)local_30; *(undefined8 *)(puVar6 + -8) = 0x100c8d; memcpy(pcVar4, &DAT_00100e9c, __n); pcVar2 = local_18; pcVar4 = local_20; lVar1 = local_38; __stream = local_60; local_18 = local_18 + 1; *pcVar2 = local_4a; *local_18 = '\0'; *(undefined8 *)(puVar6 + -8) = 0x100cc2; fprintf(__stream, pcVar4, lVar1); pcVar4 = local_20; *(undefined8 *)(puVar6 + -8) = 0x100cce; freea(pcVar4); pcVar4 = local_48; puVar7 = puVar6; } break; default: pcVar4 = (char *)0x0; puVar7 = auStack136; break; case 'c': if (local_49 == '\'') { local_48 = (char *)scan_char_literal(local_48, &local_4b); if (local_48 == (char *)0x0) { pcVar4 = (char *)0x0; puVar7 = auStack136; } else { pcVar4 = local_48; puVar7 = auStack136; if (local_60 != (FILE *)0x0) { putc_unlocked((int)local_4b, local_60); pcVar4 = local_48; puVar7 = auStack136; } } } else { pcVar4 = (char *)0x0; puVar7 = auStack136; } } if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) { *(undefined8 *)(puVar7 + -8) = 0x100cf3; __stack_chk_fail(); } return pcVar4; }
diffutils
ghidra
static void Rounded_encode(unsigned char *s, const Fq *r) { crypto_uint16 R[761], M[761]; int i; for (i = 0; i < 761; ++i) R[i] = ((r[i] + ((4591 - 1) / 2)) * 10923) >> 15; for (i = 0; i < 761; ++i) M[i] = (4591 + 2) / 3; Encode(s, R, M, 761); }
void Rounded_encode(unsigned long long a0, unsigned short *a1) { unsigned int v0; char v1; char v2; char v3; unsigned long long v5; unsigned long long v6; unsigned long long *v7; unsigned long long v8; for (v0 = 0; v0 <= 760; v0 = __addvsi3(v0, 0x1, v6 >> 15)) { v6 = __mulvsi3(__addvsi3(a1[v0], 0x8f7, v0 * 2), 0x2aab, v5); *(&(&v1)[2 * v0]) = v6 >> 15; } for (v0 = 0; v0 <= 760; v0 = __addvsi3(v0, 0x1, v5)) { *(&(&v2)[2 * v0]) = 1531; } Encode(a0, &v1, &v2, 0x2f9); v8 = *(&v3) ^ v7[5]; return; }
openssh-portable
angr_dream
int main(int argc, char **argv) { int ret; struct passwd *pwd; unsigned char key[512]; size_t key_size; const char *passwd, *username; if ((ret = gnutls_global_init()) < 0) { fprintf(stderr, "global_init: %s\n", gnutls_strerror(ret)); exit(1); } umask(066); process_options(argc, argv); if (!psktool_options.present.pskfile) { fprintf(stderr, "You need to specify a PSK key file\n"); exit(1); } else passwd = psktool_options.arg.pskfile; if (!psktool_options.present.username) { pwd = getpwuid(getuid()); if (pwd == ((void *)0)) { fprintf(stderr, "No such user\n"); return -1; } username = pwd->pw_name; } else username = psktool_options.arg.username; if (psktool_options.present.keysize && psktool_options.value.keysize > 512) { fprintf(stderr, "Key size is too long\n"); exit(1); } if (!psktool_options.present.keysize || psktool_options.value.keysize < 1) key_size = 32; else key_size = psktool_options.value.keysize; printf("Generating a random key for user '%s'\n", username); ret = gnutls_rnd(GNUTLS_RND_RANDOM, (char *)key, key_size); if (ret < 0) { fprintf(stderr, "Not enough randomness\n"); exit(1); } ret = write_key(username, key, key_size, passwd); if (ret == 0) printf("Key stored to %s\n", passwd); return ret; }
int main(undefined4 param_1, undefined8 param_2) { int iVar1; __uid_t __uid; undefined8 uVar2; passwd *ppVar3; long in_FS_OFFSET; long local_238; char *local_230; undefined local_218[520]; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); iVar1 = gnutls_global_init(); if (iVar1 < 0) { uVar2 = gnutls_strerror(iVar1); fprintf(stderr, "global_init: %s\n", uVar2); exit(1); } umask(0x36); process_options(param_1, param_2); uVar2 = _gnutls_rnd; if (DAT_0010103b != '\x01') { fprintf(stderr, "You need to specify a PSK key file\n"); exit(1); } if (DAT_0010103a == '\x01') { local_230 = _printf; } else { __uid = getuid(); ppVar3 = getpwuid(__uid); if (ppVar3 == (passwd *)0x0) { fprintf(stderr, "No such user\n"); iVar1 = -1; goto LAB_00100276; } local_230 = ppVar3->pw_name; } if ((DAT_00101039 != '\0') && (0x200 < DAT_0010106c)) { fprintf(stderr, "Key size is too long\n"); exit(1); } if ((DAT_00101039 == '\x01') && (0 < DAT_0010106c)) { local_238 = (long)DAT_0010106c; } else { local_238 = 0x20; } printf("Generating a random key for user \'%s\'\n", local_230); iVar1 = gnutls_rnd(1, local_218, local_238); if (iVar1 < 0) { fprintf(stderr, "Not enough randomness\n"); exit(1); } iVar1 = write_key(local_230, local_218, local_238, uVar2); if (iVar1 == 0) { printf("Key stored to %s\n", uVar2); } LAB_00100276: if (local_10 == *(long *)(in_FS_OFFSET + 0x28)) { return iVar1; } __stack_chk_fail(); }
gnutls
ghidra
static int skiploop(void) { int skip = evalskip; switch (skip) { case 0: break; case (1 << 0): case (1 << 1): if (__builtin_expect(!!(--skipcount <= 0), 1)) { evalskip = 0; break; } skip = (1 << 0); break; } return skip; }
int skiploop() { unsigned int v0; v0 = 17905618636109546312; if (v0 && v0 >= 0 && v0 - 1 <= 1) { skipcount = skipcount - 1; if (skipcount <= 0) inps4 = 0; else v0 = 1; } return v0; }
dash-0.5.11+git20210903+057cd650a4ed
angr_dream
int sshkey_load_cert(const char *filename, struct sshkey **keyp) { struct sshkey *pub = ((void *)0); char *file = ((void *)0); int r = -1; if (keyp != ((void *)0)) *keyp = ((void *)0); if (asprintf(&file, "%s-cert.pub", filename) == -1) return -2; r = sshkey_try_load_public(keyp, file, ((void *)0)); free(file); sshkey_free(pub); return r; }
long long sshkey_load_cert(unsigned long a0, unsigned long long *a1) { unsigned int v0; void *v1; void *v2; unsigned long long v5; v2 = 0; v1 = 0; v0 = -1; if (a1) *(a1) = 0; if (asprintf(&v1, "%s-cert.pub", a0) == -1) { v5 = 4294967294; } else { v0 = sshkey_try_load_public(a1, v1, 0x0); free(v1); sshkey_free(v2); v5 = v0; } return v5; }
openssh-portable
angr_dream
static void perform_basename(char const *string, char const *suffix, _Bool use_nuls) { char *name = base_name(string); strip_trailing_slashes(name); if (suffix && (!(((name)[0]) == '/')) && !((void)(name), 0)) remove_suffix(name, suffix); fputs_unlocked(name, stdout); putchar_unlocked(use_nuls ? '\0' : '\n'); free(name); }
void perform_basename(long a1, const char *a2, char a3) { int v3; char *s; s = (char *)base_name(a1); strip_trailing_slashes(s); if (a2 && *s != 47) remove_suffix(s, a2); fputs_unlocked(s, stdout); if (a3) v3 = 0; else v3 = 10; putchar_unlocked(v3); free(s); }
coreutils
ida
static int dep_cmp(const void *pa, const void *pb) { const struct mod *a = *(const struct mod **)pa; const struct mod *b = *(const struct mod **)pb; return a->dep_sort_idx - b->dep_sort_idx; }
long dep_cmp(const void *a1, const void *a2) { return (unsigned int)(*(_DWORD *)(*(_QWORD *)a1 + 100LL) - *(_DWORD *)(*(_QWORD *)a2 + 100LL)); }
kmod
ida
int subfile_open(struct tar_stat_info const *dir, char const *file, int flags) { int fd; static _Bool initialized; if (!initialized) { initialized = 1; strerror(2); gettext(""); } while ((fd = openat(dir ? dir->fd : chdir_fd, file, flags)) < 0 && open_failure_recover(dir)) continue; return fd; }
int subfile_open(struct_0 *a0, unsigned long long a1, unsigned long a2) { unsigned int v0; if ((initialized.7442 ^ 1)) { initialized.7442 = 1; strerror(0x2); gettext(&g_404f59); } while (true) { v0 = openat((!a0 ? a0->field_1a8 : chdir_fd), a1, a2, a1); if (v0 >= 0) { return v0; } else if (!open_failure_recover(a0)) { return v0; } } }
tar
angr_sailr
static void open_output_file(const char *path, struct format_val *p) { p->segment = ((void *)0); p->quote_opts = clone_quoting_options(((void *)0)); if (!strcmp(path, "/dev/stderr")) { p->stream = stderr; p->filename = gettext("standard error"); } else if (!strcmp(path, "/dev/stdout")) { p->stream = stdout; p->filename = gettext("standard output"); } else { p->stream = sharefile_fopen(state.shared_files, path); p->filename = path; if (p->stream == ((void *)0)) { fatal_nontarget_file_error((*__errno_location()), path); } } p->dest_is_tty = stream_is_tty(p->stream); }
void open_output_file(char *a0, struct_0 *a1) { a1->field_0 = 0; a1->field_20 = clone_quoting_options(0x0); if (!strcmp(a0, "/dev/stderr")) { a1->field_8 = stderr; a1->field_10 = gettext("standard error"); } else if (!strcmp(a0, "/dev/stdout")) { a1->field_8 = stdout; a1->field_10 = gettext("standard output"); } else { a1->field_8 = sharefile_fopen(gettext, a0, a0); a1->field_10 = a0; if (!a1->field_8) fatal_nontarget_file_error(*(__errno_location()), a0, a0); } *(&a1->field_18) = stream_is_tty(a1->field_8); return; }
findutils
angr_phoenix
static void map_read(Hash_table **ptab, char const *file, uintmax_t (*name_to_id)(char const *), char const *what, uintmax_t maxval) { FILE *fp; char *buf = ((void *)0); size_t bufsize = 0; ssize_t n; struct wordsplit ws; int wsopt; unsigned line; int err = 0; fp = fopen(file, "r"); if (!fp) open_fatal(file); ws.ws_comment = "#"; wsopt = 0x00008000 | 0x00000040 | 0x00000004 | 0x00000800 | (0x00000200 | 0x00000400); line = 0; while ((n = getline(&buf, &bufsize, fp)) > 0) { struct mapentry *ent; uintmax_t orig_id, new_id; char *name = ((void *)0); char *colon; ++line; if (wordsplit(buf, &ws, wsopt)) do { if (error_hook) error_hook(); error(0, 0, gettext("%s:%u: cannot split line: %s"), file, line, wordsplit_strerror(&ws)); fatal_exit(); } while (0); wsopt |= 0x00000008; if (ws.ws_wordc == 0) continue; if (ws.ws_wordc != 2) { error(0, 0, gettext("%s:%u: malformed line"), file, line); err = 1; continue; } if (ws.ws_wordv[0][0] == '+') { if (parse_id(&orig_id, ws.ws_wordv[0] + 1, what, maxval, file, line)) { err = 1; continue; } } else if (name_to_id) { orig_id = name_to_id(ws.ws_wordv[0]); if (orig_id == (18446744073709551615UL)) { error(0, 0, gettext("%s:%u: can't obtain %s of %s"), file, line, what, ws.ws_wordv[0]); err = 1; continue; } } colon = strchr(ws.ws_wordv[1], ':'); if (colon) { if (colon > ws.ws_wordv[1]) name = ws.ws_wordv[1]; *colon++ = 0; if (parse_id(&new_id, colon, what, maxval, file, line)) { err = 1; continue; } } else if (ws.ws_wordv[1][0] == '+') { if (parse_id(&new_id, ws.ws_wordv[1], what, maxval, file, line)) { err = 1; continue; } } else { name = ws.ws_wordv[1]; new_id = name_to_id(ws.ws_wordv[1]); if (new_id == (18446744073709551615UL)) { error(0, 0, gettext("%s:%u: can't obtain %s of %s"), file, line, what, ws.ws_wordv[1]); err = 1; continue; } } ent = xmalloc(sizeof(*ent)); ent->orig_id = orig_id; ent->new_id = new_id; ent->new_name = name ? xstrdup(name) : ((void *)0); if (!((*ptab || (*ptab = hash_initialize(0, 0, map_hash, map_compare, 0))) && hash_insert(*ptab, ent))) xalloc_die(); } if (wsopt & 0x00000008) wordsplit_free(&ws); fclose(fp); if (err) do { if (error_hook) error_hook(); error(0, 0, gettext("errors reading map file")); fatal_exit(); } while (0); }
unsigned long map_read(_QWORD *a1, const char *a2, long (*a3)(const char *), long a4, uintmax_t a5) { long v5; char *v6; char *v7; const char *v8; char *v9; const char *v10; const char *v11; char *v12; long v13; char *v14; unsigned int v19; unsigned int v20; int v21; char *lineptr; size_t n; long v24; long v25; const char *v26; FILE *stream; __ssize_t v28; char *v29; long *v30; long v31; const char **v32; const char *v33; unsigned long v34; v34 = __readfsqword(0x28u); lineptr = 0LL; n = 0LL; v21 = 0; stream = fopen(a2, "r"); if (!stream) open_fatal(a2); v33 = "#"; v19 = 36420; v20 = 0; while (1) { v28 = getline(&lineptr, &n, stream); if (v28 <= 0) break; v26 = 0LL; ++v20; if ((unsigned int)wordsplit(lineptr, &v31, v19)) { if (error_hook) error_hook(); v5 = wordsplit_strerror(&v31); v6 = gettext("%s:%u: cannot split line: %s"); error(0, 0, v6, a2, v20, v5); fatal_exit(); } v19 |= 8u; if (v31) { if (v31 == 2) { if (**v32 == 43) { if ((unsigned int)parse_id((uintmax_t *)&v24, *v32 + 1, a4, a5, (long)a2, v20)) { v21 = 1; } else { LABEL_17: v29 = strchr(v32[1], 58); if (v29) { if (v29 > v32[1]) v26 = v32[1]; v10 = v29++; *v10 = 0; if ((unsigned int)parse_id((uintmax_t *)&v25, v29, a4, a5, (long)a2, v20)) { v21 = 1; } else { LABEL_27: v30 = (long *)xmalloc(24LL); *v30 = v24; v30[1] = v25; if (v26) v13 = xstrdup(v26); else v13 = 0LL; v30[2] = v13; if (!*a1 && (*a1 = hash_initialize(0LL, 0LL, map_hash, map_compare, 0LL)) == 0LL || !hash_insert(*a1, v30)) { xalloc_die(); } } } else if (*v32[1] == 43) { if (!(unsigned int)parse_id((uintmax_t *)&v25, v32[1], a4, a5, (long)a2, v20)) goto LABEL_27; v21 = 1; } else { v26 = v32[1]; v25 = a3(v32[1]); if (v25 != -1) goto LABEL_27; v11 = v32[1]; v12 = gettext("%s:%u: can't obtain %s of %s"); error(0, 0, v12, a2, v20, a4, v11); v21 = 1; } } } else { if (!a3) goto LABEL_17; v24 = a3(*v32); if (v24 != -1) goto LABEL_17; v8 = *v32; v9 = gettext("%s:%u: can't obtain %s of %s"); error(0, 0, v9, a2, v20, a4, v8); v21 = 1; } } else { v7 = gettext("%s:%u: malformed line"); error(0, 0, v7, a2, v20); v21 = 1; } } } if ((v19 & 8) != 0) wordsplit_free(&v31); fclose(stream); if (v21) { if (error_hook) error_hook(); v14 = gettext("errors reading map file"); error(0, 0, v14); fatal_exit(); } return __readfsqword(0x28u) ^ v34; }
tar
ida
static void update_known_hosts(struct hostkeys_update_ctx *ctx) { int r, was_raw = 0, first = 1; int asking = options.update_hostkeys == 2; LogLevel loglevel = asking ? SYSLOG_LEVEL_INFO : SYSLOG_LEVEL_VERBOSE; char *fp, *response; size_t i; struct stat sb; for (i = 0; i < ctx->nkeys; i++) { if (!ctx->keys_verified[i]) continue; if ((fp = sshkey_fingerprint(ctx->keys[i], options.fingerprint_hash, SSH_FP_DEFAULT)) == ((void *)0)) sshfatal("clientloop.c", __func__, 2022, 1, SYSLOG_LEVEL_FATAL, ((void *)0), "sshkey_fingerprint failed"); if (first && asking) hostkey_change_preamble(loglevel); sshlog("clientloop.c", __func__, 2025, 0, loglevel, ((void *)0), "Learned new hostkey: %s %s", sshkey_type(ctx->keys[i]), fp); first = 0; free(fp); } for (i = 0; i < ctx->nold; i++) { if ((fp = sshkey_fingerprint(ctx->old_keys[i], options.fingerprint_hash, SSH_FP_DEFAULT)) == ((void *)0)) sshfatal("clientloop.c", __func__, 2033, 1, SYSLOG_LEVEL_FATAL, ((void *)0), "sshkey_fingerprint failed"); if (first && asking) hostkey_change_preamble(loglevel); sshlog("clientloop.c", __func__, 2036, 0, loglevel, ((void *)0), "Deprecating obsolete hostkey: %s %s", sshkey_type(ctx->old_keys[i]), fp); first = 0; free(fp); } if (options.update_hostkeys == 2) { if (get_saved_tio() != ((void *)0)) { leave_raw_mode(1); was_raw = 1; } response = ((void *)0); for (i = 0; !quit_pending && i < 3; i++) { free(response); response = read_passphrase("Accept updated hostkeys? " "(yes/no): ", 0x0001); if (strcasecmp(response, "yes") == 0) break; else if (quit_pending || response == ((void *)0) || strcasecmp(response, "no") == 0) { options.update_hostkeys = 0; break; } else { sshlog("clientloop.c", __func__, 2058, 0, loglevel, ((void *)0), "Please enter " "\"yes\" or \"no\""); } } if (quit_pending || i >= 3 || response == ((void *)0)) options.update_hostkeys = 0; free(response); if (was_raw) enter_raw_mode(1); } if (options.update_hostkeys == 0) return; for (i = 0; i < options.num_user_hostfiles; i++) { if (stat(options.user_hostfiles[i], &sb) != 0) { if ((*__errno_location()) == 2) { sshlog("clientloop.c", __func__, 2082, 1, SYSLOG_LEVEL_DEBUG1, ((void *)0), "known hosts file %s does not " "exist", options.user_hostfiles[i]); } else { sshlog("clientloop.c", __func__, 2085, 1, SYSLOG_LEVEL_ERROR, ((void *)0), "known hosts file %s " "inaccessible: %s", options.user_hostfiles[i], strerror((*__errno_location()))) ; } continue; } if ((r = hostfile_replace_entries( options.user_hostfiles[i], ctx->host_str, ctx->ip_str, i == 0 ? ctx->keys : ((void *)0), i == 0 ? ctx->nkeys : 0, options.hash_known_hosts, 0, options.fingerprint_hash)) != 0) { sshlog("clientloop.c", __func__, 2096, 1, SYSLOG_LEVEL_ERROR, ssh_err(r), "hostfile_replace_entries failed for %s", options.user_hostfiles[i]); } } }
unsigned long update_known_hosts(_QWORD *a1) { int v1; const char *v2; const char *v3; int *v4; char *v5; long v6; long v7; const char *v8; long v9; int v11; int v12; _BOOL4 v13; unsigned int v14; unsigned int v15; char *s1; unsigned long i; unsigned long j; unsigned long k; unsigned long m; char *ptr; char *ptra; struct stat v23; unsigned long v24; v24 = __readfsqword(0x28u); v11 = 0; v12 = 1; v13 = options[1463] == 2; if (options[1463] == 2) v1 = 3; else v1 = 4; v14 = v1; for (i = 0LL; i < a1[5]; ++i) { if (*(_DWORD *)(4 * i + a1[4])) { ptr = (char *)sshkey_fingerprint(*(_QWORD *)(8 * i + a1[2]), options[1462], 0LL); if (!ptr) sshfatal("clientloop.c", "update_known_hosts", 2022LL, 1LL, 1LL, 0LL, "sshkey_fingerprint failed"); if (v12 && v13) hostkey_change_preamble(v14); v2 = (const char *)sshkey_type(*(_QWORD *)(8 * i + a1[2])); sshlog("clientloop.c", "update_known_hosts", 2025LL, 0LL, v14, 0LL, "Learned new hostkey: %s %s", v2, ptr); v12 = 0; free(ptr); } } for (j = 0LL; j < a1[9]; ++j) { ptra = (char *)sshkey_fingerprint(*(_QWORD *)(8 * j + a1[8]), options[1462], 0LL); if (!ptra) sshfatal("clientloop.c", "update_known_hosts", 2033LL, 1LL, 1LL, 0LL, "sshkey_fingerprint failed"); if (v12 && v13) hostkey_change_preamble(v14); v3 = (const char *)sshkey_type(*(_QWORD *)(8 * j + a1[8])); sshlog("clientloop.c", "update_known_hosts", 2036LL, 0LL, v14, 0LL, "Deprecating obsolete hostkey: %s %s", v3, ptra); v12 = 0; free(ptra); } if (options[1463] == 2) { if (get_saved_tio()) { leave_raw_mode(1LL); v11 = 1; } s1 = 0LL; for (k = 0LL; !quit_pending; ++k) { if (k > 2) break; free(s1); s1 = (char *)read_passphrase("Accept updated hostkeys? (yes/no): ", 1LL); if (!strcasecmp(s1, "yes")) break; if (quit_pending || !s1 || !strcasecmp(s1, "no")) { options[1463] = 0; break; } sshlog("clientloop.c", "update_known_hosts", 2058LL, 0LL, v14, 0LL, "Please enter \"yes\" or \"no\""); } if (quit_pending || k > 2 || !s1) options[1463] = 0; free(s1); if (v11) enter_raw_mode(1LL); } if (options[1463]) { for (m = 0LL; m < options[124]; ++m) { if (stat(*(const char **)&options[2 * m + 126], &v23)) { if (*_errno_location() == 2) { sshlog("clientloop.c", "update_known_hosts", 2082LL, 1LL, 5LL, 0LL, "known hosts file %s does not exist", *(const char **)&options[2 * m + 126]); } else { v4 = _errno_location(); v5 = strerror(*v4); sshlog("clientloop.c", "update_known_hosts", 2085LL, 1LL, 2LL, 0LL, "known hosts file %s inaccessible: %s", *(const char **)&options[2 * m + 126], v5); } } else { if (m) v6 = 0LL; else v6 = a1[5]; if (m) v7 = 0LL; else v7 = a1[2]; v15 = hostfile_replace_entries(*(_QWORD *)&options[2 * m + 126], *a1, a1[1], v7, v6, options[1245], 0LL, options[1462]); if (v15) { v8 = *(const char **)&options[2 * m + 126]; v9 = ssh_err(v15); sshlog("clientloop.c", "update_known_hosts", 2096LL, 1LL, 2LL, v9, "hostfile_replace_entries failed for %s", v8); } } } } return __readfsqword(0x28u) ^ v24; }
openssh-portable
ida
static int histignore_item_func(ign) struct ign *ign; { if (should_expand(ign->val)) ign->flags |= 0x01; return (0); }
long histignore_item_func(long a1) { if ((unsigned int)should_expand(*(_BYTE **)a1)) *(_DWORD *)(a1 + 12) |= 1u; return 0LL; }
bash
ida
static int get_method(in) int in; { uch flags; uch magic[10]; int imagic0; int imagic1; ulg stamp; if (force && to_stdout) { imagic0 = (inptr < insize ? inbuf[inptr++] : fill_inbuf(1)); magic[0] = imagic0; imagic1 = (inptr < insize ? inbuf[inptr++] : fill_inbuf(1)); magic[1] = imagic1; } else { magic[0] = (inptr < insize ? inbuf[inptr++] : fill_inbuf(0)); imagic0 = 0; if (magic[0]) { magic[1] = (inptr < insize ? inbuf[inptr++] : fill_inbuf(0)); imagic1 = 0; } else { imagic1 = (inptr < insize ? inbuf[inptr++] : fill_inbuf(1)); magic[1] = imagic1; } } method = -1; part_nb++; header_bytes = 0; last_member = 0; if (memcmp(magic, "\037\213", 2) == 0 || memcmp(magic, "\037\236", 2) == 0) { method = (int)(inptr < insize ? inbuf[inptr++] : fill_inbuf(0)); if (method != 8) { fprintf(stderr, "%s: %s: unknown method %d -- not supported\n", program_name, ifname, method); exit_code = 1; return -1; } work = unzip; flags = (uch)(inptr < insize ? inbuf[inptr++] : fill_inbuf(0)); if ((flags & 0x20) != 0) { fprintf(stderr, "%s: %s is encrypted -- not supported\n", program_name, ifname); exit_code = 1; return -1; } if ((flags & 0xC0) != 0) { fprintf(stderr, "%s: %s has flags 0x%x -- not supported\n", program_name, ifname, flags); exit_code = 1; if (force <= 1) return -1; } stamp = (ulg)(inptr < insize ? inbuf[inptr++] : fill_inbuf(0)); stamp |= ((ulg)(inptr < insize ? inbuf[inptr++] : fill_inbuf(0))) << 8; stamp |= ((ulg)(inptr < insize ? inbuf[inptr++] : fill_inbuf(0))) << 16; stamp |= ((ulg)(inptr < insize ? inbuf[inptr++] : fill_inbuf(0))) << 24; if (stamp != 0 && !no_time) { if (stamp <= ((time_t)(!(!((time_t)0 < (time_t)-1)) ? (time_t)-1 : ((((time_t)1 << ((sizeof(time_t) * 8) - 2)) - 1) * 2 + 1)))) { time_stamp.tv_sec = stamp; time_stamp.tv_nsec = 0; } else { { if (!quiet) fprintf(stderr, "%s: %s: MTIME %lu out of range for this platform\n", program_name, ifname, stamp); if (exit_code == 0) exit_code = 2; } ; time_stamp.tv_sec = (( time_t)(!(!((time_t)0 < (time_t)-1)) ? (time_t)-1 : ((((time_t)1 << ((sizeof(time_t) * 8) - 2)) - 1) * 2 + 1))); time_stamp.tv_nsec = TIMESPEC_RESOLUTION - 1; } } magic[8] = (inptr < insize ? inbuf[inptr++] : fill_inbuf(0)); magic[9] = (inptr < insize ? inbuf[inptr++] : fill_inbuf(0)); if (flags & 0x02) { magic[2] = 8; magic[3] = flags; magic[4] = stamp & 0xff; magic[5] = (stamp >> 8) & 0xff; magic[6] = (stamp >> 16) & 0xff; magic[7] = stamp >> 24; updcrc(((void *)0), 0); updcrc(magic, 10); } if ((flags & 0x04) != 0) { uch lenbuf[2]; unsigned int len = lenbuf[0] = (inptr < insize ? inbuf[inptr++] : fill_inbuf(0)); len |= (lenbuf[1] = (inptr < insize ? inbuf[inptr++] : fill_inbuf(0))) << 8; if (verbose) { fprintf(stderr, "%s: %s: extra field of %u bytes ignored\n", program_name, ifname, len); } if (flags & 0x02) updcrc(lenbuf, 2); discard_input_bytes(len, flags); } if ((flags & 0x08) != 0) { if (no_name || (to_stdout && !list) || part_nb > 1) { discard_input_bytes(-1, flags); } else { char *p = gzip_base_name(ofname); char *base = p; for (;;) { *p = (char)(inptr < insize ? inbuf[inptr++] : fill_inbuf(0)); if (*p++ == '\0') break; if (p >= ofname + sizeof(ofname)) { gzip_error("corrupted input -- file name too large"); } } if (flags & 0x02) updcrc((uch *)base, p - base); p = gzip_base_name(base); memmove(base, p, strlen(p) + 1); if (!list) { ; if (base) list = 0; } } } if ((flags & 0x10) != 0) { discard_input_bytes(-1, flags); } if (flags & 0x02) { unsigned int crc16 = updcrc(magic, 0) & 0xffff; unsigned int header16 = (inptr < insize ? inbuf[inptr++] : fill_inbuf(0)); header16 |= ((unsigned int)(inptr < insize ? inbuf[inptr++] : fill_inbuf(0))) << 8; if (header16 != crc16) { fprintf(stderr, "%s: %s: header checksum 0x%04x != computed checksum 0x%04x\n", program_name, ifname, header16, crc16); exit_code = 1; if (force <= 1) return -1; } } if (part_nb == 1) { header_bytes = inptr + 2 * 4; } } else if (memcmp(magic, "\120\113\003\004", 2) == 0 && inptr == 2 && memcmp((char *)inbuf, "\120\113\003\004", 4) == 0) { inptr = 0; work = unzip; if (check_zipfile(in) != 0) return -1; last_member = 1; } else if (memcmp(magic, "\037\036", 2) == 0) { work = unpack; method = 2; } else if (memcmp(magic, "\037\235", 2) == 0) { work = unlzw; method = 1; last_member = 1; } else if (memcmp(magic, "\037\240", 2) == 0) { work = unlzh; method = 3; last_member = 1; } else if (force && to_stdout && !list) { method = 0; work = copy; if (imagic1 != (-1)) inptr--; last_member = 1; if (imagic0 != (-1)) { write_buf(1, magic, 1); } } if (method >= 0) return method; if (part_nb == 1) { fprintf(stderr, "\n%s: %s: not in gzip format\n", program_name, ifname); exit_code = 1; return -1; } else { if (magic[0] == 0) { int inbyte; for (inbyte = imagic1; inbyte == 0; inbyte = (inptr < insize ? inbuf[inptr++] : fill_inbuf(1))) continue; if (inbyte == (-1)) { if (verbose) { if (!quiet) fprintf(stderr, "\n%s: %s: decompression OK, trailing zero bytes ignored\n", program_name, ifname); if (exit_code == 0) exit_code = 2; }; return -3; } } { if (!quiet) fprintf(stderr, "\n%s: %s: decompression OK, trailing garbage ignored\n", program_name, ifname); if (exit_code == 0) exit_code = 2; }; return -2; } }
int get_method(unsigned long a0) { char v0; int tmp_15; unsigned int v1; unsigned int v2; unsigned int v3; unsigned int v4; unsigned int v5; unsigned int v6; unsigned long v7; unsigned long long v8; char *v9; char v10; char v11; char v12; char v13; char v14; char v15; char v16; char v17; char v18; char v19; char v20; char v21; unsigned int v23; unsigned long long v24; unsigned long long v25; unsigned long long v26; char v27; if (force && to_stdout) { if (false) { outcnt = 3850979414; v23 = *(-498339038545487787); } else { v23 = fill_inbuf(0x1); } v1 = v23; v12 = v1; if (false) { outcnt = 3850979414; *(&v23) = *(-498339038545487787); } else { v23 = fill_inbuf(0x1); } v2 = v23; v13 = v2; goto LABEL_40230a; } if (false) { outcnt = 3850979414; v23 = *(-498339038545487787); } else { v23 = fill_inbuf(0x0); } v12 = v23; v1 = 0; if (v12) { if (false) { outcnt = 3850979414; *(&v23) = *(-498339038545487787); } else { v23 = fill_inbuf(0x0); } v13 = v23; v2 = 0; } else { if (false) { outcnt = 3850979414; *(&v23) = *(-498339038545487787); } else { v23 = fill_inbuf(0x1); } v2 = v23; v13 = v2; } LABEL_40230a: method = -1; part_nb = part_nb + 1; header_bytes = 0; last_member = 0; if (!memcmp(&v12, &g_405203, 0x2)) { LABEL_402374: if (false) { outcnt = 3850979414; v23 = *(-498339038545487787); } else { v23 = fill_inbuf(0x0); } method = v23; if (method != 8) { fprintf(*(&stderr), "%s: %s: unknown method %d -- not supported\n", -116028600, &ofname, method); exit_code = 1; v23 = -1; goto LABEL_402e27; } work = *(&got.unzip); if (false) { outcnt = 3850979414; *(&v23) = *(-498339038545487787); } else { v23 = fill_inbuf(0x0); } v0 = v23; if ((v0 & 32)) { fprintf(*(&stderr), "%s: %s is encrypted -- not supported\n", -116028600, &ofname); exit_code = 1; v23 = -1; goto LABEL_402e27; } if ((v0 & 192)) { fprintf(*(&stderr), "%s: %s has flags 0x%x -- not supported\n", -116028600, &ofname, v0); exit_code = 1; if (force <= 1) { v23 = -1; goto LABEL_402e27; } } if (false) { outcnt = 3850979414; v24 = *(-498339038545487787); } else { v24 = fill_inbuf(0x0); } v8 = v24; if (false) { outcnt = 3850979414; v25 = *(-498339038545487787) * 0x100; } else { v25 = fill_inbuf(0x0) * 0x100; } v8 |= v25; if (false) { outcnt = 3850979414; v26 = *(-498339038545487787) * 0x10000; } else { v26 = fill_inbuf(0x0) * 0x10000; } v8 |= v26; if (false) { outcnt = 3850979414; v23 = *(-498339038545487787) * 0x1000000; } else { v23 = fill_inbuf(0x0) * 0x1000000; } v8 |= v23; if (v8 && !no_time) { if (v8 >= 0) { time_stamp = v8; g_400018 = 0; } else { if (!quiet) fprintf(*(&stderr), "%s: %s: MTIME %lu out of range for this platform\n", -116028600, &ofname, v8); if (!exit_code) exit_code = 2; time_stamp = 9223372036854775807; g_400018 = 999999999; } } if (false) { outcnt = 3850979414; *(&v23) = *(-498339038545487787); } else { v23 = fill_inbuf(0x0); } v20 = v23; if (false) { outcnt = 3850979414; *(&v23) = *(-498339038545487787); } else { v23 = fill_inbuf(0x0); } v21 = v23; if ((v0 & 2)) { v14 = 8; v15 = v0; v16 = v8; v17 = v8 >> 8; v18 = v8 >> 16; v19 = v8 >> 24; updcrc(0x0, 0x0); updcrc(&v12, 0xa); } if ((v0 & 4)) { if (false) { outcnt = 3850979414; *(&v23) = *(-498339038545487787); } else { v23 = fill_inbuf(0x0); } v10 = v23; v4 = v10; if (false) { outcnt = 3850979414; *(&v23) = *(-498339038545487787); } else { v23 = fill_inbuf(0x0); } v11 = v23; v4 |= (v11 * 0x100); if (verbose) fprintf(*(&stderr), "%s: %s: extra field of %u bytes ignored\n", -116028600, &ofname, v4); if ((v0 & 2)) updcrc(&v10, 0x2); discard_input_bytes(v4, v0); } if ((v0 & 8)) { if (no_name) { LABEL_4028c1: discard_input_bytes(0xffffffffffffffff, v0); } else { if (to_stdout && !list) goto LABEL_4028c1; if (!(part_nb <= 1)) goto LABEL_4028c1; v7 = gzip_base_name(&ofname); v9 = v7; do { if (false) { outcnt = 3850979414; v27 = *(-498339038545487787); } else { v27 = fill_inbuf(0x0); } *(v7) = v27; tmp_15 = v7; v7 += 1; *(&v23) = *(tmp_15); if (!v23) goto LABEL_40295e; } while (v7 < 4195360); gzip_error("corrupted input -- file name too large"); LABEL_40295e: if ((v0 & 2)) updcrc(v9, v7 + -0x1 * v9); v7 = gzip_base_name(v9); memmove(v9, v7, strlen(v7) + 1); if (!list && v9) list = 0; } } if ((v0 & 16)) discard_input_bytes(0xffffffffffffffff, v0); if ((v0 & 2)) { v5 = updcrc(&v12, 0x0); if (false) { outcnt = 3850979414; v23 = *(-498339038545487787); } else { v23 = fill_inbuf(0x0); } v6 = v23; if (false) { outcnt = 3850979414; v23 = *(-498339038545487787) * 0x100; } else { v23 = fill_inbuf(0x0) * 0x100; } v6 |= v23; if (v6 != v5) { fprintf(*(&stderr), "%s: %s: header checksum 0x%04x != computed checksum 0x%04x\n", -116028600, &ofname, v6, v5); exit_code = 1; if (force <= 1) { v23 = -1; goto LABEL_402e27; } } } if (part_nb == 1) { header_bytes = 3850979421; goto LABEL_402cc8; } } else { if (!memcmp(&v12, &g_405206, 0x2)) goto LABEL_402374; if (!memcmp(&v12, &g_40535c, 0x2) && false && !memcmp(&window, &g_40535c, 0x4)) { outcnt = 0; work = *(&got.unzip); if (!check_zipfile(a0)) { last_member = 1; goto LABEL_402cc8; } else { v23 = -1; goto LABEL_402e27; } } if (!memcmp(&v12, &g_405361, 0x2)) { work = got.unpack; method = 2; } else if (!memcmp(&v12, &g_405364, 0x2)) { work = got.unlzw; method = 1; last_member = 1; } else if (!memcmp(&v12, &g_405367, 0x2)) { work = got.unlzh; method = 3; last_member = 1; } else if (force && to_stdout && !list) { method = 0; work = got.copy; if (v2 != -1) outcnt = 3850979412; last_member = 1; if (v1 != -1) write_buf(0x1, &v12, 0x1); } LABEL_402cc8: if (method >= 0) { v23 = method; } else if (part_nb == 1) { fprintf(*(&stderr), "\n%s: %s: not in gzip format\n", -116028600, &ofname); exit_code = 1; v23 = -1; } else { if (!v12) { for (v3 = v2; !v3; v3 = v23) { if (false) { outcnt = 3850979414; v23 = *(-498339038545487787); } else { v23 = fill_inbuf(0x1); } } if (v3 == -1) { if (verbose) { if (!quiet) fprintf( *(&stderr), "\n%s: %s: decompression OK, trailing zero bytes ignored\n", -116028600, &ofname); if (!exit_code) exit_code = 2; } v23 = -3; goto LABEL_402e27; } } if (!quiet) fprintf(*(&stderr), "\n%s: %s: decompression OK, trailing garbage ignored\n", -116028600, &ofname); if (!exit_code) exit_code = 2; v23 = -2; } } LABEL_402e27: return v23; }
gzip-1.12
angr_phoenix
char *rl_filename_completion_function(const char *text, int state) { return fn_filename_completion_function(text, state); }
long rl_filename_completion_function(long a1, unsigned int a2) { return fn_filename_completion_function(a1, a2); }
libedit
ida
void xtrace_print_arith_cmd(list) WORD_LIST *list; { WORD_LIST *w; xtrace_fp = (xtrace_fp ? xtrace_fp : stderr); fprintf(xtrace_fp, "%s", indirection_level_string()); fprintf(xtrace_fp, "(( "); for (w = list; w; w = w->next) fprintf(xtrace_fp, "%s%s", w->word->word, w->next ? " " : ""); fprintf(xtrace_fp, " ))\n"); fflush(xtrace_fp); }
void xtrace_print_arith_cmd(long **param_1) { FILE *pFVar1; undefined8 uVar2; undefined *puVar3; long **local_10; pFVar1 = stderr; if (xtrace_fp != (FILE *)0x0) { pFVar1 = xtrace_fp; } xtrace_fp = pFVar1; uVar2 = indirection_level_string(); fprintf(xtrace_fp, "%s", uVar2); fprintf(xtrace_fp, "(( "); for (local_10 = param_1; local_10 != (long **)0x0; local_10 = (long **)*local_10) { if (*local_10 == (long *)0x0) { puVar3 = &DAT_00103583; } else { puVar3 = &DAT_00103591; } fprintf(xtrace_fp, "%s%s", *local_10[1], puVar3); } fprintf(xtrace_fp, " ))\n"); fflush(xtrace_fp); return; }
bash
ghidra
char *bash_groupname_completion_function(text, state) const char *text; int state; { static char *gname = (char *)((void *)0); static struct group *grent; static int gnamelen; char *value; if (state == 0) { do { if (gname) sh_xfree((gname), "bashline.c", 2658); } while (0); gname = (char *)strcpy(sh_xmalloc((1 + strlen(text)), "bashline.c", 2659), (text)); gnamelen = strlen(gname); setgrent(); } while (grent = getgrent()) { if (gnamelen == 0 || (((gnamelen == 0) ? (1) : ((gname)[0] == (grent->gr_name)[0] && strncmp(gname, grent->gr_name, gnamelen) == 0)))) break; } if (grent == 0) { endgrent(); return ((char *)((void *)0)); } value = (char *)strcpy( sh_xmalloc((1 + strlen(grent->gr_name)), "bashline.c", 2677), (grent->gr_name)); return (value); }
char *bash_groupname_completion_function(const char *a1, int a2) { size_t v2; char *v3; const char *v5; size_t v6; char *v7; if (!a2) { if (gname_11626) sh_xfree(gname_11626, "bashline.c", 2658LL); v2 = strlen(a1); v3 = (char *)sh_xmalloc(v2 + 1, "bashline.c", 2659LL); gname_11626 = strcpy(v3, a1); gnamelen_11628 = strlen(gname_11626); setgrent(); } do grent_11627 = (long)getgrent(); while (grent_11627 && gnamelen_11628 && (*gname_11626 != **(_BYTE **)grent_11627 || strncmp(gname_11626, *(const char **)grent_11627, gnamelen_11628))); if (grent_11627) { v5 = *(const char **)grent_11627; v6 = strlen(*(const char **)grent_11627); v7 = (char *)sh_xmalloc(v6 + 1, "bashline.c", 2677LL); return strcpy(v7, v5); } else { endgrent(); return 0LL; } }
bash
ida
static void print_hw_stats64(FILE *fp, struct rtnl_hw_stats64 *s) { unsigned int cols[] = { strlen("*X: bytes"), strlen("packets"), strlen("errors"), strlen("dropped"), strlen("overrun"), }; if (is_json_context()) { open_json_object("rx"); print_u64(PRINT_JSON, "bytes", ((void *)0), s->rx_bytes); print_u64(PRINT_JSON, "packets", ((void *)0), s->rx_packets); print_u64(PRINT_JSON, "errors", ((void *)0), s->rx_errors); print_u64(PRINT_JSON, "dropped", ((void *)0), s->rx_dropped); print_u64(PRINT_JSON, "multicast", ((void *)0), s->multicast); close_json_object(); open_json_object("tx"); print_u64(PRINT_JSON, "bytes", ((void *)0), s->tx_bytes); print_u64(PRINT_JSON, "packets", ((void *)0), s->tx_packets); print_u64(PRINT_JSON, "errors", ((void *)0), s->tx_errors); print_u64(PRINT_JSON, "dropped", ((void *)0), s->tx_dropped); close_json_object(); } else { size_columns(cols, (sizeof(cols) / sizeof((cols)[0])), s->rx_bytes, s->rx_packets, s->rx_errors, s->rx_dropped, s->multicast); size_columns(cols, (sizeof(cols) / sizeof((cols)[0])), s->tx_bytes, s->tx_packets, s->tx_errors, s->tx_dropped, 0); fprintf(fp, " RX: %*s %*s %*s %*s %*s%s", cols[0] - 4, "bytes", cols[1], "packets", cols[2], "errors", cols[3], "dropped", cols[4], "mcast", _SL_); fprintf(fp, " "); print_num(fp, cols[0], s->rx_bytes); print_num(fp, cols[1], s->rx_packets); print_num(fp, cols[2], s->rx_errors); print_num(fp, cols[3], s->rx_dropped); print_num(fp, cols[4], s->multicast); fprintf(fp, "%s", _SL_); fprintf(fp, " TX: %*s %*s %*s %*s%s", cols[0] - 4, "bytes", cols[1], "packets", cols[2], "errors", cols[3], "dropped", _SL_); fprintf(fp, " "); print_num(fp, cols[0], s->tx_bytes); print_num(fp, cols[1], s->tx_packets); print_num(fp, cols[2], s->tx_errors); print_num(fp, cols[3], s->tx_dropped); } }
void print_hw_stats64(void *a0, unsigned long long a1[9], unsigned long long a2, unsigned long long a3, unsigned long long a4, unsigned long long a5) { unsigned long v0; unsigned long long v1; unsigned long v2; unsigned long long v3; unsigned long v4; unsigned long long v5; unsigned long v6; unsigned int v7; unsigned int v8; unsigned int v9; unsigned int v10; unsigned int v11; char v12; unsigned long long *v14; unsigned long long v15; v7 = strlen("*X: bytes"); v8 = strlen("packets"); v9 = strlen("errors"); v10 = strlen("dropped"); v11 = strlen("overrun"); if (is_json_context("overrun", a1, a2, a3, a4, a5)) { open_json_object("rx"); print_u64(0x2, "bytes", 0x0, a1[2]); print_u64(0x2, "packets", 0x0, a1[0]); print_u64(0x2, "errors", 0x0, a1[4]); print_u64(0x2, "dropped", 0x0, a1[6]); print_u64(0x2, "multicast", 0x0, a1[8]); close_json_object(0x2, "multicast", 0x0, a3, a4, a5); open_json_object("tx"); print_u64(0x2, "bytes", 0x0, a1[3]); print_u64(0x2, "packets", 0x0, a1[1]); print_u64(0x2, "errors", 0x0, a1[5]); print_u64(0x2, "dropped", 0x0, a1[7]); close_json_object(0x2, "dropped", 0x0, a3, a4, a5); } else { v6 = a1[8]; size_columns(&v7, 0x5, a1[2], a1[0], a1[4], a1[6]); v6 = 0; size_columns(&v7, 0x5, a1[3], a1[1], a1[5], a1[7]); v6 = _SL_; v5 = "mcast"; v4 = v11; v3 = "dropped"; v2 = v10; v1 = "errors"; v0 = v9; fprintf(a0, " RX: %*s %*s %*s %*s %*s%s", v7 - 4); fprintf(a0, " "); print_num(a0, v7, a1[2], v7); print_num(a0, v8, a1[0], v8); print_num(a0, v9, a1[4], v9); print_num(a0, v10, a1[6], v10); print_num(a0, v11, a1[8], v11); fprintf(a0, "%s", _SL_); v6 = _SL_; v5 = "dropped"; v4 = v10; v3 = "errors"; v2 = v9; fprintf(a0, " TX: %*s %*s %*s %*s%s", v7 - 4); fprintf(a0, " "); print_num(a0, v7, a1[3], v7); print_num(a0, v8, a1[1], v8); print_num(a0, v9, a1[5], v9); print_num(a0, v10, a1[7], v10); } v15 = *(&v12) ^ v14[5]; return; }
iproute2-6.0.0
angr_phoenix
static int cmp_btime(struct fileinfo const *a, struct fileinfo const *b, int (*cmp)(char const *, char const *)) { int diff = timespec_cmp(get_stat_btime(&b->stat), get_stat_btime(&a->stat)); return diff ? diff : cmp(a->name, b->name); }
void cmp_btime(unsigned long long *a0, unsigned long long *a1, unsigned long long a2) { unsigned int v0; unsigned long long v2; unsigned long long v3; v0 = timespec_cmp(get_stat_btime(a1 + 3), a2, get_stat_btime(a0 + 3), a2); if (v0) v2 = v0; else v3 = (stack_base)[80](*(a0), *(a1), *(a1), a2); return; }
coreutils
angr_phoenix
static int history_set_fun(History *h, History *nh) { HistEvent ev; if (nh->h_first == ((void *)0) || nh->h_next == ((void *)0) || nh->h_last == ((void *)0) || nh->h_prev == ((void *)0) || nh->h_curr == ((void *)0) || nh->h_set == ((void *)0) || nh->h_enter == ((void *)0) || nh->h_add == ((void *)0) || nh->h_clear == ((void *)0) || nh->h_del == ((void *)0) || nh->h_ref == ((void *)0)) { if (h->h_next != history_def_next) { if (history_def_init(&h->h_ref, &ev, 0) == -1) return -1; h->h_first = history_def_first; h->h_next = history_def_next; h->h_last = history_def_last; h->h_prev = history_def_prev; h->h_curr = history_def_curr; h->h_set = history_def_set; h->h_clear = history_def_clear; h->h_enter = history_def_enter; h->h_add = history_def_add; h->h_del = history_def_del; } return -1; } if (h->h_next == history_def_next) history_def_clear(h->h_ref, &ev); h->h_ent = -1; h->h_first = nh->h_first; h->h_next = nh->h_next; h->h_last = nh->h_last; h->h_prev = nh->h_prev; h->h_curr = nh->h_curr; h->h_set = nh->h_set; h->h_clear = nh->h_clear; h->h_enter = nh->h_enter; h->h_add = nh->h_add; h->h_del = nh->h_del; return 0; }
long history_set_fun(long a1, _QWORD *a2) { char v3[24]; unsigned long v4; v4 = __readfsqword(0x28u); if (a2[2] && a2[3] && a2[4] && a2[5] && a2[6] && a2[7] && a2[10] && a2[11] && a2[9] && a2[8] && *a2) { if (*(long (**)(long, long))(a1 + 24) == history_def_next) history_def_clear(*(_QWORD *)a1, (long)v3); *(_DWORD *)(a1 + 8) = -1; *(_QWORD *)(a1 + 16) = a2[2]; *(_QWORD *)(a1 + 24) = a2[3]; *(_QWORD *)(a1 + 32) = a2[4]; *(_QWORD *)(a1 + 40) = a2[5]; *(_QWORD *)(a1 + 48) = a2[6]; *(_QWORD *)(a1 + 56) = a2[7]; *(_QWORD *)(a1 + 72) = a2[9]; *(_QWORD *)(a1 + 80) = a2[10]; *(_QWORD *)(a1 + 88) = a2[11]; *(_QWORD *)(a1 + 64) = a2[8]; return 0LL; } else { if (*(long (**)(long, long))(a1 + 24) != history_def_next) { if ((unsigned int)history_def_init((_QWORD *)a1, (long)v3, 0) == -1) return 0xFFFFFFFFLL; *(_QWORD *)(a1 + 16) = history_def_first; *(_QWORD *)(a1 + 24) = history_def_next; *(_QWORD *)(a1 + 32) = history_def_last; *(_QWORD *)(a1 + 40) = history_def_prev; *(_QWORD *)(a1 + 48) = history_def_curr; *(_QWORD *)(a1 + 56) = history_def_set; *(_QWORD *)(a1 + 72) = history_def_clear; *(_QWORD *)(a1 + 80) = history_def_enter; *(_QWORD *)(a1 + 88) = history_def_add; *(_QWORD *)(a1 + 64) = history_def_del; } return 0xFFFFFFFFLL; } }
libedit
ida
int rl_abort(int count, int key) { return count && key ? 0 : 0; }
undefined8 rl_abort(void) { return 0; }
libedit
ghidra
void demote_sensitive_data(void) { struct sshkey *tmp; u_int i; int r; for (i = 0; i < options.num_host_key_files; i++) { if (sensitive_data.host_keys[i]) { if ((r = sshkey_from_private(sensitive_data.host_keys[i], &tmp)) != 0) sshfatal("sshd.c", __func__, 405, 0, SYSLOG_LEVEL_FATAL, ssh_err(r), "could not demote host %s key", sshkey_type(sensitive_data.host_keys[i])); sshkey_free(sensitive_data.host_keys[i]); sensitive_data.host_keys[i] = tmp; } } }
void demote_sensitive_data(void) { undefined8 uVar1; undefined8 uVar2; undefined *puVar3; long in_FS_OFFSET; char *apcStack80[3]; undefined auStack56[8]; uint local_30; int local_2c; undefined8 local_28; long local_20; puVar3 = auStack56; local_20 = *(long *)(in_FS_OFFSET + 0x28); for (local_30 = 0; local_30 < options._1088_4_; local_30 = local_30 + 1) { if (*(long *)(sensitive_data._0_8_ + (ulong)local_30 * 8) != 0) { uVar1 = *(undefined8 *)(sensitive_data._0_8_ + (ulong)local_30 * 8); *(undefined8 *)(puVar3 + -8) = 0x100449; local_2c = sshkey_from_private(uVar1, &local_28); if (local_2c != 0) { uVar1 = *(undefined8 *)(sensitive_data._0_8_ + (ulong)local_30 * 8); *(undefined8 *)(puVar3 + -8) = 0x10046e; uVar1 = sshkey_type(uVar1); *(undefined8 *)(puVar3 + -8) = 0x10047b; uVar2 = ssh_err(local_2c); *(undefined8 *)(puVar3 + -8) = uVar1; *(char **)(puVar3 + -0x10) = "could not demote host %s key"; *(undefined8 *)(puVar3 + -0x18) = 0x1004af; sshfatal("sshd.c", "demote_sensitive_data", 0x195, 0, 1, uVar2); puVar3 = puVar3 + -0x10; } uVar1 = *(undefined8 *)(sensitive_data._0_8_ + (ulong)local_30 * 8); *(undefined8 *)(puVar3 + -8) = 0x1004cb; sshkey_free(uVar1); *(undefined8 *)((ulong)local_30 * 8 + sensitive_data._0_8_) = local_28; } } if (local_20 != *(long *)(in_FS_OFFSET + 0x28)) { *(undefined8 *)(puVar3 + -8) = 0x10050b; __stack_chk_fail(); } return; }
openssh-portable
ghidra
static char *string_extract_verbatim(string, slen, sindex, charlist, flags) char *string; size_t slen; int *sindex; char *charlist; int flags; { register int i; wchar_t *wcharlist; int c; char *temp; mbstate_t state; memset(&state, '\0', sizeof(mbstate_t)); if ((flags & 0x0010) && charlist[0] == '\'' && charlist[1] == '\0') { temp = string_extract_single_quoted(string, sindex, 0); --*sindex; return temp; } if (*charlist == 0) { temp = string + *sindex; c = (*sindex == 0) ? slen : (((temp) && (temp)[0]) ? ((temp)[1] ? ((temp)[2] ? strlen(temp) : 2) : 1) : 0); temp = (char *)strcpy(sh_xmalloc((1 + strlen(temp)), "subst.c", 1195), (temp)); *sindex += c; return temp; } i = *sindex; wcharlist = 0; while (c = string[i]) { size_t mblength; if ((flags & 0x0010) == 0 && c == '\001') { i += 2; if (i >= slen) { i = slen; c = 0; break; } else ; continue; } else if ((flags & 0x0020) == 0 && c == '\001' && string[i + 1] == '\177') { i += 2; if (i >= slen) { i = slen; c = 0; break; } else ; continue; } if (locale_utf8locale && slen > i && (((string[i]) & 0x80) == 0)) mblength = (string[i] != 0) ? 1 : 0; else mblength = (((__ctype_get_mb_cur_max()) > 1) ? mblen((string + i), (slen - i)) : 1); if (mblength > 1) { wchar_t wc; mblength = mbtowc(&wc, string + i, slen - i); if (((mblength) == (size_t)-1 || (mblength) == (size_t)-2)) { if ((((c) && c == (charlist)[0] && !(charlist)[1]) || (((c) ? ((char *)mbschr((charlist), (c)) != (char *)((void *)0)) : 0)))) break; } else { if (wcharlist == 0) { size_t len; len = mbstowcs(wcharlist, charlist, 0); if (len == -1) len = 0; wcharlist = (wchar_t *)sh_xmalloc((sizeof(wchar_t) * (len + 1)), "subst.c", 1247); mbstowcs(wcharlist, charlist, len + 1); } if (wcschr(wcharlist, wc)) break; } } else if ((((c) && c == (charlist)[0] && !(charlist)[1]) || (((c) ? ((char *)mbschr((charlist), (c)) != (char *)((void *)0)) : 0)))) break; do { if (locale_mb_cur_max > 1) { mbstate_t state_bak; size_t mblength; int _f; _f = is_basic((string)[i]); if (_f) mblength = 1; else if (locale_utf8locale && (((string)[i] & 0x80) == 0)) mblength = (string)[i] != 0; else { state_bak = state; mblength = mbrlen((string) + (i), (slen) - (i), &state); } if (mblength == (size_t)-2 || mblength == (size_t)-1) { state = state_bak; (i)++; } else if (mblength == 0) (i)++; else (i) += mblength; } else (i)++; } while (0); } do { if (wcharlist) sh_xfree((wcharlist), "subst.c", 1264); } while (0); temp = substring(string, *sindex, i); *sindex = i; return (temp); }
char *string_extract_verbatim(long a1, unsigned long a2, signed int *a3, const char *a4, char a5) { int v6; size_t v7; char *v8; signed int v9; long v10; wchar_t pwc; unsigned int v15; wchar_t *pwcs; unsigned long v18; size_t v19; unsigned long v20; char *src; long s; long v23; unsigned long v24; v24 = __readfsqword(0x28u); memset(&s, 0, sizeof(s)); if ((a5 & 0x10) != 0 && *a4 == 39 && !a4[1]) { src = (char *)string_extract_single_quoted(a1, a3, 0); --*a3; return src; } else if (*a4) { v9 = *a3; pwcs = 0LL; while (1) { v15 = *(char *)(v9 + a1); if (!v15) break; if ((a5 & 0x10) != 0 || v15 != 1) { if ((a5 & 0x20) == 0 && v15 == 1 && *(_BYTE *)(v9 + 1LL + a1) == 127) { v9 += 2; if (a2 <= v9) { v9 = a2; v15 = 0; break; } } else { if (locale_utf8locale && a2 > v9 && *(char *)(v9 + a1) >= 0) { v18 = *(_BYTE *)(v9 + a1) != 0; } else { if (_ctype_get_mb_cur_max() <= 1) v10 = 1LL; else v10 = mblen((const char *)(v9 + a1), a2 - v9); v18 = v10; } if (v18 <= 1) { if (v15 && v15 == *a4 && !a4[1] || v15 && mbschr(a4, v15)) break; } else { v18 = mbtowc(&pwc, (const char *)(a1 + v9), a2 - v9); if (v18 < 0xFFFFFFFFFFFFFFFELL) { if (!pwcs) { v19 = mbstowcs(0LL, a4, 0LL); if (v19 == -1LL) v19 = 0LL; pwcs = (wchar_t *)sh_xmalloc(4 * (v19 + 1), "subst.c", 1247LL); mbstowcs(pwcs, a4, v19 + 1); } if (wcschr(pwcs, pwc)) break; } else if (v15 && v15 == *a4 && !a4[1] || v15 && mbschr(a4, v15)) { break; } } if (locale_mb_cur_max <= 1) { ++v9; } else { if ((unsigned int)is_basic(*(_BYTE *)(v9 + a1))) { v20 = 1LL; } else if (locale_utf8locale && *(char *)(v9 + a1) >= 0) { v20 = *(_BYTE *)(v9 + a1) != 0; } else { v23 = s; v20 = mbrlen((const char *)(v9 + a1), a2 - v9, (mbstate_t *)&s); } if (v20 < 0xFFFFFFFFFFFFFFFELL) { if (v20) v9 += v20; else ++v9; } else { s = v23; ++v9; } } } } else { v9 += 2; if (a2 <= v9) { v9 = a2; v15 = 0; break; } } } if (pwcs) sh_xfree(pwcs, "subst.c", 1264LL); src = (char *)substring(a1, (unsigned int)*a3, (unsigned int)v9); *a3 = v9; return src; } else { src = (char *)(*a3 + a1); if (*a3) { if (src && *src) { if (src[1]) { if (src[2]) v6 = strlen(src); else v6 = 2; } else { v6 = 1; } } else { v6 = 0; } } else { v6 = a2; } v15 = v6; v7 = strlen(src); v8 = (char *)sh_xmalloc(v7 + 1, "subst.c", 1195LL); src = strcpy(v8, src); *a3 += v15; return src; } }
bash
ida
ptrdiff_t Fexecute(void *vcp, char const *buf, idx_t size, idx_t *match_size, char const *start_ptr) { char const *beg, *end, *mb_start; idx_t len; char eol = eolbyte; struct kwsearch *kwsearch = vcp; kwset_t kwset = kwsearch->kwset; _Bool mb_check = localeinfo.multibyte & !localeinfo.using_utf8 & !match_lines; _Bool longest = (mb_check | !!start_ptr | match_words) & !match_lines; for (mb_start = beg = start_ptr ? start_ptr : buf; beg <= buf + size; beg++) { struct kwsmatch kwsmatch; ptrdiff_t offset = kwsexec(kwset, beg - match_lines, buf + size - beg + match_lines, &kwsmatch, longest); if (offset < 0) break; len = kwsmatch.size - 2 * match_lines; idx_t mbclen = 0; if (mb_check && mb_goback(&mb_start, &mbclen, beg + offset, buf + size) != 0) { beg = mb_start - 1; continue; } beg += offset; if (!!start_ptr & !match_words) goto success_in_beg_and_len; if (match_lines) { len += start_ptr == ((void *)0); goto success_in_beg_and_len; } if (!match_words) goto success; if (mbclen == 0) { char const *nl = memrchr(mb_start, eol, beg - mb_start); if (nl) mb_start = nl + 1; } if (mbclen > 0 ? !wordchar_next(beg - mbclen, buf + size) : !wordchar_prev(mb_start, beg, buf + size)) for (;;) { if (!wordchar_next(beg + len, buf + size)) { if (start_ptr) goto success_in_beg_and_len; else goto success; } if (!start_ptr && !localeinfo.multibyte) { if (!kwsearch->re) { fgrep_to_grep_pattern(&kwsearch->pattern, &kwsearch->size); kwsearch->re = GEAcompile( kwsearch->pattern, kwsearch->size, ((((((((unsigned long int)1) << 1) << 1) | ((((((((unsigned long int)1) << 1) << 1) << 1) << 1) << 1) << 1) | (((((((((unsigned long int)1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) | (((((((((((unsigned long int)1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) | ((((((((((((((((((unsigned long int)1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1)) | (((unsigned long int)1) << 1) | ((((((((((((((((((((((((((unsigned long int)1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1)) | (((((((((((((unsigned long int)1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1)) & ~(((((((((((((((((((((((((((unsigned long int)1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) | (((((((((unsigned long int)1) << 1) << 1) << 1) << 1) << 1) << 1) << 1))), !!start_ptr); } if (beg + len < buf + size) { end = rawmemchr(beg + len, eol); end++; } else end = buf + size; if (0 <= EGexecute(kwsearch->re, beg, end - beg, match_size, ((void *)0))) goto success_match_words; beg = end - 1; break; } if (!len) break; struct kwsmatch shorter_match; if (kwsexec(kwset, beg, --len, &shorter_match, 1) != 0) break; len = shorter_match.size; } beg += wordchars_size(beg, buf + size); mb_start = beg; } return -1; success: if (beg + len < buf + size) { end = rawmemchr(beg + len, eol); end++; } else end = buf + size; success_match_words: beg = memrchr(buf, eol, beg - buf); beg = beg ? beg + 1 : buf; len = end - beg; success_in_beg_and_len:; *match_size = len; return beg - buf; }
long Fexecute(undefined8 *param_1, void *param_2, long param_3, long *param_4, void *param_5) { char cVar1; byte bVar2; undefined8 uVar3; long lVar4; void *pvVar5; byte bVar6; long in_FS_OFFSET; bool bVar7; void *local_90; long local_88; void *local_80; long local_78; long local_70; undefined8 *local_68; undefined8 local_60; long local_58; void *local_50; undefined local_48[16]; long local_38; undefined local_28[16]; long local_18; long local_10; cVar1 = eolbyte; local_10 = *(long *)(in_FS_OFFSET + 0x28); local_60 = *param_1; bVar7 = (byte)((match_lines ^ 1) & localeinfo & (DAT_00101062 ^ 1)) != 0; bVar6 = (bVar7 || param_5 != (void *)0x0) | match_words; bVar2 = match_lines ^ 1; local_90 = param_2; local_80 = param_2; local_68 = param_1; if (param_5 != (void *)0x0) { local_90 = param_5; local_80 = param_5; } do { if (((void *)((long)param_2 + param_3) < local_80) || (local_58 = kwsexec(local_60, (long)local_80 - (ulong)match_lines, (long)param_2 + (ulong)match_lines + (param_3 - (long)local_80), local_48, (bVar2 & bVar6) != 0), local_58 < 0)) { lVar4 = -1; LAB_001007f7: if (local_10 == *(long *)(in_FS_OFFSET + 0x28)) { return lVar4; } __stack_chk_fail(); } local_70 = local_38 - (int)((uint)match_lines * 2); local_88 = 0; if ((!bVar7) || (lVar4 = mb_goback(&local_90, &local_88, local_58 + (long)local_80), lVar4 == 0)) { local_80 = (void *)((long)local_80 + local_58); if (((match_words ^ 1) & param_5 != (void *)0x0) == 0) { if (match_lines == 0) { if (match_words == 1) { if ((local_88 == 0) && (local_50 = memrchr(local_90, (int)cVar1, (long)local_80 - (long)local_90), local_50 != (void *)0x0)) { local_90 = (void *)((long)local_50 + 1); } if (local_88 < 1) { lVar4 = wordchar_prev(local_90, local_80, param_3 + (long)param_2); } else { lVar4 = wordchar_next((long)local_80 - local_88, param_3 + (long)param_2); } if (lVar4 == 0) { while (true) { lVar4 = wordchar_next((long)local_80 + local_70); if (lVar4 == 0) { if (param_5 != (void *)0x0) goto LAB_001007de; goto LAB_0010072b; } if ((param_5 == (void *)0x0) && (localeinfo != 1)) break; if (local_70 == 0) goto LAB_001006c9; local_70 = local_70 + -1; lVar4 = kwsexec(local_60, local_80, local_70, local_28, 1); if (lVar4 != 0) goto LAB_001006c9; local_70 = local_18; } if (local_68[4] == 0) { fgrep_to_grep_pattern(local_68 + 2, local_68 + 3); uVar3 = GEAcompile(local_68[2], local_68[3], 0x10a46, 0); local_68[4] = uVar3; } if ((ulong)(local_70 + (long)local_80) < (ulong)((long)param_2 + param_3)) { pvVar5 = rawmemchr((void *)((long)local_80 + local_70), (int)cVar1); local_78 = (long)pvVar5 + 1; } else { local_78 = (long)param_2 + param_3; } lVar4 = EGexecute(local_68[4], local_80, local_78 - (long)local_80); if (-1 < lVar4) goto LAB_00100789; local_80 = (void *)(local_78 + -1); } LAB_001006c9: lVar4 = wordchars_size(local_80, param_3 + (long)param_2); local_90 = (void *)((long)local_80 + lVar4); local_80 = local_90; goto LAB_001006f8; } LAB_0010072b: if ((ulong)(local_70 + (long)local_80) < (ulong)((long)param_2 + param_3)) { pvVar5 = rawmemchr((void *)((long)local_80 + local_70), (int)cVar1); local_78 = (long)pvVar5 + 1; } else { local_78 = (long)param_2 + param_3; } LAB_00100789: pvVar5 = memrchr(param_2, (int)cVar1, (long)local_80 - (long)param_2); local_80 = param_2; if (pvVar5 != (void *)0x0) { local_80 = (void *)((long)pvVar5 + 1); } local_70 = local_78 - (long)local_80; } else { local_70 = local_70 + (ulong)(param_5 == (void *)0x0); } } LAB_001007de: *param_4 = local_70; lVar4 = (long)local_80 - (long)param_2; goto LAB_001007f7; } local_80 = (void *)((long)local_90 + -1); LAB_001006f8: local_80 = (void *)((long)local_80 + 1); } while (true); }
grep
ghidra
static off_t input_file_size(int fd, struct stat const *st, char *buf, size_t bufsize) { off_t cur = lseek(fd, 0, 1); if (cur < 0) { if ((*__errno_location()) == 29) (*__errno_location()) = 0; return -1; } off_t size = 0; do { size_t n_read = safe_read(fd, buf + size, bufsize - size); if (n_read == 0) return size; if (n_read == ((size_t)-1)) return -1; size += n_read; } while (size < bufsize); if (st->st_size == 0) { (*__errno_location()) = 75; return -1; } cur += size; off_t end; if (usable_st_size(st) && cur <= st->st_size) end = st->st_size; else { end = lseek(fd, 0, 2); if (end < 0) return -1; if (end != cur) { if (lseek(fd, cur, 0) < 0) return -1; if (end < cur) end = cur; } } size += end - cur; if (size == ((off_t)(!(!((off_t)0 < (off_t)-1)) ? (off_t)-1 : ((((off_t)1 << ((sizeof(off_t) * 8) - 2)) - 1) * 2 + 1)))) { (*__errno_location()) = 75; return -1; } return size; }
__off_t input_file_size(int a1, long a2, long a3, unsigned long a4) { unsigned long v7; __off_t v8; __off_t v9; long offset; __off_t offseta; long v12; offset = lseek(a1, 0LL, 1); if (offset >= 0) { v7 = 0LL; do { v12 = safe_read((unsigned int)a1, a3 + v7, a4 - v7); if (!v12) return v7; if (v12 == -1) return -1LL; v7 += v12; } while (a4 > v7); if (!*(_QWORD *)(a2 + 48)) goto LABEL_12; offseta = v7 + offset; if (usable_st_size(a2) && offseta <= *(_QWORD *)(a2 + 48)) { v9 = *(_QWORD *)(a2 + 48); } else { v9 = lseek(a1, 0LL, 2); if (v9 < 0) return -1LL; if (v9 != offseta) { if (lseek(a1, offseta, 0) < 0) return -1LL; if (v9 < offseta) v9 = offseta; } } v8 = v9 - offseta + v7; if (v8 == 0x7FFFFFFFFFFFFFFFLL) { LABEL_12: *_errno_location() = 75; return -1LL; } return v8; } else { if (*_errno_location() == 29) *_errno_location() = 0; return -1LL; } }
coreutils
ida
static FILE *fopen_output_safely(Char *name, const char *mode) { FILE *fp; IntNative fh; fh = open(name, 01 | 0100 | 0200, 0200 | 0400); if (fh == -1) return ((void *)0); fp = fdopen(fh, mode); if (fp == ((void *)0)) close(fh); return fp; }
FILE *fopen_output_safely(char *param_1, char *param_2) { int __fd; FILE *pFVar1; __fd = open(param_1, 0xc1, 0x180); if (__fd == -1) { pFVar1 = (FILE *)0x0; } else { pFVar1 = fdopen(__fd, param_2); if (pFVar1 == (FILE *)0x0) { close(__fd); } } return pFVar1; }
bzip2
ghidra
static wchar_t *do_hvis(wchar_t *dst, wint_t c, int flags, wint_t nextc, const wchar_t *extra) { if (iswalnum(c) || c == L'$' || c == L'-' || c == L'_' || c == L'.' || c == L'+' || c == L'!' || c == L'*' || c == L'\'' || c == L'(' || c == L')' || c == L',') dst = do_svis(dst, c, flags, nextc, extra); else { *dst++ = L'%'; *dst++ = L"0123456789abcdef"[((unsigned int)c >> 4) & 0xf]; *dst++ = L"0123456789abcdef"[(unsigned int)c & 0xf]; } return dst; }
wint_t *do_hvis(wint_t *a1, wint_t a2, short a3, unsigned char a4, const wchar_t *a5) { _DWORD *v9; if (iswalnum(a2) || a2 == 36 || a2 == 45 || a2 == 95 || a2 == 46 || a2 == 43 || a2 == 33 || a2 == 42 || a2 == 39 || a2 == 40 || a2 == 41 || a2 == 44) { return do_svis(a1, a2, a3, a4, a5); } *a1 = 37; a1[1] = dword_1648[(unsigned char)a2 >> 4]; v9 = a1 + 3; a1[2] = dword_1648[a2 & 0xF]; return v9; }
libbsd-0.11.7
ida
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(unsigned long long a0) { char v0; unsigned int v1; unsigned int v2; char v3; char v4; unsigned long long v5; char v6; void *v7; unsigned int v8; void *v9; unsigned long v10; unsigned long long *v12; unsigned int v13; v10 = v12[5]; v5 = load_ca_cert(0x1, a0); fprintf(outfile, "\nCA certificate:\n"); v2 = gnutls_x509_crt_get_dn3(v5, &v6, 0x0, &v6); if (v2 < 0) { fprintf(*(&stderr), "crt_get_dn: %s\n", gnutls_strerror(v2)); app_exit(0x1); } fprintf(outfile, "\tSubject: %s\n\n", *(&v6)); v2 = gnutls_x509_crl_init(&v4); if (v2 < 0) { fprintf(*(&stderr), "crl_init: %s\n", gnutls_strerror(v2)); app_exit(0x1); } v7 = _gnutls_fread_file(infile, 0x0, &v3); v8 = *(&v3); if (!v7) { if (!infile) v13 = &g_40b4c4; else v13 = "file"; fprintf(*(&stderr), "%s", v13); app_exit(0x1); } else { v2 = gnutls_x509_crl_import(*(&v4), &v7, incert_format, &v7); free(v7); if (v2 < 0) { fprintf(*(&stderr), "import error: %s\n", gnutls_strerror(v2)); app_exit(0x1); } print_crl_info(*(&v4), outfile, a0); v2 = gnutls_x509_crl_verify(*(&v4), &v5, 0x1, 0x0, &v0); if (v2 < 0) { fprintf(*(&stderr), "verification error: %s\n", gnutls_strerror(v2)); app_exit(0x1); } fprintf(outfile, "Verification output: "); if (*(&v0)) { fprintf(outfile, "Not verified. "); v1 = 1; } else { fprintf(outfile, "Verified."); v1 = 0; } v2 = gnutls_certificate_verification_status_print(*(&v0), 0x1, &v9, 0x0); if (v2 >= 0) { fprintf(outfile, " %s", *(&v9)); *(5243720)(*(&v9)); v9 = 0; fprintf(outfile, "\n"); app_exit(v1); } fprintf(*(&stderr), "error: %s\n", gnutls_strerror(v2)); app_exit(0x1); } }
gnutls
angr_sailr
static void reap_exited(void) { while (0 < nprocs && reap(0)) continue; }
void reap_exited() { unsigned long long v1; while (true) { v1 = nprocs; if (nprocs <= 0) break; if (!reap(0x0)) break; } return; }
coreutils
angr_dream
get_stat_mtime(struct stat const *st) { return ((st)->st_mtim); }
(((local_b8.st_mode & 0xf000) != 0x8000 || (*(long *)(param_2 + local_d8 * 0x60 + 8) == local_b8.st_size)))) { auVar16 = get_stat_mtime(&local_b8); lVar13 = param_2 + local_d8 * 0x60; iVar9 = timespec_cmp(*(undefined8 *)(lVar13 + 0x10), *(undefined8 *)(lVar13 + 0x18), SUB168(auVar16, 0), SUB168(auVar16 >> 0x40, 0)); if (iVar9 == 0) { lVar13 = local_d8 * 0x60 + param_2; uVar2 = *(ulong *)(lVar13 + 0x58); *(ulong *)(lVar13 + 0x58) = uVar2 + 1; if ((max_n_unchanged_stats_between_opens <= uVar2) && (follow_mode == 1)) { recheck(param_2 + local_d8 * 0x60, *(int *)(param_2 + local_d8 * 0x60 + 0x40) != 0); *(undefined8 *)(param_2 + local_d8 * 0x60 + 0x58) = 0; } goto LAB_001040a4; } }
coreutils
ghidra
static int session_signal_req(struct ssh *ssh, Session *s) { char *signame = ((void *)0); int r, sig, success = 0; if ((r = sshpkt_get_cstring(ssh, &signame, ((void *)0))) != 0 || (r = sshpkt_get_end(ssh)) != 0) { sshlog("session.c", __func__, 2138, 1, SYSLOG_LEVEL_ERROR, ssh_err(r), "parse"); goto out; } if ((sig = name2sig(signame)) == -1) { sshlog("session.c", __func__, 2142, 1, SYSLOG_LEVEL_ERROR, ((void *)0), "unsupported signal \"%s\"", signame); goto out; } if (s->pid <= 0) { sshlog("session.c", __func__, 2146, 1, SYSLOG_LEVEL_ERROR, ((void *)0), "no pid for session %d", s->self); goto out; } if (s->forced || s->is_subsystem) { sshlog("session.c", __func__, 2150, 1, SYSLOG_LEVEL_ERROR, ((void *)0), "refusing to send signal %s to %s session", signame, s->forced ? "forced-command" : "subsystem"); goto out; } if (!use_privsep || mm_is_monitor()) { sshlog("session.c", __func__, 2155, 1, SYSLOG_LEVEL_ERROR, ((void *)0), "session signalling requires privilege separation"); goto out; } sshlog("session.c", __func__, 2159, 1, SYSLOG_LEVEL_DEBUG1, ((void *)0), "signal %s, killpg(%ld, %d)", signame, (long)s->pid, sig); temporarily_use_uid(s->pw); r = killpg(s->pid, sig); restore_uid(); if (r != 0) { sshlog("session.c", __func__, 2164, 1, SYSLOG_LEVEL_ERROR, ((void *)0), "killpg(%ld, %d): %s", (long)s->pid, sig, strerror((*__errno_location()))); goto out; } success = 1; out: free(signame); return success; }
int session_signal_req(unsigned long long a0, struct_0 *a1) { unsigned long long v0; void *v1; unsigned long long v2; unsigned long v3; unsigned int v4; unsigned int v5; unsigned int v6; void *v7; unsigned long long v9; unsigned int v10; v7 = 0; v5 = 0; v4 = sshpkt_get_cstring(a0, &v7, 0x0, &v7); if (v4) { LABEL_40553b: v2 = "parse"; sshlog("session.c", "session_signal_req", 0x85a, 0x1, 0x2, ssh_err(v4)); } else { v4 = sshpkt_get_end(a0); if (!(!v4)) goto LABEL_40553b; v6 = name2sig(v7); if (v6 == -1) { v3 = v7; v2 = "unsupported signal \"%s\""; sshlog("session.c", "session_signal_req", 0x85e, 0x1, 0x2, 0x0); } else if (a1->field_20 <= 0) { v3 = a1->field_4; v2 = "no pid for session %d"; sshlog("session.c", "session_signal_req", 0x862, 0x1, 0x2, 0x0); } else if (a1->field_24) { LABEL_405649: if (a1->field_24) v9 = "forced-command"; else v9 = "subsystem"; v2 = v9; v1 = v7; v0 = "refusing to send signal %s to %s session"; sshlog("session.c", "session_signal_req", 0x866, 0x1, 0x2, 0x0); } else { if (!(!a1->field_c8)) goto LABEL_405649; if (!use_privsep) { LABEL_4056c0: v2 = "session signalling requires privilege separation"; sshlog("session.c", "session_signal_req", 0x86b, 0x1, 0x2, 0x0); } else { if (!(!mm_is_monitor())) goto LABEL_4056c0; v3 = v6; v2 = a1->field_20; v1 = v7; v0 = "signal %s, killpg(%ld, %d)"; sshlog("session.c", "session_signal_req", 0x86f, 0x1, 0x5, 0x0); temporarily_use_uid(a1->field_10); v10 = a1->field_20; v4 = killpg(a1->field_20, v6); restore_uid(reg_72, v6, 0x86f, 0x1, 0x5, 0x0); if (!v4) { v5 = 1; } else { v3 = strerror(*(__errno_location())); v2 = v6; v1 = a1->field_20; v0 = "killpg(%ld, %d): %s"; sshlog("session.c", "session_signal_req", 0x874, 0x1, 0x2, 0x0); } } } } free(v7); return v5; }
openssh-portable
angr_phoenix
static _Noreturn void test_syntax_error(char const *format, ...) { va_list ap; __builtin_va_start(ap, format); verror(0, 0, format, ap); exit(TEST_FAILURE); }
void test_syntax_error(undefined4 param_1, undefined4 param_2, undefined4 param_3, undefined4 param_4, undefined4 param_5, undefined4 param_6, undefined4 param_7, undefined4 param_8, undefined8 param_9, undefined8 param_10, undefined8 param_11, undefined8 param_12, undefined8 param_13, undefined8 param_14) { char in_AL; long in_FS_OFFSET; undefined4 local_d8; undefined4 local_d4; undefined *local_d0; undefined *local_c8; undefined8 local_c0; undefined local_b8[8]; undefined8 local_b0; undefined8 local_a8; undefined8 local_a0; undefined8 local_98; undefined8 local_90; undefined4 local_88; undefined4 local_78; undefined4 local_68; undefined4 local_58; undefined4 local_48; undefined4 local_38; undefined4 local_28; undefined4 local_18; if (in_AL != '\0') { local_88 = param_1; local_78 = param_2; local_68 = param_3; local_58 = param_4; local_48 = param_5; local_38 = param_6; local_28 = param_7; local_18 = param_8; } local_c0 = *(undefined8 *)(in_FS_OFFSET + 0x28); local_d8 = 8; local_d4 = 0x30; local_d0 = &stack0x00000008; local_c8 = local_b8; local_b0 = param_10; local_a8 = param_11; local_a0 = param_12; local_98 = param_13; local_90 = param_14; verror(0, 0, param_9, &local_d8); exit(2); }
coreutils
ghidra
test_code_t test_record_padding(gnutls_session_t session) { int ret; sprintf( prio_str, "NONE:" "+3DES-CBC:+AES-128-CBC:+CAMELLIA-128-CBC:+AES-256-CBC:+CAMELLIA-256-CBC" ":" "+COMP-NULL" ":+VERS-TLS1.2:+VERS-TLS1.1:+VERS-TLS1.0:-VERS-SSL3.0:" "+MAC-ALL:+MD5:+SHA1" ":+GOST28147-TC26Z-IMIT" ":" "+RSA:+DHE-RSA:+DHE-DSS:+ANON-DH:+ECDHE-RSA:+ECDHE-ECDSA:+ANON-ECDH" ":+VKO-GOST-12" ":%s", rest); { int _ret; if ((_ret = __gnutls_priority_set_direct(session, prio_str, 1045)) != TEST_SUCCEED) { return _ret; } }; gnutls_credentials_set(session, GNUTLS_CRD_CERTIFICATE, xcred); ret = test_do_handshake(session); if (ret == TEST_SUCCEED) { tls1_ok = 1; } else { sprintf(prio_str, "NONE:" "+3DES-CBC:+AES-128-CBC:+CAMELLIA-128-CBC:+AES-256-CBC:+CAMELLIA-" "256-CBC" ":" "+COMP-NULL" ":+VERS-TLS1.2:+VERS-TLS1.1:+VERS-TLS1.0:-VERS-SSL3.0:" "+MAC-ALL:+MD5:+SHA1" ":+GOST28147-TC26Z-IMIT" ":" "+RSA:+DHE-RSA:+DHE-DSS:+ANON-DH:+ECDHE-RSA:+ECDHE-ECDSA:+ANON-ECDH" ":+VKO-GOST-12" ":%%COMPAT:%s", rest); { int _ret; if ((_ret = __gnutls_priority_set_direct(session, prio_str, 1055)) != TEST_SUCCEED) { return _ret; } }; gnutls_credentials_set(session, GNUTLS_CRD_CERTIFICATE, xcred); ret = test_do_handshake(session); if (ret == TEST_SUCCEED) { tls1_ok = 1; strcat(rest, ":%COMPAT"); } else ret = TEST_IGNORE2; } return ret; }
long test_record_padding(long a1) { unsigned int v2; unsigned int v3; unsigned int v4; sprintf(prio_str, "NONE:+3DES-CBC:+AES-128-CBC:+CAMELLIA-128-CBC:+AES-256-CBC:+" "CAMELLIA-256-CBC:+COMP-NULL:+VERS-TLS1.2:+VERS-TLS1.1:+V" "ERS-TLS1.0:-VERS-SSL3.0:+MAC-ALL:+MD5:+SHA1:+GOST28147-TC26Z-IMIT:+" "RSA:+DHE-RSA:+DHE-DSS:+ANON-DH:+ECDHE-RSA:+ECDHE-" "ECDSA:+ANON-ECDH:+VKO-GOST-12:%s", rest); v3 = _gnutls_priority_set_direct(a1, prio_str, 0x415u); if (v3) return v3; gnutls_credentials_set(a1, 1LL, xcred); v2 = test_do_handshake(a1); if (v2) { sprintf(prio_str, "NONE:+3DES-CBC:+AES-128-CBC:+CAMELLIA-128-CBC:+AES-256-CBC:+" "CAMELLIA-256-CBC:+COMP-NULL:+VERS-TLS1.2:+VERS-TLS1.1:" "+VERS-TLS1.0:-VERS-SSL3.0:+MAC-ALL:+MD5:+SHA1:+GOST28147-TC26Z-" "IMIT:+RSA:+DHE-RSA:+DHE-DSS:+ANON-DH:+ECDHE-RSA:+EC" "DHE-ECDSA:+ANON-ECDH:+VKO-GOST-12:%%COMPAT:%s", rest); v4 = _gnutls_priority_set_direct(a1, prio_str, 0x41Fu); if (v4) return v4; gnutls_credentials_set(a1, 1LL, xcred); v2 = test_do_handshake(a1); if (v2) { return 4; } else { tls1_ok = 1; strcat(rest, ":%COMPAT"); } } else { tls1_ok = 1; } return v2; }
gnutls
ida
static void print_dh_info(gnutls_session_t session, const char *str, int print) { unsigned group; int ret; gnutls_datum_t raw_gen = {((void *)0), 0}; gnutls_datum_t raw_prime = {((void *)0), 0}; gnutls_dh_params_t dh_params = ((void *)0); unsigned char *params_data = ((void *)0); size_t params_data_size = 0; if (!print) return; group = gnutls_group_get(session); if (group != 0) { return; } log_msg(stdout, "- %sDiffie-Hellman parameters\n", str); log_msg(stdout, " - Using prime: %d bits\n", gnutls_dh_get_prime_bits(session)); log_msg(stdout, " - Secret key: %d bits\n", gnutls_dh_get_secret_bits(session)); log_msg(stdout, " - Peer's public key: %d bits\n", gnutls_dh_get_peers_public_bits(session)); ret = gnutls_dh_get_group(session, &raw_gen, &raw_prime); if (ret) { fprintf(stderr, "gnutls_dh_get_group %d\n", ret); goto out; } ret = gnutls_dh_params_init(&dh_params); if (ret) { fprintf(stderr, "gnutls_dh_params_init %d\n", ret); goto out; } ret = gnutls_dh_params_import_raw(dh_params, &raw_prime, &raw_gen); if (ret) { fprintf(stderr, "gnutls_dh_params_import_raw %d\n", ret); goto out; } ret = gnutls_dh_params_export_pkcs3(dh_params, GNUTLS_X509_FMT_PEM, params_data, &params_data_size); if (ret != -51) { fprintf(stderr, "gnutls_dh_params_export_pkcs3 %d\n", ret); goto out; } params_data = gnutls_malloc(params_data_size); if (!params_data) { fprintf(stderr, "gnutls_malloc %d\n", ret); goto out; } ret = gnutls_dh_params_export_pkcs3(dh_params, GNUTLS_X509_FMT_PEM, params_data, &params_data_size); if (ret) { fprintf(stderr, "gnutls_dh_params_export_pkcs3-2 %d\n", ret); goto out; } log_msg(stdout, " - PKCS#3 format:\n\n%.*s\n", (int)params_data_size, params_data); out: gnutls_free((void *)(params_data)), params_data = ((void *)0); gnutls_free((void *)(raw_prime.data)), raw_prime.data = ((void *)0); gnutls_free((void *)(raw_gen.data)), raw_gen.data = ((void *)0); gnutls_dh_params_deinit(dh_params); }
void print_dh_info(unsigned long long a0, unsigned long a1, unsigned long a2) { unsigned long v0; unsigned int v1; unsigned int v2; void *v3; void *v4; void *v5; void *v6; unsigned int v7; void *v8; unsigned int v9; char v10; unsigned long long *v12; unsigned long long v13; v0 = a1; v6 = 0; v7 = 0; v8 = 0; v9 = 0; v3 = 0; v5 = 0; v4 = 0; if (a2) { v1 = gnutls_group_get(a0); if (!v1) { log_msg(); gnutls_dh_get_prime_bits(a0); log_msg(); gnutls_dh_get_secret_bits(a0); log_msg(); gnutls_dh_get_peers_public_bits(a0); log_msg(); v2 = gnutls_dh_get_group(a0, &v6, &v8, &v6); if (!v2) { v2 = gnutls_dh_params_init(&v3); if (!v2) { v2 = gnutls_dh_params_import_raw(v3, &v8, &v6, &v8); if (!v2) { v2 = gnutls_dh_params_export_pkcs3(v3, 0x1, v5, &v4); if (v2 == -51) { v5 = *(5243160)(v4); if (v5) { v2 = gnutls_dh_params_export_pkcs3(v3, 0x1, v5, &v4); if (!v2) log_msg(); else fprintf(*(&stderr), "gnutls_dh_params_export_pkcs3-2 %d\n", v2); } else { fprintf(*(&stderr), "gnutls_malloc %d\n", v2); } } else { fprintf(*(&stderr), "gnutls_dh_params_export_pkcs3 %d\n", v2); } } else { fprintf(*(&stderr), "gnutls_dh_params_import_raw %d\n", v2); } } else { fprintf(*(&stderr), "gnutls_dh_params_init %d\n", v2); } } else { fprintf(*(&stderr), "gnutls_dh_get_group %d\n", v2); } *(5242960)(v5); v5 = 0; *(5242960)(v8); v8 = 0; *(5242960)(v6); v6 = 0; gnutls_dh_params_deinit(v3); } } v13 = *(&v10) ^ v12[5]; return; }
gnutls
angr_sailr
static char *authmethods_get(Authctxt *authctxt) { struct sshbuf *b; char *list; int i, r; if ((b = sshbuf_new()) == ((void *)0)) sshfatal("auth2.c", __func__, 491, 1, SYSLOG_LEVEL_FATAL, ((void *)0), "sshbuf_new failed"); for (i = 0; authmethods[i] != ((void *)0); i++) { if (strcmp(authmethods[i]->name, "none") == 0) continue; if (authmethods[i]->enabled == ((void *)0) || *(authmethods[i]->enabled) == 0) continue; if (!auth2_method_allowed(authctxt, authmethods[i]->name, ((void *)0))) continue; if ((r = sshbuf_putf(b, "%s%s", sshbuf_len(b) ? "," : "", authmethods[i]->name)) != 0) sshfatal("auth2.c", __func__, 503, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "buffer error"); } if ((list = sshbuf_dup_string(b)) == ((void *)0)) sshfatal("auth2.c", __func__, 506, 1, SYSLOG_LEVEL_FATAL, ((void *)0), "sshbuf_dup_string failed"); sshbuf_free(b); return list; }
long authmethods_get(undefined8 param_1) { char *__s1; int iVar1; long lVar2; undefined *puVar3; undefined8 uVar4; char **ppcVar5; undefined *puVar6; undefined *puVar7; char *pcStack88; undefined8 uStack80; undefined auStack72[8]; undefined8 local_40; int local_30; int local_2c; long local_28; long local_20; ppcVar5 = (char **)auStack72; uStack80 = 0x101370; local_40 = param_1; local_28 = sshbuf_new(); if (local_28 == 0) { ppcVar5 = &pcStack88; pcStack88 = "sshbuf_new failed"; sshfatal("auth2.c", "authmethods_get", 0x1eb, 1, 1, 0); } local_30 = 0; puVar7 = (undefined *)ppcVar5; while (*(long *)(authmethods + (long)local_30 * 8) != 0) { __s1 = **(char ***)(authmethods + (long)local_30 * 8); *(undefined8 *)(puVar7 + -8) = 0x1013eb; iVar1 = strcmp(__s1, "none"); puVar6 = puVar7; if (((iVar1 != 0) && (*(long *)(*(long *)(authmethods + (long)local_30 * 8) + 0x18) != 0)) && (**(int **)(*(long *)(authmethods + (long)local_30 * 8) + 0x18) != 0)) { uVar4 = **(undefined8 **)(authmethods + (long)local_30 * 8); *(undefined8 *)(puVar7 + -8) = 0x10146d; iVar1 = auth2_method_allowed(local_40, uVar4, 0); if (iVar1 != 0) { uVar4 = **(undefined8 **)(authmethods + (long)local_30 * 8); *(undefined8 *)(puVar7 + -8) = 0x10149c; lVar2 = sshbuf_len(local_28); if (lVar2 == 0) { puVar3 = &DAT_00102830; } else { puVar3 = &DAT_00102b63; } *(undefined8 *)(puVar7 + -8) = 0x1014cc; local_2c = sshbuf_putf(local_28, &DAT_001029dd, puVar3, uVar4); if (local_2c != 0) { *(undefined8 *)(puVar7 + -8) = 0x1014df; uVar4 = ssh_err(local_2c); puVar6 = puVar7 + -0x10; *(char **)(puVar7 + -0x10) = "buffer error"; *(undefined8 *)(puVar7 + -0x18) = 0x101516; sshfatal("auth2.c", "authmethods_get", 0x1f7, 1, 1, uVar4); } } } *(undefined8 *)(puVar6 + -8) = 0x10152a; local_30 = __addvsi3(local_30, 1); puVar7 = puVar6; } *(undefined8 *)(puVar7 + -8) = 0x10155a; local_20 = sshbuf_dup_string(local_28); puVar6 = puVar7; if (local_20 == 0) { puVar6 = puVar7 + -0x10; *(char **)(puVar7 + -0x10) = "sshbuf_dup_string failed"; *(undefined8 *)(puVar7 + -0x18) = 0x10159f; sshfatal("auth2.c", "authmethods_get", 0x1fa, 1, 1, 0); } lVar2 = local_28; *(undefined8 *)(puVar6 + -8) = 0x1015ab; sshbuf_free(lVar2); return local_20; }
openssh-portable
ghidra
static int execute_cond_command(cond_command) COND_COM *cond_command; { int retval, save_line_number; save_line_number = line_number; do { line_number = cond_command->line; if (signal_in_progress((64 + 1) + 1) == 0 && running_trap != ((64 + 1) + 1 + 1)) line_number_for_err_trap = line_number; } while (0); if (variable_context && interactive_shell && sourcelevel == 0) { line_number -= function_line_number - 1; if (line_number <= 0) line_number = 1; } command_string_index = 0; print_cond_command(cond_command); if (signal_in_progress((64 + 1)) == 0 && running_trap == 0) { do { if (the_printed_command_except_trap) sh_xfree((the_printed_command_except_trap), "execute_cmd.c", 4041); } while (0); the_printed_command_except_trap = (char *)strcpy( sh_xmalloc((1 + strlen(the_printed_command)), "execute_cmd.c", 4042), (the_printed_command)); } retval = run_debug_trap(); if (debugging_mode && retval != 0) { line_number = save_line_number; return (0); } this_command_name = "[["; last_command_exit_value = retval = execute_cond_node(cond_command); line_number = save_line_number; return (retval); }
undefined4 execute_cond_command(long param_1) { undefined4 uVar1; char *__src; int iVar2; undefined4 uVar3; size_t sVar4; char *__dest; uVar1 = line_number; line_number = *(int *)(param_1 + 4); iVar2 = signal_in_progress(0x42); if ((iVar2 == 0) && (running_trap != 0x43)) { line_number_for_err_trap = line_number; } if (((variable_context != 0) && (interactive_shell != 0)) && (sourcelevel == 0)) { line_number = line_number - (function_line_number + -1); if (line_number < 1) { line_number = 1; } } _command_string_index = 0; print_cond_command(param_1); iVar2 = signal_in_progress(0x41); if ((iVar2 == 0) && (running_trap == 0)) { if (the_printed_command_except_trap != 0) { sh_xfree(the_printed_command_except_trap, "execute_cmd.c", 0xfc9); } __src = the_printed_command; sVar4 = strlen(the_printed_command); __dest = (char *)sh_xmalloc(sVar4 + 1, "execute_cmd.c", 0xfca); strcpy(__dest, __src); } iVar2 = run_debug_trap(); if ((debugging_mode == 0) || (iVar2 == 0)) { this_command_name = &DAT_0010b3a8; last_command_exit_value = execute_cond_node(param_1); uVar3 = last_command_exit_value; } else { uVar3 = 0; } line_number = uVar1; return uVar3; }
bash
ghidra
static _Bool restricted_shell(const char *shellname) { const char *line; setusershell(); while ((line = getusershell()) != ((void *)0)) { if (('#' != *line) && (strcmp(line, shellname) == 0)) { endusershell(); return 0; } } endusershell(); return 1; }
undefined8 restricted_shell(char *param_1) { int iVar1; char *__s1; setusershell(); do { __s1 = getusershell(); if (__s1 == (char *)0x0) { endusershell(); return 1; } } while ((*__s1 == '#') || (iVar1 = strcmp(__s1, param_1), iVar1 != 0)); endusershell(); return 0; }
shadow
ghidra
int crypto_sign_ed25519_ref_fe25519_iszero( const crypto_sign_ed25519_ref_fe25519 *x) { int i; int r; crypto_sign_ed25519_ref_fe25519 t = *x; crypto_sign_ed25519_ref_fe25519_freeze(&t); r = equal(t.v[0], 0); for (i = 1; i < 32; i++) r &= equal(t.v[i], 0); return r; }
uint crypto_sign_ed25519_ref_fe25519_iszero(ulong *param_1) { uint uVar1; long in_FS_OFFSET; int local_b0; uint local_ac; ulong local_a8; ulong local_a0; ulong local_98; ulong local_90; ulong local_88; ulong local_80; ulong local_78; ulong local_70; ulong local_68; ulong local_60; ulong local_58; ulong local_50; ulong local_48; ulong local_40; ulong local_38; ulong local_30; long local_20; local_20 = *(long *)(in_FS_OFFSET + 0x28); local_a8 = *param_1; local_a0 = param_1[1]; local_98 = param_1[2]; local_90 = param_1[3]; local_88 = param_1[4]; local_80 = param_1[5]; local_78 = param_1[6]; local_70 = param_1[7]; local_68 = param_1[8]; local_60 = param_1[9]; local_58 = param_1[10]; local_50 = param_1[0xb]; local_48 = param_1[0xc]; local_40 = param_1[0xd]; local_30 = param_1[0xf]; local_38 = param_1[0xe]; crypto_sign_ed25519_ref_fe25519_freeze(&local_a8); local_ac = equal(local_a8 & 0xffffffff, 0); for (local_b0 = 1; local_b0 < 0x20; local_b0 = __addvsi3(local_b0, 1)) { uVar1 = equal(*(undefined4 *)((long)&local_a8 + (long)local_b0 * 4), 0); local_ac = uVar1 & local_ac; } if (local_20 != *(long *)(in_FS_OFFSET + 0x28)) { __stack_chk_fail(); } return local_ac; }
openssh-portable
ghidra
int channel_proxy_downstream(struct ssh *ssh, Channel *downstream) { Channel *c = ((void *)0); struct sshbuf *original = ((void *)0), *modified = ((void *)0); const u_char *cp; char *ctype = ((void *)0), *listen_host = ((void *)0); u_char type; size_t have; int ret = -1, r; u_int id, remote_id, listen_port; if ((r = sshbuf_get_string_direct(downstream->input, &cp, &have)) != 0) { sshlog("channels.c", __func__, 2952, 1, SYSLOG_LEVEL_ERROR, ssh_err(r), "parse"); return -1; } if (have < 2) { sshlog("channels.c", __func__, 2956, 1, SYSLOG_LEVEL_ERROR, ((void *)0), "short message"); return -1; } type = cp[1]; cp += 2; have -= 2; if (ssh_packet_log_type(type)) sshlog("channels.c", __func__, 2964, 1, SYSLOG_LEVEL_DEBUG3, ((void *)0), "channel %u: down->up: type %u", downstream->self, type); switch (type) { case 90: if ((original = sshbuf_from(cp, have)) == ((void *)0) || (modified = sshbuf_new()) == ((void *)0)) { sshlog("channels.c", __func__, 2971, 1, SYSLOG_LEVEL_ERROR, ((void *)0), "alloc"); goto out; } if ((r = sshbuf_get_cstring(original, &ctype, ((void *)0))) != 0 || (r = sshbuf_get_u32(original, &id)) != 0) { sshlog("channels.c", __func__, 2976, 1, SYSLOG_LEVEL_ERROR, ssh_err(r), "parse"); goto out; } c = channel_new(ssh, "mux proxy", 20, -1, -1, -1, 0, 0, 0, ctype, 1); c->mux_ctx = downstream; c->mux_downstream_id = id; if ((r = sshbuf_put_cstring(modified, ctype)) != 0 || (r = sshbuf_put_u32(modified, c->self)) != 0 || (r = sshbuf_putb(modified, original)) != 0) { sshlog("channels.c", __func__, 2986, 1, SYSLOG_LEVEL_ERROR, ssh_err(r), "compose"); channel_free(ssh, c); goto out; } break; case 91: if ((original = sshbuf_from(cp, have)) == ((void *)0) || (modified = sshbuf_new()) == ((void *)0)) { sshlog("channels.c", __func__, 2998, 1, SYSLOG_LEVEL_ERROR, ((void *)0), "alloc"); goto out; } if ((r = sshbuf_get_u32(original, &remote_id)) != 0 || (r = sshbuf_get_u32(original, &id)) != 0) { sshlog("channels.c", __func__, 3003, 1, SYSLOG_LEVEL_ERROR, ssh_err(r), "parse"); goto out; } c = channel_new(ssh, "mux proxy", 20, -1, -1, -1, 0, 0, 0, "mux-down-connect", 1); c->mux_ctx = downstream; c->mux_downstream_id = id; c->remote_id = remote_id; c->have_remote_id = 1; if ((r = sshbuf_put_u32(modified, remote_id)) != 0 || (r = sshbuf_put_u32(modified, c->self)) != 0 || (r = sshbuf_putb(modified, original)) != 0) { sshlog("channels.c", __func__, 3015, 1, SYSLOG_LEVEL_ERROR, ssh_err(r), "compose"); channel_free(ssh, c); goto out; } break; case 80: if ((original = sshbuf_from(cp, have)) == ((void *)0)) { sshlog("channels.c", __func__, 3022, 1, SYSLOG_LEVEL_ERROR, ((void *)0), "alloc"); goto out; } if ((r = sshbuf_get_cstring(original, &ctype, ((void *)0))) != 0) { sshlog("channels.c", __func__, 3026, 1, SYSLOG_LEVEL_ERROR, ssh_err(r), "parse"); goto out; } if (strcmp(ctype, "tcpip-forward") != 0) { sshlog("channels.c", __func__, 3030, 1, SYSLOG_LEVEL_ERROR, ((void *)0), "unsupported request %s", ctype); goto out; } if ((r = sshbuf_get_u8(original, ((void *)0))) != 0 || (r = sshbuf_get_cstring(original, &listen_host, ((void *)0))) != 0 || (r = sshbuf_get_u32(original, &listen_port)) != 0) { sshlog("channels.c", __func__, 3036, 1, SYSLOG_LEVEL_ERROR, ssh_err(r), "parse"); goto out; } if (listen_port > 65535) { sshlog("channels.c", __func__, 3040, 1, SYSLOG_LEVEL_ERROR, ((void *)0), "tcpip-forward for %s: bad port %u", listen_host, listen_port); goto out; } permission_set_add(ssh, 0x101, (1 << 1), "<mux>", -1, listen_host, ((void *)0), (int)listen_port, downstream); listen_host = ((void *)0); break; case 97: if (have < 4) break; remote_id = (((u_int32_t)(((const u_char *)(cp))[0]) << 24) | ((u_int32_t)(((const u_char *)(cp))[1]) << 16) | ((u_int32_t)(((const u_char *)(cp))[2]) << 8) | (u_int32_t)(((const u_char *)(cp))[3])); if ((c = channel_by_remote_id(ssh, remote_id)) != ((void *)0)) { if (c->flags & 0x02) channel_free(ssh, c); else c->flags |= 0x01; } break; } if (modified) { if ((r = sshpkt_start(ssh, type)) != 0 || (r = sshpkt_putb(ssh, modified)) != 0 || (r = sshpkt_send(ssh)) != 0) { sshlog("channels.c", __func__, 3065, 1, SYSLOG_LEVEL_ERROR, ssh_err(r), "send"); goto out; } } else { if ((r = sshpkt_start(ssh, type)) != 0 || (r = sshpkt_put(ssh, cp, have)) != 0 || (r = sshpkt_send(ssh)) != 0) { sshlog("channels.c", __func__, 3072, 1, SYSLOG_LEVEL_ERROR, ssh_err(r), "send"); goto out; } } ret = 0; out: free(ctype); free(listen_host); sshbuf_free(original); sshbuf_free(modified); return ret; }
long long channel_proxy_downstream(void *a0, struct_0 *a1) { void *v0; char v1; char v2; char v3; char v4; unsigned int v5; unsigned int v6; char v7[4]; void *v8; void *v9; char v10; unsigned long long v11; void *v12; struct_2 *v13; unsigned long long v15; unsigned long long v16; unsigned long long v17; unsigned long long v18; unsigned long long v19; v13 = 0; v11 = 0; v12 = 0; v8 = 0; v9 = 0; v5 = -1; v6 = sshbuf_get_string_direct(a1->field_68, &v7, &v10, &v7); if (v6) { sshlog("channels.c", "channel_proxy_downstream", 0xb88, 0x1, 0x2, ssh_err(v6), "parse"); v15 = 4294967295; } else if (*(&v10) <= 1) { sshlog("channels.c", "channel_proxy_downstream", 0xb8c, 0x1, 0x2, 0x0, "short message"); v15 = 4294967295; } else { v1 = *((*(&v7) + 1)); *(&v7) = *(&v7) + 2; v10 = *(&v10) - 2; if (ssh_packet_log_type(v1)) sshlog("channels.c", "channel_proxy_downstream", 0xb94, 0x1, 0x7, 0x0, "channel %u: down->up: type %u"); if (v1 != 97) { if (!(v1 <= 97)) goto LABEL_40a355; if (v1 == 91) { v11 = sshbuf_from(v7, v10, v10); if (v11) { v12 = sshbuf_new(a0, a1, v16, v17, 0x7, 0x0); if (v12) { v6 = sshbuf_get_u32(v11, &v3, &v3); if (!v6) { v6 = sshbuf_get_u32(v11, &v2, &v2); if (!v6) { v13 = channel_new(a0, "mux proxy", 0x14, 0xffffffff, 0xffffffff, 0xffffffff, 0x0, 0x0, 0x0, "mux-down-connect", 0x1); v13->field_150 = a1; v13->field_15c = *(&v2); v13->field_8 = v3; v13->field_c = 1; v6 = sshbuf_put_u32(v12, v3, v3); if (!v6) { v6 = sshbuf_put_u32(v12, v13->field_4, v13->field_4); if (!v6) { v6 = sshbuf_putb(v12, v11, v11); if (!v6) goto LABEL_40a355; } } sshlog("channels.c", "channel_proxy_downstream", 0xbc7, 0x1, 0x2, ssh_err(v6), "compose"); channel_free(a0, v13); goto LABEL_40a498; } } sshlog("channels.c", "channel_proxy_downstream", 0xbbb, 0x1, 0x2, ssh_err(v6), "parse"); goto LABEL_40a498; } } sshlog("channels.c", "channel_proxy_downstream", 0xbb6, 0x1, 0x2, 0x0, "alloc"); goto LABEL_40a498; } if (!(v1 <= 91)) goto LABEL_40a355; if (v1 != 80 && v1 == 90) { v11 = sshbuf_from(v7, v10, v10); if (v11) { v12 = sshbuf_new(a0, a1, v18, v19, 0x7, 0x0); if (v12) { v6 = sshbuf_get_cstring(v11, &v8, 0x0, &v8); if (!v6) { v6 = sshbuf_get_u32(v11, &v2, &v2); if (!v6) { v13 = channel_new(a0, "mux proxy", 0x14, 0xffffffff, 0xffffffff, 0xffffffff, 0x0, 0x0, 0x0, v8, 0x1); v13->field_150 = a1; v13->field_15c = *(&v2); v6 = sshbuf_put_cstring(v12, v8, v8); if (!v6) { v6 = sshbuf_put_u32(v12, v13->field_4, v13->field_4); if (!v6) { v6 = sshbuf_putb(v12, v11, v11); if (!v6) goto LABEL_40a355; } } sshlog("channels.c", "channel_proxy_downstream", 0xbaa, 0x1, 0x2, ssh_err(v6), "compose"); channel_free(a0, v13); goto LABEL_40a498; } } sshlog("channels.c", "channel_proxy_downstream", 0xba0, 0x1, 0x2, ssh_err(v6), "parse"); goto LABEL_40a498; } } sshlog("channels.c", "channel_proxy_downstream", 0xb9b, 0x1, 0x2, 0x0, "alloc"); goto LABEL_40a498; } v11 = sshbuf_from(v7, v10, v10); if (!v11) { sshlog("channels.c", "channel_proxy_downstream", 0xbce, 0x1, 0x2, 0x0, "alloc"); goto LABEL_40a498; } v6 = sshbuf_get_cstring(v11, &v8, 0x0, &v8); if (v6) { sshlog("channels.c", "channel_proxy_downstream", 0xbd2, 0x1, 0x2, ssh_err(v6), "parse"); goto LABEL_40a498; } if (strcmp(v8, "tcpip-forward")) { v0 = v8; sshlog("channels.c", "channel_proxy_downstream", 0xbd6, 0x1, 0x2, 0x0, "unsupported request %s"); goto LABEL_40a498; } v6 = sshbuf_get_u8(v11, 0x0); if (!v6) { v6 = sshbuf_get_cstring(v11, &v9, 0x0, &v9); if (!v6) { v6 = sshbuf_get_u32(v11, &v4, &v4); if (!v6) { if (*(&v4) > 65535) { sshlog("channels.c", "channel_proxy_downstream", 0xbe0, 0x1, 0x2, 0x0, "tcpip-forward for %s: bad port %u"); goto LABEL_40a498; } else { permission_set_add(a0, 0x101, 0x2, "<mux>", 0xffffffff, v9, 0x0, *(&v4), a1); v9 = 0; goto LABEL_40a355; } } } } sshlog("channels.c", "channel_proxy_downstream", 0xbdc, 0x1, 0x2, ssh_err(v6), "parse"); } else { if (v10 > 3) { v3 = v7[3] | (v7[0] * 0x1000000) | (v7[1] * 0x10000) | (v7[2] * 0x100); v13 = channel_by_remote_id(a0, v3); if (v13) { if (!(v13->field_18 & 2)) v13->field_18 = v13->field_18 | 1; else channel_free(a0, v13); } } LABEL_40a355: if (!v12) { v6 = sshpkt_start(a0, v1); if (!v6) { v6 = sshpkt_put(a0, v7, v10, v7); if (!v6) { v6 = sshpkt_send(a0); if (!v6) goto LABEL_40a491; } } sshlog("channels.c", "channel_proxy_downstream", 0xc00, 0x1, 0x2, ssh_err(v6), "send"); goto LABEL_40a498; } v6 = sshpkt_start(a0, v1); if (v6) { LABEL_40a3b0: sshlog("channels.c", "channel_proxy_downstream", 0xbf9, 0x1, 0x2, ssh_err(v6), "send"); } else { v6 = sshpkt_putb(a0, v12, v12); if (!(!v6)) goto LABEL_40a3b0; v6 = sshpkt_send(a0); if (!(!v6)) goto LABEL_40a3b0; LABEL_40a491: v5 = 0; } } LABEL_40a498: free(v8); free(v9); sshbuf_free(v11); sshbuf_free(v12); v15 = v5; } return v15; }
openssh-portable
angr_phoenix
int inflateBack(strm, in, in_desc, out, out_desc) z_streamp strm; in_func in; void *in_desc; out_func out; void *out_desc; { struct inflate_state *state; unsigned char *next; unsigned char *put; unsigned have, left; unsigned long hold; unsigned bits; unsigned copy; unsigned char *from; code here; code last; unsigned len; int ret; static const unsigned short order[19] = {16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15}; if (strm == 0 || strm->state == 0) return (-2); state = (struct inflate_state *)strm->state; strm->msg = 0; state->mode = TYPE; state->last = 0; state->whave = 0; next = strm->next_in; have = next != 0 ? strm->avail_in : 0; hold = 0; bits = 0; put = state->window; left = state->wsize; for (;;) switch (state->mode) { case TYPE: if (state->last) { do { hold >>= bits & 7; bits -= bits & 7; } while (0); state->mode = DONE; break; } do { while (bits < (unsigned)(3)) do { do { if (have == 0) { have = in(in_desc, &next); if (have == 0) { next = 0; ret = (-5); goto inf_leave; } } } while (0); have--; hold += (unsigned long)(*next++) << bits; bits += 8; } while (0); } while (0); state->last = ((unsigned)hold & ((1U << (1)) - 1)); do { hold >>= (1); bits -= (unsigned)(1); } while (0); switch (((unsigned)hold & ((1U << (2)) - 1))) { case 0: ; state->mode = STORED; break; case 1: fixedtables(state); ; state->mode = LEN; break; case 2: ; state->mode = TABLE; break; case 3: strm->msg = (char *)"invalid block type"; state->mode = BAD; } do { hold >>= (2); bits -= (unsigned)(2); } while (0); break; case STORED: do { hold >>= bits & 7; bits -= bits & 7; } while (0); do { while (bits < (unsigned)(32)) do { do { if (have == 0) { have = in(in_desc, &next); if (have == 0) { next = 0; ret = (-5); goto inf_leave; } } } while (0); have--; hold += (unsigned long)(*next++) << bits; bits += 8; } while (0); } while (0); if ((hold & 0xffff) != ((hold >> 16) ^ 0xffff)) { strm->msg = (char *)"invalid stored block lengths"; state->mode = BAD; break; } state->length = (unsigned)hold & 0xffff; ; do { hold = 0; bits = 0; } while (0); while (state->length != 0) { copy = state->length; do { if (have == 0) { have = in(in_desc, &next); if (have == 0) { next = 0; ret = (-5); goto inf_leave; } } } while (0); do { if (left == 0) { put = state->window; left = state->wsize; state->whave = left; if (out(out_desc, put, left)) { ret = (-5); goto inf_leave; } } } while (0); if (copy > have) copy = have; if (copy > left) copy = left; memcpy(put, next, copy); have -= copy; next += copy; left -= copy; put += copy; state->length -= copy; }; state->mode = TYPE; break; case TABLE: do { while (bits < (unsigned)(14)) do { do { if (have == 0) { have = in(in_desc, &next); if (have == 0) { next = 0; ret = (-5); goto inf_leave; } } } while (0); have--; hold += (unsigned long)(*next++) << bits; bits += 8; } while (0); } while (0); state->nlen = ((unsigned)hold & ((1U << (5)) - 1)) + 257; do { hold >>= (5); bits -= (unsigned)(5); } while (0); state->ndist = ((unsigned)hold & ((1U << (5)) - 1)) + 1; do { hold >>= (5); bits -= (unsigned)(5); } while (0); state->ncode = ((unsigned)hold & ((1U << (4)) - 1)) + 4; do { hold >>= (4); bits -= (unsigned)(4); } while (0); if (state->nlen > 286 || state->ndist > 30) { strm->msg = (char *)"too many length or distance symbols"; state->mode = BAD; break; } ; state->have = 0; while (state->have < state->ncode) { do { while (bits < (unsigned)(3)) do { do { if (have == 0) { have = in(in_desc, &next); if (have == 0) { next = 0; ret = (-5); goto inf_leave; } } } while (0); have--; hold += (unsigned long)(*next++) << bits; bits += 8; } while (0); } while (0); state->lens[order[state->have++]] = (unsigned short)((unsigned)hold & ((1U << (3)) - 1)); do { hold >>= (3); bits -= (unsigned)(3); } while (0); } while (state->have < 19) state->lens[order[state->have++]] = 0; state->next = state->codes; state->lencode = (code const *)(state->next); state->lenbits = 7; ret = inflate_table(CODES, state->lens, 19, &(state->next), &(state->lenbits), state->work); if (ret) { strm->msg = (char *)"invalid code lengths set"; state->mode = BAD; break; }; state->have = 0; while (state->have < state->nlen + state->ndist) { for (;;) { here = state->lencode[((unsigned)hold & ((1U << (state->lenbits)) - 1))]; if ((unsigned)(here.bits) <= bits) break; do { do { if (have == 0) { have = in(in_desc, &next); if (have == 0) { next = 0; ret = (-5); goto inf_leave; } } } while (0); have--; hold += (unsigned long)(*next++) << bits; bits += 8; } while (0); } if (here.val < 16) { do { hold >>= (here.bits); bits -= (unsigned)(here.bits); } while (0); state->lens[state->have++] = here.val; } else { if (here.val == 16) { do { while (bits < (unsigned)(here.bits + 2)) do { do { if (have == 0) { have = in(in_desc, &next); if (have == 0) { next = 0; ret = (-5); goto inf_leave; } } } while (0); have--; hold += (unsigned long)(*next++) << bits; bits += 8; } while (0); } while (0); do { hold >>= (here.bits); bits -= (unsigned)(here.bits); } while (0); if (state->have == 0) { strm->msg = (char *)"invalid bit length repeat"; state->mode = BAD; break; } len = (unsigned)(state->lens[state->have - 1]); copy = 3 + ((unsigned)hold & ((1U << (2)) - 1)); do { hold >>= (2); bits -= (unsigned)(2); } while (0); } else if (here.val == 17) { do { while (bits < (unsigned)(here.bits + 3)) do { do { if (have == 0) { have = in(in_desc, &next); if (have == 0) { next = 0; ret = (-5); goto inf_leave; } } } while (0); have--; hold += (unsigned long)(*next++) << bits; bits += 8; } while (0); } while (0); do { hold >>= (here.bits); bits -= (unsigned)(here.bits); } while (0); len = 0; copy = 3 + ((unsigned)hold & ((1U << (3)) - 1)); do { hold >>= (3); bits -= (unsigned)(3); } while (0); } else { do { while (bits < (unsigned)(here.bits + 7)) do { do { if (have == 0) { have = in(in_desc, &next); if (have == 0) { next = 0; ret = (-5); goto inf_leave; } } } while (0); have--; hold += (unsigned long)(*next++) << bits; bits += 8; } while (0); } while (0); do { hold >>= (here.bits); bits -= (unsigned)(here.bits); } while (0); len = 0; copy = 11 + ((unsigned)hold & ((1U << (7)) - 1)); do { hold >>= (7); bits -= (unsigned)(7); } while (0); } if (state->have + copy > state->nlen + state->ndist) { strm->msg = (char *)"invalid bit length repeat"; state->mode = BAD; break; } while (copy--) state->lens[state->have++] = (unsigned short)len; } } if (state->mode == BAD) break; if (state->lens[256] == 0) { strm->msg = (char *)"invalid code -- missing end-of-block"; state->mode = BAD; break; } state->next = state->codes; state->lencode = (code const *)(state->next); state->lenbits = 9; ret = inflate_table(LENS, state->lens, state->nlen, &(state->next), &(state->lenbits), state->work); if (ret) { strm->msg = (char *)"invalid literal/lengths set"; state->mode = BAD; break; } state->distcode = (code const *)(state->next); state->distbits = 6; ret = inflate_table(DISTS, state->lens + state->nlen, state->ndist, &(state->next), &(state->distbits), state->work); if (ret) { strm->msg = (char *)"invalid distances set"; state->mode = BAD; break; }; state->mode = LEN; case LEN: if (have >= 6 && left >= 258) { do { strm->next_out = put; strm->avail_out = left; strm->next_in = next; strm->avail_in = have; state->hold = hold; state->bits = bits; } while (0); if (state->whave < state->wsize) state->whave = state->wsize - left; inflate_fast(strm, state->wsize); do { put = strm->next_out; left = strm->avail_out; next = strm->next_in; have = strm->avail_in; hold = state->hold; bits = state->bits; } while (0); break; } for (;;) { here = state->lencode[((unsigned)hold & ((1U << (state->lenbits)) - 1))]; if ((unsigned)(here.bits) <= bits) break; do { do { if (have == 0) { have = in(in_desc, &next); if (have == 0) { next = 0; ret = (-5); goto inf_leave; } } } while (0); have--; hold += (unsigned long)(*next++) << bits; bits += 8; } while (0); } if (here.op && (here.op & 0xf0) == 0) { last = here; for (;;) { here = state ->lencode[last.val + (((unsigned)hold & ((1U << (last.bits + last.op)) - 1)) >> last.bits)]; if ((unsigned)(last.bits + here.bits) <= bits) break; do { do { if (have == 0) { have = in(in_desc, &next); if (have == 0) { next = 0; ret = (-5); goto inf_leave; } } } while (0); have--; hold += (unsigned long)(*next++) << bits; bits += 8; } while (0); } do { hold >>= (last.bits); bits -= (unsigned)(last.bits); } while (0); } do { hold >>= (here.bits); bits -= (unsigned)(here.bits); } while (0); state->length = (unsigned)here.val; if (here.op == 0) { ; do { if (left == 0) { put = state->window; left = state->wsize; state->whave = left; if (out(out_desc, put, left)) { ret = (-5); goto inf_leave; } } } while (0); *put++ = (unsigned char)(state->length); left--; state->mode = LEN; break; } if (here.op & 32) { ; state->mode = TYPE; break; } if (here.op & 64) { strm->msg = (char *)"invalid literal/length code"; state->mode = BAD; break; } state->extra = (unsigned)(here.op) & 15; if (state->extra != 0) { do { while (bits < (unsigned)(state->extra)) do { do { if (have == 0) { have = in(in_desc, &next); if (have == 0) { next = 0; ret = (-5); goto inf_leave; } } } while (0); have--; hold += (unsigned long)(*next++) << bits; bits += 8; } while (0); } while (0); state->length += ((unsigned)hold & ((1U << (state->extra)) - 1)); do { hold >>= (state->extra); bits -= (unsigned)(state->extra); } while (0); }; for (;;) { here = state->distcode[((unsigned)hold & ((1U << (state->distbits)) - 1))]; if ((unsigned)(here.bits) <= bits) break; do { do { if (have == 0) { have = in(in_desc, &next); if (have == 0) { next = 0; ret = (-5); goto inf_leave; } } } while (0); have--; hold += (unsigned long)(*next++) << bits; bits += 8; } while (0); } if ((here.op & 0xf0) == 0) { last = here; for (;;) { here = state->distcode[last.val + (((unsigned)hold & ((1U << (last.bits + last.op)) - 1)) >> last.bits)]; if ((unsigned)(last.bits + here.bits) <= bits) break; do { do { if (have == 0) { have = in(in_desc, &next); if (have == 0) { next = 0; ret = (-5); goto inf_leave; } } } while (0); have--; hold += (unsigned long)(*next++) << bits; bits += 8; } while (0); } do { hold >>= (last.bits); bits -= (unsigned)(last.bits); } while (0); } do { hold >>= (here.bits); bits -= (unsigned)(here.bits); } while (0); if (here.op & 64) { strm->msg = (char *)"invalid distance code"; state->mode = BAD; break; } state->offset = (unsigned)here.val; state->extra = (unsigned)(here.op) & 15; if (state->extra != 0) { do { while (bits < (unsigned)(state->extra)) do { do { if (have == 0) { have = in(in_desc, &next); if (have == 0) { next = 0; ret = (-5); goto inf_leave; } } } while (0); have--; hold += (unsigned long)(*next++) << bits; bits += 8; } while (0); } while (0); state->offset += ((unsigned)hold & ((1U << (state->extra)) - 1)); do { hold >>= (state->extra); bits -= (unsigned)(state->extra); } while (0); } if (state->offset > state->wsize - (state->whave < state->wsize ? left : 0)) { strm->msg = (char *)"invalid distance too far back"; state->mode = BAD; break; }; do { do { if (left == 0) { put = state->window; left = state->wsize; state->whave = left; if (out(out_desc, put, left)) { ret = (-5); goto inf_leave; } } } while (0); copy = state->wsize - state->offset; if (copy < left) { from = put + copy; copy = left - copy; } else { from = put - state->offset; copy = left; } if (copy > state->length) copy = state->length; state->length -= copy; left -= copy; do { *put++ = *from++; } while (--copy); } while (state->length != 0); break; case DONE: ret = 1; goto inf_leave; case BAD: ret = (-3); goto inf_leave; default: ret = (-2); goto inf_leave; } inf_leave: if (left < state->wsize) { if (out(out_desc, state->window, state->wsize - left) && ret == 1) ret = (-5); } strm->next_in = next; strm->avail_in = have; return ret; }
int inflateBack(byte **param_1, code *param_2, undefined8 param_3, code *param_4, undefined8 param_5) { byte *pbVar1; byte *pbVar2; undefined2 uVar3; undefined4 uVar4; uint uVar5; int iVar6; ulong uVar7; long in_FS_OFFSET; uint local_58; uint local_54; uint local_50; uint local_4c; int local_44; undefined4 local_40; byte bStack59; byte *local_38; byte *local_30; ulong local_28; byte *local_20; byte *local_18; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); if ((param_1 == (byte **)0x0) || (param_1[7] == (byte *)0x0)) { local_44 = -2; } else { local_18 = param_1[7]; param_1[6] = (byte *)0x0; *(undefined4 *)(local_18 + 8) = 0x3f3f; *(undefined4 *)(local_18 + 0xc) = 0; *(undefined4 *)(local_18 + 0x40) = 0; local_38 = *param_1; if (local_38 == (byte *)0x0) { local_58 = 0; } else { local_58 = *(uint *)(param_1 + 1); } local_28 = 0; local_50 = 0; local_54 = *(uint *)(local_18 + 0x3c); local_30 = *(byte **)(local_18 + 0x48); LAB_00100269: switch (*(undefined4 *)(local_18 + 8)) { case 0x3f3f: if (*(int *)(local_18 + 0xc) == 0) { for (; local_50 < 3; local_50 = local_50 + 8) { if ((local_58 == 0) && (local_58 = (*param_2)(param_3), local_58 == 0)) { local_38 = (byte *)0x0; local_44 = -5; goto LAB_001016ad; } local_58 = local_58 - 1; local_28 = local_28 + ((ulong)*local_38 << ((byte)local_50 & 0x3f)); local_38 = local_38 + 1; } *(uint *)(local_18 + 0xc) = (uint)local_28 & 1; local_28 = local_28 >> 1; uVar5 = (uint)local_28 & 3; if (uVar5 == 3) { param_1[6] = (byte *)"invalid block type"; *(undefined4 *)(local_18 + 8) = 0x3f51; } else if (uVar5 < 4) { if (uVar5 == 2) { *(undefined4 *)(local_18 + 8) = 0x3f44; } else if (uVar5 < 3) { if ((local_28 & 3) == 0) { *(undefined4 *)(local_18 + 8) = 0x3f41; } else if (uVar5 == 1) { fixedtables(local_18); *(undefined4 *)(local_18 + 8) = 0x3f48; } } } local_28 = local_28 >> 2; local_50 = local_50 - 3; } else { local_28 = local_28 >> ((byte)local_50 & 7); local_50 = local_50 & 0xfffffff8; *(undefined4 *)(local_18 + 8) = 0x3f50; } goto LAB_00100269; default: local_44 = -2; LAB_001016ad: if (((local_54 < *(uint *)(local_18 + 0x3c)) && (iVar6 = (*param_4)(param_5, *(undefined8 *)(local_18 + 0x48), *(int *)(local_18 + 0x3c) - local_54), iVar6 != 0)) && (local_44 == 1)) { local_44 = -5; } *param_1 = local_38; *(uint *)(param_1 + 1) = local_58; break; case 0x3f41: local_28 = local_28 >> ((byte)local_50 & 7); for (local_50 = local_50 & 0xfffffff8; local_50 < 0x20; local_50 = local_50 + 8) { if ((local_58 == 0) && (local_58 = (*param_2)(param_3), local_58 == 0)) { local_38 = (byte *)0x0; local_44 = -5; goto LAB_001016ad; } local_58 = local_58 - 1; local_28 = local_28 + ((ulong)*local_38 << ((byte)local_50 & 0x3f)); local_38 = local_38 + 1; } if ((local_28 & 0xffff) == (local_28 >> 0x10 ^ 0xffff)) { *(uint *)(local_18 + 0x5c) = (uint)local_28 & 0xffff; local_28 = 0; local_50 = 0; while (*(int *)(local_18 + 0x5c) != 0) { local_4c = *(uint *)(local_18 + 0x5c); if ((local_58 == 0) && (local_58 = (*param_2)(param_3, &local_38), local_58 == 0)) { local_38 = (byte *)0x0; local_44 = -5; goto LAB_001016ad; } if (local_54 == 0) { local_30 = *(byte **)(local_18 + 0x48); local_54 = *(uint *)(local_18 + 0x3c); *(uint *)(local_18 + 0x40) = local_54; iVar6 = (*param_4)(param_5, local_30, local_54); if (iVar6 != 0) { local_44 = -5; goto LAB_001016ad; } } if (local_58 < local_4c) { local_4c = local_58; } if (local_54 < local_4c) { local_4c = local_54; } memcpy(local_30, local_38, (ulong)local_4c); local_58 = local_58 - local_4c; local_38 = local_38 + local_4c; local_54 = local_54 - local_4c; local_30 = local_30 + local_4c; *(uint *)(local_18 + 0x5c) = *(int *)(local_18 + 0x5c) - local_4c; } *(undefined4 *)(local_18 + 8) = 0x3f3f; } else { param_1[6] = (byte *)"invalid stored block lengths"; *(undefined4 *)(local_18 + 8) = 0x3f51; } goto LAB_00100269; case 0x3f44: for (; local_50 < 0xe; local_50 = local_50 + 8) { if ((local_58 == 0) && (local_58 = (*param_2)(param_3), local_58 == 0)) { local_38 = (byte *)0x0; local_44 = -5; goto LAB_001016ad; } local_58 = local_58 - 1; local_28 = local_28 + ((ulong)*local_38 << ((byte)local_50 & 0x3f)); local_38 = local_38 + 1; } *(uint *)(local_18 + 0x84) = ((uint)local_28 & 0x1f) + 0x101; *(uint *)(local_18 + 0x88) = ((uint)(local_28 >> 5) & 0x1f) + 1; *(uint *)(local_18 + 0x80) = ((uint)(local_28 >> 10) & 0xf) + 4; local_28 = local_28 >> 0xe; local_50 = local_50 - 0xe; if ((*(uint *)(local_18 + 0x84) < 0x11f) && (*(uint *)(local_18 + 0x88) < 0x1f)) { *(undefined4 *)(local_18 + 0x8c) = 0; while (*(uint *)(local_18 + 0x8c) < *(uint *)(local_18 + 0x80)) { for (; local_50 < 3; local_50 = local_50 + 8) { if ((local_58 == 0) && (local_58 = (*param_2)(param_3), local_58 == 0)) { local_38 = (byte *)0x0; local_44 = -5; goto LAB_001016ad; } local_58 = local_58 - 1; local_28 = local_28 + ((ulong)*local_38 << ((byte)local_50 & 0x3f)); local_38 = local_38 + 1; } uVar5 = *(uint *)(local_18 + 0x8c); *(uint *)(local_18 + 0x8c) = uVar5 + 1; *(ushort *)(local_18 + ((long)(int)(uint) * (ushort *)(order_3299 + (ulong)uVar5 * 2) + 0x48) * 2 + 8) = (ushort)local_28 & 7; local_28 = local_28 >> 3; local_50 = local_50 - 3; } while (*(uint *)(local_18 + 0x8c) < 0x13) { uVar5 = *(uint *)(local_18 + 0x8c); *(uint *)(local_18 + 0x8c) = uVar5 + 1; *(undefined2 *)(local_18 + ((long)(int)(uint) * (ushort *)(order_3299 + (ulong)uVar5 * 2) + 0x48) * 2 + 8) = 0; } *(byte **)(local_18 + 0x90) = local_18 + 0x558; *(undefined8 *)(local_18 + 0x68) = *(undefined8 *)(local_18 + 0x90); *(undefined4 *)(local_18 + 0x78) = 7; iVar6 = inflate_table(0, local_18 + 0x98, 0x13, local_18 + 0x90, local_18 + 0x78, local_18 + 0x318); if (iVar6 == 0) { *(undefined4 *)(local_18 + 0x8c) = 0; while ( *(uint *)(local_18 + 0x8c) < (uint)(*(int *)(local_18 + 0x88) + *(int *)(local_18 + 0x84))) { while (true) { uVar4 = *(undefined4 *)((ulong)(~(-1 << ((byte) * (undefined4 *)(local_18 + 0x78) & 0x1f)) & (uint)local_28) * 4 + *(long *)(local_18 + 0x68)); local_40._1_1_ = (byte)((uint)uVar4 >> 8); if (local_40._1_1_ <= local_50) break; if ((local_58 == 0) && (local_58 = (*param_2)(param_3), local_58 == 0)) { local_38 = (byte *)0x0; local_44 = -5; goto LAB_001016ad; } local_58 = local_58 - 1; local_28 = local_28 + ((ulong)*local_38 << ((byte)local_50 & 0x3f)); local_50 = local_50 + 8; local_38 = local_38 + 1; } local_40._2_2_ = (ushort)((uint)uVar4 >> 0x10); if (local_40._2_2_ < 0x10) { local_28 = local_28 >> (local_40._1_1_ & 0x3f); local_50 = local_50 - local_40._1_1_; uVar5 = *(uint *)(local_18 + 0x8c); *(uint *)(local_18 + 0x8c) = uVar5 + 1; *(ushort *)(local_18 + ((ulong)uVar5 + 0x48) * 2 + 8) = local_40._2_2_; } else { if (local_40._2_2_ == 0x10) { for (; local_50 < local_40._1_1_ + 2; local_50 = local_50 + 8) { if ((local_58 == 0) && (local_58 = (*param_2)(param_3), local_58 == 0)) { local_38 = (byte *)0x0; local_44 = -5; goto LAB_001016ad; } local_58 = local_58 - 1; local_28 = local_28 + ((ulong)*local_38 << ((byte)local_50 & 0x3f)); local_38 = local_38 + 1; } local_28 = local_28 >> (local_40._1_1_ & 0x3f); local_50 = local_50 - local_40._1_1_; if (*(int *)(local_18 + 0x8c) == 0) { param_1[6] = (byte *)"invalid bit length repeat"; *(undefined4 *)(local_18 + 8) = 0x3f51; break; } uVar3 = *(undefined2 *)(local_18 + ((ulong)(*(int *)(local_18 + 0x8c) - 1) + 0x48) * 2 + 8); local_4c = ((uint)local_28 & 3) + 3; local_28 = local_28 >> 2; local_50 = local_50 - 2; } else if (local_40._2_2_ == 0x11) { for (; local_50 < local_40._1_1_ + 3; local_50 = local_50 + 8) { if ((local_58 == 0) && (local_58 = (*param_2)(param_3), local_58 == 0)) { local_38 = (byte *)0x0; local_44 = -5; goto LAB_001016ad; } local_58 = local_58 - 1; local_28 = local_28 + ((ulong)*local_38 << ((byte)local_50 & 0x3f)); local_38 = local_38 + 1; } local_28 = local_28 >> (local_40._1_1_ & 0x3f); uVar3 = 0; local_4c = ((uint)local_28 & 7) + 3; local_28 = local_28 >> 3; local_50 = (local_50 - local_40._1_1_) - 3; } else { for (; local_50 < local_40._1_1_ + 7; local_50 = local_50 + 8) { if ((local_58 == 0) && (local_58 = (*param_2)(param_3), local_58 == 0)) { local_38 = (byte *)0x0; local_44 = -5; goto LAB_001016ad; } local_58 = local_58 - 1; local_28 = local_28 + ((ulong)*local_38 << ((byte)local_50 & 0x3f)); local_38 = local_38 + 1; } local_28 = local_28 >> (local_40._1_1_ & 0x3f); uVar3 = 0; local_4c = ((uint)local_28 & 0x7f) + 0xb; local_28 = local_28 >> 7; local_50 = (local_50 - local_40._1_1_) - 7; } if ((uint)(*(int *)(local_18 + 0x88) + *(int *)(local_18 + 0x84)) < *(int *)(local_18 + 0x8c) + local_4c) { param_1[6] = (byte *)"invalid bit length repeat"; *(undefined4 *)(local_18 + 8) = 0x3f51; break; } while (local_4c != 0) { uVar5 = *(uint *)(local_18 + 0x8c); *(uint *)(local_18 + 0x8c) = uVar5 + 1; *(undefined2 *)(local_18 + ((ulong)uVar5 + 0x48) * 2 + 8) = uVar3; local_4c = local_4c + -1; } } } if (*(int *)(local_18 + 8) != 0x3f51) { if (*(short *)(local_18 + 0x298) == 0) { param_1[6] = (byte *)"invalid code -- missing end-of-block"; *(undefined4 *)(local_18 + 8) = 0x3f51; } else { *(byte **)(local_18 + 0x90) = local_18 + 0x558; *(undefined8 *)(local_18 + 0x68) = *(undefined8 *)(local_18 + 0x90); *(undefined4 *)(local_18 + 0x78) = 9; iVar6 = inflate_table( 1, local_18 + 0x98, *(undefined4 *)(local_18 + 0x84), local_18 + 0x90, local_18 + 0x78, local_18 + 0x318); if (iVar6 == 0) { *(undefined8 *)(local_18 + 0x70) = *(undefined8 *)(local_18 + 0x90); *(undefined4 *)(local_18 + 0x7c) = 6; iVar6 = inflate_table( 2, local_18 + (ulong) * (uint *)(local_18 + 0x84) * 2 + 0x98, *(undefined4 *)(local_18 + 0x88), local_18 + 0x90, local_18 + 0x7c, local_18 + 0x318); if (iVar6 == 0) { *(undefined4 *)(local_18 + 8) = 0x3f48; goto switchD_0010029e_caseD_3f48; } param_1[6] = (byte *)"invalid distances set"; *(undefined4 *)(local_18 + 8) = 0x3f51; } else { param_1[6] = (byte *)"invalid literal/lengths set"; *(undefined4 *)(local_18 + 8) = 0x3f51; } } } } else { param_1[6] = (byte *)"invalid code lengths set"; *(undefined4 *)(local_18 + 8) = 0x3f51; } } else { param_1[6] = (byte *)"too many length or distance symbols"; *(undefined4 *)(local_18 + 8) = 0x3f51; } goto LAB_00100269; case 0x3f48: switchD_0010029e_caseD_3f48: if ((local_58 < 6) || (local_54 < 0x102)) { for (; uVar5 = *(uint *)((ulong)(~(-1 << ((byte) * (undefined4 *)(local_18 + 0x78) & 0x1f)) & (uint)local_28) * 4 + *(long *)(local_18 + 0x68)), local_50 < (uVar5 >> 8 & 0xff); local_50 = local_50 + 8) { if ((local_58 == 0) && (local_58 = (*param_2)(param_3), local_58 == 0)) { local_38 = (byte *)0x0; local_44 = -5; goto LAB_001016ad; } local_58 = local_58 - 1; local_28 = local_28 + ((ulong)*local_38 << ((byte)local_50 & 0x3f)); local_38 = local_38 + 1; } local_40._0_1_ = (char)uVar5; local_40 = uVar5; if (((char)local_40 != '\0') && ((uVar5 & 0xf0) == 0)) { while (true) { bStack59 = (byte)(uVar5 >> 8); local_40 = *(uint *)((ulong)((((uint)local_28 & ~(-1 << ((char)local_40 + bStack59 & 0x1f))) >> (bStack59 & 0x1f)) + (uVar5 >> 0x10)) * 4 + *(long *)(local_18 + 0x68)); if ((local_40 >> 8 & 0xff) + (uint)bStack59 <= local_50) break; if ((local_58 == 0) && (local_58 = (*param_2)(), local_58 == 0)) { local_38 = (byte *)0x0; local_44 = -5; goto LAB_001016ad; } local_58 = local_58 - 1; local_28 = local_28 + ((ulong)*local_38 << ((byte)local_50 & 0x3f)); local_50 = local_50 + 8; local_38 = local_38 + 1; } local_28 = local_28 >> (bStack59 & 0x3f); local_50 = local_50 - bStack59; } local_28 = local_28 >> (local_40._1_1_ & 0x3f); local_50 = local_50 - local_40._1_1_; *(uint *)(local_18 + 0x5c) = local_40 >> 0x10; if ((char)local_40 == '\0') { if (local_54 == 0) { local_30 = *(byte **)(local_18 + 0x48); local_54 = *(uint *)(local_18 + 0x3c); *(uint *)(local_18 + 0x40) = local_54; iVar6 = (*param_4)(param_5, local_30, local_54); if (iVar6 != 0) { local_44 = -5; goto LAB_001016ad; } } *local_30 = (byte) * (undefined4 *)(local_18 + 0x5c); local_54 = local_54 - 1; *(undefined4 *)(local_18 + 8) = 0x3f48; local_30 = local_30 + 1; } else if ((local_40 & 0x20) == 0) { if ((local_40 & 0x40) == 0) { *(uint *)(local_18 + 100) = local_40 & 0xf; if (*(int *)(local_18 + 100) != 0) { for (; local_50 < *(uint *)(local_18 + 100); local_50 = local_50 + 8) { if ((local_58 == 0) && (local_58 = (*param_2)(param_3), local_58 == 0)) { local_38 = (byte *)0x0; local_44 = -5; goto LAB_001016ad; } local_58 = local_58 - 1; local_28 = local_28 + ((ulong)*local_38 << ((byte)local_50 & 0x3f)); local_38 = local_38 + 1; } *(uint *)(local_18 + 0x5c) = *(int *)(local_18 + 0x5c) + (~(-1 << ((byte) * (undefined4 *)(local_18 + 100) & 0x1f)) & (uint)local_28); local_28 = local_28 >> ((byte) * (undefined4 *)(local_18 + 100) & 0x3f); local_50 = local_50 - *(int *)(local_18 + 100); } for (; uVar5 = *( uint *)((ulong)(~(-1 << ((byte) * (undefined4 *)(local_18 + 0x7c) & 0x1f)) & (uint)local_28) * 4 + *(long *)(local_18 + 0x70)), local_50 < (uVar5 >> 8 & 0xff); local_50 = local_50 + 8) { if ((local_58 == 0) && (local_58 = (*param_2)(param_3), local_58 == 0)) { local_38 = (byte *)0x0; local_44 = -5; goto LAB_001016ad; } local_58 = local_58 - 1; local_28 = local_28 + ((ulong)*local_38 << ((byte)local_50 & 0x3f)); local_38 = local_38 + 1; } local_40._0_1_ = (char)uVar5; local_40 = uVar5; if ((uVar5 & 0xf0) == 0) { while (true) { bStack59 = (byte)(uVar5 >> 8); local_40 = *(uint *)((ulong)((((uint)local_28 & ~(-1 << ((char)local_40 + bStack59 & 0x1f))) >> (bStack59 & 0x1f)) + (uVar5 >> 0x10)) * 4 + *(long *)(local_18 + 0x70)); if ((local_40 >> 8 & 0xff) + (uint)bStack59 <= local_50) break; if ((local_58 == 0) && (local_58 = (*param_2)(), local_58 == 0)) { local_38 = (byte *)0x0; local_44 = -5; goto LAB_001016ad; } local_58 = local_58 - 1; local_28 = local_28 + ((ulong)*local_38 << ((byte)local_50 & 0x3f)); local_50 = local_50 + 8; local_38 = local_38 + 1; } local_28 = local_28 >> (bStack59 & 0x3f); local_50 = local_50 - bStack59; } local_28 = local_28 >> (local_40._1_1_ & 0x3f); local_50 = local_50 - local_40._1_1_; if ((local_40 & 0x40) == 0) { *(uint *)(local_18 + 0x60) = local_40 >> 0x10; *(uint *)(local_18 + 100) = local_40 & 0xf; if (*(int *)(local_18 + 100) != 0) { for (; local_50 < *(uint *)(local_18 + 100); local_50 = local_50 + 8) { if ((local_58 == 0) && (local_58 = (*param_2)(param_3), local_58 == 0)) { local_38 = (byte *)0x0; local_44 = -5; goto LAB_001016ad; } local_58 = local_58 - 1; local_28 = local_28 + ((ulong)*local_38 << ((byte)local_50 & 0x3f)); local_38 = local_38 + 1; } *(uint *)(local_18 + 0x60) = *(int *)(local_18 + 0x60) + (~(-1 << ((byte) * (undefined4 *)(local_18 + 100) & 0x1f)) & (uint)local_28); local_28 = local_28 >> ((byte) * (undefined4 *)(local_18 + 100) & 0x3f); local_50 = local_50 - *(int *)(local_18 + 100); } uVar5 = local_54; if (*(uint *)(local_18 + 0x3c) <= *(uint *)(local_18 + 0x40)) { uVar5 = 0; } if (*(int *)(local_18 + 0x3c) - uVar5 < *(uint *)(local_18 + 0x60)) { param_1[6] = (byte *)"invalid distance too far back"; *(undefined4 *)(local_18 + 8) = 0x3f51; } else { do { if (local_54 == 0) { local_30 = *(byte **)(local_18 + 0x48); local_54 = *(uint *)(local_18 + 0x3c); *(uint *)(local_18 + 0x40) = local_54; iVar6 = (*param_4)(param_5, local_30, local_54); if (iVar6 != 0) { local_44 = -5; goto LAB_001016ad; } } local_4c = *(int *)(local_18 + 0x3c) - *(int *)(local_18 + 0x60); if (local_4c < local_54) { uVar7 = (ulong)local_4c; local_4c = local_54 - local_4c; } else { uVar7 = -(ulong) * (uint *)(local_18 + 0x60); local_4c = local_54; } local_20 = local_30 + uVar7; if (*(uint *)(local_18 + 0x5c) < local_4c) { local_4c = *(uint *)(local_18 + 0x5c); } *(uint *)(local_18 + 0x5c) = *(int *)(local_18 + 0x5c) - local_4c; local_54 = local_54 - local_4c; do { pbVar1 = local_20 + 1; pbVar2 = local_30 + 1; *local_30 = *local_20; local_4c = local_4c - 1; local_30 = pbVar2; local_20 = pbVar1; } while (local_4c != 0); } while (*(int *)(local_18 + 0x5c) != 0); } } else { param_1[6] = (byte *)"invalid distance code"; *(undefined4 *)(local_18 + 8) = 0x3f51; } } else { param_1[6] = (byte *)"invalid literal/length code"; *(undefined4 *)(local_18 + 8) = 0x3f51; } } else { *(undefined4 *)(local_18 + 8) = 0x3f3f; } } else { param_1[3] = local_30; *(uint *)(param_1 + 4) = local_54; *param_1 = local_38; *(uint *)(param_1 + 1) = local_58; *(ulong *)(local_18 + 0x50) = local_28; *(uint *)(local_18 + 0x58) = local_50; if (*(uint *)(local_18 + 0x40) < *(uint *)(local_18 + 0x3c)) { *(uint *)(local_18 + 0x40) = *(int *)(local_18 + 0x3c) - local_54; } inflate_fast(param_1); local_54 = *(uint *)(param_1 + 4); local_38 = *param_1; local_58 = *(uint *)(param_1 + 1); local_28 = *(ulong *)(local_18 + 0x50); local_50 = *(uint *)(local_18 + 0x58); local_30 = param_1[3]; } goto LAB_00100269; case 0x3f50: local_44 = 1; goto LAB_001016ad; case 0x3f51: local_44 = -3; goto LAB_001016ad; } } if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) { __stack_chk_fail(); } return local_44; }
zlib
ghidra
static void set_filter(const struct cmdinfo *cip, const char *value) { filter_add(value, cip->arg_int); }
long long set_filter(struct_0 *a0, unsigned long long a1) { return filter_add(a1, a0->field_28, a0->field_28); }
dpkg
angr_phoenix
int main(int argc, char **argv) { Prog = Basename(argv[0]); log_set_progname(Prog); log_set_logfd(stderr); (void)setlocale(6, ""); (void)bindtextdomain("shadow", "/usr/share/locale"); (void)textdomain("shadow"); process_root_flag("-R", argc, argv); prefix = process_prefix_flag("-P", argc, argv); openlog("groupmod", (0x01), (10 << 3)); if (atexit(do_cleanups) != 0) { fprintf(stderr, gettext("%s: Cannot setup cleanup service.\n"), Prog); exit(11); } process_flags(argc, argv); is_shadow_grp = sgr_file_present(); { struct group *grp; grp = prefix_getgrnam(group_name); if (((void *)0) == grp) { fprintf(stderr, gettext("%s: group '%s' does not exist\n"), Prog, group_name); exit(6); } else { group_id = grp->gr_gid; } } if (gflg) { check_new_gid(); } if (nflg) { check_new_name(); } lock_files(); prepare_failure_reports(); open_files(); grp_update(); close_files(); nscd_flush_cache("group"); sssd_flush_cache(0x002); return 0; }
int main(unsigned long a0, unsigned long long *a1, unsigned int a2, unsigned long long a3, unsigned long long a4, unsigned long long a5) { struct_0 *v0; unsigned long long v2; Prog = Basename(*(a1)); log_set_progname(0xdc7d8928ec834853); log_set_logfd(stderr); setlocale(0x6, &g_401b48); bindtextdomain("shadow", "/usr/share/locale"); textdomain("shadow"); process_root_flag("-R", a0, a1); prefix = process_prefix_flag("-P", a0, a1); openlog("groupmod", 0x1, 0x50); if (atexit(got.do_cleanups)) { fprintf(stderr, gettext("%s: Cannot setup cleanup service.\n")); exit(0xb); } process_flags(a0, a1); v2 = sgr_file_present(a0, a0, 0x50, a3, a4, a5); is_shadow_grp = v2; v0 = prefix_getgrnam(group_name); if (!v0) { fprintf(stderr, gettext("%s: group '%s' does not exist\n")); exit(0x6); } group_id = v0->field_10; if (gflg) check_new_gid(); if (nflg) check_new_name(); lock_files(); prepare_failure_reports(); open_files(); grp_update(); close_files(); nscd_flush_cache("group"); sssd_flush_cache(0x2); return 0; }
shadow
angr_sailr
void pkcs12_info(common_info_st *cinfo) { gnutls_pkcs12_t pkcs12; gnutls_pkcs12_bag_t bag; gnutls_mac_algorithm_t mac_algo; char *mac_oid = ((void *)0); char hex[64 + 1]; size_t hex_size = sizeof(hex); char salt[32]; unsigned int salt_size; unsigned int mac_iter; int result; size_t size; gnutls_datum_t data; const char *pass; int indx, fail = 0; result = gnutls_pkcs12_init(&pkcs12); if (result < 0) { fprintf(stderr, "p12_init: %s\n", gnutls_strerror(result)); app_exit(1); } data.data = (void *)_gnutls_fread_file(infile, 0, &size); data.size = size; if (!data.data) { fprintf(stderr, "%s", infile ? "file" : "standard input"); app_exit(1); } result = gnutls_pkcs12_import(pkcs12, &data, incert_format, 0); free(data.data); if (result < 0) { fprintf(stderr, "p12_import: %s\n", gnutls_strerror(result)); app_exit(1); } salt_size = sizeof(salt); result = gnutls_pkcs12_mac_info(pkcs12, &mac_algo, salt, &salt_size, &mac_iter, &mac_oid); if (result == -96 && cinfo->outtext) { fprintf(outfile, "MAC info:\n"); if (mac_oid != ((void *)0)) fprintf(outfile, "\tMAC: unknown (%s)\n", mac_oid); } else if (result >= 0 && cinfo->outtext) { gnutls_datum_t bin; fprintf(outfile, "MAC info:\n"); fprintf(outfile, "\tMAC: %s (%s)\n", gnutls_mac_get_name(mac_algo), mac_oid); bin.data = (void *)salt; bin.size = salt_size; result = gnutls_hex_encode(&bin, hex, &hex_size); if (result < 0) { fprintf(stderr, "hex encode error: %s\n", gnutls_strerror(result)); app_exit(1); } fprintf(outfile, "\tSalt: %s\n", hex); fprintf(outfile, "\tSalt size: %u\n", salt_size); fprintf(outfile, "\tIteration count: %u\n\n", mac_iter); } gnutls_free((void *)(mac_oid)), mac_oid = ((void *)0); pass = get_password(cinfo, ((void *)0), 0); result = gnutls_pkcs12_verify_mac(pkcs12, pass); if (result < 0) { fail = 1; fprintf(stderr, "verify_mac: %s\n", gnutls_strerror(result)); } for (indx = 0;; indx++) { result = gnutls_pkcs12_bag_init(&bag); if (result < 0) { fprintf(stderr, "bag_init: %s\n", gnutls_strerror(result)); app_exit(1); } result = gnutls_pkcs12_get_bag(pkcs12, indx, bag); if (result < 0) { gnutls_pkcs12_bag_deinit(bag); break; } result = gnutls_pkcs12_bag_get_count(bag); if (result < 0) { fprintf(stderr, "bag_count: %s\n", gnutls_strerror(result)); gnutls_pkcs12_bag_deinit(bag); app_exit(1); } if (cinfo->outtext) fprintf(outfile, "%sBAG #%d\n", indx ? "\n" : "", indx); result = gnutls_pkcs12_bag_get_type(bag, 0); if (result < 0) { fprintf(stderr, "bag_init: %s\n", gnutls_strerror(result)); gnutls_pkcs12_bag_deinit(bag); app_exit(1); } if (result == GNUTLS_BAG_ENCRYPTED) { if (cinfo->outtext) { fprintf(outfile, "\tType: %s\n", BAGTYPE(result)); pkcs12_bag_enc_info(bag, outfile); fprintf(outfile, "\n\tDecrypting...\n"); } result = gnutls_pkcs12_bag_decrypt(bag, pass); if (result < 0) { fail = 1; fprintf(stderr, "bag_decrypt: %s\n", gnutls_strerror(result)); gnutls_pkcs12_bag_deinit(bag); continue; } result = gnutls_pkcs12_bag_get_count(bag); if (result < 0) { fprintf(stderr, "encrypted bag_count: %s\n", gnutls_strerror(result)); gnutls_pkcs12_bag_deinit(bag); app_exit(1); } } print_bag_data(bag, cinfo->outtext); gnutls_pkcs12_bag_deinit(bag); } gnutls_pkcs12_deinit(pkcs12); if (fail) { fprintf(stderr, "There were errors parsing the structure\n"); app_exit(1); } }
void pkcs12_info(struct_0 *a0) { char v0; unsigned int v1; char v2; unsigned int v3; unsigned int v4; unsigned int v5; char v6; void *v7; unsigned long long v8; char v9; unsigned long long v10; void *v11; unsigned int v12; unsigned long long v13; unsigned int v14; char v15; char v16; char v17; unsigned int v19; unsigned long long v20; unsigned int v21; unsigned int v23; unsigned long long *v24; unsigned long long v25; v7 = 0; v8 = 65; v4 = 0; v5 = gnutls_pkcs12_init(&v6); if (v5 < 0) { fprintf(*(&stderr), "p12_init: %s\n", gnutls_strerror(v5)); app_exit(0x1); } v11 = _gnutls_fread_file(infile, 0x0, &v9); v12 = *(&v9); if (!v11) { if (!infile) v19 = &g_40b4c4; else v19 = "file"; fprintf(*(&stderr), "%s", v19); app_exit(0x1); } else { v5 = gnutls_pkcs12_import(*(&v6), &v11, incert_format, 0x0); free(v11); if (v5 < 0) { fprintf(*(&stderr), "p12_import: %s\n", gnutls_strerror(v5)); app_exit(0x1); } v1 = 32; v5 = gnutls_pkcs12_mac_info(*(&v6), &v0, &v15, &v1, &v2, &v7); if (!(v5 != -96 || !a0->field_24)) { fprintf(*(&outfile), "MAC info:\n"); if (v7) fprintf(*(&outfile), "\tMAC: unknown (%s)\n", v7); } else if (v5 >= 0 && a0->field_24) { fprintf(*(&outfile), "MAC info:\n"); fprintf(*(&outfile), "\tMAC: %s (%s)\n", gnutls_mac_get_name(*(&v0)), v7); v13 = &v15; v14 = v1; v5 = gnutls_hex_encode(&v13, &v16, &v8, &v16); if (v5 < 0) { fprintf(*(&stderr), "hex encode error: %s\n", gnutls_strerror(v5)); app_exit(0x1); } fprintf(*(&outfile), "\tSalt: %s\n", &v16); fprintf(*(&outfile), "\tSalt size: %u\n", v1); fprintf(*(&outfile), "\tIteration count: %u\n\n", *(&v2)); } *(5243720)(v7); v7 = 0; v10 = get_password(a0, 0x0, 0x0, v20); v5 = gnutls_pkcs12_verify_mac(*(&v6), v10, v10); if (v5 < 0) { v4 = 1; fprintf(*(&stderr), "verify_mac: %s\n", gnutls_strerror(v5)); } for (v3 = 0; true; v3 += 1) { v5 = gnutls_pkcs12_bag_init(&v13); if (v5 < 0) { fprintf(*(&stderr), "bag_init: %s\n", gnutls_strerror(v5)); app_exit(0x1); } v5 = gnutls_pkcs12_get_bag(*(&v6), v3, v13, v3); if (v5 < 0) break; v5 = gnutls_pkcs12_bag_get_count(v13); if (v5 < 0) { fprintf(*(&stderr), "bag_count: %s\n", gnutls_strerror(v5)); gnutls_pkcs12_bag_deinit(v13); app_exit(0x1); } if (a0->field_24) { if (!v3) v21 = &g_40a932; else v21 = "\n"; v23 = v21; fprintf(*(&outfile), "%sBAG #%d\n", v21, v3); } v5 = gnutls_pkcs12_bag_get_type(v13, 0x0, v23); if (v5 < 0) { fprintf(*(&stderr), "bag_init: %s\n", gnutls_strerror(v5)); gnutls_pkcs12_bag_deinit(v13); app_exit(0x1); } if (v5 != 10) { print_bag_data(v13, a0->field_24); gnutls_pkcs12_bag_deinit(v13); } else { if (a0->field_24) { fprintf(*(&outfile), "\tType: %s\n", BAGTYPE(v5)); pkcs12_bag_enc_info(v13, *(&outfile)); fprintf(*(&outfile), "\n\tDecrypting...\n"); } v5 = gnutls_pkcs12_bag_decrypt(v13, v10, v10); if (v5 >= 0) { v5 = gnutls_pkcs12_bag_get_count(v13); if (v5 < 0) { fprintf(*(&stderr), "encrypted bag_count: %s\n", gnutls_strerror(v5)); gnutls_pkcs12_bag_deinit(v13); app_exit(0x1); } print_bag_data(v13, a0->field_24); gnutls_pkcs12_bag_deinit(v13); } else { v4 = 1; fprintf(*(&stderr), "bag_decrypt: %s\n", gnutls_strerror(v5)); gnutls_pkcs12_bag_deinit(v13); continue; } } } gnutls_pkcs12_bag_deinit(v13); gnutls_pkcs12_deinit(*(&v6)); if (!v4) { v25 = *(&v17) ^ v24[5]; return; } fprintf(*(&stderr), "There were errors parsing the structure\n"); app_exit(0x1); } }
gnutls
angr_sailr
int reportbroken_retexitstatus(int ret) { if (reports) { fputs(gettext("Errors were encountered while processing:\n"), stderr); while (reports) { fprintf(stderr, " %s\n", reports->what); free(reports->what); reports = reports->next; } } if (abort_processing) { fputs( gettext("Processing was halted because there were too many errors.\n"), stderr); } return nerrs ? 1 : ret; }
long long reportbroken_retexitstatus(unsigned long a0) { if (reports) { fputs(gettext("Errors were encountered while processing:\n"), stderr); for (; reports; reports = *(reports)) { fprintf(stderr, " %s\n", *((reports + 8))); free(*((reports + 8))); } } if (abort_processing) fputs( gettext("Processing was halted because there were too many errors.\n"), stderr); return (!nerrs ? 1 : a0); }
dpkg
angr_sailr
static void print_function_def(func) FUNCTION_DEF *func; { COMMAND *cmdcopy; REDIRECT *func_redirects; func_redirects = ((void *)0); if (posixly_correct == 0) cprintf("function %s () \n", func->name->word); else cprintf("%s () \n", func->name->word); add_unwind_protect(reset_locals, 0); indent(indentation); cprintf("{ \n"); inside_function_def++; indentation += indentation_amount; cmdcopy = copy_command(func->command); if (cmdcopy->type == cm_group) { func_redirects = cmdcopy->redirects; cmdcopy->redirects = (REDIRECT *)((void *)0); } make_command_string_internal( cmdcopy->type == cm_group ? cmdcopy->value.Group->command : cmdcopy); do { if (deferred_heredocs) print_deferred_heredocs(""); } while (0); remove_unwind_protect(); indentation -= indentation_amount; inside_function_def--; if (func_redirects) { newline("} "); print_redirection_list(func_redirects); cmdcopy->redirects = func_redirects; } else newline("}");
void print_function_def(struct_0 *a0) { void *v0; struct_1 *v1; unsigned long long v4; v0 = 0; if (posixly_correct) cprintf("%s () \n"); else cprintf("function %s () \n"); add_unwind_protect(reset_locals, 0x0); indent(indentation); cprintf("{ \n"); inside_function_def = inside_function_def + 1; indentation = indentation_amount + indentation; v1 = copy_command(a0->field_10); if (v1->field_0 == 9) { v0 = v1->field_10; v1->field_10 = 0; } make_command_string_internal((v1->field_0 == 9 ? v1 : v1->field_18->field_8)); if (deferred_heredocs) print_deferred_heredocs(&g_403583); remove_unwind_protect(); indentation = indentation - indentation_amount; inside_function_def = inside_function_def - 1; if (!v0) { newline("}"); } else { newline("} "); print_redirection_list(v0); v1->field_10 = v0; }
bash
angr_sailr
(*__errno_location()) = oerrno; return -24; } else if (rr == 0) {
int *__errno_location(void) { halt_baddata(); }
openssh-portable
ghidra
void *sh_calloc(n, s, file, line) size_t n, s; const char *file; int line; { return internal_calloc(n, s, file, line, 0x01); }
void *sh_calloc(long a1, long a2, char *a3, unsigned int a4) { return internal_calloc(a1, a2, a3, a4); }
bash
ida
void ssh_kex2(struct ssh *ssh, char *host, struct sockaddr *hostaddr, u_short port, const struct ssh_conn_info *cinfo) { char *myproposal[PROPOSAL_MAX] = { "sntrup761x25519-sha512@openssh.com," "curve25519-sha256," "curve25519-sha256@libssh.org," "ecdh-sha2-nistp256," "ecdh-sha2-nistp384," "ecdh-sha2-nistp521," "diffie-hellman-group-exchange-sha256," "diffie-hellman-group16-sha512," "diffie-hellman-group18-sha512," "diffie-hellman-group14-sha256", "ssh-ed25519-cert-v01@openssh.com," "ecdsa-sha2-nistp256-cert-v01@openssh.com," "ecdsa-sha2-nistp384-cert-v01@openssh.com," "ecdsa-sha2-nistp521-cert-v01@openssh.com," "sk-ssh-ed25519-cert-v01@openssh.com," "sk-ecdsa-sha2-nistp256-cert-v01@openssh.com," "rsa-sha2-512-cert-v01@openssh.com," "rsa-sha2-256-cert-v01@openssh.com," "ssh-ed25519," "ecdsa-sha2-nistp256," "ecdsa-sha2-nistp384," "ecdsa-sha2-nistp521," "sk-ssh-ed25519@openssh.com," "sk-ecdsa-sha2-nistp256@openssh.com," "rsa-sha2-512," "rsa-sha2-256", "chacha20-poly1305@openssh.com," "aes128-ctr,aes192-ctr,aes256-ctr," "aes128-gcm@openssh.com,aes256-gcm@openssh.com", "chacha20-poly1305@openssh.com," "aes128-ctr,aes192-ctr,aes256-ctr," "aes128-gcm@openssh.com,aes256-gcm@openssh.com", "umac-64-etm@openssh.com," "umac-128-etm@openssh.com," "hmac-sha2-256-etm@openssh.com," "hmac-sha2-512-etm@openssh.com," "hmac-sha1-etm@openssh.com," "umac-64@openssh.com," "umac-128@openssh.com," "hmac-sha2-256," "hmac-sha2-512," "hmac-sha1", "umac-64-etm@openssh.com," "umac-128-etm@openssh.com," "hmac-sha2-256-etm@openssh.com," "hmac-sha2-512-etm@openssh.com," "hmac-sha1-etm@openssh.com," "umac-64@openssh.com," "umac-128@openssh.com," "hmac-sha2-256," "hmac-sha2-512," "hmac-sha1", "none,zlib@openssh.com", "none,zlib@openssh.com", "", ""}; char *s, *all_key; char *prop_kex = ((void *)0), *prop_enc = ((void *)0), *prop_hostkey = ((void *)0); int r, use_known_hosts_order = 0; xxx_host = host; xxx_hostaddr = hostaddr; xxx_conn_info = cinfo; if (options.hostkeyalgorithms == ((void *)0) || options.hostkeyalgorithms[0] == '-' || options.hostkeyalgorithms[0] == '+') use_known_hosts_order = 1; all_key = sshkey_alg_list(0, 0, 1, ','); if ((r = kex_assemble_names(&options.hostkeyalgorithms, kex_default_pk_alg(), all_key)) != 0) sshfatal("sshconnect2.c", __func__, 247, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "kex_assemble_namelist"); free(all_key); if ((s = kex_names_cat(options.kex_algorithms, "ext-info-c")) == ((void *)0)) sshfatal("sshconnect2.c", __func__, 251, 1, SYSLOG_LEVEL_FATAL, ((void *)0), "kex_names_cat"); myproposal[PROPOSAL_KEX_ALGS] = prop_kex = compat_kex_proposal(ssh, s); myproposal[PROPOSAL_ENC_ALGS_CTOS] = myproposal[PROPOSAL_ENC_ALGS_STOC] = prop_enc = compat_cipher_proposal(ssh, options.ciphers); myproposal[PROPOSAL_COMP_ALGS_CTOS] = myproposal[PROPOSAL_COMP_ALGS_STOC] = (char *)compression_alg_list(options.compression); myproposal[PROPOSAL_MAC_ALGS_CTOS] = myproposal[PROPOSAL_MAC_ALGS_STOC] = options.macs; if (use_known_hosts_order) { myproposal[PROPOSAL_SERVER_HOST_KEY_ALGS] = prop_hostkey = compat_pkalg_proposal(ssh, order_hostkeyalgs(host, hostaddr, port, cinfo)); } else { myproposal[PROPOSAL_SERVER_HOST_KEY_ALGS] = prop_hostkey = compat_pkalg_proposal(ssh, options.hostkeyalgorithms); } if (options.rekey_limit || options.rekey_interval) ssh_packet_set_rekey_limits(ssh, options.rekey_limit, options.rekey_interval); if ((r = kex_setup(ssh, myproposal)) != 0) sshfatal("sshconnect2.c", __func__, 278, 0, SYSLOG_LEVEL_FATAL, ssh_err(r), "kex_setup"); ssh->kex->kex[KEX_DH_GRP1_SHA1] = kex_gen_client; ssh->kex->kex[KEX_DH_GRP14_SHA1] = kex_gen_client; ssh->kex->kex[KEX_DH_GRP14_SHA256] = kex_gen_client; ssh->kex->kex[KEX_DH_GRP16_SHA512] = kex_gen_client; ssh->kex->kex[KEX_DH_GRP18_SHA512] = kex_gen_client; ssh->kex->kex[KEX_DH_GEX_SHA1] = kexgex_client; ssh->kex->kex[KEX_DH_GEX_SHA256] = kexgex_client; ssh->kex->kex[KEX_ECDH_SHA2] = kex_gen_client; ssh->kex->kex[KEX_C25519_SHA256] = kex_gen_client; ssh->kex->kex[KEX_KEM_SNTRUP761X25519_SHA512] = kex_gen_client; ssh->kex->verify_host_key = &verify_host_key_callback; ssh_dispatch_run_fatal(ssh, DISPATCH_BLOCK, &ssh->kex->done); myproposal[PROPOSAL_KEX_ALGS] = compat_kex_proposal(ssh, options.kex_algorithms); if ((r = kex_prop2buf(ssh->kex->my, myproposal)) != 0) sshfatal("sshconnect2.c", __func__, 301, 0, SYSLOG_LEVEL_FATAL, ssh_err(r), "kex_prop2buf"); free(prop_kex); free(prop_enc); free(prop_hostkey); }
void ssh_kex2(long param_1, undefined8 param_2, undefined8 param_3, undefined2 param_4, undefined8 param_5) { long lVar1; undefined8 uVar2; char **ppcVar3; undefined *puVar4; undefined *puVar5; long in_FS_OFFSET; char *apcStack272[9]; undefined auStack200[8]; undefined8 local_c0; undefined2 local_b4; undefined8 local_b0; undefined8 local_a8; long local_a0; int local_98; int local_94; void *local_90; char *local_88; void *local_80; void *local_78; long local_70; char *local_68; char *local_60; char *local_58; char *local_50; char *local_48; char *local_40; char *local_38; char *local_30; undefined *local_28; undefined *local_20; long local_10; ppcVar3 = (char **)auStack200; local_10 = *(long *)(in_FS_OFFSET + 0x28); local_68 = "sntrup761x25519-sha512@openssh.com,curve25519-sha256,curve25519-sha256@" "libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521," "diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512," "diffie-hellman-group18-sha512,diffie-hellman-group14-sha256"; local_60 = "ssh-ed25519-cert-v01@openssh.com,ecdsa-sha2-nistp256-cert-v01@openssh." "com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-" "v01@openssh.com,sk-ssh-ed25519-cert-v01@openssh.com,sk-ecdsa-sha2-" "nistp256-cert-v01@openssh.com,rsa-sha2-512-cert-v01@openssh.com,rsa-" "sha2-256-cert-v01@openssh.com,ssh-ed25519,ecdsa-sha2-nistp256,ecdsa-" "sha2-nistp384,ecdsa-sha2-nistp521,sk-ssh-ed25519@openssh.com,sk-ecdsa-" "sha2-nistp256@openssh.com,rsa-sha2-512,rsa-sha2-256"; local_58 = "chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr," "aes128-gcm@openssh.com,aes256-gcm@openssh.com"; local_50 = "chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr," "aes128-gcm@openssh.com,aes256-gcm@openssh.com"; local_48 = "umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-" "etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@" "openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-" "256,hmac-sha2-512,hmac-sha1"; local_40 = "umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-" "etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@" "openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-" "256,hmac-sha2-512,hmac-sha1"; local_38 = "none,zlib@openssh.com"; local_30 = "none,zlib@openssh.com"; local_28 = &DAT_00107745; local_20 = &DAT_00107745; local_88 = (char *)0x0; local_80 = (void *)0x0; local_90 = (void *)0x0; local_98 = 0; if (((_xasprintf == (char *)0x0) || (*_xasprintf == '-')) || (*_xasprintf == '+')) { local_98 = 1; } apcStack272[8] = (char *)0x1007a3; xxx_host = param_2; xxx_hostaddr = param_3; xxx_conn_info = param_5; local_c0 = param_5; local_b4 = param_4; local_b0 = param_3; local_a8 = param_2; local_a0 = param_1; local_78 = (void *)sshkey_alg_list(0, 0, 1, 0x2c); apcStack272[8] = (char *)0x1007ac; uVar2 = kex_default_pk_alg(); apcStack272[8] = (char *)0x1007c5; local_94 = kex_assemble_names(xasprintf, uVar2, local_78); if (local_94 != 0) { apcStack272[8] = (char *)0x1007e1; uVar2 = ssh_err(local_94); ppcVar3 = apcStack272 + 7; apcStack272[7] = "kex_assemble_namelist"; sshfatal("sshconnect2.c", __func___19905, 0xf7, 1, 1, uVar2); } *(undefined8 *)((long)ppcVar3 + -8) = 0x100824; free(local_78); *(undefined8 *)((long)ppcVar3 + -8) = 0x10083a; local_70 = kex_names_cat(_free, "ext-info-c"); puVar5 = (undefined *)ppcVar3; if (local_70 == 0) { puVar5 = (undefined *)((long)ppcVar3 + -0x10); *(char **)((long)ppcVar3 + -0x10) = "kex_names_cat"; *(undefined8 *)((long)ppcVar3 + -0x18) = 0x10087f; sshfatal("sshconnect2.c", __func___19905, 0xfb, 1, 1, 0); } *(undefined8 *)(puVar5 + -8) = 0x100895; local_88 = (char *)compat_kex_proposal(local_a0, local_70); *(undefined8 *)(puVar5 + -8) = 0x1008ba; local_68 = local_88; local_80 = (void *)compat_cipher_proposal(local_a0, _strlcat); *(undefined8 *)(puVar5 + -8) = 0x1008db; local_58 = (char *)local_80; local_50 = (char *)local_80; local_38 = (char *)compression_alg_list(DAT_0010a064); local_40 = (char *)_strsep; local_48 = (char *)_strsep; local_30 = local_38; if (local_98 == 0) { *(undefined8 *)(puVar5 + -8) = 0x100969; local_60 = (char *)compat_pkalg_proposal(local_a0, _xasprintf); } else { *(undefined8 *)(puVar5 + -8) = 0x100927; uVar2 = order_hostkeyalgs(local_a8, local_b0, local_b4, local_c0); *(undefined8 *)(puVar5 + -8) = 0x10093c; local_60 = (char *)compat_pkalg_proposal(local_a0, uVar2); } local_90 = local_60; if ((_DAT_0010b328 != 0) || (_DAT_0010b330 != 0)) { *(undefined8 *)(puVar5 + -8) = 0x1009b5; ssh_packet_set_rekey_limits(local_a0, _DAT_0010b328, _DAT_0010b330); } *(undefined8 *)(puVar5 + -8) = 0x1009cb; local_94 = kex_setup(local_a0, &local_68); puVar4 = puVar5; if (local_94 != 0) { *(undefined8 *)(puVar5 + -8) = 0x1009e7; uVar2 = ssh_err(local_94); puVar4 = puVar5 + -0x10; *(char **)(puVar5 + -0x10) = "kex_setup"; *(undefined8 *)(puVar5 + -0x18) = 0x100a1e; sshfatal("sshconnect2.c", __func___19905, 0x116, 0, 1, uVar2); } *(undefined8 *)(*(long *)(local_a0 + 8) + 200) = uRam0000000000100a30; *(undefined8 *)(*(long *)(local_a0 + 8) + 0xd0) = uRam0000000000100a49; *(undefined8 *)(*(long *)(local_a0 + 8) + 0xd8) = uRam0000000000100a62; *(undefined8 *)(*(long *)(local_a0 + 8) + 0xe0) = uRam0000000000100a7b; *(undefined8 *)(*(long *)(local_a0 + 8) + 0xe8) = uRam0000000000100a94; *(undefined8 *)(*(long *)(local_a0 + 8) + 0xf0) = uRam0000000000100aad; *(undefined8 *)(*(long *)(local_a0 + 8) + 0xf8) = uRam0000000000100ac6; *(undefined8 *)(*(long *)(local_a0 + 8) + 0x100) = uRam0000000000100adf; *(undefined8 *)(*(long *)(local_a0 + 8) + 0x108) = uRam0000000000100af8; *(undefined8 *)(*(long *)(local_a0 + 8) + 0x110) = uRam0000000000100b11; *(undefined8 *)(*(long *)(local_a0 + 8) + 0xa0) = 0x100000; lVar1 = *(long *)(local_a0 + 8); *(undefined8 *)(puVar4 + -8) = 0x100b57; ssh_dispatch_run_fatal(local_a0, 0, lVar1 + 0x88); *(undefined8 *)(puVar4 + -8) = 0x100b70; local_68 = (char *)compat_kex_proposal(local_a0, _free); uVar2 = *(undefined8 *)(*(long *)(local_a0 + 8) + 0x50); *(undefined8 *)(puVar4 + -8) = 0x100b92; local_94 = kex_prop2buf(uVar2, &local_68); puVar5 = puVar4; if (local_94 != 0) { *(undefined8 *)(puVar4 + -8) = 0x100bae; uVar2 = ssh_err(local_94); puVar5 = puVar4 + -0x10; *(char **)(puVar4 + -0x10) = "kex_prop2buf"; *(undefined8 *)(puVar4 + -0x18) = 0x100be5; sshfatal("sshconnect2.c", __func___19905, 0x12d, 0, 1, uVar2); } *(undefined8 *)(puVar5 + -8) = 0x100bf1; free(local_88); *(undefined8 *)(puVar5 + -8) = 0x100bfd; free(local_80); *(undefined8 *)(puVar5 + -8) = 0x100c0c; free(local_90); if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) { *(undefined8 *)(puVar5 + -8) = 0x100c21; __stack_chk_fail(); } return; }
openssh-portable
ghidra
bmexec_trans(kwset_t kwset, char const *text, idx_t size) { ((0 <= size) ? (void)0 : __builtin_unreachable()); unsigned char const *d1; char const *ep, *sp, *tp; int d; idx_t len = kwset->mind; char const *trans = kwset->trans; if (len == 0) return 0; if (len > size) return -1; if (len == 1) { tp = memchr_kwset(text, size, kwset); return tp ? tp - text : -1; } d1 = kwset->delta; sp = kwset->target + len; tp = text + len; char gc1 = kwset->gc1; char gc2 = kwset->gc2; idx_t len12; if (!__builtin_mul_overflow(len, 12, &len12) && len12 < size) for (ep = text + size - 11 * len; tp <= ep;) { char const *tp0 = tp; d = d1[U(tp[-1])], tp += d; d = d1[U(tp[-1])], tp += d; if (d != 0) { d = d1[U(tp[-1])], tp += d; d = d1[U(tp[-1])], tp += d; d = d1[U(tp[-1])], tp += d; if (d != 0) { d = d1[U(tp[-1])], tp += d; d = d1[U(tp[-1])], tp += d; d = d1[U(tp[-1])], tp += d; if (d != 0) { d = d1[U(tp[-1])], tp += d; d = d1[U(tp[-1])], tp += d; int advance_heuristic = 16 * sizeof(long); if (advance_heuristic <= tp - tp0) continue; tp--; tp = memchr_kwset(tp, text + size - tp, kwset); if (!tp) return -1; tp++; if (ep <= tp) break; } } } if (bm_delta2_search(&tp, ep, sp, len, trans, gc1, gc2, d1, kwset)) return tp - text; } ep = text + size; d = d1[U(tp[-1])]; while (d <= ep - tp) { d = d1[U((tp += d)[-1])]; if (d != 0) continue; if (bm_delta2_search(&tp, ep, sp, len, trans, gc1, gc2, ((void *)0), kwset)) return tp - text; } return -1; }
int bmexec_trans(struct_0 *a0, unsigned long long a1, unsigned int a2) { unsigned int v0; char v1; char v2; unsigned int v3; unsigned int v4; unsigned long v5; unsigned long v6; unsigned int v7; char *v8; char *v9; unsigned long long v10; unsigned int v11; unsigned long v12; unsigned int v14; unsigned long v15; v0 = a2; *(&v7) = a0->field_68; v8 = a0->field_980; if (!*(&v7)) { v14 = 0; } else if (*(&v7) > *(&v0)) { v14 = -1; } else if (*(&v7) == 1) { v5 = memchr_kwset(a1, *(&v0), a0); if (v5) v14 = v5 - a1; else v14 = -1; } else { v9 = &a0->padding_70[0]; v10 = *(&v7) + a0->field_970; v5 = a1 + *(&v7); v1 = a0->field_988; v2 = a0->field_990; v15 = 0; if ([D] amd64g_calculate_condition( 0x0 < 64 >, 0x34 < 64 >, Load(addr = stack_base - 64, size = 8, endness = Iend_LE), 0xc < 64 >, cc_ndep<8>)) *(&v15) = 1; v6 = *(&v7) * 12; if ((v15 & 1 ^ 1) && *(&v0) > v6) { *(&v11) = a1 + *(&v0) - *(&v7) * 11; while (*(&v11) >= v5) { v12 = v5; v3 = v9[U(*((v5 - 1)))]; v5 = v3 + v5; v3 = v9[U(*((v5 - 1)))]; v5 = v3 + v5; if (v3) { v3 = v9[U(*((v5 - 1)))]; v5 = v3 + v5; v3 = v9[U(*((v5 - 1)))]; v5 = v3 + v5; v3 = v9[U(*((v5 - 1)))]; v5 = v3 + v5; if (v3) { v3 = v9[U(*((v5 - 1)))]; v5 = v3 + v5; v3 = v9[U(*((v5 - 1)))]; v5 = v3 + v5; v3 = v9[U(*((v5 - 1)))]; v5 = v3 + v5; if (v3) { v3 = v9[U(*((v5 - 1)))]; v5 = v3 + v5; v14 = v9[U(*((v5 - 1)))]; v3 = v14; v5 = v3 + v5; v4 = 128; if (v4 <= v5 - v12) continue; if (v4 > v5 - v12) { v5 -= 1; v5 = memchr_kwset(v5, *(&v0) + a1 + -0x1 * v5, a0); if (!v5) { v14 = -1; break; } else { v5 += 1; if (*(&v11) <= v5) break; } } } } } if (v3 && v4 > v5 - v12 && v5 && v3 && v3 && *(&v11) > v5 || v3 && v3 && !v3 || v3 && !v3 || !v3) { v14 = bm_delta2_search(&v5, *(&v11), v10, *(&v7), v8, v1, v2, v9, a0); if (!v14) continue; v14 = v5 - a1; break; } } } if (*(&v0) > v6 && (v15 & 1 ^ 1) && (!(v14) || !(!v3) && !(!v3) && !(!v3) && !(*(&v11) > v5) || !(!v3) && !(!v3) && !(!v3) && !(v5)) && (!(v3) || !(*(&v11) >= v5) || !(v4 > v5 - v12) || !(v3) || !(v3) || !(!v5)) || (v15 & 1 ^ 1) && *(&v0) <= v6 || !(v15 & 1 ^ 1)) { *(&v11) = a1 + *(&v0); *(&v14) = v9[U(*((v5 - 1)))]; v3 = v14; while (true) { if (v3 <= *(&v11) - v5) { v5 = v3 + v5; v3 = U(*((v5 - 1))); if (v3) continue; v14 = bm_delta2_search(&v5, *(&v11), v10, *(&v7), v8, v1, v2, 0x0, a0); if (!v14) continue; v14 = v5 - a1; break; } else { v14 = -1; break; } } } } return v14; }
grep
angr_dream
static SHELL_VAR *bind_assoc_var_internal(entry, hash, key, value, flags) SHELL_VAR *entry; HASH_TABLE *hash; char *key; char *value; int flags; { char *newval; newval = make_array_variable_value(entry, 0, key, value, flags); if (entry->assign_func) (*entry->assign_func)(entry, newval, 0, key); else assoc_insert(hash, key, newval); do { if (newval) sh_xfree((newval), "arrayfunc.c", 215); } while (0); ((entry)->attributes &= ~(0x0001000)); return (entry); }
void bind_assoc_var_internal(struct_0 *a0, unsigned long long a1, unsigned long long a2, unsigned long long a3, unsigned long a4) { unsigned long long v0; int tmp_23; unsigned long long v2; struct_0 *v3; v0 = make_array_variable_value(a0, 0x0, a2, a3, a4); if (!a0->field_20) assoc_insert(a1, a2, v0, a2); else a0->field_20(a0, v0, 0, a2, a0->field_20); if (v0) sh_xfree(v0, "arrayfunc.c", 0xd7); v2 = a0->field_28; *(&v2) = (a0->field_28 >> 8) & 239; tmp_23 = v2; a0->field_28 = tmp_23; v3 = a0; return; }
bash
angr_sailr
static _Bool do_arm_swaps(struct predicate *p) { if (p) { _Bool swapped; do { swapped = 0; if (consider_arm_swap(p) || do_arm_swaps(p->pred_left) || do_arm_swaps(p->pred_right)) { swapped = 1; } } while (swapped); return swapped; } else { return 0; } }
int do_arm_swaps(unsigned long long a0[36]) { char v0; unsigned int v2; if (!a0) { v2 = 0; return v2; } do { v0 = 0; if (consider_arm_swap(a0) || do_arm_swaps(a0[34]) || do_arm_swaps(a0[35])) v0 = 1; } while (v0); v2 = v0; return v2; }
findutils
angr_sailr
static void move_home(void) { struct stat sb; if (access(prefix_user_newhome, 0) == 0) { fprintf(stderr, gettext("%s: directory %s exists\n"), Prog, user_newhome); fail_exit(12); } if (stat(prefix_user_home, &sb) == 0) { if (!((((sb.st_mode)) & 0170000) == (0040000))) { fprintf(stderr, gettext("%s: The previous home directory (%s) was " "not a directory. It is not removed and no " "home directories are created.\n") , Prog, user_home); fail_exit(12); } if (rename(prefix_user_home, prefix_user_newhome) == 0) { if (chown_tree(prefix_user_newhome, user_id, uflg ? user_newid : (uid_t)-1, user_gid, gflg ? user_newgid : (gid_t)-1) != 0) { fprintf(stderr, gettext("%s: Failed to change ownership of the home directory"), Prog); fail_exit(12); } return; } else { if (18 == (*__errno_location())) { if (btrfs_is_subvolume(prefix_user_home) > 0) { fprintf(stderr, gettext("%s: error: cannot move subvolume from %s to %s - " "different device\n"), Prog, prefix_user_home, prefix_user_newhome); fail_exit(12); } if (copy_tree(prefix_user_home, prefix_user_newhome, 1, 1, user_id, uflg ? user_newid : (uid_t)-1, user_gid, gflg ? user_newgid : (gid_t)-1) == 0) { if (remove_tree(prefix_user_home, 1) != 0) { fprintf(stderr, gettext("%s: warning: failed to completely remove old home " "directory %s"), Prog, prefix_user_home); } return; } (void)remove_tree(prefix_user_newhome, 1); } fprintf(stderr, gettext("%s: cannot rename directory %s to %s\n"), Prog, prefix_user_home, prefix_user_newhome); fail_exit(12); } } else { fprintf(stderr, gettext("%s: The previous home directory (%s) does not " "exist or is inaccessible. Move cannot be completed.\n"), Prog, prefix_user_home); } }
void move_home(void) { undefined8 uVar1; int iVar2; undefined4 uVar3; char *pcVar4; int *piVar5; char *pcVar6; char *pcVar7; undefined4 uVar8; long in_FS_OFFSET; stat local_c8; long local_30; local_30 = *(long *)(in_FS_OFFSET + 0x28); iVar2 = access(prefix_user_newhome, 0); uVar1 = Prog; if (iVar2 == 0) { pcVar4 = (char *)gettext("%s: directory %s exists\n"); fprintf(stderr, pcVar4, uVar1); fail_exit(0xc); } iVar2 = stat(prefix_user_home, &local_c8); uVar1 = Prog; pcVar4 = prefix_user_home; if (iVar2 == 0) { if ((local_c8.st_mode & 0xf000) != 0x4000) { pcVar4 = (char *)gettext( "%s: The previous home directory (%s) was not a directory. It is not " "removed and no home directories are created.\n"); fprintf(stderr, pcVar4, uVar1); fail_exit(0xc); } iVar2 = rename(prefix_user_home, prefix_user_newhome); if (iVar2 == 0) { uVar8 = user_newgid; if (gflg == '\0') { uVar8 = 0xffffffff; } uVar3 = user_newid; if (uflg == '\0') { uVar3 = 0xffffffff; } iVar2 = chown_tree(prefix_user_newhome, user_id, uVar3, user_gid, uVar8); uVar1 = Prog; if (iVar2 != 0) { pcVar4 = (char *)gettext( "%s: Failed to change ownership of the home directory"); fprintf(stderr, pcVar4, uVar1); fail_exit(0xc); } } else { piVar5 = __errno_location(); if (*piVar5 == 0x12) { iVar2 = btrfs_is_subvolume(prefix_user_home); uVar1 = Prog; pcVar7 = prefix_user_newhome; pcVar4 = prefix_user_home; if (0 < iVar2) { pcVar6 = (char *)gettext("%s: error: cannot move subvolume from %s " "to %s - different device\n"); fprintf(stderr, pcVar6, uVar1, pcVar4, pcVar7); fail_exit(0xc); } uVar8 = user_newgid; if (gflg == '\0') { uVar8 = 0xffffffff; } uVar3 = user_newid; if (uflg == '\0') { uVar3 = 0xffffffff; } iVar2 = copy_tree(prefix_user_home, prefix_user_newhome, 1, 1, user_id, uVar3, user_gid, uVar8); if (iVar2 == 0) { iVar2 = remove_tree(prefix_user_home, 1); uVar1 = Prog; pcVar4 = prefix_user_home; if (iVar2 != 0) { pcVar7 = (char *)gettext("%s: warning: failed to completely remove " "old home directory %s"); fprintf(stderr, pcVar7, uVar1, pcVar4); } goto LAB_00104dbf; } remove_tree(prefix_user_newhome, 1); } uVar1 = Prog; pcVar7 = prefix_user_newhome; pcVar4 = prefix_user_home; pcVar6 = (char *)gettext("%s: cannot rename directory %s to %s\n"); fprintf(stderr, pcVar6, uVar1, pcVar4, pcVar7); fail_exit(0xc); } } else { pcVar7 = (char *)gettext("%s: The previous home directory (%s) does not exist " "or is inaccessible. Move cannot be completed.\n"); fprintf(stderr, pcVar7, uVar1, pcVar4); } LAB_00104dbf: if (local_30 == *(long *)(in_FS_OFFSET + 0x28)) { return; } __stack_chk_fail(); }
shadow
ghidra
static int nh_dump_filter(struct nlmsghdr *nlh, int reqlen) { int err; if (filter.ifindex) { err = addattr32(nlh, reqlen, NHA_OIF, filter.ifindex); if (err) return err; } if (filter.groups) { err = addattr_l(nlh, reqlen, NHA_GROUPS, ((void *)0), 0); if (err) return err; } if (filter.master) { err = addattr32(nlh, reqlen, NHA_MASTER, filter.master); if (err) return err; } if (filter.fdb) { err = addattr_l(nlh, reqlen, NHA_FDB, ((void *)0), 0); if (err) return err; } return 0; }
int nh_dump_filter(unsigned long long a0, unsigned long a1) { unsigned int v0; unsigned int v2; if (g_403a08) { v0 = addattr32(a0, a1, 0x5, g_403a08); if (v0) v2 = v0; } if (!v0 || !g_403a08) { if (g_403a04) { v0 = addattr_l(a0, a1, 0x9, 0x0, 0x0); if (v0) v2 = v0; } if (!g_403a04 || !v0) { if (g_403a0c) { v0 = addattr32(a0, a1, 0xa, g_403a0c); if (v0) v2 = v0; } if (!g_403a0c || !v0) { if (g_403a14) { v0 = addattr_l(a0, a1, 0xb, 0x0, 0x0); if (v0) v2 = v0; } if (!v0 || !g_403a14) v2 = 0; } } } return v2; }
iproute2-6.0.0
angr_dream
COMMAND *make_function_def(name, command, lineno, lstart) WORD_DESC *name; COMMAND *command; int lineno, lstart; { FUNCTION_DEF *temp; SHELL_VAR *bash_source_v; ARRAY *bash_source_a; temp = (FUNCTION_DEF *)sh_xmalloc((sizeof(FUNCTION_DEF)), "make_cmd.c", 786); temp->command = command; temp->name = name; temp->line = lineno; temp->flags = 0; command->line = lstart; temp->source_file = 0; do { (bash_source_v) = find_variable("BASH_SOURCE"); (bash_source_a) = ((bash_source_v) && (((((bash_source_v))->attributes) & (0x0000004)))) ? (ARRAY *)((bash_source_v)->value) : (ARRAY *)0; } while (0); if (bash_source_a && ((bash_source_a)->num_elements) > 0) temp->source_file = array_reference(bash_source_a, 0); if (temp->source_file == 0) temp->source_file = shell_initialized ? "main" : "environment"; bind_function_def(name->word, temp, 0); temp->source_file = temp->source_file ? (char *)strcpy( sh_xmalloc((1 + strlen(temp->source_file)), "make_cmd.c", 810), (temp->source_file)) : 0; return (make_command(cm_function_def, (SIMPLE_COM *)temp)); }
long make_function_def(_QWORD *a1, long a2, int a3, int a4) { long v4; const char *v5; const char *v6; size_t v7; char *v8; char *v9; long v13; long variable; v13 = sh_xmalloc(32LL, "make_cmd.c", 786LL); *(_QWORD *)(v13 + 16) = a2; *(_QWORD *)(v13 + 8) = a1; *(_DWORD *)(v13 + 4) = a3; *(_DWORD *)v13 = 0; *(_DWORD *)(a2 + 8) = a4; *(_QWORD *)(v13 + 24) = 0LL; variable = find_variable("BASH_SOURCE"); if (variable && (*(_DWORD *)(variable + 40) & 4) != 0) v4 = *(_QWORD *)(variable + 8); else v4 = 0LL; if (v4 && *(long *)(v4 + 8) > 0) *(_QWORD *)(v13 + 24) = array_reference(v4, 0LL); if (!*(_QWORD *)(v13 + 24)) { if (shell_initialized) v5 = "main"; else v5 = "environment"; *(_QWORD *)(v13 + 24) = v5; } bind_function_def(*a1, v13, 0LL); if (*(_QWORD *)(v13 + 24)) { v6 = *(const char **)(v13 + 24); v7 = strlen(v6); v8 = (char *)sh_xmalloc(v7 + 1, "make_cmd.c", 810LL); v9 = strcpy(v8, v6); } else { v9 = 0LL; } *(_QWORD *)(v13 + 24) = v9; return make_command(7, v13); }
bash
ida
static int show_config(struct kmod_ctx *ctx) { struct config_iterators { const char *name; struct kmod_config_iter *(*get_iter)(const struct kmod_ctx *ctx); } ci[] = { {"blacklist", kmod_config_get_blacklists}, {"install", kmod_config_get_install_commands}, {"remove", kmod_config_get_remove_commands}, {"alias", kmod_config_get_aliases}, {"options", kmod_config_get_options}, {"softdep", kmod_config_get_softdeps}, }; size_t i; for (i = 0; i < (sizeof(ci) / sizeof((ci)[0]) + ({ _Static_assert((!__builtin_types_compatible_p(typeof(ci), typeof(&(ci)[0]))), "!__builtin_types_compatible_p(typeof(ci), typeof(&(ci)[0]))"); 0; })); i++) { struct kmod_config_iter *iter = ci[i].get_iter(ctx); if (iter == ((void *)0)) continue; while (kmod_config_iter_next(iter)) { const char *val; printf("%s %s", ci[i].name, kmod_config_iter_get_key(iter)); val = kmod_config_iter_get_value(iter); if (val != ((void *)0)) { putchar(' '); puts(val); } else putchar('\n'); } kmod_config_iter_free_iter(iter); } puts("\n# End of configuration files. Dumping indexes now:\n"); fflush(stdout); kmod_dump_index(ctx, KMOD_INDEX_MODULES_ALIAS, 1); kmod_dump_index(ctx, KMOD_INDEX_MODULES_SYMBOL, 1); return 0; }
int show_config(unsigned long long a0) { void *v0; unsigned long long v1; char *v2; unsigned long long v3; unsigned long v4; unsigned long long v5; unsigned long v6; unsigned long long v7; unsigned long v8; unsigned long long v9; unsigned long v10; unsigned long long v11; unsigned long v12; unsigned long long v13; unsigned long v14; v3 = "blacklist"; v4 = got.kmod_config_get_blacklists; v5 = "install"; v6 = got.kmod_config_get_install_commands; v7 = "remove"; v8 = got.kmod_config_get_remove_commands; v9 = "alias"; v10 = got.kmod_config_get_aliases; v11 = "options"; v12 = got.kmod_config_get_options; v13 = "softdep"; v14 = got.kmod_config_get_softdeps; for (v0 = 0; v0 <= 5; v0 += 1) { v1 = *((-112 + 16 * (stack_base)[144] + stack_base))(a0); if (v1) { while (kmod_config_iter_next(v1)) { printf("%s %s", *((&v3 + 0x10 * v0)), kmod_config_iter_get_key(v1)); v2 = kmod_config_iter_get_value(v1); if (!v2) { putchar(0xa); } else { putchar(0x20); puts(v2); } } kmod_config_iter_free_iter(v1); } } puts("\n# End of configuration files. Dumping indexes now:\n"); fflush(stdout); kmod_dump_index(a0, 0x1, 0x1); kmod_dump_index(a0, 0x2, 0x1); return 0; }
kmod
angr_phoenix
void cu_prermupgrade(int argc, void **argv) { struct pkginfo *pkg = (struct pkginfo *)argv[0]; if (cleanup_pkg_failed++) return; maintscript_postinst(pkg, "abort-upgrade", versiondescribe(&pkg->available.version, vdew_nonambig), ((void *)0)); pkg_clear_eflags(pkg, PKG_EFLAG_REINSTREQ); post_postinst_tasks(pkg, PKG_STAT_INSTALLED); cleanup_pkg_failed--; }
long long cu_prermupgrade(unsigned long a0, unsigned long long *a1) { unsigned int v0; unsigned long long v1; unsigned long long v3; v0 = a0; v1 = *(a1); v3 = cleanup_pkg_failed; cleanup_pkg_failed = cleanup_pkg_failed + 1; if (!v3) { maintscript_postinst(v1, "abort-upgrade", versiondescribe(v1 + 272, 0x1), 0x0); pkg_clear_eflags(v1, 0x1); post_postinst_tasks(v1, 0x7); v3 = cleanup_pkg_failed - 1; cleanup_pkg_failed = cleanup_pkg_failed - 1; } return v3; }
dpkg
angr_phoenix
static inline void emit_mandatory_arg_note(void) { fputs_unlocked(gettext("\nMandatory arguments to long options are mandatory " "for short options too.\n"), stdout) ; }
void emit_mandatory_arg_note() { unsigned long long v1; v1 = fputs_unlocked(gettext("\nMandatory arguments to long options are " "mandatory for short options too.\n"), stdout); return; }
coreutils
angr_dream
int main(int argc, char **argv) { _Bool ok; int optc; size_t nfiles; char **files; char *files_from = ((void *)0); struct fstatus *fstatus; struct Tokens tok; ; set_program_name(argv[0]); setlocale(6, ""); bindtextdomain("coreutils", "/usr/local/share/locale"); textdomain("coreutils"); atexit(close_stdout); page_size = getpagesize(); setvbuf(stdout, ((void *)0), 1, 0); posixly_correct = (getenv("POSIXLY_CORRECT") != ((void *)0)); print_lines = print_words = print_chars = print_bytes = 0; print_linelength = 0; total_lines = total_words = total_chars = total_bytes = max_line_length = 0; while ((optc = getopt_long(argc, argv, "clLmw", longopts, ((void *)0))) != -1) switch (optc) { case 'c': print_bytes = 1; break; case 'm': print_chars = 1; break; case 'l': print_lines = 1; break; case 'w': print_words = 1; break; case 'L': print_linelength = 1; break; case DEBUG_PROGRAM_OPTION: debug = 1; break; case FILES0_FROM_OPTION: files_from = optarg; break; case GETOPT_HELP_CHAR: usage(0); break; ; case GETOPT_VERSION_CHAR: version_etc(stdout, "wc", "GNU coreutils", Version, ("Paul Rubin"), ("David MacKenzie"), (char *)((void *)0)); exit(0); break; ; default: usage(1); } if (!(print_lines || print_words || print_chars || print_bytes || print_linelength)) print_lines = print_words = print_bytes = 1; _Bool read_tokens = 0; struct argv_iterator *ai; if (files_from) { FILE *stream; if (optind < argc) { error(0, 0, gettext("extra operand %s"), quotearg_style(shell_escape_always_quoting_style, argv[optind])); fprintf(stderr, "%s\n", gettext("file operands cannot be combined with --files0-from")); usage(1); } if ((strcmp(files_from, "-") == 0)) stream = stdin; else { stream = fopen(files_from, "r"); if (stream == ((void *)0)) ((!!sizeof(struct { _Static_assert(1, "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), gettext " "(\"cannot open %s for reading\"), quotearg_style " "(shell_escape_always_quoting_style, files_from)), " "assume (false))" ")"); int _gl_dummy; })) ? ((error(1, (*__errno_location()), gettext("cannot open %s for reading"), quotearg_style(shell_escape_always_quoting_style, files_from)), ((0) ? (void)0 : __builtin_unreachable()))) : ((error(1, (*__errno_location()), gettext("cannot open %s for reading"), quotearg_style(shell_escape_always_quoting_style, files_from)), ((0) ? (void)0 : __builtin_unreachable())))); } struct stat st; if (fstat(fileno(stream), &st) == 0 && ((((st.st_mode)) & 0170000) == (0100000)) && st.st_size <= (((10 * 1024 * 1024) < (physmem_available() / 2)) ? (10 * 1024 * 1024) : (physmem_available() / 2))) { read_tokens = 1; readtokens0_init(&tok); if (!readtokens0(stream, &tok) || rpl_fclose(stream) != 0) ((!!sizeof(struct { _Static_assert( 1, "verify_expr (" "1" ", " "(error (1, 0, gettext (\"cannot read file names from %s\"), " "quotearg_style (shell_escape_always_quoting_style, " "files_from)), assume (false))" ")"); int _gl_dummy; })) ? ((error(1, 0, gettext("cannot read file names from %s"), quotearg_style(shell_escape_always_quoting_style, files_from)), ((0) ? (void)0 : __builtin_unreachable()))) : ((error(1, 0, gettext("cannot read file names from %s"), quotearg_style(shell_escape_always_quoting_style, files_from)), ((0) ? (void)0 : __builtin_unreachable())))); files = tok.tok; nfiles = tok.n_tok; ai = argv_iter_init_argv(files); } else { files = ((void *)0); nfiles = 0; ai = argv_iter_init_stream(stream); } } else { static char *stdin_only[] = {((void *)0)}; files = (optind < argc ? argv + optind : stdin_only); nfiles = (optind < argc ? argc - optind : 1); ai = argv_iter_init_argv(files); } if (!ai) xalloc_die(); fstatus = get_input_fstatus(nfiles, files); number_width = compute_number_width(nfiles, fstatus); ok = 1; for (int i = 0;; i++) { _Bool skip_file = 0; enum argv_iter_err ai_err; char *file_name = argv_iter(ai, &ai_err); if (!file_name) { switch (ai_err) { case AI_ERR_EOF: goto argv_iter_done; case AI_ERR_READ: error( 0, (*__errno_location()), gettext("%s: read error"), quotearg_n_style_colon(0, shell_escape_quoting_style, files_from)); ok = 0; goto argv_iter_done; case AI_ERR_MEM: xalloc_die(); default: ((void)sizeof((!"unexpected error code from argv_iter") ? 1 : 0), __extension__({ if (!"unexpected error code from argv_iter") ; else __assert_fail("!\"unexpected error code from argv_iter\"", "src/wc.c", 938, __extension__ __PRETTY_FUNCTION__); })); } } if (files_from && (strcmp(files_from, "-") == 0) && (strcmp(file_name, "-") == 0)) { error(0, 0, gettext("when reading file names from stdin, " "no file name of %s allowed"), quotearg_style(shell_escape_always_quoting_style, file_name)); skip_file = 1; } if (!file_name[0]) { if (files_from == ((void *)0)) error(0, 0, "%s", gettext("invalid zero-length file name")); else { unsigned long int file_number = argv_iter_n_args(ai); error(0, 0, "%s:%lu: %s", quotearg_n_style_colon(0, shell_escape_quoting_style, files_from), file_number, gettext("invalid zero-length file name")); } skip_file = 1; } if (skip_file) ok = 0; else ok &= wc_file(file_name, &fstatus[nfiles ? i : 0]); if (!nfiles) fstatus[0].failed = 1; } argv_iter_done: if (ok && !files_from && argv_iter_n_args(ai) == 0) ok &= wc_file(((void *)0), &fstatus[0]); if (read_tokens) readtokens0_free(&tok); if (1 < argv_iter_n_args(ai)) write_counts(total_lines, total_words, total_chars, total_bytes, max_line_length, gettext("total")); argv_iter_free(ai); free(fstatus); if (have_read_stdin && close(0) != 0) ((!!sizeof(struct { _Static_assert( 1, "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), \"-\"), assume (false))" ")"); int _gl_dummy; })) ? ((error(1, (*__errno_location()), "-"), ((0) ? (void)0 : __builtin_unreachable()))) : ((error(1, (*__errno_location()), "-"), ((0) ? (void)0 : __builtin_unreachable())))); return ok ? 0 : 1; }
int main(unsigned long a0, unsigned long long *a1) { void *v0; unsigned long long v1; char v2; char v3; char v4; char v5; unsigned int v6; unsigned int v7; unsigned long long v8; unsigned long long v9; void *v10; unsigned long long v11; void *v12; unsigned int *v13; char *v14; unsigned long v15; char v16; char v17; char v18; char v19; char v20; unsigned long long v22; unsigned long long v23; unsigned long long v24; unsigned long long v25; int v26; unsigned long long v27; unsigned long long v28; unsigned long long v29; unsigned long long v30; unsigned long long v31; void *v32; unsigned long v33; unsigned long long v34; unsigned long long v35; unsigned long long v37; v10 = 0; set_program_name(*(a1)); setlocale(0x6, &g_402913); bindtextdomain("coreutils", "/usr/local/share/locale"); textdomain("coreutils"); atexit(got.close_stdout); page_size = getpagesize(); setvbuf(stdout, NULL, 0x1, 0x0); posixly_correct = getenv("POSIXLY_CORRECT"); print_bytes = 0; print_chars = print_bytes; print_words = print_chars; print_lines = print_words; print_linelength = 0; max_line_length = 0; total_bytes = max_line_length; total_chars = total_bytes; total_words = total_chars; total_lines = total_words; while (true) { v7 = getopt_long(a0, a1, "clLmw", &longopts, NULL); if (v7 == -1) { if (!(print_lines ^ 1)) break; if ((print_lines ^ 1)) { if (!(print_words ^ 1)) break; if ((print_words ^ 1)) { if (!(print_chars ^ 1)) break; if ((print_chars ^ 1)) { if (!(print_bytes ^ 1)) break; if ((print_bytes ^ 1)) { if (!(print_linelength ^ 1)) break; if ((print_linelength ^ 1)) { print_bytes = 1; print_words = print_bytes; print_lines = print_words; break; } } } } } } else if (v7 <= 129) { if (v7 < 76) { if (v7 == -131) { v0 = 0; version_etc(stdout, "wc", "GNU coreutils", Version, "Paul Rubin", "David MacKenzie"); exit(0x0); } if (v7 == -130) usage(0x0); } else { switch (v7) { case 76: print_linelength = 1; break; case 99: print_bytes = 1; break; case 108: print_lines = 1; break; case 109: print_chars = 1; break; case 119: print_words = 1; break; case 128: debug = 1; break; case 129: v10 = optarg; break; default: usage(0x1); } } } } v3 = 0; if (!v10) { if (a0 > *(&optind)) v22 = &a1[*(&optind)]; else v22 = &stdin_only.6729; v9 = v22; if (a0 > *(&optind)) v28 = a0 - *(&optind); else v28 = 1; v8 = v28; v11 = argv_iter_init_argv(v9); } else if (a0 > *(&optind)) { v24 = quotearg_style(0x4, a1[*(&optind)], *(&optind) * 8); error(0x0, 0x0, gettext("extra operand %s")); fprintf(stderr, "%s\n", gettext("file operands cannot be combined with --files0-from")); usage(0x1); } else { v23 = strcmp(v10, "-"); if (!v23) { v12 = stdin; } else { v12 = fopen(v10, "r"); if (!v12) { v25 = quotearg_style(0x4, v10, "clLmw"); error(0x1, *(__errno_location()), gettext("cannot open %s for reading")); } } if (!v23 || v12) { v28 = fstat(fileno(v12), &v18); if (!v28 && (*(&v19) & 0xf000) == 0x8000) { v1 = *(&v20); physmem_available(); v27 = v26 / 0x4000000000000000; if ((((BinaryOp CmpF & 69) | ((BinaryOp CmpF & 69) >> 6)) & 1) != 1) { v27 = 0x4164000000000000; } else { physmem_available(); v27 /= 0x4000000000000000; } if (!(BinaryOp CmpF & 1)) { v3 = 1; readtokens0_init(&v16); *(&v28) = readtokens0(v12, &v16, &v16) ^ 1; if (!v28) { v28 = rpl_fclose(v12); if (!v28) { v9 = *(&v17); v8 = *(&v16); v11 = argv_iter_init_argv(v9); } } } } if (v28 || (*(&v19) & 0xf000) != 0x8000 || (BinaryOp CmpF & 1)) { v9 = 0; v8 = 0; v11 = argv_iter_init_stream(v12); } } } if (!v28 && a0 <= *(&optind) && (*(&v19) & 0xf000) == 0x8000 && !(BinaryOp CmpF & 1) && v10 && (!v23 || v12) && !v28 && v28 || !v28 && a0 <= *(&optind) && (*(&v19) & 0xf000) == 0x8000 && !(BinaryOp CmpF & 1) && v10 && (!v23 || v12) && v28) { v29 = quotearg_style(0x4, v10, &v16); error(0x1, 0x0, gettext("cannot read file names from %s")); } if (!v10 || !v28 && a0 <= *(&optind) && (*(&v19) & 0xf000) == 0x8000 && !(BinaryOp CmpF & 1) && v10 && (!v23 || v12) && !v28 && !v28 || a0 <= *(&optind) && v10 && (!v23 || v12) && (v28 || (*(&v19) & 0xf000) != 0x8000 || (BinaryOp CmpF & 1))) { if (!v11) xalloc_die(); v13 = get_input_fstatus(v8, v9); number_width = compute_number_width(v8, v13); v2 = 1; v6 = 0; while (true) { v4 = 0; v14 = argv_iter(v11, &v5, &v5); if (!v14) break; if (v10) { v28 = strcmp(v10, "-"); if (!v28) { v28 = strcmp(v14, "-"); if (!v28) { v30 = quotearg_style(0x4, v14, &v5); error(0x0, 0x0, gettext("when reading file names from stdin, no file name of " "%s allowed")); v4 = 1; } } } if (!*(v14)) { if (!v10) { gettext("invalid zero-length file name"); error(0x0, 0x0, "%s"); } else { v15 = argv_iter_n_args(v11); v31 = gettext("invalid zero-length file name"); quotearg_n_style_colon(0x0, 0x3, v10); error(0x0, 0x0, "%s:%lu: %s"); } v4 = 1; } if (v4) { v2 = 0; } else { if (v8) v32 = v6 * 152; else v32 = 0; v33 = v32 + v13; v28 = wc_file(v14, v33, v33) & v2; v2 = v28; } if (!v8) *(v13) = 1; v6 += 1; } v28 = *(&v5); if (*(&v5) != 4) { if (v28 <= 4 && v28 == 3) xalloc_die(); if ((v28 > 4 || v28 != 3) && (v28 > 4 || v28 != 2)) __assert_fail(); } else { v34 = quotearg_n_style_colon(0x0, 0x3, v10); error(0x0, *(__errno_location()), gettext("%s: read error")); v2 = 0; } if (*(&v5) == 4 || v28 <= 4 && v28 == 2) { if (v2 && !v10) { v35 = argv_iter_n_args(v11); if (!v35) { *(&v35) = wc_file(NULL, v13, v33) & v2; v2 = v35; } } if (v3) readtokens0_free(&v16); if (argv_iter_n_args(v11) > 1) write_counts(total_lines, total_words, total_chars, total_bytes, max_line_length, gettext("total")); argv_iter_free(v11); free(v13); if (have_read_stdin) { v37 = close(0x0); if (v37) error(0x1, *(__errno_location()), "-"); } if (!have_read_stdin || !v37) return v2 ^ 1; } } }
coreutils
angr_dream
static int _rl_nsearch_dosearch(_rl_search_cxt *cxt) { rl_mark = cxt->save_mark; if (rl_point == 0) { if (noninc_search_string == 0) { rl_ding(); rl_restore_prompt(); (rl_readline_state &= ~(0x0000100)); return -1; } } else { noninc_history_pos = cxt->save_line; if (noninc_search_string) free(noninc_search_string); noninc_search_string = strcpy((char *)xmalloc(1 + strlen(rl_line_buffer)), (rl_line_buffer)); rl_free_undo_list(); } rl_restore_prompt(); return (noninc_dosearch(noninc_search_string, cxt->direction, cxt->sflags & 0x10)); }
int _rl_nsearch_dosearch(unsigned int a0[26], unsigned long long a1, unsigned long long a2, unsigned long long a3, unsigned long long a4, unsigned long long a5) { char v0; int tmp_7; unsigned long long v1; unsigned int v2; rl_mark = a0[13]; if (rl_point) { noninc_history_pos = a0[14]; if (noninc_search_string) free(noninc_search_string); noninc_search_string = strcpy(xmalloc(strlen(rl_line_buffer) + 1), rl_line_buffer); rl_free_undo_list(); } else if (!noninc_search_string) { rl_ding(); rl_restore_prompt(a0, a1, a2, a3, a4, a5, *(&v0), v1); v2 = *(&rl_readline_state); *(&v2) = (*(&rl_readline_state) >> 8) & 254; tmp_7 = v2; *(&rl_readline_state) = tmp_7; v2 = -1; } if (rl_point || noninc_search_string) { rl_restore_prompt(a0, rl_line_buffer, a2, a3, a4, a5, *(&v0), v1); v2 = noninc_dosearch(noninc_search_string, a0[25], a0[1] & 16, a0[25], a4, a5); } return v2; }
bash
angr_dream
static _Bool millerrabin(uintmax_t n, uintmax_t ni, uintmax_t b, uintmax_t q, unsigned int k, uintmax_t one) { uintmax_t y = powm(b, q, n, ni, one); uintmax_t nm1 = n - one; if (y == one || y == nm1) return 1; for (unsigned int i = 1; i < k; i++) { y = mulredc(y, y, n, ni); if (y == nm1) return 1; if (y == one) return 0; } return 0; }
long long millerrabin(unsigned int a0, unsigned int a1, unsigned long a2, unsigned int a3, unsigned long a4, unsigned long a5) { unsigned int v0; unsigned int v1; unsigned long v2; unsigned long long v4; *(&v1) = powm(a2, a3, a0, a1, a5); v2 = a0 - a5; if (*(&v1) != a5 && *(&v1) != v2) { v0 = 1; while (true) { if (v0 < a4) { *(&v1) = mulredc(*(&v1), *(&v1), a0, a1); if (*(&v1) == v2) { v4 = 1; break; } else if (*(&v1) == a5) { v4 = 0; break; } else { v0 += 1; } } else { v4 = 0; break; } } } if (*(&v1) == v2 || *(&v1) == a5) v4 = 1; return v4; }
coreutils
angr_dream
HIST_ENTRY *history_get(int num) { static HIST_ENTRY she; HistEvent ev; int curr_num; if (h == ((void *)0) || e == ((void *)0)) rl_initialize(); if (num < history_base) return ((void *)0); if (history(h, &ev, 8) != 0) return ((void *)0); curr_num = ev.num; if (history(h, &ev, 24, num - history_base, (void **)-1) != 0) goto out; if (history(h, &ev, 8) != 0) goto out; if (history(h, &ev, 23, ev.num, &she.data) != 0) goto out; she.line = ev.str; (void)history(h, &ev, 7, curr_num); return &she; out: (void)history(h, &ev, 7, curr_num); return ((void *)0); }
long *history_get(int a1) { unsigned int v2; unsigned int v3; long v4; unsigned long v5; v5 = __readfsqword(0x28u); if (!h || !e) rl_initialize(); if (a1 < history_base) return 0LL; if ((unsigned int)history(h, &v3, 8LL, &v3)) return 0LL; v2 = v3; if ((unsigned int)history(h, &v3, 24LL, (unsigned int)(a1 - history_base)) || (unsigned int)history(h, &v3, 8LL, &v3) || (unsigned int)history(h, &v3, 23LL, v3)) { history(h, &v3, 7LL, v2); return 0LL; } else { she_6812 = v4; history(h, &v3, 7LL, v2); return &she_6812; } }
libedit
ida
static _Bool regex_compile(struct dfa_comp *dc, char const *p, idx_t len, idx_t pcount, idx_t lineno, reg_syntax_t syntax_bits, _Bool syntax_only) { struct re_pattern_buffer pat; pat.buffer = ((void *)0); pat.allocated = 0; _Static_assert((0x7f * 2 + 1) < (9223372036854775807L), "verify (" "UCHAR_MAX < IDX_MAX" ")"); idx_t uchar_max = (0x7f * 2 + 1); pat.fastmap = (syntax_only | match_icase) ? ((void *)0) : ximalloc(uchar_max + 1); pat.translate = ((void *)0); if (syntax_only) re_set_syntax( syntax_bits | (((((((((((((((((((((((((((unsigned long int)1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1)); else re_set_syntax(syntax_bits); char const *err = re_compile_pattern(p, len, &pat); if (!err) { if (syntax_only) regfree(&pat); else dc->patterns[pcount] = pat; return 1; } free(pat.fastmap); idx_t pat_lineno; char const *pat_filename = lineno < 0 ? "" : pattern_file_name(lineno, &pat_lineno); if (*pat_filename == '\0') error(0, 0, "%s", err); else { ptrdiff_t n = pat_lineno; error(0, 0, "%s:%td: %s", pat_filename, n, err); } return 0; }
long regex_compile(long a1, const char *a2, size_t a3, long a4, long a5, reg_syntax_t a6, unsigned char a7) { char *v7; unsigned char **v8; unsigned long allocated; reg_syntax_t v10; unsigned char *translate; unsigned char *v12; const char *v14; ptrdiff_t v19; long v20; const char *v21; const char *v22; ptrdiff_t v23; struct re_pattern_buffer buffer; unsigned long v25; v25 = __readfsqword(0x28u); buffer.buffer = 0LL; buffer.allocated = 0LL; v20 = 255LL; if (a7 | match_icase) v7 = 0LL; else v7 = (char *)ximalloc(v20 + 1); buffer.fastmap = v7; buffer.translate = 0LL; if (a7) re_set_syntax(a6 | 0x2000000); else re_set_syntax(a6); v21 = re_compile_pattern(a2, a3, &buffer); if (v21) { free(buffer.fastmap); if (a5 < 0) v14 = (const char *)&unk_163F; else v14 = (const char *)pattern_file_name(a5, &v19); v22 = v14; if (*v14) { v23 = v19; error(0, 0, "%s:%td: %s", v22, v19, v21); } else { error(0, 0, "%s", v21); } return 0LL; } else { if (a7) { regfree(&buffer); } else { v8 = (unsigned char **)((a4 << 6) + *(_QWORD *)(a1 + 16)); allocated = buffer.allocated; *v8 = buffer.buffer; v8[1] = (unsigned char *)allocated; v10 = buffer.syntax; v8[2] = (unsigned char *)buffer.used; v8[3] = (unsigned char *)v10; translate = buffer.translate; v8[4] = (unsigned char *)buffer.fastmap; v8[5] = translate; v12 = (unsigned char *)*((_QWORD *)&buffer + 7); v8[6] = (unsigned char *)buffer.re_nsub; v8[7] = v12; } return 1LL; } }
grep
ida
static _Bool append_equiv_class(struct Spec_list *list, char const *equiv_class_str, size_t len) { if (len != 1) return 0; struct List_element *new = xmalloc(sizeof *new); new->next = ((void *)0); new->type = RE_EQUIV_CLASS; new->u.equiv_code = *equiv_class_str; ((void)sizeof((list->tail) ? 1 : 0), __extension__({ if (list->tail) ; else __assert_fail("list->tail", "src/tr.c", 743, __extension__ __PRETTY_FUNCTION__); })); list->tail->next = new; list->tail = new; return 1; }
int append_equiv_class(struct_0 *a0, char *a1, unsigned long a2) { struct_2 *v0; unsigned int v2; if (a2 != 1) { v2 = 0; } else { v0 = xmalloc(0x20); v0->field_8 = 0; v0->field_0 = 3; v0->field_10 = *(a1); if (!a0->field_8) __assert_fail(); a0->field_8->field_8 = v0; a0->field_8 = &v0->field_0; v2 = 1; } return v2; }
coreutils
angr_phoenix
inline errcode_t ext2fs_free_mem(void *ptr) { void *p; memcpy(&p, ptr, sizeof(p)); free(p); p = 0; memcpy(ptr, &p, sizeof(p)); return 0; }
void ext2fs_free_mem(void) { halt_baddata(); }
e2fsprogs-1.46.5
ghidra
static void xheader_init(struct xheader *xhdr) { if (!xhdr->stk) { xhdr->stk = xmalloc(sizeof *xhdr->stk); _obstack_begin((xhdr->stk), 0, 0, (xmalloc), (free)); } }
void xheader_init(long *param_1) { long lVar1; if (*param_1 == 0) { lVar1 = xmalloc(0x58); *param_1 = lVar1; _obstack_begin(*param_1, 0, 0, uRam0000000000101cdb, uRam0000000000101cd1); } return; }
tar
ghidra
static Keymap get_cmd_xmap_from_keymap(kmap) Keymap kmap; { if (emacs_std_cmd_xmap == 0) init_unix_command_map(); if (kmap == emacs_standard_keymap) return emacs_std_cmd_xmap; else if (kmap == emacs_meta_keymap) return ((Keymap)(emacs_std_cmd_xmap[(('[') & 0x1f)].function)); else if (kmap == emacs_ctlx_keymap) return ((Keymap)(emacs_std_cmd_xmap[(('X') & 0x1f)].function)); else if (kmap == vi_insertion_keymap) return vi_insert_cmd_xmap; else if (kmap == vi_movement_keymap) return vi_movement_cmd_xmap; else return (Keymap)((void *)0); }
long get_cmd_xmap_from_keymap(undefined *param_1) { long lVar1; if (emacs_std_cmd_xmap == 0) { init_unix_command_map(); } lVar1 = emacs_std_cmd_xmap; if (param_1 != &emacs_standard_keymap) { if (param_1 == &emacs_meta_keymap) { lVar1 = *(long *)(emacs_std_cmd_xmap + 0x1b8); } else if (param_1 == &emacs_ctlx_keymap) { lVar1 = *(long *)(emacs_std_cmd_xmap + 0x188); } else { lVar1 = vi_insert_cmd_xmap; if ((param_1 != &vi_insertion_keymap) && (lVar1 = vi_movement_cmd_xmap, param_1 != &vi_movement_keymap)) { lVar1 = 0; } } } return lVar1; }
bash
ghidra
void crypto_sign_ed25519_ref_fe25519_mul( crypto_sign_ed25519_ref_fe25519 *r, const crypto_sign_ed25519_ref_fe25519 *x, const crypto_sign_ed25519_ref_fe25519 *y) { int i, j; crypto_uint32 t[63]; for (i = 0; i < 63; i++) t[i] = 0; for (i = 0; i < 32; i++) for (j = 0; j < 32; j++) t[i + j] += x->v[i] * y->v[j]; for (i = 32; i < 63; i++) r->v[i - 32] = t[i - 32] + times38(t[i]); r->v[31] = t[31]; reduce_mul(r); }
unsigned long crypto_sign_ed25519_ref_fe25519_mul(_DWORD *a1, long a2, long a3) { int v3; int i; int j; int m; int k; int v9[66]; unsigned long v10; v10 = __readfsqword(0x28u); for (i = 0; i <= 62; ++i) v9[i] = 0; for (j = 0; j <= 31; ++j) { for (k = 0; k <= 31; ++k) v9[j + k] += *(_DWORD *)(a3 + 4LL * k) * *(_DWORD *)(a2 + 4LL * j); } for (m = 32; m <= 62; ++m) { v3 = v9[m - 32]; a1[m - 32] = v3 + times38(v9[m]); } a1[31] = v9[31]; reduce_mul(a1); return __readfsqword(0x28u) ^ v10; }
openssh-portable
ida
static int docd(const char *dest, int flags) { const char *dir = 0; int err; ; ({ suppressint++; ({ __asm__ __volatile__("" : : : "memory"); }); 0; }); if (!(flags & 1)) { dir = updatepwd(dest); if (dir) dest = dir; } err = chdir(dest); if (err) goto out; setpwd(dir, 1); hashcd(); out: ({ ({ __asm__ __volatile__("" : : : "memory"); }); if (--suppressint == 0 && intpending) onint(); 0; }); return err; }
int docd(char *a0, unsigned long a1, unsigned long long a2, unsigned long long a3, unsigned long long a4, unsigned long long a5) { void *v0; unsigned int v1; void *v2; v0 = a0; v2 = 0; suppressint = suppressint + 1; if (!(a1 & 1)) { v2 = updatepwd(v0); if (v2) v0 = v2; } v1 = chdir(v0); if (!v1) { setpwd(v2, 0x1); hashcd(a0, 0x1, a2, a3, a4, a5); } suppressint = suppressint - 1; if (!suppressint && intpending) onint(); return v1; }
dash-0.5.11+git20210903+057cd650a4ed
angr_dream
static int vrf_configure_cgroup(const char *path, int ifindex) { int rc = -1, cg_fd, prog_fd = -1; cg_fd = open(path, 0200000 | 00); if (cg_fd < 0) { fprintf(stderr, "Failed to open cgroup path: '%s'\n", strerror((*__errno_location()))); goto out; } prog_fd = prog_load(ifindex); if (prog_fd < 0) { fprintf(stderr, "Failed to load BPF prog: '%s'\n%s", strerror((*__errno_location())), bpf_log_buf); if ((*__errno_location()) != 1) { fprintf(stderr, "Kernel compiled with CGROUP_BPF enabled?\n"); } goto out; } if (bpf_program_attach(prog_fd, cg_fd, BPF_CGROUP_INET_SOCK_CREATE)) { fprintf(stderr, "Failed to attach prog to cgroup: '%s'\n", strerror((*__errno_location()))); goto out; } rc = 0; out: close(cg_fd); close(prog_fd); return rc; }
long vrf_configure_cgroup(const char *a1, int a2) { int *v2; char *v3; int *v4; char *v5; int *v6; char *v7; unsigned int v9; int v10; int fd; v9 = -1; v10 = -1; fd = open64(a1, (int)&unk_10000); if (fd >= 0) { v10 = prog_load(a2); if (v10 >= 0) { if ((unsigned int)bpf_program_attach((unsigned int)v10, (unsigned int)fd, 2LL)) { v6 = _errno_location(); v7 = strerror(*v6); fprintf(stderr, "Failed to attach prog to cgroup: '%s'\n", v7); } else { v9 = 0; } } else { v4 = _errno_location(); v5 = strerror(*v4); fprintf(stderr, "Failed to load BPF prog: '%s'\n%s", v5, bpf_log_buf); if (*_errno_location() != 1) fprintf(stderr, "Kernel compiled with CGROUP_BPF enabled?\n"); } } else { v2 = _errno_location(); v3 = strerror(*v2); fprintf(stderr, "Failed to open cgroup path: '%s'\n", v3); } close(fd); close(v10); return v9; }
iproute2-6.0.0
ida
static void string_to_chars(char const *str, char *p, size_t s) { tar_copy_str(p, str, s); p[s - 1] = '\0'; }
void string_to_chars(undefined8 param_1, long param_2, long param_3) { tar_copy_str(param_2, param_1, param_3); *(undefined *)(param_2 + param_3 + -1) = 0; return; }
tar
ghidra
void pubkey_info(gnutls_x509_crt_t crt, common_info_st *cinfo) { gnutls_pubkey_t pubkey; pubkey = find_pubkey(crt, cinfo); if (pubkey == 0) { fprintf(stderr, "find public key error\n"); app_exit(1); } print_pubkey_info(pubkey, outfile, full_format, outcert_format, cinfo->outtext); gnutls_pubkey_deinit(pubkey); }
void pubkey_info(unsigned long long a0, struct_0 *a1) { unsigned long long v0; unsigned long long v2; v0 = find_pubkey(a0, a1); if (v0) { print_pubkey_info(v0, outfile, full_format, outcert_format, a1->field_24); v2 = gnutls_pubkey_deinit(v0); return; } fprintf(stderr, "find public key error\n"); app_exit(0x1); }
gnutls
angr_sailr
static void netns_map_del(struct nsid_cache *c) { hlist_del(&c->name_hash); hlist_del(&c->nsid_hash); free(c); }
void netns_map_del(void *a0) { unsigned long long v1; hlist_del(a0 + 16); hlist_del(a0); v1 = free(a0); return; }
iproute2-6.0.0
angr_phoenix
static int statoverride_add(const char *const *argv) { const char *user = argv[0]; const char *group = argv[1]; const char *mode = argv[2]; const char *path = argv[3]; char *filename; struct file_stat **filestat; if (!user || !group || !mode || !path || argv[4]) badusage(gettext("--%s needs four arguments"), cipaction->olong); if (strchr(path, '\n')) badusage(gettext("path may not contain newlines")); filename = path_cleanup(path); filestat = statdb_node_find(filename); if (*filestat != ((void *)0)) { if (in_force(FORCE_STATOVERRIDE_ADD)) warning(gettext("an override for '%s' already exists, " "but --force specified so will be ignored"), filename); else ohshit(gettext("an override for '%s' already exists; " "aborting"), filename); } *filestat = statdb_node_new(user, group, mode); if (opt_update) { struct stat st; struct varbuf realfilename = {0, 0, ((void *)0)}; varbuf_add_buf(&realfilename, instdir, strlen(instdir)); varbuf_add_buf(&realfilename, filename, strlen(filename)); varbuf_end_str(&realfilename); if (stat(realfilename.buf, &st) == 0) { (*filestat)->mode |= st.st_mode & 0170000; statdb_node_apply(realfilename.buf, *filestat); } else if (opt_verbose) { warning(gettext("--update given but %s does not exist"), realfilename.buf); } varbuf_destroy(&realfilename); } statdb_write(); free(filename); return 0; }
long long statoverride_add(unsigned long long a0[5], unsigned int a1, unsigned long a2, unsigned long long a3, unsigned long long a4, unsigned long long a5) { unsigned long long v0; unsigned long long v1; unsigned long long v2; char *v3; void *v4; struct struct_0 **v5; void *v6; void *v7; void *v8; char v9; char v10; unsigned long long v12; v0 = a0[0]; v1 = a0[1]; v2 = a0[2]; v3 = a0[3]; if (!v0 || !v1 || !v2 || !v3 || a0[4]) badusage(gettext("--%s needs four arguments"), *(cipaction)); a1 = 10; if (strchr(v3, 0xa)) badusage(gettext("path may not contain newlines"), a1); v4 = path_cleanup(v3); v5 = statdb_node_find(v4); if (*(v5)) { if (in_force(0x1000000)) { warning(gettext("an override for '%s' already exists, but --force " "specified so will be ignored")); } else { v12 = gettext("an override for '%s' already exists; aborting"); ohshit(v12, v4, v12); } } *(v5) = statdb_node_new(v0, v1, v2); if (opt_update) { v6 = 0; v7 = 0; v8 = 0; varbuf_add_buf(&v6, 0x7d894818ec834853, strlen(0x7d894818ec834853), 0x7d894818ec834853); varbuf_add_buf(&v6, v4, strlen(v4), v4); varbuf_end_str(&v6); if (!stat(v8, &v9)) { *(v5)->field_8 = *(v5)->field_8 | *(&v10) & 0xf000; statdb_node_apply(v8, *(v5), *(v5), *(&v10) & 0xf000, a4, a5); } else if (opt_verbose) { warning(gettext("--update given but %s does not exist")); } varbuf_destroy(&v6); } statdb_write(a0, a1, v5, a3, a4, a5); free(v4); return 0; }
dpkg
angr_sailr
cron_db database(int installed, char **additional) { cron_db db = {((void *)0), ((void *)0), (time_t)0}; struct passwd pw; int fd; struct stat ss; user *u; if (installed) load_database(&db); for (; *additional != ((void *)0); additional++) { fd = open(*additional, 00); if (fd == -1) { perror(*additional); continue; } fstat(fd, &ss); if (((((ss.st_mode)) & 0170000) == (0040000))) { fprintf(stderr, "%s is a directory - skipping\n", *additional); close(fd); continue; } memset(&pw, 0, sizeof(pw)); pw.pw_name = *additional; pw.pw_passwd = ""; pw.pw_dir = "."; u = load_user(fd, &pw, *additional, *additional, *additional); if (u == ((void *)0)) { printf("cannot load crontab %s\n", *additional); continue; } link_user(&db, u); } return db; }
void database(unsigned long long a0[3], unsigned long a1, unsigned long a2) { unsigned long long *v0; unsigned int v1; unsigned long long v2; void *v3; void *v4; void *v5; unsigned long v6; unsigned long long v7; unsigned long long v8; char v9; char v10; unsigned long long v12[3]; v0 = a2; v3 = 0; v4 = 0; v5 = 0; if (a1) load_database(&v3); for (; *(v0); v0 += 1) { v1 = open(*(v0), 0x0, *(v0)); if (v1 == -1) { perror(*(v0)); } else { fstat(v1, &v9); if ((*(&v10) & 0xf000) == 0x4000) { fprintf(stderr, "%s is a directory - skipping\n", *(v0)); close(v1); } else { memset(&v6, 0x0, 0x30); v6 = *(v0); v7 = &g_401244; v8 = "."; v2 = load_user(v1, &v6, *(v0), *(v0), *(v0)); if (!v2) printf("cannot load crontab %s\n", *(v0)); else link_user(&v3, v2, v2); } } } a0[0] = v3; a0[1] = v4; a0[2] = v5; v12 = a0; return; }
cronie
angr_dream
static void tarobject_hash(struct tarcontext *tc, struct tar_entry *te, struct fsys_namenode *namenode) { if (te->type == TAR_FILETYPE_FILE) { struct dpkg_error err; char fnamebuf[256]; char *newhash; newhash = nfmalloc(32 + 1); if (buffer_copy_IntPtr(tc->backendpipe, 0, newhash, 5, ((void *)0), 3, te->size, &err) < 0) ohshit(gettext("cannot compute MD5 hash for tar file '%.255s': %s"), path_quote_filename(fnamebuf, te->name, 256), err.str); tarobject_skip_padding(tc, te); namenode->newhash = newhash; debug(dbg_eachfiledetail, "tarobject file hash=%s", namenode->newhash); } else if (te->type == TAR_FILETYPE_HARDLINK) { struct fsys_namenode *linknode; linknode = fsys_hash_find_node(te->linkname, 0); namenode->newhash = linknode->newhash; debug(dbg_eachfiledetail, "tarobject hardlink hash=%s", namenode->newhash); } }
void tarobject_hash(unsigned int *a0, struct_0 *a1, struct_1 *a2, unsigned long long a3) { unsigned long v0; struct_1 *v1; unsigned long long v2; char v3; char v4; char v5; char v6; unsigned long long *v9; unsigned long long v10; switch (a1->field_4) { case 48: v2 = nfmalloc(0x21); v0 = &v3; if (buffer_copy_IntPtr(*(a0), 0x0, v2, 0x5, 0x0, 0x3, a1->field_18) < 0) ohshit(gettext("cannot compute MD5 hash for tar file '%.255s': %s"), path_quote_filename(&v5, a1->field_8, 0x100, a1->field_8), *(&v4)); tarobject_skip_padding(a0, a1); a2->field_40 = v2; debug(0x40, "tarobject file hash=%s", a2->field_40, a3); break; case 49: v1 = fsys_hash_find_node(a1->field_10, 0x0); a2->field_40 = v1->field_40; debug(0x40, "tarobject hardlink hash=%s", a2->field_40, a3); default: goto LABEL_401408; } LABEL_401408: v10 = *(&v6) ^ v9[5]; return; }
dpkg
angr_sailr
static void can_print_xstats(struct link_util *lu, FILE *f, struct rtattr *xstats) { struct can_device_stats *stats; if (xstats && ((int)((xstats)->rta_len) - ((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0))) == sizeof(*stats)) { stats = ((void *)(((char *)(xstats)) + ((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0)))); can_print_nl_indent(); print_string( PRINT_FP, ((void *)0), "%s", " re-started bus-errors arbit-lost error-warn error-pass bus-off"); can_print_nl_indent(); print_uint(PRINT_ANY, "restarts", " %-10u", stats->restarts); print_uint(PRINT_ANY, "bus_error", " %-10u", stats->bus_error); print_uint(PRINT_ANY, "arbitration_lost", " %-10u", stats->arbitration_lost); print_uint(PRINT_ANY, "error_warning", " %-10u", stats->error_warning); print_uint(PRINT_ANY, "error_passive", " %-10u", stats->error_passive); print_uint(PRINT_ANY, "bus_off", " %-10u", stats->bus_off); } }
long long can_print_xstats(unsigned long a0, unsigned long a1, unsigned short *a2) { unsigned long v0; unsigned long v1; unsigned int v2[6]; unsigned long long v4; v1 = a0; v0 = a1; if (a2) { v4 = *(a2); if (*(a2) == 28) { *(&v2[0]) = a2 + 2; can_print_nl_indent(); print_string( 0x1, 0x0, "%s", " re-started bus-errors arbit-lost error-warn error-pass bus-off"); can_print_nl_indent(); print_uint(0x4, "restarts", " %-10u", v2[5]); print_uint(0x4, "bus_error", " %-10u", v2[0]); print_uint(0x4, "arbitration_lost", " %-10u", v2[4]); print_uint(0x4, "error_warning", " %-10u", v2[1]); print_uint(0x4, "error_passive", " %-10u", v2[2]); v4 = print_uint(0x4, "bus_off", " %-10u", v2[3]); } } return v4; }
iproute2-6.0.0
angr_phoenix
static void put_word(WORD *w) { char const *s; int n; s = w->text; for (n = w->length; n != 0; n--) putchar_unlocked(*s++); out_column += w->length; }
void put_word(struct_0 *a0) { unsigned int v0; int tmp_8; char *v1; unsigned long long v4; v1 = a0->field_0; for (v0 = a0->field_8; v0; v0 -= 1) { tmp_8 = v1; v1 += 1; putchar_unlocked(*(tmp_8)); } v4 = out_column + a0->field_8; out_column = out_column + a0->field_8; return; }
coreutils
angr_sailr
SHELL_VAR *find_shell_variable(name) const char *name; { SHELL_VAR *var; var = var_lookup(name, shell_variables); if (var && ((((var)->attributes) & (0x0000800)))) var = find_variable_nameref(var); if (var == 0) return ((SHELL_VAR *)((void *)0)); return (var->dynamic_value ? (*(var->dynamic_value))(var) : var); }
long find_shell_variable(long a1) { long variable_nameref; variable_nameref = var_lookup(a1, shell_variables); if (variable_nameref && (*(_DWORD *)(variable_nameref + 40) & 0x800) != 0) variable_nameref = (long)find_variable_nameref((long *)variable_nameref); if (!variable_nameref) return 0LL; if (*(_QWORD *)(variable_nameref + 24)) return (*(long (**)(long))(variable_nameref + 24))(variable_nameref); return variable_nameref; }
bash
ida
static void got_alarm(int k) { alrm = 1; }
long long got_alarm(unsigned long a0) { unsigned int v0; unsigned long v2; v0 = a0; alrm = 1; return v2; }
gnutls
angr_phoenix
static void ZDecrypt(Inputs r, const unsigned char *C, const unsigned char *sk) { small f[761], v[761]; Fq c[761]; Small_decode(f, sk); sk += ((761 + 3) / 4); Small_decode(v, sk); Rounded_decode(c, C); Decrypt(r, c, f, v); }
void ZDecrypt(char *a0, unsigned long long a1, unsigned int a2) { unsigned int v0; char v1; char v2; char v3; char v4; unsigned long long *v6; unsigned long long v7; v0 = a2; Small_decode(&v2, *(&v0)); *(&v0) = *(&v0) + 191; Small_decode(&v3, *(&v0)); Rounded_decode(&v1, a1, a1); Decrypt(a0, &v1, &v2, &v3); v7 = *(&v4) ^ v6[5]; return; }
openssh-portable
angr_dream
static char *list_transform(xc, v, list, itype, quoted) int xc; SHELL_VAR *v; WORD_LIST *list; int itype, quoted; { WORD_LIST *new, *l; WORD_DESC *w; char *tword; int qflags; for (new = (WORD_LIST *)((void *)0), l = list; l; l = l->next) { tword = string_transform(xc, v, l->word->word); w = alloc_word_desc(); w->word = tword ? tword : (char *)strcpy( sh_xmalloc((1 + strlen("")), "subst.c", 8511), ("")); new = make_word_list(w, new); } l = ((new && new->next) ? (WORD_LIST *)list_reverse((GENERIC_LIST *)new) : (WORD_LIST *)(new)); qflags = quoted; if (itype == '*' && expand_no_split_dollar_star && ifs_is_null) qflags |= 0x001; tword = string_list_pos_params(itype, l, qflags, 0); dispose_words(l); return (tword); }
int list_transform(unsigned long a0, unsigned long long a1, unsigned long a2, unsigned long a3, unsigned long long a4, unsigned long long a5) { unsigned int v0; void *v1; struct_0 *v2; unsigned long v3; unsigned long long *v4; unsigned long long v6; void *v7; v1 = 0; for (v2 = a2; v2; v2 = v2->field_0) { v3 = string_transform(a0, a1, v2->field_8->field_0); v4 = alloc_word_desc(); if (v3) v6 = v3; else v6 = strcpy(sh_xmalloc(strlen(&g_41fa65) + 1, "subst.c", 0x213f), &g_41fa65); *(v4) = v6; v1 = make_word_list(v4, v1, v1); } if (v1 && *(v1)) { v7 = list_reverse(v1); goto LABEL_4142bf; } v7 = v1; LABEL_4142bf: v2 = v7; v0 = a4; if (a3 == 42 && expand_no_split_dollar_star) v0 |= 1; v3 = string_list_pos_params(a3, v2, v0, 0x0, a4, a5); dispose_words(v2); return v3; }
bash
angr_phoenix
int rl_exchange_point_and_mark(int count, int key) { if (rl_mark > rl_end) rl_mark = -1; if (rl_mark < 0) { rl_ding(); rl_mark = 0; return 1; } else { do { int t; t = rl_point; rl_point = rl_mark; rl_mark = t; } while (0); rl_activate_mark(); } return 0; }
long long rl_exchange_point_and_mark(unsigned long a0, unsigned long a1) { unsigned int v0; unsigned int v1; unsigned int v2; unsigned long long v4; v1 = a0; v0 = a1; if (rl_mark > rl_end) rl_mark = -1; if (rl_mark < 0) { rl_ding(); rl_mark = 0; v4 = 1; } else { v2 = rl_point; rl_point = rl_mark; rl_mark = v2; rl_activate_mark(); v4 = 0; } return v4; }
bash
angr_dream
void test_dict_inflate(compr, comprLen, uncompr, uncomprLen) Byte *compr, *uncompr; uLong comprLen, uncomprLen; { int err; z_stream d_stream; strcpy((char *)uncompr, "garbage"); d_stream.zalloc = zalloc; d_stream.zfree = zfree; d_stream.opaque = (voidpf)0; d_stream.next_in = compr; d_stream.avail_in = (uInt)comprLen; err = inflateInit_((&d_stream), "1.2.13", (int)sizeof(z_stream)); { if (err != 0) { fprintf(stderr, "%s error: %d\n", "inflateInit", err); exit(1); } }; d_stream.next_out = uncompr; d_stream.avail_out = (uInt)uncomprLen; for (;;) { err = inflate(&d_stream, 0); if (err == 1) break; if (err == 2) { if (d_stream.adler != dictId) { fprintf(stderr, "unexpected dictionary"); exit(1); } err = inflateSetDictionary(&d_stream, (const Bytef *)dictionary, (int)sizeof(dictionary)); } { if (err != 0) { fprintf(stderr, "%s error: %d\n", "inflate with dict", err); exit(1); } }; } err = inflateEnd(&d_stream); { if (err != 0) { fprintf(stderr, "%s error: %d\n", "inflateEnd", err); exit(1); } }; if (strcmp((char *)uncompr, hello)) { fprintf(stderr, "bad inflate with dict\n"); exit(1); } else { printf("inflate with dictionary: %s\n", (char *)uncompr); } }
void test_dict_inflate(unsigned long a0, unsigned long a1, char *a2, unsigned long a3) { unsigned int v0; unsigned long v1; unsigned int v2; unsigned long v3; unsigned int v4; unsigned long v5; unsigned long v6; void *v7; char v8; char v9; unsigned long long *v11; unsigned long long v12; strcpy(a2, "garbage"); v5 = zalloc; v6 = zfree; v7 = 0; v1 = a0; v2 = a1; v0 = inflateInit_(&v1, "1.2.13", 0x70); if (v0) { fprintf(*(&stderr), "%s error: %d\n", &g_401c20, v0); exit(0x1); } v3 = a2; v4 = a3; while (true) { v0 = inflate(&v1, 0x0); if (v0 == 1) break; if (v0 == 2) { if (*(&v8) != dictId) { fprintf(*(&stderr), "unexpected dictionary"); exit(0x1); } v0 = inflateSetDictionary(&v1, "hello", 0x6); } if (v0) { fprintf(*(&stderr), "%s error: %d\n", &g_401d4b, v0); exit(0x1); } } v0 = inflateEnd(&v1); if (v0) { fprintf(*(&stderr), "%s error: %d\n", &g_401c34, v0); exit(0x1); } else if (strcmp(a2, "hello,")) { fprintf(*(&stderr), "bad inflate with dict\n"); exit(0x1); } else { printf("inflate with dictionary: %s\n", a2); v12 = *(&v9) ^ v11[5]; return; } }
zlib
angr_phoenix
STRINGLIST *strlist_create(n) int n; { STRINGLIST *ret; register int i; ret = (STRINGLIST *)sh_xmalloc((sizeof(STRINGLIST)), "stringlist.c", 46); if (n) { ret->list = strvec_create(n + 1); ret->list_size = n; for (i = 0; i < n; i++) ret->list[i] = (char *)((void *)0); } else { ret->list = (char **)((void *)0); ret->list_size = 0; } ret->list_len = 0; return ret; }
int strlist_create(unsigned long a0) { struct_0 *v0; void *v2; v0 = sh_xmalloc(0x10, "stringlist.c", 0x2e); if (!a0) { v0->field_0 = 0; v0->field_8 = 0; } else { v0->field_0 = strvec_create(a0 + 1); v0->field_8 = a0; for (v2 = 0; v2 < a0; v2 = v2 + 1) { *((&v0->field_0->field_0 + 0x8 * v2)) = 0; } } v0->field_c = 0; return v0; }
bash
angr_phoenix
__inline static const char * pgettext_aux(const char *domain, const char *msg_ctxt_id, const char *msgid, int category) { const char *translation = dcgettext(domain, msg_ctxt_id, category); if (translation == msg_ctxt_id) return msgid; else return translation; }
int pgettext_aux(char *a0, char *a1, unsigned long a2, unsigned long a3) { unsigned long v0; v0 = dcgettext(a0, a1, a3); return (v0 == a1 ? v0 : a2); }
dpkg
angr_sailr
static void specify_nmerge(int oi, char c, char const *s) { uintmax_t n; struct rlimit rlimit; enum strtol_error e = xstrtoumax(s, ((void *)0), 10, &n, ""); unsigned int max_nmerge = ((getrlimit(RLIMIT_NOFILE, &rlimit) == 0 ? rlimit.rlim_cur : 20) - 3); if (e == LONGINT_OK) { nmerge = n; if (nmerge != n) e = LONGINT_OVERFLOW; else { if (nmerge < 2) { error(0, 0, gettext("invalid --%s argument %s"), long_options[oi].name, quote(s)); ((!!sizeof(struct { _Static_assert( SORT_FAILURE, "verify_expr (" "SORT_FAILURE" ", " "(error (SORT_FAILURE, 0, gettext (\"minimum --%s argument is " "%s\"), long_options[oi].name, quote (\"2\")), assume (false))" ")"); int _gl_dummy; })) ? ((error(SORT_FAILURE, 0, gettext("minimum --%s argument is %s"), long_options[oi].name, quote("2")), ((0) ? (void)0 : __builtin_unreachable()))) : ((error(SORT_FAILURE, 0, gettext("minimum --%s argument is %s"), long_options[oi].name, quote("2")), ((0) ? (void)0 : __builtin_unreachable())))) ; } else if (max_nmerge < nmerge) { e = LONGINT_OVERFLOW; } else return; } } if (e == LONGINT_OVERFLOW) { char max_nmerge_buf[( (((((sizeof(max_nmerge) * 8) - (!((__typeof__(max_nmerge))0 < (__typeof__(max_nmerge))-1))) * 146 + 484) / 485) + (!((__typeof__(max_nmerge))0 < (__typeof__(max_nmerge))-1))) + 1)]; error(0, 0, gettext("--%s argument %s too large"), long_options[oi].name, quote(s)); ((!!sizeof(struct { _Static_assert( SORT_FAILURE, "verify_expr (" "SORT_FAILURE" ", " "(error (SORT_FAILURE, 0, gettext (\"maximum --%s argument with " "current rlimit is %s\"), long_options[oi].name, uinttostr " "(max_nmerge, max_nmerge_buf)), assume (false))" ")"); int _gl_dummy; })) ? ((error(SORT_FAILURE, 0, gettext("maximum --%s argument with current rlimit is %s"), long_options[oi].name, uinttostr(max_nmerge, max_nmerge_buf)), ((0) ? (void)0 : __builtin_unreachable()))) : ((error(SORT_FAILURE, 0, gettext("maximum --%s argument with current rlimit is %s"), long_options[oi].name, uinttostr(max_nmerge, max_nmerge_buf)), ((0) ? (void)0 : __builtin_unreachable())))) ; } else xstrtol_fatal(e, oi, c, long_options, s); }
void specify_nmerge(int param_1, char param_2, undefined8 param_3) { undefined8 uVar1; int iVar2; uint uVar3; undefined8 uVar4; undefined8 uVar5; long in_FS_OFFSET; int local_58; ulong local_50; int local_48; long local_20; local_20 = *(long *)(in_FS_OFFSET + 0x28); local_58 = xstrtoumax(param_3, 0, 10, &local_50, &DAT_0010bb5b); iVar2 = getrlimit(RLIMIT_NOFILE, (rlimit *)&local_48); if (iVar2 == 0) { uVar3 = local_48 - 3; } else { uVar3 = 0x11; } if (local_58 == 0) { nmerge = (uint)local_50; if ((local_50 & 0xffffffff) == local_50) { if (nmerge < 2) { uVar4 = quote(param_3); uVar1 = *(undefined8 *)(long_options + (long)param_1 * 0x20); uVar5 = gettext("invalid --%s argument %s"); error(0, 0, uVar5, uVar1, uVar4); } if (nmerge <= uVar3) goto code_r0x00101cfe; local_58 = 1; } else { local_58 = 1; } } if (local_58 == 1) { uVar4 = quote(param_3); uVar1 = *(undefined8 *)(long_options + (long)param_1 * 0x20); uVar5 = gettext("--%s argument %s too large"); error(0, 0, uVar5, uVar1, uVar4); } xstrtol_fatal(local_58, param_1, (int)param_2, long_options, param_3); code_r0x00101cfe: if (local_20 != *(long *)(in_FS_OFFSET + 0x28)) { __stack_chk_fail(); } return; }
coreutils
ghidra
void print_key_material(gnutls_session_t session, const char *label, size_t size) { gnutls_datum_t bin = {((void *)0), 0}, hex = {((void *)0), 0}; int ret; bin.data = gnutls_malloc(size); if (!bin.data) { fprintf(stderr, "Error in gnutls_malloc: %s\n", gnutls_strerror(-25)); goto out; } bin.size = size; ret = gnutls_prf_rfc5705(session, strlen(label), label, 0, ((void *)0), size, (char *)bin.data); if (ret < 0) { fprintf(stderr, "Error in gnutls_prf_rfc5705: %s\n", gnutls_strerror(ret)); goto out; } ret = gnutls_hex_encode2(&bin, &hex); if (ret < 0) { fprintf(stderr, "Error in hex encoding: %s\n", gnutls_strerror(ret)); goto out; } log_msg(stdout, "- Key material: %s\n", hex.data); fflush(stdout); out: gnutls_free((void *)(bin.data)), bin.data = ((void *)0); gnutls_free((void *)(hex.data)), hex.data = ((void *)0); }
long long print_key_material(unsigned long long a0, char *a1, unsigned long long a2) { unsigned long v0; unsigned int v1; void *v2; unsigned int v3; void *v4; unsigned int v5; v2 = 0; v3 = 0; v4 = 0; v5 = 0; v2 = *(5243160)(a2); if (!v2) { fprintf(*(&stderr), "Error in gnutls_malloc: %s\n", gnutls_strerror(0xffffffe7)); } else { v3 = a2; v0 = v2; v1 = gnutls_prf_rfc5705(a0, strlen(a1), a1, 0x0, 0x0, a2); if (v1 < 0) { fprintf(*(&stderr), "Error in gnutls_prf_rfc5705: %s\n", gnutls_strerror(v1)); } else { v1 = gnutls_hex_encode2(&v2, &v4, &v4); if (v1 < 0) { fprintf(*(&stderr), "Error in hex encoding: %s\n", gnutls_strerror(v1)); } else { log_msg(); fflush(stdout); } } } *(5242960)(v2); v2 = 0; *(5242960)(v4); v4 = 0; return 0; }
gnutls
angr_dream
int el_cursor(EditLine *el, int n) { if (n == 0) goto out; el->el_line.cursor += n; if (el->el_line.cursor < el->el_line.buffer) el->el_line.cursor = el->el_line.buffer; if (el->el_line.cursor > el->el_line.lastchar) el->el_line.cursor = el->el_line.lastchar; out: return (int)(el->el_line.cursor - el->el_line.buffer); }
long long el_cursor(unsigned long long a0[13], unsigned long a1) { if (a1) { a0[11] = a1 * 4 + a0[11]; if (a0[11] < a0[10]) a0[11] = a0[10]; if (a0[11] > a0[12]) a0[11] = a0[12]; } return a0[11] - a0[10] >> 2; }
libedit
angr_phoenix
void write_longdocs(stream, builtins) FILE *stream; ARRAY *builtins; { register int i; register BUILTIN_DESC *builtin; char *dname; char *sarray[2]; for (i = 0; i < builtins->sindex; i++) { builtin = (BUILTIN_DESC *)builtins->array[i]; if (builtin->dependencies) write_ifdefs(stream, builtin->dependencies->array); dname = ((builtin)->docname ? (builtin)->docname : (builtin)->name); fprintf(stream, "char * const %s_doc[] =", dname); if (separate_helpfiles) { int l = strlen(helpfile_directory) + strlen(dname) + 1; sarray[0] = (char *)xmalloc(l + 1); sprintf(sarray[0], "%s/%s", helpfile_directory, dname); sarray[1] = (char *)((void *)0); write_documentation(stream, sarray, 0, 0x01 | 0x08); free(sarray[0]); } else write_documentation(stream, builtin->longdoc->array, 0, 0x01); if (builtin->dependencies) write_endifs(stream, builtin->dependencies->array); } }
void write_longdocs(void *a0, struct_1 *a1) { unsigned int v0; char *v1; void *v2; void *v3; char v4; void *v6; struct_3 *v7; char *v8; unsigned long long *v9; unsigned long long v10; for (v6 = 0; v6 < a1->field_4; v6 = v6 + 1) { v7 = *((&a1->field_10->field_0 + 0x8 * v6)); if (*((*((&a1->field_10->field_0 + 0x8 * v6)) + 40))) write_ifdefs(a0, *((*((*((&a1->field_10->field_0 + 0x8 * v6)) + 40)) + 16))); if (v7->field_18) v8 = v7->field_18; else v8 = v7->field_0; v1 = v8; fprintf(a0, "char * const %s_doc[] =", v1); if (separate_helpfiles) { v0 = (strlen(v1) + strlen(0xbc7d8948ec834853)) + 1; v2 = xmalloc(v0 + 1); sprintf(v2, "%s/%s", 3968026707, v1); v3 = 0; write_documentation(a0, &v2, 0x0, 0x9); free(v2); } else { write_documentation(a0, v7->field_20->field_10, 0x0, 0x1); } if (v7->field_28) write_endifs(a0, v7->field_28->field_10); } v10 = *(&v4) ^ v9[5]; return; }
bash
angr_dream
static void oct_to_env(char const *envar, unsigned long num) { char buf[1 + 1 + (sizeof(unsigned long) * 8 + 2) / 3]; snprintf(buf, sizeof buf, "0%lo", num); if (setenv(envar, buf, 1) != 0) xalloc_die(); }
void oct_to_env(char *a0, unsigned long a1) { char v0; char v1; unsigned long long *v4; unsigned long long v5; snprintf(&v0, 0x18, "0%lo", a1); if (setenv(a0, &v0, 0x1)) xalloc_die(); v5 = *(&v1) ^ v4[5]; return; }
tar
angr_dream
char *make_command_string(command) COMMAND *command; { command_string_index = was_heredoc = 0; deferred_heredocs = 0; make_command_string_internal(command); return (the_printed_command); }
int make_command_string(unsigned long long a0) { was_heredoc = 0; command_string_index = was_heredoc; deferred_heredocs = 0; make_command_string_internal(a0); return the_printed_command; }
bash
angr_dream
static int depmod_load_symvers(struct depmod *depmod, const char *filename) { char line[10240]; FILE *fp; unsigned int linenum = 0; fp = fopen(filename, "r"); if (fp == ((void *)0)) { int err = -(*__errno_location()); log_printf(7, "load symvers: %s: %m\n", filename); return err; } log_printf(7, "load symvers: %s\n", filename); while (fgets(line, sizeof(line), fp) != ((void *)0)) { const char *ver, *sym, *where; char *verend; uint64_t crc; linenum++; ver = strtok(line, " \t"); sym = strtok(((void *)0), " \t"); where = strtok(((void *)0), " \t"); if (!ver || !sym || !where) continue; if (!(strcmp((where), ("vmlinux")) == 0)) continue; crc = strtoull(ver, &verend, 16); if (verend[0] != '\0') { log_printf(3, "%s:%u Invalid symbol version %s: %m\n", filename, linenum, ver); continue; } depmod_symbol_add(depmod, sym, 0, crc, ((void *)0)); } depmod_add_fake_syms(depmod); log_printf(7, "loaded symvers: %s\n", filename); fclose(fp); return 0; }
int depmod_load_symvers(void *a0, char *a1, unsigned long a2, unsigned long long a3, unsigned long long a4) { unsigned int v0; unsigned int v1; char v2; void *v3; char *v4; void *v5; char *v6; unsigned int v7; char v8; unsigned long long v9; char v10; unsigned int v12; v10 = *(&v10); v9 = *(&v9); v0 = 0; v3 = fopen(a1, "r"); if (!v3) { v1 = -(*(__errno_location())); log_printf(0x7, "load symvers: %s: %m\n", a1, a3, a4); v12 = v1; } else { log_printf(0x7, "load symvers: %s\n", a1, a3, a4); while (true) { if (!fgets(&v8, 0x2800, v3)) { depmod_add_fake_syms(a0); log_printf(0x7, "loaded symvers: %s\n", a1, a3, a4); fclose(v3); v12 = 0; break; } v0 += 1; v4 = strtok(&v8, " \t"); v5 = strtok(NULL, " \t"); v6 = strtok(NULL, " \t"); if (!v4) { LABEL_40843f: } else { if (!v5) goto LABEL_40843f; if (!v6) goto LABEL_40843f; if (!strcmp(v6, "vmlinux")) { *(&v7) = strtoull(v4, &v2, 0x10); if (!*(*(&v2))) depmod_symbol_add(a0, v5, 0x0, *(&v7), 0x0); else log_printf(0x3, "%s:%u Invalid symbol version %s: %m\n", a1, v0, v4); } } } } return v12; }
kmod
angr_phoenix
time_t cronnext(cron_db database, time_t start, time_t end, char *include, char *exclude, char *command, int flags) { time_t closest, next; user *u; entry *e; char *indent = ""; if (flags & 0x02) { printf("crontabs:\n"); indent = " "; } else if (flags & 0x08) printf("jobs:\n"); closest = -1; for (u = database.head; u; u = u->next) { if (include && !matchuser(u->name, include)) continue; if (exclude && matchuser(u->name, exclude)) continue; if (!(flags & 0x04) && u->system) continue; if (flags & 0x02) printcrontab(u); for (e = u->crontab; e; e = e->next) { if (command && strstr(e->cmd, command) == ((void *)0)) continue; for (next = nextmatch(e, start, end); next <= end; next = nextmatch(e, next + 60, end)) { if (next < 0) break; if (closest < 0 || next < closest) closest = next; if (flags & 0x01) printentry(indent, e, next); if (!(flags & 0x08)) break; } } } return closest; }
long cronnext(undefined8 param_1, long param_2, long param_3, long param_4, char *param_5, uint param_6, undefined8 *param_7) { int iVar1; char *pcVar2; long local_30; long local_28; undefined8 *local_20; undefined8 *local_18; undefined *local_10; local_10 = &DAT_00101244; if ((param_6 & 2) == 0) { if ((param_6 & 8) != 0) { printf("jobs:\n"); } } else { printf("crontabs:\n"); local_10 = &DAT_00101250; } local_30 = -1; local_20 = param_7; do { if (local_20 == (undefined8 *)0x0) { return local_30; } if ((((param_3 == 0) || (iVar1 = matchuser(local_20[2], param_3), iVar1 != 0)) && ((param_4 == 0 || (iVar1 = matchuser(local_20[2], param_4), iVar1 == 0)))) && (((param_6 & 4) != 0 || (*(int *)((long)local_20 + 0x34) == 0)))) { if ((param_6 & 2) != 0) { printcrontab(local_20); } for (local_18 = (undefined8 *)local_20[5]; local_18 != (undefined8 *)0x0; local_18 = (undefined8 *)*local_18) { if ((param_5 == (char *)0x0) || (pcVar2 = strstr((char *)local_18[3], param_5), pcVar2 != (char *)0x0)) { for (local_28 = nextmatch(local_18, param_1, param_2); (local_28 <= param_2 && (-1 < local_28)); local_28 = nextmatch(local_18, local_28 + 0x3c, param_2)) { if ((local_30 < 0) || (local_28 < local_30)) { local_30 = local_28; } if ((param_6 & 1) != 0) { printentry(local_10, local_18, local_28); } if ((param_6 & 8) == 0) break; } } } } local_20 = (undefined8 *)*local_20; } while (true); }
cronie
ghidra
static int hostspec_is_complex(const char *hosts) { char *cp; if (strchr(hosts, '*') != ((void *)0) || strchr(hosts, '?') != ((void *)0)) return 1; if ((cp = strchr(hosts, ',')) == ((void *)0)) return 0; if (strchr(cp + 1, ',') != ((void *)0)) return 1; return 0; }
int hostspec_is_complex(char *a0) { unsigned long v0; unsigned int v2; if (strchr(a0, 0x2a)) { v2 = 1; return v2; } else if (strchr(a0, 0x3f)) { v2 = 1; return v2; } else { v0 = strchr(a0, 0x2c); v2 = (!v0 ? (!strchr(v0 + 1, 0x2c) ? 1 : 0) : 0); return v2; } }
openssh-portable
angr_sailr
static int tcsh_magic_space(count, ignore) int count, ignore; { int dist_from_end, old_point; old_point = rl_point; dist_from_end = rl_end - rl_point; if (history_expand_line(count, ignore) == 0) { rl_point = (old_point == 0) ? old_point : rl_end - dist_from_end; rl_insert(1, ' '); return (0); } else return (1); }
long long tcsh_magic_space(unsigned long a0, unsigned long a1) { unsigned int v0; unsigned int v1; unsigned long long v3; unsigned int v4; v0 = rl_point; v1 = rl_end - rl_point; if (history_expand_line(a0, a1)) { v3 = 1; } else { if (!v0) v4 = v0; else v4 = rl_end - v1; rl_point = v4; rl_insert(0x1, 0x20); v3 = 0; } return v3; }
bash
angr_phoenix
void label_notfound(void) { struct name const *cursor; if (!namelist) return; for (cursor = namelist; cursor; cursor = cursor->next) if ((occurrence_option == 0 ? (cursor)->found_count != 0 : (cursor)->found_count >= occurrence_option)) return; if (verbose_option) error(0, 0, gettext("Archive label mismatch")); set_exit_status(1); for (cursor = namelist; cursor; cursor = cursor->next) { if (regex_usage_warning(cursor->name)) break; } namelist = ((void *)0); nametail = ((void *)0); if (same_order_option) { const char *name; while ((name = name_next(1)) != ((void *)0) && regex_usage_warning(name) == 0) ; } }
long long label_notfound() { unsigned long long v0[3]; unsigned long long v1; unsigned long long v3; v3 = namelist; if (namelist) { v0[0] = namelist; while (true) { if (v0) { if (!occurrence_option) { v3 = v0[6]; *(&v3) = v0[6]; } else { v3 = occurrence_option; *(&v3) = occurrence_option <= v0[6]; } if (v3) break; if (!v3) v0[0] = v0[0]; } else { if (verbose_option) error(0x0, 0x0, gettext("Archive label mismatch")); set_exit_status(0x1); for (v0[0] = namelist; v0; v0[0] = v0[0]) { if (regex_usage_warning(v0[2])) break; } namelist = 0; nametail = 0; v3 = same_order_option; if (!same_order_option) break; if (same_order_option) { while (true) { v3 = name_next(0x1); v1 = v3; if (!v1) break; v3 = regex_usage_warning(v1); if (v3) break; } } } } } return v3; }
tar
angr_dream
static int get_decode_statvfs(struct sftp_conn *conn, struct sftp_statvfs *st, u_int expected_id, int quiet) { struct sshbuf *msg; u_char type; u_int id; u_int64_t flag; int r; if ((msg = sshbuf_new()) == ((void *)0)) sshfatal("sftp-client.c", __func__, 404, 1, SYSLOG_LEVEL_FATAL, ((void *)0), "sshbuf_new failed"); get_msg(conn, msg); if ((r = sshbuf_get_u8(msg, &type)) != 0 || (r = sshbuf_get_u32(msg, &id)) != 0) sshfatal("sftp-client.c", __func__, 409, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "parse"); sshlog("sftp-client.c", __func__, 411, 0, SYSLOG_LEVEL_DEBUG3, ((void *)0), "Received statvfs reply T:%u I:%u", type, id); if (id != expected_id) sshfatal("sftp-client.c", __func__, 413, 0, SYSLOG_LEVEL_FATAL, ((void *)0), "ID mismatch (%u != %u)", id, expected_id); if (type == 101) { u_int status; if ((r = sshbuf_get_u32(msg, &status)) != 0) sshfatal("sftp-client.c", __func__, 418, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "parse status"); if (quiet) sshlog("sftp-client.c", __func__, 420, 0, SYSLOG_LEVEL_DEBUG1, ((void *)0), "remote statvfs: %s", fx2txt(status)); else sshlog("sftp-client.c", __func__, 422, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "remote statvfs: %s", fx2txt(status)); sshbuf_free(msg); return -1; } else if (type != 201) { sshfatal("sftp-client.c", __func__, 426, 0, SYSLOG_LEVEL_FATAL, ((void *)0), "Expected SSH2_FXP_EXTENDED_REPLY(%u) packet, got %u", 201, type); } memset(st, 0, sizeof(*st)); if ((r = sshbuf_get_u64(msg, &st->f_bsize)) != 0 || (r = sshbuf_get_u64(msg, &st->f_frsize)) != 0 || (r = sshbuf_get_u64(msg, &st->f_blocks)) != 0 || (r = sshbuf_get_u64(msg, &st->f_bfree)) != 0 || (r = sshbuf_get_u64(msg, &st->f_bavail)) != 0 || (r = sshbuf_get_u64(msg, &st->f_files)) != 0 || (r = sshbuf_get_u64(msg, &st->f_ffree)) != 0 || (r = sshbuf_get_u64(msg, &st->f_favail)) != 0 || (r = sshbuf_get_u64(msg, &st->f_fsid)) != 0 || (r = sshbuf_get_u64(msg, &flag)) != 0 || (r = sshbuf_get_u64(msg, &st->f_namemax)) != 0) sshfatal("sftp-client.c", __func__, 442, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "parse statvfs"); st->f_flag = (flag & 0x00000001) ? ST_RDONLY : 0; st->f_flag |= (flag & 0x00000002) ? ST_NOSUID : 0; sshbuf_free(msg); return 0; }
void get_decode_statvfs(void *a0, struct_0 *a1, unsigned long a2, unsigned long a3) { char v0; char v1; unsigned int v2; unsigned long long v3; unsigned long long v4; unsigned long long v5; unsigned long v6; char v7; unsigned long long v9; void *v10; v4 = sshbuf_new(); if (!v4) sshfatal("sftp-client.c", "get_decode_statvfs", 0x194, 0x1, 0x1, 0x0, "sshbuf_new failed"); get_msg(a0, v4); v2 = sshbuf_get_u8(v4, &v0, &v0); if (!v2) v2 = sshbuf_get_u32(v4, &v1, &v1); if (v2 || v2) { v5 = "parse"; sshfatal("sftp-client.c", "get_decode_statvfs", 0x199, 0x1, 0x1, ssh_err(v2), *(&v7)); } v5 = *(&v1); v4 = v0; v3 = "Received statvfs reply T:%u I:%u"; sshlog("sftp-client.c", "get_decode_statvfs", 0x19b, 0x0, 0x7, 0x0, *(&v7)); if (a2 != *(&v1)) { v5 = a2; v4 = *(&v1); v3 = "ID mismatch (%u != %u)"; sshfatal("sftp-client.c", "get_decode_statvfs", 0x19d, 0x0, 0x1, 0x0, *(&v7)); } if (v0 == 101) { v2 = sshbuf_get_u32(v4, &v3, &v3); if (v2) { v5 = "parse status"; sshfatal("sftp-client.c", "get_decode_statvfs", 0x1a2, 0x1, 0x1, ssh_err(v2), *(&v7)); } if (a3) { v6 = fx2txt(v3); v5 = "remote statvfs: %s"; sshlog("sftp-client.c", "get_decode_statvfs", 0x1a4, 0x0, 0x5, 0x0, *(&v7)); } else { v6 = fx2txt(v3); v5 = "remote statvfs: %s"; sshlog("sftp-client.c", "get_decode_statvfs", 0x1a6, 0x0, 0x2, 0x0, *(&v7)); } sshbuf_free(v4); v9 = 4294967295; } else { if (v0 != 201) { v5 = v0; v4 = 201; v3 = "Expected SSH2_FXP_EXTENDED_REPLY(%u) packet, got %u"; sshfatal("sftp-client.c", "get_decode_statvfs", 0x1aa, 0x0, 0x1, 0x0, *(&v7)); } memset(a1, 0x0, 0x58); v2 = sshbuf_get_u64(v4, a1, a1); if (!v2) { v2 = sshbuf_get_u64(v4, &a1->padding_0[8], &a1->padding_0[8]); if (!v2) { v2 = sshbuf_get_u64(v4, &a1->padding_0[16], &a1->padding_0[16]); if (!v2) { v2 = sshbuf_get_u64(v4, &a1->padding_0[24], &a1->padding_0[24]); if (!v2) { v2 = sshbuf_get_u64(v4, &a1->padding_0[32], &a1->padding_0[32]); if (!v2) { v2 = sshbuf_get_u64(v4, &a1->padding_0[40], &a1->padding_0[40]); if (!v2) { v2 = sshbuf_get_u64(v4, &a1->padding_0[48], &a1->padding_0[48]); if (!v2) { v2 = sshbuf_get_u64(v4, &a1->padding_0[56], &a1->padding_0[56]); if (!v2) { v2 = sshbuf_get_u64(v4, &a1->padding_0[64], &a1->padding_0[64]); if (!v2) { v2 = sshbuf_get_u64(v4, &v3, &v3); if (!v2) v2 = sshbuf_get_u64(v4, a1 + 1, a1 + 1); } } } } } } } } } if (...) { v5 = "parse statvfs"; sshfatal("sftp-client.c", "get_decode_statvfs", 0x1ba, 0x1, 0x1, ssh_err(v2), *(&v7)); } a1->field_48 = v3 & 1; a1->field_48 = v3 & 2 | a1->field_48; sshbuf_free(v4); v10 = 0; } return; }
openssh-portable
angr_dream