input stringlengths 26 172k | output stringlengths 18 318k | repo_name stringclasses 23 values | decompiler stringclasses 5 values |
|---|---|---|---|
static int add_nh_group_attr(struct nlmsghdr *n, int maxlen, char *argv) {
struct nexthop_grp *grps = ((void *)0);
int count = 0, i;
int err = -1;
char *sep, *wsep;
if (*argv != '\0')
count = 1;
sep = strchr(argv, '/');
while (sep) {
count++;
sep = strchr(sep + 1, '/');
}
if (count == 0)
goto out;
grps = calloc(count, sizeof(*grps));
if (!grps)
goto out;
for (i = 0; i < count; ++i) {
sep = strchr(argv, '/');
if (sep)
*sep = '\0';
wsep = strchr(argv, ',');
if (wsep)
*wsep = '\0';
if (get_unsigned(&grps[i].id, argv, 0))
goto out;
if (wsep) {
unsigned int w;
wsep++;
if (get_unsigned(&w, wsep, 0) || w == 0 || w > 256)
invarg("\"weight\" is invalid\n", wsep);
grps[i].weight = w - 1;
}
if (!sep)
break;
argv = sep + 1;
}
err = addattr_l(n, maxlen, NHA_GROUP, grps, count * sizeof(*grps));
out:
free(grps);
return err;
} | long add_nh_group_attr(long a1, unsigned int a2, char *a3) {
char *s;
unsigned int v5;
int v6;
int j;
unsigned int v8;
void *ptr;
char *i;
char *v11;
unsigned long v12;
s = a3;
v12 = __readfsqword(0x28u);
ptr = 0LL;
v8 = -1;
v6 = *a3 != 0;
for (i = strchr(a3, 47); i; i = strchr(i + 1, 47))
++v6;
if (v6) {
ptr = calloc(v6, 8uLL);
if (ptr) {
for (j = 0; j < v6; ++j) {
i = strchr(s, 47);
if (i)
*i = 0;
v11 = strchr(s, 44);
if (v11)
*v11 = 0;
if ((unsigned int)get_unsigned((char *)ptr + 8 * j, s, 0LL))
goto LABEL_22;
if (v11) {
if ((unsigned int)get_unsigned(&v5, ++v11, 0LL) || !v5 || v5 > 0x100)
invarg("\"weight\" is invalid\n", v11);
*((_BYTE *)ptr + 8 * j + 4) = v5 - 1;
}
if (!i)
break;
s = i + 1;
}
v8 = addattr_l(a1, a2, 2LL, ptr, (unsigned int)(8 * v6));
}
}
LABEL_22:
free(ptr);
return v8;
} | iproute2-6.0.0 | ida |
void mux_exit_message(struct ssh *ssh, Channel *c, int exitval) {
struct sshbuf *m;
Channel *mux_chan;
int r;
sshlog("mux.c", __func__, 1218, 1, SYSLOG_LEVEL_DEBUG3, ((void *)0),
"channel %d: exit message, exitval %d", c->self, exitval);
if ((mux_chan = channel_by_id(ssh, c->ctl_chan)) == ((void *)0))
sshfatal("mux.c", __func__, 1221, 1, SYSLOG_LEVEL_FATAL, ((void *)0),
"channel %d missing mux %d", c->self, c->ctl_chan);
if ((m = sshbuf_new()) == ((void *)0))
sshfatal("mux.c", __func__, 1225, 1, SYSLOG_LEVEL_FATAL, ((void *)0),
"sshbuf_new");
if ((r = sshbuf_put_u32(m, 0x80000004)) != 0 ||
(r = sshbuf_put_u32(m, c->self)) != 0 ||
(r = sshbuf_put_u32(m, exitval)) != 0 ||
(r = sshbuf_put_stringb(mux_chan->output, m)) != 0)
sshfatal("mux.c", __func__, 1230, 1, SYSLOG_LEVEL_FATAL, ssh_err(r),
"reply");
sshbuf_free(m);
} | long long mux_exit_message(unsigned long long a0, unsigned int a1[18],
unsigned long long a2) {
unsigned long v0;
unsigned long v1;
unsigned int v2;
struct_0 *v3;
unsigned long long v4;
char v5;
unsigned long long v7;
v1 = a2;
v0 = a1[1];
sshlog("mux.c", "mux_exit_message", 0x4c2, 0x1, 0x7, 0x0,
"channel %d: exit message, exitval %d");
v3 = channel_by_id(a0, a1[17], a1[17]);
if (!v3) {
v1 = a1[17];
v0 = a1[1];
sshfatal("mux.c", "mux_exit_message", 0x4c5, 0x1, 0x1, 0x0,
"channel %d missing mux %d");
}
v4 = sshbuf_new(a0, a1, a2, 0x1, v7, 0x0);
if (!v4) {
v4 = "sshbuf_new";
sshfatal("mux.c", "mux_exit_message", 0x4c9, 0x1, 0x1, 0x0, *(&v5));
}
v2 = sshbuf_put_u32(v4, 0x80000004);
if (!v2) {
v2 = sshbuf_put_u32(v4, a1[1]);
if (!v2) {
v2 = sshbuf_put_u32(v4, a2);
if (!v2) {
v2 = sshbuf_put_stringb(v3->field_70, v4, v4);
if (!v2)
return sshbuf_free(v4);
}
}
}
v4 = "reply";
sshfatal("mux.c", "mux_exit_message", 0x4ce, 0x1, 0x1, ssh_err(v2), *(&v5));
return sshbuf_free(v4);
} | openssh-portable | angr_sailr |
void mm_log_handler(LogLevel level, int forced, const char *msg, void *ctx) {
struct sshbuf *log_msg;
struct monitor *mon = (struct monitor *)ctx;
int r;
size_t len;
if (mon->m_log_sendfd == -1)
sshfatal("monitor_wrap.c", __func__, 93, 1, SYSLOG_LEVEL_FATAL, ((void *)0),
"no log channel");
if ((log_msg = sshbuf_new()) == ((void *)0))
sshfatal("monitor_wrap.c", __func__, 96, 1, SYSLOG_LEVEL_FATAL, ((void *)0),
"sshbuf_new failed");
if ((r = sshbuf_put_u32(log_msg, 0)) != 0 ||
(r = sshbuf_put_u32(log_msg, level)) != 0 ||
(r = sshbuf_put_u32(log_msg, forced)) != 0 ||
(r = sshbuf_put_cstring(log_msg, msg)) != 0)
sshfatal("monitor_wrap.c", __func__, 102, 1, SYSLOG_LEVEL_FATAL, ssh_err(r),
"assemble");
if ((len = sshbuf_len(log_msg)) < 4 || len > 0xffffffff)
sshfatal("monitor_wrap.c", __func__, 104, 1, SYSLOG_LEVEL_FATAL,
((void *)0), "bad length %zu", len);
do {
const u_int32_t __v = (len - 4);
((u_char *)(sshbuf_mutable_ptr(log_msg)))[0] = (__v >> 24) & 0xff;
((u_char *)(sshbuf_mutable_ptr(log_msg)))[1] = (__v >> 16) & 0xff;
((u_char *)(sshbuf_mutable_ptr(log_msg)))[2] = (__v >> 8) & 0xff;
((u_char *)(sshbuf_mutable_ptr(log_msg)))[3] = __v & 0xff;
} while (0);
if (atomicio((ssize_t (*)(int, void *, size_t))write, mon->m_log_sendfd,
sshbuf_mutable_ptr(log_msg), len) != len)
sshfatal("monitor_wrap.c", __func__, 108, 1, SYSLOG_LEVEL_FATAL,
((void *)0), "write: %s", strerror((*__errno_location())));
sshbuf_free(log_msg);
} | long mm_log_handler(unsigned int a1, unsigned int a2, long a3, long a4) {
long v4;
long v5;
int *v6;
char *v7;
unsigned int v10;
long v12;
unsigned long v13;
if (*(_DWORD *)(a4 + 12) == -1)
sshfatal("monitor_wrap.c", "mm_log_handler", 93LL, 1LL, 1LL, 0LL,
"no log channel");
v12 = sshbuf_new();
if (!v12)
sshfatal("monitor_wrap.c", "mm_log_handler", 96LL, 1LL, 1LL, 0LL,
"sshbuf_new failed");
v10 = sshbuf_put_u32(v12, 0LL);
if (v10 || (v10 = sshbuf_put_u32(v12, a1)) != 0 ||
(v10 = sshbuf_put_u32(v12, a2)) != 0 ||
(v10 = sshbuf_put_cstring(v12, a3)) != 0) {
v4 = ssh_err(v10);
sshfatal("monitor_wrap.c", "mm_log_handler", 102LL, 1LL, 1LL, v4,
"assemble");
}
v13 = sshbuf_len(v12);
if (v13 <= 3 || v13 > 0xFFFFFFFF)
sshfatal("monitor_wrap.c", "mm_log_handler", 104LL, 1LL, 1LL, 0LL,
"bad length %zu", v13);
*(_BYTE *)sshbuf_mutable_ptr(v12) = (unsigned int)(v13 - 4) >> 24;
*(_BYTE *)(sshbuf_mutable_ptr(v12) + 1) = (unsigned int)(v13 - 4) >> 16;
*(_BYTE *)(sshbuf_mutable_ptr(v12) + 2) = (unsigned short)(v13 - 4) >> 8;
*(_BYTE *)(sshbuf_mutable_ptr(v12) + 3) = v13 - 4;
v5 = sshbuf_mutable_ptr(v12);
if (v13 != atomicio(&write, *(unsigned int *)(a4 + 12), v5, v13)) {
v6 = _errno_location();
v7 = strerror(*v6);
sshfatal("monitor_wrap.c", "mm_log_handler", 108LL, 1LL, 1LL, 0LL,
"write: %s", v7);
}
return sshbuf_free(v12);
} | openssh-portable | ida |
void destroy_encryption_policy_map(e2fsck_t ctx) {
struct encrypted_file_info *info = ctx->encrypted_files;
if (info) {
struct rb_root *policies = &info->policies;
while (!ext2fs_rb_empty_root(policies)) {
struct policy_map_entry *entry;
entry = ({
__typeof__(((struct policy_map_entry *)0)->node) *__mptr =
(policies->rb_node);
(struct policy_map_entry *)((char *)__mptr -
__builtin_offsetof(struct policy_map_entry,
node));
});
ext2fs_rb_erase(&entry->node, policies);
ext2fs_free_mem(&entry);
}
info->next_policy_id = 0;
}
} | void destroy_encryption_policy_map(struct_0 *a0) {
unsigned long v0;
struct_1 *v1;
unsigned long long *v2;
unsigned long v3;
char v4;
unsigned long long *v7;
unsigned long long v8;
v1 = a0->field_250;
if (v1) {
v2 = &v1->padding_0[24];
while (true) {
if (ext2fs_rb_empty_root(v2))
break;
v3 = *(v2);
v0 = v3 - 32;
ext2fs_rb_erase(v0 + 32, v2, v0 + 32);
ext2fs_free_mem(&v0);
}
v1->field_20 = 0;
}
v8 = *(&v4) ^ v7[5];
return;
} | e2fsprogs-1.46.5 | angr_dream |
char *readline(const char *p) {
HistEvent ev;
const char *volatile prompt = p;
int count;
const char *ret;
char *buf;
static int used_event_hook;
if (e == ((void *)0) || h == ((void *)0))
rl_initialize();
if (rl_startup_hook) {
(*rl_startup_hook)();
}
tty_init(e);
rl_done = 0;
(void)_setjmp(topbuf);
buf = ((void *)0);
if (rl_set_prompt(prompt) == -1)
goto out;
if (rl_pre_input_hook)
(*rl_pre_input_hook)();
if (rl_event_hook && !(e->el_flags & 0x002)) {
el_set(e, 13, _rl_event_read_char);
used_event_hook = 1;
}
if (!rl_event_hook && used_event_hook) {
el_set(e, 13, (((void *)0)));
used_event_hook = 0;
}
rl_already_prompted = 0;
ret = el_gets(e, &count);
if (ret && count > 0) {
int lastidx;
buf = strdup(ret);
if (buf == ((void *)0))
goto out;
lastidx = count - 1;
if (buf[lastidx] == '\n')
buf[lastidx] = '\0';
} else
buf = ((void *)0);
history(h, &ev, 2);
history_length = ev.num;
out:
tty_end(e, 1);
return buf;
} | char *readline(undefined8 param_1)
{
int iVar1;
long in_FS_OFFSET;
int local_48;
int local_44;
undefined8 local_40;
char *local_38;
char *local_30;
undefined local_28[24];
long local_10;
local_10 = *(long *)(in_FS_OFFSET + 0x28);
local_40 = param_1;
if ((e == 0) || (h == 0)) {
rl_initialize();
}
if (*plRam0000000000100a67 != 0) {
(**ppcRam0000000000100a76)();
}
tty_init(e);
*puRam0000000000100a91 = 0;
_setjmp((__jmp_buf_tag *)topbuf);
local_38 = (char *)0x0;
iVar1 = rl_set_prompt(local_40);
if (iVar1 == -1) {
LAB_00100c22:
tty_end(e, 1);
if (local_10 == *(long *)(in_FS_OFFSET + 0x28)) {
return local_38;
}
__stack_chk_fail();
}
if (*plRam0000000000100acb != 0) {
(**ppcRam0000000000100ada)();
}
if ((*plRam0000000000100ae6 != 0) && ((*(uint *)(e + 0x2c) & 2) == 0)) {
el_set(e, 0xd, _rl_event_read_char);
}
if ((*plRam0000000000100b30 == 0) && (used_event_hook_6550 != 0)) {
el_set(e, 0xd, 0);
}
*puRam0000000000100b71 = 0;
local_30 = (char *)el_gets(e, &local_48);
if ((local_30 == (char *)0x0) || (local_48 < 1)) {
local_38 = (char *)0x0;
} else {
local_38 = strdup(local_30);
if (local_38 == (char *)0x0)
goto LAB_00100c22;
local_44 = local_48 + -1;
if (local_38[local_44] == '\n') {
local_38[local_44] = '\0';
}
}
history(h, local_28, 2);
} | libedit | ghidra |
static int create_tunnel(struct l2tp_parm *p) {
uint32_t local_attr = L2TP_ATTR_IP_SADDR;
uint32_t peer_attr = L2TP_ATTR_IP_DADDR;
struct {
struct nlmsghdr n;
struct genlmsghdr g;
char buf[(((0) + 4U - 1) & ~(4U - 1)) + (1024)];
} req = {
.n =
{
.nlmsg_type = (genl_family),
.nlmsg_flags = (0x01 | 0x04),
.nlmsg_len =
(((((sizeof(struct genlmsghdr)) + 4U - 1) & ~(4U - 1)) +
(0)) +
((int)(((sizeof(struct nlmsghdr)) + 4U - 1) & ~(4U - 1)))),
},
.g =
{
.cmd = (L2TP_CMD_TUNNEL_CREATE),
.version = (0x1),
},
};
addattr32(&req.n, 1024, L2TP_ATTR_CONN_ID, p->tunnel_id);
addattr32(&req.n, 1024, L2TP_ATTR_PEER_CONN_ID, p->peer_tunnel_id);
addattr8(&req.n, 1024, L2TP_ATTR_PROTO_VERSION, 3);
addattr16(&req.n, 1024, L2TP_ATTR_ENCAP_TYPE, p->encap);
if (p->local_ip.family == 10)
local_attr = L2TP_ATTR_IP6_SADDR;
addattr_l(&req.n, 1024, local_attr, &p->local_ip.data, p->local_ip.bytelen);
if (p->peer_ip.family == 10)
peer_attr = L2TP_ATTR_IP6_DADDR;
addattr_l(&req.n, 1024, peer_attr, &p->peer_ip.data, p->peer_ip.bytelen);
if (p->encap == L2TP_ENCAPTYPE_UDP) {
addattr16(&req.n, 1024, L2TP_ATTR_UDP_SPORT, p->local_udp_port);
addattr16(&req.n, 1024, L2TP_ATTR_UDP_DPORT, p->peer_udp_port);
if (p->udp_csum)
addattr8(&req.n, 1024, L2TP_ATTR_UDP_CSUM, 1);
if (!p->udp6_csum_tx)
addattr(&req.n, 1024, L2TP_ATTR_UDP_ZERO_CSUM6_TX);
if (!p->udp6_csum_rx)
addattr(&req.n, 1024, L2TP_ATTR_UDP_ZERO_CSUM6_RX);
}
if (rtnl_talk(&genl_rth, &req.n, ((void *)0)) < 0)
return -2;
return 0;
} | undefined8 create_tunnel(undefined4 *param_1)
{
int iVar1;
undefined8 uVar2;
long lVar3;
undefined8 *puVar4;
long in_FS_OFFSET;
undefined4 local_430;
undefined4 local_42c;
undefined8 local_428;
undefined local_418;
undefined local_417;
long local_10;
local_10 = *(long *)(in_FS_OFFSET + 0x28);
local_430 = 0x18;
local_42c = 0x19;
puVar4 = &local_428;
for (lVar3 = 0x82; lVar3 != 0; lVar3 = lVar3 + -1) {
*puVar4 = 0;
puVar4 = puVar4 + 1;
}
*(undefined4 *)puVar4 = 0;
local_428._0_4_ = 0x14;
local_428._4_2_ = (undefined2)genl_family;
local_428._6_2_ = 5;
local_418 = 1;
local_417 = 1;
addattr32(&local_428, 0x400, 9, *param_1);
addattr32(&local_428, 0x400, 10, param_1[1]);
addattr8(&local_428, 0x400, 7, 3);
addattr16(&local_428, 0x400, 2, param_1[4] & 0xffff);
if (*(short *)((long)param_1 + 0x36) == 10) {
local_430 = 0x1f;
}
addattr_l(&local_428, 0x400, local_430, param_1 + 0xe,
*(undefined2 *)((long)param_1 + 0x32));
if (*(short *)((long)param_1 + 0x13e) == 10) {
local_42c = 0x20;
}
addattr_l(&local_428, 0x400, local_42c, param_1 + 0x50,
*(undefined2 *)((long)param_1 + 0x13a));
if (param_1[4] == 0) {
addattr16(&local_428, 0x400, 0x1a, *(undefined2 *)(param_1 + 5));
addattr16(&local_428, 0x400, 0x1b, *(undefined2 *)((long)param_1 + 0x16));
if ((*(byte *)((long)param_1 + 0x242) & 4) != 0) {
addattr8(&local_428, 0x400, 0xd, 1);
}
if ((*(byte *)((long)param_1 + 0x242) & 1) == 0) {
addattr(&local_428, 0x400, 0x21);
}
if ((*(byte *)((long)param_1 + 0x242) & 2) == 0) {
addattr(&local_428, 0x400, 0x22);
}
}
iVar1 = rtnl_talk(genl_rth, &local_428, 0);
if (iVar1 < 0) {
uVar2 = 0xfffffffe;
} else {
uVar2 = 0;
}
if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) {
__stack_chk_fail();
}
return uVar2;
} | iproute2-6.0.0 | ghidra |
int main(int argc, char **argv) {
enum header_mode header_mode = multiple_files;
_Bool ok = 1;
uintmax_t n_units = 10;
size_t n_files;
char **file;
struct File_spec *F;
size_t i;
_Bool obsolete_option;
double sleep_interval = 1.0;
;
set_program_name(argv[0]);
setlocale(6, "");
bindtextdomain("coreutils", "/usr/local/share/locale");
textdomain("coreutils");
atexit(close_stdout);
have_read_stdin = 0;
count_lines = 1;
forever = from_start = print_headers = 0;
line_end = '\n';
obsolete_option = parse_obsolete_option(argc, argv, &n_units);
argc -= obsolete_option;
argv += obsolete_option;
parse_options(argc, argv, &n_units, &header_mode, &sleep_interval);
if (from_start) {
if (n_units)
--n_units;
}
if (optind < argc) {
n_files = argc - optind;
file = argv + optind;
} else {
static char *dummy_stdin = (char *)"-";
n_files = 1;
file = &dummy_stdin;
}
{
_Bool found_hyphen = 0;
for (i = 0; i < n_files; i++)
if ((strcmp(file[i], "-") == 0))
found_hyphen = 1;
if (found_hyphen && follow_mode == Follow_name)
((!!sizeof(struct {
_Static_assert(1,
"verify_expr ("
"1"
", "
"(error (1, 0, gettext (\"cannot follow %s by name\"), "
"quotearg_style (shell_escape_always_quoting_style, "
"\"-\")), assume (false))"
")");
int _gl_dummy;
}))
? ((error(1, 0, gettext("cannot follow %s by name"),
quotearg_style(shell_escape_always_quoting_style, "-")),
((0) ? (void)0 : __builtin_unreachable())))
: ((error(1, 0, gettext("cannot follow %s by name"),
quotearg_style(shell_escape_always_quoting_style, "-")),
((0) ? (void)0 : __builtin_unreachable()))));
if (forever && found_hyphen) {
struct stat in_stat;
_Bool blocking_stdin;
blocking_stdin = (pid == 0 && follow_mode == Follow_descriptor &&
n_files == 1 && !fstat(0, &in_stat) &&
!((((in_stat.st_mode)) & 0170000) == (0100000)));
if (!blocking_stdin && isatty(0))
error(0, 0,
gettext("warning: following standard input"
" indefinitely is ineffective"));
}
}
if (!n_units && !forever && !from_start)
return 0;
F = xnmalloc(n_files, sizeof *F);
for (i = 0; i < n_files; i++)
F[i].name = file[i];
if (header_mode == always || (header_mode == multiple_files && n_files > 1))
print_headers = 1;
xset_binary_mode(1, 0);
for (i = 0; i < n_files; i++)
ok &= tail_file(&F[i], n_units);
if (forever && ignore_fifo_and_pipe(F, n_files)) {
struct stat out_stat;
if (fstat(1, &out_stat) < 0)
((!!sizeof(struct {
_Static_assert(1, "verify_expr ("
"1"
", "
"(error (1, (*__errno_location ()), gettext "
"(\"standard output\")), assume (false))"
")");
int _gl_dummy;
}))
? ((error(1, (*__errno_location()), gettext("standard output")),
((0) ? (void)0 : __builtin_unreachable())))
: ((error(1, (*__errno_location()), gettext("standard output")),
((0) ? (void)0 : __builtin_unreachable()))));
monitor_output = (((((out_stat.st_mode)) & 0170000) == (0010000))
|| (1 != 1 && isapipe(1)));
if (!disable_inotify &&
(tailable_stdin(F, n_files) || any_remote_file(F, n_files) ||
!any_non_remote_file(F, n_files) || any_symlinks(F, n_files) ||
any_non_regular_fifo(F, n_files) ||
(!ok && follow_mode == Follow_descriptor)))
disable_inotify = 1;
if (!disable_inotify) {
int wd = inotify_init();
if (0 <= wd) {
if (fflush_unlocked(stdout) != 0)
((!!sizeof(struct {
_Static_assert(1, "verify_expr ("
"1"
", "
"(error (1, (*__errno_location ()), gettext "
"(\"write error\")), assume (false))"
")");
int _gl_dummy;
}))
? ((error(1, (*__errno_location()), gettext("write error")),
((0) ? (void)0 : __builtin_unreachable())))
: ((error(1, (*__errno_location()), gettext("write error")),
((0) ? (void)0 : __builtin_unreachable()))));
Hash_table *ht;
tail_forever_inotify(wd, F, n_files, sleep_interval, &ht);
hash_free(ht);
close(wd);
(*__errno_location()) = 0;
}
error(0, (*__errno_location()),
gettext("inotify cannot be used, reverting to polling"));
}
disable_inotify = 1;
tail_forever(F, n_files, sleep_interval);
}
if (have_read_stdin && close(0) < 0)
((!!sizeof(struct {
_Static_assert(
1, "verify_expr ("
"1"
", "
"(error (1, (*__errno_location ()), \"-\"), assume (false))"
")");
int _gl_dummy;
}))
? ((error(1, (*__errno_location()), "-"),
((0) ? (void)0 : __builtin_unreachable())))
: ((error(1, (*__errno_location()), "-"),
((0) ? (void)0 : __builtin_unreachable()))));
return ok ? 0 : 1;
} | byte main(int param_1, undefined8 *param_2)
{
byte bVar1;
bool bVar2;
char cVar3;
int iVar4;
undefined8 uVar5;
undefined8 uVar6;
long lVar7;
int *piVar8;
long in_FS_OFFSET;
bool local_fc;
int local_f8;
int local_f4;
long local_f0;
undefined8 local_e8;
undefined local_e0[8];
ulong local_d8;
undefined **local_d0;
ulong local_c8;
long local_c0;
stat local_b8;
long local_20;
local_20 = *(long *)(in_FS_OFFSET + 0x28);
local_f8 = 0;
local_fc = true;
local_f0 = 10;
local_e8 = DAT_00108b60;
set_program_name(*param_2);
setlocale(6, "");
bindtextdomain("coreutils", "/usr/local/share/locale");
textdomain("coreutils");
atexit(p_Ram0000000000106f0b);
have_read_stdin = '\0';
count_lines = 1;
print_headers = 0;
from_start = '\0';
forever = '\0';
line_end = 10;
bVar1 = parse_obsolete_option(param_1, param_2, &local_f0);
param_1 = param_1 - (uint)bVar1;
parse_options(param_1, param_2 + bVar1, &local_f0, &local_f8, &local_e8);
if ((from_start != '\0') && (local_f0 != 0)) {
local_f0 = local_f0 + -1;
}
if (optind < param_1) {
local_d8 = (ulong)(param_1 - optind);
local_d0 = (undefined **)(param_2 + bVar1 + optind);
} else {
local_d8 = 1;
local_d0 = &dummy_stdin_6785;
}
bVar2 = false;
for (local_c8 = 0; local_c8 < local_d8; local_c8 = local_c8 + 1) {
iVar4 = strcmp(local_d0[local_c8], "-");
if (iVar4 == 0) {
bVar2 = true;
}
}
if ((bVar2) && (follow_mode == 1)) {
uVar5 = quotearg_style(4, &DAT_001082a2);
uVar6 = gettext("cannot follow %s by name");
error(1, 0, uVar6, uVar5);
}
if ((forever != '\0') && (bVar2)) {
if ((pid == 0) && ((follow_mode == 2 && (local_d8 == 1)))) {
iVar4 = fstat(0, &local_b8);
if ((iVar4 != 0) || ((local_b8.st_mode & 0xf000) == 0x8000))
goto LAB_00107160;
bVar2 = true;
} else {
LAB_00107160:
bVar2 = false;
}
if (!bVar2) {
iVar4 = isatty(0);
if (iVar4 != 0) {
uVar5 = gettext(
"warning: following standard input indefinitely is ineffective");
error(0, 0, uVar5);
}
}
}
if (((local_f0 == 0) && (forever != '\x01')) && (from_start != '\x01')) {
bVar1 = 0;
goto LAB_001075b5;
}
local_c0 = xnmalloc(local_d8, 0x60);
for (local_c8 = 0; local_c8 < local_d8; local_c8 = local_c8 + 1) {
*(undefined **)(local_c8 * 0x60 + local_c0) = local_d0[local_c8];
}
if ((local_f8 == 1) || ((local_f8 == 0 && (1 < local_d8)))) {
print_headers = 1;
}
xset_binary_mode(1, 0);
for (local_c8 = 0; local_c8 < local_d8; local_c8 = local_c8 + 1) {
bVar1 = tail_file(local_c0 + local_c8 * 0x60, local_f0);
local_fc = (bVar1 & local_fc) != 0;
}
if (forever != '\0') {
lVar7 = ignore_fifo_and_pipe(local_c0, local_d8);
if (lVar7 != 0) {
iVar4 = fstat(1, &local_b8);
if (iVar4 < 0) {
uVar5 = gettext("standard output");
piVar8 = __errno_location();
error(1, *piVar8, uVar5);
}
monitor_output = (local_b8.st_mode & 0xf000) == 0x1000;
if (disable_inotify != '\x01') {
cVar3 = tailable_stdin(local_c0, local_d8);
if (cVar3 == '\0') {
cVar3 = any_remote_file(local_c0, local_d8);
if (cVar3 == '\0') {
cVar3 = any_non_remote_file(local_c0, local_d8);
if (cVar3 == '\x01') {
cVar3 = any_symlinks(local_c0, local_d8);
if (cVar3 == '\0') {
cVar3 = any_non_regular_fifo(local_c0, local_d8);
if ((cVar3 == '\0') &&
((local_fc == true || (follow_mode != 2))))
goto LAB_0010745e;
}
}
}
}
disable_inotify = '\x01';
}
LAB_0010745e:
if (disable_inotify != '\x01') {
local_f4 = inotify_init();
if (-1 < local_f4) {
iVar4 = fflush_unlocked(stdout);
if (iVar4 != 0) {
uVar5 = gettext("write error");
piVar8 = __errno_location();
error(1, *piVar8, uVar5);
}
tail_forever_inotify(local_e8, local_f4, local_c0, local_d8,
local_e0);
hash_free();
close(local_f4);
piVar8 = __errno_location();
*piVar8 = 0;
}
uVar5 = gettext("inotify cannot be used, reverting to polling");
piVar8 = __errno_location();
error(0, *piVar8, uVar5);
}
disable_inotify = '\x01';
tail_forever(local_e8, local_c0, local_d8);
}
}
if (have_read_stdin != '\0') {
iVar4 = close(0);
if (iVar4 < 0) {
piVar8 = __errno_location();
error(1, *piVar8, &DAT_001082a2);
}
}
bVar1 = local_fc ^ 1;
LAB_001075b5:
if (local_20 != *(long *)(in_FS_OFFSET + 0x28)) {
__stack_chk_fail();
}
return bVar1;
} | coreutils | ghidra |
int valid_domain(char *name, int makelower, const char **errstr) {
size_t i, l = strlen(name);
u_char c, last = '\0';
static char errbuf[256];
if (l == 0) {
strlcpy(errbuf, "empty domain name", sizeof(errbuf));
goto bad;
}
if (!((*__ctype_b_loc())[(int)(((u_char)name[0]))] &
(unsigned short int)_ISalpha) &&
!((*__ctype_b_loc())[(int)(((u_char)name[0]))] &
(unsigned short int)_ISdigit)) {
snprintf(errbuf, sizeof(errbuf),
"domain name \"%.100s\" "
"starts with invalid character",
name);
goto bad;
}
for (i = 0; i < l; i++) {
c = tolower((u_char)name[i]);
if (makelower)
name[i] = (char)c;
if (last == '.' && c == '.') {
snprintf(errbuf, sizeof(errbuf),
"domain name "
"\"%.100s\" contains consecutive separators",
name);
goto bad;
}
if (c != '.' && c != '-' &&
!((*__ctype_b_loc())[(int)((c))] & (unsigned short int)_ISalnum) &&
c != '_') {
snprintf(errbuf, sizeof(errbuf),
"domain name "
"\"%.100s\" contains invalid characters",
name);
goto bad;
}
last = c;
}
if (name[l - 1] == '.')
name[l - 1] = '\0';
if (errstr != ((void *)0))
*errstr = ((void *)0);
return 1;
bad:
if (errstr != ((void *)0))
*errstr = errbuf;
return 0;
} | int valid_domain(void *a0, unsigned long a1, unsigned long long *a2,
unsigned long long a3) {
char v0;
char v1;
void *v2;
unsigned long v3;
unsigned int v6;
unsigned int v7;
unsigned int v8;
v3 = strlen(a0);
v0 = 0;
if (!v3) {
strlcpy(&errbuf.13339, "empty domain name", 0x100, a3);
goto LABEL_40654d;
}
v6 = *((*(a0) * 2 + *(__ctype_b_loc()))) & 0x400;
if (!v6) {
*(&v6) = *((*(a0) * 2 + *(__ctype_b_loc())));
v6 = v6 & 0x800;
if (!v6) {
snprintf(&errbuf.13339, 0x100,
"domain name \"%.100s\" starts with invalid character", a0);
goto LABEL_40654d;
}
}
v2 = 0;
while (true) {
if (v2 >= v3) {
if (*(-1 + a0 + v3) == 46)
*(-1 + a0 + v3) = 0;
if (a2)
*(a2) = 0;
v8 = 1;
goto LABEL_406567;
} else {
v1 = tolower(*((v2 + a0)));
if (a1)
*((a0 + v2)) = v1;
if (v0 == 46 && v1 == 46) {
snprintf(&errbuf.13339, 0x100,
"domain name \"%.100s\" contains consecutive separators", a0);
break;
}
if (v1 != 46 && v1 != 45) {
*(&v6) = *((*(__ctype_b_loc()) + v1 * 2));
v7 = v6 & 8;
if (!v7 && v1 != 95) {
snprintf(&errbuf.13339, 0x100,
"domain name \"%.100s\" contains invalid characters", a0);
break;
}
}
v0 = v1;
v2 += 1;
}
}
LABEL_40654d:
if (a2)
*(a2) = &errbuf.13339;
v8 = 0;
LABEL_406567:
return v8;
} | openssh-portable | angr_phoenix |
int should_optimize_fork(command, subshell)
COMMAND *command;
int subshell;
{
return (running_trap == 0 && command->type == cm_simple &&
signal_is_trapped(0) == 0 && signal_is_trapped((64 + 1) + 1) == 0 &&
any_signals_trapped() < 0 &&
(subshell || (command->redirects == 0 &&
command->value.Simple->redirects == 0)) &&
((command->flags & 0x80) == 0) && ((command->flags & 0x04) == 0));
} | int should_optimize_fork(struct_0 *a0, unsigned long a1) {
unsigned int v1;
if (running_trap) {
v1 = 0;
return v1;
} else if (a0->field_0 != 4) {
v1 = 0;
return v1;
} else if (signal_is_trapped(0x0)) {
v1 = 0;
return v1;
} else if (signal_is_trapped(0x42)) {
v1 = 0;
return v1;
} else if (any_signals_trapped() >= 0) {
v1 = 0;
return v1;
} else {
if (!a1) {
if (a0->field_10) {
v1 = 0;
return v1;
} else if (a0->field_18->field_10) {
v1 = 0;
return v1;
}
}
if ((a0->field_4 & 128)) {
v1 = 0;
return v1;
} else if ((a0->field_4 & 4)) {
v1 = 0;
return v1;
} else {
v1 = 1;
return v1;
}
}
} | bash | angr_sailr |
static uintmax_t parse_owner_group(char *arg, uintmax_t field_max,
char const **name_option) {
uintmax_t u = (18446744073709551615UL);
char *end;
char const *name = 0;
char const *invalid_num = 0;
char *colon = strchr(arg, ':');
if (colon) {
char const *num = colon + 1;
*colon = '\0';
if (*arg)
name = arg;
if (num &&
(!(xstrtoumax(num, &end, 10, &u, "") == LONGINT_OK && u <= field_max)))
invalid_num = num;
} else {
uintmax_t u1;
switch ('0' <= *arg && *arg <= '9' ? xstrtoumax(arg, &end, 10, &u1, "")
: LONGINT_INVALID) {
default:
name = arg;
break;
case LONGINT_OK:
if (u1 <= field_max) {
u = u1;
break;
}
__attribute__((__fallthrough__));
case LONGINT_OVERFLOW:
invalid_num = arg;
break;
}
}
if (invalid_num)
do {
if (error_hook)
error_hook();
error(0, 0, "%s: %s", quotearg_colon(invalid_num),
gettext("Invalid owner or group ID"));
fatal_exit();
} while (0);
if (name)
*name_option = name;
return u;
} | int parse_owner_group(void *a0, unsigned long a1, unsigned long long *a2,
unsigned long a3, unsigned long a4,
unsigned long long a5) {
unsigned long long v0;
char v1;
char v2;
void *v3;
void *v4;
char *v5;
unsigned long long v6;
unsigned int v8;
unsigned int v12;
unsigned int v13;
v0 = -1;
v3 = 0;
v4 = 0;
v5 = strchr(a0, 0x3a);
if (v5) {
v6 = v5 + 1;
*(v5) = 0;
if (*(a0))
v3 = a0;
if (v6 && (a1 < v0 || xstrtoumax(v6, &v1, 0xa, &v0, &g_407b53)))
v4 = v6;
} else {
if (*(a0) > 47 && *(a0) <= 57)
v8 = xstrtoumax(a0, &v1, 0xa, &v2, &g_407b53);
if (*(a0) <= 47 || *(a0) > 57)
v8 = 4;
if (v8) {
if (v8 != 1)
v3 = a0;
} else {
if (a1 >= *(&v2))
v0 = *(&v2);
}
if (v8 == 1 || !v8 && a1 < *(&v2))
v4 = a0;
}
if (v4) {
if (error_hook)
*(5242888)();
v12 = 0;
v13 = 0;
error(0x0, 0x0, "%s: %s");
fatal_exit(reg_72, reg_64, "%s: %s", quotearg_colon(v4),
gettext("Invalid owner or group ID"), a5);
}
if (v3)
*(a2) = v3;
return v0;
} | tar | angr_dream |
static _Bool
parse_used(const struct parser_table *entry, char **argv, int *arg_ptr) {
struct predicate *our_pred;
struct time_val tval;
const char *offset_str;
const char *errmsg =
"arithmetic overflow while converting %s days to a number of seconds";
if (collect_arg(argv, arg_ptr, &offset_str)) {
struct timespec zero = {0, 0};
if (get_relative_timestamp(offset_str, &tval, zero, 86400, errmsg)) {
our_pred = insert_primary(entry, offset_str);
our_pred->args.reftime = tval;
our_pred->est_success_rate =
estimate_file_age_success_rate(tval.ts.tv_sec / 86400);
return 1;
} else {
((!!sizeof(struct {
_Static_assert(1, "verify_expr ("
"1"
", "
"(error (1, 0, gettext (\"Invalid argument %s to "
"-used\"), offset_str), assume (false))"
")");
int _gl_dummy;
}))
? ((error(1, 0, gettext("Invalid argument %s to -used"), offset_str),
((0) ? (void)0 : __builtin_unreachable())))
: ((error(1, 0, gettext("Invalid argument %s to -used"), offset_str),
((0) ? (void)0 : __builtin_unreachable()))));
return 0;
}
} else {
return 0;
}
} | long long parse_used(unsigned long long a0, unsigned long long a1,
unsigned long long a2) {
char v0;
unsigned long long v1;
struct_0 *v2;
void *v3;
void *v4;
char v5;
char v6;
char v7;
unsigned long long v9;
v1 = "arithmetic overflow while converting %s days to a number of seconds";
if (!collect_arg(a1, a2, &v0)) {
v9 = 0;
return v9;
}
v3 = 0;
v4 = 0;
if (get_relative_timestamp(*(&v0), &v5, v3, v4, v1)) {
v2 = insert_primary(a0, *(&v0), *(&v0));
v2->field_38 = *(&v5);
v2->field_40 = *(&v6);
v2->field_48 = *(&v7);
estimate_file_age_success_rate();
v2->field_24 = (*(&v6) * 1749024623285053783 >> 64 >> 13) - (*(&v6) >> 63);
v9 = 1;
return v9;
}
error(0x1, 0x0, gettext("Invalid argument %s to -used"));
} | findutils | angr_sailr |
static int bond_parse_opt(struct link_util *lu, int argc, char **argv,
struct nlmsghdr *n) {
__u8 mode, use_carrier, primary_reselect, fail_over_mac;
__u8 xmit_hash_policy, num_peer_notif, all_slaves_active;
__u8 lacp_active, lacp_rate, ad_select, tlb_dynamic_lb;
__u16 ad_user_port_key, ad_actor_sys_prio;
__u32 miimon, updelay, downdelay, peer_notify_delay, arp_interval,
arp_validate;
__u32 arp_all_targets, resend_igmp, min_links, lp_interval;
__u32 packets_per_slave;
__u8 missed_max;
unsigned int ifindex;
while (argc > 0) {
if (matches(*argv, "mode") == 0) {
do {
argv++;
if (--argc <= 0)
incomplete_command();
} while (0);
if (get_index(mode_tbl, *argv) < 0)
invarg("invalid mode", *argv);
mode = get_index(mode_tbl, *argv);
addattr8(n, 1024, IFLA_BOND_MODE, mode);
} else if (matches(*argv, "active_slave") == 0) {
do {
argv++;
if (--argc <= 0)
incomplete_command();
} while (0);
ifindex = ll_name_to_index(*argv);
if (!ifindex)
return nodev(*argv);
addattr32(n, 1024, IFLA_BOND_ACTIVE_SLAVE, ifindex);
} else if (matches(*argv, "clear_active_slave") == 0) {
addattr32(n, 1024, IFLA_BOND_ACTIVE_SLAVE, 0);
} else if (matches(*argv, "miimon") == 0) {
do {
argv++;
if (--argc <= 0)
incomplete_command();
} while (0);
if (get_u32(&miimon, *argv, 0))
invarg("invalid miimon", *argv);
addattr32(n, 1024, IFLA_BOND_MIIMON, miimon);
} else if (matches(*argv, "updelay") == 0) {
do {
argv++;
if (--argc <= 0)
incomplete_command();
} while (0);
if (get_u32(&updelay, *argv, 0))
invarg("invalid updelay", *argv);
addattr32(n, 1024, IFLA_BOND_UPDELAY, updelay);
} else if (matches(*argv, "downdelay") == 0) {
do {
argv++;
if (--argc <= 0)
incomplete_command();
} while (0);
if (get_u32(&downdelay, *argv, 0))
invarg("invalid downdelay", *argv);
addattr32(n, 1024, IFLA_BOND_DOWNDELAY, downdelay);
} else if (matches(*argv, "peer_notify_delay") == 0) {
do {
argv++;
if (--argc <= 0)
incomplete_command();
} while (0);
if (get_u32(&peer_notify_delay, *argv, 0))
invarg("invalid peer_notify_delay", *argv);
addattr32(n, 1024, IFLA_BOND_PEER_NOTIF_DELAY, peer_notify_delay);
} else if (matches(*argv, "use_carrier") == 0) {
do {
argv++;
if (--argc <= 0)
incomplete_command();
} while (0);
if (get_u8(&use_carrier, *argv, 0))
invarg("invalid use_carrier", *argv);
addattr8(n, 1024, IFLA_BOND_USE_CARRIER, use_carrier);
} else if (matches(*argv, "arp_interval") == 0) {
do {
argv++;
if (--argc <= 0)
incomplete_command();
} while (0);
if (get_u32(&arp_interval, *argv, 0))
invarg("invalid arp_interval", *argv);
addattr32(n, 1024, IFLA_BOND_ARP_INTERVAL, arp_interval);
} else if (matches(*argv, "arp_ip_target") == 0) {
struct rtattr *nest = addattr_nest(n, 1024, IFLA_BOND_ARP_IP_TARGET);
if ((argc - 1 > 0)) {
do {
argv++;
if (--argc <= 0)
incomplete_command();
} while (0);
char *targets = (__extension__({
const char *__old = (*argv);
size_t __len = strlen(__old) + 1;
char *__new = (char *)__builtin_alloca(__len);
(char *)memcpy(__new, __old, __len);
}));
char *target = strtok(targets, ",");
int i;
for (i = 0; target && i < 16; i++) {
__u32 addr = get_addr32(target);
addattr32(n, 1024, i, addr);
target = strtok(((void *)0), ",");
}
addattr_nest_end(n, nest);
}
addattr_nest_end(n, nest);
} else if (strcmp(*argv, "ns_ip6_target") == 0) {
struct rtattr *nest = addattr_nest(n, 1024, IFLA_BOND_NS_IP6_TARGET);
if ((argc - 1 > 0)) {
do {
argv++;
if (--argc <= 0)
incomplete_command();
} while (0);
char *targets = (__extension__({
const char *__old = (*argv);
size_t __len = strlen(__old) + 1;
char *__new = (char *)__builtin_alloca(__len);
(char *)memcpy(__new, __old, __len);
}));
char *target = strtok(targets, ",");
int i;
for (i = 0; target && i < 16; i++) {
inet_prefix ip6_addr;
get_addr(&ip6_addr, target, 10);
addattr_l(n, 1024, i, ip6_addr.data, sizeof(struct in6_addr));
target = strtok(((void *)0), ",");
}
addattr_nest_end(n, nest);
}
addattr_nest_end(n, nest);
} else if (matches(*argv, "arp_validate") == 0) {
do {
argv++;
if (--argc <= 0)
incomplete_command();
} while (0);
if (get_index(arp_validate_tbl, *argv) < 0)
invarg("invalid arp_validate", *argv);
arp_validate = get_index(arp_validate_tbl, *argv);
addattr32(n, 1024, IFLA_BOND_ARP_VALIDATE, arp_validate);
} else if (matches(*argv, "arp_all_targets") == 0) {
do {
argv++;
if (--argc <= 0)
incomplete_command();
} while (0);
if (get_index(arp_all_targets_tbl, *argv) < 0)
invarg("invalid arp_all_targets", *argv);
arp_all_targets = get_index(arp_all_targets_tbl, *argv);
addattr32(n, 1024, IFLA_BOND_ARP_ALL_TARGETS, arp_all_targets);
} else if (strcmp(*argv, "arp_missed_max") == 0) {
do {
argv++;
if (--argc <= 0)
incomplete_command();
} while (0);
if (get_u8(&missed_max, *argv, 0))
invarg("invalid arp_missed_max", *argv);
addattr8(n, 1024, IFLA_BOND_MISSED_MAX, missed_max);
} else if (matches(*argv, "primary") == 0) {
do {
argv++;
if (--argc <= 0)
incomplete_command();
} while (0);
ifindex = ll_name_to_index(*argv);
if (!ifindex)
return nodev(*argv);
addattr32(n, 1024, IFLA_BOND_PRIMARY, ifindex);
} else if (matches(*argv, "primary_reselect") == 0) {
do {
argv++;
if (--argc <= 0)
incomplete_command();
} while (0);
if (get_index(primary_reselect_tbl, *argv) < 0)
invarg("invalid primary_reselect", *argv);
primary_reselect = get_index(primary_reselect_tbl, *argv);
addattr8(n, 1024, IFLA_BOND_PRIMARY_RESELECT, primary_reselect);
} else if (matches(*argv, "fail_over_mac") == 0) {
do {
argv++;
if (--argc <= 0)
incomplete_command();
} while (0);
if (get_index(fail_over_mac_tbl, *argv) < 0)
invarg("invalid fail_over_mac", *argv);
fail_over_mac = get_index(fail_over_mac_tbl, *argv);
addattr8(n, 1024, IFLA_BOND_FAIL_OVER_MAC, fail_over_mac);
} else if (matches(*argv, "xmit_hash_policy") == 0) {
do {
argv++;
if (--argc <= 0)
incomplete_command();
} while (0);
if (get_index(xmit_hash_policy_tbl, *argv) < 0)
invarg("invalid xmit_hash_policy", *argv);
xmit_hash_policy = get_index(xmit_hash_policy_tbl, *argv);
addattr8(n, 1024, IFLA_BOND_XMIT_HASH_POLICY, xmit_hash_policy);
} else if (matches(*argv, "resend_igmp") == 0) {
do {
argv++;
if (--argc <= 0)
incomplete_command();
} while (0);
if (get_u32(&resend_igmp, *argv, 0))
invarg("invalid resend_igmp", *argv);
addattr32(n, 1024, IFLA_BOND_RESEND_IGMP, resend_igmp);
} else if (matches(*argv, "num_grat_arp") == 0 ||
matches(*argv, "num_unsol_na") == 0) {
do {
argv++;
if (--argc <= 0)
incomplete_command();
} while (0);
if (get_u8(&num_peer_notif, *argv, 0))
invarg("invalid num_grat_arp|num_unsol_na", *argv);
addattr8(n, 1024, IFLA_BOND_NUM_PEER_NOTIF, num_peer_notif);
} else if (matches(*argv, "all_slaves_active") == 0) {
do {
argv++;
if (--argc <= 0)
incomplete_command();
} while (0);
if (get_u8(&all_slaves_active, *argv, 0))
invarg("invalid all_slaves_active", *argv);
addattr8(n, 1024, IFLA_BOND_ALL_SLAVES_ACTIVE, all_slaves_active);
} else if (matches(*argv, "min_links") == 0) {
do {
argv++;
if (--argc <= 0)
incomplete_command();
} while (0);
if (get_u32(&min_links, *argv, 0))
invarg("invalid min_links", *argv);
addattr32(n, 1024, IFLA_BOND_MIN_LINKS, min_links);
} else if (matches(*argv, "lp_interval") == 0) {
do {
argv++;
if (--argc <= 0)
incomplete_command();
} while (0);
if (get_u32(&lp_interval, *argv, 0))
invarg("invalid lp_interval", *argv);
addattr32(n, 1024, IFLA_BOND_LP_INTERVAL, lp_interval);
} else if (matches(*argv, "packets_per_slave") == 0) {
do {
argv++;
if (--argc <= 0)
incomplete_command();
} while (0);
if (get_u32(&packets_per_slave, *argv, 0))
invarg("invalid packets_per_slave", *argv);
addattr32(n, 1024, IFLA_BOND_PACKETS_PER_SLAVE, packets_per_slave);
} else if (matches(*argv, "lacp_rate") == 0) {
do {
argv++;
if (--argc <= 0)
incomplete_command();
} while (0);
if (get_index(lacp_rate_tbl, *argv) < 0)
invarg("invalid lacp_rate", *argv);
lacp_rate = get_index(lacp_rate_tbl, *argv);
addattr8(n, 1024, IFLA_BOND_AD_LACP_RATE, lacp_rate);
} else if (strcmp(*argv, "lacp_active") == 0) {
do {
argv++;
if (--argc <= 0)
incomplete_command();
} while (0);
if (get_index(lacp_active_tbl, *argv) < 0)
invarg("invalid lacp_active", *argv);
lacp_active = get_index(lacp_active_tbl, *argv);
addattr8(n, 1024, IFLA_BOND_AD_LACP_ACTIVE, lacp_active);
} else if (matches(*argv, "ad_select") == 0) {
do {
argv++;
if (--argc <= 0)
incomplete_command();
} while (0);
if (get_index(ad_select_tbl, *argv) < 0)
invarg("invalid ad_select", *argv);
ad_select = get_index(ad_select_tbl, *argv);
addattr8(n, 1024, IFLA_BOND_AD_SELECT, ad_select);
} else if (matches(*argv, "ad_user_port_key") == 0) {
do {
argv++;
if (--argc <= 0)
incomplete_command();
} while (0);
if (get_u16(&ad_user_port_key, *argv, 0))
invarg("invalid ad_user_port_key", *argv);
addattr16(n, 1024, IFLA_BOND_AD_USER_PORT_KEY, ad_user_port_key);
} else if (matches(*argv, "ad_actor_sys_prio") == 0) {
do {
argv++;
if (--argc <= 0)
incomplete_command();
} while (0);
if (get_u16(&ad_actor_sys_prio, *argv, 0))
invarg("invalid ad_actor_sys_prio", *argv);
addattr16(n, 1024, IFLA_BOND_AD_ACTOR_SYS_PRIO, ad_actor_sys_prio);
} else if (matches(*argv, "ad_actor_system") == 0) {
int len;
char abuf[32];
do {
argv++;
if (--argc <= 0)
incomplete_command();
} while (0);
len = ll_addr_a2n(abuf, sizeof(abuf), *argv);
if (len < 0)
return -1;
addattr_l(n, 1024, IFLA_BOND_AD_ACTOR_SYSTEM, abuf, len);
} else if (matches(*argv, "tlb_dynamic_lb") == 0) {
do {
argv++;
if (--argc <= 0)
incomplete_command();
} while (0);
if (get_u8(&tlb_dynamic_lb, *argv, 0)) {
invarg("invalid tlb_dynamic_lb", *argv);
return -1;
}
addattr8(n, 1024, IFLA_BOND_TLB_DYNAMIC_LB, tlb_dynamic_lb);
} else if (matches(*argv, "help") == 0) {
explain();
return -1;
} else {
fprintf(stderr, "bond: unknown command \"%s\"?\n", *argv);
explain();
return -1;
}
argc--, argv++;
}
return 0;
} | long long bond_parse_opt(unsigned long a0, unsigned long a1, unsigned long a2,
unsigned long long a3) {
unsigned long long *v0;
unsigned int v1;
unsigned long 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;
unsigned int v26;
unsigned int v27;
unsigned int v28;
unsigned int v29;
unsigned int v30;
unsigned int v31;
unsigned int v32;
unsigned long long v33;
unsigned long long v34;
unsigned long long v35;
void *v36;
unsigned int v37;
unsigned long long v38;
char *v39;
unsigned long long v40;
void *v41;
unsigned int v42;
unsigned long long v43;
char *v44;
char v45;
char v46;
char v47;
unsigned long v48;
char v49;
unsigned long v50;
unsigned long long v80;
v2 = a0;
v1 = a1;
v0 = a2;
while (true) {
if (v1 <= 0) {
v80 = 0;
return v80;
}
if ((matches(*(v0), "mode") ^ 1)) {
v0 = v0 + 1;
v1 -= 1;
if (v1 <= 0)
incomplete_command();
if (get_index(&mode_tbl, *(v0)) < 0)
invarg("invalid mode", *(v0));
v14 = get_index(&mode_tbl, *(v0));
addattr8(a3, 0x400, 0x1, v14);
} else if ((matches(*(v0), "active_slave") ^ 1)) {
v0 = v0 + 1;
v1 -= 1;
if (v1 <= 0)
incomplete_command();
v29 = ll_name_to_index(*(v0));
if (!v29) {
v80 = nodev(*(v0));
return v80;
}
addattr32(a3, 0x400, 0x2, v29);
} else if ((matches(*(v0), "clear_active_slave") ^ 1)) {
addattr32(a3, 0x400, 0x2, 0x0);
} else if ((matches(*(v0), "miimon") ^ 1)) {
v0 = v0 + 1;
v1 -= 1;
if (v1 <= 0)
incomplete_command();
if (get_u32(&v17, *(v0), 0x0, *(v0)))
invarg("invalid miimon", *(v0));
addattr32(a3, 0x400, 0x3, *(&v17));
} else if ((matches(*(v0), "updelay") ^ 1)) {
v0 = v0 + 1;
v1 -= 1;
if (v1 <= 0)
incomplete_command();
if (get_u32(&v18, *(v0), 0x0, *(v0)))
invarg("invalid updelay", *(v0));
addattr32(a3, 0x400, 0x4, *(&v18));
} else if ((matches(*(v0), "downdelay") ^ 1)) {
v0 = v0 + 1;
v1 -= 1;
if (v1 <= 0)
incomplete_command();
if (get_u32(&v19, *(v0), 0x0, *(v0)))
invarg("invalid downdelay", *(v0));
addattr32(a3, 0x400, 0x5, *(&v19));
} else if ((matches(*(v0), "peer_notify_delay") ^ 1)) {
v0 = v0 + 1;
v1 -= 1;
if (v1 <= 0)
incomplete_command();
if (get_u32(&v20, *(v0), 0x0, *(v0)))
invarg("invalid peer_notify_delay", *(v0));
addattr32(a3, 0x400, 0x1c, *(&v20));
} else if ((matches(*(v0), "use_carrier") ^ 1)) {
v0 = v0 + 1;
v1 -= 1;
if (v1 <= 0)
incomplete_command();
if (get_u8(&v3, *(v0), 0x0, *(v0)))
invarg("invalid use_carrier", *(v0));
addattr8(a3, 0x400, 0x6, v3);
} else if ((matches(*(v0), "arp_interval") ^ 1)) {
v0 = v0 + 1;
v1 -= 1;
if (v1 <= 0)
incomplete_command();
if (get_u32(&v21, *(v0), 0x0, *(v0)))
invarg("invalid arp_interval", *(v0));
addattr32(a3, 0x400, 0x7, *(&v21));
} else if ((matches(*(v0), "arp_ip_target") ^ 1)) {
v40 = addattr_nest(a3, 0x400, 0x8);
if (v1 > 1) {
v0 = v0 + 1;
v1 -= 1;
if (v1 <= 0)
incomplete_command();
v41 = *(v0);
for (*(&v42) = strlen(v41) + 1;
&v49 !=
&(&v49)[-1 * ((0 CONCAT 15 + *(&v42) + 8) / m 16 * 16 & -0x1000)];
v48 = *(&v48))
;
if ((((0 CONCAT 15 + *(&v42) + 8) / m 16 * 16) & 4095))
*((&v48 + (((0 CONCAT 15 + *(&v42) + 8) / m 16 * 16) & 4095))) =
*((&v48 + (((0 CONCAT 15 + *(&v42) + 8) / m 16 * 16) & 4095)));
v43 = (&v50 >> 4) * 16;
v44 = memcpy(v43, v41, *(&v42));
v33 = strtok(v44, ",");
for (v26 = 0; v33 && v26 <= 15; v26 += 1) {
v32 = get_addr32(v33);
addattr32(a3, 0x400, v26, v32);
v33 = strtok(NULL, ",");
}
addattr_nest_end(a3, v40, v40);
}
addattr_nest_end(a3, v40, v40);
} else if (!strcmp(*(v0), "ns_ip6_target")) {
v35 = addattr_nest(a3, 0x400, 0x1f);
if (v1 > 1) {
v0 = v0 + 1;
v1 -= 1;
if (v1 <= 0)
incomplete_command();
v36 = *(v0);
for (*(&v37) = strlen(v36) + 1;
&v49 !=
&(&v49)[-1 * ((0 CONCAT 15 + *(&v37) + 8) / m 16 * 16 & -0x1000)];
v48 = v48)
;
if ((((0 CONCAT 15 + *(&v37) + 8) / m 16 * 16) & 4095))
*((&v48 + (((0 CONCAT 15 + *(&v37) + 8) / m 16 * 16) & 4095))) =
*((&v48 + (((0 CONCAT 15 + *(&v37) + 8) / m 16 * 16) & 4095)));
v38 = (&v50 >> 4) * 16;
v39 = memcpy(v38, v36, *(&v37));
v34 = strtok(v39, ",");
for (v27 = 0; v34 && v27 <= 15; v27 += 1) {
get_addr(&v45, v34, 0xa, v34);
addattr_l(a3, 0x400, v27, &v46, 0x10);
v34 = strtok(NULL, ",");
}
addattr_nest_end(a3, v35, v35);
}
addattr_nest_end(a3, v35, v35);
} else if ((matches(*(v0), "arp_validate") ^ 1)) {
v0 = v0 + 1;
v1 -= 1;
if (v1 <= 0)
incomplete_command();
if (get_index(&arp_validate_tbl, *(v0)) < 0)
invarg("invalid arp_validate", *(v0));
v31 = get_index(&arp_validate_tbl, *(v0));
addattr32(a3, 0x400, 0x9, v31);
} else if ((matches(*(v0), "arp_all_targets") ^ 1)) {
v0 = v0 + 1;
v1 -= 1;
if (v1 <= 0)
incomplete_command();
if (get_index(&arp_all_targets_tbl, *(v0)) < 0)
invarg("invalid arp_all_targets", *(v0));
v30 = get_index(&arp_all_targets_tbl, *(v0));
addattr32(a3, 0x400, 0xa, v30);
} else if (!strcmp(*(v0), "arp_missed_max")) {
v0 = v0 + 1;
v1 -= 1;
if (v1 <= 0)
incomplete_command();
if (get_u8(&v7, *(v0), 0x0, *(v0)))
invarg("invalid arp_missed_max", *(v0));
addattr8(a3, 0x400, 0x1e, v7);
} else if ((matches(*(v0), "primary") ^ 1)) {
v0 = v0 + 1;
v1 -= 1;
if (v1 <= 0)
incomplete_command();
v29 = ll_name_to_index(*(v0));
if (!v29) {
v80 = nodev(*(v0));
return v80;
}
addattr32(a3, 0x400, 0xb, v29);
} else if ((matches(*(v0), "primary_reselect") ^ 1)) {
v0 = v0 + 1;
v1 -= 1;
if (v1 <= 0)
incomplete_command();
if (get_index(&primary_reselect_tbl, *(v0)) < 0)
invarg("invalid primary_reselect", *(v0));
v13 = get_index(&primary_reselect_tbl, *(v0));
addattr8(a3, 0x400, 0xc, v13);
} else if ((matches(*(v0), "fail_over_mac") ^ 1)) {
v0 = v0 + 1;
v1 -= 1;
if (v1 <= 0)
incomplete_command();
if (get_index(&fail_over_mac_tbl, *(v0)) < 0)
invarg("invalid fail_over_mac", *(v0));
v12 = get_index(&fail_over_mac_tbl, *(v0));
addattr8(a3, 0x400, 0xd, v12);
} else if ((matches(*(v0), "xmit_hash_policy") ^ 1)) {
v0 = v0 + 1;
v1 -= 1;
if (v1 <= 0)
incomplete_command();
if (get_index(&xmit_hash_policy_tbl, *(v0)) < 0)
invarg("invalid xmit_hash_policy", *(v0));
v11 = get_index(&xmit_hash_policy_tbl, *(v0));
addattr8(a3, 0x400, 0xe, v11);
} else if ((matches(*(v0), "resend_igmp") ^ 1)) {
v0 = v0 + 1;
v1 -= 1;
if (v1 <= 0)
incomplete_command();
if (get_u32(&v22, *(v0), 0x0, *(v0)))
invarg("invalid resend_igmp", *(v0));
addattr32(a3, 0x400, 0xf, *(&v22));
} else if ((matches(*(v0), "num_grat_arp") ^ 1) ||
(matches(*(v0), "num_unsol_na") ^ 1)) {
v0 = v0 + 1;
v1 -= 1;
if (v1 <= 0)
incomplete_command();
if (get_u8(&v4, *(v0), 0x0, *(v0)))
invarg("invalid num_grat_arp|num_unsol_na", *(v0));
addattr8(a3, 0x400, 0x10, v4);
} else if ((matches(*(v0), "all_slaves_active") ^ 1)) {
v0 = v0 + 1;
v1 -= 1;
if (v1 <= 0)
incomplete_command();
if (get_u8(&v5, *(v0), 0x0, *(v0)))
invarg("invalid all_slaves_active", *(v0));
addattr8(a3, 0x400, 0x11, v5);
} else if ((matches(*(v0), "min_links") ^ 1)) {
v0 = v0 + 1;
v1 -= 1;
if (v1 <= 0)
incomplete_command();
if (get_u32(&v23, *(v0), 0x0, *(v0)))
invarg("invalid min_links", *(v0));
addattr32(a3, 0x400, 0x12, *(&v23));
} else if ((matches(*(v0), "lp_interval") ^ 1)) {
v0 = v0 + 1;
v1 -= 1;
if (v1 <= 0)
incomplete_command();
if (get_u32(&v24, *(v0), 0x0, *(v0)))
invarg("invalid lp_interval", *(v0));
addattr32(a3, 0x400, 0x13, *(&v24));
} else if ((matches(*(v0), "packets_per_slave") ^ 1)) {
v0 = v0 + 1;
v1 -= 1;
if (v1 <= 0)
incomplete_command();
if (get_u32(&v25, *(v0), 0x0, *(v0)))
invarg("invalid packets_per_slave", *(v0));
addattr32(a3, 0x400, 0x14, *(&v25));
} else if ((matches(*(v0), "lacp_rate") ^ 1)) {
v0 = v0 + 1;
v1 -= 1;
if (v1 <= 0)
incomplete_command();
if (get_index(&lacp_rate_tbl, *(v0)) < 0)
invarg("invalid lacp_rate", *(v0));
v10 = get_index(&lacp_rate_tbl, *(v0));
addattr8(a3, 0x400, 0x15, v10);
} else if (!strcmp(*(v0), "lacp_active")) {
v0 = v0 + 1;
v1 -= 1;
if (v1 <= 0)
incomplete_command();
if (get_index(&lacp_active_tbl, *(v0)) < 0)
invarg("invalid lacp_active", *(v0));
v9 = get_index(&lacp_active_tbl, *(v0));
addattr8(a3, 0x400, 0x1d, v9);
} else if ((matches(*(v0), "ad_select") ^ 1)) {
v0 = v0 + 1;
v1 -= 1;
if (v1 <= 0)
incomplete_command();
if (get_index(&ad_select_tbl, *(v0)) < 0)
invarg("invalid ad_select", *(v0));
v8 = get_index(&ad_select_tbl, *(v0));
addattr8(a3, 0x400, 0x16, v8);
} else if ((matches(*(v0), "ad_user_port_key") ^ 1)) {
v0 = v0 + 1;
v1 -= 1;
if (v1 <= 0)
incomplete_command();
if (get_u16(&v15, *(v0), 0x0, *(v0)))
invarg("invalid ad_user_port_key", *(v0));
addattr16(a3, 0x400, 0x19, *(&v15));
} else if ((matches(*(v0), "ad_actor_sys_prio") ^ 1)) {
v0 = v0 + 1;
v1 -= 1;
if (v1 <= 0)
incomplete_command();
if (get_u16(&v16, *(v0), 0x0, *(v0)))
invarg("invalid ad_actor_sys_prio", *(v0));
addattr16(a3, 0x400, 0x18, *(&v16));
} else if ((matches(*(v0), "ad_actor_system") ^ 1)) {
v0 = v0 + 1;
v1 -= 1;
if (v1 <= 0)
incomplete_command();
v28 = ll_addr_a2n(&v47, 0x20, *(v0));
if (v28 < 0) {
v80 = 4294967295;
return v80;
}
addattr_l(a3, 0x400, 0x1a, &v47, v28);
} else if ((matches(*(v0), "tlb_dynamic_lb") ^ 1)) {
v0 = v0 + 1;
v1 -= 1;
if (v1 <= 0)
incomplete_command();
if (get_u8(&v6, *(v0), 0x0, *(v0)))
invarg("invalid tlb_dynamic_lb", *(v0));
addattr8(a3, 0x400, 0x1b, v6);
} else {
break;
}
v1 -= 1;
v0 += 1;
}
if ((matches(*(v0), "help") ^ 1)) {
explain();
v80 = 4294967295;
return v80;
}
fprintf(stderr, "bond: unknown command \"%s\"?\n", *(v0));
explain();
v80 = 4294967295;
return v80;
} | iproute2-6.0.0 | angr_sailr |
static void indent(size_t from, size_t to) {
while (from < to) {
if (tabsize != 0 && to / tabsize > (from + 1) / tabsize) {
putchar_unlocked('\t');
from += tabsize - from % tabsize;
} else {
putchar_unlocked(' ');
from++;
}
}
} | void indent(unsigned long long a0, unsigned long a1) {
unsigned long long v0;
unsigned long long v2;
v0 = a0;
while (true) {
v2 = v0;
if (v0 >= a1)
break;
if (tabsize && (0 CONCAT a1) / m tabsize > (0 CONCAT v0 + 1) / m tabsize) {
putchar_unlocked(0x9);
v0 += tabsize - ((0 CONCAT v0) / m tabsize >> 64);
continue;
}
if (!tabsize ||
(0 CONCAT a1) / m tabsize <= (0 CONCAT v0 + 1) / m tabsize) {
putchar_unlocked(0x20);
v0 += 1;
}
}
return;
} | coreutils | angr_dream |
int pstrcmp(const void *a, const void *b) {
return strcmp(*(const char *const *)a, *(const char *const *)b);
} | long long pstrcmp(unsigned long long *a0, unsigned long long *a1) {
return strcmp(*(a0), *(a1));
} | dash-0.5.11+git20210903+057cd650a4ed | angr_dream |
static void print_srh(FILE *fp, struct ipv6_sr_hdr *srh) {
int i;
if (is_json_context())
open_json_array(PRINT_JSON, "segs");
else
fprintf(fp, "segs %d [ ", srh->first_segment + 1);
for (i = srh->first_segment; i >= 0; i--)
print_color_string(PRINT_ANY, COLOR_INET6,
((void *)0), "%s ",
rt_addr_n2a(10, 16, &srh->segments[i]));
if (is_json_context())
close_json_array(PRINT_JSON, ((void *)0));
else
fprintf(fp, "] ");
if (((srh)->flags & (1 << 3))) {
unsigned int offset = ((srh->hdrlen + 1) << 3) - 40;
struct sr6_tlv_hmac *tlv;
tlv = (struct sr6_tlv_hmac *)((char *)srh + offset);
print_0xhex(PRINT_ANY, "hmac", "hmac %llX ", ntohl(tlv->hmackeyid));
}
} | void print_srh(void *a0, char a1[6]) {
unsigned int v0;
unsigned int v1;
struct_0 *v2;
unsigned long long v4;
unsigned long long v5;
if (!is_json_context())
fprintf(a0, "segs %d [ ", a1[4] + 1);
else
open_json_array(0x2, "segs");
for (v0 = a1[4]; v0 >= 0; v0 -= 1) {
print_color_string(0x4, 0x3, 0x0, "%s ",
rt_addr_n2a(0xa, 0x10, 8 + a1 + 16 * v0));
}
if (!is_json_context())
fprintf(a0, "] ");
else
close_json_array(0x2, 0x0);
v4 = a1[5] & 8;
if ((a1[5] & 8)) {
v1 = ((a1[1] + 1) * 8) - 40;
v2 = &a1[v1];
v5 = print_0xhex(0x4, "hmac", "hmac %llX ", ntohl(v2->field_4));
}
return;
} | iproute2-6.0.0 | angr_phoenix |
int rl_undo_command(int count, int key) {
if (count < 0)
return 0;
while (count) {
if (rl_do_undo())
count--;
else {
rl_ding();
break;
}
}
return 0;
} | long long rl_undo_command(unsigned long a0, unsigned long a1) {
unsigned int v0;
unsigned int v1;
v1 = a0;
if (v1 >= 0) {
for (v0 = a1; v1; v1 -= 1) {
if (!rl_do_undo()) {
rl_ding();
break;
}
}
}
return 0;
} | bash | angr_dream |
static void str_to_env(char const *envar, char const *str) {
if (str) {
if (setenv(envar, str, 1) != 0)
xalloc_die();
} else
unsetenv(envar);
} | int str_to_env(const char *a1, const char *a2) {
int result;
if (a2) {
result = setenv(a1, a2, 1);
if (!result)
return result;
xalloc_die(a1);
}
return unsetenv(a1);
} | tar | ida |
void app_exit(int val) {
if (val != 0) {
if (outfile_name)
(void)remove(outfile_name);
}
exit(val);
} | void app_exit(unsigned long a0) {
if (a0 && outfile_name)
remove(outfile_name);
exit(a0);
} | gnutls | angr_phoenix |
int main(int argc, char **argv) {
int bit_flags = 0x0010;
int dereference = -1;
_Bool ok;
_Bool preserve_root = 0;
_Bool component_specified = 0;
char *reference_file = ((void *)0);
int optc;
;
set_program_name(argv[0]);
setlocale(6, "");
bindtextdomain("coreutils", "/usr/local/share/locale");
textdomain("coreutils");
atexit(close_stdout);
while ((optc = getopt_long(argc, argv, "HLPRhvu:r:t:l:", long_options,
((void *)0))) != -1) {
switch (optc) {
case 'H':
bit_flags = 0x0001 | 0x0010;
break;
case 'L':
bit_flags = 0x0002;
break;
case 'P':
bit_flags = 0x0010;
break;
case 'h':
dereference = 0;
break;
case DEREFERENCE_OPTION:
dereference = 1;
break;
case NO_PRESERVE_ROOT:
preserve_root = 0;
break;
case PRESERVE_ROOT:
preserve_root = 1;
break;
case REFERENCE_FILE_OPTION:
reference_file = optarg;
break;
case 'R':
recurse = 1;
break;
case 'f':
break;
case 'v':
verbose = 1;
break;
case 'u':
specified_user = optarg;
component_specified = 1;
break;
case 'r':
specified_role = optarg;
component_specified = 1;
break;
case 't':
specified_type = optarg;
component_specified = 1;
break;
case 'l':
specified_range = optarg;
component_specified = 1;
break;
case GETOPT_HELP_CHAR:
usage(0);
break;
;
case GETOPT_VERSION_CHAR:
version_etc(stdout, "chcon", "GNU coreutils", Version, ("Russell Coker"),
("Jim Meyering"), (char *)((void *)0));
exit(0);
break;
;
default:
usage(1);
}
}
if (recurse) {
if (bit_flags == 0x0010) {
if (dereference == 1)
((!!sizeof(struct {
_Static_assert(1, "verify_expr ("
"1"
", "
"(error (1, 0, gettext (\"-R --dereference "
"requires either -H or -L\")), assume (false))"
")");
int _gl_dummy;
}))
? ((error(1, 0,
gettext("-R --dereference requires either -H or -L")),
((0) ? (void)0 : __builtin_unreachable())))
: ((error(1, 0,
gettext("-R --dereference requires either -H or -L")),
((0) ? (void)0 : __builtin_unreachable()))));
affect_symlink_referent = 0;
} else {
if (dereference == 0)
((!!sizeof(struct {
_Static_assert(
1,
"verify_expr ("
"1"
", "
"(error (1, 0, gettext (\"-R -h requires -P\")), assume (false))"
")");
int _gl_dummy;
}))
? ((error(1, 0, gettext("-R -h requires -P")),
((0) ? (void)0 : __builtin_unreachable())))
: ((error(1, 0, gettext("-R -h requires -P")),
((0) ? (void)0 : __builtin_unreachable()))));
affect_symlink_referent = 1;
}
} else {
bit_flags = 0x0010;
affect_symlink_referent = (dereference != 0);
}
if (argc - optind < (reference_file || component_specified ? 1 : 2)) {
if (argc <= optind)
error(0, 0, gettext("missing operand"));
else
error(0, 0, gettext("missing operand after %s"), quote(argv[argc - 1]));
usage(1);
}
if (reference_file) {
char *ref_context = ((void *)0);
if (rpl_getfilecon(reference_file, &ref_context) < 0)
((!!sizeof(struct {
_Static_assert(1, "verify_expr ("
"1"
", "
"(error (1, (*__errno_location ()), gettext "
"(\"failed to get security context of %s\"), "
"quotearg_style (shell_escape_always_quoting_style, "
"reference_file)), assume (false))"
")");
int _gl_dummy;
}))
? ((error(1, (*__errno_location()),
gettext("failed to get security context of %s"),
quotearg_style(shell_escape_always_quoting_style,
reference_file)),
((0) ? (void)0 : __builtin_unreachable())))
: ((error(1, (*__errno_location()),
gettext("failed to get security context of %s"),
quotearg_style(shell_escape_always_quoting_style,
reference_file)),
((0) ? (void)0 : __builtin_unreachable()))));
specified_context = ref_context;
} else if (component_specified) {
specified_context = ((void *)0);
} else {
specified_context = argv[optind++];
if (0 < is_selinux_enabled() &&
security_check_context(specified_context) < 0)
((!!sizeof(struct {
_Static_assert(
1, "verify_expr ("
"1"
", "
"(error (1, (*__errno_location ()), gettext (\"invalid context: "
"%s\"), quote (specified_context)), assume (false))"
")");
int _gl_dummy;
}))
? ((error(1, (*__errno_location()), gettext("invalid context: %s"),
quote(specified_context)),
((0) ? (void)0 : __builtin_unreachable())))
: ((error(1, (*__errno_location()), gettext("invalid context: %s"),
quote(specified_context)),
((0) ? (void)0 : __builtin_unreachable()))));
}
if (reference_file && component_specified) {
error(0, 0, gettext("conflicting security context specifiers given"));
usage(1);
}
if (recurse && preserve_root) {
static struct dev_ino dev_ino_buf;
root_dev_ino = get_root_dev_ino(&dev_ino_buf);
if (root_dev_ino == ((void *)0))
((!!sizeof(struct {
_Static_assert(
1, "verify_expr ("
"1"
", "
"(error (1, (*__errno_location ()), gettext (\"failed to get "
"attributes of %s\"), quotearg_style "
"(shell_escape_always_quoting_style, \"/\")), assume (false))"
")");
int _gl_dummy;
}))
? ((error(1, (*__errno_location()),
gettext("failed to get attributes of %s"),
quotearg_style(shell_escape_always_quoting_style, "/")),
((0) ? (void)0 : __builtin_unreachable())))
: ((error(1, (*__errno_location()),
gettext("failed to get attributes of %s"),
quotearg_style(shell_escape_always_quoting_style, "/")),
((0) ? (void)0 : __builtin_unreachable()))));
} else {
root_dev_ino = ((void *)0);
}
ok = process_files(argv + optind, bit_flags | 0x0008);
return ok ? 0 : 1;
} | byte main(int param_1, undefined8 *param_2)
{
bool bVar1;
bool bVar2;
byte bVar3;
int iVar4;
undefined8 uVar5;
int *piVar6;
long in_FS_OFFSET;
undefined8 uVar7;
uint local_3c;
int local_38;
undefined8 local_30;
long local_28;
long local_20;
local_20 = *(long *)(in_FS_OFFSET + 0x28);
local_3c = 0x10;
local_38 = -1;
bVar2 = false;
bVar1 = false;
local_28 = 0;
set_program_name(*param_2);
setlocale(6, "");
bindtextdomain("coreutils", "/usr/local/share/locale");
textdomain("coreutils");
atexit(p_Ram000000000010102d);
switchD_0010109b_caseD_66:
uVar7 = 0x1011ee;
iVar4 = getopt_long(param_1, param_2, "HLPRhvu:r:t:l:", long_options, 0);
if (iVar4 != -1) {
if (iVar4 < 0x84) {
if (iVar4 < 0x48) {
if (iVar4 == -0x83) {
LAB_00101174:
version_etc(stdout, "chcon", "GNU coreutils", Version,
"Russell Coker", "Jim Meyering", 0, uVar7);
exit(0);
}
if (iVar4 == -0x82) {
uVar7 = 0x101174;
usage(0);
goto LAB_00101174;
}
goto switchD_0010109b_caseD_49;
}
goto code_r0x0010107b;
}
goto switchD_0010109b_caseD_49;
}
if (recurse == '\0') {
local_3c = 0x10;
affect_symlink_referent = local_38 != 0;
} else if (local_3c == 0x10) {
if (local_38 == 1) {
uVar7 = gettext("-R --dereference requires either -H or -L");
error(1, 0, uVar7);
}
affect_symlink_referent = false;
} else {
if (local_38 == 0) {
uVar7 = gettext("-R -h requires -P");
error(1, 0, uVar7);
}
affect_symlink_referent = true;
}
if ((local_28 != 0) || (bVar1)) {
iVar4 = 1;
} else {
iVar4 = 2;
}
if (param_1 - optind < iVar4) {
if (optind < param_1) {
uVar7 = quote(param_2[(long)param_1 + -1]);
uVar5 = gettext("missing operand after %s");
error(0, 0, uVar5, uVar7);
} else {
uVar7 = gettext("missing operand");
error(0, 0, uVar7);
}
usage(1);
}
if (local_28 == 0) {
if (bVar1) {
specified_context = 0;
} else {
specified_context = param_2[optind];
optind = optind + 1;
iVar4 = is_selinux_enabled();
if ((0 < iVar4) &&
(iVar4 = security_check_context(specified_context), iVar4 < 0)) {
uVar7 = quote(specified_context);
uVar5 = gettext("invalid context: %s");
piVar6 = __errno_location();
error(1, *piVar6, uVar5, uVar7);
}
}
} else {
local_30 = 0;
iVar4 = rpl_getfilecon(local_28, &local_30);
if (iVar4 < 0) {
uVar7 = quotearg_style(4, local_28);
uVar5 = gettext("failed to get security context of %s");
piVar6 = __errno_location();
error(1, *piVar6, uVar5, uVar7);
}
specified_context = local_30;
}
if ((local_28 != 0) && (bVar1)) {
uVar7 = gettext("conflicting security context specifiers given");
error(0, 0, uVar7);
usage(1);
}
if ((recurse != '\0') && (bVar2)) {
root_dev_ino = get_root_dev_ino(dev_ino_buf_6463);
if (root_dev_ino != 0)
goto LAB_001014ff;
uVar7 = quotearg_style(4, &DAT_001018cd);
uVar5 = gettext("failed to get attributes of %s");
piVar6 = __errno_location();
error(1, *piVar6, uVar5, uVar7);
}
root_dev_ino = 0;
LAB_001014ff:
bVar3 = process_files(param_2 + optind, local_3c | 8);
if (local_20 != *(long *)(in_FS_OFFSET + 0x28)) {
__stack_chk_fail();
}
return bVar3 ^ 1;
code_r0x0010107b:
switch (iVar4) {
case 0x48:
local_3c = 0x11;
break;
default:
switchD_0010109b_caseD_49:
usage();
break;
case 0x4c:
local_3c = 2;
break;
case 0x50:
local_3c = 0x10;
break;
case 0x52:
recurse = '\x01';
break;
case 0x66:
break;
case 0x68:
local_38 = 0;
break;
case 0x6c:
specified_range = optarg;
bVar1 = true;
break;
case 0x72:
specified_role = optarg;
bVar1 = true;
break;
case 0x74:
specified_type = optarg;
bVar1 = true;
break;
case 0x75:
specified_user = optarg;
bVar1 = true;
break;
case 0x76:
verbose = 1;
break;
case 0x80:
local_38 = 1;
break;
case 0x81:
bVar2 = false;
break;
case 0x82:
bVar2 = true;
break;
case 0x83:
local_28 = optarg;
}
goto switchD_0010109b_caseD_66;
} | coreutils | ghidra |
inline void ext2fs_mark_bb_dirty(ext2_filsys fs) { fs->flags |= 0x20 | 0x02; } | void ext2fs_mark_bb_dirty(void)
{
halt_baddata();
} | e2fsprogs-1.46.5 | ghidra |
static int visible_variable_in_context(var)
SHELL_VAR *var;
{
return (((((var)->attributes) & (0x0001000))) == 0 &&
((((var)->attributes) & (0x0000020))) &&
var->context == variable_context);
} | long long visible_variable_in_context(unsigned int a0[12]) {
unsigned long long v1;
if (!(a0[10] & 0x1000) && (a0[10] & 32) && a0[11] == variable_context)
v1 = 1;
if (!(a0[10] & 32) || (a0[10] & 0x1000) || a0[11] != variable_context)
v1 = 0;
return v1;
} | bash | angr_dream |
void coproc_fdchk(fd) int fd;
{
coproc_checkfd(&sh_coproc, fd);
} | long long coproc_fdchk(unsigned long a0) {
return coproc_checkfd(&sh_coproc, a0);
} | bash | angr_dream |
static void add_backref_segment(struct transform *tf, size_t ref) {
struct replace_segm *segm = add_segment(tf);
segm->type = segm_backref;
segm->v.ref = ref;
} | void add_backref_segment(void *a0, unsigned long a1) {
struct_0 *v0;
struct_0 *v3;
*(&v0) = add_segment(a0);
v0->field_8 = 1;
v3 = v0;
v0->field_10 = a1;
return;
} | tar | angr_sailr |
static char *format_forward(u_int ftype, struct Forward *fwd) {
char *ret;
switch (ftype) {
case 1:
xasprintf(&ret, "local forward %.200s:%d -> %.200s:%d",
(fwd->listen_path != ((void *)0)) ? fwd->listen_path
: (fwd->listen_host == ((void *)0))
? (options.fwd_opts.gateway_ports ? "*" : "LOCALHOST")
: fwd->listen_host,
fwd->listen_port,
(fwd->connect_path != ((void *)0)) ? fwd->connect_path
: fwd->connect_host,
fwd->connect_port);
break;
case 3:
xasprintf(&ret, "dynamic forward %.200s:%d -> *",
(fwd->listen_host == ((void *)0))
? (options.fwd_opts.gateway_ports ? "*" : "LOCALHOST")
: fwd->listen_host,
fwd->listen_port);
break;
case 2:
xasprintf(&ret, "remote forward %.200s:%d -> %.200s:%d",
(fwd->listen_path != ((void *)0)) ? fwd->listen_path
: (fwd->listen_host == ((void *)0)) ? "LOCALHOST"
: fwd->listen_host,
fwd->listen_port,
(fwd->connect_path != ((void *)0)) ? fwd->connect_path
: fwd->connect_host,
fwd->connect_port);
break;
default:
sshfatal("mux.c", __func__, 560, 1, SYSLOG_LEVEL_FATAL, ((void *)0),
"unknown forward type %u", ftype);
}
return ret;
} | int format_forward(unsigned long a0, unsigned long long a1[6]) {
unsigned long v0;
char v1;
unsigned long long v3;
if (a0 == 3) {
if (a1[0]) {
v3 = a1[0];
} else if (!*(&sshbuf_get_cstring)) {
v3 = "LOCALHOST";
} else {
v3 = "*";
}
xasprintf(&v1, "dynamic forward %.200s:%d -> *", v3);
} else {
if (a0 <= 3) {
if (a0 == 1) {
if (a1[2]) {
v3 = a1[2];
} else if (a1[0]) {
v3 = a1[0];
} else if (!*(&sshbuf_get_cstring)) {
v3 = "LOCALHOST";
} else {
v3 = "*";
}
xasprintf(&v1, "local forward %.200s:%d -> %.200s:%d", v3);
goto LABEL_401703;
}
if (a0 == 2) {
if (a1[2]) {
v3 = a1[2];
} else if (!a1[0]) {
v3 = "LOCALHOST";
} else {
v3 = a1[0];
}
xasprintf(&v1, "remote forward %.200s:%d -> %.200s:%d", v3);
goto LABEL_401703;
}
}
v0 = a0;
sshfatal("mux.c", "format_forward", 0x230, 0x1, 0x1, 0x0,
"unknown forward type %u");
}
LABEL_401703:
*(&v3) = *(&v1);
return v3;
} | openssh-portable | angr_phoenix |
int addr_unicast_masklen(int af) {
switch (af) {
case 2:
return 32;
case 10:
return 128;
default:
return -1;
}
} | int addr_unicast_masklen(unsigned long a0) {
unsigned int v1;
if (a0 == 2) {
v1 = 32;
} else if (a0 == 10) {
v1 = 128;
} else {
v1 = -1;
}
return v1;
} | openssh-portable | angr_phoenix |
static intmax_t exp4() {
register intmax_t val1, val2;
val1 = expshift();
while ((curtok == 3) || (curtok == 4) || (curtok == '<') || (curtok == '>')) {
int op = curtok;
readtok();
val2 = expshift();
if (op == 3)
val1 = val1 <= val2;
else if (op == 4)
val1 = val1 >= val2;
else if (op == '<')
val1 = val1 < val2;
else
val1 = val1 > val2;
lasttok = 6;
}
return (val1);
} | int exp4(unsigned long long a0, unsigned long long a1, unsigned long a2,
unsigned long long a3) {
unsigned int v0;
unsigned long v2;
unsigned long long v3;
unsigned long long v4;
unsigned long long v5;
v2 = expshift(a0, a1, a2, a3);
while (true) {
switch (curtok) {
case 3:
case 4:
case 60:
case 62:
v0 = curtok;
readtok(a0, a1, a2, a3, v3, v4);
v5 = expshift(a0, a1, a2, a3);
switch (v0) {
case 3:
*(&v5) = v2 <= v5;
v2 = *(&v5);
break;
case 4:
*(&v5) = v5 <= v2;
v2 = *(&v5);
break;
case 60:
*(&v5) = v2 < v5;
v2 = *(&v5);
break;
default:
*(&v5) = v5 < v2;
v2 = *(&v5);
break;
}
lasttok = 6;
break;
default:
goto LABEL_4014e4;
}
}
LABEL_4014e4:
return v2;
} | bash | angr_sailr |
char *cond_expand_word(w, special)
WORD_DESC *w;
int special;
{
char *r, *p;
WORD_LIST *l;
int qflags;
if (w->word == 0 || w->word[0] == '\0')
return ((char *)((void *)0));
expand_no_split_dollar_star = 1;
w->flags |= (1 << 6);
qflags = (special == 3) ? 0x100 : 0;
l = call_expand_word_internal(w, qflags, 0, (int *)0, (int *)0);
expand_no_split_dollar_star = 0;
if (l) {
if (special == 0) {
if (l->word)
word_list_remove_quoted_nulls(l);
dequote_list(l);
r = string_list(l);
} else if (special == 3) {
if (l->word)
word_list_remove_quoted_nulls(l);
dequote_list(l);
r = string_list(l);
} else {
qflags = 0x01 | 0x08;
if (special == 2)
qflags |= 0x04;
word_list_remove_quoted_nulls(l);
p = string_list(l);
r = quote_string_for_globbing(p, qflags);
sh_xfree((p), "subst.c", 4148);
}
dispose_words(l);
} else
r = (char *)((void *)0);
return r;
} | undefined8 cond_expand_word(char **param_1, int param_2)
{
undefined4 uVar1;
long lVar2;
undefined8 uVar3;
undefined4 local_24;
undefined8 local_20;
if ((*param_1 == (char *)0x0) || (**param_1 == '\0')) {
local_20 = 0;
} else {
expand_no_split_dollar_star = 1;
*(uint *)(param_1 + 1) = *(uint *)(param_1 + 1) | 0x40;
if (param_2 == 3) {
uVar1 = 0x100;
} else {
uVar1 = 0;
}
lVar2 = call_expand_word_internal(param_1, uVar1, 0, 0, 0);
expand_no_split_dollar_star = 0;
if (lVar2 == 0) {
local_20 = 0;
} else {
if (param_2 == 0) {
if (*(long *)(lVar2 + 8) != 0) {
word_list_remove_quoted_nulls(lVar2);
}
dequote_list(lVar2);
local_20 = string_list(lVar2);
} else if (param_2 == 3) {
if (*(long *)(lVar2 + 8) != 0) {
word_list_remove_quoted_nulls(lVar2);
}
dequote_list(lVar2);
local_20 = string_list(lVar2);
} else {
local_24 = 9;
if (param_2 == 2) {
local_24 = 0xd;
}
word_list_remove_quoted_nulls(lVar2);
uVar3 = string_list(lVar2);
local_20 = quote_string_for_globbing(uVar3, local_24);
sh_xfree(uVar3, "subst.c", 0x1034);
}
dispose_words(lVar2);
}
}
return local_20;
} | bash | ghidra |
prompt_get(EditLine *el, el_pfunc_t *prf, wchar_t *c, int op) {
el_prompt_t *p;
if (prf == ((void *)0))
return -1;
if (op == 0)
p = &el->el_prompt;
else
p = &el->el_rprompt;
if (prf)
*prf = p->p_func;
if (c)
*c = p->p_ignore;
return 0;
} | long long prompt_get(unsigned long a0, unsigned long long *a1, unsigned int *a2,
unsigned long a3) {
struct_0 *v0;
unsigned long long v2;
if (!a1) {
v2 = 4294967295;
} else {
if (!a3)
v0 = a0 + 800;
else
v0 = a0 + 824;
if (a1)
*(a1) = v0->field_0;
if (a2)
*(a2) = v0->field_10;
v2 = 0;
}
return v2;
} | libedit | angr_phoenix |
static int reserve(struct bitmap *b, u_int n) {
u_int *tmp;
size_t nlen;
if (b->top >= b->len || n > (1 << 24))
return -1;
nlen = (n / (sizeof(u_int) * 8)) + 1;
if (b->len < nlen) {
if ((tmp = recallocarray(b->d, b->len, nlen, (sizeof(u_int)))) ==
((void *)0))
return -1;
b->d = tmp;
b->len = nlen;
}
return 0;
} | int reserve(unsigned long long a0[3], unsigned long a1) {
unsigned long long v0;
unsigned long v1;
unsigned int v3;
if (a0[2] < a0[1] && a1 <= 0x1000000) {
v0 = (a1 >> 5) + 1;
if (v0 > a0[1]) {
v1 = recallocarray(a0[0], a0[1], v0, 0x4);
if (!v1) {
v3 = -1;
} else {
a0[0] = v1;
a0[1] = v0;
}
}
if (v0 <= a0[1] || v1)
v3 = 0;
}
if (a1 > 0x1000000 || a0[2] >= a0[1])
v3 = -1;
return v3;
} | openssh-portable | angr_dream |
void complete_pending_execdirs(void) {
if (state.execdirs_outstanding) {
do_complete_pending_execdirs(get_eval_tree());
state.execdirs_outstanding = 0;
}
} | long complete_pending_execdirs() {
long result;
long eval_tree;
result = LOBYTE(state[10]);
if ((_BYTE)result) {
eval_tree = get_eval_tree();
result = do_complete_pending_execdirs(eval_tree);
LOBYTE(state[10]) = 0;
}
return result;
} | findutils | ida |
int tok_str(Tokenizer *tok, const char *line, int *argc, const char ***argv) {
LineInfo li;
memset(&li, 0, sizeof(li));
li.buffer = line;
li.cursor = li.lastchar = strchr(line, '\0');
return tok_line(tok, &li, argc, argv, ((void *)0), ((void *)0));
} | void tok_str(undefined8 param_1, char *param_2, undefined8 param_3,
undefined8 param_4)
{
long in_FS_OFFSET;
char *local_28;
char *local_20;
char *local_18;
long local_10;
local_10 = *(long *)(in_FS_OFFSET + 0x28);
memset(&local_28, 0, 0x18);
local_28 = param_2;
local_20 = strchr(param_2, 0);
local_18 = local_20;
tok_line(param_1, &local_28, param_3, param_4, 0, 0);
if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) {
__stack_chk_fail();
}
return;
} | libedit | ghidra |
static int execute_intern_function(name, funcdef)
WORD_DESC *name;
FUNCTION_DEF *funcdef;
{
SHELL_VAR *var;
char *t;
if (check_identifier(name, posixly_correct) == 0) {
if (posixly_correct && interactive_shell == 0) {
last_command_exit_value = 2;
jump_to_top_level(4);
}
return (1);
}
if (strchr(name->word, '\001')) {
t = dequote_escapes(name->word);
sh_xfree((name->word), "execute_cmd.c", 6129);
name->word = t;
}
if (posixly_correct && find_special_builtin(name->word)) {
internal_error(gettext("`%s': is a special builtin"), name->word);
last_command_exit_value = 2;
jump_to_top_level(interactive_shell ? 2 : 4);
}
var = find_function(name->word);
if (var && (((((var)->attributes) & (0x0000002))) ||
((((var)->attributes) & (0x0004000))))) {
if (((((var)->attributes) & (0x0000002))))
internal_error(gettext("%s: readonly function"), var->name);
return (1);
}
bind_function_def(name->word, funcdef, 1);
bind_function(name->word, funcdef->command);
return (0);
} | long execute_intern_function(const char **a1, long a2) {
const char *v3;
char *v4;
unsigned int v5;
long v6;
char *v7;
const char *v8;
long function;
if ((unsigned int)check_identifier(a1, posixly_correct)) {
if (strchr(*a1, 1)) {
v8 = (const char *)dequote_escapes(*a1);
sh_xfree(*a1, "execute_cmd.c", 6129LL);
*a1 = v8;
}
if (posixly_correct && find_special_builtin(*a1)) {
v3 = *a1;
v4 = gettext("`%s': is a special builtin");
internal_error(v4, v3);
last_command_exit_value = 2;
if (interactive_shell)
v5 = 2;
else
v5 = 4;
jump_to_top_level(v5);
}
function = find_function(*a1);
if (function && ((*(_DWORD *)(function + 40) & 2) != 0 ||
(*(_DWORD *)(function + 40) & 0x4000) != 0)) {
if ((*(_DWORD *)(function + 40) & 2) != 0) {
v6 = *(_QWORD *)function;
v7 = gettext("%s: readonly function");
internal_error(v7, v6);
}
return 1LL;
} else {
bind_function_def(*a1, a2, 1LL);
bind_function(*a1, *(_QWORD *)(a2 + 16));
return 0LL;
}
} else {
if (posixly_correct) {
if (!interactive_shell) {
last_command_exit_value = 2;
jump_to_top_level(4LL);
}
}
return 1LL;
}
} | bash | ida |
static int do_rmmod(int argc, char *argv[]) {
struct kmod_ctx *ctx;
const char *null_config = ((void *)0);
int flags = 0;
int i, err, r = 0;
for (;;) {
int c, idx = 0;
c = getopt_long(argc, argv, cmdopts_s, cmdopts, &idx);
if (c == -1)
break;
switch (c) {
case 'f':
flags |= KMOD_REMOVE_FORCE;
break;
case 's':
use_syslog = 1;
break;
case 'v':
verbose++;
break;
case 'h':
help();
return 0;
case 'V':
puts("kmod"
" version "
"30");
puts("-ZSTD -XZ -ZLIB -LIBCRYPTO -EXPERIMENTAL");
return 0;
case '?':
return 1;
default:
log_printf(3, "unexpected getopt_long() value '%c'.\n", c);
return 1;
}
}
log_open(use_syslog);
if (optind >= argc) {
log_printf(3, "missing module name.\n");
r = 1;
goto done;
}
ctx = kmod_new(((void *)0), &null_config);
if (!ctx) {
log_printf(3, "kmod_new() failed!\n");
r = 1;
goto done;
}
log_setup_kmod_log(ctx, verbose);
for (i = optind; i < argc; i++) {
struct kmod_module *mod;
const char *arg = argv[i];
struct stat st;
if (stat(arg, &st) == 0)
err = kmod_module_new_from_path(ctx, arg, &mod);
else
err = kmod_module_new_from_name(ctx, arg, &mod);
if (err < 0) {
log_printf(3, "could not use module %s: %s\n", arg, strerror(-err));
break;
}
if (!(flags & KMOD_REMOVE_FORCE) && check_module_inuse(mod) < 0) {
r++;
goto next;
}
err = kmod_module_remove_module(mod, flags);
if (err < 0) {
log_printf(3, "could not remove module %s: %s\n", arg, strerror(-err));
r++;
}
next:
kmod_module_unref(mod);
}
kmod_unref(ctx);
done:
log_close();
return r == 0 ? 0 : 1;
} | long long do_rmmod(unsigned long a0, unsigned long long *a1) {
unsigned int v0;
unsigned int v1;
unsigned int v2;
unsigned int v3;
unsigned int v4;
void *v5;
unsigned int v6;
unsigned long long v7;
char *v8;
char v9;
unsigned long long v11;
unsigned long long v13;
unsigned long long v14;
v5 = 0;
v0 = 0;
v3 = 0;
while (true) {
v6 = 0;
v4 = getopt_long(a0, a1, "fsvVwh", &cmdopts, &v6);
if (v4 == -1) {
log_open(use_syslog);
if (a0 <= optind) {
log_printf(0x3, "missing module name.\n", "fsvVwh");
v3 = 1;
} else {
v7 = kmod_new(0x0, &v5);
if (!v7) {
log_printf(0x3, "kmod_new() failed!\n", "fsvVwh");
v3 = 1;
} else {
log_setup_kmod_log(v7, verbose, verbose);
for (v1 = optind; v1 < a0; v1 += 1) {
v8 = a1[v1];
if (!stat(v8, &v9))
v2 = kmod_module_new_from_path(v7, v8, &v6, v8);
else
v2 = kmod_module_new_from_name(v7, v8, &v6, v8);
if (v2 < 0) {
strerror(-(v2));
log_printf(0x3, "could not use module %s: %s\n", v8);
break;
} else {
if (!(v0 & 0x200)) {
v14 = check_module_inuse(*(&v6), a1, v13);
if (v14 < 0)
v3 += 1;
}
if ((v0 & 0x200) || v14 >= 0) {
v2 = kmod_module_remove_module(*(&v6), v0, v0);
if (v2 < 0) {
strerror(-(v2));
log_printf(0x3, "could not remove module %s: %s\n", v8);
v3 += 1;
}
}
kmod_module_unref(*(&v6));
}
}
kmod_unref(v7);
}
}
log_close();
v11 = v3;
break;
} else if (v4 == 63) {
v11 = 1;
break;
} else if (v4 >= 63 && v4 <= 118 && v4 >= 86) {
switch (v4) {
case 86:
puts("kmod version 30");
puts("-ZSTD -XZ -ZLIB -LIBCRYPTO -EXPERIMENTAL");
v11 = 0;
break;
case 102:
v0 |= 0x200;
case 104:
help();
v11 = 0;
break;
case 115:
use_syslog = 1;
case 118:
verbose = verbose + 1;
default:
log_printf(0x3, "unexpected getopt_long() value '%c'.\n", v4);
v11 = 1;
break;
}
}
}
return v11;
} | kmod | angr_dream |
static int brace_expand(const char *pattern, char ***patternsp,
size_t *npatternsp) {
char *cp, *cp2, **active = ((void *)0), **done = ((void *)0);
size_t i, nactive = 0, ndone = 0;
int ret = -1, invalid = 0, expanded = 0;
*patternsp = ((void *)0);
*npatternsp = 0;
if ((cp = strdup(pattern)) == ((void *)0))
return -1;
if (append(cp, &active, &nactive) != 0) {
free(cp);
return -1;
}
while (nactive > 0) {
cp = active[nactive - 1];
nactive--;
if (brace_expand_one(cp, &active, &nactive, &expanded, &invalid) == -1) {
free(cp);
goto fail;
}
if (invalid)
sshfatal("scp.c", __func__, 920, 1, SYSLOG_LEVEL_FATAL, ((void *)0),
"invalid brace pattern \"%s\"", cp);
if (expanded) {
free(cp);
continue;
}
if ((cp2 = strrchr(cp, '/')) != ((void *)0))
*cp2++ = '\0';
else
cp2 = cp;
if (append(xstrdup(cp2), &done, &ndone) != 0) {
free(cp);
goto fail;
}
free(cp);
}
*patternsp = done;
*npatternsp = ndone;
done = ((void *)0);
ndone = 0;
ret = 0;
fail:
for (i = 0; i < nactive; i++)
free(active[i]);
free(active);
for (i = 0; i < ndone; i++)
free(done[i]);
free(done);
return ret;
} | undefined4 brace_expand(char *param_1, void **param_2, ulong *param_3)
{
void *pvVar1;
int iVar2;
undefined4 uVar3;
char *pcVar4;
undefined8 uVar5;
undefined *puVar6;
long in_FS_OFFSET;
char *apcStack144[3];
undefined auStack120[8];
ulong *local_70;
void **local_68;
char *local_60;
int local_54;
int local_50;
undefined4 local_4c;
void *local_48;
void *local_40;
ulong local_38;
ulong local_30;
char *local_28;
ulong local_20;
char *local_18;
long local_10;
puVar6 = auStack120;
local_10 = *(long *)(in_FS_OFFSET + 0x28);
local_48 = (void *)0x0;
local_40 = (void *)0x0;
local_38 = 0;
local_30 = 0;
local_4c = 0xffffffff;
local_54 = 0;
local_50 = 0;
*param_2 = (void *)0x0;
*param_3 = 0;
local_70 = param_3;
local_68 = param_2;
local_60 = param_1;
local_18 = strdup(param_1);
if (local_18 == (char *)0x0) {
puVar6 = auStack120;
uVar3 = 0xffffffff;
} else {
iVar2 = append(local_18, &local_48, &local_38);
if (iVar2 == 0) {
while (local_38 != 0) {
local_18 = *(char **)((long)local_48 + local_38 * 8 + -8);
local_38 = local_38 - 1;
*(undefined8 *)(puVar6 + -8) = 0x101dd6;
iVar2 = brace_expand_one(local_18, &local_48, &local_38, &local_50,
&local_54);
if (iVar2 == -1) {
*(undefined8 *)(puVar6 + -8) = 0x101de7;
free(local_18);
goto LAB_00101ef0;
}
if (local_54 != 0) {
*(char **)(puVar6 + -8) = local_18;
*(char **)(puVar6 + -0x10) = "invalid brace pattern \"%s\"";
*(undefined8 *)(puVar6 + -0x18) = 0x101e2c;
sshfatal("scp.c", "brace_expand", 0x398, 1, 1, 0);
puVar6 = puVar6 + -0x10;
}
if (local_50 == 0) {
*(undefined8 *)(puVar6 + -8) = 0x101e52;
pcVar4 = strrchr(local_18, 0x2f);
if (pcVar4 == (char *)0x0) {
local_28 = local_18;
} else {
local_28 = pcVar4 + 1;
*pcVar4 = '\0';
}
*(undefined8 *)(puVar6 + -8) = 0x101e82;
uVar5 = xstrdup(local_28);
*(undefined8 *)(puVar6 + -8) = 0x101e98;
iVar2 = append(uVar5, &local_40, &local_30);
if (iVar2 != 0) {
*(undefined8 *)(puVar6 + -8) = 0x101ea8;
free(local_18);
goto LAB_00101ef0;
}
*(undefined8 *)(puVar6 + -8) = 0x101eb6;
free(local_18);
} else {
*(undefined8 *)(puVar6 + -8) = 0x101e3f;
free(local_18);
}
}
*local_68 = local_40;
*local_70 = local_30;
local_40 = (void *)0x0;
local_30 = 0;
local_4c = 0;
LAB_00101ef0:
for (local_20 = 0; pvVar1 = local_48, local_20 < local_38;
local_20 = local_20 + 1) {
pvVar1 = *(void **)((long)local_48 + local_20 * 8);
*(undefined8 *)(puVar6 + -8) = 0x101f14;
free(pvVar1);
}
*(undefined8 *)(puVar6 + -8) = 0x101f2f;
free(pvVar1);
for (local_20 = 0; pvVar1 = local_40, local_20 < local_30;
local_20 = local_20 + 1) {
pvVar1 = *(void **)((long)local_40 + local_20 * 8);
*(undefined8 *)(puVar6 + -8) = 0x101f53;
free(pvVar1);
}
*(undefined8 *)(puVar6 + -8) = 0x101f6e;
free(pvVar1);
uVar3 = local_4c;
} else {
free(local_18);
puVar6 = auStack120;
uVar3 = 0xffffffff;
}
}
if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) {
*(undefined8 *)(puVar6 + -8) = 0x101f85;
__stack_chk_fail();
}
return uVar3;
} | openssh-portable | ghidra |
vi_paste_next(EditLine *el, wint_t c __attribute__((__unused__))) {
return cv_paste(el, 0);
} | long long vi_paste_next(void *a0, unsigned long a1) {
unsigned int v0;
v0 = a1;
return cv_paste(a0, 0x0);
} | libedit | angr_phoenix |
int rl_complete(int ignore __attribute__((__unused__)), int invoking_key) {
static ct_buffer_t wbreak_conv, sprefix_conv;
const char *breakchars;
if (h == ((void *)0) || e == ((void *)0))
rl_initialize();
if (rl_inhibit_completion) {
char arr[2];
arr[0] = (char)invoking_key;
arr[1] = '\0';
el_insertstr(e, arr);
return 4;
}
if (rl_completion_word_break_hook != ((void *)0))
breakchars = (*rl_completion_word_break_hook)();
else
breakchars = rl_basic_word_break_characters;
_rl_update_pos();
return fn_complete(
e, (rl_compentry_func_t *)rl_completion_entry_function,
rl_attempted_completion_function,
ct_decode_string(rl_basic_word_break_characters, &wbreak_conv),
ct_decode_string(breakchars, &sprefix_conv),
_rl_completion_append_character_function,
(size_t)rl_completion_query_items, &rl_completion_type,
&rl_attempted_completion_over, &rl_point, &rl_end);
} | undefined8 rl_complete(undefined8 param_1, undefined param_2)
{
int iVar1;
undefined8 uVar2;
undefined8 uVar3;
long in_FS_OFFSET;
undefined8 uVar4;
undefined8 local_30;
undefined local_22;
undefined local_21;
long local_20;
local_20 = *(long *)(in_FS_OFFSET + 0x28);
if ((h == 0) || (e == 0)) {
rl_initialize();
}
if (*piRam0000000000104565 == 0) {
if (*plRam000000000010459c == 0) {
local_30 = *puRam00000000001045bd;
} else {
local_30 = (**ppcRam00000000001045ab)();
}
_rl_update_pos();
iVar1 = *piRam00000000001045d0;
uVar2 = ct_decode_string(local_30, sprefix_conv_6932);
uVar4 = 0x104604;
uVar3 = ct_decode_string(*puRam00000000001045f2, wbreak_conv_6931);
uVar2 = fn_complete(e, *puRam0000000000104618, *puRam000000000010460e,
uVar3, uVar2, _rl_completion_append_character_function,
(long)iVar1, uRam0000000000104645, uRam000000000010463d,
uRam0000000000104635, uRam000000000010462d, uVar4);
} else {
local_21 = 0;
local_22 = param_2;
el_insertstr(e, &local_22);
uVar2 = 4;
}
if (local_20 != *(long *)(in_FS_OFFSET + 0x28)) {
__stack_chk_fail();
}
return uVar2;
} | libedit | ghidra |
static void print_explain(FILE *f) {
fprintf(f, "Usage: ... gtp role ROLE\n"
" [ hsize HSIZE ]\n"
" [ restart_count RESTART_COUNT ]\n"
"\n"
"Where: ROLE := { sgsn | ggsn }\n"
" HSIZE := 1-131071\n"
" RESTART_COUNT := 0-255\n");
} | void print_explain(void *a0) {
unsigned long long v1;
v1 = fprintf(a0,
"Usage: ... gtp role ROLE\n\t\t[ hsize HSIZE ]\n\t\t[ "
"restart_count RESTART_COUNT ]\n\nWhere:\tROLE\t\t:= { sgsn | "
"ggsn }\n\tHSIZE\t\t:= 1-131071\n\tRESTART_COUNT\t:= 0-255\n");
return;
} | iproute2-6.0.0 | angr_phoenix |
static int skiploop(void) {
int skip = evalskip;
switch (skip) {
case 0:
break;
case (1 << 0):
case (1 << 1):
if (__builtin_expect(!!(--skipcount <= 0), 1)) {
evalskip = 0;
break;
}
skip = (1 << 0);
break;
}
return skip;
} | long skiploop() {
unsigned int v1;
v1 = evalskip;
if (evalskip > 0 && (unsigned int)(evalskip - 1) <= 1) {
if (--skipcount > 0)
return 1;
else
evalskip = 0;
}
return v1;
} | dash-0.5.11+git20210903+057cd650a4ed | ida |
static void dump_cfg_string(ServerOpCodes code, const char *val) {
printf("%s %s\n", lookup_opcode_name(code),
val == ((void *)0) ? "none" : val);
} | void dump_cfg_string(unsigned long a0, unsigned long a1) {
unsigned int v1;
unsigned long long v2;
if (!a1)
v1 = &g_40b1c0;
else
v1 = a1;
v2 = printf("%s %s\n", lookup_opcode_name(a0), v1);
return;
} | openssh-portable | angr_phoenix |
static errcode_t recover_ext3_journal(e2fsck_t ctx) {
struct problem_context pctx;
journal_t *journal;
errcode_t retval;
clear_problem_context(&pctx);
retval = jbd2_journal_init_revoke_record_cache();
if (retval)
return retval;
retval = jbd2_journal_init_revoke_table_cache();
if (retval)
return retval;
retval = e2fsck_get_journal(ctx, &journal);
if (retval)
return retval;
retval = e2fsck_journal_load(journal);
if (retval)
goto errout;
retval = jbd2_journal_init_revoke(journal, 1024);
if (retval)
goto errout;
retval = -jbd2_journal_recover(journal);
if (retval)
goto errout;
if (journal->j_failed_commit) {
pctx.ino = journal->j_failed_commit;
fix_problem(ctx, 0x00003A, &pctx);
journal->j_superblock->s_errno = -22;
mark_buffer_dirty(journal->j_sb_buffer);
}
journal->j_tail_sequence = journal->j_transaction_sequence;
errout:
jbd2_journal_destroy_revoke(journal);
jbd2_journal_destroy_revoke_record_cache();
jbd2_journal_destroy_revoke_table_cache();
e2fsck_journal_release(ctx, journal, 1, 0);
return retval;
} | long recover_ext3_journal(const void **a1) {
int inited;
int v3;
int v4;
int v5;
long v6;
long journal;
char v8[8];
int v9;
unsigned long v10;
v10 = __readfsqword(0x28u);
clear_problem_context(v8);
inited = jbd2_journal_init_revoke_record_cache();
journal = inited;
if (inited)
return journal;
v3 = jbd2_journal_init_revoke_table_cache();
journal = v3;
if (v3)
return journal;
journal = e2fsck_get_journal(a1, &v6);
if (journal)
return journal;
journal = e2fsck_journal_load(v6);
if (!journal) {
v4 = jbd2_journal_init_revoke(v6, 1024LL);
journal = v4;
if (!v4) {
v5 = jbd2_journal_recover(v6);
journal = -v5;
if (!v5) {
if (*(_DWORD *)(v6 + 192)) {
v9 = *(_DWORD *)(v6 + 192);
fix_problem(a1, 58LL, v8);
*(_DWORD *)(*(_QWORD *)(v6 + 24) + 32LL) = -22;
mark_buffer_dirty(*(_QWORD *)(v6 + 16));
}
*(_DWORD *)(v6 + 144) = *(_DWORD *)(v6 + 148);
}
}
}
jbd2_journal_destroy_revoke(v6);
jbd2_journal_destroy_revoke_record_cache();
jbd2_journal_destroy_revoke_table_cache();
e2fsck_journal_release((long)a1, v6, 1, 0);
return journal;
} | e2fsprogs-1.46.5 | ida |
int addr_xaddr_to_sa(const struct xaddr *xa, struct sockaddr *sa,
socklen_t *len, u_int16_t port) {
struct sockaddr_in *in4 = (struct sockaddr_in *)sa;
struct sockaddr_in6 *in6 = (struct sockaddr_in6 *)sa;
if (xa == ((void *)0) || sa == ((void *)0) || len == ((void *)0))
return -1;
switch (xa->af) {
case 2:
if (*len < sizeof(*in4))
return -1;
memset(sa, '\0', sizeof(*in4));
*len = sizeof(*in4);
in4->sin_family = 2;
in4->sin_port = htons(port);
memcpy(&in4->sin_addr, &xa->xa.v4, sizeof(in4->sin_addr));
break;
case 10:
if (*len < sizeof(*in6))
return -1;
memset(sa, '\0', sizeof(*in6));
*len = sizeof(*in6);
in6->sin6_family = 10;
in6->sin6_port = htons(port);
memcpy(&in6->sin6_addr, &xa->xa.v6, sizeof(in6->sin6_addr));
in6->sin6_scope_id = xa->scope_id;
break;
default:
return -1;
}
return 0;
} | int addr_xaddr_to_sa(struct_0 *a0, void *a1, unsigned int *a2,
unsigned long a3) {
unsigned short v0[2];
struct_1 *v1;
unsigned int v3;
*(&v0) = a1;
v1 = a1;
if (!a0) {
LABEL_4000bb:
v3 = -1;
} else {
if (!a1)
goto LABEL_4000bb;
if (!a2)
goto LABEL_4000bb;
if (a0->field_0 == 2) {
if (*(a2) <= 15) {
v3 = -1;
goto LABEL_4001de;
} else {
memset(a1, 0x0, 0x10);
*(a2) = 16;
v0[0] = 2;
v0[1] = htons(a3);
memcpy(v0 + 1, &a0->padding_2[2], 0x4);
}
} else {
if (a0->field_0 != 10) {
v3 = -1;
goto LABEL_4001de;
} else if (*(a2) <= 27) {
v3 = -1;
goto LABEL_4001de;
} else {
memset(a1, 0x0, 0x1c);
*(a2) = 28;
v1->field_0 = 10;
v1->field_2 = htons(a3);
memcpy(&v1->padding_4[4], &a0->padding_2[2], 0x10);
v1->field_18 = a0->field_14;
}
}
v3 = 0;
}
LABEL_4001de:
return v3;
} | openssh-portable | angr_phoenix |
static int collsym(s, len)
unsigned char *s;
int len;
{
register struct _collsym *csp;
char *x;
x = (char *)s;
for (csp = posix_collsyms; csp->name; csp++) {
if (((csp->name)[0] == (x)[0] && strncmp(csp->name, x, len) == 0) &&
csp->name[len] == '\0')
return (csp->code);
}
if (len == 1)
return s[0];
return -1;
} | int collsym(char *a0, unsigned long a1) {
unsigned long long v1;
unsigned int v2;
v1 = &posix_collsyms;
while (true) {
if (*(v1)) {
if (*(*(v1)) == *(a0) && !strncmp(*(v1), a0, a1) && !*((a1 + *(v1)))) {
v2 = *((v1 + 8));
return v2;
}
v1 += 16;
} else {
v2 = (a1 == 1 ? -1 : *(a0));
return v2;
}
}
} | bash | angr_sailr |
static void parse_dest_constraint(const char *s, struct dest_constraint ***dcp,
size_t *ndcp, char **hostkey_files) {
struct dest_constraint *dc;
char *os, *cp;
dc = xcalloc(1, sizeof(*dc));
os = xstrdup(s);
if ((cp = strchr(os, '>')) == ((void *)0)) {
parse_dest_constraint_hop(os, &dc->to, hostkey_files);
} else {
*(cp++) = '\0';
parse_dest_constraint_hop(os, &dc->from, hostkey_files);
parse_dest_constraint_hop(cp, &dc->to, hostkey_files);
if (dc->from.user != ((void *)0)) {
sshfatal("ssh-add.c", __func__, 750, 0, SYSLOG_LEVEL_FATAL, ((void *)0),
"Invalid key constraint %s: cannot specify "
"user on 'from' host",
os);
}
}
sshlog("ssh-add.c", __func__, 755, 1, SYSLOG_LEVEL_DEBUG2, ((void *)0),
"constraint %zu: %s%s%s (%u keys) > %s%s%s (%u keys)", *ndcp,
dc->from.user ? dc->from.user : "", dc->from.user ? "@" : "",
dc->from.hostname ? dc->from.hostname : "(ORIGIN)", dc->from.nkeys,
dc->to.user ? dc->to.user : "", dc->to.user ? "@" : "",
dc->to.hostname ? dc->to.hostname : "(ANY)", dc->to.nkeys)
;
*dcp = xrecallocarray(*dcp, *ndcp, *ndcp + 1, sizeof(**dcp));
(*dcp)[(*ndcp)++] = dc;
free(os);
} | void parse_dest_constraint(undefined8 param_1, long *param_2, long *param_3,
undefined8 param_4)
{
uint uVar1;
long lVar2;
long lVar3;
char *pcVar4;
undefined *puVar5;
long lVar6;
undefined *puVar7;
char *pcVar8;
char **ppcVar9;
undefined *puVar10;
undefined *puVar11;
char *pcStack88;
char *pcStack80;
undefined8 local_48;
long *local_40;
long *local_38;
undefined8 local_30;
long *local_20;
char *local_18;
char *local_10;
ppcVar9 = (char **)&local_48;
pcStack80 = (char *)0x102363;
local_48 = param_4;
local_40 = param_3;
local_38 = param_2;
local_30 = param_1;
local_20 = (long *)xcalloc(1, 0x50);
pcStack80 = (char *)0x102373;
local_18 = (char *)xstrdup(local_30);
pcStack80 = (char *)0x102388;
pcVar4 = strchr(local_18, 0x3e);
if (pcVar4 == (char *)0x0) {
pcStack80 = (char *)0x1023ae;
local_10 = pcVar4;
parse_dest_constraint_hop(local_18, local_20 + 5, local_48);
ppcVar9 = (char **)&local_48;
} else {
local_10 = pcVar4 + 1;
*pcVar4 = '\0';
pcStack80 = (char *)0x1023d9;
parse_dest_constraint_hop(local_18, local_20, local_48);
pcStack80 = (char *)0x1023f4;
parse_dest_constraint_hop(local_10, local_20 + 5, local_48);
if (*local_20 != 0) {
pcStack80 = local_18;
ppcVar9 = &pcStack88;
pcStack88 =
"Invalid key constraint %s: cannot specify user on \'from\' host";
sshfatal("ssh-add.c", "parse_dest_constraint", 0x2ee, 0, 1, 0);
}
}
if (local_20[6] == 0) {
pcVar4 = "(ANY)";
} else {
pcVar4 = (char *)local_20[6];
}
if (local_20[5] == 0) {
puVar11 = &DAT_001033df;
} else {
puVar11 = &DAT_001038c8;
}
if (local_20[5] == 0) {
puVar7 = &DAT_001033df;
} else {
puVar7 = (undefined *)local_20[5];
}
uVar1 = *(uint *)((long)local_20 + 0x14);
if (local_20[1] == 0) {
pcVar8 = "(ORIGIN)";
} else {
pcVar8 = (char *)local_20[1];
}
if (*local_20 == 0) {
puVar10 = &DAT_001033df;
} else {
puVar10 = &DAT_001038c8;
}
if (*local_20 == 0) {
puVar5 = &DAT_001033df;
} else {
puVar5 = (undefined *)*local_20;
}
lVar6 = *local_40;
*(ulong *)((long)ppcVar9 + -8) = (ulong) * (uint *)((long)local_20 + 0x3c);
*(char **)((long)ppcVar9 + -0x10) = pcVar4;
*(undefined **)((long)ppcVar9 + -0x18) = puVar11;
*(undefined **)((long)ppcVar9 + -0x20) = puVar7;
*(ulong *)((long)ppcVar9 + -0x28) = (ulong)uVar1;
*(char **)((long)ppcVar9 + -0x30) = pcVar8;
*(undefined **)((long)ppcVar9 + -0x38) = puVar10;
*(undefined **)((long)ppcVar9 + -0x40) = puVar5;
*(long *)((long)ppcVar9 + -0x48) = lVar6;
*(char **)((long)ppcVar9 + -0x50) =
"constraint %zu: %s%s%s (%u keys) > %s%s%s (%u keys)";
*(undefined8 *)((long)ppcVar9 + -0x58) = 0x102542;
sshlog("ssh-add.c", "parse_dest_constraint", 0x2f3, 1, 6, 0);
lVar6 = *local_40;
lVar2 = *local_40;
lVar3 = *local_38;
*(undefined8 *)((long)ppcVar9 + -8) = 0x10256c;
lVar6 = xrecallocarray(lVar3, lVar2, lVar6 + 1, 8);
*local_38 = lVar6;
lVar6 = *local_38;
lVar2 = *local_40;
*local_40 = lVar2 + 1;
*(long **)(lVar6 + lVar2 * 8) = local_20;
*(undefined8 *)((long)ppcVar9 + -8) = 0x1025a7;
free(local_18);
return;
} | openssh-portable | ghidra |
static void pkg_array_list_item(struct pkg_array *array, struct pkginfo *pkg,
void *pkg_data) {
struct list_format *fmt = pkg_data;
int l;
const char *pdesc;
list_format_init(fmt, array);
list_format_print_header(fmt);
pdesc = pkg_synopsis(pkg, &l);
l = ((l) < (fmt->dw) ? (l) : (fmt->dw));
list_format_print(fmt, pkg_abbrev_want(pkg), pkg_abbrev_status(pkg),
pkg_abbrev_eflag(pkg), pkg_name(pkg, pnaw_nonambig),
versiondescribe(&pkg->installed.version, vdew_nonambig),
dpkg_arch_describe(pkg->installed.arch), pdesc, l);
} | long long pkg_array_list_item(void *a0, struct_0 *a1, struct_1 *a2) {
unsigned long long v0;
char v1;
unsigned long long v2;
unsigned int v4;
list_format_init(a2, a0);
list_format_print_header(a2);
v2 = pkg_synopsis(a1, &v1, &v1);
v4 = *(&v1);
if (a2->field_10 <= *(&v1))
v4 = a2->field_10;
v1 = v4;
v0 = versiondescribe(&a1[1].padding_0[56], 0x1, &v1);
list_format_print(a2, pkg_abbrev_want(a1), pkg_abbrev_status(a1),
pkg_abbrev_eflag(a1), pkg_name(a1, 0x1, &v1), v0,
dpkg_arch_describe(a1->field_58), v2, v1);
return 0;
} | dpkg | angr_sailr |
static int extract_node(char *file_name, int typeflag) {
_Bool interdir_made = 0;
mode_t mode =
(current_stat_info.stat.st_mode &
((0100 | (0100 >> 3) | ((0100 >> 3) >> 3) |
(0200 | (0200 >> 3) | ((0200 >> 3) >> 3) |
(0400 | (0400 >> 3) | ((0400 >> 3) >> 3)))) |
0060000 | 0020000) &
~(0 < same_owner_option
? ((0400 | 0200 | 0100) >> 3) | (((0400 | 0200 | 0100) >> 3) >> 3)
: 0));
while (mknodat(chdir_fd, file_name, mode, current_stat_info.stat.st_rdev) !=
0)
switch (maybe_recoverable(file_name, 0, &interdir_made)) {
case 1:
continue;
case 2:
return 0;
case 0:
mknod_error(file_name);
return -1;
}
set_stat(file_name, ¤t_stat_info, -1, mode & ~current_umask,
(0100 | (0100 >> 3) | ((0100 >> 3) >> 3) |
(0200 | (0200 >> 3) | ((0200 >> 3) >> 3) |
(0400 | (0400 >> 3) | ((0400 >> 3) >> 3)))),
typeflag, 0, 0x100);
return 0;
} | long long extract_node(unsigned long a0, unsigned long a1) {
char v0;
unsigned int v1;
unsigned long long v4;
unsigned long long v5;
v0 = 0;
v1 = (same_owner_option <= 0 ? -64 : -1) & remove_any_file & 25087;
while (true) {
do {
if (!mknodat(chdir_fd, a0, v1, mknodat)) {
set_stat(a0, ¤t_stat_info, 0xffffffff, !(current_umask)&v1, 0x1ff,
a1, 0x0, 0x100);
v5 = 0;
return v5;
}
v4 = maybe_recoverable(a0, 0x0, &v0);
if (v4 == 2) {
v5 = 0;
return v5;
}
} while (v4 > 2);
if (!v4)
break;
}
mknod_error(a0);
v5 = 4294967295;
return v5;
} | tar | angr_sailr |
static int process_journal_block(ext2_filsys fs, blk64_t *block_nr,
e2_blkcnt_t blockcnt,
blk64_t ref_block __attribute__((unused)),
int ref_offset __attribute__((unused)),
void *priv_data) {
struct process_block_struct *p;
blk64_t blk = *block_nr;
p = (struct process_block_struct *)priv_data;
if (!blk || blk < fs->super->s_first_data_block ||
blk >= ext2fs_blocks_count(fs->super))
return 2;
if (blockcnt >= 0)
p->last_block = blockcnt;
return 0;
} | long long process_journal_block(struct_0 *a0, unsigned long long *a1,
unsigned long a2, unsigned long a3,
unsigned long a4, unsigned long long *a5) {
unsigned int v0;
unsigned long v1;
unsigned long v2;
unsigned long long v4;
v1 = a3;
v0 = a4;
v2 = *(a1);
if (!v2) {
LABEL_400fd7:
v4 = 2;
} else {
if (v2 < a0->field_20->field_14)
goto LABEL_400fd7;
if (!(v2 < ext2fs_blocks_count(a0->field_20)))
goto LABEL_400fd7;
if (!((a2 - 0 >> 63)))
*(a5) = a2;
v4 = 0;
}
return v4;
} | e2fsprogs-1.46.5 | angr_phoenix |
static int stat_for_ino(char const *name, struct stat *st) {
return do_statx(-100, name, st, 0, 0x00000100U);
} | int stat_for_ino(unsigned long long a0, void *a1) {
return do_statx(0xffffff9c, a0, a1, 0x0, 0x100);
} | coreutils | angr_dream |
static void chacha_encrypt_bytes(chacha_ctx *x, const u8 *m, u8 *c, u32 bytes) {
u32 x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15;
u32 j0, j1, j2, j3, j4, j5, j6, j7, j8, j9, j10, j11, j12, j13, j14, j15;
u8 *ctarget = ((void *)0);
u8 tmp[64];
unsigned int i;
if (!bytes)
return;
j0 = x->input[0];
j1 = x->input[1];
j2 = x->input[2];
j3 = x->input[3];
j4 = x->input[4];
j5 = x->input[5];
j6 = x->input[6];
j7 = x->input[7];
j8 = x->input[8];
j9 = x->input[9];
j10 = x->input[10];
j11 = x->input[11];
j12 = x->input[12];
j13 = x->input[13];
j14 = x->input[14];
j15 = x->input[15];
for (;;) {
if (bytes < 64) {
for (i = 0; i < bytes; ++i)
tmp[i] = m[i];
m = tmp;
ctarget = c;
c = tmp;
}
x0 = j0;
x1 = j1;
x2 = j2;
x3 = j3;
x4 = j4;
x5 = j5;
x6 = j6;
x7 = j7;
x8 = j8;
x9 = j9;
x10 = j10;
x11 = j11;
x12 = j12;
x13 = j13;
x14 = j14;
x15 = j15;
for (i = 20; i > 0; i -= 2) {
x0 = (((u32)((x0) + (x4)) & (0xFFFFFFFFU)));
x12 = ((((u32)((((x12) ^ (x0))) << (16)) & (0xFFFFFFFFU)) |
((((x12) ^ (x0))) >> (32 - (16)))));
x8 = (((u32)((x8) + (x12)) & (0xFFFFFFFFU)));
x4 = ((((u32)((((x4) ^ (x8))) << (12)) & (0xFFFFFFFFU)) |
((((x4) ^ (x8))) >> (32 - (12)))));
x0 = (((u32)((x0) + (x4)) & (0xFFFFFFFFU)));
x12 = ((((u32)((((x12) ^ (x0))) << (8)) & (0xFFFFFFFFU)) |
((((x12) ^ (x0))) >> (32 - (8)))));
x8 = (((u32)((x8) + (x12)) & (0xFFFFFFFFU)));
x4 = ((((u32)((((x4) ^ (x8))) << (7)) & (0xFFFFFFFFU)) |
((((x4) ^ (x8))) >> (32 - (7)))));
x1 = (((u32)((x1) + (x5)) & (0xFFFFFFFFU)));
x13 = ((((u32)((((x13) ^ (x1))) << (16)) & (0xFFFFFFFFU)) |
((((x13) ^ (x1))) >> (32 - (16)))));
x9 = (((u32)((x9) + (x13)) & (0xFFFFFFFFU)));
x5 = ((((u32)((((x5) ^ (x9))) << (12)) & (0xFFFFFFFFU)) |
((((x5) ^ (x9))) >> (32 - (12)))));
x1 = (((u32)((x1) + (x5)) & (0xFFFFFFFFU)));
x13 = ((((u32)((((x13) ^ (x1))) << (8)) & (0xFFFFFFFFU)) |
((((x13) ^ (x1))) >> (32 - (8)))));
x9 = (((u32)((x9) + (x13)) & (0xFFFFFFFFU)));
x5 = ((((u32)((((x5) ^ (x9))) << (7)) & (0xFFFFFFFFU)) |
((((x5) ^ (x9))) >> (32 - (7)))));
x2 = (((u32)((x2) + (x6)) & (0xFFFFFFFFU)));
x14 = ((((u32)((((x14) ^ (x2))) << (16)) & (0xFFFFFFFFU)) |
((((x14) ^ (x2))) >> (32 - (16)))));
x10 = (((u32)((x10) + (x14)) & (0xFFFFFFFFU)));
x6 = ((((u32)((((x6) ^ (x10))) << (12)) & (0xFFFFFFFFU)) |
((((x6) ^ (x10))) >> (32 - (12)))));
x2 = (((u32)((x2) + (x6)) & (0xFFFFFFFFU)));
x14 = ((((u32)((((x14) ^ (x2))) << (8)) & (0xFFFFFFFFU)) |
((((x14) ^ (x2))) >> (32 - (8)))));
x10 = (((u32)((x10) + (x14)) & (0xFFFFFFFFU)));
x6 = ((((u32)((((x6) ^ (x10))) << (7)) & (0xFFFFFFFFU)) |
((((x6) ^ (x10))) >> (32 - (7)))));
x3 = (((u32)((x3) + (x7)) & (0xFFFFFFFFU)));
x15 = ((((u32)((((x15) ^ (x3))) << (16)) & (0xFFFFFFFFU)) |
((((x15) ^ (x3))) >> (32 - (16)))));
x11 = (((u32)((x11) + (x15)) & (0xFFFFFFFFU)));
x7 = ((((u32)((((x7) ^ (x11))) << (12)) & (0xFFFFFFFFU)) |
((((x7) ^ (x11))) >> (32 - (12)))));
x3 = (((u32)((x3) + (x7)) & (0xFFFFFFFFU)));
x15 = ((((u32)((((x15) ^ (x3))) << (8)) & (0xFFFFFFFFU)) |
((((x15) ^ (x3))) >> (32 - (8)))));
x11 = (((u32)((x11) + (x15)) & (0xFFFFFFFFU)));
x7 = ((((u32)((((x7) ^ (x11))) << (7)) & (0xFFFFFFFFU)) |
((((x7) ^ (x11))) >> (32 - (7)))));
x0 = (((u32)((x0) + (x5)) & (0xFFFFFFFFU)));
x15 = ((((u32)((((x15) ^ (x0))) << (16)) & (0xFFFFFFFFU)) |
((((x15) ^ (x0))) >> (32 - (16)))));
x10 = (((u32)((x10) + (x15)) & (0xFFFFFFFFU)));
x5 = ((((u32)((((x5) ^ (x10))) << (12)) & (0xFFFFFFFFU)) |
((((x5) ^ (x10))) >> (32 - (12)))));
x0 = (((u32)((x0) + (x5)) & (0xFFFFFFFFU)));
x15 = ((((u32)((((x15) ^ (x0))) << (8)) & (0xFFFFFFFFU)) |
((((x15) ^ (x0))) >> (32 - (8)))));
x10 = (((u32)((x10) + (x15)) & (0xFFFFFFFFU)));
x5 = ((((u32)((((x5) ^ (x10))) << (7)) & (0xFFFFFFFFU)) |
((((x5) ^ (x10))) >> (32 - (7)))));
x1 = (((u32)((x1) + (x6)) & (0xFFFFFFFFU)));
x12 = ((((u32)((((x12) ^ (x1))) << (16)) & (0xFFFFFFFFU)) |
((((x12) ^ (x1))) >> (32 - (16)))));
x11 = (((u32)((x11) + (x12)) & (0xFFFFFFFFU)));
x6 = ((((u32)((((x6) ^ (x11))) << (12)) & (0xFFFFFFFFU)) |
((((x6) ^ (x11))) >> (32 - (12)))));
x1 = (((u32)((x1) + (x6)) & (0xFFFFFFFFU)));
x12 = ((((u32)((((x12) ^ (x1))) << (8)) & (0xFFFFFFFFU)) |
((((x12) ^ (x1))) >> (32 - (8)))));
x11 = (((u32)((x11) + (x12)) & (0xFFFFFFFFU)));
x6 = ((((u32)((((x6) ^ (x11))) << (7)) & (0xFFFFFFFFU)) |
((((x6) ^ (x11))) >> (32 - (7)))));
x2 = (((u32)((x2) + (x7)) & (0xFFFFFFFFU)));
x13 = ((((u32)((((x13) ^ (x2))) << (16)) & (0xFFFFFFFFU)) |
((((x13) ^ (x2))) >> (32 - (16)))));
x8 = (((u32)((x8) + (x13)) & (0xFFFFFFFFU)));
x7 = ((((u32)((((x7) ^ (x8))) << (12)) & (0xFFFFFFFFU)) |
((((x7) ^ (x8))) >> (32 - (12)))));
x2 = (((u32)((x2) + (x7)) & (0xFFFFFFFFU)));
x13 = ((((u32)((((x13) ^ (x2))) << (8)) & (0xFFFFFFFFU)) |
((((x13) ^ (x2))) >> (32 - (8)))));
x8 = (((u32)((x8) + (x13)) & (0xFFFFFFFFU)));
x7 = ((((u32)((((x7) ^ (x8))) << (7)) & (0xFFFFFFFFU)) |
((((x7) ^ (x8))) >> (32 - (7)))));
x3 = (((u32)((x3) + (x4)) & (0xFFFFFFFFU)));
x14 = ((((u32)((((x14) ^ (x3))) << (16)) & (0xFFFFFFFFU)) |
((((x14) ^ (x3))) >> (32 - (16)))));
x9 = (((u32)((x9) + (x14)) & (0xFFFFFFFFU)));
x4 = ((((u32)((((x4) ^ (x9))) << (12)) & (0xFFFFFFFFU)) |
((((x4) ^ (x9))) >> (32 - (12)))));
x3 = (((u32)((x3) + (x4)) & (0xFFFFFFFFU)));
x14 = ((((u32)((((x14) ^ (x3))) << (8)) & (0xFFFFFFFFU)) |
((((x14) ^ (x3))) >> (32 - (8)))));
x9 = (((u32)((x9) + (x14)) & (0xFFFFFFFFU)));
x4 = ((((u32)((((x4) ^ (x9))) << (7)) & (0xFFFFFFFFU)) |
((((x4) ^ (x9))) >> (32 - (7)))));
}
x0 = (((u32)((x0) + (j0)) & (0xFFFFFFFFU)));
x1 = (((u32)((x1) + (j1)) & (0xFFFFFFFFU)));
x2 = (((u32)((x2) + (j2)) & (0xFFFFFFFFU)));
x3 = (((u32)((x3) + (j3)) & (0xFFFFFFFFU)));
x4 = (((u32)((x4) + (j4)) & (0xFFFFFFFFU)));
x5 = (((u32)((x5) + (j5)) & (0xFFFFFFFFU)));
x6 = (((u32)((x6) + (j6)) & (0xFFFFFFFFU)));
x7 = (((u32)((x7) + (j7)) & (0xFFFFFFFFU)));
x8 = (((u32)((x8) + (j8)) & (0xFFFFFFFFU)));
x9 = (((u32)((x9) + (j9)) & (0xFFFFFFFFU)));
x10 = (((u32)((x10) + (j10)) & (0xFFFFFFFFU)));
x11 = (((u32)((x11) + (j11)) & (0xFFFFFFFFU)));
x12 = (((u32)((x12) + (j12)) & (0xFFFFFFFFU)));
x13 = (((u32)((x13) + (j13)) & (0xFFFFFFFFU)));
x14 = (((u32)((x14) + (j14)) & (0xFFFFFFFFU)));
x15 = (((u32)((x15) + (j15)) & (0xFFFFFFFFU)));
j12 = ((((u32)(((j12)) + (1)) & (0xFFFFFFFFU))));
if (!j12) {
j13 = ((((u32)(((j13)) + (1)) & (0xFFFFFFFFU))));
}
do {
(c + 0)[0] = ((u8)((x0)) & (0xFFU));
(c + 0)[1] = ((u8)((x0) >> 8) & (0xFFU));
(c + 0)[2] = ((u8)((x0) >> 16) & (0xFFU));
(c + 0)[3] = ((u8)((x0) >> 24) & (0xFFU));
} while (0);
do {
(c + 4)[0] = ((u8)((x1)) & (0xFFU));
(c + 4)[1] = ((u8)((x1) >> 8) & (0xFFU));
(c + 4)[2] = ((u8)((x1) >> 16) & (0xFFU));
(c + 4)[3] = ((u8)((x1) >> 24) & (0xFFU));
} while (0);
do {
(c + 8)[0] = ((u8)((x2)) & (0xFFU));
(c + 8)[1] = ((u8)((x2) >> 8) & (0xFFU));
(c + 8)[2] = ((u8)((x2) >> 16) & (0xFFU));
(c + 8)[3] = ((u8)((x2) >> 24) & (0xFFU));
} while (0);
do {
(c + 12)[0] = ((u8)((x3)) & (0xFFU));
(c + 12)[1] = ((u8)((x3) >> 8) & (0xFFU));
(c + 12)[2] = ((u8)((x3) >> 16) & (0xFFU));
(c + 12)[3] = ((u8)((x3) >> 24) & (0xFFU));
} while (0);
do {
(c + 16)[0] = ((u8)((x4)) & (0xFFU));
(c + 16)[1] = ((u8)((x4) >> 8) & (0xFFU));
(c + 16)[2] = ((u8)((x4) >> 16) & (0xFFU));
(c + 16)[3] = ((u8)((x4) >> 24) & (0xFFU));
} while (0);
do {
(c + 20)[0] = ((u8)((x5)) & (0xFFU));
(c + 20)[1] = ((u8)((x5) >> 8) & (0xFFU));
(c + 20)[2] = ((u8)((x5) >> 16) & (0xFFU));
(c + 20)[3] = ((u8)((x5) >> 24) & (0xFFU));
} while (0);
do {
(c + 24)[0] = ((u8)((x6)) & (0xFFU));
(c + 24)[1] = ((u8)((x6) >> 8) & (0xFFU));
(c + 24)[2] = ((u8)((x6) >> 16) & (0xFFU));
(c + 24)[3] = ((u8)((x6) >> 24) & (0xFFU));
} while (0);
do {
(c + 28)[0] = ((u8)((x7)) & (0xFFU));
(c + 28)[1] = ((u8)((x7) >> 8) & (0xFFU));
(c + 28)[2] = ((u8)((x7) >> 16) & (0xFFU));
(c + 28)[3] = ((u8)((x7) >> 24) & (0xFFU));
} while (0);
do {
(c + 32)[0] = ((u8)((x8)) & (0xFFU));
(c + 32)[1] = ((u8)((x8) >> 8) & (0xFFU));
(c + 32)[2] = ((u8)((x8) >> 16) & (0xFFU));
(c + 32)[3] = ((u8)((x8) >> 24) & (0xFFU));
} while (0);
do {
(c + 36)[0] = ((u8)((x9)) & (0xFFU));
(c + 36)[1] = ((u8)((x9) >> 8) & (0xFFU));
(c + 36)[2] = ((u8)((x9) >> 16) & (0xFFU));
(c + 36)[3] = ((u8)((x9) >> 24) & (0xFFU));
} while (0);
do {
(c + 40)[0] = ((u8)((x10)) & (0xFFU));
(c + 40)[1] = ((u8)((x10) >> 8) & (0xFFU));
(c + 40)[2] = ((u8)((x10) >> 16) & (0xFFU));
(c + 40)[3] = ((u8)((x10) >> 24) & (0xFFU));
} while (0);
do {
(c + 44)[0] = ((u8)((x11)) & (0xFFU));
(c + 44)[1] = ((u8)((x11) >> 8) & (0xFFU));
(c + 44)[2] = ((u8)((x11) >> 16) & (0xFFU));
(c + 44)[3] = ((u8)((x11) >> 24) & (0xFFU));
} while (0);
do {
(c + 48)[0] = ((u8)((x12)) & (0xFFU));
(c + 48)[1] = ((u8)((x12) >> 8) & (0xFFU));
(c + 48)[2] = ((u8)((x12) >> 16) & (0xFFU));
(c + 48)[3] = ((u8)((x12) >> 24) & (0xFFU));
} while (0);
do {
(c + 52)[0] = ((u8)((x13)) & (0xFFU));
(c + 52)[1] = ((u8)((x13) >> 8) & (0xFFU));
(c + 52)[2] = ((u8)((x13) >> 16) & (0xFFU));
(c + 52)[3] = ((u8)((x13) >> 24) & (0xFFU));
} while (0);
do {
(c + 56)[0] = ((u8)((x14)) & (0xFFU));
(c + 56)[1] = ((u8)((x14) >> 8) & (0xFFU));
(c + 56)[2] = ((u8)((x14) >> 16) & (0xFFU));
(c + 56)[3] = ((u8)((x14) >> 24) & (0xFFU));
} while (0);
do {
(c + 60)[0] = ((u8)((x15)) & (0xFFU));
(c + 60)[1] = ((u8)((x15) >> 8) & (0xFFU));
(c + 60)[2] = ((u8)((x15) >> 16) & (0xFFU));
(c + 60)[3] = ((u8)((x15) >> 24) & (0xFFU));
} while (0);
if (bytes <= 64) {
if (bytes < 64) {
for (i = 0; i < bytes; ++i)
ctarget[i] = c[i];
}
x->input[12] = j12;
x->input[13] = j13;
return;
}
bytes -= 64;
c += 64;
}
} | unsigned long chacha_encrypt_bytes(int *a1, char *a2, char *a3,
unsigned int a4) {
unsigned int v5;
int v8;
int v9;
int v10;
int v11;
int v12;
int v13;
int v14;
int v15;
int v16;
int v17;
int v18;
int v19;
int v20;
int v21;
int v22;
int v23;
int v24;
int v25;
int v26;
int v27;
int v28;
int v29;
int v30;
int v31;
int v32;
int v33;
int v34;
int v35;
int v36;
int v37;
int v38;
int v39;
int v40;
int v41;
int v42;
int v43;
int v44;
int v45;
int v46;
int v47;
int v48;
int v49;
int v50;
int v51;
int v52;
int v53;
int v54;
int v55;
int v56;
int v57;
int v58;
int v59;
int v60;
int v61;
int v62;
int v63;
int v64;
int v65;
int v66;
int v67;
int v68;
int v69;
int v70;
int v71;
int v72;
int v73;
int v74;
int v75;
int v76;
int v77;
int v78;
int v79;
int v80;
int v81;
int v82;
int v83;
int v84;
int v85;
int v86;
int v87;
int v88;
int v89;
unsigned int i;
int j;
unsigned int k;
int v93;
int v94;
int v95;
int v96;
int v97;
int v98;
int v99;
int v100;
int v101;
int v102;
int v103;
int v104;
int v105;
int v106;
char *v107;
char v108[72];
unsigned long v109;
v5 = a4;
v109 = __readfsqword(0x28u);
v107 = 0LL;
if (a4) {
v93 = *a1;
v94 = a1[1];
v95 = a1[2];
v96 = a1[3];
v97 = a1[4];
v98 = a1[5];
v99 = a1[6];
v100 = a1[7];
v101 = a1[8];
v102 = a1[9];
v103 = a1[10];
v104 = a1[11];
v88 = a1[12];
v89 = a1[13];
v105 = a1[14];
v106 = a1[15];
while (1) {
if (v5 <= 0x3F) {
for (i = 0; i < v5; ++i)
v108[i] = a2[i];
a2 = v108;
v107 = a3;
a3 = v108;
}
v8 = v93;
v13 = v94;
v18 = v95;
v23 = v96;
v28 = v97;
v33 = v98;
v38 = v99;
v43 = v100;
v48 = v101;
v53 = v102;
v58 = v103;
v63 = v104;
v68 = v88;
v73 = v89;
v78 = v105;
v83 = v106;
for (j = 20; j; j -= 2) {
v9 = v28 + v8;
v69 = __ROL4__(v9 ^ v68, 16);
v49 = v69 + v48;
v29 = __ROL4__(v49 ^ v28, 12);
v10 = v29 + v9;
v70 = __ROL4__(v10 ^ v69, 8);
v50 = v70 + v49;
v30 = __ROL4__(v50 ^ v29, 7);
v14 = v33 + v13;
v74 = __ROL4__(v14 ^ v73, 16);
v54 = v74 + v53;
v34 = __ROL4__(v54 ^ v33, 12);
v15 = v34 + v14;
v75 = __ROL4__(v15 ^ v74, 8);
v55 = v75 + v54;
v35 = __ROL4__(v55 ^ v34, 7);
v19 = v38 + v18;
v79 = __ROL4__(v19 ^ v78, 16);
v59 = v79 + v58;
v39 = __ROL4__(v59 ^ v38, 12);
v20 = v39 + v19;
v80 = __ROL4__(v20 ^ v79, 8);
v60 = v80 + v59;
v40 = __ROL4__(v60 ^ v39, 7);
v24 = v43 + v23;
v84 = __ROL4__(v24 ^ v83, 16);
v64 = v84 + v63;
v44 = __ROL4__(v64 ^ v43, 12);
v25 = v44 + v24;
v85 = __ROL4__(v25 ^ v84, 8);
v65 = v85 + v64;
v45 = __ROL4__(v65 ^ v44, 7);
v11 = v35 + v10;
v86 = __ROL4__(v11 ^ v85, 16);
v61 = v86 + v60;
v36 = __ROL4__(v61 ^ v35, 12);
v8 = v36 + v11;
v83 = __ROL4__(v8 ^ v86, 8);
v58 = v83 + v61;
v33 = __ROL4__(v58 ^ v36, 7);
v16 = v40 + v15;
v71 = __ROL4__(v16 ^ v70, 16);
v66 = v71 + v65;
v41 = __ROL4__(v66 ^ v40, 12);
v13 = v41 + v16;
v68 = __ROL4__(v13 ^ v71, 8);
v63 = v68 + v66;
v38 = __ROL4__(v63 ^ v41, 7);
v21 = v45 + v20;
v76 = __ROL4__(v21 ^ v75, 16);
v51 = v76 + v50;
v46 = __ROL4__(v51 ^ v45, 12);
v18 = v46 + v21;
v73 = __ROL4__(v18 ^ v76, 8);
v48 = v73 + v51;
v43 = __ROL4__(v48 ^ v46, 7);
v26 = v30 + v25;
v81 = __ROL4__(v26 ^ v80, 16);
v56 = v81 + v55;
v31 = __ROL4__(v56 ^ v30, 12);
v23 = v31 + v26;
v78 = __ROL4__(v23 ^ v81, 8);
v53 = v78 + v56;
v28 = __ROL4__(v53 ^ v31, 7);
}
v12 = v93 + v8;
v17 = v94 + v13;
v22 = v95 + v18;
v27 = v96 + v23;
v32 = v97 + v28;
v37 = v98 + v33;
v42 = v99 + v38;
v47 = v100 + v43;
v52 = v101 + v48;
v57 = v102 + v53;
v62 = v103 + v58;
v67 = v104 + v63;
v72 = v88 + v68;
v77 = v89 + v73;
v82 = v105 + v78;
v87 = v106 + v83;
if (!++v88)
++v89;
*(_DWORD *)a3 = v12;
*((_DWORD *)a3 + 1) = v17;
*((_DWORD *)a3 + 2) = v22;
*((_DWORD *)a3 + 3) = v27;
*((_DWORD *)a3 + 4) = v32;
*((_DWORD *)a3 + 5) = v37;
*((_DWORD *)a3 + 6) = v42;
*((_DWORD *)a3 + 7) = v47;
*((_DWORD *)a3 + 8) = v52;
*((_DWORD *)a3 + 9) = v57;
*((_DWORD *)a3 + 10) = v62;
*((_DWORD *)a3 + 11) = v67;
*((_DWORD *)a3 + 12) = v72;
*((_DWORD *)a3 + 13) = v77;
*((_DWORD *)a3 + 14) = v82;
*((_DWORD *)a3 + 15) = v87;
if (v5 <= 0x40)
break;
v5 -= 64;
a3 += 64;
}
if (v5 <= 0x3F) {
for (k = 0; k < v5; ++k)
v107[k] = a3[k];
}
a1[12] = v88;
a1[13] = v89;
}
return __readfsqword(0x28u) ^ v109;
} | libbsd-0.11.7 | ida |
void app_exit(int val) {
if (val != 0) {
if (outfile_name)
(void)remove(outfile_name);
}
exit(val);
} | void app_exit(int a1) {
if (a1) {
if (outfile_name)
remove(outfile_name);
}
exit(a1);
} | gnutls | ida |
test_code_t test_3des(gnutls_session_t session) {
int ret;
sprintf(prio_str,
"NONE:"
"+3DES-CBC:"
"+COMP-NULL"
":%s:"
"+MAC-ALL:+MD5:+SHA1"
":+GOST28147-TC26Z-IMIT"
":"
"+RSA:+DHE-RSA:+DHE-DSS:+ANON-DH:+ECDHE-RSA:+ECDHE-ECDSA:+ANON-ECDH"
":+VKO-GOST-12"
":%s",
protocol_str, rest);
{
int _ret;
if ((_ret = __gnutls_priority_set_direct(session, prio_str, 935)) !=
TEST_SUCCEED) {
return _ret;
}
};
gnutls_credentials_set(session, GNUTLS_CRD_CERTIFICATE, xcred);
ret = test_do_handshake(session);
return ret;
} | long long test_3des(unsigned long long a0) {
unsigned int v0;
unsigned int v1;
unsigned long long v3;
sprintf(&prio_str,
"NONE:+3DES-CBC:+COMP-NULL:%s:+MAC-ALL:+MD5:+SHA1:+GOST28147-TC26Z-"
"IMIT:+RSA:+DHE-RSA:+DHE-DSS:+ANON-DH:+ECDHE-RSA:+ECDHE-ECDSA:+ANON-"
"ECDH:+VKO-GOST-12:%s",
&protocol_str, &rest);
v0 = __gnutls_priority_set_direct(a0, &prio_str, 0x3a7);
if (v0) {
v3 = v0;
} else {
gnutls_credentials_set(a0, 0x1, xcred);
v1 = test_do_handshake(a0);
v3 = v1;
}
return v3;
} | gnutls | angr_dream |
void *__new_var_obj_p(int magic, size_t size) {
obj_prefix *obj_p = (obj_prefix *)malloc(size);
if (obj_p) {
obj_p->p_magic = (long)magic;
obj_p->p_flags = 1;
}
return obj_p;
} | long long __new_var_obj_p(unsigned long a0, unsigned int a1) {
unsigned short v0[2];
*(&v0) = malloc(a1);
if (v0) {
v0[0] = a0;
v0[1] = 1;
}
return v0;
} | acl-2.3.1 | angr_phoenix |
static inline int ila_ident_name2type(char *name) {
if (!strcmp(name, "luid"))
return ILA_ATYPE_LUID;
else if (!strcmp(name, "use-format"))
return ILA_ATYPE_USE_FORMAT;
else
return -1;
} | undefined8 ila_ident_name2type(char *param_1)
{
int iVar1;
undefined8 uVar2;
iVar1 = strcmp(param_1, "luid");
if (iVar1 == 0) {
uVar2 = 1;
} else {
iVar1 = strcmp(param_1, "use-format");
if (iVar1 == 0) {
uVar2 = 0x20;
} else {
uVar2 = 0xffffffff;
}
}
return uVar2;
} | iproute2-6.0.0 | ghidra |
int config_has_permitted_cnames(Options *options) {
if (options->num_permitted_cnames == 1 &&
strcasecmp(options->permitted_cnames[0].source_list, "none") == 0 &&
strcmp(options->permitted_cnames[0].target_list, "") == 0)
return 0;
return options->num_permitted_cnames > 0;
} | _BOOL8 config_has_permitted_cnames(long a1) {
return (*(_DWORD *)(a1 + 5324) != 1 ||
strcasecmp(*(const char **)(a1 + 5328), "none") ||
strcmp(*(const char **)(a1 + 5336), &byte_B5E4)) &&
*(_DWORD *)(a1 + 5324) > 0;
} | openssh-portable | ida |
void write_longdocs(stream, builtins) FILE *stream;
ARRAY *builtins;
{
register int i;
register BUILTIN_DESC *builtin;
char *dname;
char *sarray[2];
for (i = 0; i < builtins->sindex; i++) {
builtin = (BUILTIN_DESC *)builtins->array[i];
if (builtin->dependencies)
write_ifdefs(stream, builtin->dependencies->array);
dname = ((builtin)->docname ? (builtin)->docname : (builtin)->name);
fprintf(stream, "char * const %s_doc[] =", dname);
if (separate_helpfiles) {
int l = strlen(helpfile_directory) + strlen(dname) + 1;
sarray[0] = (char *)xmalloc(l + 1);
sprintf(sarray[0], "%s/%s", helpfile_directory, dname);
sarray[1] = (char *)((void *)0);
write_documentation(stream, sarray, 0, 0x01 | 0x08);
free(sarray[0]);
} else
write_documentation(stream, builtin->longdoc->array, 0, 0x01);
if (builtin->dependencies)
write_endifs(stream, builtin->dependencies->array);
}
} | void write_longdocs(FILE *param_1, long param_2)
{
char **ppcVar1;
char *__s;
size_t sVar2;
size_t sVar3;
int iVar4;
long in_FS_OFFSET;
char *local_48;
undefined8 local_40;
long local_30;
local_30 = *(long *)(in_FS_OFFSET + 0x28);
for (iVar4 = 0; iVar4 < *(int *)(param_2 + 4); iVar4 = iVar4 + 1) {
ppcVar1 = *(char ***)(*(long *)(param_2 + 0x10) + (long)iVar4 * 8);
if (ppcVar1[5] != (char *)0x0) {
write_ifdefs(param_1, *(undefined8 *)(ppcVar1[5] + 0x10));
}
if (ppcVar1[3] == (char *)0x0) {
__s = *ppcVar1;
} else {
__s = ppcVar1[3];
}
fprintf(param_1, "char * const %s_doc[] =", __s);
if (separate_helpfiles == 0) {
write_documentation(param_1, *(undefined8 *)(ppcVar1[4] + 0x10), 0, 1);
} else {
sVar2 = strlen(helpfile_directory);
sVar3 = strlen(__s);
local_48 = (char *)xmalloc((int)sVar3 + (int)sVar2 + 2);
sprintf(local_48, "%s/%s", helpfile_directory, __s);
local_40 = 0;
write_documentation(param_1, &local_48, 0, 9);
free(local_48);
}
if (ppcVar1[5] != (char *)0x0) {
write_endifs(param_1, *(undefined8 *)(ppcVar1[5] + 0x10));
}
}
if (local_30 != *(long *)(in_FS_OFFSET + 0x28)) {
__stack_chk_fail();
}
return;
} | bash | ghidra |
test_code_t test_ecdhe_x25519(gnutls_session_t session) {
return test_ecdhe_curve(session, "+CURVE-X25519", GNUTLS_ECC_CURVE_X25519);
} | long test_ecdhe_x25519(long a1) {
return test_ecdhe_curve(a1, "+CURVE-X25519", 6);
} | gnutls | ida |
int execcmd(int argc, char **argv) {
if (argc > 1) {
optlist[3] = 0;
optlist[4] = 0;
optschanged();
shellexec(argv + 1, ((&(&(&varinit[0])[1])[1])[1].text + 5), 0);
}
return 0;
} | undefined8 execcmd(int param_1, long param_2)
{
if (1 < param_1) {
DAT_001030cb = 0;
DAT_001030cc = 0;
optschanged();
shellexec(param_2 + 8, handler + 5, 0);
}
return 0;
} | dash-0.5.11+git20210903+057cd650a4ed | ghidra |
static void print_explain(FILE *f) {
fprintf(f, "Usage: ... geneve id VNI\n"
" remote ADDR\n"
" [ ttl TTL ]\n"
" [ tos TOS ]\n"
" [ df DF ]\n"
" [ flowlabel LABEL ]\n"
" [ dstport PORT ]\n"
" [ [no]external ]\n"
" [ [no]udpcsum ]\n"
" [ [no]udp6zerocsumtx ]\n"
" [ [no]udp6zerocsumrx ]\n"
" [ innerprotoinherit ]\n"
"\n"
"Where: VNI := 0-16777215\n"
" ADDR := IP_ADDRESS\n"
" TOS := { NUMBER | inherit }\n"
" TTL := { 1..255 | auto | inherit }\n"
" DF := { unset | set | inherit }\n"
" LABEL := 0-1048575\n");
} | void print_explain(void *a0) {
unsigned long long v1;
v1 = fprintf(
a0,
"Usage: ... geneve id VNI\n\t\tremote ADDR\n\t\t[ ttl TTL ]\n\t\t[ tos "
"TOS ]\n\t\t[ df DF ]\n\t\t[ flowlabel LABEL ]\n\t\t[ dstport PORT "
"]\n\t\t[ [no]external ]\n\t\t[ [no]udpcsum ]\n\t\t[ [no]udp6zerocsumtx "
"]\n\t\t[ [no]udp6zerocsumrx ]\n\t\t[ innerprotoinherit ]\n\nWhere:\tVNI "
" := 0-16777215\n\tADDR := IP_ADDRESS\n\tTOS := { NUMBER | inherit "
"}\n\tTTL := { 1..255 | auto | inherit }\n\tDF := { unset | set | "
"inherit }\n\tLABEL := 0-1048575\n");
return;
} | iproute2-6.0.0 | angr_dream |
static const char *updatepwd(const char *dir) {
char *new;
char *p;
char *cdcomppath;
const char *lim;
cdcomppath = sstrdup(dir);
((new) = ((void *)stacknxt));
if (*dir != '/') {
if (curdir == nullstr)
return 0;
new = stputs(curdir, new);
}
new = makestrspace(strlen(dir) + 2, new);
lim = ((void *)stacknxt) + 1;
if (*dir != '/') {
if (new[-1] != '/')
(*new++ = ('/'));
if (new > lim && *lim == '/')
lim++;
} else {
(*new++ = ('/'));
cdcomppath++;
if (dir[1] == '/' && dir[2] != '/') {
(*new++ = ('/'));
cdcomppath++;
lim++;
}
}
p = strtok(cdcomppath, "/");
while (p) {
switch (*p) {
case '.':
if (p[1] == '.' && p[2] == '\0') {
while (new > lim) {
(--new);
if (new[-1] == '/')
break;
}
break;
} else if (p[1] == '\0')
break;
default:
new = stputs(p, new);
(*new++ = ('/'));
}
p = strtok(0, "/");
}
if (new > lim)
(--new);
*new = 0;
return ((void *)stacknxt);
} | long updatepwd(char *param_1)
{
char *pcVar1;
long lVar2;
char *pcVar3;
size_t sVar4;
char *pcVar5;
undefined *puVar6;
char *local_28;
char *local_20;
char *local_18;
char *local_10;
pcVar3 = (char *)sstrdup(param_1);
local_28 = (char *)stacknxt;
if (*param_1 != '/') {
if (curdir == &nullstr) {
return 0;
}
local_28 = (char *)stputs(curdir, stacknxt);
}
sVar4 = strlen(param_1);
pcVar5 = (char *)makestrspace(sVar4 + 2, local_28);
lVar2 = stacknxt;
local_10 = (char *)(stacknxt + 1);
if (*param_1 == '/') {
pcVar1 = pcVar5 + 1;
*pcVar5 = '/';
local_18 = pcVar3 + 1;
local_28 = pcVar1;
if ((param_1[1] == '/') && (param_1[2] != '/')) {
local_28 = pcVar5 + 2;
*pcVar1 = '/';
local_18 = pcVar3 + 2;
local_10 = (char *)(lVar2 + 2);
}
} else {
local_28 = pcVar5;
if (pcVar5[-1] != '/') {
local_28 = pcVar5 + 1;
*pcVar5 = '/';
}
local_18 = pcVar3;
if ((local_10 < local_28) && (*local_10 == '/')) {
local_10 = (char *)(lVar2 + 2);
}
}
local_20 = strtok(local_18, "/");
do {
if (local_20 == (char *)0x0) {
if (local_10 < local_28) {
local_28 = local_28 + -1;
}
*local_28 = '\0';
return stacknxt;
}
if (*local_20 == '.') {
if ((local_20[1] == '.') && (local_20[2] == '\0')) {
do {
if (local_28 <= local_10)
break;
pcVar3 = local_28 + -1;
pcVar5 = local_28 + -2;
local_28 = pcVar3;
} while (*pcVar5 != '/');
} else if (local_20[1] != '\0')
goto LAB_00100562;
} else {
LAB_00100562:
puVar6 = (undefined *)stputs(local_20, local_28);
*puVar6 = 0x2f;
local_28 = puVar6 + 1;
}
local_20 = strtok((char *)0x0, "/");
} while (true);
} | dash-0.5.11+git20210903+057cd650a4ed | ghidra |
void _rl_region_color_on(void) {
if (_rl_active_region_start_color && _rl_active_region_end_color)
tputs(_rl_active_region_start_color, 1, _rl_output_character_function);
} | long long _rl_region_color_on() {
unsigned long long v1;
v1 = _rl_active_region_start_color;
if (_rl_active_region_start_color) {
v1 = _rl_active_region_end_color;
if (_rl_active_region_end_color)
v1 = tputs(_rl_active_region_start_color, 0x1,
_rl_output_character_function);
}
return v1;
} | bash | angr_dream |
static inline __u64 rta_getattr_u64(const struct rtattr *rta) {
__u64 tmp;
memcpy(&tmp,
((void *)(((char *)(rta)) +
((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0)))),
sizeof(__u64));
return tmp;
} | int rta_getattr_u64(unsigned long a0) {
char v0;
memcpy(&v0, a0 + 4, 0x8);
return *(&v0);
} | iproute2-6.0.0 | angr_sailr |
size_t sshbuf_max_size(const struct sshbuf *buf) { return buf->max_size; } | undefined8 sshbuf_max_size(long param_1)
{
return *(undefined8 *)(param_1 + 0x20);
} | openssh-portable | ghidra |
static int do_show(int argc, char **argv) {
struct ip6_tnl_parm2 p, p1;
ip6_tnl_parm_init(&p, 0);
p.proto = 0;
if (parse_args(argc, argv, (0x89F0 + 0), &p) < 0)
return -1;
if (!p.name[0] || show_stats) {
struct tnl_print_nlmsg_info info = {
.p1 = &p,
.p2 = &p1,
.init = ip6_tnl_parm_initialize,
.match = ip6_tnl_parm_match,
.print = print_tunnel,
};
return do_tunnels_list(&info);
}
if (tnl_get_ioctl(p.name, &p))
return -1;
print_tunnel(&p);
return 0;
} | void do_show(unsigned long a0, unsigned int a1, unsigned long a2,
unsigned long a3, unsigned long long a4, unsigned long long a5) {
void *v0;
unsigned long v1;
void *v2;
unsigned long long v3;
unsigned long long v4;
unsigned long long v5;
char v6;
char v7;
char v8;
unsigned long long v10;
unsigned long long v11;
unsigned long long v12;
void *v13;
ip6_tnl_parm_init(&v6, 0x0);
v7 = 0;
if (parse_args(a0, a1, 0x89f0, &v6) < 0) {
v10 = 4294967295;
} else if (!v6) {
LABEL_401895:
v0 = 0;
v1 = 0;
v2 = 0;
v3 = 0;
v4 = 0;
v5 = 0;
v1 = &v6;
v2 = &v8;
v3 = ip6_tnl_parm_initialize;
v4 = ip6_tnl_parm_match;
v5 = print_tunnel;
v11 = do_tunnels_list(&v0);
} else {
if (!(!show_stats))
goto LABEL_401895;
if (tnl_get_ioctl(&v6, &v6, &v6)) {
v12 = 4294967295;
} else {
print_tunnel(&v6, &v6, &v6, &v6, a4, a5);
v13 = 0;
}
}
return;
} | iproute2-6.0.0 | angr_phoenix |
acl_t acl_get_fd(int fd) {
const size_t size_guess = acl_ea_size(16);
char *ext_acl_p = __builtin_alloca(size_guess);
int retval;
if (!ext_acl_p)
return ((void *)0);
retval = fgetxattr(fd, "system.posix_acl_access", ext_acl_p, size_guess);
if (retval == -1 && (*__errno_location()) == 34) {
retval = fgetxattr(fd, "system.posix_acl_access", ((void *)0), 0);
if (retval > 0) {
ext_acl_p = __builtin_alloca(retval);
if (!ext_acl_p)
return ((void *)0);
retval = fgetxattr(fd, "system.posix_acl_access", ext_acl_p, retval);
}
}
if (retval > 0) {
acl_t acl = __acl_from_xattr(ext_acl_p, retval);
return acl;
} else if (retval == 0 || (*__errno_location()) == 61 ||
(*__errno_location()) == 61) {
struct stat st;
if (fstat(fd, &st) == 0)
return acl_from_mode(st.st_mode);
else
return ((void *)0);
} else
return ((void *)0);
} | undefined8 acl_get_fd(int param_1)
{
int iVar1;
ulong uVar2;
void *pvVar3;
undefined8 uVar4;
ssize_t sVar5;
int *piVar6;
size_t sVar7;
long lVar8;
undefined *puVar9;
undefined *puVar10;
undefined *puVar11;
long in_FS_OFFSET;
undefined auStack216[12];
int local_cc;
int local_c4;
void *local_c0;
size_t local_b8;
undefined8 local_b0;
stat local_a8;
long local_10;
local_10 = *(long *)(in_FS_OFFSET + 0x28);
local_cc = param_1;
local_b8 = acl_ea_size(0x10);
uVar2 = ((local_b8 + 0x17) / 0x10) * 0x10;
for (puVar9 = auStack216;
puVar9 != auStack216 + -(uVar2 & 0xfffffffffffff000);
puVar9 = puVar9 + -0x1000) {
*(undefined8 *)(puVar9 + -8) = *(undefined8 *)(puVar9 + -8);
}
lVar8 = -(ulong)((uint)uVar2 & 0xfff);
puVar10 = puVar9 + lVar8;
if ((uVar2 & 0xfff) != 0) {
*(undefined8 *)(puVar9 + ((ulong)((uint)uVar2 & 0xfff) - 8) + lVar8) =
*(undefined8 *)(puVar9 + ((ulong)((uint)uVar2 & 0xfff) - 8) + lVar8);
}
sVar7 = local_b8;
iVar1 = local_cc;
pvVar3 = (void *)((ulong)(puVar9 + lVar8 + 0xf) & 0xfffffffffffffff0);
local_c0 = pvVar3;
if (pvVar3 == (void *)0x0) {
uVar4 = 0;
puVar11 = puVar9 + lVar8;
} else {
*(undefined8 *)(puVar9 + lVar8 + -8) = 0x100113;
sVar5 = fgetxattr(iVar1, "system.posix_acl_access", pvVar3, sVar7);
local_c4 = (int)sVar5;
puVar11 = puVar9 + lVar8;
if ((int)sVar5 == -1) {
*(undefined8 *)(puVar9 + lVar8 + -8) = 0x10012b;
piVar6 = __errno_location();
iVar1 = local_cc;
puVar11 = puVar9 + lVar8;
if (*piVar6 == 0x22) {
*(undefined8 *)(puVar9 + lVar8 + -8) = 0x100154;
sVar5 = fgetxattr(iVar1, "system.posix_acl_access", (void *)0x0, 0);
local_c4 = (int)sVar5;
puVar11 = puVar9 + lVar8;
if (0 < local_c4) {
uVar2 = (((long)local_c4 + 0x17U) / 0x10) * 0x10;
for (; puVar10 != puVar9 + (lVar8 - (uVar2 & 0xfffffffffffff000));
puVar10 = puVar10 + -0x1000) {
*(undefined8 *)(puVar10 + -8) = *(undefined8 *)(puVar10 + -8);
}
lVar8 = -(ulong)((uint)uVar2 & 0xfff);
puVar11 = puVar10 + lVar8;
if ((uVar2 & 0xfff) != 0) {
*(undefined8 *)(puVar10 + ((ulong)((uint)uVar2 & 0xfff) - 8) +
lVar8) =
*(undefined8 *)(puVar10 + ((ulong)((uint)uVar2 & 0xfff) - 8) +
lVar8);
}
iVar1 = local_cc;
pvVar3 =
(void *)((ulong)(puVar10 + lVar8 + 0xf) & 0xfffffffffffffff0);
local_c0 = pvVar3;
if (pvVar3 == (void *)0x0) {
uVar4 = 0;
puVar11 = puVar10 + lVar8;
goto LAB_001002c3;
}
sVar7 = (size_t)local_c4;
*(undefined8 *)(puVar10 + lVar8 + -8) = 0x100232;
sVar5 = fgetxattr(iVar1, "system.posix_acl_access", pvVar3, sVar7);
local_c4 = (int)sVar5;
}
}
}
pvVar3 = local_c0;
if (local_c4 < 1) {
if (local_c4 != 0) {
*(undefined8 *)(puVar11 + -8) = 0x10027a;
piVar6 = __errno_location();
if (*piVar6 != 0x3d) {
*(undefined8 *)(puVar11 + -8) = 0x100286;
piVar6 = __errno_location();
if (*piVar6 != 0x3d) {
uVar4 = 0;
goto LAB_001002c3;
}
}
}
iVar1 = local_cc;
*(undefined8 *)(puVar11 + -8) = 0x1002a4;
iVar1 = fstat(iVar1, &local_a8);
if (iVar1 == 0) {
*(undefined8 *)(puVar11 + -8) = 0x1002b5;
uVar4 = acl_from_mode(local_a8.st_mode);
} else {
uVar4 = 0;
}
} else {
lVar8 = (long)local_c4;
*(undefined8 *)(puVar11 + -8) = 0x10025c;
uVar4 = __acl_from_xattr(pvVar3, lVar8);
local_b0 = uVar4;
}
}
LAB_001002c3:
if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) {
*(undefined8 *)(puVar11 + -8) = 0x1002d7;
__stack_chk_fail();
}
return uVar4;
} | acl-2.3.1 | ghidra |
void sl_free(StringList *sl, int all) {
size_t i;
if (sl == ((void *)0))
return;
if (sl->sl_str) {
if (all)
for (i = 0; i < sl->sl_cur; i++)
free(sl->sl_str[i]);
free(sl->sl_str);
}
free(sl);
} | long long sl_free(unsigned long long a0[3], unsigned long a1) {
void *v0;
if (a0 && a0[0]) {
if (a1) {
for (v0 = 0; v0 < a0[2]; v0 += 1) {
free(*((a0[0] + v0 * 8)));
}
}
free(a0[0]);
}
return free(a0);
} | libbsd-0.11.7 | angr_phoenix |
static void try_save_ocsp_status(gnutls_session_t session) {
unsigned int cert_num = 0;
gnutls_certificate_get_peers(session, &cert_num);
if (cert_num == 0) {
fprintf(stderr,
"no certificates sent by server, so can't get OCSP status!\n");
return;
}
const char *path;
gnutls_x509_crt_fmt_t type;
unsigned int max_out;
if (gnutls_cli_options.present.save_ocsp) {
path = gnutls_cli_options.arg.save_ocsp;
type = GNUTLS_X509_FMT_DER;
max_out = 1;
} else {
path = gnutls_cli_options.arg.save_ocsp_multi;
type = GNUTLS_X509_FMT_PEM;
max_out = cert_num;
}
FILE *fp = fopen(path, "w");
if (fp == ((void *)0)) {
fprintf(stderr, "could not open %s for writing\n", path);
exit(1);
}
for (unsigned int i = 0; i < max_out; i++) {
gnutls_datum_t oresp;
int ret = gnutls_ocsp_status_request_get2(session, i, &oresp);
if (ret == -56) {
fprintf(stderr, "no OCSP response for certificate %u\n", i);
continue;
} else if (ret < 0) {
fprintf(stderr, "error getting OCSP response %u: %s\n", i,
gnutls_strerror(ret));
exit(1);
}
if (type == GNUTLS_X509_FMT_DER) {
if (fwrite(oresp.data, oresp.size, 1, fp) != 1) {
fprintf(stderr, "writing to %s failed\n", path);
exit(1);
}
continue;
}
gnutls_datum_t t;
ret = gnutls_pem_base64_encode2("OCSP RESPONSE", &oresp, &t);
if (ret < 0) {
fprintf(stderr, "error allocating PEM OCSP response: %s\n",
gnutls_strerror(ret));
exit(1);
}
if (fwrite(t.data, t.size, 1, fp) != 1) {
fprintf(stderr, "writing to %s failed\n", path);
exit(1);
}
gnutls_free((void *)(t.data)), t.data = ((void *)0);
}
if (fclose(fp) != 0) {
perror("failed to close OCSP save file");
}
return;
} | void try_save_ocsp_status(unsigned long long a0) {
unsigned int v0;
unsigned int v1;
unsigned int v2;
unsigned int v3;
unsigned int v4;
char *v5;
void *v6;
char v7;
char v8;
char v9;
char v10;
char v11;
unsigned long long v13;
unsigned long long v14;
unsigned long long v15;
unsigned long long *v17;
unsigned long long v18;
v0 = 0;
gnutls_certificate_get_peers(a0, &v0, &v0);
if (!v0) {
fprintf(*(&stderr),
"no certificates sent by server, so can't get OCSP status!\n");
} else {
if (g_50010e) {
v5 = gnutls_verify_stored_pubkey;
v1 = 0;
v2 = 1;
} else {
v5 = gnutls_store_pubkey;
v1 = 1;
v2 = v0;
}
v6 = fopen(v5, "w");
if (!v6) {
fprintf(*(&stderr), "could not open %s for writing\n", v5);
exit(0x1);
}
for (v3 = 0; v3 < v2; v3 += 1) {
v4 = gnutls_ocsp_status_request_get2(a0, v3, &v7, v3);
if (v4 == -56) {
fprintf(*(&stderr), "no OCSP response for certificate %u\n", v3);
} else if (v4 < 0) {
fprintf(*(&stderr), "error getting OCSP response %u: %s\n", v3,
gnutls_strerror(v4));
exit(0x1);
} else if (!v1) {
v13 = fwrite(*(&v7), *(&v8), 0x1, v6);
if (v13 != 1) {
fprintf(*(&stderr), "writing to %s failed\n", v5);
exit(0x1);
}
} else {
v4 = gnutls_pem_base64_encode2("OCSP RESPONSE", &v7, &v9, v14);
if (v4 < 0) {
fprintf(*(&stderr), "error allocating PEM OCSP response: %s\n",
gnutls_strerror(v4));
exit(0x1);
}
v15 = fwrite(*(&v9), *(&v10), 0x1, v6);
if (v15 != 1) {
fprintf(*(&stderr), "writing to %s failed\n", v5);
exit(0x1);
}
*(5243000)(*(&v9));
v9 = 0;
}
}
if (fclose(v6))
perror("failed to close OCSP save file");
}
if (!v0 || v6) {
v18 = *(&v11) ^ v17[5];
return;
}
} | gnutls | angr_dream |
static int handle_option(const char *str, struct name_elt const *ent) {
struct wordsplit ws;
int i;
struct option_locus loc;
while (*str &&
((*__ctype_b_loc())[(int)((*str))] & (unsigned short int)_ISspace))
++str;
if (*str != '-')
return 1;
ws.ws_offs = 1;
if (wordsplit(str, &ws,
(0x00000040 | 0x00000004 | (0x00000200 | 0x00000400) |
0x00000800 | 0x02000000) |
0x00000002))
do {
if (error_hook)
error_hook();
error(0, 0, gettext("cannot split string '%s': %s"), str,
wordsplit_strerror(&ws));
fatal_exit();
} while (0);
ws.ws_wordv[0] = (char *)program_name;
loc.source = OPTS_FILE;
loc.name = ent->v.file.name;
loc.line = ent->v.file.line;
more_options(ws.ws_wordc + ws.ws_offs, ws.ws_wordv, &loc);
for (i = 0; i < ws.ws_wordc + ws.ws_offs; i++)
ws.ws_wordv[i] = ((void *)0);
wordsplit_free(&ws);
return 0;
} | undefined8 handle_option(char *param_1, long param_2)
{
int iVar1;
ushort **ppuVar2;
undefined8 uVar3;
undefined8 uVar4;
long in_FS_OFFSET;
char *local_140;
int local_12c;
undefined4 local_128[2];
undefined8 local_120;
undefined8 local_118;
long local_108;
undefined8 *local_100;
long local_f8;
long local_20;
local_20 = *(long *)(in_FS_OFFSET + 0x28);
for (local_140 = param_1; *local_140 != '\0'; local_140 = local_140 + 1) {
ppuVar2 = __ctype_b_loc();
if (((*ppuVar2)[*local_140] & 0x2000) == 0)
break;
}
if (*local_140 == '-') {
local_f8 = 1;
iVar1 = wordsplit(local_140, &local_108, 0x2000e46);
if (iVar1 != 0) {
if (error_hook != (code *)0x0) {
(*error_hook)();
}
uVar3 = wordsplit_strerror(&local_108);
uVar4 = gettext("cannot split string \'%s\': %s");
error(0, 0, uVar4, local_140, uVar3);
fatal_exit();
}
*local_100 = program_name;
local_128[0] = 2;
local_120 = *(undefined8 *)(param_2 + 0x18);
local_118 = *(undefined8 *)(param_2 + 0x20);
more_options((int)local_f8 + (int)local_108, local_100, local_128);
local_12c = 0;
while (true) {
if ((ulong)(local_f8 + local_108) <= (ulong)(long)local_12c)
break;
local_100[local_12c] = 0;
local_12c = local_12c + 1;
}
wordsplit_free(&local_108);
uVar3 = 0;
} else {
uVar3 = 1;
}
if (local_20 != *(long *)(in_FS_OFFSET + 0x28)) {
__stack_chk_fail();
}
return uVar3;
} | tar | ghidra |
static inline _Bool
is_empty_dir(int fd_cwd, char const *dir) {
DIR *dirp;
struct dirent const *dp;
int saved_errno;
int fd = openat(fd_cwd, dir,
(00 | 0200000
| 0400 | 0400000 | 04000));
if (fd < 0)
return 0;
dirp = fdopendir(fd);
if (dirp == ((void *)0)) {
close(fd);
return 0;
}
(*__errno_location()) = 0;
dp = readdir_ignoring_dot_and_dotdot(dirp);
saved_errno = (*__errno_location());
closedir(dirp);
(*__errno_location()) = saved_errno;
if (dp != ((void *)0))
return 0;
return saved_errno == 0 ? 1 : 0;
} | ulong is_empty_dir(int param_1, char *param_2)
{
int iVar1;
ulong uVar2;
DIR *__dirp;
int *piVar3;
long lVar4;
iVar1 = openat(param_1, param_2, 0x30900);
if (iVar1 < 0) {
uVar2 = 0;
} else {
__dirp = fdopendir(iVar1);
if (__dirp == (DIR *)0x0) {
close(iVar1);
uVar2 = 0;
} else {
piVar3 = __errno_location();
*piVar3 = 0;
lVar4 = readdir_ignoring_dot_and_dotdot(__dirp);
piVar3 = __errno_location();
iVar1 = *piVar3;
closedir(__dirp);
piVar3 = __errno_location();
*piVar3 = iVar1;
if (lVar4 == 0) {
uVar2 = (ulong)piVar3 & 0xffffffffffffff00 | (ulong)(iVar1 == 0);
} else {
uVar2 = 0;
}
}
}
return uVar2;
} | coreutils | ghidra |
static void bind_termcap_arrow_keys(Keymap map) {
Keymap xkeymap;
xkeymap = _rl_keymap;
_rl_keymap = map;
rl_bind_keyseq_if_unbound(_rl_term_ku, rl_get_previous_history);
rl_bind_keyseq_if_unbound(_rl_term_kd, rl_get_next_history);
rl_bind_keyseq_if_unbound(_rl_term_kr, rl_forward_char);
rl_bind_keyseq_if_unbound(_rl_term_kl, rl_backward_char);
rl_bind_keyseq_if_unbound(_rl_term_kh, rl_beg_of_line);
rl_bind_keyseq_if_unbound(_rl_term_at7, rl_end_of_line);
rl_bind_keyseq_if_unbound(_rl_term_kD, rl_delete);
rl_bind_keyseq_if_unbound(_rl_term_kI, rl_overwrite_mode);
rl_bind_keyseq_if_unbound(_rl_term_kN, rl_history_search_forward);
rl_bind_keyseq_if_unbound(_rl_term_kP, rl_history_search_backward);
_rl_keymap = xkeymap;
} | void bind_termcap_arrow_keys(undefined8 param_1)
{
_rl_keymap = param_1;
rl_bind_keyseq_if_unbound(_rl_term_ku, uRam0000000000100a53);
} | bash | ghidra |
static _Bool
get_comp_type(const char **str, enum comparison_type *comp_type) {
switch (**str) {
case '+':
*comp_type = COMP_GT;
(*str)++;
break;
case '-':
*comp_type = COMP_LT;
(*str)++;
break;
default:
*comp_type = COMP_EQ;
break;
}
return 1;
} | long get_comp_type(_QWORD *a1, _DWORD *a2) {
int v2;
v2 = *(char *)*a1;
if (v2 == 43) {
*a2 = 0;
++*a1;
} else if (v2 == 45) {
*a2 = 1;
++*a1;
} else {
*a2 = 2;
}
return 1LL;
} | findutils | ida |
static void dirlist_replace_prefix(const char *pref, const char *repl) {
struct directory *dp;
size_t pref_len = strlen(pref);
size_t repl_len = strlen(repl);
for (dp = dirhead; dp; dp = dp->next)
replace_prefix(&dp->name, pref, pref_len, repl, repl_len);
} | void dirlist_replace_prefix(char *a0, char *a1) {
unsigned long long *v0;
unsigned long long v1;
unsigned long long v2;
unsigned long long v4;
unsigned long long v5;
v1 = strlen(a0);
v2 = strlen(a1);
v4 = dirhead;
for (v0 = dirhead; v0; v0 = *(v0)) {
replace_prefix(v0 + 11, a0, v1, a1, v2);
v5 = *(v0);
}
return;
} | tar | angr_dream |
static void help() {
static char const *const help_msg[] = {
"Compress or uncompress FILEs (by default, compress FILES in-place).",
"",
"Mandatory arguments to long options are mandatory for short options "
"too.",
"",
" -c, --stdout write on standard output, keep original files "
"unchanged",
" -d, --decompress decompress",
" -f, --force force overwrite of output file and compress links",
" -h, --help give this help",
" -k, --keep keep (don't delete) input files",
" -l, --list list compressed file contents",
" -L, --license display software license",
" -n, --no-name do not save or restore the original name and "
"timestamp",
" -N, --name save or restore the original name and timestamp",
" -q, --quiet suppress all warnings",
" -r, --recursive operate recursively on directories",
" --rsyncable make rsync-friendly archive",
" -S, --suffix=SUF use suffix SUF on compressed files",
" --synchronous synchronous output (safer if system crashes, but "
"slower)",
" -t, --test test compressed file integrity",
" -v, --verbose verbose mode",
" -V, --version display version number",
" -1, --fast compress faster",
" -9, --best compress better",
"",
"With no FILE, or when FILE is -, read standard input.",
"",
"Report bugs to <bug-gzip@gnu.org>.",
0};
char const *const *p = help_msg;
printf("Usage: %s [OPTION]... [FILE]...\n", program_name);
while (*p)
printf("%s\n", *p++);
} | char *help() {
const char **v0;
char *result;
char **v2;
v2 = &help_msg_5319;
printf("Usage: %s [OPTION]... [FILE]...\n", program_name);
while (1) {
result = *v2;
if (!*v2)
break;
v0 = (const char **)v2++;
printf("%s\n", *v0);
}
return result;
} | gzip-1.12 | ida |
(r = sshpkt_send(ssh)) != 0)
sshpkt_fatal(ssh, r, "%s: send reply", __func__);
}
}
else { | void sshpkt_send(void)
{
halt_baddata();
} | openssh-portable | ghidra |
static int execute_for_command(for_command)
FOR_COM *for_command;
{
register WORD_LIST *releaser, *list;
SHELL_VAR *v;
char *identifier;
int retval, save_line_number;
save_line_number = line_number;
if (check_identifier(for_command->name, 1) == 0) {
if (posixly_correct && interactive_shell == 0) {
last_command_exit_value = 2;
jump_to_top_level(4);
}
return (1);
}
loop_level++;
identifier = for_command->name->word;
line_number = for_command->line;
list = releaser = expand_words_no_vars(for_command->map_list);
begin_unwind_frame("for");
add_unwind_protect(dispose_words, releaser);
if (for_command->flags & 0x08)
for_command->action->flags |= 0x08;
for (retval = 0; list; list = list->next) {
do {
if (terminating_signal)
termsig_handler(terminating_signal);
if (interrupt_state)
throw_to_top_level();
} while (0);
line_number = for_command->line;
command_string_index = 0;
print_for_command_head(for_command);
if (echo_command_at_execute)
xtrace_print_for_command_head(for_command);
if (signal_in_progress((64 + 1)) == 0 && running_trap == 0) {
do {
if (the_printed_command_except_trap)
sh_xfree((the_printed_command_except_trap), "execute_cmd.c", 2928);
} while (0);
the_printed_command_except_trap = (char *)strcpy(
sh_xmalloc((1 + strlen(the_printed_command)), "execute_cmd.c", 2929),
(the_printed_command));
}
retval = run_debug_trap();
if (debugging_mode && retval != 0)
continue;
this_command_name = (char *)((void *)0);
v = find_variable_last_nameref(identifier, 1);
if (v && ((((v)->attributes) & (0x0000800)))) {
if (valid_nameref_value(list->word->word, 1) == 0) {
sh_invalidid(list->word->word);
v = 0;
} else if (((((v)->attributes) & (0x0000002))))
err_readonly(((v)->name));
else
v = bind_variable_value(v, list->word->word, 0x0010);
} else
v = bind_variable(identifier, list->word->word, 0);
if (v == 0 || ((((v)->attributes) & (0x0000002))) ||
((((v)->attributes) & (0x0004000)))) {
line_number = save_line_number;
if (v && ((((v)->attributes) & (0x0000002))) && interactive_shell == 0 &&
posixly_correct) {
last_command_exit_value = 1;
jump_to_top_level(1);
} else {
dispose_words(releaser);
discard_unwind_frame("for");
loop_level--;
return (1);
}
}
if (((identifier)[0] == 'I' && (identifier)[1] == 'F' &&
(identifier)[2] == 'S' && (identifier)[3] == '\0'))
setifs(v);
else
stupidly_hack_special_variables(identifier);
retval = execute_command(for_command->action);
do {
if (job_control == 0 || interactive_shell == 0)
reap_dead_jobs();
} while (0);
do {
if (terminating_signal)
termsig_handler(terminating_signal);
if (interrupt_state)
throw_to_top_level();
} while (0);
if (breaking) {
breaking--;
break;
}
if (continuing) {
continuing--;
if (continuing)
break;
}
}
loop_level--;
line_number = save_line_number;
dispose_words(releaser);
discard_unwind_frame("for");
return (retval);
} | long long execute_for_command(struct_0 *a0, unsigned int a1, unsigned int a2,
unsigned int a3, unsigned int a4,
unsigned long long a5) {
unsigned int v0;
unsigned int v1;
void *v2;
char v3[4];
unsigned long long v5;
unsigned long long v6;
struct_3 *v7;
unsigned long long v8;
v1 = line_number;
if (!check_identifier(a0->field_8, 0x1)) {
if (*(&posixly_correct) && !*(&interactive_shell)) {
line_number_for_err_trap = 2;
jump_to_top_level(0x4);
}
v8 = 1;
return v8;
} else {
loop_level = loop_level + 1;
*(&v3) = a0->field_8->field_0;
line_number = a0->field_4;
v5 = expand_words_no_vars(a0->field_10);
v6 = v5;
v7 = v5;
begin_unwind_frame("for");
add_unwind_protect(got.dispose_words, v5);
if ((a0->field_0 & 8))
a0->field_18->field_4 = a0->field_18->field_4 | 8;
v0 = 0;
while (true) {
if (!v7) {
LABEL_404ec8:
loop_level = loop_level - 1;
line_number = v1;
dispose_words(v6);
discard_unwind_frame("for");
v8 = v0;
return v8;
}
if (terminating_signal)
termsig_handler(terminating_signal);
if (interrupt_state)
throw_to_top_level();
line_number = a0->field_4;
command_string_index = 0;
print_for_command_head(a0);
if (echo_command_at_execute)
xtrace_print_for_command_head(a0);
if (!signal_in_progress(0x41) && !running_trap) {
sh_xfree(0xbaec7d8920ec8348, "execute_cmd.c", 0xb70);
this_shell_function = strcpy(
sh_xmalloc(strlen(the_printed_command) + 1, "execute_cmd.c", 0xb71),
the_printed_command);
}
v0 = run_debug_trap();
if (debugging_mode && v0) {
LABEL_404eb9:
v7 = v7->field_0;
} else {
this_shell_function = 0;
v2 = find_variable_last_nameref(v3, 0x1);
if (!v2 || !(v2[40] & 0x800)) {
v2 = bind_variable(v3, v7->field_8->field_0, 0x0,
v7->field_8->field_0);
} else if (!valid_nameref_value(v7->field_8->field_0, 0x1)) {
sh_invalidid(v7->field_8->field_0);
v2 = 0;
} else if (!(v2[40] & 2)) {
v2 = bind_variable_value(v2, v7->field_8->field_0, 0x10,
v7->field_8->field_0);
} else {
err_readonly(*(v2));
}
if (!v2 || (v2[40] & 2) || (v2[40] & 0x4000)) {
line_number = v1;
if (v2 && (v2[40] & 2) && !*(&interactive_shell) &&
*(&posixly_correct)) {
line_number_for_err_trap = 1;
jump_to_top_level(0x1);
break;
}
}
if (v3[0] != 73 || v3[1] != 70 || v3[2] != 83 || v3[3])
stupidly_hack_special_variables(v3);
else
setifs(v2);
v0 = execute_command(a0->field_18, a1, a2, a3, a4, a5);
if (!job_control || !*(&interactive_shell))
reap_dead_jobs();
if (terminating_signal)
termsig_handler(terminating_signal);
if (interrupt_state)
throw_to_top_level();
if (breaking) {
breaking = breaking - 1;
loop_level = loop_level - 1;
line_number = v1;
dispose_words(v6);
discard_unwind_frame("for");
v8 = v0;
return v8;
}
if (!((continuing = continuing - 1, continuing)))
goto LABEL_404eb9;
goto LABEL_404ec8;
}
}
dispose_words(v6);
discard_unwind_frame("for");
loop_level = loop_level - 1;
v8 = 1;
return v8;
}
} | bash | angr_sailr |
void free_undo_list(void) { rl_free_undo_list(); } | long free_undo_list() { return rl_free_undo_list(); } | bash | ida |
static int print_ila_mapping(struct nlmsghdr *n, void *arg) {
struct genlmsghdr *ghdr;
struct rtattr *tb[(__ILA_ATTR_MAX - 1) + 1];
int len = n->nlmsg_len;
if (n->nlmsg_type != genl_family)
return 0;
len -= (((((sizeof(struct genlmsghdr)) + 4U - 1) & ~(4U - 1))) +
((int)(((sizeof(struct nlmsghdr)) + 4U - 1) & ~(4U - 1))));
if (len < 0)
return -1;
ghdr = ((void *)(((char *)n) +
((int)(((sizeof(struct nlmsghdr)) + 4U - 1) & ~(4U - 1)))));
parse_rtattr(
tb, (__ILA_ATTR_MAX - 1),
(void *)ghdr + (((sizeof(struct genlmsghdr)) + 4U - 1) & ~(4U - 1)), len);
open_json_object(((void *)0));
print_ila_locid("locator_match", ILA_ATTR_LOCATOR_MATCH, tb);
print_ila_locid("locator", ILA_ATTR_LOCATOR, tb);
if (tb[ILA_ATTR_IFINDEX]) {
__u32 ifindex = rta_getattr_u32(tb[ILA_ATTR_IFINDEX]);
print_color_string(PRINT_ANY, COLOR_IFNAME, "interface", "%-16s",
ll_index_to_name(ifindex));
} else {
print_string(PRINT_FP, ((void *)0), "%-10s ", "-");
}
if (tb[ILA_ATTR_CSUM_MODE]) {
__u8 csum = rta_getattr_u8(tb[ILA_ATTR_CSUM_MODE]);
print_string(PRINT_ANY, "csum_mode", "%s", ila_csum_mode2name(csum));
} else
print_string(PRINT_FP, ((void *)0), "%-10s ", "-");
if (tb[ILA_ATTR_IDENT_TYPE])
print_string(PRINT_ANY, "ident_type", "%s",
ila_ident_type2name(rta_getattr_u8(tb[ILA_ATTR_IDENT_TYPE])));
else
print_string(PRINT_FP, ((void *)0), "%s", "-");
print_nl();
close_json_object();
return 0;
} | long long print_ila_mapping(struct_0 *a0, unsigned long long a1,
unsigned long a2, unsigned long long a3,
unsigned long long a4, unsigned long long a5) {
unsigned long v0;
char v1;
unsigned int v2;
unsigned int v3;
unsigned long v4;
char v5;
char v6;
char v7;
char v8;
unsigned long long v10;
v0 = a1;
v2 = a0->field_0;
if (a0->field_4 != genl_family) {
v10 = 0;
return v10;
}
v2 -= 20;
if (v2 < 0) {
v10 = 4294967295;
return v10;
}
v4 = &a0[2].field_4;
parse_rtattr(&v5, 0x9, v4 + 4, v2);
open_json_object(0x0);
print_ila_locid("locator_match", 0x3, &v5);
print_ila_locid("locator", 0x1, &v5);
if (!*(&v6)) {
print_string(0x1, 0x0, "%-10s ", "-");
} else {
v3 = rta_getattr_u32(*(&v6));
print_color_string(0x4, 0x0, "interface", "%-16s", ll_index_to_name(v3));
}
if (!*(&v7)) {
print_string(0x1, 0x0, "%-10s ", "-");
} else {
v1 = rta_getattr_u8(*(&v7));
print_string(0x4, "csum_mode", "%s", ila_csum_mode2name(v1));
}
if (!*(&v8))
print_string(0x1, 0x0, "%s", "-");
else
print_string(0x4, "ident_type", "%s",
ila_ident_type2name(rta_getattr_u8(*(&v8))));
print_nl(a0, a1, "%s", a3, a4, a5);
close_json_object(a0, a1, "%s", a3, a4, a5);
v10 = 0;
return v10;
} | iproute2-6.0.0 | angr_sailr |
static void print_element_env(char const *element,
__attribute__((__unused__)) char const *envvar) {
print_element(element);
} | void print_element_env(undefined8 param_1)
{
print_element(param_1);
return;
} | coreutils | ghidra |
static inline __u32 rta_getattr_u32(const struct rtattr *rta) {
return *(__u32 *)((
void *)(((char *)(rta)) +
((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0))));
} | undefined4 rta_getattr_u32(long param_1)
{
return *(undefined4 *)(param_1 + 4);
} | iproute2-6.0.0 | ghidra |
static int server_input_channel_open(int type, u_int32_t seq, struct ssh *ssh) {
Channel *c = ((void *)0);
char *ctype = ((void *)0);
const char *errmsg = ((void *)0);
int r, reason = 2;
u_int rchan = 0, rmaxpack = 0, rwindow = 0;
if ((r = sshpkt_get_cstring(ssh, &ctype, ((void *)0))) != 0 ||
(r = sshpkt_get_u32(ssh, &rchan)) != 0 ||
(r = sshpkt_get_u32(ssh, &rwindow)) != 0 ||
(r = sshpkt_get_u32(ssh, &rmaxpack)) != 0)
sshpkt_fatal(ssh, r, "%s: parse packet", __func__);
sshlog("serverloop.c", __func__, 635, 1, SYSLOG_LEVEL_DEBUG1, ((void *)0),
"ctype %s rchan %u win %u max %u", ctype, rchan, rwindow, rmaxpack);
if (strcmp(ctype, "session") == 0) {
c = server_request_session(ssh);
} else if (strcmp(ctype, "direct-tcpip") == 0) {
c = server_request_direct_tcpip(ssh, &reason, &errmsg);
} else if (strcmp(ctype, "direct-streamlocal@openssh.com") == 0) {
c = server_request_direct_streamlocal(ssh);
} else if (strcmp(ctype, "tun@openssh.com") == 0) {
c = server_request_tun(ssh);
}
if (c != ((void *)0)) {
sshlog("serverloop.c", __func__, 648, 1, SYSLOG_LEVEL_DEBUG1, ((void *)0),
"confirm %s", ctype);
c->remote_id = rchan;
c->have_remote_id = 1;
c->remote_window = rwindow;
c->remote_maxpacket = rmaxpack;
if (c->type != 12) {
if ((r = sshpkt_start(ssh, 91)) != 0 ||
(r = sshpkt_put_u32(ssh, c->remote_id)) != 0 ||
(r = sshpkt_put_u32(ssh, c->self)) != 0 ||
(r = sshpkt_put_u32(ssh, c->local_window)) != 0 ||
(r = sshpkt_put_u32(ssh, c->local_maxpacket)) != 0 ||
(r = sshpkt_send(ssh)) != 0) {
sshpkt_fatal(ssh, r, "%s: send open confirm", __func__);
}
}
} else {
sshlog("serverloop.c", __func__, 665, 1, SYSLOG_LEVEL_DEBUG1, ((void *)0),
"failure %s", ctype);
if ((r = sshpkt_start(ssh, 92)) != 0 ||
(r = sshpkt_put_u32(ssh, rchan)) != 0 ||
(r = sshpkt_put_u32(ssh, reason)) != 0 ||
(r = sshpkt_put_cstring(ssh, errmsg ? errmsg : "open failed")) != 0 ||
(r = sshpkt_put_cstring(ssh, "")) != 0 || (r = sshpkt_send(ssh)) != 0) {
sshpkt_fatal(ssh, r, "%s: send open failure", __func__);
}
}
free(ctype);
return 0;
} | long long server_input_channel_open(unsigned long a0, unsigned long a1,
unsigned long long a2) {
void *v0;
unsigned long v1;
unsigned long v2;
void *v3;
unsigned int v4;
unsigned int v5;
unsigned int v6;
unsigned int v7;
unsigned int v8;
unsigned int v9;
unsigned int v10;
void *v11;
void *v12;
void *v13;
unsigned long long v15;
v5 = a0;
v4 = a1;
v13 = 0;
v11 = 0;
v12 = 0;
v6 = 2;
v7 = 0;
v8 = 0;
v9 = 0;
v10 = sshpkt_get_cstring(a2, &v11, 0x0, &v11);
if (!v10) {
v10 = sshpkt_get_u32(a2, &v7, &v7);
if (!v10) {
v10 = sshpkt_get_u32(a2, &v9, &v9);
if (!v10) {
v10 = sshpkt_get_u32(a2, &v8, &v8);
if (!v10)
goto LABEL_4019b1;
}
}
}
sshpkt_fatal(a2, v10, "%s: parse packet", "server_input_channel_open");
LABEL_4019b1:
v2 = v9;
v1 = v7;
v0 = v11;
sshlog("serverloop.c", "server_input_channel_open", 0x27b, 0x1, 0x5, 0x0,
"ctype %s rchan %u win %u max %u");
if (!strcmp(v11, "session")) {
v13 = server_request_session(a2);
} else if (!strcmp(v11, "direct-tcpip")) {
v13 = server_request_direct_tcpip(a2, &v6, &v12);
} else if (!strcmp(v11, "direct-streamlocal@openssh.com")) {
v13 = server_request_direct_streamlocal(a2);
} else if (!strcmp(v11, "tun@openssh.com")) {
v13 = server_request_tun(a2);
}
if (v13) {
v3 = v11;
sshlog("serverloop.c", "server_input_channel_open", 0x288, 0x1, 0x5, 0x0,
"confirm %s");
*(&v13[8]) = v7;
*(&v13[12]) = 1;
*(&v13[168]) = v9;
*(&v13[172]) = v8;
if (*(v13) == 12)
goto LABEL_401d25;
v10 = sshpkt_start(a2, 0x5b);
if (!v10) {
v10 = sshpkt_put_u32(a2, v13[8], v13[8]);
if (!v10) {
v10 = sshpkt_put_u32(a2, v13[4], v13[4]);
if (!v10) {
v10 = sshpkt_put_u32(a2, v13[176], v13[176]);
if (!v10) {
v10 = sshpkt_put_u32(a2, v13[188], v13[188]);
if (!v10) {
v10 = sshpkt_send(a2);
if (!v10)
goto LABEL_401d25;
}
}
}
}
}
sshpkt_fatal(a2, v10, "%s: send open confirm", "server_input_channel_open");
}
v3 = v11;
sshlog("serverloop.c", "server_input_channel_open", 0x299, 0x1, 0x5, 0x0,
"failure %s");
v10 = sshpkt_start(a2, 0x5c);
if (!v10) {
v10 = sshpkt_put_u32(a2, v7, v7);
if (!v10) {
v10 = sshpkt_put_u32(a2, v6, v6);
if (!v10) {
if (!v12)
v15 = "open failed";
else
v15 = v12;
v10 = sshpkt_put_cstring(a2, v15);
if (!v10) {
v10 = sshpkt_put_cstring(a2, &g_403301);
if (!v10) {
v10 = sshpkt_send(a2);
if (!v10)
goto LABEL_401d25;
}
}
}
}
}
sshpkt_fatal(a2, v10, "%s: send open failure", "server_input_channel_open");
LABEL_401d25:
free(v11);
return 0;
} | openssh-portable | angr_phoenix |
int sshpkt_get_ec(struct ssh *ssh, EC_POINT *v, const EC_GROUP *g) {
return sshbuf_get_ec(ssh->state->incoming_packet, v, g);
} | void sshpkt_get_ec(long *param_1, undefined8 param_2, undefined8 param_3)
{
sshbuf_get_ec(*(undefined8 *)(*param_1 + 0x38), param_2, param_3);
return;
} | openssh-portable | ghidra |
static void control_path_file(struct pkginfo *pkg, const char *control_file) {
const char *control_pathname;
struct stat st;
control_pathname = pkg_infodb_get_file(pkg, &pkg->installed, control_file);
if (stat(control_pathname, &st) < 0)
return;
if (!((((st.st_mode)) & 0170000) == (0100000)))
return;
pkg_infodb_print_filename(control_pathname, control_file);
} | void control_path_file(unsigned long long a0, char *a1) {
unsigned long v0;
char v1;
char v2;
char v3;
unsigned long long *v6;
unsigned long long v7;
v0 = pkg_infodb_get_file(a0, a0 + 72, a1, a0 + 72);
if (stat(v0, &v1) >= 0 && (*(&v2) & 0xf000) == 0x8000)
pkg_infodb_print_filename(v0, a1);
v7 = *(&v3) ^ v6[5];
return;
} | dpkg | angr_dream |
idx_t wordchars_size(char const *buf, char const *end) {
return wordchars_count(buf, end, 1);
} | long long wordchars_size(void *a0, unsigned int a1) {
return wordchars_count(a0, a1, 0x1);
} | grep | angr_phoenix |
static int parse_link_flags(const char *cmd, char **argv, int argc,
int *sflag) {
int ch;
BSDoptind = BSDoptreset = 1;
BSDopterr = 0;
*sflag = 0;
while ((ch = BSDgetopt(argc, argv, "s")) != -1) {
switch (ch) {
case 's':
*sflag = 1;
break;
default:
sshlog("sftp.c", __func__, 450, 0, SYSLOG_LEVEL_ERROR, ((void *)0),
"%s: Invalid flag -%c", cmd, BSDoptopt);
return -1;
}
}
return BSDoptind;
} | int parse_link_flags(unsigned long long a0, unsigned long long a1,
unsigned long a2, unsigned int *a3) {
unsigned long v0;
unsigned int v1;
unsigned int v3;
BSDoptreset = 1;
BSDoptind = BSDoptreset;
BSDopterr = 0;
*(a3) = 0;
while (true) {
v1 = BSDgetopt(a2, a1, "s", a1);
if (v1 == -1) {
v3 = BSDoptind;
break;
} else if (v1 == 115) {
*(a3) = 1;
} else {
v0 = BSDoptopt;
sshlog("sftp.c", "parse_link_flags", 0x1c2, 0x0, 0x2, 0x0,
"%s: Invalid flag -%c", a0);
v3 = -1;
break;
}
}
return v3;
} | openssh-portable | angr_dream |
static int input_userauth_request(int type, u_int32_t seq, struct ssh *ssh) {
Authctxt *authctxt = ssh->authctxt;
Authmethod *m = ((void *)0);
char *user = ((void *)0), *service = ((void *)0), *method = ((void *)0),
*style = ((void *)0);
int r, authenticated = 0;
double tstart = monotime_double();
if (authctxt == ((void *)0))
sshfatal("auth2.c", __func__, 270, 0, SYSLOG_LEVEL_FATAL, ((void *)0),
"input_userauth_request: no authctxt");
if ((r = sshpkt_get_cstring(ssh, &user, ((void *)0))) != 0 ||
(r = sshpkt_get_cstring(ssh, &service, ((void *)0))) != 0 ||
(r = sshpkt_get_cstring(ssh, &method, ((void *)0))) != 0)
goto out;
sshlog("auth2.c", __func__, 276, 0, SYSLOG_LEVEL_DEBUG1, ((void *)0),
"userauth-request for user %s service %s method %s", user, service,
method);
sshlog("auth2.c", __func__, 277, 0, SYSLOG_LEVEL_DEBUG1, ((void *)0),
"attempt %d failures %d", authctxt->attempt, authctxt->failures);
if ((style = strchr(user, ':')) != ((void *)0))
*style++ = 0;
if (authctxt->attempt >= 1024)
auth_maxtries_exceeded(ssh);
if (authctxt->attempt++ == 0) {
authctxt->pw =
(use_privsep ? mm_getpwnamallow(ssh, user) : getpwnamallow(ssh, user));
authctxt->user = xstrdup(user);
if (authctxt->pw && strcmp(service, "ssh-connection") == 0) {
authctxt->valid = 1;
sshlog("auth2.c", __func__, 290, 1, SYSLOG_LEVEL_DEBUG2, ((void *)0),
"setting up authctxt for %s", user);
} else {
authctxt->valid = 0;
authctxt->pw = fakepw();
}
ssh_packet_set_log_preamble(
ssh, "%suser %s", authctxt->valid ? "authenticating " : "invalid ",
user);
setproctitle("%s%s", authctxt->valid ? user : "unknown",
use_privsep ? " [net]" : "");
authctxt->service = xstrdup(service);
authctxt->style = style ? xstrdup(style) : ((void *)0);
if (use_privsep)
mm_inform_authserv(service, style);
userauth_banner(ssh);
if (auth2_setup_methods_lists(authctxt) != 0)
ssh_packet_disconnect(ssh, "no authentication methods enabled");
} else if (strcmp(user, authctxt->user) != 0 ||
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);
}
auth2_challenge_stop(ssh);
auth2_authctxt_reset_info(authctxt);
authctxt->postponed = 0;
authctxt->server_caused_failure = 0;
m = authmethod_lookup(authctxt, method);
if (m != ((void *)0) && authctxt->failures < options.max_authtries) {
sshlog("auth2.c", __func__, 337, 0, SYSLOG_LEVEL_DEBUG2, ((void *)0),
"input_userauth_request: try method %s", method);
authenticated = m->userauth(ssh, method);
}
if (!authctxt->authenticated)
ensure_minimum_time_since(tstart, user_specific_delay(authctxt->user));
userauth_finish(ssh, authenticated, method, ((void *)0));
r = 0;
out:
free(service);
free(user);
free(method);
return r;
} | long long input_userauth_request(unsigned long a0, unsigned long a1,
struct_0 *a2) {
unsigned long long v0;
unsigned int v1;
unsigned int v2;
unsigned int v3;
unsigned int v4;
void *v5;
void *v6;
void *v7;
unsigned long long v8;
struct_2 *v9;
void *v10;
unsigned long v11;
unsigned long long v12;
void *v13;
unsigned long long v14;
void *v15;
unsigned long long v16;
unsigned long v17;
unsigned long v18;
unsigned long v19;
char *v20;
unsigned int v21;
unsigned long long v22;
void *v25;
v2 = a0;
v1 = a1;
v9 = a2->field_860;
v10 = 0;
v5 = 0;
v6 = 0;
v7 = 0;
v8 = 0;
v4 = 0;
monotime_double();
v11 = v19;
if (!v9) {
v0 = "input_userauth_request: no authctxt";
sshfatal("auth2.c", "input_userauth_request", 0x10e, 0x0, 0x1, 0x0);
}
v3 = sshpkt_get_cstring(a2, &v5, 0x0, &v5);
if (!v3) {
v3 = sshpkt_get_cstring(a2, &v6, 0x0, &v6);
if (!v3) {
v3 = sshpkt_get_cstring(a2, &v7, 0x0, &v7);
if (!v3) {
v15 = v7;
v14 = v6;
v13 = v5;
v12 = "userauth-request for user %s service %s method %s";
sshlog("auth2.c", "input_userauth_request", 0x114, 0x0, 0x5, 0x0,
*(&v16));
v18 = v9->field_14;
v17 = v9->field_10;
v16 = "attempt %d failures %d";
sshlog("auth2.c", "input_userauth_request", 0x115, 0x0, 0x5, 0x0,
"attempt %d failures %d");
v8 = strchr(v5, 0x3a);
if (v8) {
v20 = v8;
v8 += 1;
*(v20) = 0;
}
if (v9->field_10 > 1023)
auth_maxtries_exceeded(a2);
v21 = v9->field_10;
v9->field_10 = __addvsi3(v9->field_10, 0x1);
if (v21) {
LABEL_400cd4:
if (strcmp(v5, v9->field_20) || strcmp(v6, v9->field_28))
ssh_packet_disconnect(
a2,
"Change of username or service not allowed: (%s,%s) -> (%s,%s)",
v9->field_20);
} else {
if (!use_privsep)
v22 = getpwnamallow(a2, v5, v5);
else
v22 = mm_getpwnamallow(a2, v5, v5);
v9->field_30 = v22;
v9->field_20 = xstrdup(v5);
if (!v9->field_30 || strcmp(v6, "ssh-connection")) {
v9->field_c = 0;
v9->field_30 = fakepw();
} else {
v9->field_c = 1;
v15 = v5;
v14 = "setting up authctxt for %s";
sshlog("auth2.c", "input_userauth_request", 0x122, 0x1, 0x6, 0x0,
"attempt %d failures %d");
}
ssh_packet_set_log_preamble(
a2, "%suser %s", (!v9->field_c ? "authenticating " : "invalid "),
v5);
setproctitle("%s%s", (!v9->field_c ? v5 : "unknown"));
v9->field_28 = xstrdup(v6);
if (!v8)
v25 = 0;
else
v25 = xstrdup(v8);
v9->field_38 = v25;
if (use_privsep)
mm_inform_authserv(v6, v8, v8);
userauth_banner(a2, a1, v9);
if (auth2_setup_methods_lists(v9)) {
ssh_packet_disconnect(a2, "no authentication methods enabled", v9);
goto LABEL_400cd4;
}
}
auth2_challenge_stop(a2);
auth2_authctxt_reset_info(v9);
v9->field_8 = 0;
v9->field_18 = 0;
v10 = authmethod_lookup(v9, v7);
if (v10 && v9->field_14 < *(5250536)) {
v15 = v7;
v14 = "input_userauth_request: try method %s";
sshlog("auth2.c", "input_userauth_request", 0x151, 0x0, 0x6, 0x0,
"attempt %d failures %d");
v4 = v10->field_10(a2, v7, v7, v10->field_10);
}
if (!v9->field_4) {
user_specific_delay(v9->field_20);
ensure_minimum_time_since();
}
userauth_finish(a2, v4, v7, 0x0);
v3 = 0;
}
}
}
free(v6);
free(v5);
free(v7);
return v3;
} | openssh-portable | angr_sailr |
void freefunc(struct funcnode *f) {
if (f && --f->count < 0)
free((pointer)(f));
} | long long freefunc(unsigned int *a0) {
unsigned int *v0;
unsigned long long v2;
v0 = a0;
if (a0) {
*(a0) = *(a0)-1;
v2 = *(a0);
if (*(a0) < 0)
v2 = free(a0);
}
return v2;
} | dash-0.5.11+git20210903+057cd650a4ed | angr_sailr |
static void print_runlevel(const STRUCT_UTMP *utmp_ent) {
static char *runlevline, *comment;
unsigned char last = ((utmp_ent)->ut_pid) / 256;
unsigned char curr = ((utmp_ent)->ut_pid) % 256;
if (!runlevline)
runlevline = xmalloc(strlen(gettext("run-level")) + 3);
sprintf(runlevline, "%s %c", gettext("run-level"), curr);
if (!comment)
comment = xmalloc(strlen(gettext("last=")) + 2);
sprintf(comment, "%s%c", gettext("last="), (last == 'N') ? 'S' : last);
print_line(-1, "", ' ', -1, runlevline, time_string(utmp_ent), "", "",
c_isprint(last) ? comment : "", "");
return;
} | void print_runlevel(struct_0 *a0) {
char v0;
char v1;
unsigned int v4;
unsigned long long v6;
unsigned long long v7;
v0 = (a0->field_4 < 0 ? a0->field_4 + 255 : a0->field_4) >> 8;
v1 = a0->field_4 + (a0->field_4 >> 31 >> 24) - (a0->field_4 >> 31 >> 24);
if (!runlevline.6680)
runlevline.6680 = xmalloc(strlen(gettext("run-level")) + 3);
sprintf(runlevline.6680, "%s %c", gettext("run-level"), v1);
if (!comment.6681)
comment.6681 = xmalloc(strlen(gettext("last=")) + 2);
if (v0 != 78)
v4 = v0;
else
v4 = 83;
sprintf(comment.6681, "%s%c", gettext("last="), v4);
if (c_isprint(v0))
v6 = comment.6681;
else
v6 = &g_401de3;
v7 = print_line(0xffffffff, &g_401de3, 0x20, 0xffffffff, runlevline.6680,
time_string(a0), &g_401de3, &g_401de3, v6, &g_401de3);
return;
} | coreutils | angr_dream |
static int waitproc(int block, int *status) {
sigset_t oldmask;
int flags = block == 1 ? 0 : 1;
int err;
if (jobctl)
flags |= 2;
do {
gotsigchld = 0;
do
err = wait3(status, flags, ((void *)0));
while (err < 0 && (*dash_errno) == 4);
if (err || (err = -!block))
break;
sigblockall(&oldmask);
while (!gotsigchld && !pending_sig)
sigsuspend(&oldmask);
sigclearmask();
} while (gotsigchld);
return err;
} | __pid_t waitproc(int param_1, void *param_2)
{
long in_FS_OFFSET;
uint local_a0;
__pid_t local_9c;
sigset_t local_98;
long local_10;
local_10 = *(long *)(in_FS_OFFSET + 0x28);
local_a0 = (uint)(param_1 != 1);
if (jobctl != 0) {
local_a0 = local_a0 | 2;
}
do {
gotsigchld = 0;
do {
local_9c = wait3(param_2, local_a0, (rusage *)0x0);
if (-1 < local_9c)
break;
} while (*dash_errno == 4);
if ((local_9c != 0) || (local_9c = -(uint)(param_1 == 0), local_9c != 0))
break;
sigblockall(&local_98);
while ((gotsigchld == 0 && (pending_sig == 0))) {
sigsuspend(&local_98);
}
sigclearmask();
} while (gotsigchld != 0);
if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) {
__stack_chk_fail();
}
return local_9c;
} | dash-0.5.11+git20210903+057cd650a4ed | ghidra |
static int ext4_fc_handle_inode(e2fsck_t ctx, __u8 *val) {
int ino, inode_len = 128;
struct ext2_inode_large *inode = ((void *)0), *fc_inode = ((void *)0);
__le32 fc_ino;
__u8 *fc_raw_inode;
errcode_t err;
blk64_t blks;
memcpy(&fc_ino, val, sizeof(fc_ino));
fc_raw_inode = val + sizeof(fc_ino);
ino = ((__u32)(__le32)(fc_ino));
if ((((ctx->fs->super)->s_rev_level == 0)
? 128
: (ctx->fs->super)->s_inode_size) > 128)
inode_len += ((__u16)(__le16)(((struct ext2_inode_large *)fc_raw_inode)
->i_extra_isize));
err = ext2fs_get_mem(inode_len, &inode);
if (err)
goto out;
err = ext2fs_get_mem(inode_len, &fc_inode);
if (err)
goto out;
ext4_fc_flush_extents(ctx, ino);
err = ext2fs_read_inode_full(ctx->fs, ino, (struct ext2_inode *)inode,
inode_len);
if (err)
goto out;
memcpy(fc_inode, fc_raw_inode, inode_len);
memcpy(inode, fc_inode, __builtin_offsetof(struct ext2_inode_large, i_block));
memcpy(&inode->i_generation, &fc_inode->i_generation,
inode_len - __builtin_offsetof(struct ext2_inode_large, i_generation));
ext4_fc_replay_fixup_iblocks(inode, fc_inode);
err = ext2fs_count_blocks(ctx->fs, ino, EXT2_INODE(inode), &blks);
if (err)
goto out;
ext2fs_iblk_set(ctx->fs, EXT2_INODE(inode), blks);
ext2fs_inode_csum_set(ctx->fs, ino, inode);
err = ext2fs_write_inode_full(ctx->fs, ino, (struct ext2_inode *)inode,
inode_len);
if (err)
goto out;
if (inode->i_links_count)
ext2fs_mark_inode_bitmap2(ctx->fs->inode_map, ino);
else
ext2fs_unmark_inode_bitmap2(ctx->fs->inode_map, ino);
ext2fs_mark_ib_dirty(ctx->fs);
out:
ext2fs_free_mem(&inode);
ext2fs_free_mem(&fc_inode);
return __errcode_to_errno(err, __func__, 793);
} | long ext4_fc_handle_inode(_QWORD *a1, long a2) {
long v2;
long v3;
long v4;
unsigned int dest;
unsigned int v7;
unsigned int v8;
void *v9;
void *v10;
long v11;
long mem;
void *v13;
unsigned long v14;
v14 = __readfsqword(0x28u);
v7 = 128;
v9 = 0LL;
v10 = 0LL;
memcpy(&dest, (const void *)a2, sizeof(dest));
v13 = (void *)(a2 + 4);
v8 = dest;
if (*(_DWORD *)(*(_QWORD *)(*a1 + 32LL) + 76LL) &&
*(_WORD *)(*(_QWORD *)(*a1 + 32LL) + 88LL) > 0x80u)
v7 += *((unsigned short *)v13 + 64);
mem = ext2fs_get_mem((int)v7, &v9);
if (!mem) {
mem = ext2fs_get_mem((int)v7, &v10);
if (!mem) {
ext4_fc_flush_extents((long)a1, (void *)(int)v8);
mem = ext2fs_read_inode_full(*a1, v8, v9, v7);
if (!mem) {
memcpy(v10, v13, (int)v7);
memcpy(v9, v10, 0x28uLL);
memcpy((char *)v9 + 100, (char *)v10 + 100, (int)v7 - 100LL);
ext4_fc_replay_fixup_iblocks((long)v9, (long)v10);
v2 = EXT2_INODE((long)v9);
mem = ext2fs_count_blocks(*a1, v8, v2, &v11);
if (!mem) {
v3 = v11;
v4 = EXT2_INODE((long)v9);
ext2fs_iblk_set(*a1, v4, v3);
ext2fs_inode_csum_set(*a1, v8, v9);
mem = ext2fs_write_inode_full(*a1, v8, v9, v7);
if (!mem) {
if (*((_WORD *)v9 + 13))
ext2fs_mark_inode_bitmap2(*(_QWORD *)(*a1 + 80LL), v8);
else
ext2fs_unmark_inode_bitmap2(*(_QWORD *)(*a1 + 80LL), v8);
ext2fs_mark_ib_dirty(*a1);
}
}
}
}
}
ext2fs_free_mem(&v9);
ext2fs_free_mem(&v10);
return _errcode_to_errno(mem, "ext4_fc_handle_inode", 0x319u);
} | e2fsprogs-1.46.5 | ida |
static void align_column(COLUMN *p) {
padding_not_printed = p->start_position;
if (col_sep_length < padding_not_printed) {
pad_across_to(padding_not_printed - col_sep_length);
padding_not_printed = 0;
}
if (use_col_separator)
print_sep_string();
if (p->numbered)
add_line_number(p);
} | void align_column(struct_0 *a0) {
unsigned long long v1;
unsigned long long v2;
padding_not_printed = a0->field_34;
if (col_sep_length < padding_not_printed) {
pad_across_to(padding_not_printed - col_sep_length);
padding_not_printed = 0;
}
if (use_col_separator)
print_sep_string();
v1 = a0->field_38;
if (a0->field_38)
v2 = add_line_number(a0);
return;
} | coreutils | angr_dream |
int addr_match_cidr_list(const char *addr, const char *_list) {
char *list, *cp, *o;
struct xaddr try_addr, match_addr;
u_int masklen;
int ret = 0, r;
if (addr != ((void *)0) && addr_pton(addr, &try_addr) != 0) {
sshlog("addrmatch.c", __func__, 117, 1, SYSLOG_LEVEL_DEBUG2, ((void *)0),
"couldn't parse address %.100s", addr);
return 0;
}
if ((o = list = strdup(_list)) == ((void *)0))
return -1;
while ((cp = strsep(&list, ",")) != ((void *)0)) {
if (*cp == '\0') {
sshlog("addrmatch.c", __func__, 124, 1, SYSLOG_LEVEL_ERROR, ((void *)0),
"empty entry in list \"%.100s\"", o);
ret = -1;
break;
}
if (strlen(cp) > 46 + 3) {
sshlog("addrmatch.c", __func__, 137, 1, SYSLOG_LEVEL_ERROR, ((void *)0),
"list entry \"%.100s\" too long", cp);
ret = -1;
break;
}
if (strspn(cp, "0123456789abcdefABCDEF.:/") != strlen(cp)) {
sshlog("addrmatch.c", __func__, 143, 1, SYSLOG_LEVEL_ERROR, ((void *)0),
"list entry \"%.100s\" contains invalid "
"characters",
cp);
ret = -1;
}
r = addr_pton_cidr(cp, &match_addr, &masklen);
if (r == -1) {
sshlog("addrmatch.c", __func__, 151, 0, SYSLOG_LEVEL_ERROR, ((void *)0),
"Invalid network entry \"%.100s\"", cp);
ret = -1;
break;
} else if (r == -2) {
sshlog("addrmatch.c", __func__, 155, 0, SYSLOG_LEVEL_ERROR, ((void *)0),
"Inconsistent mask length for "
"network \"%.100s\"",
cp);
ret = -1;
break;
} else if (r == 0 && addr != ((void *)0)) {
if (addr_netmatch(&try_addr, &match_addr, masklen) == 0)
ret = 1;
continue;
}
}
free(o);
return ret;
} | long long addr_match_cidr_list(unsigned long long a0, char *a1) {
char *v0;
char v1;
unsigned int v2;
unsigned int v3;
void *v4;
void *v5;
char *v6;
char v7;
char v8;
unsigned long long v10;
unsigned long long v11;
unsigned long long v12;
v2 = 0;
if (a0) {
v10 = addr_pton(a0, &v7, &v7);
if (v10) {
v0 = a0;
sshlog("addrmatch.c", "addr_match_cidr_list", 0x75, 0x1, 0x6, 0x0,
"couldn't parse address %.100s");
v11 = 0;
}
}
if (!a0 || !v10) {
v4 = strdup(a1);
v5 = v4;
if (!v5) {
v11 = 4294967295;
} else {
while (true) {
v6 = strsep(&v4, ",");
if (v6) {
if (!*(v6)) {
v0 = v5;
sshlog("addrmatch.c", "addr_match_cidr_list", 0x7c, 0x1, 0x2, 0x0,
"empty entry in list \"%.100s\"");
v2 = -1;
} else {
v12 = strlen(v6);
if (v12 > 49) {
v0 = v6;
sshlog("addrmatch.c", "addr_match_cidr_list", 0x89, 0x1, 0x2, 0x0,
"list entry \"%.100s\" too long");
v2 = -1;
} else {
if (strspn(v6, "0123456789abcdefABCDEF.:/") != strlen(v6)) {
v0 = v6;
sshlog("addrmatch.c", "addr_match_cidr_list", 0x8f, 0x1, 0x2,
0x0,
"list entry \"%.100s\" contains invalid characters");
v2 = -1;
}
v3 = addr_pton_cidr(v6, &v8, &v1, &v8);
if (v3 == -1) {
v0 = v6;
sshlog("addrmatch.c", "addr_match_cidr_list", 0x97, 0x0, 0x2,
0x0, "Invalid network entry \"%.100s\"");
v2 = -1;
} else if (v3 != -2) {
if (v3)
continue;
if (!a0)
continue;
if (!addr_netmatch(&v7, &v8, *(&v1), &v8))
v2 = 1;
continue;
}
if (v3 == -2) {
v0 = v6;
sshlog("addrmatch.c", "addr_match_cidr_list", 0x9b, 0x0, 0x2,
0x0, "Inconsistent mask length for network \"%.100s\"");
v2 = -1;
}
}
}
}
if (!v6 || v3 == -2 || v3 == -1 || !*(v6) || v12 > 49) {
free(v5);
v11 = v2;
break;
}
}
}
}
return v11;
} | openssh-portable | angr_dream |
int acl_get_tag_type(acl_entry_t entry_d, acl_tag_t *tag_type_p) {
acl_entry_obj *entry_obj_p =
((acl_entry_obj *)__ext2int_and_check(entry_d, (0x9D6B)));
if (!entry_obj_p)
return -1;
if (!tag_type_p) {
(*__errno_location()) = 22;
return -1;
}
*tag_type_p = entry_obj_p->i.e_entry.e_tag;
return 0;
} | long long acl_get_tag_type(unsigned long long a0, unsigned int *a1) {
struct_0 *v0;
unsigned long long v2;
v0 = __ext2int_and_check(a0, 0x9d6b);
if (!v0) {
v2 = 4294967295;
} else if (a1) {
*(a1) = v0->field_20;
v2 = 0;
} else {
*(__errno_location()) = 22;
v2 = 4294967295;
}
return v2;
} | acl-2.3.1 | angr_phoenix |
void checkpath(void) {
static const char *const prog_list[] = {"sh",
"rm",
"tar",
"diff",
"dpkg-deb",
"ldconfig",
"start-stop-daemon",
((void *)0)
};
const char *const *prog;
int warned = 0;
for (prog = prog_list; *prog; prog++) {
if (!find_command(*prog)) {
warning(gettext("'%s' not found in PATH or not executable"), *prog);
warned++;
}
}
if (warned)
forcibleerr(
FORCE_BAD_PATH,
ngettext("%d expected program not found in PATH or not executable\n%s",
"%d expected programs not found in PATH or not executable\n%s",
warned)
,
warned,
gettext("Note: root's PATH should usually contain "
"/usr/local/sbin, /usr/sbin and /sbin"));
} | void checkpath(void)
{
long lVar1;
char cVar2;
undefined8 uVar3;
undefined8 uVar4;
int local_24;
undefined1 *local_20;
local_24 = 0;
for (local_20 = prog_list_5174; *(long *)local_20 != 0;
local_20 = (undefined1 *)((long)local_20 + 8)) {
cVar2 = find_command(*(long *)local_20);
if (cVar2 != '\x01') {
lVar1 = *(long *)local_20;
uVar3 = gettext("\'%s\' not found in PATH or not executable");
warning(uVar3, lVar1);
local_24 = local_24 + 1;
}
}
if (local_24 != 0) {
uVar3 = gettext("Note: root\'s PATH should usually contain "
"/usr/local/sbin, /usr/sbin and /sbin");
uVar4 =
ngettext("%d expected program not found in PATH or not executable\n%s",
"%d expected programs not found in PATH or not executable\n%s",
(long)local_24);
forcibleerr(2, uVar4, local_24, uVar3);
}
return;
} | dpkg | ghidra |
int pwdcmd(int argc, char **argv) {
int flags;
const char *dir = curdir;
flags = cdopt();
if (flags) {
if (physdir == nullstr)
setpwd(dir, 0);
dir = physdir;
}
out1fmt(snlfmt, dir);
return 0;
} | long long pwdcmd(unsigned long a0, unsigned long a1) {
unsigned long v0;
unsigned int v1;
unsigned int v2;
unsigned long long v3;
v1 = a0;
v0 = a1;
v3 = curdir;
v2 = cdopt();
if (v2) {
if (physdir == 5242912)
setpwd(v3, 0x0);
v3 = physdir;
}
out1fmt(0x500048, v3);
return 0;
} | dash-0.5.11+git20210903+057cd650a4ed | angr_dream |
static long parse_number(const char *arg) {
char *endptr = ((void *)0);
(*__errno_location()) = 0;
long result;
if (strncmp(arg, "0x", 2) == 0)
result = strtol(arg + 2, &endptr, 16);
else if (strncmp(arg, "0", 1) == 0 &&
strspn(arg, "012345678") == strlen(optarg))
result = strtol(arg + 1, &endptr, 8);
else
result = strtol(arg, &endptr, 10);
if ((*__errno_location()) != 0 || (endptr && *endptr != '\0'))
error(1, (*__errno_location()), "'%s' is not a recognizable number.", arg);
return result;
} | long parse_number(char *param_1)
{
int iVar1;
int *piVar2;
size_t sVar3;
size_t sVar4;
long in_FS_OFFSET;
char *local_30;
long local_28;
long local_20;
local_20 = *(long *)(in_FS_OFFSET + 0x28);
local_30 = (char *)0x0;
piVar2 = __errno_location();
*piVar2 = 0;
iVar1 = strncmp(param_1, "0x", 2);
if (iVar1 == 0) {
local_28 = strtol(param_1 + 2, &local_30, 0x10);
} else {
iVar1 = strncmp(param_1, "0", 1);
if (iVar1 == 0) {
sVar3 = strspn(param_1, "012345678");
sVar4 = strlen(*ppcRam00000000001000ad);
if (sVar3 == sVar4) {
local_28 = strtol(param_1 + 1, &local_30, 8);
goto LAB_001000fb;
}
}
local_28 = strtol(param_1, &local_30, 10);
}
LAB_001000fb:
piVar2 = __errno_location();
if ((*piVar2 == 0) && ((local_30 == (char *)0x0 || (*local_30 == '\0')))) {
if (local_20 != *(long *)(in_FS_OFFSET + 0x28)) {
__stack_chk_fail();
}
return local_28;
}
piVar2 = __errno_location();
error(1, *piVar2, "\'%s\' is not a recognizable number.", param_1);
} | gnutls | ghidra |
sh_builtin_func_t *find_shell_builtin(name)
char *name;
{
current_builtin = builtin_address_internal(name, 0);
return (current_builtin ? current_builtin->function
: (sh_builtin_func_t *)((void *)0));
} | long long find_shell_builtin(char *a0) {
void *v1;
current_builtin = builtin_address_internal(a0, 0x0);
if (current_builtin)
v1 = *((current_builtin + 8));
else
v1 = 0;
return v1;
} | bash | angr_dream |
char *array_keys(s, quoted, pflags)
char *s;
int quoted, pflags;
{
int len;
char *retval, *t, *temp;
WORD_LIST *l;
SHELL_VAR *var;
var = array_variable_part(s, 0, &t, &len);
if (var == 0 || ((t[0]) == '@' || (t[0]) == '*') == 0 || t[1] != ']')
return (char *)((void *)0);
if (((var)->value != 0) == 0 || ((((var)->attributes) & (0x0001000))))
return (char *)((void *)0);
if (((((var)->attributes) & (0x0000004))) == 0 &&
((((var)->attributes) & (0x0000040))) == 0)
l = make_word_list(make_word("0"), ((WORD_LIST *)((void *)0)));
else if (((((var)->attributes) & (0x0000040))))
l = assoc_keys_to_word_list((HASH_TABLE *)((var)->value));
else
l = array_keys_to_word_list((ARRAY *)((var)->value));
if (l == (WORD_LIST *)((void *)0))
return ((char *)((void *)0));
retval = string_list_pos_params(t[0], l, quoted, pflags);
dispose_words(l);
return retval;
} | long long array_keys(char *a0, unsigned long a1, unsigned long a2) {
char v0;
char v1;
unsigned long long v2;
struct_0 *v3;
unsigned long long v4;
unsigned int v6;
void *v7;
v3 = array_variable_part(a0, 0x0, &v1, &v0);
if (!v3) {
LABEL_403930:
v7 = 0;
} else {
if (*(*(&v1)) == 64) {
LABEL_403911:
v6 = 1;
} else {
if (*(*(&v1)) == 42)
goto LABEL_403911;
v6 = 0;
}
if (!v6)
goto LABEL_403930;
if (!(*((*(&v1) + 1)) == 93))
goto LABEL_403930;
if (!v3->field_8) {
LABEL_403957:
v7 = 0;
} else {
if (!(!(v3->field_28 & 0x1000)))
goto LABEL_403957;
if (!(v3->field_28 & 4) && !(v3->field_28 & 64)) {
v2 = make_word_list(make_word("0"), 0x0);
goto LABEL_4039d4;
}
if (!(v3->field_28 & 64))
v2 = array_keys_to_word_list(v3->field_8);
else
v2 = assoc_keys_to_word_list(v3->field_8);
LABEL_4039d4:
if (!v2) {
v7 = 0;
} else {
v4 = string_list_pos_params(*(*(&v1)), v2, a1, a2);
dispose_words(v2);
v7 = v4;
}
}
}
return v7;
} | bash | angr_phoenix |
static void usage(void) {
fprintf(stderr, "Usage: rtmon [ OPTIONS ] file FILE [ all | LISTofOBJECTS ]\n"
"OPTIONS := { -f[amily] { inet | inet6 | link | help } |\n"
" -4 | -6 | -0 | -V[ersion] }\n"
"LISTofOBJECTS := [ link ] [ address ] [ route ]\n");
exit(-1);
} | void usage() {
fprintf(
stderr,
"Usage: rtmon [ OPTIONS ] file FILE [ all | LISTofOBJECTS ]\nOPTIONS := "
"{ -f[amily] { inet | inet6 | link | help } |\n -4 | -6 | -0 "
"| -V[ersion] }\nLISTofOBJECTS := [ link ] [ address ] [ route ]\n");
exit(0xffffffff);
} | iproute2-6.0.0 | angr_sailr |
void *reallocarray(void *optr, size_t nmemb, size_t size) {
if ((nmemb >= ((size_t)1 << (sizeof(size_t) * 4)) ||
size >= ((size_t)1 << (sizeof(size_t) * 4))) &&
nmemb > 0 && (18446744073709551615UL) / nmemb < size) {
(*__errno_location()) = 12;
return ((void *)0);
}
return realloc(optr, size * nmemb);
} | void *reallocarray(void *a1, unsigned long a2, unsigned long a3) {
if (a2 <= 0xFFFFFFFF && a3 <= 0xFFFFFFFF || !a2 || is_mul_ok(a2, a3))
return realloc(a1, a2 * a3);
*_errno_location() = 12;
return 0LL;
} | libbsd-0.11.7 | ida |
void closefrom(int lowfd) {
long fd;
char fdpath[4096], *endp;
struct dirent *dent;
DIR *dirp;
int len;
if (close_range(lowfd, 0x7fffffff, 0) == 0)
return;
len = snprintf(fdpath, sizeof(fdpath), "/proc/%ld/fd", (long)getpid());
if (len > 0 && (size_t)len < sizeof(fdpath) && (dirp = opendir(fdpath))) {
while ((dent = readdir(dirp)) != ((void *)0)) {
fd = strtol(dent->d_name, &endp, 10);
if (dent->d_name != endp && *endp == '\0' && fd >= 0 && fd < 0x7fffffff &&
fd >= lowfd && fd != dirfd(dirp))
(void)close((int)fd);
}
(void)closedir(dirp);
return;
}
closefrom_fallback(lowfd);
} | long long closefrom(unsigned long a0) {
unsigned int v0;
char v1;
unsigned long long v2;
unsigned long v3;
unsigned long v4;
char v5;
unsigned long long v6;
v6 = *(&v6);
if (close_range(a0, 0x7fffffff, 0x0)) {
v0 = snprintf(&v5, 0x1000, "/proc/%ld/fd", getpid());
if (v0 > 0 && v0 <= 4095) {
v2 = opendir(&v5);
if (v2) {
while (true) {
v3 = readdir(v2);
if (v3) {
v4 = strtol(v3 + 19, &v1, 0xa);
if (v3 + 19 == *(&v1))
continue;
if (*(*(&v1)))
continue;
if ((v4 - 0 >> 63))
continue;
if (v4 > 2147483646)
continue;
if (v4 < a0)
continue;
if (v4 == dirfd(v2))
continue;
close(v4);
} else {
closedir(v2);
break;
}
}
}
}
if (!v2 || v0 <= 0 || v0 > 4095)
closefrom_fallback(a0);
}
return 0;
} | openssh-portable | angr_dream |
char *gzgets(file, buf, len)
gzFile file;
char *buf;
int len;
{
unsigned left, n;
char *str;
unsigned char *eol;
gz_statep state;
if (file == ((void *)0) || buf == ((void *)0) || len < 1)
return ((void *)0);
state = (gz_statep)file;
if (state->mode != 7247 || (state->err != 0 && state->err != (-5)))
return ((void *)0);
if (state->seek) {
state->seek = 0;
if (gz_skip(state, state->skip) == -1)
return ((void *)0);
}
str = buf;
left = (unsigned)len - 1;
if (left)
do {
if (state->x.have == 0 && gz_fetch(state) == -1)
return ((void *)0);
if (state->x.have == 0) {
state->past = 1;
break;
}
n = state->x.have > left ? left : state->x.have;
eol = (unsigned char *)memchr(state->x.next, '\n', n);
if (eol != ((void *)0))
n = (unsigned)(eol - state->x.next) + 1;
memcpy(buf, state->x.next, n);
state->x.have -= n;
state->x.next += n;
state->x.pos += n;
left -= n;
buf += n;
} while (left && eol == ((void *)0));
if (buf == str)
return ((void *)0);
buf[0] = 0;
return str;
} | long long gzgets(struct_0 *a0, void *a1, unsigned long a2) {
void *v0;
unsigned long long v1;
unsigned int v2;
void *v3;
unsigned long v4;
void *v6;
unsigned long long v7;
v0 = a1;
if (a0 && v0 && a2 > 0) {
if (a0->field_18 == 7247 && (!a0->field_74 || a0->field_74 == -5)) {
if (a0->field_70) {
a0->field_70 = 0;
v7 = gz_skip(a0, a0->field_68);
if (v7 == -1)
v6 = 0;
}
if (!a0->field_70 || v7 != -1) {
v3 = v0;
*(&v1) = a2 - 1;
if (v1) {
while (true) {
if (!a0->field_0) {
v7 = gz_fetch(a0);
if (v7 == -1) {
v6 = 0;
break;
}
}
if (a0->field_0 || v7 != -1) {
if (!a0->field_0) {
a0->field_54 = 1;
break;
} else {
*(&v7) = a0->field_0;
if (v1 <= a0->field_0)
*(&v7) = v1;
v2 = v7;
v4 = memchr(a0->field_8, 0xa, v2);
if (v4)
v2 = (v4 - a0->field_8) + 1;
memcpy(v0, a0->field_8, v2);
a0->field_0 = a0->field_0 - v2;
a0->field_8 = a0->field_8 + v2;
a0->field_10 = a0->field_10 + v2;
v1 = v1 - v2;
v0 += v2;
if (!v1)
break;
if (v1) {
if (v4)
break;
}
}
}
}
}
if (!v1 || a0->field_0 || v7 != -1) {
if (v0 == v3) {
v6 = 0;
} else {
*(v0) = 0;
v6 = v3;
}
}
}
}
if (a0->field_18 != 7247 || a0->field_74 && a0->field_74 != -5)
v6 = 0;
}
if (!a0 || !v0 || a2 <= 0)
v6 = 0;
return v6;
} | zlib | angr_dream |
vi_insert(EditLine *el, wint_t c __attribute__((__unused__))) {
el->el_map.current = el->el_map.key;
cv_undo(el);
return 0;
} | long long vi_insert(unsigned long long a0[129], unsigned long a1) {
unsigned int v0;
v0 = a1;
a0[128] = a0[127];
cv_undo(a0);
return 0;
} | libedit | angr_sailr |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.