input
stringlengths
26
172k
output
stringlengths
18
318k
repo_name
stringclasses
23 values
decompiler
stringclasses
5 values
int save_errno = (*__errno_location()), e, pgs = getpagesize(), faster = 0, repeat; static int cnt; struct timespec ts; struct timeval tv; struct rusage ru; sigset_t sigset; struct stat st; SHA512_CTX ctx; static pid_t lastpid; pid_t pid; size_t i, ii, m; char *p; pid = getpid(); if (lastpid == pid) { faster = 1; repeat = 2; } else {
int *__errno_location(void) { halt_baddata(); }
libbsd-0.11.7
ghidra
static _Bool transform_member_name(char **pinput, int type) { return transform_name_fp(pinput, type, decode_xform, &type); }
void transform_member_name(unsigned long long a0, unsigned long a1) { char v0; unsigned long long v2; v2 = transform_name_fp(a0, a1, decode_xform, &v0); return; }
tar
angr_phoenix
static float calc_percent(struct percent_tbl *tbl, int pass, int curr, int max) { float percent; if (pass <= 0) return 0.0; if (pass > tbl->max_pass || max == 0) return 100.0; percent = ((float)curr) / ((float)max); return ((percent * (tbl->table[pass] - tbl->table[pass - 1])) + tbl->table[pass - 1]); }
float calc_percent(int *a1, int a2, int a3, int a4) { if (a2 <= 0) return 0.0; if (a2 <= *a1 && a4) return (float)a1[a2] + (float)((float)(a1[a2 + 1] - a1[a2]) * (float)((float)a3 / (float)a4)); return 100.0; }
e2fsprogs-1.46.5
ida
static int ibuffer_space(void) { if (pop_index > push_index) return (pop_index - push_index - 1); else return (ibuffer_len - (push_index - pop_index)); }
int ibuffer_space() { unsigned int v1; if (pop_index > push_index) v1 = pop_index - push_index - 1; else v1 = ibuffer_len - (push_index - pop_index); return v1; }
bash
angr_phoenix
int mount_proc(void) { struct stat st; char *args[] = {"mount", "-t", "proc", "proc", "/proc", 0}; pid_t pid, rc; int wst; int did_mount = 0; if (stat("/proc/version", &st) < 0 && (*__errno_location()) == 2) { if ((pid = fork()) < 0) { nsyslog(3, "cannot fork"); exit(1); } if (pid == 0) { execv("/bin/mount", args); execv("/sbin/mount", args); nsyslog(3, "cannot execute mount"); exit(1); } while ((rc = wait(&wst)) != pid) if (rc < 0 && (*__errno_location()) == 10) break; if (rc != pid || (((wst) & 0xff00) >> 8) != 0) nsyslog(3, "mount returned non-zero exit status"); did_mount = 1; } if (stat("/proc/version", &st) < 0) { if ((*__errno_location()) == 2) nsyslog(3, "/proc not mounted, failed to mount."); else nsyslog(3, "/proc unavailable."); exit(1); } return did_mount; }
void mount_proc(unsigned long a0, unsigned long a1, unsigned int a2, unsigned int a3, unsigned int a4, unsigned int a5) { char v0; unsigned int v1; unsigned int v2; unsigned int v3; unsigned long long v4; unsigned long long v5; unsigned long long v6; unsigned long long v7; unsigned long long v8; void *v9; char v10; unsigned long long v14; v4 = "mount"; v5 = "-t"; v6 = "proc"; v7 = "proc"; v8 = "/proc"; v9 = 0; v1 = 0; if (stat("/proc/version", &v10) < 0 && *(__errno_location()) == 2) { v2 = fork(); if (v2 < 0) { nsyslog(0x3, "cannot fork", a2, a3, a4, a5); exit(0x1); } else if (!v2) { execv("/bin/mount", &v4); execv("/sbin/mount", &v4); nsyslog(0x3, "cannot execute mount", a2, a3, a4, a5); exit(0x1); } else { while (true) { v3 = wait(&v0); if (v3 == v2) break; if (!(v3 < 0)) continue; if (*(__errno_location()) == 10) break; } if (v3 == v2 && !(*(&v0) >> 8)) goto LABEL_40024c; nsyslog(0x3, "mount returned non-zero exit status", a2, a3, a4, a5); LABEL_40024c: v1 = 1; } } if (stat("/proc/version", &v10) < 0) { if (*(__errno_location()) != 2) nsyslog(0x3, "/proc unavailable.", a2, a3, a4, a5); else nsyslog(0x3, "/proc not mounted, failed to mount.", a2, a3, a4, a5); exit(0x1); } else { v14 = v1; return; } }
sysvinit
angr_phoenix
static void process_signals(void) { while (interrupt_signal || stop_signal_count) { int sig; int stops; sigset_t oldset; set_color_context(RESET_CONTEXT); fflush_unlocked(stdout); sigprocmask(0, &caught_signals, &oldset); sig = interrupt_signal; stops = stop_signal_count; if (stops) { stop_signal_count = stops - 1; sig = 19; } else signal(sig, ((__sighandler_t)0)); raise(sig); sigprocmask(2, &oldset, ((void *)0)); } }
void process_signals() { unsigned int v0; unsigned int v1; char v2; char v3; unsigned long long *v5; unsigned long long v6; while (true) { if (!interrupt_signal) { if (!stop_signal_count) break; } set_color_context(0x3); fflush_unlocked(stdout); sigprocmask(0x0, &caught_signals, &v2); v0 = interrupt_signal; v1 = stop_signal_count; if (v1) { stop_signal_count = v1 - 1; v0 = 19; } else { signal(v0, 0x0); } raise(v0); sigprocmask(0x2, &v2, NULL); } v6 = *(&v3) ^ v5[5]; return; }
diffutils
angr_dream
static char const *get_default_format(operand first, operand step, operand last) { static char format_buf[sizeof "%0.Lf" + 2 * (((((sizeof(int) * 8) - (!((__typeof__(int))0 < (__typeof__(int))-1))) * 146 + 484) / 485) + (!((__typeof__(int))0 < (__typeof__(int))-1)))]; int prec = (((first.precision) > (step.precision)) ? (first.precision) : (step.precision)); if (prec != 0x7fffffff && last.precision != 0x7fffffff) { if (equal_width) { size_t first_width = first.width + (prec - first.precision); size_t last_width = last.width + (prec - last.precision); if (last.precision && prec == 0) last_width--; if (last.precision == 0 && prec) last_width++; if (first.precision == 0 && prec) first_width++; size_t width = (((first_width) > (last_width)) ? (first_width) : (last_width)); if (width <= 0x7fffffff) { int w = width; sprintf(format_buf, "%%0%d.%dLf", w, prec); return format_buf; } } else { sprintf(format_buf, "%%.%dLf", prec); return format_buf; } } return "%Lg"; }
int get_default_format() { unsigned int v0; unsigned int v1; unsigned long long v2; unsigned long long v3; unsigned long v4; char v6; char v7; char v8; char v9; char v10; unsigned int v12; unsigned long long v13; v12 = *(&v7); if (*(&v7) <= *(&v8)) v12 = *(&v8); v0 = v12; if (v0 == 2147483647) { return; } else if (*(&v10) == 2147483647) { return; } else if (equal_width) { v2 = v0 - *(&v7) + *(&v6); v3 = v0 - *(&v10) + *(&v9); if (*(&v10) && !v0) v3 -= 1; if (!*(&v10) && v0) v3 += 1; if (!*(&v7) && v0) v2 += 1; v13 = v2; if (v2 <= v3) v13 = v3; v4 = v13; if (v4 < 0x80000000) { v1 = v4; sprintf(&format_buf.5839, "%%0%d.%dLf", v1, v0); return; } return; } else { sprintf(&format_buf.5839, "%%.%dLf", v0); return; } }
coreutils
angr_sailr
static int shouldexp_filterpat(s) char *s; { register char *p; for (p = s; p && *p; p++) { if (*p == '\\') p++; else if (*p == '&') return 1; } return 0; }
long shouldexp_filterpat(_BYTE *a1) { while (a1 && *a1) { if (*a1 == 92) { ++a1; } else if (*a1 == 38) { return 1LL; } ++a1; } return 0LL; }
bash
ida
static void set_LD_PRELOAD(void) { int ret; char const *preload_env = "LD_PRELOAD"; char *old_libs = getenv(preload_env); char *LD_PRELOAD; char const *const search_path[] = {program_path, "/usr/local/libexec/coreutils", ((void *)0) }; char const *const *path = search_path; char *libstdbuf; while (1) { struct stat sb; if (!**path) { libstdbuf = xstrdup("libstdbuf.so"); break; } ret = asprintf(&libstdbuf, "%s/%s", *path, "libstdbuf.so"); if (ret < 0) xalloc_die(); if (stat(libstdbuf, &sb) == 0) break; free(libstdbuf); ++path; if (!*path) ((!!sizeof(struct { _Static_assert(EXIT_CANCELED, "verify_expr (" "EXIT_CANCELED" ", " "(error (EXIT_CANCELED, 0, gettext (\"failed to find " "%s\"), quote (\"libstdbuf.so\")), assume (false))" ")"); int _gl_dummy; })) ? ((error(EXIT_CANCELED, 0, gettext("failed to find %s"), quote("libstdbuf.so")), ((0) ? (void)0 : __builtin_unreachable()))) : ((error(EXIT_CANCELED, 0, gettext("failed to find %s"), quote("libstdbuf.so")), ((0) ? (void)0 : __builtin_unreachable())))); } if (old_libs) ret = asprintf(&LD_PRELOAD, "%s=%s:%s", preload_env, old_libs, libstdbuf); else ret = asprintf(&LD_PRELOAD, "%s=%s", preload_env, libstdbuf); if (ret < 0) xalloc_die(); free(libstdbuf); ret = putenv(LD_PRELOAD); if (ret != 0) { ((!!sizeof(struct { _Static_assert(EXIT_CANCELED, "verify_expr (" "EXIT_CANCELED" ", " "(error (EXIT_CANCELED, (*__errno_location ()), gettext " "(\"failed to update the environment with %s\"), quote " "(LD_PRELOAD)), assume (false))" ")"); int _gl_dummy; })) ? ((error(EXIT_CANCELED, (*__errno_location()), gettext("failed to update the environment with %s"), quote(LD_PRELOAD)), ((0) ? (void)0 : __builtin_unreachable()))) : ((error(EXIT_CANCELED, (*__errno_location()), gettext("failed to update the environment with %s"), quote(LD_PRELOAD)), ((0) ? (void)0 : __builtin_unreachable())))) ; } }
void set_LD_PRELOAD(void) { int iVar1; undefined8 uVar2; undefined8 uVar3; int *piVar4; long in_FS_OFFSET; int local_104; char *local_100; char *local_f8; char **local_f0; char *local_e8; char *local_e0; char *local_d8; char *local_d0; undefined8 local_c8; stat local_b8; long local_20; local_20 = *(long *)(in_FS_OFFSET + 0x28); local_e8 = "LD_PRELOAD"; local_e0 = getenv("LD_PRELOAD"); local_d8 = program_path; local_d0 = "/usr/local/libexec/coreutils"; local_c8 = 0; local_f0 = &local_d8; do { if (**local_f0 == '\0') { local_f8 = (char *)xstrdup("libstdbuf.so"); goto LAB_001007cc; } iVar1 = asprintf(&local_f8, "%s/%s", *local_f0, "libstdbuf.so"); if (iVar1 < 0) { xalloc_die(); } iVar1 = stat(local_f8, &local_b8); if (iVar1 == 0) goto LAB_001007cc; free(local_f8); local_f0 = local_f0 + 1; } while (*local_f0 != (char *)0x0); uVar2 = quote("libstdbuf.so"); uVar3 = gettext("failed to find %s"); error(0x7d, 0, uVar3, uVar2); LAB_001007cc: if (local_e0 == (char *)0x0) { local_104 = asprintf(&local_100, "%s=%s", local_e8, local_f8); } else { local_104 = asprintf(&local_100, "%s=%s:%s", local_e8, local_e0, local_f8); } if (local_104 < 0) { xalloc_die(); } free(local_f8); iVar1 = putenv(local_100); if (iVar1 != 0) { uVar2 = quote(local_100); uVar3 = gettext("failed to update the environment with %s"); piVar4 = __errno_location(); error(0x7d, *piVar4, uVar3, uVar2); } if (local_20 != *(long *)(in_FS_OFFSET + 0x28)) { __stack_chk_fail(); } return; }
coreutils
ghidra
static time_t reaper(void) { time_t deadline = 0, now = monotime(); Identity *id, *nxt; for (id = ((&idtab->idlist)->tqh_first); id; id = nxt) { nxt = ((id)->next.tqe_next); if (id->death == 0) continue; if (now >= id->death) { sshlog("ssh-agent.c", __func__, 940, 0, SYSLOG_LEVEL_DEBUG1, ((void *)0), "expiring key '%s'", id->comment); do { if (((id)->next.tqe_next) != ((void *)0)) (id)->next.tqe_next->next.tqe_prev = (id)->next.tqe_prev; else (&idtab->idlist)->tqh_last = (id)->next.tqe_prev; *(id)->next.tqe_prev = (id)->next.tqe_next; ; ; } while (0); free_identity(id); idtab->nentries--; } else deadline = (deadline == 0) ? id->death : (((deadline) < (id->death)) ? (deadline) : (id->death)); } if (deadline == 0 || deadline <= now) return 0; else return (deadline - now); }
int reaper() { void *v0; struct_0 *v1; unsigned long long v2; unsigned long long v3[6]; unsigned long v5; v0 = 0; v2 = monotime(); for (v1 = *(16752697131771134800); v1; v1 = &v3[0]) { v3[0] = v1->field_0; if (v1->field_28) { if (v2 < v1->field_28) { if (!v0) { v5 = v1->field_28; } else { v5 = v1->field_28; if (v0 <= v1->field_28) v5 = v0; } v0 = v5; } else { sshlog("ssh-agent.c", "reaper", 0x3ac, 0x0, 0x5, 0x0, "expiring key '%s'", v1->field_18, v0, v1, v2); if (v1->field_0) v1->field_0->field_8 = v1->field_8; else g_e87d894820ec8358 = &v1->field_8->field_0; v1->field_8->field_0 = v1->field_0; free_identity(v1); g_e87d894820ec8348 = __addvsi3(g_e87d894820ec8348, 0xffffffff); } } } if (!v0) { LABEL_402b94: *(&v5) = 0; } else { if (v0 <= v2) goto LABEL_402b94; v5 = __subvdi3(v0, v2); } return v5; }
openssh-portable
angr_phoenix
void monotime_tv(struct timeval *tv) { struct timespec ts; monotime_ts(&ts); tv->tv_sec = ts.tv_sec; tv->tv_usec = ts.tv_nsec / 1000; }
void monotime_tv(unsigned long long a0[2]) { char v0; char v1; char v2; unsigned long long *v4; unsigned long long v5; monotime_ts(&v0); a0[0] = *(&v0); a0[1] = (*(&v1) * 2361183241434822607 >> 64 >> 7) - (*(&v1) >> 63); v5 = *(&v2) ^ v4[5]; return; }
openssh-portable
angr_phoenix
static void handle_fs_bad_blocks(e2fsck_t ctx) { ext2_filsys fs = ctx->fs; dgrp_t i; blk64_t first_block; blk64_t new_blk; for (i = 0; i < fs->group_desc_count; i++) { first_block = ext2fs_group_first_block2(fs, i); if (ctx->invalid_block_bitmap_flag[i]) { new_blk = ext2fs_block_bitmap_loc(fs, i); new_table_block(ctx, first_block, i, (gettext("block bitmap")), 1, &new_blk); ext2fs_block_bitmap_loc_set(fs, i, new_blk); } if (ctx->invalid_inode_bitmap_flag[i]) { new_blk = ext2fs_inode_bitmap_loc(fs, i); new_table_block(ctx, first_block, i, (gettext("inode bitmap")), 1, &new_blk); ext2fs_inode_bitmap_loc_set(fs, i, new_blk); } if (ctx->invalid_inode_table_flag[i]) { new_blk = ext2fs_inode_table_loc(fs, i); new_table_block(ctx, first_block, i, (gettext("inode table")), fs->inode_blocks_per_group, &new_blk); ext2fs_inode_table_loc_set(fs, i, new_blk); ctx->flags |= 0x0004; } } ctx->invalid_bitmaps = 0; }
void handle_fs_bad_blocks(struct_0 *a0, unsigned long a1, unsigned long a2, unsigned long long a3) { unsigned int v0; unsigned long long v1; unsigned int v2[19]; unsigned long long v3; char v4; unsigned long long *v6; unsigned long long v7; *(&v2[0]) = a0->field_0; for (v0 = 0; v0 < v2[12]; v0 += 1) { v3 = ext2fs_group_first_block2(v2, v0, v0, a3); if (*((a0->field_1f8 + (v0 << 2)))) { v1 = ext2fs_block_bitmap_loc(v2, v0, v0); new_table_block(a0, v3, v0, gettext("block bitmap"), 0x1, &v1); a3 = v0; ext2fs_block_bitmap_loc_set(v2, v0, v1, v0); } if (*((a0->field_1f0 + (v0 << 2)))) { v1 = ext2fs_inode_bitmap_loc(v2, v0, v0); new_table_block(a0, v3, v0, gettext("inode bitmap"), 0x1, &v1); a3 = v0; ext2fs_inode_bitmap_loc_set(v2, v0, v1, v0); } if (*((a0->field_200 + (v0 << 2)))) { v1 = ext2fs_inode_table_loc(v2, v0, v0); new_table_block(a0, v3, v0, gettext("inode table"), v2[18], &v1); a3 = v0; ext2fs_inode_table_loc_set(v2, v0, v1, v0); a0->field_48 = a0->field_48 | 4; } } a0->field_208 = 0; v7 = *(&v4) ^ v6[5]; return; }
e2fsprogs-1.46.5
angr_dream
static char *memcpy_lowcase(char *dest, const char *src, size_t len) { while (len-- > 0) dest[len] = tolower((unsigned char)src[len]); return dest; }
void memcpy_lowcase(char *a0, char *a1, unsigned long long a2) { char *v0; char *v2; char *v3; v0 = a2; while (true) { v2 = v0; v0 += 1; if (!v2) break; *((v0 + a0)) = tolower(*((v0 + a1))); } v3 = a0; return; }
gnutls
angr_dream
void ensure_package_clientdata(struct pkginfo *pkg) { if (pkg->clientdata) return; pkg->clientdata = nfmalloc(sizeof(*pkg->clientdata)); pkg->clientdata->istobe = PKG_ISTOBE_NORMAL; pkg->clientdata->color = PKG_CYCLE_WHITE; pkg->clientdata->enqueued = 0; pkg->clientdata->replacingfilesandsaid = 0; pkg->clientdata->cmdline_seen = 0; pkg->clientdata->trigprocdeferred = ((void *)0); }
long long ensure_package_clientdata(struct_1 *a0) { struct_0 *v1; v1 = a0->field_138; if (!a0->field_138) { a0->field_138 = nfmalloc(0x20); a0->field_138->field_0 = 0; a0->field_138->field_4 = 0; a0->field_138->field_8 = 0; a0->field_138->field_c = 0; a0->field_138->field_10 = 0; v1 = a0->field_138; a0->field_138->field_18 = 0; } return v1; }
dpkg
angr_phoenix
static void get_field_list(void) { switch (header_mode) { case DEFAULT_MODE: alloc_field(SOURCE_FIELD, ((void *)0)); if (print_type) alloc_field(FSTYPE_FIELD, ((void *)0)); alloc_field(SIZE_FIELD, ((void *)0)); alloc_field(USED_FIELD, ((void *)0)); alloc_field(AVAIL_FIELD, ((void *)0)); alloc_field(PCENT_FIELD, ((void *)0)); alloc_field(TARGET_FIELD, ((void *)0)); break; case HUMAN_MODE: alloc_field(SOURCE_FIELD, ((void *)0)); if (print_type) alloc_field(FSTYPE_FIELD, ((void *)0)); alloc_field(SIZE_FIELD, "Size"); alloc_field(USED_FIELD, ((void *)0)); alloc_field(AVAIL_FIELD, "Avail"); alloc_field(PCENT_FIELD, ((void *)0)); alloc_field(TARGET_FIELD, ((void *)0)); break; case INODES_MODE: alloc_field(SOURCE_FIELD, ((void *)0)); if (print_type) alloc_field(FSTYPE_FIELD, ((void *)0)); alloc_field(ITOTAL_FIELD, ((void *)0)); alloc_field(IUSED_FIELD, ((void *)0)); alloc_field(IAVAIL_FIELD, ((void *)0)); alloc_field(IPCENT_FIELD, ((void *)0)); alloc_field(TARGET_FIELD, ((void *)0)); break; case POSIX_MODE: alloc_field(SOURCE_FIELD, ((void *)0)); if (print_type) alloc_field(FSTYPE_FIELD, ((void *)0)); alloc_field(SIZE_FIELD, ((void *)0)); alloc_field(USED_FIELD, ((void *)0)); alloc_field(AVAIL_FIELD, ((void *)0)); alloc_field(PCENT_FIELD, "Capacity"); alloc_field(TARGET_FIELD, ((void *)0)); break; case OUTPUT_MODE: if (!ncolumns) { decode_output_arg(all_args_string); } break; default: ((void)sizeof((!"invalid header_mode") ? 1 : 0), __extension__({ if (!"invalid header_mode") ; else __assert_fail("!\"invalid header_mode\"", "src/df.c", 565, __extension__ __PRETTY_FUNCTION__); })); } }
void get_field_list() { switch (header_mode) { case 0: alloc_field(0, 0LL); if (print_type) alloc_field(1, 0LL); alloc_field(2, 0LL); alloc_field(3, 0LL); alloc_field(4, 0LL); alloc_field(5, 0LL); alloc_field(10, 0LL); break; case 1: alloc_field(0, 0LL); if (print_type) alloc_field(1, 0LL); alloc_field(6, 0LL); alloc_field(7, 0LL); alloc_field(8, 0LL); alloc_field(9, 0LL); alloc_field(10, 0LL); break; case 2: alloc_field(0, 0LL); if (print_type) alloc_field(1, 0LL); alloc_field(2, (long)"Size"); alloc_field(3, 0LL); alloc_field(4, (long)"Avail"); alloc_field(5, 0LL); alloc_field(10, 0LL); break; case 3: alloc_field(0, 0LL); if (print_type) alloc_field(1, 0LL); alloc_field(2, 0LL); alloc_field(3, 0LL); alloc_field(4, 0LL); alloc_field(5, (long)"Capacity"); alloc_field(10, 0LL); break; case 4: if (!ncolumns) decode_output_arg((long)all_args_string); break; default: _assert_fail("!\"invalid header_mode\"", "src/df.c", 0x235u, "get_field_list"); } }
coreutils
ida
void malloc_trace_bin(n) int n; { }
long long malloc_trace_bin(unsigned long a0) { unsigned int v0; unsigned long v2; v0 = a0; return v2; }
bash
angr_phoenix
int opt_flag(const char *opt, int allow_negate, const char **optsp) { size_t opt_len = strlen(opt); const char *opts = *optsp; int negate = 0; if (allow_negate && strncasecmp(opts, "no-", 3) == 0) { opts += 3; negate = 1; } if (strncasecmp(opts, opt, opt_len) == 0) { *optsp = opts + opt_len; return negate ? 0 : 1; } return -1; }
long opt_flag(const char *a1, int a2, char **a3) { int v5; char *s1; size_t n; n = strlen(a1); s1 = *a3; v5 = 0; if (a2 && !strncasecmp(s1, "no-", 3uLL)) { s1 += 3; v5 = 1; } if (strncasecmp(s1, a1, n)) return 0xFFFFFFFFLL; *a3 = &s1[n]; return v5 == 0; }
openssh-portable
ida
uLong crc32_combine(crc1, crc2, len2) uLong crc1; uLong crc2; off_t len2; { return crc32_combine64(crc1, crc2, (off64_t)len2); }
unsigned long crc32_combine(unsigned int a1, unsigned int a2, long a3) { return crc32_combine64(a1, a2, a3); }
zlib
ida
(r = asprintf(&back, "%s.old", filename)) == -1) { r = -2; goto fail; }
int asprintf(char **__ptr, char *__fmt, ...) { halt_baddata(); }
openssh-portable
ghidra
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 [NUMBER]...\n or: %s OPTION\n") , program_name, program_name); fputs_unlocked(gettext("Print the prime factors of each specified integer " "NUMBER. If none\nare specified on the command " "line, read them from standard input.\n\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("factor"); } exit(status); }
long long usage(unsigned long a0) { unsigned long v0; unsigned long v1; unsigned long v3; unsigned long v4; v1 = v3; v0 = v4; if (a0) { fprintf(stderr, gettext("Try '%s --help' for more information.\n")); } else { printf(gettext("Usage: %s [NUMBER]...\n or: %s OPTION\n")); fputs_unlocked(gettext("Print the prime factors of each specified integer " "NUMBER. If none\nare specified on the command " "line, read them from standard input.\n\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("factor"); } exit(a0); }
coreutils
angr_dream
static int major_from_header(const char *p, size_t s) { return from_header( p, s, "major_t", ((int)~( (int)(!(!((int)0 < (int)-1)) ? (int)-1 : ((((int)1 << ((sizeof(int) * 8) - 2)) - 1) * 2 + 1)))), ((int)(!(!((int)0 < (int)-1)) ? (int)-1 : ((((int)1 << ((sizeof(int) * 8) - 2)) - 1) * 2 + 1))), 0, 0); }
int major_from_header(unsigned long long a0, unsigned long long a1) { return from_header(a0, a1, "major_t", 0xffffffff80000000, 0x7fffffff, 0x0, 0x0); }
tar
angr_sailr
static void add_key(struct sshkey *k, char *name, char *label) { struct pkcs11_keyinfo *ki; ki = xcalloc(1, sizeof(*ki)); ki->providername = xstrdup(name); ki->key = k; ki->label = xstrdup(label); do { (ki)->next.tqe_next = ((void *)0); (ki)->next.tqe_prev = (&pkcs11_keylist)->tqh_last; *(&pkcs11_keylist)->tqh_last = (ki); (&pkcs11_keylist)->tqh_last = &(ki)->next.tqe_next; } while (0); }
void add_key(undefined8 param_1, undefined8 param_2, undefined8 param_3) { undefined8 *puVar1; undefined8 uVar2; puVar1 = (undefined8 *)xcalloc(1, 0x28); uVar2 = xstrdup(param_2); puVar1[1] = uVar2; *puVar1 = param_1; uVar2 = xstrdup(param_3); puVar1[2] = uVar2; puVar1[3] = 0; puVar1[4] = pkcs11_keylist._8_8_; *pkcs11_keylist._8_8_ = (long)puVar1; pkcs11_keylist._8_8_ = puVar1 + 3; return; }
openssh-portable
ghidra
void rtrim(char *s) { size_t i; if ((i = strlen(s)) == 0) return; for (i--; i > 0; i--) { if (((*__ctype_b_loc())[(int)(((int)s[i]))] & (unsigned short int)_ISspace)) s[i] = '\0'; } }
size_t rtrim(const char *a1) { size_t result; size_t i; result = strlen(a1); if (result) { for (i = result - 1; i; --i) { result = (*_ctype_b_loc())[a1[i]] & 0x2000; if ((_DWORD)result) { result = (size_t)&a1[i]; a1[i] = 0; } } } return result; }
openssh-portable
ida
static int setenv_TZ(char const *tz) { return tz ? setenv("TZ", tz, 1) : unsetenv("TZ"); }
int setenv_TZ(char *a0) { unsigned long long v1; if (a0) v1 = setenv("TZ", a0, 0x1); else v1 = unsetenv("TZ"); return v1; }
gnutls
angr_dream
== set_element(bits, low, high, i)) { unget_char(ch, file); return ((-1)); }
undefined8 set_element(long param_1, uint param_2, uint param_3, int param_4) { undefined8 uVar1; if ((DebugFlags & 9) != 0) { printf("set_element(?,%d,%d,%d)\n", (ulong)param_2, (ulong)param_3); } if ((param_4 < (int)param_2) || ((int)param_3 < param_4)) { uVar1 = 0xffffffff; } else { *(byte *)(param_1 + ((int)(param_4 - param_2) >> 3)) = *(byte *)(param_1 + ((int)(param_4 - param_2) >> 3)) | (byte)(1 << ((char)param_4 - (char)param_2 & 7U)); uVar1 = 0; } return uVar1; }
cronie
ghidra
static void main_sigchld_handler(int sig) { int save_errno = (*__errno_location()); pid_t pid; int status; while ((pid = waitpid(-1, &status, 1)) > 0 || (pid == -1 && (*__errno_location()) == 4)) ; (*__errno_location()) = save_errno; }
long long main_sigchld_handler(unsigned long a0) { unsigned int v0; char v1; unsigned int v2; unsigned int v3; v0 = a0; v2 = *(__errno_location()); while (true) { do { v3 = waitpid(0xffffffff, &v1, 0x1); } while (v3 > 0); if (v3 != -1) break; if (*(__errno_location()) != 4) break; } *(__errno_location()) = v2; return 0; }
openssh-portable
angr_phoenix
int inflateValidate(strm, check) z_streamp strm; int check; { struct inflate_state *state; if (inflateStateCheck(strm)) return (-2); state = (struct inflate_state *)strm->state; if (check && state->wrap) state->wrap |= 4; else state->wrap &= ~4; return 0; }
long inflateValidate(_QWORD *a1, int a2) { long v3; if (inflateStateCheck(a1)) return 4294967294LL; v3 = a1[7]; if (a2 && *(_DWORD *)(v3 + 16)) *(_DWORD *)(v3 + 16) |= 4u; else *(_DWORD *)(v3 + 16) &= ~4u; return 0LL; }
zlib
ida
static int depmod_modules_search_dir(struct depmod *depmod, DIR *d, size_t baselen, struct scratchbuf *s_path) { struct dirent *de; int err = 0, dfd = dirfd(d); char *path; while ((de = readdir(d)) != ((void *)0)) { const char *name = de->d_name; size_t namelen; uint8_t is_dir; if (should_exclude_dir(depmod->cfg, name)) continue; namelen = strlen(name); if (scratchbuf_alloc(s_path, baselen + namelen + 2) < 0) { err = -12; log_printf(3, "No memory\n"); continue; } path = scratchbuf_str(s_path); memcpy(path + baselen, name, namelen + 1); if (de->d_type == DT_REG) is_dir = 0; else if (de->d_type == DT_DIR) is_dir = 1; else { struct stat st; if (fstatat(dfd, name, &st, 0) < 0) { log_printf(3, "fstatat(%d, %s): %m\n", dfd, name); continue; } else if (((((st.st_mode)) & 0170000) == (0100000))) is_dir = 0; else if (((((st.st_mode)) & 0170000) == (0040000))) is_dir = 1; else { log_printf(3, "unsupported file type %s: %o\n", path, st.st_mode & 0170000); continue; } } if (is_dir) { int fd; DIR *subdir; fd = openat(dfd, name, 00); if (fd < 0) { log_printf(3, "openat(%d, %s, O_RDONLY): %m\n", dfd, name); continue; } subdir = fdopendir(fd); if (subdir == ((void *)0)) { log_printf(3, "fdopendir(%d): %m\n", fd); close(fd); continue; } path[baselen + namelen] = '/'; path[baselen + namelen + 1] = '\0'; err = depmod_modules_search_dir(depmod, subdir, baselen + namelen + 1, s_path); closedir(subdir); } else { err = depmod_modules_search_file(depmod, baselen, namelen, path); } if (err < 0) { path[baselen + namelen] = '\0'; log_printf(3, "failed %s: %s\n", path, strerror(-err)); err = 0; } } return err; }
int depmod_modules_search_dir(unsigned long long *a0, unsigned long long a1, unsigned long long a2, unsigned long long *a3, unsigned long long a4) { unsigned long v0; char v1; unsigned int v2; unsigned int v3; unsigned int v4; struct_0 *v5; void *v6; unsigned long long v7; char *v8; unsigned long long v9; char v10; char v11; v0 = a2; v2 = 0; v3 = dirfd(a1); while (true) { while (true) { while (true) { do { v5 = readdir(a1); if (!v5) return v2; } while ((v6 = (v5 + 19), should_exclude_dir(*(a0), v6))); v7 = strlen(v6); if (scratchbuf_alloc(a3, v7 + v0 + 2, v7 + v0 + 2) >= 0) break; v2 = -12; log_printf(0x3, "No memory\n", a2, a3, a4); } v8 = scratchbuf_str(a3); memcpy(&v8[v0], v6, v7 + 1); switch (v5->field_12) { case 8: v1 = 0; break; case 4: v1 = 1; break; default: if (fstatat(v3, v6, &v10, 0x0) < 0) { a2 = v3; log_printf(0x3, "fstatat(%d, %s): %m\n", v3, v6, a4); continue; } else { switch (*(&v11) & 0xf000) { case 32768: v1 = 0; break; case 16384: v1 = 1; break; default: log_printf(0x3, "unsupported file type %s: %o\n", v8, *(&v11) & 0xf000, a4); continue; } } } if (!v1) { v2 = depmod_modules_search_file(a0, v0, v7, v8, a4); } else { v4 = openat(v3, v6, 0x0, v6); if (v4 < 0) { a2 = v3; log_printf(0x3, "openat(%d, %s, O_RDONLY): %m\n", v3, v6, a4); continue; } else { v9 = fdopendir(v4); if (v9) { v8[v7 + v0] = 47; v8[1 + v0 + v7] = 0; v2 = depmod_modules_search_dir(a0, v9, v7 + v0 + 1, a3, a4); closedir(v9); } else { log_printf(0x3, "fdopendir(%d): %m\n", v4, a3, a4); close(v4); continue; } } } if (v2 < 0) break; } v8[v7 + v0] = 0; log_printf(0x3, "failed %s: %s\n", v8, strerror(-(v2)), a4); v2 = 0; } }
kmod
angr_sailr
void rl_prep_terminal(int meta_flag __attribute__((__unused__))) { el_set(e, 16, 1); }
long rl_prep_terminal() { return el_set(e, 16LL, 1LL); }
libedit
ida
static inline void emit_stdin_note(void) { fputs_unlocked( gettext("\nWith no FILE, or when FILE is -, read standard input.\n"), stdout) ; }
int emit_stdin_note() { FILE *v0; char *v1; v0 = stdout; v1 = gettext("\nWith no FILE, or when FILE is -, read standard input.\n"); return fputs_unlocked(v1, v0); }
coreutils
ida
static void treefails(struct tree const *tree, struct trie const *fail, struct trie *recourse, _Bool reverse) { struct tree *cur; if (!tree) return; treefails(tree->llink, fail, recourse, reverse); treefails(tree->rlink, fail, recourse, reverse); while (fail) { cur = fail->links; while (cur && tree->label != cur->label) if (tree->label < cur->label) cur = cur->llink; else cur = cur->rlink; if (cur) { tree->trie->fail = cur->trie; if (!reverse && cur->trie->accepting && !tree->trie->accepting) tree->trie->accepting = -1; return; } fail = fail->fail; } tree->trie->fail = recourse; }
void treefails(undefined8 *param_1, long param_2, undefined8 param_3, char param_4) { long local_28; undefined8 *local_10; if (param_1 != (undefined8 *)0x0) { treefails(*param_1, param_2, param_3, param_4); treefails(param_1[1], param_2, param_3, param_4); for (local_28 = param_2; local_28 != 0; local_28 = *(long *)(local_28 + 0x20)) { local_10 = *(undefined8 **)(local_28 + 8); while ((local_10 != (undefined8 *)0x0 && (*(char *)(param_1 + 3) != *(char *)(local_10 + 3)))) { if (*(byte *)(param_1 + 3) < *(byte *)(local_10 + 3)) { local_10 = (undefined8 *)*local_10; } else { local_10 = (undefined8 *)local_10[1]; } } if (local_10 != (undefined8 *)0x0) { *(undefined8 *)(param_1[2] + 0x20) = local_10[2]; if (param_4 == '\x01') { return; } if (*(long *)local_10[2] == 0) { return; } if (*(long *)param_1[2] != 0) { return; } *(undefined8 *)param_1[2] = 0xffffffffffffffff; return; } } *(undefined8 *)(param_1[2] + 0x20) = param_3; } return; }
grep
ghidra
void fatal_nontarget_file_error(int errno_value, const char *name) { state.already_issued_stat_error_msg = 0; report_file_err(1, errno_value, 0, name); abort(); }
void fatal_nontarget_file_error(int a1, long a2) { LOBYTE(state[14]) = 0; report_file_err(1, a1, 0, a2); abort(); }
findutils
ida
static void process_config_files(const char *host_name, struct passwd *pw, int final_pass, int *want_final_pass) { char buf[4096]; int r; if (config != ((void *)0)) { if (strcasecmp(config, "none") != 0 && !read_config_file(config, pw, host, host_name, &options, 2 | (final_pass ? 4 : 0), want_final_pass)) sshfatal("ssh.c", __func__, 566, 0, SYSLOG_LEVEL_FATAL, ((void *)0), "Can't open user config file %.100s: " "%.100s", config, strerror((*__errno_location()))); } else { r = snprintf(buf, sizeof buf, "%s/%s", pw->pw_dir, ".ssh" "/config"); if (r > 0 && (size_t)r < sizeof(buf)) (void)read_config_file(buf, pw, host, host_name, &options, 1 | 2 | (final_pass ? 4 : 0), want_final_pass); (void)read_config_file("/usr/local/etc" "/ssh_config", pw, host, host_name, &options, final_pass ? 4 : 0, want_final_pass); } }
void process_config_files(unsigned long long a0, unsigned long long a1, unsigned long a2, unsigned long long a3) { unsigned long long v0; unsigned long v1; unsigned long v2; struct_0 *v3; unsigned long long v4; unsigned int v5; char v6; unsigned long long v7; unsigned long v8; unsigned long long *v13; unsigned long long v14; v7 = *(&v7); v4 = a0; v3 = a1; if (!config) { LABEL_401569: v5 = snprintf(&v6, 0x1000, "%s/%s", v3->field_20, &g_408bc3); if (v5 > 0 && v5 <= 4095) { v8 = a3; read_config_file(&v6, v3, 0x48000ffff1058b48, v4, &hostaddr, (!a2 ? 7 : 3)); } v8 = a3; read_config_file("/usr/local/etc/ssh_config", v3, 0x48000ffff1058b48, v4, &hostaddr, (!a2 ? 4 : 0)); } else if (strcasecmp(config, "none") && (v2 = a3, !read_config_file(config, v3, 0x48000ffff1058b48, v4, &hostaddr, (!a2 ? 6 : 2)))) { v2 = strerror(*(__errno_location())); v1 = config; v0 = "Can't open user config file %.100s: %.100s"; sshfatal("ssh.c", "process_config_files", 0x236, 0x0, 0x1, 0x0); goto LABEL_401569; } v14 = v8 ^ v13[5]; return; }
openssh-portable
angr_sailr
static void usage(void) { fprintf(stderr, "%s, %s\n", "OpenSSH_9.1" "p1", OpenSSL_version(0)); fprintf(stderr, "usage: sshd [-46DdeiqTt] [-C connection_spec] [-c host_cert_file]\n" " [-E log_file] [-f config_file] [-g login_grace_time]\n" " [-h host_key_file] [-o option] [-p port] [-u len]\n"); exit(1); }
void usage(void) { undefined8 uVar1; uVar1 = OpenSSL_version(0); fprintf(stderr, "%s, %s\n", "OpenSSH_9.1p1", uVar1); fprintf(stderr, "usage: sshd [-46DdeiqTt] [-C connection_spec] [-c host_cert_file]\n " " [-E log_file] [-f config_file] [-g login_grace_time]\n " " [-h host_key_file] [-o option] [-p port] [-u len]\n"); exit(1); }
openssh-portable
ghidra
char *stputs(const char *s, char *p) { return stnputs(s, strlen(s), p); }
void stputs(char *param_1, undefined8 param_2) { size_t sVar1; sVar1 = strlen(param_1); stnputs(param_1, sVar1, param_2); return; }
dash-0.5.11+git20210903+057cd650a4ed
ghidra
ext2_ino_t e2fsck_get_lost_and_found(e2fsck_t ctx, int fix) { ext2_filsys fs = ctx->fs; ext2_ino_t ino; blk64_t blk; errcode_t retval; struct ext2_inode_large inode; char *block; static const char name[] = "lost+found"; struct problem_context pctx; int will_rehash, flags; if (ctx->lost_and_found) return ctx->lost_and_found; clear_problem_context(&pctx); will_rehash = e2fsck_dir_will_be_rehashed(ctx, 2); if (will_rehash) { flags = ctx->fs->flags; ctx->fs->flags |= 0x200000; } retval = ext2fs_lookup(fs, 2, name, sizeof(name) - 1, 0, &ino); if (will_rehash) ctx->fs->flags = (flags & 0x200000) | (ctx->fs->flags & ~0x200000); if (retval && !fix) return 0; if (!retval) { retval = ext2fs_read_inode_full(fs, ino, EXT2_INODE(&inode), sizeof(inode)); if (fix && retval) return 0; if (fix && (inode.i_flags & 0x10000000)) { if (!fix_problem(ctx, 0x030018, &pctx)) return 0; goto unlink; } if (fix && (inode.i_flags & 0x00000800)) { if (!fix_problem(ctx, 0x03001B, &pctx)) return 0; goto unlink; } if (ext2fs_check_directory(fs, ino) == 0) { ctx->lost_and_found = ino; return ino; } if (!fix) return 0; pctx.ino = ino; if (!fix_problem(ctx, 0x030017, &pctx)) return 0; unlink: pctx.errcode = ext2fs_unlink(fs, 2, name, ino, 0); if (pctx.errcode) { pctx.str = "ext2fs_unlink"; fix_problem(ctx, 0x030013, &pctx); return 0; } (void)e2fsck_dir_info_set_parent(ctx, ino, 0); e2fsck_adjust_inode_count(ctx, ino, -1); if ((((inode.i_mode) & 00170000) == 0040000)) ctx->flags |= 0x0004; } else if (retval != (2133571404L)) { pctx.errcode = retval; fix_problem(ctx, 0x030009, &pctx); } if (!fix_problem(ctx, 0x030004, 0)) return 0; e2fsck_read_bitmaps(ctx); if (ctx->lnf_repair_block) { blk = ctx->lnf_repair_block; ctx->lnf_repair_block = 0; goto skip_new_block; } retval = ext2fs_new_block2(fs, 0, ctx->block_found_map, &blk); if (retval == (2133571400L) && fix_problem(ctx, 0x030019, &pctx)) { fix_problem(ctx, 0x03001A, &pctx); ctx->lost_and_found = 2; return 0; } if (retval) { pctx.errcode = retval; fix_problem(ctx, 0x03000A, &pctx); return 0; } ext2fs_mark_block_bitmap2(ctx->block_found_map, blk); skip_new_block: ext2fs_block_alloc_stats2(fs, blk, +1); retval = ext2fs_new_inode(fs, 2, 040700, ctx->inode_used_map, &ino); if (retval == (2133571401L) && fix_problem(ctx, 0x030019, &pctx)) { fix_problem(ctx, 0x03001A, &pctx); ctx->lost_and_found = 2; return 0; } if (retval) { pctx.errcode = retval; fix_problem(ctx, 0x03000B, &pctx); return 0; } ext2fs_mark_inode_bitmap2(ctx->inode_used_map, ino); ext2fs_mark_inode_bitmap2(ctx->inode_dir_map, ino); ext2fs_inode_alloc_stats2(fs, ino, +1, 1); memset(&inode, 0, sizeof(inode)); inode.i_mode = 040700; inode.i_size = fs->blocksize; inode.i_atime = inode.i_ctime = inode.i_mtime = ctx->now; inode.i_links_count = 2; ext2fs_iblk_set(fs, EXT2_INODE(&inode), 1); inode.i_block[0] = blk; pctx.errcode = ext2fs_write_new_inode(fs, ino, EXT2_INODE(&inode)); if (pctx.errcode) { pctx.str = "ext2fs_write_inode"; fix_problem(ctx, 0x030013, &pctx); return 0; } retval = ext2fs_new_dir_block(fs, ino, 2, &block); if (retval) { pctx.errcode = retval; fix_problem(ctx, 0x03000C, &pctx); return 0; } retval = ext2fs_write_dir_block4(fs, blk, block, 0, ino); ext2fs_free_mem(&block); if (retval) { pctx.errcode = retval; fix_problem(ctx, 0x03000D, &pctx); return 0; } pctx.errcode = ext2fs_link(fs, 2, name, ino, 2); if (pctx.errcode == (2133571366L)) { pctx.errcode = ext2fs_expand_dir(fs, 2); if (pctx.errcode) goto link_error; pctx.errcode = ext2fs_link(fs, 2, name, ino, 2); } if (pctx.errcode) { link_error: pctx.str = "ext2fs_link"; fix_problem(ctx, 0x030013, &pctx); return 0; } e2fsck_add_dir_info(ctx, ino, 2); e2fsck_adjust_inode_count(ctx, 2, 1); ext2fs_icount_store(ctx->inode_count, ino, 2); ext2fs_icount_store(ctx->inode_link_info, ino, 2); ctx->lost_and_found = ino; quota_data_add(ctx->qctx, &inode, ino, ((1 << 10) << (fs->super)->s_log_cluster_size)); quota_data_inodes(ctx->qctx, &inode, ino, +1); return ino; }
int e2fsck_get_lost_and_found(struct_0 *a0, unsigned long a1) { unsigned int v0; char v1; unsigned int v2; unsigned int v3; unsigned long long v4; char v5; struct_2 *v6; unsigned long v7; unsigned long v8; unsigned int v9; unsigned long long v10; char v11; unsigned int v12; unsigned int v13; unsigned int v14; unsigned int v15; unsigned short v16; char v17; unsigned int v18; unsigned int v20; v0 = a1; v6 = &a0->field_0->padding_0; if (a0->field_228) { v20 = a0->field_228; } else { clear_problem_context(&v8); v3 = e2fsck_dir_will_be_rehashed(a0, 0x2); if (v3) { v2 = a0->field_0->field_10; a0->field_0->field_10 = a0->field_0->field_10 | 0x200000; } v7 = ext2fs_lookup(v6, 0x2, "lost+found", 0xa, 0x0, &v1); if (v3) a0->field_0->field_10 = a0->field_0->field_10 & -2097153 | v2 & 0x200000; if (v7 && !v0) v20 = 0; if (!v7 || v0) { if (!v7) { v7 = ext2fs_read_inode_full(v6, *(&v1), EXT2_INODE(&v11), 0xa0); if (v0) { if (v7) { v20 = 0; } else { if ((*(&v17) & 0x10000000)) { v20 = fix_problem(a0, 0x30018, &v8); if (!v20) v20 = 0; } else { if ((*(&v17) & 0x800)) { v20 = fix_problem(a0, 0x3001b, &v8); if (!v20) v20 = 0; } else if (v20) { v9 = *(&v1); v20 = fix_problem(a0, 0x30017, &v8); if (!v20) v20 = 0; } } } } if ((!v7 || !v0) && (!(*(&v17) & 0x10000000) || !v0) && (!(*(&v17) & 0x800) || !v0)) { v20 = ext2fs_check_directory(v6, *(&v1), *(&v1)); if (!v20) { a0->field_228 = *(&v1); v20 = *(&v1); } } if (!v0 && v20) v20 = 0; } else if (v7 != 2133571404) { v8 = v7; fix_problem(a0, 0x30009, &v8); } if (!v7 && !v7 && (*(&v17) & 0x10000000) && v20 && v0 || !(*(&v17) & 0x10000000) && !v7 && !v7 && v20 && (*(&v17) & 0x800) && v0 || !(*(&v17) & 0x10000000) && !v7 && !(*(&v17) & 0x800) && !v7 && v20 && v0 && v20) { v8 = ext2fs_unlink(v6, 0x2, "lost+found", *(&v1), 0x0); if (v8) { v10 = "ext2fs_unlink"; fix_problem(a0, 0x30013, &v8); v20 = 0; } else { e2fsck_dir_info_set_parent(a0, *(&v1), 0x0, *(&v1)); e2fsck_adjust_inode_count(a0, *(&v1), 0xffffffff); if ((*(&v11) & 0xf000) == 0x4000) a0->field_48 = a0->field_48 | 4; } } if ((!v7 && !v7 && (*(&v17) & 0x10000000) && v20 && v0 || !(*(&v17) & 0x10000000) && !v7 && !v7 && v20 && (*(&v17) & 0x800) && v0 || !(*(&v17) & 0x10000000) && !v7 && !(*(&v17) & 0x800) && !v7 && v20 && v0 && v20) && !v8 || v7) { v20 = fix_problem(a0, 0x30004, 0x0); if (!v20) { v20 = 0; } else { e2fsck_read_bitmaps(a0); if (a0->field_380) { v4 = a0->field_380; a0->field_380 = 0; } else { v7 = ext2fs_new_block2(v6, 0x0, a0->field_1a0, &v4); if (v7 == 2133571400) { v20 = fix_problem(a0, 0x30019, &v8); if (v20) { fix_problem(a0, 0x3001a, &v8); a0->field_228 = 2; v20 = 0; } } if (!v20 || v7 != 2133571400) { if (v7) { v8 = v7; fix_problem(a0, 0x3000a, &v8); v20 = 0; } else { ext2fs_mark_block_bitmap2(a0->field_1a0, v4, v4); } } } if (a0->field_380 || !v7 && !v20 || !v7) { ext2fs_block_alloc_stats2(v6, v4, 0x1, v4); v7 = ext2fs_new_inode(v6, 0x2, 0x41c0, a0->field_168, &v1); if (v7 == 2133571401) { v20 = fix_problem(a0, 0x30019, &v8); if (v20) { fix_problem(a0, 0x3001a, &v8); a0->field_228 = 2; v20 = 0; } } if (!v20 || v7 != 2133571401) { if (v7) { v8 = v7; fix_problem(a0, 0x3000b, &v8); v20 = 0; } else { ext2fs_mark_inode_bitmap2(a0->field_168, *(&v1)); ext2fs_mark_inode_bitmap2(a0->field_178, *(&v1)); ext2fs_inode_alloc_stats2(v6, *(&v1), 0x1, 0x1); memset(&v11, 0x0, 0xa0); v11 = 16832; v12 = v6->field_28; v15 = a0->field_348; v14 = v15; v13 = v14; v16 = 2; v20 = EXT2_INODE(&v11); ext2fs_iblk_set(v6, v20, 0x1, v20); v18 = v4; v8 = ext2fs_write_new_inode(v6, *(&v1), EXT2_INODE(&v11)); if (v8) { v10 = "ext2fs_write_inode"; fix_problem(a0, 0x30013, &v8); v20 = 0; } else { v7 = ext2fs_new_dir_block(v6, *(&v1), 0x2, &v5); if (v7) { v8 = v7; fix_problem(a0, 0x3000c, &v8); v20 = 0; } else { v7 = ext2fs_write_dir_block4(v6, v4, *(&v5), 0x0, *(&v1)); ext2fs_free_mem(&v5); if (v7) { v8 = v7; fix_problem(a0, 0x3000d, &v8); v20 = 0; } else { v8 = ext2fs_link(v6, 0x2, "lost+found", *(&v1), 0x2); if (v8 == 2133571366) { v8 = ext2fs_expand_dir(v6, 0x2); if (!v8) v8 = ext2fs_link(v6, 0x2, "lost+found", *(&v1), 0x2); } if ((!v8 || v8 != 2133571366) && !v8) { e2fsck_add_dir_info(a0, *(&v1), 0x2); e2fsck_adjust_inode_count(a0, 0x2, 0x1); ext2fs_icount_store(a0->field_1b8, *(&v1), 0x2); ext2fs_icount_store(a0->field_1c0, *(&v1), 0x2); a0->field_228 = *(&v1); quota_data_add(a0->field_278, &v11, *(&v1), 0x400 << (v6->field_20->field_1c & 31)); quota_data_inodes(a0->field_278, &v11, *(&v1), 0x1); v20 = *(&v1); } if (v8 || v8 == 2133571366 && v8) { v10 = "ext2fs_link"; fix_problem(a0, 0x30013, &v8); v20 = 0; } } } } } } } } } } } return v20; }
e2fsprogs-1.46.5
angr_dream
static int inflate_fixed(void) { int i; struct huft *tl; struct huft *td; int bl; int bd; unsigned l[288]; for (i = 0; i < 144; i++) l[i] = 8; for (; i < 256; i++) l[i] = 9; for (; i < 280; i++) l[i] = 7; for (; i < 288; i++) l[i] = 8; bl = 7; if ((i = huft_build(l, 288, 257, cplens, cplext, &tl, &bl)) != 0) return i; for (i = 0; i < 30; i++) l[i] = 5; bd = 5; if ((i = huft_build(l, 30, 0, cpdist, cpdext, &td, &bd)) > 1) { huft_free(tl); return i; } if (inflate_codes(tl, td, bl, bd)) return 1; huft_free(tl); huft_free(td); return 0; }
long inflate_fixed() { unsigned int v1; unsigned int v2; int i; long v4; long v5; int v6[290]; unsigned long v7; v7 = __readfsqword(0x28u); for (i = 0; i <= 143; ++i) v6[i] = 8; while (i <= 255) v6[i++] = 9; while (i <= 279) v6[i++] = 7; while (i <= 287) v6[i++] = 8; v1 = 7; i = huft_build((unsigned int *)v6, 0x120u, 0x101u, (long)&cplens, (long)&cplext, &v4, &v1); if (i) return (unsigned int)i; for (i = 0; i <= 29; ++i) v6[i] = 5; v2 = 5; i = huft_build((unsigned int *)v6, 0x1Eu, 0, (long)&cpdist, (long)&cpdext, &v5, &v2); if (i <= 1) { if ((unsigned int)inflate_codes(v4, v5, v1, v2)) { return 1LL; } else { huft_free(v4); huft_free(v5); return 0LL; } } else { huft_free(v4); return (unsigned int)i; } }
gzip-1.12
ida
int sh_contains_shell_metas(string) const char *string; { const char *s; for (s = string; s && *s; s++) { switch (*s) { case ' ': case '\t': case '\n': case '\'': case '"': case '\\': case '|': case '&': case ';': case '(': case ')': case '<': case '>': case '!': case '{': case '}': case '*': case '[': case '?': case ']': case '^': case '$': case '`': return (1); case '~': if (s == string || s[-1] == '=' || s[-1] == ':') return (1); break; case '#': if (s == string) return (1); default: break; } } return (0); }
long long sh_contains_shell_metas(unsigned long a0) { char *v0; unsigned long long v2; v0 = a0; while (true) { if (v0 && *(v0)) { switch (*(v0)) { case 9: case 10: case 32: case 33: case 34: case 36: case 38: case 39: case 40: case 41: case 42: case 59: case 60: case 62: case 63: case 91: case 92: case 93: case 94: case 96: case 123: case 124: case 125: v2 = 1; break; case 35: if (v0 == a0) { v2 = 1; break; } case 126: if (v0 == a0 || v0[1] == 61) { v2 = 1; break; } } v0 += 1; continue; } if (!v0 || !*(v0)) { v2 = 0; break; } } return v2; }
bash
angr_dream
static void check_order(struct linebuffer const *prev, struct linebuffer const *current, int whatfile) { if (check_input_order != CHECK_ORDER_DISABLED && ((check_input_order == CHECK_ORDER_ENABLED) || seen_unpairable)) { if (!issued_disorder_warning[whatfile - 1]) { int order; if (hard_LC_COLLATE) order = xmemcoll(prev->buffer, prev->length - 1, current->buffer, current->length - 1); else order = memcmp2(prev->buffer, prev->length - 1, current->buffer, current->length - 1); if (0 < order) { error((check_input_order == CHECK_ORDER_ENABLED ? 1 : 0), 0, gettext("file %d is not in sorted order"), whatfile); issued_disorder_warning[whatfile - 1] = 1; } } } }
void check_order(long param_1, long param_2, int param_3) { undefined8 uVar1; int local_c; if ((check_input_order != 2) && (((check_input_order == 1 || (seen_unpairable != '\0')) && (*(char *)((long)&issued_disorder_warning + (long)(param_3 + -1)) != '\x01')))) { if (hard_LC_COLLATE == '\0') { local_c = memcmp2(*(undefined8 *)(param_1 + 0x10), *(long *)(param_1 + 8) + -1, *(undefined8 *)(param_2 + 0x10), *(long *)(param_2 + 8) + -1); } else { local_c = xmemcoll( *(undefined8 *)(param_1 + 0x10), *(long *)(param_1 + 8) + -1, *(undefined8 *)(param_2 + 0x10), *(long *)(param_2 + 8) + -1); } if (0 < local_c) { uVar1 = gettext("file %d is not in sorted order"); error(check_input_order == 1, 0, uVar1, param_3); *(undefined *)((long)&issued_disorder_warning + (long)(param_3 + -1)) = 1; } } return; }
coreutils
ghidra
void unsetfunc(const char *name) { struct tblentry *cmdp; if ((cmdp = cmdlookup(name, 0)) != ((void *)0) && cmdp->cmdtype == 1) delete_cmd_entry(); }
long long unsetfunc(char *a0) { struct_0 *v0; unsigned long long v2; v2 = cmdlookup(a0, 0x0); v0 = v2; if (!v0) return v2; v2 = v0->field_10; if (v0->field_10 == 1) { v2 = delete_cmd_entry(); return v2; } return v2; }
dash-0.5.11+git20210903+057cd650a4ed
angr_sailr
void run_unwind_protects() { if (unwind_protect_list) without_interrupts(run_unwind_protects_internal, (char *)((void *)0), (char *)((void *)0)); }
long run_unwind_protects() { long result; result = unwind_protect_list; if (unwind_protect_list) return without_interrupts( (long (*)(long, long))run_unwind_protects_internal, 0LL, 0LL); return result; }
bash
ida
static char *readnum(char *s, lin *pnum) { unsigned char c = *s; lin num = 0; if (!((unsigned int)(c) - '0' <= 9)) return 0; do { num = c - '0' + num * 10; c = *++s; } while (((unsigned int)(c) - '0' <= 9)); *pnum = num; return s; }
int readnum(unsigned long a0, unsigned long long *a1) { char *v0; char v1; void *v2; unsigned int v4; v0 = a0; v1 = *(v0); v2 = 0; if (v1 - 48 > 9) { v4 = 0; return v4; } do { v2 = v2 * 10 + v1 - 48; v0 += 1; v1 = *(v0); } while (v1 - 48 <= 9); *(a1) = v2; v4 = v0; return v4; }
diffutils
angr_sailr
static enum found_status deppossi_ok_found(struct pkginfo *possdependee, struct pkginfo *requiredby, struct pkginfo *removing, struct deppossi *provider, struct pkginfo **fixbytrig, _Bool *matched, struct deppossi *checkversion, int *interestingwarnings, struct varbuf *oemsgs) { enum found_status thisf; if (ignore_depends(possdependee)) { debug(dbg_depcondetail, " ignoring depended package so ok and found"); return FOUND_OK; } thisf = FOUND_NONE; if (possdependee == removing) { if (provider) { varbuf_printf( oemsgs, gettext(" Package %s which provides %s is to be removed.\n"), pkg_name(possdependee, pnaw_nonambig), provider->ed->name); } else { varbuf_printf(oemsgs, gettext(" Package %s is to be removed.\n"), pkg_name(possdependee, pnaw_nonambig)); } *matched = 1; debug(dbg_depcondetail, " removing possdependee, returning %d", thisf); return thisf; } switch (possdependee->status) { case PKG_STAT_UNPACKED: case PKG_STAT_HALFCONFIGURED: case PKG_STAT_TRIGGERSAWAITED: case PKG_STAT_TRIGGERSPENDING: case PKG_STAT_INSTALLED: if (checkversion) { if (provider) { debug(dbg_depcondetail, " checking package %s provided by pkg %s", checkversion->ed->name, pkg_name(possdependee, pnaw_always)); if (!pkg_virtual_deppossi_satisfied(checkversion, provider)) { varbuf_printf( oemsgs, gettext(" Version of %s on system, provided by %s, is %s.\n"), checkversion->ed->name, pkg_name(possdependee, pnaw_always), versiondescribe(&provider->version, vdew_nonambig)); if (in_force(FORCE_DEPENDS_VERSION)) thisf = found_forced_on(DEPEND_TRY_FORCE_DEPENDS_VERSION); debug(dbg_depcondetail, " bad version"); goto unsuitable; } } else { debug(dbg_depcondetail, " checking non-provided pkg %s", pkg_name(possdependee, pnaw_always)); if (!versionsatisfied(&possdependee->installed, checkversion)) { varbuf_printf( oemsgs, gettext(" Version of %s on system is %s.\n"), pkg_name(possdependee, pnaw_nonambig), versiondescribe(&possdependee->installed.version, vdew_nonambig)); if (in_force(FORCE_DEPENDS_VERSION)) thisf = found_forced_on(DEPEND_TRY_FORCE_DEPENDS_VERSION); debug(dbg_depcondetail, " bad version"); goto unsuitable; } } } if (possdependee->status == PKG_STAT_INSTALLED || possdependee->status == PKG_STAT_TRIGGERSPENDING) { debug(dbg_depcondetail, " is installed, ok and found"); return FOUND_OK; } if (possdependee->status == PKG_STAT_TRIGGERSAWAITED) { if (possdependee->trigaw.head == ((void *)0)) do_internerr("packages.c", 448, __func__, "package %s in state %s, has no awaited triggers", pkg_name(possdependee, pnaw_always), pkg_status_name(possdependee)) ; if (removing || !(f_triggers || (possdependee->clientdata && possdependee->clientdata->istobe == PKG_ISTOBE_INSTALLNEW))) { if (provider) { varbuf_printf(oemsgs, gettext(" Package %s which provides %s awaits trigger " "processing.\n"), pkg_name(possdependee, pnaw_nonambig), provider->ed->name); } else { varbuf_printf(oemsgs, gettext(" Package %s awaits trigger processing.\n"), pkg_name(possdependee, pnaw_nonambig)); } debug(dbg_depcondetail, " triggers-awaited, no fixbytrig"); goto unsuitable; } *fixbytrig = possdependee->trigaw.head->pend; debug(dbg_depcondetail, " triggers-awaited, fixbytrig '%s', defer", pkg_name(*fixbytrig, pnaw_always)); return FOUND_DEFER; } if (possdependee->clientdata && possdependee->clientdata->istobe == PKG_ISTOBE_INSTALLNEW) { debug(dbg_depcondetail, " unpacked/halfconfigured, defer"); return FOUND_DEFER; } else if (!removing && in_force(FORCE_CONFIGURE_ANY) && !skip_due_to_hold(possdependee) && !(possdependee->status == PKG_STAT_HALFCONFIGURED)) { notice(gettext("also configuring '%s' (required by '%s')"), pkg_name(possdependee, pnaw_nonambig), pkg_name(requiredby, pnaw_nonambig)); enqueue_package(possdependee); sincenothing = 0; return FOUND_DEFER; } else { if (provider) { varbuf_printf( oemsgs, gettext(" Package %s which provides %s is not configured yet.\n"), pkg_name(possdependee, pnaw_nonambig), provider->ed->name); } else { varbuf_printf(oemsgs, gettext(" Package %s is not configured yet.\n"), pkg_name(possdependee, pnaw_nonambig)); } debug(dbg_depcondetail, " not configured/able"); goto unsuitable; } default: if (provider) { varbuf_printf( oemsgs, gettext(" Package %s which provides %s is not installed.\n"), pkg_name(possdependee, pnaw_nonambig), provider->ed->name); } else { varbuf_printf(oemsgs, gettext(" Package %s is not installed.\n"), pkg_name(possdependee, pnaw_nonambig)); } debug(dbg_depcondetail, " not installed"); goto unsuitable; } unsuitable: debug(dbg_depcondetail, " returning %d", thisf); (*interestingwarnings)++; return thisf; }
int deppossi_ok_found(struct_2 *a0, unsigned long long a1, unsigned long long a2, struct_0 *a3, unsigned long long a4, char *a5, struct_0 *v1, unsigned int *a6, unsigned long long a7) { unsigned int v0; unsigned int v2; if (ignore_depends(a0)) { debug(0x100, " ignoring depended package so ok and found", a2, a3, a4, a5); v2 = 3; } else { v0 = 0; if (a0 == a2) { if (!a3) { v2 = gettext(" Package %s is to be removed.\n"); varbuf_printf(a7, v2, pkg_name(a0, 0x1), v2); } else { varbuf_printf( a7, gettext(" Package %s which provides %s is to be removed.\n"), pkg_name(a0, 0x1), a3->field_8->field_8); } *(a5) = 1; debug(0x100, " removing possdependee, returning %d", v0, a3, a4, a5); v2 = v0; } else if (a0->field_18 - 3 <= 4) { if (v1) { if (a3) { debug(0x100, " checking package %s provided by pkg %s", v1->field_8->field_8, pkg_name(a0, 0x3), a4, a5); v2 = pkg_virtual_deppossi_satisfied(v1, a3) ^ 1; if (v2) { versiondescribe(a3 + 3, 0x1); varbuf_printf( a7, gettext(" Version of %s on system, provided by %s, is %s.\n"), v1->field_8->field_8, pkg_name(a0, 0x3)); if (in_force(0x2000)) v0 = found_forced_on(0x5); debug(0x100, " bad version", a2, a3, a4, a5); goto LABEL_401177; } } else { debug(0x100, " checking non-provided pkg %s", pkg_name(a0, 0x3), a3, a4, a5); v2 = versionsatisfied(&a0->padding_1c[44], v1) ^ 1; if (v2) { varbuf_printf(a7, gettext(" Version of %s on system is %s.\n"), pkg_name(a0, 0x1), versiondescribe(&a0->padding_1c[124], 0x1)); if (in_force(0x2000)) v0 = found_forced_on(0x5); debug(0x100, " bad version", a2, a3, a4, a5); goto LABEL_401177; } } } if (a0->field_18 != 7 && a0->field_18 != 6) { if (a0->field_18 != 5) { if (a0->field_138 && a0->field_138->field_0 == 2) { debug(0x100, " unpacked/halfconfigured, defer", a2, a3, a4, a5); v2 = 1; goto LABEL_4011a4; } if (!a2 && in_force(0x400)) { v2 = skip_due_to_hold(a0) ^ 1; if (v2 && a0->field_18 != 4) { notice(gettext("also configuring '%s' (required by '%s')"), pkg_name(a0, 0x1), pkg_name(a1, 0x1)); enqueue_package(a0); sincenothing = 0; v2 = 1; goto LABEL_4011a4; } } if (!a3) { v2 = gettext(" Package %s is not configured yet.\n"); varbuf_printf(a7, v2, pkg_name(a0, 0x1), v2); } else { varbuf_printf( a7, gettext( " Package %s which provides %s is not configured yet.\n"), pkg_name(a0, 0x1), a3->field_8->field_8); } debug(0x100, " not configured/able", a2, a3, a4, a5); goto LABEL_401177; } else { if (!a0->field_148) { pkg_status_name(a0); do_internerr("packages.c", 0x1c0, "deppossi_ok_found", "package %s in state %s, has no awaited triggers", pkg_name(a0, 0x3)); } if (!a2) { if (f_triggers) { LABEL_400f01: *(a4) = a0->field_148->field_8; debug(0x100, " triggers-awaited, fixbytrig '%s', defer", pkg_name(*(a4), 0x3), a3, a4, a5); v2 = 1; goto LABEL_4011a4; } else if (a0->field_138) { if (!(a0->field_138->field_0 == 2)) goto LABEL_400e5d; goto LABEL_400f01; } } LABEL_400e5d: if (!a3) { v2 = gettext(" Package %s awaits trigger processing.\n"); varbuf_printf(a7, v2, pkg_name(a0, 0x1), v2); } else { varbuf_printf(a7, gettext(" Package %s which provides %s awaits " "trigger processing.\n"), pkg_name(a0, 0x1), a3->field_8->field_8); } debug(0x100, " triggers-awaited, no fixbytrig", a2, a3, a4, a5); goto LABEL_401177; } } debug(0x100, " is installed, ok and found", a2, a3, a4, a5); v2 = 3; } else { if (!a3) { v2 = gettext(" Package %s is not installed.\n"); varbuf_printf(a7, v2, pkg_name(a0, 0x1), v2); } else { varbuf_printf( a7, gettext(" Package %s which provides %s is not installed.\n"), pkg_name(a0, 0x1), a3->field_8->field_8); } debug(0x100, " not installed", a2, a3, a4, a5); LABEL_401177: debug(0x100, " returning %d", v0, a3, a4, a5); *(a6) = *(a6) + 1; v2 = v0; } } LABEL_4011a4: return v2; }
dpkg
angr_phoenix
ssh_packet_not_very_much_data_to_write(ssh)) channel_output_poll(ssh); if (options.rekey_interval > 0 && !ssh_packet_is_rekeying(ssh)) { rekey_timeout_ms = ssh_packet_get_rekey_timeout(ssh) * 1000; } else {
void ssh_packet_not_very_much_data_to_write(void) { halt_baddata(); }
openssh-portable
ghidra
int starttls_proto_to_port(const char *app_proto) { struct servent *s; if (strcasecmp(app_proto, "xmpp") == 0) app_proto = "xmpp-server"; ; s = getservbyname(app_proto, ((void *)0)); if (s != ((void *)0)) { return ntohs(s->s_port); } endservent(); return 443; }
uint16_t starttls_proto_to_port(char *param_1) { uint16_t uVar1; int iVar2; servent *psVar3; char *local_20; iVar2 = strcasecmp(param_1, "xmpp"); local_20 = param_1; if (iVar2 == 0) { local_20 = "xmpp-server"; } psVar3 = getservbyname(local_20, (char *)0x0); if (psVar3 == (servent *)0x0) { endservent(); uVar1 = 0x1bb; } else { uVar1 = ntohs((uint16_t)psVar3->s_port); } return uVar1; }
gnutls
ghidra
static _Bool depmod_is_path_starts_with(const char *path, size_t pathlen, const char *prefix, size_t prefix_len) { if (pathlen <= prefix_len) return 0; if (path[prefix_len] != '/') return 0; if (memcmp(path, prefix, prefix_len) != 0) return 0; return 1; }
undefined8 depmod_is_path_starts_with(void *param_1, ulong param_2, void *param_3, ulong param_4) { int iVar1; undefined8 uVar2; if (param_4 < param_2) { if (*(char *)(param_4 + (long)param_1) == '/') { iVar1 = memcmp(param_1, param_3, param_4); if (iVar1 == 0) { uVar2 = 1; } else { uVar2 = 0; } } else { uVar2 = 0; } } else { uVar2 = 0; } return uVar2; }
kmod
ghidra
static void chacha_keysetup(chacha_ctx *x, const u8 *k, u32 kbits) { const char *constants; x->input[4] = (((u32)((k + 0)[0])) | ((u32)((k + 0)[1]) << 8) | ((u32)((k + 0)[2]) << 16) | ((u32)((k + 0)[3]) << 24)); x->input[5] = (((u32)((k + 4)[0])) | ((u32)((k + 4)[1]) << 8) | ((u32)((k + 4)[2]) << 16) | ((u32)((k + 4)[3]) << 24)); x->input[6] = (((u32)((k + 8)[0])) | ((u32)((k + 8)[1]) << 8) | ((u32)((k + 8)[2]) << 16) | ((u32)((k + 8)[3]) << 24)); x->input[7] = (((u32)((k + 12)[0])) | ((u32)((k + 12)[1]) << 8) | ((u32)((k + 12)[2]) << 16) | ((u32)((k + 12)[3]) << 24)); if (kbits == 256) { k += 16; constants = sigma; } else { constants = tau; } x->input[8] = (((u32)((k + 0)[0])) | ((u32)((k + 0)[1]) << 8) | ((u32)((k + 0)[2]) << 16) | ((u32)((k + 0)[3]) << 24)); x->input[9] = (((u32)((k + 4)[0])) | ((u32)((k + 4)[1]) << 8) | ((u32)((k + 4)[2]) << 16) | ((u32)((k + 4)[3]) << 24)); x->input[10] = (((u32)((k + 8)[0])) | ((u32)((k + 8)[1]) << 8) | ((u32)((k + 8)[2]) << 16) | ((u32)((k + 8)[3]) << 24)); x->input[11] = (((u32)((k + 12)[0])) | ((u32)((k + 12)[1]) << 8) | ((u32)((k + 12)[2]) << 16) | ((u32)((k + 12)[3]) << 24)); x->input[0] = (((u32)((constants + 0)[0])) | ((u32)((constants + 0)[1]) << 8) | ((u32)((constants + 0)[2]) << 16) | ((u32)((constants + 0)[3]) << 24)); x->input[1] = (((u32)((constants + 4)[0])) | ((u32)((constants + 4)[1]) << 8) | ((u32)((constants + 4)[2]) << 16) | ((u32)((constants + 4)[3]) << 24)); x->input[2] = (((u32)((constants + 8)[0])) | ((u32)((constants + 8)[1]) << 8) | ((u32)((constants + 8)[2]) << 16) | ((u32)((constants + 8)[3]) << 24)); x->input[3] = (((u32)((constants + 12)[0])) | ((u32)((constants + 12)[1]) << 8) | ((u32)((constants + 12)[2]) << 16) | ((u32)((constants + 12)[3]) << 24)); }
void chacha_keysetup(unsigned int a0[12], unsigned long a1, unsigned long a2) { char v0[16]; unsigned long long v1; unsigned int v3[12]; *(&v0[0]) = a1; a0[4] = (v0[1] * 0x100) | v0[0] | (v0[2] * 0x10000) | (v0[3] * 0x1000000); a0[5] = (v0[5] * 0x100) | v0[4] | (v0[6] * 0x10000) | (v0[7] * 0x1000000); a0[6] = (v0[9] * 0x100) | v0[8] | (v0[10] * 0x10000) | (v0[11] * 0x1000000); a0[7] = (v0[13] * 0x100) | v0[12] | (v0[14] * 0x10000) | (v0[15] * 0x1000000); if (a2 == 0x100) { *(&v0[0]) = v0 + 1; v1 = "expand 32-byte k"; } else { v1 = "ex"; } a0[8] = (v0[1] * 0x100) | v0[0] | (v0[2] * 0x10000) | (v0[3] * 0x1000000); a0[9] = (v0[5] * 0x100) | v0[4] | (v0[6] * 0x10000) | (v0[7] * 0x1000000); a0[10] = (v0[9] * 0x100) | v0[8] | (v0[10] * 0x10000) | (v0[11] * 0x1000000); a0[11] = (v0[13] * 0x100) | v0[12] | (v0[14] * 0x10000) | (v0[15] * 0x1000000); a0[0] = (*((v1 + 1)) * 0x100) | *(v1) | (*((v1 + 2)) * 0x10000) | (*((v1 + 3)) * 0x1000000); a0[1] = (*((v1 + 5)) * 0x100) | *((v1 + 4)) | (*((v1 + 6)) * 0x10000) | (*((v1 + 7)) * 0x1000000); a0[2] = (*((v1 + 9)) * 0x100) | *((v1 + 8)) | (*((v1 + 10)) * 0x10000) | (*((v1 + 11)) * 0x1000000); v3 = a0; a0[3] = (*((v1 + 13)) * 0x100) | *((v1 + 12)) | (*((v1 + 14)) * 0x10000) | (*((v1 + 15)) * 0x1000000); return; }
libbsd-0.11.7
angr_dream
int netopen(path) char *path; { char *np, *s, *t; int fd; np = (char *)sh_xmalloc((strlen(path) + 1), "netopen.c", 299); strcpy(np, path); s = np + 9; t = strchr(s, '/'); if (t == 0) { internal_error(gettext("%s: bad network path specification"), path); sh_xfree((np), "netopen.c", 307); return -1; } *t++ = '\0'; fd = _netopen(s, t, path[5]); sh_xfree((np), "netopen.c", 312); return fd; }
long long netopen(struct_0 *a0) { int tmp_15; unsigned int v0; char *v1; char *v2; char *v3; unsigned long long v5; unsigned long long v6; v1 = sh_xmalloc(strlen(a0) + 1, "netopen.c", 0x12b); strcpy(v1, a0); v2 = v1 + 9; v3 = strchr(v2, 0x2f); if (v3) { tmp_15 = v3; v3 += 1; *(tmp_15) = 0; v0 = _netopen(v2, v3, a0->field_5); sh_xfree(v1, "netopen.c", 0x138); v6 = v0; } else { v5 = gettext("%s: bad network path specification"); internal_error(v5, a0, v5); sh_xfree(v1, "netopen.c", 0x133); v6 = 4294967295; } return v6; }
bash
angr_phoenix
static void process_add_identity(SocketEntry *e) { Identity *id; int success = 0, confirm = 0; char *fp, *comment = ((void *)0), *sk_provider = ((void *)0); char canonical_provider[4096]; time_t death = 0; u_int seconds = 0; struct dest_constraint *dest_constraints = ((void *)0); size_t ndest_constraints = 0; struct sshkey *k = ((void *)0); int r = -1; sshlog("ssh-agent.c", __func__, 1210, 1, SYSLOG_LEVEL_DEBUG2, ((void *)0), "entering"); if ((r = sshkey_private_deserialize(e->request, &k)) != 0 || k == ((void *)0) || (r = sshbuf_get_cstring(e->request, &comment, ((void *)0))) != 0) { sshlog("ssh-agent.c", __func__, 1214, 1, SYSLOG_LEVEL_ERROR, ssh_err(r), "parse"); goto out; } if (parse_key_constraints(e->request, k, &death, &seconds, &confirm, &sk_provider, &dest_constraints, &ndest_constraints) != 0) { sshlog("ssh-agent.c", __func__, 1219, 1, SYSLOG_LEVEL_ERROR, ((void *)0), "failed to parse constraints"); sshbuf_reset(e->request); goto out; } if (sk_provider != ((void *)0)) { if (!sshkey_is_sk(k)) { sshlog("ssh-agent.c", __func__, 1226, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "Cannot add provider: %s is not an " "authenticator-hosted key", sshkey_type(k)); goto out; } if (strcasecmp(sk_provider, "internal") == 0) { sshlog("ssh-agent.c", __func__, 1231, 1, SYSLOG_LEVEL_DEBUG1, ((void *)0), "internal provider"); } else { if (realpath(sk_provider, canonical_provider) == ((void *)0)) { sshlog("ssh-agent.c", __func__, 1234, 0, SYSLOG_LEVEL_VERBOSE, ((void *)0), "failed provider \"%.100s\": " "realpath: %s", sk_provider, strerror((*__errno_location()))) ; goto out; } free(sk_provider); sk_provider = xstrdup(canonical_provider); if (match_pattern_list(sk_provider, allowed_providers, 0) != 1) { sshlog("ssh-agent.c", __func__, 1243, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "Refusing add key: " "provider %s not allowed", sk_provider); goto out; } } } if ((r = sshkey_shield_private(k)) != 0) { sshlog("ssh-agent.c", __func__, 1250, 1, SYSLOG_LEVEL_ERROR, ssh_err(r), "shield private"); goto out; } if (lifetime && !death) death = monotime() + lifetime; if ((id = lookup_identity(k)) == ((void *)0)) { id = xcalloc(1, sizeof(Identity)); do { (id)->next.tqe_next = ((void *)0); (id)->next.tqe_prev = (&idtab->idlist)->tqh_last; *(&idtab->idlist)->tqh_last = (id); (&idtab->idlist)->tqh_last = &(id)->next.tqe_next; } while (0); idtab->nentries++; } else { if (identity_permitted(id, e, ((void *)0), ((void *)0), ((void *)0)) != 0) goto out; sshkey_free(id->key); free(id->comment); free(id->sk_provider); free_dest_constraints(id->dest_constraints, id->ndest_constraints); } id->key = k; id->comment = comment; id->death = death; id->confirm = confirm; id->sk_provider = sk_provider; id->dest_constraints = dest_constraints; id->ndest_constraints = ndest_constraints; if ((fp = sshkey_fingerprint(k, 2, SSH_FP_DEFAULT)) == ((void *)0)) sshfatal("ssh-agent.c", __func__, 1282, 1, SYSLOG_LEVEL_FATAL, ((void *)0), "sshkey_fingerprint failed"); sshlog("ssh-agent.c", __func__, 1283, 1, SYSLOG_LEVEL_DEBUG1, ((void *)0), "add %s %s \"%.100s\" (life: %u) (confirm: %u) " "(provider: %s) (destination constraints: %zu)", sshkey_ssh_name(k), fp, comment, seconds, confirm, sk_provider == ((void *)0) ? "none" : sk_provider, ndest_constraints) ; free(fp); k = ((void *)0); comment = ((void *)0); sk_provider = ((void *)0); dest_constraints = ((void *)0); ndest_constraints = 0; success = 1; out: free(sk_provider); free(comment); sshkey_free(k); free_dest_constraints(dest_constraints, ndest_constraints); send_status(e, success); }
void process_add_identity(struct_1 *a0) { char v0; char v1; unsigned int v2; unsigned int v3; unsigned int v4; unsigned int v5; void *v6; unsigned long long v7; void *v8; void *v9; void *v10; void *v11; struct_0 *v12; void *v13; char v14; unsigned long long v15; unsigned long long v16; unsigned long v17; unsigned long v18; void *v19; unsigned long v20; unsigned long v21; unsigned long long v22; void *v23; char v24; unsigned long long v25; char v26; char v27; char v28; unsigned long long v30; unsigned long long v31; unsigned long long v32; unsigned long long v33; unsigned long long v34; unsigned long long v35; unsigned long long v36; unsigned long long *v37; unsigned long long v38; v15 = *(&v15); v4 = 0; v2 = 0; v6 = 0; v7 = 0; v8 = 0; v3 = 0; v9 = 0; v10 = 0; v11 = 0; v5 = -1; sshlog("ssh-agent.c", "process_add_identity", 0x4ba, 0x1, 0x6, 0x0, "entering", *(&v0), *(&v1), a0, *(&v2)); v5 = sshkey_private_deserialize(a0->field_18, &v11, &v11); if (!v5 && v11) { v5 = sshbuf_get_cstring(a0->field_18, &v6, 0x0, &v6); if (!v5) { if (parse_key_constraints(a0->field_18, v11, &v8, &v3, &v2, &v7, &v9, &v10)) { sshlog("ssh-agent.c", "process_add_identity", 0x4c3, 0x1, 0x2, 0x0, "failed to parse constraints", &v10, *(&v1), a0, *(&v2)); sshbuf_reset(a0->field_18); } else { if (v7) { v30 = sshkey_is_sk(v11); if (!v30) { sshlog("ssh-agent.c", "process_add_identity", 0x4ca, 0x0, 0x2, 0x0, "Cannot add provider: %s is not an authenticator-hosted key", sshkey_type(v11), *(&v1), a0, *(&v2)); } else { v31 = strcasecmp(v7, "internal"); if (!v31) { sshlog("ssh-agent.c", "process_add_identity", 0x4cf, 0x1, 0x5, 0x0, "internal provider", &v10, *(&v1), a0, *(&v2)); } else { v32 = realpath(v7, &v14); if (!v32) { sshlog("ssh-agent.c", "process_add_identity", 0x4d2, 0x0, 0x4, 0x0, "failed provider \"%.100s\": realpath: %s", v7, strerror(*(__errno_location())), &v10, *(&v1)); } else { free(v7); v7 = xstrdup(&v14); v33 = match_pattern_list(v7, allowed_providers, 0x0, allowed_providers); if (v33 != 1) sshlog("ssh-agent.c", "process_add_identity", 0x4db, 0x0, 0x2, 0x0, "Refusing add key: provider %s not allowed", v7, *(&v1), a0, *(&v2)); } } } } if (!v7 || !v31 && v30 || v33 == 1 && v32 && v30) { v5 = sshkey_shield_private(v11); if (v5) { sshlog("ssh-agent.c", "process_add_identity", 0x4e2, 0x1, 0x2, ssh_err(v5), "shield private", &v10, *(&v1), a0, *(&v2)); } else { if (lifetime && !v8) { v34 = monotime(); v8 = __addvdi3(v34, lifetime, v34); } v12 = lookup_identity(v11); if (!v12) { v12 = xcalloc(0x1, 0x50); v12->field_0 = 0; v12->field_8 = g_e87d894820ec8358; g_e87d894820ec8358->field_0 = v12; g_e87d894820ec8358 = v12; g_e87d894820ec8348 = __addvsi3(g_e87d894820ec8348, 0x1); } else { v35 = identity_permitted(v12, a0, 0x0, NULL, NULL); if (!v35) { sshkey_free(v12->field_10); free(v12->field_18); free(v12->field_38); free_dest_constraints(v12->field_40, v12->field_48); } } if (!v35 || !v12) { v12->field_10 = v11; v12->field_18 = v6; v12->field_28 = v8; v12->field_30 = v2; v12->field_38 = v7; v12->field_40 = v9; v12->field_48 = v10; v13 = sshkey_fingerprint(v11, 0x2, 0x0); if (!v13) sshfatal("ssh-agent.c", "process_add_identity", 0x502, 0x1, 0x1, 0x0); if (v7) v36 = v7; else v36 = "none"; v23 = v10; v22 = v36; v21 = v2; v20 = v3; v19 = v6; v18 = v13; v17 = sshkey_ssh_name(v11); v16 = "add %s %s \"%.100s\" (life: %u) (confirm: %u) (provider: " "%s) (destination constraints: %zu)"; sshlog("ssh-agent.c", "process_add_identity", 0x503, 0x1, 0x5, 0x0, *(&v24), v25, *(&v26), *(&v27), *(&v28)); free(v13); v11 = 0; v6 = 0; v7 = 0; v9 = 0; v10 = 0; v4 = 1; } } } } } } if (!v11 || v5 || v5) sshlog("ssh-agent.c", "process_add_identity", 0x4be, 0x1, 0x2, ssh_err(v5), "parse", *(&v0), *(&v1), a0, *(&v2)); free(v7); free(v6); sshkey_free(v11); free_dest_constraints(v9, v10); send_status(a0, v4); v38 = v16 ^ v37[5]; return; }
openssh-portable
angr_dream
char const *getprogname(void) { return program_invocation_short_name; }
undefined8 getprogname(void) { return *puRam000000000010000f; }
gnutls
ghidra
_Bool pred_type (const char *pathname, struct stat *stat_buf, struct predicate *pred_ptr) { mode_t mode; enum file_type type = FTYPE_COUNT; ((void)sizeof((state.have_type) ? 1 : 0), __extension__({ if (state.have_type) ; else __assert_fail("state.have_type", "pred.c", 977, __extension__ __PRETTY_FUNCTION__); })); if (0 == state.type) { return 0; } (void)pathname; if (state.have_stat) mode = stat_buf->st_mode; else mode = state.type; switch (mode & 0170000) { case 0100000: type = FTYPE_REG; break; case 0040000: type = FTYPE_DIR; break; case 0120000: type = FTYPE_LNK; break; case 0060000: type = FTYPE_BLK; break; case 0020000: type = FTYPE_CHR; break; case 0140000: type = FTYPE_SOCK; break; case 0010000: type = FTYPE_FIFO; break; } if ((type != FTYPE_COUNT) && pred_ptr->args.types[type]) return 1; else return 0; }
void pred_type(unsigned long a0, struct_1 *a1, unsigned long a2) { unsigned long v0; unsigned int v1; unsigned int v2; void *v4; void *v5; unsigned long long v6; v0 = a0; v2 = 7; if (!g_50002d) __assert_fail(); if (!unlinkat) { v4 = 0; } else { if (g_50002c) v1 = a1->field_18; else v1 = unlinkat; if ((v1 & 0xf000) == 0xc000) { v2 = 6; } else if ((v1 & 0xf000) <= 0xc000) { if ((v1 & 0xf000) == 0xa000) { v2 = 4; } else if ((v1 & 0xf000) <= 0xa000) { if ((v1 & 0xf000) == 0x8000) { v2 = 3; } else if ((v1 & 0xf000) <= 0x8000) { if ((v1 & 0xf000) == 0x6000) { v2 = 0; } else if ((v1 & 0xf000) <= 0x6000) { if ((v1 & 0xf000) == 0x4000) { v2 = 2; } else if ((v1 & 0xf000) <= 0x4000) { if ((v1 & 0xf000) == 0x1000) { v2 = 5; } else if ((v1 & 0xf000) == 0x2000) { v2 = 1; } } } } } } if (v2 != 7 && *((a2 + v2 + 56))) v6 = 1; if (!*((a2 + v2 + 56)) || v2 == 7) v5 = 0; } return; }
findutils
angr_dream
static int choose_comp(struct sshcomp *comp, char *client, char *server) { char *name = match_list(client, server, ((void *)0)); if (name == ((void *)0)) return -33; if (strcmp(name, "zlib@openssh.com") == 0) { comp->type = 2; } else if (strcmp(name, "zlib") == 0) { comp->type = 1; } else if (strcmp(name, "none") == 0) { comp->type = 0; } else { sshlog("kex.c", __func__, 832, 1, SYSLOG_LEVEL_ERROR, ((void *)0), "unsupported compression scheme %s", name); free(name); return -1; } comp->name = name; return 0; }
long choose_comp(long a1, long a2, long a3) { char *s1; s1 = (char *)match_list(a2, a3, 0LL); if (!s1) return 4294967263LL; if (!strcmp(s1, "zlib@openssh.com")) { *(_DWORD *)a1 = 2; } else if (!strcmp(s1, "zlib")) { *(_DWORD *)a1 = 1; } else { if (strcmp(s1, "none")) { sshlog("kex.c", "choose_comp", 832LL, 1LL, 2LL, 0LL, "unsupported compression scheme %s", s1); free(s1); return 0xFFFFFFFFLL; } *(_DWORD *)a1 = 0; } *(_QWORD *)(a1 + 8) = s1; return 0LL; }
openssh-portable
ida
static WORD_LIST *word_list_split(list) WORD_LIST *list; { WORD_LIST *result, *t, *tresult, *e; WORD_DESC *w; for (t = list, result = (WORD_LIST *)((void *)0); t; t = t->next) { tresult = word_split(t->word, ifs_value); if (tresult == 0 && t->word && (t->word->flags & (1 << 21))) { w = alloc_word_desc(); w->word = (char *)sh_xmalloc((1), "subst.c", 12090); w->word[0] = '\0'; tresult = make_word_list(w, (WORD_LIST *)((void *)0)); } if (tresult && tresult->next == 0 && t->next == 0 && (t->word->flags & (1 << 9)) && ((t->word->word)[0] == (tresult->word->word)[0] && strcmp(t->word->word, tresult->word->word) == 0)) tresult->word->flags |= (1 << 9); if (result == 0) result = e = tresult; else { e->next = tresult; while (e->next) e = e->next; } } return (result); }
int word_list_split(unsigned long a0, unsigned long a1, unsigned long a2, unsigned int a3, unsigned long a4, unsigned long long a5) { void *v0; int tmp_29; struct_3 *v1; struct_0 *v2; unsigned long long v3[2]; char **v4; unsigned long long v6; v1 = a0; for (v0 = 0; v1; v1 = v1->field_0) { v2 = word_split(v1->field_8, 0x5e8c0fc45b60ffc, 0x5e8c0fc45b60ffc, a3, a4, a5); if (!v2 && v1->field_8 && (v1->field_8->field_8 & 0x200000)) { v4 = alloc_word_desc(); *(v4) = sh_xmalloc(0x1, "subst.c", 0x2f3a); *(*(v4)) = 0; v2 = make_word_list(v4, 0x0, v4); } if (v2 && !v2->field_0 && !v1->field_0 && (v1->field_8->field_8 & 0x200) && *(v1->field_8->field_0) == v2->field_8->field_0->field_0 && !strcmp(v1->field_8->field_0, v2->field_8->field_0)) { v6 = v2->field_8->field_8; *(&v6) = (v2->field_8->field_8 >> 8) | 2; tmp_29 = v6; v2->field_8->field_8 = tmp_29; } if (!v0) { v3[0] = v2; v0[0] = v3; } else { for (v3[0] = v2; v3[0]; v3[0] = v3[0]) ; } } return v0; }
bash
angr_sailr
static int it_init_running(itp) ITEMLIST *itp; { return (it_init_joblist(itp, 0)); }
long it_init_running(long a1) { return it_init_joblist(a1, 0); }
bash
ida
static int ssh_request_reply(int sock, struct sshbuf *request, struct sshbuf *reply) { int r; size_t l, len; char buf[1024]; len = sshbuf_len(request); do { const u_int32_t __v = (len); ((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); if (atomicio((ssize_t (*)(int, void *, size_t))write, sock, buf, 4) != 4 || atomicio((ssize_t (*)(int, void *, size_t))write, sock, sshbuf_mutable_ptr(request), sshbuf_len(request)) != sshbuf_len(request)) return -26; if (atomicio(read, sock, buf, 4) != 4) return -26; len = (((u_int32_t)(((const u_char *)(buf))[0]) << 24) | ((u_int32_t)(((const u_char *)(buf))[1]) << 16) | ((u_int32_t)(((const u_char *)(buf))[2]) << 8) | (u_int32_t)(((const u_char *)(buf))[3])); if (len > (256 * 1024)) return -4; sshbuf_reset(reply); while (len > 0) { l = len; if (l > sizeof(buf)) l = sizeof(buf); if (atomicio(read, sock, buf, l) != l) return -26; if ((r = sshbuf_put(reply, buf, l)) != 0) return r; len -= l; } return 0; }
int ssh_request_reply(unsigned long a0, unsigned long long a1, unsigned long long a2) { unsigned int v0; unsigned long long v1; unsigned long long v2; unsigned long long v3; char v4; char v5; char v6; char v7; unsigned int v9; unsigned long long v10; v3 = sshbuf_len(a1); v0 = v3; v4 = v0 >> 24; v5 = v0 >> 16; v6 = v0 >> 8; v7 = v0; v9 = atomicio(got.write, a0, &v4, 0x4); if (v9 == 4) { v10 = atomicio(got.write, a0, sshbuf_mutable_ptr(a1), sshbuf_len(a1)); v9 = sshbuf_len(a1); if (v10 == v9) { v9 = atomicio(got.read, a0, &v4, 0x4); if (v9 != 4) { v9 = -26; } else { v3 = v7 | (v4 * 0x1000000) | (v5 * 0x10000) | (v6 * 0x100); if (v3 > 0x40000) { v9 = -0x4; } else { sshbuf_reset(a2); while (true) { if (v3) { v2 = v3; if (v2 > 0x400) v2 = 0x400; v9 = atomicio(got.read, a0, &v4, v2); if (v2 != v9) { v9 = -26; break; } else { *(&v1) = sshbuf_put(a2, &v4, v2, &v4); if (v1) { v9 = v1; break; } else { v3 -= v2; } } } else { v9 = 0; break; } } } } } } if (v9 != 4 || v10 != v9) v9 = -26; return v9; }
openssh-portable
angr_dream
static const char *append_char_function(const char *name) { struct stat stbuf; char *expname = *name == '~' ? fn_tilde_expand(name) : ((void *)0); const char *rs = " "; if (stat(expname ? expname : name, &stbuf) == -1) goto out; if (((((stbuf.st_mode)) & 0170000) == (0040000))) rs = "/"; out: if (expname) free(expname); return rs; }
long long append_char_function(char *a0) { unsigned long long v0; void *v1; char v2; char v3; void *v5; if (*(a0) != 126) v5 = 0; else v5 = fn_tilde_expand(a0); v1 = v5; v0 = " "; if (stat((!v1 ? v1 : a0), &v2) != -1 && (*(&v3) & 0xf000) == 0x4000) v0 = "/"; if (v1) free(v1); return v0; }
libedit
angr_sailr
static void rsyslogdDebugSwitch(void) { time_t tTime; struct tm tp; datetime.GetTime(&tTime); localtime_r(&tTime, &tp); if (debugging_on == 0) { debugging_on = 1; r_dbgprintf("rsyslogd.c", "\n"); r_dbgprintf("rsyslogd.c", "\n"); r_dbgprintf("rsyslogd.c", "************************************************" "********************************\n"); r_dbgprintf("rsyslogd.c", "Switching debugging_on to true at %2.2d:%2.2d:%2.2d\n", tp.tm_hour, tp.tm_min, tp.tm_sec); r_dbgprintf("rsyslogd.c", "************************************************" "********************************\n"); } else { r_dbgprintf("rsyslogd.c", "************************************************" "********************************\n"); r_dbgprintf("rsyslogd.c", "Switching debugging_on to false at %2.2d:%2.2d:%2.2d\n", tp.tm_hour, tp.tm_min, tp.tm_sec); r_dbgprintf("rsyslogd.c", "************************************************" "********************************\n"); r_dbgprintf("rsyslogd.c", "\n"); r_dbgprintf("rsyslogd.c", "\n"); debugging_on = 0; } }
void rsyslogdDebugSwitch() { char v0; char v1; char v2; char v3; unsigned long long *v5; unsigned long long v6; *(&g_404648)(&v0); localtime_r(&v0, &v1); if (debugging_on) { r_dbgprintf("rsyslogd.c", "**************************************************************" "******************\n", *(&g_404648)); r_dbgprintf("rsyslogd.c", "Switching debugging_on to false at %2.2d:%2.2d:%2.2d\n", *(&v2)); r_dbgprintf("rsyslogd.c", "**************************************************************" "******************\n", *(&g_404648)); r_dbgprintf("rsyslogd.c", "\n", *(&g_404648)); r_dbgprintf("rsyslogd.c", "\n", *(&g_404648)); debugging_on = 0; } else { debugging_on = 1; r_dbgprintf("rsyslogd.c", "\n", *(&g_404648)); r_dbgprintf("rsyslogd.c", "\n", *(&g_404648)); r_dbgprintf("rsyslogd.c", "**************************************************************" "******************\n", *(&g_404648)); r_dbgprintf("rsyslogd.c", "Switching debugging_on to true at %2.2d:%2.2d:%2.2d\n", *(&v2)); r_dbgprintf("rsyslogd.c", "**************************************************************" "******************\n", *(&g_404648)); } v6 = *(&v3) ^ v5[5]; return; }
rsyslog-8.2210.0
angr_sailr
void set_cron_uid(void) { if (setuid(0) < 0) { perror("setuid"); exit(1); } }
long long set_cron_uid() { unsigned long long v1; v1 = setuid(0x0); if (v1 >= 0) return v1; perror("setuid"); exit(0x1); }
cronie
angr_phoenix
int rl_vi_change_to(int count, int key) { int c, r; _rl_vimotion_cxt *savecxt; savecxt = 0; if (_rl_vi_redoing) { savecxt = _rl_vimvcxt; _rl_vimvcxt = _rl_mvcxt_alloc(0x02, key); } else if (_rl_vimvcxt) _rl_mvcxt_init(_rl_vimvcxt, 0x02, key); else _rl_vimvcxt = _rl_mvcxt_alloc(0x02, key); _rl_vimvcxt->start = rl_point; rl_mark = rl_point; if ((1 && (1 && ((*__ctype_b_loc())[(int)(((unsigned char)key))] & (unsigned short int)_ISupper)))) { _rl_vimvcxt->motion = '$'; r = rl_domove_motion_callback(_rl_vimvcxt); } else if (_rl_vi_redoing && _rl_vi_last_motion != 'c') { _rl_vimvcxt->motion = _rl_vi_last_motion; r = rl_domove_motion_callback(_rl_vimvcxt); } else if (_rl_vi_redoing) { _rl_vimvcxt->motion = _rl_vi_last_motion; rl_mark = rl_end; rl_beg_of_line(1, key); (rl_readline_state &= ~(0x0100000)); r = vidomove_dispatch(_rl_vimvcxt); } else if ((rl_readline_state & (0x0080000))) { (rl_readline_state |= (0x0100000)); return (0); } else r = rl_vi_domove(key, &c); if (r < 0) { rl_ding(); r = -1; } _rl_mvcxt_dispose(_rl_vimvcxt); _rl_vimvcxt = savecxt; return r; }
long long rl_vi_change_to(unsigned long a0, unsigned long long a1, unsigned long a2, unsigned long long a3, unsigned long long a4, unsigned long long a5) { unsigned int v0; char v1; unsigned int v2; void *v3; unsigned int v6; void *v7; v0 = a0; v3 = 0; if (true) { v3 = _rl_vimvcxt; _rl_vimvcxt = _rl_mvcxt_alloc(0x2, a1); } else if (!_rl_vimvcxt) { _rl_vimvcxt = _rl_mvcxt_alloc(0x2, a1); } else { _rl_mvcxt_init(_rl_vimvcxt, 0x2, a1); } *(&_rl_vimvcxt[20]) = rl_point; rl_mark = rl_point; v6 = *((*(__ctype_b_loc()) + a1 * 2)) & 0x100; if (v6) { *(&_rl_vimvcxt[32]) = 36; v2 = rl_domove_motion_callback(_rl_vimvcxt, a1, a1 * 2, a3, a4, a5); goto LABEL_402e9c; } if (_rl_vi_last_motion != 99) { *(&_rl_vimvcxt[32]) = _rl_vi_last_motion; v2 = rl_domove_motion_callback(_rl_vimvcxt, a1, _rl_vi_last_motion, a3, a4, a5); goto LABEL_402e9c; } if (true) { *(&_rl_vimvcxt[32]) = _rl_vi_last_motion; rl_mark = rl_end; rl_beg_of_line(0x1, a1); rl_readline_state = rl_readline_state & -1048577; v2 = vidomove_dispatch(_rl_vimvcxt, a1, a1 * 2, a3, a4, a5); } else if ((rl_readline_state & 0x80000)) { rl_readline_state = rl_readline_state | 0x100000; v7 = 0; goto LABEL_402ecb; } else { v2 = rl_vi_domove(a1, &v1, &v1, a3, a4, a5); } LABEL_402e9c: if (v2 < 0) { rl_ding(); v2 = -1; } _rl_mvcxt_dispose(_rl_vimvcxt); _rl_vimvcxt = v3; v7 = v2; LABEL_402ecb: return v7; }
bash
angr_phoenix
static size_t count_newlines(char *buf, size_t bufsize) { size_t count = 0; char *p; char *lim = buf + bufsize; char ch = *lim; *lim = '\n'; for (p = buf; (p = rawmemchr(p, '\n')) != lim; p++) count++; *lim = ch; return count; }
int count_newlines(void *a0, unsigned long a1) { char v0; void *v1; void *v2; char *v3; v1 = 0; v3 = a1 + a0; v0 = *(v3); *(v3) = 10; v2 = a0; while (true) { v2 = rawmemchr(v2, 0xa); if (v2 == v3) break; v1 += 1; v2 += 1; } *(v3) = v0; return v1; }
diffutils
angr_dream
int optionh_stat(const char *name, struct stat *p) { if (-100 != state.cwd_dir_fd) ((void)sizeof((state.cwd_dir_fd >= 0) ? 1 : 0), __extension__({ if (state.cwd_dir_fd >= 0) ; else __assert_fail("state.cwd_dir_fd >= 0", "util.c", 605, __extension__ __PRETTY_FUNCTION__); })); set_stat_placeholders(p); if (0 == state.curdepth) { int rv; rv = fstatat(state.cwd_dir_fd, name, p, 0); if (0 == rv) return 0; else return fallback_stat(name, p, rv); } else { return fstatat(state.cwd_dir_fd, name, p, 0x100); } }
int optionh_stat(const char *a1, struct stat *a2) { int v3; if (state[6] != -100 && state[6] < 0) _assert_fail("state.cwd_dir_fd >= 0", "util.c", 0x25Du, "optionh_stat"); set_stat_placeholders(); if (state[0]) return fstatat(state[6], a1, a2, 256); v3 = fstatat(state[6], a1, a2, 0); if (v3) return fallback_stat(a1, a2, v3); else return 0; }
findutils
ida
COMMAND *make_coproc_command(name, command) char *name; COMMAND *command; { COPROC_COM *temp; temp = (COPROC_COM *)sh_xmalloc((sizeof(COPROC_COM)), "make_cmd.c", 835); temp->name = (char *)strcpy(sh_xmalloc((1 + strlen(name)), "make_cmd.c", 836), (name)); temp->command = command; temp->flags = 0x01 | 0x1000; return (make_command(cm_coproc, (SIMPLE_COM *)temp)); }
long long make_coproc_command(char *a0, unsigned long a1) { struct_0 *v0; v0 = sh_xmalloc(0x18, "make_cmd.c", 0x343); v0->field_8 = strcpy(sh_xmalloc(strlen(a0) + 1, "make_cmd.c", 0x344), a0); v0->field_10 = a1; v0->field_0 = 4097; return make_command(0xe, v0); }
bash
angr_dream
static int pkcs11_rsa_wrap(struct pkcs11_provider *provider, CK_ULONG slotidx, CK_ATTRIBUTE *keyid_attrib, RSA *rsa) { struct pkcs11_key *k11; if (pkcs11_rsa_start_wrapper() == -1) return (-1); k11 = xcalloc(1, sizeof(*k11)); k11->provider = provider; provider->refcount++; k11->slotidx = slotidx; k11->keyid_len = keyid_attrib->ulValueLen; if (k11->keyid_len > 0) { k11->keyid = xmalloc(k11->keyid_len); memcpy(k11->keyid, keyid_attrib->pValue, k11->keyid_len); } RSA_set_method(rsa, rsa_method); RSA_set_ex_data(rsa, rsa_idx, k11); return (0); }
int pkcs11_rsa_wrap(struct_0 *a0, unsigned long a1, unsigned long long a2[3], unsigned long long a3) { struct_1 *v0; unsigned int v2; v2 = pkcs11_rsa_start_wrapper(); if (v2 == -1) { v2 = -1; } else { v0 = xcalloc(0x1, 0x20); v0->field_0 = a0; a0->field_8c = __addvsi3(a0->field_8c, 0x1); v0->field_8 = a1; v0->field_18 = a2[2]; if (v0->field_18 > 0) { v0->field_10 = xmalloc(v0->field_18); memcpy(v0->field_10, a2[1], v0->field_18); } RSA_set_method(a3, rsa_method, rsa_method); RSA_set_ex_data(a3, rsa_idx, v0, rsa_idx); v2 = 0; } return v2; }
openssh-portable
angr_dream
gzFile gzdopen(fd, mode) int fd; const char *mode; { char *path; gzFile gz; if (fd == -1 || (path = (char *)malloc(7 + 3 * sizeof(int))) == ((void *)0)) return ((void *)0); (void)snprintf(path, 7 + 3 * sizeof(int), "<fd:%d>", fd); gz = gz_open(path, fd, mode); free(path); return gz; }
undefined8 gzdopen(uint param_1, undefined8 param_2) { char *__s; undefined8 uVar1; if ((param_1 != 0xffffffff) && (__s = (char *)malloc(0x13), __s != (char *)0x0)) { snprintf(__s, 0x13, "<fd:%d>", (ulong)param_1); uVar1 = gz_open(__s, param_1, param_2); free(__s); return uVar1; } return 0; }
zlib
ghidra
ch_end(EditLine *el) { free(el->el_line.buffer); el->el_line.buffer = ((void *)0); el->el_line.limit = ((void *)0); free(el->el_chared.c_undo.buf); el->el_chared.c_undo.buf = ((void *)0); free(el->el_chared.c_redo.buf); el->el_chared.c_redo.buf = ((void *)0); el->el_chared.c_redo.pos = ((void *)0); el->el_chared.c_redo.lim = ((void *)0); el->el_chared.c_redo.cmd = 28; free(el->el_chared.c_kill.buf); el->el_chared.c_kill.buf = ((void *)0); ch_reset(el); }
long long ch_end(struct_0 *a0) { free(a0->field_50); a0->field_50 = 0; a0->field_68 = 0; free(a0->field_378); a0->field_378 = 0; free(a0->field_398); a0->field_398 = 0; a0->field_3a0 = 0; a0->field_3a8 = 0; a0->field_3b0 = 28; free(a0->field_380); a0->field_380 = 0; return ch_reset(a0); }
libedit
angr_dream
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; return v21; } else if (fflush(stdout)) { v0 = strerror(*(__errno_location())); sshlog("sshconnect2.c", "ssh_keysign", 0x80f, 0x1, 0x2, 0x0, "fflush: %s"); v21 = -1; return v21; } else if (pipe(&v10) == -1) { v0 = strerror(*(__errno_location())); sshlog("sshconnect2.c", "ssh_keysign", 0x813, 0x1, 0x2, 0x0, "pipe: %s"); v21 = -1; return v21; } else if (pipe(&v12) != -1) { v7 = fork(); if (v7 == -1) { v0 = strerror(*(__errno_location())); sshlog("sshconnect2.c", "ssh_keysign", 0x81b, 0x1, 0x2, 0x0, "fork: %s"); v21 = -1; return v21; } 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), v5)) { v17 = "buffer error"; sshfatal("sshconnect2.c", "ssh_keysign", 0x83e, 0x1, 0x1, ssh_err(v5)); } 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) { *(__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)); ssh_signal(0x11, v8); sshbuf_free(*(&v9)); v21 = -1; return v21; } else if (!(*(&v4) >> 8)) { v5 = sshbuf_get_u8(*(&v9), &v2, &v2); if (v5) { v17 = "buffer error"; sshlog("sshconnect2.c", "ssh_keysign", 0x85a, 0x1, 0x2, ssh_err(v5), *(&v19)); ssh_signal(0x11, v8); sshbuf_free(*(&v9)); v21 = -1; return v21; } else if (v3 != v2) { v17 = "bad version"; sshlog("sshconnect2.c", "ssh_keysign", 0x85e, 0x1, 0x2, 0x0, *(&v19)); ssh_signal(0x11, v8); sshbuf_free(*(&v9)); v21 = -1; return v21; } else { v5 = sshbuf_get_string(*(&v9), a2, a3, a2); if (!v5) { ssh_signal(0x11, v8); sshbuf_free(*(&v9)); v21 = 0; return v21; } v17 = "buffer error"; sshlog("sshconnect2.c", "ssh_keysign", 0x862, 0x1, 0x2, ssh_err(v5), *(&v19)); ssh_signal(0x11, v8); sshbuf_free(*(&v9)); v21 = -1; return v21; } } else { v18 = *(&v4) >> 8; v17 = "exited with status %d"; sshlog("sshconnect2.c", "ssh_keysign", 0x856, 0x1, 0x2, 0x0, *(&v19)); ssh_signal(0x11, v8); sshbuf_free(*(&v9)); v21 = -1; return v21; } } 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)); } else { v17 = "no reply"; sshlog("sshconnect2.c", "ssh_keysign", 0x846, 0x1, 0x2, 0x0, *(&v19)); } ssh_signal(0x11, v8); sshbuf_free(*(&v9)); v21 = -1; return v21; } else { v0 = strerror(*(__errno_location())); sshlog("sshconnect2.c", "ssh_keysign", 0x817, 0x1, 0x2, 0x0, "pipe: %s"); v21 = -1; return v21; } }
openssh-portable
angr_sailr
int ssh_digest_buffer(int alg, const struct sshbuf *b, u_char *d, size_t dlen) { return ssh_digest_memory(alg, sshbuf_ptr(b), sshbuf_len(b), d, dlen); }
long long ssh_digest_buffer(unsigned long a0, unsigned long long a1, unsigned long long a2, unsigned int a3) { return ssh_digest_memory(a0, sshbuf_ptr(a1), sshbuf_len(a1), a2, a3); }
openssh-portable
angr_sailr
int asmprintf(char **outp, size_t sz, int *wp, const char *fmt, ...) { va_list ap; int ret; *outp = ((void *)0); __builtin_va_start(ap, fmt); ret = vasnmprintf(outp, sz, wp, fmt, ap); __builtin_va_end(ap); return ret; }
long long asmprintf() { unsigned int v0; unsigned int v1; unsigned int v2; unsigned long v3; unsigned long v4; unsigned long v5; char v6; unsigned long v7; unsigned long v8; int v9; int v10; int v11; int v12; int v13; int v14; int v15; int v16; unsigned long v17; unsigned long v18; unsigned long v19; char v20; int v21; int v22; int v23; int v24; int v25; int v26; int v27; int v28; unsigned long long *v29; unsigned long long *v30; unsigned long long v31; unsigned int *v32; char *v33; v7 = v18; v8 = v19; if (v20) { v9 = v21; v10 = v22; v11 = v23; v12 = v24; v13 = v25; v14 = v26; v15 = v27; v16 = v28; } v5 = v29[5]; *(v30) = 0; v1 = 32; v2 = 48; v3 = &v17; v4 = &v6; v0 = vasnmprintf(v30, v31, v32, v33, &v1); if ((v5 ^ v29[5])) __stack_chk_fail(); return v0; }
openssh-portable
angr_dream
static int card_of_complement(struct Spec_list *s) { int c; int cardinality = N_CHARS; _Bool in_set[N_CHARS] = { 0, }; s->state = ((18446744073709551615UL) - 1); while ((c = get_next(s, ((void *)0))) != -1) { cardinality -= (!in_set[c]); in_set[c] = 1; } return cardinality; }
int card_of_complement(void *a0) { struct_0 *v0; unsigned int v1; unsigned int v2; void *v3; unsigned long long v5; void *v6; unsigned long v7; v0 = a0; v1 = 0x100; v5 = 32; for (v6 = &v3; v5; v6 += v7 * 8) { v5 -= 1; v3 = 0; } v0->field_10 = -2; while (true) { v2 = get_next(v0, NULL); if (v2 == -1) break; v1 -= (&v3)[v2] ^ 1; (&v3)[v2] = 1; } return v1; }
coreutils
angr_dream
static void server_alive_check(struct ssh *ssh) { int r; if (ssh_packet_inc_alive_timeouts(ssh) > options.server_alive_count_max) { sshlog("clientloop.c", __func__, 497, 0, SYSLOG_LEVEL_INFO, ((void *)0), "Timeout, server %s not responding.", host); cleanup_exit(255); } if ((r = sshpkt_start(ssh, 80)) != 0 || (r = sshpkt_put_cstring(ssh, "keepalive@openssh.com")) != 0 || (r = sshpkt_put_u8(ssh, 1)) != 0 || (r = sshpkt_send(ssh)) != 0) sshfatal("clientloop.c", __func__, 504, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "send packet"); client_register_global_confirm(((void *)0), ((void *)0)); schedule_server_alive_check(); }
void server_alive_check(unsigned long long a0) { unsigned long long v0; unsigned long v1; unsigned int v2; unsigned long long v5; if (ssh_packet_inc_alive_timeouts(a0) > *(5247856)) { v1 = host; v0 = "Timeout, server %s not responding."; sshlog("clientloop.c", "server_alive_check", 0x1f1, 0x0, 0x3, 0x0); cleanup_exit(0xff); } v2 = sshpkt_start(a0, 0x50); if (!v2) { v2 = sshpkt_put_cstring(a0, "keepalive@openssh.com"); if (!v2) { v2 = sshpkt_put_u8(a0, 0x1); if (!v2) v2 = sshpkt_send(a0); } } if (v2 || v2 || v2 || v2) { v0 = "send packet"; sshfatal("clientloop.c", "server_alive_check", 0x1f8, 0x1, 0x1, ssh_err(v2)); } client_register_global_confirm(0x0, 0x0); v5 = schedule_server_alive_check(); return; }
openssh-portable
angr_dream
static size_t xdupmbstowcs2(destp, src) wchar_t **destp; const char *src; { const char *p; wchar_t *wsbuf; size_t wsbuf_size; size_t wcnum; mbstate_t state; size_t n, wcslength; const char *end_or_backslash; size_t nms; mbstate_t tmp_state; const char *tmp_p; memset(&state, '\0', sizeof(mbstate_t)); wsbuf_size = 0; wsbuf = ((void *)0); p = src; wcnum = 0; do { end_or_backslash = strchrnul(p, '\\'); nms = end_or_backslash - p; if (*end_or_backslash == '\0') nms++; tmp_p = p; tmp_state = state; if (nms == 0 && *p == '\\') nms = wcslength = 1; else wcslength = mbsnrtowcs(((void *)0), &tmp_p, nms, 0, &tmp_state); if (wcslength == 0) { tmp_p = p; tmp_state = state; wcslength = 1; } if (wcslength == (size_t)-1) { free(wsbuf); *destp = ((void *)0); return (size_t)-1; } if (wsbuf_size < wcnum + wcslength + 1) { wchar_t *wstmp; while (wsbuf_size < wcnum + wcslength + 1) wsbuf_size += 32; wstmp = (wchar_t *)realloc(wsbuf, wsbuf_size * sizeof(wchar_t)); if (wstmp == ((void *)0)) { free(wsbuf); *destp = ((void *)0); return (size_t)-1; } wsbuf = wstmp; } n = mbsnrtowcs(wsbuf + wcnum, &p, nms, wsbuf_size - wcnum, &state); if (n == 0 && p == 0) { wsbuf[wcnum] = L'\0'; break; } if (wcslength == 1 && (n == 0 || n == (size_t)-1)) { state = tmp_state; p = tmp_p; wsbuf[wcnum] = *p; if (*p == 0) break; else { wcnum++; p++; } } else wcnum += wcslength; if (mbsinit(&state) && (p != ((void *)0)) && (*p == '\\')) { wsbuf[wcnum++] = L'\\'; p++; } } while (p != ((void *)0)); *destp = wsbuf; return wcnum; }
void xdupmbstowcs2(unsigned long long *a0, char *a1) { char *v0; int tmp_16; char *v1; void *v2; void *v3; void *v4; unsigned long long v5; unsigned long long v6; char *v7; void *v8; unsigned long v9; unsigned long long v10; unsigned long long v11; unsigned long long v13; void *v14; unsigned long long v15; memset(&v10, 0x0, 0x8); v3 = 0; v2 = 0; v0 = a1; v4 = 0; do { v7 = strchrnul(v0, 0x5c); v6 = v7 - v0; if (!*(v7)) v6 += 1; v1 = v0; v11 = v10; if (!v6 && *(v0) == 92) { v5 = 1; v6 = v5; goto LABEL_400300; } v5 = mbsnrtowcs(0x0, &v1, v6, 0x0, &v11); LABEL_400300: if (!v5) { v1 = v0; v11 = v10; v5 = 1; } if (v5 == -1) { free(v2); *(a0) = 0; v13 = -1; goto LABEL_40050d; } if (v3 < v5 + v4 + 1) { for (; v3 < v5 + v4 + 1; v3 += 32) ; v8 = realloc(v2, v3 * 4); if (v8) { v2 = v8; } else { free(v2); *(a0) = 0; v15 = -1; goto LABEL_40050d; } } v9 = mbsnrtowcs(v4 * 4 + v2, &v0, v6, v3 - v4, &v10); if (!v9 && !v0) { *((v2 + 0x4 * v4)) = 0; break; } if (v5 == 1) { if (v9 && !(v9 == -1)) goto LABEL_400495; v10 = v11; v0 = v1; *((v2 + 0x4 * v4)) = *(v0); if (!*(v0)) break; v4 += 1; v0 += 1; goto LABEL_40049d; } LABEL_400495: v4 += v5; LABEL_40049d: if (mbsinit(&v10) && v0 && *(v0) == 92) { tmp_16 = v4; v4 += 1; *((v2 + 4 * tmp_16)) = 92; v0 += 1; } } while (v0); *(a0) = v2; v14 = v4; LABEL_40050d: return; }
bash
angr_phoenix
static void add_links(char *c) { int i, j, nr; char *f, *g, *h; char *idtest[6]; out_length += strlen(c); nr = 0; idtest[0] = strstr(c + 1, ": idtest[1] = strchr(c + 1, '@'); idtest[2] = strstr(c, "www."); idtest[3] = strstr(c, "ftp."); idtest[4] = 0; idtest[5] = strstr(c + 1, ".h&gt;"); for (i = 0; i < 6; i++) nr += (idtest[i] != ((void *)0) ); while (nr) { j = -1; for (i = 0; i < 6; i++) if (idtest[i] && (j < 0 || idtest[i] < idtest[j])) j = i; switch (j) { case 5: f = idtest[5]; h = f + 2; g = f; while (g > c && g[-1] != ';') g--; if (g != c) { char t; t = *g; *g = '\0'; fputs(c, stdout); *g = t; *h = '\0'; printf("<A HREF=\"file:/usr/include/%s\">%s</A>&gt;", g, g); c = f + 6; } else { f[5] = '\0'; fputs(c, stdout); f[5] = ';'; c = f + 5; } break; case 4: break; case 3: case 2: g = f = idtest[j]; while (*g && (((*__ctype_b_loc())[(int)((*g))] & (unsigned short int)_ISalnum) || *g == '_' || *g == '-' || *g == '+' || *g == '.')) g++; if (g[-1] == '.') g--; if (g - f > 4) { char t; t = *f; *f = '\0'; fputs(c, stdout); *f = t; t = *g; *g = '\0'; printf("<A HREF=\"%s: f, f); *g = t; c = g; } else { f[3] = '\0'; fputs(c, stdout); c = f + 3; f[3] = '.'; } break; case 1: g = f = idtest[1]; while (g > c && (((*__ctype_b_loc())[(int)((g[-1]))] & (unsigned short int)_ISalnum) || g[-1] == '_' || g[-1] == '-' || g[-1] == '+' || g[-1] == '.' || g[-1] == '%')) g--; h = f + 1; while (*h && (((*__ctype_b_loc())[(int)((*h))] & (unsigned short int)_ISalnum) || *h == '_' || *h == '-' || *h == '+' || *h == '.')) h++; if (*h == '.') h--; if (h - f > 4 && f - g > 1) { char t; t = *g; *g = '\0'; fputs(c, stdout); *g = t; t = *h; *h = '\0'; printf("<A HREF=\"mailto:%s\">%s</A>", g, g); *h = t; c = h; } else { *f = '\0'; fputs(c, stdout); *f = '@'; idtest[1] = c; c = f; } break; case 0: g = f = idtest[0]; while ( g > c && ((*__ctype_b_loc())[(int)((g[-1]))] & (unsigned short int)_ISalpha) && ((*__ctype_b_loc())[(int)((g[-1]))] & (unsigned short int)_ISlower)) g--; h = f + 3; while ( *h && !((*__ctype_b_loc())[(int)((*h))] & (unsigned short int)_ISspace) && *h != '<' && *h != '>' && *h != '"' && *h != '&') h++; if (f - g > 2 && f - g < 7 && h - f > 3) { char t; t = *g; *g = '\0'; fputs(c, stdout); *g = t; t = *h; *h = '\0'; printf("<A HREF=\"%s\">%s</A>", g, g); *h = t; c = h; } else { f[1] = '\0'; fputs(c, stdout); f[1] = '/'; c = f + 1; } break; default: break; } nr = 0; if (idtest[0] && idtest[0] < c) idtest[0] = strstr(c + 1, ": if (idtest[1] && idtest[1] < c) idtest[1] = strchr(c + 1, '@'); if (idtest[2] && idtest[2] < c) idtest[2] = strstr(c, "www."); if (idtest[3] && idtest[3] < c) idtest[3] = strstr(c, "ftp."); if (idtest[4] && idtest[4] < c) idtest[4] = strchr(c + 1, '('); if (idtest[5] && idtest[5] < c) idtest[5] = strstr(c + 1, ".h&gt;"); for (i = 0; i < 6; i++) nr += (idtest[i] != ((void *)0) ); } fputs(c, stdout ); }
void add_links(char *a0) { char v0[4]; char v1; char v2; char v3; char v4; unsigned int v5; unsigned int v6; unsigned int v7; char v8[4]; char v9[4]; char v10[4]; unsigned long v11; char v12[4]; unsigned long v13; unsigned long v14; void *v15; char v16[6]; char v17; unsigned int v20; unsigned int v22; unsigned int v24; unsigned int v25; unsigned int v26; unsigned int v27; unsigned long long *v28; unsigned long long v29; *(&v0) = a0; out_length = out_length + strlen(v0); v7 = 0; v11 = strstr(&v0[1], ": *(&v12) = strchr(&v0[1], 0x40); v13 = strstr(v0, "www."); v14 = strstr(v0, "ftp."); v15 = 0; *(&v16) = strstr(&v0[1], ".h&gt;"); for (v5 = 0; v5 <= 5; v5 += 1) { v7 += (&v11)[v5]; } while (v7) { v6 = -1; for (v5 = 0; v5 <= 5; v5 += 1) { if ((&v11)[v5] && ((&v11)[v5] < (&v11)[v6] || v6 < 0)) v6 = v5; } switch (v6) { case 0: *(&v10) = v11; for (*(&v8) = v10; v8 > v0; *(&v8) = &v8[1]) { v20 = *((*(__ctype_b_loc()) + v8[1] * 2)) & 0x400; if (!v20) break; if (v20) { *(&v20) = *((*(__ctype_b_loc()) + v8[1] * 2)); v20 = v20 & 0x200; if (!v20) break; } } for (*(&v9) = &v10[1 + 1]; v9[0]; *(&v9) = &v9[1]) { *(&v20) = *((v9[0] * 2 + *(__ctype_b_loc()))); v25 = v20 & 0x2000; if (v25) break; if (!v25) { if (v9[0] == 60) break; if (v9[0] != 60) { if (v9[0] == 62) break; if (v9[0] != 62) { if (v9[0] == 34) break; if (v9[0] != 34) { if (v9[0] == 38) break; } } } } } if (v10 - v8 > 2 && v10 - v8 <= 6 && v9 - v10 > 3) { v4 = v8[0]; v8[0] = 0; fputs(v0, *(&stdout)); v8[0] = v4; v4 = v9[0]; v9[0] = 0; printf("<A HREF=\"%s\">%s</A>", v8, v8); v9[0] = v4; *(&v0) = v9; break; } if (v9 - v10 <= 3 || v10 - v8 <= 2 || v10 - v8 > 6) { v10[1] = 0; fputs(v0, *(&stdout)); v10[1] = 47; *(&v0) = &v10[1]; break; } case 1: *(&v10) = v12; for (*(&v8) = v10; v8 > v0; *(&v8) = &v8[1]) { v24 = *((*(__ctype_b_loc()) + v8[1] * 2)) & 8; if (!v24 && v8[1] != 95 && v8[1] != 45 && v8[1] != 43 && v8[1] != 46) { if (v8[1] != 37) break; } } for (*(&v9) = &v10[1]; v9[0]; *(&v9) = &v9[1]) { *(&v24) = *((v9[0] * 2 + *(__ctype_b_loc()))); v26 = v24 & 8; if (!v26 && v9[0] != 95 && v9[0] != 45 && v9[0] != 43) { if (v9[0] != 46) break; } } if (v9[0] == 46) *(&v9) = &v9[1]; if (v9 - v10 > 4 && v10 - v8 > 1) { v3 = v8[0]; v8[0] = 0; fputs(v0, *(&stdout)); v8[0] = v3; v3 = v9[0]; v9[0] = 0; printf("<A HREF=\"mailto:%s\">%s</A>", v8, v8); v9[0] = v3; *(&v0) = v9; break; } if (v10 - v8 <= 1 || v9 - v10 <= 4) { v10[0] = 0; fputs(v0, *(&stdout)); v10[0] = 64; *(&v12) = v0; *(&v0) = v10; break; } case 2: case 3: *(&v10) = (&v11)[v6]; for (*(&v8) = v10; v8[0]; *(&v8) = &v8[1]) { v22 = *((v8[0] * 2 + *(__ctype_b_loc()))) & 8; if (!v22 && v8[0] != 95 && v8[0] != 45 && v8[0] != 43) { if (v8[0] != 46) break; } } if (v8[1] == 46) *(&v8) = &v8[1]; if (v8 - v10 > 4) { v2 = v10[0]; v10[0] = 0; fputs(v0, *(&stdout)); v10[0] = v2; v2 = v8[0]; v8[0] = 0; if (v6 == 3) v27 = "ftp"; else v27 = &g_410206; printf("<A HREF=\"%s: v8[0] = v2; *(&v0) = v8; break; } else { v10[1 + 1] = 0; fputs(v0, *(&stdout)); *(&v0) = &v10[1 + 1]; v10[1 + 1] = 46; break; } case 4: break; case 5: *(&v10) = v16; v9 = &v10[2]; for (*(&v8) = v10; v8 > v0; *(&v8) = &v8[1]) { if (v8[1] == 59) break; } if (v8 != v0) { v1 = v8[0]; v8[0] = 0; fputs(v0, *(&stdout)); v8[0] = v1; *(v9) = 0; printf("<A HREF=\"file:/usr/include/%s\">%s</A>&gt;", v8, v8); *(&v0) = v10 + 1; break; } else { v10[5] = 0; fputs(v0, *(&stdout)); v10[5] = 59; *(&v0) = &v10[5]; break; } } v7 = 0; if (v11 && v0 > v11) v11 = strstr(&v0[1], ": if (v12 && v0 > v12) v12 = strchr(&v0[1], 0x40); if (v13 && v0 > v13) v13 = strstr(v0, "www."); if (v14 && v0 > v14) v14 = strstr(v0, "ftp."); if (v15 && v0 > v15) v15 = strchr(&v0[1], 0x28); if (v16 && v0 > v16) v16 = strstr(&v0[1], ".h&gt;"); for (v5 = 0; v5 <= 5; v5 += 1) { v7 += (&v11)[v5]; } } fputs(v0, *(&stdout)); v29 = *(&v17) ^ v28[5]; return; }
bash
angr_dream
pid_t xfork(void) { pid_t p = fork(); if (p == (pid_t)-1) call_arg_fatal("fork", gettext("child process")); return p; }
long long xfork() { unsigned int v0; v0 = fork(); if (v0 == -1) call_arg_fatal("fork", gettext("child process")); return v0; }
tar
angr_phoenix
static uintmax_t string_to_integer(_Bool count_lines, char const *n_string) { return xdectoumax(n_string, 0, (18446744073709551615UL), "bkKmMGTPEZY0", count_lines ? gettext("invalid number of lines") : gettext("invalid number of bytes"), 0); }
int string_to_integer(unsigned long a0, unsigned long long a1) { unsigned long long v1; if (!a0) { v1 = gettext("invalid number of bytes"); return xdectoumax(a1, 0x0, 0xffffffffffffffff, "bkKmMGTPEZY0", v1, 0x0); } v1 = gettext("invalid number of lines"); return xdectoumax(a1, 0x0, 0xffffffffffffffff, "bkKmMGTPEZY0", v1, 0x0); }
coreutils
angr_sailr
char *sh_mkdoublequoted(s, slen, flags) const char *s; int slen, flags; { char *r, *ret; const char *send; int rlen, mb_cur_max; mbstate_t state; memset(&state, '\0', sizeof(mbstate_t)); send = s + slen; mb_cur_max = flags ? (__ctype_get_mb_cur_max()) : 1; rlen = (flags == 0) ? slen + 3 : (2 * slen) + 1; ret = r = (char *)sh_xmalloc((rlen), "shquote.c", 195); *r++ = '"'; while (*s) { if (flags && *s == '"') *r++ = '\\'; if (flags && ((locale_utf8locale && (*s & 0x80)) || (locale_utf8locale == 0 && mb_cur_max > 1 && is_basic(*s) == 0))) { do { if (locale_mb_cur_max > 1) { mbstate_t state_bak; size_t mblength; int _k; _k = is_basic(*(s)); if (_k) mblength = 1; else if (locale_utf8locale && ((*(s) & 0x80) == 0)) mblength = *(s) != 0; else { state_bak = state; mblength = mbrlen((s), (send) - (s), &state); } if (mblength == (size_t)-2 || mblength == (size_t)-1) { state = state_bak; mblength = 1; } else mblength = (mblength < 1) ? 1 : mblength; for (_k = 0; _k < mblength; _k++) *(r)++ = *(s)++; } else *(r)++ = *(s)++; } while (0); continue; } *r++ = *s++; } *r++ = '"'; *r = '\0'; return ret; }
long long sh_mkdoublequoted(unsigned long long a0, unsigned int a1, unsigned long a2, unsigned long long a3, unsigned long long a4, unsigned long long a5) { char *v0; int tmp_18; int tmp_14; int tmp_10; unsigned int v1; unsigned int v2; unsigned int v3; char *v4; unsigned long long v5; char *v6; char *v7; unsigned long long v8; unsigned long long v9; unsigned int v11; char *v12; unsigned long long v13; char *v14; char *v15; unsigned long long v16; char *v17; v0 = a0; memset(&v8, 0x0, 0x8); v6 = v0; if (a2) v11 = __ctype_get_mb_cur_max(&v8, 0x0, 0x0, a3, a4, a5); else v11 = 1; v2 = v11; if (!a2) v11 = 3; else v11 = 1; v3 = v11; v4 = sh_xmalloc(v3, "shquote.c", 0xc3); v7 = v4; tmp_18 = v4; v4 += 1; *(tmp_18) = 34; while (*(v0)) { if (a2 && *(v0) == 34) { v12 = v4; v4 += 1; *(v12) = 92; } if (a2) { if (!locale_utf8locale && v2 > 1) v13 = is_basic(*(v0)); if ((*(v0) < 0 || !locale_utf8locale) && (!v13 || locale_utf8locale) && (v2 > 1 || locale_utf8locale)) { if (locale_mb_cur_max > 1) { v1 = is_basic(*(v0)); if (v1) { v5 = 1; } else { if (locale_utf8locale && *(v0) >= 0) v5 = *(v0); if (*(v0) < 0 || !locale_utf8locale) { v9 = v8; v5 = mbrlen(v0, v6 - v0, &v8, v6 - v0); } } if (v5 != -2 && v5 != -1) { if (v5) v16 = v5; else v16 = 1; v5 = v16; } if (v5 == -2 || v5 == -1) { v8 = v9; v5 = 1; } for (v1 = 0; v5 > v1; v1 += 1) { tmp_14 = v0; v0 += 1; v17 = v4; v4 += 1; *(v17) = *(tmp_14); } } else { tmp_10 = v0; v0 += 1; v15 = v4; v4 += 1; a2 = *(tmp_10); *(v15) = a2; continue; } } } if (!a2 || v2 <= 1 && !locale_utf8locale || !locale_utf8locale && v13 || *(v0) >= 0 && locale_utf8locale) { tmp_10 = v0; v0 += 1; v14 = v4; v4 += 1; a2 = *(tmp_10); *(v14) = a2; } } tmp_14 = v4; v4 += 1; *(tmp_14) = 34; *(v4) = 0; return v7; }
bash
angr_dream
static int pkg_array_match_patterns(struct pkg_array *array, pkg_array_visitor_func *pkg_visitor, void *pkg_data, const char *const *argv) { int argc, i, ip, *found; int rc = 0; struct pkg_spec *ps; for (argc = 0; argv[argc]; argc++) ; found = m_calloc(argc, sizeof(int)); ps = m_malloc(sizeof(*ps) * argc); for (ip = 0; ip < argc; ip++) { pkg_spec_init(&ps[ip], PKG_SPEC_PATTERNS | PKG_SPEC_ARCH_WILDCARD); pkg_spec_parse(&ps[ip], argv[ip]); } for (i = 0; i < array->n_pkgs; i++) { struct pkginfo *pkg; _Bool pkg_found = 0; pkg = array->pkgs[i]; for (ip = 0; ip < argc; ip++) { if (pkg_spec_match_pkg(&ps[ip], pkg, &pkg->installed)) { pkg_found = 1; found[ip]++; } } if (!pkg_found) array->pkgs[i] = ((void *)0); } pkg_array_foreach(array, pkg_visitor, pkg_data); for (ip = 0; ip < argc; ip++) { if (!found[ip]) { notice(gettext("no packages found matching %s"), argv[ip]); rc++; } pkg_spec_destroy(&ps[ip]); } free(ps); free(found); return rc; }
int pkg_array_match_patterns(struct_0 *a0, unsigned long long a1, unsigned long long a2, unsigned long long *a3) { char v0; unsigned int v1; unsigned int v2; unsigned int v3; unsigned int v4; unsigned int *v5; void *v6; unsigned long long v7; v4 = 0; for (v1 = 0; a3[v1]; v1 += 1) ; v5 = m_calloc(v1, 0x4); v6 = m_malloc(v1 * 40); for (v3 = 0; v3 < v1; v3 += 1) { pkg_spec_init(v6 + v3 * 40, 0x201, v3 * 40); pkg_spec_parse(v6 + v3 * 40, a3[v3], v3 * 40, a3[v3]); } for (v2 = 0; v2 < a0->field_0; v2 += 1) { v0 = 0; v7 = *((a0->field_8 + v2 * 8)); for (v3 = 0; v3 < v1; v3 += 1) { if (pkg_spec_match_pkg(((v3 << 2) + v3 << 3) + v6, v7, v7 + 72, ((v3 << 2) + v3 << 3) + v6)) { v0 = 1; v5[v3] = v5[v3] + 1; } } if ((v0 ^ 1)) *((a0->field_8 + v2 * 8)) = 0; } pkg_array_foreach(a0, a1, a2, a1); for (v3 = 0; v3 < v1; v3 += 1) { if (!v5[v3]) { notice(gettext("no packages found matching %s"), a3[v3]); v4 += 1; } pkg_spec_destroy(v6 + v3 * 40); } free(v6); free(v5); return v4; }
dpkg
angr_phoenix
static void ipstats_enabled_free(struct ipstats_stat_enabled *enabled) { free(enabled->enabled); }
void ipstats_enabled_free(void **param_1) { free(*param_1); return; }
iproute2-6.0.0
ghidra
inline _Bool c_isalnum(int c) { switch (c) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': case 'a' + (0): case 'b' + (0): case 'c' + (0): case 'd' + (0): case 'e' + (0): case 'f' + (0): case 'g' + (0): case 'h' + (0): case 'i' + (0): case 'j' + (0): case 'k' + (0): case 'l' + (0): case 'm' + (0): case 'n' + (0): case 'o' + (0): case 'p' + (0): case 'q' + (0): case 'r' + (0): case 's' + (0): case 't' + (0): case 'u' + (0): case 'v' + (0): case 'w' + (0): case 'x' + (0): case 'y' + (0): case 'z' + (0): case 'a' + ('A' - 'a'): case 'b' + ('A' - 'a'): case 'c' + ('A' - 'a'): case 'd' + ('A' - 'a'): case 'e' + ('A' - 'a'): case 'f' + ('A' - 'a'): case 'g' + ('A' - 'a'): case 'h' + ('A' - 'a'): case 'i' + ('A' - 'a'): case 'j' + ('A' - 'a'): case 'k' + ('A' - 'a'): case 'l' + ('A' - 'a'): case 'm' + ('A' - 'a'): case 'n' + ('A' - 'a'): case 'o' + ('A' - 'a'): case 'p' + ('A' - 'a'): case 'q' + ('A' - 'a'): case 'r' + ('A' - 'a'): case 's' + ('A' - 'a'): case 't' + ('A' - 'a'): case 'u' + ('A' - 'a'): case 'v' + ('A' - 'a'): case 'w' + ('A' - 'a'): case 'x' + ('A' - 'a'): case 'y' + ('A' - 'a'): case 'z' + ('A' - 'a'): return 1; default: return 0; } }
void c_isalnum(void) { halt_baddata(); }
coreutils
ghidra
static int vrf_configure_cgroup(const char *path, int ifindex) { int rc = -1, cg_fd, prog_fd = -1; cg_fd = open(path, 0200000 | 00); if (cg_fd < 0) { fprintf(stderr, "Failed to open cgroup path: '%s'\n", strerror((*__errno_location()))); goto out; } prog_fd = prog_load(ifindex); if (prog_fd < 0) { fprintf(stderr, "Failed to load BPF prog: '%s'\n%s", strerror((*__errno_location())), bpf_log_buf); if ((*__errno_location()) != 1) { fprintf(stderr, "Kernel compiled with CGROUP_BPF enabled?\n"); } goto out; } if (bpf_program_attach(prog_fd, cg_fd, BPF_CGROUP_INET_SOCK_CREATE)) { fprintf(stderr, "Failed to attach prog to cgroup: '%s'\n", strerror((*__errno_location()))); goto out; } rc = 0; out: close(cg_fd); close(prog_fd); return rc; }
int vrf_configure_cgroup(char *a0, unsigned long a1, unsigned long a2) { unsigned int v0; unsigned int v1; unsigned int v2; v0 = -1; v1 = -1; v2 = open64(a0, 0x10000, a2); if (v2 < 0) { fprintf(*(&stderr), "Failed to open cgroup path: '%s'\n", strerror(*(__errno_location()))); } else { v1 = prog_load(a1); if (v1 < 0) { fprintf(*(&stderr), "Failed to load BPF prog: '%s'\n%s", strerror(*(__errno_location())), &bpf_log_buf); if (*(__errno_location()) != 1) fprintf(*(&stderr), "Kernel compiled with CGROUP_BPF enabled?\n"); } else if (bpf_program_attach(v1, v2, 0x2, v2)) { fprintf(*(&stderr), "Failed to attach prog to cgroup: '%s'\n", strerror(*(__errno_location()))); } else { v0 = 0; } } close(v2); close(v1); return v0; }
iproute2-6.0.0
angr_dream
const char *directory_contents(struct directory *dir) { if (!dir) return ((void *)0); return dir->dump ? dir->dump->contents : ((void *)0); }
int directory_contents(struct_0 *a0) { unsigned int v1; if (!a0) { v1 = 0; } else if (a0->field_28) { v1 = a0->field_28->field_0; } else { v1 = 0; } return v1; }
tar
angr_dream
, "mkstemp: %s", strerror( (*__errno_location ()) )); goto out; } if (atomicio((ssize_t (*)(int, void *, size_t))write, fd, sshbuf_mutable_ptr(info), sshbuf_len(info)) != sshbuf_len(info)) { sshlog("session.c", __func__, 276, 1, SYSLOG_LEVEL_ERROR, ((void *)0), "write: %s", strerror((*__errno_location()))); goto out; }
char *strerror(int __errnum) { halt_baddata(); }
openssh-portable
ghidra
static void print_encap_seg6local(FILE *fp, struct rtattr *encap) { struct rtattr *tb[(__SEG6_LOCAL_MAX - 1) + 1]; int action; char b1[64]; (parse_rtattr_flags( (tb), ((__SEG6_LOCAL_MAX - 1)), ((void *)(((char *)(encap)) + ((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0)))), ((int)((encap)->rta_len) - ((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0))), (1 << 15))); if (!tb[SEG6_LOCAL_ACTION]) return; action = rta_getattr_u32(tb[SEG6_LOCAL_ACTION]); print_string(PRINT_ANY, "action", "action %s ", format_action_type(action)); if (tb[SEG6_LOCAL_SRH]) { open_json_object("srh"); print_srh(fp, ((void *)(((char *)(tb[SEG6_LOCAL_SRH])) + ((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0))))); close_json_object(); } if (tb[SEG6_LOCAL_TABLE]) print_string(PRINT_ANY, "table", "table %s ", rtnl_rttable_n2a(rta_getattr_u32(tb[SEG6_LOCAL_TABLE]), b1, sizeof(b1))); if (tb[SEG6_LOCAL_VRFTABLE]) print_string(PRINT_ANY, "vrftable", "vrftable %s ", rtnl_rttable_n2a(rta_getattr_u32(tb[SEG6_LOCAL_VRFTABLE]), b1, sizeof(b1))); if (tb[SEG6_LOCAL_NH4]) { print_string( PRINT_ANY, "nh4", "nh4 %s ", rt_addr_n2a( 2, ((int)((tb[SEG6_LOCAL_NH4])->rta_len) - ((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0))), ((void *)(((char *)(tb[SEG6_LOCAL_NH4])) + ((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0)))))); } if (tb[SEG6_LOCAL_NH6]) { print_string( PRINT_ANY, "nh6", "nh6 %s ", rt_addr_n2a( 10, ((int)((tb[SEG6_LOCAL_NH6])->rta_len) - ((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0))), ((void *)(((char *)(tb[SEG6_LOCAL_NH6])) + ((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0)))))); } if (tb[SEG6_LOCAL_IIF]) { int iif = rta_getattr_u32(tb[SEG6_LOCAL_IIF]); print_string(PRINT_ANY, "iif", "iif %s ", ll_index_to_name(iif)); } if (tb[SEG6_LOCAL_OIF]) { int oif = rta_getattr_u32(tb[SEG6_LOCAL_OIF]); print_string(PRINT_ANY, "oif", "oif %s ", ll_index_to_name(oif)); } if (tb[SEG6_LOCAL_BPF]) print_encap_bpf_prog(fp, tb[SEG6_LOCAL_BPF], "endpoint"); if (tb[SEG6_LOCAL_COUNTERS] && show_stats) print_seg6_local_counters(fp, tb[SEG6_LOCAL_COUNTERS]); }
unsigned long print_encap_seg6local(FILE *a1, unsigned short *a2) { const char *v2; unsigned int v3; long v4; unsigned int v5; long v6; long v7; long v8; long v9; long v10; unsigned int v12; unsigned int v13; unsigned int v14; char v15[8]; long v16; long v17; long v18; unsigned short *v19; unsigned short *v20; long v21; long v22; unsigned short *v23; long v24; unsigned short *v25; char v26[72]; unsigned long v27; v27 = __readfsqword(0x28u); parse_rtattr_flags(v15, 10LL, a2 + 2, (unsigned int)*a2 - 4, 0x8000LL); if (v16) { v12 = rta_getattr_u32(v16); v2 = format_action_type(v12); print_string(4u, (long)"action", "action %s ", (long)v2); if (v17) { open_json_object("srh"); print_srh(a1, (unsigned char *)(v17 + 4)); close_json_object(a1); } if (v18) { v3 = rta_getattr_u32(v18); v4 = rtnl_rttable_n2a(v3, v26, 64LL); print_string(4u, (long)"table", "table %s ", v4); } if (v24) { v5 = rta_getattr_u32(v24); v6 = rtnl_rttable_n2a(v5, v26, 64LL); print_string(4u, (long)"vrftable", "vrftable %s ", v6); } if (v19) { v7 = rt_addr_n2a(2LL, (unsigned int)*v19 - 4, v19 + 2); print_string(4u, (long)"nh4", "nh4 %s ", v7); } if (v20) { v8 = rt_addr_n2a(10LL, (unsigned int)*v20 - 4, v20 + 2); print_string(4u, (long)"nh6", "nh6 %s ", v8); } if (v21) { v13 = rta_getattr_u32(v21); v9 = ll_index_to_name(v13); print_string(4u, (long)"iif", "iif %s ", v9); } if (v22) { v14 = rta_getattr_u32(v22); v10 = ll_index_to_name(v14); print_string(4u, (long)"oif", "oif %s ", v10); } if (v23) print_encap_bpf_prog(a1, v23, "endpoint"); if (v25 && show_stats) print_seg6_local_counters((long)a1, v25); } return __readfsqword(0x28u) ^ v27; }
iproute2-6.0.0
ida
terminal_deletechars(EditLine *el, int num) { if (num <= 0) return; if (!((el)->el_terminal.t_flags & 0x002)) { return; } if (num > el->el_terminal.t_size.h) { return; } if ((el->el_terminal.t_str[30] != ((void *)0) && el->el_terminal.t_str[30][0] != '\0')) if ((num > 1) || !(el->el_terminal.t_str[6] != ((void *)0) && el->el_terminal.t_str[6][0] != '\0')) { terminal_tputs(el, tgoto(el->el_terminal.t_str[30], num, num), num); return; } if ((el->el_terminal.t_str[8] != ((void *)0) && el->el_terminal.t_str[8][0] != '\0')) terminal_tputs(el, el->el_terminal.t_str[8], 1); if ((el->el_terminal.t_str[6] != ((void *)0) && el->el_terminal.t_str[6][0] != '\0')) while (num--) terminal_tputs(el, el->el_terminal.t_str[6], 1); if ((el->el_terminal.t_str[9] != ((void *)0) && el->el_terminal.t_str[9][0] != '\0')) terminal_tputs(el, el->el_terminal.t_str[9], 1); }
long long terminal_deletechars(struct_0 *a0, unsigned long a1) { unsigned int v0; int tmp_9; char *v2; v0 = a1; if (v0 <= 0) return v2; v2 = a0->field_98 & 2; if (!(a0->field_98 & 2)) return v2; v2 = a0->field_90; if (v0 > a0->field_90) return v2; if (a0->field_b0->field_f0 && *(a0->field_b0->field_f0) && (!(v0 <= 1) || !(a0->field_b0->field_30) || !(*(a0->field_b0->field_30)))) { v2 = terminal_tputs(a0, tgoto(a0->field_b0->field_f0, v0, v0, v0), v0); return v2; } if (a0->field_b0->field_40 && *(a0->field_b0->field_40)) terminal_tputs(a0, a0->field_b0->field_40, 0x1); if (a0->field_b0->field_30 && *(a0->field_b0->field_30)) { while (true) { tmp_9 = v0; v0 -= 1; if (!tmp_9) break; terminal_tputs(a0, a0->field_b0->field_30, 0x1); } } v2 = a0->field_b0->field_48; if (!a0->field_b0->field_48) return v2; v2 = *(a0->field_b0->field_48); if (*(a0->field_b0->field_48)) { v2 = terminal_tputs(a0, a0->field_b0->field_48, 0x1); return v2; } return v2; }
libedit
angr_sailr
static _Bool pipe_bytes(char const *pretty_filename, int fd, uintmax_t n_bytes, uintmax_t *read_pos) { struct charbuffer { char buffer[8192]; size_t nbytes; struct charbuffer *next; }; typedef struct charbuffer CBUFFER; CBUFFER *first, *last, *tmp; size_t i; size_t total_bytes = 0; _Bool ok = 1; size_t n_read; first = last = xmalloc(sizeof(CBUFFER)); first->nbytes = 0; first->next = ((void *)0); tmp = xmalloc(sizeof(CBUFFER)); while (1) { n_read = safe_read(fd, tmp->buffer, 8192); if (n_read == 0 || n_read == ((size_t)-1)) break; *read_pos += n_read; tmp->nbytes = n_read; tmp->next = ((void *)0); total_bytes += tmp->nbytes; if (tmp->nbytes + last->nbytes < 8192) { memcpy(&last->buffer[last->nbytes], tmp->buffer, tmp->nbytes); last->nbytes += tmp->nbytes; } else { last = last->next = tmp; if (total_bytes - first->nbytes > n_bytes) { tmp = first; total_bytes -= first->nbytes; first = first->next; } else { tmp = xmalloc(sizeof(CBUFFER)); } } } free(tmp); if (n_read == ((size_t)-1)) { error(0, (*__errno_location()), gettext("error reading %s"), quotearg_style(shell_escape_always_quoting_style, pretty_filename)); ok = 0; goto free_cbuffers; } for (tmp = first; total_bytes - tmp->nbytes > n_bytes; tmp = tmp->next) total_bytes -= tmp->nbytes; if (total_bytes > n_bytes) i = total_bytes - n_bytes; else i = 0; xwrite_stdout(&tmp->buffer[i], tmp->nbytes - i); for (tmp = tmp->next; tmp; tmp = tmp->next) xwrite_stdout(tmp->buffer, tmp->nbytes); free_cbuffers: while (first) { tmp = first->next; free(first); first = tmp; } return ok; }
undefined pipe_bytes(undefined8 param_1, undefined4 param_2, ulong param_3, long *param_4) { long *plVar1; void *pvVar2; long lVar3; undefined8 uVar4; undefined8 uVar5; int *piVar6; undefined local_49; void *local_48; void *local_40; void *local_38; long local_30; ulong local_28; local_28 = 0; local_49 = 1; local_48 = (void *)xmalloc(0x2010); *(undefined8 *)((long)local_48 + 0x2000) = 0; *(undefined8 *)((long)local_48 + 0x2008) = 0; local_38 = (void *)xmalloc(0x2010); local_40 = local_48; while ((lVar3 = safe_read(param_2, local_38, 0x2000), lVar3 != 0 && (lVar3 != -1))) { *param_4 = *param_4 + lVar3; *(long *)((long)local_38 + 0x2000) = lVar3; *(undefined8 *)((long)local_38 + 0x2008) = 0; local_28 = local_28 + *(long *)((long)local_38 + 0x2000); if ((ulong)(*(long *)((long)local_40 + 0x2000) + *(long *)((long)local_38 + 0x2000)) < 0x2000) { memcpy((void *)((long)local_40 + *(long *)((long)local_40 + 0x2000)), local_38, *(size_t *)((long)local_38 + 0x2000)); *(long *)((long)local_40 + 0x2000) = *(long *)((long)local_40 + 0x2000) + *(long *)((long)local_38 + 0x2000); } else { *(void **)((long)local_40 + 0x2008) = local_38; local_40 = *(void **)((long)local_40 + 0x2008); if (param_3 < local_28 - *(long *)((long)local_48 + 0x2000)) { local_38 = local_48; local_28 = local_28 - *(long *)((long)local_48 + 0x2000); local_48 = *(void **)((long)local_48 + 0x2008); } else { local_38 = (void *)xmalloc(); } } } free(local_38); if (lVar3 == -1) { uVar4 = quotearg_style(4, param_1); uVar5 = gettext("error reading %s"); piVar6 = __errno_location(); error(0, *piVar6, uVar5, uVar4); local_49 = 0; } else { local_38 = local_48; for (; param_3 < local_28 - *(long *)((long)local_38 + 0x2000); local_28 = local_28 - *plVar1) { plVar1 = (long *)((long)local_38 + 0x2000); local_38 = *(void **)((long)local_38 + 0x2008); } if (param_3 < local_28) { local_30 = local_28 - param_3; } else { local_30 = 0; } xwrite_stdout(local_30 + (long)local_38, *(long *)((long)local_38 + 0x2000) - local_30); for (local_38 = *(void **)((long)local_38 + 0x2008); local_38 != (void *)0x0; local_38 = *(void **)((long)local_38 + 0x2008)) { xwrite_stdout(local_38, *(undefined8 *)((long)local_38 + 0x2000)); } } while (local_48 != (void *)0x0) { pvVar2 = *(void **)((long)local_48 + 0x2008); free(local_48); local_48 = pvVar2; } return local_49; }
coreutils
ghidra
inline unsigned char to_uchar(char ch) { return ch; }
void to_uchar(void) { halt_baddata(); }
grep
ghidra
static struct dns_query *parse_dns_qsection(const u_char *answer, int size, const u_char **cp, int count) { struct dns_query *head, *curr, *prev; int i, length; char name[1025]; for (i = 1, head = ((void *)0), prev = ((void *)0); i <= count; i++, prev = curr) { curr = calloc(1, sizeof(struct dns_query)); if (curr == ((void *)0)) { free_dns_query(head); return (((void *)0)); } if (head == ((void *)0)) head = curr; if (prev != ((void *)0)) prev->next = curr; length = dn_expand(answer, answer + size, *cp, name, sizeof(name)); if (length < 0) { free_dns_query(head); return (((void *)0)); } curr->name = strdup(name); if (curr->name == ((void *)0)) { free_dns_query(head); return (((void *)0)); } *cp += length; curr->type = (_ssh_compat_getshort(*cp)); *cp += 2; curr->class = (_ssh_compat_getshort(*cp)); *cp += 2; } return (head); }
_WORD *parse_dns_qsection(long a1, int a2, unsigned short **a3, int a4) { int v7; int v8; long v9; _WORD *v10; _WORD *v11; char s[1032]; unsigned long v13; v13 = __readfsqword(0x28u); v7 = 1; v9 = 0LL; v10 = 0LL; while (v7 <= a4) { v11 = calloc(1uLL, 0x18uLL); if (!v11) goto LABEL_10; if (!v9) v9 = (long)v11; if (v10) *((_QWORD *)v10 + 2) = v11; v8 = dn_expand(a1, a2 + a1, *a3, s, 1025LL); if (v8 < 0 || (*(_QWORD *)v11 = strdup(s)) == 0LL) { LABEL_10: free_dns_query(v9); return 0LL; } *a3 = (unsigned short *)((char *)*a3 + v8); v11[4] = ssh_compat_getshort(*a3); v11[5] = ssh_compat_getshort(++*a3); ++*a3; ++v7; v10 = v11; } return (_WORD *)v9; }
openssh-portable
ida
static void exit_cleanup(void) { if (temphead) { struct cs_status cs; cs_enter(&cs); cleanup(); cs_leave(&cs); } close_stdout(); }
long long exit_cleanup() { char v0; if (temphead) { cs_enter(&v0); cleanup(); cs_leave(&v0); } close_stdout(); return 0; }
coreutils
angr_phoenix
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]... [FILE]...\n or: %s [-abcdfilosx]... " "[FILE] [[+]OFFSET[.][b]]\n or: %s --traditional [OPTION]... " "[FILE] [[+]OFFSET[.][b] [+][LABEL][.][b]]\n") , program_name, program_name, program_name); fputs_unlocked(gettext("\nWrite an unambiguous representation, octal bytes " "by default,\nof FILE to standard output. With " "more than one FILE argument,\nconcatenate them in " "the listed order to form the input.\n"), stdout) ; emit_stdin_note(); fputs_unlocked( gettext("\nIf first and second call formats both apply, the second " "format is assumed\nif the last operand begins with + or (if " "there are 2 operands) a digit.\nAn OFFSET operand means -j " "OFFSET. LABEL is the pseudo-address\nat first byte printed, " "incremented when dump is progressing.\nFor OFFSET and LABEL, " "a 0x or 0X prefix indicates hexadecimal;\nsuffixes may be . " "for octal and b for multiply by 512.\n"), stdout) ; emit_mandatory_arg_note(); fputs_unlocked( gettext(" -A, --address-radix=RADIX output format for file offsets; " "RADIX is one\n of [doxn], for " "Decimal, Octal, Hex or None\n --endian={big|little} " "swap input bytes according the specified order\n -j, " "--skip-bytes=BYTES skip BYTES input bytes first\n"), stdout) ; fputs_unlocked( gettext( " -N, --read-bytes=BYTES limit dump to BYTES input bytes\n " "-S BYTES, --strings[=BYTES] output strings of at least BYTES " "graphic chars;\n 3 is implied when " "BYTES is not specified\n -t, --format=TYPE select " "output format or formats\n -v, --output-duplicates do not " "use * to mark line suppression\n -w[BYTES], --width[=BYTES] " "output BYTES bytes per output line;\n " " 32 is implied when BYTES is not specified\n --traditional " " accept arguments in third form above\n"), stdout); fputs_unlocked(gettext(" --help display this help and exit\n"), stdout); fputs_unlocked( gettext(" --version output version information and exit\n"), stdout); fputs_unlocked( gettext("\n\nTraditional format specifications may be intermixed; they " "accumulate:\n -a same as -t a, select named characters, " "ignoring high-order bit\n -b same as -t o1, select octal " "bytes\n -c same as -t c, select printable characters or " "backslash escapes\n -d same as -t u2, select unsigned " "decimal 2-byte units\n"), stdout) ; fputs_unlocked( gettext(" -f same as -t fF, select floats\n -i same as -t dI, " "select decimal ints\n -l same as -t dL, select decimal " "longs\n -o same as -t o2, select octal 2-byte units\n -s " " same as -t d2, select decimal 2-byte units\n -x same as " "-t x2, select hexadecimal 2-byte units\n"), stdout) ; fputs_unlocked( gettext("\n\nTYPE is made up of one or more of these specifications:\n " " a named character, ignoring high-order bit\n c " " printable character or backslash escape\n"), stdout) ; fputs_unlocked( gettext( " d[SIZE] signed decimal, SIZE bytes per integer\n f[SIZE] " "floating point, SIZE bytes per float\n o[SIZE] octal, SIZE " "bytes per integer\n u[SIZE] unsigned decimal, SIZE bytes per " "integer\n x[SIZE] hexadecimal, SIZE bytes per integer\n"), stdout) ; fputs_unlocked(gettext("\nSIZE is a number. For TYPE in [doux], SIZE may " "also be C for\nsizeof(char), S for sizeof(short), " "I for sizeof(int) or L for\nsizeof(long). If TYPE " "is f, SIZE may also be F for sizeof(float), D\nfor " "sizeof(double) or L for sizeof(long double).\n"), stdout) ; fputs_unlocked(gettext("\nAdding a z suffix to any type displays printable " "characters at the end of\neach output line.\n"), stdout) ; fputs_unlocked( gettext( "\n\nBYTES is hex with 0x or 0X prefix, and may have a multiplier " "suffix:\n b 512\n KB 1000\n K 1024\n MB 1000*1000\n " " M 1024*1024\nand so on for G, T, P, E, Z, Y.\nBinary prefixes " "can be used, too: KiB=K, MiB=M, and so on.\n"), stdout); emit_ancillary_info("od"); } exit(status); }
void usage(unsigned long a0) { unsigned long v0; unsigned long v1; unsigned long v2; unsigned long v4; unsigned long v5; unsigned long v6; v2 = v4; v1 = v5; v0 = v6; if (a0) { fprintf(stderr, gettext("Try '%s --help' for more information.\n")); } else { printf( gettext("Usage: %s [OPTION]... [FILE]...\n or: %s [-abcdfilosx]... " "[FILE] [[+]OFFSET[.][b]]\n or: %s --traditional [OPTION]... " "[FILE] [[+]OFFSET[.][b] [+][LABEL][.][b]]\n")); fputs_unlocked(gettext("\nWrite an unambiguous representation, octal bytes " "by default,\nof FILE to standard output. With " "more than one FILE argument,\nconcatenate them in " "the listed order to form the input.\n"), stdout); emit_stdin_note(); fputs_unlocked( gettext("\nIf first and second call formats both apply, the second " "format is assumed\nif the last operand begins with + or (if " "there are 2 operands) a digit.\nAn OFFSET operand means -j " "OFFSET. LABEL is the pseudo-address\nat first byte printed, " "incremented when dump is progressing.\nFor OFFSET and LABEL, " "a 0x or 0X prefix indicates hexadecimal;\nsuffixes may be . " "for octal and b for multiply by 512.\n"), stdout); emit_mandatory_arg_note(); fputs_unlocked( gettext(" -A, --address-radix=RADIX output format for file offsets; " "RADIX is one\n of [doxn], for " "Decimal, Octal, Hex or None\n --endian={big|little} " "swap input bytes according the specified order\n -j, " "--skip-bytes=BYTES skip BYTES input bytes first\n"), stdout); fputs_unlocked( gettext( " -N, --read-bytes=BYTES limit dump to BYTES input bytes\n " "-S BYTES, --strings[=BYTES] output strings of at least BYTES " "graphic chars;\n 3 is implied when " "BYTES is not specified\n -t, --format=TYPE select " "output format or formats\n -v, --output-duplicates do not " "use * to mark line suppression\n -w[BYTES], --width[=BYTES] " "output BYTES bytes per output line;\n " " 32 is implied when BYTES is not specified\n --traditional " " accept arguments in third form above\n"), stdout); fputs_unlocked(gettext(" --help display this help and exit\n"), stdout); fputs_unlocked( gettext(" --version output version information and exit\n"), stdout); fputs_unlocked( gettext("\n\nTraditional format specifications may be intermixed; they " "accumulate:\n -a same as -t a, select named characters, " "ignoring high-order bit\n -b same as -t o1, select octal " "bytes\n -c same as -t c, select printable characters or " "backslash escapes\n -d same as -t u2, select unsigned " "decimal 2-byte units\n"), stdout); fputs_unlocked( gettext(" -f same as -t fF, select floats\n -i same as -t dI, " "select decimal ints\n -l same as -t dL, select decimal " "longs\n -o same as -t o2, select octal 2-byte units\n -s " " same as -t d2, select decimal 2-byte units\n -x same as " "-t x2, select hexadecimal 2-byte units\n"), stdout); fputs_unlocked( gettext("\n\nTYPE is made up of one or more of these specifications:\n " " a named character, ignoring high-order bit\n c " " printable character or backslash escape\n"), stdout); fputs_unlocked( gettext( " d[SIZE] signed decimal, SIZE bytes per integer\n f[SIZE] " "floating point, SIZE bytes per float\n o[SIZE] octal, SIZE " "bytes per integer\n u[SIZE] unsigned decimal, SIZE bytes per " "integer\n x[SIZE] hexadecimal, SIZE bytes per integer\n"), stdout); fputs_unlocked(gettext("\nSIZE is a number. For TYPE in [doux], SIZE may " "also be C for\nsizeof(char), S for sizeof(short), " "I for sizeof(int) or L for\nsizeof(long). If TYPE " "is f, SIZE may also be F for sizeof(float), D\nfor " "sizeof(double) or L for sizeof(long double).\n"), stdout); fputs_unlocked(gettext("\nAdding a z suffix to any type displays printable " "characters at the end of\neach output line.\n"), stdout); fputs_unlocked( gettext( "\n\nBYTES is hex with 0x or 0X prefix, and may have a multiplier " "suffix:\n b 512\n KB 1000\n K 1024\n MB 1000*1000\n " " M 1024*1024\nand so on for G, T, P, E, Z, Y.\nBinary prefixes " "can be used, too: KiB=K, MiB=M, and so on.\n"), stdout); emit_ancillary_info("od"); } exit(a0); }
coreutils
angr_dream
const char *get_history_event(const char *cmd, int *cindex, int qchar) { int idx, sign, sub, num, begin, ret; size_t len; char *pat; const char *rptr; HistEvent ev; idx = *cindex; if (cmd[idx++] != history_expansion_char) return ((void *)0); if (cmd[idx] == history_expansion_char || cmd[idx] == '\0') { if (history(h, &ev, 3) != 0) return ((void *)0); *cindex = cmd[idx] ? (idx + 1) : idx; return ev.str; } sign = 0; if (cmd[idx] == '-') { sign = 1; idx++; } if ('0' <= cmd[idx] && cmd[idx] <= '9') { HIST_ENTRY *he; num = 0; while (cmd[idx] && '0' <= cmd[idx] && cmd[idx] <= '9') { num = num * 10 + cmd[idx] - '0'; idx++; } if (sign) num = history_length - num + history_base; if (!(he = history_get(num))) return ((void *)0); *cindex = idx; return he->line; } sub = 0; if (cmd[idx] == '?') { sub = 1; idx++; } begin = idx; while (cmd[idx]) { if (cmd[idx] == '\n') break; if (sub && cmd[idx] == '?') break; if (!sub && (cmd[idx] == ':' || cmd[idx] == ' ' || cmd[idx] == '\t' || cmd[idx] == qchar)) break; idx++; } len = (size_t)idx - (size_t)begin; if (sub && cmd[idx] == '?') idx++; if (sub && len == 0 && last_search_pat && *last_search_pat) pat = last_search_pat; else if (len == 0) return ((void *)0); else { if ((pat = calloc(len + 1, sizeof(*pat))) == ((void *)0)) return ((void *)0); (void)strlcpy(pat, cmd + begin, len + 1); } if (history(h, &ev, 8) != 0) { if (pat != last_search_pat) free(pat); return ((void *)0); } num = ev.num; if (sub) { if (pat != last_search_pat) { free(last_search_pat); last_search_pat = pat; } ret = history_search(pat, -1); } else ret = history_search_prefix(pat, -1); if (ret == -1) { history(h, &ev, 3); (void)fprintf(rl_outstream, "%s: Event not found\n", pat); if (pat != last_search_pat) free(pat); return ((void *)0); } if (sub && len) { free(last_search_match); last_search_match = strdup(pat); } if (pat != last_search_pat) free(pat); if (history(h, &ev, 8) != 0) return ((void *)0); *cindex = idx; rptr = ev.str; (void)history(h, &ev, 7, num); return rptr; }
undefined8 get_history_event(long param_1, int *param_2, int param_3) { int iVar1; undefined8 uVar2; undefined8 *puVar3; void *pvVar4; long lVar5; long in_FS_OFFSET; bool bVar6; int local_60; int local_54; undefined local_28[24]; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); iVar1 = *param_2; local_60 = iVar1 + 1; if (*(char *)(param_1 + iVar1) == *pcRam0000000000100e72) { if ((*(char *)(param_1 + local_60) == *pcRam0000000000100e9a) || (*(char *)(param_1 + local_60) == '\0')) { history(h, local_28, 3); } bVar6 = *(char *)(param_1 + local_60) == '-'; if (bVar6) { local_60 = iVar1 + 2; } if ((*(char *)(param_1 + local_60) < '0') || ('9' < *(char *)(param_1 + local_60))) { bVar6 = *(char *)(param_1 + local_60) == '?'; iVar1 = local_60; if (bVar6) { local_60 = local_60 + 1; iVar1 = local_60; } while ((((*(char *)(param_1 + local_60) != '\0' && (*(char *)(param_1 + local_60) != '\n')) && ((!bVar6 || (*(char *)(param_1 + local_60) != '?')))) && ((bVar6 || ((((*(char *)(param_1 + local_60) != ':' && (*(char *)(param_1 + local_60) != ' ')) && (*(char *)(param_1 + local_60) != '\t')) && (param_3 != *(char *)(param_1 + local_60)))))))) { local_60 = local_60 + 1; } lVar5 = (long)local_60 - (long)iVar1; if (((bVar6) && (lVar5 == 0)) && ((last_search_pat != (char *)0x0 && (*last_search_pat != '\0')))) { LAB_001011d4: history(h, local_28, 8); } if (lVar5 == 0) { uVar2 = 0; } else { pvVar4 = calloc(lVar5 + 1, 1); if (pvVar4 != (void *)0x0) { strlcpy(pvVar4, iVar1 + param_1, lVar5 + 1); goto LAB_001011d4; } uVar2 = 0; } } else { local_54 = 0; for (; ((*(char *)(param_1 + local_60) != '\0' && ('/' < *(char *)(param_1 + local_60))) && (*(char *)(param_1 + local_60) < ':')); local_60 = local_60 + 1) { local_54 = (int)*(char *)(param_1 + local_60) + local_54 * 10 + -0x30; } if (bVar6) { local_54 = *piRam0000000000100ff4 + (*piRam0000000000100fe6 - local_54); } puVar3 = (undefined8 *)history_get(local_54); if (puVar3 == (undefined8 *)0x0) { uVar2 = 0; } else { *param_2 = local_60; uVar2 = *puVar3; } } } else { uVar2 = 0; } if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) { __stack_chk_fail(); } return uVar2; }
libedit
ghidra
static int mux_client_write_packet(int fd, struct sshbuf *m) { struct sshbuf *queue; u_int have, need; int r, oerrno, len; const u_char *ptr; struct pollfd pfd; pfd.fd = fd; pfd.events = 0x004; if ((queue = sshbuf_new()) == ((void *)0)) sshfatal("mux.c", __func__, 1501, 1, SYSLOG_LEVEL_FATAL, ((void *)0), "sshbuf_new"); if ((r = sshbuf_put_stringb(queue, m)) != 0) sshfatal("mux.c", __func__, 1503, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "enqueue"); need = sshbuf_len(queue); ptr = sshbuf_ptr(queue); for (have = 0; have < need;) { if (muxclient_terminate) { sshbuf_free(queue); (*__errno_location()) = 4; return -1; } len = write(fd, ptr + have, need - have); if (len == -1) { switch ((*__errno_location())) { case 11: (void)poll(&pfd, 1, -1); case 4: continue; default: oerrno = (*__errno_location()); sshbuf_free(queue); (*__errno_location()) = oerrno; return -1; } } if (len == 0) { sshbuf_free(queue); (*__errno_location()) = 32; return -1; } have += (u_int)len; } sshbuf_free(queue); return 0; }
undefined8 mux_client_write_packet(int param_1, undefined8 param_2) { undefined8 uVar1; int *piVar2; ssize_t sVar3; char **ppcVar4; undefined *puVar5; long in_FS_OFFSET; char *apcStack128[6]; int local_4c; uint local_3c; int local_38; uint local_34; int local_30; int local_2c; long local_28; long local_20; pollfd local_18; long local_10; ppcVar4 = apcStack128 + 5; local_10 = *(long *)(in_FS_OFFSET + 0x28); local_18.events = 4; apcStack128[4] = (char *)0x104d10; apcStack128[5] = (char *)param_2; local_4c = param_1; local_18.fd = param_1; local_28 = sshbuf_new(); if (local_28 == 0) { ppcVar4 = apcStack128 + 3; apcStack128[3] = "sshbuf_new"; sshfatal("mux.c", "mux_client_write_packet", 0x5dd, 1, 1, 0); } *(undefined8 *)((long)ppcVar4 + -8) = 0x104d68; local_38 = sshbuf_put_stringb(local_28); puVar5 = (undefined *)ppcVar4; if (local_38 != 0) { *(undefined8 *)((long)ppcVar4 + -8) = 0x104d7b; uVar1 = ssh_err(local_38); puVar5 = (undefined *)((long)ppcVar4 + -0x10); *(char **)((long)ppcVar4 + -0x10) = "enqueue"; *(undefined8 *)((long)ppcVar4 + -0x18) = 0x104db2; sshfatal("mux.c", "mux_client_write_packet", 0x5df, 1, 1, uVar1); } *(undefined8 *)(puVar5 + -8) = 0x104dbe; local_34 = sshbuf_len(local_28); *(undefined8 *)(puVar5 + -8) = 0x104dcd; local_20 = sshbuf_ptr(); local_3c = 0; do { if (local_34 <= local_3c) { *(undefined8 *)(puVar5 + -8) = 0x104ec6; sshbuf_free(local_28); uVar1 = 0; LAB_00104ecb: if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) { *(undefined8 *)(puVar5 + -8) = 0x104edf; __stack_chk_fail(); } return uVar1; } if (muxclient_terminate != 0) { *(undefined8 *)(puVar5 + -8) = 0x104df3; sshbuf_free(local_28); *(undefined8 *)(puVar5 + -8) = 0x104df8; piVar2 = __errno_location(); *piVar2 = 4; uVar1 = 0xffffffff; goto LAB_00104ecb; } *(undefined8 *)(puVar5 + -8) = 0x104e2b; sVar3 = write(local_4c, (void *)((ulong)local_3c + local_20), (ulong)(local_34 - local_3c)); local_30 = (int)sVar3; if (local_30 == -1) { *(undefined8 *)(puVar5 + -8) = 0x104e39; piVar2 = __errno_location(); if (*piVar2 != 4) { if (*piVar2 != 0xb) { *(undefined8 *)(puVar5 + -8) = 0x104e62; piVar2 = __errno_location(); local_2c = *piVar2; *(undefined8 *)(puVar5 + -8) = 0x104e73; sshbuf_free(local_28); *(undefined8 *)(puVar5 + -8) = 0x104e78; piVar2 = __errno_location(); *piVar2 = local_2c; uVar1 = 0xffffffff; goto LAB_00104ecb; } *(undefined8 *)(puVar5 + -8) = 0x104e5b; poll(&local_18, 1, -1); } } else { if (local_30 == 0) { *(undefined8 *)(puVar5 + -8) = 0x104e96; sshbuf_free(local_28); *(undefined8 *)(puVar5 + -8) = 0x104e9b; piVar2 = __errno_location(); *piVar2 = 0x20; uVar1 = 0xffffffff; goto LAB_00104ecb; } local_3c = local_3c + local_30; } } while (true); }
openssh-portable
ghidra
static int mod_fill_all_unique_dependencies(const struct mod *mod, const struct mod **deps, size_t n_deps, size_t *last) { size_t i; int err = 0; for (i = 0; i < mod->deps.count; i++) { const struct mod *d = mod->deps.array[i]; size_t j; uint8_t exists = 0; for (j = 0; j < *last; j++) { if (deps[j] == d) { exists = 1; break; } } if (exists) continue; if (*last >= n_deps) return -28; deps[*last] = d; (*last)++; err = mod_fill_all_unique_dependencies(d, deps, n_deps, last); if (err < 0) break; } return err; }
int mod_fill_all_unique_dependencies(long param_1, long param_2, ulong param_3, ulong *param_4) { long lVar1; bool bVar2; int local_24; ulong local_20; ulong local_18; local_24 = 0; local_20 = 0; do { if (*(ulong *)(param_1 + 0x38) <= local_20) { return local_24; } lVar1 = *(long *)(*(long *)(param_1 + 0x30) + local_20 * 8); bVar2 = false; for (local_18 = 0; local_18 < *param_4; local_18 = local_18 + 1) { if (lVar1 == *(long *)(param_2 + local_18 * 8)) { bVar2 = true; break; } } if (!bVar2) { if (param_3 <= *param_4) { return -0x1c; } *(long *)(*param_4 * 8 + param_2) = lVar1; *param_4 = *param_4 + 1; local_24 = mod_fill_all_unique_dependencies(lVar1, param_2, param_3, param_4); if (local_24 < 0) { return local_24; } } local_20 = local_20 + 1; } while (true); }
kmod
ghidra
static int make_ancestor(char const *dir, char const *component, void *options) { struct mkdir_options const *o = options; if (o->set_security_context && defaultcon(o->set_security_context, component, 0040000) < 0 && !ignorable_ctx_err((*__errno_location()))) error(0, (*__errno_location()), gettext("failed to set default creation context for %s"), quotearg_style(shell_escape_always_quoting_style, dir)); if (o->umask_ancestor != o->umask_self) umask(o->umask_ancestor); int r = mkdir(component, ((0400 | 0200 | 0100) | ((0400 | 0200 | 0100) >> 3) | (((0400 | 0200 | 0100) >> 3) >> 3))); if (o->umask_ancestor != o->umask_self) { int mkdir_errno = (*__errno_location()); umask(o->umask_self); (*__errno_location()) = mkdir_errno; } if (r == 0) { r = (o->umask_ancestor & 0400) != 0; announce_mkdir(dir, options); } return r; }
uint make_ancestor(undefined8 param_1, char *param_2, long param_3) { char cVar1; int iVar2; undefined8 uVar3; undefined8 uVar4; int *piVar5; uint local_28; if (*(long *)(param_3 + 0x18) != 0) { iVar2 = defaultcon(*(undefined8 *)(param_3 + 0x18), param_2, 0x4000); if (iVar2 < 0) { __errno_location(); cVar1 = ignorable_ctx_err(); if (cVar1 != '\x01') { uVar3 = quotearg_style(4, param_1); uVar4 = gettext("failed to set default creation context for %s"); piVar5 = __errno_location(); error(0, *piVar5, uVar4, uVar3); } } } if (*(int *)(param_3 + 8) != *(int *)(param_3 + 0xc)) { umask(*(__mode_t *)(param_3 + 8)); } local_28 = mkdir(param_2, 0x1ff); if (*(int *)(param_3 + 8) != *(int *)(param_3 + 0xc)) { piVar5 = __errno_location(); iVar2 = *piVar5; umask(*(__mode_t *)(param_3 + 0xc)); piVar5 = __errno_location(); *piVar5 = iVar2; } if (local_28 == 0) { local_28 = (uint)((*(uint *)(param_3 + 8) & 0x100) != 0); announce_mkdir(param_1, param_3); } return local_28; }
coreutils
ghidra
static char *tar_help_filter(int key, const char *text, void *input) { struct obstack stk; char *s; switch (key) { default: s = (char *)text; break; case 'j': s = xasprintf(gettext("filter the archive through %s"), "bzip2"); break; case 'z': s = xasprintf(gettext("filter the archive through %s"), "gzip"); break; case 'Z': s = xasprintf(gettext("filter the archive through %s"), "compress"); break; case LZIP_OPTION: s = xasprintf(gettext("filter the archive through %s"), "lzip"); break; case LZMA_OPTION: s = xasprintf(gettext("filter the archive through %s"), "lzma"); break; case LZOP_OPTION: s = xasprintf(gettext("filter the archive through %s"), "lzop"); break; case 'J': s = xasprintf(gettext("filter the archive through %s"), "xz"); break; case ZSTD_OPTION: s = xasprintf(gettext("filter the archive through %s"), "zstd"); break; case 0x2000004: { const char *tstr; _obstack_begin((&stk), 0, 0, (xmalloc), (free)); tstr = gettext("Valid arguments for the --quoting-style option are:"); __extension__({ struct obstack *__o = (&stk); size_t __len = (strlen(tstr)); if (__extension__({ struct obstack const *__o1 = (__o); (size_t)(__o1->chunk_limit - __o1->next_free); }) < __len) _obstack_newchunk(__o, __len); memcpy(__o->next_free, tstr, __len); __o->next_free += __len; (void)0; }); __extension__({ struct obstack *__o = (&stk); size_t __len = (2); if (__extension__({ struct obstack const *__o1 = (__o); (size_t)(__o1->chunk_limit - __o1->next_free); }) < __len) _obstack_newchunk(__o, __len); memcpy(__o->next_free, "\n\n", __len); __o->next_free += __len; (void)0; }); tar_list_quoting_styles(&stk, " "); tstr = gettext("\n*This* tar defaults to:\n"); __extension__({ struct obstack *__o = (&stk); size_t __len = (strlen(tstr)); if (__extension__({ struct obstack const *__o1 = (__o); (size_t)(__o1->chunk_limit - __o1->next_free); }) < __len) _obstack_newchunk(__o, __len); memcpy(__o->next_free, tstr, __len); __o->next_free += __len; (void)0; }); s = format_default_settings(); __extension__({ struct obstack *__o = (&stk); size_t __len = (strlen(s)); if (__extension__({ struct obstack const *__o1 = (__o); (size_t)(__o1->chunk_limit - __o1->next_free); }) < __len) _obstack_newchunk(__o, __len); memcpy(__o->next_free, s, __len); __o->next_free += __len; (void)0; }); __extension__({ struct obstack *__o = (&stk); if (__extension__({ struct obstack const *__o1 = (__o); (size_t)(__o1->chunk_limit - __o1->next_free); }) < 1) _obstack_newchunk(__o, 1); ((void)(*((__o)->next_free)++ = ('\n'))); }); __extension__({ struct obstack *__o = (&stk); if (__extension__({ struct obstack const *__o1 = (__o); (size_t)(__o1->chunk_limit - __o1->next_free); }) < 1) _obstack_newchunk(__o, 1); ((void)(*((__o)->next_free)++ = (0))); }); s = xstrdup(__extension__({ struct obstack *__o1 = (&stk); void *__value = (void *)__o1->object_base; if (__o1->next_free == __value) __o1->maybe_empty_object = 1; __o1->next_free = ((sizeof(ptrdiff_t) < sizeof(void *) ? (__o1->object_base) : (char *)0) + (((__o1->next_free) - (sizeof(ptrdiff_t) < sizeof(void *) ? (__o1->object_base) : (char *)0) + (__o1->alignment_mask)) & ~(__o1->alignment_mask))); if ((size_t)(__o1->next_free - (char *)__o1->chunk) > (size_t)(__o1->chunk_limit - (char *)__o1->chunk)) __o1->next_free = __o1->chunk_limit; __o1->object_base = __o1->next_free; __value; })); __extension__({ struct obstack *__o = (&stk); void *__obj = (void *)(((void *)0)); if (__obj > (void *)__o->chunk && __obj < (void *)__o->chunk_limit) __o->next_free = __o->object_base = (char *)__obj; else _obstack_free(__o, __obj); }); } } return s; }
undefined8 tar_help_filter(int param_1, undefined8 param_2) { undefined *puVar1; undefined8 uVar2; char *pcVar3; size_t sVar4; long in_FS_OFFSET; undefined8 local_118; undefined local_68[8]; long lStack96; undefined *puStack88; undefined *puStack80; undefined *puStack72; ulong uStack56; byte bStack24; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); if (param_1 == 0x2000004) { _obstack_begin(local_68, 0, 0, uRam0000000000101192, uRam0000000000101188); pcVar3 = (char *)gettext("Valid arguments for the --quoting-style option are:"); sVar4 = strlen(pcVar3); if ((ulong)((long)puStack72 - (long)puStack80) < sVar4) { _obstack_newchunk(local_68, sVar4); } memcpy(puStack80, pcVar3, sVar4); puStack80 = puStack80 + sVar4; if ((ulong)((long)puStack72 - (long)puStack80) < 2) { _obstack_newchunk(local_68, 2); } memcpy(puStack80, &DAT_00107b24, 2); puStack80 = puStack80 + 2; tar_list_quoting_styles(local_68, &DAT_00107b27); pcVar3 = (char *)gettext("\n*This* tar defaults to:\n"); sVar4 = strlen(pcVar3); if ((ulong)((long)puStack72 - (long)puStack80) < sVar4) { _obstack_newchunk(local_68, sVar4); } memcpy(puStack80, pcVar3, sVar4); puStack80 = puStack80 + sVar4; pcVar3 = (char *)format_default_settings(); sVar4 = strlen(pcVar3); if ((ulong)((long)puStack72 - (long)puStack80) < sVar4) { _obstack_newchunk(local_68, sVar4); } memcpy(puStack80, pcVar3, sVar4); puStack80 = puStack80 + sVar4; if (puStack72 == puStack80) { _obstack_newchunk(local_68, 1); } puVar1 = puStack80 + 1; *puStack80 = 10; puStack80 = puVar1; if (puStack72 == puVar1) { _obstack_newchunk(local_68, 1); } puVar1 = puStack80; puStack80 = puStack80 + 1; *puVar1 = 0; if (puStack88 == puStack80) { bStack24 = bStack24 | 2; } puStack80 = (undefined *)(~uStack56 & (ulong)(puStack80 + uStack56)); if ((ulong)((long)puStack72 - lStack96) < (ulong)((long)puStack80 - lStack96)) { puStack80 = puStack72; } local_118 = xstrdup(puStack88); _obstack_free(local_68, 0); } else { local_118 = param_2; if (param_1 < 0x2000005) { if (param_1 == 0xcf) { uVar2 = gettext("filter the archive through %s"); local_118 = xasprintf(uVar2, &DAT_00106fc4); } else if (param_1 < 0xd0) { if (param_1 == 0x96) { uVar2 = gettext("filter the archive through %s"); local_118 = xasprintf(uVar2, &DAT_00106fbc); } else if (param_1 < 0x97) { if (param_1 == 0x95) { uVar2 = gettext("filter the archive through %s"); local_118 = xasprintf(uVar2, &DAT_00106fb7); } else if (param_1 < 0x96) { if (param_1 == 0x94) { uVar2 = gettext("filter the archive through %s"); local_118 = xasprintf(uVar2, &DAT_00106fb2); } else if (param_1 < 0x95) { if (param_1 == 0x7a) { uVar2 = gettext("filter the archive through %s"); local_118 = xasprintf(uVar2, &DAT_00106f8b); } else if (param_1 < 0x7b) { if (param_1 == 0x6a) { uVar2 = gettext("filter the archive through %s"); local_118 = xasprintf(uVar2, "bzip2"); } else if (param_1 < 0x6b) { if (param_1 == 0x4a) { uVar2 = gettext("filter the archive through %s"); local_118 = xasprintf(uVar2, &DAT_00106fc1); } else if (param_1 == 0x5a) { uVar2 = gettext("filter the archive through %s"); local_118 = xasprintf(uVar2, "compress"); } } } } } } } } } if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) { __stack_chk_fail(); } return local_118; }
tar
ghidra
HIST_ENTRY *previous_history(void) { HistEvent ev; if (history_offset == 0) return ((void *)0); if (history(h, &ev, 4) != 0) return ((void *)0); history_offset--; return current_history(); }
long long previous_history() { char v0; void *v2; if (!*(got.history_offset)) { v2 = 0; return v2; } else if (!history(h, &v0, 0x4, &v0)) { *(got.history_offset) = *(got.history_offset) - 1; v2 = current_history(); return v2; } else { v2 = 0; return v2; } }
libedit
angr_sailr
0 ) do { fprintf(stderr, gettext("Try '%s --help' for more information.\n"), program_name); } while (0) ;
int fprintf(FILE *__stream, char *__format, ...) { halt_baddata(); }
coreutils
ghidra
int kex_gen_client(struct ssh *ssh) { struct kex *kex = ssh->kex; int r; switch (kex->kex_type) { case KEX_DH_GRP1_SHA1: case KEX_DH_GRP14_SHA1: case KEX_DH_GRP14_SHA256: case KEX_DH_GRP16_SHA512: case KEX_DH_GRP18_SHA512: r = kex_dh_keypair(kex); break; case KEX_ECDH_SHA2: r = kex_ecdh_keypair(kex); break; case KEX_C25519_SHA256: r = kex_c25519_keypair(kex); break; case KEX_KEM_SNTRUP761X25519_SHA512: r = kex_kem_sntrup761x25519_keypair(kex); break; default: r = -10; break; } if (r != 0) return r; if ((r = sshpkt_start(ssh, 30)) != 0 || (r = sshpkt_put_stringb(ssh, kex->client_pub)) != 0 || (r = sshpkt_send(ssh)) != 0) return r; sshlog("kexgen.c", __func__, 133, 0, SYSLOG_LEVEL_DEBUG1, ((void *)0), "expecting SSH2_MSG_KEX_ECDH_REPLY"); ssh_dispatch_set(ssh, 31, &input_kex_gen_reply); return 0; }
long long kex_gen_client(struct_0 *a0) { unsigned long long v0; unsigned int v1; struct_1 *v2; void *v4; v2 = a0->field_8; if (v2->field_38 == 9) { v1 = kex_kem_sntrup761x25519_keypair(v2); } else { if (v2->field_38 <= 9) { if (v2->field_38 == 8) { v1 = kex_c25519_keypair(v2); goto LABEL_4002d0; } else if (v2->field_38 <= 8) { if (v2->field_38 <= 4) { v1 = kex_dh_keypair(v2); goto LABEL_4002d0; } if (v2->field_38 == 7) { v1 = kex_ecdh_keypair(v2); goto LABEL_4002d0; } } } v1 = -10; } LABEL_4002d0: if (v1) { v4 = v1; } else { v1 = sshpkt_start(a0, 0x1e); if (v1) { LABEL_400330: v4 = v1; } else { v1 = sshpkt_put_stringb(a0, v2->field_868, v2->field_868); if (!(!v1)) goto LABEL_400330; v1 = sshpkt_send(a0); if (!(!v1)) goto LABEL_400330; v0 = "expecting SSH2_MSG_KEX_ECDH_REPLY"; sshlog("kexgen.c", "kex_gen_client", 0x85, 0x0, 0x5, 0x0); ssh_dispatch_set(a0, 0x1f, input_kex_gen_reply); v4 = 0; } } return v4; }
openssh-portable
angr_phoenix
static void transitional_interest_callback(const char *trig, struct pkginfo *pkg, struct pkgbin *pkgbin, enum trig_options opts) { struct pkginfo *pend = pkg; struct pkgbin *pendbin = pkgbin; trig_cicb_interest_add(trig, pend, pendbin, opts); transitional_interest_callback_ro(trig, pend, pendbin, opts); }
long long transitional_interest_callback(unsigned long long a0, void *a1, unsigned long long a2, unsigned long a3) { trig_cicb_interest_add(a0, a1, a2, a3); return transitional_interest_callback_ro(a0, a1, a2, a3); }
dpkg
angr_phoenix
static _Bool dump(void) { char *block[2]; uintmax_t current_offset; _Bool idx = 0; _Bool ok = 1; size_t n_bytes_read; block[0] = xnmalloc(2, bytes_per_block); block[1] = block[0] + bytes_per_block; current_offset = n_bytes_to_skip; if (limit_bytes_to_format) { while (1) { size_t n_needed; if (current_offset >= end_offset) { n_bytes_read = 0; break; } n_needed = (((end_offset - current_offset) < ((uintmax_t)bytes_per_block)) ? (end_offset - current_offset) : ((uintmax_t)bytes_per_block)) ; ok &= read_block(n_needed, block[idx], &n_bytes_read); if (n_bytes_read < bytes_per_block) break; ((void)sizeof((n_bytes_read == bytes_per_block) ? 1 : 0), __extension__({ if (n_bytes_read == bytes_per_block) ; else __assert_fail("n_bytes_read == bytes_per_block", "src/od.c", 1404, __extension__ __PRETTY_FUNCTION__); })); write_block(current_offset, n_bytes_read, block[!idx], block[idx]); current_offset += n_bytes_read; idx = !idx; } } else { while (1) { ok &= read_block(bytes_per_block, block[idx], &n_bytes_read); if (n_bytes_read < bytes_per_block) break; ((void)sizeof((n_bytes_read == bytes_per_block) ? 1 : 0), __extension__({ if (n_bytes_read == bytes_per_block) ; else __assert_fail("n_bytes_read == bytes_per_block", "src/od.c", 1418, __extension__ __PRETTY_FUNCTION__); })); write_block(current_offset, n_bytes_read, block[!idx], block[idx]); current_offset += n_bytes_read; idx = !idx; } } if (n_bytes_read > 0) { int l_c_m; size_t bytes_to_write; l_c_m = get_lcm(); bytes_to_write = l_c_m * ((n_bytes_read + l_c_m - 1) / l_c_m); memset(block[idx] + n_bytes_read, 0, bytes_to_write - n_bytes_read); write_block(current_offset, n_bytes_read, block[!idx], block[idx]); current_offset += n_bytes_read; } format_address(current_offset, '\n'); if (limit_bytes_to_format && current_offset >= end_offset) ok &= check_and_close(0); free(block[0]); return ok; }
bool dump(void) { byte bVar1; int iVar2; long in_FS_OFFSET; bool local_4e; bool local_4d; ulong local_48; ulong local_40; ulong local_38; long local_30; void *local_28; long local_20; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); local_4e = false; local_4d = true; local_28 = (void *)xnmalloc(2, bytes_per_block); local_20 = bytes_per_block + (long)local_28; local_40 = n_bytes_to_skip; if (limit_bytes_to_format == '\0') { while (true) { bVar1 = read_block(bytes_per_block, (&local_28)[(int)(uint)local_4e], &local_48); local_4d = (bVar1 & local_4d) != 0; if (local_48 < bytes_per_block) break; if (local_48 != bytes_per_block) { __assert_fail("n_bytes_read == bytes_per_block", "src/od.c", 0x58a, (char *)&__PRETTY_FUNCTION___6489); } write_block(local_40, local_48, (&local_28)[(int)(uint)(local_4e ^ 1)], (&local_28)[(int)(uint)local_4e]); local_40 = local_40 + local_48; local_4e = local_4e == false; } } else { for (; local_40 < end_offset; local_40 = local_40 + local_48) { local_38 = bytes_per_block; if (end_offset - local_40 <= bytes_per_block) { local_38 = end_offset - local_40; } bVar1 = read_block(local_38, (&local_28)[(int)(uint)local_4e], &local_48); local_4d = (bVar1 & local_4d) != 0; if (local_48 < bytes_per_block) goto LAB_00102e15; if (local_48 != bytes_per_block) { __assert_fail("n_bytes_read == bytes_per_block", "src/od.c", 0x57c, (char *)&__PRETTY_FUNCTION___6489); } write_block(local_40, local_48, (&local_28)[(int)(uint)(local_4e ^ 1)], (&local_28)[(int)(uint)local_4e]); local_4e = local_4e == false; } local_48 = 0; } LAB_00102e15: if (local_48 != 0) { iVar2 = get_lcm(); local_30 = (((local_48 + (long)iVar2) - 1) / (ulong)(long)iVar2) * (long)iVar2; memset((void *)(local_48 + (long)(&local_28)[(int)(uint)local_4e]), 0, local_30 - local_48); write_block(local_40, local_48, (&local_28)[(int)(uint)(local_4e ^ 1)], (&local_28)[(int)(uint)local_4e]); local_40 = local_40 + local_48; } (*format_address)(local_40, 10); if ((limit_bytes_to_format != '\0') && (end_offset <= local_40)) { bVar1 = check_and_close(0); local_4d = (bVar1 & local_4d) != 0; } free(local_28); if (local_10 == *(long *)(in_FS_OFFSET + 0x28)) { return local_4d; } __stack_chk_fail(); }
coreutils
ghidra
static void log_gpasswd_success_group(__attribute__((unused)) void *arg) { char buf[1024]; snprintf(buf, 1023, " in %s", gr_dbname()); buf[1023] = '\0'; log_gpasswd_success(buf); }
unsigned long log_gpasswd_success_group() { const char *v0; char s[1032]; unsigned long v3; v3 = __readfsqword(0x28u); v0 = (const char *)gr_dbname(); snprintf(s, 0x3FFuLL, " in %s", v0); s[1023] = 0; log_gpasswd_success(s); return __readfsqword(0x28u) ^ v3; }
shadow
ida
int EVP_CIPHER_CTX_set_iv(EVP_CIPHER_CTX *ctx, const unsigned char *iv, size_t len) { if (ctx == ((void *)0)) return 0; if (EVP_CIPHER_CTX_get_iv_length(ctx) < 0) return 0; if (len != (size_t)EVP_CIPHER_CTX_get_iv_length(ctx)) return 0; if (len > 16) return 0; if (len != 0) { if (iv == ((void *)0)) return 0; memcpy(EVP_CIPHER_CTX_iv_noconst(ctx), iv, len); } return 1; }
long long EVP_CIPHER_CTX_set_iv(unsigned long long a0, void *a1, unsigned int a2) { unsigned long long v1; if (!a0) { v1 = 0; } else if (EVP_CIPHER_CTX_get_iv_length(a0) < 0) { v1 = 0; } else if (a2 != EVP_CIPHER_CTX_get_iv_length(a0)) { v1 = 0; } else if (a2 > 16) { v1 = 0; } else { if (a2) { if (!a1) { v1 = 0; goto LABEL_400146; } else { memcpy(EVP_CIPHER_CTX_iv_noconst(a0), a1, a2); } } v1 = 1; } LABEL_400146: return v1; }
openssh-portable
angr_phoenix