input stringlengths 26 172k | output stringlengths 18 318k | repo_name stringclasses 23 values | decompiler stringclasses 5 values |
|---|---|---|---|
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 bond_print_stats_attr(struct rtattr *attr, int ifindex) {
struct rtattr *bondtb[(__LINK_XSTATS_TYPE_MAX - 1) + 1];
struct rtattr *i, *list;
const char *ifname = "";
int rem;
parse_rtattr(
bondtb, (__LINK_XSTATS_TYPE_MAX - 1) + 1,
((void *)(((char *)(attr)) +
((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0)))),
((int)((attr)->rta_len) -
((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0))));
if (!bondtb[LINK_XSTATS_TYPE_BOND])
return;
list = bondtb[LINK_XSTATS_TYPE_BOND];
rem = ((int)((list)->rta_len) -
((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0)));
open_json_object(((void *)0));
ifname = ll_index_to_name(ifindex);
print_string(PRINT_ANY, "ifname", "%-16s\n", ifname);
for (i = ((void *)(((char *)(list)) +
((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0))));
((rem) >= (int)sizeof(struct rtattr) &&
(i)->rta_len >= sizeof(struct rtattr) && (i)->rta_len <= (rem));
i = ((rem) -= ((((i)->rta_len) + 4U - 1) & ~(4U - 1)),
(struct rtattr *)(((char *)(i)) +
((((i)->rta_len) + 4U - 1) & ~(4U - 1))))) {
if (xstats_print_attr && i->rta_type != xstats_print_attr)
continue;
switch (i->rta_type) {
case BOND_XSTATS_3AD:
bond_print_3ad_stats(i);
break;
}
break;
}
close_json_object();
} | void bond_print_stats_attr(unsigned short *a0, unsigned long a1) {
unsigned int v0;
unsigned short v1[2];
unsigned long long v2;
unsigned long long v3;
char v4;
char v5;
char v6;
unsigned long long *v8;
unsigned long long v9;
v2 = &g_4040a2;
parse_rtattr(&v4, 0x3, a0 + 2, *(a0)-4);
if (*(&v5)) {
v3 = *(&v5);
v0 = *(v3)-4;
open_json_object(0x0);
v2 = ll_index_to_name(a1);
print_string(0x4, "ifname", "%-16s\n", v2);
for (*(&v1) = v3 + 4; v0 > 3; *(&v1) = v1 + (v1[0] + 3 & 0xfffffffc)) {
if (v1[0] <= 3)
break;
if (v1[0] > 3) {
if (v0 < v1[0])
break;
}
if (xstats_print_attr && v1[1] != xstats_print_attr) {
v0 -= v1[0] + 3 & 0xfffffffc;
continue;
}
if (v1[1] == xstats_print_attr || !xstats_print_attr) {
if (v1[1] == 1)
bond_print_3ad_stats(v1);
break;
}
}
close_json_object();
}
v9 = *(&v6) ^ v8[5];
return;
} | iproute2-6.0.0 | angr_dream |
static int it_init_functions(itp)
ITEMLIST *itp;
{
init_itemlist_from_varlist(itp, all_visible_functions);
return 0;
} | long long it_init_functions(unsigned long long a0) {
init_itemlist_from_varlist(a0, got.all_visible_functions);
return 0;
} | bash | angr_sailr |
void platform_pledge_agent(void) {} | void platform_pledge_agent() { ; } | openssh-portable | ida |
static int client_x11_display_valid(const char *display) {
size_t i, dlen;
if (display == ((void *)0))
return 0;
dlen = strlen(display);
for (i = 0; i < dlen; i++) {
if (!((*__ctype_b_loc())[(int)(((u_char)display[i]))] &
(unsigned short int)_ISalnum) &&
strchr(":/.-_", display[i]) == ((void *)0)) {
sshlog("clientloop.c", __func__, 276, 0, SYSLOG_LEVEL_DEBUG1, ((void *)0),
"Invalid character '%c' in DISPLAY", display[i]);
return 0;
}
}
return 1;
} | undefined8 client_x11_display_valid(char *param_1)
{
undefined8 uVar1;
size_t sVar2;
ushort **ppuVar3;
char *pcVar4;
ulong local_18;
if (param_1 == (char *)0x0) {
uVar1 = 0;
} else {
sVar2 = strlen(param_1);
for (local_18 = 0; local_18 < sVar2; local_18 = local_18 + 1) {
ppuVar3 = __ctype_b_loc();
if ((((*ppuVar3)[(byte)param_1[local_18]] & 8) == 0) &&
(pcVar4 = strchr(":/.-_", (int)param_1[local_18]),
pcVar4 == (char *)0x0)) {
sshlog("clientloop.c", "client_x11_display_valid", 0x114, 0, 5, 0,
"Invalid character \'%c\' in DISPLAY", (int)param_1[local_18]);
return 0;
}
}
uVar1 = 1;
}
return uVar1;
} | openssh-portable | ghidra |
static void save_tty_chars(struct termios *tiop) {
_rl_last_tty_chars = _rl_tty_chars;
_rl_tty_chars.t_eof = tiop->c_cc[4];
_rl_tty_chars.t_eol = tiop->c_cc[11];
_rl_tty_chars.t_eol2 = tiop->c_cc[16];
_rl_tty_chars.t_erase = tiop->c_cc[2];
_rl_tty_chars.t_werase = tiop->c_cc[14];
_rl_tty_chars.t_kill = tiop->c_cc[3];
_rl_tty_chars.t_reprint = tiop->c_cc[12];
_rl_intr_char = _rl_tty_chars.t_intr = tiop->c_cc[0];
_rl_quit_char = _rl_tty_chars.t_quit = tiop->c_cc[1];
_rl_susp_char = _rl_tty_chars.t_susp = tiop->c_cc[10];
_rl_tty_chars.t_start = tiop->c_cc[8];
_rl_tty_chars.t_stop = tiop->c_cc[9];
_rl_tty_chars.t_lnext = tiop->c_cc[15];
_rl_tty_chars.t_flush = tiop->c_cc[13];
} | void save_tty_chars(char a0[34]) {
char v0;
unsigned long long v2;
unsigned long long v3;
_rl_last_tty_chars = *(&_rl_tty_chars);
g_400e28 = *(&g_400e18);
_rl_tty_chars = a0[21];
g_400e11 = a0[28];
g_400e12 = a0[33];
g_400e13 = a0[19];
g_400e14 = a0[31];
g_400e15 = a0[20];
g_400e16 = a0[29];
g_400e17 = a0[17];
_rl_intr_char = g_400e17;
g_400e18 = a0[18];
_rl_quit_char = g_400e18;
g_400e19 = a0[27];
_rl_susp_char = g_400e19;
g_400e1b = a0[25];
g_400e1c = a0[26];
g_400e1d = a0[32];
v2 = a0[30];
g_400e1e = a0[30];
v3 = *(&v0);
return;
} | bash | angr_sailr |
static void nh(nh_ctx *hc, const UINT8 *buf, UINT32 padded_len,
UINT32 unpadded_len, UINT8 *result)
{
UINT32 nbits;
nbits = (unpadded_len << 3);
((UINT64 *)result)[0] = nbits;
((UINT64 *)result)[1] = nbits;
nh_aux(hc->nh_key, buf, result, padded_len);
} | void nh(undefined8 param_1, undefined8 param_2, undefined4 param_3, int param_4,
ulong *param_5)
{
*param_5 = (ulong)(uint)(param_4 << 3);
param_5[1] = (ulong)(uint)(param_4 << 3);
nh_aux(param_1, param_2, param_5, param_3);
return;
} | openssh-portable | ghidra |
static _Bool
opt_expr(struct predicate **eval_treep) {
struct predlist regex_list = {((void *)0), ((void *)0)},
name_list = {((void *)0), ((void *)0)};
struct predlist cbo_list[NumEvaluationCosts];
int i;
struct predicate *curr;
struct predicate **prevp;
struct predicate **last_sidep;
PRED_FUNC pred_func;
enum predicate_type p_type;
_Bool has_side_effects = 0;
enum predicate_precedence prev_prec, biop_prec;
if (eval_treep == ((void *)0) || *eval_treep == ((void *)0))
return (0);
for (i = 0; i < NumEvaluationCosts; i++)
predlist_init(&cbo_list[i]);
prevp = eval_treep;
prev_prec = AND_PREC;
curr = *prevp;
while (curr->pred_left != ((void *)0)) {
prevp = &curr->pred_left;
prev_prec = curr->p_prec;
curr = curr->pred_left;
}
if (curr->p_type != BI_OP)
set_new_parent(curr, prev_prec, prevp);
if (options.debug_options & (DebugExpressionTree | DebugTreeOpt)) {
fprintf(stderr, "Normalized Eval Tree:\n");
print_tree(stderr, *eval_treep, 0);
}
prevp = eval_treep;
biop_prec = NO_PREC;
if ((*prevp) && (*prevp)->p_type == BI_OP)
biop_prec = (*prevp)->p_prec;
while ((curr = *prevp) != ((void *)0)) {
if (curr->p_type == BI_OP) {
if (curr->p_prec != biop_prec)
curr = set_new_parent(curr, biop_prec, prevp);
}
p_type = curr->pred_right->p_type;
pred_func = curr->pred_right->pred_func;
switch (p_type) {
case NO_TYPE:
case PRIMARY_TYPE:
if (biop_prec == COMMA_PREC)
break;
if (!curr->pred_right->side_effects) {
_Bool reorder;
if (predicate_is_cost_free(curr->pred_right)) {
if (options.debug_options & DebugTreeOpt) {
fprintf(stderr, "-O%d: promoting cheap predicate ",
(int)options.optimisation_level);
print_predicate(stderr, curr->pred_right);
fprintf(stderr, " into name_list\n");
}
predlist_insert(&name_list, curr, prevp);
continue;
}
if (pred_func == pred_regex) {
predlist_insert(®ex_list, curr, prevp);
continue;
}
reorder = ((options.optimisation_level > 1) &&
(NeedsType == curr->pred_right->p_cost ||
NeedsInodeNumber == curr->pred_right->p_cost) &&
!curr->pred_right->need_stat) ||
(options.optimisation_level > 2);
if (reorder) {
if (options.debug_options & DebugTreeOpt) {
fprintf(stderr, "-O%d: categorising predicate ",
(int)options.optimisation_level);
print_predicate(stderr, curr->pred_right);
fprintf(stderr, " by cost (%s)\n",
cost_name(curr->pred_right->p_cost));
}
predlist_insert(&cbo_list[curr->pred_right->p_cost], curr, prevp);
continue;
}
}
break;
case UNI_OP:
curr->pred_right->side_effects = opt_expr(&curr->pred_right->pred_right);
break;
case BI_OP:
curr->pred_right->side_effects = opt_expr(&curr->pred_right);
break;
default:
((!!sizeof(struct {
_Static_assert(1, "verify_expr ("
"1"
", "
"(error (1, 0, gettext (\"oops -- invalid expression "
"type!\")), assume (false))"
")");
int _gl_dummy;
}))
? ((error(1, 0, gettext("oops -- invalid expression type!")),
((0) ? (void)0 : __builtin_unreachable())))
: ((error(1, 0, gettext("oops -- invalid expression type!")),
((0) ? (void)0 : __builtin_unreachable()))));
break;
}
if (curr->pred_right->side_effects == 1) {
last_sidep = prevp;
merge_lists(cbo_list, NumEvaluationCosts, &name_list, ®ex_list,
last_sidep);
has_side_effects = 1;
}
prevp = &curr->pred_left;
}
last_sidep = prevp;
merge_lists(cbo_list, NumEvaluationCosts, &name_list, ®ex_list,
last_sidep);
return has_side_effects;
} | undefined opt_expr(long *param_1)
{
uint uVar1;
long lVar2;
char cVar3;
bool bVar4;
undefined uVar5;
undefined8 uVar6;
long in_FS_OFFSET;
undefined local_12a;
int local_128;
undefined4 local_124;
int local_120;
long local_118;
long *local_110;
undefined8 local_f8;
undefined8 local_f0;
undefined8 local_e8;
undefined8 local_e0;
undefined local_d8[184];
long local_20;
local_20 = *(long *)(in_FS_OFFSET + 0x28);
local_f8 = 0;
local_f0 = 0;
local_e8 = 0;
local_e0 = 0;
local_12a = 0;
if ((param_1 != (long *)0x0) && (*param_1 != 0)) {
for (local_128 = 0; local_128 < 0xb; local_128 = local_128 + 1) {
predlist_init(local_d8 + (long)local_128 * 0x10);
}
local_124 = 3;
local_110 = param_1;
for (local_118 = *param_1; *(long *)(local_118 + 0x110) != 0;
local_118 = *(long *)(local_118 + 0x110)) {
local_110 = (long *)(local_118 + 0x110);
local_124 = *(undefined4 *)(local_118 + 0x14);
}
if (*(int *)(local_118 + 0x10) != 3) {
set_new_parent(local_118, local_124, local_110);
}
if ((pred_regex & 9) != 0) {
fprintf(stderr, "Normalized Eval Tree:\n");
print_tree(stderr, *param_1, 0);
}
local_120 = 0;
local_110 = param_1;
if ((*param_1 != 0) && (*(int *)(*param_1 + 0x10) == 3)) {
local_120 = *(int *)(*param_1 + 0x14);
}
LAB_0010160d:
do {
local_118 = *local_110;
if (local_118 == 0)
goto code_r0x0010162c;
if ((*(int *)(local_118 + 0x10) == 3) &&
(local_120 != *(int *)(local_118 + 0x14))) {
local_118 = set_new_parent(local_118, local_120, local_110);
}
uVar1 = *(uint *)(*(long *)(local_118 + 0x118) + 0x10);
lVar2 = **(long **)(local_118 + 0x118);
if (uVar1 == 3) {
lVar2 = *(long *)(local_118 + 0x118);
uVar5 = opt_expr(local_118 + 0x118);
*(undefined *)(lVar2 + 0x18) = uVar5;
} else if (uVar1 < 4) {
if (uVar1 < 2) {
if ((local_120 != 1) &&
(*(char *)(*(long *)(local_118 + 0x118) + 0x18) != '\x01')) {
cVar3 = predicate_is_cost_free(*(undefined8 *)(local_118 + 0x118));
if (cVar3 != '\0') {
if ((pred_regex & 8) != 0) {
fprintf(stderr, "-O%d: promoting cheap predicate ",
(ulong)pred_closeparen);
print_predicate(stderr, *(undefined8 *)(local_118 + 0x118));
fprintf(stderr, " into name_list\n");
}
predlist_insert(&local_e8, local_118, local_110);
goto LAB_0010160d;
}
if (lVar2 == lRam00000000001013a7) {
predlist_insert(&local_f8, local_118, local_110);
goto LAB_0010160d;
}
if (((pred_closeparen < 2) ||
(((*(int *)(*(long *)(local_118 + 0x118) + 0x20) != 2 &&
(*(int *)(*(long *)(local_118 + 0x118) + 0x20) != 1)) ||
(*(char *)(*(long *)(local_118 + 0x118) + 0x1a) ==
'\x01')))) &&
(pred_closeparen < 3)) {
bVar4 = false;
} else {
bVar4 = true;
}
if (bVar4) {
if ((pred_regex & 8) != 0) {
fprintf(stderr, "-O%d: categorising predicate ",
(ulong)pred_closeparen);
print_predicate(stderr, *(undefined8 *)(local_118 + 0x118));
uVar6 = cost_name(
*(undefined4 *)(*(long *)(local_118 + 0x118) + 0x20));
fprintf(stderr, " by cost (%s)\n", uVar6);
}
predlist_insert(
local_d8 + (ulong) *
(uint *)(*(long *)(local_118 + 0x118) + 0x20) *
0x10,
local_118, local_110);
goto LAB_0010160d;
}
}
} else {
if (uVar1 != 2)
goto LAB_0010157b;
lVar2 = *(long *)(local_118 + 0x118);
uVar5 = opt_expr(*(long *)(local_118 + 0x118) + 0x118);
*(undefined *)(lVar2 + 0x18) = uVar5;
}
} else {
LAB_0010157b:
uVar6 = gettext("oops -- invalid expression type!");
error(1, 0, uVar6);
}
if (*(char *)(*(long *)(local_118 + 0x118) + 0x18) != '\0') {
merge_lists(local_d8, 0xb, &local_e8, &local_f8, local_110);
local_12a = 1;
}
local_110 = (long *)(local_118 + 0x110);
} while (true);
}
local_12a = 0;
LAB_0010166d:
if (local_20 == *(long *)(in_FS_OFFSET + 0x28)) {
return local_12a;
}
__stack_chk_fail();
code_r0x0010162c:
merge_lists(local_d8, 0xb, &local_e8, &local_f8, local_110);
goto LAB_0010166d;
} | findutils | ghidra |
acl_t acl_from_text(const char *buf_p) {
acl_t acl;
acl = acl_init(0);
if (!acl)
return ((void *)0);
if (!buf_p) {
(*__errno_location()) = 22;
return ((void *)0);
}
while (*buf_p != '\0') {
if (parse_acl_entry(&buf_p, &acl) != 0)
goto fail;
do {
while (*(buf_p) == ' ' || *(buf_p) == '\t' || *(buf_p) == '\n' ||
*(buf_p) == '\r')
(buf_p)++;
if (*(buf_p) == '#') {
while (*(buf_p) != '\n' && *(buf_p) != '\0')
(buf_p)++;
}
} while (0);
if (*buf_p == ',') {
buf_p++;
do {
while (*(buf_p) == ' ' || *(buf_p) == '\t' || *(buf_p) == '\n' ||
*(buf_p) == '\r')
(buf_p)++;
if (*(buf_p) == '#') {
while (*(buf_p) != '\n' && *(buf_p) != '\0')
(buf_p)++;
}
} while (0);
}
}
if (*buf_p != '\0') {
(*__errno_location()) = 22;
goto fail;
}
return acl;
fail:
acl_free(acl);
return ((void *)0);
} | long long acl_from_text(unsigned long a0) {
char *v0;
unsigned long long v1;
void *v3;
unsigned long long v4;
v0 = a0;
v1 = acl_init(0x0);
if (!v1) {
v3 = 0;
} else if (!v0) {
*(__errno_location()) = 22;
v3 = 0;
} else {
while (true) {
if (*(v0)) {
v4 = parse_acl_entry(&v0, &v1);
if (!v4) {
while (true) {
if (*(v0) != 32 && *(v0) != 9 && *(v0) != 10) {
if (*(v0) != 13)
break;
}
v0 += 1;
}
if (*(v0) == 35) {
for (; *(v0) != 10; v0 += 1) {
if (!*(v0))
break;
}
}
if (*(v0) != 44)
continue;
v0 += 1;
while (true) {
if (*(v0) != 32 && *(v0) != 9 && *(v0) != 10) {
if (*(v0) != 13)
break;
}
v0 += 1;
}
if (*(v0) != 35)
continue;
for (; *(v0) != 10; v0 += 1) {
if (!*(v0))
break;
}
}
} else if (*(v0)) {
*(__errno_location()) = 22;
} else {
v3 = v1;
break;
}
if (!*(v0) && *(v0) || v4 && *(v0)) {
acl_free(v1);
v3 = 0;
break;
}
}
}
return v3;
} | acl-2.3.1 | angr_dream |
void add_starting_file(char const *file_name) {
struct name *name = make_name(file_name);
if (starting_file_option) {
struct name *head = namelist;
remname(head);
free_name(head);
}
name->prev = ((void *)0);
name->next = namelist;
namelist = name;
if (!nametail)
nametail = namelist;
name->found_count = 0;
name->matching_flags = (((wildcards == enable_wildcards) ? (1 << 28) : 0) |
include_anchored | matching_flags | recursion_option);
name->change_dir = 0;
name->directory = ((void *)0);
name->parent = ((void *)0);
name->cmdline = 1;
starting_file_option = 1;
} | void add_starting_file(undefined8 param_1)
{
undefined8 uVar1;
undefined8 *puVar2;
uint uVar3;
puVar2 = (undefined8 *)make_name(param_1);
uVar1 = namelist;
if (starting_file_option != '\0') {
remname(namelist);
free_name(uVar1);
}
puVar2[1] = 0;
*puVar2 = namelist;
if (nametail == (undefined8 *)0x0) {
nametail = puVar2;
}
namelist = puVar2;
puVar2[6] = 0;
if (wildcards == 2) {
uVar3 = 0x10000000;
} else {
uVar3 = 0;
}
*(uint *)(puVar2 + 4) =
uVar3 | include_anchored | matching_flags | recursion_option;
*(undefined4 *)(puVar2 + 5) = 0;
puVar2[7] = 0;
puVar2[8] = 0;
*(undefined *)((long)puVar2 + 0x24) = 1;
starting_file_option = 1;
return;
} | tar | ghidra |
sig_set(EditLine *el) {
size_t i;
sigset_t oset;
struct sigaction osa, nsa;
nsa.__sigaction_handler.sa_handler = sig_handler;
nsa.sa_flags = 0;
sigemptyset(&nsa.sa_mask);
(void)sigprocmask(0, &el->el_signal->sig_set, &oset);
for (i = 0; sighdl[i] != -1; i++) {
if (sigaction(sighdl[i], &nsa, &osa) != -1 &&
osa.__sigaction_handler.sa_handler != sig_handler)
el->el_signal->sig_action[i] = osa;
}
sel = el;
(void)sigprocmask(2, &oset, ((void *)0));
} | unsigned long sig_set(long a1) {
__sighandler_t *v1;
unsigned long v2;
unsigned long v3;
unsigned long v4;
unsigned long v5;
unsigned long v6;
unsigned long v7;
unsigned long v8;
unsigned long v9;
void (*v10)(int);
long i;
sigset_t oset;
struct sigaction v14;
struct sigaction v15;
unsigned long v16;
v16 = __readfsqword(0x28u);
v15.sa_handler = (__sighandler_t)sig_handler;
v15.sa_flags = 0;
sigemptyset(&v15.sa_mask);
sigprocmask(0, (const sigset_t *)(*(_QWORD *)(a1 + 1208) + 1064LL), &oset);
for (i = 0LL; sighdl[i] != -1; ++i) {
if (sigaction(sighdl[i], &v15, &v14) != -1 &&
(unsigned long (*)(int))v14.sa_handler != sig_handler) {
v1 = (__sighandler_t *)(*(_QWORD *)(a1 + 1208) + 152 * i);
v2 = v14.sa_mask.__val[0];
*v1 = v14.sa_handler;
v1[1] = (__sighandler_t)v2;
v3 = v14.sa_mask.__val[2];
v1[2] = (__sighandler_t)v14.sa_mask.__val[1];
v1[3] = (__sighandler_t)v3;
v4 = v14.sa_mask.__val[4];
v1[4] = (__sighandler_t)v14.sa_mask.__val[3];
v1[5] = (__sighandler_t)v4;
v5 = v14.sa_mask.__val[6];
v1[6] = (__sighandler_t)v14.sa_mask.__val[5];
v1[7] = (__sighandler_t)v5;
v6 = v14.sa_mask.__val[8];
v1[8] = (__sighandler_t)v14.sa_mask.__val[7];
v1[9] = (__sighandler_t)v6;
v7 = v14.sa_mask.__val[10];
v1[10] = (__sighandler_t)v14.sa_mask.__val[9];
v1[11] = (__sighandler_t)v7;
v8 = v14.sa_mask.__val[12];
v1[12] = (__sighandler_t)v14.sa_mask.__val[11];
v1[13] = (__sighandler_t)v8;
v9 = v14.sa_mask.__val[14];
v1[14] = (__sighandler_t)v14.sa_mask.__val[13];
v1[15] = (__sighandler_t)v9;
v10 = *(void (**)(int))&v14.sa_flags;
v1[16] = (__sighandler_t)v14.sa_mask.__val[15];
v1[17] = v10;
v1[18] = (__sighandler_t)v14.sa_restorer;
}
}
sel = a1;
sigprocmask(2, &oset, 0LL);
return __readfsqword(0x28u) ^ v16;
} | libedit | ida |
static inline int skip_single_quoted(string, slen, sind, flags) const
char *string;
size_t slen;
int sind;
int flags;
{
register int c;
mbstate_t state;
memset(&state, '\0', sizeof(mbstate_t));
c = sind;
while (string[c] && string[c] != '\'') {
if ((flags & 0x0400) && string[c] == '\\' && string[c + 1] == '\'' &&
string[c + 2])
do {
if (locale_mb_cur_max > 1) {
mbstate_t state_bak;
size_t mblength;
int _f;
_f = is_basic((string)[c]);
if (_f)
mblength = 1;
else if (locale_utf8locale && (((string)[c] & 0x80) == 0))
mblength = (string)[c] != 0;
else {
state_bak = state;
mblength = mbrlen((string) + (c), (slen) - (c), &state);
}
if (mblength == (size_t)-2 || mblength == (size_t)-1) {
state = state_bak;
(c)++;
} else if (mblength == 0)
(c)++;
else
(c) += mblength;
} else
(c)++;
} while (0);
do {
if (locale_mb_cur_max > 1) {
mbstate_t state_bak;
size_t mblength;
int _f;
_f = is_basic((string)[c]);
if (_f)
mblength = 1;
else if (locale_utf8locale && (((string)[c] & 0x80) == 0))
mblength = (string)[c] != 0;
else {
state_bak = state;
mblength = mbrlen((string) + (c), (slen) - (c), &state);
}
if (mblength == (size_t)-2 || mblength == (size_t)-1) {
state = state_bak;
(c)++;
} else if (mblength == 0)
(c)++;
else
(c) += mblength;
} else
(c)++;
} while (0);
}
if (string[c])
c++;
return c;
} | int skip_single_quoted(char *a0, unsigned long a1, unsigned long a2,
unsigned long a3) {
unsigned int v0;
unsigned int v1;
unsigned long long v2;
unsigned long long v3;
unsigned long long v4;
unsigned long long v5;
char *v7;
memset(&v4, 0x0, 0x8);
v7 = a2;
while (true) {
switch (*((a0 + v7))) {
case 0:
case 39:
goto LABEL_4013a0;
default:
if ((a3 & 0x400) && *((a0 + v7)) == 92 && *((a0 + v7 + 1)) == 39 &&
*((a0 + v7 + 2))) {
if (locale_mb_cur_max <= 1) {
v7 = v7 + 1;
} else {
v0 = is_basic(*((a0 + v7)));
if (v0) {
v2 = 1;
} else if (!locale_utf8locale || *((a0 + v7)) < 0) {
v5 = v4;
v2 = mbrlen(v7 + a0, a1 + -0x1 * v7, &v4, v7 + a0);
} else {
v2 = *((a0 + v7));
}
if (v2 == -2 || v2 == -1) {
v4 = v5;
v7 = v7 + 1;
} else {
v7 = (!v2 ? &v7[v2] : v7 + 1);
}
}
}
if (locale_mb_cur_max <= 1) {
v7 = v7 + 1;
continue;
} else {
v1 = is_basic(*((a0 + v7)));
if (v1) {
v3 = 1;
break;
} else if (!locale_utf8locale || *((a0 + v7)) < 0) {
v5 = v4;
v3 = mbrlen(v7 + a0, a1 + -0x1 * v7, &v4, v7 + a0);
break;
} else {
v3 = *((a0 + v7));
break;
}
if (v3 == -2 || v3 == -1) {
v4 = v5;
v7 = v7 + 1;
continue;
} else {
v7 = (!v3 ? &v7[v3] : v7 + 1);
}
}
}
}
LABEL_4013a0:
return a2;
} | bash | angr_sailr |
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;
} | int parse_integer(char *a0, unsigned int *a1, unsigned long a2,
unsigned long a3, unsigned long a4, unsigned int a5) {
unsigned int v0;
unsigned int v1;
unsigned int v2;
unsigned long v3;
char *v4;
unsigned long long v5;
char v6;
unsigned long long v8;
unsigned long v9;
v1 = 0;
v3 = v1;
v0 = xstrtoumax(a0, &v4, 0xa, &v3, "bcEGkKMPTwYZ0");
if ((v0 & -2) == 2 && v4[1] != 66 && *(v4) == 66) {
v4 += 1;
if (!*(v4))
v0 &= -3;
}
if ((v0 & -2) == 2 && *(v4) == 120) {
if (v4[1] == 66)
v8 = strchr(v4 + 1, 0x42);
if (!v8 || v4[1] != 66) {
v2 = xstrtoumax(v4 + 1, &v4, 0xa, &v6, "bcEGkKMPTwYZ0");
if ((v2 & -2)) {
v0 = v2;
v5 = v1;
} else {
v9 = 0;
if ([D] amd64g_calculate_condition(
0x0 < 64 >, 0x30 < 64 >,
Load(addr = stack_base - 64, size = 8, endness = Iend_LE),
Load(addr = stack_base - 40, size = 8, endness = Iend_LE),
cc_ndep<8>))
v9 = 1;
if (v5 < 0)
*(&v9) = 1;
v5 = v3 * *(&v6);
if (!(v9 & 1) && (!((v0 | v2) & 1) || !v5)) {
if (!v5 && !strncmp(a0, "0x", strlen("0x")))
nl_error(0x0, 0x0,
gettext("warning: %s is a zero multiplier; use %s if that "
"is intended"),
quote_n(0x0, "0x"), quote_n(0x1, "00x"), a5);
v0 = 0;
}
if ((v9 & 1) || ((v0 | v2) & 1) && v5) {
v0 = 1;
v5 = 9223372036854775807;
}
}
}
}
if ((v0 & -2) != 2 || *(v4) != 120 || v4[1] == 66 && v8) {
if (v3 >= 0) {
v5 = v3;
} else {
v0 = 1;
v5 = 9223372036854775807;
}
}
*(a1) = v0;
return v5;
} | coreutils | angr_dream |
u_int32_t Blowfish_stream2word(const u_int8_t *data, u_int16_t databytes,
u_int16_t *current) {
u_int8_t i;
u_int16_t j;
u_int32_t temp;
temp = 0x00000000;
j = *current;
for (i = 0; i < 4; i++, j++) {
if (j >= databytes)
j = 0;
temp = (temp << 8) | data[j];
}
*current = j;
return temp;
} | uint Blowfish_stream2word(long param_1, ushort param_2, ushort *param_3)
{
byte local_f;
ushort local_e;
uint local_c;
local_c = 0;
local_e = *param_3;
for (local_f = 0; local_f < 4; local_f = local_f + 1) {
if (param_2 <= local_e) {
local_e = 0;
}
local_c = (uint) * (byte *)(param_1 + (ulong)local_e) | local_c << 8;
local_e = local_e + 1;
}
*param_3 = local_e;
return local_c;
} | openssh-portable | ghidra |
static intmax_t ipow(base, exp)
intmax_t base, exp;
{
intmax_t result;
result = 1;
while (exp) {
if (exp & 1)
result *= base;
exp >>= 1;
base *= base;
}
return result;
} | long ipow(long param_1, ulong param_2)
{
ulong local_28;
long local_20;
long local_10;
local_10 = 1;
local_20 = param_1;
for (local_28 = param_2; local_28 != 0; local_28 = (long)local_28 >> 1) {
if ((local_28 & 1) != 0) {
local_10 = local_10 * local_20;
}
local_20 = local_20 * local_20;
}
return local_10;
} | bash | ghidra |
static int openredirect(union node *redir) {
struct stat64 sb;
char *fname;
int flags;
int f;
switch (redir->nfile.type) {
case 18:
flags = 00;
do_open:
f = sh_open(redir->nfile.expfname, flags, 0);
break;
case 19:
flags = 02 | 0100;
goto do_open;
case 16:
if (optlist[11]) {
fname = redir->nfile.expfname;
if (stat64(fname, &sb) < 0) {
flags = 01 | 0100 | 0200;
goto do_open;
}
if (((((sb.st_mode)) & 0170000) == (0100000)))
goto ecreate;
f = sh_open(fname, 01, 0);
if (!fstat64(f, &sb) && ((((sb.st_mode)) & 0170000) == (0100000))) {
close(f);
goto ecreate;
}
break;
}
case 17:
flags = 01 | 0100 | 01000;
goto do_open;
case 20:
flags = 01 | 0100 | 02000;
goto do_open;
case 21:
case 22:
f = redir->ndup.dupfd;
if (f == redir->nfile.fd)
f = -2;
break;
default:
case 23:
case 24:
f = openhere(redir);
break;
}
return f;
ecreate:
sh_open_fail(fname, 0100, 17);
} | int openredirect(undefined4 *param_1)
{
char *__file;
int iVar1;
long in_FS_OFFSET;
undefined4 local_b8;
int local_b4;
stat64 local_a8;
long local_10;
local_10 = *(long *)(in_FS_OFFSET + 0x28);
switch (*param_1) {
case 0x10:
if (DAT_0010105b == '\0')
goto switchD_0010032c_caseD_11;
__file = *(char **)(param_1 + 8);
iVar1 = stat64(__file, &local_a8);
if (-1 < iVar1) {
if ((local_a8.st_mode & 0xf000) != 0x8000) {
local_b4 = sh_open(__file, 1, 0);
iVar1 = fstat64(local_b4, &local_a8);
if ((iVar1 != 0) || ((local_a8.st_mode & 0xf000) != 0x8000))
goto LAB_00100499;
close(local_b4);
}
sh_open_fail(__file, 0x40, 0x11);
goto LAB_001004ca;
}
local_b8 = 0xc1;
break;
case 0x11:
switchD_0010032c_caseD_11:
local_b8 = 0x241;
break;
case 0x12:
local_b8 = 0;
break;
case 0x13:
local_b8 = 0x42;
break;
case 0x14:
local_b8 = 0x441;
break;
case 0x15:
case 0x16:
local_b4 = param_1[5];
if (local_b4 == param_1[4]) {
local_b4 = -2;
}
goto LAB_00100499;
default:
local_b4 = openhere(param_1);
goto LAB_00100499;
}
local_b4 = sh_open(*(undefined8 *)(param_1 + 8), local_b8, 0);
LAB_00100499:
if (local_10 == *(long *)(in_FS_OFFSET + 0x28)) {
return local_b4;
}
LAB_001004ca:
__stack_chk_fail();
} | dash-0.5.11+git20210903+057cd650a4ed | ghidra |
int addnewenv(const char *new, char **curr, int n) {
size_t nlen = strcspn(new, "=");
int i;
for (i = 0; i < n; i++) {
if (nlen != strcspn(curr[i], "="))
continue;
if (strncmp(new, curr[i], nlen) == 0)
break;
}
if (i >= n)
curr[n++] = istrdup(new);
else {
free(curr[i]);
curr[i] = istrdup(new);
}
return n;
} | int addnewenv(char *a0, unsigned long long *a1, unsigned long a2,
unsigned long long a3, unsigned long long a4,
unsigned long long a5) {
unsigned int v0;
int tmp_11;
unsigned int v1;
unsigned int v2;
v0 = a2;
*(&v2) = strcspn(a0, "=");
v1 = 0;
while (true) {
if (v1 >= v0)
break;
if (*(&v2) == strcspn(a1[v1], "=") && !strncmp(a0, a1[v1], *(&v2)))
break;
v1 += 1;
}
if (v1 >= v0) {
tmp_11 = v0;
v0 += 1;
a1[tmp_11] = istrdup(a0, a1, tmp_11 * 8, a3, a4, a5);
} else {
free(a1[v1]);
a1[v1] = istrdup(a0, a1, v1 * 8, a3, a4, a5);
}
return v0;
} | sysvinit | angr_phoenix |
static struct change *build_script(struct file_data const filevec[]) {
struct change *script = 0;
char *changed0 = filevec[0].changed;
char *changed1 = filevec[1].changed;
lin i0 = filevec[0].buffered_lines, i1 = filevec[1].buffered_lines;
while (i0 >= 0 || i1 >= 0) {
if (changed0[i0 - 1] | changed1[i1 - 1]) {
lin line0 = i0, line1 = i1;
while (changed0[i0 - 1])
--i0;
while (changed1[i1 - 1])
--i1;
script = add_change(i0, i1, line0 - i0, line1 - i1, script);
}
i0--, i1--;
}
return script;
} | int build_script(unsigned long long a0[74]) {
void *v0;
unsigned int v1;
unsigned int v2;
char *v3;
char *v4;
unsigned long v5;
unsigned long v6;
v0 = 0;
v3 = a0[35];
v4 = a0[73];
*(&v1) = a0[25];
for (*(&v2) = a0[63]; !((*(&v1) - 0 >> 63)) || !((*(&v2) - 0 >> 63));
*(&v2) = *(&v2) - 1) {
if ((v4[1 + *(&v2)] | v3[1 + *(&v1)])) {
v5 = *(&v1);
for (v6 = *(&v2); v3[1 + *(&v1)]; *(&v1) = *(&v1) - 1)
;
for (; v4[1 + *(&v2)]; *(&v2) = *(&v2) - 1)
;
v0 = add_change(*(&v1), *(&v2), v5 - *(&v1), v6 - *(&v2), v0);
}
*(&v1) = *(&v1) - 1;
}
return v0;
} | diffutils | angr_sailr |
static void lm_init(int pack_level) {
register unsigned j;
if (pack_level < 1 || pack_level > 9)
gzip_error("bad pack level");
memset((voidp)((char *)(prev + 0x8000)), 0,
((unsigned)(1 << 15) * sizeof(*(prev + 0x8000))));
rsync_chunk_end = 0xFFFFFFFFUL;
rsync_sum = 0;
max_lazy_match = configuration_table[pack_level].max_lazy;
good_match = configuration_table[pack_level].good_length;
nice_match = configuration_table[pack_level].nice_length;
max_chain_length = configuration_table[pack_level].max_chain;
strstart = 0;
block_start = 0L;
lookahead = read_buf((char *)window,
sizeof(int) <= 2 ? (unsigned)0x8000 : 2 * 0x8000);
if (lookahead == 0 || lookahead == (unsigned)(-1)) {
eofile = 1, lookahead = 0;
return;
}
eofile = 0;
while (lookahead < (258 + 3 + 1) && !eofile)
fill_window();
ins_h = 0;
for (j = 0; j < 3 - 1; j++)
(ins_h = (((ins_h) << ((15 + 3 - 1) / 3)) ^ (window[j])) &
((unsigned)(1 << 15) - 1));
} | void lm_init(unsigned long a0) {
unsigned long long v1;
unsigned long long v2;
unsigned long long v3;
unsigned long long v4;
unsigned long long v5;
void *v6;
if (a0 <= 0 || a0 > 9)
gzip_error("bad pack level");
memset(0x510008, 0x0, 0x10000);
rsync_chunk_end = 4294967295;
rsync_sum = 0;
max_lazy_match = (&g_401182)[a0];
good_match = (&configuration_table)[a0];
nice_match = (&g_401184)[a0];
good_match = (&g_401186)[a0];
good_match = 0;
block_start = 0;
lookahead = *(5242904)(&window, 0x10000, a0 * 8);
v1 = lookahead;
if (lookahead) {
v2 = lookahead;
if (lookahead != -1) {
eofile = 0;
while (true) {
v3 = lookahead;
if (!(lookahead <= 261) || !((v4 = eofile, !eofile)))
break;
fill_window();
}
ins_h = 0;
for (v6 = 0; v6 <= 1; v6 = v6 + 1) {
v5 = (*((v6 + &window)) ^ (ins_h * 32)) & 32767;
ins_h = (*((v6 + &window)) ^ (ins_h * 32)) & 32767;
}
return;
}
}
eofile = 1;
lookahead = 0;
return;
} | gzip-1.12 | angr_sailr |
static void pr_context_hunk(struct change *hunk) {
lin first0, last0, first1, last1, i;
char const *prefix;
char const *function;
FILE *out;
enum changes changes = analyze_hunk(hunk, &first0, &last0, &first1, &last1);
if (!changes)
return;
i = -files[0].prefix_lines;
first0 = ((first0 - context) >= (i) ? (first0 - context) : (i));
first1 = ((first1 - context) >= (i) ? (first1 - context) : (i));
if (last0 < files[0].valid_lines - context)
last0 += context;
else
last0 = files[0].valid_lines - 1;
if (last1 < files[1].valid_lines - context)
last1 += context;
else
last1 = files[1].valid_lines - 1;
function = ((void *)0);
if (function_regexp.fastmap)
function = find_function(files[0].linbuf, first0);
begin_output();
out = outfile;
fputs_unlocked("***************", out);
if (function)
print_context_function(out, function);
putc_unlocked('\n', out);
set_color_context(LINE_NUMBER_CONTEXT);
fputs_unlocked("*** ", out);
print_context_number_range(&files[0], first0, last0);
fputs_unlocked(" ****", out);
set_color_context(RESET_CONTEXT);
putc_unlocked('\n', out);
if (changes & OLD) {
struct change *next = hunk;
for (i = first0; i <= last0; i++) {
set_color_context(DELETE_CONTEXT);
while (next && next->line0 + next->deleted <= i)
next = next->link;
prefix = " ";
if (next && next->line0 <= i) {
prefix = (next->inserted > 0 ? "!" : "-");
}
print_1_line_nl(prefix, &files[0].linbuf[i], 1);
set_color_context(RESET_CONTEXT);
if (files[0].linbuf[i + 1][-1] == '\n')
putc_unlocked('\n', out);
}
}
set_color_context(LINE_NUMBER_CONTEXT);
fputs_unlocked("--- ", out);
print_context_number_range(&files[1], first1, last1);
fputs_unlocked(" ----", out);
set_color_context(RESET_CONTEXT);
putc_unlocked('\n', out);
if (changes & NEW) {
struct change *next = hunk;
for (i = first1; i <= last1; i++) {
set_color_context(ADD_CONTEXT);
while (next && next->line1 + next->inserted <= i)
next = next->link;
prefix = " ";
if (next && next->line1 <= i) {
prefix = (next->deleted > 0 ? "!" : "+");
}
print_1_line_nl(prefix, &files[1].linbuf[i], 1);
set_color_context(RESET_CONTEXT);
if (files[1].linbuf[i + 1][-1] == '\n')
putc_unlocked('\n', out);
}
}
} | void pr_context_hunk(undefined8 *param_1)
{
uint uVar1;
long in_FS_OFFSET;
long local_60;
long local_58;
long local_50;
long local_48;
long local_40;
undefined *local_38;
long local_30;
undefined8 *local_28;
undefined8 *local_20;
FILE *local_18;
long local_10;
local_10 = *(long *)(in_FS_OFFSET + 0x28);
uVar1 = analyze_hunk(param_1, &local_60, &local_58, &local_50, &local_48);
if (uVar1 != 0) {
local_40 = -_DAT_00102150;
local_60 = local_60 - context;
if (local_60 <= local_40) {
local_60 = local_40;
}
local_50 = local_50 - context;
if (local_50 <= local_40) {
local_50 = local_40;
}
if (local_58 < _DAT_00102138 - context) {
local_58 = context + local_58;
} else {
local_58 = _DAT_00102138 + -1;
}
if (local_48 < _DAT_00102268 - context) {
local_48 = context + local_48;
} else {
local_48 = _DAT_00102268 + -1;
}
local_30 = 0;
if (suppress_blank_empty != 0) {
local_30 = find_function(_DAT_00102120, local_60);
}
begin_output();
local_18 = outfile;
fputs_unlocked("***************", outfile);
if (local_30 != 0) {
print_context_function(local_18, local_30);
}
putc_unlocked(10, local_18);
set_color_context(4);
fputs_unlocked("*** ", local_18);
print_context_number_range(&files, local_60, local_58);
fputs_unlocked(" ****", local_18);
set_color_context(3);
putc_unlocked(10, local_18);
if ((uVar1 & 1) != 0) {
local_28 = param_1;
for (local_40 = local_60; local_40 <= local_58; local_40 = local_40 + 1) {
set_color_context(2);
for (; (local_28 != (undefined8 *)0x0 &&
((long)(local_28[2] + local_28[3]) <= local_40));
local_28 = (undefined8 *)*local_28) {
}
local_38 = &DAT_00101143;
if ((local_28 != (undefined8 *)0x0) &&
((long)local_28[3] <= local_40)) {
if ((long)local_28[1] < 1) {
local_38 = &DAT_00101147;
} else {
local_38 = &DAT_00101145;
}
}
print_1_line_nl(local_38, _DAT_00102120 + local_40 * 8, 1);
set_color_context(3);
if (*(char *)(*(long *)(_DAT_00102120 + (local_40 + 1) * 8) + -1) ==
'\n') {
putc_unlocked(10, local_18);
}
}
}
set_color_context(4);
fputs_unlocked("--- ", local_18);
print_context_number_range(0x102198, local_50, local_48);
fputs_unlocked(" ----", local_18);
set_color_context(3);
putc_unlocked(10, local_18);
if ((uVar1 & 2) != 0) {
local_20 = param_1;
for (local_40 = local_50; local_40 <= local_48; local_40 = local_40 + 1) {
set_color_context(1);
for (; (local_20 != (undefined8 *)0x0 &&
((long)(local_20[1] + local_20[4]) <= local_40));
local_20 = (undefined8 *)*local_20) {
}
local_38 = &DAT_00101143;
if ((local_20 != (undefined8 *)0x0) &&
((long)local_20[4] <= local_40)) {
if ((long)local_20[2] < 1) {
local_38 = &DAT_00101154;
} else {
local_38 = &DAT_00101145;
}
}
print_1_line_nl(local_38, _DAT_00102250 + local_40 * 8, 1);
set_color_context(3);
if (*(char *)(*(long *)(_DAT_00102250 + (local_40 + 1) * 8) + -1) ==
'\n') {
putc_unlocked(10, local_18);
}
}
}
}
if (local_10 == *(long *)(in_FS_OFFSET + 0x28)) {
return;
}
__stack_chk_fail();
} | diffutils | ghidra |
void read_directory_file(void) {
int fd;
char *buf = ((void *)0);
size_t bufsize = 0;
int flags = 02 | 0100;
if (incremental_level == 0)
flags |= 01000;
fd = open(listed_incremental_option, flags,
(0200 | (0200 >> 3) | ((0200 >> 3) >> 3) |
(0400 | (0400 >> 3) | ((0400 >> 3) >> 3))));
if (fd < 0) {
open_error(listed_incremental_option);
return;
}
listed_incremental_stream = fdopen(fd, "r+");
if (!listed_incremental_stream) {
open_error(listed_incremental_option);
close(fd);
return;
}
name_from_list();
blank_name_list();
if (0 < getline(&buf, &bufsize, listed_incremental_stream)) {
char *ebuf;
uintmax_t incremental_version;
if (strncmp(buf, "GNU tar", sizeof "GNU tar" - 1) == 0) {
ebuf = buf + sizeof "GNU tar" - 1;
if (*ebuf++ != '-')
do {
if (error_hook)
error_hook();
error(1, 0, gettext("Bad incremental file format"));
exit_status = 2;
} while (0);
for (; *ebuf != '-'; ebuf++)
if (!*ebuf)
do {
if (error_hook)
error_hook();
error(1, 0, gettext("Bad incremental file format"));
exit_status = 2;
} while (0);
incremental_version = strtoumax(ebuf + 1, ((void *)0), 10);
} else
incremental_version = 0;
switch (incremental_version) {
case 0:
case 1:
read_incr_db_01(incremental_version, buf);
break;
case 2:
read_incr_db_2();
break;
default:
do {
if (error_hook)
error_hook();
error(1, 0,
gettext("Unsupported incremental format version: %"
"l"
"u"),
incremental_version);
exit_status = 2;
} while (0);
}
}
if (ferror_unlocked(listed_incremental_stream))
read_error(listed_incremental_option);
free(buf);
} | unsigned long read_directory_file() {
char *v0;
char *v1;
char *v2;
int oflag;
int fd;
char *lineptr;
size_t n;
char *v8;
uintmax_t v9;
unsigned long v10;
v10 = __readfsqword(0x28u);
lineptr = 0LL;
n = 0LL;
oflag = 66;
if (!incremental_level)
oflag = 578;
fd = open(listed_incremental_option, oflag, 438LL);
if (fd >= 0) {
listed_incremental_stream = fdopen(fd, "r+");
if (listed_incremental_stream) {
name_from_list();
blank_name_list();
if (getline(&lineptr, &n, listed_incremental_stream) > 0) {
if (!strncmp(lineptr, "GNU tar", 7uLL)) {
v8 = lineptr + 8;
if (lineptr[7] != 45) {
if (error_hook)
error_hook();
v0 = gettext("Bad incremental file format");
error(1, 0, v0);
exit_status = 2;
}
while (*v8 != 45) {
if (!*v8) {
if (error_hook)
error_hook();
v1 = gettext("Bad incremental file format");
error(1, 0, v1);
exit_status = 2;
}
++v8;
}
v9 = strtoumax(v8 + 1, 0LL, 10);
} else {
v9 = 0LL;
}
if (v9 <= 1) {
read_incr_db_01(v9, lineptr);
} else if (v9 == 2) {
read_incr_db_2();
} else {
if (error_hook)
error_hook();
v2 = gettext("Unsupported incremental format version: %lu");
error(1, 0, v2, v9);
exit_status = 2;
}
}
if (ferror_unlocked(listed_incremental_stream))
read_error(listed_incremental_option);
free(lineptr);
} else {
open_error(listed_incremental_option);
close(fd);
}
} else {
open_error(listed_incremental_option);
}
return __readfsqword(0x28u) ^ v10;
} | tar | ida |
static int ssh_packet_init_compression(struct ssh *ssh) {
if (!ssh->state->compression_buffer &&
((ssh->state->compression_buffer = sshbuf_new()) == ((void *)0)))
return -2;
return 0;
} | int ssh_packet_init_compression(struct struct_0 **a0) {
struct_0 *v1;
unsigned int v2;
if (!*(a0)->field_40) {
v1 = *(a0);
*(a0)->field_40 = sshbuf_new();
if (!v1->field_40) {
v2 = -2;
goto LABEL_4012d2;
}
}
v2 = 0;
LABEL_4012d2:
return v2;
} | openssh-portable | angr_phoenix |
const char *gzerror(file, errnum)
gzFile file;
int *errnum;
{
gz_statep state;
if (file == ((void *)0))
return ((void *)0);
state = (gz_statep)file;
if (state->mode != 7247 && state->mode != 31153)
return ((void *)0);
if (errnum != ((void *)0))
*errnum = state->err;
return state->err == (-4) ? "out of memory"
: (state->msg == ((void *)0) ? "" : state->msg);
} | long long gzerror(struct_0 *a0, unsigned int *a1) {
unsigned long long v1;
if (!a0) {
v1 = 0;
} else {
if (a0->field_18 != 7247 && a0->field_18 != 31153)
v1 = 0;
if (a0->field_18 == 7247 || a0->field_18 == 31153) {
if (a1)
*(a1) = a0->field_74;
if (a0->field_74 == -0x4) {
v1 = "out of memory";
} else if (a0->field_78) {
v1 = a0->field_78;
} else {
v1 = &g_400e8c;
}
}
}
return v1;
} | zlib | angr_dream |
static void expredir(union node *n) {
union node *redir;
for (redir = n; redir; redir = redir->nfile.next) {
struct arglist fn;
fn.lastp = &fn.list;
switch (redir->type) {
case 19:
case 18:
case 16:
case 17:
case 20:
expandarg(redir->nfile.fname, &fn, 0x2 | 0x8);
redir->nfile.expfname = fn.list->text;
break;
case 22:
case 21:
if (redir->ndup.vname) {
expandarg(redir->ndup.vname, &fn, 0x2 | 0x8);
fixredir(redir, fn.list->text, 1);
}
break;
}
}
} | void expredir(unsigned long long a0) {
struct_0 *v0;
char v1;
unsigned long v2;
char v3;
unsigned long long *v5;
unsigned long long v6;
for (v0 = a0; v0; v0 = v0->field_8) {
v2 = &v1;
if (v0->field_0 > 20) {
if (v0->field_0 - 21 <= 1 && v0->field_18) {
expandarg(v0->field_18, &v1, 0xa, &v1);
fixredir(v0, *((*(&v1) + 8)), 0x1, *((*(&v1) + 8)));
}
} else {
if (v0->field_0 >= 16) {
expandarg(v0->field_18, &v1, 0xa, &v1);
v0->field_20 = *((*(&v1) + 8));
}
}
}
v6 = *(&v3) ^ v5[5];
return;
} | dash-0.5.11+git20210903+057cd650a4ed | angr_sailr |
ed_quoted_insert(EditLine *el, wint_t c __attribute__((__unused__))) {
int num;
wchar_t ch;
tty_quotemode(el);
num = el_wgetc(el, &ch);
tty_noquotemode(el);
if (num == 1)
return ed_insert(el, ch);
else
return ed_end_of_file(el, 0);
} | long long ed_quoted_insert(void *a0, unsigned long a1) {
unsigned int v0;
char v1;
unsigned int v2;
unsigned long long v4;
v0 = a1;
tty_quotemode(a0);
v2 = el_wgetc(a0, &v1, &v1);
tty_noquotemode(a0);
if (v2 != 1)
v4 = ed_end_of_file(a0, 0x0);
else
v4 = ed_insert(a0, *(&v1));
return v4;
} | libedit | angr_phoenix |
static int channel_request_rforward_cancel_tcpip(struct ssh *ssh,
const char *host,
u_short port) {
struct ssh_channels *sc = ssh->chanctxt;
struct permission_set *pset = &sc->local_perms;
int r;
u_int i;
struct permission *perm = ((void *)0);
for (i = 0; i < pset->num_permitted_user; i++) {
perm = &pset->permitted_user[i];
if (open_listen_match_tcpip(perm, host, port, 0))
break;
perm = ((void *)0);
}
if (perm == ((void *)0)) {
sshlog("channels.c", __func__, 4214, 1, SYSLOG_LEVEL_DEBUG1, ((void *)0),
"requested forward not found");
return -1;
}
if ((r = sshpkt_start(ssh, 80)) != 0 ||
(r = sshpkt_put_cstring(ssh, "cancel-tcpip-forward")) != 0 ||
(r = sshpkt_put_u8(ssh, 0)) != 0 ||
(r = sshpkt_put_cstring(ssh, channel_rfwd_bind_host(host))) != 0 ||
(r = sshpkt_put_u32(ssh, port)) != 0 || (r = sshpkt_send(ssh)) != 0)
sshfatal("channels.c", __func__, 4223, 1, SYSLOG_LEVEL_FATAL, ssh_err(r),
"send cancel");
fwd_perm_clear(perm);
return 0;
} | undefined8 channel_request_rforward_cancel_tcpip(long param_1,
undefined8 param_2,
undefined2 param_3)
{
int iVar1;
undefined8 uVar2;
char **ppcVar3;
char *pcStack88;
undefined8 uStack80;
undefined auStack72[12];
undefined2 local_3c;
undefined8 local_38;
long local_30;
int local_28;
uint local_24;
long local_20;
long local_18;
uint *local_10;
ppcVar3 = (char **)auStack72;
local_18 = *(long *)(param_1 + 0x868);
local_10 = (uint *)(local_18 + 0x20);
local_3c = param_3;
local_38 = param_2;
local_30 = param_1;
for (local_24 = 0; local_20 = 0, local_24 < *local_10;
local_24 = local_24 + 1) {
local_20 = (ulong)local_24 * 0x30 + *(long *)(local_10 + 2);
uStack80 = 0x10de9d;
iVar1 = open_listen_match_tcpip(local_20, local_38, local_3c, 0);
if (iVar1 != 0)
break;
}
if (local_20 == 0) {
pcStack88 = "requested forward not found";
sshlog("channels.c", "channel_request_rforward_cancel_tcpip", 0x1076, 1, 5,
0);
return 0xffffffff;
}
uStack80 = 0x10df1b;
local_28 = sshpkt_start(local_30, 0x50);
if (local_28 == 0) {
uStack80 = 0x10df3b;
local_28 = sshpkt_put_cstring(local_30, "cancel-tcpip-forward");
if (local_28 == 0) {
uStack80 = 0x10df55;
local_28 = sshpkt_put_u8(local_30, 0);
if (local_28 == 0) {
uStack80 = 0x10df6a;
uVar2 = channel_rfwd_bind_host(local_38);
uStack80 = 0x10df7c;
local_28 = sshpkt_put_cstring(local_30, uVar2);
if (local_28 == 0) {
uStack80 = 0x10df97;
local_28 = sshpkt_put_u32(local_30, local_3c);
if (local_28 == 0) {
uStack80 = 0x10dfac;
local_28 = sshpkt_send(local_30);
if (local_28 == 0)
goto LAB_0010dff6;
}
}
}
}
}
uStack80 = 0x10dfbf;
uVar2 = ssh_err(local_28);
ppcVar3 = &pcStack88;
pcStack88 = "send cancel";
sshfatal("channels.c", "channel_request_rforward_cancel_tcpip", 0x107f, 1, 1,
uVar2);
LAB_0010dff6:
*(undefined8 *)((long)ppcVar3 + -8) = 0x10e002;
fwd_perm_clear(local_20);
return 0;
} | openssh-portable | ghidra |
static void add_file_name(char *name, char *names[2], int operand_status[2],
int joption_count[2], int *nfiles,
int *prev_optc_status, int *optc_status) {
int n = *nfiles;
if (n == 2) {
_Bool op0 = (operand_status[0] == MUST_BE_OPERAND);
char *arg = names[op0];
switch (operand_status[op0]) {
case MUST_BE_OPERAND:
error(0, 0, gettext("extra operand %s"),
quotearg_style(shell_escape_always_quoting_style, name));
usage(1);
case MIGHT_BE_J1_ARG:
joption_count[0]--;
set_join_field(&join_field_1, string_to_join_field(arg));
break;
case MIGHT_BE_J2_ARG:
joption_count[1]--;
set_join_field(&join_field_2, string_to_join_field(arg));
break;
case MIGHT_BE_O_ARG:
add_field_list(arg);
break;
}
if (!op0) {
operand_status[0] = operand_status[1];
names[0] = names[1];
}
n = 1;
}
operand_status[n] = *prev_optc_status;
names[n] = name;
*nfiles = n + 1;
if (*prev_optc_status == MIGHT_BE_O_ARG)
*optc_status = MIGHT_BE_O_ARG;
} | void add_file_name(unsigned long long a0, unsigned long long a1[2],
unsigned int a2[2], unsigned int a3[2], unsigned int *a4,
unsigned int *a5, unsigned int *v6) {
unsigned int v0[2];
unsigned int v1[2];
unsigned long long v2[2];
char v3;
unsigned int v4;
void *v5;
unsigned long long v7;
unsigned long long v8;
unsigned int *v9;
v2[0] = a1;
*(&v1[0]) = a2;
*(&v0[0]) = a3;
v4 = *(a4);
if (v4 == 2) {
v3 = !a2[0];
v5 = a1[v3];
if (a2[v3] == 3) {
add_field_list(v5);
} else if (a2[v3] <= 3) {
if (a2[v3] == 2) {
a3[1] = a3[1] - 1;
set_join_field(&join_field_2, string_to_join_field(v5));
} else if (a2[v3] <= 2) {
if (!a2[v3]) {
v7 = quotearg_style(0x4, a0);
error(0x0, 0x0, gettext("extra operand %s"));
usage(0x1);
} else if (a2[v3] == 1) {
a3[0] = a3[0] - 1;
set_join_field(&join_field_1, string_to_join_field(v5));
}
}
}
if ((v3 ^ 1)) {
a2[0] = a2[1];
a1[0] = a1[1];
}
v4 = 1;
}
a2[v4] = *(a5);
a1[v4] = a0;
*(a4) = v4 + 1;
v8 = *(a5);
if (*(a5) == 3) {
v9 = v6;
*(v6) = 3;
}
return;
} | coreutils | angr_phoenix |
static void scan_tree(s, tree, max_code) deflate_state *s;
ct_data *tree;
int max_code;
{
int n;
int prevlen = -1;
int curlen;
int nextlen = tree[0].dl.len;
int count = 0;
int max_count = 7;
int min_count = 4;
if (nextlen == 0)
max_count = 138, min_count = 3;
tree[max_code + 1].dl.len = (ush)0xffff;
for (n = 0; n <= max_code; n++) {
curlen = nextlen;
nextlen = tree[n + 1].dl.len;
if (++count < max_count && curlen == nextlen) {
continue;
} else if (count < min_count) {
s->bl_tree[curlen].fc.freq += count;
} else if (curlen != 0) {
if (curlen != prevlen)
s->bl_tree[curlen].fc.freq++;
s->bl_tree[16].fc.freq++;
} else if (count <= 10) {
s->bl_tree[17].fc.freq++;
} else {
s->bl_tree[18].fc.freq++;
}
count = 0;
prevlen = curlen;
if (nextlen == 0) {
max_count = 138, min_count = 3;
} else if (curlen == nextlen) {
max_count = 6, min_count = 3;
} else {
max_count = 7, min_count = 4;
}
}
} | void scan_tree(struct_1 *a0, struct_2 *a1, unsigned long a2) {
unsigned int v0;
unsigned int v1;
unsigned int v2;
unsigned int v3;
unsigned int v4;
unsigned int v5;
unsigned int v6;
unsigned long long v8;
v1 = -1;
v2 = a1->field_2;
v3 = 0;
v4 = 7;
v5 = 4;
if (!v2) {
v4 = 138;
v5 = 3;
}
a1[1 + a2].field_2 = 65535;
v0 = 0;
while (true) {
v8 = v0;
if (v0 > a2)
break;
v6 = v2;
v2 = a1[1 + v0].field_2;
v3 += 1;
if (v3 >= v4 || v6 != v2) {
if (v3 < v5) {
*(&a0->padding_0[2748 + 4 * v6]) =
*(&a0->padding_0[2748 + 4 * v6]) + v3;
} else if (v6) {
if (v6 != v1)
*(&a0->padding_0[2748 + 4 * v6]) =
*(&a0->padding_0[2748 + 4 * v6]) + 1;
*(&a0->padding_0[2812]) = *(&a0->padding_0[2812]) + 1;
} else if (v3 <= 10) {
*(&a0->padding_0[0xb00]) = *(&a0->padding_0[0xb00]) + 1;
} else {
a0->field_b04 = a0->field_b04 + 1;
}
v3 = 0;
v1 = v6;
if (!v2) {
v4 = 138;
v5 = 3;
} else if (v6 == v2) {
v4 = 6;
v5 = 3;
} else {
v4 = 7;
v5 = 4;
}
}
v0 += 1;
}
return;
} | zlib | angr_sailr |
int parse_ipqos(const char *cp) {
u_int i;
char *ep;
long val;
if (cp == ((void *)0))
return -1;
for (i = 0; ipqos[i].name != ((void *)0); i++) {
if (strcasecmp(cp, ipqos[i].name) == 0)
return ipqos[i].value;
}
val = strtol(cp, &ep, 0);
if (*cp == '\0' || *ep != '\0' || val < 0 || val > 255)
return -1;
return val;
} | long long parse_ipqos(char *a0) {
unsigned int v0;
char v1;
unsigned long long v2;
unsigned long long v4;
if (!a0) {
v4 = 4294967295;
return v4;
}
for (v0 = 0; ipqos[2 * v0]; v0 += 1) {
if (!strcasecmp(a0, ipqos[2 * v0])) {
v4 = (&g_408f68)[2 * v0];
return v4;
}
}
v2 = strtol(a0, &v1, 0x0);
if (!*(a0)) {
v4 = 4294967295;
return v4;
} else if (*(*(&v1))) {
v4 = 4294967295;
return v4;
} else if ((v2 - 0 >> 63)) {
v4 = 4294967295;
return v4;
} else if (v2 > 255) {
v4 = 4294967295;
return v4;
} else {
v4 = v2;
return v4;
}
} | openssh-portable | angr_sailr |
int cron_change_user_permanently(struct passwd *pw, char *homedir) {
if (setreuid(pw->pw_uid, pw->pw_uid) != 0) {
log_it("CRON", getpid(), "ERROR", "setreuid failed", (*__errno_location()));
return -1;
}
if (chdir(homedir) == -1) {
log_it("CRON", getpid(), "ERROR chdir failed", homedir,
(*__errno_location()));
return -1;
}
log_close();
return 0;
} | long long cron_change_user_permanently(struct_0 *a0, char *a1) {
unsigned long long v4;
if (setreuid(a0->field_10, a0->field_10)) {
log_it("CRON", getpid(), "ERROR", "setreuid failed", *(__errno_location()));
v4 = 4294967295;
} else if (chdir(a1) == -1) {
log_it("CRON", getpid(), "ERROR chdir failed", a1, *(__errno_location()));
v4 = 4294967295;
} else {
log_close();
v4 = 0;
}
return v4;
} | cronie | angr_dream |
static ptrdiff_t fgrep_icase_charlen(char const *pat, idx_t patlen,
mbstate_t *mbs) {
unsigned char pat0 = pat[0];
if (localeinfo.sbctowc[pat0] != (0xffffffffu))
return ok_fold[pat0];
wchar_t wc;
size_t wn = rpl_mbrtowc(&wc, pat, patlen, mbs);
if (16 < wn)
return -1;
wchar_t folded[CASE_FOLDED_BUFSIZE];
if (case_folded_counterparts(wc, folded))
return -1;
for (idx_t i = wn; 0 < --i;) {
unsigned char c = pat[i];
if (toupper(c) != c)
return -1;
}
return wn;
} | ulong fgrep_icase_charlen(byte *param_1, undefined8 param_2, undefined8 param_3)
{
byte bVar1;
int iVar2;
uint uVar3;
ulong uVar4;
long in_FS_OFFSET;
undefined4 local_ac;
ulong local_a8;
ulong local_a0;
undefined local_98[136];
long local_10;
local_10 = *(long *)(in_FS_OFFSET + 0x28);
if (*(int *)(localeinfo + ((long)(int)(uint)*param_1 + 0x40) * 4 + 4) == -1) {
local_a0 = rpl_mbrtowc(&local_ac, param_1, param_2, param_3);
if (local_a0 < 0x11) {
iVar2 = case_folded_counterparts(local_ac, local_98);
if (iVar2 == 0) {
local_a8 = local_a0;
do {
local_a8 = local_a8 - 1;
uVar4 = local_a0;
if ((long)local_a8 < 1)
goto LAB_00103af4;
bVar1 = param_1[local_a8];
uVar3 = toupper((uint)bVar1);
} while (uVar3 == bVar1);
uVar4 = 0xffffffffffffffff;
} else {
uVar4 = 0xffffffffffffffff;
}
} else {
uVar4 = 0xffffffffffffffff;
}
} else {
uVar4 = (long)(char)ok_fold[(int)(uint)*param_1];
}
LAB_00103af4:
if (local_10 == *(long *)(in_FS_OFFSET + 0x28)) {
return uVar4;
}
__stack_chk_fail();
} | grep | ghidra |
static int depmod_load_modules(struct depmod *depmod) {
struct mod **itr, **itr_end;
log_printf(7, "load symbols (%zd modules)\n", depmod->modules.count);
itr = (struct mod **)depmod->modules.array;
itr_end = itr + depmod->modules.count;
for (; itr < itr_end; itr++) {
struct mod *mod = *itr;
struct kmod_list *l, *list = ((void *)0);
int err = kmod_module_get_symbols(mod->kmod, &list);
if (err < 0) {
if (err == -2)
log_printf(7, "ignoring %s: no symbols\n", mod->path);
else
log_printf(3, "failed to load symbols from %s: %s\n", mod->path,
strerror(-err));
goto load_info;
}
for (l = ((list) == ((void *)0)) ? ((void *)0) : (list); l != ((void *)0);
l = (l->node.next == &((list)->node))
? ((void *)0)
: ((struct kmod_list *)((char *)(l->node.next) -
__builtin_offsetof(struct kmod_list,
node)) -
((typeof(*(l->node.next)) *)0 !=
(typeof(((struct kmod_list *)0)->node) *)0))) {
const char *name = kmod_module_symbol_get_symbol(l);
uint64_t crc = kmod_module_symbol_get_crc(l);
depmod_symbol_add(depmod, name, 0, crc, mod);
}
kmod_module_symbols_free_list(list);
load_info:
kmod_module_get_info(mod->kmod, &mod->info_list);
kmod_module_get_dependency_symbols(mod->kmod, &mod->dep_sym_list);
kmod_module_unref(mod->kmod);
mod->kmod = ((void *)0);
}
log_printf(7, "loaded symbols (%zd modules, %u symbols)\n",
depmod->modules.count, hash_get_count(depmod->symbols));
return 0;
} | int depmod_load_modules(unsigned long long a0[9], unsigned long a1,
unsigned long a2, unsigned long long a3,
unsigned long long a4) {
unsigned int v0;
void *v1;
unsigned long long *v2;
void *v3;
unsigned long v4;
unsigned long long v5[2];
void *v6;
unsigned int v7;
void *v9;
log_printf(0x7, "load symbols (%zd modules)\n", a0[3], a3, a4);
v2 = a0[2];
for (v4 = &v2[a0[3]]; v2 < v4; v2 += 1) {
v5[0] = *(v2);
v1 = 0;
v0 = kmod_module_get_symbols(v5[0], &v1, &v1);
if (v0 >= 0) {
for (v3 = v1; v3; v3 = v9) {
v6 = kmod_module_symbol_get_symbol(v3);
*(&v7) = kmod_module_symbol_get_crc(v3);
depmod_symbol_add(a0, v6, 0x0, *(&v7), v5);
if (*(v3) != v1)
v9 = *(v3);
else
v9 = 0;
}
kmod_module_symbols_free_list(v1);
} else if (v0 == -2) {
log_printf(0x7, "ignoring %s: no symbols\n", v5[1], a3, v5);
} else {
log_printf(0x3, "failed to load symbols from %s: %s\n", v5[1],
strerror(-(v0)), v5);
}
kmod_module_get_info(v5[0], v5 + 2, v5 + 2);
kmod_module_get_dependency_symbols(v5[0], &v5[2 + 1], &v5[2 + 1]);
kmod_module_unref(v5[0]);
v5[0] = 0;
}
log_printf(0x7, "loaded symbols (%zd modules, %u symbols)\n", a0[3],
hash_get_count(a0[8]), v5);
return 0;
} | kmod | angr_dream |
static void conread(int s) {
con *c = &fdcon[s];
size_t n;
if (c->c_status == 1) {
congreet(s);
return;
}
n = atomicio(read, s, c->c_data + c->c_off, c->c_len - c->c_off);
if (n == 0) {
sshlog("ssh-keyscan.c", __func__, 571, 0, SYSLOG_LEVEL_ERROR, ((void *)0),
"read (%s): %s", c->c_name, strerror((*__errno_location())));
confree(s);
return;
}
c->c_off += n;
if (c->c_off == c->c_len)
switch (c->c_status) {
case 2:
c->c_plen = htonl(c->c_plen);
c->c_len = c->c_plen + 8 - (c->c_plen & 7);
c->c_off = 0;
c->c_data = xmalloc(c->c_len);
c->c_status = 3;
break;
default:
sshfatal("ssh-keyscan.c", __func__, 587, 0, SYSLOG_LEVEL_FATAL,
((void *)0), "conread: invalid status %d", c->c_status);
break;
}
contouch(s);
} | void conread(unsigned long a0) {
unsigned long v0;
struct_0 *v1;
unsigned long v2;
unsigned long long v4;
unsigned long long v5;
unsigned long long v6;
unsigned long long v7;
unsigned long long v8;
unsigned long long v9;
v1 = a0 * 112 + 7267821926853935944;
if (v1->field_0 == 1) {
v4 = congreet(a0);
return;
}
v2 = atomicio(got.read, a0, v1->field_40 + v1->field_10,
__subvsi3(v1->field_c, v1->field_10, v1->field_10));
if (!v2) {
strerror(*(__errno_location()));
sshlog("ssh-keyscan.c", "conread", 0x23b, 0x0, 0x2, 0x0, "read (%s): %s",
v1->field_28);
v8 = confree(a0);
return;
}
v1->field_10 = v2 + v1->field_10;
if (v1->field_10 == v1->field_c) {
if (v1->field_0 != 2) {
v0 = v1->field_0;
sshfatal("ssh-keyscan.c", "conread", 0x24b, 0x0, 0x1, 0x0,
"conread: invalid status %d");
}
v5 = htonl(v1->field_8);
v1->field_8 = v5;
v7 = __addvsi3(v1->field_8, 0x8, v5, v6);
v1->field_c = __subvsi3(v7, v1->field_8 & 7, v7);
v1->field_10 = 0;
v1->field_40 = xmalloc(v1->field_c);
v1->field_0 = 3;
}
v9 = contouch(a0);
return;
} | openssh-portable | angr_sailr |
void bash_history_disable() {
remember_on_history = 0;
history_expansion_inhibited = 1;
} | long long bash_history_disable() {
unsigned long v1;
remember_on_history = 0;
dont_save_function_defs = 1;
return v1;
} | bash | angr_phoenix |
inline int ext2fs_test_inode_bitmap2(ext2fs_inode_bitmap bitmap,
ext2_ino_t inode) {
return ext2fs_test_generic_bmap((ext2fs_generic_bitmap)bitmap, inode);
} | void ext2fs_test_inode_bitmap2(void)
{
halt_baddata();
} | e2fsprogs-1.46.5 | ghidra |
static int errno_to_portable(int unixerrno) {
int ret = 0;
switch (unixerrno) {
case 0:
ret = 0;
break;
case 2:
case 20:
case 9:
case 40:
ret = 2;
break;
case 1:
case 13:
case 14:
ret = 3;
break;
case 36:
case 22:
ret = 5;
break;
case 38:
ret = 8;
break;
default:
ret = 4;
break;
}
return ret;
} | undefined4 errno_to_portable(undefined4 param_1)
{
undefined4 local_c;
switch (param_1) {
case 0:
local_c = 0;
break;
case 1:
case 0xd:
case 0xe:
local_c = 3;
break;
case 2:
case 9:
case 0x14:
case 0x28:
local_c = 2;
break;
default:
local_c = 4;
break;
case 0x16:
case 0x24:
local_c = 5;
break;
case 0x26:
local_c = 8;
}
return local_c;
} | openssh-portable | ghidra |
static char *get_tmpdir(flags)
int flags;
{
char *tdir;
tdir = (flags & 0x0001) ? get_string_value("TMPDIR") : (char *)((void *)0);
if (tdir && (file_iswdir(tdir) == 0 || strlen(tdir) > 4096))
tdir = 0;
if (tdir == 0)
tdir = get_sys_tmpdir();
if (tmpnamelen == -1)
tmpnamelen = pathconf(tdir, _PC_NAME_MAX);
return tdir;
} | int get_tmpdir(unsigned long a0) {
void *v0;
void *v2;
unsigned long long v3;
if ((a0 & 1))
v2 = get_string_value("TMPDIR");
else
v2 = 0;
v0 = v2;
if (v0) {
v3 = file_iswdir(v0);
if (!v3 || strlen(v0) > 0x1000)
v0 = 0;
}
if (!v0)
*(&v0) = get_sys_tmpdir();
if (tmpnamelen == -1)
tmpnamelen = pathconf(v0, 0x3);
return v0;
} | bash | angr_dream |
static int do_dump(int ifindex) {
struct {
struct nlmsghdr n;
struct genlmsghdr g;
char buf[(((0) + 4U - 1) & ~(4U - 1)) + (1024)];
} req = {
.n =
{
.nlmsg_type = (genl_family),
.nlmsg_flags = (0x01 | (0x100 | 0x200)),
.nlmsg_len =
(((((sizeof(struct genlmsghdr)) + 4U - 1) & ~(4U - 1)) +
(0)) +
((int)(((sizeof(struct nlmsghdr)) + 4U - 1) & ~(4U - 1)))),
},
.g =
{
.cmd = (MACSEC_CMD_GET_TXSC),
.version = (1),
},
};
memset(&filter, 0, sizeof(filter));
filter.ifindex = ifindex;
req.n.nlmsg_seq = genl_rth.dump = ++genl_rth.seq;
if (rtnl_send(&genl_rth, &req, req.n.nlmsg_len) < 0) {
perror("Failed to send dump request");
exit(1);
}
new_json_obj(json);
if (rtnl_dump_filter_nc(&genl_rth, process, stdout, 0) < 0) {
delete_json_obj();
fprintf(stderr, "Dump terminated\n");
exit(1);
}
delete_json_obj();
return 0;
} | long do_dump(int a1) {
int v2[262];
unsigned long v3;
v3 = __readfsqword(0x28u);
memset(v2, 0, 1044);
v2[0] = 20;
LOWORD(v2[1]) = genl_family;
HIWORD(v2[1]) = 769;
BYTE1(v2[4]) = 1;
memset(&filter, 0, 0x10uLL);
filter = a1;
dword_40C0 = ++dword_40BC;
v2[2] = dword_40BC;
if ((int)rtnl_send(&genl_rth, v2, 20LL) < 0) {
perror("Failed to send dump request");
exit(1);
}
new_json_obj(json);
if ((int)rtnl_dump_filter_nc(&genl_rth, process, stdout, 0LL) < 0) {
delete_json_obj();
fprintf(stderr, "Dump terminated\n");
exit(1);
}
delete_json_obj();
return 0LL;
} | iproute2-6.0.0 | ida |
static void tarobject_skip_padding(struct tarcontext *tc,
struct tar_entry *te) {
struct dpkg_error err;
size_t r;
r = te->size % 512;
if (r == 0)
return;
if (buffer_skip_Int(tc->backendpipe, 0, 512 - r, &err) < 0)
ohshit(gettext("cannot skip padding for file '%.255s': %s"), te->name,
err.str);
} | unsigned long tarobject_skip_padding(unsigned int *a1, long a2) {
long v2;
long v3;
char *v4;
long v6;
char v7[8];
long v8;
unsigned long v9;
v9 = __readfsqword(0x28u);
v6 = *(_QWORD *)(a2 + 24) % 512LL;
if (v6 && buffer_skip_Int(*a1, 0LL, 512 - v6, v7) < 0) {
v2 = v8;
v3 = *(_QWORD *)(a2 + 8);
v4 = gettext("cannot skip padding for file '%.255s': %s");
ohshit(v4, v3, v2);
}
return __readfsqword(0x28u) ^ v9;
} | dpkg | ida |
int rl_quoted_insert(int count, int key) {
if ((rl_readline_state & (0x0080000)) == 0)
_rl_disable_tty_signals();
if ((rl_readline_state & (0x0080000))) {
_rl_callback_data = _rl_callback_data_alloc(count);
_rl_callback_func = _rl_insert_next_callback;
return (0);
}
if (count < 0) {
int r;
do
r = _rl_insert_next(1);
while (r == 0 && ++count < 0);
return r;
}
return _rl_insert_next(count);
} | long long rl_quoted_insert(unsigned long a0, unsigned long a1) {
unsigned int v0;
unsigned int v1;
unsigned int v2;
void *v4;
v1 = a0;
v0 = a1;
if (!(rl_readline_state & 0x80000))
_rl_disable_tty_signals();
if ((rl_readline_state & 0x80000)) {
_rl_callback_data = _rl_callback_data_alloc(v1);
_rl_callback_func = _rl_insert_next_callback;
v4 = 0;
} else if (v1 < 0) {
do {
v2 = _rl_insert_next(0x1);
if (v2)
break;
v1 += 1;
} while (v1 < 0);
v4 = v2;
} else {
v4 = _rl_insert_next(v1);
}
return v4;
} | bash | angr_dream |
static void bond_print_xstats_help(struct link_util *lu, FILE *f) {
fprintf(f, "Usage: ... %s [ 802.3ad ] [ dev DEVICE ]\n", lu->id);
} | void bond_print_xstats_help(struct_0 *a0, void *a1) {
unsigned long long v1;
v1 = fprintf(a1, "Usage: ... %s [ 802.3ad ] [ dev DEVICE ]\n", a0->field_8);
return;
} | iproute2-6.0.0 | angr_dream |
static size_t tab_from_to(size_t from, size_t to) {
FILE *out = outfile;
size_t tab;
size_t tab_size = tabsize;
if (!expand_tabs)
for (tab = from + tab_size - from % tab_size; tab <= to; tab += tab_size) {
putc_unlocked('\t', out);
from = tab;
}
while (from++ < to)
putc_unlocked(' ', out);
return to;
} | int tab_from_to(unsigned long long a0, unsigned long a1) {
unsigned long long v0;
unsigned long v1;
void *v2;
unsigned long v3;
unsigned long long v5;
v0 = a0;
v2 = outfile;
v3 = tabsize;
if ((expand_tabs ^ 1)) {
for (v1 = v0 + v3 - ((0 CONCAT v0) / m v3 >> 64); v1 <= a1; v1 += v3) {
putc_unlocked(0x9, v2);
v0 = v1;
}
}
while (true) {
v5 = v0;
v0 += 1;
if (a1 <= v5)
break;
putc_unlocked(0x20, v2);
}
return a1;
} | diffutils | angr_sailr |
static void xfields(struct line *line) {
char *ptr = line->buf.buffer;
char const *lim = ptr + line->buf.length - 1;
if (ptr == lim)
return;
if (0 <= tab && tab != '\n') {
char *sep;
for (; (sep = memchr(ptr, tab, lim - ptr)) != ((void *)0); ptr = sep + 1)
extract_field(line, ptr, sep - ptr);
} else if (tab < 0) {
while (field_sep(*ptr))
if (++ptr == lim)
return;
do {
char *sep;
for (sep = ptr + 1; sep != lim && !field_sep(*sep); sep++)
continue;
extract_field(line, ptr, sep - ptr);
if (sep == lim)
return;
for (ptr = sep + 1; ptr != lim && field_sep(*ptr); ptr++)
continue;
} while (ptr != lim);
}
extract_field(line, ptr, lim - ptr);
} | void xfields(unsigned long long a0[3]) {
char *v0;
char *v1;
unsigned long v2;
unsigned long v3;
char *v5;
unsigned long long v6;
v0 = a0[2];
v2 = &v0[1 + a0[1]];
v5 = v0;
if (v0 == v2)
return;
if (!(tab < 0 || tab == 10)) {
while (true) {
v3 = memchr(v0, tab, v2 + -0x1 * v0);
if (!v3)
break;
extract_field(a0, v0, v3 + -0x1 * v0);
v0 = v3 + 1;
}
} else if (tab < 0) {
while (field_sep(*(v0))) {
v0 += 1;
v5 = v0;
if (v0 == v2)
return;
}
do {
for (v1 = v0 + 1; v1 != v2 && (*(&v5) = (field_sep(*(v1)) ^ 1), v5);
v1 += 1)
;
extract_field(a0, v0, v1 - v0);
v5 = v1;
if (v1 == v2)
return;
for (v0 = v1 + 1; v0 != v2 && field_sep(*(v0)); v0 += 1)
;
} while (v0 != v2);
}
v6 = extract_field(a0, v0, v2 + -0x1 * v0);
return;
} | coreutils | angr_sailr |
static void process_flags(int argc, char **argv) {
int c;
static struct option long_options[] = {{"help", 0, ((void *)0), 'h'},
{"root", 1, ((void *)0), 'R'},
{((void *)0), 0, ((void *)0), '\0'}};
while ((c = getopt_long(argc, argv, "hR:", long_options, ((void *)0))) !=
-1) {
switch (c) {
case 'h':
usage(0);
break;
case 'R':
break;
default:
usage(2);
}
}
if (optind != argc) {
usage(2);
}
} | void process_flags(unsigned long a0, char **a1) {
unsigned int v0;
unsigned long long v2;
while (true) {
v0 = getopt_long(a0, a1, "hR:", &long_options.5670, NULL);
if (v0 != -1) {
if (v0 == 82)
continue;
if (v0 == 104)
usage(0x0);
usage(0x2);
} else {
v2 = optind;
if (a0 != optind)
usage(0x2);
return;
}
}
} | shadow | angr_dream |
static int inflateStateCheck(strm)
z_streamp strm;
{
struct inflate_state *state;
if (strm == 0 || strm->zalloc == (alloc_func)0 || strm->zfree == (free_func)0)
return 1;
state = (struct inflate_state *)strm->state;
if (state == 0 || state->strm != strm || state->mode < HEAD ||
state->mode > SYNC)
return 1;
return 0;
} | undefined8 inflateStateCheck(long param_1)
{
long *plVar1;
undefined8 uVar2;
if (((param_1 == 0) || (*(long *)(param_1 + 0x40) == 0)) ||
(*(long *)(param_1 + 0x48) == 0)) {
uVar2 = 1;
} else {
plVar1 = *(long **)(param_1 + 0x38);
if (((plVar1 == (long *)0x0) || (param_1 != *plVar1)) ||
((*(uint *)(plVar1 + 1) < 0x3f34 ||
(0x3f53 < *(uint *)(plVar1 + 1))))) {
uVar2 = 1;
} else {
uVar2 = 0;
}
}
return uVar2;
} | zlib | ghidra |
void ifsfree(void) {
struct ifsregion *p = ifsfirst.next;
if (!p)
goto out;
({
suppressint++;
({ __asm__ __volatile__("" : : : "memory"); });
0;
});
do {
struct ifsregion *ifsp;
ifsp = p->next;
free((pointer)(p));
p = ifsp;
} while (p);
ifsfirst.next = ((void *)0);
({
({ __asm__ __volatile__("" : : : "memory"); });
if (--suppressint == 0 && intpending)
onint();
0;
});
out:
ifslastp = ((void *)0);
} | void ifsfree() {
unsigned long long *v0;
void *v1;
unsigned long long v3;
unsigned long long v4;
unsigned long long v5;
unsigned long long v6;
v3 = ifsfirst;
v0 = ifsfirst;
if (v0) {
suppressint = suppressint + 1;
do {
v1 = *(v0);
free(v0);
v0 = v1;
} while (v0);
ifsfirst = 0;
suppressint = suppressint - 1;
v4 = suppressint;
v5 = intpending;
v6 = onint();
}
ifslastp = 0;
return;
} | dash-0.5.11+git20210903+057cd650a4ed | angr_phoenix |
void fprint_off(file, offset, width) FILE *file;
off_t offset;
int width;
{
char buf[8 * sizeof(off_t)];
char *p = buf + sizeof buf;
if (offset < 0) {
do
*--p = '0' - offset % 10;
while ((offset /= 10) != 0);
*--p = '-';
} else {
do
*--p = '0' + offset % 10;
while ((offset /= 10) != 0);
}
width -= buf + sizeof buf - p;
while (0 < width--) {
putc(' ', file);
}
for (; p < buf + sizeof buf; p++)
putc(*p, file);
} | void fprint_off(FILE *param_1, long param_2, int param_3)
{
char *pcVar1;
long in_FS_OFFSET;
int local_7c;
long local_78;
char *local_60;
undefined local_58[62];
char acStack26[10];
long local_10;
local_10 = *(long *)(in_FS_OFFSET + 0x28);
local_60 = acStack26 + 2;
local_78 = param_2;
pcVar1 = local_60;
if (param_2 < 0) {
do {
local_60 = pcVar1;
local_60[-1] = '0' - ((char)local_78 + (char)(local_78 / 10) * -10);
local_78 = local_78 / 10;
pcVar1 = local_60 + -1;
} while (local_78 != 0);
local_60 = local_60 + -2;
*local_60 = '-';
} else {
do {
local_60 = local_60 + -1;
*local_60 = (char)local_78 + (char)(local_78 / 10) * -10 + '0';
local_78 = local_78 / 10;
} while (local_78 != 0);
}
local_7c = param_3 - (((int)local_58 + 0x40) - (int)local_60);
while (0 < local_7c) {
putc(0x20, param_1);
local_7c = local_7c + -1;
}
for (; local_60 < acStack26 + 2; local_60 = local_60 + 1) {
putc((int)*local_60, param_1);
}
if (local_10 == *(long *)(in_FS_OFFSET + 0x28)) {
return;
}
__stack_chk_fail();
} | gzip-1.12 | ghidra |
int bcrypt_pbkdf(const char *pass, size_t passlen, const uint8_t *salt,
size_t saltlen, uint8_t *key, size_t keylen,
unsigned int rounds) {
uint8_t sha2pass[64U];
uint8_t sha2salt[64U];
uint8_t out[(8 * 4)];
uint8_t tmpout[(8 * 4)];
uint8_t *countsalt;
size_t i, j, amt, stride;
uint32_t count;
size_t origkeylen = keylen;
if (rounds < 1)
goto bad;
if (passlen == 0 || saltlen == 0 || keylen == 0 ||
keylen > sizeof(out) * sizeof(out) || saltlen > 1 << 20)
goto bad;
if ((countsalt = calloc(1, saltlen + 4)) == ((void *)0))
goto bad;
stride = (keylen + sizeof(out) - 1) / sizeof(out);
amt = (keylen + stride - 1) / stride;
memcpy(countsalt, salt, saltlen);
crypto_hash_sha512(sha2pass, pass, passlen);
for (count = 1; keylen > 0; count++) {
countsalt[saltlen + 0] = (count >> 24) & 0xff;
countsalt[saltlen + 1] = (count >> 16) & 0xff;
countsalt[saltlen + 2] = (count >> 8) & 0xff;
countsalt[saltlen + 3] = count & 0xff;
crypto_hash_sha512(sha2salt, countsalt, saltlen + 4);
bcrypt_hash(sha2pass, sha2salt, tmpout);
memcpy(out, tmpout, sizeof(out));
for (i = 1; i < rounds; i++) {
crypto_hash_sha512(sha2salt, tmpout, sizeof(tmpout));
bcrypt_hash(sha2pass, sha2salt, tmpout);
for (j = 0; j < sizeof(out); j++)
out[j] ^= tmpout[j];
}
amt = (((amt) < (keylen)) ? (amt) : (keylen));
for (i = 0; i < amt; i++) {
size_t dest = i * stride + (count - 1);
if (dest >= origkeylen)
break;
key[dest] = out[i];
}
keylen -= i;
}
freezero(countsalt, saltlen + 4);
explicit_bzero(out, sizeof(out));
explicit_bzero(tmpout, sizeof(tmpout));
return 0;
bad:
arc4random_buf(key, keylen);
return -1;
} | long long bcrypt_pbkdf(unsigned long long a0, unsigned long long a1, void *a2,
char *a3, unsigned long long a4, unsigned long long a5,
unsigned int v13) {
unsigned long long v0;
unsigned int v1;
void *v2;
void *v3;
unsigned long v4;
unsigned long v5;
char *v6;
unsigned long long v7;
char *v8;
char v9;
char v10;
char v11;
char v12;
unsigned long long v14;
unsigned long long v15;
v0 = a5;
v5 = v0;
if (v13 && a1 && a3 && v0 && v0 <= 0x400 && a3 <= 0x100000) {
v6 = calloc(0x1, a3 + 4);
if (v6) {
v7 = v0 + 31 >> 5;
v4 = (0 CONCAT v7 + v0 - 1) / m v7;
memcpy(v6, a2, a3);
crypto_hash_sha512(&v11, a0, a1, a0);
for (v1 = 1; v0; v1 += 1) {
*((a3 + v6)) = v1 >> 24;
*((v6 + a3 + 1)) = v1 >> 16;
*((v6 + a3 + 2)) = v1 >> 8;
*((v6 + a3 + 3)) = v1;
crypto_hash_sha512(&v12, v6, a3 + 4, v6);
bcrypt_hash(&v11, &v12, &v10);
memcpy(&v9, &v10, 0x20);
for (v2 = 1; v2 < v13; v2 += 1) {
crypto_hash_sha512(&v12, &v10, 0x20, &v10);
bcrypt_hash(&v11, &v12, &v10);
for (v3 = 0; v3 <= 31; v3 += 1) {
*((v3 + &v9)) = *((v3 + &v9)) ^ *((v3 + &v10));
}
}
v15 = v4;
if (v0 <= v4)
v15 = v0;
v4 = v15;
for (v2 = 0; v2 < v4; v2 += 1) {
v8 = v7 * v2 + v1 - 1;
if (v8 >= v5)
break;
v8[a4] = *((v2 + &v9));
}
v0 -= v2;
}
freezero(v6, a3 + 4, a3 + 4);
explicit_bzero(&v9, 0x20);
explicit_bzero(&v10, 0x20);
v14 = 0;
}
}
if (!a3 || !a1 || !v6 || !v13 || !v0 || v0 > 0x400 || a3 > 0x100000) {
arc4random_buf(a4, v0, v0);
v14 = 4294967295;
}
return v14;
} | openssh-portable | angr_dream |
static void index__checkstring(const char *str) {
int i;
for (i = 0; str[i]; i++) {
int ch = str[i];
if (ch >= 128)
log_printf(2,
"Module index: bad character '%c'=0x%x - only 7-bit ASCII is "
"supported:"
"\n%s\n",
(char)ch, (int)ch, str);
}
} | void index__checkstring(char *a0) {
unsigned int v0;
unsigned int v1;
unsigned long long v3;
v0 = 0;
while (true) {
v3 = a0[v0];
if (!a0[v0])
break;
v1 = a0[v0];
if (v1 > 127)
log_printf(0x2,
"Module index: bad character '%c'=0x%x - only 7-bit ASCII is "
"supported:\n%s\n",
v1, v1, a0);
v0 += 1;
}
return;
} | kmod | angr_dream |
int xfrm_parse_mark(struct xfrm_mark *mark, int *argcp, char ***argvp) {
int argc = *argcp;
char **argv = *argvp;
do {
argv++;
if (--argc <= 0)
incomplete_command();
} while (0);
if (get_u32(&mark->v, *argv, 0)) {
invarg("MARK value is invalid\n", *argv);
}
if (argc > 1)
do {
argv++;
if (--argc <= 0)
incomplete_command();
} while (0);
else {
mark->m = 0xffffffff;
goto done;
}
if (strcmp(*argv, "mask") == 0) {
do {
argv++;
if (--argc <= 0)
incomplete_command();
} while (0);
if (get_u32(&mark->m, *argv, 0)) {
invarg("MASK value is invalid\n", *argv);
}
} else {
mark->m = 0xffffffff;
do {
argv--;
argc++;
} while (0);
}
done:
*argcp = argc;
*argvp = argv;
return 0;
} | long long xfrm_parse_mark(struct_0 *a0, unsigned int *a1,
unsigned long long *a2) {
unsigned int v0;
unsigned long long *v1;
v0 = *(a1);
v1 = *(a2);
v1 += 8;
v0 -= 1;
if (v0 <= 0)
incomplete_command();
if (get_u32(a0, *(v1), 0x0, *(v1)))
invarg("MARK value is invalid\n", *(v1));
if (v0 <= 1) {
LABEL_401ab5:
a0->field_4 = -1;
} else {
v1 += 8;
v0 -= 1;
if (v0 > 0) {
if (!strcmp(*(v1), "mask")) {
v1 += 8;
v0 -= 1;
if (v0 <= 0)
incomplete_command();
if (!get_u32(&a0->field_4, *(v1), 0x0, &a0->field_4))
goto LABEL_401b3d;
invarg("MASK value is invalid\n", *(v1));
}
a0->field_4 = -1;
v1 += 1;
v0 += 1;
} else {
incomplete_command();
goto LABEL_401ab5;
}
}
LABEL_401b3d:
*(a1) = v0;
*(a2) = v1;
return 0;
} | iproute2-6.0.0 | angr_phoenix |
SHELL_VAR *array_variable_part(s, flags, subp, lenp) const char *s;
int flags;
char **subp;
int *lenp;
{
char *t;
SHELL_VAR *var;
t = array_variable_name(s, flags, subp, lenp);
if (t == 0)
return ((SHELL_VAR *)((void *)0));
var = find_variable(t);
sh_xfree((t), "arrayfunc.c", 1453);
return var;
} | undefined8 array_variable_part(undefined8 param_1, undefined4 param_2,
undefined8 param_3, undefined8 param_4)
{
long lVar1;
undefined8 uVar2;
lVar1 = array_variable_name(param_1, param_2, param_3, param_4);
if (lVar1 == 0) {
uVar2 = 0;
} else {
uVar2 = find_variable(lVar1);
sh_xfree(lVar1, "arrayfunc.c", 0x5ad);
}
return uVar2;
} | bash | ghidra |
static struct lvalue *alloc_lvalue() {
struct lvalue *lv;
lv = sh_xmalloc((sizeof(struct lvalue)), "expr.c", 1128);
init_lvalue(lv);
return (lv);
} | long long alloc_lvalue() {
void *v0;
v0 = sh_xmalloc(0x20, "expr.c", 0x468);
init_lvalue(v0);
return v0;
} | bash | angr_dream |
static void print_proto_down(FILE *f, struct rtattr *tb[]) {
struct rtattr *preason[IFLA_PROTO_DOWN_REASON_MAX + 1];
if (tb[IFLA_PROTO_DOWN]) {
if (rta_getattr_u8(tb[IFLA_PROTO_DOWN]))
print_bool(PRINT_ANY, "proto_down", " protodown on ", 1);
}
if (tb[IFLA_PROTO_DOWN_REASON]) {
char buf[255];
__u32 reason;
int i, start = 1;
(parse_rtattr_flags(
(preason), (IFLA_PROTO_DOWN_REASON_MAX),
((void *)(((char *)(tb[IFLA_PROTO_DOWN_REASON])) +
((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0)))),
((int)((tb[IFLA_PROTO_DOWN_REASON])->rta_len) -
((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0))),
(1 << 15)));
if (!tb[IFLA_PROTO_DOWN_REASON_VALUE])
return;
reason = rta_getattr_u8(preason[IFLA_PROTO_DOWN_REASON_VALUE]);
if (!reason)
return;
open_json_array(PRINT_ANY, is_json_context() ? "proto_down_reason"
: "protodown_reason <");
for (i = 0; reason; i++, reason >>= 1) {
if (reason & 0x1) {
if (protodown_reason_n2a(i, buf, sizeof(buf)))
break;
print_string(PRINT_ANY, ((void *)0), start ? "%s" : ",%s", buf);
start = 0;
}
}
close_json_array(PRINT_ANY, ">");
}
} | void print_proto_down(undefined8 param_1, long param_2)
{
bool bVar1;
char cVar2;
byte bVar3;
int iVar4;
char *pcVar5;
undefined *puVar6;
undefined8 in_R9;
long in_FS_OFFSET;
uint local_144;
int local_140;
undefined local_138[16];
undefined8 local_128;
undefined local_118[264];
long local_10;
local_10 = *(long *)(in_FS_OFFSET + 0x28);
if ((*(long *)(param_2 + 0x138) != 0) &&
(cVar2 = rta_getattr_u8(*(undefined8 *)(param_2 + 0x138)),
cVar2 != '\0')) {
print_bool(4, "proto_down", " protodown on ", 1);
}
if (*(long *)(param_2 + 0x1b8) != 0) {
bVar1 = true;
parse_rtattr_flags(local_138, 2, *(long *)(param_2 + 0x1b8) + 4,
**(ushort **)(param_2 + 0x1b8) - 4, 0x8000, in_R9,
param_2, param_1);
if (*(long *)(param_2 + 0x10) != 0) {
bVar3 = rta_getattr_u8(local_128);
local_144 = (uint)bVar3;
if (local_144 != 0) {
cVar2 = is_json_context();
if (cVar2 == '\0') {
pcVar5 = "protodown_reason <";
} else {
pcVar5 = "proto_down_reason";
}
open_json_array(4, pcVar5);
local_140 = 0;
for (; local_144 != 0; local_144 = local_144 >> 1) {
if ((local_144 & 1) != 0) {
iVar4 = protodown_reason_n2a(local_140, local_118, 0xff);
if (iVar4 != 0)
break;
if (bVar1) {
puVar6 = &DAT_00108b24;
} else {
puVar6 = &DAT_00108bcd;
}
print_string(4, 0, puVar6, local_118);
bVar1 = false;
}
local_140 = local_140 + 1;
}
close_json_array(4, &DAT_001092a5);
}
}
}
if (local_10 == *(long *)(in_FS_OFFSET + 0x28)) {
return;
}
__stack_chk_fail();
} | iproute2-6.0.0 | ghidra |
0
)
do {
fprintf(stderr,
gettext("Try '%s --help' for more information.\n"),
program_name);
}
while (0)
; | int fprintf(FILE *__stream, char *__format, ...)
{
halt_baddata();
} | coreutils | ghidra |
void finish_output(void) {
if (outfile != 0 && outfile != stdout) {
int status;
int wstatus;
int werrno = 0;
if (ferror_unlocked(outfile))
fatal("write failed");
if (fclose(outfile) != 0)
pfatal_with_name(gettext("write failed"));
if (waitpid(pr_pid, &wstatus, 0) < 0)
pfatal_with_name("waitpid");
status = (!werrno && (((wstatus) & 0x7f) == 0)
? (((wstatus) & 0xff00) >> 8)
: 0x7fffffff);
if (status)
((!!sizeof(struct {
_Static_assert(
2,
"verify_expr ("
"2"
", "
"(error (2, werrno, gettext (status == 126 ? \"subsidiary program "
"'%s' could not be invoked\" : status == 127 ? \"subsidiary "
"program '%s' not found\" : status == 0x7fffffff ? \"subsidiary "
"program '%s' failed\" : \"subsidiary program '%s' failed (exit "
"status %d)\"), pr_program, status), assume (false))"
")");
int _gl_dummy;
}))
? ((error(
2, werrno,
gettext(
status == 126
? "subsidiary program '%s' could not be invoked"
: status == 127 ? "subsidiary program '%s' not found"
: status == 0x7fffffff
? "subsidiary program '%s' failed"
: "subsidiary program '%s' failed (exit status %d)"),
pr_program, status),
((0) ? (void)0 : __builtin_unreachable())))
: ((error(
2, werrno,
gettext(
status == 126
? "subsidiary program '%s' could not be invoked"
: status == 127 ? "subsidiary program '%s' not found"
: status == 0x7fffffff
? "subsidiary program '%s' failed"
: "subsidiary program '%s' failed (exit status %d)"),
pr_program, status),
((0) ? (void)0 : __builtin_unreachable()))))
;
}
outfile = 0;
} | long long finish_output() {
char v0;
unsigned int v1;
unsigned int v2;
unsigned int v4;
if (outfile && outfile != stdout) {
v1 = 0;
if (ferror_unlocked(outfile)) {
fatal("write failed");
} else if (fclose(outfile)) {
pfatal_with_name(gettext("write failed"));
} else if (waitpid(pr_pid, &v0, 0x0) < 0) {
pfatal_with_name("waitpid");
} else {
if (v1 || (*(&v0) & 127))
v4 = 2147483647;
else
v4 = *(&v0) >> 8;
v2 = v4;
if (v2)
error(
0x2, v1,
gettext((v2 == 126
? (v2 == 127 ? (v2 == 2147483647
? "subsidiary program '%s' failed "
"(exit status %d)"
: "subsidiary program '%s' failed")
: "subsidiary program '%s' not found")
: "subsidiary program '%s' could not be invoked")));
}
}
outfile = 0;
return 0;
} | diffutils | angr_sailr |
const u_char *ssh_output_ptr(struct ssh *ssh, size_t *len) {
struct sshbuf *output = ssh_packet_get_output(ssh);
*len = sshbuf_len(output);
return sshbuf_ptr(output);
} | long ssh_output_ptr(long a1, _QWORD *a2) {
long output;
output = ssh_packet_get_output(a1);
*a2 = sshbuf_len(output);
return sshbuf_ptr(output);
} | openssh-portable | ida |
char *remove_quoted_nulls(string)
char *string;
{
register size_t slen;
register int i, j, prev_i;
mbstate_t state;
memset(&state, '\0', sizeof(mbstate_t));
if (strchr(string, '\177') == 0)
return string;
slen = strlen(string);
i = j = 0;
while (i < slen) {
if (string[i] == '\001') {
i++;
string[j++] = '\001';
if (i == slen)
break;
} else if (string[i] == '\177') {
i++;
continue;
}
prev_i = i;
do {
if (locale_mb_cur_max > 1) {
mbstate_t state_bak;
size_t mblength;
int _f;
_f = is_basic((string)[i]);
if (_f)
mblength = 1;
else if (locale_utf8locale && (((string)[i] & 0x80) == 0))
mblength = (string)[i] != 0;
else {
state_bak = state;
mblength = mbrlen((string) + (i), (slen) - (i), &state);
}
if (mblength == (size_t)-2 || mblength == (size_t)-1) {
state = state_bak;
(i)++;
} else if (mblength == 0)
(i)++;
else
(i) += mblength;
} else
(i)++;
} while (0);
if (j < prev_i) {
do
string[j++] = string[prev_i++];
while (prev_i < i);
} else
j = i;
}
string[j] = '\0';
return (string);
} | void remove_quoted_nulls(void *a0) {
int tmp_17;
unsigned int v0;
int tmp_13;
int tmp_30;
unsigned long long v1;
unsigned long long v2;
unsigned long long v3;
unsigned long long v5;
void *v6;
unsigned long long v7;
void *v8;
void *v9;
void *v10;
void *v11;
memset(&v2, 0x0, 0x8);
v5 = strchr(a0, 0x7f);
if (!v5) {
v6 = a0;
} else {
v7 = strlen(a0);
v9 = 0;
v8 = 0;
while (v7 > v8) {
if (*((a0 + v8)) == 1) {
v8 = v8 + 1;
tmp_17 = v9;
v9 += 1;
*(a0 + tmp_17) = 1;
if (v7 == v8)
break;
} else if (*((a0 + v8)) == 127) {
v8 = v8 + 1;
continue;
}
if (*((a0 + v8)) == 1 && v7 != v8 ||
*((a0 + v8)) != 1 && *((a0 + v8)) != 127) {
v10 = v8;
if (locale_mb_cur_max > 1) {
v0 = is_basic(*((a0 + v8)));
if (v0) {
v1 = 1;
} else {
if (locale_utf8locale && *((a0 + v8)) >= 0)
v1 = *((a0 + v8));
if (*((a0 + v8)) < 0 || !locale_utf8locale) {
v3 = v2;
v1 = mbrlen(v8 + a0, v7 - v8, &v2, v8 + a0);
}
}
if (v1 != -2 && v1 != -1) {
if (!v1)
v8 = v8 + 1;
else
v8 += v1;
}
if (v1 == -2 || v1 == -1) {
v2 = v3;
v8 = v8 + 1;
}
} else {
v8 = v8 + 1;
}
if (v9 < v10) {
do {
tmp_13 = v10;
v10 += 1;
tmp_30 = v9;
v9 += 1;
*(&v5) = *(tmp_13 + a0);
*(tmp_30 + a0) = v5;
} while (v10 < v8);
} else {
v9 = v8;
}
}
}
*((a0 + v9)) = 0;
v11 = a0;
}
return;
} | bash | angr_dream |
static void transitional_interest_callback_ro(const char *trig,
struct pkginfo *pkg,
struct pkgbin *pkgbin,
enum trig_options opts) {
struct pkginfo *pend = pkg;
struct pkgbin *pendbin = pkgbin;
debug(dbg_triggersdetail,
"trig_transitional_interest_callback trig=%s pend=%s", trig,
pkgbin_name(pend, pendbin, pnaw_always));
if (pend->status >= PKG_STAT_TRIGGERSAWAITED)
trig_note_pend(pend, nfstrsave(trig));
} | void transitional_interest_callback_ro(unsigned long long a0, struct_0 *a1,
unsigned long long a2,
unsigned long a3) {
unsigned int v0;
unsigned long long v2;
unsigned long long v3;
unsigned long long v4;
v0 = a3;
pkgbin_name(a1, a2, 0x3, a2);
debug(0x2000, "trig_transitional_interest_callback trig=%s pend=%s", a0);
v2 = a1->field_18;
if (a1->field_18 > 4) {
v3 = nfstrsave(a0);
v4 = trig_note_pend(a1, v3, v3);
}
return;
} | dpkg | angr_phoenix |
static void ipstats_show_hw_s_info_one(const struct ipstats_hw_s_info *hwsi,
enum ipstats_hw_s_info_idx idx) {
const struct ipstats_hw_s_info_one *hwsio = hwsi->infos[idx];
const char *name = ipstats_hw_s_info_name[idx];
if (hwsio == ((void *)0))
return;
print_string(PRINT_FP, ((void *)0), " %s", name);
open_json_object(name);
__ipstats_show_hw_s_info_one(hwsio);
close_json_object();
} | void ipstats_show_hw_s_info_one(unsigned long long a0, unsigned long a1,
unsigned long a2, unsigned long long a3,
unsigned long long a4, unsigned long long a5) {
void *v0;
unsigned long long v1;
unsigned long long v3;
unsigned long long v4;
v0 = *((a0 + a1 * 8));
v3 = "l3_stats";
v1 = "l3_stats";
if (v0) {
print_string(0x1, 0x0, " %s", v1);
open_json_object(v1);
__ipstats_show_hw_s_info_one(v0);
v4 = close_json_object(a0, 0x0, " %s", a3, a4, a5);
return;
}
return;
} | iproute2-6.0.0 | angr_sailr |
static int execute_builtin(builtin, words, flags, subshell)
sh_builtin_func_t *builtin;
WORD_LIST *words;
int flags, subshell;
{
int result, eval_unwind, ignexit_flag;
int isbltinenv, should_keep;
char *error_trap;
error_trap = 0;
should_keep = 0;
if (subshell == 0 && (flags & 0x08) &&
(builtin == eval_builtin || (flags & 0x0800) ||
builtin == source_builtin)) {
begin_unwind_frame("eval_builtin");
unwind_protect_mem((char *)&(exit_immediately_on_error),
sizeof(exit_immediately_on_error));
unwind_protect_mem((char *)&(builtin_ignoring_errexit),
sizeof(builtin_ignoring_errexit));
error_trap = (signal_is_trapped((64 + 1) + 1) &&
signal_is_ignored((64 + 1) + 1) == 0)
? trap_list[(64 + 1) + 1]
: (char *)((void *)0);
if (error_trap) {
error_trap = (char *)strcpy(
sh_xmalloc((1 + strlen(error_trap)), "execute_cmd.c", 4885),
(error_trap));
add_unwind_protect(xfree, error_trap);
add_unwind_protect(set_error_trap, error_trap);
restore_default_signal((64 + 1) + 1);
}
exit_immediately_on_error = 0;
ignexit_flag = builtin_ignoring_errexit;
builtin_ignoring_errexit = 1;
eval_unwind = 1;
} else
eval_unwind = 0;
isbltinenv = (builtin == source_builtin || builtin == eval_builtin ||
builtin == unset_builtin || builtin == mapfile_builtin);
should_keep = isbltinenv && builtin != mapfile_builtin;
if (builtin == fc_builtin || builtin == read_builtin) {
isbltinenv = 1;
should_keep = 0;
}
if (isbltinenv) {
if (subshell == 0)
begin_unwind_frame("builtin_env");
if (temporary_env) {
push_scope(0x08, temporary_env);
if (flags & 0x0800)
should_keep = 0;
if (subshell == 0)
add_unwind_protect(pop_scope, should_keep ? "1" : 0);
temporary_env = (HASH_TABLE *)((void *)0);
}
}
if (subshell == 0 && builtin == eval_builtin) {
if (evalnest_max > 0 && evalnest >= evalnest_max) {
internal_error(gettext("eval: maximum eval nesting level exceeded (%d)"),
evalnest);
evalnest = 0;
jump_to_top_level(2);
}
unwind_protect_mem((char *)&(evalnest), sizeof(evalnest));
evalnest++;
} else if (subshell == 0 && builtin == source_builtin) {
if (sourcenest_max > 0 && sourcenest >= sourcenest_max) {
internal_error(gettext("%s: maximum source nesting level exceeded (%d)"),
this_command_name, sourcenest);
sourcenest = 0;
jump_to_top_level(2);
}
unwind_protect_mem((char *)&(sourcenest), sizeof(sourcenest));
sourcenest++;
}
if (posixly_correct && subshell == 0 && builtin == return_builtin &&
(flags & 0x0800) == 0 && temporary_env) {
begin_unwind_frame("return_temp_env");
add_unwind_protect(merge_temporary_env, (char *)((void *)0));
}
executing_builtin++;
executing_command_builtin |= builtin == command_builtin;
result = ((*builtin)(words->next));
if (posixly_correct && subshell == 0 && builtin == return_builtin &&
temporary_env)
discard_unwind_frame("return_temp_env");
if (subshell == 0 && isbltinenv)
run_unwind_frame("builtin_env");
if (eval_unwind) {
builtin_ignoring_errexit = ignexit_flag;
exit_immediately_on_error = builtin_ignoring_errexit ? 0 : errexit_flag;
if (error_trap) {
set_error_trap(error_trap);
sh_xfree((error_trap), "execute_cmd.c", 4988);
}
discard_unwind_frame("eval_builtin");
}
return (result);
} | int execute_builtin(unsigned long a0, unsigned long long *a1, unsigned long a2,
unsigned long a3) {
unsigned long v0;
unsigned int v1;
unsigned int v2;
unsigned int v3;
unsigned int v4;
unsigned int v5;
void *v6;
unsigned long v8;
v0 = a0;
v6 = 0;
v4 = 0;
if (a3) {
LABEL_408c34:
v1 = 0;
} else {
if (!(a2 & 8))
goto LABEL_408c34;
if (a0 != got.eval_builtin && !(a2 & 0x800)) {
if (a0 == got.source_builtin)
goto LABEL_408b31;
goto LABEL_408c34;
}
LABEL_408b31:
begin_unwind_frame("eval_builtin");
unwind_protect_mem(0x5000e8, 0x4);
unwind_protect_mem(&builtin_ignoring_errexit, 0x4);
if (signal_is_trapped(0x42) && !signal_is_ignored(0x42)) {
v8 = reset_shell_options;
goto LABEL_408b89;
}
v8 = 0;
LABEL_408b89:
v6 = v8;
if (v6) {
v6 = strcpy(sh_xmalloc(strlen(v6) + 1, "execute_cmd.c", 0x1315), v6);
add_unwind_protect(got.xfree, v6);
add_unwind_protect(got.set_error_trap, v6);
restore_default_signal(0x42);
}
exit_immediately_on_error = 0;
v2 = builtin_ignoring_errexit;
builtin_ignoring_errexit = 1;
v1 = 1;
}
if (a0 == got.source_builtin) {
LABEL_408c6f:
*(&v8) = 1;
} else {
if (a0 == got.eval_builtin)
goto LABEL_408c6f;
if (a0 == got.unset_builtin)
goto LABEL_408c6f;
if (a0 == got.mapfile_builtin)
goto LABEL_408c6f;
*(&v8) = 0;
}
v3 = v8;
if (v3 && a0 != got.mapfile_builtin) {
*(&v8) = 1;
goto LABEL_408c9d;
}
*(&v8) = 0;
LABEL_408c9d:
v4 = v8;
if (a0 != got.fc_builtin && !(a0 == got.read_builtin))
goto LABEL_408cc8;
v3 = 1;
v4 = 0;
LABEL_408cc8:
if (v3) {
if (!a3)
begin_unwind_frame("builtin_env");
if (temporary_env) {
push_scope(0x8, temporary_env);
if ((a2 & 0x800))
v4 = 0;
if (!a3) {
if (v4)
v8 = "1";
else
v8 = 0;
add_unwind_protect(got.pop_scope, v8);
}
temporary_env = 0;
}
}
if (!a3 && a0 == got.eval_builtin) {
if (evalnest_max > 0 && evalnest >= evalnest_max) {
internal_error(gettext("eval: maximum eval nesting level exceeded (%d)"),
evalnest);
evalnest = 0;
jump_to_top_level(0x2);
}
unwind_protect_mem(&evalnest, 0x4);
evalnest = evalnest + 1;
goto LABEL_408e70;
}
if (!a3 && a0 == got.source_builtin) {
if (sourcenest_max > 0 && sourcenest >= sourcenest_max) {
internal_error(gettext("%s: maximum source nesting level exceeded (%d)"),
0xbaec7d8920ec8348);
sourcenest = 0;
jump_to_top_level(0x2);
}
unwind_protect_mem(&sourcenest, 0x4);
sourcenest = sourcenest + 1;
}
LABEL_408e70:
if (posixly_correct && !a3 && a0 == got.return_builtin && !(a2 & 0x800) &&
temporary_env) {
begin_unwind_frame("return_temp_env");
add_unwind_protect(got.merge_temporary_env, 0x0);
}
executing_builtin = executing_builtin + 1;
executing_command_builtin =
executing_command_builtin | a0 == got.command_builtin;
v5 = (stack_base)[64](*(a1));
if (posixly_correct && !a3 && a0 == got.return_builtin && temporary_env)
discard_unwind_frame("return_temp_env");
if (!a3 && v3)
run_unwind_frame("builtin_env");
if (v1) {
builtin_ignoring_errexit = v2;
if (builtin_ignoring_errexit)
*(&v8) = 0;
else
*(&v8) = errexit_flag;
exit_immediately_on_error = v8;
if (v6) {
set_error_trap(v6);
sh_xfree(v6, "execute_cmd.c", 0x137c);
}
discard_unwind_frame("eval_builtin");
}
return v5;
} | bash | angr_phoenix |
static struct item *search_item(struct item *root, char const *str) {
struct item *p, *q, *r, *s, *t;
int a;
((void)sizeof((root) ? 1 : 0), __extension__({
if (root)
;
else
__assert_fail("root", "src/tsort.c", 126,
__extension__ __PRETTY_FUNCTION__);
}));
if (root->right == ((void *)0))
return (root->right = new_item(str));
t = root;
s = p = root->right;
while (1) {
((void)sizeof((str && p && p->str) ? 1 : 0), __extension__({
if (str && p && p->str)
;
else
__assert_fail("str && p && p->str", "src/tsort.c", 140,
__extension__ __PRETTY_FUNCTION__);
}));
a = strcmp(str, p->str);
if (a == 0)
return p;
if (a < 0)
q = p->left;
else
q = p->right;
if (q == ((void *)0)) {
q = new_item(str);
if (a < 0)
p->left = q;
else
p->right = q;
((void)sizeof((str && s && s->str && !(strcmp(str, s->str) == 0)) ? 1
: 0),
__extension__({
if (str && s && s->str && !(strcmp(str, s->str) == 0))
;
else
__assert_fail("str && s && s->str && !STREQ (str, s->str)",
"src/tsort.c", 163, __extension__ __PRETTY_FUNCTION__);
}));
if (strcmp(str, s->str) < 0) {
r = p = s->left;
a = -1;
} else {
r = p = s->right;
a = 1;
}
while (p != q) {
((void)sizeof((str && p && p->str && !(strcmp(str, p->str) == 0)) ? 1
: 0),
__extension__({
if (str && p && p->str && !(strcmp(str, p->str) == 0))
;
else
__assert_fail("str && p && p->str && !STREQ (str, p->str)",
"src/tsort.c", 177,
__extension__ __PRETTY_FUNCTION__);
}));
if (strcmp(str, p->str) < 0) {
p->balance = -1;
p = p->left;
} else {
p->balance = 1;
p = p->right;
}
}
if (s->balance == 0 || s->balance == -a) {
s->balance += a;
return q;
}
if (r->balance == a) {
p = r;
if (a < 0) {
s->left = r->right;
r->right = s;
} else {
s->right = r->left;
r->left = s;
}
s->balance = r->balance = 0;
} else {
if (a < 0) {
p = r->right;
r->right = p->left;
p->left = r;
s->left = p->right;
p->right = s;
} else {
p = r->left;
r->left = p->right;
p->right = r;
s->right = p->left;
p->left = s;
}
s->balance = 0;
r->balance = 0;
if (p->balance == a)
s->balance = -a;
else if (p->balance == -a)
r->balance = a;
p->balance = 0;
}
if (s == t->right)
t->right = p;
else
t->left = p;
return q;
}
if (q->balance) {
t = p;
s = q;
}
p = q;
}
} | int search_item(unsigned long long a0[3], char *a1) {
unsigned int v0;
struct_0 *v1;
struct_0 *v2;
struct_0 *v3;
struct_0 *v4;
unsigned long long v5[3];
unsigned int v7;
if (!a0) {
__assert_fail();
} else if (!a0[2]) {
a0[2] = new_item(a1);
v7 = a0[2];
return v7;
} else {
v5[0] = a0;
v1 = a0[2];
v4 = v1;
while (true) {
if (!(a1) || !(v1) || !(v1->field_0))
__assert_fail();
v0 = strcmp(a1, v1->field_0);
if (!v0) {
v7 = v1;
return v7;
}
if (v0 < 0)
v2 = v1->field_8;
else
v2 = v1->field_10;
if (!v2)
break;
if (v2->field_18) {
v5 = v1;
v4 = v2;
}
v1 = v2;
}
v2 = new_item(a1);
if (v0 < 0)
v1->field_8 = v2;
else
v1->field_10 = v2;
if (a1 && v4 && v4->field_0 && strcmp(a1, v4->field_0)) {
if (strcmp(a1, v4->field_0) < 0) {
v1 = v4->field_8;
v3 = v1;
v0 = -1;
} else {
v1 = v4->field_10;
v3 = v1;
v0 = 1;
}
while (v1 != v2) {
if (!(a1) || !(v1) || !(v1->field_0) || !(strcmp(a1, v1->field_0)))
__assert_fail();
if (strcmp(a1, v1->field_0) < 0) {
v1->field_18 = 255;
v1 = v1->field_8;
} else {
v1->field_18 = 1;
v1 = v1->field_10;
}
}
if (!(v4->field_18) || !(v4->field_18 != !(v0))) {
v4->field_18 = v0 + v4->field_18;
v7 = v2;
return v7;
}
if (v0 == v3->field_18) {
v1 = v3;
if (v0 < 0) {
v4->field_8 = v3->field_10;
v3->field_10 = v4;
} else {
v4->field_10 = v3->field_8;
v3->field_8 = v4;
}
v3->field_18 = 0;
v4->field_18 = v3->field_18;
} else {
if (v0 < 0) {
v1 = v3->field_10;
v3->field_10 = v1->field_8;
v1->field_8 = v3;
v4->field_8 = v1->field_10;
v1->field_10 = v4;
} else {
v1 = v3->field_8;
v3->field_8 = v1->field_10;
v1->field_10 = v3;
v4->field_10 = v1->field_8;
v1->field_8 = v4;
}
v4->field_18 = 0;
v3->field_18 = 0;
if (v0 == v1->field_18) {
v4->field_18 = -(v0);
} else if (v1->field_18 == !(v0)) {
v3->field_18 = v0;
}
v1->field_18 = 0;
}
if (v4 == v5[2])
v5[2] = v1;
else
v5[1] = v1;
v7 = v2;
return v7;
}
__assert_fail();
}
} | coreutils | angr_sailr |
static void unwind_frame_run_internal(tag, ignore) char *tag, *ignore;
{
UNWIND_ELT *elt;
int found;
found = 0;
while (elt = unwind_protect_list) {
unwind_protect_list = elt->head.next;
if (elt->head.cleanup == 0) {
if (tag &&
((elt->arg.v)[0] == (tag)[0] && strcmp(elt->arg.v, tag) == 0)) {
do {
if ((uwcache).nc < (uwcache).cs) {
do {
if ((sizeof(UNWIND_ELT)) <= 32) {
register char *mzp = (char *)((elt));
unsigned long mctmp = (sizeof(UNWIND_ELT));
register long mcn;
if (mctmp < 8)
mcn = 0;
else {
mcn = (mctmp - 1) / 8;
mctmp &= 7;
}
switch (mctmp) {
case 0:
for (;;) {
*mzp++ = 0xdf;
case 7:
*mzp++ = 0xdf;
case 6:
*mzp++ = 0xdf;
case 5:
*mzp++ = 0xdf;
case 4:
*mzp++ = 0xdf;
case 3:
*mzp++ = 0xdf;
case 2:
*mzp++ = 0xdf;
case 1:
*mzp++ = 0xdf;
if (mcn <= 0)
break;
mcn--;
}
}
} else
memset(((elt)), (0xdf), (sizeof(UNWIND_ELT)));
} while (0);
((UNWIND_ELT **)((uwcache).data))[(uwcache).nc++] = (elt);
} else
sh_xfree((elt), "unwind_prot.c", 316);
} while (0);
found = 1;
break;
}
} else {
if (elt->head.cleanup == (Function *)restore_variable)
restore_variable(&elt->sv.v);
else
(*(elt->head.cleanup))(elt->arg.v);
}
do {
if ((uwcache).nc < (uwcache).cs) {
do {
if ((sizeof(UNWIND_ELT)) <= 32) {
register char *mzp = (char *)((elt));
unsigned long mctmp = (sizeof(UNWIND_ELT));
register long mcn;
if (mctmp < 8)
mcn = 0;
else {
mcn = (mctmp - 1) / 8;
mctmp &= 7;
}
switch (mctmp) {
case 0:
for (;;) {
*mzp++ = 0xdf;
case 7:
*mzp++ = 0xdf;
case 6:
*mzp++ = 0xdf;
case 5:
*mzp++ = 0xdf;
case 4:
*mzp++ = 0xdf;
case 3:
*mzp++ = 0xdf;
case 2:
*mzp++ = 0xdf;
case 1:
*mzp++ = 0xdf;
if (mcn <= 0)
break;
mcn--;
}
}
} else
memset(((elt)), (0xdf), (sizeof(UNWIND_ELT)));
} while (0);
((UNWIND_ELT **)((uwcache).data))[(uwcache).nc++] = (elt);
} else
sh_xfree((elt), "unwind_prot.c", 329);
} while (0);
}
if (tag && found == 0)
internal_warning(gettext("unwind_frame_run: %s: frame not found"), tag);
} | void unwind_frame_run_internal(char *a0, unsigned long a1) {
unsigned long v0;
int tmp_15;
unsigned int v1;
unsigned long long v2;
unsigned long long v3;
struct_1 *v4;
struct_0 *v6;
unsigned long long v7;
struct_0 *v8;
struct_0 *v9;
struct_0 *v10;
struct_0 *v11;
struct_0 *v12;
struct_0 *v13;
struct_0 *v14;
struct_0 *v15;
struct_0 *v16;
unsigned long long v17;
struct_0 *v18;
unsigned long long v19;
unsigned long long v20;
struct_0 *v21;
struct_0 *v22;
struct_0 *v23;
struct_0 *v24;
struct_0 *v25;
struct_0 *v26;
struct_0 *v27;
struct_0 *v28;
struct_0 *v29;
unsigned long long v30;
unsigned long long v31;
v0 = a1;
v1 = 0;
while (true) {
v6 = unwind_protect_list;
v4 = unwind_protect_list;
if (!v4)
break;
unwind_protect_list = *(&v4->field_0);
if (!v4->field_8) {
if (a0 && v4->field_10->field_0 == *(a0)) {
v7 = strcmp(v4->field_10, a0);
if (!v7) {
if (g_400c2c < g_400c28) {
v18 = v4;
v2 = 32;
if (v2 <= 7) {
v20 = 0;
} else {
v20 = v2 - 1 >> 3;
v2 &= 7;
}
switch (v2) {
case 0:
while (true) {
v21 = v18;
v18 = &v18->padding_1;
v21->field_0 = 223;
v22 = v18;
v18 = &v18->padding_1;
v22->field_0 = 223;
v23 = v18;
v18 = &v18->padding_1;
v23->field_0 = 223;
v24 = v18;
v18 = &v18->padding_1;
v24->field_0 = 223;
v25 = v18;
v18 = &v18->padding_1;
v25->field_0 = 223;
v26 = v18;
v18 = &v18->padding_1;
v26->field_0 = 223;
v27 = v18;
v18 = &v18->padding_1;
v27->field_0 = 223;
v28 = v18;
v18 = &v18->padding_1;
v28->field_0 = 223;
if (v20 <= 0)
break;
v20 -= 1;
}
}
tmp_15 = g_400c2c;
g_400c2c = g_400c2c + 1;
v29 = v4;
*((uwcache + tmp_15 * 8)) = v4;
} else {
v19 = sh_xfree(v4, "unwind_prot.c", 0x13c);
}
v1 = 1;
break;
}
}
} else {
if (v4->field_8 == restore_variable)
restore_variable(&v4->field_10);
else
*(((stack_base)[32] + 8))(v4->field_10);
}
if (!a0 || v4->field_8 || v4->field_10->field_0 != *(a0) || v7) {
if (g_400c2c < g_400c28) {
v9 = v4;
v3 = 32;
if (v3 <= 7) {
v17 = 0;
} else {
v17 = v3 - 1 >> 3;
v3 &= 7;
}
switch (v3) {
case 7:
v10 = v9;
v9 = &v9->padding_1;
v10->field_0 = 223;
case 6:
v11 = v9;
v9 = &v9->padding_1;
v11->field_0 = 223;
case 5:
v12 = v9;
v9 = &v9->padding_1;
v12->field_0 = 223;
case 4:
v13 = v9;
v9 = &v9->padding_1;
v13->field_0 = 223;
case 3:
v14 = v9;
v9 = &v9->padding_1;
v14->field_0 = 223;
case 2:
v15 = v9;
v9 = &v9->padding_1;
v15->field_0 = 223;
case 1:
v16 = v9;
v9 = &v9->padding_1;
v16->field_0 = 223;
if (v17 > 0)
v17 -= 1;
case 0:
v8 = v9;
v9 = &v9->padding_1;
v8->field_0 = 223;
}
g_400c2c = g_400c2c + 1;
*((uwcache + g_400c2c * 8)) = v4;
} else {
sh_xfree(v4, "unwind_prot.c", 0x149);
}
}
}
if (a0 && !v1) {
v30 = gettext("unwind_frame_run: %s: frame not found");
v31 = internal_warning(v30, a0, v30);
}
return;
} | bash | angr_dream |
static inline void emit_backup_suffix_note(void) {
fputs_unlocked(
gettext(
"\nThe backup suffix is '~', unless set with --suffix or "
"SIMPLE_BACKUP_SUFFIX.\nThe version control method may be selected "
"via the --backup option or through\nthe VERSION_CONTROL environment "
"variable. Here are the values:\n\n"),
stdout)
;
fputs_unlocked(
gettext(" none, off never make backups (even if --backup is "
"given)\n numbered, t make numbered backups\n existing, "
"nil numbered if numbered backups exist, simple otherwise\n "
"simple, never always make simple backups\n"),
stdout)
;
} | void emit_backup_suffix_note() {
unsigned long long v1;
fputs_unlocked(
gettext(
"\nThe backup suffix is '~', unless set with --suffix or "
"SIMPLE_BACKUP_SUFFIX.\nThe version control method may be selected "
"via the --backup option or through\nthe VERSION_CONTROL environment "
"variable. Here are the values:\n\n"),
stdout);
v1 = fputs_unlocked(
gettext(" none, off never make backups (even if --backup is "
"given)\n numbered, t make numbered backups\n existing, "
"nil numbered if numbered backups exist, simple otherwise\n "
"simple, never always make simple backups\n"),
stdout);
return;
} | coreutils | angr_sailr |
static void tty__setchar(struct termios *td, unsigned char *s) {
td->c_cc[0] = s[0];
td->c_cc[1] = s[1];
td->c_cc[2] = s[2];
td->c_cc[3] = s[3];
td->c_cc[4] = s[4];
td->c_cc[11] = s[5];
td->c_cc[16] = s[6];
td->c_cc[8] = s[10];
td->c_cc[9] = s[11];
td->c_cc[14] = s[12];
td->c_cc[10] = s[13];
td->c_cc[12] = s[15];
td->c_cc[13] = s[16];
td->c_cc[15] = s[17];
td->c_cc[6] = s[23];
td->c_cc[5] = s[24];
} | void tty__setchar(char a0[34], char a1[25]) {
char v0;
char v2[34];
unsigned long long v3;
a0[17] = a1[0];
a0[18] = a1[1];
a0[19] = a1[2];
a0[20] = a1[3];
a0[21] = a1[4];
a0[28] = a1[5];
a0[33] = a1[6];
a0[25] = a1[10];
a0[26] = a1[11];
a0[31] = a1[12];
a0[27] = a1[13];
a0[29] = a1[15];
a0[30] = a1[16];
a0[32] = a1[17];
a0[23] = a1[23];
v2 = a0;
a0[22] = a1[24];
v3 = *(&v0);
return;
} | libedit | angr_dream |
static void readline_initialize_everything(void) {
if (!rl_instream)
rl_instream = stdin;
if (!rl_outstream)
rl_outstream = stdout;
_rl_in_stream = rl_instream;
_rl_out_stream = rl_outstream;
if (rl_line_buffer == 0)
rl_line_buffer = (char *)xmalloc(rl_line_buffer_len = 256);
if (rl_terminal_name == 0)
rl_terminal_name = sh_get_env_value("TERM");
_rl_init_terminal_io(rl_terminal_name);
readline_default_bindings();
rl_initialize_funmap();
_rl_init_eightbit();
rl_read_init_file((char *)((void *)0));
if (_rl_horizontal_scroll_mode && _rl_term_autowrap) {
_rl_screenwidth--;
_rl_screenchars -= _rl_screenheight;
}
rl_set_keymap_from_edit_mode();
bind_arrow_keys();
bind_bracketed_paste_prefix();
if (rl_completer_word_break_characters == 0)
rl_completer_word_break_characters = rl_basic_word_break_characters;
if (_rl_colored_stats || _rl_colored_completion_prefix)
_rl_parse_colors();
rl_executing_keyseq = malloc(_rl_executing_keyseq_size = 16);
if (rl_executing_keyseq)
rl_executing_keyseq[rl_key_sequence_length = 0] = '\0';
} | long readline_initialize_everything() {
long result;
if (!rl_instream)
rl_instream = (long)stdin;
if (!rl_outstream)
rl_outstream = (long)stdout;
rl_in_stream = rl_instream;
rl_out_stream = (FILE *)rl_outstream;
if (!rl_line_buffer) {
rl_line_buffer_len = 256;
rl_line_buffer = xmalloc(256LL);
}
if (!rl_terminal_name)
rl_terminal_name = sh_get_env_value("TERM");
rl_init_terminal_io(rl_terminal_name);
readline_default_bindings();
rl_initialize_funmap();
rl_init_eightbit();
rl_read_init_file(0LL);
if (rl_horizontal_scroll_mode && rl_term_autowrap) {
--rl_screenwidth;
rl_screenchars -= rl_screenheight;
}
rl_set_keymap_from_edit_mode();
bind_arrow_keys();
bind_bracketed_paste_prefix();
if (!rl_completer_word_break_characters)
rl_completer_word_break_characters = rl_basic_word_break_characters;
if (rl_colored_stats || rl_colored_completion_prefix)
rl_parse_colors();
rl_executing_keyseq_size = 16;
rl_executing_keyseq = (long)malloc(0x10uLL);
result = rl_executing_keyseq;
if (rl_executing_keyseq) {
rl_key_sequence_length = 0;
result = rl_executing_keyseq;
*(_BYTE *)rl_executing_keyseq = 0;
}
return result;
} | bash | ida |
const char *safely_quote_err_filename(int n, char const *arg) {
return quotearg_n_style(n, options.err_quoting_style, arg);
} | int safely_quote_err_filename(unsigned long a0, unsigned long long a1) {
return quotearg_n_style(a0, g_5000c4, a1);
} | findutils | angr_sailr |
static void command_print_word_list(list, separator) WORD_LIST *list;
char *separator;
{
_print_word_list(list, separator, cprintf);
} | void command_print_word_list(unsigned long long a0, unsigned long long a1) {
unsigned long long v1;
v1 = _print_word_list(a0, a1, cprintf);
return;
} | bash | angr_phoenix |
static void sig_alarm(int ignore) {
alarm_fired = 1;
alarm(1);
} | long long sig_alarm(unsigned long a0) {
unsigned int v0;
v0 = a0;
alarm_fired = 1;
return alarm(0x1);
} | openssh-portable | angr_dream |
int isconsole(char *s, char *res, int rlen) {
struct consdev *c;
int l, sl, i, fd;
char *p, *q;
sl = strlen(s);
for (c = consdev; c->cmdline; c++) {
l = strlen(c->cmdline);
if (sl <= l)
continue;
p = s + l;
if (strncmp(s, c->cmdline, l) != 0)
continue;
for (i = 0; i < 2; i++) {
snprintf(res, rlen, i ? c->dev1 : c->dev2, p);
if ((q = strchr(res, ',')) != ((void *)0))
*q = 0;
if ((fd = open(res, 00 | 04000)) >= 0) {
close(fd);
return 1;
}
}
}
snprintf(res, rlen, "/dev/%s", s);
if ((q = strchr(res, ',')) != ((void *)0))
*q = 0;
if (istty(res))
return 1;
return 0;
} | int isconsole(char *a0, char *a1, unsigned long a2) {
unsigned int v0;
unsigned int v1;
unsigned int v2;
unsigned int v3;
unsigned long long v4;
char *v5;
unsigned long v6;
unsigned int v8;
unsigned int v9;
v1 = strlen(a0);
for (v4 = &consdev; *(v4); v4 += 24) {
v2 = strlen(*(v4));
if (v1 > v2) {
v6 = &a0[v2];
if (!strncmp(a0, *(v4), v2)) {
for (v0 = 0; v0 <= 1; v0 += 1) {
v8 = (!v0 ? *((v4 + 8)) : *((v4 + 16)));
snprintf(a1, a2, v8);
v5 = strchr(a1, 0x2c);
if (v5)
*(v5) = 0;
v3 = open(a1, 0x800, a2);
if (v3 >= 0) {
close(v3);
v8 = 1;
return v8;
}
}
}
}
}
snprintf(a1, a2, "/dev/%s", a0);
v9 = 44;
v5 = strchr(a1, 0x2c);
if (v5)
*(v5) = 0;
v8 = istty(a1, reg_64, "/dev/%s");
v8 = (!v8 ? 1 : 0);
return v8;
} | sysvinit | angr_sailr |
char *xheader_xhdr_name(struct tar_stat_info *st) {
if (!exthdr_name)
assign_string(&exthdr_name,
header_template[pax_file_header][posixly_correct]);
return xheader_format_name(st, exthdr_name, 0);
} | void xheader_xhdr_name(undefined8 param_1)
{
if (exthdr_name == 0) {
assign_string(&exthdr_name,
*(undefined8 *)(header_template +
(long)(int)(uint)posixly_correct * 8));
}
xheader_format_name(param_1, exthdr_name, 0);
return;
} | tar | ghidra |
inline void ext2fs_mark_super_dirty(ext2_filsys fs) {
fs->flags |= 0x04 | 0x02;
} | void ext2fs_mark_super_dirty(void)
{
halt_baddata();
} | e2fsprogs-1.46.5 | ghidra |
static void new_sgent(struct sgrp *sgent) {
explicit_bzero((sgent), (sizeof *sgent));
sgent->sg_name = group_name;
if (pflg) {
sgent->sg_passwd = group_passwd;
} else {
sgent->sg_passwd = "!";
}
sgent->sg_adm = &empty_list;
sgent->sg_mem = &empty_list;
} | long long new_sgent(unsigned long long a0[4]) {
explicit_bzero(a0, 0x20);
a0[0] = group_name;
if (pflg)
a0[1] = group_passwd;
else
a0[1] = "!";
a0[2] = &empty_list;
a0[3] = &empty_list;
return a0;
} | shadow | angr_dream |
static int waitone(int block, struct job *job) {
int pid;
int status;
struct job *jp;
struct job *thisjob = ((void *)0);
int state;
({
suppressint++;
({ __asm__ __volatile__("" : : : "memory"); });
0;
});
;
pid = waitproc(block, &status);
;
if (pid <= 0)
goto out;
for (jp = curjob; jp; jp = jp->prev_job) {
struct procstat *sp;
struct procstat *spend;
if (jp->state == 2)
continue;
state = 2;
spend = jp->ps + jp->nprocs;
sp = jp->ps;
do {
if (sp->pid == pid) {
;
sp->status = status;
thisjob = jp;
}
if (sp->status == -1)
state = 0;
if (state == 0)
continue;
if ((((sp->status) & 0xff) == 0x7f)) {
jp->stopstatus = sp->status;
state = 1;
}
} while (++sp < spend);
if (thisjob)
goto gotjob;
}
goto out;
gotjob:
if (state != 0) {
thisjob->changed = 1;
if (thisjob->state != state) {
;
thisjob->state = state;
if (state == 1) {
set_curjob(thisjob, 0);
}
}
}
out:
({
({ __asm__ __volatile__("" : : : "memory"); });
if (--suppressint == 0 && intpending)
onint();
0;
});
if (thisjob && thisjob == job) {
char s[48 + 1];
int len;
len = sprint_status(s, status, 1);
if (len) {
s[len] = '\n';
s[len + 1] = 0;
outstr(s, out2);
}
}
return pid;
} | int waitone(unsigned long a0, unsigned long a1) {
char v0;
unsigned int v1;
unsigned int v2;
unsigned int v3;
void *v4;
void *v5;
unsigned int v6[2];
unsigned long v7;
char v8;
v5 = 0;
suppressint = suppressint + 1;
v2 = waitproc(a0, &v0);
if (v2 > 0) {
v4 = curjob;
while (true) {
if (!v4)
break;
if (v4[30] != 2) {
v1 = 2;
v7 = v4[28] * 16 + v4[16];
*(&v6[0]) = v4[16];
do {
if (v2 == v6[0]) {
v6[1] = *(&v0);
v5 = v4;
}
if (v6[1] == -1)
v1 = 0;
if (v1 && v6[1] == 127) {
*(&v4[24]) = v6[1];
v1 = 1;
}
*(&v6[0]) = v6 + 2;
} while (v6 < v7);
if (v5) {
if (v1) {
*(&v5[31]) = v5[31] | 16;
if (v1 != v5[30]) {
*(&v5[30]) = v1;
if (v1 == 1) {
set_curjob(v5, 0x0);
break;
}
}
}
break;
}
}
v4 = v4[32];
}
}
suppressint = suppressint - 1;
if (!suppressint && intpending)
onint();
if (v5 && v5 == a1) {
v3 = sprint_status(&v8, *(&v0), 0x1);
if (v3) {
(&v8)[v3] = 10;
(&v8)[1 + v3] = 0;
outstr(&v8, out2);
}
}
return v2;
} | dash-0.5.11+git20210903+057cd650a4ed | angr_phoenix |
test_code_t test_safe_renegotiation_scsv(gnutls_session_t session) {
int ret;
if (ssl3_ok == 0)
return TEST_IGNORE;
sprintf(prio_str,
"NONE:"
"+CIPHER-ALL:+ARCFOUR-128:+3DES-CBC"
":+GOST28147-TC26Z-CNT"
":"
"+COMP-NULL"
":+VERS-TLS1.0:"
"+MAC-ALL:+MD5:+SHA1"
":+GOST28147-TC26Z-IMIT"
":"
"+RSA:+DHE-RSA:+DHE-DSS:+ANON-DH:+ECDHE-RSA:+ECDHE-ECDSA:+ANON-ECDH"
":+VKO-GOST-12"
":%%SAFE_RENEGOTIATION");
{
int _ret;
if ((_ret = __gnutls_priority_set_direct(session, prio_str, 520)) !=
TEST_SUCCEED) {
return _ret;
}
};
gnutls_credentials_set(session, GNUTLS_CRD_CERTIFICATE, xcred);
ret = test_do_handshake(session);
return ret;
} | long test_safe_renegotiation_scsv(long a1) {
unsigned int v2;
if (!ssl3_ok)
return 3LL;
sprintf(prio_str,
"NONE:+CIPHER-ALL:+ARCFOUR-128:+3DES-CBC:+GOST28147-TC26Z-CNT:+COMP-"
"NULL:+VERS-TLS1.0:+MAC-ALL:+MD5:+SHA1:+GOST28147-"
"TC26Z-IMIT:+RSA:+DHE-RSA:+DHE-DSS:+ANON-DH:+ECDHE-RSA:+ECDHE-ECDSA:+"
"ANON-ECDH:+VKO-GOST-12:%%SAFE_RENEGOTIATION");
v2 = _gnutls_priority_set_direct(a1, prio_str, 0x208u);
if (v2)
return v2;
gnutls_credentials_set(a1, 1LL, xcred);
return (unsigned int)test_do_handshake(a1);
} | gnutls | ida |
static _Bool
file_ignored(char const *name) {
return (
(ignore_mode != IGNORE_MINIMAL && name[0] == '.' &&
(ignore_mode == IGNORE_DEFAULT || !name[1 + (name[1] == '.')])) ||
(ignore_mode == IGNORE_DEFAULT && patterns_match(hide_patterns, name)) ||
patterns_match(ignore_patterns, name));
} | _BOOL8 file_ignored(long a1) {
long v1;
bool v2;
v2 = ignore_mode != 2 && *(_BYTE *)a1 == 46 &&
(!ignore_mode || (*(_BYTE *)(a1 + 1) != 46 ? (v1 = 1LL) : (v1 = 2LL),
!*(_BYTE *)(v1 + a1))) ||
!ignore_mode &&
(unsigned char)patterns_match(hide_patterns, (const char *)a1) ||
(unsigned char)patterns_match(ignore_patterns, (const char *)a1);
return v2;
} | coreutils | ida |
static _Bool
uid_to_chars(uid_t v, char *p, size_t s) {
return to_chars(v < 0, (uintmax_t)v, sizeof v, uid_substitute, p, s, "uid_t");
} | int uid_to_chars(unsigned long a0, char *a1, unsigned long long a2) {
return to_chars(0x0, a0, 0x4, uid_substitute, a1, a2, "uid_t");
} | tar | angr_phoenix |
const char *next_decompress_program(int *pstate) {
struct zip_program const *zp;
if (use_compress_program_option)
return ((void *)0);
zp = find_zip_program(archive_compression_type, pstate);
return zp ? zp->program : ((void *)0);
} | long long next_decompress_program(unsigned int *a0) {
struct_0 *v0;
void *v2;
if (use_compress_program_option) {
v2 = 0;
return v2;
}
v0 = find_zip_program(archive_compression_type, a0);
v2 = (!v0 ? v0->field_8 : 0);
return v2;
} | tar | angr_sailr |
static int gz_look(state)
gz_statep state;
{
z_streamp strm = &(state->strm);
if (state->size == 0) {
state->in = (unsigned char *)malloc(state->want);
state->out = (unsigned char *)malloc(state->want << 1);
if (state->in == ((void *)0) || state->out == ((void *)0)) {
free(state->out);
free(state->in);
gz_error(state, (-4), "out of memory");
return -1;
}
state->size = state->want;
state->strm.zalloc = 0;
state->strm.zfree = 0;
state->strm.opaque = 0;
state->strm.avail_in = 0;
state->strm.next_in = 0;
if (inflateInit2_((&(state->strm)), (15 + 16), "1.2.13",
(int)sizeof(z_stream)) != 0) {
free(state->out);
free(state->in);
state->size = 0;
gz_error(state, (-4), "out of memory");
return -1;
}
}
if (strm->avail_in < 2) {
if (gz_avail(state) == -1)
return -1;
if (strm->avail_in == 0)
return 0;
}
if (strm->avail_in > 1 && strm->next_in[0] == 31 && strm->next_in[1] == 139) {
inflateReset(strm);
state->how = 2;
state->direct = 0;
return 0;
}
if (state->direct == 0) {
strm->avail_in = 0;
state->eof = 1;
state->x.have = 0;
return 0;
}
state->x.next = state->out;
memcpy(state->x.next, strm->next_in, strm->avail_in);
state->x.have = strm->avail_in;
strm->avail_in = 0;
state->how = 1;
state->direct = 1;
return 0;
} | int gz_look(struct_0 *a0) {
struct_1 *v0;
unsigned int v2;
v0 = &a0[85401592933840516].padding_10[16];
if (!a0->field_28) {
a0->field_30 = malloc(a0->field_2c);
a0->field_38 = malloc(a0->field_2c * 2);
if (!(a0->field_30) || !(a0->field_38)) {
free(a0->field_38);
free(a0->field_30);
gz_error(a0, 0xfffffffc, "out of memory");
v2 = -1;
return v2;
}
a0->field_28 = a0->field_2c;
a0->field_c0 = 0;
a0->field_c8 = 0;
a0->field_d0 = 0;
a0->field_88 = 0;
a0->field_80 = 0;
if (inflateInit2_(&a0[85401592933840516].padding_10[16], 0x1f, "1.2.13",
0x70)) {
free(a0->field_38);
a0->field_28 = 0;
free(a0->field_30);
gz_error(a0, 0xfffffffc, "out of memory");
v2 = -1;
return v2;
}
}
if (v0->field_8 <= 1) {
if (gz_avail(a0) == -1) {
v2 = -1;
return v2;
} else if (!v0->field_8) {
v2 = 0;
return v2;
}
}
if (v0->field_8 > 1 && v0->field_0->field_0 == 31 &&
v0->field_0->field_1 == 139) {
inflateReset(v0);
a0->field_44 = 2;
a0->field_40 = 0;
v2 = 0;
return v2;
}
if (!a0->field_40) {
v0->field_8 = 0;
a0->field_50 = 1;
a0->field_0 = 0;
v2 = 0;
return v2;
}
a0->field_8 = a0->field_38;
memcpy(a0->field_8, v0->field_0, v0->field_8);
a0->field_0 = v0->field_8;
v0->field_8 = 0;
a0->field_44 = 1;
a0->field_40 = 1;
v2 = 0;
return v2;
} | zlib | angr_sailr |
SHELL_VAR *find_or_make_array_variable(name, flags)
char *name;
int flags;
{
SHELL_VAR *var;
var = find_variable(name);
if (var == 0) {
var = find_variable_last_nameref(name, 1);
if (var && ((((var)->attributes) & (0x0000800))) &&
((((var)->attributes) & (0x0001000)))) {
internal_warning(gettext("%s: removing nameref attribute"), name);
((var)->attributes &= ~(0x0000800));
}
if (var && ((((var)->attributes) & (0x0000800)))) {
if (valid_nameref_value(((var)->value), 2) == 0) {
sh_invalidid(((var)->value));
return ((SHELL_VAR *)((void *)0));
}
var = (flags & 2) ? make_new_assoc_variable(((var)->value))
: make_new_array_variable(((var)->value));
}
}
if (var == 0)
var = (flags & 2) ? make_new_assoc_variable(name)
: make_new_array_variable(name);
else if ((flags & 1) && (((((var)->attributes) & (0x0000002))) ||
((((var)->attributes) & (0x0004000))))) {
if (((((var)->attributes) & (0x0000002))))
err_readonly(name);
return ((SHELL_VAR *)((void *)0));
} else if ((flags & 2) && ((((var)->attributes) & (0x0000004)))) {
set_exit_status(1);
report_error(gettext("%s: cannot convert indexed to associative array"),
name);
return ((SHELL_VAR *)((void *)0));
} else if (flags & 2)
var =
((((var)->attributes) & (0x0000040))) ? var : convert_var_to_assoc(var);
else if (((((var)->attributes) & (0x0000004))) == 0 &&
((((var)->attributes) & (0x0000040))) == 0)
var = convert_var_to_array(var);
return (var);
} | int find_or_make_array_variable(unsigned long long a0, unsigned long a1) {
struct_0 *v0;
int tmp_17;
struct_0 *v2;
unsigned long long v3;
v2 = find_variable(a0);
v0 = v2;
if (!v0) {
v2 = find_variable_last_nameref(a0, 0x1);
v0 = v2;
if (v0 && (v0->field_28 & 0x800) && (v0->field_28 & 0x1000)) {
v3 = gettext("%s: removing nameref attribute");
internal_warning(v3, a0, v3);
v2 = v0->field_28;
*(&v2) = (v0->field_28 >> 8) & 247;
tmp_17 = v2;
v0->field_28 = tmp_17;
}
if (v0 && (v0->field_28 & 0x800)) {
v2 = valid_nameref_value(v0->field_8, 0x2);
if (!v2) {
sh_invalidid(v0->field_8);
v2 = 0;
} else {
if ((a1 & 2))
v2 = make_new_assoc_variable(v0->field_8);
else
v2 = make_new_array_variable(v0->field_8);
v0 = v2;
}
}
}
if (!(v0->field_28 & 0x800) || !v0 || v0 || v2) {
if (!v0) {
if ((a1 & 2))
v2 = make_new_assoc_variable(a0);
else
v2 = make_new_array_variable(a0);
v0 = v2;
} else {
if ((a1 & 1) && ((v0->field_28 & 0x4000) || (v0->field_28 & 2))) {
if ((v0->field_28 & 2))
err_readonly(a0);
v2 = 0;
}
if (!(a1 & 1) || !(v0->field_28 & 0x4000) && !(v0->field_28 & 2)) {
if ((a1 & 2) && (v0->field_28 & 4)) {
set_exit_status(0x1);
v2 = gettext("%s: cannot convert indexed to associative array");
report_error(v2, a0, v2);
v2 = 0;
}
if (!(v0->field_28 & 4) || !(a1 & 2)) {
if ((a1 & 2)) {
if (!(v0->field_28 & 64))
v2 = convert_var_to_assoc(v0);
else
v2 = v0;
v0 = v2;
} else if (!(v0->field_28 & 4) && !(v0->field_28 & 64)) {
v2 = convert_var_to_array(v0);
v0 = v2;
}
}
}
}
if (!(v0->field_28 & 2) || !(v0->field_28 & 0x4000) || !(v0->field_28 & 4))
v2 = v0;
}
return v2;
} | bash | angr_dream |
void print_num(FILE *fp, unsigned int width, uint64_t count) {
const char *prefix = "kMGTPE";
const unsigned int base = use_iec ? 1024 : 1000;
uint64_t powi = 1;
uint16_t powj = 1;
uint8_t precision = 2;
char buf[64];
if (!human_readable || count < base) {
fprintf(fp,
"%*"
"l"
"u"
" ",
width, count);
return;
}
for (;;) {
powi *= base;
if (count / base < powi)
break;
if (!prefix[1])
break;
++prefix;
}
for (; precision > 0; precision--) {
powj *= 10;
if (count / powi < powj)
break;
}
snprintf(buf, sizeof(buf), "%.*f%c%s", precision, (double)count / powi,
*prefix, use_iec ? "i" : "");
fprintf(fp, "%*s ", width, buf);
} | void print_num(FILE *param_1, uint param_2, ulong param_3)
{
uint uVar1;
undefined *puVar2;
long in_FS_OFFSET;
double dVar3;
double dVar4;
byte local_6f;
ushort local_6e;
char *local_68;
ulong local_60;
undefined local_58[72];
long local_10;
local_10 = *(long *)(in_FS_OFFSET + 0x28);
local_68 = "kMGTPE";
if (use_iec == 0) {
uVar1 = 1000;
} else {
uVar1 = 0x400;
}
local_60 = 1;
local_6e = 1;
local_6f = 2;
if ((human_readable == 0) || (param_3 < uVar1)) {
fprintf(param_1, "%*lu ", (ulong)param_2, param_3);
} else {
for (; (local_60 = uVar1 * local_60,
local_60 <= param_3 / uVar1 && (local_68[1] != '\0'));
local_68 = local_68 + 1) {
}
while ((local_6f != 0 && (local_6e = local_6e * 10,
(ulong)local_6e <= param_3 / local_60))) {
local_6f = local_6f - 1;
}
if (use_iec == 0) {
puVar2 = &DAT_00108ca2;
} else {
puVar2 = &DAT_00108f49;
}
if ((long)param_3 < 0) {
dVar3 = (double)(param_3 >> 1 | (ulong)((uint)param_3 & 1));
dVar3 = dVar3 + dVar3;
} else {
dVar3 = (double)param_3;
}
if ((long)local_60 < 0) {
dVar4 = (double)(local_60 >> 1) + (double)(local_60 >> 1);
} else {
dVar4 = (double)local_60;
}
snprintf((char *)(dVar3 / dVar4), (size_t)local_58, (char *)0x40,
"%.*f%c%s", (ulong)local_6f, (ulong)(uint)(int)*local_68, puVar2);
fprintf(param_1, "%*s ", (ulong)param_2, local_58);
}
if (local_10 == *(long *)(in_FS_OFFSET + 0x28)) {
return;
}
__stack_chk_fail();
} | iproute2-6.0.0 | ghidra |
static void safe_print(FILE *f, const char *cp, int len) {
unsigned char ch;
if (len < 0)
len = strlen(cp);
while (len--) {
ch = *cp++;
if (ch > 128) {
fputs("M-", f);
ch -= 128;
}
if ((ch < 32) || (ch == 0x7f)) {
fputc('^', f);
ch ^= 0x40;
}
fputc(ch, f);
}
} | void safe_print(FILE *param_1, byte *param_2, int param_3)
{
size_t sVar1;
int local_2c;
byte *local_28;
byte local_9;
local_2c = param_3;
local_28 = param_2;
if (param_3 < 0) {
sVar1 = strlen((char *)param_2);
local_2c = (int)sVar1;
local_28 = param_2;
}
while (local_2c != 0) {
local_9 = *local_28;
if (0x80 < local_9) {
fputs("M-", param_1);
local_9 = local_9 + 0x80;
}
if ((local_9 < 0x20) || (local_9 == 0x7f)) {
fputc(0x5e, param_1);
local_9 = local_9 ^ 0x40;
}
fputc((uint)local_9, param_1);
local_2c = local_2c + -1;
local_28 = local_28 + 1;
}
return;
} | e2fsprogs-1.46.5 | ghidra |
static _Bool
parse_exec(const struct parser_table *entry, char **argv, int *arg_ptr) {
return insert_exec_ok("-exec", entry, argv, arg_ptr);
} | void parse_exec(undefined8 param_1, undefined8 param_2, undefined8 param_3)
{
insert_exec_ok("-exec", param_1, param_2, param_3);
return;
} | findutils | ghidra |
static inline void __jiffies_to_tv(struct timeval *tv, unsigned long jiffies) {
unsigned long long tvusec;
tvusec = 10000ULL * jiffies;
tv->tv_sec = tvusec / 1000000;
tv->tv_usec = tvusec - 1000000 * tv->tv_sec;
} | void __jiffies_to_tv(ulong *param_1, long param_2)
{
*param_1 = (ulong)(param_2 * 10000) / 1000000;
param_1[1] = param_2 * 10000 + *param_1 * -1000000;
return;
} | iproute2-6.0.0 | 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(void)
{
long *plVar1;
void *__ptr;
long lVar2;
undefined8 uVar3;
undefined8 uVar4;
long lVar5;
__ptr = (void *)dpkg_db_get_path("diversions");
lVar2 = atomic_file_new(__ptr, 1);
atomic_file_open(lVar2);
uVar3 = fsys_hash_iter_new();
while (lVar5 = fsys_hash_iter_next(uVar3), lVar5 != 0) {
plVar1 = *(long **)(lVar5 + 0x18);
if ((plVar1 != (long *)0x0) && (*plVar1 != 0)) {
uVar4 = diversion_pkg_name(plVar1);
fprintf(*(FILE **)(lVar2 + 0x18), "%s\n%s\n%s\n",
*(undefined8 *)(*(long *)(*(long *)(*plVar1 + 0x18) + 8) + 8),
*(undefined8 *)(*plVar1 + 8), uVar4);
}
}
fsys_hash_iter_free(uVar3);
atomic_file_sync(lVar2);
atomic_file_close(lVar2);
atomic_file_commit(lVar2);
atomic_file_free(lVar2);
free(__ptr);
return;
} | dpkg | ghidra |
int BZ2_bzBuffToBuffDecompress(char *dest, unsigned int *destLen, char *source,
unsigned int sourceLen, int small,
int verbosity) {
bz_stream strm;
int ret;
if (dest == ((void *)0) || destLen == ((void *)0) || source == ((void *)0) ||
(small != 0 && small != 1) || verbosity < 0 || verbosity > 4)
return (-2);
strm.bzalloc = ((void *)0);
strm.bzfree = ((void *)0);
strm.opaque = ((void *)0);
ret = BZ2_bzDecompressInit(&strm, verbosity, small);
if (ret != 0)
return ret;
strm.next_in = source;
strm.next_out = dest;
strm.avail_in = sourceLen;
strm.avail_out = *destLen;
ret = BZ2_bzDecompress(&strm);
if (ret == 0)
goto output_overflow_or_eof;
if (ret != 4)
goto errhandler;
*destLen -= strm.avail_out;
BZ2_bzDecompressEnd(&strm);
return 0;
output_overflow_or_eof:
if (strm.avail_out > 0) {
BZ2_bzDecompressEnd(&strm);
return (-7);
} else {
BZ2_bzDecompressEnd(&strm);
return (-8);
};
errhandler:
BZ2_bzDecompressEnd(&strm);
return ret;
} | int BZ2_bzBuffToBuffDecompress(long param_1, int *param_2, long param_3,
undefined4 param_4, int param_5, int param_6)
{
int iVar1;
long in_FS_OFFSET;
long local_68;
undefined4 local_60;
long local_50;
int local_48;
undefined8 local_30;
undefined8 local_28;
undefined8 local_20;
long local_10;
local_10 = *(long *)(in_FS_OFFSET + 0x28);
if ((((param_1 == 0) || (param_2 == (int *)0x0)) || (param_3 == 0)) ||
(((param_5 != 0 && (param_5 != 1)) ||
((param_6 < 0 || (4 < param_6)))))) {
iVar1 = -2;
} else {
local_30 = 0;
local_28 = 0;
local_20 = 0;
iVar1 = BZ2_bzDecompressInit(&local_68, param_6, param_5);
if (iVar1 == 0) {
local_48 = *param_2;
local_68 = param_3;
local_60 = param_4;
local_50 = param_1;
iVar1 = BZ2_bzDecompress(&local_68);
if (iVar1 == 0) {
if (local_48 == 0) {
BZ2_bzDecompressEnd(&local_68);
iVar1 = -8;
} else {
BZ2_bzDecompressEnd(&local_68);
iVar1 = -7;
}
} else if (iVar1 == 4) {
*param_2 = *param_2 - local_48;
BZ2_bzDecompressEnd(&local_68);
iVar1 = 0;
} else {
BZ2_bzDecompressEnd(&local_68);
}
}
}
if (local_10 == *(long *)(in_FS_OFFSET + 0x28)) {
return iVar1;
}
__stack_chk_fail();
} | bzip2 | ghidra |
static void makedumpdir(struct directory *directory, const char *dir) {
size_t i, dirsize, len;
const char *p;
char const **array;
char *new_dump, *new_dump_ptr;
struct dumpdir *dump;
if (directory->children == ALL_CHILDREN)
dump = ((void *)0);
else if (directory->orig)
dump =
directory->orig->idump ? directory->orig->idump : directory->orig->dump;
else
dump = directory->dump;
dirsize = 0;
len = 0;
for (p = dir; *p; p += strlen(p) + 1, dirsize++)
len += strlen(p) + 2;
len++;
array = xcalloc(dirsize, sizeof array[0]);
for (i = 0, p = dir; *p; p += strlen(p) + 1, i++)
array[i] = p;
qsort(array, dirsize, sizeof(array[0]), compare_dirnames);
new_dump = xmalloc(len);
new_dump_ptr = new_dump;
for (i = 0; i < dirsize; i++) {
const char *loc = dumpdir_locate(dump, array[i]);
if (loc) {
if (directory->tagfile)
*new_dump_ptr = 'I';
else
*new_dump_ptr = ' ';
new_dump_ptr++;
} else if (directory->tagfile)
*new_dump_ptr++ = 'I';
else
*new_dump_ptr++ = 'Y';
for (p = array[i]; (*new_dump_ptr++ = *p++);)
;
}
*new_dump_ptr = 0;
directory->idump = directory->dump;
directory->dump = dumpdir_create0(new_dump, ((void *)0));
free(new_dump);
free(array);
} | void makedumpdir(struct_0 *a0, char *a1) {
void *v0;
int tmp_14;
int tmp_22;
void *v1;
void *v2;
char *v3;
char *v4;
void *v5;
void *v6;
char *v7;
unsigned long v8;
char *v10;
unsigned long long v11;
unsigned long long v13;
if (a0->field_38 == 2) {
v5 = 0;
} else if (a0->field_40) {
if (a0->field_40->field_30)
v10 = a0->field_40->field_30;
else
v10 = a0->field_40->field_28;
v5 = v10;
} else {
v5 = a0->field_28;
}
v1 = 0;
v2 = 0;
for (v3 = a1; *(v3); v1 += 1) {
v2 = strlen(v3) + v2 + 2;
v10 = strlen(v3) + 1;
v3 = &v3[v10];
}
v2 += 1;
v6 = xcalloc(v1, 0x8, v11);
v0 = 0;
for (v3 = a1; *(v3); v0 += 1) {
*((0x8 * v0 + v6)) = v3;
v10 = strlen(v3) + 1;
v3 = &v3[v10];
}
qsort(v6, v1, 0x8, compare_dirnames);
v7 = xmalloc(v2);
v4 = v7;
for (v0 = 0; v0 < v1; v0 += 1) {
v8 = dumpdir_locate(v5, *((v6 + 0x8 * v0)));
if (v8) {
if (a0->field_48)
*(v4) = 73;
else
*(v4) = 32;
v4 += 1;
} else if (a0->field_48) {
v10 = v4;
v4 += 1;
*(v10) = 73;
} else {
v10 = v4;
v4 += 1;
*(v10) = 89;
}
v3 = *((v6 + 0x8 * v0));
do {
tmp_14 = v3;
v3 += 1;
tmp_22 = v4;
v4 += 1;
*(tmp_22) = *(tmp_14);
*(&v10) = *(tmp_22);
} while (v10);
}
*(v4) = 0;
a0->field_30 = a0->field_28;
a0->field_28 = dumpdir_create0(v7, NULL);
free(v7);
v13 = free(v6);
return;
} | tar | angr_dream |
u_int32_t sshkey_signatures_left(const struct sshkey *k) { return 0; } | long long sshkey_signatures_left(unsigned long a0) {
unsigned long v0;
v0 = a0;
return 0;
} | openssh-portable | angr_phoenix |
int main(int argc, char **argv) {
Prog = Basename(argv[0]);
log_set_progname(Prog);
log_set_logfd(stderr);
(void)setlocale(6, "");
(void)bindtextdomain("shadow", "/usr/share/locale");
(void)textdomain("shadow");
process_root_flag("-R", argc, argv);
{
int c;
static struct option const longopts[] = {
{"before", 1, ((void *)0), 'b'}, {"clear", 0, ((void *)0), 'C'},
{"help", 0, ((void *)0), 'h'}, {"root", 1, ((void *)0), 'R'},
{"set", 0, ((void *)0), 'S'}, {"time", 1, ((void *)0), 't'},
{"user", 1, ((void *)0), 'u'}, {((void *)0), 0, ((void *)0), '\0'}};
while ((c = getopt_long(argc, argv, "b:ChR:St:u:", longopts,
((void *)0))) != -1) {
switch (c) {
case 'b': {
unsigned long inverse_days;
if (getulong(optarg, &inverse_days) == 0) {
fprintf(stderr, gettext("%s: invalid numeric argument '%s'\n"), Prog,
optarg);
exit(1);
}
inverse_seconds = (time_t)inverse_days * (24L * 3600L);
bflg = 1;
break;
}
case 'C': {
Cflg = 1;
break;
}
case 'h':
usage(0);
break;
case 'R':
break;
case 'S': {
Sflg = 1;
break;
}
case 't': {
unsigned long days;
if (getulong(optarg, &days) == 0) {
fprintf(stderr, gettext("%s: invalid numeric argument '%s'\n"), Prog,
optarg);
exit(1);
}
seconds = (time_t)days * (24L * 3600L);
tflg = 1;
break;
}
case 'u': {
const struct passwd *pwent;
uflg = 1;
pwent = getpwnam(optarg);
if (((void *)0) != pwent) {
umin = (unsigned long)pwent->pw_uid;
has_umin = 1;
umax = umin;
has_umax = 1;
} else {
if (getrange(optarg, &umin, &has_umin, &umax, &has_umax) == 0) {
fprintf(stderr, gettext("%s: Unknown user or range: %s\n"), Prog,
optarg);
exit(1);
}
}
break;
}
default:
usage(1);
break;
}
}
if (argc > optind) {
fprintf(stderr, gettext("%s: unexpected argument: %s\n"), Prog,
argv[optind]);
usage(1);
}
if (Cflg && Sflg) {
fprintf(stderr,
gettext("%s: Option -C cannot be used together with option -S\n"),
Prog);
usage(1);
}
if ((Cflg || Sflg) && !uflg) {
fprintf(
stderr,
gettext(
"%s: Options -C and -S require option -u to specify the user\n"),
Prog);
usage(1);
}
}
lastlogfile = fopen("/var/log/lastlog", (Cflg || Sflg) ? "r+" : "r");
if (((void *)0) == lastlogfile) {
perror("/var/log/lastlog");
exit(1);
}
if (fstat(fileno(lastlogfile), &statbuf) != 0) {
fprintf(stderr, gettext("%s: Cannot get the size of %s: %s\n"), Prog,
"/var/log/lastlog", strerror((*__errno_location())));
exit(1);
}
if (Cflg || Sflg)
update();
else
print();
(void)fclose(lastlogfile);
return 0;
} | int main(unsigned long a0, unsigned long long *a1) {
unsigned int v0;
char v1;
struct_0 *v2;
unsigned long long v4;
Prog = Basename(*(a1));
log_set_progname(0xdc7d8928ec834853);
log_set_logfd(stderr);
setlocale(0x6, &g_40133f);
bindtextdomain("shadow", "/usr/share/locale");
textdomain("shadow");
process_root_flag("-R", a0, a1);
while (true) {
v0 = getopt_long(a0, a1, "b:ChR:St:u:", &longopts.5863, NULL);
if (v0 == -1)
break;
switch (v0) {
case 67:
Cflg = 1;
break;
case 82:
break;
case 83:
Sflg = 1;
break;
case 98:
if (getulong(*(&optarg), &v1, &v1)) {
inverse_seconds = *(&v1) * 86400;
bflg = 1;
break;
} else {
fprintf(stderr, gettext("%s: invalid numeric argument '%s'\n"));
exit(0x1);
}
case 104:
usage(0x0);
case 116:
if (getulong(*(&optarg), &v1, &v1)) {
seconds = *(&v1) * 86400;
tflg = 1;
break;
} else {
fprintf(stderr, gettext("%s: invalid numeric argument '%s'\n"));
exit(0x1);
}
case 117:
uflg = 1;
v2 = &getpwnam(*(&optarg))->pw_name;
if (v2) {
umin = v2->field_10;
has_umin = 1;
umax = umin;
has_umax = 1;
break;
} else {
if (!getrange(*(&optarg), &umin, &has_umin, &umax, &has_umax)) {
fprintf(stderr, gettext("%s: Unknown user or range: %s\n"));
exit(0x1);
}
break;
}
default:
usage(0x1);
}
}
if (a0 > optind) {
fprintf(stderr, gettext("%s: unexpected argument: %s\n"));
usage(0x1);
}
if (Cflg && Sflg) {
fprintf(stderr,
gettext("%s: Option -C cannot be used together with option -S\n"));
usage(0x1);
}
if ((Cflg || Sflg) && (uflg ^ 1)) {
fprintf(
stderr,
gettext(
"%s: Options -C and -S require option -u to specify the user\n"));
usage(0x1);
}
if (Cflg || Sflg)
v4 = "r+";
else
v4 = "r";
lastlogfile = fopen("/var/log/lastlog", v4);
if (!lastlogfile) {
perror("/var/log/lastlog");
exit(0x1);
} else if (!fstat(fileno(lastlogfile), &statbuf)) {
if (Cflg || Sflg)
update();
else
print();
fclose(lastlogfile);
return 0;
} else {
strerror(*(__errno_location()));
fprintf(stderr, gettext("%s: Cannot get the size of %s: %s\n"));
exit(0x1);
}
} | shadow | angr_sailr |
static struct sshkey *load_pkcs11_key(char *path) {
struct sshkey **keys = ((void *)0), *public, *private = ((void *)0);
int r, i, nkeys;
if ((r = sshkey_load_public(path, &public, ((void *)0))) != 0)
sshfatal("ssh-keygen.c", __func__, 1706, 0, SYSLOG_LEVEL_FATAL, ssh_err(r),
"Couldn't load CA public key \"%s\"", path);
nkeys = pkcs11_add_provider(pkcs11provider, identity_passphrase, &keys,
((void *)0));
sshlog("ssh-keygen.c", __func__, 1710, 1, SYSLOG_LEVEL_DEBUG3, ((void *)0),
"%d keys", nkeys);
if (nkeys <= 0)
sshfatal("ssh-keygen.c", __func__, 1712, 0, SYSLOG_LEVEL_FATAL, ((void *)0),
"cannot read public key from pkcs11");
for (i = 0; i < nkeys; i++) {
if (sshkey_equal_public(public, keys[i])) {
private = keys[i];
continue;
}
sshkey_free(keys[i]);
}
free(keys);
sshkey_free(public);
return private;
} | int load_pkcs11_key(unsigned long long a0) {
unsigned long v0;
unsigned int v1;
unsigned int v2;
unsigned int v3;
void *v4;
char v5;
void *v6;
unsigned long long v7;
unsigned long v8;
char v9;
unsigned long long v10;
v4 = 0;
v6 = 0;
v2 = sshkey_load_public(a0, &v5, 0x0);
if (v2) {
v0 = a0;
sshfatal("ssh-keygen.c", "load_pkcs11_key", 0x6aa, 0x0, 0x1, ssh_err(v2),
"Couldn\'t load CA public key \"%s\"");
}
v3 = pkcs11_add_provider(pkcs11provider, identity_passphrase, &v4, 0x0);
v8 = v3;
v7 = "%d keys";
sshlog("ssh-keygen.c", "load_pkcs11_key", 0x6ae, 0x1, 0x7, 0x0, *(&v9), v10);
if (v3 <= 0) {
v7 = "cannot read public key from pkcs11";
sshfatal("ssh-keygen.c", "load_pkcs11_key", 0x6b0, 0x0, 0x1, 0x0, *(&v9));
}
for (v1 = 0; v1 < v3; v1 = __addvsi3(v1, 0x1)) {
if (!sshkey_equal_public(*(&v5), *((v4 + 8 * v1)), *((v4 + 8 * v1))))
sshkey_free(*((v4 + 8 * v1)));
else
v6 = *((v4 + 8 * v1));
}
free(v4);
sshkey_free(*(&v5));
return v6;
} | openssh-portable | angr_phoenix |
void print(char *s) {
int fd;
if ((fd = console_open(01 | 0400 | 04000)) >= 0) {
safe_write(fd, s, strlen(s));
close(fd);
}
} | void print(char *a0) {
unsigned int v0;
unsigned long long v3;
v0 = console_open(0x901);
if (v0 >= 0) {
safe_write(v0, a0, strlen(a0));
v3 = close(v0);
}
return;
} | sysvinit | angr_phoenix |
static void maybe_make_readline_line(new_line) char *new_line;
{
if (new_line && strcmp(new_line, rl_line_buffer) != 0) {
rl_point = rl_end;
rl_add_undo(UNDO_BEGIN, 0, 0, 0);
rl_delete_text(0, rl_point);
rl_point = rl_end = rl_mark = 0;
rl_insert_text(new_line);
rl_add_undo(UNDO_END, 0, 0, 0);
}
} | void maybe_make_readline_line(char *a0) {
unsigned long long v2;
if (a0 && strcmp(a0, rl_line_buffer)) {
rl_point = rl_end;
rl_add_undo(0x2, 0x0, 0x0, 0x0);
rl_delete_text(0x0, rl_point, 0x0);
rl_mark = 0;
rl_end = rl_mark;
rl_point = rl_end;
rl_insert_text(a0);
v2 = rl_add_undo(0x3, 0x0, 0x0, 0x0);
}
return;
} | bash | angr_phoenix |
test_code_t test_etm(gnutls_session_t session) {
int ret;
if (tls_ext_ok == 0)
return TEST_IGNORE;
sprintf(prio_str,
"NONE:"
"+AES-128-CBC:+AES-256-CBC:"
"+COMP-NULL"
":%s:"
"+MAC-ALL:+MD5:+SHA1"
":+GOST28147-TC26Z-IMIT"
":%s:"
"+RSA:+DHE-RSA:+DHE-DSS:+ANON-DH:+ECDHE-RSA:+ECDHE-ECDSA:+ANON-ECDH"
":+VKO-GOST-12",
rest, protocol_str);
{
int _ret;
if ((_ret = __gnutls_priority_set_direct(session, prio_str, 495)) !=
TEST_SUCCEED) {
return _ret;
}
};
gnutls_credentials_set(session, GNUTLS_CRD_CERTIFICATE, xcred);
ret = test_do_handshake(session);
if (ret < 0)
return TEST_FAILED;
if (gnutls_session_etm_status(session) != 0)
return TEST_SUCCEED;
return TEST_FAILED;
} | long long test_etm(unsigned long long a0) {
unsigned int v0;
unsigned int v1;
unsigned long long v3;
if (!tls_ext_ok) {
v3 = 3;
return v3;
}
sprintf(&prio_str,
"NONE:+AES-128-CBC:+AES-256-CBC:+COMP-NULL:%s:+MAC-ALL:+MD5:+SHA1:+"
"GOST28147-TC26Z-IMIT:%s:+RSA:+DHE-RSA:+DHE-DSS:+ANON-DH:+ECDHE-RSA:+"
"ECDHE-ECDSA:+ANON-ECDH:+VKO-GOST-12",
&rest, &protocol_str);
v0 = __gnutls_priority_set_direct(a0, &prio_str, 0x1ef);
if (v0) {
v3 = v0;
return v3;
}
gnutls_credentials_set(a0, 0x1, xcred);
v1 = test_do_handshake(a0);
v3 = (v1 < 0 ? (!gnutls_session_etm_status(a0) ? 0 : 1) : 1);
return v3;
} | gnutls | angr_sailr |
static int session_exec_req(struct ssh *ssh, Session *s) {
u_int success;
int r;
char *command = ((void *)0);
if ((r = sshpkt_get_cstring(ssh, &command, ((void *)0))) != 0 ||
(r = sshpkt_get_end(ssh)) != 0)
sshpkt_fatal(ssh, r, "%s: parse packet", __func__);
success = do_exec(ssh, s, command) == 0;
free(command);
return success;
} | int session_exec_req(unsigned long long a0, void *a1) {
unsigned int v0;
unsigned int v1;
void *v2;
v2 = 0;
v0 = sshpkt_get_cstring(a0, &v2, 0x0, &v2);
if (!v0) {
v0 = sshpkt_get_end(a0);
if (!v0)
goto LABEL_405063;
}
sshpkt_fatal(a0, v0, "%s: parse packet", "session_exec_req");
LABEL_405063:
v1 = !do_exec(a0, a1, v2);
free(v2);
return v1;
} | openssh-portable | angr_phoenix |
int xfrm_xfrmproto_getbyname(char *name) {
int i;
for (i = 0;; i++) {
const struct typeent *t = &xfrmproto_types[i];
if (!t->t_name || t->t_type == -1)
break;
if (strcmp(t->t_name, name) == 0)
return t->t_type;
}
return -1;
} | int xfrm_xfrmproto_getbyname(char *a0) {
unsigned int v0;
struct_0 *v1;
unsigned int v3;
for (v0 = 0; v1->field_0; v0 += 1) {
v1 = &(&xfrmproto_types)[2 * v0];
if (v1->field_8 == -1) {
v3 = -1;
return v3;
} else if (!strcmp(v1->field_0, a0)) {
v3 = v1->field_8;
return v3;
}
}
v3 = -1;
return v3;
} | iproute2-6.0.0 | angr_sailr |
int sshsig_get_pubkey(struct sshbuf *signature, struct sshkey **pubkey) {
struct sshkey *pk = ((void *)0);
int r = -21;
if (pubkey == ((void *)0))
return -1;
if ((r = sshsig_parse_preamble(signature)) != 0)
return r;
if ((r = sshkey_froms(signature, &pk)) != 0)
return r;
*pubkey = pk;
pk = ((void *)0);
return 0;
} | long long sshsig_get_pubkey(unsigned long long a0, unsigned long long *a1) {
unsigned int v0;
void *v1;
unsigned long long v3;
v1 = 0;
v0 = -21;
if (!a1) {
v3 = 4294967295;
} else {
v0 = sshsig_parse_preamble(a0);
if (v0) {
v3 = v0;
} else {
v0 = sshkey_froms(a0, &v1, &v1);
if (v0) {
v3 = v0;
} else {
*(a1) = v1;
v1 = 0;
v3 = 0;
}
}
}
return v3;
} | openssh-portable | angr_dream |
void reset() {
{
basepf.lleft = basepf.nleft = 0;
basepf.unget = 0;
popallfiles();
}
{
}
{
unwindlocalvars(0);
}
} | long reset() {
basepf[4] = 0;
basepf[5] = basepf[4];
basepf[32] = 0;
popallfiles();
return unwindlocalvars(0LL);
} | dash-0.5.11+git20210903+057cd650a4ed | ida |
char *vis(char *dst, int c, int flag, int nextc) {
if ((((c) == '\\' || (flag & 0x400) == 0) &&
(((u_int)(c) <= (0x7f * 2 + 1) && ((((u_char)(c)) & ~0x7f) == 0) &&
(((c) != '*' && (c) != '?' && (c) != '[' && (c) != '#') ||
(flag & 0x100) == 0) &&
((*__ctype_b_loc())[(int)(((u_char)(c)))] &
(unsigned short int)_ISgraph)) ||
((flag & 0x04) == 0 && (c) == ' ') ||
((flag & 0x08) == 0 && (c) == '\t') ||
((flag & 0x10) == 0 && (c) == '\n') ||
((flag & 0x20) && ((c) == '\b' || (c) == '\007' || (c) == '\r' ||
((*__ctype_b_loc())[(int)(((u_char)(c)))] &
(unsigned short int)_ISgraph)))))) {
if ((c == '"' && (flag & 0x200) != 0) || (c == '\\' && (flag & 0x40) == 0))
*dst++ = '\\';
*dst++ = c;
*dst = '\0';
return (dst);
}
if (flag & 0x02) {
switch (c) {
case '\n':
*dst++ = '\\';
*dst++ = 'n';
goto done;
case '\r':
*dst++ = '\\';
*dst++ = 'r';
goto done;
case '\b':
*dst++ = '\\';
*dst++ = 'b';
goto done;
case '\a':
*dst++ = '\\';
*dst++ = 'a';
goto done;
case '\v':
*dst++ = '\\';
*dst++ = 'v';
goto done;
case '\t':
*dst++ = '\\';
*dst++ = 't';
goto done;
case '\f':
*dst++ = '\\';
*dst++ = 'f';
goto done;
case ' ':
*dst++ = '\\';
*dst++ = 's';
goto done;
case '\0':
*dst++ = '\\';
*dst++ = '0';
if ((((u_char)(nextc)) >= '0' && ((u_char)(nextc)) <= '7')) {
*dst++ = '0';
*dst++ = '0';
}
goto done;
}
}
if (((c & 0177) == ' ') || (flag & 0x01) ||
((flag & 0x100) && (c == '*' || c == '?' || c == '[' || c == '#'))) {
*dst++ = '\\';
*dst++ = ((u_char)c >> 6 & 07) + '0';
*dst++ = ((u_char)c >> 3 & 07) + '0';
*dst++ = ((u_char)c & 07) + '0';
goto done;
}
if ((flag & 0x40) == 0)
*dst++ = '\\';
if (c & 0200) {
c &= 0177;
*dst++ = 'M';
}
if (((*__ctype_b_loc())[(int)(((u_char)c))] & (unsigned short int)_IScntrl)) {
*dst++ = '^';
if (c == 0177)
*dst++ = '?';
else
*dst++ = c + '@';
} else {
*dst++ = '-';
*dst++ = c;
}
done:
*dst = '\0';
return (dst);
} | _BYTE *vis(_BYTE *a1, unsigned int a2, short a3, unsigned char a4) {
_BYTE *v4;
_BYTE *v6;
_BYTE *v7;
_BYTE *v8;
unsigned int v11;
_BYTE *v12;
_BYTE *v13;
_BYTE *v14;
v12 = a1;
v11 = a2;
if (a2 != 92 && (a3 & 0x400) != 0 ||
(a2 > 0xFF || (a2 & 0x80) != 0 ||
(a2 == 42 || a2 == 63 || a2 == 91 || a2 == 35) && (a3 & 0x100) != 0 ||
((*_ctype_b_loc())[(unsigned char)a2] & 0x8000u) == 0) &&
((a3 & 4) != 0 || a2 != 32) && ((a3 & 8) != 0 || a2 != 9) &&
((a3 & 0x10) != 0 || a2 != 10) &&
((a3 & 0x20) == 0 ||
a2 != 8 && a2 != 7 && a2 != 13 &&
((*_ctype_b_loc())[(unsigned char)a2] & 0x8000u) == 0)) {
if ((a3 & 2) != 0) {
switch (a2) {
case 0u:
*a1 = 92;
v14 = a1 + 2;
a1[1] = 48;
if (a4 > 0x2Fu && a4 <= 0x37u) {
*v14 = 48;
v14 = a1 + 4;
a1[3] = 48;
}
break;
case 7u:
*a1 = 92;
v14 = a1 + 2;
a1[1] = 97;
break;
case 8u:
*a1 = 92;
v14 = a1 + 2;
a1[1] = 98;
break;
case 9u:
*a1 = 92;
v14 = a1 + 2;
a1[1] = 116;
break;
case 0xAu:
*a1 = 92;
v14 = a1 + 2;
a1[1] = 110;
break;
case 0xBu:
*a1 = 92;
v14 = a1 + 2;
a1[1] = 118;
break;
case 0xCu:
*a1 = 92;
v14 = a1 + 2;
a1[1] = 102;
break;
case 0xDu:
*a1 = 92;
v14 = a1 + 2;
a1[1] = 114;
break;
case 0x20u:
*a1 = 92;
v14 = a1 + 2;
a1[1] = 115;
break;
default:
goto LABEL_41;
}
} else {
LABEL_41:
if ((a2 & 0x7F) == 32 || (a3 & 1) != 0 ||
(a3 & 0x100) != 0 && (a2 == 42 || a2 == 63 || a2 == 91 || a2 == 35)) {
*a1 = 92;
a1[1] = ((unsigned char)a2 >> 6) + 48;
a1[2] = (((unsigned char)a2 >> 3) & 7) + 48;
v14 = a1 + 4;
a1[3] = (a2 & 7) + 48;
} else {
if ((a3 & 0x40) == 0) {
v12 = a1 + 1;
*a1 = 92;
}
if ((a2 & 0x80) != 0) {
v11 = a2 & 0x7F;
v6 = v12++;
*v6 = 77;
}
if (((*_ctype_b_loc())[(unsigned char)v11] & 2) != 0) {
*v12 = 94;
v7 = v12 + 1;
v14 = v12 + 2;
if (v11 == 127)
*v7 = 63;
else
*v7 = v11 + 64;
} else {
*v12 = 45;
v8 = v12 + 1;
v14 = v12 + 2;
*v8 = v11;
}
}
}
*v14 = 0;
return v14;
} else {
if (a2 == 34 && (a3 & 0x200) != 0 || a2 == 92 && (a3 & 0x40) == 0) {
v12 = a1 + 1;
*a1 = 92;
}
v4 = v12;
v13 = v12 + 1;
*v4 = a2;
*v13 = 0;
return v13;
}
} | openssh-portable | ida |
static int userauth_kbdint(struct ssh *ssh, const char *method) {
int r, authenticated = 0;
char *lang, *devs;
if ((r = sshpkt_get_cstring(ssh, &lang, ((void *)0))) != 0 ||
(r = sshpkt_get_cstring(ssh, &devs, ((void *)0))) != 0 ||
(r = sshpkt_get_end(ssh)) != 0)
sshfatal("auth2-kbdint.c", __func__, 55, 1, SYSLOG_LEVEL_FATAL, ssh_err(r),
"parse packet");
sshlog("auth2-kbdint.c", __func__, 57, 0, SYSLOG_LEVEL_DEBUG1, ((void *)0),
"keyboard-interactive devs %s", devs);
if (options.kbd_interactive_authentication)
authenticated = auth2_challenge(ssh, devs);
free(devs);
free(lang);
return authenticated;
} | long long userauth_kbdint(unsigned long long a0, unsigned long a1) {
unsigned long long v0;
unsigned long v1;
unsigned int v2;
unsigned int v3;
char v4;
char v5;
unsigned long long v6;
unsigned long long v7;
char v8;
v1 = a1;
v3 = 0;
v2 = sshpkt_get_cstring(a0, &v4, 0x0, &v4);
if (v2) {
LABEL_400081:
v0 = "parse packet";
sshfatal("auth2-kbdint.c", "userauth_kbdint", 0x37, 0x1, 0x1, ssh_err(v2));
} else {
v2 = sshpkt_get_cstring(a0, &v5, 0x0, &v5);
if (v2 || (v2 = sshpkt_get_end(a0), v2))
goto LABEL_400081;
}
v7 = *(&v5);
v6 = "keyboard-interactive devs %s";
sshlog("auth2-kbdint.c", "userauth_kbdint", 0x39, 0x0, 0x5, 0x0, *(&v8));
if (*(5244268))
v3 = auth2_challenge(a0, *(&v5), *(&v5));
free(*(&v5));
free(*(&v4));
return v3;
} | openssh-portable | angr_sailr |
static _Bool
getseq(FILE *fp, struct seq *seq, int whichfile) {
if (seq->count == seq->alloc) {
seq->lines =
((!!sizeof(struct {
_Static_assert(
sizeof *(seq->lines) != 1,
"verify_expr ("
"sizeof *(seq->lines) != 1"
", "
"x2nrealloc (seq->lines, &seq->alloc, sizeof *(seq->lines))"
")");
int _gl_dummy;
}))
? (x2nrealloc(seq->lines, &seq->alloc, sizeof *(seq->lines)))
: (x2nrealloc(seq->lines, &seq->alloc, sizeof *(seq->lines))));
for (size_t i = seq->count; i < seq->alloc; i++)
seq->lines[i] = ((void *)0);
}
if (get_line(fp, &seq->lines[seq->count], whichfile)) {
++seq->count;
return 1;
}
return 0;
} | void getseq(void *a0, unsigned long long a1[3], unsigned long a2) {
unsigned long long *v0;
void *v2;
unsigned long long v3;
if (a1[0] == a1[1]) {
a1[2] = x2nrealloc(a1[2], &a1[1], 0x8, &a1[1]);
for (v0 = a1[0]; v0 < a1[1]; v0 = v0 + 1) {
*((a1[2] + v0 * 8)) = 0;
}
}
if (!get_line(a0, a1[2] + (a1[0] << 3), a2)) {
v2 = 0;
} else {
a1[0] = a1[0] + 1;
v3 = 1;
}
return;
} | coreutils | angr_phoenix |
int sshbuf_putb(struct sshbuf *buf, const struct sshbuf *v) {
if (v == ((void *)0))
return 0;
return sshbuf_put(buf, sshbuf_ptr(v), sshbuf_len(v));
} | undefined8 sshbuf_putb(undefined8 param_1, long param_2)
{
undefined8 uVar1;
undefined8 uVar2;
if (param_2 == 0) {
uVar1 = 0;
} else {
uVar1 = sshbuf_len(param_2);
uVar2 = sshbuf_ptr(param_2);
uVar1 = sshbuf_put(param_1, uVar2, uVar1);
}
return uVar1;
} | openssh-portable | ghidra |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.