input
stringlengths
26
172k
output
stringlengths
18
318k
repo_name
stringclasses
23 values
decompiler
stringclasses
5 values
static inline void emit_ancillary_info(char const *program) { struct infomap { char const *program; char const *node; } const infomap[] = { {"[", "test invocation"}, {"coreutils", "Multi-call invocation"}, {"sha224sum", "sha2 utilities"}, {"sha256sum", "sha2 utilities"}, {"sha384sum", "sha2 utilities"}, {"sha512sum", "sha2 utilities"}, {((void *)0), ((void *)0)}}; char const *node = program; struct infomap const *map_prog = infomap; while (map_prog->program && !(strcmp(program, map_prog->program) == 0)) map_prog++; if (map_prog->node) node = map_prog->node; printf (gettext ("\n%s online help: <%s>\n"), "GNU coreutils", "https: char const *lc_messages = setlocale ( 5 , ((void *)0) ); if (lc_messages && strncmp (lc_messages, "" "en_" "", sizeof ("en_") - 1)) { fputs_unlocked (gettext ("Report any translation bugs to " "<https: stdout ) ; } char const *url_program = (strcmp (program, "[") == 0) ? "test" : program; printf (gettext ("Full documentation <%s%s>\n"), "https: printf (gettext ("or available locally via: info '(coreutils) %s%s'\n"), node, node == program ? " invocation" : ""); }
void emit_ancillary_info(char *a0) { unsigned long long v0; unsigned long long v1[2]; char *v2; unsigned long long v3; unsigned long long v4; unsigned long long v5; unsigned long long v6; unsigned long long v7; unsigned long long v8; unsigned long long v9; unsigned long long v10; unsigned long long v11; unsigned long long v12; unsigned long long v13; unsigned long long v14; unsigned long long v15; void *v16; void *v17; char v18; unsigned long long v23; unsigned long long *v24; unsigned long long v25; v4 = "["; v5 = "test invocation"; v6 = "coreutils"; v7 = "Multi-call invocation"; v8 = "sha224sum"; v9 = "sha2 utilities"; v10 = "sha256sum"; v11 = "sha2 utilities"; v12 = "sha384sum"; v13 = "sha2 utilities"; v14 = "sha512sum"; v15 = "sha2 utilities"; v16 = 0; v17 = 0; v0 = a0; for (v1[0] = &v4; v1[0]; v1[0] = v1 + 1) { if (!strcmp(a0, v1[0])) break; } if (v1[1]) v0 = v1[1]; printf(gettext("\n%s online help: <%s>\n")); v2 = setlocale(0x5, NULL); if (v2 && strncmp(v2, "en_", 0x3)) fputs_unlocked(gettext("Report any translation bugs to <https: if (strcmp(a0, "[")) v23 = a0; else v23 = "test"; v3 = v23; printf(gettext("Full documentation <%s%s>\n")); printf(gettext("or available locally via: info '(coreutils) %s%s'\n")); v25 = *(&v18) ^ v24[5]; return; }
coreutils
angr_dream
void e2fsck_rehash_directories(e2fsck_t ctx) { struct problem_context pctx; struct resource_track rtrack; struct dir_info *dir; ext2_u32_iterate iter; struct dir_info_iter *dirinfo_iter = 0; ext2_ino_t ino; errcode_t retval; int cur, max, all_dirs, first = 1; init_resource_track(&rtrack, ctx->fs->io); all_dirs = ctx->options & 0x0400; if (!ctx->dirs_to_hash && !all_dirs) return; (void)e2fsck_get_lost_and_found(ctx, 0); clear_problem_context(&pctx); cur = 0; if (all_dirs) { dirinfo_iter = e2fsck_dir_info_iter_begin(ctx); max = e2fsck_get_num_dirinfo(ctx); } else { retval = ext2fs_u32_list_iterate_begin(ctx->dirs_to_hash, &iter); if (retval) { pctx.errcode = retval; fix_problem(ctx, 0x031001, &pctx); return; } max = ext2fs_u32_list_count(ctx->dirs_to_hash); } while (1) { if (all_dirs) { if ((dir = e2fsck_dir_info_iter(ctx, dirinfo_iter)) == 0) break; ino = dir->ino; } else { if (!ext2fs_u32_list_iterate(iter, &ino)) break; } if (!ext2fs_test_inode_bitmap2(ctx->inode_dir_map, ino)) continue; pctx.dir = ino; if (first) { fix_problem(ctx, 0x031000, &pctx); first = 0; } pctx.errcode = e2fsck_rehash_dir(ctx, ino, &pctx); if (pctx.errcode) { end_problem_latch(ctx, 0x0090); fix_problem(ctx, 0x031002, &pctx); } if (ctx->progress && !ctx->progress_fd) e2fsck_simple_progress(ctx, "Rebuilding directory", 100.0 * (float)(++cur) / (float)max, ino); } end_problem_latch(ctx, 0x0090); if (all_dirs) e2fsck_dir_info_iter_end(ctx, dirinfo_iter); else ext2fs_u32_list_iterate_end(iter); if (ctx->dirs_to_hash) ext2fs_u32_list_free(ctx->dirs_to_hash); ctx->dirs_to_hash = 0; print_resource_track(ctx, "Pass 3A", &rtrack, ctx->fs->io); }
long long e2fsck_rehash_directories(struct_0 *a0) { unsigned int v0; unsigned int v1; unsigned int v2; unsigned int v3; unsigned int v4; char v5; void *v6; unsigned long v7; unsigned int *v8; char v9; unsigned long v10; unsigned int v11; v6 = 0; v3 = 1; init_resource_track(&v9, a0->field_0->field_8, a0->field_0->field_8); v4 = a0->field_4c & 0x400; if (!a0->field_248 && !v4) return 0; e2fsck_get_lost_and_found(a0, 0x0); clear_problem_context(&v10); v1 = 0; if (v4) { v6 = e2fsck_dir_info_iter_begin(a0); v2 = e2fsck_get_num_dirinfo(a0); } else { v7 = ext2fs_u32_list_iterate_begin(a0->field_248, &v5, &v5); if (v7) { v10 = v7; fix_problem(a0, 0x31001, &v10); return 0; } v2 = ext2fs_u32_list_count(a0->field_248); } while (true) { do { if (v4) { v8 = e2fsck_dir_info_iter(a0, v6, v6); if (v8) { v0 = *(v8); } else { LABEL_4033e2: end_problem_latch(a0, 0x90); if (!v4) ext2fs_u32_list_iterate_end(*(&v5)); else e2fsck_dir_info_iter_end(a0, v6, v6); if (a0->field_248) ext2fs_u32_list_free(a0->field_248); a0->field_248 = 0; print_resource_track(a0, "Pass 3A", &v9, a0->field_0->field_8); return 0; } } else if (!ext2fs_u32_list_iterate(*(&v5), &v0, &v0)) { goto LABEL_4033e2; } if (!ext2fs_test_inode_bitmap2(a0->field_178, v0, v0)) continue; v11 = v0; if (v3) { fix_problem(a0, 0x31000, &v10); v3 = 0; } v10 = e2fsck_rehash_dir(a0, v0, &v10); if (v10) { end_problem_latch(a0, 0x90); fix_problem(a0, 0x31002, &v10); } } while (!(a0->field_160) || !(!a0->field_2c8)); v1 += 1; e2fsck_simple_progress(a0, "Rebuilding directory", v0); } }
e2fsprogs-1.46.5
angr_sailr
vi_command_mode(EditLine *el, wint_t c __attribute__((__unused__))) { el->el_chared.c_vcmd.action = 0x00; el->el_chared.c_vcmd.pos = 0; el->el_state.doingarg = 0; el->el_state.inputmode = 0; el->el_map.current = el->el_map.alt; if (el->el_line.cursor > el->el_line.buffer) el->el_line.cursor--; return 5; }
long long vi_command_mode(struct_0 *a0, unsigned long a1) { unsigned int v0; v0 = a1; a0->field_3c0 = 0; a0->field_3c8 = 0; a0->field_74 = 0; a0->field_70 = 0; a0->field_400 = a0->field_3f0; if (a0->field_58 > a0->field_50) a0->field_58 = a0->field_58 - 4; return 5; }
libedit
angr_sailr
static inline __u8 rta_getattr_u8(const struct rtattr *rta) { return *(__u8 *)(( void *)(((char *)(rta)) + ((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0)))); }
int rta_getattr_u8(struct_0 *a0) { return a0->field_4; }
iproute2-6.0.0
angr_dream
static void init_fromfs() { char *cur; cur = curencoding(); conv_fromfs = iconv_open(cur, "UTF-8-MAC"); }
void init_fromfs(void) { char *__tocode; __tocode = (char *)curencoding(); conv_fromfs = iconv_open(__tocode, "UTF-8-MAC"); return; }
bash
ghidra
void purge_directory(char const *directory_name) { if (!try_purge_directory(directory_name)) skip_member(); }
void purge_directory(undefined8 param_1) { char cVar1; cVar1 = try_purge_directory(param_1); if (cVar1 != '\x01') { skip_member(); } return; }
tar
ghidra
static long parse_number(const char *arg) { char *endptr = ((void *)0); (*__errno_location()) = 0; long result; if (strncmp(arg, "0x", 2) == 0) result = strtol(arg + 2, &endptr, 16); else if (strncmp(arg, "0", 1) == 0 && strspn(arg, "012345678") == strlen(optarg)) result = strtol(arg + 1, &endptr, 8); else result = strtol(arg, &endptr, 10); if ((*__errno_location()) != 0 || (endptr && *endptr != '\0')) error(1, (*__errno_location()), "'%s' is not a recognizable number.", arg); return result; }
long parse_number(const char *a1) { size_t v1; int *v2; char *endptr; long v5; unsigned long v6; v6 = __readfsqword(0x28u); endptr = 0LL; *_errno_location() = 0; if (!strncmp(a1, "0x", 2uLL)) { v5 = strtol(a1 + 2, &endptr, 16); } else if (!strncmp(a1, "0", 1uLL) && (v1 = strspn(a1, "012345678"), v1 == strlen(optarg))) { v5 = strtol(a1 + 1, &endptr, 8); } else { v5 = strtol(a1, &endptr, 10); } if (*_errno_location() || endptr && *endptr) { v2 = _errno_location(); error(1, *v2, "'%s' is not a recognizable number.", a1); } return v5; }
gnutls
ida
void fatal_error (const char *format, ...) { va_list args; error_prolog(0); __builtin_va_start(args, format); vfprintf(stderr, format, args); fprintf(stderr, "\n"); __builtin_va_end(args); sh_exit(2); }
unsigned long fatal_error(const char *a1, long a2, long a3, long a4, long a5, long a6, ...) { long v6; long v7; long v8; long v9; gcc_va_list arg; unsigned long v12; long v13; long v14; long v15; long v16; long v17; va_start(arg, a6); v13 = a2; v14 = a3; v15 = a4; v16 = a5; v17 = a6; v12 = __readfsqword(0x28u); error_prolog(0); arg[0].gp_offset = 8; vfprintf(stderr, a1, arg); fprintf(stderr, "\n"); sh_exit(2LL); return internal_error((_BYTE *)error_prolog + 2, (long)"\n", v6, v7, v8, v9); }
bash
ida
int sshbuf_get_ec(struct sshbuf *buf, EC_POINT *v, const EC_GROUP *g) { const u_char *d; size_t len; int r; if ((r = sshbuf_peek_string_direct(buf, &d, &len)) < 0) return r; if ((r = get_ec(d, len, v, g)) != 0) return r; if (sshbuf_get_string_direct(buf, ((void *)0), ((void *)0)) != 0) { ; ; return -1; } return 0; }
long long sshbuf_get_ec(unsigned long long a0, unsigned long long a1, unsigned long long a2) { unsigned int v0; char v1; char v2; unsigned long long v4; v0 = sshbuf_peek_string_direct(a0, &v1, &v2, &v1); if (v0 < 0) { v4 = v0; } else { v0 = get_ec(*(&v1), *(&v2), a1, a2); if (v0) { v4 = v0; } else if (sshbuf_get_string_direct(a0, 0x0, 0x0)) { v4 = 4294967295; } else { v4 = 0; } } return v4; }
openssh-portable
angr_phoenix
int umaskcmd(int argc, char **argv) { char *ap; int mask; int i; int symbolic_mode = 0; while ((i = nextopt("S")) != '\0') { symbolic_mode = 1; } ({ suppressint++; ({ __asm__ __volatile__("" : : : "memory"); }); 0; }); mask = umask(0); umask(mask); ({ ({ __asm__ __volatile__("" : : : "memory"); }); if (--suppressint == 0 && intpending) onint(); 0; }); if ((ap = *argptr) == ((void *)0)) { if (symbolic_mode) { char buf[18]; int j; mask = ~mask; ap = buf; for (i = 0; i < 3; i++) { *ap++ = "ugo"[i]; *ap++ = '='; for (j = 0; j < 3; j++) if (mask & (1 << (8 - (3 * i + j)))) *ap++ = "rwx"[j]; *ap++ = ','; } ap[-1] = '\0'; out1fmt("%s\n", buf); } else { out1fmt("%.4o\n", mask); } } else { int new_mask; if (((*__ctype_b_loc())[(int)(((unsigned char)*ap))] & (unsigned short int)_ISdigit)) { new_mask = 0; do { if (*ap >= '8' || *ap < '0') sh_error(illnum, *argptr); new_mask = (new_mask << 3) + (*ap - '0'); } while (*++ap != '\0'); } else { int positions, new_val; char op; mask = ~mask; new_mask = mask; positions = 0; while (*ap) { while (*ap && strchr("augo", *ap)) switch (*ap++) { case 'a': positions |= 0111; break; case 'u': positions |= 0100; break; case 'g': positions |= 0010; break; case 'o': positions |= 0001; break; } if (!positions) positions = 0111; if (!strchr("=+-", op = *ap)) break; ap++; new_val = 0; while (*ap && strchr("rwxugoXs", *ap)) switch (*ap++) { case 'r': new_val |= 04; break; case 'w': new_val |= 02; break; case 'x': new_val |= 01; break; case 'u': new_val |= mask >> 6; break; case 'g': new_val |= mask >> 3; break; case 'o': new_val |= mask >> 0; break; case 'X': if (mask & 0111) new_val |= 01; break; case 's': break; } new_val = (new_val & 07) * positions; switch (op) { case '-': new_mask &= ~new_val; break; case '=': new_mask = new_val | (new_mask & ~(positions * 07)); break; case '+': new_mask |= new_val; } if (*ap == ',') { positions = 0; ap++; } else if (!strchr("=+-", *ap)) break; } if (*ap) { sh_error("Illegal mode: %s", *argptr); return 1; } new_mask = ~new_mask; } umask(new_mask); } return 0; }
long long umaskcmd(unsigned long a0, unsigned long a1) { unsigned long v0; int tmp_9; int tmp_12; int tmp_14; int tmp_37; unsigned int v1; char v2; unsigned int v3; unsigned int v4; unsigned int v5; unsigned int v6; unsigned int v7; unsigned int v8; unsigned int v9; char *v10; char v11; unsigned int v14; char *v15; char *v16; unsigned long long v17; unsigned long long v18; unsigned long long v19; unsigned long long v20; struct_0 *v21; unsigned long long v22; v1 = a0; v0 = a1; v4 = 0; while (true) { v3 = nextopt("S"); if (!v3) break; v4 = 1; } suppressint = suppressint + 1; v9 = umask(0x0); umask(v9); suppressint = suppressint - 1; if (!suppressint && intpending) onint(); v10 = *(argptr); if (v10) { v14 = *((*(v10) * 2 + *(__ctype_b_loc()))) & 0x800; if (v14) { v6 = 0; do { if (*(v10) <= 47 || *(v10) > 55) sh_error(0x5000f0); v6 = *(v10)-48 + (v6 * 8); v10 += 1; } while (*(v10)); } else { v9 = !(v9); v6 = v9; v7 = 0; while (*(v10)) { while (true) { if (*(v10)) { v17 = strchr("augo", *(v10)); if (v17) { tmp_9 = v10; v10 += 1; v18 = *(tmp_9); if (v18 != 117) { if (v18 > 117) continue; if (v18 != 111) { if (v18 > 111) continue; if (v18 != 97) { if (v18 != 103) continue; v7 |= 8; continue; } else { v7 |= 73; continue; } } else { v7 |= 1; continue; } } else { v7 |= 64; continue; } } } if (!*(v10) || !v17) { if (!v7) v7 = 73; v2 = *(v10); v19 = strchr("=+-", v2); if (!v19) break; if (v19) { v10 += 1; v8 = 0; if (true) { while (true) { if (*(v10)) { v20 = strchr("rwxugoXs", *(v10)); if (v20) { tmp_12 = v10; v10 += 1; *(&v20) = *(tmp_12); v21 = v20 - 88; switch (v21) { case 0: if (!(v9 & 73)) continue; v8 |= 1; break; case 15: v8 |= (v9 >> 3); break; case 23: v8 |= v9; break; case 26: v8 |= 4; break; case 27: break; case 29: v8 |= (v9 >> 6); break; case 31: v8 |= 2; break; case 32: v8 |= 1; break; } v22 = *((0x4 * &v21->padding_0[0] + &g_400c18)) + &g_400c18; } } if (!*(v10) || !v20) { v8 = (v8 & 7) * v7; if (v2 != 61) { if (v2 > 61) break; if (v2 <= 61) { if (v2 != 43) { if (v2 != 45) break; if (v2 == 45) { v6 &= !(v8); break; } } else { v6 |= v8; break; } } } else { v6 = !((v7 * 8) - v7) & v6 | v8; break; } } } } if (*(v10) == 44) { v7 = 0; v10 += 1; break; } else { break; } } } } if (!v19 || !strchr("=+-", *(v10)) && *(v10) != 44) break; } if (*(v10)) sh_error("Illegal mode: %s"); v6 = !(v6); } umask(v6); } else if (v4) { v9 = !(v9); v10 = &v11; for (v3 = 0; v3 <= 2; v3 += 1) { tmp_14 = v10; v10 += 1; *(tmp_14) = *(v3 + &g_400c0d); tmp_37 = v10; v10 += 1; *(tmp_37) = 61; for (v5 = 0; v5 <= 2; v5 += 1) { if (((v9 >> ((8 - (v5 + v3 + (v3 << 1))) & 31)) & 1)) { v15 = v10; v10 += 1; *(v15) = *(v5 + &g_400c11); } } v16 = v10; v10 += 1; *(v16) = 44; } v10[1] = 0; out1fmt("%s\n", &v11); } else { out1fmt("%.4o\n", v9); } return 0; }
dash-0.5.11+git20210903+057cd650a4ed
angr_dream
int ssh_input_space(struct ssh *ssh, size_t len) { return (0 == sshbuf_check_reserve(ssh_packet_get_input(ssh), len)); }
long long ssh_input_space(unsigned long long a0, unsigned long long a1) { unsigned long long v1; v1 = ssh_packet_get_input(a0); return !sshbuf_check_reserve(v1, a1, v1); }
openssh-portable
angr_phoenix
int pidfile_close(struct pidfh *pfh) { int error; error = pidfile_verify(pfh); if (error != 0) { (*__errno_location()) = error; return (-1); } if (close(pfh->pf_fd) == -1) error = (*__errno_location()); free(pfh->pf_path); free(pfh); if (error != 0) { (*__errno_location()) = error; return (-1); } return (0); }
long long pidfile_close(struct_0 *a0) { unsigned int v0; unsigned long long v2; unsigned long long v3; v0 = pidfile_verify(a0); if (v0) { *(__errno_location()) = v0; v3 = 4294967295; } else { v2 = close(a0->field_0); if (v2 == -1) { *(&v2) = *(__errno_location()); v0 = v2; } free(a0->field_8); free(a0); if (v0) { *(__errno_location()) = v0; v3 = 4294967295; } else { v3 = 0; } } return v3; }
libbsd-0.11.7
angr_dream
static struct merge_node *merge_tree_init(size_t nthreads, size_t nlines, struct line *dest) { struct merge_node *merge_tree = xmalloc(2 * sizeof *merge_tree * nthreads); struct merge_node *root = merge_tree; root->lo = root->hi = root->end_lo = root->end_hi = ((void *)0); root->dest = ((void *)0); root->nlo = root->nhi = nlines; root->parent = ((void *)0); root->level = MERGE_END; root->queued = 0; pthread_mutex_init(&root->lock, ((void *)0)); init_node(root, root + 1, dest, nthreads, nlines, 0); return merge_tree; }
undefined8 *merge_tree_init(long param_1, undefined8 param_2, undefined8 param_3) { undefined8 *puVar1; puVar1 = (undefined8 *)xmalloc(param_1 << 8); puVar1[3] = 0; puVar1[2] = puVar1[3]; puVar1[1] = puVar1[2]; *puVar1 = puVar1[1]; puVar1[4] = 0; puVar1[6] = param_2; puVar1[5] = puVar1[6]; puVar1[7] = 0; *(undefined4 *)(puVar1 + 10) = 0; *(undefined *)((long)puVar1 + 0x54) = 0; pthread_mutex_init((pthread_mutex_t *)(puVar1 + 0xb), (pthread_mutexattr_t *)0x0); init_node(puVar1, puVar1 + 0x10, param_3, param_1, param_2, 0); return puVar1; }
coreutils
ghidra
static size_t lf_refill(struct line_filter *lf) { size_t s = ck_fread(lf->buffer, ((size_t)65536), lf->infile); lf->bufpos = lf->buffer; lf->buflim = lf->buffer + s; lf->buflim[0] = '\n'; checksigs(); return s; }
size_t lf_refill(long a1) { size_t v2; v2 = ck_fread(*(void **)(a1 + 16), 0x10000uLL, *(FILE **)a1); *(_QWORD *)(a1 + 8) = *(_QWORD *)(a1 + 16); *(_QWORD *)(a1 + 24) = v2 + *(_QWORD *)(a1 + 16); **(_BYTE **)(a1 + 24) = 10; checksigs(); return v2; }
diffutils
ida
static void readError(void) { fprintf(stderr, "%s: I/O error reading `%s', possible reason follows.\n", progName, inFileName); perror(progName); fprintf(stderr, "%s: warning: output file(s) may be incomplete.\n", progName); exit(1); }
void readError(void) { fprintf(stderr, "%s: I/O error reading `%s\', possible reason follows.\n", progName, inFileName); perror(progName); fprintf(stderr, "%s: warning: output file(s) may be incomplete.\n", progName); exit(1); }
bzip2
ghidra
void print_array_assignment(var, quoted) SHELL_VAR *var; int quoted; { char *vstr; vstr = array_to_assign((ARRAY *)((var)->value), quoted); if (vstr == 0) printf("%s=%s\n", var->name, quoted ? "'()'" : "()"); else { printf("%s=%s\n", var->name, vstr); sh_xfree((vstr), "arrayfunc.c", 1225); } }
void print_array_assignment(undefined8 *param_1, int param_2) { long lVar1; undefined *puVar2; lVar1 = array_to_assign(param_1[1], param_2); if (lVar1 == 0) { if (param_2 == 0) { puVar2 = &DAT_00103b2a; } else { puVar2 = &DAT_00103b25; } printf("%s=%s\n", *param_1, puVar2); } else { printf("%s=%s\n", *param_1, lVar1); sh_xfree(lVar1, "arrayfunc.c", 0x4c9); } return; }
bash
ghidra
read_prepare(EditLine *el) { if (el->el_flags & 0x001) sig_set(el); if (el->el_flags & 0x002) return; if ((el->el_flags & (0x008 | 0x004)) == 0x008) tty_rawmode(el); el_resize(el); re_clear_display(el); ch_reset(el); re_refresh(el); if (el->el_flags & 0x008) terminal__flush(el); }
long read_prepare(long a1) { long result; if ((*(_DWORD *)(a1 + 44) & 1) != 0) sig_set(a1); result = *(_DWORD *)(a1 + 44) & 2; if (!(_DWORD)result) { if ((*(_DWORD *)(a1 + 44) & 0xC) == 8) tty_rawmode(a1); el_resize(a1); re_clear_display(a1); ch_reset(a1); re_refresh(a1); result = *(_DWORD *)(a1 + 44) & 8; if ((_DWORD)result) return terminal__flush(a1); } return result; }
libedit
ida
static arrayind_t array_length_reference(s) char *s; { int len; arrayind_t ind; char *akey; char *t, c; ARRAY *array; HASH_TABLE *h; SHELL_VAR *var; var = array_variable_part(s, 0, &t, &len); if ((var == 0 || ((((var)->attributes) & (0x0001000))) || (((((var)->attributes) & (0x0000040))) == 0 && ((((var)->attributes) & (0x0000004))) == 0)) && unbound_vars_is_error) { c = *--t; *t = '\0'; set_exit_status(1); err_unboundvar(s); *t = c; return (-1); } else if (var == 0 || ((((var)->attributes) & (0x0001000)))) return 0; array = ((((var)->attributes) & (0x0000004))) ? (ARRAY *)((var)->value) : (ARRAY *)((void *)0); h = ((((var)->attributes) & (0x0000040))) ? (HASH_TABLE *)((var)->value) : (HASH_TABLE *)((void *)0); if (((t[0]) == '@' || (t[0]) == '*') && t[1] == ']') { if (((((var)->attributes) & (0x0000040)))) return (h ? ((h)->nentries) : 0); else if (((((var)->attributes) & (0x0000004)))) return (array ? ((array)->num_elements) : 0); else return (((var)->value != 0) ? 1 : 0); } if (((((var)->attributes) & (0x0000040)))) { t[len - 1] = '\0'; akey = expand_subscript_string(t, 0); t[len - 1] = ']'; if (akey == 0 || *akey == 0) { err_badarraysub(t); do { if (akey) sh_xfree((akey), "subst.c", 7266); } while (0); return (-1); } t = assoc_reference((HASH_TABLE *)((var)->value), akey); sh_xfree((akey), "subst.c", 7270); } else { ind = array_expand_index(var, t, len, 0); if (var && ((((var)->attributes) & (0x0000004))) && ind < 0) ind = (((ARRAY *)((var)->value))->max_index) + 1 + ind; if (ind < 0) { err_badarraysub(t); return (-1); } if (((((var)->attributes) & (0x0000004)))) t = array_reference(array, ind); else t = (ind == 0) ? ((var)->value) : (char *)((void *)0); } len = (((__ctype_get_mb_cur_max()) > 1) ? (((t) && (t)[0]) ? ((t)[1] ? mbstrlen(t) : 1) : 0) : (((t) && (t)[0]) ? ((t)[1] ? ((t)[2] ? strlen(t) : 2) : 1) : 0)); return (len); }
ulong array_length_reference(undefined8 param_1) { char cVar1; ulong uVar2; size_t sVar3; long in_FS_OFFSET; int local_44; char *local_40; long local_38; long local_30; long local_28; long local_20; char *local_18; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); local_30 = array_variable_part(param_1, 0, &local_40, &local_44); if ((((local_30 == 0) || ((*(uint *)(local_30 + 0x28) & 0x1000) != 0)) || (((*(uint *)(local_30 + 0x28) & 0x40) == 0 && ((*(uint *)(local_30 + 0x28) & 4) == 0)))) && (unbound_vars_is_error != 0)) { local_40 = local_40 + -1; cVar1 = *local_40; *local_40 = '\0'; set_exit_status(1); err_unboundvar(param_1); *local_40 = cVar1; uVar2 = 0xffffffffffffffff; } else if ((local_30 == 0) || ((*(uint *)(local_30 + 0x28) & 0x1000) != 0)) { uVar2 = 0; } else { if ((*(uint *)(local_30 + 0x28) & 4) == 0) { local_28 = 0; } else { local_28 = *(long *)(local_30 + 8); } if ((*(uint *)(local_30 + 0x28) & 0x40) == 0) { local_20 = 0; } else { local_20 = *(long *)(local_30 + 8); } if (((*local_40 == '@') || (*local_40 == '*')) && (local_40[1] == ']')) { if ((*(uint *)(local_30 + 0x28) & 0x40) == 0) { if ((*(uint *)(local_30 + 0x28) & 4) == 0) { uVar2 = (ulong)(*(long *)(local_30 + 8) != 0); } else if (local_28 == 0) { uVar2 = 0; } else { uVar2 = *(ulong *)(local_28 + 8); } } else if (local_20 == 0) { uVar2 = 0; } else { uVar2 = (ulong) * (int *)(local_20 + 0xc); } } else { if ((*(uint *)(local_30 + 0x28) & 0x40) == 0) { local_38 = array_expand_index(local_30, local_40, local_44, 0); if (((local_30 != 0) && ((*(uint *)(local_30 + 0x28) & 4) != 0)) && (local_38 < 0)) { local_38 = local_38 + **(long **)(local_30 + 8) + 1; } if (local_38 < 0) { err_badarraysub(local_40); uVar2 = 0xffffffffffffffff; goto LAB_00110aeb; } if ((*(uint *)(local_30 + 0x28) & 4) == 0) { if (local_38 == 0) { local_40 = *(char **)(local_30 + 8); } else { local_40 = (char *)0x0; } } else { local_40 = (char *)array_reference(local_28, local_38); } } else { local_40[(long)local_44 + -1] = '\0'; local_18 = (char *)expand_subscript_string(local_40, 0); local_40[(long)local_44 + -1] = ']'; if ((local_18 == (char *)0x0) || (*local_18 == '\0')) { err_badarraysub(local_40); if (local_18 != (char *)0x0) { sh_xfree(local_18, "subst.c", 0x1c62); } uVar2 = 0xffffffffffffffff; goto LAB_00110aeb; } local_40 = (char *)assoc_reference(*(undefined8 *)(local_30 + 8), local_18); sh_xfree(local_18, "subst.c", 0x1c66); } sVar3 = __ctype_get_mb_cur_max(); if (sVar3 < 2) { if ((local_40 == (char *)0x0) || (*local_40 == '\0')) { local_44 = 0; } else if (local_40[1] == '\0') { local_44 = 1; } else if (local_40[2] == '\0') { local_44 = 2; } else { sVar3 = strlen(local_40); local_44 = (int)sVar3; } } else if ((local_40 == (char *)0x0) || (*local_40 == '\0')) { local_44 = 0; } else if (local_40[1] == '\0') { local_44 = 1; } else { local_44 = mbstrlen(local_40); } uVar2 = (ulong)local_44; } } LAB_00110aeb: if (local_10 == *(long *)(in_FS_OFFSET + 0x28)) { return uVar2; } __stack_chk_fail(); }
bash
ghidra
static Bool containsDubiousChars(Char *name) { return ((Bool)0); }
long containsDubiousChars() { return 0LL; }
bzip2
ida
static int set_othername_octet(int type, void *crt) { int ret = 0, i; const char *oid; if (batch) { if (!cfg.other_name_octet) return 0; for (i = 0; cfg.other_name_octet[i] != ((void *)0); i += 2) { oid = cfg.other_name_octet[i]; if (cfg.other_name_octet[i + 1] == ((void *)0)) { fprintf(stderr, "other_name_octet: %s does not have an argument.\n", cfg.other_name_octet[i]); exit(1); } if (type == 1) ret = gnutls_x509_crt_set_subject_alt_othername( crt, oid, cfg.other_name_octet[i + 1], strlen(cfg.other_name_octet[i + 1]), 1 | (1 << 1)); else ret = gnutls_x509_crq_set_subject_alt_othername( crt, oid, cfg.other_name_octet[i + 1], strlen(cfg.other_name_octet[i + 1]), 1 | (1 << 1)); if (ret < 0) break; } } if (ret < 0) { fprintf(stderr, "set_subject_alt_othername: %s\n", gnutls_strerror(ret)); exit(1); } return ret; }
void set_othername_octet(unsigned long a0, unsigned long long a1) { unsigned int v0; unsigned int v1; unsigned long long v2; void *v4; unsigned long long v5; v0 = 0; if (*(got.batch)) { if (*((got.cfg + 368))) { v1 = 0; while (true) { if (!*((*((got.cfg + 368)) + (v1 << 3)))) break; v2 = *((*((got.cfg + 368)) + v1 * 8)); if (!*((*((got.cfg + 368)) + (v1 + 1 << 3)))) { fprintf(*(*(&got.stderr)), "other_name_octet: %s does not have an argument.\n", *((*((got.cfg + 368)) + v1 * 8))); exit(0x1); } if (a0 == 1) v0 = gnutls_x509_crt_set_subject_alt_othername( a1, v2, *((*((got.cfg + 368)) + (v1 + 1) * 8)), strlen(*((*((got.cfg + 368)) + (v1 + 1) * 8))), 0x3); else v0 = gnutls_x509_crq_set_subject_alt_othername( a1, v2, *((*((got.cfg + 368)) + (v1 + 1) * 8)), strlen(*((*((got.cfg + 368)) + (v1 + 1) * 8))), 0x3); if (v0 < 0) break; v1 += 2; } } else { v4 = 0; return; } } if (v0 >= 0) { v5 = v0; return; } fprintf(*(*(&got.stderr)), "set_subject_alt_othername: %s\n", gnutls_strerror(v0)); exit(0x1); }
gnutls
angr_sailr
static inline void inet_prefix_reset(inet_prefix *p) { p->flags = 0; }
void inet_prefix_reset(undefined2 *param_1) { *param_1 = 0; return; }
iproute2-6.0.0
ghidra
static void factor_insert_multiplicity(struct factors *factors, uintmax_t prime, unsigned int m) { unsigned int nfactors = factors->nfactors; uintmax_t *p = factors->p; unsigned char *e = factors->e; int i; for (i = nfactors - 1; i >= 0; i--) { if (p[i] <= prime) break; } if (i < 0 || p[i] != prime) { for (int j = nfactors - 1; j > i; j--) { p[j + 1] = p[j]; e[j + 1] = e[j]; } p[i + 1] = prime; e[i + 1] = m; factors->nfactors = nfactors + 1; } else { e[i] += m; } }
void factor_insert_multiplicity(struct_0 *a0, unsigned long a1, unsigned long a2) { unsigned int v0; unsigned int v1; unsigned int v2; unsigned long long *v3; char *v4; unsigned long long v6; struct_0 *v7; v2 = a0->field_fa; v3 = &a0->padding_0[16]; v4 = &a0->padding_0[224]; for (v0 = v2 - 1; v0 >= 0; v0 -= 1) { if (a1 >= v3[v0]) break; } if (v0 >= 0 && a1 == v3[v0]) { v6 = &v4[v0]; v4[v0] = v4[v0] + a2; } if (v0 < 0 || a1 != v3[v0]) { for (v1 = v2 - 1; v1 > v0; v1 -= 1) { v3[1 + v1] = v3[v1]; v4[1 + v1] = v4[v1]; } v3[1 + v0] = a1; v4[1 + v0] = a2; v7 = a0; a0->field_fa = v2 + 1; } return; }
coreutils
angr_dream
static gnutls_digest_algorithm_t get_dig(gnutls_x509_crt_t crt, common_info_st *cinfo) { gnutls_digest_algorithm_t dig; gnutls_pubkey_t pubkey; int result; result = gnutls_pubkey_init(&pubkey); if (result < 0) { fprintf(stderr, "memory error\n"); app_exit(1); } result = gnutls_pubkey_import_x509(pubkey, crt, 0); if (result < 0) { { fprintf(stderr, "gnutls_pubkey_import_x509: %s\n", gnutls_strerror(result)); app_exit(1); } } dig = get_dig_for_pub(pubkey, cinfo); gnutls_pubkey_deinit(pubkey); return dig; }
undefined4 get_dig(undefined8 param_1, undefined8 param_2) { int iVar1; undefined4 uVar2; undefined8 uVar3; long in_FS_OFFSET; undefined8 local_18; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); iVar1 = gnutls_pubkey_init(&local_18); if (iVar1 < 0) { fprintf(stderr, "memory error\n"); app_exit(1); } iVar1 = gnutls_pubkey_import_x509(local_18, param_1, 0); if (iVar1 < 0) { uVar3 = gnutls_strerror(iVar1); fprintf(stderr, "gnutls_pubkey_import_x509: %s\n", uVar3); app_exit(1); } uVar2 = get_dig_for_pub(local_18, param_2); gnutls_pubkey_deinit(local_18); if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) { __stack_chk_fail(); } return uVar2; }
gnutls
ghidra
static size_t hash_link(void const *entry, size_t n_buckets) { struct link const *l = entry; uintmax_t num = l->dev ^ l->ino; return num % n_buckets; }
long long hash_link(unsigned long long a0[2], unsigned long a1) { unsigned long v0; v0 = a0[1] ^ a0[0]; return (0 CONCAT v0) / m a1 >> 64; }
tar
angr_dream
static inline _Bool is_addrtype_inet_not_unspec(const inet_prefix *p) { return (p->flags & ADDRTYPE_INET_UNSPEC) == ADDRTYPE_INET; }
int is_addrtype_inet_not_unspec(unsigned short *a0) { unsigned int v1; v1 = *(a0) & 6; *(&v1) = (*(a0) & 6) == 2; return v1; }
iproute2-6.0.0
angr_dream
static void _gnu_flush_write(size_t buffer_level) { ssize_t status; union block *header; char *copy_ptr; size_t copy_size; size_t bufsize; struct bufmap *map; status = _flush_write(); if (status != record_size && !multi_volume_option) archive_write_error(status); else { if (status) records_written++; bytes_written += status; } if (status == record_size) { return; } map = bufmap_locate(status); if (status % 512) { do { if (error_hook) error_hook(); error(0, 0, gettext("write did not end on a block boundary")); exit_status = 2; } while (0); archive_write_error(status); } if (status < 0 && (*__errno_location()) != 28 && (*__errno_location()) != 5 && (*__errno_location()) != 6) archive_write_error(status); if (!new_volume(ACCESS_WRITE)) return; tar_stat_destroy(&dummy); increase_volume_number(); prev_written += bytes_written; bytes_written = 0; copy_ptr = record_start->buffer + status; copy_size = buffer_level - status; record_index = !record_index; init_buffer(); inhibit_map = 1; if (volume_label_option) add_volume_label(); if (map) add_multi_volume_header(map); write_extended(1, &dummy, find_next_block()); tar_stat_destroy(&dummy); if (map) add_chunk_header(map); header = find_next_block(); bufmap_reset(map, header - record_start); bufsize = available_space_after(header); inhibit_map = 0; while (bufsize < copy_size) { memcpy(header->buffer, copy_ptr, bufsize); copy_ptr += bufsize; copy_size -= bufsize; set_next_block_after(header + (bufsize - 1) / 512); header = find_next_block(); bufsize = available_space_after(header); } memcpy(header->buffer, copy_ptr, copy_size); memset(header->buffer + copy_size, 0, bufsize - copy_size); set_next_block_after(header + (copy_size - 1) / 512); find_next_block(); }
void _gnu_flush_write(unsigned long a0, unsigned long long a1, unsigned long long a2, unsigned long long a3, unsigned long long a4, unsigned long long a5) { unsigned long v0; void *v1; unsigned int v2; unsigned int v3; unsigned long v4; void *v5; unsigned long long v8; unsigned long long v10; unsigned long long v12; *(&v4) = _flush_write(); if (v4 != record_size && (multi_volume_option ^ 1)) archive_write_error(v4); if (v4) continued_file_offset = 16752697132039570249; v8 = v4; bytes_written = L Conv(128->64, (Conv(64->128, Load(addr = 0x404ae8 < 64 >, size = 8, endness = Iend_LE)) + xmm1<16>))<8> v10 = record_size; if (v4 == record_size) return; v5 = bufmap_locate(v4); if ((v4 & 511)) { if (error_hook) *(5243096)(); error(0x0, 0x0, gettext("write did not end on a block boundary")); exit_status = 2; archive_write_error(v4); } else { if ((v4 - 0 >> 63)) { *(&v10) = *(__errno_location()); if (v10 != 28) { *(&v10) = *(__errno_location()); if (v10 != 5) { *(&v10) = *(__errno_location()); if (v10 != 6) archive_write_error(v4); } } } if ((new_volume(0x1, a1, a2, a3, a4, a5) ^ 1)) return; tar_stat_destroy(&dummy); increase_volume_number(&dummy, a1, a2, a3, a4, a5); prev_written = bytes_written + prev_written; bytes_written = 0; v1 = v4 + 16752697132039570248; *(&v2) = a0 - v4; record_index = !record_index; init_buffer(); inhibit_map = 1; if (volume_label_option) add_volume_label(); if (v5) add_multi_volume_header(v5); write_extended(0x1, &dummy, find_next_block()); tar_stat_destroy(&dummy); if (v5) add_chunk_header(v5); v0 = find_next_block(); bufmap_reset(v5, v0 - 16752697132039570248 >> 9); *(&v3) = available_space_after(v0); for (inhibit_map = 0; *(&v3) < *(&v2); *(&v3) = available_space_after(v0)) { memcpy(v0, v1, *(&v3)); v1 += *(&v3); *(&v2) = *(&v2) - *(&v3); set_next_block_after(v0 + (*(&v3) - 1 & -0x200)); v0 = find_next_block(); } memcpy(v0, v1, *(&v2)); memset(v0 + *(&v2), 0x0, *(&v3) - *(&v2)); set_next_block_after(v0 + (*(&v2) - 1 & -0x200)); v12 = find_next_block(); return; } }
tar
angr_sailr
int ext2_file_type(unsigned int mode) { if ((((mode) & 00170000) == 0100000)) return 1; if ((((mode) & 00170000) == 0040000)) return 2; if ((((mode) & 00170000) == 0020000)) return 3; if ((((mode) & 00170000) == 0060000)) return 4; if ((((mode) & 00170000) == 0120000)) return 7; if ((((mode) & 00170000) == 0010000)) return 5; if ((((mode) & 00170000) == 0140000)) return 6; return 0; }
long long ext2_file_type(unsigned long a0) { unsigned long long v1; if ((a0 & 0xf000) == 0x8000) { v1 = 1; } else if ((a0 & 0xf000) == 0x4000) { v1 = 2; } else if ((a0 & 0xf000) == 0x2000) { v1 = 3; } else if ((a0 & 0xf000) == 0x6000) { v1 = 4; } else if ((a0 & 0xf000) == 0xa000) { v1 = 7; } else if ((a0 & 0xf000) == 0x1000) { v1 = 5; } else if ((a0 & 0xf000) == 0xc000) { v1 = 6; } else { v1 = 0; } return v1; }
e2fsprogs-1.46.5
angr_phoenix
void session_proctitle(Session *s) { if (s->pw == ((void *)0)) sshlog("session.c", __func__, 2554, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "no user for session %d", s->self); else setproctitle("%s@%s", s->pw->pw_name, session_tty_list()); }
long session_proctitle(long a1) { char *v2; if (!*(_QWORD *)(a1 + 16)) return sshlog("session.c", "session_proctitle", 2554LL, 0LL, 2LL, 0LL, "no user for session %d", *(unsigned int *)(a1 + 4)); v2 = session_tty_list(); return setproctitle("%s@%s", **(const char ***)(a1 + 16), v2); }
openssh-portable
ida
int e2fsck_dir_info_set_dotdot(e2fsck_t ctx, ext2_ino_t ino, ext2_ino_t dotdot) { struct dir_info *p; p = e2fsck_get_dir_info(ctx, ino); if (!p) return 1; p->dotdot = dotdot; e2fsck_put_dir_info(ctx, p); return 0; }
long long e2fsck_dir_info_set_dotdot(void *a0, unsigned long a1, unsigned long a2) { struct_0 *v0; unsigned long long v2; v0 = e2fsck_get_dir_info(a0, a1); if (!v0) { v2 = 1; } else { v0->field_4 = a2; e2fsck_put_dir_info(a0, v0); v2 = 0; } return v2; }
e2fsprogs-1.46.5
angr_dream
int swap_uids_back(void) { return ((setegid(save_egid) || seteuid(save_euid)) ? -1 : 0); }
undefined8 swap_uids_back(void) { int iVar1; iVar1 = setegid(save_egid); if ((iVar1 == 0) && (iVar1 = seteuid(save_euid), iVar1 == 0)) { return 0; } return 0xffffffff; }
cronie
ghidra
WORD_LIST *strvec_to_word_list(array, alloc, starting_index) char **array; int alloc, starting_index; { WORD_LIST *list; WORD_DESC *w; int i, count; if (array == 0 || array[0] == 0) return (WORD_LIST *)((void *)0); for (count = 0; array[count]; count++) ; for (i = starting_index, list = (WORD_LIST *)((void *)0); i < count; i++) { w = make_bare_word(alloc ? array[i] : ""); if (alloc == 0) { sh_xfree((w->word), "stringvec.c", 266); w->word = array[i]; } list = make_word_list(w, list); } return (((list && list->next) ? (WORD_LIST *)list_reverse((GENERIC_LIST *)list) : (WORD_LIST *)(list))); }
long long strvec_to_word_list(unsigned long long *a0, unsigned long a1, unsigned long a2) { unsigned int v0; unsigned int v1; void *v2; unsigned long long *v3; void *v5; if (!a0) { v5 = 0; return v5; } else if (!*(a0)) { v5 = 0; return v5; } else { for (v1 = 0; a0[v1]; v1 += 1) ; v0 = a2; for (v2 = 0; v0 < v1; v0 += 1) { v3 = make_bare_word((!a1 ? a0[v0] : &g_40080b)); if (!a1) { sh_xfree(*(v3), "stringvec.c", 0x10a); *(v3) = a0[v0]; } v2 = make_word_list(v3, v2, v2); } if (v2 && *(v2)) { v5 = list_reverse(v2); return v5; } v5 = v2; return v5; } }
bash
angr_sailr
static void hg_addfn(struct exclude *ex, char const *pattern, int options, void *data) { int *hgopt = data; size_t len; while (((*__ctype_b_loc())[(int)((*pattern))] & (unsigned short int)_ISspace)) ++pattern; if (*pattern == 0 || *pattern == '#') return; if (strncmp(pattern, "syntax:", 7) == 0) { for (pattern += 7; ((*__ctype_b_loc())[(int)((*pattern))] & (unsigned short int)_ISspace); ++pattern) ; if (strcmp(pattern, "regexp") == 0) *hgopt = (1 << 27); else if (strcmp(pattern, "glob") == 0) *hgopt = (1 << 28); return; } len = strlen(pattern); if (pattern[len - 1] == '/') { char *p; --len; p = xmalloc(len + 1); memcpy(p, pattern, len); p[len] = 0; pattern = p; exclude_add_pattern_buffer(ex, p); options |= (1 << 3) | (1 << 26); } add_exclude(ex, pattern, ((*hgopt == (1 << 27)) ? (options & ~(1 << 28)) : (options & ~(1 << 27))) | *hgopt); }
long long hg_addfn(unsigned long long a0, void *a1, unsigned long a2, unsigned int *a3) { unsigned long long v0; char *v1; unsigned long v2; char *v3; unsigned int v6; unsigned long long v7; unsigned long long v9; v1 = a1; *(&v0) = a2; while (true) { v6 = *((*(v1) * 2 + *(__ctype_b_loc()))) & 0x2000; if (!v6) break; v1 += 1; } v9 = *(v1); if (*(v1)) { v9 = *(v1); if (*(v1) != 35) { v7 = strncmp(v1, "syntax:", 0x7); if (!v7) { v1 += 7; while (true) { *(&v7) = *((*(v1) * 2 + *(__ctype_b_loc()))); *(&v7) = v7 & 0x2000; if (!v7) break; v1 += 1; } if (!strcmp(v1, "regexp")) { v9 = a3; *(a3) = 0x8000000; } else { v9 = strcmp(v1, "glob"); if (!v9) { v9 = a3; *(a3) = 0x10000000; } } } else { v2 = strlen(v1); if (v1[1 + v2] == 47) { v2 -= 1; v3 = xmalloc(v2 + 1); memcpy(v3, v1, v2); *((v2 + v3)) = 0; v1 = v3; exclude_add_pattern_buffer(a0, v3, v3); *(&v0) = v0 | 67108872; } if (*(a3) == 0x8000000) *(&v7) = v0 & 4026531839; else *(&v7) = v0 & -134217729; v9 = add_exclude(a0, v1, *(a3) | v7, v1); } } } return v9; }
tar
angr_dream
static void flush_deferred_unlinks(_Bool force) { struct deferred_unlink *p, *prev = ((void *)0); int saved_chdir = chdir_current; for (p = dunlink_head; p;) { struct deferred_unlink *next = p->next; if (force || records_written > p->records_written + deferred_unlink_delay) { chdir_do(p->dir_idx); if (p->is_dir) { const char *fname; if (p->dir_idx && ((p)->is_dir && ((p)->file_name[0] == 0 || strcmp((p)->file_name, ".") == 0))) { prev = p; p = next; continue; } else fname = p->file_name; if (unlinkat(chdir_fd, fname, 0x200) != 0) { switch ((*__errno_location())) { case 2: break; case 17: case 39: prev = p; p = next; continue; default: rmdir_error(fname); } } } else { if (unlinkat(chdir_fd, p->file_name, 0) != 0 && (*__errno_location()) != 2) unlink_error(p->file_name); } dunlink_reclaim(p); dunlink_count--; p = next; if (prev) prev->next = p; else dunlink_head = p; } else { prev = p; p = next; } } if (!dunlink_head) dunlink_tail = ((void *)0); else if (force) { for (p = dunlink_head; p;) { struct deferred_unlink *next = p->next; const char *fname; chdir_do(p->dir_idx); if (p->dir_idx && ((p)->is_dir && ((p)->file_name[0] == 0 || strcmp((p)->file_name, ".") == 0))) { fname = tar_dirname(); chdir_do(p->dir_idx - 1); } else fname = p->file_name; if (unlinkat(chdir_fd, fname, 0x200) != 0) { if ((*__errno_location()) != 2) rmdir_error(fname); } dunlink_reclaim(p); dunlink_count--; p = next; } dunlink_head = dunlink_tail = ((void *)0); } chdir_do(saved_chdir); }
long flush_deferred_unlinks(char a1) { int v1; unsigned int v3; unsigned int *v4; long i; unsigned int **v6; char *v7; long v8; unsigned int *v9; char *name; v6 = 0LL; v3 = chdir_current; v4 = (unsigned int *)dunlink_head; while (v4) { v9 = *(unsigned int **)v4; if (a1 || (unsigned long)(deferred_unlink_delay + *((_QWORD *)v4 + 4)) < records_written) { chdir_do(v4[2]); if (!*((_BYTE *)v4 + 24)) { if (unlinkat(chdir_fd, *((const char **)v4 + 2), 0) && *_errno_location() != 2) unlink_error(*((_QWORD *)v4 + 2)); goto LABEL_20; } if (v4[2] && *((_BYTE *)v4 + 24) && (!**((_BYTE **)v4 + 2) || !strcmp(*((const char **)v4 + 2), "."))) { v6 = (unsigned int **)v4; v4 = v9; } else { name = (char *)*((_QWORD *)v4 + 2); if (!unlinkat(chdir_fd, name, 512)) goto LABEL_20; v1 = *_errno_location(); if (v1 == 39) goto LABEL_15; if (v1 > 39) { LABEL_16: rmdir_error(name); goto LABEL_20; } if (v1 == 2) { LABEL_20: dunlink_reclaim((void **)v4); --dunlink_count; v4 = v9; if (v6) *v6 = v9; else dunlink_head = (long)v9; } else { if (v1 != 17) goto LABEL_16; LABEL_15: v6 = (unsigned int **)v4; v4 = v9; } } } else { v6 = (unsigned int **)v4; v4 = *(unsigned int **)v4; } } if (dunlink_head) { if (a1) { for (i = dunlink_head; i; i = v8) { v8 = *(_QWORD *)i; chdir_do(*(unsigned int *)(i + 8)); if (*(_DWORD *)(i + 8) && *(_BYTE *)(i + 24) && (!**(_BYTE **)(i + 16) || !strcmp(*(const char **)(i + 16), "."))) { v7 = (char *)tar_dirname(); chdir_do((unsigned int)(*(_DWORD *)(i + 8) - 1)); } else { v7 = *(char **)(i + 16); } if (unlinkat(chdir_fd, v7, 512) && *_errno_location() != 2) rmdir_error(v7); dunlink_reclaim((void **)i); --dunlink_count; } dunlink_tail = 0LL; dunlink_head = 0LL; } } else { dunlink_tail = 0LL; } return chdir_do(v3); }
tar
ida
static int sshsig_peek_hashalg(struct sshbuf *signature, char **hashalgp) { struct sshbuf *buf = ((void *)0); char *hashalg = ((void *)0); int r = -1; if (hashalgp != ((void *)0)) *hashalgp = ((void *)0); if ((buf = sshbuf_fromb(signature)) == ((void *)0)) return -2; if ((r = sshsig_parse_preamble(buf)) != 0) goto done; if ((r = sshbuf_get_string_direct(buf, ((void *)0), ((void *)0))) != 0 || (r = sshbuf_get_string_direct(buf, ((void *)0), ((void *)0))) != 0 || (r = sshbuf_get_string(buf, ((void *)0), ((void *)0))) != 0 || (r = sshbuf_get_cstring(buf, &hashalg, ((void *)0))) != 0 || (r = sshbuf_get_string_direct(buf, ((void *)0), ((void *)0))) != 0) { sshlog("sshsig.c", __func__, 274, 1, SYSLOG_LEVEL_ERROR, ssh_err(r), "parse signature object"); goto done; } r = 0; *hashalgp = hashalg; hashalg = ((void *)0); done: free(hashalg); sshbuf_free(buf); return r; }
int sshsig_peek_hashalg(undefined8 param_1, void **param_2) { undefined8 uVar1; long in_FS_OFFSET; undefined8 uVar2; int local_24; void *local_20; long local_18; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); local_18 = 0; local_20 = (void *)0x0; if (param_2 != (void **)0x0) { *param_2 = (void *)0x0; } local_18 = sshbuf_fromb(param_1); if (local_18 == 0) { local_24 = -2; goto LAB_00100dea; } local_24 = sshsig_parse_preamble(local_18); if (local_24 == 0) { local_24 = sshbuf_get_string_direct(local_18, 0, 0); if (local_24 == 0) { local_24 = sshbuf_get_string_direct(local_18, 0, 0); if (local_24 == 0) { local_24 = sshbuf_get_string(local_18, 0, 0); if (local_24 == 0) { local_24 = sshbuf_get_cstring(local_18, &local_20, 0); if (local_24 == 0) { local_24 = sshbuf_get_string_direct(local_18, 0, 0); if (local_24 == 0) { local_24 = 0; *param_2 = local_20; local_20 = (void *)0x0; goto LAB_00100dcf; } } } } } uVar2 = 0x100d75; uVar1 = ssh_err(local_24); sshlog("sshsig.c", "sshsig_peek_hashalg", 0x112, 1, 2, uVar1, "parse signature object", uVar2); } LAB_00100dcf: free(local_20); sshbuf_free(local_18); LAB_00100dea: if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) { __stack_chk_fail(); } return local_24; }
openssh-portable
ghidra
static void move_archive(off_t count) { if (count == 0) return; { struct mtop operation; if (count < 0 ? (operation.mt_op = 4, operation.mt_count = -count, operation.mt_count == -count) : (operation.mt_op = 3, operation.mt_count = count, operation.mt_count == count)) { if (0 <= (((archive) >= (1 << 30)) ? rmt_ioctl__(archive - (1 << 30), (((1U) << (((0 + 8) + 8) + 14)) | ((('m')) << (0 + 8)) | (((1)) << 0) | ((((sizeof(struct mtop)))) << ((0 + 8) + 8))), (char *)&operation) : ioctl(archive, (((1U) << (((0 + 8) + 8) + 14)) | ((('m')) << (0 + 8)) | (((1)) << 0) | ((((sizeof(struct mtop)))) << ((0 + 8) + 8))), (char *)&operation))) return; if ((*__errno_location()) == 5 && 0 <= (((archive) >= (1 << 30)) ? rmt_ioctl__(archive - (1 << 30), (((1U) << (((0 + 8) + 8) + 14)) | ((('m')) << (0 + 8)) | (((1)) << 0) | ((((sizeof(struct mtop)))) << ((0 + 8) + 8))), (char *)&operation) : ioctl(archive, (((1U) << (((0 + 8) + 8) + 14)) | ((('m')) << (0 + 8)) | (((1)) << 0) | ((((sizeof(struct mtop)))) << ((0 + 8) + 8))), (char *)&operation))) return; } } { off_t position0 = (((archive) >= (1 << 30)) ? rmt_lseek__(archive - (1 << 30), (off_t)0, 1) : lseek(archive, (off_t)0, 1)); off_t increment = record_size * (off_t)count; off_t position = position0 + increment; if (increment / count != record_size || (position < position0) != (increment < 0) || (position = position < 0 ? 0 : position, (((archive) >= (1 << 30)) ? rmt_lseek__(archive - (1 << 30), position, 0) : lseek(archive, position, 0)) != position)) seek_error_details(archive_name_array[0], position); return; } }
void move_archive(unsigned long a0) { unsigned long v0; void *v1; unsigned long v2; unsigned long long *v3; unsigned short v4; unsigned int v5; char v6; char v8; char v9; unsigned int v10; unsigned long long v11; unsigned int v12; void *v13; unsigned long long v14; unsigned long long *v15; unsigned long long v16; v0 = a0; if (a0) { if ((a0 - 0 >> 63)) { v4 = 4; v5 = -(a0); v8 = v5 == -(v0); } else { v4 = 3; v5 = a0; v8 = a0 == v5; } if (v8) { if (archive > 1073741823) v9 = !(rmt_ioctl__(archive - 0x40000000, 0x40086d01, &v4, archive - 0x40000000)) >> 31; else v9 = !(ioctl(archive, 0x40086d01)) >> 31; if (!v9) { v10 = *(__errno_location()); if (v10 == 5) { if (archive > 1073741823) *(&v10) = !(rmt_ioctl__(archive - 0x40000000, 0x40086d01, &v4, archive - 0x40000000)) >> 31; else *(&v10) = !(ioctl(archive, 0x40086d01)) >> 31; } } } if (!v8 || !v10 && !v9 || !v9 && v10 != 5) { if (archive > 1073741823) v11 = rmt_lseek__(archive - 0x40000000, 0x0, 0x1); else v11 = lseek(archive, 0x0, 0x1); v2 = v11; v3 = record_size * a0; v1 = v3 + v2; v12 = (v3 >> 63 CONCAT v3) / m a0; if ((v3 >> 63 CONCAT v3) / m a0 == record_size) { *(&v12) = v1 < v2; if (!((v3 >> 63) ^ v12)) { if ((v1 - 0 >> 63 ^ 1)) v13 = v1; else v13 = 0; v1 = v13; if (archive > 1073741823) v14 = rmt_lseek__(archive - 0x40000000, v1, 0x0); else v14 = lseek(archive, v1, 0x0); } } if ((v3 >> 63 CONCAT v3) / m a0 != record_size || ((v3 >> 63) ^ v12) || v14 != v1) seek_error_details(*(archive_name_array), v1, v1); } } v16 = *(&v6) ^ v15[5]; return; }
tar
angr_dream
static void x_obstack_grow(struct xheader *xhdr, const char *ptr, size_t length) { __extension__({ struct obstack *__o = (xhdr->stk); size_t __len = (length); if (__extension__({ struct obstack const *__o1 = (__o); (size_t)(__o1->chunk_limit - __o1->next_free); }) < __len) _obstack_newchunk(__o, __len); memcpy(__o->next_free, ptr, __len); __o->next_free += __len; (void)0; }); xhdr->size += length; }
void x_obstack_grow(unsigned long long a0[2], void *a1, unsigned long a2) { unsigned long long v0[5]; unsigned long long v1[5]; unsigned long long v3[2]; v0[0] = a0[0]; v1[0] = v0; if (v1[4] - v1[3] < a2) _obstack_newchunk(v0, a2, a2); memcpy(v0[3], a1, a2); v0[3] = v0[3] + a2; v3 = a0; a0[1] = a0[1] + a2; return; }
tar
angr_sailr
static void read_inittab(void) { FILE *fp; FILE *fp_tab; CHILD *ch, *old, *i; CHILD *head = ((void *)0); sigset_t nmask, omask; char buf[256]; char err[64]; char *id, *rlevel, *action, *process; char *p; int lineNo = 0; int actionNo; int f; int round; int foundOne = 0; int talk; int done = -1; DIR *tabdir = ((void *)0); struct dirent *file_entry; char f_name[272]; if ((fp = fopen("/etc/inittab", "r")) == ((void *)0)) initlog((1 | 2), "No inittab file found"); if ((tabdir = opendir("/etc/inittab.d")) == ((void *)0)) initlog((1 | 2), "No inittab.d directory found"); while (done != 1) { if (done == -1) { if (fp == ((void *)0) || fgets(buf, sizeof(buf), fp) == ((void *)0)) { done = 0; for (old = newFamily; old; old = old->next) if (strpbrk(old->rlevel, "S")) break; if (old == ((void *)0)) snprintf(buf, sizeof(buf), "~~:S:wait:%s\n", "/sbin/sulogin"); else continue; } } else if (done == 0) { if (tabdir != ((void *)0)) { if ((file_entry = readdir(tabdir)) != ((void *)0)) { if (!strcmp(file_entry->d_name, ".") || !strcmp(file_entry->d_name, "..")) continue; if (strlen(file_entry->d_name) < 5 || strcmp(file_entry->d_name + strlen(file_entry->d_name) - 4, ".tab")) continue; memset(f_name, 0, sizeof(char) * 272); snprintf(f_name, 272, "/etc/inittab.d/%s", file_entry->d_name); initlog((1 | 2), "Reading: %s", f_name); if ((fp_tab = fopen(f_name, "r")) == ((void *)0)) continue; while (fgets(buf, sizeof(buf), fp_tab) != ((void *)0)) { for (p = buf; *p == ' ' || *p == '\t'; p++) ; if (*p != '#' && *p != '\n') break; } fclose(fp_tab); if (strlen(p) == 0) continue; } else { done = 1; continue; } } else { done = 1; continue; } } lineNo++; for (p = buf; *p == ' ' || *p == '\t'; p++) ; if (*p == '#' || *p == '\n') continue; id = strsep(&p, ":"); rlevel = strsep(&p, ":"); action = strsep(&p, ":"); process = strsep(&p, "\n"); err[0] = 0; if (!id || !*id) strcpy(err, "missing id field"); if (!rlevel) strcpy(err, "missing runlevel field"); if (!process) strcpy(err, "missing process field"); if (!action || !*action) strcpy(err, "missing action field"); if (id && strlen(id) > sizeof(utproto.ut_id)) sprintf(err, "id field too long (max %d characters)", (int)sizeof(utproto.ut_id)); if (rlevel && strlen(rlevel) > 11) strcpy(err, "rlevel field too long (max 11 characters)"); if (process && strlen(process) > 127) strcpy(err, "process field too long (max 127 characters)"); if (action && strlen(action) > 32) strcpy(err, "action field too long"); if (err[0] != 0) { initlog((1 | 2), "%s[%d]: %s", "/etc/inittab", lineNo, err); ; continue; } actionNo = -1; for (f = 0; actions[f].name; f++) if (strcasecmp(action, actions[f].name) == 0) { actionNo = actions[f].act; break; } if (actionNo == -1) { initlog((1 | 2), "%s[%d]: %s: unknown action field", "/etc/inittab", lineNo, action); continue; } for (old = newFamily; old; old = old->next) { if (strcmp(old->id, id) == 0 && strcmp(id, "~~")) { initlog((1 | 2), "%s[%d]: duplicate ID field \"%s\"", "/etc/inittab", lineNo, id); break; } } if (old) continue; ch = imalloc(sizeof(CHILD)); ch->action = actionNo; strncpy(ch->id, id, sizeof(utproto.ut_id) + 1); strncpy(ch->process, process, sizeof(ch->process) - 1); if (rlevel[0]) { for (f = 0; f < (int)sizeof(rlevel) - 1 && rlevel[f]; f++) { ch->rlevel[f] = rlevel[f]; if (ch->rlevel[f] == 's') ch->rlevel[f] = 'S'; } strncpy(ch->rlevel, rlevel, sizeof(ch->rlevel) - 1); } else { strcpy(ch->rlevel, "0123456789"); if (((ch->action) == 7 || (ch->action) == 6 || (ch->action) == 8 || (ch->action) == 14 || (ch->action) == 9)) strcpy(ch->rlevel, "S0123456789"); } if (ch->action == 13) strcpy(ch->rlevel, "#"); if (ch->action == 4 || ch->action == 5) strcpy(ch->rlevel, "*"); if (((ch->action) == 7 || (ch->action) == 6 || (ch->action) == 8 || (ch->action) == 14 || (ch->action) == 9)) { ch->flags |= 128; old = ((void *)0); for (i = newFamily; i; i = i->next) { if (!((i->action) == 7 || (i->action) == 6 || (i->action) == 8 || (i->action) == 14 || (i->action) == 9)) break; old = i; } if (old) { ch->next = i; old->next = ch; if (i == ((void *)0)) head = ch; } else { ch->next = newFamily; newFamily = ch; if (ch->next == ((void *)0)) head = ch; } } else { if (ch->action == 15) ch->flags |= 128; ch->next = ((void *)0); if (head) head->next = ch; else newFamily = ch; head = ch; } for (old = family; old; old = old->next) if (strcmp(old->id, ch->id) == 0) { old->new = ch; break; } } if (fp) fclose(fp); if (tabdir) closedir(tabdir); check_kernel_console(); ; for (round = 0; round < 2; round++) { talk = 1; for (ch = family; ch; ch = ch->next) { ch->flags &= ~4; if (ch->new == ((void *)0)) ch->flags |= 4; if (ch->new && ch->action != ch->new->action) ch->flags |= 4; if (ch->action != 4 && strchr(ch->rlevel, runlevel) == ((void *)0)) { if (runlevel == 'S' || !(ch->flags & 8)) ch->flags |= 4; } if ((ch->flags & 4) == 0) { ch->new->flags = ch->flags; ch->new->pid = ch->pid; ch->new->exstat = ch->exstat; continue; } if ((ch->flags & 2) == 0) { ch->flags &= ~4; continue; }; switch (round) { case 0: if (talk) initlog( 1, "Sending processes configured via /etc/inittab the TERM signal"); kill(-(ch->pid), 15); foundOne = 1; break; case 1: if (talk) initlog( 1, "Sending processes configured via /etc/inittab the KILL signal"); kill(-(ch->pid), 9); break; } talk = 0; } if (foundOne && round == 0) { for (f = 0; f < 100 * sleep_time; f++) { for (ch = family; ch; ch = ch->next) { if (!(ch->flags & 4)) continue; if ((ch->flags & 2) && !(ch->flags & 64)) break; } if (ch == ((void *)0)) { round = 1; foundOne = 0; break; } do_msleep(10); } } } if (foundOne) do_msleep(10); for (ch = family; ch; ch = ch->next) if (ch->flags & 4) { if (!(ch->flags & 64)) initlog(1, "Pid %d [id %s] seems to hang", ch->pid, ch->id); else { ; ch->flags &= ~2; if (ch->process[0] != '+') write_utmp_wtmp("", ch->id, ch->pid, 8, ((void *)0)); } } sigemptyset(&nmask); sigaddset(&nmask, 17); sigprocmask(0, &nmask, &omask); for (ch = family; ch; ch = old) { old = ch->next; free(ch); } family = newFamily; for (ch = family; ch; ch = ch->next) ch->new = ((void *)0); newFamily = ((void *)0); sigprocmask(2, &omask, ((void *)0)); }
void read_inittab(unsigned int a0, unsigned int a1, void *a2, unsigned int a3, unsigned int a4, unsigned int a5) { unsigned int v0; unsigned int v1; unsigned int v2; unsigned int v3; unsigned int v4; unsigned int v5; unsigned int v6; char *v7; struct_1 *v8; struct_5 *v9; struct_3 *v10; void *v11; unsigned long long v12; void *v13; unsigned long v14; void *v15; char *v16; char *v17; char *v18; char *v19; char v20; char v21; char v22; char v23; char v24; char v25; unsigned long long v34; unsigned long long v36; unsigned long long v40; unsigned long long v41; void *v42; void *v43; unsigned long long v45; unsigned long long *v47; unsigned long long v48; v11 = 0; v0 = 0; v4 = 0; v6 = -1; v12 = 0; v13 = fopen("/etc/inittab", "r"); if (!v13) initlog(0x3, "No inittab file found", a2, a3, a4, a5); v12 = opendir("/etc/inittab.d"); if (!v12) initlog(0x3, "No inittab.d directory found", a2, a3, a4, a5); while (true) { while (true) { while (true) { if (v6 != 1) { if (v6 == -1) { if (v13) a1 = 0x100; if (!v13 || !fgets(&v23, 0x100, v13)) { v6 = 0; for (v9 = newFamily; v9; v9 = v9->field_c0) { if (strpbrk(&v9->padding_c[24], "S")) break; } if (v9) continue; a3 = &g_4075bd; snprintf(&v23, 0x100, "~~:S:wait:%s\n", &g_4075bd); } } if (!v6) { if (v12) { v14 = readdir(v12); if (v14) { if (!strcmp(v14 + 19, ".")) continue; if (!strcmp(v14 + 19, "..")) continue; if (strlen(v14 + 19) <= 4) continue; if (strcmp(strlen(v14 + 19) - 4 + v14 + 19, ".tab")) continue; memset(&v24, 0x0, 0x110); a3 = v14 + 19; snprintf(&v24, 0x110, "/etc/inittab.d/%s", (v14 + 19)); initlog(0x3, "Reading: %s", &v24, v14 + 19, a4, a5); v15 = fopen(&v24, "r"); if (!v15) continue; do { a1 = 0x100; if (!fgets(&v23, 0x100, v15)) break; v7 = &v23; while (true) { if (*(v7) != 32) { if (*(v7) != 9) break; } v7 += 1; } if (*(v7) == 35) continue; } while (*(v7) == 10); fclose(v15); v34 = strlen(v7); continue; } else { v6 = 1; continue; } } else { v6 = 1; continue; } } if (v6 == -1 || v6 || v14 && v12 && v34) { v0 += 1; v7 = &v23; while (true) { if (*(v7) != 32) { if (*(v7) != 9) break; } v7 += 1; } if (*(v7) == 35) continue; if (*(v7) == 10) continue; v16 = strsep(&v7, ":"); v17 = strsep(&v7, ":"); v18 = strsep(&v7, ":"); v19 = strsep(&v7, "\n"); v22 = 0; if (!*(v16) || !v16) strcpy(&v22, "missing id field"); if (!v17) strcpy(&v22, "missing runlevel field"); if (!v19) strcpy(&v22, "missing process field"); if (!*(v18) || !v18) strcpy(&v22, "missing action field"); if (v16 && strlen(v16) > 4) sprintf(&v22, "id field too long (max %d characters)", 4); if (!v17) break; if (v17) { v36 = strlen(v17); if (v36 <= 11) break; if (v36 > 11) { strcpy(&v22, "rlevel field too long (max 11 characters)"); break; } } } } else { if (v13) fclose(v13); if (v12) closedir(v12); check_kernel_console(a0, a1, a2, a3, a4, a5); for (v3 = 0; v3 <= 1; v3 += 1) { v5 = 1; for (v8 = family; v8; v8 = v8->field_c0) { v45 = v8->field_0 & -5; v8->field_0 = v8->field_0 & -5; if (!v8->field_b8) { v45 = v8->field_0 | 4; v8->field_0 = v8->field_0 | 4; } if (v8->field_b8) { v45 = v8->field_30; if (v8->field_30 != v8->field_b8->field_30) { v45 = v8->field_0 | 4; v8->field_0 = v8->field_0 | 4; } } if (v8->field_30 != 4 && !strchr(&v8->padding_c[24], runlevel) && (runlevel == 83 || !(v8->field_0 & 8))) { v45 = v8->field_0 | 4; v8->field_0 = v8->field_0 | 4; } if (!(v8->field_0 & 4)) { v8->field_b8->field_0 = v8->field_0; v8->field_b8->field_8 = v8->field_8; v8->field_b8->field_4 = v8->field_4; } else if (!(v8->field_0 & 2)) { v8->field_0 = v8->field_0 & -5; } else { if (!v3) { if (v5) initlog(0x1, "Sending processes configured via /etc/inittab the " "TERM signal", v45, a3, a4, a5); kill(-(v8->field_8), 0xf); v4 = 1; } else if (v3 == 1) { if (v5) initlog(0x1, "Sending processes configured via /etc/inittab the " "KILL signal", v45, a3, a4, a5); kill(-(v8->field_8), 0x9); } v5 = 0; } } if (v4 && !v3) { for (v2 = 0; v2 < sleep_time * 100; v2 += 1) { for (v8 = family; v8; v8 = v8->field_c0) { if ((v8->field_0 & 4) && (v8->field_0 & 2)) { if (!(v8->field_0 & 64)) break; } } if (!v8) { v3 = 1; v4 = 0; break; } else { do_msleep(0xa); } } } } if (v4) do_msleep(0xa); for (v8 = family; v8; v8 = v8->field_c0) { if ((v8->field_0 & 4)) { if (!(v8->field_0 & 64)) { initlog(0x1, "Pid %d [id %s] seems to hang", v8->field_8, &v8->padding_c[16], a4, a5); } else { v8->field_0 = v8->field_0 & -3; if (v8->field_34 != 43) write_utmp_wtmp(&g_407481, &v8->padding_c[16], v8->field_8, 0x8, 0x0); } } } sigemptyset(&v20); sigaddset(&v20, 0x11); sigprocmask(0x0, &v20, &v21); for (v8 = family; v8; v8 = v9) { v9 = v8->field_c0; free(v8); } family = newFamily; for (v8[0] = family; v8; v8[0] = v8[24]) { v8->field_b8 = 0; } newFamily = 0; sigprocmask(0x2, &v21, NULL); v48 = *(&v25) ^ v47[5]; return; } } if (v19 && strlen(v19) > 127) strcpy(&v22, "process field too long (max 127 characters)"); if (v18 && strlen(v18) > 32) strcpy(&v22, "action field too long"); if (v22) { initlog(0x3, "%s[%d]: %s", "/etc/inittab", v0, &v22, a5); } else { v1 = -1; v2 = 0; while (true) { a2 = v2 * 16; if (!actions[2 * v2]) break; if (!strcasecmp(v18, actions[2 * v2])) { a2 = v2 * 16; v1 = (&g_407c28)[2 * v2]; break; } else { v2 += 1; } } if (v1 == -1) { initlog(0x3, "%s[%d]: %s: unknown action field", "/etc/inittab", v0, v18, a5); } else { for (v9 = newFamily; v9; v9 = v9->field_c0) { v40 = strcmp(&v9->padding_c[16], v16); if (!v40) { v41 = strcmp(v16, "~~"); if (v41) { initlog(0x3, "%s[%d]: duplicate ID field \"%s\"", "/etc/inittab", v0, v16, a5); break; } } } if (!v9) break; } } } v42 = imalloc(0xc8, a1, a2, a3, v16, a5); v8 = v42; *(&v8[48]) = v1; strncpy(v8 + 28, v16, 0x5); strncpy(v8 + 52, v19, 0x7f); if (*(v17)) { for (v2 = 0; v2 <= 6; v2 += 1) { if (!v17[v2]) break; if (v17[v2]) { *(36 + v8 + v2) = v17[v2]; if (*(36 + v8 + v2) == 115) *(36 + v8 + v2) = 83; } } strncpy(v8 + 36, v17, 0xb); } else { strcpy(v8 + 36, "0123456789"); if (v8[48] == 8 || v8[48] == 6 || v8[48] == 9 || v8[48] == 14 || v8[48] == 7) strcpy(v8 + 36, "S0123456789"); } if (v8[48] == 13) strcpy(v8 + 36, "#"); if (v8[48] == 4 || v8[48] == 5) strcpy(v8 + 36, "*"); if (v8[48] != 7 && v8[48] != 6 && v8[48] != 8 && v8[48] != 14 && v8[48] != 9) { if (v8[48] == 15) { v43 = *(v8); *(&v43) = v8->field_0 | 128; a2 = v43; *(v8) = v43; } *(&v8[192]) = 0; if (v11) { a2 = v8; *(&v11[192]) = v8; } else { newFamily = v8; } v11 = v8; } if (v8[48] == 9 || v8[48] == 6 || v8[48] == 7 || v8[48] == 8 || v8[48] == 14) { *(&v42) = *(v8); *(&v42) = v8->field_0 | 128; *(v8) = v42; v9 = 0; for (v10 = newFamily; v10; v10 = v10->field_c0) { if (v10->field_30 != 7 && v10->field_30 != 6 && v10->field_30 != 8 && v10->field_30 != 14) { if (v10->field_30 != 9) break; } v9 = v10; } if (v9) { *(&v8[192]) = v10; a2 = v8; *(&v9[192]) = v8; if (!v10) v11 = v8; } else { a2 = newFamily; *(&v8[192]) = newFamily; newFamily = v8; if (!v8[192]) v11 = v8; } } for (v9 = family; v9; v9 = v9->field_c0) { if (!strcmp(&v9->padding_c[16], v8 + 28)) { a2 = v8; v9->field_b8 = v8; break; } } } }
sysvinit
angr_dream
static intmax_t expr_streval(tok, e, lvalue) char *tok; int e; struct lvalue *lvalue; { SHELL_VAR *v; char *value; intmax_t tval; int initial_depth; arrayind_t ind; int tflag, aflag; array_eltstate_t es; if (noeval) return (0); initial_depth = expr_depth; tflag = (assoc_expand_once && already_expanded) ? 0x020 : 0; aflag = tflag; v = (e == ']') ? array_variable_part(tok, tflag, (char **)0, (int *)0) : find_variable(tok); if (v == 0 && e != ']') v = find_variable_last_nameref(tok, 0); if ((v == 0 || ((((v)->attributes) & (0x0001000)))) && unbound_vars_is_error) { value = (e == ']') ? array_variable_name(tok, tflag, (char **)0, (int *)0) : tok; set_exit_status(1); err_unboundvar(value); if (e == ']') do { if (value) sh_xfree((value), "expr.c", 1191); } while (0); if (no_longjmp_on_fatal_error && interactive_shell) siglongjmp((evalbuf), (1)); if (interactive_shell) { expr_unwind(); top_level_cleanup(); jump_to_top_level(2); } else jump_to_top_level(1); } init_eltstate(&es); es.ind = -1; value = (e == ']') ? get_array_value(tok, aflag, &es) : get_variable_value(v); ind = es.ind; flush_eltstate(&es); if (expr_depth < initial_depth) { if (no_longjmp_on_fatal_error && interactive_shell) siglongjmp((evalbuf), (1)); return (0); } tval = (value && *value) ? subexpr(value) : 0; if (lvalue) { lvalue->tokstr = tok; lvalue->tokval = tval; lvalue->tokvar = v; lvalue->ind = ind; } return (tval); }
long expr_streval(long param_1, int param_2, long *param_3) { int iVar1; undefined4 uVar2; long lVar3; long lVar4; char *pcVar5; long in_FS_OFFSET; long local_58; undefined local_38[8]; long local_30; long local_10; iVar1 = expr_depth; local_10 = *(long *)(in_FS_OFFSET + 0x28); if (noeval == 0) { if ((assoc_expand_once == 0) || (already_expanded == 0)) { uVar2 = 0; } else { uVar2 = 0x20; } if (param_2 == 0x5d) { local_58 = array_variable_part(param_1, uVar2, 0, 0); } else { local_58 = find_variable(param_1); } if ((local_58 == 0) && (param_2 != 0x5d)) { local_58 = find_variable_last_nameref(param_1, 0); } if (((local_58 == 0) || ((*(uint *)(local_58 + 0x28) & 0x1000) != 0)) && (unbound_vars_is_error != 0)) { lVar4 = param_1; if (param_2 == 0x5d) { lVar4 = array_variable_name(param_1, uVar2, 0, 0); } set_exit_status(1); err_unboundvar(lVar4); if ((param_2 == 0x5d) && (lVar4 != 0)) { sh_xfree(lVar4, "expr.c", 0x4a7); } if ((no_longjmp_on_fatal_error != 0) && (interactive_shell != 0)) { siglongjmp((__jmp_buf_tag *)evalbuf, 1); } if (interactive_shell != 0) { expr_unwind(); top_level_cleanup(); jump_to_top_level(2); } jump_to_top_level(1); } init_eltstate(local_38); local_30 = -1; if (param_2 == 0x5d) { pcVar5 = (char *)get_array_value(param_1, uVar2, local_38); } else { pcVar5 = (char *)get_variable_value(local_58); } lVar4 = local_30; flush_eltstate(local_38); if (expr_depth < iVar1) { if ((no_longjmp_on_fatal_error != 0) && (interactive_shell != 0)) { siglongjmp((__jmp_buf_tag *)evalbuf, 1); } lVar3 = 0; } else { if ((pcVar5 == (char *)0x0) || (*pcVar5 == '\0')) { lVar3 = 0; } else { lVar3 = subexpr(pcVar5); } if (param_3 != (long *)0x0) { *param_3 = param_1; param_3[1] = lVar3; param_3[2] = local_58; param_3[3] = lVar4; } } } else { lVar3 = 0; } if (local_10 == *(long *)(in_FS_OFFSET + 0x28)) { return lVar3; } __stack_chk_fail(); }
bash
ghidra
static void find_jobs(int vtime, cron_db *db, int doWild, int doNonWild, long vGMToff) { char *orig_tz, *job_tz; struct tm *tm; int minute, hour, dom, month, dow; user *u; entry *e; orig_tz = getenv("TZ"); for (u = db->head; u != ((void *)0); u = u->next) { for (e = u->crontab; e != ((void *)0); e = e->next) { time_t virtualSecond = (time_t)(vtime - e->delay) * (time_t)60; time_t virtualGMTSecond = virtualSecond - vGMToff; job_tz = env_get("CRON_TZ", e->envp); do { char *t = job_tz; if (t != ((void *)0) && *t != '\0') { setenv("TZ", t, 1); tm = localtime(&virtualGMTSecond); } else { if ((orig_tz) != ((void *)0)) setenv("TZ", (orig_tz), 1); else unsetenv("TZ"); tm = gmtime(&virtualSecond); } minute = tm->tm_min - 0; hour = tm->tm_hour - 0; dom = tm->tm_mday - 1; month = tm->tm_mon + 1 - 1; dow = tm->tm_wday - 0; } while (0); if (((e->minute)[((minute) >> 3)] & (1 << ((minute) & 0x7))) && ((e->hour)[((hour) >> 3)] & (1 << ((hour) & 0x7))) && ((e->month)[((month) >> 3)] & (1 << ((month) & 0x7))) && (((e->flags & 0x04) || (e->flags & 0x08)) ? (((e->dow)[((dow) >> 3)] & (1 << ((dow) & 0x7))) && ((e->dom)[((dom) >> 3)] & (1 << ((dom) & 0x7)))) : (((e->dow)[((dow) >> 3)] & (1 << ((dow) & 0x7))) || ((e->dom)[((dom) >> 3)] & (1 << ((dom) & 0x7)))))) { if (job_tz != ((void *)0) && vGMToff != GMToff) continue; if ((doNonWild && !(e->flags & (0x01 | 0x02))) || (doWild && (e->flags & (0x01 | 0x02)))) job_add(e, u); } } } if (orig_tz != ((void *)0)) setenv("TZ", orig_tz, 1); else unsetenv("TZ"); }
unsigned long find_jobs(int a1, long **a2, int a3, int a4, long a5) { bool v5; int v10; int tm_wday; time_t v12; time_t timer; struct tm *v14; long *i; long j; char *v17; char *v18; char *value; unsigned long v20; v20 = __readfsqword(0x28u); v17 = getenv("TZ"); for (i = *a2; i; i = (long *)*i) { for (j = i[5]; j; j = *(_QWORD *)j) { v12 = 60LL * (a1 - *(_DWORD *)(j + 56)); timer = v12 - a5; v18 = (char *)env_get("CRON_TZ", *(_QWORD *)(j + 16)); value = v18; if (v18 && *value) { setenv("TZ", value, 1); v14 = localtime(&timer); } else { if (v17) setenv("TZ", v17, 1); else unsetenv("TZ"); v14 = gmtime(&v12); } v10 = v14->tm_mday - 1; tm_wday = v14->tm_wday; if ((((int)*(unsigned char *)(j + (v14->tm_min >> 3) + 32) >> (v14->tm_min & 7)) & 1) != 0 && (((int)*(unsigned char *)(j + (v14->tm_hour >> 3) + 40) >> (v14->tm_hour & 7)) & 1) != 0 && (((int)*(unsigned char *)(j + (v14->tm_mon >> 3) + 47) >> (v14->tm_mon & 7)) & 1) != 0) { if ((*(_DWORD *)(j + 52) & 4) != 0 || (*(_DWORD *)(j + 52) & 8) != 0) v5 = (((int)*(unsigned char *)(j + (tm_wday >> 3) + 49) >> (tm_wday & 7)) & 1) != 0 && (((int)*(unsigned char *)(j + (v10 >> 3) + 43) >> (v10 & 7)) & 1) != 0; else v5 = (((int)*(unsigned char *)(j + (tm_wday >> 3) + 49) >> (tm_wday & 7)) & 1) != 0 || (((int)*(unsigned char *)(j + (v10 >> 3) + 43) >> (v10 & 7)) & 1) != 0; if (v5 && (!v18 || a5 == GMToff) && (a4 && (*(_DWORD *)(j + 52) & 3) == 0 || a3 && (*(_DWORD *)(j + 52) & 3) != 0)) { job_add(j, i); } } } } if (v17) setenv("TZ", v17, 1); else unsetenv("TZ"); return __readfsqword(0x28u) ^ v20; }
cronie
ida
int _rl_search_getchar(_rl_search_cxt *cxt) { int c; (rl_readline_state |= (0x0000040)); c = cxt->lastc = rl_read_key(); (rl_readline_state &= ~(0x0000040)); if (c >= 0 && (__ctype_get_mb_cur_max()) > 1 && rl_byte_oriented == 0) c = cxt->lastc = _rl_read_mbstring(cxt->lastc, cxt->mb, 16); do { if (_rl_caught_signal) _rl_signal_handler(_rl_caught_signal); } while (0); return c; }
int _rl_search_getchar(struct_0 *a0) { unsigned int v0; rl_readline_state = rl_readline_state | 64; a0->field_6c = rl_read_key(); v0 = a0->field_6c; rl_readline_state = rl_readline_state & -65; if (v0 >= 0 && __ctype_get_mb_cur_max() > 1 && !rl_byte_oriented) { a0->field_6c = _rl_read_mbstring(a0->field_6c, a0 + 1, 0x10, a0 + 1); v0 = a0->field_6c; } if (_rl_caught_signal) _rl_signal_handler(_rl_caught_signal); return v0; }
bash
angr_phoenix
void _rl_standout_off(void) { if (_rl_term_so && _rl_term_se) tputs(_rl_term_se, 1, _rl_output_character_function); }
long long _rl_standout_off() { unsigned long long v1; v1 = _rl_term_so; if (_rl_term_so) { v1 = _rl_term_se; if (_rl_term_se) v1 = tputs(_rl_term_se, 0x1, _rl_output_character_function); } return v1; }
bash
angr_sailr
static void check_server_cmd(socket_st *socket, int ret) { if (socket->secure) { if (ret == -37) { log_msg(stdout, "*** Received rehandshake request\n"); ret = do_handshake(socket); if (ret == 0) { log_msg(stdout, "*** Rehandshake was performed.\n"); } else { log_msg(stdout, "*** Rehandshake Failed: %s\n", gnutls_strerror(ret)); } } else if (ret == -424) { do { ret = gnutls_reauth(socket->session, 0); } while (ret < 0 && gnutls_error_is_fatal(ret) == 0); if (ret == 0) { log_msg(stdout, "*** Re-auth was performed.\n"); } else { log_msg(stdout, "*** Re-auth failed: %s\n", gnutls_strerror(ret)); } } } }
void check_server_cmd(struct_0 *a0, unsigned long a1, unsigned long long a2) { unsigned int v0; unsigned long long v2; unsigned long long v4; unsigned long long v5; unsigned long long v6; unsigned long long v7; v0 = a1; v2 = a0->field_10; if (a0->field_10) { if (v0 == -37) { log_msg(*(&stdout), "*** Received rehandshake request\n", a2); v0 = do_handshake(a0); if (!v0) v5 = log_msg(*(&stdout), "*** Rehandshake was performed.\n", a2); else v7 = log_msg(*(&stdout), "*** Rehandshake Failed: %s\n", gnutls_strerror(v0)); } else if (v0 == -424) { while (true) { v0 = gnutls_reauth(a0->field_8, 0x0); if (v0 >= 0) break; if (gnutls_error_is_fatal(v0)) break; } if (!v0) v4 = log_msg(*(&stdout), "*** Re-auth was performed.\n", a2); else v6 = log_msg(*(&stdout), "*** Re-auth failed: %s\n", gnutls_strerror(v0)); } } return; }
gnutls
angr_dream
ARRAY_ELEMENT *array_unshift_element(a) ARRAY *a; { return (array_shift(a, 1, 0)); }
long long array_unshift_element(void *a0) { return array_shift(a0, 0x1, 0x0); }
bash
angr_sailr
int cron_change_user_permanently(struct passwd *pw, char *homedir) { if (setreuid(pw->pw_uid, pw->pw_uid) != 0) { log_it("CRON", getpid(), "ERROR", "setreuid failed", (*__errno_location())); return -1; } if (chdir(homedir) == -1) { log_it("CRON", getpid(), "ERROR chdir failed", homedir, (*__errno_location())); return -1; } log_close(); return 0; }
long long cron_change_user_permanently(struct_0 *a0, char *a1) { unsigned long long v2; if (setreuid(a0->field_10, a0->field_10)) { log_it("CRON", getpid(), "ERROR", "setreuid failed", *(__errno_location())); v2 = 4294967295; } else if (chdir(a1) != -1) { log_close(); v2 = 0; } else { log_it("CRON", getpid(), "ERROR chdir failed", a1, *(__errno_location())); v2 = 4294967295; } return v2; }
cronie
angr_phoenix
enum read_header tar_checksum(union block *header, _Bool silent) { size_t i; int unsigned_sum = 0; int signed_sum = 0; int recorded_sum; int parsed_sum; char *p; p = header->buffer; for (i = sizeof *header; i-- != 0;) { unsigned_sum += (unsigned char)*p; signed_sum += (signed char)(*p++); } if (unsigned_sum == 0) return HEADER_ZERO_BLOCK; for (i = sizeof header->header.chksum; i-- != 0;) { unsigned_sum -= (unsigned char)header->header.chksum[i]; signed_sum -= (signed char)(header->header.chksum[i]); } unsigned_sum += ' ' * sizeof header->header.chksum; signed_sum += ' ' * sizeof header->header.chksum; parsed_sum = from_header(header->header.chksum, sizeof header->header.chksum, 0, 0, 0x7fffffff, 1, silent); if (parsed_sum < 0) return HEADER_FAILURE; recorded_sum = parsed_sum; if (unsigned_sum != recorded_sum && signed_sum != recorded_sum) return HEADER_FAILURE; return HEADER_SUCCESS; }
int tar_checksum(unsigned long a0, unsigned long a1) { unsigned int v0; int tmp_31; unsigned int v1; unsigned int v2; unsigned int v3; unsigned long long v4; char *v5; unsigned long v7; v0 = 0; v1 = 0; v5 = a0; v4 = 0x200; while (true) { v7 = v4; v4 -= 1; if (!v7) break; v0 += *(v5); tmp_31 = v5; v5 += 1; *(&v7) = *(tmp_31); v1 += v7; } if (!v0) { *(&v7) = 3; return v7; } v4 = 8; while (true) { v7 = v4; v4 -= 1; if (!v7) break; v0 -= *((v4 + a0 + 148)); v1 -= *((v4 + a0 + 148)); } v0 += 0x100; v1 += 0x100; v2 = from_header(a0 + 148, 0x8, 0x0, 0x0, 0x7fffffff, 0x1, a1); if (v2 < 0) { *(&v7) = 5; return v7; } v3 = v2; if (v0 == v3) { *(&v7) = 1; return v7; } else if (v1 == v3) { *(&v7) = 1; return v7; } else { *(&v7) = 5; return v7; } }
tar
angr_sailr
void usage(int status) { if (status != 0) do { fprintf(stderr, gettext("Try '%s --help' for more information.\n"), program_name); } while (0); else { printf(gettext("Usage: %s [OPTION]...\n"), program_name); fputs_unlocked(gettext("Print the number of processing units available to " "the current process,\nwhich may be less than the " "number of online processors\n\n"), stdout) ; fputs_unlocked( gettext(" --all print the number of installed processors\n " " --ignore=N if possible, exclude N processing units\n"), stdout) ; fputs_unlocked(gettext(" --help display this help and exit\n"), stdout); fputs_unlocked( gettext(" --version output version information and exit\n"), stdout); emit_ancillary_info("nproc"); } exit(status); }
void usage(int a1) { long v1; char *v2; char *v3; FILE *v4; char *v5; FILE *v6; char *v7; FILE *v8; char *v9; FILE *v10; char *v11; v1 = program_name; if (a1) { v2 = gettext("Try '%s --help' for more information.\n"); fprintf(stderr, v2, v1); } else { v3 = gettext("Usage: %s [OPTION]...\n"); printf(v3, v1); v4 = stdout; v5 = gettext("Print the number of processing units available to the " "current process,\n" "which may be less than the number of online processors\n" "\n"); fputs_unlocked(v5, v4); v6 = stdout; v7 = gettext(" --all print the number of installed processors\n" " --ignore=N if possible, exclude N processing units\n"); fputs_unlocked(v7, v6); v8 = stdout; v9 = gettext(" --help display this help and exit\n"); fputs_unlocked(v9, v8); v10 = stdout; v11 = gettext(" --version output version information and exit\n"); fputs_unlocked(v11, v10); emit_ancillary_info("nproc"); } exit(a1); }
coreutils
ida
struct link_util *get_link_kind(const char *id) { void *dlh; char buf[256]; struct link_util *l; for (l = linkutil_list; l; l = l->next) if (strcmp(l->id, id) == 0) return l; snprintf(buf, sizeof(buf), "%s/link_%s.so", get_ip_lib_dir(), id); dlh = dlopen(buf, 0x00001); if (dlh == ((void *)0)) { dlh = BODY; if (dlh == ((void *)0)) { dlh = BODY = dlopen(((void *)0), 0x00001); if (dlh == ((void *)0)) return ((void *)0); } } snprintf(buf, sizeof(buf), "%s_link_util", id); l = dlsym(dlh, buf); if (l == ((void *)0)) return ((void *)0); l->next = linkutil_list; linkutil_list = l; return l; }
int get_link_kind(char *a0) { unsigned long long v0; unsigned long long v1[2]; char v2; unsigned int v4; for (v1[0] = linkutil_list; v1; v1[0] = v1[0]) { if (!strcmp(v1[1], a0)) { v4 = v1; return v4; } } snprintf(&v2, 0x100, "%s/link_%s.so", get_ip_lib_dir(), a0); v0 = dlopen(&v2, 0x1); if (!v0) { v0 = BODY; if (!v0) { BODY = dlopen(0x0, 0x1); v0 = BODY; if (!v0) { v4 = 0; return v4; } } } snprintf(&v2, 0x100, "%s_link_util", a0); v1 = dlsym(v0, &v2, &v2); if (!v1) { v4 = 0; return v4; } *(v1) = linkutil_list; linkutil_list = v1; v4 = v1; return v4; }
iproute2-6.0.0
angr_sailr
static int macsec_parse_opt(struct link_util *lu, int argc, char **argv, struct nlmsghdr *n) { int ret; __u8 encoding_sa = 0xff; __u32 window = -1; enum macsec_offload offload; struct cipher_args cipher = {0}; enum macsec_validation_type validate; _Bool es = 0, scb = 0, send_sci = 0; int replay_protect = -1; struct sci sci = {0}; ret = get_sci_portaddr(&sci, &argc, &argv, 1, 1); if (ret < 0) { fprintf(stderr, "expected sci\n"); return -1; } if (ret > 0) { if (sci.sci) addattr_l(n, 1024, IFLA_MACSEC_SCI, &sci.sci, sizeof(sci.sci)); else addattr_l(n, 1024, IFLA_MACSEC_PORT, &sci.port, sizeof(sci.port)); } while (argc > 0) { if (strcmp(*argv, "cipher") == 0) { do { argv++; if (--argc <= 0) incomplete_command(); } while (0); if (cipher.id) duparg("cipher", *argv); if (strcmp(*argv, "default") == 0) cipher.id = 0x0080020001000001ULL; else if (strcmp(*argv, "gcm-aes-128") == 0 || strcmp(*argv, "GCM-AES-128") == 0) cipher.id = 0x0080C20001000001ULL; else if (strcmp(*argv, "gcm-aes-256") == 0 || strcmp(*argv, "GCM-AES-256") == 0) cipher.id = 0x0080C20001000002ULL; else invarg("expected: default, gcm-aes-128 or" " gcm-aes-256", *argv); } else if (strcmp(*argv, "icvlen") == 0) { do { argv++; if (--argc <= 0) incomplete_command(); } while (0); if (cipher.icv_len) duparg("icvlen", *argv); get_icvlen(&cipher.icv_len, *argv); } else if (strcmp(*argv, "encrypt") == 0) { do { argv++; if (--argc <= 0) incomplete_command(); } while (0); int i; i = parse_on_off("encrypt", *argv, &ret); if (ret != 0) return ret; addattr8(n, 1024, IFLA_MACSEC_ENCRYPT, i); } else if (strcmp(*argv, "send_sci") == 0) { do { argv++; if (--argc <= 0) incomplete_command(); } while (0); int i; i = parse_on_off("send_sci", *argv, &ret); if (ret != 0) return ret; send_sci = i; addattr8(n, 1024, IFLA_MACSEC_INC_SCI, send_sci); } else if (strcmp(*argv, "end_station") == 0) { do { argv++; if (--argc <= 0) incomplete_command(); } while (0); int i; i = parse_on_off("end_station", *argv, &ret); if (ret != 0) return ret; es = i; addattr8(n, 1024, IFLA_MACSEC_ES, es); } else if (strcmp(*argv, "scb") == 0) { do { argv++; if (--argc <= 0) incomplete_command(); } while (0); int i; i = parse_on_off("scb", *argv, &ret); if (ret != 0) return ret; scb = i; addattr8(n, 1024, IFLA_MACSEC_SCB, scb); } else if (strcmp(*argv, "protect") == 0) { do { argv++; if (--argc <= 0) incomplete_command(); } while (0); int i; i = parse_on_off("protect", *argv, &ret); if (ret != 0) return ret; addattr8(n, 1024, IFLA_MACSEC_PROTECT, i); } else if (strcmp(*argv, "replay") == 0) { do { argv++; if (--argc <= 0) incomplete_command(); } while (0); int i; i = parse_on_off("replay", *argv, &ret); if (ret != 0) return ret; replay_protect = !!i; } else if (strcmp(*argv, "window") == 0) { do { argv++; if (--argc <= 0) incomplete_command(); } while (0); ret = get_u32(&window, *argv, 0); if (ret) invarg("expected replay window size", *argv); } else if (strcmp(*argv, "validate") == 0) { do { argv++; if (--argc <= 0) incomplete_command(); } while (0); validate = parse_one_of( "validate", *argv, validate_str, (sizeof(validate_str) / sizeof((validate_str)[0])), &ret); if (ret != 0) return ret; addattr8(n, 1024, IFLA_MACSEC_VALIDATION, validate); } else if (strcmp(*argv, "encodingsa") == 0) { if (encoding_sa != 0xff) duparg2("encodingsa", "encodingsa"); do { argv++; if (--argc <= 0) incomplete_command(); } while (0); ret = get_an(&encoding_sa, *argv); if (ret) invarg("expected an { 0..3 }", *argv); } else if (strcmp(*argv, "offload") == 0) { do { argv++; if (--argc <= 0) incomplete_command(); } while (0); offload = parse_one_of("offload", *argv, offload_str, (sizeof(offload_str) / sizeof((offload_str)[0])), &ret); if (ret != 0) return ret; addattr8(n, 1024, IFLA_MACSEC_OFFLOAD, offload); } else { fprintf(stderr, "macsec: unknown command \"%s\"?\n", *argv); usage(stderr); return -1; } argv++; argc--; } if (!check_txsc_flags(es, scb, send_sci)) { fprintf(stderr, "invalid combination of send_sci/end_station/scb\n"); return -1; } if (window != -1 && replay_protect == -1) { fprintf(stderr, "replay window set, but replay protection not enabled. did you " "mean 'replay on window %u'?\n", window); return -1; } else if (window == -1 && replay_protect == 1) { fprintf(stderr, "replay protection enabled, but no window set. did you " "mean 'replay on window VALUE'?\n"); return -1; } if (cipher.id) addattr_l(n, 1024, IFLA_MACSEC_CIPHER_SUITE, &cipher.id, sizeof(cipher.id)); if (cipher.icv_len) addattr_l(n, 1024, IFLA_MACSEC_ICV_LEN, &cipher.icv_len, sizeof(cipher.icv_len)); if (replay_protect != -1) { addattr32(n, 1024, IFLA_MACSEC_WINDOW, window); addattr8(n, 1024, IFLA_MACSEC_REPLAY_PROTECT, replay_protect); } if (encoding_sa != 0xff) { addattr_l(n, 1024, IFLA_MACSEC_ENCODING_SA, &encoding_sa, sizeof(encoding_sa)); } return 0; }
long long macsec_parse_opt(unsigned long a0, unsigned long a1, unsigned long a2, unsigned long long a3) { unsigned long long *v0; unsigned int v1; unsigned long v2; char v3; char v4; char v5; char v6; unsigned int v7; unsigned int v8; unsigned int v9; unsigned int v10; unsigned int v11; unsigned int v12; unsigned int v13; unsigned int v14; unsigned int v15; unsigned int v16; unsigned int v17; unsigned long long v18; void *v19; void *v20; void *v21; unsigned long long v23; unsigned long long v24; unsigned long long v25; v2 = a0; v1 = a1; v0 = a2; v3 = 255; v8 = -1; v18 = 0; v19 = 0; v4 = 0; v5 = 0; v6 = 0; v9 = -1; v20 = 0; v21 = 0; v7 = get_sci_portaddr(&v20, &v1, &v0, 0x1, 0x1); if (v7 < 0) { fprintf(*(&stderr), "expected sci\n"); v23 = 4294967295; } else { if (v7 > 0) { if (v20) addattr_l(a3, 0x400, 0x1, &v20, 0x8); else addattr_l(a3, 0x400, 0x2, &v21, 0x2); } while (true) { if (v1 > 0) { v24 = strcmp(*(v0), "cipher"); if (!v24) { v0 = v0 + 1; v1 = v1 - 1; if (v1 <= 0) incomplete_command(); if (v18) duparg("cipher", *(v0)); v25 = strcmp(*(v0), "default"); if (!v25) { v18 = 36030996058996737; } else { v25 = strcmp(*(v0), "gcm-aes-128"); if (v25) { v25 = strcmp(*(v0), "GCM-AES-128"); if (v25) { v25 = strcmp(*(v0), "gcm-aes-256"); if (v25) { v25 = strcmp(*(v0), "GCM-AES-256"); if (v25) invarg("expected: default, gcm-aes-128 or gcm-aes-256", *(v0)); } if (!v25 || !v25) v18 = 36242102291529730; } } if (!v25 || !v25) v18 = 36242102291529729; } } if (v24 || v25 && v25 && v25 && v25 && v25) v25 = strcmp(*(v0), "icvlen"); if (v25 && (v25 || v24) && (v25 || v24) && (v25 || v24) && (v25 || v24) && (v25 || v24)) { v25 = strcmp(*(v0), "encrypt"); if (!v25) { v0 = v0 + 1; v1 = v1 - 1; if (v1 <= 0) incomplete_command(); v17 = parse_on_off("encrypt", *(v0), &v7); if (v7) { v23 = v7; break; } else { addattr8(a3, 0x400, 0x7, v17); } } else { v25 = strcmp(*(v0), "send_sci"); if (!v25) { v0 = v0 + 1; v1 = v1 - 1; if (v1 <= 0) incomplete_command(); v16 = parse_on_off("send_sci", *(v0), &v7); if (v7) { v23 = v7; break; } else { v6 = v16; addattr8(a3, 0x400, 0x9, v6); } } else { v25 = strcmp(*(v0), "end_station"); if (!v25) { v0 = v0 + 1; v1 = v1 - 1; if (v1 <= 0) incomplete_command(); v15 = parse_on_off("end_station", *(v0), &v7); if (v7) { v23 = v7; break; } else { v4 = v15; addattr8(a3, 0x400, 0xa, v4); } } else { v25 = strcmp(*(v0), "scb"); if (!v25) { v0 = v0 + 1; v1 = v1 - 1; if (v1 <= 0) incomplete_command(); v14 = parse_on_off("scb", *(v0), &v7); if (v7) { v23 = v7; break; } else { v5 = v14; addattr8(a3, 0x400, 0xb, v5); } } else { v25 = strcmp(*(v0), "protect"); if (!v25) { v0 = v0 + 1; v1 = v1 - 1; if (v1 <= 0) incomplete_command(); v13 = parse_on_off("protect", *(v0), &v7); if (v7) { v23 = v7; break; } else { addattr8(a3, 0x400, 0x8, v13); } } else { v25 = strcmp(*(v0), "replay"); if (!v25) { v0 = v0 + 1; v1 = v1 - 1; if (v1 <= 0) incomplete_command(); v12 = parse_on_off("replay", *(v0), &v7); if (v7) { v23 = v7; break; } else { v9 = v12; } } else { v25 = strcmp(*(v0), "window"); if (!v25) { v0 = v0 + 1; v1 = v1 - 1; if (v1 <= 0) incomplete_command(); v7 = get_u32(&v8, *(v0), 0x0, *(v0)); if (v7) invarg("expected replay window size", *(v0)); } } } } } } } } if (!v25 && (v25 || v24) && (v25 || v24) && (v25 || v24) && (v25 || v24) && (v25 || v24)) { v0 = v0 + 1; v1 = v1 - 1; if (v1 <= 0) incomplete_command(); if (v19) duparg("icvlen", *(v0)); get_icvlen(&v19, *(v0)); } if (v25 && v25 && (v25 || v24) && (v25 || v24) && (v25 || v24) && (v25 || v24) && (v25 || v24) && v25 && v25 && v25 && v25 && v25 && !v25 && v7 || v25 && v25 && (v25 || v24) && (v25 || v24) && (v25 || v24) && (v25 || v24) && (v25 || v24) && v25 && v25 && v25 && v25 && v25 && v25) { v25 = strcmp(*(v0), "validate"); if (!v25) { v0 = v0 + 1; v1 = v1 - 1; if (v1 <= 0) incomplete_command(); v11 = parse_one_of("validate", *(v0), &validate_str, 0x3, &v7); if (v7) { v23 = v7; break; } else { addattr8(a3, 0x400, 0xd, v11); } } else { v25 = strcmp(*(v0), "encodingsa"); if (!v25) { if (v3 != 255) duparg2("encodingsa", "encodingsa"); v0 = v0 + 1; v1 = v1 - 1; if (v1 <= 0) incomplete_command(); v7 = get_an(&v3, *(v0)); if (v7) invarg("expected an { 0..3 }", *(v0)); } } } if (...) { v25 = strcmp(*(v0), "offload"); if (!v25) { v0 = v0 + 1; v1 = v1 - 1; if (v1 <= 0) incomplete_command(); v10 = parse_one_of("offload", *(v0), &offload_str, 0x3, &v7); if (v7) { v23 = v7; break; } else { addattr8(a3, 0x400, 0xf, v10); } } else { fprintf(*(&stderr), "macsec: unknown command \"%s\"?\n", *(v0)); usage(*(&stderr)); v23 = 4294967295; break; } } if (...) { v0 = v0 + 1; v1 = v1 - 1; } } else { *(&v25) = check_txsc_flags(v4, v5, v6) ^ 1; if (v25) { fprintf(*(&stderr), "invalid combination of send_sci/end_station/scb\n"); v23 = 4294967295; break; } else { if (v8 != -1 && v9 == -1) { fprintf(*(&stderr), "replay window set, but replay protection not enabled. did " "you mean 'replay on window %u'?\n", v8); v23 = 4294967295; break; } if (v8 == -1 || v9 != -1) { if (v8 == -1 && v9 == 1) { fprintf(*(&stderr), "replay protection enabled, but no window set. did you " "mean 'replay on window VALUE'?\n"); v23 = 4294967295; break; } if (v8 != -1 || v9 != 1) { if (v18) addattr_l(a3, 0x400, 0x4, &v18, 0x8); if (v19) addattr_l(a3, 0x400, 0x3, &v19, 0x1); if (v9 != -1) { addattr32(a3, 0x400, 0x5, v8); addattr8(a3, 0x400, 0xc, v9); } if (v3 != 255) addattr_l(a3, 0x400, 0x6, &v3, 0x1); v23 = 0; break; } } } } } } return v23; }
iproute2-6.0.0
angr_dream
static _Bool wordchar(wint_t wc) { return wc == L'_' || iswalnum(wc); }
int wordchar(unsigned long a0) { unsigned int v1; unsigned int v2; if (a0 == 95 || iswalnum(a0)) v1 = 1; else v1 = 0; v2 = v1 & 1; return v2; }
grep
angr_sailr
void recordregion(int start, int end, int nulonly) { struct ifsregion *ifsp; if (ifslastp == ((void *)0)) { ifsp = &ifsfirst; } else { ({ suppressint++; ({ __asm__ __volatile__("" : : : "memory"); }); 0; }); ifsp = (struct ifsregion *)ckmalloc(sizeof(struct ifsregion)); ifsp->next = ((void *)0); ifslastp->next = ifsp; ({ ({ __asm__ __volatile__("" : : : "memory"); }); if (--suppressint == 0 && intpending) onint(); 0; }); } ifslastp = ifsp; ifslastp->begoff = start; ifslastp->endoff = end; ifslastp->nulonly = nulonly; }
void recordregion(unsigned long a0, unsigned long a1, unsigned long a2) { unsigned long long v0; struct_0 *v3; if (!ifslastp) { v0 = &ifsfirst; } else { suppressint = suppressint + 1; *(&v0) = ckmalloc(0x18); *(v0) = 0; *(ifslastp) = v0; suppressint = suppressint - 1; if (!suppressint && intpending) onint(); } ifslastp = v0; *((ifslastp + 8)) = a0; *((ifslastp + 12)) = a1; v3 = ifslastp; *((ifslastp + 16)) = a2; return; }
dash-0.5.11+git20210903+057cd650a4ed
angr_phoenix
static size_t src_to_dest_hash(void const *x, size_t table_size) { struct Src_to_dest const *p = x; return (uintmax_t)p->st_ino % table_size; }
ulong src_to_dest_hash(ulong *param_1, ulong param_2) { return *param_1 % param_2; }
coreutils
ghidra
void *malloc_watch(addr) void *addr; { register int i; void *ret; if (addr == 0) return addr; ret = (void *)0; return ret; }
long long malloc_watch(unsigned long long a0) { void *v0; void *v2; if (!a0) { v2 = a0; } else { v0 = 0; v2 = v0; } return v2; }
bash
angr_dream
char *percent_dollar_expand(const char *string, ...) { char *ret; int err; va_list ap; __builtin_va_start(ap, string); ret = vdollar_percent_expand(&err, 1, 1, string, ap); __builtin_va_end(ap); if (err) sshfatal("misc.c", __func__, 1384, 1, SYSLOG_LEVEL_FATAL, ((void *)0), "failed"); return ret; }
long long percent_dollar_expand() { char v0; unsigned long v1; unsigned int v2; unsigned int v3; unsigned long v4; unsigned long v5; unsigned long v6; char v7; unsigned long v8; unsigned long v9; unsigned long v10; unsigned long v11; unsigned long v12; int v13; int v14; int v15; int v16; int v17; int v18; int v19; int v20; unsigned long v21; unsigned long v22; unsigned long v23; unsigned long v24; unsigned long v25; unsigned long v26; char v27; int v28; int v29; int v30; int v31; int v32; int v33; int v34; int v35; unsigned long long *v36; unsigned int v37; v8 = v22; v9 = v23; v10 = v24; v11 = v25; v12 = v26; if (v27) { v13 = v28; v14 = v29; v15 = v30; v16 = v31; v17 = v32; v18 = v33; v19 = v34; v20 = v35; } v6 = v36[5]; v2 = 8; v3 = 48; v4 = &v21; v5 = &v7; v1 = vdollar_percent_expand(&v0, 0x1, 0x1, v37, &v2); if (*(&v0)) sshfatal("misc.c", "percent_dollar_expand", 0x568, 0x1, 0x1, 0x0, "failed"); if ((v6 ^ v36[5])) __stack_chk_fail(); return v1; }
openssh-portable
angr_sailr
int process_options(int argc, char **argv) { struct gnutls_cli_debug_options *opts = &gnutls_cli_debug_options; int opt; while ((opt = getopt_long(argc, argv, "!Vd:hp:v:", long_options, ((void *)0))) != (-1)) switch (opt) { case '\0': break; case 'd': opts->present.debug = 1; opts->arg.debug = optarg; opts->value.debug = parse_number(optarg); opts->enabled.debug = 1; break; case 'V': opts->present.verbose = 1; opts->enabled.verbose = 1; break; case 'p': opts->present.port = 1; opts->arg.port = optarg; opts->value.port = parse_number(optarg); opts->enabled.port = 1; break; case 0x7f + 2: case 0x7f + 1: opts->present.starttls_proto = 1; opts->arg.starttls_proto = optarg; opts->enabled.starttls_proto = 1; break; case 'v': opts->present.version = 1; opts->arg.version = optarg; opts->enabled.version = 1; break; case 'h': opts->present.help = 1; opts->enabled.help = 1; break; case '!': opts->present.more_help = 1; opts->enabled.more_help = 1; break; default: usage(stderr, 1); break; } if (gnutls_cli_debug_options.present.debug && gnutls_cli_debug_options.value.debug < 0) { error(1, 0, "%s option value %d is out of range.", "debug", opts->value.debug); } if (gnutls_cli_debug_options.present.debug && gnutls_cli_debug_options.value.debug > 9999) { error(1, 0, "%s option value %d is out of range", "debug", opts->value.debug); } if (gnutls_cli_debug_options.present.port && gnutls_cli_debug_options.value.port < 0) { error(1, 0, "%s option value %d is out of range.", "port", opts->value.port); } if (gnutls_cli_debug_options.present.port && gnutls_cli_debug_options.value.port > 65536) { error(1, 0, "%s option value %d is out of range", "port", opts->value.port); } if (gnutls_cli_debug_options.present.help) { usage(stdout, (0)); } if (gnutls_cli_debug_options.present.more_help) { pid_t pid; int pfds[2]; if (pipe(pfds) < 0) error(1, (*__errno_location()), "pipe"); pid = fork(); if (pid < 0) error(1, (*__errno_location()), "fork"); if (pid == 0) { close(pfds[0]); dup2(pfds[1], 1); close(pfds[1]); usage(stdout, 0); } else { const char *args[2]; const char *envvar; close(pfds[1]); dup2(pfds[0], 0); close(pfds[0]); envvar = secure_getenv("PAGER"); if (!envvar || *envvar == '\0') args[0] = "more"; else args[0] = envvar; args[1] = ((void *)0); execvp(args[0], (char *const *)args); exit(1); } } if (gnutls_cli_debug_options.present.version) { if (!gnutls_cli_debug_options.arg.version || !strcmp(gnutls_cli_debug_options.arg.version, "c")) { const char str[] = "gnutls-cli-debug 3.7.8\n" "Copyright (C) 2000-2021 Free Software Foundation, and others\n" "This is free software. It is licensed for use, modification and\n" "redistribution under the terms of the GNU General Public License,\n" "version 3 or later <http: "\n" "Please send bug reports to: <bugs@gnutls.org> \n"; fprintf(stdout, "%s", str); exit(0); } else if (!strcmp(gnutls_cli_debug_options.arg.version, "v")) { const char str[] = "gnutls-cli-debug 3.7.8\n"; fprintf(stdout, "%s", str); exit(0); } else if (!strcmp(gnutls_cli_debug_options.arg.version, "n")) { const char str[] = "gnutls-cli-debug 3.7.8\n" "Copyright (C) 2000-2021 Free Software Foundation, and others\n" "This is free software. It is licensed for use, modification and\n" "redistribution under the terms of the GNU General Public License,\n" "version 3 or later <http: "\n" "gnutls is free software: you can redistribute it and/or\n" "modify it under the terms of the GNU General Public License\n" "as published by the Free Software Foundation,\n" "either version 3 of the License, or (at your option) any later " "version.\n" "\n" "gnutls is distributed in the hope that it will be useful,\n" "but WITHOUT ANY WARRANTY; without even the implied warranty\n" "of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n" "See the GNU General Public License for more details.\n" "\n" "You should have received a copy of the GNU General Public License\n" "along with this program. If not, see <http: "\n" "Please send bug reports to: <bugs@gnutls.org> \n"; fprintf(stdout, "%s", str); exit(0); } else { error(1, 0, "version option argument 'a' invalid. Use:\n" " 'v' - version only\n" " 'c' - version and copyright\n" " 'n' - version and full copyright notice"); } } return optind; }
long process_options(int a1, char *const *a2) { int i; int *v3; int *v4; __pid_t v6; char *v7; int pipedes[2]; char *file[2]; char v10[936]; unsigned long v11; v11 = __readfsqword(0x28u); for (i = getopt_long(a1, a2, "!Vd:hp:v:", &long_options, 0LL); i != -1; i = getopt_long(a1, a2, "!Vd:hp:v:", &long_options, 0LL)) { if (i > 129) goto LABEL_15; if (i >= 86) { switch (i) { case 86: *((_BYTE *)&gnutls_cli_debug_options + 1) = 1; *((_BYTE *)&gnutls_cli_debug_options + 49) = 1; continue; case 100: gnutls_cli_debug_options = 1; *((_QWORD *)&gnutls_cli_debug_options + 1) = optarg; *((_DWORD *)&gnutls_cli_debug_options + 10) = parse_number(optarg); *((_BYTE *)&gnutls_cli_debug_options + 48) = 1; continue; case 104: *((_BYTE *)&gnutls_cli_debug_options + 5) = 1; *((_BYTE *)&gnutls_cli_debug_options + 53) = 1; continue; case 112: *((_BYTE *)&gnutls_cli_debug_options + 2) = 1; *((_QWORD *)&gnutls_cli_debug_options + 2) = optarg; *((_DWORD *)&gnutls_cli_debug_options + 11) = parse_number(optarg); *((_BYTE *)&gnutls_cli_debug_options + 50) = 1; continue; case 118: *((_BYTE *)&gnutls_cli_debug_options + 4) = 1; *((_QWORD *)&gnutls_cli_debug_options + 4) = optarg; *((_BYTE *)&gnutls_cli_debug_options + 52) = 1; continue; case 128: case 129: *((_BYTE *)&gnutls_cli_debug_options + 3) = 1; *((_QWORD *)&gnutls_cli_debug_options + 3) = optarg; *((_BYTE *)&gnutls_cli_debug_options + 51) = 1; continue; default: goto LABEL_15; } } if (i) { if (i != 33) LABEL_15: usage(stderr, 1); *((_BYTE *)&gnutls_cli_debug_options + 6) = 1; *((_BYTE *)&gnutls_cli_debug_options + 54) = 1; } } if (gnutls_cli_debug_options && *((int *)&gnutls_cli_debug_options + 10) < 0) error(1, 0, "%s option value %d is out of range.", "debug", *((unsigned int *)&gnutls_cli_debug_options + 10)); if (gnutls_cli_debug_options && *((int *)&gnutls_cli_debug_options + 10) > 9999) error(1, 0, "%s option value %d is out of range", "debug", *((unsigned int *)&gnutls_cli_debug_options + 10)); if (*((_BYTE *)&gnutls_cli_debug_options + 2) && *((int *)&gnutls_cli_debug_options + 11) < 0) error(1, 0, "%s option value %d is out of range.", "port", *((unsigned int *)&gnutls_cli_debug_options + 11)); if (*((_BYTE *)&gnutls_cli_debug_options + 2) && *((int *)&gnutls_cli_debug_options + 11) > 0x10000) error(1, 0, "%s option value %d is out of range", "port", *((unsigned int *)&gnutls_cli_debug_options + 11)); if (*((_BYTE *)&gnutls_cli_debug_options + 5)) usage(stdout, 0); if (*((_BYTE *)&gnutls_cli_debug_options + 6)) { if (pipe(pipedes) < 0) { v3 = _errno_location(); error(1, *v3, "pipe"); } v6 = fork(); if (v6 < 0) { v4 = _errno_location(); error(1, *v4, "fork"); } if (!v6) { close(pipedes[0]); dup2(pipedes[1], 1); close(pipedes[1]); usage(stdout, 0); } close(pipedes[1]); dup2(pipedes[0], 0); close(pipedes[0]); v7 = secure_getenv("PAGER"); if (v7 && *v7) file[0] = v7; else file[0] = "more"; file[1] = 0LL; execvp(file[0], file); exit(1); } if (*((_BYTE *)&gnutls_cli_debug_options + 4)) { if (!*((_QWORD *)&gnutls_cli_debug_options + 4) || !strcmp(*((const char **)&gnutls_cli_debug_options + 4), "c")) { strcpy( v10, "gnutls-cli-debug 3.7.8\n" "Copyright (C) 2000-2021 Free Software Foundation, and others\n" "This is free software. It is licensed for use, modification and\n" "redistribution under the terms of the GNU General Public License,\n" "version 3 or later <http: "\n" "Please send bug reports to: <bugs@gnutls.org> \n"); fprintf(stdout, "%s", v10); exit(0); } if (!strcmp(*((const char **)&gnutls_cli_debug_options + 4), "v")) { strcpy(v10, "gnutls-cli-debug 3.7.8\n"); fprintf(stdout, "%s", v10); exit(0); } if (!strcmp(*((const char **)&gnutls_cli_debug_options + 4), "n")) { strcpy( v10, "gnutls-cli-debug 3.7.8\n" "Copyright (C) 2000-2021 Free Software Foundation, and others\n" "This is free software. It is licensed for use, modification and\n" "redistribution under the terms of the GNU General Public License,\n" "version 3 or later <http: "\n" "gnutls is free software: you can redistribute it and/or\n" "modify it under the terms of the GNU General Public License\n" "as published by the Free Software Foundation,\n" "either version 3 of the License, or (at your option) any later " "version.\n" "\n" "gnutls is distributed in the hope that it will be useful,\n" "but WITHOUT ANY WARRANTY; without even the implied warranty\n" "of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n" "See the GNU General Public License for more details.\n" "\n" "You should have received a copy of the GNU General Public License\n" "along with this program. If not, see <http: "\n" "Please send bug reports to: <bugs@gnutls.org> \n"); fprintf(stdout, "%s", v10); exit(0); } error(1, 0, "version option argument 'a' invalid. Use:\n" "\t'v' - version only\n" "\t'c' - version and copyright\n" "\t'n' - version and full copyright notice"); } return (unsigned int)optind; }
gnutls
ida
int validate_inherited_value(var, type) SHELL_VAR *var; int type; { if (type == 0x0000004 && ((((var)->attributes) & (0x0000040)))) return 0; else if (type == 0x0000040 && ((((var)->attributes) & (0x0000004)))) return 0; else return 1; }
_BOOL8 validate_inherited_value(long a1, int a2) { if (a2 == 4 && (*(_DWORD *)(a1 + 40) & 0x40) != 0) return 0LL; return a2 != 64 || (*(_DWORD *)(a1 + 40) & 4) == 0; }
bash
ida
void clear_directory_table(void) { struct directory *dp; if (directory_table) hash_clear(directory_table); if (directory_meta_table) hash_clear(directory_meta_table); for (dp = dirhead; dp;) { struct directory *next = dp->next; free_directory(dp); dp = next; } dirhead = dirtail = ((void *)0); }
long clear_directory_table() { long result; void **i; void **v2; if (directory_table) hash_clear(directory_table); if (directory_meta_table) hash_clear(directory_meta_table); for (i = (void **)dirhead; i; i = v2) { v2 = (void **)*i; free_directory(i); } dirtail = 0LL; result = 0LL; dirhead = 0LL; return result; }
tar
ida
int unpackchk(const char *const *argv) { int totalcount, sects; struct sectionentry *sectionentries, *se, **sep; struct pkg_hash_iter *iter; struct pkginfo *pkg; const char *thissect; char buf[20]; int width; if (*argv) badusage(gettext("--%s takes no arguments"), cipaction->olong); modstatdb_open(msdbrw_readonly); totalcount = 0; sectionentries = ((void *)0); sects = 0; iter = pkg_hash_iter_new(); while ((pkg = pkg_hash_iter_next_pkg(iter))) { if (!yettobeunpacked(pkg, &thissect)) continue; for (se = sectionentries; se && strcasecmp(thissect, se->name); se = se->next) ; if (!se) { se = nfmalloc(sizeof(*se)); for (sep = &sectionentries; *sep && strcasecmp(thissect, (*sep)->name) > 0; sep = &(*sep)->next) ; se->name = thissect; se->count = 0; se->next = *sep; *sep = se; sects++; } se->count++; totalcount++; } pkg_hash_iter_free(iter); if (totalcount == 0) return 0; if (totalcount <= 12) { iter = pkg_hash_iter_new(); while ((pkg = pkg_hash_iter_next_pkg(iter))) { if (!yettobeunpacked(pkg, ((void *)0))) continue; describebriefly(pkg); } pkg_hash_iter_free(iter); } else if (sects <= 12) { for (se = sectionentries; se; se = se->next) { sprintf(buf, "%d", se->count); printf(gettext(" %d in %s: "), se->count, se->name); width = 70 - strlen(se->name) - strlen(buf); while (width > 59) { putchar(' '); width--; } iter = pkg_hash_iter_new(); while ((pkg = pkg_hash_iter_next_pkg(iter))) { const char *pkgname; if (!yettobeunpacked(pkg, &thissect)) continue; if (strcasecmp(thissect, se->name)) continue; pkgname = pkg_name(pkg, pnaw_nonambig); width -= strlen(pkgname); width--; if (width < 4) { printf(" ..."); break; } printf(" %s", pkgname); } pkg_hash_iter_free(iter); putchar('\n'); } } else { printf(ngettext(" %d package, from the following section:", " %d packages, from the following sections:", totalcount), totalcount); width = 0; for (se = sectionentries; se; se = se->next) { sprintf(buf, "%d", se->count); width -= (6 + strlen(se->name) + strlen(buf)); if (width < 0) { putchar('\n'); width = 73 - strlen(se->name) - strlen(buf); } printf(" %s (%d)", se->name, se->count); } putchar('\n'); } m_output(stdout, gettext("<standard output>")); return 0; }
long long unpackchk(unsigned long long *a0, unsigned long long a1, unsigned long long a2, unsigned long long a3, unsigned long long a4, unsigned long long a5) { unsigned int v0; unsigned int v1; unsigned int v2; void *v3; char v4; void *v5; struct_0 *v6; unsigned long long v7; void *v8; char *v9; char v10; unsigned long long v11; unsigned long long v12; unsigned long long v14; unsigned long long v15; unsigned long long v16; unsigned long long v17; unsigned long long v18; unsigned long long v19; unsigned long long v20; unsigned long long v22; unsigned long long v23; unsigned long long v24; v12 = v14; v11 = v15; if (*(a0)) badusage(gettext("--%s takes no arguments"), *(cipaction)); modstatdb_open(0x0); v0 = 0; v3 = 0; v1 = 0; v7 = pkg_hash_iter_new(0x0, *(cipaction), a2, a3, a4, a5); while (true) { v8 = pkg_hash_iter_next_pkg(v7); if (v8) { v16 = yettobeunpacked(v8, &v4) ^ 1; if (v16) continue; for (v5 = v3; v5; v5 = *(v5)) { v16 = strcasecmp(*(&v4), v5[8]); if (!v16) break; } if (!v5) { v5 = nfmalloc(0x18); for (v6 = &v3; v6->field_0; v6 = &v6->field_0->field_0) { v16 = strcasecmp(*(&v4), v6->field_0->field_8); if (v16 <= 0) break; } *(&v5[8]) = *(&v4); *(&v5[16]) = 0; *(v5) = v6->field_0; v6->field_0 = v5; v1 += 1; } *(&v5[16]) = v5[16] + 1; v0 += 1; } else { pkg_hash_iter_free(v7); if (!v0) { break; } else { if (v0 <= 12) { v7 = pkg_hash_iter_new(a0, a1, a2, a3, a4, a5); while (true) { v8 = pkg_hash_iter_next_pkg(v7); if (v8) { *(&v16) = yettobeunpacked(v8, NULL) ^ 1; if (v16) continue; describebriefly(v8); } else { pkg_hash_iter_free(v7); break; } } } else if (v1 <= 12) { for (v5 = v3; v5; v5 = *(v5)) { sprintf(&v10, "%d", v5[16]); v17 = v5[16]; printf(gettext(" %d in %s: ")); v18 = strlen(v5[8]); v19 = strlen(&v10); for (v2 = 70 - (v19 + v18); v2 > 59; v2 -= 1) { a0 = 32; putchar(0x20); } v20 = pkg_hash_iter_new(a0, v17, 70 - (v19 + v18), a3, a4, a5); v7 = v20; while (true) { v8 = pkg_hash_iter_next_pkg(v7); if (!v8) break; *(&v20) = yettobeunpacked(v8, &v4) ^ 1; if (v20) continue; if (strcasecmp(*(&v4), v5[8])) continue; v9 = pkg_name(v8, 0x1); v2 -= strlen(v9); v2 -= 1; if (v2 <= 3) { printf(" ..."); break; } else { printf(" %s", v9); } } pkg_hash_iter_free(v7); putchar(0xa); } } else { printf(ngettext(" %d package, from the following section:", " %d packages, from the following sections:", v0)); v2 = 0; for (v5 = v3; v5; v5 = *(v5)) { sprintf(&v10, "%d", v5[16]); v2 = (v2 - (strlen(&v10) + strlen(v5[8]))) - 6; if (v2 < 0) { putchar(0xa); v2 = 73 - (strlen(&v10) + strlen(v5[8])); } printf(" %s (%d)", v5[8], v5[16]); } putchar(0xa); } v22 = gettext("<standard output>"); m_output(stdout, v22, v22); break; } } } v23 = v11; v24 = v12; return 0; }
dpkg
angr_dream
static int prepare_poll(struct pollfd **pfdp, size_t *npfdp, int *timeoutp, u_int maxfds) { struct pollfd *pfd = *pfdp; size_t i, j, npfd = 0; time_t deadline; int r; for (i = 0; i < sockets_alloc; i++) { switch (sockets[i].type) { case AUTH_SOCKET: case AUTH_CONNECTION: npfd++; break; case AUTH_UNUSED: break; default: sshfatal("ssh-agent.c", __func__, 1886, 0, SYSLOG_LEVEL_FATAL, ((void *)0), "Unknown socket type %d", sockets[i].type); break; } } if (npfd != *npfdp && (pfd = recallocarray(pfd, *npfdp, npfd, sizeof(*pfd))) == ((void *)0)) sshfatal("ssh-agent.c", __func__, 1892, 1, SYSLOG_LEVEL_FATAL, ((void *)0), "recallocarray failed"); *pfdp = pfd; *npfdp = npfd; for (i = j = 0; i < sockets_alloc; i++) { switch (sockets[i].type) { case AUTH_SOCKET: if (npfd > maxfds) { sshlog("ssh-agent.c", __func__, 1900, 0, SYSLOG_LEVEL_DEBUG3, ((void *)0), "out of fds (active %zu >= limit %u); " "skipping arming listener", npfd, maxfds); break; } pfd[j].fd = sockets[i].fd; pfd[j].revents = 0; pfd[j].events = 0x001; j++; break; case AUTH_CONNECTION: pfd[j].fd = sockets[i].fd; pfd[j].revents = 0; if ((r = sshbuf_check_reserve(sockets[i].input, (4096))) == 0 && (r = sshbuf_check_reserve(sockets[i].output, (256 * 1024))) == 0) pfd[j].events = 0x001; else if (r != -9) sshfatal("ssh-agent.c", __func__, 1922, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "reserve"); if (sshbuf_len(sockets[i].output) > 0) pfd[j].events |= 0x004; j++; break; default: break; } } deadline = reaper(); if (parent_alive_interval != 0) deadline = (deadline == 0) ? parent_alive_interval : (((deadline) < (parent_alive_interval)) ? (deadline) : (parent_alive_interval)); if (deadline == 0) { *timeoutp = -1; } else { if (deadline > 0x7fffffff / 1000) *timeoutp = 0x7fffffff / 1000; else *timeoutp = deadline * 1000; } return (1); }
void prepare_poll(unsigned long long *a0, unsigned long long *a1, unsigned int *a2, unsigned long a3) { unsigned int v0; void *v1; void *v2; unsigned long v3; void *v4; unsigned long long v5; unsigned long v6; char v7; unsigned long long v8; char v9; char v10; char v11; unsigned long long v12; unsigned long long v13; v1 = *(a0); v4 = 0; v2 = 0; while (true) { if (v2 >= sockets_alloc) break; if (*((((v2 << 1) + v2 << 4) + sockets + 4))) { if (*((((v2 << 1) + v2 << 4) + sockets + 4)) - 1 > 1) { v6 = *((v2 * 48 + sockets + 4)); v5 = "Unknown socket type %d"; sshfatal("ssh-agent.c", "prepare_poll", 0x75e, 0x0, 0x1, 0x0); } else { v4 += 1; } } v2 += 1; } if (v4 != *(a1)) { v1 = recallocarray(v1, *(a1), v4, 0x8); if (!v1) { v5 = "recallocarray failed"; sshfatal("ssh-agent.c", "prepare_poll", 0x764, 0x1, 0x1, 0x0); } } *(a0) = v1; *(a1) = v4; v3 = 0; v2 = v3; while (true) { if (v2 >= sockets_alloc) break; if (*((((v2 << 1) + v2 << 4) + sockets + 4)) == 1) { if (v4 <= a3) { *((v1 + 0x8 * v3)) = *((v2 * 48 + sockets)); *((6 + v1 + 0x8 * v3)) = 0; *((4 + v1 + 0x8 * v3)) = 1; v3 += 1; goto LABEL_407056; } else { v5 = a3; v4 = v4; v3 = "out of fds (active %zu >= limit %u); skipping arming listener"; sshlog("ssh-agent.c", "prepare_poll", 0x76c, 0x0, 0x7, 0x0, *(&v7), v8, *(&v9), *(&v10), *(&v11)); goto LABEL_407056; } } if (!(*((((v2 << 1) + v2 << 4) + sockets + 4)) == 2)) goto LABEL_407056; *((v1 + 0x8 * v3)) = *((v2 * 48 + sockets)); *((6 + v1 + 0x8 * v3)) = 0; v0 = sshbuf_check_reserve(*((v2 * 48 + sockets + 8)), 0x1000, v2, sockets); if (!v0) { v0 = sshbuf_check_reserve(*((v2 * 48 + sockets + 16)), 0x40000, v2, sockets); if (!v0) { *((4 + v1 + 0x8 * v3)) = 1; goto LABEL_406ff3; } } if (v0 != -9) { v5 = "reserve"; sshfatal("ssh-agent.c", "prepare_poll", 0x782, 0x1, 0x1, ssh_err(v0)); } LABEL_406ff3: if (sshbuf_len(*((((v2 << 1) + v2 << 4) + sockets + 16)))) *((4 + v1 + 0x8 * v3)) = *((4 + v1 + 0x8 * v3)) | 4; v3 += 1; LABEL_407056: v2 += 1; } v5 = reaper(); if (parent_alive_interval) { if (!v5) { v12 = parent_alive_interval; } else { v12 = parent_alive_interval; if (v5 <= parent_alive_interval) v12 = v5; } v5 = v12; } if (!v5) { *(a2) = -1; } else if (v5 > 2147483) { *(a2) = 2147483; } else { *(a2) = v5 * 1000; } v13 = 1; return; }
openssh-portable
angr_phoenix
static int multiaddr_modify(int cmd, int argc, char **argv) { struct ifreq ifr = {}; int family; int fd, len; if (cmd == RTM_NEWADDR) cmd = 0x8931; else cmd = 0x8932; while (argc > 0) { if (strcmp(*argv, "dev") == 0) { do { argv++; if (--argc <= 0) incomplete_command(); } while (0); if (ifr.ifr_ifrn.ifrn_name[0]) duparg("dev", *argv); if (get_ifname(ifr.ifr_ifrn.ifrn_name, *argv)) invarg("\"dev\" not a valid ifname", *argv); } else { if (matches(*argv, "address") == 0) { do { argv++; if (--argc <= 0) incomplete_command(); } while (0); } if (matches(*argv, "help") == 0) usage(); if (ifr.ifr_ifru.ifru_hwaddr.sa_data[0]) duparg("address", *argv); len = ll_addr_a2n(ifr.ifr_ifru.ifru_hwaddr.sa_data, sizeof(ifr.ifr_ifru.ifru_hwaddr.sa_data), *argv); if (len < 0) exit(1); if (len != 6) { fprintf(stderr, "Error: Invalid address length %d - must be %d bytes\n", len, 6); exit(1); } } argc--; argv++; } if (ifr.ifr_ifrn.ifrn_name[0] == 0) { fprintf(stderr, "Not enough information: \"dev\" is required.\n"); exit(-1); } switch (preferred_family) { case 10: case 17: case 2: family = preferred_family; break; default: family = 2; } fd = socket(family, SOCK_DGRAM, 0); if (fd < 0) { perror("Cannot create socket"); exit(1); } if (ioctl(fd, cmd, (char *)&ifr) != 0) { perror("ioctl"); exit(1); } close(fd); exit(0); }
void multiaddr_modify(int param_1, int param_2, char **param_3) { char cVar1; uint uVar2; int iVar3; int iVar4; long in_FS_OFFSET; char **local_58; int local_50; int local_4c; uint local_44; undefined8 local_38; undefined8 local_30; undefined8 local_28; undefined8 local_20; undefined8 local_18; undefined8 local_10; local_10 = *(undefined8 *)(in_FS_OFFSET + 0x28); local_38 = 0; local_30 = 0; local_28 = 0; local_20 = 0; local_18 = 0; local_58 = param_3; local_50 = param_2; if (param_1 == 0x14) { local_4c = 0x8931; } else { local_4c = 0x8932; } do { if (local_50 < 1) { if ((char)local_38 == '\0') { fprintf(stderr, "Not enough information: \"dev\" is required.\n"); exit(-1); } if ((preferred_family < 0x12) && ((1 << ((byte)preferred_family & 0x3f) & 0x20404U) != 0)) { local_44 = preferred_family; } else { local_44 = 2; } iVar3 = socket(local_44, 2, 0); if (iVar3 < 0) { perror("Cannot create socket"); exit(1); } iVar4 = ioctl(iVar3, (long)local_4c, &local_38); if (iVar4 != 0) { perror("ioctl"); exit(1); } close(iVar3); exit(0); } iVar3 = strcmp(*local_58, "dev"); if (iVar3 == 0) { local_58 = local_58 + 1; local_50 = local_50 + -1; if (local_50 < 1) { incomplete_command(); } if ((char)local_38 != '\0') { duparg(&DAT_0010118b, *local_58); } iVar3 = get_ifname(&local_38, *local_58); if (iVar3 != 0) { invarg("\"dev\" not a valid ifname", *local_58); goto LAB_00100d1e; } } else { LAB_00100d1e: cVar1 = matches(*local_58, "address"); if (cVar1 != '\x01') { local_58 = local_58 + 1; local_50 = local_50 + -1; if (local_50 < 1) { incomplete_command(); } } cVar1 = matches(*local_58, &DAT_0010118f); if (cVar1 != '\x01') { usage(); } if (local_28._2_1_ != '\0') { duparg("address", *local_58); } uVar2 = ll_addr_a2n((long)&local_28 + 2, 0xe, *local_58); if ((int)uVar2 < 0) { exit(1); } if (uVar2 != 6) { fprintf(stderr, "Error: Invalid address length %d - must be %d bytes\n", (ulong)uVar2, 6); exit(1); } } local_50 = local_50 + -1; local_58 = local_58 + 1; } while (true); }
iproute2-6.0.0
ghidra
inline errcode_t ext2fs_get_mem(unsigned long size, void *ptr) { void *pp; pp = malloc(size); if (!pp) return (2133571398L); memcpy(ptr, &pp, sizeof(pp)); return 0; }
void ext2fs_get_mem(void) { halt_baddata(); }
e2fsprogs-1.46.5
ghidra
static inline __u16 rta_getattr_u16(const struct rtattr *rta) { return *(__u16 *)(( void *)(((char *)(rta)) + ((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0)))); }
int rta_getattr_u16(struct_0 *a0) { return a0->field_4; }
iproute2-6.0.0
angr_sailr
static STRINGLIST *gen_globpat_matches(cs, text) COMPSPEC *cs; const char *text; { STRINGLIST *sl; int gflags; sl = strlist_create(0); gflags = glob_star ? 0x400 : 0; sl->list = glob_filename(cs->globpat, gflags); if ((sl->list) == (char **)&glob_error_return) sl->list = (char **)((void *)0); if (sl->list) sl->list_len = sl->list_size = strvec_len(sl->list); return sl; }
long gen_globpat_matches(long a1) { unsigned int v1; long v3; v3 = strlist_create(0LL); if (glob_star) v1 = 1024; else v1 = 0; *(_QWORD *)v3 = glob_filename(*(_QWORD *)(a1 + 24), v1); if (*(_UNKNOWN **)v3 == &glob_error_return) *(_QWORD *)v3 = 0LL; if (*(_QWORD *)v3) { *(_DWORD *)(v3 + 8) = strvec_len(*(_QWORD *)v3); *(_DWORD *)(v3 + 12) = *(_DWORD *)(v3 + 8); } return v3; }
bash
ida
int inflateSyncPoint(strm) z_streamp strm; { struct inflate_state *state; if (inflateStateCheck(strm)) return (-2); state = (struct inflate_state *)strm->state; return state->mode == STORED && state->bits == 0; }
long long inflateSyncPoint(struct_0 *a0) { unsigned int v0[23]; unsigned long long v2; if (inflateStateCheck(a0)) { v2 = 4294967294; return v2; } *(&v0[0]) = a0->field_38; if (v0[2] != 16193) { v2 = 0; return v2; } else if (v0[22]) { v2 = 0; return v2; } else { v2 = 1; return v2; } }
zlib
angr_sailr
static int verify_host_key_callback(struct sshkey *hostkey, struct ssh *ssh) { int r; if ((r = sshkey_check_rsa_length(hostkey, options.required_rsa_size)) != 0) sshfatal("sshconnect2.c", __func__, 103, 0, SYSLOG_LEVEL_FATAL, ssh_err(r), "Bad server host key"); if (verify_host_key(xxx_host, xxx_hostaddr, hostkey, xxx_conn_info) == -1) sshfatal("sshconnect2.c", __func__, 106, 0, SYSLOG_LEVEL_FATAL, ((void *)0), "Host key verification failed."); return 0; }
long verify_host_key_callback(long a1) { long v1; unsigned int v3; v3 = sshkey_check_rsa_length(a1, options[1478]); if (v3) { v1 = ssh_err(v3); sshfatal("sshconnect2.c", "verify_host_key_callback", 103LL, 0LL, 1LL, v1, "Bad server host key"); } if ((unsigned int)verify_host_key(xxx_host, xxx_hostaddr, a1, xxx_conn_info) == -1) sshfatal("sshconnect2.c", "verify_host_key_callback", 106LL, 0LL, 1LL, 0LL, "Host key verification failed."); return 0LL; }
openssh-portable
ida
static char *adjust_resolution(char const *format) { char *copy = ((void *)0); for (char const *f = format; *f; f++) if (f[0] == '%') { if (f[1] == '-' && f[2] == 'N') { if (!copy) copy = xstrdup(format); copy[f + 1 - format] = '0' + res_width(gettime_res()); f += 2; } else f += f[1] == '%'; } return copy; }
int adjust_resolution(unsigned long long a0) { void *v0; char v1[3]; v0 = 0; *(&v1) = a0; while (true) { switch (v1[0]) { case 0: return v0; case 37: if (v1[1] != 45 || v1[2] != 78) { *(&v1) = &v1[v1[1] == 37]; break; } else { if (!v0) v0 = xstrdup(a0); *((v0 + &v1[1 + -1 * a0])) = res_width(gettime_res()) + 48; *(&v1) = &v1[2]; break; } default: *(&v1) = &v1[1]; continue; } } }
coreutils
angr_sailr
static int cfg_kernel_matches(const struct cfg *cfg, const char *pattern) { regex_t re; int status; if ((strcmp((pattern), ("*")) == 0)) return 1; if (regcomp(&re, pattern, 1 | (1 << 3)) != 0) return 0; status = regexec(&re, cfg->kversion, 0, ((void *)0), 0); regfree(&re); return status == 0; }
int cfg_kernel_matches(unsigned long long *a0, char *a1) { unsigned int v0; char v1; unsigned int v3; if (!strcmp(a1, "*")) { v3 = 1; return v3; } else if (!regcomp(&v1, a1, 0x9, a1)) { v0 = regexec(&v1, *(a0), 0x0, 0x0, 0x0); regfree(&v1); v3 = !v0; return v3; } else { v3 = 0; return v3; } }
kmod
angr_sailr
static void send_state(int fd) { FILE *fp; CHILD *p; int i, val; fp = fdopen(fd, "w"); fprintf(fp, "VER%s\n", Version); fprintf(fp, "-RL%c\n", runlevel); fprintf(fp, "-TL%c\n", thislevel); fprintf(fp, "-PL%c\n", prevlevel); fprintf(fp, "-SI%u\n", got_signals); fprintf(fp, "-WR%d\n", wrote_wtmp_reboot); fprintf(fp, "-WU%d\n", wrote_utmp_reboot); fprintf(fp, "-ST%d\n", sleep_time); fprintf(fp, "-DB%d\n", did_boot); for (p = family; p; p = p->next) { fprintf(fp, "REC%s\n", p->id); fprintf(fp, "LEV%s\n", p->rlevel); for (i = 0, val = p->flags; flags[i].mask; i++) if (val & flags[i].mask) { val &= ~flags[i].mask; fprintf(fp, "FL %s\n", flags[i].name); } fprintf(fp, "PID%d\n", p->pid); fprintf(fp, "EXS%u\n", p->exstat); for (i = 0; actions[i].act; i++) if (actions[i].act == p->action) { fprintf(fp, "AC %s\n", actions[i].name); break; } fprintf(fp, "CMD%s\n", p->process); fprintf(fp, "EOR\n"); } fprintf(fp, "END\n"); fclose(fp); }
void send_state(unsigned long a0) { unsigned int v0; unsigned int v1; struct_0 *v2; void *v3; unsigned long long v5; v3 = fdopen(a0, "w"); fprintf(v3, "VER%s\n", Version); fprintf(v3, "-RL%c\n", runlevel); fprintf(v3, "-TL%c\n", thislevel); fprintf(v3, "-PL%c\n", prevlevel); fprintf(v3, "-SI%u\n", 955024200); fprintf(v3, "-WR%d\n", wrote_wtmp_reboot); fprintf(v3, "-WU%d\n", wrote_utmp_reboot); fprintf(v3, "-ST%d\n", sleep_time); fprintf(v3, "-DB%d\n", did_boot); for (v2 = family; v2; v2 = v2->field_c0) { fprintf(v3, "REC%s\n", &v2->padding_c[16]); fprintf(v3, "LEV%s\n", &v2->padding_c[24]); v0 = 0; for (v1 = v2->field_0; g_407d28[4 * v0]; v0 += 1) { if ((g_407d28[4 * v0] & v1)) { v1 &= !(g_407d28[4 * v0]); fprintf(v3, "FL %s\n", (&flags)[2 * v0]); } } fprintf(v3, "PID%d\n", v2->field_8); fprintf(v3, "EXS%u\n", v2->field_4); v0 = 0; while (true) { if (!g_407c28[4 * v0]) break; if (g_407c28[4 * v0] != v2->field_30) { v0 += 1; } else { fprintf(v3, "AC %s\n", (&actions)[2 * v0]); break; } } fprintf(v3, "CMD%s\n", &v2->padding_34); fprintf(v3, "EOR\n"); } fprintf(v3, "END\n"); v5 = fclose(v3); return; }
sysvinit
angr_phoenix
static void check_parent_exists(void) { if (parent_pid != -1 && getppid() != parent_pid) { cleanup_socket(); _exit(2); } }
void check_parent_exists(unsigned int a0, unsigned int a1, unsigned long a2, unsigned int a3, unsigned int a4, unsigned int a5) { char v0; unsigned long long v2; v2 = parent_pid; if (parent_pid != -1 && getppid() != parent_pid) { cleanup_socket(a0, a1, parent_pid, a3, a4, a5, *(&v0)); _exit(0x2); } return; }
openssh-portable
angr_phoenix
int sshbuf_consume_end(struct sshbuf *buf, size_t len) { int r; ; if ((r = sshbuf_check_sanity(buf)) != 0) return r; if (len == 0) return 0; if (len > sshbuf_len(buf)) return -3; buf->size -= len; ; return 0; }
long sshbuf_consume_end(long a1, unsigned long a2) { unsigned int v3; v3 = sshbuf_check_sanity(a1); if (v3) return v3; if (!a2) return 0LL; if (a2 > sshbuf_len(a1)) return 4294967293LL; *(_QWORD *)(a1 + 24) -= a2; return 0LL; }
openssh-portable
ida
keymacro_map_str(EditLine *el, wchar_t *str) { el->el_keymacro.val.str = str; return &el->el_keymacro.val; }
long long keymacro_map_str(struct_0 *a0, unsigned long a1) { a0->field_450 = a1; return &a0->field_450; }
libedit
angr_dream
inline void *xnrealloc(void *p, size_t n, size_t s) { return xreallocarray(p, n, s); }
void xnrealloc(void) { halt_baddata(); }
coreutils
ghidra
const char *fmtcheck(const char *f1, const char *f2) { const char *f1p, *f2p; EFT f1t, f2t; if (!f1) return f2; f1p = f1; f1t = FMTCHECK_START; f2p = f2; f2t = FMTCHECK_START; while ((f1t = get_next_format(&f1p, f1t)) != FMTCHECK_DONE) { if (f1t == FMTCHECK_UNKNOWN) return f2; f2t = get_next_format(&f2p, f2t); if (f1t != f2t) return f2; } return f1; }
long long fmtcheck(unsigned long long a0, unsigned long long a1) { unsigned int v0; unsigned int v1; unsigned long v2; unsigned long v3; unsigned long long v5; if (!a0) { v5 = a1; return v5; } v2 = a0; v0 = 0; v3 = a1; v1 = 0; while (true) { v0 = get_next_format(&v2, v0); switch (v0) { case 24: v5 = a0; return v5; case 25: v5 = a1; return v5; default: v1 = get_next_format(&v3, v1); if (v0 != v1) { v5 = a1; return v5; } break; } } }
libbsd-0.11.7
angr_sailr
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); }
long execute_cond_command(long a1) { size_t v1; const char *v2; char *v3; int v6; int v7; v6 = line_number; line_number = *(_DWORD *)(a1 + 4); if (!(unsigned int)signal_in_progress(66LL) && running_trap != 67) line_number_for_err_trap = line_number; if (variable_context) { if (interactive_shell) { if (!sourcelevel) { line_number -= function_line_number - 1; if (line_number <= 0) line_number = 1; } } } command_string_index = 0; print_cond_command(a1); if (!(unsigned int)signal_in_progress(65LL) && !running_trap) { if (the_printed_command_except_trap) sh_xfree(the_printed_command_except_trap, "execute_cmd.c", 4041LL); v1 = strlen(the_printed_command); v2 = the_printed_command; v3 = (char *)sh_xmalloc(v1 + 1, "execute_cmd.c", 4042LL); the_printed_command_except_trap = strcpy(v3, v2); } v7 = run_debug_trap(); if (debugging_mode && v7) { line_number = v6; return 0LL; } else { this_command_name = (long)"[["; last_command_exit_value = execute_cond_node(a1); line_number = v6; return (unsigned int)last_command_exit_value; } }
bash
ida
void complete_pending_execs(struct predicate *p) { if (((void *)0) == p) return; complete_pending_execs(p->pred_left); if ((((p)->pred_func) == (pred_exec)) && p->args.exec_vec.multiple) { struct exec_val *execp = &p->args.exec_vec; if (execp->state.todo) { bc_do_exec(&execp->ctl, &execp->state); } } complete_pending_execs(p->pred_right); }
void complete_pending_execs(long *param_1) { if (param_1 != (long *)0x0) { complete_pending_execs(param_1[0x22]); if (((*param_1 == lRam000000000010088d) && (*(char *)(param_1 + 7) != '\0')) && (*(int *)(param_1 + 0x1a) != 0)) { bc_do_exec(param_1 + 8, param_1 + 0x13); } complete_pending_execs(param_1[0x23]); } return; }
findutils
ghidra
static double getdouble(void) { double val; char *cp, *ep; cp = *gargv; if (cp == ((void *)0)) return 0; gargv++; if (*cp == '\"' || *cp == '\'') return (unsigned char)cp[1]; (*__errno_location()) = 0; val = strtod(cp, &ep); check_conversion(cp, ep); return val; }
unsigned long getdouble() { char *endptr; char *nptr; double v3; unsigned long v4; v4 = __readfsqword(0x28u); nptr = *(char **)gargv; if (nptr) { gargv += 8LL; if (*nptr != 34 && *nptr != 39) { *_errno_location() = 0; v3 = strtod(nptr, &endptr); check_conversion(nptr, endptr); } } return __readfsqword(0x28u) ^ v4; }
dash-0.5.11+git20210903+057cd650a4ed
ida
int decode_attrib(struct sshbuf *b, Attrib *a) { int r; attrib_clear(a); if ((r = sshbuf_get_u32(b, &a->flags)) != 0) return r; if (a->flags & 0x00000001) { if ((r = sshbuf_get_u64(b, &a->size)) != 0) return r; } if (a->flags & 0x00000002) { if ((r = sshbuf_get_u32(b, &a->uid)) != 0 || (r = sshbuf_get_u32(b, &a->gid)) != 0) return r; } if (a->flags & 0x00000004) { if ((r = sshbuf_get_u32(b, &a->perm)) != 0) return r; } if (a->flags & 0x00000008) { if ((r = sshbuf_get_u32(b, &a->atime)) != 0 || (r = sshbuf_get_u32(b, &a->mtime)) != 0) return r; } if (a->flags & 0x80000000) { char *type; u_char *data; size_t dlen; u_int i, count; if ((r = sshbuf_get_u32(b, &count)) != 0) return r; for (i = 0; i < count; i++) { if ((r = sshbuf_get_cstring(b, &type, ((void *)0))) != 0 || (r = sshbuf_get_string(b, &data, &dlen)) != 0) return r; sshlog("sftp-common.c", __func__, 144, 0, SYSLOG_LEVEL_DEBUG3, ((void *)0), "Got file attribute \"%.100s\" len %zu", type, dlen); free(type); free(data); } } return 0; }
long long decode_attrib(unsigned long long a0, unsigned int *a1) { unsigned long long v0; char v1; unsigned int v2; unsigned int v3; char v4; char v5; char v6; void *v8; attrib_clear(a1); v2 = sshbuf_get_u32(a0, a1, a1); if (v2) { v8 = v2; } else { if ((*(a1) & 1)) { v2 = sshbuf_get_u64(a0, a1 + 2, a1 + 2); if (v2) { v8 = v2; goto LABEL_40044c; } } if (!(*(a1) & 2)) { LABEL_4002c9: if ((*(a1) & 4)) { v2 = sshbuf_get_u32(a0, a1 + 6, a1 + 6); if (v2) { v8 = v2; goto LABEL_40044c; } } if (!(*(a1) & 8)) { LABEL_400353: if (*(a1) < 0) { v2 = sshbuf_get_u32(a0, &v1, &v1); if (v2) { v8 = v2; goto LABEL_40044c; } else { v3 = 0; while (true) { if (v3 >= *(&v1)) break; v2 = sshbuf_get_cstring(a0, &v4, 0x0, &v4); if (v2) { LABEL_4003d2: v8 = v2; goto LABEL_40044c; } else { v2 = sshbuf_get_string(a0, &v5, &v6, &v5); if (!(!v2)) goto LABEL_4003d2; v0 = *(&v6); sshlog("sftp-common.c", "decode_attrib", 0x90, 0x0, 0x7, 0x0, "Got file attribute \"%.100s\" len %zu", *(&v4)); free(*(&v4)); free(*(&v5)); v3 += 1; } } } } v8 = 0; } else { v2 = sshbuf_get_u32(a0, a1 + 7, a1 + 7); if (!v2) { v2 = sshbuf_get_u32(a0, a1 + 8, a1 + 8); if (!v2) goto LABEL_400353; } v8 = v2; } } else { v2 = sshbuf_get_u32(a0, a1 + 4, a1 + 4); if (!v2) { v2 = sshbuf_get_u32(a0, a1 + 5, a1 + 5); if (!v2) goto LABEL_4002c9; } v8 = v2; } } LABEL_40044c: return v8; }
openssh-portable
angr_phoenix
void mm_request_send(int sock, enum monitor_reqtype type, struct sshbuf *m) { size_t mlen = sshbuf_len(m); u_char buf[5]; sshlog("monitor_wrap.c", __func__, 128, 1, SYSLOG_LEVEL_DEBUG3, ((void *)0), "entering, type %d", type); if (mlen >= 0xffffffff) sshfatal("monitor_wrap.c", __func__, 131, 1, SYSLOG_LEVEL_FATAL, ((void *)0), "bad length %zu", mlen); do { const u_int32_t __v = (mlen + 1); ((u_char *)(buf))[0] = (__v >> 24) & 0xff; ((u_char *)(buf))[1] = (__v >> 16) & 0xff; ((u_char *)(buf))[2] = (__v >> 8) & 0xff; ((u_char *)(buf))[3] = __v & 0xff; } while (0); buf[4] = (u_char)type; if (atomicio((ssize_t (*)(int, void *, size_t))write, sock, buf, sizeof(buf)) != sizeof(buf)) sshfatal("monitor_wrap.c", __func__, 135, 1, SYSLOG_LEVEL_FATAL, ((void *)0), "write: %s", strerror((*__errno_location()))); if (atomicio((ssize_t (*)(int, void *, size_t))write, sock, sshbuf_mutable_ptr(m), mlen) != mlen) sshfatal("monitor_wrap.c", __func__, 137, 1, SYSLOG_LEVEL_FATAL, ((void *)0), "write: %s", strerror((*__errno_location()))); }
void mm_request_send(unsigned long a0, unsigned long a1, unsigned long long a2) { unsigned long v0; unsigned int v1; unsigned long long v2; char v3; char v4; char v5; char v6; char v7; unsigned long long v8; unsigned long v9; unsigned long long *v11; unsigned long long v12; v2 = sshbuf_len(a2); v0 = a1; sshlog("monitor_wrap.c", "mm_request_send", 0x80, 0x1, 0x7, 0x0, "entering, type %d"); if (v2 > 4294967294) { v0 = v2; sshfatal("monitor_wrap.c", "mm_request_send", 0x83, 0x1, 0x1, 0x0); } v1 = v2 + 1; v3 = v1 >> 24; v4 = v1 >> 16; v5 = v1 >> 8; v6 = v1; v7 = a1; if (atomicio(got.write, a0, &v3, 0x5) != 5) { v9 = strerror(*(__errno_location())); v8 = "write: %s"; sshfatal("monitor_wrap.c", "mm_request_send", 0x87, 0x1, 0x1, 0x0); } if (v2 != atomicio(got.write, a0, sshbuf_mutable_ptr(a2), v2)) { v9 = strerror(*(__errno_location())); v8 = "write: %s"; sshfatal("monitor_wrap.c", "mm_request_send", 0x89, 0x1, 0x1, 0x0); } v12 = v8 ^ v11[5]; return; }
openssh-portable
angr_sailr
static SHELL_VAR *get_funcname(self) SHELL_VAR *self; { return (self); }
undefined8 get_funcname(undefined8 param_1) { return param_1; }
bash
ghidra
static int ssh_keysign(struct ssh *ssh, struct sshkey *key, u_char **sigp, size_t *lenp, const u_char *data, size_t datalen) { struct sshbuf *b; struct stat st; pid_t pid; int r, to[2], from[2], status; int sock = ssh_packet_get_connection_in(ssh); u_char rversion = 0, version = 2; void (*osigchld)(int); *sigp = ((void *)0); *lenp = 0; if (stat("/usr/local/libexec/ssh-keysign", &st) == -1) { sshlog("sshconnect2.c", __func__, 2059, 1, SYSLOG_LEVEL_ERROR, ((void *)0), "not installed: %s", strerror((*__errno_location()))); return -1; } if (fflush(stdout) != 0) { sshlog("sshconnect2.c", __func__, 2063, 1, SYSLOG_LEVEL_ERROR, ((void *)0), "fflush: %s", strerror((*__errno_location()))); return -1; } if (pipe(to) == -1) { sshlog("sshconnect2.c", __func__, 2067, 1, SYSLOG_LEVEL_ERROR, ((void *)0), "pipe: %s", strerror((*__errno_location()))); return -1; } if (pipe(from) == -1) { sshlog("sshconnect2.c", __func__, 2071, 1, SYSLOG_LEVEL_ERROR, ((void *)0), "pipe: %s", strerror((*__errno_location()))); return -1; } if ((pid = fork()) == -1) { sshlog("sshconnect2.c", __func__, 2075, 1, SYSLOG_LEVEL_ERROR, ((void *)0), "fork: %s", strerror((*__errno_location()))); return -1; } osigchld = ssh_signal(17, ((__sighandler_t)0)); if (pid == 0) { close(from[0]); if (dup2(from[1], 1) == -1) sshfatal("sshconnect2.c", __func__, 2082, 1, SYSLOG_LEVEL_FATAL, ((void *)0), "dup2: %s", strerror((*__errno_location()))); close(to[1]); if (dup2(to[0], 0) == -1) sshfatal("sshconnect2.c", __func__, 2085, 1, SYSLOG_LEVEL_FATAL, ((void *)0), "dup2: %s", strerror((*__errno_location()))); close(from[1]); close(to[0]); if (dup2(sock, 2 + 1) == -1) sshfatal("sshconnect2.c", __func__, 2090, 1, SYSLOG_LEVEL_FATAL, ((void *)0), "dup2: %s", strerror((*__errno_location()))); sock = 2 + 1; fcntl(sock, 2, 0); closefrom(sock + 1); sshlog("sshconnect2.c", __func__, 2095, 1, SYSLOG_LEVEL_DEBUG3, ((void *)0), "[child] pid=%ld, exec %s", (long)getpid(), "/usr/local/libexec/ssh-keysign"); execl("/usr/local/libexec/ssh-keysign", "/usr/local/libexec/ssh-keysign", (char *)((void *)0)); sshfatal("sshconnect2.c", __func__, 2098, 1, SYSLOG_LEVEL_FATAL, ((void *)0), "exec(%s): %s", "/usr/local/libexec/ssh-keysign", strerror((*__errno_location()))); } close(from[1]); close(to[0]); sock = 2 + 1; if ((b = sshbuf_new()) == ((void *)0)) sshfatal("sshconnect2.c", __func__, 2106, 1, SYSLOG_LEVEL_FATAL, ((void *)0), "sshbuf_new failed"); if ((r = sshbuf_put_u32(b, sock)) != 0 || (r = sshbuf_put_string(b, data, datalen)) != 0) sshfatal("sshconnect2.c", __func__, 2110, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "buffer error"); if (ssh_msg_send(to[1], version, b) == -1) sshfatal("sshconnect2.c", __func__, 2112, 1, SYSLOG_LEVEL_FATAL, ((void *)0), "couldn't send request"); sshbuf_reset(b); r = ssh_msg_recv(from[0], b); close(from[0]); close(to[1]); if (r < 0) { sshlog("sshconnect2.c", __func__, 2118, 1, SYSLOG_LEVEL_ERROR, ((void *)0), "no reply"); goto fail; } (*__errno_location()) = 0; while (waitpid(pid, &status, 0) == -1) { if ((*__errno_location()) != 4) { sshlog("sshconnect2.c", __func__, 2125, 1, SYSLOG_LEVEL_ERROR, ((void *)0), "waitpid %ld: %s", (long)pid, strerror((*__errno_location()))); goto fail; } } if (!(((status) & 0x7f) == 0)) { sshlog("sshconnect2.c", __func__, 2130, 1, SYSLOG_LEVEL_ERROR, ((void *)0), "exited abnormally"); goto fail; } if ((((status) & 0xff00) >> 8) != 0) { sshlog("sshconnect2.c", __func__, 2134, 1, SYSLOG_LEVEL_ERROR, ((void *)0), "exited with status %d", (((status) & 0xff00) >> 8)); goto fail; } if ((r = sshbuf_get_u8(b, &rversion)) != 0) { sshlog("sshconnect2.c", __func__, 2138, 1, SYSLOG_LEVEL_ERROR, ssh_err(r), "buffer error"); goto fail; } if (rversion != version) { sshlog("sshconnect2.c", __func__, 2142, 1, SYSLOG_LEVEL_ERROR, ((void *)0), "bad version"); goto fail; } if ((r = sshbuf_get_string(b, sigp, lenp)) != 0) { sshlog("sshconnect2.c", __func__, 2146, 1, SYSLOG_LEVEL_ERROR, ssh_err(r), "buffer error"); fail: ssh_signal(17, osigchld); sshbuf_free(b); return -1; } ssh_signal(17, osigchld); sshbuf_free(b); return 0; }
int ssh_keysign(unsigned long long a0, unsigned long long a1, unsigned long long *a2, unsigned long long *a3, unsigned long long a4, unsigned long long a5) { unsigned long v0; unsigned long v1; char v2; char v3; char v4; unsigned int v5; unsigned int v6; unsigned int v7; unsigned long long v8; unsigned int v9; char v10; char v11; char v12; char v13; char v14; unsigned long long v15; unsigned long v16; unsigned long long v17; unsigned long v18; char v19; unsigned int v21; unsigned int v22; v1 = a1; v6 = ssh_packet_get_connection_in(a0); v2 = 0; v3 = 2; *(a2) = 0; *(a3) = 0; if (stat("/usr/local/libexec/ssh-keysign", &v14) == -1) { v0 = strerror(*(__errno_location())); sshlog("sshconnect2.c", "ssh_keysign", 0x80b, 0x1, 0x2, 0x0, "not installed: %s"); v21 = -1; } else if (fflush(stdout)) { v0 = strerror(*(__errno_location())); sshlog("sshconnect2.c", "ssh_keysign", 0x80f, 0x1, 0x2, 0x0, "fflush: %s"); v21 = -1; } else if (pipe(&v10) == -1) { v0 = strerror(*(__errno_location())); sshlog("sshconnect2.c", "ssh_keysign", 0x813, 0x1, 0x2, 0x0, "pipe: %s"); v21 = -1; } else if (pipe(&v12) == -1) { v0 = strerror(*(__errno_location())); sshlog("sshconnect2.c", "ssh_keysign", 0x817, 0x1, 0x2, 0x0, "pipe: %s"); v21 = -1; } else { v7 = fork(); if (v7 == -1) { v0 = strerror(*(__errno_location())); sshlog("sshconnect2.c", "ssh_keysign", 0x81b, 0x1, 0x2, 0x0, "fork: %s"); v21 = -1; } else { v8 = ssh_signal(0x11, 0x0); if (!v7) { close(*(&v12)); if (dup2(*(&v13), 0x1) == -1) { v0 = strerror(*(__errno_location())); sshfatal("sshconnect2.c", "ssh_keysign", 0x822, 0x1, 0x1, 0x0); } close(*(&v11)); if (dup2(*(&v10), 0x0) == -1) { v18 = strerror(*(__errno_location())); v17 = "dup2: %s"; sshfatal("sshconnect2.c", "ssh_keysign", 0x825, 0x1, 0x1, 0x0); } close(*(&v13)); close(*(&v10)); if (dup2(v6, 0x3) == -1) { v18 = strerror(*(__errno_location())); v17 = "dup2: %s"; sshfatal("sshconnect2.c", "ssh_keysign", 0x82a, 0x1, 0x1, 0x0); } v6 = 3; fcntl(v6, 0x2); closefrom(__addvsi3(v6, 0x1)); v17 = "/usr/local/libexec/ssh-keysign"; v16 = getpid(); v15 = "[child] pid=%ld, exec %s"; sshlog("sshconnect2.c", "ssh_keysign", 0x82f, 0x1, 0x7, 0x0, *(&v19)); execl("/usr/local/libexec/ssh-keysign", "/usr/local/libexec/ssh-keysign"); v17 = strerror(*(__errno_location())); v16 = "/usr/local/libexec/ssh-keysign"; v15 = "exec(%s): %s"; sshfatal("sshconnect2.c", "ssh_keysign", 0x832, 0x1, 0x1, 0x0); } close(*(&v13)); v22 = *(&v10); close(*(&v10)); v6 = 3; v21 = sshbuf_new(reg_72, a1, 0x832, 0x1, 0x1, 0x0); v9 = v21; if (!*(&v9)) { v17 = "sshbuf_new failed"; sshfatal("sshconnect2.c", "ssh_keysign", 0x83a, 0x1, 0x1, 0x0); } v5 = sshbuf_put_u32(*(&v9), v6, v6); if (!v5) { v5 = sshbuf_put_string(*(&v9), a4, a5, a4); if (!v5) goto LABEL_40632f; } v17 = "buffer error"; sshfatal("sshconnect2.c", "ssh_keysign", 0x83e, 0x1, 0x1, ssh_err(v5)); LABEL_40632f: if (ssh_msg_send(*(&v11), v3, *(&v9), v3) == -1) { v17 = "couldn't send request"; sshfatal("sshconnect2.c", "ssh_keysign", 0x840, 0x1, 0x1, 0x0); } sshbuf_reset(*(&v9)); v5 = ssh_msg_recv(*(&v12), *(&v9), *(&v9)); close(*(&v12)); close(*(&v11)); if (v5 < 0) { v17 = "no reply"; sshlog("sshconnect2.c", "ssh_keysign", 0x846, 0x1, 0x2, 0x0, *(&v19)); } else { *(__errno_location()) = 0; do { if (waitpid(v7, &v4, 0x0) != -1) { if ((*(&v4) & 127)) { v17 = "exited abnormally"; sshlog("sshconnect2.c", "ssh_keysign", 0x852, 0x1, 0x2, 0x0, *(&v19)); goto LABEL_40669e; } else if ((*(&v4) >> 8)) { v18 = *(&v4) >> 8; v17 = "exited with status %d"; sshlog("sshconnect2.c", "ssh_keysign", 0x856, 0x1, 0x2, 0x0, *(&v19)); goto LABEL_40669e; } else { v5 = sshbuf_get_u8(*(&v9), &v2, &v2); if (v5) { v17 = "buffer error"; sshlog("sshconnect2.c", "ssh_keysign", 0x85a, 0x1, 0x2, ssh_err(v5), *(&v19)); goto LABEL_40669e; } else if (v3 != v2) { v17 = "bad version"; sshlog("sshconnect2.c", "ssh_keysign", 0x85e, 0x1, 0x2, 0x0, *(&v19)); goto LABEL_40669e; } else { v5 = sshbuf_get_string(*(&v9), a2, a3, a2); if (!v5) { ssh_signal(0x11, v8); sshbuf_free(*(&v9)); v21 = 0; goto LABEL_4066f0; } else { v17 = "buffer error"; sshlog("sshconnect2.c", "ssh_keysign", 0x862, 0x1, 0x2, ssh_err(v5), *(&v19)); goto LABEL_40669e; } } } } v21 = *(__errno_location()); } while (v21 == 4); v17 = strerror(*(__errno_location())); v16 = v7; v15 = "waitpid %ld: %s"; sshlog("sshconnect2.c", "ssh_keysign", 0x84d, 0x1, 0x2, 0x0, *(&v19)); } LABEL_40669e: ssh_signal(0x11, v8); sshbuf_free(*(&v9)); v21 = -1; } } LABEL_4066f0: return v21; }
openssh-portable
angr_phoenix
static int anti_replay_db_add(void *dbf, time_t exp, const gnutls_datum_t *key, const gnutls_datum_t *data) { time_t now = time(0); int i; for (i = 0; i < cache_db_ptr; i++) { if (key->size == cache_db[i].session_id_size && memcmp(key->data, cache_db[i].session_id, key->size) == 0 && now < gnutls_db_check_entry_expire_time(&cache_db[i].session_data)) return -428; } return wrap_db_store(dbf, *key, *data); }
long anti_replay_db_add(long a1, long a2, long a3, long a4) { int i; time_t v8; v8 = time(0LL); for (i = 0; i < cache_db_ptr; ++i) { if (*(_DWORD *)(a3 + 8) == *((_DWORD *)cache_db + 38 * i + 32) && !memcmp(*(const void **)a3, (char *)cache_db + 152 * i, *(unsigned int *)(a3 + 8)) && v8 < gnutls_db_check_entry_expire_time((char *)cache_db + 152 * i + 136)) { return 4294966868LL; } } return wrap_db_store(a1, *(const void **)a3, *(_QWORD *)(a3 + 8), *(const void **)a4, *(_QWORD *)(a4 + 8)); }
gnutls
ida
static void _rs_stir(void) { u_char rnd[32 + 8]; uint32_t rekey_fuzz = 0; if (getentropy(rnd, sizeof rnd) == -1) _getentropy_fail(); if (!rs) _rs_init(rnd, sizeof(rnd)); else _rs_rekey(rnd, sizeof(rnd)); explicit_bzero(rnd, sizeof(rnd)); rs->rs_have = 0; memset(rsx->rs_buf, 0, sizeof(rsx->rs_buf)); chacha_encrypt_bytes(&rsx->rs_chacha, (uint8_t *)&rekey_fuzz, (uint8_t *)&rekey_fuzz, sizeof(rekey_fuzz)); rs->rs_count = (1024 * 1024) + (rekey_fuzz % (1024 * 1024)); }
void _rs_stir() { unsigned int v0; char v1; char v2; unsigned long long *v4; unsigned long long v5; v0 = 0; if (getentropy(&v1, 0x28) == -1) _getentropy_fail(); if (rs) _rs_rekey(&v1, 0x28); else _rs_init(&v1, 0x28); explicit_bzero(&v1, 0x28); *(rs) = 0; memset(rsx + 64, 0x0, 0x400); chacha_encrypt_bytes(rsx, &v0, &v0, 0x4); *((rs + 8)) = (v0 & 1048575) + 0x100000; v5 = *(&v2) ^ v4[5]; return; }
openssh-portable
angr_sailr
static void print_explain(FILE *f) { fprintf(f, "Usage: ... geneve id VNI\n" " remote ADDR\n" " [ ttl TTL ]\n" " [ tos TOS ]\n" " [ df DF ]\n" " [ flowlabel LABEL ]\n" " [ dstport PORT ]\n" " [ [no]external ]\n" " [ [no]udpcsum ]\n" " [ [no]udp6zerocsumtx ]\n" " [ [no]udp6zerocsumrx ]\n" " [ innerprotoinherit ]\n" "\n" "Where: VNI := 0-16777215\n" " ADDR := IP_ADDRESS\n" " TOS := { NUMBER | inherit }\n" " TTL := { 1..255 | auto | inherit }\n" " DF := { unset | set | inherit }\n" " LABEL := 0-1048575\n"); }
void print_explain(void *a0) { unsigned long long v1; v1 = fprintf( a0, "Usage: ... geneve id VNI\n\t\tremote ADDR\n\t\t[ ttl TTL ]\n\t\t[ tos " "TOS ]\n\t\t[ df DF ]\n\t\t[ flowlabel LABEL ]\n\t\t[ dstport PORT " "]\n\t\t[ [no]external ]\n\t\t[ [no]udpcsum ]\n\t\t[ [no]udp6zerocsumtx " "]\n\t\t[ [no]udp6zerocsumrx ]\n\t\t[ innerprotoinherit ]\n\nWhere:\tVNI " " := 0-16777215\n\tADDR := IP_ADDRESS\n\tTOS := { NUMBER | inherit " "}\n\tTTL := { 1..255 | auto | inherit }\n\tDF := { unset | set | " "inherit }\n\tLABEL := 0-1048575\n"); return; }
iproute2-6.0.0
angr_phoenix
char *expand_authorized_keys(const char *filename, struct passwd *pw) { char *file, uidstr[32], ret[4096]; int i; snprintf(uidstr, sizeof(uidstr), "%llu", (unsigned long long)pw->pw_uid); file = percent_expand(filename, "h", pw->pw_dir, "u", pw->pw_name, "U", uidstr, (char *)((void *)0)); if (path_absolute(file)) return (file); i = snprintf(ret, sizeof(ret), "%s/%s", pw->pw_dir, file); if (i < 0 || (size_t)i >= sizeof(ret)) sshfatal("auth.c", __func__, 404, 0, SYSLOG_LEVEL_FATAL, ((void *)0), "expand_authorized_keys: path too long"); free(file); return (xstrdup(ret)); }
void *expand_authorized_keys(undefined8 param_1, undefined8 *param_2) { int iVar1; void *pvVar2; undefined8 **ppuVar3; long in_FS_OFFSET; char *pcStack4200; undefined8 uStack4192; undefined8 *local_1058; undefined8 local_1050; uint local_1044; void *local_1040; char local_1038[32]; char local_1018[4104]; long local_10; ppuVar3 = &local_1058; local_10 = *(long *)(in_FS_OFFSET + 0x28); uStack4192 = 0x100e61; local_1058 = param_2; local_1050 = param_1; snprintf(local_1038, 0x20, "%llu", (ulong) * (uint *)(param_2 + 2)); uStack4192 = 0; pcStack4200 = local_1038; local_1040 = (void *)percent_expand(local_1050, &DAT_00102cf8, local_1058[4], &DAT_00102cf6, *local_1058, &DAT_00102cf4); uStack4192 = 0x100ec6; iVar1 = path_absolute(local_1040); pvVar2 = local_1040; if (iVar1 == 0) { uStack4192 = 0x100f0e; local_1044 = snprintf(local_1018, 0x1000, "%s/%s", local_1058[4], local_1040); if (((int)local_1044 < 0) || (ppuVar3 = &local_1058, 0xfff < local_1044)) { ppuVar3 = (undefined8 **)&pcStack4200; pcStack4200 = "expand_authorized_keys: path too long"; sshfatal("auth.c", "expand_authorized_keys", 0x194, 0, 1, 0); } *(undefined8 *)((long)ppuVar3 + -8) = 0x100f73; free(local_1040); *(undefined8 *)((long)ppuVar3 + -8) = 0x100f82; pvVar2 = (void *)xstrdup(local_1018); } if (local_10 == *(long *)(in_FS_OFFSET + 0x28)) { return pvVar2; } *(undefined8 *)((long)ppuVar3 + -8) = 0x100f96; __stack_chk_fail(); }
openssh-portable
ghidra
static inline void emit_ancillary_info(char const *program) { struct infomap { char const *program; char const *node; } const infomap[] = { {"[", "test invocation"}, {"coreutils", "Multi-call invocation"}, {"sha224sum", "sha2 utilities"}, {"sha256sum", "sha2 utilities"}, {"sha384sum", "sha2 utilities"}, {"sha512sum", "sha2 utilities"}, {((void *)0), ((void *)0)}}; char const *node = program; struct infomap const *map_prog = infomap; while (map_prog->program && !(strcmp(program, map_prog->program) == 0)) map_prog++; if (map_prog->node) node = map_prog->node; printf (gettext ("\n%s online help: <%s>\n"), "GNU coreutils", "https: char const *lc_messages = setlocale ( 5 , ((void *)0) ); if (lc_messages && strncmp (lc_messages, "" "en_" "", sizeof ("en_") - 1)) { fputs_unlocked (gettext ("Report any translation bugs to " "<https: stdout ) ; } char const *url_program = (strcmp (program, "[") == 0) ? "test" : program; printf (gettext ("Full documentation <%s%s>\n"), "https: printf (gettext ("or available locally via: info '(coreutils) %s%s'\n"), node, node == program ? " invocation" : ""); }
void emit_ancillary_info(char *a0) { unsigned long long v0; unsigned long long v1[2]; char *v2; unsigned long long v3; unsigned long long v4; unsigned long long v5; unsigned long long v6; unsigned long long v7; unsigned long long v8; unsigned long long v9; unsigned long long v10; unsigned long long v11; unsigned long long v12; unsigned long long v13; unsigned long long v14; unsigned long long v15; void *v16; void *v17; char v18; unsigned long long v20; unsigned long long *v21; unsigned long long v22; v4 = "["; v5 = "test invocation"; v6 = "coreutils"; v7 = "Multi-call invocation"; v8 = "sha224sum"; v9 = "sha2 utilities"; v10 = "sha256sum"; v11 = "sha2 utilities"; v12 = "sha384sum"; v13 = "sha2 utilities"; v14 = "sha512sum"; v15 = "sha2 utilities"; v16 = 0; v17 = 0; v0 = a0; v1[0] = &v4; while (true) { if (!v1[0]) break; if (!strcmp(a0, v1[0])) break; v1[0] = v1 + 1; } if (v1[1]) v0 = v1[1]; printf(gettext("\n%s online help: <%s>\n")); v2 = setlocale(0x5, NULL); if (v2 && strncmp(v2, "en_", 0x3)) fputs_unlocked(gettext("Report any translation bugs to <https: if (!strcmp(a0, "[")) v20 = "test"; else v20 = a0; v3 = v20; printf(gettext("Full documentation <%s%s>\n")); printf(gettext("or available locally via: info '(coreutils) %s%s'\n")); v22 = *(&v18) ^ v21[5]; return; }
coreutils
angr_phoenix
int unbind_nameref(name) const char *name; { SHELL_VAR *v; v = var_lookup(name, shell_variables); if (v && ((((v)->attributes) & (0x0000800)))) return makunbound(name, shell_variables); return 0; }
long long unbind_nameref(char *a0) { struct_0 *v0; void *v2; v0 = var_lookup(a0, shell_variables); if (v0 && (v0->field_28 & 0x800)) v2 = makunbound(a0, shell_variables); if (!v0 || !(v0->field_28 & 0x800)) v2 = 0; return v2; }
bash
angr_dream
static void usage(int status) { FILE *usageout = (0 != status) ? stderr : stdout; (void)fprintf(usageout, gettext("Usage: %s [options]\n" "\n" "Options:\n") , Prog); (void)fputs(gettext(" -h, --help display this help " "message and exit\n"), usageout); (void)fputs( gettext(" -R, --root CHROOT_DIR directory to chroot into\n"), usageout); (void)fputs("\n", usageout); exit(status); }
void usage(unsigned long a0) { void *v0; unsigned long v1; unsigned long v3; void *v4; v1 = v3; if (a0) v4 = stderr; else v4 = stdout; v0 = v4; fprintf(v0, gettext("Usage: %s [options]\n\nOptions:\n")); fputs(gettext(" -h, --help display this help message and " "exit\n"), v0); fputs(gettext(" -R, --root CHROOT_DIR directory to chroot into\n"), v0); fputs("\n", v0); exit(a0); }
shadow
angr_dream
static wint_t collwcsym(s, len) wchar_t *s; int len; { register struct _collwcsym *csp; for (csp = posix_collwcsyms; csp->name; csp++) { if (((csp->name)[0] == (s)[0] && wcsncmp(csp->name, s, len) == 0) && csp->name[len] == L'\0') return (csp->code); } if (len == 1) return s[0]; return (0xffffffffu); }
int collwcsym(unsigned int *a0, unsigned long a1) { unsigned long long v1; unsigned int v2; v1 = &posix_collwcsyms; while (true) { if (*(v1)) { if (*(*(v1)) == *(a0) && !wcsncmp(*(v1), a0, a1) && !*((*(v1) + (a1 << 2)))) { v2 = *((v1 + 8)); break; } v1 += 16; } else if (a1 != 1) { v2 = -1; break; } else { v2 = *(a0); break; } } return v2; }
bash
angr_phoenix
static void check_time(char const *file_name, struct timespec t) { if (t.tv_sec < 0) do { if ((warning_option & (0x00008000))) do { if (error_hook) error_hook(); error(0, 0, gettext("%s: implausibly old time stamp %s"), file_name, tartime(t, 1)); } while (0); } while (0) ; else if (timespec_cmp(volume_start_time, t) < 0) { struct timespec now; gettime(&now); if (timespec_cmp(now, t) < 0) { char buf[TIMESPEC_STRSIZE_BOUND]; struct timespec diff; diff.tv_sec = t.tv_sec - now.tv_sec; diff.tv_nsec = t.tv_nsec - now.tv_nsec; if (diff.tv_nsec < 0) { diff.tv_nsec += BILLION; diff.tv_sec--; } do { if ((warning_option & (0x00008000))) do { if (error_hook) error_hook(); error(0, 0, gettext("%s: time stamp %s is %s s in the future"), file_name, tartime(t, 1), code_timespec(diff, buf)); } while (0); } while (0) ; } } }
void check_time(unsigned long a0, unsigned long long a1, unsigned long long a2) { unsigned long v0; char v1; char v2; unsigned long long v3; unsigned long long v4; char v5; char v6; unsigned long long v8; unsigned long long v9; unsigned long long v10; unsigned long long *v11; unsigned long long v12; v0 = a0; if (a1 >= 0) { if (timespec_cmp(volume_start_time, timespec_cmp, a1, a2) < 0) { gettime(&v1); if (timespec_cmp(*(&v1), *(&v2), a1, a2) < 0) { v3 = a1 - *(&v1); v4 = a2 - *(&v2); if (v4 < 0) { v4 += 0x3b9aca00; v3 -= 1; } if ((*(&warning_option) & 0x8000)) { if (*(&error_hook)) *(5243024)(); v9 = code_timespec(v3, v4, &v5, v3); v10 = tartime(a1, a2, 0x1, a1); error(0x0, 0x0, gettext("%s: time stamp %s is %s s in the future")); } } } } else { if ((*(&warning_option) & 0x8000)) { if (*(&error_hook)) *(5243024)(); v8 = tartime(a1, a2, 0x1, a1); error(0x0, 0x0, gettext("%s: implausibly old time stamp %s")); } } v12 = *(&v6) ^ v11[5]; return; }
tar
angr_phoenix
static inline __u32 rta_getattr_u32(const struct rtattr *rta) { return *(__u32 *)(( void *)(((char *)(rta)) + ((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0)))); }
undefined4 rta_getattr_u32(long param_1) { return *(undefined4 *)(param_1 + 4); }
iproute2-6.0.0
ghidra
static void pdf_gen_xor(pdf_ctx *pc, const UINT8 nonce[8], UINT8 buf[8]) { union { UINT8 tmp_nonce_lo[4]; UINT32 align; } t; *(UINT32 *)t.tmp_nonce_lo = ((const UINT32 *)nonce)[1]; t.tmp_nonce_lo[3] &= ~0; if ((((UINT32 *)t.tmp_nonce_lo)[0] != ((UINT32 *)pc->nonce)[1]) || (((const UINT32 *)nonce)[0] != ((UINT32 *)pc->nonce)[0])) { ((UINT32 *)pc->nonce)[0] = ((const UINT32 *)nonce)[0]; ((UINT32 *)pc->nonce)[1] = ((UINT32 *)t.tmp_nonce_lo)[0]; AES_encrypt((u_char *)(pc->nonce), (u_char *)(pc->cache), (AES_KEY *)pc->prf_key); } ((UINT64 *)buf)[0] ^= ((UINT64 *)pc->cache)[0]; ((UINT64 *)buf)[1] ^= ((UINT64 *)pc->cache)[1]; }
void pdf_gen_xor(struct_0 *a0, unsigned int a1[2], unsigned long long a2[2]) { unsigned int v0; char v1; char v2; unsigned long long *v4; unsigned long long v5; v0 = a1[1]; v1 = *(&v0 + 3); if (v0 != a0->field_14 || a1[0] != a0->field_10) { a0->field_10 = a1[0]; a0->field_14 = v0; AES_encrypt(&a0->field_10, a0, &a0[1].field_8, &a0->field_10); } a2[0] = a2[0] ^ a0->field_0; a2[1] = a0->field_8 ^ a2[1]; v5 = *(&v2) ^ v4[5]; return; }
openssh-portable
angr_sailr
static int dns_read_rdata(u_int8_t *algorithm, u_int8_t *digest_type, u_char **digest, size_t *digest_len, u_char *rdata, int rdata_len) { int success = 0; *algorithm = SSHFP_KEY_RESERVED; *digest_type = SSHFP_HASH_RESERVED; if (rdata_len >= 2) { *algorithm = rdata[0]; *digest_type = rdata[1]; *digest_len = rdata_len - 2; if (*digest_len > 0) { *digest = xmalloc(*digest_len); memcpy(*digest, rdata + 2, *digest_len); } else { *digest = (u_char *)xstrdup(""); } success = 1; } return success; }
int dns_read_rdata(char *a0, char *a1, unsigned long long *a2, unsigned long long *a3, char a4[2], unsigned long a5) { unsigned int v0; v0 = 0; *(a0) = 0; *(a1) = 0; if (a5 > 1) { *(a0) = a4[0]; *(a1) = a4[1]; *(a3) = __addvsi3(a5, 0xfffffffe, a4[1]); if (*(a3)) { *(a2) = xmalloc(*(a3)); memcpy(*(a2), a4 + 1, *(a3)); } else { *(a2) = xstrdup(&g_400c1c); } v0 = 1; } return v0; }
openssh-portable
angr_dream
void jbd2_journal_clear_revoke(journal_t *journal) { int i; struct list_head *hash_list; struct jbd2_revoke_record_s *record; struct jbd2_revoke_table_s *revoke; revoke = journal->j_revoke; for (i = 0; i < revoke->hash_size; i++) { hash_list = &revoke->hash_table[i]; while (!list_empty(hash_list)) { record = (struct jbd2_revoke_record_s *)hash_list->next; list_del(&record->hash); free(record); } } }
long long jbd2_journal_clear_revoke(struct_0 *a0) { unsigned int v0; struct_1 *v1; unsigned long long *v2; void *v3; v1 = a0->field_a8; for (v0 = 0; v0 < v1->field_0; v0 += 1) { v2 = v1->field_8 + v0 * 16; while (!list_empty(v2)) { v3 = *(v2); list_del(v3); free(v3); } } return v1->field_0; }
e2fsprogs-1.46.5
angr_phoenix
int ssh_digest_copy_state(struct ssh_digest_ctx *from, struct ssh_digest_ctx *to) { if (from->alg != to->alg) return -10; if (!EVP_MD_CTX_copy_ex(to->mdctx, from->mdctx)) return -22; return 0; }
long ssh_digest_copy_state(long a1, long a2) { if (*(_DWORD *)a1 != *(_DWORD *)a2) return 4294967286LL; if ((unsigned int)EVP_MD_CTX_copy_ex(*(_QWORD *)(a2 + 8), *(_QWORD *)(a1 + 8))) return 0LL; return 4294967274LL; }
openssh-portable
ida
char *string_list_dollar_at(list, quoted, flags) WORD_LIST *list; int quoted; int flags; { char *ifs, *ret; char sep[(__ctype_get_mb_cur_max()) + 1]; WORD_LIST *tlist; ifs = ifs_var ? ((ifs_var)->value) : (char *)0; if (flags & 0x08) { sep[0] = ' '; sep[1] = '\0'; } else if (ifs && *ifs) { if (ifs_firstc_len == 1) { sep[0] = ifs_firstc[0]; sep[1] = '\0'; } else { memcpy(sep, ifs_firstc, ifs_firstc_len); sep[ifs_firstc_len] = '\0'; } } else { sep[0] = ' '; sep[1] = '\0'; } tlist = (quoted & (0x002 | 0x001 | 0x008)) ? quote_list(list) : list_quote_escapes(list); ret = string_list_internal(tlist, sep); return ret; }
int string_list_dollar_at(unsigned long long a0, unsigned long long a1, unsigned long long a2, unsigned long long a3, unsigned long long a4, unsigned long long a5) { unsigned int v0; unsigned int v1; char v2; char v3[425802354520363005]; void *v4; void *v5; unsigned long v6; char v7; char v8; unsigned long v10; void *v11; void *v12; v1 = a1; v0 = a2; for (v10 = (0 CONCAT __ctype_get_mb_cur_max(a0, a1, a2, a3, a4, a5, *(&v0), a0, *(&v2)) + 16) / m 16 * 16; &v8 != &v0 + -1 * (v10 & -0x1000); v7 = *(&v7)) ; if ((v10 & 4095)) *((&v7 + (v10 & 4095))) = *((&v7 + (v10 & 4095))); *(&v3[0]) = &v8; if (false) v11 = 0; v11 = *(425802354520363012); v4 = v11; if ((v0 & 8)) { v3[0] = 32; v3[1] = 0; } else { if (v4 && *(v4)) { if (false) { v3[0] = 1480919671367579151; v3[1] = 0; } memcpy(v3, &ifs_firstc, 0x5e8c0fc45b60ffc); v3[425802354520363004] = 0; } if (!*(v4) || !v4) { v3[0] = 32; v3[1] = 0; } } if ((v1 & 11)) v12 = quote_list(a0); else v12 = list_quote_escapes(a0); v5 = v12; v6 = string_list_internal(v5, v3); return v6; }
bash
angr_dream
static void set_prefix(char *p) { char *s; prefix_lead_space = 0; while (*p == ' ') { prefix_lead_space++; p++; } prefix = p; prefix_full_length = strlen(p); s = p + prefix_full_length; while (s > p && s[-1] == ' ') s--; *s = '\0'; prefix_length = s - p; }
void set_prefix(char *a0) { char *v0; char *v1; unsigned long long v3; v0 = a0; for (prefix_lead_space = 0; *(v0) == 32; v0 += 1) { prefix_lead_space = prefix_lead_space + 1; } prefix = v0; prefix_full_length = strlen(v0); for (v1 = &v0[prefix_full_length]; v1 > v0; v1 += 1) { if (v1[1] != 32) break; } *(v1) = 0; v3 = v1 - v0; prefix_length = v1 - v0; return; }
coreutils
angr_dream
!ext2fs_has_feature_extents(fs->super) && fix_problem(ctx, 0x000048, &pctx)) { ext2fs_set_feature_extents(fs->super); ext2fs_mark_super_dirty(fs); }
int ext2fs_has_feature_extents(struct_0 *a0) { return (a0->field_60 & 64); }
e2fsprogs-1.46.5
angr_phoenix
int kex_derive_keys(struct ssh *ssh, u_char *hash, u_int hashlen, const struct sshbuf *shared_secret) { struct kex *kex = ssh->kex; u_char *keys[6]; u_int i, j, mode, ctos; int r; if ((kex->flags & 0x0002) != 0) { if (sshbuf_len(kex->session_id) != 0) { sshlog("kex.c", __func__, 1114, 1, SYSLOG_LEVEL_ERROR, ((void *)0), "already have session ID at kex"); return -1; } if ((r = sshbuf_put(kex->session_id, hash, hashlen)) != 0) return r; } else if (sshbuf_len(kex->session_id) == 0) { sshlog("kex.c", __func__, 1120, 1, SYSLOG_LEVEL_ERROR, ((void *)0), "no session ID in rekex"); return -1; } for (i = 0; i < 6; i++) { if ((r = derive_key(ssh, 'A' + i, kex->we_need, hash, hashlen, shared_secret, &keys[i])) != 0) { for (j = 0; j < i; j++) free(keys[j]); return r; } } for (mode = 0; mode < MODE_MAX; mode++) { ctos = (!kex->server && mode == MODE_OUT) || (kex->server && mode == MODE_IN); kex->newkeys[mode]->enc.iv = keys[ctos ? 0 : 1]; kex->newkeys[mode]->enc.key = keys[ctos ? 2 : 3]; kex->newkeys[mode]->mac.key = keys[ctos ? 4 : 5]; } return 0; }
long long kex_derive_keys(struct_0 *a0, unsigned long long a1, unsigned long a2, unsigned long long a3) { unsigned long long v0; unsigned int v1; unsigned int v2; unsigned int v3; unsigned int v4; unsigned int v5; struct_1 *v6; char v7; unsigned long long v9; unsigned int v10; unsigned long long v11; unsigned long long v12; v0 = a3; v6 = a0->field_8; if ((v6->field_8c & 2)) { if (sshbuf_len(v6->field_70)) { sshlog("kex.c", "kex_derive_keys", 0x45a, 0x1, 0x2, 0x0, "already have session ID at kex"); v9 = 4294967295; goto LABEL_4034a1; } v4 = sshbuf_put(v6->field_70, a1, a2, a1); if (v4) { v9 = v4; goto LABEL_4034a1; } } else if (!sshbuf_len(v6->field_70)) { sshlog("kex.c", "kex_derive_keys", 0x460, 0x1, 0x2, 0x0, "no session ID in rekex"); v9 = 4294967295; goto LABEL_4034a1; } v1 = 0; while (true) { if (v1 > 5) { v3 = 0; while (true) { if (v3 > 1) break; if (!v6->field_18 && v3 == 1) goto LABEL_40340c; if (!v6->field_18) { LABEL_403413: v10 = 0; LABEL_403418: v5 = v10; (&v6->field_0)[v3]->field_28 = *(&(&v7)[8 * (!v5)]); if (v5) v11 = 2; else v11 = 3; (&v6->field_0)[v3]->field_20 = *(&(&v7)[8 * v11]); if (!v5) v12 = 5; else v12 = 4; (&v6->field_0)[v3]->field_40 = *(&(&v7)[8 * v12]); v3 += 1; } else { if (!(!v3)) goto LABEL_403413; LABEL_40340c: v10 = 1; goto LABEL_403418; } } v9 = 0; break; } else { v4 = derive_key(a0, v1 + 65, v6->field_10, a1, a2, v0, &(&v7)[8 * v1]); if (!v4) { v1 += 1; } else { for (v2 = 0; v2 < v1; v2 += 1) { free(*(&(&v7)[8 * v2])); } v9 = v4; break; } } } LABEL_4034a1: return v9; }
openssh-portable
angr_phoenix
size_t hash_string(const char *string, size_t n_buckets) { size_t value = 0; unsigned char ch; for (; (ch = *string); string++) value = (value * 31 + ch) % n_buckets; return value; }
long long hash_string(unsigned long a0, unsigned long a1) { char *v0; char v1; void *v2; v0 = a0; v2 = 0; while (true) { v1 = *(v0); if (!v1) break; v2 = (0 CONCAT v1 + v2 * 31) / m a1 >> 64; v0 += 1; } return v2; }
gnutls
angr_sailr
void setup_async_signals() { if (job_control == 0) { get_original_signal(2); set_signal_handler(2, ((__sighandler_t)1)); get_original_signal(3); set_signal_handler(3, ((__sighandler_t)1)); } }
long long setup_async_signals() { unsigned long long v1; v1 = job_control; if (!job_control) { get_original_signal(0x2); set_signal_handler(0x2, 0x1); get_original_signal(0x3); v1 = set_signal_handler(0x3, 0x1); } return v1; }
bash
angr_phoenix
void rl_push_macro_input(char *macro) { _rl_with_macro_input(macro); }
long long rl_push_macro_input(unsigned long long a0, unsigned long long a1, unsigned long long a2, unsigned long long a3, unsigned long long a4, unsigned long long a5) { return _rl_with_macro_input(a0, a1, a2, a3, a4, a5); }
bash
angr_phoenix