input stringlengths 26 172k | output stringlengths 18 318k | repo_name stringclasses 23 values | decompiler stringclasses 5 values |
|---|---|---|---|
static const char *progress_meter_path(const char *path) {
const char *progresspath;
if ((progresspath = strrchr(path, '/')) == ((void *)0))
return path;
progresspath++;
if (*progresspath == '\0')
return path;
return progresspath;
} | int progress_meter_path(char *a0) {
unsigned long v0;
unsigned int v2;
v0 = strrchr(a0, 0x2f);
if (!v0) {
v2 = a0;
return v2;
}
v0 += 1;
v2 = (!*(v0) ? v0 : a0);
return v2;
} | openssh-portable | angr_sailr |
static void check_inputs(char *const *files, size_t nfiles) {
for (size_t i = 0; i < nfiles; i++) {
if ((strcmp(files[i], "-") == 0))
continue;
if (euidaccess(files[i], 4) != 0)
sort_die(gettext("cannot read"), files[i]);
}
} | void check_inputs(void *a0, unsigned long a1) {
void *v0;
void *v2;
unsigned int v3;
v0 = 0;
while (true) {
v2 = v0;
if (v0 >= a1)
return;
if (strcmp(*((a0 + 0x8 * v0)), "-") &&
euidaccess(*((a0 + 0x8 * v0)), 0x4, v0 << 3))
sort_die(gettext("cannot read"), *((a0 + 0x8 * v0)), v3);
v0 += 1;
}
} | coreutils | angr_phoenix |
DH *dh_new_group1(void) {
static char *gen = "2", *group1 = "FFFFFFFF"
"FFFFFFFF"
"C90FDAA2"
"2168C234"
"C4C6628B"
"80DC1CD1"
"29024E08"
"8A67CC74"
"020BBEA6"
"3B139B22"
"514A0879"
"8E3404DD"
"EF9519B3"
"CD3A431B"
"302B0A6D"
"F25F1437"
"4FE1356D"
"6D51C245"
"E485B576"
"625E7EC6"
"F44C42E9"
"A637ED6B"
"0BFF5CB6"
"F406B7ED"
"EE386BFB"
"5A899FA5"
"AE9F2411"
"7C4B1FE6"
"49286651"
"ECE65381"
"FFFFFFFF"
"FFFFFFFF";
return (dh_new_group_asc(gen, group1));
} | long long dh_new_group1() { return dh_new_group_asc(gen.17681, group1.17682); } | openssh-portable | angr_phoenix |
ssize_t socket_recv(const socket_st *socket, void *buffer, int buffer_size) {
int ret;
if (socket->secure) {
do {
ret = gnutls_record_recv(socket->session, buffer, buffer_size);
if (ret == -293)
gnutls_heartbeat_pong(socket->session, 0);
} while (ret == -52 || ret == -293);
} else
do {
ret = recv(socket->fd, buffer, buffer_size, 0);
} while (ret == -1 && (*__errno_location()) == 4);
return ret;
} | int socket_recv(struct_0 *a0, unsigned long long a1, unsigned long a2) {
unsigned int v0;
if (a0->field_10) {
do {
do {
v0 = gnutls_record_recv(a0->field_8, a1, a2, a1);
if (v0 == -293)
gnutls_heartbeat_pong(a0->field_8, 0x0);
} while (v0 == -52);
} while (v0 == -293);
} else {
while (true) {
v0 = recv(a0->field_0, a1, a2, 0x0);
if (v0 != -1)
break;
if (*(__errno_location()) != 4)
break;
}
}
return v0;
} | gnutls | angr_dream |
static int dns_read_rdata(u_int8_t *algorithm, u_int8_t *digest_type,
u_char **digest, size_t *digest_len, u_char *rdata,
int rdata_len) {
int success = 0;
*algorithm = SSHFP_KEY_RESERVED;
*digest_type = SSHFP_HASH_RESERVED;
if (rdata_len >= 2) {
*algorithm = rdata[0];
*digest_type = rdata[1];
*digest_len = rdata_len - 2;
if (*digest_len > 0) {
*digest = xmalloc(*digest_len);
memcpy(*digest, rdata + 2, *digest_len);
} else {
*digest = (u_char *)xstrdup("");
}
success = 1;
}
return success;
} | int dns_read_rdata(char *a0, char *a1, unsigned long long *a2,
unsigned long long *a3, char a4[2], unsigned long a5) {
unsigned int v0;
v0 = 0;
*(a0) = 0;
*(a1) = 0;
if (a5 <= 1)
return v0;
*(a0) = a4[0];
*(a1) = a4[1];
*(a3) = __addvsi3(a5, 0xfffffffe, a4[1]);
if (*(a3)) {
*(a2) = xmalloc(*(a3));
memcpy(*(a2), a4 + 1, *(a3));
} else {
*(a2) = xstrdup(&g_400c1c);
}
v0 = 1;
return v0;
} | openssh-portable | angr_sailr |
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 long test_safe_renegotiation_scsv(unsigned long long a0) {
unsigned int v0;
unsigned int v1;
unsigned long long v3;
if (!ssl3_ok) {
v3 = 3;
return v3;
}
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");
v0 = __gnutls_priority_set_direct(a0, &prio_str, 0x208);
if (v0) {
v3 = v0;
return v3;
}
gnutls_credentials_set(a0, 0x1, xcred);
v1 = test_do_handshake(a0);
v3 = v1;
return v3;
} | gnutls | angr_sailr |
static union node *simplecmd(void) {
union node *args, **app;
union node *n = ((void *)0);
union node *vars, **vpp;
union node **rpp, *redir;
int savecheckkwd;
int savelinno;
args = ((void *)0);
app = &args;
vars = ((void *)0);
vpp = &vars;
redir = ((void *)0);
rpp = &redir;
savecheckkwd = 0x1;
savelinno = (parsefile->linno);
for (;;) {
checkkwd = savecheckkwd;
switch (readtoken()) {
case 12:
n = (union node *)stalloc(sizeof(struct narg));
n->type = 15;
n->narg.text = wordtext;
n->narg.backquote = backquotelist;
if (savecheckkwd && isassignment(wordtext)) {
*vpp = n;
vpp = &n->narg.next;
} else {
*app = n;
app = &n->narg.next;
savecheckkwd = 0;
}
break;
case 11:
*rpp = n = redirnode;
rpp = &n->nfile.next;
parsefname();
break;
case 7:
if (args && app == &args->narg.next && !vars && !redir) {
struct builtincmd *bcmd;
const char *name;
if (readtoken() != 8)
synexpect(8);
name = n->narg.text;
if (!goodname(name) ||
((bcmd = find_builtin(name)) && bcmd->flags & 0x1))
synerror("Bad function name");
n->type = 14;
checkkwd = 0x4 | 0x2 | 0x1;
n->ndefun.text = n->narg.text;
n->ndefun.linno = (parsefile->linno);
n->ndefun.body = command();
return n;
}
default:
tokpushback++;
goto out;
}
}
out:
*app = ((void *)0);
*vpp = ((void *)0);
*rpp = ((void *)0);
n = (union node *)stalloc(sizeof(struct ncmd));
n->type = 0;
n->ncmd.linno = savelinno;
n->ncmd.args = args;
n->ncmd.assign = vars;
n->ncmd.redirect = redir;
return n;
} | void simplecmd(unsigned long long a0, unsigned long long a1,
unsigned long long a2, unsigned long long a3,
unsigned long long a4, unsigned long long a5) {
unsigned int v0;
unsigned int v1;
void *v2;
void *v3;
void *v4;
unsigned long long *v5;
void *v6;
unsigned long long *v7;
unsigned long long *v8;
unsigned long long v9;
struct_2 *v10;
unsigned long long v12;
struct_0 *v14;
unsigned long long v15;
void *v17;
v6 = 0;
v2 = 0;
v5 = &v2;
v3 = 0;
v7 = &v3;
v4 = 0;
v8 = &v4;
v0 = 1;
v1 = *((parsefile + 8));
while (true) {
quoteflag = v0;
v12 = readtoken(a0, a1, a2, a3, a4, a5);
if (v12 == 12) {
v6 = stalloc(0x20);
v6->field_0 = 15;
v6->field_10 = -556885833387505336;
v6->field_18 = -556885833387505336;
if (v0) {
a0 = -125990584;
if (isassignment(0xf87d8948)) {
a2 = v6;
*(v7) = v6;
v7 = &v6->padding_4[4];
goto LABEL_400eb7;
}
}
a2 = v6;
*(v5) = v6;
v5 = &v6->padding_4[4];
v0 = 0;
goto LABEL_400eb7;
}
if (v12 > 12) {
LABEL_400e36:
quoteflag = 283935561;
*(v5) = 0;
*(v7) = 0;
*(v8) = 0;
v6 = stalloc(0x20);
v6->field_0 = 0;
v6->field_4 = v1;
v6->field_10 = v2;
*(&v6->padding_4[4]) = v3;
v6->field_18 = v4;
v14 = v6;
break;
} else if (v12 != 7) {
if (!(v12 == 11))
goto LABEL_400e36;
v6 = -556885833387505336;
*(v8) = v6;
v8 = &v6->padding_4[4];
parsefname(a0, a1, v6, a3, a4, a5);
LABEL_400eb7:
} else {
if (v2 && v5 == v2 + 8 && !v3 && !v4) {
if (readtoken(a0, a1, a2, a3, a4, a5) != 8)
synexpect(0x8);
v9 = v6[16];
if (goodname(v9)) {
v10 = find_builtin(v9);
if (!v10) {
LABEL_400deb:
*(v6) = 14;
quoteflag = 7;
*(&v6->padding_4[4]) = v6->field_10;
v15 = *((parsefile + 8));
v6->field_4 = *((parsefile + 8));
*(&v6->field_10) = command(a0, a1, v15, a3, a4, a5);
v17 = v6;
break;
} else if (!(v10->field_10 & 1)) {
goto LABEL_400deb;
}
}
synerror("Bad function name");
}
goto LABEL_400e36;
}
}
return;
} | dash-0.5.11+git20210903+057cd650a4ed | angr_phoenix |
static void set(char **var, char *val) {
if (val)
*var = val;
} | void set(unsigned long long *a0, unsigned long a1) {
unsigned long long *v1;
if (a1) {
v1 = a0;
*(a0) = a1;
}
return;
} | sysvinit | angr_sailr |
static void team_slave_print_help(struct link_util *lu, int argc, char **argv,
FILE *f) {
fprintf(f, "Usage: ... team_slave\n");
} | void team_slave_print_help(void)
{
FILE *in_RCX;
fprintf(in_RCX, "Usage: ... team_slave\n");
return;
} | iproute2-6.0.0 | ghidra |
union block *write_extended(_Bool global, struct tar_stat_info *st,
union block *old_header) {
union block *header, hp;
char *p;
int type;
time_t t;
if (st->xhdr.buffer || st->xhdr.stk == ((void *)0))
return old_header;
xheader_finish(&st->xhdr);
memcpy(hp.buffer, old_header, sizeof(hp));
if (global) {
type = 'g';
p = xheader_ghdr_name();
t = start_time.tv_sec;
} else {
type = 'x';
p = xheader_xhdr_name(st);
t = set_mtime_option ? mtime_option.tv_sec : st->stat.st_mtim.tv_sec;
}
xheader_write(type, p, t, &st->xhdr);
free(p);
header = find_next_block();
memcpy(header, &hp.buffer, sizeof(hp.buffer));
return header;
} | int write_extended(unsigned long a0, unsigned long long a1[48], void *a2) {
unsigned int v0;
void *v1;
unsigned long long v2;
void *v3;
char v4;
unsigned long v6;
if (!a1[47] && a1[45]) {
xheader_finish(&a1[45]);
memcpy(&v4, a2, 0x200);
if (a0) {
v0 = 103;
v1 = xheader_ghdr_name();
v2 = start_time;
} else {
v0 = 120;
v1 = xheader_xhdr_name(a1);
if (set_mtime_option)
v6 = mtime_option;
else
v6 = a1[22];
v2 = v6;
}
xheader_write(v0, v1, v2, &a1[45]);
free(v1);
v3 = find_next_block();
memcpy(v3, &v4, 0x200);
*(&v6) = v3;
}
if (!a1[45] || a1[47])
v6 = a2;
return v6;
} | tar | angr_dream |
void explicit_bzero(void *buf, size_t len) {
memset(buf, 0, len);
__explicit_bzero_hook(buf, len);
} | long long explicit_bzero(unsigned long a0, unsigned int a1) {
memset(a0, 0x0, a1);
return __explicit_bzero_hook(a0, a1);
} | libbsd-0.11.7 | angr_sailr |
STRINGLIST *strlist_copy(sl)
STRINGLIST *sl;
{
STRINGLIST *new;
register int i;
if (sl == 0)
return ((STRINGLIST *)0);
new = strlist_create(sl->list_size);
if (sl->list) {
for (i = 0; i < sl->list_size; i++)
new->list[i] =
((sl->list[i]) ? (char *)strcpy(sh_xmalloc((1 + strlen(sl->list[i])),
"stringlist.c", 134),
(sl->list[i]))
: (char *)((void *)0));
}
new->list_size = sl->list_size;
new->list_len = sl->list_len;
if (new->list)
new->list[new->list_len] = (char *)((void *)0);
return new;
} | long strlist_copy(long a1) {
int i;
const char *v3;
size_t v4;
char *v5;
char *v6;
long v7;
if (!a1)
return 0LL;
v7 = strlist_create(*(_DWORD *)(a1 + 8));
if (*(_QWORD *)a1) {
for (i = 0; i < *(_DWORD *)(a1 + 8); ++i) {
if (*(_QWORD *)(8LL * i + *(_QWORD *)a1)) {
v3 = *(const char **)(8LL * i + *(_QWORD *)a1);
v4 = strlen(v3);
v5 = (char *)sh_xmalloc(v4 + 1, "stringlist.c", 134LL);
v6 = strcpy(v5, v3);
} else {
v6 = 0LL;
}
*(_QWORD *)(8LL * i + *(_QWORD *)v7) = v6;
}
}
*(_DWORD *)(v7 + 8) = *(_DWORD *)(a1 + 8);
*(_DWORD *)(v7 + 12) = *(_DWORD *)(a1 + 12);
if (*(_QWORD *)v7)
*(_QWORD *)(*(_QWORD *)v7 + 8LL * *(int *)(v7 + 12)) = 0LL;
return v7;
} | bash | ida |
static void do_pwchange(Session *s) {
fflush(((void *)0));
fprintf(stderr, "WARNING: Your password has expired.\n");
if (s->ttyfd != -1) {
fprintf(stderr, "You must change your password now and login again!\n");
execl("/usr/bin/passwd", "passwd", (char *)((void *)0));
perror("passwd");
} else {
fprintf(stderr, "Password change required but no TTY available.\n");
}
exit(1);
} | void do_pwchange(long param_1)
{
fflush((FILE *)0x0);
fprintf(stderr, "WARNING: Your password has expired.\n");
if (*(int *)(param_1 + 0x34) == -1) {
fprintf(stderr, "Password change required but no TTY available.\n");
} else {
fprintf(stderr, "You must change your password now and login again!\n");
execl("/usr/bin/passwd", "passwd", 0);
perror("passwd");
}
exit(1);
} | openssh-portable | ghidra |
int copy(in, out)
int in, out;
{
int got;
(*__errno_location()) = 0;
while (insize > inptr) {
write_buf(out, (char *)inbuf + inptr, insize - inptr);
got = read_buffer(in, (char *)inbuf, 0x40000);
if (got == -1)
read_error();
bytes_in += got;
insize = (unsigned)got;
inptr = 0;
}
return 0;
} | long copy(int a1, int a2) {
int buffer;
*_errno_location() = 0;
while (insize > inptr) {
write_buf(a2, (char *)&inbuf + inptr, insize - inptr);
buffer = read_buffer(a1, &inbuf, 0x40000);
if (buffer == -1)
read_error();
bytes_in += buffer;
insize = buffer;
inptr = 0;
}
return 0LL;
} | gzip-1.12 | ida |
static Channel *channel_from_packet_id(struct ssh *ssh, const char *where,
const char *what) {
int id = channel_parse_id(ssh, where, what);
Channel *c;
if ((c = channel_lookup(ssh, id)) == ((void *)0)) {
ssh_packet_disconnect(ssh, "%s packet referred to nonexistent channel %d",
what, id);
}
return c;
} | int channel_from_packet_id(void *a0, unsigned int a1, unsigned long long a2) {
unsigned int v0;
unsigned long v1;
v0 = channel_parse_id(a0, a1, a2);
v1 = channel_lookup(a0, v0);
if (!v1)
ssh_packet_disconnect(a0, "%s packet referred to nonexistent channel %d",
a2);
return v1;
} | openssh-portable | angr_phoenix |
static void build_tree(s, desc) deflate_state *s;
tree_desc *desc;
{
ct_data *tree = desc->dyn_tree;
const ct_data *stree = desc->stat_desc->static_tree;
int elems = desc->stat_desc->elems;
int n, m;
int max_code = -1;
int node;
s->heap_len = 0, s->heap_max = (2 * (256 + 1 + 29) + 1);
for (n = 0; n < elems; n++) {
if (tree[n].fc.freq != 0) {
s->heap[++(s->heap_len)] = max_code = n;
s->depth[n] = 0;
} else {
tree[n].dl.len = 0;
}
}
while (s->heap_len < 2) {
node = s->heap[++(s->heap_len)] = (max_code < 2 ? ++max_code : 0);
tree[node].fc.freq = 1;
s->depth[node] = 0;
s->opt_len--;
if (stree)
s->static_len -= stree[node].dl.len;
}
desc->max_code = max_code;
for (n = s->heap_len / 2; n >= 1; n--)
pqdownheap(s, tree, n);
node = elems;
do {
{
n = s->heap[1];
s->heap[1] = s->heap[s->heap_len--];
pqdownheap(s, tree, 1);
};
m = s->heap[1];
s->heap[--(s->heap_max)] = n;
s->heap[--(s->heap_max)] = m;
tree[node].fc.freq = tree[n].fc.freq + tree[m].fc.freq;
s->depth[node] =
(uch)((s->depth[n] >= s->depth[m] ? s->depth[n] : s->depth[m]) + 1);
tree[n].dl.dad = tree[m].dl.dad = (ush)node;
s->heap[1] = node++;
pqdownheap(s, tree, 1);
} while (s->heap_len >= 2);
s->heap[--(s->heap_max)] = s->heap[1];
gen_bitlen(s, (tree_desc *)desc);
gen_codes((ct_data *)tree, max_code, s->bl_count);
} | void build_tree(struct_0 *a0, struct_3 *a1) {
struct_0 *v0;
int tmp_60;
int tmp_35;
unsigned int v1;
unsigned int v2;
unsigned int v3;
unsigned int v4;
unsigned int v5;
unsigned short *v6;
unsigned long v7;
unsigned int v9;
char v10;
unsigned int v11;
unsigned long long v12;
v0 = a0;
v6 = a1->field_0;
v7 = a1->field_10->field_0;
v4 = a1->field_10->field_14;
v2 = -1;
a0->field_14b4 = 0;
a0->field_14b8 = 573;
for (v1 = 0; v1 < v4; v1 += 1) {
if (v6[2 * v1]) {
v2 = v1;
a0->field_14b4 = a0->field_14b4 + 1;
*(&a0->padding_4[3004 + 4 * a0->field_14b4]) = v2;
a0->padding_14bc[v1] = 0;
} else {
v6[1 + 2 * v1] = 0;
}
}
while (true) {
if (a0->field_14b4 <= 1) {
if (v2 <= 1) {
v2 += 1;
v9 = v2;
} else {
v9 = 0;
}
a0->field_14b4 = a0->field_14b4 + 1;
tmp_60 = a0->field_14b4;
*(&a0->padding_4[3004 + 4 * a0->field_14b4]) = v9;
v3 = *(&a0->padding_4[3004 + 4 * tmp_60]);
v6[2 * v3] = 1;
a0->padding_14bc[v3] = 0;
a0->field_1718 = a0->field_1718 - 1;
if (!v7)
continue;
a0->field_1720 = a0->field_1720 - *((v7 + v3 * 4 + 2));
} else {
a1->field_8 = v2;
for (v1 = a0->field_14b4 + (a0->field_14b4 >> 31) >> 1; v1 > 0; v1 -= 1) {
pqdownheap(a0, v6, v1);
}
v3 = v4;
while (true) {
v1 = a0->field_bc4;
tmp_35 = a0->field_14b4;
a0->field_14b4 = a0->field_14b4 - 1;
a0->field_bc4 = *(&a0->padding_4[3004 + 4 * tmp_35]);
pqdownheap(a0, v6, 0x1);
v5 = a0->field_bc4;
a0->field_14b8 = a0->field_14b8 - 1;
*(&a0->padding_4[3004 + 4 * a0->field_14b8]) = v1;
a0->field_14b8 = a0->field_14b8 - 1;
*(&a0->padding_4[3004 + 4 * a0->field_14b8]) = v5;
v6[2 * v3] = v6[2 * v5] + v6[2 * v1];
if (a0->padding_14bc[v1] >= a0->padding_14bc[v5])
v10 = a0->padding_14bc[v1] + 1;
else
v10 = a0->padding_14bc[v5] + 1;
a0->padding_14bc[v3] = v10;
v11 = v3;
v6[1 + 2 * v5] = v3;
v6[1 + 2 * v1] = v6[1 + 2 * v5];
v3 += 1;
a0->field_bc4 = v11;
pqdownheap(a0, v6, 0x1);
if (a0->field_14b4 <= 1)
break;
}
a0->field_14b8 = a0->field_14b8 - 1;
*(&a0->padding_4[3004 + 4 * a0->field_14b8]) = a0->field_bc4;
gen_bitlen(a0, a1);
v12 = gen_codes(v6, v2, &a0->padding_4[2972]);
return;
}
}
} | zlib | angr_dream |
static int deflateStateCheck(strm)
z_streamp strm;
{
deflate_state *s;
if (strm == 0 || strm->zalloc == (alloc_func)0 || strm->zfree == (free_func)0)
return 1;
s = strm->state;
if (s == 0 || s->strm != strm ||
(s->status != 42 &&
s->status != 57 &&
s->status != 69 && s->status != 73 && s->status != 91 &&
s->status != 103 && s->status != 113 && s->status != 666))
return 1;
return 0;
} | _BOOL8 deflateStateCheck(_QWORD *a1) {
long v2;
if (!a1 || !a1[8] || !a1[9])
return 1LL;
v2 = a1[7];
return !v2 || a1 != *(_QWORD **)v2 ||
*(_DWORD *)(v2 + 8) != 42 && *(_DWORD *)(v2 + 8) != 57 &&
*(_DWORD *)(v2 + 8) != 69 && *(_DWORD *)(v2 + 8) != 73 &&
*(_DWORD *)(v2 + 8) != 91 && *(_DWORD *)(v2 + 8) != 103 &&
*(_DWORD *)(v2 + 8) != 113 && *(_DWORD *)(v2 + 8) != 666;
} | zlib | ida |
char *shell_version_string() {
static char tt[32] = {'\0'};
if (tt[0] == '\0') {
if (release_status)
snprintf(tt, sizeof(tt), "%s.%d(%d)-%s", dist_version, patch_level,
build_version, release_status);
else
snprintf(tt, sizeof(tt), "%s.%d(%d)", dist_version, patch_level,
build_version);
}
return tt;
} | int shell_version_string() {
if (!tt.2506) {
if (false)
snprintf(&tt.2506, 0x20, "%s.%d(%d)", &g_4001c0, 0, 1);
snprintf(&tt.2506, 0x20, "%s.%d(%d)-%s", &g_4001c0, 0, 1, &g_4001cc);
}
return &tt.2506;
} | bash | angr_dream |
static void signal_setup(_Bool init) {
static int const sig[] = {
20,
14, 1, 2, 13, 3, 15,
29,
27,
26,
24,
25,
};
enum { nsigs = (sizeof(sig) / sizeof *(sig)) };
int j;
if (init) {
struct sigaction act;
sigemptyset(&caught_signals);
for (j = 0; j < nsigs; j++) {
sigaction(sig[j], ((void *)0), &act);
if (act.__sigaction_handler.sa_handler != ((__sighandler_t)1))
sigaddset(&caught_signals, sig[j]);
}
act.sa_mask = caught_signals;
act.sa_flags = 0x10000000;
for (j = 0; j < nsigs; j++)
if (sigismember(&caught_signals, sig[j])) {
act.__sigaction_handler.sa_handler =
sig[j] == 20 ? stophandler : sighandler;
sigaction(sig[j], &act, ((void *)0));
}
} else {
for (j = 0; j < nsigs; j++)
if (sigismember(&caught_signals, sig[j]))
signal(sig[j], ((__sighandler_t)0));
}
} | unsigned long signal_setup(char a1) {
void (*v1)(int);
int i;
int j;
int k;
struct sigaction v6;
unsigned long v7;
v7 = __readfsqword(0x28u);
if (a1) {
sigemptyset(&caught_signals);
for (i = 0; i <= 11; ++i) {
sigaction(sig_9171[i], 0LL, &v6);
if (v6.sa_handler != (__sighandler_t)&loc_1)
sigaddset(&caught_signals, sig_9171[i]);
}
v6.sa_mask = caught_signals;
v6.sa_flags = 0x10000000;
for (j = 0; j <= 11; ++j) {
if (sigismember(&caught_signals, sig_9171[j])) {
if (sig_9171[j] == 20)
v1 = (void (*)(int))stophandler;
else
v1 = (void (*)(int))sighandler;
v6.sa_handler = v1;
sigaction(sig_9171[j], &v6, 0LL);
}
}
} else {
for (k = 0; k <= 11; ++k) {
if (sigismember(&caught_signals, sig_9171[k]))
signal(sig_9171[k], 0LL);
}
}
return __readfsqword(0x28u) ^ v7;
} | coreutils | ida |
void trig_activate_packageprocessing(struct pkginfo *pkg) {
debug(dbg_triggersdetail, "trigproc_activate_packageprocessing pkg=%s",
pkg_name(pkg, pnaw_always));
trig_parse_ci(pkg_infodb_get_file(pkg, &pkg->installed, "triggers"),
((void *)0), trig_cicb_statuschange_activate, pkg,
&pkg->installed);
} | void trig_activate_packageprocessing(long param_1)
{
undefined8 uVar1;
uVar1 = pkg_name(param_1, 3);
debug(0x2000, "trigproc_activate_packageprocessing pkg=%s", uVar1);
uVar1 = pkg_infodb_get_file(param_1, param_1 + 0x48, "triggers");
trig_parse_ci(uVar1, 0, uRam00000000001002b4, param_1, param_1 + 0x48);
return;
} | dpkg | ghidra |
void write_dummy_declarations(stream, builtins) FILE *stream;
ARRAY *builtins;
{
register int i;
BUILTIN_DESC *builtin;
for (i = 0; structfile_header[i]; i++)
fprintf(stream, "%s\n", structfile_header[i]);
for (i = 0; i < builtins->sindex; i++) {
builtin = (BUILTIN_DESC *)builtins->array[i];
fprintf(stream, "int %s () { return (0); }\n", builtin->function);
}
} | long long write_dummy_declarations(void *a0, struct_0 *a1) {
struct_2 *v0;
void *v2;
void *v3;
for (v2 = 0; *((0x8 * v2 + &structfile_header[0])); v2 = v2 + 1) {
fprintf(a0, "%s\n", *((0x8 * v2 + &structfile_header[0])));
}
for (v3 = 0; v3 < a1->field_4; v3 = v3 + 1) {
v0 = *((&a1->field_10->field_0 + 0x8 * v3));
fprintf(a0, "int %s () { return (0); }\n", v0->field_8);
}
return a1->field_4;
} | bash | angr_phoenix |
void changepath(const char *newval) {
const char *new;
int idx;
int bltin;
new = newval;
idx = 0;
bltin = -1;
for (;;) {
if (*new == '%' && prefix(new + 1, "builtin")) {
bltin = idx;
break;
}
new = strchr(new, ':');
if (!new)
break;
idx++;
new++;
}
builtinloc = bltin;
clearcmdentry();
} | long long changepath(char *a0) {
unsigned int v0;
unsigned int v1;
char *v2;
unsigned long long v4;
v2 = a0;
v0 = 0;
v1 = -1;
while (true) {
if (*(v2) == 37) {
v4 = prefix(v2 + 1, "builtin");
if (v4) {
v1 = v0;
break;
}
}
if (!v4 || *(v2) != 37) {
v2 = strchr(v2, 0x3a);
if (!v2)
break;
if (v2) {
v0 += 1;
v2 += 1;
}
}
}
builtinloc = v1;
return clearcmdentry();
} | dash-0.5.11+git20210903+057cd650a4ed | angr_dream |
static int quota_inum_is_reserved(ext2_filsys fs, ext2_ino_t ino) {
enum quota_type qtype;
for (qtype = 0; qtype < MAXQUOTAS; qtype++)
if (quota_type2inum(qtype, fs->super) == ino)
return 1;
return 0;
} | undefined8 quota_inum_is_reserved(long param_1, int param_2)
{
int iVar1;
uint local_c;
local_c = 0;
while (true) {
if (2 < local_c) {
return 0;
}
iVar1 = quota_type2inum(local_c, *(undefined8 *)(param_1 + 0x20));
if (param_2 == iVar1)
break;
local_c = local_c + 1;
}
return 1;
} | e2fsprogs-1.46.5 | ghidra |
void coproc_fdchk(fd) int fd;
{
coproc_checkfd(&sh_coproc, fd);
} | void coproc_fdchk(undefined4 param_1)
{
coproc_checkfd(sh_coproc, param_1);
return;
} | bash | ghidra |
static int restore_handler(struct rtnl_ctrl_data *ctrl, struct nlmsghdr *n,
void *arg) {
struct rtmsg *r =
((void *)(((char *)n) +
((int)(((sizeof(struct nlmsghdr)) + 4U - 1) & ~(4U - 1)))));
struct rtattr *tb[(__RTA_MAX - 1) + 1];
int len = n->nlmsg_len -
((sizeof(*r)) +
((int)(((sizeof(struct nlmsghdr)) + 4U - 1) & ~(4U - 1))));
int ret, prio = *(int *)arg;
parse_rtattr(
tb, (__RTA_MAX - 1),
((struct rtattr *)(((char *)(r)) +
(((sizeof(struct rtmsg)) + 4U - 1) & ~(4U - 1)))),
len);
if (!prio && !tb[RTA_GATEWAY] &&
(!tb[RTA_PREFSRC] || !rtattr_cmp(tb[RTA_PREFSRC], tb[RTA_DST])))
goto restore;
else if (prio == 1 && !tb[RTA_GATEWAY] && tb[RTA_PREFSRC] &&
rtattr_cmp(tb[RTA_PREFSRC], tb[RTA_DST]))
goto restore;
else if (prio == 2 && tb[RTA_GATEWAY])
goto restore;
return 0;
restore:
n->nlmsg_flags |= 0x01 | 0x400 | 0x04;
ll_init_map(&rth);
ret = rtnl_talk(&rth, n, ((void *)0));
if ((ret < 0) && ((*__errno_location()) == 17))
ret = 0;
return ret;
} | int restore_handler(undefined8 param_1, int *param_2, int *param_3)
{
int iVar1;
int iVar2;
int *piVar3;
long in_FS_OFFSET;
int local_11c;
undefined local_108[8];
undefined8 local_100;
long local_e0;
long local_d0;
long local_10;
local_10 = *(long *)(in_FS_OFFSET + 0x28);
iVar1 = *param_3;
parse_rtattr(local_108, 0x1e, param_2 + 7, *param_2 + -0x1c);
if ((((iVar1 == 0) && (local_e0 == 0)) &&
((local_d0 == 0 ||
(iVar2 = rtattr_cmp(local_d0, local_100), iVar2 == 0)))) ||
(((((iVar1 == 1 && (local_e0 == 0)) && (local_d0 != 0)) &&
(iVar2 = rtattr_cmp(local_d0, local_100), iVar2 != 0)) ||
((iVar1 == 2 && (local_e0 != 0)))))) {
*(ushort *)((long)param_2 + 6) = *(ushort *)((long)param_2 + 6) | 0x405;
ll_init_map(&rth);
local_11c = rtnl_talk(&rth, param_2, 0);
if ((local_11c < 0) && (piVar3 = __errno_location(), *piVar3 == 0x11)) {
local_11c = 0;
}
} else {
local_11c = 0;
}
if (local_10 == *(long *)(in_FS_OFFSET + 0x28)) {
return local_11c;
}
__stack_chk_fail();
} | iproute2-6.0.0 | ghidra |
static void cleanup(void) {
sigset_t oldset;
close_output_file();
sigprocmask(0, &caught_signals, &oldset);
delete_all_files(0);
sigprocmask(2, &oldset, ((void *)0));
} | void cleanup() {
char v0;
char v1;
unsigned long long *v3;
unsigned long long v4;
close_output_file();
sigprocmask(0x0, &caught_signals, &v0);
delete_all_files(0x0);
sigprocmask(0x2, &v0, NULL);
v4 = *(&v1) ^ v3[5];
return;
} | coreutils | angr_dream |
int main(int argc, char **argv) {
int c;
FILE *fp;
int reverse = 0, forever = 0, oldfmt = 0;
while ((c = getopt(argc, argv, "froh")) != (-1)) {
switch (c) {
case 'r':
reverse = 1;
break;
case 'f':
forever = 1;
break;
case 'o':
oldfmt = 1;
break;
case 'h':
usage(0);
break;
default:
usage(1);
}
}
if (optind < argc) {
fprintf(stderr, "Utmp %sdump of %s\n", reverse ? "un" : "", argv[optind]);
if ((fp = fopen(argv[optind], "r")) == ((void *)0)) {
perror("Unable to open file");
exit(1);
}
} else {
fprintf(stderr, "Utmp %sdump of stdin\n", reverse ? "un" : "");
fp = stdin;
}
if (reverse)
undump(fp, forever, oldfmt);
else
dump(fp, forever, oldfmt);
fclose(fp);
return 0;
} | int main(int argc, const char **argv, const char **envp) {
const char *v3;
const char *v4;
int v6;
int v7;
int v8;
int v9;
struct _IO_FILE *stream;
v6 = 0;
v7 = 0;
v8 = 0;
while (1) {
v9 = getopt(argc, (char *const *)argv, "froh");
if (v9 == -1)
break;
if (v9 == 114) {
v6 = 1;
} else {
if (v9 > 114)
goto LABEL_13;
if (v9 == 111) {
v8 = 1;
} else {
if (v9 > 111)
goto LABEL_13;
if (v9 != 102) {
if (v9 == 104)
usage(0);
LABEL_13:
usage(1);
}
v7 = 1;
}
}
}
if (argc <= optind) {
if (v6)
v4 = "un";
else
v4 = (const char *)&unk_ED8;
fprintf(stderr, "Utmp %sdump of stdin\n", v4);
stream = stdin;
} else {
if (v6)
v3 = "un";
else
v3 = (const char *)&unk_ED8;
fprintf(stderr, "Utmp %sdump of %s\n", v3, argv[optind]);
stream = fopen(argv[optind], "r");
if (!stream) {
perror("Unable to open file");
exit(1);
}
}
if (v6)
undump(stream, v7, v8);
else
dump(stream, v7, v8);
fclose(stream);
return 0;
} | sysvinit | ida |
void usage(int status) {
if (status != 0)
do {
fprintf(stderr, gettext("Try '%s --help' for more information.\n"),
program_name);
} while (0);
else {
printf(gettext("Usage: %s [OPTION]... [TEMPLATE]\n"), program_name);
fputs_unlocked(
gettext("Create a temporary file or directory, safely, and print its "
"name.\nTEMPLATE must contain at least 3 consecutive 'X's in "
"last component.\nIf TEMPLATE is not specified, use "
"tmp.XXXXXXXXXX, and --tmpdir is implied.\n"),
stdout)
;
fputs_unlocked(gettext("Files are created u+rw, and directories u+rwx, "
"minus umask restrictions.\n"),
stdout)
;
fputs_unlocked("\n", stdout);
fputs_unlocked(
gettext(" -d, --directory create a directory, not a file\n -u, "
"--dry-run do not create anything; merely print a name "
"(unsafe)\n -q, --quiet suppress diagnostics about "
"file/dir-creation failure\n"),
stdout)
;
fputs_unlocked(
gettext(" --suffix=SUFF append SUFF to TEMPLATE; SUFF must not "
"contain a slash.\n This option is "
"implied if TEMPLATE does not end in X\n"),
stdout)
;
fputs_unlocked(
gettext(
" -p DIR, --tmpdir[=DIR] interpret TEMPLATE relative to DIR; if "
"DIR is not\n specified, use $TMPDIR if "
"set, else /tmp. With\n this option, "
"TEMPLATE must not be an absolute name;\n "
"unlike with -t, TEMPLATE may contain slashes, but\n "
" mktemp creates only the final component\n"),
stdout)
;
fputs_unlocked(
gettext(" -t interpret TEMPLATE as a single file "
"name component,\n relative to a "
"directory: $TMPDIR, if set; else the\n "
"directory specified via -p; else /tmp [deprecated]\n"),
stdout)
;
fputs_unlocked(gettext(" --help display this help and exit\n"),
stdout);
fputs_unlocked(
gettext(" --version output version information and exit\n"),
stdout);
emit_ancillary_info("mktemp");
}
exit(status);
} | void usage(unsigned long a0) {
unsigned long v0;
unsigned long v2;
v0 = v2;
if (a0) {
fprintf(stderr, gettext("Try '%s --help' for more information.\n"));
} else {
printf(gettext("Usage: %s [OPTION]... [TEMPLATE]\n"));
fputs_unlocked(
gettext("Create a temporary file or directory, safely, and print its "
"name.\nTEMPLATE must contain at least 3 consecutive 'X's in "
"last component.\nIf TEMPLATE is not specified, use "
"tmp.XXXXXXXXXX, and --tmpdir is implied.\n"),
stdout);
fputs_unlocked(gettext("Files are created u+rw, and directories u+rwx, "
"minus umask restrictions.\n"),
stdout);
fputs_unlocked("\n", stdout);
fputs_unlocked(
gettext(" -d, --directory create a directory, not a file\n -u, "
"--dry-run do not create anything; merely print a name "
"(unsafe)\n -q, --quiet suppress diagnostics about "
"file/dir-creation failure\n"),
stdout);
fputs_unlocked(
gettext(" --suffix=SUFF append SUFF to TEMPLATE; SUFF must not "
"contain a slash.\n This option is "
"implied if TEMPLATE does not end in X\n"),
stdout);
fputs_unlocked(
gettext(
" -p DIR, --tmpdir[=DIR] interpret TEMPLATE relative to DIR; if "
"DIR is not\n specified, use $TMPDIR if "
"set, else /tmp. With\n this option, "
"TEMPLATE must not be an absolute name;\n "
"unlike with -t, TEMPLATE may contain slashes, but\n "
" mktemp creates only the final component\n"),
stdout);
fputs_unlocked(
gettext(" -t interpret TEMPLATE as a single file "
"name component,\n relative to a "
"directory: $TMPDIR, if set; else the\n "
"directory specified via -p; else /tmp [deprecated]\n"),
stdout);
fputs_unlocked(gettext(" --help display this help and exit\n"),
stdout);
fputs_unlocked(
gettext(" --version output version information and exit\n"),
stdout);
emit_ancillary_info("mktemp");
}
exit(a0);
} | coreutils | angr_sailr |
static void ssh_sandbox_child_debugging(void) {
struct sigaction act;
sigset_t mask;
sshlog("sandbox-seccomp-filter.c", __func__, 388, 0, SYSLOG_LEVEL_DEBUG3,
((void *)0), "%s: installing SIGSYS handler", __func__);
memset(&act, 0, sizeof(act));
sigemptyset(&mask);
sigaddset(&mask, 31);
act.__sigaction_handler.sa_sigaction = &ssh_sandbox_violation;
act.sa_flags = 4;
if (sigaction(31, &act, ((void *)0)) == -1)
sshfatal("sandbox-seccomp-filter.c", __func__, 396, 0, SYSLOG_LEVEL_FATAL,
((void *)0), "%s: sigaction(SIGSYS): %s", __func__,
strerror((*__errno_location())));
if (sigprocmask(1, &mask, ((void *)0)) == -1)
sshfatal("sandbox-seccomp-filter.c", __func__, 398, 0, SYSLOG_LEVEL_FATAL,
((void *)0), "%s: sigprocmask(SIGSYS): %s", __func__,
strerror((*__errno_location())));
} | unsigned long ssh_sandbox_child_debugging() {
int *v0;
char *v1;
int *v2;
char *v3;
sigset_t set;
struct sigaction s;
unsigned long v7;
v7 = __readfsqword(0x28u);
sshlog("sandbox-seccomp-filter.c", "ssh_sandbox_child_debugging", 388LL, 0LL,
7LL, 0LL, "%s: installing SIGSYS handler",
"ssh_sandbox_child_debugging");
memset(&s, 0, sizeof(s));
sigemptyset(&set);
sigaddset(&set, 31);
s.sa_handler = (__sighandler_t)ssh_sandbox_violation;
s.sa_flags = 4;
if (sigaction(31, &s, 0LL) == -1) {
v0 = _errno_location();
v1 = strerror(*v0);
sshfatal("sandbox-seccomp-filter.c", "ssh_sandbox_child_debugging", 396LL,
0LL, 1LL, 0LL, "%s: sigaction(SIGSYS): %s",
"ssh_sandbox_child_debugging", v1);
}
if (sigprocmask(1, &set, 0LL) == -1) {
v2 = _errno_location();
v3 = strerror(*v2);
sshfatal("sandbox-seccomp-filter.c", "ssh_sandbox_child_debugging", 398LL,
0LL, 1LL, 0LL, "%s: sigprocmask(SIGSYS): %s",
"ssh_sandbox_child_debugging", v3);
}
return __readfsqword(0x28u) ^ v7;
} | openssh-portable | ida |
void clear_history(void) {
HistEvent ev;
if (h == ((void *)0) || e == ((void *)0))
rl_initialize();
(void)history(h, &ev, 19);
history_offset = history_length = 0;
} | long long clear_history() {
char v0;
if (!h || !e)
rl_initialize();
history(h, &v0, 0x13, &v0);
*(got.history_length) = 0;
*(got.history_offset) = *(got.history_length);
return 0;
} | libedit | angr_dream |
static int process_bad_block(ext2_filsys fs, blk64_t *block_nr,
e2_blkcnt_t blockcnt,
blk64_t ref_block __attribute__((unused)),
int ref_offset __attribute__((unused)),
void *priv_data) {
struct process_block_struct *p;
blk64_t blk = *block_nr;
blk64_t first_block;
dgrp_t i;
struct problem_context *pctx;
e2fsck_t ctx;
if (!blk)
return 0;
p = (struct process_block_struct *)priv_data;
ctx = p->ctx;
pctx = p->pctx;
pctx->ino = 1;
pctx->blk = blk;
pctx->blkcount = blockcnt;
if ((blk < fs->super->s_first_data_block) ||
(blk >= ext2fs_blocks_count(fs->super))) {
if (fix_problem(ctx, 0x010012, pctx)) {
*block_nr = 0;
return 1;
} else
return 0;
}
if (blockcnt < 0) {
if (ext2fs_test_block_bitmap2(p->fs_meta_blocks, blk)) {
p->bbcheck = 1;
if (fix_problem(ctx, 0x01004D, pctx)) {
*block_nr = 0;
return 1;
}
} else if (ext2fs_test_block_bitmap2(ctx->block_found_map, blk)) {
p->bbcheck = 1;
if (fix_problem(ctx, 0x010015, pctx)) {
*block_nr = 0;
return 1;
}
if (ctx->flags & (0x0001 | 0x0002))
return 2;
} else
mark_block_used(ctx, blk);
return 0;
}
ctx->fs_badblocks_count++;
if (!ext2fs_test_block_bitmap2(ctx->block_found_map, blk)) {
ext2fs_mark_block_bitmap2(ctx->block_found_map, blk);
return 0;
}
first_block = fs->super->s_first_data_block;
for (i = 0; i < fs->group_desc_count; i++) {
pctx->group = i;
pctx->blk = blk;
if (!ext2fs_bg_has_super(fs, i))
goto skip_super;
if (blk == first_block) {
if (i == 0) {
if (fix_problem(ctx, 0x010019, pctx)) {
*block_nr = 0;
return 1;
}
return 0;
}
fix_problem(ctx, 0x01001B, pctx);
return 0;
}
if ((blk > first_block) && (blk <= first_block + fs->desc_blocks)) {
if (i == 0) {
pctx->blk = *block_nr;
if (fix_problem(ctx, 0x01001A, pctx)) {
*block_nr = 0;
return 1;
}
return 0;
}
fix_problem(ctx, 0x01001C, pctx);
return 0;
}
skip_super:
if (blk == ext2fs_block_bitmap_loc(fs, i)) {
if (fix_problem(ctx, 0x01000A, pctx)) {
ctx->invalid_block_bitmap_flag[i]++;
ctx->invalid_bitmaps++;
}
return 0;
}
if (blk == ext2fs_inode_bitmap_loc(fs, i)) {
if (fix_problem(ctx, 0x01000B, pctx)) {
ctx->invalid_inode_bitmap_flag[i]++;
ctx->invalid_bitmaps++;
}
return 0;
}
if ((blk >= ext2fs_inode_table_loc(fs, i)) &&
(blk < (ext2fs_inode_table_loc(fs, i) + fs->inode_blocks_per_group))) {
return 0;
}
first_block += fs->super->s_blocks_per_group;
}
if ((blk == p->inode->i_block[12]) || (blk == p->inode->i_block[(12 + 1)]) ||
(blk == p->inode->i_block[((12 + 1) + 1)])) {
p->bbcheck = 1;
if (fix_problem(ctx, 0x010015, pctx)) {
*block_nr = 0;
return 1;
}
if (ctx->flags & (0x0001 | 0x0002))
return 2;
return 0;
}
pctx->group = -1;
fix_problem(ctx, 0x01001D, pctx);
return 0;
} | long long process_bad_block(struct_0 *a0, unsigned long long *a1,
unsigned long a2, unsigned long a3,
unsigned long a4, struct_2 *a5) {
unsigned int v0;
unsigned long v1;
unsigned int v2;
unsigned long v3;
unsigned long long v4;
struct_5 *v5;
struct_4 *v6;
unsigned long long v8;
unsigned long long v9;
unsigned long long v12;
unsigned long long v13;
unsigned long long v14;
unsigned long long v15;
unsigned long long v18;
unsigned long long v19;
unsigned long long v22;
v1 = a3;
v0 = a4;
v4 = *(a1);
if (!v4) {
v8 = 0;
} else {
v5 = a5->field_58;
v6 = a5->field_48;
v6->field_8 = 1;
v6->field_28 = v4;
v6->field_38 = a2;
if (v4 >= a0->field_20->field_14) {
v9 = ext2fs_blocks_count(a0->field_20);
if (v4 < v9) {
if ((a2 - 0 >> 63)) {
v12 = ext2fs_test_block_bitmap2(a5->field_50, v4, v4);
if (v12) {
a5->field_4 = a5->field_4 | 64;
v14 = fix_problem(v5, 0x1004d, v6);
if (v14) {
*(a1) = 0;
v8 = 1;
}
} else {
v13 = ext2fs_test_block_bitmap2(v5->field_1a0, v4, v4);
if (v13) {
a5->field_4 = a5->field_4 | 64;
v22 = fix_problem(v5, 0x10015, v6);
if (v22) {
*(a1) = 0;
v8 = 1;
} else if ((v5->field_48 & 3)) {
v8 = 2;
}
} else {
mark_block_used(v5, v4);
}
}
if (!v13 && !v12 || !v14 && v12 ||
!v12 && !(v5->field_48 & 3) && !v22)
v8 = 0;
} else {
v5->field_304 = v5->field_304 + 1;
if (!ext2fs_test_block_bitmap2(v5->field_1a0, v4, v4)) {
ext2fs_mark_block_bitmap2(v5->field_1a0, v4, v4);
v8 = 0;
} else {
v3 = a0->field_20->field_14;
v2 = 0;
while (true) {
if (v2 < a0->field_30) {
v6->field_40 = v2;
v6->field_28 = v4;
v15 = ext2fs_bg_has_super(a0, v2, v2);
if (v15) {
if (v4 == v3) {
if (v2) {
fix_problem(v5, 0x1001b, v6);
v8 = 0;
break;
} else if (fix_problem(v5, 0x10019, v6)) {
*(a1) = 0;
v8 = 1;
break;
} else {
v8 = 0;
break;
}
} else {
if (v4 > v3 && v4 <= v3 + a0->field_38) {
if (!v2) {
v6->field_28 = *(a1);
if (fix_problem(v5, 0x1001a, v6)) {
*(a1) = 0;
v8 = 1;
break;
} else {
v8 = 0;
break;
}
} else {
fix_problem(v5, 0x1001c, v6);
v8 = 0;
break;
}
}
}
}
if (!v15 || v4 <= v3 && v4 != v3 ||
v4 != v3 && v4 > v3 + a0->field_38) {
if (v4 == ext2fs_block_bitmap_loc(a0, v2, v2)) {
if (fix_problem(v5, 0x1000a, v6)) {
*((v5->field_1f8 + v2 * 4)) =
*((v5->field_1f8 + v2 * 4)) + 1;
v5->field_208 = v5->field_208 + 1;
}
v8 = 0;
break;
} else if (v4 == ext2fs_inode_bitmap_loc(a0, v2, v2)) {
if (fix_problem(v5, 0x1000b, v6)) {
*((v5->field_1f0 + v2 * 4)) =
*((v5->field_1f0 + v2 * 4)) + 1;
v5->field_208 = v5->field_208 + 1;
}
v8 = 0;
break;
} else {
v18 = ext2fs_inode_table_loc(a0, v2, v2);
if (v4 >= v18) {
v19 = ext2fs_inode_table_loc(a0, v2, v2);
if (v4 < v19 + a0->field_48) {
v8 = 0;
break;
}
}
if (v4 < v18 || v4 >= v19 + a0->field_48) {
v3 += a0->field_20->field_20;
v2 += 1;
}
}
}
} else {
if (v4 != a5->field_40->field_58 &&
v4 != a5->field_40->field_5c &&
v4 != a5->field_40->field_60) {
v6->field_40 = -1;
fix_problem(v5, 0x1001d, v6);
v8 = 0;
break;
}
if (v4 == a5->field_40->field_60 ||
v4 == a5->field_40->field_5c ||
v4 == a5->field_40->field_58) {
a5->field_4 = a5->field_4 | 64;
if (fix_problem(v5, 0x10015, v6)) {
*(a1) = 0;
v8 = 1;
break;
} else if ((v5->field_48 & 3)) {
v8 = 2;
break;
} else {
v8 = 0;
break;
}
}
}
}
}
}
}
}
if (v4 < a0->field_20->field_14 || v4 >= v9) {
if (fix_problem(v5, 0x10012, v6)) {
*(a1) = 0;
v8 = 1;
} else {
v8 = 0;
}
}
}
return v8;
} | e2fsprogs-1.46.5 | angr_dream |
static Bool isempty_RL(EState *s) {
if (s->state_in_ch < 256 && s->state_in_len > 0)
return ((Bool)0);
else
return ((Bool)1);
} | _BOOL8 isempty_RL(long a1) {
return *(_DWORD *)(a1 + 92) > 0xFFu || *(int *)(a1 + 96) <= 0;
} | bzip2 | ida |
int sshsig_verify_fd(struct sshbuf *signature, int fd,
const char *expect_namespace, struct sshkey **sign_keyp,
struct sshkey_sig_details **sig_details) {
struct sshbuf *b = ((void *)0);
int r = -1;
char *hashalg = ((void *)0);
if (sig_details != ((void *)0))
*sig_details = ((void *)0);
if (sign_keyp != ((void *)0))
*sign_keyp = ((void *)0);
if ((r = sshsig_peek_hashalg(signature, &hashalg)) != 0)
return r;
sshlog("sshsig.c", __func__, 601, 1, SYSLOG_LEVEL_DEBUG1, ((void *)0),
"signature made with hash \"%s\"", hashalg);
if ((r = hash_file(fd, hashalg, &b)) != 0) {
sshlog("sshsig.c", __func__, 603, 1, SYSLOG_LEVEL_ERROR, ssh_err(r),
"hash_file");
goto out;
}
if ((r = sshsig_wrap_verify(signature, hashalg, b, expect_namespace,
sign_keyp, sig_details)) != 0)
goto out;
r = 0;
out:
sshbuf_free(b);
free(hashalg);
return r;
} | long sshsig_verify_fd(long a1, int a2, const char *a3, unsigned int **a4,
_QWORD *a5) {
long v6;
unsigned int v10;
unsigned int v11;
long v12;
void *ptr[2];
ptr[1] = (void *)__readfsqword(0x28u);
v12 = 0LL;
ptr[0] = 0LL;
if (a5)
*a5 = 0LL;
if (a4)
*a4 = 0LL;
v10 = sshsig_peek_hashalg(a1, ptr);
if (v10)
return v10;
sshlog("sshsig.c", "sshsig_verify_fd", 601LL, 1LL, 5LL, 0LL,
"signature made with hash \"%s\"", (const char *)ptr[0]);
v11 = hash_file(a2, (const char *)ptr[0], &v12);
if (v11) {
v6 = ssh_err(v11);
sshlog("sshsig.c", "sshsig_verify_fd", 603LL, 1LL, 2LL, v6, "hash_file");
} else {
v11 = sshsig_wrap_verify(a1, (const char *)ptr[0], v12, a3, a4, a5);
if (!v11)
v11 = 0;
}
sshbuf_free(v12);
free(ptr[0]);
return v11;
} | openssh-portable | ida |
static ssize_t iread_fullblock(int fd, char *buf, idx_t size) {
ssize_t nread = 0;
while (0 < size) {
ssize_t ncurr = iread(fd, buf, size);
if (ncurr < 0)
return ncurr;
if (ncurr == 0)
break;
nread += ncurr;
buf += ncurr;
size -= ncurr;
}
return nread;
} | long iread_fullblock(undefined4 param_1, long param_2, long param_3)
{
long lVar1;
long lVar2;
long local_30;
long local_28;
long local_18;
local_18 = 0;
local_30 = param_3;
local_28 = param_2;
while (((lVar2 = local_18,
0 < local_30 && (lVar1 = iread(param_1, local_28, local_30),
lVar2 = lVar1, -1 < lVar1)) &&
(lVar2 = local_18, lVar1 != 0))) {
local_18 = local_18 + lVar1;
local_28 = local_28 + lVar1;
local_30 = local_30 - lVar1;
}
return lVar2;
} | coreutils | ghidra |
const char *get_confirmed_pass(_Bool empty_ok) {
if (batch && !ask_pass)
return cfg.password;
else {
const char *pass = ((void *)0);
char *copy = ((void *)0);
do {
if (pass)
fprintf(stderr, "Password mismatch, try again.\n");
free(copy);
pass = getpass("Enter password: ");
copy = strdup(pass);
if (copy == ((void *)0)) {
fprintf(stderr, "memory error\n");
exit(1);
};
pass = getpass("Confirm password: ");
} while (strcmp(pass, copy) != 0 && !(empty_ok && *pass == '\0'));
free(copy);
return pass;
}
} | long long get_confirmed_pass(unsigned long a0) {
void *v0;
void *v1;
void *v3;
unsigned long long v4;
if (*(got.batch) && !*(got.ask_pass))
v3 = *((got.cfg + 464));
if (!*(got.batch) || *(got.ask_pass)) {
v0 = 0;
v1 = 0;
while (true) {
if (v0)
fprintf(*(got.stderr), "Password mismatch, try again.\n");
free(v1);
v0 = getpass("Enter password: ");
v1 = strdup(v0);
if (!v1) {
fprintf(*(got.stderr), "memory error\n");
exit(0x1);
}
v0 = getpass("Confirm password: ");
v4 = strcmp(v0, v1);
if (!v4)
break;
if (v4) {
if ((a0 ^ 1))
continue;
if (!*(v0))
break;
}
}
free(v1);
v3 = v0;
}
return v3;
} | gnutls | angr_dream |
static void print_group(FILE *f, gid_t gid) {
struct group *group = getgrgid(gid);
if (group)
print_string(PRINT_ANY, "group", "group %s ", group->gr_name);
else
print_uint(PRINT_ANY, "group", "group %u ", gid);
} | void print_group(undefined8 param_1, __gid_t param_2)
{
group *pgVar1;
pgVar1 = getgrgid(param_2);
if (pgVar1 == (group *)0x0) {
print_uint(4, "group", "group %u ", param_2);
} else {
print_string(4, "group", "group %s ", pgVar1->gr_name);
}
return;
} | iproute2-6.0.0 | ghidra |
static int gz_comp(state, flush)
gz_statep state;
int flush;
{
int ret, writ;
unsigned have, put, max = ((unsigned)-1 >> 2) + 1;
z_streamp strm = &(state->strm);
if (state->size == 0 && gz_init(state) == -1)
return -1;
if (state->direct) {
while (strm->avail_in) {
put = strm->avail_in > max ? max : strm->avail_in;
writ = write(state->fd, strm->next_in, put);
if (writ < 0) {
gz_error(state, (-1), strerror((*__errno_location())));
return -1;
}
strm->avail_in -= (unsigned)writ;
strm->next_in += writ;
}
return 0;
}
if (state->reset) {
if (strm->avail_in == 0)
return 0;
deflateReset(strm);
state->reset = 0;
}
ret = 0;
do {
if (strm->avail_out == 0 || (flush != 0 && (flush != 4 || ret == 1))) {
while (strm->next_out > state->x.next) {
put = strm->next_out - state->x.next > (int)max
? max
: (unsigned)(strm->next_out - state->x.next);
writ = write(state->fd, state->x.next, put);
if (writ < 0) {
gz_error(state, (-1), strerror((*__errno_location())));
return -1;
}
state->x.next += writ;
}
if (strm->avail_out == 0) {
strm->avail_out = state->size;
strm->next_out = state->out;
state->x.next = state->out;
}
}
have = strm->avail_out;
ret = deflate(strm, flush);
if (ret == (-2)) {
gz_error(state, (-2), "internal error: deflate stream corrupt");
return -1;
}
have -= strm->avail_out;
} while (have);
if (flush == 4)
state->reset = 1;
return 0;
} | int gz_comp(struct_0 *a0, unsigned long a1) {
unsigned int v0;
unsigned int v1;
unsigned int v2;
unsigned int v3;
unsigned int v4;
struct_1 *v5;
unsigned int v7;
unsigned int v8;
unsigned int v9;
v1 = 0x40000000;
v5 = &a0[184467440737095514].padding_44[20];
if (!a0->field_28 && gz_init(a0) == -1) {
v7 = -1;
goto LABEL_4004a9;
}
if (!a0->field_40) {
if (a0->field_60) {
if (!v5->field_8) {
v7 = 0;
goto LABEL_4004a9;
} else {
deflateReset(v5);
a0->field_60 = 0;
}
}
v0 = 0;
do {
if (v5->field_20) {
if (!a1)
goto LABEL_40043c;
if (a1 == 4 && !(v0 == 1))
goto LABEL_40043c;
}
while (true) {
if (v5->field_18 > a0->field_8) {
if (v5->field_18 - a0->field_8 > v1)
v9 = v1;
else
v9 = v5->field_18 - a0->field_8;
v2 = v9;
v3 = write(a0->field_1c, a0->field_8, v2);
if (v3 >= 0) {
a0->field_8 = a0->field_8 + v3;
} else {
gz_error(a0, 0xffffffff, strerror(*(__errno_location())));
v7 = -1;
goto LABEL_4004a9;
}
} else if (!v5->field_20) {
v5->field_20 = a0->field_28;
v5->field_18 = a0->field_38;
a0->field_8 = a0->field_38;
break;
}
}
LABEL_40043c:
v4 = v5->field_20;
v0 = deflate(v5, a1, a1);
if (v0 == -2) {
gz_error(a0, 0xfffffffe, "internal error: deflate stream corrupt");
v7 = -1;
goto LABEL_4004a9;
}
v4 -= v5->field_20;
} while (v4);
if (a1 == 4)
a0->field_60 = 1;
v7 = 0;
} else {
while (true) {
if (!v5->field_8) {
v7 = 0;
break;
} else {
v8 = v5->field_8;
if (v1 <= v5->field_8)
v8 = v1;
v2 = v8;
v3 = write(a0->field_1c, v5->field_0, v2);
if (v3 >= 0) {
v5->field_8 = v5->field_8 - v3;
v5->field_0 = v5->field_0 + v3;
} else {
gz_error(a0, 0xffffffff, strerror(*(__errno_location())));
v7 = -1;
break;
}
}
}
}
LABEL_4004a9:
return v7;
} | zlib | angr_phoenix |
static inline int rtm_get_table(struct rtmsg *r, struct rtattr **tb) {
__u32 table = r->rtm_table;
if (tb[RTA_TABLE])
table = rta_getattr_u32(tb[RTA_TABLE]);
return table;
} | uint rtm_get_table(long param_1, long param_2)
{
uint local_c;
local_c = (uint) * (byte *)(param_1 + 4);
if (*(long *)(param_2 + 0x78) != 0) {
local_c = rta_getattr_u32(*(undefined8 *)(param_2 + 0x78));
}
return local_c;
} | iproute2-6.0.0 | ghidra |
int jobscmd(int argc, char **argv) {
int mode, m;
struct output *out;
mode = 0;
while ((m = nextopt("lp")))
if (m == 'l')
mode = 0x04;
else
mode = 0x01;
out = out1;
argv = argptr;
if (*argv)
do
showjob(out, getjob(*argv, 0), mode);
while (*++argv);
else
showjobs(out, mode);
return 0;
} | long jobscmd() {
long v0;
_BYTE **v2;
char v3;
int v4;
long v5;
v3 = 0;
while (1) {
v4 = nextopt("lp");
if (!v4)
break;
if (v4 == 108)
v3 = 4;
else
v3 = 1;
}
v5 = out1;
v2 = (_BYTE **)argptr;
if (*argptr) {
do {
v0 = getjob(*v2, 0);
showjob(v5, v0, v3);
++v2;
} while (*v2);
} else {
showjobs(out1, v3);
}
return 0LL;
} | dash-0.5.11+git20210903+057cd650a4ed | ida |
static void init_buffer(void) {
if (!record_buffer_aligned[record_index])
record_buffer_aligned[record_index] =
page_aligned_alloc(&record_buffer[record_index], record_size);
record_start = record_buffer_aligned[record_index];
current_block = record_start;
record_end = record_start + blocking_factor;
} | char *init_buffer() {
int v0;
char *result;
if (!record_buffer_aligned[record_index]) {
v0 = record_index;
record_buffer_aligned[v0] =
page_aligned_alloc(&record_buffer + record_index, record_size);
}
record_start = (void *)record_buffer_aligned[record_index];
current_block = (long)record_start;
result = (char *)record_start + 512 * (long)blocking_factor;
record_end = result;
return result;
} | tar | ida |
static size_t size_opt(char const *opt, char const *msgid) {
uintmax_t size;
switch (xstrtoumax(opt, ((void *)0), 10, &size, "")) {
case LONGINT_OK:
case LONGINT_OVERFLOW:
break;
default:
((!!sizeof(struct {
_Static_assert(
1, "verify_expr ("
"1"
", "
"(error (1, 0, \"%s: %s\", opt, gettext (msgid)), assume (false))"
")");
int _gl_dummy;
}))
? ((error(1, 0, "%s: %s", opt, gettext(msgid)),
((0) ? (void)0 : __builtin_unreachable())))
: ((error(1, 0, "%s: %s", opt, gettext(msgid)),
((0) ? (void)0 : __builtin_unreachable()))));
}
return (((size) < ((18446744073709551615UL))) ? (size)
: ((18446744073709551615UL)));
} | int size_opt(unsigned long long a0, char *a1) {
char v0;
unsigned long long v2;
v2 = xstrtoumax(a0, 0x0, 0xa, &v0, &g_401733);
if (v2 > 1) {
gettext(a1);
error(0x1, 0x0, "%s: %s");
}
*(&v2) = *(&v0);
return v2;
} | coreutils | angr_dream |
intmax_t strtosysint(char const *arg, char **arglim, intmax_t minval,
uintmax_t maxval) {
(*__errno_location()) = 0;
if (maxval <= (9223372036854775807L)) {
if (((unsigned)(arg[*arg == '-']) - '0' <= 9)) {
intmax_t i = strtoimax(arg, arglim, 10);
intmax_t imaxval = maxval;
if (minval <= i && i <= imaxval)
return i;
(*__errno_location()) = 34;
return i < minval ? minval : maxval;
}
} else {
if (((unsigned)(*arg) - '0' <= 9)) {
uintmax_t i = strtoumax(arg, arglim, 10);
if (i <= maxval)
return represent_uintmax(i);
(*__errno_location()) = 34;
return maxval;
}
}
(*__errno_location()) = 22;
return 0;
} | long long strtosysint(char *a0, char **a1, unsigned long long a2,
unsigned long long a3) {
unsigned long long v0;
unsigned long long v1;
unsigned long v2;
void *v4;
*(__errno_location()) = 0;
if (a3 >= 0) {
if (a0[*(a0) == 45] - 48 <= 9) {
v1 = strtoimax(a0, a1, 0xa);
v2 = a3;
if (a2 <= v1 && v1 <= v2)
v4 = v1;
if (a2 > v1 || v1 > v2) {
*(__errno_location()) = 34;
if (v1 < a2)
v4 = a2;
else
v4 = a3;
}
}
} else {
if (*(a0)-48 <= 9) {
v0 = strtoumax(a0, a1, 0xa);
if (v0 <= a3) {
v4 = represent_uintmax(v0);
} else {
*(__errno_location()) = 34;
v4 = a3;
}
}
}
if (a3 < 0 && *(a0)-48 > 9 || a0[*(a0) == 45] - 48 > 9 && a3 >= 0) {
*(__errno_location()) = 22;
v4 = 0;
}
return v4;
} | tar | angr_dream |
time_t cronnext(cron_db database, time_t start, time_t end, char *include,
char *exclude, char *command, int flags) {
time_t closest, next;
user *u;
entry *e;
char *indent = "";
if (flags & 0x02) {
printf("crontabs:\n");
indent = " ";
} else if (flags & 0x08)
printf("jobs:\n");
closest = -1;
for (u = database.head; u; u = u->next) {
if (include && !matchuser(u->name, include))
continue;
if (exclude && matchuser(u->name, exclude))
continue;
if (!(flags & 0x04) && u->system)
continue;
if (flags & 0x02)
printcrontab(u);
for (e = u->crontab; e; e = e->next) {
if (command && strstr(e->cmd, command) == ((void *)0))
continue;
for (next = nextmatch(e, start, end); next <= end;
next = nextmatch(e, next + 60, end)) {
if (next < 0)
break;
if (closest < 0 || next < closest)
closest = next;
if (flags & 0x01)
printentry(indent, e, next);
if (!(flags & 0x08))
break;
}
}
}
return closest;
} | int cronnext(unsigned long a0, unsigned int a1, char *a2, char *a3, char *a4,
unsigned long a5, void *v5) {
unsigned long long v0;
unsigned int v1;
struct_0 *v2;
unsigned long long v3[4];
unsigned long long v4;
v4 = &g_401244;
if ((a5 & 2)) {
printf("crontabs:\n");
v4 = " ";
} else if ((a5 & 8)) {
printf("jobs:\n");
}
v0 = -1;
for (v2 = v5; v2; v2 = v2->field_0) {
if ((!a2 || matchuser(v2->field_10, a2)) &&
(!a3 || !matchuser(v2->field_10, a3)) && ((a5 & 4) || !v2->field_34)) {
if ((a5 & 2))
printcrontab(v2);
for (v3[0] = v2->field_28; v3; v3[0] = v3[0]) {
if (!a4 || strstr(v3[3], a4)) {
*(&v1) = nextmatch(v3, a0, a1);
while (true) {
if (!(*(&v1) <= a1) || !(!((*(&v1) - 0 >> 63))))
break;
if ((v0 - 0 >> 63) || *(&v1) < v0)
v0 = *(&v1);
if ((a5 & 1))
printentry(v4, v3, *(&v1));
if (!(a5 & 8))
break;
*(&v1) = nextmatch(v3, *(&v1) + 60, a1);
}
}
}
}
}
return v0;
} | cronie | angr_sailr |
static void dynaFileFreeCacheEntries(instanceData *__restrict__ const pData) {
register int i;
((void)(0));
for (i = 0; i < pData->iCurrCacheSize; ++i) {
dynaFileDelCacheEntry(pData, i, 1);
}
pData->iCurrElt = -1;
pData->pStrm = ((void *)0);
} | void dynaFileFreeCacheEntries(struct_0 *a0) {
void *v1;
struct_0 *v2;
for (v1 = 0; v1 < a0->field_148; v1 = v1 + 1) {
dynaFileDelCacheEntry(a0, v1, 0x1);
}
a0->field_144 = -1;
v2 = a0;
a0->field_38 = 0;
return;
} | rsyslog-8.2210.0 | angr_sailr |
static void entry_free(void *pv) {
struct SharefileEntry *p = pv;
if (p->fp) {
if (0 != rpl_fclose(p->fp))
fatal_nontarget_file_error((*__errno_location()), p->name);
}
free(p->name);
free(p);
} | void entry_free(unsigned long long a0[4]) {
unsigned long long v2;
if (a0[3] && rpl_fclose(a0[3]))
fatal_nontarget_file_error(*(__errno_location()), a0[2]);
free(a0[2]);
v2 = free(a0);
return;
} | findutils | angr_dream |
int rl_vi_fetch_history(int count, int c) {
return (rl_fetch_history(count, c));
} | long long rl_vi_fetch_history(unsigned long a0, unsigned long a1) {
return rl_fetch_history(a0, a1, a1);
} | bash | angr_phoenix |
static struct tm *convert_time(struct tm *(*convert)(const time_t *,
struct tm *),
long_int t, struct tm *tm) {
time_t x = t;
return convert(&x, tm);
} | long convert_time(long (*a1)(long *, long), long a2, long a3) {
long v4[2];
v4[1] = __readfsqword(0x28u);
v4[0] = a2;
return a1(v4, a3);
} | gnutls | ida |
void put_u64(void *vp, u_int64_t v) {
u_char *p = (u_char *)vp;
p[0] = (u_char)(v >> 56) & 0xff;
p[1] = (u_char)(v >> 48) & 0xff;
p[2] = (u_char)(v >> 40) & 0xff;
p[3] = (u_char)(v >> 32) & 0xff;
p[4] = (u_char)(v >> 24) & 0xff;
p[5] = (u_char)(v >> 16) & 0xff;
p[6] = (u_char)(v >> 8) & 0xff;
p[7] = (u_char)v & 0xff;
} | _BYTE *put_u64(_BYTE *a1, long a2) {
_BYTE *result;
*a1 = HIBYTE(a2);
a1[1] = BYTE6(a2);
a1[2] = BYTE5(a2);
a1[3] = BYTE4(a2);
a1[4] = BYTE3(a2);
a1[5] = BYTE2(a2);
a1[6] = BYTE1(a2);
result = a1 + 7;
a1[7] = a2;
return result;
} | openssh-portable | ida |
static int reset_locale_vars() {
char *t, *x;
if (lang == 0 || *lang == '\0')
maybe_make_export_env();
if (setlocale(6, lang ? lang : "") == 0)
return 0;
x = 0;
x = setlocale(0, get_locale_var("LC_CTYPE"));
t = setlocale(3, get_locale_var("LC_COLLATE"));
t = setlocale(5, get_locale_var("LC_MESSAGES"));
t = setlocale(1, get_locale_var("LC_NUMERIC"));
t = setlocale(2, get_locale_var("LC_TIME"));
locale_setblanks();
locale_mb_cur_max = (__ctype_get_mb_cur_max());
if (x)
locale_utf8locale = locale_isutf8(x);
locale_shiftstates = mblen((char *)((void *)0), 0);
u32reset();
return 1;
} | long reset_locale_vars() {
const char *v0;
char *locale_var;
char *v3;
char *v4;
char *v5;
char *v6;
char *v7;
if (!lang || !*lang)
maybe_make_export_env();
if (lang)
v0 = lang;
else
v0 = &locale;
if (!setlocale(6, v0))
return 0LL;
locale_var = get_locale_var((long)"LC_CTYPE");
v7 = setlocale(0, locale_var);
v3 = get_locale_var((long)"LC_COLLATE");
setlocale(3, v3);
v4 = get_locale_var((long)"LC_MESSAGES");
setlocale(5, v4);
v5 = get_locale_var((long)"LC_NUMERIC");
setlocale(1, v5);
v6 = get_locale_var((long)"LC_TIME");
setlocale(2, v6);
locale_setblanks();
locale_mb_cur_max = _ctype_get_mb_cur_max();
if (v7)
locale_utf8locale = locale_isutf8();
locale_shiftstates = mblen(0LL, 0LL);
u32reset();
return 1LL;
} | bash | ida |
static WORD_LIST *separate_out_assignments(tlist)
WORD_LIST *tlist;
{
register WORD_LIST *vp, *lp;
if (tlist == 0)
return ((WORD_LIST *)((void *)0));
if (subst_assign_varlist)
dispose_words(subst_assign_varlist);
subst_assign_varlist = (WORD_LIST *)((void *)0);
vp = lp = tlist;
while (lp && (lp->word->flags & (1 << 2))) {
vp = lp;
lp = lp->next;
}
if (lp != tlist) {
subst_assign_varlist = tlist;
vp->next = (WORD_LIST *)((void *)0);
tlist = lp;
}
if (!tlist)
return ((WORD_LIST *)((void *)0));
if (place_keywords_in_env) {
WORD_LIST *tp;
tp = tlist;
lp = tlist->next;
while (lp) {
if (lp->word->flags & (1 << 2)) {
if (!subst_assign_varlist)
subst_assign_varlist = vp = lp;
else {
vp->next = lp;
vp = lp;
}
tp->next = lp->next;
lp->next = (WORD_LIST *)((void *)0);
lp = tp->next;
} else {
tp = lp;
lp = lp->next;
}
}
}
return (tlist);
} | undefined8 *separate_out_assignments(undefined8 *param_1)
{
undefined8 *puVar1;
undefined8 *puVar2;
undefined8 *puVar3;
undefined8 *local_30;
undefined8 *local_20;
if (param_1 == (undefined8 *)0x0) {
local_30 = (undefined8 *)0x0;
} else {
if (subst_assign_varlist != (undefined8 *)0x0) {
dispose_words(subst_assign_varlist);
}
subst_assign_varlist = (undefined8 *)0x0;
puVar1 = param_1;
puVar3 = param_1;
while ((puVar2 = puVar1, puVar2 != (undefined8 *)0x0 &&
((*(uint *)(puVar2[1] + 8) & 4) != 0))) {
puVar1 = (undefined8 *)*puVar2;
puVar3 = puVar2;
}
local_30 = param_1;
if (puVar2 != param_1) {
subst_assign_varlist = param_1;
*puVar3 = 0;
local_30 = puVar2;
}
if (local_30 == (undefined8 *)0x0) {
local_30 = (undefined8 *)0x0;
} else if (place_keywords_in_env != 0) {
local_20 = local_30;
puVar1 = (undefined8 *)*local_30;
while (puVar2 = puVar1, puVar2 != (undefined8 *)0x0) {
if ((*(uint *)(puVar2[1] + 8) & 4) == 0) {
puVar1 = (undefined8 *)*puVar2;
local_20 = puVar2;
} else {
puVar1 = puVar2;
if (subst_assign_varlist != (undefined8 *)0x0) {
*puVar3 = puVar2;
puVar1 = subst_assign_varlist;
}
subst_assign_varlist = puVar1;
*local_20 = *puVar2;
*puVar2 = 0;
puVar1 = (undefined8 *)*local_20;
puVar3 = puVar2;
}
}
}
}
return local_30;
} | bash | ghidra |
static void accumulate_host_timing_secret(struct sshbuf *server_cfg,
struct sshkey *key) {
static struct ssh_digest_ctx *ctx;
u_char *hash;
size_t len;
struct sshbuf *buf;
int r;
if (ctx == ((void *)0) && (ctx = ssh_digest_start(4)) == ((void *)0))
sshfatal("sshd.c", __func__, 1498, 1, SYSLOG_LEVEL_FATAL, ((void *)0),
"ssh_digest_start");
if (key == ((void *)0)) {
if (ssh_digest_update(ctx, sshbuf_ptr(server_cfg),
sshbuf_len(server_cfg)) != 0)
sshfatal("sshd.c", __func__, 1503, 1, SYSLOG_LEVEL_FATAL, ((void *)0),
"ssh_digest_update");
len = ssh_digest_bytes(4);
hash = xmalloc(len);
if (ssh_digest_final(ctx, hash, len) != 0)
sshfatal("sshd.c", __func__, 1507, 1, SYSLOG_LEVEL_FATAL, ((void *)0),
"ssh_digest_final");
options.timing_secret = (((u_int64_t)(((const u_char *)(hash))[0]) << 56) |
((u_int64_t)(((const u_char *)(hash))[1]) << 48) |
((u_int64_t)(((const u_char *)(hash))[2]) << 40) |
((u_int64_t)(((const u_char *)(hash))[3]) << 32) |
((u_int64_t)(((const u_char *)(hash))[4]) << 24) |
((u_int64_t)(((const u_char *)(hash))[5]) << 16) |
((u_int64_t)(((const u_char *)(hash))[6]) << 8) |
(u_int64_t)(((const u_char *)(hash))[7]));
freezero(hash, len);
ssh_digest_free(ctx);
ctx = ((void *)0);
return;
}
if ((buf = sshbuf_new()) == ((void *)0))
sshfatal("sshd.c", __func__, 1515, 1, SYSLOG_LEVEL_FATAL, ((void *)0),
"could not allocate buffer");
if ((r = sshkey_private_serialize(key, buf)) != 0)
sshfatal("sshd.c", __func__, 1517, 1, SYSLOG_LEVEL_FATAL, ssh_err(r),
"decode key");
if (ssh_digest_update(ctx, sshbuf_ptr(buf), sshbuf_len(buf)) != 0)
sshfatal("sshd.c", __func__, 1519, 1, SYSLOG_LEVEL_FATAL, ((void *)0),
"ssh_digest_update");
sshbuf_reset(buf);
sshbuf_free(buf);
} | long accumulate_host_timing_secret(long a1, long a2) {
long v2;
long v3;
long result;
long v5;
long v6;
long v7;
unsigned int v8;
long v9;
long v10;
unsigned long *v11;
if (!ctx_21501) {
ctx_21501 = ssh_digest_start(4LL);
if (!ctx_21501)
sshfatal("sshd.c", "accumulate_host_timing_secret", 1498LL, 1LL, 1LL, 0LL,
"ssh_digest_start");
}
if (a2) {
v9 = sshbuf_new();
if (!v9)
sshfatal("sshd.c", "accumulate_host_timing_secret", 1515LL, 1LL, 1LL, 0LL,
"could not allocate buffer");
v8 = sshkey_private_serialize(a2, v9);
if (v8) {
v5 = ssh_err(v8);
sshfatal("sshd.c", "accumulate_host_timing_secret", 1517LL, 1LL, 1LL, v5,
"decode key");
}
v6 = sshbuf_len(v9);
v7 = sshbuf_ptr(v9);
if ((unsigned int)ssh_digest_update(ctx_21501, v7, v6))
sshfatal("sshd.c", "accumulate_host_timing_secret", 1519LL, 1LL, 1LL, 0LL,
"ssh_digest_update");
sshbuf_reset(v9);
return sshbuf_free(v9);
} else {
v2 = sshbuf_len(a1);
v3 = sshbuf_ptr(a1);
if ((unsigned int)ssh_digest_update(ctx_21501, v3, v2))
sshfatal("sshd.c", "accumulate_host_timing_secret", 1503LL, 1LL, 1LL, 0LL,
"ssh_digest_update");
v10 = ((long (*)(long))ssh_digest_bytes)(4LL);
v11 = (unsigned long *)((long (*)(long))xmalloc)(v10);
if ((unsigned int)ssh_digest_final(ctx_21501, v11, v10))
sshfatal("sshd.c", "accumulate_host_timing_secret", 1507LL, 1LL, 1LL, 0LL,
"ssh_digest_final");
*(_QWORD *)&options[1964] = _byteswap_uint64(*v11);
((void (*)(unsigned long *, long))freezero)(v11, v10);
result = ssh_digest_free(ctx_21501);
ctx_21501 = 0LL;
}
return result;
} | openssh-portable | ida |
void usage(int status) {
if (status != 0)
do {
fprintf(stderr, gettext("Try '%s --help' for more information.\n"),
program_name);
} while (0);
else {
printf(gettext("Usage: %s [OPTION]... [FILE]...\n")
,
program_name);
fputs_unlocked(gettext("Paginate or columnate FILE(s) for printing.\n"),
stdout)
;
emit_stdin_note();
emit_mandatory_arg_note();
fputs_unlocked(
gettext(" +FIRST_PAGE[:LAST_PAGE], --pages=FIRST_PAGE[:LAST_PAGE]\n "
" begin [stop] printing with page "
"FIRST_[LAST_]PAGE\n -COLUMN, --columns=COLUMN\n "
" output COLUMN columns and print columns down,\n "
" unless -a is used. Balance number of lines in "
"the\n columns on each page\n"),
stdout)
;
fputs_unlocked(
gettext(" -a, --across print columns across rather than down, "
"used together\n with -COLUMN\n -c, "
"--show-control-chars\n use hat notation "
"(^G) and octal backslash notation\n -d, --double-space\n "
" double space the output\n"),
stdout)
;
fputs_unlocked(
gettext(
" -D, --date-format=FORMAT\n use FORMAT for "
"the header date\n -e[CHAR[WIDTH]], --expand-tabs[=CHAR[WIDTH]]\n "
" expand input CHARs (TABs) to tab WIDTH (8)\n "
"-F, -f, --form-feed\n use form feeds instead "
"of newlines to separate pages\n (by a 3-line "
"page header with -F or a 5-line header\n and "
"trailer without -F)\n"),
stdout);
fputs_unlocked(
gettext(
" -h, --header=HEADER\n use a centered HEADER "
"instead of filename in page header,\n -h \"\" "
"prints a blank line, don't use -h\"\"\n -i[CHAR[WIDTH]], "
"--output-tabs[=CHAR[WIDTH]]\n replace spaces "
"with CHARs (TABs) to tab WIDTH (8)\n -J, --join-lines merge "
"full lines, turns off -W line truncation, no column\n "
" alignment, --sep-string[=STRING] sets separators\n"),
stdout)
;
fputs_unlocked(
gettext(" -l, --length=PAGE_LENGTH\n set the page "
"length to PAGE_LENGTH (66) lines\n "
"(default number of lines of text 56, and with -F 63).\n "
" implies -t if PAGE_LENGTH <= 10\n"),
stdout)
;
fputs_unlocked(gettext(" -m, --merge print all files in parallel, "
"one in each column,\n truncate "
"lines, but join lines of full length with -J\n"),
stdout)
;
fputs_unlocked(
gettext(" -n[SEP[DIGITS]], --number-lines[=SEP[DIGITS]]\n "
" number lines, use DIGITS (5) digits, then SEP (TAB),\n "
" default counting starts with 1st line of "
"input file\n -N, --first-line-number=NUMBER\n "
" start counting with NUMBER at 1st line of first\n "
" page printed (see +FIRST_PAGE)\n"),
stdout)
;
fputs_unlocked(
gettext(" -o, --indent=MARGIN\n offset each line "
"with MARGIN (zero) spaces, do not\n affect "
"-w or -W, MARGIN will be added to PAGE_WIDTH\n -r, "
"--no-file-warnings\n omit warning when a "
"file cannot be opened\n"),
stdout)
;
fputs_unlocked(
gettext(" -s[CHAR], --separator[=CHAR]\n separate "
"columns by a single character, default for CHAR\n "
" is the <TAB> character without -w and \'no char\' with "
"-w.\n -s[CHAR] turns off line truncation "
"of all 3 column\n options (-COLUMN|-a "
"-COLUMN|-m) except -w is set\n"),
stdout)
;
fputs_unlocked(
gettext(
" -S[STRING], --sep-string[=STRING]\n separate "
"columns by STRING,\n without -S: Default "
"separator <TAB> with -J and <space>\n "
"otherwise (same as -S\" \"), no effect on column options\n"),
stdout)
;
fputs_unlocked(
gettext(" -t, --omit-header omit page headers and trailers;\n "
" implied if PAGE_LENGTH <= 10\n"),
stdout)
;
fputs_unlocked(
gettext(
" -T, --omit-pagination\n omit page headers "
"and trailers, eliminate any pagination\n by "
"form feeds set in input files\n -v, --show-nonprinting\n "
" use octal backslash notation\n -w, "
"--width=PAGE_WIDTH\n set page width to "
"PAGE_WIDTH (72) characters for\n multiple "
"text-column output only, -s[char] turns off (72)\n"),
stdout);
fputs_unlocked(
gettext(" -W, --page-width=PAGE_WIDTH\n set page "
"width to PAGE_WIDTH (72) characters always,\n "
" truncate lines, except -J option is set, no interference\n "
" with -S or -s\n"),
stdout)
;
fputs_unlocked(gettext(" --help display this help and exit\n"),
stdout);
fputs_unlocked(
gettext(" --version output version information and exit\n"),
stdout);
emit_ancillary_info("pr");
}
exit(status);
} | void usage(unsigned long a0) {
unsigned long v0;
unsigned long v2;
v0 = v2;
if (a0) {
fprintf(stderr, gettext("Try '%s --help' for more information.\n"));
} else {
printf(gettext("Usage: %s [OPTION]... [FILE]...\n"));
fputs_unlocked(gettext("Paginate or columnate FILE(s) for printing.\n"),
stdout);
emit_stdin_note();
emit_mandatory_arg_note();
fputs_unlocked(
gettext(" +FIRST_PAGE[:LAST_PAGE], --pages=FIRST_PAGE[:LAST_PAGE]\n "
" begin [stop] printing with page "
"FIRST_[LAST_]PAGE\n -COLUMN, --columns=COLUMN\n "
" output COLUMN columns and print columns down,\n "
" unless -a is used. Balance number of lines in "
"the\n columns on each page\n"),
stdout);
fputs_unlocked(
gettext(" -a, --across print columns across rather than down, "
"used together\n with -COLUMN\n -c, "
"--show-control-chars\n use hat notation "
"(^G) and octal backslash notation\n -d, --double-space\n "
" double space the output\n"),
stdout);
fputs_unlocked(
gettext(
" -D, --date-format=FORMAT\n use FORMAT for "
"the header date\n -e[CHAR[WIDTH]], --expand-tabs[=CHAR[WIDTH]]\n "
" expand input CHARs (TABs) to tab WIDTH (8)\n "
"-F, -f, --form-feed\n use form feeds instead "
"of newlines to separate pages\n (by a 3-line "
"page header with -F or a 5-line header\n and "
"trailer without -F)\n"),
stdout);
fputs_unlocked(
gettext(
" -h, --header=HEADER\n use a centered HEADER "
"instead of filename in page header,\n -h \"\" "
"prints a blank line, don\'t use -h\"\"\n -i[CHAR[WIDTH]], "
"--output-tabs[=CHAR[WIDTH]]\n replace spaces "
"with CHARs (TABs) to tab WIDTH (8)\n -J, --join-lines merge "
"full lines, turns off -W line truncation, no column\n "
" alignment, --sep-string[=STRING] sets separators\n"),
stdout);
fputs_unlocked(
gettext(" -l, --length=PAGE_LENGTH\n set the page "
"length to PAGE_LENGTH (66) lines\n "
"(default number of lines of text 56, and with -F 63).\n "
" implies -t if PAGE_LENGTH <= 10\n"),
stdout);
fputs_unlocked(gettext(" -m, --merge print all files in parallel, "
"one in each column,\n truncate "
"lines, but join lines of full length with -J\n"),
stdout);
fputs_unlocked(
gettext(" -n[SEP[DIGITS]], --number-lines[=SEP[DIGITS]]\n "
" number lines, use DIGITS (5) digits, then SEP (TAB),\n "
" default counting starts with 1st line of "
"input file\n -N, --first-line-number=NUMBER\n "
" start counting with NUMBER at 1st line of first\n "
" page printed (see +FIRST_PAGE)\n"),
stdout);
fputs_unlocked(
gettext(" -o, --indent=MARGIN\n offset each line "
"with MARGIN (zero) spaces, do not\n affect "
"-w or -W, MARGIN will be added to PAGE_WIDTH\n -r, "
"--no-file-warnings\n omit warning when a "
"file cannot be opened\n"),
stdout);
fputs_unlocked(
gettext(" -s[CHAR], --separator[=CHAR]\n separate "
"columns by a single character, default for CHAR\n "
" is the <TAB> character without -w and 'no char' with "
"-w.\n -s[CHAR] turns off line truncation "
"of all 3 column\n options (-COLUMN|-a "
"-COLUMN|-m) except -w is set\n"),
stdout);
fputs_unlocked(
gettext(
" -S[STRING], --sep-string[=STRING]\n separate "
"columns by STRING,\n without -S: Default "
"separator <TAB> with -J and <space>\n "
"otherwise (same as -S\" \"), no effect on column options\n"),
stdout);
fputs_unlocked(
gettext(" -t, --omit-header omit page headers and trailers;\n "
" implied if PAGE_LENGTH <= 10\n"),
stdout);
fputs_unlocked(
gettext(
" -T, --omit-pagination\n omit page headers "
"and trailers, eliminate any pagination\n by "
"form feeds set in input files\n -v, --show-nonprinting\n "
" use octal backslash notation\n -w, "
"--width=PAGE_WIDTH\n set page width to "
"PAGE_WIDTH (72) characters for\n multiple "
"text-column output only, -s[char] turns off (72)\n"),
stdout);
fputs_unlocked(
gettext(" -W, --page-width=PAGE_WIDTH\n set page "
"width to PAGE_WIDTH (72) characters always,\n "
" truncate lines, except -J option is set, no interference\n "
" with -S or -s\n"),
stdout);
fputs_unlocked(gettext(" --help display this help and exit\n"),
stdout);
fputs_unlocked(
gettext(" --version output version information and exit\n"),
stdout);
emit_ancillary_info("pr");
}
exit(a0);
} | coreutils | angr_dream |
void dispose_used_env_vars() {
if (temporary_env) {
dispose_temporary_env(propagate_temp_var);
maybe_make_export_env();
}
} | long long dispose_used_env_vars() {
unsigned long long v1;
v1 = temporary_env;
if (temporary_env) {
dispose_temporary_env(propagate_temp_var);
v1 = maybe_make_export_env();
return v1;
}
return v1;
} | bash | angr_sailr |
static int compare_names(char const *name1, char const *name2) {
if (locale_specific_sorting) {
int diff = compare_collated(name1, name2);
if (diff || ignore_file_name_case)
return diff;
}
return strcmp(name1, name2);
} | int compare_names(char *a0, char *a1) {
unsigned int v0;
unsigned long v2;
if (locale_specific_sorting) {
v0 = compare_collated(a0, a1);
if (v0 || ignore_file_name_case)
v2 = v0;
}
if (!locale_specific_sorting || !v0 && !ignore_file_name_case)
v2 = strcmp(a0, a1);
return v2;
} | diffutils | angr_dream |
int crypto_sign_ed25519_ref_fe25519_iseq_vartime(
const crypto_sign_ed25519_ref_fe25519 *x,
const crypto_sign_ed25519_ref_fe25519 *y) {
int i;
crypto_sign_ed25519_ref_fe25519 t1 = *x;
crypto_sign_ed25519_ref_fe25519 t2 = *y;
crypto_sign_ed25519_ref_fe25519_freeze(&t1);
crypto_sign_ed25519_ref_fe25519_freeze(&t2);
for (i = 0; i < 32; i++)
if (t1.v[i] != t2.v[i])
return 0;
return 1;
} | long crypto_sign_ed25519_ref_fe25519_iseq_vartime(long *a1, long *a2) {
long v2;
long v3;
long v4;
long v5;
long v6;
long v7;
long v8;
long v9;
long v10;
long v11;
long v12;
long v13;
long v14;
long v15;
long v16;
long v17;
int i;
long v20[16];
long v21[20];
v21[17] = __readfsqword(0x28u);
v2 = a1[1];
v20[0] = *a1;
v20[1] = v2;
v3 = a1[3];
v20[2] = a1[2];
v20[3] = v3;
v4 = a1[5];
v20[4] = a1[4];
v20[5] = v4;
v5 = a1[7];
v20[6] = a1[6];
v20[7] = v5;
v6 = a1[9];
v20[8] = a1[8];
v20[9] = v6;
v7 = a1[11];
v20[10] = a1[10];
v20[11] = v7;
v8 = a1[13];
v20[12] = a1[12];
v20[13] = v8;
v9 = a1[15];
v20[14] = a1[14];
v20[15] = v9;
v10 = a2[1];
v21[0] = *a2;
v21[1] = v10;
v11 = a2[3];
v21[2] = a2[2];
v21[3] = v11;
v12 = a2[5];
v21[4] = a2[4];
v21[5] = v12;
v13 = a2[7];
v21[6] = a2[6];
v21[7] = v13;
v14 = a2[9];
v21[8] = a2[8];
v21[9] = v14;
v15 = a2[11];
v21[10] = a2[10];
v21[11] = v15;
v16 = a2[13];
v21[12] = a2[12];
v21[13] = v16;
v17 = a2[15];
v21[14] = a2[14];
v21[15] = v17;
crypto_sign_ed25519_ref_fe25519_freeze((long)v20);
crypto_sign_ed25519_ref_fe25519_freeze((long)v21);
for (i = 0; i <= 31; ++i) {
if (*((_DWORD *)v20 + i) != *((_DWORD *)v21 + i))
return 0LL;
}
return 1LL;
} | openssh-portable | ida |
void arc4random_buf(void *buf, size_t n) {
pthread_mutex_lock(&arc4random_mtx);
_rs_random_buf(buf, n);
pthread_mutex_unlock(&arc4random_mtx);
} | long long arc4random_buf(void *a0, unsigned int a1) {
pthread_mutex_lock(&arc4random_mtx);
_rs_random_buf(a0, a1);
return pthread_mutex_unlock(&arc4random_mtx);
} | libbsd-0.11.7 | angr_sailr |
static void print_crq_info(gnutls_x509_crq_t crq, FILE *out,
common_info_st *cinfo) {
gnutls_datum_t data;
int ret;
size_t size;
if (cinfo->outtext) {
ret = gnutls_x509_crq_print(crq, full_format, &data);
if (ret < 0) {
fprintf(stderr, "crq_print: %s\n", gnutls_strerror(ret));
app_exit(1);
}
fprintf(out, "%s\n", data.data);
gnutls_free((void *)(data.data)), data.data = ((void *)0);
}
ret = gnutls_x509_crq_verify(crq, 0);
if (ret < 0) {
fprintf(cinfo->outtext ? out : stderr, "Self signature: FAILED\n\n");
} else {
fprintf(cinfo->outtext ? out : stderr, "Self signature: verified\n\n");
}
size = lbuffer_size;
ret = gnutls_x509_crq_export(crq, outcert_format, lbuffer, &size);
if (ret < 0) {
fprintf(stderr, "crq_export: %s\n", gnutls_strerror(ret));
app_exit(1);
}
fwrite(lbuffer, 1, size, outfile);
} | void print_crq_info(unsigned long long a0, void *a1, struct_0 *a2) {
unsigned int v0;
unsigned int v1;
void *v2;
char v3;
unsigned long long *v7;
unsigned long long v8;
if (a2->field_24) {
v0 = gnutls_x509_crq_print(a0, full_format, &v2, full_format);
if (v0 < 0) {
fprintf(*(&stderr), "crq_print: %s\n", gnutls_strerror(v0));
app_exit(0x1);
}
fprintf(a1, "%s\n", *(&v2));
*(5243720)(*(&v2));
v2 = 0;
}
v0 = gnutls_x509_crq_verify(a0, 0x0);
if (v0 >= 0)
fprintf((!a2->field_24 ? a1 : *(&stderr)), "Self signature: verified\n\n");
else
fprintf((!a2->field_24 ? a1 : *(&stderr)), "Self signature: FAILED\n\n");
*(&v1) = lbuffer_size;
v0 = gnutls_x509_crq_export(a0, outcert_format, lbuffer, &v1);
if (v0 >= 0) {
fwrite(lbuffer, 0x1, *(&v1), outfile);
v8 = *(&v3) ^ v7[5];
return;
}
fprintf(*(&stderr), "crq_export: %s\n", gnutls_strerror(v0));
app_exit(0x1);
} | gnutls | angr_sailr |
static void print_dh_info(FILE *outfile, gnutls_datum_t *p, gnutls_datum_t *g,
unsigned int q_bits, int cprint) {
if (q_bits > 0) {
if (cprint != 0)
fprintf(outfile, "\n \n\n", (7 + q_bits) / 8);
else
fprintf(outfile, "\nRecommended key length: %d bits\n\n", q_bits);
}
print_head(outfile, "generator", g->size, cprint);
print_hex_datum(outfile, g, cprint);
print_head(outfile, "prime", p->size, cprint);
print_hex_datum(outfile, p, cprint);
} | void print_dh_info(void *a0, struct_0 *a1, struct_0 *a2, unsigned long a3,
unsigned long a4) {
unsigned long long v1;
if (a3) {
if (!a4)
fprintf(a0, "\nRecommended key length: %d bits\n\n", a3);
else
fprintf(a0, "\n \n\n", (a3 + 7 >> 3));
}
print_head(a0, "generator", a2->field_8, a4);
print_hex_datum(a0, a2, a4);
print_head(a0, "prime", a1->field_8, a4);
v1 = print_hex_datum(a0, a1, a4);
return;
} | gnutls | angr_sailr |
int xasprintf(char **ret, const char *fmt, ...) {
va_list ap;
int i;
__builtin_va_start(ap, fmt);
i = xvasprintf(ret, fmt, ap);
__builtin_va_end(ap);
return i;
} | long xasprintf(char **a1, const char *a2, long a3, long a4, long a5, long a6,
...) {
gcc_va_list va;
unsigned long v8;
long v9;
long v10;
long v11;
long v12;
va_start(va, a6);
v9 = a3;
v10 = a4;
v11 = a5;
v12 = a6;
v8 = __readfsqword(0x28u);
va[0].gp_offset = 16;
return (unsigned int)xvasprintf(a1, a2, va);
} | openssh-portable | ida |
static void Rq_decode(Fq *r, const unsigned char *s) {
crypto_uint16 R[761], M[761];
int i;
for (i = 0; i < 761; ++i)
M[i] = 4591;
Decode(R, s, M, 761);
for (i = 0; i < 761; ++i)
r[i] = ((Fq)R[i]) - ((4591 - 1) / 2);
} | unsigned long Rq_decode(long a1, unsigned char *a2) {
int i;
int j;
short v5[768];
short v6[764];
unsigned long v7;
v7 = __readfsqword(0x28u);
for (i = 0; i <= 760; ++i)
v6[i] = 4591;
Decode(v5, a2, (unsigned short *)v6, 761LL);
for (j = 0; j <= 760; ++j)
*(_WORD *)(2LL * j + a1) = v5[j] - 2295;
return __readfsqword(0x28u) ^ v7;
} | openssh-portable | ida |
int rl_forward(int count, int key) { return (rl_forward_char(count, key)); } | long long rl_forward(unsigned long a0, unsigned long a1) {
return rl_forward_char(a0, a1);
} | bash | angr_dream |
static void append_unset_var(char const *var) {
if (usvars_used == usvars_alloc)
usvars = x2nrealloc(usvars, &usvars_alloc, sizeof *usvars);
usvars[usvars_used++] = var;
} | void append_unset_var(undefined8 param_1)
{
long lVar1;
if (usvars_used == usvars_alloc) {
usvars = x2nrealloc(usvars, &usvars_alloc, 8);
}
lVar1 = usvars_used * 8;
usvars_used = usvars_used + 1;
*(undefined8 *)(usvars + lVar1) = param_1;
return;
} | coreutils | ghidra |
static int history_def_insert(history_t *h, HistEventW *ev,
const wchar_t *str) {
hentry_t *c;
c = malloc(sizeof(*c));
if (c == ((void *)0))
goto oomem;
if ((c->ev.str = wcsdup(str)) == ((void *)0)) {
free(c);
goto oomem;
}
c->data = ((void *)0);
c->ev.num = ++h->eventid;
c->next = h->list.next;
c->prev = &h->list;
h->list.next->prev = c;
h->list.next = c;
h->cur++;
h->cursor = c;
*ev = c->ev;
return 0;
oomem: {
ev->num = 2;
ev->str = he_errlist[2];
};
return -1;
} | int history_def_insert(struct_0 *a0, struct_2 *a1, unsigned short *a2) {
unsigned short *v0;
struct_3 *v1;
unsigned long long v3;
unsigned int v4;
v0 = a2;
v1 = malloc(0x28);
if (v1) {
v1->field_8 = wcsdup(v0);
if (v1->field_8) {
v1->field_10 = 0;
a0->field_38 = a0->field_38 + 1;
*(&v1->field_0) = a0->field_38;
v1->field_18 = a0->field_18;
v1->field_20 = a0;
a0->field_18->field_20 = v1;
a0->field_18 = &v1->field_0;
a0->field_34 = a0->field_34 + 1;
a0->field_28 = v1;
v3 = v1->field_8;
*(&a1->field_0) = *(&v1->field_0);
a1->field_8 = v3;
v4 = 0;
goto LABEL_400985;
} else {
free(v1);
}
}
a1->field_0 = 2;
a1->field_8 = "m";
v4 = -1;
LABEL_400985:
return v4;
} | libedit | angr_phoenix |
time_t _long_to_time(long tlong) {
if (sizeof(long) == sizeof(int32_t))
return (_time32_to_time(tlong));
return ((time_t)tlong);
} | long long _long_to_time(unsigned long a0) { return a0; } | libbsd-0.11.7 | angr_dream |
int rl_upcase_word(int count, int key) { return (rl_change_case(count, 1)); } | void rl_upcase_word(undefined4 param_1)
{
rl_change_case(param_1, 1);
return;
} | bash | ghidra |
int do_xfrm_state(int argc, char **argv) {
if (argc < 1)
return xfrm_state_list_or_deleteall(0, ((void *)0), 0);
if (matches(*argv, "add") == 0)
return xfrm_state_modify(XFRM_MSG_NEWSA, 0, argc - 1, argv + 1);
if (matches(*argv, "update") == 0)
return xfrm_state_modify(XFRM_MSG_UPDSA, 0, argc - 1, argv + 1);
if (matches(*argv, "allocspi") == 0)
return xfrm_state_allocspi(argc - 1, argv + 1);
if (matches(*argv, "delete") == 0)
return xfrm_state_get_or_delete(argc - 1, argv + 1, 1);
if (matches(*argv, "deleteall") == 0 || matches(*argv, "delall") == 0)
return xfrm_state_list_or_deleteall(argc - 1, argv + 1, 1);
if (matches(*argv, "list") == 0 || matches(*argv, "show") == 0 ||
matches(*argv, "lst") == 0)
return xfrm_state_list_or_deleteall(argc - 1, argv + 1, 0);
if (matches(*argv, "get") == 0)
return xfrm_state_get_or_delete(argc - 1, argv + 1, 0);
if (matches(*argv, "flush") == 0)
return xfrm_state_flush(argc - 1, argv + 1);
if (matches(*argv, "count") == 0) {
return xfrm_sad_getinfo(argc, argv);
}
if (matches(*argv, "help") == 0)
usage();
fprintf(stderr, "Command \"%s\" is unknown, try \"ip xfrm state help\".\n",
*argv);
exit(-1);
} | long long do_xfrm_state(unsigned long a0, unsigned long long *a1) {
char v1;
unsigned long long v2;
char v3;
char v4;
char v5;
char v6;
char v7;
char v8;
char v9;
char v10;
char v11;
char v12;
char v13;
if (a0 <= 0)
xfrm_state_list_or_deleteall(0x0, 0x0, 0x0);
v1 = matches(*(a1), "add") ^ 1;
if (v1) {
v2 = xfrm_state_modify(0x10, 0x0, a0 - 1, a1 + 1);
} else {
v3 = matches(*(a1), "update") ^ 1;
if (v3) {
v2 = xfrm_state_modify(0x1a, 0x0, a0 - 1, a1 + 1);
} else {
v4 = matches(*(a1), "allocspi") ^ 1;
if (v4) {
v2 = xfrm_state_allocspi(a0 - 1, a1 + 1);
} else {
v5 = matches(*(a1), "delete") ^ 1;
if (v5) {
v2 = xfrm_state_get_or_delete(a0 - 1, a1 + 1, 0x1);
} else {
v6 = matches(*(a1), "deleteall") ^ 1;
if (!v6) {
v7 = matches(*(a1), "delall") ^ 1;
if (!v7) {
v8 = matches(*(a1), "list") ^ 1;
if (!v8) {
v9 = matches(*(a1), "show") ^ 1;
if (!v9) {
v10 = matches(*(a1), "lst") ^ 1;
if (!v10) {
v11 = matches(*(a1), "get") ^ 1;
if (v11) {
v2 = xfrm_state_get_or_delete(a0 - 1, a1 + 1, 0x0);
} else {
v12 = matches(*(a1), "flush") ^ 1;
if (v12) {
v2 = xfrm_state_flush(a0 - 1, a1 + 1);
} else {
v13 = matches(*(a1), "count") ^ 1;
if (v13) {
v2 = xfrm_sad_getinfo(a0, a1);
} else if ((matches(*(a1), "help") ^ 1)) {
usage();
} else {
fprintf(stderr,
"Command \"%s\" is unknown, try \"ip xfrm "
"state help\".\n",
*(a1));
exit(0xffffffff);
}
}
}
}
}
}
}
}
if (v6 || v7)
xfrm_state_list_or_deleteall(a0 - 1, a1 + 1, 0x1);
}
}
}
}
if (!v4 && !v5 && !v9 && !v6 && !v1 && !v3 && !v7 && !v8 && v10 ||
!v4 && !v5 && !v6 && !v1 && !v3 && !v7 && !v8 && v9 ||
!v4 && !v5 && !v6 && !v1 && !v3 && !v7 && v8)
xfrm_state_list_or_deleteall(a0 - 1, a1 + 1, 0x0);
if (...)
return v2;
} | iproute2-6.0.0 | angr_dream |
void set_dollar_vars_changed() {
if (variable_context)
changed_dollar_vars |= 0x02;
else if (this_shell_builtin == set_builtin)
changed_dollar_vars |= 0x04;
else
changed_dollar_vars |= 0x01;
} | void set_dollar_vars_changed(void)
{
if (variable_context == 0) {
if (this_shell_builtin == lRam0000000000100d76) {
changed_dollar_vars = changed_dollar_vars | 4;
} else {
changed_dollar_vars = changed_dollar_vars | 1;
}
} else {
changed_dollar_vars = changed_dollar_vars | 2;
}
return;
} | bash | ghidra |
static intmax_t grepbuf(char *beg, char const *lim) {
intmax_t outleft0 = outleft;
char *endp;
for (char *p = beg; p < lim; p = endp) {
idx_t match_size;
ptrdiff_t match_offset =
execute(compiled_pattern, p, lim - p, &match_size, ((void *)0));
if (match_offset < 0) {
if (!out_invert)
break;
match_offset = lim - p;
match_size = 0;
}
char *b = p + match_offset;
endp = b + match_size;
if (!out_invert && b == lim)
break;
if (!out_invert || p < b) {
char *prbeg = out_invert ? p : b;
char *prend = out_invert ? b : endp;
prtext(prbeg, prend);
if (!outleft || done_on_match) {
if (exit_on_match)
exit(errseen ? exit_failure : 0);
break;
}
}
}
return outleft0 - outleft;
} | long grepbuf(ulong param_1, ulong param_2)
{
int __status;
long in_FS_OFFSET;
long local_50;
ulong local_48;
long local_40;
long local_38;
ulong local_30;
ulong local_28;
ulong local_20;
ulong local_18;
long local_10;
local_10 = *(long *)(in_FS_OFFSET + 0x28);
local_38 = outleft;
local_48 = param_1;
do {
if (param_2 <= local_48) {
LAB_00102074:
if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) {
__stack_chk_fail();
}
return local_38 - outleft;
}
local_40 = (*execute)(compiled_pattern, local_48, param_2 - local_48,
&local_50, 0);
if (local_40 < 0) {
if (out_invert != '\x01')
goto LAB_00102074;
local_40 = param_2 - local_48;
local_50 = 0;
}
local_30 = local_48 + local_40;
local_28 = local_30 + local_50;
if ((out_invert != '\x01') && (local_30 == param_2))
goto LAB_00102074;
if ((out_invert != '\x01') || (local_48 < local_30)) {
local_18 = local_28;
local_20 = local_30;
if (out_invert != '\0') {
local_18 = local_30;
local_20 = local_48;
}
prtext(local_20, local_18);
if ((outleft == 0) || (done_on_match != '\0')) {
if (exit_on_match != '\0') {
__status = exit_failure;
if (errseen == '\0') {
__status = 0;
}
exit(__status);
}
goto LAB_00102074;
}
}
local_48 = local_28;
} while (true);
} | grep | ghidra |
char *extract_command_subst(string, sindex, xflags)
char *string;
int *sindex;
int xflags;
{
char *ret;
if (string[*sindex] == '(' || (xflags & 0x0400))
return (extract_delimited_string(string, sindex, "$(", "(", ")",
xflags | 0x0008));
else {
xflags |= (no_longjmp_on_fatal_error ? 0x0040 : 0);
ret = xparse_dolparen(string, string + *sindex, sindex, xflags);
return ret;
}
} | int extract_command_subst(char *a0, unsigned int *a1, unsigned long a2) {
unsigned int v0;
unsigned long v1;
unsigned long v3;
unsigned int v4;
v0 = a2;
if (a0[*(a1)] != 40 && !(v0 & 0x400)) {
if (no_longjmp_on_fatal_error)
v4 = 64;
else
v4 = 0;
v0 |= v4;
v1 = xparse_dolparen(a0, &a0[*(a1)], a1, v0);
v3 = v1;
}
if (a0[*(a1)] == 40 || (v0 & 0x400))
v3 = extract_delimited_string(a0, a1, "$(", "(", ")", v0 | 8);
return v3;
} | bash | angr_dream |
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 ed_quoted_insert(long a1) {
int v2;
int v3;
unsigned long v4;
v4 = __readfsqword(0x28u);
tty_quotemode(a1);
v3 = el_wgetc(a1, &v2);
tty_noquotemode(a1);
if (v3 == 1)
return ed_insert(a1, v2);
else
return ed_end_of_file(a1);
} | libedit | ida |
static _Bool
gid_to_chars(gid_t v, char *p, size_t s) {
return to_chars(v < 0, (uintmax_t)v, sizeof v, gid_substitute, p, s, "gid_t");
} | int gid_to_chars(unsigned long a0, char *a1, unsigned long long a2) {
return to_chars(0x0, a0, 0x4, gid_substitute, a1, a2, "gid_t");
} | tar | angr_sailr |
int ssh_hmac_final(struct ssh_hmac_ctx *ctx, u_char *d, size_t dlen)
__attribute__(());
void ssh_hmac_free(struct ssh_hmac_ctx *ctx);
struct sshbuf {
u_char *d;
const u_char *cd;
size_t off;
size_t size;
size_t max_size;
size_t alloc;
int readonly;
int dont_free;
u_int refcount;
struct sshbuf *parent;
}; | || (unsigned int)ssh_hmac_final(v7, v9, 256LL) )
{
sshfatal("hostfile.c", "host_hash", 140LL, 1LL, 1LL, 0LL,
"ssh_hmac failed");
} | openssh-portable | ida |
static void _rl_vi_save_insert(UNDO_LIST *up) {
int len, start, end;
if (up == 0 || up->what != UNDO_INSERT) {
if (vi_insert_buffer_size >= 1)
vi_insert_buffer[0] = '\0';
return;
}
start = up->start;
end = up->end;
len = end - start + 1;
vi_save_insert_buffer(start, len);
} | void _rl_vi_save_insert(unsigned int a0[7]) {
unsigned int v0;
unsigned int v1;
unsigned int v2;
unsigned long long v4;
unsigned long long v5;
char *v6;
if (a0 && a0[6] == 1) {
v0 = a0[2];
v1 = a0[3];
v2 = v1 - v0 + 1;
v5 = vi_save_insert_buffer(v0, v2);
return;
}
v4 = vi_insert_buffer_size;
if (vi_insert_buffer_size > 0) {
v6 = vi_insert_buffer;
*(vi_insert_buffer) = 0;
}
return;
} | bash | angr_sailr |
void rl_cleanup_after_signal(void) {} | void rl_cleanup_after_signal() { ; } | libedit | ida |
char **shell_glob_filename(pathname, qflags) const char *pathname;
int qflags;
{
char *temp, **results;
int gflags, quoted_pattern;
noglob_dot_filenames = glob_dot_filenames == 0;
temp = quote_string_for_globbing(pathname, 0x02 | qflags);
gflags = glob_star ? 0x400 : 0;
results = glob_filename(temp, gflags);
sh_xfree((temp), "pathexp.c", 419);
if (results && (((results) == (char **)&glob_error_return) == 0)) {
if (should_ignore_glob_matches())
ignore_glob_matches(results);
if (results && results[0])
strvec_sort(results, 1);
else {
do {
if (results)
sh_xfree((results), "pathexp.c", 429);
} while (0);
results = (char **)&glob_error_return;
}
}
return (results);
} | long long shell_glob_filename(void *a0, unsigned long a1) {
unsigned int v0;
unsigned long long v1;
unsigned long long v2;
unsigned int v4;
noglob_dot_filenames = !5023220010551146633;
v2 = quote_string_for_globbing(a0, a1 | 2);
if (!glob_star)
v4 = 0;
else
v4 = 0x400;
v0 = v4;
v1 = glob_filename(v2, v0, v0);
sh_xfree(v2, "pathexp.c", 0x1a3);
if (v1 && v1 != 5242968) {
if (should_ignore_glob_matches())
ignore_glob_matches(v1);
if (v1 && *(v1)) {
strvec_sort(v1, 0x1);
goto LABEL_400df9;
}
if (v1)
sh_xfree(v1, "pathexp.c", 0x1ad);
v1 = &glob_error_return;
}
LABEL_400df9:
return v1;
} | bash | angr_phoenix |
static void set_verify_format(const struct cmdinfo *cip, const char *value) {
if (!verify_set_output(value))
badusage(gettext("unknown verify output format '%s'"), value);
} | long set_verify_format(long a1, long a2) {
long result;
char *v3;
result = (unsigned int)verify_set_output(a2) ^ 1;
if ((_BYTE)result) {
v3 = gettext("unknown verify output format '%s'");
return badusage(v3, a2);
}
return result;
} | dpkg | ida |
static void print_ifdef_hunk(struct change *hunk) {
lin first0, last0, first1, last1;
enum changes changes = analyze_hunk(hunk, &first0, &last0, &first1, &last1);
if (!changes)
return;
begin_output();
if (next_line0 < first0 || next_line1 < first1)
format_ifdef(group_format[UNCHANGED], next_line0, first0, next_line1,
first1);
next_line0 = last0 + 1;
next_line1 = last1 + 1;
format_ifdef(group_format[changes], first0, next_line0, first1, next_line1);
} | void print_ifdef_hunk(undefined8 param_1)
{
uint uVar1;
long in_FS_OFFSET;
long local_30;
long local_28;
long local_20;
long local_18;
long local_10;
local_10 = *(long *)(in_FS_OFFSET + 0x28);
uVar1 = analyze_hunk(param_1, &local_30, &local_28, &local_20, &local_18);
if (uVar1 != 0) {
begin_output();
if ((next_line0 < local_30) || (next_line1 < local_20)) {
format_ifdef(group_format, next_line0, local_30, next_line1, local_20);
}
next_line0 = local_28 + 1;
next_line1 = local_18 + 1;
format_ifdef((&group_format)[uVar1], local_30, next_line0, local_20,
next_line1);
}
if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) {
__stack_chk_fail();
}
return;
} | diffutils | ghidra |
static char *read_check_passphrase(const char *prompt1, const char *prompt2,
const char *retry_prompt) {
char *passphrase1, *passphrase2;
for (;;) {
passphrase1 = read_passphrase(prompt1, 0x0002);
passphrase2 = read_passphrase(prompt2, 0x0002);
if (strcmp(passphrase1, passphrase2) == 0) {
freezero(passphrase2, strlen(passphrase2));
return passphrase1;
}
freezero(passphrase1, strlen(passphrase1));
freezero(passphrase2, strlen(passphrase2));
fputs(retry_prompt, stdout);
fputc('\n', stdout);
fflush(stdout);
}
return ((void *)0);
} | void read_check_passphrase(unsigned long long a0, unsigned long long a1,
char *a2) {
char *v0;
char *v1;
unsigned long long v5;
unsigned long long v6;
unsigned long long v7;
unsigned long long v8;
while (true) {
*(&v0) = read_passphrase(a0, 0x2);
v1 = read_passphrase(a1, 0x2);
if (!strcmp(v0, v1))
break;
v5 = strlen(v0);
freezero(v0, v5, v5);
v6 = strlen(v1);
freezero(v1, v6, v6);
fputs(a2, stdout);
fputc(0xa, stdout);
fflush(stdout);
}
v7 = strlen(v1);
freezero(v1, v7, v7);
v8 = v0;
return;
} | openssh-portable | angr_dream |
static rsRetVal loadTCPSupport(void) {
rsRetVal iRet = RS_RET_OK;
if ((iRet = obj.UseObj("omfwd.c", (uchar *)"netstrms", (uchar *)"lmnetstrms",
(void *)&netstrms)) != RS_RET_OK)
goto finalize_it;
if ((iRet = obj.UseObj("omfwd.c", (uchar *)"netstrm", (uchar *)"lmnetstrms",
(void *)&netstrm)) != RS_RET_OK)
goto finalize_it;
if ((iRet = obj.UseObj("omfwd.c", (uchar *)"tcpclt", (uchar *)"lmtcpclt",
(void *)&tcpclt)) != RS_RET_OK)
goto finalize_it;
finalize_it:
return iRet;
} | long loadTCPSupport() {
unsigned int v1;
v1 = qword_5588("omfwd.c", "netstrms", "lmnetstrms", &netstrms);
if (!v1) {
v1 = qword_5588("omfwd.c", "netstrm", "lmnetstrms", &netstrm);
if (!v1)
return (unsigned int)qword_5588("omfwd.c", "tcpclt", "lmtcpclt", &tcpclt);
}
return v1;
} | rsyslog-8.2210.0 | ida |
static void set_control_char(struct control_info const *info, char const *arg,
struct termios *mode) {
unsigned long int value;
if ((strcmp(info->name, "min") == 0) || (strcmp(info->name, "time") == 0))
value = integer_arg(
arg,
((cc_t)(!(!((cc_t)0 < (cc_t)-1))
? (cc_t)-1
: ((((cc_t)1 << ((sizeof(cc_t) * 8) - 2)) - 1) * 2 + 1))));
else if (arg[0] == '\0' || arg[1] == '\0')
value = to_uchar(arg[0]);
else if ((strcmp(arg, "^-") == 0) || (strcmp(arg, "undef") == 0))
value = '\0';
else if (arg[0] == '^' && arg[1] != '\0') {
if (arg[1] == '?')
value = 127;
else
value = to_uchar(arg[1]) & ~0140;
} else
value = integer_arg(
arg,
((cc_t)(!(!((cc_t)0 < (cc_t)-1))
? (cc_t)-1
: ((((cc_t)1 << ((sizeof(cc_t) * 8) - 2)) - 1) * 2 + 1))));
mode->c_cc[info->offset] = value;
} | void set_control_char(unsigned long long a0[3], unsigned long long a1,
unsigned long a2) {
char v0;
unsigned long long v1;
unsigned long long v4;
if (!strcmp(a0[0], "min")) {
LABEL_402501:
v1 = integer_arg(a1, 0xff);
} else {
if (!strcmp(a0[0], "time"))
goto LABEL_402501;
if (!*(a1)) {
LABEL_402535:
v1 = to_uchar(*(a1));
} else {
if (!*((a1 + 1)))
goto LABEL_402535;
if (!strcmp(a1, "^-")) {
LABEL_402580:
v1 = 0;
} else {
if (!strcmp(a1, "undef"))
goto LABEL_402580;
if (*(a1) == 94 && *((a1 + 1))) {
if (*((a1 + 1)) == 63) {
v1 = 127;
goto LABEL_4025f5;
} else {
v1 = to_uchar(*((a1 + 1))) & 4294967199;
goto LABEL_4025f5;
}
}
v1 = integer_arg(a1, 0xff);
}
}
}
LABEL_4025f5:
v4 = a0[2];
*((*(&v0) + a0[2] + 17)) = v1;
return;
} | coreutils | angr_phoenix |
int rl_vi_first_print(int count, int key) {
return (rl_vi_back_to_indent(1, key));
} | long long rl_vi_first_print(unsigned long a0, unsigned long a1) {
unsigned int v0;
v0 = a0;
return rl_vi_back_to_indent(0x1, a1);
} | bash | angr_dream |
int strcmp_until(const char *left, const char *right, char until) {
while (*left && *left != until && *left == *right) {
left++;
right++;
}
if ((*left == '\0' || *left == until) &&
(*right == '\0' || *right == until)) {
return (0);
}
return (*left - *right);
} | int strcmp_until(unsigned long a0, unsigned long a1, unsigned long a2) {
char *v0;
char *v1;
unsigned int v3;
v1 = a0;
for (v0 = a1; *(v1); v0 += 1) {
if (a2 == *(v1))
break;
if (a2 != *(v1)) {
if (*(v1) != *(v0))
break;
}
v1 += 1;
}
if (!*(v1) && a2 == *(v0) || !*(v1) && !*(v0) || a2 == *(v0) && a2 == *(v1) ||
!*(v0) && a2 == *(v1))
v3 = 0;
else
v3 = *(v1) - *(v0);
return v3;
} | cronie | angr_dream |
static errcode_t
e2fsck_journal_fix_corrupt_super(e2fsck_t ctx, journal_t *journal,
struct problem_context *pctx) {
struct ext2_super_block *sb = ctx->fs->super;
int recover = ext2fs_has_feature_journal_needs_recovery(ctx->fs->super);
if (ext2fs_has_feature_journal(sb)) {
if (fix_problem(ctx, 0x000015, pctx)) {
e2fsck_journal_reset_super(ctx, journal->j_superblock, journal);
journal->j_transaction_sequence = 1;
e2fsck_clear_recover(ctx, recover);
return 0;
}
return (2133571504L);
} else if (e2fsck_journal_fix_bad_inode(ctx, pctx))
return (2133571504L);
return 0;
} | int e2fsck_journal_fix_corrupt_super(struct struct_1 **a0, struct_0 *a1,
unsigned long long a2) {
unsigned int v0;
void *v1;
unsigned int v3;
v1 = *(a0)->field_20;
v0 = ext2fs_has_feature_journal_needs_recovery(*(a0)->field_20);
if (ext2fs_has_feature_journal(v1)) {
if (!fix_problem(a0, 0x15, a2)) {
v3 = 2133571504;
} else {
e2fsck_journal_reset_super(a0, a1->field_18, a1, a1->field_18);
a1->field_94 = 1;
e2fsck_clear_recover(a0, v0);
v3 = 0;
}
} else {
if (e2fsck_journal_fix_bad_inode(a0, a2))
v3 = 2133571504;
else
v3 = 0;
}
return v3;
} | e2fsprogs-1.46.5 | angr_phoenix |
static COPROC_COM *copy_coproc_command(com)
COPROC_COM *com;
{
COPROC_COM *new_coproc;
new_coproc =
(COPROC_COM *)sh_xmalloc((sizeof(COPROC_COM)), "copy_cmd.c", 242);
new_coproc->name = (char *)strcpy(
sh_xmalloc((1 + strlen(com->name)), "copy_cmd.c", 243), (com->name));
new_coproc->command = copy_command(com->command);
new_coproc->flags = com->flags;
return (new_coproc);
} | int copy_coproc_command(struct_0 *a0) {
struct_0 *v0;
v0 = sh_xmalloc(0x18, "copy_cmd.c", 0xf2);
v0->field_8 = strcpy(sh_xmalloc(strlen(a0->field_8) + 1, "copy_cmd.c", 0xf3),
a0->field_8);
v0->field_10 = copy_command(a0->field_10);
v0->field_0 = a0->field_0;
return v0;
} | bash | angr_phoenix |
int sshkey_save_public(const struct sshkey *key, const char *path,
const char *comment) {
int fd, oerrno;
FILE *f = ((void *)0);
int r = -1;
if ((fd = open(path, 01 | 0100 | 01000, 0644)) == -1)
return -24;
if ((f = fdopen(fd, "w")) == ((void *)0)) {
r = -24;
close(fd);
goto fail;
}
if ((r = sshkey_write(key, f)) != 0)
goto fail;
fprintf(f, " %s\n", comment);
if (ferror(f)) {
r = -24;
goto fail;
}
if (fclose(f) != 0) {
r = -24;
f = ((void *)0);
fail:
if (f != ((void *)0)) {
oerrno = (*__errno_location());
fclose(f);
(*__errno_location()) = oerrno;
}
return r;
}
return 0;
} | int sshkey_save_public(undefined8 param_1, char *param_2, undefined8 param_3)
{
int iVar1;
int *piVar2;
int local_1c;
FILE *local_10;
iVar1 = open(param_2, 0x241, 0x1a4);
if (iVar1 == -1) {
local_1c = -0x18;
} else {
local_10 = fdopen(iVar1, "w");
if (local_10 == (FILE *)0x0) {
local_1c = -0x18;
close(iVar1);
} else {
local_1c = sshkey_write(param_1, local_10);
if (local_1c == 0) {
fprintf(local_10, " %s\n", param_3);
iVar1 = ferror(local_10);
if (iVar1 == 0) {
iVar1 = fclose(local_10);
if (iVar1 == 0) {
return 0;
}
local_1c = -0x18;
local_10 = (FILE *)0x0;
} else {
local_1c = -0x18;
}
}
}
if (local_10 != (FILE *)0x0) {
piVar2 = __errno_location();
iVar1 = *piVar2;
fclose(local_10);
piVar2 = __errno_location();
*piVar2 = iVar1;
}
}
return local_1c;
} | openssh-portable | ghidra |
inline void xset_binary_mode(int fd, int mode) {
if (set_binary_mode(fd, mode) < 0)
xset_binary_mode_error();
} | void xset_binary_mode(void)
{
halt_baddata();
} | coreutils | ghidra |
static void get_group(struct group *gr, struct sgrp *sg)
{
struct group const *tmpgr = ((void *)0);
struct sgrp const *tmpsg = ((void *)0);
if (gr_open(00) == 0) {
fprintf(stderr, gettext("%s: cannot open %s\n"), Prog, gr_dbname());
do {
char *old_locale = setlocale(6, ((void *)0));
char *saved_locale = ((void *)0);
if (((void *)0) != old_locale) {
saved_locale = strdup(old_locale);
}
if (((void *)0) != saved_locale) {
(void)setlocale(6, "C");
}
syslog(4, "cannot open %s", gr_dbname());
if (((void *)0) != saved_locale) {
(void)setlocale(6, saved_locale);
free(saved_locale);
}
} while (0);
exit(1);
}
tmpgr = gr_locate(group);
if (((void *)0) == tmpgr) {
fprintf(stderr, gettext("%s: group '%s' does not exist in %s\n"), Prog,
group, gr_dbname());
exit(3);
}
*gr = *tmpgr;
gr->gr_name = xstrdup(tmpgr->gr_name);
gr->gr_passwd = xstrdup(tmpgr->gr_passwd);
gr->gr_mem = dup_list(tmpgr->gr_mem);
if (gr_close() == 0) {
fprintf(stderr, gettext("%s: failure while closing read-only %s\n"), Prog,
gr_dbname());
do {
char *old_locale = setlocale(6, ((void *)0));
char *saved_locale = ((void *)0);
if (((void *)0) != old_locale) {
saved_locale = strdup(old_locale);
}
if (((void *)0) != saved_locale) {
(void)setlocale(6, "C");
}
syslog(3, "failure while closing read-only %s", gr_dbname());
if (((void *)0) != saved_locale) {
(void)setlocale(6, saved_locale);
free(saved_locale);
}
} while (0)
;
exit(1);
}
if (is_shadowgrp) {
if (sgr_open(00) == 0) {
fprintf(stderr, gettext("%s: cannot open %s\n"), Prog, sgr_dbname());
do {
char *old_locale = setlocale(6, ((void *)0));
char *saved_locale = ((void *)0);
if (((void *)0) != old_locale) {
saved_locale = strdup(old_locale);
}
if (((void *)0) != saved_locale) {
(void)setlocale(6, "C");
}
syslog(4, "cannot open %s", sgr_dbname());
if (((void *)0) != saved_locale) {
(void)setlocale(6, saved_locale);
free(saved_locale);
}
} while (0);
exit(1);
}
tmpsg = sgr_locate(group);
if (((void *)0) != tmpsg) {
*sg = *tmpsg;
sg->sg_name = xstrdup(tmpsg->sg_name);
sg->sg_passwd = xstrdup(tmpsg->sg_passwd);
sg->sg_mem = dup_list(tmpsg->sg_mem);
sg->sg_adm = dup_list(tmpsg->sg_adm);
} else {
sg->sg_name = xstrdup(group);
sg->sg_passwd = gr->gr_passwd;
gr->gr_passwd = "x";
sg->sg_mem = dup_list(gr->gr_mem);
sg->sg_adm = (char **)xmalloc(sizeof(char *) * 2);
{
sg->sg_adm[0] = ((void *)0);
}
}
if (sgr_close() == 0) {
fprintf(stderr, gettext("%s: failure while closing read-only %s\n"), Prog,
sgr_dbname());
do {
char *old_locale = setlocale(6, ((void *)0));
char *saved_locale = ((void *)0);
if (((void *)0) != old_locale) {
saved_locale = strdup(old_locale);
}
if (((void *)0) != saved_locale) {
(void)setlocale(6, "C");
}
syslog(3, "failure while closing read-only %s", sgr_dbname());
if (((void *)0) != saved_locale) {
(void)setlocale(6, saved_locale);
free(saved_locale);
}
} while (0)
;
exit(1);
}
}
} | long get_group(_QWORD *a1, _QWORD *a2) {
long v2;
long v3;
char *v4;
const char *v5;
long v6;
long v7;
long v8;
char *v9;
long v10;
long v11;
long v12;
long v13;
char *v14;
const char *v15;
long result;
long v17;
long v18;
char *v19;
const char *v20;
long v21;
long v22;
long v23;
long v24;
char *v25;
const char *v26;
char *locale;
char *v28;
char *v29;
char *v30;
_QWORD *v31;
_QWORD *v32;
const char *v33;
const char *v34;
const char *v35;
const char *s;
if (!(unsigned int)gr_open(0LL)) {
v2 = gr_dbname();
v3 = Prog;
v4 = gettext("%s: cannot open %s\n");
fprintf(stderr, v4, v3, v2);
s = setlocale(6, 0LL);
locale = 0LL;
if (s)
locale = strdup(s);
if (locale)
setlocale(6, "C");
v5 = (const char *)gr_dbname();
syslog(4, "cannot open %s", v5);
if (locale) {
setlocale(6, locale);
free(locale);
}
exit(1);
}
v31 = (_QWORD *)gr_locate(group);
if (!v31) {
v6 = gr_dbname();
v7 = group;
v8 = Prog;
v9 = gettext("%s: group '%s' does not exist in %s\n");
fprintf(stderr, v9, v8, v7, v6);
exit(3);
}
v10 = v31[1];
*a1 = *v31;
a1[1] = v10;
v11 = v31[3];
a1[2] = v31[2];
a1[3] = v11;
*a1 = xstrdup(*v31);
a1[1] = xstrdup(v31[1]);
a1[3] = dup_list(v31[3]);
if (!(unsigned int)gr_close()) {
v12 = gr_dbname();
v13 = Prog;
v14 = gettext("%s: failure while closing read-only %s\n");
fprintf(stderr, v14, v13, v12);
v35 = setlocale(6, 0LL);
v28 = 0LL;
if (v35)
v28 = strdup(v35);
if (v28)
setlocale(6, "C");
v15 = (const char *)gr_dbname();
syslog(3, "failure while closing read-only %s", v15);
if (v28) {
setlocale(6, v28);
free(v28);
}
exit(1);
}
result = (unsigned char)is_shadowgrp;
if (is_shadowgrp) {
if (!(unsigned int)sgr_open(0LL)) {
v17 = sgr_dbname();
v18 = Prog;
v19 = gettext("%s: cannot open %s\n");
fprintf(stderr, v19, v18, v17);
v34 = setlocale(6, 0LL);
v29 = 0LL;
if (v34)
v29 = strdup(v34);
if (v29)
setlocale(6, "C");
v20 = (const char *)sgr_dbname();
syslog(4, "cannot open %s", v20);
if (v29) {
setlocale(6, v29);
free(v29);
}
exit(1);
}
v32 = (_QWORD *)sgr_locate(group);
if (v32) {
v21 = v32[1];
*a2 = *v32;
a2[1] = v21;
v22 = v32[3];
a2[2] = v32[2];
a2[3] = v22;
*a2 = xstrdup(*v32);
a2[1] = xstrdup(v32[1]);
a2[3] = dup_list(v32[3]);
a2[2] = dup_list(v32[2]);
} else {
*a2 = xstrdup(group);
a2[1] = a1[1];
a1[1] = "x";
a2[3] = dup_list(a1[3]);
a2[2] = xmalloc(16LL);
*(_QWORD *)a2[2] = 0LL;
}
result = sgr_close();
if (!(_DWORD)result) {
v23 = sgr_dbname();
v24 = Prog;
v25 = gettext("%s: failure while closing read-only %s\n");
fprintf(stderr, v25, v24, v23);
v33 = setlocale(6, 0LL);
v30 = 0LL;
if (v33)
v30 = strdup(v33);
if (v30)
setlocale(6, "C");
v26 = (const char *)sgr_dbname();
syslog(3, "failure while closing read-only %s", v26);
if (v30) {
setlocale(6, v30);
free(v30);
}
exit(1);
}
}
return result;
} | shadow | ida |
char *percent_expand(const char *string, ...) {
char *ret;
int err;
va_list ap;
__builtin_va_start(ap, string);
ret = vdollar_percent_expand(&err, 0, 1, string, ap);
__builtin_va_end(ap);
if (err)
sshfatal("misc.c", __func__, 1365, 1, SYSLOG_LEVEL_FATAL, ((void *)0),
"failed");
return ret;
} | long percent_expand(char *a1, long a2, long a3, long a4, long a5, long a6,
...) {
int v7;
long v8;
gcc_va_list va;
unsigned long v10;
long v11;
long v12;
long v13;
long v14;
long v15;
va_start(va, a6);
v11 = a2;
v12 = a3;
v13 = a4;
v14 = a5;
v15 = a6;
v10 = __readfsqword(0x28u);
va[0].gp_offset = 8;
v8 = vdollar_percent_expand(&v7, 0, 1, a1, &va[0].gp_offset);
if (v7)
sshfatal("misc.c", "percent_expand", 1365LL, 1LL, 1LL, 0LL, "failed");
return v8;
} | openssh-portable | ida |
static void xheader_print(struct xheader *xhdr, char const *keyword,
char const *value) {
xheader_print_n(xhdr, keyword, value, strlen(value));
} | void xheader_print(void *a0, unsigned long a1, void *a2) {
unsigned long long v1;
v1 = xheader_print_n(a0, a1, a2, strlen(a2));
return;
} | tar | angr_dream |
static inline void emit_ancillary_info(char const *program) {
struct infomap {
char const *program;
char const *node;
} const infomap[] = {
{"[", "test invocation"}, {"coreutils", "Multi-call invocation"},
{"sha224sum", "sha2 utilities"}, {"sha256sum", "sha2 utilities"},
{"sha384sum", "sha2 utilities"}, {"sha512sum", "sha2 utilities"},
{((void *)0), ((void *)0)}};
char const *node = program;
struct infomap const *map_prog = infomap;
while (map_prog->program && !(strcmp(program, map_prog->program) == 0))
map_prog++;
if (map_prog->node)
node = map_prog->node;
printf (gettext ("\n%s online help: <%s>\n"), "GNU coreutils", "https:
char const *lc_messages = setlocale (
5
,
((void *)0)
);
if (lc_messages && strncmp (lc_messages, "" "en_" "", sizeof ("en_") - 1))
{
fputs_unlocked (gettext ("Report any translation bugs to " "<https:
stdout
)
;
}
char const *url_program = (strcmp (program, "[") == 0) ? "test" : program;
printf (gettext ("Full documentation <%s%s>\n"),
"https:
printf (gettext ("or available locally via: info '(coreutils) %s%s'\n"),
node, node == program ? " invocation" : "");
} | void emit_ancillary_info(char *a0) {
unsigned long long v0;
unsigned long long v1[2];
char *v2;
unsigned long long v3;
unsigned long long v4;
unsigned long long v5;
unsigned long long v6;
unsigned long long v7;
unsigned long long v8;
unsigned long long v9;
unsigned long long v10;
unsigned long long v11;
unsigned long long v12;
unsigned long long v13;
unsigned long long v14;
unsigned long long v15;
void *v16;
void *v17;
char v18;
unsigned long long v20;
unsigned long long *v21;
unsigned long long v22;
v4 = "[";
v5 = "test invocation";
v6 = "coreutils";
v7 = "Multi-call invocation";
v8 = "sha224sum";
v9 = "sha2 utilities";
v10 = "sha256sum";
v11 = "sha2 utilities";
v12 = "sha384sum";
v13 = "sha2 utilities";
v14 = "sha512sum";
v15 = "sha2 utilities";
v16 = 0;
v17 = 0;
v0 = a0;
v1[0] = &v4;
while (true) {
if (!v1[0])
break;
if (!strcmp(a0, v1[0]))
break;
v1[0] = v1 + 1;
}
if (v1[1])
v0 = v1[1];
printf(gettext("\n%s online help: <%s>\n"));
v2 = setlocale(0x5, NULL);
if (v2 && strncmp(v2, "en_", 0x3))
fputs_unlocked(gettext("Report any translation bugs to <https:
if (!strcmp(a0, "["))
v20 = "test";
else
v20 = a0;
v3 = v20;
printf(gettext("Full documentation <%s%s>\n"));
printf(gettext("or available locally via: info '(coreutils) %s%s'\n"));
v22 = *(&v18) ^ v21[5];
return;
} | coreutils | angr_phoenix |
static void find_jobs(int vtime, cron_db *db, int doWild, int doNonWild,
long vGMToff) {
char *orig_tz, *job_tz;
struct tm *tm;
int minute, hour, dom, month, dow;
user *u;
entry *e;
orig_tz = getenv("TZ");
for (u = db->head; u != ((void *)0); u = u->next) {
for (e = u->crontab; e != ((void *)0); e = e->next) {
time_t virtualSecond = (time_t)(vtime - e->delay) * (time_t)60;
time_t virtualGMTSecond = virtualSecond - vGMToff;
job_tz = env_get("CRON_TZ", e->envp);
do {
char *t = job_tz;
if (t != ((void *)0) && *t != '\0') {
setenv("TZ", t, 1);
tm = localtime(&virtualGMTSecond);
} else {
if ((orig_tz) != ((void *)0))
setenv("TZ", (orig_tz), 1);
else
unsetenv("TZ");
tm = gmtime(&virtualSecond);
}
minute = tm->tm_min - 0;
hour = tm->tm_hour - 0;
dom = tm->tm_mday - 1;
month = tm->tm_mon + 1 - 1;
dow = tm->tm_wday - 0;
} while (0);
if (((e->minute)[((minute) >> 3)] & (1 << ((minute) & 0x7))) &&
((e->hour)[((hour) >> 3)] & (1 << ((hour) & 0x7))) &&
((e->month)[((month) >> 3)] & (1 << ((month) & 0x7))) &&
(((e->flags & 0x04) || (e->flags & 0x08))
? (((e->dow)[((dow) >> 3)] & (1 << ((dow) & 0x7))) &&
((e->dom)[((dom) >> 3)] & (1 << ((dom) & 0x7))))
: (((e->dow)[((dow) >> 3)] & (1 << ((dow) & 0x7))) ||
((e->dom)[((dom) >> 3)] & (1 << ((dom) & 0x7)))))) {
if (job_tz != ((void *)0) && vGMToff != GMToff)
continue;
if ((doNonWild && !(e->flags & (0x01 | 0x02))) ||
(doWild && (e->flags & (0x01 | 0x02))))
job_add(e, u);
}
}
}
if (orig_tz != ((void *)0))
setenv("TZ", orig_tz, 1);
else
unsetenv("TZ");
} | void find_jobs(unsigned long a0, unsigned long long *a1, unsigned long a2,
unsigned long a3, unsigned long a4) {
unsigned int v0;
unsigned int v1;
unsigned int v2;
unsigned int v3;
unsigned int v4;
unsigned long v5;
unsigned long v6;
unsigned int v7[7];
unsigned long long v8[6];
struct_5 *v9;
char *v10;
char *v11;
char *v12;
char v13;
unsigned int v15;
unsigned long long *v16;
unsigned long long v17;
v10 = getenv("TZ");
for (v8[0] = *(a1); v8; v8[0] = v8[0]) {
for (v9 = v8[5]; v9; v9 = v9->field_0) {
v5 = (a0 - v9->field_38) * 60;
v6 = v5 - a4;
v11 = env_get("CRON_TZ", v9->field_10, a0 - v9->field_38);
v12 = v11;
if (!v12 || !*(v12)) {
if (!v10)
unsetenv("TZ");
else
setenv("TZ", v10, 0x1);
*(&v7[0]) = gmtime(&v5);
} else {
setenv("TZ", v12, 0x1);
*(&v7[0]) = localtime(&v6);
}
v0 = v7[1];
v1 = v7[2];
v2 = v7[3] - 1;
v3 = v7[4];
v4 = v7[6];
if (((v9->padding_18[8 + (v0 >> 3)] >> ((v0 & 7) & 31)) & 1) &&
((v9->padding_18[16 + (v1 >> 3)] >> ((v1 & 7) & 31)) & 1) &&
((v9->padding_18[23 + (v3 >> 3)] >> ((v3 & 7) & 31)) & 1)) {
if ((v9->field_34 & 4) || (v9->field_34 & 8)) {
if (!((v9->padding_18[25 + (v4 >> 3)] >> ((v4 & 7) & 31)) & 1) ||
!((v9->padding_18[19 + (v2 >> 3)] >> ((v2 & 7) & 31)) & 1))
v15 = 0;
else
v15 = 1;
*(&v15) = v15 & 1;
} else {
if (((v9->padding_18[25 + (v4 >> 3)] >> ((v4 & 7) & 31)) & 1) ||
((v9->padding_18[19 + (v2 >> 3)] >> ((v2 & 7) & 31)) & 1))
v15 = 1;
else
v15 = 0;
*(&v15) = v15 & 1;
}
if (v15 && (!v11 || a4 == GMToff) &&
(a3 && !(v9->field_34 & 3) || a2 && (v9->field_34 & 3)))
job_add(v9, v8, v8);
}
}
}
if (!v10)
unsetenv("TZ");
else
setenv("TZ", v10, 0x1);
v17 = *(&v13) ^ v16[5];
return;
} | cronie | angr_sailr |
static void print_for_command(for_command) FOR_COM *for_command;
{
print_for_command_head(for_command);
cprintf(";");
newline("do\n");
indentation += indentation_amount;
make_command_string_internal(for_command->action);
do {
if (deferred_heredocs)
print_deferred_heredocs("");
} while (0);
semicolon();
indentation -= indentation_amount;
newline("done");
} | void print_for_command(struct_0 *a0) {
unsigned long long v1;
print_for_command_head(a0);
cprintf(";");
newline("do\n");
indentation = indentation_amount + indentation;
make_command_string_internal(a0->field_18);
if (deferred_heredocs)
print_deferred_heredocs(&g_403583);
semicolon();
indentation = indentation - indentation_amount;
v1 = newline("done");
return;
} | bash | angr_phoenix |
uLong adler32_combine64(adler1, adler2, len2)
uLong adler1;
uLong adler2;
off64_t len2;
{
return adler32_combine_(adler1, adler2, len2);
} | long long adler32_combine64(unsigned int a0, unsigned int a1, unsigned int a2) {
return adler32_combine_(a0, a1, a2);
} | zlib | angr_phoenix |
ed_search_prev_history(EditLine *el, wint_t c __attribute__((__unused__))) {
const wchar_t *hp;
int h;
int found = 0;
el->el_chared.c_vcmd.action = 0x00;
el->el_chared.c_undo.len = -1;
*el->el_line.lastchar = '\0';
if (el->el_history.eventno < 0) {
el->el_history.eventno = 0;
return 6;
}
if (el->el_history.eventno == 0) {
(void)wcsncpy(el->el_history.buf, el->el_line.buffer, ((size_t)1024));
el->el_history.last =
el->el_history.buf + (el->el_line.lastchar - el->el_line.buffer);
}
if (el->el_history.ref == ((void *)0))
return 6;
hp = (((el)->el_flags & 0x040)
? hist_convert(el, 3, ((void *)0))
: ((((*(el)->el_history.fun)((el)->el_history.ref,
&(el)->el_history.ev, 3,
((void *)0))) == -1)
? ((void *)0)
: (el)->el_history.ev.str));
if (hp == ((void *)0))
return 6;
c_setpat(el);
for (h = 1; h <= el->el_history.eventno; h++)
hp = (((el)->el_flags & 0x040)
? hist_convert(el, 6, ((void *)0))
: ((((*(el)->el_history.fun)((el)->el_history.ref,
&(el)->el_history.ev, 6,
((void *)0))) == -1)
? ((void *)0)
: (el)->el_history.ev.str));
while (hp != ((void *)0)) {
if ((wcsncmp(hp, el->el_line.buffer,
(size_t)(el->el_line.lastchar - el->el_line.buffer)) ||
hp[el->el_line.lastchar - el->el_line.buffer]) &&
c_hmatch(el, hp)) {
found = 1;
break;
}
h++;
hp = (((el)->el_flags & 0x040)
? hist_convert(el, 6, ((void *)0))
: ((((*(el)->el_history.fun)((el)->el_history.ref,
&(el)->el_history.ev, 6,
((void *)0))) == -1)
? ((void *)0)
: (el)->el_history.ev.str));
}
if (!found) {
return 6;
}
el->el_history.eventno = h;
return hist_get(el);
} | long long ed_search_prev_history(struct_0 *a0, unsigned long a1) {
unsigned int v0;
unsigned int v1;
unsigned int v2;
void *v3;
unsigned long long v5;
void *v6;
void *v9;
unsigned long long v10;
unsigned long long v11;
void *v12;
v0 = a1;
v2 = 0;
a0->field_3c0 = 0;
a0->field_368 = -1;
a0->field_60->field_0 = 0;
if (a0->field_470 < 0) {
a0->field_470 = 0;
v5 = 6;
} else {
if (!a0->field_470) {
wcsncpy(a0->field_458, a0->field_50, 0x400);
a0->field_468 = a0->field_458 + a0->field_60 + -1 * a0->field_50;
}
if (!a0->field_478) {
v5 = 6;
} else {
if ((a0->field_2c & 64)) {
v6 = hist_convert(a0, 0x3, 0x0);
} else if (a0->field_480(a0->field_478, &a0->padding_488, 3, 0,
a0->field_480) != -1) {
v6 = a0->field_490;
} else {
v6 = 0;
}
v3 = v6;
if (!v3) {
v5 = 6;
} else {
c_setpat(a0);
for (v1 = 1; v1 <= a0->field_470; v1 += 1) {
if ((a0->field_2c & 64)) {
v9 = hist_convert(a0, 0x6, 0x0);
} else if (a0->field_480(a0->field_478, &a0->padding_488, 6, 0,
a0->field_480) != -1) {
v9 = a0->field_490;
} else {
v9 = 0;
}
v3 = v9;
}
for (; v3; v3 = v12) {
v10 =
wcsncmp(v3, a0->field_50, a0->field_60 + -1 * a0->field_50 >> 2);
if (*((v3 + a0->field_60 + -1 * a0->field_50)) || v10) {
v11 = c_hmatch(a0, v3, v3);
if (v11) {
v2 = 1;
break;
}
}
if (!v11 || !*((v3 + a0->field_60 + -1 * a0->field_50)) && !v10) {
v1 += 1;
if ((a0->field_2c & 64)) {
v12 = hist_convert(a0, 0x6, 0x0);
} else if (a0->field_480(a0->field_478, &a0->padding_488, 6, 0,
a0->field_480) != -1) {
v12 = a0->field_490;
} else {
v12 = 0;
}
}
}
if (!v2) {
v5 = 6;
} else {
a0->field_470 = v1;
v5 = hist_get(a0);
}
}
}
}
return v5;
} | libedit | angr_dream |
static void output_one_tex_line(void) {
BLOCK key;
BLOCK after;
char *cursor;
printf("\\%s ", macro_name);
putchar_unlocked('{');
print_field(tail);
fputs_unlocked("}{", stdout);
print_field(before);
fputs_unlocked("}{", stdout);
key.start = keyafter.start;
after.end = keyafter.end;
cursor = keyafter.start;
if (word_regex.string) {
regoff_t count;
count = re_match(&word_regex.pattern, cursor, keyafter.end - cursor, 0,
((void *)0));
if (count == -2)
matcher_error();
cursor += count == -1 ? 1 : count;
} else if (word_fastmap[to_uchar(*cursor)])
while (cursor < keyafter.end && word_fastmap[to_uchar(*cursor)])
cursor++;
else
cursor++;
key.end = cursor;
after.start = cursor;
print_field(key);
fputs_unlocked("}{", stdout);
print_field(after);
fputs_unlocked("}{", stdout);
print_field(head);
putchar_unlocked('}');
if (auto_reference || input_reference) {
putchar_unlocked('{');
print_field(reference);
putchar_unlocked('}');
}
putchar_unlocked('\n');
} | void output_one_tex_line() {
unsigned int v0;
char *v1;
char *v2;
char *v3;
char *v4;
char *v5;
unsigned long long v9;
unsigned long long v10;
printf("\\%s ", macro_name);
putchar_unlocked(0x7b);
print_field(tail, g_404288);
fputs_unlocked("}{", stdout); | coreutils | angr_phoenix |
static int check_ext_attr(e2fsck_t ctx, struct problem_context *pctx,
char *block_buf, struct ea_quota *ea_block_quota) {
ext2_filsys fs = ctx->fs;
ext2_ino_t ino = pctx->ino;
struct ext2_inode *inode = pctx->inode;
blk64_t blk;
char *end;
struct ext2_ext_attr_header *header;
struct ext2_ext_attr_entry *first, *entry;
blk64_t quota_blocks = ((1) << (fs)->cluster_ratio_bits);
__u64 quota_inodes = 0;
region_t region = 0;
int failed_csum = 0;
ea_block_quota->blocks = 0;
ea_block_quota->inodes = 0;
blk = ext2fs_file_acl_block(fs, inode);
if (blk == 0)
return 0;
if (!ext2fs_has_feature_xattr(fs->super) ||
(blk < fs->super->s_first_data_block) ||
(blk >= ext2fs_blocks_count(fs->super))) {
mark_inode_bad(ctx, ino);
return 0;
}
if (!ctx->block_ea_map) {
pctx->errcode =
e2fsck_allocate_block_bitmap(fs, (gettext("ext attr block map")), 2,
"block_ea_map", &ctx->block_ea_map);
if (pctx->errcode) {
pctx->num = 2;
fix_problem(ctx, 0x010025, pctx);
ctx->flags |= 0x0001;
return 0;
}
}
if (!ctx->refcount) {
pctx->errcode = ea_refcount_create(0, &ctx->refcount);
if (pctx->errcode) {
pctx->num = 1;
fix_problem(ctx, 0x010038, pctx);
ctx->flags |= 0x0001;
return 0;
}
}
if (ext2fs_fast_test_block_bitmap2(ctx->block_ea_map, blk)) {
ea_block_quota->blocks = ((1) << (fs)->cluster_ratio_bits);
ea_block_quota->inodes = 0;
if (ctx->ea_block_quota_blocks) {
ea_refcount_fetch(ctx->ea_block_quota_blocks, blk, "a_blocks);
if (quota_blocks)
ea_block_quota->blocks = quota_blocks;
}
if (ctx->ea_block_quota_inodes)
ea_refcount_fetch(ctx->ea_block_quota_inodes, blk,
&ea_block_quota->inodes);
if (ea_refcount_decrement(ctx->refcount, blk, 0) == 0)
return 1;
if (!ctx->refcount_extra) {
pctx->errcode = ea_refcount_create(0, &ctx->refcount_extra);
if (pctx->errcode) {
pctx->num = 2;
fix_problem(ctx, 0x010038, pctx);
ctx->flags |= 0x0001;
return 0;
}
}
ea_refcount_increment(ctx->refcount_extra, blk, 0);
return 1;
}
pctx->blk = blk;
pctx->errcode = ext2fs_read_ext_attr3(fs, blk, block_buf, pctx->ino);
if (pctx->errcode == (2133571479L)) {
pctx->errcode = 0;
failed_csum = 1;
} else if (pctx->errcode == (2133571489L))
pctx->errcode = 0;
if (pctx->errcode && fix_problem(ctx, 0x010039, pctx)) {
pctx->errcode = 0;
goto clear_extattr;
}
header = (struct ext2_ext_attr_header *)block_buf;
pctx->blk = ext2fs_file_acl_block(fs, inode);
if (((ctx->ext_attr_ver == 1) && (header->h_magic != 0xEA010000)) ||
((ctx->ext_attr_ver == 2) && (header->h_magic != 0xEA020000))) {
if (fix_problem(ctx, 0x01003A, pctx))
goto clear_extattr;
}
if (header->h_blocks != 1) {
if (fix_problem(ctx, 0x01003E, pctx))
goto clear_extattr;
}
if (pctx->errcode && fix_problem(ctx, 0x010039, pctx))
goto clear_extattr;
region = region_create(0, fs->blocksize);
if (!region) {
fix_problem(ctx, 0x01003F, pctx);
ctx->flags |= 0x0001;
return 0;
}
if (region_allocate(region, 0, sizeof(struct ext2_ext_attr_header))) {
if (fix_problem(ctx, 0x010040, pctx))
goto clear_extattr;
}
first = (struct ext2_ext_attr_entry *)(header + 1);
end = block_buf + fs->blocksize;
entry = first;
while ((char *)entry < end && *(__u32 *)entry) {
__u32 hash;
if (region_allocate(region, (char *)entry - (char *)header,
(((entry->e_name_len) + (((unsigned)1 << 2) - 1) +
sizeof(struct ext2_ext_attr_entry)) &
~(((unsigned)1 << 2) - 1)))) {
if (fix_problem(ctx, 0x010040, pctx))
goto clear_extattr;
break;
}
if ((ctx->ext_attr_ver == 1 &&
(entry->e_name_len == 0 || entry->e_name_index != 0)) ||
(ctx->ext_attr_ver == 2 && entry->e_name_index == 0)) {
if (fix_problem(ctx, 0x010041, pctx))
goto clear_extattr;
break;
}
if (entry->e_value_inum == 0) {
if (entry->e_value_offs + entry->e_value_size > fs->blocksize) {
if (fix_problem(ctx, 0x010042, pctx))
goto clear_extattr;
break;
}
if (entry->e_value_size &&
region_allocate(region, entry->e_value_offs,
(((entry->e_value_size) + (((unsigned)1 << 2) - 1)) &
~(((unsigned)1 << 2) - 1)))) {
if (fix_problem(ctx, 0x010040, pctx))
goto clear_extattr;
}
hash = ext2fs_ext_attr_hash_entry(entry, block_buf + entry->e_value_offs);
if (entry->e_hash != hash) {
pctx->num = entry->e_hash;
if (fix_problem(ctx, 0x010054, pctx))
goto clear_extattr;
entry->e_hash = hash;
}
} else {
problem_t problem;
blk64_t entry_quota_blocks;
problem = check_large_ea_inode(ctx, entry, pctx, &entry_quota_blocks);
if (problem && fix_problem(ctx, problem, pctx))
goto clear_extattr;
quota_blocks += entry_quota_blocks;
quota_inodes++;
}
entry =
((struct ext2_ext_attr_entry *)((char *)(entry) +
((((entry)->e_name_len) +
(((unsigned)1 << 2) - 1) +
sizeof(struct ext2_ext_attr_entry)) &
~(((unsigned)1 << 2) - 1))));
}
if (region_allocate(region, (char *)entry - (char *)header, 4)) {
if (fix_problem(ctx, 0x010040, pctx))
goto clear_extattr;
}
region_free(region);
if (failed_csum && fix_problem(ctx, 0x01006C, pctx)) {
pctx->errcode = ext2fs_write_ext_attr3(fs, blk, block_buf, pctx->ino);
if (pctx->errcode)
return 0;
}
if (quota_blocks != ((1U) << (fs)->cluster_ratio_bits)) {
if (!ctx->ea_block_quota_blocks) {
pctx->errcode = ea_refcount_create(0, &ctx->ea_block_quota_blocks);
if (pctx->errcode) {
pctx->num = 3;
goto refcount_fail;
}
}
ea_refcount_store(ctx->ea_block_quota_blocks, blk, quota_blocks);
}
if (quota_inodes) {
if (!ctx->ea_block_quota_inodes) {
pctx->errcode = ea_refcount_create(0, &ctx->ea_block_quota_inodes);
if (pctx->errcode) {
pctx->num = 4;
refcount_fail:
fix_problem(ctx, 0x010038, pctx);
ctx->flags |= 0x0001;
return 0;
}
}
ea_refcount_store(ctx->ea_block_quota_inodes, blk, quota_inodes);
}
ea_block_quota->blocks = quota_blocks;
ea_block_quota->inodes = quota_inodes;
inc_ea_inode_refs(ctx, pctx, first, end);
ea_refcount_store(ctx->refcount, blk, header->h_refcount - 1);
mark_block_used(ctx, blk);
ext2fs_fast_mark_block_bitmap2(ctx->block_ea_map, blk);
return 1;
clear_extattr:
if (region)
region_free(region);
ext2fs_file_acl_block_set(fs, inode, 0);
e2fsck_write_inode(ctx, ino, inode, "check_ext_attr");
return 0;
} | int check_ext_attr(struct_0 *a0, struct_1 *a1, unsigned int a2[3],
unsigned long long a3[2]) {
unsigned int v0;
unsigned int v1;
unsigned int v2;
unsigned int v3;
unsigned long long v4;
char v5;
struct_4 *v6;
void *v7;
void *v8;
struct_2 *v9;
unsigned long long v10;
unsigned long long v11;
void *v12;
unsigned int v13;
unsigned long long v15;
unsigned long long v16;
unsigned long long v17;
v9 = a0->field_0;
v1 = a1->field_8;
v10 = a1->field_18;
v4 = 1 << (v9->field_c0 & 31);
v7 = 0;
v8 = 0;
v0 = 0;
a3[0] = 0;
a3[1] = 0;
v11 = ext2fs_file_acl_block(v9, v10, v10);
if (!v11) {
v15 = 0;
} else {
v15 = ext2fs_has_feature_xattr(v9->field_20);
if (v15 && v11 >= v9->field_20->field_14) {
v15 = ext2fs_blocks_count(v9->field_20);
if (v11 < v15) {
if (!a0->field_1b0) {
a1->field_0 =
e2fsck_allocate_block_bitmap(v9, gettext("ext attr block map"),
0x2, "block_ea_map", &a0->field_1b0);
if (a1->field_0) {
a1->field_50 = 2;
fix_problem(a0, 0x10025, a1);
a0->field_48 = a0->field_48 | 1;
v15 = 0;
}
}
if (!a1->field_0 || a0->field_1b0) {
if (!a0->field_1c8) {
a1->field_0 = ea_refcount_create(0x0, &a0->field_1c8);
if (a1->field_0) {
a1->field_50 = 1;
fix_problem(a0, 0x10038, a1);
a0->field_48 = a0->field_48 | 1;
v15 = 0;
}
}
if (!a1->field_0 || a0->field_1c8) {
v15 = ext2fs_fast_test_block_bitmap2(a0->field_1b0, v11, v11);
if (v15) {
a3[0] = 1 << (v9->field_c0 & 31);
a3[1] = 0;
if (a0->field_1d8) {
ea_refcount_fetch(a0->field_1d8, v11, &v4, v11);
if (v4)
a3[0] = v4;
}
if (a0->field_1e0)
ea_refcount_fetch(a0->field_1e0, v11, &a3[1], v11);
v15 = ea_refcount_decrement(a0->field_1c8, v11, 0x0, v11);
if (!v15) {
v15 = 1;
} else {
if (!a0->field_1d0) {
a1->field_0 = ea_refcount_create(0x0, &a0->field_1d0);
if (a1->field_0) {
a1->field_50 = 2;
fix_problem(a0, 0x10038, a1);
a0->field_48 = a0->field_48 | 1;
v15 = 0;
}
}
if (!a1->field_0 || a0->field_1d0) {
ea_refcount_increment(a0->field_1d0, v11, 0x0, v11);
v15 = 1;
}
}
} else {
a1->field_28 = v11;
a1->field_0 = ext2fs_read_ext_attr3(v9, v11, a2, a1->field_8);
if (a1->field_0 == 2133571479) {
a1->field_0 = 0;
v0 = 1;
} else if (a1->field_0 == 2133571489) {
a1->field_0 = 0;
}
if (a1->field_0) {
v15 = fix_problem(a0, 0x10039, a1);
if (v15)
a1->field_0 = 0;
}
if (!v15 || !a1->field_0) {
a1->field_28 = ext2fs_file_acl_block(v9, v10, v10);
if ((a0->field_358 == 2 || a0->field_358 == 1) &&
(a0->field_358 == 2 || a2[0] != 0xea010000) &&
(a0->field_358 == 1 || a2[0] != 0xea020000) &&
(a2[0] != 0xea020000 || a2[0] != 0xea010000))
v15 = fix_problem(a0, 0x1003a, a1);
if (a2[2] != 1 &&
(a2[0] == 0xea020000 || !v15 || a0->field_358 != 2) &&
(a2[0] == 0xea010000 || !v15 || a0->field_358 != 1))
v15 = fix_problem(a0, 0x1003e, a1);
}
if ((a2[2] != 1 && (!v15 || !a1->field_0) &&
(a2[0] == 0xea020000 || !v15 || a0->field_358 != 2) &&
(a2[0] == 0xea010000 || !v15 || a0->field_358 != 1) &&
!v15 ||
(!v15 && !v15 || !v15 && !a1->field_0 ||
a2[0] == 0xea020000 && !v15 && a2[0] == 0xea010000 ||
a2[0] == 0xea020000 && a2[0] == 0xea010000 &&
!a1->field_0 ||
a2[0] == 0xea020000 && !v15 && a0->field_358 != 1 ||
a2[0] == 0xea020000 && !a1->field_0 && a0->field_358 != 1 ||
!v15 && a2[0] == 0xea010000 && a0->field_358 != 2 ||
a2[0] == 0xea010000 && !a1->field_0 && a0->field_358 != 2 ||
!v15 && a0->field_358 != 2 && a0->field_358 != 1 ||
!a1->field_0 && a0->field_358 != 2 && a0->field_358 != 1) &&
a2[2] == 1) &&
a1->field_0)
v15 = fix_problem(a0, 0x10039, a1);
if (...) {
v8 = region_create(0x0, v9->field_28, a1);
if (!v8) {
fix_problem(a0, 0x1003f, a1);
a0->field_48 = a0->field_48 | 1;
v15 = 0;
} else {
v16 = region_allocate(v8, 0x0, 0x20);
if (v16)
v15 = fix_problem(a0, 0x10040, a1);
}
}
if (...) {
v12 = &a2[2 + 2];
*(&v13) = a2 + v9->field_28;
v6 = v12;
while (true) {
if (v6 < *(&v13) && *(&v6->field_0)) {
v17 = region_allocate(v8, v6 - a2,
v6->field_0 + 19 & 0xfffffffc);
if (v17) {
v15 = fix_problem(a0, 0x10040, a1);
if (v15)
break;
}
}
if (v6 < *(&v13) && a0->field_358 == 2 && !v17 &&
*(&v6->field_0) &&
(!v6->field_1 || a0->field_358 != 1) &&
(a0->field_358 != 1 || v6->field_0) && v6->field_1 ||
v6 < *(&v13) && !v17 && *(&v6->field_0) &&
(!v6->field_1 || a0->field_358 != 1) &&
(a0->field_358 != 1 || v6->field_0) &&
a0->field_358 != 2) {
if (v6->field_4) {
v2 = check_large_ea_inode(a0, v6, a1, &v5);
if (v2) {
v15 = fix_problem(a0, v2, a1);
if (v15)
break;
}
if (!v15) {
v4 = *(&v5) + v4;
v7 += 1;
}
} else if (v6->field_2 + v6->field_8 > v9->field_28) {
v15 = fix_problem(a0, 0x10042, a1);
if (v15)
break;
} else {
if (v6->field_8 &&
region_allocate(v8, v6->field_2,
v6->field_8 + 3 & -0x4)) {
v15 = fix_problem(a0, 0x10040, a1);
if (v15)
break;
}
if (!v15) {
v3 = ext2fs_ext_attr_hash_entry(v6, v6->field_2 + a2,
v6->field_2 + a2);
if (v3 != v6->field_c) {
a1->field_50 = v6->field_c;
v15 = fix_problem(a0, 0x10054, a1);
if (v15)
break;
if (!v15)
v6->field_c = v3;
}
}
}
}
if (v6 < *(&v13) && a0->field_358 == 2 && !v17 &&
*(&v6->field_0) &&
(!v6->field_1 || a0->field_358 != 1) &&
(a0->field_358 != 1 || v6->field_0) && !v6->field_1 ||
a0->field_358 == 1 && v6 < *(&v13) && !v17 &&
v6->field_0 && *(&v6->field_0) && v6->field_1 ||
a0->field_358 == 1 && v6 < *(&v13) && !v17 &&
*(&v6->field_0) && !v6->field_0) {
v15 = fix_problem(a0, 0x10041, a1);
if (v15)
break;
}
if (...) {
v15 = region_allocate(v8, v6 - a2, 0x4);
if (v15) {
v15 = fix_problem(a0, 0x10040, a1);
if (v15)
break;
}
if (!v15) {
region_free(v8);
if (v0) {
v15 = fix_problem(a0, 0x1006c, a1);
if (v15) {
a1->field_0 =
ext2fs_write_ext_attr3(v9, v11, a2, a1->field_8);
if (a1->field_0) {
v15 = 0;
break;
}
}
}
if (!v0 || !a1->field_0 || !v15) {
if (1 << (v9->field_c0 & 31) != v4) {
if (!a0->field_1d8) {
a1->field_0 =
ea_refcount_create(0x0, &a0->field_1d8);
if (a1->field_0)
a1->field_50 = 3;
}
if (!a1->field_0 || a0->field_1d8)
ea_refcount_store(a0->field_1d8, v11, v4, v11);
}
if ((!a1->field_0 || 1 << (v9->field_c0 & 31) == v4 ||
a0->field_1d8) &&
v7) {
if (!a0->field_1e0) {
a1->field_0 =
ea_refcount_create(0x0, &a0->field_1e0);
if (a1->field_0)
a1->field_50 = 4;
}
if (!a1->field_0 || a0->field_1e0)
ea_refcount_store(a0->field_1e0, v11, v7, v11);
}
if ((!a0->field_1d8 || !a0->field_1e0) &&
(!a0->field_1d8 || v7) &&
(!a0->field_1d8 || a1->field_0) &&
(!a0->field_1e0 || a1->field_0) &&
(!a0->field_1e0 ||
1 << (v9->field_c0 & 31) != v4) &&
(a1->field_0 || v7) &&
(a1->field_0 || a1->field_0) &&
(v7 || 1 << (v9->field_c0 & 31) != v4) &&
(1 << (v9->field_c0 & 31) != v4 || a1->field_0)) {
fix_problem(a0, 0x10038, a1);
a0->field_48 = a0->field_48 | 1;
v15 = 0;
break;
} else {
a3[0] = v4;
a3[1] = v7;
inc_ea_inode_refs(a0, a1, v12, *(&v13));
ea_refcount_store(a0->field_1c8, v11, a2[1] - 1, v11);
mark_block_used(a0, v11);
ext2fs_fast_mark_block_bitmap2(a0->field_1b0, v11,
v11);
v15 = 1;
break;
}
}
}
}
if ((v6 < *(&v13) && a0->field_358 == 2 && !v17 &&
*(&v6->field_0) &&
(!v6->field_1 || a0->field_358 != 1) &&
(a0->field_358 != 1 || v6->field_0) && v6->field_1 ||
v6 < *(&v13) && !v17 && *(&v6->field_0) &&
(!v6->field_1 || a0->field_358 != 1) &&
(a0->field_358 != 1 || v6->field_0) &&
a0->field_358 != 2) &&
!v6->field_4 &&
v6->field_2 + v6->field_8 <= v9->field_28 ||
(v6 < *(&v13) && a0->field_358 == 2 && !v17 &&
*(&v6->field_0) &&
(!v6->field_1 || a0->field_358 != 1) &&
(a0->field_358 != 1 || v6->field_0) && v6->field_1 ||
v6 < *(&v13) && !v17 && *(&v6->field_0) &&
(!v6->field_1 || a0->field_358 != 1) &&
(a0->field_358 != 1 || v6->field_0) &&
a0->field_358 != 2) &&
v6->field_4)
v6 = &(&v6->field_0)[v6->field_0 + 19 & 0xfffffffc];
}
}
if (...) {
if (v8)
region_free(v8);
ext2fs_file_acl_block_set(v9, v10, 0x0, v10);
e2fsck_write_inode(a0, v1, v10, "check_ext_attr");
v15 = 0;
}
}
}
}
}
}
if (v11 < v9->field_20->field_14 || !v15 || v11 >= v15) {
mark_inode_bad(a0, v1);
v15 = 0;
}
}
return v15;
} | e2fsprogs-1.46.5 | angr_dream |
static void ext4_fc_flush_extents(e2fsck_t ctx, ino_t ino) {
struct extent_list *extent_list = &ctx->fc_replay_state.fc_extent_list;
if (extent_list->ino == ino || extent_list->ino == 0)
return;
e2fsck_rewrite_extent_tree(ctx, extent_list);
ext2fs_free_mem(&extent_list->extents);
memset(extent_list, 0, sizeof(*extent_list));
} | void ext4_fc_flush_extents(long param_1, ulong param_2)
{
if ((param_2 != *(uint *)(param_1 + 0x3d8)) &&
(*(int *)(param_1 + 0x3d8) != 0)) {
e2fsck_rewrite_extent_tree(param_1, (void *)(param_1 + 0x3b0));
ext2fs_free_mem(param_1 + 0x3b8);
memset((void *)(param_1 + 0x3b0), 0, 0x30);
}
return;
} | e2fsprogs-1.46.5 | ghidra |
void __attribute__((visibility("hidden")))
_tr_stored_block(s, buf, stored_len, last) deflate_state *s;
charf *buf;
ulg stored_len;
int last;
{
{
int len = 3;
if (s->bi_valid > (int)16 - len) {
int val = (int)(0 << 1) + last;
s->bi_buf |= (ush)val << s->bi_valid;
{
{
s->pending_buf[s->pending++] = (Bytef)((uch)((s->bi_buf) & 0xff));
};
{
s->pending_buf[s->pending++] = (Bytef)((uch)((ush)(s->bi_buf) >> 8));
};
};
s->bi_buf = (ush)val >> (16 - s->bi_valid);
s->bi_valid += len - 16;
} else {
s->bi_buf |= (ush)((0 << 1) + last) << s->bi_valid;
s->bi_valid += len;
}
};
bi_windup(s);
{
{
s->pending_buf[s->pending++] = (Bytef)((uch)(((ush)stored_len) & 0xff));
};
{
s->pending_buf[s->pending++] =
(Bytef)((uch)((ush)((ush)stored_len) >> 8));
};
};
{
{
s->pending_buf[s->pending++] = (Bytef)((uch)(((ush)~stored_len) & 0xff));
};
{
s->pending_buf[s->pending++] =
(Bytef)((uch)((ush)((ush)~stored_len) >> 8));
};
};
if (stored_len)
memcpy(s->pending_buf + s->pending, (Bytef *)buf, stored_len);
s->pending += stored_len;
} | void _tr_stored_block(long param_1, void *param_2, size_t param_3, uint param_4)
{
long lVar1;
byte bVar2;
if (*(int *)(param_1 + 0x1734) < 0xe) {
*(ushort *)(param_1 + 0x1730) =
(ushort)((param_4 & 0xffff)
<< ((byte) * (undefined4 *)(param_1 + 0x1734) & 0x1f)) |
*(ushort *)(param_1 + 0x1730);
*(int *)(param_1 + 0x1734) = *(int *)(param_1 + 0x1734) + 3;
} else {
*(ushort *)(param_1 + 0x1730) =
(ushort)((param_4 & 0xffff)
<< ((byte) * (undefined4 *)(param_1 + 0x1734) & 0x1f)) |
*(ushort *)(param_1 + 0x1730);
lVar1 = *(long *)(param_1 + 0x28);
*(long *)(param_1 + 0x28) = lVar1 + 1;
*(char *)(lVar1 + *(long *)(param_1 + 0x10)) =
(char)*(undefined2 *)(param_1 + 0x1730);
lVar1 = *(long *)(param_1 + 0x28);
*(long *)(param_1 + 0x28) = lVar1 + 1;
*(char *)(lVar1 + *(long *)(param_1 + 0x10)) =
(char)((ushort) * (undefined2 *)(param_1 + 0x1730) >> 8);
*(short *)(param_1 + 0x1730) =
(short)((int)(param_4 & 0xffff) >>
(0x10U - (char)*(undefined4 *)(param_1 + 0x1734) & 0x1f));
*(int *)(param_1 + 0x1734) = *(int *)(param_1 + 0x1734) + -0xd;
}
bi_windup();
lVar1 = *(long *)(param_1 + 0x28);
*(long *)(param_1 + 0x28) = lVar1 + 1;
*(byte *)(lVar1 + *(long *)(param_1 + 0x10)) = (byte)param_3;
bVar2 = (byte)(param_3 >> 8);
lVar1 = *(long *)(param_1 + 0x28);
*(long *)(param_1 + 0x28) = lVar1 + 1;
*(byte *)(lVar1 + *(long *)(param_1 + 0x10)) = bVar2;
lVar1 = *(long *)(param_1 + 0x28);
*(long *)(param_1 + 0x28) = lVar1 + 1;
*(byte *)(lVar1 + *(long *)(param_1 + 0x10)) = ~(byte)param_3;
lVar1 = *(long *)(param_1 + 0x28);
*(long *)(param_1 + 0x28) = lVar1 + 1;
*(byte *)(lVar1 + *(long *)(param_1 + 0x10)) = ~bVar2;
if (param_3 != 0) {
memcpy((void *)(*(long *)(param_1 + 0x10) + *(long *)(param_1 + 0x28)),
param_2, param_3);
}
*(size_t *)(param_1 + 0x28) = *(long *)(param_1 + 0x28) + param_3;
return;
} | zlib | ghidra |
static void xdup2(int from, int into) {
if (from != into) {
int status = close(into);
if (status != 0 && (*__errno_location()) != 9) {
int e = (*__errno_location());
do {
if (error_hook)
error_hook();
error(0, e, gettext("Cannot close"));
fatal_exit();
} while (0);
}
status = dup(from);
if (status != into) {
if (status < 0) {
int e = (*__errno_location());
do {
if (error_hook)
error_hook();
error(0, e, gettext("Cannot dup"));
fatal_exit();
} while (0);
}
abort();
}
xclose(from);
}
} | void xdup2(int param_1, int param_2)
{
int iVar1;
int *piVar2;
undefined8 uVar3;
if (param_1 != param_2) {
iVar1 = close(param_2);
if (iVar1 != 0) {
piVar2 = __errno_location();
if (*piVar2 != 9) {
piVar2 = __errno_location();
iVar1 = *piVar2;
if (error_hook != (code *)0x0) {
(*error_hook)();
}
uVar3 = gettext("Cannot close");
error(0, iVar1, uVar3);
fatal_exit();
}
}
iVar1 = dup(param_1);
if (iVar1 != param_2) {
if (iVar1 < 0) {
piVar2 = __errno_location();
iVar1 = *piVar2;
if (error_hook != (code *)0x0) {
(*error_hook)();
}
uVar3 = gettext("Cannot dup");
error(0, iVar1, uVar3);
fatal_exit();
}
abort();
}
xclose(param_1);
}
return;
} | tar | ghidra |
static void addFlagsFromEnvVar(Cell **argList, Char *varName) {
Int32 i, j, k;
Char *envbase, *p;
envbase = getenv(varName);
if (envbase != ((void *)0)) {
p = envbase;
i = 0;
while (((Bool)1)) {
if (p[i] == 0)
break;
p += i;
i = 0;
while (((*__ctype_b_loc())[(int)(((Int32)(p[0])))] &
(unsigned short int)_ISspace))
p++;
while (p[i] != 0 && !((*__ctype_b_loc())[(int)(((Int32)(p[i])))] &
(unsigned short int)_ISspace))
i++;
if (i > 0) {
k = i;
if (k > 1034 - 10)
k = 1034 - 10;
for (j = 0; j < k; j++)
tmpName[j] = p[j];
tmpName[k] = 0;
*argList = snocString((*argList), (tmpName));
}
}
}
} | void addFlagsFromEnvVar(undefined8 *param_1, char *param_2)
{
ushort **ppuVar1;
undefined8 uVar2;
int local_24;
int local_20;
int local_1c;
char *local_18;
local_18 = getenv(param_2);
if (local_18 != (char *)0x0) {
local_24 = 0;
while (local_18[local_24] != '\0') {
local_18 = local_18 + local_24;
local_24 = 0;
while (ppuVar1 = __ctype_b_loc(), ((*ppuVar1)[*local_18] & 0x2000) != 0) {
local_18 = local_18 + 1;
}
while ((local_18[local_24] != '\0' &&
(ppuVar1 = __ctype_b_loc(),
((*ppuVar1)[local_18[local_24]] & 0x2000) == 0))) {
local_24 = local_24 + 1;
}
if (0 < local_24) {
local_1c = local_24;
if (0x400 < local_24) {
local_1c = 0x400;
}
for (local_20 = 0; local_20 < local_1c; local_20 = local_20 + 1) {
tmpName[local_20] = local_18[local_20];
}
tmpName[local_1c] = 0;
uVar2 = snocString(*param_1, tmpName);
*param_1 = uVar2;
}
}
}
return;
} | bzip2 | ghidra |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.