input
stringlengths
26
172k
output
stringlengths
18
318k
repo_name
stringclasses
23 values
decompiler
stringclasses
5 values
EditLine *el_init_fd(const char *prog, FILE *fin, FILE *fout, FILE *ferr, int fdin, int fdout, int fderr) { return el_init_internal(prog, fin, fout, ferr, fdin, fdout, fderr, 0); }
void el_init_fd(undefined8 param_1, undefined8 param_2, undefined8 param_3, undefined8 param_4, undefined4 param_5, undefined4 param_6, undefined4 param_7) { el_init_internal(param_1, param_2, param_3, param_4, param_5, param_6, param_7, 0); return; }
libedit
ghidra
void malloc_set_tracefp(fp) FILE *fp; { }
long long malloc_set_tracefp(unsigned long a0) { unsigned long v0; unsigned long v2; v0 = a0; return v2; }
bash
angr_sailr
static void list_format_print(struct list_format *fmt, int c_want, int c_status, int c_eflag, const char *name, const char *version, const char *arch, const char *desc, int desc_len) { struct str_crop_info ns, vs, as, ds; str_gen_crop(name, fmt->nw, &ns); str_gen_crop(version, fmt->vw, &vs); str_gen_crop(arch, fmt->aw, &as); str_gen_crop(desc, desc_len, &ds); printf("%c%c%c %-*.*s %-*.*s %-*.*s %.*s\n", c_want, c_status, c_eflag, ns.max_bytes, ns.str_bytes, name, vs.max_bytes, vs.str_bytes, version, as.max_bytes, as.str_bytes, arch, ds.str_bytes, desc); }
void list_format_print(unsigned int a0[4], unsigned long a1, unsigned long a2, unsigned long a3, unsigned long long a4, unsigned long long a5, unsigned long long v19, unsigned long long a6, unsigned int a7) { unsigned long v0; unsigned long v1; unsigned long v2; unsigned long v3; unsigned long v4; unsigned long v5; unsigned long v6; unsigned long v7; unsigned long v8; unsigned long long v9; unsigned long long v10; char v11; char v12; char v13; char v14; char v15; char v16; char v17; char v18; unsigned long long *v20; unsigned long long v21; v10 = v19; v9 = a6; str_gen_crop(a4, a0[1], &v11, a0[1]); str_gen_crop(a5, a0[2], &v13, a0[2]); str_gen_crop(v10, a0[3], &v15, a0[3]); str_gen_crop(v9, a7, &v17, a7); v8 = v9; v7 = *(&v17); v6 = v10; v5 = *(&v15); v4 = *(&v16); v3 = a5; v2 = *(&v13); v1 = *(&v14); v0 = a4; printf("%c%c%c %-*.*s %-*.*s %-*.*s %.*s\n", a1, a2, a3, *(&v12)); v21 = *(&v18) ^ v20[5]; return; }
dpkg
angr_dream
static char *fingerprint_bubblebabble(u_char *dgst_raw, size_t dgst_raw_len) { char vowels[] = {'a', 'e', 'i', 'o', 'u', 'y'}; char consonants[] = {'b', 'c', 'd', 'f', 'g', 'h', 'k', 'l', 'm', 'n', 'p', 'r', 's', 't', 'v', 'z', 'x'}; u_int i, j = 0, rounds, seed = 1; char *retval; rounds = (dgst_raw_len / 2) + 1; if ((retval = calloc(rounds, 6)) == ((void *)0)) return ((void *)0); retval[j++] = 'x'; for (i = 0; i < rounds; i++) { u_int idx0, idx1, idx2, idx3, idx4; if ((i + 1 < rounds) || (dgst_raw_len % 2 != 0)) { idx0 = (((((u_int)(dgst_raw[2 * i])) >> 6) & 3) + seed) % 6; idx1 = (((u_int)(dgst_raw[2 * i])) >> 2) & 15; idx2 = ((((u_int)(dgst_raw[2 * i])) & 3) + (seed / 6)) % 6; retval[j++] = vowels[idx0]; retval[j++] = consonants[idx1]; retval[j++] = vowels[idx2]; if ((i + 1) < rounds) { idx3 = (((u_int)(dgst_raw[(2 * i) + 1])) >> 4) & 15; idx4 = (((u_int)(dgst_raw[(2 * i) + 1]))) & 15; retval[j++] = consonants[idx3]; retval[j++] = '-'; retval[j++] = consonants[idx4]; seed = ((seed * 5) + ((((u_int)(dgst_raw[2 * i])) * 7) + ((u_int)(dgst_raw[(2 * i) + 1])))) % 36; } } else { idx0 = seed % 6; idx1 = 16; idx2 = seed / 6; retval[j++] = vowels[idx0]; retval[j++] = consonants[idx1]; retval[j++] = vowels[idx2]; } } retval[j++] = 'x'; retval[j++] = '\0'; return retval; }
undefined *fingerprint_bubblebabble(long param_1, ulong param_2) { byte bVar1; byte bVar2; uint uVar3; uint uVar4; undefined *puVar5; long in_FS_OFFSET; uint local_5c; uint local_58; uint local_54; undefined4 local_2e; undefined2 local_2a; undefined8 local_28; undefined8 local_20; undefined local_18; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); local_2e = 0x6f696561; local_2a = 0x7975; local_28 = 0x6c6b686766646362; local_20 = 0x7a76747372706e6d; local_18 = 0x78; local_54 = 1; uVar4 = (int)(param_2 >> 1) + 1; puVar5 = (undefined *)calloc((ulong)uVar4, 6); if (puVar5 == (undefined *)0x0) { puVar5 = (undefined *)0x0; } else { local_58 = 1; *puVar5 = 0x78; for (local_5c = 0; local_5c < uVar4; local_5c = local_5c + 1) { if ((local_5c + 1 < uVar4) || ((param_2 & 1) != 0)) { bVar1 = *(byte *)(param_1 + (ulong)(local_5c * 2)); bVar2 = *(byte *)(param_1 + (ulong)(local_5c * 2)); puVar5[local_58] = *( undefined *)((long)&local_2e + (ulong)(((*(byte *)(param_1 + (ulong)(local_5c * 2)) >> 6) + local_54) % 6)); puVar5[local_58 + 1] = *(undefined *)((long)&local_28 + (ulong)(bVar1 >> 2 & 0xf)); puVar5[local_58 + 2] = *(undefined *)((long)&local_2e + (ulong)(((bVar2 & 3) + local_54 / 6) % 6)); uVar3 = local_58 + 3; if (local_5c + 1 < uVar4) { bVar1 = *(byte *)(param_1 + (ulong)(local_5c * 2 + 1)); puVar5[local_58 + 3] = *(undefined *)((long)&local_28 + (ulong)(*(byte *)(param_1 + (ulong)(local_5c * 2 + 1)) >> 4)); puVar5[local_58 + 4] = 0x2d; puVar5[local_58 + 5] = *(undefined *)((long)&local_28 + (ulong)(bVar1 & 0xf)); bVar1 = *(byte *)(param_1 + (ulong)(local_5c * 2)); local_54 = (((uint)bVar1 * 8 - (uint)bVar1) + local_54 * 5 + (uint) * (byte *)(param_1 + (ulong)(local_5c * 2 + 1))) % 0x24; uVar3 = local_58 + 6; } } else { puVar5[local_58] = *(undefined *)((long)&local_2e + (ulong)(local_54 % 6)); puVar5[local_58 + 1] = local_18; puVar5[local_58 + 2] = *(undefined *)((long)&local_2e + (ulong)(local_54 / 6)); uVar3 = local_58 + 3; } local_58 = uVar3; } puVar5[local_58] = 0x78; puVar5[local_58 + 1] = 0; } if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) { __stack_chk_fail(); } return puVar5; }
openssh-portable
ghidra
COMPSPEC *progcomp_search(cmd) const char *cmd; { register BUCKET_CONTENTS *item; COMPSPEC *cs; if (prog_completes == 0) return ((COMPSPEC *)((void *)0)); item = hash_search(cmd, prog_completes, 0); if (item == ((void *)0)) return ((COMPSPEC *)((void *)0)); cs = (COMPSPEC *)item->data; return (cs); }
undefined8 progcomp_search(undefined8 param_1) { undefined8 uVar1; long lVar2; if (prog_completes == 0) { uVar1 = 0; } else { lVar2 = hash_search(param_1, prog_completes, 0); if (lVar2 == 0) { uVar1 = 0; } else { uVar1 = *(undefined8 *)(lVar2 + 0x10); } } return uVar1; }
bash
ghidra
static _Bool ignore_depends_possi(struct deppossi *possi) { struct deppossi_pkg_iterator *possi_iter; struct pkginfo *pkg; possi_iter = deppossi_pkg_iter_new(possi, wpb_installed); while ((pkg = deppossi_pkg_iter_next(possi_iter))) { if (ignore_depends(pkg)) { deppossi_pkg_iter_free(possi_iter); return 1; } } deppossi_pkg_iter_free(possi_iter); return 0; }
int ignore_depends_possi(unsigned long long a0) { unsigned long long v0; unsigned int v1; unsigned int v3; v0 = deppossi_pkg_iter_new(a0, 0x0); while (true) { *(&v1) = deppossi_pkg_iter_next(v0); if (!*(&v1)) { deppossi_pkg_iter_free(v0); v3 = 0; return v3; } else if (ignore_depends(*(&v1))) { deppossi_pkg_iter_free(v0); v3 = 1; return v3; } } }
dpkg
angr_sailr
static void dynaFileFreeCacheEntries(instanceData *__restrict__ const pData) { register int i; ((void)(0)); for (i = 0; i < pData->iCurrCacheSize; ++i) { dynaFileDelCacheEntry(pData, i, 1); } pData->iCurrElt = -1; pData->pStrm = ((void *)0); }
long dynaFileFreeCacheEntries(long a1) { int i; long result; for (i = 0; i < *(_DWORD *)(a1 + 328); ++i) dynaFileDelCacheEntry(a1, i, 1); *(_DWORD *)(a1 + 324) = -1; result = a1; *(_QWORD *)(a1 + 56) = 0LL; return result; }
rsyslog-8.2210.0
ida
static rsRetVal doTryResume(wrkrInstanceData_t *pWrkrData) { int iErr; struct addrinfo *res = ((void *)0); struct addrinfo hints; instanceData *pData; int bBindRequired = 0; const char *address; rsRetVal iRet = RS_RET_OK; if (pWrkrData->bIsConnected) goto finalize_it; ; pData = pWrkrData->pData; if (pData->protocol == 0) { memset(&hints, 0, sizeof(hints)); hints.ai_flags = 0x0400; hints.ai_family = glbl.GetDefPFFamily(runModConf->pConf); hints.ai_socktype = SOCK_DGRAM; if ((iErr = (getaddrinfo(pData->target, pData->port, &hints, &res))) != 0) { LogError(0, RS_RET_SUSPENDED, "omfwd: could not get addrinfo for hostname '%s':'%s': %s", pData->target, pData->port, gai_strerror(iErr)); do { iRet = RS_RET_SUSPENDED; goto finalize_it; } while (0); } address = pData->target; if (pData->address) { struct addrinfo *addr; hints.ai_family = res->ai_family; hints.ai_flags |= 0x0001; iErr = getaddrinfo(pData->address, pData->port, &hints, &addr); freeaddrinfo(addr); if (iErr != 0) { LogError(0, RS_RET_SUSPENDED, "omfwd: cannot use bind address '%s' for host '%s': %s", pData->address, pData->target, gai_strerror(iErr)); do { iRet = RS_RET_SUSPENDED; goto finalize_it; } while (0); } bBindRequired = 1; address = pData->address; } if (Debug) { r_dbgprintf("omfwd.c", "%s found, resuming.\n", pData->target); }; pWrkrData->f_addr = res; res = ((void *)0); if (pWrkrData->pSockArray == ((void *)0)) { if ((iRet = changeToNs(pData)) != RS_RET_OK) goto finalize_it; pWrkrData->pSockArray = net.create_udp_socket( (uchar *)address, ((void *)0), bBindRequired, 0, pData->UDPSendBuf, pData->ipfreebind, pData->device); if ((iRet = returnToOriginalNs(pData)) != RS_RET_OK) goto finalize_it; } if (pWrkrData->pSockArray != ((void *)0)) { pWrkrData->bIsConnected = 1; } } else { if ((iRet = changeToNs(pData)) != RS_RET_OK) goto finalize_it; if ((iRet = TCPSendInit((void *)pWrkrData)) != RS_RET_OK) goto finalize_it; if ((iRet = returnToOriginalNs(pData)) != RS_RET_OK) goto finalize_it; } finalize_it: if (Debug) { r_dbgprintf("omfwd.c", "omfwd: doTryResume %s iRet %d\n", pWrkrData->pData->target, iRet); }; if (res != ((void *)0)) { freeaddrinfo(res); } if (iRet != RS_RET_OK) { returnToOriginalNs(pData); if (pWrkrData->f_addr != ((void *)0)) { freeaddrinfo(pWrkrData->f_addr); pWrkrData->f_addr = ((void *)0); } iRet = RS_RET_SUSPENDED; } return iRet; }
int doTryResume(struct_0 *a0, unsigned long long a1, unsigned long long a2) { unsigned long v0; unsigned int v1; unsigned int v2; unsigned int v3; void *v4; char v5; struct_1 *v6; unsigned long long v7; unsigned int v8; unsigned int v9; unsigned int v10; void *v12; v4 = 0; v1 = 0; v2 = 0; if (!a0->field_28) { v6 = a0->field_0; if (!v6->field_78) { memset(&v8, 0x0, 0x30); v8 = 0x400; v9 = *(4216592)(*(runModConf)); v10 = 2; v3 = getaddrinfo(v6->field_50, v6->field_70, &v8, &v4); if (v3) { gai_strerror(v3); LogError(0x0, 0xfffff829, "omfwd: could not get addrinfo for hostname '%s':'%s': %s"); v2 = -2007; } else { v7 = v6->field_50; if (v6->field_58) { v9 = v4[4]; v8 |= 1; v3 = getaddrinfo(v6->field_58, v6->field_70, &v8, &v5); freeaddrinfo(*(&v5)); if (!v3) { v1 = 1; v7 = v6->field_58; } else { gai_strerror(v3); LogError(0x0, 0xfffff829, "omfwd: cannot use bind address '%s' for host '%s': %s"); v2 = -2007; goto LABEL_4020d0; } } if (Debug) r_dbgprintf("omfwd.c", "%s found, resuming.\n"); v12 = v4; a0->field_18 = v4; v4 = 0; if (!a0->field_20) { v2 = changeToNs(v6, a1, v12); if (!(!v2)) goto LABEL_4020d0; v0 = v6->field_60; a0->field_20 = *(4216848)(v7, 0, v1, 0, v6->field_bc, v6->field_b0); v2 = returnToOriginalNs(v6); if (!(!v2)) goto LABEL_4020d0; } if (a0->field_20) a0->field_28 = 1; } } else { v2 = changeToNs(v6, a1, a2); if (!v2) { v2 = TCPSendInit(a0); if (!v2) v2 = returnToOriginalNs(v6); } } } LABEL_4020d0: if (Debug) r_dbgprintf("omfwd.c", "omfwd: doTryResume %s iRet %d\n"); if (v4) freeaddrinfo(v4); if (v2) { returnToOriginalNs(v6); if (a0->field_18) { freeaddrinfo(a0->field_18); a0->field_18 = 0; } v2 = -2007; } return v2; }
rsyslog-8.2210.0
angr_phoenix
static void print_spaces(ptrdiff_t number) { for (ptrdiff_t counter = number; counter > 0; counter--) putchar_unlocked(' '); }
int print_spaces(long a1) { int result; long i; result = a1; for (i = a1; i > 0; --i) result = putchar_unlocked(32); return result; }
coreutils
ida
static void xdp_dump_json_one(struct rtattr *tb[(__IFLA_XDP_MAX - 1) + 1], __u32 attr, __u8 mode) { if (!tb[attr]) return; open_json_object(((void *)0)); print_uint(PRINT_JSON, "mode", ((void *)0), mode); bpf_dump_prog_info(((void *)0), rta_getattr_u32(tb[attr])); close_json_object(); }
void xdp_dump_json_one(long param_1, uint param_2, undefined param_3) { undefined4 uVar1; if (*(long *)(param_1 + (ulong)param_2 * 8) != 0) { open_json_object(0); print_uint(2, &DAT_00100879, 0, param_3); uVar1 = rta_getattr_u32(*(undefined8 *)(param_1 + (ulong)param_2 * 8)); bpf_dump_prog_info(0, uVar1); close_json_object(); } return; }
iproute2-6.0.0
ghidra
int main(int argc, char **argv) { struct keyfield *key; struct keyfield key_buf; struct keyfield gkey; _Bool gkey_only = 0; char const *s; int c = 0; char checkonly = 0; _Bool mergeonly = 0; char *random_source = ((void *)0); _Bool need_random = 0; size_t nthreads = 0; size_t nfiles = 0; _Bool posixly_correct = (getenv("POSIXLY_CORRECT") != ((void *)0)); int posix_ver = posix2_version(); _Bool traditional_usage = !(200112 <= posix_ver && posix_ver < 200809); char **files; char *files_from = ((void *)0); struct Tokens tok; char const *outfile = ((void *)0); _Bool locale_ok; ; set_program_name(argv[0]); locale_ok = !!setlocale(6, ""); bindtextdomain("coreutils", "/usr/local/share/locale"); textdomain("coreutils"); initialize_exit_failure(SORT_FAILURE); hard_LC_COLLATE = hard_locale(3); hard_LC_TIME = hard_locale(2); { struct lconv const *locale = localeconv(); decimal_point = locale->decimal_point[0]; if (!decimal_point || locale->decimal_point[1]) decimal_point = '.'; thousands_sep = locale->thousands_sep[0]; if (thousands_sep && locale->thousands_sep[1]) thousands_sep_ignored = 1; if (!thousands_sep || locale->thousands_sep[1]) thousands_sep = NON_CHAR; } have_read_stdin = 0; inittables(); { size_t i; static int const sig[] = { 14, 1, 2, 13, 3, 15, 29, 27, 26, 24, 25, }; enum { nsigs = (sizeof(sig) / sizeof *(sig)) }; struct sigaction act; sigemptyset(&caught_signals); for (i = 0; i < nsigs; i++) { sigaction(sig[i], ((void *)0), &act); if (act.__sigaction_handler.sa_handler != ((__sighandler_t)1)) sigaddset(&caught_signals, sig[i]); } act.__sigaction_handler.sa_handler = sighandler; act.sa_mask = caught_signals; act.sa_flags = 0; for (i = 0; i < nsigs; i++) if (sigismember(&caught_signals, sig[i])) sigaction(sig[i], &act, ((void *)0)); } signal(17, ((__sighandler_t)0)); atexit(exit_cleanup); key_init(&gkey); gkey.sword = (18446744073709551615UL); files = xnmalloc(argc, sizeof *files); while (1) { int oi = -1; if (c == -1 || (posixly_correct && nfiles != 0 && !(traditional_usage && !checkonly && optind != argc && argv[optind][0] == '-' && argv[optind][1] == 'o' && (argv[optind][2] || optind + 1 != argc))) || ((c = getopt_long(argc, argv, short_options, long_options, &oi)) == -1)) { if (argc <= optind) break; files[nfiles++] = argv[optind++]; } else switch (c) { case 1: key = ((void *)0); if (optarg[0] == '+') { _Bool minus_pos_usage = (optind != argc && argv[optind][0] == '-' && ((unsigned int)(argv[optind][1]) - '0' <= 9)); traditional_usage |= minus_pos_usage && !posixly_correct; if (traditional_usage) { key = key_init(&key_buf); s = parse_field_count(optarg + 1, &key->sword, ((void *)0)); if (s && *s == '.') s = parse_field_count(s + 1, &key->schar, ((void *)0)); if (!(key->sword || key->schar)) key->sword = (18446744073709551615UL); if (!s || *set_ordering(s, key, bl_start)) key = ((void *)0); else { if (minus_pos_usage) { char const *optarg1 = argv[optind++]; s = parse_field_count(optarg1 + 1, &key->eword, "invalid number after '-'"); ((void)sizeof((s) ? 1 : 0), __extension__({ if (s) ; else __assert_fail("s", "src/sort.c", 4449, __extension__ __PRETTY_FUNCTION__); })); if (*s == '.') s = parse_field_count(s + 1, &key->echar, "invalid number after '.'"); if (!key->echar && key->eword) { key->eword--; } if (*set_ordering(s, key, bl_end)) badfieldspec(optarg1, "stray character in field spec"); } key->traditional_used = 1; insertkey(key); } } } if (!key) files[nfiles++] = optarg; break; case SORT_OPTION: c = ((sort_types)[__xargmatch_internal( "--sort", optarg, sort_args, (void const *)(sort_types), sizeof *(sort_types), argmatch_die, 1)]); __attribute__((__fallthrough__)); case 'b': case 'd': case 'f': case 'g': case 'h': case 'i': case 'M': case 'n': case 'r': case 'R': case 'V': { char str[2]; str[0] = c; str[1] = '\0'; set_ordering(str, &gkey, bl_both); } break; case CHECK_OPTION: c = (optarg ? ((check_types)[__xargmatch_internal( "--check", optarg, check_args, (void const *)(check_types), sizeof *(check_types), argmatch_die, 1)]) : 'c'); __attribute__((__fallthrough__)); case 'c': case 'C': if (checkonly && checkonly != c) incompatible_options("cC"); checkonly = c; break; case COMPRESS_PROGRAM_OPTION: if (compress_program && !(strcmp(compress_program, optarg) == 0)) ((!!sizeof(struct { _Static_assert(SORT_FAILURE, "verify_expr (" "SORT_FAILURE" ", " "(error (SORT_FAILURE, 0, gettext (\"multiple " "compress programs specified\")), assume (false))" ")"); int _gl_dummy; })) ? ((error(SORT_FAILURE, 0, gettext("multiple compress programs specified")), ((0) ? (void)0 : __builtin_unreachable()))) : ((error(SORT_FAILURE, 0, gettext("multiple compress programs specified")), ((0) ? (void)0 : __builtin_unreachable())))); compress_program = optarg; break; case DEBUG_PROGRAM_OPTION: debug = 1; break; case FILES0_FROM_OPTION: files_from = optarg; break; case 'k': key = key_init(&key_buf); s = parse_field_count(optarg, &key->sword, "invalid number at field start"); if (!key->sword--) { badfieldspec(optarg, "field number is zero"); } if (*s == '.') { s = parse_field_count(s + 1, &key->schar, "invalid number after '.'"); if (!key->schar--) { badfieldspec(optarg, "character offset is zero"); } } if (!(key->sword || key->schar)) key->sword = (18446744073709551615UL); s = set_ordering(s, key, bl_start); if (*s != ',') { key->eword = (18446744073709551615UL); key->echar = 0; } else { s = parse_field_count(s + 1, &key->eword, "invalid number after ','"); if (!key->eword--) { badfieldspec(optarg, "field number is zero"); } if (*s == '.') { s = parse_field_count(s + 1, &key->echar, "invalid number after '.'"); } s = set_ordering(s, key, bl_end); } if (*s) badfieldspec(optarg, "stray character in field spec"); insertkey(key); break; case 'm': mergeonly = 1; break; case NMERGE_OPTION: specify_nmerge(oi, c, optarg); break; case 'o': if (outfile && !(strcmp(outfile, optarg) == 0)) ((!!sizeof(struct { _Static_assert(SORT_FAILURE, "verify_expr (" "SORT_FAILURE" ", " "(error (SORT_FAILURE, 0, gettext (\"multiple " "output files specified\")), assume (false))" ")"); int _gl_dummy; })) ? ((error(SORT_FAILURE, 0, gettext("multiple output files specified")), ((0) ? (void)0 : __builtin_unreachable()))) : ((error(SORT_FAILURE, 0, gettext("multiple output files specified")), ((0) ? (void)0 : __builtin_unreachable())))); outfile = optarg; break; case RANDOM_SOURCE_OPTION: if (random_source && !(strcmp(random_source, optarg) == 0)) ((!!sizeof(struct { _Static_assert(SORT_FAILURE, "verify_expr (" "SORT_FAILURE" ", " "(error (SORT_FAILURE, 0, gettext (\"multiple " "random sources specified\")), assume (false))" ")"); int _gl_dummy; })) ? ((error(SORT_FAILURE, 0, gettext("multiple random sources specified")), ((0) ? (void)0 : __builtin_unreachable()))) : ((error(SORT_FAILURE, 0, gettext("multiple random sources specified")), ((0) ? (void)0 : __builtin_unreachable())))); random_source = optarg; break; case 's': stable = 1; break; case 'S': specify_sort_size(oi, c, optarg); break; case 't': { char newtab = optarg[0]; if (!newtab) ((!!sizeof(struct { _Static_assert(SORT_FAILURE, "verify_expr (" "SORT_FAILURE" ", " "(error (SORT_FAILURE, 0, gettext " "(\"empty tab\")), assume (false))" ")"); int _gl_dummy; })) ? ((error(SORT_FAILURE, 0, gettext("empty tab")), ((0) ? (void)0 : __builtin_unreachable()))) : ((error(SORT_FAILURE, 0, gettext("empty tab")), ((0) ? (void)0 : __builtin_unreachable())))); if (optarg[1]) { if ((strcmp(optarg, "\\0") == 0)) newtab = '\0'; else { ((!!sizeof(struct { _Static_assert( SORT_FAILURE, "verify_expr (" "SORT_FAILURE" ", " "(error (SORT_FAILURE, 0, gettext (\"multi-character tab " "%s\"), quote (optarg)), assume (false))" ")"); int _gl_dummy; })) ? ((error(SORT_FAILURE, 0, gettext("multi-character tab %s"), quote(optarg)), ((0) ? (void)0 : __builtin_unreachable()))) : ((error(SORT_FAILURE, 0, gettext("multi-character tab %s"), quote(optarg)), ((0) ? (void)0 : __builtin_unreachable())))); } } if (tab != TAB_DEFAULT && tab != newtab) ((!!sizeof(struct { _Static_assert(SORT_FAILURE, "verify_expr (" "SORT_FAILURE" ", " "(error (SORT_FAILURE, 0, gettext (\"incompatible " "tabs\")), assume (false))" ")"); int _gl_dummy; })) ? ((error(SORT_FAILURE, 0, gettext("incompatible tabs")), ((0) ? (void)0 : __builtin_unreachable()))) : ((error(SORT_FAILURE, 0, gettext("incompatible tabs")), ((0) ? (void)0 : __builtin_unreachable())))); tab = newtab; } break; case 'T': add_temp_dir(optarg); break; case PARALLEL_OPTION: nthreads = specify_nthreads(oi, c, optarg); break; case 'u': unique = 1; break; case 'y': if (optarg == argv[optind - 1]) { char const *p; for (p = optarg; ((unsigned int)(*p) - '0' <= 9); p++) continue; optind -= (*p != '\0'); } break; case 'z': eolchar = 0; break; case GETOPT_HELP_CHAR: usage(0); break; ; case GETOPT_VERSION_CHAR: version_etc(stdout, "sort", "GNU coreutils", Version, ("Mike Haertel"), ("Paul Eggert"), (char *)((void *)0)); exit(0); break; ; default: usage(SORT_FAILURE); } } if (files_from) { if (nfiles) { error(0, 0, gettext("extra operand %s"), quotearg_style(shell_escape_always_quoting_style, files[0])); fprintf(stderr, "%s\n", gettext("file operands cannot be combined with --files0-from")); usage(SORT_FAILURE); } FILE *stream = xfopen(files_from, "r"); readtokens0_init(&tok); if (!readtokens0(stream, &tok)) ((!!sizeof(struct { _Static_assert( SORT_FAILURE, "verify_expr (" "SORT_FAILURE" ", " "(error (SORT_FAILURE, 0, gettext (\"cannot read file names from " "%s\"), quotearg_style (shell_escape_always_quoting_style, " "files_from)), assume (false))" ")"); int _gl_dummy; })) ? ((error(SORT_FAILURE, 0, gettext("cannot read file names from %s"), quotearg_style(shell_escape_always_quoting_style, files_from)), ((0) ? (void)0 : __builtin_unreachable()))) : ((error(SORT_FAILURE, 0, gettext("cannot read file names from %s"), quotearg_style(shell_escape_always_quoting_style, files_from)), ((0) ? (void)0 : __builtin_unreachable())))); xfclose(stream, files_from); if (tok.n_tok) { free(files); files = tok.tok; nfiles = tok.n_tok; for (size_t i = 0; i < nfiles; i++) { if ((strcmp(files[i], "-") == 0)) ((!!sizeof(struct { _Static_assert( SORT_FAILURE, "verify_expr (" "SORT_FAILURE" ", " "(error (SORT_FAILURE, 0, gettext (\"when reading file names " "from stdin, \" \"no file name of %s allowed\"), " "quotearg_style (shell_escape_always_quoting_style, " "files[i])), assume (false))" ")"); int _gl_dummy; })) ? ((error(SORT_FAILURE, 0, gettext("when reading file names from stdin, " "no file name of %s allowed"), quotearg_style(shell_escape_always_quoting_style, files[i])), ((0) ? (void)0 : __builtin_unreachable()))) : ((error(SORT_FAILURE, 0, gettext("when reading file names from stdin, " "no file name of %s allowed"), quotearg_style(shell_escape_always_quoting_style, files[i])), ((0) ? (void)0 : __builtin_unreachable())))) ; else if (files[i][0] == '\0') { unsigned long int file_number = i + 1; ((!!sizeof(struct { _Static_assert( SORT_FAILURE, "verify_expr (" "SORT_FAILURE" ", " "(error (SORT_FAILURE, 0, gettext (\"%s:%lu: invalid " "zero-length file name\"), quotearg_n_style_colon (0, " "shell_escape_quoting_style, files_from), file_number), assume " "(false))" ")"); int _gl_dummy; })) ? ((error(SORT_FAILURE, 0, gettext("%s:%lu: invalid zero-length file name"), quotearg_n_style_colon(0, shell_escape_quoting_style, files_from), file_number), ((0) ? (void)0 : __builtin_unreachable()))) : ((error(SORT_FAILURE, 0, gettext("%s:%lu: invalid zero-length file name"), quotearg_n_style_colon(0, shell_escape_quoting_style, files_from), file_number), ((0) ? (void)0 : __builtin_unreachable())))) ; } } } else ((!!sizeof(struct { _Static_assert( SORT_FAILURE, "verify_expr (" "SORT_FAILURE" ", " "(error (SORT_FAILURE, 0, gettext (\"no input from %s\"), " "quotearg_style (shell_escape_always_quoting_style, files_from)), " "assume (false))" ")"); int _gl_dummy; })) ? ((error(SORT_FAILURE, 0, gettext("no input from %s"), quotearg_style(shell_escape_always_quoting_style, files_from)), ((0) ? (void)0 : __builtin_unreachable()))) : ((error(SORT_FAILURE, 0, gettext("no input from %s"), quotearg_style(shell_escape_always_quoting_style, files_from)), ((0) ? (void)0 : __builtin_unreachable())))); } for (key = keylist; key; key = key->next) { if (default_key_compare(key) && !key->reverse) { key->ignore = gkey.ignore; key->translate = gkey.translate; key->skipsblanks = gkey.skipsblanks; key->skipeblanks = gkey.skipeblanks; key->month = gkey.month; key->numeric = gkey.numeric; key->general_numeric = gkey.general_numeric; key->human_numeric = gkey.human_numeric; key->version = gkey.version; key->random = gkey.random; key->reverse = gkey.reverse; } need_random |= key->random; } if (!keylist && !default_key_compare(&gkey)) { gkey_only = 1; insertkey(&gkey); need_random |= gkey.random; } check_ordering_compatibility(); if (debug) { if (checkonly || outfile) { static char opts[] = "X --debug"; opts[0] = (checkonly ? checkonly : 'o'); incompatible_options(opts); } if (locale_ok) locale_ok = !!setlocale(3, ""); if (!locale_ok) error(0, 0, "%s", gettext("failed to set locale")); if (hard_LC_COLLATE) error(0, 0, gettext("text ordering performed using %s sorting rules"), quote(setlocale(3, ((void *)0)))); else error(0, 0, "%s", gettext("text ordering performed using simple byte comparison")); key_warnings(&gkey, gkey_only); } reverse = gkey.reverse; if (need_random) random_md5_state_init(random_source); if (temp_dir_count == 0) { char const *tmp_dir = getenv("TMPDIR"); add_temp_dir(tmp_dir ? tmp_dir : "/tmp"); } if (nfiles == 0) { nfiles = 1; free(files); files = xmalloc(sizeof *files); *files = (char *)"-"; } if (0 < sort_size) sort_size = (((sort_size) > ((nmerge * (2 + sizeof(struct line))))) ? (sort_size) : ((nmerge * (2 + sizeof(struct line))))); if (checkonly) { if (nfiles > 1) ((!!sizeof(struct { _Static_assert( SORT_FAILURE, "verify_expr (" "SORT_FAILURE" ", " "(error (SORT_FAILURE, 0, gettext (\"extra operand %s not allowed " "with -%c\"), quotearg_style (shell_escape_always_quoting_style, " "files[1]), checkonly), assume (false))" ")"); int _gl_dummy; })) ? ((error( SORT_FAILURE, 0, gettext("extra operand %s not allowed with -%c"), quotearg_style(shell_escape_always_quoting_style, files[1]), checkonly), ((0) ? (void)0 : __builtin_unreachable()))) : ((error( SORT_FAILURE, 0, gettext("extra operand %s not allowed with -%c"), quotearg_style(shell_escape_always_quoting_style, files[1]), checkonly), ((0) ? (void)0 : __builtin_unreachable())))); if (outfile) { static char opts[] = {0, 'o', 0}; opts[0] = checkonly; incompatible_options(opts); } exit(check(files[0], checkonly) ? 0 : SORT_OUT_OF_ORDER); } check_inputs(files, nfiles); check_output(outfile); if (mergeonly) { struct sortfile *sortfiles = xcalloc(nfiles, sizeof *sortfiles); for (size_t i = 0; i < nfiles; ++i) sortfiles[i].name = files[i]; merge(sortfiles, 0, nfiles, outfile); } else { if (!nthreads) { unsigned long int np = num_processors(NPROC_CURRENT_OVERRIDABLE); nthreads = (((np) < (DEFAULT_MAX_THREADS)) ? (np) : (DEFAULT_MAX_THREADS)); } size_t nthreads_max = (18446744073709551615UL) / (2 * sizeof(struct merge_node)); nthreads = (((nthreads) < (nthreads_max)) ? (nthreads) : (nthreads_max)); sort(files, nfiles, outfile, nthreads); } if (have_read_stdin && rpl_fclose(stdin) == (-1)) sort_die(gettext("close failed"), "-"); return 0; }
undefined8 main(int param_1, undefined8 *param_2) { bool bVar1; byte bVar2; bool bVar3; bool bVar4; char cVar5; int iVar6; uint uVar7; char *pcVar8; char *pcVar9; lconv *plVar10; long *plVar11; undefined8 uVar12; long lVar13; ulong uVar14; long in_FS_OFFSET; bool bVar15; undefined8 uVar16; char local_338; bool local_336; char local_333; int local_330; long *local_328; char *local_320; char *local_318; ulong local_310; ulong local_308; undefined8 *local_300; char *local_2f8; char *local_2f0; ulong local_2e8; char *local_2e0; ulong local_2d8; ulong local_2d0; undefined local_288[80]; undefined8 local_238[4]; undefined8 local_218; undefined8 local_210; undefined local_208; undefined local_207; undefined local_206; byte local_205; undefined local_204; undefined local_203; undefined local_202; undefined local_201; undefined local_200; undefined4 local_1e8; undefined4 uStack484; undefined8 *local_1e0; sigaction local_c8; undefined local_22; undefined local_21; long local_20; local_20 = *(long *)(in_FS_OFFSET + 0x28); local_330 = 0; local_338 = '\0'; bVar3 = false; local_318 = (char *)0x0; local_336 = false; local_310 = 0; local_308 = 0; pcVar8 = getenv("POSIXLY_CORRECT"); iVar6 = posix2_version(); if ((iVar6 < 0x30db0) || (0x31068 < iVar6)) { bVar1 = true; } else { bVar1 = false; } local_2f8 = (char *)0x0; local_2f0 = (char *)0x0; set_program_name(*param_2); pcVar9 = setlocale(6, ""); bVar15 = pcVar9 != (char *)0x0; bindtextdomain("coreutils"); textdomain("coreutils"); initialize_exit_failure(2); hard_LC_COLLATE = hard_locale(3); hard_LC_TIME = hard_locale(2); plVar10 = localeconv(); decimal_point = *plVar10->decimal_point; if ((decimal_point == '\0') || (plVar10->decimal_point[1] != '\0')) { decimal_point = '.'; } thousands_sep = (int)*plVar10->thousands_sep; if ((thousands_sep != 0) && (plVar10->thousands_sep[1] != '\0')) { thousands_sep_ignored = 1; } if ((thousands_sep == 0) || (plVar10->thousands_sep[1] != '\0')) { thousands_sep = 0x80; } have_read_stdin = '\0'; inittables(); sigemptyset((sigset_t *)caught_signals); for (local_2e8 = 0; local_2e8 < 0xb; local_2e8 = local_2e8 + 1) { sigaction(*(int *)(sig_8531 + local_2e8 * 4), (sigaction *)0x0, &local_c8); if (local_c8.__sigaction_handler != (code *)0x1) { sigaddset((sigset_t *)caught_signals, *(int *)(sig_8531 + local_2e8 * 4)); } } local_c8.__sigaction_handler = sighandler; local_c8.sa_mask.__val[0] = caught_signals._0_8_; local_c8.sa_mask.__val[1] = caught_signals._8_8_; local_c8.sa_mask.__val[2] = caught_signals._16_8_; local_c8.sa_mask.__val[3] = caught_signals._24_8_; local_c8.sa_mask.__val[4] = caught_signals._32_8_; local_c8.sa_mask.__val[5] = caught_signals._40_8_; local_c8.sa_mask.__val[6] = caught_signals._48_8_; local_c8.sa_mask.__val[7] = caught_signals._56_8_; local_c8.sa_mask.__val[8] = caught_signals._64_8_; local_c8.sa_mask.__val[9] = caught_signals._72_8_; local_c8.sa_mask.__val[10] = caught_signals._80_8_; local_c8.sa_mask.__val[11] = caught_signals._88_8_; local_c8.sa_mask.__val[12] = caught_signals._96_8_; local_c8.sa_mask.__val[13] = caught_signals._104_8_; local_c8.sa_mask.__val[14] = caught_signals._112_8_; local_c8.sa_mask.__val[15] = caught_signals._120_8_; local_c8.sa_flags = 0; for (local_2e8 = 0; local_2e8 < 0xb; local_2e8 = local_2e8 + 1) { iVar6 = sigismember((sigset_t *)caught_signals, *(int *)(sig_8531 + local_2e8 * 4)); if (iVar6 != 0) { sigaction(*(int *)(sig_8531 + local_2e8 * 4), &local_c8, (sigaction *)0x0); } } signal(0x11, (__sighandler_t)0x0); atexit(exit_cleanup); key_init(local_238); local_238[0] = 0xffffffffffffffff; local_300 = (undefined8 *)xnmalloc((long)param_1, 8); LAB_00109d73: do { local_1e8 = 0xffffffff; if ((local_330 != -1) && (((pcVar8 == (char *)0x0 || (local_308 == 0)) || (((bVar1 && ((((local_338 == '\0' && (param_1 != optind)) && (*(char *)param_2[optind] == '-')) && (*(char *)(param_2[optind] + 1) == 'o')))) && ((*(char *)(param_2[optind] + 2) != '\0' || (param_1 != optind + 1)))))))) { uVar16 = 0x109e8b; local_330 = getopt_long(param_1, param_2, short_options, long_options, &local_1e8); if (local_330 != -1) { if (local_330 < 0x88) { if (local_330 < 1) { if (local_330 == -0x83) { LAB_0010a9d9: version_etc(stdout, &DAT_0010cb05, "GNU coreutils", Version, "Mike Haertel", "Paul Eggert", 0, uVar16); exit(0); } if (local_330 == -0x82) { uVar16 = 0x10a9d9; usage(0); goto LAB_0010a9d9; } } else { cVar5 = (char)local_330; switch (local_330) { case 1: local_328 = (long *)0x0; if (*optarg == '+') { if (((param_1 == optind) || (*(char *)param_2[optind] != '-')) || (9 < (int)*(char *)(param_2[optind] + 1) - 0x30U)) { bVar4 = false; } else { bVar4 = true; } if ((!bVar4) || (pcVar8 != (char *)0x0)) { bVar2 = 0; } else { bVar2 = 1; } bVar1 = (bool)(bVar1 | bVar2); if (bVar1) { local_328 = (long *)key_init(local_288); local_320 = (char *)parse_field_count(optarg + 1, local_328, 0); if ((local_320 != (char *)0x0) && (*local_320 == '.')) { local_320 = (char *)parse_field_count(local_320 + 1, local_328 + 1, 0); } if ((*local_328 == 0) && (local_328[1] == 0)) { *local_328 = -1; } if ((local_320 == (char *)0x0) || (pcVar9 = (char *)set_ordering(local_320, local_328, 0), *pcVar9 != '\0')) { local_328 = (long *)0x0; } else { if (bVar4) { lVar13 = param_2[optind]; optind = optind + 1; local_320 = (char *)parse_field_count( lVar13 + 1, local_328 + 2, "invalid number after \'-\'"); if (local_320 == (char *)0x0) { __assert_fail("s", "src/sort.c", 0x1161, (char *)&__PRETTY_FUNCTION___8546); } if (*local_320 == '.') { local_320 = (char *)parse_field_count( local_320 + 1, local_328 + 3, "invalid number after \'.\'"); } if ((local_328[3] == 0) && (local_328[2] != 0)) { local_328[2] = local_328[2] + -1; } pcVar9 = (char *)set_ordering(local_320, local_328, 1); if (*pcVar9 != '\0') { badfieldspec(lVar13, "stray character in field spec"); } } *(undefined *)((long)local_328 + 0x39) = 1; insertkey(); } } } if (local_328 == (long *)0x0) { local_300[local_308] = optarg; local_308 = local_308 + 1; } goto LAB_00109d73; case 0x53: specify_sort_size(local_1e8, (int)cVar5, optarg); goto LAB_00109d73; case 0x54: add_temp_dir(); goto LAB_00109d73; case 0x6b: plVar11 = (long *)key_init(local_288); local_320 = (char *)parse_field_count( optarg, plVar11, "invalid number at field start"); lVar13 = *plVar11; *plVar11 = lVar13 + -1; if (lVar13 == 0) { badfieldspec(optarg, "field number is zero"); } if (*local_320 == '.') { local_320 = (char *)parse_field_count( local_320 + 1, plVar11 + 1, "invalid number after \'.\'"); lVar13 = plVar11[1]; plVar11[1] = lVar13 + -1; if (lVar13 == 0) { badfieldspec(optarg, "character offset is zero"); } } if ((*plVar11 == 0) && (plVar11[1] == 0)) { *plVar11 = -1; } local_320 = (char *)set_ordering(local_320, plVar11, 0); if (*local_320 == ',') { local_320 = (char *)parse_field_count( local_320 + 1, plVar11 + 2, "invalid number after \',\'"); lVar13 = plVar11[2]; plVar11[2] = lVar13 + -1; if (lVar13 == 0) { badfieldspec(optarg, "field number is zero"); } if (*local_320 == '.') { local_320 = (char *)parse_field_count( local_320 + 1, plVar11 + 3, "invalid number after \'.\'"); } local_320 = (char *)set_ordering(local_320, plVar11, 1); } else { plVar11[2] = -1; plVar11[3] = 0; } if (*local_320 != '\0') { badfieldspec(optarg, "stray character in field spec"); } insertkey(); goto LAB_00109d73; case 0x6d: bVar3 = true; goto LAB_00109d73; case 0x6f: if ((local_2f0 != (char *)0x0) && (iVar6 = strcmp(local_2f0, optarg), iVar6 != 0)) { uVar16 = gettext("multiple output files specified"); error(2, 0, uVar16); } local_2f0 = optarg; goto LAB_00109d73; case 0x73: stable = 1; goto LAB_00109d73; case 0x74: local_333 = *optarg; if (local_333 == '\0') { uVar16 = gettext("empty tab"); error(2, 0, uVar16); } if (optarg[1] != '\0') { iVar6 = strcmp(optarg, "\\0"); if (iVar6 != 0) { uVar16 = quote(optarg); uVar12 = gettext("multi-character tab %s"); error(2, 0, uVar12, uVar16); } local_333 = '\0'; } if ((tab != 0x80) && (local_333 != tab)) { uVar16 = gettext("incompatible tabs"); error(2, 0, uVar16); } tab = (int)local_333; goto LAB_00109d73; case 0x75: unique = 1; goto LAB_00109d73; case 0x79: if ((char *)param_2[(long)optind + -1] == optarg) { for (local_2e0 = optarg; (int)*local_2e0 - 0x30U < 10; local_2e0 = local_2e0 + 1) { } optind = optind - (uint)(*local_2e0 != '\0'); } goto LAB_00109d73; case 0x7a: eolchar = 0; goto LAB_00109d73; case 0x80: if (optarg == (char *)0x0) { local_330 = 99; } else { lVar13 = __xargmatch_internal("--check", optarg, check_args, "CCcgeneral-numeric", 1, argmatch_die, 1, uVar16); local_330 = (int)"CCcgeneral-numeric"[lVar13]; } case 0x43: case 99: if ((local_338 != '\0') && (local_330 != local_338)) { incompatible_options(); } local_338 = (char)local_330; goto LAB_00109d73; case 0x81: if ((compress_program != (char *)0x0) && (iVar6 = strcmp(compress_program, optarg), iVar6 != 0)) { uVar16 = gettext("multiple compress programs specified"); error(2, 0, uVar16); } compress_program = optarg; goto LAB_00109d73; case 0x82: debug = '\x01'; goto LAB_00109d73; case 0x83: local_2f8 = optarg; goto LAB_00109d73; case 0x84: specify_nmerge(local_1e8, (int)cVar5, optarg); goto LAB_00109d73; case 0x85: if ((local_318 != (char *)0x0) && (iVar6 = strcmp(local_318, optarg), iVar6 != 0)) { uVar16 = gettext("multiple random sources specified"); error(2, 0, uVar16); } local_318 = optarg; goto LAB_00109d73; case 0x86: lVar13 = __xargmatch_internal("--sort", optarg, sort_args, "ghMnRVwaiting for %s [-d]", 1, argmatch_die, 1, uVar16); local_330 = (int)"ghMnRVwaiting for %s [-d]"[lVar13]; case 0x4d: case 0x52: case 0x56: case 0x62: case 100: case 0x66: case 0x67: case 0x68: case 0x69: case 0x6e: case 0x72: local_22 = (undefined)local_330; local_21 = 0; set_ordering(&local_22, local_238, 2); goto LAB_00109d73; case 0x87: local_310 = specify_nthreads(local_1e8, (int)cVar5, optarg); goto LAB_00109d73; } } } usage(); goto LAB_00109d73; } } if (param_1 <= optind) { if (local_2f8 != (char *)0x0) { if (local_308 != 0) { uVar16 = quotearg_style(4, *local_300); uVar12 = gettext("extra operand %s"); error(0, 0, uVar12, uVar16); } uVar16 = xfopen(local_2f8, &DAT_0010ce4c); readtokens0_init(&local_1e8); cVar5 = readtokens0(uVar16, &local_1e8); if (cVar5 != '\x01') { uVar16 = quotearg_style(4, local_2f8); uVar12 = gettext("cannot read file names from %s"); error(2, 0, uVar12, uVar16); } xfclose(uVar16, local_2f8); if (CONCAT44(uStack484, local_1e8) == 0) { uVar16 = quotearg_style(4, local_2f8); uVar12 = gettext("no input from %s"); error(2, 0, uVar12, uVar16); } free(local_300); local_300 = local_1e0; local_308 = CONCAT44(uStack484, local_1e8); for (local_2d8 = 0; local_2d8 < local_308; local_2d8 = local_2d8 + 1) { iVar6 = strcmp((char *)local_1e0[local_2d8], "-"); if (iVar6 == 0) { uVar16 = quotearg_style(4, local_1e0[local_2d8]); uVar12 = gettext("when reading file names from stdin, no file name " "of %s allowed"); error(2, 0, uVar12, uVar16); } if (*(char *)local_1e0[local_2d8] == '\0') { uVar16 = quotearg_n_style_colon(0, 3, local_2f8); uVar12 = gettext("%s:%lu: invalid zero-length file name"); error(2, 0, uVar12, uVar16, local_2d8 + 1); } } } for (local_328 = (long *)keylist; local_328 != (long *)0x0; local_328 = *(long **)((long)local_328 + 0x40)) { cVar5 = default_key_compare(local_328); if ((cVar5 != '\0') && (*(char *)((long)local_328 + 0x37) != '\x01')) { *(undefined8 *)((long)local_328 + 0x20) = local_218; *(undefined8 *)((long)local_328 + 0x28) = local_210; *(undefined *)((long)local_328 + 0x30) = local_208; *(undefined *)((long)local_328 + 0x31) = local_207; *(undefined *)((long)local_328 + 0x36) = local_202; *(undefined *)((long)local_328 + 0x32) = local_206; *(undefined *)((long)local_328 + 0x34) = local_204; *(undefined *)((long)local_328 + 0x35) = local_203; *(undefined *)((long)local_328 + 0x38) = local_200; *(byte *)((long)local_328 + 0x33) = local_205; *(undefined *)((long)local_328 + 0x37) = local_201; } local_336 = (*(byte *)((long)local_328 + 0x33) | local_336) != 0; } if ((keylist == 0) && (cVar5 = default_key_compare(local_238), cVar5 != '\x01')) { insertkey(local_238); local_336 = (local_205 | local_336) != 0; } check_ordering_compatibility(); if (debug != '\0') { if ((local_338 != '\0') || (local_2f0 != (char *)0x0)) { if (local_338 == '\0') { local_338 = 'o'; } opts_8619[0] = local_338; incompatible_options(opts_8619); } if (bVar15) { pcVar8 = setlocale(3, ""); bVar15 = pcVar8 != (char *)0x0; } if (!bVar15) { uVar16 = gettext("failed to set locale"); error(0, 0, &DAT_0010d79c, uVar16); } if (hard_LC_COLLATE != '\0') { pcVar8 = setlocale(3, (char *)0x0); uVar16 = quote(pcVar8); uVar12 = gettext("text ordering performed using %s sorting rules"); error(0, 0, uVar12, uVar16); } uVar16 = gettext("text ordering performed using simple byte comparison"); error(0, 0, &DAT_0010d79c, uVar16); } reverse = local_201; if (local_336 != false) { random_md5_state_init(local_318); } if (temp_dir_count == 0) { pcVar8 = getenv("TMPDIR"); if (pcVar8 == (char *)0x0) { pcVar8 = "/tmp"; } add_temp_dir(pcVar8); } if (local_308 == 0) { local_308 = 1; free(local_300); local_300 = (undefined8 *)xmalloc(8); *local_300 = &DAT_0010cd3b; } if ((sort_size != 0) && (sort_size <= (ulong)nmerge * 0x22)) { sort_size = (ulong)nmerge * 0x22; } if (local_338 == '\0') { check_inputs(local_300, local_308); check_output(local_2f0); if (bVar3) { lVar13 = xcalloc(local_308, 0x10); for (local_2d0 = 0; local_2d0 < local_308; local_2d0 = local_2d0 + 1) { *(undefined8 *)(lVar13 + local_2d0 * 0x10) = local_300[local_2d0]; } merge(lVar13, 0, local_308, local_2f0); } else { if (local_310 == 0) { uVar14 = num_processors(2); local_310 = 8; if (uVar14 < 9) { local_310 = uVar14; } } if (0xfffffffffffffe < local_310) { local_310 = 0xffffffffffffff; } sort(local_300, local_308, local_2f0, local_310); } if ((have_read_stdin != '\0') && (iVar6 = rpl_fclose(stdin), iVar6 == -1)) { uVar16 = gettext("close failed"); sort_die(uVar16, &DAT_0010cd3b); } if (local_20 != *(long *)(in_FS_OFFSET + 0x28)) { __stack_chk_fail(); } return 0; } if (1 < local_308) { uVar16 = quotearg_style(4, local_300[1]); uVar12 = gettext("extra operand %s not allowed with -%c"); error(2, 0, uVar12, uVar16, (int)local_338); } if (local_2f0 != (char *)0x0) { opts_8623._0_1_ = local_338; incompatible_options(&opts_8623); } uVar7 = check(*local_300, (int)local_338); exit((uVar7 ^ 1) & 0xff); } lVar13 = (long)optind; optind = optind + 1; local_300[local_308] = param_2[lVar13]; local_308 = local_308 + 1; } while (true); }
coreutils
ghidra
void load_history() { char *hf; set_if_not("HISTSIZE", "500"); sv_histsize("HISTSIZE"); set_if_not("HISTFILESIZE", get_string_value("HISTSIZE")); sv_histsize("HISTFILESIZE"); hf = get_string_value("HISTFILE"); if (hf && *hf && file_exists(hf)) { read_history(hf); history_lines_in_file = history_lines_read_from_file; using_history(); } }
void load_history(void) { int iVar1; undefined8 uVar2; char *pcVar3; set_if_not("HISTSIZE", &DAT_0010146b); sv_histsize("HISTSIZE"); uVar2 = get_string_value("HISTSIZE"); set_if_not("HISTFILESIZE", uVar2); sv_histsize("HISTFILESIZE"); pcVar3 = (char *)get_string_value("HISTFILE"); if ((pcVar3 != (char *)0x0) && (*pcVar3 != '\0')) { iVar1 = file_exists(pcVar3); if (iVar1 != 0) { read_history(pcVar3); history_lines_in_file = history_lines_read_from_file; using_history(); } } return; }
bash
ghidra
terminal_overwrite(EditLine *el, const wchar_t *cp, size_t n) { if (n == 0) return; if (n > (size_t)el->el_terminal.t_size.h) { return; } do { terminal__putc(el, *cp++); el->el_cursor.h++; } while (--n); if (el->el_cursor.h >= el->el_terminal.t_size.h) { if (((el)->el_terminal.t_flags & 0x080)) { el->el_cursor.h = 0; if (el->el_cursor.v + 1 < el->el_terminal.t_size.v) el->el_cursor.v++; if (((el)->el_terminal.t_flags & 0x100)) { wchar_t c; if ((c = el->el_display[el->el_cursor.v][el->el_cursor.h]) != '\0') { terminal_overwrite(el, &c, (size_t)1); while (el->el_display[el->el_cursor.v][el->el_cursor.h] == ((wint_t)-1)) el->el_cursor.h++; } else { terminal__putc(el, ' '); el->el_cursor.h = 1; } } } else el->el_cursor.h = el->el_terminal.t_size.h - 1; } }
unsigned long terminal_overwrite(long a1, unsigned int *a2, unsigned long a3) { unsigned int *v3; unsigned long v5; unsigned int v7; unsigned long v8; v5 = a3; v8 = __readfsqword(0x28u); if (a3 && a3 <= *(int *)(a1 + 144)) { do { v3 = a2++; terminal__putc(a1, *v3); ++*(_DWORD *)(a1 + 48); --v5; } while (v5); if (*(_DWORD *)(a1 + 48) >= *(_DWORD *)(a1 + 144)) { if ((*(_DWORD *)(a1 + 152) & 0x80) != 0) { *(_DWORD *)(a1 + 48) = 0; if (*(_DWORD *)(a1 + 52) + 1 < *(_DWORD *)(a1 + 148)) ++*(_DWORD *)(a1 + 52); if ((*(_DWORD *)(a1 + 152) & 0x100) != 0) { v7 = *(_DWORD *)(*(_QWORD *)(*(_QWORD *)(a1 + 56) + 8LL * *(int *)(a1 + 52)) + 4LL * *(int *)(a1 + 48)); if (v7) { terminal_overwrite(a1, &v7, 1uLL); while (*(_DWORD *)(*(_QWORD *)(*(_QWORD *)(a1 + 56) + 8LL * *(int *)(a1 + 52)) + 4LL * *(int *)(a1 + 48)) == -1) ++*(_DWORD *)(a1 + 48); } else { terminal__putc(a1, 0x20u); *(_DWORD *)(a1 + 48) = 1; } } } else { *(_DWORD *)(a1 + 48) = *(_DWORD *)(a1 + 144) - 1; } } } return __readfsqword(0x28u) ^ v8; }
libedit
ida
static _Bool do_statfs(char const *filename, char const *format) { struct statfs statfsbuf; if ((strcmp(filename, "-") == 0)) { error(0, 0, gettext("using %s to denote standard input does not work" " in file system mode"), quotearg_style(shell_escape_always_quoting_style, filename)); return 0; } if (statfs(filename, &statfsbuf) != 0) { error(0, (*__errno_location()), gettext("cannot read file system information for %s"), quotearg_style(shell_escape_always_quoting_style, filename)); return 0; } _Bool fail = print_it(format, -1, filename, print_statfs, &statfsbuf); return !fail; }
int do_statfs(char *a0, unsigned int a1) { char v0; char v1; unsigned long long v3; unsigned int v4; unsigned long long v5; if (!strcmp(a0, "-")) { v3 = quotearg_style(0x4, a0); error(0x0, 0x0, gettext("using %s to denote standard input does not work in file " "system mode")); v4 = 0; return v4; } else if (!statfs(a0, &v1, &v1)) { v0 = print_it(a1, 0xffffffff, a0, print_statfs, &v1); v4 = !(v0); return v4; } else { v5 = quotearg_style(0x4, a0); error(0x0, *(__errno_location()), gettext("cannot read file system information for %s")); v4 = 0; return v4; } }
coreutils
angr_sailr
_Bool pred_execdir (const char *pathname, struct stat *stat_buf, struct predicate *pred_ptr) { (void)&pathname; return impl_pred_exec(state.rel_pathname, stat_buf, pred_ptr); }
long long pred_execdir(unsigned long a0, unsigned long long a1, unsigned long long a2) { unsigned long v0; v0 = a0; return impl_pred_exec(strcmp, a1, a2, a1); }
findutils
angr_sailr
static void print_explain(FILE *f) { fprintf(f, "Usage: ... bridge_slave [ fdb_flush ]\n" " [ state STATE ]\n" " [ priority PRIO ]\n" " [ cost COST ]\n" " [ guard {on | off} ]\n" " [ hairpin {on | off} ]\n" " [ fastleave {on | off} ]\n" " [ root_block {on | off} ]\n" " [ learning {on | off} ]\n" " [ flood {on | off} ]\n" " [ proxy_arp {on | off} ]\n" " [ proxy_arp_wifi {on | off} ]\n" " [ mcast_router MULTICAST_ROUTER ]\n" " [ mcast_fast_leave {on | off} ]\n" " [ mcast_flood {on | off} ]\n" " [ bcast_flood {on | off} ]\n" " [ mcast_to_unicast {on | off} ]\n" " [ group_fwd_mask MASK ]\n" " [ neigh_suppress {on | off} ]\n" " [ vlan_tunnel {on | off} ]\n" " [ isolated {on | off} ]\n" " [ locked {on | off} ]\n" " [ backup_port DEVICE ] [ nobackup_port ]\n"); }
int print_explain(FILE *a1) { return fprintf(a1, "Usage: ... bridge_slave [ fdb_flush ]\n" "\t\t\t[ state STATE ]\n" "\t\t\t[ priority PRIO ]\n" "\t\t\t[ cost COST ]\n" "\t\t\t[ guard {on | off} ]\n" "\t\t\t[ hairpin {on | off} ]\n" "\t\t\t[ fastleave {on | off} ]\n" "\t\t\t[ root_block {on | off} ]\n" "\t\t\t[ learning {on | off} ]\n" "\t\t\t[ flood {on | off} ]\n" "\t\t\t[ proxy_arp {on | off} ]\n" "\t\t\t[ proxy_arp_wifi {on | off} ]\n" "\t\t\t[ mcast_router MULTICAST_ROUTER ]\n" "\t\t\t[ mcast_fast_leave {on | off} ]\n" "\t\t\t[ mcast_flood {on | off} ]\n" "\t\t\t[ bcast_flood {on | off} ]\n" "\t\t\t[ mcast_to_unicast {on | off} ]\n" "\t\t\t[ group_fwd_mask MASK ]\n" "\t\t\t[ neigh_suppress {on | off} ]\n" "\t\t\t[ vlan_tunnel {on | off} ]\n" "\t\t\t[ isolated {on | off} ]\n" "\t\t\t[ locked {on | off} ]\n" "\t\t\t[ backup_port DEVICE ] [ nobackup_port ]\n"); }
iproute2-6.0.0
ida
static int pkcs11_fetch_x509_pubkey(struct pkcs11_provider *p, CK_ULONG slotidx, CK_OBJECT_HANDLE *obj, struct sshkey **keyp, char **labelp) { CK_ATTRIBUTE cert_attr[3]; CK_SESSION_HANDLE session; CK_FUNCTION_LIST *f = ((void *)0); CK_RV rv; X509 *x509 = ((void *)0); X509_NAME *x509_name = ((void *)0); EVP_PKEY *evp; RSA *rsa = ((void *)0); EC_KEY *ec = ((void *)0); struct sshkey *key = ((void *)0); int i; int nid; const u_char *cp; char *subject = ((void *)0); *keyp = ((void *)0); *labelp = ((void *)0); memset(&cert_attr, 0, sizeof(cert_attr)); cert_attr[0].type = (0x102); cert_attr[1].type = (0x101); cert_attr[2].type = (0x11); session = p->slotinfo[slotidx].session; f = p->function_list; rv = f->C_GetAttributeValue(session, *obj, cert_attr, 3); if (rv != (0)) { sshlog("ssh-pkcs11.c", __func__, 949, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "C_GetAttributeValue failed: %lu", rv); return -1; } if (cert_attr[1].ulValueLen == 0 || cert_attr[2].ulValueLen == 0) { sshlog("ssh-pkcs11.c", __func__, 960, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "invalid attribute length"); return -1; } for (i = 0; i < 3; i++) if (cert_attr[i].ulValueLen > 0) cert_attr[i].pValue = xcalloc(1, cert_attr[i].ulValueLen); rv = f->C_GetAttributeValue(session, *obj, cert_attr, 3); if (rv != (0)) { sshlog("ssh-pkcs11.c", __func__, 972, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "C_GetAttributeValue failed: %lu", rv); goto out; } cp = cert_attr[1].pValue; if ((x509_name = d2i_X509_NAME(((void *)0), &cp, cert_attr[1].ulValueLen)) == ((void *)0) || (subject = X509_NAME_oneline(x509_name, ((void *)0), 0)) == ((void *)0)) subject = xstrdup("invalid subject"); X509_NAME_free(x509_name); cp = cert_attr[2].pValue; if ((x509 = d2i_X509(((void *)0), &cp, cert_attr[2].ulValueLen)) == ((void *)0)) { sshlog("ssh-pkcs11.c", __func__, 986, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "d2i_x509 failed"); goto out; } if ((evp = X509_get_pubkey(x509)) == ((void *)0)) { sshlog("ssh-pkcs11.c", __func__, 991, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "X509_get_pubkey failed"); goto out; } if (EVP_PKEY_get_base_id(evp) == 6) { if (EVP_PKEY_get0_RSA(evp) == ((void *)0)) { sshlog("ssh-pkcs11.c", __func__, 997, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "invalid x509; no rsa key"); goto out; } if ((rsa = RSAPublicKey_dup(EVP_PKEY_get0_RSA(evp))) == ((void *)0)) { sshlog("ssh-pkcs11.c", __func__, 1001, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "RSAPublicKey_dup failed"); goto out; } if (pkcs11_rsa_wrap(p, slotidx, &cert_attr[0], rsa)) goto out; key = sshkey_new(KEY_UNSPEC); if (key == ((void *)0)) { sshlog("ssh-pkcs11.c", __func__, 1010, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "sshkey_new failed"); goto out; } key->rsa = rsa; key->type = KEY_RSA; key->flags |= 0x0001; rsa = ((void *)0); } else if (EVP_PKEY_get_base_id(evp) == 408) { if (EVP_PKEY_get0_EC_KEY(evp) == ((void *)0)) { sshlog("ssh-pkcs11.c", __func__, 1021, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "invalid x509; no ec key"); goto out; } if ((ec = EC_KEY_dup(EVP_PKEY_get0_EC_KEY(evp))) == ((void *)0)) { sshlog("ssh-pkcs11.c", __func__, 1025, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "EC_KEY_dup failed"); goto out; } nid = sshkey_ecdsa_key_to_nid(ec); if (nid < 0) { sshlog("ssh-pkcs11.c", __func__, 1031, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "couldn't get curve nid"); goto out; } if (pkcs11_ecdsa_wrap(p, slotidx, &cert_attr[0], ec)) goto out; key = sshkey_new(KEY_UNSPEC); if (key == ((void *)0)) { sshlog("ssh-pkcs11.c", __func__, 1040, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "sshkey_new failed"); goto out; } key->ecdsa = ec; key->ecdsa_nid = nid; key->type = KEY_ECDSA; key->flags |= 0x0001; ec = ((void *)0); } else { sshlog("ssh-pkcs11.c", __func__, 1051, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "unknown certificate key type"); goto out; } out: for (i = 0; i < 3; i++) free(cert_attr[i].pValue); X509_free(x509); RSA_free(rsa); EC_KEY_free(ec); if (key == ((void *)0)) { free(subject); return -1; } *keyp = key; *labelp = subject; return 0; }
int pkcs11_fetch_x509_pubkey(unsigned long long a0[17], unsigned int a1, unsigned long long *a2, unsigned long long *a3, unsigned long long *a4) { unsigned long v0; unsigned int v1; unsigned int v2; unsigned long long v3; void *v4; void *v5; void *v6; void *v7; unsigned long v8; void *v9; void *v10; unsigned long long v11; unsigned long v12; unsigned long long v13; char v14; char v15; char v16; unsigned long long v17; char v18; char v19; unsigned long long v20; char v21; char v22; unsigned long long v24; v9 = 0; v4 = 0; v10 = 0; v5 = 0; v6 = 0; v7 = 0; v8 = 0; *(a3) = 0; *(a4) = 0; memset(&v14, 0x0, 0x48); v14 = 258; v17 = 257; v20 = 17; v11 = *((a1 * 224 + a0[16] + 208)); v9 = a0[2]; v12 = v9->field_c8(v11, *(a2), &v14, 3, v9->field_c8); if (v12) { v0 = v12; sshlog("ssh-pkcs11.c", "pkcs11_fetch_x509_pubkey", 0x3b5, 0x0, 0x2, 0x0, "C_GetAttributeValue failed: %lu"); v24 = -1; } else { if (*(&v19) && *(&v22)) { for (v1 = 0; v1 <= 2; v1 = __addvsi3(v1, 0x1)) { if (*(&(&v16)[16 * v1 + 8 * v1])) *(&(&v15)[24 * v1]) = xcalloc(0x1, *(&(&v16)[24 * v1])); } v12 = v9->field_c8(v11, *(a2), &v14, 3, v9->field_c8); if (v12) { v0 = v12; sshlog("ssh-pkcs11.c", "pkcs11_fetch_x509_pubkey", 0x3cc, 0x0, 0x2, 0x0, "C_GetAttributeValue failed: %lu"); } else { v3 = *(&v18); v10 = d2i_X509_NAME(0x0, &v3, *(&v19)); if (v10) v8 = X509_NAME_oneline(v10, 0x0, 0x0); if (!v8 || !v10) v8 = xstrdup("invalid subject"); X509_NAME_free(v10); v3 = *(&v21); v4 = d2i_X509(0x0, &v3, *(&v22)); if (!v4) { sshlog("ssh-pkcs11.c", "pkcs11_fetch_x509_pubkey", 0x3da, 0x0, 0x2, 0x0, "d2i_x509 failed"); } else { v13 = X509_get_pubkey(v4); if (!v13) { sshlog("ssh-pkcs11.c", "pkcs11_fetch_x509_pubkey", 0x3df, 0x0, 0x2, 0x0, "X509_get_pubkey failed"); } else if (EVP_PKEY_get_base_id(v13) == 6) { v24 = EVP_PKEY_get0_RSA(v13); if (!v24) { sshlog("ssh-pkcs11.c", "pkcs11_fetch_x509_pubkey", 0x3e5, 0x0, 0x2, 0x0, "invalid x509; no rsa key"); } else { v5 = RSAPublicKey_dup(EVP_PKEY_get0_RSA(v13)); if (!v5) { sshlog("ssh-pkcs11.c", "pkcs11_fetch_x509_pubkey", 0x3e9, 0x0, 0x2, 0x0, "RSAPublicKey_dup failed"); } else { v24 = pkcs11_rsa_wrap(a0, a1, &v14, v5); if (!v24) { v7 = sshkey_new(0xe); if (!v7) { sshlog("ssh-pkcs11.c", "pkcs11_fetch_x509_pubkey", 0x3f2, 0x0, 0x2, 0x0, "sshkey_new failed"); } else { *(&v7[8]) = v5; *(v7) = 0; *(&v7[4]) = v7[4] | 1; v5 = 0; } } } } } else { v24 = EVP_PKEY_get_base_id(v13); if (v24 == 408) { v24 = EVP_PKEY_get0_EC_KEY(v13); if (!v24) { sshlog("ssh-pkcs11.c", "pkcs11_fetch_x509_pubkey", 0x3fd, 0x0, 0x2, 0x0, "invalid x509; no ec key"); } else { v6 = EC_KEY_dup(EVP_PKEY_get0_EC_KEY(v13)); if (!v6) { sshlog("ssh-pkcs11.c", "pkcs11_fetch_x509_pubkey", 0x401, 0x0, 0x2, 0x0, "EC_KEY_dup failed"); } else { v2 = sshkey_ecdsa_key_to_nid(v6); if (v2 < 0) { sshlog("ssh-pkcs11.c", "pkcs11_fetch_x509_pubkey", 0x407, 0x0, 0x2, 0x0, "couldn't get curve nid"); } else { v24 = pkcs11_ecdsa_wrap(a0, a1, &v14, v6); if (!v24) { v7 = sshkey_new(0xe); if (!v7) { sshlog("ssh-pkcs11.c", "pkcs11_fetch_x509_pubkey", 0x410, 0x0, 0x2, 0x0, "sshkey_new failed"); } else { *(&v7[32]) = v6; *(&v7[24]) = v2; *(v7) = 2; *(&v7[4]) = v7[4] | 1; v6 = 0; } } } } } } else { sshlog("ssh-pkcs11.c", "pkcs11_fetch_x509_pubkey", 0x41b, 0x0, 0x2, 0x0, "unknown certificate key type"); } } } } for (v1 = 0; v1 <= 2; v1 = __addvsi3(v1, 0x1)) { free(*(&(&v15)[24 * v1])); } X509_free(v4); RSA_free(v5); EC_KEY_free(v6); if (!v7) { free(v8); v24 = -1; } else { *(a3) = v7; *(a4) = v8; v24 = 0; } } if (!*(&v19) || !*(&v22)) { sshlog("ssh-pkcs11.c", "pkcs11_fetch_x509_pubkey", 0x3c0, 0x0, 0x2, 0x0, "invalid attribute length"); v24 = -1; } } return v24; }
openssh-portable
angr_dream
static void opt_rename_setup(void) { if (opt_rename >= 0) return; opt_rename = 0; warning(gettext("please specify --no-rename explicitly, the default " "will change to --rename in 1.20.x")); }
long opt_rename_setup() { long result; char *v1; result = (unsigned int)opt_rename; if (opt_rename < 0) { opt_rename = 0; v1 = gettext("please specify --no-rename explicitly, the default will " "change to --rename in 1.20.x"); return warning(v1); } return result; }
dpkg
ida
static int e2fsck_journal_sb_csum_verify(journal_t *j, journal_superblock_t *jsb) { __u32 provided, calculated; if (!jbd2_journal_has_csum_v2or3(j)) return 1; provided = ext2fs_swab32((__u32)(__be32)(jsb->s_checksum)); calculated = e2fsck_journal_sb_csum(jsb); return provided == calculated; }
_BOOL8 e2fsck_journal_sb_csum_verify(long a1, long a2) { int v3; if (!jbd2_journal_has_csum_v2or3(a1)) return 1LL; v3 = ext2fs_swab32(*(unsigned int *)(a2 + 252)); return v3 == (unsigned int)e2fsck_journal_sb_csum(a2); }
e2fsprogs-1.46.5
ida
static _Bool parse_exec(const struct parser_table *entry, char **argv, int *arg_ptr) { return insert_exec_ok("-exec", entry, argv, arg_ptr); }
long long parse_exec(unsigned long long a0, unsigned long long a1, unsigned long long a2) { return insert_exec_ok("-exec", a0, a1, a2); }
findutils
angr_phoenix
int rl_call_last_kbd_macro(int count, int ignore) { if (current_macro == 0) _rl_abort_internal(); if ((rl_readline_state & (0x0001000))) { rl_ding(); current_macro[--current_macro_index] = '\0'; return 0; } while (count--) _rl_with_macro_input( strcpy((char *)xmalloc(1 + strlen(current_macro)), (current_macro))); return 0; }
long rl_call_last_kbd_macro(int a1) { const char *v2; size_t v3; char *v4; char *v5; if (!current_macro) rl_abort_internal(); if ((rl_readline_state & 0x1000) != 0) { rl_ding(); current_macro[--current_macro_index] = 0; return 0LL; } else { while (a1--) { v2 = current_macro; v3 = strlen(current_macro); v4 = (char *)xmalloc(v3 + 1); v5 = strcpy(v4, v2); rl_with_macro_input(v5); } return 0LL; } }
bash
ida
char *argv_assemble(int argc, char **argv) { int i, j, ws, r; char c, *ret; struct sshbuf *buf, *arg; if ((buf = sshbuf_new()) == ((void *)0) || (arg = sshbuf_new()) == ((void *)0)) sshfatal("misc.c", __func__, 2068, 1, SYSLOG_LEVEL_FATAL, ((void *)0), "sshbuf_new failed"); for (i = 0; i < argc; i++) { ws = 0; sshbuf_reset(arg); for (j = 0; argv[i][j] != '\0'; j++) { r = 0; c = argv[i][j]; switch (c) { case ' ': case '\t': ws = 1; r = sshbuf_put_u8(arg, c); break; case '\\': case '\'': case '"': if ((r = sshbuf_put_u8(arg, '\\')) != 0) break; default: r = sshbuf_put_u8(arg, c); break; } if (r != 0) sshfatal("misc.c", __func__, 2093, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "sshbuf_put_u8"); } if ((i != 0 && (r = sshbuf_put_u8(buf, ' ')) != 0) || (ws != 0 && (r = sshbuf_put_u8(buf, '"')) != 0) || (r = sshbuf_putb(buf, arg)) != 0 || (ws != 0 && (r = sshbuf_put_u8(buf, '"')) != 0)) sshfatal("misc.c", __func__, 2099, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "assemble"); } if ((ret = malloc(sshbuf_len(buf) + 1)) == ((void *)0)) sshfatal("misc.c", __func__, 2102, 1, SYSLOG_LEVEL_FATAL, ((void *)0), "malloc failed"); memcpy(ret, sshbuf_ptr(buf), sshbuf_len(buf)); ret[sshbuf_len(buf)] = '\0'; sshbuf_free(buf); sshbuf_free(arg); return ret; }
long long argv_assemble(unsigned long a0, unsigned long long *a1) { char v0; unsigned int v1; unsigned int v2; unsigned int v3; unsigned int v4; unsigned long long v5; unsigned long long v6; char *v7; unsigned long long v8; char v9; unsigned long long v11; v5 = sshbuf_new(); if (v5) { v6 = sshbuf_new(); if (!(!v6)) goto LABEL_405706; } sshfatal("misc.c", "argv_assemble", 0x814, 0x1, 0x1, 0x0, "sshbuf_new failed"); LABEL_405706: v1 = 0; while (true) { if (v1 >= a0) break; v3 = 0; sshbuf_reset(v6); v2 = 0; while (true) { v11 = a1[v1]; if (!*((v2 + a1[v1]))) break; v4 = 0; v0 = *((v2 + a1[v1])); if (v0 != 92) { if (!(v0 <= 92)) goto LABEL_4057c4; if (v0 != 39) { if (!(v0 <= 39)) goto LABEL_4057c4; if (v0 != 34 && v0 <= 34) { if (v0 != 9 && !(v0 == 32)) goto LABEL_4057c4; v3 = 1; v4 = sshbuf_put_u8(v6, v0, v0); goto LABEL_4057df; } } } v4 = sshbuf_put_u8(v6, 0x5c, a1[v1]); if (!(!v4)) goto LABEL_4057df; LABEL_4057c4: v4 = sshbuf_put_u8(v6, v0, v0); LABEL_4057df: if (v4) { v8 = "sshbuf_put_u8"; sshfatal("misc.c", "argv_assemble", 0x82d, 0x1, 0x1, ssh_err(v4), *(&v9)); } v2 = __addvsi3(v2, 0x1); } if (v1) { v4 = sshbuf_put_u8(v5, 0x20, v11); if (!(!v4)) goto LABEL_4058dc; } if (v3) { v4 = sshbuf_put_u8(v5, 0x22, v11); if (!(!v4)) goto LABEL_4058dc; } v4 = sshbuf_putb(v5, v6, v6); if (!v4) { if (!v3) goto LABEL_40591d; v4 = sshbuf_put_u8(v5, 0x22, v11); if (!v4) goto LABEL_40591d; } LABEL_4058dc: v8 = "assemble"; sshfatal("misc.c", "argv_assemble", 0x833, 0x1, 0x1, ssh_err(v4), *(&v9)); LABEL_40591d: v1 = __addvsi3(v1, 0x1); } v7 = malloc(sshbuf_len(v5) + 1); if (!v7) { v8 = "malloc failed"; sshfatal("misc.c", "argv_assemble", 0x836, 0x1, 0x1, 0x0, *(&v9)); } memcpy(v7, sshbuf_ptr(v5), sshbuf_len(v5)); v7[sshbuf_len(v5)] = 0; sshbuf_free(v5); sshbuf_free(v6); return v7; }
openssh-portable
angr_phoenix
static int sshkey_parse_private2_pubkey(struct sshbuf *blob, int type, struct sshkey **keyp) { int r = -1; struct sshbuf *decoded = ((void *)0); struct sshkey *pubkey = ((void *)0); u_int nkeys = 0; if (keyp != ((void *)0)) *keyp = ((void *)0); if ((r = private2_uudecode(blob, &decoded)) != 0) goto out; if ((r = sshbuf_consume(decoded, sizeof("openssh-key-v1"))) != 0 || (r = sshbuf_get_string_direct(decoded, ((void *)0), ((void *)0))) != 0 || (r = sshbuf_get_string_direct(decoded, ((void *)0), ((void *)0))) != 0 || (r = sshbuf_get_string_direct(decoded, ((void *)0), ((void *)0))) != 0 || (r = sshbuf_get_u32(decoded, &nkeys)) != 0) goto out; if (nkeys != 1) { r = -4; goto out; } if ((r = sshkey_froms(decoded, &pubkey)) != 0) goto out; if (type != KEY_UNSPEC && sshkey_type_plain(type) != sshkey_type_plain(pubkey->type)) { r = -13; goto out; } r = 0; if (keyp != ((void *)0)) { *keyp = pubkey; pubkey = ((void *)0); } out: sshbuf_free(decoded); sshkey_free(pubkey); return r; }
int sshkey_parse_private2_pubkey(unsigned long long a0, unsigned long a1, unsigned long long *a2) { unsigned int v0; unsigned int v1; void *v2; void *v3; v1 = -1; v2 = 0; v3 = 0; v0 = 0; if (a2) *(a2) = 0; v1 = private2_uudecode(a0, &v2); if (v1) { LABEL_40b0ba: sshbuf_free(v2); sshkey_free(v3); } else { v1 = sshbuf_consume(v2, 0xf); if (v1) goto LABEL_40b0ba; v1 = sshbuf_get_string_direct(v2, 0x0, 0x0); if (v1) { sshbuf_free(v2); sshkey_free(v3); } else { v1 = sshbuf_get_string_direct(v2, 0x0, 0x0); if (v1) { goto LABEL_40b0ba; } else { v1 = sshbuf_get_string_direct(v2, 0x0, 0x0); if (v1) { sshbuf_free(v2); sshkey_free(v3); } else { v1 = sshbuf_get_u32(v2, &v0, &v0); if (v1) { sshbuf_free(v2); sshkey_free(v3); } else if (v0 == 1) { v1 = sshkey_froms(v2, &v3); if (v1) { sshbuf_free(v2); sshkey_free(v3); } else if (a1 == 14 || sshkey_type_plain(a1) == sshkey_type_plain(*(v3))) { v1 = 0; if (!a2) { sshbuf_free(v2); sshkey_free(v3); } else { *(a2) = v3; v3 = 0; sshbuf_free(v2); sshkey_free(v3); } } else { v1 = -13; sshbuf_free(v2); sshkey_free(v3); } } else { v1 = -0x4; sshbuf_free(v2); sshkey_free(v3); } } } } } return v1; }
openssh-portable
angr_sailr
static int print_nlmsg_tunnel(struct nlmsghdr *n, void *arg) { struct tnl_print_nlmsg_info *info = arg; struct ifinfomsg *ifi = ((void *)(((char *)n) + ((int)(((sizeof(struct nlmsghdr)) + 4U - 1) & ~(4U - 1))))); struct rtattr *tb[(__IFLA_MAX - 1) + 1]; const char *name, *n1; if (n->nlmsg_type != RTM_NEWLINK && n->nlmsg_type != RTM_DELLINK) return 0; if (n->nlmsg_len < ((sizeof(*ifi)) + ((int)(((sizeof(struct nlmsghdr)) + 4U - 1) & ~(4U - 1))))) return -1; if (preferred_family == 2) { switch (ifi->ifi_type) { case 768: case 778: case 776: break; default: return 0; } } else { switch (ifi->ifi_type) { case 769: case 823: break; default: return 0; } } parse_rtattr( tb, (__IFLA_MAX - 1), ((struct rtattr *)(((char *)(ifi)) + (((sizeof(struct ifinfomsg)) + 4U - 1) & ~(4U - 1)))), ((n)->nlmsg_len - ((((((sizeof(struct ifinfomsg))) + ((int)(((sizeof(struct nlmsghdr)) + 4U - 1) & ~(4U - 1))))) + 4U - 1) & ~(4U - 1)))); if (!tb[IFLA_IFNAME]) return 0; name = rta_getattr_str(tb[IFLA_IFNAME]); n1 = info->p1; if (n1[0] && strcmp(n1, name)) return 0; info->ifi = ifi; info->init(info); if (tnl_get_ioctl(name, info->p2)) return 0; if (!info->match(info)) return 0; info->print(info->p2); if (show_stats) { struct rtnl_link_stats64 s; if (get_rtnl_link_stats_rta(&s, tb) <= 0) return -1; tnl_print_stats(&s); } fputc('\n', stdout); return 0; }
long long print_nlmsg_tunnel(struct_0 *a0, unsigned long long a1[3]) { struct_1 *v0; char *v1; char *v2; char v3; char v4; char v5; unsigned long long v7; v0 = &a0[2].field_4; switch (a0->field_4) { case 16: case 17: if (a0->field_0 > 31) { if (preferred_family != 2) { switch (v0->field_2) { case 769: case 823: break; default: v7 = 0; return v7; } } else if (10 < v0->field_2 - 0x300) { v7 = 0; return v7; } else if (!((1 << ((v0->field_2 - 0x300) & 63)) & 1281)) { v7 = 0; return v7; } parse_rtattr(&v4, 0x3c, v0 + 4, a0->field_0 - 32); if (!*(&v5)) { v7 = 0; return v7; } v1 = rta_getattr_str(*(&v5)); v2 = a1[1]; if (*(v2) && strcmp(v2, v1)) { v7 = 0; return v7; } a1[0] = v0; a1[1](a1); if (tnl_get_ioctl(v1, a1[2])) { v7 = 0; return v7; } else if (!(a1[1 + 1](a1) ^ 1)) { a1[1 + 2](a1[2]); if (show_stats) { if (get_rtnl_link_stats_rta(&v3, &v4, &v4) > 0) { tnl_print_stats(&v3); } else { v7 = 4294967295; return v7; } } fputc(0xa, stdout); v7 = 0; return v7; } else { v7 = 0; return v7; } } else { v7 = 4294967295; return v7; } default: v7 = 0; return v7; } }
iproute2-6.0.0
angr_sailr
int sshkey_cert_copy(const struct sshkey *from_key, struct sshkey *to_key) { u_int i; const struct sshkey_cert *from; struct sshkey_cert *to; int r = -1; if (to_key == ((void *)0) || (from = from_key->cert) == ((void *)0)) return -10; if ((to = cert_new()) == ((void *)0)) return -2; if ((r = sshbuf_putb(to->certblob, from->certblob)) != 0 || (r = sshbuf_putb(to->critical, from->critical)) != 0 || (r = sshbuf_putb(to->extensions, from->extensions)) != 0) goto out; to->serial = from->serial; to->type = from->type; if (from->key_id == ((void *)0)) to->key_id = ((void *)0); else if ((to->key_id = strdup(from->key_id)) == ((void *)0)) { r = -2; goto out; } to->valid_after = from->valid_after; to->valid_before = from->valid_before; if (from->signature_key == ((void *)0)) to->signature_key = ((void *)0); else if ((r = sshkey_from_private(from->signature_key, &to->signature_key)) != 0) goto out; if (from->signature_type != ((void *)0) && (to->signature_type = strdup(from->signature_type)) == ((void *)0)) { r = -2; goto out; } if (from->nprincipals > 256) { r = -10; goto out; } if (from->nprincipals > 0) { if ((to->principals = calloc(from->nprincipals, sizeof(*to->principals))) == ((void *)0)) { r = -2; goto out; } for (i = 0; i < from->nprincipals; i++) { to->principals[i] = strdup(from->principals[i]); if (to->principals[i] == ((void *)0)) { to->nprincipals = i; r = -2; goto out; } } } to->nprincipals = from->nprincipals; cert_free(to_key->cert); to_key->cert = to; to = ((void *)0); r = 0; out: cert_free(to); return r; }
int sshkey_cert_copy(struct_0 *a0, struct_0 *a1) { unsigned int v0; unsigned int v1; void *v2; struct_1 *v3; unsigned int v5; v1 = -1; if (!a1) { LABEL_403a57: v5 = -10; } else { v3 = a0->field_80; if (!v3) goto LABEL_403a57; v2 = cert_new(); if (!v2) { v5 = -2; } else { v1 = sshbuf_putb(*(v2), v3->field_0, v3->field_0); if (!v1) { v1 = sshbuf_putb(v2[64], v3->field_40, v3->field_40); if (!v1) { v1 = sshbuf_putb(v2[72], v3->field_48, v3->field_48); if (!v1) { *(&v2[16]) = v3->field_10; *(&v2[8]) = v3->field_8; if (!v3->field_18) { *(&v2[24]) = 0; } else { *(&v2[24]) = strdup(v3->field_18); if (!v2[24]) { v1 = -2; goto LABEL_403d23; } } *(&v2[48]) = v3->field_30; *(&v2[56]) = v3->field_38; if (!v3->field_50) { *(&v2[80]) = 0; } else { v1 = sshkey_from_private(v3->field_50, v2 + 80); if (!(!v1)) goto LABEL_403d23; } if (v3->field_58) { *(&v2[88]) = strdup(v3->field_58); if (!v2[88]) { v1 = -2; goto LABEL_403d23; } } if (v3->field_20 > 0x100) { v1 = -10; } else { if (v3->field_20) { *(&v2[40]) = calloc(v3->field_20, 0x8); if (!v2[40]) { v1 = -2; goto LABEL_403d23; } else { v0 = 0; while (true) { if (v0 >= v3->field_20) break; *((v2[40] + v0 * 8)) = strdup(*((v3->field_28 + v0 * 8))); if (!*((v2[40] + (v0 << 3)))) { *(&v2[32]) = v0; v1 = -2; goto LABEL_403d23; } else { v0 += 1; } } } } *(&v2[32]) = v3->field_20; cert_free(a1->field_80); a1->field_80 = v2; v2 = 0; v1 = 0; } } } } LABEL_403d23: cert_free(v2); v5 = v1; } } return v5; }
openssh-portable
angr_phoenix
static _Bool parse_true(const struct parser_table *entry, char **argv, int *arg_ptr) { struct predicate *our_pred; (void)argv; (void)arg_ptr; our_pred = insert_primary_noarg(entry); our_pred->need_stat = our_pred->need_type = 0; our_pred->est_success_rate = 1.0f; return 1; }
void parse_true(unsigned long long a0, unsigned long a1, unsigned long a2) { unsigned long v0; unsigned long v1; struct_0 *v2; unsigned long long v4; v1 = a1; v0 = a2; v2 = insert_primary_noarg(a0); v2->field_1b = 0; v2->field_1a = v2->field_1b; v2->field_24 = 0x3e99999a3f800000; v4 = 1; return; }
findutils
angr_phoenix
static off_t elseek(int fd, off_t offset, int whence, char const *filename) { off_t new_offset = lseek(fd, offset, whence); char buf[((((((sizeof(offset) * 8) - (!((__typeof__(offset))0 < (__typeof__(offset))-1))) * 146 + 484) / 485) + (!((__typeof__(offset))0 < (__typeof__(offset))-1))) + 1)]; if (new_offset < 0) error(0, (*__errno_location()), gettext(whence == 0 ? "%s: cannot seek to offset %s" : "%s: cannot seek to relative offset %s") , quotearg_n_style_colon(0, shell_escape_quoting_style, filename), offtostr(offset, buf)); return new_offset; }
int elseek(unsigned long a0, unsigned long a1, unsigned long a2, unsigned long long a3) { char v0; unsigned long v1; char v2; unsigned long long v4; unsigned long long v5; v1 = lseek(a0, a1, a2); if ((v1 - 0 >> 63)) { v4 = offtostr(a1, &v2, &v2); v5 = quotearg_n_style_colon(0x0, 0x3, a3); error(0x0, *(__errno_location()), gettext((!*(&v0) ? "%s: cannot seek to relative offset %s" : "%s: cannot seek to offset %s"))); return v1; } return v1; }
coreutils
angr_sailr
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_dream
void crypto_sign_ed25519_ref_fe25519_cmov( crypto_sign_ed25519_ref_fe25519 *r, const crypto_sign_ed25519_ref_fe25519 *x, unsigned char b) { int i; crypto_uint32 mask = b; mask = -mask; for (i = 0; i < 32; i++) r->v[i] ^= mask & (x->v[i] ^ r->v[i]); }
long long crypto_sign_ed25519_ref_fe25519_cmov(unsigned int *a0, unsigned int *a1, unsigned long a2) { char v0; unsigned int v1; unsigned int v2; unsigned long long v4; v0 = a2; v4 = v0; v2 = v0; v2 = -(v2); for (v1 = 0; v1 <= 31; v1 = v4) { a0[v1] = a0[v1] ^ (a0[v1] ^ a1[v1]) & v2; v4 = __addvsi3(v1, 0x1, v1); } return v4; }
openssh-portable
angr_dream
static _Bool user_match(const char *tok, const char *string) { struct group *group; char *at; at = strchr(tok + 1, '@'); if (((void *)0) != at) { *at = '\0'; return (user_match(tok, string) && from_match(at + 1, myhostname())); } else if (tok[0] == '@') { return (netgroup_match(tok + 1, (char *)0, string)); } else if (string_match(tok, string)) { return 1; } else if ((group = getgrnam(tok)) != ((void *)0)) { int i; for (i = 0; ((void *)0) != group->gr_mem[i]; i++) { if (strcasecmp(string, group->gr_mem[i]) == 0) { return 1; } } } return 0; }
bool user_match(const char *a1, const char *a2) { char *v2; bool v3; int i; char *v6; struct group *v7; v6 = strchr(a1 + 1, 64); if (v6) { *v6 = 0; v3 = 0; if (user_match(a1, a2)) { v2 = myhostname(); if (from_match(v6 + 1, v2)) return 1; } return v3; } else if (*a1 == 64) { return netgroup_match(a1 + 1, 0LL, a2); } else if (string_match(a1, a2)) { return 1; } else { v7 = getgrnam(a1); if (v7) { for (i = 0; v7->gr_mem[i]; ++i) { if (!strcasecmp(a2, v7->gr_mem[i])) return 1; } } return 0; } }
shadow
ida
static inline long double simple_round(long double val, enum round_type t) { intmax_t rval; intmax_t intmax_mul = val / (9223372036854775807L); val -= (long double)(9223372036854775807L) * intmax_mul; switch (t) { case round_ceiling: rval = simple_round_ceiling(val); break; case round_floor: rval = simple_round_floor(val); break; case round_from_zero: rval = simple_round_from_zero(val); break; case round_to_zero: rval = simple_round_to_zero(val); break; case round_nearest: rval = simple_round_nearest(val); break; default: return 0; } return (long double)(9223372036854775807L) * intmax_mul + rval; }
void simple_round(unsigned int a0, unsigned int a1, unsigned long a2, unsigned int a3, unsigned int a4, unsigned int a5, unsigned int v4, unsigned int a6) { int tmp_58; unsigned short v0; unsigned short v1; unsigned long v2; unsigned long v3; unsigned long long v5; [D] t7 = DIRTY 1 TODO(effects):: : amd64g_dirtyhelper_loadF80le( t15) if ([D] GetI(968 : I8x8)[t2, 0]){ [D] t1 = DIRTY 1 TODO(effects):: : amd64g_dirtyhelper_loadF80le(t2)[D] PutI( 904 : F64x8)[t4, 0] = t7[D] PutI(968 : I8x8)[t4, 0] = 0x01 } else { [D] t1 = DIRTY 1 TODO(effects):: : amd64g_dirtyhelper_loadF80le(t2)[D] PutI( 904 : F64x8)[t4, 0] = t7[D] PutI(968 : I8x8)[t4, 0] = 0x01 }[D] t1 = DIRTY 1 TODO(effects):: : amd64g_dirtyhelper_loadF80le( 0x0000000000405230) if ([D] GetI(968 : I8x8)[t2, 0]){ [D] t1 = DIRTY 1 TODO(effects):: : amd64g_dirtyhelper_loadF80le( 0x0000000000405230)[D] PutI(904 : F64x8)[t2, 0] = t5[D] PutI(968 : I8x8)[t2, 0] = 0x01 } else { [D] t1 = DIRTY 1 TODO(effects):: : amd64g_dirtyhelper_loadF80le( 0x0000000000405230)[D] PutI(904 : F64x8)[t2, 0] = t5[D] PutI(968 : I8x8)[t2, 0] = 0x01 }[D] PutI(904 : F64x8)[t23, 1] = t24[D] PutI(968 : I8x8)[t23, 1] = 0x01 [D] PutI(968 : I8x8)[t23, 0] = 0x00 v1 = [D] amd64g_create_fpucw(fpround<8>); v5 = v1; *(&v5) = (v1 >> 8) | 12; tmp_58 = v5; v0 = tmp_58; *(&v3) = ([D] GetI(968 : I8x8)[t74, 0] ? [D] GetI(904 : F64x8)[t74, 0] : nan); [D] PutI(968 : I8x8)[t74, 0] = 0x00 [D] PutI(904 : F64x8)[t95, 0] = t98[D] PutI(968 : I8x8)[t95, 0] = 0x01 [D] t15 = DIRTY 1 TODO(effects):: : amd64g_dirtyhelper_loadF80le(0x0000000000405230)[D] PutI( 904 : F64x8)[t109, 0] = t112[D] PutI(968 : I8x8)[t109, 0] = 0x01 [D] PutI(904 : F64x8)[t119, 1] = t120[D] PutI(968 : I8x8)[t119, 1] = 0x01 [D] PutI(968 : I8x8)[t119, 0] = 0x00 [D] t17 = DIRTY 1 TODO(effects):: : amd64g_dirtyhelper_loadF80le(t139)[D] PutI(904 : F64x8)[t141, 0] = t144[D] PutI(968 : I8x8)[t141, 0] = 0x01 [D] PutI(904 : F64x8)[t151, 1] = t152[D] PutI(968 : I8x8)[t151, 1] = 0x01 [D] PutI(968 : I8x8)[t151, 0] = 0x00 [D] t4294967295 = DIRTY 1 TODO(effects):: : amd64g_dirtyhelper_storeF80le(t171, t173)[D] PutI(968 : I8x8)[t177, 0] = 0x00 switch (a0) { case 0: *(&v2) = simple_round_ceiling(); break; case 1: *(&v2) = simple_round_floor(); break; case 2: *(&v2) = simple_round_from_zero(a0, a1, &g_40380c, a3, a4, a5, *(&v4), *(&a6)); break; case 3: *(&v2) = simple_round_to_zero(); break; case 4: *(&v2) = simple_round_nearest(); break; default: [D] PutI(904 : F64x8)[t0, 0] = t3[D] PutI(968 : I8x8)[t0, 0] = 0x01 return; } if ([D] GetI(968 : I8x8)[t2, 0]) { [D] PutI(904 : F64x8)[t3, 0] = t6[D] PutI(968 : I8x8)[t3, 0] = 0x01 } else { [D] PutI(904 : F64x8)[t3, 0] = t6[D] PutI(968 : I8x8)[t3, 0] = 0x01 } [D] t1 = DIRTY 1 TODO(effects):: : amd64g_dirtyhelper_loadF80le( 0x0000000000405230) if ([D] GetI(968 : I8x8)[t2, 0]){ [D] t1 = DIRTY 1 TODO(effects):: : amd64g_dirtyhelper_loadF80le( 0x0000000000405230)[D] PutI(904 : F64x8)[t2, 0] = t5[D] PutI(968 : I8x8)[t2, 0] = 0x01 } else { [D] t1 = DIRTY 1 TODO(effects):: : amd64g_dirtyhelper_loadF80le( 0x0000000000405230)[D] PutI(904 : F64x8)[t2, 0] = t5[D] PutI(968 : I8x8)[t2, 0] = 0x01 }[D] PutI(904 : F64x8)[t1, 1] = t2[D] PutI(968 : I8x8)[t1, 1] = 0x01 [D] PutI(968 : I8x8)[t1, 0] = 0x00 [D] PutI(904 : F64x8)[t23, 0] = t26[D] PutI(968 : I8x8)[t23, 0] = 0x01 [D] PutI(904 : F64x8)[t37, 1] = t38[D] PutI(968 : I8x8)[t37, 1] = 0x01 [D] PutI(968 : I8x8)[t37, 0] = 0x00 return; }
coreutils
angr_sailr
static void merge_lists(struct predlist lists[], int nlists, struct predlist *name_list, struct predlist *regex_list, struct predicate **last) { int i; static void (*mergefn)(struct predlist *, struct predicate **); mergefn = predlist_merge_sort; mergefn(name_list, last); mergefn(regex_list, last); for (i = 0; i < nlists; i++) mergefn(&lists[i], last); }
void merge_lists(unsigned long a0, unsigned long a1, unsigned long long a2, unsigned long long a3, unsigned long long a4) { unsigned int v0; unsigned long long v2; mergefn.5804 = predlist_merge_sort; *(4206936)(a2, a4, a2, a3); *(4206936)(a3, a4, a2, a3); v0 = 0; while (true) { v2 = v0; if (v0 >= a1) break; *(4206936)(v0 * 16 + a0, a4, a2, a3); v0 += 1; } return; }
findutils
angr_dream
static void dummy_print_help(struct link_util *lu, int argc, char **argv, FILE *f) { fprintf(f, "Usage: ... dummy\n"); }
void dummy_print_help(void) { FILE *in_RCX; fprintf(in_RCX, "Usage: ... dummy\n"); return; }
iproute2-6.0.0
ghidra
void auth_debug_add(const char *fmt, ...) { char buf[1024]; va_list args; int r; if (auth_debug == ((void *)0)) return; __builtin_va_start(args, fmt); vsnprintf(buf, sizeof(buf), fmt, args); __builtin_va_end(args); if ((r = sshbuf_put_cstring(auth_debug, buf)) != 0) sshfatal("auth.c", __func__, 581, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "sshbuf_put_cstring"); }
void auth_debug_add(undefined4 param_1, undefined4 param_2, undefined4 param_3, undefined4 param_4, undefined4 param_5, undefined4 param_6, undefined4 param_7, undefined4 param_8, char *param_9, undefined8 param_10, undefined8 param_11, undefined8 param_12, undefined8 param_13, undefined8 param_14) { char in_AL; undefined8 uVar1; char **ppcVar2; long in_FS_OFFSET; char *pcStack1288; undefined8 uStack1280; undefined auStack1272[8]; char *local_4f0; int local_4e4; undefined4 local_4e0; undefined4 local_4dc; undefined *local_4d8; undefined *local_4d0; char local_4c8[1032]; long local_c0; undefined local_b8[8]; undefined8 local_b0; undefined8 local_a8; undefined8 local_a0; undefined8 local_98; undefined8 local_90; undefined4 local_88; undefined4 local_78; undefined4 local_68; undefined4 local_58; undefined4 local_48; undefined4 local_38; undefined4 local_28; undefined4 local_18; if (in_AL != '\0') { local_88 = param_1; local_78 = param_2; local_68 = param_3; local_58 = param_4; local_48 = param_5; local_38 = param_6; local_28 = param_7; local_18 = param_8; } local_c0 = *(long *)(in_FS_OFFSET + 0x28); ppcVar2 = (char **)auStack1272; local_4f0 = param_9; local_b0 = param_10; local_a8 = param_11; local_a0 = param_12; local_98 = param_13; local_90 = param_14; if (auth_debug != 0) { local_4e0 = 8; local_4dc = 0x30; local_4d8 = &stack0x00000008; local_4d0 = local_b8; uStack1280 = 0x1016d0; vsnprintf(local_4c8, 0x400, param_9, &local_4e0); uStack1280 = 0x1016e9; local_4e4 = sshbuf_put_cstring(auth_debug, local_4c8); ppcVar2 = (char **)auStack1272; if (local_4e4 != 0) { uStack1280 = 0x101705; uVar1 = ssh_err(local_4e4); ppcVar2 = &pcStack1288; pcStack1288 = "sshbuf_put_cstring"; sshfatal("auth.c", "auth_debug_add", 0x245, 1, 1, uVar1); } } if (local_c0 != *(long *)(in_FS_OFFSET + 0x28)) { *(undefined8 *)((long)ppcVar2 + -8) = 0x101754; __stack_chk_fail(); } return; }
openssh-portable
ghidra
int strvec_remove(array, name) char **array, *name; { register int i, j; char *x; if (array == 0) return 0; for (i = 0; array[i]; i++) if (((name)[0] == (array[i])[0] && strcmp(name, array[i]) == 0)) { x = array[i]; for (j = i; array[j]; j++) array[j] = array[j + 1]; sh_xfree((x), "stringvec.c", 119); return 1; } return 0; }
long long strvec_remove(void *a0, char *a1) { char *v0; unsigned long long v2; void *v3; if (!a0) { v2 = 0; return v2; } for (v3 = 0; *((a0 + 0x8 * v3)); v3 = v3 + 1) { if (*(a1) == *(*((a0 + 0x8 * v3))) && !strcmp(a1, *((a0 + 0x8 * v3)))) { for (v0 = *((a0 + 0x8 * v3)); *((a0 + 0x8 * v3)); v3 = v3 + 1) { *((a0 + 0x8 * v3)) = *((8 + a0 + 0x8 * v3)); } sh_xfree(v0, "stringvec.c", 0x77); v2 = 1; return v2; } } v2 = 0; return v2; }
bash
angr_sailr
static int do_ipnh_bucket(int argc, char **argv) { if (argc < 1) return ipnh_bucket_list(0, ((void *)0)); if (!matches(*argv, "list") || !matches(*argv, "show") || !matches(*argv, "lst")) return ipnh_bucket_list(argc - 1, argv + 1); if (!matches(*argv, "get")) return ipnh_bucket_get(argc - 1, argv + 1); if (!matches(*argv, "help")) usage(); fprintf(stderr, "Command \"%s\" is unknown, try \"ip nexthop help\".\n", *argv); exit(-1); }
void do_ipnh_bucket(int param_1, undefined8 *param_2) { char cVar1; if (param_1 < 1) { ipnh_bucket_list(0, 0); } else { cVar1 = matches(*param_2, &DAT_0010619d); if (((cVar1 == '\x01') && (cVar1 = matches(*param_2, &DAT_001061a2), cVar1 == '\x01')) && (cVar1 = matches(*param_2, &DAT_001061a7), cVar1 == '\x01')) { cVar1 = matches(*param_2, &DAT_001061ab); if (cVar1 != '\x01') { ipnh_bucket_get(param_1 + -1, param_2 + 1); return; } cVar1 = matches(*param_2, &DAT_00106121); if (cVar1 != '\x01') { usage(); } fprintf(stderr, "Command \"%s\" is unknown, try \"ip nexthop help\".\n", *param_2); exit(-1); } ipnh_bucket_list(param_1 + -1, param_2 + 1); } return; }
iproute2-6.0.0
ghidra
_Bool pred_ipath (const char *pathname, struct stat *stat_buf, struct predicate *pred_ptr) { (void)stat_buf; if (fnmatch(pred_ptr->args.str, pathname, (1 << 4)) == 0) return (1); return (0); }
long long pred_ipath(char *a0, unsigned long a1, struct_0 *a2) { unsigned long v0; unsigned long long v2; v0 = a1; if (!fnmatch(a2->field_38, a0, 0x10)) v2 = 1; else v2 = 0; return v2; }
findutils
angr_phoenix
static int process_msg(struct nlmsghdr *n, void *arg) { FILE *fp = (FILE *)arg; struct genlmsghdr *ghdr; struct rtattr *attrs[(__TCP_METRICS_ATTR_MAX - 1) + 1], *a; const char *h; int len = n->nlmsg_len; inet_prefix daddr, saddr; int atype, stype; if (n->nlmsg_type != genl_family) return -1; len -= (((((sizeof(struct genlmsghdr)) + 4U - 1) & ~(4U - 1))) + ((int)(((sizeof(struct nlmsghdr)) + 4U - 1) & ~(4U - 1)))); if (len < 0) return -1; ghdr = ((void *)(((char *)n) + ((int)(((sizeof(struct nlmsghdr)) + 4U - 1) & ~(4U - 1))))); if (ghdr->cmd != TCP_METRICS_CMD_GET) return 0; parse_rtattr( attrs, (__TCP_METRICS_ATTR_MAX - 1), (void *)ghdr + (((sizeof(struct genlmsghdr)) + 4U - 1) & ~(4U - 1)), len); if (attrs[TCP_METRICS_ATTR_ADDR_IPV4]) { if (f.daddr.family && f.daddr.family != 2) return 0; a = attrs[TCP_METRICS_ATTR_ADDR_IPV4]; daddr.family = 2; atype = TCP_METRICS_ATTR_ADDR_IPV4; } else if (attrs[TCP_METRICS_ATTR_ADDR_IPV6]) { if (f.daddr.family && f.daddr.family != 10) return 0; a = attrs[TCP_METRICS_ATTR_ADDR_IPV6]; daddr.family = 10; atype = TCP_METRICS_ATTR_ADDR_IPV6; } else { return 0; } if (get_addr_rta(&daddr, a, daddr.family)) return 0; if (f.daddr.family && f.daddr.bitlen >= 0 && inet_addr_match(&daddr, &f.daddr, f.daddr.bitlen)) return 0; if (attrs[TCP_METRICS_ATTR_SADDR_IPV4]) { if (f.saddr.family && f.saddr.family != 2) return 0; a = attrs[TCP_METRICS_ATTR_SADDR_IPV4]; saddr.family = 2; stype = TCP_METRICS_ATTR_SADDR_IPV4; } else if (attrs[TCP_METRICS_ATTR_SADDR_IPV6]) { if (f.saddr.family && f.saddr.family != 10) return 0; a = attrs[TCP_METRICS_ATTR_SADDR_IPV6]; saddr.family = 10; stype = TCP_METRICS_ATTR_SADDR_IPV6; } else { saddr.family = 0; stype = 0; } if (saddr.family) { if (get_addr_rta(&saddr, a, saddr.family)) return 0; if (f.saddr.family && f.saddr.bitlen >= 0 && inet_addr_match(&saddr, &f.saddr, f.saddr.bitlen)) return 0; } if (f.flushb) { struct nlmsghdr *fn; struct { struct nlmsghdr n; struct genlmsghdr g; char buf[(((0) + 4U - 1) & ~(4U - 1)) + (128)]; } req2 = { .n = { .nlmsg_type = (genl_family), .nlmsg_flags = (0x01), .nlmsg_len = (((((sizeof(struct genlmsghdr)) + 4U - 1) & ~(4U - 1)) + (0)) + ((int)(((sizeof(struct nlmsghdr)) + 4U - 1) & ~(4U - 1)))), }, .g = { .cmd = (TCP_METRICS_CMD_DEL), .version = (0x1), }, }; addattr_l(&req2.n, sizeof(req2), atype, daddr.data, daddr.bytelen); if (saddr.family) addattr_l(&req2.n, sizeof(req2), stype, saddr.data, saddr.bytelen); if ((((f.flushp) + 4U - 1) & ~(4U - 1)) + req2.n.nlmsg_len > f.flushe) { if (flush_update()) return -1; } fn = (struct nlmsghdr *)(f.flushb + (((f.flushp) + 4U - 1) & ~(4U - 1))); memcpy(fn, &req2.n, req2.n.nlmsg_len); fn->nlmsg_seq = ++grth.seq; f.flushp = (((char *)fn) + req2.n.nlmsg_len) - f.flushb; f.flushed++; if (show_stats < 2) return 0; } open_json_object(((void *)0)); if (f.cmd & (0x0002 | 0x0004)) print_bool(PRINT_ANY, "deleted", "Deleted ", 1); h = format_host(daddr.family, daddr.bytelen, daddr.data); print_color_string(PRINT_ANY, ifa_family_color(daddr.family), "dst", "%s", h); a = attrs[TCP_METRICS_ATTR_AGE]; if (a) { __u64 val = rta_getattr_u64(a); double age = val / 1000.; print_float(PRINT_ANY, "age", " age %.03fsec", age); } a = attrs[TCP_METRICS_ATTR_TW_TS_STAMP]; if (a) { __s32 val = (__s32)rta_getattr_u32(a); __u32 tsval; char tw_ts[64]; a = attrs[TCP_METRICS_ATTR_TW_TSVAL]; tsval = a ? rta_getattr_u32(a) : 0; snprintf(tw_ts, sizeof(tw_ts), "%u/%d", tsval, val); print_string(PRINT_ANY, "tw_ts_stamp", " tw_ts %s ago", tw_ts); } if (attrs[TCP_METRICS_ATTR_VALS]) print_tcp_metrics(attrs[TCP_METRICS_ATTR_VALS]); a = attrs[TCP_METRICS_ATTR_FOPEN_MSS]; if (a) { print_uint(PRINT_ANY, "fopen_miss", " fo_mss %u", rta_getattr_u16(a)); } a = attrs[TCP_METRICS_ATTR_FOPEN_SYN_DROPS]; if (a) { __u16 syn_loss = rta_getattr_u16(a); double ts; a = attrs[TCP_METRICS_ATTR_FOPEN_SYN_DROP_TS]; ts = a ? rta_getattr_u64(a) : 0; print_uint(PRINT_ANY, "fopen_syn_drops", " fo_syn_drops %u", syn_loss); print_float(PRINT_ANY, "fopen_syn_drop_ts", "/%.03fusec ago", ts / 1000000.); } a = attrs[TCP_METRICS_ATTR_FOPEN_COOKIE]; if (a) { char cookie[32 + 1]; unsigned char *ptr = ((void *)(((char *)(a)) + ((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0)))); int i, max = ((int)((a)->rta_len) - ((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0))); if (max > 16) max = 16; cookie[0] = 0; for (i = 0; i < max; i++) sprintf(cookie + i + i, "%02x", ptr[i]); print_string(PRINT_ANY, "fo_cookie", " fo_cookie %s", cookie); } if (saddr.family) { const char *src; src = format_host(saddr.family, saddr.bytelen, saddr.data); print_string(PRINT_ANY, "source", " source %s", src); } print_string(PRINT_FP, ((void *)0), "\n", ""); close_json_object(); fflush(fp); return 0; }
long process_msg(long a1, FILE *a2) { int addr_rta; unsigned int v4; long v5; double v6; unsigned int v7; unsigned short v8; long v9; double v10; unsigned short v11; unsigned int v12; unsigned int v13; int i; int v15; int v16; unsigned int v17; long v18; _DWORD *dest; const char *v20; unsigned short *v21; long v22; char v23[8]; long v24; long v25; long v26; long v27; long v28; unsigned short *v29; long v30; long v31; long v32; unsigned short *v33; long v34; long v35; int src[40]; char v37[2]; unsigned short v38; unsigned short v39; _BYTE v40[264]; char v41[2]; unsigned short v42; unsigned short v43; _BYTE v44[264]; char s[72]; unsigned long v46; v46 = __readfsqword(0x28u); if (*(unsigned short *)(a1 + 4) != genl_family) return 0xFFFFFFFFLL; v16 = *(_DWORD *)a1 - 20; if (v16 < 0) return 0xFFFFFFFFLL; if (*(_BYTE *)(a1 + 16) != 1) return 0LL; parse_rtattr(v23, 13LL, a1 + 20, (unsigned int)v16); if (v24) { if (word_19A2 && word_19A2 != 2) return 0LL; v18 = v24; v39 = 2; v12 = 1; addr_rta = get_addr_rta(v37, v24, 2LL); } else { if (!v25) return 0LL; if (word_19A2 && word_19A2 != 10) return 0LL; v18 = v25; v39 = 10; v12 = 2; addr_rta = get_addr_rta(v37, v25, 10LL); } if (addr_rta) return 0LL; if (word_19A2 && word_19A0 >= 0 && (unsigned int)inet_addr_match(v37, &unk_199C, (unsigned int)word_19A0)) return 0LL; if (v34) { if (word_1AAA && word_1AAA != 2) return 0LL; v18 = v34; v43 = 2; v13 = 11; } else if (v35) { if (word_1AAA && word_1AAA != 10) return 0LL; v18 = v35; v43 = 10; v13 = 12; } else { v43 = 0; v13 = 0; } if (v43) { if ((unsigned int)get_addr_rta(v41, v18, v43)) return 0LL; if (word_1AAA && word_1AA8 >= 0 && (unsigned int)inet_addr_match(v41, &unk_1AA4, (unsigned int)word_1AA8)) return 0LL; } if (!qword_1988) goto LABEL_50; memset(src, 0, 148); src[0] = 20; LOWORD(src[1]) = genl_family; HIWORD(src[1]) = 1; LOWORD(src[4]) = 258; addattr_l(src, 148LL, v12, v40, v38); if (v43) addattr_l(src, 148LL, v13, v44, v42); if (src[0] + ((dword_1990 + 3) & 0xFFFFFFFC) > dword_1994 && (unsigned int)flush_update()) return 0xFFFFFFFFLL; dest = (_DWORD *)(qword_1988 + ((dword_1990 + 3) & 0xFFFFFFFC)); memcpy(dest, src, (unsigned int)src[0]); dest[2] = ++dword_195C; dword_1990 = (_DWORD)dest + src[0] - qword_1988; ++f; if (show_stats <= 1) return 0LL; LABEL_50: open_json_object(0LL); if ((dword_1998 & 6) != 0) print_bool(4u, (long)"deleted", (long)"Deleted ", 1u); v20 = (const char *)format_host(v39, v38, v40); v4 = ifa_family_color((unsigned char)v39); print_color_string(4LL, v4, "dst", "%s", v20); if (v26) { v5 = rta_getattr_u64(v26); if (v5 < 0) v6 = (double)(int)(v5 & 1 | ((unsigned long)v5 >> 1)) + (double)(int)(v5 & 1 | ((unsigned long)v5 >> 1)); else v6 = (double)(int)v5; print_float(4u, (long)"age", (long)" age %.03fsec", v6 / 1000.0); } if (v28) { v17 = rta_getattr_u32(v28); if (v27) v7 = rta_getattr_u32(v27); else v7 = 0; snprintf(s, 0x40uLL, "%u/%d", v7, v17); print_string(4u, (long)"tw_ts_stamp", " tw_ts %s ago", (long)s); } if (v29) print_tcp_metrics(v29); if (v30) { v8 = rta_getattr_u16(v30); print_uint(4u, (long)"fopen_miss", (long)" fo_mss %u", v8); } if (v31) { v11 = rta_getattr_u16(v31); if (v32) { v9 = rta_getattr_u64(v32); if (v9 < 0) v10 = (double)(int)(v9 & 1 | ((unsigned long)v9 >> 1)) + (double)(int)(v9 & 1 | ((unsigned long)v9 >> 1)); else v10 = (double)(int)v9; } else { v10 = 0.0; } print_uint(4u, (long)"fopen_syn_drops", (long)" fo_syn_drops %u", v11); print_float(4u, (long)"fopen_syn_drop_ts", (long)"/%.03fusec ago", v10 / 1000000.0); } if (v33) { v21 = v33 + 2; v15 = *v33 - 4; if (v15 > 16) v15 = 16; s[0] = 0; for (i = 0; i < v15; ++i) sprintf(&s[2 * i], "%02x", *((unsigned char *)v21 + i)); print_string(4u, (long)"fo_cookie", " fo_cookie %s", (long)s); } if (v43) { v22 = format_host(v43, v42, v44); print_string(4u, (long)"source", " source %s", v22); } print_string(1u, 0LL, "\n", (long)&unk_1DE9); close_json_object(1LL); fflush(a2); return 0LL; }
iproute2-6.0.0
ida
_Bool pred_context (const char *pathname, struct stat *stat_buf, struct predicate *pred_ptr) { char *scontext; int rv = (*options.x_getfilecon)(state.cwd_dir_fd, state.rel_pathname, &scontext); (void)stat_buf; if (rv < 0) { error(0, (*__errno_location()), gettext("getfilecon failed: %s"), safely_quote_err_filename(0, pathname)); return 0; } rv = (fnmatch(pred_ptr->args.scontext, scontext, 0) == 0); freecon(scontext); return rv; }
ulong pred_context(undefined8 param_1, undefined8 param_2, long param_3) { int iVar1; undefined8 uVar2; undefined8 uVar3; int *piVar4; ulong uVar5; long in_FS_OFFSET; char *local_28; long local_20; local_20 = *(long *)(in_FS_OFFSET + 0x28); iVar1 = (*_fputs)(___errno_location, _strcmp, &local_28); if (iVar1 < 0) { uVar2 = safely_quote_err_filename(0, param_1); uVar3 = gettext("getfilecon failed: %s"); piVar4 = __errno_location(); error(0, *piVar4, uVar3, uVar2); uVar5 = 0; } else { iVar1 = fnmatch(*(char **)(param_3 + 0x38), local_28, 0); uVar5 = freecon(local_28); uVar5 = uVar5 & 0xffffffffffffff00 | (ulong)(iVar1 == 0); } if (local_20 != *(long *)(in_FS_OFFSET + 0x28)) { __stack_chk_fail(); } return uVar5; }
findutils
ghidra
static __inline void _rs_random_u32(uint32_t *val) { u_char *keystream; _rs_stir_if_needed(sizeof(*val)); if (rs->rs_have < sizeof(*val)) _rs_rekey(((void *)0), 0); keystream = rsx->rs_buf + sizeof(rsx->rs_buf) - rs->rs_have; memcpy(val, keystream, sizeof(*val)); memset(keystream, 0, sizeof(*val)); rs->rs_have -= sizeof(*val); }
void _rs_random_u32(void *param_1) { void *__src; _rs_stir_if_needed(4); if (*rs < 4) { _rs_rekey(0, 0); } __src = (void *)((rsx + 0x440) - *rs); memcpy(param_1, __src, 4); memset(__src, 0, 4); *rs = *rs - 4; return; }
openssh-portable
ghidra
static void print_table_row(int num_width, int signum, int name_width, char const *signame) { char const *description = strsignal(signum); printf("%*d %-*s %s\n", num_width, signum, name_width, signame, description ? description : "?"); }
void print_table_row(unsigned long a0, unsigned long a1, unsigned long a2, unsigned long a3) { unsigned long v0; unsigned int v1; unsigned long v2; unsigned long long v4; v1 = a2; v0 = a3; v2 = strsignal(a1); v4 = printf("%*d %-*s %s\n", a0); return; }
coreutils
angr_dream
ct_visual_width(wchar_t c) { int t = ct_chr_class(c); switch (t) { case (-1): return 2; case (-2): return 1; case (-3): return 0; case (0): return wcwidth(c); case (-4): if (c > 0xffff) return 8; else return 7; default: return 0; } }
int ct_visual_width(unsigned long a0) { unsigned int v0; unsigned int v2; v0 = ct_chr_class(a0); switch (v0 + 4) { case 0: if (a0 <= 65535) { v2 = 7; break; } else { v2 = 8; break; } case 1: v2 = 0; break; case 2: v2 = 1; break; case 3: v2 = 2; break; case 4: v2 = wcwidth(a0); break; default: v2 = 0; break; } return v2; }
libedit
angr_phoenix
int validate_trigname(const char *const *argv) { const char *emsg; if (!argv[0] || argv[1]) badusage(gettext("--%s takes one <trigname> argument"), cipaction->olong); emsg = trig_name_is_illegal(argv[0]); if (emsg) ohshit(gettext("trigger name '%s' is invalid: %s"), argv[0], emsg); return 0; }
undefined8 validate_trigname(long *param_1) { long lVar1; undefined8 uVar2; long lVar3; undefined8 uVar4; if ((*param_1 == 0) || (param_1[1] != 0)) { uVar4 = *cipaction; uVar2 = gettext("--%s takes one <trigname> argument"); badusage(uVar2, uVar4); } lVar3 = trig_name_is_illegal(*param_1); if (lVar3 != 0) { lVar1 = *param_1; uVar4 = gettext("trigger name \'%s\' is invalid: %s"); ohshit(uVar4, lVar1, lVar3); } return 0; }
dpkg
ghidra
void request_stdin(const char *rpl_option) { if (stdin_used_by) do { if (error_hook) error_hook(); error(0, 0, gettext("Options '%s' and '%s' both want standard input"), stdin_used_by, rpl_option); usage(2); } while (0); stdin_used_by = rpl_option; }
void request_stdin(unsigned long long a0) { unsigned long long v1; if (stdin_used_by) { if (error_hook) *(5242888)(); error(0x0, 0x0, gettext("Options '%s' and '%s' both want standard input")); usage(0x2); } else { v1 = a0; stdin_used_by = a0; return; } }
tar
angr_dream
static _Bool netgroup_match(const char *group, const char *machine, const char *user) { static char *mydomain = (char *)0; if (mydomain == (char *)0) { static char domain[256 + 1]; getdomainname(domain, 256); mydomain = domain; } return (innetgr(group, machine, user, mydomain) != 0); }
bool netgroup_match(const char *a1, const char *a2, const char *a3) { if (!mydomain_6473) { getdomainname(domain_6474, 0x100uLL); mydomain_6473 = domain_6474; } return innetgr(a1, a2, a3, mydomain_6473) != 0; }
shadow
ida
static inline __u8 rta_getattr_u8(const struct rtattr *rta) { return *(__u8 *)(( void *)(((char *)(rta)) + ((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0)))); }
int rta_getattr_u8(struct_0 *a0) { return a0->field_4; }
iproute2-6.0.0
angr_dream
static inline __u8 rta_getattr_u8(const struct rtattr *rta) { return *(__u8 *)(( void *)(((char *)(rta)) + ((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0)))); }
int rta_getattr_u8(struct_0 *a0) { return a0->field_4; }
iproute2-6.0.0
angr_dream
gl_linked_indexof_from_to(gl_list_t list, size_t start_index, size_t end_index, const void *elt) { size_t count = list->count; if (!(start_index <= end_index && end_index <= count)) abort(); { gl_listelement_equals_fn equals = list->base.equals_fn; size_t index = start_index; gl_list_node_t node = list->root.next; for (; start_index > 0; start_index--) node = node->next; if (equals != ((void *)0)) { for (; index < end_index; node = node->next, index++) if (equals(elt, node->value)) return index; } else { for (; index < end_index; node = node->next, index++) if (elt == node->value) return index; } return (size_t)(-1); } }
long long gl_linked_indexof_from_to(unsigned long long a0[9], unsigned long long a1, unsigned long a2, unsigned long long a3) { unsigned long long v0; unsigned long long v1; unsigned long long v2[3]; unsigned long v3; unsigned long long v4; unsigned long long v6; v0 = a1; v3 = a0[8]; if (v0 <= a2 && a2 <= v3) { v4 = a0[1]; v1 = v0; for (v2[0] = a0[5]; v0; v0 -= 1) { v2[0] = v2[0]; } if (!v4) { while (true) { if (v1 >= a2) { v6 = -1; return v6; } else if (a3 != v2[2]) { v2[0] = v2[0]; v1 += 1; } else { v6 = v1; return v6; } } } else { for (; v1 < a2; v1 += 1) { if (!(stack_base)[16](a3, v2[2], v2[2], (stack_base)[16])) { v2[0] = v2[0]; } else { v6 = v1; return v6; } } v6 = -1; return v6; } } abort(); }
gnutls
angr_sailr
void usage(void) { fprintf(stderr, "usage: %s [-n] [-w] [-d] [-f] [-h] [-i]%s\n", progname, strcmp(progname, "halt") ? "" : " [-p]"); fprintf(stderr, "\t-n: don't sync before halting the system\n"); fprintf(stderr, "\t-w: only write a wtmp reboot record and exit.\n"); fprintf(stderr, "\t-d: don't write a wtmp record.\n"); fprintf(stderr, "\t-f: force halt/reboot, don't call shutdown.\n"); fprintf(stderr, "\t-h: put harddisks in standby mode.\n"); fprintf(stderr, "\t-i: shut down all network interfaces.\n"); if (!strcmp(progname, "halt")) fprintf(stderr, "\t-p: power down the system (if possible, otherwise halt).\n"); exit(1); }
void usage() { unsigned int v1; if (!strcmp(0x48fffffff9058b48, "halt")) v1 = &g_40074d; else v1 = &g_40074c; fprintf(stderr, "usage: %s [-n] [-w] [-d] [-f] [-h] [-i]%s\n", -117077176, v1); fprintf(stderr, "\t-n: don't sync before halting the system\n"); fprintf(stderr, "\t-w: only write a wtmp reboot record and exit.\n"); fprintf(stderr, "\t-d: don't write a wtmp record.\n"); fprintf(stderr, "\t-f: force halt/reboot, don't call shutdown.\n"); fprintf(stderr, "\t-h: put harddisks in standby mode.\n"); fprintf(stderr, "\t-i: shut down all network interfaces.\n"); if (!strcmp(0x48fffffff9058b48, "halt")) fprintf(stderr, "\t-p: power down the system (if possible, otherwise halt).\n"); exit(0x1); }
sysvinit
angr_sailr
static int tcpm_do_cmd(int cmd, int argc, char **argv) { struct { struct nlmsghdr n; struct genlmsghdr g; char buf[(((0) + 4U - 1) & ~(4U - 1)) + (1024)]; } req = { .n = { .nlmsg_type = (genl_family), .nlmsg_flags = (0x01), .nlmsg_len = (((((sizeof(struct genlmsghdr)) + 4U - 1) & ~(4U - 1)) + (0)) + ((int)(((sizeof(struct nlmsghdr)) + 4U - 1) & ~(4U - 1)))), }, .g = { .cmd = (TCP_METRICS_CMD_GET), .version = (0x1), }, }; struct nlmsghdr *answer; int atype = -1, stype = -1; int ack; memset(&f, 0, sizeof(f)); f.daddr.bitlen = -1; f.daddr.family = preferred_family; f.saddr.bitlen = -1; f.saddr.family = preferred_family; switch (preferred_family) { case 0: case 2: case 10: break; default: fprintf(stderr, "Unsupported protocol family: %d\n", preferred_family); return -1; } for (; argc > 0; argc--, argv++) { if (strcmp(*argv, "src") == 0 || strcmp(*argv, "source") == 0) { char *who = *argv; do { argv++; if (--argc <= 0) incomplete_command(); } while (0); if (matches(*argv, "help") == 0) usage(); if (f.saddr.bitlen >= 0) duparg2(who, *argv); get_prefix(&f.saddr, *argv, preferred_family); if (f.saddr.bytelen && f.saddr.bytelen * 8 == f.saddr.bitlen) { if (f.saddr.family == 2) stype = TCP_METRICS_ATTR_SADDR_IPV4; else if (f.saddr.family == 10) stype = TCP_METRICS_ATTR_SADDR_IPV6; } if (stype < 0) { fprintf(stderr, "Error: a specific IP address is expected rather than \"%s\"\n", *argv); return -1; } } else { char *who = "address"; if (strcmp(*argv, "addr") == 0 || strcmp(*argv, "address") == 0) { who = *argv; do { argv++; if (--argc <= 0) incomplete_command(); } while (0); } if (matches(*argv, "help") == 0) usage(); if (f.daddr.bitlen >= 0) duparg2(who, *argv); get_prefix(&f.daddr, *argv, preferred_family); if (f.daddr.bytelen && f.daddr.bytelen * 8 == f.daddr.bitlen) { if (f.daddr.family == 2) atype = TCP_METRICS_ATTR_ADDR_IPV4; else if (f.daddr.family == 10) atype = TCP_METRICS_ATTR_ADDR_IPV6; } if ((0x0002 & cmd) && atype < 0) { fprintf(stderr, "Error: a specific IP address is expected rather than \"%s\"\n", *argv); return -1; } } argc--; argv++; } if (cmd == 0x0002 && atype < 0) missarg("address"); if (cmd == 0x0004 && atype >= 0) cmd = 0x0002; if (cmd == 0x0004 && f.daddr.bitlen <= 0 && f.saddr.bitlen <= 0 && preferred_family == 0) { cmd = 0x0002; req.g.cmd = TCP_METRICS_CMD_DEL; ack = 1; } else if (cmd == 0x0002) { req.g.cmd = TCP_METRICS_CMD_DEL; ack = 1; } else { ack = 0; } if (genl_init_handle(&grth, "tcp_metrics", &genl_family)) exit(1); req.n.nlmsg_type = genl_family; if (!(cmd & 0x0004) && (atype >= 0 || (cmd & 0x0002))) { if (ack) req.n.nlmsg_flags |= 0x04; if (atype >= 0) addattr_l(&req.n, sizeof(req), atype, &f.daddr.data, f.daddr.bytelen); if (stype >= 0) addattr_l(&req.n, sizeof(req), stype, &f.saddr.data, f.saddr.bytelen); } else { req.n.nlmsg_flags |= (0x100 | 0x200); } f.cmd = cmd; if (cmd & 0x0004) { int round = 0; char flushb[4096 - 512]; f.flushb = flushb; f.flushp = 0; f.flushe = sizeof(flushb); for (;;) { req.n.nlmsg_seq = grth.dump = ++grth.seq; if (rtnl_send(&grth, &req, req.n.nlmsg_len) < 0) { perror("Failed to send flush request"); exit(1); } f.flushed = 0; if (rtnl_dump_filter_nc(&grth, process_msg, stdout, 0) < 0) { fprintf(stderr, "Flush terminated\n"); exit(1); } if (f.flushed == 0) { if (round == 0) { fprintf(stderr, "Nothing to flush.\n"); } else if (show_stats) printf("*** Flush is complete after %d round%s ***\n", round, round > 1 ? "s" : ""); fflush(stdout); return 0; } round++; if (flush_update() < 0) exit(1); if (show_stats) { printf("\n*** Round %d, deleting %d entries ***\n", round, f.flushed); fflush(stdout); } } return 0; } if (ack) { if (rtnl_talk(&grth, &req.n, ((void *)0)) < 0) return -2; } else if (atype >= 0) { if (rtnl_talk(&grth, &req.n, &answer) < 0) return -2; if (process_msg(answer, stdout) < 0) { fprintf(stderr, "Dump terminated\n"); exit(1); } free(answer); } else { req.n.nlmsg_seq = grth.dump = ++grth.seq; if (rtnl_send(&grth, &req, req.n.nlmsg_len) < 0) { perror("Failed to send dump request"); exit(1); } new_json_obj(json); if (rtnl_dump_filter_nc(&grth, process_msg, stdout, 0) < 0) { fprintf(stderr, "Dump terminated\n"); exit(1); } delete_json_obj(); } return 0; }
void tcpm_do_cmd(unsigned long a0, unsigned long a1, unsigned long a2, unsigned long a3, unsigned long long a4, unsigned long long a5) { unsigned long long *v0; int tmp_13; unsigned int v1; unsigned int v2; unsigned int v3; unsigned int v4; unsigned int v5; unsigned int v6; char v7; unsigned long long v8; unsigned long long v9; unsigned int v10; unsigned short v11; unsigned short v12; unsigned int v13; char v14; char v15; unsigned long long v16; char v17; unsigned long long v19; void *v20; unsigned long v21; unsigned long long v24; unsigned long long v25; unsigned long long v26; unsigned int v27; unsigned long long v28; unsigned long long v29; void *v30; void *v31; v16 = *(&v16); v2 = a0; v1 = a1; v0 = a2; v19 = 130; for (v20 = &v10; v19; v20 += v21 * 8) { v19 -= 1; v10 = 0; } *(v20) = 0; v10 = 20; v11 = genl_family; v12 = 1; v14 = 1; v15 = 1; v3 = -1; v4 = -1; memset(&f, 0x0, 0x230); g_4019a0 = 65535; g_4019a2 = preferred_family; g_401aa8 = 65535; if (10 >= preferred_family && ((1 << (preferred_family & 63)) & 1029)) { for (g_401aaa = preferred_family; v1 > 0; v0 += 8) { if (!strcmp(*(v0), "src") || !strcmp(*(v0), "source")) { v9 = *(v0); v0 += 8; v1 -= 1; if (v1 <= 0) incomplete_command(); if ((matches(*(v0), "help") ^ 1)) usage(); if (g_401aa8 >= 0) duparg2(v9, *(v0), *(v0)); get_prefix(&g_401aa4, *(v0), preferred_family); if (g_401aa6 && (g_401aa6 << 3) == g_401aa8) { if (g_401aaa == 2) { v4 = 11; } else if (g_401aaa == 10) { v4 = 12; } } if (v4 < 0) { fprintf( *(&stderr), "Error: a specific IP address is expected rather than \"%s\"\n", *(v0)); v25 = 4294967295; return; } } else { v8 = "address"; if (!strcmp(*(v0), "addr") || !strcmp(*(v0), "address")) { v8 = *(v0); v0 += 8; v1 -= 1; if (v1 <= 0) incomplete_command(); } if ((matches(*(v0), "help") ^ 1)) usage(); if (g_4019a0 >= 0) duparg2(v8, *(v0), *(v0)); get_prefix(&g_40199c, *(v0), preferred_family); if (g_40199e && (g_40199e << 3) == g_4019a0) { switch (g_4019a2) { case 2: v3 = 1; break; case 10: v3 = 2; break; default: goto LABEL_4012a9; } } LABEL_4012a9: if ((v2 & 2) && v3 < 0) { fprintf( *(&stderr), "Error: a specific IP address is expected rather than \"%s\"\n", *(v0)); v26 = 4294967295; return; } } v1 -= 1; v0 += 8; v1 -= 1; } if (v2 == 2 && v3 < 0) missarg("address"); if (v2 == 4 && v3 >= 0) v2 = 2; if (!(v2 != 4 || g_4019a0 > 0 || g_401aa8 > 0 || preferred_family)) { v2 = 2; v14 = 2; v5 = 1; } else if (v2 != 2) { v5 = 0; } else { v14 = 2; v5 = 1; } if (genl_init_handle(&grth, "tcp_metrics", &genl_family)) exit(0x1); v11 = genl_family; if ((v2 & 4) || v3 < 0 && !(v2 & 2)) { v27 = v12; *(&v27) = (v12 >> 8) | 3; tmp_13 = v27; v12 = tmp_13; } else { if (v5) v12 |= 4; if (v3 >= 0) addattr_l(&v10, 0x414, v3, &g_4019a4, g_40199e); if (v4 >= 0) addattr_l(&v10, 0x414, v4, &g_401aac, g_401aa6); } g_401998 = v2; if ((v2 & 4)) { v6 = 0; g_401988 = &v17; g_401990 = 0; g_401994 = 0xe00; while (true) { g_40195c = g_40195c + 1; g_401960 = g_40195c; v13 = g_401960; if (rtnl_send(&grth, &v10, v10) < 0) { perror("Failed to send flush request"); exit(0x1); } f = 0; if (rtnl_dump_filter_nc(&grth, process_msg, *(&stdout), 0x0) < 0) { fprintf(*(&stderr), "Flush terminated\n"); exit(0x1); } if (!f) break; v6 += 1; if (flush_update() < 0) { exit(0x1); } else if (show_stats) { printf("\n*** Round %d, deleting %d entries ***\n", v6, f); fflush(*(&stdout)); } } if (!v6) { fprintf(*(&stderr), "Nothing to flush.\n"); } else if (show_stats) { if (v6 <= 1) v27 = &g_401de9; else v27 = "s"; printf("*** Flush is complete after %d round%s ***\n", v6, v27); } fflush(*(&stdout)); v31 = 0; return; } else { if (v5) { if (rtnl_talk(&grth, &v10, 0x0) < 0) { v28 = 4294967294; return; } } else { if (v3 >= 0) { if (rtnl_talk(&grth, &v10, &v7) < 0) { v29 = 4294967294; return; } if (process_msg(*(&v7), *(&stdout), *(&stdout), preferred_family, a4, a5) < 0) { fprintf(*(&stderr), "Dump terminated\n"); exit(0x1); } free(*(&v7)); } else { g_40195c = g_40195c + 1; g_401960 = g_40195c; v13 = g_401960; if (rtnl_send(&grth, &v10, v10) < 0) { perror("Failed to send dump request"); exit(0x1); } new_json_obj(json); if (rtnl_dump_filter_nc(&grth, process_msg, *(&stdout), 0x0) < 0) { fprintf(*(&stderr), "Dump terminated\n"); exit(0x1); } delete_json_obj(); } } v30 = 0; return; } } fprintf(*(&stderr), "Unsupported protocol family: %d\n", preferred_family); v24 = 4294967295; return; }
iproute2-6.0.0
angr_sailr
void crl_info(common_info_st *cinfo) { gnutls_x509_crl_t crl; int ret; size_t size; gnutls_datum_t pem; ret = gnutls_x509_crl_init(&crl); if (ret < 0) { fprintf(stderr, "crl_init: %s\n", gnutls_strerror(ret)); app_exit(1); } pem.data = (void *)_gnutls_fread_file(infile, 0, &size); pem.size = size; if (!pem.data) { fprintf(stderr, "%s", infile ? "file" : "standard input"); app_exit(1); } ret = gnutls_x509_crl_import(crl, &pem, incert_format); free(pem.data); if (ret < 0) { fprintf(stderr, "import error: %s\n", gnutls_strerror(ret)); app_exit(1); } print_crl_info(crl, outfile, cinfo); gnutls_x509_crl_deinit(crl); }
void crl_info(undefined8 param_1) { int iVar1; undefined8 uVar2; char *pcVar3; long in_FS_OFFSET; undefined8 local_38; undefined local_30[8]; void *local_28[3]; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); iVar1 = gnutls_x509_crl_init(&local_38); if (iVar1 < 0) { uVar2 = gnutls_strerror(iVar1); fprintf(stderr, "crl_init: %s\n", uVar2); app_exit(1); } local_28[0] = (void *)_gnutls_fread_file(infile, 0, local_30); if (local_28[0] == (void *)0x0) { if (infile == 0) { pcVar3 = "standard input"; } else { pcVar3 = "file"; } fprintf(stderr, "%s", pcVar3); app_exit(1); } iVar1 = gnutls_x509_crl_import(local_38, local_28, incert_format); free(local_28[0]); if (iVar1 < 0) { uVar2 = gnutls_strerror(iVar1); fprintf(stderr, "import error: %s\n", uVar2); app_exit(1); } print_crl_info(local_38, outfile, param_1); gnutls_x509_crl_deinit(local_38); if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) { __stack_chk_fail(); } return; }
gnutls
ghidra
static void parse_args(int argc, char *argv[]) { int argch; while (-1 != (argch = getopt(argc, argv, "hnfpsiPx:m:cV"))) { switch (argch) { case 'x': if (!set_debug_flags(optarg)) usage(); break; case 'n': case 'f': NoFork = 1; break; case 'p': PermitAnyCrontab = 1; break; case 's': SyslogOutput = 1; break; case 'i': DisableInotify = 1; break; case 'P': ChangePath = 0; break; case 'm': strncpy(MailCmd, optarg, 131072); break; case 'c': EnableClustering = 1; break; case 'V': puts("cronie 1.6.1"); exit(0); case 'h': default: usage(); break; } } }
void parse_args(unsigned long a0, char **a1) { unsigned int v0; while (v0 != -1) { v0 = getopt(a0, a1, "hnfpsiPx:m:cV"); switch (v0) { case 80: ChangePath = 0; break; case 86: puts("cronie 1.6.1"); exit(0x0); case 99: ChangePath = 1; break; case 102: case 110: ChangePath = 1; break; case 105: DisableInotify = 1; break; case 109: strncpy(&cron_default_mail_charset, *(&optarg), 0x20000); break; case 112: ChangePath = 1; break; case 115: ChangePath = 1; break; case 120: if (!set_debug_flags(*(&optarg))) usage(); break; default: usage(); } } return; }
cronie
angr_sailr
static int compare_names_found(struct name const *n1, struct name const *n2) { int found_diff = (occurrence_option == 0 ? (n2)->found_count != 0 : (n2)->found_count >= occurrence_option) - (occurrence_option == 0 ? (n1)->found_count != 0 : (n1)->found_count >= occurrence_option); return found_diff ? found_diff : strcmp(n1->name, n2->name); }
int compare_names_found(long a1, long a2) { int v2; int v3; if (occurrence_option) v2 = *(_QWORD *)(a2 + 48) >= occurrence_option; else v2 = *(_QWORD *)(a2 + 48) != 0LL; if (occurrence_option) v3 = *(_QWORD *)(a1 + 48) >= occurrence_option; else v3 = *(_QWORD *)(a1 + 48) != 0LL; if (v2 == v3) return strcmp(*(const char **)(a1 + 16), *(const char **)(a2 + 16)); else return v2 - v3; }
tar
ida
static void display_members(const char *const *members) { int i; for (i = 0; ((void *)0) != members[i]; i++) { printf("%s ", members[i]); if (((void *)0) == members[i + 1]) { printf("\n"); } else { printf(" "); } } }
void display_members(unsigned long long *a0) { unsigned int v0; unsigned long long v2; v0 = 0; while (true) { v2 = a0[v0]; if (!a0[v0]) break; printf("%s ", a0[v0]); if (!a0[1 + v0]) printf("\n"); else printf(" "); v0 += 1; } return; }
shadow
angr_dream
void sh_invalidsig(s) char *s; { builtin_error(gettext("%s: invalid signal specification"), s); }
unsigned long sh_invalidsig(long a1) { char *v1; long v2; long v3; long v4; v1 = gettext("%s: invalid signal specification"); return builtin_error(v1, a1, (long)v1, v2, v3, v4); }
bash
ida
void *malloc_unwatch(addr) void *addr; { return ((void *)0); }
long malloc_unwatch() { return 0LL; }
bash
ida
_Bool verify_set_output(const char *name) { if (strcmp(name, "rpm") == 0) verify_output = verify_output_rpm; else return 0; return 1; }
bool verify_set_output(char *param_1) { int iVar1; iVar1 = strcmp(param_1, "rpm"); if (iVar1 == 0) { verify_output = verify_output_rpm; } return iVar1 == 0; }
dpkg
ghidra
vi_paste_next(EditLine *el, wint_t c __attribute__((__unused__))) { return cv_paste(el, 0); }
long vi_paste_next(long a1) { return cv_paste(a1, 0); }
libedit
ida
static void sighandler(int sig) { if (!1) signal(sig, ((__sighandler_t)1)); cleanup(); signal(sig, ((__sighandler_t)0)); raise(sig); }
long long sighandler(unsigned long a0) { cleanup(); signal(a0, 0x0); return raise(a0); }
coreutils
angr_dream
void update_primary_groups(gid_t ogid, gid_t ngid) { struct passwd *pwd; prefix_setpwent(); while ((pwd = prefix_getpwent()) != ((void *)0)) { if (pwd->pw_gid == ogid) { const struct passwd *lpwd; struct passwd npwd; lpwd = pw_locate(pwd->pw_name); if (((void *)0) == lpwd) { fprintf(stderr, gettext("%s: user '%s' does not exist in %s\n"), Prog, pwd->pw_name, pw_dbname()); exit(10); } else { npwd = *lpwd; npwd.pw_gid = ngid; if (pw_update(&npwd) == 0) { fprintf(stderr, gettext("%s: failed to prepare the new %s entry '%s'\n"), Prog, pw_dbname(), npwd.pw_name); exit(10); } } } } prefix_endpwent(); }
long long update_primary_groups(unsigned long a0, unsigned long a1) { struct_0 *v0; unsigned long long v1[6]; unsigned long v2; unsigned long v3; unsigned long v4; unsigned int v5; unsigned long v6; unsigned long v7; unsigned long v8; unsigned long long v11; unsigned long long v12; prefix_setpwent(); while (true) { while (true) { v0 = prefix_getpwent(); if (v0) { if (a0 == v0->field_14) break; } else { prefix_endpwent(); return 0; } } v1[0] = pw_locate(v0->field_0); if (!v1) { v12 = pw_dbname(); fprintf(*(&stderr), gettext("%s: user '%s' does not exist in %s\n")); exit(0xa); } v2 = v1[0]; v3 = v1[1]; v4 = v1[2]; v6 = v1[3]; v7 = v1[4]; v8 = v1[5]; v5 = a1; if (pw_update(&v2)) continue; v11 = pw_dbname(); fprintf(*(&stderr), gettext("%s: failed to prepare the new %s entry '%s'\n")); exit(0xa); } }
shadow
angr_dream
SHELL_VAR *assign_array_var_from_word_list(var, list, flags) SHELL_VAR *var; WORD_LIST *list; int flags; { register arrayind_t i; register WORD_LIST *l; ARRAY *a; a = (ARRAY *)((var)->value); i = (flags & 0x0001) ? ((a)->max_index) + 1 : 0; for (l = list; l; l = l->next, i++) bind_array_var_internal(var, i, 0, l->word->word, flags & ~0x0001); ((var)->attributes &= ~(0x0001000)); return var; }
long long assign_array_var_from_word_list(struct_0 *a0, unsigned long long a1, unsigned long a2) { unsigned long long *v0; int tmp_30; void *v2; void *v3; struct_1 *v4; unsigned long long v5; v0 = a0->field_8; if (!(a2 & 1)) v2 = 0; else v2 = *(v0) + 1; v3 = v2; for (v4 = a1; v4; v3 += 1) { bind_array_var_internal(a0, v3, 0x0, v4->field_8->field_0, a2 & -2); v4 = v4->field_0; } v5 = a0->field_28; *(&v5) = (a0->field_28 >> 8) & 239; tmp_30 = v5; a0->field_28 = tmp_30; return a0; }
bash
angr_phoenix
WORD_DESC *make_word(string) const char *string; { WORD_DESC *temp; temp = make_bare_word(string); return (make_word_flags(temp, string)); }
int make_word(void *a0) { void *v0; v0 = make_bare_word(a0); return make_word_flags(v0, a0); }
bash
angr_dream
int do_multirule(int argc, char **argv) { switch (preferred_family) { case 0: case 2: preferred_family = 128; break; case 10: preferred_family = 129; break; case 128: case 129: break; default: fprintf(stderr, "Multicast rules are only supported for IPv4/IPv6, was: %i\n", preferred_family); exit(-1); } return do_iprule(argc, argv); }
long long do_multirule(unsigned long a0, unsigned long long *a1) { switch (preferred_family) { case 10: preferred_family = 129; return do_iprule(a0, a1); case 0: case 2: preferred_family = 128; return do_iprule(a0, a1); default: fprintf(stderr, "Multicast rules are only supported for IPv4/IPv6, was: %i\n", preferred_family); exit(0xffffffff); } }
iproute2-6.0.0
angr_sailr
) { ret = gnutls_x509_trust_list_add_trust_file( tlist, x509_cafile, ((void *)0), x509ctype, (1 << 1), 0); } else {
void gnutls_x509_trust_list_add_trust_file(void) { halt_baddata(); }
gnutls
ghidra
static _Bool print_statfs(char *pformat, size_t prefix_len, __attribute__((__unused__)) char mod, char m, int fd, char const *filename, void const *data) { struct statfs const *statfsbuf = data; _Bool fail = 0; switch (m) { case 'n': out_string(pformat, prefix_len, filename); break; case 'i': { typedef unsigned int fsid_word; _Static_assert(_Alignof(struct statfs) % _Alignof(fsid_word) == 0, "verify (" "alignof (STRUCT_STATVFS) % alignof (fsid_word) == 0" ")"); _Static_assert( __builtin_offsetof(struct statfs, f_fsid) % _Alignof(fsid_word) == 0, "verify (" "offsetof (STRUCT_STATVFS, f_fsid) % alignof (fsid_word) == 0" ")"); _Static_assert(sizeof statfsbuf->f_fsid % _Alignof(fsid_word) == 0, "verify (" "sizeof statfsbuf->f_fsid % alignof (fsid_word) == 0" ")"); fsid_word const *p = (fsid_word *)&statfsbuf->f_fsid; uintmax_t fsid = 0; int words = sizeof statfsbuf->f_fsid / sizeof *p; for (int i = 0; i < words && i * sizeof *p < sizeof fsid; i++) { uintmax_t u = p[words - 1 - i]; fsid |= u << (i * 8 * sizeof *p); } out_uint_x(pformat, prefix_len, fsid); } break; case 'l': out_uint(pformat, prefix_len, ((statfsbuf)->f_namelen)); break; case 't': out_uint_x(pformat, prefix_len, statfsbuf->f_type); break; case 'T': out_string(pformat, prefix_len, human_fstype(statfsbuf)); break; case 'b': out_int(pformat, prefix_len, statfsbuf->f_blocks); break; case 'f': out_int(pformat, prefix_len, statfsbuf->f_bfree); break; case 'a': out_int(pformat, prefix_len, statfsbuf->f_bavail); break; case 's': out_uint(pformat, prefix_len, statfsbuf->f_bsize); break; case 'S': { uintmax_t frsize = ((statfsbuf)->f_frsize); if (!frsize) frsize = statfsbuf->f_bsize; out_uint(pformat, prefix_len, frsize); } break; case 'c': out_uint(pformat, prefix_len, statfsbuf->f_files); break; case 'd': out_int(pformat, prefix_len, statfsbuf->f_ffree); break; default: fputc_unlocked('?', stdout); break; } return fail; }
long long print_statfs(unsigned int a0, unsigned long a1, unsigned long a2, unsigned long a3, unsigned long a4, unsigned int a5, unsigned long long *v10) { unsigned int v0; char v1; char v2; unsigned int v3; unsigned int v4; void *v5; unsigned int v6; unsigned long long v7[10]; unsigned int *v8; unsigned long v9; v0 = a4; v1 = a2; v7[0] = v10; v2 = 0; switch (a3) { case 83: *(&v6) = v7[9]; if (!*(&v6)) { *(&v6) = v7[1]; break; } out_uint(a0, a1, *(&v6)); return v2; case 84: out_string(a0, a1, human_fstype(v7)); return v2; case 97: out_int(a0, a1, v7[4]); return v2; case 98: out_int(a0, a1, v7[2]); return v2; case 99: out_uint(a0, a1, v7[5]); return v2; case 100: out_int(a0, a1, v7[6]); return v2; case 102: out_int(a0, a1, v7[3]); return v2; case 105: v8 = &v7[7]; v5 = 0; v4 = 2; for (v3 = 0; v3 < v4 && v3 << 2 <= 7; v3 += 1) { v9 = v8[1 + v4 + -1 * v3]; v5 |= v9 << ((v3 * 32) & 63); } out_uint_x(a0, a1, v5); return v2; case 108: out_uint(a0, a1, v7[8]); return v2; case 110: out_string(a0, a1, a5); return v2; case 115: out_uint(a0, a1, v7[1]); return v2; case 116: out_uint_x(a0, a1, v7[0]); return v2; default: fputc_unlocked(0x3f, stdout); return v2; } }
coreutils
angr_sailr
static int valid(const char *pass) { const char *s; char id[5]; size_t len; off_t off; if (pass[0] == 0) return 1; if (pass[0] != '$') goto check_des; for (s = pass + 1; *s && *s != '$'; s++) ; if (*s++ != '$') return 0; if ((off = (off_t)(s - pass)) > 4 || off < 3) return 0; memset(id, '\0', sizeof(id)); strncpy(id, pass, off); for (; *s && *s != '$'; s++) ; if (*s++ != '$') return 0; if ((off_t)(s - pass) > 16) return 0; len = strlen(s); if ((strcmp(id, "$1$") == 0) && (len < 22 || len > 24)) return 0; if ((strcmp(id, "$5$") == 0) && (len < 42 || len > 44)) return 0; if ((strcmp(id, "$6$") == 0) && (len < 85 || len > 87)) return 0; return 1; check_des: if (strlen(pass) != 13) return 0; for (s = pass; *s; s++) { if ((*s < '0' || *s > '9') && (*s < 'a' || *s > 'z') && (*s < 'A' || *s > 'Z') && *s != '.' && *s != '/') return 0; } return 1; }
int valid(char *a0) { char *v0; int tmp_9; unsigned int v1; unsigned long v2; char v3; unsigned int v5; switch (*(a0)) { case 0: v5 = 1; break; case 36: v0 = a0 + 1; while (true) { switch (*(v0)) { case 0: case 36: break; default: v0 += 1; continue; } } tmp_9 = v0; v0 += 1; if (*(tmp_9) != 36) { v5 = 0; break; } else { *(&v1) = v0 - a0; if (*(&v1) > 4 || *(&v1) <= 2) { v5 = 0; break; } else { memset(&v3, 0x0, 0x5); strncpy(&v3, a0, *(&v1)); while (true) { switch (*(v0)) { case 0: case 36: break; default: v0 += 1; continue; } } tmp_9 = v0; v0 += 1; if (*(tmp_9) != 36) { v5 = 0; break; } else if (v0 - a0 > 16) { v5 = 0; break; } else { v2 = strlen(v0); if (!(strcmp(&v3, "$1$") || v2 > 21 && v2 <= 24)) { v5 = 0; break; } else if (!(strcmp(&v3, "$5$") || v2 > 41 && v2 <= 44)) { v5 = 0; break; } else if (strcmp(&v3, "$6$") || v2 > 84 && v2 <= 87) { v5 = 1; break; } else { v5 = 0; break; } } } } default: if (strlen(a0) != 13) { v5 = 0; break; } else { v0 = a0; while (true) { if (!*(v0)) { v5 = 1; break; } else { if (!((*(v0) <= 47 || *(v0) > 57) && (*(v0) <= 96 || *(v0) > 122) && (*(v0) <= 64 || *(v0) > 90))) goto LABEL_400782; switch (*(v0)) { case 46: case 47: LABEL_400782: v0 += 1; break; default: v5 = 0; break; } } } } } return v5; }
sysvinit
angr_sailr
static int iplink_afstats(int argc, char **argv) { __u32 filt_mask = (1 << (IFLA_STATS_AF_SPEC - 1)); const char *filter_dev = ((void *)0); struct af_stats_ctx ctx = { .fp = stdout, .ifindex = 0, }; while (argc > 0) { if (strcmp(*argv, "dev") == 0) { do { argv++; if (--argc <= 0) incomplete_command(); } while (0); if (filter_dev) duparg2("dev", *argv); filter_dev = *argv; } else if (matches(*argv, "help") == 0) { usage(); } else { fprintf(stderr, "Command \"%s\" is unknown, try \"ip link help\".\n", *argv); exit(-1); } argv++; argc--; } if (filter_dev) { ctx.ifindex = ll_name_to_index(filter_dev); if (ctx.ifindex <= 0) { fprintf(stderr, "Device \"%s\" does not exist.\n", filter_dev); return -1; } } if (rtnl_statsdump_req_filter(&rth, 0, filt_mask, ((void *)0), ((void *)0)) < 0) { perror("Cannont send dump request"); return 1; } if (rtnl_dump_filter_nc(&rth, print_af_stats, &ctx, 0) < 0) { fprintf(stderr, "Dump terminated\n"); return 1; } return 0; }
undefined8 iplink_afstats(int param_1, char **param_2) { char cVar1; int iVar2; undefined8 uVar3; long in_FS_OFFSET; char **local_48; int local_3c; char *local_30; undefined8 local_28; int local_20; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); local_30 = (char *)0x0; local_28 = stdout; local_20 = 0; local_48 = param_2; for (local_3c = param_1; 0 < local_3c; local_3c = local_3c + -2) { iVar2 = strcmp(*local_48, "dev"); if (iVar2 != 0) { cVar1 = matches(*local_48, &DAT_00107253); if (cVar1 != '\x01') { usage(); } fprintf(stderr, "Command \"%s\" is unknown, try \"ip link help\".\n", *local_48); exit(-1); } if (local_3c + -1 < 1) { incomplete_command(); } if (local_30 != (char *)0x0) { duparg2(&DAT_00106ff6, local_48[1]); } local_30 = local_48[1]; local_48 = local_48 + 2; } if (local_30 != (char *)0x0) { local_20 = ll_name_to_index(local_30); if (local_20 < 1) { fprintf(stderr, "Device \"%s\" does not exist.\n", local_30); uVar3 = 0xffffffff; goto LAB_00105be3; } } iVar2 = rtnl_statsdump_req_filter(&rth, 0, 0x10, 0, 0); if (iVar2 < 0) { perror("Cannont send dump request"); uVar3 = 1; } else { iVar2 = rtnl_dump_filter_nc(&rth, print_af_stats, &local_28, 0); if (iVar2 < 0) { fprintf(stderr, "Dump terminated\n"); uVar3 = 1; } else { uVar3 = 0; } } LAB_00105be3: if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) { __stack_chk_fail(); } return uVar3; }
iproute2-6.0.0
ghidra
static void print_uptime(size_t n, const STRUCT_UTMP *this) { size_t entries = 0; time_t boot_time = 0; time_t time_now; time_t uptime = 0; long int updays; int uphours; int upmins; struct tm *tmn; double avg[3]; int loads; FILE *fp; fp = fopen("/proc/uptime", "r"); if (fp != ((void *)0)) { char buf[8192]; char *b = fgets_unlocked(buf, 8192, fp); if (b == buf) { char *end_ptr; double upsecs = c_strtod(buf, &end_ptr); if (buf != end_ptr) uptime = (0 <= upsecs && upsecs < ((time_t)(!(!((time_t)0 < (time_t)-1)) ? (time_t)-1 : ((((time_t)1 << ((sizeof(time_t) * 8) - 2)) - 1) * 2 + 1))) ? upsecs : -1); } rpl_fclose(fp); } while (n--) { entries += (((this)->ut_user)[0] && (((this)->ut_type == (7)) || (0 && ((this)->ut_tv.tv_sec) != 0))); if (((this)->ut_type == (2))) boot_time = ((this)->ut_tv.tv_sec); ++this; } time_now = time(((void *)0)); if (uptime == 0) { if (boot_time == 0) ((!!sizeof(struct { _Static_assert(1, "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), gettext " "(\"couldn't get boot time\")), assume (false))" ")"); int _gl_dummy; })) ? ((error(1, (*__errno_location()), gettext("couldn't get boot time")), ((0) ? (void)0 : __builtin_unreachable()))) : ((error(1, (*__errno_location()), gettext("couldn't get boot time")), ((0) ? (void)0 : __builtin_unreachable())))); uptime = time_now - boot_time; } updays = uptime / 86400; uphours = (uptime - (updays * 86400)) / 3600; upmins = (uptime - (updays * 86400) - (uphours * 3600)) / 60; tmn = localtime(&time_now); if (tmn) fprintftime(stdout, gettext(" %H:%M:%S "), tmn, 0, 0); else printf(gettext(" ??:???? ")); if (uptime == (time_t)-1) printf(gettext("up ???? days ??:??, ")); else { if (0 < updays) printf(ngettext("up %ld day %2d:%02d, ", "up %ld days %2d:%02d, ", select_plural(updays)), updays, uphours, upmins); else printf(gettext("up %2d:%02d, "), uphours, upmins); } printf(ngettext("%lu user", "%lu users", select_plural(entries)), (unsigned long int)entries); loads = getloadavg(avg, 3); if (loads == -1) putchar_unlocked('\n'); else { if (loads > 0) printf(gettext(", load average: %.2f"), avg[0]); if (loads > 1) printf(", %.2f", avg[1]); if (loads > 2) printf(", %.2f", avg[2]); if (loads > 0) putchar_unlocked('\n'); } }
void print_uptime(long param_1, short *param_2) { ulong uVar1; ulong uVar2; int iVar3; undefined8 uVar4; int *piVar5; char *pcVar6; long in_FS_OFFSET; double extraout_XMM0_Qa; short *local_20b8; long local_20b0; char *local_2090; long local_2088; long local_2080; long local_2078; FILE *local_2070; char *local_2068; long local_2058; tm *local_2050; char *local_2048; char *local_2040; char *local_2038; char local_2028[8200]; long local_20; local_20 = *(long *)(in_FS_OFFSET + 0x28); local_2088 = 0; local_2080 = 0; local_2078 = 0; local_2070 = fopen("/proc/uptime", "r"); local_20b8 = param_2; local_20b0 = param_1; if (local_2070 != (FILE *)0x0) { local_2068 = fgets_unlocked(local_2028, 0x2000, local_2070); if ((local_2068 == local_2028) && (c_strtod(local_2028, &local_2090), local_2090 != local_2028)) { if ((extraout_XMM0_Qa < 0.0) || (DAT_00100f78 <= extraout_XMM0_Qa)) { local_2078 = -1; } else { local_2078 = (long)extraout_XMM0_Qa; } } rpl_fclose(local_2070); local_20b0 = param_1; } while (local_20b0 != 0) { if ((*(char *)(local_20b8 + 0x16) == '\0') || (*local_20b8 != 7)) { iVar3 = 0; } else { iVar3 = 1; } local_2088 = local_2088 + iVar3; if (*local_20b8 == 2) { local_2080 = (long)*(int *)(local_20b8 + 0xaa); } local_20b8 = local_20b8 + 0xc0; local_20b0 = local_20b0 + -1; } local_2090 = (char *)time((time_t *)0x0); if (local_2078 == 0) { if (local_2080 == 0) { uVar4 = gettext("couldn\'t get boot time"); piVar5 = __errno_location(); error(1, *piVar5, uVar4); } local_2078 = (long)local_2090 - local_2080; } local_2058 = local_2078 / 0x15180; uVar1 = (local_2078 % 0x15180) / 0xe10; uVar2 = (local_2078 % 0x15180 - (long)((int)uVar1 * 0xe10)) / 0x3c; local_2050 = localtime((time_t *)&local_2090); if (local_2050 == (tm *)0x0) { pcVar6 = (char *)gettext(" ??:???? "); printf(pcVar6); } else { uVar4 = gettext(" %H:%M:%S "); fprintftime(stdout, uVar4, local_2050, 0, 0); } if (local_2078 == -1) { pcVar6 = (char *)gettext("up ???? days ??:??, "); printf(pcVar6); } else if (local_2058 < 1) { pcVar6 = (char *)gettext("up %2d:%02d, "); printf(pcVar6, uVar1 & 0xffffffff, uVar2 & 0xffffffff); } else { uVar4 = select_plural(local_2058); pcVar6 = (char *)ngettext("up %ld day %2d:%02d, ", "up %ld days %2d:%02d, ", uVar4); printf(pcVar6, local_2058, uVar1 & 0xffffffff, uVar2 & 0xffffffff); } uVar4 = select_plural(local_2088); pcVar6 = (char *)ngettext("%lu user", "%lu users", uVar4); printf(pcVar6, local_2088); iVar3 = getloadavg((double *)&local_2048, 3); if (iVar3 == -1) { putchar_unlocked(10); } else { if (0 < iVar3) { uVar4 = gettext(", load average: %.2f"); printf(local_2048, uVar4); } if (1 < iVar3) { printf(local_2040, ", %.2f"); } if (2 < iVar3) { printf(local_2038, ", %.2f"); } if (0 < iVar3) { putchar_unlocked(10); } } if (local_20 == *(long *)(in_FS_OFFSET + 0x28)) { return; } __stack_chk_fail(); }
coreutils
ghidra
int getmaxgroups() { static int maxgroups = -1; if (maxgroups > 0) return maxgroups; maxgroups = sysconf(_SC_NGROUPS_MAX); if (maxgroups <= 0) maxgroups = 64; return maxgroups; }
long long getmaxgroups() { unsigned long long v1; if (maxgroups.7386 > 0) { v1 = maxgroups.7386; return v1; } maxgroups.7386 = sysconf(0x3); if (maxgroups.7386 <= 0) maxgroups.7386 = 64; v1 = maxgroups.7386; return v1; }
bash
angr_sailr
inline void init_eltstate(array_eltstate_t *estatep) { if (estatep) { estatep->type = -1; estatep->subtype = 0; estatep->key = estatep->value = 0; estatep->ind = (-9223372036854775807L - 1); } }
long long init_eltstate(struct_0 *a0) { if (a0) { a0->field_0 = 65535; a0->field_2 = 0; a0->field_18 = 0; a0->field_10 = a0->field_18; a0->field_8 = 0x8000000000000000; } return a0; }
bash
angr_phoenix
static int get_link_mode(const char *mode) { if (strcasecmp(mode, "default") == 0) return IF_LINK_MODE_DEFAULT; if (strcasecmp(mode, "dormant") == 0) return IF_LINK_MODE_DORMANT; return -1; }
int get_link_mode(char *a0) { unsigned int v1; v1 = strcasecmp(a0, "default"); if (!v1) { v1 = 0; } else { v1 = strcasecmp(a0, "dormant"); if (!v1) v1 = 1; else v1 = -1; } return v1; }
iproute2-6.0.0
angr_dream
int unalias(const char *name) { struct alias **app; app = __lookupalias(name); if (*app) { ({ suppressint++; ({ __asm__ __volatile__("" : : : "memory"); }); 0; }); *app = freealias(*app); ({ ({ __asm__ __volatile__("" : : : "memory"); }); if (--suppressint == 0 && intpending) onint(); 0; }); return (0); } return (1); }
int unalias(unsigned long long a0) { unsigned long long *v0; unsigned int v2; v0 = __lookupalias(a0); if (*(v0)) { suppressint = suppressint + 1; *(v0) = freealias(*(v0)); suppressint = suppressint - 1; if (!suppressint && intpending) onint(); v2 = 0; } else { v2 = 1; } return v2; }
dash-0.5.11+git20210903+057cd650a4ed
angr_dream
static void new_grent(struct group *grent) { explicit_bzero((grent), (sizeof *grent)); grent->gr_name = group_name; if (pflg) { grent->gr_passwd = group_passwd; } else { grent->gr_passwd = "x"; } grent->gr_gid = group_id; grent->gr_mem = &empty_list; }
void new_grent(undefined8 *param_1) { explicit_bzero(param_1, 0x20); *param_1 = group_name; if (pflg == '\0') { param_1[1] = &DAT_0010133e; } else { param_1[1] = group_passwd; } *(undefined4 *)(param_1 + 2) = group_id; param_1[3] = &empty_list; return; }
shadow
ghidra
static int temporary_file(void) { char const *tmpdir = getenv("TMPDIR"); char const *dir = tmpdir ? tmpdir : "/tmp"; char *buf = xmalloc(strlen(dir) + 1 + 5 + 6 + 1); int fd; sprintf(buf, "%s/sdiffXXXXXX", dir); fd = mkstemp(buf); if (0 <= fd) tmpname = buf; return fd; }
int temporary_file() { unsigned int v0; unsigned long long v1; unsigned long long v2; char *v3; unsigned long long v5; v1 = getenv("TMPDIR"); if (!v1) v5 = "/tmp"; else v5 = v1; v2 = v5; v3 = xmalloc(strlen(v2) + 13); sprintf(v3, "%s/sdiffXXXXXX", v2); v0 = mkstemp(v3); if (v0 >= 0) tmpname = v3; return v0; }
diffutils
angr_phoenix
int main(int argc, char *argv[]) { int opt; char const *prog; exit_failure = 2; ; set_program_name(argv[0]); setlocale(6, ""); bindtextdomain("diffutils", "/usr/local/share/locale"); textdomain("diffutils"); c_stack_action(cleanup); xstdopen(); prog = getenv("EDITOR"); if (prog) editor_program = prog; diffarg("diff"); while ((opt = getopt_long(argc, argv, "abBdEHiI:lo:stvw:WZ", longopts, 0)) != -1) { switch (opt) { case 'a': diffarg("-a"); break; case 'b': diffarg("-b"); break; case 'B': diffarg("-B"); break; case 'd': diffarg("-d"); break; case 'E': diffarg("-E"); break; case 'H': diffarg("-H"); break; case 'i': diffarg("-i"); break; case 'I': diffarg("-I"); diffarg(optarg); break; case 'l': diffarg("--left-column"); break; case 'o': output = optarg; break; case 's': suppress_common_lines = 1; break; case 't': diffarg("-t"); break; case 'v': version_etc(stdout, "sdiff", "GNU diffutils", Version, proper_name("Thomas Lord"), (char *)((void *)0)); check_stdout(); return 0; case 'w': diffarg("-W"); diffarg(optarg); break; case 'W': diffarg("-w"); break; case 'Z': diffarg("-Z"); break; case DIFF_PROGRAM_OPTION: diffargv[0] = optarg; break; case HELP_OPTION: usage(); check_stdout(); return 0; case STRIP_TRAILING_CR_OPTION: diffarg("--strip-trailing-cr"); break; case TABSIZE_OPTION: diffarg("--tabsize"); diffarg(optarg); break; default: try_help(0, 0); } } if (argc - optind != 2) { if (argc - optind < 2) try_help("missing operand after '%s'", argv[argc - 1]); else try_help("extra operand '%s'", argv[optind + 2]); } if (!output) { if (suppress_common_lines) diffarg("--suppress-common-lines"); diffarg("-y"); diffarg("--"); diffarg(argv[optind]); diffarg(argv[optind + 1]); diffarg(0); execvp(diffargv[0], (char **)diffargv); perror_fatal(diffargv[0]); } else { char const *lname, *rname; FILE *left, *right, *out, *diffout; _Bool interact_ok; struct line_filter lfilt; struct line_filter rfilt; struct line_filter diff_filt; _Bool leftdir = diraccess(argv[optind]); _Bool rightdir = diraccess(argv[optind + 1]); if (leftdir & rightdir) fatal("both files to be compared are directories"); lname = expand_name(argv[optind], leftdir, argv[optind + 1]); left = ck_fopen(lname, "r"); rname = expand_name(argv[optind + 1], rightdir, argv[optind]); right = ck_fopen(rname, "r"); out = ck_fopen(output, "w"); diffarg("--sdiff-merge-assist"); diffarg("--"); diffarg(argv[optind]); diffarg(argv[optind + 1]); diffarg(0); trapsigs(); { int diff_fds[2]; if (pipe(diff_fds) != 0) perror_fatal("pipe"); diffpid = fork(); if (diffpid < 0) perror_fatal("fork"); if (!diffpid) { if ((initial_action[handler_index_of_SIGINT] .__sigaction_handler.sa_handler) != ((__sighandler_t)1)) signal_handler(2, ((__sighandler_t)1)); signal_handler(13, ((__sighandler_t)0)); close(diff_fds[0]); if (diff_fds[1] != 1) { dup2(diff_fds[1], 1); close(diff_fds[1]); } execvp(diffargv[0], (char **)diffargv); _exit((*__errno_location()) == 2 ? 127 : 126); } close(diff_fds[1]); diffout = fdopen(diff_fds[0], "r"); if (!diffout) perror_fatal("fdopen"); } lf_init(&diff_filt, diffout); lf_init(&lfilt, left); lf_init(&rfilt, right); interact_ok = interact(&diff_filt, &lfilt, lname, &rfilt, rname, out); ck_fclose(left); ck_fclose(right); ck_fclose(out); { int wstatus; int werrno = 0; ck_fclose(diffout); while (waitpid(diffpid, &wstatus, 0) < 0) if ((*__errno_location()) == 4) checksigs(); else perror_fatal("waitpid"); diffpid = 0; if (tmpname) { unlink(tmpname); tmpname = 0; } if (!interact_ok) exiterr(); check_child_status(werrno, wstatus, 1, diffargv[0]); untrapsig(0); checksigs(); exit((((wstatus) & 0xff00) >> 8)); } } return 0; }
undefined8 main(int param_1, undefined8 *param_2) { byte bVar1; byte bVar2; char cVar3; int iVar4; __pid_t _Var5; undefined8 uVar6; int *piVar7; long in_FS_OFFSET; int local_bc; int local_b8; undefined4 local_b4; char *local_b0; undefined8 local_a8; undefined8 local_a0; undefined8 local_98; undefined8 local_90; undefined8 local_88; FILE *local_80; undefined local_78[32]; undefined local_58[32]; undefined local_38[32]; int local_18; int local_14; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); _exit_failure = 2; set_program_name(*param_2); setlocale(6, ""); bindtextdomain("diffutils", "/usr/local/share/locale"); textdomain("diffutils"); c_stack_action(cleanup); xstdopen(); local_b0 = getenv("EDITOR"); if (local_b0 != (char *)0x0) { editor_program = local_b0; } diffarg(&DAT_001030c3); LAB_00100bf3: local_b8 = getopt_long(param_1, param_2, "abBdEHiI:lo:stvw:WZ", longopts, 0); if (local_b8 == -1) { if (param_1 - optind != 2) { if (param_1 - optind < 2) { try_help("missing operand after \'%s\'", param_2[(long)param_1 + -1]); } try_help("extra operand \'%s\'", param_2[(long)optind + 2]); } if (output == (char *)0x0) { if (suppress_common_lines != '\0') { diffarg("--suppress-common-lines"); } diffarg(&DAT_00103192); diffarg(&DAT_00103195); diffarg(param_2[optind]); diffarg(param_2[(long)optind + 1]); diffarg(0); execvp(*diffargv, diffargv); perror_fatal(*diffargv); } bVar1 = diraccess(param_2[optind]); bVar2 = diraccess(param_2[(long)optind + 1]); if ((bVar2 & bVar1) != 0) { fatal("both files to be compared are directories"); } local_a8 = expand_name(param_2[optind], bVar1, param_2[(long)optind + 1]); local_a0 = ck_fopen(local_a8, &DAT_001031c2); local_98 = expand_name(param_2[(long)optind + 1], bVar2, param_2[optind]); local_90 = ck_fopen(local_98, &DAT_001031c2); local_88 = ck_fopen(output, &DAT_001031c4); diffarg("--sdiff-merge-assist"); diffarg(&DAT_00103195); diffarg(param_2[optind]); diffarg(param_2[(long)optind + 1]); diffarg(0); trapsigs(); iVar4 = pipe(&local_18); if (iVar4 != 0) { perror_fatal(); } diffpid = fork(); if (diffpid < 0) { perror_fatal(); } if (diffpid != 0) { close(local_14); local_80 = fdopen(local_18, "r"); if (local_80 == (FILE *)0x0) { perror_fatal("fdopen"); } lf_init(local_38, local_80); lf_init(local_78, local_a0); lf_init(local_58, local_90); cVar3 = interact(local_38, local_78, local_a8, local_58, local_98, local_88); ck_fclose(local_a0); ck_fclose(local_90); ck_fclose(local_88); local_b4 = 0; ck_fclose(); while (_Var5 = waitpid(diffpid, &local_bc, 0), _Var5 < 0) { piVar7 = __errno_location(); if (*piVar7 == 4) { checksigs(); } else { perror_fatal(); } } diffpid = 0; if (tmpname != (char *)0x0) { unlink(tmpname); tmpname = (char *)0x0; } if (cVar3 != '\x01') { exiterr(); } check_child_status(local_b4, local_bc, 1, *diffargv); untrapsig(); checksigs(); exit(local_bc >> 8 & 0xff); } if (initial_action._912_8_ != 1) { signal_handler(2, 1); } signal_handler(0xd, 0); close(local_18); if (local_14 != 1) { dup2(local_14, 1); close(local_14); } execvp(*diffargv, diffargv); piVar7 = __errno_location(); if (*piVar7 == 2) { iVar4 = 0x7f; } else { iVar4 = 0x7e; } _exit(iVar4); } switch (local_b8) { case 0x42: diffarg(); goto LAB_00100bf3; default: try_help(0, 0); goto LAB_00100bf3; case 0x45: diffarg(); goto LAB_00100bf3; case 0x48: diffarg(); goto LAB_00100bf3; case 0x49: diffarg(&DAT_001030dd); diffarg(); goto LAB_00100bf3; case 0x57: diffarg(); goto LAB_00100bf3; case 0x5a: diffarg(); goto LAB_00100bf3; case 0x61: diffarg(); goto LAB_00100bf3; case 0x62: diffarg(); goto LAB_00100bf3; case 100: diffarg(); goto LAB_00100bf3; case 0x69: diffarg(); goto LAB_00100bf3; case 0x6c: diffarg(); goto LAB_00100bf3; case 0x6f: output = optarg; goto LAB_00100bf3; case 0x73: suppress_common_lines = '\x01'; goto LAB_00100bf3; case 0x74: diffarg(); goto LAB_00100bf3; case 0x76: uVar6 = proper_name("Thomas Lord"); version_etc(stdout, "sdiff", "GNU diffutils", Version, uVar6, 0); check_stdout(); break; case 0x77: diffarg(&DAT_00103111); diffarg(); goto LAB_00100bf3; case 0x80: *diffargv = optarg; goto LAB_00100bf3; case 0x81: usage(); check_stdout(); break; case 0x82: diffarg(); goto LAB_00100bf3; case 0x83: goto switchD_00100a2b_caseD_83; } if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) { __stack_chk_fail(); } return 0; switchD_00100a2b_caseD_83: diffarg("--tabsize"); diffarg(); goto LAB_00100bf3; }
diffutils
ghidra
SHELL_VAR **all_local_variables(visible_only) int visible_only; { VARLIST *vlist; SHELL_VAR **ret; VAR_CONTEXT *vc; vc = shell_variables; for (vc = shell_variables; vc; vc = vc->down) if ((((vc)->flags & 0x04) != 0) && vc->scope == variable_context) break; if (vc == 0) { internal_error( gettext("all_local_variables: no function context at current scope")); return (SHELL_VAR **)((void *)0); } if (vc->table == 0 || ((vc->table) ? (vc->table)->nentries : 0) == 0 || (((vc)->flags & 0x01) != 0) == 0) return (SHELL_VAR **)((void *)0); vlist = vlist_alloc(((vc->table) ? (vc->table)->nentries : 0)); if (visible_only) flatten(vc->table, visible_variable_in_context, vlist, 0); else flatten(vc->table, variable_in_context, vlist, 0); ret = vlist->list; sh_xfree((vlist), "variables.c", 4461); if (ret) sort_variables(ret); return ret; }
long long all_local_variables(unsigned long a0) { struct_0 *v0; unsigned long long *v1; unsigned long long v2; void *v4; v0 = shell_variables; for (v0 = shell_variables; v0 && (!(v0->field_c & 4) || v0->field_8 != variable_context); v0 = v0->field_18) ; if (!v0) { internal_error( gettext("all_local_variables: no function context at current scope")); v4 = 0; return v4; } else if (!v0->field_20) { v4 = 0; return v4; } else if (!v0->field_20) { v4 = 0; return v4; } else if (!v0->field_20->field_c) { v4 = 0; return v4; } else if (!(v0->field_c & 1)) { v4 = 0; return v4; } else { v1 = vlist_alloc((!v0->field_20 ? v0->field_20->field_c : 0)); if (!a0) flatten(v0->field_20, variable_in_context, v1, 0x0); else flatten(v0->field_20, visible_variable_in_context, v1, 0x0); v2 = *(v1); sh_xfree(v1, "variables.c", 0x116d); if (v2) sort_variables(v2); v4 = v2; return v4; } }
bash
angr_sailr
int sshpkt_get_u64(struct ssh *ssh, u_int64_t *valp) { return sshbuf_get_u64(ssh->state->incoming_packet, valp); }
void sshpkt_get_u64(long *param_1, undefined8 param_2) { sshbuf_get_u64(*(undefined8 *)(*param_1 + 0x38), param_2); return; }
openssh-portable
ghidra
static int iftruncate(int fd, off_t length) { int ret; do { process_signals(); ret = ftruncate(fd, length); } while (ret < 0 && (*__errno_location()) == 4); return ret; }
long iftruncate(int a1, __off_t a2) { int v3; do { process_signals(); v3 = ftruncate(a1, a2); } while (v3 < 0 && *_errno_location() == 4); return (unsigned int)v3; }
coreutils
ida
static void hdlr_sighup(void) { pthread_mutex_lock(&mutHadHUP); bHadHUP = 1; pthread_mutex_unlock(&mutHadHUP); r_dbgprintf("rsyslogd.c", "awaking mainthread on HUP\n"); pthread_kill(mainthread, 21); }
long long hdlr_sighup(unsigned long a0, unsigned long a1, unsigned long long a2) { pthread_mutex_lock(&mutHadHUP); bHadHUP = 1; pthread_mutex_unlock(&mutHadHUP); r_dbgprintf("rsyslogd.c", "awaking mainthread on HUP\n", a2); return pthread_kill(mainthread, 0x15); }
rsyslog-8.2210.0
angr_dream
static void *sortlines_thread(void *data) { struct thread_args const *args = data; sortlines(args->lines, args->nthreads, args->total_lines, args->node, args->queue, args->tfp, args->output_temp); return ((void *)0); }
void *sortlines_thread(unsigned char ***a1) { sortlines(*a1, (unsigned long)a1[1], (unsigned long)a1[2], (unsigned char ***)a1[3], (long)a1[4], (FILE *)a1[5], (char *)a1[6]); return 0LL; }
coreutils
ida
static void badfieldspec(char const *spec, char const *msgid) { ((!!sizeof(struct { _Static_assert( SORT_FAILURE, "verify_expr (" "SORT_FAILURE" ", " "(error (SORT_FAILURE, 0, gettext (\"%s: invalid field specification " "%s\"), gettext (msgid), quote (spec)), assume (false))" ")"); int _gl_dummy; })) ? ((error(SORT_FAILURE, 0, gettext("%s: invalid field specification %s"), gettext(msgid), quote(spec)), ((0) ? (void)0 : __builtin_unreachable()))) : ((error(SORT_FAILURE, 0, gettext("%s: invalid field specification %s"), gettext(msgid), quote(spec)), ((0) ? (void)0 : __builtin_unreachable())))); }
unsigned long badfieldspec(long a1, const char *a2) { long v2; char *v3; char *v4; v2 = quote(a1); v3 = gettext(a2); v4 = gettext("%s: invalid field specification %s"); error(2, 0, v4, v3, v2); return incompatible_options(2LL); }
coreutils
ida
static _Bool homogeneous_spec_list(struct Spec_list *s) { int b, c; s->state = ((18446744073709551615UL) - 1); if ((b = get_next(s, ((void *)0))) == -1) return 0; while ((c = get_next(s, ((void *)0))) != -1) if (c != b) return 0; return 1; }
int homogeneous_spec_list(struct_0 *a0) { unsigned int v0; unsigned int v1; unsigned int v3; a0->field_10 = -2; v0 = get_next(a0, NULL); if (v0 == -1) { v3 = 0; } else { while (true) { v1 = get_next(a0, NULL); if (v1 != -1) { if (v1 == v0) continue; v3 = 0; break; } else { v3 = 1; break; } } } return v3; }
coreutils
angr_dream
gzFile gzopen(path, mode) const char *path; const char *mode; { return gz_open(path, -1, mode); }
void *gzopen(const char *a1, char *a2) { return gz_open(a1, -1, a2); }
zlib
ida
int ttnocanon() { struct termios tt; if (ttsaved == 0) return -1; tt = ttin; return (ttfd_nocanon(0, &tt)); }
long long ttnocanon() { unsigned long v0; unsigned long v1; unsigned long v2; unsigned long v3; unsigned long v4; unsigned long v5; unsigned long v6; unsigned int v7; unsigned long long v9; if (!ttsaved) { v9 = 4294967295; } else { v0 = ttin; v1 = g_400748; v2 = g_400750; v3 = g_400758; v4 = g_400760; v5 = g_400768; v6 = g_400770; v7 = g_400778; v9 = ttfd_nocanon(0x0, &v0); } return v9; }
bash
angr_dream
inline void xset_binary_mode(int fd, int mode) { if (set_binary_mode(fd, mode) < 0) xset_binary_mode_error(); }
void xset_binary_mode(void) { halt_baddata(); }
coreutils
ghidra
static void _rl_move_cursor_relative(int new, const char *data, const char *dataf) { register int i; int woff; int cpos, dpos; int adjust; int in_invisline; int mb_cur_max = (__ctype_get_mb_cur_max()); woff = ((_rl_last_v_pos == 0) ? (wrap_offset ? (prompt_physical_chars > _rl_screenwidth ? prompt_invis_chars_first_line : wrap_offset) : 0) : ((_rl_last_v_pos == prompt_last_screen_line) ? wrap_offset - prompt_invis_chars_first_line : 0)); cpos = _rl_last_c_pos; if (cpos == 0 && cpos == new) return; if (mb_cur_max > 1 && rl_byte_oriented == 0) { adjust = 1; if (new == local_prompt_len && memcmp(data, local_prompt, new) == 0) { dpos = prompt_physical_chars; cpos_adjusted = 1; adjust = 0; } else if (new > local_prompt_len && local_prompt && memcmp(data, local_prompt, local_prompt_len) == 0) { dpos = prompt_physical_chars + _rl_col_width(data, local_prompt_len, new, 1); cpos_adjusted = 1; adjust = 0; } else dpos = _rl_col_width(data, 0, new, 1); if (displaying_prompt_first_line == 0) adjust = 0; in_invisline = 0; if (data > (line_state_invisible->line) && data < (line_state_invisible->line) + (line_state_invisible->lbreaks)[_rl_inv_botlin + 1]) in_invisline = data - (line_state_invisible->line); if (adjust && ((new > prompt_last_invisible) || (new + in_invisline > prompt_last_invisible) || (prompt_physical_chars >= _rl_screenwidth && _rl_last_v_pos == prompt_last_screen_line && wrap_offset >= woff && dpos >= woff && new > (prompt_last_invisible - ((line_state_visible->lbreaks)[_rl_last_v_pos]) - wrap_offset)))) { dpos -= woff; cpos_adjusted = 1; } } else dpos = new; if (cpos == dpos) return; if (mb_cur_max > 1 && rl_byte_oriented == 0) i = _rl_last_c_pos; else i = _rl_last_c_pos - woff; if (dpos == 0 || (((dpos) + 1) < ((_rl_last_c_pos) - (dpos))) || (_rl_term_autowrap && i == _rl_screenwidth)) { _rl_cr(); cpos = _rl_last_c_pos = 0; } if (cpos < dpos) { if (mb_cur_max > 1 && rl_byte_oriented == 0) { if (_rl_term_forward_char) { for (i = cpos; i < dpos; i++) tputs(_rl_term_forward_char, 1, _rl_output_character_function); } else { _rl_cr(); puts_face(data, dataf, new); } } else puts_face(data + cpos, dataf + cpos, new - cpos); } else if (cpos > dpos) _rl_backspace(cpos - dpos); _rl_last_c_pos = dpos; }
long long _rl_move_cursor_relative(unsigned long a0, void *a1, unsigned long long a2) { unsigned int v0; unsigned int v1; unsigned int v2; unsigned int v3; unsigned int v4; unsigned int v5; unsigned int v7; unsigned long long v8; unsigned long long v9; unsigned long long v10; unsigned int v11; unsigned int v12; v4 = __ctype_get_mb_cur_max(); if (!_rl_last_v_pos) { if (!*(&wrap_offset)) { v7 = 0; } else if (prompt_physical_chars > _rl_screenwidth) { v7 = *(&prompt_invis_chars_first_line); } else { v7 = *(&wrap_offset); } } else { if (_rl_last_v_pos == prompt_last_screen_line) v7 = *(&wrap_offset) - *(&prompt_invis_chars_first_line); else v7 = 0; } v5 = v7; v0 = _rl_last_c_pos; if (!v0) v10 = v0; if (v0 || v0 != a0) { if (v4 > 1 && !rl_byte_oriented) { v2 = 1; if (a0 == local_prompt_len) { v8 = memcmp(a1, local_prompt, a0); if (!v8) { v1 = prompt_physical_chars; cpos_adjusted = 1; v2 = 0; } } if (a0 != local_prompt_len || v8) { if (a0 > local_prompt_len && local_prompt) { v9 = memcmp(a1, local_prompt, local_prompt_len); if (!v9) { *(&v9) = _rl_col_width(a1, local_prompt_len, a0, 0x1) + prompt_physical_chars; v1 = v9; cpos_adjusted = 1; v2 = 0; } } if (a0 <= local_prompt_len || !local_prompt || v9) v1 = _rl_col_width(a1, 0x0, a0, 0x1); } if (!displaying_prompt_first_line) v2 = 0; v3 = 0; if (a1 > *(line_state_invisible) && a1 < *((*((line_state_invisible + 16)) + (_rl_inv_botlin + 1 << 2))) + *(line_state_invisible)) v3 = (a1 - *(line_state_invisible)); if (v2 && (a0 + v3 <= prompt_last_invisible && _rl_last_v_pos == prompt_last_screen_line && a0 <= prompt_last_invisible && prompt_physical_chars >= _rl_screenwidth && v5 <= *(&wrap_offset) && v1 >= v5 && a0 > prompt_last_invisible - *((*((line_state_visible + 16)) + (_rl_last_v_pos << 2))) - *(&wrap_offset) || a0 <= prompt_last_invisible && a0 + v3 > prompt_last_invisible || a0 > prompt_last_invisible)) { v1 -= v5; cpos_adjusted = 1; } } if (v4 <= 1 || rl_byte_oriented) v1 = a0; v10 = v0; if (v0 != v1) { if (v4 > 1 && !rl_byte_oriented) v11 = _rl_last_c_pos; if (v4 <= 1 || rl_byte_oriented) v11 = _rl_last_c_pos - v5; if (v1 + 1 < _rl_last_c_pos - v1 || !v1 || v11 == _rl_screenwidth && _rl_term_autowrap) { _rl_cr(); _rl_last_c_pos = 0; v0 = _rl_last_c_pos; } if (v0 < v1) { if (v4 > 1 && !rl_byte_oriented) { if (_rl_term_forward_char) { for (v12 = v0; v12 < v1; v12 += 1) { tputs(_rl_term_forward_char, 0x1, got._rl_output_character_function); } } else { _rl_cr(); puts_face(a1, a2, a0, a2); } } if (v4 <= 1 || rl_byte_oriented) puts_face(v0 + a1, v0 + a2, a0 - v0, v0 + a1); } else if (v0 > v1) { _rl_backspace(v0 - v1); } v10 = v1; _rl_last_c_pos = v1; } } return v10; }
bash
angr_dream
static int it_init_keywords(itp) ITEMLIST *itp; { STRINGLIST *sl; register int i, n; for (n = 0; word_token_alist[n].word; n++) ; sl = strlist_create(n); for (i = 0; i < n; i++) sl->list[i] = word_token_alist[i].word; sl->list[sl->list_len = i] = (char *)((void *)0); itp->flags |= 0x020; itp->slist = sl; return 0; }
long long it_init_keywords(struct_0 *a0) { struct_1 *v0; int tmp_42; void *v2; void *v3; for (v2 = 0; *((0x10 * v2 + &word_token_alist[0])); v2 = v2 + 1) ; v0 = strlist_create(v2); for (v3 = 0; v3 < v2; v3 = v3 + 1) { *((v3 * 8 + v0->field_0)) = *((0x10 * v3 + &word_token_alist[0])); } tmp_42 = v0->field_0; v0->field_c = v3; *((v0->field_c * 8 + tmp_42)) = 0; a0->field_0 = a0->field_0 | 32; a0->field_10 = v0; return 0; }
bash
angr_dream
static void create_variable_tables() { if (shell_variables == 0) { shell_variables = global_variables = new_var_context((char *)((void *)0), 0); shell_variables->scope = 0; shell_variables->table = hash_create(1024); } if (shell_functions == 0) shell_functions = hash_create(512); if (shell_function_defs == 0) shell_function_defs = hash_create(512); }
void create_variable_tables() { unsigned long long v1; if (shell_variables) { if (!shell_functions) shell_functions = hash_create(0x200); v1 = shell_function_defs; if (!shell_function_defs) { *(&shell_function_defs) = hash_create(0x200); return; } return; } }
bash
angr_sailr
void test_inflate(compr, comprLen, uncompr, uncomprLen) Byte *compr, *uncompr; uLong comprLen, uncomprLen; { int err; z_stream d_stream; strcpy((char *)uncompr, "garbage"); d_stream.zalloc = zalloc; d_stream.zfree = zfree; d_stream.opaque = (voidpf)0; d_stream.next_in = compr; d_stream.avail_in = 0; d_stream.next_out = uncompr; err = inflateInit_((&d_stream), "1.2.13", (int)sizeof(z_stream)); { if (err != 0) { fprintf(stderr, "%s error: %d\n", "inflateInit", err); exit(1); } }; while (d_stream.total_out < uncomprLen && d_stream.total_in < comprLen) { d_stream.avail_in = d_stream.avail_out = 1; err = inflate(&d_stream, 0); if (err == 1) break; { if (err != 0) { fprintf(stderr, "%s error: %d\n", "inflate", err); exit(1); } }; } err = inflateEnd(&d_stream); { if (err != 0) { fprintf(stderr, "%s error: %d\n", "inflateEnd", err); exit(1); } }; if (strcmp((char *)uncompr, hello)) { fprintf(stderr, "bad inflate\n"); exit(1); } else { printf("inflate(): %s\n", (char *)uncompr); } }
void test_inflate(undefined8 param_1, ulong param_2, char *param_3, ulong param_4) { uint uVar1; int iVar2; long in_FS_OFFSET; undefined8 local_88; undefined4 local_80; ulong local_78; char *local_70; undefined4 local_68; ulong local_60; undefined8 local_48; undefined8 local_40; undefined8 local_38; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); strcpy(param_3, "garbage"); local_48 = zalloc; local_40 = zfree; local_38 = 0; local_80 = 0; local_88 = param_1; local_70 = param_3; uVar1 = inflateInit_(&local_88, "1.2.13", 0x70); if (uVar1 != 0) { fprintf(stderr, "%s error: %d\n", "inflateInit", (ulong)uVar1); exit(1); } while ((local_60 < param_4 && (local_78 < param_2))) { local_68 = 1; local_80 = 1; uVar1 = inflate(&local_88, 0); if (uVar1 == 1) break; if (uVar1 != 0) { fprintf(stderr, "%s error: %d\n", "inflate", (ulong)uVar1); exit(1); } } uVar1 = inflateEnd(&local_88); if (uVar1 != 0) { fprintf(stderr, "%s error: %d\n", "inflateEnd", (ulong)uVar1); exit(1); } iVar2 = strcmp(param_3, hello); if (iVar2 == 0) { printf("inflate(): %s\n", param_3); if (local_10 == *(long *)(in_FS_OFFSET + 0x28)) { return; } __stack_chk_fail(); } fprintf(stderr, "bad inflate\n"); exit(1); }
zlib
ghidra
int channel_request_remote_forwarding(struct ssh *ssh, struct Forward *fwd) { int r, success = 0, idx = -1; char *host_to_connect, *listen_host, *listen_path; int port_to_connect, listen_port; if (fwd->listen_path != ((void *)0)) { if ((r = sshpkt_start(ssh, 80)) != 0 || (r = sshpkt_put_cstring(ssh, "streamlocal-forward@openssh.com")) != 0 || (r = sshpkt_put_u8(ssh, 1)) != 0 || (r = sshpkt_put_cstring(ssh, fwd->listen_path)) != 0 || (r = sshpkt_send(ssh)) != 0 || (r = ssh_packet_write_wait(ssh)) != 0) sshfatal("channels.c", __func__, 4096, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "request streamlocal"); } else { if ((r = sshpkt_start(ssh, 80)) != 0 || (r = sshpkt_put_cstring(ssh, "tcpip-forward")) != 0 || (r = sshpkt_put_u8(ssh, 1)) != 0 || (r = sshpkt_put_cstring( ssh, channel_rfwd_bind_host(fwd->listen_host))) != 0 || (r = sshpkt_put_u32(ssh, fwd->listen_port)) != 0 || (r = sshpkt_send(ssh)) != 0 || (r = ssh_packet_write_wait(ssh)) != 0) sshfatal("channels.c", __func__, 4106, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "request tcpip-forward"); } success = 1; if (success) { host_to_connect = listen_host = listen_path = ((void *)0); port_to_connect = listen_port = 0; if (fwd->connect_path != ((void *)0)) { host_to_connect = xstrdup(fwd->connect_path); port_to_connect = -2; } else { host_to_connect = xstrdup(fwd->connect_host); port_to_connect = fwd->connect_port; } if (fwd->listen_path != ((void *)0)) { listen_path = xstrdup(fwd->listen_path); listen_port = -2; } else { if (fwd->listen_host != ((void *)0)) listen_host = xstrdup(fwd->listen_host); listen_port = fwd->listen_port; } idx = permission_set_add(ssh, 0x101, (1 << 1), host_to_connect, port_to_connect, listen_host, listen_path, listen_port, ((void *)0)); } return idx; }
undefined4 channel_request_remote_forwarding(undefined8 param_1, long *param_2) { long lVar1; undefined4 uVar2; undefined8 uVar3; long **pplVar4; long **pplVar5; ulong auStack144[7]; char *pcStack88; undefined8 uStack80; long *local_48; undefined8 local_40; int local_34; undefined4 local_30; undefined4 local_2c; uint local_28; undefined4 local_24; undefined8 local_20; undefined8 local_18; undefined8 local_10; pplVar4 = &local_48; local_48 = param_2; local_24 = 0; local_30 = 0xffffffff; local_40 = param_1; if (param_2[2] != 0) { uStack80 = 0x10d971; local_34 = sshpkt_start(param_1, 0x50); if (local_34 == 0) { uStack80 = 0x10d991; local_34 = sshpkt_put_cstring(local_40, "streamlocal-forward@openssh.com"); if (local_34 == 0) { uStack80 = 0x10d9ab; local_34 = sshpkt_put_u8(local_40, 1); if (local_34 == 0) { uStack80 = 0x10d9cb; local_34 = sshpkt_put_cstring(local_40, local_48[2]); if (local_34 == 0) { uStack80 = 0x10d9e0; local_34 = sshpkt_send(local_40); if (local_34 == 0) { uStack80 = 0x10d9f5; local_34 = ssh_packet_write_wait(local_40); pplVar5 = &local_48; if (local_34 == 0) goto LAB_0010db50; } } } } } uStack80 = 0x10da0c; uVar3 = ssh_err(local_34); pplVar4 = (long **)&pcStack88; pcStack88 = "request streamlocal"; sshfatal("channels.c", "channel_request_remote_forwarding", 0x1000, 1, 1, uVar3); } *(undefined8 *)((long)pplVar4 + -8) = 0x10da54; local_34 = sshpkt_start(local_40, 0x50); if (local_34 == 0) { *(undefined8 *)((long)pplVar4 + -8) = 0x10da74; local_34 = sshpkt_put_cstring(local_40, "tcpip-forward"); if (local_34 == 0) { *(undefined8 *)((long)pplVar4 + -8) = 0x10da92; local_34 = sshpkt_put_u8(local_40, 1); if (local_34 == 0) { lVar1 = *local_48; *(undefined8 *)((long)pplVar4 + -8) = 0x10daaa; uVar3 = channel_rfwd_bind_host(lVar1); *(undefined8 *)((long)pplVar4 + -8) = 0x10dabc; local_34 = sshpkt_put_cstring(local_40, uVar3); if (local_34 == 0) { uVar2 = *(undefined4 *)(local_48 + 1); *(undefined8 *)((long)pplVar4 + -8) = 0x10dadc; local_34 = sshpkt_put_u32(local_40, uVar2); if (local_34 == 0) { *(undefined8 *)((long)pplVar4 + -8) = 0x10daf1; local_34 = sshpkt_send(local_40); if (local_34 == 0) { *(undefined8 *)((long)pplVar4 + -8) = 0x10db06; local_34 = ssh_packet_write_wait(local_40); pplVar5 = pplVar4; if (local_34 == 0) goto LAB_0010db50; } } } } } } *(undefined8 *)((long)pplVar4 + -8) = 0x10db19; uVar3 = ssh_err(local_34); pplVar5 = (long **)((long)pplVar4 + -0x10); *(char **)((long)pplVar4 + -0x10) = "request tcpip-forward"; *(undefined8 *)((long)pplVar4 + -0x18) = 0x10db50; sshfatal("channels.c", "channel_request_remote_forwarding", 0x100a, 1, 1, uVar3); LAB_0010db50: local_24 = 1; local_10 = 0; local_18 = 0; local_20 = 0; local_28 = 0; local_2c = 0; if (local_48[5] == 0) { lVar1 = local_48[3]; *(undefined8 *)((long)pplVar5 + -8) = 0x10dbc0; local_20 = xstrdup(lVar1); local_2c = *(undefined4 *)(local_48 + 4); } else { lVar1 = local_48[5]; *(undefined8 *)((long)pplVar5 + -8) = 0x10dba3; local_20 = xstrdup(lVar1); local_2c = 0xfffffffe; } if (local_48[2] == 0) { if (*local_48 != 0) { lVar1 = *local_48; *(undefined8 *)((long)pplVar5 + -8) = 0x10dc13; local_18 = xstrdup(lVar1); } local_28 = *(uint *)(local_48 + 1); } else { lVar1 = local_48[2]; *(undefined8 *)((long)pplVar5 + -8) = 0x10dbeb; local_10 = xstrdup(lVar1); local_28 = 0xfffffffe; } *(undefined8 *)((long)pplVar5 + -0x10) = 0; *(ulong *)((long)pplVar5 + -0x18) = (ulong)local_28; *(undefined8 *)((long)pplVar5 + -0x20) = local_10; *(undefined8 *)((long)pplVar5 + -0x28) = 0x10dc58; uVar2 = permission_set_add(local_40, 0x101, 2, local_20, local_2c, local_18); return uVar2; }
openssh-portable
ghidra
char *match_filter_allowlist(const char *proposal, const char *filter) { return filter_list(proposal, filter, 0); }
void *match_filter_allowlist(const char *a1, const char *a2) { return filter_list(a1, a2, 0); }
openssh-portable
ida
print_cookie(const char *name, const char *fmt, const uint8_t *cookie, int len) { char abuf[32]; size_t n; n = snprintf(abuf, sizeof(abuf), "%02x%02x%02x%02x", cookie[0], cookie[1], cookie[2], cookie[3]); if (len == 8) snprintf(abuf + n, sizeof(abuf) - n, "%02x%02x%02x%02x", cookie[4], cookie[5], cookie[6], cookie[7]); print_string(PRINT_ANY, name, fmt, abuf); }
void print_cookie(unsigned long long a0, unsigned long long a1, char a2[8], unsigned long a3) { unsigned long v0; char v1; char v2; unsigned long long *v4; unsigned long long v5; v0 = snprintf(&v1, 0x20, "%02x%02x%02x%02x", a2[0], a2[1], a2[2], a2[3]); if (a3 == 8) snprintf(&(&v1)[v0], 32 - v0, "%02x%02x%02x%02x", a2[4], a2[5], a2[6], a2[7]); print_string(0x4, a0, a1, &v1); v5 = *(&v2) ^ v4[5]; return; }
iproute2-6.0.0
angr_dream
static _Bool fold_file(char const *filename, size_t width) { FILE *istream; int c; size_t column = 0; size_t offset_out = 0; static char *line_out = ((void *)0); static size_t allocated_out = 0; int saved_errno; if ((strcmp(filename, "-") == 0)) { istream = stdin; have_read_stdin = 1; } else istream = fopen(filename, "r"); if (istream == ((void *)0)) { error(0, (*__errno_location()), "%s", quotearg_n_style_colon(0, shell_escape_quoting_style, filename)); return 0; } fadvise(istream, FADVISE_SEQUENTIAL); while ((c = getc_unlocked(istream)) != (-1)) { if (offset_out + 1 >= allocated_out) line_out = ((!!sizeof(struct { _Static_assert(sizeof *(line_out) == 1, "verify_expr (" "sizeof *(line_out) == 1" ", " "x2realloc (line_out, &allocated_out)" ")"); int _gl_dummy; })) ? (x2realloc(line_out, &allocated_out)) : (x2realloc(line_out, &allocated_out))); if (c == '\n') { line_out[offset_out++] = c; fwrite_unlocked(line_out, sizeof(char), offset_out, stdout); column = offset_out = 0; continue; } rescan: column = adjust_column(column, c); if (column > width) { if (break_spaces) { _Bool found_blank = 0; size_t logical_end = offset_out; while (logical_end) { --logical_end; if (((*__ctype_b_loc())[(int)((to_uchar(line_out[logical_end])))] & (unsigned short int)_ISblank)) { found_blank = 1; break; } } if (found_blank) { size_t i; logical_end++; fwrite_unlocked(line_out, sizeof(char), (size_t)logical_end, stdout); putchar_unlocked('\n'); memmove(line_out, line_out + logical_end, offset_out - logical_end); offset_out -= logical_end; for (column = i = 0; i < offset_out; i++) column = adjust_column(column, line_out[i]); goto rescan; } } if (offset_out == 0) { line_out[offset_out++] = c; continue; } line_out[offset_out++] = '\n'; fwrite_unlocked(line_out, sizeof(char), (size_t)offset_out, stdout); column = offset_out = 0; goto rescan; } line_out[offset_out++] = c; } saved_errno = (*__errno_location()); if (!ferror_unlocked(istream)) saved_errno = 0; if (offset_out) fwrite_unlocked(line_out, sizeof(char), (size_t)offset_out, stdout); if ((strcmp(filename, "-") == 0)) clearerr_unlocked(istream); else if (rpl_fclose(istream) != 0 && !saved_errno) saved_errno = (*__errno_location()); if (saved_errno) { error(0, saved_errno, "%s", quotearg_n_style_colon(0, shell_escape_quoting_style, filename)); return 0; } return 1; }
int fold_file(char *a0, unsigned long a1) { int tmp_17; int tmp_12; char v0; int tmp_16; unsigned int v1; unsigned int v2; void *v3; void *v4; void *v5; void *v6; void *v7; unsigned long long v9; unsigned int v10; v4 = 0; v5 = 0; if (!strcmp(a0, "-")) { v3 = stdin; have_read_stdin = 1; } else { v3 = fopen(a0, "r"); } if (!v3) { v9 = quotearg_n_style_colon(0x0, 0x3, a0); error(0x0, *(__errno_location()), "%s"); v10 = 0; return v10; } fadvise(v3, 0x2); while (true) { v2 = getc_unlocked(v3); if (v2 == -1) break; if (v5 + 1 >= allocated_out.5794) line_out.5793 = x2realloc(line_out.5793, &allocated_out.5794); if (v2 == 10) { tmp_17 = v5; v5 += 1; *((tmp_17 + line_out.5793)) = v2; fwrite_unlocked(line_out.5793, 0x1, v5, *(&stdout)); v5 = 0; v4 = v5; } else { while (true) { v10 = adjust_column(v4, v2); v4 = v10; if (*(&v4) <= a1) { tmp_12 = v5; v5 += 1; *((tmp_12 + line_out.5793)) = v2; break; } else { if (break_spaces) { v0 = 0; v6 = v5; do { if (!v6) goto LABEL_40063b; v6 -= 1; *(&v10) = *((to_uchar(*(v6 + line_out.5793)) * 2 + *(__ctype_b_loc()))); v10 = v10 & 1; } while (!v10); v0 = 1; LABEL_40063b: if (v0) { *(&v6) = v6 + 1; fwrite_unlocked(line_out.5793, 0x1, *(&v6), *(&stdout)); putchar_unlocked(0xa); memmove(line_out.5793, line_out.5793 + *(&v6), v5 - *(&v6)); v5 -= *(&v6); v7 = 0; for (v4 = v7; v7 < v5; v7 += 1) { v4 = adjust_column(v4, *(v7 + line_out.5793)); } } } if (v5) { tmp_16 = v5; v5 += 1; *((tmp_16 + line_out.5793)) = 10; fwrite_unlocked(line_out.5793, 0x1, v5, *(&stdout)); v5 = 0; v4 = v5; } else { tmp_12 = v5; v5 += 1; *((tmp_12 + line_out.5793)) = v2; break; } } } } } v1 = *(__errno_location()); if (!ferror_unlocked(v3)) v1 = 0; if (v5) fwrite_unlocked(line_out.5793, 0x1, v5, *(&stdout)); if (!strcmp(a0, "-")) { clearerr_unlocked(v3); } else if (rpl_fclose(v3) && !v1) { v10 = *(__errno_location()); v1 = v10; } if (!v1) { v10 = 1; return v10; } quotearg_n_style_colon(0x0, 0x3, a0); error(0x0, v1, "%s"); v10 = 0; return v10; }
coreutils
angr_sailr
static int delete_tunnel(struct l2tp_parm *p) { struct { struct nlmsghdr n; struct genlmsghdr g; char buf[(((0) + 4U - 1) & ~(4U - 1)) + (128)]; } req = { .n = { .nlmsg_type = (genl_family), .nlmsg_flags = (0x01 | 0x04), .nlmsg_len = (((((sizeof(struct genlmsghdr)) + 4U - 1) & ~(4U - 1)) + (0)) + ((int)(((sizeof(struct nlmsghdr)) + 4U - 1) & ~(4U - 1)))), }, .g = { .cmd = (L2TP_CMD_TUNNEL_DELETE), .version = (0x1), }, }; addattr32(&req.n, 128, L2TP_ATTR_CONN_ID, p->tunnel_id); if (rtnl_talk(&genl_rth, &req.n, ((void *)0)) < 0) return -2; return 0; }
void delete_tunnel(unsigned long a0) { unsigned int *v0; void *v1; unsigned short v2; unsigned short v3; char v4; char v5; unsigned long long v7; void *v8; unsigned long v9; unsigned long long v10; void *v11; v0 = a0; v7 = 18; for (v8 = &v1; v7; v8 += v9 * 8) { v7 -= 1; v1 = 0; } *(v8) = 0; v1 = 20; v2 = genl_family; v3 = 5; v4 = 2; v5 = 1; addattr32(&v1, 0x80, 0x9, *(v0)); if (rtnl_talk(&genl_rth, &v1, 0x0) < 0) v10 = 4294967294; else v11 = 0; return; }
iproute2-6.0.0
angr_phoenix
void check_resize_inode(e2fsck_t ctx) { ext2_filsys fs = ctx->fs; struct ext2_inode inode; struct problem_context pctx; int i, gdt_off, ind_off; dgrp_t j; blk_t blk, pblk; blk_t expect; __u32 *dind_buf = 0, *ind_buf; errcode_t retval; clear_problem_context(&pctx); if (ext2fs_has_feature_resize_inode(fs->super) && ext2fs_has_feature_meta_bg(fs->super) && fix_problem(ctx, 0x000051, &pctx)) { ext2fs_clear_feature_resize_inode(fs->super); fs->super->s_reserved_gdt_blocks = 0; ext2fs_mark_super_dirty(fs); } if (!ext2fs_has_feature_resize_inode(fs->super)) { if (fs->super->s_reserved_gdt_blocks) { pctx.num = fs->super->s_reserved_gdt_blocks; if (fix_problem(ctx, 0x00002E, &pctx)) { fs->super->s_reserved_gdt_blocks = 0; ext2fs_mark_super_dirty(fs); } } } pctx.ino = 7; retval = ext2fs_read_inode(fs, 7, &inode); if (retval) { if (ext2fs_has_feature_resize_inode(fs->super)) ctx->flags |= 0x0400; return; } if (!ext2fs_has_feature_resize_inode(fs->super)) { for (i = 0; i < (((12 + 1) + 1) + 1); i++) { if (inode.i_block[i]) break; } if ((i < (((12 + 1) + 1) + 1)) && fix_problem(ctx, 0x00002F, &pctx)) { memset(&inode, 0, sizeof(inode)); e2fsck_write_inode(ctx, 7, &inode, "clear_resize"); } return; } blk = inode.i_block[(12 + 1)]; for (i = 0; i < (((12 + 1) + 1) + 1); i++) { if (i != (12 + 1) && inode.i_block[i]) break; } if ((i < (((12 + 1) + 1) + 1)) || !blk || !inode.i_links_count || !(inode.i_mode & 0100000) || (blk < fs->super->s_first_data_block || blk >= ext2fs_blocks_count(fs->super))) { resize_inode_invalid: if (fix_problem(ctx, 0x000030, &pctx)) { memset(&inode, 0, sizeof(inode)); e2fsck_write_inode(ctx, 7, &inode, "clear_resize"); ctx->flags |= 0x0400; } if (!(ctx->options & 0x0001)) { fs->super->s_state &= ~0x0001; ext2fs_mark_super_dirty(fs); } goto cleanup; } dind_buf = (__u32 *)e2fsck_allocate_memory(ctx, fs->blocksize * 2, "resize dind buffer"); ind_buf = (__u32 *)((char *)dind_buf + fs->blocksize); retval = ext2fs_read_ind_block(fs, blk, dind_buf); if (retval) goto resize_inode_invalid; gdt_off = fs->desc_blocks; pblk = fs->super->s_first_data_block + 1 + fs->desc_blocks; if (fs->blocksize == 1024 && fs->super->s_first_data_block == 0) pblk++; for (i = 0; i < fs->super->s_reserved_gdt_blocks / 4; i++, gdt_off++, pblk++) { gdt_off %= fs->blocksize / 4; if (dind_buf[gdt_off] != pblk) goto resize_inode_invalid; retval = ext2fs_read_ind_block(fs, pblk, ind_buf); if (retval) goto resize_inode_invalid; ind_off = 0; for (j = 1; j < fs->group_desc_count; j++) { if (!ext2fs_bg_has_super(fs, j)) continue; expect = pblk + ((blk64_t)((fs->super)->s_blocks_per_group) * (j)); if (ind_buf[ind_off] != expect) goto resize_inode_invalid; ind_off++; } } cleanup: if (dind_buf) ext2fs_free_mem(&dind_buf); }
long long check_resize_inode(struct_0 *a0) { int tmp_17; unsigned int v0; unsigned int v1; unsigned int v2; unsigned int v3; unsigned int v4; unsigned int v5; unsigned int v6; unsigned int *v7; struct_1 *v8; unsigned long v9; unsigned int *v10; char v11; unsigned int v12; unsigned long v13; char v14; char v15; char v16; char v17; unsigned long long v19; unsigned long long v20; v8 = a0->field_0; v7 = 0; clear_problem_context(&v11); if (ext2fs_has_feature_resize_inode(v8->field_20) && ext2fs_has_feature_meta_bg(v8->field_20) && fix_problem(a0, 0x51, &v11)) { ext2fs_clear_feature_resize_inode(v8->field_20); v8->field_20->field_ce = 0; ext2fs_mark_super_dirty(v8); } if (!ext2fs_has_feature_resize_inode(v8->field_20) && v8->field_20->field_ce) { v13 = v8->field_20->field_ce; if (fix_problem(a0, 0x2e, &v11)) { v8->field_20->field_ce = 0; ext2fs_mark_super_dirty(v8); } } v12 = 7; v9 = ext2fs_read_inode(v8, 0x7, &v14); if (v9) { if (!ext2fs_has_feature_resize_inode(v8->field_20)) return 0; v19 = a0->field_48; *(&v19) = (a0->field_48 >> 8) | 4; tmp_17 = v19; a0->field_48 = tmp_17; return 0; } else { if (ext2fs_has_feature_resize_inode(v8->field_20)) { v5 = *(&v17); for (v0 = 0; v0 <= 14 && (v0 == 13 || !*(&(&v15)[32 + 4 * v0])); v0 += 1) ; if (v0 <= 14 || !v5 || !*(&v16) || *(&v14) >= 0 || v5 < v8->field_20->field_14 || v5 >= ext2fs_blocks_count(v8->field_20)) goto LABEL_4015fa; v7 = e2fsck_allocate_memory(a0, v8->field_28 * 2, "resize dind buffer", v8->field_28 * 2); v10 = v8->field_28 + v7; v9 = ext2fs_read_ind_block(v8, v5, v7, v5); if (v9) { LABEL_4015fa: if (fix_problem(a0, 0x30, &v11)) { memset(&v14, 0x0, 0x80); e2fsck_write_inode(a0, 0x7, &v14, "clear_resize"); v20 = a0->field_48; *(&v20) = (a0->field_48 >> 8) | 4; tmp_17 = v20; a0->field_48 = tmp_17; } if (!(a0->field_4c & 1)) { v8->field_20->field_3a = v8->field_20->field_3a & 4294967294; ext2fs_mark_super_dirty(v8); } } else { v1 = v8->field_38; v4 = v8->field_38 + v8->field_20->field_14 + 1; if (v8->field_28 == 0x400 && !v8->field_20->field_14) v4 += 1; v0 = 0; LABEL_4018d9: if (v0 < (v8->field_20->field_ce >> 2)) { v1 = (0 CONCAT v1) / m(v8->field_28 >> 2) >> 32; if (v4 == v7[v1] && (v9 = ext2fs_read_ind_block(v8, v4, v10, v4), !v9)) { v2 = 0; v3 = 1; while (true) { if (v3 >= v8->field_30) { v0 += 1; v1 += 1; v4 += 1; goto LABEL_4018d9; } else { if (ext2fs_bg_has_super(v8, v3, v3)) { v6 = v4 + v3 * v8->field_20->field_20; if (v6 != v10[v2]) break; v2 += 1; } v3 += 1; } } } } } if (v7) { ext2fs_free_mem(&v7); return 0; } return 0; } else { for (v0 = 0; v0 <= 14 && !*(&(&v15)[32 + 4 * v0]); v0 += 1) ; if (v0 > 14) { return 0; } else if (!fix_problem(a0, 0x2f, &v11)) { return 0; } else { memset(&v14, 0x0, 0x80); e2fsck_write_inode(a0, 0x7, &v14, "clear_resize"); return 0; } } } }
e2fsprogs-1.46.5
angr_sailr
void channel_prepare_poll(struct ssh *ssh, struct pollfd **pfdp, u_int *npfd_allocp, u_int *npfd_activep, u_int npfd_reserved, time_t *minwait_secs) { struct ssh_channels *sc = ssh->chanctxt; u_int i, oalloc, p, npfd = npfd_reserved; channel_before_prepare_io(ssh); for (i = 0; i < sc->channels_alloc; i++) { if (sc->channels[i] == ((void *)0)) continue; sc->channels[i]->io_want = sc->channels[i]->io_ready = 0; } if (sc->channels_alloc >= (0x7fffffff / 4) - npfd_reserved) sshfatal("channels.c", __func__, 2620, 1, SYSLOG_LEVEL_FATAL, ((void *)0), "too many channels"); npfd += sc->channels_alloc * 4; if (npfd > *npfd_allocp) { *pfdp = xrecallocarray(*pfdp, *npfd_allocp, npfd, sizeof(**pfdp)); *npfd_allocp = npfd; } *npfd_activep = npfd_reserved; oalloc = sc->channels_alloc; channel_handler(ssh, CHAN_PRE, minwait_secs); if (oalloc != sc->channels_alloc) { sshfatal("channels.c", __func__, 2634, 1, SYSLOG_LEVEL_FATAL, ((void *)0), "channels_alloc changed during CHAN_PRE " "(was %u, now %u)", oalloc, sc->channels_alloc); } p = npfd_reserved; for (i = 0; i < sc->channels_alloc; i++) channel_prepare_pollfd(sc->channels[i], &p, *pfdp, npfd); *npfd_activep = p; }
long long channel_prepare_poll(struct_2 *a0, unsigned long long *a1, unsigned int *a2, unsigned int *a3, unsigned long a4, unsigned long long *a5) { unsigned long long v0; unsigned int v1; unsigned int v2; unsigned int v3; unsigned int v4; struct_3 *v5; unsigned long v6; v5 = a0->field_868; v3 = a4; channel_before_prepare_io(a0); for (v2 = 0; v2 < v5->field_8; v2 += 1) { if (*((v5->field_0 + (v2 << 3)))) { *((*((v5->field_0 + v2 * 8)) + 48)) = 0; *((*((v5->field_0 + v2 * 8)) + 44)) = *((*((v5->field_0 + v2 * 8)) + 48)); } } if (v5->field_8 >= 536870911 - a4) { v0 = "too many channels"; sshfatal("channels.c", "channel_prepare_poll", 0xa3c, 0x1, 0x1, 0x0); } v3 += (v5->field_8 * 4); if (v3 > *(a2)) { *(a1) = xrecallocarray(*(a1), *(a2), v3, 0x8); *(a2) = v3; } *(a3) = a4; v4 = v5->field_8; channel_handler(a0, 0x0, a5); if (v4 != v5->field_8) { v6 = v5->field_8; v5 = v4; v3 = "channels_alloc changed during CHAN_PRE (was %u, now %u)"; sshfatal("channels.c", "channel_prepare_poll", 0xa4a, 0x1, 0x1, 0x0); } v1 = a4; for (v2 = 0; v2 < v5->field_8; v2 += 1) { channel_prepare_pollfd(*((v5->field_0 + v2 * 8)), &a4, *(a1), v3); } *(a3) = v1; return 0; }
openssh-portable
angr_sailr
int sshbuf_put_bignum2_bytes(struct sshbuf *buf, const void *v, size_t len) { u_char *d; const u_char *s = (const u_char *)v; int r, prepend; if (len > 0x8000000 - 5) { ; return -9; } for (; len > 0 && *s == 0; len--, s++) ; prepend = len > 0 && (s[0] & 0x80) != 0; if ((r = sshbuf_reserve(buf, len + 4 + prepend, &d)) < 0) return r; do { const u_int32_t __v = (len + prepend); ((u_char *)(d))[0] = (__v >> 24) & 0xff; ((u_char *)(d))[1] = (__v >> 16) & 0xff; ((u_char *)(d))[2] = (__v >> 8) & 0xff; ((u_char *)(d))[3] = __v & 0xff; } while (0); if (prepend) d[4] = 0; if (len != 0) memcpy(d + 4 + prepend, s, len); return 0; }
long sshbuf_put_bignum2_bytes(long a1, void *a2, unsigned long a3) { _BOOL4 v4; unsigned long n; _BOOL4 v6; int v7; _BYTE *v8; void *src; unsigned long v10; n = a3; v10 = __readfsqword(0x28u); src = a2; if (a3 > 0x7FFFFFB) return 4294967287LL; while (n && !*(_BYTE *)src) { --n; src = (char *)src + 1; } v4 = n && *(char *)src < 0; v6 = v4; v7 = sshbuf_reserve(a1, v4 + n + 4, &v8); if (v7 < 0) return (unsigned int)v7; *v8 = (unsigned int)(n + v6) >> 24; v8[1] = (unsigned int)(n + v6) >> 16; v8[2] = (unsigned short)(n + v6) >> 8; v8[3] = n + v6; if (v6) v8[4] = 0; if (n) memcpy(&v8[v6 + 4], src, n); return 0LL; }
openssh-portable
ida
static void validate_tab_stops(uintmax_t const *tabs, size_t entries) { uintmax_t prev_tab = 0; for (size_t i = 0; i < entries; i++) { if (tabs[i] == 0) ((!!sizeof(struct { _Static_assert( 1, "verify_expr (" "1" ", " "(error (1, 0, gettext (\"tab size cannot be 0\")), assume (false))" ")"); int _gl_dummy; })) ? ((error(1, 0, gettext("tab size cannot be 0")), ((0) ? (void)0 : __builtin_unreachable()))) : ((error(1, 0, gettext("tab size cannot be 0")), ((0) ? (void)0 : __builtin_unreachable())))); if (tabs[i] <= prev_tab) ((!!sizeof(struct { _Static_assert(1, "verify_expr (" "1" ", " "(error (1, 0, gettext (\"tab sizes must be " "ascending\")), assume (false))" ")"); int _gl_dummy; })) ? ((error(1, 0, gettext("tab sizes must be ascending")), ((0) ? (void)0 : __builtin_unreachable()))) : ((error(1, 0, gettext("tab sizes must be ascending")), ((0) ? (void)0 : __builtin_unreachable())))); prev_tab = tabs[i]; } if (increment_size && extend_size) ((!!sizeof(struct { _Static_assert(1, "verify_expr (" "1" ", " "(error (1, 0, gettext (\"'/' specifier is mutually " "exclusive with '+'\")), assume (false))" ")"); int _gl_dummy; })) ? ((error(1, 0, gettext("'/' specifier is mutually exclusive with '+'")), ((0) ? (void)0 : __builtin_unreachable()))) : ((error(1, 0, gettext("'/' specifier is mutually exclusive with '+'")), ((0) ? (void)0 : __builtin_unreachable())))); }
void validate_tab_stops(void *a0, unsigned long a1) { void *v0; void *v1; unsigned long long v3; unsigned long long v4; v0 = 0; v1 = 0; while (v1 < a1) { if (!*((a0 + 0x8 * v1))) { error(0x1, 0x0, gettext("tab size cannot be 0")); } else if (v0 < *((a0 + 0x8 * v1))) { v0 = *((a0 + 0x8 * v1)); v1 += 1; } else { error(0x1, 0x0, gettext("tab sizes must be ascending")); } } v3 = increment_size; if (!increment_size) return; v4 = extend_size; if (!extend_size) return; error(0x1, 0x0, gettext("'/' specifier is mutually exclusive with '+'")); }
coreutils
angr_sailr
HANDLER_ENTRY *find_directive(directive) char *directive; { register int i; for (i = 0; handlers[i].directive; i++) if (strcmp(handlers[i].directive, directive) == 0) return (&handlers[i]); return ((HANDLER_ENTRY *)((void *)0)); }
int find_directive(char *a0) { void *v1; unsigned int v2; v1 = 0; while (true) { if (!*((0x10 * v1 + &handlers[0]))) { v2 = 0; break; } else if (strcmp(*((0x10 * v1 + &handlers[0])), a0)) { v1 = v1 + 1; } else { v2 = (&handlers[0] + 0x10 * v1); break; } } return v2; }
bash
angr_phoenix
static tcflag_t *mode_type_flag(enum mode_type type, struct termios *mode) { switch (type) { case control: return &mode->c_cflag; case input: return &mode->c_iflag; case output: return &mode->c_oflag; case local: return &mode->c_lflag; case combination: return ((void *)0); default: abort(); } }
int mode_type_flag(unsigned long a0, unsigned long a1) { unsigned int v1; switch (a0) { case 0: v1 = a1 + 8; break; case 1: v1 = a1; break; case 2: v1 = a1 + 4; break; case 3: v1 = a1 + 12; break; case 4: v1 = 0; break; default: abort(); } return v1; }
coreutils
angr_phoenix