input
stringlengths
26
172k
output
stringlengths
18
318k
repo_name
stringclasses
23 values
decompiler
stringclasses
5 values
static void sieve_large(u_int32_t s32) { u_int64_t r, u, s = s32; sshlog("moduli.c", __func__, 191, 0, SYSLOG_LEVEL_DEBUG3, ((void *)0), "sieve_large %u", s32); largetries++; r = BN_mod_word(largebase, s32); if (r == 0) u = 0; else u = s - r; if (u < largebits * 2ULL) { if (u & 0x1) u += s; for (u /= 2; u < largebits; u += s) ((LargeSieve)[(u) >> ((3) + (2))] |= (1L << ((u) & 31))); } r = (2 * r + 1) % s; if (r == 0) u = 0; else u = s - r; if (u < largebits * 4ULL) { while (u & 0x3) { if ((0xffffffffUL) - u < s) return; u += s; } for (u /= 4; u < largebits; u += s) ((LargeSieve)[(u) >> ((3) + (2))] |= (1L << ((u) & 31))); } }
unsigned long sieve_large(unsigned int a1) { unsigned long result; unsigned long v2; unsigned long i; unsigned long v4; unsigned long j; long v6; unsigned long v7; sshlog("moduli.c", "sieve_large", 191LL, 0LL, 7LL, 0LL, "sieve_large %u", a1); ++largetries; v6 = BN_mod_word(largebase, a1); if (v6) v2 = a1 - v6; else v2 = 0LL; if (v2 < 2 * (unsigned long)(unsigned int)largebits) { if ((v2 & 1) != 0) v2 += a1; for (i = v2 >> 1; i < (unsigned int)largebits; i += a1) *((_DWORD *)LargeSieve + (i >> 5)) |= 1LL << (i & 0x1F); } v7 = (2 * v6 + 1) % (unsigned long)a1; if (v7) v4 = a1 - v7; else v4 = 0LL; result = 4LL * (unsigned int)largebits; if (v4 < result) { while ((v4 & 3) != 0) { result = 0xFFFFFFFF - v4; if (a1 > 0xFFFFFFFF - v4) return result; v4 += a1; } for (j = v4 >> 2;; j += a1) { result = (unsigned int)largebits; if (j >= (unsigned int)largebits) break; *((_DWORD *)LargeSieve + (j >> 5)) |= 1LL << (j & 0x1F); } } return result; }
openssh-portable
ida
void e2fsck_write_bitmaps(e2fsck_t ctx) { ext2_filsys fs = ctx->fs; errcode_t retval; const char *old_op; old_op = ehandler_operation((gettext("writing block and inode bitmaps"))); retval = ext2fs_write_bitmaps(fs); ehandler_operation(old_op); if (retval) { com_err(ctx->program_name, retval, (gettext("while rewriting block and inode bitmaps for %s")), ctx->device_name); fatal_error(ctx, 0); } }
long long e2fsck_write_bitmaps(unsigned long long a0[4]) { unsigned long long v0; unsigned long long v1; unsigned long long v2; v0 = a0[0]; v1 = ehandler_operation(gettext("writing block and inode bitmaps")); v2 = ext2fs_write_bitmaps(v0); if (!v2) return ehandler_operation(v1); com_err(a0[1], v2, gettext("while rewriting block and inode bitmaps for %s"), a0[3]); fatal_error(); }
e2fsprogs-1.46.5
angr_phoenix
static void print_linktype(FILE *fp, struct rtattr *tb) { struct rtattr *linkinfo[(__IFLA_INFO_MAX - 1) + 1]; struct link_util *lu; struct link_util *slave_lu; char slave[32]; (parse_rtattr_flags( (linkinfo), ((__IFLA_INFO_MAX - 1)), ((void *)(((char *)(tb)) + ((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0)))), ((int)((tb)->rta_len) - ((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0))), (1 << 15))); open_json_object("linkinfo"); if (linkinfo[IFLA_INFO_KIND]) { const char *kind = rta_getattr_str(linkinfo[IFLA_INFO_KIND]); print_nl(); print_string(PRINT_ANY, "info_kind", " %s ", kind); lu = get_link_kind(kind); if (lu && lu->print_opt) { struct rtattr *attr[lu->maxattr + 1], **data = ((void *)0); if (linkinfo[IFLA_INFO_DATA]) { (parse_rtattr_flags( (attr), (lu->maxattr), ((void *)(((char *)(linkinfo[IFLA_INFO_DATA])) + ((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0)))), ((int)((linkinfo[IFLA_INFO_DATA])->rta_len) - ((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0))), (1 << 15))); data = attr; } open_json_object("info_data"); lu->print_opt(lu, fp, data); close_json_object(); if (linkinfo[IFLA_INFO_XSTATS] && show_stats && lu->print_xstats) { open_json_object("info_xstats"); lu->print_xstats(lu, fp, linkinfo[IFLA_INFO_XSTATS]); close_json_object(); } } } if (linkinfo[IFLA_INFO_SLAVE_KIND]) { const char *slave_kind = rta_getattr_str(linkinfo[IFLA_INFO_SLAVE_KIND]); print_nl(); print_string(PRINT_ANY, "info_slave_kind", " %s_slave ", slave_kind); snprintf(slave, sizeof(slave), "%s_slave", slave_kind); slave_lu = get_link_kind(slave); if (slave_lu && slave_lu->print_opt) { struct rtattr *attr[slave_lu->maxattr + 1], **data = ((void *)0); if (linkinfo[IFLA_INFO_SLAVE_DATA]) { (parse_rtattr_flags( (attr), (slave_lu->maxattr), ((void *)(((char *)(linkinfo[IFLA_INFO_SLAVE_DATA])) + ((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0)))), ((int)((linkinfo[IFLA_INFO_SLAVE_DATA])->rta_len) - ((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0))), (1 << 15))); data = attr; } open_json_object("info_slave_data"); slave_lu->print_opt(slave_lu, fp, data); close_json_object(); } } close_json_object(); }
void print_linktype(unsigned long long a0, unsigned short *a1, unsigned long long a2, unsigned long a3, unsigned long long a4, unsigned long long a5) { unsigned long v0; void *v1; unsigned long v2; void *v3; unsigned long long v4; unsigned long long v5; unsigned long long v6; struct_1 *v7; unsigned long v8; unsigned long long v9; unsigned long long v10; struct_0 *v11; unsigned long v12; unsigned long long v13; char v14; char v15; char v16; char v17; char v18; char v19; char v20; char v21; unsigned long long v22; char v23; char v24; unsigned long long *v26; unsigned long long v27; parse_rtattr_flags(&v14, 0x5, a1 + 2, *(a1)-4, 0x8000); open_json_object("linkinfo"); if (*(&v15)) { v6 = rta_getattr_str(*(&v15)); print_nl(a0, 0x5, a2, a3, 0x8000, a5); print_string(0x4, "info_kind", " %s ", v6); v7 = get_link_kind(v6); if (v7 && v7->field_20) { v8 = v7->field_10 - 0; v2 = v7->field_10 + 1; v3 = 0; v0 = v7->field_10 + 1; for (v1 = 0; &v23 != &v0 + -1 * ((0 CONCAT 15 + (v7->field_10 + 1 << 3)) / m 16 * 16 & -0x1000); v22 = *(&v22)) ; if ((((0 CONCAT 15 + (v7->field_10 + 1 << 3)) / m 16 * 16) & 4095)) *((&v22 + (((0 CONCAT 15 + (v7->field_10 + 1) * 8) / m 16 * 16) & 4095))) = *((&v22 + (((0 CONCAT 15 + (v7->field_10 + 1) * 8) / m 16 * 16) & 4095))); v9 = (&v24 >> 3) * 8; v5 = 0; if (*(&v16)) { parse_rtattr_flags(v9, v7->field_10, *(&v16) + 4, *(*(&v16)) - 4, 0x8000); v5 = v9; } open_json_object("info_data"); v7->field_20(v7, a0, v5, a0, v7->field_20); close_json_object(a0, a1, a2, a3, a4, a5); if (*(&v17) && show_stats && v7->field_28) { open_json_object("info_xstats"); v7->field_28(v7, a0, *(&v17), a0, v7->field_28); close_json_object(a0, a1, a2, a3, a4, a5); } } } if (*(&v18)) { v10 = rta_getattr_str(*(&v18)); print_nl(a0, a1, a2, a3, a4, a5); print_string(0x4, "info_slave_kind", " %s_slave ", v10); a3 = v10; snprintf(&v20, 0x20, "%s_slave", v10); v11 = get_link_kind(&v20); if (v11 && v11->field_20) { for (v12 = v11->field_10 - 0; &v23 != &v0 + -1 * ((0 CONCAT 15 + (v11->field_10 + 1 << 3)) / m 16 * 16 & -0x1000); v22 = v22) ; if ((((0 CONCAT 15 + (v11->field_10 + 1 << 3)) / m 16 * 16) & 4095)) *((&v22 + (((0 CONCAT 15 + (v11->field_10 + 1) * 8) / m 16 * 16) & 4095))) = *((&v22 + (((0 CONCAT 15 + (v11->field_10 + 1) * 8) / m 16 * 16) & 4095))); v13 = (&v24 >> 3) * 8; v4 = 0; if (*(&v19)) { parse_rtattr_flags(v13, v11->field_10, *(&v19) + 4, *(*(&v19)) - 4, 0x8000); v4 = v13; } open_json_object("info_slave_data"); v11->field_20(v11, a0, v4, a0, v11->field_20); close_json_object(a0, a1, a2, reg_24, a4, a5); } } close_json_object(a0, a1, a2, a3, a4, a5); v27 = *(&v21) ^ v26[5]; return; }
iproute2-6.0.0
angr_phoenix
static _Bool skipped_file(char const *name, _Bool command_line, _Bool is_dir) { struct exclude **pats; if (!is_dir) pats = excluded_patterns; else if (directories == SKIP_DIRECTORIES) return 1; else if (command_line && omit_dot_slash) return 0; else pats = excluded_directory_patterns; return pats[command_line] && excluded_file_name(pats[command_line], name); }
undefined4 skipped_file(undefined8 param_1, byte param_2, char param_3) { char cVar1; undefined4 uVar2; undefined1 *local_10; if (param_3 == '\x01') { if (directories == 4) { return 1; } if ((param_2 != 0) && (omit_dot_slash != '\0')) { return 0; } local_10 = excluded_directory_patterns; } else { local_10 = excluded_patterns; } if ((*(long *)(local_10 + (ulong)param_2 * 8) == 0) || (cVar1 = excluded_file_name( *(undefined8 *)(local_10 + (ulong)param_2 * 8), param_1), cVar1 == '\0')) { uVar2 = 0; } else { uVar2 = 1; } return uVar2; }
grep
ghidra
char *sh_get_env_value(const char *varname) { return ((char *)getenv(varname)); }
void sh_get_env_value(char *param_1) { getenv(param_1); return; }
bash
ghidra
_Bool transform_program_p (void) { return transform_head != ((void *)0); }
long long transform_program_p() { unsigned long long v1; v1 = transform_head; *(&v1) = transform_head; return v1; }
tar
angr_dream
static int append(char *cp, char ***ap, size_t *np) { char **tmp; if ((tmp = reallocarray(*ap, *np + 1, sizeof(*tmp))) == ((void *)0)) return -1; tmp[(*np)] = cp; (*np)++; *ap = tmp; return 0; }
int append(unsigned long a0, unsigned long long *a1, unsigned long long *a2) { unsigned long long *v0; unsigned long long *v1; unsigned int v3; v0 = a2; v1 = reallocarray(*(a1), *(a2) + 1, 0x8); if (!v1) { v3 = -1; } else { v1[*(a2)] = a0; *(a2) = *(a2) + 1; *(a1) = v1; v3 = 0; } return v3; }
openssh-portable
angr_phoenix
vi_next_char(EditLine *el, wint_t c __attribute__((__unused__))) { return cv_csearch(el, (+1), -1, el->el_state.argument, 0); }
long long vi_next_char(struct_0 *a0, unsigned long a1) { unsigned int v0; v0 = a1; return cv_csearch(a0, 0x1, 0xffffffff, a0->field_78, 0x0); }
libedit
angr_dream
void stat_to_attrib(const struct stat *st, Attrib *a) { attrib_clear(a); a->flags = 0; a->flags |= 0x00000001; a->size = st->st_size; a->flags |= 0x00000002; a->uid = st->st_uid; a->gid = st->st_gid; a->flags |= 0x00000004; a->perm = st->st_mode; a->flags |= 0x00000008; a->atime = st->st_atim.tv_sec; a->mtime = st->st_mtim.tv_sec; }
long long stat_to_attrib(struct_1 *a0, struct_0 *a1) { struct_0 *v0; v0 = a1; attrib_clear(a1); a1->field_0 = 0; a1->field_0 = a1->field_0 | 1; a1->field_8 = a0->field_30; a1->field_0 = a1->field_0 | 2; a1->field_10 = a0->field_1c; a1->field_14 = a0->field_20; a1->field_0 = a1->field_0 | 4; a1->field_18 = a0->field_18; a1->field_0 = a1->field_0 | 8; a1->field_1c = a0->field_48; a1->field_20 = a0->field_58; return a1; }
openssh-portable
angr_phoenix
static char *do_realpath_expand(struct sftp_conn *conn, const char *path, int expand) { struct sshbuf *msg; u_int expected_id, count, id; char *filename, *longname; Attrib a; u_char type; int r; const char *what = "SSH2_FXP_REALPATH"; if (expand) what = "expand-path@openssh.com"; if ((msg = sshbuf_new()) == ((void *)0)) sshfatal("sftp-client.c", __func__, 1009, 1, SYSLOG_LEVEL_FATAL, ((void *)0), "sshbuf_new failed"); expected_id = id = conn->msg_id++; if (expand) { sshlog("sftp-client.c", __func__, 1013, 0, SYSLOG_LEVEL_DEBUG2, ((void *)0), "Sending SSH2_FXP_EXTENDED(expand-path@openssh.com) " "\"%s\"", path); if ((r = sshbuf_put_u8(msg, 200)) != 0 || (r = sshbuf_put_u32(msg, id)) != 0 || (r = sshbuf_put_cstring(msg, "expand-path@openssh.com")) != 0 || (r = sshbuf_put_cstring(msg, path)) != 0) sshfatal("sftp-client.c", __func__, 1020, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "compose %s", what); send_msg(conn, msg); } else { sshlog("sftp-client.c", __func__, 1023, 0, SYSLOG_LEVEL_DEBUG2, ((void *)0), "Sending SSH2_FXP_REALPATH \"%s\"", path); send_string_request(conn, id, 16, path, strlen(path)); } get_msg(conn, msg); if ((r = sshbuf_get_u8(msg, &type)) != 0 || (r = sshbuf_get_u32(msg, &id)) != 0) sshfatal("sftp-client.c", __func__, 1030, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "parse"); if (id != expected_id) sshfatal("sftp-client.c", __func__, 1033, 0, SYSLOG_LEVEL_FATAL, ((void *)0), "ID mismatch (%u != %u)", id, expected_id); if (type == 101) { u_int status; char *errmsg; if ((r = sshbuf_get_u32(msg, &status)) != 0 || (r = sshbuf_get_cstring(msg, &errmsg, ((void *)0))) != 0) sshfatal("sftp-client.c", __func__, 1041, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "parse status"); sshlog("sftp-client.c", __func__, 1042, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "%s %s: %s", expand ? "expand" : "realpath", path, *errmsg == '\0' ? fx2txt(status) : errmsg); free(errmsg); sshbuf_free(msg); return ((void *)0); } else if (type != 104) sshfatal("sftp-client.c", __func__, 1048, 0, SYSLOG_LEVEL_FATAL, ((void *)0), "Expected SSH2_FXP_NAME(%u) packet, got %u", 104, type); if ((r = sshbuf_get_u32(msg, &count)) != 0) sshfatal("sftp-client.c", __func__, 1052, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "parse count"); if (count != 1) sshfatal("sftp-client.c", __func__, 1054, 0, SYSLOG_LEVEL_FATAL, ((void *)0), "Got multiple names (%d) from %s", count, what); if ((r = sshbuf_get_cstring(msg, &filename, ((void *)0))) != 0 || (r = sshbuf_get_cstring(msg, &longname, ((void *)0))) != 0 || (r = decode_attrib(msg, &a)) != 0) sshfatal("sftp-client.c", __func__, 1059, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "parse filename/attrib"); sshlog("sftp-client.c", __func__, 1061, 0, SYSLOG_LEVEL_DEBUG3, ((void *)0), "%s %s -> %s", what, path, filename); free(longname); sshbuf_free(msg); return (filename); }
void do_realpath_expand(struct_0 *a0, char *a1, unsigned long a2) { unsigned int v0; int tmp_17; struct_0 *v1; char v2; char v3; unsigned int v4; unsigned int v5; unsigned int v6; char v7; char v8; unsigned long long v9; unsigned long long v10; char v11; unsigned long long v12; unsigned long long v13; unsigned long long v14; unsigned long long v15; char v16; unsigned long long v18; unsigned long long v19; void *v20; unsigned long long v21; v1 = a0; v0 = a2; v9 = "SSH2_FXP_REALPATH"; if (v0) v9 = "expand-path@openssh.com"; v10 = sshbuf_new(); if (!v10) sshfatal("sftp-client.c", "do_realpath_expand", 0x3f1, 0x1, 0x1, 0x0, "sshbuf_new failed"); tmp_17 = a0->field_18; a0->field_18 = a0->field_18 + 1; v4 = tmp_17; v6 = v4; if (!v0) { v15 = a1; v14 = "Sending SSH2_FXP_REALPATH \"%s\""; sshlog("sftp-client.c", "do_realpath_expand", 0x3ff, 0x0, 0x6, 0x0, *(&v16)); send_string_request(a0, v4, 0x10, a1, strlen(a1)); } else { v15 = a1; v14 = "Sending SSH2_FXP_EXTENDED(expand-path@openssh.com) \"%s\""; sshlog("sftp-client.c", "do_realpath_expand", 0x3f5, 0x0, 0x6, 0x0, *(&v16)); v5 = sshbuf_put_u8(v10, 0xc8, 0x3f5); if (!v5) { v5 = sshbuf_put_u32(v10, v4, v4); if (!v5) { v5 = sshbuf_put_cstring(v10, "expand-path@openssh.com"); if (!v5) { v5 = sshbuf_put_cstring(v10, a1); if (!v5) goto LABEL_403cbb; } } } v15 = v9; v14 = "compose %s"; sshfatal("sftp-client.c", "do_realpath_expand", 0x3fc, 0x1, 0x1, ssh_err(v5), *(&v16)); LABEL_403cbb: send_msg(a0, v10); } get_msg(a0, v10); v5 = sshbuf_get_u8(v10, &v2, &v2); if (!v5) { v5 = sshbuf_get_u32(v10, &v4, &v4); if (!v5) goto LABEL_403dc5; } v14 = "parse"; sshfatal("sftp-client.c", "do_realpath_expand", 0x406, 0x1, 0x1, ssh_err(v5), *(&v16)); LABEL_403dc5: if (v6 != v4) { v14 = v6; v13 = v4; v12 = "ID mismatch (%u != %u)"; sshfatal("sftp-client.c", "do_realpath_expand", 0x409, 0x0, 0x1, 0x0, *(&v16)); } if (v2 == 101) { v5 = sshbuf_get_u32(v10, &v8, &v8); if (!v5) { v5 = sshbuf_get_cstring(v10, &v11, 0x0, &v11); if (!v5) goto LABEL_403e99; } v14 = "parse status"; sshfatal("sftp-client.c", "do_realpath_expand", 0x411, 0x1, 0x1, ssh_err(v5), *(&v16)); LABEL_403e99: if (*(*(&v11))) v18 = *(&v11); else v18 = fx2txt(*(&v8)); if (v0) v19 = "expand"; else v19 = "realpath"; v15 = v18; v14 = a1; v13 = v19; v12 = "%s %s: %s"; sshlog("sftp-client.c", "do_realpath_expand", 0x412, 0x0, 0x2, 0x0, *(&v16)); free(*(&v11)); sshbuf_free(v10); v20 = 0; } else { if (v2 != 104) { v14 = v2; v13 = 104; v12 = "Expected SSH2_FXP_NAME(%u) packet, got %u"; sshfatal("sftp-client.c", "do_realpath_expand", 0x418, 0x0, 0x1, 0x0, *(&v16)); } v5 = sshbuf_get_u32(v10, &v3, &v3); if (v5) { v14 = "parse count"; sshfatal("sftp-client.c", "do_realpath_expand", 0x41c, 0x1, 0x1, ssh_err(v5), *(&v16)); } if (*(&v3) != 1) { v14 = v9; v13 = *(&v3); v12 = "Got multiple names (%d) from %s"; sshfatal("sftp-client.c", "do_realpath_expand", 0x41e, 0x0, 0x1, 0x0, *(&v16)); } v5 = sshbuf_get_cstring(v10, &v7, 0x0, &v7); if (!v5) { v5 = sshbuf_get_cstring(v10, &v8, 0x0, &v8); if (!v5) { v5 = decode_attrib(v10, &v11); if (!v5) goto LABEL_4040bf; } } v14 = "parse filename/attrib"; sshfatal("sftp-client.c", "do_realpath_expand", 0x423, 0x1, 0x1, ssh_err(v5), *(&v16)); LABEL_4040bf: v15 = *(&v7); v14 = a1; v13 = v9; v12 = "%s %s -> %s"; sshlog("sftp-client.c", "do_realpath_expand", 0x425, 0x0, 0x7, 0x0, *(&v16)); free(*(&v8)); sshbuf_free(v10); v21 = *(&v7); } return; }
openssh-portable
angr_phoenix
static void ipstats_enabled_free(struct ipstats_stat_enabled *enabled) { free(enabled->enabled); }
void ipstats_enabled_free(unsigned long long *a0) { unsigned long long v1; v1 = free(*(a0)); return; }
iproute2-6.0.0
angr_sailr
int main(int argc, char **argv) { int c; ; set_program_name(argv[0]); setlocale(6, ""); bindtextdomain("coreutils", "/usr/local/share/locale"); textdomain("coreutils"); initialize_exit_failure(EXIT_CANCELED); atexit(close_stdout); while ((c = getopt_long(argc, argv, "+i:o:e:", longopts, ((void *)0))) != -1) { int opt_fileno; switch (c) { case 'e': case 'i': case 'o': opt_fileno = optc_to_fileno(c); ((void)sizeof( (0 <= opt_fileno && opt_fileno < (sizeof(stdbuf) / sizeof *(stdbuf))) ? 1 : 0), __extension__({ if (0 <= opt_fileno && opt_fileno < (sizeof(stdbuf) / sizeof *(stdbuf))) ; else __assert_fail( "0 <= opt_fileno && opt_fileno < ARRAY_CARDINALITY (stdbuf)", "src/stdbuf.c", 336, __extension__ __PRETTY_FUNCTION__); })); stdbuf[opt_fileno].optc = c; while (c_isspace(*optarg)) optarg++; stdbuf[opt_fileno].optarg = optarg; if (c == 'i' && *optarg == 'L') { error(0, 0, gettext("line buffering stdin is meaningless")); usage(EXIT_CANCELED); } if (!(strcmp(optarg, "L") == 0) && parse_size(optarg, &stdbuf[opt_fileno].size) == -1) ((!!sizeof(struct { _Static_assert( EXIT_CANCELED, "verify_expr (" "EXIT_CANCELED" ", " "(error (EXIT_CANCELED, (*__errno_location ()), gettext " "(\"invalid mode %s\"), quote (optarg)), assume (false))" ")"); int _gl_dummy; })) ? ((error(EXIT_CANCELED, (*__errno_location()), gettext("invalid mode %s"), quote(optarg)), ((0) ? (void)0 : __builtin_unreachable()))) : ((error(EXIT_CANCELED, (*__errno_location()), gettext("invalid mode %s"), quote(optarg)), ((0) ? (void)0 : __builtin_unreachable())))); break; case GETOPT_HELP_CHAR: usage(0); break; ; case GETOPT_VERSION_CHAR: version_etc(stdout, "stdbuf", "GNU coreutils", Version, ("Padraig Brady"), (char *)((void *)0)); exit(0); break; ; default: usage(EXIT_CANCELED); } } argv += optind; argc -= optind; if (argc < 1) { error(0, 0, gettext("missing operand")); usage(EXIT_CANCELED); } if (!set_libstdbuf_options()) { error(0, 0, gettext("you must specify a buffering mode option")); usage(EXIT_CANCELED); } set_program_path(program_name); if (!program_path) program_path = xstrdup("/usr/local/lib/coreutils"); set_LD_PRELOAD(); free(program_path); execvp(*argv, argv); int exit_status = (*__errno_location()) == 2 ? EXIT_ENOENT : EXIT_CANNOT_INVOKE; error(0, (*__errno_location()), gettext("failed to run command %s"), quote(argv[0])); return exit_status; }
int main(unsigned long a0, char **a1) { unsigned long long *v0; unsigned int v1; unsigned int v2; unsigned int v3; unsigned int v4; unsigned long long v6; unsigned int v9; unsigned long long v10; v1 = a0; v0 = a1; set_program_name(*(v0)); setlocale(0x6, &g_4010ab); bindtextdomain("coreutils", "/usr/local/share/locale"); textdomain("coreutils"); initialize_exit_failure(0x7d); atexit(got.close_stdout); while (true) { v2 = getopt_long(v1, v0, "+i:o:e:", &longopts, NULL); if (v2 == -1) { v0 = &v0[optind]; v1 -= optind; if (v1 <= 0) { error(0x0, 0x0, gettext("missing operand")); usage(0x7d); } else if ((set_libstdbuf_options() ^ 1)) { error(0x0, 0x0, gettext("you must specify a buffering mode option")); usage(0x7d); } else { set_program_path(program_name); if (!program_path) { program_path = xstrdup("/usr/local/lib/coreutils"); break; } } } if (v2 > 111) { LABEL_400d3a: usage(0x7d); } if (v2 < 101) { if (v2 == -131) { version_etc(stdout, "stdbuf", "GNU coreutils", Version, "Padraig Brady", 0x0); exit(0x0); } else if (v2 == -130) { usage(0x0); } goto LABEL_400d3a; } if (!((1 << ((v2 - 101) & 63)) & 1041)) goto LABEL_400d3a; v4 = optc_to_fileno(v2); if (v4 < 0) { LABEL_400b81: __assert_fail(); } if (!(v4 <= 2)) goto LABEL_400b81; for (*(&(&g_400ee8)[3 * v4]) = v2; c_isspace(*(optarg)); optarg = optarg + 1) ; (&g_400ef0)[3 * v4] = optarg; if (v2 == 105 && *(optarg) == 76) { error(0x0, 0x0, gettext("line buffering stdin is meaningless")); usage(0x7d); } if (strcmp(optarg, "L") && parse_size(optarg, &(&stdbuf)[2 * v4 + v4]) == -1) { v6 = quote(optarg); error(0x7d, *(__errno_location()), gettext("invalid mode %s")); } } set_LD_PRELOAD(); free(program_path); execvp(*(v0), v0); if (*(__errno_location()) != 2) v9 = 126; else v9 = 127; v3 = v9; v10 = quote(*(v0)); error(0x0, *(__errno_location()), gettext("failed to run command %s")); return v3; }
coreutils
angr_phoenix
static void _write_volume_label(const char *str) { if (archive_format == POSIX_FORMAT) xheader_store("GNU.volume.label", &dummy, str); else { union block *label = find_next_block(); memset(label, 0, 512); strcpy(label->header.name, str); assign_string(&current_stat_info.file_name, label->header.name); current_stat_info.had_trailing_slash = strip_trailing_slashes(current_stat_info.file_name); label->header.typeflag = 'V'; time_to_chars(start_time.tv_sec, label->header.mtime, sizeof(label->header.mtime)); finish_header(&current_stat_info, label, -1); set_next_block_after(label); } }
void _write_volume_label(char *a0) { struct_0 *v0; unsigned long long v2; unsigned long long v3; if (archive_format == 4) { v2 = xheader_store("GNU.volume.label", &dummy, a0); return; } v0 = find_next_block(); memset(v0, 0x0, 0x200); strcpy(v0, a0); assign_string(tar_stat_destroy, v0); read_full_records_option = strip_trailing_slashes(tar_stat_destroy); v0->field_9c = 86; time_to_chars(start_time, &v0->padding_0[136], 0xc, &v0->padding_0[136]); finish_header(0x500188, v0, 0xffffffffffffffff); v3 = set_next_block_after(v0); return; }
tar
angr_sailr
static int redir_varvalue(redir) REDIRECT *redir; { SHELL_VAR *v; char *val, *w; intmax_t vmax; int i; char *sub; int len, vr; w = redir->redirector.filename->word; if (vr = valid_array_reference(w, 0)) { v = array_variable_part(w, 0, &sub, &len); } else { v = find_variable(w); if (v == 0) { v = find_variable_last_nameref(w, 0); if (v && ((((v)->attributes) & (0x0000800)))) { w = ((v)->value); if (vr = valid_array_reference(w, 0)) v = array_variable_part(w, 0, &sub, &len); else v = find_variable(w); } } } if (v == 0 || ((((v)->attributes) & (0x0001000)))) return -1; if (vr && (((((v)->attributes) & (0x0000004))) || ((((v)->attributes) & (0x0000040))))) val = get_array_value(w, 0, (array_eltstate_t *)((void *)0)); else val = get_variable_value(v); if (val == 0 || *val == 0) return -1; if (legal_number(val, &vmax) < 0) return -1; i = vmax; return i; }
int redir_varvalue(struct_0 *a0) { char v0; unsigned int v1; unsigned int v2; char v3; char v4; struct_2 *v5; char *v6; unsigned long long v7; unsigned int v9; v7 = a0->field_8->field_0; v1 = valid_array_reference(v7, 0x0); if (v1) { v5 = array_variable_part(v7, 0x0, &v4, &v0); } else { v5 = find_variable(v7); if (!v5) { v5 = find_variable_last_nameref(v7, 0x0); if (v5 && (v5->field_28 & 0x800)) { v7 = v5->field_8; v1 = valid_array_reference(v7, 0x0); if (v1) v5 = array_variable_part(v7, 0x0, &v4, &v0); else v5 = find_variable(v7); } } } if (v5 && !(v5->field_28 & 0x1000)) { if (v1 && ((v5->field_28 & 4) || (v5->field_28 & 64))) v6 = get_array_value(v7, 0x0, 0x0); if (!v1 || !(v5->field_28 & 4) && !(v5->field_28 & 64)) v6 = get_variable_value(v5); if (v6 && *(v6)) { v9 = legal_number(v6, &v3, &v3); if (v9 < 0) { v9 = -1; } else { v2 = *(&v3); v9 = v2; } } if (!v6 || !*(v6)) v9 = -1; } if (!v5 || (v5->field_28 & 0x1000)) v9 = -1; return v9; }
bash
angr_dream
char *acl_to_any_text(acl_t acl, const char *prefix, char separator, int options) { return __acl_to_any_text(acl, ((void *)0), prefix, separator, ((void *)0), options); }
long long acl_to_any_text(unsigned long long a0, unsigned long long a1, unsigned long a2, unsigned long a3) { char v0; char v1; return __acl_to_any_text(a0, 0x0, a1, a2, 0x0, a3, *(&v0), *(&v1), a1, a0); }
acl-2.3.1
angr_sailr
static __inline__ int list_empty(struct list_head *head) { return head->next == head; }
bool list_empty(long *param_1) { return param_1 == (long *)*param_1; }
e2fsprogs-1.46.5
ghidra
char *uinttostr(i, buf, len) uintmax_t i; char *buf; size_t len; { return (fmtumax(i, 10, buf, len, 0x08)); }
long long uinttostr(unsigned long long a0, unsigned long long a1, unsigned long long a2) { return fmtumax(a0, 0xa, a1, a2, 0x8); }
bash
angr_sailr
static int parse_acl_entry(const char **text_p, acl_t *acl_p) { acl_entry_obj entry_obj; acl_entry_t entry_d; char *str; const char *backup; int error, perm_chars; __new_obj_p_here((0x9D6B), &entry_obj); do { (entry_obj).i.e_entry.e_tag = (0x00); __new_obj_p_here((0x1ED5), &(entry_obj).i.e_entry.e_perm); (entry_obj).i.e_entry.e_perm.i.s_perm = (0x0000); __new_obj_p_here((0x1C27), &(entry_obj).i.e_entry.e_id); (entry_obj).i.e_entry.e_id.i.q_id = ((id_t)-1); } while (0); do { while (*(*text_p) == ' ' || *(*text_p) == '\t' || *(*text_p) == '\n' || *(*text_p) == '\r') (*text_p)++; if (*(*text_p) == '#') { while (*(*text_p) != '\n' && *(*text_p) != '\0') (*text_p)++; } } while (0); switch (**text_p) { case 'u': if (!skip_tag_name(text_p, "user")) goto fail; backup = *text_p; str = get_token(text_p); if (str) { entry_obj.i.e_entry.e_tag = (0x02); error = get_uid(__acl_unquote(str), &entry_obj.i.e_entry.e_id.i.q_id); free(str); if (error) { *text_p = backup; return -1; } } else { entry_obj.i.e_entry.e_tag = (0x01); } break; case 'g': if (!skip_tag_name(text_p, "group")) goto fail; backup = *text_p; str = get_token(text_p); if (str) { entry_obj.i.e_entry.e_tag = (0x08); error = get_gid(__acl_unquote(str), &entry_obj.i.e_entry.e_id.i.q_id); free(str); if (error) { *text_p = backup; return -1; } } else { entry_obj.i.e_entry.e_tag = (0x04); } break; case 'm': if (!skip_tag_name(text_p, "mask")) goto fail; do { while (*(*text_p) == ' ' || *(*text_p) == '\t' || *(*text_p) == '\n' || *(*text_p) == '\r') (*text_p)++; if (*(*text_p) == '#') { while (*(*text_p) != '\n' && *(*text_p) != '\0') (*text_p)++; } } while (0); if (**text_p == ':') (*text_p)++; entry_obj.i.e_entry.e_tag = (0x10); break; case 'o': if (!skip_tag_name(text_p, "other")) goto fail; do { while (*(*text_p) == ' ' || *(*text_p) == '\t' || *(*text_p) == '\n' || *(*text_p) == '\r') (*text_p)++; if (*(*text_p) == '#') { while (*(*text_p) != '\n' && *(*text_p) != '\0') (*text_p)++; } } while (0); if (**text_p == ':') (*text_p)++; entry_obj.i.e_entry.e_tag = (0x20); break; default: goto fail; } for (perm_chars = 0; perm_chars < 3; perm_chars++, (*text_p)++) { switch (**text_p) { case 'r': if (entry_obj.i.e_entry.e_perm.i.s_perm & (0x04)) goto fail; entry_obj.i.e_entry.e_perm.i.s_perm |= (0x04); break; case 'w': if (entry_obj.i.e_entry.e_perm.i.s_perm & (0x02)) goto fail; entry_obj.i.e_entry.e_perm.i.s_perm |= (0x02); break; case 'x': if (entry_obj.i.e_entry.e_perm.i.s_perm & (0x01)) goto fail; entry_obj.i.e_entry.e_perm.i.s_perm |= (0x01); break; case '-': break; default: if (perm_chars == 0) goto fail; goto create_entry; } } create_entry: if (acl_create_entry(acl_p, &entry_d) != 0) return -1; if (acl_copy_entry(entry_d, ((&entry_obj) ? &(&entry_obj)->i : ((void *)0))) != 0) return -1; return 0; fail: (*__errno_location()) = 22; return -1; }
long parse_acl_entry(const void **a1, long a2) { int v2; const char *v3; const char *v5; int v6; int i; int uid; int gid; long v10; const void *v11; void *ptr; char v13[8]; long v14; int v15; long v16; __gid_t v17; long v18; int v19; unsigned long v20; v20 = __readfsqword(0x28u); _new_obj_p_here(40299LL, v13); v15 = 0; _new_obj_p_here(7893LL, &v18); v19 = 0; _new_obj_p_here(7207LL, &v16); v17 = -1; while (*(_BYTE *)*a1 == 32 || *(_BYTE *)*a1 == 9 || *(_BYTE *)*a1 == 10 || *(_BYTE *)*a1 == 13) *a1 = (char *)*a1 + 1; if (*(_BYTE *)*a1 == 35) { while (*(_BYTE *)*a1 != 10 && *(_BYTE *)*a1) *a1 = (char *)*a1 + 1; } v2 = *(char *)*a1; if (v2 == 117) { if ((unsigned int)skip_tag_name((char **)a1, "user")) { v11 = *a1; ptr = get_token(a1); if (ptr) { v15 = 2; v3 = (const char *)_acl_unquote(ptr); uid = get_uid(v3, &v17); free(ptr); if (uid) { *a1 = v11; return 0xFFFFFFFFLL; } } else { v15 = 1; } goto LABEL_59; } goto LABEL_80; } if (v2 > 117) goto LABEL_80; if (v2 != 111) { if (v2 <= 111) { if (v2 == 103) { if ((unsigned int)skip_tag_name((char **)a1, "group")) { v11 = *a1; ptr = get_token(a1); if (ptr) { v15 = 8; v5 = (const char *)_acl_unquote(ptr); gid = get_gid(v5, &v17); free(ptr); if (gid) { *a1 = v11; return 0xFFFFFFFFLL; } } else { v15 = 4; } goto LABEL_59; } } else if (v2 == 109 && (unsigned int)skip_tag_name((char **)a1, "mask")) { while (*(_BYTE *)*a1 == 32 || *(_BYTE *)*a1 == 9 || *(_BYTE *)*a1 == 10 || *(_BYTE *)*a1 == 13) *a1 = (char *)*a1 + 1; if (*(_BYTE *)*a1 == 35) { while (*(_BYTE *)*a1 != 10 && *(_BYTE *)*a1) *a1 = (char *)*a1 + 1; } if (*(_BYTE *)*a1 == 58) *a1 = (char *)*a1 + 1; v15 = 16; goto LABEL_59; } } LABEL_80: *_errno_location() = 22; return 0xFFFFFFFFLL; } if (!(unsigned int)skip_tag_name((char **)a1, "other")) goto LABEL_80; while (*(_BYTE *)*a1 == 32 || *(_BYTE *)*a1 == 9 || *(_BYTE *)*a1 == 10 || *(_BYTE *)*a1 == 13) *a1 = (char *)*a1 + 1; if (*(_BYTE *)*a1 == 35) { while (*(_BYTE *)*a1 != 10 && *(_BYTE *)*a1) *a1 = (char *)*a1 + 1; } if (*(_BYTE *)*a1 == 58) *a1 = (char *)*a1 + 1; v15 = 32; LABEL_59: for (i = 0; i <= 2; ++i) { v6 = *(char *)*a1; if (v6 == 120) { if ((v19 & 1) != 0) goto LABEL_80; v19 |= 1u; } else { if (v6 > 120) goto LABEL_71; if (v6 == 119) { if ((v19 & 2) != 0) goto LABEL_80; v19 |= 2u; } else if (v6 != 45) { if (v6 != 114) { LABEL_71: if (!i) goto LABEL_80; break; } if ((v19 & 4) != 0) goto LABEL_80; v19 |= 4u; } } *a1 = (char *)*a1 + 1; } if ((unsigned int)acl_create_entry(a2, &v10)) return 0xFFFFFFFFLL; if ((unsigned int)acl_copy_entry(v10, &v14)) return 0xFFFFFFFFLL; return 0LL; }
acl-2.3.1
ida
static PATTERN_LIST *copy_case_clause(clause) PATTERN_LIST *clause; { PATTERN_LIST *new_clause; new_clause = (PATTERN_LIST *)sh_xmalloc((sizeof(PATTERN_LIST)), "copy_cmd.c", 94); new_clause->patterns = copy_word_list(clause->patterns); new_clause->action = copy_command(clause->action); new_clause->flags = clause->flags; return (new_clause); }
long copy_case_clause(long param_1) { long lVar1; undefined8 uVar2; lVar1 = sh_xmalloc(0x20, "copy_cmd.c", 0x5e); uVar2 = copy_word_list(*(undefined8 *)(param_1 + 8)); *(undefined8 *)(lVar1 + 8) = uVar2; uVar2 = copy_command(*(undefined8 *)(param_1 + 0x10)); *(undefined8 *)(lVar1 + 0x10) = uVar2; *(undefined4 *)(lVar1 + 0x18) = *(undefined4 *)(param_1 + 0x18); return lVar1; }
bash
ghidra
static char const *time_string(const STRUCT_UTMP *utmp_ent) { static char buf[(((((sizeof(intmax_t) * 8) - (!((__typeof__(intmax_t))0 < (__typeof__(intmax_t))-1))) * 146 + 484) / 485) + (!((__typeof__(intmax_t))0 < (__typeof__(intmax_t))-1))) + sizeof "-%m-%d %H:%M"]; time_t t = ((utmp_ent)->ut_tv.tv_sec); struct tm *tmp = localtime(&t); if (tmp) { strftime(buf, sizeof buf, time_format, tmp); return buf; } else return timetostr(t, buf); }
undefined1 *time_string(long param_1) { undefined1 *puVar1; long in_FS_OFFSET; long local_20; tm *local_18; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); local_20 = (long)*(int *)(param_1 + 0x154); local_18 = localtime(&local_20); if (local_18 == (tm *)0x0) { puVar1 = (undefined1 *)timetostr(local_20, buf_5945); } else { strftime(buf_5945, 0x21, time_format, local_18); puVar1 = buf_5945; } if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) { __stack_chk_fail(); } return puVar1; }
coreutils
ghidra
void poly1305_auth(unsigned char out[16], const unsigned char *m, size_t inlen, const unsigned char key[32]) { uint32_t t0, t1, t2, t3; uint32_t h0, h1, h2, h3, h4; uint32_t r0, r1, r2, r3, r4; uint32_t s1, s2, s3, s4; uint32_t b, nb; size_t j; uint64_t t[5]; uint64_t f0, f1, f2, f3; uint32_t g0, g1, g2, g3, g4; uint64_t c; unsigned char mp[16]; t0 = (((uint32_t)((key + 0)[0])) | ((uint32_t)((key + 0)[1]) << 8) | ((uint32_t)((key + 0)[2]) << 16) | ((uint32_t)((key + 0)[3]) << 24)); t1 = (((uint32_t)((key + 4)[0])) | ((uint32_t)((key + 4)[1]) << 8) | ((uint32_t)((key + 4)[2]) << 16) | ((uint32_t)((key + 4)[3]) << 24)); t2 = (((uint32_t)((key + 8)[0])) | ((uint32_t)((key + 8)[1]) << 8) | ((uint32_t)((key + 8)[2]) << 16) | ((uint32_t)((key + 8)[3]) << 24)); t3 = (((uint32_t)((key + 12)[0])) | ((uint32_t)((key + 12)[1]) << 8) | ((uint32_t)((key + 12)[2]) << 16) | ((uint32_t)((key + 12)[3]) << 24)); r0 = t0 & 0x3ffffff; t0 >>= 26; t0 |= t1 << 6; r1 = t0 & 0x3ffff03; t1 >>= 20; t1 |= t2 << 12; r2 = t1 & 0x3ffc0ff; t2 >>= 14; t2 |= t3 << 18; r3 = t2 & 0x3f03fff; t3 >>= 8; r4 = t3 & 0x00fffff; s1 = r1 * 5; s2 = r2 * 5; s3 = r3 * 5; s4 = r4 * 5; h0 = 0; h1 = 0; h2 = 0; h3 = 0; h4 = 0; if (inlen < 16) goto poly1305_donna_atmost15bytes; poly1305_donna_16bytes: m += 16; inlen -= 16; t0 = (((uint32_t)((m - 16)[0])) | ((uint32_t)((m - 16)[1]) << 8) | ((uint32_t)((m - 16)[2]) << 16) | ((uint32_t)((m - 16)[3]) << 24)); t1 = (((uint32_t)((m - 12)[0])) | ((uint32_t)((m - 12)[1]) << 8) | ((uint32_t)((m - 12)[2]) << 16) | ((uint32_t)((m - 12)[3]) << 24)); t2 = (((uint32_t)((m - 8)[0])) | ((uint32_t)((m - 8)[1]) << 8) | ((uint32_t)((m - 8)[2]) << 16) | ((uint32_t)((m - 8)[3]) << 24)); t3 = (((uint32_t)((m - 4)[0])) | ((uint32_t)((m - 4)[1]) << 8) | ((uint32_t)((m - 4)[2]) << 16) | ((uint32_t)((m - 4)[3]) << 24)); h0 += t0 & 0x3ffffff; h1 += ((((uint64_t)t1 << 32) | t0) >> 26) & 0x3ffffff; h2 += ((((uint64_t)t2 << 32) | t1) >> 20) & 0x3ffffff; h3 += ((((uint64_t)t3 << 32) | t2) >> 14) & 0x3ffffff; h4 += (t3 >> 8) | (1 << 24); poly1305_donna_mul: t[0] = ((uint64_t)(h0) * (r0)) + ((uint64_t)(h1) * (s4)) + ((uint64_t)(h2) * (s3)) + ((uint64_t)(h3) * (s2)) + ((uint64_t)(h4) * (s1)); t[1] = ((uint64_t)(h0) * (r1)) + ((uint64_t)(h1) * (r0)) + ((uint64_t)(h2) * (s4)) + ((uint64_t)(h3) * (s3)) + ((uint64_t)(h4) * (s2)); t[2] = ((uint64_t)(h0) * (r2)) + ((uint64_t)(h1) * (r1)) + ((uint64_t)(h2) * (r0)) + ((uint64_t)(h3) * (s4)) + ((uint64_t)(h4) * (s3)); t[3] = ((uint64_t)(h0) * (r3)) + ((uint64_t)(h1) * (r2)) + ((uint64_t)(h2) * (r1)) + ((uint64_t)(h3) * (r0)) + ((uint64_t)(h4) * (s4)); t[4] = ((uint64_t)(h0) * (r4)) + ((uint64_t)(h1) * (r3)) + ((uint64_t)(h2) * (r2)) + ((uint64_t)(h3) * (r1)) + ((uint64_t)(h4) * (r0)); h0 = (uint32_t)t[0] & 0x3ffffff; c = (t[0] >> 26); t[1] += c; h1 = (uint32_t)t[1] & 0x3ffffff; b = (uint32_t)(t[1] >> 26); t[2] += b; h2 = (uint32_t)t[2] & 0x3ffffff; b = (uint32_t)(t[2] >> 26); t[3] += b; h3 = (uint32_t)t[3] & 0x3ffffff; b = (uint32_t)(t[3] >> 26); t[4] += b; h4 = (uint32_t)t[4] & 0x3ffffff; b = (uint32_t)(t[4] >> 26); h0 += b * 5; if (inlen >= 16) goto poly1305_donna_16bytes; poly1305_donna_atmost15bytes: if (!inlen) goto poly1305_donna_finish; for (j = 0; j < inlen; j++) mp[j] = m[j]; mp[j++] = 1; for (; j < 16; j++) mp[j] = 0; inlen = 0; t0 = (((uint32_t)((mp + 0)[0])) | ((uint32_t)((mp + 0)[1]) << 8) | ((uint32_t)((mp + 0)[2]) << 16) | ((uint32_t)((mp + 0)[3]) << 24)); t1 = (((uint32_t)((mp + 4)[0])) | ((uint32_t)((mp + 4)[1]) << 8) | ((uint32_t)((mp + 4)[2]) << 16) | ((uint32_t)((mp + 4)[3]) << 24)); t2 = (((uint32_t)((mp + 8)[0])) | ((uint32_t)((mp + 8)[1]) << 8) | ((uint32_t)((mp + 8)[2]) << 16) | ((uint32_t)((mp + 8)[3]) << 24)); t3 = (((uint32_t)((mp + 12)[0])) | ((uint32_t)((mp + 12)[1]) << 8) | ((uint32_t)((mp + 12)[2]) << 16) | ((uint32_t)((mp + 12)[3]) << 24)); h0 += t0 & 0x3ffffff; h1 += ((((uint64_t)t1 << 32) | t0) >> 26) & 0x3ffffff; h2 += ((((uint64_t)t2 << 32) | t1) >> 20) & 0x3ffffff; h3 += ((((uint64_t)t3 << 32) | t2) >> 14) & 0x3ffffff; h4 += (t3 >> 8); goto poly1305_donna_mul; poly1305_donna_finish: b = h0 >> 26; h0 = h0 & 0x3ffffff; h1 += b; b = h1 >> 26; h1 = h1 & 0x3ffffff; h2 += b; b = h2 >> 26; h2 = h2 & 0x3ffffff; h3 += b; b = h3 >> 26; h3 = h3 & 0x3ffffff; h4 += b; b = h4 >> 26; h4 = h4 & 0x3ffffff; h0 += b * 5; b = h0 >> 26; h0 = h0 & 0x3ffffff; h1 += b; g0 = h0 + 5; b = g0 >> 26; g0 &= 0x3ffffff; g1 = h1 + b; b = g1 >> 26; g1 &= 0x3ffffff; g2 = h2 + b; b = g2 >> 26; g2 &= 0x3ffffff; g3 = h3 + b; b = g3 >> 26; g3 &= 0x3ffffff; g4 = h4 + b - (1 << 26); b = (g4 >> 31) - 1; nb = ~b; h0 = (h0 & nb) | (g0 & b); h1 = (h1 & nb) | (g1 & b); h2 = (h2 & nb) | (g2 & b); h3 = (h3 & nb) | (g3 & b); h4 = (h4 & nb) | (g4 & b); f0 = ((h0) | (h1 << 26)) + (uint64_t)(((uint32_t)((&key[16])[0])) | ((uint32_t)((&key[16])[1]) << 8) | ((uint32_t)((&key[16])[2]) << 16) | ((uint32_t)((&key[16])[3]) << 24)); f1 = ((h1 >> 6) | (h2 << 20)) + (uint64_t)(((uint32_t)((&key[20])[0])) | ((uint32_t)((&key[20])[1]) << 8) | ((uint32_t)((&key[20])[2]) << 16) | ((uint32_t)((&key[20])[3]) << 24)); f2 = ((h2 >> 12) | (h3 << 14)) + (uint64_t)(((uint32_t)((&key[24])[0])) | ((uint32_t)((&key[24])[1]) << 8) | ((uint32_t)((&key[24])[2]) << 16) | ((uint32_t)((&key[24])[3]) << 24)); f3 = ((h3 >> 18) | (h4 << 8)) + (uint64_t)(((uint32_t)((&key[28])[0])) | ((uint32_t)((&key[28])[1]) << 8) | ((uint32_t)((&key[28])[2]) << 16) | ((uint32_t)((&key[28])[3]) << 24)); do { (&out[0])[0] = (uint8_t)((f0)); (&out[0])[1] = (uint8_t)((f0) >> 8); (&out[0])[2] = (uint8_t)((f0) >> 16); (&out[0])[3] = (uint8_t)((f0) >> 24); } while (0); f1 += (f0 >> 32); do { (&out[4])[0] = (uint8_t)((f1)); (&out[4])[1] = (uint8_t)((f1) >> 8); (&out[4])[2] = (uint8_t)((f1) >> 16); (&out[4])[3] = (uint8_t)((f1) >> 24); } while (0); f2 += (f1 >> 32); do { (&out[8])[0] = (uint8_t)((f2)); (&out[8])[1] = (uint8_t)((f2) >> 8); (&out[8])[2] = (uint8_t)((f2) >> 16); (&out[8])[3] = (uint8_t)((f2) >> 24); } while (0); f3 += (f2 >> 32); do { (&out[12])[0] = (uint8_t)((f3)); (&out[12])[1] = (uint8_t)((f3) >> 8); (&out[12])[2] = (uint8_t)((f3) >> 16); (&out[12])[3] = (uint8_t)((f3) >> 24); } while (0); }
long long poly1305_auth(char a0[16], unsigned long long a1, unsigned long a2, char a3[32]) { unsigned long v0; void *v1; unsigned int v2; unsigned int v3; unsigned int v4; unsigned int v5; unsigned int v6; unsigned int v7; unsigned int v8; unsigned int v9; unsigned int v10; unsigned int v11; unsigned int v12; unsigned int v13; unsigned int v14; unsigned int v15; unsigned int v16; unsigned int v17; unsigned int v18; unsigned int v19; unsigned int v20; unsigned int v21; unsigned int v22; unsigned int v23; unsigned int v24; unsigned int v25; unsigned int v26; void *v27; unsigned long v28; unsigned long v29; unsigned long v30; unsigned long v31; unsigned long long v32; unsigned long v33; unsigned long v34; unsigned long v35; unsigned long v36; unsigned long v37; char v38; char v39; char v40; char v41; char v42; char v43; char v44; char v45; char v46; char v47; char v48; char v49; char v50; char v51; char v52; char v53; void *v55; v1 = a1; v0 = a2; v7 = (a3[3] * 0x1000000) | (a3[1] * 0x100) | a3[0] | (a3[2] * 0x10000); v8 = (a3[7] * 0x1000000) | (a3[5] * 0x100) | a3[4] | (a3[6] * 0x10000); v9 = (a3[11] * 0x1000000) | (a3[9] * 0x100) | a3[8] | (a3[10] * 0x10000); v10 = (a3[15] * 0x1000000) | (a3[13] * 0x100) | a3[12] | (a3[14] * 0x10000); v11 = v7 & 67108863; v7 >>= 26; v7 |= (v8 * 64); v12 = v7 & 67108611; v8 >>= 20; v8 |= (v9 * 0x1000); v13 = v8 & 67092735; v9 >>= 14; v9 |= (v10 * 0x40000); v14 = v9 & 66076671; v10 >>= 8; v15 = v10 & 1048575; v16 = (v12 * 4) + v12; v17 = (v13 * 4) + v13; v18 = (v14 * 4) + v14; v19 = (v15 * 4) + v15; v2 = 0; v3 = 0; v4 = 0; v5 = 0; v6 = 0; if (v0 > 15) { v1 += 16; v0 -= 16; v7 = (v1[13] * 0x1000000) | (v1[15] * 0x100) | v1[16] | (v1[14] * 0x10000); v8 = (v1[9] * 0x1000000) | (v1[11] * 0x100) | v1[12] | (v1[10] * 0x10000); v9 = (v1[5] * 0x1000000) | (v1[7] * 0x100) | v1[8] | (v1[6] * 0x10000); v10 = (v1[1] * 0x1000000) | (v1[3] * 0x100) | v1[4] | (v1[2] * 0x10000); v2 += v7 & 67108863; v3 += ((v7 | v8 * 0x100000000) >> 26) & 67108863; v4 += ((v8 | v9 * 0x100000000) >> 20) & 67108863; v5 += ((v9 | v10 * 0x100000000) >> 14) & 67108863; v6 += (v10 >> 8) | 0x1000000; goto LABEL_4004d0; } while (v0) { for (v27 = 0; v27 < v0; v27 += 1) { *((v27 + &v38)) = *((v27 + v1)); } v55 = v27; v27 += 1; for (*((&v38 + v55)) = 1; v27 <= 15; v27 += 1) { *((v27 + &v38)) = 0; } v0 = 0; v7 = (v41 * 0x1000000) | (v39 * 0x100) | v38 | (v40 * 0x10000); v8 = (v45 * 0x1000000) | (v43 * 0x100) | v42 | (v44 * 0x10000); v9 = (v49 * 0x1000000) | (v47 * 0x100) | v46 | (v48 * 0x10000); v10 = (v53 * 0x1000000) | (v51 * 0x100) | v50 | (v52 * 0x10000); v2 += v7 & 67108863; v3 += ((v7 | v8 * 0x100000000) >> 26) & 67108863; v4 += ((v8 | v9 * 0x100000000) >> 20) & 67108863; v5 += ((v9 | v10 * 0x100000000) >> 14) & 67108863; v6 += (v10 >> 8); while (true) { LABEL_4004d0: v33 = v6 * v16 + v11 * v2 + v3 * v19 + v4 * v18 + v17 * v5; v34 = v6 * v17 + v12 * v2 + v3 * v11 + v4 * v19 + v18 * v5; v35 = v6 * v18 + v13 * v2 + v3 * v12 + v4 * v11 + v19 * v5; v36 = v6 * v19 + v14 * v2 + v3 * v13 + v4 * v12 + v11 * v5; v37 = v6 * v11 + v15 * v2 + v3 * v14 + v4 * v13 + v12 * v5; v2 = v33 & 67108863; v32 = v33 >> 26; v34 = v32 + v34; v3 = v34 & 67108863; v20 = v34 >> 26; v35 = v20 + v35; v4 = v35 & 67108863; v20 = v35 >> 26; v36 = v20 + v36; v5 = v36 & 67108863; v20 = v36 >> 26; v37 = v20 + v37; v6 = v37 & 67108863; v20 = v37 >> 26; v2 += (v20 * 4) + v20; if (v0 <= 15) break; v1 += 16; v0 -= 16; v7 = (v1[13] * 0x1000000) | (v1[15] * 0x100) | v1[16] | (v1[14] * 0x10000); v8 = (v1[9] * 0x1000000) | (v1[11] * 0x100) | v1[12] | (v1[10] * 0x10000); v9 = (v1[5] * 0x1000000) | (v1[7] * 0x100) | v1[8] | (v1[6] * 0x10000); v10 = (v1[1] * 0x1000000) | (v1[3] * 0x100) | v1[4] | (v1[2] * 0x10000); v2 += v7 & 67108863; v3 += ((v7 | v8 * 0x100000000) >> 26) & 67108863; v4 += ((v8 | v9 * 0x100000000) >> 20) & 67108863; v5 += ((v9 | v10 * 0x100000000) >> 14) & 67108863; v6 += (v10 >> 8) | 0x1000000; } } v20 = v2 >> 26; v2 &= 67108863; v3 += v20; v20 = v3 >> 26; v3 &= 67108863; v4 += v20; v20 = v4 >> 26; v4 &= 67108863; v5 += v20; v20 = v5 >> 26; v5 &= 67108863; v6 += v20; v20 = v6 >> 26; v6 &= 67108863; v2 += (v20 * 4) + v20; v20 = v2 >> 26; v2 &= 67108863; v3 += v20; v21 = v2 + 5; v20 = v21 >> 26; v21 &= 67108863; v22 = v20 + v3; v20 = v22 >> 26; v22 &= 67108863; v23 = v20 + v4; v20 = v23 >> 26; v23 &= 67108863; v24 = v20 + v5; v20 = v24 >> 26; v24 &= 67108863; v25 = v20 + v6 - 0x4000000; v20 = (v25 >> 31) - 1; v26 = !(v20); v2 = v21 & v20 | v2 & v26; v3 = v22 & v20 | v3 & v26; v4 = v23 & v20 | v4 & v26; v5 = v24 & v20 | v5 & v26; v6 = v25 & v20 | v6 & v26; v28 = ((a3[19] * 0x1000000) | (a3[17] * 0x100) | a3[16] | (a3[18] * 0x10000)) + ((v3 * 0x4000000) | v2); v29 = ((a3[23] * 0x1000000) | (a3[21] * 0x100) | a3[20] | (a3[22] * 0x10000)) + ((v4 * 0x100000) | (v3 >> 6)); v30 = ((a3[27] * 0x1000000) | (a3[25] * 0x100) | a3[24] | (a3[26] * 0x10000)) + ((v5 * 0x4000) | (v4 >> 12)); v31 = ((a3[31] * 0x1000000) | (a3[29] * 0x100) | a3[28] | (a3[30] * 0x10000)) + ((v6 * 0x100) | (v5 >> 18)); a0[0] = v28; a0[1] = v28 >> 8; a0[2] = v28 >> 16; a0[3] = v28 >> 24; v29 += v28 >> 32; a0[4] = v29; a0[5] = v29 >> 8; a0[6] = v29 >> 16; a0[7] = v29 >> 24; v30 += v29 >> 32; a0[8] = v30; a0[9] = v30 >> 8; a0[10] = v30 >> 16; a0[11] = v30 >> 24; v31 += v30 >> 32; a0[12] = v31; a0[13] = v31 >> 8; a0[14] = v31 >> 16; a0[15] = v31 >> 24; return 0; }
openssh-portable
angr_sailr
, "%s%s%s:%ld: Removed %s key for host %s", ctx->quiet ? __func__ : "", ctx->quiet ? ": " : "", l->path, l->linenum, sshkey_type(l->key), ctx->host) ; ctx->modified = 1; return 0; } if (l->status == 1) { sshlog("hostfile.c", __func__, 577, 0, loglevel, ((void *)0), "%s%s%s:%ld: invalid known_hosts entry", ctx->quiet ? __func__ : "", ctx->quiet ? ": " : "", l->path, l->linenum) ; }
void sshkey_type(void) { halt_baddata(); }
openssh-portable
ghidra
static inline void emit_ancillary_info(char const *program) { struct infomap { char const *program; char const *node; } const infomap[] = { {"[", "test invocation"}, {"coreutils", "Multi-call invocation"}, {"sha224sum", "sha2 utilities"}, {"sha256sum", "sha2 utilities"}, {"sha384sum", "sha2 utilities"}, {"sha512sum", "sha2 utilities"}, {((void *)0), ((void *)0)}}; char const *node = program; struct infomap const *map_prog = infomap; while (map_prog->program && !(strcmp(program, map_prog->program) == 0)) map_prog++; if (map_prog->node) node = map_prog->node; printf (gettext ("\n%s online help: <%s>\n"), "GNU coreutils", "https: char const *lc_messages = setlocale ( 5 , ((void *)0) ); if (lc_messages && strncmp (lc_messages, "" "en_" "", sizeof ("en_") - 1)) { fputs_unlocked (gettext ("Report any translation bugs to " "<https: stdout ) ; } char const *url_program = (strcmp (program, "[") == 0) ? "test" : program; printf (gettext ("Full documentation <%s%s>\n"), "https: printf (gettext ("or available locally via: info '(coreutils) %s%s'\n"), node, node == program ? " invocation" : ""); }
void emit_ancillary_info(char *a0) { unsigned long v0; unsigned long long v1[2]; char *v2; unsigned long v3; unsigned long long v4; unsigned long long v5; unsigned long long v6; unsigned long long v7; unsigned long long v8; unsigned long long v9; unsigned long long v10; unsigned long long v11; unsigned long long v12; unsigned long long v13; unsigned long long v14; unsigned long long v15; void *v16; void *v17; char v18; unsigned long long *v21; unsigned long long v22; v4 = "["; v5 = "test invocation"; v6 = "coreutils"; v7 = "Multi-call invocation"; v8 = "sha224sum"; v9 = "sha2 utilities"; v10 = "sha256sum"; v11 = "sha2 utilities"; v12 = "sha384sum"; v13 = "sha2 utilities"; v14 = "sha512sum"; v15 = "sha2 utilities"; v16 = 0; v17 = 0; v0 = a0; for (v1[0] = &v4; v1[0] && strcmp(a0, v1[0]); v1[0] = v1 + 1) ; if (v1[1]) v0 = v1[1]; printf(gettext("\n%s online help: <%s>\n")); v2 = setlocale(0x5, NULL); if (v2 && strncmp(v2, "en_", 0x3)) fputs_unlocked(gettext("Report any translation bugs to <https: *(&v3) = (!strcmp(a0, "[") ? a0 : "test"); printf(gettext("Full documentation <%s%s>\n")); printf(gettext("or available locally via: info '(coreutils) %s%s'\n")); v22 = *(&v18) ^ v21[5]; return; }
coreutils
angr_sailr
void udp_server(const char *name, int port, int mtu) { int sock, ret; struct sockaddr_storage cli_addr; socklen_t cli_addr_size; char buffer[255]; priv_data_st priv; gnutls_session_t session; gnutls_datum_t cookie_key; gnutls_dtls_prestate_st prestate; unsigned char sequence[8]; ret = gnutls_key_generate(&cookie_key, 16); if (ret < 0) { fprintf(stderr, "Cannot generate key\n"); exit(1); } ret = listen_socket(name, port, SOCK_DGRAM); if (ret < 0) { fprintf(stderr, "Cannot listen\n"); exit(1); } for (;;) { printf("Waiting for connection...\n"); sock = wait_for_connection(); if (sock < 0) continue; cli_addr_size = sizeof(cli_addr); ret = recvfrom(sock, buffer, sizeof(buffer) - 1, MSG_PEEK, (struct sockaddr *)&cli_addr, &cli_addr_size); if (ret > 13 && buffer[0] == 22 && buffer[13] == GNUTLS_HANDSHAKE_CLIENT_HELLO) { if (!gnutls_serv_options.present.nocookie) { memset(&prestate, 0, sizeof(prestate)); ret = gnutls_dtls_cookie_verify(&cookie_key, &cli_addr, cli_addr_size, buffer, ret, &prestate); if (ret < 0) { priv_data_st s; memset(&s, 0, sizeof(s)); s.fd = sock; s.cli_addr = (void *)&cli_addr; s.cli_addr_size = cli_addr_size; printf("Sending hello verify request to %s\n", human_addr((struct sockaddr *)&cli_addr, cli_addr_size, buffer, sizeof(buffer) - 1)); gnutls_dtls_cookie_send(&cookie_key, &cli_addr, cli_addr_size, &prestate, (gnutls_transport_ptr_t)&s, push_func); recvfrom(sock, buffer, sizeof(buffer) - 1, 0, (struct sockaddr *)&cli_addr, &cli_addr_size); continue; } } printf("Accepted connection from %s\n", human_addr((struct sockaddr *)&cli_addr, sizeof(cli_addr), buffer, sizeof(buffer) - 1)); } else continue; session = initialize_session(1); if (!gnutls_serv_options.present.nocookie) gnutls_dtls_prestate_set(session, &prestate); if (mtu) gnutls_dtls_set_mtu(session, mtu); priv.session = session; priv.fd = sock; priv.cli_addr = &cli_addr; priv.cli_addr_size = cli_addr_size; gnutls_transport_set_ptr(session, &priv); gnutls_transport_set_push_function(session, push_func); gnutls_transport_set_pull_function(session, pull_func); gnutls_transport_set_pull_timeout_function(session, pull_timeout_func); do { ret = gnutls_handshake(session); } while (ret == -28 || ret == -52); if (ret < 0) { fprintf(stderr, "Error in handshake(): %s\n", gnutls_strerror(ret)); gnutls_deinit(session); continue; } for (;;) { do { ret = gnutls_record_recv_seq(session, buffer, sizeof(buffer) - 1, sequence); if (ret == -293) gnutls_heartbeat_pong(session, 0); } while (ret == -52 || ret == -28 || ret == -293); if (ret == -37) { fprintf(stderr, "*** Received hello message\n"); do { ret = gnutls_handshake(session); } while (ret == -52 || ret == -28); if (ret == 0) continue; } if (ret < 0) { fprintf(stderr, "Error in recv(): %s\n", gnutls_strerror(ret)); break; } if (ret == 0) { printf("EOF\n\n"); break; } buffer[ret] = 0; printf("received[%.2x%.2x%.2x%.2x%.2x%.2x%.2x%.2x]: %s\n", sequence[0], sequence[1], sequence[2], sequence[3], sequence[4], sequence[5], sequence[6], sequence[7], buffer); if (check_command(session, buffer, disable_client_cert) == 0) { ret = gnutls_record_send(session, buffer, ret); if (ret < 0) { fprintf(stderr, "Error in send(): %s\n", gnutls_strerror(ret)); break; } } } gnutls_deinit(session); } }
long long udp_server(unsigned long long a0, unsigned long a1, unsigned long long a2) { unsigned long long v0; unsigned int v1; unsigned int v2; unsigned int v3; unsigned long long v4; char v5; char v6; unsigned long v7; unsigned int v8; unsigned long v9; unsigned int v10; char v11; unsigned int v12; unsigned long v13; unsigned int v14; char v15; char v16; char v17; char v18; char v19; char v20; char v21; char v22; char v23; char v24; char v25; unsigned long v26; unsigned long long *v28; unsigned int v29; unsigned long long v30; unsigned long long v31; unsigned long v32; unsigned int v33; *(&v0) = a2; v26 = v28[5]; v2 = gnutls_key_generate(&v6, 0x10); if (v2 < 0) { fprintf(*(&stderr), "Cannot generate key\n"); exit(0x1); } v2 = listen_socket(a0, a1, 0x2, a1); if (v2 < 0) { fprintf(*(&stderr), "Cannot listen\n"); exit(0x1); } while (true) { do { printf("Waiting for connection...\n"); v30 = wait_for_connection("Waiting for connection...\n", v1, v0, v29, v32, v33); v3 = v30; } while (v3 < 0); v1 = 128; v29 = 2; v2 = recvfrom(v3, &v24, 0xfe, 0x2, &v15, &v1); if (v2 > 13 && v24 == 22 && v25 == 1) { if ((memset ^ 1)) { memset(&v5, 0x0, 0xc); v2 = gnutls_dtls_cookie_verify(&v6, &v15, v1, &v24, v2, &v5); if (v2 < 0) { memset(&v11, 0x0, 0x20); v12 = v3; v13 = &v15; v14 = v1; printf("Sending hello verify request to %s\n", human_addr(&v15, v1, &v24, 0xfe)); v31 = v1; gnutls_dtls_cookie_send(&v6, &v15, v1, &v5, &v11, push_func); v29 = 0; recvfrom(v3, &v24, 0xfe, 0x0, &v15, &v1); continue; } } printf("Accepted connection from %s\n", human_addr(&v15, 0x80, &v24, 0xfe)); v4 = initialize_session(0x1); if ((memset ^ 1)) gnutls_dtls_prestate_set(v4, &v5, &v5); if (v0) gnutls_dtls_set_mtu(v4, v0, v0); v7 = v4; v8 = v3; v9 = &v15; v10 = v1; gnutls_transport_set_ptr(v4, &v7, &v7); gnutls_transport_set_push_function(v4, push_func); gnutls_transport_set_pull_function(v4, pull_func); gnutls_transport_set_pull_timeout_function(v4, pull_timeout_func); while (true) { v2 = gnutls_handshake(v4); if (v2 == -28) continue; if (v2 != -52) break; } if (v2 < 0) { fprintf(*(&stderr), "Error in handshake(): %s\n", gnutls_strerror(v2)); gnutls_deinit(v4); } else { do { do { do { do { v2 = gnutls_record_recv_seq(v4, &v24, 0xfe, &v16); if (v2 == -293) gnutls_heartbeat_pong(v4, 0x0); } while (v2 == -52); } while (v2 == -28); } while (v2 == -293); if (v2 == -37) { fprintf(*(&stderr), "*** Received hello message\n"); while (true) { v2 = gnutls_handshake(v4); if (v2 == -52) continue; if (v2 != -28) break; } if (!v2) continue; } if (v2 < 0) { fprintf(*(&stderr), "Error in recv(): %s\n", gnutls_strerror(v2)); goto LABEL_40068d; } if (!v2) { printf("EOF\n\n"); goto LABEL_40068d; } (&v24)[v2] = 0; v33 = v20; v32 = v19; printf("received[%.2x%.2x%.2x%.2x%.2x%.2x%.2x%.2x]: %s\n", v16, v17, v18, v19, v20, v21, v22, v23, &v24); if (!(!check_command(v4, &v24, disable_client_cert, &v24))) continue; v2 = gnutls_record_send(v4, &v24, v2, &v24); } while (v2 >= 0); fprintf(*(&stderr), "Error in send(): %s\n", gnutls_strerror(v2)); LABEL_40068d: gnutls_deinit(v4); continue; } } } }
gnutls
angr_phoenix
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); }
void convert_time(code *param_1, undefined8 param_2, undefined8 param_3) { long in_FS_OFFSET; undefined8 local_18; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); local_18 = param_2; (*param_1)(&local_18, param_3); if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) { __stack_chk_fail(); } return; }
gnutls
ghidra
int sys_auth_passwd(struct ssh *ssh, const char *password) { Authctxt *authctxt = ssh->authctxt; struct passwd *pw = authctxt->pw; char *encrypted_password, *salt = ((void *)0); char *pw_password = authctxt->valid ? shadow_pw(pw) : pw->pw_passwd; if (pw_password == ((void *)0)) return 0; if (strcmp(pw_password, "") == 0 && strcmp(password, "") == 0) return (1); if (authctxt->valid && pw_password[0] && pw_password[1]) salt = pw_password; encrypted_password = xcrypt(password, salt); return encrypted_password != ((void *)0) && strcmp(encrypted_password, pw_password) == 0; }
undefined8 sys_auth_passwd(long param_1, char *param_2) { long lVar1; int iVar2; char *__s1; char *__s1_00; char *local_30; lVar1 = *(long *)(param_1 + 0x860); local_30 = (char *)0x0; if (*(int *)(lVar1 + 0xc) == 0) { __s1 = *(char **)(*(long *)(lVar1 + 0x30) + 8); } else { __s1 = (char *)shadow_pw(*(long *)(lVar1 + 0x30)); } if (__s1 != (char *)0x0) { iVar2 = strcmp(__s1, ""); if ((iVar2 == 0) && (iVar2 = strcmp(param_2, ""), iVar2 == 0)) { return 1; } if (((*(int *)(lVar1 + 0xc) != 0) && (*__s1 != '\0')) && (__s1[1] != '\0')) { local_30 = __s1; } __s1_00 = (char *)xcrypt(param_2, local_30); if ((__s1_00 != (char *)0x0) && (iVar2 = strcmp(__s1_00, __s1), iVar2 == 0)) { return 1; } } return 0; }
openssh-portable
ghidra
static _Bool raw_comparator(const void *a, const void *b) { return a == b; }
ulong raw_comparator(ulong param_1, ulong param_2) { return param_1 & 0xffffffffffffff00 | (ulong)(param_1 == param_2); }
gnutls
ghidra
static inline __u16 rta_getattr_u16(const struct rtattr *rta) { return *(__u16 *)(( void *)(((char *)(rta)) + ((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0)))); }
long rta_getattr_u16(long a1) { return *(unsigned short *)(a1 + 4); }
iproute2-6.0.0
ida
static _Bool entry_comparator(const void *av, const void *bv) { const struct SharefileEntry *a = av, *b = bv; return (a->inode == b->inode) && (a->device == b->device); }
undefined4 entry_comparator(long *param_1, long *param_2) { undefined4 uVar1; if ((param_1[1] == param_2[1]) && (*param_1 == *param_2)) { uVar1 = 1; } else { uVar1 = 0; } return uVar1; }
findutils
ghidra
static rsRetVal initTCP(wrkrInstanceData_t *pWrkrData) { instanceData *pData; rsRetVal iRet = RS_RET_OK; pData = pWrkrData->pData; if (pData->protocol == 1) { if ((iRet = tcpclt.Construct(&pWrkrData->pTCPClt)) != RS_RET_OK) goto finalize_it; if ((iRet = tcpclt.SetResendLastOnRecon( pWrkrData->pTCPClt, pData->bResendLastOnRecon)) != RS_RET_OK) goto finalize_it; if ((iRet = tcpclt.SetSendInit(pWrkrData->pTCPClt, TCPSendInit)) != RS_RET_OK) goto finalize_it; if ((iRet = tcpclt.SetSendFrame(pWrkrData->pTCPClt, TCPSendFrame)) != RS_RET_OK) goto finalize_it; if ((iRet = tcpclt.SetSendPrepRetry(pWrkrData->pTCPClt, TCPSendPrepRetry)) != RS_RET_OK) goto finalize_it; if ((iRet = tcpclt.SetFraming(pWrkrData->pTCPClt, pData->tcp_framing)) != RS_RET_OK) goto finalize_it; if ((iRet = tcpclt.SetFramingDelimiter( pWrkrData->pTCPClt, pData->tcp_framingDelimiter)) != RS_RET_OK) goto finalize_it; if ((iRet = tcpclt.SetRebindInterval(pWrkrData->pTCPClt, pData->iRebindInterval)) != RS_RET_OK) goto finalize_it; } finalize_it: return iRet; }
int initTCP(long *param_1) { long lVar1; int local_14; local_14 = 0; lVar1 = *param_1; if (((((*(int *)(lVar1 + 0x78) == 1) && (local_14 = (*tcpclt._8_8_)(param_1 + 6), local_14 == 0)) && (local_14 = (*tcpclt._48_8_)(param_1[6], *(undefined4 *)(lVar1 + 200)), local_14 == 0)) && ((local_14 = (*tcpclt._56_8_)(param_1[6], TCPSendInit), local_14 == 0 && (local_14 = (*tcpclt._64_8_)(param_1[6], TCPSendFrame), local_14 == 0)))) && ((local_14 = (*tcpclt._72_8_)(param_1[6], TCPSendPrepRetry), local_14 == 0 && ((local_14 = (*tcpclt._80_8_)(param_1[6], *(undefined4 *)(lVar1 + 0xc0)), local_14 == 0 && (local_14 = (*tcpclt._96_8_)( param_1[6], *(undefined *)(lVar1 + 0xc4)), local_14 == 0)))))) { local_14 = (*tcpclt._88_8_)(param_1[6], *(undefined4 *)(lVar1 + 0x8c)); } return local_14; }
rsyslog-8.2210.0
ghidra
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
void gzip_error(char const *m) { fprintf(stderr, "\n%s: %s: %s\n", program_name, ifname, m); abort_gzip(); }
long gzip_error(const char *a1) { fprintf(stderr, "\n%s: %s: %s\n", program_name, &ifname, a1); abort_gzip(); return xalloc_die(); }
gzip-1.12
ida
static int do_df(struct sftp_conn *conn, const char *path, int hflag, int iflag) { struct sftp_statvfs st; char s_used[7], s_avail[7]; char s_root[7], s_total[7]; char s_icapacity[16], s_dcapacity[16]; if (do_statvfs(conn, path, &st, 1) == -1) return -1; if (st.f_files == 0) strlcpy(s_icapacity, "ERR", sizeof(s_icapacity)); else { snprintf( s_icapacity, sizeof(s_icapacity), "%3llu%%", (unsigned long long)(100 * (st.f_files - st.f_ffree) / st.f_files)); } if (st.f_blocks == 0) strlcpy(s_dcapacity, "ERR", sizeof(s_dcapacity)); else { snprintf( s_dcapacity, sizeof(s_dcapacity), "%3llu%%", (unsigned long long)(100 * (st.f_blocks - st.f_bfree) / st.f_blocks)); } if (iflag) { printf(" Inodes Used Avail " "(root) %%Capacity\n"); printf("%11llu %11llu %11llu %11llu %s\n", (unsigned long long)st.f_files, (unsigned long long)(st.f_files - st.f_ffree), (unsigned long long)st.f_favail, (unsigned long long)st.f_ffree, s_icapacity); } else if (hflag) { strlcpy(s_used, "error", sizeof(s_used)); strlcpy(s_avail, "error", sizeof(s_avail)); strlcpy(s_root, "error", sizeof(s_root)); strlcpy(s_total, "error", sizeof(s_total)); fmt_scaled((st.f_blocks - st.f_bfree) * st.f_frsize, s_used); fmt_scaled(st.f_bavail * st.f_frsize, s_avail); fmt_scaled(st.f_bfree * st.f_frsize, s_root); fmt_scaled(st.f_blocks * st.f_frsize, s_total); printf(" Size Used Avail (root) %%Capacity\n"); printf("%7sB %7sB %7sB %7sB %s\n", s_total, s_used, s_avail, s_root, s_dcapacity); } else { printf(" Size Used Avail " "(root) %%Capacity\n"); printf( "%12llu %12llu %12llu %12llu %s\n", (unsigned long long)(st.f_frsize * st.f_blocks / 1024), (unsigned long long)(st.f_frsize * (st.f_blocks - st.f_bfree) / 1024), (unsigned long long)(st.f_frsize * st.f_bavail / 1024), (unsigned long long)(st.f_frsize * st.f_bfree / 1024), s_dcapacity); } return 0; }
int do_df(unsigned long long a0, unsigned long long a1, unsigned long a2, unsigned long a3) { char v0; char v1; char v2; char v3; char v4; char v5; char v6; char v7; char v8; char v9; char v10; char v11; char v12; char v13; unsigned int v15; if (do_statvfs(a0, a1, &v0, 0x1) == -1) { v15 = -1; } else { if (*(&v5)) snprintf(&v12, 0x10, "%3llu%%", ((0 CONCAT(*(&v5) - *(&v6)) * 100) / m * (&v5))); else strlcpy(&v12, "ERR", 0x10); if (*(&v2)) snprintf(&v13, 0x10, "%3llu%%", ((0 CONCAT(*(&v2) - *(&v3)) * 100) / m * (&v2))); else strlcpy(&v13, "ERR", 0x10); if (a3) { printf(" Inodes Used Avail (root) %%Capacity\n"); printf("%11llu %11llu %11llu %11llu %s\n", *(&v5), (*(&v5) - *(&v6)), *(&v7), *(&v6), &v12); } else if (!a2) { printf(" Size Used Avail (root) " "%%Capacity\n"); printf("%12llu %12llu %12llu %12llu %s\n", (*(&v1) * *(&v2) >> 10), ((*(&v2) - *(&v3)) * *(&v1) >> 10), (*(&v1) * *(&v4) >> 10), (*(&v1) * *(&v3) >> 10), &v13); } else { strlcpy(&v8, "error", 0x7); strlcpy(&v9, "error", 0x7); strlcpy(&v10, "error", 0x7); strlcpy(&v11, "error", 0x7); fmt_scaled((*(&v2) - *(&v3)) * *(&v1), &v8, (*(&v2) - *(&v3)) * *(&v1)); fmt_scaled(*(&v4) * *(&v1), &v9, *(&v4) * *(&v1)); fmt_scaled(*(&v3) * *(&v1), &v10, *(&v3) * *(&v1)); fmt_scaled(*(&v2) * *(&v1), &v11, *(&v2) * *(&v1)); printf(" Size Used Avail (root) %%Capacity\n"); printf("%7sB %7sB %7sB %7sB %s\n", &v11, &v8, &v9, &v10, &v13); } v15 = 0; } return v15; }
openssh-portable
angr_phoenix
strcmp(service, authctxt->service) != 0) { ssh_packet_disconnect(ssh, "Change of username or service " "not allowed: (%s,%s) -> (%s,%s)", authctxt->user, authctxt->service, user, service); }
int strcmp(char *__s1, char *__s2) { halt_baddata(); }
openssh-portable
ghidra
void ea_refcount_intr_begin(ext2_refcount_t refcount) { refcount->cursor = 0; }
long ea_refcount_intr_begin(long a1) { long result; result = a1; *(_QWORD *)(a1 + 16) = 0LL; return result; }
e2fsprogs-1.46.5
ida
(r = sshbuf_get_string_direct(b, ((void *)0) , &elen)) != 0) { sshlog("ssh-agent.c", __func__, 967, 1, SYSLOG_LEVEL_ERROR, ssh_err(r), "parse"); goto out; }
void sshbuf_get_string_direct(void) { halt_baddata(); }
openssh-portable
ghidra
int sshbuf_poke_u16(struct sshbuf *buf, size_t offset, u_int16_t val) { u_char *p = ((void *)0); int r; if ((r = check_woffset(buf, offset, 2, &p)) != 0) return r; do { const u_int16_t __v = (val); ((u_char *)(p))[0] = (__v >> 8) & 0xff; ((u_char *)(p))[1] = __v & 0xff; } while (0); return 0; }
int sshbuf_poke_u16(undefined8 param_1, undefined8 param_2, undefined2 param_3) { int iVar1; long in_FS_OFFSET; undefined *local_18; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); local_18 = (undefined *)0x0; iVar1 = check_woffset(param_1, param_2, 2, &local_18); if (iVar1 == 0) { *local_18 = (char)((ushort)param_3 >> 8); local_18[1] = (char)param_3; iVar1 = 0; } if (local_10 == *(long *)(in_FS_OFFSET + 0x28)) { return iVar1; } __stack_chk_fail(); }
openssh-portable
ghidra
static void pr_sgr_end_if(char const *s) { if (color_option) pr_sgr_end(s); }
void pr_sgr_end_if(char *a0) { unsigned long long v1; unsigned long long v2; v1 = color_option; if (color_option) v2 = pr_sgr_end(a0); return; }
grep
angr_phoenix
void malloc_set_tracefn(s, fn) char *s; char *fn; { }
long long malloc_set_tracefn(unsigned long a0, unsigned long a1) { unsigned long v0; unsigned long v1; unsigned long v3; v1 = a0; v0 = a1; return v3; }
bash
angr_phoenix
static _Bool term(void) { _Bool value; _Bool negated = 0; while (pos < argc && argv[pos][0] == '!' && argv[pos][1] == '\0') { advance(1); negated = !negated; } if (pos >= argc) beyond(); if (argv[pos][0] == '(' && argv[pos][1] == '\0') { int nargs; advance(1); for (nargs = 1; pos + nargs < argc && !(strcmp(argv[pos + nargs], ")") == 0); nargs++) if (nargs == 4) { nargs = argc - pos; break; } value = posixtest(nargs); if (argv[pos] == 0) test_syntax_error(gettext("%s expected"), quote(")")); else if (argv[pos][0] != ')' || argv[pos][1]) test_syntax_error(gettext("%s expected, found %s"), quote_n(0, ")"), quote_n(1, argv[pos])); advance(0); } else if (4 <= argc - pos && (strcmp(argv[pos], "-l") == 0) && binop(argv[pos + 2])) value = binary_operator(1); else if (3 <= argc - pos && binop(argv[pos + 1])) value = binary_operator(0); else if (argv[pos][0] == '-' && argv[pos][1] && argv[pos][2] == '\0') value = unary_operator(); else { value = (argv[pos][0] != '\0'); advance(0); } return negated ^ value; }
int term() { char v0; char v1; unsigned int v2; unsigned long long v4; for (v1 = 0; pos < argc && *(*((argv + (pos << 3)))) == 33 && !*((*((argv + (pos << 3))) + 1)); v1 &= 1) { advance(0x1); v1 = !(v1); } if (pos >= argc) beyond(); if (*(*((argv + (pos << 3)))) == 40 && !*((*((argv + (pos << 3))) + 1))) { advance(0x1); v2 = 1; while (true) { if (!(pos + v2 < argc) || !(strcmp(*((argv + (v2 + pos << 3))), ")"))) break; if (v2 != 4) { v2 += 1; } else { v2 = argc - pos; break; } } v0 = posixtest(v2); if (!*((argv + (pos << 3)))) test_syntax_error(gettext("%s expected"), quote(")")); if (*(*((argv + (pos << 3)))) == 41 && !*((*((argv + (pos << 3))) + 1))) { advance(0x0); return (v1 ^ v0); } quote_n(0x1, *((argv + pos * 8)), pos * 8); test_syntax_error(gettext("%s expected, found %s"), quote_n(0x0, ")", v4)); } if (argc - pos > 3 && !strcmp(*((argv + (pos << 3))), "-l") && binop(*((argv + (pos + 2 << 3))))) { v0 = binary_operator(0x1); return (v1 ^ v0); } if (argc - pos > 2 && binop(*((argv + (pos + 1 << 3))))) { v0 = binary_operator(0x0); return (v1 ^ v0); } if (*(*((argv + (pos << 3)))) == 45 && *((*((argv + (pos << 3))) + 1)) && !*((*((argv + (pos << 3))) + 2))) { v0 = unary_operator(); return (v1 ^ v0); } v0 = *(*((argv + (pos << 3)))); advance(0x0); return (v1 ^ v0); }
coreutils
angr_sailr
static int history_def_first(void *p, HistEventW *ev) { history_t *h = (history_t *)p; h->cursor = h->list.next; if (h->cursor != &h->list) *ev = h->cursor->ev; else { { ev->num = 3; ev->str = he_errlist[3]; }; return -1; } return 0; }
long history_def_first(long a1, long a2) { _QWORD *v2; long v3; *(_QWORD *)(a1 + 40) = *(_QWORD *)(a1 + 24); if (*(_QWORD *)(a1 + 40) == a1) { *(_DWORD *)a2 = 3; *(_QWORD *)(a2 + 8) = "f"; return 0xFFFFFFFFLL; } else { v2 = *(_QWORD **)(a1 + 40); v3 = v2[1]; *(_QWORD *)a2 = *v2; *(_QWORD *)(a2 + 8) = v3; return 0LL; } }
libedit
ida
static char *getarg(const char *input, const char **endp, char **argbuf, size_t *arglen) { if (input[0] == '{') { char *p = strchr(input + 1, '}'); if (p) { size_t n = p - input; if (n > *arglen) { *arglen = n; *argbuf = xrealloc(*argbuf, *arglen); } n--; memcpy(*argbuf, input + 1, n); (*argbuf)[n] = 0; *endp = p + 1; return *argbuf; } } *endp = input; return ((void *)0); }
void *getarg(_BYTE *a1, _QWORD *a2, void **a3, size_t *a4) { char *v7; size_t n; size_t na; if (*a1 == 123 && (v7 = strchr(a1 + 1, 125)) != 0LL) { n = v7 - a1; if (v7 - a1 > *a4) { *a4 = n; *a3 = (void *)xrealloc(*a3, *a4); } na = n - 1; memcpy(*a3, a1 + 1, na); *((_BYTE *)*a3 + na) = 0; *a2 = v7 + 1; return *a3; } else { *a2 = a1; return 0LL; } }
tar
ida
static void flush_paragraph(void) { WORD *split_point; WORD *w; int shift; COST best_break; if (word_limit == unused_word_type) { fwrite_unlocked(parabuf, sizeof *parabuf, wptr - parabuf, stdout); wptr = parabuf; return; } fmt_paragraph(); split_point = word_limit; best_break = ((COST)(!(!((COST)0 < (COST)-1)) ? (COST)-1 : ((((COST)1 << ((sizeof(COST) * 8) - 2)) - 1) * 2 + 1))); for (w = unused_word_type->next_break; w != word_limit; w = w->next_break) { if (w->best_cost - w->next_break->best_cost < best_break) { split_point = w; best_break = w->best_cost - w->next_break->best_cost; } if (best_break <= ((COST)(!(!((COST)0 < (COST)-1)) ? (COST)-1 : ((((COST)1 << ((sizeof(COST) * 8) - 2)) - 1) * 2 + 1))) - (((COST)(3)) * ((COST)(3)))) best_break += (((COST)(3)) * ((COST)(3))); } put_paragraph(split_point); memmove(parabuf, split_point->text, wptr - split_point->text); shift = split_point->text - parabuf; wptr -= shift; for (w = split_point; w <= word_limit; w++) w->text -= shift; memmove(unused_word_type, split_point, (word_limit - split_point + 1) * sizeof *unused_word_type); word_limit -= split_point - unused_word_type; }
char *flush_paragraph() { char *result; signed int v1; const void **src; long i; const void **j; long v5; if ((_UNKNOWN *)word_limit == &unused_word_type) { fwrite_unlocked(&parabuf, 1uLL, wptr - (_QWORD)&parabuf, stdout); result = (char *)&parabuf; wptr = (long)&parabuf; } else { fmt_paragraph(); src = (const void **)word_limit; v5 = 0x7FFFFFFFFFFFFFFFLL; for (i = qword_2F40; i != word_limit; i = *(_QWORD *)(i + 32)) { if (v5 > *(_QWORD *)(i + 24) - *(_QWORD *)(*(_QWORD *)(i + 32) + 24LL)) { src = (const void **)i; v5 = *(_QWORD *)(i + 24) - *(_QWORD *)(*(_QWORD *)(i + 32) + 24LL); } if (v5 <= 0x7FFFFFFFFFFFFFF6LL) v5 += 9LL; } put_paragraph((long)src); memmove(&parabuf, *src, wptr - (_QWORD)*src); v1 = (unsigned int)*src - (unsigned int)&parabuf; wptr -= v1; for (j = src; (unsigned long)j <= word_limit; j += 5) *j = (char *)*j - v1; memmove(&unused_word_type, src, word_limit - (_QWORD)src + 40); result = (char *)(&unused_word_type - (_UNKNOWN *)src + word_limit); word_limit = (long)result; } return result; }
coreutils
ida
static void do_convert_to_ssh2(struct passwd *pw, struct sshkey *k) { struct sshbuf *b; char comment[61], *b64; int r; if ((b = sshbuf_new()) == ((void *)0)) sshfatal("ssh-keygen.c", __func__, 353, 1, SYSLOG_LEVEL_FATAL, ((void *)0), "sshbuf_new failed"); if ((r = sshkey_putb(k, b)) != 0) sshfatal("ssh-keygen.c", __func__, 355, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "put key"); if ((b64 = sshbuf_dtob64_string(b, 1)) == ((void *)0)) sshfatal("ssh-keygen.c", __func__, 357, 1, SYSLOG_LEVEL_FATAL, ((void *)0), "sshbuf_dtob64_string failed"); snprintf(comment, sizeof(comment), "%u-bit %s, converted by %s@%s from OpenSSH", sshkey_size(k), sshkey_type(k), pw->pw_name, hostname); sshkey_free(k); sshbuf_free(b); fprintf(stdout, "%s\n", "---- BEGIN SSH2 PUBLIC KEY ----"); fprintf(stdout, "Comment: \"%s\"\n%s", comment, b64); fprintf(stdout, "%s\n", "---- END SSH2 PUBLIC KEY ----"); free(b64); exit(0); }
void do_convert_to_ssh2(unsigned long long *a0, unsigned long long a1, unsigned long a2) { unsigned int v0; unsigned long long v1; void *v2; char v3; unsigned long v4; unsigned long v5; unsigned long long v6; char v7; unsigned long v9; unsigned long v10; unsigned long long *v11; v6 = v9; v5 = v10; v4 = v11[5]; v1 = sshbuf_new(); if (!v1) sshfatal("ssh-keygen.c", "do_convert_to_ssh2", 0x161, 0x1, 0x1, 0x0, "sshbuf_new failed"); v0 = sshkey_putb(a1, v1, v1); if (v0) { v6 = "put key"; sshfatal("ssh-keygen.c", "do_convert_to_ssh2", 0x163, 0x1, 0x1, ssh_err(v0), *(&v7)); } v2 = sshbuf_dtob64_string(v1, 0x1); if (!v2) { v6 = "sshbuf_dtob64_string failed"; sshfatal("ssh-keygen.c", "do_convert_to_ssh2", 0x165, 0x1, 0x1, 0x0, *(&v7)); } v6 = &hostname; snprintf(&v3, 0x3d, "%u-bit %s, converted by %s@%s from OpenSSH", sshkey_size(a1), sshkey_type(a1), *(a0), *(&v7)); sshkey_free(a1); sshbuf_free(v1); fprintf(stdout, "%s\n", &g_410e38); fprintf(stdout, "Comment: \"%s\"\n%s", &v3, v2); fprintf(stdout, "%s\n", &g_410e6d); free(v2); exit(0x0); }
openssh-portable
angr_phoenix
static inline void emit_ancillary_info(char const *program) { struct infomap { char const *program; char const *node; } const infomap[] = { {"[", "test invocation"}, {"coreutils", "Multi-call invocation"}, {"sha224sum", "sha2 utilities"}, {"sha256sum", "sha2 utilities"}, {"sha384sum", "sha2 utilities"}, {"sha512sum", "sha2 utilities"}, {((void *)0), ((void *)0)}}; char const *node = program; struct infomap const *map_prog = infomap; while (map_prog->program && !(strcmp(program, map_prog->program) == 0)) map_prog++; if (map_prog->node) node = map_prog->node; printf (gettext ("\n%s online help: <%s>\n"), "GNU coreutils", "https: char const *lc_messages = setlocale ( 5 , ((void *)0) ); if (lc_messages && strncmp (lc_messages, "" "en_" "", sizeof ("en_") - 1)) { fputs_unlocked (gettext ("Report any translation bugs to " "<https: stdout ) ; } char const *url_program = (strcmp (program, "[") == 0) ? "test" : program; printf (gettext ("Full documentation <%s%s>\n"), "https: printf (gettext ("or available locally via: info '(coreutils) %s%s'\n"), node, node == program ? " invocation" : ""); }
void emit_ancillary_info(char *param_1) { FILE *__stream; int iVar1; char *pcVar2; char *pcVar3; long in_FS_OFFSET; char *local_b8; char **local_b0; char *local_98; char *local_90; char *local_88; char *local_80; char *local_78; char *local_70; char *local_68; char *local_60; char *local_58; char *local_50; char *local_48; char *local_40; undefined8 local_38; undefined8 local_30; long local_20; local_20 = *(long *)(in_FS_OFFSET + 0x28); local_98 = "["; local_90 = "test invocation"; local_88 = "coreutils"; local_80 = "Multi-call invocation"; local_78 = "sha224sum"; local_70 = "sha2 utilities"; local_68 = "sha256sum"; local_60 = "sha2 utilities"; local_58 = "sha384sum"; local_50 = "sha2 utilities"; local_48 = "sha512sum"; local_40 = "sha2 utilities"; local_38 = 0; local_30 = 0; local_b0 = &local_98; while ((*local_b0 != (char *)0x0 && (iVar1 = strcmp(param_1, *local_b0), iVar1 != 0))) { local_b0 = local_b0 + 2; } local_b8 = param_1; if (local_b0[1] != (char *)0x0) { local_b8 = local_b0[1]; } pcVar2 = (char *)gettext("\n%s online help: <%s>\n"); printf(pcVar2,"GNU coreutils","https: pcVar2 = setlocale(5,(char *)0x0); if ((pcVar2 != (char *)0x0) && (iVar1 = strncmp(pcVar2,"en_",3), __stream = stdout, iVar1 != 0)) { pcVar2 = (char *)gettext("Report any translation bugs to <https: ); fputs_unlocked(pcVar2, __stream); } iVar1 = strcmp(param_1,"["); pcVar2 = param_1; if (iVar1 == 0) { pcVar2 = "test"; } pcVar3 = (char *)gettext("Full documentation <%s%s>\n"); printf(pcVar3,"https: if (local_b8 == param_1) { pcVar2 = " invocation"; } else { pcVar2 = ""; } pcVar3 = (char *)gettext("or available locally via: info \'(coreutils) %s%s\'\n"); printf(pcVar3,local_b8,pcVar2); if (local_20 == *(long *)(in_FS_OFFSET + 0x28)) { return; } __stack_chk_fail(); }
coreutils
ghidra
int tnl_add_ioctl(int cmd, const char *basedev, const char *name, void *p) { struct ifreq ifr; int fd; int err; if (cmd == (0x89F0 + 3) && name[0]) strlcpy(ifr.ifr_ifrn.ifrn_name, name, 16); else strlcpy(ifr.ifr_ifrn.ifrn_name, basedev, 16); ifr.ifr_ifru.ifru_data = p; fd = socket(preferred_family, SOCK_DGRAM, 0); if (fd < 0) { fprintf(stderr, "create socket failed: %s\n", strerror((*__errno_location()))); return -1; } err = ioctl(fd, cmd, &ifr); if (err) fprintf(stderr, "add tunnel \"%s\" failed: %s\n", ifr.ifr_ifrn.ifrn_name, strerror((*__errno_location()))); close(fd); return err; }
long long tnl_add_ioctl(unsigned long a0, unsigned long long a1, char *a2, unsigned long a3) { unsigned int v0; unsigned int v1; char v2; unsigned long v3; unsigned long long v5; if (a0 != 35315 || !*(a2)) strlcpy(&v2, a1, 0x10, a1); else strlcpy(&v2, a2, 0x10, a2); v3 = a3; v0 = socket(preferred_family, 0x2, 0x0); if (v0 < 0) { fprintf(*(&stderr), "create socket failed: %s\n", strerror(*(__errno_location()))); v5 = 4294967295; return v5; } v1 = ioctl(v0, a0); if (v1) fprintf(*(&stderr), "add tunnel \"%s\" failed: %s\n", &v2, strerror(*(__errno_location()))); close(v0); v5 = v1; return v5; }
iproute2-6.0.0
angr_sailr
static void client_cleanup_stdio_fwd(struct ssh *ssh, int id, void *arg) { sshlog("ssh.c", __func__, 1847, 0, SYSLOG_LEVEL_DEBUG1, ((void *)0), "stdio forwarding: done"); cleanup_exit(0); }
long long client_cleanup_stdio_fwd(unsigned long a0, unsigned long a1) { char v0; unsigned long v1; unsigned int v2; unsigned long v3; unsigned long v5; v3 = a0; v2 = a1; v1 = v5; sshlog("ssh.c", "client_cleanup_stdio_fwd", 0x737, 0x0, 0x5, 0x0, "stdio forwarding: done", *(&v0)); cleanup_exit(0x0); }
openssh-portable
angr_phoenix
void perror_with_name(char const *name) { error(0, (*__errno_location()), "%s", name); }
long long perror_with_name(unsigned long a0) { unsigned long v0; v0 = a0; return error(0x0, *(__errno_location()), "%s"); }
diffutils
angr_dream
static void cfg_free(struct cfg *cfg) { while (cfg->overrides) { struct cfg_override *tmp = cfg->overrides; cfg->overrides = cfg->overrides->next; cfg_override_free(tmp); } while (cfg->searches) { struct cfg_search *tmp = cfg->searches; cfg->searches = cfg->searches->next; cfg_search_free(tmp); } while (cfg->externals) { struct cfg_external *tmp = cfg->externals; cfg->externals = cfg->externals->next; cfg_external_free(tmp); } while (cfg->excludes) { struct cfg_exclude *tmp = cfg->excludes; cfg->excludes = cfg->excludes->next; cfg_exclude_free(tmp); } }
void cfg_free(struct struct_0 *a0[519]) { unsigned long long *v0; unsigned long long *v1; unsigned long long *v2; unsigned long long *v3; unsigned long long *v5; while (a0[515]) { v3 = &a0[515]->field_0; a0[515] = a0[515]->field_0; cfg_override_free(v3); } while (a0[516]) { v2 = &a0[516]->field_0; a0[516] = a0[516]->field_0; cfg_search_free(v2); } while (a0[517]) { v1 = &a0[517]->field_0; a0[517] = a0[517]->field_0; cfg_external_free(v1); } while (true) { v5 = a0[518]; if (!a0[518]) break; v0 = &a0[518]->field_0; a0[518] = a0[518]->field_0; cfg_exclude_free(v0); } return; }
kmod
angr_sailr
static void ipaddr_loop_each_vf(struct rtattr *tb[], int vfnum, int *min, int *max) { struct rtattr *vflist = tb[IFLA_VFINFO_LIST]; struct rtattr *i, *vf[(__IFLA_VF_MAX - 1) + 1]; struct ifla_vf_rate *vf_rate; int rem; rem = ((int)((vflist)->rta_len) - ((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0))); for (i = ((void *)(((char *)(vflist)) + ((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0)))); ((rem) >= (int)sizeof(struct rtattr) && (i)->rta_len >= sizeof(struct rtattr) && (i)->rta_len <= (rem)); i = ((rem) -= ((((i)->rta_len) + 4U - 1) & ~(4U - 1)), (struct rtattr *)(((char *)(i)) + ((((i)->rta_len) + 4U - 1) & ~(4U - 1))))) { (parse_rtattr_flags( (vf), ((__IFLA_VF_MAX - 1)), ((void *)(((char *)(i)) + ((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0)))), ((int)((i)->rta_len) - ((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0))), (1 << 15))); if (!vf[IFLA_VF_RATE]) { fprintf(stderr, "VF min/max rate API not supported\n"); exit(1); } vf_rate = ((void *)(((char *)(vf[IFLA_VF_RATE])) + ((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0)))); if (vf_rate->vf == vfnum) { *min = vf_rate->min_tx_rate; *max = vf_rate->max_tx_rate; return; } } fprintf(stderr, "Cannot find VF %d\n", vfnum); exit(1); }
unsigned long ipaddr_loop_each_vf(long a1, unsigned int a2, _DWORD *a3, _DWORD *a4) { int v7; _WORD *i; unsigned short *v9; long v10; char v11[48]; long v12; unsigned long v13; v13 = __readfsqword(0x28u); v9 = *(unsigned short **)(a1 + 176); v7 = *v9 - 4; for (i = v9 + 2;; i = (_WORD *)((char *)i + (((unsigned short)*i + 3) & 0xFFFFFFFC))) { if (v7 <= 3 || *i <= 3u || v7 < (unsigned short)*i) { fprintf(stderr, "Cannot find VF %d\n", a2); exit(1); } parse_rtattr_flags(v11, 13LL, i + 2, (unsigned int)(unsigned short)*i - 4, 0x8000LL); if (!v12) { fprintf(stderr, "VF min/max rate API not supported\n"); exit(1); } v10 = v12 + 4; if (*(_DWORD *)(v12 + 4) == a2) break; v7 -= ((unsigned short)*i + 3) & 0xFFFFFFFC; } *a3 = *(_DWORD *)(v12 + 8); *a4 = *(_DWORD *)(v10 + 8); return __readfsqword(0x28u) ^ v13; }
iproute2-6.0.0
ida
static void update(void) { const struct passwd *pwent; unsigned long lastlog_uid_max; if (!uflg) return; lastlog_uid_max = getdef_ulong("LASTLOG_UID_MAX", 0xFFFFFFFFUL); if ((has_umin && umin > lastlog_uid_max) || (has_umax && umax > lastlog_uid_max)) { fprintf( stderr, gettext("%s: Selected uid(s) are higher than LASTLOG_UID_MAX (%lu),\n" "\tthey will not be updated.\n"), Prog, lastlog_uid_max); return; } if (has_umin && has_umax && (umin == umax)) { update_one(getpwuid((uid_t)umin)); } else { setpwent(); while ((pwent = getpwent()) != ((void *)0)) { if ((has_umin && (pwent->pw_uid < (uid_t)umin)) || (has_umax && (pwent->pw_uid > (uid_t)umax))) { continue; } update_one(pwent); } endpwent(); } if (fflush(lastlogfile) != 0 || fsync(fileno(lastlogfile)) != 0) { fprintf(stderr, gettext("%s: Failed to update the lastlog file\n"), Prog); exit(1); } }
void update() { unsigned long v0; struct_0 *v1; unsigned long long v3; unsigned long long v4; unsigned long long v5; unsigned long long v6; v3 = uflg ^ 1; if (!(uflg ^ 1)) { v0 = getdef_ulong("LASTLOG_UID_MAX", 0xffffffff); if ((!has_umin || v0 >= umin) && (!has_umax || v0 >= umax)) { if (has_umin && has_umax && umin == umax) update_one(getpwuid(umin)); if (!has_umin || !has_umax || umin != umax) { setpwent(); while (true) { v1 = &getpwent()->pw_name; if (!v1) break; if (!has_umin) continue; if (!has_umax) continue; update_one(v1); } endpwent(); } v5 = fflush(lastlogfile); if (!v5) v6 = fsync(fileno(lastlogfile)); if (v5 || v6) { fprintf(*(&stderr), gettext("%s: Failed to update the lastlog file\n")); exit(0x1); } } if ((v0 < umax || v0 < umin) && (v0 < umax || has_umin) && (v0 < umin || has_umax) && (has_umin || has_umax)) v4 = fprintf(*(&stderr), gettext("%s: Selected uid(s) are higher than LASTLOG_UID_MAX " "(%lu),\n\tthey will not be updated.\n")); } if ((uflg ^ 1) || !v5 && !v6 || v0 < umax && has_umax || v0 < umin && has_umin) return; }
shadow
angr_dream
int sshkey_fingerprint_raw(const struct sshkey *k, int dgst_alg, u_char **retp, size_t *lenp) { u_char *blob = ((void *)0), *ret = ((void *)0); size_t blob_len = 0; int r = -1; if (retp != ((void *)0)) *retp = ((void *)0); if (lenp != ((void *)0)) *lenp = 0; if (ssh_digest_bytes(dgst_alg) == 0) { r = -10; goto out; } if ((r = to_blob(k, &blob, &blob_len, 1, SSHKEY_SERIALIZE_DEFAULT)) != 0) goto out; if ((ret = calloc(1, 64)) == ((void *)0)) { r = -2; goto out; } if ((r = ssh_digest_memory(dgst_alg, blob, blob_len, ret, 64)) != 0) goto out; if (retp != ((void *)0)) { *retp = ret; ret = ((void *)0); } if (lenp != ((void *)0)) *lenp = ssh_digest_bytes(dgst_alg); r = 0; out: free(ret); if (blob != ((void *)0)) freezero(blob, blob_len); return r; }
int sshkey_fingerprint_raw(unsigned long long a0, unsigned long a1, unsigned long long *a2, unsigned long long *a3) { unsigned int v0; void *v1; void *v2; void *v3; v1 = 0; v3 = 0; v2 = 0; v0 = -1; if (a2) *(a2) = 0; if (a3) *(a3) = 0; if (!ssh_digest_bytes(a1)) { v0 = -10; } else { v0 = to_blob(a0, &v1, &v2, 0x1, 0x0); if (!v0) { v3 = calloc(0x1, 0x40); if (!v3) { v0 = -2; } else { v0 = ssh_digest_memory(a1, v1, v2, v3, 0x40); if (!v0) { if (a2) { *(a2) = v3; v3 = 0; } if (a3) *(a3) = ssh_digest_bytes(a1); v0 = 0; } } } } free(v3); if (v1) { freezero(v1, v2); return v0; } return v0; }
openssh-portable
angr_sailr
static void nh_transform(nh_ctx *hc, const UINT8 *buf, UINT32 nbytes) { UINT8 *key; key = hc->nh_key + hc->bytes_hashed; nh_aux(key, buf, hc->state, nbytes); }
long nh_transform(long a1, long a2, unsigned int a3) { return nh_aux((_DWORD *)(a1 + *(int *)(a1 + 1140)), a2, (long *)(a1 + 1144), a3); }
openssh-portable
ida
char *assoc_to_assign(hash, quoted) HASH_TABLE *hash; int quoted; { char *ret; char *istr, *vstr; int i, rsize, rlen, elen; BUCKET_CONTENTS *tlist; if (hash == 0 || ((hash)->nentries == 0)) return (char *)0; ret = sh_xmalloc((rsize = 128), "assoc.c", 454); ret[0] = '('; rlen = 1; for (i = 0; i < hash->nbuckets; i++) for (tlist = ((hash && (i < hash->nbuckets)) ? hash->bucket_array[i] : (BUCKET_CONTENTS *)((void *)0)); tlist; tlist = tlist->next) { if (ansic_shouldquote(tlist->key)) istr = ansic_quote(tlist->key, 0, (int *)0); else if (sh_contains_shell_metas(tlist->key)) istr = sh_double_quote(tlist->key); else if (((tlist->key[0]) == '@' || (tlist->key[0]) == '*') && tlist->key[1] == '\0') istr = sh_double_quote(tlist->key); else istr = tlist->key; vstr = tlist->data ? (ansic_shouldquote((char *)tlist->data) ? ansic_quote((char *)tlist->data, 0, (int *)0) : sh_double_quote((char *)tlist->data)) : (char *)0; elen = (((istr) && (istr)[0]) ? ((istr)[1] ? ((istr)[2] ? strlen(istr) : 2) : 1) : 0) + 8 + (((vstr) && (vstr)[0]) ? ((vstr)[1] ? ((vstr)[2] ? strlen(vstr) : 2) : 1) : 0); do { if ((rlen) + ((elen + 1)) >= rsize) { while ((rlen) + ((elen + 1)) >= rsize) rsize += (rsize); ret = sh_xrealloc((ret), (rsize), "assoc.c", 476); } } while (0); ret[rlen++] = '['; strcpy(ret + rlen, istr); rlen += (((istr) && (istr)[0]) ? ((istr)[1] ? ((istr)[2] ? strlen(istr) : 2) : 1) : 0); ret[rlen++] = ']'; ret[rlen++] = '='; if (vstr) { strcpy(ret + rlen, vstr); rlen += (((vstr) && (vstr)[0]) ? ((vstr)[1] ? ((vstr)[2] ? strlen(vstr) : 2) : 1) : 0); } ret[rlen++] = ' '; if (istr != tlist->key) do { if (istr) sh_xfree((istr), "assoc.c", 491); } while (0); do { if (vstr) sh_xfree((vstr), "assoc.c", 493); } while (0); } do { if ((rlen) + (1) >= rsize) { while ((rlen) + (1) >= rsize) rsize += (8); ret = sh_xrealloc((ret), (rsize), "assoc.c", 496); } } while (0); ret[rlen++] = ')'; ret[rlen] = '\0'; if (quoted) { vstr = sh_single_quote(ret); sh_xfree((ret), "assoc.c", 503); ret = vstr; } return ret; }
long long assoc_to_assign(struct_0 *a0, unsigned long a1) { unsigned int v0; int tmp_18; int tmp_42; int tmp_61; int tmp_16; int tmp_20; unsigned int v1; unsigned int v2; unsigned int v3; void *v4; char v5[3]; void *v6; void *v7; void *v9; void *v10; void *v11; unsigned long long v12; unsigned long v13; if (!a0) { v9 = 0; return v9; } else if (a0->field_c) { v1 = 128; v4 = sh_xmalloc(0x80, "assoc.c", 0x1c6); *(v4) = 40; v2 = 1; for (v0 = 0; v0 < a0->field_8; v0 += 1) { if (!a0 || v0 >= a0->field_8) v10 = 0; else v10 = *((a0->field_0 + v0 * 8)); for (v6 = v10; v6; v6 = *(v6)) { if (ansic_shouldquote(v6[8])) { *(&v5) = ansic_quote(v6[8], 0x0, 0x0); } else if (sh_contains_shell_metas(v6[8])) { *(&v5) = sh_double_quote(v6[8]); } else { switch (*(v6[8])) { case 42: case 64: if (!*((v6[8] + 1))) { *(&v5) = sh_double_quote(v6[8]); break; } else { *(&v5) = v6[8]; break; } default: *(&v5) = v6[8]; break; } } if (!v6[16]) { v11 = 0; } else if (!ansic_shouldquote(v6[16])) { v11 = sh_double_quote(v6[16]); } else { v11 = ansic_quote(v6[16], 0x0, 0x0); } v7 = v11; if (!v5 || !v5[0]) v12 = 8; else v12 = (!v5[1] ? (!v5[2] ? strlen(v5) + 8 : 10) : 9); if (!v7 || !*(v7)) { v13 = 0; } else if (!v7[1]) { v13 = 1; } else if (v7[2]) { v13 = strlen(v7); } else { v13 = 2; } if (v1 <= v2 + v3 + 1) { for (v3 = v13 + v12; v1 <= v2 + v3 + 1; v1 *= 2) ; v4 = sh_xrealloc(v4, v1, "assoc.c", 0x1dc); } tmp_18 = v2; v2 += 1; *(v4 + tmp_18) = 91; strcpy(v2 + v4, v5); if (!v5 || !v5[0]) { *(&v13) = 0; } else if (!v5[1]) { *(&v13) = 1; } else if (v5[2]) { v13 = strlen(v5); } else { *(&v13) = 2; } v2 = v13 + v2; tmp_42 = v2; v2 += 1; *(v4 + tmp_42) = 93; tmp_61 = v2; v2 += 1; *(v4 + tmp_61) = 61; if (v7) { strcpy(v2 + v4, v7); if (!v7 || !*(v7)) { *(&v13) = 0; } else if (!v7[1]) { *(&v13) = 1; } else if (!v7[2]) { *(&v13) = 2; } else { v13 = strlen(v7); } *(&v13) = v13 + v2; v2 = v13; } tmp_16 = v2; v2 += 1; *(v4 + tmp_16) = 32; if (v5 != v6[8] && v5) sh_xfree(v5, "assoc.c", 0x1eb); if (v7) sh_xfree(v7, "assoc.c", 0x1ed); } } if (v1 <= v2 + 1) { for (; v1 <= v2 + 1; v1 += 8) ; v4 = sh_xrealloc(v4, v1, "assoc.c", 0x1f0); } tmp_20 = v2; v2 += 1; *(v4 + tmp_20) = 41; *(v4 + v2) = 0; if (a1) { v7 = sh_single_quote(v4); sh_xfree(v4, "assoc.c", 0x1f7); v4 = v7; } v9 = v4; return v9; } else { v9 = 0; return v9; } }
bash
angr_sailr
static void explain(void) { print_explain(stderr); }
void explain() { unsigned long long v1; v1 = print_explain(stderr); return; }
iproute2-6.0.0
angr_sailr
void strmode(int mode, char *p) { switch (mode & 0170000) { case 0040000: *p++ = 'd'; break; case 0020000: *p++ = 'c'; break; case 0060000: *p++ = 'b'; break; case 0100000: *p++ = '-'; break; case 0120000: *p++ = 'l'; break; case 0140000: *p++ = 's'; break; case 0010000: *p++ = 'p'; break; default: *p++ = '?'; break; } if (mode & 0400) *p++ = 'r'; else *p++ = '-'; if (mode & 0200) *p++ = 'w'; else *p++ = '-'; switch (mode & (0100 | 04000)) { case 0: *p++ = '-'; break; case 0100: *p++ = 'x'; break; case 04000: *p++ = 'S'; break; case 0100 | 04000: *p++ = 's'; break; } if (mode & (0400 >> 3)) *p++ = 'r'; else *p++ = '-'; if (mode & (0200 >> 3)) *p++ = 'w'; else *p++ = '-'; switch (mode & ((0100 >> 3) | 02000)) { case 0: *p++ = '-'; break; case (0100 >> 3): *p++ = 'x'; break; case 02000: *p++ = 'S'; break; case (0100 >> 3) | 02000: *p++ = 's'; break; } if (mode & ((0400 >> 3) >> 3)) *p++ = 'r'; else *p++ = '-'; if (mode & ((0200 >> 3) >> 3)) *p++ = 'w'; else *p++ = '-'; switch (mode & (((0100 >> 3) >> 3) | 01000)) { case 0: *p++ = '-'; break; case ((0100 >> 3) >> 3): *p++ = 'x'; break; case 01000: *p++ = 'T'; break; case ((0100 >> 3) >> 3) | 01000: *p++ = 't'; break; } *p++ = ' '; *p = '\0'; }
long long strmode(unsigned long a0, unsigned long long a1) { unsigned long long v0; int tmp_13; char *v2; char *v3; char *v4; char *v5; char *v6; char *v7; char *v8; char *v9; char *v10; char *v11; char *v12; char *v13; char *v14; char *v15; char *v16; char *v17; char *v18; char *v19; char *v20; char *v21; char *v22; char *v23; char *v24; char *v25; char *v26; char *v27; char *v28; char *v29; char *v30; char *v31; char *v32; char *v33; v0 = a1; if ((a0 & 0xf000) == 0xc000) { v2 = v0; v0 += 1; *(v2) = 115; } else { if ((a0 & 0xf000) <= 0xc000) { if ((a0 & 0xf000) == 0xa000) { v3 = v0; v0 += 1; *(v3) = 108; goto LABEL_400110; } if ((a0 & 0xf000) <= 0xa000) { if ((a0 & 0xf000) == 0x8000) { v4 = v0; v0 += 1; *(v4) = 45; goto LABEL_400110; } if ((a0 & 0xf000) <= 0x8000) { if ((a0 & 0xf000) == 0x6000) { v5 = v0; v0 += 1; *(v5) = 98; goto LABEL_400110; } if ((a0 & 0xf000) <= 0x6000) { if ((a0 & 0xf000) == 0x4000) { v6 = v0; v0 += 1; *(v6) = 100; goto LABEL_400110; } if ((a0 & 0xf000) <= 0x4000) { if ((a0 & 0xf000) == 0x1000) { v7 = v0; v0 += 1; *(v7) = 112; goto LABEL_400110; } else if ((a0 & 0xf000) == 0x2000) { v9 = v0; v0 += 1; *(v9) = 99; goto LABEL_400110; } } } } } } v8 = v0; v0 += 1; *(v8) = 63; } LABEL_400110: if ((a0 & 0x100)) { v10 = v0; v0 += 1; *(v10) = 114; } else { v11 = v0; v0 += 1; *(v11) = 45; } if ((a0 & 128)) { v12 = v0; v0 += 1; *(v12) = 119; } else { v13 = v0; v0 += 1; *(v13) = 45; } if ((a0 & 2112) == 2112) { v14 = v0; v0 += 1; *(v14) = 115; } else if ((a0 & 2112) <= 2112) { if ((a0 & 2112) == 0x800) { v15 = v0; v0 += 1; *(v15) = 83; } else if ((a0 & 2112) <= 0x800) { if (!(a0 & 2112)) { v16 = v0; v0 += 1; *(v16) = 45; } else if ((a0 & 2112) == 64) { v17 = v0; v0 += 1; *(v17) = 120; } } } if ((a0 & 32)) { v18 = v0; v0 += 1; *(v18) = 114; } else { v19 = v0; v0 += 1; *(v19) = 45; } if ((a0 & 16)) { v20 = v0; v0 += 1; *(v20) = 119; } else { v21 = v0; v0 += 1; *(v21) = 45; } if ((a0 & 1032) == 1032) { v22 = v0; v0 += 1; *(v22) = 115; } else if ((a0 & 1032) <= 1032) { if ((a0 & 1032) == 0x400) { v23 = v0; v0 += 1; *(v23) = 83; } else if ((a0 & 1032) <= 0x400) { if (!(a0 & 1032)) { v24 = v0; v0 += 1; *(v24) = 45; } else if ((a0 & 1032) == 8) { v25 = v0; v0 += 1; *(v25) = 120; } } } if ((a0 & 4)) { v26 = v0; v0 += 1; *(v26) = 114; } else { v27 = v0; v0 += 1; *(v27) = 45; } if ((a0 & 2)) { v28 = v0; v0 += 1; *(v28) = 119; } else { v29 = v0; v0 += 1; *(v29) = 45; } if ((a0 & 513) == 513) { v30 = v0; v0 += 1; *(v30) = 116; } else if ((a0 & 513) <= 513) { if ((a0 & 513) == 0x200) { v31 = v0; v0 += 1; *(v31) = 84; } else if ((a0 & 513) <= 0x200) { if (!(a0 & 513)) { v32 = v0; v0 += 1; *(v32) = 45; } else if ((a0 & 513) == 1) { v33 = v0; v0 += 1; *(v33) = 120; } } } tmp_13 = v0; v0 += 1; *(tmp_13) = 32; *(v0) = 0; return v0; }
openssh-portable
angr_phoenix
static char *exptilde(char *startp, int flag) { signed char c; char *name; const char *home; char *p; p = startp; name = p + 1; while ((c = *++p) != '\0') { switch (c) { case -127: return (startp); case -120: return (startp); case ':': if (flag & 0x4) goto done; break; case '/': case -125: goto done; } } done: if (flag & 0x400) goto out; *p = '\0'; if (*name == '\0') { home = lookupvar(homestr); } else { home = getpwhome(name); } *p = c; if (!home) goto lose; strtodest(home, flag | 0x100); out: return (p); lose: return (startp); }
int exptilde(unsigned long a0, unsigned long a1) { unsigned int v0; int tmp_14; char v1; unsigned long long v2; char *v3; char *v4; unsigned int v6; v0 = a1; v3 = a0; v4 = v3 + 1; while (true) { v3 += 1; v1 = *(v3); if (!v1) { LABEL_400665: if (!(v0 & 0x400)) { *(v3) = 0; if (*(v4)) v2 = getpwhome(v4); else v2 = lookupvar(0x500048); *(v3) = v1; if (v2) { v6 = v0; *(&v6) = (v0 >> 8) | 1; tmp_14 = v6; strtodest(v2, tmp_14); } else { v6 = a0; break; } } *(&v6) = v3; break; } if (v1 == 58) { if (!(v0 & 4)) continue; goto LABEL_400665; } if (!(v1 <= 58)) continue; if (v1 == 47) { LABEL_400661: goto LABEL_400665; } else { if (!(v1 <= 47)) continue; if (v1 == -120) { v6 = a0; break; } if (!(v1 <= -120)) continue; if (v1 == -127) { v6 = a0; break; } if (v1 == -125) goto LABEL_400661; } } return v6; }
dash-0.5.11+git20210903+057cd650a4ed
angr_phoenix
static int do_lstat(char const *name, struct stat *st) { return do_statx(-100, name, st, 0x100, calc_req_mask()); }
int do_lstat(unsigned long long a0, void *a1) { return do_statx(0xffffff9c, a0, a1, 0x100, calc_req_mask()); }
coreutils
angr_phoenix
void rl_save_prompt(void) { rl_prompt_saved = strdup(rl_prompt); }
long long rl_save_prompt() { *(got.rl_prompt_saved) = strdup(*(got.rl_prompt)); return got.rl_prompt_saved; }
libedit
angr_sailr
int sshkey_ecdsa_nid_from_name(const char *name) { const struct keytype *kt; for (kt = keytypes; kt->type != -1; kt++) { if (!key_type_is_ecdsa_variant(kt->type)) continue; if (kt->name != ((void *)0) && strcmp(name, kt->name) == 0) return kt->nid; } return -1; }
long sshkey_ecdsa_nid_from_name(const char *a1) { char **i; for (i = keytypes; *((_DWORD *)i + 6) != -1; i += 5) { if (key_type_is_ecdsa_variant(*((_DWORD *)i + 6)) && *i && !strcmp(a1, *i)) return *((unsigned int *)i + 7); } return 0xFFFFFFFFLL; }
openssh-portable
ida
const char **rl_funmap_names(void) { const char **result; int result_size, result_index; rl_initialize_funmap(); for (result_index = result_size = 0, result = (const char **)((void *)0); funmap[result_index]; result_index++) { if (result_index + 2 > result_size) { result_size += 20; result = (const char **)xrealloc(result, result_size * sizeof(char *)); } result[result_index] = funmap[result_index]->name; result[result_index + 1] = (char *)((void *)0); } qsort(result, result_index, sizeof(char *), (QSFUNC *)_rl_qsort_string_compare); return (result); }
long long rl_funmap_names() { unsigned int v0; unsigned int v1; void *v2; rl_initialize_funmap(); v0 = 0; v1 = v0; for (v2 = 0; *((9045840598434793555 + (v1 << 3))); v1 += 1) { if (v0 <= v1 + 1) { v0 += 20; v2 = xrealloc(v2, v0 * 8, v0 * 8); } *((v2 + 8 * v1)) = *(*((9045840598434793555 + v1 * 8))); *((8 + v2 + 8 * v1)) = 0; } qsort(v2, v1, 0x8, got._rl_qsort_string_compare); return v2; }
bash
angr_sailr
int strvis(char *dst, const char *src, int flag) { char c; char *start; for (start = dst; (c = *src);) dst = vis(dst, c, flag, *++src); *dst = '\0'; return (dst - start); }
int strvis(unsigned long long a0, unsigned long a1, unsigned long a2) { char *v0; char *v1; char v2; char *v3; v1 = a0; v0 = a1; v3 = v1; while (true) { v2 = *(v0); if (!v2) break; v0 += 1; v1 = vis(v1, v2, a2, *(v0)); } *(v1) = 0; return __subvdi3(v1, v3); }
openssh-portable
angr_dream
static int load_resident_keys(int agent_fd, const char *skprovider, int qflag, struct dest_constraint **dest_constraints, size_t ndest_constraints) { struct sshsk_resident_key **srks; size_t nsrks, i; struct sshkey *key; int r, ok = 0; char *fp; pass = read_passphrase("Enter PIN for authenticator: ", 0x0002); if ((r = sshsk_load_resident(skprovider, ((void *)0), pass, 0, &srks, &nsrks)) != 0) { sshlog("ssh-add.c", __func__, 593, 0, SYSLOG_LEVEL_ERROR, ssh_err(r), "Unable to load resident keys"); return r; } for (i = 0; i < nsrks; i++) { key = srks[i]->key; if ((fp = sshkey_fingerprint(key, fingerprint_hash, SSH_FP_DEFAULT)) == ((void *)0)) sshfatal("ssh-add.c", __func__, 600, 1, SYSLOG_LEVEL_FATAL, ((void *)0), "sshkey_fingerprint failed"); if ((r = ssh_add_identity_constrained(agent_fd, key, "", lifetime, confirm, maxsign, skprovider, dest_constraints, ndest_constraints)) != 0) { sshlog("ssh-add.c", __func__, 604, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "Unable to add key %s %s", sshkey_type(key), fp); free(fp); ok = r; continue; } if (ok == 0) ok = 1; if (!qflag) { fprintf(stderr, "Resident identity added: %s %s\n", sshkey_type(key), fp); if (lifetime != 0) { fprintf(stderr, "Lifetime set to %d seconds\n", lifetime); } if (confirm != 0) { fprintf(stderr, "The user must confirm " "each use of the key\n"); } } free(fp); } sshsk_free_resident_keys(srks, nsrks); if (nsrks == 0) return -46; return ok == 1 ? 0 : ok; }
long load_resident_keys(unsigned int a1, long a2, int a3, long a4, long a5) { long v5; const char *v7; const char *v8; unsigned int v12; unsigned int v13; unsigned int v14; long v15; unsigned long v16; unsigned long i; long v18; void *ptr; unsigned long v20; v20 = __readfsqword(0x28u); v12 = 0; pass = (char *)read_passphrase("Enter PIN for authenticator: ", 2LL); v13 = sshsk_load_resident(a2, 0LL, pass, 0LL, &v15, &v16); if (v13) { v5 = ssh_err(v13); sshlog("ssh-add.c", "load_resident_keys", 593LL, 0LL, 2LL, v5, "Unable to load resident keys"); return v13; } else { for (i = 0LL; i < v16; ++i) { v18 = **(_QWORD **)(8 * i + v15); ptr = (void *)sshkey_fingerprint(v18, (unsigned int)fingerprint_hash, 0LL); if (!ptr) sshfatal("ssh-add.c", "load_resident_keys", 600LL, 1LL, 1LL, 0LL, "sshkey_fingerprint failed"); v14 = ssh_add_identity_constrained( a1, v18, &byte_33DF, (unsigned int)lifetime, (unsigned int)confirm, (unsigned int)maxsign, a2, a4, a5); if (v14) { v7 = (const char *)sshkey_type(v18); sshlog("ssh-add.c", "load_resident_keys", 604LL, 0LL, 2LL, 0LL, "Unable to add key %s %s", v7, (const char *)ptr); free(ptr); v12 = v14; } else { if (!v12) v12 = 1; if (!a3) { v8 = (const char *)sshkey_type(v18); fprintf(stderr, "Resident identity added: %s %s\n", v8, (const char *)ptr); if (lifetime) fprintf(stderr, "Lifetime set to %d seconds\n", (unsigned int)lifetime); if (confirm) fprintf(stderr, "The user must confirm each use of the key\n"); } free(ptr); } } sshsk_free_resident_keys(v15, v16); if (v16) { if (v12 == 1) return 0LL; else return v12; } else { return 4294967250LL; } } }
openssh-portable
ida
static union node *pipeline(void) { union node *n1, *n2, *pipenode; struct nodelist *lp, *prev; int negate; negate = 0; ; if (readtoken() == 13) { negate = !negate; checkkwd = 0x2 | 0x1; } else tokpushback++; n1 = command(); if (readtoken() == 6) { pipenode = (union node *)stalloc(sizeof(struct npipe)); pipenode->type = 1; pipenode->npipe.backgnd = 0; lp = (struct nodelist *)stalloc(sizeof(struct nodelist)); pipenode->npipe.cmdlist = lp; lp->n = n1; do { prev = lp; lp = (struct nodelist *)stalloc(sizeof(struct nodelist)); checkkwd = 0x4 | 0x2 | 0x1; lp->n = command(); prev->next = lp; } while (readtoken() == 6); lp->next = ((void *)0); n1 = pipenode; } tokpushback++; if (negate) { n2 = (union node *)stalloc(sizeof(struct nnot)); n2->type = 25; n2->nnot.com = n1; return n2; } else return n1; }
int pipeline(unsigned long long a0, unsigned long long a1, unsigned long long a2, unsigned long long a3, unsigned long long a4, unsigned long long a5) { unsigned int v0; struct_0 *v1; unsigned long long v2[2]; struct_0 *v3; unsigned long long v4[2]; struct_1 *v5; unsigned long long v8; v0 = 0; if (readtoken(a0, a1, a2, a3, a4, a5) == 13) { v0 = !v0; quoteflag = 3; } else { quoteflag = 283935561; } v1 = command(a0, a1, a2, a3, a4, a5); v8 = readtoken(a0, a1, a2, a3, a4, a5); if (v8 == 6) { v3 = stalloc(0x10); v3->field_0 = 1; v3->field_4 = 0; v2[0] = stalloc(0x10); v3->field_8 = v2; v2[1] = v1; while (true) { v4[0] = v2; v2[0] = stalloc(0x10); quoteflag = 7; v2[1] = command(0x10, a1, v2, a3, a4, a5); v4[0] = v2; v8 = readtoken(0x10, a1, v2, a3, a4, a5); if (v8 != 6) break; } v2[0] = 0; v1 = v3; } quoteflag = 283935561; if (v0) { v5 = stalloc(0x10); v5->field_0 = 25; v5->field_8 = v1; *(&v8) = v5; } else { *(&v8) = v1; } return v8; }
dash-0.5.11+git20210903+057cd650a4ed
angr_dream
static void parse_nh_group_type_res(struct nlmsghdr *n, int maxlen, int *argcp, char ***argvp) { char **argv = *argvp; struct rtattr *nest; int argc = *argcp; if (!(argc - 1 > 0)) return; nest = addattr_nest(n, maxlen, NHA_RES_GROUP); nest->rta_type |= (1 << 15); do { argv++; argc--; } while (0); while (argc > 0) { if (strcmp(*argv, "buckets") == 0) { __u16 buckets; do { argv++; if (--argc <= 0) incomplete_command(); } while (0); if (get_u16(&buckets, *argv, 0)) invarg("invalid buckets value", *argv); addattr16(n, maxlen, NHA_RES_GROUP_BUCKETS, buckets); } else if (strcmp(*argv, "idle_timer") == 0) { __u32 idle_timer; do { argv++; if (--argc <= 0) incomplete_command(); } while (0); if (get_unsigned(&idle_timer, *argv, 0) || idle_timer >= (4294967295U) / 100) invarg("invalid idle timer value", *argv); addattr32(n, maxlen, NHA_RES_GROUP_IDLE_TIMER, idle_timer * 100); } else if (strcmp(*argv, "unbalanced_timer") == 0) { __u32 unbalanced_timer; do { argv++; if (--argc <= 0) incomplete_command(); } while (0); if (get_unsigned(&unbalanced_timer, *argv, 0) || unbalanced_timer >= (4294967295U) / 100) invarg("invalid unbalanced timer value", *argv); addattr32(n, maxlen, NHA_RES_GROUP_UNBALANCED_TIMER, unbalanced_timer * 100); } else { break; } argc--; argv++; } *argcp = argc + 1; *argvp = argv - 1; addattr_nest_end(n, nest); }
void parse_nh_group_type_res(unsigned long long a0, unsigned long a1, unsigned int *a2, unsigned long long *a3) { char v0; unsigned int v1; unsigned long long *v2; struct_0 *v3; char v4; unsigned long long v9; unsigned long long *v12; unsigned long long v13; v2 = *(a3); v1 = *(a2); if (v1 > 1) { v3 = addattr_nest(a0, a1, 0xc, a1); v3->field_2 = v3->field_2 | 0x8000; v2 += 8; for (v1 -= 1; v1 > 0; v2 += 8) { if (!strcmp(*(v2), "buckets")) { v2 += 8; v1 -= 1; if (v1 <= 0) incomplete_command(); if (get_u16(&v0, *(v2), 0x0, *(v2))) invarg("invalid buckets value", *(v2)); addattr16(a0, a1, 0x1, *(&v0)); } else if (!strcmp(*(v2), "idle_timer")) { v2 += 8; v1 -= 1; if (v1 <= 0) incomplete_command(); if (*(&v0) > 42949671 || get_unsigned(&v0, *(v2), 0x0, *(v2))) invarg("invalid idle timer value", *(v2)); addattr32(a0, a1, 0x2, *(&v0) * 100); } else { v9 = strcmp(*(v2), "unbalanced_timer"); if (v9) break; if (!v9) { v2 += 8; v1 -= 1; if (v1 <= 0) incomplete_command(); if (get_unsigned(&v0, *(v2), 0x0, *(v2)) || *(&v0) > 42949671) invarg("invalid unbalanced timer value", *(v2)); addattr32(a0, a1, 0x3, *(&v0) * 100); } } v1 -= 1; } *(a2) = v1 + 1; *(a3) = v2 + 1; addattr_nest_end(a0, v3, v3); } v13 = *(&v4) ^ v12[5]; return; }
iproute2-6.0.0
angr_dream
static inline ssize_t smack_new_label_from_self(char **label) { return -1; }
int smack_new_label_from_self(unsigned long a0) { unsigned long v0; v0 = a0; return -1; }
coreutils
angr_dream
static void xwrite_stdout(char const *buffer, size_t n_bytes) { if (n_bytes > 0 && fwrite_unlocked(buffer, 1, n_bytes, stdout) < n_bytes) { clearerr_unlocked(stdout); ((!!sizeof(struct { _Static_assert( 1, "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), gettext (\"error writing " "%s\"), quotearg_style (shell_escape_always_quoting_style, " "\"standard output\")), assume (false))" ")"); int _gl_dummy; })) ? ((error(1, (*__errno_location()), gettext("error writing %s"), quotearg_style(shell_escape_always_quoting_style, "standard output")), ((0) ? (void)0 : __builtin_unreachable()))) : ((error(1, (*__errno_location()), gettext("error writing %s"), quotearg_style(shell_escape_always_quoting_style, "standard output")), ((0) ? (void)0 : __builtin_unreachable())))); } }
void xwrite_stdout(void *a0, unsigned int a1) { unsigned long long v2; if (a1 && a1 > fwrite_unlocked(a0, 0x1, a1, stdout)) { clearerr_unlocked(stdout); v2 = quotearg_style(0x4, "standard output"); error(0x1, *(__errno_location()), gettext("error writing %s")); } return; }
coreutils
angr_phoenix
int strnunvis(char *dst, size_t dlen, const char *src) { return strnunvisx(dst, dlen, src, 0); }
long strnunvis(_BYTE *a1, long a2, char *a3) { return strnunvisx(a1, a2, a3, 0); }
libedit
ida
void crypto_sign_ed25519_ref_sc25519_mul_shortsc( crypto_sign_ed25519_ref_sc25519 *r, const crypto_sign_ed25519_ref_sc25519 *x, const crypto_sign_ed25519_ref_shortsc25519 *y) { crypto_sign_ed25519_ref_sc25519 t; crypto_sign_ed25519_ref_sc25519_from_shortsc(&t, y); crypto_sign_ed25519_ref_sc25519_mul(r, x, &t); }
unsigned long crypto_sign_ed25519_ref_sc25519_mul_shortsc(long a1, long a2, long a3) { char v4[136]; unsigned long v5; v5 = __readfsqword(0x28u); crypto_sign_ed25519_ref_sc25519_from_shortsc((long)v4, a3); crypto_sign_ed25519_ref_sc25519_mul(a1, a2, (long)v4); return __readfsqword(0x28u) ^ v5; }
openssh-portable
ida
char **strvec_copy(array) char **array; { register int i; int len; char **ret; len = strvec_len(array); ret = (char **)sh_xmalloc(((len + 1) * sizeof(char *)), "stringvec.c", 151); for (i = 0; array[i]; i++) ret[i] = (char *)strcpy( sh_xmalloc((1 + strlen(array[i])), "stringvec.c", 153), (array[i])); ret[i] = (char *)((void *)0); return (ret); }
long long strvec_copy(void *a0) { unsigned int v0; void *v1; void *v3; v0 = strvec_len(a0); v1 = sh_xmalloc((v0 + 1) * 8, "stringvec.c", 0x97); for (v3 = 0; *((a0 + 0x8 * v3)); v3 = v3 + 1) { *((0x8 * v3 + v1)) = strcpy(sh_xmalloc(strlen(*((a0 + 0x8 * v3))) + 1, "stringvec.c", 0x99), *((a0 + 0x8 * v3))); } *((v1 + 0x8 * v3)) = 0; return v1; }
bash
angr_phoenix
static int history_load(History *h, const char *fname) { FILE *fp; char *line; size_t llen; ssize_t sz; size_t max_size; char *ptr; int i = -1; HistEvent ev; char *decode_result; if ((fp = fopen(fname, "r")) == ((void *)0)) return i; line = ((void *)0); llen = 0; if ((sz = getline(&line, &llen, fp)) == -1) goto done; if (strncmp(line, hist_cookie, (size_t)sz) != 0) goto done; ptr = malloc((max_size = 1024) * sizeof(*ptr)); if (ptr == ((void *)0)) goto done; for (i = 0; (sz = getline(&line, &llen, fp)) != -1; i++) { if (sz > 0 && line[sz - 1] == '\n') line[--sz] = '\0'; if (max_size < (size_t)sz) { char *nptr; max_size = ((size_t)sz + 1024) & (size_t)~1023; nptr = realloc((ptr), (max_size * sizeof(*ptr))); if (nptr == ((void *)0)) { i = -1; goto oomem; } ptr = nptr; } (void)strunvis(ptr, line); decode_result = (ptr); if (decode_result == ((void *)0)) continue; if ((*(h)->h_enter)((h)->h_ref, &ev, decode_result) == -1) { i = -1; goto oomem; } } oomem: free(ptr); done: free(line); (void)fclose(fp); return i; }
int history_load(unsigned long long a0[11], char *a1) { unsigned int v0; void *v1; void *v2; void *v3; unsigned long long v4; void *v5; void *v6; void *v7; unsigned long long v8; char v9; unsigned int v11; v0 = -1; v6 = fopen(a1, "r"); if (!v6) { v11 = v0; } else { v1 = 0; v2 = 0; *(&v3) = getline(&v1, &v2, v6); if (*(&v3) != -1 && !strncmp(v1, "_HiStOrY_V2_\n", *(&v3))) { v4 = 0x400; v5 = malloc(0x400); if (v5) { v0 = 0; while (true) { v3 = getline(&v1, &v2, v6); if (v3 == -1) break; if (v3 > 0 && *((v1 + v3 - 1)) == 10) { v3 -= 1; *((v3 + v1)) = 0; } if (v4 < v3) { *(&v4) = v3 + 0x400 & -0x400; v7 = realloc(v5, *(&v4)); if (v7) { v5 = v7; } else { v0 = -1; break; } } strunvis(v5, v1, v1); v8 = v5; if (v8 && a0[10](a0[0], &v9, v8, &v9, a0[10]) == -1) { v0 = -1; break; } v0 += 1; } free(v5); } } free(v1); fclose(v6); v11 = v0; } return v11; }
libedit
angr_phoenix
static SHELL_VAR *get_lineno(var) SHELL_VAR *var; { int ln; ln = executing_line_number(); return (set_int_value(var, ln, 0)); }
long long get_lineno(void *a0) { unsigned int v0; v0 = executing_line_number(); return set_int_value(a0, v0, 0x0); }
bash
angr_phoenix
void throughlocal_sftp(struct sftp_conn *from, struct sftp_conn *to, char *src, char *targ) { char *target = ((void *)0), *filename = ((void *)0), *abs_dst = ((void *)0); char *abs_src = ((void *)0), *tmp = ((void *)0); _ssh_compat_glob_t g; int i, r, targetisdir, err = 0; if ((filename = __xpg_basename(src)) == ((void *)0)) sshfatal("scp.c", __func__, 1910, 0, SYSLOG_LEVEL_FATAL, ((void *)0), "basename %s: %s", src, strerror((*__errno_location()))); if ((abs_src = prepare_remote_path(from, src)) == ((void *)0) || (target = prepare_remote_path(to, targ)) == ((void *)0)) cleanup_exit(255); memset(&g, 0, sizeof(g)); targetisdir = remote_is_dir(to, target); if (!targetisdir && targetshouldbedirectory) { sshlog("scp.c", __func__, 1919, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "%s: destination is not a directory", targ); err = -1; goto out; } sshlog("scp.c", __func__, 1924, 1, SYSLOG_LEVEL_DEBUG3, ((void *)0), "copying remote %s to remote %s", abs_src, target); if ((r = remote_glob(from, abs_src, 0x0008, ((void *)0), &g)) != 0) { if (r == (-1)) sshlog("scp.c", __func__, 1927, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "%s: too many glob matches", src); else sshlog("scp.c", __func__, 1929, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "%s: %s", src, strerror(2)); err = -1; goto out; } for (i = 0; g.gl_pathv[i] && !interrupted; i++) { tmp = xstrdup(g.gl_pathv[i]); if ((filename = __xpg_basename(tmp)) == ((void *)0)) { sshlog("scp.c", __func__, 1937, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "basename %s: %s", tmp, strerror((*__errno_location()))); err = -1; goto out; } if (targetisdir) abs_dst = path_append(target, filename); else abs_dst = xstrdup(target); sshlog("scp.c", __func__, 1947, 0, SYSLOG_LEVEL_DEBUG1, ((void *)0), "Fetching %s to %s\n", g.gl_pathv[i], abs_dst); if (globpath_is_dir(g.gl_pathv[i]) && iamrecursive) { if (crossload_dir(from, to, g.gl_pathv[i], abs_dst, ((void *)0), pflag, 2, 1) == -1) err = -1; } else { if (do_crossload(from, to, g.gl_pathv[i], abs_dst, ((void *)0), pflag) == -1) err = -1; } free(abs_dst); abs_dst = ((void *)0); free(tmp); tmp = ((void *)0); } out: free(abs_src); free(abs_dst); free(target); free(tmp); _ssh__compat_globfree(&g); if (err == -1) errs = 1; }
unsigned long throughlocal_sftp(long a1, long a2, char *a3, const char *a4) { int *v4; char *v5; char *v6; int *v7; char *v8; int i; int v13; int is_dir; int v15; char *ptr; char *v17; char *v18; char *v19; char *v20; long s[13]; unsigned long v22; v22 = __readfsqword(0x28u); v17 = 0LL; v13 = 0; if (!_xpg_basename(a3)) { v4 = _errno_location(); v5 = strerror(*v4); sshfatal("scp.c", "throughlocal_sftp", 1910LL, 0LL, 1LL, 0LL, "basename %s: %s", a3, v5); } v20 = (char *)prepare_remote_path(a1, a3); if (!v20 || (v18 = (char *)prepare_remote_path(a2, a4)) == 0LL) cleanup_exit(255); memset(s, 0, 0x60uLL); is_dir = remote_is_dir(a2, v18); if (is_dir || !targetshouldbedirectory) { sshlog("scp.c", "throughlocal_sftp", 1924LL, 1LL, 7LL, 0LL, "copying remote %s to remote %s", v20, v18); v15 = remote_glob(a1, v20, 8LL, 0LL, s); if (v15) { if (v15 == -1) { sshlog("scp.c", "throughlocal_sftp", 1927LL, 0LL, 2LL, 0LL, "%s: too many glob matches", a3); } else { v6 = strerror(2); sshlog("scp.c", "throughlocal_sftp", 1929LL, 0LL, 2LL, 0LL, "%s: %s", a3, v6); } v13 = -1; } else { for (i = 0; *(_QWORD *)(8LL * i + s[4]) && !interrupted; ++i) { v17 = (char *)xstrdup(*(_QWORD *)(8LL * i + s[4])); v19 = _xpg_basename(v17); if (!v19) { v7 = _errno_location(); v8 = strerror(*v7); sshlog("scp.c", "throughlocal_sftp", 1937LL, 0LL, 2LL, 0LL, "basename %s: %s", v17, v8); v13 = -1; break; } if (is_dir) ptr = (char *)path_append(v18, v19); else ptr = (char *)xstrdup(v18); sshlog("scp.c", "throughlocal_sftp", 1947LL, 0LL, 5LL, 0LL, "Fetching %s to %s\n", *(const char **)(8LL * i + s[4]), ptr); if ((unsigned int)globpath_is_dir(*(_QWORD *)(8LL * i + s[4])) && iamrecursive) { if ((unsigned int)crossload_dir(a1, a2, *(_QWORD *)(8LL * i + s[4]), ptr, 0LL, (unsigned int)pflag, 2LL, 1LL) == -1) v13 = -1; } else if ((unsigned int)do_crossload(a1, a2, *(_QWORD *)(8LL * i + s[4]), ptr, 0LL, (unsigned int)pflag) == -1) { v13 = -1; } free(ptr); free(v17); v17 = 0LL; } } } else { sshlog("scp.c", "throughlocal_sftp", 1919LL, 0LL, 2LL, 0LL, "%s: destination is not a directory", a4); v13 = -1; } free(v20); free(0LL); free(v18); free(v17); ssh__compat_globfree(s); if (v13 == -1) errs = 1; return __readfsqword(0x28u) ^ v22; }
openssh-portable
ida
static void expr_bind_array_element(tok, ind, rhs) char *tok; arrayind_t ind; char *rhs; { char *lhs, *vname; size_t llen; char ibuf[(((sizeof(arrayind_t) * 8) - (!((arrayind_t)0 < (arrayind_t)-1))) * 302 / 1000 + 1 + (!((arrayind_t)0 < (arrayind_t)-1))) + 1], *istr; istr = fmtumax(ind, 10, ibuf, sizeof(ibuf), 0); vname = array_variable_name(tok, 0, (char **)((void *)0), (int *)((void *)0)); llen = strlen(vname) + sizeof(ibuf) + 3; lhs = sh_xmalloc((llen), "expr.c", 381); sprintf(lhs, "%s[%s]", vname, istr); expr_bind_variable(lhs, rhs); sh_xfree((vname), "expr.c", 387); sh_xfree((lhs), "expr.c", 388); }
void expr_bind_array_element(undefined8 param_1, undefined8 param_2, undefined8 param_3) { undefined8 uVar1; char *__s; size_t sVar2; char *__s_00; long in_FS_OFFSET; undefined local_28[24]; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); uVar1 = fmtumax(param_2, 10, local_28, 0x16, 0); __s = (char *)array_variable_name(param_1, 0, 0, 0); sVar2 = strlen(__s); __s_00 = (char *)sh_xmalloc(sVar2 + 0x19, "expr.c", 0x17d); sprintf(__s_00, "%s[%s]", __s, uVar1); expr_bind_variable(__s_00, param_3); sh_xfree(__s, "expr.c", 0x183); sh_xfree(__s_00, "expr.c", 0x184); if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) { __stack_chk_fail(); } return; }
bash
ghidra
void xattrs_print(struct tar_stat_info const *st) { if (verbose_option < 3) return; if (selinux_context_option > 0 && st->cntx_name) fprintf(stdlis, " s: %s\n", st->cntx_name); if (acls_option > 0 && (st->acls_a_len || st->acls_d_len)) { fprintf(stdlis, " a: "); acls_one_line("", ',', st->acls_a_ptr, st->acls_a_len); if (st->acls_a_len && st->acls_d_len) fprintf(stdlis, ","); acls_one_line("default:", ',', st->acls_d_ptr, st->acls_d_len); fprintf(stdlis, "\n"); } if (xattrs_option > 0 && st->xattr_map_size) { int i; for (i = 0; i < st->xattr_map_size; ++i) { char *keyword = st->xattr_map[i].xkey + strlen("SCHILY.xattr."); if (!xattrs_masked_out(keyword, 0)) fprintf(stdlis, " x: %lu %s\n", (unsigned long)st->xattr_map[i].xval_len, keyword); } } }
long long xattrs_print(unsigned long long a0[45]) { unsigned int v0; unsigned long long v1; unsigned long long v3; v3 = verbose_option; if (verbose_option <= 2) return v3; if (selinux_context_option > 0 && a0[6]) fprintf(stdlis, " s: %s\n", a0[6]); if (acls_option > 0 && (a0[8] || a0[10])) { fprintf(stdlis, " a: "); acls_one_line(&g_4025ac, 0x2c, a0[7], a0[8]); if (a0[8] && a0[10]) fprintf(stdlis, ","); acls_one_line("default:", 0x2c, a0[9], a0[10]); fprintf(stdlis, "\n"); } v3 = xattrs_option; if (xattrs_option <= 0) return v3; v3 = a0[43]; if (!a0[43]) return v3; v0 = 0; while (true) { v3 = a0[43]; if (v0 >= a0[43]) break; v1 = strlen("SCHILY.xattr.") + *((v0 * 24 + a0[44])); *(&v3) = xattrs_masked_out(v1, 0x0) ^ 1; if (v3) fprintf(stdlis, " x: %lu %s\n", *((v0 * 24 + a0[44] + 16)), v1); v0 += 1; } return v3; }
tar
angr_sailr
static void reset_lineno(void) { if (reset_numbers) { line_no = starting_line_number; line_no_overflow = 0; } }
void reset_lineno(void) { if (reset_numbers != '\0') { line_no = starting_line_number; line_no_overflow = 0; } return; }
coreutils
ghidra
static void process_line_count(const struct control *p, intmax_t repetition) { intmax_t linenum; intmax_t last_line_to_save = p->lines_required * (repetition + 1); create_output_file(); if (no_more_lines() && suppress_matched) handle_line_error(p, repetition); linenum = get_first_line_in_buffer(); while (linenum++ < last_line_to_save) { struct cstring *line = remove_line(); if (line == ((void *)0)) handle_line_error(p, repetition); save_line_to_file(line); } close_output_file(); if (suppress_matched) remove_line(); if (no_more_lines() && !suppress_matched) handle_line_error(p, repetition); }
char process_line_count(long a1, long a2) { long v2; char result; long first_line_in_buffer; long v5; long v6; v5 = (a2 + 1) * *(_QWORD *)(a1 + 8); create_output_file(); if (no_more_lines() && suppress_matched) handle_line_error(a1, a2); first_line_in_buffer = get_first_line_in_buffer(); while (1) { v2 = first_line_in_buffer++; if (v5 <= v2) break; v6 = remove_line(); if (!v6) handle_line_error(a1, a2); save_line_to_file(v6); } close_output_file(); if (suppress_matched) remove_line(); result = no_more_lines(); if (result) { result = suppress_matched ^ 1; if (suppress_matched != 1) handle_line_error(a1, a2); } return result; }
coreutils
ida
void err_unboundvar(s) const char *s; { report_error(gettext("%s: unbound variable"), s); }
unsigned long err_unboundvar(long a1) { char *v1; long v2; long v3; long v4; v1 = gettext("%s: unbound variable"); return report_error(v1, a1, (long)v1, v2, v3, v4); }
bash
ida
static void tty_setup_flags(EditLine *el, struct termios *tios, int mode) { int kind; for (kind = 0; kind <= 3; kind++) { tcflag_t *f = tty__get_flag(tios, kind); *f = tty_update_flag(el, *f, mode, kind); } }
void tty_setup_flags(unsigned long long a0, unsigned long long a1, unsigned long a2) { unsigned int v0; unsigned int *v1; for (v0 = 0; v0 <= 3; v0 += 1) { v1 = tty__get_flag(a1, v0); *(v1) = tty_update_flag(a0, *(v1), a2, v0); } return; }
libedit
angr_phoenix
static _Bool xattrs_masked_out(const char *kw, _Bool archiving) { return xattrs_kw_included(kw, archiving) ? xattrs_kw_excluded(kw, archiving) : 1; }
int xattrs_masked_out(unsigned long long a0, unsigned long a1) { unsigned int v1; if (!xattrs_kw_included(a0, a1)) { v1 = 1; return v1; } else if (xattrs_kw_excluded(a0, a1)) { v1 = 1; return v1; } else { v1 = 0; return v1; } }
tar
angr_sailr
static inline _Bool is_addrtype_inet_not_multi(const inet_prefix *p) { return (p->flags & ADDRTYPE_INET_MULTI) == ADDRTYPE_INET; }
int is_addrtype_inet_not_multi(unsigned short *a0) { unsigned int v1; v1 = *(a0) & 10; *(&v1) = (*(a0) & 10) == 2; return v1; }
iproute2-6.0.0
angr_phoenix
int sys_exec_info_script(const char **archive_name, int volume_number) { pid_t pid; char uintbuf[((((((sizeof(uintmax_t) * 8) - (!((__typeof__(uintmax_t))0 < (__typeof__(uintmax_t))-1))) * 146 + 484) / 485) + (!((__typeof__(uintmax_t))0 < (__typeof__(uintmax_t))-1))) + 1)]; int p[2]; static void (*saved_handler)(int sig); xpipe(p); saved_handler = signal(13, ((__sighandler_t)1)); pid = xfork(); if (pid != 0) { int rc; int status; char *buf = ((void *)0); size_t size = 0; FILE *fp; xclose(p[1]); fp = fdopen(p[0], "r"); rc = getline(&buf, &size, fp); fclose(fp); if (rc > 0 && buf[rc - 1] == '\n') buf[--rc] = 0; while (waitpid(pid, &status, 0) == -1) if ((*__errno_location()) != 4) { signal(13, saved_handler); waitpid_error(info_script_option); return -1; } signal(13, saved_handler); if ((((status) & 0x7f) == 0)) { if ((((status) & 0xff00) >> 8) == 0 && rc > 0) *archive_name = buf; else free(buf); return (((status) & 0xff00) >> 8); } free(buf); return -1; } setenv("TAR_VERSION", "1.34", 1); setenv("TAR_ARCHIVE", *archive_name, 1); setenv("TAR_VOLUME", umaxtostr(volume_number, uintbuf), 1); setenv("TAR_BLOCKING_FACTOR", umaxtostr(blocking_factor, uintbuf), 1); setenv("TAR_SUBCOMMAND", subcommand_string(subcommand_option), 1); setenv("TAR_FORMAT", archive_format_string(current_format == DEFAULT_FORMAT ? archive_format : current_format), 1); setenv("TAR_FD", umaxtostr(p[1], uintbuf), 1); xclose(p[0]); priv_set_restore_linkdir(); xexec(info_script_option); }
long long sys_exec_info_script(unsigned long long *a0, unsigned long a1) { char v0; unsigned int v1; unsigned int v2; void *v3; void *v4; void *v5; char v6; char v7; char v8; unsigned long long v11; unsigned long long v12; xpipe(&v6); saved_handler.7084 = signal(0xd, 0x1); v2 = xfork(); if (!v2) { setenv("TAR_VERSION", "1.34", 0x1); setenv("TAR_ARCHIVE", *(a0), 0x1); setenv("TAR_VOLUME", umaxtostr(a1, &v8, &v8), 0x1); setenv("TAR_BLOCKING_FACTOR", umaxtostr(blocking_factor, &v8, &v8), 0x1); setenv("TAR_SUBCOMMAND", subcommand_string(subcommand_option), 0x1); if (!current_format) v11 = archive_format; else v11 = current_format; setenv("TAR_FORMAT", archive_format_string(v11), 0x1); setenv("TAR_FD", umaxtostr(*(&v7), &v8, &v8), 0x1); xclose(*(&v6)); priv_set_restore_linkdir(); xexec(*(&info_script_option)); } else { v3 = 0; v4 = 0; xclose(*(&v7)); v5 = fdopen(*(&v6), "r"); v1 = getline(&v3, &v4, v5); fclose(v5); if (v1 > 0 && *(-1 + v3 + v1) == 10) { v1 -= 1; *(v1 + v3) = 0; } do { if (waitpid(v2, &v0, 0x0) != -1) { signal(0xd, saved_handler.7084); if ((*(&v0) & 127)) { free(v3); v12 = 4294967295; goto LABEL_401d66; } if (!(*(&v0) >> 8) && v1 > 0) { *(a0) = v3; goto LABEL_401c22; } free(v3); LABEL_401c22: v12 = *(&v0) >> 8; goto LABEL_401d66; } } while (*(__errno_location()) == 4); signal(0xd, saved_handler.7084); waitpid_error(*(&info_script_option)); v12 = 4294967295; LABEL_401d66: return v12; } }
tar
angr_phoenix
static int stat_for_mode(char const *name, struct stat *st) { return do_statx(-100, name, st, 0, 0x00000002U); }
long stat_for_mode(long a1, long a2) { return do_statx(0xFFFFFF9C, a1, a2, 0, 2u); }
coreutils
ida
int tun_open(int tun, int mode, char **ifname) { return (sys_tun_open(tun, mode, ifname)); }
long long tun_open(unsigned long a0, unsigned long a1, unsigned long long a2) { return sys_tun_open(a0, a1, a2, a1); }
openssh-portable
angr_sailr
void usage(int status) { if (status != 0) do { fprintf(stderr, gettext("Try '%s --help' for more information.\n"), program_name); } while (0); else { printf(gettext("Usage: %s [OPTION]... [TEMPLATE]\n"), program_name); fputs_unlocked( gettext("Create a temporary file or directory, safely, and print its " "name.\nTEMPLATE must contain at least 3 consecutive 'X's in " "last component.\nIf TEMPLATE is not specified, use " "tmp.XXXXXXXXXX, and --tmpdir is implied.\n"), stdout) ; fputs_unlocked(gettext("Files are created u+rw, and directories u+rwx, " "minus umask restrictions.\n"), stdout) ; fputs_unlocked("\n", stdout); fputs_unlocked( gettext(" -d, --directory create a directory, not a file\n -u, " "--dry-run do not create anything; merely print a name " "(unsafe)\n -q, --quiet suppress diagnostics about " "file/dir-creation failure\n"), stdout) ; fputs_unlocked( gettext(" --suffix=SUFF append SUFF to TEMPLATE; SUFF must not " "contain a slash.\n This option is " "implied if TEMPLATE does not end in X\n"), stdout) ; fputs_unlocked( gettext( " -p DIR, --tmpdir[=DIR] interpret TEMPLATE relative to DIR; if " "DIR is not\n specified, use $TMPDIR if " "set, else /tmp. With\n this option, " "TEMPLATE must not be an absolute name;\n " "unlike with -t, TEMPLATE may contain slashes, but\n " " mktemp creates only the final component\n"), stdout) ; fputs_unlocked( gettext(" -t interpret TEMPLATE as a single file " "name component,\n relative to a " "directory: $TMPDIR, if set; else the\n " "directory specified via -p; else /tmp [deprecated]\n"), stdout) ; fputs_unlocked(gettext(" --help display this help and exit\n"), stdout); fputs_unlocked( gettext(" --version output version information and exit\n"), stdout); emit_ancillary_info("mktemp"); } exit(status); }
void usage(int a1) { long v1; char *v2; char *v3; FILE *v4; char *v5; FILE *v6; char *v7; FILE *v8; char *v9; FILE *v10; char *v11; FILE *v12; char *v13; FILE *v14; char *v15; FILE *v16; char *v17; FILE *v18; char *v19; v1 = program_name; if (a1) { v2 = gettext("Try '%s --help' for more information.\n"); fprintf(stderr, v2, v1); } else { v3 = gettext("Usage: %s [OPTION]... [TEMPLATE]\n"); printf(v3, v1); v4 = stdout; v5 = gettext( "Create a temporary file or directory, safely, and print its name.\n" "TEMPLATE must contain at least 3 consecutive 'X's in last component.\n" "If TEMPLATE is not specified, use tmp.XXXXXXXXXX, and --tmpdir is " "implied.\n"); fputs_unlocked(v5, v4); v6 = stdout; v7 = gettext("Files are created u+rw, and directories u+rwx, minus umask " "restrictions.\n"); fputs_unlocked(v7, v6); fputs_unlocked("\n", stdout); v8 = stdout; v9 = gettext(" -d, --directory create a directory, not a file\n" " -u, --dry-run do not create anything; merely print a " "name (unsafe)\n" " -q, --quiet suppress diagnostics about " "file/dir-creation failure\n"); fputs_unlocked(v9, v8); v10 = stdout; v11 = gettext(" --suffix=SUFF append SUFF to TEMPLATE; SUFF must " "not contain a slash.\n" " This option is implied if TEMPLATE " "does not end in X\n"); fputs_unlocked(v11, v10); v12 = stdout; v13 = gettext( " -p DIR, --tmpdir[=DIR] interpret TEMPLATE relative to DIR; if DIR " "is not\n" " specified, use $TMPDIR if set, else /tmp. " "With\n" " this option, TEMPLATE must not be an absolute " "name;\n" " unlike with -t, TEMPLATE may contain slashes, " "but\n" " mktemp creates only the final component\n"); fputs_unlocked(v13, v12); v14 = stdout; v15 = gettext(" -t interpret TEMPLATE as a single file " "name component,\n" " relative to a directory: $TMPDIR, " "if set; else the\n" " directory specified via -p; else " "/tmp [deprecated]\n"); fputs_unlocked(v15, v14); v16 = stdout; v17 = gettext(" --help display this help and exit\n"); fputs_unlocked(v17, v16); v18 = stdout; v19 = gettext(" --version output version information and exit\n"); fputs_unlocked(v19, v18); emit_ancillary_info("mktemp"); } exit(a1); }
coreutils
ida
inline _Bool is_basic(char c) { return (is_basic_table[(unsigned char)c >> 5] >> ((unsigned char)c & 31)) & 1; }
void is_basic(void) { halt_baddata(); }
coreutils
ghidra
static void trig_transitional_activate(enum modstatdb_rw cstatus) { struct pkg_hash_iter *iter; struct pkginfo *pkg; iter = pkg_hash_iter_new(); while ((pkg = pkg_hash_iter_next_pkg(iter))) { if (pkg->status <= PKG_STAT_HALFINSTALLED) continue; debug(dbg_triggersdetail, "trig_transitional_activate %s %s", pkg_name(pkg, pnaw_always), pkg_status_name(pkg)); pkg->trigpend_head = ((void *)0); trig_parse_ci(pkg_infodb_get_file(pkg, &pkg->installed, "triggers"), cstatus >= msdbrw_write ? transitional_interest_callback : transitional_interest_callback_ro, ((void *)0), pkg, &pkg->installed); if (pkg->status < PKG_STAT_TRIGGERSAWAITED) continue; if (pkg->trigaw.head) pkg_set_status(pkg, PKG_STAT_TRIGGERSAWAITED); else if (pkg->trigpend_head) pkg_set_status(pkg, PKG_STAT_TRIGGERSPENDING); else pkg_set_status(pkg, PKG_STAT_INSTALLED); } pkg_hash_iter_free(iter); if (cstatus >= msdbrw_write) { modstatdb_checkpoint(); trig_file_interests_save(); } }
void trig_transitional_activate(uint param_1) { undefined8 uVar1; undefined8 uVar2; undefined8 uVar3; long lVar4; code *pcVar5; uVar1 = pkg_hash_iter_new(); while (lVar4 = pkg_hash_iter_next_pkg(uVar1), lVar4 != 0) { if (2 < *(uint *)(lVar4 + 0x18)) { uVar2 = pkg_status_name(lVar4); uVar3 = pkg_name(lVar4, 3); debug(0x2000, "trig_transitional_activate %s %s", uVar3, uVar2); *(undefined8 *)(lVar4 + 0x160) = 0; if (param_1 < 3) { pcVar5 = transitional_interest_callback_ro; } else { pcVar5 = transitional_interest_callback; } uVar2 = pkg_infodb_get_file(lVar4, lVar4 + 0x48, "triggers"); trig_parse_ci(uVar2, pcVar5, 0, lVar4, lVar4 + 0x48); if (4 < *(uint *)(lVar4 + 0x18)) { if (*(long *)(lVar4 + 0x148) == 0) { if (*(long *)(lVar4 + 0x160) == 0) { pkg_set_status(lVar4, 7); } else { pkg_set_status(lVar4, 6); } } else { pkg_set_status(lVar4, 5); } } } } pkg_hash_iter_free(uVar1); if (2 < param_1) { modstatdb_checkpoint(); trig_file_interests_save(); } return; }
dpkg
ghidra
static int quota_inum_is_reserved(ext2_filsys fs, ext2_ino_t ino) { enum quota_type qtype; for (qtype = 0; qtype < MAXQUOTAS; qtype++) if (quota_type2inum(qtype, fs->super) == ino) return 1; return 0; }
int quota_inum_is_reserved(struct_0 *a0, unsigned long a1) { unsigned int v0; unsigned int v2; v0 = 0; while (true) { if (v0 > 2) { v2 = 0; return v2; } else if (a1 != quota_type2inum(v0, a0->field_20, a0->field_20)) { v0 += 1; } else { v2 = 1; return v2; } } }
e2fsprogs-1.46.5
angr_sailr
static errcode_t PRS(int argc, char *argv[], e2fsck_t *ret_ctx) { int flush = 0; int c, fd; e2fsck_t ctx; errcode_t retval; struct sigaction sa; char *extended_opts = 0; char *cp; int res; unsigned long long phys_mem_kb, blk; retval = e2fsck_allocate_context(&ctx); if (retval) return retval; *ret_ctx = ctx; e2fsck_global_ctx = ctx; setvbuf(stdout, ((void *)0), 2, 8192); setvbuf(stderr, ((void *)0), 2, 8192); if (getenv("E2FSCK_FORCE_INTERACTIVE") || (isatty(0) && isatty(1))) { ctx->interactive = 1; } else { ctx->start_meta[0] = '\001'; ctx->stop_meta[0] = '\002'; } memset(bar, '=', sizeof(bar) - 1); memset(spaces, ' ', sizeof(spaces) - 1); add_error_table(&et_ext2_error_table); add_error_table(&et_prof_error_table); blkid_get_cache(&ctx->blkid, ((void *)0)); if (argc && *argv) ctx->program_name = *argv; else ctx->program_name = "e2fsck"; phys_mem_kb = get_memory_size() / 1024; ctx->readahead_kb = ~0ULL; while ((c = getopt(argc, argv, "panyrcC:B:dE:fvtFVM:b:I:j:P:l:L:N:SsDkz:")) != (-1)) switch (c) { case 'C': ctx->progress = e2fsck_update_progress; res = sscanf(optarg, "%d", &ctx->progress_fd); if (res != 1) goto sscanf_err; if (ctx->progress_fd < 0) { ctx->progress = 0; ctx->progress_fd = ctx->progress_fd * -1; } if (!ctx->progress_fd) break; fd = dup(ctx->progress_fd); if (fd < 0) { fprintf(stderr, (gettext("Error validating file descriptor %d: %s\n")), ctx->progress_fd, error_message((*__errno_location()))); fatal_error( ctx, (gettext("Invalid completion information file descriptor"))); } else close(fd); break; case 'D': ctx->options |= 0x0400; break; case 'E': extended_opts = optarg; break; case 'p': case 'a': if (ctx->options & (0x0004 | 0x0008)) { conflict_opt: fatal_error( ctx, (gettext( "Only one of the options -p/-a, -n or -y may be specified."))); } ctx->options |= 0x0002; break; case 'n': if (ctx->options & (0x0004 | 0x0002)) goto conflict_opt; ctx->options |= 0x0008; break; case 'y': if (ctx->options & (0x0002 | 0x0008)) goto conflict_opt; ctx->options |= 0x0004; break; case 't': if (ctx->options & 0x0010) ctx->options |= 0x0020; else ctx->options |= 0x0010; break; case 'c': if (cflag++) ctx->options |= 0x0200; ctx->options |= 0x0040; break; case 'r': break; case 'b': res = sscanf(optarg, "%llu", &blk); ctx->use_superblock = blk; if (res != 1) goto sscanf_err; ctx->flags |= 0x0100; break; case 'B': ctx->blocksize = atoi(optarg); break; case 'I': res = sscanf(optarg, "%d", &ctx->inode_buffer_blocks); if (res != 1) goto sscanf_err; break; case 'j': ctx->journal_name = blkid_get_devname(ctx->blkid, optarg, ((void *)0)); if (!ctx->journal_name) { com_err(ctx->program_name, 0, (gettext("Unable to resolve '%s'")), optarg); fatal_error(ctx, 0); } break; case 'P': res = sscanf(optarg, "%d", &ctx->process_inode_size); if (res != 1) goto sscanf_err; break; case 'L': replace_bad_blocks++; case 'l': if (bad_blocks_file) free(bad_blocks_file); bad_blocks_file = string_copy(ctx, optarg, 0); break; case 'd': ctx->options |= 0x0080; break; case 'f': ctx->options |= 0x0100; break; case 'F': flush = 1; break; case 'v': verbose = 1; break; case 'V': show_version_only = 1; break; case 'N': ctx->device_name = string_copy(ctx, optarg, 0); break; case 'k': keep_bad_blocks++; break; case 'z': ctx->undo_file = optarg; break; default: usage(ctx); } if (show_version_only) return 0; if (optind != argc - 1) usage(ctx); if ((ctx->options & 0x0008) && (ctx->options & 0x0400)) { com_err(ctx->program_name, 0, "%s", (gettext("The -n and -D options are incompatible."))); fatal_error(ctx, 0); } if ((ctx->options & 0x0008) && cflag) { com_err(ctx->program_name, 0, "%s", (gettext("The -n and -c options are incompatible."))); fatal_error(ctx, 0); } if ((ctx->options & 0x0008) && bad_blocks_file) { com_err(ctx->program_name, 0, "%s", (gettext("The -n and -l/-L options are incompatible."))); fatal_error(ctx, 0); } if (ctx->options & 0x0008) ctx->options |= 0x0001; ctx->io_options = strchr(argv[optind], '?'); if (ctx->io_options) *ctx->io_options++ = 0; ctx->filesystem_name = blkid_get_devname(ctx->blkid, argv[optind], 0); if (!ctx->filesystem_name) { com_err(ctx->program_name, 0, (gettext("Unable to resolve '%s'")), argv[optind]); fatal_error(ctx, 0); } if (extended_opts) parse_extended_opts(ctx, extended_opts); if (getenv("E2FSCK_FIXES_ONLY")) ctx->options |= 0x8000; if ((ctx->options & 0x0400) && (ctx->options & 0x8000)) { com_err(ctx->program_name, 0, "%s", (gettext("The -D and -E fixes_only options are incompatible."))); fatal_error(ctx, 0); } if ((ctx->options & 0x4000) && (ctx->options & 0x8000)) { com_err( ctx->program_name, 0, "%s", (gettext( "The -E bmap2extent and fixes_only options are incompatible."))); fatal_error(ctx, 0); } if ((cp = getenv("E2FSCK_CONFIG")) != ((void *)0)) config_fn[0] = cp; profile_set_syntax_err_cb(syntax_err_report); profile_init(config_fn, &ctx->profile); profile_get_boolean(ctx->profile, "options", "report_time", 0, 0, &c); if (c) ctx->options |= 0x0010 | 0x0020; profile_get_boolean(ctx->profile, "options", "report_verbose", 0, 0, &c); if (c) verbose = 1; profile_get_boolean(ctx->profile, "options", "no_optimize_extents", 0, 0, &c); if (c) ctx->options |= 0x10000; profile_get_boolean(ctx->profile, "options", "inode_count_fullmap", 0, 0, &c); if (c) ctx->options |= 0x20000; if (ctx->readahead_kb == ~0ULL) { profile_get_integer(ctx->profile, "options", "readahead_mem_pct", 0, -1, &c); if (c >= 0 && c <= 100) ctx->readahead_kb = phys_mem_kb * c / 100; profile_get_integer(ctx->profile, "options", "readahead_kb", 0, -1, &c); if (c >= 0) ctx->readahead_kb = c; if (ctx->readahead_kb != ~0ULL && ctx->readahead_kb > phys_mem_kb) ctx->readahead_kb = phys_mem_kb; } if ((ctx->options & 0x0008) && (ctx->options & 0x2000)) ctx->options &= ~0x2000; if (flush) { fd = open(ctx->filesystem_name, 00, 0); if (fd < 0) { com_err("open", (*__errno_location()), (gettext("while opening %s for flushing")), ctx->filesystem_name); fatal_error(ctx, 0); } if ((retval = ext2fs_sync_device(fd, 1))) { com_err("ext2fs_sync_device", retval, (gettext("while trying to flush %s")), ctx->filesystem_name); fatal_error(ctx, 0); } close(fd); } if (cflag && bad_blocks_file) { fprintf(stderr, "%s", (gettext("The -c and the -l/-L options may not " "be both used at the same time.\n"))); exit(16); } memset(&sa, 0, sizeof(struct sigaction)); sa.__sigaction_handler.sa_handler = signal_cancel; sigaction(2, &sa, 0); sigaction(15, &sa, 0); sa.sa_flags = 0x10000000; sa.__sigaction_handler.sa_handler = signal_progress_on; sigaction(10, &sa, 0); sa.__sigaction_handler.sa_handler = signal_progress_off; sigaction(12, &sa, 0); if (cflag) { char *oldpath = getenv("PATH"); char *newpath; int len = sizeof("PATH=/sbin") + 1; if (oldpath) len += strlen(oldpath); newpath = malloc(len); if (!newpath) fatal_error(ctx, "Couldn't malloc() newpath"); strcpy(newpath, "PATH=/sbin"); if (oldpath) { strcat(newpath, ":"); strcat(newpath, oldpath); } putenv(newpath); } return 0; sscanf_err: fprintf(stderr, (gettext("\nInvalid non-numeric argument to -%c (\"%s\")\n\n")), c, optarg); exit(1); }
long PRS(int a1, char *const *a2, _QWORD *a3) { int *v4; long v5; unsigned int v6; char *v7; char *v8; int v9; char *v10; int v11; int v13; int v14; int v15; long v16; char *v17; char *v18; int v19; int v20; long v21; char *v22; char *v23; char *v24; long v25; _BYTE *v26; long v27; char *v28; char *v29; int v30; char *v31; char *v32; int v33; long v34; char *v35; int *v36; long v37; char *v38; char *v39; char *v40; char *v41; unsigned int v43; int v44; int v45; int fd; int v47; long v48; long v49; char *v50; long v51; unsigned long v52; char *v53; char *src; char *dest; struct sigaction s; unsigned long v57; v57 = __readfsqword(0x28u); v44 = 0; v50 = 0LL; v51 = e2fsck_allocate_context(&v48); if (v51) return v51; *a3 = v48; e2fsck_global_ctx = v48; setvbuf(stdout, 0LL, 2, 0x2000uLL); setvbuf(stderr, 0LL, 2, 0x2000uLL); if (getenv("E2FSCK_FORCE_INTERACTIVE") || isatty(0) && isatty(1)) { *(_DWORD *)(v48 + 728) = 1; } else { *(_BYTE *)(v48 + 732) = 1; *(_BYTE *)(v48 + 734) = 2; } memset(bar, 61, 0x7FuLL); memset(spaces, 32, 0x7FuLL); add_error_table(&et_ext2_error_table); add_error_table(&et_prof_error_table); blkid_get_cache(v48 + 136, 0LL); if (a1 && *a2) *(char **)(v48 + 8) = *a2; else *(_QWORD *)(v48 + 8) = "e2fsck"; v52 = (unsigned long)get_memory_size() >> 10; *(_QWORD *)(v48 + 920) = -1LL; while (1) { v43 = getopt(a1, a2, "panyrcC:B:dE:fvtFVM:b:I:j:P:l:L:N:SsDkz:"); if (v43 == -1) break; switch (v43) { case 'B': v15 = atoi(optarg); *(_DWORD *)(v48 + 80) = v15; continue; case 'C': *(_QWORD *)(v48 + 352) = e2fsck_update_progress; v47 = _isoc99_sscanf(optarg, "%d", v48 + 712); if (v47 != 1) goto LABEL_128; if (*(int *)(v48 + 712) < 0) { *(_QWORD *)(v48 + 352) = 0LL; *(_DWORD *)(v48 + 712) = -*(_DWORD *)(v48 + 712); } if (*(_DWORD *)(v48 + 712)) { fd = dup(*(_DWORD *)(v48 + 712)); if (fd >= 0) { close(fd); } else { v4 = _errno_location(); v5 = error_message(*v4); v6 = *(_DWORD *)(v48 + 712); v7 = gettext("Error validating file descriptor %d: %s\n"); fprintf(stderr, v7, v6, v5); v8 = gettext("Invalid completion information file descriptor"); fatal_error(v48, v8); } } continue; case 'D': v9 = *(_DWORD *)(v48 + 76); BYTE1(v9) |= 4u; *(_DWORD *)(v48 + 76) = v9; continue; case 'E': v50 = optarg; continue; case 'F': v44 = 1; continue; case 'I': v47 = _isoc99_sscanf(optarg, "%d", v48 + 604); if (v47 == 1) continue; goto LABEL_128; case 'L': ++replace_bad_blocks; goto LABEL_47; case 'N': v21 = v48; *(_QWORD *)(v21 + 24) = string_copy(v48, optarg, 0LL); continue; case 'P': v47 = _isoc99_sscanf(optarg, "%d", v48 + 600); if (v47 == 1) continue; goto LABEL_128; case 'V': show_version_only = 1; continue; case 'a': case 'p': if ((*(_DWORD *)(v48 + 76) & 0xC) != 0) goto LABEL_24; goto LABEL_25; case 'b': v47 = _isoc99_sscanf(optarg, "%llu", &v49); *(_QWORD *)(v48 + 88) = v49; if (v47 != 1) { LABEL_128: v40 = optarg; v41 = gettext("\nInvalid non-numeric argument to -%c (\"%s\")\n\n"); fprintf(stderr, v41, v43, v40); exit(1); } v14 = *(_DWORD *)(v48 + 72); BYTE1(v14) |= 1u; *(_DWORD *)(v48 + 72) = v14; continue; case 'c': if (cflag++) { v13 = *(_DWORD *)(v48 + 76); BYTE1(v13) |= 2u; *(_DWORD *)(v48 + 76) = v13; } *(_DWORD *)(v48 + 76) |= 0x40u; continue; case 'd': v19 = *(_DWORD *)(v48 + 76); LOBYTE(v19) = v19 | 0x80; *(_DWORD *)(v48 + 76) = v19; continue; case 'f': v20 = *(_DWORD *)(v48 + 76); BYTE1(v20) |= 1u; *(_DWORD *)(v48 + 76) = v20; continue; case 'j': v16 = v48; *(_QWORD *)(v16 + 624) = blkid_get_devname(*(_QWORD *)(v48 + 136), optarg, 0LL); if (!*(_QWORD *)(v48 + 624)) { v17 = optarg; v18 = gettext("Unable to resolve '%s'"); com_err(*(_QWORD *)(v48 + 8), 0LL, v18, v17); fatal_error(v48, 0LL); } continue; case 'k': ++keep_bad_blocks; continue; case 'l': LABEL_47: if (bad_blocks_file) free(bad_blocks_file); bad_blocks_file = (void *)string_copy(v48, optarg, 0LL); continue; case 'n': if ((*(_DWORD *)(v48 + 76) & 6) != 0) goto LABEL_24; *(_DWORD *)(v48 + 76) |= 8u; break; case 'r': continue; case 't': if ((*(_DWORD *)(v48 + 76) & 0x10) != 0) v11 = *(_DWORD *)(v48 + 76) | 0x20; else v11 = *(_DWORD *)(v48 + 76) | 0x10; *(_DWORD *)(v48 + 76) = v11; continue; case 'v': verbose = 1; continue; case 'y': if ((*(_DWORD *)(v48 + 76) & 0xA) != 0) { LABEL_24: v10 = gettext( "Only one of the options -p/-a, -n or -y may be specified."); fatal_error(v48, v10); LABEL_25: *(_DWORD *)(v48 + 76) |= 2u; } else { *(_DWORD *)(v48 + 76) |= 4u; } break; case 'z': *(_QWORD *)(v48 + 936) = optarg; break; default: usage(v48); } } if (show_version_only) return 0LL; if (a1 - 1 != optind) usage(v48); if ((*(_DWORD *)(v48 + 76) & 8) != 0 && (*(_DWORD *)(v48 + 76) & 0x400) != 0) { v22 = gettext("The -n and -D options are incompatible."); com_err(*(_QWORD *)(v48 + 8), 0LL, "%s", v22); fatal_error(v48, 0LL); } if ((*(_DWORD *)(v48 + 76) & 8) != 0 && cflag) { v23 = gettext("The -n and -c options are incompatible."); com_err(*(_QWORD *)(v48 + 8), 0LL, "%s", v23); fatal_error(v48, 0LL); } if ((*(_DWORD *)(v48 + 76) & 8) != 0 && bad_blocks_file) { v24 = gettext("The -n and -l/-L options are incompatible."); com_err(*(_QWORD *)(v48 + 8), 0LL, "%s", v24); fatal_error(v48, 0LL); } if ((*(_DWORD *)(v48 + 76) & 8) != 0) *(_DWORD *)(v48 + 76) |= 1u; v25 = v48; *(_QWORD *)(v25 + 32) = strchr(a2[optind], 63); if (*(_QWORD *)(v48 + 32)) { v26 = *(_BYTE **)(v48 + 32); *(_QWORD *)(v48 + 32) = v26 + 1; *v26 = 0; } v27 = v48; *(_QWORD *)(v27 + 16) = blkid_get_devname(*(_QWORD *)(v48 + 136), a2[optind], 0LL); if (!*(_QWORD *)(v48 + 16)) { v28 = a2[optind]; v29 = gettext("Unable to resolve '%s'"); com_err(*(_QWORD *)(v48 + 8), 0LL, v29, v28); fatal_error(v48, 0LL); } if (v50) parse_extended_opts(v48, (long)v50); if (getenv("E2FSCK_FIXES_ONLY")) { v30 = *(_DWORD *)(v48 + 76); BYTE1(v30) |= 0x80u; *(_DWORD *)(v48 + 76) = v30; } if ((*(_DWORD *)(v48 + 76) & 0x400) != 0 && (*(_DWORD *)(v48 + 76) & 0x8000) != 0) { v31 = gettext("The -D and -E fixes_only options are incompatible."); com_err(*(_QWORD *)(v48 + 8), 0LL, "%s", v31); fatal_error(v48, 0LL); } if ((*(_DWORD *)(v48 + 76) & 0x4000) != 0 && (*(_DWORD *)(v48 + 76) & 0x8000) != 0) { v32 = gettext("The -E bmap2extent and fixes_only options are incompatible."); com_err(*(_QWORD *)(v48 + 8), 0LL, "%s", v32); fatal_error(v48, 0LL); } v53 = getenv("E2FSCK_CONFIG"); if (v53) config_fn = v53; profile_set_syntax_err_cb(syntax_err_report); profile_init(&config_fn, v48 + 864); profile_get_boolean(*(_QWORD *)(v48 + 864), "options", "report_time", 0LL, 0LL, &v43); if (v43) *(_DWORD *)(v48 + 76) |= 0x30u; profile_get_boolean(*(_QWORD *)(v48 + 864), "options", "report_verbose", 0LL, 0LL, &v43); if (v43) verbose = 1; profile_get_boolean(*(_QWORD *)(v48 + 864), "options", "no_optimize_extents", 0LL, 0LL, &v43); if (v43) *(_DWORD *)(v48 + 76) |= 0x10000u; profile_get_boolean(*(_QWORD *)(v48 + 864), "options", "inode_count_fullmap", 0LL, 0LL, &v43); if (v43) *(_DWORD *)(v48 + 76) |= 0x20000u; if (*(_QWORD *)(v48 + 920) == -1LL) { profile_get_integer(*(_QWORD *)(v48 + 864), "options", "readahead_mem_pct", 0LL, 0xFFFFFFFFLL, &v43); if (v43 <= 0x64) *(_QWORD *)(v48 + 920) = v52 * (int)v43 / 0x64; profile_get_integer(*(_QWORD *)(v48 + 864), "options", "readahead_kb", 0LL, 0xFFFFFFFFLL, &v43); if ((v43 & 0x80000000) == 0) *(_QWORD *)(v48 + 920) = (int)v43; if (*(_QWORD *)(v48 + 920) != -1LL && v52 < *(_QWORD *)(v48 + 920)) *(_QWORD *)(v48 + 920) = v52; } if ((*(_DWORD *)(v48 + 76) & 8) != 0 && (*(_DWORD *)(v48 + 76) & 0x2000) != 0) { v33 = *(_DWORD *)(v48 + 76); BYTE1(v33) &= ~0x20u; *(_DWORD *)(v48 + 76) = v33; } if (v44) { fd = open(*(const char **)(v48 + 16), 0, 0LL); if (fd < 0) { v34 = *(_QWORD *)(v48 + 16); v35 = gettext("while opening %s for flushing"); v36 = _errno_location(); com_err("open", *v36, v35, v34); fatal_error(v48, 0LL); } v51 = ext2fs_sync_device((unsigned int)fd, 1LL); if (v51) { v37 = *(_QWORD *)(v48 + 16); v38 = gettext("while trying to flush %s"); com_err("ext2fs_sync_device", v51, v38, v37); fatal_error(v48, 0LL); } close(fd); } if (cflag && bad_blocks_file) { v39 = gettext("The -c and the -l/-L options may not be both used at the " "same time.\n"); fprintf(stderr, "%s", v39); exit(16); } memset(&s, 0, sizeof(s)); s.sa_handler = (__sighandler_t)signal_cancel; sigaction(2, &s, 0LL); sigaction(15, &s, 0LL); s.sa_flags = 0x10000000; s.sa_handler = (__sighandler_t)signal_progress_on; sigaction(10, &s, 0LL); s.sa_handler = (__sighandler_t)signal_progress_off; sigaction(12, &s, 0LL); if (cflag) { src = getenv("PATH"); v45 = 12; if (src) v45 += strlen(src); dest = (char *)malloc(v45); if (!dest) fatal_error(v48, "Couldn't malloc() newpath"); strcpy(dest, "PATH=/sbin"); if (src) { strcat(dest, ":"); strcat(dest, src); } putenv(dest); } return 0LL; }
e2fsprogs-1.46.5
ida
void xalloc_die() { fprintf(stderr, "\n%s: memory_exhausted\n", program_name); abort_gzip(); }
long long xalloc_die() { char v0; unsigned long long v1; unsigned int v2; unsigned long long v3; unsigned long long v4; unsigned long long v5; unsigned long long v6; unsigned long long v7; v2 = program_name; fprintf(stderr, "\n%s: memory_exhausted\n", program_name); abort_gzip(v3, "\n%s: memory_exhausted\n", v4, v5, v6, v7, *(&v0), v1); }
gzip-1.12
angr_phoenix
static _Bool parse_mmin(const struct parser_table *entry, char **argv, int *arg_ptr) { return do_parse_xmin(entry, argv, arg_ptr, XVAL_MTIME); }
long long parse_mmin(unsigned long long a0, unsigned long long a1, unsigned long long a2) { return do_parse_xmin(a0, a1, a2, 0x3); }
findutils
angr_sailr
static void dump_cfg_fmtint(ServerOpCodes code, int val) { printf("%s %s\n", lookup_opcode_name(code), fmt_intarg(code, val)); }
void dump_cfg_fmtint(unsigned long a0, unsigned long a1) { unsigned long long v1; v1 = printf("%s %s\n", lookup_opcode_name(a0), fmt_intarg(a0, a1)); return; }
openssh-portable
angr_phoenix
static void zaptemp(char const *name) { struct tempnode *volatile *pnode; struct tempnode *node; struct tempnode *next; int unlink_status; int unlink_errno = 0; struct cs_status cs; for (pnode = &temphead; (node = *pnode)->name != name; pnode = &node->next) continue; if (node->state == UNREAPED) wait_proc(node->pid); next = node->next; cs_enter(&cs); unlink_status = unlink(name); unlink_errno = (*__errno_location()); *pnode = next; cs_leave(&cs); if (unlink_status != 0) error(0, unlink_errno, gettext("warning: cannot remove: %s"), quotearg_n_style_colon(0, shell_escape_quoting_style, name)); if (!next) temptail = pnode; free(node); }
void zaptemp(char *a0) { unsigned int v0; unsigned int v1; unsigned long long v2; struct_0 *v3; unsigned long v4; char v5; char v6; unsigned long long v8; unsigned long long *v9; unsigned long long v10; v0 = 0; v2 = &temphead; while (true) { v3 = *(v2); if (a0 == v3 + 1) break; v2 = v3; } if (v3->field_c == 1) wait_proc(v3->field_8); v4 = v3->field_0; cs_enter(&v5); v1 = unlink(a0); v0 = *(__errno_location()); *(v2) = v4; cs_leave(&v5); if (v1) { v8 = quotearg_n_style_colon(0x0, 0x3, a0); error(0x0, v0, gettext("warning: cannot remove: %s")); } if (!v4) temptail = v2; free(v3); v10 = *(&v6) ^ v9[5]; return; }
coreutils
angr_phoenix
static int handle_to_string(int handle, u_char **stringp, int *hlenp) { if (stringp == ((void *)0) || hlenp == ((void *)0)) return -1; *stringp = xmalloc(sizeof(int32_t)); put_u32(*stringp, handle); *hlenp = sizeof(int32_t); return 0; }
long handle_to_string(unsigned int a1, _QWORD *a2, _DWORD *a3) { if (!a2 || !a3) return 0xFFFFFFFFLL; *a2 = xmalloc(4LL); put_u32(*a2, a1); *a3 = 4; return 0LL; }
openssh-portable
ida
static int conalloc(char *iname, char *oname, int keytype) { char *namebase, *name, *namelist; int s; namebase = namelist = xstrdup(iname); do { name = xstrsep(&namelist, ","); if (!name) { free(namebase); return (-1); } } while ((s = tcpconnect(name)) < 0); if (s >= maxfd) sshfatal("ssh-keyscan.c", __func__, 403, 0, SYSLOG_LEVEL_FATAL, ((void *)0), "conalloc: fdno %d too high", s); if (fdcon[s].c_status) sshfatal("ssh-keyscan.c", __func__, 405, 0, SYSLOG_LEVEL_FATAL, ((void *)0), "conalloc: attempt to reuse fdno %d", s); sshlog("ssh-keyscan.c", __func__, 407, 1, SYSLOG_LEVEL_DEBUG3, ((void *)0), "oname %s kt %d", oname, keytype); fdcon[s].c_fd = s; fdcon[s].c_status = 1; fdcon[s].c_namebase = namebase; fdcon[s].c_name = name; fdcon[s].c_namelist = namelist; fdcon[s].c_output_name = xstrdup(oname); fdcon[s].c_data = (char *)&fdcon[s].c_plen; fdcon[s].c_len = 4; fdcon[s].c_off = 0; fdcon[s].c_keytype = keytype; monotime_ts(&fdcon[s].c_ts); fdcon[s].c_ts.tv_sec += timeout; do { (&fdcon[s])->c_link.tqe_next = ((void *)0); (&fdcon[s])->c_link.tqe_prev = (&tq)->tqh_last; *(&tq)->tqh_last = (&fdcon[s]); (&tq)->tqh_last = &(&fdcon[s])->c_link.tqe_next; } while (0); read_wait[s].fd = s; read_wait[s].events = 0x001; ncon++; return (s); }
int conalloc(unsigned long long a0, unsigned long long a1, unsigned long a2) { struct_1 *v0; unsigned int v1; void *v2; void *v3; unsigned long long v4; unsigned int v6; v2 = xstrdup(a0); v3 = v2; while (true) { v4 = xstrsep(&v2, ","); if (!v4) { free(v3); v6 = -1; break; } else { v1 = tcpconnect(v4); if (v1 < 0) continue; if (v1 >= 3850979413) { v0 = v1; sshfatal("ssh-keyscan.c", "conalloc", 0x193, 0x0, 0x1, 0x0, "conalloc: fdno %d too high"); } else if (*(((v1 * 7 << 4) + 7267821926853935944))) { v0 = v1; sshfatal("ssh-keyscan.c", "conalloc", 0x195, 0x0, 0x1, 0x0, "conalloc: attempt to reuse fdno %d"); } else { sshlog("ssh-keyscan.c", "conalloc", 0x197, 0x1, 0x7, 0x0, "oname %s kt %d", a1); *((7267821926853935944 + v1 * 112 + 4)) = v1; *((v1 * 112 + 7267821926853935944)) = 1; *((7267821926853935944 + v1 * 112 + 32)) = v3; *((7267821926853935944 + v1 * 112 + 40)) = v4; *((7267821926853935944 + v1 * 112 + 48)) = v2; *((7267821926853935944 + v1 * 112 + 56)) = xstrdup(a1); *((v1 * 112 + 7267821926853936008)) = 7267821926853935944 + v1 * 112 + 8; *((v1 * 112 + 7267821926853935956)) = 4; *((v1 * 112 + 7267821926853935960)) = 0; *((7267821926853935944 + v1 * 112 + 20)) = a2; monotime_ts(v1 * 112 + 7267821926853936024, 7267821926853935944 + v1 * 112, v1, 0x64dc7d8930ec8348); *((7267821926853935944 + v1 * 112 + 80)) = __addvdi3(*((v1 * 112 + 7267821926853936024)), timeout, v1, *((v1 * 112 + 7267821926853936024))); *((v1 * 112 + 7267821926853936040)) = 0; *((7267821926853935944 + v1 * 112 + 104)) = &g_8d48c031f8458948; g_8d48c031f8458948 = v1 * 112 + 7267821926853935944; g_400018 = v1 * 112 + 7267821926853936040; *((v1 * 8 + 7267821926853935944)) = v1; *((7267821926853935944 + v1 * 8 + 4)) = 1; ncon = __addvsi3(0x30ec8348e5894855, 0x1, v1 * 8, 0x64dc7d8930ec8348); v6 = v1; break; } } } return v6; }
openssh-portable
angr_dream
static size_t adjust_column(size_t column, char c) { if (!count_bytes) { if (c == '\b') { if (column > 0) column--; } else if (c == '\r') column = 0; else if (c == '\t') column += 8 - column % 8; else column++; } else column++; return column; }
int adjust_column(unsigned long a0, unsigned long a1) { void *v0; v0 = a0; if (!(count_bytes ^ 1)) { v0 += 1; return v0; } switch (a1) { case 8: if (v0) { v0 -= 1; break; } return v0; case 13: v0 = 0; return v0; case 9: v0 = (v0 & -8) + 8; return v0; default: v0 += 1; return v0; } }
coreutils
angr_sailr
static void parse_repeat_count(int argnum, struct control *p, char *str) { char *end; end = str + strlen(str) - 1; if (*end != '}')
void parse_repeat_count(unsigned long a0, struct_0 *a1, struct_1 *a2) { char v0; char *v1; char v2; unsigned long long v4; unsigned long long *v5; unsigned long long v6; unsigned long long v7; v1 = &(&a2->field_1)[strlen(a2)]; if (*(v1) != 125) { v4 = quote(a2); error(0x1, 0x0, gettext("%s: '}' is required in repeat count")); }
coreutils
angr_sailr
inline int priv_set_restore_linkdir(void) { return -1; }
void priv_set_restore_linkdir(void) { halt_baddata(); }
tar
ghidra
int ifdown(void) { char ifr_buf[sizeof(struct ifreq) * 64]; char *ifr_end; struct ifconf ifc; int fd; int shaper; if ((fd = socket(2, SOCK_DGRAM, 0)) < 0) { fprintf(stderr, "ifdown: "); perror("socket"); return -1; } ifc.ifc_len = sizeof(ifr_buf); ifc.ifc_ifcu.ifcu_buf = ifr_buf; if (ioctl(fd, 0x8912, &ifc) < 0) { fprintf(stderr, "ifdown: "); perror("SIOCGIFCONF"); close(fd); return -1; } ifr_end = ifr_buf + ifc.ifc_len; for (shaper = 1; shaper >= 0; shaper--) { char *ifr_next = ifr_buf; while (ifr_next < ifr_end) { struct ifreq *ifr; int flags; ifr = (struct ifreq *)ifr_next; ifr_next += sizeof(struct ifreq); if ((strncmp(ifr->ifr_ifrn.ifrn_name, "shaper", 6) == 0) != shaper) continue; if (strncmp(ifr->ifr_ifrn.ifrn_name, "lo", 2) == 0) continue; if (strchr(ifr->ifr_ifrn.ifrn_name, ':') != ((void *)0)) continue; if (ioctl(fd, 0x8913, ifr) < 0) { fprintf(stderr, "ifdown: shutdown "); perror(ifr->ifr_ifrn.ifrn_name); continue; } flags = ifr->ifr_ifru.ifru_flags; if (flags & IFF_UP) { flags &= ~(IFF_UP); ifr->ifr_ifru.ifru_flags = flags; if (ioctl(fd, 0x8914, ifr) < 0) { fprintf(stderr, "ifdown: shutdown "); perror(ifr->ifr_ifrn.ifrn_name); } } } } close(fd); return 0; }
undefined8 ifdown(void) { char *pcVar1; int __fd; int iVar2; undefined8 uVar3; long lVar4; char *pcVar5; long in_FS_OFFSET; uint local_a4c; char *local_a40; int local_a28[2]; char *local_a20; char local_a18[2568]; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); __fd = socket(2, 2, 0); if (__fd < 0) { fprintf(stderr, "ifdown: "); perror("socket"); uVar3 = 0xffffffff; } else { local_a28[0] = 0xa00; local_a20 = local_a18; iVar2 = ioctl(__fd, 0x8912, local_a28); if (iVar2 < 0) { fprintf(stderr, "ifdown: "); perror("SIOCGIFCONF"); close(__fd); uVar3 = 0xffffffff; } else { lVar4 = (long)local_a28[0]; for (local_a4c = 1; -1 < (int)local_a4c; local_a4c = local_a4c - 1) { pcVar1 = local_a18; while (local_a40 = pcVar1, local_a40 < local_a18 + lVar4) { pcVar1 = local_a40 + 0x28; iVar2 = strncmp(local_a40, "shaper", 6); if (((local_a4c == (iVar2 == 0)) && (iVar2 = strncmp(local_a40, "lo", 2), iVar2 != 0)) && (pcVar5 = strchr(local_a40, 0x3a), pcVar5 == (char *)0x0)) { iVar2 = ioctl(__fd, 0x8913, local_a40); if (iVar2 < 0) { fprintf(stderr, "ifdown: shutdown "); perror(local_a40); } else if ((*(ushort *)(local_a40 + 0x10) & 1) != 0) { *(ushort *)(local_a40 + 0x10) = *(ushort *)(local_a40 + 0x10) & 0xfffe; iVar2 = ioctl(__fd, 0x8914, local_a40); if (iVar2 < 0) { fprintf(stderr, "ifdown: shutdown "); perror(local_a40); } } } } } close(__fd); uVar3 = 0; } } if (local_10 == *(long *)(in_FS_OFFSET + 0x28)) { return uVar3; } __stack_chk_fail(); }
sysvinit
ghidra
static int sshsig_peek_hashalg(struct sshbuf *signature, char **hashalgp) { struct sshbuf *buf = ((void *)0); char *hashalg = ((void *)0); int r = -1; if (hashalgp != ((void *)0)) *hashalgp = ((void *)0); if ((buf = sshbuf_fromb(signature)) == ((void *)0)) return -2; if ((r = sshsig_parse_preamble(buf)) != 0) goto done; if ((r = sshbuf_get_string_direct(buf, ((void *)0), ((void *)0))) != 0 || (r = sshbuf_get_string_direct(buf, ((void *)0), ((void *)0))) != 0 || (r = sshbuf_get_string(buf, ((void *)0), ((void *)0))) != 0 || (r = sshbuf_get_cstring(buf, &hashalg, ((void *)0))) != 0 || (r = sshbuf_get_string_direct(buf, ((void *)0), ((void *)0))) != 0) { sshlog("sshsig.c", __func__, 274, 1, SYSLOG_LEVEL_ERROR, ssh_err(r), "parse signature object"); goto done; } r = 0; *hashalgp = hashalg; hashalg = ((void *)0); done: free(hashalg); sshbuf_free(buf); return r; }
int sshsig_peek_hashalg(unsigned long long a0, unsigned long long *a1) { unsigned long long v0; unsigned int v1; void *v2; void *v3; unsigned int v5; v3 = 0; v2 = 0; v1 = -1; if (a1) *(a1) = 0; v3 = sshbuf_fromb(a0); if (!v3) { v5 = -2; } else { v1 = sshsig_parse_preamble(v3); if (!v1) { v1 = sshbuf_get_string_direct(v3, 0x0, 0x0); if (v1) { LABEL_400d6b: v0 = "parse signature object"; sshlog("sshsig.c", "sshsig_peek_hashalg", 0x112, 0x1, 0x2, ssh_err(v1)); } else { v1 = sshbuf_get_string_direct(v3, 0x0, 0x0); if (!(!v1)) goto LABEL_400d6b; v1 = sshbuf_get_string(v3, 0x0, 0x0); if (!(!v1)) goto LABEL_400d6b; v1 = sshbuf_get_cstring(v3, &v2, 0x0, &v2); if (!(!v1)) goto LABEL_400d6b; v1 = sshbuf_get_string_direct(v3, 0x0, 0x0); if (!(!v1)) goto LABEL_400d6b; v1 = 0; *(a1) = v2; v2 = 0; } } free(v2); sshbuf_free(v3); v5 = v1; } return v5; }
openssh-portable
angr_phoenix