input
stringlengths
26
172k
output
stringlengths
18
318k
repo_name
stringclasses
23 values
decompiler
stringclasses
5 values
int sshbuf_set_max_size(struct sshbuf *buf, size_t max_size) { size_t rlen; u_char *dp; int r; ; if ((r = sshbuf_check_sanity(buf)) != 0) return r; if (max_size == buf->max_size) return 0; if (buf->readonly || buf->refcount > 1) return -49; if (max_size > 0x8000000) return -9; sshbuf_maybe_pack(buf, max_size < buf->size); if (max_size < buf->alloc && max_size > buf->size) { if (buf->size < 256) rlen = 256; else rlen = ((((buf->size) + ((256) - 1)) / (256)) * (256)); if (rlen > max_size) rlen = max_size; ; if ((dp = recallocarray(buf->d, buf->alloc, rlen, 1)) == ((void *)0)) return -2; buf->cd = buf->d = dp; buf->alloc = rlen; }; if (max_size < buf->alloc) return -9; buf->max_size = max_size; return 0; }
int sshbuf_set_max_size(long *param_1, ulong param_2) { int iVar1; long lVar2; ulong local_18; iVar1 = sshbuf_check_sanity(param_1); if (iVar1 == 0) { if (param_2 == param_1[4]) { iVar1 = 0; } else if ((*(int *)(param_1 + 6) == 0) && (*(uint *)(param_1 + 7) < 2)) { if (param_2 < 0x8000001) { sshbuf_maybe_pack(param_1, param_2 < (ulong)param_1[3]); if ((param_2 < (ulong)param_1[5]) && ((ulong)param_1[3] < param_2)) { if ((ulong)param_1[3] < 0x100) { local_18 = 0x100; } else { local_18 = param_1[3] + 0xffU & 0xffffffffffffff00; } if (param_2 < local_18) { local_18 = param_2; } lVar2 = recallocarray(*param_1, param_1[5], local_18, 1); if (lVar2 == 0) { return -2; } *param_1 = lVar2; param_1[1] = *param_1; param_1[5] = local_18; } if (param_2 < (ulong)param_1[5]) { iVar1 = -9; } else { param_1[4] = param_2; iVar1 = 0; } } else { iVar1 = -9; } } else { iVar1 = -0x31; } } return iVar1; }
openssh-portable
ghidra
inline void ext2fs_mark_super_dirty(ext2_filsys fs) { fs->flags |= 0x04 | 0x02; }
void ext2fs_mark_super_dirty(void) { halt_baddata(); }
e2fsprogs-1.46.5
ghidra
vi_to_history_line(EditLine *el, wint_t c __attribute__((__unused__))) { int sv_event_no = el->el_history.eventno; el_action_t rval; if (el->el_history.eventno == 0) { (void)wcsncpy(el->el_history.buf, el->el_line.buffer, ((size_t)1024)); el->el_history.last = el->el_history.buf + (el->el_line.lastchar - el->el_line.buffer); } if (!el->el_state.doingarg) { el->el_history.eventno = 0x7fffffff; hist_get(el); } else { el->el_history.eventno = 1; if (hist_get(el) == 6) return 6; el->el_history.eventno = 1 + el->el_history.ev.num - el->el_state.argument; if (el->el_history.eventno < 0) { el->el_history.eventno = sv_event_no; return 6; } } rval = hist_get(el); if (rval == 6) el->el_history.eventno = sv_event_no; return rval; }
int vi_to_history_line(struct_0 *a0, unsigned long a1) { unsigned int v0; char v1; unsigned int v2; unsigned int v4; v0 = a1; v2 = a0->field_470; if (!a0->field_470) { wcsncpy(a0->field_458, a0->field_50, 0x400); a0->field_468 = a0->field_458 + a0->field_60 - a0->field_50; } if (!a0->field_74) { a0->field_470 = 2147483647; hist_get(a0); } else { a0->field_470 = 1; if (hist_get(a0) == 6) { v4 = 6; return v4; } a0->field_470 = a0->field_488 + 1 - a0->field_78; if (a0->field_470 < 0) { a0->field_470 = v2; v4 = 6; return v4; } } v1 = hist_get(a0); if (v1 == 6) a0->field_470 = v2; v4 = v1; return v4; }
libedit
angr_sailr
BZFILE *BZ2_bzReadOpen(int *bzerror, FILE *f, int verbosity, int small, void *unused, int nUnused) { bzFile *bzf = ((void *)0); int ret; { if (bzerror != ((void *)0)) *bzerror = 0; if (bzf != ((void *)0)) bzf->lastErr = 0; }; if (f == ((void *)0) || (small != 0 && small != 1) || (verbosity < 0 || verbosity > 4) || (unused == ((void *)0) && nUnused != 0) || (unused != ((void *)0) && (nUnused < 0 || nUnused > 5000))) { { if (bzerror != ((void *)0)) *bzerror = (-2); if (bzf != ((void *)0)) bzf->lastErr = (-2); }; return ((void *)0); }; if (ferror(f)) { { if (bzerror != ((void *)0)) *bzerror = (-6); if (bzf != ((void *)0)) bzf->lastErr = (-6); }; return ((void *)0); }; bzf = malloc(sizeof(bzFile)); if (bzf == ((void *)0)) { { if (bzerror != ((void *)0)) *bzerror = (-3); if (bzf != ((void *)0)) bzf->lastErr = (-3); }; return ((void *)0); }; { if (bzerror != ((void *)0)) *bzerror = 0; if (bzf != ((void *)0)) bzf->lastErr = 0; }; bzf->initialisedOk = ((Bool)0); bzf->handle = f; bzf->bufN = 0; bzf->writing = ((Bool)0); bzf->strm.bzalloc = ((void *)0); bzf->strm.bzfree = ((void *)0); bzf->strm.opaque = ((void *)0); while (nUnused > 0) { bzf->buf[bzf->bufN] = *((UChar *)(unused)); bzf->bufN++; unused = ((void *)(1 + ((UChar *)(unused)))); nUnused--; } ret = BZ2_bzDecompressInit(&(bzf->strm), verbosity, small); if (ret != 0) { { if (bzerror != ((void *)0)) *bzerror = ret; if (bzf != ((void *)0)) bzf->lastErr = ret; }; free(bzf); return ((void *)0); }; bzf->strm.avail_in = bzf->bufN; bzf->strm.next_in = bzf->buf; bzf->initialisedOk = ((Bool)1); return bzf; }
int BZ2_bzReadOpen(unsigned int *a0, void *a1, unsigned long a2, unsigned long a3, unsigned long a4, unsigned long a5) { unsigned int v0; char *v1; unsigned int v2; void *v3; unsigned int v5; v1 = a4; v0 = a5; v3 = 0; if (a0) *(a0) = 0; if (v3) *(&v3[5096]) = 0; if (!a1 || a2 < 0 && a1 && (a3 == 1 || !a3) || a1 && a3 != 1 && a3 || a1 && a2 > 4 && a2 >= 0 && (a3 == 1 || !a3) || v0 < 0 && a2 <= 4 && v1 && a1 && a2 >= 0 && (a3 == 1 || !a3) || !v1 && a2 <= 4 && a1 && v0 && a2 >= 0 && (a3 == 1 || !a3) || a2 <= 4 && v0 >= 0 && v1 && a1 && a2 >= 0 && v0 > 5000 && (a3 == 1 || !a3)) { if (a0) *(a0) = -2; if (v3) *(&v3[5096]) = -2; v5 = 0; } if (!v1 && a2 <= 4 && a1 && a2 >= 0 && (a3 == 1 || !a3) && (!v0 || v1) || a2 <= 4 && v0 <= 5000 && v0 >= 0 && v1 && a1 && a2 >= 0 && (a3 == 1 || !a3)) { v5 = ferror(a1); if (v5) { if (a0) *(a0) = -6; if (v3) *(&v3[5096]) = -6; v5 = 0; } else { v3 = malloc(0x13f0); if (!v3) { if (a0) *(a0) = -3; if (v3) *(&v3[5096]) = -3; v5 = 0; } else { if (a0) *(a0) = 0; if (v3) *(&v3[5096]) = 0; v3->field_13ec = 0; v3->field_0 = a1; v3->field_1390 = 0; v3->field_1394 = 0; v3->field_13d0 = 0; v3->field_13d8 = 0; for (v3->field_13e0 = 0; v0 > 0; v0 = v0 - 1) { v3->padding_8[v3->field_1390] = *(v1); v3->field_1390 = v3->field_1390 + 1; v1 += 1; } v2 = BZ2_bzDecompressInit(&v3->field_1398, a2, a3); if (v2) { if (a0) *(a0) = v2; if (v3) *(&v3[5096]) = v2; free(v3); v5 = 0; } else { v3->field_13a0 = v3->field_1390; v3->field_1398 = &v3->padding_8; v3->field_13ec = 1; v5 = v3; } } } } return v5; }
bzip2
angr_dream
c_delbefore1(EditLine *el) { wchar_t *cp; for (cp = el->el_line.cursor - 1; cp <= el->el_line.lastchar; cp++) *cp = cp[1]; el->el_line.lastchar--; }
long long c_delbefore1(unsigned long long a0[13]) { unsigned int v0[2]; for (*(&v0[0]) = a0[11] - 4; v0 <= a0[12]; *(&v0[0]) = &v0[1]) { v0[0] = v0[1]; } a0[12] = a0[12] - 4; return a0; }
libedit
angr_sailr
cron_db database(int installed, char **additional) { cron_db db = {((void *)0), ((void *)0), (time_t)0}; struct passwd pw; int fd; struct stat ss; user *u; if (installed) load_database(&db); for (; *additional != ((void *)0); additional++) { fd = open(*additional, 00); if (fd == -1) { perror(*additional); continue; } fstat(fd, &ss); if (((((ss.st_mode)) & 0170000) == (0040000))) { fprintf(stderr, "%s is a directory - skipping\n", *additional); close(fd); continue; } memset(&pw, 0, sizeof(pw)); pw.pw_name = *additional; pw.pw_passwd = ""; pw.pw_dir = "."; u = load_user(fd, &pw, *additional, *additional, *additional); if (u == ((void *)0)) { printf("cannot load crontab %s\n", *additional); continue; } link_user(&db, u); } return db; }
undefined8 *database(undefined8 *param_1, int param_2, char **param_3) { int __fd; long lVar1; long in_FS_OFFSET; char **local_120; undefined8 local_f8; undefined8 local_f0; undefined8 local_e8; char *local_d8; undefined *local_d0; undefined *local_b8; stat local_a8; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); local_f8 = 0; local_f0 = 0; local_e8 = 0; local_120 = param_3; if (param_2 != 0) { load_database(&local_f8); } for (; *local_120 != (char *)0x0; local_120 = local_120 + 1) { __fd = open(*local_120, 0); if (__fd == -1) { perror(*local_120); } else { fstat(__fd, &local_a8); if ((local_a8.st_mode & 0xf000) == 0x4000) { fprintf(stderr, "%s is a directory - skipping\n", *local_120); close(__fd); } else { memset(&local_d8, 0, 0x30); local_d8 = *local_120; local_d0 = &DAT_00101244; local_b8 = &DAT_0010127a; lVar1 = load_user(__fd, &local_d8, *local_120, *local_120, *local_120); if (lVar1 == 0) { printf("cannot load crontab %s\n", *local_120); } else { link_user(&local_f8, lVar1); } } } } *param_1 = local_f8; param_1[1] = local_f0; param_1[2] = local_e8; if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) { __stack_chk_fail(); } return param_1; }
cronie
ghidra
find_change(struct change *start) { return start; }
long long find_change(unsigned long a0) { return a0; }
diffutils
angr_phoenix
int globpath_is_dir(const char *pathname) { size_t l = strlen(pathname); return l > 0 && pathname[l - 1] == '/'; }
_BOOL8 globpath_is_dir(const char *a1) { size_t v2; v2 = strlen(a1); return v2 && a1[v2 - 1] == 47; }
openssh-portable
ida
ed_digit(EditLine *el, wint_t c) { if (!iswdigit(c)) return 6; if (el->el_state.doingarg) { if (el->el_state.lastcmd == 46) el->el_state.argument = c - '0'; else { if (el->el_state.argument > 1000000) return 6; el->el_state.argument = (el->el_state.argument * 10) + (c - '0'); } return 3; } return ed_insert(el, c); }
long ed_digit(long a1, wint_t a2) { if (!iswdigit(a2)) return 6LL; if (!*(_DWORD *)(a1 + 116)) return ed_insert(a1, a2); if (*(_BYTE *)(a1 + 128) == 46) { *(_DWORD *)(a1 + 120) = a2 - 48; } else { if (*(int *)(a1 + 120) > 1000000) return 6LL; *(_DWORD *)(a1 + 120) = 10 * *(_DWORD *)(a1 + 120) + a2 - 48; } return 3LL; }
libedit
ida
static char *scan_expression(char *c, int *result) { int value = 0, value2, j = 0, sign = 1, opex = 0; char oper = 'c'; if (*c == '!') { c = scan_expression(c + 1, &value); value = (!value); } else if (*c == 'n') { c++; value = 0; } else if (*c == 't') { c++; value = 1 - 0; } else if (*c == '\'' || *c == '"' || *c < ' ' || (*c == '\\' && c[1] == '(')) { char *st1 = ((void *)0), *st2 = ((void *)0), *h; char *tcmp = ((void *)0); char sep; sep = *c; if (sep == '\\') { tcmp = c; c = c + 3; } c++; h = c; while (*c != sep && (!tcmp || strncmp(c, tcmp, 4))) c++; *c = '\n'; scan_troff(h, 1, &st1); *c = sep; if (tcmp) c = c + 3; c++; h = c; while (*c != sep && (!tcmp || strncmp(c, tcmp, 4))) c++; *c = '\n'; scan_troff(h, 1, &st2); *c = sep; if (!st1 && !st2) value = 1; else if (!st1 || !st2) value = 0; else value = (!strcmp(st1, st2)); if (st1) free(st1); if (st2) free(st2); if (tcmp) c = c + 3; c++; } else { while (*c && !((*__ctype_b_loc())[(int)((*c))] & (unsigned short int)_ISspace) && *c != ')') { opex = 0; switch (*c) { case '(': c = scan_expression(c + 1, &value2); value2 = sign * value2; opex = 1; break; case '.': case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': { int num = 0, denum = 1; value2 = 0; while (((*__ctype_b_loc())[(int)((*c))] & (unsigned short int)_ISdigit)) value2 = value2 * 10 + ((*c++) - '0'); if (*c == '.') { c++; while (((*__ctype_b_loc())[(int)((*c))] & (unsigned short int)_ISdigit)) { num = num * 10 + ((*c++) - '0'); denum = denum * 10; } } if (((*__ctype_b_loc())[(int)((*c))] & (unsigned short int)_ISalpha)) { switch (*c) { case 'i': value2 = value2 * 10 + (num * 10 + denum / 2) / denum; num = 0; break; default: break; } c++; } value2 = value2 + (num + denum / 2) / denum; value2 = sign * value2; opex = 1; break; } case '\\': c = scan_escape(c + 1); value2 = intresult * sign; if (((*__ctype_b_loc())[(int)((*c))] & (unsigned short int)_ISalpha)) c++; opex = 1; break; case '-': if (oper) { sign = -1; c++; break; } case '>': case '<': case '+': case '/': case '*': case '%': case '&': case '=': case ':': if (c[1] == '=') oper = (*c++) + 16; else oper = *c; c++; break; default: c++; break; } if (opex) { sign = 1; switch (oper) { case 'c': value = value2; break; case '-': value = value - value2; break; case '+': value = value + value2; break; case '*': value = value * value2; break; case '/': if (value2) value = value / value2; break; case '%': if (value2) value = value % value2; break; case '<': value = (value < value2); break; case '>': value = (value > value2); break; case '>' + 16: value = (value >= value2); break; case '<' + 16: value = (value <= value2); break; case '=': case '=' + 16: value = (value == value2); break; case '&': value = (value && value2); break; case ':': value = (value || value2); break; default: fprintf(stderr, "man2html: unknown operator %c.\n", oper); } oper = 0; } } if (*c == ')') c++; } *result = value; return c; }
char *scan_expression(char *a1, _DWORD *a2) { char *v2; char *v3; char *v4; _BOOL4 v5; _BOOL4 v6; char *s1; char *s1a; char *s1b; char v11; char v12; int v13; int v14; int v15; int v16; int v17; int v18; char *v19; char *v20; char *s2; char *v22; unsigned long v23; s1 = a1; v23 = __readfsqword(0x28u); v13 = 0; v18 = 0; v14 = 1; v15 = 0; v11 = 99; switch (*a1) { case '!': s1 = scan_expression(a1 + 1, &v13); v13 = v13 == 0; break; case 'n': s1 = a1 + 1; v13 = 0; break; case 't': s1 = a1 + 1; v13 = 1; break; default: if (*a1 == 39 || *a1 == 34 || *a1 <= 31 || *a1 == 92 && a1[1] == 40) { v19 = 0LL; v20 = 0LL; s2 = 0LL; v12 = *a1; if (*a1 == 92) { s2 = a1; s1 = a1 + 3; } s1a = s1 + 1; v22 = s1a; while (v12 != *s1a && (!s2 || strncmp(s1a, s2, 4uLL))) ++s1a; *s1a = 10; scan_troff(v22, 1, &v19); *s1a = v12; if (s2) s1a += 3; s1b = s1a + 1; v22 = s1b; while (v12 != *s1b && (!s2 || strncmp(s1b, s2, 4uLL))) ++s1b; *s1b = 10; scan_troff(v22, 1, &v20); *s1b = v12; if (v19 || v20) v13 = v19 && v20 && strcmp(v19, v20) == 0; else v13 = 1; if (v19) free(v19); if (v20) free(v20); if (s2) s1b += 3; s1 = s1b + 1; } else { while (*s1 && ((*_ctype_b_loc())[*s1] & 0x2000) == 0 && *s1 != 41) { v15 = 0; switch (*s1) { case '%': case '&': case '*': case '+': case '/': case ':': case '<': case '=': case '>': goto LABEL_59; case '(': s1 = scan_expression(s1 + 1, &v20); LODWORD(v20) = v14 * (_DWORD)v20; v15 = 1; break; case '-': if (v11) { v14 = -1; ++s1; } else { LABEL_59: if (s1[1] == 61) { v4 = s1++; v11 = *v4 + 16; } else { v11 = *s1; } ++s1; } break; case '.': case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': v16 = 0; v17 = 1; LODWORD(v20) = 0; while (((*_ctype_b_loc())[*s1] & 0x800) != 0) { v2 = s1++; LODWORD(v20) = 10 * (_DWORD)v20 + *v2 - 48; } if (*s1 == 46) { ++s1; while (((*_ctype_b_loc())[*s1] & 0x800) != 0) { v3 = s1++; v16 = 10 * v16 + *v3 - 48; v17 *= 10; } } if (((*_ctype_b_loc())[*s1] & 0x400) != 0) { if (*s1 == 105) { LODWORD(v20) = 10 * (_DWORD)v20 + (10 * v16 + v17 / 2) / v17; v16 = 0; } ++s1; } LODWORD(v20) = (v17 / 2 + v16) / v17 + (_DWORD)v20; LODWORD(v20) = v14 * (_DWORD)v20; v15 = 1; break; case '\\': s1 = scan_escape(s1 + 1); LODWORD(v20) = v14 * intresult; if (((*_ctype_b_loc())[*s1] & 0x400) != 0) ++s1; v15 = 1; break; default: ++s1; break; } if (v15) { v14 = 1; switch (v11) { case '%': if ((_DWORD)v20) v13 %= (int)v20; break; case '&': v5 = v13 && (_DWORD)v20; v13 = v5; break; case '*': v13 *= (_DWORD)v20; break; case '+': v13 += (int)v20; break; case '-': v13 -= (int)v20; break; case '/': if ((_DWORD)v20) v13 /= (int)v20; break; case ':': v6 = v13 || (_DWORD)v20; v13 = v6; break; case '<': v13 = v13 < (int)v20; break; case '=': case 'M': v13 = v13 == (_DWORD)v20; break; case '>': v13 = v13 > (int)v20; break; case 'L': v13 = v13 <= (int)v20; break; case 'N': v13 = v13 >= (int)v20; break; case 'c': v13 = (int)v20; break; default: fprintf(stderr, "man2html: unknown operator %c.\n", (unsigned int)v11); break; } v11 = 0; } } if (*s1 == 41) ++s1; } break; } *a2 = v13; return s1; }
bash
ida
u_int32_t get_u32(const void *vp) { const u_char *p = (const u_char *)vp; u_int32_t v; v = (u_int32_t)p[0] << 24; v |= (u_int32_t)p[1] << 16; v |= (u_int32_t)p[2] << 8; v |= (u_int32_t)p[3]; return (v); }
long long get_u32(char a0[4]) { unsigned int v0; v0 = a0[0] * 0x1000000; v0 |= (a0[1] * 0x10000); v0 |= (a0[2] * 0x100); v0 |= a0[3]; return v0; }
openssh-portable
angr_dream
static void _rs_stir(void) { unsigned char rnd[32 + 8]; uint32_t rekey_fuzz = 0; if (getentropy(rnd, sizeof rnd) == -1) _getentropy_fail(); if (!rs) _rs_init(rnd, sizeof(rnd)); else _rs_rekey(rnd, sizeof(rnd)); explicit_bzero(rnd, sizeof(rnd)); rs->rs_have = 0; memset(rsx->rs_buf, 0, sizeof(rsx->rs_buf)); chacha_encrypt_bytes(&rsx->rs_chacha, (uint8_t *)&rekey_fuzz, (uint8_t *)&rekey_fuzz, sizeof(rekey_fuzz)); rs->rs_count = (1024 * 1024) + (rekey_fuzz % (1024 * 1024)); }
void _rs_stir() { unsigned int v0; char v1; char v2; unsigned long long *v4; unsigned long long v5; v0 = 0; if (getentropy(&v1, 0x28) == -1) _getentropy_fail(); if (rs) _rs_rekey(&v1, 0x28); else _rs_init(&v1, 0x28); explicit_bzero(&v1, 0x28); *(rs) = 0; memset(rsx + 64, 0x0, 0x400); chacha_encrypt_bytes(rsx, &v0, &v0, 0x4); *((rs + 8)) = (v0 & 1048575) + 0x100000; v5 = *(&v2) ^ v4[5]; return; }
libbsd-0.11.7
angr_sailr
ext2_ino_t e2fsck_get_num_dx_dirinfo(e2fsck_t ctx) { return ctx->dx_dir_info_count; }
undefined4 e2fsck_get_num_dx_dirinfo(long param_1) { return *(undefined4 *)(param_1 + 0x238); }
e2fsprogs-1.46.5
ghidra
static void select(unsigned int p[64], unsigned int q[64], const unsigned int r[64], const unsigned int s[64], unsigned int b) { unsigned int j; unsigned int t; unsigned int bminus1; bminus1 = b - 1; for (j = 0; j < 64; ++j) { t = bminus1 & (r[j] ^ s[j]); p[j] = s[j] ^ t; q[j] = r[j] ^ t; } }
void select(unsigned int *a0, unsigned int *a1, unsigned int *a2, unsigned int *a3, unsigned long a4) { unsigned int v0; unsigned int v1; unsigned int v2; unsigned long long v4; unsigned long long v5; v4 = a4 - 1; v1 = a4 - 1; for (v0 = 0; v0 <= 63; v0 += 1) { v2 = (a3[v0] ^ a2[v0]) & v1; a0[v0] = a3[v0] ^ v2; v5 = a2[v0] ^ v2; a1[v0] = a2[v0] ^ v2; } return; }
openssh-portable
angr_dream
static _Bool excluded_fstype(char const *fstype) { const struct fs_type_list *fsp; if (fs_exclude_list == ((void *)0) || fstype == ((void *)0)) return 0; for (fsp = fs_exclude_list; fsp; fsp = fsp->fs_next) if ((strcmp(fstype, fsp->fs_name) == 0)) return 1; return 0; }
undefined8 excluded_fstype(char *param_1) { int iVar1; char **local_10; if ((fs_exclude_list != (char **)0x0) && (param_1 != (char *)0x0)) { for (local_10 = fs_exclude_list; local_10 != (char **)0x0; local_10 = (char **)local_10[1]) { iVar1 = strcmp(param_1, *local_10); if (iVar1 == 0) { return 1; } } } return 0; }
coreutils
ghidra
int auth2_key_already_used(Authctxt *authctxt, const struct sshkey *key) { u_int i; char *fp; for (i = 0; i < authctxt->nprev_keys; i++) { if (sshkey_equal_public(key, authctxt->prev_keys[i])) { fp = sshkey_fingerprint(authctxt->prev_keys[i], options.fingerprint_hash, SSH_FP_DEFAULT); sshlog("auth2.c", __func__, 795, 1, SYSLOG_LEVEL_DEBUG3, ((void *)0), "key already used: %s %s", sshkey_type(authctxt->prev_keys[i]), fp == ((void *)0) ? "UNKNOWN" : fp) ; free(fp); return 1; } } return 0; }
long long auth2_key_already_used(struct_0 *a0, unsigned long long a1) { unsigned long v0; unsigned long long v1; unsigned int v2; void *v3; unsigned long long v5; unsigned long long v6; v2 = 0; while (true) { if (v2 >= a0->field_70) { v5 = 0; break; } else if (!sshkey_equal_public(a1, *((a0->field_68 + (v2 << 3))), *((a0->field_68 + (v2 << 3))))) { v2 += 1; } else { v3 = sshkey_fingerprint(*((a0->field_68 + v2 * 8)), *(5250728), 0x0, *(5250728)); if (v3) v6 = v3; else v6 = "UNKNOWN"; v1 = v6; v0 = sshkey_type(*((a0->field_68 + v2 * 8))); sshlog("auth2.c", "auth2_key_already_used", 0x31b, 0x1, 0x7, 0x0, "key already used: %s %s"); free(v3); v5 = 1; break; } } return v5; }
openssh-portable
angr_phoenix
static inline void emit_ancillary_info(char const *program) { struct infomap { char const *program; char const *node; } const infomap[] = { {"[", "test invocation"}, {"coreutils", "Multi-call invocation"}, {"sha224sum", "sha2 utilities"}, {"sha256sum", "sha2 utilities"}, {"sha384sum", "sha2 utilities"}, {"sha512sum", "sha2 utilities"}, {((void *)0), ((void *)0)}}; char const *node = program; struct infomap const *map_prog = infomap; while (map_prog->program && !(strcmp(program, map_prog->program) == 0)) map_prog++; if (map_prog->node) node = map_prog->node; printf (gettext ("\n%s online help: <%s>\n"), "GNU coreutils", "https: char const *lc_messages = setlocale ( 5 , ((void *)0) ); if (lc_messages && strncmp (lc_messages, "" "en_" "", sizeof ("en_") - 1)) { fputs_unlocked (gettext ("Report any translation bugs to " "<https: stdout ) ; } char const *url_program = (strcmp (program, "[") == 0) ? "test" : program; printf (gettext ("Full documentation <%s%s>\n"), "https: printf (gettext ("or available locally via: info '(coreutils) %s%s'\n"), node, node == program ? " invocation" : ""); }
void emit_ancillary_info(char *a0) { unsigned long long v0; unsigned long long v1[2]; char *v2; unsigned long long v3; unsigned long long v4; unsigned long long v5; unsigned long long v6; unsigned long long v7; unsigned long long v8; unsigned long long v9; unsigned long long v10; unsigned long long v11; unsigned long long v12; unsigned long long v13; unsigned long long v14; unsigned long long v15; void *v16; void *v17; char v18; unsigned long long v20; unsigned long long *v21; unsigned long long v22; v4 = "["; v5 = "test invocation"; v6 = "coreutils"; v7 = "Multi-call invocation"; v8 = "sha224sum"; v9 = "sha2 utilities"; v10 = "sha256sum"; v11 = "sha2 utilities"; v12 = "sha384sum"; v13 = "sha2 utilities"; v14 = "sha512sum"; v15 = "sha2 utilities"; v16 = 0; v17 = 0; v0 = a0; v1[0] = &v4; while (true) { if (!v1[0]) break; if (!strcmp(a0, v1[0])) break; v1[0] = v1 + 1; } if (v1[1]) v0 = v1[1]; printf(gettext("\n%s online help: <%s>\n")); v2 = setlocale(0x5, NULL); if (v2 && strncmp(v2, "en_", 0x3)) fputs_unlocked(gettext("Report any translation bugs to <https: if (!strcmp(a0, "[")) v20 = "test"; else v20 = a0; v3 = v20; printf(gettext("Full documentation <%s%s>\n")); printf(gettext("or available locally via: info '(coreutils) %s%s'\n")); v22 = *(&v18) ^ v21[5]; return; }
coreutils
angr_phoenix
int el_source(EditLine *el, const char *fname) { FILE *fp; size_t len; ssize_t slen; char *ptr; char *path = ((void *)0); const wchar_t *dptr; int error = 0; fp = ((void *)0); if (fname == ((void *)0)) { if ((fname = secure_getenv("EDITRC")) == ((void *)0)) { static const char elpath[] = "/.editrc"; size_t plen = sizeof(elpath); if ((ptr = secure_getenv("HOME")) == ((void *)0)) return -1; plen += strlen(ptr); if ((path = calloc(plen, sizeof(*path))) == ((void *)0)) return -1; (void)snprintf(path, plen, "%s%s", ptr, elpath + (*ptr == '\0')); fname = path; } } if (fname[0] == '\0') return -1; if (fp == ((void *)0)) fp = fopen(fname, "r"); if (fp == ((void *)0)) { free(path); return -1; } ptr = ((void *)0); len = 0; while ((slen = getline(&ptr, &len, fp)) != -1) { if (*ptr == '\n') continue; if (slen > 0 && ptr[--slen] == '\n') ptr[slen] = '\0'; dptr = ct_decode_string(ptr, &el->el_scratch); if (!dptr) continue; while (*dptr != '\0' && iswspace(*dptr)) dptr++; if (*dptr == '#') continue; if ((error = parse_line(el, dptr)) == -1) break; } free(ptr); free(path); (void)fclose(fp); return error; }
int el_source(long param_1, char *param_2) { int iVar1; size_t sVar2; char *pcVar3; long in_FS_OFFSET; char *local_68; int local_4c; size_t local_48; char *local_40; FILE *local_38; char *local_30; wint_t *local_28; size_t local_20; long local_18; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); local_30 = (char *)0x0; local_4c = 0; local_38 = (FILE *)0x0; local_68 = param_2; if ((param_2 == (char *)0x0) && (local_68 = (char *)secure_getenv("EDITRC"), local_68 == (char *)0x0)) { local_20 = 9; local_40 = (char *)secure_getenv(&DAT_00101ef7); if (local_40 == (char *)0x0) { local_4c = -1; goto LAB_00101b96; } sVar2 = strlen(local_40); local_20 = local_20 + sVar2; local_30 = (char *)calloc(local_20, 1); if (local_30 == (char *)0x0) { local_4c = -1; goto LAB_00101b96; } if (*local_40 == '\0') { pcVar3 = ".editrc"; } else { pcVar3 = "/.editrc"; } snprintf(local_30, local_20, "%s%s", local_40, pcVar3); local_68 = local_30; } if (*local_68 == '\0') { local_4c = -1; } else { if (local_38 == (FILE *)0x0) { local_38 = fopen(local_68, "r"); } if (local_38 == (FILE *)0x0) { free(local_30); local_4c = -1; } else { local_40 = (char *)0x0; local_48 = 0; do { do { do { local_18 = getline(&local_40, &local_48, local_38); if (local_18 == -1) goto LAB_00101b6f; } while (*local_40 == '\n'); if ((0 < local_18) && (local_18 = local_18 + -1, local_40[local_18] == '\n')) { local_40[local_18] = '\0'; } local_28 = (wint_t *)ct_decode_string(local_40, param_1 + 0x4e8); } while (local_28 == (wint_t *)0x0); while ((*local_28 != 0 && (iVar1 = iswspace(*local_28), iVar1 != 0))) { local_28 = local_28 + 1; } } while ((*local_28 == 0x23) || (local_4c = parse_line(param_1, local_28), local_4c != -1)); LAB_00101b6f: free(local_40); free(local_30); fclose(local_38); } } LAB_00101b96: if (local_10 == *(long *)(in_FS_OFFSET + 0x28)) { return local_4c; } __stack_chk_fail(); }
libedit
ghidra
static int node_lookup(EditLine *el, const wchar_t *str, keymacro_node_t *ptr, size_t cnt) { ssize_t used; if (ptr == ((void *)0)) return -1; if (!str || *str == 0) { (void)node_enum(el, ptr, cnt); return 0; } else { if (ptr->ch == *str) { used = ct_visual_char(el->el_keymacro.buf + cnt, ((size_t)1024) - cnt, ptr->ch); if (used == -1) return -1; if (ptr->next != ((void *)0)) return (node_lookup(el, str + 1, ptr->next, (size_t)used + cnt)); else { if (str[1] == 0) { size_t px = cnt + (size_t)used; el->el_keymacro.buf[px] = '"'; el->el_keymacro.buf[px + 1] = '\0'; keymacro_kprint(el, el->el_keymacro.buf, &ptr->val, ptr->type); return 0; } else return -1; } } else { if (ptr->sibling) return (node_lookup(el, str, ptr->sibling, cnt)); else return -1; } } }
int node_lookup(unsigned long long a0, unsigned int a1[2], struct_0 *a2, unsigned long long a3) { unsigned long v0; unsigned int *v1; unsigned int v3; if (!a2) { v3 = -1; } else { if (a1 && a1[0]) { if (a2->field_0 == a1[0]) { v0 = ct_visual_char(*((a0 + 1088)) + a3 * 4, 0x400 - a3, a2->field_0, *((a0 + 1088)) + a3 * 4); if (v0 == -1) { v3 = -1; } else { if (a2->field_10) { v3 = node_lookup(a0, &a1[1], a2->field_10, v0 + a3); } else { if (!a1[1]) { v1 = a3 + v0; *((*((a0 + 1088)) + v1 * 4)) = 34; *((*((a0 + 1088)) + (v1 + 1) * 4)) = 0; keymacro_kprint(a0, *((a0 + 1088)), &a2->padding_8, a2->field_4); v3 = 0; } else { v3 = -1; } } } } else if (a2->field_18) { v3 = node_lookup(a0, a1, a2->field_18, a3); } else { v3 = -1; } } if (!a1[0] || !a1) { node_enum(a0, a2, a3); v3 = 0; } } return v3; }
libedit
angr_dream
" TTL := 0..255 (default=%d)\n" " TCLASS := { 0x0..0xff | inherit }\n"
" TTL := 0..255 (default=%d)\n" " TCLASS := { 0x0..0xff | inherit }\n"
iproute2-6.0.0
ida
int shtimer_chktimeout(sh_timer *t) { struct timeval now; int r; if (t->flags & 0x01) return t->alrmflag; if (t->tmout.tv_sec == 0 && t->tmout.tv_usec == 0) return 0; if (gettimeofday(&now, 0) < 0) return 0; r = ((now.tv_sec > t->tmout.tv_sec) || (now.tv_sec == t->tmout.tv_sec && now.tv_usec >= t->tmout.tv_usec)); return r; }
long long shtimer_chktimeout(struct_0 *a0) { unsigned int v0; char v1; char v2; void *v4; unsigned int v5; if ((a0->field_14 & 1)) { v4 = a0->field_18; } else { if (!a0->field_0 && !a0->field_8) v4 = 0; if (a0->field_0 || a0->field_8) { v5 = gettimeofday(&v1, NULL); if (v5 < 0) { v4 = 0; } else { if (*(&v1) <= a0->field_0 && (*(&v2) < a0->field_8 || *(&v1) != a0->field_0)) v5 = 0; if (*(&v1) > a0->field_0 || *(&v1) == a0->field_0 && *(&v2) >= a0->field_8) v5 = 1; v0 = v5; v4 = v0; } } } return v4; }
bash
angr_dream
int strsvisx(char *mbdst, const char *mbsrc, size_t len, int flags, const char *mbextra) { return istrsenvisx(&mbdst, ((void *)0), mbsrc, len, flags, mbextra, ((void *)0)); }
long strsvisx(char *a1, const char *a2, unsigned long a3, int a4, char *a5) { char *v6; v6 = a1; return istrsenvisx(&v6, 0LL, a2, a3, a4, a5, 0LL); }
libedit
ida
static void locale_setblanks() { int x; for (x = 0; x < sh_syntabsiz; x++) { if (((*__ctype_b_loc())[(int)(((unsigned char)x))] & (unsigned short int)_ISblank)) sh_syntaxtab[x] |= 0x0002 | 0x2000; else if (((x) ? ((char *)mbschr(("()<>;&| \t\n"), (x)) != (char *)((void *)0)) : 0)) { sh_syntaxtab[x] |= 0x0002; sh_syntaxtab[x] &= ~0x2000; } else sh_syntaxtab[x] &= ~(0x0002 | 0x2000); } }
long locale_setblanks() { int v0; long result; int i; for (i = 0;; ++i) { result = sh_syntabsiz; if (i >= sh_syntabsiz) break; if (((*_ctype_b_loc())[(unsigned char)i] & 1) != 0) { sh_syntaxtab[i] |= 0x2002u; } else if (i && mbschr("()<>;&| \t\n", (unsigned int)i)) { sh_syntaxtab[i] |= 2u; v0 = sh_syntaxtab[i]; BYTE1(v0) &= ~0x20u; sh_syntaxtab[i] = v0; } else { sh_syntaxtab[i] &= 0xFFFFDFFD; } } return result; }
bash
ida
static void really_add_history(line) char *line; { hist_last_line_added = 1; hist_last_line_pushed = 0; add_history(line); history_lines_this_session++; }
void really_add_history(undefined8 param_1) { hist_last_line_added = 1; hist_last_line_pushed = 0; add_history(param_1); history_lines_this_session = history_lines_this_session + 1; return; }
bash
ghidra
static void sparse_minor_decoder(struct tar_stat_info *st, char const *keyword, char const *arg, size_t size) { uintmax_t u; if (decode_num( &u, arg, ((unsigned)(!(!((unsigned)0 < (unsigned)-1)) ? (unsigned)-1 : ((((unsigned)1 << ((sizeof(unsigned) * 8) - 2)) - 1) * 2 + 1))), keyword)) st->sparse_minor = u; }
unsigned long sparse_minor_decoder(long a1, long a2, long a3) { long v4; unsigned long v5; v5 = __readfsqword(0x28u); if ((unsigned char)decode_num(&v4, a3, 0xFFFFFFFFLL, a2)) *(_DWORD *)(a1 + 296) = v4; return __readfsqword(0x28u) ^ v5; }
tar
ida
void dpkg_selabel_close(void) { if (sehandle == ((void *)0)) return; selinux_status_close(); selabel_close(sehandle); sehandle = ((void *)0); }
long long dpkg_selabel_close() { unsigned long long v1; v1 = sehandle; if (sehandle) { selinux_status_close(); v1 = selabel_close(sehandle); sehandle = 0; return v1; } return v1; }
dpkg
angr_sailr
void usage(int status) { if (status != 0) do { fprintf(stderr, gettext("Try '%s --help' for more information.\n"), program_name); } while (0); else { printf(gettext("Usage: %s FILE\n or: %s OPTION\n") , program_name, program_name); fputs_unlocked( gettext("Call the unlink function to remove the specified FILE.\n\n"), stdout); fputs_unlocked(gettext(" --help display this help and exit\n"), stdout); fputs_unlocked( gettext(" --version output version information and exit\n"), stdout); emit_ancillary_info("unlink"); } exit(status); }
void usage(int param_1) { FILE *pFVar1; undefined8 uVar2; char *pcVar3; uVar2 = program_name; if (param_1 == 0) { pcVar3 = (char *)gettext("Usage: %s FILE\n or: %s OPTION\n"); printf(pcVar3, uVar2, uVar2); pFVar1 = stdout; pcVar3 = (char *)gettext( "Call the unlink function to remove the specified FILE.\n\n"); fputs_unlocked(pcVar3, pFVar1); pFVar1 = stdout; pcVar3 = (char *)gettext(" --help display this help and exit\n"); fputs_unlocked(pcVar3, pFVar1); pFVar1 = stdout; pcVar3 = (char *)gettext( " --version output version information and exit\n"); fputs_unlocked(pcVar3, pFVar1); emit_ancillary_info(); } else { pcVar3 = (char *)gettext("Try \'%s --help\' for more information.\n"); fprintf(stderr, pcVar3, uVar2); } exit(param_1); }
coreutils
ghidra
static void parser_ungetc(struct parser_st *parser, int c) { ((void)sizeof((parser->pushback_length < (sizeof(parser->pushback) / sizeof((parser->pushback)[0]))) ? 1 : 0), __extension__({ if (parser->pushback_length < (sizeof(parser->pushback) / sizeof((parser->pushback)[0]))) ; else __assert_fail("parser->pushback_length < SIZEOF(parser->pushback)", "cfg.c", 119, __extension__ __PRETTY_FUNCTION__); })); parser->pushback[parser->pushback_length++] = c; }
void parser_ungetc(long param_1, undefined param_2) { long lVar1; if (1 < *(ulong *)(param_1 + 0x10)) { __assert_fail("parser->pushback_length < SIZEOF(parser->pushback)", "cfg.c", 0x77, "parser_ungetc"); } lVar1 = *(long *)(param_1 + 0x10); *(long *)(param_1 + 0x10) = lVar1 + 1; *(undefined *)(param_1 + 8 + lVar1) = param_2; return; }
gnutls
ghidra
inline void ext2fs_mark_ib_dirty(ext2_filsys fs) { fs->flags |= 0x10 | 0x02; }
void ext2fs_mark_ib_dirty(void) { halt_baddata(); }
e2fsprogs-1.46.5
ghidra
int rl_transpose_words(int count, int key) { char *word1, *word2; int w1_beg, w1_end, w2_beg, w2_end; int orig_point, orig_end; orig_point = rl_point; orig_end = rl_end; if (!count) return 0; rl_forward_word(count, key); w2_end = rl_point; rl_backward_word(1, key); w2_beg = rl_point; rl_backward_word(count, key); w1_beg = rl_point; rl_forward_word(1, key); w1_end = rl_point; if ((w1_beg == w2_beg) || (w2_beg < w1_end)) { rl_ding(); rl_point = orig_point; return 1; } word1 = rl_copy_text(w1_beg, w1_end); word2 = rl_copy_text(w2_beg, w2_end); rl_begin_undo_group(); rl_point = w2_beg; rl_delete_text(w2_beg, w2_end); rl_insert_text(word1); rl_point = w1_beg; rl_delete_text(w1_beg, w1_end); rl_insert_text(word2); rl_point = w2_end; rl_end = orig_end; rl_end_undo_group(); xfree(word1); xfree(word2); return 0; }
long long rl_transpose_words(unsigned long a0, unsigned long a1) { unsigned int v0; unsigned int v1; unsigned int v2; unsigned int v3; unsigned int v4; unsigned int v5; char *v6; char *v7; unsigned long long v9; v0 = rl_point; v1 = rl_end; if (!a0) { v9 = 0; return v9; } rl_forward_word(a0, a1); v2 = rl_point; rl_backward_word(0x1, a1); v3 = rl_point; rl_backward_word(a0, a1); v4 = rl_point; rl_forward_word(0x1, a1); v5 = rl_point; if (v4 != v3 && v3 >= v5) { v6 = rl_copy_text(v4, v5, v5); v7 = rl_copy_text(v3, v2, v2); rl_begin_undo_group(); rl_point = v3; rl_delete_text(v3, v2); rl_insert_text(v6); rl_point = v4; rl_delete_text(v4, v5); rl_insert_text(v7); rl_point = v2; rl_end = v1; rl_end_undo_group(); xfree(v6); xfree(v7); v9 = 0; return v9; } rl_ding(); rl_point = v0; v9 = 1; return v9; }
bash
angr_sailr
static inline void inet_prefix_reset(inet_prefix *p) { p->flags = 0; }
_WORD *inet_prefix_reset(_WORD *a1) { _WORD *result; result = a1; *a1 = 0; return result; }
iproute2-6.0.0
ida
static void handle_line_error(const struct control *p, intmax_t repetition) { char buf[((((((sizeof(intmax_t) * 8) - (!((__typeof__(intmax_t))0 < (__typeof__(intmax_t))-1))) * 146 + 484) / 485) + (!((__typeof__(intmax_t))0 < (__typeof__(intmax_t))-1))) + 1)]; fprintf(stderr, gettext("%s: %s: line number out of range"), program_name, quote(imaxtostr(p->lines_required, buf))); if (repetition) fprintf(stderr, gettext(" on repetition %s\n"), imaxtostr(repetition, buf)); else fprintf(stderr, "\n"); cleanup_fatal(); }
void handle_line_error(long param_1, long param_2) { undefined8 uVar1; undefined8 uVar2; char *pcVar3; long in_FS_OFFSET; undefined local_38[24]; undefined8 local_20; local_20 = *(undefined8 *)(in_FS_OFFSET + 0x28); uVar1 = imaxtostr(*(undefined8 *)(param_1 + 8), local_38); uVar2 = quote(uVar1); uVar1 = program_name; pcVar3 = (char *)gettext("%s: %s: line number out of range"); fprintf(stderr, pcVar3, uVar1, uVar2); if (param_2 == 0) { fprintf(stderr, "\n"); } else { uVar1 = imaxtostr(param_2, local_38); pcVar3 = (char *)gettext(" on repetition %s\n"); fprintf(stderr, pcVar3, uVar1); } cleanup_fatal(); }
coreutils
ghidra
void sshsk_free_resident_keys(struct sshsk_resident_key **srks, size_t nsrks) { size_t i; if (srks == ((void *)0) || nsrks == 0) return; for (i = 0; i < nsrks; i++) sshsk_free_resident_key(srks[i]); free(srks); }
void sshsk_free_resident_keys(_QWORD **a1, unsigned long a2) { unsigned long i; if (a1 && a2) { for (i = 0LL; i < a2; ++i) sshsk_free_resident_key(a1[i]); free(a1); } }
openssh-portable
ida
int seed_from_prngd(unsigned char *buf, size_t bytes) { return -1; }
long long seed_from_prngd(unsigned long a0, unsigned long a1) { unsigned long v0; unsigned long v1; v1 = a0; v0 = a1; return 4294967295; }
openssh-portable
angr_dream
static int vi_delete_dispatch(_rl_vimotion_cxt *m) { if (((strchr(" l|h^0bBFT`", m->motion) == 0) && (rl_point >= m->start)) && (rl_mark < rl_end)) do { if ((__ctype_get_mb_cur_max()) == 1 || rl_byte_oriented) rl_mark++; else rl_mark = _rl_find_next_mbchar(rl_line_buffer, rl_mark, 1, 0x00); } while (0); rl_kill_text(rl_point, rl_mark); return (0); }
int vi_delete_dispatch(unsigned int a0[9]) { if (!strchr(" l|h^0bBFT`", a0[8]) && a0[5] <= rl_point && rl_mark < rl_end) { if (__ctype_get_mb_cur_max() == 1) { LABEL_402884: rl_mark = rl_mark + 1; } else { if (!(!rl_byte_oriented)) goto LABEL_402884; rl_mark = _rl_find_next_mbchar(rl_line_buffer, rl_mark, 0x1, 0x0); } } rl_kill_text(rl_point, rl_mark, rl_mark); return 0; }
bash
angr_phoenix
char *sys_get_rdomain(int fd) { char dev[16 + 1]; socklen_t len = sizeof(dev) - 1; if (getsockopt(fd, 1, 25, dev, &len) == -1) { sshlog("port-net.c", __func__, 57, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "%s: cannot determine VRF for fd=%d : %s", __func__, fd, strerror((*__errno_location()))); return ((void *)0); } dev[len] = '\0'; return strdup(dev); }
char *sys_get_rdomain(int a1) { int *v1; char *v2; socklen_t optlen; char optval[24]; unsigned long v6; v6 = __readfsqword(0x28u); optlen = 16; if (getsockopt(a1, 1, 25, optval, &optlen) == -1) { v1 = _errno_location(); v2 = strerror(*v1); sshlog("port-net.c", "sys_get_rdomain", 57LL, 0LL, 2LL, 0LL, "%s: cannot determine VRF for fd=%d : %s", "sys_get_rdomain", (unsigned int)a1, v2); return 0LL; } else { optval[optlen] = 0; return strdup(optval); } }
openssh-portable
ida
int wextglob_pattern_p(pat) const wchar_t *pat; { switch (pat[0]) { case L'*': case L'+': case L'!': case L'@': case L'?': return (pat[1] == L'('); default: return 0; } return 0; }
long long wextglob_pattern_p(unsigned int a0[2]) { void *v1; if (31 < a0[0] - 33) { v1 = 0; return v1; } else if (!((1 << ((a0[0] - 33) & 63)) & 3221227009)) { v1 = 0; return v1; } else { v1 = a0[1] == 40; return v1; } }
bash
angr_sailr
static int pkg_array_match_patterns(struct pkg_array *array, pkg_array_visitor_func *pkg_visitor, void *pkg_data, const char *const *argv) { int argc, i, ip, *found; int rc = 0; struct pkg_spec *ps; for (argc = 0; argv[argc]; argc++) ; found = m_calloc(argc, sizeof(int)); ps = m_malloc(sizeof(*ps) * argc); for (ip = 0; ip < argc; ip++) { pkg_spec_init(&ps[ip], PKG_SPEC_PATTERNS | PKG_SPEC_ARCH_WILDCARD); pkg_spec_parse(&ps[ip], argv[ip]); } for (i = 0; i < array->n_pkgs; i++) { struct pkginfo *pkg; _Bool pkg_found = 0; pkg = array->pkgs[i]; for (ip = 0; ip < argc; ip++) { if (pkg_spec_match_pkg(&ps[ip], pkg, &pkg->installed)) { pkg_found = 1; found[ip]++; } } if (!pkg_found) array->pkgs[i] = ((void *)0); } pkg_array_foreach(array, pkg_visitor, pkg_data); for (ip = 0; ip < argc; ip++) { if (!found[ip]) { notice(gettext("no packages found matching %s"), argv[ip]); rc++; } pkg_spec_destroy(&ps[ip]); } free(ps); free(found); return rc; }
int pkg_array_match_patterns(int *param_1, undefined8 param_2, undefined8 param_3, long param_4) { long lVar1; undefined8 uVar2; bool bVar3; char cVar4; void *__ptr; void *__ptr_00; int *piVar5; undefined8 uVar6; int local_40; int local_3c; int local_38; int local_34; local_34 = 0; local_40 = 0; while (*(long *)(param_4 + (long)local_40 * 8) != 0) { local_40 = local_40 + 1; } __ptr = (void *)m_calloc((long)local_40, 4); __ptr_00 = (void *)m_malloc((long)local_40 * 0x28); for (local_38 = 0; local_38 < local_40; local_38 = local_38 + 1) { pkg_spec_init((void *)((long)__ptr_00 + (long)local_38 * 0x28), 0x201); pkg_spec_parse((void *)((long)__ptr_00 + (long)local_38 * 0x28), *(undefined8 *)(param_4 + (long)local_38 * 8)); } for (local_3c = 0; local_3c < *param_1; local_3c = local_3c + 1) { bVar3 = false; lVar1 = *(long *)(*(long *)(param_1 + 2) + (long)local_3c * 8); for (local_38 = 0; local_38 < local_40; local_38 = local_38 + 1) { cVar4 = pkg_spec_match_pkg((void *)((long)local_38 * 0x28 + (long)__ptr_00), lVar1, lVar1 + 0x48); if (cVar4 != '\0') { bVar3 = true; piVar5 = (int *)((long)__ptr + (long)local_38 * 4); *piVar5 = *piVar5 + 1; } } if (!bVar3) { *(undefined8 *)(*(long *)(param_1 + 2) + (long)local_3c * 8) = 0; } } pkg_array_foreach(param_1, param_2, param_3); for (local_38 = 0; local_38 < local_40; local_38 = local_38 + 1) { if (*(int *)((long)__ptr + (long)local_38 * 4) == 0) { uVar2 = *(undefined8 *)(param_4 + (long)local_38 * 8); uVar6 = gettext("no packages found matching %s"); notice(uVar6, uVar2); local_34 = local_34 + 1; } pkg_spec_destroy((void *)((long)__ptr_00 + (long)local_38 * 0x28)); } free(__ptr_00); free(__ptr); return local_34; }
dpkg
ghidra
static int verify_result_rpm(enum verify_result result, int check) { switch (result) { case VERIFY_FAIL: return check; case VERIFY_PASS: return '.'; case VERIFY_NONE: default: return '?'; } }
int verify_result_rpm(unsigned long a0, unsigned long a1) { unsigned int v1; if (a0 == 1) { v1 = 46; } else if (a0 != 2) { v1 = 63; } else { v1 = a1; } return v1; }
dpkg
angr_phoenix
static void read_dev_mcast(struct ma_info **result_p) { char buf[256]; FILE *fp = fopen("/proc/net/dev_mcast", "r"); if (!fp) return; while (fgets(buf, sizeof(buf), fp)) { char hexa[256]; struct ma_info m = {.addr.family = 17}; int len; int st; sscanf(buf, "%d%s%d%d%s", &m.index, m.name, &m.users, &st, hexa); if (filter.dev && strcmp(filter.dev, m.name)) continue; len = parse_hex(hexa, (unsigned char *)&m.addr.data, sizeof(m.addr.data)); if (len >= 0) { struct ma_info *ma = malloc(sizeof(m)); memcpy(ma, &m, sizeof(m)); ma->addr.bytelen = len; ma->addr.bitlen = len << 3; if (st) ma->features = "static"; maddr_ins(result_p, ma); } } fclose(fp); }
void read_dev_mcast(undefined8 param_1) { int iVar1; char *pcVar2; long lVar3; undefined8 *puVar4; long in_FS_OFFSET; byte bVar5; undefined8 uVar6; int local_360; int local_35c; FILE *local_358; void *local_350; undefined8 local_348; undefined local_340[4]; undefined local_33c[12]; char local_330[22]; undefined2 local_31a; undefined local_318[256]; char local_218[256]; undefined local_118[264]; long local_10; bVar5 = 0; local_10 = *(long *)(in_FS_OFFSET + 0x28); local_358 = fopen64("/proc/net/dev_mcast", "r"); if (local_358 != (FILE *)0x0) { while (true) { uVar6 = 0x10038d; pcVar2 = fgets(local_218, 0x100, local_358); if (pcVar2 == (char *)0x0) break; puVar4 = &local_348; for (lVar3 = 0x26; lVar3 != 0; lVar3 = lVar3 + -1) { *puVar4 = 0; puVar4 = puVar4 + (ulong)bVar5 * -2 + 1; } local_31a = 0x11; __isoc99_sscanf(local_218, "%d%s%d%d%s", local_340, local_330, local_33c, &local_360, local_118, uVar6); if (((filter._0_8_ == (char *)0x0) || (iVar1 = strcmp(filter._0_8_, local_330), iVar1 == 0)) && (local_35c = parse_hex(local_118, local_318, 0x100), -1 < local_35c)) { local_350 = malloc(0x130); memcpy(local_350, &local_348, 0x130); *(short *)((long)local_350 + 0x2a) = (short)local_35c; *(short *)((long)local_350 + 0x2c) = (short)(local_35c << 3); if (local_360 != 0) { *(char **)((long)local_350 + 0x10) = "static"; } maddr_ins(param_1, local_350); } } fclose(local_358); } if (local_10 == *(long *)(in_FS_OFFSET + 0x28)) { return; } __stack_chk_fail(); }
iproute2-6.0.0
ghidra
static void ip_long(uhash_ctx_t ahc, u_char *res) { int i; UINT64 t; for (i = 0; i < (16 / 4); i++) { if (ahc->poly_accum[i] >= ((UINT64)0xFFFFFFFFFFFFFFC5ull)) ahc->poly_accum[i] -= ((UINT64)0xFFFFFFFFFFFFFFC5ull); t = ip_aux(0, ahc->ip_keys + (i * 4), ahc->poly_accum[i]); put_u32((UINT32 *)res + i, ip_reduce_p36(t) ^ ahc->ip_trans[i]); } }
void ip_long(unsigned long a0, unsigned long a1) { unsigned int v0; unsigned int v1; for (v0 = 0; v0 <= 3; v0 = __addvsi3(v0, 0x1)) { if (*((a0 + (v0 + 150 << 3) + 8)) > -60) *((a0 + (v0 + 150) * 8 + 8)) = *((a0 + (v0 + 150) * 8 + 8)) + 59; *(&v1) = ip_aux(0x0, a0 + 1240 + v0 * 32, *((a0 + (v0 + 150) * 8 + 8))); put_u32(a1 + v0 * 4, *((a0 + (v0 + 340) * 4 + 8)) ^ ip_reduce_p36(*(&v1)), *((a0 + (v0 + 340) * 4 + 8)) ^ ip_reduce_p36(*(&v1))); } return; }
openssh-portable
angr_dream
char *extract_command_subst(string, sindex, xflags) char *string; int *sindex; int xflags; { char *ret; if (string[*sindex] == '(' || (xflags & 0x0400)) return (extract_delimited_string(string, sindex, "$(", "(", ")", xflags | 0x0008)); else { xflags |= (no_longjmp_on_fatal_error ? 0x0040 : 0); ret = xparse_dolparen(string, string + *sindex, sindex, xflags); return ret; } }
int extract_command_subst(char *a0, unsigned int *a1, unsigned long a2) { unsigned int v0; unsigned long v1; unsigned long v3; unsigned int v4; v0 = a2; if (a0[*(a1)] == 40) { LABEL_401957: v3 = extract_delimited_string(a0, a1, "$(", "(", ")", v0 | 8); } else { if (!(!(v0 & 0x400))) goto LABEL_401957; if (!no_longjmp_on_fatal_error) v4 = 0; else v4 = 64; v0 |= v4; v1 = xparse_dolparen(a0, &a0[*(a1)], a1, v0); v3 = v1; } return v3; }
bash
angr_phoenix
test_code_t test_known_protocols(gnutls_session_t session) { if (tls1_2_ok == 0 && tls1_1_ok == 0 && tls1_ok == 0 && ssl3_ok == 0 && tls1_3_ok == 0) return TEST_FAILED; return TEST_SUCCEED; }
long long test_known_protocols(unsigned long a0) { unsigned long v0; unsigned long long v2; v0 = a0; if (tls1_2_ok) { v2 = 0; return v2; } else if (tls1_1_ok) { v2 = 0; return v2; } else if (tls1_ok) { v2 = 0; return v2; } else if (ssl3_ok) { v2 = 0; return v2; } else if (tls1_3_ok) { v2 = 0; return v2; } else { v2 = 1; return v2; } }
gnutls
angr_sailr
static void move_fd(int oldfd, int newfd) { if (oldfd != newfd) { dup2(oldfd, newfd); close(oldfd); } }
int move_fd(int a1, int a2) { int result; result = a1; if (a1 != a2) { dup2(a1, a2); return close(a1); } return result; }
coreutils
ida
static int uhash_reset(uhash_ctx_t pc) { nh_reset(&pc->hash); pc->msg_len = 0; pc->poly_accum[0] = 1; pc->poly_accum[1] = 1; pc->poly_accum[2] = 1; pc->poly_accum[3] = 1; return 1; }
undefined8 uhash_reset(long param_1) { nh_reset(param_1); *(undefined4 *)(param_1 + 0x568) = 0; *(undefined8 *)(param_1 + 0x4b8) = 1; *(undefined8 *)(param_1 + 0x4c0) = 1; *(undefined8 *)(param_1 + 0x4c8) = 1; *(undefined8 *)(param_1 + 0x4d0) = 1; return 1; }
openssh-portable
ghidra
static void finalise_cert_exts(void) { if (certflags_command != ((void *)0)) cert_ext_add("force-command", certflags_command, 1); if (certflags_src_addr != ((void *)0)) cert_ext_add("source-address", certflags_src_addr, 1); if ((certflags_flags & (1 << 6)) != 0) cert_ext_add("verify-required", ((void *)0), 1); if ((certflags_flags & (1)) != 0) cert_ext_add("permit-X11-forwarding", ((void *)0), 0); if ((certflags_flags & (1 << 1)) != 0) cert_ext_add("permit-agent-forwarding", ((void *)0), 0); if ((certflags_flags & (1 << 2)) != 0) cert_ext_add("permit-port-forwarding", ((void *)0), 0); if ((certflags_flags & (1 << 3)) != 0) cert_ext_add("permit-pty", ((void *)0), 0); if ((certflags_flags & (1 << 4)) != 0) cert_ext_add("permit-user-rc", ((void *)0), 0); if ((certflags_flags & (1 << 5)) != 0) cert_ext_add("no-touch-required", ((void *)0), 0); if (ncert_ext > 0) qsort(cert_ext, ncert_ext, sizeof(*cert_ext), cert_ext_cmp); }
void finalise_cert_exts() { unsigned long long v1; unsigned long long v2; if (certflags_command) cert_ext_add("force-command", certflags_command, 0x1); if (certflags_src_addr) cert_ext_add("source-address", certflags_src_addr, 0x1); if ((certflags_flags & 64)) cert_ext_add("verify-required", 0x0, 0x1); if ((certflags_flags & 1)) cert_ext_add("permit-X11-forwarding", 0x0, 0x0); if ((certflags_flags & 2)) cert_ext_add("permit-agent-forwarding", 0x0, 0x0); if ((certflags_flags & 4)) cert_ext_add("permit-port-forwarding", 0x0, 0x0); if ((certflags_flags & 8)) cert_ext_add("permit-pty", 0x0, 0x0); if ((certflags_flags & 16)) cert_ext_add("permit-user-rc", 0x0, 0x0); if ((certflags_flags & 32)) cert_ext_add("no-touch-required", 0x0, 0x0); v1 = ncert_ext; if (ncert_ext) v2 = qsort(cert_ext, ncert_ext, 0x18, cert_ext_cmp); return; }
openssh-portable
angr_sailr
void sshlogdirect(LogLevel level, int forced, const char *fmt, ...) { va_list args; __builtin_va_start(args, fmt); do_log(level, forced, ((void *)0), fmt, args); __builtin_va_end(args); }
long long sshlogdirect(unsigned long a0, unsigned long a1, char *a2, unsigned long a3, unsigned long a4, unsigned long a5) { unsigned int v0; unsigned int v1; unsigned long v2; unsigned long v3; unsigned long v4; char v5; unsigned long v6; unsigned long v7; unsigned long v8; int v9; int v10; int v11; int v12; int v13; int v14; int v15; int v16; unsigned long v17; char v18; int v19; int v20; int v21; int v22; int v23; int v24; int v25; int v26; unsigned long long *v27; v6 = a3; v7 = a4; v8 = a5; if (v18) { v9 = v19; v10 = v20; v11 = v21; v12 = v22; v13 = v23; v14 = v24; v15 = v25; v16 = v26; } v4 = v27[5]; v0 = 24; v1 = 48; v2 = &v17; v3 = &v5; do_log(a0, a1, 0x0, a2, &v0); if ((v4 ^ v27[5])) __stack_chk_fail(); return 0; }
openssh-portable
angr_sailr
static int compute_number_width(size_t nfiles, struct fstatus const *fstatus) { int width = 1; if (0 < nfiles && fstatus[0].failed <= 0) { int minimum_width = 1; uintmax_t regular_total = 0; for (size_t i = 0; i < nfiles; i++) if (!fstatus[i].failed) { if (((((fstatus[i].st.st_mode)) & 0170000) == (0100000))) regular_total += fstatus[i].st.st_size; else minimum_width = 7; } for (; 10 <= regular_total; regular_total /= 10) width++; if (width < minimum_width) width = minimum_width; } return width; }
int compute_number_width(unsigned long a0, unsigned int *a1) { unsigned int v0; unsigned int v1; unsigned long long v2; void *v3; v0 = 1; if (a0 && *(a1) <= 0) { v1 = 1; v2 = 0; for (v3 = 0; v3 < a0; v3 += 1) { if (!*((a1 + 0x80 * v3 + 0x10 * v3 + 0x8 * v3))) { if ((*((32 + a1 + 0x80 * v3 + 0x10 * v3 + 0x8 * v3)) & 0xf000) == 0x8000) v2 += *((56 + a1 + 0x98 * v3)); else v1 = 7; } } for (; v2 > 9; v2 = v2 * 14757395258967641293 >> 64 >> 3) { v0 += 1; } if (v0 < v1) v0 = v1; } return v0; }
coreutils
angr_dream
test_code_t test_tls1_1(gnutls_session_t session) { int ret; sprintf(prio_str, "NONE:" "+CIPHER-ALL:+ARCFOUR-128:+3DES-CBC" ":+GOST28147-TC26Z-CNT" ":" "+COMP-NULL" ":+VERS-TLS1.1:" "+MAC-ALL:+MD5:+SHA1" ":+GOST28147-TC26Z-IMIT" ":" "+RSA:+DHE-RSA:+DHE-DSS:+ANON-DH:+ECDHE-RSA:+ECDHE-ECDSA:+ANON-ECDH" ":+VKO-GOST-12" ":%s", rest); { int _ret; if ((_ret = __gnutls_priority_set_direct(session, prio_str, 1161)) != TEST_SUCCEED) { return _ret; } }; gnutls_credentials_set(session, GNUTLS_CRD_CERTIFICATE, xcred); ret = test_do_handshake(session); if (ret == TEST_SUCCEED) tls1_1_ok = 1; return ret; }
long long test_tls1_1(unsigned long long a0) { unsigned int v0; unsigned int v1; unsigned long long v3; sprintf( &prio_str, "NONE:+CIPHER-ALL:+ARCFOUR-128:+3DES-CBC:+GOST28147-TC26Z-CNT:+COMP-NULL:" "+VERS-TLS1.1:+MAC-ALL:+MD5:+SHA1:+GOST28147-TC26Z-IMIT:+RSA:+DHE-RSA:+" "DHE-DSS:+ANON-DH:+ECDHE-RSA:+ECDHE-ECDSA:+ANON-ECDH:+VKO-GOST-12:%s", &rest); v0 = __gnutls_priority_set_direct(a0, &prio_str, 0x489); if (v0) { v3 = v0; } else { gnutls_credentials_set(a0, 0x1, xcred); v1 = test_do_handshake(a0); if (!v1) tls1_1_ok = 1; v3 = v1; } return v3; }
gnutls
angr_phoenix
read_init(EditLine *el) { struct macros *ma; if ((el->el_read = malloc(sizeof(*el->el_read))) == ((void *)0)) return -1; ma = &el->el_read->macros; if ((ma->macro = calloc(10, sizeof(*ma->macro))) == ((void *)0)) { free(el->el_read); return -1; } ma->level = -1; ma->offset = 0; el->el_read->read_char = read_char; return 0; }
undefined8 read_init(long param_1) { void **ppvVar1; void *pvVar2; undefined8 uVar3; pvVar2 = malloc(0x20); *(void **)(param_1 + 0x4c0) = pvVar2; if (*(long *)(param_1 + 0x4c0) == 0) { uVar3 = 0xffffffff; } else { ppvVar1 = *(void ***)(param_1 + 0x4c0); pvVar2 = calloc(10, 8); *ppvVar1 = pvVar2; if (*ppvVar1 == (void *)0x0) { free(*(void **)(param_1 + 0x4c0)); uVar3 = 0xffffffff; } else { *(undefined4 *)(ppvVar1 + 1) = 0xffffffff; *(undefined4 *)((long)ppvVar1 + 0xc) = 0; *(code **)(*(long *)(param_1 + 0x4c0) + 0x10) = read_char; uVar3 = 0; } } return uVar3; }
libedit
ghidra
static char *get_history_word_specifier(char *spec, char *from, int *caller_index) { register int i = *caller_index; int first, last; int expecting_word_spec = 0; char *result; first = last = 0; result = (char *)((void *)0); if (spec[i] == ':') { i++; expecting_word_spec++; } if (spec[i] == '%') { *caller_index = i + 1; return (search_match ? strcpy(xmalloc(1 + strlen(search_match)), (search_match)) : strcpy(xmalloc(1 + strlen("")), (""))); } if (spec[i] == '*') { *caller_index = i + 1; result = history_arg_extract(1, '$', from); return (result ? result : strcpy(xmalloc(1 + strlen("")), (""))); } if (spec[i] == '$') { *caller_index = i + 1; return (history_arg_extract('$', '$', from)); } if (spec[i] == '-') first = 0; else if (spec[i] == '^') { first = 1; i++; } else if (((spec[i]) >= '0' && (spec[i]) <= '9') && expecting_word_spec) { for (first = 0; ((spec[i]) >= '0' && (spec[i]) <= '9'); i++) first = (first * 10) + ((spec[i]) - '0'); } else return ((char *)((void *)0)); if (spec[i] == '^' || spec[i] == '*') { last = (spec[i] == '^') ? 1 : '$'; i++; } else if (spec[i] != '-') last = first; else { i++; if (((spec[i]) >= '0' && (spec[i]) <= '9')) { for (last = 0; ((spec[i]) >= '0' && (spec[i]) <= '9'); i++) last = (last * 10) + ((spec[i]) - '0'); } else if (spec[i] == '$') { i++; last = '$'; } else if (spec[i] == '^') { i++; last = 1; } else last = -1; } *caller_index = i; if (last >= first || last == '$' || last < 0) result = history_arg_extract(first, last, from); return (result ? result : (char *)&error_pointer); }
int get_history_word_specifier(char *a0, unsigned long long a1, unsigned int *a2) { unsigned int v0; unsigned int v1; unsigned int v2; void *v3; char *v5; unsigned int v6; unsigned int v7; v5 = *(a2); v2 = 0; v1 = 0; v0 = v1; v3 = 0; if (a0[*(a2)] == 58) { v5 = *(a2) + 1; v2 += 1; } if (*((a0 + v5)) == 37) { *(a2) = v5 + 1; if (!search_match) { v7 = strcpy(xmalloc(strlen(&g_403c84) + 1), &g_403c84); return v7; } v7 = strcpy(xmalloc(strlen(search_match) + 1), search_match); return v7; } else if (*((a0 + v5)) == 42) { *(a2) = v5 + 1; v3 = history_arg_extract(0x1, 0x24, a1); if (v3) { v7 = v3; return v7; } v7 = strcpy(xmalloc(strlen(&g_403c84) + 1), &g_403c84); return v7; } else if (*((a0 + v5)) == 36) { *(a2) = v5 + 1; v7 = history_arg_extract(0x24, 0x24, a1); return v7; } else { if (*((a0 + v5)) == 45) { v0 = 0; } else if (*((a0 + v5)) == 94) { v0 = 1; v5 = v5 + 1; } else { if (*((a0 + v5)) <= 47) { v7 = 0; return v7; } if (*((a0 + v5)) > 57) { v7 = 0; return v7; } if (!v2) { v7 = 0; return v7; } for (v0 = 0; *((a0 + v5)) > 47 && *((a0 + v5)) <= 57; v5 = v5 + 1) { v0 = *((a0 + v5)) - 48 + ((v0 * 4) + v0) * 2; } } switch (*((a0 + v5))) { case 42: case 94: v6 = (*((a0 + v5)) == 94 ? 36 : 1); v1 = v6; *(&v5) = v5 + 1; break; case 45: v5 = v5 + 1; if (*((a0 + v5)) <= 47 || *((a0 + v5)) > 57) { switch (*((a0 + v5))) { case 36: *(&v5) = v5 + 1; v1 = 36; break; case 94: *(&v5) = v5 + 1; v1 = 1; break; default: v1 = -1; break; } } else { for (v1 = 0; *((a0 + v5)) > 47 && *((a0 + v5)) <= 57; v5 = v5 + 1) { v1 = *((a0 + v5)) - 48 + ((v1 * 4) + v1) * 2; } break; } default: v1 = v0; break; } *(a2) = v5; if (v1 >= v0 || v1 == 36 || v1 < 0) v3 = history_arg_extract(v0, v1, a1); v7 = (!v3 ? v3 : &error_pointer); return v7; } }
bash
angr_sailr
static crypto_uint32 lt(crypto_uint32 a, crypto_uint32 b) { unsigned int x = a; x -= (unsigned int)b; x >>= 31; return x; }
uint lt(int param_1, int param_2) { return (uint)(param_1 - param_2) >> 0x1f; }
openssh-portable
ghidra
void show_snapshot_field_ranges(void) { struct field_range const *p; char minbuf[SYSINT_BUFSIZE]; char maxbuf[SYSINT_BUFSIZE]; printf("This tar's snapshot file field ranges are\n"); printf(" (%-15s => [ %s, %s ]):\n\n", "field name", "min", "max"); for (p = field_ranges; p->fieldname != ((void *)0); p++) { printf(" %-15s => [ %s, %s ],\n", p->fieldname, sysinttostr(p->min_val, p->min_val, p->max_val, minbuf), sysinttostr(p->max_val, p->min_val, p->max_val, maxbuf)); } printf("\n"); }
long long show_snapshot_field_ranges() { unsigned long long v0; char v1; char v2; unsigned long long v4; printf("This tar's snapshot file field ranges are\n"); printf(" (%-15s => [ %s, %s ]):\n\n", &g_404ec3, &g_404ebf); for (v0 = &field_ranges; *(v0); v0 += 24) { v4 = sysinttostr(*((v0 + 16)), *((v0 + 8)), *((v0 + 16)), &v2); printf(" %-15s => [ %s, %s ],\n", *(v0), sysinttostr(*((v0 + 8)), *((v0 + 8)), *((v0 + 16)), &v1)); } printf("\n"); return 0; }
tar
angr_sailr
void test_archive_label(void) { base64_init(); name_gather(); open_archive(ACCESS_READ); if (read_header(&current_header, &current_stat_info, read_header_auto) == HEADER_SUCCESS) { decode_header(current_header, &current_stat_info, &current_format, 0); if (current_header->header.typeflag == 'V') assign_string_n(&volume_label, current_header->header.name, sizeof(current_header->header.name)); if (volume_label) { if (verbose_option) print_volume_label(); if (!name_match(volume_label) && multi_volume_option) { char *s = drop_volume_label_suffix(volume_label); name_match(s); free(s); } } } close_archive(); label_notfound(); }
long test_archive_label() { void *ptr; base64_init(); name_gather(); open_archive(0LL); if ((unsigned int)read_header(&current_header, (long)current_stat_info, 0) == 1) { decode_header(current_header, (long)current_stat_info, &current_format, 0); if (*(_BYTE *)(current_header + 156) == 86) assign_string_n(&volume_label, current_header, 100LL); if (volume_label) { if (verbose_option) print_volume_label(); if ((unsigned char)name_match(volume_label) != 1 && multi_volume_option) { ptr = (void *)drop_volume_label_suffix(volume_label); name_match(ptr); free(ptr); } } } close_archive(); return label_notfound(); }
tar
ida
static _Bool parse_ls(const struct parser_table *entry, char **argv, int *arg_ptr) { (void)&argv; (void)&arg_ptr; return insert_fls(entry, ((void *)0)); }
long long parse_ls(unsigned long long a0, unsigned long a1, unsigned long a2) { unsigned long v0; unsigned long v1; v1 = a1; v0 = a2; return insert_fls(a0, 0x0); }
findutils
angr_phoenix
int pwdcmd(int argc, char **argv) { int flags; const char *dir = curdir; flags = cdopt(); if (flags) { if (physdir == nullstr) setpwd(dir, 0); dir = physdir; } out1fmt(snlfmt, dir); return 0; }
long pwdcmd(long a1) { char *v2; v2 = (char *)curdir; if ((unsigned int)cdopt()) { if (physdir == &nullstr) setpwd(v2, 0); v2 = (char *)physdir; } out1fmt(&snlfmt, v2); return 0LL; }
dash-0.5.11+git20210903+057cd650a4ed
ida
sh_builtin_func_t *builtin_address(name) char *name; { current_builtin = builtin_address_internal(name, 1); return (current_builtin ? current_builtin->function : (sh_builtin_func_t *)((void *)0)); }
long long builtin_address(char *a0) { current_builtin = builtin_address_internal(a0, 0x1); return (!current_builtin ? *((current_builtin + 8)) : 0); }
bash
angr_sailr
void sigcatcher_setup(void) { struct sigaction sa; memset(&sa, 0, sizeof(struct sigaction)); sa.__sigaction_handler.sa_sigaction = die_signal_handler; sa.sa_flags = 4; sigaction(8, &sa, 0); sigaction(4, &sa, 0); sigaction(7, &sa, 0); sigaction(11, &sa, 0); sigaction(6, &sa, 0); }
long long sigcatcher_setup() { unsigned long long v0; unsigned int v1; memset(&v0, 0x0, 0x98); v0 = die_signal_handler; v1 = 4; sigaction(0x8, &v0, 0x0); sigaction(0x4, &v0, 0x0); sigaction(0x7, &v0, 0x0); sigaction(0xb, &v0, 0x0); sigaction(0x6, &v0, 0x0); return 0; }
e2fsprogs-1.46.5
angr_dream
static int _rl_col_width(const char *str, int start, int end, int flags) { wchar_t wc; mbstate_t ps; int tmp, point, width, max; if (end <= start) return 0; if ((__ctype_get_mb_cur_max()) == 1 || rl_byte_oriented) return (end - start); memset(&ps, 0, sizeof(mbstate_t)); point = 0; max = end; if (flags && start == 0 && end == local_prompt_len && memcmp(str, local_prompt, local_prompt_len) == 0) return (prompt_physical_chars + wrap_offset); else if (flags && start == 0 && local_prompt_len > 0 && end > local_prompt_len && local_prompt && memcmp(str, local_prompt, local_prompt_len) == 0) { tmp = prompt_physical_chars + wrap_offset; tmp += _rl_col_width(str, local_prompt_len, end, flags); return (tmp); } while (point < start) { if (_rl_utf8locale && (((str[point]) & 0x80) == 0)) { memset(&ps, 0, sizeof(mbstate_t)); tmp = 1; } else tmp = mbrlen(str + point, max, &ps); if ((((size_t)tmp) == (size_t)-1 || ((size_t)tmp) == (size_t)-2)) { point++; max--; memset(&ps, 0, sizeof(mbstate_t)); } else if (((tmp) == 0)) break; else { point += tmp; max -= tmp; } } width = point - start; while (point < end) { if (_rl_utf8locale && (((str[point]) & 0x80) == 0)) { tmp = 1; wc = (wchar_t)str[point]; } else tmp = mbrtowc(&wc, str + point, max, &ps); if ((((size_t)tmp) == (size_t)-1 || ((size_t)tmp) == (size_t)-2)) { point++; max--; width++; memset(&ps, 0, sizeof(mbstate_t)); } else if (((tmp) == 0)) break; else { point += tmp; max -= tmp; tmp = ((_rl_utf8locale && ((wc) >= 768 && (wc) <= 879)) ? 0 : _rl_wcwidth(wc)); width += (tmp >= 0) ? tmp : 1; } } width += point - end; return width; }
long long _rl_col_width(char *a0, unsigned long a1, unsigned long a2, unsigned long a3) { unsigned int v0; unsigned int v1; unsigned int v2; unsigned int v3; unsigned int v4; char v5; void *v7; unsigned int v8; if (a2 <= a1) { v7 = 0; } else if (__ctype_get_mb_cur_max() == 1) { LABEL_407924: v7 = a2 - a1; } else { if (!(!rl_byte_oriented)) goto LABEL_407924; memset(&v5, 0x0, 0x8); v2 = 0; v4 = a2; if (a3 && !a1 && a2 == local_prompt_len && !memcmp(a0, local_prompt, local_prompt_len)) { v7 = *(&wrap_offset) + *(&prompt_physical_chars); goto LABEL_407bfd; } if (a3 && !a1 && local_prompt_len > 0 && a2 > local_prompt_len && local_prompt && !memcmp(a0, local_prompt, local_prompt_len)) { v1 = *(&wrap_offset) + *(&prompt_physical_chars); v1 += _rl_col_width(a0, local_prompt_len, a2, a3); v7 = v1; goto LABEL_407bfd; } while (true) { if (v2 >= a1) break; if (_rl_utf8locale && a0[v2] >= 0) { memset(&v5, 0x0, 0x8); v1 = 1; goto LABEL_407a9c; } v1 = mbrlen(&a0[v2], v4, &v5, &a0[v2]); LABEL_407a9c: if (v1 == -1) { LABEL_407aa8: v2 += 1; v4 = v4 - 1; memset(&v5, 0x0, 0x8); } else { if (v1 == -2) goto LABEL_407aa8; if (!v1) break; v2 += v1; v4 = v4 - v1; } } v3 = v2 - a1; while (true) { if (v2 >= a2) break; if (_rl_utf8locale && a0[v2] >= 0) { v1 = 1; v0 = a0[v2]; goto LABEL_407b5b; } v1 = mbrtowc(&v0, &a0[v2], v4, &v5); LABEL_407b5b: if (v1 == -1) { LABEL_407b67: v2 += 1; v4 = v4 - 1; v3 += 1; memset(&v5, 0x0, 0x8); } else { if (v1 == -2) goto LABEL_407b67; if (!v1) break; v2 += v1; v4 = v4 - v1; if (!_rl_utf8locale) { LABEL_407bbb: v8 = _rl_wcwidth(v0); goto LABEL_407bcc; } else { if (v0 <= 767) goto LABEL_407bbb; if (!(v0 <= 879)) goto LABEL_407bbb; v8 = 0; LABEL_407bcc: v1 = v8; if (v1 < 0) v8 = 1; else v8 = v1; v3 += v8; } } } v3 += v2 - a2; v7 = v3; } LABEL_407bfd: return v7; }
bash
angr_phoenix
static inline char *ila_ident_type2name(__u8 ident_type) { switch (ident_type) { case ILA_ATYPE_IID: return "iid"; case ILA_ATYPE_LUID: return "luid"; case ILA_ATYPE_VIRT_V4: return "virt-v4"; case ILA_ATYPE_VIRT_UNI_V6: return "virt-uni-v6"; case ILA_ATYPE_VIRT_MULTI_V6: return "virt-multi-v6"; case ILA_ATYPE_NONLOCAL_ADDR: return "nonlocal-addr"; case ILA_ATYPE_USE_FORMAT: return "use-format"; default: return "unknown"; } }
int ila_ident_type2name(unsigned long a0) { unsigned int v1; switch (a0) { case 0: v1 = &g_400f7d; break; case 1: v1 = &g_400f81; break; case 2: v1 = &g_400f86; break; case 3: v1 = &g_400f8e; break; case 4: v1 = &g_400f9a; break; case 5: v1 = &g_400fa8; break; case 32: v1 = &g_400fb6; break; default: v1 = &g_400f75; break; } return v1; }
iproute2-6.0.0
angr_dream
static void print_LDBL(long double x) { char buf[((1 + (((((64) * 1) * 146 + 484) / 485) + 1) + 16 + 1 + (-100 < ((-4931)) && (4932) < 100 ? 3 : -1000 < ((-4931)) && (4932) < 1000 ? 4 : -10000 < ((-4931)) && (4932) < 10000 ? 5 : -100000 < ((-4931)) && (4932) < 100000 ? 6 : -1000000 < ((-4931)) && (4932) < 1000000 ? 7 : (((((sizeof(int) * 8) - (!((__typeof__(int))0 < (__typeof__(int))-1))) * 146 + 484) / 485) + (!((__typeof__(int))0 < (__typeof__(int))-1))))) + 1)]; ldtoastr(buf, sizeof buf, FTOASTR_LEFT_JUSTIFY, 0, x); puts(buf); }
void print_LDBL(unsigned long a0, unsigned long a1, unsigned long a2, unsigned long a3, unsigned long a4, unsigned long a5, unsigned long v4, unsigned long a6) { unsigned long v0; unsigned long v1; char v2; char v3; unsigned long long *v5; unsigned long long v6; v1 = a6; v0 = v4; ldtoastr(&v2, 0x2d, 0x1, 0x0); puts(&v2); v6 = *(&v3) ^ v5[5]; return; }
coreutils
angr_dream
static _Bool stream_is_tty(FILE *fp) { int fd = fileno(fp); if (-1 == fd) { return 0; } else { return isatty(fd) ? 1 : 0; } }
ulong stream_is_tty(FILE *param_1) { int iVar1; ulong uVar2; undefined4 extraout_var; iVar1 = fileno(param_1); if (iVar1 == -1) { uVar2 = 0; } else { iVar1 = isatty(iVar1); uVar2 = CONCAT44(extraout_var, iVar1) & 0xffffffffffffff00 | (ulong)(iVar1 != 0); } return uVar2; }
findutils
ghidra
char *ansic_quote(str, flags, rlen) char *str; int flags, *rlen; { char *r, *ret, *s; int l, rsize; unsigned char c; size_t clen; int b; wchar_t wc; if (str == 0 || *str == 0) return ((char *)0); l = strlen(str); rsize = 4 * l + 4; r = ret = (char *)sh_xmalloc((rsize), "strtrans.c", 248); *r++ = '$'; *r++ = '\''; for (s = str; c = *s; s++) { b = l = 1; clen = 1; switch (c) { case '\033': c = 'E'; break; case '\a': c = 'a'; break; case '\v': c = 'v'; break; case '\b': c = 'b'; break; case '\f': c = 'f'; break; case '\n': c = 'n'; break; case '\r': c = 'r'; break; case '\t': c = 't'; break; case '\\': case '\'': break; default: b = is_basic(c); if ((b == 0 && ((clen = mbrtowc(&wc, s, (__ctype_get_mb_cur_max()), 0)) < 0 || ((clen) == (size_t)-1 || (clen) == (size_t)-2) || iswprint(wc) == 0)) || (b == 1 && (1 && ((*__ctype_b_loc())[(int)(((unsigned char)c))] & (unsigned short int)_ISprint)) == 0)) { *r++ = '\\'; *r++ = (((c >> 6) & 07) + '0'); *r++ = (((c >> 3) & 07) + '0'); *r++ = ((c & 07) + '0'); continue; } l = 0; break; } if (b == 0 && clen == 0) break; if (l) *r++ = '\\'; if (clen == 1) *r++ = c; else { for (b = 0; b < (int)clen; b++) *r++ = (unsigned char)s[b]; s += clen - 1; } } *r++ = '\''; *r = '\0'; if (rlen) *rlen = r - ret; return ret; }
long long ansic_quote(char *a0, unsigned long a1, unsigned int *a2) { unsigned int v0; int tmp_24; int tmp_32; int tmp_44; int tmp_72; int tmp_108; int tmp_133; int tmp_12; char v1; char v2; unsigned int v3; unsigned int v4; unsigned int v5; char *v6; char *v7; unsigned long long v8; unsigned long long v9; void *v11; unsigned long long v12; char *v13; char *v14; char *v15; v0 = a1; if (a0 && *(a0)) { v3 = strlen(a0); v5 = (v3 + 1) * 4; v9 = sh_xmalloc(v5, "strtrans.c", 0xf8); v6 = v9; tmp_24 = v6; v6 += 1; *(tmp_24) = 36; tmp_32 = v6; v6 += 1; *(tmp_32) = 39; v7 = a0; while (true) { v1 = *(v7); if (!v1) break; v3 = 1; v4 = v3; v8 = 1; if (v1 <= 39 && v1 >= 7) { switch (v1) { case 7: v1 = 97; break; case 8: v1 = 98; break; case 9: v1 = 116; break; case 10: v1 = 110; break; case 11: v1 = 118; break; case 12: v1 = 102; break; if (v8) { if (v3) { v13 = v6; v6 += 1; *(v13) = 92; } if (v8 == 1) { v14 = v6; v6 += 1; *(v14) = v1; } else { for (v4 = 0; v4 < v8; v4 += 1) { v15 = v6; v6 += 1; *(v15) = v7[v4]; } v7 = &v7[1 + v8]; } } case 13: v1 = 114; break; case 27: v1 = 69; break; case 39: break; default: v4 = is_basic(v1); } } if (!v4) { v8 = mbrtowc(&v2, v7, __ctype_get_mb_cur_max(), 0x0); if (v8 != -1 && v8 != -2) v12 = iswprint(*(&v2)); if (v8 == -1 || v8 == -2) { tmp_44 = v6; v6 += 1; *(tmp_44) = 92; tmp_72 = v6; v6 += 1; *(tmp_72) = (v1 >> 6) + 48; tmp_108 = v6; v6 += 1; *(tmp_108) = ((v1 >> 3) & 7) + 48; tmp_133 = v6; v6 += 1; *(tmp_133) = (v1 & 7) + 48; } } else if (v4 != 1) { v3 = 0; } if (v4 == 1) { *(&v12) = *((*(__ctype_b_loc()) + v1 * 2)); *(&v12) = v12 & 0x4000; } v7 += 1; } tmp_12 = v6; v6 += 1; *(tmp_12) = 39; *(v6) = 0; if (a2) *(a2) = &v6[-1 * v9]; v11 = v9; } if (!a0 || !*(a0)) v11 = 0; return v11; }
bash
angr_dream
void put_u32(void *vp, u_int32_t v) { u_char *p = (u_char *)vp; p[0] = (u_char)(v >> 24) & 0xff; p[1] = (u_char)(v >> 16) & 0xff; p[2] = (u_char)(v >> 8) & 0xff; p[3] = (u_char)v & 0xff; }
long long put_u32(char a0[4], unsigned long a1) { a0[0] = a1 >> 24; a0[1] = a1 >> 16; a0[2] = a1 >> 8; a0[3] = a1; return &a0[3]; }
openssh-portable
angr_dream
_Bool force_conflicts(struct deppossi *possi) { return in_force(FORCE_CONFLICTS); }
long force_conflicts() { return in_force((const char *)&loc_800); }
dpkg
ida
static void usr_update(unsigned long subuid_count, unsigned long subgid_count) { struct passwd pwent; struct spwd spent; char *tty; new_pwent(&pwent); new_spent(&spent); tty = ttyname(0); do { char *old_locale = setlocale(6, ((void *)0)); char *saved_locale = ((void *)0); if (((void *)0) != old_locale) { saved_locale = strdup(old_locale); } if (((void *)0) != saved_locale) { (void)setlocale(6, "C"); } syslog(6, "new user: name=%s, UID=%u, GID=%u, home=%s, shell=%s, from=%s", user_name, (unsigned int)user_id, (unsigned int)user_gid, user_home, user_shell, tty ? tty : "none"); if (((void *)0) != saved_locale) { (void)setlocale(6, saved_locale); free(saved_locale); } } while (0) ; if ((!lflg) && (prefix_getpwuid(user_id) == ((void *)0))) { faillog_reset(user_id); lastlog_reset(user_id); } if (pw_update(&pwent) == 0) { fprintf(stderr, gettext("%s: failed to prepare the new %s entry '%s'\n"), Prog, pw_dbname(), pwent.pw_name); fail_exit(1); } if (is_shadow_pwd && (spw_update(&spent) == 0)) { fprintf(stderr, gettext("%s: failed to prepare the new %s entry '%s'\n"), Prog, spw_dbname(), spent.sp_namp); fail_exit(1); } if (is_sub_uid && (sub_uid_add(user_name, sub_uid_start, subuid_count) == 0)) { fprintf(stderr, gettext("%s: failed to prepare the new %s entry\n"), Prog, sub_uid_dbname()); fail_exit(16); } if (is_sub_gid && (sub_gid_add(user_name, sub_gid_start, subgid_count) == 0)) { fprintf(stderr, gettext("%s: failed to prepare the new %s entry\n"), Prog, sub_uid_dbname()); fail_exit(18); } if (do_grp_update) { grp_update(); } }
unsigned long usr_update(long a1, long a2) { const char *v2; const char *v3; long v4; long v5; long v6; char *v7; long v8; long v9; long v10; char *v11; char *v12; long v13; long v14; char *v15; char *v16; long v17; long v18; char *v19; char *locale; char *v24; const char *s; long v26[6]; long v27[9]; unsigned long v28; v28 = __readfsqword(0x28u); new_pwent((long)v26); new_spent(v27); v24 = ttyname(0); s = setlocale(6, 0LL); locale = 0LL; if (s) locale = strdup(s); if (locale) setlocale(6, "C"); if (v24) v2 = v24; else v2 = "none"; v3 = "new user: name=%s, UID=%u, GID=%u, home=%s, shell=%s, from=%s"; syslog(6, "new user: name=%s, UID=%u, GID=%u, home=%s, shell=%s, from=%s", user_name, user_id, user_gid, user_home, user_shell, v2); if (locale) { v3 = locale; setlocale(6, locale); free(locale); } if (lflg != 1 && !prefix_getpwuid(user_id)) { faillog_reset(user_id); lastlog_reset(user_id); } if (!(unsigned int)pw_update(v26)) { v4 = v26[0]; v5 = pw_dbname(v26, v3); v6 = Prog; v7 = gettext("%s: failed to prepare the new %s entry '%s'\n"); fprintf(stderr, v7, v6, v5, v4); fail_exit((_BYTE *)fail_exit + 1, v7); } if (is_shadow_pwd && !(unsigned int)spw_update(v27)) { v8 = v27[0]; v9 = spw_dbname(v27, v3); v10 = Prog; v11 = gettext("%s: failed to prepare the new %s entry '%s'\n"); fprintf(stderr, v11, v10, v9, v8); fail_exit((_BYTE *)fail_exit + 1, v11); } if (is_sub_uid) { v12 = user_name; if (!(unsigned int)sub_uid_add(user_name, (unsigned int)sub_uid_start, a1)) { v13 = sub_uid_dbname(v12); v14 = Prog; v15 = gettext("%s: failed to prepare the new %s entry\n"); fprintf(stderr, v15, v14, v13); fail_exit((_BYTE *)&loc_B + 5, v15); } } if (is_sub_gid) { v16 = user_name; if (!(unsigned int)sub_gid_add(user_name, (unsigned int)sub_gid_start, a2)) { v17 = sub_uid_dbname(v16); v18 = Prog; v19 = gettext("%s: failed to prepare the new %s entry\n"); fprintf(stderr, v19, v18, v17); fail_exit((char *)&loc_12, v19); } } if (do_grp_update) grp_update(); return __readfsqword(0x28u) ^ v28; }
shadow
ida
static int xfrm_policy_dir_parse(__u8 *dir, int *argcp, char ***argvp) { int argc = *argcp; char **argv = *argvp; if (strcmp(*argv, "in") == 0) *dir = XFRM_POLICY_IN; else if (strcmp(*argv, "out") == 0) *dir = XFRM_POLICY_OUT; else if (strcmp(*argv, "fwd") == 0) *dir = XFRM_POLICY_FWD; else invarg("DIR value is invalid", *argv); *argcp = argc; *argvp = argv; return 0; }
void xfrm_policy_dir_parse(char *a0, unsigned int *a1, unsigned long long *a2) { unsigned int v0; unsigned long long *v1; void *v3; v0 = *(a1); v1 = *(a2); if (!strcmp(*(v1), "in")) { *(a0) = 0; } else if (!strcmp(*(v1), "out")) { *(a0) = 1; } else if (strcmp(*(v1), "fwd")) { invarg("DIR value is invalid", *(v1)); } else { *(a0) = 2; } *(a1) = v0; *(a2) = v1; v3 = 0; return; }
iproute2-6.0.0
angr_phoenix
vi_yank_end(EditLine *el, wint_t c __attribute__((__unused__))) { cv_yank(el, el->el_line.cursor, (int)(el->el_line.lastchar - el->el_line.cursor)); return 4; }
long long vi_yank_end(unsigned long long a0[13], unsigned long a1) { unsigned int v0; v0 = a1; cv_yank(a0, a0[11], a0[12] - a0[11] >> 2, a0[11]); return 4; }
libedit
angr_dream
tty_end(EditLine *el, int how) { if (el->el_flags & 0x004) return; if (!el->el_tty.t_initialized) return; if (tty_setty(el, how, &el->el_tty.t_or) == -1) { } }
void tty_end(long param_1, undefined4 param_2) { if (((*(uint *)(param_1 + 0x2c) & 4) == 0) && (*(char *)(param_1 + 0x30a) != '\0')) { tty_setty(param_1, param_2, param_1 + 0x20c); } return; }
libedit
ghidra
enum dump_status sparse_extract_file(int fd, struct tar_stat_info *st, off_t *size) { _Bool rc = 1; struct tar_sparse_file file; size_t i; if (!tar_sparse_init(&file)) return dump_status_not_implemented; file.stat_info = st; file.fd = fd; file.seekable = lseek(fd, 0, 0) == 0; file.offset = 0; rc = tar_sparse_decode_header(&file); for (i = 0; rc && i < file.stat_info->sparse_map_avail; i++) rc = tar_sparse_extract_region(&file, i); *size = file.stat_info->archive_file_size - file.dumped_size; return (tar_sparse_done(&file) && rc) ? dump_status_ok : dump_status_short; }
long long sparse_extract_file(unsigned long a0, unsigned long long a1[39], unsigned long long *a2) { char v0; void *v1; unsigned int v2; char v3; void *v4; char v5; unsigned long long v8; v0 = 1; if ((tar_sparse_init(&v2) ^ 1)) { v8 = 3; } else { v2 = a0; v3 = !lseek(a0, 0x0, 0x0); v4 = 0; v0 = tar_sparse_decode_header(&v2); v1 = 0; while (true) { if (!v0) break; if (v1 >= a1[38]) break; v0 = tar_sparse_extract_region(&v2, v1); v1 += 1; } *(a2) = a1[35] - *(&v5); if (!tar_sparse_done(&v2)) { LABEL_401338: v8 = 1; } else { if (!v0) goto LABEL_401338; v8 = 0; } } return v8; }
tar
angr_phoenix
int unbind_variable_noref(name) const char *name; { SHELL_VAR *v; v = var_lookup(name, shell_variables); if (v) return makunbound(name, shell_variables); return 0; }
void unbind_variable_noref(unsigned long long a0) { unsigned long v0; void *v2; unsigned long long v3; v0 = var_lookup(a0, shell_variables); if (!v0) v2 = 0; else v3 = makunbound(a0, shell_variables); return; }
bash
angr_phoenix
static int extract_file(char *file_name, int typeflag) { int fd; off_t size; union block *data_block; int status; size_t count; size_t written; _Bool interdir_made = 0; mode_t mode = (current_stat_info.stat.st_mode & (0100 | (0100 >> 3) | ((0100 >> 3) >> 3) | (0200 | (0200 >> 3) | ((0200 >> 3) >> 3) | (0400 | (0400 >> 3) | ((0400 >> 3) >> 3)))) & ~(0 < same_owner_option ? ((0400 | 0200 | 0100) >> 3) | (((0400 | 0200 | 0100) >> 3) >> 3) : 0)); mode_t invert_permissions = 0 < same_owner_option ? mode & (((0400 | 0200 | 0100) >> 3) | (((0400 | 0200 | 0100) >> 3) >> 3)) : 0; mode_t current_mode = 0; mode_t current_mode_mask = 0; if (to_stdout_option) fd = 1; else if (to_command_option) { fd = sys_exec_command(file_name, 'f', &current_stat_info); if (fd < 0) { skip_member(); return 0; } } else { int file_created = 0; if (set_xattr(file_name, &current_stat_info, invert_permissions, typeflag, &file_created)) return 1; while ((fd = open_output_file(file_name, typeflag, mode, file_created, &current_mode, &current_mode_mask)) < 0) { int recover = maybe_recoverable(file_name, 1, &interdir_made); if (recover != 1) { skip_member(); if (recover == 2) return 0; open_error(file_name); return 1; } } } mv_begin_read(&current_stat_info); if (current_stat_info.is_sparse) sparse_extract_file(fd, &current_stat_info, &size); else for (size = current_stat_info.stat.st_size; size > 0;) { mv_size_left(size); data_block = find_next_block(); if (!data_block) { do { if (error_hook) error_hook(); error(0, 0, gettext("Unexpected EOF in archive")); exit_status = 2; } while (0); break; } written = available_space_after(data_block); if (written > size) written = size; (*__errno_location()) = 0; count = blocking_write(fd, data_block->buffer, written); size -= written; set_next_block_after((union block *)(data_block->buffer + written - 1)); if (count != written) { if (!to_command_option) write_error_details(file_name, count, written); break; } } skip_file(size); mv_end(); if (to_stdout_option) return 0; if (!to_command_option) set_stat(file_name, &current_stat_info, fd, current_mode, current_mode_mask, typeflag, 0, (old_files_option == OVERWRITE_OLD_FILES ? 0 : 0x100)); status = close(fd); if (status < 0) close_error(file_name); if (to_command_option) sys_wait_command(); return status; }
long long extract_file(unsigned long a0, unsigned int a1) { char v0; unsigned int v1; unsigned int v2; unsigned int v3; unsigned int v4; unsigned int v5; unsigned int v6; unsigned int v7; unsigned int v8; unsigned int v9; unsigned long long v10; unsigned long long v11; unsigned int v13; unsigned int v14; unsigned long long v15; unsigned long long v16; unsigned long long v17; unsigned long long v18; void *v20; a1 = a1; v0 = 0; if (same_owner_option > 0) v13 = -64; else v13 = -1; v4 = v13 & remove_any_file & 511; if (same_owner_option > 0) v14 = v4 & 63; else v14 = 0; v5 = v14; v1 = 0; v2 = 0; if (to_stdout_option) { v3 = 1; } else if (to_command_option) { v3 = sys_exec_command(a0, 0x66, 0x500170); if (v3 < 0) { skip_member(); v16 = 0; } } else { v8 = 0; v15 = set_xattr(a0, &current_stat_info, v5, a1, &v8); if (v15) { v16 = 1; } else { while (true) { a1 = a1; v3 = open_output_file(a0, a1, v4, v8, &v1, &v2); if (v3 >= 0) break; v6 = maybe_recoverable(a0, 0x1, &v0); if (v6 == 1) continue; skip_member(); if (v6 == 2) { v16 = 0; break; } else { open_error(a0); v16 = 1; break; } } } } if (to_stdout_option || !v15 && v6 == 1 && !to_command_option || v3 >= 0 && to_command_option || !v15 && !to_command_option && v3 >= 0) { mv_begin_read(0x500170); if (blocking_write) { sparse_extract_file(v3, 0x500170, &v8); } else { *(&v8) = skip_member; while (*(&v8) > 0) { mv_size_left(*(&v8)); v10 = find_next_block(a0, a1, v17, v18, &v1, &v2); if (!v10) { if (error_hook) *(5243024)(); a1 = 0; error(0x0, 0x0, gettext("Unexpected EOF in archive")); exit_status = 2; break; } else { *(&v9) = available_space_after(v10); if (*(&v9) > *(&v8)) *(&v9) = *(&v8); *(__errno_location()) = 0; v11 = blocking_write(v3, v10, *(&v9), v10); *(&v8) = *(&v8) - *(&v9); set_next_block_after(v10 + *(&v9) - 1); if (v11 == *(&v9)) continue; if (!to_command_option) write_error_details(a0, v11, *(&v9), v11); break; } } } skip_file(*(&v8)); mv_end(a0, a1, v17, v18, &v1, &v2); if (to_stdout_option) { v16 = 0; } else { if (!to_command_option) { if (old_files_option == 2) v20 = 0; else v20 = 0x100; set_stat(a0, &current_stat_info, v3, v1, v2, a1, 0x0, v20); } v7 = close(v3); if (v7 < 0) close_error(a0); if (to_command_option) sys_wait_command(); v16 = v7; } } return v16; }
tar
angr_dream
static void removal_bulk_remove_leftover_dirs(struct pkginfo *pkg) { struct fsys_hash_rev_iter rev_iter; struct fsys_namenode_list *leftover; struct fsys_namenode *namenode; static struct varbuf fnvb; struct stat stab; ensure_packagefiles_available(pkg); modstatdb_note(pkg); push_checkpoint(~ehflag_bombout, ehflag_normaltidy); fsys_hash_rev_iter_init(&rev_iter, pkg->files); leftover = ((void *)0); while ((namenode = fsys_hash_rev_iter_next(&rev_iter))) { struct fsys_namenode *usenode; debug(dbg_eachfile, "removal_bulk '%s' flags=%o", namenode->name, namenode->flags); if (namenode->flags & FNNF_OLD_CONFF) { debug(dbg_eachfiledetail, "removal_bulk expecting only left over dirs, " "ignoring conffile '%s'", namenode->name); continue; } usenode = namenodetouse(namenode, pkg, &pkg->installed); varbuf_reset(&fnvb); varbuf_add_buf(&fnvb, instdir, strlen(instdir)); varbuf_add_buf(&fnvb, usenode->name, strlen(usenode->name)); varbuf_end_str(&fnvb); if (!stat(fnvb.buf, &stab) && ((((stab.st_mode)) & 0170000) == (0040000))) { debug(dbg_eachfiledetail, "removal_bulk is a directory"); if (dir_is_used_by_pkg(namenode, pkg, leftover)) { push_leftover(&leftover, namenode); continue; } if (dir_is_used_by_others(namenode, pkg)) continue; if (strcmp(usenode->name, "/.") == 0) { debug(dbg_eachfiledetail, "removal_bulk '%s' root directory, cannot remove", fnvb.buf); push_leftover(&leftover, namenode); continue; } } trig_path_activate(usenode, pkg); debug(dbg_eachfiledetail, "removal_bulk removing '%s'", fnvb.buf); if (!rmdir(fnvb.buf) || (*__errno_location()) == 2 || (*__errno_location()) == 40) continue; if ((*__errno_location()) == 39 || (*__errno_location()) == 17) { warning(gettext("while removing %.250s, directory '%.250s' not empty so " "not removed"), pkg_name(pkg, pnaw_nonambig), namenode->name); push_leftover(&leftover, namenode); continue; } else if ((*__errno_location()) == 16 || (*__errno_location()) == 1) { warning( gettext("while removing %.250s, unable to remove directory '%.250s': " "%s - directory may be a mount point?"), pkg_name(pkg, pnaw_nonambig), namenode->name, strerror((*__errno_location()))); push_leftover(&leftover, namenode); continue; } if ((*__errno_location()) != 20) ohshite(gettext("cannot remove '%.250s'"), fnvb.buf); if (lstat(fnvb.buf, &stab) == 0 && ((((stab.st_mode)) & 0170000) == (0120000))) { debug(dbg_eachfiledetail, "removal_bulk is a symlink to a directory"); if (unlink(fnvb.buf)) ohshite(gettext("cannot remove '%.250s'"), fnvb.buf); continue; } push_leftover(&leftover, namenode); continue; } write_filelist_except(pkg, &pkg->installed, leftover, 0); modstatdb_note(pkg); push_checkpoint(~ehflag_bombout, ehflag_normaltidy); }
void removal_bulk_remove_leftover_dirs(struct_0 *a0) { char v0; void *v1; struct_1 *v2; struct_2 *v3; char v4; char v5; char v6; unsigned long long v8; unsigned long long v9; unsigned long long v10; unsigned long long v11; unsigned long long v12; unsigned long long v13; unsigned long long v14; unsigned long long *v16; unsigned long long v17; ensure_packagefiles_available(a0); modstatdb_note(a0); push_checkpoint(0xfffffffd, 0x1); fsys_hash_rev_iter_init(&v0, a0->field_168, a0->field_168); v1 = 0; while (true) { while (true) { while (true) { v2 = fsys_hash_rev_iter_next(&v0); if (v2) { debug(0x8, "removal_bulk '%s' flags=%o", v2->field_8); if ((v2->field_30 & 4)) { debug(0x40, "removal_bulk expecting only left over dirs, ignoring " "conffile '%s'", v2->field_8); } else { v3 = namenodetouse(v2, a0, &a0->padding_0[72], a0); varbuf_reset(&fnvb.5642); varbuf_add_buf(&fnvb.5642, instdir, strlen(instdir)); varbuf_add_buf(&fnvb.5642, v3->field_8, strlen(v3->field_8)); varbuf_end_str(&fnvb.5642); v8 = stat(g_4021f0, &v4); if (!v8 && (*(&v5) & 0xf000) == 0x4000) { debug(0x40, "removal_bulk is a directory", v9); v10 = dir_is_used_by_pkg(v2, a0, v1, a0); if (v10) { push_leftover(&v1, v2); continue; } else { v11 = dir_is_used_by_others(v2, a0, a0); if (v11) continue; if (!v11) { v12 = strcmp(v3->field_8, "/."); if (!v12) { debug(0x40, "removal_bulk '%s' root directory, cannot remove", g_4021f0); push_leftover(&v1, v2); continue; } } } } if (v8 || (*(&v5) & 0xf000) != 0x4000 || !v11 && !v10 && v12) { trig_path_activate(v3, a0, a0); debug(0x40, "removal_bulk removing '%s'", g_4021f0); v13 = rmdir(g_4021f0); if (!v13) continue; *(&v13) = *(__errno_location()); if (v13 == 2) continue; *(&v13) = *(__errno_location()); if (v13 != 40) break; } } } else { write_filelist_except(a0, &a0->padding_0[72], v1, 0x0); modstatdb_note(a0); push_checkpoint(0xfffffffd, 0x1); v17 = *(&v6) ^ v16[5]; return; } } *(&v13) = *(__errno_location()); if (v13 != 39) { *(&v13) = *(__errno_location()); if (v13 != 17) { *(&v13) = *(__errno_location()); if (v13 != 16) { *(&v13) = *(__errno_location()); if (v13 != 1) { *(&v13) = *(__errno_location()); if (v13 != 20) ohshite(gettext("cannot remove '%.250s'"), g_4021f0, v9); v14 = lstat(g_4021f0, &v4); if (!v14 && (*(&v5) & 0xf000) == 0xa000) { debug(0x40, "removal_bulk is a symlink to a directory", v9); if (unlink(g_4021f0)) break; } if (v14 || (*(&v5) & 0xf000) != 0xa000) { push_leftover(&v1, v2); continue; } } } if (v13 == 1 || v13 == 16) { strerror(*(__errno_location())); warning(gettext("while removing %.250s, unable to remove directory " "'%.250s': %s - directory may be a mount point?"), pkg_name(a0, 0x1)); push_leftover(&v1, v2); continue; } } } if (v13 == 17 || v13 == 39) { warning(gettext("while removing %.250s, directory '%.250s' not empty " "so not removed"), pkg_name(a0, 0x1)); push_leftover(&v1, v2); } } ohshite(gettext("cannot remove '%.250s'"), g_4021f0, v9); } }
dpkg
angr_dream
static inline int ila_hook_name2type(char *name) { if (!strcmp(name, "output")) return ILA_HOOK_ROUTE_OUTPUT; else if (!strcmp(name, "input")) return ILA_HOOK_ROUTE_INPUT; else return -1; }
int ila_hook_name2type(char *a0) { unsigned int v1; if (!strcmp(a0, "output")) { v1 = 0; } else if (!strcmp(a0, "input")) { v1 = 1; } else { v1 = -1; } return v1; }
iproute2-6.0.0
angr_phoenix
errcode_t e2fsck_allocate_inode_bitmap(ext2_filsys fs, const char *descr, int deftype, const char *name, ext2fs_inode_bitmap *ret) { errcode_t retval; unsigned int save_type; e2fsck_set_bitmap_type(fs, deftype, name, &save_type); retval = ext2fs_allocate_inode_bitmap(fs, descr, ret); fs->default_bitmap_type = save_type; return retval; }
long long e2fsck_allocate_inode_bitmap(struct_0 *a0, unsigned long long a1, unsigned long a2, unsigned long long a3, unsigned long long a4) { char v0; unsigned long v1; e2fsck_set_bitmap_type(a0, a2, a3, &v0); v1 = ext2fs_allocate_inode_bitmap(a0, a1, a4, a1); a0->field_c4 = *(&v0); return v1; }
e2fsprogs-1.46.5
angr_phoenix
static int ssh_packet_send_mux(struct ssh *ssh) { struct session_state *state = ssh->state; u_char type, *cp; size_t len; int r; if (ssh->kex) return -1; len = sshbuf_len(state->outgoing_packet); if (len < 6) return -1; cp = sshbuf_mutable_ptr(state->outgoing_packet); type = cp[5]; if (ssh_packet_log_type(type)) sshlog("packet.c", __func__, 2638, 1, SYSLOG_LEVEL_DEBUG3, ((void *)0), "type %u", type); if (type >= 80 && type <= 127) { do { const u_int32_t __v = (len - 4); ((u_char *)(cp))[0] = (__v >> 24) & 0xff; ((u_char *)(cp))[1] = (__v >> 16) & 0xff; ((u_char *)(cp))[2] = (__v >> 8) & 0xff; ((u_char *)(cp))[3] = __v & 0xff; } while (0); if ((r = sshbuf_putb(state->output, state->outgoing_packet)) != 0) return r; } sshbuf_reset(state->outgoing_packet); return 0; }
void ssh_packet_send_mux(unsigned long long a0[2]) { unsigned long long v0; unsigned long v1; char v2; unsigned int v3; unsigned int v4; unsigned long long v5[7]; unsigned long v6; char v7[6]; unsigned long long v9; unsigned long long v10; unsigned long long v11; void *v12; v5[0] = a0[0]; if (a0[1]) { v9 = 4294967295; return; } v6 = sshbuf_len(v5[6]); if (v6 <= 5) { v10 = 4294967295; return; } *(&v7) = sshbuf_mutable_ptr(v5[6]); v2 = v7[5]; if (ssh_packet_log_type(v2)) { v1 = v2; v0 = "type %u"; sshlog("packet.c", "ssh_packet_send_mux", 0xa4e, 0x1, 0x7, 0x0); } if (v2 > 79 && v2 >= 0) { v3 = v6 - 4; v7[0] = v3 >> 24; v7[1] = v3 >> 16; v7[2] = v3 >> 8; v7[3] = v3; v4 = sshbuf_putb(v5[5], v5[6], v5[6]); if (v4) { v11 = v4; return; } } sshbuf_reset(v5[6]); v12 = 0; return; }
openssh-portable
angr_sailr
static void rebuild_extents(e2fsck_t ctx, const char *pass_name, int pr_header) { struct problem_context pctx; struct resource_track rtrack; struct extent_list list = {0}; int first = 1; ext2_ino_t ino = 0; errcode_t retval; if (!ext2fs_has_feature_extents(ctx->fs->super) || !ext2fs_test_valid(ctx->fs) || ctx->invalid_bitmaps) { if (ctx->inodes_to_rebuild) ext2fs_free_inode_bitmap(ctx->inodes_to_rebuild); ctx->inodes_to_rebuild = ((void *)0); } if (ctx->inodes_to_rebuild == ((void *)0)) return; init_resource_track(&rtrack, ctx->fs->io); clear_problem_context(&pctx); e2fsck_read_bitmaps(ctx); list.size = 341; retval = ext2fs_get_array(sizeof(struct ext2fs_extent), list.size, &list.extents); if (retval) return; while (1) { retval = ext2fs_find_first_set_inode_bitmap2( ctx->inodes_to_rebuild, ino + 1, ctx->fs->super->s_inodes_count, &ino); if (retval) break; pctx.ino = ino; if (first) { fix_problem(ctx, pr_header, &pctx); first = 0; } pctx.errcode = rebuild_extent_tree(ctx, &list, ino); if (pctx.errcode) { end_problem_latch(ctx, 0x00B0); fix_problem(ctx, 0x014001, &pctx); } if (ctx->progress && !ctx->progress_fd) e2fsck_simple_progress( ctx, "Rebuilding extents", 100.0 * (float)ino / (float)ctx->fs->super->s_inodes_count, ino); } end_problem_latch(ctx, 0x00B0); ext2fs_free_inode_bitmap(ctx->inodes_to_rebuild); ctx->inodes_to_rebuild = ((void *)0); ext2fs_free_mem(&list.extents); print_resource_track(ctx, pass_name, &rtrack, ctx->fs->io); }
void rebuild_extents(struct_0 *a0, unsigned long long a1, unsigned long a2) { unsigned int v0; unsigned int v1; unsigned long v2; void *v3; void *v4; void *v5; unsigned int v6; void *v7; void *v8; void *v9; char v10; unsigned long v11; unsigned int v12; char v13; unsigned long long v15; unsigned int v16; unsigned int v17; unsigned long v19; int v22; int v23; unsigned long long *v24; unsigned long long v25; v3 = 0; v4 = 0; v5 = 0; v7 = 0; v8 = 0; v9 = 0; v1 = 1; v0 = 0; if (!ext2fs_has_feature_extents(a0->field_0->field_20) || !ext2fs_test_valid(a0->field_0) || a0->field_208) { if (a0->field_3a0) ext2fs_free_inode_bitmap(a0->field_3a0); a0->field_3a0 = 0; } if (a0->field_3a0) { init_resource_track(&v10, a0->field_0->field_8, a0->field_0->field_8); clear_problem_context(&v11); e2fsck_read_bitmaps(a0); v6 = 341; v2 = ext2fs_get_array(0x18, v6, &v4); if (!v2) { while (true) { v2 = ext2fs_find_first_set_inode_bitmap2(a0->field_3a0, v0 + 1, *(a0->field_0->field_20), &v0); if (v2) break; v12 = v0; if (v1) { fix_problem(a0, a2, &v11, a2); v1 = 0; } v11 = rebuild_extent_tree(a0, &v3, v0); if (v11) { end_problem_latch(a0, 0xb0); fix_problem(a0, 0x14001, &v11, v15); } if (a0->field_160 && !a0->field_2c8) { if (v0 < 0) { v17 = v0 >> 1 | v0 & 1; v16 = reg_224 * 2; } else { v16 = v0; } v19 = v16; v22 = 0; *(&v22) = 0x4059000000000000; if (*(a0->field_0->field_20) >= 0) { *(&v22) = *(a0->field_0->field_20); } else { *(&v22) = *(a0->field_0->field_20) >> 1 | *(a0->field_0->field_20) & 1; v22 *= 2; } v23 = reg_256 * 0x4059000000000000 / v22; v16 = v23; e2fsck_simple_progress(a0, "Rebuilding extents", v0); } } end_problem_latch(a0, 0xb0); ext2fs_free_inode_bitmap(a0->field_3a0); a0->field_3a0 = 0; ext2fs_free_mem(&v4); print_resource_track(a0, a1, &v10, a0->field_0->field_8); } } v25 = *(&v13) ^ v24[5]; return; }
e2fsprogs-1.46.5
angr_sailr
static void assemble_algorithms(ServerOptions *o) { char *all_cipher, *all_mac, *all_kex, *all_key, *all_sig; char *def_cipher, *def_mac, *def_kex, *def_key, *def_sig; int r; all_cipher = cipher_alg_list(',', 0); all_mac = mac_alg_list(','); all_kex = kex_alg_list(','); all_key = sshkey_alg_list(0, 0, 1, ','); all_sig = sshkey_alg_list(0, 1, 1, ','); def_cipher = match_filter_allowlist("chacha20-poly1305@openssh.com," "aes128-ctr,aes192-ctr,aes256-ctr," "aes128-gcm@openssh.com,aes256-gcm@openssh.com", all_cipher); def_mac = match_filter_allowlist("umac-64-etm@openssh.com," "umac-128-etm@openssh.com," "hmac-sha2-256-etm@openssh.com," "hmac-sha2-512-etm@openssh.com," "hmac-sha1-etm@openssh.com," "umac-64@openssh.com," "umac-128@openssh.com," "hmac-sha2-256," "hmac-sha2-512," "hmac-sha1", all_mac); def_kex = match_filter_allowlist("sntrup761x25519-sha512@openssh.com," "curve25519-sha256," "curve25519-sha256@libssh.org," "ecdh-sha2-nistp256," "ecdh-sha2-nistp384," "ecdh-sha2-nistp521," "diffie-hellman-group-exchange-sha256," "diffie-hellman-group16-sha512," "diffie-hellman-group18-sha512," "diffie-hellman-group14-sha256", all_kex); def_key = match_filter_allowlist("ssh-ed25519-cert-v01@openssh.com," "ecdsa-sha2-nistp256-cert-v01@openssh.com," "ecdsa-sha2-nistp384-cert-v01@openssh.com," "ecdsa-sha2-nistp521-cert-v01@openssh.com," "sk-ssh-ed25519-cert-v01@openssh.com," "sk-ecdsa-sha2-nistp256-cert-v01@openssh.com," "rsa-sha2-512-cert-v01@openssh.com," "rsa-sha2-256-cert-v01@openssh.com," "ssh-ed25519," "ecdsa-sha2-nistp256," "ecdsa-sha2-nistp384," "ecdsa-sha2-nistp521," "sk-ssh-ed25519@openssh.com," "sk-ecdsa-sha2-nistp256@openssh.com," "rsa-sha2-512," "rsa-sha2-256", all_key); def_sig = match_filter_allowlist("ssh-ed25519," "ecdsa-sha2-nistp256," "ecdsa-sha2-nistp384," "ecdsa-sha2-nistp521," "sk-ssh-ed25519@openssh.com," "sk-ecdsa-sha2-nistp256@openssh.com," "rsa-sha2-512," "rsa-sha2-256", all_sig); do { if ((r = kex_assemble_names(&o->ciphers, def_cipher, all_cipher)) != 0) sshfatal("servconf.c", __func__, 231, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "%s", "ciphers"); } while (0); do { if ((r = kex_assemble_names(&o->macs, def_mac, all_mac)) != 0) sshfatal("servconf.c", __func__, 232, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "%s", "macs"); } while (0); do { if ((r = kex_assemble_names(&o->kex_algorithms, def_kex, all_kex)) != 0) sshfatal("servconf.c", __func__, 233, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "%s", "kex_algorithms"); } while (0); do { if ((r = kex_assemble_names(&o->hostkeyalgorithms, def_key, all_key)) != 0) sshfatal("servconf.c", __func__, 234, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "%s", "hostkeyalgorithms"); } while (0); do { if ((r = kex_assemble_names(&o->hostbased_accepted_algos, def_key, all_key)) != 0) sshfatal("servconf.c", __func__, 235, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "%s", "hostbased_accepted_algos"); } while (0); do { if ((r = kex_assemble_names(&o->pubkey_accepted_algos, def_key, all_key)) != 0) sshfatal("servconf.c", __func__, 236, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "%s", "pubkey_accepted_algos"); } while (0); do { if ((r = kex_assemble_names(&o->ca_sign_algorithms, def_sig, all_sig)) != 0) sshfatal("servconf.c", __func__, 237, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "%s", "ca_sign_algorithms"); } while (0); free(all_cipher); free(all_mac); free(all_kex); free(all_key); free(all_sig); free(def_cipher); free(def_mac); free(def_kex); free(def_key); free(def_sig); }
void assemble_algorithms(long param_1) { undefined8 uVar1; char **ppcVar2; undefined *puVar3; undefined *puVar4; char *apcStack240[15]; undefined auStack120[8]; long local_70; int local_5c; void *local_58; void *local_50; void *local_48; void *local_40; void *local_38; void *local_30; void *local_28; void *local_20; void *local_18; void *local_10; ppcVar2 = (char **)auStack120; apcStack240[14] = (char *)0x10063d; local_70 = param_1; local_58 = (void *)cipher_alg_list(0x2c, 0); apcStack240[14] = (char *)0x10064b; local_50 = (void *)mac_alg_list(0x2c); apcStack240[14] = (char *)0x100659; local_48 = (void *)kex_alg_list(0x2c); apcStack240[14] = (char *)0x100676; local_40 = (void *)sshkey_alg_list(0, 0, 1, 0x2c); apcStack240[14] = (char *)0x100693; local_38 = (void *)sshkey_alg_list(0, 1, 1, 0x2c); apcStack240[14] = (char *)0x1006aa; local_30 = (void *)match_filter_allowlist( "chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,aes128-" "gcm@openssh.com,aes256-gcm@openssh.com", local_58); apcStack240[14] = (char *)0x1006c1; local_28 = (void *)match_filter_allowlist( "umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-etm@" "openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com," "umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-256,hmac-sha2-512," "hmac-sha1", local_50); apcStack240[14] = (char *)0x1006d8; local_20 = (void *)match_filter_allowlist( "sntrup761x25519-sha512@openssh.com,curve25519-sha256,curve25519-sha256@" "libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521," "diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512," "diffie-hellman-group18-sha512,diffie-hellman-group14-sha256", local_48); apcStack240[14] = (char *)0x1006ef; local_18 = (void *)match_filter_allowlist( "ssh-ed25519-cert-v01@openssh.com,ecdsa-sha2-nistp256-cert-v01@openssh." "com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-" "v01@openssh.com,sk-ssh-ed25519-cert-v01@openssh.com,sk-ecdsa-sha2-" "nistp256-cert-v01@openssh.com,rsa-sha2-512-cert-v01@openssh.com,rsa-" "sha2-256-cert-v01@openssh.com,ssh-ed25519,ecdsa-sha2-nistp256,ecdsa-" "sha2-nistp384,ecdsa-sha2-nistp521,sk-ssh-ed25519@openssh.com,sk-ecdsa-" "sha2-nistp256@openssh.com,rsa-sha2-512,rsa-sha2-256", local_40); apcStack240[14] = (char *)0x100706; local_10 = (void *)match_filter_allowlist( "ssh-ed25519,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521," "sk-ssh-ed25519@openssh.com,sk-ecdsa-sha2-nistp256@openssh.com,rsa-sha2-" "512,rsa-sha2-256", local_38); apcStack240[14] = (char *)0x100728; local_5c = kex_assemble_names(local_70 + 0x4b8, local_30, local_58); if (local_5c != 0) { apcStack240[14] = (char *)0x10073b; uVar1 = ssh_err(local_5c); apcStack240[14] = "ciphers"; ppcVar2 = apcStack240 + 0xd; apcStack240[13] = &DAT_0010b6a3; sshfatal("servconf.c", "assemble_algorithms", 0xe7, 1, 1, uVar1); } *(undefined8 *)((long)ppcVar2 + -8) = 0x100794; local_5c = kex_assemble_names(local_70 + 0x4c0, local_28, local_50); puVar3 = (undefined *)ppcVar2; if (local_5c != 0) { *(undefined8 *)((long)ppcVar2 + -8) = 0x1007a7; uVar1 = ssh_err(local_5c); *(undefined **)((long)ppcVar2 + -8) = &DAT_0010b6a6; puVar3 = (undefined *)((long)ppcVar2 + -0x10); *(undefined **)((long)ppcVar2 + -0x10) = &DAT_0010b6a3; *(undefined8 *)((long)ppcVar2 + -0x18) = 0x1007e2; sshfatal("servconf.c", "assemble_algorithms", 0xe8, 1, 1, uVar1); } *(undefined8 *)(puVar3 + -8) = 0x100800; local_5c = kex_assemble_names(local_70 + 0x4c8, local_20, local_48); puVar4 = puVar3; if (local_5c != 0) { *(undefined8 *)(puVar3 + -8) = 0x100813; uVar1 = ssh_err(local_5c); *(char **)(puVar3 + -8) = "kex_algorithms"; puVar4 = puVar3 + -0x10; *(undefined **)(puVar3 + -0x10) = &DAT_0010b6a3; *(undefined8 *)(puVar3 + -0x18) = 0x10084e; sshfatal("servconf.c", "assemble_algorithms", 0xe9, 1, 1, uVar1); } *(undefined8 *)(puVar4 + -8) = 0x10086c; local_5c = kex_assemble_names(local_70 + 0x500, local_18, local_40); puVar3 = puVar4; if (local_5c != 0) { *(undefined8 *)(puVar4 + -8) = 0x10087f; uVar1 = ssh_err(local_5c); *(char **)(puVar4 + -8) = "hostkeyalgorithms"; puVar3 = puVar4 + -0x10; *(undefined **)(puVar4 + -0x10) = &DAT_0010b6a3; *(undefined8 *)(puVar4 + -0x18) = 0x1008ba; sshfatal("servconf.c", "assemble_algorithms", 0xea, 1, 1, uVar1); } *(undefined8 *)(puVar3 + -8) = 0x1008d8; local_5c = kex_assemble_names(local_70 + 0x4f8, local_18, local_40); puVar4 = puVar3; if (local_5c != 0) { *(undefined8 *)(puVar3 + -8) = 0x1008eb; uVar1 = ssh_err(local_5c); *(char **)(puVar3 + -8) = "hostbased_accepted_algos"; puVar4 = puVar3 + -0x10; *(undefined **)(puVar3 + -0x10) = &DAT_0010b6a3; *(undefined8 *)(puVar3 + -0x18) = 0x100926; sshfatal("servconf.c", "assemble_algorithms", 0xeb, 1, 1, uVar1); } *(undefined8 *)(puVar4 + -8) = 0x100944; local_5c = kex_assemble_names(local_70 + 0x518, local_18, local_40); puVar3 = puVar4; if (local_5c != 0) { *(undefined8 *)(puVar4 + -8) = 0x100957; uVar1 = ssh_err(local_5c); *(char **)(puVar4 + -8) = "pubkey_accepted_algos"; puVar3 = puVar4 + -0x10; *(undefined **)(puVar4 + -0x10) = &DAT_0010b6a3; *(undefined8 *)(puVar4 + -0x18) = 0x100992; sshfatal("servconf.c", "assemble_algorithms", 0xec, 1, 1, uVar1); } *(undefined8 *)(puVar3 + -8) = 0x1009b0; local_5c = kex_assemble_names(local_70 + 0x508, local_10, local_38); puVar4 = puVar3; if (local_5c != 0) { *(undefined8 *)(puVar3 + -8) = 0x1009c3; uVar1 = ssh_err(local_5c); *(char **)(puVar3 + -8) = "ca_sign_algorithms"; puVar4 = puVar3 + -0x10; *(undefined **)(puVar3 + -0x10) = &DAT_0010b6a3; *(undefined8 *)(puVar3 + -0x18) = 0x1009fe; sshfatal("servconf.c", "assemble_algorithms", 0xed, 1, 1, uVar1); } *(undefined8 *)(puVar4 + -8) = 0x100a0a; free(local_58); *(undefined8 *)(puVar4 + -8) = 0x100a16; free(local_50); *(undefined8 *)(puVar4 + -8) = 0x100a22; free(local_48); *(undefined8 *)(puVar4 + -8) = 0x100a2e; free(local_40); *(undefined8 *)(puVar4 + -8) = 0x100a3a; free(local_38); *(undefined8 *)(puVar4 + -8) = 0x100a46; free(local_30); *(undefined8 *)(puVar4 + -8) = 0x100a52; free(local_28); *(undefined8 *)(puVar4 + -8) = 0x100a5e; free(local_20); *(undefined8 *)(puVar4 + -8) = 0x100a6a; free(local_18); *(undefined8 *)(puVar4 + -8) = 0x100a76; free(local_10); return; }
openssh-portable
ghidra
static void cmd_parser(int argc, char **argv) { char *rest = ((void *)0); static char lh[] = "localhost"; int optct = process_options(argc, argv); argc -= optct; argv += optct; if (rest == ((void *)0) && argc > 0) rest = argv[0]; if (gnutls_cli_debug_options.present.port) port = gnutls_cli_debug_options.value.port; else { if (gnutls_cli_debug_options.present.starttls_proto) port = starttls_proto_to_port(gnutls_cli_debug_options.arg.starttls_proto); else port = 443; } if (rest == ((void *)0)) hostname = lh; else hostname = rest; if (gnutls_cli_debug_options.present.debug) debug = gnutls_cli_debug_options.value.debug; if (gnutls_cli_debug_options.present.verbose) verbose++; }
void cmd_parser(int param_1, long param_2) { int iVar1; char *local_10; local_10 = (char *)0x0; iVar1 = process_options(param_1, param_2); if (0 < param_1 - iVar1) { local_10 = *(char **)(param_2 + (long)iVar1 * 8); } if (DAT_00102272 == '\0') { if (DAT_00102273 == '\0') { port = 0x1bb; } else { port = starttls_proto_to_port(_printf); } } else { port = DAT_0010229c; } if (local_10 == (char *)0x0) { hostname = lh_11959; } else { hostname = local_10; } if (gnutls_cli_debug_options != '\0') { debug = _strcmp; } if (DAT_00102271 != '\0') { verbose = verbose + 1; } return; }
gnutls
ghidra
expand_pax_option(struct tar_args *targs, const char *arg) { struct obstack stk; char *res; _obstack_begin((&stk), 0, 0, (xmalloc), (free)); while (*arg) { size_t seglen = strcspn(arg, ","); char *p = memchr(arg, '=', seglen); if (p) { size_t len = p - arg + 1; __extension__({ struct obstack *__o = (&stk); size_t __len = (len); if (__extension__({ struct obstack const *__o1 = (__o); (size_t)(__o1->chunk_limit - __o1->next_free); }) < __len) _obstack_newchunk(__o, __len); memcpy(__o->next_free, arg, __len); __o->next_free += __len; (void)0; }); len = seglen - len; for (++p; *p && ((*__ctype_b_loc())[(int)(((unsigned char)*p))] & (unsigned short int)_ISspace); p++) len--; if (*p == '{' && p[len - 1] == '}') { struct timespec ts; char *tmp = xmalloc(len); memcpy(tmp, p + 1, len - 2); tmp[len - 2] = 0; if (get_date_or_file(targs, "--pax-option", tmp, &ts) == 0) { char buf[TIMESPEC_STRSIZE_BOUND]; char const *s = code_timespec(ts, buf); __extension__({ struct obstack *__o = (&stk); size_t __len = (strlen(s)); if (__extension__({ struct obstack const *__o1 = (__o); (size_t)(__o1->chunk_limit - __o1->next_free); }) < __len) _obstack_newchunk(__o, __len); memcpy(__o->next_free, s, __len); __o->next_free += __len; (void)0; }); } else __extension__({ struct obstack *__o = (&stk); size_t __len = (len); if (__extension__({ struct obstack const *__o1 = (__o); (size_t)(__o1->chunk_limit - __o1->next_free); }) < __len) _obstack_newchunk(__o, __len); memcpy(__o->next_free, p, __len); __o->next_free += __len; (void)0; }); free(tmp); } else __extension__({ struct obstack *__o = (&stk); size_t __len = (len); if (__extension__({ struct obstack const *__o1 = (__o); (size_t)(__o1->chunk_limit - __o1->next_free); }) < __len) _obstack_newchunk(__o, __len); memcpy(__o->next_free, p, __len); __o->next_free += __len; (void)0; }); } else __extension__({ struct obstack *__o = (&stk); size_t __len = (seglen); if (__extension__({ struct obstack const *__o1 = (__o); (size_t)(__o1->chunk_limit - __o1->next_free); }) < __len) _obstack_newchunk(__o, __len); memcpy(__o->next_free, arg, __len); __o->next_free += __len; (void)0; }); arg += seglen; if (*arg) { __extension__({ struct obstack *__o = (&stk); if (__extension__({ struct obstack const *__o1 = (__o); (size_t)(__o1->chunk_limit - __o1->next_free); }) < 1) _obstack_newchunk(__o, 1); ((void)(*((__o)->next_free)++ = (*arg))); }); arg++; } } __extension__({ struct obstack *__o = (&stk); if (__extension__({ struct obstack const *__o1 = (__o); (size_t)(__o1->chunk_limit - __o1->next_free); }) < 1) _obstack_newchunk(__o, 1); ((void)(*((__o)->next_free)++ = (0))); }); res = xstrdup(__extension__({ struct obstack *__o1 = (&stk); void *__value = (void *)__o1->object_base; if (__o1->next_free == __value) __o1->maybe_empty_object = 1; __o1->next_free = ((sizeof(ptrdiff_t) < sizeof(void *) ? (__o1->object_base) : (char *)0) + (((__o1->next_free) - (sizeof(ptrdiff_t) < sizeof(void *) ? (__o1->object_base) : (char *)0) + (__o1->alignment_mask)) & ~(__o1->alignment_mask))); if ((size_t)(__o1->next_free - (char *)__o1->chunk) > (size_t)(__o1->chunk_limit - (char *)__o1->chunk)) __o1->next_free = __o1->chunk_limit; __o1->object_base = __o1->next_free; __value; })); __extension__({ struct obstack *__o = (&stk); void *__obj = (void *)(((void *)0)); if (__obj > (void *)__o->chunk && __obj < (void *)__o->chunk_limit) __o->next_free = __o->object_base = (char *)__obj; else _obstack_free(__o, __obj); }); return res; }
undefined8 expand_pax_option(undefined8 param_1, char *param_2) { int iVar1; size_t __n; byte *pbVar2; byte *__n_00; ushort **ppuVar3; void *__dest; char *pcVar4; size_t __n_01; undefined8 uVar5; long in_FS_OFFSET; char *local_1a8; byte *local_190; ulong local_188; undefined8 local_a8; undefined8 local_a0; undefined local_98[8]; long lStack144; char *pcStack136; char *pcStack128; char *pcStack120; ulong uStack104; byte bStack72; undefined local_38[40]; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); _obstack_begin(local_98, 0, 0, uRam00000000001016fc, uRam00000000001016f2); local_1a8 = param_2; while (*local_1a8 != '\0') { __n = strcspn(local_1a8, ","); pbVar2 = (byte *)memchr(local_1a8, 0x3d, __n); if (pbVar2 == (byte *)0x0) { if ((ulong)((long)pcStack120 - (long)pcStack128) < __n) { _obstack_newchunk(local_98, __n); } memcpy(pcStack128, local_1a8, __n); pcStack128 = pcStack128 + __n; } else { __n_00 = pbVar2 + (1 - (long)local_1a8); if (pcStack120 + -(long)pcStack128 < __n_00) { _obstack_newchunk(local_98, __n_00); } memcpy(pcStack128, local_1a8, (size_t)__n_00); pcStack128 = pcStack128 + (long)__n_00; local_188 = __n - (long)__n_00; while ((local_190 = pbVar2 + 1, *local_190 != 0 && (ppuVar3 = __ctype_b_loc(), ((*ppuVar3)[*local_190] & 0x2000) != 0))) { local_188 = local_188 - 1; pbVar2 = local_190; } if ((*local_190 == 0x7b) && (local_190[local_188 - 1] == 0x7d)) { __dest = (void *)xmalloc(local_188); memcpy(__dest, pbVar2 + 2, local_188 - 2); *(undefined *)((long)__dest + (local_188 - 2)) = 0; iVar1 = get_date_or_file(param_1, "--pax-option", __dest, &local_a8); if (iVar1 == 0) { pcVar4 = (char *)code_timespec(local_a8, local_a0, local_38); __n_01 = strlen(pcVar4); if ((ulong)((long)pcStack120 - (long)pcStack128) < __n_01) { _obstack_newchunk(local_98, __n_01); } memcpy(pcStack128, pcVar4, __n_01); pcStack128 = pcStack128 + __n_01; } else { if ((ulong)((long)pcStack120 - (long)pcStack128) < local_188) { _obstack_newchunk(local_98, local_188); } memcpy(pcStack128, local_190, local_188); pcStack128 = pcStack128 + local_188; } free(__dest); } else { if ((ulong)((long)pcStack120 - (long)pcStack128) < local_188) { _obstack_newchunk(local_98, local_188); } memcpy(pcStack128, local_190, local_188); pcStack128 = pcStack128 + local_188; } } local_1a8 = local_1a8 + __n; if (*local_1a8 != '\0') { if (pcStack120 == pcStack128) { _obstack_newchunk(local_98, 1); } *pcStack128 = *local_1a8; local_1a8 = local_1a8 + 1; pcStack128 = pcStack128 + 1; } } if (pcStack120 == pcStack128) { _obstack_newchunk(local_98, 1); } pcVar4 = pcStack128; pcStack128 = pcStack128 + 1; *pcVar4 = '\0'; if (pcStack136 == pcStack128) { bStack72 = bStack72 | 2; } pcStack128 = (char *)(~uStack104 & (ulong)(pcStack128 + uStack104)); if ((ulong)((long)pcStack120 - lStack144) < (ulong)((long)pcStack128 - lStack144)) { pcStack128 = pcStack120; } uVar5 = xstrdup(pcStack136); _obstack_free(local_98, 0); if (local_10 == *(long *)(in_FS_OFFSET + 0x28)) { return uVar5; } __stack_chk_fail(); }
tar
ghidra
void internal_warning (const char *format, ...) { va_list args; error_prolog(1); fprintf(stderr, gettext("warning: ")); __builtin_va_start(args, format); vfprintf(stderr, format, args); fprintf(stderr, "\n"); __builtin_va_end(args); }
long long internal_warning() { unsigned int v0; unsigned int v1; unsigned long v2; unsigned long v3; unsigned long v4; char v5; unsigned long v6; unsigned long v7; unsigned long v8; unsigned long v9; unsigned long v10; int v11; int v12; int v13; int v14; int v15; int v16; int v17; int v18; unsigned long v19; unsigned long v20; unsigned long v21; unsigned long v22; unsigned long v23; unsigned long v24; char v25; int v26; int v27; int v28; int v29; int v30; int v31; int v32; int v33; unsigned long long *v34; char *v35; v6 = v20; v7 = v21; v8 = v22; v9 = v23; v10 = v24; if (v25) { v11 = v26; v12 = v27; v13 = v28; v14 = v29; v15 = v30; v16 = v31; v17 = v32; v18 = v33; } v4 = v34[5]; error_prolog(0x1); fprintf(stderr, gettext("warning: ")); v0 = 8; v1 = 48; v2 = &v19; v3 = &v5; vfprintf(stderr, v35, &v0); fprintf(stderr, "\n"); if (!(v4 ^ v34[5])) return 0; __stack_chk_fail(); }
bash
angr_phoenix
static void name_list_advance(void) { struct name_elt *elt = name_head; name_head = elt->next; if (name_head) name_head->prev = ((void *)0); if (elt->type == NELT_OPTION || elt->type == NELT_CHDIR) { if (subcommand_option == CREATE_SUBCOMMAND || subcommand_option == UPDATE_SUBCOMMAND) unconsumed_option_push(elt); } else { if (elt->type != NELT_NOOP) unconsumed_option_free(); free(elt); } }
void name_list_advance(void) { long *__ptr; __ptr = name_head; name_head = (long *)*name_head; if (name_head != (long *)0x0) { *(undefined8 *)((long)name_head + 8) = 0; } if ((*(int *)(__ptr + 2) == 4) || (*(int *)(__ptr + 2) == 1)) { if ((subcommand_option == 3) || (subcommand_option == 8)) { unconsumed_option_push(__ptr); } } else { if (*(int *)(__ptr + 2) != 3) { unconsumed_option_free(); } free(__ptr); } return; }
tar
ghidra
int rl_backward_byte(int count, int key) { if (count < 0) return (rl_forward_byte(-count, key)); if (count > 0) { if (rl_point < count) { rl_point = 0; rl_ding(); } else rl_point -= count; } if (rl_point < 0) rl_point = 0; return 0; }
void rl_backward_byte(unsigned long a0, unsigned long a1) { unsigned int v0; unsigned long long v2; void *v3; v0 = a0; if (a0 < 0) { v2 = rl_forward_byte(-(v0), a1); return; } if (a0 > 0) { if (a0 <= rl_point) { rl_point = rl_point - a0; } else { rl_point = 0; rl_ding(); } } if (rl_point < 0) rl_point = 0; v3 = 0; return; }
bash
angr_sailr
static int do_show(int argc, char **argv) { if (rtnl_linkdump_req_filter_fn(&rth, 0, tuntap_filter_req) < 0) { perror("Cannot send dump request\n"); return -1; } new_json_obj(json); if (rtnl_dump_filter_nc(&rth, print_tuntap, ((void *)0), 0) < 0) { fprintf(stderr, "Dump terminated\n"); return -1; } delete_json_obj(); fflush(stdout); return 0; }
void do_show(unsigned long a0, unsigned long a1) { unsigned long v0; unsigned int v1; unsigned long long v3; unsigned long long v4; void *v5; v1 = a0; v0 = a1; if (rtnl_linkdump_req_filter_fn(0x500190, 0x0, tuntap_filter_req) < 0) { perror("Cannot send dump request\n"); v3 = 4294967295; } else { new_json_obj(json); if (rtnl_dump_filter_nc(0x500190, print_tuntap, 0x0, 0x0) < 0) { fprintf(stderr, "Dump terminated\n"); v4 = 4294967295; } else { delete_json_obj(); fflush(stdout); v5 = 0; } } return; }
iproute2-6.0.0
angr_phoenix
void chdir_do(int i) { if (chdir_current != i) { struct wd *curr = &wd[i]; int fd = curr->fd; if (!fd) { if (!(((curr->name)[0]) == '/')) chdir_do(i - 1); fd = openat(chdir_fd, curr->name, open_searchdir_flags & ~0400000); if (fd < 0) open_fatal(curr->name); curr->fd = fd; if (wdcache_count < CHDIR_CACHE_SIZE) wdcache[wdcache_count++] = i; else { struct wd *stale = &wd[wdcache[CHDIR_CACHE_SIZE - 1]]; if (close(stale->fd) != 0) close_diag(stale->name); stale->fd = 0; wdcache[CHDIR_CACHE_SIZE - 1] = i; } } if (0 < fd) { size_t ci; int prev = wdcache[0]; for (ci = 1; prev != i; ci++) { int cur = wdcache[ci]; wdcache[ci] = prev; if (cur == i) break; prev = cur; } wdcache[0] = i; } chdir_current = i; chdir_fd = fd; } }
long chdir_do(int a1) { long result; long v2; int v3; int v4; int v5; long i; _QWORD *v7; long v8; result = (unsigned int)chdir_current; if (a1 != chdir_current) { v7 = (_QWORD *)(wd + 24LL * a1); v3 = *((_DWORD *)v7 + 4); if (!v3) { if (*(_BYTE *)*v7 != 47) chdir_do(a1 - 1); v3 = openat(chdir_fd, (const char *)*v7, open_searchdir_flags & 0xFFFDFFFF); if (v3 < 0) open_fatal(*v7); *((_DWORD *)v7 + 4) = v3; if ((unsigned long)wdcache_count > 0xF) { v8 = wd + 24LL * dword_259C; if (close(*(_DWORD *)(v8 + 16))) close_diag(*(_QWORD *)v8); *(_DWORD *)(v8 + 16) = 0; dword_259C = a1; } else { v2 = wdcache_count++; wdcache[v2] = a1; } } if (v3 > 0) { v4 = wdcache[0]; for (i = 1LL; v4 != a1; ++i) { v5 = wdcache[i]; wdcache[i] = v4; if (v5 == a1) break; v4 = v5; } wdcache[0] = a1; } chdir_current = a1; result = (unsigned int)v3; chdir_fd = v3; } return result; }
tar
ida
void mm_log_handler(LogLevel level, int forced, const char *msg, void *ctx) { struct sshbuf *log_msg; struct monitor *mon = (struct monitor *)ctx; int r; size_t len; if (mon->m_log_sendfd == -1) sshfatal("monitor_wrap.c", __func__, 93, 1, SYSLOG_LEVEL_FATAL, ((void *)0), "no log channel"); if ((log_msg = sshbuf_new()) == ((void *)0)) sshfatal("monitor_wrap.c", __func__, 96, 1, SYSLOG_LEVEL_FATAL, ((void *)0), "sshbuf_new failed"); if ((r = sshbuf_put_u32(log_msg, 0)) != 0 || (r = sshbuf_put_u32(log_msg, level)) != 0 || (r = sshbuf_put_u32(log_msg, forced)) != 0 || (r = sshbuf_put_cstring(log_msg, msg)) != 0) sshfatal("monitor_wrap.c", __func__, 102, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "assemble"); if ((len = sshbuf_len(log_msg)) < 4 || len > 0xffffffff) sshfatal("monitor_wrap.c", __func__, 104, 1, SYSLOG_LEVEL_FATAL, ((void *)0), "bad length %zu", len); do { const u_int32_t __v = (len - 4); ((u_char *)(sshbuf_mutable_ptr(log_msg)))[0] = (__v >> 24) & 0xff; ((u_char *)(sshbuf_mutable_ptr(log_msg)))[1] = (__v >> 16) & 0xff; ((u_char *)(sshbuf_mutable_ptr(log_msg)))[2] = (__v >> 8) & 0xff; ((u_char *)(sshbuf_mutable_ptr(log_msg)))[3] = __v & 0xff; } while (0); if (atomicio((ssize_t (*)(int, void *, size_t))write, mon->m_log_sendfd, sshbuf_mutable_ptr(log_msg), len) != len) sshfatal("monitor_wrap.c", __func__, 108, 1, SYSLOG_LEVEL_FATAL, ((void *)0), "write: %s", strerror((*__errno_location()))); sshbuf_free(log_msg); }
void mm_log_handler(undefined4 param_1, undefined4 param_2, undefined8 param_3, long param_4) { undefined4 uVar1; int iVar2; int iVar3; undefined8 uVar4; undefined *puVar5; long lVar6; ulong uVar7; int *piVar8; char *pcVar9; char **ppcVar10; undefined *puVar11; char *apcStack176[4]; ulong uStack144; char *apcStack136[6]; undefined auStack88[8]; long local_50; undefined8 local_48; undefined4 local_40; undefined4 local_3c; int local_38; int local_34; long local_30; long local_28; ulong local_20; ppcVar10 = (char **)auStack88; local_50 = param_4; local_48 = param_3; local_40 = param_2; local_3c = param_1; local_30 = param_4; if (*(int *)(param_4 + 0xc) == -1) { ppcVar10 = apcStack136 + 4; apcStack136[4] = "no log channel"; sshfatal("monitor_wrap.c", "mm_log_handler", 0x5d, 1, 1, 0); } *(undefined8 *)((long)ppcVar10 + -8) = 0x10006e; local_28 = sshbuf_new(); puVar11 = (undefined *)ppcVar10; if (local_28 == 0) { puVar11 = (undefined *)((long)ppcVar10 + -0x10); *(char **)((long)ppcVar10 + -0x10) = "sshbuf_new failed"; *(undefined8 *)((long)ppcVar10 + -0x18) = 0x1000b3; sshfatal("monitor_wrap.c", "mm_log_handler", 0x60, 1, 1, 0); } *(undefined8 *)(puVar11 + -8) = 0x1000c4; local_38 = sshbuf_put_u32(local_28, 0); if (local_38 == 0) { *(undefined8 *)(puVar11 + -8) = 0x1000de; local_38 = sshbuf_put_u32(local_28, local_3c); if (local_38 == 0) { *(undefined8 *)(puVar11 + -8) = 0x1000f8; local_38 = sshbuf_put_u32(local_28, local_40); if (local_38 == 0) { *(undefined8 *)(puVar11 + -8) = 0x100114; local_38 = sshbuf_put_cstring(local_28, local_48); puVar5 = puVar11; if (local_38 == 0) goto LAB_0010015e; } } } *(undefined8 *)(puVar11 + -8) = 0x100127; uVar4 = ssh_err(local_38); puVar5 = puVar11 + -0x10; *(char **)(puVar11 + -0x10) = "assemble"; *(undefined8 *)(puVar11 + -0x18) = 0x10015e; sshfatal("monitor_wrap.c", "mm_log_handler", 0x66, 1, 1, uVar4); LAB_0010015e: *(undefined8 *)(puVar5 + -8) = 0x10016a; local_20 = sshbuf_len(local_28); if ((local_20 < 4) || (puVar11 = puVar5, 0xffffffff < local_20)) { *(ulong *)(puVar5 + -8) = local_20; puVar11 = puVar5 + -0x10; *(char **)(puVar5 + -0x10) = "bad length %zu"; *(undefined8 *)(puVar5 + -0x18) = 0x1001b9; sshfatal("monitor_wrap.c", "mm_log_handler", 0x68, 1, 1, 0); } iVar3 = (int)local_20 + -4; *(undefined8 *)(puVar11 + -8) = 0x1001d7; local_34 = iVar3; puVar5 = (undefined *)sshbuf_mutable_ptr(local_28); iVar2 = local_34; *puVar5 = (char)((uint)iVar3 >> 0x18); *(undefined8 *)(puVar11 + -8) = 0x1001ef; lVar6 = sshbuf_mutable_ptr(local_28); iVar3 = local_34; *(char *)(lVar6 + 1) = (char)((uint)iVar2 >> 0x10); *(undefined8 *)(puVar11 + -8) = 0x10020b; lVar6 = sshbuf_mutable_ptr(local_28); *(char *)(lVar6 + 2) = (char)((uint)iVar3 >> 8); *(undefined8 *)(puVar11 + -8) = 0x10021f; lVar6 = sshbuf_mutable_ptr(local_28); *(char *)(lVar6 + 3) = (char)local_34; *(undefined8 *)(puVar11 + -8) = 0x100234; uVar4 = sshbuf_mutable_ptr(local_28); uVar1 = *(undefined4 *)(local_30 + 0xc); *(undefined8 *)(puVar11 + -8) = 0x100259; uVar7 = atomicio(uRam0000000000100251, uVar1, uVar4, local_20); puVar5 = puVar11; if (local_20 != uVar7) { *(undefined8 *)(puVar11 + -8) = 0x100264; piVar8 = __errno_location(); iVar2 = *piVar8; *(undefined8 *)(puVar11 + -8) = 0x10026d; pcVar9 = strerror(iVar2); *(char **)(puVar11 + -8) = pcVar9; puVar5 = puVar11 + -0x10; *(char **)(puVar11 + -0x10) = "write: %s"; *(undefined8 *)(puVar11 + -0x18) = 0x1002a4; sshfatal("monitor_wrap.c", "mm_log_handler", 0x6c, 1, 1, 0); } *(undefined8 *)(puVar5 + -8) = 0x1002b0; sshbuf_free(local_28); return; }
openssh-portable
ghidra
static int do_depmod(int argc, char *argv[]) { FILE *out = ((void *)0); int err = 0, all = 0, maybe_all = 0, n_config_paths = 0; __attribute__((cleanup(freep))) char *root = ((void *)0); __attribute__((cleanup(freep))) const char **config_paths = ((void *)0); const char *system_map = ((void *)0); const char *module_symvers = ((void *)0); const char *null_kmod_config = ((void *)0); struct utsname un; struct kmod_ctx *ctx = ((void *)0); struct cfg cfg; struct depmod depmod; memset(&cfg, 0, sizeof(cfg)); memset(&depmod, 0, sizeof(depmod)); for (;;) { int c, idx = 0; c = getopt_long(argc, argv, cmdopts_s, cmdopts, &idx); if (c == -1) break; switch (c) { case 'a': all = 1; break; case 'A': maybe_all = 1; break; case 'b': if (root) free(root); root = path_make_absolute_cwd(optarg); break; case 'C': { size_t bytes = sizeof(char *) * (n_config_paths + 2); void *tmp = realloc(config_paths, bytes); if (!tmp) { fputs("Error: out-of-memory\n", stderr); goto cmdline_failed; } config_paths = tmp; config_paths[n_config_paths] = optarg; n_config_paths++; config_paths[n_config_paths] = ((void *)0); break; } case 'E': module_symvers = optarg; cfg.check_symvers = 1; break; case 'F': system_map = optarg; break; case 'e': cfg.print_unknown = 1; break; case 'v': verbose++; break; case 'n': out = stdout; break; case 'P': if (optarg[1] != '\0') { log_printf(2, "-P only takes a single char\n"); goto cmdline_failed; } cfg.sym_prefix = optarg[0]; break; case 'w': cfg.warn_dups = 1; break; case 'u': case 'q': case 'r': case 'm': if (idx > 0) log_printf(4, "Ignored deprecated option --%s\n", cmdopts[idx].name); else log_printf(4, "Ignored deprecated option -%c\n", c); break; case 'h': help(); return 0; case 'V': puts("kmod" " version " "30"); puts("-ZSTD -XZ -ZLIB -LIBCRYPTO -EXPERIMENTAL"); return 0; case '?': goto cmdline_failed; default: log_printf(3, "unexpected getopt_long() value '%c'.\n", c); goto cmdline_failed; } } if (optind < argc) { if (!is_version_number(argv[optind])) { log_printf(3, "Bad version passed %s\n", argv[optind]); goto cmdline_failed; } cfg.kversion = argv[optind]; optind++; } else { if (uname(&un) < 0) { log_printf(2, "uname() failed: %s\n", strerror((*__errno_location()))); goto cmdline_failed; } cfg.kversion = un.release; } cfg.dirnamelen = snprintf(cfg.dirname, 4096, "%s/lib/modules/%s", root == ((void *)0) ? "" : root, cfg.kversion); if (optind == argc) all = 1; if (maybe_all) { if (out == stdout) goto done; if (depfile_up_to_date(cfg.dirname) == 1) goto done; all = 1; } ctx = kmod_new(cfg.dirname, &null_kmod_config); if (ctx == ((void *)0)) { log_printf(2, "kmod_new(\"%s\", {NULL}) failed: %m\n", cfg.dirname); goto cmdline_failed; } log_setup_kmod_log(ctx, verbose); err = depmod_init(&depmod, &cfg, ctx); if (err < 0) { log_printf(2, "depmod_init: %s\n", strerror(-err)); goto depmod_init_failed; } ctx = ((void *)0); if (module_symvers != ((void *)0)) { err = depmod_load_symvers(&depmod, module_symvers); if (err < 0) { log_printf(2, "could not load %s: %s\n", module_symvers, strerror(-err)); goto cmdline_failed; } } else if (system_map != ((void *)0)) { err = depmod_load_system_map(&depmod, system_map); if (err < 0) { log_printf(2, "could not load %s: %s\n", system_map, strerror(-err)); goto cmdline_failed; } } else if (cfg.print_unknown) { log_printf(4, "-e needs -E or -F\n"); cfg.print_unknown = 0; } if (all) { err = cfg_load(&cfg, config_paths); if (err < 0) { log_printf(2, "could not load configuration files\n"); goto cmdline_modules_failed; } err = depmod_modules_search(&depmod); if (err < 0) { log_printf(2, "could not search modules: %s\n", strerror(-err)); goto cmdline_modules_failed; } } else { int i; for (i = optind; i < argc; i++) { const char *path = argv[i]; struct kmod_module *mod; if (path[0] != '/') { log_printf(2, "%s: not absolute path.\n", path); goto cmdline_modules_failed; } err = kmod_module_new_from_path(depmod.ctx, path, &mod); if (err < 0) { log_printf(2, "could not create module %s: %s\n", path, strerror(-err)); goto cmdline_modules_failed; } err = depmod_module_add(&depmod, mod); if (err < 0) { log_printf(2, "could not add module %s: %s\n", path, strerror(-err)); kmod_module_unref(mod); goto cmdline_modules_failed; } } } err = depmod_modules_build_array(&depmod); if (err < 0) { log_printf(2, "could not build module array: %s\n", strerror(-err)); goto cmdline_modules_failed; } depmod_modules_sort(&depmod); err = depmod_load(&depmod); if (err < 0) goto cmdline_modules_failed; err = depmod_output(&depmod, out); done: depmod_shutdown(&depmod); cfg_free(&cfg); return err >= 0 ? 0 : 1; cmdline_modules_failed: depmod_shutdown(&depmod); depmod_init_failed: if (ctx != ((void *)0)) kmod_unref(ctx); cmdline_failed: cfg_free(&cfg); return 1; }
uint do_depmod(int param_1, long param_2) { bool bVar1; bool bVar2; int iVar3; int *piVar4; char *pcVar5; undefined *puVar6; long in_FS_OFFSET; uint local_12a8; int local_129c; int local_1298; undefined *local_1290; void *local_1288; undefined8 local_1280; int local_1278; undefined4 uStack4724; long local_1270; undefined *local_1268; undefined *local_1260; long local_1258; size_t local_1250; void *local_1248; char *local_1240; undefined local_1238[8]; undefined8 local_1230; utsname local_11e8; char *local_1058; char local_1050[4096]; long local_50; undefined local_48; undefined local_47; char local_46; undefined local_45; long local_20; local_20 = *(long *)(in_FS_OFFSET + 0x28); local_1270 = 0; local_12a8 = 0; bVar2 = false; bVar1 = false; local_129c = 0; local_1290 = (undefined *)0x0; local_1288 = (void *)0x0; local_1268 = (undefined *)0x0; local_1260 = (undefined *)0x0; local_1280 = 0; local_1258 = 0; memset(&local_1058, 0, 0x1038); memset(local_1238, 0, 0x48); while (true) { local_1278 = 0; iVar3 = getopt_long(param_1, param_2, cmdopts_s, cmdopts, &local_1278); if (iVar3 == -1) break; switch (iVar3) { case 0x3f: goto LAB_00109905; default: log_printf(3, "unexpected getopt_long() value \'%c\'.\n", iVar3); goto LAB_00109905; case 0x41: bVar1 = true; break; case 0x43: local_1250 = (long)(local_129c + 2) << 3; local_1248 = realloc(local_1288, local_1250); if (local_1248 == (void *)0x0) { fputs("Error: out-of-memory\n", stderr); goto LAB_00109905; } *(undefined **)((long)local_129c * 8 + (long)local_1248) = optarg; local_129c = local_129c + 1; *(undefined8 *)((long)local_1248 + (long)local_129c * 8) = 0; local_1288 = local_1248; break; case 0x45: local_1260 = optarg; local_47 = 1; break; case 0x46: local_1268 = optarg; break; case 0x50: if (optarg[1] != '\0') { log_printf(2, "-P only takes a single char\n"); goto LAB_00109905; } local_48 = *optarg; break; case 0x56: puts("kmod version 30"); puts("-ZSTD -XZ -ZLIB -LIBCRYPTO -EXPERIMENTAL"); local_12a8 = 0; goto LAB_00109919; case 0x61: bVar2 = true; break; case 0x62: if (local_1290 != (undefined *)0x0) { free(local_1290); } local_1290 = (undefined *)path_make_absolute_cwd(); break; case 0x65: local_46 = '\x01'; break; case 0x68: help(); local_12a8 = 0; goto LAB_00109919; case 0x6d: case 0x71: case 0x72: case 0x75: if (local_1278 < 1) { log_printf(4, "Ignored deprecated option -%c\n", iVar3); } else { log_printf(4, "Ignored deprecated option --%s\n", *(undefined8 *)(cmdopts + (long)local_1278 * 0x20)); } break; case 0x6e: local_1270 = stdout; break; case 0x76: verbose = verbose + 1; break; case 0x77: local_45 = 1; } } if (optind < param_1) { iVar3 = is_version_number(*(undefined8 *)(param_2 + (long)optind * 8)); if (iVar3 != 0) { local_1058 = *(char **)(param_2 + (long)optind * 8); optind = optind + 1; goto LAB_00109398; } log_printf(3, "Bad version passed %s\n", *(undefined8 *)(param_2 + (long)optind * 8)); } else { iVar3 = uname(&local_11e8); if (iVar3 < 0) { piVar4 = __errno_location(); pcVar5 = strerror(*piVar4); log_printf(2, "uname() failed: %s\n", pcVar5); } else { local_1058 = local_11e8.release; LAB_00109398: puVar6 = local_1290; if (local_1290 == (undefined *)0x0) { puVar6 = &DAT_001004fd; } iVar3 = snprintf(local_1050, 0x1000, "%s/lib/modules/%s", puVar6, local_1058); local_50 = (long)iVar3; if (param_1 == optind) { bVar2 = true; } if (bVar1) { if ((local_1270 != stdout) && (iVar3 = depfile_up_to_date(local_1050), iVar3 != 1)) { bVar2 = true; goto LAB_00109443; } LAB_001098aa: depmod_shutdown(local_1238); cfg_free(&local_1058); local_12a8 = local_12a8 >> 0x1f; goto LAB_00109919; } LAB_00109443: local_1258 = kmod_new(local_1050, &local_1280); if (local_1258 == 0) { log_printf(2, "kmod_new(\"%s\", {NULL}) failed: %m\n", local_1050); } else { log_setup_kmod_log(local_1258, verbose); iVar3 = depmod_init(local_1238, &local_1058, local_1258); if (iVar3 < 0) { pcVar5 = strerror(-iVar3); log_printf(2, "depmod_init: %s\n", pcVar5); } else { local_1258 = 0; if (local_1260 == (undefined *)0x0) { if (local_1268 == (undefined *)0x0) { if (local_46 != '\0') { log_printf(4, "-e needs -E or -F\n"); local_46 = '\0'; } } else { iVar3 = depmod_load_system_map(local_1238, local_1268); if (iVar3 < 0) { pcVar5 = strerror(-iVar3); log_printf(2, "could not load %s: %s\n", local_1268, pcVar5); goto LAB_00109905; } } } else { iVar3 = depmod_load_symvers(local_1238, local_1260); if (iVar3 < 0) { pcVar5 = strerror(-iVar3); log_printf(2, "could not load %s: %s\n", local_1260, pcVar5); goto LAB_00109905; } } if (bVar2) { iVar3 = cfg_load(&local_1058, local_1288); if (iVar3 < 0) { log_printf(2, "could not load configuration files\n"); } else { iVar3 = depmod_modules_search(); if (-1 < iVar3) goto LAB_00109810; pcVar5 = strerror(-iVar3); log_printf(2, "could not search modules: %s\n", pcVar5); } } else { for (local_1298 = optind; local_1298 < param_1; local_1298 = local_1298 + 1) { local_1240 = *(char **)(param_2 + (long)local_1298 * 8); if (*local_1240 != '/') { log_printf(2, "%s: not absolute path.\n", local_1240); goto LAB_001098d7; } iVar3 = kmod_module_new_from_path(local_1230, local_1240, &local_1278); if (iVar3 < 0) { pcVar5 = strerror(-iVar3); log_printf(2, "could not create module %s: %s\n", local_1240, pcVar5); goto LAB_001098d7; } iVar3 = depmod_module_add(local_1238, CONCAT44(uStack4724, local_1278)); if (iVar3 < 0) { pcVar5 = strerror(-iVar3); log_printf(2, "could not add module %s: %s\n", local_1240, pcVar5); kmod_module_unref(CONCAT44(uStack4724, local_1278)); goto LAB_001098d7; } } LAB_00109810: iVar3 = depmod_modules_build_array(); if (iVar3 < 0) { pcVar5 = strerror(-iVar3); log_printf(2, "could not build module array: %s\n", pcVar5); } else { depmod_modules_sort(local_1238); iVar3 = depmod_load(local_1238); if (-1 < iVar3) { local_12a8 = depmod_output(local_1238, local_1270); goto LAB_001098aa; } } } LAB_001098d7: depmod_shutdown(local_1238); } if (local_1258 != 0) { kmod_unref(local_1258); } } } } LAB_00109905: cfg_free(&local_1058); local_12a8 = 1; LAB_00109919: freep(&local_1288); freep(&local_1290); if (local_20 != *(long *)(in_FS_OFFSET + 0x28)) { __stack_chk_fail(); } return local_12a8; }
kmod
ghidra
void dispose_cond_node(cond) COND_COM *cond; { if (cond) { if (cond->left) dispose_cond_node(cond->left); if (cond->right) dispose_cond_node(cond->right); if (cond->op) dispose_word(cond->op); sh_xfree((cond), "dispose_cmd.c", 222); } }
void dispose_cond_node(unsigned long long a0[5]) { unsigned long long v1; if (a0) { if (a0[3]) dispose_cond_node(a0[3]); if (a0[4]) dispose_cond_node(a0[4]); if (a0[2]) dispose_word(a0[2]); v1 = sh_xfree(a0, "dispose_cmd.c", 0xde); } return; }
bash
angr_dream
SHELL_VAR *find_variable_nameref_for_assignment(name, flags) const char *name; int flags; { SHELL_VAR *var; var = find_variable_last_nameref(name, 1); if (var && ((((var)->attributes) & (0x0000800))) && ((((var)->attributes) & (0x0001000)))) { internal_warning(gettext("%s: removing nameref attribute"), name); ((var)->attributes &= ~(0x0000800)); } if (var && ((((var)->attributes) & (0x0000800)))) { if (valid_nameref_value(((var)->value), 1) == 0) { sh_invalidid(((var)->value) ? ((var)->value) : ""); return ((SHELL_VAR *)(void *)&nameref_invalid_value); } } return (var); }
undefined1 *find_variable_nameref_for_assignment(undefined8 param_1) { int iVar1; undefined1 *puVar2; undefined8 uVar3; puVar2 = (undefined1 *)find_variable_last_nameref(param_1, 1); if (((puVar2 != (undefined1 *)0x0) && ((*(uint *)(puVar2 + 0x28) & 0x800) != 0)) && ((*(uint *)(puVar2 + 0x28) & 0x1000) != 0)) { uVar3 = gettext("%s: removing nameref attribute"); internal_warning(uVar3, param_1); *(uint *)(puVar2 + 0x28) = *(uint *)(puVar2 + 0x28) & 0xfffff7ff; } if (((puVar2 != (undefined1 *)0x0) && ((*(uint *)(puVar2 + 0x28) & 0x800) != 0)) && (iVar1 = valid_nameref_value(*(undefined8 *)(puVar2 + 8), 1), iVar1 == 0)) { if (*(long *)(puVar2 + 8) == 0) { puVar2 = &DAT_0010bcf4; } else { puVar2 = *(undefined1 **)(puVar2 + 8); } sh_invalidid(puVar2); puVar2 = nameref_invalid_value; } return puVar2; }
bash
ghidra
static void print_login(const STRUCT_UTMP *utmp_ent) { char *comment = make_id_equals_comment(utmp_ent); char pidstr[(((((sizeof(utmp_ent->ut_pid) * 8) - (!((__typeof__(utmp_ent->ut_pid))0 < (__typeof__(utmp_ent->ut_pid))-1))) * 146 + 484) / 485) + (!((__typeof__(utmp_ent->ut_pid))0 < (__typeof__(utmp_ent->ut_pid))-1))) + 1]; sprintf(pidstr, "%ld", (long int)(utmp_ent->ut_pid)); print_line(-1, gettext("LOGIN"), ' ', sizeof utmp_ent->ut_line, utmp_ent->ut_line, time_string(utmp_ent), "", pidstr, comment, ""); free(comment); }
void print_login(struct_0 *a0) { unsigned long v0; char v1; char v2; unsigned long long *v4; unsigned long long v5; v0 = make_id_equals_comment(a0); sprintf(&v1, "%ld", a0->field_4); print_line(0xffffffff, gettext("LOGIN"), 0x20, 0x20, a0 + 1, time_string(a0), &g_401de3, &v1, v0, &g_401de3); free(v0); v5 = *(&v2) ^ v4[5]; return; }
coreutils
angr_sailr
int rl_vi_editing_mode(int count, int key) { _rl_set_insert_mode(1, 1); rl_editing_mode = 0; rl_vi_insert_mode(1, key); return 0; }
undefined8 rl_vi_editing_mode(undefined8 param_1, undefined4 param_2) { _rl_set_insert_mode(1, 1); rl_editing_mode = 0; rl_vi_insert_mode(1, param_2); return 0; }
bash
ghidra
char *oneline(const char *file) { FILE *fp; char *ret = (char *)0, *nl; size_t len = 0; if ((fp = fopen(file, "re")) == (FILE *)0) goto err; if (getline(&ret, &len, fp) < 0) goto out; if (len) ret[len - 1] = '\0'; if ((nl = strchr(ret, '\n'))) *nl = '\0'; out: fclose(fp); err: return ret; }
char *oneline(char *param_1) { __ssize_t _Var1; long in_FS_OFFSET; char *local_30; size_t local_28; FILE *local_20; char *local_18; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); local_30 = (char *)0x0; local_28 = 0; local_20 = fopen(param_1, "re"); if (local_20 != (FILE *)0x0) { _Var1 = getline(&local_30, &local_28, local_20); if (-1 < _Var1) { if (local_28 != 0) { local_30[local_28 - 1] = '\0'; } local_18 = strchr(local_30, 10); if (local_18 != (char *)0x0) { *local_18 = '\0'; } } fclose(local_20); } if (local_10 == *(long *)(in_FS_OFFSET + 0x28)) { return local_30; } __stack_chk_fail(); }
sysvinit
ghidra
int list_length(list) GENERIC_LIST *list; { register int i; for (i = 0; list; list = list->next, i++) ; return (i); }
int list_length(undefined8 *param_1) { int iVar1; undefined8 *local_18; iVar1 = 0; for (local_18 = param_1; local_18 != (undefined8 *)0x0; local_18 = (undefined8 *)*local_18) { iVar1 = iVar1 + 1; } return iVar1; }
bash
ghidra
int strunvis(char *dst, const char *src) { return strnunvisx(dst, (size_t)~0, src, 0); }
long strunvis(_BYTE *a1, char *a2) { return strnunvisx(a1, -1LL, a2, 0); }
libedit
ida
int unbind_array_element(var, sub, flags) SHELL_VAR *var; char *sub; int flags; { arrayind_t ind; char *akey; ARRAY_ELEMENT *ae; if (((sub[0]) == '@' || (sub[0]) == '*') && sub[1] == 0) { if (((((var)->attributes) & (0x0000004))) || ((((var)->attributes) & (0x0000040)))) { if (flags & 0x004) { unbind_variable(var->name); return (0); } } else return -2; } if (((((var)->attributes) & (0x0000040)))) { akey = (flags & 0x001) ? sub : expand_subscript_string(sub, 0); if (akey == 0 || *akey == 0) { builtin_error("[%s]: %s", sub, gettext(bash_badsub_errmsg)); do { if (akey) sh_xfree((akey), "arrayfunc.c", 1149); } while (0); return -1; } assoc_remove((HASH_TABLE *)((var)->value), akey); if (akey != sub) sh_xfree((akey), "arrayfunc.c", 1154); } else if (((((var)->attributes) & (0x0000004)))) { if (((sub[0]) == '@' || (sub[0]) == '*') && sub[1] == 0) { if (shell_compatibility_level <= 51) { unbind_variable(((var)->name)); return 0; } else { array_flush((ARRAY *)((var)->value)); return 0; } } ind = array_expand_index(var, sub, strlen(sub) + 1, 0); if (ind < 0) ind = (((ARRAY *)((var)->value))->max_index) + 1 + ind; if (ind < 0) { builtin_error("[%s]: %s", sub, gettext(bash_badsub_errmsg)); return -1; } ae = array_remove((ARRAY *)((var)->value), ind); if (ae) array_dispose_element(ae); } else { akey = this_command_name; ind = array_expand_index(var, sub, strlen(sub) + 1, 0); this_command_name = akey; if (ind == 0) { unbind_variable(var->name); return (0); } else return -2; } return 0; }
long long unbind_array_element(struct_0 *a0, char a1[2], unsigned long a2) { unsigned long long v0; char v1[2]; unsigned long long v2; unsigned long long v4; char v5[2]; if ((a1[0] == 64 || a1[0] == 42) && !a1[1]) { if (!(a0->field_28 & 4) && !(a0->field_28 & 64)) v4 = 4294967294; if (((a0->field_28 & 4) || (a0->field_28 & 64)) && (a2 & 4)) { unbind_variable(a0->field_0); v4 = 0; } } if (a1[1] || !(a2 & 4) && (a0->field_28 & 4) || !(a2 & 4) && (a0->field_28 & 64) || a1[0] != 64 && a1[0] != 42) { if ((a0->field_28 & 64)) { if (!(a2 & 1)) *(&v5) = expand_subscript_string(a1, 0x0); else v5 = a1; *(&v1) = v5; if (v1 && v1[0]) { assoc_remove(a0->field_8, v1, v1); if (v1 != a1) sh_xfree(v1, "arrayfunc.c", 0x482); } if (!v1[0] || !v1) { builtin_error("[%s]: %s", a1, gettext("bad array subscript")); if (v1) sh_xfree(v1, "arrayfunc.c", 0x47d); v4 = 4294967295; } } else if ((a0->field_28 & 4)) { if ((a1[0] == 42 || a1[0] == 64) && !a1[1]) { if (shell_compatibility_level <= 51) { unbind_variable(a0->field_0); v4 = 0; } else { array_flush(a0->field_8); v4 = 0; } } if (a1[1] || a1[0] != 42 && a1[0] != 64) { v0 = array_expand_index(a0, a1, strlen(a1) + 1, 0x0); if ((v0 - 0 >> 63)) v0 += a0->field_8->field_0 + 1; if ((v0 - 0 >> 63)) { builtin_error("[%s]: %s", a1, gettext("bad array subscript")); v4 = 4294967295; } else { v2 = array_remove(a0->field_8, v0, v0); if (v2) array_dispose_element(v2); } } } else { v1 = this_command_name; v0 = array_expand_index(a0, a1, strlen(a1) + 1, 0x0); this_command_name = v1; if (!v0) { unbind_variable(a0->field_0); v4 = 0; } else { v4 = 4294967294; } } if ((!(a0->field_28 & 64) || v1[0]) && (!(a0->field_28 & 64) || v1) && ((a0->field_28 & 4) || (a0->field_28 & 64)) && (!((v0 - 0 >> 63)) || (a0->field_28 & 64)) && (a1[0] != 42 || (a0->field_28 & 64) || a1[1]) && (a1[0] != 64 || (a0->field_28 & 64) || a1[1])) v4 = 0; } return v4; }
bash
angr_dream
int parse_user_host_path(const char *s, char **userp, char **hostp, char **pathp) { char *user = ((void *)0), *host = ((void *)0), *path = ((void *)0); char *sdup, *tmp; int ret = -1; if (userp != ((void *)0)) *userp = ((void *)0); if (hostp != ((void *)0)) *hostp = ((void *)0); if (pathp != ((void *)0)) *pathp = ((void *)0); sdup = xstrdup(s); if ((tmp = colon(sdup)) == ((void *)0)) goto out; *tmp++ = '\0'; if (*tmp == '\0') tmp = "."; path = xstrdup(tmp); tmp = strrchr(sdup, '@'); if (tmp != ((void *)0)) { *tmp++ = '\0'; host = xstrdup(cleanhostname(tmp)); if (*sdup != '\0') user = xstrdup(sdup); } else { host = xstrdup(cleanhostname(sdup)); user = ((void *)0); } if (userp != ((void *)0)) { *userp = user; user = ((void *)0); } if (hostp != ((void *)0)) { *hostp = host; host = ((void *)0); } if (pathp != ((void *)0)) { *pathp = path; path = ((void *)0); } ret = 0; out: free(sdup); free(user); free(host); free(path); return ret; }
long long parse_user_host_path(unsigned long long a0, unsigned long long *a1, unsigned long long *a2, unsigned long long *a3) { unsigned int v0; int tmp_11; int tmp_9; void *v1; void *v2; void *v3; unsigned long long v4; char *v5; v1 = 0; v2 = 0; v3 = 0; v0 = -1; if (a1) *(a1) = 0; if (a2) *(a2) = 0; if (a3) *(a3) = 0; v5 = xstrdup(a0); v4 = colon(v5); if (v4) { tmp_11 = v4; v4 += 1; *(tmp_11) = 0; if (!*(v4)) v4 = "."; v3 = xstrdup(v4); v4 = strrchr(v5, 0x40); if (v4) { tmp_9 = v4; v4 += 1; *(tmp_9) = 0; v2 = xstrdup(cleanhostname(v4)); if (*(v5)) v1 = xstrdup(v5); } else { v2 = xstrdup(cleanhostname(v5)); v1 = 0; } if (a1) { *(a1) = v1; v1 = 0; } if (a2) { *(a2) = v2; v2 = 0; } if (a3) { *(a3) = v3; v3 = 0; } v0 = 0; } free(v5); free(v1); free(v2); free(v3); return v0; }
openssh-portable
angr_dream
static void handle_update_read(int handle, ssize_t bytes) { if (handle_is_ok(handle, HANDLE_FILE) && bytes > 0) handles[handle].bytes_read += bytes; }
void handle_update_read(int param_1, long param_2) { int iVar1; iVar1 = handle_is_ok(param_1, 2); if ((iVar1 != 0) && (0 < param_2)) { *(long *)((long)param_1 * 0x38 + handles + 0x20) = *(long *)((long)param_1 * 0x38 + handles + 0x20) + param_2; } return; }
openssh-portable
ghidra
static int xdp_delete(struct xdp_req *xdp) { xdp_ebpf_cb(xdp, -1, ((void *)0)); return 0; }
void xdp_delete(void *a0) { void *v1; xdp_ebpf_cb(a0, 0xffffffff, 0x0); v1 = 0; return; }
iproute2-6.0.0
angr_dream
int channel_input_ieof(int type, u_int32_t seq, struct ssh *ssh) { Channel *c = channel_from_packet_id(ssh, __func__, "ieof"); int r; if ((r = sshpkt_get_end(ssh)) != 0) { sshlog("channels.c", __func__, 3322, 1, SYSLOG_LEVEL_ERROR, ssh_err(r), "parse data"); ssh_packet_disconnect(ssh, "Invalid ieof message"); } if (channel_proxy_upstream(c, type, seq, ssh)) return 0; chan_rcvd_ieof(ssh, c); if (c->force_drain && c->istate == 0) { sshlog("channels.c", __func__, 3332, 0, SYSLOG_LEVEL_DEBUG1, ((void *)0), "channel %d: FORCE input drain", c->self); c->istate = 1; if (sshbuf_len(c->input) == 0) chan_ibuf_empty(ssh, c); } return 0; }
long channel_input_ieof(unsigned int a1, unsigned int a2, long a3) { long v3; unsigned int end; unsigned int *v7; v7 = channel_from_packet_id(a3, "channel_input_ieof", "ieof"); end = sshpkt_get_end(a3); if (end) { v3 = ssh_err(end); sshlog("channels.c", "channel_input_ieof", 3322LL, 1LL, 2LL, v3, "parse data"); ssh_packet_disconnect(a3, "Invalid ieof message"); } if ((unsigned int)channel_proxy_upstream((long)v7, a1, a2, a3)) return 0LL; chan_rcvd_ieof(a3, v7); if (v7[20] && !v7[4]) { sshlog("channels.c", "channel_input_ieof", 3332LL, 0LL, 5LL, 0LL, "channel %d: FORCE input drain", v7[1]); v7[4] = 1; if (!sshbuf_len(*((_QWORD *)v7 + 13))) chan_ibuf_empty(a3, v7); } return 0LL; }
openssh-portable
ida
int main(int argc, char **argv) { int c; char *userspec = ((void *)0); char const *username = ((void *)0); char const *groups = ((void *)0); _Bool skip_chdir = 0; uid_t uid = -1; gid_t gid = -1; gid_t *out_gids = ((void *)0); size_t n_gids = 0; ; set_program_name(argv[0]); setlocale(6, ""); bindtextdomain("coreutils", "/usr/local/share/locale"); textdomain("coreutils"); initialize_exit_failure(EXIT_CANCELED); atexit(close_stdout); while ((c = getopt_long(argc, argv, "+", long_opts, ((void *)0))) != -1) { switch (c) { case USERSPEC: { userspec = optarg; size_t userlen = strlen(userspec); if (userlen && userspec[userlen - 1] == ':') userspec[userlen - 1] = '\0'; break; } case GROUPS: groups = optarg; break; case SKIP_CHDIR: skip_chdir = 1; break; case GETOPT_HELP_CHAR: usage(0); break; ; case GETOPT_VERSION_CHAR: version_etc(stdout, "chroot", "GNU coreutils", Version, ("Roland McGrath"), (char *)((void *)0)); exit(0); break; ; default: usage(EXIT_CANCELED); } } if (argc <= optind) { error(0, 0, gettext("missing operand")); usage(EXIT_CANCELED); } char const *newroot = argv[optind]; _Bool is_oldroot = is_root(newroot); if (!is_oldroot && skip_chdir) { error(0, 0, gettext("option --skip-chdir only permitted if NEWROOT is old %s"), quotearg_style(shell_escape_always_quoting_style, "/")); usage(EXIT_CANCELED); } if (!is_oldroot) { if (userspec) (__extension__({ __typeof__(parse_user_spec(userspec, &uid, &gid, ((void *)0), ((void *)0))) __x = (parse_user_spec(userspec, &uid, &gid, ((void *)0), ((void *)0))); (void)__x; })); if ((!uid_unset(uid)) && (!groups || gid_unset(gid))) { const struct passwd *pwd; if ((pwd = getpwuid(uid))) { if (gid_unset(gid)) gid = pwd->pw_gid; username = pwd->pw_name; } } if (groups && *groups) (__extension__({ __typeof__(parse_additional_groups(groups, &out_gids, &n_gids, 0)) __x = (parse_additional_groups(groups, &out_gids, &n_gids, 0)); (void)__x; })); else if (!groups && (!gid_unset(gid)) && username) { int ngroups = xgetgroups(username, gid, &out_gids); if (0 < ngroups) n_gids = ngroups; } } if (chroot(newroot) != 0) ((!!sizeof(struct { _Static_assert( EXIT_CANCELED, "verify_expr (" "EXIT_CANCELED" ", " "(error (EXIT_CANCELED, (*__errno_location ()), gettext (\"cannot " "change root directory to %s\"), quotearg_style " "(shell_escape_always_quoting_style, newroot)), assume (false))" ")"); int _gl_dummy; })) ? ((error(EXIT_CANCELED, (*__errno_location()), gettext("cannot change root directory to %s"), quotearg_style(shell_escape_always_quoting_style, newroot)), ((0) ? (void)0 : __builtin_unreachable()))) : ((error(EXIT_CANCELED, (*__errno_location()), gettext("cannot change root directory to %s"), quotearg_style(shell_escape_always_quoting_style, newroot)), ((0) ? (void)0 : __builtin_unreachable())))); if (!skip_chdir && chdir("/")) ((!!sizeof(struct { _Static_assert(EXIT_CANCELED, "verify_expr (" "EXIT_CANCELED" ", " "(error (EXIT_CANCELED, (*__errno_location ()), gettext " "(\"cannot chdir to root directory\")), assume (false))" ")"); int _gl_dummy; })) ? ((error(EXIT_CANCELED, (*__errno_location()), gettext("cannot chdir to root directory")), ((0) ? (void)0 : __builtin_unreachable()))) : ((error(EXIT_CANCELED, (*__errno_location()), gettext("cannot chdir to root directory")), ((0) ? (void)0 : __builtin_unreachable())))); if (argc == optind + 1) { char *shell = getenv("SHELL"); if (shell == ((void *)0)) shell = bad_cast("/bin/sh"); argv[0] = shell; argv[1] = bad_cast("-i"); argv[2] = ((void *)0); } else { argv += optind + 1; } if (userspec) { _Bool warn; char const *err = parse_user_spec_warn(userspec, &uid, &gid, ((void *)0), ((void *)0), &warn); if (err) error(warn ? 0 : EXIT_CANCELED, 0, "%s", (err)); } if ((!uid_unset(uid)) && (!groups || gid_unset(gid))) { const struct passwd *pwd; if ((pwd = getpwuid(uid))) { if (gid_unset(gid)) gid = pwd->pw_gid; username = pwd->pw_name; } else if (gid_unset(gid)) { ((!!sizeof(struct { _Static_assert(EXIT_CANCELED, "verify_expr (" "EXIT_CANCELED" ", " "(error (EXIT_CANCELED, (*__errno_location ()), gettext " "(\"no group specified for unknown uid: %d\"), (int) " "uid), assume (false))" ")"); int _gl_dummy; })) ? ((error(EXIT_CANCELED, (*__errno_location()), gettext("no group specified for unknown uid: %d"), (int)uid), ((0) ? (void)0 : __builtin_unreachable()))) : ((error(EXIT_CANCELED, (*__errno_location()), gettext("no group specified for unknown uid: %d"), (int)uid), ((0) ? (void)0 : __builtin_unreachable())))); } } gid_t *gids = out_gids; gid_t *in_gids = ((void *)0); if (groups && *groups) { if (parse_additional_groups(groups, &in_gids, &n_gids, !n_gids) != 0) { if (!n_gids) return EXIT_CANCELED; } else gids = in_gids; } else if (!groups && (!gid_unset(gid)) && username) { int ngroups = xgetgroups(username, gid, &in_gids); if (ngroups <= 0) { if (!n_gids) ((!!sizeof(struct { _Static_assert( EXIT_CANCELED, "verify_expr (" "EXIT_CANCELED" ", " "(error (EXIT_CANCELED, (*__errno_location ()), gettext " "(\"failed to get supplemental groups\")), assume (false))" ")"); int _gl_dummy; })) ? ((error(EXIT_CANCELED, (*__errno_location()), gettext("failed to get supplemental groups")), ((0) ? (void)0 : __builtin_unreachable()))) : ((error(EXIT_CANCELED, (*__errno_location()), gettext("failed to get supplemental groups")), ((0) ? (void)0 : __builtin_unreachable())))); } else { n_gids = ngroups; gids = in_gids; } } if (((!uid_unset(uid)) || groups) && setgroups(n_gids, gids) != 0) ((!!sizeof(struct { _Static_assert(EXIT_CANCELED, "verify_expr (" "EXIT_CANCELED" ", " "(error (EXIT_CANCELED, (*__errno_location ()), gettext " "(\"failed to set supplemental groups\")), assume (false))" ")"); int _gl_dummy; })) ? ((error(EXIT_CANCELED, (*__errno_location()), gettext("failed to set supplemental groups")), ((0) ? (void)0 : __builtin_unreachable()))) : ((error(EXIT_CANCELED, (*__errno_location()), gettext("failed to set supplemental groups")), ((0) ? (void)0 : __builtin_unreachable())))); free(in_gids); free(out_gids); if ((!gid_unset(gid)) && setgid(gid)) ((!!sizeof(struct { _Static_assert(EXIT_CANCELED, "verify_expr (" "EXIT_CANCELED" ", " "(error (EXIT_CANCELED, (*__errno_location ()), gettext " "(\"failed to set group-ID\")), assume (false))" ")"); int _gl_dummy; })) ? ((error(EXIT_CANCELED, (*__errno_location()), gettext("failed to set group-ID")), ((0) ? (void)0 : __builtin_unreachable()))) : ((error(EXIT_CANCELED, (*__errno_location()), gettext("failed to set group-ID")), ((0) ? (void)0 : __builtin_unreachable())))); if ((!uid_unset(uid)) && setuid(uid)) ((!!sizeof(struct { _Static_assert(EXIT_CANCELED, "verify_expr (" "EXIT_CANCELED" ", " "(error (EXIT_CANCELED, (*__errno_location ()), gettext " "(\"failed to set user-ID\")), assume (false))" ")"); int _gl_dummy; })) ? ((error(EXIT_CANCELED, (*__errno_location()), gettext("failed to set user-ID")), ((0) ? (void)0 : __builtin_unreachable()))) : ((error(EXIT_CANCELED, (*__errno_location()), gettext("failed to set user-ID")), ((0) ? (void)0 : __builtin_unreachable())))); execvp(argv[0], argv); int exit_status = (*__errno_location()) == 2 ? EXIT_ENOENT : EXIT_CANNOT_INVOKE; error(0, (*__errno_location()), gettext("failed to run command %s"), quote(argv[0])); return exit_status; }
int main(unsigned long a0, unsigned long a1) { unsigned long long v0[3]; char v1; char v2; unsigned int v3; unsigned int v4; unsigned int v5; unsigned int v6; unsigned int v7; unsigned int v8; unsigned long long v9; void *v10; void *v11; char v12; void *v13; void *v14; void *v15; unsigned long v16; void *v17; char *v18; unsigned long v19; struct_0 *v20; unsigned long v21; struct_0 *v22; unsigned long v23; unsigned long long v25; unsigned long v26; unsigned long long v27; unsigned int v28; unsigned int v29; unsigned long long v30; v0[0] = a1; v13 = 0; v14 = 0; v15 = 0; v1 = 0; v3 = -1; v4 = -1; v10 = 0; v11 = 0; set_program_name(v0[0]); setlocale(0x6, &g_4011db); bindtextdomain("coreutils", "/usr/local/share/locale"); textdomain("coreutils"); initialize_exit_failure(0x7d); atexit(got.close_stdout); while (true) { v5 = getopt_long(a0, v0, "+", &long_opts, NULL); if (v5 != -1) { if (v5 != 258) { if (v5 <= 258) { if (v5 == 257) { v13 = *(&optarg); v23 = strlen(v13); if (!v23) continue; if (*(-1 + v13 + v23) != 58) continue; *(-1 + v13 + v23) = 0; continue; } else if (v5 <= 257) { if (v5 == 0x100) { v15 = *(&optarg); continue; } else if (v5 <= 0x100) { if (v5 == -131) { version_etc(stdout, "chroot", "GNU coreutils", Version, "Roland McGrath", 0x0); exit(0x0); } if (v5 == -130) usage(0x0); } } } if (v5 > 258 || v5 != 257 && v5 > 257 || v5 != 0x100 && v5 != 257 && v5 > 0x100 || v5 != 0x100 && v5 != -131 && v5 != 257 && v5 != -130) usage(0x7d); } else { v1 = 1; } } else { if (a0 <= optind) { error(0x0, 0x0, gettext("missing operand")); usage(0x7d); } v18 = v0[optind]; v2 = is_root(v18); if ((v2 ^ 1) && v1) { v25 = quotearg_style(0x4, "/"); error( 0x0, 0x0, gettext("option --skip-chdir only permitted if NEWROOT is old %s")); usage(0x7d); } if (!v1 || !(v2 ^ 1)) { if (!(v2 ^ 1)) break; if ((v2 ^ 1)) { if (v13) v19 = parse_user_spec(v13, &v3, &v4, 0x0, 0x0); v26 = uid_unset(v3) ^ 1; if (v26) { if (v15) v26 = gid_unset(v4); if (!v15 || v26) { v20 = &getpwuid(v3)->pw_name; if (v20) { v26 = gid_unset(v4); if (v26) v4 = v20->field_14; v14 = v20->field_0; } } } if (v15 && *(v15)) { v6 = parse_additional_groups(v15, &v10, &v11, 0x0); break; } if (!*(v15) || !v15) { if (v15) break; if (!v15) { *(&v26) = gid_unset(v4) ^ 1; if (!v26) break; if (v26) { if (!v14) break; if (v14) { v7 = xgetgroups(v14, v4, &v10, v4); if (v7 <= 0) break; if (v7 > 0) { v11 = v7; break; } } } } } } } } } v29 = chroot(v18); if (v29) { v27 = quotearg_style(0x4, v18); error(0x7d, *(__errno_location()), gettext("cannot change root directory to %s")); } if ((v1 ^ 1)) { v29 = chdir("/"); if (v29) error(0x7d, *(__errno_location()), gettext("cannot chdir to root directory")); } if (!v29 || !(v1 ^ 1)) { if (a0 == optind + 1) { v16 = getenv("SHELL"); if (!v16) v16 = bad_cast("/bin/sh"); v0[0] = v16; v0[1] = bad_cast("-i"); v0[2] = 0; } else { v0[0] = &v0[1 + optind]; } if (v13) { v21 = parse_user_spec_warn(v13, &v3, &v4, 0x0, 0x0, &v12); if (v21) { if (v12) v28 = 0; else v28 = 125; error(v28, 0x0, "%s"); } } *(&v29) = uid_unset(v3) ^ 1; if (v29) { if (v15) v29 = gid_unset(v4); if (!v15 || v29) { v22 = &getpwuid(v3)->pw_name; if (v22) { v29 = gid_unset(v4); if (v29) v4 = v22->field_14; v14 = v22->field_0; } else { v29 = gid_unset(v4); if (v29) error(0x7d, *(__errno_location()), gettext("no group specified for unknown uid: %d")); } } } if (!v29 || !v29 || v22 || !v29 && v15) { v17 = v10; v12 = 0; if (!v15) { *(&v29) = gid_unset(v4) ^ 1; if (v29 && v14) { v8 = xgetgroups(v14, v4, &v12, v4); if (v8 <= 0) { if (!v11) error(0x7d, *(__errno_location()), gettext("failed to get supplemental groups")); } else { v11 = v8; v17 = v12; } } } else if (*(v15)) { v29 = parse_additional_groups(v15, &v12, &v11, !v11); if (!v29) { v17 = v12; } else if (!v11) { v29 = 125; } } if (v11 || !v14 && !v15 || !v29 && !v15 || !*(v15) && v15 || !v29 && v15 || !v15 && v8 > 0) *(&v29) = uid_unset(v3) ^ 1; if (!*(v15) && v15 || !v29 && v15 || v29 && v11 || v15 && v11 || !v14 && !v15 && v29 || !v29 && !v15 && v29 || !v15 && v29 && v8 > 0) { v29 = setgroups(v11, v17); if (v29) error(0x7d, *(__errno_location()), gettext("failed to set supplemental groups")); } if ((!*(v15) && v15 || !v29 && v15 || v29 && v11 || v15 && v11 || !v14 && !v15 && v29 || !v29 && !v15 && v29 || !v15 && v29 && v8 > 0) && !v29 || !v29 && (!*(v15) || !v29 || !v15 || v11) && (!v14 || !v29 || v15 || v11 || v8 > 0) && !v15) { free(v12); free(v10); *(&v29) = gid_unset(v4) ^ 1; if (v29) { v29 = setgid(v4); if (v29) error(0x7d, *(__errno_location()), gettext("failed to set group-ID")); } } if (((!*(v15) && v15 || !v29 && v15 || v29 && v11 || v15 && v11 || !v14 && !v15 && v29 || !v29 && !v15 && v29 || !v15 && v29 && v8 > 0) && !v29 || !v29 && (!*(v15) || !v29 || !v15 || v11) && (!v14 || !v29 || v15 || v11 || v8 > 0) && !v15) && v29 && !v29 || ((!*(v15) && v15 || !v29 && v15 || v29 && v11 || v15 && v11 || !v14 && !v15 && v29 || !v29 && !v15 && v29 || !v15 && v29 && v8 > 0) && !v29 || !v29 && (!*(v15) || !v29 || !v15 || v11) && (!v14 || !v29 || v15 || v11 || v8 > 0) && !v15) && !v29) { *(&v29) = uid_unset(v3) ^ 1; if (v29) { v29 = setuid(v3); if (v29) error(0x7d, *(__errno_location()), gettext("failed to set user-ID")); } } if (...) { execvp(v0[0], v0); v29 = *(__errno_location()); if (v29 == 2) v29 = 127; else v29 = 126; *(&v9) = v29; v30 = quote(v0[0]); error(0x0, *(__errno_location()), gettext("failed to run command %s")); v29 = v9; } if (...) return v29; } } }
coreutils
angr_dream