input stringlengths 26 172k | output stringlengths 18 318k | repo_name stringclasses 23 values | decompiler stringclasses 5 values |
|---|---|---|---|
void *xmalloc(size_t bytes) {
void *temp;
temp = malloc(bytes);
if (temp == 0)
memory_error_and_abort("xmalloc");
return (temp);
} | long long xmalloc(unsigned int a0) {
unsigned long v0;
v0 = malloc(a0);
if (v0)
return v0;
memory_error_and_abort("xmalloc");
} | bash | angr_phoenix |
static void set_force_obsolete(const struct cmdinfo *cip, const char *value) {
warning(gettext("deprecated --%s option; use --%s instead"), cip->olong,
"force-all");
set_force(FORCE_ALL);
} | long long set_force_obsolete(unsigned long a0, unsigned long a1) {
unsigned long v0;
unsigned long v1;
v1 = a0;
v0 = a1;
warning(gettext("deprecated --%s option; use --%s instead"));
return set_force(0xffffffff);
} | dpkg | angr_phoenix |
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_phoenix |
int main(int argc, char **argv) {
static char const unknown[] = "unknown";
unsigned int toprint = 0;
;
set_program_name(argv[0]);
setlocale(6, "");
bindtextdomain("coreutils", "/usr/local/share/locale");
textdomain("coreutils");
atexit(close_stdout);
toprint = decode_switches(argc, argv);
if (toprint == 0)
toprint = 1;
if (toprint & (1 | 2 | 4 | 8 | 16)) {
struct utsname name;
if (uname(&name) == -1)
((!!sizeof(struct {
_Static_assert(1, "verify_expr ("
"1"
", "
"(error (1, (*__errno_location ()), gettext "
"(\"cannot get system name\")), assume (false))"
")");
int _gl_dummy;
}))
? ((error(1, (*__errno_location()),
gettext("cannot get system name")),
((0) ? (void)0 : __builtin_unreachable())))
: ((error(1, (*__errno_location()),
gettext("cannot get system name")),
((0) ? (void)0 : __builtin_unreachable()))));
if (toprint & 1)
print_element_env(name.sysname, "UNAME_SYSNAME");
if (toprint & 2)
print_element_env(name.nodename, "UNAME_NODENAME");
if (toprint & 4)
print_element_env(name.release, "UNAME_RELEASE");
if (toprint & 8)
print_element_env(name.version, "UNAME_VERSION");
if (toprint & 16)
print_element_env(name.machine, "UNAME_MACHINE");
}
if (toprint & 32) {
char const *element = unknown;
if (!(toprint == (0x7fffffff * 2U + 1U) && element == unknown))
print_element(element);
}
if (toprint & 64) {
char const *element = unknown;
if (!(toprint == (0x7fffffff * 2U + 1U) && element == unknown))
print_element(element);
}
if (toprint & 128)
print_element("GNU/Linux");
putchar_unlocked('\n');
return 0;
} | int main(unsigned long a0, unsigned long long *a1) {
unsigned int v0;
unsigned long long v1;
unsigned long long v2;
char v3;
char v4;
char v5;
char v6;
char v7;
v0 = 0;
set_program_name(*(a1));
setlocale(0x6, &g_400a9b);
bindtextdomain("coreutils", "/usr/local/share/locale");
textdomain("coreutils");
atexit(got.close_stdout);
v0 = decode_switches(a0, a1);
if (!v0)
v0 = 1;
if ((v0 & 31)) {
if (uname(&v3) == -1)
error(0x1, *(__errno_location()), gettext("cannot get system name"));
if ((v0 & 1))
print_element_env(&v3, "UNAME_SYSNAME");
if ((v0 & 2))
print_element_env(&v4, "UNAME_NODENAME");
if ((v0 & 4))
print_element_env(&v5, "UNAME_RELEASE");
if ((v0 & 8))
print_element_env(&v6, "UNAME_VERSION");
if ((v0 & 16))
print_element_env(&v7, "UNAME_MACHINE");
}
if ((v0 & 32)) {
v1 = "unknown";
if (v0 == -1 && v1 == "unknown")
goto LABEL_4008d5;
print_element(v1);
}
LABEL_4008d5:
if ((v0 & 64)) {
v2 = "unknown";
if (v0 == -1 && v2 == "unknown")
goto LABEL_400918;
print_element(v2);
}
LABEL_400918:
if ((v0 & 128))
print_element("GNU/Linux");
putchar_unlocked(0xa);
return 0;
} | coreutils | angr_phoenix |
static int process_input(struct ssh *ssh, int connection_in) {
int r;
if ((r = ssh_packet_process_read(ssh, connection_in)) == 0)
return 0;
if (r == -24) {
if ((*__errno_location()) == 11 || (*__errno_location()) == 4 ||
(*__errno_location()) == 11)
return 0;
if ((*__errno_location()) == 32) {
sshlog("serverloop.c", __func__, 285, 0, SYSLOG_LEVEL_VERBOSE,
((void *)0), "Connection closed by %.100s port %d",
ssh_remote_ipaddr(ssh), ssh_remote_port(ssh));
return -1;
}
sshlog("serverloop.c", __func__, 289, 0, SYSLOG_LEVEL_VERBOSE, ((void *)0),
"Read error from remote host %s port %d: %s", ssh_remote_ipaddr(ssh),
ssh_remote_port(ssh), strerror((*__errno_location())))
;
cleanup_exit(255);
}
return -1;
} | int process_input(unsigned long long a0, unsigned long a1) {
unsigned long v0;
unsigned long v1;
unsigned long v2;
unsigned int v3;
unsigned int v5;
v3 = ssh_packet_process_read(a0, a1, a1);
switch (v3) {
case 0:
v5 = 0;
return v5;
case 4294967272:
if (*(__errno_location()) == 11) {
v5 = 0;
return v5;
} else if (*(__errno_location()) == 4) {
v5 = 0;
return v5;
} else if (*(__errno_location()) == 11) {
v5 = 0;
return v5;
} else if (*(__errno_location()) == 32) {
v1 = ssh_remote_port(a0);
v0 = ssh_remote_ipaddr(a0);
sshlog("serverloop.c", "process_input", 0x11d, 0x0, 0x4, 0x0,
"Connection closed by %.100s port %d");
v5 = -1;
return v5;
} else {
v2 = strerror(*(__errno_location()));
v1 = ssh_remote_port(a0);
v0 = ssh_remote_ipaddr(a0);
sshlog("serverloop.c", "process_input", 0x121, 0x0, 0x4, 0x0,
"Read error from remote host %s port %d: %s");
cleanup_exit(0xff);
v5 = -1;
return v5;
}
default:
v5 = -1;
return v5;
}
} | openssh-portable | angr_sailr |
static _Bool
path_prefix(char const *prefix, char const *path) {
prefix++;
path++;
if (!*prefix)
return *path != '/';
if (*prefix == '/' && !prefix[1])
return *path == '/';
while (*prefix && *path) {
if (*prefix != *path)
break;
prefix++;
path++;
}
return (!*prefix && (*path == '/' || !*path));
} | bool path_prefix(long a1, long a2) {
_BYTE *v4;
_BYTE *v5;
v5 = (_BYTE *)(a1 + 1);
v4 = (_BYTE *)(a2 + 1);
if (!*(_BYTE *)(a1 + 1))
return *v4 != 47;
if (*v5 == 47 && !*(_BYTE *)(a1 + 2))
return *v4 == 47;
while (*v5 && *v4 && *v5 == *v4) {
++v5;
++v4;
}
return !*v5 && (*v4 == 47 || !*v4);
} | coreutils | ida |
static _Bool
pkgset_getting_in_sync(struct pkginfo *pkg) {
struct pkginfo *otherpkg;
for (otherpkg = &pkg->set->pkg; otherpkg; otherpkg = otherpkg->arch_next) {
if (otherpkg == pkg)
continue;
if (otherpkg->status <= PKG_STAT_CONFIGFILES)
continue;
if (dpkg_version_compare(&pkg->available.version,
&otherpkg->installed.version)) {
return 0;
}
}
return 1;
} | int pkgset_getting_in_sync(unsigned long long *a0) {
struct_0 *v0;
unsigned int v2;
v0 = *(a0) + 16;
while (true) {
if (v0) {
if (v0 != a0 && v0->field_18 > 1) {
v2 = dpkg_version_compare(a0 + 34, &v0[5].field_8 + 4,
&v0[5].field_8 + 4);
if (v2) {
v2 = 0;
break;
}
}
if (!v2 || v0 == a0 || v0->field_18 <= 1)
v0 = v0->field_8;
} else {
v2 = 1;
break;
}
}
return v2;
} | dpkg | angr_dream |
int tnl_prl_ioctl(int cmd, const char *name, void *p) {
return tnl_gen_ioctl(cmd, name, p, -1);
} | long tnl_prl_ioctl(int a1, const char *a2, long a3) {
return tnl_gen_ioctl(a1, a2, a3, -1);
} | iproute2-6.0.0 | ida |
static void userauth_send_banner(struct ssh *ssh, const char *msg) {
int r;
if ((r = sshpkt_start(ssh, 53)) != 0 ||
(r = sshpkt_put_cstring(ssh, msg)) != 0 ||
(r = sshpkt_put_cstring(ssh, "")) != 0 || (r = sshpkt_send(ssh)) != 0)
sshfatal("auth2.c", __func__, 147, 1, SYSLOG_LEVEL_FATAL, ssh_err(r),
"send packet");
sshlog("auth2.c", __func__, 148, 0, SYSLOG_LEVEL_DEBUG1, ((void *)0),
"%s: sent", __func__);
} | void userauth_send_banner(unsigned long long a0, unsigned long long a1) {
unsigned long long v0;
unsigned long long v1;
unsigned int v2;
unsigned long long v3;
char v4;
unsigned long long v6;
unsigned long long v7;
v2 = sshpkt_start(a0, 0x35);
if (!(!v2) || !((v2 = sshpkt_put_cstring(a0, a1, a1), !v2))) {
LABEL_4001ea:
v0 = "send packet";
sshfatal("auth2.c", "userauth_send_banner", 0x93, 0x1, 0x1, ssh_err(v2));
} else {
v2 = sshpkt_put_cstring(a0, &g_402830, v6);
if (v2 || (v2 = sshpkt_send(a0), v2))
goto LABEL_4001ea;
}
v3 = "userauth_send_banner";
v1 = "%s: sent";
v7 = sshlog("auth2.c", "userauth_send_banner", 0x94, 0x0, 0x5, 0x0, *(&v4));
return;
} | openssh-portable | angr_sailr |
static errcode_t fix_inline_dir_size(e2fsck_t ctx, ext2_ino_t ino,
size_t *inline_data_size,
struct problem_context *pctx, char *buf) {
ext2_filsys fs = ctx->fs;
struct ext2_inode inode;
size_t new_size, old_size;
errcode_t retval;
old_size = *inline_data_size;
if (old_size > ((sizeof(__u32) * (((12 + 1) + 1) + 1))) &&
old_size <
((sizeof(__u32) * (((12 + 1) + 1) + 1))) + ext2fs_dir_rec_len(1, 0)) {
old_size = ((sizeof(__u32) * (((12 + 1) + 1) + 1)));
new_size = old_size;
} else
new_size = old_size + (4 - (old_size & 3));
memset(buf + old_size, 0, new_size - old_size);
retval = ext2fs_inline_data_set(fs, ino, 0, buf, new_size);
if (retval == (2133571495L)) {
new_size -= 4;
retval = ext2fs_inline_data_set(fs, ino, 0, buf, new_size);
if (retval) {
if (fix_problem(ctx, 0x02004F, pctx)) {
new_size = 0;
goto write_inode;
}
goto err;
}
} else if (retval) {
if (fix_problem(ctx, 0x02004F, pctx)) {
new_size = 0;
goto write_inode;
}
goto err;
}
write_inode:
retval = ext2fs_read_inode(fs, ino, &inode);
if (retval)
goto err;
retval = ext2fs_inode_size_set(fs, &inode, new_size);
if (retval)
goto err;
if (new_size == 0)
inode.i_flags &= ~0x10000000;
retval = ext2fs_write_inode(fs, ino, &inode);
if (retval)
goto err;
*inline_data_size = new_size;
err:
return retval;
} | long fix_inline_dir_size(long *a1, unsigned int a2, unsigned long *a3, long a4,
long a5) {
unsigned long v9;
unsigned long v10;
long inode;
long v12;
char v13[32];
int v14;
unsigned long v15;
v15 = __readfsqword(0x28u);
v12 = *a1;
v10 = *a3;
if (*a3 <= 0x3C ||
v10 >= (unsigned long)(unsigned int)ext2fs_dir_rec_len(1u, 0) + 60) {
v9 = (v10 & 0xFFFFFFFFFFFFFFFCLL) + 4;
} else {
v10 = 60LL;
v9 = 60LL;
}
memset((void *)(v10 + a5), 0, v9 - v10);
inode = ext2fs_inline_data_set(v12, a2, 0LL, a5, v9);
if (inode == 2133571495) {
v9 -= 4LL;
inode = ext2fs_inline_data_set(v12, a2, 0LL, a5, v9);
if (inode) {
if (!(unsigned int)fix_problem(a1, 131151LL, a4))
return inode;
v9 = 0LL;
}
} else if (inode) {
if (!(unsigned int)fix_problem(a1, 131151LL, a4))
return inode;
v9 = 0LL;
}
inode = ext2fs_read_inode(v12, a2, v13);
if (!inode) {
inode = ext2fs_inode_size_set(v12, v13, v9);
if (!inode) {
if (!v9)
v14 &= ~0x10000000u;
inode = ext2fs_write_inode(v12, a2, v13);
if (!inode)
*a3 = v9;
}
}
return inode;
} | e2fsprogs-1.46.5 | ida |
static int evalcase(union node *n, int flags) {
union node *cp;
union node *patp;
struct arglist arglist;
int status = 0;
errlinno = lineno = n->ncase.linno;
if (funcline)
lineno -= funcline - 1;
arglist.lastp = &arglist.list;
expandarg(n->ncase.expr, &arglist, 0x2);
for (cp = n->ncase.cases; cp && evalskip == 0; cp = cp->nclist.next) {
for (patp = cp->nclist.pattern; patp; patp = patp->narg.next) {
if (casematch(patp, arglist.list->text)) {
if (evalskip == 0 && cp->nclist.body) {
status = evaltree(cp->nclist.body, flags);
}
goto out;
}
}
}
out:
return status;
} | long long evalcase(struct_0 *a0, unsigned long a1) {
unsigned int v0;
unsigned long long v1[4];
struct_1 *v2;
char v3;
unsigned long v4;
unsigned long long v6;
v0 = 0;
lineno = a0->field_4;
errlinno = lineno;
if (funcline)
lineno = lineno - (funcline - 1);
v4 = &v3;
expandarg(a0->field_8, &v3, 0x2, &v3);
v1[0] = a0->field_10;
while (true) {
break;
if (false) {
v2 = v1[2];
while (true) {
if (v2) {
v6 = casematch(v2, *((*(&v3) + 8)), *((*(&v3) + 8)));
if (v6) {
if (false && v1[3])
v0 = evaltree(v1[3], a1);
break;
} else {
v2 = v2->field_8;
}
} else {
v1[0] = v1[1];
break;
}
}
if (v2 && v6)
break;
}
}
return v0;
} | dash-0.5.11+git20210903+057cd650a4ed | angr_dream |
static void save_buffer(struct buffer_record *buf) {
struct buffer_record *p;
buf->next = ((void *)0);
buf->curr_line = buf->line_start;
if (head == ((void *)0))
head = buf;
else {
for (p = head; p->next; p = p->next)
;
p->next = buf;
}
} | _QWORD *save_buffer(_QWORD *a1) {
_QWORD *result;
_QWORD *i;
a1[8] = 0LL;
a1[7] = a1[6];
if (head) {
for (i = (_QWORD *)head; i[8]; i = (_QWORD *)i[8])
;
result = i;
i[8] = a1;
} else {
result = a1;
head = (long)a1;
}
return result;
} | coreutils | ida |
void set_next_block_after(union block *block) {
while (block >= current_block)
current_block++;
if (current_block > record_end)
abort();
} | void set_next_block_after(unsigned long a0) {
unsigned long long v1;
for (; a0 >= 16752697132039570248;
continued_file_offset = 16752697132039570760)
;
v1 = 16752697132039570248;
if (false)
abort();
return;
} | tar | angr_dream |
void add_certificate_file(Options *options, const char *path,
int userprovided) {
int i;
if (options->num_certificate_files >= 100)
sshfatal("readconf.c", __func__, 459, 0, SYSLOG_LEVEL_FATAL, ((void *)0),
"Too many certificate files specified (max %d)", 100);
for (i = 0; i < options->num_certificate_files; i++) {
if (options->certificate_file_userprovided[i] == userprovided &&
strcmp(options->certificate_files[i], path) == 0) {
sshlog("readconf.c", __func__, 466, 1, SYSLOG_LEVEL_DEBUG2, ((void *)0),
"ignoring duplicate key %s", path);
return;
}
}
options->certificate_file_userprovided[options->num_certificate_files] =
userprovided;
options->certificate_files[options->num_certificate_files++] = xstrdup(path);
} | void add_certificate_file(struct_0 *a0, char *a1, unsigned long a2) {
unsigned long long v0;
unsigned long long v1;
unsigned int v2;
unsigned long long v3;
unsigned long v4;
char v5;
unsigned long long v7;
unsigned long long v8;
if (a0->field_af8 > 99) {
v1 = 100;
v0 = "Too many certificate files specified (max %d)";
sshfatal("readconf.c", "add_certificate_file", 0x1cb, 0x0, 0x1, 0x0);
}
v2 = 0;
while (true) {
if (v2 < a0->field_af8) {
if (a2 == *(&a0[1].padding_1[803 + 4 * v2])) {
v7 = strcmp(*(&a0[1].padding_1[3 + 8 * v2]), a1);
if (!v7) {
v4 = a1;
v3 = "ignoring duplicate key %s";
v8 = sshlog("readconf.c", "add_certificate_file", 0x1d2, 0x1, 0x6,
0x0, *(&v5));
break;
}
}
if (v7 || a2 != *(&a0[1].padding_1[803 + 4 * v2]))
v2 = __addvsi3(v2, 0x1);
} else {
*(&a0[1].padding_1[803 + 4 * a0->field_af8]) = a2;
a0->field_af8 = __addvsi3(a0->field_af8, 0x1);
*(&a0[1].padding_1[3 + 8 * a0->field_af8]) = xstrdup(a1);
break;
}
}
return;
} | openssh-portable | angr_dream |
static void new_spent(struct spwd *spent) {
if (lflg) {
if (spw_locate(user_newname) != ((void *)0)) {
fprintf(stderr, gettext("%s: user '%s' already exists in %s\n"), Prog,
user_newname, spw_dbname());
fail_exit(9);
}
spent->sp_namp = xstrdup(user_newname);
}
if (fflg) {
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(6, "change user '%s' inactive from '%ld' to '%ld'", spent->sp_namp,
spent->sp_inact, user_newinactive);
if (((void *)0) != saved_locale) {
(void)setlocale(6, saved_locale);
free(saved_locale);
}
} while (0)
;
spent->sp_inact = user_newinactive;
}
if (eflg) {
char new_exp[16], old_exp[16];
date_to_str(sizeof(new_exp), new_exp, user_newexpire * (24L * 3600L));
date_to_str(sizeof(old_exp), old_exp, user_expire * (24L * 3600L));
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(6, "change user '%s' expiration from '%s' to '%s'", spent->sp_namp,
old_exp, new_exp);
if (((void *)0) != saved_locale) {
(void)setlocale(6, saved_locale);
free(saved_locale);
}
} while (0)
;
spent->sp_expire = user_newexpire;
}
spent->sp_pwdp = new_pw_passwd(spent->sp_pwdp);
if (pflg) {
spent->sp_lstchg = (long)gettime() / (24L * 3600L);
if (0 == spent->sp_lstchg) {
spent->sp_lstchg = -1;
}
}
} | void new_spent(unsigned long long a0[8], unsigned long long a1,
unsigned long long a2, unsigned long long a3) {
void *v0;
void *v1;
char *v2;
char *v3;
char v4;
char v5;
char v6;
unsigned long long v9;
unsigned long long *v11;
unsigned long long v12;
if (lflg) {
if (!spw_locate(user_newname)) {
a2 = a0;
*(&a0[0]) = xstrdup(user_newname, a1, a2, a3);
} else {
v9 = spw_dbname();
fprintf(stderr, gettext("%s: user '%s' already exists in %s\n"));
fail_exit(0x9);
}
}
if (fflg) {
v2 = setlocale(0x6, NULL);
v0 = 0;
if (v2)
v0 = strdup(v2);
if (v0)
setlocale(0x6, "C");
a3 = a0[6];
syslog(0x6, "change user '%s' inactive from '%ld' to '%ld'");
if (v0) {
setlocale(0x6, v0);
free(v0);
}
a2 = user_newinactive;
a0[6] = user_newinactive;
}
if (eflg) {
date_to_str(0x10, &v4, user_newexpire * 86400);
date_to_str(0x10, &v5, user_expire * 86400);
v3 = setlocale(0x6, NULL);
v1 = 0;
if (v3)
v1 = strdup(v3);
if (v1)
setlocale(0x6, "C");
a3 = &v5;
syslog(0x6, "change user '%s' expiration from '%s' to '%s'");
if (v1) {
setlocale(0x6, v1);
free(v1);
}
a2 = user_newexpire;
a0[7] = user_newexpire;
}
a0[1] = new_pw_passwd(a0[1], a1, a2, a3);
if (pflg) {
a0[2] = (gettime() * 1749024623285053783 >> 64 >> 13) - (gettime() >> 63);
if (!a0[2])
a0[2] = -1;
}
v12 = *(&v6) ^ v11[5];
return;
} | shadow | angr_phoenix |
static int edit_and_execute_command(count, c, editing_mode, edit_command)
int count, c, editing_mode;
char *edit_command;
{
char *command, *metaval;
int r, rrs, metaflag;
sh_parser_state_t ps;
rrs = rl_readline_state;
saved_command_line_count = current_command_line_count;
rl_newline(1, c);
if (rl_explicit_arg) {
command = (char *)sh_xmalloc((strlen(edit_command) + 8), "bashline.c", 960);
sprintf(command, "%s %d", edit_command, count);
} else {
using_history();
current_command_line_count++;
bash_add_history(rl_line_buffer);
current_command_line_count = 0;
bash_add_history("");
history_lines_this_session++;
using_history();
command = (char *)strcpy(
sh_xmalloc((1 + strlen(edit_command)), "bashline.c", 978),
(edit_command));
}
metaval = rl_variable_value("input-meta");
metaflag =
((metaval)[0] == 'o' && (metaval)[1] == 'n' && (metaval)[2] == '\0');
if (rl_deprep_term_function)
(*rl_deprep_term_function)();
rl_clear_signals();
save_parser_state(&ps);
r = parse_and_execute(command, (editing_mode == 0) ? "v" : "C-xC-e", 0x004);
restore_parser_state(&ps);
reset_readahead_token();
if (rl_prep_term_function)
(*rl_prep_term_function)(metaflag);
rl_set_signals();
current_command_line_count = saved_command_line_count;
rl_line_buffer[0] = '\0';
rl_point = rl_end = 0;
rl_done = 0;
rl_readline_state = rrs;
if (editing_mode == 0)
rl_vi_insertion_mode(1, c);
rl_forced_update_display();
return r;
} | long long edit_and_execute_command(unsigned long a0, unsigned long long a1,
unsigned long a2, char *a3,
unsigned long long a4,
unsigned long long a5) {
unsigned int v0;
unsigned int v1;
unsigned int v2;
char *v3;
char v4[3];
char v5;
unsigned int v7;
unsigned long long v8;
v0 = rl_readline_state;
saved_command_line_count = current_command_line_count;
rl_newline(0x1, a1);
if (rl_explicit_arg) {
v3 = sh_xmalloc(strlen(a3) + 8, "bashline.c", 0x3c0);
sprintf(v3, "%s %d", a3, a0);
} else {
using_history();
current_command_line_count = current_command_line_count + 1;
bash_add_history(rl_line_buffer);
current_command_line_count = 0;
bash_add_history(&g_40a4a2);
history_lines_this_session = history_lines_this_session + 1;
using_history();
v3 = strcpy(sh_xmalloc(strlen(a3) + 1, "bashline.c", 0x3d2), a3);
}
*(&v4) = rl_variable_value("input-meta");
if (v4[0] == 111 && v4[1] == 110 && !v4[2])
v7 = 1;
if (v4[0] != 111 || v4[1] != 110 || v4[2])
v7 = 0;
v1 = v7;
if (rl_deprep_term_function)
*(5243552)();
rl_clear_signals();
save_parser_state(&v5);
if (!a2)
v8 = "v";
else
v8 = "C-xC-e";
v2 = parse_and_execute(v3, v8, 0x4, v3);
restore_parser_state(&v5);
reset_readahead_token(&v5, a1, 0x4, a3, a4, a5);
if (rl_prep_term_function)
*(5243600)(v1);
rl_set_signals();
current_command_line_count = saved_command_line_count;
*(rl_line_buffer) = 0;
rl_end = 0;
rl_point = rl_end;
rl_done = 0;
rl_readline_state = v0;
if (!a2)
rl_vi_insertion_mode(0x1, a1);
rl_forced_update_display();
return v2;
} | bash | angr_dream |
static _Bool
parse_accesscheck(const struct parser_table *entry, char **argv, int *arg_ptr) {
struct predicate *our_pred;
(void)argv;
(void)arg_ptr;
our_pred = insert_primary_noarg(entry);
our_pred->need_stat = our_pred->need_type = 0;
our_pred->side_effects = our_pred->no_default_print = 0;
if ((((our_pred)->pred_func) == (pred_executable)))
our_pred->est_success_rate = 0.2;
else
our_pred->est_success_rate = 0.9;
return 1;
} | long long parse_accesscheck(unsigned long long a0, unsigned long a1,
unsigned long a2) {
unsigned long v0;
unsigned long v1;
struct_0 *v2;
v1 = a1;
v0 = a2;
v2 = insert_primary_noarg(a0);
v2->field_1b = 0;
v2->field_1a = v2->field_1b;
v2->field_19 = 0;
v2->field_18 = v2->field_19;
if (v2->field_0 == got.pred_executable)
v2->field_24 = 4561245704505052365;
else
v2->field_24 = 1063675494;
return 1;
} | findutils | angr_phoenix |
static _Bool
print_page(void) {
int j;
int lines_left_on_page;
COLUMN *p;
_Bool pv;
init_page();
if (cols_ready_to_print() == 0)
return 0;
if (extremities)
print_a_header = 1;
pad_vertically = 0;
pv = 0;
lines_left_on_page = lines_per_body;
if (double_space)
lines_left_on_page *= 2;
while (lines_left_on_page > 0 && cols_ready_to_print() > 0) {
output_position = 0;
spaces_not_printed = 0;
separators_not_printed = 0;
pad_vertically = 0;
align_empty_cols = 0;
empty_line = 1;
for (j = 1, p = column_vector; j <= columns; ++j, ++p) {
input_position = 0;
if (p->lines_to_print > 0 || p->status == FF_FOUND) {
FF_only = 0;
padding_not_printed = p->start_position;
if (!(p->print_func)(p))
read_rest_of_line(p);
pv |= pad_vertically;
--p->lines_to_print;
if (p->lines_to_print <= 0) {
if (cols_ready_to_print() == 0)
break;
}
if (parallel_files && p->status != OPEN) {
if (empty_line)
align_empty_cols = 1;
else if (p->status == CLOSED || (p->status == ON_HOLD && FF_only))
align_column(p);
}
} else if (parallel_files) {
if (empty_line)
align_empty_cols = 1;
else
align_column(p);
}
if (use_col_separator)
++separators_not_printed;
}
if (pad_vertically) {
putchar_unlocked('\n');
--lines_left_on_page;
}
if (cols_ready_to_print() == 0 && !extremities)
break;
if (double_space && pv) {
putchar_unlocked('\n');
--lines_left_on_page;
}
}
if (lines_left_on_page == 0)
for (j = 1, p = column_vector; j <= columns; ++j, ++p)
if (p->status == OPEN)
p->full_page_printed = 1;
pad_vertically = pv;
if (pad_vertically && extremities)
pad_down(lines_left_on_page + lines_per_footer);
else if (keep_FF && print_a_FF) {
putchar_unlocked('\f');
print_a_FF = 0;
}
if (last_page_number < ++page_number)
return 0;
reset_status();
return 1;
} | long print_page() {
bool v1;
int v2;
int v3;
int v4;
int *i;
char *v6;
init_page();
if (!(unsigned int)cols_ready_to_print())
return 0LL;
if (extremities)
print_a_header = 1;
pad_vertically = 0;
v1 = 0;
v4 = lines_per_body;
if (double_space)
v4 = 2 * lines_per_body;
LABEL_37:
if (v4 > 0 && (unsigned int)cols_ready_to_print()) {
output_position = 0;
spaces_not_printed = 0;
separators_not_printed = 0;
pad_vertically = 0;
align_empty_cols = 0;
empty_line = 1;
v2 = 1;
for (i = (int *)column_vector;; i += 16) {
if (v2 > columns) {
LABEL_30:
if (pad_vertically) {
putchar_unlocked(10);
--v4;
}
if ((unsigned int)cols_ready_to_print() || extremities == 1) {
if (double_space && v1) {
putchar_unlocked(10);
--v4;
}
goto LABEL_37;
}
goto LABEL_39;
}
input_position = 0;
if (i[12] <= 0 && i[4] != 1)
break;
FF_only = 0;
padding_not_printed = i[13];
if ((*((unsigned char (**)(int *))i + 3))(i) != 1)
read_rest_of_line((FILE **)i);
v1 = (unsigned char)(v1 | pad_vertically) != 0;
if (--i[12] <= 0 && !(unsigned int)cols_ready_to_print())
goto LABEL_30;
if (parallel_files && i[4]) {
if (empty_line) {
align_empty_cols = 1;
goto LABEL_26;
}
if (i[4] == 3 || i[4] == 2 && FF_only)
goto LABEL_25;
}
LABEL_26:
if (use_col_separator)
++separators_not_printed;
++v2;
}
if (!parallel_files)
goto LABEL_26;
if (empty_line) {
align_empty_cols = 1;
goto LABEL_26;
}
LABEL_25:
align_column((long)i);
goto LABEL_26;
}
LABEL_39:
if (!v4) {
v3 = 1;
v6 = (char *)column_vector;
while (v3 <= columns) {
if (!*((_DWORD *)v6 + 4))
v6[57] = 1;
++v3;
v6 += 64;
}
}
pad_vertically = v1;
if (v1 && extremities) {
pad_down(v4 + 5);
} else if (keep_FF && print_a_FF) {
putchar_unlocked(12);
print_a_FF = 0;
}
if (++page_number > (unsigned long)last_page_number)
return 0LL;
reset_status();
return 1LL;
} | coreutils | ida |
static u_int st_hash(const char *name, size_t len, int tabsz) {
u_int key = 0;
((void)sizeof((name != ((void *)0)) ? 1 : 0), __extension__({
if (name != ((void *)0))
;
else
__assert_fail("name != NULL", "pwcache.c", 96,
__extension__ __PRETTY_FUNCTION__);
}));
while (len--) {
key += *name++;
key = (key << 8) | (key >> 24);
}
return key % tabsz;
} | long st_hash(char *a1, long a2, unsigned int a3) {
char *v3;
char *v7;
unsigned int v8;
v7 = a1;
v8 = 0;
if (!a1)
_assert_fail("name != NULL", "pwcache.c", 0x60u, "st_hash");
while (a2--) {
v3 = v7++;
v8 = __ROL4__(*v3 + v8, 8);
}
return v8 % a3;
} | libbsd-0.11.7 | ida |
static gl_list_t gl_linked_nx_create(gl_list_implementation_t implementation,
gl_listelement_equals_fn equals_fn,
gl_listelement_hashcode_fn hashcode_fn,
gl_listelement_dispose_fn dispose_fn,
_Bool allow_duplicates, size_t count,
const void **contents) {
struct gl_list_impl *list =
(struct gl_list_impl *)malloc(sizeof(struct gl_list_impl));
gl_list_node_t tail;
if (list == ((void *)0))
return ((void *)0);
list->base.vtable = implementation;
list->base.equals_fn = equals_fn;
list->base.hashcode_fn = hashcode_fn;
list->base.dispose_fn = dispose_fn;
list->base.allow_duplicates = allow_duplicates;
list->count = count;
tail = &list->root;
for (; count > 0; contents++, count--) {
gl_list_node_t node =
(struct gl_list_node_impl *)malloc(sizeof(struct gl_list_node_impl));
if (node == ((void *)0))
goto fail2;
node->value = *contents;
node->prev = tail;
tail->next = node;
tail = node;
}
tail->next = &list->root;
list->root.prev = tail;
return list;
fail2: {
gl_list_node_t node;
for (node = tail; node != &list->root;) {
gl_list_node_t prev = node->prev;
free(node);
node = prev;
}
}
free(list);
return ((void *)0);
} | long long gl_linked_nx_create(unsigned long a0, unsigned long a1,
unsigned long a2, unsigned long a3,
unsigned long a4, unsigned long a5,
unsigned long long *v6) {
unsigned long v0;
unsigned long long v1[3];
unsigned long long v2[3];
void *v3;
unsigned long long v4[3];
void *v5;
void *v7;
v0 = a5;
v3 = malloc(0x48);
if (!v3) {
v7 = 0;
} else {
*(v3) = a0;
*(&v3[8]) = a1;
*(&v3[16]) = a2;
*(&v3[24]) = a3;
*(&v3[32]) = a4;
*(&v3[64]) = v0;
v1[0] = v3 + 40;
while (true) {
if (v0) {
v4[0] = malloc(0x18);
if (v4) {
v4[2] = *(v6);
v4[1] = v1;
v1[0] = v4;
v1[0] = v4;
v6 += 1;
v0 -= 1;
} else {
for (v2[0] = v1; v2 != v3 + 40; v2[0] = v5) {
v5 = v2[1];
free(v2);
}
free(v3);
v7 = 0;
break;
}
} else {
v1[0] = v3 + 40;
*(&v3[48]) = v1;
v7 = v3;
break;
}
}
}
return v7;
} | gnutls | angr_dream |
static void e2fsck_block_alloc_stats(ext2_filsys fs, blk64_t blk, int inuse) {
e2fsck_t ctx = (e2fsck_t)fs->priv_data;
if (ctx->block_found_map && ctx->block_metadata_map && inuse < 0 &&
ext2fs_test_block_bitmap2(ctx->block_metadata_map, blk))
return;
if (ctx->block_found_map) {
if (inuse > 0)
ext2fs_mark_block_bitmap2(ctx->block_found_map, blk);
else
ext2fs_unmark_block_bitmap2(ctx->block_found_map, blk);
}
} | long e2fsck_block_alloc_stats(long a1, long a2, int a3) {
long result;
long v5;
v5 = *(_QWORD *)(a1 + 224);
if (!*(_QWORD *)(v5 + 416) || !*(_QWORD *)(v5 + 912) || a3 >= 0 ||
(result = ext2fs_test_block_bitmap2(*(_QWORD *)(v5 + 912), a2),
!(_DWORD)result)) {
result = *(_QWORD *)(v5 + 416);
if (result) {
if (a3 <= 0)
return ext2fs_unmark_block_bitmap2(*(_QWORD *)(v5 + 416), a2);
else
return ext2fs_mark_block_bitmap2(*(_QWORD *)(v5 + 416), a2);
}
}
return result;
} | e2fsprogs-1.46.5 | ida |
static size_t adjust_column(size_t column, char c) {
if (!count_bytes) {
if (c == '\b') {
if (column > 0)
column--;
} else if (c == '\r')
column = 0;
else if (c == '\t')
column += 8 - column % 8;
else
column++;
} else
column++;
return column;
} | int adjust_column(unsigned long a0, unsigned long a1) {
void *v0;
v0 = a0;
if (!(count_bytes ^ 1)) {
v0 += 1;
} else if (a1 == 8) {
if (v0)
v0 -= 1;
} else {
if (a1 == 13) {
v0 = 0;
} else if (a1 == 9) {
v0 = (v0 & -8) + 8;
} else {
v0 += 1;
}
}
return v0;
} | coreutils | angr_dream |
int where_history(void) { return history_offset; } | long where_history() { return (unsigned int)history_offset; } | libedit | ida |
static void invis_nul(int *outp) {
invis_addc(outp, '\0', 0);
*outp -= 1;
} | long long invis_nul(unsigned int *a0) {
unsigned int *v0;
v0 = a0;
invis_addc(a0, 0x0, 0x0);
*(a0) = *(a0)-1;
return a0;
} | bash | angr_dream |
static void print_flag(enum output_type t, __u32 *flags, __u32 flag,
const char *name) {
if (*flags & flag) {
*flags &= ~flag;
print_string(t, ((void *)0), *flags ? "%s," : "%s", name);
}
} | void print_flag(unsigned long a0, unsigned int *a1, unsigned long a2,
unsigned long long a3) {
unsigned int v0;
unsigned long long v2;
unsigned long long v3;
unsigned long long v4;
v0 = a2;
v2 = *(a1)&a2;
if ((*(a1)&a2)) {
*(a1) = !(v0) & *(a1);
if (*(a1))
v3 = "%s,";
else
v3 = "%s";
v4 = print_string(a0, 0x0, v3, a3);
}
return;
} | iproute2-6.0.0 | angr_dream |
static void cut_fields(FILE *stream) {
int c;
uintmax_t field_idx = 1;
_Bool found_any_selected_field = 0;
_Bool buffer_first_field;
current_rp = frp;
c = getc_unlocked(stream);
if (c == (-1))
return;
ungetc(c, stream);
c = 0;
buffer_first_field = (suppress_non_delimited ^ !print_kth(1));
while (1) {
if (field_idx == 1 && buffer_first_field) {
ssize_t len;
size_t n_bytes;
len = getndelim2(&field_1_buffer, &field_1_bufsize, 0, ((size_t)-1),
delim, line_delim, stream);
if (len < 0) {
free(field_1_buffer);
field_1_buffer = ((void *)0);
if (ferror_unlocked(stream) || feof_unlocked(stream))
break;
xalloc_die();
}
n_bytes = len;
((void)sizeof((n_bytes != 0) ? 1 : 0), __extension__({
if (n_bytes != 0)
;
else
__assert_fail("n_bytes != 0", "src/cut.c", 315,
__extension__ __PRETTY_FUNCTION__);
}));
c = 0;
if (to_uchar(field_1_buffer[n_bytes - 1]) != delim) {
if (suppress_non_delimited) {
} else {
fwrite_unlocked(field_1_buffer, sizeof(char), n_bytes, stdout);
if (field_1_buffer[n_bytes - 1] != line_delim)
putchar_unlocked(line_delim);
c = line_delim;
}
continue;
}
if (print_kth(1)) {
fwrite_unlocked(field_1_buffer, sizeof(char), n_bytes - 1, stdout);
if (delim == line_delim) {
int last_c = getc_unlocked(stream);
if (last_c != (-1)) {
ungetc(last_c, stream);
found_any_selected_field = 1;
}
} else
found_any_selected_field = 1;
}
next_item(&field_idx);
}
int prev_c = c;
if (print_kth(field_idx)) {
if (found_any_selected_field) {
fwrite_unlocked(output_delimiter_string, sizeof(char),
output_delimiter_length, stdout);
}
found_any_selected_field = 1;
while ((c = getc_unlocked(stream)) != delim && c != line_delim &&
c != (-1)) {
putchar_unlocked(c);
prev_c = c;
}
} else {
while ((c = getc_unlocked(stream)) != delim && c != line_delim &&
c != (-1)) {
prev_c = c;
}
}
if (delim == line_delim && c == delim) {
int last_c = getc_unlocked(stream);
if (last_c != (-1))
ungetc(last_c, stream);
else
c = last_c;
}
if (c == delim)
next_item(&field_idx);
else if (c == line_delim || c == (-1)) {
if (found_any_selected_field ||
!(suppress_non_delimited && field_idx == 1)) {
if (c == line_delim || prev_c != line_delim || delim == line_delim)
putchar_unlocked(line_delim);
}
if (c == (-1))
break;
field_idx = 1;
current_rp = frp;
found_any_selected_field = 0;
}
}
} | long long cut_fields(void *a0) {
unsigned long v0;
char v1;
char v2;
unsigned int v3;
unsigned int v4;
unsigned int v5;
unsigned int v6;
unsigned long long v7;
unsigned int v8;
unsigned int v9;
v7 = 1;
v1 = 0;
current_rp = frp;
v3 = getc_unlocked(a0);
if (v3 != -1) {
ungetc(v3, a0);
v3 = 0;
v2 = (suppress_non_delimited ^ print_kth(0x1) ^ 1);
while (true) {
if (v7 == 1 && v2) {
v0 = a0;
*(&v8) = getndelim2(&field_1_buffer, &field_1_bufsize, 0x0,
0xffffffffffffffff, delim, line_delim);
if ((*(&v8) - 0 >> 63)) {
free(field_1_buffer);
field_1_buffer = 0;
if (!ferror_unlocked(a0)) {
if (!feof_unlocked(a0))
xalloc_die();
break;
}
} else {
*(&v9) = *(&v8);
if (!*(&v9))
__assert_fail();
v3 = 0;
if (to_uchar(*(-1 + field_1_buffer + *(&v9))) == delim) {
if (print_kth(0x1)) {
fwrite_unlocked(field_1_buffer, 0x1, *(&v9) - 1, *(&stdout));
if (delim != line_delim) {
v1 = 1;
} else {
v5 = getc_unlocked(a0);
if (v5 != -1) {
ungetc(v5, a0);
v1 = 1;
}
}
}
next_item(&v7);
} else {
if (!suppress_non_delimited) {
fwrite_unlocked(field_1_buffer, 0x1, *(&v9), *(&stdout));
if (*(-1 + field_1_buffer + *(&v9)) != line_delim)
putchar_unlocked(line_delim);
v3 = line_delim;
}
continue;
}
}
}
v4 = v3;
if (print_kth(v7)) {
if (v1)
fwrite_unlocked(output_delimiter_string, 0x1, output_delimiter_length,
*(&stdout));
v1 = 1;
while (true) {
v3 = getc_unlocked(a0);
if (v3 == delim)
break;
if (v3 == line_delim)
break;
if (v3 == -1)
break;
putchar_unlocked(v3);
v4 = v3;
}
} else {
while (true) {
v3 = getc_unlocked(a0);
if (v3 == delim)
break;
if (v3 == line_delim)
break;
if (v3 == -1)
break;
v4 = v3;
}
}
if (delim == line_delim && v3 == delim) {
v6 = getc_unlocked(a0);
if (v6 == -1)
v3 = v6;
else
ungetc(v6, a0);
}
if (v3 == delim) {
next_item(&v7);
continue;
}
if (v3 != line_delim && !(v3 == -1))
continue;
if (!v1 && !(suppress_non_delimited ^ 1) && v7 == 1)
goto LABEL_400a98;
if (v3 != line_delim && v4 == line_delim && !(delim == line_delim))
goto LABEL_400a98;
putchar_unlocked(line_delim);
LABEL_400a98:
if (v3 == -1)
break;
v7 = 1;
current_rp = frp;
v1 = 0;
}
}
return 0;
} | coreutils | angr_phoenix |
static int run_program(char **argv) {
int fds[2];
int status, rc, pid;
char buffer[80];
struct sigaction sa;
if (pipe(fds) < 0) {
perror("pipe");
exit(1);
}
memset(&sa, 0, sizeof(struct sigaction));
sa.__sigaction_handler.sa_handler = signal_term;
sigaction(2, &sa, 0);
sigaction(15, &sa, 0);
sa.sa_flags = 0x10000000;
pid = fork();
if (pid < 0) {
perror("vfork");
exit(1);
}
if (pid == 0) {
dup2(fds[1], 1);
dup2(fds[1], 2);
close(fds[0]);
close(fds[1]);
execvp(argv[0], argv);
perror(argv[0]);
exit(1);
}
child_pid = pid;
close(fds[1]);
while (!(waitpid(pid, &status, 1))) {
do_read(fds[0]);
}
child_pid = -1;
do_read(fds[0]);
close(fds[0]);
if ((((status) & 0x7f) == 0)) {
rc = (((status) & 0xff00) >> 8);
if (rc) {
send_output(argv[0], 0, 0x03);
sprintf(buffer, " exited with status code %d\n", rc);
send_output(buffer, 0, 0x03);
}
} else {
if ((((signed char)(((status) & 0x7f) + 1) >> 1) > 0)) {
send_output(argv[0], 0, 0x03);
sprintf(buffer, "died with signal %d\n",
((status) & 0x7f));
send_output(buffer, 0, 0x03);
return 1;
}
rc = 0;
}
return rc;
} | int run_program(unsigned long long *a0) {
char v0;
unsigned int v1;
unsigned int v2;
char v3;
char v4;
unsigned long long v5;
unsigned int v6;
char v7;
unsigned int v9;
if (pipe(&v3) < 0) {
perror("pipe");
exit(0x1);
}
memset(&v5, 0x0, 0x98);
v5 = signal_term;
sigaction(0x2, &v5, 0x0);
sigaction(0xf, &v5, 0x0);
v6 = 0x10000000;
v2 = fork();
if (v2 < 0) {
perror("vfork");
exit(0x1);
} else if (!v2) {
dup2(*(&v4), 0x1);
dup2(*(&v4), 0x2);
close(*(&v3));
close(*(&v4));
execvp(*(a0), a0);
perror(*(a0));
exit(0x1);
} else {
child_pid = v2;
close(*(&v4));
while (!waitpid(v2, &v0, 0x1)) {
do_read(*(&v3));
}
child_pid = -1;
do_read(*(&v3));
close(*(&v3));
if (!(*(&v0) & 127)) {
v1 = (*(&v0) >> 8) & 255;
if (v1) {
send_output(*(a0), 0x0, 0x3);
sprintf(&v7, " exited with status code %d\n", v1);
send_output(&v7, 0x0, 0x3);
}
} else if (((*(&v0) & 127) + 1 >> 1) <= 0) {
v1 = 0;
} else {
send_output(*(a0), 0x0, 0x3);
sprintf(&v7, "died with signal %d\n", *(&v0) & 127);
send_output(&v7, 0x0, 0x3);
v9 = 1;
goto LABEL_4006bf;
}
v9 = v1;
LABEL_4006bf:
return v9;
}
} | sysvinit | angr_phoenix |
off64_t gzoffset64(file)
gzFile file;
{
off64_t offset;
gz_statep state;
if (file == ((void *)0))
return -1;
state = (gz_statep)file;
if (state->mode != 7247 && state->mode != 31153)
return -1;
offset = lseek64(state->fd, 0, 1);
if (offset == -1)
return -1;
if (state->mode == 7247)
offset -= state->strm.avail_in;
return offset;
} | long gzoffset64(long param_1)
{
long lVar1;
if (param_1 == 0) {
lVar1 = -1;
} else if ((*(int *)(param_1 + 0x18) == 0x1c4f) ||
(*(int *)(param_1 + 0x18) == 0x79b1)) {
lVar1 = lseek64(*(int *)(param_1 + 0x1c), 0, 1);
if (lVar1 == -1) {
lVar1 = -1;
} else if (*(int *)(param_1 + 0x18) == 0x1c4f) {
lVar1 = lVar1 - (ulong) * (uint *)(param_1 + 0x88);
}
} else {
lVar1 = -1;
}
return lVar1;
} | zlib | ghidra |
static int compare_host(const char *a, const char *b) {
if (a == ((void *)0) && b == ((void *)0))
return 1;
if (a == ((void *)0) || b == ((void *)0))
return 0;
return strcmp(a, b) == 0;
} | int compare_host(char *a0, char *a1) {
unsigned int v1;
if (!a0 && !a1)
v1 = 1;
if (a0 || a1) {
if (a0 && a1)
v1 = !strcmp(a0, a1);
if (!a0 || !a1)
v1 = 0;
}
return v1;
} | openssh-portable | angr_dream |
int addr_cmp(const struct xaddr *a, const struct xaddr *b) {
int i;
if (a->af != b->af)
return (a->af == 10 ? 1 : -1);
switch (a->af) {
case 2:
if (a->xa.v4.s_addr == b->xa.v4.s_addr)
return 0;
return (ntohl(a->xa.v4.s_addr) > ntohl(b->xa.v4.s_addr) ? 1 : -1);
case 10:
for (i = 0; i < 16; i++)
if (a->xa.addr8[i] - b->xa.addr8[i] != 0)
return (a->xa.addr8[i] - b->xa.addr8[i]);
if (a->scope_id == b->scope_id)
return (0);
return (a->scope_id > b->scope_id ? 1 : -1);
default:
return (-1);
}
} | void addr_cmp(struct_0 *a0, struct_0 *a1) {
unsigned int v0;
unsigned long v2;
unsigned long v3;
unsigned long long v4;
unsigned long v5;
unsigned long long v6;
if (a0->field_0 != a1->field_0) {
v2 = (a0->field_0 == 10 ? 4294967295 : 1);
return;
}
switch (a0->field_0) {
case 2:
v3 = (a0->field_4 == a1->field_4
? (ntohl(a0->field_4) <= ntohl(a1->field_4) ? 1 : 4294967295)
: 0);
return;
case 10:
for (v0 = 0; v0 <= 15;
v0 = __addvsi3(v0, 0x1, a1, *(4 + &a0->field_0 + v0))) {
if (*(4 + &a0->field_0 + v0) != *(4 + &a1->field_0 + v0)) {
v6 = __subvsi3(*(4 + &a0->field_0 + v0), *(4 + &a1->field_0 + v0),
*(4 + &a1->field_0 + v0), a1);
return;
}
}
v5 = (a0->field_14 == a1->field_14
? (a0->field_14 <= a1->field_14 ? 1 : 4294967295)
: 0);
return;
default:
v4 = 4294967295;
return;
}
} | openssh-portable | angr_sailr |
int print_addrinfo(struct nlmsghdr *n, void *arg) {
FILE *fp = arg;
struct ifaddrmsg *ifa =
((void *)(((char *)n) +
((int)(((sizeof(struct nlmsghdr)) + 4U - 1) & ~(4U - 1)))));
int len = n->nlmsg_len;
unsigned int ifa_flags;
struct rtattr *rta_tb[(__IFA_MAX - 1) + 1];
char b1[64];
if (n->nlmsg_type != RTM_NEWADDR && n->nlmsg_type != RTM_DELADDR)
return 0;
len -= ((sizeof(*ifa)) +
((int)(((sizeof(struct nlmsghdr)) + 4U - 1) & ~(4U - 1))));
if (len < 0) {
fprintf(stderr, "BUG: wrong nlmsg len %d\n", len);
return -1;
}
if (filter.flushb && n->nlmsg_type != RTM_NEWADDR)
return 0;
parse_rtattr(
rta_tb, (__IFA_MAX - 1),
((struct rtattr *)(((char *)(ifa)) +
(((sizeof(struct ifaddrmsg)) + 4U - 1) & ~(4U - 1)))),
n->nlmsg_len -
((sizeof(*ifa)) +
((int)(((sizeof(struct nlmsghdr)) + 4U - 1) & ~(4U - 1)))));
ifa_flags = get_ifa_flags(ifa, rta_tb[IFA_FLAGS]);
if (!rta_tb[IFA_LOCAL])
rta_tb[IFA_LOCAL] = rta_tb[IFA_ADDRESS];
if (!rta_tb[IFA_ADDRESS])
rta_tb[IFA_ADDRESS] = rta_tb[IFA_LOCAL];
if (filter.ifindex && filter.ifindex != ifa->ifa_index)
return 0;
if ((filter.scope ^ ifa->ifa_scope) & filter.scopemask)
return 0;
if ((filter.flags ^ ifa_flags) & filter.flagmask)
return 0;
if (filter.family && filter.family != ifa->ifa_family)
return 0;
if (ifa_label_match_rta(ifa->ifa_index, rta_tb[IFA_LABEL]))
return 0;
if (inet_addr_match_rta(&filter.pfx, rta_tb[IFA_LOCAL]))
return 0;
if (filter.flushb) {
struct nlmsghdr *fn;
if ((((filter.flushp) + 4U - 1) & ~(4U - 1)) + n->nlmsg_len >
filter.flushe) {
if (flush_update())
return -1;
}
fn = (struct nlmsghdr *)(filter.flushb +
(((filter.flushp) + 4U - 1) & ~(4U - 1)));
memcpy(fn, n, n->nlmsg_len);
fn->nlmsg_type = RTM_DELADDR;
fn->nlmsg_flags = 0x01;
fn->nlmsg_seq = ++rth.seq;
filter.flushp = (((char *)fn) + n->nlmsg_len) - filter.flushb;
filter.flushed++;
if (show_stats < 2)
return 0;
}
if (n->nlmsg_type == RTM_DELADDR)
print_bool(PRINT_ANY, "deleted", "Deleted ", 1);
if (!brief) {
const char *name;
if (filter.oneline || filter.flushb) {
const char *dev = ll_index_to_name(ifa->ifa_index);
if (is_json_context()) {
print_int(PRINT_JSON, "index", ((void *)0), ifa->ifa_index);
print_string(PRINT_JSON, "dev", ((void *)0), dev);
} else {
fprintf(fp, "%u: %s", ifa->ifa_index, dev);
}
}
name = family_name(ifa->ifa_family);
if (*name != '?') {
print_string(PRINT_ANY, "family", " %s ", name);
} else {
print_int(PRINT_ANY, "family_index", " family %d ", ifa->ifa_family);
}
}
if (rta_tb[IFA_LOCAL]) {
print_color_string(
PRINT_ANY, ifa_family_color(ifa->ifa_family), "local", "%s",
format_host(
ifa->ifa_family,
((int)((rta_tb[IFA_LOCAL])->rta_len) -
((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0))),
((void *)(((char *)(rta_tb[IFA_LOCAL])) +
((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) +
(0))))));
if (rta_tb[IFA_ADDRESS] &&
memcmp(((void *)(((char *)(rta_tb[IFA_ADDRESS])) +
((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) +
(0)))),
((void *)(((char *)(rta_tb[IFA_LOCAL])) +
((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) +
(0)))),
ifa->ifa_family == 2 ? 4 : 16)) {
print_string(PRINT_FP, ((void *)0), " %s ", "peer");
print_color_string(
PRINT_ANY, ifa_family_color(ifa->ifa_family), "address", "%s",
format_host(
ifa->ifa_family,
((int)((rta_tb[IFA_ADDRESS])->rta_len) -
((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0))),
((void *)(((char *)(rta_tb[IFA_ADDRESS])) +
((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) +
(0))))));
}
print_int(PRINT_ANY, "prefixlen", "/%d ", ifa->ifa_prefixlen);
if (rta_tb[IFA_RT_PRIORITY])
print_uint(PRINT_ANY, "metric", "metric %u ",
rta_getattr_u32(rta_tb[IFA_RT_PRIORITY]));
}
if (brief)
goto brief_exit;
if (rta_tb[IFA_BROADCAST]) {
print_string(PRINT_FP, ((void *)0), "%s ", "brd");
print_color_string(
PRINT_ANY, ifa_family_color(ifa->ifa_family), "broadcast", "%s ",
format_host(
ifa->ifa_family,
((int)((rta_tb[IFA_BROADCAST])->rta_len) -
((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0))),
((void *)(((char *)(rta_tb[IFA_BROADCAST])) +
((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) +
(0))))));
}
if (rta_tb[IFA_ANYCAST]) {
print_string(PRINT_FP, ((void *)0), "%s ", "any");
print_color_string(
PRINT_ANY, ifa_family_color(ifa->ifa_family), "anycast", "%s ",
format_host(
ifa->ifa_family,
((int)((rta_tb[IFA_ANYCAST])->rta_len) -
((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0))),
((void *)(((char *)(rta_tb[IFA_ANYCAST])) +
((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) +
(0))))));
}
print_string(PRINT_ANY, "scope", "scope %s ",
rtnl_rtscope_n2a(ifa->ifa_scope, b1, sizeof(b1)));
print_ifa_flags(fp, ifa, ifa_flags);
if (rta_tb[IFA_LABEL])
print_string(PRINT_ANY, "label", "%s", rta_getattr_str(rta_tb[IFA_LABEL]));
if (rta_tb[IFA_CACHEINFO]) {
struct ifa_cacheinfo *ci =
((void *)(((char *)(rta_tb[IFA_CACHEINFO])) +
((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0))));
print_nl();
print_string(PRINT_FP, ((void *)0), " valid_lft ", ((void *)0));
if (ci->ifa_valid == 0xFFFFFFFFU) {
print_uint(PRINT_JSON, "valid_life_time",
((void *)0), 0xFFFFFFFFU);
print_string(PRINT_FP, ((void *)0), "%s", "forever");
} else {
print_uint(PRINT_ANY, "valid_life_time", "%usec", ci->ifa_valid);
}
print_string(PRINT_FP, ((void *)0), " preferred_lft ", ((void *)0));
if (ci->ifa_prefered == 0xFFFFFFFFU) {
print_uint(PRINT_JSON, "preferred_life_time",
((void *)0), 0xFFFFFFFFU);
print_string(PRINT_FP, ((void *)0), "%s", "forever");
} else {
if (ifa_flags & 0x20)
print_int(PRINT_ANY, "preferred_life_time", "%dsec", ci->ifa_prefered);
else
print_uint(PRINT_ANY, "preferred_life_time", "%usec", ci->ifa_prefered);
}
}
print_string(PRINT_FP, ((void *)0), "%s", "\n");
brief_exit:
fflush(fp);
return 0;
} | undefined8 print_addrinfo(uint *param_1, FILE *param_2)
{
char cVar1;
uint uVar2;
int iVar3;
undefined4 uVar4;
uint *puVar5;
undefined8 uVar6;
void *__dest;
char *pcVar7;
int *piVar8;
size_t __n;
long in_FS_OFFSET;
undefined local_c8[8];
ushort *local_c0;
ushort *local_b8;
long local_b0;
ushort *local_a8;
ushort *local_a0;
long local_98;
undefined8 local_88;
long local_80;
undefined local_68[72];
long local_20;
local_20 = *(long *)(in_FS_OFFSET + 0x28);
puVar5 = param_1 + 4;
if ((*(short *)(param_1 + 1) == 0x14) || (*(short *)(param_1 + 1) == 0x15)) {
if ((int)(*param_1 - 0x18) < 0) {
fprintf(stderr, "BUG: wrong nlmsg len %d\n", (ulong)(*param_1 - 0x18));
uVar6 = 0xffffffff;
} else if ((filter._320_8_ == 0) || (*(short *)(param_1 + 1) == 0x14)) {
parse_rtattr(local_c8, 0xb, param_1 + 6, *param_1 - 0x18);
uVar2 = get_ifa_flags(puVar5, local_88);
if (local_b8 == (ushort *)0x0) {
local_b8 = local_c0;
}
if (local_c0 == (ushort *)0x0) {
local_c0 = local_b8;
}
if ((filter._0_4_ == 0) || (filter._0_4_ == param_1[5])) {
if ((filter._284_4_ &
(filter._280_4_ ^ *(byte *)((long)param_1 + 0x13))) == 0) {
if (((filter._288_4_ ^ uVar2) & filter._292_4_) == 0) {
if ((filter._4_4_ == 0) || (filter._4_4_ == *(byte *)puVar5)) {
iVar3 = ifa_label_match_rta(param_1[5], local_b0);
if (iVar3 == 0) {
iVar3 = inet_addr_match_rta(0x108510, local_b8);
if (iVar3 == 0) {
if (filter._320_8_ != 0) {
if (filter._332_4_ <
(filter._328_4_ + 3U & 0xfffffffc) + *param_1) {
iVar3 = flush_update();
if (iVar3 != 0) {
uVar6 = 0xffffffff;
goto LAB_00105716;
}
}
__dest =
(void *)((ulong)(filter._328_4_ + 3U & 0xfffffffc) +
filter._320_8_);
memcpy(__dest, param_1, (ulong)*param_1);
*(undefined2 *)((long)__dest + 4) = 0x15;
*(undefined2 *)((long)__dest + 6) = 1;
DAT_0010b1ec = DAT_0010b1ec + 1;
*(int *)((long)__dest + 8) = DAT_0010b1ec;
filter._328_4_ =
(*param_1 + (int)__dest) - (int)filter._320_8_;
filter._312_4_ = filter._312_4_ + 1;
if (show_stats < 2) {
uVar6 = 0;
goto LAB_00105716;
}
}
if (*(short *)(param_1 + 1) == 0x15) {
print_bool(4, "deleted", "Deleted ", 1);
}
if (brief == 0) {
if ((filter._8_4_ != 0) || (filter._320_8_ != 0)) {
uVar6 = ll_index_to_name(param_1[5]);
cVar1 = is_json_context();
if (cVar1 == '\0') {
fprintf(param_2, "%u: %s", (ulong)param_1[5], uVar6);
} else {
print_int(2, "index", 0, param_1[5]);
print_string(2, &DAT_00109678, 0, uVar6);
}
}
pcVar7 = (char *)family_name(*(byte *)puVar5);
if (*pcVar7 == '?') {
print_int(4, "family_index", " family %d ",
*(byte *)puVar5);
} else {
print_string(4, "family", " %s ", pcVar7);
}
}
if (local_b8 != (ushort *)0x0) {
uVar6 = format_host(*(byte *)puVar5, *local_b8 - 4,
local_b8 + 2);
uVar4 = ifa_family_color(*(byte *)puVar5);
print_color_string(4, uVar4, "local", &DAT_00108b24, uVar6);
if (local_c0 != (ushort *)0x0) {
if (*(byte *)puVar5 == 2) {
__n = 4;
} else {
__n = 0x10;
}
iVar3 = memcmp(local_c0 + 2, local_b8 + 2, __n);
if (iVar3 != 0) {
print_string(1, 0, &DAT_001096b1, &DAT_001096ac);
uVar6 = format_host(*(byte *)puVar5, *local_c0 - 4,
local_c0 + 2);
uVar4 = ifa_family_color(*(byte *)puVar5);
print_color_string(4, uVar4, "address", &DAT_00108b24,
uVar6);
}
}
print_int(4, "prefixlen", &DAT_001096b6,
*(undefined *)((long)param_1 + 0x11));
if (local_80 != 0) {
uVar4 = rta_getattr_u32(local_80);
print_uint(4, "metric", "metric %u ", uVar4);
}
}
if (brief == 0) {
if (local_a8 != (ushort *)0x0) {
print_string(1, 0, &DAT_00108c37, &DAT_001096d7);
uVar6 = format_host(*(byte *)puVar5, *local_a8 - 4,
local_a8 + 2);
uVar4 = ifa_family_color(*(byte *)puVar5);
print_color_string(4, uVar4, "broadcast", &DAT_00108c37,
uVar6);
}
if (local_a0 != (ushort *)0x0) {
print_string(1, 0, &DAT_00108c37, &DAT_001096db);
uVar6 = format_host(*(byte *)puVar5, *local_a0 - 4,
local_a0 + 2);
uVar4 = ifa_family_color(*(byte *)puVar5);
print_color_string(4, uVar4, "anycast", &DAT_00108c37,
uVar6);
}
uVar6 = rtnl_rtscope_n2a(
*(undefined *)((long)param_1 + 0x13), local_68, 0x40);
print_string(4, "scope", "scope %s ", uVar6);
print_ifa_flags(param_2, puVar5, uVar2);
if (local_b0 != 0) {
uVar6 = rta_getattr_str(local_b0);
print_string(4, "label", &DAT_00108b24, uVar6);
}
if (local_98 != 0) {
piVar8 = (int *)(local_98 + 4);
print_nl();
print_string(1, 0, " valid_lft ", 0);
if (*(int *)(local_98 + 8) == -1) {
print_uint(2, "valid_life_time", 0, 0xffffffff);
print_string(1, 0, &DAT_00108b24, "forever");
} else {
print_uint(4, "valid_life_time", "%usec",
*(undefined4 *)(local_98 + 8));
}
print_string(1, 0, " preferred_lft ", 0);
if (*piVar8 == -1) {
print_uint(2, "preferred_life_time", 0, 0xffffffff);
print_string(1, 0, &DAT_00108b24, "forever");
} else if ((uVar2 & 0x20) == 0) {
print_uint(4, "preferred_life_time", "%usec", *piVar8);
} else {
print_int(4, "preferred_life_time", "%dsec", *piVar8);
}
}
print_string(1, 0, &DAT_00108b24, &DAT_001091f6);
}
fflush(param_2);
uVar6 = 0;
} else {
uVar6 = 0;
}
} else {
uVar6 = 0;
}
} else {
uVar6 = 0;
}
} else {
uVar6 = 0;
}
} else {
uVar6 = 0;
}
} else {
uVar6 = 0;
}
} else {
uVar6 = 0;
}
} else {
uVar6 = 0;
}
LAB_00105716:
if (local_20 != *(long *)(in_FS_OFFSET + 0x28)) {
__stack_chk_fail();
}
return uVar6;
} | iproute2-6.0.0 | ghidra |
static void ossl_error(const char *msg) {
unsigned long e;
sshlog("ssh-pkcs11.c", __func__, 88, 1, SYSLOG_LEVEL_ERROR, ((void *)0), "%s",
msg);
while ((e = ERR_get_error()) != 0)
sshlog("ssh-pkcs11.c", __func__, 90, 1, SYSLOG_LEVEL_ERROR, ((void *)0),
"libcrypto error: %s", ERR_error_string(e, ((void *)0)));
} | void ossl_error(unsigned long a0) {
unsigned long v0;
unsigned long long v1;
v0 = a0;
sshlog("ssh-pkcs11.c", "ossl_error", 0x58, 0x1, 0x2, 0x0, "%s");
while (true) {
*(&v1) = ERR_get_error();
if (!v1)
break;
v0 = ERR_error_string(v1, 0x0);
sshlog("ssh-pkcs11.c", "ossl_error", 0x5a, 0x1, 0x2, 0x0,
"libcrypto error: %s");
}
return;
} | openssh-portable | angr_sailr |
void ttsave() {
if (ttsaved)
return;
ttgetattr(0, &ttin);
ttgetattr(1, &ttout);
ttsaved = 1;
} | void ttsave(void)
{
if (ttsaved == 0) {
ttgetattr(0, ttin);
ttgetattr(1, ttout);
ttsaved = 1;
}
return;
} | bash | ghidra |
int complete_builtin(list)
WORD_LIST *list;
{
int opt_given, rval;
unsigned long acts, copts;
COMPSPEC *cs;
struct _optflags oflags;
WORD_LIST *l, *wl;
if (list == 0) {
print_all_completions();
return (0);
}
opt_given = oflags.pflag = oflags.rflag = 0;
oflags.Dflag = oflags.Eflag = oflags.Iflag = 0;
acts = copts = (unsigned long)0L;
Garg = Warg = Parg = Sarg = Xarg = Farg = Carg = (char *)((void *)0);
cs = (COMPSPEC *)((void *)0);
rval = build_actions(list, &oflags, &acts, &copts);
if (rval == 258)
return (rval);
opt_given = rval != 1;
list = loptend;
if (oflags.Dflag)
wl = make_word_list(make_bare_word("_DefaultCmD_"),
(WORD_LIST *)((void *)0));
else if (oflags.Eflag)
wl = make_word_list(make_bare_word("_EmptycmD_"), (WORD_LIST *)((void *)0));
else if (oflags.Iflag)
wl = make_word_list(make_bare_word("_InitialWorD_"),
(WORD_LIST *)((void *)0));
else
wl = (WORD_LIST *)((void *)0);
if (oflags.pflag || (list == 0 && opt_given == 0)) {
if (wl) {
rval = print_cmd_completions(wl);
dispose_words(wl);
return rval;
} else if (list == 0) {
print_all_completions();
return (0);
}
return (print_cmd_completions(list));
}
if (oflags.rflag) {
if (wl) {
rval = remove_cmd_completions(wl);
dispose_words(wl);
return rval;
} else if (list == 0) {
progcomp_flush();
return (0);
}
return (remove_cmd_completions(list));
}
if (wl == 0 && list == 0 && opt_given) {
builtin_usage();
return (258);
}
cs = compspec_create();
cs->actions = acts;
cs->options = copts;
cs->globpat = ((Garg) ? (char *)strcpy(sh_xmalloc((1 + strlen(Garg)),
"./complete.def", 456),
(Garg))
: (char *)((void *)0));
cs->words = ((Warg) ? (char *)strcpy(sh_xmalloc((1 + strlen(Warg)),
"./complete.def", 457),
(Warg))
: (char *)((void *)0));
cs->prefix = ((Parg) ? (char *)strcpy(sh_xmalloc((1 + strlen(Parg)),
"./complete.def", 458),
(Parg))
: (char *)((void *)0));
cs->suffix = ((Sarg) ? (char *)strcpy(sh_xmalloc((1 + strlen(Sarg)),
"./complete.def", 459),
(Sarg))
: (char *)((void *)0));
cs->funcname = ((Farg) ? (char *)strcpy(sh_xmalloc((1 + strlen(Farg)),
"./complete.def", 460),
(Farg))
: (char *)((void *)0));
cs->command = ((Carg) ? (char *)strcpy(sh_xmalloc((1 + strlen(Carg)),
"./complete.def", 461),
(Carg))
: (char *)((void *)0));
cs->filterpat = ((Xarg) ? (char *)strcpy(sh_xmalloc((1 + strlen(Xarg)),
"./complete.def", 462),
(Xarg))
: (char *)((void *)0));
for (rval = 0, l = wl ? wl : list; l; l = l->next) {
if (progcomp_insert(l->word->word, cs) == 0)
rval = 1;
}
dispose_words(wl);
return (rval);
} | long long complete_builtin(unsigned long long a0, unsigned long long a1,
unsigned long a2, unsigned long a3,
unsigned long long a4, unsigned long long a5) {
unsigned long long v0;
unsigned int v1;
unsigned int v2;
void *v3;
void *v4;
void *v5;
void *v6;
void *v7;
unsigned int v8;
unsigned int v9;
unsigned int v10;
unsigned int v11;
unsigned int v12;
unsigned long long v14;
void *v15;
void *v16;
void *v17;
void *v18;
void *v19;
void *v20;
void *v21;
void *v22;
v0 = a0;
if (!v0) {
print_all_completions();
v14 = 0;
} else {
v9 = 0;
v8 = v9;
v2 = v8;
v12 = 0;
v11 = v12;
v10 = v11;
v4 = 0;
v3 = v4;
Carg = 0;
Farg = Carg;
Xarg = Farg;
Sarg = Xarg;
Parg = Sarg;
Warg = Parg;
Garg = Warg;
v7 = 0;
v1 = build_actions(v0, &v8, &v3, &v4, a4, a5);
if (v1 == 258) {
v14 = v1;
} else {
v2 = v1 != 1;
v0 = loptend;
if (v10) {
v6 = make_word_list(make_bare_word("_DefaultCmD_"), 0x0);
} else if (v11) {
v6 = make_word_list(make_bare_word("_EmptycmD_"), 0x0);
} else if (!v12) {
v6 = 0;
} else {
v6 = make_word_list(make_bare_word("_InitialWorD_"), 0x0);
}
if (v8) {
LABEL_400721:
if (v6) {
v1 = print_cmd_completions(v6);
dispose_words(v6);
v14 = v1;
} else if (!v0) {
print_all_completions();
v14 = 0;
} else {
v14 = print_cmd_completions(v0);
}
} else {
if (!v0 && !v2)
goto LABEL_400721;
if (!v9) {
if (!v6 && !v0 && v2) {
builtin_usage(a0, a1, &v3, &v4, a4, a5);
v14 = 258;
goto LABEL_400abe;
}
v7[0] = compspec_create();
v7[1] = v3;
v7[2] = v4;
if (!Garg)
v15 = 0;
else
v15 = strcpy(sh_xmalloc(strlen(Garg) + 1, "./complete.def", 0x1c8),
Garg);
v7[3] = v15;
if (!Warg)
v16 = 0;
else
v16 = strcpy(sh_xmalloc(strlen(Warg) + 1, "./complete.def", 0x1c9),
Warg);
v7[4] = v16;
if (!Parg)
v17 = 0;
else
v17 = strcpy(sh_xmalloc(strlen(Parg) + 1, "./complete.def", 0x1ca),
Parg);
v7[5] = v17;
if (!Sarg)
v18 = 0;
else
v18 = strcpy(sh_xmalloc(strlen(Sarg) + 1, "./complete.def", 0x1cb),
Sarg);
v7[6] = v18;
if (!Farg)
v19 = 0;
else
v19 = strcpy(sh_xmalloc(strlen(Farg) + 1, "./complete.def", 0x1cc),
Farg);
v7[7] = v19;
if (!Carg)
v20 = 0;
else
v20 = strcpy(sh_xmalloc(strlen(Carg) + 1, "./complete.def", 0x1cd),
Carg);
v7[8] = v20;
if (!Xarg)
v21 = 0;
else
v21 = strcpy(sh_xmalloc(strlen(Xarg) + 1, "./complete.def", 0x1ce),
Xarg);
v7[10] = v21;
v1 = 0;
if (v6)
v22 = v6;
else
v22 = v0;
for (v5 = v22; v5; v5 = *(v5)) {
if (!progcomp_insert(*(v5[8]), v7, v7))
v1 = 1;
}
dispose_words(v6);
v14 = v1;
} else if (v6) {
v1 = remove_cmd_completions(v6);
dispose_words(v6);
v14 = v1;
} else if (!v0) {
progcomp_flush();
v14 = 0;
} else {
v14 = remove_cmd_completions(v0);
}
}
}
}
LABEL_400abe:
return v14;
} | bash | angr_phoenix |
static _Bool
read_char(int *c) {
_Bool ok = 1;
*c = (-1);
while (in_stream != ((void *)0)) {
*c = fgetc(in_stream);
if (*c != (-1))
break;
ok &= check_and_close((*__errno_location()));
ok &= open_next_file();
}
return ok;
} | int read_char(unsigned int *a0) {
char v0;
v0 = 1;
for (*(a0) = -1; in_stream; v0 = (open_next_file() & v0)) {
*(a0) = fgetc(in_stream);
if (*(a0) != -1)
return v0;
v0 = (check_and_close(*(__errno_location())) & v0);
}
return v0;
} | coreutils | angr_sailr |
static int match_cfg_line(Options *options, char **condition, struct passwd *pw,
const char *host_arg, const char *original_host,
int final_pass, int *want_final_pass,
const char *filename, int linenum) {
char *arg, *oattrib, *attrib, *cmd, *cp = *condition, *host, *criteria;
const char *ruser;
int r, port, this_result, result = 1, attributes = 0, negate;
char thishost[1025], shorthost[1025], portstr[32];
char uidstr[32];
port = options->port <= 0 ? default_ssh_port() : options->port;
ruser = options->user == ((void *)0) ? pw->pw_name : options->user;
if (final_pass) {
host = xstrdup(options->hostname);
} else if (options->hostname != ((void *)0)) {
host =
percent_expand(options->hostname, "h", host_arg, (char *)((void *)0));
} else {
host = xstrdup(host_arg);
}
sshlog("readconf.c", __func__, 608, 0, SYSLOG_LEVEL_DEBUG2, ((void *)0),
"checking match for '%s' host %s originally %s", cp, host,
original_host);
while ((oattrib = attrib = strdelim(&cp)) && *attrib != '\0') {
if (*attrib == '#') {
cp = ((void *)0);
break;
}
arg = criteria = ((void *)0);
this_result = 1;
if ((negate = attrib[0] == '!'))
attrib++;
if (strcasecmp(attrib, "all") == 0) {
if (attributes > 1 || ((arg = strdelim(&cp)) != ((void *)0) &&
*arg != '\0' && *arg != '#')) {
sshlog("readconf.c", __func__, 624, 0, SYSLOG_LEVEL_ERROR, ((void *)0),
"%.200s line %d: '%s' cannot be combined "
"with other Match attributes",
filename, linenum, oattrib)
;
result = -1;
goto out;
}
if (arg != ((void *)0) && *arg == '#')
cp = ((void *)0);
if (result)
result = negate ? 0 : 1;
goto out;
}
attributes++;
if (strcasecmp(attrib, "canonical") == 0 ||
strcasecmp(attrib, "final") == 0) {
if (strcasecmp(attrib, "final") == 0 && want_final_pass != ((void *)0))
*want_final_pass = 1;
r = !!final_pass;
if (r == (negate ? 1 : 0))
this_result = result = 0;
sshlog("readconf.c", __func__, 650, 0, SYSLOG_LEVEL_DEBUG3, ((void *)0),
"%.200s line %d: %smatched '%s'", filename, linenum,
this_result ? "" : "not ", oattrib)
;
continue;
}
if ((arg = strdelim(&cp)) == ((void *)0) || *arg == '\0' || *arg == '#') {
sshlog("readconf.c", __func__, 658, 0, SYSLOG_LEVEL_ERROR, ((void *)0),
"Missing Match criteria for %s", attrib);
result = -1;
goto out;
}
if (strcasecmp(attrib, "host") == 0) {
criteria = xstrdup(host);
r = match_hostname(host, arg) == 1;
if (r == (negate ? 1 : 0))
this_result = result = 0;
} else if (strcasecmp(attrib, "originalhost") == 0) {
criteria = xstrdup(original_host);
r = match_hostname(original_host, arg) == 1;
if (r == (negate ? 1 : 0))
this_result = result = 0;
} else if (strcasecmp(attrib, "user") == 0) {
criteria = xstrdup(ruser);
r = match_pattern_list(ruser, arg, 0) == 1;
if (r == (negate ? 1 : 0))
this_result = result = 0;
} else if (strcasecmp(attrib, "localuser") == 0) {
criteria = xstrdup(pw->pw_name);
r = match_pattern_list(pw->pw_name, arg, 0) == 1;
if (r == (negate ? 1 : 0))
this_result = result = 0;
} else if (strcasecmp(attrib, "exec") == 0) {
char *conn_hash_hex, *keyalias;
if (gethostname(thishost, sizeof(thishost)) == -1)
sshfatal("readconf.c", __func__, 686, 0, SYSLOG_LEVEL_FATAL,
((void *)0), "gethostname: %s",
strerror((*__errno_location())));
strlcpy(shorthost, thishost, sizeof(shorthost));
shorthost[strcspn(thishost, ".")] = '\0';
snprintf(portstr, sizeof(portstr), "%d", port);
snprintf(uidstr, sizeof(uidstr), "%llu", (unsigned long long)pw->pw_uid);
conn_hash_hex = ssh_connection_hash(thishost, host, portstr, ruser);
keyalias = options->host_key_alias ? options->host_key_alias : host;
cmd = percent_expand(arg, "C", conn_hash_hex, "L", shorthost, "d",
pw->pw_dir, "h", host, "k", keyalias, "l", thishost,
"n", original_host, "p", portstr, "r", ruser, "u",
pw->pw_name, "i", uidstr, (char *)((void *)0));
free(conn_hash_hex);
if (result != 1) {
sshlog("readconf.c", __func__, 713, 0, SYSLOG_LEVEL_DEBUG3, ((void *)0),
"%.200s line %d: skipped exec "
"\"%.100s\"",
filename, linenum, cmd);
free(cmd);
continue;
}
r = execute_in_shell(cmd);
if (r == -1) {
sshfatal("readconf.c", __func__, 720, 0, SYSLOG_LEVEL_FATAL,
((void *)0),
"%.200s line %d: match exec "
"'%.100s' error",
filename, linenum, cmd)
;
}
criteria = xstrdup(cmd);
free(cmd);
r = r == 0;
if (r == (negate ? 1 : 0))
this_result = result = 0;
} else {
sshlog("readconf.c", __func__, 731, 0, SYSLOG_LEVEL_ERROR, ((void *)0),
"Unsupported Match attribute %s", attrib);
result = -1;
goto out;
}
sshlog("readconf.c", __func__, 735, 0, SYSLOG_LEVEL_DEBUG3, ((void *)0),
"%.200s line %d: %smatched '%s \"%.100s\"' ", filename, linenum,
this_result ? "" : "not ", oattrib, criteria)
;
free(criteria);
}
if (attributes == 0) {
sshlog("readconf.c", __func__, 741, 0, SYSLOG_LEVEL_ERROR, ((void *)0),
"One or more attributes required for Match");
result = -1;
goto out;
}
out:
if (result != -1)
sshlog("readconf.c", __func__, 747, 0, SYSLOG_LEVEL_DEBUG2, ((void *)0),
"match %sfound", result ? "" : "not ");
*condition = cp;
free(host);
return result;
} | int match_cfg_line(struct_1 *a0, unsigned long long *a1, struct_0 *a2,
unsigned long long a3, unsigned long long a4,
unsigned long a5, unsigned long v44, unsigned long a6,
unsigned int a7) {
unsigned long v0;
unsigned long v1;
unsigned long v2;
unsigned long v3;
unsigned int *v4;
unsigned int v5;
unsigned int v6;
unsigned int v7;
unsigned int v8;
unsigned int v9;
unsigned int v10;
void *v11;
char *v12;
void *v13;
void *v14;
char *v15;
char *v16;
char *v17;
void *v18;
void *v19;
void *v20;
char v21;
char v22;
char v23;
char v24;
unsigned long v25;
unsigned long long v26;
unsigned long v27;
unsigned long long v28;
unsigned long v29;
unsigned long long v30;
unsigned long v31;
unsigned long long v32;
unsigned long v33;
unsigned long long v34;
unsigned long v35;
unsigned long long v36;
unsigned long long v37;
unsigned long v38;
unsigned long long v39;
unsigned long v40;
unsigned long long v41;
unsigned long v42;
char v43;
unsigned long v45;
char *v46;
unsigned long long v48;
unsigned long long v49;
unsigned long long v51;
unsigned long long v52;
unsigned long long v53;
unsigned long long v54;
unsigned long long v55;
unsigned long long v56;
void *v58;
unsigned long long v59;
unsigned long long v60;
v4 = v44;
v3 = a6;
v11 = *(a1);
v6 = 1;
v7 = 0;
if (a0->field_88 <= 0)
v45 = default_ssh_port();
else
v45 = a0->field_88;
v8 = v45;
if (!a0->field_e0)
v46 = a2->field_0;
else
v46 = a0->field_e0;
v15 = v46;
if (a5) {
v13 = xstrdup(a0->field_c8);
} else if (a0->field_c8) {
v13 = percent_expand(a0->field_c8, "h", a3, 0x0);
} else {
v13 = xstrdup(a3);
}
v2 = a4;
v1 = v13;
v0 = v11;
sshlog("readconf.c", "match_cfg_line", 0x260, 0x0, 0x6, 0x0,
"checking match for '%s' host %s originally %s");
while (true) {
v12 = strdelim(&v11);
v16 = v12;
if (v16 && *(v12)) {
if (*(v12) == 35) {
v11 = 0;
} else {
v14 = 0;
v17 = v14;
v5 = 1;
v9 = *(v12) == 33;
if (v9)
v12 += 1;
if (!strcasecmp(v12, "all")) {
if (v7 <= 1) {
v17 = strdelim(&v11);
if (!*(v17) || !v17 || *(v17) == 35) {
if (v17 && *(v17) == 35)
v11 = 0;
if (v6)
v6 = !v9;
break;
}
}
if (v7 > 1 || *(v17) && v17 && *(v17) != 35) {
v42 = v16;
v41 = a7;
v40 = v3;
v39 = "%.200s line %d: '%s' cannot be combined with other Match "
"attributes";
sshlog("readconf.c", "match_cfg_line", 0x270, 0x0, 0x2, 0x0,
*(&v43));
v6 = -1;
break;
}
} else {
v7 = __addvsi3(v7, 0x1);
v48 = strcasecmp(v12, "canonical");
if (v48) {
v49 = strcasecmp(v12, "final");
if (v49) {
v17 = strdelim(&v11);
if (v17 && *(v17) && *(v17) != 35) {
v51 = strcasecmp(v12, "host");
if (!v51) {
v14 = xstrdup(v13);
v10 = match_hostname(v13, v17, v17) == 1;
if (v10 == v9) {
v6 = 0;
v5 = v6;
}
} else {
v52 = strcasecmp(v12, "originalhost");
if (!v52) {
v14 = xstrdup(a4);
v10 = match_hostname(a4, v17, v17) == 1;
if (v10 == v9) {
v6 = 0;
v5 = v6;
}
} else {
v54 = strcasecmp(v12, "user");
if (!v54) {
v14 = xstrdup(v15);
v10 = match_pattern_list(v15, v17, 0x0, v17) == 1;
if (v10 == v9) {
v6 = 0;
v5 = v6;
}
} else {
v55 = strcasecmp(v12, "localuser");
if (!v55) {
v14 = xstrdup(a2->field_0);
v10 =
match_pattern_list(a2->field_0, v17, 0x0, v17) == 1;
if (v10 == v9) {
v6 = 0;
v5 = v6;
}
} else {
v56 = strcasecmp(v12, "exec");
if (!v56) {
if (gethostname(&v23, 0x401) == -1) {
v42 = strerror(*(__errno_location()));
v41 = "gethostname: %s";
sshfatal("readconf.c", "match_cfg_line", 0x2ae, 0x0,
0x1, 0x0);
}
strlcpy(&v24, &v23, 0x401, &v23);
(&v24)[strcspn(&v23, ".")] = 0;
snprintf(&v21, 0x20, "%d", v8);
snprintf(&v22, 0x20, "%llu", a2->field_10);
v18 = ssh_connection_hash(&v23, v13, &v21, v15);
if (a0->field_d0)
v58 = a0->field_d0;
else
v58 = v13;
v19 = v58;
v42 = 0;
v41 = &v22;
v40 = "i";
v39 = a2->field_0;
v38 = "u";
v37 = v15;
v36 = "r";
v35 = &v21;
v34 = "p";
v33 = a4;
v32 = "n";
v31 = &v23;
v30 = "l";
v29 = v19;
v28 = "k";
v27 = v13;
v26 = "h";
v25 = a2->field_20;
v20 = percent_expand(v17, "C", v18, "L");
free(v18);
if (v6 != 1) {
v42 = v20;
v41 = a7;
v40 = v3;
v39 = "%.200s line %d: skipped exec \"%.100s\"";
sshlog("readconf.c", "match_cfg_line", 0x2c9, 0x0,
0x7, 0x0, *(&v43));
free(v20);
continue;
} else {
v10 = execute_in_shell(v20);
if (v10 == -1) {
v42 = v20;
v41 = a7;
v40 = v3;
v39 = "%.200s line %d: match exec '%.100s' error";
sshfatal("readconf.c", "match_cfg_line", 0x2d0,
0x0, 0x1, 0x0);
}
v14 = xstrdup(v20);
free(v20);
v10 = !v10;
if (v10 == v9) {
v6 = 0;
v5 = v6;
}
}
} else {
v42 = v12;
v41 = "Unsupported Match attribute %s";
sshlog("readconf.c", "match_cfg_line", 0x2db, 0x0,
0x2, 0x0, *(&v43));
v6 = -1;
break;
}
}
}
}
}
if (!v52 || !v51 || !v54 || !v55 || !v56 && v6 == 1) {
if (v5)
v59 = &g_40b5e4;
else
v59 = "not ";
v42 = v14;
v41 = v16;
v40 = v59;
v39 = a7;
v38 = v3;
v37 = "%.200s line %d: %smatched \'%s \"%.100s\"\' ";
sshlog("readconf.c", "match_cfg_line", 0x2df, 0x0, 0x7, 0x0,
*(&v43));
free(v14);
}
}
if (*(v17) == 35 || !*(v17) || !v17) {
v42 = v12;
v41 = "Missing Match criteria for %s";
sshlog("readconf.c", "match_cfg_line", 0x292, 0x0, 0x2, 0x0,
*(&v43));
v6 = -1;
break;
}
}
}
if (!v48 || !v49) {
if (!strcasecmp(v12, "final") && v4)
*(v4) = 1;
v10 = a5;
if (v10 == v9) {
v6 = 0;
v5 = v6;
}
if (v5)
v53 = &g_40b5e4;
else
v53 = "not ";
v41 = v16;
v40 = v53;
v39 = a7;
v38 = v3;
v37 = "%.200s line %d: %smatched '%s'";
sshlog("readconf.c", "match_cfg_line", 0x28a, 0x0, 0x7, 0x0,
*(&v43));
continue;
}
}
}
}
if (!v16 || !*(v12) || *(v12) == 35) {
if (v7)
break;
if (!v7) {
v41 = "One or more attributes required for Match";
sshlog("readconf.c", "match_cfg_line", 0x2e5, 0x0, 0x2, 0x0, *(&v43));
v6 = -1;
break;
}
}
}
if (v6 != -1) {
if (v6)
v60 = &g_40b5e4;
else
v60 = "not ";
v42 = v60;
v41 = "match %sfound";
sshlog("readconf.c", "match_cfg_line", 0x2eb, 0x0, 0x6, 0x0, *(&v43));
}
*(a1) = v11;
free(v13);
return v6;
} | openssh-portable | angr_dream |
static _Bool
parse_xtype(const struct parser_table *entry, char **argv, int *arg_ptr) {
return insert_type(argv, arg_ptr, entry, pred_xtype);
} | long parse_xtype(long a1, long a2, int *a3) {
return insert_type(a2, a3, a1, &pred_xtype);
} | findutils | ida |
void xheader_write(char type, char *name, time_t t, struct xheader *xhdr) {
union block *header;
size_t size;
char *p;
size = xhdr->size;
switch (type) {
case 'g':
if (globexthdr_mtime_option)
t = globexthdr_mtime;
break;
case 'x':
if (exthdr_mtime_option)
t = exthdr_mtime;
break;
}
header = start_private_header(name, size, t);
header->header.typeflag = type;
simple_finish_header(header);
p = xhdr->buffer;
do {
size_t len;
header = find_next_block();
len = 512;
if (len > size)
len = size;
memcpy(header->buffer, p, len);
if (len < 512)
memset(header->buffer + len, 0, 512 - len);
p += len;
size -= len;
set_next_block_after(header);
} while (size > 0);
xheader_destroy(xhdr);
if (type == 'g')
global_header_count++;
} | void xheader_write(unsigned long a0, unsigned long long a1,
unsigned long long a2, unsigned long long a3[3]) {
unsigned long long v0;
unsigned long v1;
void *v2;
unsigned long long v3;
struct_0 *v4;
unsigned long long v6;
unsigned long long v7;
v0 = a2;
v1 = a3[1];
if (a0 != 103) {
if (a0 == 120 && exthdr_mtime_option)
v0 = exthdr_mtime;
} else {
if (globexthdr_mtime_option)
v0 = globexthdr_mtime;
}
v4 = start_private_header(a1, v1, v0, v1);
v4->field_9c = a0;
simple_finish_header(v4);
v2 = a3[2];
while (true) {
v4 = find_next_block();
v3 = 0x200;
if (v3 > v1)
v3 = v1;
memcpy(v4, v2, v3);
if (v3 <= 511)
memset(v4 + v3, 0x0, 0x200 - v3);
v2 += v3;
v1 -= v3;
set_next_block_after(v4);
if (!v1)
break;
}
v6 = xheader_destroy(a3);
if (a0 == 103) {
v7 = global_header_count + 1;
global_header_count = global_header_count + 1;
}
return;
} | tar | angr_dream |
static int input_eof() {
if (!decompress || last_member)
return 1;
if (inptr == insize) {
if (insize != 0x40000 || fill_inbuf(1) == (-1))
return 1;
inptr = 0;
}
return 0;
} | int input_eof() {
unsigned int v1;
if (!decompress) {
v1 = 1;
return v1;
} else if (last_member) {
v1 = 1;
return v1;
} else if (false) {
v1 = 0;
return v1;
} else if (true) {
v1 = 1;
return v1;
} else if (fill_inbuf(0x1) == -1) {
v1 = 1;
return v1;
} else {
outcnt = 0;
v1 = 0;
return v1;
}
} | gzip-1.12 | angr_sailr |
void xheader_decode_global(struct xheader *xhdr) {
if (xhdr->size) {
char *p = xhdr->buffer + 512;
xheader_list_destroy(&global_header_override_list);
while (decode_record(xhdr, &p, decg, &global_header_override_list))
continue;
}
} | void xheader_decode_global(long param_1)
{
char cVar1;
long in_FS_OFFSET;
long local_18;
long local_10;
local_10 = *(long *)(in_FS_OFFSET + 0x28);
if (*(long *)(param_1 + 8) != 0) {
local_18 = *(long *)(param_1 + 0x10) + 0x200;
xheader_list_destroy(&global_header_override_list);
do {
cVar1 =
decode_record(param_1, &local_18, decg, &global_header_override_list);
} while (cVar1 != '\0');
}
if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) {
__stack_chk_fail();
}
return;
} | tar | ghidra |
static void expand_compound_assignment_word(tlist, flags) WORD_LIST *tlist;
int flags;
{
WORD_LIST *l;
int wlen, oind, t;
char *value, *temp;
t = assignment(tlist->word->word, 0);
oind = 1;
value = extract_array_assignment_list(tlist->word->word + t + 1, &oind);
l = expand_oneword(value, flags);
sh_xfree((value), "subst.c", 12589);
value = string_list(l);
dispose_words(l);
wlen = (((value) && (value)[0])
? ((value)[1] ? ((value)[2] ? strlen(value) : 2) : 1)
: 0);
temp = sh_xmalloc((t + 3 + wlen + 1), "subst.c", 12597);
memcpy(temp, tlist->word->word, ++t);
temp[t++] = '(';
if (value)
memcpy(temp + t, value, wlen);
t += wlen;
temp[t++] = ')';
temp[t] = '\0';
sh_xfree((tlist->word->word), "subst.c", 12607);
tlist->word->word = temp;
sh_xfree((value), "subst.c", 12610);
} | void expand_compound_assignment_word(struct_0 *a0, unsigned long a1,
unsigned long a2, unsigned long long a3) {
unsigned int v0;
int tmp_14;
int tmp_37;
unsigned int v1;
unsigned int v2;
unsigned long long v3;
void *v4;
char *v5;
char v6;
unsigned int v8;
unsigned long long *v9;
unsigned long long v10;
v1 = assignment(a0->field_8->field_0, 0x0);
v0 = 1;
v3 = extract_array_assignment_list(v1 + 1 + a0->field_8->field_0, &v0);
v4 = expand_oneword(v3, a1, a1, a3);
sh_xfree(v3, "subst.c", 0x312d);
*(&v3) = string_list(v4);
dispose_words(v4);
if (v3 && v3[0]) {
if (!v3[1]) {
v8 = 1;
} else if (v3[2]) {
v8 = strlen(v3);
} else {
v8 = 2;
}
}
if (!v3 || !v3[0])
v8 = 0;
v2 = v8;
v5 = sh_xmalloc(v2 + v1 + 3 + 1, "subst.c", 0x3135);
v1 += 1;
memcpy(v5, a0->field_8->field_0, v1);
tmp_14 = v1;
v1 += 1;
v5[tmp_14] = 40;
if (v3)
memcpy(&v5[v1], v3, v2);
v1 += v2;
tmp_37 = v1;
v1 += 1;
v5[tmp_37] = 41;
v5[v1] = 0;
sh_xfree(a0->field_8->field_0, "subst.c", 0x313f);
a0->field_8->field_0 = v5;
sh_xfree(v3, "subst.c", 0x3142);
v10 = *(&v6) ^ v9[5];
return;
} | bash | angr_dream |
static int histfile_restore(const char *backup, const char *orig) {
char linkbuf[4096 + 1];
ssize_t n;
if ((n = readlink(orig, linkbuf, sizeof(linkbuf) - 1)) > 0) {
linkbuf[n] = '\0';
return (history_rename(backup, linkbuf));
}
return (history_rename(backup, orig));
} | int histfile_restore(const char *a1, const char *a2) {
ssize_t v3;
char buf[16];
unsigned long v5;
v5 = __readfsqword(0x28u);
v3 = readlink(a2, buf, 0x1000uLL);
if (v3 <= 0)
return history_rename(a1, a2);
buf[v3] = 0;
return history_rename(a1, buf);
} | bash | ida |
static _Bool want_subuids(void) {
if (get_subid_nss_handle() != ((void *)0))
return 0;
if (getdef_ulong("SUB_UID_COUNT", 65536) == 0)
return 0;
return 1;
} | int want_subuids() {
unsigned int v1;
if (get_subid_nss_handle()) {
v1 = 0;
} else if (!getdef_ulong("SUB_UID_COUNT", 0x10000)) {
v1 = 0;
} else {
v1 = 1;
}
return v1;
} | shadow | angr_phoenix |
static _Bool
entry_comparator(const void *av, const void *bv) {
const struct SharefileEntry *a = av, *b = bv;
return (a->inode == b->inode) && (a->device == b->device);
} | long long entry_comparator(unsigned long long a0[2], unsigned long long a1[2]) {
unsigned int v1;
unsigned long long v2;
if (a0[1] == a1[1] && a0[0] == a1[0])
v1 = 1;
if (a0[0] != a1[0] || a0[1] != a1[1])
v1 = 0;
v2 = v1 & 1;
return v2;
} | findutils | angr_dream |
static int check_ofname() {
if (!force) {
int ok = 0;
fprintf(stderr, "%s: %s already exists;", program_name, ofname);
if (foreground && (presume_input_tty || isatty(0))) {
fprintf(stderr, " do you wish to overwrite (y or n)? ");
rpl_fflush(stderr);
ok = yesno();
}
if (!ok) {
fprintf(stderr, "\tnot overwritten\n");
if (exit_code == 0)
exit_code = 2;
return 1;
}
}
if (xunlink(ofname)) {
progerror(ofname);
return 1;
}
return 0;
} | bool check_ofname(void)
{
char cVar1;
int iVar2;
if (force == 0) {
cVar1 = '\0';
fprintf(stderr, "%s: %s already exists;", program_name, ofname);
if ((foreground != 0) &&
((presume_input_tty != '\0' || (iVar2 = isatty(0), iVar2 != 0)))) {
fprintf(stderr, " do you wish to overwrite (y or n)? ");
rpl_fflush(stderr);
cVar1 = yesno();
}
if (cVar1 == '\0') {
fprintf(stderr, "\tnot overwritten\n");
if (exit_code == 0) {
exit_code = 2;
}
return true;
}
}
iVar2 = xunlink(ofname);
if (iVar2 != 0) {
progerror(ofname);
}
return iVar2 != 0;
} | gzip-1.12 | ghidra |
static int print_ila_mapping(struct nlmsghdr *n, void *arg) {
struct genlmsghdr *ghdr;
struct rtattr *tb[(__ILA_ATTR_MAX - 1) + 1];
int len = n->nlmsg_len;
if (n->nlmsg_type != genl_family)
return 0;
len -= (((((sizeof(struct genlmsghdr)) + 4U - 1) & ~(4U - 1))) +
((int)(((sizeof(struct nlmsghdr)) + 4U - 1) & ~(4U - 1))));
if (len < 0)
return -1;
ghdr = ((void *)(((char *)n) +
((int)(((sizeof(struct nlmsghdr)) + 4U - 1) & ~(4U - 1)))));
parse_rtattr(
tb, (__ILA_ATTR_MAX - 1),
(void *)ghdr + (((sizeof(struct genlmsghdr)) + 4U - 1) & ~(4U - 1)), len);
open_json_object(((void *)0));
print_ila_locid("locator_match", ILA_ATTR_LOCATOR_MATCH, tb);
print_ila_locid("locator", ILA_ATTR_LOCATOR, tb);
if (tb[ILA_ATTR_IFINDEX]) {
__u32 ifindex = rta_getattr_u32(tb[ILA_ATTR_IFINDEX]);
print_color_string(PRINT_ANY, COLOR_IFNAME, "interface", "%-16s",
ll_index_to_name(ifindex));
} else {
print_string(PRINT_FP, ((void *)0), "%-10s ", "-");
}
if (tb[ILA_ATTR_CSUM_MODE]) {
__u8 csum = rta_getattr_u8(tb[ILA_ATTR_CSUM_MODE]);
print_string(PRINT_ANY, "csum_mode", "%s", ila_csum_mode2name(csum));
} else
print_string(PRINT_FP, ((void *)0), "%-10s ", "-");
if (tb[ILA_ATTR_IDENT_TYPE])
print_string(PRINT_ANY, "ident_type", "%s",
ila_ident_type2name(rta_getattr_u8(tb[ILA_ATTR_IDENT_TYPE])));
else
print_string(PRINT_FP, ((void *)0), "%s", "-");
print_nl();
close_json_object();
return 0;
} | long long print_ila_mapping(struct_0 *a0, unsigned long long a1,
unsigned long a2, unsigned long long a3,
unsigned long long a4, unsigned long long a5) {
unsigned long v0;
char v1;
unsigned int v2;
unsigned int v3;
unsigned long v4;
char v5;
char v6;
char v7;
char v8;
unsigned long long v10;
v0 = a1;
v2 = a0->field_0;
if (a0->field_4 != genl_family) {
v10 = 0;
} else {
v2 -= 20;
if (v2 < 0) {
v10 = 4294967295;
} else {
v4 = &a0[2].field_4;
parse_rtattr(&v5, 0x9, v4 + 4, v2);
open_json_object(0x0);
print_ila_locid("locator_match", 0x3, &v5);
print_ila_locid("locator", 0x1, &v5);
if (!*(&v6)) {
print_string(0x1, 0x0, "%-10s ", "-");
} else {
v3 = rta_getattr_u32(*(&v6));
print_color_string(0x4, 0x0, "interface", "%-16s",
ll_index_to_name(v3));
}
if (!*(&v7)) {
print_string(0x1, 0x0, "%-10s ", "-");
} else {
v1 = rta_getattr_u8(*(&v7));
print_string(0x4, "csum_mode", "%s", ila_csum_mode2name(v1));
}
if (!*(&v8))
print_string(0x1, 0x0, "%s", "-");
else
print_string(0x4, "ident_type", "%s",
ila_ident_type2name(rta_getattr_u8(*(&v8))));
print_nl(a0, a1, "%s", a3, a4, a5);
close_json_object(a0, a1, "%s", a3, a4, a5);
v10 = 0;
}
}
return v10;
} | iproute2-6.0.0 | angr_phoenix |
static void encap_type_usage(void) {
int i;
fprintf(stderr, "Usage: ip route ... encap TYPE [ OPTIONS ] [...]\n");
for (i = 1; i <= (__LWTUNNEL_ENCAP_MAX - 1); i++)
fprintf(stderr, "%s %s\n", format_encap_type(i),
i == 1 ? "TYPE := " : " ");
exit(-1);
} | void encap_type_usage() {
const char *v0;
const char *v1;
int i;
fprintf(stderr, "Usage: ip route ... encap TYPE [ OPTIONS ] [...]\n");
for (i = 1; i <= 9; ++i) {
if (i == 1)
v0 = "TYPE := ";
else
v0 = " ";
v1 = format_encap_type(i);
fprintf(stderr, "%s %s\n", v1, v0);
}
exit(-1);
} | iproute2-6.0.0 | ida |
int get_hostkey_index(struct sshkey *key, int compare, struct ssh *ssh) {
u_int i;
for (i = 0; i < options.num_host_key_files; i++) {
if (sshkey_is_cert(key)) {
if (key == sensitive_data.host_certificates[i] ||
(compare && sensitive_data.host_certificates[i] &&
sshkey_equal(key, sensitive_data.host_certificates[i])))
return (i);
} else {
if (key == sensitive_data.host_keys[i] ||
(compare && sensitive_data.host_keys[i] &&
sshkey_equal(key, sensitive_data.host_keys[i])))
return (i);
if (key == sensitive_data.host_pubkeys[i] ||
(compare && sensitive_data.host_pubkeys[i] &&
sshkey_equal(key, sensitive_data.host_pubkeys[i])))
return (i);
}
}
return (-1);
} | long long get_hostkey_index(unsigned long long a0, unsigned long a1,
unsigned long a2) {
unsigned long v0;
unsigned int v1;
unsigned long long v3;
unsigned long long v4;
unsigned long long v5;
unsigned long long v6;
unsigned long long v7;
v0 = a2;
v1 = 0;
while (true) {
if (v1 < 1221591368) {
v3 = sshkey_is_cert(a0);
if (v3) {
if (a0 != *((7482642431 + (v1 << 3))) && a1 &&
*((7482642431 + (v1 << 3))))
v5 = sshkey_equal(a0, *((7482642431 + v1 * 8)),
*((7482642431 + v1 * 8)));
if ((a0 == *((7482642431 + (v1 << 3))) ||
*((7482642431 + (v1 << 3)))) &&
(a0 == *((7482642431 + (v1 << 3))) || v5) &&
(a0 == *((7482642431 + (v1 << 3))) || a1)) {
v7 = v1;
break;
}
} else {
if (a0 != *((0x7097058d480000 + (v1 << 3))) && a1) {
if (*((0x7097058d480000 + (v1 << 3))))
v4 = sshkey_equal(a0, *((0x7097058d480000 + v1 * 8)),
*((0x7097058d480000 + v1 * 8)));
if (a0 != *((0xcde8c78902048b00 + (v1 << 3))) &&
(!*((0x7097058d480000 + (v1 << 3))) || !v4) &&
*((0xcde8c78902048b00 + (v1 << 3))))
v6 = sshkey_equal(a0, *((0xcde8c78902048b00 + v1 * 8)),
*((0xcde8c78902048b00 + v1 * 8)));
}
if ((a0 == *((0x7097058d480000 + (v1 << 3))) ||
*((0x7097058d480000 + (v1 << 3)))) &&
(a0 == *((0x7097058d480000 + (v1 << 3))) || a1) &&
(a0 == *((0x7097058d480000 + (v1 << 3))) || v4)) {
v7 = v1;
break;
}
}
if (*((7482642431 + (v1 << 3))) && v3 &&
a0 != *((7482642431 + (v1 << 3))) && a1 && !v5 ||
v3 && a0 != *((7482642431 + (v1 << 3))) && a1 &&
!*((7482642431 + (v1 << 3))) ||
v3 && a0 != *((7482642431 + (v1 << 3))) && !a1 ||
!v3 && a0 != *((0x7097058d480000 + (v1 << 3))) && a1 &&
a0 != *((0xcde8c78902048b00 + (v1 << 3))) &&
*((0xcde8c78902048b00 + (v1 << 3))) &&
(!*((0x7097058d480000 + (v1 << 3))) || !v4) && !v6 ||
!v3 && a0 != *((0x7097058d480000 + (v1 << 3))) && a1 &&
a0 != *((0xcde8c78902048b00 + (v1 << 3))) &&
(!*((0x7097058d480000 + (v1 << 3))) || !v4) &&
!*((0xcde8c78902048b00 + (v1 << 3))) ||
!v3 && a0 != *((0x7097058d480000 + (v1 << 3))) &&
a0 != *((0xcde8c78902048b00 + (v1 << 3))) &&
(!*((0x7097058d480000 + (v1 << 3))) || !a1 || !v4) && !a1) {
v1 += 1;
continue;
}
if (!v3 && a0 != *((0x7097058d480000 + (v1 << 3))) && a1 &&
a0 != *((0xcde8c78902048b00 + (v1 << 3))) &&
*((0xcde8c78902048b00 + (v1 << 3))) &&
(!*((0x7097058d480000 + (v1 << 3))) || !v4) && v6 ||
!v3 && a0 != *((0x7097058d480000 + (v1 << 3))) &&
(!*((0x7097058d480000 + (v1 << 3))) || !a1 || !v4) &&
a0 == *((0xcde8c78902048b00 + (v1 << 3)))) {
v7 = v1;
break;
}
} else {
v7 = 4294967295;
break;
}
}
return v7;
} | openssh-portable | angr_dream |
int do_setstat(struct sftp_conn *conn, const char *path, Attrib *a) {
u_int status, id;
sshlog("sftp-client.c", __func__, 962, 0, SYSLOG_LEVEL_DEBUG2, ((void *)0),
"Sending SSH2_FXP_SETSTAT \"%s\"", path);
id = conn->msg_id++;
send_string_attrs_request(conn, id, 9, path, strlen(path), a);
status = get_status(conn, id);
if (status != 0)
sshlog("sftp-client.c", __func__, 970, 0, SYSLOG_LEVEL_ERROR, ((void *)0),
"remote setstat \"%s\": %s", path, fx2txt(status));
return status == 0 ? 0 : -1;
} | void do_setstat(struct_0 *a0, char *a1, unsigned long long a2) {
int tmp_17;
unsigned long v0;
unsigned long v1;
struct_0 *v2;
unsigned int v3;
unsigned int v4;
void *v6;
unsigned long long v7;
v2 = a0;
v1 = a1;
sshlog("sftp-client.c", "do_setstat", 0x3c2, 0x0, 0x6, 0x0,
"Sending SSH2_FXP_SETSTAT \"%s\"");
tmp_17 = a0->field_18;
a0->field_18 = a0->field_18 + 1;
v3 = tmp_17;
send_string_attrs_request(a0, v3, 0x9, a1, strlen(a1), a2);
v4 = get_status(a0, v3);
if (v4) {
fx2txt(v4);
v0 = a1;
sshlog("sftp-client.c", "do_setstat", 0x3ca, 0x0, 0x2, 0x0,
"remote setstat \"%s\": %s");
}
if (!v4)
v6 = 0;
else
v7 = 4294967295;
return;
} | openssh-portable | angr_dream |
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]... [NUMBER]...\n")
,
program_name);
fputs_unlocked(gettext("Reformat NUMBER(s), or the numbers from standard "
"input if none are specified.\n"),
stdout)
;
emit_mandatory_arg_note();
fputs_unlocked(
gettext(" --debug print warnings about invalid input\n"),
stdout)
;
fputs_unlocked(gettext(" -d, --delimiter=X use X instead of whitespace "
"for field delimiter\n"),
stdout)
;
fputs_unlocked(
gettext(
" --field=FIELDS replace the numbers in these input fields "
"(default=1);\n see FIELDS below\n"),
stdout)
;
fputs_unlocked(
gettext(
" --format=FORMAT use printf style floating-point FORMAT;\n "
" see FORMAT below for details\n"),
stdout)
;
fputs_unlocked(
gettext(
" --from=UNIT auto-scale input numbers to UNITs; default "
"is 'none';\n see UNIT below\n"),
stdout)
;
fputs_unlocked(gettext(" --from-unit=N specify the input unit size "
"(instead of the default 1)\n"),
stdout)
;
fputs_unlocked(
gettext(" --grouping use locale-defined grouping of digits, "
"e.g. 1,000,000\n (which means it has "
"no effect in the C/POSIX locale)\n"),
stdout)
;
fputs_unlocked(gettext(" --header[=N] print (without converting) "
"the first N header lines;\n "
" N defaults to 1 if not specified\n"),
stdout)
;
fputs_unlocked(gettext(" --invalid=MODE failure mode for invalid "
"numbers: MODE can be:\n "
"abort (default), fail, warn, ignore\n"),
stdout)
;
fputs_unlocked(
gettext(" --padding=N pad the output to N characters; "
"positive N will\n right-align; "
"negative N will left-align;\n padding "
"is ignored if the output is wider than N;\n "
" the default is to automatically pad if a whitespace\n "
" is found\n"),
stdout)
;
fputs_unlocked(
gettext(" --round=METHOD use METHOD for rounding when scaling; "
"METHOD can be:\n up, down, from-zero "
"(default), towards-zero, nearest\n"),
stdout)
;
fputs_unlocked(
gettext(
" --suffix=SUFFIX add SUFFIX to output numbers, and accept "
"optional\n SUFFIX in input numbers\n"),
stdout)
;
fputs_unlocked(gettext(" --to=UNIT auto-scale output numbers "
"to UNITs; see UNIT below\n"),
stdout)
;
fputs_unlocked(gettext(" --to-unit=N the output unit size "
"(instead of the default 1)\n"),
stdout)
;
fputs_unlocked(
gettext(
" -z, --zero-terminated line delimiter is NUL, not newline\n"),
stdout)
;
fputs_unlocked(gettext(" --help display this help and exit\n"),
stdout);
fputs_unlocked(
gettext(" --version output version information and exit\n"),
stdout);
fputs_unlocked(gettext("\nUNIT options:\n"), stdout)
;
fputs_unlocked(gettext(" none no auto-scaling is done; suffixes "
"will trigger an error\n"),
stdout)
;
fputs_unlocked(
gettext(" auto accept optional single/two letter suffix:\n "
" 1K = 1000,\n 1Ki = 1024,\n "
" 1M = 1000000,\n 1Mi = 1048576,\n"),
stdout)
;
fputs_unlocked(
gettext(
" si accept optional single letter suffix:\n "
" 1K = 1000,\n 1M = 1000000,\n ...\n"),
stdout)
;
fputs_unlocked(
gettext(
" iec accept optional single letter suffix:\n "
" 1K = 1024,\n 1M = 1048576,\n ...\n"),
stdout)
;
fputs_unlocked(
gettext(
" iec-i accept optional two-letter suffix:\n "
"1Ki = 1024,\n 1Mi = 1048576,\n ...\n"),
stdout)
;
fputs_unlocked(
gettext("\nFIELDS supports cut(1) style field ranges:\n N N'th "
"field, counted from 1\n N- from N'th field, to end of "
"line\n N-M from N'th to M'th field (inclusive)\n -M from "
"first to M'th field (inclusive)\n - all fields\nMultiple "
"fields/ranges can be separated with commas\n"),
stdout)
;
fputs_unlocked(
gettext("\nFORMAT must be suitable for printing one floating-point "
"argument '%f'.\nOptional quote (%'f) will enable --grouping "
"(if supported by current locale).\nOptional width value "
"(%10f) will pad output. Optional zero (%010f) width\nwill "
"zero pad the number. Optional negative values (%-10f) will "
"left align.\nOptional precision (%.1f) will override the "
"input determined precision.\n"),
stdout)
;
printf(
gettext(
"\nExit status is 0 if all input numbers were successfully "
"converted.\nBy default, %s will stop at the first conversion "
"error with exit status 2.\nWith --invalid='fail' a warning is "
"printed for each conversion error\nand the exit status is 2. "
"With --invalid='warn' each conversion error is\ndiagnosed, but "
"the exit status is 0. With --invalid='ignore' conversion\nerrors "
"are not diagnosed and the exit status is 0.\n")
,
program_name);
printf(
gettext("\nExamples:\n $ %s --to=si 1000\n -> \"1.0K\"\n "
"$ %s --to=iec 2048\n -> \"2.0K\"\n $ %s --to=iec-i "
"4096\n -> \"4.0Ki\"\n $ echo 1K | %s --from=si\n "
" -> \"1000\"\n $ echo 1K | %s --from=iec\n "
"-> \"1024\"\n $ df -B1 | %s --header --field 2-4 --to=si\n "
"$ ls -l | %s --header --field 5 --to=iec\n $ ls -lh | %s "
"--header --field 5 --from=iec --padding=10\n $ ls -lh | %s "
"--header --field 5 --from=iec --format %%10f\n"),
program_name, program_name, program_name, program_name, program_name,
program_name, program_name, program_name, program_name);
emit_ancillary_info("numfmt");
}
exit(status);
} | void usage(unsigned long a0) {
unsigned long v0;
unsigned long v1;
unsigned long v2;
unsigned long v3;
unsigned long v4;
unsigned long v5;
void *v6;
void *v7;
unsigned long v8;
unsigned long v9;
unsigned long v10;
unsigned long v11;
unsigned long v12;
unsigned long v14;
unsigned long v15;
unsigned long v16;
unsigned long v17;
unsigned long v18;
v12 = v14;
v11 = v15;
v10 = v16;
v9 = v17;
v8 = v18;
if (a0) {
fprintf(stderr, gettext("Try '%s --help' for more information.\n"));
} else {
printf(gettext("Usage: %s [OPTION]... [NUMBER]...\n"));
fputs_unlocked(gettext("Reformat NUMBER(s), or the numbers from standard "
"input if none are specified.\n"),
stdout);
emit_mandatory_arg_note();
fputs_unlocked(
gettext(" --debug print warnings about invalid input\n"),
stdout);
fputs_unlocked(gettext(" -d, --delimiter=X use X instead of whitespace "
"for field delimiter\n"),
stdout);
fputs_unlocked(
gettext(
" --field=FIELDS replace the numbers in these input fields "
"(default=1);\n see FIELDS below\n"),
stdout);
fputs_unlocked(
gettext(
" --format=FORMAT use printf style floating-point FORMAT;\n "
" see FORMAT below for details\n"),
stdout);
fputs_unlocked(
gettext(
" --from=UNIT auto-scale input numbers to UNITs; default "
"is 'none';\n see UNIT below\n"),
stdout);
fputs_unlocked(gettext(" --from-unit=N specify the input unit size "
"(instead of the default 1)\n"),
stdout);
fputs_unlocked(
gettext(" --grouping use locale-defined grouping of digits, "
"e.g. 1,000,000\n (which means it has "
"no effect in the C/POSIX locale)\n"),
stdout);
fputs_unlocked(gettext(" --header[=N] print (without converting) "
"the first N header lines;\n "
" N defaults to 1 if not specified\n"),
stdout);
fputs_unlocked(gettext(" --invalid=MODE failure mode for invalid "
"numbers: MODE can be:\n "
"abort (default), fail, warn, ignore\n"),
stdout);
fputs_unlocked(
gettext(" --padding=N pad the output to N characters; "
"positive N will\n right-align; "
"negative N will left-align;\n padding "
"is ignored if the output is wider than N;\n "
" the default is to automatically pad if a whitespace\n "
" is found\n"),
stdout);
fputs_unlocked(
gettext(" --round=METHOD use METHOD for rounding when scaling; "
"METHOD can be:\n up, down, from-zero "
"(default), towards-zero, nearest\n"),
stdout);
fputs_unlocked(
gettext(
" --suffix=SUFFIX add SUFFIX to output numbers, and accept "
"optional\n SUFFIX in input numbers\n"),
stdout);
fputs_unlocked(gettext(" --to=UNIT auto-scale output numbers "
"to UNITs; see UNIT below\n"),
stdout);
fputs_unlocked(gettext(" --to-unit=N the output unit size "
"(instead of the default 1)\n"),
stdout);
fputs_unlocked(
gettext(
" -z, --zero-terminated line delimiter is NUL, not newline\n"),
stdout);
fputs_unlocked(gettext(" --help display this help and exit\n"),
stdout);
fputs_unlocked(
gettext(" --version output version information and exit\n"),
stdout);
fputs_unlocked(gettext("\nUNIT options:\n"), stdout);
fputs_unlocked(gettext(" none no auto-scaling is done; suffixes "
"will trigger an error\n"),
stdout);
fputs_unlocked(
gettext(" auto accept optional single/two letter suffix:\n "
" 1K = 1000,\n 1Ki = 1024,\n "
" 1M = 1000000,\n 1Mi = 1048576,\n"),
stdout);
fputs_unlocked(
gettext(
" si accept optional single letter suffix:\n "
" 1K = 1000,\n 1M = 1000000,\n ...\n"),
stdout);
fputs_unlocked(
gettext(
" iec accept optional single letter suffix:\n "
" 1K = 1024,\n 1M = 1048576,\n ...\n"),
stdout);
fputs_unlocked(
gettext(
" iec-i accept optional two-letter suffix:\n "
"1Ki = 1024,\n 1Mi = 1048576,\n ...\n"),
stdout);
fputs_unlocked(
gettext("\nFIELDS supports cut(1) style field ranges:\n N N'th "
"field, counted from 1\n N- from N'th field, to end of "
"line\n N-M from N'th to M'th field (inclusive)\n -M from "
"first to M'th field (inclusive)\n - all fields\nMultiple "
"fields/ranges can be separated with commas\n"),
stdout);
fputs_unlocked(
gettext("\nFORMAT must be suitable for printing one floating-point "
"argument '%f'.\nOptional quote (%'f) will enable --grouping "
"(if supported by current locale).\nOptional width value "
"(%10f) will pad output. Optional zero (%010f) width\nwill "
"zero pad the number. Optional negative values (%-10f) will "
"left align.\nOptional precision (%.1f) will override the "
"input determined precision.\n"),
stdout);
printf(gettext(
"\nExit status is 0 if all input numbers were successfully "
"converted.\nBy default, %s will stop at the first conversion error "
"with exit status 2.\nWith --invalid='fail' a warning is printed for "
"each conversion error\nand the exit status is 2. With "
"--invalid='warn' each conversion error is\ndiagnosed, but the exit "
"status is 0. With --invalid='ignore' conversion\nerrors are not "
"diagnosed and the exit status is 0.\n"));
v7 = program_name;
v6 = program_name;
v5 = program_name;
v4 = program_name;
v3 = v7;
v2 = v6;
v1 = program_name;
v0 = program_name;
printf(
gettext("\nExamples:\n $ %s --to=si 1000\n -> \"1.0K\"\n "
"$ %s --to=iec 2048\n -> \"2.0K\"\n $ %s --to=iec-i "
"4096\n -> \"4.0Ki\"\n $ echo 1K | %s --from=si\n "
" -> \"1000\"\n $ echo 1K | %s --from=iec\n "
"-> \"1024\"\n $ df -B1 | %s --header --field 2-4 --to=si\n "
"$ ls -l | %s --header --field 5 --to=iec\n $ ls -lh | %s "
"--header --field 5 --from=iec --padding=10\n $ ls -lh | %s "
"--header --field 5 --from=iec --format %%10f\n"));
emit_ancillary_info("numfmt");
}
exit(a0);
} | coreutils | angr_sailr |
static void treat_file(iname) char *iname;
{
if ((strcmp((iname), ("-")) == 0)) {
int cflag = to_stdout;
treat_stdin();
to_stdout = cflag;
return;
}
ifd = open_input_file(iname, &istat);
if (ifd < 0)
return;
if (((((istat.st_mode)) & 0170000) == (0040000))) {
if (recursive) {
treat_dir(ifd, iname);
return;
}
close(ifd);
{
if (!quiet)
fprintf(stderr, "%s: %s is a directory -- ignored\n", program_name,
ifname);
if (exit_code == 0)
exit_code = 2;
};
return;
}
if (!to_stdout) {
if (!((((istat.st_mode)) & 0170000) == (0100000))) {
{
if (!quiet)
fprintf(stderr,
"%s: %s is not a directory or a regular file - ignored\n",
program_name, ifname);
if (exit_code == 0)
exit_code = 2;
}
;
close(ifd);
return;
}
if (istat.st_mode & 04000) {
{
if (!quiet)
fprintf(stderr, "%s: %s is set-user-ID on execution - ignored\n",
program_name, ifname);
if (exit_code == 0)
exit_code = 2;
};
close(ifd);
return;
}
if (istat.st_mode & 02000) {
{
if (!quiet)
fprintf(stderr, "%s: %s is set-group-ID on execution - ignored\n",
program_name, ifname);
if (exit_code == 0)
exit_code = 2;
};
close(ifd);
return;
}
if (!force) {
if (istat.st_mode & 01000) {
{
if (!quiet)
fprintf(stderr, "%s: %s has the sticky bit set - file ignored\n",
program_name, ifname);
if (exit_code == 0)
exit_code = 2;
}
;
close(ifd);
return;
}
if (2 <= istat.st_nlink) {
{
if (!quiet)
fprintf(stderr, "%s: %s has %lu other link%s -- file ignored\n",
program_name, ifname, (unsigned long int)istat.st_nlink - 1,
istat.st_nlink == 2 ? "" : "s");
if (exit_code == 0)
exit_code = 2;
}
;
close(ifd);
return;
}
}
}
get_input_size_and_time();
if (to_stdout && !test) {
strcpy(ofname, "stdout");
} else if (make_ofname() != 0) {
close(ifd);
return;
}
clear_bufs();
part_nb = 0;
if (decompress) {
method = get_method(ifd);
if (method < 0) {
close(ifd);
return;
}
}
if (to_stdout) {
ofd = 1;
} else {
if (create_outfile() != 0)
return;
if (!decompress && save_orig_name && !verbose && !quiet) {
fprintf(stderr, "%s: %s compressed to %s\n", program_name, ifname,
ofname);
}
}
if (!save_orig_name)
save_orig_name = !no_name;
if (verbose && !list) {
fprintf(stderr, "%s:\t", ifname);
}
for (;;) {
if ((*work)(ifd, ofd) != 0) {
method = -1;
break;
}
if (input_eof())
break;
method = get_method(ifd);
if (method < 0)
break;
bytes_out = 0;
}
if (close(ifd) != 0)
read_error();
if (list) {
do_list(method);
return;
}
if (!to_stdout) {
copy_stat(&istat);
if ((synchronous &&
((0 <= dfd && fdatasync(dfd) != 0 && (*__errno_location()) != 22) ||
(fsync(ofd) != 0 && (*__errno_location()) != 22))) ||
close(ofd) != 0)
write_error();
if (!keep) {
sigset_t oldset;
int unlink_errno;
char *ifbase = last_component(ifname);
int ufd = atdir_eq(ifname, ifbase - ifname) ? dfd : -1;
int res;
sigprocmask(0, &caught_signals, &oldset);
remove_ofname_fd = -1;
res = ufd < 0 ? xunlink(ifname) : unlinkat(ufd, ifbase, 0);
unlink_errno = res == 0 ? 0 : (*__errno_location());
sigprocmask(2, &oldset, ((void *)0));
if (unlink_errno) {
{
if (!quiet)
fprintf(stderr, "%s: ", program_name);
if (exit_code == 0)
exit_code = 2;
};
if (!quiet) {
(*__errno_location()) = unlink_errno;
perror(ifname);
}
}
}
}
if (method == -1) {
if (!to_stdout)
remove_output_file(0);
return;
}
if (verbose) {
if (test) {
fprintf(stderr, " OK");
} else if (decompress) {
display_ratio(bytes_out - (bytes_in - header_bytes), bytes_out, stderr);
} else {
display_ratio(bytes_in - (bytes_out - header_bytes), bytes_in, stderr);
}
if (!test)
fprintf(stderr, " -- %s %s", keep ? "created" : "replaced with", ofname);
fprintf(stderr, "\n");
}
} | void treat_file(char *a0, unsigned long long a1, unsigned int a2,
unsigned long long a3, unsigned int a4, unsigned long long a5) {
unsigned int v0;
unsigned int v1;
unsigned int v2;
unsigned long long v3;
char v4;
char v5;
unsigned int v7;
unsigned int v11;
unsigned long long *v12;
unsigned long long v13;
if (strcmp(a0, "-")) {
outcnt = open_input_file(a0, &istat);
if (-498339038549686187 >= 0) {
if ((g_404778 & 0xf000) != 0x4000) {
if (to_stdout) {
LABEL_40118e:
get_input_size_and_time(a0, &istat, a2);
if (to_stdout && !test) {
strcpy(&ofname, "stdout");
goto LABEL_4011d7;
} else {
if (make_ofname()) {
close(0xe5894855);
} else {
LABEL_4011d7:
clear_bufs(a0, a1, a2, a3, a4, a5);
part_nb = 0;
if (!decompress ||
(method = get_method(0xf9158b48e5894855), method >= 0)) {
if (to_stdout) {
outcnt = 1;
goto LABEL_40129a;
} else {
if (!create_outfile(a0, a1, a2, a3, a4, a5)) {
if (!decompress && !verbose && !*(&quiet)) {
a2 = -116028600;
a4 = &ofname;
a3 = &ofname;
fprintf(*(&stderr), "%s: %s compressed to %s\n",
-116028600, &ofname, &ofname);
}
LABEL_40129a:
if (false)
outcnt = !no_name;
if (verbose && !list) {
a2 = &ofname;
fprintf(*(&stderr), "%s:\t", &ofname);
}
while (true) {
if (zip(0xf9158b48e5894855, 0xf9158b48e5894855)) {
method = -1;
break;
} else {
if (!(!input_eof()) ||
!((method = get_method(0xf9158b48e5894855),
method >= 0)))
break;
bytes_out = 0;
}
}
if (close(0xe5894855))
read_error(-116028600 CONCAT 3850979413,
0xf9158b48e5894855, a2, a3, a4, a5);
if (!list) {
if (!to_stdout) {
copy_stat(&istat, 0xf9158b48e5894855, a2);
if (synchronous && (dfd >= 0 && fdatasync(dfd) &&
*(__errno_location()) != 22 ||
fsync(0xe5894855) &&
*(__errno_location()) != 22) ||
close(0xe5894855))
write_error();
if (!keep) {
v3 = last_component(&ofname);
v0 = (!atdir_eq(&ofname, v3 + -0x1 * &ofname) ? dfd
: -1);
sigprocmask(0x0, &caught_signals, &v4);
remove_ofname_fd = -1;
if (v0 >= 0)
v11 = unlinkat(v0, v3, 0x0, v3);
else
v11 = xunlink(&ofname);
v11 = v11;
v11 = (!v11 ? *(__errno_location()) : 0);
v1 = v11;
sigprocmask(0x2, &v4, NULL);
if (v1) {
if (!*(&quiet))
fprintf(*(&stderr), "%s: ", -116028600);
if (!exit_code)
exit_code = 2;
if (!*(&quiet)) {
*(__errno_location()) = v1;
perror(&ofname);
}
}
}
}
if (method == -1) {
if (!to_stdout)
remove_output_file(0x0);
} else {
if (verbose) {
if (test) {
fprintf(*(&stderr), " OK");
} else {
if (!decompress)
display_ratio(*(&header_bytes),
0x48fffffff9158b48, *(&stderr),
*(&header_bytes));
else
display_ratio(*(&header_bytes),
0x48fffffff9158b48, *(&stderr),
*(&header_bytes));
}
if (!test) {
if (!keep)
v11 = &g_405147;
else
v11 = "created";
fprintf(*(&stderr), " -- %s %s", v11, &ofname);
}
fprintf(*(&stderr), "\n");
}
}
} else {
do_list(method);
}
}
}
} else {
close(0xe5894855);
}
}
}
} else if ((g_404778 & 0xf000) != 0x8000) {
if (!*(&quiet))
fprintf(*(&stderr),
"%s: %s is not a directory or a regular file - ignored\n",
-116028600, &ofname);
if (!exit_code)
exit_code = 2;
close(0xe5894855);
} else if ((g_404778 & 0x800)) {
if (!*(&quiet))
fprintf(*(&stderr),
"%s: %s is set-user-ID on execution - ignored\n",
-116028600, &ofname);
if (!exit_code)
exit_code = 2;
close(0xe5894855);
} else if ((g_404778 & 0x400)) {
if (!*(&quiet))
fprintf(*(&stderr),
"%s: %s is set-group-ID on execution - ignored\n",
-116028600, &ofname);
if (!exit_code)
exit_code = 2;
close(0xe5894855);
} else {
if (!(!force))
goto LABEL_40118e;
if ((g_404778 & 0x200)) {
if (!*(&quiet))
fprintf(*(&stderr),
"%s: %s has the sticky bit set - file ignored\n",
-116028600, &ofname);
if (!exit_code)
exit_code = 2;
close(0xe5894855);
} else {
if (g_404770 <= 1)
goto LABEL_40118e;
if (!*(&quiet)) {
if (g_404770 != 2)
v7 = &g_4050ee;
else
v7 = &g_404f6f;
fprintf(*(&stderr),
"%s: %s has %lu other link%s -- file ignored\n",
-116028600, &ofname, (g_404770 - 1), v7);
}
if (!exit_code)
exit_code = 2;
close(0xe5894855);
}
}
} else {
if (recursive) {
treat_dir(0xf9158b48e5894855, a0);
} else {
close(0xe5894855);
if (!*(&quiet))
fprintf(*(&stderr), "%s: %s is a directory -- ignored\n",
-116028600, &ofname);
if (!exit_code)
exit_code = 2;
}
}
}
} else {
v2 = to_stdout;
treat_stdin(a0, "-", a2, a3, a4, a5);
to_stdout = v2;
}
v13 = *(&v5) ^ v12[5];
return;
} | gzip-1.12 | angr_sailr |
HASH_TABLE *assoc_quote(h)
HASH_TABLE *h;
{
int i;
BUCKET_CONTENTS *tlist;
char *t;
if (h == 0 || ((h)->nentries == 0))
return ((HASH_TABLE *)((void *)0));
for (i = 0; i < h->nbuckets; i++)
for (tlist = ((h && (i < h->nbuckets)) ? h->bucket_array[i]
: (BUCKET_CONTENTS *)((void *)0));
tlist; tlist = tlist->next) {
t = quote_string((char *)tlist->data);
do {
if (tlist->data)
sh_xfree((tlist->data), "assoc.c", 160);
} while (0);
tlist->data = t;
}
return h;
} | long assoc_quote(long a1) {
long v2;
_QWORD *i;
long v4;
if (!a1 || !*(_DWORD *)(a1 + 12))
return 0LL;
LODWORD(v2) = 0;
while ((int)v2 < *(_DWORD *)(a1 + 8)) {
for (i = *(_QWORD **)(8LL * (int)v2 + *(_QWORD *)a1); i; i = (_QWORD *)*i) {
v4 = quote_string(i[2]);
if (i[2])
sh_xfree(i[2], "assoc.c", 160LL);
i[2] = v4;
}
v2 = (unsigned int)(v2 + 1);
}
return a1;
} | bash | ida |
static void cpl_flush() {
struct cpelement *cpe, *p;
for (cpe = coproc_list.head; cpe;) {
p = cpe;
cpe = cpe->next;
coproc_dispose(p->coproc);
cpe_dispose(p);
}
coproc_list.head = coproc_list.tail = 0;
coproc_list.ncoproc = 0;
} | long long cpl_flush() {
unsigned long long *v0;
unsigned long long v1[2];
v0 = coproc_list;
while (v0) {
v1[0] = v0;
v0 = *(v0);
coproc_dispose(v1[1]);
cpe_dispose(v1);
}
g_40b118 = 0;
coproc_list = g_40b118;
g_40b120 = 0;
return g_40b118;
} | bash | angr_sailr |
static int ext4_add_extent_to_list(e2fsck_t ctx, struct extent_list *list,
struct ext2fs_extent *ex) {
return ext4_modify_extent_list(ctx, list, ex, 0);
} | void ext4_add_extent_to_list(undefined8 param_1, undefined8 param_2,
undefined8 param_3)
{
ext4_modify_extent_list(param_1, param_2, param_3, 0);
return;
} | e2fsprogs-1.46.5 | ghidra |
static inline void emit_ancillary_info(char const *program) {
struct infomap {
char const *program;
char const *node;
} const infomap[] = {
{"[", "test invocation"}, {"coreutils", "Multi-call invocation"},
{"sha224sum", "sha2 utilities"}, {"sha256sum", "sha2 utilities"},
{"sha384sum", "sha2 utilities"}, {"sha512sum", "sha2 utilities"},
{((void *)0), ((void *)0)}};
char const *node = program;
struct infomap const *map_prog = infomap;
while (map_prog->program && !(strcmp(program, map_prog->program) == 0))
map_prog++;
if (map_prog->node)
node = map_prog->node;
printf (gettext ("\n%s online help: <%s>\n"), "GNU coreutils", "https:
char const *lc_messages = setlocale (
5
,
((void *)0)
);
if (lc_messages && strncmp (lc_messages, "" "en_" "", sizeof ("en_") - 1))
{
fputs_unlocked (gettext ("Report any translation bugs to " "<https:
stdout
)
;
}
char const *url_program = (strcmp (program, "[") == 0) ? "test" : program;
printf (gettext ("Full documentation <%s%s>\n"),
"https:
printf (gettext ("or available locally via: info '(coreutils) %s%s'\n"),
node, node == program ? " invocation" : "");
} | void emit_ancillary_info(char *a0) {
unsigned long v0;
unsigned long long v1[2];
char *v2;
unsigned long long v3;
unsigned long long v4;
unsigned long long v5;
unsigned long long v6;
unsigned long long v7;
unsigned long long v8;
unsigned long long v9;
unsigned long long v10;
unsigned long long v11;
unsigned long long v12;
unsigned long long v13;
unsigned long long v14;
unsigned long long v15;
void *v16;
void *v17;
char v18;
unsigned long long v20;
unsigned long long *v21;
unsigned long long v22;
v4 = "[";
v5 = "test invocation";
v6 = "coreutils";
v7 = "Multi-call invocation";
v8 = "sha224sum";
v9 = "sha2 utilities";
v10 = "sha256sum";
v11 = "sha2 utilities";
v12 = "sha384sum";
v13 = "sha2 utilities";
v14 = "sha512sum";
v15 = "sha2 utilities";
v16 = 0;
v17 = 0;
v0 = a0;
v1[0] = &v4;
while (true) {
if (!v1[0])
break;
if (!strcmp(a0, v1[0]))
break;
v1[0] = v1 + 1;
}
if (v1[1])
v0 = v1[1];
printf(gettext("\n%s online help: <%s>\n"));
v2 = setlocale(0x5, NULL);
if (v2 && strncmp(v2, "en_", 0x3))
fputs_unlocked(gettext("Report any translation bugs to <https:
if (!strcmp(a0, "["))
v20 = "test";
else
v20 = a0;
v3 = v20;
printf(gettext("Full documentation <%s%s>\n"));
printf(gettext("or available locally via: info '(coreutils) %s%s'\n"));
v22 = *(&v18) ^ v21[5];
return;
} | coreutils | angr_phoenix |
UNDO_LIST *_rl_copy_undo_entry(UNDO_LIST *entry) {
UNDO_LIST *new;
new = alloc_undo_entry(entry->what, entry->start, entry->end,
(char *)((void *)0));
new->text = entry->text ? strcpy((char *)xmalloc(1 + strlen(entry->text)),
(entry->text))
: 0;
return new;
} | int _rl_copy_undo_entry(struct_0 *a0) {
struct_1 *v0;
void *v2;
v0 = alloc_undo_entry(a0->field_18, a0->field_8, a0->field_c, 0x0);
if (!a0->field_10)
v2 = 0;
else
v2 = strcpy(xmalloc(strlen(a0->field_10) + 1), a0->field_10);
v0->field_10 = v2;
return v0;
} | bash | angr_sailr |
void _rl_control_keypad(int on) {
if (on && _rl_term_ks)
tputs(_rl_term_ks, 1, _rl_output_character_function);
else if (!on && _rl_term_ke)
tputs(_rl_term_ke, 1, _rl_output_character_function);
} | long long _rl_control_keypad(unsigned long a0) {
unsigned long long v1;
if (a0) {
v1 = _rl_term_ks;
if (_rl_term_ks) {
v1 = tputs(_rl_term_ks, 0x1, _rl_output_character_function);
goto LABEL_401106;
}
}
if (!a0) {
v1 = _rl_term_ke;
if (_rl_term_ke)
v1 = tputs(_rl_term_ke, 0x1, _rl_output_character_function);
}
LABEL_401106:
return v1;
} | bash | angr_phoenix |
ARRAY *array_quote_escapes(array)
ARRAY *array;
{
ARRAY_ELEMENT *a;
char *t;
if (array == 0 || ((array)->head) == 0 || ((array)->num_elements == 0))
return (ARRAY *)((void *)0);
for (a = ((array->head)->next); a != array->head; a = ((a)->next)) {
t = quote_escapes(a->value);
do {
if (a->value)
sh_xfree((a->value), "array.c", 339);
} while (0);
a->value = t;
}
return array;
} | long long array_quote_escapes(void *a0) {
unsigned long long v0[3];
unsigned long v1;
void *v3;
if (!a0) {
LABEL_4007f8:
v3 = 0;
} else {
if (!a0[16])
goto LABEL_4007f8;
if (!a0[8])
goto LABEL_4007f8;
for (v0[0] = *((a0[16] + 16)); v0 != a0[16]; v0[0] = v0[2]) {
v1 = quote_escapes(v0[1]);
if (v0[1])
sh_xfree(v0[1], "array.c", 0x153);
v0[1] = v1;
}
v3 = a0;
}
return v3;
} | bash | angr_phoenix |
static __inline void _rs_stir_if_needed(size_t len) {
_rs_forkdetect();
if (!rs || rs->rs_count <= len)
_rs_stir();
if (rs->rs_count <= len)
rs->rs_count = 0;
else
rs->rs_count -= len;
} | void _rs_stir_if_needed(unsigned long a0) {
struct_0 *v1;
struct_0 *v2;
_rs_forkdetect();
if (!rs || a0 >= *((rs + 8)))
_rs_stir();
if (a0 >= *((rs + 8))) {
v1 = rs;
*((rs + 8)) = 0;
} else {
v2 = rs;
*((rs + 8)) = *((rs + 8)) - a0;
}
return;
} | libbsd-0.11.7 | angr_dream |
static errcode_t try_open_fs(e2fsck_t ctx, int flags, io_manager io_ptr,
ext2_filsys *ret_fs) {
errcode_t retval;
*ret_fs = ((void *)0);
if (ctx->superblock && ctx->blocksize) {
retval = ext2fs_open2(ctx->filesystem_name, ctx->io_options, flags,
ctx->superblock, ctx->blocksize, io_ptr, ret_fs);
} else if (ctx->superblock) {
int blocksize;
for (blocksize = (1 << 10); blocksize <= (1 << 16); blocksize *= 2) {
if (*ret_fs) {
ext2fs_free(*ret_fs);
*ret_fs = ((void *)0);
}
retval = ext2fs_open2(ctx->filesystem_name, ctx->io_options, flags,
ctx->superblock, blocksize, io_ptr, ret_fs);
if (!retval)
break;
}
} else
retval = ext2fs_open2(ctx->filesystem_name, ctx->io_options, flags, 0, 0,
io_ptr, ret_fs);
if (retval == 0) {
(*ret_fs)->priv_data = ctx;
e2fsck_set_bitmap_type(*ret_fs, 2, "default", ((void *)0));
}
return retval;
} | int try_open_fs(struct_0 *a0, unsigned long a1, unsigned long long a2,
struct struct_1 **a3) {
unsigned long long *v0;
unsigned int v1;
unsigned long v2;
*(a3) = 0;
if (!(!a0->field_60 || !a0->field_50)) {
v0 = a3;
v2 = ext2fs_open2(a0->field_10, a0->field_20, a1, a0->field_60,
a0->field_50, a2);
} else if (!a0->field_60) {
v0 = a3;
v2 = ext2fs_open2(a0->field_10, a0->field_20, a1, 0x0, 0x0, a2);
} else {
v1 = 0x400;
while (true) {
if (v1 > 0x10000)
break;
if (*(a3)) {
ext2fs_free(*(a3));
*(a3) = 0;
}
v0 = a3;
v2 = ext2fs_open2(a0->field_10, a0->field_20, a1, a0->field_60, v1, a2);
if (!v2)
break;
v1 *= 2;
}
}
if (!v2) {
*(a3)->field_e0 = a0;
e2fsck_set_bitmap_type(*(a3), 0x2, "default", 0x0);
}
return v2;
} | e2fsprogs-1.46.5 | angr_sailr |
int ssh_packet_is_rekeying(struct ssh *ssh) {
return ssh->state->rekeying ||
(ssh->kex != ((void *)0) && ssh->kex->done == 0);
} | int ssh_packet_is_rekeying(struct_0 *a0) {
unsigned int v1;
if (!a0->field_0->field_1dc && (!a0->field_8 || a0->field_8->field_88))
v1 = 0;
if (a0->field_0->field_1dc || !a0->field_8->field_88 && a0->field_8)
v1 = 1;
return v1;
} | openssh-portable | angr_dream |
static void stophandler(int sig) {
if (!1)
signal(sig, stophandler);
if (!interrupt_signal)
stop_signal_count++;
} | long stophandler() {
long result;
result = (unsigned int)interrupt_signal;
if (!interrupt_signal)
return (unsigned int)++stop_signal_count;
return result;
} | diffutils | ida |
errcode_t e2fsck_readahead_dblist(ext2_filsys fs, int flags, ext2_dblist dblist,
unsigned long long start,
unsigned long long count) {
errcode_t err;
struct read_dblist pr;
;
if (flags & ~(0x01))
return (2133571399L);
memset(&pr, 0, sizeof(pr));
pr.flags = flags;
err = ext2fs_dblist_iterate3(dblist, readahead_dir_block, start, count, &pr);
if (pr.err)
return pr.err;
if (err)
return err;
if (pr.run_len)
err = io_channel_cache_readahead(fs->io, pr.run_start, pr.run_len);
return err;
} | long long e2fsck_readahead_dblist(struct_0 *a0, unsigned long a1,
unsigned long long a2, unsigned long long a3,
unsigned long long a4) {
unsigned long long v0;
char v1;
char v2;
char v3;
unsigned int v4;
unsigned long long v6;
if ((a1 & -2)) {
v6 = 2133571399;
} else {
memset(&v1, 0x0, 0x20);
v4 = a1;
v0 = ext2fs_dblist_iterate3(a2, readahead_dir_block, a3, a4, &v1);
if (*(&v1)) {
v6 = *(&v1);
} else if (v0) {
v6 = v0;
} else {
if (*(&v3))
v0 = io_channel_cache_readahead(a0->field_8, *(&v2), *(&v3), *(&v2));
v6 = v0;
}
}
return v6;
} | e2fsprogs-1.46.5 | angr_phoenix |
static COMMAND *make_until_or_while(which, test,
action) enum command_type which;
COMMAND *test, *action;
{
WHILE_COM *temp;
temp = (WHILE_COM *)sh_xmalloc((sizeof(WHILE_COM)), "make_cmd.c", 405);
temp->flags = 0;
temp->test = test;
temp->action = action;
return (make_command(which, (SIMPLE_COM *)temp));
} | void make_until_or_while(unsigned long a0, unsigned long a1, unsigned long a2) {
struct_0 *v0;
unsigned long long v2;
v0 = sh_xmalloc(0x18, "make_cmd.c", 0x195);
v0->field_0 = 0;
v0->field_8 = a1;
v0->field_10 = a2;
v2 = make_command(a0, v0);
return;
} | bash | 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]... [FILE]...\n")
,
program_name);
fputs_unlocked(gettext("Convert tabs in each FILE to spaces, writing to "
"standard output.\n"),
stdout)
;
emit_stdin_note();
emit_mandatory_arg_note();
fputs_unlocked(
gettext(" -i, --initial do not convert tabs after non blanks\n "
"-t, --tabs=N have tabs N characters apart, not 8\n"),
stdout)
;
emit_tab_list_info();
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("expand");
}
exit(status);
} | void usage(unsigned long long a0) {
unsigned long v0;
unsigned long v2;
unsigned long long v3;
unsigned long long v4;
unsigned long long v5;
unsigned long long v6;
unsigned long long v7;
v0 = v2;
if (a0) {
fprintf(stderr, gettext("Try '%s --help' for more information.\n"));
} else {
printf(gettext("Usage: %s [OPTION]... [FILE]...\n"));
fputs_unlocked(gettext("Convert tabs in each FILE to spaces, writing to "
"standard output.\n"),
stdout);
emit_stdin_note();
emit_mandatory_arg_note();
fputs_unlocked(
gettext(" -i, --initial do not convert tabs after non blanks\n "
"-t, --tabs=N have tabs N characters apart, not 8\n"),
stdout);
emit_tab_list_info(a0, v3, v4, v5, v6, v7);
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("expand");
}
exit(a0);
} | coreutils | angr_phoenix |
static void print_date(time_t date) {
struct tm *tp;
char buf[80];
tp = gmtime(&date);
if (((void *)0) == tp) {
(void)printf("time_t: %lu\n", (unsigned long)date);
} else {
(void)strftime(buf, sizeof buf, iflg ? "%Y-%m-%d" : "%b %d, %Y", tp);
(void)puts(buf);
}
} | void print_date(unsigned long a0) {
char v0;
void *v1;
char v2;
char v3;
unsigned long long *v6;
unsigned long long v7;
v1 = gmtime(&v0);
if (!v1) {
printf("time_t: %lu\n", a0);
} else {
strftime(&v2, 0x50, (!iflg ? "%Y-%m-%d" : "%b %d, %Y"), v1);
puts(&v2);
}
v7 = *(&v3) ^ v6[5];
return;
} | shadow | angr_sailr |
static SHELL_VAR *get_aliasvar(self)
SHELL_VAR *self;
{
build_aliasvar(self);
return (self);
} | long get_aliasvar(long a1) {
build_aliasvar(a1);
return a1;
} | bash | ida |
static int depmod_load_system_map(struct depmod *depmod, const char *filename) {
const char ksymstr[] = "__ksymtab_";
const size_t ksymstr_len = sizeof(ksymstr) - 1;
char line[10240];
FILE *fp;
unsigned int linenum = 0;
fp = fopen(filename, "r");
if (fp == ((void *)0)) {
int err = -(*__errno_location());
log_printf(7, "load System.map: %s: %m\n", filename);
return err;
}
log_printf(7, "load System.map: %s\n", filename);
while (fgets(line, sizeof(line), fp) != ((void *)0)) {
char *p, *end;
linenum++;
p = strchr(line, ' ');
if (p == ((void *)0))
goto invalid_syntax;
p++;
p = strchr(p, ' ');
if (p == ((void *)0))
goto invalid_syntax;
p++;
if (p[0] == depmod->cfg->sym_prefix)
p++;
if (strncmp(p, ksymstr, ksymstr_len) != 0)
continue;
end = strchr(p, '\n');
if (end != ((void *)0))
*end = '\0';
depmod_symbol_add(depmod, p + ksymstr_len, 1, 0, ((void *)0));
continue;
invalid_syntax:
log_printf(3, "%s:%u: invalid line: %s\n", filename, linenum, line);
}
depmod_add_fake_syms(depmod);
log_printf(7, "loaded System.map: %s\n", filename);
fclose(fp);
return 0;
} | long depmod_load_system_map(_QWORD *a1, const char *a2) {
unsigned int v3;
unsigned int v4;
char *s1;
char *s1a;
char *s1b;
FILE *stream;
char *v9;
char s2[11];
char s[2064];
unsigned long v12;
v12 = __readfsqword(0x28u);
strcpy(s2, "__ksymtab_");
v3 = 0;
stream = fopen(a2, "r");
if (stream) {
log_printf(7LL, "load System.map: %s\n", a2);
while (fgets(s, 10240, stream)) {
++v3;
s1 = strchr(s, 32);
if (s1 && (s1a = strchr(s1 + 1, 32)) != 0LL) {
s1b = s1a + 1;
if (*s1b == *(_BYTE *)(*a1 + 4112LL))
++s1b;
if (!strncmp(s1b, s2, 0xAuLL)) {
v9 = strchr(s1b, 10);
if (v9)
*v9 = 0;
depmod_symbol_add(a1, s1b + 10, 1, 0LL, 0LL);
}
} else {
log_printf(3LL, "%s:%u: invalid line: %s\n", a2, v3, s);
}
}
depmod_add_fake_syms(a1);
log_printf(7LL, "loaded System.map: %s\n", a2);
fclose(stream);
return 0LL;
} else {
v4 = -*_errno_location();
log_printf(7LL, "load System.map: %s: %m\n", a2);
return v4;
}
} | kmod | ida |
static inline void emit_ancillary_info(char const *program) {
struct infomap {
char const *program;
char const *node;
} const infomap[] = {
{"[", "test invocation"}, {"coreutils", "Multi-call invocation"},
{"sha224sum", "sha2 utilities"}, {"sha256sum", "sha2 utilities"},
{"sha384sum", "sha2 utilities"}, {"sha512sum", "sha2 utilities"},
{((void *)0), ((void *)0)}};
char const *node = program;
struct infomap const *map_prog = infomap;
while (map_prog->program && !(strcmp(program, map_prog->program) == 0))
map_prog++;
if (map_prog->node)
node = map_prog->node;
printf (gettext ("\n%s online help: <%s>\n"), "GNU coreutils", "https:
char const *lc_messages = setlocale (
5
,
((void *)0)
);
if (lc_messages && strncmp (lc_messages, "" "en_" "", sizeof ("en_") - 1))
{
fputs_unlocked (gettext ("Report any translation bugs to " "<https:
stdout
)
;
}
char const *url_program = (strcmp (program, "[") == 0) ? "test" : program;
printf (gettext ("Full documentation <%s%s>\n"),
"https:
printf (gettext ("or available locally via: info '(coreutils) %s%s'\n"),
node, node == program ? " invocation" : "");
} | void emit_ancillary_info(char *param_1)
{
FILE *__stream;
int iVar1;
char *pcVar2;
char *pcVar3;
long in_FS_OFFSET;
char *local_b8;
char **local_b0;
char *local_98;
char *local_90;
char *local_88;
char *local_80;
char *local_78;
char *local_70;
char *local_68;
char *local_60;
char *local_58;
char *local_50;
char *local_48;
char *local_40;
undefined8 local_38;
undefined8 local_30;
long local_20;
local_20 = *(long *)(in_FS_OFFSET + 0x28);
local_98 = "[";
local_90 = "test invocation";
local_88 = "coreutils";
local_80 = "Multi-call invocation";
local_78 = "sha224sum";
local_70 = "sha2 utilities";
local_68 = "sha256sum";
local_60 = "sha2 utilities";
local_58 = "sha384sum";
local_50 = "sha2 utilities";
local_48 = "sha512sum";
local_40 = "sha2 utilities";
local_38 = 0;
local_30 = 0;
local_b0 = &local_98;
while ((*local_b0 != (char *)0x0 &&
(iVar1 = strcmp(param_1, *local_b0), iVar1 != 0))) {
local_b0 = local_b0 + 2;
}
local_b8 = param_1;
if (local_b0[1] != (char *)0x0) {
local_b8 = local_b0[1];
}
pcVar2 = (char *)gettext("\n%s online help: <%s>\n");
printf(pcVar2,"GNU coreutils","https:
pcVar2 = setlocale(5,(char *)0x0);
if ((pcVar2 != (char *)0x0) && (iVar1 = strncmp(pcVar2,"en_",3), __stream = stdout, iVar1 != 0)) {
pcVar2 = (char *)gettext("Report any translation bugs to <https:
);
fputs_unlocked(pcVar2, __stream);
}
iVar1 = strcmp(param_1,"[");
pcVar2 = param_1;
if (iVar1 == 0) {
pcVar2 = "test";
}
pcVar3 = (char *)gettext("Full documentation <%s%s>\n");
printf(pcVar3,"https:
if (local_b8 == param_1) {
pcVar2 = " invocation";
}
else {
pcVar2 = "";
}
pcVar3 = (char *)gettext("or available locally via: info \'(coreutils) %s%s\'\n");
printf(pcVar3,local_b8,pcVar2);
if (local_20 == *(long *)(in_FS_OFFSET + 0x28)) {
return;
}
__stack_chk_fail();
} | coreutils | ghidra |
int main(int argc, char **argv) {
int optc;
int selinux_enabled = (is_selinux_enabled() > 0);
_Bool smack_enabled = is_smack_enabled();
;
set_program_name(argv[0]);
setlocale(6, "");
bindtextdomain("coreutils", "/usr/local/share/locale");
textdomain("coreutils");
atexit(close_stdout);
while ((optc = getopt_long(argc, argv, "agnruzGZ", longopts, ((void *)0))) !=
-1) {
switch (optc) {
case 'a':
break;
case 'Z':
if (!selinux_enabled)
((!!sizeof(struct {
_Static_assert(1,
"verify_expr ("
"1"
", "
"(error (1, 0, gettext (\"--context (-Z) works only "
"on an SELinux-enabled kernel\")), assume (false))"
")");
int _gl_dummy;
}))
? ((error(1, 0,
gettext("--context (-Z) works only on an "
"SELinux-enabled kernel")),
((0) ? (void)0 : __builtin_unreachable())))
: ((error(1, 0,
gettext("--context (-Z) works only on an "
"SELinux-enabled kernel")),
((0) ? (void)0 : __builtin_unreachable()))));
just_context = 1;
break;
case 'g':
just_group = 1;
break;
case 'n':
use_name = 1;
break;
case 'r':
use_real = 1;
break;
case 'u':
just_user = 1;
break;
case 'z':
opt_zero = 1;
break;
case 'G':
just_group_list = 1;
break;
case GETOPT_HELP_CHAR:
usage(0);
break;
;
case GETOPT_VERSION_CHAR:
version_etc(stdout, "id", "GNU coreutils", Version, ("Arnold Robbins"),
("David MacKenzie"), (char *)((void *)0));
exit(0);
break;
;
default:
usage(1);
}
}
size_t n_ids = argc - optind;
if (n_ids && just_context)
((!!sizeof(struct {
_Static_assert(1, "verify_expr ("
"1"
", "
"(error (1, 0, gettext (\"cannot print security "
"context when user specified\")), assume (false))"
")");
int _gl_dummy;
}))
? ((error(
1, 0,
gettext("cannot print security context when user specified")),
((0) ? (void)0 : __builtin_unreachable())))
: ((error(
1, 0,
gettext("cannot print security context when user specified")),
((0) ? (void)0 : __builtin_unreachable()))));
if (just_user + just_group + just_group_list + just_context > 1)
((!!sizeof(struct {
_Static_assert(1, "verify_expr ("
"1"
", "
"(error (1, 0, gettext (\"cannot print \\\"only\\\" of "
"more than one choice\")), assume (false))"
")");
int _gl_dummy;
}))
? ((error(1, 0,
gettext("cannot print \"only\" of more than one choice")),
((0) ? (void)0 : __builtin_unreachable())))
: ((error(1, 0,
gettext("cannot print \"only\" of more than one choice")),
((0) ? (void)0 : __builtin_unreachable()))));
_Bool default_format =
!(just_user || just_group || just_group_list || just_context);
if (default_format && (use_real || use_name))
((!!sizeof(struct {
_Static_assert(1, "verify_expr ("
"1"
", "
"(error (1, 0, gettext (\"cannot print only names or "
"real IDs in default format\")), assume (false))"
")");
int _gl_dummy;
}))
? ((error(
1, 0,
gettext(
"cannot print only names or real IDs in default format")),
((0) ? (void)0 : __builtin_unreachable())))
: ((error(
1, 0,
gettext(
"cannot print only names or real IDs in default format")),
((0) ? (void)0 : __builtin_unreachable()))));
if (default_format && opt_zero)
((!!sizeof(struct {
_Static_assert(1, "verify_expr ("
"1"
", "
"(error (1, 0, gettext (\"option --zero not permitted "
"in default format\")), assume (false))"
")");
int _gl_dummy;
}))
? ((error(1, 0,
gettext("option --zero not permitted in default format")),
((0) ? (void)0 : __builtin_unreachable())))
: ((error(1, 0,
gettext("option --zero not permitted in default format")),
((0) ? (void)0 : __builtin_unreachable()))));
if (n_ids == 0 &&
(just_context || (default_format && !getenv("POSIXLY_CORRECT")))) {
if ((selinux_enabled && getcon(&context) && just_context) ||
(smack_enabled && smack_new_label_from_self(&context) < 0 &&
just_context))
((!!sizeof(struct {
_Static_assert(1, "verify_expr ("
"1"
", "
"(error (1, 0, gettext (\"can't get process "
"context\")), assume (false))"
")");
int _gl_dummy;
}))
? ((error(1, 0, gettext("can't get process context")),
((0) ? (void)0 : __builtin_unreachable())))
: ((error(1, 0, gettext("can't get process context")),
((0) ? (void)0 : __builtin_unreachable()))));
}
if (n_ids >= 1) {
multiple_users = n_ids > 1 ? 1 : 0;
n_ids += optind;
for (; optind < n_ids; optind++) {
char *pw_name = ((void *)0);
struct passwd *pwd = ((void *)0);
char const *spec = argv[optind];
if (*spec) {
if (parse_user_spec(spec, &euid, ((void *)0), &pw_name, ((void *)0)) ==
((void *)0))
pwd = pw_name ? getpwnam(pw_name) : getpwuid(euid);
}
if (pwd == ((void *)0)) {
error(0, (*__errno_location()), gettext("%s: no such user"),
quote(spec));
ok &= 0;
} else {
if (!pw_name)
pw_name = xstrdup(pwd->pw_name);
ruid = euid = pwd->pw_uid;
rgid = egid = pwd->pw_gid;
print_stuff(pw_name);
}
free(pw_name);
}
} else {
uid_t NO_UID = -1;
gid_t NO_GID = -1;
if (just_user ? !use_real
: !just_group && !just_group_list && !just_context) {
(*__errno_location()) = 0;
euid = geteuid();
if (euid == NO_UID && (*__errno_location()))
((!!sizeof(struct {
_Static_assert(1, "verify_expr ("
"1"
", "
"(error (1, (*__errno_location ()), gettext "
"(\"cannot get effective UID\")), assume (false))"
")");
int _gl_dummy;
}))
? ((error(1, (*__errno_location()),
gettext("cannot get effective UID")),
((0) ? (void)0 : __builtin_unreachable())))
: ((error(1, (*__errno_location()),
gettext("cannot get effective UID")),
((0) ? (void)0 : __builtin_unreachable()))));
}
if (just_user ? use_real
: !just_group && (just_group_list || !just_context)) {
(*__errno_location()) = 0;
ruid = getuid();
if (ruid == NO_UID && (*__errno_location()))
((!!sizeof(struct {
_Static_assert(1, "verify_expr ("
"1"
", "
"(error (1, (*__errno_location ()), gettext "
"(\"cannot get real UID\")), assume (false))"
")");
int _gl_dummy;
}))
? ((error(1, (*__errno_location()),
gettext("cannot get real UID")),
((0) ? (void)0 : __builtin_unreachable())))
: ((error(1, (*__errno_location()),
gettext("cannot get real UID")),
((0) ? (void)0 : __builtin_unreachable()))));
}
if (!just_user && (just_group || just_group_list || !just_context)) {
(*__errno_location()) = 0;
egid = getegid();
if (egid == NO_GID && (*__errno_location()))
((!!sizeof(struct {
_Static_assert(1, "verify_expr ("
"1"
", "
"(error (1, (*__errno_location ()), gettext "
"(\"cannot get effective GID\")), assume (false))"
")");
int _gl_dummy;
}))
? ((error(1, (*__errno_location()),
gettext("cannot get effective GID")),
((0) ? (void)0 : __builtin_unreachable())))
: ((error(1, (*__errno_location()),
gettext("cannot get effective GID")),
((0) ? (void)0 : __builtin_unreachable()))));
(*__errno_location()) = 0;
rgid = getgid();
if (rgid == NO_GID && (*__errno_location()))
((!!sizeof(struct {
_Static_assert(1, "verify_expr ("
"1"
", "
"(error (1, (*__errno_location ()), gettext "
"(\"cannot get real GID\")), assume (false))"
")");
int _gl_dummy;
}))
? ((error(1, (*__errno_location()),
gettext("cannot get real GID")),
((0) ? (void)0 : __builtin_unreachable())))
: ((error(1, (*__errno_location()),
gettext("cannot get real GID")),
((0) ? (void)0 : __builtin_unreachable()))));
}
print_stuff(((void *)0));
}
return ok ? 0 : 1;
} | int main(int argc, const char **argv, const char **envp) {
char *v3;
char *v4;
char *v5;
bool v6;
char *v7;
char *v8;
char *v9;
struct passwd *v10;
long v11;
char *v12;
int *v13;
char v14;
char *v15;
int *v16;
char v17;
char *v18;
int *v19;
char *v20;
int *v21;
char *v22;
int *v23;
char v25;
bool v26;
_BOOL4 v27;
int v28;
char *name;
struct passwd *v30;
unsigned long v31;
const char *v32;
unsigned long v33;
v33 = __readfsqword(0x28u);
v27 = (int)is_selinux_enabled(argc, argv, envp) > 0;
v25 = is_smack_enabled();
set_program_name(*argv);
setlocale(6, locale);
bindtextdomain("coreutils", "/usr/local/share/locale");
textdomain("coreutils");
atexit((void (*)(void))&close_stdout);
while (2) {
v28 = getopt_long(argc, (char *const *)argv, "agnruzGZ", &longopts, 0LL);
if (v28 != -1) {
if (v28 <= 122) {
if (v28 >= 71) {
switch (v28) {
case 'G':
just_group_list = 1;
continue;
case 'Z':
if (!v27) {
v3 = gettext(
"--context (-Z) works only on an SELinux-enabled kernel");
error(1, 0, v3);
}
just_context = 1;
continue;
case 'a':
continue;
case 'g':
just_group = 1;
continue;
case 'n':
use_name = 1;
continue;
case 'r':
use_real = 1;
continue;
case 'u':
just_user = 1;
continue;
case 'z':
opt_zero = 1;
continue;
default:
goto LABEL_19;
}
}
if (v28 == -131) {
version_etc(stdout, "id", "GNU coreutils", Version, "Arnold Robbins",
"David MacKenzie", 0LL);
exit(0);
}
if (v28 == -130)
usage(0);
}
LABEL_19:
usage(1);
}
break;
}
v31 = argc - optind;
if (argc != optind && just_context) {
v4 = gettext("cannot print security context when user specified");
error(1, 0, v4);
}
if ((unsigned char)just_group_list + (unsigned char)just_group +
(unsigned char)just_user + (unsigned char)just_context >
1) {
v5 = gettext("cannot print \"only\" of more than one choice");
error(1, 0, v5);
}
v6 = just_user != 1 && just_group != 1 && just_group_list != 1 &&
just_context != 1;
v26 = v6;
if (v6 && (use_real || use_name)) {
v7 = gettext("cannot print only names or real IDs in default format");
error(1, 0, v7);
}
if (v26 && opt_zero) {
v8 = gettext("option --zero not permitted in default format");
error(1, 0, v8);
}
if (!v31 && (just_context || v26 && !getenv("POSIXLY_CORRECT")) &&
(v27 && (unsigned int)getcon(&context) && just_context ||
v25 && smack_new_label_from_self() < 0 && just_context)) {
v9 = gettext("can't get process context");
error(1, 0, v9);
}
if (v31) {
multiple_users = v31 > 1;
v31 += optind;
while (v31 > optind) {
name = 0LL;
v30 = 0LL;
v32 = argv[optind];
if (*v32 && !parse_user_spec(v32, &euid, 0LL, &name, 0LL)) {
if (name)
v10 = getpwnam(name);
else
v10 = getpwuid(euid);
v30 = v10;
}
if (v30) {
if (!name)
name = (char *)xstrdup(v30->pw_name);
euid = v30->pw_uid;
ruid = euid;
egid = v30->pw_gid;
rgid = egid;
print_stuff((long)name);
} else {
v11 = quote(v32);
v12 = gettext("%s: no such user");
v13 = _errno_location();
error(0, *v13, v12, v11);
ok = 0;
}
free(name);
++optind;
}
} else {
if (just_user)
v14 = use_real ^ 1;
else
v14 = just_group != 1 && just_group_list != 1 && just_context != 1;
if (v14) {
*_errno_location() = 0;
euid = geteuid();
if (euid == -1) {
if (*_errno_location()) {
v15 = gettext("cannot get effective UID");
v16 = _errno_location();
error(1, *v16, v15);
}
}
}
if (just_user)
v17 = use_real;
else
v17 = just_group != 1 && (just_group_list || just_context != 1);
if (v17) {
*_errno_location() = 0;
ruid = getuid();
if (ruid == -1) {
if (*_errno_location()) {
v18 = gettext("cannot get real UID");
v19 = _errno_location();
error(1, *v19, v18);
}
}
}
if (just_user != 1 &&
(just_group || just_group_list || just_context != 1)) {
*_errno_location() = 0;
egid = getegid();
if (egid == -1 && *_errno_location()) {
v20 = gettext("cannot get effective GID");
v21 = _errno_location();
error(1, *v21, v20);
}
*_errno_location() = 0;
rgid = getgid();
if (rgid == -1 && *_errno_location()) {
v22 = gettext("cannot get real GID");
v23 = _errno_location();
error(1, *v23, v22);
}
}
print_stuff(0LL);
}
return (unsigned char)ok ^ 1;
} | coreutils | ida |
static int yyerror(parser_control const *pc __attribute__((__unused__)),
char const *s __attribute__((__unused__))) {
return 0;
} | undefined8 yyerror(void)
{
return 0;
} | gnutls | ghidra |
int gzputs(file, s)
gzFile file;
const char *s;
{
z_size_t len, put;
gz_statep state;
if (file == ((void *)0))
return -1;
state = (gz_statep)file;
if (state->mode != 31153 || state->err != 0)
return -1;
len = strlen(s);
if ((int)len < 0 || (unsigned)len != len) {
gz_error(state, (-2), "string length does not fit in int");
return -1;
}
put = gz_write(state, s, len);
return put < len ? -1 : (int)len;
} | unsigned long gzputs(long a1, char *a2) {
unsigned long v3;
if (!a1)
return 0xFFFFFFFFLL;
if (*(_DWORD *)(a1 + 24) != 31153 || *(_DWORD *)(a1 + 116))
return 0xFFFFFFFFLL;
v3 = strlen(a2);
if ((v3 & 0x80000000) == 0LL && v3 == (unsigned int)v3) {
if (gz_write(a1, a2, v3) < v3)
return 0xFFFFFFFFLL;
else
return v3;
} else {
gz_error(a1, 4294967294LL, "string length does not fit in int");
return 0xFFFFFFFFLL;
}
} | zlib | ida |
static void adjust_extattr_refcount(e2fsck_t ctx, ext2_refcount_t refcount,
char *block_buf, int adjust_sign) {
struct ext2_ext_attr_header *header;
struct problem_context pctx;
ext2_filsys fs = ctx->fs;
blk64_t blk;
__u32 should_be;
ea_value_t count;
clear_problem_context(&pctx);
ea_refcount_intr_begin(refcount);
while (1) {
if ((blk = ea_refcount_intr_next(refcount, &count)) == 0)
break;
pctx.blk = blk;
pctx.errcode = ext2fs_read_ext_attr3(fs, blk, block_buf, pctx.ino);
if (pctx.errcode) {
fix_problem(ctx, 0x01003B, &pctx);
return;
}
header = (struct ext2_ext_attr_header *)block_buf;
pctx.blkcount = header->h_refcount;
should_be = header->h_refcount + adjust_sign * (int)count;
pctx.num = should_be;
if (fix_problem(ctx, 0x01003C, &pctx)) {
header->h_refcount = should_be;
pctx.errcode = ext2fs_write_ext_attr3(fs, blk, block_buf, pctx.ino);
if (pctx.errcode) {
fix_problem(ctx, 0x01003D, &pctx);
continue;
}
}
}
} | void adjust_extattr_refcount(undefined8 *param_1, undefined8 param_2,
long param_3, int param_4)
{
uint uVar1;
int iVar2;
long in_FS_OFFSET;
undefined8 local_98;
undefined8 local_90;
long local_88;
long local_80;
long local_78;
undefined4 local_70;
long local_50;
ulong local_40;
ulong local_28;
long local_10;
local_10 = *(long *)(in_FS_OFFSET + 0x28);
local_90 = *param_1;
clear_problem_context(&local_78);
ea_refcount_intr_begin(param_2);
do {
local_88 = ea_refcount_intr_next(param_2, &local_98);
if (local_88 == 0) {
LAB_00106784:
if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) {
__stack_chk_fail();
}
return;
}
local_50 = local_88;
local_78 = ext2fs_read_ext_attr3(local_90, local_88, param_3, local_70);
if (local_78 != 0) {
fix_problem(param_1, 0x1003b, &local_78);
goto LAB_00106784;
}
local_40 = (ulong) * (uint *)(param_3 + 4);
uVar1 = *(int *)(param_3 + 4) + (int)local_98 * param_4;
local_28 = (ulong)uVar1;
local_80 = param_3;
iVar2 = fix_problem(param_1, 0x1003c, &local_78);
if (iVar2 != 0) {
*(uint *)(local_80 + 4) = uVar1;
local_78 = ext2fs_write_ext_attr3(local_90, local_88, param_3);
if (local_78 != 0) {
fix_problem(param_1, 0x1003d, &local_78);
}
}
} while (true);
} | e2fsprogs-1.46.5 | ghidra |
static void open_files(void) {
if (pw_lock() == 0) {
fprintf(stderr, gettext("%s: cannot lock %s; try again later.\n"), Prog,
pw_dbname());
fail_exit(1);
}
pw_locked = 1;
if (pw_open(0100 | 02) == 0) {
fprintf(stderr, gettext("%s: cannot open %s\n"), Prog, pw_dbname());
fail_exit(1);
}
if (is_shadow_pwd && (spw_lock() == 0)) {
fprintf(stderr, gettext("%s: cannot lock %s; try again later.\n"), Prog,
spw_dbname());
fail_exit(1);
}
spw_locked = 1;
if (is_shadow_pwd && (spw_open(0100 | 02) == 0)) {
fprintf(stderr, gettext("%s: cannot open %s\n"), Prog, spw_dbname());
fail_exit(1);
}
if (Gflg || lflg) {
if (gr_lock() == 0) {
fprintf(stderr, gettext("%s: cannot lock %s; try again later.\n"), Prog,
gr_dbname());
fail_exit(10);
}
gr_locked = 1;
if (gr_open(0100 | 02) == 0) {
fprintf(stderr, gettext("%s: cannot open %s\n"), Prog, gr_dbname());
fail_exit(10);
}
if (is_shadow_grp && (sgr_lock() == 0)) {
fprintf(stderr, gettext("%s: cannot lock %s; try again later.\n"), Prog,
sgr_dbname());
fail_exit(10);
}
sgr_locked = 1;
if (is_shadow_grp && (sgr_open(0100 | 02) == 0)) {
fprintf(stderr, gettext("%s: cannot open %s\n"), Prog, sgr_dbname());
fail_exit(10);
}
}
if (vflg || Vflg) {
if (sub_uid_lock() == 0) {
fprintf(stderr, gettext("%s: cannot lock %s; try again later.\n"), Prog,
sub_uid_dbname());
fail_exit(16);
}
sub_uid_locked = 1;
if (sub_uid_open(0100 | 02) == 0) {
fprintf(stderr, gettext("%s: cannot open %s\n"), Prog, sub_uid_dbname());
fail_exit(16);
}
}
if (wflg || Wflg) {
if (sub_gid_lock() == 0) {
fprintf(stderr, gettext("%s: cannot lock %s; try again later.\n"), Prog,
sub_gid_dbname());
fail_exit(18);
}
sub_gid_locked = 1;
if (sub_gid_open(0100 | 02) == 0) {
fprintf(stderr, gettext("%s: cannot open %s\n"), Prog, sub_gid_dbname());
fail_exit(18);
}
}
} | long open_files() {
long v0;
long v1;
char *v2;
long v3;
long v4;
char *v5;
long v6;
long v7;
char *v8;
long v9;
long v10;
char *v11;
long v12;
long v13;
char *v14;
long v15;
long v16;
char *v17;
long v18;
long v19;
char *v20;
long v21;
long v22;
char *v23;
long v24;
long v25;
char *v26;
long v27;
long v28;
char *v29;
long result;
long v31;
long v32;
char *v33;
long v34;
long v35;
char *v36;
if (!(unsigned int)pw_lock()) {
v0 = pw_dbname();
v1 = Prog;
v2 = gettext("%s: cannot lock %s; try again later.\n");
fprintf(stderr, v2, v1, v0);
fail_exit(1);
}
pw_locked = 1;
if (!(unsigned int)pw_open(66LL)) {
v3 = pw_dbname();
v4 = Prog;
v5 = gettext("%s: cannot open %s\n");
fprintf(stderr, v5, v4, v3);
fail_exit(1);
}
if (is_shadow_pwd && !(unsigned int)spw_lock()) {
v6 = spw_dbname();
v7 = Prog;
v8 = gettext("%s: cannot lock %s; try again later.\n");
fprintf(stderr, v8, v7, v6);
fail_exit(1);
}
spw_locked = 1;
if (is_shadow_pwd && !(unsigned int)spw_open(66LL)) {
v9 = spw_dbname();
v10 = Prog;
v11 = gettext("%s: cannot open %s\n");
fprintf(stderr, v11, v10, v9);
fail_exit(1);
}
if (Gflg || lflg) {
if (!(unsigned int)gr_lock()) {
v12 = gr_dbname();
v13 = Prog;
v14 = gettext("%s: cannot lock %s; try again later.\n");
fprintf(stderr, v14, v13, v12);
fail_exit(10);
}
gr_locked = 1;
if (!(unsigned int)gr_open(66LL)) {
v15 = gr_dbname();
v16 = Prog;
v17 = gettext("%s: cannot open %s\n");
fprintf(stderr, v17, v16, v15);
fail_exit(10);
}
if (is_shadow_grp && !(unsigned int)sgr_lock()) {
v18 = sgr_dbname();
v19 = Prog;
v20 = gettext("%s: cannot lock %s; try again later.\n");
fprintf(stderr, v20, v19, v18);
fail_exit(10);
}
sgr_locked = 1;
if (is_shadow_grp && !(unsigned int)sgr_open(66LL)) {
v21 = sgr_dbname();
v22 = Prog;
v23 = gettext("%s: cannot open %s\n");
fprintf(stderr, v23, v22, v21);
fail_exit(10);
}
}
if (vflg || Vflg) {
if (!(unsigned int)sub_uid_lock()) {
v24 = sub_uid_dbname();
v25 = Prog;
v26 = gettext("%s: cannot lock %s; try again later.\n");
fprintf(stderr, v26, v25, v24);
fail_exit(16);
}
sub_uid_locked = 1;
if (!(unsigned int)sub_uid_open(66LL)) {
v27 = sub_uid_dbname();
v28 = Prog;
v29 = gettext("%s: cannot open %s\n");
fprintf(stderr, v29, v28, v27);
fail_exit(16);
}
}
if (wflg || (result = (unsigned char)Wflg, Wflg)) {
if (!(unsigned int)sub_gid_lock()) {
v31 = sub_gid_dbname();
v32 = Prog;
v33 = gettext("%s: cannot lock %s; try again later.\n");
fprintf(stderr, v33, v32, v31);
fail_exit(18);
}
sub_gid_locked = 1;
result = sub_gid_open(66LL);
if (!(_DWORD)result) {
v34 = sub_gid_dbname();
v35 = Prog;
v36 = gettext("%s: cannot open %s\n");
fprintf(stderr, v36, v35, v34);
fail_exit(18);
}
}
return result;
} | shadow | ida |
static void print_case_clauses(clauses) PATTERN_LIST *clauses;
{
indentation += indentation_amount;
while (clauses) {
newline("");
command_print_word_list(clauses->patterns, " | ");
cprintf(")\n");
indentation += indentation_amount;
make_command_string_internal(clauses->action);
indentation -= indentation_amount;
do {
if (deferred_heredocs)
print_deferred_heredocs("");
} while (0);
if (clauses->flags & 0x01)
newline(";&");
else if (clauses->flags & 0x02)
newline(";;&");
else
newline(";;");
clauses = clauses->next;
}
indentation -= indentation_amount;
} | void print_case_clauses(unsigned long a0) {
struct_0 *v0;
unsigned long long v2;
v0 = a0;
for (indentation = indentation_amount + indentation; v0; v0 = v0->field_0) {
newline(&g_403583);
command_print_word_list(v0->field_8, " | ");
cprintf(")\n");
indentation = indentation_amount + indentation;
make_command_string_internal(v0->field_10);
indentation = indentation - indentation_amount;
if (deferred_heredocs)
print_deferred_heredocs(&g_403583);
if ((v0->field_18 & 1)) {
newline(";&");
} else if ((v0->field_18 & 2)) {
newline(";;&");
} else {
newline(";;");
}
}
v2 = indentation - indentation_amount;
indentation = indentation - indentation_amount;
return;
} | bash | angr_dream |
void exitshell(void) {
struct jmploc loc;
char *p;
savestatus = exitstatus;
;
if (_setjmp(loc.loc))
goto out;
handler = &loc;
if ((p = trap[0])) {
trap[0] = ((void *)0);
evalskip = 0;
evalstring(p, 0);
evalskip = (1 << 3);
}
out:
exitreset();
if (__builtin_expect(!!(!_setjmp(loc.loc)), 1))
setjobctl(0);
flushall();
_exit(exitstatus);
} | long long exitshell() {
unsigned long long v0;
char v1;
unsigned long v2;
unsigned long long *v4;
v2 = v4[5];
savestatus = exitstatus;
if (!_setjmp(&v1)) {
handler = &v1;
v0 = 5188164362531343176;
if (v0) {
sigmode = 0;
evalskip = 0;
evalstring(v0, 0x0);
evalskip = 8;
}
}
exitreset();
if (!_setjmp(&v1))
setjobctl(0x0);
flushall();
_exit(exitstatus);
} | dash-0.5.11+git20210903+057cd650a4ed | angr_dream |
static int sh_euidaccess(path, mode) const char *path;
int mode;
{
int r, e;
if (current_user.uid != current_user.euid)
setreuid(current_user.euid, current_user.uid);
if (current_user.gid != current_user.egid)
setregid(current_user.egid, current_user.gid);
r = access(path, mode);
e = (*__errno_location());
if (current_user.uid != current_user.euid)
setreuid(current_user.uid, current_user.euid);
if (current_user.gid != current_user.egid)
setregid(current_user.gid, current_user.egid);
(*__errno_location()) = e;
return r;
} | long long sh_euidaccess(char *a0, unsigned long a1) {
unsigned int v0;
unsigned int v1;
if (current_user != g_500044)
setreuid(g_500044, current_user);
if (group_member != g_50004c)
setregid(g_50004c, group_member);
v0 = access(a0, a1);
v1 = *(__errno_location());
if (current_user != g_500044)
setreuid(current_user, g_500044);
if (group_member != g_50004c)
setregid(group_member, g_50004c);
*(__errno_location()) = v1;
return v0;
} | bash | angr_phoenix |
tty_bind_char(EditLine *el, int force) {
unsigned char *t_n = el->el_tty.t_c[1];
unsigned char *t_o = el->el_tty.t_ed.c_cc;
wchar_t new[2], old[2];
const ttymap_t *tp;
el_action_t *map, *alt;
const el_action_t *dmap, *dalt;
new[1] = old[1] = '\0';
map = el->el_map.key;
alt = el->el_map.alt;
if (el->el_map.type == 1) {
dmap = el->el_map.vii;
dalt = el->el_map.vic;
} else {
dmap = el->el_map.emacs;
dalt = ((void *)0);
}
for (tp = tty_map; tp->nch != (wint_t)-1; tp++) {
new[0] = (wchar_t)t_n[tp->nch];
old[0] = (wchar_t)t_o[tp->och];
if (new[0] == old[0] && !force)
continue;
keymacro_clear(el, map, old);
map[(unsigned char)old[0]] = dmap[(unsigned char)old[0]];
keymacro_clear(el, map, new);
map[(unsigned char)new[0]] = tp->bind[el->el_map.type];
if (dalt) {
keymacro_clear(el, alt, old);
alt[(unsigned char)old[0]] = dalt[(unsigned char)old[0]];
keymacro_clear(el, alt, new);
alt[(unsigned char)new[0]] = tp->bind[el->el_map.type + 1];
}
}
} | void tty_bind_char(struct_0 *a0, unsigned long a1) {
unsigned long long v0;
char *v1;
void *v2;
char *v3;
char *v4;
char *v5;
char *v6;
unsigned int v7;
unsigned int v8;
unsigned int v9;
unsigned int v10;
char v11;
unsigned long long *v13;
unsigned long long v14;
v3 = &a0->padding_0[473];
v4 = &a0->padding_0[661];
v10 = 0;
v8 = v10;
v5 = a0->field_3f8;
v6 = a0->field_3f0;
if (a0->field_420 == 1) {
v1 = a0->field_418;
v2 = a0->field_410;
} else {
v1 = a0->field_408;
v2 = 0;
}
for (v0 = &tty_map; *(v0) != -1; v0 += 12) {
v7 = v3[*(v0)];
v9 = v4[*((v0 + 4))];
if (v7 != v9 || a1) {
keymacro_clear(a0, v5, &v9, v5);
v5[v9] = v1[v9];
keymacro_clear(a0, v5, &v7, v5);
v5[v7] = *((v0 + a0->field_420 + 8));
if (v2) {
keymacro_clear(a0, v6, &v9, v6);
v6[v9] = *(v2 + v9);
keymacro_clear(a0, v6, &v7, v6);
v6[v7] = *((v0 + a0->field_420 + 1 + 8));
}
}
}
v14 = *(&v11) ^ v13[5];
return;
} | libedit | angr_sailr |
static void *fudge_opendir(const char *path) {
struct SFTP_OPENDIR *r;
r = xcalloc(1, sizeof(*r));
if (do_readdir(cur.conn, path, &r->dir)) {
free(r);
return (((void *)0));
}
r->offset = 0;
return ((void *)r);
} | long long fudge_opendir(unsigned long long a0) {
struct_0 *v0;
void *v2;
v0 = xcalloc(0x1, 0x10);
if (!do_readdir(cur, a0, v0, a0)) {
v0->field_8 = 0;
v2 = v0;
} else {
free(v0);
v2 = 0;
}
return v2;
} | openssh-portable | angr_phoenix |
void ssh_sandbox_parent_preauth(struct ssh_sandbox *box, pid_t child_pid) {
box->child_pid = child_pid;
} | long long ssh_sandbox_parent_preauth(unsigned int *a0, unsigned long a1) {
*(a0) = a1;
return a0;
} | openssh-portable | angr_sailr |
char *oneline(const char *file) {
FILE *fp;
char *ret = (char *)0, *nl;
size_t len = 0;
if ((fp = fopen(file, "re")) == (FILE *)0)
goto err;
if (getline(&ret, &len, fp) < 0)
goto out;
if (len)
ret[len - 1] = '\0';
if ((nl = strchr(ret, '\n')))
*nl = '\0';
out:
fclose(fp);
err:
return ret;
} | int oneline(char *a0) {
void *v0;
void *v1;
void *v2;
char *v3;
v0 = 0;
v1 = 0;
v2 = fopen(a0, "re");
if (!v2)
return v0;
if (getline(&v0, &v1, v2) >= 0) {
if (v1)
*((v0 + v1 - 1)) = 0;
v3 = strchr(v0, 0xa);
if (v3)
*(v3) = 0;
}
fclose(v2);
return v0;
} | sysvinit | angr_sailr |
uLong crc32_combine_op(crc1, crc2, op)
uLong crc1;
uLong crc2;
uLong op;
{
return multmodp(op, crc1) ^ (crc2 & 0xffffffff);
} | long long crc32_combine_op(unsigned int a0, unsigned long long a1,
unsigned int a2) {
return a1 ^ multmodp(a2, a0);
} | zlib | angr_sailr |
int inflateInit2_(strm, windowBits, version, stream_size)
z_streamp strm;
int windowBits;
const char *version;
int stream_size;
{
int ret;
struct inflate_state *state;
if (version == 0 || version[0] != "1.2.13"[0] ||
stream_size != (int)(sizeof(z_stream)))
return (-6);
if (strm == 0)
return (-2);
strm->msg = 0;
if (strm->zalloc == (alloc_func)0) {
strm->zalloc = zcalloc;
strm->opaque = (voidpf)0;
}
if (strm->zfree == (free_func)0)
strm->zfree = zcfree;
state = (struct inflate_state *)(*((strm)->zalloc))(
(strm)->opaque, (1), (sizeof(struct inflate_state)));
if (state == 0)
return (-4);
;
strm->state = (struct internal_state *)state;
state->strm = strm;
state->window = 0;
state->mode = HEAD;
ret = inflateReset2(strm, windowBits);
if (ret != 0) {
(*((strm)->zfree))((strm)->opaque, (voidpf)(state));
strm->state = 0;
}
return ret;
} | void inflateInit2_(unsigned long long a0[11], unsigned long a1, char *a2,
unsigned long a3) {
unsigned int v0;
struct_0 *v1;
unsigned long long v3;
unsigned long long v4;
unsigned long long v5;
unsigned long long v6;
if (a2 && *(a2) == 49 && a3 == 112) {
if (!a0) {
v4 = 4294967294;
} else {
a0[6] = 0;
if (!a0[8]) {
a0[8] = &zcalloc;
a0[10] = 0;
}
if (!a0[9])
a0[9] = &zcfree;
v1 = a0[8](a0[10], 1, 7160, a0[8]);
if (!v1) {
v5 = 0xfffffffc;
} else {
a0[7] = v1;
v1->field_0 = a0;
v1->field_48 = 0;
v1->field_8 = 16180;
v0 = inflateReset2(a0, a1);
if (v0) {
a0[9](a0[10], v1, v1, a0[9]);
a0[7] = 0;
}
v6 = v0;
}
}
}
if (!a2 || *(a2) != 49 || a3 != 112)
v3 = 4294967290;
return;
} | zlib | angr_dream |
void usage(int status) {
if (status != 0)
do {
fprintf(stderr, gettext("Try '%s --help' for more information.\n"),
program_name);
} while (0);
else {
printf(gettext("Usage: %s [OPTION]... FILE...\n"), program_name);
fputs_unlocked(
gettext(
"Update the access and modification times of each FILE to the "
"current time.\n\nA FILE argument that does not exist is created "
"empty, unless -c or -h\nis supplied.\n\nA FILE argument string of "
"- is handled specially and causes touch to\nchange the times of "
"the file associated with standard output.\n"),
stdout)
;
emit_mandatory_arg_note();
fputs_unlocked(
gettext(" -a change only the access time\n -c, "
"--no-create do not create any files\n -d, "
"--date=STRING parse STRING and use it instead of current "
"time\n -f (ignored)\n"),
stdout)
;
fputs_unlocked(
gettext(" -h, --no-dereference affect each symbolic link instead of "
"any referenced\n file (useful only on "
"systems that can change the\n "
"timestamps of a symlink)\n -m change "
"only the modification time\n"),
stdout)
;
fputs_unlocked(
gettext(
" -r, --reference=FILE use this file's times instead of current "
"time\n -t STAMP use [[CC]YY]MMDDhhmm[.ss] instead "
"of current time\n --time=WORD change the specified "
"time:\n WORD is access, atime, or use: "
"equivalent to -a\n WORD is modify or "
"mtime: equivalent to -m\n"),
stdout)
;
fputs_unlocked(gettext(" --help display this help and exit\n"),
stdout);
fputs_unlocked(
gettext(" --version output version information and exit\n"),
stdout);
fputs_unlocked(gettext("\nNote that the -d and -t options accept different "
"time-date formats.\n"),
stdout)
;
emit_ancillary_info("touch");
}
exit(status);
} | void usage(unsigned long a0) {
unsigned long v0;
unsigned long v2;
v0 = v2;
if (a0) {
fprintf(stderr, gettext("Try '%s --help' for more information.\n"));
} else {
printf(gettext("Usage: %s [OPTION]... FILE...\n"));
fputs_unlocked(
gettext(
"Update the access and modification times of each FILE to the "
"current time.\n\nA FILE argument that does not exist is created "
"empty, unless -c or -h\nis supplied.\n\nA FILE argument string of "
"- is handled specially and causes touch to\nchange the times of "
"the file associated with standard output.\n"),
stdout);
emit_mandatory_arg_note();
fputs_unlocked(
gettext(" -a change only the access time\n -c, "
"--no-create do not create any files\n -d, "
"--date=STRING parse STRING and use it instead of current "
"time\n -f (ignored)\n"),
stdout);
fputs_unlocked(
gettext(" -h, --no-dereference affect each symbolic link instead of "
"any referenced\n file (useful only on "
"systems that can change the\n "
"timestamps of a symlink)\n -m change "
"only the modification time\n"),
stdout);
fputs_unlocked(
gettext(
" -r, --reference=FILE use this file's times instead of current "
"time\n -t STAMP use [[CC]YY]MMDDhhmm[.ss] instead "
"of current time\n --time=WORD change the specified "
"time:\n WORD is access, atime, or use: "
"equivalent to -a\n WORD is modify or "
"mtime: equivalent to -m\n"),
stdout);
fputs_unlocked(gettext(" --help display this help and exit\n"),
stdout);
fputs_unlocked(
gettext(" --version output version information and exit\n"),
stdout);
fputs_unlocked(gettext("\nNote that the -d and -t options accept different "
"time-date formats.\n"),
stdout);
emit_ancillary_info("touch");
}
exit(a0);
} | coreutils | angr_phoenix |
int validate_trigname(const char *const *argv) {
const char *emsg;
if (!argv[0] || argv[1])
badusage(gettext("--%s takes one <trigname> argument"), cipaction->olong);
emsg = trig_name_is_illegal(argv[0]);
if (emsg)
ohshit(gettext("trigger name '%s' is invalid: %s"), argv[0], emsg);
return 0;
} | long long validate_trigname(unsigned long long a0[2]) {
unsigned long long v0;
if (!a0[0] || a0[1])
badusage(gettext("--%s takes one <trigname> argument"), *(cipaction));
v0 = trig_name_is_illegal(a0[0]);
if (v0) {
ohshit(gettext("trigger name '%s' is invalid: %s"), a0[0], v0);
return 0;
}
return 0;
} | dpkg | angr_sailr |
int xfrm_policy_print(struct nlmsghdr *n, void *arg) {
struct rtattr *tb[(__XFRMA_MAX - 1) + 1];
struct rtattr *rta;
struct xfrm_userpolicy_info *xpinfo = ((void *)0);
struct xfrm_user_polexpire *xpexp = ((void *)0);
struct xfrm_userpolicy_id *xpid = ((void *)0);
__u8 ptype = XFRM_POLICY_TYPE_MAIN;
FILE *fp = (FILE *)arg;
int len = n->nlmsg_len;
if (n->nlmsg_type != XFRM_MSG_NEWPOLICY &&
n->nlmsg_type != XFRM_MSG_DELPOLICY &&
n->nlmsg_type != XFRM_MSG_UPDPOLICY &&
n->nlmsg_type != XFRM_MSG_POLEXPIRE) {
fprintf(stderr, "Not a policy: %08x %08x %08x\n", n->nlmsg_len,
n->nlmsg_type, n->nlmsg_flags);
return 0;
}
if (n->nlmsg_type == XFRM_MSG_DELPOLICY) {
xpid = ((void *)(((char *)n) + ((int)(((sizeof(struct nlmsghdr)) + 4U - 1) &
~(4U - 1)))));
len -= (((((sizeof(*xpid)) +
((int)(((sizeof(struct nlmsghdr)) + 4U - 1) & ~(4U - 1))))) +
4U - 1) &
~(4U - 1));
} else if (n->nlmsg_type == XFRM_MSG_POLEXPIRE) {
xpexp =
((void *)(((char *)n) +
((int)(((sizeof(struct nlmsghdr)) + 4U - 1) & ~(4U - 1)))));
xpinfo = &xpexp->pol;
len -= (((((sizeof(*xpexp)) +
((int)(((sizeof(struct nlmsghdr)) + 4U - 1) & ~(4U - 1))))) +
4U - 1) &
~(4U - 1));
} else {
xpexp = ((void *)0);
xpinfo =
((void *)(((char *)n) +
((int)(((sizeof(struct nlmsghdr)) + 4U - 1) & ~(4U - 1)))));
len -= (((((sizeof(*xpinfo)) +
((int)(((sizeof(struct nlmsghdr)) + 4U - 1) & ~(4U - 1))))) +
4U - 1) &
~(4U - 1));
}
if (len < 0) {
fprintf(stderr, "BUG: wrong nlmsg len %d\n", len);
return -1;
}
if (n->nlmsg_type == XFRM_MSG_DELPOLICY)
rta = ((struct rtattr *)(((char *)(xpid)) +
(((sizeof(struct xfrm_userpolicy_id)) + 4U - 1) &
~(4U - 1))));
else if (n->nlmsg_type == XFRM_MSG_POLEXPIRE)
rta = ((struct rtattr *)(((char *)(xpexp)) +
(((sizeof(struct xfrm_user_polexpire)) + 4U - 1) &
~(4U - 1))));
else
rta = ((struct rtattr *)(((char *)(xpinfo)) +
(((sizeof(struct xfrm_userpolicy_info)) + 4U - 1) &
~(4U - 1))));
parse_rtattr(tb, (__XFRMA_MAX - 1), rta, len);
if (tb[XFRMA_POLICY_TYPE]) {
struct xfrm_userpolicy_type *upt;
if (((int)((tb[XFRMA_POLICY_TYPE])->rta_len) -
((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0))) <
sizeof(*upt)) {
fprintf(stderr, "too short XFRMA_POLICY_TYPE len\n");
return -1;
}
upt = ((void *)(((char *)(tb[XFRMA_POLICY_TYPE])) +
((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0))));
ptype = upt->type;
}
if (xpinfo && !xfrm_policy_filter_match(xpinfo, ptype))
return 0;
if (n->nlmsg_type == XFRM_MSG_DELPOLICY)
fprintf(fp, "Deleted ");
else if (n->nlmsg_type == XFRM_MSG_UPDPOLICY)
fprintf(fp, "Updated ");
else if (n->nlmsg_type == XFRM_MSG_POLEXPIRE)
fprintf(fp, "Expired ");
if (n->nlmsg_type == XFRM_MSG_DELPOLICY) {
if (!tb[XFRMA_POLICY]) {
fprintf(stderr, "Buggy XFRM_MSG_DELPOLICY: no XFRMA_POLICY\n");
return -1;
}
if (((int)((tb[XFRMA_POLICY])->rta_len) -
((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0))) <
sizeof(*xpinfo)) {
fprintf(stderr, "Buggy XFRM_MSG_DELPOLICY: too short XFRMA_POLICY len\n");
return -1;
}
xpinfo =
((void *)(((char *)(tb[XFRMA_POLICY])) +
((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0))));
}
xfrm_policy_info_print(xpinfo, tb, fp, ((void *)0), ((void *)0));
if (n->nlmsg_type == XFRM_MSG_POLEXPIRE) {
fprintf(fp, "\t");
fprintf(fp, "hard %u", xpexp->hard);
fprintf(fp, "%s", _SL_);
}
if (oneline)
fprintf(fp, "\n");
fflush(fp);
return 0;
} | int xfrm_policy_print(struct_0 *a0, void *a1) {
char v0;
unsigned int v1;
unsigned long long v2;
void *v3;
void *v4;
void *v5;
char *v6;
char v7;
char v8;
char v9;
unsigned int v11;
v3 = 0;
v4 = 0;
v5 = 0;
v0 = 0;
v1 = a0->field_0;
if (a0->field_4 != 19 && a0->field_4 != 20 && a0->field_4 != 25 &&
a0->field_4 != 27) {
fprintf(*(&stderr), "Not a policy: %08x %08x %08x\n", a0->field_0,
a0->field_4, a0->field_6);
v11 = 0;
}
if (a0->field_4 == 20 || a0->field_4 == 19 || a0->field_4 == 25 ||
a0->field_4 == 27) {
if (a0->field_4 == 20) {
v5 = a0 + 2;
v1 -= 80;
} else if (a0->field_4 == 27) {
v4 = a0 + 2;
v3 = v4;
v1 -= 192;
} else {
v4 = 0;
v3 = a0 + 2;
v1 -= 184;
}
if (v1 < 0) {
fprintf(*(&stderr), "BUG: wrong nlmsg len %d\n", v1);
v11 = -1;
} else {
if (a0->field_4 == 20) {
v2 = v5 + 64;
} else if (a0->field_4 == 27) {
v2 = v4 + 176;
} else {
v2 = v3 + 168;
}
parse_rtattr(&v7, 0x20, v2, v1);
if (*(&v9)) {
if (*(*(&v9)) - 4 <= 5) {
fprintf(*(&stderr), "too short XFRMA_POLICY_TYPE len\n");
v11 = -1;
} else {
v6 = *(&v9) + 4;
v0 = *(v6);
}
}
if (!*(&v9) || *(*(&v9)) - 4 > 5) {
if (v3) {
v11 = xfrm_policy_filter_match(v3, v0);
if (!v11)
v11 = 0;
}
if (!v3 || v11) {
if (a0->field_4 == 20) {
fprintf(a1, "Deleted ");
} else if (a0->field_4 == 25) {
fprintf(a1, "Updated ");
} else if (a0->field_4 == 27) {
fprintf(a1, "Expired ");
}
if (a0->field_4 == 20) {
if (!*(&v8)) {
fprintf(*(&stderr),
"Buggy XFRM_MSG_DELPOLICY: no XFRMA_POLICY\n");
v11 = -1;
} else if (*(*(&v8)) - 4 <= 167) {
fprintf(*(&stderr),
"Buggy XFRM_MSG_DELPOLICY: too short XFRMA_POLICY len\n");
v11 = -1;
} else {
v3 = *(&v8) + 4;
}
}
if (a0->field_4 != 20 || *(*(&v8)) - 4 > 167 && *(&v8)) {
xfrm_policy_info_print(v3, &v7, a1, 0x0, 0x0);
if (a0->field_4 == 27) {
fprintf(a1, "\t");
fprintf(a1, "hard %u", v4[168]);
fprintf(a1, "%s", _SL_);
}
if (oneline)
fprintf(a1, "\n");
fflush(a1);
v11 = 0;
}
}
}
}
}
return v11;
} | iproute2-6.0.0 | angr_dream |
void channel_stop_listening(struct ssh *ssh) {
u_int i;
Channel *c;
for (i = 0; i < ssh->chanctxt->channels_alloc; i++) {
c = ssh->chanctxt->channels[i];
if (c != ((void *)0)) {
switch (c->type) {
case 6:
case 2:
case 11:
case 1:
case 18:
case 19:
channel_close_fd(ssh, c, &c->sock);
channel_free(ssh, c);
break;
}
}
}
} | void channel_stop_listening(long param_1)
{
uint *puVar1;
uint local_14;
for (local_14 = 0; local_14 < *(uint *)(*(long *)(param_1 + 0x868) + 8);
local_14 = local_14 + 1) {
puVar1 = *(uint **)(**(long **)(param_1 + 0x868) + (ulong)local_14 * 8);
if (((puVar1 != (uint *)0x0) && (*puVar1 < 0x14)) &&
((1 << ((byte)*puVar1 & 0x3f) & 0xc0846U) != 0)) {
channel_close_fd(param_1, puVar1, puVar1 + 10);
channel_free(param_1, puVar1);
}
}
return;
} | openssh-portable | ghidra |
static unsigned load_chain(gnutls_x509_crt_t chain[8]) {
if (ocsptool_options.present.load_chain) {
common_info_st info;
size_t list_size;
memset(&info, 0, sizeof(info));
gnutls_x509_crt_t *list;
unsigned i;
info.verbose = verbose;
info.cert = ocsptool_options.arg.load_chain;
info.sort_chain = 1;
list = load_cert_list(1, &list_size, &info);
if (list_size > 8) {
fprintf(stderr, "Too many certificates in chain\n");
app_exit(1);
}
for (i = 0; i < list_size; i++)
chain[i] = list[i];
gnutls_free((void *)(list)), list = ((void *)0);
return list_size;
} else {
common_info_st info;
memset(&info, 0, sizeof(info));
info.verbose = verbose;
if (!ocsptool_options.present.load_cert) {
fprintf(stderr, "Missing option --load-cert\n");
app_exit(1);
}
info.cert = ocsptool_options.arg.load_cert;
chain[0] = load_cert(1, &info);
memset(&info, 0, sizeof(info));
info.verbose = verbose;
if (!ocsptool_options.present.load_issuer) {
fprintf(stderr, "Missing option --load-issuer\n");
app_exit(1);
}
info.cert = ocsptool_options.arg.load_issuer;
chain[1] = load_cert(1, &info);
return 2;
}
} | int load_chain(unsigned long long a0[2]) {
unsigned int v0;
char v1;
void *v2;
char v3;
unsigned long v4;
unsigned int v5;
unsigned int v6;
unsigned int v8;
if (g_500042) {
memset(&v3, 0x0, 0xd8);
v5 = *(&verbose);
v4 = gnutls_free;
v6 = 1;
v2 = load_cert_list(0x1, &v1, &v3);
if (*(&v1) > 8) {
fprintf(*(&stderr), "Too many certificates in chain\n");
app_exit(0x1);
}
for (v0 = 0; v0 < *(&v1); v0 += 1) {
a0[v0] = v2[v0];
}
*(5243000)(v2);
v2 = 0;
v8 = *(&v1);
} else {
memset(&v3, 0x0, 0xd8);
v5 = *(&verbose);
if ((g_500044 ^ 1)) {
fprintf(*(&stderr), "Missing option --load-cert\n");
app_exit(0x1);
}
v4 = gnutls_ocsp_req_deinit;
a0[0] = load_cert(0x1, &v3);
memset(&v3, 0x0, 0xd8);
v5 = *(&verbose);
if ((g_500043 ^ 1)) {
fprintf(*(&stderr), "Missing option --load-issuer\n");
app_exit(0x1);
}
v4 = printf;
a0[1] = load_cert(0x1, &v3);
v8 = 2;
}
return v8;
} | gnutls | angr_phoenix |
static void mark_ancestor_dirs(FTSENT *ent) {
FTSENT *p;
for (p = ent->fts_parent; 0 <= p->fts_level; p = p->fts_parent) {
if (p->fts_number)
break;
p->fts_number = 1;
}
} | long mark_ancestor_dirs(long a1) {
long result;
_QWORD *i;
for (i = *(_QWORD **)(a1 + 8);; i = (_QWORD *)i[1]) {
result = i[11];
if (result < 0)
break;
result = i[4];
if (result)
break;
i[4] = 1LL;
}
return result;
} | coreutils | ida |
get_number(int *, int, const char *[], FILE *),
set_element(bitstr_t *, int, int, int);
void free_entry(entry *e) {
free(e->cmd);
free(e->pwd);
env_free(e->envp);
free(e);
} | undefined8 get_number(int *param_1, int param_2, long param_3,
undefined8 param_4)
{
long lVar1;
ushort *puVar2;
char *__s1;
undefined *puVar3;
int iVar4;
int iVar5;
ushort **ppuVar6;
long lVar7;
undefined8 uVar8;
undefined *puVar9;
long in_FS_OFFSET;
int iStack131140;
int iStack131136;
char *pcStack131128;
char *pcStack131120;
char acStack131112[24];
undefined auStack131088[131072];
puVar3 = &stack0xfffffffffffffff0;
do {
puVar9 = puVar3;
*(undefined8 *)(puVar9 + -0x1000) = *(undefined8 *)(puVar9 + -0x1000);
puVar3 = puVar9 + -0x1000;
} while (puVar9 + -0x1000 != auStack131088);
lVar1 = *(long *)(in_FS_OFFSET + 0x28);
iStack131140 = 0;
pcStack131120 = acStack131112;
while (true) {
*(undefined8 *)(puVar9 + -0x1060) = 0x102094;
ppuVar6 = __ctype_b_loc();
puVar2 = *ppuVar6;
*(undefined8 *)(puVar9 + -0x1060) = 0x1020a6;
iVar4 = get_char(param_4);
if ((puVar2[iVar4] & 8) == 0)
break;
iStack131140 = iStack131140 + 1;
if (0x1ffff < iStack131140)
goto LAB_00102232;
*pcStack131120 = (char)iVar4;
pcStack131120 = pcStack131120 + 1;
}
*pcStack131120 = '\0';
if (iStack131140 != 0) {
*(undefined8 *)(puVar9 + -0x1060) = 0x1020f5;
unget_char(iVar4, param_4);
*(undefined8 *)(puVar9 + -0x1060) = 0x102113;
lVar7 = strtol(acStack131112, &pcStack131128, 10);
*param_1 = (int)lVar7;
if ((*pcStack131128 == '\0') && (pcStack131128 != acStack131112)) {
uVar8 = 0;
goto LAB_0010224e;
}
if (param_3 != 0) {
iStack131136 = 0;
while (*(long *)(param_3 + (long)iStack131136 * 8) != 0) {
if ((DebugFlags & 9) != 0) {
uVar8 = *(undefined8 *)(param_3 + (long)iStack131136 * 8);
*(undefined8 *)(puVar9 + -0x1060) = 0x1021ab;
printf("get_num, compare(%s,%s)\n", uVar8, acStack131112);
}
__s1 = *(char **)(param_3 + (long)iStack131136 * 8);
*(undefined8 *)(puVar9 + -0x1060) = 0x1021da;
iVar5 = strcasecmp(__s1, acStack131112);
if (iVar5 == 0) {
*param_1 = iStack131136 + param_2;
uVar8 = 0;
goto LAB_0010224e;
}
iStack131136 = iStack131136 + 1;
}
}
}
LAB_00102232:
*(undefined8 *)(puVar9 + -0x1060) = 0x102249;
unget_char(iVar4, param_4);
uVar8 = 0xffffffff;
LAB_0010224e:
if (lVar1 == *(long *)(in_FS_OFFSET + 0x28)) {
return uVar8;
}
*(undefined8 *)(puVar9 + -0x1060) = 0x102262;
__stack_chk_fail();
} | cronie | ghidra |
static int choose_comp(struct sshcomp *comp, char *client, char *server) {
char *name = match_list(client, server, ((void *)0));
if (name == ((void *)0))
return -33;
if (strcmp(name, "zlib@openssh.com") == 0) {
comp->type = 2;
} else if (strcmp(name, "zlib") == 0) {
comp->type = 1;
} else
if (strcmp(name, "none") == 0) {
comp->type = 0;
} else {
sshlog("kex.c", __func__, 832, 1, SYSLOG_LEVEL_ERROR, ((void *)0),
"unsupported compression scheme %s", name);
free(name);
return -1;
}
comp->name = name;
return 0;
} | int choose_comp(struct_0 *a0, unsigned long long a1, unsigned long long a2) {
unsigned long v0;
void *v1;
unsigned int v3;
v1 = match_list(a1, a2, 0x0, a2);
if (!v1) {
v3 = -33;
} else {
v3 = strcmp(v1, "zlib@openssh.com");
if (!v3) {
a0->field_0 = 2;
} else {
v3 = strcmp(v1, "zlib");
if (!v3) {
a0->field_0 = 1;
} else {
v3 = strcmp(v1, "none");
if (!v3) {
a0->field_0 = 0;
} else {
v0 = v1;
sshlog("kex.c", "choose_comp", 0x340, 0x1, 0x2, 0x0,
"unsupported compression scheme %s");
free(v1);
v3 = -1;
}
}
}
if (!v3 || !v3 || !v3) {
a0->field_8 = v1;
v3 = 0;
}
}
return v3;
} | openssh-portable | angr_dream |
static void tcinit(struct console *con) {
int serial, flags;
struct termios *tio = &con->tio;
int fd = con->fd;
serial = (*__errno_location()) = 0;
if (tcgetattr(fd, tio) < 0) {
con->flags |= 0x0002;
return;
}
if (ioctl(fd, 0x5415, (char *)&serial) == 0) {
speed_t ispeed, ospeed;
struct winsize ws;
con->flags |= 0x0001;
(void)tcflush(fd, 2);
ispeed = cfgetispeed(tio);
ospeed = cfgetospeed(tio);
if (!ispeed)
ispeed = (0000015);
if (!ospeed)
ospeed = (0000015);
tio->c_iflag = tio->c_lflag = tio->c_oflag = 0;
tio->c_cflag = 0000200 | 0000060 | 0002000 | (tio->c_cflag & 0004000);
cfsetispeed(tio, ispeed);
cfsetospeed(tio, ospeed);
tio->c_line = 0;
tio->c_cc[5] = 0;
tio->c_cc[6] = 1;
if (ioctl(fd, 0x5413, &ws) == 0) {
int set = 0;
if (ws.ws_row == 0) {
ws.ws_row = 24;
set++;
}
if (ws.ws_col == 0) {
ws.ws_col = 80;
set++;
}
(void)ioctl(fd, 0x5414, &ws);
}
goto setattr;
}
setattr:
tcsetattr(fd, 0, tio);
if ((flags = fcntl(fd, 3, 0)) != -1)
(void)fcntl(fd, 4, flags & ~04000);
} | void tcinit(unsigned int a0[6]) {
unsigned int v0;
unsigned int v1;
unsigned int v2;
unsigned int v3;
unsigned int v4;
unsigned int v5;
struct_0 *v6;
unsigned short v7;
unsigned short v8;
char v9;
unsigned int *v11;
unsigned long long *v12;
unsigned long long v13;
v6 = &a0[1 + 3];
v4 = a0[5];
v11 = __errno_location();
*(v11) = 0;
v0 = *(v11);
if (tcgetattr(v4, v6) < 0) {
a0[4] = a0[4] | 2;
} else {
if (!ioctl(v4, 0x5415)) {
a0[4] = a0[4] | 1;
tcflush(v4, 0x2);
v1 = cfgetispeed(v6);
v2 = cfgetospeed(v6);
if (!v1)
v1 = 13;
if (!v2)
v2 = 13;
v6->field_4 = 0;
v6->field_c = v6->field_4;
v6->field_0 = v6->field_c;
v6->field_8 = v6->field_8 & 0x800 | 1200;
cfsetispeed(v6, v1);
cfsetospeed(v6, v2);
v6->field_10 = 0;
v6->field_16 = 0;
v6->field_17 = 1;
if (!ioctl(v4, 0x5413)) {
v3 = 0;
if (!*(&v7)) {
v7 = 24;
v3 += 1;
}
if (!*(&v8)) {
v8 = 80;
v3 += 1;
}
ioctl(v4, 0x5414);
}
}
tcsetattr(v4, 0x0, v6);
v5 = fcntl(v4, 0x3);
if (v5 != -1)
fcntl(v4, 0x4);
}
v13 = *(&v9) ^ v12[5];
return;
} | sysvinit | angr_sailr |
void replace_prefix(char **pname, const char *samp, size_t slen,
const char *repl, size_t rlen) {
char *name = *pname;
size_t nlen = strlen(name);
if (nlen > slen && memcmp(name, samp, slen) == 0 && ((name[slen]) == '/')) {
if (rlen > slen) {
name = xrealloc(name, nlen - slen + rlen + 1);
*pname = name;
}
memmove(name + rlen, name + slen, nlen - slen + 1);
memcpy(name, repl, rlen);
}
} | long long replace_prefix(unsigned long long *a0, void *a1, char *a2, void *a3,
unsigned int a4) {
char *v0;
unsigned long long v1;
unsigned long long v3;
v0 = *(a0);
v1 = strlen(v0);
v3 = v1;
if (v1 > a2) {
v3 = memcmp(v0, a1, a2);
if (!v3) {
v3 = *((a2 + v0));
if (*((a2 + v0)) == 47) {
if (a4 > a2) {
v0 = xrealloc(v0, 1 + a4 + v1 + -0x1 * a2, 1 + a4 + v1 + -0x1 * a2);
*(a0) = v0;
}
memmove(&v0[a4], v0 + a2, 1 + v1 + -0x1 * a2);
v3 = memcpy(v0, a3, a4);
}
}
}
return v3;
} | tar | angr_dream |
ed_transpose_chars(EditLine *el, wint_t c) {
if (el->el_line.cursor < el->el_line.lastchar) {
if (el->el_line.lastchar <= &el->el_line.buffer[1])
return 6;
else
el->el_line.cursor++;
}
if (el->el_line.cursor > &el->el_line.buffer[1]) {
c = el->el_line.cursor[-2];
el->el_line.cursor[-2] = el->el_line.cursor[-1];
el->el_line.cursor[-1] = c;
return 4;
} else
return 6;
} | long long ed_transpose_chars(unsigned long long a0[13], unsigned long a1) {
unsigned int v0;
unsigned long long v2;
v0 = a1;
if (a0[11] < a0[12]) {
if (a0[12] <= a0[10] + 4)
v2 = 6;
else
a0[11] = a0[11] + 4;
}
if (a0[11] >= a0[12] || a0[12] > a0[10] + 4) {
if (a0[11] > a0[10] + 4) {
v0 = *((a0[11] - 8));
*((a0[11] - 8)) = *((a0[11] - 4));
*((a0[11] - 4)) = v0;
v2 = 4;
} else {
v2 = 6;
}
}
return v2;
} | libedit | angr_dream |
static int _rl_vi_callback_change_char(_rl_callback_generic_arg *data) {
int c;
char mb[16 + 1];
c = _rl_vi_callback_getchar(mb, 16);
if (c < 0)
return -1;
if ((__ctype_get_mb_cur_max()) > 1 && rl_byte_oriented == 0)
strncpy(_rl_vi_last_replacement, mb, 16);
else
_rl_vi_last_replacement[0] = c;
_rl_vi_last_replacement[16] = '\0';
_rl_callback_func = 0;
_rl_want_redisplay = 1;
return (_rl_vi_change_char(data->count, c, mb));
} | undefined8 _rl_vi_callback_change_char(undefined4 *param_1)
{
int iVar1;
undefined8 uVar2;
size_t sVar3;
long in_FS_OFFSET;
char local_28[24];
long local_10;
local_10 = *(long *)(in_FS_OFFSET + 0x28);
iVar1 = _rl_vi_callback_getchar(local_28, 0x10);
if (iVar1 < 0) {
uVar2 = 0xffffffff;
} else {
sVar3 = __ctype_get_mb_cur_max();
if ((sVar3 < 2) || (rl_byte_oriented != 0)) {
_rl_vi_last_replacement[0] = (undefined)iVar1;
} else {
strncpy(_rl_vi_last_replacement, local_28, 0x10);
}
_rl_vi_last_replacement[16] = 0;
_rl_callback_func = 0;
__rl_want_redisplay = 1;
uVar2 = _rl_vi_change_char(*param_1, iVar1, local_28);
}
if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) {
__stack_chk_fail();
}
return uVar2;
} | bash | ghidra |
static char *parameter_brace_patsub(varname, value, estatep, patsub, quoted,
pflags, flags)
char *varname, *value;
array_eltstate_t *estatep;
char *patsub;
int quoted, pflags, flags;
{
int vtype, mflags, starsub, delim;
char *val, *temp, *pat, *rep, *p, *lpatsub, *tt, *oname;
SHELL_VAR *v;
if (value == 0)
return ((char *)((void *)0));
oname = this_command_name;
this_command_name = varname;
vtype = get_var_and_type(varname, value, estatep, quoted, flags, &v, &val);
if (vtype == -1) {
this_command_name = oname;
return ((char *)((void *)0));
}
starsub = vtype & 128;
vtype &= ~128;
mflags = 0;
if (*patsub == '/') {
mflags |= 0x010;
patsub++;
}
lpatsub = (char *)strcpy(sh_xmalloc((1 + strlen(patsub)), "subst.c", 9128),
(patsub));
if (quoted & (0x002 | 0x001))
mflags |= 0x020;
if (starsub)
mflags |= 0x080;
if (pflags & 0x08)
mflags |= 0x040;
delim = skip_to_delim(lpatsub, ((*patsub == '/') ? 1 : 0), "/", 0);
if (lpatsub[delim] == '/') {
lpatsub[delim] = 0;
rep = lpatsub + delim + 1;
} else
rep = (char *)((void *)0);
if (rep && *rep == '\0')
rep = (char *)((void *)0);
pat = getpattern(lpatsub, quoted, 1);
if (rep) {
if (shell_compatibility_level > 42 && patsub_replacement == 0)
rep = expand_string_if_necessary(rep, quoted & ~(0x001 | 0x002),
expand_string_unsplit);
else if (shell_compatibility_level > 42 && patsub_replacement)
rep = expand_string_for_patsub(rep, quoted & ~(0x001 | 0x002));
else if ((mflags & 0x020) == 0)
rep = expand_string_if_necessary(rep, quoted, expand_string_unsplit);
else
rep =
expand_string_to_string_internal(rep, quoted, expand_string_unsplit);
if (patsub_replacement && rep && *rep && shouldexp_replacement(rep))
mflags |= 0x100;
}
p = pat;
if (mflags & 0x010)
mflags |= 0x000;
else if (pat && pat[0] == '#') {
mflags |= 0x001;
p++;
} else if (pat && pat[0] == '%') {
mflags |= 0x002;
p++;
} else
mflags |= 0x000;
switch (vtype) {
case 0:
case 3:
temp = pat_subst(val, p, rep, mflags);
if (vtype == 0)
do {
if (val)
sh_xfree((val), "subst.c", 9218);
} while (0);
if (temp) {
tt = (mflags & 0x020) ? quote_string(temp) : quote_escapes(temp);
sh_xfree((temp), "subst.c", 9222);
temp = tt;
}
break;
case 1:
if ((pflags & 0x04) && (mflags & 0x080))
mflags |= 0x040;
temp = pos_params_pat_subst(val, p, rep, mflags);
if (temp && quoted == 0 && ifs_is_null) {
} else if (temp && quoted == 0 && (pflags & 0x08)) {
} else if (temp && (mflags & 0x020) == 0) {
tt = quote_escapes(temp);
sh_xfree((temp), "subst.c", 9245);
temp = tt;
}
break;
case 2:
if ((mflags & 0x080) && (mflags & 0x040) && ifs_is_null)
mflags |= 0x020;
if (((((v)->attributes) & (0x0000040))))
temp = assoc_patsub((HASH_TABLE *)((v)->value), p, rep, mflags);
else
temp = array_patsub((ARRAY *)((v)->value), p, rep, mflags);
if (temp && quoted == 0 && ifs_is_null) {
} else if (temp && (mflags & 0x020) == 0) {
tt = quote_escapes(temp);
sh_xfree((temp), "subst.c", 9270);
temp = tt;
}
break;
}
do {
if (pat)
sh_xfree((pat), "subst.c", 9277);
} while (0);
do {
if (rep)
sh_xfree((rep), "subst.c", 9278);
} while (0);
sh_xfree((lpatsub), "subst.c", 9279);
this_command_name = oname;
return temp;
} | int parameter_brace_patsub(void *a0, void *a1, void *a2, char *a3,
unsigned long a4, unsigned long a5,
unsigned int v14) {
char *v0;
unsigned int v1;
unsigned int v2;
unsigned int v3;
unsigned int v4;
char v5;
char v6;
unsigned long long v7;
void *v8;
char *v9;
unsigned long long v10;
char *v11;
char *v12;
unsigned long v13;
unsigned long long v15;
v0 = a3;
if (!a1) {
v15 = 0;
} else {
v10 = this_command_name;
this_command_name = a0;
v2 = get_var_and_type(a0, a1, a2, a4, v14, &v6, &v5);
if (v2 == -1) {
this_command_name = v10;
v15 = 0;
} else {
v3 = v2 & 128;
v2 &= -129;
v1 = 0;
if (*(v0) == 47) {
v1 |= 16;
v0 += 1;
}
v11 = strcpy(sh_xmalloc(strlen(v0) + 1, "subst.c", 0x23a8), v0);
if ((a4 & 3))
v1 |= 32;
if (v3)
v1 |= 128;
if ((a5 & 8))
v1 |= 64;
v4 = skip_to_delim(v11, *(v0) == 47, "/", 0x0, a4, &v6);
if (v11[v4] == 47) {
v11[v4] = 0;
v8 = &v11[1 + v4];
} else {
v8 = 0;
}
if (v8 && !*(v8))
v8 = 0;
v12 = getpattern(v11, a4, 0x1);
if (v8) {
if (shell_compatibility_level > 42 && !patsub_replacement)
v8 = expand_string_if_necessary(v8, a4 & -0x4, expand_string_unsplit,
a4 & -0x4, a4, &v6);
if (shell_compatibility_level <= 42 || patsub_replacement) {
if (shell_compatibility_level > 42 && patsub_replacement)
v8 = expand_string_for_patsub(v8, a4 & -0x4);
if (shell_compatibility_level <= 42 || !patsub_replacement) {
if (!(v1 & 32))
v8 = expand_string_if_necessary(v8, a4, expand_string_unsplit, a4,
a4, &v6);
else
v8 = expand_string_to_string_internal(v8, a4,
expand_string_unsplit);
}
}
if (patsub_replacement && v8 && *(v8)) {
v15 = shouldexp_replacement(v8);
if (v15)
v1 |= 0x100;
}
}
v9 = v12;
if (!(v1 & 16)) {
if (v12 && *(v12) == 35) {
v1 |= 1;
v9 += 1;
}
if ((!v12 || *(v12) != 35) && v12 && *(v12) == 37) {
v1 |= 2;
v9 += 1;
}
}
if (v2 != 3 && v2 <= 3) {
if (v2 == 2) {
if ((v1 & 128) && (v1 & 64))
v1 |= 32;
if ((*((*(&v6) + 40)) & 64))
v7 = assoc_patsub(*((*(&v6) + 8)), v9, v8, v1);
else
v7 = array_patsub(*((*(&v6) + 8)), v9, v8, v1);
if ((!v7 || a4) && v7 && !(v1 & 32)) {
v13 = quote_escapes(v7);
sh_xfree(v7, "subst.c", 0x2436);
v7 = v13;
}
} else if (v2 <= 2 && v2 && v2 == 1) {
if ((a5 & 4) && (v1 & 128))
v1 |= 64;
v7 = pos_params_pat_subst(*(&v5), v9, v8, v1, a4, &v6);
if ((!v7 || a4) && v7 && !(v1 & 32)) {
v13 = quote_escapes(v7);
sh_xfree(v7, "subst.c", 0x241d);
v7 = v13;
}
}
}
if (v2 == 3 || !v2 && v2 <= 2 && v2 <= 3 && v2 != 2) {
v7 = pat_subst(*(&v5), v9, v8, v1, a4, &v6);
if (!v2 && *(&v5))
sh_xfree(*(&v5), "subst.c", 0x2402);
if (v7) {
if ((v1 & 32))
v15 = quote_string(v7);
else
v15 = quote_escapes(v7);
v13 = v15;
sh_xfree(v7, "subst.c", 0x2406);
v7 = v13;
}
}
if (v12)
sh_xfree(v12, "subst.c", 0x243d);
if (v8)
sh_xfree(v8, "subst.c", 0x243e);
sh_xfree(v11, "subst.c", 0x243f);
this_command_name = v10;
v15 = v7;
}
}
return v15;
} | bash | angr_dream |
void clear_unwind_protect_list(flags) int flags;
{
char *flag;
if (unwind_protect_list) {
flag = flags ? "" : (char *)((void *)0);
without_interrupts(clear_unwind_protects_internal, flag,
(char *)((void *)0));
}
} | long long clear_unwind_protect_list(unsigned long a0) {
unsigned long long v0;
unsigned long long v2;
unsigned long long v3;
v2 = unwind_protect_list;
if (unwind_protect_list) {
if (a0)
v3 = &g_400c46;
else
v3 = 0;
v0 = v3;
v2 = without_interrupts(clear_unwind_protects_internal, v0, 0x0);
}
return v2;
} | bash | angr_phoenix |
static void digest_break_file(char const *file_name) {
BLOCK file_contents;
char *cursor;
swallow_file_in_memory(file_name, &file_contents);
memset(word_fastmap, 1, 256);
for (cursor = file_contents.start; cursor < file_contents.end; cursor++)
word_fastmap[to_uchar(*cursor)] = 0;
if (!gnu_extensions) {
word_fastmap[' '] = 0;
word_fastmap['\t'] = 0;
word_fastmap['\n'] = 0;
}
free(file_contents.start);
} | unsigned long digest_break_file(const char *a1) {
unsigned char *i;
void *ptr[3];
unsigned long v4;
v4 = __readfsqword(0x28u);
swallow_file_in_memory(a1, (long *)ptr);
memset(word_fastmap, 1, 0x100uLL);
for (i = (unsigned char *)ptr[0]; i < ptr[1]; ++i)
word_fastmap[(unsigned char)to_uchar(*i)] = 0;
if (gnu_extensions != 1) {
byte_3FE0 = 0;
byte_3FC9 = 0;
byte_3FCA = 0;
}
free(ptr[0]);
return __readfsqword(0x28u) ^ v4;
} | coreutils | ida |
static int ipstats_show(int argc, char **argv) {
struct ipstats_stat_enabled enabled = {};
struct ipstats_sel sel = {};
const char *dev = ((void *)0);
int ifindex;
int err;
int i;
while (argc > 0) {
if (strcmp(*argv, "dev") == 0) {
do {
argv++;
if (--argc <= 0)
incomplete_command();
} while (0);
if (dev != ((void *)0))
duparg2("dev", *argv);
if (check_ifname(*argv))
invarg("\"dev\" not a valid ifname", *argv);
dev = *argv;
} else if (strcmp(*argv, "help") == 0) {
do_help();
return 0;
} else {
_Bool found_level = 0;
for (i = 0; i < (sizeof(ipstats_levels) / sizeof((ipstats_levels)[0]));
i++) {
if (strcmp(*argv, ipstats_levels[i]) == 0) {
do {
argv++;
if (--argc <= 0)
incomplete_command();
} while (0);
err = ipstats_select(&sel, *argv, i, &enabled);
if (err)
goto err;
found_level = 1;
}
}
if (!found_level) {
fprintf(stderr, "What is \"%s\"?\n", *argv);
do_help();
err = -22;
goto err;
}
}
do {
argv++;
argc--;
} while (0);
}
err = ipstats_enable_check(&sel, &enabled);
if (err)
goto err;
if (dev) {
ifindex = ll_name_to_index(dev);
if (!ifindex) {
err = nodev(dev);
goto err;
}
} else {
ifindex = 0;
}
err = ipstats_show_do(ifindex, &enabled);
err:
ipstats_enabled_free(&enabled);
return err;
} | int ipstats_show(int param_1, char **param_2)
{
bool bVar1;
int iVar2;
long in_FS_OFFSET;
char **local_68;
int local_5c;
int local_4c;
int local_48;
uint local_44;
char *local_40;
undefined8 local_38;
undefined8 local_30;
undefined8 local_28;
undefined8 local_20;
undefined8 local_18;
long local_10;
local_10 = *(long *)(in_FS_OFFSET + 0x28);
local_38 = 0;
local_30 = 0;
local_28 = 0;
local_20 = 0;
local_18 = 0;
local_40 = (char *)0x0;
local_68 = param_2;
for (local_5c = param_1; 0 < local_5c; local_5c = local_5c + -1) {
iVar2 = strcmp(*local_68, "dev");
if (iVar2 == 0) {
local_68 = local_68 + 1;
local_5c = local_5c + -1;
if (local_5c < 1) {
incomplete_command();
}
if (local_40 != (char *)0x0) {
duparg2(&DAT_0010349d, *local_68);
}
iVar2 = check_ifname(*local_68);
if (iVar2 != 0) {
invarg("\"dev\" not a valid ifname", *local_68);
}
local_40 = *local_68;
} else {
iVar2 = strcmp(*local_68, "help");
if (iVar2 == 0) {
do_help();
local_48 = 0;
goto LAB_00102b05;
}
bVar1 = false;
for (local_44 = 0; local_44 < 3; local_44 = local_44 + 1) {
iVar2 = strcmp(*local_68,
*(char **)(ipstats_levels + (long)(int)local_44 * 8));
if (iVar2 == 0) {
local_68 = local_68 + 1;
local_5c = local_5c + -1;
if (local_5c < 1) {
incomplete_command();
}
local_48 = ipstats_select(&local_28, *local_68, local_44, &local_38);
if (local_48 != 0)
goto LAB_00102af6;
bVar1 = true;
}
}
if (!bVar1) {
fprintf(stderr, "What is \"%s\"?\n", *local_68);
do_help();
local_48 = -0x16;
goto LAB_00102af6;
}
}
local_68 = local_68 + 1;
}
local_48 = ipstats_enable_check(&local_28, &local_38);
if (local_48 == 0) {
if (local_40 == (char *)0x0) {
local_4c = 0;
} else {
local_4c = ll_name_to_index(local_40);
if (local_4c == 0) {
local_48 = nodev(local_40);
goto LAB_00102af6;
}
}
local_48 = ipstats_show_do(local_4c, &local_38);
}
LAB_00102af6:
ipstats_enabled_free(&local_38);
LAB_00102b05:
if (local_10 == *(long *)(in_FS_OFFSET + 0x28)) {
return local_48;
}
__stack_chk_fail();
} | iproute2-6.0.0 | ghidra |
off_t deflate(int pack_level) {
IPos hash_head;
IPos prev_match;
int flush = 0;
int match_available = 0;
register unsigned match_length = 3 - 1;
lm_init(pack_level);
if (pack_level <= 3)
return deflate_fast();
while (lookahead != 0) {
((ins_h = (((ins_h) << ((15 + 3 - 1) / 3)) ^ (window[(strstart) + 3 - 1])) &
((unsigned)(1 << 15) - 1)),
prev[(strstart) & (0x8000 - 1)] = hash_head = (prev + 0x8000)[ins_h],
(prev + 0x8000)[ins_h] = (strstart));
prev_length = match_length, prev_match = match_start;
match_length = 3 - 1;
if (hash_head != 0 && prev_length < max_lazy_match &&
strstart - hash_head <= (0x8000 - (258 + 3 + 1)) &&
strstart <= window_size - (258 + 3 + 1)) {
match_length = longest_match(hash_head);
if (match_length > lookahead)
match_length = lookahead;
if (match_length == 3 && strstart - match_start > 4096) {
match_length--;
}
}
if (prev_length >= 3 && match_length <= prev_length) {
;
flush = ct_tally(strstart - 1 - prev_match, prev_length - 3);
lookahead -= prev_length - 1;
prev_length -= 2;
do {
if (rsync)
rsync_roll((strstart), (prev_length + 1));
} while (0);
do {
strstart++;
((ins_h =
(((ins_h) << ((15 + 3 - 1) / 3)) ^ (window[(strstart) + 3 - 1])) &
((unsigned)(1 << 15) - 1)),
prev[(strstart) & (0x8000 - 1)] = hash_head = (prev + 0x8000)[ins_h],
(prev + 0x8000)[ins_h] = (strstart));
} while (--prev_length != 0);
match_available = 0;
match_length = 3 - 1;
strstart++;
if (rsync && strstart > rsync_chunk_end) {
rsync_chunk_end = 0xFFFFFFFFUL;
flush = 2;
}
if (flush)
flush_block(block_start >= 0L ? (char *)&window[(unsigned)block_start]
: (char *)((void *)0),
(long)strstart - block_start, flush - 1, (0)),
block_start = strstart;
} else if (match_available) {
;
flush = ct_tally(0, window[strstart - 1]);
if (rsync && strstart > rsync_chunk_end) {
rsync_chunk_end = 0xFFFFFFFFUL;
flush = 2;
}
if (flush)
flush_block(block_start >= 0L ? (char *)&window[(unsigned)block_start]
: (char *)((void *)0),
(long)strstart - block_start, flush - 1, (0)),
block_start = strstart;
do {
if (rsync)
rsync_roll((strstart), (1));
} while (0);
strstart++;
lookahead--;
} else {
if (rsync && strstart > rsync_chunk_end) {
rsync_chunk_end = 0xFFFFFFFFUL;
flush = 2;
flush_block(block_start >= 0L ? (char *)&window[(unsigned)block_start]
: (char *)((void *)0),
(long)strstart - block_start, flush - 1, (0)),
block_start = strstart;
}
match_available = 1;
do {
if (rsync)
rsync_roll((strstart), (1));
} while (0);
strstart++;
lookahead--;
};
while (lookahead < (258 + 3 + 1) && !eofile)
fill_window();
}
if (match_available)
ct_tally(0, window[strstart - 1]);
return flush_block(block_start >= 0L ? (char *)&window[(unsigned)block_start]
: (char *)((void *)0),
(long)strstart - block_start, flush - 1, (1));
} | void deflate(int param_1)
{
bool bVar1;
int iVar2;
uint uVar3;
uint uVar4;
uint uVar5;
undefined1 *puVar6;
int local_28;
local_28 = 0;
bVar1 = false;
uVar5 = 2;
lm_init(param_1);
if (param_1 < 4) {
deflate_fast();
} else {
while (lookahead != 0) {
ins_h = ((uint)(byte)(&window)[strstart + 2] ^ ins_h << 5) & 0x7fff;
uVar3 = (uint)(ushort)(&prev)[(ulong)ins_h + 0x8000];
(&prev)[strstart & 0x7fff] = (&prev)[(ulong)ins_h + 0x8000];
(&prev)[(ulong)ins_h + 0x8000] = (short)strstart;
iVar2 = match_start;
uVar4 = 2;
prev_length = uVar5;
if ((((uVar3 != 0) && (uVar5 < max_lazy_match)) &&
(strstart - uVar3 < 0x7efb)) &&
((ulong)strstart <= window_size - 0x106U)) {
uVar4 = longest_match(uVar3);
if (lookahead < uVar4) {
uVar4 = lookahead;
}
if ((uVar4 == 3) && (0x1000 < strstart - match_start)) {
uVar4 = 2;
}
}
uVar5 = uVar4;
if ((prev_length < 3) || (prev_length < uVar5)) {
if (bVar1) {
local_28 = ct_tally(0, (&window)[strstart - 1]);
if ((rsync != 0) && (rsync_chunk_end < strstart)) {
rsync_chunk_end = 0xffffffff;
local_28 = 2;
}
if (local_28 != 0) {
if ((long)block_start < 0) {
puVar6 = (undefined1 *)0x0;
} else {
puVar6 = &window + (block_start & 0xffffffff);
}
flush_block(puVar6, strstart - block_start, local_28 + -1);
block_start = (ulong)strstart;
}
if (rsync != 0) {
rsync_roll();
}
strstart = strstart + 1;
lookahead = lookahead - 1;
} else {
if ((rsync != 0) && (rsync_chunk_end < strstart)) {
rsync_chunk_end = 0xffffffff;
local_28 = 2;
if ((long)block_start < 0) {
puVar6 = (undefined1 *)0x0;
} else {
puVar6 = &window + (block_start & 0xffffffff);
}
flush_block(puVar6, strstart - block_start, 1);
block_start = (ulong)strstart;
}
bVar1 = true;
if (rsync != 0) {
rsync_roll(strstart, 1);
}
strstart = strstart + 1;
lookahead = lookahead - 1;
}
} else {
local_28 = ct_tally((strstart - iVar2) + -1, prev_length - 3);
lookahead = (lookahead - prev_length) + 1;
prev_length = prev_length - 2;
if (rsync != 0) {
rsync_roll();
}
do {
uVar5 = strstart + 1;
ins_h = ((uint)(byte)(&window)[strstart + 3] ^ ins_h << 5) & 0x7fff;
strstart = uVar5;
(&prev)[uVar5 & 0x7fff] = (&prev)[(ulong)ins_h + 0x8000];
(&prev)[(ulong)ins_h + 0x8000] = (short)strstart;
prev_length = prev_length - 1;
} while (prev_length != 0);
bVar1 = false;
uVar5 = 2;
strstart = strstart + 1;
if ((rsync != 0) && (rsync_chunk_end < strstart)) {
rsync_chunk_end = 0xffffffff;
local_28 = 2;
}
if (local_28 != 0) {
if ((long)block_start < 0) {
puVar6 = (undefined1 *)0x0;
} else {
puVar6 = &window + (block_start & 0xffffffff);
}
flush_block(puVar6, strstart - block_start, local_28 + -1);
block_start = (ulong)strstart;
}
}
while ((lookahead < 0x106 && (eofile == 0))) {
fill_window();
}
}
if (bVar1) {
ct_tally(0, (&window)[strstart - 1]);
}
if ((long)block_start < 0) {
puVar6 = (undefined1 *)0x0;
} else {
puVar6 = &window + (block_start & 0xffffffff);
}
flush_block(puVar6, strstart - block_start, local_28 + -1, 1);
}
return;
} | gzip-1.12 | ghidra |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.