input stringlengths 26 172k | output stringlengths 18 318k | repo_name stringclasses 23 values | decompiler stringclasses 5 values |
|---|---|---|---|
static inline void emit_mandatory_arg_note(void) {
fputs_unlocked(gettext("\nMandatory arguments to long options are mandatory "
"for short options too.\n"),
stdout)
;
} | void emit_mandatory_arg_note() {
unsigned long long v1;
v1 = fputs_unlocked(gettext("\nMandatory arguments to long options are "
"mandatory for short options too.\n"),
stdout);
return;
} | coreutils | angr_sailr |
int cert_verify(gnutls_session_t session, const char *hostname,
const char *purpose) {
int rc;
unsigned int status = 0;
gnutls_datum_t out;
int type;
gnutls_typed_vdata_st data[2];
unsigned elements = 0;
memset(data, 0, sizeof(data));
if (hostname) {
data[elements].type = GNUTLS_DT_DNS_HOSTNAME;
data[elements].data = (void *)hostname;
elements++;
}
if (purpose) {
data[elements].type = GNUTLS_DT_KEY_PURPOSE_OID;
data[elements].data = (void *)purpose;
elements++;
}
rc = gnutls_certificate_verify_peers(session, data, elements, &status);
if (rc == -49) {
log_msg(stdout, "- Peer did not send any certificate.\n");
return 0;
}
if (rc < 0) {
log_msg(stdout, "- Could not verify certificate (err: %s)\n",
gnutls_strerror(rc));
return 0;
}
type = gnutls_certificate_type_get(session);
rc = gnutls_certificate_verification_status_print(status, type, &out, 0);
if (rc < 0) {
log_msg(stdout, "- Could not print verification flags (err: %s)\n",
gnutls_strerror(rc));
return 0;
}
log_msg(stdout, "- Status: %s\n", out.data);
gnutls_free((void *)(out.data)), out.data = ((void *)0);
if (status) {
if (!(status & GNUTLS_CERT_INVALID))
abort();
return 0;
}
return 1;
} | long long cert_verify(unsigned long long a0, unsigned long a1,
unsigned long a2) {
unsigned int v0;
unsigned int v1;
unsigned int v2;
unsigned int v3;
void *v4;
char v5;
char v6;
unsigned long long v8;
v0 = 0;
v1 = 0;
memset(&v5, 0x0, 0x30);
if (a1) {
*(&(&v5)[24 * v1]) = 1;
*(&(&v6)[24 * v1]) = a1;
v1 += 1;
}
if (a2) {
*(&(&v5)[24 * v1]) = 2;
*(&(&v6)[24 * v1]) = a2;
v1 += 1;
}
v2 = gnutls_certificate_verify_peers(a0, &v5, v1, &v0);
if (v2 == -49) {
log_msg();
v8 = 0;
return v8;
} else if (v2 >= 0) {
v3 = gnutls_certificate_type_get(a0);
v2 = gnutls_certificate_verification_status_print(v0, v3, &v4, 0x0);
if (v2 < 0) {
gnutls_strerror(v2);
log_msg();
v8 = 0;
return v8;
}
log_msg();
*(5242960)(*(&v4));
v4 = 0;
if (!v0) {
v8 = 1;
return v8;
} else if (!(v0 & 2)) {
abort();
} else {
v8 = 0;
return v8;
}
} else {
gnutls_strerror(v2);
log_msg();
v8 = 0;
return v8;
}
} | gnutls | angr_sailr |
static _Bool
parse_regextype(const struct parser_table *entry, char **argv, int *arg_ptr) {
const char *type_name;
if (collect_arg(argv, arg_ptr, &type_name)) {
options.regex_options = get_regex_type(type_name);
return parse_noop(entry, argv, arg_ptr);
}
return 0;
} | long parse_regextype(long a1, long a2, int *a3) {
long v4[2];
v4[1] = __readfsqword(0x28u);
if (!(unsigned char)collect_arg(a2, a3, v4))
return 0LL;
HIDWORD(options[11]) = get_regex_type(v4[0]);
return parse_noop();
} | findutils | ida |
static enum found_status found_forced_on(enum dependtry dependtry_forced) {
if (dependtry >= dependtry_forced)
return FOUND_FORCED;
else
return FOUND_DEFER;
} | int found_forced_on(unsigned long a0) {
unsigned int v1;
if (a0 <= dependtry)
v1 = 2;
else
v1 = 1;
return v1;
} | dpkg | angr_phoenix |
void test_flush(compr, comprLen) Byte *compr;
uLong *comprLen;
{
z_stream c_stream;
int err;
uInt len = (uInt)strlen(hello) + 1;
c_stream.zalloc = zalloc;
c_stream.zfree = zfree;
c_stream.opaque = (voidpf)0;
err = deflateInit_((&c_stream), ((-1)), "1.2.13", (int)sizeof(z_stream));
{
if (err != 0) {
fprintf(stderr, "%s error: %d\n", "deflateInit", err);
exit(1);
}
};
c_stream.next_in = (unsigned char *)hello;
c_stream.next_out = compr;
c_stream.avail_in = 3;
c_stream.avail_out = (uInt)*comprLen;
err = deflate(&c_stream, 3);
{
if (err != 0) {
fprintf(stderr, "%s error: %d\n", "deflate", err);
exit(1);
}
};
compr[3]++;
c_stream.avail_in = len - 3;
err = deflate(&c_stream, 4);
if (err != 1) {
{
if (err != 0) {
fprintf(stderr, "%s error: %d\n", "deflate", err);
exit(1);
}
};
}
err = deflateEnd(&c_stream);
{
if (err != 0) {
fprintf(stderr, "%s error: %d\n", "deflateEnd", err);
exit(1);
}
};
*comprLen = c_stream.total_out;
} | void test_flush(struct_0 *a0, unsigned long long *a1) {
unsigned int v0;
unsigned int v1;
unsigned long long v2;
unsigned int v3;
struct_0 *v4;
unsigned int v5;
char v6;
unsigned long v7;
unsigned long v8;
void *v9;
char v10;
unsigned long long *v12;
unsigned long long v13;
v0 = strlen("hello,") + 1;
v7 = zalloc;
v8 = zfree;
v9 = 0;
v1 = deflateInit_(&v2, 0xffffffff, "1.2.13", 0x70);
if (v1) {
fprintf(*(&stderr), "%s error: %d\n", &g_401c01, v1);
exit(0x1);
}
v2 = "hello,";
v4 = a0;
v3 = 3;
v5 = *(a1);
v1 = deflate(&v2, 0x3);
if (v1) {
fprintf(*(&stderr), "%s error: %d\n", &g_401c0d, v1);
exit(0x1);
}
a0->field_3 = a0->field_3 + 1;
v3 = v0 - 3;
v1 = deflate(&v2, 0x4);
if (v1 != 1 && v1) {
fprintf(*(&stderr), "%s error: %d\n", &g_401c0d, v1);
exit(0x1);
}
v1 = deflateEnd(&v2);
if (v1) {
fprintf(*(&stderr), "%s error: %d\n", &g_401c15, v1);
exit(0x1);
}
*(a1) = *(&v6);
v13 = *(&v10) ^ v12[5];
return;
} | zlib | angr_phoenix |
static int handle_is_ok(int i, int type) {
return i >= 0 && (u_int)i < num_handles && handles[i].use == type;
} | _BOOL8 handle_is_ok(unsigned int a1, int a2) {
return (a1 & 0x80000000) == 0 && a1 < num_handles &&
a2 == *(_DWORD *)(handles + 56LL * (int)a1);
} | openssh-portable | ida |
static void check_inode_extra_space(e2fsck_t ctx, struct problem_context *pctx,
struct ea_quota *ea_ibody_quota) {
struct ext2_super_block *sb = ctx->fs->super;
struct ext2_inode_large *inode;
__u32 *eamagic;
int min, max;
ea_ibody_quota->blocks = 0;
ea_ibody_quota->inodes = 0;
inode = (struct ext2_inode_large *)pctx->inode;
if ((((sb)->s_rev_level == 0) ? 128 : (sb)->s_inode_size) == 128) {
return;
}
min = sizeof(inode->i_extra_isize) + sizeof(inode->i_checksum_hi);
max = (((sb)->s_rev_level == 0) ? 128 : (sb)->s_inode_size) - 128;
if (inode->i_extra_isize &&
(inode->i_extra_isize < min || inode->i_extra_isize > max ||
inode->i_extra_isize & 3)) {
if (!fix_problem(ctx, 0x01004F, pctx))
return;
if (inode->i_extra_isize < min || inode->i_extra_isize > max)
inode->i_extra_isize = sb->s_want_extra_isize;
else
inode->i_extra_isize = (inode->i_extra_isize + 3) & ~3;
e2fsck_write_inode_full(
ctx, pctx->ino, pctx->inode,
(((sb)->s_rev_level == 0) ? 128 : (sb)->s_inode_size), "pass1");
}
if (inode->i_extra_isize >= max - sizeof(__u32))
return;
eamagic = (__u32 *)(((char *)inode) + 128 + inode->i_extra_isize);
if (*eamagic == 0xEA020000) {
check_ea_in_inode(ctx, pctx, ea_ibody_quota);
}
if (((sizeof(time_t) <= 4) ||
(((sizeof(time_t) > 4) && ctx->now < 2 * (1LL << 32)))) &&
(check_inode_extra_negative_epoch(inode->i_atime, inode->i_atime_extra) ||
check_inode_extra_negative_epoch(inode->i_ctime, inode->i_ctime_extra) ||
check_inode_extra_negative_epoch(inode->i_crtime,
inode->i_crtime_extra) ||
check_inode_extra_negative_epoch(inode->i_mtime,
inode->i_mtime_extra))) {
if (!fix_problem(ctx, 0x010082, pctx))
return;
if (check_inode_extra_negative_epoch(inode->i_atime, inode->i_atime_extra))
inode->i_atime_extra &= ~((1 << 2) - 1);
if (check_inode_extra_negative_epoch(inode->i_ctime, inode->i_ctime_extra))
inode->i_ctime_extra &= ~((1 << 2) - 1);
if (check_inode_extra_negative_epoch(inode->i_crtime,
inode->i_crtime_extra))
inode->i_crtime_extra &= ~((1 << 2) - 1);
if (check_inode_extra_negative_epoch(inode->i_mtime, inode->i_mtime_extra))
inode->i_mtime_extra &= ~((1 << 2) - 1);
e2fsck_write_inode_full(
ctx, pctx->ino, pctx->inode,
(((sb)->s_rev_level == 0) ? 128 : (sb)->s_inode_size), "pass1");
}
} | void check_inode_extra_space(struct_1 *a0, struct_0 *a1,
unsigned long long a2[2]) {
unsigned int v0;
unsigned int v1;
struct_4 *v2;
struct_3 *v3;
unsigned int *v4;
unsigned long long v6;
unsigned int v7;
unsigned long long v8;
unsigned long long v9;
unsigned long long v10;
unsigned long long v11;
unsigned long long v12;
unsigned long long v14;
unsigned long long v15;
v2 = a0->field_0->field_20;
a2[0] = 0;
a2[1] = 0;
v3 = a1->field_18;
v6 = v2->field_4c;
if (v2->field_4c) {
v7 = v2->field_58;
if (v2->field_58 != 128) {
v0 = 4;
if (!v2->field_4c)
v7 = 0;
else
v7 = v2->field_58 - 128;
v1 = v7;
if (v3->field_80) {
if (v0 <= v3->field_80 && v1 >= v3->field_80 && !(v3->field_80 & 3))
goto LABEL_4012bd;
v8 = fix_problem(a0, 0x1004f, a1);
if (v0 > v3->field_80) {
LABEL_401247:
v3->field_80 = v2->field_15e;
} else {
if (v1 < v3->field_80)
goto LABEL_401247;
v3->field_80 = v3->field_80 + 3 & 0xfffffffc;
}
if (!v2->field_4c)
v9 = 128;
else
v9 = v2->field_58;
e2fsck_write_inode_full(a0, a1->field_8, a1->field_18, v9, "pass1");
}
LABEL_4012bd:
v10 = v3->field_80;
if (v3->field_80 < v1 - 4) {
v4 = &v3->padding_0[v3->field_80 + 128];
if (*(v4) == 0xea020000)
check_ea_in_inode(a0, a1, a2);
v11 = a0->field_348;
if (a0->field_348 <= 8589934591) {
if (!check_inode_extra_negative_epoch(v3->field_8, v3->field_8c) &&
!check_inode_extra_negative_epoch(v3->field_c, v3->field_84) &&
!check_inode_extra_negative_epoch(v3->field_90, v3->field_94))
v12 = check_inode_extra_negative_epoch(v3->field_10, v3->field_88);
if (fix_problem(a0, 0x10082, a1)) {
if (check_inode_extra_negative_epoch(v3->field_8, v3->field_8c))
v3->field_8c = v3->field_8c & -0x4;
if (check_inode_extra_negative_epoch(v3->field_c, v3->field_84))
v3->field_84 = v3->field_84 & -0x4;
if (check_inode_extra_negative_epoch(v3->field_90, v3->field_94))
v3->field_94 = v3->field_94 & -0x4;
if (check_inode_extra_negative_epoch(v3->field_10, v3->field_88))
v3->field_88 = v3->field_88 & -0x4;
if (!v2->field_4c)
v14 = 128;
else
v14 = v2->field_58;
v15 = e2fsck_write_inode_full(a0, a1->field_8, a1->field_18, v14,
"pass1");
}
}
}
}
}
return;
} | e2fsprogs-1.46.5 | angr_phoenix |
void save_bash_argv() {
WORD_LIST *list;
list = list_rest_of_args();
push_args(list);
dispose_words(list);
} | void save_bash_argv() {
unsigned long long v0;
unsigned long long v2;
v0 = list_rest_of_args();
push_args(v0);
v2 = dispose_words(v0);
return;
} | bash | angr_sailr |
static inline _Bool
name_more_files(void) {
return filename_args != FILES_NONE;
} | bool name_more_files() { return filename_args != 0; } | tar | ida |
int main(int argc, char **argv) {
int errors = 0;
_Bool changed = 0;
Prog = Basename(argv[0]);
log_set_progname(Prog);
log_set_logfd(stderr);
(void)setlocale(6, "");
(void)bindtextdomain("shadow", "/usr/share/locale");
(void)textdomain("shadow");
process_root_flag("-R", argc, argv);
openlog("grpck", (0x01), (10 << 3));
process_flags(argc, argv);
open_files();
if (sort_mode) {
gr_sort();
if (is_shadow) {
sgr_sort();
}
changed = 1;
} else {
check_grp_file(&errors, &changed);
if (is_shadow) {
check_sgr_file(&errors, &changed);
}
}
close_files(changed);
if (!read_only) {
nscd_flush_cache("group");
sssd_flush_cache(0x002);
}
if (0 != errors) {
if (changed) {
printf(gettext("%s: the files have been updated\n"), Prog);
} else {
printf(gettext("%s: no changes\n"), Prog);
}
}
return ((0 != errors) ? 2 : 0);
} | int main(unsigned long a0, unsigned long long *a1) {
char v0;
unsigned int v1;
unsigned int v3;
v1 = 0;
v0 = 0;
Prog = Basename(*(a1));
log_set_progname(0x8930ec8348535441);
log_set_logfd(stderr);
setlocale(0x6, &g_40212a);
bindtextdomain("shadow", "/usr/share/locale");
textdomain("shadow");
process_root_flag("-R", a0, a1);
openlog("grpck", 0x1, 0x50);
process_flags(a0, a1);
open_files();
if (sort_mode) {
gr_sort();
if (is_shadow)
sgr_sort();
v0 = 1;
} else {
check_grp_file(&v1, &v0);
if (is_shadow)
check_sgr_file(&v1, &v0);
}
close_files(v0);
if ((read_only ^ 1)) {
nscd_flush_cache("group");
sssd_flush_cache(0x2);
}
if (v1) {
if (v0)
printf(gettext("%s: the files have been updated\n"));
else
printf(gettext("%s: no changes\n"));
}
if (v1)
v3 = 2;
else
v3 = 0;
return v3;
} | shadow | angr_dream |
static struct addrinfo *resolve_host(const char *name, int port, int logerr,
char *cname, size_t clen) {
char strport[32];
struct addrinfo hints, *res;
int gaierr;
LogLevel loglevel = SYSLOG_LEVEL_DEBUG1;
if (port <= 0)
port = default_ssh_port();
if (cname != ((void *)0))
*cname = '\0';
sshlog("ssh.c", __func__, 262, 1, SYSLOG_LEVEL_DEBUG3, ((void *)0),
"lookup %s:%d", name, port);
snprintf(strport, sizeof strport, "%d", port);
memset(&hints, 0, sizeof(hints));
hints.ai_family = options.address_family == -1 ?
0
: options.address_family;
hints.ai_socktype = SOCK_STREAM;
if (cname != ((void *)0))
hints.ai_flags = 0x0002;
if ((gaierr = getaddrinfo(name, strport, &hints, &res)) != 0) {
if (logerr || (gaierr != -2 && gaierr != -5))
loglevel = SYSLOG_LEVEL_ERROR;
sshlog("ssh.c", __func__, 274, 0, loglevel, ((void *)0),
"%s: Could not resolve hostname %.100s: %s", __progname, name,
ssh_gai_strerror(gaierr));
return ((void *)0);
}
if (cname != ((void *)0) && res->ai_canonname != ((void *)0)) {
if (strlcpy(cname, res->ai_canonname, clen) >= clen) {
sshlog("ssh.c", __func__, 280, 1, SYSLOG_LEVEL_ERROR, ((void *)0),
"host \"%s\" cname \"%s\" too long (max %lu)", name,
res->ai_canonname, (u_long)clen);
if (clen > 0)
*cname = '\0';
}
}
return res;
} | int resolve_host(unsigned long long a0, unsigned long a1, unsigned long a2,
char *a3, unsigned long long a4) {
unsigned long v0;
unsigned long v1;
unsigned int v2;
unsigned int v3;
unsigned int v4;
char v5;
unsigned int v6;
unsigned int v7;
unsigned int v8;
char v9;
unsigned int v12;
v2 = a1;
v3 = 5;
if (v2 <= 0)
v2 = default_ssh_port();
if (a3)
*(a3) = 0;
v0 = v2;
sshlog("ssh.c", "resolve_host", 0x106, 0x1, 0x7, 0x0, "lookup %s:%d", a0);
snprintf(&v9, 0x20, "%d", v2);
memset(&v6, 0x0, 0x30);
if (false)
v12 = 0;
v12 = 8278818138817399553;
v7 = v12;
v8 = 1;
if (a3)
v6 = 2;
v4 = getaddrinfo(a0, &v9, &v6, &v5);
if (v4) {
if (a2 || v4 != -2 && v4 != -5)
v3 = 2;
v1 = ssh_gai_strerror(v4);
v0 = a0;
sshlog("ssh.c", "resolve_host", 0x112, 0x0, v3, 0x0,
"%s: Could not resolve hostname %.100s: %s", __progname);
v12 = 0;
} else {
if (a3 && *((*(&v5) + 32))) {
v12 = strlcpy(a3, *((*(&v5) + 32)), a4, *((*(&v5) + 32)));
if (a4 <= v12) {
v1 = a4;
v0 = *((*(&v5) + 32));
sshlog("ssh.c", "resolve_host", 0x118, 0x1, 0x2, 0x0,
"host \"%s\" cname \"%s\" too long (max %lu)", a0);
if (a4)
*(a3) = 0;
}
}
v12 = *(&v5);
}
return v12;
} | openssh-portable | angr_dream |
int rl_insert_close(int count, int invoking_key) {
if (rl_explicit_arg || !rl_blink_matching_paren)
_rl_insert_char(count, invoking_key);
else {
int orig_point, match_point, ready;
struct timeval timer;
fd_set readfds;
_rl_insert_char(1, invoking_key);
(*rl_redisplay_function)();
match_point =
find_matching_open(rl_line_buffer, rl_point - 2, invoking_key);
if (match_point < 0)
return 1;
do {
unsigned int __i;
fd_set *__arr = (&readfds);
for (__i = 0; __i < sizeof(fd_set) / sizeof(__fd_mask); ++__i)
((__arr)->fds_bits)[__i] = 0;
} while (0);
((void)(((&readfds)->fds_bits)[((fileno(rl_instream)) /
(8 * (int)sizeof(__fd_mask)))] |=
((__fd_mask)(1UL << ((fileno(rl_instream)) %
(8 * (int)sizeof(__fd_mask)))))));
do {
(timer).tv_sec = (_paren_blink_usec) / 1000000;
(timer).tv_usec = (_paren_blink_usec) % 1000000;
} while (0);
orig_point = rl_point;
rl_point = match_point;
(*rl_redisplay_function)();
ready = select(1, &readfds, (fd_set *)((void *)0), (fd_set *)((void *)0),
&timer);
rl_point = orig_point;
}
return 0;
} | long rl_insert_close(unsigned int a1, int a2) {
long v3;
int v4;
unsigned int i;
int matching_open;
int v7;
struct timeval timeout;
fd_set readfds;
unsigned long v10;
v10 = __readfsqword(0x28u);
if (!rl_explicit_arg && rl_blink_matching_paren) {
rl_insert_char(1LL, (unsigned int)a2);
rl_redisplay_function();
matching_open = find_matching_open(rl_line_buffer, rl_point - 2, a2);
if (matching_open < 0)
return 1LL;
for (i = 0; i <= 0xF; ++i)
readfds.fds_bits[i] = 0LL;
v3 = 1LL << (fileno(rl_instream) % 64);
v4 = fileno(rl_instream);
readfds.fds_bits[v4 / 64] |= v3;
timeout.tv_sec = paren_blink_usec / 1000000;
timeout.tv_usec = paren_blink_usec % 1000000;
v7 = rl_point;
rl_point = matching_open;
rl_redisplay_function();
select(1, &readfds, 0LL, 0LL, &timeout);
rl_point = v7;
} else {
rl_insert_char(a1, (unsigned int)a2);
}
return 0LL;
} | bash | ida |
static int node__delete(EditLine *el, keymacro_node_t **inptr,
const wchar_t *str) {
keymacro_node_t *ptr;
keymacro_node_t *prev_ptr = ((void *)0);
ptr = *inptr;
if (ptr->ch != *str) {
keymacro_node_t *xm;
for (xm = ptr; xm->sibling != ((void *)0); xm = xm->sibling)
if (xm->sibling->ch == *str)
break;
if (xm->sibling == ((void *)0))
return 0;
prev_ptr = xm;
ptr = xm->sibling;
}
if (*++str == '\0') {
if (prev_ptr == ((void *)0))
*inptr = ptr->sibling;
else
prev_ptr->sibling = ptr->sibling;
ptr->sibling = ((void *)0);
node__put(el, ptr);
return 1;
} else if (ptr->next != ((void *)0) &&
node__delete(el, &ptr->next, str) == 1) {
if (ptr->next != ((void *)0))
return 0;
if (prev_ptr == ((void *)0))
*inptr = ptr->sibling;
else
prev_ptr->sibling = ptr->sibling;
ptr->sibling = ((void *)0);
node__put(el, ptr);
return 1;
} else {
return 0;
}
} | long node__delete(long a1, _QWORD *a2, _DWORD *a3) {
_DWORD *v4;
_DWORD *v5;
_DWORD *i;
v5 = 0LL;
v4 = (_DWORD *)*a2;
if (*(_DWORD *)*a2 != *a3) {
for (i = (_DWORD *)*a2; *((_QWORD *)i + 3) && **((_DWORD **)i + 3) != *a3;
i = (_DWORD *)*((_QWORD *)i + 3))
;
if (!*((_QWORD *)i + 3))
return 0LL;
v5 = i;
v4 = (_DWORD *)*((_QWORD *)i + 3);
}
if (!a3[1]) {
if (v5)
*((_QWORD *)v5 + 3) = *((_QWORD *)v4 + 3);
else
*a2 = *((_QWORD *)v4 + 3);
LABEL_13:
*((_QWORD *)v4 + 3) = 0LL;
node__put(a1, (long)v4);
return 1LL;
}
if (!*((_QWORD *)v4 + 2) ||
(unsigned int)node__delete(a1, (_QWORD *)v4 + 2, a3 + 1) != 1)
return 0LL;
if (!*((_QWORD *)v4 + 2)) {
if (v5)
*((_QWORD *)v5 + 3) = *((_QWORD *)v4 + 3);
else
*a2 = *((_QWORD *)v4 + 3);
goto LABEL_13;
}
return 0LL;
} | libedit | ida |
static rsRetVal doTryResume(wrkrInstanceData_t *pWrkrData) {
int iErr;
struct addrinfo *res = ((void *)0);
struct addrinfo hints;
instanceData *pData;
int bBindRequired = 0;
const char *address;
rsRetVal iRet = RS_RET_OK;
if (pWrkrData->bIsConnected)
goto finalize_it;
;
pData = pWrkrData->pData;
if (pData->protocol == 0) {
memset(&hints, 0, sizeof(hints));
hints.ai_flags = 0x0400;
hints.ai_family = glbl.GetDefPFFamily(runModConf->pConf);
hints.ai_socktype = SOCK_DGRAM;
if ((iErr = (getaddrinfo(pData->target, pData->port, &hints, &res))) != 0) {
LogError(0, RS_RET_SUSPENDED,
"omfwd: could not get addrinfo for hostname '%s':'%s': %s",
pData->target, pData->port, gai_strerror(iErr));
do {
iRet = RS_RET_SUSPENDED;
goto finalize_it;
} while (0);
}
address = pData->target;
if (pData->address) {
struct addrinfo *addr;
hints.ai_family = res->ai_family;
hints.ai_flags |= 0x0001;
iErr = getaddrinfo(pData->address, pData->port, &hints, &addr);
freeaddrinfo(addr);
if (iErr != 0) {
LogError(0, RS_RET_SUSPENDED,
"omfwd: cannot use bind address '%s' for host '%s': %s",
pData->address, pData->target, gai_strerror(iErr));
do {
iRet = RS_RET_SUSPENDED;
goto finalize_it;
} while (0);
}
bBindRequired = 1;
address = pData->address;
}
if (Debug) {
r_dbgprintf("omfwd.c", "%s found, resuming.\n", pData->target);
};
pWrkrData->f_addr = res;
res = ((void *)0);
if (pWrkrData->pSockArray == ((void *)0)) {
if ((iRet = changeToNs(pData)) != RS_RET_OK)
goto finalize_it;
pWrkrData->pSockArray = net.create_udp_socket(
(uchar *)address,
((void *)0), bBindRequired, 0, pData->UDPSendBuf, pData->ipfreebind,
pData->device);
if ((iRet = returnToOriginalNs(pData)) != RS_RET_OK)
goto finalize_it;
}
if (pWrkrData->pSockArray != ((void *)0)) {
pWrkrData->bIsConnected = 1;
}
} else {
if ((iRet = changeToNs(pData)) != RS_RET_OK)
goto finalize_it;
if ((iRet = TCPSendInit((void *)pWrkrData)) != RS_RET_OK)
goto finalize_it;
if ((iRet = returnToOriginalNs(pData)) != RS_RET_OK)
goto finalize_it;
}
finalize_it:
if (Debug) {
r_dbgprintf("omfwd.c", "omfwd: doTryResume %s iRet %d\n",
pWrkrData->pData->target, iRet);
};
if (res != ((void *)0)) {
freeaddrinfo(res);
}
if (iRet != RS_RET_OK) {
returnToOriginalNs(pData);
if (pWrkrData->f_addr != ((void *)0)) {
freeaddrinfo(pWrkrData->f_addr);
pWrkrData->f_addr = ((void *)0);
}
iRet = RS_RET_SUSPENDED;
}
return iRet;
} | int doTryResume(struct_0 *a0, unsigned long long a1, unsigned long long a2) {
unsigned long v0;
unsigned int v1;
unsigned int v2;
unsigned int v3;
void *v4;
char v5;
struct_1 *v6;
unsigned long long v7;
unsigned int v8;
unsigned int v9;
unsigned int v10;
void *v12;
v4 = 0;
v1 = 0;
v2 = 0;
if (!a0->field_28) {
v6 = a0->field_0;
if (!v6->field_78) {
memset(&v8, 0x0, 0x30);
v8 = 0x400;
v9 = *(4216592)(*(runModConf));
v10 = 2;
v3 = getaddrinfo(v6->field_50, v6->field_70, &v8, &v4);
if (v3) {
gai_strerror(v3);
LogError(0x0, 0xfffff829,
"omfwd: could not get addrinfo for hostname '%s':'%s': %s");
v2 = -2007;
} else {
v7 = v6->field_50;
if (v6->field_58) {
v9 = v4[4];
v8 |= 1;
v3 = getaddrinfo(v6->field_58, v6->field_70, &v8, &v5);
freeaddrinfo(*(&v5));
if (v3) {
gai_strerror(v3);
LogError(0x0, 0xfffff829,
"omfwd: cannot use bind address '%s' for host '%s': %s");
v2 = -2007;
} else {
v1 = 1;
v7 = v6->field_58;
}
}
if (!v3 || !v6->field_58) {
if (Debug)
r_dbgprintf("omfwd.c", "%s found, resuming.\n");
v12 = v4;
a0->field_18 = v4;
v4 = 0;
if (!a0->field_20) {
v2 = changeToNs(v6, a1, v12);
if (!v2) {
v0 = v6->field_60;
a0->field_20 =
*(4216848)(v7, 0, v1, 0, v6->field_bc, v6->field_b0);
v2 = returnToOriginalNs(v6);
}
}
if ((a0->field_20 || !v2 && !v2) && a0->field_20)
a0->field_28 = 1;
}
}
} else {
v2 = changeToNs(v6, a1, a2);
if (!v2) {
v2 = TCPSendInit(a0);
if (!v2)
v2 = returnToOriginalNs(v6);
}
}
}
if (Debug)
r_dbgprintf("omfwd.c", "omfwd: doTryResume %s iRet %d\n");
if (v4)
freeaddrinfo(v4);
if (v2) {
returnToOriginalNs(v6);
if (a0->field_18) {
freeaddrinfo(a0->field_18);
a0->field_18 = 0;
}
v2 = -2007;
}
return v2;
} | rsyslog-8.2210.0 | angr_dream |
void attrib_to_stat(const Attrib *a, struct stat *st) {
memset(st, 0, sizeof(*st));
if (a->flags & 0x00000001)
st->st_size = a->size;
if (a->flags & 0x00000002) {
st->st_uid = a->uid;
st->st_gid = a->gid;
}
if (a->flags & 0x00000004)
st->st_mode = a->perm;
if (a->flags & 0x00000008) {
st->st_atim.tv_sec = a->atime;
st->st_mtim.tv_sec = a->mtime;
}
} | long long attrib_to_stat(struct_0 *a0, struct_1 *a1) {
struct_1 *v1;
memset(a1, 0x0, 0x90);
if ((a0->field_0 & 1))
a1->field_30 = a0->field_8;
if ((a0->field_0 & 2)) {
a1->field_1c = a0->field_10;
a1->field_20 = a0->field_14;
}
if ((a0->field_0 & 4))
a1->field_18 = a0->field_18;
v1 = a0->field_0 & 8;
if ((a0->field_0 & 8)) {
a1->field_48 = a0->field_1c;
v1 = a1;
a1->field_58 = a0->field_20;
}
return v1;
} | openssh-portable | angr_dream |
static int ext4_fc_replay(journal_t *journal, struct buffer_head *bh,
enum passtype pass, int off, tid_t expected_tid) {
e2fsck_t ctx = journal->j_fs_dev->k_ctx;
struct e2fsck_fc_replay_state *state = &ctx->fc_replay_state;
int ret = 1;
struct ext4_fc_tl tl;
__u8 *start, *end, *cur, *val;
if (pass == PASS_SCAN) {
state->fc_current_pass = PASS_SCAN;
return ext4_fc_replay_scan(journal, bh, off, expected_tid);
}
if (state->fc_replay_num_tags == 0)
goto replay_done;
if (state->fc_current_pass != pass) {
state->fc_current_pass = pass;
ctx->fs->flags |= 0x200000;
ret = __errcode_to_errno(ext2fs_read_bitmaps(ctx->fs), __func__, 873);
if (ret) {
do {
if ((1) <= (-1)) {
printf(""
"(%s, %d): %s: ",
"journal.c", 875, __FUNCTION__);
printf("Error %d while reading bitmaps\n", ret);
}
} while (0);
return ret;
}
state->fc_super_state = ctx->fs->super->s_state;
ctx->fs->super->s_state |= 0x0002;
ctx->fs->super->s_state |= 0x0020;
ext2fs_mark_super_dirty(ctx->fs);
ext2fs_flush(ctx->fs);
}
start = (__u8 *)bh->b_data;
end = (__u8 *)bh->b_data + journal->j_blocksize - 1;
for (cur = start; cur < end;
cur = cur + ((__u16)(__le16)(tl.fc_len)) + sizeof(tl)) {
memcpy(&tl, cur, sizeof(tl));
val = cur + sizeof(tl);
if (state->fc_replay_num_tags == 0)
goto replay_done;
do {
if ((3) <= (-1)) {
printf(""
"(%s, %d): %s: ",
"journal.c", 900, __FUNCTION__);
printf("Replay phase processing %s tag\n",
tag2str(((__u16)(__le16)(tl.fc_tag))));
}
} while (0);
state->fc_replay_num_tags--;
switch (((__u16)(__le16)(tl.fc_tag))) {
case 0x0003:
case 0x0004:
ret = ext4_fc_handle_link_and_create(ctx, &tl, val);
break;
case 0x0005:
ret = ext4_fc_handle_unlink(ctx, &tl, val);
break;
case 0x0001:
ret = ext4_fc_handle_add_extent(ctx, val);
break;
case 0x0002:
ret = ext4_fc_handle_del_range(ctx, val);
break;
case 0x0006:
ret = ext4_fc_handle_inode(ctx, val);
break;
case 0x0008:
ext4_fc_flush_extents(ctx, 0);
case 0x0007:
case 0x0009:
break;
default:
ret = -125;
break;
}
if (ret < 0)
break;
ret = 1;
}
return ret;
replay_done:
do {
if ((1) <= (-1)) {
printf(""
"(%s, %d): %s: ",
"journal.c", 935, __FUNCTION__);
printf("End of fast commit replay\n");
}
} while (0);
if (state->fc_current_pass != pass)
return 0;
ext2fs_calculate_summary_stats(ctx->fs, 0);
ext2fs_write_block_bitmap(ctx->fs);
ext2fs_write_inode_bitmap(ctx->fs);
ext2fs_mark_super_dirty(ctx->fs);
ext2fs_set_gdt_csum(ctx->fs);
ctx->fs->super->s_state = state->fc_super_state;
ext2fs_flush(ctx->fs);
return 0;
} | long long ext4_fc_replay(struct_0 *a0, unsigned int a1, unsigned long a2,
unsigned long a3, unsigned long a4) {
unsigned int v0;
char v1;
char v2;
void *v3;
struct struct_3 **v4;
struct_2 *v5;
void *v6;
unsigned long v7;
void *v8;
void *v10;
struct_5 *v11;
v4 = a0->field_70->field_0;
v5 = &v4[118];
v0 = 1;
if (!a2) {
v5->field_38 = 0;
v10 = ext4_fc_replay_scan(a0, a1, a3, a4);
} else {
if (v5->field_30) {
if (a2 != v5->field_38) {
v5->field_38 = a2;
*(v4)->field_10 = *(v4)->field_10 | 0x200000;
v0 = __errcode_to_errno(ext2fs_read_bitmaps(*(v4)), "ext4_fc_replay",
0x369);
if (v0) {
v10 = v0;
goto LABEL_402ef9;
} else {
v5->field_44 = *(v4)->field_20->field_3a;
*(v4)->field_20->field_3a = *(v4)->field_20->field_3a | 2;
*(v4)->field_20->field_3a = *(v4)->field_20->field_3a | 32;
ext2fs_mark_super_dirty(*(v4));
ext2fs_flush(*(v4));
}
}
v6 = a1 + 40;
v7 = a0->field_78 - 1 + a1 + 40;
v3 = v6;
while (true) {
if (v3 >= v7) {
LABEL_402e5f:
v10 = v0;
goto LABEL_402ef9;
} else {
memcpy(&v1, v3, 0x4);
v8 = v3 + 4;
if (!v5->field_30)
break;
v5->field_30 = v5->field_30 - 1;
v11 = *(&v1);
switch (*(&v1)) {
case 1:
v0 = ext4_fc_handle_add_extent(v4, v8);
break;
case 2:
v0 = ext4_fc_handle_del_range(v4, v8);
break;
case 3:
case 4:
v0 = ext4_fc_handle_link_and_create(v4, &v1, v8);
break;
case 5:
v0 = ext4_fc_handle_unlink(v4, &v1, v8);
break;
case 6:
v0 = ext4_fc_handle_inode(v4, v8);
break;
case 8:
ext4_fc_flush_extents(v4, 0x0);
case 7:
case 9:
break;
default:
v0 = -125;
break;
}
if (v0 < 0)
goto LABEL_402e5f;
v0 = 1;
v3 += *(&v2) + 4;
}
}
}
if (a2 != v5->field_38) {
v10 = 0;
} else {
ext2fs_calculate_summary_stats(*(v4), 0x0);
ext2fs_write_block_bitmap(*(v4));
ext2fs_write_inode_bitmap(*(v4));
ext2fs_mark_super_dirty(*(v4));
ext2fs_set_gdt_csum(*(v4));
*(v4)->field_20->field_3a = v5->field_44;
ext2fs_flush(*(v4));
v10 = 0;
}
}
LABEL_402ef9:
return v10;
} | e2fsprogs-1.46.5 | angr_phoenix |
static void tls_log_func(int level, const char *str) {
fprintf(stderr, "|<%d>| %s", level, str);
} | void tls_log_func(uint param_1, undefined8 param_2)
{
fprintf(stderr, "|<%d>| %s", (ulong)param_1, param_2);
return;
} | gnutls | ghidra |
static void print_LDBL(long double x) {
char buf[((1 + (((((64) * 1) * 146 + 484) / 485) + 1) + 16 + 1 +
(-100 < ((-4931)) && (4932) < 100 ? 3
: -1000 < ((-4931)) && (4932) < 1000 ? 4
: -10000 < ((-4931)) && (4932) < 10000 ? 5
: -100000 < ((-4931)) && (4932) < 100000 ? 6
: -1000000 < ((-4931)) && (4932) < 1000000
? 7
: (((((sizeof(int) * 8) -
(!((__typeof__(int))0 < (__typeof__(int))-1))) *
146 +
484) /
485) +
(!((__typeof__(int))0 < (__typeof__(int))-1))))) +
1)];
ldtoastr(buf, sizeof buf, FTOASTR_LEFT_JUSTIFY, 0, x);
puts(buf);
} | void print_LDBL(unsigned long a0, unsigned long a1, unsigned long a2,
unsigned long a3, unsigned long a4, unsigned long a5,
unsigned long v4, unsigned long a6) {
unsigned long v0;
unsigned long v1;
char v2;
char v3;
unsigned long long *v5;
unsigned long long v6;
v1 = a6;
v0 = v4;
ldtoastr(&v2, 0x2d, 0x1, 0x0);
puts(&v2);
v6 = *(&v3) ^ v5[5];
return;
} | coreutils | angr_sailr |
static void fail_cancel(void) {
CHILD *ch;
for (ch = family; ch; ch = ch->next) {
ch->count = 0;
ch->tm = 0;
ch->flags &= ~16;
}
} | long fail_cancel() {
long result;
long i;
result = family;
for (i = family; i; i = result) {
*(_DWORD *)(i + 24) = 0;
*(_QWORD *)(i + 16) = 0LL;
*(_DWORD *)i &= ~0x10u;
result = *(_QWORD *)(i + 192);
}
return result;
} | sysvinit | ida |
static int mptcp_addr_modify(int argc, char **argv, int cmd) {
struct {
struct nlmsghdr n;
struct genlmsghdr g;
char buf[(((0) + 4U - 1) & ~(4U - 1)) + (4096)];
} req = {
.n =
{
.nlmsg_type = (genl_family),
.nlmsg_flags = (0x01),
.nlmsg_len =
(((((sizeof(struct genlmsghdr)) + 4U - 1) & ~(4U - 1)) +
(0)) +
((int)(((sizeof(struct nlmsghdr)) + 4U - 1) & ~(4U - 1)))),
},
.g =
{
.cmd = (cmd),
.version = (0x1),
},
};
int ret;
ret = mptcp_parse_opt(argc, argv, &req.n, cmd);
if (ret)
return ret;
if (rtnl_talk(&genl_rth, &req.n, ((void *)0)) < 0)
return -2;
return 0;
} | long mptcp_addr_modify(int a1, const char **a2, int a3) {
unsigned int v4;
long v5[514];
int v6;
unsigned long v7;
v7 = __readfsqword(0x28u);
memset(v5, 0, sizeof(v5));
v6 = 0;
LODWORD(v5[0]) = 20;
WORD2(v5[0]) = genl_family;
HIWORD(v5[0]) = 1;
LOBYTE(v5[2]) = a3;
BYTE1(v5[2]) = 1;
v4 = mptcp_parse_opt(a1, a2, (long)v5, a3);
if (v4)
return v4;
if ((int)rtnl_talk(&genl_rth, v5, 0LL) >= 0)
return 0LL;
return 4294967294LL;
} | iproute2-6.0.0 | ida |
int trap_builtin(list)
WORD_LIST *list;
{
int list_signal_names, display, result, opt;
list_signal_names = display = 0;
result = 0;
reset_internal_getopt();
while ((opt = internal_getopt(list, "lp")) != -1) {
switch (opt) {
case 'l':
list_signal_names++;
break;
case 'p':
display++;
break;
case -99:
builtin_help();
return (258);
default:
builtin_usage();
return (258);
}
}
list = loptend;
opt = 0x02 | 0x01;
if (list_signal_names)
return (sh_chkwrite(display_signal_list((WORD_LIST *)((void *)0), 1)));
else if (display || list == 0) {
initialize_terminating_signals();
get_all_original_signals();
return (sh_chkwrite(display_traps(list, display && posixly_correct)));
} else {
char *first_arg;
int operation, sig, first_signal;
operation = 0;
first_arg = list->word->word;
first_signal = first_arg && *first_arg && all_digits(first_arg) &&
(decode_signal(first_arg, opt) != -1);
if (first_signal)
operation = 1;
else if (posixly_correct == 0 && first_arg && *first_arg &&
(*first_arg != '-' || first_arg[1]) &&
(decode_signal(first_arg, opt) != -1) && list->next == 0)
operation = 1;
else {
list = list->next;
if (list == 0) {
builtin_usage();
return (258);
} else if (*first_arg == '\0')
operation = 2;
else if (first_arg[0] == '-' && !first_arg[1])
operation = 1;
}
if (subshell_environment & 0x80) {
free_trap_strings();
subshell_environment &= ~0x80;
}
while (list) {
sig = decode_signal(list->word->word, opt);
if (sig == -1) {
sh_invalidsig(list->word->word);
result = 1;
} else {
switch (operation) {
case 0:
set_signal(sig, first_arg);
break;
case 1:
restore_default_signal(sig);
switch (sig) {
case 2:
if (interactive)
set_signal_handler(2, sigint_sighandler);
else if (interactive_shell &&
(sourcelevel || running_trap || parse_and_execute_level))
set_signal_handler(2, sigint_sighandler);
else
set_signal_handler(2, termsig_sighandler);
break;
case 3:
set_signal_handler(3, ((__sighandler_t)1));
break;
case 15:
case 21:
case 22:
case 20:
if (interactive)
set_signal_handler(sig, ((__sighandler_t)1));
break;
}
break;
case 2:
ignore_signal(sig);
break;
}
}
list = list->next;
}
}
return (result);
} | long trap_builtin(long a1) {
unsigned int v2;
int v3;
unsigned int v4;
int v6;
long *v7;
int v8;
int v9;
unsigned int v10;
int v11;
int v12;
int v13;
_BYTE *v14;
v9 = 0;
v8 = 0;
v10 = 0;
reset_internal_getopt();
while (1) {
v12 = internal_getopt(a1, &unk_6B6);
if (v12 == -1)
break;
if (v12 == 112) {
++v9;
} else {
if (v12 > 112)
goto LABEL_37;
if (v12 == -99) {
builtin_help();
return 258LL;
}
if (v12 != 108)
goto LABEL_37;
++v8;
}
}
v7 = (long *)loptend;
if (v8) {
v2 = display_signal_list(0LL, 1LL);
return sh_chkwrite(v2);
}
if (!v9 && loptend) {
v11 = 0;
v14 = **(_BYTE ***)(loptend + 8LL);
if (v14 && *v14 && (unsigned int)all_digits(v14) &&
(unsigned int)decode_signal(v14, 3LL) != -1) {
v11 = 1;
} else if (posixly_correct || !v14 || !*v14 || *v14 == 45 && !v14[1] ||
(unsigned int)decode_signal(v14, 3LL) == -1 || *v7) {
v7 = (long *)*v7;
if (!v7) {
LABEL_37:
builtin_usage();
return 258LL;
}
if (*v14) {
if (*v14 == 45 && !v14[1])
v11 = 1;
} else {
v11 = 2;
}
} else {
v11 = 1;
}
if ((subshell_environment & 0x80) != 0) {
free_trap_strings();
v6 = subshell_environment;
LOBYTE(v6) = subshell_environment & 0x7F;
subshell_environment = v6;
}
while (v7) {
v13 = decode_signal(*(_QWORD *)v7[1], 3LL);
if (v13 == -1) {
sh_invalidsig(*(_QWORD *)v7[1]);
v10 = 1;
} else if (v11 == 2) {
ignore_signal((unsigned int)v13);
} else if (v11) {
restore_default_signal((unsigned int)v13);
if (v13 <= 22) {
if (v13 >= 20 || v13 == 15) {
if (interactive)
set_signal_handler((unsigned int)v13, 1LL);
} else if (v13 <= 15) {
if (v13 == 2) {
if (interactive ||
interactive_shell &&
(sourcelevel || running_trap || parse_and_execute_level))
set_signal_handler(2LL, &sigint_sighandler);
else
set_signal_handler(2LL, &termsig_sighandler);
} else if (v13 == 3) {
set_signal_handler(3LL, 1LL);
}
}
}
} else {
set_signal((unsigned int)v13, v14);
}
v7 = (long *)*v7;
}
return v10;
} else {
initialize_terminating_signals();
get_all_original_signals();
v3 = v9 && posixly_correct;
v4 = display_traps((long **)v7, v3);
return sh_chkwrite(v4);
}
} | bash | ida |
static int write_devname(FILE *out, char modname[], char devname[], char type,
unsigned int maj, unsigned int min) {
int ret;
ret = fprintf(out, "%s %s %c%u:%u\n", modname, devname, type, maj, min);
if (ret >= 0)
return 0;
else
return 1;
} | long long write_devname(void *a0, unsigned long a1, unsigned long a2,
unsigned long a3, unsigned long a4, unsigned long a5) {
unsigned int v0;
unsigned long long v2;
v0 = fprintf(a0, "%s %s %c%u:%u\n", a1, a2, a3, a4, a5);
if (v0 >= 0)
v2 = 0;
else
v2 = 1;
return v2;
} | kmod | angr_dream |
2
]) {
fprintf(
stderr,
gettext(
"configuration error - cannot "
"parse %s value: '%d'"),
"ERASECHAR", erasechar);
exit(1);
} | int fprintf(FILE *__stream, char *__format, ...)
{
halt_baddata();
} | shadow | ghidra |
static _Bool
tar_sparse_init(struct tar_sparse_file *file) {
memset(file, 0, sizeof *file);
if (!sparse_select_optab(file))
return 0;
if (file->optab->init)
return file->optab->init(file);
return 1;
} | undefined8 tar_sparse_init(void *param_1)
{
char cVar1;
undefined8 uVar2;
memset(param_1, 0, 0x30);
cVar1 = sparse_select_optab(param_1);
if (cVar1 == '\x01') {
if (**(long **)((long)param_1 + 0x20) == 0) {
uVar2 = 1;
} else {
uVar2 = (***(code ***)((long)param_1 + 0x20))(param_1);
}
} else {
uVar2 = 0;
}
return uVar2;
} | tar | ghidra |
static void reap_all(void) {
while (0 < nprocs)
reap(-1);
} | void reap_all() {
unsigned long long v1;
while (true) {
v1 = nprocs;
if (nprocs <= 0)
break;
reap(0xffffffff);
}
return;
} | coreutils | angr_phoenix |
static _Bool
wc(int fd, char const *file_x, struct fstatus *fstatus, off_t current_pos) {
_Bool ok = 1;
char buf[(16 * 1024) + 1];
size_t bytes_read;
uintmax_t lines, words, chars, bytes, linelength;
_Bool count_bytes, count_chars, count_complicated;
char const *file = file_x ? file_x : gettext("standard input");
lines = words = chars = bytes = linelength = 0;
if ((__ctype_get_mb_cur_max()) > 1) {
count_bytes = print_bytes;
count_chars = print_chars;
} else
{
count_bytes = print_bytes || print_chars;
count_chars = 0;
}
count_complicated = print_words || print_linelength;
if (!count_bytes || count_chars || print_lines || count_complicated)
fdadvise(fd, 0, 0, FADVISE_SEQUENTIAL);
if (count_bytes && !count_chars && !print_lines && !count_complicated) {
_Bool skip_read = 0;
if (0 < fstatus->failed)
fstatus->failed = fstat(fd, &fstatus->st);
if (!fstatus->failed && usable_st_size(&fstatus->st) &&
0 <= fstatus->st.st_size) {
size_t end_pos = fstatus->st.st_size;
if (current_pos < 0)
current_pos = lseek(fd, 0, 1);
if (end_pos % page_size) {
bytes = end_pos < current_pos ? 0 : end_pos - current_pos;
skip_read = 1;
} else {
off_t hi_pos =
end_pos -
end_pos % (((0 < (fstatus->st).st_blksize &&
(fstatus->st).st_blksize <= ((size_t)-1) / 8 + 1)
? (fstatus->st).st_blksize
: 512) +
1);
if (0 <= current_pos && current_pos < hi_pos &&
0 <= lseek(fd, hi_pos, 1))
bytes = hi_pos - current_pos;
}
}
if (!skip_read) {
fdadvise(fd, 0, 0, FADVISE_SEQUENTIAL);
while ((bytes_read = safe_read(fd, buf, (16 * 1024))) > 0) {
if (bytes_read == ((size_t)-1)) {
error(0, (*__errno_location()), "%s",
quotearg_n_style_colon(0, shell_escape_quoting_style, file));
ok = 0;
break;
}
bytes += bytes_read;
}
}
} else if (!count_chars && !count_complicated) {
if (avx2_supported())
wc_lines_p = wc_lines_avx2;
ok = wc_lines_p(file, fd, &lines, &bytes);
}
else if ((__ctype_get_mb_cur_max()) > 1) {
_Bool in_word = 0;
uintmax_t linepos = 0;
mbstate_t state = {
0,
};
_Bool in_shift = 0;
size_t prev = 0;
while ((bytes_read = safe_read(fd, buf + prev, (16 * 1024) - prev)) > 0) {
char const *p;
mbstate_t backup_state;
if (bytes_read == ((size_t)-1)) {
error(0, (*__errno_location()), "%s",
quotearg_n_style_colon(0, shell_escape_quoting_style, file));
ok = 0;
break;
}
bytes += bytes_read;
p = buf;
bytes_read += prev;
do {
wchar_t wide_char;
size_t n;
_Bool wide = 1;
if (!in_shift && is_basic(*p)) {
n = 1;
wide_char = *p;
wide = 0;
} else {
in_shift = 1;
backup_state = state;
n = rpl_mbrtowc(&wide_char, p, bytes_read, &state);
if (n == (size_t)-2) {
state = backup_state;
break;
}
if (n == (size_t)-1) {
p++;
bytes_read--;
continue;
}
if (mbsinit(&state))
in_shift = 0;
if (n == 0) {
wide_char = 0;
n = 1;
}
}
switch (wide_char) {
case '\n':
lines++;
__attribute__((__fallthrough__));
case '\r':
case '\f':
if (linepos > linelength)
linelength = linepos;
linepos = 0;
goto mb_word_separator;
case '\t':
linepos += 8 - (linepos % 8);
goto mb_word_separator;
case ' ':
linepos++;
__attribute__((__fallthrough__));
case '\v':
mb_word_separator:
words += in_word;
in_word = 0;
break;
default:
if (wide && iswprint(wide_char)) {
if (print_linelength) {
int width = wcwidth(wide_char);
if (width > 0)
linepos += width;
}
if (iswspace(wide_char) || iswnbspace(wide_char))
goto mb_word_separator;
in_word = 1;
} else if (!wide && ((*__ctype_b_loc())[(int)((to_uchar(*p)))] &
(unsigned short int)_ISprint)) {
linepos++;
if (((*__ctype_b_loc())[(int)((to_uchar(*p)))] &
(unsigned short int)_ISspace))
goto mb_word_separator;
in_word = 1;
}
break;
}
p += n;
bytes_read -= n;
chars++;
} while (bytes_read > 0);
if (bytes_read > 0) {
if (bytes_read == (16 * 1024)) {
p++;
bytes_read--;
}
memmove(buf, p, bytes_read);
}
prev = bytes_read;
}
if (linepos > linelength)
linelength = linepos;
words += in_word;
}
else {
_Bool in_word = 0;
uintmax_t linepos = 0;
while ((bytes_read = safe_read(fd, buf, (16 * 1024))) > 0) {
char const *p = buf;
if (bytes_read == ((size_t)-1)) {
error(0, (*__errno_location()), "%s",
quotearg_n_style_colon(0, shell_escape_quoting_style, file));
ok = 0;
break;
}
bytes += bytes_read;
do {
switch (*p++) {
case '\n':
lines++;
__attribute__((__fallthrough__));
case '\r':
case '\f':
if (linepos > linelength)
linelength = linepos;
linepos = 0;
goto word_separator;
case '\t':
linepos += 8 - (linepos % 8);
goto word_separator;
case ' ':
linepos++;
__attribute__((__fallthrough__));
case '\v':
word_separator:
words += in_word;
in_word = 0;
break;
default:
if (((*__ctype_b_loc())[(int)((to_uchar(p[-1])))] &
(unsigned short int)_ISprint)) {
linepos++;
if (((*__ctype_b_loc())[(int)((to_uchar(p[-1])))] &
(unsigned short int)_ISspace)
|| isnbspace(to_uchar(p[-1])))
goto word_separator;
in_word = 1;
}
break;
}
} while (--bytes_read);
}
if (linepos > linelength)
linelength = linepos;
words += in_word;
}
if (count_chars < print_chars)
chars = bytes;
write_counts(lines, words, chars, bytes, linelength, file_x);
total_lines += lines;
total_words += words;
total_chars += chars;
total_bytes += bytes;
if (linelength > max_line_length)
max_line_length = linelength;
return ok;
} | int wc() {
unsigned long v0;
int tmp_12;
char v1;
char v2;
char v3;
char v4;
char v5;
char v6;
char v7;
char v8;
char v9;
unsigned int v10;
unsigned int v11;
void *v12;
void *v13;
unsigned long v14;
void *v15;
void *v16;
void *v17;
unsigned long v18;
void *v19;
char *v20;
unsigned long long v21;
void *v22;
char *v23;
char v24;
unsigned long v25;
unsigned int v26;
void *v27;
void *v28;
char v29;
char v30;
unsigned long long v31;
unsigned long v32;
unsigned long v33;
char v35;
char v36;
unsigned long v37;
unsigned long v38;
unsigned long long *v39;
char *v40;
char v41;
struct_0 *v42;
struct_1 *v43;
unsigned long long v46;
unsigned long long v49;
unsigned long long v50;
unsigned long long v51;
unsigned long long v52;
unsigned long long v54;
unsigned long long v55;
unsigned long long v56;
unsigned long long v57;
v33 = v37;
do {
v31 = *(&v31);
} while (&v31 != &v30);
v0 = v38;
v32 = v39[5];
v1 = 1;
if (v40)
v41 = v40;
else
v41 = gettext("standard input");
v24 = v41;
v17 = 0;
v13 = v17;
v16 = v13;
v15 = v16;
v12 = v15;
if (__ctype_get_mb_cur_max() > 1) {
v2 = print_bytes;
v3 = print_chars;
} else {
if (print_bytes || print_chars)
v41 = 1;
else
v41 = 0;
v2 = v41;
v2 &= 1;
v3 = 0;
}
if (print_words || print_linelength)
v41 = 1;
else
v41 = 0;
v9 = v41;
v9 &= 1;
if ((v2 ^ 1) || v3 || print_lines || v9)
fdadvise(v46, 0x0, 0x0, 0x2);
if (!(!v2 || !(v3 ^ 1) || !(print_lines ^ 1) || !(v9 ^ 1))) {
v4 = 0;
if (v42->field_0 > 0)
v42->field_0 = fstat(v46, &v42->padding_4[4]);
if (!v42->field_0 && usable_st_size(&v42->padding_4[4]) &&
v42->field_38 >= 0) {
v25 = v42->field_38;
if ((v0 - 0 >> 63))
v0 = lseek(v46, 0x0, 0x1);
if (!(0 CONCAT v25) / m page_size >> 64) {
if (v42->field_40 <= 0 || v42->field_40 > 0x2000000000000000)
v54 = 513;
else
v54 = v42->field_40 + 1;
*(&v26) = v25 - ((0 CONCAT v25) / m v54 >> 64);
if (!((v0 - 0 >> 63)) && v0 < *(&v26) && lseek(v46, *(&v26), 0x1) >= 0)
v13 = *(&v26) - v0;
} else {
*(&v13) = (v25 < v0 ? v25 - v0 : 0);
v4 = 1;
}
}
if ((v4 ^ 1)) {
fdadvise(v46, 0x0, 0x0, 0x2);
while (true) {
v14 = safe_read(v46, &v29, 0x4000, &v29);
if (!v14)
break;
if (v14 != -1) {
v13 = v14 + v13;
} else {
v55 = quotearg_n_style_colon(0x0, 0x3, *(&v24));
error(0x0, *(__errno_location()), "%s");
v1 = 0;
break;
}
}
}
} else if (!(!(v3 ^ 1) || !(v9 ^ 1))) {
if (avx2_supported())
wc_lines_p = got.wc_lines_avx2;
v1 = wc_lines(v49, 0, 0, 2, v50);
} else if (__ctype_get_mb_cur_max() > 1) {
v5 = 0;
v18 = 0;
v27 = 0;
v6 = 0;
v19 = 0;
while (true) {
v14 = safe_read(v46, &v29 + v19, 0x4000 - v19, &v29 + v19);
if (!v14)
break;
if (v14 != -1) {
v13 = v14 + v13;
v20 = &v29;
v14 += v19;
do {
v7 = 1;
if ((v6 ^ 1) && is_basic(*(v20))) {
v21 = 1;
v10 = *(v20);
v7 = 0;
} else {
v6 = 1;
v28 = v27;
v21 = rpl_mbrtowc(&v10, v20, v14, &v27);
if (v21 == -2) {
v27 = v28;
break;
} else if (v21 != -1) {
if (mbsinit(&v27))
v6 = 0;
if (!v21) {
v10 = 0;
v21 = 1;
}
} else {
v20 += 1;
v14 -= 1;
continue;
}
}
switch (v10) {
case 32:
v18 += 1;
v15 += v5;
v5 = 0;
break;
case 9:
v18 = (v18 & -8) + 8;
case 11:
v15 += v5;
v5 = 0;
break;
case 10:
v12 += 1;
case 12:
case 13:
if (v18 > v17)
v17 = v18;
v18 = 0;
v15 += v5;
v5 = 0;
break;
default:
if (v7 && iswprint(v10)) {
if (print_linelength) {
v11 = wcwidth(v10);
if (v11 > 0)
v18 += v11;
}
if (iswspace(v10) || iswnbspace(v10)) {
v15 += v5;
v5 = 0;
break;
} else {
v5 = 1;
break;
}
}
if (!(v7 ^ 1)) {
break;
} else {
v46 = *(v20);
*(&v41) = *((to_uchar(*(v20)) * 2 + *(__ctype_b_loc())));
*(&v41) = *(&v41) & 0x4000;
if (!*(&v41)) {
break;
} else {
v18 += 1;
v46 = *(v20);
*(&v41) = *((to_uchar(*(v20)) * 2 + *(__ctype_b_loc())));
*(&v41) = *(&v41) & 0x2000;
if (!*(&v41)) {
v5 = 1;
break;
}
}
}
v20 = &v20[v21];
v14 -= v21;
v16 += 1;
}
} while (v14);
switch (v14) {
case 0:
break;
case 16384:
v20 += 1;
v14 -= 1;
memmove(&v29, v20, v14);
default:
memmove(&v29, v20, v14);
}
v19 = v14;
} else {
v52 = quotearg_n_style_colon(0x0, 0x3, *(&v24));
error(0x0, *(__errno_location()), "%s");
v1 = 0;
break;
}
}
if (v18 > v17)
v17 = v18;
v15 += v5;
} else {
v8 = 0;
v22 = 0;
while (true) {
v14 = safe_read(v46, &v29, 0x4000, &v29);
if (!v14)
break;
v23 = &v29;
if (v14 != -1) {
v13 = v14 + v13;
do {
tmp_12 = v23;
v23 += 1;
v41 = *(tmp_12);
v43 = v41 - 9;
switch (v43) {
case 23:
v22 += 1;
break;
case 0:
v22 = (v22 & -8) + 8;
case 2:
v15 += v8;
v8 = 0;
continue;
case 1:
v12 += 1;
case 3:
case 4:
if (v22 > v17)
v17 = v22;
v22 = 0;
break;
default:
*(&v43) = *((to_uchar(v23[1]) * 2 + *(__ctype_b_loc())));
*(&v43) = v43 & 0x4000;
if (!v43) {
continue;
} else {
v22 += 1;
v46 = v23[1];
*(&v43) = *((to_uchar(v23[1]) * 2 + *(__ctype_b_loc())));
*(&v43) = v43 & 0x2000;
if (!v43) {
v46 = v23[1];
if (!isnbspace(to_uchar(v23[1]))) {
v8 = 1;
continue;
}
}
break;
}
}
} while ((v14 -= 1, v14));
} else {
v51 = quotearg_n_style_colon(0x0, 0x3, *(&v24));
error(0x0, *(__errno_location()), "%s");
v1 = 0;
break;
}
}
if (v22 > v17)
v17 = v22;
v15 += v8;
}
if (v3 < print_chars)
v16 = v13;
write_counts(v12, v15, v16, v13, v17, v40);
total_lines = v12 + total_lines;
total_words = v15 + total_words;
total_chars = v16 + total_chars;
total_bytes = v13 + total_bytes;
if (v17 > max_line_length)
max_line_length = v17;
if ((v32 ^ v39[5]))
__stack_chk_fail();
v56 = *(&v35);
v57 = *(&v36);
return;
} | coreutils | angr_sailr |
void trigproc_run_deferred(void) {
jmp_buf ejbuf;
debug(dbg_triggers, "trigproc_run_deferred");
while (!pkg_queue_is_empty(&deferred)) {
struct pkginfo *pkg;
pkg = pkg_queue_pop(&deferred);
if (!pkg)
continue;
if (_setjmp(ejbuf)) {
pop_error_context(ehflag_bombout);
continue;
}
push_error_context_jump(&ejbuf, print_error_perpackage,
pkg_name(pkg, pnaw_nonambig));
ensure_package_clientdata(pkg);
pkg->clientdata->trigprocdeferred = ((void *)0);
trigproc(pkg, TRIGPROC_TRY_DEFERRED);
pop_error_context(ehflag_normaltidy);
}
} | long long trigproc_run_deferred(unsigned long a0, unsigned long a1,
unsigned long long a2) {
struct_0 *v0;
char v1;
debug(0x1000, "trigproc_run_deferred", a2);
while (true) {
do {
if (pkg_queue_is_empty(&deferred))
return 0;
v0 = pkg_queue_pop(&deferred);
} while (!v0);
if (_setjmp(&v1)) {
pop_error_context(0x2);
} else {
push_error_context_jump(&v1, got.print_error_perpackage,
pkg_name(v0, 0x1), got.print_error_perpackage);
ensure_package_clientdata(v0);
v0->field_138->field_18 = 0;
trigproc(v0, 0x0);
pop_error_context(0x1);
}
}
} | dpkg | angr_phoenix |
static int import_dsa_dh(gnutls_dh_params_t dh_params, gnutls_datum_t *params,
gnutls_x509_crt_fmt_t format) {
gnutls_x509_privkey_t pkey;
int ret;
ret = gnutls_x509_privkey_init(&pkey);
if (ret < 0)
return ret;
ret = gnutls_x509_privkey_import(pkey, params, format);
if (ret < 0)
return ret;
ret = gnutls_dh_params_import_dsa(dh_params, pkey);
gnutls_x509_privkey_deinit(pkey);
return ret;
} | int import_dsa_dh(undefined8 param_1, undefined8 param_2, undefined4 param_3)
{
int iVar1;
long in_FS_OFFSET;
undefined8 local_18;
long local_10;
local_10 = *(long *)(in_FS_OFFSET + 0x28);
iVar1 = gnutls_x509_privkey_init(&local_18);
if ((-1 < iVar1) &&
(iVar1 = gnutls_x509_privkey_import(local_18, param_2, param_3),
-1 < iVar1)) {
iVar1 = gnutls_dh_params_import_dsa(param_1, local_18);
gnutls_x509_privkey_deinit(local_18);
}
if (local_10 == *(long *)(in_FS_OFFSET + 0x28)) {
return iVar1;
}
__stack_chk_fail();
} | gnutls | ghidra |
static void conloop(void) {
struct timespec seltime, now;
con *c;
int i;
monotime_ts(&now);
c = ((&tq)->tqh_first);
if (c && (((&c->c_ts)->tv_sec == (&now)->tv_sec)
? ((&c->c_ts)->tv_nsec > (&now)->tv_nsec)
: ((&c->c_ts)->tv_sec > (&now)->tv_sec)))
do {
(&seltime)->tv_sec = (&c->c_ts)->tv_sec - (&now)->tv_sec;
(&seltime)->tv_nsec = (&c->c_ts)->tv_nsec - (&now)->tv_nsec;
if ((&seltime)->tv_nsec < 0) {
(&seltime)->tv_sec--;
(&seltime)->tv_nsec += 1000000000L;
}
} while (0);
else
(&seltime)->tv_sec = (&seltime)->tv_nsec = 0;
while (ppoll(read_wait, maxfd, &seltime, ((void *)0)) == -1) {
if ((*__errno_location()) == 11 || (*__errno_location()) == 4 ||
(*__errno_location()) == 11)
continue;
sshlog("ssh-keyscan.c", __func__, 612, 0, SYSLOG_LEVEL_ERROR, ((void *)0),
"poll error");
}
for (i = 0; i < maxfd; i++) {
if (read_wait[i].revents & (0x010 | 0x008 | 0x020))
confree(i);
else if (read_wait[i].revents & (0x001 | 0x010))
conread(i);
}
c = ((&tq)->tqh_first);
while (c && (((&c->c_ts)->tv_sec == (&now)->tv_sec)
? ((&c->c_ts)->tv_nsec < (&now)->tv_nsec)
: ((&c->c_ts)->tv_sec < (&now)->tv_sec))) {
int s = c->c_fd;
c = ((c)->c_link.tqe_next);
conrecycle(s);
}
} | void conloop(unsigned long a0, unsigned long long a1, unsigned long long a2,
unsigned long long a3) {
char v0;
unsigned int v1;
unsigned int v2;
unsigned long long v3;
unsigned long v4;
unsigned long v5;
char v6;
char v7;
char v8;
unsigned long long v10;
unsigned long long *v11;
unsigned long long v12;
monotime_ts(&v6, a1, a2, a3);
v3 = 172419746632;
if (v3 && (*((v3 + 80)) == *(&v6) || *((v3 + 80)) > *(&v6)) &&
(*((v3 + 80)) != *(&v6) || *((v3 + 88)) > *(&v7))) {
v4 = __subvdi3(*((v3 + 80)), *(&v6), *(&v6));
v5 = __subvdi3(*((v3 + 88)), *(&v7), *(&v7));
if (v5 < 0) {
v4 = __addvdi3(v4, 0xffffffffffffffff, a2, a3);
v5 = __addvdi3(v5, 0x3b9aca00, a2, a3);
}
}
if (!v3 || *((v3 + 80)) == *(&v6) && *((v3 + 88)) <= *(&v7) ||
*((v3 + 80)) <= *(&v6) && *((v3 + 80)) != *(&v6)) {
v5 = 0;
v4 = v5;
}
while (true) {
while (true) {
while (true) {
while (true) {
v10 = ppoll(0x64dc7d8930ec8348, 0x30ec8348e5894855, &v4, 0x0);
if (v10 == -1) {
*(&v10) = *(__errno_location());
if (v10 != 11)
break;
} else {
for (v1 = 0; v1 < 3850979413;
v1 = __addvsi3(v1, 0x1, v1 * 8, 0x0)) {
if ((*((7267821926853935944 + (v1 << 3) + 6)) & 56)) {
confree(v1);
} else if ((*((7267821926853935944 + (v1 << 3) + 6)) & 17)) {
conread(v1);
}
}
v3 = 172419746632;
while (v3) {
if (*((v3 + 80)) == *(&v6)) {
if (*((v3 + 88)) >= *(&v7))
break;
} else {
if (*((v3 + 80)) >= *(&v6))
break;
}
v2 = *((v3 + 4));
v3 = *((v3 + 96));
conrecycle(v2);
}
v12 = *(&v8) ^ v11[5];
return;
}
}
*(&v10) = *(__errno_location());
if (v10 != 4)
break;
}
*(&v10) = *(__errno_location());
if (v10 != 11)
break;
}
sshlog("ssh-keyscan.c", "conloop", 0x264, 0x0, 0x2, 0x0, "poll error",
*(&v0));
}
} | openssh-portable | angr_dream |
static int hexchar(const char *s) {
unsigned char result[2];
int i;
for (i = 0; i < 2; i++) {
if (s[i] >= '0' && s[i] <= '9')
result[i] = (unsigned char)(s[i] - '0');
else if (s[i] >= 'a' && s[i] <= 'f')
result[i] = (unsigned char)(s[i] - 'a') + 10;
else if (s[i] >= 'A' && s[i] <= 'F')
result[i] = (unsigned char)(s[i] - 'A') + 10;
else
return -1;
}
return (result[0] << 4) | result[1];
} | uint hexchar(long param_1)
{
uint uVar1;
long in_FS_OFFSET;
int local_18;
byte local_12[2];
long local_10;
local_10 = *(long *)(in_FS_OFFSET + 0x28);
local_18 = 0;
do {
if (1 < local_18) {
uVar1 = (uint)local_12[1] | (uint)local_12[0] << 4;
LAB_00101ea6:
if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) {
__stack_chk_fail();
}
return uVar1;
}
if ((*(char *)(param_1 + local_18) < '0') ||
('9' < *(char *)(param_1 + local_18))) {
if ((*(char *)(param_1 + local_18) < 'a') ||
('f' < *(char *)(param_1 + local_18))) {
if ((*(char *)(param_1 + local_18) < 'A') ||
('F' < *(char *)(param_1 + local_18))) {
uVar1 = 0xffffffff;
goto LAB_00101ea6;
}
local_12[local_18] = *(char *)(param_1 + local_18) - 0x37;
} else {
local_12[local_18] = *(char *)(param_1 + local_18) + 0xa9;
}
} else {
local_12[local_18] = *(char *)(param_1 + local_18) - 0x30;
}
local_18 = __addvsi3(local_18, 1);
} while (true);
} | openssh-portable | ghidra |
static int pidfile_verify(const struct pidfh *pfh) {
struct stat sb;
if (pfh == ((void *)0) || pfh->pf_fd == -1)
return (22);
if (fstat(pfh->pf_fd, &sb) == -1)
return ((*__errno_location()));
if (sb.st_dev != pfh->pf_dev || sb.st_ino != pfh->pf_ino)
return (22);
return (0);
} | int pidfile_verify(int *param_1)
{
int iVar1;
int *piVar2;
long in_FS_OFFSET;
stat local_a8;
long local_10;
local_10 = *(long *)(in_FS_OFFSET + 0x28);
if ((param_1 == (int *)0x0) || (*param_1 == -1)) {
iVar1 = 0x16;
} else {
iVar1 = fstat(*param_1, &local_a8);
if (iVar1 == -1) {
piVar2 = __errno_location();
iVar1 = *piVar2;
} else if ((local_a8.st_dev == *(__dev_t *)(param_1 + 4)) &&
(local_a8.st_ino == *(__ino_t *)(param_1 + 6))) {
iVar1 = 0;
} else {
iVar1 = 0x16;
}
}
if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) {
__stack_chk_fail();
}
return iVar1;
} | libbsd-0.11.7 | ghidra |
static int updatewindow(strm, end, copy)
z_streamp strm;
const Bytef *end;
unsigned copy;
{
struct inflate_state *state;
unsigned dist;
state = (struct inflate_state *)strm->state;
if (state->window == 0) {
state->window = (unsigned char *)(*((strm)->zalloc))(
(strm)->opaque, (1U << state->wbits), (sizeof(unsigned char)));
if (state->window == 0)
return 1;
}
if (state->wsize == 0) {
state->wsize = 1U << state->wbits;
state->wnext = 0;
state->whave = 0;
}
if (copy >= state->wsize) {
memcpy(state->window, end - state->wsize, state->wsize);
state->wnext = 0;
state->whave = state->wsize;
} else {
dist = state->wsize - state->wnext;
if (dist > copy)
dist = copy;
memcpy(state->window + state->wnext, end - copy, dist);
copy -= dist;
if (copy) {
memcpy(state->window, end - copy, copy);
state->wnext = copy;
state->whave = state->wsize;
} else {
state->wnext += dist;
if (state->wnext == state->wsize)
state->wnext = 0;
if (state->whave < state->wsize)
state->whave += dist;
}
}
return 0;
} | long updatewindow(long a1, long a2, unsigned int a3) {
unsigned int v5;
unsigned int n;
size_t n_4;
n_4 = *(_QWORD *)(a1 + 56);
if (!*(_QWORD *)(n_4 + 72)) {
*(_QWORD *)(n_4 + 72) = (*(long (**)(_QWORD, _QWORD, long))(a1 + 64))(
*(_QWORD *)(a1 + 80), (unsigned int)(1 << *(_DWORD *)(n_4 + 56)), 1LL);
if (!*(_QWORD *)(n_4 + 72))
return 1LL;
}
if (!*(_DWORD *)(n_4 + 60)) {
*(_DWORD *)(n_4 + 60) = 1 << *(_DWORD *)(n_4 + 56);
*(_DWORD *)(n_4 + 68) = 0;
*(_DWORD *)(n_4 + 64) = 0;
}
if (a3 < *(_DWORD *)(n_4 + 60)) {
n = *(_DWORD *)(n_4 + 60) - *(_DWORD *)(n_4 + 68);
if (n > a3)
n = a3;
memcpy((void *)(*(unsigned int *)(n_4 + 68) + *(_QWORD *)(n_4 + 72)),
(const void *)(a2 - a3), n);
v5 = a3 - n;
if (v5) {
memcpy(*(void **)(n_4 + 72), (const void *)(a2 - v5), v5);
*(_DWORD *)(n_4 + 68) = v5;
*(_DWORD *)(n_4 + 64) = *(_DWORD *)(n_4 + 60);
} else {
*(_DWORD *)(n_4 + 68) += n;
if (*(_DWORD *)(n_4 + 68) == *(_DWORD *)(n_4 + 60))
*(_DWORD *)(n_4 + 68) = 0;
if (*(_DWORD *)(n_4 + 64) < *(_DWORD *)(n_4 + 60))
*(_DWORD *)(n_4 + 64) += n;
}
} else {
memcpy(*(void **)(n_4 + 72),
(const void *)(a2 - *(unsigned int *)(n_4 + 60)),
*(unsigned int *)(n_4 + 60));
*(_DWORD *)(n_4 + 68) = 0;
*(_DWORD *)(n_4 + 64) = *(_DWORD *)(n_4 + 60);
}
return 0LL;
} | zlib | ida |
static void usage(void) {
fprintf(stderr, "usage: ssh-agent [-c | -s] [-Dd] [-a bind_address] [-E "
"fingerprint_hash]\n"
" [-P allowed_providers] [-t life]\n"
" ssh-agent [-a bind_address] [-E fingerprint_hash] "
"[-P allowed_providers]\n"
" [-t life] command [arg ...]\n"
" ssh-agent [-c | -s] -k\n");
exit(1);
} | void usage() {
fprintf(stderr,
"usage: ssh-agent [-c | -s] [-Dd] [-a bind_address] [-E "
"fingerprint_hash]\n [-P allowed_providers] [-t "
"life]\n ssh-agent [-a bind_address] [-E fingerprint_hash] [-P "
"allowed_providers]\n [-t life] command [arg ...]\n "
" ssh-agent [-c | -s] -k\n");
exit(0x1);
} | openssh-portable | angr_dream |
int fd_ispipe(fd)
int fd;
{
(*__errno_location()) = 0;
return ((lseek(fd, 0L, 1) < 0) && ((*__errno_location()) == 29));
} | long long fd_ispipe(unsigned long a0) {
unsigned long long v2;
*(__errno_location()) = 0;
if (lseek(a0, 0x0, 0x1) < 0 && *(__errno_location()) == 29) {
v2 = 1;
goto LABEL_400ca7;
}
v2 = 0;
LABEL_400ca7:
return v2;
} | bash | angr_phoenix |
int main(int argc, char **argv) {
int do_reboot = 0;
int do_sync = 1;
int do_wtmp = 1;
int do_nothing = 0;
int do_hard = 0;
int do_ifdown = 0;
int do_hddown = 0;
int do_poweroff = 0;
int c;
char *tm = ((void *)0);
if (argv[0][0] == '-')
argv[0]++;
if ((progname = strrchr(argv[0], '/')) != ((void *)0))
progname++;
else
progname = argv[0];
if (!strcmp(progname, "reboot"))
do_reboot = 1;
if (!strcmp(progname, "poweroff"))
do_poweroff = 1;
while ((c = getopt(argc, argv, ":ihdfnpwt:")) != (-1)) {
switch (c) {
case 'n':
do_sync = 0;
do_wtmp = 0;
break;
case 'w':
do_nothing = 1;
break;
case 'd':
do_wtmp = 0;
break;
case 'f':
do_hard = 1;
break;
case 'i':
do_ifdown = 1;
break;
case 'h':
do_hddown = 1;
break;
case 'p':
do_poweroff = 1;
break;
case 't':
tm = optarg;
break;
default:
usage();
}
}
if (argc != optind)
usage();
if (geteuid() != 0) {
fprintf(stderr, "%s: must be superuser.\n", progname);
exit(1);
}
if (chdir("/")) {
fprintf(stderr, "%s: chdir(/): %m\n", progname);
exit(1);
}
if (!do_hard && !do_nothing) {
c = get_runlevel();
if (c != '0' && c != '6')
do_shutdown(do_reboot ? "-r" : "-h", do_poweroff, tm);
}
if (do_wtmp)
write_wtmp("shutdown", "~~", 0, 1, "~~");
if (do_nothing && !do_hddown && !do_ifdown)
exit(0);
if (do_sync) {
sync();
}
if (do_ifdown)
(void)ifdown();
if (do_hddown)
(void)hddown();
else
(void)hdflush();
if (do_nothing)
exit(0);
if (do_reboot) {
reboot(0x01234567);
} else {
reboot(0x89abcdef);
kill(1, 20);
if (do_poweroff)
reboot(0x4321fedc);
reboot(0xcdef0123);
}
reboot(0);
kill(1, 18);
exit(0);
} | int main(unsigned long a0) {
unsigned int v0;
unsigned int v1;
unsigned int v2;
unsigned int v3;
unsigned int v4;
unsigned int v5;
unsigned int v6;
unsigned int v7;
unsigned int v8;
void *v9;
unsigned long long *v11;
v0 = 0;
v1 = 1;
v2 = 1;
v3 = 0;
v4 = 0;
v5 = 0;
v6 = 0;
v7 = 0;
v9 = 0;
if (*(*(v11)) == 45)
*(v11) = *(v11) + 1;
progname = strrchr(*(v11), 0x2f);
if (true)
progname = 5260204364651662153;
else
progname = *(v11);
if (!strcmp(0x48fffffff9058b48, "reboot"))
v0 = 1;
if (!strcmp(0x48fffffff9058b48, "poweroff"))
v7 = 1;
while (true) {
v8 = getopt(a0, v11, ":ihdfnpwt:");
if (v8 == -1)
break;
switch (v8) {
case 100:
v2 = 0;
break;
case 102:
v4 = 1;
break;
case 104:
v6 = 1;
break;
case 105:
v5 = 1;
break;
case 110:
v1 = 0;
v2 = 0;
break;
case 112:
v7 = 1;
break;
case 116:
v9 = optarg;
break;
case 119:
v3 = 1;
break;
default:
usage();
}
}
if (a0 != optind) {
usage();
} else if (geteuid()) {
fprintf(*(&stderr), "%s: must be superuser.\n", -117077176);
exit(0x1);
} else if (chdir("/")) {
fprintf(*(&stderr), "%s: chdir(/): %m\n", -117077176);
exit(0x1);
} else {
if (!(!v4))
goto LABEL_400628;
if (!(!v3))
goto LABEL_400628;
v8 = get_runlevel();
switch (v8) {
case 48:
case 54:
LABEL_400628:
if (v2)
write_wtmp("shutdown", "~~", 0x0, 0x1, "~~");
if (v3 && !v6 && !v5)
exit(0x0);
if (v1)
sync();
if (v5)
ifdown();
if (!v6)
hdflush();
else
hddown();
if (v3)
exit(0x0);
if (v0) {
reboot(0x1234567);
break;
} else {
reboot(0x89abcdef);
kill(0x1, 0x14);
if (v7)
reboot(0x4321fedc);
reboot(0xcdef0123);
}
reboot(0x0);
kill(0x1, 0x12);
exit(0x0);
default:
do_shutdown((!v0 ? "-r" : "-h"), v7);
}
}
} | sysvinit | angr_sailr |
static inline void fd_writeback_init(int fd) { sync_file_range(fd, 0, 0, 2); } | void fd_writeback_init(unsigned long a0) { sync_file_range(a0, 0x0, 0x0, 0x2); } | dpkg | angr_sailr |
static void send_msg(struct sftp_conn *conn, struct sshbuf *m) {
u_char mlen[4];
struct iovec iov[2];
if (sshbuf_len(m) > (256 * 1024))
sshfatal("sftp-client.c", __func__, 171, 0, SYSLOG_LEVEL_FATAL, ((void *)0),
"Outbound message too long %zu", sshbuf_len(m));
put_u32(mlen, sshbuf_len(m));
iov[0].iov_base = mlen;
iov[0].iov_len = sizeof(mlen);
iov[1].iov_base = (u_char *)sshbuf_ptr(m);
iov[1].iov_len = sshbuf_len(m);
if (atomiciov6(writev, conn->fd_out, iov, 2, sftpio,
conn->limit_kbps > 0 ? &conn->bwlimit_out : ((void *)0)) !=
sshbuf_len(m) + sizeof(mlen))
sshfatal("sftp-client.c", __func__, 183, 0, SYSLOG_LEVEL_FATAL, ((void *)0),
"Couldn't send packet: %s", strerror((*__errno_location())));
sshbuf_reset(m);
} | unsigned long send_msg(long a1, long a2) {
long v2;
unsigned int v3;
long v4;
long v5;
int *v6;
char *v7;
long v9[4];
char v10[4];
unsigned long v11;
v11 = __readfsqword(0x28u);
if ((unsigned long)sshbuf_len(a2) > 0x40000) {
v2 = sshbuf_len(a2);
sshfatal("sftp-client.c", "send_msg", 171LL, 0LL, 1LL, 0LL,
"Outbound message too long %zu", v2);
}
v3 = sshbuf_len(a2);
put_u32(v10, v3);
v9[0] = (long)v10;
v9[1] = 4LL;
v9[2] = sshbuf_ptr(a2);
v9[3] = sshbuf_len(a2);
if (*(_QWORD *)(a1 + 32))
v4 = a1 + 104;
else
v4 = 0LL;
v5 = atomiciov6(&writev, *(unsigned int *)(a1 + 4), v9, 2LL, sftpio, v4);
if (v5 != sshbuf_len(a2) + 4) {
v6 = _errno_location();
v7 = strerror(*v6);
sshfatal("sftp-client.c", "send_msg", 183LL, 0LL, 1LL, 0LL,
"Couldn't send packet: %s", v7);
}
sshbuf_reset(a2);
return __readfsqword(0x28u) ^ v11;
} | openssh-portable | ida |
static char *make_dev_fd_filename(fd)
int fd;
{
char *ret,
intbuf[(((sizeof(int) * 8) - (!((int)0 < (int)-1))) * 302 / 1000 + 1 +
(!((int)0 < (int)-1))) +
1],
*p;
ret = (char *)sh_xmalloc((sizeof("/dev/fd/") + 8), "subst.c", 6447);
strcpy(ret, "/dev/fd/");
p = inttostr(fd, intbuf, sizeof(intbuf));
strcpy(ret + sizeof("/dev/fd/") - 1, p);
add_fifo_list(fd);
return (ret);
} | int make_dev_fd_filename(unsigned long a0) {
char *v0;
char *v1;
char v2;
v0 = sh_xmalloc(0x11, "subst.c", 0x192f);
strcpy(v0, "/dev/fd/");
v1 = inttostr(a0, &v2, 0xc, &v2);
strcpy(v0 + 8, v1);
add_fifo_list(a0);
return v0;
} | bash | angr_dream |
static Channel *client_request_x11(struct ssh *ssh, const char *request_type,
int rchan) {
Channel *c = ((void *)0);
char *originator;
u_int originator_port;
int r, sock;
if (!options.forward_x11) {
sshlog("clientloop.c", __func__, 1551, 0, SYSLOG_LEVEL_ERROR, ((void *)0),
"Warning: ssh server tried X11 forwarding.");
sshlog("clientloop.c", __func__, 1552, 0, SYSLOG_LEVEL_ERROR, ((void *)0),
"Warning: this is probably a break-in attempt by a "
"malicious server.");
return ((void *)0);
}
if (x11_refuse_time != 0 && (u_int)monotime() >= x11_refuse_time) {
sshlog("clientloop.c", __func__, 1557, 0, SYSLOG_LEVEL_VERBOSE, ((void *)0),
"Rejected X11 connection after ForwardX11Timeout "
"expired");
return ((void *)0);
}
if ((r = sshpkt_get_cstring(ssh, &originator, ((void *)0))) != 0 ||
(r = sshpkt_get_u32(ssh, &originator_port)) != 0 ||
(r = sshpkt_get_end(ssh)) != 0)
sshfatal("clientloop.c", __func__, 1564, 1, SYSLOG_LEVEL_FATAL, ssh_err(r),
"parse packet");
sshlog("clientloop.c", __func__, 1567, 0, SYSLOG_LEVEL_DEBUG1, ((void *)0),
"client_request_x11: request from %s %u", originator, originator_port);
free(originator);
sock = x11_connect_display(ssh);
if (sock < 0)
return ((void *)0);
c = channel_new(ssh, "x11", 7, sock, sock, -1, (64 * (32 * 1024)),
(16 * 1024), 0, "x11", 1);
c->force_drain = 1;
return c;
} | long client_request_x11(undefined8 param_1, undefined8 param_2,
undefined4 param_3)
{
uint uVar1;
long lVar2;
undefined8 uVar3;
char **ppcVar4;
long in_FS_OFFSET;
char *pcStack104;
undefined8 uStack96;
undefined auStack88[12];
undefined4 local_4c;
undefined8 local_48;
undefined8 local_40;
uint local_2c;
int local_28;
int local_24;
void *local_20;
long local_18;
long local_10;
ppcVar4 = (char **)auStack88;
local_10 = *(long *)(in_FS_OFFSET + 0x28);
local_18 = 0;
local_4c = param_3;
local_48 = param_2;
local_40 = param_1;
if (_sshlog == 0) {
pcStack104 = "Warning: ssh server tried X11 forwarding.";
sshlog("clientloop.c", "client_request_x11", 0x60f, 0, 2, 0);
pcStack104 =
"Warning: this is probably a break-in attempt by a malicious server.";
sshlog("clientloop.c", "client_request_x11", 0x610, 0, 2, 0);
ppcVar4 = (char **)auStack88;
lVar2 = 0;
goto LAB_0010445d;
}
if (x11_refuse_time != 0) {
uStack96 = 0x1042ad;
uVar1 = monotime();
if (x11_refuse_time <= uVar1) {
pcStack104 = "Rejected X11 connection after ForwardX11Timeout expired";
sshlog("clientloop.c", "client_request_x11", 0x615, 0, 4, 0);
lVar2 = 0;
goto LAB_0010445d;
}
}
uStack96 = 0x104319;
local_28 = sshpkt_get_cstring(local_40, &local_20, 0);
if (local_28 == 0) {
uStack96 = 0x104335;
local_28 = sshpkt_get_u32(local_40, &local_2c);
if (local_28 != 0)
goto LAB_00104353;
uStack96 = 0x10434a;
local_28 = sshpkt_get_end(local_40);
ppcVar4 = (char **)auStack88;
if (local_28 != 0)
goto LAB_00104353;
} else {
LAB_00104353:
uStack96 = 0x10435d;
uVar3 = ssh_err(local_28);
ppcVar4 = &pcStack104;
pcStack104 = "parse packet";
sshfatal("clientloop.c", "client_request_x11", 0x61c, 1, 1, uVar3);
}
*(ulong *)((long)ppcVar4 + -0x10) = (ulong)local_2c;
*(void **)((long)ppcVar4 + -0x18) = local_20;
*(char **)((long)ppcVar4 + -0x20) = "client_request_x11: request from %s %u";
*(undefined8 *)((long)ppcVar4 + -0x28) = 0x1043d7;
sshlog("clientloop.c", "client_request_x11", 0x61f, 0, 5, 0);
*(undefined8 *)((long)ppcVar4 + -8) = 0x1043e7;
free(local_20);
*(undefined8 *)((long)ppcVar4 + -8) = 0x1043f3;
local_24 = x11_connect_display(local_40);
if (local_24 < 0) {
lVar2 = 0;
} else {
*(undefined8 *)((long)ppcVar4 + -0x10) = 1;
*(undefined **)((long)ppcVar4 + -0x18) = &DAT_001099f7;
*(undefined8 *)((long)ppcVar4 + -0x20) = 0;
*(undefined8 *)((long)ppcVar4 + -0x28) = 0x4000;
*(undefined8 *)((long)ppcVar4 + -0x30) = 0x200000;
*(undefined8 *)((long)ppcVar4 + -0x38) = 0x104446;
lVar2 =
channel_new(local_40, &DAT_001099f7, 7, local_24, local_24, 0xffffffff);
*(undefined4 *)(lVar2 + 0x50) = 1;
local_18 = lVar2;
}
LAB_0010445d:
if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) {
*(undefined8 *)((long)ppcVar4 + -8) = 0x104471;
__stack_chk_fail();
}
return lVar2;
} | openssh-portable | ghidra |
int pkcs11_add_provider(char *provider_id, char *pin, struct sshkey ***keyp,
char ***labelsp) {
struct pkcs11_provider *p = ((void *)0);
int nkeys;
nkeys = pkcs11_register_provider(provider_id, pin, keyp, labelsp, &p, (1));
if (nkeys <= 0 && p != ((void *)0)) {
do {
if (((p)->next.tqe_next) != ((void *)0))
(p)->next.tqe_next->next.tqe_prev = (p)->next.tqe_prev;
else
(&pkcs11_providers)->tqh_last = (p)->next.tqe_prev;
*(p)->next.tqe_prev = (p)->next.tqe_next;
;
;
} while (0);
pkcs11_provider_finalize(p);
pkcs11_provider_unref(p);
}
if (nkeys == 0)
sshlog("ssh-pkcs11.c", __func__, 1687, 1, SYSLOG_LEVEL_DEBUG1, ((void *)0),
"provider %s returned no keys", provider_id);
return (nkeys);
} | int pkcs11_add_provider(undefined8 param_1, undefined8 param_2,
undefined8 param_3, undefined8 param_4)
{
int iVar1;
long in_FS_OFFSET;
long local_18;
long local_10;
local_10 = *(long *)(in_FS_OFFSET + 0x28);
local_18 = 0;
iVar1 = pkcs11_register_provider(param_1, param_2, param_3, param_4,
&local_18, 1);
if ((iVar1 < 1) && (local_18 != 0)) {
if (*(long *)(local_18 + 0x90) == 0) {
pkcs11_providers._8_8_ = *(undefined8 *)(local_18 + 0x98);
} else {
*(undefined8 *)(*(long *)(local_18 + 0x90) + 0x98) =
*(undefined8 *)(local_18 + 0x98);
}
**(undefined8 **)(local_18 + 0x98) = *(undefined8 *)(local_18 + 0x90);
pkcs11_provider_finalize(local_18);
pkcs11_provider_unref(local_18);
}
if (iVar1 == 0) {
sshlog("ssh-pkcs11.c", "pkcs11_add_provider", 0x697, 1, 5, 0,
"provider %s returned no keys", param_1);
}
if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) {
__stack_chk_fail();
}
return iVar1;
} | openssh-portable | ghidra |
static void uhash_init(uhash_ctx_t ahc, aes_int_key prf_key) {
int i;
UINT8 buf[(8 * (8 / 4) + 4) * sizeof(UINT64)];
memset(ahc, 0, sizeof(uhash_ctx));
nh_init(&ahc->hash, prf_key);
kdf(buf, prf_key, 2, sizeof(buf));
for (i = 0; i < (8 / 4); i++) {
memcpy(ahc->poly_key_8 + i, buf + 24 * i, 8);
endian_convert((ahc->poly_key_8 + i), (8), (8));
ahc->poly_key_8[i] &= ((UINT64)0x01ffffffu << 32) + 0x01ffffffu;
ahc->poly_accum[i] = 1;
}
kdf(buf, prf_key, 3, sizeof(buf));
for (i = 0; i < (8 / 4); i++)
memcpy(ahc->ip_keys + 4 * i, buf + (8 * i + 4) * sizeof(UINT64),
4 * sizeof(UINT64));
endian_convert((ahc->ip_keys), (sizeof(UINT64)), (sizeof(ahc->ip_keys)));
for (i = 0; i < (8 / 4) * 4; i++)
ahc->ip_keys[i] %= ((UINT64)0x0000000FFFFFFFFBull);
kdf(ahc->ip_trans, prf_key, 4, (8 / 4) * sizeof(UINT32));
endian_convert((ahc->ip_trans), (sizeof(UINT32)), ((8 / 4) * sizeof(UINT32)));
explicit_bzero(buf, sizeof(buf));
} | void uhash_init(unsigned long a0, unsigned long long a1) {
unsigned int v0;
char v1;
char v2;
char v3;
unsigned long long *v5;
unsigned long long v6;
memset(a0, 0x0, 0x4d8);
nh_init(a0, a1);
kdf(&v1, a1, 0x2, 0xa0);
for (v0 = 0; v0 <= 1; v0 = __addvsi3(v0, 0x1)) {
memcpy(v0 * 8 + a0 + 1128, &(&v1)[__mulvsi3(v0, 0x18)], 0x8);
endian_convert(v0 * 8 + a0 + 1128, 0x8, 0x8);
*((a0 + (v0 + 140) * 8 + 8)) =
*((a0 + (v0 + 140) * 8 + 8)) & 144115183814443007;
*((a0 + (v0 + 142) * 8 + 8)) = 1;
}
kdf(&v1, a1, 0x3, 0xa0);
for (v0 = 0; v0 <= 1; v0 = __addvsi3(v0, 0x1)) {
memcpy(v0 * 32 + a0 + 1160, &(&v2)[64 * v0], 0x20);
}
endian_convert(a0 + 1160, 0x8, 0x40);
for (v0 = 0; v0 <= 7; v0 = __addvsi3(v0, 0x1)) {
*((a0 + (v0 + 144) * 8 + 8)) = ...;
}
kdf(a0 + 1224, a1, 0x4, 0x8);
endian_convert(a0 + 1224, 0x4, 0x8);
explicit_bzero(&v1, 0xa0);
v6 = *(&v3) ^ v5[5];
return;
} | openssh-portable | angr_sailr |
int main(int argc, char **argv) {
char buf[8192];
char *name;
char *newpwd;
char *cp;
const char *salt;
int errors = 0;
int line = 0;
Prog = Basename(argv[0]);
log_set_progname(Prog);
log_set_logfd(stderr);
(void)setlocale(6, "");
(void)bindtextdomain("shadow", "/usr/share/locale");
(void)textdomain("shadow");
process_flags(argc, argv);
salt = get_salt();
process_root_flag("-R", argc, argv);
openlog("chpasswd", (0x01), (10 << 3));
check_perms();
{
is_shadow_pwd = spw_file_present();
open_files();
}
while (fgets(buf, (int)sizeof buf, stdin) != (char *)0) {
line++;
cp = strrchr(buf, '\n');
if (((void *)0) != cp) {
*cp = '\0';
} else {
if (feof(stdin) == 0) {
while (fgets(buf, (int)sizeof buf, stdin) != (char *)0) {
cp = strchr(buf, '\n');
if (cp != ((void *)0)) {
break;
}
}
fprintf(stderr, gettext("%s: line %d: line too long\n"), Prog, line);
errors++;
continue;
}
}
name = buf;
cp = strchr(name, ':');
if (((void *)0) != cp) {
*cp = '\0';
cp++;
} else {
fprintf(stderr, gettext("%s: line %d: missing new password\n"), Prog,
line);
errors++;
continue;
}
newpwd = cp;
{
const struct spwd *sp;
struct spwd newsp;
const struct passwd *pw;
struct passwd newpw;
if (salt) {
cp = pw_encrypt(newpwd, salt);
if (((void *)0) == cp) {
fprintf(stderr,
gettext("%s: failed to crypt password with salt '%s': %s\n"),
Prog, salt, strerror((*__errno_location())));
fail_exit(1);
}
}
pw = pw_locate(name);
if (((void *)0) == pw) {
fprintf(stderr, gettext("%s: line %d: user '%s' does not exist\n"),
Prog, line, name);
errors++;
continue;
}
if (is_shadow_pwd) {
sp = spw_locate(name);
if ((((void *)0) == sp) && (strcmp(pw->pw_passwd, "x") == 0)) {
newsp.sp_namp = name;
newsp.sp_min = getdef_num("PASS_MIN_DAYS", -1);
newsp.sp_max = getdef_num("PASS_MAX_DAYS", -1);
newsp.sp_warn = getdef_num("PASS_WARN_AGE", -1);
newsp.sp_inact = -1;
newsp.sp_expire = -1;
newsp.sp_flag = ((unsigned long int)-1);
sp = &newsp;
}
} else {
sp = ((void *)0);
}
if (((void *)0) != sp) {
newsp = *sp;
newsp.sp_pwdp = cp;
newsp.sp_lstchg = (long)gettime() / (24L * 3600L);
if (0 == newsp.sp_lstchg) {
newsp.sp_lstchg = -1;
}
}
if ((((void *)0) == sp) || (strcmp(pw->pw_passwd, "x") != 0)) {
newpw = *pw;
newpw.pw_passwd = cp;
}
if (((void *)0) != sp) {
if (spw_update(&newsp) == 0) {
fprintf(
stderr,
gettext("%s: line %d: failed to prepare the new %s entry '%s'\n"),
Prog, line, spw_dbname(), newsp.sp_namp);
errors++;
continue;
}
}
if ((((void *)0) == sp) || (strcmp(pw->pw_passwd, "x") != 0)) {
if (pw_update(&newpw) == 0) {
fprintf(
stderr,
gettext("%s: line %d: failed to prepare the new %s entry '%s'\n"),
Prog, line, pw_dbname(), newpw.pw_name);
errors++;
continue;
}
}
}
}
if (0 != errors) {
{
fprintf(stderr, gettext("%s: error detected, changes ignored\n"), Prog);
}
fail_exit(1);
}
{
close_files();
}
nscd_flush_cache("passwd");
sssd_flush_cache(0x001);
return (0);
} | undefined8 main(undefined4 param_1, undefined8 *param_2)
{
undefined8 uVar1;
int iVar2;
long lVar3;
int *piVar4;
char *pcVar5;
undefined8 *puVar6;
long lVar7;
undefined8 uVar8;
undefined8 uVar9;
char *pcVar10;
long in_FS_OFFSET;
int local_20f0;
uint local_20ec;
char *local_20e8;
char **local_20e0;
undefined8 local_20b8;
char *local_20b0;
undefined8 local_20a8;
undefined8 local_20a0;
undefined8 local_2098;
undefined8 local_2090;
char *local_2088;
char *local_2080;
char *local_2078;
char *local_2070;
char *local_2068;
char *local_2060;
char *local_2058;
char *local_2050;
char *local_2048;
char local_2038[8200];
long local_30;
local_30 = *(long *)(in_FS_OFFSET + 0x28);
local_20f0 = 0;
local_20ec = 0;
Prog = Basename(*param_2);
log_set_progname(Prog);
log_set_logfd(stderr);
setlocale(6, "");
bindtextdomain("shadow", "/usr/share/locale");
textdomain("shadow");
process_flags(param_1, param_2);
lVar3 = get_salt();
process_root_flag(&DAT_001018be, param_1, param_2);
openlog("chpasswd", 1, 0x50);
check_perms();
is_shadow_pwd = spw_file_present();
open_files();
LAB_00101350:
do {
pcVar10 = fgets(local_2038, 0x2000, stdin);
uVar1 = Prog;
if (pcVar10 == (char *)0x0) {
if (local_20f0 != 0) {
pcVar10 = (char *)gettext("%s: error detected, changes ignored\n");
fprintf(stderr, pcVar10, uVar1);
fail_exit(1);
}
close_files();
nscd_flush_cache("passwd");
sssd_flush_cache(1);
if (local_30 == *(long *)(in_FS_OFFSET + 0x28)) {
return 0;
}
__stack_chk_fail();
}
local_20ec = local_20ec + 1;
pcVar10 = strrchr(local_2038, 10);
if (pcVar10 == (char *)0x0) {
iVar2 = feof(stdin);
if (iVar2 == 0) {
do {
pcVar10 = fgets(local_2038, 0x2000, stdin);
if (pcVar10 == (char *)0x0)
break;
pcVar10 = strchr(local_2038, 10);
} while (pcVar10 == (char *)0x0);
uVar1 = Prog;
pcVar10 = (char *)gettext("%s: line %d: line too long\n");
fprintf(stderr, pcVar10, uVar1, (ulong)local_20ec);
local_20f0 = local_20f0 + 1;
goto LAB_00101350;
}
} else {
*pcVar10 = '\0';
}
local_20e8 = strchr(local_2038, 0x3a);
uVar1 = Prog;
if (local_20e8 == (char *)0x0) {
pcVar10 = (char *)gettext("%s: line %d: missing new password\n");
fprintf(stderr, pcVar10, uVar1, (ulong)local_20ec);
local_20f0 = local_20f0 + 1;
} else {
*local_20e8 = '\0';
local_20e8 = local_20e8 + 1;
if ((lVar3 != 0) && (local_20e8 = (char *)pw_encrypt(local_20e8, lVar3),
local_20e8 == (char *)0x0)) {
piVar4 = __errno_location();
pcVar10 = strerror(*piVar4);
uVar1 = Prog;
pcVar5 = (char *)gettext(
"%s: failed to crypt password with salt \'%s\': %s\n");
fprintf(stderr, pcVar5, uVar1, lVar3, pcVar10);
fail_exit(1);
}
puVar6 = (undefined8 *)pw_locate(local_2038);
uVar1 = Prog;
if (puVar6 == (undefined8 *)0x0) {
pcVar10 = (char *)gettext("%s: line %d: user \'%s\' does not exist\n");
fprintf(stderr, pcVar10, uVar1, (ulong)local_20ec, local_2038);
local_20f0 = local_20f0 + 1;
} else {
if (is_shadow_pwd == '\0') {
local_20e0 = (char **)0x0;
} else {
local_20e0 = (char **)spw_locate(local_2038);
if ((local_20e0 == (char **)0x0) &&
(iVar2 = strcmp((char *)puVar6[1], "x"), iVar2 == 0)) {
local_2088 = local_2038;
iVar2 = getdef_num("PASS_MIN_DAYS", 0xffffffff);
local_2070 = (char *)(long)iVar2;
iVar2 = getdef_num("PASS_MAX_DAYS", 0xffffffff);
local_2068 = (char *)(long)iVar2;
iVar2 = getdef_num("PASS_WARN_AGE", 0xffffffff);
local_2060 = (char *)(long)iVar2;
local_2058 = (char *)0xffffffffffffffff;
local_2050 = (char *)0xffffffffffffffff;
local_2048 = (char *)0xffffffffffffffff;
local_20e0 = &local_2088;
}
}
if (local_20e0 != (char **)0x0) {
local_2088 = *local_20e0;
local_2078 = local_20e0[2];
local_2070 = local_20e0[3];
local_2068 = local_20e0[4];
local_2060 = local_20e0[5];
local_2058 = local_20e0[6];
local_2050 = local_20e0[7];
local_2048 = local_20e0[8];
local_2080 = local_20e8;
lVar7 = gettime();
local_2078 = (char *)(lVar7 / 0x15180);
if (local_2078 == (char *)0x0) {
local_2078 = (char *)0xffffffffffffffff;
}
}
if ((local_20e0 == (char **)0x0) ||
(iVar2 = strcmp((char *)puVar6[1], "x"), iVar2 != 0)) {
local_20b8 = *puVar6;
local_20a8 = puVar6[2];
local_20a0 = puVar6[3];
local_2090 = puVar6[5];
local_2098 = puVar6[4];
local_20b0 = local_20e8;
}
if ((local_20e0 == (char **)0x0) ||
(iVar2 = spw_update(&local_2088), pcVar10 = local_2088,
iVar2 != 0)) {
if (((local_20e0 == (char **)0x0) ||
(iVar2 = strcmp((char *)puVar6[1], "x"), iVar2 != 0)) &&
(iVar2 = pw_update(&local_20b8), uVar1 = local_20b8,
iVar2 == 0)) {
uVar9 = pw_dbname();
uVar8 = Prog;
pcVar10 = (char *)gettext(
"%s: line %d: failed to prepare the new %s entry \'%s\'\n");
fprintf(stderr, pcVar10, uVar8, (ulong)local_20ec, uVar9, uVar1);
local_20f0 = local_20f0 + 1;
}
} else {
uVar8 = spw_dbname();
uVar1 = Prog;
pcVar5 = (char *)gettext(
"%s: line %d: failed to prepare the new %s entry \'%s\'\n");
fprintf(stderr, pcVar5, uVar1, (ulong)local_20ec, uVar8, pcVar10);
local_20f0 = local_20f0 + 1;
}
}
}
} while (true);
} | shadow | ghidra |
int timeval_to_cpu(rt, ut, st)
struct timeval *rt, *ut, *st;
{
struct timeval t1, t2;
register int i;
addtimeval(&t1, ut, st);
t2.tv_sec = rt->tv_sec;
t2.tv_usec = rt->tv_usec;
for (i = 0; i < 6; i++) {
if ((t1.tv_sec > 99999999) || (t2.tv_sec > 99999999))
break;
t1.tv_sec *= 10;
t1.tv_sec += t1.tv_usec / 100000;
t1.tv_usec *= 10;
t1.tv_usec %= 1000000;
t2.tv_sec *= 10;
t2.tv_sec += t2.tv_usec / 100000;
t2.tv_usec *= 10;
t2.tv_usec %= 1000000;
}
for (i = 0; i < 4; i++) {
if (t1.tv_sec < 100000000)
t1.tv_sec *= 10;
else
t2.tv_sec /= 10;
}
return ((t2.tv_sec == 0) ? 0 : t1.tv_sec / t2.tv_sec);
} | long timeval_to_cpu(long *param_1, undefined8 param_2, undefined8 param_3)
{
long lVar1;
int iVar2;
long in_FS_OFFSET;
long local_48;
long local_40;
long local_38;
long local_30;
long local_20;
local_20 = *(long *)(in_FS_OFFSET + 0x28);
addtimeval(&local_48, param_2, param_3);
local_30 = param_1[1];
iVar2 = 0;
for (local_38 = *param_1;
((iVar2 < 6 && (local_48 < 100000000)) && (local_38 < 100000000));
local_38 = lVar1 + local_38 * 10) {
local_48 = local_40 / 100000 + local_48 * 10;
local_40 = (local_40 * 10) % 1000000;
lVar1 = local_30 / 100000;
local_30 = (local_30 * 10) % 1000000;
iVar2 = iVar2 + 1;
}
for (iVar2 = 0; iVar2 < 4; iVar2 = iVar2 + 1) {
if (local_48 < 100000000) {
local_48 = local_48 * 10;
} else {
local_38 = local_38 / 10;
}
}
if (local_38 == 0) {
lVar1 = 0;
} else {
lVar1 = local_48 / local_38;
}
if (local_20 != *(long *)(in_FS_OFFSET + 0x28)) {
__stack_chk_fail();
}
return lVar1;
} | bash | ghidra |
void sh_getopt_restore_istate(state) sh_getopt_state_t *state;
{
sh_optarg = state->gs_optarg;
sh_optind = state->gs_optind;
sh_curopt = state->gs_curopt;
nextchar = state->gs_nextchar;
sh_charindex = state->gs_charindex;
sh_getopt_dispose_istate(state);
} | void sh_getopt_restore_istate(undefined8 *param_1)
{
sh_optarg = *param_1;
sh_optind = *(undefined4 *)(param_1 + 1);
sh_curopt = *(undefined4 *)((long)param_1 + 0xc);
nextchar = param_1[2];
sh_charindex = *(undefined4 *)(param_1 + 3);
sh_getopt_dispose_istate(param_1);
return;
} | bash | ghidra |
static void xfrm_ae_flags_print(__u32 flags, void *arg) {
FILE *fp = (FILE *)arg;
fprintf(fp, " (0x%x) ", flags);
if (!flags)
return;
if (flags & XFRM_AE_CR)
fprintf(fp, " replay update ");
if (flags & XFRM_AE_CE)
fprintf(fp, " timer expired ");
if (flags & XFRM_AE_CU)
fprintf(fp, " policy updated ");
} | int xfrm_ae_flags_print(unsigned int a1, FILE *a2) {
int result;
result = fprintf(a2, " (0x%x) ", a1);
if (a1) {
if ((a1 & 0x10) != 0)
fprintf(a2, " replay update ");
if ((a1 & 0x20) != 0)
fprintf(a2, " timer expired ");
result = a1 & 0x40;
if ((a1 & 0x40) != 0)
return fprintf(a2, " policy updated ");
}
return result;
} | iproute2-6.0.0 | ida |
static _Bool setmax_one(uid_t uid, short max) {
off_t offset;
struct faillog fl;
offset = (off_t)uid * sizeof(fl);
if (offset + sizeof(fl) <= statbuf.st_size) {
int err = fseeko(fail, offset, 0);
((void)sizeof((0 == err) ? 1 : 0), __extension__({
if (0 == err)
;
else
__assert_fail("0 == err", "faillog.c", 318,
__extension__ __PRETTY_FUNCTION__);
}));
if (fread((char *)&fl, sizeof(fl), 1, fail) != 1) {
fprintf(stderr, gettext("%s: Failed to get the entry for UID %lu\n"),
Prog, (unsigned long int)uid);
return 1;
}
} else {
explicit_bzero((&fl), (sizeof(fl)));
}
if (max == fl.fail_max) {
return 0;
}
fl.fail_max = max;
if ((fseeko(fail, offset, 0) == 0) &&
(fwrite((char *)&fl, sizeof(fl), 1, fail) == 1)) {
(void)fflush(fail);
return 0;
}
fprintf(stderr, gettext("%s: Failed to set max for UID %lu\n"), Prog,
(unsigned long int)uid);
return 1;
} | undefined8 setmax_one(uint param_1, short param_2)
{
int iVar1;
long __off;
size_t sVar2;
char *pcVar3;
undefined8 uVar4;
long in_FS_OFFSET;
undefined local_48[2];
short local_46;
long local_20;
local_20 = *(long *)(in_FS_OFFSET + 0x28);
__off = (ulong)param_1 * 0x20;
if (statbuf._48_8_ < __off + 0x20U) {
explicit_bzero(local_48, 0x20);
} else {
iVar1 = fseeko(fail, __off, 0);
if (iVar1 != 0) {
__assert_fail("0 == err", "faillog.c", 0x13e, "setmax_one");
}
sVar2 = fread(local_48, 0x20, 1, fail);
uVar4 = Prog;
if (sVar2 != 1) {
pcVar3 = (char *)gettext("%s: Failed to get the entry for UID %lu\n");
fprintf(stderr, pcVar3, uVar4, (ulong)param_1);
uVar4 = 1;
goto LAB_00100a47;
}
}
if (param_2 == local_46) {
uVar4 = 0;
} else {
local_46 = param_2;
iVar1 = fseeko(fail, __off, 0);
if (iVar1 == 0) {
sVar2 = fwrite(local_48, 0x20, 1, fail);
if (sVar2 == 1) {
fflush(fail);
uVar4 = 0;
goto LAB_00100a47;
}
}
uVar4 = Prog;
pcVar3 = (char *)gettext("%s: Failed to set max for UID %lu\n");
fprintf(stderr, pcVar3, uVar4, (ulong)param_1);
uVar4 = 1;
}
LAB_00100a47:
if (local_20 != *(long *)(in_FS_OFFSET + 0x28)) {
__stack_chk_fail();
}
return uVar4;
} | shadow | ghidra |
static int
ipstats_stat_desc_show_hw_stats_info(struct ipstats_stat_show_attrs *attrs,
const struct ipstats_stat_desc *desc) {
return ipstats_show_hw_s_info(attrs, IFLA_STATS_LINK_OFFLOAD_XSTATS,
IFLA_OFFLOAD_XSTATS_HW_S_INFO);
} | long ipstats_stat_desc_show_hw_stats_info(long a1) {
return ipstats_show_hw_s_info(a1, 4u, 2);
} | iproute2-6.0.0 | ida |
static inline ext2_ino_t *quota_sb_inump(struct ext2_super_block *sb,
enum quota_type qtype) {
switch (qtype) {
case USRQUOTA:
return &sb->s_usr_quota_inum;
case GRPQUOTA:
return &sb->s_grp_quota_inum;
case PRJQUOTA:
return &sb->s_prj_quota_inum;
default:
return ((void *)0);
}
return ((void *)0);
} | long quota_sb_inump(long a1, unsigned int a2) {
if (a2 == 2)
return a1 + 620;
if (a2 > 2)
return 0LL;
if (a2)
return a1 + 580;
return a1 + 576;
} | e2fsprogs-1.46.5 | ida |
static char const *human_fstype(struct statfs const *statfsbuf) {
switch (statfsbuf->f_type) {
case 0x5A3C69F0:
return "aafs";
case 0x61636673:
return "acfs";
case 0xADF5:
return "adfs";
case 0xADFF:
return "affs";
case 0x5346414F:
return "afs";
case 0x09041934:
return "anon-inode FS";
case 0x61756673:
return "aufs";
case 0x0187:
return "autofs";
case 0x13661366:
return "balloon-kvm-fs";
case 0x42465331:
return "befs";
case 0x62646576:
return "bdevfs";
case 0x1BADFACE:
return "bfs";
case 0x6C6F6F70:
return "binderfs";
case 0xCAFE4A11:
return "bpf_fs";
case 0x42494E4D:
return "binfmt_misc";
case 0x9123683E:
return "btrfs";
case 0x73727279:
return "btrfs_test";
case 0x00C36400:
return "ceph";
case 0x0027E0EB:
return "cgroupfs";
case 0x63677270:
return "cgroup2fs";
case 0xFF534D42:
return "cifs";
case 0x73757245:
return "coda";
case 0x012FF7B7:
return "coh";
case 0x62656570:
return "configfs";
case 0x28CD3D45:
return "cramfs";
case 0x453DCD28:
return "cramfs-wend";
case 0x64646178:
return "daxfs";
case 0x64626720:
return "debugfs";
case 0x1373:
return "devfs";
case 0x454D444D:
return "devmem";
case 0x1CD1:
return "devpts";
case 0x444D4142:
return "dma-buf-fs";
case 0xF15F:
return "ecryptfs";
case 0xDE5E81E4:
return "efivarfs";
case 0x00414A53:
return "efs";
case 0xE0F5E1E2:
return "erofs";
case 0x2011BAB0:
return "exfat";
case 0x45584653:
return "exfs";
case 0x5DF5:
return "exofs";
case 0x137D:
return "ext";
case 0xEF53:
return "ext2/ext3";
case 0xEF51:
return "ext2";
case 0xF2F52010:
return "f2fs";
case 0x4006:
return "fat";
case 0x19830326:
return "fhgfs";
case 0x65735546:
return "fuseblk";
case 0x65735543:
return "fusectl";
case 0x0BAD1DEA:
return "futexfs";
case 0x01161970:
return "gfs/gfs2";
case 0x47504653:
return "gpfs";
case 0x4244:
return "hfs";
case 0x482B:
return "hfs+";
case 0x4858:
return "hfsx";
case 0x00C0FFEE:
return "hostfs";
case 0xF995E849:
return "hpfs";
case 0x958458F6:
return "hugetlbfs";
case 0x11307854:
return "inodefs";
case 0x013111A8:
return "ibrix";
case 0x2BAD1DEA:
return "inotifyfs";
case 0x9660:
return "isofs";
case 0x4004:
return "isofs";
case 0x4000:
return "isofs";
case 0x07C0:
return "jffs";
case 0x72B6:
return "jffs2";
case 0x3153464A:
return "jfs";
case 0x6B414653:
return "k-afs";
case 0xC97E8168:
return "logfs";
case 0x0BD00BD0:
return "lustre";
case 0x5346314D:
return "m1fs";
case 0x137F:
return "minix";
case 0x138F:
return "minix (30 char.)";
case 0x2468:
return "minix v2";
case 0x2478:
return "minix v2 (30 char.)";
case 0x4D5A:
return "minix3";
case 0x19800202:
return "mqueue";
case 0x4D44:
return "msdos";
case 0x564C:
return "novell";
case 0x6969:
return "nfs";
case 0x6E667364:
return "nfsd";
case 0x3434:
return "nilfs";
case 0x6E736673:
return "nsfs";
case 0x5346544E:
return "ntfs";
case 0x9FA1:
return "openprom";
case 0x7461636F:
return "ocfs2";
case 0x794C7630:
return "overlayfs";
case 0xAAD7AAEA:
return "panfs";
case 0x50495045:
return "pipefs";
case 0xC7571590:
return "ppc-cmm-fs";
case 0x7C7C6673:
return "prl_fs";
case 0x9FA0:
return "proc";
case 0x6165676C:
return "pstorefs";
case 0x002F:
return "qnx4";
case 0x68191122:
return "qnx6";
case 0x858458F6:
return "ramfs";
case 0x07655821:
return "rdt";
case 0x52654973:
return "reiserfs";
case 0x7275:
return "romfs";
case 0x67596969:
return "rpc_pipefs";
case 0x5DCA2DF5:
return "sdcardfs";
case 0x5345434D:
return "secretmem";
case 0x73636673:
return "securityfs";
case 0xF97CFF8C:
return "selinux";
case 0x43415D53:
return "smackfs";
case 0x517B:
return "smb";
case 0xFE534D42:
return "smb2";
case 0xBEEFDEAD:
return "snfs";
case 0x534F434B:
return "sockfs";
case 0x73717368:
return "squashfs";
case 0x62656572:
return "sysfs";
case 0x012FF7B6:
return "sysv2";
case 0x012FF7B5:
return "sysv4";
case 0x01021994:
return "tmpfs";
case 0x74726163:
return "tracefs";
case 0x24051905:
return "ubifs";
case 0x15013346:
return "udf";
case 0x00011954:
return "ufs";
case 0x54190100:
return "ufs";
case 0x9FA2:
return "usbdevfs";
case 0x01021997:
return "v9fs";
case 0x786F4256:
return "vboxsf";
case 0xBACBACBC:
return "vmhgfs";
case 0xA501FCF5:
return "vxfs";
case 0x565A4653:
return "vzfs";
case 0x53464846:
return "wslfs";
case 0xABBA1974:
return "xenfs";
case 0x012FF7B4:
return "xenix";
case 0x58465342:
return "xfs";
case 0x012FD16D:
return "xia";
case 0x0033:
return "z3fold";
case 0x2FC12FC1:
return "zfs";
case 0x5A4F4653:
return "zonefs";
case 0x58295829:
return "zsmallocfs";
default: {
unsigned long int type = statfsbuf->f_type;
static char buf[sizeof "UNKNOWN (0x%lx)" - 3 + (sizeof type * 8 + 3) / 4];
sprintf(buf, "UNKNOWN (0x%lx)", type);
return buf;
}
}
} | char *human_fstype(long *param_1)
{
long lVar1;
lVar1 = *param_1;
if (lVar1 == 0xff534d42) {
return "cifs";
}
if (lVar1 < 0xff534d43) {
if (lVar1 == 0xfe534d42) {
return "smb2";
}
if (lVar1 < 0xfe534d43) {
if (lVar1 == 0xf995e849) {
return "hpfs";
}
if (lVar1 < 0xf995e84a) {
if (lVar1 == 0xf97cff8c) {
return "selinux";
}
if (lVar1 < 0xf97cff8d) {
if (lVar1 == 0xf2f52010) {
return "f2fs";
}
if (lVar1 < 0xf2f52011) {
if (lVar1 == 0xe0f5e1e2) {
return "erofs";
}
if (lVar1 < 0xe0f5e1e3) {
if (lVar1 == 0xde5e81e4) {
return "efivarfs";
}
if (lVar1 < 0xde5e81e5) {
if (lVar1 == 0xcafe4a11) {
return "bpf_fs";
}
if (lVar1 < 0xcafe4a12) {
if (lVar1 == 0xc97e8168) {
return "logfs";
}
if (lVar1 < 0xc97e8169) {
if (lVar1 == 0xc7571590) {
return "ppc-cmm-fs";
}
if (lVar1 < 0xc7571591) {
if (lVar1 == 0xbeefdead) {
return "snfs";
}
if (lVar1 < 0xbeefdeae) {
if (lVar1 == 0xbacbacbc) {
return "vmhgfs";
}
if (lVar1 < 0xbacbacbd) {
if (lVar1 == 0xabba1974) {
return "xenfs";
}
if (lVar1 < 0xabba1975) {
if (lVar1 == 0xaad7aaea) {
return "panfs";
}
if (lVar1 < 0xaad7aaeb) {
if (lVar1 == 0xa501fcf5) {
return "vxfs";
}
if (lVar1 < 0xa501fcf6) {
if (lVar1 == 0x958458f6) {
return "hugetlbfs";
}
if (lVar1 < 0x958458f7) {
if (lVar1 == 0x9123683e) {
return "btrfs";
}
if (lVar1 < 0x9123683f) {
if (lVar1 == 0x858458f6) {
return "ramfs";
}
if (lVar1 < 0x858458f7) {
if (lVar1 == 0x7c7c6673) {
return "prl_fs";
}
if (lVar1 < 0x7c7c6674) {
if (lVar1 == 0x794c7630) {
return "overlayfs";
}
if (lVar1 < 0x794c7631) {
if (lVar1 == 0x786f4256) {
return "vboxsf";
}
if (lVar1 < 0x786f4257) {
if (lVar1 == 0x74726163) {
return "tracefs";
}
if (lVar1 < 0x74726164) {
if (lVar1 == 0x7461636f) {
return "ocfs2";
}
if (lVar1 < 0x74616370) {
if (lVar1 == 0x73757245) {
return "coda";
}
if (lVar1 < 0x73757246) {
if (lVar1 == 0x73727279) {
return "btrfs_test";
}
if (lVar1 < 0x7372727a) {
if (lVar1 == 0x73717368) {
return "squashfs";
}
if (lVar1 < 0x73717369) {
if (lVar1 == 0x73636673) {
return "securityfs";
}
if (lVar1 < 0x73636674) {
if (lVar1 ==
0x6e736673) {
return "nsfs";
}
if (lVar1 <
0x6e736674) {
if (lVar1 ==
0x6e667364) {
return "nfsd";
}
if (lVar1 <
0x6e667365) {
if (lVar1 ==
0x6c6f6f70) {
return "binderfs";
}
if (lVar1 <
0x6c6f6f71) {
if (lVar1 ==
0x6b414653) {
return "k-afs";
}
if (lVar1 <
0x6b414654) {
if (lVar1 ==
0x68191122) {
return "qnx6";
}
if (lVar1 <
0x68191123) {
if (lVar1 ==
0x67596969) {
return "rpc"
"_pi"
"pef"
"s";
}
if (lVar1 <
0x6759696a) {
if (lVar1 ==
0x65735546) {
return "f"
"u"
"s"
"e"
"b"
"l"
"k";
}
if (lVar1 <
0x65735547) {
if (lVar1 ==
0x65735543) {
return "fusectl";
}
if (lVar1 <
0x65735544) {
if (lVar1 ==
0x64646178) {
return "daxfs";
}
if (lVar1 <
0x64646179) {
if (lVar1 ==
0x64626720) {
return "debugfs";
}
if (lVar1 <
0x64626721) {
if (lVar1 ==
0x63677270) {
return "cgroup2fs";
}
if (lVar1 <
0x63677271) {
if (lVar1 ==
0x62656572) {
return "sysfs";
}
if (lVar1 <
0x62656573) {
if (lVar1 ==
0x62656570) {
return "configfs";
}
if (lVar1 <
0x62656571) {
if (lVar1 ==
0x62646576) {
return "bdevfs";
}
if (lVar1 <
0x62646577) {
if (lVar1 ==
0x61756673) {
return "aufs";
}
if (lVar1 <
0x61756674) {
if (lVar1 ==
0x6165676c) {
return "pstorefs";
}
if (lVar1 <
0x6165676d) {
if (lVar1 ==
0x61636673) {
return "acfs";
}
if (lVar1 <
0x61636674) {
if (lVar1 ==
0x5dca2df5) {
return "sdcardfs";
}
if (lVar1 <
0x5dca2df6) {
if (lVar1 ==
0x5a4f4653) {
return "zonefs";
}
if (lVar1 <
0x5a4f4654) {
if (lVar1 ==
0x5a3c69f0) {
return "aafs";
}
if (lVar1 <
0x5a3c69f1) {
if (lVar1 ==
0x58465342) {
return "xfs";
}
if (lVar1 <
0x58465343) {
if (lVar1 ==
0x58295829) {
return "zsmallocfs";
}
if (lVar1 <
0x5829582a) {
if (lVar1 ==
0x565a4653) {
return "vzfs";
}
if (lVar1 <
0x565a4654) {
if (lVar1 ==
0x54190100) {
return "ufs";
}
if (lVar1 <
0x54190101) {
if (lVar1 ==
0x534f434b) {
return "sockfs";
}
if (lVar1 <
0x534f434c) {
if (lVar1 ==
0x5346544e) {
return "ntfs";
}
if (lVar1 <
0x5346544f) {
if (lVar1 ==
0x53464846) {
return "wslfs";
}
if (lVar1 <
0x53464847) {
if (lVar1 ==
0x5346414f) {
return "afs";
}
if (lVar1 <
0x53464150) {
if (lVar1 ==
0x5346314d) {
return "m1fs";
}
if (lVar1 <
0x5346314e) {
if (lVar1 ==
0x5345434d) {
return "secretmem";
}
if (lVar1 <
0x5345434e) {
if (lVar1 ==
0x52654973) {
return "reiserfs";
}
if (lVar1 <
0x52654974) {
if (lVar1 ==
0x50495045) {
return "pipefs";
}
if (lVar1 <
0x50495046) {
if (lVar1 ==
0x47504653) {
return "gpfs";
}
if (lVar1 <
0x47504654) {
if (lVar1 ==
0x45584653) {
return "exfs";
}
if (lVar1 <
0x45584654) {
if (lVar1 ==
0x454d444d) {
return "devmem";
}
if (lVar1 <
0x454d444e) {
if (lVar1 ==
0x453dcd28) {
return "cramfs-wend";
}
if (lVar1 <
0x453dcd29) {
if (lVar1 ==
0x444d4142) {
return "dma-buf-fs";
}
if (lVar1 <
0x444d4143) {
if (lVar1 ==
0x43415d53) {
return "smackfs";
}
if (lVar1 <
0x43415d54) {
if (lVar1 ==
0x42494e4d) {
return "binfmt_misc";
}
if (lVar1 <
0x42494e4e) {
if (lVar1 ==
0x42465331) {
return "befs";
}
if (lVar1 <
0x42465332) {
if (lVar1 ==
0x3153464a) {
return "jfs";
}
if (lVar1 <
0x3153464b) {
if (lVar1 ==
0x2fc12fc1) {
return "zfs";
}
if (lVar1 <
0x2fc12fc2) {
if (lVar1 ==
0x2bad1dea) {
return "inotifyfs";
}
if (lVar1 <
0x2bad1deb) {
if (lVar1 ==
0x28cd3d45) {
return "cramfs";
}
if (lVar1 <
0x28cd3d46) {
if (lVar1 ==
0x24051905) {
return "ubifs";
}
if (lVar1 <
0x24051906) {
if (lVar1 ==
0x2011bab0) {
return "exfat";
}
if (lVar1 <
0x2011bab1) {
if (lVar1 ==
0x1badface) {
return "bfs";
}
if (lVar1 <
0x1badfacf) {
if (lVar1 ==
0x19830326) {
return "fhgfs";
}
if (lVar1 <
0x19830327) {
if (lVar1 ==
0x19800202) {
return "mqueue";
}
if (lVar1 <
0x19800203) {
if (lVar1 ==
0x15013346) {
return "udf";
}
if (lVar1 <
0x15013347) {
if (lVar1 ==
0x13661366) {
return "balloon-kvm-fs";
}
if (lVar1 <
0x13661367) {
if (lVar1 ==
0x11307854) {
return "inodefs";
}
if (lVar1 <
0x11307855) {
if (lVar1 ==
0xbd00bd0) {
return "lustre";
}
if (lVar1 <
0xbd00bd1) {
if (lVar1 ==
0xbad1dea) {
return "futexfs";
}
if (lVar1 <
0xbad1deb) {
if (lVar1 ==
0x9041934) {
return "anon-inode FS";
}
if (lVar1 <
0x9041935) {
if (lVar1 ==
0x7655821) {
return "rdt";
}
if (lVar1 <
0x7655822) {
if (lVar1 ==
0x13111a8) {
return "ibrix";
}
if (lVar1 <
0x13111a9) {
if (lVar1 ==
0x12ff7b7) {
return "coh";
}
if (lVar1 <
0x12ff7b8) {
if (lVar1 ==
0x12ff7b6) {
return "sysv2";
}
if (lVar1 <
0x12ff7b7) {
if (lVar1 ==
0x12ff7b5) {
return "sysv4";
}
if (lVar1 <
0x12ff7b6) {
if (lVar1 ==
0x12ff7b4) {
return "xenix";
}
if (lVar1 <
0x12ff7b5) {
if (lVar1 ==
0x12fd16d) {
return "xia";
}
if (lVar1 <
0x12fd16e) {
if (lVar1 ==
0x1161970) {
return "gfs/gfs2";
}
if (lVar1 <
0x1161971) {
if (lVar1 ==
0x1021997) {
return "v9fs";
}
if (lVar1 <
0x1021998) {
if (lVar1 ==
0x1021994) {
return "tmpfs";
}
if (lVar1 <
0x1021995) {
if (lVar1 ==
0xc36400) {
return "ceph";
}
if (lVar1 <
0xc36401) {
if (lVar1 ==
0xc0ffee) {
return "hostfs";
}
if (lVar1 <
0xc0ffef) {
if (lVar1 ==
0x414a53) {
return "efs";
}
if (lVar1 <
0x414a54) {
if (lVar1 ==
0x27e0eb) {
return "cgroupfs";
}
if (lVar1 <
0x27e0ec) {
if (lVar1 ==
0x11954) {
return "ufs";
}
if (lVar1 <
0x11955) {
if (lVar1 ==
0xf15f) {
return "ecryptfs";
}
if (lVar1 <
0xf160) {
if (lVar1 ==
0xef53) {
return "ext2/ext3";
}
if (lVar1 <
0xef54) {
if (lVar1 ==
0xef51) {
return "ext2";
}
if (lVar1 <
0xef52) {
if (lVar1 ==
0xadff) {
return "affs";
}
if (lVar1 <
0xae00) {
if (lVar1 ==
0xadf5) {
return "adfs";
}
if (lVar1 <
0xadf6) {
if (lVar1 ==
0x9fa2) {
return "usbdevfs";
}
if (lVar1 <
0x9fa3) {
if (lVar1 ==
0x9fa1) {
return "openprom";
}
if (lVar1 <
0x9fa2) {
if (lVar1 ==
0x9fa0) {
return "proc";
}
if (lVar1 <
0x9fa1) {
if (lVar1 ==
0x9660) {
return "isofs";
}
if (lVar1 <
0x9661) {
if (lVar1 ==
0x72b6) {
return "jffs2";
}
if (lVar1 <
0x72b7) {
if (lVar1 ==
0x7275) {
return "romfs";
}
if (lVar1 <
0x7276) {
if (lVar1 ==
0x6969) {
return "nfs";
}
if (lVar1 <
0x696a) {
if (lVar1 ==
0x5df5) {
return "exofs";
}
if (lVar1 <
0x5df6) {
if (lVar1 ==
0x564c) {
return "novell";
}
if (lVar1 <
0x564d) {
if (lVar1 ==
0x517b) {
return "smb";
}
if (lVar1 <
0x517c) {
if (lVar1 ==
0x4d5a) {
return "minix3";
}
if (lVar1 <
0x4d5b) {
if (lVar1 ==
0x4d44) {
return "msdos";
}
if (lVar1 <
0x4d45) {
if (lVar1 ==
0x4858) {
return "hfsx";
}
if (lVar1 <
0x4859) {
if (lVar1 ==
0x482b) {
return "hfs+";
}
if (lVar1 <
0x482c) {
if (lVar1 ==
0x4244) {
return "hfs";
}
if (lVar1 <
0x4245) {
if (lVar1 ==
0x4006) {
return "fat";
}
if (lVar1 <
0x4007) {
if (lVar1 ==
0x4004) {
return "isofs";
}
if (lVar1 <
0x4005) {
if (lVar1 ==
0x4000) {
return "isofs";
}
if (lVar1 <
0x4001) {
if (lVar1 ==
0x3434) {
return "nilfs";
}
if (lVar1 <
0x3435) {
if (lVar1 ==
0x2478) {
return "minix v2 (30 char.)";
}
if (lVar1 <
0x2479) {
if (lVar1 ==
0x2468) {
return "minix v2";
}
if (lVar1 <
0x2469) {
if (lVar1 ==
0x1cd1) {
return "devpts";
}
if (lVar1 <
0x1cd2) {
if (lVar1 ==
0x138f) {
return "minix (30 char.)";
}
if (lVar1 <
0x1390) {
if (lVar1 ==
0x137f) {
return "minix";
}
if (lVar1 <
0x1380) {
if (lVar1 ==
0x137d) {
return "ext";
}
if (lVar1 <
0x137e) {
if (lVar1 ==
0x1373) {
return "devfs";
}
if (lVar1 <
0x1374) {
if (lVar1 ==
0x7c0) {
return "jffs";
}
if (lVar1 <
0x7c1) {
if (lVar1 ==
0x187) {
return "autofs";
}
if (lVar1 <
0x188) {
if (lVar1 ==
0x2f) {
return "qnx4";
}
if (lVar1 ==
0x33) {
return "z3fold";
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
sprintf(buf_6644, "UNKNOWN (0x%lx)", *param_1);
return buf_6644;
} | coreutils | ghidra |
re_refresh(EditLine *el) {
int i, rhdiff;
wchar_t *cp, *st;
coord_t cur;
;
literal_clear(el);
el->el_refresh.r_cursor.h = 0;
el->el_refresh.r_cursor.v = 0;
terminal_move_to_char(el, 0);
prompt_print(el, 12);
el->el_refresh.r_cursor.h = 0;
el->el_refresh.r_cursor.v = 0;
if (el->el_line.cursor >= el->el_line.lastchar) {
if (el->el_map.current == el->el_map.alt &&
el->el_line.lastchar != el->el_line.buffer)
el->el_line.cursor = el->el_line.lastchar - 1;
else
el->el_line.cursor = el->el_line.lastchar;
}
cur.h = -1;
cur.v = 0;
prompt_print(el, 0);
st = el->el_line.buffer;
for (cp = st; cp < el->el_line.lastchar; cp++) {
if (cp == el->el_line.cursor) {
int w = wcwidth(*cp);
cur.h = el->el_refresh.r_cursor.h;
cur.v = el->el_refresh.r_cursor.v;
if (w > 1 && el->el_refresh.r_cursor.h + w > el->el_terminal.t_size.h) {
cur.h = 0;
cur.v++;
}
}
re_addc(el, *cp);
}
if (cur.h == -1) {
cur.h = el->el_refresh.r_cursor.h;
cur.v = el->el_refresh.r_cursor.v;
}
rhdiff = el->el_terminal.t_size.h - el->el_refresh.r_cursor.h -
el->el_rprompt.p_pos.h;
if (el->el_rprompt.p_pos.h && !el->el_rprompt.p_pos.v &&
!el->el_refresh.r_cursor.v && rhdiff > 1) {
while (--rhdiff > 0)
re_putc(el, ' ', 1);
prompt_print(el, 12);
} else {
el->el_rprompt.p_pos.h = 0;
el->el_rprompt.p_pos.v = 0;
}
re_putc(el, '\0', 0);
el->el_refresh.r_newcv = el->el_refresh.r_cursor.v;
;
;
for (i = 0; i <= el->el_refresh.r_newcv; i++) {
re_update_line(el, (wchar_t *)el->el_display[i],
(wchar_t *)el->el_vdisplay[i], i);
re__copy_and_pad((wchar_t *)el->el_display[i],
(wchar_t *)el->el_vdisplay[i],
(size_t)el->el_terminal.t_size.h);
}
;
if (el->el_refresh.r_oldcv > el->el_refresh.r_newcv)
for (; i <= el->el_refresh.r_oldcv; i++) {
terminal_move_to_line(el, i);
terminal_move_to_char(el, 0);
terminal_clear_EOL(el, (int)wcslen((const wchar_t *)el->el_display[i]));
el->el_display[i][0] = '\0';
}
el->el_refresh.r_oldcv = el->el_refresh.r_newcv;
;
terminal_move_to_line(el, cur.v);
terminal_move_to_char(el, cur.h);
} | long re_refresh(long a1) {
unsigned int v1;
signed int j;
int v4;
int v5;
wchar_t *i;
unsigned int v7;
unsigned int v8;
literal_clear(a1);
*(_DWORD *)(a1 + 784) = 0;
*(_DWORD *)(a1 + 788) = 0;
terminal_move_to_char(a1, 0LL);
prompt_print(a1, 12LL);
*(_DWORD *)(a1 + 784) = 0;
*(_DWORD *)(a1 + 788) = 0;
if (*(_QWORD *)(a1 + 88) >= *(_QWORD *)(a1 + 96)) {
if (*(_QWORD *)(a1 + 1024) != *(_QWORD *)(a1 + 1008) ||
*(_QWORD *)(a1 + 96) == *(_QWORD *)(a1 + 80))
*(_QWORD *)(a1 + 88) = *(_QWORD *)(a1 + 96);
else
*(_QWORD *)(a1 + 88) = *(_QWORD *)(a1 + 96) - 4LL;
}
v7 = -1;
v8 = 0;
prompt_print(a1, 0LL);
for (i = *(wchar_t **)(a1 + 80); (unsigned long)i < *(_QWORD *)(a1 + 96);
++i) {
if (i == *(wchar_t **)(a1 + 88)) {
v5 = wcwidth(*i);
v7 = *(_DWORD *)(a1 + 784);
v8 = *(_DWORD *)(a1 + 788);
if (v5 > 1 && v5 + *(_DWORD *)(a1 + 784) > *(_DWORD *)(a1 + 144)) {
v7 = 0;
++v8;
}
}
re_addc(a1, *i);
}
if (v7 == -1) {
v7 = *(_DWORD *)(a1 + 784);
v8 = *(_DWORD *)(a1 + 788);
}
v4 = *(_DWORD *)(a1 + 144) - *(_DWORD *)(a1 + 784) - *(_DWORD *)(a1 + 832);
if (!*(_DWORD *)(a1 + 832) || *(_DWORD *)(a1 + 836) ||
*(_DWORD *)(a1 + 788) || v4 <= 1) {
*(_DWORD *)(a1 + 832) = 0;
*(_DWORD *)(a1 + 836) = 0;
} else {
while (--v4 > 0)
re_putc(a1, 32, 1);
prompt_print(a1, 12LL);
}
re_putc(a1, 0, 0);
*(_DWORD *)(a1 + 796) = *(_DWORD *)(a1 + 788);
for (j = 0; j <= *(_DWORD *)(a1 + 796); ++j) {
re_update_line(a1, *(unsigned int **)(8LL * j + *(_QWORD *)(a1 + 56)),
*(unsigned int **)(8LL * j + *(_QWORD *)(a1 + 64)), j);
re__copy_and_pad(*(_DWORD **)(8LL * j + *(_QWORD *)(a1 + 56)),
*(_DWORD **)(8LL * j + *(_QWORD *)(a1 + 64)),
*(int *)(a1 + 144));
}
if (*(_DWORD *)(a1 + 792) > *(_DWORD *)(a1 + 796)) {
while (j <= *(_DWORD *)(a1 + 792)) {
terminal_move_to_line(a1, (unsigned int)j);
terminal_move_to_char(a1, 0LL);
v1 = wcslen(*(const wchar_t **)(8LL * j + *(_QWORD *)(a1 + 56)));
terminal_clear_EOL(a1, v1);
**(_DWORD **)(8LL * j++ + *(_QWORD *)(a1 + 56)) = 0;
}
}
*(_DWORD *)(a1 + 792) = *(_DWORD *)(a1 + 796);
terminal_move_to_line(a1, v8);
return terminal_move_to_char(a1, v7);
} | libedit | ida |
int fifos_pending() { return 0; } | long long fifos_pending() { return 0; } | bash | angr_dream |
get_stat_atime(struct stat const *st) { return ((st)->st_atim); } | void get_stat_atime(void)
{
halt_baddata();
} | coreutils | ghidra |
static __u8 read_ioam6mode_type(const char *mode) {
__u8 i;
for (i = (__IOAM6_IPTUNNEL_MODE_MIN + 1);
i <= (__IOAM6_IPTUNNEL_MODE_MAX - 1); i++) {
if (ioam6_mode_types[i] && !strcmp(mode, ioam6_mode_types[i]))
return i;
}
return 0;
} | int read_ioam6mode_type(char *a0) {
char v0;
unsigned int v2;
v0 = 1;
while (true) {
if (v0 <= 3) {
if (ioam6_mode_types[v0]) {
v2 = strcmp(a0, ioam6_mode_types[v0]);
if (!v2) {
v2 = v0;
break;
}
}
if (!ioam6_mode_types[v0] || v2)
v0 += 1;
} else {
v2 = 0;
break;
}
}
return v2;
} | iproute2-6.0.0 | angr_dream |
static void send_msg(struct sshbuf *m) {
u_char buf[4];
size_t mlen = sshbuf_len(m);
int r;
do {
const u_int32_t __v = (mlen);
((u_char *)(buf))[0] = (__v >> 24) & 0xff;
((u_char *)(buf))[1] = (__v >> 16) & 0xff;
((u_char *)(buf))[2] = (__v >> 8) & 0xff;
((u_char *)(buf))[3] = __v & 0xff;
} while (0);
if (atomicio((ssize_t (*)(int, void *, size_t))write, fd, buf, 4) != 4 ||
atomicio((ssize_t (*)(int, void *, size_t))write, fd,
sshbuf_mutable_ptr(m), sshbuf_len(m)) != sshbuf_len(m))
sshlog("ssh-pkcs11-client.c", __func__, 66, 0, SYSLOG_LEVEL_ERROR,
((void *)0), "write to helper failed");
if ((r = sshbuf_consume(m, mlen)) != 0)
sshfatal("ssh-pkcs11-client.c", __func__, 68, 1, SYSLOG_LEVEL_FATAL,
ssh_err(r), "consume");
} | void send_msg(unsigned long long a0) {
unsigned long long v0;
unsigned int v1;
unsigned int v2;
unsigned long long v3;
char v4;
char v5;
char v6;
char v7;
char v8;
unsigned long long *v10;
unsigned long long v11;
v3 = sshbuf_len(a0);
v1 = v3;
v4 = v1 >> 24;
v5 = v1 >> 16;
v6 = v1 >> 8;
v7 = v1;
if (atomicio(got.write, fd, &v4, 0x4) != 4 ||
atomicio(got.write, fd, sshbuf_mutable_ptr(a0), sshbuf_len(a0)) !=
sshbuf_len(a0)) {
v0 = "write to helper failed";
sshlog("ssh-pkcs11-client.c", "send_msg", 0x42, 0x0, 0x2, 0x0);
}
v2 = sshbuf_consume(a0, v3, v3);
if (v2) {
v0 = "consume";
sshfatal("ssh-pkcs11-client.c", "send_msg", 0x44, 0x1, 0x1, ssh_err(v2));
}
v11 = *(&v8) ^ v10[5];
return;
} | openssh-portable | angr_sailr |
static int host_delete(struct hostkey_foreach_line *l, void *_ctx) {
struct host_delete_ctx *ctx = (struct host_delete_ctx *)_ctx;
int loglevel = ctx->quiet ? SYSLOG_LEVEL_DEBUG1 : SYSLOG_LEVEL_VERBOSE;
size_t i;
if (l->status == 3 && l->marker == MRK_NONE) {
for (i = 0; i < ctx->nkeys; i++) {
if (!sshkey_equal(ctx->keys[i], l->key))
continue;
ctx->match_keys[i] |= l->match;
fprintf(ctx->out, "%s\n", l->line);
sshlog("hostfile.c", __func__, 560, 1, SYSLOG_LEVEL_DEBUG3, ((void *)0),
"%s key already at %s:%ld", sshkey_type(l->key), l->path,
l->linenum);
return 0;
}
sshlog("hostfile.c", __func__, 569, 0, loglevel, ((void *)0),
"%s%s%s:%ld: Removed %s key for host %s", ctx->quiet ? __func__ : "",
ctx->quiet ? ": " : "", l->path, l->linenum, sshkey_type(l->key),
ctx->host)
;
ctx->modified = 1;
return 0;
}
if (l->status == 1) {
sshlog("hostfile.c", __func__, 577, 0, loglevel, ((void *)0),
"%s%s%s:%ld: invalid known_hosts entry", ctx->quiet ? __func__ : "",
ctx->quiet ? ": " : "", l->path, l->linenum)
;
}
fprintf(ctx->out, "%s\n", l->line);
return 0;
} | undefined8 host_delete(undefined8 *param_1, FILE **param_2)
{
FILE *pFVar1;
undefined4 uVar2;
int iVar3;
undefined8 uVar4;
undefined8 uVar5;
char *pcVar6;
undefined *puVar7;
undefined8 uVar8;
FILE *local_28;
if (*(int *)(param_2 + 1) == 0) {
uVar2 = 4;
} else {
uVar2 = 5;
}
if ((*(int *)(param_1 + 2) == 3) && (*(int *)(param_1 + 4) == 1)) {
for (local_28 = (FILE *)0x0; local_28 < param_2[6];
local_28 = (FILE *)((long)&local_28->_flags + 1)) {
iVar3 = sshkey_equal(
*(undefined8 *)(¶m_2[5]->_flags + (long)local_28 * 2),
param_1[8]);
if (iVar3 != 0) {
(¶m_2[4]->_flags)[(long)local_28] =
*(uint *)((long)param_1 + 0x14) |
(¶m_2[4]->_flags)[(long)local_28];
fprintf(*param_2, "%s\n", param_1[3]);
uVar5 = param_1[1];
uVar8 = *param_1;
uVar4 = sshkey_type(param_1[8]);
sshlog("hostfile.c", "host_delete", 0x230, 1, 7, 0,
"%s key already at %s:%ld", uVar4, uVar8, uVar5);
return 0;
}
}
pFVar1 = param_2[2];
uVar8 = 0x10187e;
uVar5 = sshkey_type(param_1[8]);
if (*(int *)(param_2 + 1) == 0) {
puVar7 = &DAT_00102eda;
} else {
puVar7 = &DAT_00103009;
}
if (*(int *)(param_2 + 1) == 0) {
pcVar6 = "";
} else {
pcVar6 = "host_delete";
}
sshlog("hostfile.c", "host_delete", 0x239, 0, uVar2, 0,
"%s%s%s:%ld: Removed %s key for host %s", pcVar6, puVar7, *param_1,
param_1[1], uVar5, pFVar1, uVar8);
*(undefined4 *)(param_2 + 7) = 1;
} else {
if (*(int *)(param_1 + 2) == 1) {
if (*(int *)(param_2 + 1) == 0) {
puVar7 = &DAT_00102eda;
} else {
puVar7 = &DAT_00103009;
}
if (*(int *)(param_2 + 1) == 0) {
pcVar6 = "";
} else {
pcVar6 = "host_delete";
}
sshlog("hostfile.c", "host_delete", 0x241, 0, uVar2, 0,
"%s%s%s:%ld: invalid known_hosts entry", pcVar6, puVar7, *param_1,
param_1[1]);
}
fprintf(*param_2, "%s\n", param_1[3]);
}
return 0;
} | openssh-portable | ghidra |
static char *bash_filename_rewrite_hook(fname, fnlen)
char *fname;
int fnlen;
{
char *conv;
conv = fnx_fromfs(fname, fnlen);
if (conv != fname)
conv = (char *)strcpy(sh_xmalloc((1 + strlen(conv)), "bashline.c", 3296),
(conv));
return conv;
} | char *bash_filename_rewrite_hook(char *a1, int a2) {
size_t v2;
char *v3;
char *s;
s = (char *)fnx_fromfs(a1, a2);
if (s != a1) {
v2 = strlen(s);
v3 = (char *)sh_xmalloc(v2 + 1, "bashline.c", 3296LL);
return strcpy(v3, s);
}
return s;
} | bash | ida |
void assign_string_n(char **string, const char *value, size_t n) {
free(*string);
if (value) {
size_t l = strnlen(value, n);
char *p = xmalloc(l + 1);
memcpy(p, value, l);
p[l] = 0;
*string = p;
}
} | long long assign_string_n(unsigned long long *a0, void *a1, unsigned int a2) {
char *v0;
char *v1;
unsigned long long *v3;
v3 = free(*(a0));
if (a1) {
v0 = strnlen(a1, a2);
v1 = xmalloc(v0 + 1);
memcpy(v1, a1, v0);
*((v0 + v1)) = 0;
v3 = a0;
*(a0) = v1;
return v3;
}
return v3;
} | tar | angr_sailr |
static int history_set_nth(void *p, HistEventW *ev, int n) {
history_t *h = (history_t *)p;
if (h->cur == 0) {
{
ev->num = 5;
ev->str = he_errlist[5];
};
return -1;
}
for (h->cursor = h->list.prev; h->cursor != &h->list;
h->cursor = h->cursor->prev)
if (n-- <= 0)
break;
if (h->cursor == &h->list) {
{
ev->num = 9;
ev->str = he_errlist[9];
};
return -1;
}
return 0;
} | int history_set_nth(struct_0 *a0, struct_2 *a1, unsigned long a2) {
unsigned int v0;
unsigned int v2;
unsigned int v3;
v0 = a2;
if (!a0->field_34) {
a1->field_0 = 5;
a1->field_8 = "e";
v2 = -1;
} else {
for (a0->field_28 = a0->field_20; a0->field_28 != a0;
a0->field_28 = a0->field_28->field_20) {
v3 = v0;
v0 -= 1;
if (v3 <= 0)
break;
}
if (a0->field_28 == a0) {
a1->field_0 = 9;
a1->field_8 = "e";
v2 = -1;
} else {
v2 = 0;
}
}
return v2;
} | libedit | angr_dream |
static void print_sdiff_hunk(struct change *hunk) {
lin first0, last0, first1, last1;
register lin i, j;
enum changes changes = analyze_hunk(hunk, &first0, &last0, &first1, &last1);
if (!changes)
return;
print_sdiff_common_lines(first0, first1);
if (sdiff_merge_assist) {
printint len0 = last0 - first0 + 1;
printint len1 = last1 - first1 + 1;
fprintf(outfile,
"c%"
"l"
"d,%"
"l"
"d\n",
len0, len1);
}
if (changes == CHANGED) {
for (i = first0, j = first1; i <= last0 && j <= last1; i++, j++)
print_1sdiff_line(&files[0].linbuf[i], '|', &files[1].linbuf[j]);
changes = (i <= last0 ? OLD : 0) + (j <= last1 ? NEW : 0);
next0 = first0 = i;
next1 = first1 = j;
}
if (changes & NEW) {
for (j = first1; j <= last1; ++j)
print_1sdiff_line(0, '>', &files[1].linbuf[j]);
next1 = j;
}
if (changes & OLD) {
for (i = first0; i <= last0; ++i)
print_1sdiff_line(&files[0].linbuf[i], '<', 0);
next0 = i;
}
} | long long print_sdiff_hunk(unsigned long long a0) {
unsigned int v0;
unsigned long long v1;
char v2;
unsigned long long v3;
char v4;
unsigned long v5;
unsigned long v6;
unsigned long long v8;
unsigned long long v9;
unsigned long v10;
unsigned long long v11;
unsigned long long v12;
unsigned long long v13;
v0 = analyze_hunk(a0, &v1, &v2, &v3, &v4);
if (v0) {
print_sdiff_common_lines(v1, v3);
if (sdiff_merge_assist) {
v5 = *(&v2) - v1 + 1;
v6 = *(&v4) - v3 + 1;
fprintf(outfile, "c%ld,%ld\n", v5, v6);
}
if (v0 == 3) {
v8 = v1;
v9 = v3;
while (true) {
if (v8 > *(&v2))
break;
if (v9 > *(&v4))
break;
print_1sdiff_line(g_5000c0 + v8 * 8, 0x7c, v9 * 8 + *(5243376));
v8 += 1;
v9 += 1;
}
v10 = v8 <= *(&v2);
if (v9 <= *(&v4))
v11 = 2;
else
v11 = 0;
v0 = v10 + v11;
v1 = v8;
next0 = v1;
v3 = v9;
next1 = v3;
}
if ((v0 & 2)) {
for (v12 = v3; v12 <= *(&v4); v12 += 1) {
print_1sdiff_line(0x0, 0x3e, *(5243376) + v12 * 8);
}
next1 = v12;
}
if ((v0 & 1)) {
for (v13 = v1; v13 <= *(&v2); v13 += 1) {
print_1sdiff_line(g_5000c0 + v13 * 8, 0x3c, 0x0);
}
next0 = v13;
}
}
return 0;
} | diffutils | angr_phoenix |
int main(int argc, char **argv) {
char *mode = ((void *)0);
size_t mode_len = 0;
size_t mode_alloc = 0;
_Bool ok;
_Bool preserve_root = 0;
char const *reference_file = ((void *)0);
int c;
;
set_program_name(argv[0]);
setlocale(6, "");
bindtextdomain("coreutils", "/usr/local/share/locale");
textdomain("coreutils");
atexit(close_stdout);
recurse = force_silent = diagnose_surprises = 0;
while ((c = getopt_long(argc, argv,
("Rcfvr::w::x::X::s::t::u::g::o::a::,::+::=::"
"0::1::2::3::4::5::6::7::"),
long_options, ((void *)0))) != -1) {
switch (c) {
case 'r':
case 'w':
case 'x':
case 'X':
case 's':
case 't':
case 'u':
case 'g':
case 'o':
case 'a':
case ',':
case '+':
case '=':
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
{
char const *arg = argv[optind - 1];
size_t arg_len = strlen(arg);
size_t mode_comma_len = mode_len + !!mode_len;
size_t new_mode_len = mode_comma_len + arg_len;
if (mode_alloc <= new_mode_len) {
mode_alloc = new_mode_len + 1;
mode = ((!!sizeof(struct {
_Static_assert(sizeof *(mode) == 1, "verify_expr ("
"sizeof *(mode) == 1"
", "
"x2realloc (mode, &mode_alloc)"
")");
int _gl_dummy;
}))
? (x2realloc(mode, &mode_alloc))
: (x2realloc(mode, &mode_alloc)));
}
mode[mode_len] = ',';
memcpy(mode + mode_comma_len, arg, arg_len + 1);
mode_len = new_mode_len;
diagnose_surprises = 1;
} break;
case NO_PRESERVE_ROOT:
preserve_root = 0;
break;
case PRESERVE_ROOT:
preserve_root = 1;
break;
case REFERENCE_FILE_OPTION:
reference_file = optarg;
break;
case 'R':
recurse = 1;
break;
case 'c':
verbosity = V_changes_only;
break;
case 'f':
force_silent = 1;
break;
case 'v':
verbosity = V_high;
break;
case GETOPT_HELP_CHAR:
usage(0);
break;
;
case GETOPT_VERSION_CHAR:
version_etc(stdout, "chmod", "GNU coreutils", Version,
("David MacKenzie"), ("Jim Meyering"), (char *)((void *)0));
exit(0);
break;
;
default:
usage(1);
}
}
if (reference_file) {
if (mode) {
error(0, 0, gettext("cannot combine mode and --reference options"));
usage(1);
}
} else {
if (!mode)
mode = argv[optind++];
}
if (optind >= argc) {
if (!mode || mode != argv[optind - 1])
error(0, 0, gettext("missing operand"));
else
error(0, 0, gettext("missing operand after %s"), quote(argv[argc - 1]));
usage(1);
}
if (reference_file) {
change = mode_create_from_ref(reference_file);
if (!change)
((!!sizeof(struct {
_Static_assert(1, "verify_expr ("
"1"
", "
"(error (1, (*__errno_location ()), gettext "
"(\"failed to get attributes of %s\"), "
"quotearg_style (shell_escape_always_quoting_style, "
"reference_file)), assume (false))"
")");
int _gl_dummy;
}))
? ((error(1, (*__errno_location()),
gettext("failed to get attributes of %s"),
quotearg_style(shell_escape_always_quoting_style,
reference_file)),
((0) ? (void)0 : __builtin_unreachable())))
: ((error(1, (*__errno_location()),
gettext("failed to get attributes of %s"),
quotearg_style(shell_escape_always_quoting_style,
reference_file)),
((0) ? (void)0 : __builtin_unreachable()))));
} else {
change = mode_compile(mode);
if (!change) {
error(0, 0, gettext("invalid mode: %s"), quote(mode));
usage(1);
}
umask_value = umask(0);
}
if (recurse && preserve_root) {
static struct dev_ino dev_ino_buf;
root_dev_ino = get_root_dev_ino(&dev_ino_buf);
if (root_dev_ino == ((void *)0))
((!!sizeof(struct {
_Static_assert(
1, "verify_expr ("
"1"
", "
"(error (1, (*__errno_location ()), gettext (\"failed to get "
"attributes of %s\"), quotearg_style "
"(shell_escape_always_quoting_style, \"/\")), assume (false))"
")");
int _gl_dummy;
}))
? ((error(1, (*__errno_location()),
gettext("failed to get attributes of %s"),
quotearg_style(shell_escape_always_quoting_style, "/")),
((0) ? (void)0 : __builtin_unreachable())))
: ((error(1, (*__errno_location()),
gettext("failed to get attributes of %s"),
quotearg_style(shell_escape_always_quoting_style, "/")),
((0) ? (void)0 : __builtin_unreachable()))));
} else {
root_dev_ino = ((void *)0);
}
ok = process_files(argv + optind, 0x0001 | 0x0010 | 0x0400);
return ok ? 0 : 1;
} | int main(unsigned long a0, unsigned long long *a1) {
void *v0;
int tmp_10;
char v1;
char v2;
unsigned int v3;
void *v4;
void *v5;
void *v6;
void *v7;
void *v8;
unsigned long v9;
unsigned long v10;
unsigned long long v11;
unsigned long long v13;
unsigned long long v14;
unsigned long long v15;
unsigned long long v16;
v5 = 0;
v6 = 0;
v4 = 0;
v1 = 0;
v7 = 0;
set_program_name(*(a1));
setlocale(0x6, &g_401583);
bindtextdomain("coreutils", "/usr/local/share/locale");
textdomain("coreutils");
atexit(got.close_stdout);
diagnose_surprises = 0;
force_silent = diagnose_surprises;
recurse = force_silent;
while (true) {
v3 = getopt_long(
a0, a1,
"Rcfvr::w::x::X::s::t::u::g::o::a::,::+::=::0::1::2::3::4::5::6::7::",
&long_options, NULL);
if (v3 != -1) {
if (v3 <= 130) {
if (v3 < 43) {
if (v3 == -131) {
v0 = 0;
version_etc(stdout, "chmod", "GNU coreutils", Version,
"David MacKenzie", "Jim Meyering");
exit(0x0);
}
if (v3 == -130)
usage(0x0);
} else {
switch (v3) {
case 43:
case 44:
case 48:
case 49:
case 50:
case 51:
case 52:
case 53:
case 54:
case 55:
case 61:
case 88:
case 97:
case 103:
case 111:
case 114:
case 115:
case 116:
case 117:
case 119:
case 120:
v8 = a1[1 + optind];
v9 = strlen(v8);
v10 = v6 + (v6);
v11 = v9 + v10;
if (v11 >= v4) {
v4 = v11 + 1;
v5 = x2realloc(v5, &v4, &v4);
}
*((v6 + v5)) = 44;
memcpy(v5 + v10, v8, v9 + 1);
v6 = v11;
diagnose_surprises = 1;
break;
case 82:
recurse = 1;
break;
case 99:
verbosity = 1;
break;
case 102:
force_silent = 1;
break;
case 118:
verbosity = 0;
break;
case 128:
v1 = 0;
break;
case 129:
v1 = 1;
break;
case 130:
v7 = optarg;
break;
default:
usage(0x1);
}
}
}
} else {
if (v7) {
if (!v5)
break;
if (v5) {
error(0x0, 0x0,
gettext("cannot combine mode and --reference options"));
usage(0x1);
}
} else {
if (v5)
break;
if (!v5) {
tmp_10 = optind;
optind = optind + 1;
v5 = a1[tmp_10];
break;
}
}
}
}
if (a0 <= optind) {
if (v5 && v5 == a1[1 + optind]) {
v13 = quote(a1[1 + a0]);
error(0x0, 0x0, gettext("missing operand after %s"));
}
if (!v5 || v5 != a1[1 + optind])
error(0x0, 0x0, gettext("missing operand"));
usage(0x1);
} else {
if (v7) {
change = mode_create_from_ref(v7);
if (!change) {
v15 = quotearg_style(0x4, v7);
error(0x1, *(__errno_location()),
gettext("failed to get attributes of %s"));
}
} else {
change = mode_compile(v5);
if (!change) {
v14 = quote(v5);
error(0x0, 0x0, gettext("invalid mode: %s"));
usage(0x1);
}
umask_value = umask(0x0);
}
if (change) {
if (recurse && v1) {
root_dev_ino = get_root_dev_ino(&dev_ino_buf.5990);
if (!root_dev_ino) {
v16 = quotearg_style(0x4, "/");
error(0x1, *(__errno_location()),
gettext("failed to get attributes of %s"));
}
}
if (!v1 || !recurse)
root_dev_ino = 0;
if (!v1 || !recurse || root_dev_ino) {
v2 = process_files(&a1[optind], 0x411);
return v2 ^ 1;
}
}
}
} | coreutils | angr_dream |
static int parse_df_flags(const char *cmd, char **argv, int argc, int *hflag,
int *iflag) {
int ch;
BSDoptind = BSDoptreset = 1;
BSDopterr = 0;
*hflag = *iflag = 0;
while ((ch = BSDgetopt(argc, argv, "hi")) != -1) {
switch (ch) {
case 'h':
*hflag = 1;
break;
case 'i':
*iflag = 1;
break;
default:
sshlog("sftp.c", __func__, 554, 0, SYSLOG_LEVEL_ERROR, ((void *)0),
"%s: Invalid flag -%c", cmd, BSDoptopt);
return -1;
}
}
return BSDoptind;
} | undefined4 parse_df_flags(undefined8 param_1, undefined8 param_2,
undefined4 param_3, undefined4 *param_4,
undefined4 *param_5)
{
int iVar1;
undefined8 uVar2;
BSDoptreset = 1;
BSDoptind = 1;
_BSDopterr = 0;
*param_5 = 0;
*param_4 = *param_5;
while (true) {
while (true) {
uVar2 = 0x100c5c;
iVar1 = BSDgetopt(param_3, param_2, &DAT_001099dc);
if (iVar1 == -1) {
return BSDoptind;
}
if (iVar1 != 0x68)
break;
*param_4 = 1;
}
if (iVar1 != 0x69)
break;
*param_5 = 1;
}
sshlog("sftp.c", "parse_df_flags", 0x22a, 0, 2, 0, "%s: Invalid flag -%c",
param_1, BSDoptopt, uVar2);
return 0xffffffff;
} | openssh-portable | ghidra |
void __free_obj_p(obj_prefix *obj_p) {
obj_p->p_magic = 0;
if (obj_p->p_flags & 1)
free(obj_p);
} | long long __free_obj_p(unsigned short a0[2]) {
unsigned long long v1;
a0[0] = 0;
v1 = a0[1] & 1;
if ((a0[1] & 1))
v1 = free(a0);
return v1;
} | acl-2.3.1 | angr_phoenix |
static void fail_exit(int code) {
if (pw_locked) {
if (pw_unlock() == 0) {
fprintf(stderr, gettext("%s: failed to unlock %s\n"), Prog, pw_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, "failed to unlock %s", pw_dbname());
if (((void *)0) != saved_locale) {
(void)setlocale(6, saved_locale);
free(saved_locale);
}
} while (0);
}
}
closelog();
exit(code);
} | void fail_exit(int param_1)
{
int iVar1;
undefined8 uVar2;
char *pcVar3;
undefined8 uVar4;
char *local_28;
if (pw_locked != '\0') {
iVar1 = pw_unlock();
if (iVar1 == 0) {
uVar2 = pw_dbname();
uVar4 = Prog;
pcVar3 = (char *)gettext("%s: failed to unlock %s\n");
fprintf(stderr, pcVar3, uVar4, uVar2);
pcVar3 = setlocale(6, (char *)0x0);
local_28 = (char *)0x0;
if (pcVar3 != (char *)0x0) {
local_28 = strdup(pcVar3);
}
if (local_28 != (char *)0x0) {
setlocale(6, "C");
}
uVar4 = pw_dbname();
syslog(3, "failed to unlock %s", uVar4);
if (local_28 != (char *)0x0) {
setlocale(6, local_28);
free(local_28);
}
}
}
closelog();
exit(param_1);
} | shadow | ghidra |
static void trig_transitional_activate(enum modstatdb_rw cstatus) {
struct pkg_hash_iter *iter;
struct pkginfo *pkg;
iter = pkg_hash_iter_new();
while ((pkg = pkg_hash_iter_next_pkg(iter))) {
if (pkg->status <= PKG_STAT_HALFINSTALLED)
continue;
debug(dbg_triggersdetail, "trig_transitional_activate %s %s",
pkg_name(pkg, pnaw_always), pkg_status_name(pkg));
pkg->trigpend_head = ((void *)0);
trig_parse_ci(pkg_infodb_get_file(pkg, &pkg->installed, "triggers"),
cstatus >= msdbrw_write ? transitional_interest_callback
: transitional_interest_callback_ro,
((void *)0), pkg, &pkg->installed);
if (pkg->status < PKG_STAT_TRIGGERSAWAITED)
continue;
if (pkg->trigaw.head)
pkg_set_status(pkg, PKG_STAT_TRIGGERSAWAITED);
else if (pkg->trigpend_head)
pkg_set_status(pkg, PKG_STAT_TRIGGERSPENDING);
else
pkg_set_status(pkg, PKG_STAT_INSTALLED);
}
pkg_hash_iter_free(iter);
if (cstatus >= msdbrw_write) {
modstatdb_checkpoint();
trig_file_interests_save();
}
} | long long trig_transitional_activate(unsigned long long a0,
unsigned long long a1, unsigned long a2,
unsigned long a3, unsigned long a4,
unsigned long long a5) {
unsigned long long v0;
struct_0 *v1;
unsigned long long v4;
v0 = pkg_hash_iter_new();
while (true) {
while (true) {
while (true) {
do {
do {
v1 = pkg_hash_iter_next_pkg(v0);
if (!v1) {
v4 = pkg_hash_iter_free(v0);
if (a0 > 2) {
modstatdb_checkpoint();
v4 = trig_file_interests_save(a0, a1, 0x0, v1,
&v1->padding_1c[44], a5);
return v4;
}
return v4;
}
} while (v1->field_18 <= 2);
pkg_status_name(v1);
debug(0x2000, "trig_transitional_activate %s %s", pkg_name(v1, 0x3));
v1->field_160 = 0;
trig_parse_ci(pkg_infodb_get_file(v1, &v1->padding_1c[44], "triggers",
&v1->padding_1c[44]),
(a0 <= 2 ? transitional_interest_callback
: transitional_interest_callback_ro),
0x0, v1, &v1->padding_1c[44]);
} while (v1->field_18 <= 4);
if (!v1->field_148)
break;
pkg_set_status(v1, 0x5);
}
if (v1->field_160)
break;
pkg_set_status(v1, 0x7);
}
pkg_set_status(v1, 0x6);
}
} | dpkg | angr_sailr |
static int private2_check_padding(struct sshbuf *decrypted) {
u_char pad;
size_t i;
int r;
i = 0;
while (sshbuf_len(decrypted)) {
if ((r = sshbuf_get_u8(decrypted, &pad)) != 0)
goto out;
if (pad != (++i & 0xff)) {
r = -4;
goto out;
}
}
r = 0;
out:
explicit_bzero(&pad, sizeof(pad));
explicit_bzero(&i, sizeof(i));
return r;
} | long private2_check_padding(long a1) {
long i;
unsigned char v3;
unsigned int u8;
long v5[2];
v5[1] = __readfsqword(0x28u);
v5[0] = 0LL;
for (i = sshbuf_len(a1); i; i = sshbuf_len(a1)) {
u8 = sshbuf_get_u8(a1, &v3);
if (u8)
goto LABEL_8;
++v5[0];
if (v3 != (unsigned long)LOBYTE(v5[0])) {
u8 = -4;
goto LABEL_8;
}
}
u8 = 0;
LABEL_8:
explicit_bzero(&v3, 1LL);
explicit_bzero(v5, 8LL);
return u8;
} | openssh-portable | ida |
int open_redir_file(r, fnp)
REDIRECT *r;
char **fnp;
{
char *fn;
int fd, rval;
if (r->instruction != r_input_direction)
return -1;
if (posixly_correct && !interactive_shell)
disallow_filename_globbing++;
fn = redirection_expand(r->redirectee.filename);
if (posixly_correct && !interactive_shell)
disallow_filename_globbing--;
if (fn == 0) {
redirection_error(r, -1, fn);
return -1;
}
fd = open(fn, 00);
if (fd < 0) {
file_error(fn);
sh_xfree((fn), "evalstring.c", 735);
if (fnp)
*fnp = 0;
return -1;
}
if (fnp)
*fnp = fn;
return fd;
} | int open_redir_file(long param_1, char **param_2)
{
int iVar1;
char *__file;
if (*(int *)(param_1 + 0x18) == 1) {
if ((posixly_correct != 0) && (interactive_shell == 0)) {
disallow_filename_globbing = disallow_filename_globbing + 1;
}
__file = (char *)redirection_expand(*(undefined8 *)(param_1 + 0x20));
if ((posixly_correct != 0) && (interactive_shell == 0)) {
disallow_filename_globbing = disallow_filename_globbing + -1;
}
if (__file == (char *)0x0) {
redirection_error(param_1, 0xffffffff, 0);
iVar1 = -1;
} else {
iVar1 = open(__file, 0);
if (iVar1 < 0) {
file_error(__file);
sh_xfree(__file, "evalstring.c", 0x2df);
if (param_2 != (char **)0x0) {
*param_2 = (char *)0x0;
}
iVar1 = -1;
} else if (param_2 != (char **)0x0) {
*param_2 = __file;
}
}
} else {
iVar1 = -1;
}
return iVar1;
} | bash | ghidra |
int rl_end_undo_group(void) {
rl_add_undo(UNDO_END, 0, 0, 0);
_rl_undo_group_level--;
return 0;
} | undefined8 rl_end_undo_group(void)
{
rl_add_undo(3, 0, 0, 0);
_rl_undo_group_level = _rl_undo_group_level + -1;
return 0;
} | bash | ghidra |
void ssh_packet_set_mux(struct ssh *ssh) {
ssh->state->mux = 1;
ssh->state->rekeying = 0;
kex_free(ssh->kex);
ssh->kex = ((void *)0);
} | long long ssh_packet_set_mux(struct_0 *a0) {
a0->field_0->field_1e0 = 1;
a0->field_0->field_1dc = 0;
kex_free(a0->field_8);
a0->field_8 = 0;
return a0;
} | openssh-portable | angr_dream |
static void hsr_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[]) {
char b1[64];
if (!tb)
return;
if (tb[IFLA_HSR_SLAVE1] &&
((int)((tb[IFLA_HSR_SLAVE1])->rta_len) -
((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0))) <
sizeof(__u32))
return;
if (tb[IFLA_HSR_SLAVE2] &&
((int)((tb[IFLA_HSR_SLAVE2])->rta_len) -
((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0))) <
sizeof(__u32))
return;
if (tb[IFLA_HSR_SEQ_NR] &&
((int)((tb[IFLA_HSR_SEQ_NR])->rta_len) -
((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0))) <
sizeof(__u16))
return;
if (tb[IFLA_HSR_SUPERVISION_ADDR] &&
((int)((tb[IFLA_HSR_SUPERVISION_ADDR])->rta_len) -
((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0))) < 6)
return;
if (tb[IFLA_HSR_SLAVE1])
print_string(PRINT_ANY, "slave1", "slave1 %s ",
ll_index_to_name(rta_getattr_u32(tb[IFLA_HSR_SLAVE1])));
else
print_null(PRINT_ANY, "slave1", "slave1 %s ", "<none>");
if (tb[IFLA_HSR_SLAVE2])
print_string(PRINT_ANY, "slave2", "slave2 %s ",
ll_index_to_name(rta_getattr_u32(tb[IFLA_HSR_SLAVE2])));
else
print_null(PRINT_ANY, "slave2", "slave2 %s ", "<none>");
if (tb[IFLA_HSR_SEQ_NR])
print_int(PRINT_ANY, "seq_nr", "sequence %d ",
rta_getattr_u16(tb[IFLA_HSR_SEQ_NR]));
if (tb[IFLA_HSR_SUPERVISION_ADDR])
print_string(
PRINT_ANY, "supervision_addr", "supervision %s ",
ll_addr_n2a(
((void *)(((char *)(tb[IFLA_HSR_SUPERVISION_ADDR])) +
((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) +
(0)))),
((int)((tb[IFLA_HSR_SUPERVISION_ADDR])->rta_len) -
((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0))),
0xFFFF, b1, sizeof(b1)));
if (tb[IFLA_HSR_PROTOCOL])
print_hhu(PRINT_ANY, "proto", "proto %hhu ",
rta_getattr_u8(tb[IFLA_HSR_PROTOCOL]));
} | long long hsr_print_opt(unsigned long a0, unsigned long a1, struct_0 *a2) {
unsigned long v0;
unsigned long v1;
char v2;
v1 = a0;
v0 = a1;
if (!a2)
return 0;
if (a2->field_8 && a2->field_8->field_0 - 4 <= 3)
return 0;
if (a2->field_10 && a2->field_10->field_0 - 4 <= 3)
return 0;
if (a2->field_28 && a2->field_28->field_0 - 4 <= 1)
return 0;
if (a2->field_20 && a2->field_20->field_0 - 4 <= 5)
return 0;
if (!a2->field_8)
print_null(0x4, "slave1", "slave1 %s ", "<none>");
else
print_string(0x4, "slave1", "slave1 %s ",
ll_index_to_name(rta_getattr_u32(a2->field_8)));
if (!a2->field_10)
print_null(0x4, "slave2", "slave2 %s ", "<none>");
else
print_string(0x4, "slave2", "slave2 %s ",
ll_index_to_name(rta_getattr_u32(a2->field_10)));
if (a2->field_28)
print_int(0x4, "seq_nr", "sequence %d ", rta_getattr_u16(a2->field_28));
if (a2->field_20)
print_string(0x4, "supervision_addr", "supervision %s ",
ll_addr_n2a(a2->field_20 + 2, a2->field_20->field_0 - 4,
0xffff, &v2, 0x40));
if (a2->field_38) {
print_hhu(0x4, "proto", "proto %hhu ", rta_getattr_u8(a2->field_38));
return 0;
}
return 0;
} | iproute2-6.0.0 | angr_sailr |
static void xattr_acls_a_decoder(struct tar_stat_info *st, char const *keyword,
char const *arg, size_t size) {
st->acls_a_ptr = xmemdup(arg, size + 1);
st->acls_a_len = size;
} | long long xattr_acls_a_decoder(unsigned long long a0[9], unsigned long a1,
unsigned long long a2, unsigned long long a3) {
unsigned long v0;
v0 = a1;
a0[7] = xmemdup(a2, a3 + 1, a3 + 1, a3);
a0[8] = a3;
return a0;
} | tar | angr_sailr |
int rl_show_char(int c) {
int n = 1;
if (((c) > 0x07f && (c) <= 255) && (_rl_output_meta_chars == 0)) {
fprintf(rl_outstream, "M-");
n += 2;
c = ((c) & (~0x080));
}
if ((((c) < 0x020 && (((c) & 0x80) == 0)) && c != '\t') || c == 0x7f)
{
fprintf(rl_outstream, "C-");
n += 2;
c = ((c) < 0x020 && (((c) & 0x80) == 0))
? ((1 &&
(1 &&
((*__ctype_b_loc())[(int)(((unsigned char)((c) | 0x40)))] &
(unsigned short int)_ISlower)))
? toupper((unsigned char)(((c) | 0x40)))
: (((c) | 0x40)))
: '?';
}
putc(c, rl_outstream);
fflush(rl_outstream);
return n;
} | long long rl_show_char(unsigned long a0) {
unsigned int v0;
unsigned int v1;
unsigned int v4;
unsigned int v6;
v0 = a0;
v1 = 1;
if (v0 > 127 && v0 <= 255 && !_rl_output_meta_chars) {
fprintf(rl_outstream, "M-");
v1 += 2;
v0 &= -129;
}
if (v0 <= 31 && !(v0 & 128) && !(v0 == 9))
goto LABEL_4068c7;
if (!(v0 == 127))
goto LABEL_406940;
LABEL_4068c7:
fprintf(rl_outstream, "C-");
v1 += 2;
if (v0 <= 31 && !(v0 & 128)) {
v6 = *((*(__ctype_b_loc()) + (v0 | 64) * 2)) & 0x200;
if (!v6) {
v4 = v0 | 64;
goto LABEL_40693d;
} else {
v4 = toupper(v0 | 64);
goto LABEL_40693d;
}
}
v4 = 63;
LABEL_40693d:
v0 = v4;
LABEL_406940:
putc(v0, rl_outstream);
fflush(rl_outstream);
return v1;
} | bash | angr_phoenix |
static int ssh_packet_start_discard(struct ssh *ssh, struct sshenc *enc,
struct sshmac *mac, size_t mac_already,
u_int discard) {
struct session_state *state = ssh->state;
int r;
if (enc == ((void *)0) || !cipher_is_cbc(enc->cipher) || (mac && mac->etm)) {
if ((r = sshpkt_disconnect(ssh, "Packet corrupt")) != 0)
return r;
return -30;
}
if (mac && mac->enabled) {
state->packet_discard_mac = mac;
state->packet_discard_mac_already = mac_already;
}
if (sshbuf_len(state->input) >= discard)
return ssh_packet_stop_discard(ssh);
state->packet_discard = discard - sshbuf_len(state->input);
return 0;
} | void ssh_packet_start_discard(unsigned long long *a0, struct_0 *a1,
unsigned int a2[9], unsigned long a3,
unsigned long a4) {
unsigned int v0;
struct_1 *v1;
unsigned long v3;
unsigned long long v4;
void *v5;
v1 = *(a0);
if (a1 && cipher_is_cbc(a1->field_8) && (!(a2) || !(a2[8]))) {
if (a2 && a2[2]) {
v1->field_1d0 = a2;
v1->field_1c8 = a3;
}
if (sshbuf_len(v1->field_20) >= a4) {
v4 = ssh_packet_stop_discard(a0);
return;
}
v1->field_1c4 = a4 - sshbuf_len(v1->field_20);
v5 = 0;
return;
}
v0 = sshpkt_disconnect();
v3 = (!v0 ? v0 : 4294967266);
return;
} | openssh-portable | angr_sailr |
static void pr_forward_ed_hunk(struct change *hunk) {
lin i, f0, l0, f1, l1;
enum changes changes = analyze_hunk(hunk, &f0, &l0, &f1, &l1);
if (!changes)
return;
begin_output();
fputc_unlocked(change_letter[changes], outfile);
print_number_range(' ', files, f0, l0);
fputc_unlocked('\n', outfile);
if (changes == OLD)
return;
for (i = f1; i <= l1; i++)
print_1_line("", &files[1].linbuf[i]);
fputs_unlocked(".\n", outfile);
} | long long pr_forward_ed_hunk(unsigned long long a0) {
unsigned int v0;
char v1;
char v2;
char v3;
char v4;
unsigned long long v5;
v0 = analyze_hunk(a0, &v1, &v2, &v3, &v4);
if (v0) {
begin_output();
fputc_unlocked(*(v0 + &change_letter), outfile);
print_number_range(0x20, 0x500028, *(&v1), *(&v2));
fputc_unlocked(0xa, outfile);
if (v0 != 1) {
for (v5 = *(&v3); v5 <= *(&v4); v5 += 1) {
print_1_line(&g_4004e5, *(5243408) + v5 * 8, v5 * 8);
}
fputs_unlocked(".\n", outfile);
}
}
return 0;
} | diffutils | angr_dream |
char *expand_assignment_string_to_string(string, quoted)
char *string;
int quoted;
{
return (expand_string_to_string_internal(string, quoted,
expand_string_assignment));
} | void expand_assignment_string_to_string(undefined8 param_1, undefined4 param_2)
{
expand_string_to_string_internal(param_1, param_2, expand_string_assignment);
return;
} | bash | ghidra |
static errcode_t calculate_tree(ext2_filsys fs, struct out_dir *outdir,
ext2_ino_t ino, ext2_ino_t parent,
struct ext2_inode *inode) {
struct ext2_dx_root_info *root_info;
struct ext2_dx_entry *root, *int_ent, *dx_ent = 0;
struct ext2_dx_countlimit *root_limit, *int_limit, *limit;
errcode_t retval;
int i, c1, c2, c3, nblks;
int limit_offset, int_offset, root_offset;
root_info = set_root_node(fs, outdir->buf, ino, parent, inode);
root_offset = limit_offset =
((char *)root_info - outdir->buf) + root_info->info_length;
root_limit = (struct ext2_dx_countlimit *)(outdir->buf + limit_offset);
c1 = root_limit->limit;
nblks = outdir->num;
if (nblks - 1 <= c1) {
root = (struct ext2_dx_entry *)(outdir->buf + root_offset);
for (i = 1; i < nblks; i++) {
root->block = ((__le32)(__u32)(i));
if (i != 1)
root->hash = ((__le32)(__u32)(outdir->hashes[i]));
root++;
c1--;
}
} else if (nblks - 1 <= ext2fs_htree_intnode_maxrecs(fs, c1)) {
c2 = 0;
limit = ((void *)0);
root_info->indirect_levels = 1;
for (i = 1; i < nblks; i++) {
if (c2 == 0 && c1 == 0)
return 28;
if (c2 == 0) {
retval = alloc_blocks(fs, &limit, &root, &dx_ent, &root_offset,
((void *)0), outdir, i, &c1, &c2);
if (retval)
return retval;
}
dx_ent->block = ((__le32)(__u32)(i));
if (c2 != limit->limit)
dx_ent->hash = ((__le32)(__u32)(outdir->hashes[i]));
dx_ent++;
c2--;
}
limit->count = ((__le16)(__u16)(limit->limit - c2));
limit->limit = ((__le16)(__u16)(limit->limit));
} else {
c2 = 0;
c3 = 0;
limit = ((void *)0);
int_limit = 0;
root_info->indirect_levels = 2;
for (i = 1; i < nblks; i++) {
if (c3 == 0 && c2 == 0 && c1 == 0)
return 28;
if (c3 == 0 && c2 == 0) {
retval = alloc_blocks(fs, &int_limit, &root, &int_ent, &root_offset,
&int_offset, outdir, i, &c1, &c2);
if (retval)
return retval;
}
if (c3 == 0) {
int delta1 = (char *)int_limit - outdir->buf;
int delta2 = (char *)root - outdir->buf;
retval = alloc_blocks(fs, &limit, &int_ent, &dx_ent, &int_offset,
((void *)0), outdir, i, &c2, &c3);
if (retval)
return retval;
int_limit = (struct ext2_dx_countlimit *)(outdir->buf + delta1);
root = (struct ext2_dx_entry *)(outdir->buf + delta2);
}
dx_ent->block = ((__le32)(__u32)(i));
if (c3 != limit->limit)
dx_ent->hash = ((__le32)(__u32)(outdir->hashes[i]));
dx_ent++;
c3--;
}
int_limit->count = ((__le16)(__u16)(limit->limit - c2));
int_limit->limit = ((__le16)(__u16)(limit->limit));
limit->count = ((__le16)(__u16)(limit->limit - c3));
limit->limit = ((__le16)(__u16)(limit->limit));
}
root_limit = (struct ext2_dx_countlimit *)(outdir->buf + limit_offset);
root_limit->count = ((__le16)(__u16)(root_limit->limit - c1));
root_limit->limit = ((__le16)(__u16)(root_limit->limit));
return 0;
} | int calculate_tree(void *a0, struct_0 *a1, unsigned long a2, unsigned long a3,
void *a4) {
unsigned int v0;
unsigned int v1;
unsigned int v2;
char v3;
unsigned int v4;
unsigned int v5;
unsigned int v6;
unsigned int v7;
unsigned int v8;
unsigned int v9;
unsigned int v10[2];
char v11;
void *v12;
void *v13;
void *v14;
char v15[7];
unsigned short *v16;
unsigned long v17;
unsigned int v19;
v12 = 0;
*(&v15) = set_root_node(a0, a1->field_8, a2, a3, a4);
v6 = v15[5] + &v15[-1 * a1->field_8];
v4 = v6;
v16 = v6 + a1->field_8;
v0 = *(v16);
v7 = a1->field_0;
if (v7 - 1 <= v0) {
*(&v10[0]) = v4 + a1->field_8;
for (v5 = 1; v5 < v7; v5 += 1) {
v10[1] = v5;
if (v5 != 1)
v10[0] = *((v5 * 4 + a1->field_10));
*(&v10[0]) = v10 + 1;
v0 -= 1;
}
} else if (v7 - 1 > ext2fs_htree_intnode_maxrecs(a0, v0, v0)) {
v1 = 0;
v2 = 0;
v14 = 0;
v13 = 0;
v15[6] = 2;
v5 = 1;
while (true) {
if (v5 >= v7) {
*(&v13[2]) = *(v14)-v1;
*(v13) = *(v14);
*(&v14[2]) = *(v14)-v2;
*(v14) = *(v14);
break;
} else {
if (!v2 && !v1 && !v0) {
v19 = 28;
goto LABEL_4027e2;
}
if (!v2 && !v1) {
v17 = alloc_blocks(a0, &v13, &v10, &v11, &v4, &v3, a1, v5, &v0, &v1);
if (v17) {
v19 = v17;
goto LABEL_4027e2;
}
}
if (!v2) {
v8 = (v13 - a1->field_8);
v9 = (v10 + -1 * a1->field_8);
v17 = alloc_blocks(a0, &v14, &v11, &v12, &v3, NULL, a1, v5, &v1, &v2);
if (!v17) {
v13 = v8 + a1->field_8;
v10 = v9 + a1->field_8;
} else {
v19 = v17;
goto LABEL_4027e2;
}
}
*(&v12[4]) = v5;
if (*(v14) != v2)
*(v12) = *((v5 * 4 + a1->field_10));
v12 += 8;
v2 -= 1;
v5 += 1;
}
}
} else {
v1 = 0;
v14 = 0;
v15[6] = 1;
v5 = 1;
while (true) {
if (v5 >= v7) {
*(&v14[2]) = *(v14)-v1;
*(v14) = *(v14);
break;
} else {
if (!v1 && !v0) {
v19 = 28;
goto LABEL_4027e2;
}
if (!v1) {
v17 = alloc_blocks(a0, &v14, &v10, &v12, &v4, NULL, a1, v5, &v0, &v1);
if (v17) {
v19 = v17;
goto LABEL_4027e2;
}
}
*(&v12[4]) = v5;
if (*(v14) != v1)
*(v12) = *((v5 * 4 + a1->field_10));
v12 += 8;
v1 -= 1;
v5 += 1;
}
}
}
*(&v16) = v6 + a1->field_8;
v16[1] = *(v16)-v0;
v16[0] = v16[0];
v19 = 0;
LABEL_4027e2:
return v19;
} | e2fsprogs-1.46.5 | angr_phoenix |
static struct sshbuf *reply_error(int r, char *fmt, ...) {
char *msg;
va_list ap;
struct sshbuf *resp;
__builtin_va_start(ap, fmt);
xvasprintf(&msg, fmt, ap);
__builtin_va_end(ap);
sshlog("ssh-sk-helper.c", __func__, 66, 0, SYSLOG_LEVEL_DEBUG1, ((void *)0),
"%s: %s", __progname, msg);
free(msg);
if (r >= 0)
sshfatal("ssh-sk-helper.c", __func__, 70, 1, SYSLOG_LEVEL_FATAL,
((void *)0), "invalid error code %d", r);
if ((resp = sshbuf_new()) == ((void *)0))
sshfatal("ssh-sk-helper.c", __func__, 73, 0, SYSLOG_LEVEL_FATAL,
((void *)0), "%s: sshbuf_new failed", __progname);
if (sshbuf_put_u32(resp, 0) != 0 || sshbuf_put_u32(resp, (u_int)-r) != 0)
sshfatal("ssh-sk-helper.c", __func__, 76, 0, SYSLOG_LEVEL_FATAL,
((void *)0), "%s: buffer error", __progname);
return resp;
} | long reply_error(undefined4 param_1, undefined4 param_2, undefined4 param_3,
undefined4 param_4, undefined4 param_5, undefined4 param_6,
undefined4 param_7, undefined4 param_8, uint param_9,
undefined8 param_10, undefined8 param_11, undefined8 param_12,
undefined8 param_13, undefined8 param_14)
{
char in_AL;
int iVar1;
undefined4 uVar2;
char **ppcVar3;
undefined *puVar4;
undefined *puVar5;
long in_FS_OFFSET;
char *apcStackY304[3];
char *pcStack264;
ulong uStack256;
undefined8 local_f8;
uint local_ec;
char *local_e8;
long local_e0;
undefined4 local_d8;
undefined4 local_d4;
undefined *local_d0;
undefined *local_c8;
long local_c0;
undefined local_b8[16];
undefined8 local_a8;
undefined8 local_a0;
undefined8 local_98;
undefined8 local_90;
undefined4 local_88;
undefined4 local_78;
undefined4 local_68;
undefined4 local_58;
undefined4 local_48;
undefined4 local_38;
undefined4 local_28;
undefined4 local_18;
ppcVar3 = (char **)&local_f8;
if (in_AL != '\0') {
local_88 = param_1;
local_78 = param_2;
local_68 = param_3;
local_58 = param_4;
local_48 = param_5;
local_38 = param_6;
local_28 = param_7;
local_18 = param_8;
}
local_c0 = *(long *)(in_FS_OFFSET + 0x28);
local_d8 = 0x10;
local_d4 = 0x30;
local_d0 = &stack0x00000008;
local_c8 = local_b8;
uStack256 = 0x1000bb;
local_f8 = param_10;
local_ec = param_9;
local_a8 = param_11;
local_a0 = param_12;
local_98 = param_13;
local_90 = param_14;
xvasprintf(&local_e8, param_10, &local_d8);
pcStack264 = local_e8;
sshlog("ssh-sk-helper.c", "reply_error", 0x42, 0, 5, 0, "%s: %s", __progname);
uStack256 = 0x100118;
free(local_e8);
if (-1 < (int)local_ec) {
uStack256 = (ulong)local_ec;
ppcVar3 = (char **)&stack0xfffffffffffffef8;
pcStack264 = "invalid error code %d";
sshfatal("ssh-sk-helper.c", "reply_error", 0x46, 1, 1, 0);
}
*(undefined8 *)((long)ppcVar3 + -8) = 0x100163;
local_e0 = sshbuf_new();
puVar4 = (undefined *)ppcVar3;
if (local_e0 == 0) {
*(undefined8 *)((long)ppcVar3 + -8) = __progname;
puVar4 = (undefined *)((long)ppcVar3 + -0x10);
*(char **)((long)ppcVar3 + -0x10) = "%s: sshbuf_new failed";
*(undefined8 *)((long)ppcVar3 + -0x18) = 0x1001b2;
sshfatal("ssh-sk-helper.c", "reply_error", 0x49, 0, 1, 0);
}
*(undefined8 *)(puVar4 + -8) = 0x1001c6;
iVar1 = sshbuf_put_u32(local_e0, 0);
if (iVar1 == 0) {
*(undefined8 *)(puVar4 + -8) = 0x1001d5;
uVar2 = __negvsi2(local_ec);
*(undefined8 *)(puVar4 + -8) = 0x1001e8;
iVar1 = sshbuf_put_u32(local_e0, uVar2);
puVar5 = puVar4;
if (iVar1 == 0)
goto LAB_0010022a;
}
*(undefined8 *)(puVar4 + -8) = __progname;
puVar5 = puVar4 + -0x10;
*(char **)(puVar4 + -0x10) = "%s: buffer error";
*(undefined8 *)(puVar4 + -0x18) = 0x10022a;
sshfatal("ssh-sk-helper.c", "reply_error", 0x4c, 0, 1, 0);
LAB_0010022a:
if (local_c0 != *(long *)(in_FS_OFFSET + 0x28)) {
*(undefined8 *)(puVar5 + -8) = 0x100248;
__stack_chk_fail();
}
return local_e0;
} | openssh-portable | ghidra |
char *username_completion_function(const char *text, int state) {
struct passwd *pass = ((void *)0);
if (text[0] == '\0')
return ((void *)0);
if (*text == '~')
text++;
if (state == 0)
setpwent();
while ((pass = getpwent()) != ((void *)0)
&& text[0] == pass->pw_name[0] && strcmp(text, pass->pw_name) == 0)
continue;
if (pass == ((void *)0)) {
endpwent();
return ((void *)0);
}
return strdup(pass->pw_name);
} | long long username_completion_function(unsigned long long a0,
unsigned long a1) {
char *v0;
char **v1;
void *v3;
v0 = a0;
v1 = 0;
if (!*(v0)) {
v3 = 0;
} else {
if (*(v0) == 126)
v0 += 1;
if (!a1)
setpwent();
while (true) {
v1 = &getpwent()->pw_name;
if (!v1)
break;
if (*(v0) != *(*(v1)))
break;
if (strcmp(v0))
break;
}
if (v1) {
v3 = strdup(*(v1));
} else {
endpwent();
v3 = 0;
}
}
return v3;
} | libedit | angr_phoenix |
static void channel_prepare_pollfd(Channel *c, u_int *next_pollfd,
struct pollfd *pfd, u_int npfd) {
u_int ev, p = *next_pollfd;
if (c == ((void *)0))
return;
if (p + 4 > npfd) {
sshfatal("channels.c", __func__, 2511, 1, SYSLOG_LEVEL_FATAL, ((void *)0),
"channel %d: bad pfd offset %u (max %u)", c->self, p, npfd);
}
c->pfds[0] = c->pfds[1] = c->pfds[2] = c->pfds[3] = -1;
if (c->rfd != -1) {
ev = 0;
if ((c->io_want & 0x01) != 0)
ev |= 0x001;
if (c->wfd == c->rfd) {
if ((c->io_want & 0x02) != 0)
ev |= 0x004;
}
if (c->efd == c->rfd) {
if ((c->io_want & 0x04) != 0)
ev |= 0x001;
if ((c->io_want & 0x08) != 0)
ev |= 0x004;
}
if (c->sock == c->rfd) {
if ((c->io_want & 0x10) != 0)
ev |= 0x001;
if ((c->io_want & 0x20) != 0)
ev |= 0x004;
}
if (ev != 0) {
c->pfds[0] = p;
pfd[p].fd = c->rfd;
pfd[p].events = ev;
dump_channel_poll(__func__, "rfd", c, p, &pfd[p]);
p++;
}
}
if (c->wfd != -1 && c->rfd != c->wfd) {
ev = 0;
if ((c->io_want & 0x02))
ev |= 0x004;
if (ev != 0) {
c->pfds[1] = p;
pfd[p].fd = c->wfd;
pfd[p].events = ev;
dump_channel_poll(__func__, "wfd", c, p, &pfd[p]);
p++;
}
}
if (c->efd != -1 && c->rfd != c->efd) {
ev = 0;
if ((c->io_want & 0x04) != 0)
ev |= 0x001;
if ((c->io_want & 0x08) != 0)
ev |= 0x004;
if (ev != 0) {
c->pfds[2] = p;
pfd[p].fd = c->efd;
pfd[p].events = ev;
dump_channel_poll(__func__, "efd", c, p, &pfd[p]);
p++;
}
}
if (c->sock != -1 && c->rfd != c->sock) {
ev = 0;
if ((c->io_want & 0x10) != 0)
ev |= 0x001;
if ((c->io_want & 0x20) != 0)
ev |= 0x004;
if (ev != 0) {
c->pfds[3] = p;
pfd[p].fd = c->sock;
pfd[p].events = 0;
dump_channel_poll(__func__, "sock", c, p, &pfd[p]);
p++;
}
}
*next_pollfd = p;
} | void channel_prepare_pollfd(unsigned int a0[17], unsigned int *a1,
unsigned int *a2, unsigned long a3) {
unsigned long long v0;
unsigned long v1;
unsigned long v2;
unsigned long v3;
unsigned int v4;
unsigned int v5;
unsigned long long v7;
unsigned int *v8;
v7 = *(a1);
v5 = *(a1);
if (!a0)
return;
if (a3 < v5 + 4) {
v3 = a3;
v2 = v5;
v1 = a0[1];
v0 = "channel %d: bad pfd offset %u (max %u)";
sshfatal("channels.c", "channel_prepare_pollfd", 0x9cf, 0x1, 0x1, 0x0);
}
a0[16] = -1;
a0[15] = a0[16];
a0[14] = a0[15];
a0[13] = a0[14];
if (a0[7] != -1) {
v4 = 0;
if ((a0[11] & 1))
v4 |= 1;
if (a0[8] == a0[7] && (a0[11] & 2))
v4 |= 4;
if (a0[9] == a0[7]) {
if ((a0[11] & 4))
v4 |= 1;
if ((a0[11] & 8))
v4 |= 4;
}
if (a0[10] == a0[7]) {
if ((a0[11] & 16))
v4 |= 1;
if ((a0[11] & 32))
v4 |= 4;
}
if (v4) {
a0[13] = v5;
a2[2 * v5] = a0[7];
*(&a2[1 + 2 * v5]) = v4;
dump_channel_poll("channel_prepare_pollfd", "rfd", a0, v5, &a2[2 * v5]);
v5 += 1;
}
}
if (a0[8] != -1 && a0[7] != a0[8]) {
v4 = 0;
if ((a0[11] & 2))
v4 |= 4;
if (v4) {
a0[14] = v5;
a2[2 * v5] = a0[8];
*(&a2[1 + 2 * v5]) = v4;
dump_channel_poll("channel_prepare_pollfd", "wfd", a0, v5, &a2[2 * v5]);
v5 += 1;
}
}
if (a0[9] != -1 && a0[7] != a0[9]) {
v4 = 0;
if ((a0[11] & 4))
v4 |= 1;
if ((a0[11] & 8))
v4 |= 4;
if (v4) {
a0[15] = v5;
a2[2 * v5] = a0[9];
*(&a2[1 + 2 * v5]) = v4;
dump_channel_poll("channel_prepare_pollfd", "efd", a0, v5, &a2[2 * v5]);
v5 += 1;
}
}
if (a0[10] != -1 && a0[7] != a0[10]) {
v4 = 0;
if ((a0[11] & 16))
v4 |= 1;
if ((a0[11] & 32))
v4 |= 4;
if (v4) {
a0[16] = v5;
a2[2 * v5] = a0[10];
*(&a2[1 + 2 * v5]) = 0;
dump_channel_poll("channel_prepare_pollfd", "sock", a0, v5, &a2[2 * v5]);
v5 += 1;
}
}
v8 = a1;
*(a1) = v5;
return;
} | openssh-portable | angr_sailr |
static COMMAND *make_for_or_select(type, name, map_list, action,
lineno) enum command_type type;
WORD_DESC *name;
WORD_LIST *map_list;
COMMAND *action;
int lineno;
{
FOR_COM *temp;
temp = (FOR_COM *)sh_xmalloc((sizeof(FOR_COM)), "make_cmd.c", 209);
temp->flags = 0;
temp->name = name;
temp->line = lineno;
temp->map_list = map_list;
temp->action = action;
return (make_command(type, (SIMPLE_COM *)temp));
} | long make_for_or_select(int a1, long a2, long a3, long a4, int a5) {
long v9;
v9 = sh_xmalloc(32LL, "make_cmd.c", 209LL);
*(_DWORD *)v9 = 0;
*(_QWORD *)(v9 + 8) = a2;
*(_DWORD *)(v9 + 4) = a5;
*(_QWORD *)(v9 + 16) = a3;
*(_QWORD *)(v9 + 24) = a4;
return make_command(a1, v9);
} | bash | ida |
static rsRetVal preprocessBatch(batch_t *pBatch, int *pbShutdownImmediate) {
prop_t *ip;
prop_t *fqdn;
prop_t *localName;
int bIsPermitted;
smsg_t *pMsg;
int i;
rsRetVal localRet;
rsRetVal iRet = RS_RET_OK;
for (i = 0; i < pBatch->nElem && !*pbShutdownImmediate; i++) {
pMsg = pBatch->pElem[i].pMsg;
if ((pMsg->msgFlags & 0x080) != 0) {
if (Debug) {
r_dbgprintf("rsyslogd.c", "msgConsumer: UDP ACL must be checked for "
"message (hostname-based)\n");
};
if (net.cvthname(pMsg->rcvFrom.pfrominet, &localName, &fqdn, &ip) !=
RS_RET_OK)
continue;
bIsPermitted = net.isAllowedSender2(
(uchar *)"UDP", (struct sockaddr *)pMsg->rcvFrom.pfrominet,
(char *)propGetSzStr(fqdn), 1);
if (!bIsPermitted) {
if (Debug) {
r_dbgprintf(
"rsyslogd.c",
"Message from '%s' discarded, not a permitted sender host\n",
propGetSzStr(fqdn));
};
pBatch->eltState[i] = 4;
} else {
MsgSetRcvFrom(pMsg, localName);
if ((iRet = MsgSetRcvFromIP(pMsg, ip)) != RS_RET_OK)
goto finalize_it;
pMsg->msgFlags &= ~0x080;
}
}
if ((pMsg->msgFlags & 0x010) != 0) {
if ((localRet = parser.ParseMsg(pMsg)) != RS_RET_OK) {
if (Debug) {
r_dbgprintf("rsyslogd.c", "Message discarded, parsing error %d\n",
localRet);
};
pBatch->eltState[i] = 4;
}
}
}
finalize_it:
return iRet;
} | void preprocessBatch(struct_0 *a0, unsigned int *a1) {
unsigned int v0;
unsigned int v1;
unsigned int v2;
unsigned int v3;
char v4;
char v5;
char v6;
struct_1 *v7;
unsigned int v9;
unsigned long long v10;
v1 = 0;
v0 = 0;
while (true) {
if (v0 >= a0->field_4) {
LABEL_401233:
break;
} else {
if (!(!*(a1)))
goto LABEL_401233;
v7 = *((a0->field_18 + v0 * 8));
if ((v7->field_58 & 128)) {
if (Debug)
r_dbgprintf("rsyslogd.c",
"msgConsumer: UDP ACL must be checked for message "
"(hostname-based)\n",
v0 * 8);
if (!(!g_4044e8(v7->field_f8, &v6, &v5, &v4, g_4044e8)))
goto LABEL_401210;
v2 = *(4212064)("UDP", v7->field_f8, propGetSzStr(*(&v5)), 1);
if (!v2) {
if (Debug)
r_dbgprintf(
"rsyslogd.c",
"Message from '%s' discarded, not a permitted sender host\n",
propGetSzStr(*(&v5)));
*((v0 + a0->field_20)) = 4;
} else {
MsgSetRcvFrom(v7, *(&v6), *(&v6));
v1 = MsgSetRcvFromIP(v7, *(&v4), *(&v4));
if (v1)
break;
v9 = v7->field_58;
*(&v9) = v7->field_58 & 127;
v7->field_58 = v9;
}
}
if ((v7->field_58 & 16)) {
v3 = *(4211744)(v7);
if (v3) {
if (Debug)
r_dbgprintf("rsyslogd.c", "Message discarded, parsing error %d\n",
v3);
*((v0 + a0->field_20)) = 4;
}
}
LABEL_401210:
v0 += 1;
}
}
v10 = v1;
return;
} | rsyslog-8.2210.0 | angr_phoenix |
static void terminal_setflags(EditLine *el) {
(el)->el_terminal.t_flags = 0;
if (el->el_tty.t_tabs)
(el)->el_terminal.t_flags |=
(el->el_terminal.t_val[1] && !el->el_terminal.t_val[5]) ? 0x008 : 0;
(el)->el_terminal.t_flags |=
(el->el_terminal.t_val[4] || el->el_terminal.t_val[7]) ? 0x040 : 0;
(el)->el_terminal.t_flags |= (el->el_terminal.t_str[3] != ((void *)0) &&
el->el_terminal.t_str[3][0] != '\0')
? 0x004
: 0;
(el)->el_terminal.t_flags |= ((el->el_terminal.t_str[6] != ((void *)0) &&
el->el_terminal.t_str[6][0] != '\0') ||
(el->el_terminal.t_str[30] != ((void *)0) &&
el->el_terminal.t_str[30][0] != '\0'))
? 0x002
: 0;
(el)->el_terminal.t_flags |= ((el->el_terminal.t_str[14] != ((void *)0) &&
el->el_terminal.t_str[14][0] != '\0') ||
(el->el_terminal.t_str[13] != ((void *)0) &&
el->el_terminal.t_str[13][0] != '\0') ||
(el->el_terminal.t_str[32] != ((void *)0) &&
el->el_terminal.t_str[32][0] != '\0'))
? 0x001
: 0;
(el)->el_terminal.t_flags |= ((el->el_terminal.t_str[26] != ((void *)0) &&
el->el_terminal.t_str[26][0] != '\0') ||
(el->el_terminal.t_str[35] != ((void *)0) &&
el->el_terminal.t_str[35][0] != '\0'))
? 0x020
: 0;
(el)->el_terminal.t_flags |= el->el_terminal.t_val[0] ? 0x080 : 0;
(el)->el_terminal.t_flags |= el->el_terminal.t_val[6] ? 0x100 : 0;
if ((el->el_terminal.t_str[21] != ((void *)0) &&
el->el_terminal.t_str[21][0] != '\0') &&
(el->el_terminal.t_str[28] != ((void *)0) &&
el->el_terminal.t_str[28][0] != '\0'))
(el)->el_terminal.t_flags |=
(strcmp(el->el_terminal.t_str[21], el->el_terminal.t_str[28]) == 0)
? 0x010
: 0;
else
(el)->el_terminal.t_flags &= ~0x010;
if ((el->el_terminal.t_str[21] != ((void *)0) &&
el->el_terminal.t_str[21][0] != '\0') &&
(el->el_terminal.t_str[23] != ((void *)0) &&
el->el_terminal.t_str[23][0] != '\0'))
(el)->el_terminal.t_flags |=
(strcmp(el->el_terminal.t_str[21], el->el_terminal.t_str[23]) == 0)
? 0x010
: 0;
} | void terminal_setflags(long param_1)
{
uint uVar1;
int iVar2;
uint uVar3;
*(undefined4 *)(param_1 + 0x98) = 0;
if (*(int *)(param_1 + 0x2fc) != 0) {
if ((*(int *)(*(long *)(param_1 + 0xb8) + 4) == 0) ||
(*(int *)(*(long *)(param_1 + 0xb8) + 0x14) != 0)) {
uVar1 = 0;
} else {
uVar1 = 8;
}
*(uint *)(param_1 + 0x98) = *(uint *)(param_1 + 0x98) | uVar1;
}
if ((*(int *)(*(long *)(param_1 + 0xb8) + 0x10) == 0) &&
(*(int *)(*(long *)(param_1 + 0xb8) + 0x1c) == 0)) {
uVar1 = 0;
} else {
uVar1 = 0x40;
}
*(uint *)(param_1 + 0x98) = *(uint *)(param_1 + 0x98) | uVar1;
if ((*(long *)(*(long *)(param_1 + 0xb0) + 0x18) == 0) ||
(**(char **)(*(long *)(param_1 + 0xb0) + 0x18) == '\0')) {
uVar1 = 0;
} else {
uVar1 = 4;
}
*(uint *)(param_1 + 0x98) = *(uint *)(param_1 + 0x98) | uVar1;
if (((*(long *)(*(long *)(param_1 + 0xb0) + 0x30) == 0) ||
(**(char **)(*(long *)(param_1 + 0xb0) + 0x30) == '\0')) &&
((*(long *)(*(long *)(param_1 + 0xb0) + 0xf0) == 0 ||
(**(char **)(*(long *)(param_1 + 0xb0) + 0xf0) == '\0')))) {
uVar1 = 0;
} else {
uVar1 = 2;
}
*(uint *)(param_1 + 0x98) = *(uint *)(param_1 + 0x98) | uVar1;
if ((((*(long *)(*(long *)(param_1 + 0xb0) + 0x70) == 0) ||
(**(char **)(*(long *)(param_1 + 0xb0) + 0x70) == '\0')) &&
((*(long *)(*(long *)(param_1 + 0xb0) + 0x68) == 0 ||
(**(char **)(*(long *)(param_1 + 0xb0) + 0x68) == '\0')))) &&
((*(long *)(*(long *)(param_1 + 0xb0) + 0x100) == 0 ||
(**(char **)(*(long *)(param_1 + 0xb0) + 0x100) == '\0')))) {
uVar1 = 0;
} else {
uVar1 = 1;
}
*(uint *)(param_1 + 0x98) = *(uint *)(param_1 + 0x98) | uVar1;
if (((*(long *)(*(long *)(param_1 + 0xb0) + 0xd0) == 0) ||
(**(char **)(*(long *)(param_1 + 0xb0) + 0xd0) == '\0')) &&
((*(long *)(*(long *)(param_1 + 0xb0) + 0x118) == 0 ||
(**(char **)(*(long *)(param_1 + 0xb0) + 0x118) == '\0')))) {
uVar1 = 0;
} else {
uVar1 = 0x20;
}
*(uint *)(param_1 + 0x98) = *(uint *)(param_1 + 0x98) | uVar1;
if (**(int **)(param_1 + 0xb8) == 0) {
uVar1 = 0;
} else {
uVar1 = 0x80;
}
*(uint *)(param_1 + 0x98) = *(uint *)(param_1 + 0x98) | uVar1;
if (*(int *)(*(long *)(param_1 + 0xb8) + 0x18) == 0) {
uVar1 = 0;
} else {
uVar1 = 0x100;
}
*(uint *)(param_1 + 0x98) = *(uint *)(param_1 + 0x98) | uVar1;
if ((((*(long *)(*(long *)(param_1 + 0xb0) + 0xa8) == 0) ||
(**(char **)(*(long *)(param_1 + 0xb0) + 0xa8) == '\0')) ||
(*(long *)(*(long *)(param_1 + 0xb0) + 0xe0) == 0)) ||
(**(char **)(*(long *)(param_1 + 0xb0) + 0xe0) == '\0')) {
*(uint *)(param_1 + 0x98) = *(uint *)(param_1 + 0x98) & 0xffffffef;
} else {
uVar1 = *(uint *)(param_1 + 0x98);
iVar2 = strcmp(*(char **)(*(long *)(param_1 + 0xb0) + 0xa8),
*(char **)(*(long *)(param_1 + 0xb0) + 0xe0));
if (iVar2 == 0) {
uVar3 = 0x10;
} else {
uVar3 = 0;
}
*(uint *)(param_1 + 0x98) = uVar3 | uVar1;
}
if (((*(long *)(*(long *)(param_1 + 0xb0) + 0xa8) != 0) &&
(**(char **)(*(long *)(param_1 + 0xb0) + 0xa8) != '\0')) &&
((*(long *)(*(long *)(param_1 + 0xb0) + 0xb8) != 0 &&
(**(char **)(*(long *)(param_1 + 0xb0) + 0xb8) != '\0')))) {
uVar1 = *(uint *)(param_1 + 0x98);
iVar2 = strcmp(*(char **)(*(long *)(param_1 + 0xb0) + 0xa8),
*(char **)(*(long *)(param_1 + 0xb0) + 0xb8));
if (iVar2 == 0) {
uVar3 = 0x10;
} else {
uVar3 = 0;
}
*(uint *)(param_1 + 0x98) = uVar3 | uVar1;
}
return;
} | libedit | ghidra |
static void usage(int status) {
FILE *usageout = (0 != status) ? stderr : stdout;
(void)fprintf(usageout,
gettext("Usage: %s [options]\n"
"\n"
"Options:\n")
,
Prog);
(void)fputs(gettext(" -b, --badname allow bad names\n"),
usageout);
(void)fprintf(
usageout,
gettext(" -c, --crypt-method METHOD the crypt method (one of %s)\n"),
"NONE DES MD5"
" SHA256 SHA512"
);
(void)fputs(gettext(" -h, --help display this help "
"message and exit\n"),
usageout);
(void)fputs(
gettext(" -r, --system create system accounts\n"),
usageout);
(void)fputs(
gettext(" -R, --root CHROOT_DIR directory to chroot into\n"),
usageout);
(void)fputs(
gettext(" -s, --sha-rounds number of rounds for the SHA, "
"BCRYPT\n"
" or YESCRYPT crypt algorithms\n"),
usageout);
(void)fputs("\n", usageout);
exit(status);
} | void usage(int param_1)
{
undefined8 uVar1;
FILE *__stream;
char *pcVar2;
uVar1 = Prog;
__stream = stdout;
if (param_1 != 0) {
__stream = stderr;
}
pcVar2 = (char *)gettext("Usage: %s [options]\n\nOptions:\n");
fprintf(__stream, pcVar2, uVar1);
pcVar2 = (char *)gettext(" -b, --badname allow bad names\n");
fputs(pcVar2, __stream);
pcVar2 = (char *)gettext(
" -c, --crypt-method METHOD the crypt method (one of %s)\n");
fprintf(__stream, pcVar2, "NONE DES MD5 SHA256 SHA512");
pcVar2 = (char *)gettext(
" -h, --help display this help message and exit\n");
fputs(pcVar2, __stream);
pcVar2 = (char *)gettext(
" -r, --system create system accounts\n");
fputs(pcVar2, __stream);
pcVar2 = (char *)gettext(
" -R, --root CHROOT_DIR directory to chroot into\n");
fputs(pcVar2, __stream);
pcVar2 = (char *)gettext(
" -s, --sha-rounds number of rounds for the SHA, BCRYPT\n "
" or YESCRYPT crypt algorithms\n");
fputs(pcVar2, __stream);
fputs("\n", __stream);
exit(param_1);
} | shadow | ghidra |
static char **splitbuf_finishup(struct splitbuf *ss) {
int argc = ss->argc;
char **argv = ss->argv;
char *stringbase = (char *)(ss->argv + ss->half_alloc);
for (int i = 1; i < argc; i++)
argv[i] = stringbase + (intptr_t)argv[i];
return argv;
} | void splitbuf_finishup(struct_0 *a0) {
unsigned int v0;
unsigned int v1;
unsigned long long *v2;
unsigned long v3;
unsigned long long *v5;
v1 = a0->field_8;
v2 = a0->field_0;
v3 = a0->field_10 * 8 + a0->field_0;
for (v0 = 1; v0 < v1; v0 += 1) {
v2[v0] = v3 + v2[v0];
}
v5 = v2;
return;
} | coreutils | angr_phoenix |
static _Bool
disable_core_dumps(void) {
if (prctl(4, 0) == 0)
return 1;
error(0, (*__errno_location()),
gettext("warning: disabling core dumps failed"));
return 0;
} | int disable_core_dumps() {
unsigned int v1;
if (!prctl(0x4, 0x0)) {
v1 = 1;
} else {
error(0x0, *(__errno_location()),
gettext("warning: disabling core dumps failed"));
v1 = 0;
}
return v1;
} | coreutils | angr_phoenix |
kwset_t kwsalloc(char const *trans) {
struct kwset *kwset = xmalloc(sizeof *kwset);
_obstack_begin((&kwset->obstack), 0, 0, (xmalloc), (free));
kwset->words = 0;
kwset->trie = __extension__({
struct obstack *__h = (&kwset->obstack);
__extension__({
struct obstack *__o = (__h);
size_t __len = ((sizeof *kwset->trie));
if (__extension__({
struct obstack const *__o1 = (__o);
(size_t)(__o1->chunk_limit - __o1->next_free);
}) < __len)
_obstack_newchunk(__o, __len);
((void)((__o)->next_free += (__len)));
});
__extension__({
struct obstack *__o1 = (__h);
void *__value = (void *)__o1->object_base;
if (__o1->next_free == __value)
__o1->maybe_empty_object = 1;
__o1->next_free =
((sizeof(ptrdiff_t) < sizeof(void *) ? (__o1->object_base)
: (char *)0) +
(((__o1->next_free) -
(sizeof(ptrdiff_t) < sizeof(void *) ? (__o1->object_base)
: (char *)0) +
(__o1->alignment_mask)) &
~(__o1->alignment_mask)));
if ((size_t)(__o1->next_free - (char *)__o1->chunk) >
(size_t)(__o1->chunk_limit - (char *)__o1->chunk))
__o1->next_free = __o1->chunk_limit;
__o1->object_base = __o1->next_free;
__value;
});
});
kwset->trie->accepting = 0;
kwset->trie->links = ((void *)0);
kwset->trie->parent = ((void *)0);
kwset->trie->next = ((void *)0);
kwset->trie->fail = ((void *)0);
kwset->trie->depth = 0;
kwset->trie->shift = 0;
kwset->mind = (9223372036854775807L);
kwset->target = ((void *)0);
kwset->trans = trans;
kwset->kwsexec = acexec;
return kwset;
} | long kwsalloc(undefined8 param_1)
{
long lVar1;
long lVar2;
lVar2 = xmalloc(0x9a0);
_obstack_begin(lVar2, 0, 0, uRam00000000001000af, uRam00000000001000a5);
*(undefined8 *)(lVar2 + 0x58) = 0;
if ((ulong)(*(long *)(lVar2 + 0x20) - *(long *)(lVar2 + 0x18)) < 0x40) {
_obstack_newchunk(lVar2, 0x40);
}
*(long *)(lVar2 + 0x18) = *(long *)(lVar2 + 0x18) + 0x40;
lVar1 = *(long *)(lVar2 + 0x10);
if (lVar1 == *(long *)(lVar2 + 0x18)) {
*(byte *)(lVar2 + 0x50) = *(byte *)(lVar2 + 0x50) | 2;
}
*(ulong *)(lVar2 + 0x18) = ~*(ulong *)(lVar2 + 0x30) &
*(long *)(lVar2 + 0x18) + *(long *)(lVar2 + 0x30);
if ((ulong)(*(long *)(lVar2 + 0x20) - *(long *)(lVar2 + 8)) <
(ulong)(*(long *)(lVar2 + 0x18) - *(long *)(lVar2 + 8))) {
*(undefined8 *)(lVar2 + 0x18) = *(undefined8 *)(lVar2 + 0x20);
}
*(undefined8 *)(lVar2 + 0x10) = *(undefined8 *)(lVar2 + 0x18);
*(long *)(lVar2 + 0x60) = lVar1;
**(undefined8 **)(lVar2 + 0x60) = 0;
*(undefined8 *)(*(long *)(lVar2 + 0x60) + 8) = 0;
*(undefined8 *)(*(long *)(lVar2 + 0x60) + 0x10) = 0;
*(undefined8 *)(*(long *)(lVar2 + 0x60) + 0x18) = 0;
*(undefined8 *)(*(long *)(lVar2 + 0x60) + 0x20) = 0;
*(undefined8 *)(*(long *)(lVar2 + 0x60) + 0x28) = 0;
*(undefined8 *)(*(long *)(lVar2 + 0x60) + 0x30) = 0;
*(undefined8 *)(lVar2 + 0x68) = 0x7fffffffffffffff;
*(undefined8 *)(lVar2 + 0x970) = 0;
*(undefined8 *)(lVar2 + 0x980) = param_1;
*(code **)(lVar2 + 0x998) = acexec;
return lVar2;
} | grep | ghidra |
map_addfunc(EditLine *el, const wchar_t *name, const wchar_t *help,
el_func_t func) {
void *p;
size_t nf = el->el_map.nfunc + 1;
if (name == ((void *)0) || help == ((void *)0) || func == ((void *)0))
return -1;
if ((p = realloc(el->el_map.func, nf * sizeof(*el->el_map.func))) ==
((void *)0))
return -1;
el->el_map.func = p;
if ((p = realloc(el->el_map.help, nf * sizeof(*el->el_map.help))) ==
((void *)0))
return -1;
el->el_map.help = p;
nf = (size_t)el->el_map.nfunc;
el->el_map.func[nf] = func;
el->el_map.help[nf].name = name;
el->el_map.help[nf].func = (int)nf;
el->el_map.help[nf].description = help;
el->el_map.nfunc++;
return 0;
} | long long map_addfunc(unsigned long long a0[136], unsigned long a1,
unsigned long a2, unsigned long a3) {
unsigned long long *v0;
unsigned long v1;
unsigned long long v3;
*(&v0) = a0[135] + 1;
if (!a1) {
LABEL_4014c3:
v3 = 4294967295;
} else {
if (!a2)
goto LABEL_4014c3;
if (!a3)
goto LABEL_4014c3;
v1 = realloc(a0[134], *(&v0) * 8);
if (!v1) {
v3 = 4294967295;
} else {
a0[134] = v1;
v1 = realloc(a0[133], *(&v0) * 24);
if (!v1) {
v3 = 4294967295;
} else {
a0[133] = v1;
v0 = a0[135];
*((v0 * 8 + a0[134])) = a3;
*((a0[133] + v0 * 24)) = a1;
*((v0 * 24 + a0[133] + 8)) = v0;
*((a0[133] + v0 * 24 + 16)) = a2;
a0[135] = a0[135] + 1;
v3 = 0;
}
}
}
return v3;
} | libedit | angr_phoenix |
static void inc_ea_inode_refs(e2fsck_t ctx, struct problem_context *pctx,
struct ext2_ext_attr_entry *first, void *end) {
struct ext2_ext_attr_entry *entry;
for (entry = first; (void *)entry < end && !(*((__u32 *)(entry)) == 0UL);
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 (!entry->e_value_inum)
continue;
if (!ctx->ea_inode_refs) {
pctx->errcode = ea_refcount_create(0, &ctx->ea_inode_refs);
if (pctx->errcode) {
pctx->num = 4;
fix_problem(ctx, 0x010038, pctx);
ctx->flags |= 0x0001;
return;
}
}
ea_refcount_increment(ctx->ea_inode_refs, entry->e_value_inum, 0);
}
} | unsigned int *inc_ea_inode_refs(unsigned int *a1, _QWORD *a2, unsigned int *a3,
unsigned long a4) {
unsigned int *result;
while (1) {
result = a3;
if ((unsigned long)a3 >= a4)
break;
result = (unsigned int *)*a3;
if (!(_DWORD)result)
break;
if (a3[1]) {
if (!*((_QWORD *)a1 + 61)) {
*a2 = ea_refcount_create(0LL, a1 + 122);
if (*a2) {
a2[10] = 4LL;
fix_problem(a1, 65592LL, a2);
result = a1;
a1[18] |= 1u;
return result;
}
}
ea_refcount_increment(*((_QWORD *)a1 + 61), a3[1], 0LL);
}
a3 = (unsigned int *)((char *)a3 +
((*(unsigned char *)a3 + 19) & 0xFFFFFFFC));
}
return result;
} | e2fsprogs-1.46.5 | ida |
static int ssh2_capable(int remote_major, int remote_minor) {
switch (remote_major) {
case 1:
if (remote_minor == 99)
return 1;
break;
case 2:
return 1;
default:
break;
}
return 0;
} | int ssh2_capable(unsigned long a0, unsigned long a1) {
unsigned int v1;
switch (a0) {
case 1:
if (a1 != 99) {
v1 = 0;
return v1;
}
v1 = 1;
return v1;
case 2:
v1 = 1;
return v1;
default:
v1 = 0;
return v1;
}
} | openssh-portable | angr_sailr |
static void dispose_temporary_env(pushf) sh_free_func_t *pushf;
{
int i;
HASH_TABLE *disposer;
tempvar_list =
strvec_create(((temporary_env) ? (temporary_env)->nentries : 0) + 1);
tempvar_list[tvlist_ind = 0] = 0;
disposer = temporary_env;
temporary_env = (HASH_TABLE *)((void *)0);
hash_flush(disposer, pushf);
hash_dispose(disposer);
tempvar_list[tvlist_ind] = 0;
array_needs_making = 1;
for (i = 0; i < tvlist_ind; i++)
stupidly_hack_special_variables(tempvar_list[i]);
strvec_dispose(tempvar_list);
tempvar_list = 0;
tvlist_ind = 0;
} | void dispose_temporary_env(unsigned long long a0) {
unsigned int v0;
struct_0 *v1;
unsigned long long v3;
unsigned long long v4;
if (!temporary_env)
v3 = 1;
else
v3 = temporary_env[12] + 1;
tempvar_list = strvec_create(v3);
tvlist_ind = 0;
g_58b4808ec834853 = 0;
v1 = temporary_env;
temporary_env = 0;
hash_flush(v1, a0);
hash_dispose(v1);
(&g_58b4808ec834853)[17042544940070553685] = 0;
array_needs_making = 1;
for (v0 = 0; v0 < 3850979413; v0 += 1) {
stupidly_hack_special_variables((&g_58b4808ec834853)[v0]);
}
v4 = strvec_dispose(0x58b4808ec834853);
tempvar_list = 0;
tvlist_ind = 0;
return;
} | bash | angr_phoenix |
static void check_kernel_console() {
FILE *fp;
char buf[4096];
if ((fp = fopen("/proc/cmdline", "r")) == 0) {
return;
}
if (fgets(buf, sizeof(buf), fp)) {
char *p = buf;
if (strstr(p, "init.autocon=1")) {
while ((p = strstr(p, "console="))) {
char *e;
p += strlen("console=");
for (e = p; *e; ++e) {
switch (*e) {
case '-' ... '9':
case 'A' ... 'Z':
case '_':
case 'a' ... 'z':
continue;
}
break;
}
if (p != e) {
CHILD *old;
int dup = 0;
char id[8] = {0};
char dev[32] = {0};
strncpy(dev, p,
(((sizeof(dev)) < ((unsigned)(e - p)))
? (sizeof(dev))
: ((unsigned)(e - p))));
if (!strncmp(dev, "tty", 3))
strncpy(id, dev + 3, sizeof(id));
else
strncpy(id, dev, sizeof(id));
for (old = newFamily; old; old = old->next) {
if (!strcmp(old->id, id)) {
dup = 1;
}
}
if (!dup) {
CHILD *ch = imalloc(sizeof(CHILD));
ch->action = 1;
strcpy(ch->id, id);
strcpy(ch->rlevel, "2345");
sprintf(ch->process,
"/sbin/agetty -L -s 115200,38400,9600 %s vt102", dev);
ch->next = ((void *)0);
for (old = family; old; old = old->next) {
if (strcmp(old->id, ch->id) == 0) {
old->new = ch;
break;
}
}
for (old = newFamily; old; old = old->next) {
if (!old->next) {
old->next = ch;
break;
}
}
initlog((1 | 2), "added agetty on %s with id %s", dev, id);
}
}
}
}
}
fclose(fp);
return;
} | void check_kernel_console(unsigned long a0, unsigned int a1, unsigned long a2,
unsigned long a3, unsigned int a4, unsigned int a5) {
unsigned int v0;
char *v1;
char *v2;
struct_0 *v3;
void *v4;
struct_1 *v5;
void *v6;
void *v7;
void *v8;
void *v9;
void *v10;
char v11;
unsigned long long v12;
char v13;
unsigned long long v17;
unsigned long long *v21;
unsigned long long v22;
v12 = *(&v12);
v4 = fopen("/proc/cmdline", "r");
if (v4) {
if (fgets(&v11, 0x1000, v4)) {
v1 = &v11;
if (strstr(v1, "init.autocon=1")) {
while (true) {
v1 = strstr(v1, "console=");
if (!v1)
break;
v1 += strlen("console=");
for (v2 = v1; *(v2); v2 += 1) {
if (!((*(v2) <= 122 || *(v2) <= 57) &&
(*(v2) <= 57 || *(v2) >= 65) &&
(*(v2) <= 57 ||
(288230372997595135 & 1 << (*(v2)-65 & 63))) &&
(*(v2) >= 45 || *(v2) > 57)))
break;
}
if (v1 == v2)
continue;
v0 = 0;
v6 = 0;
v7 = 0;
v8 = 0;
v9 = 0;
v10 = 0;
v17 = v2 - v1;
if (32 < (v2 - v1))
v17 = 32;
strncpy(&v7, v1, v17);
if (!strncmp(&v7, "tty", 0x3))
strncpy(&v6, &v7, 0x8);
else
strncpy(&v6, &v7, 0x8);
for (v3 = newFamily; v3; v3 = v3->field_c0) {
if (!strcmp(&v3->padding_0[28], &v6))
v0 = 1;
}
if (v0)
continue;
v5 = imalloc(0xc8, a1, 0x8, a3, a4, a5);
v5->field_30 = 1;
strcpy(&v5->padding_0[28], &v6);
strcpy(&v5->padding_0[36], "2345");
sprintf(&v5->padding_34,
"/sbin/agetty -L -s 115200,38400,9600 %s vt102", &v7);
v5->field_c0 = 0;
for (v3[0] = family; v3; v3[0] = v3[24]) {
if (!strcmp(&v3[3] + 4, &v5->padding_0[28])) {
v3[23] = v5;
break;
}
}
for (v3 = newFamily; v3; v3 = v3->field_c0) {
if (!v3->field_c0) {
v3->field_c0 = v5;
break;
}
}
initlog(0x3, "added agetty on %s with id %s", &v7, &v6, a4, a5);
}
}
}
fclose(v4);
}
v22 = *(&v13) ^ v21[5];
return;
} | sysvinit | angr_dream |
void malloc_set_tracefp(fp) FILE *fp;
{
} | long long malloc_set_tracefp(unsigned long a0) {
unsigned long v0;
unsigned long v2;
v0 = a0;
return v2;
} | bash | angr_phoenix |
static int do_standby_disk(char *device, unsigned int flags) {
unsigned char flush1[4] = {0xEA, 0, 0, 0};
unsigned char flush2[4] = {0xE7, 0, 0, 0};
unsigned char stdby1[4] = {0xE0, 0, 0, 0};
unsigned char stdby2[4] = {0x94, 0, 0, 0};
char buf[255 + 1];
int fd, ret;
ret = snprintf(buf, sizeof(buf),
"/dev"
"/%s",
device);
if ((ret >= (int)sizeof(buf)) || (ret < 0))
return -1;
if ((fd = open(buf, 02 | 04000)) < 0)
return -1;
switch (flags & 0x00000004) {
case 0x00000004:
if ((ret = ioctl(fd, 0x031f, &flush1)) == 0)
break;
default:
ret = ioctl(fd, 0x031f, &flush2) &&
ioctl(fd, (((0U) << (((0 + 8) + 8) + 14)) | (((0x12)) << (0 + 8)) |
(((97)) << 0) | ((0) << ((0 + 8) + 8))));
break;
}
if ((flags & 0x00000020) == 0x0) {
ret = ioctl(fd, 0x031f, &stdby1) && ioctl(fd, 0x031f, &stdby2);
}
close(fd);
if (ret)
return -1;
return 0;
} | void do_standby_disk(unsigned long a0, unsigned long a1) {
unsigned int v0;
unsigned int v1;
unsigned int v2;
unsigned int v3;
unsigned int v4;
unsigned int v5;
char v6;
unsigned long long v8;
unsigned long long v9;
unsigned int v10;
unsigned int v11;
unsigned long long v12;
void *v13;
v2 = 234;
v3 = 231;
v4 = 224;
v5 = 148;
v0 = snprintf(&v6, 0x100, "/dev/%s", a0);
if (v0 > 255) {
LABEL_4004ea:
v8 = 4294967295;
} else {
if (v0 < 0)
goto LABEL_4004ea;
v1 = open(&v6, 0x802, 0xbca);
if (v1 < 0) {
v9 = 4294967295;
} else {
if ((a1 & 4) == 4) {
v0 = ioctl(v1, 0x31f);
if (!v0)
goto LABEL_40059b;
}
if (ioctl(v1, 0x31f) && ioctl(v1, 0x1261)) {
v10 = 1;
goto LABEL_400594;
}
v10 = 0;
LABEL_400594:
v0 = v10;
LABEL_40059b:
if (!(a1 & 32)) {
if (ioctl(v1, 0x31f) && ioctl(v1, 0x31f)) {
v11 = 1;
goto LABEL_4005ee;
}
v11 = 0;
LABEL_4005ee:
v0 = v11;
}
close(v1);
if (v0)
v12 = 4294967295;
else
v13 = 0;
}
}
return;
} | sysvinit | angr_phoenix |
int print_prefix(struct nlmsghdr *n, void *arg) {
FILE *fp = (FILE *)arg;
struct prefixmsg *prefix =
((void *)(((char *)n) +
((int)(((sizeof(struct nlmsghdr)) + 4U - 1) & ~(4U - 1)))));
int len = n->nlmsg_len;
struct rtattr *tb[(__RTA_MAX - 1) + 1];
int family = preferred_family;
if (n->nlmsg_type != RTM_NEWPREFIX) {
fprintf(stderr, "Not a prefix: %08x %08x %08x\n", n->nlmsg_len,
n->nlmsg_type, n->nlmsg_flags);
return 0;
}
len -= ((sizeof(*prefix)) +
((int)(((sizeof(struct nlmsghdr)) + 4U - 1) & ~(4U - 1))));
if (len < 0) {
fprintf(stderr, "BUG: wrong nlmsg len %d\n", len);
return -1;
}
if (family == 0)
family = 10;
if (family != 10)
return 0;
if (prefix->prefix_family != 10) {
fprintf(stderr, "incorrect protocol family: %d\n", prefix->prefix_family);
return 0;
}
if (prefix->prefix_type != 3) {
fprintf(stderr, "wrong ND type %d\n", prefix->prefix_type);
return 0;
}
parse_rtattr(
tb, (__RTA_MAX - 1),
((struct rtattr *)(((char *)(prefix)) +
(((sizeof(struct rtmsg)) + 4U - 1) & ~(4U - 1)))),
len);
if (tb[PREFIX_ADDRESS]) {
fprintf(fp, "prefix %s/%u",
rt_addr_n2a(
family,
((int)((tb[PREFIX_ADDRESS])->rta_len) -
((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0))),
((void *)(((char *)(tb[PREFIX_ADDRESS])) +
((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) +
(0))))),
prefix->prefix_len);
}
fprintf(fp, "dev %s ", ll_index_to_name(prefix->prefix_ifindex));
if (prefix->prefix_flags & 0x01)
fprintf(fp, "onlink ");
if (prefix->prefix_flags & 0x02)
fprintf(fp, "autoconf ");
if (tb[PREFIX_CACHEINFO]) {
const struct prefix_cacheinfo *pc =
((void *)(((char *)(tb[PREFIX_CACHEINFO])) +
((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0))));
fprintf(fp, "valid %u ", pc->valid_time);
fprintf(fp, "preferred %u ", pc->preferred_time);
}
fprintf(fp, "\n");
fflush(fp);
return 0;
} | long long print_prefix(struct_0 *a0, void *a1) {
unsigned int v0;
unsigned int v1;
struct_1 *v2;
unsigned int v3[2];
char v4;
char v5;
char v6;
unsigned long long v8;
v2 = &a0[2];
v1 = a0->field_0;
v0 = preferred_family;
if (a0->field_4 != 52) {
fprintf(*(&stderr), "Not a prefix: %08x %08x %08x\n", a0->field_0,
a0->field_4, a0->field_6);
v8 = 0;
return v8;
}
v1 -= 28;
if (v1 < 0) {
fprintf(*(&stderr), "BUG: wrong nlmsg len %d\n", v1);
v8 = 4294967295;
return v8;
}
if (!v0)
v0 = 10;
if (v0 != 10) {
v8 = 0;
return v8;
} else if (v2->field_0 != 10) {
fprintf(*(&stderr), "incorrect protocol family: %d\n", v2->field_0);
v8 = 0;
return v8;
} else if (v2->field_8 != 3) {
fprintf(*(&stderr), "wrong ND type %d\n", v2->field_8);
v8 = 0;
return v8;
} else {
parse_rtattr(&v4, 0x1e, &v2[1].padding_1, v1);
if (*(&v5))
fprintf(a1, "prefix %s/%u",
rt_addr_n2a(v0, *(*(&v5)) - 4, *(&v5) + 4, *(*(&v5)) - 4),
v2->field_9);
fprintf(a1, "dev %s ", ll_index_to_name(v2->field_4));
if ((v2->field_a & 1))
fprintf(a1, "onlink ");
if ((v2->field_a & 2))
fprintf(a1, "autoconf ");
if (*(&v6)) {
*(&v3[0]) = *(&v6) + 4;
fprintf(a1, "valid %u ", v3[1]);
fprintf(a1, "preferred %u ", v3[0]);
}
fprintf(a1, "\n");
fflush(a1);
v8 = 0;
return v8;
}
} | iproute2-6.0.0 | angr_sailr |
char *username_completion_function(const char *text, int state) {
struct passwd *pass = ((void *)0);
if (text[0] == '\0')
return ((void *)0);
if (*text == '~')
text++;
if (state == 0)
setpwent();
while ((pass = getpwent()) != ((void *)0)
&& text[0] == pass->pw_name[0] && strcmp(text, pass->pw_name) == 0)
continue;
if (pass == ((void *)0)) {
endpwent();
return ((void *)0);
}
return strdup(pass->pw_name);
} | long long username_completion_function(unsigned long long a0,
unsigned long a1) {
char *v0;
char **v1;
void *v3;
v0 = a0;
v1 = 0;
if (!*(v0)) {
v3 = 0;
} else {
if (*(v0) == 126)
v0 += 1;
if (!a1)
setpwent();
while (true) {
v1 = &getpwent()->pw_name;
if (!v1)
break;
if (*(v0) != *(*(v1)))
break;
if (strcmp(v0))
break;
}
if (!v1) {
endpwent();
v3 = 0;
} else {
v3 = strdup(*(v1));
}
}
return v3;
} | libedit | angr_dream |
sh_builtin_func_t *find_shell_builtin(name)
char *name;
{
current_builtin = builtin_address_internal(name, 0);
return (current_builtin ? current_builtin->function
: (sh_builtin_func_t *)((void *)0));
} | long long find_shell_builtin(char *a0) {
current_builtin = builtin_address_internal(a0, 0x0);
return (!current_builtin ? *((current_builtin + 8)) : 0);
} | bash | angr_sailr |
static void tooManyBlocks(Int32 max_handled_blocks) {
fprintf(stderr, "%s: `%s' appears to contain more than %d blocks\n", progName,
inFileName, max_handled_blocks);
fprintf(stderr, "%s: and cannot be handled. To fix, increase\n", progName);
fprintf(stderr,
"%s: BZ_MAX_HANDLED_BLOCKS in bzip2recover.c, and recompile.\n",
progName);
exit(1);
} | void tooManyBlocks(uint param_1)
{
fprintf(stderr, "%s: `%s\' appears to contain more than %d blocks\n",
progName, inFileName, (ulong)param_1);
fprintf(stderr, "%s: and cannot be handled. To fix, increase\n", progName);
fprintf(stderr,
"%s: BZ_MAX_HANDLED_BLOCKS in bzip2recover.c, and recompile.\n",
progName);
exit(1);
} | bzip2 | ghidra |
char *tohex(const void *vp, size_t l) {
const u_char *p = (const u_char *)vp;
char b[3], *r;
size_t i, hl;
if (l > 65536)
return xstrdup("tohex: length > 65536");
hl = l * 2 + 1;
r = xcalloc(1, hl);
for (i = 0; i < l; i++) {
snprintf(b, sizeof(b), "%02x", p[i]);
strlcat(r, b, hl);
}
return (r);
} | long long tohex(void *a0, unsigned long a1) {
void *v0;
unsigned long long v1;
unsigned long long v2;
char v3;
unsigned long long v5;
if (a1 > 0x10000) {
v5 = xstrdup("tohex: length > 65536");
return v5;
}
v1 = a1 * 2 + 1;
*(&v2) = xcalloc(0x1, v1);
for (v0 = 0; v0 < a1; v0 += 1) {
snprintf(&v3, 0x3, "%02x", *((v0 + a0)));
strlcat(v2, &v3, v1, &v3);
}
v5 = v2;
return v5;
} | openssh-portable | angr_sailr |
void usage(int status) {
if (status != 0)
do {
fprintf(stderr, gettext("Try '%s --help' for more information.\n"),
program_name);
} while (0);
else {
printf(gettext("Usage: %s [OPTION]...\n"), program_name);
fputs_unlocked(gettext("Print the file name of the terminal connected to "
"standard input.\n\n -s, --silent, --quiet print "
"nothing, only return an exit status\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("tty");
}
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]...\n"));
fputs_unlocked(gettext("Print the file name of the terminal connected to "
"standard input.\n\n -s, --silent, --quiet print "
"nothing, only return an exit status\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("tty");
}
exit(a0);
} | coreutils | angr_phoenix |
inline char *sub_append_string(source, target, indx, size)
char *source, *target;
size_t *indx;
size_t *size;
{
if (source) {
size_t n, srclen;
srclen = (((source) && (source)[0])
? ((source)[1] ? ((source)[2] ? strlen(source) : 2) : 1)
: 0);
if (srclen >= (*size - *indx)) {
n = srclen + *indx;
n = (n + 128) - (n % 128);
target = (char *)sh_xrealloc((target), ((*size = n)), "subst.c", 755);
}
__builtin_memcpy((target + *indx), (source), (srclen));
*indx += srclen;
target[*indx] = '\0';
sh_xfree((source), "subst.c", 762);
}
return (target);
} | long sub_append_string(char *param_1, long param_2, long *param_3,
long *param_4)
{
ulong __n;
long local_28;
local_28 = param_2;
if (param_1 != (char *)0x0) {
if ((param_1 == (char *)0x0) || (*param_1 == '\0')) {
__n = 0;
} else if (param_1[1] == '\0') {
__n = 1;
} else if (param_1[2] == '\0') {
__n = 2;
} else {
__n = strlen(param_1);
}
if ((ulong)(*param_4 - *param_3) <= __n) {
*param_4 = (__n + *param_3 & 0xffffffffffffff80) + 0x80;
local_28 = sh_xrealloc(param_2, *param_4, "subst.c", 0x2f3);
}
memcpy((void *)(*param_3 + local_28), param_1, __n);
*param_3 = *param_3 + __n;
*(undefined *)(local_28 + *param_3) = 0;
sh_xfree(param_1, "subst.c", 0x2fa);
}
return local_28;
} | bash | ghidra |
c_delafter1(EditLine *el) {
wchar_t *cp;
for (cp = el->el_line.cursor; cp <= el->el_line.lastchar; cp++)
*cp = cp[1];
el->el_line.lastchar--;
} | long long c_delafter1(unsigned long long a0[13]) {
unsigned int v0[2];
for (*(&v0[0]) = a0[11]; v0 <= a0[12]; *(&v0[0]) = &v0[1]) {
v0[0] = v0[1];
}
a0[12] = a0[12] - 4;
return a0;
} | libedit | angr_sailr |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.