input stringlengths 26 172k | output stringlengths 18 318k | repo_name stringclasses 23 values | decompiler stringclasses 5 values |
|---|---|---|---|
void init_resource_track(struct resource_track *track, io_channel channel) {
struct rusage r;
io_stats io_start = 0;
track->brk_start = sbrk(0);
gettimeofday(&track->time_start, 0);
getrusage(RUSAGE_SELF, &r);
track->user_start = r.ru_utime;
track->system_start = r.ru_stime;
track->bytes_read = 0;
track->bytes_written = 0;
if (channel && channel->manager && channel->manager->get_stats)
channel->manager->get_stats(channel, &io_start);
if (io_start) {
track->bytes_read = io_start->bytes_read;
track->bytes_written = io_start->bytes_written;
}
} | long long init_resource_track(unsigned long long a0[9], struct_0 *a1) {
void *v0;
char v1;
char v2;
char v3;
char v4;
v0 = 0;
a0[6] = sbrk(0x0);
gettimeofday(a0, NULL);
getrusage(0x0, &v1);
a0[2] = *(&v1);
a0[3] = *(&v2);
a0[4] = *(&v3);
a0[5] = *(&v4);
a0[7] = 0;
a0[8] = 0;
if (a1 && a1->field_8 && a1->field_8->field_50)
a1->field_8->field_50(a1, &v0, &v0, a1->field_8->field_50);
if (v0) {
a0[7] = v0[8];
a0[8] = v0[16];
}
return 0;
} | e2fsprogs-1.46.5 | angr_sailr |
int rl_set_keyboard_input_timeout(int u) {
int o;
o = _keyboard_input_timeout;
if (u >= 0)
_keyboard_input_timeout = u;
return (o);
} | int rl_set_keyboard_input_timeout(unsigned long a0) {
unsigned int v0;
v0 = _keyboard_input_timeout;
if (a0 >= 0)
_keyboard_input_timeout = a0;
return v0;
} | bash | angr_dream |
static void print_slave_oper_state(FILE *fp, const char *name, __u16 state) {
open_json_array(PRINT_ANY, name);
print_string(PRINT_FP, ((void *)0), " <", ((void *)0));
if (state & 0x1) {
state &= ~0x1;
print_string(PRINT_ANY, ((void *)0), state ? "%s," : "%s", "active");
};
if (state & 0x2) {
state &= ~0x2;
print_string(PRINT_ANY, ((void *)0), state ? "%s," : "%s", "short_timeout");
};
if (state & 0x4) {
state &= ~0x4;
print_string(PRINT_ANY, ((void *)0), state ? "%s," : "%s", "aggregating");
};
if (state & 0x8) {
state &= ~0x8;
print_string(PRINT_ANY, ((void *)0), state ? "%s," : "%s", "in_sync");
};
if (state & 0x10) {
state &= ~0x10;
print_string(PRINT_ANY, ((void *)0), state ? "%s," : "%s", "collecting");
};
if (state & 0x20) {
state &= ~0x20;
print_string(PRINT_ANY, ((void *)0), state ? "%s," : "%s", "distributing");
};
if (state & 0x40) {
state &= ~0x40;
print_string(PRINT_ANY, ((void *)0), state ? "%s," : "%s", "defaulted");
};
if (state & 0x80) {
state &= ~0x80;
print_string(PRINT_ANY, ((void *)0), state ? "%s," : "%s", "expired");
};
close_json_array(PRINT_ANY, "> ");
} | long print_slave_oper_state(long a1, long a2, short a3) {
const char *v3;
const char *v4;
const char *v5;
const char *v6;
const char *v7;
const char *v8;
const char *v9;
const char *v10;
open_json_array(4LL, a2);
print_string(1u, 0LL, (long)" <", 0LL);
if ((a3 & 1) != 0) {
a3 &= ~1u;
if (a3)
v3 = "%s,";
else
v3 = "%s";
print_string(4u, 0LL, (long)v3, (long)"active");
}
if ((a3 & 2) != 0) {
a3 &= ~2u;
if (a3)
v4 = "%s,";
else
v4 = "%s";
print_string(4u, 0LL, (long)v4, (long)"short_timeout");
}
if ((a3 & 4) != 0) {
a3 &= ~4u;
if (a3)
v5 = "%s,";
else
v5 = "%s";
print_string(4u, 0LL, (long)v5, (long)"aggregating");
}
if ((a3 & 8) != 0) {
a3 &= ~8u;
if (a3)
v6 = "%s,";
else
v6 = "%s";
print_string(4u, 0LL, (long)v6, (long)"in_sync");
}
if ((a3 & 0x10) != 0) {
a3 &= ~0x10u;
if (a3)
v7 = "%s,";
else
v7 = "%s";
print_string(4u, 0LL, (long)v7, (long)"collecting");
}
if ((a3 & 0x20) != 0) {
a3 &= ~0x20u;
if (a3)
v8 = "%s,";
else
v8 = "%s";
print_string(4u, 0LL, (long)v8, (long)"distributing");
}
if ((a3 & 0x40) != 0) {
a3 &= ~0x40u;
if (a3)
v9 = "%s,";
else
v9 = "%s";
print_string(4u, 0LL, (long)v9, (long)"defaulted");
}
if ((a3 & 0x80) != 0) {
if ((a3 & 0xFF7F) != 0)
v10 = "%s,";
else
v10 = "%s";
print_string(4u, 0LL, (long)v10, (long)"expired");
}
return close_json_array(4LL, "> ");
} | iproute2-6.0.0 | ida |
int savefd(int from, int ofd) {
int newfd;
int err;
newfd = fcntl(from, 0, 10);
err = newfd < 0 ? (*dash_errno) : 0;
if (err != 9) {
close(ofd);
if (err)
sh_error("%d: %s", from, strerror(err));
else
fcntl(newfd, 2, 1);
}
return newfd;
} | int savefd(int param_1, int param_2)
{
int __fd;
int __errnum;
char *pcVar1;
__fd = fcntl(param_1, 0, 10);
if (__fd < 0) {
__errnum = *dash_errno;
} else {
__errnum = 0;
}
if (__errnum != 9) {
close(param_2);
if (__errnum != 0) {
pcVar1 = strerror(__errnum);
sh_error("%d: %s", param_1, pcVar1);
}
fcntl(__fd, 2, 1);
}
return __fd;
} | dash-0.5.11+git20210903+057cd650a4ed | ghidra |
static int cache_fstatat(int fd, char const *file, struct stat *st, int flag) {
if (st->st_size == -1 && fstatat(fd, file, st, flag) != 0) {
st->st_size = -2;
st->st_ino = (*__errno_location());
}
if (0 <= st->st_size)
return 0;
(*__errno_location()) = (int)st->st_ino;
return -1;
} | long cache_fstatat(int a1, const char *a2, struct stat *a3, int a4) {
__ino_t st_ino;
if (a3->st_size == -1 && fstatat(a1, a2, a3, a4)) {
a3->st_size = -2LL;
a3->st_ino = *_errno_location();
}
if (a3->st_size >= 0)
return 0LL;
st_ino = a3->st_ino;
*_errno_location() = st_ino;
return 0xFFFFFFFFLL;
} | coreutils | ida |
static void dunlink_insert(struct deferred_unlink *anchor,
struct deferred_unlink *p) {
if (anchor) {
p->next = anchor->next;
anchor->next = p;
} else {
p->next = dunlink_head;
dunlink_head = p;
}
if (!p->next)
dunlink_tail = p;
dunlink_count++;
} | long dunlink_insert(_QWORD *a1, _QWORD *a2) {
if (a1) {
*a2 = *a1;
*a1 = a2;
} else {
*a2 = dunlink_head;
dunlink_head = (long)a2;
}
if (!*a2)
dunlink_tail = (long)a2;
return ++dunlink_count;
} | tar | ida |
static inline const char *mod_get_compressed_path(const struct mod *mod) {
if (mod->relpath != ((void *)0))
return mod->relpath;
return mod->path;
} | int mod_get_compressed_path(unsigned long long a0[3]) {
unsigned int v1;
if (a0[2])
v1 = a0[2];
else
v1 = a0[1];
return v1;
} | kmod | angr_phoenix |
static void dump_cfg_strarray_oneline(OpCodes code, u_int count, char **vals) {
u_int i;
printf("%s", lookup_opcode_name(code));
if (count == 0)
printf(" none");
for (i = 0; i < count; i++)
printf(" %s", vals[i]);
printf("\n");
} | void dump_cfg_strarray_oneline(undefined4 param_1, uint param_2, long param_3)
{
undefined8 uVar1;
uint local_c;
uVar1 = lookup_opcode_name(param_1);
printf("%s", uVar1);
if (param_2 == 0) {
printf(" none");
}
for (local_c = 0; local_c < param_2; local_c = local_c + 1) {
printf(" %s", *(undefined8 *)(param_3 + (ulong)local_c * 8));
}
printf("\n");
return;
} | openssh-portable | ghidra |
static void usage(int status) {
FILE *usageout = (0 != status) ? stderr : stdout;
(void)fprintf(usageout,
gettext("Usage: %s [options] GROUP\n"
"\n"
"Options:\n")
,
Prog);
(void)fputs(gettext(" -a, --append append the users "
"mentioned by -U option to the group \n"
" without removing "
"existing user members\n"),
usageout);
(void)fputs(
gettext(" -g, --gid GID change the group ID to GID\n"),
usageout);
(void)fputs(gettext(" -h, --help display this help "
"message and exit\n"),
usageout);
(void)fputs(
gettext(" -n, --new-name NEW_GROUP change the name to NEW_GROUP\n"),
usageout);
(void)fputs(gettext(" -o, --non-unique allow to use a "
"duplicate (non-unique) GID\n"),
usageout);
(void)fputs(gettext(" -p, --password PASSWORD change the password to "
"this (encrypted)\n"
" PASSWORD\n"),
usageout);
(void)fputs(
gettext(" -R, --root CHROOT_DIR directory to chroot into\n"),
usageout);
(void)fputs(gettext(" -P, --prefix PREFIX_DIR prefix directory where "
"are located the /etc/* files\n"),
usageout);
(void)fputs(gettext(" -U, --users USERS list of user members of "
"this group\n"),
usageout);
(void)fputs("\n", usageout);
exit(status);
} | long long usage(unsigned long a0) {
void *v0;
unsigned long v1;
unsigned long v3;
void *v4;
v1 = v3;
if (a0)
v4 = stderr;
else
v4 = stdout;
v0 = v4;
fprintf(v0, gettext("Usage: %s [options] GROUP\n\nOptions:\n"));
fputs(gettext(" -a, --append append the users mentioned by "
"-U option to the group \n "
"without removing existing user members\n"),
v0);
fputs(gettext(" -g, --gid GID change the group ID to GID\n"),
v0);
fputs(gettext(" -h, --help display this help message and "
"exit\n"),
v0);
fputs(
gettext(" -n, --new-name NEW_GROUP change the name to NEW_GROUP\n"),
v0);
fputs(gettext(" -o, --non-unique allow to use a duplicate "
"(non-unique) GID\n"),
v0);
fputs(gettext(" -p, --password PASSWORD change the password to this "
"(encrypted)\n PASSWORD\n"),
v0);
fputs(gettext(" -R, --root CHROOT_DIR directory to chroot into\n"),
v0);
fputs(gettext(" -P, --prefix PREFIX_DIR prefix directory where are located the /etc
} | shadow | angr_dream |
void sv_path(name) char *name;
{
phash_flush();
} | long sv_path() { return phash_flush(); } | bash | ida |
int rl_initialize(void) {
HistEvent ev;
int editmode = 1;
struct termios t;
if (e != ((void *)0))
el_end(e);
if (h != ((void *)0))
history_end(h);
(rl_readline_state &= ~((unsigned long)0x000001));
if (!rl_instream)
rl_instream = stdin;
if (!rl_outstream)
rl_outstream = stdout;
if (tcgetattr(fileno(rl_instream), &t) != -1 && (t.c_lflag & 0000010) == 0)
editmode = 0;
e = el_init_internal(rl_readline_name, rl_instream, rl_outstream,
stderr, fileno(rl_instream), fileno(rl_outstream),
fileno(stderr), 0x080);
if (!editmode)
el_set(e, 11, 0);
h = history_init();
if (!e || !h)
return -1;
history(h, &ev, 1, 0x7fffffff);
history_length = 0;
max_input_history = 0x7fffffff;
el_set(e, 10, history, h);
el_set(e, 23, _resize_fun, &rl_line_buffer);
if (rl_getc_function)
el_set(e, 13, _getc_function);
if (rl_set_prompt("") == -1) {
history_end(h);
el_end(e);
return -1;
}
el_set(e, 21, _get_prompt, '\1');
el_set(e, 3, rl_catch_signals);
el_set(e, 2, "emacs");
if (rl_terminal_name != ((void *)0))
el_set(e, 1, rl_terminal_name);
else
el_get(e, 1, &rl_terminal_name);
el_set(e, 9, "rl_complete", "ReadLine compatible completion function",
_el_rl_complete);
el_set(e, 4, "^I", "rl_complete", ((void *)0));
el_set(e, 9, "rl_tstp", "ReadLine compatible suspend function", _el_rl_tstp);
el_set(e, 4, "^Z", "rl_tstp", ((void *)0));
el_set(e, 4, "^R", "em-inc-search-prev", ((void *)0));
el_set(e, 4, "\\e[1~", "ed-move-to-beg", ((void *)0));
el_set(e, 4, "\\e[4~", "ed-move-to-end", ((void *)0));
el_set(e, 4, "\\e[7~", "ed-move-to-beg", ((void *)0));
el_set(e, 4, "\\e[8~", "ed-move-to-end", ((void *)0));
el_set(e, 4, "\\e[H", "ed-move-to-beg", ((void *)0));
el_set(e, 4, "\\e[F", "ed-move-to-end", ((void *)0));
el_set(e, 4, "\\e[3~", "ed-delete-next-char", ((void *)0));
el_set(e, 4, "\\e[2~", "ed-quoted-insert", ((void *)0));
el_set(e, 4, "\\e[1;5C", "em-next-word", ((void *)0));
el_set(e, 4, "\\e[1;5D", "ed-prev-word", ((void *)0));
el_set(e, 4, "\\e[5C", "em-next-word", ((void *)0));
el_set(e, 4, "\\e[5D", "ed-prev-word", ((void *)0));
el_set(e, 4, "\\e\\e[C", "em-next-word", ((void *)0));
el_set(e, 4, "\\e\\e[D", "ed-prev-word", ((void *)0));
el_source(e, ((void *)0));
_resize_fun(e, &rl_line_buffer);
_rl_update_pos();
tty_end(e, 1);
return 0;
} | void rl_initialize(void)
{
if (e != 0) {
el_end(e);
}
if (h != 0) {
history_end(h);
}
*puRam0000000000100351 = *puRam0000000000100340 & 0xfffffffffffffffe;
if (*plRam000000000010035b == 0) {
*puRam0000000000100374 = *puRam000000000010036a;
}
if (*plRam000000000010037e == 0) {
*puRam0000000000100397 = *puRam000000000010038d;
}
fileno(*ppFRam00000000001003a1);
} | libedit | ghidra |
static int getfilecon_cache(char const *file, struct fileinfo *f, _Bool deref) {
static dev_t unsupported_device;
if (f->stat.st_dev == unsupported_device) {
(*__errno_location()) = 95;
return -1;
}
int r = 0;
r = (deref ? rpl_getfilecon(file, &f->scontext)
: rpl_lgetfilecon(file, &f->scontext));
if (r < 0 && errno_unsupported((*__errno_location())))
unsupported_device = f->stat.st_dev;
return r;
} | int getfilecon_cache(undefined8 param_1, long param_2, char param_3)
{
char cVar1;
int iVar2;
int *piVar3;
if (*(long *)(param_2 + 0x18) == unsupported_device_9561) {
piVar3 = __errno_location();
*piVar3 = 0x5f;
iVar2 = -1;
} else {
if (param_3 == '\0') {
iVar2 = rpl_lgetfilecon(param_1, param_2 + 0xb0);
} else {
iVar2 = rpl_getfilecon(param_1, param_2 + 0xb0);
}
if (iVar2 < 0) {
piVar3 = __errno_location();
cVar1 = errno_unsupported(*piVar3);
if (cVar1 != '\0') {
unsupported_device_9561 = *(long *)(param_2 + 0x18);
}
}
}
return iVar2;
} | coreutils | ghidra |
int assert_protected(const char *const *argv) {
struct dpkg_version version = {0, "1.20.1", ((void *)0)};
return assert_version_support(argv, &version, gettext("Protected field"));
} | void assert_protected(undefined8 param_1)
{
undefined8 uVar1;
long in_FS_OFFSET;
undefined4 local_28[2];
char *local_20;
undefined8 local_18;
long local_10;
local_10 = *(long *)(in_FS_OFFSET + 0x28);
local_28[0] = 0;
local_20 = "1.20.1";
local_18 = 0;
uVar1 = gettext("Protected field");
assert_version_support(param_1, local_28, uVar1);
if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) {
__stack_chk_fail();
}
return;
} | dpkg | ghidra |
static void send_handle(u_int32_t id, int handle) {
u_char *string;
int hlen;
handle_to_string(handle, &string, &hlen);
sshlog("sftp-server.c", __func__, 610, 0, SYSLOG_LEVEL_DEBUG1, ((void *)0),
"request %u: sent handle handle %d", id, handle);
send_data_or_handle(102, id, string, hlen);
free(string);
} | void send_handle(unsigned long a0, unsigned long a1) {
unsigned long v0;
unsigned long v1;
char v2;
char v3;
char v4;
unsigned long long *v6;
unsigned long long v7;
handle_to_string(a1, &v3, &v2);
v1 = a1;
v0 = a0;
sshlog("sftp-server.c", "send_handle", 0x262, 0x0, 0x5, 0x0,
"request %u: sent handle handle %d");
send_data_or_handle(0x66, a0, *(&v3), *(&v2));
free(*(&v3));
v7 = *(&v4) ^ v6[5];
return;
} | openssh-portable | angr_phoenix |
static int read_config_file_depth(const char *filename, struct passwd *pw,
const char *host, const char *original_host,
Options *options, int flags, int *activep,
int *want_final_pass, int depth) {
FILE *f;
char *line = ((void *)0);
size_t linesize = 0;
int linenum;
int bad_options = 0;
if (depth < 0 || depth > 16)
sshfatal("readconf.c", __func__, 2245, 0, SYSLOG_LEVEL_FATAL, ((void *)0),
"Too many recursive configuration includes");
if ((f = fopen(filename, "r")) == ((void *)0))
return 0;
if (flags & 1) {
struct stat sb;
if (fstat(fileno(f), &sb) == -1)
sshfatal("readconf.c", __func__, 2254, 0, SYSLOG_LEVEL_FATAL, ((void *)0),
"fstat %s: %s", filename, strerror((*__errno_location())));
if (((sb.st_uid != 0 && sb.st_uid != getuid()) || (sb.st_mode & 022) != 0))
sshfatal("readconf.c", __func__, 2257, 0, SYSLOG_LEVEL_FATAL, ((void *)0),
"Bad owner or permissions on %s", filename);
}
sshlog("readconf.c", __func__, 2260, 0, SYSLOG_LEVEL_DEBUG1, ((void *)0),
"Reading configuration data %.200s", filename);
linenum = 0;
while (getline(&line, &linesize, f) != -1) {
linenum++;
if (process_config_line_depth(options, pw, host, original_host, line,
filename, linenum, activep, flags,
want_final_pass, depth) != 0)
bad_options++;
}
free(line);
fclose(f);
if (bad_options > 0)
sshfatal("readconf.c", __func__, 2283, 0, SYSLOG_LEVEL_FATAL, ((void *)0),
"%s: terminating, %d bad configuration options", filename,
bad_options);
return 1;
} | undefined8
read_config_file_depth(char *param_1, undefined8 param_2, undefined8 param_3,
undefined8 param_4, undefined8 param_5, uint param_6,
undefined8 param_7, undefined8 param_8, uint param_9)
{
int iVar1;
__uid_t _Var2;
undefined8 uVar3;
int *piVar4;
char *pcVar5;
__ssize_t _Var6;
undefined *puVar7;
undefined *puVar8;
char **ppcVar9;
long in_FS_OFFSET;
ulong auStack400[3];
char *apcStack376[13];
undefined8 local_110;
uint local_104;
undefined8 local_100;
undefined8 local_f8;
undefined8 local_f0;
undefined8 local_e8;
char *local_e0;
uint local_d8;
uint local_d4;
char *local_d0;
size_t local_c8;
FILE *local_c0;
stat local_b8;
long local_20;
ppcVar9 = apcStack376 + 0xc;
local_110 = param_7;
apcStack376[12] = (char *)param_8;
local_20 = *(long *)(in_FS_OFFSET + 0x28);
local_d0 = (char *)0x0;
local_c8 = 0;
local_d4 = 0;
local_104 = param_6;
local_100 = param_5;
local_f8 = param_4;
local_f0 = param_3;
local_e8 = param_2;
local_e0 = param_1;
if (((int)param_9 < 0) || (0x10 < (int)param_9)) {
ppcVar9 = apcStack376 + 10;
apcStack376[10] = "Too many recursive configuration includes";
sshfatal("readconf.c", "read_config_file_depth", 0x8c5, 0, 1, 0);
}
*(undefined8 *)((long)ppcVar9 + -8) = 0x106a72;
local_c0 = fopen(local_e0, "r");
if (local_c0 == (FILE *)0x0) {
uVar3 = 0;
goto LAB_00106cea;
}
puVar8 = (undefined *)ppcVar9;
if ((local_104 & 1) != 0) {
*(undefined8 *)((long)ppcVar9 + -8) = 0x106aad;
iVar1 = fileno(local_c0);
*(undefined8 *)((long)ppcVar9 + -8) = 0x106ac0;
iVar1 = fstat(iVar1, &local_b8);
puVar7 = (undefined *)ppcVar9;
if (iVar1 == -1) {
*(undefined8 *)((long)ppcVar9 + -8) = 0x106aca;
piVar4 = __errno_location();
iVar1 = *piVar4;
*(undefined8 *)((long)ppcVar9 + -8) = 0x106ad3;
pcVar5 = strerror(iVar1);
*(char **)((long)ppcVar9 + -0x10) = pcVar5;
*(char **)((long)ppcVar9 + -0x18) = local_e0;
puVar7 = (undefined *)((long)ppcVar9 + -0x20);
*(char **)((long)ppcVar9 + -0x20) = "fstat %s: %s";
*(undefined8 *)((long)ppcVar9 + -0x28) = 0x106b14;
sshfatal("readconf.c", "read_config_file_depth", 0x8ce, 0, 1, 0);
}
if (local_b8.st_uid == 0) {
LAB_00106b2d:
puVar8 = puVar7;
if ((local_b8.st_mode & 0x12) == 0)
goto LAB_00106b76;
} else {
*(undefined8 *)(puVar7 + -8) = 0x106b29;
_Var2 = getuid();
if (local_b8.st_uid == _Var2)
goto LAB_00106b2d;
}
*(char **)(puVar7 + -8) = local_e0;
puVar8 = puVar7 + -0x10;
*(char **)(puVar7 + -0x10) = "Bad owner or permissions on %s";
*(undefined8 *)(puVar7 + -0x18) = 0x106b76;
sshfatal("readconf.c", "read_config_file_depth", 0x8d1, 0, 1, 0);
}
LAB_00106b76:
*(char **)(puVar8 + -8) = local_e0;
*(char **)(puVar8 + -0x10) = "Reading configuration data %.200s";
*(undefined8 *)(puVar8 + -0x18) = 0x106bb2;
sshlog("readconf.c", "read_config_file_depth", 0x8d4, 0, 5, 0);
local_d8 = 0;
while (true) {
*(undefined8 *)(puVar8 + -8) = 0x106c6d;
_Var6 = getline(&local_d0, &local_c8, local_c0);
if (_Var6 == -1)
break;
*(undefined8 *)(puVar8 + -8) = 0x106bd5;
local_d8 = __addvsi3(local_d8, 1);
*(ulong *)(puVar8 + -0x10) = (ulong)param_9;
*(char **)(puVar8 + -0x18) = apcStack376[12];
*(ulong *)(puVar8 + -0x20) = (ulong)local_104;
*(undefined8 *)(puVar8 + -0x28) = local_110;
*(ulong *)(puVar8 + -0x30) = (ulong)local_d8;
*(undefined8 *)(puVar8 + -0x38) = 0x106c2f;
iVar1 = process_config_line_depth(local_100, local_e8, local_f0, local_f8,
local_d0, local_e0);
if (iVar1 != 0) {
*(undefined8 *)(puVar8 + -8) = 0x106c47;
local_d4 = __addvsi3(local_d4, 1);
}
}
*(undefined8 *)(puVar8 + -8) = 0x106c86;
free(local_d0);
*(undefined8 *)(puVar8 + -8) = 0x106c95;
fclose(local_c0);
ppcVar9 = (char **)puVar8;
if (0 < (int)local_d4) {
*(ulong *)(puVar8 + -0x10) = (ulong)local_d4;
*(char **)(puVar8 + -0x18) = local_e0;
ppcVar9 = (char **)(puVar8 + -0x20);
*(char **)(puVar8 + -0x20) =
"%s: terminating, %d bad configuration options";
*(undefined8 *)(puVar8 + -0x28) = 0x106ce5;
sshfatal("readconf.c", "read_config_file_depth", 0x8eb, 0, 1, 0);
}
uVar3 = 1;
LAB_00106cea:
if (local_20 != *(long *)(in_FS_OFFSET + 0x28)) {
*(undefined8 *)((long)ppcVar9 + -8) = 0x106cfe;
__stack_chk_fail();
}
return uVar3;
} | openssh-portable | ghidra |
static void compress_mode(BITCMD *set) {
BITCMD *nset;
int setbits, clrbits, Xbits, op;
for (nset = set;;) {
while ((op = nset->cmd) != '+' && op != '-' && op != 'X') {
*set++ = *nset++;
if (!op)
return;
}
for (setbits = clrbits = Xbits = 0;; nset++) {
if ((op = nset->cmd) == '-') {
clrbits |= nset->bits;
setbits &= ~nset->bits;
Xbits &= ~nset->bits;
} else if (op == '+') {
setbits |= nset->bits;
clrbits &= ~nset->bits;
Xbits &= ~nset->bits;
} else if (op == 'X')
Xbits |= nset->bits & ~setbits;
else
break;
}
if (clrbits) {
set->cmd = '-';
set->cmd2 = 0;
set->bits = clrbits;
set++;
}
if (setbits) {
set->cmd = '+';
set->cmd2 = 0;
set->bits = setbits;
set++;
}
if (Xbits) {
set->cmd = 'X';
set->cmd2 = 0;
set->bits = Xbits;
set++;
}
}
} | char *compress_mode(char *a1) {
char *v1;
char *result;
char *v3;
int v4;
int v5;
int v6;
int v7;
int v8;
char *v9;
v3 = a1;
v9 = a1;
while (2) {
while (1) {
v7 = *v9;
if (v7 != 43 && v7 != 45 && v7 != 88)
break;
v6 = 0;
v5 = 0;
v4 = 0;
while (1) {
v8 = *v9;
if (v8 == 45) {
v5 |= *((_DWORD *)v9 + 1);
v4 &= ~*((_DWORD *)v9 + 1);
v6 &= ~*((_DWORD *)v9 + 1);
goto LABEL_13;
}
if (v8 == 43) {
v4 |= *((_DWORD *)v9 + 1);
v5 &= ~*((_DWORD *)v9 + 1);
v6 &= ~*((_DWORD *)v9 + 1);
goto LABEL_13;
}
if (v8 != 88)
break;
v6 |= *((_DWORD *)v9 + 1) & ~v4;
LABEL_13:
v9 += 8;
}
if (v5) {
*v3 = 45;
v3[1] = 0;
*((_DWORD *)v3 + 1) = v5;
v3 += 8;
}
if (v4) {
*v3 = 43;
v3[1] = 0;
*((_DWORD *)v3 + 1) = v4;
v3 += 8;
}
if (v6) {
*v3 = 88;
v3[1] = 0;
*((_DWORD *)v3 + 1) = v6;
v3 += 8;
}
}
v1 = v9;
v9 += 8;
result = v3;
v3 += 8;
*(_QWORD *)result = *(_QWORD *)v1;
if (v7)
continue;
return result;
}
} | libbsd-0.11.7 | ida |
void do_child(struct ssh *ssh, Session *s, const char *command) {
char **env, *argv[10], remote_id[512];
const char *shell, *shell0;
struct passwd *pw = s->pw;
int r = 0;
sshpkt_fmt_connection_id(ssh, remote_id, sizeof(remote_id));
destroy_sensitive_data();
ssh_packet_clear_keys(ssh);
if (s->authctxt->force_pwchange) {
do_setusercontext(pw);
child_close_fds(ssh);
do_pwchange(s);
exit(1);
}
if (!options.use_pam)
do_nologin(pw);
do_setusercontext(pw);
if (!check_quietlogin(s, command))
display_loginmsg();
shell = (pw->pw_shell[0] == '\0') ? "/bin/sh" : pw->pw_shell;
env = do_setup_env(ssh, s, shell);
child_close_fds(ssh);
environ = env;
if (chdir(pw->pw_dir) == -1) {
if (r || !in_chroot) {
fprintf(stderr,
"Could not chdir to home "
"directory %s: %s\n",
pw->pw_dir, strerror((*__errno_location())));
}
if (r)
exit(1);
}
closefrom(2 + 1);
do_rc_files(ssh, s, shell);
ssh_signal(13, ((__sighandler_t)0));
if (s->is_subsystem == 3) {
sshlog("session.c", __func__, 1646, 0, SYSLOG_LEVEL_ERROR, ((void *)0),
"Connection from %s: refusing non-sftp session", remote_id);
printf("This service allows sftp connections only.\n");
fflush(((void *)0));
exit(1);
} else if (s->is_subsystem == 2) {
int i;
char *p, *args;
setproctitle("%s@%s", s->pw->pw_name, "internal-sftp");
args = xstrdup(command ? command : "sftp-server");
for (i = 0, (p = strtok(args, " ")); p; (p = strtok(((void *)0), " ")))
if (i < 10 - 1)
argv[i++] = p;
argv[i] = ((void *)0);
BSDoptind = BSDoptreset = 1;
__progname = argv[0];
exit(sftp_server_main(i, argv, s->pw));
}
fflush(((void *)0));
if ((shell0 = strrchr(shell, '/')) != ((void *)0))
shell0++;
else
shell0 = shell;
if (!command) {
char argv0[256];
argv0[0] = '-';
if (strlcpy(argv0 + 1, shell0, sizeof(argv0) - 1) >= sizeof(argv0) - 1) {
(*__errno_location()) = 22;
perror(shell);
exit(1);
}
argv[0] = argv0;
argv[1] = ((void *)0);
execve(shell, argv, env);
perror(shell);
exit(1);
}
argv[0] = (char *)shell0;
argv[1] = "-c";
argv[2] = (char *)command;
argv[3] = ((void *)0);
execve(shell, argv, env);
perror(shell);
exit(1);
} | void do_child(unsigned long long a0, struct_0 *a1, unsigned long long a2,
unsigned long a3, unsigned long long a4, unsigned long long a5) {
unsigned long long v0;
unsigned long v1;
unsigned int v2;
unsigned int v3;
char *v4;
unsigned long v5;
struct_3 *v6;
char *v7;
unsigned long v8;
char *v9;
char v10;
unsigned long long v11;
unsigned long v12;
void *v13;
char v14;
char v15;
char v16;
unsigned long v17;
unsigned long v18;
char v19;
unsigned long long v20;
char v21;
unsigned long v22;
unsigned long long *v23;
unsigned long long *v26;
v18 = v22;
v17 = v23[5];
v6 = &a1->field_10->field_0;
v3 = 0;
sshpkt_fmt_connection_id(a0, &v16, 0x200, &v16);
destroy_sensitive_data(a0, &v16, 0x200, &v16, a4, a5, *(&v19), v20, *(&v21));
ssh_packet_clear_keys(a0);
if (a1->field_18->field_1c) {
do_setusercontext(v6, &v16, 0x200, &v16, a4, a5);
child_close_fds(a0);
do_pwchange(a1);
}
if (!*(5250776))
do_nologin(v6);
do_setusercontext(v6, &v16, 0x200, &v16, a4, a5);
if (!check_quietlogin(a1, a2))
display_loginmsg();
*(&v7) = (!v6->field_28->field_0 ? v6->field_28 : "/bin/sh");
v8 = do_setup_env(a0, a1, v7);
child_close_fds(a0);
environ = v8;
if (chdir(v6->field_20) == -1) {
if (v3 || !in_chroot)
fprintf(stderr, "Could not chdir to home directory %s: %s\n",
v6->field_20, strerror(*(__errno_location())));
if (v3)
exit(0x1);
}
closefrom(0x3);
do_rc_files(a0, a1, v7);
ssh_signal(0xd, 0x0);
switch (a1->field_c8) {
case 3:
v1 = &v16;
v0 = "Connection from %s: refusing non-sftp session";
sshlog("session.c", "do_child", 0x66e, 0x0, 0x2, 0x0);
printf("This service allows sftp connections only.\n");
fflush(NULL);
exit(0x1);
case 2:
setproctitle("%s@%s", a1->field_10->field_0);
v9 = xstrdup((!a2 ? a2 : "sftp-server"));
v2 = 0;
for (v5 = strtok(v9, " "); v5; v5 = strtok(NULL, " ")) {
if (v2 <= 8) {
v26 = v2;
v2 = __addvsi3(v2, 0x1);
*((&v10 + 0x8 * v26)) = v5;
}
}
*(&(&v10)[8 * v2]) = 0;
BSDoptreset = 1;
BSDoptind = BSDoptreset;
__progname = v10;
exit(sftp_server_main(v2, &v10, a1->field_10, &v10));
default:
fflush(NULL);
v4 = strrchr(v7, 0x2f);
if (!v4) {
v4 = v7;
break;
} else {
v4 += 1;
break;
}
if (a2) {
v10 = v4;
v11 = "-c";
v12 = a2;
v13 = 0;
execve(v7, &v10, v8);
perror(v7);
exit(0x1);
}
v14 = 45;
if (strlcpy(&v15, v4, 0xff, v4) <= 254) {
v10 = &v14;
v11 = 0;
execve(v7, &v10, v8);
perror(v7);
exit(0x1);
}
*(__errno_location()) = 22;
perror(v7);
exit(0x1);
}
} | openssh-portable | angr_sailr |
char *sshbuf_dtob64_string(const struct sshbuf *buf, int wrap) {
struct sshbuf *tmp;
char *ret;
if ((tmp = sshbuf_new()) == ((void *)0))
return ((void *)0);
if (sshbuf_dtob64(buf, tmp, wrap) != 0) {
sshbuf_free(tmp);
return ((void *)0);
}
ret = sshbuf_dup_string(tmp);
sshbuf_free(tmp);
return ret;
} | long long sshbuf_dtob64_string(unsigned long long a0, unsigned long a1) {
unsigned long long v0;
unsigned long long v1;
void *v3;
v0 = sshbuf_new();
if (!v0) {
v3 = 0;
} else if (sshbuf_dtob64(a0, v0, a1)) {
sshbuf_free(v0);
v3 = 0;
} else {
v1 = sshbuf_dup_string(v0);
sshbuf_free(v0);
v3 = v1;
}
return v3;
} | openssh-portable | angr_phoenix |
int file_has_acl_at(int fd, char const *file, struct stat const *st) {
;
if (fd == -100 || (((file)[0]) == '/'))
return (file_has_acl(file, st));
{
struct saved_cwd saved_cwd;
int saved_errno;
int err;
{
char proc_buf[((4096) < (4096 - 64) ? (4096) : (4096 - 64))];
char *proc_file = openat_proc_name(proc_buf, fd, file);
if (proc_file) {
int proc_result = (file_has_acl(proc_file, st));
int proc_errno = (*__errno_location());
if (proc_file != proc_buf)
free(proc_file);
if (-1 != proc_result)
return proc_result;
if (!((proc_errno) == 20 || (proc_errno) == 2 || (proc_errno) == 1 ||
(proc_errno) == 13 || (proc_errno) == 38 || (proc_errno) == 95)) {
(*__errno_location()) = proc_errno;
return proc_result;
}
}
}
if (save_cwd(&saved_cwd) != 0)
openat_save_fail((*__errno_location()));
if (0 <= fd && fd == saved_cwd.desc) {
free_cwd(&saved_cwd);
(*__errno_location()) = 9;
return -1;
}
if (fchdir(fd) != 0) {
saved_errno = (*__errno_location());
free_cwd(&saved_cwd);
(*__errno_location()) = saved_errno;
return -1;
}
err = (file_has_acl(file, st));
saved_errno = (err == -1 ? (*__errno_location()) : 0);
if (restore_cwd(&saved_cwd) != 0)
openat_restore_fail((*__errno_location()));
free_cwd(&saved_cwd);
if (saved_errno)
(*__errno_location()) = saved_errno;
return err;
}
} | int file_has_acl_at(unsigned long a0, char *a1, unsigned long long a2) {
unsigned long long v0;
unsigned int v1;
unsigned int v2;
unsigned int v3;
unsigned int v4;
void *v5;
char v6;
char v7;
unsigned int v9;
v0 = *(&v0);
if (a0 != -100 && *(a1) != 47) {
v5 = openat_proc_name(&v7, a0, a1, a0);
if (v5) {
v1 = file_has_acl(v5, a2, a2);
v2 = *(__errno_location());
if (v5 != &v7)
free(v5);
if (v1 != -1) {
v9 = v1;
} else if (v2 != 20 && v2 != 2 && v2 != 1 && v2 != 13 && v2 != 38 &&
v2 != 95) {
*(__errno_location()) = v2;
v9 = v1;
}
}
if (!v5 || v2 == 2 && v1 == -1 || v1 == -1 && v2 == 1 ||
v1 == -1 && v2 == 38 || v1 == -1 && v2 == 20 || v1 == -1 && v2 == 13 ||
v1 == -1 && v2 == 95) {
v9 = save_cwd(&v6);
if (v9)
openat_save_fail(*(__errno_location()));
if (a0 >= 0 && a0 == *(&v6)) {
free_cwd(&v6);
*(__errno_location()) = 9;
v9 = -1;
}
if (a0 < 0 || a0 != *(&v6)) {
v9 = fchdir(a0);
if (v9) {
v4 = *(__errno_location());
free_cwd(&v6);
*(__errno_location()) = v4;
v9 = -1;
} else {
v3 = file_has_acl(a1, a2, a2);
if (v3 == -1)
v9 = *(__errno_location());
else
v9 = 0;
v4 = v9;
v9 = restore_cwd(&v6);
if (v9)
openat_restore_fail(*(__errno_location()));
free_cwd(&v6);
if (v4)
*(__errno_location()) = v4;
v9 = v3;
}
}
}
}
if (a0 == -100 || *(a1) == 47)
v9 = file_has_acl(a1, a2, a2);
return v9;
} | tar | angr_dream |
static void get_header(void) {
size_t col;
alloc_table_row();
for (col = 0; col < ncolumns; col++) {
char *cell = ((void *)0);
char const *header = gettext(columns[col]->caption);
if (columns[col]->field == SIZE_FIELD &&
(header_mode == DEFAULT_MODE ||
(header_mode == OUTPUT_MODE &&
!(human_output_opts & human_autoscale)))) {
char buf[((2 * sizeof(uintmax_t) * 8 * 146 / 485 + 1) * (16 + 1) - 16 +
1 + 3) +
1];
int opts = (human_suppress_point_zero | human_autoscale | human_SI |
(human_output_opts &
(human_group_digits | human_base_1024 | human_B)));
uintmax_t q1000 = output_block_size;
uintmax_t q1024 = output_block_size;
_Bool divisible_by_1000;
_Bool divisible_by_1024;
do {
divisible_by_1000 = q1000 % 1000 == 0;
q1000 /= 1000;
divisible_by_1024 = q1024 % 1024 == 0;
q1024 /= 1024;
} while (divisible_by_1000 & divisible_by_1024);
if (divisible_by_1000 < divisible_by_1024)
opts |= human_base_1024;
if (divisible_by_1024 < divisible_by_1000)
opts &= ~human_base_1024;
if (!(opts & human_base_1024))
opts |= human_B;
char *num = human_readable(output_block_size, buf, opts, 1, 1);
header = gettext("blocks");
if (asprintf(&cell, gettext("%s-%s"), num, header) == -1)
cell = ((void *)0);
} else if (header_mode == POSIX_MODE && columns[col]->field == SIZE_FIELD) {
char buf[((((((sizeof(uintmax_t) * 8) -
(!((__typeof__(uintmax_t))0 < (__typeof__(uintmax_t))-1))) *
146 +
484) /
485) +
(!((__typeof__(uintmax_t))0 < (__typeof__(uintmax_t))-1))) +
1)];
char *num = umaxtostr(output_block_size, buf);
if (asprintf(&cell, gettext("%s-%s"), num, header) == -1)
cell = ((void *)0);
} else
cell = strdup(header);
if (!cell)
xalloc_die();
replace_problematic_chars(cell);
table[nrows - 1][col] = cell;
size_t cell_width = gnu_mbswidth(cell, 0);
columns[col]->width =
(((columns[col]->width) > (cell_width)) ? (columns[col]->width)
: (cell_width));
}
} | void get_header(void)
{
int iVar1;
char *pcVar2;
ulong uVar3;
long in_FS_OFFSET;
bool bVar4;
bool bVar5;
uint local_2ec;
char *local_2e8;
ulong local_2e0;
ulong local_2d8;
ulong local_2d0;
char *local_2c8;
undefined8 local_2c0;
undefined8 local_2b8;
ulong local_2b0;
undefined local_2a8[664];
long local_10;
local_10 = *(long *)(in_FS_OFFSET + 0x28);
alloc_table_row();
for (local_2e0 = 0; local_2e0 < ncolumns; local_2e0 = local_2e0 + 1) {
local_2e8 = (char *)0x0;
local_2c8 = (char *)gettext(
*(undefined8 *)(*(long *)(columns + local_2e0 * 8) + 0x18));
if ((**(int **)(columns + local_2e0 * 8) == 2) &&
((header_mode == 0 ||
((header_mode == 4 && ((human_output_opts & 0x10) == 0)))))) {
local_2ec = human_output_opts & 0x124 | 0x98;
local_2d8 = output_block_size;
local_2d0 = output_block_size;
do {
bVar4 = local_2d8 + ((local_2d8 >> 3) / 0x7d) * -1000 == 0;
local_2d8 = (local_2d8 >> 3) / 0x7d;
bVar5 = (local_2d0 & 0x3ff) == 0;
local_2d0 = local_2d0 >> 10;
} while (bVar5 && bVar4);
if (bVar4 < bVar5) {
local_2ec = human_output_opts & 0x124 | 0xb8;
}
if (bVar5 < bVar4) {
local_2ec = local_2ec & 0xffffffdf;
}
if ((local_2ec & 0x20) == 0) {
local_2ec = local_2ec | 0x100;
}
local_2c0 = human_readable(output_block_size, local_2a8, local_2ec, 1, 1);
local_2c8 = (char *)gettext("blocks");
pcVar2 = (char *)gettext("%s-%s");
iVar1 = asprintf(&local_2e8, pcVar2, local_2c0, local_2c8);
if (iVar1 == -1) {
local_2e8 = (char *)0x0;
}
} else if ((header_mode == 3) &&
(**(int **)(columns + local_2e0 * 8) == 2)) {
local_2b8 = umaxtostr(output_block_size, local_2a8);
pcVar2 = (char *)gettext("%s-%s");
iVar1 = asprintf(&local_2e8, pcVar2, local_2b8, local_2c8);
if (iVar1 == -1) {
local_2e8 = (char *)0x0;
}
} else {
local_2e8 = strdup(local_2c8);
}
if (local_2e8 == (char *)0x0) {
xalloc_die();
}
replace_problematic_chars(local_2e8);
*(char **)(local_2e0 * 8 + *(long *)(table + nrows * 8 + -8)) = local_2e8;
iVar1 = gnu_mbswidth(local_2e8, 0);
local_2b0 = (ulong)iVar1;
uVar3 = *(ulong *)(*(long *)(columns + local_2e0 * 8) + 0x20);
if (uVar3 <= local_2b0) {
uVar3 = local_2b0;
}
*(ulong *)(*(long *)(columns + local_2e0 * 8) + 0x20) = uVar3;
}
if (local_10 == *(long *)(in_FS_OFFSET + 0x28)) {
return;
}
__stack_chk_fail();
} | coreutils | ghidra |
static struct directory *find_directory_meta(dev_t dev, ino_t ino) {
if (!directory_meta_table)
return 0;
else {
struct directory *dir = make_directory("", ((void *)0));
struct directory *ret;
dir->device_number = dev;
dir->inode_number = ino;
ret = hash_lookup(directory_meta_table, dir);
free_directory(dir);
return ret;
}
} | long find_directory_meta(void *a1, void *a2) {
void **directory;
long v4;
if (!directory_meta_table)
return 0LL;
directory = (void **)make_directory(byte_4C14, 0LL);
directory[3] = a1;
directory[4] = a2;
v4 = hash_lookup(directory_meta_table, directory);
free_directory(directory);
return v4;
} | tar | ida |
static void free_invoke_hooks(struct invoke_list *hook_list) {
struct invoke_hook *hook, *hook_next;
for (hook = hook_list->head; hook; hook = hook_next) {
hook_next = hook->next;
free(hook->command);
free(hook);
}
} | void free_invoke_hooks(unsigned long long *a0) {
unsigned long long v0[2];
void *v1;
unsigned long long v3;
unsigned long long v4;
v3 = *(a0);
for (v0[0] = *(a0); v0; v0[0] = v1) {
v1 = v0[0];
free(v0[1]);
free(v0);
v4 = v1;
}
return;
} | dpkg | angr_sailr |
static int screen_columns(void) {
struct winsize win;
if (get_win_size(1, &win) == 0 && 0 < win.ws_col)
return win.ws_col;
{
char *col_string = getenv("COLUMNS");
long int n_columns;
if (!(col_string != ((void *)0)
&&
xstrtol(col_string, ((void *)0), 0, &n_columns, "") == LONGINT_OK &&
0 < n_columns && n_columns <= 0x7fffffff))
n_columns = 80;
return n_columns;
}
} | ulong screen_columns(void)
{
int iVar1;
ulong uVar2;
long in_FS_OFFSET;
ulong local_28;
char *local_20;
undefined local_18[2];
ushort local_16;
long local_10;
local_10 = *(long *)(in_FS_OFFSET + 0x28);
iVar1 = get_win_size(1, local_18);
if ((iVar1 == 0) && (local_16 != 0)) {
uVar2 = (ulong)local_16;
} else {
local_20 = getenv("COLUMNS");
if ((((local_20 == (char *)0x0) ||
(iVar1 = xstrtol(local_20, 0, 0, &local_28, &DAT_00103df3),
iVar1 != 0)) ||
((long)local_28 < 1)) ||
(uVar2 = local_28, 0x7fffffff < (long)local_28)) {
local_28 = 0x50;
uVar2 = local_28;
}
}
if (local_10 == *(long *)(in_FS_OFFSET + 0x28)) {
return uVar2;
}
__stack_chk_fail();
} | coreutils | ghidra |
static void
ipstats_stat_desc_pack_link(struct ipstats_stat_dump_filters *filters,
const struct ipstats_stat_desc *desc) {
ipstats_stat_desc_enable_bit(filters, IFLA_STATS_LINK_64, 0);
} | long long ipstats_stat_desc_pack_link(unsigned int *a0, unsigned long a1) {
unsigned long v0;
v0 = a1;
return ipstats_stat_desc_enable_bit(a0, 0x1, 0x0);
} | iproute2-6.0.0 | angr_dream |
static void ip6tunnel_print_opt(struct link_util *lu, FILE *f,
struct rtattr *tb[]) {
char s2[64];
__u32 flags = 0;
__u32 flowinfo = 0;
__u8 ttl = 0;
if (!tb)
return;
if (tb[IFLA_IPTUN_COLLECT_METADATA]) {
print_bool(PRINT_ANY, "external", "external ", 1);
}
if (tb[IFLA_IPTUN_FLAGS])
flags = rta_getattr_u32(tb[IFLA_IPTUN_FLAGS]);
if (tb[IFLA_IPTUN_FLOWINFO])
flowinfo = rta_getattr_u32(tb[IFLA_IPTUN_FLOWINFO]);
if (tb[IFLA_IPTUN_PROTO]) {
switch (rta_getattr_u8(tb[IFLA_IPTUN_PROTO])) {
case IPPROTO_IPIP:
print_string(PRINT_ANY, "proto", "%s ", "ipip6");
break;
case IPPROTO_IPV6:
print_string(PRINT_ANY, "proto", "%s ", "ip6ip6");
break;
case 0:
print_string(PRINT_ANY, "proto", "%s ", "any");
break;
}
}
tnl_print_endpoint("remote", tb[IFLA_IPTUN_REMOTE], 10);
tnl_print_endpoint("local", tb[IFLA_IPTUN_LOCAL], 10);
if (tb[IFLA_IPTUN_LINK]) {
__u32 link = rta_getattr_u32(tb[IFLA_IPTUN_LINK]);
if (link) {
print_string(PRINT_ANY, "link", "dev %s ", ll_index_to_name(link));
}
}
if (tb[IFLA_IPTUN_TTL])
ttl = rta_getattr_u8(tb[IFLA_IPTUN_TTL]);
if (is_json_context() || ttl)
print_uint(PRINT_ANY, "ttl", "hoplimit %u ", ttl);
else
print_string(PRINT_FP, ((void *)0), "hoplimit %s ", "inherit");
if (flags & 0x1) {
print_bool(PRINT_ANY, "ip6_tnl_f_ign_encap_limit", "encaplimit none ",
1);
} else if (tb[IFLA_IPTUN_ENCAP_LIMIT]) {
__u8 val = rta_getattr_u8(tb[IFLA_IPTUN_ENCAP_LIMIT]);
print_uint(PRINT_ANY, "encap_limit", "encaplimit %u ", val);
}
if (flags & 0x2) {
print_bool(PRINT_ANY, "ip6_tnl_f_use_orig_tclass", "tclass inherit ",
1);
} else if (tb[IFLA_IPTUN_FLOWINFO]) {
__u32 val = ntohl(flowinfo & htonl(0x0FF00000)) >> 20;
snprintf(s2, sizeof(s2), "0x%02x", val);
print_string(PRINT_ANY, "tclass", "tclass %s ", s2);
}
if (flags & 0x4) {
print_bool(PRINT_ANY, "ip6_tnl_f_use_orig_flowlabel", "flowlabel inherit ",
1);
} else if (tb[IFLA_IPTUN_FLOWINFO]) {
__u32 val = ntohl(flowinfo & htonl(0x000FFFFF));
snprintf(s2, sizeof(s2), "0x%05x", val);
print_string(PRINT_ANY, "flowlabel", "flowlabel %s ", s2);
}
if (flags & 0x10)
print_bool(PRINT_ANY, "ip6_tnl_f_rcv_dscp_copy", "dscp inherit ",
1);
if (flags & 0x8)
print_bool(PRINT_ANY, "ip6_tnl_f_mip6_dev", "mip6 ", 1);
if (flags & 0x40)
print_bool(PRINT_ANY, "ip6_tnl_f_allow_local_remote", "allow-localremote ",
1);
if (flags & 0x20) {
print_bool(PRINT_ANY, "ip6_tnl_f_use_orig_fwmark", "fwmark inherit ",
1);
} else if (tb[IFLA_IPTUN_FWMARK]) {
__u32 fwmark = rta_getattr_u32(tb[IFLA_IPTUN_FWMARK]);
if (fwmark) {
print_0xhex(PRINT_ANY, "fwmark", "fwmark %#llx ", fwmark);
}
}
tnl_print_encap(tb, IFLA_IPTUN_ENCAP_TYPE, IFLA_IPTUN_ENCAP_FLAGS,
IFLA_IPTUN_ENCAP_SPORT, IFLA_IPTUN_ENCAP_DPORT);
} | long long ip6tunnel_print_opt(unsigned long a0, unsigned long a1,
unsigned long long a2[21]) {
unsigned long v0;
unsigned long v1;
char v2;
char v3;
unsigned int v4;
unsigned int v5;
unsigned int v6;
unsigned int v7;
unsigned int v8;
unsigned int v9;
char v10;
unsigned long long v12;
unsigned long long v13;
v1 = a0;
v0 = a1;
v4 = 0;
v5 = 0;
v2 = 0;
if (a2) {
if (a2[19])
print_bool(0x4, "external", "external ", 0x1);
if (a2[8])
v4 = rta_getattr_u32(a2[8]);
if (a2[7])
v5 = rta_getattr_u32(a2[7]);
if (a2[9]) {
v12 = rta_getattr_u8(a2[9]);
if (v12 == 41) {
print_string(0x4, "proto", "%s ", "ip6ip6");
} else if (v12 <= 41) {
if (!v12) {
print_string(0x4, "proto", "%s ", "any");
} else if (v12 == 4) {
print_string(0x4, "proto", "%s ", "ipip6");
}
}
}
tnl_print_endpoint("remote", a2[3], 0xa);
tnl_print_endpoint("local", a2[2], 0xa);
if (a2[1]) {
v6 = rta_getattr_u32(a2[1]);
if (v6)
print_string(0x4, "link", "dev %s ", ll_index_to_name(v6));
}
if (a2[4])
v2 = rta_getattr_u8(a2[4]);
v13 = is_json_context();
if (!v13 && !v2)
print_string(0x1, 0x0, "hoplimit %s ", "inherit");
if (v2 || v13)
print_uint(0x4, "ttl", "hoplimit %u ", v2);
if ((v4 & 1)) {
print_bool(0x4, "ip6_tnl_f_ign_encap_limit", "encaplimit none ", 0x1);
} else if (a2[6]) {
v3 = rta_getattr_u8(a2[6]);
print_uint(0x4, "encap_limit", "encaplimit %u ", v3);
}
if ((v4 & 2)) {
print_bool(0x4, "ip6_tnl_f_use_orig_tclass", "tclass inherit ", 0x1);
} else if (a2[7]) {
v7 = ntohl(htonl(0xff00000) & v5) >> 20;
snprintf(&v10, 0x40, "0x%02x", v7);
print_string(0x4, "tclass", "tclass %s ", &v10);
}
if ((v4 & 4)) {
print_bool(0x4, "ip6_tnl_f_use_orig_flowlabel", "flowlabel inherit ",
0x1);
} else if (a2[7]) {
v8 = ntohl(htonl(0xfffff) & v5);
snprintf(&v10, 0x40, "0x%05x", v8);
print_string(0x4, "flowlabel", "flowlabel %s ", &v10);
}
if ((v4 & 16))
print_bool(0x4, "ip6_tnl_f_rcv_dscp_copy", "dscp inherit ", 0x1);
if ((v4 & 8))
print_bool(0x4, "ip6_tnl_f_mip6_dev", "mip6 ", 0x1);
if ((v4 & 64))
print_bool(0x4, "ip6_tnl_f_allow_local_remote", "allow-localremote ",
0x1);
if ((v4 & 32)) {
print_bool(0x4, "ip6_tnl_f_use_orig_fwmark", "fwmark inherit ", 0x1);
} else if (a2[20]) {
v9 = rta_getattr_u32(a2[20]);
if (v9)
print_0xhex(0x4, "fwmark", "fwmark %#llx ", v9);
}
tnl_print_encap(a2, 0xf, 0x10, 0x11, 0x12);
}
return 0;
} | iproute2-6.0.0 | angr_dream |
static inline void flush_file(void) {
off_t blocks_to_skip;
set_next_block_after(current_header);
blocks_to_skip = (current_stat_info.stat.st_size + 512 - 1) / 512;
while (record_end - current_block <= blocks_to_skip) {
blocks_to_skip -= (record_end - current_block);
flush_archive();
}
current_block += blocks_to_skip;
} | void flush_file(unsigned long long a0, unsigned long long a1, unsigned long a2,
unsigned long long a3, unsigned long long a4,
unsigned long long a5) {
unsigned long long v0;
unsigned long long v2;
set_next_block_after(current_header);
*(&v0) = (xmalloc + 511 < 0 ? xmalloc + 1022 : xmalloc + 511) >> 9;
while (v0 >= record_end - current_block >> 9) {
v0 += -(record_end - current_block >> 9);
flush_archive(a0, a1, record_end - current_block, a3, a4, a5);
}
v2 = current_block + v0 * 0x200;
current_block = current_block + v0 * 0x200;
return;
} | tar | angr_dream |
static void tls_log_func(int level, const char *str) {
fprintf(stderr, "|<%d>| %s", level, str);
} | int tls_log_func(unsigned int a1, const char *a2) {
return fprintf(stderr, "|<%d>| %s", a1, a2);
} | gnutls | ida |
static void expbackq(union node *cmd, int flag) {
struct backcmd in;
int i;
char buf[128];
char *p;
char *dest;
int startloc;
struct stackmark smark;
if (flag & 0x400)
goto out;
({
suppressint++;
({ __asm__ __volatile__("" : : : "memory"); });
0;
});
startloc = expdest - (char *)((void *)stacknxt);
pushstackmark(&smark, startloc);
evalbackcmd(cmd, (struct backcmd *)&in);
popstackmark(&smark);
p = in.buf;
i = in.nleft;
if (i == 0)
goto read;
for (;;) {
memtodest(p, i, flag);
read:
if (in.fd < 0)
break;
do {
i = read(in.fd, buf, sizeof buf);
} while (i < 0 && (*dash_errno) == 4);
;
if (i <= 0)
break;
p = buf;
}
if (in.buf)
free((pointer)(in.buf));
if (in.fd >= 0) {
close(in.fd);
back_exitstatus = waitforjob(in.jp);
}
({
({ __asm__ __volatile__("" : : : "memory"); });
if (--suppressint == 0 && intpending)
onint();
0;
});
dest = expdest;
for (; dest > ((char *)((void *)stacknxt) + startloc) && dest[-1] == '\n';)
(--dest);
expdest = dest;
if (!(flag & 0x100))
recordregion(startloc, dest - (char *)((void *)stacknxt), 0);
;
out:
argbackq = argbackq->next;
} | void expbackq(unsigned long long a0, unsigned long a1) {
unsigned int v0;
unsigned int v1;
unsigned long long v2;
void *v3;
char v4;
char v5;
char v6;
char v7;
char v8;
char v9;
char v10;
unsigned long long *v12;
unsigned long long v13;
if (!(a1 & 0x400)) {
suppressint = suppressint + 1;
v1 = (expdest - stacknxt);
pushstackmark(&v4, v1, v1);
evalbackcmd(a0, &v5, &v5);
popstackmark(&v4);
v2 = *(&v6);
v0 = *(&v7);
if (v0)
memtodest(v2, v0, a1);
while (true) {
if (*(&v5) < 0)
break;
do {
v0 = read(*(&v5), &v9, 0x80);
} while (v0 < 0 && *(dash_errno) == 4);
if (v0 <= 0)
break;
v2 = &v9;
memtodest(v2, v0, a1);
}
if (*(&v6))
free(*(&v6));
if (*(&v5) >= 0) {
close(*(&v5));
back_exitstatus = waitforjob(*(&v8));
}
suppressint = suppressint - 1;
if (!suppressint && intpending)
onint();
for (v3 = expdest; v3 > v1 + stacknxt && v3[1] == 10; v3 -= 1)
;
expdest = v3;
if (!(a1 & 0x100))
recordregion(v1, v3 - stacknxt, 0x0);
}
argbackq = *(argbackq);
v13 = *(&v10) ^ v12[5];
return;
} | dash-0.5.11+git20210903+057cd650a4ed | angr_sailr |
keymacro_map_str(EditLine *el, wchar_t *str) {
el->el_keymacro.val.str = str;
return &el->el_keymacro.val;
} | long keymacro_map_str(long param_1, undefined8 param_2)
{
*(undefined8 *)(param_1 + 0x450) = param_2;
return param_1 + 0x450;
} | libedit | ghidra |
void *growstackstr(void) {
size_t len = stacknleft;
growstackblock(0);
return ((void *)stacknxt) + len;
} | undefined *growstackstr(void)
{
long lVar1;
lVar1 = stacknleft;
growstackblock(0);
return stacknxt + lVar1;
} | dash-0.5.11+git20210903+057cd650a4ed | ghidra |
char *sh_mktmpname(nameroot, flags)
char *nameroot;
int flags;
{
char *filename, *tdir, *lroot;
struct stat sb;
int r, tdlen;
static int seeded = 0;
filename = (char *)sh_xmalloc((4096 + 1), "tmpfile.c", 144);
tdir = get_tmpdir(flags);
tdlen = strlen(tdir);
lroot = nameroot ? nameroot : "shtmp";
if (nameroot == 0)
flags &= ~0x0008;
if ((flags & 0x0008) && strlen(nameroot) > 4096)
flags &= ~0x0008;
if (flags & 0x0008)
strcpy(filename, nameroot);
else
sprintf(filename, "%s/%s.XXXXXX", tdir, lroot);
if (mktemp(filename) == 0) {
sh_xfree((filename), "tmpfile.c", 162);
filename = ((void *)0);
}
return filename;
} | char *sh_mktmpname(char *param_1, uint param_2)
{
long lVar1;
char *__s;
size_t sVar2;
char *pcVar3;
long in_FS_OFFSET;
uint local_d4;
char *local_c0;
lVar1 = *(long *)(in_FS_OFFSET + 0x28);
local_c0 = (char *)sh_xmalloc(0x1001, "tmpfile.c", 0x90);
__s = (char *)get_tmpdir(param_2);
strlen(__s);
local_d4 = param_2;
pcVar3 = param_1;
if (param_1 == (char *)0x0) {
local_d4 = 0;
pcVar3 = "shtmp";
}
if (((local_d4 & 8) != 0) && (sVar2 = strlen(param_1), 0x1000 < sVar2)) {
local_d4 = 0;
}
if ((local_d4 & 8) == 0) {
sprintf(local_c0, "%s/%s.XXXXXX", __s, pcVar3);
} else {
strcpy(local_c0, param_1);
}
pcVar3 = mktemp(local_c0);
if (pcVar3 == (char *)0x0) {
sh_xfree(local_c0, "tmpfile.c", 0xa2);
local_c0 = (char *)0x0;
}
if (lVar1 != *(long *)(in_FS_OFFSET + 0x28)) {
__stack_chk_fail();
}
return local_c0;
} | bash | ghidra |
static ssize_t client_push(gnutls_transport_ptr_t tr, const void *data,
size_t len) {
size_t newlen;
;
len = ((len) < (sizeof(to_server) - to_server_len)
? (len)
: (sizeof(to_server) - to_server_len));
newlen = to_server_len + len;
memcpy(to_server + to_server_len, data, len);
to_server_len = newlen;
return len;
} | size_t client_push(undefined8 param_1, void *param_2, ulong param_3)
{
ulong __n;
long lVar1;
__n = 0x10000U - to_server_len;
if (param_3 <= 0x10000U - to_server_len) {
__n = param_3;
}
lVar1 = __n + to_server_len;
memcpy(to_server + to_server_len, param_2, __n);
to_server_len = lVar1;
return __n;
} | gnutls | ghidra |
(r = sshpkt_get_end(ssh)) != 0)
sshpkt_fatal(ssh, r, "%s: parse packet", __func__);
if (target_port > 0xFFFF) {
sshlog("serverloop.c", __func__, 443, 1, SYSLOG_LEVEL_ERROR, ((void *)0),
"invalid target port");
*reason = 1;
goto out;
} | || (cstring = sshpkt_get_end(a1)) != 0 )
{
sshpkt_fatal(a1, cstring, "%s: parse packet",
"server_request_direct_tcpip");
} | openssh-portable | ida |
vi_repeat_prev_char(EditLine *el, wint_t c __attribute__((__unused__))) {
el_action_t r;
int dir = el->el_search.chadir;
r = cv_csearch(el, -dir, el->el_search.chacha, el->el_state.argument,
el->el_search.chatflg);
el->el_search.chadir = dir;
return r;
} | undefined vi_repeat_prev_char(long param_1)
{
int iVar1;
undefined uVar2;
iVar1 = *(int *)(param_1 + 0x4ac);
uVar2 = cv_csearch(param_1, -iVar1, *(undefined4 *)(param_1 + 0x4b0),
*(undefined4 *)(param_1 + 0x78),
(int)*(char *)(param_1 + 0x4b4));
*(int *)(param_1 + 0x4ac) = iVar1;
return uVar2;
} | libedit | ghidra |
static inline __s32 rta_getattr_s32(const struct rtattr *rta) {
return *(__s32 *)((
void *)(((char *)(rta)) +
((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0))));
} | int rta_getattr_s32(struct_0 *a0) { return a0->field_4; } | iproute2-6.0.0 | angr_phoenix |
static intmax_t parse_integer(char const *str, strtol_error *invalid) {
int indeterminate = 0;
uintmax_t n = indeterminate;
char *suffix;
static char const suffixes[] = "bcEGkKMPTwYZ0";
strtol_error e = xstrtoumax(str, &suffix, 10, &n, suffixes);
intmax_t result;
if ((e & ~LONGINT_OVERFLOW) == LONGINT_INVALID_SUFFIX_CHAR &&
suffix[-1] != 'B' && *suffix == 'B') {
suffix++;
if (!*suffix)
e &= ~LONGINT_INVALID_SUFFIX_CHAR;
}
if ((e & ~LONGINT_OVERFLOW) == LONGINT_INVALID_SUFFIX_CHAR &&
*suffix == 'x' && !(suffix[-1] == 'B' && strchr(suffix + 1, 'B'))) {
uintmax_t o;
strtol_error f = xstrtoumax(suffix + 1, &suffix, 10, &o, suffixes);
if ((f & ~LONGINT_OVERFLOW) != LONGINT_OK) {
e = f;
result = indeterminate;
} else if (__builtin_mul_overflow(n, o, &result) ||
(result != 0 && ((e | f) & LONGINT_OVERFLOW))) {
e = LONGINT_OVERFLOW;
result = (9223372036854775807L);
} else {
if (result == 0 && (strncmp(str, "0x", strlen("0x")) == 0))
nl_error(0, 0,
gettext("warning: %s is a zero multiplier; "
"use %s if that is intended"),
quote_n(0, "0x"), quote_n(1, "00x"));
e = LONGINT_OK;
}
} else if (n <= (9223372036854775807L))
result = n;
else {
e = LONGINT_OVERFLOW;
result = (9223372036854775807L);
}
*invalid = e;
return result;
} | unsigned long parse_integer(const char *a1, int *a2) {
bool v2;
size_t v3;
long v4;
long v5;
char *v6;
long v7;
int v9;
int v10;
signed long v11;
long v12;
unsigned long v13;
unsigned long v14[4];
v14[1] = __readfsqword(0x28u);
v11 = 0LL;
v9 = xstrtoumax(a1, &v12, 10LL, &v11, "bcEGkKMPTwYZ0");
if ((v9 & 0xFFFFFFFE) == 2 && *(_BYTE *)(v12 - 1) != 66 &&
*(_BYTE *)v12 == 66 && !*(_BYTE *)++v12)
v9 &= ~2u;
if ((v9 & 0xFFFFFFFE) != 2 || *(_BYTE *)v12 != 120 ||
*(_BYTE *)(v12 - 1) == 66 && strchr((const char *)(v12 + 1), 66)) {
if (v11 < 0) {
v9 = 1;
v13 = 0x7FFFFFFFFFFFFFFFLL;
} else {
v13 = v11;
}
} else {
v10 = xstrtoumax(v12 + 1, &v12, 10LL, v14, "bcEGkKMPTwYZ0");
if ((v10 & 0xFFFFFFFE) != 0) {
v9 = v10;
v13 = 0LL;
} else {
v2 = !is_mul_ok(v14[0], v11);
if (((v14[0] * v11) & 0x8000000000000000LL) != 0LL)
v2 = 1;
v13 = v14[0] * v11;
if (v2 || v13 && (((unsigned char)v10 | (unsigned char)v9) & 1) != 0) {
v9 = 1;
v13 = 0x7FFFFFFFFFFFFFFFLL;
} else {
if (!v13) {
v3 = strlen("0x");
if (!strncmp(a1, "0x", v3)) {
v4 = quote_n(1LL, "00x");
v5 = quote_n(0LL, "0x");
v6 = gettext(
"warning: %s is a zero multiplier; use %s if that is intended");
nl_error(0, 0, (long)v6, v5, v4, v7);
}
}
v9 = 0;
}
}
}
*a2 = v9;
return v13;
} | coreutils | ida |
int rl_vi_replace(int count, int key) {
int i;
vi_replace_count = 0;
if (vi_replace_map == 0) {
vi_replace_map = rl_make_bare_keymap();
for (i = 0; i < ' '; i++)
if (vi_insertion_keymap[i].type == 0)
vi_replace_map[i].function = vi_insertion_keymap[i].function;
for (i = ' '; i < 257; i++)
vi_replace_map[i].function = rl_vi_overstrike;
vi_replace_map[0x7f].function = rl_vi_overstrike_delete;
vi_replace_map[(('[') & 0x1f)].function = rl_vi_movement_mode;
vi_replace_map[(('M') & 0x1f)].function = rl_newline;
vi_replace_map['\n'].function = rl_newline;
if (vi_insertion_keymap[(('H') & 0x1f)].type == 0 &&
vi_insertion_keymap[(('H') & 0x1f)].function == rl_rubout)
vi_replace_map[(('H') & 0x1f)].function = rl_vi_overstrike_delete;
if (vi_insertion_keymap[(('U') & 0x1f)].type == 0 &&
vi_insertion_keymap[(('U') & 0x1f)].function == rl_unix_line_discard)
vi_replace_map[(('U') & 0x1f)].function = rl_vi_overstrike_kill_line;
if (vi_insertion_keymap[(('W') & 0x1f)].type == 0 &&
vi_insertion_keymap[(('W') & 0x1f)].function == rl_vi_unix_word_rubout)
vi_replace_map[(('W') & 0x1f)].function = rl_vi_overstrike_kill_word;
if (vi_insertion_keymap[(('Y') & 0x1f)].type == 0 &&
vi_insertion_keymap[(('Y') & 0x1f)].function == rl_yank)
vi_replace_map[(('Y') & 0x1f)].function = rl_vi_overstrike_yank;
vi_replace_map[257 - 1].type = 0;
vi_replace_map[257 - 1].function = (rl_command_func_t *)((void *)0);
}
rl_vi_start_inserting(key, 1, rl_arg_sign);
_rl_vi_last_key_before_insert = 'R';
_rl_keymap = vi_replace_map;
if (_rl_enable_bracketed_paste)
rl_bind_keyseq_if_unbound("\033[200~", rl_vi_overstrike_bracketed_paste);
return (0);
} | undefined8 rl_vi_replace(undefined8 param_1, undefined4 param_2)
{
int local_c;
vi_replace_count = 0;
if (vi_replace_map == 0) {
vi_replace_map = rl_make_bare_keymap();
for (local_c = 0; local_c < 0x20; local_c = local_c + 1) {
if ((&vi_insertion_keymap)[(long)local_c * 0x10] == '\0') {
*(undefined8 *)((long)local_c * 0x10 + vi_replace_map + 8) =
*(undefined8 *)(&_rl_show_mode_in_prompt + (long)local_c * 4);
}
}
for (local_c = 0x20; local_c < 0x101; local_c = local_c + 1) {
*(code **)(vi_replace_map + (long)local_c * 0x10 + 8) = rl_vi_overstrike;
}
*(code **)(vi_replace_map + 0x7f8) = rl_vi_overstrike_delete;
*(code **)(vi_replace_map + 0x1b8) = rl_vi_movement_mode;
*(undefined8 *)(vi_replace_map + 0xd8) = uRam0000000000104585;
*(undefined8 *)(vi_replace_map + 0xa8) = uRam000000000010459d;
if ((towupper == (code)0x0) && (_rl_forward_char == lRam00000000001045ba)) {
*(code **)(vi_replace_map + 0x88) = rl_vi_overstrike_delete;
}
if ((_rl_read_mbchar == (code)0x0) &&
(_rl_callback_func == lRam00000000001045ee)) {
*(code **)(vi_replace_map + 0x158) = rl_vi_overstrike_kill_line;
}
if ((_rl_callback_data_alloc == (code)0x0) &&
(_rl_callback_data == rl_vi_unix_word_rubout)) {
*(code **)(vi_replace_map + 0x178) = rl_vi_overstrike_kill_word;
}
if ((rl_unix_line_discard == (code)0x0) &&
(__rl_bracketed_text == lRam000000000010465a)) {
*(code **)(vi_replace_map + 0x198) = rl_vi_overstrike_yank;
}
*(undefined *)(vi_replace_map + 0x1000) = 0;
*(undefined8 *)(vi_replace_map + 0x1008) = 0;
}
rl_vi_start_inserting(param_2, 1, rl_arg_sign);
_rl_vi_last_key_before_insert = 0x52;
_rl_keymap = vi_replace_map;
if (_rl_enable_bracketed_paste != 0) {
rl_bind_keyseq_if_unbound(&DAT_00104abf, rl_vi_overstrike_bracketed_paste);
}
return 0;
} | bash | ghidra |
static int human_numcompare(char const *a, char const *b) {
while (blanks[to_uchar(*a)])
a++;
while (blanks[to_uchar(*b)])
b++;
int diff = find_unit_order(a) - find_unit_order(b);
return (diff ? diff : strnumcmp(a, b, decimal_point, thousands_sep));
} | ulong human_numcompare(char *param_1, char *param_2)
{
byte bVar1;
int iVar2;
int iVar3;
ulong uVar4;
char *local_38;
char *local_30;
local_30 = param_1;
while (bVar1 = to_uchar((int)*local_30), local_38 = param_2,
blanks[(int)(uint)bVar1] != '\0') {
local_30 = local_30 + 1;
}
while (bVar1 = to_uchar((int)*local_38), blanks[(int)(uint)bVar1] != '\0') {
local_38 = local_38 + 1;
}
iVar2 = find_unit_order(local_30);
iVar3 = find_unit_order(local_38);
if (iVar2 - iVar3 == 0) {
uVar4 = strnumcmp(local_30, local_38, (int)decimal_point, thousands_sep);
} else {
uVar4 = (ulong)(uint)(iVar2 - iVar3);
}
return uVar4;
} | coreutils | ghidra |
static void print_tunnel(const struct l2tp_data *data) {
const struct l2tp_parm *p = &data->config;
char buf[46];
open_json_object(((void *)0));
print_uint(PRINT_ANY, "tunnel_id", "Tunnel %u,", p->tunnel_id);
print_string(PRINT_ANY, "encap", " encap %s",
p->encap == L2TP_ENCAPTYPE_UDP ? "UDP"
: p->encap == L2TP_ENCAPTYPE_IP ? "IP"
: "??");
print_nl();
print_string(
PRINT_ANY, "local", " From %s ",
inet_ntop(p->local_ip.family, p->local_ip.data, buf, sizeof(buf)));
print_string(PRINT_ANY, "peer", "to %s",
inet_ntop(p->peer_ip.family, p->peer_ip.data, buf, sizeof(buf)));
print_nl();
print_uint(PRINT_ANY, "peer_tunnel", " Peer tunnel %u", p->peer_tunnel_id);
print_nl();
if (p->encap == L2TP_ENCAPTYPE_UDP) {
print_string(PRINT_FP, ((void *)0),
" UDP source / dest ports:", ((void *)0));
print_hu(PRINT_ANY, "local_port", " %hu", p->local_udp_port);
print_hu(PRINT_ANY, "peer_port", "/%hu", p->peer_udp_port);
print_nl();
switch (p->local_ip.family) {
case 2:
print_bool(PRINT_JSON, "checksum",
((void *)0), p->udp_csum);
print_string(PRINT_FP, ((void *)0), " UDP checksum: %s\n",
p->udp_csum ? "enabled" : "disabled");
break;
case 10:
if (is_json_context()) {
print_bool(PRINT_JSON, "checksum_tx",
((void *)0), p->udp6_csum_tx);
print_bool(PRINT_JSON, "checksum_rx",
((void *)0), p->udp6_csum_rx);
} else {
printf(" UDP checksum: %s%s%s%s\n",
p->udp6_csum_tx && p->udp6_csum_rx ? "enabled" : "",
p->udp6_csum_tx && !p->udp6_csum_rx ? "tx" : "",
!p->udp6_csum_tx && p->udp6_csum_rx ? "rx" : "",
!p->udp6_csum_tx && !p->udp6_csum_rx ? "disabled" : "");
}
break;
}
}
close_json_object();
} | void print_tunnel(struct_0 *a0, unsigned int a1, unsigned int a2,
unsigned long long a3, unsigned long long a4,
unsigned long long a5) {
char v0;
char v1;
unsigned long v3;
unsigned long long v4;
unsigned int v5;
unsigned long long *v6;
unsigned long long v7;
open_json_object(0x0);
print_uint(0x4, "tunnel_id", "Tunnel %u,", a0->field_0);
if (!a0->field_10) {
v3 = "UDP";
} else if (a0->field_10 == 1) {
v3 = "IP";
} else {
v3 = "??";
}
print_string(0x4, "encap", " encap %s", v3);
print_nl(0x4, "encap", " encap %s", a3, a4, a5);
print_string(0x4, "local", " From %s ",
inet_ntop(a0->field_36, &a0->padding_38, &v0, 0x2e));
print_string(0x4, "peer", "to %s",
inet_ntop(a0->field_13e, &a0->padding_140, &v0, 0x2e));
print_nl(0x4, "peer", "to %s", a3, a4, a5);
print_uint(0x4, "peer_tunnel", " Peer tunnel %u", a0->field_4);
print_nl(0x4, "peer_tunnel", " Peer tunnel %u", a3, a4, a5);
if (!a0->field_10) {
print_string(0x1, 0x0, " UDP source / dest ports:", 0x0);
print_hu(0x4, "local_port", " %hu", a0->field_14);
print_hu(0x4, "peer_port", "/%hu", a0->field_16);
print_nl(0x4, "peer_port", "/%hu", a3, a4, a5);
if (a0->field_36 == 2) {
print_bool(0x2, "checksum", 0x0, (a0->field_242 & 4));
if ((a0->field_242 & 4))
v4 = "enabled";
else
v4 = "disabled";
print_string(0x1, 0x0, " UDP checksum: %s\n", v4);
} else if (a0->field_36 == 10) {
if (is_json_context()) {
print_bool(0x2, "checksum_tx", 0x0, (a0->field_242 & 1));
print_bool(0x2, "checksum_rx", 0x0, (a0->field_242 & 2));
} else {
if (!(a0->field_242 & 1) && !(a0->field_242 & 2)) {
a1 = "disabled";
goto LABEL_400dc7;
}
a1 = &g_402f11;
LABEL_400dc7:
if (!(a0->field_242 & 1) && (a0->field_242 & 2)) {
v5 = &g_402f12;
goto LABEL_400dfb;
}
v5 = &g_402f11;
LABEL_400dfb:
if ((a0->field_242 & 1) && !(a0->field_242 & 2)) {
a2 = &g_402f15;
goto LABEL_400e2f;
}
a2 = &g_402f11;
LABEL_400e2f:
if ((a0->field_242 & 1) && (a0->field_242 & 2)) {
*(&v3) = "enabled";
goto LABEL_400e63;
}
*(&v3) = &g_402f11;
LABEL_400e63:
printf(" UDP checksum: %s%s%s%s\n", v3, a2, v5, a1);
}
}
}
close_json_object();
v7 = *(&v1) ^ v6[5];
return;
} | iproute2-6.0.0 | angr_phoenix |
void sh_free(mem, file, line) void *mem;
const char *file;
int line;
{
internal_free(mem, file, line, 0x01);
} | unsigned long sh_free(char *a1, char *a2, unsigned int a3) {
return internal_free(a1, a2, a3);
} | bash | ida |
static void print_link_event(FILE *f, __u32 event) {
if (event >= (sizeof(link_events) / sizeof((link_events)[0])))
print_int(PRINT_ANY, "event", "event %d ", event);
else {
if (event)
print_string(PRINT_ANY, "event", "event %s ", link_events[event]);
}
} | void print_link_event(undefined8 param_1, uint param_2)
{
if (param_2 < 7) {
if (param_2 != 0) {
print_string(4, "event", "event %s ",
*(undefined8 *)(link_events + (ulong)param_2 * 8));
}
} else {
print_int(4, "event", "event %d ", param_2);
}
return;
} | iproute2-6.0.0 | ghidra |
static void shift_boundaries(struct file_data filevec[]) {
int f;
for (f = 0; f < 2; f++) {
char *changed = filevec[f].changed;
char *other_changed = filevec[1 - f].changed;
lin const *equivs = filevec[f].equivs;
lin i = 0;
lin j = 0;
lin i_end = filevec[f].buffered_lines;
while (1) {
lin runlength, start, corresponding;
while (i < i_end && !changed[i]) {
while (other_changed[j++])
continue;
i++;
}
if (i == i_end)
break;
start = i;
while (changed[++i])
continue;
while (other_changed[j])
j++;
do {
runlength = i - start;
while (start && equivs[start - 1] == equivs[i - 1]) {
changed[--start] = 1;
changed[--i] = 0;
while (changed[start - 1])
start--;
while (other_changed[--j])
continue;
}
corresponding = other_changed[j - 1] ? i : i_end;
while (i != i_end && equivs[start] == equivs[i]) {
changed[start++] = 0;
changed[i++] = 1;
while (changed[i])
i++;
while (other_changed[++j])
corresponding = i;
}
} while (runlength != i - start);
while (corresponding < i) {
changed[--start] = 1;
changed[--i] = 0;
while (other_changed[--j])
continue;
}
}
}
} | void shift_boundaries(long param_1)
{
long lVar1;
long lVar2;
long lVar3;
long lVar4;
long lVar5;
char *pcVar6;
long lVar7;
int local_54;
long local_50;
long local_48;
long local_40;
long local_38;
for (local_54 = 0; local_54 < 2; local_54 = local_54 + 1) {
lVar2 = *(long *)(param_1 + (long)local_54 * 0x130 + 0x118);
lVar3 = *(long *)(param_1 + (long)(1 - local_54) * 0x130 + 0x118);
lVar4 = *(long *)(param_1 + (long)local_54 * 0x130 + 0xf8);
local_50 = 0;
local_48 = 0;
lVar5 = *(long *)(param_1 + (long)local_54 * 0x130 + 200);
while (true) {
for (; (local_50 < lVar5 && (*(char *)(lVar2 + local_50) == '\0'));
local_50 = local_50 + 1) {
do {
lVar7 = local_48 + 1;
pcVar6 = (char *)(lVar3 + local_48);
local_48 = lVar7;
} while (*pcVar6 != '\0');
}
if (local_50 == lVar5)
break;
local_40 = local_50;
do {
local_50 = local_50 + 1;
} while (*(char *)(lVar2 + local_50) != '\0');
for (; *(char *)(lVar3 + local_48) != '\0'; local_48 = local_48 + 1) {
}
do {
lVar7 = local_50 - local_40;
while ((local_40 != 0 && (*(long *)(lVar4 + local_40 * 8 + -8) ==
*(long *)(lVar4 + local_50 * 8 + -8)))) {
local_40 = local_40 + -1;
*(undefined *)(lVar2 + local_40) = 1;
local_50 = local_50 + -1;
*(undefined *)(lVar2 + local_50) = 0;
for (; *(char *)(lVar2 + local_40 + -1) != '\0';
local_40 = local_40 + -1) {
}
do {
local_48 = local_48 + -1;
} while (*(char *)(lVar3 + local_48) != '\0');
}
local_38 = lVar5;
if (*(char *)(lVar3 + local_48 + -1) != '\0') {
local_38 = local_50;
}
while ((local_50 != lVar5 && (*(long *)(lVar4 + local_40 * 8) ==
*(long *)(lVar4 + local_50 * 8)))) {
lVar1 = local_40 + 1;
*(undefined *)(lVar2 + local_40) = 0;
*(undefined *)(lVar2 + local_50) = 1;
do {
local_50 = local_50 + 1;
} while (*(char *)(lVar2 + local_50) != '\0');
while (local_48 = local_48 + 1, local_40 = lVar1,
*(char *)(lVar3 + local_48) != '\0') {
local_38 = local_50;
}
}
} while (lVar7 != local_50 - local_40);
while (local_38 < local_50) {
local_40 = local_40 + -1;
*(undefined *)(lVar2 + local_40) = 1;
local_50 = local_50 + -1;
*(undefined *)(lVar2 + local_50) = 0;
do {
local_48 = local_48 + -1;
} while (*(char *)(lVar3 + local_48) != '\0');
}
}
}
return;
} | diffutils | ghidra |
static struct passwd *check_perms(void) {
struct passwd *pw = xgetpwnam(name);
if (((void *)0) == pw) {
(void)fprintf(stderr, gettext("No passwd entry for user '%s'\n"), name);
do {
char *old_locale = setlocale(6, ((void *)0));
char *saved_locale = ((void *)0);
if (((void *)0) != old_locale) {
saved_locale = strdup(old_locale);
}
if (((void *)0) != saved_locale) {
(void)setlocale(6, "C");
}
syslog(5, "No passwd entry for user '%s'", name);
if (((void *)0) != saved_locale) {
(void)setlocale(6, saved_locale);
free(saved_locale);
}
} while (0);
su_failure(caller_tty, 1);
}
(void)signal(2, ((__sighandler_t)1));
(void)signal(3, ((__sighandler_t)1));
check_perms_nopam(pw);
(void)signal(2, ((__sighandler_t)0));
(void)signal(3, ((__sighandler_t)0));
if ('*' == pw->pw_shell[0]) {
subsystem(pw);
endpwent();
endspent();
pw_free(pw);
return check_perms();
}
return pw;
} | int check_perms(unsigned long long a0, unsigned long a1, unsigned long long a2,
unsigned long long a3, unsigned long long a4,
unsigned long long a5) {
void *v0;
struct_0 *v1;
char *v2;
unsigned long v4;
v1 = xgetpwnam(&name);
if (!v1) {
fprintf(stderr, gettext("No passwd entry for user '%s'\n"));
v2 = setlocale(0x6, NULL);
v0 = 0;
if (v2)
v0 = strdup(v2);
if (v0)
setlocale(0x6, "C");
syslog(0x5, "No passwd entry for user '%s'");
if (v0) {
setlocale(0x6, v0);
free(v0);
}
su_failure(caller_tty, 0x1);
} else {
signal(0x2, 0x1);
signal(0x3, 0x1);
check_perms_nopam(v1);
signal(0x2, 0x0);
signal(0x3, 0x0);
if (v1->field_28->field_0 != 42) {
v4 = v1;
return v4;
}
subsystem(v1);
endpwent();
endspent(a0, 0x0, a2, a3, a4, a5);
pw_free(v1);
v4 = check_perms(a0, 0x0, a2, a3, a4, a5);
return v4;
}
} | shadow | angr_sailr |
get_u8(&protocol_version, *argv, 0) == 1))
invarg("version is invalid", *argv);
addattr_l(n, 1024, IFLA_HSR_VERSION, &protocol_version, 1);
}
else if (matches(*argv, "proto") == 0) { | void get_u8(void)
{
halt_baddata();
} | iproute2-6.0.0 | ghidra |
static void alloc_bb_map(e2fsck_t ctx) {
struct problem_context pctx;
clear_problem_context(&pctx);
pctx.errcode =
e2fsck_allocate_inode_bitmap(ctx->fs, (gettext("inode in bad block map")),
2, "inode_bb_map", &ctx->inode_bb_map);
if (pctx.errcode) {
pctx.num = 4;
fix_problem(ctx, 0x010024, &pctx);
ctx->flags |= 0x0001;
return;
}
} | void alloc_bb_map(struct_0 *a0) {
unsigned long v0;
unsigned long long v1;
char v2;
unsigned long long *v4;
unsigned long long v5;
clear_problem_context(&v0);
v0 = e2fsck_allocate_inode_bitmap(a0->field_0,
gettext("inode in bad block map"), 0x2,
"inode_bb_map", &a0[5].field_0 + 4);
if (v0) {
v1 = 4;
fix_problem(a0, 0x10024, &v0);
a0->field_48 = a0->field_48 | 1;
}
v5 = *(&v2) ^ v4[5];
return;
} | e2fsprogs-1.46.5 | angr_sailr |
static void print_rt_pref(FILE *fp, unsigned int pref) {
switch (pref) {
case 0x3:
print_string(PRINT_ANY, "pref", "pref %s", "low");
break;
case 0x0:
print_string(PRINT_ANY, "pref", "pref %s", "medium");
break;
case 0x1:
print_string(PRINT_ANY, "pref", "pref %s", "high");
break;
default:
print_uint(PRINT_ANY, "pref", "%u", pref);
}
} | void print_rt_pref(unsigned long a0, unsigned long a1) {
unsigned long v0;
unsigned long long v2;
unsigned long long v3;
unsigned long long v4;
unsigned long long v5;
v0 = a0;
if (a1 == 3) {
v2 = print_string(0x4, "pref", "pref %s", "low");
} else {
if (a1 <= 3) {
if (!a1) {
v3 = print_string(0x4, "pref", "pref %s", "medium");
goto LABEL_4011e2;
}
if (a1 == 1) {
v4 = print_string(0x4, "pref", "pref %s", "high");
goto LABEL_4011e2;
}
}
v5 = print_uint(0x4, "pref", "%u", a1);
}
LABEL_4011e2:
return;
} | iproute2-6.0.0 | angr_phoenix |
static void start_if_needed(void) {
CHILD *ch;
int delete;
;
for (ch = family; ch; ch = ch->next) {
if (ch->flags & 32)
break;
if (ch->flags & 2)
continue;
delete = 1;
if (strchr(ch->rlevel, runlevel) ||
((ch->flags & 8) && !strchr("#*Ss", runlevel))) {
startup(ch);
delete = 0;
}
if (delete) {
ch->flags &= ~(2 | 32);
if (!((ch->action) == 7 || (ch->action) == 6 || (ch->action) == 8 ||
(ch->action) == 14 || (ch->action) == 9) &&
ch->action != 15)
ch->flags &= ~128;
ch->pid = 0;
} else
if (ch->flags & 32)
break;
}
} | void start_if_needed(void)
{
bool bVar1;
char *pcVar2;
uint *local_10;
for (local_10 = family;
(local_10 != (uint *)0x0 && ((*local_10 & 0x20) == 0));
local_10 = *(uint **)(local_10 + 0x30)) {
if ((*local_10 & 2) == 0) {
bVar1 = true;
pcVar2 = strchr((char *)(local_10 + 9), (int)runlevel);
if ((pcVar2 != (char *)0x0) ||
(((*local_10 & 8) != 0 &&
(pcVar2 = strchr("#*Ss", (int)runlevel), pcVar2 == (char *)0x0)))) {
startup(local_10);
bVar1 = false;
}
if (bVar1) {
*local_10 = *local_10 & 0xffffffdd;
if ((((local_10[0xc] != 7) && (local_10[0xc] != 6)) &&
(local_10[0xc] != 8)) &&
(((local_10[0xc] != 0xe && (local_10[0xc] != 9)) &&
(local_10[0xc] != 0xf)))) {
*local_10 = *local_10 & 0xffffff7f;
}
local_10[2] = 0;
} else if ((*local_10 & 0x20) != 0) {
return;
}
}
}
return;
} | sysvinit | ghidra |
static inline void emit_ancillary_info(char const *program) {
struct infomap {
char const *program;
char const *node;
} const infomap[] = {
{"[", "test invocation"}, {"coreutils", "Multi-call invocation"},
{"sha224sum", "sha2 utilities"}, {"sha256sum", "sha2 utilities"},
{"sha384sum", "sha2 utilities"}, {"sha512sum", "sha2 utilities"},
{((void *)0), ((void *)0)}};
char const *node = program;
struct infomap const *map_prog = infomap;
while (map_prog->program && !(strcmp(program, map_prog->program) == 0))
map_prog++;
if (map_prog->node)
node = map_prog->node;
printf (gettext ("\n%s online help: <%s>\n"), "GNU coreutils", "https:
char const *lc_messages = setlocale (
5
,
((void *)0)
);
if (lc_messages && strncmp (lc_messages, "" "en_" "", sizeof ("en_") - 1))
{
fputs_unlocked (gettext ("Report any translation bugs to " "<https:
stdout
)
;
}
char const *url_program = (strcmp (program, "[") == 0) ? "test" : program;
printf (gettext ("Full documentation <%s%s>\n"),
"https:
printf (gettext ("or available locally via: info '(coreutils) %s%s'\n"),
node, node == program ? " invocation" : "");
} | unsigned long emit_ancillary_info(const char *a1) {
char *v1;
FILE *v2;
char *v3;
const char *v4;
char *v5;
const char *v6;
char *v7;
const char *v9;
long *i;
const char *v11;
const char *v12;
long v13[15];
unsigned long v14;
v14 = __readfsqword(0x28u);
v13[0] = (long)"[";
v13[1] = (long)"test invocation";
v13[2] = (long)"coreutils";
v13[3] = (long)"Multi-call invocation";
v13[4] = (long)"sha224sum";
v13[5] = (long)"sha2 utilities";
v13[6] = (long)"sha256sum";
v13[7] = (long)"sha2 utilities";
v13[8] = (long)"sha384sum";
v13[9] = (long)"sha2 utilities";
v13[10] = (long)"sha512sum";
v13[11] = (long)"sha2 utilities";
v13[12] = 0LL;
v13[13] = 0LL;
v9 = a1;
for (i = v13; *i && strcmp(a1, (const char *)*i); i += 2)
;
if (i[1])
v9 = (const char *)i[1];
v1 = gettext("\n%s online help: <%s>\n");
printf(v1, "GNU coreutils", "https:
v11 = setlocale(5, 0LL);
if ( v11 && strncmp(v11, "en_", 3uLL) )
{
v2 = stdout;
v3 = gettext("Report any translation bugs to <https:
fputs_unlocked(v3, v2);
}
if ( !strcmp(a1, "[") )
v4 = "test";
else
v4 = a1;
v12 = v4;
v5 = gettext("Full documentation <%s%s>\n");
printf(v5, "https:
if ( v9 == a1 )
v6 = " invocation";
else
v6 = locale;
v7 = gettext("or available locally via: info '(coreutils) %s%s'\n");
printf(v7, v9, v6);
return __readfsqword(0x28u) ^ v14;
} | coreutils | ida |
static void time_to_env(char const *envar, struct timespec t) {
char buf[TIMESPEC_STRSIZE_BOUND];
if (setenv(envar, code_timespec(t, buf), 1) != 0)
xalloc_die();
} | void time_to_env(char *a0, unsigned long long a1, unsigned long long a2) {
char v0;
char v1;
unsigned long long *v4;
unsigned long long v5;
if (setenv(a0, code_timespec(a1, a2, &v0, a1), 0x1))
xalloc_die();
v5 = *(&v1) ^ v4[5];
return;
} | tar | angr_dream |
int main(int argc, char **argv) {
int optc;
int n_users;
;
set_program_name(argv[0]);
setlocale(6, "");
bindtextdomain("coreutils", "/usr/local/share/locale");
textdomain("coreutils");
atexit(close_stdout);
while ((optc = getopt_long(argc, argv, "sfwiqbhlp", longopts, ((void *)0))) !=
-1) {
switch (optc) {
case 's':
do_short_format = 1;
break;
case 'l':
do_short_format = 0;
break;
case 'f':
include_heading = 0;
break;
case 'w':
include_fullname = 0;
break;
case 'i':
include_fullname = 0;
include_where = 0;
break;
case 'q':
include_fullname = 0;
include_where = 0;
include_idle = 0;
break;
case 'h':
include_project = 0;
break;
case 'p':
include_plan = 0;
break;
case 'b':
include_home_and_shell = 0;
break;
case GETOPT_HELP_CHAR:
usage(0);
break;
;
case GETOPT_VERSION_CHAR:
version_etc(stdout, "pinky", "GNU coreutils", Version,
("Joseph Arceneaux"), ("David MacKenzie"), ("Kaveh Ghazi"),
(char *)((void *)0));
exit(0);
break;
;
default:
usage(1);
}
}
n_users = argc - optind;
if (!do_short_format && n_users == 0) {
error(0, 0,
gettext("no username specified; at least one must be specified when "
"using -l"));
usage(1);
}
if (do_short_format)
short_pinky("/var/run/utmp", n_users, argv + optind);
else
long_pinky(n_users, argv + optind);
return 0;
} | undefined8 main(int param_1, undefined8 *param_2)
{
int iVar1;
undefined8 uVar2;
set_program_name(*param_2);
setlocale(6, "");
bindtextdomain("coreutils", "/usr/local/share/locale");
textdomain("coreutils");
atexit(p_Ram00000000001013f7);
do {
while (true) {
iVar1 = getopt_long(param_1, param_2, "sfwiqbhlp", longopts, 0);
if (iVar1 == -1) {
param_1 = param_1 - optind;
if ((do_short_format != '\x01') && (param_1 == 0)) {
uVar2 = gettext("no username specified; at least one must be "
"specified when using -l");
error(0, 0, uVar2);
usage(1);
}
if (do_short_format == '\0') {
long_pinky(param_1, param_2 + optind);
} else {
short_pinky("/var/run/utmp", param_1, param_2 + optind);
}
return 0;
}
if (iVar1 < 0x78)
break;
switchD_00101462_caseD_63:
usage();
}
if (iVar1 < 0x62) {
if (iVar1 == -0x83) {
LAB_001014e7:
version_etc(stdout, "pinky", "GNU coreutils", Version,
"Joseph Arceneaux", "David MacKenzie", "Kaveh Ghazi", 0);
exit(0);
}
if (iVar1 == -0x82) {
usage(0);
goto LAB_001014e7;
}
goto switchD_00101462_caseD_63;
}
switch (iVar1) {
case 0x62:
include_home_and_shell = 0;
break;
default:
goto switchD_00101462_caseD_63;
case 0x66:
include_heading = 0;
break;
case 0x68:
include_project = 0;
break;
case 0x69:
include_fullname = 0;
include_where = 0;
break;
case 0x6c:
do_short_format = '\0';
break;
case 0x70:
include_plan = 0;
break;
case 0x71:
include_fullname = 0;
include_where = 0;
include_idle = 0;
break;
case 0x73:
do_short_format = '\x01';
break;
case 0x77:
include_fullname = 0;
}
} while (true);
} | coreutils | ghidra |
void addargs(arglist *args, char *fmt, ...) {
va_list ap;
char *cp;
u_int nalloc;
int r;
__builtin_va_start(ap, fmt);
r = vasprintf(&cp, fmt, ap);
__builtin_va_end(ap);
if (r == -1)
sshfatal("misc.c", __func__, 1072, 1, SYSLOG_LEVEL_FATAL, ((void *)0),
"argument too long");
nalloc = args->nalloc;
if (args->list == ((void *)0)) {
nalloc = 32;
args->num = 0;
} else if (args->num > (256 * 1024))
sshfatal("misc.c", __func__, 1079, 1, SYSLOG_LEVEL_FATAL, ((void *)0),
"too many arguments");
else if (args->num >= args->nalloc)
sshfatal("misc.c", __func__, 1081, 1, SYSLOG_LEVEL_FATAL, ((void *)0),
"arglist corrupt");
else if (args->num + 2 >= nalloc)
nalloc *= 2;
args->list = xrecallocarray(args->list, args->nalloc, nalloc, sizeof(char *));
args->nalloc = nalloc;
args->list[args->num++] = cp;
args->list[args->num] = ((void *)0);
} | long long addargs() {
char *v0;
int tmp_66;
struct_0 *v1;
unsigned int v2;
unsigned int v3;
char v4;
unsigned int v5;
unsigned int v6;
unsigned long v7;
unsigned long v8;
unsigned long v9;
char v10;
unsigned long v11;
unsigned long v12;
unsigned long v13;
unsigned long v14;
int v15;
int v16;
int v17;
int v18;
int v19;
int v20;
int v21;
int v22;
unsigned long long v23;
char v24;
unsigned long v25;
struct_0 *v26;
char *v27;
unsigned long v28;
unsigned long v29;
unsigned long v30;
unsigned long v31;
char v32;
int v33;
int v34;
int v35;
int v36;
int v37;
int v38;
int v39;
int v40;
unsigned long long *v41;
unsigned long long *v42;
v1 = v26;
v0 = v27;
v11 = v28;
v12 = v29;
v13 = v30;
v14 = v31;
if (v32) {
v15 = v33;
v16 = v34;
v17 = v35;
v18 = v36;
v19 = v37;
v20 = v38;
v21 = v39;
v22 = v40;
}
v9 = v41[5];
v5 = 16;
v6 = 48;
v7 = &v25;
v8 = &v10;
v3 = vasprintf(&v4, v0, &v5);
if (v3 == -1)
sshfatal("misc.c", "addargs", 0x430, 0x1, 0x1, 0x0, "argument too long");
v2 = v26->field_c;
if (!v26->field_0) {
v2 = 32;
v26->field_8 = 0;
} else {
if (v26->field_8 > 0x40000) {
v23 = "too many arguments";
sshfatal("misc.c", "addargs", 0x437, 0x1, 0x1, 0x0, *(&v24));
}
if (v26->field_8 >= v26->field_c) {
v23 = "arglist corrupt";
sshfatal("misc.c", "addargs", 0x439, 0x1, 0x1, 0x0, *(&v24));
}
if (v2 <= v26->field_8 + 2)
v2 *= 2;
}
v26->field_0 = xrecallocarray(v26->field_0, v26->field_c, v2, 0x8);
v26->field_c = v2;
v42 = v26->field_0;
tmp_66 = v26->field_8;
v26->field_8 = v26->field_8 + 1;
v42[tmp_66] = *(&v4);
*((v26->field_8 * 8 + v26->field_0)) = 0;
if ((v9 ^ v41[5]))
__stack_chk_fail();
return 0;
} | openssh-portable | angr_sailr |
int auth_activate_options(struct ssh *ssh, struct sshauthopt *opts) {
struct sshauthopt *old = auth_opts;
const char *emsg = ((void *)0);
sshlog("auth.c", __func__, 833, 1, SYSLOG_LEVEL_DEBUG1, ((void *)0),
"setting new authentication options");
if ((auth_opts = sshauthopt_merge(old, opts, &emsg)) == ((void *)0)) {
sshlog("auth.c", __func__, 835, 0, SYSLOG_LEVEL_ERROR, ((void *)0),
"Inconsistent authentication options: %s", emsg);
return -1;
}
return 0;
} | int auth_activate_options(unsigned long a0, unsigned long long a1) {
void *v0;
unsigned long v1;
void *v2;
unsigned long long v3;
unsigned int v5;
v1 = a0;
v3 = auth_opts;
v2 = 0;
sshlog("auth.c", "auth_activate_options", 0x341, 0x1, 0x5, 0x0,
"setting new authentication options");
auth_opts = sshauthopt_merge(v3, a1, &v2, a1);
if (!auth_opts) {
v0 = v2;
sshlog("auth.c", "auth_activate_options", 0x343, 0x0, 0x2, 0x0,
"Inconsistent authentication options: %s");
v5 = -1;
} else {
v5 = 0;
}
return v5;
} | openssh-portable | angr_dream |
static inline void emit_stdin_note(void) {
fputs_unlocked(
gettext("\nWith no FILE, or when FILE is -, read standard input.\n"),
stdout)
;
} | void emit_stdin_note(void)
{
char *__s;
FILE *__stream;
__stream = stdout;
__s = (char *)gettext(
"\nWith no FILE, or when FILE is -, read standard input.\n");
fputs_unlocked(__s, __stream);
return;
} | coreutils | ghidra |
static EFT get_next_format_from_width(const char **pf) {
const char *f;
f = *pf;
if (*f == '.') {
f++;
if (*f == '*') {
do {
*(pf) = (f);
return FMTCHECK_PRECISION;
} while (0);
}
while (((*__ctype_b_loc())[(int)(((unsigned char)*f))] &
(unsigned short int)_ISdigit))
f++;
if (!*f)
do {
*(pf) = (f);
return FMTCHECK_UNKNOWN;
} while (0);
}
do {
*(pf) = (f);
return get_next_format_from_precision(pf);
} while (0);
} | long get_next_format_from_width(_BYTE **a1) {
_BYTE *v2;
v2 = *a1;
if (**a1 != 46)
goto LABEL_8;
if (*++v2 == 42) {
*a1 = v2;
return 23LL;
}
while (((*_ctype_b_loc())[(unsigned char)*v2] & 0x800) != 0)
++v2;
if (*v2) {
LABEL_8:
*a1 = v2;
return get_next_format_from_precision(a1);
} else {
*a1 = v2;
return 25LL;
}
} | libbsd-0.11.7 | ida |
void check_dev_tty() {
int tty_fd;
char *tty;
tty_fd = open("/dev/tty", 02 | 04000);
if (tty_fd < 0) {
tty = (char *)ttyname(fileno(stdin));
if (tty == 0)
return;
tty_fd = open(tty, 02 | 04000);
}
if (tty_fd >= 0)
close(tty_fd);
} | int check_dev_tty() {
char *v0;
int v1;
int fd;
LODWORD(v0) = open("/dev/tty", 2050);
fd = (int)v0;
if ((int)v0 < 0) {
v1 = fileno(stdin);
v0 = ttyname(v1);
if (!v0)
return (int)v0;
LODWORD(v0) = open(v0, 2050);
fd = (int)v0;
}
if (fd >= 0)
LODWORD(v0) = close(fd);
return (int)v0;
} | bash | ida |
static void usage(void) {
fprintf(stderr, "%s, %s\n",
"OpenSSH_9.1"
"p1",
OpenSSL_version(0));
fprintf(stderr,
"usage: sshd [-46DdeiqTt] [-C connection_spec] [-c host_cert_file]\n"
" [-E log_file] [-f config_file] [-g login_grace_time]\n"
" [-h host_key_file] [-o option] [-p port] [-u len]\n");
exit(1);
} | void usage() {
fprintf(stderr, "%s, %s\n", &g_407605, OpenSSL_version(0x0));
fprintf(stderr,
"usage: sshd [-46DdeiqTt] [-C connection_spec] [-c host_cert_file]\n "
" [-E log_file] [-f config_file] [-g login_grace_time]\n "
" [-h host_key_file] [-o option] [-p port] [-u len]\n");
exit(0x1);
} | openssh-portable | angr_phoenix |
static void default_bzfree(void *opaque, void *addr) {
if (addr != ((void *)0))
free(addr);
} | void default_bzfree(long a1, void *a2) {
if (a2)
free(a2);
} | bzip2 | ida |
1
)
{
n_read = safe_read(fd, tmp->buffer, 8192);
if (n_read == 0 || n_read == ((size_t)-1))
break;
tmp->nbytes = n_read;
*read_pos += n_read;
tmp->nlines = 0;
tmp->next = ((void *)0);
{
char const *buffer_end = tmp->buffer + n_read;
char const *p = tmp->buffer;
while ((p = memchr(p, line_end, buffer_end - p))) {
++p;
++tmp->nlines;
}
}
total_lines += tmp->nlines;
if (tmp->nbytes + last->nbytes < 8192) {
memcpy(&last->buffer[last->nbytes], tmp->buffer, tmp->nbytes);
last->nbytes += tmp->nbytes;
last->nlines += tmp->nlines;
} else {
last = last->next = tmp;
if (total_lines - first->nlines > n_lines) {
tmp = first;
total_lines -= first->nlines;
first = first->next;
} else
tmp = xmalloc(sizeof(LBUFFER));
}
} | void safe_read(void)
{
halt_baddata();
} | coreutils | ghidra |
(fs->super->s_mnt_count >=
(unsigned) fs->super->s_max_mnt_count)) {
reason = (gettext(" has been mounted %u times without being checked"));
reason_arg = fs->super->s_mnt_count;
if (batt &&
(fs->super->s_mnt_count < (unsigned)fs->super->s_max_mnt_count * 2))
reason = 0;
} else if (!broken_system_clock && fs->super->s_checkinterval && | ((*(int *)(*(long *)(local_b0 + 0x20) + 0x44) != 0 &&
(param_1[0x69] < (long)local_b8)))) {
local_c8 = gettext(
" has filesystem last checked time in the future");
if (local_cc != 0) {
local_c8 = 0;
}
} | e2fsprogs-1.46.5 | ghidra |
void __attribute__((visibility("hidden"))) gz_error(state, err,
msg) gz_statep state;
int err;
const char *msg;
{
if (state->msg != ((void *)0)) {
if (state->err != (-4))
free(state->msg);
state->msg = ((void *)0);
}
if (err != 0 && err != (-5))
state->x.have = 0;
state->err = err;
if (msg == ((void *)0))
return;
if (err == (-4))
return;
if ((state->msg = (char *)malloc(strlen(state->path) + strlen(msg) + 3)) ==
((void *)0)) {
state->err = (-4);
return;
}
(void)snprintf(state->msg, strlen(state->path) + strlen(msg) + 3, "%s%s%s",
state->path, ": ", msg);
} | void gz_error(struct_0 *a0, unsigned long a1, char *a2) {
struct_0 *v1;
struct_0 *v2;
unsigned long long v3;
if (a0->field_78) {
if (a0->field_74 != -0x4)
free(a0->field_78);
a0->field_78 = 0;
}
if (a1 && a1 != -5)
a0->field_0 = 0;
v1 = a0;
a0->field_74 = a1;
if (a2 && a1 != -0x4) {
a0->field_78 = malloc(strlen(a2) + strlen(a0->field_20) + 3);
if (!a0->field_78) {
v2 = a0;
a0->field_74 = -0x4;
} else {
v3 = snprintf(a0->field_78, strlen(a2) + strlen(a0->field_20) + 3,
"%s%s%s", a0->field_20, &g_400e9b, a2);
}
}
return;
} | zlib | angr_dream |
gnutls_x509_crq_t load_request(common_info_st *info) {
gnutls_x509_crq_t crq;
int ret;
gnutls_datum_t dat;
size_t size;
if (!info->request)
return ((void *)0);
ret = gnutls_x509_crq_init(&crq);
if (ret < 0) {
fprintf(stderr, "crq_init: %s\n", gnutls_strerror(ret));
app_exit(1);
}
dat.data = (void *)_gnutls_read_file(info->request, 0x1, &size);
dat.size = size;
if (!dat.data) {
fprintf(stderr, "error reading file at --load-request: %s\n",
info->request);
app_exit(1);
}
ret = gnutls_x509_crq_import(crq, &dat, info->incert_format);
if (ret == -207) {
fprintf(stderr, "import error: could not find a valid PEM header\n");
app_exit(1);
}
free(dat.data);
if (ret < 0) {
fprintf(stderr, "error importing certificate request: %s: %s\n",
info->request, gnutls_strerror(ret));
app_exit(1);
}
return crq;
} | long long load_request(struct_0 *a0) {
unsigned int v0;
char v1;
char v2;
void *v3;
unsigned int v4;
unsigned long long v6;
if (!a0->field_30) {
v6 = 0;
} else {
v0 = gnutls_x509_crq_init(&v1);
if (v0 < 0) {
fprintf(stderr, "crq_init: %s\n", gnutls_strerror(v0));
app_exit(0x1);
}
v3 = _gnutls_read_file(a0->field_30, 0x1, &v2);
v4 = *(&v2);
if (!v3) {
fprintf(stderr, "error reading file at --load-request: %s\n",
a0->field_30);
app_exit(0x1);
}
v0 = gnutls_x509_crq_import(*(&v1), &v3, a0->field_1c, &v3);
if (v0 == -207) {
fprintf(stderr, "import error: could not find a valid PEM header\n");
app_exit(0x1);
}
free(v3);
if (v0 < 0) {
fprintf(stderr, "error importing certificate request: %s: %s\n",
a0->field_30, gnutls_strerror(v0));
app_exit(0x1);
}
v6 = *(&v1);
}
return v6;
} | gnutls | angr_dream |
static int iproute_flush_cache(void) {
int len;
int flush_fd = open("/proc/sys/net/ipv4/route/flush", 01);
char *buffer = "-1";
if (flush_fd < 0) {
fprintf(stderr, "Cannot open \"%s\": %s\n",
"/proc/sys/net/ipv4/route/flush", strerror((*__errno_location())));
return -1;
}
len = strlen(buffer);
if ((write(flush_fd, (void *)buffer, len)) < len) {
fprintf(stderr, "Cannot flush routing cache\n");
close(flush_fd);
return -1;
}
close(flush_fd);
return 0;
} | void iproute_flush_cache(unsigned long a0, unsigned long a1, unsigned long a2) {
unsigned int v0;
unsigned int v1;
unsigned long long v2;
unsigned long long v4;
void *v5;
unsigned long long v6;
v0 = open64("/proc/sys/net/ipv4/route/flush", 0x1, a2);
v2 = "-1";
if (v0 < 0) {
fprintf(*(&stderr), "Cannot open \"%s\": %s\n", &g_40a748,
strerror(*(__errno_location())));
v4 = 4294967295;
return;
}
v1 = strlen(v2);
if (write(v0, v2, v1) < v1) {
fprintf(*(&stderr), "Cannot flush routing cache\n");
close(v0);
v6 = 4294967295;
return;
}
close(v0);
v5 = 0;
return;
} | iproute2-6.0.0 | angr_sailr |
static void next_file_name(void) {
static size_t *sufindex;
static size_t outbase_length;
static size_t outfile_length;
static size_t addsuf_length;
if (!outfile) {
_Bool widen;
new_name:
widen = !!outfile_length;
if (!widen) {
outbase_length = strlen(outbase);
addsuf_length = additional_suffix ? strlen(additional_suffix) : 0;
outfile_length = outbase_length + suffix_length + addsuf_length;
} else {
outfile_length += 2;
suffix_length++;
}
if (outfile_length + 1 < outbase_length)
xalloc_die();
outfile = xrealloc(outfile, outfile_length + 1);
if (!widen)
memcpy(outfile, outbase, outbase_length);
else {
outfile[outbase_length] = suffix_alphabet[sufindex[0]];
outbase_length++;
}
outfile_mid = outfile + outbase_length;
memset(outfile_mid, suffix_alphabet[0], suffix_length);
if (additional_suffix)
memcpy(outfile_mid + suffix_length, additional_suffix, addsuf_length);
outfile[outfile_length] = 0;
free(sufindex);
sufindex = xcalloc(suffix_length, sizeof *sufindex);
if (numeric_suffix_start) {
((void)sizeof((!widen) ? 1 : 0), __extension__({
if (!widen)
;
else
__assert_fail("! widen", "src/split.c", 409,
__extension__ __PRETTY_FUNCTION__);
}));
size_t i = strlen(numeric_suffix_start);
memcpy(outfile_mid + suffix_length - i, numeric_suffix_start, i);
size_t *sufindex_end = sufindex + suffix_length;
while (i-- != 0)
*--sufindex_end = numeric_suffix_start[i] - '0';
}
} else {
size_t i = suffix_length;
while (i-- != 0) {
sufindex[i]++;
if (suffix_auto && i == 0 && !suffix_alphabet[sufindex[0] + 1])
goto new_name;
outfile_mid[i] = suffix_alphabet[sufindex[i]];
if (outfile_mid[i])
return;
sufindex[i] = 0;
outfile_mid[i] = suffix_alphabet[sufindex[i]];
}
((!!sizeof(struct {
_Static_assert(1, "verify_expr ("
"1"
", "
"(error (1, 0, gettext (\"output file suffixes "
"exhausted\")), assume (false))"
")");
int _gl_dummy;
}))
? ((error(1, 0, gettext("output file suffixes exhausted")),
((0) ? (void)0 : __builtin_unreachable())))
: ((error(1, 0, gettext("output file suffixes exhausted")),
((0) ? (void)0 : __builtin_unreachable()))));
}
} | void next_file_name(void)
{
size_t sVar1;
undefined8 uVar2;
bool bVar3;
size_t local_20;
long *local_18;
size_t local_10;
if (outfile == (void *)0x0) {
LAB_001008ff:
bVar3 = outfile_length_5985 != 0;
if (bVar3) {
outfile_length_5985 = outfile_length_5985 + 2;
suffix_length = suffix_length + 1;
} else {
outbase_length_5984 = strlen(outbase);
if (additional_suffix == (char *)0x0) {
addsuf_length_5986 = 0;
} else {
addsuf_length_5986 = strlen(additional_suffix);
}
outfile_length_5985 =
addsuf_length_5986 + outbase_length_5984 + suffix_length;
}
if (outfile_length_5985 + 1U < outbase_length_5984) {
xalloc_die();
}
outfile = (void *)xrealloc(outfile);
if (bVar3) {
*(undefined *)(outbase_length_5984 + (long)outfile) =
suffix_alphabet[*sufindex_5983];
outbase_length_5984 = outbase_length_5984 + 1;
} else {
memcpy(outfile, outbase, outbase_length_5984);
}
outfile_mid = (void *)(outbase_length_5984 + (long)outfile);
memset(outfile_mid, (int)(char)*suffix_alphabet, suffix_length);
if (additional_suffix != (char *)0x0) {
memcpy((void *)(suffix_length + (long)outfile_mid), additional_suffix,
addsuf_length_5986);
}
*(undefined *)(outfile_length_5985 + (long)outfile) = 0;
free(sufindex_5983);
sufindex_5983 = (long *)xcalloc(suffix_length, 8);
if (numeric_suffix_start != (char *)0x0) {
if (bVar3) {
__assert_fail("! widen", "src/split.c", 0x199, "next_file_name");
}
local_20 = strlen(numeric_suffix_start);
memcpy((void *)((long)outfile_mid + (suffix_length - local_20)),
numeric_suffix_start, local_20);
local_18 = sufindex_5983 + suffix_length;
while (local_20 != 0) {
local_18 = local_18 + -1;
*local_18 = (long)(numeric_suffix_start[local_20 - 1] + -0x30);
local_20 = local_20 - 1;
}
}
} else {
local_10 = suffix_length;
while (sVar1 = local_10 - 1, local_10 != 0) {
sufindex_5983[sVar1] = sufindex_5983[sVar1] + 1;
if (((suffix_auto != '\0') && (sVar1 == 0)) &&
(suffix_alphabet[*sufindex_5983 + 1] == '\0'))
goto LAB_001008ff;
*(undefined *)(sVar1 + (long)outfile_mid) =
suffix_alphabet[sufindex_5983[sVar1]];
if (*(char *)(sVar1 + (long)outfile_mid) != '\0') {
return;
}
sufindex_5983[sVar1] = 0;
*(undefined *)(sVar1 + (long)outfile_mid) =
suffix_alphabet[sufindex_5983[sVar1]];
local_10 = sVar1;
}
uVar2 = gettext("output file suffixes exhausted");
error(1, 0, uVar2);
}
return;
} | coreutils | ghidra |
static void list_entries_users(size_t n, const STRUCT_UTMP *this) {
char **u = xnmalloc(n, sizeof *u);
size_t i;
size_t n_entries = 0;
while (n--) {
if ((((this)->ut_user)[0] &&
(((this)->ut_type == (7)) || (0 && ((this)->ut_tv.tv_sec) != 0)))) {
char *trimmed_name;
trimmed_name = extract_trimmed_name(this);
u[n_entries] = trimmed_name;
++n_entries;
}
this++;
}
qsort(u, n_entries, sizeof(u[0]), userid_compare);
for (i = 0; i < n_entries; i++) {
char c = (i < n_entries - 1 ? ' ' : '\n');
fputs_unlocked(u[i], stdout);
putchar_unlocked(c);
}
for (i = 0; i < n_entries; i++)
free(u[i]);
free(u);
} | void list_entries_users(long a1, long a2) {
char v3;
long v5;
char v6;
unsigned long i;
size_t j;
size_t nmemb;
_QWORD *base;
v5 = a1;
base = (_QWORD *)xnmalloc(a1, 8LL);
nmemb = 0LL;
while (v5--) {
if (*(_BYTE *)(a2 + 44) && *(_WORD *)a2 == 7)
base[nmemb++] = extract_trimmed_name(a2);
a2 += 384LL;
}
qsort(base, nmemb, 8uLL, (__compar_fn_t)userid_compare);
for (i = 0LL; i < nmemb; ++i) {
if (i >= nmemb - 1)
v3 = 10;
else
v3 = 32;
v6 = v3;
fputs_unlocked((const char *)base[i], stdout);
putchar_unlocked(v6);
}
for (j = 0LL; j < nmemb; ++j)
free((void *)base[j]);
free(base);
} | coreutils | ida |
acl_t acl_dup(acl_t acl) {
acl_entry_obj *entry_obj_p, *dup_entry_obj_p;
acl_obj *acl_obj_p = ((acl_obj *)__ext2int_and_check(acl, (0x712C)));
acl_obj *dup_obj_p;
if (!acl_obj_p)
return ((void *)0);
dup_obj_p = __acl_init_obj(acl_obj_p->i.a_used);
if (!dup_obj_p)
return ((void *)0);
for ((entry_obj_p) = (acl_obj_p)->i.a_next;
(entry_obj_p) != (acl_entry_obj *)(acl_obj_p);
(entry_obj_p) = (entry_obj_p)->i.e_next) {
dup_entry_obj_p = __acl_create_entry_obj(dup_obj_p);
if (dup_entry_obj_p == ((void *)0))
goto fail;
dup_entry_obj_p->i.e_entry.e_tag = entry_obj_p->i.e_entry.e_tag;
dup_entry_obj_p->i.e_entry.e_id = entry_obj_p->i.e_entry.e_id;
dup_entry_obj_p->i.e_entry.e_perm = entry_obj_p->i.e_entry.e_perm;
}
return ((dup_obj_p) ? &(dup_obj_p)->i : ((void *)0));
fail:
__acl_free_acl_obj(dup_obj_p);
return ((void *)0);
} | long long acl_dup(unsigned long long a0) {
struct_0 *v0;
int tmp_41;
unsigned long long v1[7];
unsigned long long v2;
struct_1 *v3;
void *v5;
unsigned long long v6;
v1[0] = __ext2int_and_check(a0, 0x712c);
if (!v1) {
v5 = 0;
return v5;
}
v2 = __acl_init_obj(v1[6]);
if (!v2) {
v5 = 0;
return v5;
}
for (v0 = v1[2]; v0 != v1; v0 = v0->field_10) {
v3 = __acl_create_entry_obj(v2);
if (!v3) {
__acl_free_acl_obj(v2);
v5 = 0;
return v5;
}
v3->field_20 = v0->field_20;
tmp_41 = v0->field_30;
v3->field_28 = v0->field_28;
v3->field_30 = tmp_41;
v6 = v0->field_40;
v3->field_38 = v0->field_38;
v3->field_40 = v6;
}
v5 = (!v2 ? v2 + 8 : 0);
return v5;
} | acl-2.3.1 | angr_sailr |
ext2fs_bg_free_blocks_count(fs, i) <
fs->super->s_blocks_per_group) {
super = ext2fs_block_bitmap_loc(fs, i);
err = mark_bmap(ra_map, super);
if (err)
break;
} | void ext2fs_bg_free_blocks_count(void)
{
halt_baddata();
} | e2fsprogs-1.46.5 | ghidra |
static void divertdb_write(void) {
char *dbname;
struct atomic_file *file;
struct fsys_hash_iter *iter;
struct fsys_namenode *namenode;
dbname = dpkg_db_get_path("diversions");
file = atomic_file_new(dbname, ATOMIC_FILE_BACKUP);
atomic_file_open(file);
iter = fsys_hash_iter_new();
while ((namenode = fsys_hash_iter_next(iter))) {
struct fsys_diversion *d = namenode->divert;
if (d == ((void *)0) || d->useinstead == ((void *)0))
continue;
fprintf(file->fp, "%s\n%s\n%s\n", d->useinstead->divert->camefrom->name,
d->useinstead->name, diversion_pkg_name(d));
}
fsys_hash_iter_free(iter);
atomic_file_sync(file);
atomic_file_close(file);
atomic_file_commit(file);
atomic_file_free(file);
free(dbname);
} | void divertdb_write(unsigned long long a0, unsigned long a1,
unsigned long long a2, unsigned long long a3,
unsigned long long a4, unsigned long long a5) {
void *v0;
struct_0 *v1;
unsigned long long v2;
struct_0 *v3;
unsigned long long *v4[4];
unsigned long long v6;
v0 = dpkg_db_get_path("diversions");
v1 = atomic_file_new(v0, 0x1);
atomic_file_open(v1);
v2 = fsys_hash_iter_new(a0, 0x1, a2, a3, a4, a5);
while (true) {
do {
do {
v3 = fsys_hash_iter_next(v2);
if (!v3) {
fsys_hash_iter_free(v2);
atomic_file_sync(v1);
atomic_file_close(v1);
atomic_file_commit(v1);
atomic_file_free(v1);
v6 = free(v0);
return;
}
} while ((v4 = v3->field_18, !v4));
} while (!*(v4));
fprintf(v1->field_18, "%s\n%s\n%s\n", *((*(((*(v4))[3] + 8)) + 8)),
(*(v4))[1], diversion_pkg_name(v4));
}
} | dpkg | angr_sailr |
static int do_switch(void *arg) {
char *netns = arg;
vrf_reset();
return netns_switch(netns);
} | long long do_switch(unsigned long long a0) {
vrf_reset();
return netns_switch(a0);
} | iproute2-6.0.0 | angr_phoenix |
void strmode(mode_t mode, char *p) {
switch (mode & 0170000) {
case 0040000:
*p++ = 'd';
break;
case 0020000:
*p++ = 'c';
break;
case 0060000:
*p++ = 'b';
break;
case 0100000:
*p++ = '-';
break;
case 0120000:
*p++ = 'l';
break;
case 0140000:
*p++ = 's';
break;
case 0010000:
*p++ = 'p';
break;
default:
*p++ = '?';
break;
}
if (mode & 0400)
*p++ = 'r';
else
*p++ = '-';
if (mode & 0200)
*p++ = 'w';
else
*p++ = '-';
switch (mode & (0100 | 04000)) {
case 0:
*p++ = '-';
break;
case 0100:
*p++ = 'x';
break;
case 04000:
*p++ = 'S';
break;
case 0100 | 04000:
*p++ = 's';
break;
}
if (mode & (0400 >> 3))
*p++ = 'r';
else
*p++ = '-';
if (mode & (0200 >> 3))
*p++ = 'w';
else
*p++ = '-';
switch (mode & ((0100 >> 3) | 02000)) {
case 0:
*p++ = '-';
break;
case (0100 >> 3):
*p++ = 'x';
break;
case 02000:
*p++ = 'S';
break;
case (0100 >> 3) | 02000:
*p++ = 's';
break;
}
if (mode & ((0400 >> 3) >> 3))
*p++ = 'r';
else
*p++ = '-';
if (mode & ((0200 >> 3) >> 3))
*p++ = 'w';
else
*p++ = '-';
switch (mode & (((0100 >> 3) >> 3) | 01000)) {
case 0:
*p++ = '-';
break;
case ((0100 >> 3) >> 3):
*p++ = 'x';
break;
case 01000:
*p++ = 'T';
break;
case ((0100 >> 3) >> 3) | 01000:
*p++ = 't';
break;
}
*p++ = ' ';
*p = '\0';
} | void strmode(uint param_1, undefined *param_2)
{
undefined *puVar1;
uint uVar2;
undefined *local_18;
uVar2 = param_1 & 0xf000;
if (uVar2 == 0xc000) {
*param_2 = 0x73;
goto LAB_00100110;
}
if (uVar2 < 0xc001) {
if (uVar2 == 0xa000) {
*param_2 = 0x6c;
goto LAB_00100110;
}
if (uVar2 < 0xa001) {
if (uVar2 == 0x8000) {
*param_2 = 0x2d;
goto LAB_00100110;
}
if (uVar2 < 0x8001) {
if (uVar2 == 0x6000) {
*param_2 = 0x62;
goto LAB_00100110;
}
if (uVar2 < 0x6001) {
if (uVar2 == 0x4000) {
*param_2 = 100;
goto LAB_00100110;
}
if (uVar2 < 0x4001) {
if (uVar2 == 0x1000) {
*param_2 = 0x70;
goto LAB_00100110;
}
if (uVar2 == 0x2000) {
*param_2 = 99;
goto LAB_00100110;
}
}
}
}
}
}
*param_2 = 0x3f;
LAB_00100110:
local_18 = param_2 + 1;
if ((param_1 & 0x100) == 0) {
*local_18 = 0x2d;
} else {
*local_18 = 0x72;
}
local_18 = param_2 + 2;
if ((param_1 & 0x80) == 0) {
*local_18 = 0x2d;
} else {
*local_18 = 0x77;
}
local_18 = param_2 + 3;
uVar2 = param_1 & 0x840;
if (uVar2 == 0x840) {
*local_18 = 0x73;
local_18 = param_2 + 4;
} else if (uVar2 < 0x841) {
if (uVar2 == 0x800) {
*local_18 = 0x53;
local_18 = param_2 + 4;
} else if (uVar2 < 0x801) {
if (uVar2 == 0) {
*local_18 = 0x2d;
local_18 = param_2 + 4;
} else if (uVar2 == 0x40) {
*local_18 = 0x78;
local_18 = param_2 + 4;
}
}
}
puVar1 = local_18;
if ((param_1 & 0x20) == 0) {
*local_18 = 0x2d;
} else {
*local_18 = 0x72;
}
local_18 = local_18 + 1;
if ((param_1 & 0x10) == 0) {
*local_18 = 0x2d;
} else {
*local_18 = 0x77;
}
local_18 = puVar1 + 2;
uVar2 = param_1 & 0x408;
if (uVar2 == 0x408) {
*local_18 = 0x73;
local_18 = puVar1 + 3;
} else if (uVar2 < 0x409) {
if (uVar2 == 0x400) {
*local_18 = 0x53;
local_18 = puVar1 + 3;
} else if (uVar2 < 0x401) {
if (uVar2 == 0) {
*local_18 = 0x2d;
local_18 = puVar1 + 3;
} else if (uVar2 == 8) {
*local_18 = 0x78;
local_18 = puVar1 + 3;
}
}
}
puVar1 = local_18;
if ((param_1 & 4) == 0) {
*local_18 = 0x2d;
} else {
*local_18 = 0x72;
}
local_18 = local_18 + 1;
if ((param_1 & 2) == 0) {
*local_18 = 0x2d;
} else {
*local_18 = 0x77;
}
local_18 = puVar1 + 2;
param_1 = param_1 & 0x201;
if (param_1 == 0x201) {
*local_18 = 0x74;
local_18 = puVar1 + 3;
} else if (param_1 < 0x202) {
if (param_1 == 0x200) {
*local_18 = 0x54;
local_18 = puVar1 + 3;
} else if (param_1 < 0x201) {
if (param_1 == 0) {
*local_18 = 0x2d;
local_18 = puVar1 + 3;
} else if (param_1 == 1) {
*local_18 = 0x78;
local_18 = puVar1 + 3;
}
}
}
*local_18 = 0x20;
local_18[1] = 0;
return;
} | libbsd-0.11.7 | ghidra |
static inline char const *suffix_power_char(unsigned int power) {
switch (power) {
case 0:
return "";
case 1:
return "K";
case 2:
return "M";
case 3:
return "G";
case 4:
return "T";
case 5:
return "P";
case 6:
return "E";
case 7:
return "Z";
case 8:
return "Y";
default:
return "(error)";
}
} | short *suffix_power_char(int a1) {
short *result;
switch (a1) {
case 0:
result = (short *)locale;
break;
case 1:
result = aKmgtpezy;
break;
case 2:
result = &aKmgtpezy[1];
break;
case 3:
result = &aKmgtpezy[2];
break;
case 4:
result = &aKmgtpezy[3];
break;
case 5:
result = &aKmgtpezy[4];
break;
case 6:
result = &aKmgtpezy[5];
break;
case 7:
result = &aKmgtpezy[6];
break;
case 8:
result = &aKmgtpezy[7];
break;
default:
result = (short *)"(error)";
break;
}
return result;
} | coreutils | ida |
gnutls_privkey_t load_ca_private_key(common_info_st *info) {
gnutls_privkey_t key;
gnutls_datum_t dat;
size_t size;
if (info->ca_privkey == ((void *)0)) {
fprintf(stderr, "missing --load-ca-privkey\n");
app_exit(1);
}
if (gnutls_url_is_supported(info->ca_privkey) != 0)
return _load_url_privkey(info->ca_privkey);
dat.data = (void *)_gnutls_read_file(info->ca_privkey, 0x1, &size);
dat.size = size;
if (!dat.data) {
fprintf(stderr, "error reading file at --load-ca-privkey: %s\n",
info->ca_privkey);
app_exit(1);
}
key = _load_privkey(&dat, info);
free(dat.data);
return key;
} | long load_ca_private_key(long a1) {
long v2;
long privkey;
void *ptr;
int v5;
unsigned long v6;
v6 = __readfsqword(0x28u);
if (!*(_QWORD *)(a1 + 80)) {
fprintf(stderr, "missing --load-ca-privkey\n");
app_exit(1LL);
}
if ((unsigned int)gnutls_url_is_supported(*(_QWORD *)(a1 + 80)))
return load_url_privkey(*(const char **)(a1 + 80));
ptr = (void *)gnutls_read_file(*(_QWORD *)(a1 + 80), 1LL, &v2);
v5 = v2;
if (!ptr) {
fprintf(stderr, "error reading file at --load-ca-privkey: %s\n",
*(const char **)(a1 + 80));
app_exit(1LL);
}
privkey = load_privkey((long)&ptr, a1);
free(ptr);
return privkey;
} | gnutls | ida |
void progcomp_dispose() {
if (prog_completes)
hash_dispose(prog_completes);
prog_completes = (HASH_TABLE *)((void *)0);
} | void progcomp_dispose(void)
{
if (prog_completes != 0) {
hash_dispose(prog_completes);
}
prog_completes = 0;
return;
} | bash | ghidra |
static inline void emit_ancillary_info(char const *program) {
struct infomap {
char const *program;
char const *node;
} const infomap[] = {
{"[", "test invocation"}, {"coreutils", "Multi-call invocation"},
{"sha224sum", "sha2 utilities"}, {"sha256sum", "sha2 utilities"},
{"sha384sum", "sha2 utilities"}, {"sha512sum", "sha2 utilities"},
{((void *)0), ((void *)0)}};
char const *node = program;
struct infomap const *map_prog = infomap;
while (map_prog->program && !(strcmp(program, map_prog->program) == 0))
map_prog++;
if (map_prog->node)
node = map_prog->node;
printf (gettext ("\n%s online help: <%s>\n"), "GNU coreutils", "https:
char const *lc_messages = setlocale (
5
,
((void *)0)
);
if (lc_messages && strncmp (lc_messages, "" "en_" "", sizeof ("en_") - 1))
{
fputs_unlocked (gettext ("Report any translation bugs to " "<https:
stdout
)
;
}
char const *url_program = (strcmp (program, "[") == 0) ? "test" : program;
printf (gettext ("Full documentation <%s%s>\n"),
"https:
printf (gettext ("or available locally via: info '(coreutils) %s%s'\n"),
node, node == program ? " invocation" : "");
} | void emit_ancillary_info(char *param_1)
{
FILE *__stream;
int iVar1;
char *pcVar2;
char *pcVar3;
long in_FS_OFFSET;
char *local_b8;
char **local_b0;
char *local_98;
char *local_90;
char *local_88;
char *local_80;
char *local_78;
char *local_70;
char *local_68;
char *local_60;
char *local_58;
char *local_50;
char *local_48;
char *local_40;
undefined8 local_38;
undefined8 local_30;
long local_20;
local_20 = *(long *)(in_FS_OFFSET + 0x28);
local_98 = "[";
local_90 = "test invocation";
local_88 = "coreutils";
local_80 = "Multi-call invocation";
local_78 = "sha224sum";
local_70 = "sha2 utilities";
local_68 = "sha256sum";
local_60 = "sha2 utilities";
local_58 = "sha384sum";
local_50 = "sha2 utilities";
local_48 = "sha512sum";
local_40 = "sha2 utilities";
local_38 = 0;
local_30 = 0;
local_b0 = &local_98;
while ((*local_b0 != (char *)0x0 &&
(iVar1 = strcmp(param_1, *local_b0), iVar1 != 0))) {
local_b0 = local_b0 + 2;
}
local_b8 = param_1;
if (local_b0[1] != (char *)0x0) {
local_b8 = local_b0[1];
}
pcVar2 = (char *)gettext("\n%s online help: <%s>\n");
printf(pcVar2,"GNU coreutils","https:
pcVar2 = setlocale(5,(char *)0x0);
if ((pcVar2 != (char *)0x0) && (iVar1 = strncmp(pcVar2,"en_",3), __stream = stdout, iVar1 != 0)) {
pcVar2 = (char *)gettext("Report any translation bugs to <https:
);
fputs_unlocked(pcVar2, __stream);
}
iVar1 = strcmp(param_1,"[");
pcVar2 = param_1;
if (iVar1 == 0) {
pcVar2 = "test";
}
pcVar3 = (char *)gettext("Full documentation <%s%s>\n");
printf(pcVar3,"https:
if (local_b8 == param_1) {
pcVar2 = " invocation";
}
else {
pcVar2 = "";
}
pcVar3 = (char *)gettext("or available locally via: info \'(coreutils) %s%s\'\n");
printf(pcVar3,local_b8,pcVar2);
if (local_20 == *(long *)(in_FS_OFFSET + 0x28)) {
return;
}
__stack_chk_fail();
} | coreutils | ghidra |
static _Bool
install_file_in_file(char const *from, char const *to, int to_dirfd,
char const *to_relname, const struct cp_options *x) {
struct stat from_sb;
if (x->preserve_timestamps && stat(from, &from_sb) != 0) {
error(0, (*__errno_location()), gettext("cannot stat %s"),
quotearg_style(shell_escape_always_quoting_style, from));
return 0;
}
if (!copy_file(from, to, to_dirfd, to_relname, x))
return 0;
if (strip_files)
if (!strip(to)) {
if (unlinkat(to_dirfd, to_relname, 0) != 0)
((!!sizeof(struct {
_Static_assert(
1, "verify_expr ("
"1"
", "
"(error (1, (*__errno_location ()), gettext (\"cannot unlink "
"%s\"), quotearg_style (shell_escape_always_quoting_style, "
"to)), assume (false))"
")");
int _gl_dummy;
}))
? ((error(1, (*__errno_location()), gettext("cannot unlink %s"),
quotearg_style(shell_escape_always_quoting_style, to)),
((0) ? (void)0 : __builtin_unreachable())))
: ((error(1, (*__errno_location()), gettext("cannot unlink %s"),
quotearg_style(shell_escape_always_quoting_style, to)),
((0) ? (void)0 : __builtin_unreachable()))));
return 0;
}
if (x->preserve_timestamps &&
(strip_files || !((((from_sb.st_mode)) & 0170000) == (0100000))) &&
!change_timestamps(&from_sb, to, to_dirfd, to_relname))
return 0;
return change_attributes(to, to_dirfd, to_relname);
} | long install_file_in_file(const char *a1, const char *a2, unsigned int a3,
const char *a4, long a5) {
long v5;
char *v6;
int *v7;
long v9;
char *v10;
int *v11;
struct stat v15;
unsigned long v16;
v16 = __readfsqword(0x28u);
if (*(_BYTE *)(a5 + 31) && stat(a1, &v15)) {
v5 = quotearg_style(4LL, a1);
v6 = gettext("cannot stat %s");
v7 = _errno_location();
error(0, *v7, v6, v5);
return 0LL;
} else if ((unsigned char)copy_file(a1, (long)a2, a3, a4, a5) != 1) {
return 0LL;
} else if (strip_files && (unsigned char)strip((long)a2) != 1) {
if (unlinkat(a3, a4, 0)) {
v9 = quotearg_style(4LL, a2);
v10 = gettext("cannot unlink %s");
v11 = _errno_location();
error(1, *v11, v10, v9);
}
return 0LL;
} else if (*(_BYTE *)(a5 + 31) &&
(strip_files || (v15.st_mode & 0xF000) != 0x8000) &&
(unsigned char)change_timestamps((long)&v15, (long)a2, a3, a4) !=
1) {
return 0LL;
} else {
return change_attributes(a2, a3, (long)a4);
}
} | coreutils | ida |
WORD_LIST *expand_word_leave_quoted(word, quoted)
WORD_DESC *word;
int quoted;
{
WORD_LIST *result;
expand_no_split_dollar_star = 1;
if (ifs_is_null)
word->flags |= (1 << 4);
word->flags |= (1 << 6);
result = call_expand_word_internal(word, quoted, 0, (int *)((void *)0),
(int *)((void *)0));
expand_no_split_dollar_star = 0;
return result;
} | undefined8 expand_word_leave_quoted(long param_1, undefined4 param_2)
{
undefined8 uVar1;
expand_no_split_dollar_star = 1;
if (ifs_is_null != 0) {
*(uint *)(param_1 + 8) = *(uint *)(param_1 + 8) | 0x10;
}
*(uint *)(param_1 + 8) = *(uint *)(param_1 + 8) | 0x40;
uVar1 = call_expand_word_internal(param_1, param_2, 0, 0, 0);
expand_no_split_dollar_star = 0;
return uVar1;
} | bash | ghidra |
static BUCKET_CONTENTS *copy_bucket_array(ba, cpdata)
BUCKET_CONTENTS *ba;
sh_string_func_t *cpdata;
{
BUCKET_CONTENTS *new_bucket, *n, *e;
if (ba == 0)
return ((BUCKET_CONTENTS *)0);
for (n = (BUCKET_CONTENTS *)0, e = ba; e; e = e->next) {
if (n == 0) {
new_bucket = (BUCKET_CONTENTS *)sh_xmalloc((sizeof(BUCKET_CONTENTS)),
"hashlib.c", 104);
n = new_bucket;
} else {
n->next = (BUCKET_CONTENTS *)sh_xmalloc((sizeof(BUCKET_CONTENTS)),
"hashlib.c", 109);
n = n->next;
}
n->key = (char *)strcpy(sh_xmalloc((1 + strlen(e->key)), "hashlib.c", 113),
(e->key));
n->data = e->data
? (cpdata ? (*cpdata)(e->data)
: (char *)strcpy(sh_xmalloc((1 + strlen(e->data)),
"hashlib.c", 114),
(e->data)))
: ((void *)0);
n->khash = e->khash;
n->times_found = e->times_found;
n->next = (BUCKET_CONTENTS *)((void *)0);
}
return new_bucket;
} | long copy_bucket_array(long *a1, long (*a2)(long)) {
const char *v3;
size_t v4;
char *v5;
char *v6;
const char *v7;
size_t v8;
char *v9;
long v10;
long v11;
long *i;
if (!a1)
return 0LL;
v11 = 0LL;
for (i = a1; i; i = (long *)*i) {
if (v11) {
*(_QWORD *)v11 = sh_xmalloc(32LL, "hashlib.c", 109LL);
v11 = *(_QWORD *)v11;
} else {
v10 = sh_xmalloc(32LL, "hashlib.c", 104LL);
v11 = v10;
}
v3 = (const char *)i[1];
v4 = strlen(v3);
v5 = (char *)sh_xmalloc(v4 + 1, "hashlib.c", 113LL);
*(_QWORD *)(v11 + 8) = strcpy(v5, v3);
if (i[2]) {
if (a2) {
v6 = (char *)a2(i[2]);
} else {
v7 = (const char *)i[2];
v8 = strlen(v7);
v9 = (char *)sh_xmalloc(v8 + 1, "hashlib.c", 114LL);
v6 = strcpy(v9, v7);
}
} else {
v6 = 0LL;
}
*(_QWORD *)(v11 + 16) = v6;
*(_DWORD *)(v11 + 24) = *((_DWORD *)i + 6);
*(_DWORD *)(v11 + 28) = *((_DWORD *)i + 7);
*(_QWORD *)v11 = 0LL;
}
return v10;
} | bash | ida |
int e2fsck_reconnect_file(e2fsck_t ctx, ext2_ino_t ino) {
ext2_filsys fs = ctx->fs;
errcode_t retval;
char name[80];
struct problem_context pctx;
struct ext2_inode inode;
int file_type = 0;
clear_problem_context(&pctx);
pctx.ino = ino;
if (!ctx->bad_lost_and_found && !ctx->lost_and_found) {
if (e2fsck_get_lost_and_found(ctx, 1) == 0)
ctx->bad_lost_and_found++;
}
if (ctx->bad_lost_and_found) {
fix_problem(ctx, 0x030006, &pctx);
return 1;
}
sprintf(name, "#%u", ino);
if (ext2fs_read_inode(fs, ino, &inode) == 0)
file_type = ext2_file_type(inode.i_mode);
retval = ext2fs_link(fs, ctx->lost_and_found, name, ino, file_type);
if (retval == (2133571366L)) {
if (!fix_problem(ctx, 0x030002, &pctx))
return 1;
retval = e2fsck_expand_directory(ctx, ctx->lost_and_found, 1, 0);
if (retval) {
pctx.errcode = retval;
fix_problem(ctx, 0x030007, &pctx);
return 1;
}
retval = ext2fs_link(fs, ctx->lost_and_found, name, ino, file_type);
}
if (retval) {
pctx.errcode = retval;
fix_problem(ctx, 0x030008, &pctx);
return 1;
}
e2fsck_adjust_inode_count(ctx, ino, 1);
return 0;
} | int e2fsck_reconnect_file(struct_0 *a0, unsigned long a1) {
unsigned int v0;
unsigned long v1;
unsigned long long v2;
unsigned long v3;
unsigned int v4;
char v5;
char v6;
unsigned int v8;
v2 = a0->field_0;
v0 = 0;
clear_problem_context(&v3);
v4 = a1;
if (!a0->field_22c && !a0->field_228 && !e2fsck_get_lost_and_found(a0, 0x1))
a0->field_22c = a0->field_22c + 1;
if (a0->field_22c) {
fix_problem(a0, 0x30006, &v3);
v8 = 1;
} else {
sprintf(&v6, "#%u", a1);
if (!ext2fs_read_inode(v2, a1, &v5, a1))
v0 = ext2_file_type(*(&v5));
v1 = ext2fs_link(v2, a0->field_228, &v6, a1, v0);
if (v1 == 2133571366) {
if (!fix_problem(a0, 0x30002, &v3)) {
v8 = 1;
goto LABEL_401a6e;
}
v1 = e2fsck_expand_directory(a0, a0->field_228, 0x1, 0x0);
if (v1) {
v3 = v1;
fix_problem(a0, 0x30007, &v3);
v8 = 1;
goto LABEL_401a6e;
} else {
v1 = ext2fs_link(v2, a0->field_228, &v6, a1, v0);
}
}
if (v1) {
v3 = v1;
fix_problem(a0, 0x30008, &v3);
v8 = 1;
} else {
e2fsck_adjust_inode_count(a0, a1, 0x1);
v8 = 0;
}
}
LABEL_401a6e:
return v8;
} | e2fsprogs-1.46.5 | angr_phoenix |
int xvasprintf(char **, const char *, va_list) __attribute__((__nonnull__(2)));
const char *ssh_err(int n);
typedef enum {
SYSLOG_FACILITY_DAEMON,
SYSLOG_FACILITY_USER,
SYSLOG_FACILITY_AUTH,
SYSLOG_FACILITY_LOCAL0,
SYSLOG_FACILITY_LOCAL1,
SYSLOG_FACILITY_LOCAL2,
SYSLOG_FACILITY_LOCAL3,
SYSLOG_FACILITY_LOCAL4,
SYSLOG_FACILITY_LOCAL5,
SYSLOG_FACILITY_LOCAL6,
SYSLOG_FACILITY_LOCAL7,
SYSLOG_FACILITY_NOT_SET = -1
} SyslogFacility; | long xvasprintf(char **a1, const char *a2, void *a3) {
int v4;
v4 = vasprintf(a1, a2, a3);
if (v4 < 0 || !*a1)
sshfatal("xmalloc.c", "xvasprintf", 104LL, 0LL, 1LL, 0LL,
"xvasprintf: could not allocate memory");
return (unsigned int)v4;
} | openssh-portable | ida |
static _Bool
parse_noignore_race(const struct parser_table *entry, char **argv,
int *arg_ptr) {
options.ignore_readdir_race = 0;
return parse_noop(entry, argv, arg_ptr);
} | long parse_noignore_race() {
BYTE6(options[1]) = 0;
return parse_noop();
} | findutils | ida |
static void add_user(const char *user, const struct group *grp) {
struct group *newgrp;
if (is_on_list(grp->gr_mem, user)) {
fprintf(stderr, gettext("%s: user '%s' is already a member of '%s'\n"),
Prog, user, grp->gr_name);
fail_exit(7);
}
newgrp = __gr_dup(grp);
if (((void *)0) == newgrp) {
fprintf(stderr, gettext("%s: Out of memory. Cannot update %s.\n"), Prog,
gr_dbname());
fail_exit(13);
}
newgrp->gr_mem = add_list(newgrp->gr_mem, user);
if (is_shadowgrp) {
const struct sgrp *sg = sgr_locate(newgrp->gr_name);
struct sgrp *newsg;
if (((void *)0) == sg) {
static struct sgrp sgrent;
sgrent.sg_name = xstrdup(newgrp->gr_name);
sgrent.sg_mem = dup_list(newgrp->gr_mem);
sgrent.sg_adm = (char **)xmalloc(sizeof(char *));
{
sgrent.sg_adm[0] = ((void *)0);
}
sgrent.sg_passwd = newgrp->gr_passwd;
newgrp->gr_passwd = "x";
newsg = &sgrent;
} else {
newsg = __sgr_dup(sg);
if (((void *)0) == newsg) {
fprintf(stderr, gettext("%s: Out of memory. Cannot update %s.\n"), Prog,
sgr_dbname());
fail_exit(13);
}
newsg->sg_mem = add_list(newsg->sg_mem, user);
}
if (sgr_update(newsg) == 0) {
fprintf(stderr, gettext("%s: failed to prepare the new %s entry '%s'\n"),
Prog, sgr_dbname(), newsg->sg_name);
fail_exit(13);
}
}
if (gr_update(newgrp) == 0) {
fprintf(stderr, gettext("%s: failed to prepare the new %s entry '%s'\n"),
Prog, gr_dbname(), newgrp->gr_name);
fail_exit(13);
}
} | void add_user(undefined8 param_1, undefined8 *param_2)
{
char cVar1;
int iVar2;
char *pcVar3;
undefined8 *puVar4;
undefined8 uVar5;
undefined8 uVar6;
long lVar7;
undefined8 uVar8;
undefined1 *local_40;
cVar1 = is_on_list(param_2[3], param_1);
uVar6 = Prog;
if (cVar1 != '\0') {
uVar5 = *param_2;
pcVar3 = (char *)gettext("%s: user \'%s\' is already a member of \'%s\'\n");
fprintf(stderr, pcVar3, uVar6, param_1, uVar5);
fail_exit(7);
}
puVar4 = (undefined8 *)__gr_dup(param_2);
if (puVar4 == (undefined8 *)0x0) {
uVar5 = gr_dbname();
uVar6 = Prog;
pcVar3 = (char *)gettext("%s: Out of memory. Cannot update %s.\n");
fprintf(stderr, pcVar3, uVar6, uVar5);
fail_exit(0xd);
}
uVar6 = add_list(puVar4[3], param_1);
puVar4[3] = uVar6;
if (is_shadowgrp != '\0') {
lVar7 = sgr_locate(*puVar4);
if (lVar7 == 0) {
sgrent_5662._0_8_ = xstrdup(*puVar4);
sgrent_5662._24_8_ = dup_list(puVar4[3]);
sgrent_5662._16_8_ = (undefined8 *)xmalloc(8);
*sgrent_5662._16_8_ = 0;
sgrent_5662._8_8_ = puVar4[1];
puVar4[1] = &DAT_00101756;
local_40 = sgrent_5662;
} else {
local_40 = (undefined1 *)__sgr_dup(lVar7);
if ((undefined8 *)local_40 == (undefined8 *)0x0) {
uVar5 = sgr_dbname();
uVar6 = Prog;
pcVar3 = (char *)gettext("%s: Out of memory. Cannot update %s.\n");
fprintf(stderr, pcVar3, uVar6, uVar5);
fail_exit(0xd);
}
uVar6 = add_list(*(undefined8 *)((long)local_40 + 0x18), param_1);
*(undefined8 *)((long)local_40 + 0x18) = uVar6;
}
iVar2 = sgr_update(local_40);
if (iVar2 == 0) {
uVar6 = *(undefined8 *)local_40;
uVar8 = sgr_dbname();
uVar5 = Prog;
pcVar3 =
(char *)gettext("%s: failed to prepare the new %s entry \'%s\'\n");
fprintf(stderr, pcVar3, uVar5, uVar8, uVar6);
fail_exit(0xd);
}
}
iVar2 = gr_update(puVar4);
if (iVar2 == 0) {
uVar6 = *puVar4;
uVar8 = gr_dbname();
uVar5 = Prog;
pcVar3 = (char *)gettext("%s: failed to prepare the new %s entry \'%s\'\n");
fprintf(stderr, pcVar3, uVar5, uVar8, uVar6);
fail_exit(0xd);
}
return;
} | shadow | ghidra |
static enum RCH_status restricted_chown(int cwd_fd, char const *file,
struct stat const *orig_st, uid_t uid,
gid_t gid, uid_t required_uid,
gid_t required_gid) {
enum RCH_status status = RC_ok;
struct stat st;
int open_flags = 04000 | 0400;
int fd;
if (required_uid == (uid_t)-1 && required_gid == (gid_t)-1)
return RC_do_ordinary_chown;
if (!((((orig_st->st_mode)) & 0170000) == (0100000))) {
if (((((orig_st->st_mode)) & 0170000) == (0040000)))
open_flags |= 0200000;
else
return RC_do_ordinary_chown;
}
fd = openat(cwd_fd, file, 00 | open_flags);
if (!(0 <= fd || ((*__errno_location()) == 13 &&
((((orig_st->st_mode)) & 0170000) == (0100000))
&& 0 <= (fd = openat(cwd_fd, file, 01 | open_flags)))))
return ((*__errno_location()) == 13 ? RC_do_ordinary_chown : RC_error);
if (fstat(fd, &st) != 0)
status = RC_error;
else if (!((*orig_st).st_ino == (st).st_ino &&
(*orig_st).st_dev == (st).st_dev))
status = RC_inode_changed;
else if ((required_uid == (uid_t)-1 || required_uid == st.st_uid) &&
(required_gid == (gid_t)-1 || required_gid == st.st_gid)) {
if (fchown(fd, uid, gid) == 0) {
status = (close(fd) == 0 ? RC_ok : RC_error);
return status;
} else {
status = RC_error;
}
}
int saved_errno = (*__errno_location());
close(fd);
(*__errno_location()) = saved_errno;
return status;
} | int restricted_chown(unsigned long a0, unsigned long long a1, struct_0 *a2,
unsigned long a3, unsigned long a4, unsigned long a5,
unsigned int v8) {
unsigned int v0;
unsigned int v1;
unsigned int v2;
unsigned int v3;
char v4;
char v5;
char v6;
char v7;
unsigned int v9;
unsigned int v12;
v0 = 2;
v1 = 0x900;
if (a5 == -1 && v8 == -1) {
v9 = 5;
goto LABEL_400708;
}
if ((a2->field_18 & 0xf000) != 0x8000) {
if ((a2->field_18 & 0xf000) != 0x4000) {
v9 = 5;
goto LABEL_400708;
} else {
v1 |= 0x10000;
}
}
v2 = openat(a0, a1, v1, a1);
if (v2 >= 0) {
LABEL_4005ff:
if (fstat(v2, &v4)) {
v0 = 6;
goto LABEL_4006db;
}
if (a2->field_8 != *(&v5)) {
LABEL_400656:
v0 = 4;
goto LABEL_4006db;
} else {
if (!(a2->field_0 == *(&v4)))
goto LABEL_400656;
if (a5 != -1 && !(a5 == *(&v6)))
goto LABEL_4006db;
if (v8 != -1 && !(v8 == *(&v7)))
goto LABEL_4006db;
if (fchown(v2, a3, a4)) {
v0 = 6;
} else {
if (close(v2))
v12 = 6;
else
v12 = 2;
v0 = v12;
v9 = v0;
goto LABEL_400708;
}
LABEL_4006db:
v3 = *(__errno_location());
close(v2);
*(__errno_location()) = v3;
v9 = v0;
}
} else {
if (*(__errno_location()) == 13 && (a2->field_18 & 0xf000) == 0x8000) {
v2 = openat(a0, a1, v1 | 1, a1);
if (v2 < 0)
goto LABEL_4005df;
goto LABEL_4005ff;
}
LABEL_4005df:
if (*(__errno_location()) == 13)
v9 = 5;
else
v9 = 6;
}
LABEL_400708:
return v9;
} | coreutils | angr_phoenix |
static int statdb_node_remove(const char *filename) {
struct fsys_namenode *file;
file = fsys_hash_find_node(filename, FHFF_NONE);
if (!file || !file->statoverride)
return 0;
file->statoverride = ((void *)0);
return 1;
} | int statdb_node_remove(unsigned long long a0) {
struct_0 *v0;
unsigned int v2;
v0 = fsys_hash_find_node(a0, 0x2);
if (!v0) {
LABEL_40032e:
v2 = 0;
} else {
if (!v0->field_20)
goto LABEL_40032e;
v0->field_20 = 0;
v2 = 1;
}
return v2;
} | dpkg | angr_phoenix |
static _Bool
parse_mindepth(const struct parser_table *entry, char **argv, int *arg_ptr) {
return insert_depthspec(entry, argv, arg_ptr, &options.mindepth);
} | long long parse_mindepth(unsigned long long a0, unsigned long long a1,
unsigned long long a2) {
return insert_depthspec(a0, a1, a2, 0x500010);
} | findutils | angr_dream |
rsRetVal modExitIminternal(void) {
rsRetVal iRet = RS_RET_OK;
iRet = llDestroy(&llMsgs);
return iRet;
} | long modExitIminternal() { return (unsigned int)llDestroy(&llMsgs); } | rsyslog-8.2210.0 | ida |
static int connect_to_helper(struct ssh *ssh, const char *name, int port,
int socktype, char *ctype, char *rname,
struct channel_connect *cctx, int *reason,
const char **errmsg) {
struct addrinfo hints;
int gaierr;
int sock = -1;
char strport[32];
if (port == -2) {
struct sockaddr_un *sunaddr;
struct addrinfo *ai;
if (strlen(name) > sizeof(sunaddr->sun_path)) {
sshlog("channels.c", __func__, 4476, 0, SYSLOG_LEVEL_ERROR, ((void *)0),
"%.100s: %.100s", name, strerror(36));
return -1;
}
ai = xmalloc(sizeof(*ai) + sizeof(*sunaddr));
memset(ai, 0, sizeof(*ai) + sizeof(*sunaddr));
ai->ai_addr = (struct sockaddr *)(ai + 1);
ai->ai_addrlen = sizeof(*sunaddr);
ai->ai_family = 1;
ai->ai_socktype = socktype;
ai->ai_protocol = 0;
sunaddr = (struct sockaddr_un *)ai->ai_addr;
sunaddr->sun_family = 1;
strlcpy(sunaddr->sun_path, name, sizeof(sunaddr->sun_path));
cctx->aitop = ai;
} else {
memset(&hints, 0, sizeof(hints));
hints.ai_family = ssh->chanctxt->IPv4or6;
hints.ai_socktype = socktype;
snprintf(strport, sizeof strport, "%d", port);
if ((gaierr = getaddrinfo(name, strport, &hints, &cctx->aitop)) != 0) {
if (errmsg != ((void *)0))
*errmsg = ssh_gai_strerror(gaierr);
if (reason != ((void *)0))
*reason = 2;
sshlog("channels.c", __func__, 4507, 0, SYSLOG_LEVEL_ERROR, ((void *)0),
"connect_to %.100s: unknown host (%s)", name,
ssh_gai_strerror(gaierr));
return -1;
}
}
cctx->host = xstrdup(name);
cctx->port = port;
cctx->ai = cctx->aitop;
if ((sock = connect_next(cctx)) == -1) {
sshlog("channels.c", __func__, 4518, 0, SYSLOG_LEVEL_ERROR, ((void *)0),
"connect to %.100s port %d failed: %s", name, port,
strerror((*__errno_location())));
return -1;
}
return sock;
} | int connect_to_helper(long param_1, char *param_2, uint param_3, int param_4,
undefined8 param_5, undefined8 param_6,
undefined8 *param_7, undefined4 *param_8,
undefined8 *param_9)
{
undefined2 *puVar1;
int iVar2;
size_t sVar3;
char *pcVar4;
void *__s;
int *piVar5;
long in_FS_OFFSET;
undefined8 uVar6;
undefined8 uVar7;
addrinfo local_68;
char local_38[40];
long local_10;
local_10 = *(long *)(in_FS_OFFSET + 0x28);
if (param_3 == 0xfffffffe) {
sVar3 = strlen(param_2);
if (0x6c < sVar3) {
uVar6 = 0x10ebf8;
pcVar4 = strerror(0x24);
sshlog("channels.c", "connect_to_helper", 0x117c, 0, 2, 0,
"%.100s: %.100s", param_2, pcVar4, uVar6);
iVar2 = -1;
goto LAB_0010eec0;
}
__s = (void *)xmalloc(0x9e);
memset(__s, 0, 0x9e);
*(long *)((long)__s + 0x18) = (long)__s + 0x30;
*(undefined4 *)((long)__s + 0x10) = 0x6e;
*(undefined4 *)((long)__s + 4) = 1;
*(int *)((long)__s + 8) = param_4;
*(undefined4 *)((long)__s + 0xc) = 0;
puVar1 = *(undefined2 **)((long)__s + 0x18);
*puVar1 = 1;
strlcpy(puVar1 + 1, param_2, 0x6c);
param_7[3] = __s;
} else {
memset(&local_68, 0, 0x30);
local_68.ai_family = *(int *)(*(long *)(param_1 + 0x868) + 0x9c);
local_68.ai_socktype = param_4;
snprintf(local_38, 0x20, "%d", (ulong)param_3);
iVar2 =
getaddrinfo(param_2, local_38, &local_68, (addrinfo **)(param_7 + 3));
if (iVar2 != 0) {
if (param_9 != (undefined8 *)0x0) {
uVar6 = ssh_gai_strerror(iVar2);
*param_9 = uVar6;
}
if (param_8 != (undefined4 *)0x0) {
*param_8 = 2;
}
uVar7 = 0x10edba;
uVar6 = ssh_gai_strerror(iVar2);
sshlog("channels.c", "connect_to_helper", 0x119b, 0, 2, 0,
"connect_to %.100s: unknown host (%s)", param_2, uVar6, uVar7);
iVar2 = -1;
goto LAB_0010eec0;
}
}
uVar6 = xstrdup(param_2);
*param_7 = uVar6;
*(uint *)(param_7 + 1) = param_3;
param_7[2] = param_7[3];
iVar2 = connect_next();
if (iVar2 == -1) {
piVar5 = __errno_location();
pcVar4 = strerror(*piVar5);
sshlog("channels.c", "connect_to_helper", 0x11a6, 0, 2, 0,
"connect to %.100s port %d failed: %s", param_2, param_3, pcVar4);
iVar2 = -1;
}
LAB_0010eec0:
if (local_10 == *(long *)(in_FS_OFFSET + 0x28)) {
return iVar2;
}
__stack_chk_fail();
} | openssh-portable | ghidra |
static inline _Bool
usable_st_size(struct stat const *sb) {
return (((((sb->st_mode)) & 0170000) == (0100000)) ||
((((sb->st_mode)) & 0170000) == (0120000))
|| ((sb)->st_mode - (sb)->st_mode) || 0);
} | int usable_st_size(struct_0 *a0) {
unsigned int v1;
unsigned int v2;
if ((a0->field_18 & 0xf000) != 0x8000 && (a0->field_18 & 0xf000) != 0xa000)
v1 = 0;
if ((a0->field_18 & 0xf000) == 0xa000 || (a0->field_18 & 0xf000) == 0x8000)
v1 = 1;
v2 = v1 & 1;
return v2;
} | coreutils | angr_dream |
int gzwrite(file, buf, len)
gzFile file;
voidpc buf;
unsigned len;
{
gz_statep state;
if (file == ((void *)0))
return 0;
state = (gz_statep)file;
if (state->mode != 31153 || state->err != 0)
return 0;
if ((int)len < 0) {
gz_error(state, (-3), "requested length does not fit in int");
return 0;
}
return (int)gz_write(state, buf, len);
} | unsigned long gzwrite(long a1, char *a2, unsigned int a3) {
if (!a1)
return 0LL;
if (*(_DWORD *)(a1 + 24) != 31153 || *(_DWORD *)(a1 + 116))
return 0LL;
if ((a3 & 0x80000000) == 0)
return gz_write(a1, a2, a3);
gz_error(a1, 4294967293LL, "requested length does not fit in int");
return 0LL;
} | zlib | ida |
SHELL_VAR *assign_array_var_from_string(var, value, flags)
SHELL_VAR *var;
char *value;
int flags;
{
WORD_LIST *nlist;
if (value == 0)
return var;
nlist = expand_compound_array_assignment(var, value, flags);
assign_compound_array_list(var, nlist, flags);
if (nlist)
dispose_words(nlist);
if (var)
((var)->attributes &= ~(0x0001000));
return (var);
} | void assign_array_var_from_string(unsigned long long a0, unsigned long long a1,
unsigned long a2) {
unsigned long long v0;
int tmp_17;
unsigned long long v2;
unsigned long long v3;
struct_0 *v4;
if (!a1) {
v2 = a0;
} else {
v0 = expand_compound_array_assignment(a0, a1, a2);
assign_compound_array_list(a0, v0, a2);
if (v0)
dispose_words(v0);
if (a0) {
v3 = *((a0 + 40));
*(&v3) = (*((a0 + 40)) >> 8) & 239;
tmp_17 = v3;
*((a0 + 40)) = tmp_17;
}
v4 = a0;
}
return;
} | bash | angr_dream |
int mergesort(void *base, size_t nmemb, size_t size,
int (*cmp)(const void *, const void *)) {
size_t i;
int sense;
int big, iflag;
unsigned char *f1, *f2, *t, *b, *tp2, *q, *l1, *l2;
unsigned char *list2, *list1, *p2, *p, *last, **p1;
if (size < sizeof(unsigned char *) / 2) {
(*__errno_location()) = 22;
return (-1);
}
if (nmemb == 0)
return (0);
iflag = 0;
if (!(size % sizeof(int)) && !(((char *)base - (char *)0) % sizeof(int)))
iflag = 1;
if ((list2 = malloc(nmemb * size + sizeof(unsigned char *))) == ((void *)0))
return (-1);
list1 = base;
setup(list1, list2, nmemb, size, cmp);
last = list2 + nmemb * size;
i = big = 0;
while (
*(unsigned char **)((unsigned char *)0 +
(((unsigned char *)list2 + sizeof(unsigned char *) -
1 - (unsigned char *)0) &
~(sizeof(unsigned char *) - 1))) != last) {
l2 = list1;
p1 = (unsigned char **)((unsigned char *)0 +
(((unsigned char *)list1 + sizeof(unsigned char *) -
1 - (unsigned char *)0) &
~(sizeof(unsigned char *) - 1)));
for (tp2 = p2 = list2; p2 != last;
p1 = (unsigned char **)((unsigned char *)0 +
(((unsigned char *)l2 +
sizeof(unsigned char *) - 1 -
(unsigned char *)0) &
~(sizeof(unsigned char *) - 1)))) {
p2 = *(unsigned char **)((unsigned char *)0 +
(((unsigned char *)p2 + sizeof(unsigned char *) -
1 - (unsigned char *)0) &
~(sizeof(unsigned char *) - 1)));
f1 = l2;
f2 = l1 = list1 + (p2 - list2);
if (p2 != last)
p2 = *(
unsigned char **)((unsigned char *)0 +
(((unsigned char *)p2 + sizeof(unsigned char *) -
1 - (unsigned char *)0) &
~(sizeof(unsigned char *) - 1)));
l2 = list1 + (p2 - list2);
while (f1 < l1 && f2 < l2) {
if ((*cmp)(f1, f2) <= 0) {
q = f2;
b = f1, t = l1;
sense = -1;
} else {
q = f1;
b = f2, t = l2;
sense = 0;
}
if (!big) {
while ((b += size) < t && cmp(q, b) > sense)
if (++i == 6) {
big = 1;
goto EXPONENTIAL;
}
} else {
EXPONENTIAL:
for (i = size;; i <<= 1)
if ((p = (b + i)) >= t) {
if ((p = t - size) > b && (*cmp)(q, p) <= sense)
t = p;
else
b = p;
break;
} else if ((*cmp)(q, p) <= sense) {
t = p;
if (i == size)
big = 0;
goto FASTCASE;
} else
b = p;
while (t > b + size) {
i = (((t - b) / size) >> 1) * size;
if ((*cmp)(q, p = b + i) <= sense)
t = p;
else
b = p;
}
goto COPY;
FASTCASE:
while (i > size)
if ((*cmp)(q, p = b + (i >>= 1)) <= sense)
t = p;
else
b = p;
COPY:
b = t;
}
i = size;
if (q == f1) {
if (iflag) {
do
*(int *)tp2 = *(int *)f2, f2 += sizeof(int), tp2 += sizeof(int);
while (f2 < b);
do
*(int *)tp2 = *(int *)f1, f1 += sizeof(int), tp2 += sizeof(int);
while (i -= sizeof(int));
} else {
do
*tp2++ = *f2++;
while (f2 < b);
do
*tp2++ = *f1++;
while (i -= 1);
}
} else {
if (iflag) {
do
*(int *)tp2 = *(int *)f1, f1 += sizeof(int), tp2 += sizeof(int);
while (f1 < b);
do
*(int *)tp2 = *(int *)f2, f2 += sizeof(int), tp2 += sizeof(int);
while (i -= sizeof(int));
} else {
do
*tp2++ = *f1++;
while (f1 < b);
do
*tp2++ = *f2++;
while (i -= 1);
}
}
}
if (f2 < l2) {
if (iflag)
do
*(int *)tp2 = *(int *)f2, f2 += sizeof(int), tp2 += sizeof(int);
while (f2 < l2);
else
do
*tp2++ = *f2++;
while (f2 < l2);
} else if (f1 < l1) {
if (iflag)
do
*(int *)tp2 = *(int *)f1, f1 += sizeof(int), tp2 += sizeof(int);
while (f1 < l1);
else
do
*tp2++ = *f1++;
while (f1 < l1);
}
*p1 = l2;
}
tp2 = list1;
list1 = list2;
list2 = tp2;
last = list2 + nmemb * size;
}
if (base == list2) {
memmove(list2, list1, nmemb * size);
list2 = list1;
}
free(list2);
return (0);
} | undefined8 mergesort(undefined4 *param_1, long param_2, ulong param_3,
code *param_4)
{
undefined4 *puVar1;
bool bVar2;
bool bVar3;
undefined4 *puVar4;
ulong uVar5;
int iVar6;
int *piVar7;
undefined8 uVar8;
undefined4 *puVar9;
undefined4 *puVar10;
int local_8c;
ulong local_80;
undefined4 *local_78;
undefined4 *local_70;
undefined4 *local_68;
undefined4 *local_60;
undefined4 *local_58;
undefined4 *local_50;
undefined4 *local_48;
undefined4 *local_40;
undefined4 *local_38;
undefined4 *local_30;
undefined4 *local_28;
undefined8 *local_20;
if (param_3 < 4) {
piVar7 = __errno_location();
*piVar7 = 0x16;
uVar8 = 0xffffffff;
} else if (param_2 == 0) {
uVar8 = 0;
} else {
bVar2 = false;
if (((param_3 & 3) == 0) && (((ulong)param_1 & 3) == 0)) {
bVar2 = true;
}
local_40 = (undefined4 *)malloc(param_2 * param_3 + 8);
if (local_40 == (undefined4 *)0x0) {
uVar8 = 0xffffffff;
} else {
setup(param_1, local_40, param_2, param_3, param_4);
bVar3 = false;
local_80 = 0;
local_28 = (undefined4 *)((long)local_40 + param_2 * param_3);
local_38 = param_1;
while (puVar4 = local_38,
local_28 != *(undefined4 **)((ulong)((long)local_40 + 7) &
0xfffffffffffffff8)) {
local_48 = local_38;
local_30 = local_40;
local_58 = local_40;
while (local_20 = (undefined8 *)((ulong)((long)local_48 + 7) &
0xfffffffffffffff8),
local_30 != local_28) {
local_30 = *(undefined4 **)((ulong)((long)local_30 + 7) &
0xfffffffffffffff8);
local_78 = local_48;
puVar9 = (undefined4 *)((long)local_38 +
((long)local_30 - (long)local_40));
if (local_30 != local_28) {
local_30 = *(undefined4 **)((ulong)((long)local_30 + 7) &
0xfffffffffffffff8);
}
local_48 = (undefined4 *)((long)local_38 +
((long)local_30 - (long)local_40));
local_70 = puVar9;
while ((local_78 < puVar9 && (local_70 < local_48))) {
iVar6 = (*param_4)(local_78, local_70);
if (iVar6 < 1) {
local_50 = local_70;
local_60 = local_78;
local_8c = -1;
local_68 = puVar9;
} else {
local_50 = local_78;
local_60 = local_70;
local_8c = 0;
local_68 = local_48;
}
uVar5 = param_3;
if (!bVar3) {
do {
local_60 = (undefined4 *)((long)local_60 + param_3);
if ((local_68 <= local_60) ||
(iVar6 = (*param_4)(local_50, local_60), iVar6 <= local_8c))
goto LAB_00100428;
local_80 = local_80 + 1;
} while (local_80 != 6);
bVar3 = true;
uVar5 = param_3;
}
LAB_00100283:
local_80 = uVar5;
puVar10 = (undefined4 *)(local_80 + (long)local_60);
if (puVar10 < local_68) {
iVar6 = (*param_4)(local_50, puVar10);
if (local_8c < iVar6)
goto LAB_00100335;
local_68 = puVar10;
puVar10 = local_60;
if (local_80 == param_3) {
bVar3 = false;
}
while (local_60 = puVar10, param_3 < local_80) {
local_80 = local_80 >> 1;
puVar10 = (undefined4 *)(local_80 + (long)local_60);
iVar6 = (*param_4)(local_50, puVar10);
if (iVar6 <= local_8c) {
local_68 = puVar10;
puVar10 = local_60;
}
}
} else {
puVar10 = (undefined4 *)((long)local_68 - param_3);
if ((local_60 < puVar10) &&
(iVar6 = (*param_4)(local_50, puVar10), iVar6 <= local_8c)) {
local_68 = puVar10;
puVar10 = local_60;
}
while (local_60 = puVar10,
(undefined4 *)(param_3 + (long)local_60) < local_68) {
puVar10 = (undefined4 *)(param_3 * ((ulong)((long)local_68 -
(long)local_60) /
param_3 >>
1) +
(long)local_60);
iVar6 = (*param_4)(local_50, puVar10);
if (iVar6 <= local_8c) {
local_68 = puVar10;
puVar10 = local_60;
}
}
}
local_60 = local_68;
LAB_00100428:
local_80 = param_3;
if (local_50 == local_78) {
if (bVar2) {
do {
*local_58 = *local_70;
local_70 = local_70 + 1;
local_58 = local_58 + 1;
} while (local_70 < local_60);
do {
*local_58 = *local_78;
local_78 = local_78 + 1;
local_58 = local_58 + 1;
local_80 = local_80 - 4;
} while (local_80 != 0);
} else {
do {
puVar10 = (undefined4 *)((long)local_70 + 1);
puVar1 = (undefined4 *)((long)local_58 + 1);
*(undefined *)local_58 = *(undefined *)local_70;
local_70 = puVar10;
local_58 = puVar1;
} while (puVar10 < local_60);
do {
puVar10 = (undefined4 *)((long)local_78 + 1);
puVar1 = (undefined4 *)((long)local_58 + 1);
*(undefined *)local_58 = *(undefined *)local_78;
local_80 = local_80 - 1;
local_78 = puVar10;
local_58 = puVar1;
} while (local_80 != 0);
}
} else if (bVar2) {
do {
*local_58 = *local_78;
local_78 = local_78 + 1;
local_58 = local_58 + 1;
} while (local_78 < local_60);
do {
*local_58 = *local_70;
local_70 = local_70 + 1;
local_58 = local_58 + 1;
local_80 = local_80 - 4;
} while (local_80 != 0);
} else {
do {
puVar10 = (undefined4 *)((long)local_78 + 1);
puVar1 = (undefined4 *)((long)local_58 + 1);
*(undefined *)local_58 = *(undefined *)local_78;
local_78 = puVar10;
local_58 = puVar1;
} while (puVar10 < local_60);
do {
puVar10 = (undefined4 *)((long)local_70 + 1);
puVar1 = (undefined4 *)((long)local_58 + 1);
*(undefined *)local_58 = *(undefined *)local_70;
local_80 = local_80 - 1;
local_70 = puVar10;
local_58 = puVar1;
} while (local_80 != 0);
}
}
if (local_70 < local_48) {
if (bVar2) {
do {
*local_58 = *local_70;
local_70 = local_70 + 1;
local_58 = local_58 + 1;
} while (local_70 < local_48);
} else {
do {
puVar9 = (undefined4 *)((long)local_70 + 1);
puVar10 = (undefined4 *)((long)local_58 + 1);
*(undefined *)local_58 = *(undefined *)local_70;
local_70 = puVar9;
local_58 = puVar10;
} while (puVar9 < local_48);
}
} else if (local_78 < puVar9) {
if (bVar2) {
do {
*local_58 = *local_78;
local_78 = local_78 + 1;
local_58 = local_58 + 1;
} while (local_78 < puVar9);
} else {
do {
puVar10 = (undefined4 *)((long)local_78 + 1);
puVar1 = (undefined4 *)((long)local_58 + 1);
*(undefined *)local_58 = *(undefined *)local_78;
local_78 = puVar10;
local_58 = puVar1;
} while (puVar10 < puVar9);
}
}
*local_20 = local_48;
}
local_38 = local_40;
local_40 = puVar4;
local_28 = (undefined4 *)((long)puVar4 + param_2 * param_3);
}
if (param_1 == local_40) {
memmove(local_40, local_38, param_2 * param_3);
local_40 = local_38;
}
free(local_40);
uVar8 = 0;
}
}
return uVar8;
LAB_00100335:
uVar5 = local_80 << 1;
local_60 = puVar10;
goto LAB_00100283;
} | libbsd-0.11.7 | ghidra |
) ==
((void *)0)
) {
nsyslog(3, "strdupa(): %s\n",
strerror((*__errno_location())));
return 0;
} | void nsyslog(unsigned long a0, char *a1, unsigned long a2, unsigned long a3,
unsigned long a4, unsigned long a5) {
unsigned int v0;
unsigned int v1;
unsigned long v2;
unsigned long v3;
unsigned long long v4;
char v5;
unsigned long v6;
unsigned long v7;
unsigned long v8;
unsigned long v9;
int v10;
int v11;
int v12;
int v13;
int v14;
int v15;
int v16;
int v17;
unsigned long v18;
char v19;
int v20;
int v21;
int v22;
int v23;
int v24;
int v25;
int v26;
int v27;
unsigned long long *v28;
unsigned long long v29;
v6 = a2;
v7 = a3;
v8 = a4;
v9 = a5;
if (v19) {
v10 = v20;
v11 = v21;
v12 = v22;
v13 = v23;
v14 = v24;
v15 = v25;
v16 = v26;
v17 = v27;
}
v4 = v28[5];
v0 = 16;
v1 = 48;
v2 = &v18;
v3 = &v5;
if (!ttyname(0x0)) {
vsyslog(a0, a1, &v0);
} else {
fprintf(stderr, "%s: ", 612141384);
vfprintf(stderr, a1, &v0);
fprintf(stderr, "\n");
}
v29 = v4 ^ v28[5];
if ((v4 ^ v28[5]))
__stack_chk_fail();
return;
} | sysvinit | angr_sailr |
static char **build_argv(char const *str, int extra_argc, int *argc) {
_Bool dq = 0, sq = 0;
struct splitbuf ss;
ss.argv = xnmalloc(extra_argc + 2, 2 * sizeof *ss.argv);
ss.argc = 1;
ss.half_alloc = extra_argc + 2;
ss.extra_argc = extra_argc;
ss.sep = 1;
ss.argv[ss.argc] = 0;
while (*str) {
char newc = *str;
switch (*str) {
case '\'':
if (dq)
break;
sq = !sq;
check_start_new_arg(&ss);
++str;
continue;
case '"':
if (sq)
break;
dq = !dq;
check_start_new_arg(&ss);
++str;
continue;
case ' ':
case '\t':
case '\n':
case '\v':
case '\f':
case '\r':
if (sq || dq)
break;
ss.sep = 1;
str += strspn(str, " \t\n\v\f\r");
continue;
case '#':
if (!ss.sep)
break;
goto eos;
case '\\':
if (sq && str[1] != '\\' && str[1] != '\'')
break;
newc = *++str;
switch (newc) {
case '"':
case '#':
case '$':
case '\'':
case '\\':
break;
case '_':
if (!dq) {
++str;
ss.sep = 1;
continue;
}
newc = ' ';
break;
case 'c':
if (dq)
((!!sizeof(struct {
_Static_assert(
EXIT_CANCELED,
"verify_expr ("
"EXIT_CANCELED"
", "
"(error (EXIT_CANCELED, 0, gettext (\"'\\\\c' must not appear "
"in double-quoted -S string\")), assume (false))"
")");
int _gl_dummy;
}))
? ((error(
EXIT_CANCELED, 0,
gettext(
"'\\c' must not appear in double-quoted -S string")),
((0) ? (void)0 : __builtin_unreachable())))
: ((error(
EXIT_CANCELED, 0,
gettext(
"'\\c' must not appear in double-quoted -S string")),
((0) ? (void)0 : __builtin_unreachable()))));
goto eos;
case 'f':
newc = '\f';
break;
case 'n':
newc = '\n';
break;
case 'r':
newc = '\r';
break;
case 't':
newc = '\t';
break;
case 'v':
newc = '\v';
break;
case '\0':
((!!sizeof(struct {
_Static_assert(EXIT_CANCELED,
"verify_expr ("
"EXIT_CANCELED"
", "
"(error (EXIT_CANCELED, 0, gettext (\"invalid "
"backslash at end of string in -S\")), assume (false))"
")");
int _gl_dummy;
}))
? ((error(EXIT_CANCELED, 0,
gettext("invalid backslash at end of string in -S")),
((0) ? (void)0 : __builtin_unreachable())))
: ((error(EXIT_CANCELED, 0,
gettext("invalid backslash at end of string in -S")),
((0) ? (void)0 : __builtin_unreachable()))));
default:
((!!sizeof(struct {
_Static_assert(EXIT_CANCELED,
"verify_expr ("
"EXIT_CANCELED"
", "
"(error (EXIT_CANCELED, 0, gettext (\"invalid "
"sequence '\\\\%c' in -S\"), newc), assume (false))"
")");
int _gl_dummy;
}))
? ((error(EXIT_CANCELED, 0,
gettext("invalid sequence '\\%c' in -S"), newc),
((0) ? (void)0 : __builtin_unreachable())))
: ((error(EXIT_CANCELED, 0,
gettext("invalid sequence '\\%c' in -S"), newc),
((0) ? (void)0 : __builtin_unreachable()))));
}
break;
case '$':
if (sq)
break;
{
char *n = extract_varname(str);
if (!n)
((!!sizeof(struct {
_Static_assert(
EXIT_CANCELED,
"verify_expr ("
"EXIT_CANCELED"
", "
"(error (EXIT_CANCELED, 0, gettext (\"only ${VARNAME} "
"expansion is supported, error at: %s\"), str), assume (false))"
")");
int _gl_dummy;
}))
? ((error(EXIT_CANCELED, 0,
gettext("only ${VARNAME} expansion is supported, "
"error at: %s"),
str),
((0) ? (void)0 : __builtin_unreachable())))
: ((error(EXIT_CANCELED, 0,
gettext("only ${VARNAME} expansion is supported, "
"error at: %s"),
str),
((0) ? (void)0 : __builtin_unreachable()))))
;
char *v = getenv(n);
if (v) {
check_start_new_arg(&ss);
do {
if (dev_debug)
fprintf(stderr, "expanding ${%s} into %s\n", n, quote(v));
} while (0);
for (; *v; v++)
splitbuf_append_byte(&ss, *v);
} else
do {
if (dev_debug)
fprintf(stderr, "replacing ${%s} with null string\n", n);
} while (0);
str = strchr(str, '}') + 1;
continue;
}
}
check_start_new_arg(&ss);
splitbuf_append_byte(&ss, newc);
++str;
} | int build_argv(void *a0, unsigned long a1, unsigned int *a2) {
char v0[2];
char v1;
char v2;
char v3;
char *v4;
char *v5;
unsigned long long *v6;
unsigned int v7;
unsigned long v8;
unsigned int v9;
char v10;
*(&v0) = a0;
v1 = 0;
v2 = 0;
v6 = xnmalloc(a1 + 2, 0x10);
v7 = 1;
v8 = a1 + 2;
v9 = a1;
v10 = 1;
v6[v7] = 0;
while (true) {
if (!v0[0]) {
if (!v1 && !v2)
goto LABEL_400e65;
error(0x7d, 0x0, gettext("no terminating quote in -S string"));
}
v3 = v0[0];
if (v0[0] > 39) {
if (!(v0[0] == 92))
goto LABEL_400dfd;
if (v2 && v0[1] != 92 && !(v0[1] == 39))
goto LABEL_400dfd;
*(&v0) = &v0[1];
v3 = v0[0];
if (!v3)
error(0x7d, 0x0, gettext("invalid backslash at end of string in -S"));
if (v3 < 0)
goto LABEL_400ca9;
if (!(v3 <= 118))
goto LABEL_400ca9;
if (v3 < 34)
goto LABEL_400ca9;
switch (v3) {
case 34:
case 35:
case 36:
case 39:
case 92:
break;
case 95:
if (!(v1 ^ 1)) {
v3 = 32;
break;
} else {
*(&v0) = &v0[1];
v10 = 1;
continue;
}
case 99:
if (v1)
error(0x7d, 0x0,
gettext("'\\c' must not appear in double-quoted -S string"));
LABEL_400e65:
splitbuf_append_byte(&v6, 0x0);
*(a2) = v7;
goto LABEL_400e9f;
case 102:
v3 = 12;
break;
case 110:
v3 = 10;
break;
case 114:
v3 = 13;
break;
case 116:
v3 = 9;
break;
case 118:
v3 = 11;
break;
default:
LABEL_400ca9:
error(0x7d, 0x0, gettext("invalid sequence '\\%c' in -S"));
}
goto LABEL_400dfd;
} else {
if (v0[0] < 9)
goto LABEL_400dfd;
switch (v0[0]) {
case 9:
case 10:
case 11:
case 12:
case 13:
case 32:
if (!v2 && !v1) {
v10 = 1;
*(&v0) = &v0[strspn(v0, &g_402b3f)];
continue;
}
break;
case 34:
if (!v2) {
v1 = !(v1);
v1 &= 1;
check_start_new_arg(&v6);
*(&v0) = &v0[1];
continue;
}
break;
case 35:
if (!(!(v10 ^ 1)))
break;
goto LABEL_400e65;
case 36:
if (!v2) {
v5 = extract_varname(v0);
if (!v5)
error(0x7d, 0x0,
gettext(
"only ${VARNAME} expansion is supported, error at: %s"));
v4 = getenv(v5);
if (v4) {
check_start_new_arg(&v6);
if (dev_debug)
fprintf(*(&stderr), "expanding ${%s} into %s\n", v5, quote(v4));
for (; *(v4); v4 += 1) {
splitbuf_append_byte(&v6, *(v4));
}
} else if (dev_debug) {
fprintf(*(&stderr), "replacing ${%s} with null string\n", v5);
}
*(&v0) = strchr(v0, 0x7d) + 1;
continue;
}
case 39:
if (!v1) {
v2 = !(v2);
v2 &= 1;
check_start_new_arg(&v6);
*(&v0) = &v0[1];
continue;
}
break;
default:
LABEL_400dfd:
check_start_new_arg(&v6);
splitbuf_append_byte(&v6, v3);
*(&v0) = &v0[1];
continue;
}
}
}
LABEL_400e9f:
return splitbuf_finishup(&v6);
} | coreutils | angr_phoenix |
static struct sshkey *lookup_key(struct sshkey *k) {
struct pkcs11_keyinfo *ki;
for ((ki) = ((&pkcs11_keylist)->tqh_first); (ki) != ((void *)0);
(ki) = ((ki)->next.tqe_next)) {
sshlog("ssh-pkcs11-helper.c", __func__, 101, 0, SYSLOG_LEVEL_DEBUG1,
((void *)0), "check %s %s %s", sshkey_type(ki->key),
ki->providername, ki->label);
if (sshkey_equal(k, ki->key))
return (ki->key);
}
return (((void *)0));
} | int lookup_key(unsigned long long a0) {
unsigned long v0;
unsigned long long v1;
unsigned int v3;
v1 = 15588516631309289800;
while (true) {
if (v1) {
v0 = *((v1 + 16));
sshlog("ssh-pkcs11-helper.c", "lookup_key", 0x65, 0x0, 0x5, 0x0,
"check %s %s %s", sshkey_type(*(v1)), *((v1 + 8)));
v3 = sshkey_equal(a0, *(v1), *(v1));
if (v3) {
v3 = *(v1);
break;
} else {
v1 = *((v1 + 24));
}
} else {
v3 = 0;
break;
}
}
return v3;
} | openssh-portable | angr_dream |
ifa->ifa_addr->sa_family != af ||
strcmp(ifa->ifa_name, options.bind_interface) != 0)
continue;
switch (ifa->ifa_addr->sa_family) {
case 2:
sa = (struct sockaddr_in *)ifa->ifa_addr;
if (!allow_local &&
sa->sin_addr.s_addr == htonl(((in_addr_t)0x7f000001)))
continue;
if (*rlenp < sizeof(struct sockaddr_in)) {
sshlog("sshconnect.c", __func__, 320, 1, SYSLOG_LEVEL_ERROR,
((void *)0), "v4 addr doesn't fit");
return -1;
}
*rlenp = sizeof(struct sockaddr_in);
memcpy(resultp, sa, *rlenp);
return 0;
case 10:
sa6 = (struct sockaddr_in6 *)ifa->ifa_addr;
v6addr = &sa6->sin6_addr;
if (!allow_local &&
((__extension__({
const struct in6_addr *__a = (const struct in6_addr *)(v6addr);
(__a->__in6_u.__u6_addr32[0] & htonl(0xffc00000)) ==
htonl(0xfe800000);
})) ||
(__extension__({
const struct in6_addr *__a = (const struct in6_addr *)(v6addr);
__a->__in6_u.__u6_addr32[0] == 0 &&
__a->__in6_u.__u6_addr32[1] == 0 &&
__a->__in6_u.__u6_addr32[2] == 0 &&
__a->__in6_u.__u6_addr32[3] == htonl(1);
}))))
continue;
if (*rlenp < sizeof(struct sockaddr_in6)) {
sshlog("sshconnect.c", __func__, 334, 1, SYSLOG_LEVEL_ERROR,
((void *)0), "v6 addr doesn't fit");
return -1;
}
*rlenp = sizeof(struct sockaddr_in6);
memcpy(resultp, sa6, *rlenp);
return 0;
} | int strcmp(char *__s1, char *__s2)
{
halt_baddata();
} | openssh-portable | ghidra |
static int glob1(Char *pattern, Char *pattern_last, _ssh_compat_glob_t *pglob,
struct glob_lim *limitp) {
Char pathbuf[4096];
if (*pattern == '\0')
return (0);
return (glob2(pathbuf, pathbuf + 4096 - 1, pathbuf, pathbuf + 4096 - 1,
pattern, pattern_last, pglob, limitp));
} | int glob1(unsigned short *a0, unsigned long long a1, unsigned long long a2,
unsigned long long a3) {
char v0;
char v1;
char v2;
char v3;
unsigned int v5;
v2 = *(&v2);
v1 = *(&v1);
if (!*(a0))
v5 = 0;
else
v5 = glob2(&v0, &v3, &v0, &v3, a0, a1, a2, a3);
return v5;
} | openssh-portable | angr_phoenix |
static int ipntable_show(int argc, char **argv) {
ipntable_reset_filter();
filter.family = preferred_family;
while (argc > 0) {
if (strcmp(*argv, "dev") == 0) {
do {
argv++;
if (--argc <= 0)
incomplete_command();
} while (0);
if (strcmp("none", *argv) == 0)
filter.index = (-1);
else if ((filter.index = ll_name_to_index(*argv)) == 0)
invarg("\"DEV\" is invalid", *argv);
} else if (strcmp(*argv, "name") == 0) {
do {
argv++;
if (--argc <= 0)
incomplete_command();
} while (0);
filter.name = *argv;
} else
invarg("unknown", *argv);
argc--;
argv++;
}
if (rtnl_neightbldump_req(&rth, preferred_family) < 0) {
perror("Cannot send dump request");
exit(1);
}
new_json_obj(json);
if (rtnl_dump_filter_nc(&rth, print_ntable, stdout, 0) < 0) {
fprintf(stderr, "Dump terminated\n");
exit(1);
}
delete_json_obj();
return 0;
} | long ipntable_show(int a1, const char **a2) {
ipntable_reset_filter();
filter = preferred_family;
while (a1 > 0) {
if (strcmp(*a2, "dev"))
goto LABEL_9;
++a2;
if (--a1 <= 0)
incomplete_command();
if (!strcmp("none", *a2)) {
dword_21A4 = -1;
goto LABEL_14;
}
dword_21A4 = ll_name_to_index(*a2);
if (!dword_21A4) {
invarg("\"DEV\" is invalid", *a2);
LABEL_9:
if (!strcmp(*a2, "name")) {
++a2;
if (--a1 <= 0)
incomplete_command();
s1 = (char *)*a2;
} else {
invarg("unknown", *a2);
}
}
LABEL_14:
--a1;
++a2;
}
if ((int)rtnl_neightbldump_req(&rth, preferred_family) < 0) {
perror("Cannot send dump request");
exit(1);
}
new_json_obj(json);
if ((int)rtnl_dump_filter_nc(&rth, print_ntable, stdout, 0LL) < 0) {
fprintf(stderr, "Dump terminated\n");
exit(1);
}
delete_json_obj();
return 0LL;
} | iproute2-6.0.0 | ida |
1
,
SOCK_STREAM
, 0, pair) == -1) {
sshlog("ssh-sk-client.c", __func__, 73, 0, SYSLOG_LEVEL_ERROR,
((void *)0), "socketpair: %s",
strerror((*__errno_location())));
return -24;
} | void sshlog(void)
{
halt_baddata();
} | openssh-portable | ghidra |
void arc4random_addrandom(unsigned char *dat, int datlen) {
pthread_mutex_lock(&arc4random_mtx);
_rs_stir_if_needed(datlen);
_rs_rekey(dat, datlen);
pthread_mutex_unlock(&arc4random_mtx);
} | void arc4random_addrandom(undefined8 param_1, int param_2)
{
pthread_mutex_lock((pthread_mutex_t *)arc4random_mtx);
_rs_stir_if_needed((long)param_2);
_rs_rekey(param_1, (long)param_2);
pthread_mutex_unlock((pthread_mutex_t *)arc4random_mtx);
return;
} | libbsd-0.11.7 | ghidra |
int el_getc(EditLine *el, char *cp) {
int num_read;
wchar_t wc = 0;
num_read = el_wgetc(el, &wc);
*cp = '\0';
if (num_read <= 0)
return num_read;
num_read = wctob(wc);
if (num_read == (-1)) {
(*__errno_location()) = 34;
return -1;
} else {
*cp = (char)num_read;
return 1;
}
} | long long el_getc(unsigned long long a0, char *a1) {
unsigned int v0;
unsigned int v1;
unsigned long long v3;
v0 = 0;
v1 = el_wgetc(a0, &v0, &v0);
*(a1) = 0;
if (v1 <= 0) {
v3 = v1;
} else {
v1 = wctob(v0);
if (v1 == -1) {
*(__errno_location()) = 34;
v3 = 4294967295;
} else {
*(a1) = v1;
v3 = 1;
}
}
return v3;
} | libedit | angr_dream |
static void display_speed(struct termios *mode, _Bool fancy) {
if (cfgetispeed(mode) == 0 || cfgetispeed(mode) == cfgetospeed(mode))
wrapf(fancy ? "speed %lu baud;" : "%lu\n",
baud_to_value(cfgetospeed(mode)));
else
wrapf(fancy ? "ispeed %lu baud; ospeed %lu baud;" : "%lu %lu\n",
baud_to_value(cfgetispeed(mode)), baud_to_value(cfgetospeed(mode)));
if (!fancy)
current_col = 0;
} | void display_speed(void *a0, unsigned long a1) {
unsigned long v1;
if (!cfgetispeed(a0)) {
LABEL_4032b6:
baud_to_value(cfgetospeed(a0));
wrapf();
} else {
if (cfgetispeed(a0) == cfgetospeed(a0))
goto LABEL_4032b6;
baud_to_value(cfgetospeed(a0));
baud_to_value(cfgetispeed(a0));
wrapf();
}
v1 = a1 ^ 1;
if ((a1 ^ 1))
current_col = 0;
return;
} | coreutils | angr_phoenix |
static void pqdownheap(tree, k) ct_data *tree;
int k;
{
int v = heap[k];
int j = k << 1;
while (j <= heap_len) {
if (j < heap_len && (tree[heap[j + 1]].fc.freq < tree[heap[j]].fc.freq ||
(tree[heap[j + 1]].fc.freq == tree[heap[j]].fc.freq &&
depth[heap[j + 1]] <= depth[heap[j]])))
j++;
if ((tree[v].fc.freq < tree[heap[j]].fc.freq ||
(tree[v].fc.freq == tree[heap[j]].fc.freq &&
depth[v] <= depth[heap[j]])))
break;
heap[k] = heap[j];
k = j;
j <<= 1;
}
heap[k] = v;
} | void pqdownheap(unsigned short *a0, unsigned long a1) {
unsigned int v0;
unsigned int v1;
unsigned int v2;
unsigned long long v5;
v0 = a1;
v2 = heap[v0];
for (v1 = v0 * 2; v1 <= heap_len; v1 *= 2) {
if (v1 < heap_len &&
([D] amd64g_calculate_condition(
0x2 < 64 >, 0x6 < 64 >,
Conv(16->64,
Load(addr = (rdi<8> +
(Conv(32->s64, Load(addr = stack_base - 12,
size = 4, endness = Iend_LE))
<< 0x2 <
8 >)),
size = 2, endness = Iend_LE)),
Conv(
16->64,
Load(addr =
(rdi<8> +
(Conv(32->s64,
Load(addr = ((Conv(32->s64,
Load(addr = stack_base - 16,
size = 4,
endness = Iend_LE))
<< 0x2 <
8 >) +
0x402f00 <
64 >),
size = 4, endness = Iend_LE))
<< 0x2 <
8 >)),
size = 2, endness = Iend_LE)),
cc_ndep<8>) ||
*(heap[1 + v1] + &depth) <= *(heap[v1] + &depth) &&
a0[2 * heap[1 + v1]] == a0[2 * heap[v1]]))
v1 += 1;
if ([D] amd64g_calculate_condition(
0x2 < 64 >, 0x6 < 64 >,
Conv(16->64,
Load(addr = (rdi<8> +
(Conv(32->s64, Load(addr = stack_base - 12,
size = 4, endness = Iend_LE))
<< 0x2 <
8 >)),
size = 2, endness = Iend_LE)),
Conv(16->64,
Load(addr =
(rdi<8> +
(Conv(32->s64,
Load(addr = ((Conv(32->s64,
Load(addr = stack_base - 16,
size = 4,
endness = Iend_LE))
<< 0x2 <
8 >) +
0x402f00 <
64 >),
size = 4, endness = Iend_LE))
<< 0x2 <
8 >)),
size = 2, endness = Iend_LE)),
cc_ndep<8>))
break;
if (!([D] amd64g_calculate_condition(
0x2 < 64 >, 0x6 < 64 >,
Conv(16->64,
Load(addr = (rdi<8> +
(Conv(32->s64, Load(addr = stack_base - 12,
size = 4, endness = Iend_LE))
<< 0x2 <
8 >)),
size = 2, endness = Iend_LE)),
Conv(16->64,
Load(addr =
(rdi<8> +
(Conv(32->s64,
Load(addr = ((Conv(32->s64,
Load(addr = stack_base - 16,
size = 4,
endness = Iend_LE))
<< 0x2 <
8 >) +
0x402f00 <
64 >),
size = 4, endness = Iend_LE))
<< 0x2 <
8 >)),
size = 2, endness = Iend_LE)),
cc_ndep<8>)) &&
a0[2 * v2] == a0[2 * heap[v1]]) {
if (*(v2 + &depth) <= *(heap[v1] + &depth))
break;
}
heap[v0] = heap[v1];
v0 = v1;
}
v5 = v2;
heap[v0] = v2;
return;
} | gzip-1.12 | angr_dream |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.