input
stringlengths
26
172k
output
stringlengths
18
318k
repo_name
stringclasses
23 values
decompiler
stringclasses
5 values
static void read_incr_db_2(void) { struct obstack stk; char offbuf[((((((sizeof(off_t) * 8) - (!((__typeof__(off_t))0 < (__typeof__(off_t))-1))) * 146 + 484) / 485) + (!((__typeof__(off_t))0 < (__typeof__(off_t))-1))) + 1)]; _obstack_begin((&stk), 0, 0, (xmalloc), (free)); read_timespec(listed_incremental_stream, &newer_mtime_option); for (;;) { intmax_t i; struct timespec mtime; dev_t dev; ino_t ino; _Bool nfs; char *name; char *content; size_t s; if (!read_num(listed_incremental_stream, "nfs", 0, 1, &i)) return; nfs = i; read_timespec(listed_incremental_stream, &mtime); if (!read_num( listed_incremental_stream, "dev", ((dev_t) ~( (dev_t)(!(!((dev_t)0 < (dev_t)-1)) ? (dev_t)-1 : ((((dev_t)1 << ((sizeof(dev_t) * 8) - 2)) - 1) * 2 + 1)))), ((dev_t)(!(!((dev_t)0 < (dev_t)-1)) ? (dev_t)-1 : ((((dev_t)1 << ((sizeof(dev_t) * 8) - 2)) - 1) * 2 + 1))), &i)) break; dev = i; if (!read_num( listed_incremental_stream, "ino", ((ino_t) ~( (ino_t)(!(!((ino_t)0 < (ino_t)-1)) ? (ino_t)-1 : ((((ino_t)1 << ((sizeof(ino_t) * 8) - 2)) - 1) * 2 + 1)))), ((ino_t)(!(!((ino_t)0 < (ino_t)-1)) ? (ino_t)-1 : ((((ino_t)1 << ((sizeof(ino_t) * 8) - 2)) - 1) * 2 + 1))), &i)) break; ino = i; if (read_obstack(listed_incremental_stream, &stk, &s)) break; name = __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; }); while (read_obstack(listed_incremental_stream, &stk, &s) == 0 && s > 1) ; if (getc_unlocked(listed_incremental_stream) != 0) do { if (error_hook) error_hook(); error(0, 0, gettext("%s: byte %s: %s"), quotearg_colon(listed_incremental_option), offtostr(ftello(listed_incremental_stream), offbuf), gettext("Missing record terminator")); fatal_exit(); } while (0) ; content = __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; }); note_directory(name, mtime, dev, ino, nfs, 0, content); __extension__({ struct obstack *__o = (&stk); void *__obj = (void *)(content); if (__obj > (void *)__o->chunk && __obj < (void *)__o->chunk_limit) __o->next_free = __o->object_base = (char *)__obj; else _obstack_free(__o, __obj); }); } do { if (error_hook) error_hook(); error(0, 0, "%s: %s", quotearg_colon(listed_incremental_option), gettext("Unexpected EOF in snapshot file")); fatal_exit(); } while (0) ; }
void read_incr_db_2(unsigned int a0, unsigned int a1, unsigned long long a2, unsigned int a3, unsigned int a4, unsigned long long a5) { char v0; char v1; char v2; unsigned long long v3; unsigned long long v4; struct_0 *v5; char *v6; char *v7; struct_0 *v8; void *v9; void *v10; unsigned long long v11[5]; void *v12; char v13; char v14; char v15; char v16; char v17; unsigned long long v23; unsigned long long *v28; unsigned long long v29; _obstack_begin(&v15, 0x0, 0x0, got.xmalloc, got.free); read_timespec(listed_incremental_stream, &newer_mtime_option, 0x0, a3, a4, a5); while (true) { if ((read_num(listed_incremental_stream, 0x404e3d, 0x0, 0x1, &v1) ^ 1)) break; v0 = *(&v1); read_timespec(listed_incremental_stream, &v13, &v13, 0x1, &v1, v0); if ((read_num(listed_incremental_stream, 0x404e41, 0x0, 0xffffffffffffffff, &v1) ^ 1)) { LABEL_403664: if (error_hook) *(5243072)(); a1 = 0; error(0x0, 0x0, "%s: %s"); fatal_exit(0x0, a1, "%s: %s", quotearg_colon(listed_incremental_option), gettext("Unexpected EOF in snapshot file"), v0); break; } else { v3 = *(&v1); if (!(!(read_num(listed_incremental_stream, 0x404e45, 0x0, 0xffffffffffffffff, &v1) ^ 1))) goto LABEL_403664; v4 = *(&v1); if (!(!read_obstack(listed_incremental_stream, &v15, &v2))) goto LABEL_403664; v5 = &v15; v6 = v5->field_10; if (v6 == v5->field_18) v5->field_50 = v5->field_50 | 2; v5->field_18 = !(v5->field_30) & v5->field_18 + v5->field_30; if (v5->field_18 - v5->field_8 > v5->field_20 - v5->field_8) v5->field_18 = v5->field_20; v5->field_10 = v5->field_18; v7 = v6; while (true) { if (read_obstack(listed_incremental_stream, &v15, &v2)) break; if (*(&v2) <= 1) break; } if (getc_unlocked(listed_incremental_stream)) { if (error_hook) *(5243072)(); v23 = ftello(listed_incremental_stream); a1 = 0; error(0x0, 0x0, gettext("%s: byte %s: %s")); fatal_exit(0x0, a1, a2, quotearg_colon(listed_incremental_option), offtostr(v23, &v16, v23), gettext("Missing record terminator")); } v8 = &v15; v9 = v8->field_10; if (v9 == v8->field_18) v8->field_50 = v8->field_50 | 2; v8->field_18 = !(v8->field_30) & v8->field_18 + v8->field_30; if (v8->field_18 - v8->field_8 > v8->field_20 - v8->field_8) v8->field_18 = v8->field_20; v8->field_10 = v8->field_18; v10 = v9; note_directory(v7, *(&v13), *(&v14), v3, v4, v0, 0x0, v10); v11[0] = &v15; v12 = v10; if (v12 > v11[1] && v12 < v11[4]) { v11[2] = v12; v11[3] = v11[2]; goto LABEL_403658; } _obstack_free(v11, v12); LABEL_403658: } } v29 = *(&v17) ^ v28[5]; return; }
tar
angr_phoenix
errcode_t e2fsck_allocate_block_bitmap(ext2_filsys fs, const char *descr, int deftype, const char *name, ext2fs_block_bitmap *ret) { errcode_t retval; unsigned int save_type; e2fsck_set_bitmap_type(fs, deftype, name, &save_type); retval = ext2fs_allocate_block_bitmap(fs, descr, ret); fs->default_bitmap_type = save_type; return retval; }
long long e2fsck_allocate_block_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_block_bitmap(a0, a1, a4, a1); a0->field_c4 = *(&v0); return v1; }
e2fsprogs-1.46.5
angr_sailr
static void passname(unsigned char const *data, char name[7]) { if (data) sprintf(name, "%02x%02x%02x", data[0], data[1], data[2]); else memcpy(name, "random", 7); }
void passname(char a0[3], void *a1) { unsigned long long v1; unsigned long long v2; if (!a0) v1 = memcpy(a1, "random", 0x7); else v2 = sprintf(a1, "%02x%02x%02x", a0[0], a0[1], a0[2]); return; }
coreutils
angr_phoenix
struct sshkey *get_hostkey_public_by_index(int ind, struct ssh *ssh) { if (ind < 0 || (u_int)ind >= options.num_host_key_files) return (((void *)0)); return (sensitive_data.host_pubkeys[ind]); }
int get_hostkey_public_by_index(unsigned long a0, unsigned long a1) { unsigned long v0; unsigned int v2; v0 = a1; if (a0 < 0) { LABEL_401224: v2 = 0; } else { if (9892157179741339976 <= a0) goto LABEL_401224; v2 = *((0xcde8c78902048b00 + a0 * 8)); } return v2; }
openssh-portable
angr_phoenix
static void tls_log_func(int level, const char *str) { fprintf(stderr, "|<%d>| %s", level, str); }
long long tls_log_func(unsigned long a0, unsigned long a1) { return fprintf(stderr, "|<%d>| %s", a0, a1); }
gnutls
angr_dream
static inline __u32 rta_getattr_u32(const struct rtattr *rta) { return *(__u32 *)(( void *)(((char *)(rta)) + ((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0)))); }
int rta_getattr_u32(struct_0 *a0) { return a0->field_4; }
iproute2-6.0.0
angr_sailr
) { fprintf(stderr, "%s: can't gzopen %s\n", prog, outfile); exit(1); }
int fprintf(FILE *__stream, char *__format, ...) { halt_baddata(); }
zlib
ghidra
vi_change_case(EditLine *el, wint_t c) { int i; if (el->el_line.cursor >= el->el_line.lastchar) return 6; cv_undo(el); for (i = 0; i < el->el_state.argument; i++) { c = *el->el_line.cursor; if (iswupper(c)) *el->el_line.cursor = towlower(c); else if (iswlower(c)) *el->el_line.cursor = towupper(c); if (++el->el_line.cursor >= el->el_line.lastchar) { el->el_line.cursor--; re_fastaddc(el); break; } re_fastaddc(el); } return 0; }
long long vi_change_case(struct_0 *a0, unsigned long a1) { unsigned int v0; unsigned int v1; unsigned long long v3; v0 = a1; if (a0->field_58 >= a0->field_60) { v3 = 6; } else { cv_undo(a0); for (v1 = 0; v1 < a0->field_78; v1 += 1) { v0 = a0->field_58->field_0; if (iswupper(v0)) { a0->field_58->field_0 = towlower(v0); } else if (iswlower(v0)) { a0->field_58->field_0 = towupper(v0); } a0->field_58 = a0->field_58 + 1; if (a0->field_58 >= a0->field_60) { a0->field_58 = a0->field_58 + 1; re_fastaddc(a0); break; } else { re_fastaddc(a0); } } v3 = 0; } return v3; }
libedit
angr_dream
static _Bool xattrs_kw_included(const char *kw, _Bool archiving) { if (xattrs_setup.incl.size) return xattrs_matches_mask(kw, &xattrs_setup.incl); else if (archiving) return 1; else return strncmp(kw, "user.", sizeof("user.") - 1) == 0; }
int xattrs_kw_included(char *a0, unsigned long a1) { unsigned int v1; if (g_402388) { v1 = xattrs_matches_mask(a0, &xattrs_setup); } else if (a1) { v1 = 1; } else { v1 = strncmp(a0, "user.", 0x5); *(&v1) = !v1; } return v1; }
tar
angr_dream
static void replace_problematic_chars(char *cell) { static int tty_out = -1; if (tty_out < 0) tty_out = isatty(1); (tty_out ? replace_invalid_chars : replace_control_chars)(cell); }
long replace_problematic_chars(char *a1) { if (tty_out_7378 < 0) tty_out_7378 = isatty(1); if (tty_out_7378) return replace_invalid_chars(a1); else return replace_control_chars((unsigned char *)a1); }
coreutils
ida
static size_t debug_width(char const *text, char const *lim) { size_t width = mbsnwidth(text, lim - text, 0); while (text < lim) width += (*text++ == '\t'); return width; }
int debug_width(unsigned long long a0, unsigned long a1) { char *v0; int tmp_14; unsigned long v1; unsigned long v4; v0 = a0; for (v1 = mbsnwidth(v0, a1 + -0x1 * v0, 0x0, a1 + -0x1 * v0); v0 < a1; v1 += v4) { tmp_14 = v0; v0 += 1; v4 = *(tmp_14) == 9; } return v1; }
coreutils
angr_phoenix
static inline void __jiffies_to_tv(struct timeval *tv, unsigned long jiffies) { unsigned long long tvusec; tvusec = 10000ULL * jiffies; tv->tv_sec = tvusec / 1000000; tv->tv_usec = tvusec - 1000000 * tv->tv_sec; }
void __jiffies_to_tv(unsigned long long a0[2], unsigned long a1) { unsigned long v0; char v1; unsigned long long v3[2]; unsigned long long v4; v0 = a1 * 10000; a0[0] = v0 * 4835703278458516699 >> 64 >> 18; v3 = a0; a0[1] = v0 - a0[0] * 1000000; v4 = *(&v1); return; }
iproute2-6.0.0
angr_sailr
static void HashSession(unsigned char *k, int b, const unsigned char *y, const unsigned char *z) { unsigned char x[32 + 1007 + 32]; int i; Hash_prefix(x, 3, y, ((761 + 3) / 4)); for (i = 0; i < 1007 + 32; ++i) x[32 + i] = z[i]; Hash_prefix(k, b, x, sizeof x); }
void HashSession(char *a0, unsigned long a1, char *a2, char *a3) { unsigned int v0; char v1; char v2; unsigned long long *v4; unsigned long long v5; Hash_prefix(&v1, 0x3, a2, 0xbf); for (v0 = 0; v0 <= 1038; v0 = __addvsi3(v0, 0x1, a3[v0])) { (&v1)[__addvsi3(v0, 0x20, v0)] = a3[v0]; } Hash_prefix(a0, a1, &v1, 0x42f); v5 = *(&v2) ^ v4[5]; return; }
openssh-portable
angr_phoenix
static char *read_diff(char const *filea, char const *fileb, char **output_placement) { char *diff_result; size_t current_chunk_size, total; int fd, wstatus, status; int werrno = 0; struct stat pipestat; char const *argv[9]; char const **ap; int fds[2]; pid_t pid; ap = argv; *ap++ = diff_program; if (text) *ap++ = "-a"; if (strip_trailing_cr) *ap++ = "--strip-trailing-cr"; *ap++ = "--horizon-lines=100"; *ap++ = "--"; *ap++ = filea; *ap++ = fileb; *ap = 0; if (pipe(fds) != 0) perror_with_exit("pipe"); pid = fork(); if (pid == 0) { close(fds[0]); if (fds[1] != 1) { dup2(fds[1], 1); close(fds[1]); } execvp(diff_program, (char **)argv); _exit((*__errno_location()) == 2 ? 127 : 126); } if (pid == -1) perror_with_exit("fork"); close(fds[1]); fd = fds[0]; if (fstat(fd, &pipestat) != 0) perror_with_exit("fstat"); current_chunk_size = ((1) >= (((pipestat).st_blksize)) ? (1) : (((pipestat).st_blksize))); diff_result = xmalloc(current_chunk_size); total = 0; for (;;) { size_t bytes_to_read = current_chunk_size - total; size_t bytes = block_read(fd, diff_result + total, bytes_to_read); total += bytes; if (bytes != bytes_to_read) { if (bytes == (18446744073709551615UL)) perror_with_exit(gettext("read failed")); break; } if ((9223372036854775807L) / 2 <= current_chunk_size) xalloc_die(); current_chunk_size *= 2; diff_result = xrealloc(diff_result, current_chunk_size); } if (total != 0 && diff_result[total - 1] != '\n') fatal("invalid diff format; incomplete last line"); *output_placement = diff_result; if (close(fd) != 0) perror_with_exit("close"); if (waitpid(pid, &wstatus, 0) < 0) perror_with_exit("waitpid"); status = !werrno && (((wstatus) & 0x7f) == 0) ? (((wstatus) & 0xff00) >> 8) : 0x7fffffff; if (2 <= status) ((!!sizeof(struct { _Static_assert( 2, "verify_expr (" "2" ", " "(error (2, werrno, gettext (status == 126 ? \"subsidiary program " "'%s' could not be invoked\" : status == 127 ? \"subsidiary " "program '%s' not found\" : status == 0x7fffffff ? \"subsidiary " "program '%s' failed\" : \"subsidiary program '%s' failed (exit " "status %d)\"), diff_program, status), assume (false))" ")"); int _gl_dummy; })) ? ((error(2, werrno, gettext( status == 126 ? "subsidiary program '%s' could not be invoked" : status == 127 ? "subsidiary program '%s' not found" : status == 0x7fffffff ? "subsidiary program '%s' failed" : "subsidiary program '%s' failed (exit status %d)"), diff_program, status), ((0) ? (void)0 : __builtin_unreachable()))) : ((error(2, werrno, gettext( status == 126 ? "subsidiary program '%s' could not be invoked" : status == 127 ? "subsidiary program '%s' not found" : status == 0x7fffffff ? "subsidiary program '%s' failed" : "subsidiary program '%s' failed (exit status %d)"), diff_program, status), ((0) ? (void)0 : __builtin_unreachable())))) ; return diff_result + total; }
int read_diff(unsigned long a0, unsigned long a1, unsigned long long *a2) { int tmp_63; int tmp_27; int tmp_36; int tmp_45; int tmp_57; char v0; unsigned int v1; unsigned int v2; unsigned int v3; unsigned int v4; char *v5; unsigned long long v6; void *v7; unsigned long long *v8; unsigned long long v9; unsigned long v10; char v11; char v12; char v13; char v14; char v15; unsigned long long *v17; unsigned long long *v18; unsigned int v19; unsigned long long v21; unsigned int v23; unsigned long long v24; v1 = 0; v8 = &v13; tmp_63 = v8; v8 += 1; *(tmp_63) = diff_program; if (text) { v17 = v8; v8 = v8 + 1; *(v17) = "-a"; } if (strip_trailing_cr) { v18 = v8; v8 = v8 + 1; *(v18) = "--strip-trailing-cr"; } tmp_27 = v8; v8 += 1; *(tmp_27) = "--horizon-lines=100"; tmp_36 = v8; v8 += 1; *(tmp_36) = "--"; tmp_45 = v8; v8 += 1; *(tmp_45) = a0; tmp_57 = v8; v8 += 1; *(tmp_57) = a1; *(v8) = 0; v19 = pipe(&v11); if (v19) perror_with_exit("pipe"); v2 = fork(); if (!v2) { close(*(&v11)); if (*(&v12) != 1) { dup2(*(&v12), 0x1); close(*(&v12)); } execvp(diff_program, &v13); v19 = *(__errno_location()); if (v19 == 2) v19 = 127; else v19 = 126; _exit(v19); } else if (v2 == -1) { perror_with_exit("fork"); } else { close(*(&v12)); v3 = *(&v11); if (fstat(v3, &v14)) perror_with_exit("fstat"); v21 = *(&v15); if (*(&v15) <= 0) v21 = 1; v6 = v21; v5 = xmalloc(v6); v7 = 0; while (true) { v9 = v6 - v7; v10 = block_read(v3, v5 + v7, v9, v5 + v7); v7 += v10; if (v10 != v9) break; if (v6 > 4611686018427387902) xalloc_die(); v6 *= 2; v5 = xrealloc(v5, v6, v6); } if (v10 == -1) perror_with_exit(gettext("read failed")); if (v7 && *((v5 + v7 - 1)) != 10) fatal("invalid diff format; incomplete last line"); if (*((v5 + v7 - 1)) == 10 || !v7) { *(a2) = v5; if (close(v3)) perror_with_exit("close"); v23 = waitpid(v2, &v0, 0x0); if (v23 < 0) perror_with_exit("waitpid"); if (!v1 && !(*(&v0) & 127)) v23 = *(&v0) >> 8; if (v1 || (*(&v0) & 127)) v23 = 2147483647; v4 = v23; if (v4 > 1) { if (v4 == 126) { v24 = "subsidiary program '%s' could not be invoked"; } else if (v4 == 127) { v24 = "subsidiary program '%s' not found"; } else if (v4 == 2147483647) { v24 = "subsidiary program '%s' failed"; } else { v24 = "subsidiary program '%s' failed (exit status %d)"; } error(0x2, v1, gettext(v24)); } else { return v7 + v5; } } } }
diffutils
angr_dream
void add_identity_file(Options *options, const char *dir, const char *filename, int userprovided) { char *path; int i; if (options->num_identity_files >= 100) sshfatal("readconf.c", __func__, 485, 0, SYSLOG_LEVEL_FATAL, ((void *)0), "Too many identity files specified (max %d)", 100); if (dir == ((void *)0)) path = xstrdup(filename); else if (xasprintf(&path, "%s%s", dir, filename) >= 4096) sshfatal("readconf.c", __func__, 491, 0, SYSLOG_LEVEL_FATAL, ((void *)0), "Identity file path %s too long", path); for (i = 0; i < options->num_identity_files; i++) { if (options->identity_file_userprovided[i] == userprovided && strcmp(options->identity_files[i], path) == 0) { sshlog("readconf.c", __func__, 497, 1, SYSLOG_LEVEL_DEBUG2, ((void *)0), "ignoring duplicate key %s", path); free(path); return; } } options->identity_file_userprovided[options->num_identity_files] = userprovided; options->identity_files[options->num_identity_files++] = path; }
unsigned long add_identity_file(long a1, const char *a2, const char *a3, int a4) { int v4; const char *v8; int i; char *s2; unsigned long v11; v8 = a2; v11 = __readfsqword(0x28u); if (*(int *)(a1 + 804) > 99) { a2 = "add_identity_file"; sshfatal("readconf.c", "add_identity_file", 485LL, 0LL, 1LL, 0LL, "Too many identity files specified (max %d)", 100LL); } if (v8) { if ((int)xasprintf(&s2, "%s%s", v8, a3) > 4095) sshfatal("readconf.c", "add_identity_file", 491LL, 0LL, 1LL, 0LL, "Identity file path %s too long", s2); } else { s2 = (char *)xstrdup(a3, a2); } for (i = 0; i < *(_DWORD *)(a1 + 804); ++i) { if (a4 == *(_DWORD *)(a1 + 4 * (i + 400LL) + 8) && !strcmp(*(const char **)(a1 + 8 * (i + 100LL) + 8), s2)) { sshlog("readconf.c", "add_identity_file", 497LL, 1LL, 6LL, 0LL, "ignoring duplicate key %s", s2); free(s2); return __readfsqword(0x28u) ^ v11; } } *(_DWORD *)(a1 + 4 * (*(int *)(a1 + 804) + 400LL) + 8) = a4; v4 = *(_DWORD *)(a1 + 804); *(_DWORD *)(a1 + 804) = v4 + 1; *(_QWORD *)(a1 + 8 * (v4 + 100LL) + 8) = s2; return __readfsqword(0x28u) ^ v11; }
openssh-portable
ida
static SHELL_VAR *build_hashcmd(self) SHELL_VAR *self; { HASH_TABLE *h; int i; char *k, *v; BUCKET_CONTENTS *item; h = (HASH_TABLE *)((self)->value); if (h) assoc_dispose(h); if (hashed_filenames == 0 || ((hashed_filenames) ? (hashed_filenames)->nentries : 0) == 0) { ((self)->value = ((char *)((void *)0))); return self; } h = (hash_create((hashed_filenames->nbuckets))); for (i = 0; i < hashed_filenames->nbuckets; i++) { for (item = ((hashed_filenames && (i < hashed_filenames->nbuckets)) ? hashed_filenames->bucket_array[i] : (BUCKET_CONTENTS *)((void *)0)); item; item = item->next) { k = (char *)strcpy( sh_xmalloc((1 + strlen(item->key)), "variables.c", 1743), (item->key)); v = ((PATH_DATA *)(item)->data)->path; assoc_insert(h, k, v); } } ((self)->value = ((char *)h)); return self; }
void build_hashcmd(struct_0 *a0) { unsigned int v0; void *v1; unsigned long long v2; unsigned long long v3; unsigned long long v4; struct_0 *v6; void *v7; struct_0 *v8; v2 = a0->field_8; if (v2) assoc_dispose(v2); if (!hashed_filenames) { LABEL_402783: a0->field_8 = 0; v6 = a0; } else { if (!hashed_filenames) goto LABEL_402783; if (!*((hashed_filenames + 12))) goto LABEL_402783; v2 = hash_create(*((hashed_filenames + 8))); v0 = 0; while (true) { if (v0 >= *((hashed_filenames + 8))) break; if (hashed_filenames && v0 < *((hashed_filenames + 8))) { v7 = *((*(hashed_filenames) + v0 * 8)); goto LABEL_4027f5; } v7 = 0; LABEL_4027f5: for (v1 = v7; v1; v1 = *(v1)) { v3 = strcpy(sh_xmalloc(strlen(v1[8]) + 1, "variables.c", 0x6cf), v1[8]); v4 = *(v1[16]); assoc_insert(v2, v3, v4, v3); } v0 += 1; } a0->field_8 = v2; v8 = a0; } return; }
bash
angr_phoenix
void progcomp_flush() { if (prog_completes) hash_flush(prog_completes, free_progcomp); }
long progcomp_flush() { long result; result = prog_completes; if (prog_completes) return hash_flush(prog_completes, free_progcomp); return result; }
bash
ida
static char *split_ignorespec(s, ip) char *s; int *ip; { char *t; int n, i; if (s == 0) return 0; i = *ip; if (s[i] == 0) return 0; n = skip_to_delim(s, i, ":", 0x001 | 0x010 | 0x040); t = substring(s, i, n); if (s[n] == ':') n++; *ip = n; return t; }
int split_ignorespec(char *a0, unsigned int *a1) { unsigned int v0; unsigned int v1; unsigned long v2; unsigned int v4; if (!a0) { v4 = 0; } else { v1 = *(a1); if (!a0[v1]) { v4 = 0; } else { v0 = skip_to_delim(a0, v1, ":", 0x51); v2 = substring(a0, v1, v0, v1); if (a0[v0] == 58) v0 += 1; *(a1) = v0; v4 = v2; } } return v4; }
bash
angr_dream
int kex_kem_sntrup761x25519_keypair(struct kex *kex) { struct sshbuf *buf = ((void *)0); u_char *cp = ((void *)0); size_t need; int r; if ((buf = sshbuf_new()) == ((void *)0)) return -2; need = 1158 + 32; if ((r = sshbuf_reserve(buf, need, &cp)) != 0) goto out; crypto_kem_sntrup761_keypair(cp, kex->sntrup761_client_key); cp += 1158; kexc25519_keygen(kex->c25519_client_key, cp); kex->client_pub = buf; buf = ((void *)0); out: sshbuf_free(buf); return r; }
long kex_kem_sntrup761x25519_keypair(long a1) { unsigned int v2; long v3; long v4; long v5; unsigned long v6; v6 = __readfsqword(0x28u); v3 = 0LL; v4 = sshbuf_new(); if (!v4) return 4294967294LL; v5 = 1190LL; v2 = sshbuf_reserve(v4, 1190LL, &v3); if (!v2) { crypto_kem_sntrup761_keypair(v3, a1 + 384); v3 += 1158LL; kexc25519_keygen(a1 + 320, v3); *(_QWORD *)(a1 + 2152) = v4; v4 = 0LL; } sshbuf_free(v4); return v2; }
openssh-portable
ida
static struct control *extract_regexp(int argnum, _Bool ignore, char const *str) { idx_t len; char delim = *str; char const *closing_delim; struct control *p; char const *err; closing_delim = strrchr(str + 1, delim); if (closing_delim == ((void *)0)) ((!!sizeof(struct { _Static_assert(1, "verify_expr (" "1" ", " "(error (1, 0, gettext (\"%s: closing delimiter '%c' " "missing\"), str, delim), assume (false))" ")"); int _gl_dummy; })) ? ((error(1, 0, gettext("%s: closing delimiter '%c' missing"), str, delim), ((0) ? (void)0 : __builtin_unreachable()))) : ((error(1, 0, gettext("%s: closing delimiter '%c' missing"), str, delim), ((0) ? (void)0 : __builtin_unreachable())))); len = closing_delim - str - 1; p = new_control_record(); p->argnum = argnum; p->ignore = ignore; p->regexpr = 1; p->re_compiled.buffer = ((void *)0); p->re_compiled.allocated = 0; p->re_compiled.fastmap = xmalloc((0x7f * 2 + 1) + 1); p->re_compiled.translate = ((void *)0); re_syntax_options = ((((((unsigned long int)1) << 1) << 1) | ((((((((unsigned long int)1) << 1) << 1) << 1) << 1) << 1) << 1) | (((((((((unsigned long int)1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) | (((((((((((unsigned long int)1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) | ((((((((((((((((((unsigned long int)1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1)) | (((unsigned long int)1) << 1) | ((((((((((((((((((((((((((unsigned long int)1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1)) & ~((((((((((((((((((((((((((unsigned long int)1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) & ~((((((((((((((((((unsigned long int)1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1) << 1); err = re_compile_pattern(str + 1, len, &p->re_compiled); if (err) { error(0, 0, gettext("%s: invalid regular expression: %s"), quote(str), err); cleanup_fatal(); } if (closing_delim[1]) check_for_offset(p, str, closing_delim + 1); return p; }
int extract_regexp(unsigned long a0, unsigned long a1, char *a2) { char v0; struct_1 *v1; unsigned long long v2; struct_0 *v3; unsigned long v4; unsigned long long v6; v0 = *(a2); v1 = &strrchr(a2 + 1, v0); if (!v1) error(0x1, 0x0, gettext("%s: closing delimiter '%c' missing")); v2 = v1 - a2 - 1; v3 = new_control_record(); v3->field_18 = a0; v3->field_1d = a1; v3->field_1e = 1; v3->field_20 = 0; v3->field_28 = 0; v3->field_40 = xmalloc(0x100); v3->field_48 = 0; re_syntax_options = 710; v4 = re_compile_pattern(a2 + 1, v2, &v3->field_20, a2 + 1); if (v4) { v6 = quote(a2); error(0x0, 0x0, gettext("%s: invalid regular expression: %s")); cleanup_fatal(); } if (v1->field_1) check_for_offset(v3, a2, &v1->field_1); return v3; }
coreutils
angr_sailr
void kwsfree(kwset_t kwset) { __extension__({ struct obstack *__o = (&kwset->obstack); 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); }); free(kwset); }
void kwsfree(struct obstack *a1) { obstack_free(a1, 0LL); free(a1); }
grep
ida
static void exit_cleanup(void) { if (temphead) { struct cs_status cs; cs_enter(&cs); cleanup(); cs_leave(&cs); } close_stdout(); }
long long exit_cleanup() { char v0; if (temphead) { cs_enter(&v0); cleanup(); cs_leave(&v0); } close_stdout(); return 0; }
coreutils
angr_dream
static SigHandler *rl_set_sighandler(int sig, SigHandler *handler, sighandler_cxt *ohandler) { sighandler_cxt old_handler; struct sigaction act; act.__sigaction_handler.sa_handler = handler; act.sa_flags = (sig == 28) ? 0x10000000 : 0; sigemptyset(&act.sa_mask); sigemptyset(&ohandler->sa_mask); sigaction(sig, &act, &old_handler); if (handler != rl_signal_handler || old_handler.__sigaction_handler.sa_handler != rl_signal_handler) memcpy(ohandler, &old_handler, sizeof(sighandler_cxt)); return (ohandler->__sigaction_handler.sa_handler); }
long rl_set_sighandler(int a1, void (*a2)(int), long a3) { int v3; void *src[20]; struct sigaction v7; unsigned long v8; v8 = __readfsqword(0x28u); v7.sa_handler = a2; if (a1 == 28) v3 = 0x10000000; else v3 = 0; v7.sa_flags = v3; sigemptyset(&v7.sa_mask); sigemptyset((sigset_t *)(a3 + 8)); sigaction(a1, &v7, (struct sigaction *)src); if ((char *)a2 != (char *)rl_signal_handler || src[0] != rl_signal_handler) memcpy((void *)a3, src, 0x98uLL); return *(_QWORD *)a3; }
bash
ida
WORD_DESC *command_substitute(string, quoted, flags) char *string; int quoted; int flags; { pid_t pid, old_pid, old_pipeline_pgrp, old_async_pid; char *istring, *s; int result, fildes[2], function_value, pflags, rc, tflag, fork_flags; WORD_DESC *ret; sigset_t set, oset; istring = (char *)((void *)0); for (s = string; s && *s && ((sh_syntaxtab[(unsigned char)(*s)] & 0x2000) || *s == '\n'); s++) ; if (s == 0 || *s == 0) return ((WORD_DESC *)((void *)0)); if (*s == '<' && (s[1] != '<' && s[1] != '>' && s[1] != '&')) { COMMAND *cmd; cmd = parse_string_to_command(string, 0); if (cmd && can_optimize_cat_file(cmd)) { tflag = 0; istring = optimize_cat_file(cmd->value.Simple->redirects, quoted, flags, &tflag); if (istring == &expand_param_error) { last_command_exit_value = 1; istring = 0; } else last_command_exit_value = 0; last_command_subst_pid = dollar_dollar_pid; dispose_command(cmd); ret = alloc_word_desc(); ret->word = istring; ret->flags = tflag; return ret; } dispose_command(cmd); } if (wordexp_only && read_but_dont_execute) { last_command_exit_value = 125; jump_to_top_level(3); } if (subst_assign_varlist == 0 || garglist == 0) maybe_make_export_env(); pflags = (interactive && sourcelevel == 0) ? 0x010 : 0; old_pid = last_made_pid; if (pipe(fildes) < 0) { sys_error("%s", gettext("cannot make pipe for command substitution")); goto error_exit; } old_pipeline_pgrp = pipeline_pgrp; if ((subshell_environment & (0x08 | 0x10)) == 0) pipeline_pgrp = shell_pgrp; cleanup_the_pipeline(); old_async_pid = last_asynchronous_pid; fork_flags = (subshell_environment & 0x01) ? 1 : 0; pid = make_child((char *)((void *)0), fork_flags | 4); last_asynchronous_pid = old_async_pid; if (pid == 0) { reset_signal_handlers(); if (interrupt_state != 0) { kill(getpid(), 2); interrupt_state = 0; } do { if (terminating_signal) termsig_handler(terminating_signal); if (interrupt_state) throw_to_top_level(); } while (0); subshell_environment |= 0x80; subshell_environment &= ~0x100; } set_sigchld_handler(); stop_making_children(); if (pid != 0) pipeline_pgrp = old_pipeline_pgrp; if (pid < 0) { sys_error(gettext("cannot make child for command substitution")); error_exit: last_made_pid = old_pid; do { if (istring) sh_xfree((istring), "subst.c", 7033); } while (0); close(fildes[0]); close(fildes[1]); return ((WORD_DESC *)((void *)0)); } if (pid == 0) { interactive = 0; if (pipeline_pgrp > 0 && pipeline_pgrp != shell_pgrp) shell_pgrp = pipeline_pgrp; set_sigint_handler(); free_pushed_string_input(); fpurge(stdout); if (dup2(fildes[1], 1) < 0) { sys_error("%s", gettext("command_substitute: cannot duplicate pipe as fd 1")); exit(1); } if ((fildes[1] != fileno(stdin)) && (fildes[1] != fileno(stdout)) && (fildes[1] != fileno(stderr))) close(fildes[1]); if ((fildes[0] != fileno(stdin)) && (fildes[0] != fileno(stdout)) && (fildes[0] != fileno(stderr))) close(fildes[0]); subshell_environment |= 0x04; change_flag('v', '+'); if (inherit_errexit == 0) { builtin_ignoring_errexit = 0; change_flag('e', '+'); } set_shellopts(); if (expanding_redir) { flush_temporary_env(); expanding_redir = 0; } remove_quoted_escapes(string); if (expand_aliases) expand_aliases = posixly_correct == 0; startup_state = 2; parse_and_execute_level = 0; result = __sigsetjmp((top_level), 0); if (result == 0 && return_catch_flag) function_value = __sigsetjmp((return_catch), 0); else function_value = 0; if (result == 4) rc = last_command_exit_value; else if (result == 3 || result == 6) rc = last_command_exit_value; else if (result) rc = 1; else if (function_value) rc = return_catch_value; else { subshell_level++; rc = parse_and_execute(string, "command substitution", pflags | 0x004); } last_command_exit_value = rc; rc = run_exit_trap(); unlink_fifo_list(); exit(rc); } else { int dummyfd; close_pgrp_pipe(); close(fildes[1]); begin_unwind_frame("read-comsub"); dummyfd = fildes[0]; add_unwind_protect(close, dummyfd); do { sigemptyset(&set); sigaddset(&set, 2); sigemptyset(&oset); sigprocmask(0, &set, &oset); } while (0); tflag = 0; istring = read_comsub(fildes[0], quoted, flags, &tflag); close(fildes[0]); discard_unwind_frame("read-comsub"); sigprocmask(2, &oset, (sigset_t *)((void *)0)); current_command_subst_pid = pid; last_command_exit_value = wait_for(pid, (1 << 8)); last_command_subst_pid = pid; last_made_pid = old_pid; if (last_command_exit_value == (128 + 2) && last_command_exit_signal == 2) kill(getpid(), 2); ret = alloc_word_desc(); ret->word = istring; ret->flags = tflag; return ret; } }
undefined8 *command_substitute(byte *param_1, undefined4 param_2, undefined4 param_3) { int iVar1; __pid_t _Var2; int iVar3; int iVar4; undefined8 *puVar5; undefined8 uVar6; long in_FS_OFFSET; bool bVar7; undefined4 local_17c; int local_178; int local_174; uint local_170; uint local_16c; undefined4 local_168; int local_164; undefined4 local_160; uint local_15c; int local_158; int local_154; undefined1 *local_150; byte *local_148; long local_140; undefined8 *local_138; int local_130; int local_12c; sigset_t local_128; sigset_t local_a8; long local_20; local_20 = *(long *)(in_FS_OFFSET + 0x28); local_150 = (undefined1 *)0x0; for (local_148 = param_1; ((local_148 != (byte *)0x0 && (*local_148 != 0)) && (((*(uint *)(&sh_syntaxtab + (long)(int)(uint)*local_148 * 4) & 0x2000) != 0 || (*local_148 == 10)))); local_148 = local_148 + 1) { } if ((local_148 == (byte *)0x0) || (*local_148 == 0)) { puVar5 = (undefined8 *)0x0; } else { if ((((*local_148 == 0x3c) && (local_148[1] != 0x3c)) && (local_148[1] != 0x3e)) && (local_148[1] != 0x26)) { local_140 = parse_string_to_command(param_1, 0); if ((local_140 != 0) && (iVar1 = can_optimize_cat_file(local_140), iVar1 != 0)) { local_17c = 0; local_150 = (undefined1 *)optimize_cat_file( *(undefined8 *)(*(long *)(local_140 + 0x18) + 0x10), param_2, param_3, &local_17c); bVar7 = local_150 == &expand_param_error; if (bVar7) { local_150 = (undefined1 *)0x0; } last_command_exit_value = (uint)bVar7; last_command_subst_pid = dollar_dollar_pid; dispose_command(local_140); puVar5 = (undefined8 *)alloc_word_desc(); *puVar5 = local_150; *(undefined4 *)(puVar5 + 1) = local_17c; local_138 = puVar5; goto LAB_001106f4; } dispose_command(local_140); } if ((wordexp_only != 0) && (read_but_dont_execute != 0)) { last_command_exit_value = 0x7d; jump_to_top_level(3); } if ((subst_assign_varlist == 0) || (garglist == 0)) { maybe_make_export_env(); } if ((interactive == 0) || (sourcelevel != 0)) { local_170 = 0; } else { local_170 = 0x10; } local_168 = last_made_pid; iVar1 = pipe(&local_130); if (iVar1 < 0) { uVar6 = gettext("cannot make pipe for command substitution"); sys_error(&DAT_0011faf2, uVar6); } else { local_164 = pipeline_pgrp; if ((subshell_environment & 0x18) == 0) { pipeline_pgrp = shell_pgrp; } cleanup_the_pipeline(); local_160 = last_asynchronous_pid; local_15c = subshell_environment & 1; local_158 = make_child(0, local_15c | 4); last_asynchronous_pid = local_160; if (local_158 == 0) { reset_signal_handlers(); if (interrupt_state != 0) { _Var2 = getpid(); kill(_Var2, 2); interrupt_state = 0; } if (terminating_signal != 0) { termsig_handler(); } if (interrupt_state != 0) { throw_to_top_level(); } subshell_environment = subshell_environment & 0xfffffeff | 0x80; } set_sigchld_handler(); stop_making_children(); if (local_158 != 0) { pipeline_pgrp = local_164; } if (-1 < local_158) { if (local_158 == 0) { interactive = 0; if ((0 < pipeline_pgrp) && (pipeline_pgrp != shell_pgrp)) { shell_pgrp = pipeline_pgrp; } set_sigint_handler(); free_pushed_string_input(); fpurge(); iVar3 = dup2(local_12c, 1); iVar1 = local_12c; if (-1 < iVar3) { iVar4 = fileno(stdin); iVar3 = local_12c; if (((iVar1 != iVar4) && (iVar4 = fileno(stdout), iVar1 = local_12c, iVar3 != iVar4)) && (iVar3 = fileno(stderr), iVar1 != iVar3)) { close(local_12c); } iVar1 = local_130; iVar4 = fileno(stdin); iVar3 = local_130; if (((iVar1 != iVar4) && (iVar4 = fileno(stdout), iVar1 = local_130, iVar3 != iVar4)) && (iVar3 = fileno(stderr), iVar1 != iVar3)) { close(local_130); } subshell_environment = subshell_environment | 4; change_flag(0x76, 0x2b); if (inherit_errexit == 0) { _builtin_ignoring_errexit = 0; change_flag(0x65, 0x2b); } set_shellopts(); if (expanding_redir != 0) { flush_temporary_env(); expanding_redir = 0; } remove_quoted_escapes(param_1); if (expand_aliases != 0) { expand_aliases = (uint)(posixly_correct == 0); } _startup_state = 2; parse_and_execute_level = 0; local_178 = __sigsetjmp(&top_level, 0); if ((local_178 == 0) && (return_catch_flag != 0)) { local_174 = __sigsetjmp(&return_catch, 0); } else { local_174 = 0; } if (local_178 == 4) { local_16c = last_command_exit_value; } else if ((local_178 == 3) || (local_178 == 6)) { local_16c = last_command_exit_value; } else if (local_178 == 0) { if (local_174 == 0) { subshell_level = subshell_level + 1; local_16c = parse_and_execute(param_1, "command substitution", local_170 | 4); } else { local_16c = return_catch_value; } } else { local_16c = 1; } last_command_exit_value = local_16c; local_16c = run_exit_trap(); unlink_fifo_list(); exit(local_16c); } uVar6 = gettext("command_substitute: cannot duplicate pipe as fd 1"); sys_error(&DAT_0011faf2, uVar6); exit(1); } close_pgrp_pipe(); close(local_12c); begin_unwind_frame("read-comsub"); local_154 = local_130; add_unwind_protect(uRam000000000011059e, local_130); sigemptyset(&local_128); sigaddset(&local_128, 2); sigemptyset(&local_a8); sigprocmask(0, &local_128, &local_a8); local_17c = 0; local_150 = (undefined1 *)read_comsub(local_130, param_2, param_3, &local_17c); close(local_130); discard_unwind_frame("read-comsub"); sigprocmask(2, &local_a8, (sigset_t *)0x0); current_command_subst_pid = local_158; last_command_exit_value = wait_for(local_158, 0x100); last_command_subst_pid = local_158; last_made_pid = local_168; if ((last_command_exit_value == 0x82) && (last_command_exit_signal == 2)) { _Var2 = getpid(); kill(_Var2, 2); } puVar5 = (undefined8 *)alloc_word_desc(); *puVar5 = local_150; *(undefined4 *)(puVar5 + 1) = local_17c; local_138 = puVar5; goto LAB_001106f4; } gettext("cannot make child for command substitution"); sys_error(); } last_made_pid = local_168; if (local_150 != (undefined1 *)0x0) { sh_xfree(local_150, "subst.c", 0x1b79); } close(local_130); close(local_12c); puVar5 = (undefined8 *)0x0; } LAB_001106f4: if (local_20 == *(long *)(in_FS_OFFSET + 0x28)) { return puVar5; } __stack_chk_fail(); }
bash
ghidra
static void print_cert(struct sshkey *key) { char valid[64], *key_fp, *ca_fp; u_int i; key_fp = sshkey_fingerprint(key, fingerprint_hash, SSH_FP_DEFAULT); ca_fp = sshkey_fingerprint(key->cert->signature_key, fingerprint_hash, SSH_FP_DEFAULT); if (key_fp == ((void *)0) || ca_fp == ((void *)0)) sshfatal("ssh-keygen.c", __func__, 2111, 1, SYSLOG_LEVEL_FATAL, ((void *)0), "sshkey_fingerprint fail"); sshkey_format_cert_validity(key->cert, valid, sizeof(valid)); printf(" Type: %s %s certificate\n", sshkey_ssh_name(key), sshkey_cert_type(key)); printf(" Public key: %s %s\n", sshkey_type(key), key_fp); printf(" Signing CA: %s %s (using %s)\n", sshkey_type(key->cert->signature_key), ca_fp, key->cert->signature_type); printf(" Key ID: \"%s\"\n", key->cert->key_id); printf(" Serial: %llu\n", (unsigned long long)key->cert->serial); printf(" Valid: %s\n", valid); printf(" Principals: "); if (key->cert->nprincipals == 0) printf("(none)\n"); else { for (i = 0; i < key->cert->nprincipals; i++) printf("\n %s", key->cert->principals[i]); printf("\n"); } printf(" Critical Options: "); if (sshbuf_len(key->cert->critical) == 0) printf("(none)\n"); else { printf("\n"); show_options(key->cert->critical, 1); } printf(" Extensions: "); if (sshbuf_len(key->cert->extensions) == 0) printf("(none)\n"); else { printf("\n"); show_options(key->cert->extensions, 0); } }
unsigned long print_cert(long a1) { const char *v1; const char *v2; const char *v3; const char *v4; const char *v5; unsigned int i; const char *v8; const char *v9; char v10[72]; unsigned long v11; v11 = __readfsqword(0x28u); v8 = (const char *)sshkey_fingerprint(a1, (unsigned int)fingerprint_hash, 0LL); v9 = (const char *)sshkey_fingerprint( *(_QWORD *)(*(_QWORD *)(a1 + 128) + 80LL), (unsigned int)fingerprint_hash, 0LL); if (!v8 || !v9) sshfatal("ssh-keygen.c", "print_cert", 2111LL, 1LL, 1LL, 0LL, "sshkey_fingerprint fail"); sshkey_format_cert_validity(*(_QWORD *)(a1 + 128), v10, 64LL); v1 = (const char *)sshkey_cert_type(a1); v2 = (const char *)sshkey_ssh_name(a1); printf(" Type: %s %s certificate\n", v2, v1); v3 = (const char *)sshkey_type(a1); printf(" Public key: %s %s\n", v3, v8); v4 = *(const char **)(*(_QWORD *)(a1 + 128) + 88LL); v5 = (const char *)sshkey_type(*(_QWORD *)(*(_QWORD *)(a1 + 128) + 80LL)); printf(" Signing CA: %s %s (using %s)\n", v5, v9, v4); printf(" Key ID: \"%s\"\n", *(const char **)(*(_QWORD *)(a1 + 128) + 24LL)); printf(" Serial: %llu\n", *(_QWORD *)(*(_QWORD *)(a1 + 128) + 16LL)); printf(" Valid: %s\n", v10); printf(" Principals: "); if (*(_DWORD *)(*(_QWORD *)(a1 + 128) + 32LL)) { for (i = 0; i < *(_DWORD *)(*(_QWORD *)(a1 + 128) + 32LL); ++i) printf("\n %s", *(const char **)(8LL * i + *(_QWORD *)(*(_QWORD *)(a1 + 128) + 40LL))); printf("\n"); } else { printf("(none)\n"); } printf(" Critical Options: "); if (sshbuf_len(*(_QWORD *)(*(_QWORD *)(a1 + 128) + 64LL))) { printf("\n"); show_options(*(_QWORD *)(*(_QWORD *)(a1 + 128) + 64LL), 1); } else { printf("(none)\n"); } printf(" Extensions: "); if (sshbuf_len(*(_QWORD *)(*(_QWORD *)(a1 + 128) + 72LL))) { printf("\n"); show_options(*(_QWORD *)(*(_QWORD *)(a1 + 128) + 72LL), 0); } else { printf("(none)\n"); } return __readfsqword(0x28u) ^ v11; }
openssh-portable
ida
static int process_msg(struct nlmsghdr *n, void *arg) { struct rtattr *attrs[(__SEG6_ATTR_MAX - 1) + 1]; struct genlmsghdr *ghdr; int len = n->nlmsg_len; if (n->nlmsg_type != genl_family) return -1; len -= (((((sizeof(struct genlmsghdr)) + 4U - 1) & ~(4U - 1))) + ((int)(((sizeof(struct nlmsghdr)) + 4U - 1) & ~(4U - 1)))); if (len < 0) return -1; ghdr = ((void *)(((char *)n) + ((int)(((sizeof(struct nlmsghdr)) + 4U - 1) & ~(4U - 1))))); parse_rtattr( attrs, (__SEG6_ATTR_MAX - 1), (void *)ghdr + (((sizeof(struct genlmsghdr)) + 4U - 1) & ~(4U - 1)), len); open_json_object(((void *)0)); switch (ghdr->cmd) { case SEG6_CMD_DUMPHMAC: print_dumphmac(attrs); break; case SEG6_CMD_GET_TUNSRC: print_tunsrc(attrs); break; } close_json_object(); return 0; }
int process_msg(struct_0 *a0, unsigned long a1) { unsigned long v0; unsigned int v1; char *v2; char v3; unsigned int v5; v0 = a1; v1 = a0->field_0; if (a0->field_4 != genl_family) { v5 = -1; } else { v1 -= 20; if (v1 < 0) { v5 = -1; } else { v2 = &a0[2].field_4; parse_rtattr(&v3, 0x7, v2 + 4, v1); open_json_object(0x0); if (*(v2) == 2) { print_dumphmac(&v3); } else if (*(v2) == 4) { print_tunsrc(&v3); } close_json_object(); v5 = 0; } } return v5; }
iproute2-6.0.0
angr_phoenix
void blank_name_list(void) { struct name *name; gnu_list_name = 0; for (name = namelist; name; name = name->next) name->found_count = 0; }
long blank_name_list() { long result; long *i; gnu_list_name = 0LL; result = namelist; for (i = (long *)namelist; i; i = (long *)*i) { i[6] = 0LL; result = *i; } return result; }
tar
ida
int mac_valid(const char *names) { char *maclist, *cp, *p; if (names == ((void *)0) || strcmp(names, "") == 0) return 0; if ((maclist = cp = strdup(names)) == ((void *)0)) return 0; for ((p = strsep(&cp, ",")); p && *p != '\0'; (p = strsep(&cp, ","))) { if (mac_setup(((void *)0), p) < 0) { free(maclist); return 0; } } free(maclist); return 1; }
long long mac_valid(char *a0) { void *v0; char *v1; void *v2; unsigned long long v4; if (!a0) { v4 = 0; return v4; } else if (!strcmp(a0, &g_4009aa)) { v4 = 0; return v4; } else { v0 = strdup(a0); v2 = v0; if (!v2) { v4 = 0; return v4; } for (v1 = strsep(&v0, ","); v1 && *(v1); v1 = strsep(&v0, ",")) { if (mac_setup(0x0, v1) < 0) { free(v2); v4 = 0; return v4; } } free(v2); v4 = 1; return v4; } }
openssh-portable
angr_sailr
int sshkey_private_to_fileblob(struct sshkey *key, struct sshbuf *blob, const char *passphrase, const char *comment, int format, const char *openssh_format_cipher, int openssh_format_rounds) { switch (key->type) { case KEY_DSA: case KEY_ECDSA: case KEY_RSA: break; case KEY_ED25519: case KEY_ED25519_SK: case KEY_ECDSA_SK: return sshkey_private_to_blob2(key, blob, passphrase, comment, openssh_format_cipher, openssh_format_rounds); default: return -14; } switch (format) { case SSHKEY_PRIVATE_OPENSSH: return sshkey_private_to_blob2(key, blob, passphrase, comment, openssh_format_cipher, openssh_format_rounds); case SSHKEY_PRIVATE_PEM: case SSHKEY_PRIVATE_PKCS8: return sshkey_private_to_blob_pem_pkcs8(key, blob, format, passphrase, comment); default: return -10; } }
long long sshkey_private_to_fileblob(unsigned int *a0, unsigned long long a1, char *a2, unsigned long long a3, unsigned long a4, unsigned long long a5, unsigned int v0) { unsigned long long v1; if (*(a0) != 12) { if (*(a0) <= 12 && *(a0) != 10 && *(a0) <= 10 && *(a0) <= 2 && *(a0) >= 0) { if (a4) { if (a4 >= 0 && a4 - 1 <= 1) v1 = sshkey_private_to_blob_pem_pkcs8(a0, a1, a4, a2, a3); if (a4 < 0 || a4 - 1 > 1) v1 = 4294967286; } else { v1 = sshkey_private_to_blob2(a0, a1, a2, a3, a5, v0); } } if ((*(a0) != 10 || *(a0) > 12) && (*(a0) < 0 || *(a0) > 12 || *(a0) > 10 || *(a0) > 2) && (*(a0) <= 2 || *(a0) != 3 || *(a0) > 12 || *(a0) > 10)) v1 = 4294967282; } if (*(a0) == 12 || *(a0) == 10 && *(a0) <= 12 || *(a0) == 3 && *(a0) <= 12 && *(a0) <= 10 && *(a0) > 2) v1 = sshkey_private_to_blob2(a0, a1, a2, a3, a5, v0); return v1; }
openssh-portable
angr_dream
int hashcmd(int argc, char **argv) { struct tblentry **pp; struct tblentry *cmdp; int c; struct cmdentry entry; char *name; while ((c = nextopt("r")) != '\0') { clearcmdentry(); return 0; } if (*argptr == ((void *)0)) { for (pp = cmdtable; pp < &cmdtable[31]; pp++) { for (cmdp = *pp; cmdp; cmdp = cmdp->next) { if (cmdp->cmdtype == 0) printentry(cmdp); } } return 0; } c = 0; while ((name = *argptr) != ((void *)0)) { if ((cmdp = cmdlookup(name, 0)) && (cmdp->cmdtype == 0 || (cmdp->cmdtype == 2 && !(cmdp->param.cmd->flags & 0x2) && builtinloc > 0))) delete_cmd_entry(); find_command(name, &entry, 0x01, ((&(&(&varinit[0])[1])[1])[1].text + 5)); if (entry.cmdtype == -1) c = 1; argptr++; } return c; }
long long hashcmd(unsigned long a0, unsigned long a1) { unsigned long v0; unsigned int v1; unsigned int v2; unsigned long long v3; struct_0 *v4; char *v5; char v6; void *v8; v1 = a0; v0 = a1; v2 = nextopt("r"); if (v2) { clearcmdentry(); v8 = 0; return v8; } else if (!*(argptr)) { for (v3 = &cmdtable; v3 < "%s: %s"; v3 += 8) { for (v4 = *(v3); v4; v4 = v4->field_0) { if (!v4->field_10) printentry(v4); } } v8 = 0; return v8; } else { v2 = 0; while (true) { v5 = *(argptr); if (!v5) break; v4 = cmdlookup(v5, 0x0); if (v4) { switch (v4->field_10) { case 0: LABEL_4005e7: delete_cmd_entry(); case 2: if (!(v4->field_8->field_10 & 2) && builtinloc > 0) goto LABEL_4005e7; else goto LABEL_4005ec; default: goto LABEL_4005ec; } } LABEL_4005ec: find_command(v5, &v6, 0x1, onint + 5); if (*(&v6) == -1) v2 = 1; argptr = argptr + 8; } v8 = v2; return v8; } }
dash-0.5.11+git20210903+057cd650a4ed
angr_sailr
static char *next_field(char **line) { char *field_start = *line; char *field_end = field_start; if (delimiter != DELIMITER_DEFAULT) { if (*field_start != delimiter) { while (*field_end && *field_end != delimiter) ++field_end; } } else { while (*field_end && field_sep(*field_end)) ++field_end; while (*field_end && !field_sep(*field_end)) ++field_end; } *line = field_end; return field_start; }
char *next_field(char **param_1) { char *pcVar1; char cVar2; char *local_18; pcVar1 = *param_1; local_18 = pcVar1; if (delimiter == 0x80) { while ( (*local_18 != '\0' && (cVar2 = field_sep(*local_18), cVar2 != '\0'))) { local_18 = local_18 + 1; } while ((*local_18 != '\0' && (cVar2 = field_sep(*local_18), cVar2 != '\x01'))) { local_18 = local_18 + 1; } } else if (*pcVar1 != delimiter) { for (; (*local_18 != '\0' && (*local_18 != delimiter)); local_18 = local_18 + 1) { } } *param_1 = local_18; return pcVar1; }
coreutils
ghidra
static int depmod_load_modules(struct depmod *depmod) { struct mod **itr, **itr_end; log_printf(7, "load symbols (%zd modules)\n", depmod->modules.count); itr = (struct mod **)depmod->modules.array; itr_end = itr + depmod->modules.count; for (; itr < itr_end; itr++) { struct mod *mod = *itr; struct kmod_list *l, *list = ((void *)0); int err = kmod_module_get_symbols(mod->kmod, &list); if (err < 0) { if (err == -2) log_printf(7, "ignoring %s: no symbols\n", mod->path); else log_printf(3, "failed to load symbols from %s: %s\n", mod->path, strerror(-err)); goto load_info; } for (l = ((list) == ((void *)0)) ? ((void *)0) : (list); l != ((void *)0); l = (l->node.next == &((list)->node)) ? ((void *)0) : ((struct kmod_list *)((char *)(l->node.next) - __builtin_offsetof(struct kmod_list, node)) - ((typeof(*(l->node.next)) *)0 != (typeof(((struct kmod_list *)0)->node) *)0))) { const char *name = kmod_module_symbol_get_symbol(l); uint64_t crc = kmod_module_symbol_get_crc(l); depmod_symbol_add(depmod, name, 0, crc, mod); } kmod_module_symbols_free_list(list); load_info: kmod_module_get_info(mod->kmod, &mod->info_list); kmod_module_get_dependency_symbols(mod->kmod, &mod->dep_sym_list); kmod_module_unref(mod->kmod); mod->kmod = ((void *)0); } log_printf(7, "loaded symbols (%zd modules, %u symbols)\n", depmod->modules.count, hash_get_count(depmod->symbols)); return 0; }
int depmod_load_modules(unsigned long long a0[9], unsigned long a1, unsigned long a2, unsigned long long a3, unsigned long long a4) { unsigned int v0; void *v1; unsigned long long *v2; void *v3; unsigned long v4; unsigned long long v5[2]; void *v6; unsigned int v7; void *v9; log_printf(0x7, "load symbols (%zd modules)\n", a0[3], a3, a4); v2 = a0[2]; for (v4 = &v2[a0[3]]; v2 < v4; v2 += 1) { v5[0] = *(v2); v1 = 0; v0 = kmod_module_get_symbols(v5[0], &v1, &v1); if (v0 >= 0) { for (v3 = v1; v3; v3 = v9) { v6 = kmod_module_symbol_get_symbol(v3); *(&v7) = kmod_module_symbol_get_crc(v3); depmod_symbol_add(a0, v6, 0x0, *(&v7), v5); if (*(v3) == v1) v9 = 0; else v9 = *(v3); } kmod_module_symbols_free_list(v1); } else if (v0 == -2) { log_printf(0x7, "ignoring %s: no symbols\n", v5[1], a3, v5); } else { log_printf(0x3, "failed to load symbols from %s: %s\n", v5[1], strerror(-(v0)), v5); } kmod_module_get_info(v5[0], v5 + 2, v5 + 2); kmod_module_get_dependency_symbols(v5[0], &v5[2 + 1], &v5[2 + 1]); kmod_module_unref(v5[0]); v5[0] = 0; } log_printf(0x7, "loaded symbols (%zd modules, %u symbols)\n", a0[3], hash_get_count(a0[8]), v5); return 0; }
kmod
angr_phoenix
SHELL_VAR **all_visible_functions() { return (fapply(visible_var)); }
long long all_visible_functions() { return fapply(visible_var); }
bash
angr_sailr
static struct tm *convert_time(struct tm *(*convert)(const time_t *, struct tm *), long_int t, struct tm *tm) { time_t x = t; return convert(&x, tm); }
int convert_time(unsigned long long a0, unsigned long a1, unsigned long long a2) { unsigned long v0; v0 = a1; return (stack_base)[32](&v0, a2, a2, a0); }
gnutls
angr_dream
static void send_tree(s, tree, max_code) deflate_state *s; ct_data *tree; int max_code; { int n; int prevlen = -1; int curlen; int nextlen = tree[0].dl.len; int count = 0; int max_count = 7; int min_count = 4; if (nextlen == 0) max_count = 138, min_count = 3; for (n = 0; n <= max_code; n++) { curlen = nextlen; nextlen = tree[n + 1].dl.len; if (++count < max_count && curlen == nextlen) { continue; } else if (count < min_count) { do { { int len = s->bl_tree[curlen].dl.len; if (s->bi_valid > (int)16 - len) { int val = (int)s->bl_tree[curlen].fc.code; s->bi_buf |= (ush)val << s->bi_valid; { { s->pending_buf[s->pending++] = (Bytef)((uch)((s->bi_buf) & 0xff)); }; { s->pending_buf[s->pending++] = (Bytef)((uch)((ush)(s->bi_buf) >> 8)); }; }; s->bi_buf = (ush)val >> (16 - s->bi_valid); s->bi_valid += len - 16; } else { s->bi_buf |= (ush)(s->bl_tree[curlen].fc.code) << s->bi_valid; s->bi_valid += len; } }; } while (--count != 0); } else if (curlen != 0) { if (curlen != prevlen) { { int len = s->bl_tree[curlen].dl.len; if (s->bi_valid > (int)16 - len) { int val = (int)s->bl_tree[curlen].fc.code; s->bi_buf |= (ush)val << s->bi_valid; { { s->pending_buf[s->pending++] = (Bytef)((uch)((s->bi_buf) & 0xff)); }; { s->pending_buf[s->pending++] = (Bytef)((uch)((ush)(s->bi_buf) >> 8)); }; }; s->bi_buf = (ush)val >> (16 - s->bi_valid); s->bi_valid += len - 16; } else { s->bi_buf |= (ush)(s->bl_tree[curlen].fc.code) << s->bi_valid; s->bi_valid += len; } }; count--; }; { int len = s->bl_tree[16].dl.len; if (s->bi_valid > (int)16 - len) { int val = (int)s->bl_tree[16].fc.code; s->bi_buf |= (ush)val << s->bi_valid; { { s->pending_buf[s->pending++] = (Bytef)((uch)((s->bi_buf) & 0xff)); }; { s->pending_buf[s->pending++] = (Bytef)((uch)((ush)(s->bi_buf) >> 8)); }; }; s->bi_buf = (ush)val >> (16 - s->bi_valid); s->bi_valid += len - 16; } else { s->bi_buf |= (ush)(s->bl_tree[16].fc.code) << s->bi_valid; s->bi_valid += len; } }; { int len = 2; if (s->bi_valid > (int)16 - len) { int val = (int)count - 3; s->bi_buf |= (ush)val << s->bi_valid; { { s->pending_buf[s->pending++] = (Bytef)((uch)((s->bi_buf) & 0xff)); }; { s->pending_buf[s->pending++] = (Bytef)((uch)((ush)(s->bi_buf) >> 8)); }; }; s->bi_buf = (ush)val >> (16 - s->bi_valid); s->bi_valid += len - 16; } else { s->bi_buf |= (ush)(count - 3) << s->bi_valid; s->bi_valid += len; } }; } else if (count <= 10) { { int len = s->bl_tree[17].dl.len; if (s->bi_valid > (int)16 - len) { int val = (int)s->bl_tree[17].fc.code; s->bi_buf |= (ush)val << s->bi_valid; { { s->pending_buf[s->pending++] = (Bytef)((uch)((s->bi_buf) & 0xff)); }; { s->pending_buf[s->pending++] = (Bytef)((uch)((ush)(s->bi_buf) >> 8)); }; }; s->bi_buf = (ush)val >> (16 - s->bi_valid); s->bi_valid += len - 16; } else { s->bi_buf |= (ush)(s->bl_tree[17].fc.code) << s->bi_valid; s->bi_valid += len; } }; { int len = 3; if (s->bi_valid > (int)16 - len) { int val = (int)count - 3; s->bi_buf |= (ush)val << s->bi_valid; { { s->pending_buf[s->pending++] = (Bytef)((uch)((s->bi_buf) & 0xff)); }; { s->pending_buf[s->pending++] = (Bytef)((uch)((ush)(s->bi_buf) >> 8)); }; }; s->bi_buf = (ush)val >> (16 - s->bi_valid); s->bi_valid += len - 16; } else { s->bi_buf |= (ush)(count - 3) << s->bi_valid; s->bi_valid += len; } }; } else { { int len = s->bl_tree[18].dl.len; if (s->bi_valid > (int)16 - len) { int val = (int)s->bl_tree[18].fc.code; s->bi_buf |= (ush)val << s->bi_valid; { { s->pending_buf[s->pending++] = (Bytef)((uch)((s->bi_buf) & 0xff)); }; { s->pending_buf[s->pending++] = (Bytef)((uch)((ush)(s->bi_buf) >> 8)); }; }; s->bi_buf = (ush)val >> (16 - s->bi_valid); s->bi_valid += len - 16; } else { s->bi_buf |= (ush)(s->bl_tree[18].fc.code) << s->bi_valid; s->bi_valid += len; } }; { int len = 7; if (s->bi_valid > (int)16 - len) { int val = (int)count - 11; s->bi_buf |= (ush)val << s->bi_valid; { { s->pending_buf[s->pending++] = (Bytef)((uch)((s->bi_buf) & 0xff)); }; { s->pending_buf[s->pending++] = (Bytef)((uch)((ush)(s->bi_buf) >> 8)); }; }; s->bi_buf = (ush)val >> (16 - s->bi_valid); s->bi_valid += len - 16; } else { s->bi_buf |= (ush)(count - 11) << s->bi_valid; s->bi_valid += len; } }; } count = 0; prevlen = curlen; if (nextlen == 0) { max_count = 138, min_count = 3; } else if (curlen == nextlen) { max_count = 6, min_count = 3; } else { max_count = 7, min_count = 4; } } }
void send_tree(long param_1, long param_2, int param_3) { ushort uVar1; int iVar2; long lVar3; uint uVar4; uint uVar5; int local_64; uint local_60; uint local_5c; int local_58; int local_54; int local_50; local_60 = 0xffffffff; local_58 = 0; local_54 = 7; local_50 = 4; if (*(ushort *)(param_2 + 2) == 0) { local_54 = 0x8a; local_50 = 3; } local_5c = (uint) * (ushort *)(param_2 + 2); for (local_64 = 0; local_64 <= param_3; local_64 = local_64 + 1) { uVar4 = (uint) * (ushort *)(param_2 + ((long)local_64 + 1) * 4 + 2); iVar2 = local_58 + 1; if ((local_54 <= iVar2) || (local_5c != uVar4)) { if (iVar2 < local_50) { do { local_58 = iVar2; uVar5 = (uint) * (ushort *)(param_1 + 0xe + ((long)(int)local_5c + 0x2ac) * 4); if ((int)(0x10 - uVar5) < *(int *)(param_1 + 0x1734)) { uVar1 = *(ushort *)(param_1 + 0xc + ((long)(int)local_5c + 0x2ac) * 4); *(ushort *)(param_1 + 0x1730) = uVar1 << ((byte) * (undefined4 *)(param_1 + 0x1734) & 0x1f) | *(ushort *)(param_1 + 0x1730); lVar3 = *(long *)(param_1 + 0x28); *(long *)(param_1 + 0x28) = lVar3 + 1; *(char *)(lVar3 + *(long *)(param_1 + 0x10)) = (char)*(undefined2 *)(param_1 + 0x1730); lVar3 = *(long *)(param_1 + 0x28); *(long *)(param_1 + 0x28) = lVar3 + 1; *(char *)(lVar3 + *(long *)(param_1 + 0x10)) = (char)((ushort) * (undefined2 *)(param_1 + 0x1730) >> 8); *(short *)(param_1 + 0x1730) = (short)((int)(uint)uVar1 >> (0x10U - (char)*(undefined4 *)(param_1 + 0x1734) & 0x1f)); *(uint *)(param_1 + 0x1734) = (uVar5 - 0x10) + *(int *)(param_1 + 0x1734); } else { *(ushort *)(param_1 + 0x1730) = *(short *)(param_1 + 0xc + ((long)(int)local_5c + 0x2ac) * 4) << ((byte) * (undefined4 *)(param_1 + 0x1734) & 0x1f) | *(ushort *)(param_1 + 0x1730); *(uint *)(param_1 + 0x1734) = *(int *)(param_1 + 0x1734) + uVar5; } iVar2 = local_58 + -1; } while (local_58 + -1 != 0); } else if (local_5c == 0) { if (iVar2 < 0xb) { uVar5 = (uint) * (ushort *)(param_1 + 0xb02); if ((int)(0x10 - uVar5) < *(int *)(param_1 + 0x1734)) { uVar1 = *(ushort *)(param_1 + 0xb00); *(ushort *)(param_1 + 0x1730) = uVar1 << ((byte) * (undefined4 *)(param_1 + 0x1734) & 0x1f) | *(ushort *)(param_1 + 0x1730); lVar3 = *(long *)(param_1 + 0x28); *(long *)(param_1 + 0x28) = lVar3 + 1; *(char *)(lVar3 + *(long *)(param_1 + 0x10)) = (char)*(undefined2 *)(param_1 + 0x1730); lVar3 = *(long *)(param_1 + 0x28); *(long *)(param_1 + 0x28) = lVar3 + 1; *(char *)(lVar3 + *(long *)(param_1 + 0x10)) = (char)((ushort) * (undefined2 *)(param_1 + 0x1730) >> 8); *(short *)(param_1 + 0x1730) = (short)((int)(uint)uVar1 >> (0x10U - (char)*(undefined4 *)(param_1 + 0x1734) & 0x1f)); *(uint *)(param_1 + 0x1734) = (uVar5 - 0x10) + *(int *)(param_1 + 0x1734); } else { *(ushort *)(param_1 + 0x1730) = *(short *)(param_1 + 0xb00) << ((byte) * (undefined4 *)(param_1 + 0x1734) & 0x1f) | *(ushort *)(param_1 + 0x1730); *(uint *)(param_1 + 0x1734) = *(int *)(param_1 + 0x1734) + uVar5; } if (*(int *)(param_1 + 0x1734) < 0xe) { *(ushort *)(param_1 + 0x1730) = (ushort)((local_58 - 2U & 0xffff) << ((byte) * (undefined4 *)(param_1 + 0x1734) & 0x1f)) | *(ushort *)(param_1 + 0x1730); *(int *)(param_1 + 0x1734) = *(int *)(param_1 + 0x1734) + 3; } else { *(ushort *)(param_1 + 0x1730) = (ushort)((local_58 - 2U & 0xffff) << ((byte) * (undefined4 *)(param_1 + 0x1734) & 0x1f)) | *(ushort *)(param_1 + 0x1730); lVar3 = *(long *)(param_1 + 0x28); *(long *)(param_1 + 0x28) = lVar3 + 1; *(char *)(lVar3 + *(long *)(param_1 + 0x10)) = (char)*(undefined2 *)(param_1 + 0x1730); lVar3 = *(long *)(param_1 + 0x28); *(long *)(param_1 + 0x28) = lVar3 + 1; *(char *)(lVar3 + *(long *)(param_1 + 0x10)) = (char)((ushort) * (undefined2 *)(param_1 + 0x1730) >> 8); *(short *)(param_1 + 0x1730) = (short)((int)(local_58 - 2U & 0xffff) >> (0x10U - (char)*(undefined4 *)(param_1 + 0x1734) & 0x1f)); *(int *)(param_1 + 0x1734) = *(int *)(param_1 + 0x1734) + -0xd; } } else { uVar5 = (uint) * (ushort *)(param_1 + 0xb06); if ((int)(0x10 - uVar5) < *(int *)(param_1 + 0x1734)) { uVar1 = *(ushort *)(param_1 + 0xb04); *(ushort *)(param_1 + 0x1730) = uVar1 << ((byte) * (undefined4 *)(param_1 + 0x1734) & 0x1f) | *(ushort *)(param_1 + 0x1730); lVar3 = *(long *)(param_1 + 0x28); *(long *)(param_1 + 0x28) = lVar3 + 1; *(char *)(lVar3 + *(long *)(param_1 + 0x10)) = (char)*(undefined2 *)(param_1 + 0x1730); lVar3 = *(long *)(param_1 + 0x28); *(long *)(param_1 + 0x28) = lVar3 + 1; *(char *)(lVar3 + *(long *)(param_1 + 0x10)) = (char)((ushort) * (undefined2 *)(param_1 + 0x1730) >> 8); *(short *)(param_1 + 0x1730) = (short)((int)(uint)uVar1 >> (0x10U - (char)*(undefined4 *)(param_1 + 0x1734) & 0x1f)); *(uint *)(param_1 + 0x1734) = (uVar5 - 0x10) + *(int *)(param_1 + 0x1734); } else { *(ushort *)(param_1 + 0x1730) = *(short *)(param_1 + 0xb04) << ((byte) * (undefined4 *)(param_1 + 0x1734) & 0x1f) | *(ushort *)(param_1 + 0x1730); *(uint *)(param_1 + 0x1734) = *(int *)(param_1 + 0x1734) + uVar5; } if (*(int *)(param_1 + 0x1734) < 10) { *(ushort *)(param_1 + 0x1730) = (ushort)((local_58 - 10U & 0xffff) << ((byte) * (undefined4 *)(param_1 + 0x1734) & 0x1f)) | *(ushort *)(param_1 + 0x1730); *(int *)(param_1 + 0x1734) = *(int *)(param_1 + 0x1734) + 7; } else { *(ushort *)(param_1 + 0x1730) = (ushort)((local_58 - 10U & 0xffff) << ((byte) * (undefined4 *)(param_1 + 0x1734) & 0x1f)) | *(ushort *)(param_1 + 0x1730); lVar3 = *(long *)(param_1 + 0x28); *(long *)(param_1 + 0x28) = lVar3 + 1; *(char *)(lVar3 + *(long *)(param_1 + 0x10)) = (char)*(undefined2 *)(param_1 + 0x1730); lVar3 = *(long *)(param_1 + 0x28); *(long *)(param_1 + 0x28) = lVar3 + 1; *(char *)(lVar3 + *(long *)(param_1 + 0x10)) = (char)((ushort) * (undefined2 *)(param_1 + 0x1730) >> 8); *(short *)(param_1 + 0x1730) = (short)((int)(local_58 - 10U & 0xffff) >> (0x10U - (char)*(undefined4 *)(param_1 + 0x1734) & 0x1f)); *(int *)(param_1 + 0x1734) = *(int *)(param_1 + 0x1734) + -9; } } } else { if (local_5c != local_60) { uVar5 = (uint) * (ushort *)(param_1 + 0xe + ((long)(int)local_5c + 0x2ac) * 4); iVar2 = local_58; if ((int)(0x10 - uVar5) < *(int *)(param_1 + 0x1734)) { uVar1 = *(ushort *)(param_1 + 0xc + ((long)(int)local_5c + 0x2ac) * 4); *(ushort *)(param_1 + 0x1730) = uVar1 << ((byte) * (undefined4 *)(param_1 + 0x1734) & 0x1f) | *(ushort *)(param_1 + 0x1730); lVar3 = *(long *)(param_1 + 0x28); *(long *)(param_1 + 0x28) = lVar3 + 1; *(char *)(lVar3 + *(long *)(param_1 + 0x10)) = (char)*(undefined2 *)(param_1 + 0x1730); lVar3 = *(long *)(param_1 + 0x28); *(long *)(param_1 + 0x28) = lVar3 + 1; *(char *)(lVar3 + *(long *)(param_1 + 0x10)) = (char)((ushort) * (undefined2 *)(param_1 + 0x1730) >> 8); *(short *)(param_1 + 0x1730) = (short)((int)(uint)uVar1 >> (0x10U - (char)*(undefined4 *)(param_1 + 0x1734) & 0x1f)); *(uint *)(param_1 + 0x1734) = (uVar5 - 0x10) + *(int *)(param_1 + 0x1734); } else { *(ushort *)(param_1 + 0x1730) = *(short *)(param_1 + 0xc + ((long)(int)local_5c + 0x2ac) * 4) << ((byte) * (undefined4 *)(param_1 + 0x1734) & 0x1f) | *(ushort *)(param_1 + 0x1730); *(uint *)(param_1 + 0x1734) = *(int *)(param_1 + 0x1734) + uVar5; } } local_58 = iVar2; uVar5 = (uint) * (ushort *)(param_1 + 0xafe); if ((int)(0x10 - uVar5) < *(int *)(param_1 + 0x1734)) { uVar1 = *(ushort *)(param_1 + 0xafc); *(ushort *)(param_1 + 0x1730) = uVar1 << ((byte) * (undefined4 *)(param_1 + 0x1734) & 0x1f) | *(ushort *)(param_1 + 0x1730); lVar3 = *(long *)(param_1 + 0x28); *(long *)(param_1 + 0x28) = lVar3 + 1; *(char *)(lVar3 + *(long *)(param_1 + 0x10)) = (char)*(undefined2 *)(param_1 + 0x1730); lVar3 = *(long *)(param_1 + 0x28); *(long *)(param_1 + 0x28) = lVar3 + 1; *(char *)(lVar3 + *(long *)(param_1 + 0x10)) = (char)((ushort) * (undefined2 *)(param_1 + 0x1730) >> 8); *(short *)(param_1 + 0x1730) = (short)((int)(uint)uVar1 >> (0x10U - (char)*(undefined4 *)(param_1 + 0x1734) & 0x1f)); *(uint *)(param_1 + 0x1734) = (uVar5 - 0x10) + *(int *)(param_1 + 0x1734); } else { *(ushort *)(param_1 + 0x1730) = *(short *)(param_1 + 0xafc) << ((byte) * (undefined4 *)(param_1 + 0x1734) & 0x1f) | *(ushort *)(param_1 + 0x1730); *(uint *)(param_1 + 0x1734) = *(int *)(param_1 + 0x1734) + uVar5; } if (*(int *)(param_1 + 0x1734) < 0xf) { *(ushort *)(param_1 + 0x1730) = (ushort)((local_58 - 3U & 0xffff) << ((byte) * (undefined4 *)(param_1 + 0x1734) & 0x1f)) | *(ushort *)(param_1 + 0x1730); *(int *)(param_1 + 0x1734) = *(int *)(param_1 + 0x1734) + 2; } else { *(ushort *)(param_1 + 0x1730) = (ushort)((local_58 - 3U & 0xffff) << ((byte) * (undefined4 *)(param_1 + 0x1734) & 0x1f)) | *(ushort *)(param_1 + 0x1730); lVar3 = *(long *)(param_1 + 0x28); *(long *)(param_1 + 0x28) = lVar3 + 1; *(char *)(lVar3 + *(long *)(param_1 + 0x10)) = (char)*(undefined2 *)(param_1 + 0x1730); lVar3 = *(long *)(param_1 + 0x28); *(long *)(param_1 + 0x28) = lVar3 + 1; *(char *)(lVar3 + *(long *)(param_1 + 0x10)) = (char)((ushort) * (undefined2 *)(param_1 + 0x1730) >> 8); *(short *)(param_1 + 0x1730) = (short)((int)(local_58 - 3U & 0xffff) >> (0x10U - (char)*(undefined4 *)(param_1 + 0x1734) & 0x1f)); *(int *)(param_1 + 0x1734) = *(int *)(param_1 + 0x1734) + -0xe; } } local_58 = 0; local_60 = local_5c; iVar2 = local_58; if (uVar4 == 0) { local_54 = 0x8a; local_50 = 3; } else if (local_5c == uVar4) { local_54 = 6; local_50 = 3; } else { local_54 = 7; local_50 = 4; } } local_58 = iVar2; local_5c = uVar4; } return; }
zlib
ghidra
static int cmp_version(struct fileinfo const *a, struct fileinfo const *b) { int diff = filevercmp(a->name, b->name); return diff ? diff : strcmp(a->name, b->name); }
void cmp_version(unsigned long long *a0, unsigned long long *a1) { unsigned int v0; unsigned long long v2; unsigned long long v3; v0 = filevercmp(*(a0), *(a1), *(a1)); if (v0) { v2 = v0; return; } v3 = strcmp(*(a0), *(a1)); return; }
coreutils
angr_sailr
char *utf8_mbsmbchar(str) const char *str; { register char *s; for (s = (char *)str; *s; s++) if ((*s & 0xc0) == 0x80) return s; return (0); }
long long utf8_mbsmbchar(unsigned long long a0) { void *v1; void *v2; v1 = a0; while (true) { if (!*(v1)) { v2 = 0; return v2; } else if ((*(v1) & 192) != 128) { v1 += 1; } else { v2 = v1; return v2; } } }
bash
angr_sailr
int sshkey_check_sigtype(const u_char *sig, size_t siglen, const char *requested_alg) { const char *expected_alg; char *sigtype = ((void *)0); int r; if (requested_alg == ((void *)0)) return 0; if ((expected_alg = sshkey_sigalg_by_name(requested_alg)) == ((void *)0)) return -10; if ((r = sshkey_get_sigtype(sig, siglen, &sigtype)) != 0) return r; r = strcmp(expected_alg, sigtype) == 0; free(sigtype); return r ? 0 : -58; }
long long sshkey_check_sigtype(unsigned long long a0, unsigned long long a1, char *a2) { unsigned int v0; void *v1; char *v2; unsigned long long v4; v1 = 0; if (!a2) { v4 = 0; return v4; } v2 = sshkey_sigalg_by_name(a2); if (!v2) { v4 = 4294967286; return v4; } v0 = sshkey_get_sigtype(a0, a1, &v1); if (v0) { v4 = v0; return v4; } v0 = !strcmp(v2, v1); free(v1); v4 = (!v0 ? 0 : 4294967238); return v4; }
openssh-portable
angr_sailr
static struct ea_refcount_el *insert_refcount_el(ext2_refcount_t refcount, ea_key_t ea_key, int pos) { struct ea_refcount_el *el; errcode_t retval; size_t new_size = 0; int num; if (refcount->count >= refcount->size) { new_size = refcount->size + 100; retval = ext2fs_resize_mem( (size_t)refcount->size * sizeof(struct ea_refcount_el), (size_t)new_size * sizeof(struct ea_refcount_el), &refcount->list); if (retval) return 0; refcount->size = new_size; } num = (int)refcount->count - pos; if (num < 0) return 0; if (num) { memmove(&refcount->list[pos + 1], &refcount->list[pos], sizeof(struct ea_refcount_el) * num); } refcount->count++; el = &refcount->list[pos]; el->ea_key = ea_key; el->ea_value = 0; return el; }
void insert_refcount_el(unsigned long long a0[4], unsigned long a1, unsigned long a2) { unsigned int v0; void *v1; unsigned long v2; unsigned long long v3[2]; void *v5; void *v6; unsigned long long v7[2]; v1 = 0; if (a0[0] >= a0[1]) { v1 = a0[1] + 100; v2 = ext2fs_resize_mem(a0[1] * 16, v1 * 16, &a0[3], v1 * 16); if (v2) { v5 = 0; goto LABEL_400306; } else { a0[1] = v1; } } v0 = a0[0] - a2; if (v0 < 0) { v6 = 0; } else { if (v0) memmove(a0[3] + (a2 + 1) * 16, a2 * 16 + a0[3], v0 * 16); a0[0] = a0[0] + 1; v3[0] = a0[3] + a2 * 16; v3[0] = a1; v3[1] = 0; v7 = v3; } LABEL_400306: return; }
e2fsprogs-1.46.5
angr_phoenix
int sshkey_shield_private(struct sshkey *k) { struct sshbuf *prvbuf = ((void *)0); u_char *prekey = ((void *)0), *enc = ((void *)0), keyiv[64]; struct sshcipher_ctx *cctx = ((void *)0); const struct sshcipher *cipher; size_t i, enclen = 0; struct sshkey *kswap = ((void *)0), tmp; int r = -1; if ((cipher = cipher_by_name("aes256-ctr")) == ((void *)0)) { r = -10; goto out; } if (cipher_keylen(cipher) + cipher_ivlen(cipher) > ssh_digest_bytes(4)) { r = -1; goto out; } if ((prekey = malloc((16 * 1024))) == ((void *)0)) { r = -2; goto out; } arc4random_buf(prekey, (16 * 1024)); if ((r = ssh_digest_memory(4, prekey, (16 * 1024), keyiv, 64)) != 0) goto out; if ((r = cipher_init(&cctx, cipher, keyiv, cipher_keylen(cipher), keyiv + cipher_keylen(cipher), cipher_ivlen(cipher), 1)) != 0) goto out; if ((prvbuf = sshbuf_new()) == ((void *)0)) { r = -2; goto out; } if (sshkey_is_shielded(k) && (r = sshkey_unshield_private(k)) != 0) goto out; if ((r = sshkey_private_serialize_opt(k, prvbuf, SSHKEY_SERIALIZE_SHIELD)) != 0) goto out; i = 0; while (sshbuf_len(prvbuf) % cipher_blocksize(cipher)) { if ((r = sshbuf_put_u8(prvbuf, ++i & 0xff)) != 0) goto out; } enclen = sshbuf_len(prvbuf); if ((enc = malloc(enclen)) == ((void *)0)) { r = -2; goto out; } if ((r = cipher_crypt(cctx, 0, enc, sshbuf_ptr(prvbuf), sshbuf_len(prvbuf), 0, 0)) != 0) goto out; if ((r = sshkey_from_private(k, &kswap)) != 0) goto out; tmp = *kswap; *kswap = *k; *k = tmp; k->shielded_private = enc; k->shielded_len = enclen; k->shield_prekey = prekey; k->shield_prekey_len = (16 * 1024); enc = prekey = ((void *)0); enclen = 0; k->sk_flags = kswap->sk_flags; r = 0; out: cipher_free(cctx); explicit_bzero(keyiv, sizeof(keyiv)); explicit_bzero(&tmp, sizeof(tmp)); freezero(enc, enclen); freezero(prekey, (16 * 1024)); sshkey_free(kswap); sshbuf_free(prvbuf); return r; }
int sshkey_shield_private(undefined8 *param_1) { int iVar1; int iVar2; undefined4 uVar3; uint uVar4; undefined4 uVar5; ulong uVar6; long in_FS_OFFSET; undefined8 uVar7; undefined8 uVar8; int local_15c; undefined8 local_158; undefined8 *local_150; long local_148; void *local_140; void *local_138; ulong local_130; size_t local_128; long local_120; undefined8 local_118; undefined8 local_110; undefined8 local_108; undefined8 local_100; undefined8 local_f8; undefined8 local_f0; undefined8 local_e8; undefined8 local_e0; undefined8 local_d8; undefined8 local_d0; undefined8 local_c8; undefined8 local_c0; undefined8 local_b8; undefined8 local_b0; undefined8 local_a8; undefined8 local_a0; undefined8 local_98; undefined8 local_90; undefined8 local_88; undefined8 local_80; undefined8 local_78; undefined local_68[72]; long local_20; local_20 = *(long *)(in_FS_OFFSET + 0x28); local_148 = 0; local_140 = (void *)0x0; local_138 = (void *)0x0; local_158 = 0; local_128 = 0; local_150 = (undefined8 *)0x0; local_120 = cipher_by_name("aes256-ctr"); if (local_120 == 0) { local_15c = -10; } else { iVar1 = cipher_keylen(local_120); iVar2 = cipher_ivlen(local_120); uVar6 = ssh_digest_bytes(4); if (uVar6 < (uint)(iVar2 + iVar1)) { local_15c = -1; } else { local_140 = malloc(0x4000); if (local_140 == (void *)0x0) { local_15c = -2; } else { arc4random_buf(local_140, 0x4000); local_15c = ssh_digest_memory(4, local_140, 0x4000, local_68, 0x40); if (local_15c == 0) { uVar3 = cipher_ivlen(local_120); uVar4 = cipher_keylen(local_120); uVar7 = 0x1043dd; uVar5 = cipher_keylen(local_120); local_15c = cipher_init(&local_158, local_120, local_68, uVar5, local_68 + uVar4, uVar3, 1, uVar7); if (local_15c == 0) { local_148 = sshbuf_new(); if (local_148 == 0) { local_15c = -2; } else { iVar1 = sshkey_is_shielded(param_1); if (((iVar1 == 0) || (local_15c = sshkey_unshield_private(param_1), local_15c == 0)) && (local_15c = sshkey_private_serialize_opt(param_1, local_148, 3), local_15c == 0)) { local_130 = 0; do { uVar6 = sshbuf_len(local_148); uVar4 = cipher_blocksize(local_120); if (uVar6 % (ulong)uVar4 == 0) { local_128 = sshbuf_len(local_148); local_138 = malloc(local_128); if (local_138 == (void *)0x0) { local_15c = -2; } else { uVar3 = sshbuf_len(local_148); uVar8 = 0x104585; uVar7 = sshbuf_ptr(local_148); local_15c = cipher_crypt(local_158, 0, local_138, uVar7, uVar3, 0, 0, uVar8); if ((local_15c == 0) && (local_15c = sshkey_from_private(param_1, &local_150), local_15c == 0)) { local_118 = *local_150; local_110 = local_150[1]; local_108 = local_150[2]; local_100 = local_150[3]; local_f8 = local_150[4]; local_f0 = local_150[5]; local_e8 = local_150[6]; local_e0 = local_150[7]; local_d8 = local_150[8]; local_d0 = local_150[9]; local_c8 = local_150[10]; local_c0 = local_150[0xb]; local_b8 = local_150[0xc]; local_b0 = local_150[0xd]; local_a8 = local_150[0xe]; local_a0 = local_150[0xf]; local_98 = local_150[0x10]; local_90 = local_150[0x11]; local_88 = local_150[0x12]; local_80 = local_150[0x13]; local_78 = local_150[0x14]; uVar7 = param_1[1]; *local_150 = *param_1; local_150[1] = uVar7; uVar7 = param_1[3]; local_150[2] = param_1[2]; local_150[3] = uVar7; uVar7 = param_1[5]; local_150[4] = param_1[4]; local_150[5] = uVar7; uVar7 = param_1[7]; local_150[6] = param_1[6]; local_150[7] = uVar7; uVar7 = param_1[9]; local_150[8] = param_1[8]; local_150[9] = uVar7; uVar7 = param_1[0xb]; local_150[10] = param_1[10]; local_150[0xb] = uVar7; uVar7 = param_1[0xd]; local_150[0xc] = param_1[0xc]; local_150[0xd] = uVar7; uVar7 = param_1[0xf]; local_150[0xe] = param_1[0xe]; local_150[0xf] = uVar7; uVar7 = param_1[0x11]; local_150[0x10] = param_1[0x10]; local_150[0x11] = uVar7; uVar7 = param_1[0x13]; local_150[0x12] = param_1[0x12]; local_150[0x13] = uVar7; local_150[0x14] = param_1[0x14]; *param_1 = local_118; param_1[1] = local_110; param_1[2] = local_108; param_1[3] = local_100; param_1[4] = local_f8; param_1[5] = local_f0; param_1[6] = local_e8; param_1[7] = local_e0; param_1[8] = local_d8; param_1[9] = local_d0; param_1[10] = local_c8; param_1[0xb] = local_c0; param_1[0xc] = local_b8; param_1[0xd] = local_b0; param_1[0xe] = local_a8; param_1[0xf] = local_a0; param_1[0x10] = local_98; param_1[0x11] = local_90; param_1[0x12] = local_88; param_1[0x13] = local_80; param_1[0x14] = local_78; param_1[0x11] = local_138; param_1[0x12] = local_128; param_1[0x13] = local_140; param_1[0x14] = 0x4000; local_140 = (void *)0x0; local_138 = (void *)0x0; local_128 = 0; *(undefined *)(param_1 + 0xd) = *(undefined *)(local_150 + 0xd); local_15c = 0; } } break; } local_130 = local_130 + 1; local_15c = sshbuf_put_u8(local_148, local_130 & 0xff); } while (local_15c == 0); } } } } } } } cipher_free(local_158); explicit_bzero(local_68, 0x40); explicit_bzero(&local_118, 0xa8); freezero(local_138, local_128); freezero(local_140, 0x4000); sshkey_free(local_150); sshbuf_free(local_148); if (local_20 == *(long *)(in_FS_OFFSET + 0x28)) { return local_15c; } __stack_chk_fail(); }
openssh-portable
ghidra
static char *pos_params(string, start, end, quoted, pflags) char *string; int start, end, quoted, pflags; { WORD_LIST *save, *params, *h, *t; char *ret; int i; if (start == end) return ((char *)((void *)0)); save = params = list_rest_of_args(); if (save == 0 && start > 0) return ((char *)((void *)0)); if (start == 0) { t = make_word_list(make_word(dollar_vars[0]), params); save = params = t; } for (i = start ? 1 : 0; params && i < start; i++) params = params->next; if (params == 0) { dispose_words(save); return ((char *)((void *)0)); } for (h = t = params; params && i < end; i++) { t = params; params = params->next; } t->next = (WORD_LIST *)((void *)0); ret = string_list_pos_params(string[0], h, quoted, pflags); if (t != params) t->next = params; dispose_words(save); return (ret); }
int pos_params(char *a0, unsigned long a1, unsigned long a2, unsigned long a3, unsigned long long a4, unsigned long long a5) { unsigned int v0; unsigned long long *v1; unsigned long long *v2; unsigned long long *v3; unsigned long long *v4; unsigned long v5; unsigned int v7; if (a1 == a2) { v7 = 0; } else { v2 = list_rest_of_args(); v1 = v2; if (!v1 && a1 > 0) { v7 = 0; goto LABEL_409609; } if (!a1) { v7 = make_word(dollar_vars); v3 = make_word_list(v7, v2, v7); v2 = v3; v1 = v2; } v0 = a1; while (true) { if (!v2) break; if (v0 >= a1) break; v2 = *(v2); v0 += 1; } if (!v2) { dispose_words(v1); v7 = 0; } else { v3 = v2; v4 = v3; while (true) { if (!v2) break; if (v0 >= a2) break; v3 = v2; v2 = *(v2); v0 += 1; } *(v3) = 0; v5 = string_list_pos_params(*(a0), v4, a3, a4, a4, a5); if (v3 != v2) *(v3) = v2; dispose_words(v1); v7 = v5; } } LABEL_409609: return v7; }
bash
angr_phoenix
static int pgetc_eatbnl(void) { int c; while ((c = pgetc()) == '\\') { if (pgetc() != '\n') { pungetc(); break; } nlprompt(); } return c; }
int pgetc_eatbnl(void) { int iVar1; while (true) { iVar1 = pgetc(); if (iVar1 != 0x5c) { return iVar1; } iVar1 = pgetc(); if (iVar1 != 10) break; nlprompt(); } pungetc(); return 0x5c; }
dash-0.5.11+git20210903+057cd650a4ed
ghidra
int main(int argc, char **argv) { int ret; struct passwd *pwd; unsigned char key[512]; size_t key_size; const char *passwd, *username; if ((ret = gnutls_global_init()) < 0) { fprintf(stderr, "global_init: %s\n", gnutls_strerror(ret)); exit(1); } umask(066); process_options(argc, argv); if (!psktool_options.present.pskfile) { fprintf(stderr, "You need to specify a PSK key file\n"); exit(1); } else passwd = psktool_options.arg.pskfile; if (!psktool_options.present.username) { pwd = getpwuid(getuid()); if (pwd == ((void *)0)) { fprintf(stderr, "No such user\n"); return -1; } username = pwd->pw_name; } else username = psktool_options.arg.username; if (psktool_options.present.keysize && psktool_options.value.keysize > 512) { fprintf(stderr, "Key size is too long\n"); exit(1); } if (!psktool_options.present.keysize || psktool_options.value.keysize < 1) key_size = 32; else key_size = psktool_options.value.keysize; printf("Generating a random key for user '%s'\n", username); ret = gnutls_rnd(GNUTLS_RND_RANDOM, (char *)key, key_size); if (ret < 0) { fprintf(stderr, "Not enough randomness\n"); exit(1); } ret = write_key(username, key, key_size, passwd); if (ret == 0) printf("Key stored to %s\n", passwd); return ret; }
int main(unsigned long a0, unsigned long long a1) { unsigned int v0; unsigned long long v1; char *v2; char *v3; unsigned long long *v4; char v5; unsigned int v7; v0 = gnutls_global_init(); if (v0 < 0) { fprintf(*(&stderr), "global_init: %s\n", gnutls_strerror(v0)); exit(0x1); } umask(0x36); process_options(a0, a1, a1); if ((g_50003b ^ 1)) { fprintf(*(&stderr), "You need to specify a PSK key file\n"); exit(0x1); } v3 = gnutls_rnd; if ((g_50003a ^ 1)) { v4 = &getpwuid(getuid())->pw_name; if (!v4) { fprintf(*(&stderr), "No such user\n"); v7 = -1; } else { v2 = *(v4); } } else { v2 = printf; } if (!(g_50003a ^ 1) || v4) { if (g_500039 && g_50006c > 0x200) { fprintf(*(&stderr), "Key size is too long\n"); exit(0x1); } if (!g_500039 || g_50006c <= 0x200) { if (v0 < 0) { fprintf(*(&stderr), "Not enough randomness\n"); exit(0x1); } v0 = write_key(v2, &v5, v1, v3); if (!v0) printf("Key stored to %s\n", v3); v7 = v0; } } if (!g_500039 && !(g_50003a ^ 1) || g_50006c <= 0x200 && !(g_50003a ^ 1) || !g_500039 && v4 || g_50006c <= 0x200 && v4) { if (!(g_500039 ^ 1) && g_50006c > 0) v1 = g_50006c; if (g_50006c <= 0 || (g_500039 ^ 1)) v1 = 32; printf("Generating a random key for user '%s'\n", v2); v0 = gnutls_rnd(0x1, &v5, v1); } if (!g_500039 && v0 >= 0 || g_50006c <= 0x200 && v0 >= 0 || !v4 && (g_50003a ^ 1)) return v7; }
gnutls
angr_dream
static int download_dir_internal(struct sftp_conn *conn, const char *src, const char *dst, int depth, Attrib *dirattrib, int preserve_flag, int print_flag, int resume_flag, int fsync_flag, int follow_link_flag, int inplace_flag) { int i, ret = 0; SFTP_DIRENT **dir_entries; char *filename, *new_src = ((void *)0), *new_dst = ((void *)0); mode_t mode = 0777, tmpmode = mode; if (depth >= 64) { sshlog("sftp-client.c", __func__, 1871, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "Maximum directory depth exceeded: %d levels", depth); return -1; } sshlog("sftp-client.c", __func__, 1875, 1, SYSLOG_LEVEL_DEBUG2, ((void *)0), "download dir remote \"%s\" to local \"%s\"", src, dst); if (dirattrib == ((void *)0) && (dirattrib = do_stat(conn, src, 1)) == ((void *)0)) { sshlog("sftp-client.c", __func__, 1879, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "stat remote \"%s\" directory failed", src); return -1; } if (!((((dirattrib->perm)) & 0170000) == (0040000))) { sshlog("sftp-client.c", __func__, 1883, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "\"%s\" is not a directory", src); return -1; } if (print_flag && print_flag != 2) mprintf("Retrieving %s\n", src); if (dirattrib->flags & 0x00000004) { mode = dirattrib->perm & 01777; tmpmode = mode | (0200 | 0100); } else { sshlog("sftp-client.c", __func__, 1893, 0, SYSLOG_LEVEL_DEBUG1, ((void *)0), "download remote \"%s\": server " "did not send permissions", dst); } if (mkdir(dst, tmpmode) == -1 && (*__errno_location()) != 17) { sshlog("sftp-client.c", __func__, 1898, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "mkdir %s: %s", dst, strerror((*__errno_location()))); return -1; } if (do_readdir(conn, src, &dir_entries) == -1) { sshlog("sftp-client.c", __func__, 1903, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "remote readdir \"%s\" failed", src); return -1; } for (i = 0; dir_entries[i] != ((void *)0) && !interrupted; i++) { free(new_dst); free(new_src); filename = dir_entries[i]->filename; new_dst = path_append(dst, filename); new_src = path_append(src, filename); if (((((dir_entries[i]->a.perm)) & 0170000) == (0040000))) { if (strcmp(filename, ".") == 0 || strcmp(filename, "..") == 0) continue; if (download_dir_internal(conn, new_src, new_dst, depth + 1, &(dir_entries[i]->a), preserve_flag, print_flag, resume_flag, fsync_flag, follow_link_flag, inplace_flag) == -1) ret = -1; } else if (((((dir_entries[i]->a.perm)) & 0170000) == (0100000)) || (follow_link_flag && ((((dir_entries[i]->a.perm)) & 0170000) == (0120000)))) { if (do_download(conn, new_src, new_dst, ((((dir_entries[i]->a.perm)) & 0170000) == (0120000)) ? ((void *)0) : &(dir_entries[i]->a), preserve_flag, resume_flag, fsync_flag, inplace_flag) == -1) { sshlog("sftp-client.c", __func__, 1936, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "Download of file %s to %s failed", new_src, new_dst); ret = -1; } } else sshlog("sftp-client.c", __func__, 1941, 0, SYSLOG_LEVEL_INFO, ((void *)0), "download \"%s\": not a regular file", new_src); } free(new_dst); free(new_src); if (preserve_flag) { if (dirattrib->flags & 0x00000008) { struct timeval tv[2]; tv[0].tv_sec = dirattrib->atime; tv[1].tv_sec = dirattrib->mtime; tv[0].tv_usec = tv[1].tv_usec = 0; if (utimes(dst, tv) == -1) sshlog("sftp-client.c", __func__, 1954, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "local set times on \"%s\": %s", dst, strerror((*__errno_location()))); } else sshlog("sftp-client.c", __func__, 1957, 0, SYSLOG_LEVEL_DEBUG1, ((void *)0), "Server did not send times for directory " "\"%s\"", dst); } if (mode != tmpmode && chmod(dst, mode) == -1) sshlog("sftp-client.c", __func__, 1962, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "local chmod directory \"%s\": %s", dst, strerror((*__errno_location()))); free_sftp_dirents(dir_entries); return ret; }
int download_dir_internal(void *a0, char *a1, char *a2, unsigned long a3, unsigned long a4, unsigned long a5, unsigned int v14, unsigned int a6, unsigned int a7, unsigned int a8, unsigned int a9) { unsigned long v0; unsigned int v1; unsigned int v2; unsigned int v3; unsigned int v4; unsigned int v5; char v6; void *v7; void *v8; char *v9; unsigned long v10; void *v11; unsigned long v12; void *v13; unsigned int v15; v1 = a3; v0 = a4; v3 = 0; v7 = 0; v8 = 0; v4 = 511; v5 = v4; if (v1 > 63) { sshlog("sftp-client.c", "download_dir_internal", 0x74f, 0x0, 0x2, 0x0, "Maximum directory depth exceeded: %d levels"); v15 = -1; return v15; } sshlog("sftp-client.c", "download_dir_internal", 0x753, 0x1, 0x6, 0x0, "download dir remote \"%s\" to local \"%s\""); if (!v0) { v15 = do_stat(a0, a1, 0x1); *(&v0) = v15; if (!v0) { sshlog("sftp-client.c", "download_dir_internal", 0x757, 0x0, 0x2, 0x0, "stat remote \"%s\" directory failed"); v15 = -1; return v15; } } if ((*((v0 + 24)) & 0xf000) != 0x4000) { sshlog("sftp-client.c", "download_dir_internal", 0x75b, 0x0, 0x2, 0x0, "\"%s\" is not a directory"); v15 = -1; return v15; } switch (v14) { case 0: case 2: break; default: mprintf("Retrieving %s\n", a1); } if ((*(v0) & 4)) { v4 = *((v0 + 24)) & 1023; v15 = v4; *(&v15) = v4 | 192; v5 = v15; } else { sshlog("sftp-client.c", "download_dir_internal", 0x765, 0x0, 0x5, 0x0, "download remote \"%s\": server did not send permissions"); } if (mkdir(a2, v5) == -1) { v15 = *(__errno_location()); if (v15 != 17) { strerror(*(__errno_location())); sshlog("sftp-client.c", "download_dir_internal", 0x76a, 0x0, 0x2, 0x0, "mkdir %s: %s"); v15 = -1; return v15; } } if (do_readdir(a0, a1, &v6) == -1) { sshlog("sftp-client.c", "download_dir_internal", 0x76f, 0x0, 0x2, 0x0, "remote readdir \"%s\" failed"); v15 = -1; return v15; } v2 = 0; while (true) { if (!(*((*(&v6) + (v2 << 3)))) || !(!interrupted)) break; free(v8); free(v7); v9 = *(*((*(&v6) + v2 * 8))); v8 = path_append(a2, v9); v7 = path_append(a1, v9); switch (*((*((*(&v6) + (v2 << 3))) + 40)) & 0xf000) { case 16384: if (!strcmp(v9, ".") || !strcmp(v9, "..")) { break; } else if (download_dir_internal(a0, v7, v8, __addvsi3(v1, 0x1), *((*(&v6) + v2 * 8)) + 16, a5, v14, a6, a7, a8, a9) == -1) { v3 = -1; break; } case 32768: LABEL_40765c: if (do_download(a0, v7, v8, ((*((*((*(&v6) + (v2 << 3))) + 40)) & 0xf000) == 0xa000 ? *((*(&v6) + v2 * 8)) + 16 : 0), a5, a6, a7, a9) == -1) { sshlog("sftp-client.c", "download_dir_internal", 0x790, 0x0, 0x2, 0x0, "Download of file %s to %s failed"); v3 = -1; break; } default: if (!a8 || (*((*((*(&v6) + (v2 << 3))) + 40)) & 0xf000) != 0xa000) goto LABEL_40771f; else goto LABEL_40765c; } LABEL_40771f: sshlog("sftp-client.c", "download_dir_internal", 0x795, 0x0, 0x3, 0x0, "download \"%s\": not a regular file"); v2 = __addvsi3(v2, 0x1); } free(v8); free(v7); if (a5) { if ((*(v0) & 8)) { v10 = *((v0 + 28)); v12 = *((v0 + 32)); v13 = 0; v11 = v13; if (utimes(a2, &v10) == -1) { strerror(*(__errno_location())); sshlog("sftp-client.c", "download_dir_internal", 0x7a2, 0x0, 0x2, 0x0, "local set times on \"%s\": %s"); } } else { sshlog("sftp-client.c", "download_dir_internal", 0x7a5, 0x0, 0x5, 0x0, "Server did not send times for directory \"%s\""); } } if (v4 != v5 && chmod(a2, v4) == -1) { strerror(*(__errno_location())); sshlog("sftp-client.c", "download_dir_internal", 0x7aa, 0x0, 0x2, 0x0, "local chmod directory \"%s\": %s"); } free_sftp_dirents(*(&v6)); v15 = v3; return v15; }
openssh-portable
angr_sailr
static void get_field_values(struct field_values_t *bv, struct field_values_t *iv, const struct fs_usage *fsu) { iv->input_units = iv->output_units = 1; iv->total = fsu->fsu_files; iv->available = iv->available_to_root = fsu->fsu_ffree; iv->negate_available = 0; iv->used = (18446744073709551615UL); iv->negate_used = 0; if (known_value(iv->total) && known_value(iv->available_to_root)) { iv->used = iv->total - iv->available_to_root; iv->negate_used = (iv->total < iv->available_to_root); } bv->input_units = fsu->fsu_blocksize; bv->output_units = output_block_size; bv->total = fsu->fsu_blocks; bv->available = fsu->fsu_bavail; bv->available_to_root = fsu->fsu_bfree; bv->negate_available = (fsu->fsu_bavail_top_bit_set && known_value(fsu->fsu_bavail)); bv->used = (18446744073709551615UL); bv->negate_used = 0; if (known_value(bv->total) && known_value(bv->available_to_root)) { bv->used = bv->total - bv->available_to_root; bv->negate_used = (bv->total < bv->available_to_root); } }
void get_field_values(struct_1 *a0, struct_1 *a1, struct_0 *a2) { unsigned int v1; struct_1 *v4; a1->field_8 = 1; a1->field_0 = a1->field_8; a1->field_10 = a2->field_28; a1->field_28 = a2->field_30; a1->field_18 = a1->field_28; a1->field_20 = 0; a1->field_30 = -1; a1->field_38 = 0; if (known_value(a1->field_10) && known_value(a1->field_28)) { a1->field_30 = a1->field_10 - a1->field_28; a1->field_38 = a1->field_10 < a1->field_28; } a0->field_0 = a2->field_0; a0->field_8 = output_block_size; a0->field_10 = a2->field_8; a0->field_18 = a2->field_18; a0->field_28 = a2->field_10; if (!a2->field_20 || !known_value(a2->field_18)) v1 = 0; else v1 = 1; *(&v1) = v1 & 1; a0->field_20 = v1; a0->field_30 = -1; a0->field_38 = 0; if (!known_value(a0->field_10)) { return; } else if (!known_value(a0->field_28)) { return; } else { a0->field_30 = a0->field_10 - a0->field_28; v4 = a0; a0->field_38 = a0->field_10 < a0->field_28; return; } }
coreutils
angr_sailr
int set_file_atime(int fd, int parentfd, char const *file, struct timespec atime) { struct timespec ts[2]; ts[0] = atime; ts[1].tv_nsec = ((1l << 30) - 2l); return fdutimensat(fd, parentfd, file, ts, fstatat_flags); }
long set_file_atime(unsigned int a1, unsigned int a2, long a3, long a4, long a5) { long v6[6]; v6[5] = __readfsqword(0x28u); v6[0] = a4; v6[1] = a5; v6[3] = 1073741822LL; return fdutimensat(a1, a2, a3, v6, (unsigned int)fstatat_flags); }
tar
ida
gnutls_pk_algorithm_t figure_key_type(const char *key_type) { if (strcasecmp(key_type, "rsa") == 0) return GNUTLS_PK_RSA; else if (strcasecmp(key_type, "rsa-pss") == 0) return GNUTLS_PK_RSA_PSS; else if (strcasecmp(key_type, "ed25519") == 0 || strcasecmp(key_type, "eddsa") == 0) return GNUTLS_PK_EDDSA_ED25519; else if (strcasecmp(key_type, "ed448") == 0) return GNUTLS_PK_EDDSA_ED448; else if (strcasecmp(key_type, "x25519") == 0) return GNUTLS_PK_ECDH_X25519; else if (strcasecmp(key_type, "x448") == 0) return GNUTLS_PK_ECDH_X448; else if (strcasecmp(key_type, "dsa") == 0) return GNUTLS_PK_DSA; else if (strcasecmp(key_type, "ecdsa") == 0 || strcasecmp(key_type, "ecc") == 0) return GNUTLS_PK_ECDSA; else if (strcasecmp(key_type, "gost01") == 0) return GNUTLS_PK_GOST_01; else if (strcasecmp(key_type, "gost12-256") == 0) return GNUTLS_PK_GOST_12_256; else if (strcasecmp(key_type, "gost12-512") == 0) return GNUTLS_PK_GOST_12_512; else { fprintf(stderr, "unknown key type: %s\n", key_type); return GNUTLS_PK_UNKNOWN; } }
long long figure_key_type(char *a0) { unsigned long long v1; if (!strcasecmp(a0, "rsa")) { v1 = 1; return v1; } else if (!strcasecmp(a0, "rsa-pss")) { v1 = 6; return v1; } else if (!strcasecmp(a0, "ed25519")) { v1 = 7; return v1; } else if (!strcasecmp(a0, "eddsa")) { v1 = 7; return v1; } else if (!strcasecmp(a0, "ed448")) { v1 = 12; return v1; } else if (!strcasecmp(a0, "x25519")) { v1 = 5; return v1; } else if (!strcasecmp(a0, "x448")) { v1 = 11; return v1; } else if (!strcasecmp(a0, "dsa")) { v1 = 2; return v1; } else if (!strcasecmp(a0, "ecdsa")) { v1 = 4; return v1; } else if (!strcasecmp(a0, "ecc")) { v1 = 4; return v1; } else if (!strcasecmp(a0, "gost01")) { v1 = 8; return v1; } else if (!strcasecmp(a0, "gost12-256")) { v1 = 9; return v1; } else if (strcasecmp(a0, "gost12-512")) { fprintf(stderr, "unknown key type: %s\n", a0); v1 = 0; return v1; } else { v1 = 10; return v1; } }
gnutls
angr_sailr
1 , 0, gettext ("%s is not the name of an existing group"), quotearg_n_style (0, options.err_quoting_style, groupname)), (( 0 ) ? (void) 0 : __builtin_unreachable ())))) ; } else { ((!!sizeof(struct { _Static_assert(1, "verify_expr (" "1" ", " "(error (1, 0, gettext (\"argument to -group is empty, " "but should be a group name\")), assume (false))" ")"); int _gl_dummy; })) ? ((error(1, 0, gettext("argument to -group is empty, but should be a " "group name")), ((0) ? (void)0 : __builtin_unreachable()))) : ((error(1, 0, gettext("argument to -group is empty, but should be a " "group name")), ((0) ? (void)0 : __builtin_unreachable())))); }
void gettext(void) { halt_baddata(); }
findutils
ghidra
static struct change *build_reverse_script(struct file_data const filevec[]) { struct change *script = 0; char *changed0 = filevec[0].changed; char *changed1 = filevec[1].changed; lin len0 = filevec[0].buffered_lines; lin len1 = filevec[1].buffered_lines; lin i0 = 0, i1 = 0; while (i0 < len0 || i1 < len1) { if (changed0[i0] | changed1[i1]) { lin line0 = i0, line1 = i1; while (changed0[i0]) ++i0; while (changed1[i1]) ++i1; script = add_change(line0, line1, i0 - line0, i1 - line1, script); } i0++, i1++; } return script; }
undefined8 build_reverse_script(long param_1) { long lVar1; long lVar2; long lVar3; long lVar4; long lVar5; long lVar6; undefined8 local_50; long local_48; long local_40; local_50 = 0; lVar1 = *(long *)(param_1 + 0x118); lVar2 = *(long *)(param_1 + 0x248); lVar3 = *(long *)(param_1 + 200); lVar4 = *(long *)(param_1 + 0x1f8); local_48 = 0; for (local_40 = 0; (lVar6 = local_40, lVar5 = local_48, local_48 < lVar3 || (local_40 < lVar4)); local_40 = local_40 + 1) { if ((*(byte *)(lVar2 + local_40) | *(byte *)(lVar1 + local_48)) != 0) { for (; *(char *)(lVar1 + local_48) != '\0'; local_48 = local_48 + 1) { } for (; *(char *)(lVar2 + local_40) != '\0'; local_40 = local_40 + 1) { } local_50 = add_change(lVar5, lVar6, local_48 - lVar5, local_40 - lVar6, local_50); } local_48 = local_48 + 1; } return local_50; }
diffutils
ghidra
static void permission_set_get_array(struct ssh *ssh, int who, int where, struct permission ***permpp, u_int **npermpp) { struct permission_set *pset = permission_set_get(ssh, where); switch (who) { case 0x101: *permpp = &pset->permitted_user; *npermpp = &pset->num_permitted_user; break; case 0x100: *permpp = &pset->permitted_admin; *npermpp = &pset->num_permitted_admin; break; default: sshfatal("channels.c", __func__, 543, 1, SYSLOG_LEVEL_FATAL, ((void *)0), "invalid forwarding client %d", who); } }
long *permission_set_get_array(long a1, unsigned int a2, unsigned int a3, _QWORD *a4, long *a5) { long *result; long v8; v8 = permission_set_get(a1, a3); if (a2 == 256) { *a4 = v8 + 24; result = a5; *a5 = v8 + 16; } else if (a2 == 257) { *a4 = v8 + 8; result = a5; *a5 = v8; } else { return (long *)sshfatal("channels.c", "permission_set_get_array", 543LL, 1LL, 1LL, 0LL, "invalid forwarding client %d", a2); } return result; }
openssh-portable
ida
static char **expand_amble(text, tlen, flags) char *text; size_t tlen; int flags; { char **result, **partial, **tresult; char *tem; int start, i, c; mbstate_t state; memset(&state, '\0', sizeof(mbstate_t)); result = (char **)((void *)0); start = i = 0; c = 1; while (c) { c = brace_gobbler(text, tlen, &i, brace_arg_separator); tem = substring(text, start, i); partial = brace_expand(tem); if (!result) result = partial; else { register int lr, lp, j; lr = strvec_len(result); lp = strvec_len(partial); tresult = strvec_mresize(result, lp + lr + 1); if (tresult == 0) { internal_error( gettext("brace expansion: cannot allocate memory for %s"), tem); sh_xfree((tem), "braces.c", 328); strvec_dispose(partial); strvec_dispose(result); result = (char **)((void *)0); return result; } else result = tresult; for (j = 0; j < lp; j++) result[lr + j] = partial[j]; result[lr + j] = (char *)((void *)0); sh_xfree((partial), "braces.c", 341); } sh_xfree((tem), "braces.c", 343); do { if (locale_mb_cur_max > 1) { mbstate_t state_bak; size_t mblength; int _f; _f = is_basic((text)[i]); if (_f) mblength = 1; else if (locale_utf8locale && (((text)[i] & 0x80) == 0)) mblength = (text)[i] != 0; else { state_bak = state; mblength = mbrlen((text) + (i), (tlen) - (i), &state); } if (mblength == (size_t)-2 || mblength == (size_t)-1) { state = state_bak; (i)++; } else if (mblength == 0) (i)++; else (i) += mblength; } else (i)++; } while (0); start = i; } return (result); }
int expand_amble(char *a0, unsigned int a1, unsigned long a2) { unsigned int v0; unsigned int v1; unsigned int v2; unsigned int v3; unsigned int v4; void *v5; unsigned long long v6; char *v7; void *v8; unsigned long v9; unsigned long long v10; unsigned long long v11; unsigned long long v13; unsigned long long v14; void *v15; v0 = a2; memset(&v10, 0x0, 0x8); v5 = 0; v1 = 0; v2 = v1; for (v3 = 1; v3; v2 = v1) { v3 = brace_gobbler(a0, a1, &v1, 0x2c); v7 = substring(a0, v2, v1); v8 = brace_expand(v7); if (!v5) { v5 = v8; } else { v13 = strvec_len(v5); v14 = strvec_len(v8); v9 = strvec_mresize(v5, v14 + v13 + 1, v14 + v13 + 1); if (!v9) { v14 = gettext("brace expansion: cannot allocate memory for %s"); internal_error(v14, v7, v14); sh_xfree(v7, "braces.c", 0x148); strvec_dispose(v8); strvec_dispose(v5); v5 = 0; *(&v14) = v5; return v14; } v5 = v9; for (v15 = 0; v15 < v14; v15 = v15 + 1) { *((&v5[v13] + 0x8 * v15)) = *((v8 + 0x8 * v15)); } *((&v5[v13] + 0x8 * v15)) = 0; sh_xfree(v8, "braces.c", 0x155); } sh_xfree(v7, "braces.c", 0x157); if (locale_mb_cur_max <= 1) { v1 += 1; } else { v4 = is_basic(a0[v1]); if (v4) { v6 = 1; } else if (!locale_utf8locale || a0[v1] < 0) { v11 = v10; v6 = mbrlen(&a0[v1], a1 - v1, &v10, &a0[v1]); } else { v6 = a0[v1]; } if (v6 == -2 || v6 == -1) { v10 = v11; v1 += 1; } else if (!v6) { v1 += 1; } else { v1 += v6; } } } *(&v14) = v5; return v14; }
bash
angr_sailr
gl_linked_last_node(gl_list_t list) { if (list->count > 0) return list->root.prev; else return ((void *)0); }
long gl_linked_last_node(long a1) { if (*(_QWORD *)(a1 + 64)) return *(_QWORD *)(a1 + 48); else return 0LL; }
gnutls
ida
ct_visual_string(const wchar_t *s, ct_buffer_t *conv) { wchar_t *dst; ssize_t used; if (!s) return ((void *)0); if (ct_conv_wbuff_resize(conv, ((size_t)1024)) == -1) return ((void *)0); used = 0; dst = conv->wbuff; while (*s) { used = ct_visual_char(dst, conv->wsize - (size_t)(dst - conv->wbuff), *s); if (used != -1) { ++s; dst += used; continue; } used = dst - conv->wbuff; if (ct_conv_wbuff_resize(conv, conv->wsize + ((size_t)1024)) == -1) return ((void *)0); dst = conv->wbuff + used; } if (dst >= (conv->wbuff + conv->wsize)) { used = dst - conv->wbuff; if (ct_conv_wbuff_resize(conv, conv->wsize + ((size_t)1024)) == -1) return ((void *)0); dst = conv->wbuff + used; } *dst = L'\0'; return conv->wbuff; }
long long ct_visual_string(unsigned long a0, unsigned long long a1[4]) { unsigned int *v0; unsigned int *v1; unsigned long long v2; void *v4; unsigned long long v7; v0 = a0; if (!v0) { v4 = 0; } else if (ct_conv_wbuff_resize(a1, 0x400) == -1) { v4 = 0; } else { v2 = 0; v1 = a1[2]; while (true) { if (*(v0)) { v2 = ct_visual_char(v1, a1[3] - (v1 + -1 * a1[2] >> 2), *(v0)); if (v2 != -1) { v0 += 1; v1 = &v1[v2]; } else { v2 = v1 + -1 * a1[2] >> 2; if (ct_conv_wbuff_resize(a1, a1[3] + 0x400) == -1) { v4 = 0; break; } else { v1 = a1[2] + v2 * 4; } } } else { if (v1 >= (a1[3] << 2) + a1[2]) { v2 = v1 + -1 * a1[2] >> 2; v7 = ct_conv_wbuff_resize(a1, a1[3] + 0x400); if (v7 == -1) { v4 = 0; break; } else { v1 = a1[2] + v2 * 4; } } if (v1 < (a1[3] << 2) + a1[2] || v7 != -1) { *(v1) = 0; v4 = a1[2]; break; } } } } return v4; }
libedit
angr_dream
static void usage(int status) { FILE *usageout = (0 != status) ? stderr : stdout; (void)fprintf(usageout, gettext("Usage: %s [options]\n" "\n" "Options:\n") , Prog); (void)fputs(gettext(" -b, --before DAYS print only lastlog " "records older than DAYS\n"), usageout); (void)fputs(gettext(" -C, --clear clear lastlog record of " "an user (usable only with -u)\n"), usageout); (void)fputs(gettext(" -h, --help display this help " "message and exit\n"), usageout); (void)fputs( gettext(" -R, --root CHROOT_DIR directory to chroot into\n"), usageout); (void)fputs(gettext(" -S, --set set lastlog record to " "current time (usable only with -u)\n"), usageout); (void)fputs(gettext(" -t, --time DAYS print only lastlog " "records more recent than DAYS\n"), usageout); (void)fputs(gettext(" -u, --user LOGIN print lastlog record of " "the specified LOGIN\n"), usageout); (void)fputs("\n", usageout); exit(status); }
void usage(int param_1) { undefined8 uVar1; FILE *__stream; char *pcVar2; uVar1 = Prog; __stream = stdout; if (param_1 != 0) { __stream = stderr; } pcVar2 = (char *)gettext("Usage: %s [options]\n\nOptions:\n"); fprintf(__stream, pcVar2, uVar1); pcVar2 = (char *)gettext(" -b, --before DAYS print only lastlog " "records older than DAYS\n"); fputs(pcVar2, __stream); pcVar2 = (char *)gettext(" -C, --clear clear lastlog " "record of an user (usable only with -u)\n"); fputs(pcVar2, __stream); pcVar2 = (char *)gettext( " -h, --help display this help message and exit\n"); fputs(pcVar2, __stream); pcVar2 = (char *)gettext( " -R, --root CHROOT_DIR directory to chroot into\n"); fputs(pcVar2, __stream); pcVar2 = (char *)gettext(" -S, --set set lastlog record " "to current time (usable only with -u)\n"); fputs(pcVar2, __stream); pcVar2 = (char *)gettext(" -t, --time DAYS print only lastlog " "records more recent than DAYS\n"); fputs(pcVar2, __stream); pcVar2 = (char *)gettext(" -u, --user LOGIN print lastlog " "record of the specified LOGIN\n"); fputs(pcVar2, __stream); fputs("\n", __stream); exit(param_1); }
shadow
ghidra
_Bool *changed); static void fail_exit(int status) { if (gr_locked) { if (gr_unlock() == 0) { fprintf(stderr, gettext("%s: failed to " "unlock %s\n"), Prog, gr_dbname()); 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(3, "failed to unlock %s", gr_dbname()); if (((void *)0) != saved_locale) { (void)setlocale(6, saved_locale); free(saved_locale); } } while (0); } } if (sgr_locked) { if (sgr_unlock() == 0) { fprintf(stderr, gettext("%s: failed to " "unlock %s\n"), Prog, sgr_dbname()); 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(3, "failed to unlock %s", sgr_dbname()); if (((void *)0) != saved_locale) { (void)setlocale(6, saved_locale); free(saved_locale); } } while (0); } } closelog(); exit(status); }
void fail_exit(int a1) { long v1; long v2; char *v3; const char *v4; long v5; long v6; char *v7; const char *v8; char *locale; char *v10; const char *s; const char *v12; if (gr_locked && !(unsigned int)gr_unlock()) { v1 = gr_dbname(); v2 = Prog; v3 = gettext("%s: failed to unlock %s\n"); fprintf(stderr, v3, v2, v1); s = setlocale(6, 0LL); locale = 0LL; if (s) locale = strdup(s); if (locale) setlocale(6, "C"); v4 = (const char *)gr_dbname(); syslog(3, "failed to unlock %s", v4); if (locale) { setlocale(6, locale); free(locale); } } if (sgr_locked && !(unsigned int)sgr_unlock()) { v5 = sgr_dbname(); v6 = Prog; v7 = gettext("%s: failed to unlock %s\n"); fprintf(stderr, v7, v6, v5); v12 = setlocale(6, 0LL); v10 = 0LL; if (v12) v10 = strdup(v12); if (v10) setlocale(6, "C"); v8 = (const char *)sgr_dbname(); syslog(3, "failed to unlock %s", v8); if (v10) { setlocale(6, v10); free(v10); } } closelog(); exit(a1); }
shadow
ida
static int rl_vi_overstrike_kill_word(int count, int key) { int r, end; end = rl_end; r = rl_vi_unix_word_rubout(count, key); vi_replace_count -= end - rl_end; return r; }
long long rl_vi_overstrike_kill_word(unsigned long a0, unsigned long a1) { unsigned int v0; unsigned int v1; v0 = rl_end; v1 = rl_vi_unix_word_rubout(a0, a1); vi_replace_count = vi_replace_count - (v0 - rl_end); return v1; }
bash
angr_phoenix
static void usage() { fprintf(stderr, "%s: usage: %s [-d] [-o filename]\n", progname, progname); exit(2); }
void usage() { fprintf(stderr, "%s: usage: %s [-d] [-o filename]\n", -116552888, -116552888); exit(0x2); }
bash
angr_dream
0 ) do { fprintf(stderr, gettext("Try '%s --help' for more information.\n"), program_name); } while (0) ;
int fprintf(FILE *__stream, char *__format, ...) { halt_baddata(); }
coreutils
ghidra
static gl_list_node_t gl_linked_sortedlist_nx_add(gl_list_t list, gl_listelement_compar_fn compar, const void *elt) { gl_list_node_t node; for (node = list->root.next; node != &list->root; node = node->next) if (compar(node->value, elt) >= 0) return gl_linked_nx_add_before(list, node, elt); return gl_linked_nx_add_last(list, elt); }
_QWORD *gl_linked_sortedlist_nx_add(long a1, int (*a2)(_QWORD, long), long a3) { _QWORD *i; for (i = *(_QWORD **)(a1 + 40); i != (_QWORD *)(a1 + 40); i = (_QWORD *)*i) { if (a2(i[2], a3) >= 0) return gl_linked_nx_add_before(a1, (long)i, a3); } return gl_linked_nx_add_last(a1, a3); }
gnutls
ida
&& (access (newpw.pw_dir, 0 ) != 0)) { mode_t mode = getdef_num("HOME_MODE", 0777 & ~getdef_num("UMASK", 022)); if (newpw.pw_dir[0] != '/') { fprintf(stderr, gettext("%s: line %d: homedir must be an absolute path\n"), Prog, line); errors++; continue; }; if (mkdir(newpw.pw_dir, mode) != 0) { fprintf(stderr, gettext("%s: line %d: mkdir %s failed: %s\n"), Prog, line, newpw.pw_dir, strerror((*__errno_location()))); } else if (chown(newpw.pw_dir, newpw.pw_uid, newpw.pw_gid) != 0) { fprintf(stderr, gettext("%s: line %d: chown %s failed: %s\n"), Prog, line, newpw.pw_dir, strerror((*__errno_location()))); } }
int access(char *__name, int __type) { halt_baddata(); }
shadow
ghidra
blk64_t get_backup_sb(e2fsck_t ctx, ext2_filsys fs, const char *name, io_manager manager) { struct ext2_super_block *sb; io_channel io = ((void *)0); void *buf = ((void *)0); int blocksize; blk64_t superblock, ret_sb = 8193; if (fs && fs->super) { ret_sb = (fs->super->s_blocks_per_group + fs->super->s_first_data_block); if (ctx) { ctx->superblock = ret_sb; ctx->blocksize = fs->blocksize; } return ret_sb; } if (ctx) { if (ctx->blocksize) { ret_sb = ctx->blocksize * 8; if (ctx->blocksize == 1024) ret_sb++; ctx->superblock = ret_sb; return ret_sb; } ctx->superblock = ret_sb; ctx->blocksize = 1024; } if (!name || !manager) goto cleanup; if (manager->open(name, 0, &io) != 0) goto cleanup; if (ext2fs_get_mem(1024, &buf)) goto cleanup; sb = (struct ext2_super_block *)buf; for (blocksize = (1 << 10); blocksize <= (1 << 16); blocksize *= 2) { superblock = blocksize * 8; if (blocksize == 1024) superblock++; ((io)->manager->set_blksize((io), blocksize)); if (io_channel_read_blk64(io, superblock, -1024, buf)) continue; if ((sb->s_magic == 0xEF53) && (((1 << 10) << (sb)->s_log_block_size) == blocksize)) { ret_sb = superblock; if (ctx) { ctx->superblock = superblock; ctx->blocksize = blocksize; } break; } } cleanup: if (io) ((io)->manager->close((io))); if (buf) ext2fs_free_mem(&buf); return (ret_sb); }
long get_backup_sb(long a1, long a2, long a3, long a4) { int i; long v6; long v7; long v8; long v9; long v10; unsigned long v11; v11 = __readfsqword(0x28u); v6 = 0LL; v7 = 0LL; v9 = 8193LL; if (a2 && *(_QWORD *)(a2 + 32)) { v9 = (unsigned int)(*(_DWORD *)(*(_QWORD *)(a2 + 32) + 32LL) + *(_DWORD *)(*(_QWORD *)(a2 + 32) + 20LL)); if (a1) { *(_QWORD *)(a1 + 96) = v9; *(_DWORD *)(a1 + 80) = *(_DWORD *)(a2 + 40); } return v9; } if (a1) { if (*(_DWORD *)(a1 + 80)) { v9 = (unsigned int)(8 * *(_DWORD *)(a1 + 80)); if (*(_DWORD *)(a1 + 80) == 1024) ++v9; *(_QWORD *)(a1 + 96) = v9; return v9; } *(_QWORD *)(a1 + 96) = v9; *(_DWORD *)(a1 + 80) = 1024; } if (a3 && a4 && !(*(long (**)(long, _QWORD, long *))(a4 + 16))(a3, 0LL, &v6) && !ext2fs_get_mem(1024LL, &v7)) { v10 = v7; for (i = 1024; i <= 0x10000; i *= 2) { v8 = 8 * i; if (i == 1024) ++v8; (*(void (**)(long, _QWORD))(*(_QWORD *)(v6 + 8) + 32LL))(v6, (unsigned int)i); if (!io_channel_read_blk64(v6, v8, 4294966272LL, v7) && *(_WORD *)(v10 + 56) == 0xEF53 && i == 1024 << *(_DWORD *)(v10 + 24)) { v9 = v8; if (a1) { *(_QWORD *)(a1 + 96) = v8; *(_DWORD *)(a1 + 80) = i; } break; } } } if (v6) (*(void (**)(long))(*(_QWORD *)(v6 + 8) + 24LL))(v6); if (v7) ext2fs_free_mem(&v7); return v9; }
e2fsprogs-1.46.5
ida
static inline __u32 nl_mgrp(__u32 group) { if (group > 31) { fprintf(stderr, "Use setsockopt for this group %d\n", group); exit(-1); } return group ? (1 << (group - 1)) : 0; }
long nl_mgrp(unsigned int a1) { if (a1 > 0x1F) { fprintf(stderr, "Use setsockopt for this group %d\n", a1); exit(-1); } if (a1) return (unsigned int)(1 << (a1 - 1)); else return 0LL; }
iproute2-6.0.0
ida
static void ipnh_cache_del(struct nh_entry *nhe) { ipnh_cache_unlink_entry(nhe); ipnh_destroy_entry(nhe); free(nhe); }
void ipnh_cache_del(void *a0) { unsigned long long v1; ipnh_cache_unlink_entry(a0); ipnh_destroy_entry(a0); v1 = free(a0); return; }
iproute2-6.0.0
angr_dream
static Channel *client_request_agent(struct ssh *ssh, const char *request_type, int rchan) { Channel *c = ((void *)0); int r, sock; if (!options.forward_agent) { sshlog("clientloop.c", __func__, 1587, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "Warning: ssh server tried agent forwarding."); sshlog("clientloop.c", __func__, 1588, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "Warning: this is probably a break-in attempt by a " "malicious server."); return ((void *)0); } if (forward_agent_sock_path == ((void *)0)) { r = ssh_get_authentication_socket(&sock); } else { r = ssh_get_authentication_socket_path(forward_agent_sock_path, &sock); } if (r != 0) { if (r != -47) sshlog("clientloop.c", __func__, 1599, 1, SYSLOG_LEVEL_DEBUG1, ssh_err(r), "ssh_get_authentication_socket"); return ((void *)0); } if ((r = ssh_agent_bind_hostkey(sock, ssh->kex->initial_hostkey, ssh->kex->session_id, ssh->kex->initial_sig, 1)) == 0) sshlog("clientloop.c", __func__, 1604, 1, SYSLOG_LEVEL_DEBUG1, ((void *)0), "bound agent to hostkey"); else sshlog("clientloop.c", __func__, 1606, 1, SYSLOG_LEVEL_DEBUG2, ssh_err(r), "ssh_agent_bind_hostkey"); c = channel_new(ssh, "authentication agent connection", 4, sock, sock, -1, (4 * (16 * 1024)), (32 * 1024), 0, "authentication agent connection", 1); c->force_drain = 1; return c; }
long client_request_agent(long a1) { long v2; long v3; unsigned int v4; unsigned int authentication_socket_path; long v6; unsigned long v7; v7 = __readfsqword(0x28u); v6 = 0LL; if (options[0]) { if (forward_agent_sock_path) authentication_socket_path = ssh_get_authentication_socket_path(forward_agent_sock_path, &v4); else authentication_socket_path = ssh_get_authentication_socket(&v4); if (authentication_socket_path) { if (authentication_socket_path != -47) { v2 = ssh_err(authentication_socket_path); sshlog("clientloop.c", "client_request_agent", 1599LL, 1LL, 5LL, v2, "ssh_get_authentication_socket"); } return 0LL; } else { authentication_socket_path = ssh_agent_bind_hostkey(v4, *(_QWORD *)(*(_QWORD *)(a1 + 8) + 128LL), *(_QWORD *)(*(_QWORD *)(a1 + 8) + 112LL), *(_QWORD *)(*(_QWORD *)(a1 + 8) + 120LL), 1LL); if (authentication_socket_path) { v3 = ssh_err(authentication_socket_path); sshlog("clientloop.c", "client_request_agent", 1606LL, 1LL, 6LL, v3, "ssh_agent_bind_hostkey"); } else { sshlog("clientloop.c", "client_request_agent", 1604LL, 1LL, 5LL, 0LL, "bound agent to hostkey"); } v6 = channel_new(a1, "authentication agent connection", 4LL, v4, v4, 0xFFFFFFFFLL, 0x10000LL, 0x8000LL, 0LL, "authentication agent connection", 1LL); *(_DWORD *)(v6 + 80) = 1; return v6; } } else { sshlog("clientloop.c", "client_request_agent", 1587LL, 0LL, 2LL, 0LL, "Warning: ssh server tried agent forwarding."); sshlog( "clientloop.c", "client_request_agent", 1588LL, 0LL, 2LL, 0LL, "Warning: this is probably a break-in attempt by a malicious server."); return 0LL; } }
openssh-portable
ida
test_code_t test_session_resume2(gnutls_session_t session) { int ret; char tmp_session_id[32]; size_t tmp_session_id_size; if (session == ((void *)0)) return TEST_IGNORE; sprintf(prio_str, "NONE:" "+CIPHER-ALL:+ARCFOUR-128:+3DES-CBC" ":+GOST28147-TC26Z-CNT" ":" "+COMP-NULL" ":%s:" "+MAC-ALL:+MD5:+SHA1" ":+GOST28147-TC26Z-IMIT" ":" "+RSA:+DHE-RSA:+DHE-DSS:+ANON-DH:+ECDHE-RSA:+ECDHE-ECDSA:+ANON-ECDH" ":+VKO-GOST-12" ":%s", protocol_str, rest); { int _ret; if ((_ret = __gnutls_priority_set_direct(session, prio_str, 1490)) != TEST_SUCCEED) { return _ret; } }; gnutls_credentials_set(session, GNUTLS_CRD_CERTIFICATE, xcred); gnutls_credentials_set(session, GNUTLS_CRD_ANON, anon_cred); gnutls_session_set_data(session, session_data, session_data_size); memcpy(tmp_session_id, session_id, session_id_size); tmp_session_id_size = session_id_size; ret = test_do_handshake(session); if (ret == TEST_FAILED) return ret; session_id_size = sizeof(session_id); gnutls_session_get_id(session, session_id, &session_id_size); if (session_id_size == 0) return TEST_FAILED; if (gnutls_session_is_resumed(session)) return TEST_SUCCEED; if (tmp_session_id_size == session_id_size && memcmp(tmp_session_id, session_id, tmp_session_id_size) == 0) return TEST_SUCCEED; else return TEST_FAILED; }
int test_session_resume2(long param_1) { size_t __n; int iVar1; long in_FS_OFFSET; undefined local_38[40]; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); if (param_1 == 0) { iVar1 = 3; } else { sprintf( prio_str, "NONE:+CIPHER-ALL:+ARCFOUR-128:+3DES-CBC:+GOST28147-TC26Z-CNT:+COMP-" "NULL:%s:+MAC-ALL:+MD5:+SHA1:+GOST28147-TC26Z-IMIT:+RSA:+DHE-RSA:+DHE-" "DSS:+ANON-DH:+ECDHE-RSA:+ECDHE-ECDSA:+ANON-ECDH:+VKO-GOST-12:%s", protocol_str, rest); iVar1 = __gnutls_priority_set_direct(param_1, prio_str, 0x5d2); if (iVar1 == 0) { gnutls_credentials_set(param_1, 1, xcred); gnutls_credentials_set(param_1, 2, anon_cred); gnutls_session_set_data(param_1, session_data, session_data_size); memcpy(local_38, session_id, session_id_size); __n = session_id_size; iVar1 = test_do_handshake(param_1); if (iVar1 != 1) { session_id_size = 0x20; gnutls_session_get_id(param_1, session_id, &session_id_size); if (session_id_size == 0) { iVar1 = 1; } else { iVar1 = gnutls_session_is_resumed(param_1); if (iVar1 == 0) { if ((__n == session_id_size) && (iVar1 = memcmp(local_38, session_id, __n), iVar1 == 0)) { iVar1 = 0; } else { iVar1 = 1; } } else { iVar1 = 0; } } } } } if (local_10 == *(long *)(in_FS_OFFSET + 0x28)) { return iVar1; } __stack_chk_fail(); }
gnutls
ghidra
void cleanup_exit(int i) { _exit(i); }
long long cleanup_exit(unsigned long a0) { _exit(a0); }
openssh-portable
angr_dream
void unset_sigwinch_handler() { set_signal_handler(28, old_winch); }
long long unset_sigwinch_handler() { return set_signal_handler(0x1c, old_winch); }
bash
angr_phoenix
static char *cdesc(i) int i; { static char xbuf[16]; if (i == ' ') return "SPC"; else if ((1 && ((*__ctype_b_loc())[(int)(((unsigned char)i))] & (unsigned short int)_ISprint))) { xbuf[0] = i; xbuf[1] = '\0'; return (xbuf); } else if (i == '\001') return "CTLESC"; else if (i == '\177') return "CTLNUL"; else if (i == '\033') return "ESC"; xbuf[0] = '\\'; xbuf[2] = '\0'; switch (i) { case '\a': xbuf[1] = 'a'; break; case '\v': xbuf[1] = 'v'; break; case '\b': xbuf[1] = 'b'; break; case '\f': xbuf[1] = 'f'; break; case '\n': xbuf[1] = 'n'; break; case '\r': xbuf[1] = 'r'; break; case '\t': xbuf[1] = 't'; break; default: sprintf(xbuf, "%d", i); break; } return xbuf; }
undefined1 *cdesc(uint param_1) { undefined1 *puVar1; ushort **ppuVar2; if (param_1 == 0x20) { puVar1 = "SPC"; } else { ppuVar2 = __ctype_b_loc(); if (((*ppuVar2)[param_1 & 0xff] & 0x4000) == 0) { if (param_1 == 1) { puVar1 = "CTLESC"; } else if (param_1 == 0x7f) { puVar1 = "CTLNUL"; } else if (param_1 == 0x1b) { puVar1 = "ESC"; } else { xbuf_4133[0] = 0x5c; xbuf_4133[2] = 0; switch (param_1) { case 7: xbuf_4133[1] = 0x61; break; case 8: xbuf_4133[1] = 0x62; break; case 9: xbuf_4133[1] = 0x74; break; case 10: xbuf_4133[1] = 0x6e; break; case 0xb: xbuf_4133[1] = 0x76; break; case 0xc: xbuf_4133[1] = 0x66; break; case 0xd: xbuf_4133[1] = 0x72; break; default: sprintf(xbuf_4133, "%d", (ulong)param_1); } puVar1 = xbuf_4133; } } else { xbuf_4133[0] = (undefined)param_1; xbuf_4133[1] = 0; puVar1 = xbuf_4133; } } return puVar1; }
bash
ghidra
static inline int valid_suffix(const char suf) { static char const *valid_suffixes = "KMGTPEZY"; return (strchr(valid_suffixes, suf) != ((void *)0)); }
bool valid_suffix(char param_1) { char *pcVar1; pcVar1 = strchr(valid_suffixes_7036, (int)param_1); return pcVar1 != (char *)0x0; }
coreutils
ghidra
void get_state_crt_set(gnutls_x509_crt_t crt) { int ret; if (batch) { if (!cfg.state) return; ret = gnutls_x509_crt_set_dn_by_oid(crt, "2.5.4.8", 0, cfg.state, strlen(cfg.state)); if (ret < 0) { fprintf(stderr, "set_dn: %s\n", gnutls_strerror(ret)); exit(1); } } else { read_crt_set(crt, "State or province name: ", "2.5.4.8"); } }
unsigned long get_state_crt_set(long a1) { unsigned long result; unsigned int v2; const char *v3; if (!batch) return read_crt_set(a1, "State or province name: ", (long)"2.5.4.8"); result = *(_QWORD *)&cfg[6]; if (result) { v2 = strlen(*(const char **)&cfg[6]); result = gnutls_x509_crt_set_dn_by_oid(a1, "2.5.4.8", 0LL, *(_QWORD *)&cfg[6], v2); if ((result & 0x80000000) != 0LL) { v3 = (const char *)gnutls_strerror((unsigned int)result); fprintf(stderr, "set_dn: %s\n", v3); exit(1); } } return result; }
gnutls
ida
char *expand_subscript_string(string, quoted) char *string; int quoted; { WORD_DESC td; WORD_LIST *tlist; int oe; char *ret; if (string == 0 || *string == 0) return (char *)((void *)0); oe = expand_no_split_dollar_star; ret = (char *)((void *)0); td.flags = (1 << 20) | (1 << 12) | (1 << 6); td.word = (char *)strcpy(sh_xmalloc((1 + strlen(string)), "subst.c", 10789), (string)); expand_no_split_dollar_star = 1; tlist = call_expand_word_internal(&td, quoted, 0, (int *)((void *)0), (int *)((void *)0)); expand_no_split_dollar_star = oe; if (tlist) { if (tlist->word) { remove_quoted_nulls(tlist->word->word); tlist->word->flags &= ~(1 << 18); } dequote_list(tlist); ret = string_list(tlist); dispose_words(tlist); } sh_xfree((td.word), "subst.c", 10807); return (ret); }
undefined8 expand_subscript_string(char *param_1, undefined4 param_2) { undefined4 uVar1; size_t sVar2; char *__dest; long lVar3; long in_FS_OFFSET; undefined8 local_38; char *local_28; undefined4 local_20; long local_10; uVar1 = expand_no_split_dollar_star; local_10 = *(long *)(in_FS_OFFSET + 0x28); if ((param_1 == (char *)0x0) || (*param_1 == '\0')) { local_38 = 0; } else { local_38 = 0; local_20 = 0x101040; sVar2 = strlen(param_1); __dest = (char *)sh_xmalloc(sVar2 + 1, "subst.c", 0x2a25); local_28 = strcpy(__dest, param_1); expand_no_split_dollar_star = 1; lVar3 = call_expand_word_internal(&local_28, param_2, 0, 0, 0); expand_no_split_dollar_star = uVar1; if (lVar3 != 0) { if (*(long *)(lVar3 + 8) != 0) { remove_quoted_nulls(**(undefined8 **)(lVar3 + 8)); *(uint *)(*(long *)(lVar3 + 8) + 8) = *(uint *)(*(long *)(lVar3 + 8) + 8) & 0xfffbffff; } dequote_list(lVar3); local_38 = string_list(lVar3); dispose_words(lVar3); } sh_xfree(local_28, "subst.c", 0x2a37); } if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) { __stack_chk_fail(); } return local_38; }
bash
ghidra
static void fix_dotdot(e2fsck_t ctx, ext2_ino_t ino, ext2_ino_t parent) { ext2_filsys fs = ctx->fs; errcode_t retval; struct fix_dotdot_struct fp; struct problem_context pctx; int flags, will_rehash; fp.fs = fs; fp.parent = parent; fp.done = 0; fp.ctx = ctx; clear_problem_context(&pctx); pctx.ino = ino; will_rehash = e2fsck_dir_will_be_rehashed(ctx, ino); if (will_rehash) { flags = ctx->fs->flags; ctx->fs->flags |= 0x200000; } retval = ext2fs_dir_iterate(fs, ino, 1, 0, fix_dotdot_proc, &fp); if (will_rehash) ctx->fs->flags = (flags & 0x200000) | (ctx->fs->flags & ~0x200000); if (retval || !fp.done) { pctx.errcode = retval; fix_problem(ctx, retval ? 0x03000F : 0x030010, &pctx); ext2fs_unmark_valid(fs); } (void)e2fsck_dir_info_set_dotdot(ctx, ino, parent); if (e2fsck_dir_info_set_parent(ctx, ino, ctx->lost_and_found)) fix_problem(ctx, 0x030016, &pctx); return; }
void fix_dotdot(struct_0 *a0, unsigned long a1, unsigned long a2) { unsigned int v0; unsigned int v1; struct_1 *v2; unsigned long v3; struct_1 *v4; unsigned int v5; unsigned int v6; struct_2 *v7; char v8; unsigned int v9; char v10; unsigned long long *v13; unsigned long long v14; v2 = a0->field_0; v4 = v2; v5 = a2; v6 = 0; v7 = &a0->field_0; clear_problem_context(&v8); v9 = a1; v1 = e2fsck_dir_will_be_rehashed(a0, a1); if (v1) { v0 = a0->field_0->field_10; a0->field_0->field_10 = a0->field_0->field_10 | 0x200000; } v3 = ext2fs_dir_iterate(v2, a1, 0x1, 0x0, fix_dotdot_proc, &v4); if (v1) a0->field_0->field_10 = a0->field_0->field_10 & -2097153 | v0 & 0x200000; if (v3 || !v6) { v8 = v3; fix_problem(a0, (!v3 ? 196623 : 196624), &v8); ext2fs_unmark_valid(v2); } e2fsck_dir_info_set_dotdot(a0, a1, a2, a1); if (e2fsck_dir_info_set_parent(a0, a1, a0->field_228, a1)) fix_problem(a0, 0x30016, &v8); v14 = *(&v10) ^ v13[5]; return; }
e2fsprogs-1.46.5
angr_sailr
int sshkey_check_sigtype(const u_char *sig, size_t siglen, const char *requested_alg) { const char *expected_alg; char *sigtype = ((void *)0); int r; if (requested_alg == ((void *)0)) return 0; if ((expected_alg = sshkey_sigalg_by_name(requested_alg)) == ((void *)0)) return -10; if ((r = sshkey_get_sigtype(sig, siglen, &sigtype)) != 0) return r; r = strcmp(expected_alg, sigtype) == 0; free(sigtype); return r ? 0 : -58; }
long sshkey_check_sigtype(long a1, long a2, const char *a3) { unsigned int sigtype; _BOOL4 v5; char *s2; char *s1; unsigned long v8; v8 = __readfsqword(0x28u); s2 = 0LL; if (!a3) return 0LL; s1 = sshkey_sigalg_by_name(a3); if (!s1) return 4294967286LL; sigtype = sshkey_get_sigtype(a1, a2, (void **)&s2); if (sigtype) return sigtype; v5 = strcmp(s1, s2) == 0; free(s2); if (v5) return 0LL; else return 4294967238LL; }
openssh-portable
ida
static void tail_forever(struct File_spec *f, size_t n_files, double sleep_interval) { _Bool blocking = (pid == 0 && follow_mode == Follow_descriptor && n_files == 1 && f[0].fd != -1 && !((((f[0].mode)) & 0170000) == (0100000))); size_t last; _Bool writer_is_dead = 0; last = n_files - 1; while (1) { size_t i; _Bool any_input = 0; for (i = 0; i < n_files; i++) { int fd; char const *name; mode_t mode; struct stat stats; uintmax_t bytes_read; if (f[i].ignore) continue; if (f[i].fd < 0) { recheck(&f[i], blocking); continue; } fd = f[i].fd; name = pretty_name(&f[i]); mode = f[i].mode; if (f[i].blocking != blocking) { int old_flags = rpl_fcntl(fd, 3); int new_flags = old_flags | (blocking ? 0 : 04000); if (old_flags < 0 || (new_flags != old_flags && rpl_fcntl(fd, 4, new_flags) == -1)) { if (((((f[i].mode)) & 0170000) == (0100000)) && (*__errno_location()) == 1) { } else ((!!sizeof(struct { _Static_assert( 1, "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), gettext (\"%s: cannot " "change nonblocking mode\"), quotearg_n_style_colon (0, " "shell_escape_quoting_style, name)), assume (false))" ")"); int _gl_dummy; })) ? ((error(1, (*__errno_location()), gettext("%s: cannot change nonblocking mode"), quotearg_n_style_colon(0, shell_escape_quoting_style, name)), ((0) ? (void)0 : __builtin_unreachable()))) : ((error(1, (*__errno_location()), gettext("%s: cannot change nonblocking mode"), quotearg_n_style_colon(0, shell_escape_quoting_style, name)), ((0) ? (void)0 : __builtin_unreachable())))) ; } else f[i].blocking = blocking; } if (!f[i].blocking) { if (fstat(fd, &stats) != 0) { f[i].fd = -1; f[i].errnum = (*__errno_location()); error(0, (*__errno_location()), "%s", quotearg_n_style_colon(0, shell_escape_quoting_style, name)); close(fd); continue; } if (f[i].mode == stats.st_mode && (!((((stats.st_mode)) & 0170000) == (0100000)) || f[i].size == stats.st_size) && timespec_cmp(f[i].mtime, get_stat_mtime(&stats)) == 0) { if ((max_n_unchanged_stats_between_opens <= f[i].n_unchanged_stats++) && follow_mode == Follow_name) { recheck(&f[i], f[i].blocking); f[i].n_unchanged_stats = 0; } continue; } f[i].mtime = get_stat_mtime(&stats); f[i].mode = stats.st_mode; f[i].n_unchanged_stats = 0; if (((((mode)) & 0170000) == (0100000)) && stats.st_size < f[i].size) { error(0, 0, gettext("%s: file truncated"), quotearg_n_style_colon(0, shell_escape_quoting_style, name)); xlseek(fd, 0, 0, name); f[i].size = 0; } if (i != last) { if (print_headers) write_header(name); last = i; } } uintmax_t bytes_to_read; if (f[i].blocking) bytes_to_read = ((18446744073709551615UL) - 1); else if (((((mode)) & 0170000) == (0100000)) && f[i].remote) bytes_to_read = stats.st_size - f[i].size; else bytes_to_read = (18446744073709551615UL); bytes_read = dump_remainder(0, name, fd, bytes_to_read); any_input |= (bytes_read != 0); f[i].size += bytes_read; } if (!any_live_files(f, n_files)) { error(0, 0, gettext("no files remaining")); break; } if ((!any_input || blocking) && fflush_unlocked(stdout) != 0) ((!!sizeof(struct { _Static_assert(1, "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), gettext (\"write " "error\")), assume (false))" ")"); int _gl_dummy; })) ? ((error(1, (*__errno_location()), gettext("write error")), ((0) ? (void)0 : __builtin_unreachable()))) : ((error(1, (*__errno_location()), gettext("write error")), ((0) ? (void)0 : __builtin_unreachable())))); check_output_alive(); if (!any_input) { if (writer_is_dead) break; writer_is_dead = (pid != 0 && kill(pid, 0) != 0 && (*__errno_location()) != 1); if (!writer_is_dead && xnanosleep(sleep_interval)) ((!!sizeof(struct { _Static_assert(1, "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), gettext " "(\"cannot read realtime clock\")), assume (false))" ")"); int _gl_dummy; })) ? ((error(1, (*__errno_location()), gettext("cannot read realtime clock")), ((0) ? (void)0 : __builtin_unreachable()))) : ((error(1, (*__errno_location()), gettext("cannot read realtime clock")), ((0) ? (void)0 : __builtin_unreachable())))); } } }
void tail_forever(undefined8 param_1, long param_2, ulong param_3) { uint uVar1; ulong uVar2; bool bVar3; bool bVar4; byte bVar5; char cVar6; uint uVar7; uint uVar8; int iVar9; int iVar10; undefined8 uVar11; undefined8 uVar12; long lVar13; undefined8 uVar14; int *piVar15; long in_FS_OFFSET; undefined auVar16[16]; ulong local_e0; ulong local_d8; long local_d0; stat local_b8; long local_20; local_20 = *(long *)(in_FS_OFFSET + 0x28); if ((((pid == 0) && (follow_mode == 2)) && (param_3 == 1)) && ((*(int *)(param_2 + 0x38) != -1 && ((*(uint *)(param_2 + 0x30) & 0xf000) != 0x8000)))) { bVar5 = 1; } else { bVar5 = 0; } bVar4 = false; local_e0 = param_3 - 1; do { do { bVar3 = false; for (local_d8 = 0; local_d8 < param_3; local_d8 = local_d8 + 1) { if (*(char *)(param_2 + local_d8 * 0x60 + 0x34) == '\0') { if (*(int *)(param_2 + local_d8 * 0x60 + 0x38) < 0) { recheck(param_2 + local_d8 * 0x60, bVar5); } else { iVar10 = *(int *)(param_2 + local_d8 * 0x60 + 0x38); uVar14 = pretty_name(); uVar1 = *(uint *)(param_2 + local_d8 * 0x60 + 0x30); if (*(uint *)(param_2 + local_d8 * 0x60 + 0x40) != (uint)bVar5) { uVar7 = rpl_fcntl(iVar10, 3); if (bVar5 == 0) { uVar8 = 0x800; } else { uVar8 = 0; } if (((int)uVar7 < 0) || (((uVar8 | uVar7) != uVar7 && (iVar9 = rpl_fcntl(iVar10, 4, uVar8 | uVar7), iVar9 == -1)))) { if (((*(uint *)(param_2 + local_d8 * 0x60 + 0x30) & 0xf000) != 0x8000) || (piVar15 = __errno_location(), *piVar15 != 1)) { uVar11 = quotearg_n_style_colon(0, 3, uVar14); uVar12 = gettext("%s: cannot change nonblocking mode"); piVar15 = __errno_location(); error(1, *piVar15, uVar12, uVar11); } } else { *(uint *)(local_d8 * 0x60 + param_2 + 0x40) = (uint)bVar5; } } if (*(int *)(param_2 + local_d8 * 0x60 + 0x40) == 0) { iVar9 = fstat(iVar10, &local_b8); if (iVar9 != 0) { *(undefined4 *)(param_2 + local_d8 * 0x60 + 0x38) = 0xffffffff; piVar15 = __errno_location(); *(int *)(local_d8 * 0x60 + param_2 + 0x3c) = *piVar15; uVar14 = quotearg_n_style_colon(0, 3, uVar14); piVar15 = __errno_location(); error(0, *piVar15, &DAT_00108461, uVar14); close(iVar10); goto LAB_001040a4; } if ((*(uint *)(param_2 + local_d8 * 0x60 + 0x30) == local_b8.st_mode) && (((local_b8.st_mode & 0xf000) != 0x8000 || (*(long *)(param_2 + local_d8 * 0x60 + 8) == local_b8.st_size)))) { auVar16 = get_stat_mtime(&local_b8); lVar13 = param_2 + local_d8 * 0x60; iVar9 = timespec_cmp(*(undefined8 *)(lVar13 + 0x10), *(undefined8 *)(lVar13 + 0x18), SUB168(auVar16, 0), SUB168(auVar16 >> 0x40, 0)); if (iVar9 == 0) { lVar13 = local_d8 * 0x60 + param_2; uVar2 = *(ulong *)(lVar13 + 0x58); *(ulong *)(lVar13 + 0x58) = uVar2 + 1; if ((max_n_unchanged_stats_between_opens <= uVar2) && (follow_mode == 1)) { recheck(param_2 + local_d8 * 0x60, *(int *)(param_2 + local_d8 * 0x60 + 0x40) != 0); *(undefined8 *)(param_2 + local_d8 * 0x60 + 0x58) = 0; } goto LAB_001040a4; } } lVar13 = local_d8 * 0x60 + param_2; auVar16 = get_stat_mtime(&local_b8); *(long *)(lVar13 + 0x10) = SUB168(auVar16, 0); *(long *)(lVar13 + 0x18) = SUB168(auVar16 >> 0x40, 0); *(__mode_t *)(local_d8 * 0x60 + param_2 + 0x30) = local_b8.st_mode; *(undefined8 *)(param_2 + local_d8 * 0x60 + 0x58) = 0; if (((uVar1 & 0xf000) == 0x8000) && (local_b8.st_size < *(long *)(param_2 + local_d8 * 0x60 + 8))) { uVar11 = quotearg_n_style_colon(0, 3, uVar14); uVar12 = gettext("%s: file truncated"); error(0, 0, uVar12, uVar11); xlseek(iVar10, 0, 0, uVar14); *(undefined8 *)(param_2 + local_d8 * 0x60 + 8) = 0; } if (local_d8 != local_e0) { if (print_headers != '\0') { write_header(uVar14); } local_e0 = local_d8; } } if (*(int *)(param_2 + local_d8 * 0x60 + 0x40) == 0) { if (((uVar1 & 0xf000) == 0x8000) && (*(char *)(param_2 + local_d8 * 0x60 + 0x35) != '\0')) { local_d0 = local_b8.st_size - *(long *)(param_2 + local_d8 * 0x60 + 8); } else { local_d0 = -1; } } else { local_d0 = -2; } lVar13 = dump_remainder(0, uVar14, iVar10, local_d0); bVar3 = (bool)(lVar13 != 0 | bVar3); *(long *)(param_2 + local_d8 * 0x60 + 8) = *(long *)(param_2 + local_d8 * 0x60 + 8) + lVar13; } } LAB_001040a4: } cVar6 = any_live_files(); if (cVar6 != '\x01') { uVar14 = gettext("no files remaining"); error(0, 0, uVar14); goto code_r0x0010421c; } if (((!bVar3) || (bVar5 != 0)) && (iVar10 = fflush_unlocked(stdout), iVar10 != 0)) { uVar14 = gettext("write error"); piVar15 = __errno_location(); error(1, *piVar15, uVar14); } check_output_alive(); } while (bVar3); if (bVar4) goto code_r0x0010421c; if (((pid == 0) || (iVar10 = kill(pid, 0), iVar10 == 0)) || (piVar15 = __errno_location(), *piVar15 == 1)) { bVar4 = false; } else { bVar4 = true; } } while ((bVar4) || (iVar10 = xnanosleep(param_1), iVar10 == 0)); uVar14 = gettext("cannot read realtime clock"); piVar15 = __errno_location(); error(1, *piVar15, uVar14); code_r0x0010421c: if (local_20 == *(long *)(in_FS_OFFSET + 0x28)) { return; } __stack_chk_fail(); }
coreutils
ghidra
static void vxcan_print_help(struct link_util *lu, int argc, char **argv, FILE *f) { print_usage(f); }
long long vxcan_print_help(unsigned long a0, unsigned long a1, unsigned long a2, unsigned int a3) { unsigned long v0; unsigned int v1; unsigned long v2; v2 = a0; v1 = a1; v0 = a2; return print_usage(a3); }
iproute2-6.0.0
angr_dream
static errcode_t get_inline_data_ea_size(ext2_filsys fs, ext2_ino_t ino, size_t *sz) { void *p; struct ext2_xattr_handle *handle; errcode_t retval; retval = ext2fs_xattrs_open(fs, ino, &handle); if (retval) return retval; retval = ext2fs_xattrs_read(handle); if (retval) goto err; retval = ext2fs_xattr_get(handle, "system.data", &p, sz); if (retval) goto err; ext2fs_free_mem(&p); err: (void)ext2fs_xattrs_close(&handle); return retval; }
long get_inline_data_ea_size(long a1, unsigned int a2, long a3) { char v5[8]; long v6; long v7; unsigned long v8; v8 = __readfsqword(0x28u); v7 = ext2fs_xattrs_open(a1, a2, &v6); if (v7) return v7; v7 = ext2fs_xattrs_read(v6); if (!v7) { v7 = ext2fs_xattr_get(v6, "system.data", v5, a3); if (!v7) ext2fs_free_mem(v5); } ext2fs_xattrs_close(&v6); return v7; }
e2fsprogs-1.46.5
ida
static inline size_t gcd(size_t u, size_t v) { do { size_t t = u % v; u = v; v = t; } while (v); return u; }
int gcd(unsigned long a0, unsigned long a1) { unsigned long v0; unsigned long v1; unsigned long v2; v1 = a0; v0 = a1; do { v2 = (0 CONCAT v1) / m v0 >> 64; v1 = v0; v0 = v2; } while (v0); return v1; }
coreutils
angr_phoenix
usage(const struct cmdinfo *ci, const char *value) { printf(gettext("Usage: %s [<option>...] <command>\n" "\n") , "dpkg"); printf(gettext( "Commands:\n" " -i|--install <.deb file name>... | -R|--recursive " "<directory>...\n" " --unpack <.deb file name>... | -R|--recursive " "<directory>...\n" " -A|--record-avail <.deb file name>... | -R|--recursive " "<directory>...\n" " --configure <package>... | -a|--pending\n" " --triggers-only <package>... | -a|--pending\n" " -r|--remove <package>... | -a|--pending\n" " -P|--purge <package>... | -a|--pending\n" " -V|--verify [<package>...] Verify the integrity of package(s).\n" " --get-selections [<pattern>...] Get list of selections to stdout.\n" " --set-selections Set package selections from stdin.\n" " --clear-selections Deselect every non-essential " "package.\n" " --update-avail [<Packages-file>] Replace available packages info.\n" " --merge-avail [<Packages-file>] Merge with info from file.\n" " --clear-avail Erase existing available info.\n" " --forget-old-unavail Forget uninstalled unavailable " "pkgs.\n" " -s|--status [<package>...] Display package status details.\n" " -p|--print-avail [<package>...] Display available version details.\n" " -L|--listfiles <package>... List files 'owned' by package(s).\n" " -l|--list [<pattern>...] List packages concisely.\n" " -S|--search <pattern>... Find package(s) owning file(s).\n" " -C|--audit [<package>...] Check for broken package(s).\n" " --yet-to-unpack Print packages selected for " "installation.\n" " --predep-package Print pre-dependencies to unpack.\n" " --add-architecture <arch> Add <arch> to the list of " "architectures.\n" " --remove-architecture <arch> Remove <arch> from the list of " "architectures.\n" " --print-architecture Print dpkg architecture.\n" " --print-foreign-architectures Print allowed foreign " "architectures.\n" " --assert-<feature> Assert support for the specified " "feature.\n" " --validate-<thing> <string> Validate a <thing>'s <string>.\n" " --compare-versions <a> <op> <b> Compare version numbers - see " "below.\n" " --force-help Show help on forcing.\n" " -Dh|--debug=help Show help on debugging.\n" "\n")); printf(gettext(" -?, --help Show this help message.\n" " --version Show the version.\n" "\n") ); printf(gettext( "Assertable features: support-predepends, working-epoch, " "long-filenames,\n" " multi-conrep, multi-arch, versioned-provides, protected-field.\n" "\n") ); printf(gettext("Validatable things: pkgname, archname, trigname, version.\n" "\n") ); printf(gettext("Use dpkg with -b, --build, -c, --contents, -e, --control, " "-I, --info,\n" " -f, --field, -x, --extract, -X, --vextract, " "--ctrl-tarfile, --fsys-tarfile\n" "on archives (type %s --help).\n" "\n") , "dpkg-deb"); printf( gettext( "Options:\n" " --admindir=<directory> Use <directory> instead of %s.\n" " --root=<directory> Install on a different root " "directory.\n" " --instdir=<directory> Change installation dir without " "changing admin dir.\n" " --pre-invoke=<command> Set a pre-invoke hook.\n" " --post-invoke=<command> Set a post-invoke hook.\n" " --path-exclude=<pattern> Do not install paths which match a " "shell pattern.\n" " --path-include=<pattern> Re-include a pattern after a previous " "exclusion.\n" " -O|--selected-only Skip packages not selected for " "install/upgrade.\n" " -E|--skip-same-version Skip packages whose same version is " "installed.\n" " -G|--refuse-downgrade Skip packages with earlier version " "than installed.\n" " -B|--auto-deconfigure Install even if it would break some " "other package.\n" " --[no-]triggers Skip or force consequential trigger " "processing.\n" " --verify-format=<format> Verify output format (supported: " "'rpm').\n" " --no-pager Disables the use of any pager.\n" " --no-debsig Do not try to verify package " "signatures.\n" " --no-act|--dry-run|--simulate\n" " Just say what we would do - don't do " "it.\n" " -D|--debug=<octal> Enable debugging (see -Dhelp or " "--debug=help).\n" " --status-fd <n> Send status change updates to file " "descriptor <n>.\n" " --status-logger=<command> Send status change updates to " "<command>'s stdin.\n" " --log=<filename> Log status changes and actions to " "<filename>.\n" " --ignore-depends=<package>[,...]\n" " Ignore dependencies involving " "<package>.\n" " --force-<thing>[,...] Override problems (see --force-help).\n" " --no-force-<thing>[,...] Stop when problems encountered.\n" " --refuse-<thing>[,...] Ditto.\n" " --abort-after <n> Abort after encountering <n> errors.\n" " --robot Use machine-readable output on some " "commands.\n" "\n"), "/usr/local/var/lib/dpkg"); printf(gettext("Comparison operators for --compare-versions are:\n" " lt le eq ne ge gt (treat empty version as earlier " "than any version);\n" " lt-nl le-nl ge-nl gt-nl (treat empty version as later than " "any version);\n" " < << <= = >= >> > (only for compatibility with " "control file syntax).\n" "\n") ); printf(gettext( "Use 'apt' or 'aptitude' for user-friendly package management.\n")); m_output(stdout, gettext("<standard output>")); exit(0); }
long long usage() { unsigned long v0; unsigned long v1; unsigned long v3; unsigned long v4; unsigned long long v5; v1 = v3; v0 = v4; printf(gettext("Usage: %s [<option>...] <command>\n\n")); printf(gettext( "Commands:\n -i|--install <.deb file name>... | -R|--recursive " "<directory>...\n --unpack <.deb file name>... | " "-R|--recursive <directory>...\n -A|--record-avail <.deb file name>... " "| -R|--recursive <directory>...\n --configure <package>... | " "-a|--pending\n --triggers-only <package>... | -a|--pending\n " "-r|--remove <package>... | -a|--pending\n -P|--purge " "<package>... | -a|--pending\n -V|--verify [<package>...] Verify " "the integrity of package(s).\n --get-selections [<pattern>...] Get " "list of selections to stdout.\n --set-selections Set " "package selections from stdin.\n --clear-selections " "Deselect every non-essential package.\n --update-avail " "[<Packages-file>] Replace available packages info.\n --merge-avail " "[<Packages-file>] Merge with info from file.\n --clear-avail " " Erase existing available info.\n --forget-old-unavail " " Forget uninstalled unavailable pkgs.\n -s|--status [<package>...] " " Display packa")); printf(gettext(" -?, --help Show this help message.\n " " --version Show the version.\n\n")); printf(gettext("Assertable features: support-predepends, working-epoch, " "long-filenames,\n multi-conrep, multi-arch, " "versioned-provides, protected-field.\n\n")); printf( gettext("Validatable things: pkgname, archname, trigname, version.\n\n")); printf(gettext( "Use dpkg with -b, --build, -c, --contents, -e, --control, -I, --info,\n " " -f, --field, -x, --extract, -X, --vextract, --ctrl-tarfile, " "--fsys-tarfile\non archives (type %s --help).\n\n")); printf(gettext( "Options:\n --admindir=<directory> Use <directory> instead of %s.\n " " --root=<directory> Install on a different root directory.\n " "--instdir=<directory> Change installation dir without changing " "admin dir.\n --pre-invoke=<command> Set a pre-invoke hook.\n " "--post-invoke=<command> Set a post-invoke hook.\n " "--path-exclude=<pattern> Do not install paths which match a shell " "pattern.\n --path-include=<pattern> Re-include a pattern after a " "previous exclusion.\n -O|--selected-only Skip packages not " "selected for install/upgrade.\n -E|--skip-same-version Skip " "packages whose same version is installed.\n -G|--refuse-downgrade " "Skip packages with earlier version than installed.\n " "-B|--auto-deconfigure Install even if it would break some other " "package.\n --[no-]triggers Skip or force consequential " "trigger processing.\n --verify-format=<format> Verify output format " "(supported: 'rpm').\n --no-pager Disables the use of " "any pager.\n --no-debsig ")); printf(gettext("Comparison operators for --compare-versions are:\n lt le eq " "ne ge gt (treat empty version as earlier than any " "version);\n lt-nl le-nl ge-nl gt-nl (treat empty version as " "later than any version);\n < << <= = >= >> > (only " "for compatibility with control file syntax).\n\n")); printf(gettext( "Use 'apt' or 'aptitude' for user-friendly package management.\n")); v5 = gettext("<standard output>"); m_output(stdout, v5, v5); exit(0x0); }
dpkg
angr_sailr
static inline __u32 rta_getattr_u32(const struct rtattr *rta) { return *(__u32 *)(( void *)(((char *)(rta)) + ((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0)))); }
int rta_getattr_u32(struct_0 *a0) { return a0->field_4; }
iproute2-6.0.0
angr_phoenix
int main(int argc, char **argv) { int file_count; size_t proglen; char **argv_copy; int env_argc; char **env_argv; ; program_name = gzip_base_name(argv[0]); proglen = strlen(program_name); if (4 < proglen && (strcmp((program_name + proglen - 4), (".exe")) == 0)) program_name[proglen - 4] = '\0'; argv_copy = argv; env = add_envopt(&env_argc, &argv_copy, "GZIP"); env_argv = env ? argv_copy : ((void *)0); z_suffix = ".gz"; z_len = strlen(z_suffix); while (1) { int optc; int longind = -1; if (env_argv) { if (env_argv[optind] && (strcmp((env_argv[optind]), ("--")) == 0)) optc = ENV_OPTION + '-'; else { optc = getopt_long(env_argc, env_argv, shortopts, longopts, &longind); if (0 <= optc) optc += ENV_OPTION; else { if (optind != env_argc) { fprintf(stderr, ("%s: %s: non-option in " "GZIP" " environment variable\n"), program_name, env_argv[optind]); try_help(); } if (env_argc != 1 && !quiet) fprintf(stderr, ("%s: warning: " "GZIP" " environment variable" " is deprecated; use an alias or script\n"), program_name); free(env_argv); env_argv = ((void *)0); optind = 1; longind = -1; } } } if (!env_argv) optc = getopt_long(argc, argv, shortopts, longopts, &longind); if (optc < 0) break; switch (optc) { case 'a': ascii = 1; break; case 'b': maxbits = atoi(optarg); for (; *optarg; optarg++) if (!('0' <= *optarg && *optarg <= '9')) { fprintf(stderr, "%s: -b operand is not an integer\n", program_name); try_help(); } break; case 'c': to_stdout = 1; break; case 'd': decompress = 1; break; case 'f': force++; break; case 'h': case 'H': help(); finish_out(); break; case 'k': keep = 1; break; case 'l': list = decompress = test = to_stdout = 1; break; case 'L': license(); finish_out(); break; case 'm': no_time = 1; break; case 'M': no_time = 0; break; case 'n': case 'n' + ENV_OPTION: no_name = no_time = 1; break; case 'N': case 'N' + ENV_OPTION: no_name = no_time = 0; break; case PRESUME_INPUT_TTY_OPTION: presume_input_tty = 1; break; case 'q': case 'q' + ENV_OPTION: quiet = 1; verbose = 0; break; case 'r': recursive = 1; break; case RSYNCABLE_OPTION: case RSYNCABLE_OPTION + ENV_OPTION: rsync = 1; break; case 'S': z_len = strlen(optarg); z_suffix = optarg; break; case SYNCHRONOUS_OPTION: synchronous = 1; break; case 't': test = decompress = to_stdout = 1; break; case 'v': case 'v' + ENV_OPTION: verbose++; quiet = 0; break; case 'V': version(); finish_out(); break; case 'Z': fprintf(stderr, "%s: -Z not supported in this version\n", program_name); try_help(); break; case '1' + ENV_OPTION: case '2' + ENV_OPTION: case '3' + ENV_OPTION: case '4' + ENV_OPTION: case '5' + ENV_OPTION: case '6' + ENV_OPTION: case '7' + ENV_OPTION: case '8' + ENV_OPTION: case '9' + ENV_OPTION: optc -= ENV_OPTION; __attribute__((__fallthrough__)); case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': level = optc - '0'; break; default: if (ENV_OPTION <= optc && optc != ENV_OPTION + '?') { fprintf(stderr, "%s: ", program_name); if (longind < 0) fprintf(stderr, "-%c: ", optc - ENV_OPTION); else fprintf(stderr, "--%s: ", longopts[longind].name); fprintf(stderr, ("option not valid in " "GZIP" " environment variable\n")); } try_help(); } } if (no_time < 0) no_time = decompress; if (no_name < 0) no_name = decompress; file_count = argc - optind; if (ascii && !quiet) { fprintf(stderr, "%s: option --ascii ignored on this system\n", program_name); } if (z_len == 0 || z_len > 30) { fprintf(stderr, "%s: invalid suffix '%s'\n", program_name, z_suffix); do_exit(1); } ; ; ; ; ; exiting_signal = quiet ? 13 : 0; install_signal_handlers(); if (file_count != 0) { if (to_stdout && !test && (!decompress || !ascii)) { ; } while (optind < argc) { treat_file(argv[optind++]); } } else { treat_stdin(); } if (stdin_was_read && close(0) != 0) { strcpy(ifname, "stdin"); read_error(); } if (list) { if (!quiet && 1 < file_count) do_list(-1); if (rpl_fflush(stdout) != 0) write_error(); } if (to_stdout && ((synchronous && fdatasync(1) != 0 && (*__errno_location()) != 22) || close(1) != 0) && (*__errno_location()) != 9) write_error(); do_exit(exit_code); }
int main(unsigned long a0) { unsigned int v0; int tmp_11; char v1; unsigned int v2; unsigned int v3; unsigned int v4; char v5; void *v6; unsigned long v7; unsigned long v8; unsigned long long *v10; unsigned long long *v11; void *v12; unsigned long long v14; unsigned long v15; unsigned long long v17; unsigned long v18; v0 = a0; v8 = v10[5]; bytes_out = gzip_base_name(*(v11)); v7 = strlen(0x48fffffff9158b48); if (v7 > 4 && !strcmp(5260204364652710728 + v7 - 4, ".exe")) *((5260204364652710728 + v7 - 4)) = 0; env = add_envopt(&v1, &v5, "GZIP", &v5); v12 = (!env ? v11 : 0); v6 = v12; z_suffix = ".gz"; z_len = strlen(z_suffix); while (true) { v2 = -1; if (v6) { if (!*((v6 + 8 * optind)) || strcmp(*((v6 + 8 * optind)), "--")) { v3 = getopt_long(*(&v1), v6, "ab:cdfhH?klLmMnNqrS:tvVZ123456789", &longopts, &v2); if (v3 >= 0) { v3 += 131; } else if (optind == *(&v1)) { if (*(&v1) != 1 && !quiet) fprintf(stderr, "%s: warning: GZIP environment variable is deprecated; use " "an alias or script\n", -116028600); free(v6); v6 = 0; optind = 1; v2 = -1; } else { fprintf(stderr, "%s: %s: non-option in GZIP environment variable\n", -116028600, *((v6 + 8 * optind))); try_help(); } } else { v3 = 176; } } if (!v6) v3 = getopt_long(v0, v11, "ab:cdfhH?klLmMnNqrS:tvVZ123456789", &longopts, &v2); if (v3 < 0) break; switch (v3) { case 72: case 104: help(); finish_out(); case 76: license(); finish_out(); case 77: no_time = 0; break; case 78: case 209: no_time = 0; no_name = no_time; break; case 83: z_len = strlen(optarg); z_suffix = optarg; break; case 86: version(); finish_out(); case 90: fprintf(stderr, "%s: -Z not supported in this version\n", -116028600); try_help(); case 97: ascii = 1; break; case 98: for (maxbits = atoi(optarg); *(optarg); optarg = optarg + 1) { if (!(*(optarg) > 47) || !(*(optarg) <= 57)) { fprintf(stderr, "%s: -b operand is not an integer\n", -116028600); try_help(); } } case 99: to_stdout = 1; break; case 100: decompress = 1; break; case 102: force = force + 1; break; case 107: keep = 1; break; case 108: to_stdout = 1; test = to_stdout; decompress = test; list = decompress; break; case 109: no_time = 1; break; case 110: case 241: no_time = 1; no_name = no_time; break; case 113: case 244: quiet = 1; verbose = 0; break; case 114: recursive = 1; break; case 116: to_stdout = 1; decompress = to_stdout; test = decompress; break; case 118: case 249: verbose = verbose + 1; quiet = 0; break; case 128: presume_input_tty = 1; break; case 129: case 260: rsync = 1; break; case 130: synchronous = 1; break; case 180: case 181: case 182: case 183: case 184: case 185: case 186: case 187: case 188: v3 -= 131; case 49: case 50: case 51: case 52: case 53: case 54: case 55: case 56: case 57: level = v3 - 48; break; default: if (v3 > 130 && v3 != 194) { fprintf(stderr, "%s: ", -116028600); if (v2 >= 0) fprintf(stderr, "--%s: ", (&longopts)[4 * v2]); else fprintf(stderr, "-%c: ", v3 - 131); fprintf(stderr, "option not valid in GZIP environment variable\n"); } try_help(); } } if (no_time < 0) no_time = decompress; if (no_name < 0) no_name = decompress; v4 = v0 - optind; if (ascii && !quiet) fprintf(stderr, "%s: option --ascii ignored on this system\n", -116028600); if (z_len && z_len <= 30) { *(&v12) = (!quiet ? 13 : 0); exiting_signal = v12; install_signal_handlers(); if (!v4) { treat_stdin(a0, v11, v15, v17, v18, v14); } else { while (v0 > optind) { tmp_11 = optind; optind = optind + 1; v15 = tmp_11 * 8; treat_file(v11[tmp_11], v11, v15, v17, v18, v14); } } if (stdin_was_read && close(0x0)) { strcpy(&ofname, "stdin"); read_error(&ofname, "stdin", v15, v17, v18, v14); } if (list) { if (!quiet && v4 > 1) do_list(0xffffffff); if (rpl_fflush(stdout)) write_error(); } if (to_stdout && (synchronous && fdatasync(0x1) && (*(&v12) = *(__errno_location()), v12 != 22) || close(0x1))) { *(&v12) = *(__errno_location()); if (v12 != 9) write_error(); } do_exit(exit_code); } fprintf(stderr, "%s: invalid suffix '%s'\n", -116028600, z_suffix); do_exit(0x1); }
gzip-1.12
angr_sailr
void pkcs7_sign(common_info_st *cinfo, unsigned embed) { gnutls_pkcs7_t pkcs7; gnutls_privkey_t key; int ret; size_t size; gnutls_datum_t data; unsigned flags = 0; gnutls_x509_crt_t *crts; size_t crt_size; size_t i; if (certtool_options.enabled.p7_time) flags |= GNUTLS_PKCS7_INCLUDE_TIME; if (certtool_options.enabled.p7_include_cert) flags |= GNUTLS_PKCS7_INCLUDE_CERT; ret = gnutls_pkcs7_init(&pkcs7); if (ret < 0) { fprintf(stderr, "p7_init: %s\n", gnutls_strerror(ret)); app_exit(1); } data.data = (void *)_gnutls_fread_file(infile, 0, &size); data.size = size; if (!data.data) { fprintf(stderr, "%s", infile ? "file" : "standard input"); app_exit(1); } crts = load_cert_list(1, &crt_size, cinfo); key = load_private_key(1, cinfo); if (embed) flags |= GNUTLS_PKCS7_EMBED_DATA; ret = gnutls_pkcs7_sign(pkcs7, *crts, key, &data, ((void *)0), ((void *)0), get_dig(*crts, cinfo), flags); if (ret < 0) { fprintf(stderr, "Error signing: %s\n", gnutls_strerror(ret)); app_exit(1); } for (i = 1; i < crt_size; i++) { ret = gnutls_pkcs7_set_crt(pkcs7, crts[i]); if (ret < 0) { fprintf(stderr, "Error adding cert: %s\n", gnutls_strerror(ret)); exit(1); } } size = lbuffer_size; ret = gnutls_pkcs7_export(pkcs7, outcert_format, lbuffer, &size); if (ret < 0) { fprintf(stderr, "pkcs7_export: %s\n", gnutls_strerror(ret)); app_exit(1); } fwrite(lbuffer, 1, size, outfile); gnutls_privkey_deinit(key); for (i = 0; i < crt_size; i++) { gnutls_x509_crt_deinit(crts[i]); } gnutls_free((void *)(crts)), crts = ((void *)0); gnutls_pkcs7_deinit(pkcs7); app_exit(0); }
void pkcs7_sign(unsigned long long a0, unsigned long a1) { unsigned long v0; unsigned int v1; unsigned int v2; char v3; char v4; char v5; unsigned long long v6; unsigned long long v7; unsigned long long v8; unsigned long v9; unsigned int v10; unsigned long v11; unsigned long long *v13; unsigned int v14; v11 = v13[5]; v1 = 0; if (g_5001ec) v1 |= 2; if (g_5001eb) v1 |= 4; v2 = gnutls_pkcs7_init(&v3); if (v2 < 0) { fprintf(*(&stderr), "p7_init: %s\n", gnutls_strerror(v2)); app_exit(0x1); } v9 = _gnutls_fread_file(infile, 0x0, &v4); v10 = *(&v4); if (!v9) { if (!infile) v14 = &g_40b4c4; else v14 = "file"; fprintf(*(&stderr), "%s", v14); app_exit(0x1); } else { v7 = load_cert_list(0x1, &v5, a0); v8 = load_private_key(0x1, a0); if (a1) v1 |= 1; v0 = v1; v2 = gnutls_pkcs7_sign(*(&v3), *(v7), v8, &v9, 0x0, 0x0, get_dig(*(v7), a0)); if (v2 < 0) { fprintf(*(&stderr), "Error signing: %s\n", gnutls_strerror(v2)); app_exit(0x1); } for (v6 = 1; v6 < *(&v5); v6 += 1) { v2 = gnutls_pkcs7_set_crt(*(&v3), *((v7 + v6 * 8)), *((v7 + v6 * 8))); if (v2 < 0) { fprintf(*(&stderr), "Error adding cert: %s\n", gnutls_strerror(v2)); exit(0x1); } } *(&v4) = lbuffer_size; v2 = gnutls_pkcs7_export(*(&v3), outcert_format, lbuffer, &v4); if (v2 < 0) { fprintf(*(&stderr), "pkcs7_export: %s\n", gnutls_strerror(v2)); app_exit(0x1); } fwrite(lbuffer, 0x1, *(&v4), outfile); gnutls_privkey_deinit(v8); for (v6 = 0; v6 < *(&v5); v6 += 1) { gnutls_x509_crt_deinit(*((v7 + v6 * 8))); } *(5243720)(v7); v7 = 0; gnutls_pkcs7_deinit(*(&v3)); app_exit(0x0); } }
gnutls
angr_sailr
char *sshkey_fingerprint(const struct sshkey *k, int dgst_alg, enum sshkey_fp_rep dgst_rep) { char *retval = ((void *)0); u_char *dgst_raw; size_t dgst_raw_len; if (sshkey_fingerprint_raw(k, dgst_alg, &dgst_raw, &dgst_raw_len) != 0) return ((void *)0); switch (dgst_rep) { case SSH_FP_DEFAULT: if (dgst_alg == 0) { retval = fingerprint_hex(ssh_digest_alg_name(dgst_alg), dgst_raw, dgst_raw_len); } else { retval = fingerprint_b64(ssh_digest_alg_name(dgst_alg), dgst_raw, dgst_raw_len); } break; case SSH_FP_HEX: retval = fingerprint_hex(ssh_digest_alg_name(dgst_alg), dgst_raw, dgst_raw_len); break; case SSH_FP_BASE64: retval = fingerprint_b64(ssh_digest_alg_name(dgst_alg), dgst_raw, dgst_raw_len); break; case SSH_FP_BUBBLEBABBLE: retval = fingerprint_bubblebabble(dgst_raw, dgst_raw_len); break; case SSH_FP_RANDOMART: retval = fingerprint_randomart(ssh_digest_alg_name(dgst_alg), dgst_raw, dgst_raw_len, k); break; default: freezero(dgst_raw, dgst_raw_len); return ((void *)0); } freezero(dgst_raw, dgst_raw_len); return retval; }
long long sshkey_fingerprint(void *a0, unsigned long a1, unsigned long a2) { char v0; char v1; unsigned long long v2; void *v4; v2 = 0; if (sshkey_fingerprint_raw(a0, a1, &v0, &v1)) { v4 = 0; return v4; } switch (a2) { case 0: if (!a1) { v2 = fingerprint_hex(ssh_digest_alg_name(a1), *(&v0), *(&v1)); break; } else { v2 = fingerprint_b64(ssh_digest_alg_name(a1), *(&v0), *(&v1)); break; } case 1: v2 = fingerprint_hex(ssh_digest_alg_name(a1), *(&v0), *(&v1)); break; case 2: v2 = fingerprint_b64(ssh_digest_alg_name(a1), *(&v0), *(&v1)); break; case 3: v2 = fingerprint_bubblebabble(*(&v0), *(&v1)); break; case 4: v2 = fingerprint_randomart(ssh_digest_alg_name(a1), *(&v0), *(&v1), a0); break; default: freezero(*(&v0), *(&v1)); v4 = 0; return v4; } freezero(*(&v0), *(&v1)); v4 = v2; return v4; }
openssh-portable
angr_sailr
char *concat(char const *s1, char const *s2, char const *s3) { char *new = xmalloc(strlen(s1) + strlen(s2) + strlen(s3) + 1); sprintf(new, "%s%s%s", s1, s2, s3); return new; }
long long concat(char *a0, char *a1, char *a2) { char *v0; v0 = xmalloc(strlen(a2) + strlen(a0) + strlen(a1) + 1); sprintf(v0, "%s%s%s", a0, a1, a2); return v0; }
diffutils
angr_dream
static void check_flags(void) { if (sflg && !(((void *)0) != crypt_method)) { fprintf(stderr, gettext("%s: %s flag is only allowed with the %s flag\n"), Prog, "-s", "-c"); usage(1); } if ((((void *)0) != crypt_method)) { if ((0 != strcmp(crypt_method, "DES")) && (0 != strcmp(crypt_method, "MD5")) && (0 != strcmp(crypt_method, "NONE")) && (0 != strcmp(crypt_method, "SHA256")) && (0 != strcmp(crypt_method, "SHA512")) ) { fprintf(stderr, gettext("%s: unsupported crypt method: %s\n"), Prog, crypt_method); usage(1); } } }
int check_flags() { long v0; char *v1; int result; char *v3; long v4; char *v5; if (sflg && !crypt_method) { v0 = Prog; v1 = gettext("%s: %s flag is only allowed with the %s flag\n"); fprintf(stderr, v1, v0, "-s", "-c"); usage(1); } result = (int)crypt_method; if (crypt_method) { result = strcmp(crypt_method, "DES"); if (result) { result = strcmp(crypt_method, "MD5"); if (result) { result = strcmp(crypt_method, "NONE"); if (result) { result = strcmp(crypt_method, "SHA256"); if (result) { result = strcmp(crypt_method, "SHA512"); if (result) { v3 = crypt_method; v4 = Prog; v5 = gettext("%s: unsupported crypt method: %s\n"); fprintf(stderr, v5, v4, v3); usage(1); } } } } } } return result; }
shadow
ida
void *xrecallocarray(void *ptr, size_t onmemb, size_t nmemb, size_t size) { void *new_ptr; new_ptr = recallocarray(ptr, onmemb, nmemb, size); if (new_ptr == ((void *)0)) sshfatal("xmalloc.c", __func__, 81, 0, SYSLOG_LEVEL_FATAL, ((void *)0), "xrecallocarray: out of memory (%zu elements of %zu bytes)", nmemb, size); return new_ptr; }
long xrecallocarray(long a1, long a2, long a3, long a4) { long v7; v7 = recallocarray(a1, a2, a3, a4); if (!v7) sshfatal("xmalloc.c", "xrecallocarray", 81LL, 0LL, 1LL, 0LL, "xrecallocarray: out of memory (%zu elements of %zu bytes)", a3, a4); return v7; }
openssh-portable
ida
int _rl_replace_text(const char *text, int start, int end) { int n; n = 0; rl_begin_undo_group(); if (start <= end) rl_delete_text(start, end + 1); rl_point = start; if (*text) n = rl_insert_text(text); rl_end_undo_group(); return n; }
undefined4 _rl_replace_text(char *param_1, int param_2, int param_3) { undefined4 local_c; local_c = 0; rl_begin_undo_group(); if (param_2 <= param_3) { rl_delete_text(param_2, param_3 + 1); } rl_point = param_2; if (*param_1 != '\0') { local_c = rl_insert_text(param_1); } rl_end_undo_group(); return local_c; }
bash
ghidra
int get_runlevel(void) { struct utmp *ut; char *r; int runlevel, status; if (getenv("INIT_VERSION") && (r = getenv("RUNLEVEL")) != ((void *)0)) return *r; setutent(); while ((ut = getutent()) != ((void *)0)) { if (ut->ut_type == 1) return (ut->ut_pid & 255); } endutent(); status = Read_Runlevel_Log(&runlevel); if (status) return runlevel; fprintf(stderr, "WARNING: could not determine runlevel" " - doing soft %s\n", progname); fprintf(stderr, " (it's better to use shutdown instead of %s" " from the command line)\n", progname); return -1; }
uint get_runlevel(void) { char *pcVar1; long in_FS_OFFSET; uint local_28; int local_24; char *local_20; short *local_18; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); pcVar1 = getenv("INIT_VERSION"); if ((pcVar1 == (char *)0x0) || (local_20 = getenv("RUNLEVEL"), local_20 == (char *)0x0)) { setutent(); do { local_18 = (short *)getutent(); if (local_18 == (short *)0x0) { endutent(); local_24 = Read_Runlevel_Log(&local_28); if (local_24 == 0) { fprintf(stderr, "WARNING: could not determine runlevel - doing soft %s\n", progname); fprintf(stderr, " (it\'s better to use shutdown instead of %s from the " "command line)\n", progname); local_28 = 0xffffffff; } goto LAB_00100224; } } while (*local_18 != 1); local_28 = *(uint *)(local_18 + 2) & 0xff; } else { local_28 = (uint)*local_20; } LAB_00100224: if (local_10 == *(long *)(in_FS_OFFSET + 0x28)) { return local_28; } __stack_chk_fail(); }
sysvinit
ghidra
static void set_use_compress_program_option(const char *string, struct option_locus *loc) { struct option_locus *p = optloc_save(OC_COMPRESS, loc); if (use_compress_program_option && strcmp(use_compress_program_option, string) != 0 && p->source == OPTS_COMMAND_LINE) do { if (error_hook) error_hook(); error(0, 0, gettext("Conflicting compression options")); usage(2); } while (0); use_compress_program_option = string; }
const char *set_use_compress_program_option(const char *a1, long a2) { char *v2; char *v3; const char *result; _DWORD *v6; v6 = (_DWORD *)optloc_save(0, a2); if (use_compress_program_option) { v2 = use_compress_program_option; if (strcmp(use_compress_program_option, a1)) { if (*v6 == 1) { if (error_hook) error_hook(v2); v3 = gettext("Conflicting compression options"); error(0, 0, v3); usage(2); } } } result = a1; use_compress_program_option = (char *)a1; return result; }
tar
ida
wchar_t *ct_decode_string(const char *s, ct_buffer_t *conv) { size_t len; if (!s) return ((void *)0); len = mbstowcs(((void *)0), s, (size_t)0); if (len == (size_t)-1) return ((void *)0); if (conv->wsize < ++len) if (ct_conv_wbuff_resize(conv, len + ((size_t)1024)) == -1) return ((void *)0); mbstowcs(conv->wbuff, s, conv->wsize); return conv->wbuff; }
long ct_decode_string(const char *a1, long a2) { size_t v3; size_t v4; if (!a1) return 0LL; v3 = mbstowcs(0LL, a1, 0LL); if (v3 == -1LL) return 0LL; v4 = v3 + 1; if (v4 > *(_QWORD *)(a2 + 24) && (unsigned int)ct_conv_wbuff_resize(a2, v4 + 1024) == -1) return 0LL; mbstowcs(*(wchar_t **)(a2 + 16), a1, *(_QWORD *)(a2 + 24)); return *(_QWORD *)(a2 + 16); }
libedit
ida
static int history_next_string(HistoryW *h, HistEventW *ev, const wchar_t *str) { size_t len = wcslen(str); int retval; for (retval = (*(h)->h_curr)((h)->h_ref, ev); retval != -1; retval = (*(h)->h_prev)((h)->h_ref, ev)) if (wcsncmp(str, ev->str, len) == 0) return 0; { ev->num = 9; ev->str = he_errlist[9]; }; return -1; }
long history_next_string(_QWORD *a1, long a2, const wchar_t *a3) { int i; size_t n; n = wcslen(a3); for (i = ((long (*)(_QWORD, long))a1[6])(*a1, a2); i != -1; i = ((long (*)(_QWORD, long))a1[5])(*a1, a2)) { if (!wcsncmp(a3, *(const wchar_t **)(a2 + 8), n)) return 0LL; } *(_DWORD *)a2 = 9; *(_QWORD *)(a2 + 8) = "e"; return 0xFFFFFFFFLL; }
libedit
ida
static int do_read(int fd) { int c; char buffer[4096], *cp, *sep; c = read(fd, buffer, sizeof(buffer) - 1); if (c <= 0) return c; if (do_skip) { send_output(buffer, c, 0x02); buffer[c] = 0; cp = buffer; while (*cp) { if (skip_mode) { cp = strchr(cp, '\002'); if (!cp) return 0; cp++; skip_mode = 0; continue; } sep = strchr(cp, '\001'); if (sep) *sep = 0; send_output(cp, 0, 0x01); if (sep) { cp = sep + 1; skip_mode = 1; } else break; } } else send_output(buffer, c, 0x03); return c; }
int do_read(unsigned long a0) { unsigned int v0; char *v1; char *v2; char v3; unsigned long long v4; unsigned int v6; v4 = *(&v4); v0 = read(a0, &v3, 0xfff); if (v0 <= 0) { v6 = v0; return v6; } if (do_skip) { send_output(&v3, v0, 0x2); (&v3)[v0] = 0; v1 = &v3; while (true) { if (!*(v1)) break; if (skip_mode) { v1 = strchr(v1, 0x2); if (!v1) { v6 = 0; return v6; } v1 += 1; skip_mode = 0; } else { v2 = strchr(v1, 0x1); if (v2) *(v2) = 0; send_output(v1, 0x0, 0x1); if (!v2) break; v1 = v2 + 1; skip_mode = 1; } } } else { send_output(&v3, v0, 0x3); } v6 = v0; return v6; }
sysvinit
angr_sailr
void initialize_server_options(ServerOptions *options) { memset(options, 0, sizeof(*options)); options->use_pam = -1; options->num_ports = 0; options->ports_from_cmdline = 0; options->queued_listen_addrs = ((void *)0); options->num_queued_listens = 0; options->listen_addrs = ((void *)0); options->num_listen_addrs = 0; options->address_family = -1; options->routing_domain = ((void *)0); options->num_host_key_files = 0; options->num_host_cert_files = 0; options->host_key_agent = ((void *)0); options->pid_file = ((void *)0); options->login_grace_time = -1; options->permit_root_login = -1; options->ignore_rhosts = -1; options->ignore_user_known_hosts = -1; options->print_motd = -1; options->print_lastlog = -1; options->x11_forwarding = -1; options->x11_display_offset = -1; options->x11_use_localhost = -1; options->permit_tty = -1; options->permit_user_rc = -1; options->xauth_location = ((void *)0); options->strict_modes = -1; options->tcp_keep_alive = -1; options->log_facility = SYSLOG_FACILITY_NOT_SET; options->log_level = SYSLOG_LEVEL_NOT_SET; options->num_log_verbose = 0; options->log_verbose = ((void *)0); options->hostbased_authentication = -1; options->hostbased_uses_name_from_packet_only = -1; options->hostbased_accepted_algos = ((void *)0); options->hostkeyalgorithms = ((void *)0); options->pubkey_authentication = -1; options->pubkey_auth_options = -1; options->pubkey_accepted_algos = ((void *)0); options->kerberos_authentication = -1; options->kerberos_or_local_passwd = -1; options->kerberos_ticket_cleanup = -1; options->kerberos_get_afs_token = -1; options->gss_authentication = -1; options->gss_cleanup_creds = -1; options->gss_strict_acceptor = -1; options->password_authentication = -1; options->kbd_interactive_authentication = -1; options->permit_empty_passwd = -1; options->permit_user_env = -1; options->permit_user_env_allowlist = ((void *)0); options->compression = -1; options->rekey_limit = -1; options->rekey_interval = -1; options->allow_tcp_forwarding = -1; options->allow_streamlocal_forwarding = -1; options->allow_agent_forwarding = -1; options->num_allow_users = 0; options->num_deny_users = 0; options->num_allow_groups = 0; options->num_deny_groups = 0; options->ciphers = ((void *)0); options->macs = ((void *)0); options->kex_algorithms = ((void *)0); options->ca_sign_algorithms = ((void *)0); options->fwd_opts.gateway_ports = -1; options->fwd_opts.streamlocal_bind_mask = (mode_t)-1; options->fwd_opts.streamlocal_bind_unlink = -1; options->num_subsystems = 0; options->max_startups_begin = -1; options->max_startups_rate = -1; options->max_startups = -1; options->per_source_max_startups = -1; options->per_source_masklen_ipv4 = -1; options->per_source_masklen_ipv6 = -1; options->max_authtries = -1; options->max_sessions = -1; options->banner = ((void *)0); options->use_dns = -1; options->client_alive_interval = -1; options->client_alive_count_max = -1; options->num_authkeys_files = 0; options->num_accept_env = 0; options->num_setenv = 0; options->permit_tun = -1; options->permitted_opens = ((void *)0); options->permitted_listens = ((void *)0); options->adm_forced_command = ((void *)0); options->chroot_directory = ((void *)0); options->authorized_keys_command = ((void *)0); options->authorized_keys_command_user = ((void *)0); options->revoked_keys_file = ((void *)0); options->sk_provider = ((void *)0); options->trusted_user_ca_keys = ((void *)0); options->authorized_principals_file = ((void *)0); options->authorized_principals_command = ((void *)0); options->authorized_principals_command_user = ((void *)0); options->ip_qos_interactive = -1; options->ip_qos_bulk = -1; options->version_addendum = ((void *)0); options->fingerprint_hash = -1; options->disable_forwarding = -1; options->expose_userauth_info = -1; options->required_rsa_size = -1; }
_DWORD *initialize_server_options(_DWORD *a1) { _DWORD *result; memset(a1, 0, 0x1EC8uLL); a1[1926] = -1; *a1 = 0; a1[1] = 0; *((_QWORD *)a1 + 129) = 0LL; a1[260] = 0; *((_QWORD *)a1 + 131) = 0LL; a1[264] = 0; a1[265] = -1; *((_QWORD *)a1 + 133) = 0LL; a1[272] = 0; a1[276] = 0; *((_QWORD *)a1 + 139) = 0LL; *((_QWORD *)a1 + 140) = 0LL; a1[284] = -1; a1[285] = -1; a1[286] = -1; a1[287] = -1; a1[288] = -1; a1[289] = -1; a1[290] = -1; a1[291] = -1; a1[292] = -1; a1[296] = -1; a1[297] = -1; *((_QWORD *)a1 + 147) = 0LL; a1[298] = -1; a1[299] = -1; a1[311] = -1; a1[312] = -1; a1[313] = 0; *((_QWORD *)a1 + 157) = 0LL; a1[316] = -1; a1[317] = -1; *((_QWORD *)a1 + 159) = 0LL; *((_QWORD *)a1 + 160) = 0LL; a1[324] = -1; a1[328] = -1; *((_QWORD *)a1 + 163) = 0LL; a1[329] = -1; a1[330] = -1; a1[331] = -1; a1[332] = -1; a1[333] = -1; a1[334] = -1; a1[335] = -1; a1[336] = -1; a1[337] = -1; a1[338] = -1; a1[339] = -1; *((_QWORD *)a1 + 170) = 0LL; a1[342] = -1; *((_QWORD *)a1 + 976) = -1LL; a1[1954] = -1; a1[343] = -1; a1[344] = -1; a1[345] = -1; a1[347] = 0; a1[350] = 0; a1[354] = 0; a1[358] = 0; *((_QWORD *)a1 + 151) = 0LL; *((_QWORD *)a1 + 152) = 0LL; *((_QWORD *)a1 + 153) = 0LL; *((_QWORD *)a1 + 161) = 0LL; a1[308] = -1; a1[309] = -1; a1[310] = -1; a1[362] = 0; a1[1908] = -1; a1[1909] = -1; a1[1910] = -1; a1[1911] = -1; a1[1912] = -1; a1[1913] = -1; a1[1914] = -1; a1[1915] = -1; *((_QWORD *)a1 + 958) = 0LL; a1[1918] = -1; a1[1919] = -1; a1[1920] = -1; a1[1921] = 0; a1[1900] = 0; a1[1904] = 0; a1[1927] = -1; *((_QWORD *)a1 + 964) = 0LL; *((_QWORD *)a1 + 966) = 0LL; *((_QWORD *)a1 + 962) = 0LL; *((_QWORD *)a1 + 968) = 0LL; *((_QWORD *)a1 + 971) = 0LL; *((_QWORD *)a1 + 972) = 0LL; *((_QWORD *)a1 + 969) = 0LL; *((_QWORD *)a1 + 983) = 0LL; *((_QWORD *)a1 + 970) = 0LL; *((_QWORD *)a1 + 973) = 0LL; *((_QWORD *)a1 + 974) = 0LL; *((_QWORD *)a1 + 975) = 0LL; a1[300] = -1; a1[301] = -1; *((_QWORD *)a1 + 978) = 0LL; a1[1962] = -1; a1[346] = -1; a1[1963] = -1; result = a1; a1[1968] = -1; return result; }
openssh-portable
ida
inline int ext2fs_dirent_name_len(const struct ext2_dir_entry *entry) { return entry->name_len & 0xff; }
void ext2fs_dirent_name_len(void) { halt_baddata(); }
e2fsprogs-1.46.5
ghidra
int el_wparse(EditLine *el, int argc, const wchar_t *argv[]) { const wchar_t *ptr; int i; if (argc < 1) return -1; ptr = wcschr(argv[0], L':'); if (ptr != ((void *)0)) { wchar_t *tprog; size_t l; if (ptr == argv[0]) return 0; l = (size_t)(ptr - argv[0]); tprog = calloc(l + 1, sizeof(*tprog)); if (tprog == ((void *)0)) return 0; (void)wcsncpy(tprog, argv[0], l); tprog[l] = '\0'; ptr++; l = (size_t)el_match(el->el_prog, tprog); free(tprog); if (!l) return 0; } else ptr = argv[0]; for (i = 0; cmds[i].name != ((void *)0); i++) if (wcscmp(cmds[i].name, ptr) == 0) { i = (*cmds[i].func)(el, argc, argv); return -i; } return -1; }
int el_wparse(unsigned long long *a0, unsigned long a1, unsigned long long *a2) { unsigned int v0; unsigned short *v1; unsigned long v2; unsigned long long v3; unsigned int v5; if (a1 <= 0) { v5 = -1; } else { v1 = wcschr(*(a2), 0x3a); if (!v1) { v1 = *(a2); } else { if (v1 == *(a2)) { v5 = 0; goto LABEL_400232; } v2 = v1 - *(a2) >> 2; v3 = calloc(v2 + 1, 0x4); if (!v3) { v5 = 0; goto LABEL_400232; } wcsncpy(v3, *(a2), v2); *((v3 + v2 * 4)) = 0; v1 += 4; v2 = el_match(*(a0), v3, v3); free(v3); if (!v2) { v5 = 0; goto LABEL_400232; } } v0 = 0; while (true) { if (!cmds[2 * v0]) { v5 = -1; break; } else if (wcscmp(cmds[2 * v0], v1)) { v0 += 1; } else { v0 = (&g_400888)[2 * v0](a0, a1, a2, a1, (&g_400888)[2 * v0]); v5 = -(v0); break; } } } LABEL_400232: return v5; }
libedit
angr_phoenix
int main(int argc, char **argv) { int ch, fflag, tflag, status, n; char **newargv, *argv0; const char *errstr; enum scp_mode_e mode = MODE_SFTP; char *sftp_direct = ((void *)0); sanitise_stdfd(); msetlocale(); argv0 = argv[0]; newargv = xcalloc((((argc + 1) > (1)) ? (argc + 1) : (1)), sizeof(*newargv)); for (n = 0; n < argc; n++) newargv[n] = xstrdup(argv[n]); argv = newargv; __progname = ssh_get_progname(argv[0]); log_init(argv0, log_level, SYSLOG_FACILITY_USER, 2); memset(&args, '\0', sizeof(args)); memset(&remote_remote_args, '\0', sizeof(remote_remote_args)); args.list = remote_remote_args.list = ((void *)0); addargs(&args, "%s", ssh_program); addargs(&args, "-x"); addargs(&args, "-oPermitLocalCommand=no"); addargs(&args, "-oClearAllForwardings=yes"); addargs(&args, "-oRemoteCommand=none"); addargs(&args, "-oRequestTTY=no"); fflag = Tflag = tflag = 0; while ((ch = BSDgetopt(argc, argv, "12346ABCTdfOpqRrstvD:F:J:M:P:S:c:i:l:o:")) != -1) { switch (ch) { case '1': sshfatal("scp.c", __func__, 487, 0, SYSLOG_LEVEL_FATAL, ((void *)0), "SSH protocol v.1 is no longer supported"); break; case '2': break; case 'A': case '4': case '6': case 'C': addargs(&args, "-%c", ch); addargs(&remote_remote_args, "-%c", ch); break; case 'D': sftp_direct = BSDoptarg; break; case '3': throughlocal = 1; break; case 'R': throughlocal = 0; break; case 'o': case 'c': case 'i': case 'F': case 'J': addargs(&remote_remote_args, "-%c", ch); addargs(&remote_remote_args, "%s", BSDoptarg); addargs(&args, "-%c", ch); addargs(&args, "%s", BSDoptarg); break; case 'O': mode = MODE_SCP; break; case 's': mode = MODE_SFTP; break; case 'P': sshport = a2port(BSDoptarg); if (sshport <= 0) sshfatal("scp.c", __func__, 527, 0, SYSLOG_LEVEL_FATAL, ((void *)0), "bad port \"%s\"\n", BSDoptarg); break; case 'B': addargs(&remote_remote_args, "-oBatchmode=yes"); addargs(&args, "-oBatchmode=yes"); break; case 'l': limit_kbps = strtonum(BSDoptarg, 1, 100 * 1024 * 1024, &errstr); if (errstr != ((void *)0)) usage(); limit_kbps *= 1024; bandwidth_limit_init(&bwlimit, limit_kbps, 16384); break; case 'p': pflag = 1; break; case 'r': iamrecursive = 1; break; case 'S': ssh_program = xstrdup(BSDoptarg); break; case 'v': addargs(&args, "-v"); addargs(&remote_remote_args, "-v"); if (verbose_mode == 0) log_level = SYSLOG_LEVEL_DEBUG1; else if (log_level < SYSLOG_LEVEL_DEBUG3) log_level++; verbose_mode = 1; break; case 'q': addargs(&args, "-q"); addargs(&remote_remote_args, "-q"); showprogress = 0; break; case 'd': targetshouldbedirectory = 1; break; case 'f': iamremote = 1; fflag = 1; break; case 't': iamremote = 1; tflag = 1; break; case 'T': Tflag = 1; break; default: usage(); } } argc -= BSDoptind; argv += BSDoptind; log_init(argv0, log_level, SYSLOG_FACILITY_USER, 2); addargs(&args, "-oForwardAgent=no"); if (iamremote) mode = MODE_SCP; if ((pwd = getpwuid(userid = getuid())) == ((void *)0)) sshfatal("scp.c", __func__, 599, 0, SYSLOG_LEVEL_FATAL, ((void *)0), "unknown user %u", (u_int)userid); if (!isatty(1)) showprogress = 0; if (pflag) { } else { if (pledge("stdio rpath wpath cpath fattr tty proc exec", ((void *)0)) == -1) { perror("pledge"); exit(1); } } remin = 0; remout = 1; if (fflag) { (void)response(); source(argc, argv); exit(errs != 0); } if (tflag) { sink(argc, argv, ((void *)0)); exit(errs != 0); } if (argc < 2) usage(); if (argc > 2) targetshouldbedirectory = 1; remin = remout = -1; do_cmd_pid = -1; (void)snprintf(cmd, sizeof cmd, "scp%s%s%s%s", verbose_mode ? " -v" : "", iamrecursive ? " -r" : "", pflag ? " -p" : "", targetshouldbedirectory ? " -d" : ""); (void)ssh_signal(13, lostconn); if (colon(argv[argc - 1])) toremote(argc, argv, mode, sftp_direct); else { if (targetshouldbedirectory) verifydir(argv[argc - 1]); tolocal(argc, argv, mode, sftp_direct); } if (do_cmd_pid != -1 && (mode == MODE_SFTP || errs == 0)) { if (remin != -1) (void)close(remin); if (remout != -1) (void)close(remout); if (waitpid(do_cmd_pid, &status, 0) == -1) errs = 1; else { if (!(((status) & 0x7f) == 0) || (((status) & 0xff00) >> 8) != 0) errs = 1; } } exit(errs != 0); }
int main(unsigned long long a0, unsigned long long a1) { unsigned long long *v0; unsigned int v1; char v2; unsigned int v3; unsigned int v4; unsigned int v5; unsigned int v6; unsigned int v7; char v8; void *v9; unsigned long long v10; unsigned long long *v11; unsigned long v12; unsigned long long v13; unsigned long long v14; unsigned long v16; unsigned long long *v17; unsigned long long v18; unsigned long long v19; unsigned long long v20; unsigned long long v21; unsigned long long v22; struct_0 *v23; unsigned long long v24; unsigned long long v26; unsigned long long v27; unsigned long long v28; unsigned long long v29; v13 = v16; v1 = a0; v0 = a1; v12 = v17[5]; v6 = 1; v9 = 0; sanitise_stdfd(); msetlocale(a0, a1, v18, v19, v20, v21); v10 = *(v0); v22 = __addvsi3(v1, 0x1); if (v22 <= 0) v22 = 1; v11 = xcalloc(v22, 0x8, 0x1); for (v5 = 0; v5 < v1; v5 = __addvsi3(v5, 0x1)) { v11[v5] = xstrdup(v0[v5]); } v0 = v11; __progname = ssh_get_progname(*(v0)); log_init(v10, log_level, 0x1, 0x2); memset(&remote_remote_args, 0x0, 0x10); memset(&remote_remote_args, 0x0, 0x10); remote_remote_args = 0; remote_remote_args = 142007424292452101; addargs(&remote_remote_args, "%s"); addargs(&remote_remote_args, "-x"); addargs(&remote_remote_args, "-oPermitLocalCommand=no"); addargs(&remote_remote_args, "-oClearAllForwardings=yes"); addargs(&remote_remote_args, "-oRemoteCommand=none"); addargs(&remote_remote_args, "-oRequestTTY=no"); v4 = 0; targetshouldbedirectory = v4; v3 = 1219493948222425173; if (true) { while (true) { v7 = BSDgetopt(v1, v0, "12346ABCTdfOpqRrstvD:F:J:M:P:S:c:i:l:o:", v0); if (v7 != -1) { v23 = __addvsi3(v7, 0xffffffcf); switch (v23) { case 0: v13 = "SSH protocol v.1 is no longer supported"; sshfatal("scp.c", "main", 0x1e7, 0x0, 0x1, 0x0); case 1: break; case 2: throughlocal = 1; break; case 3: case 5: case 16: case 18: addargs(&remote_remote_args, "-%c"); addargs(&remote_remote_args, "-%c"); break; case 17: addargs(&remote_remote_args, "-oBatchmode=yes"); addargs(&remote_remote_args, "-oBatchmode=yes"); break; case 19: v9 = *(&BSDoptarg); break; case 21: case 25: case 50: case 56: case 62: addargs(&remote_remote_args, "-%c"); addargs(&remote_remote_args, "%s"); addargs(&remote_remote_args, "-%c"); addargs(&remote_remote_args, "%s"); break; case 30: v6 = 0; break; case 31: sshport = a2port(*(&BSDoptarg)); if (sshport > 0) continue; v14 = *(&BSDoptarg); v13 = "bad port \"%s\"\n"; sshfatal("scp.c", "main", 0x20f, 0x0, 0x1, 0x0); case 33: throughlocal = 0; break; case 34: ssh_program = xstrdup(*(&BSDoptarg)); break; case 35: targetshouldbedirectory = 1; break; case 51: targetshouldbedirectory = 1; break; case 53: targetshouldbedirectory = 1; v3 = 1; break; case 59: limit_kbps = strtonum(*(&BSDoptarg), 0x1, 0x6400000, &v8); if (*(&v8)) usage(); limit_kbps = __mulvdi3(limit_kbps, 0x400); bandwidth_limit_init(&cmd, limit_kbps, 0x4000); break; case 63: targetshouldbedirectory = 1; break; case 64: addargs(&remote_remote_args, "-q"); addargs(&remote_remote_args, "-q"); showprogress = 0; break; case 65: targetshouldbedirectory = 1; break; case 66: v6 = 1; break; case 67: targetshouldbedirectory = 1; v4 = 1; break; case 69: addargs(&remote_remote_args, "-v"); addargs(&remote_remote_args, "-v"); if (!verbose_mode) { log_level = 5; } else if (log_level <= 6) { log_level = __addvsi3(log_level, 0x1); } verbose_mode = 1; break; default: usage(); } if (v23 <= 69) v24 = *((0x4 * &v23->padding_0[0] + &g_406e80)) + &g_406e80; } else { v1 = __subvsi3(v1, BSDoptind); v0 = &v0[BSDoptind]; log_init(v10, log_level, 0x1, 0x2); addargs(&remote_remote_args, "-oForwardAgent=no"); v6 = 0; targetshouldbedirectory = getuid(); pwd = getpwuid(0xe5894855); if (true) break; if (false) { v14 = 1219493948222425173; v13 = "unknown user %u"; sshfatal("scp.c", "main", 0x257, 0x0, 0x1, 0x0); break; } } } } if (!isatty(0x1)) showprogress = 0; if (false) { v26 = pledge("stdio rpath wpath cpath fattr tty proc exec", 0x0); perror("pledge"); exit(0x1); } targetshouldbedirectory = 0; targetshouldbedirectory = 1; if (v3) { response(); source(v1, v0); exit(1219493948222425173); } else if (v4) { sink(v1, v0, 0x0); exit(1219493948222425173); } else if (v1 <= 1) { usage(); } else { if (v1 > 2) targetshouldbedirectory = 1; targetshouldbedirectory = -1; targetshouldbedirectory = 1219493948222425173; do_cmd_pid = -1; v27 = " -d"; if (false) v27 = &g_406e67; v28 = " -p"; if (false) v28 = &g_406e67; v29 = " -r"; if (false) v29 = &g_406e67; v13 = v27; snprintf(&cmd, 0x40, "scp%s%s%s%s"); ssh_signal(0xd, lostconn); if (colon(v0[__addvsi3(v1, 0xffffffff)])) { toremote(v1, v0, v6, v9, v29, v28); } else { verifydir(v0[__addvsi3(v1, 0xffffffff)]); tolocal(v1, v0, v6, v9, v29, v28); } if (do_cmd_pid != -1 && v6 == 1) { close(0xe5894855); close(0xe5894855); if (waitpid(do_cmd_pid, &v2, 0x0) == -1) { targetshouldbedirectory = 1; } else if ((*(&v2) & 127) || (*(&v2) >> 8)) { targetshouldbedirectory = 1; } } exit(1219493948222425173); } }
openssh-portable
angr_dream
static inline intmax_t simple_round_to_zero(long double val) { return val; }
long simple_round_to_zero(long double a1) { return (long)a1; }
coreutils
ida
static void expand(void) { FILE *fp = next_file(((void *)0)); if (!fp) return; while (1) { int c; _Bool convert = 1; uintmax_t column = 0; size_t tab_index = 0; do { while ((c = getc_unlocked(fp)) < 0 && (fp = next_file(fp))) continue; if (convert) { if (c == '\t') { uintmax_t next_tab_column; _Bool last_tab; next_tab_column = get_next_tab_column(column, &tab_index, &last_tab); if (last_tab) next_tab_column = column + 1; if (next_tab_column < column) ((!!sizeof(struct { _Static_assert(1, "verify_expr (" "1" ", " "(error (1, 0, gettext (\"input line is too " "long\")), assume (false))" ")"); int _gl_dummy; })) ? ((error(1, 0, gettext("input line is too long")), ((0) ? (void)0 : __builtin_unreachable()))) : ((error(1, 0, gettext("input line is too long")), ((0) ? (void)0 : __builtin_unreachable())))); while (++column < next_tab_column) if (putchar_unlocked(' ') < 0) ((!!sizeof(struct { _Static_assert(1, "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), gettext " "(\"write error\")), assume (false))" ")"); int _gl_dummy; })) ? ((error(1, (*__errno_location()), gettext("write error")), ((0) ? (void)0 : __builtin_unreachable()))) : ((error(1, (*__errno_location()), gettext("write error")), ((0) ? (void)0 : __builtin_unreachable())))); c = ' '; } else if (c == '\b') { column -= !!column; tab_index -= !!tab_index; } else { column++; if (!column) ((!!sizeof(struct { _Static_assert(1, "verify_expr (" "1" ", " "(error (1, 0, gettext (\"input line is too " "long\")), assume (false))" ")"); int _gl_dummy; })) ? ((error(1, 0, gettext("input line is too long")), ((0) ? (void)0 : __builtin_unreachable()))) : ((error(1, 0, gettext("input line is too long")), ((0) ? (void)0 : __builtin_unreachable())))); } convert &= convert_entire_line || !!((*__ctype_b_loc())[(int)((c))] & (unsigned short int)_ISblank); } if (c < 0) return; if (putchar_unlocked(c) < 0) ((!!sizeof(struct { _Static_assert(1, "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), gettext " "(\"write error\")), assume (false))" ")"); int _gl_dummy; })) ? ((error(1, (*__errno_location()), gettext("write error")), ((0) ? (void)0 : __builtin_unreachable()))) : ((error(1, (*__errno_location()), gettext("write error")), ((0) ? (void)0 : __builtin_unreachable())))); } while (c != '\n'); } }
void expand() { char v0; char v1; unsigned int v2; void *v3; void *v4; void *v5; unsigned long v6; char v7; unsigned int v9; unsigned long long *v11; unsigned long long v12; v4 = next_file(0x0); if (v4) { do { v1 = 1; v5 = 0; v3 = 0; while (true) { v2 = getc_unlocked(v4); if (v2 < 0) { v4 = next_file(v4); continue; } if (v1) { if (v2 == 9) { v6 = get_next_tab_column(v5, &v3, &v0, &v3); if (v0) v6 = v5 + 1; if (v6 < v5) error(0x1, 0x0, gettext("input line is too long")); while (true) { v5 += 1; if (v5 < v6) { v9 = putchar_unlocked(0x20); if (v9 >= 0) continue; error(0x1, *(__errno_location()), gettext("write error")); } else { v2 = 32; break; } } } else if (v2 != 8) { v5 += 1; if (!v5) error(0x1, 0x0, gettext("input line is too long")); } if (v2 == 8) { v5 -= v5; v3 -= v3; } if ((v6 >= v5 || v2 != 9) && (v2 == 8 || v2 == 9 || v5)) { if (!convert_entire_line) { *(&v9) = *((*(__ctype_b_loc()) + v2 * 2)); v9 = v9 & 1; if (!v9) v9 = 0; } if (convert_entire_line || v9) v9 = 1; v9 &= v1; v1 = v9; } } if (!v1 || v2 == 8 || v2 == 9 && v6 >= v5 || v2 != 9 && v5) { if (v2 < 0) break; if (v2 >= 0) { if (putchar_unlocked(v2) < 0) error(0x1, *(__errno_location()), gettext("write error")); if (v2 == 10) break; } } } } while (v2 >= 0); } v12 = *(&v7) ^ v11[5]; return; }
coreutils
angr_dream
static size_t raw_hasher(const void *data, size_t n) { size_t val = rotr_sz((size_t)data, 3); return val % n; }
unsigned long raw_hasher(long a1, unsigned long a2) { return rotr_sz(a1, 3LL) % a2; }
gnutls
ida
static char *quote_breaks(char *s) { register char *p, *r; char *ret; int len = 3; for (p = s; p && *p; p++, len++) { if (*p == '\'') len += 3; else if ((((*p) == ' ') || ((*p) == '\t')) || *p == '\n') len += 2; } r = ret = (char *)xmalloc(len); *r++ = '\''; for (p = s; p && *p;) { if (*p == '\'') { *r++ = '\''; *r++ = '\\'; *r++ = '\''; *r++ = '\''; p++; } else if ((((*p) == ' ') || ((*p) == '\t')) || *p == '\n') { *r++ = '\''; *r++ = *p++; *r++ = '\''; } else *r++ = *p++; } *r++ = '\''; *r = '\0'; return ret; }
undefined *quote_breaks(char *param_1) { undefined *puVar1; char *pcVar2; int local_24; local_24 = 3; for (pcVar2 = param_1; (pcVar2 != (char *)0x0 && (*pcVar2 != '\0')); pcVar2 = pcVar2 + 1) { if (*pcVar2 == '\'') { local_24 = local_24 + 3; } else if (((*pcVar2 == ' ') || (*pcVar2 == '\t')) || (*pcVar2 == '\n')) { local_24 = local_24 + 2; } local_24 = local_24 + 1; } puVar1 = (undefined *)xmalloc((long)local_24); *puVar1 = 0x27; pcVar2 = puVar1 + 1; while ((param_1 != (char *)0x0 && (*param_1 != '\0'))) { if (*param_1 == '\'') { *pcVar2 = '\''; pcVar2[1] = '\\'; pcVar2[2] = '\''; pcVar2[3] = '\''; param_1 = param_1 + 1; pcVar2 = pcVar2 + 4; } else if (((*param_1 == ' ') || (*param_1 == '\t')) || (*param_1 == '\n')) { *pcVar2 = '\''; pcVar2[1] = *param_1; pcVar2[2] = '\''; param_1 = param_1 + 1; pcVar2 = pcVar2 + 3; } else { *pcVar2 = *param_1; param_1 = param_1 + 1; pcVar2 = pcVar2 + 1; } } *pcVar2 = '\''; pcVar2[1] = '\0'; return puVar1; }
bash
ghidra
_Bool apply_predicate(const char *pathname, struct stat *stat_buf, struct predicate *p) { ++p->perf.visits; if (p->need_stat || p->need_type || p->need_inum) { if (get_info(pathname, stat_buf, p) != 0) return 0; } if ((p->pred_func)(pathname, stat_buf, p)) { ++(p->perf.successes); return 1; } else { return 0; } }
long long apply_predicate(unsigned long long a0, void *a1, struct_0 *a2) { unsigned long long v1; a2->field_120 = a2->field_120 + 1; if (!a2->field_1a && !a2->field_1b && !a2->field_1c) goto LABEL_4019d6; if (get_info(a0, a1, a2)) { v1 = 0; goto LABEL_401a1c; } LABEL_4019d6: if (!a2->field_0(a0, a1, a2, a1, a2->field_0)) { v1 = 0; } else { a2->field_128 = a2->field_128 + 1; v1 = 1; } LABEL_401a1c: return v1; }
findutils
angr_phoenix