input stringlengths 26 172k | output stringlengths 18 318k | repo_name stringclasses 23 values | decompiler stringclasses 5 values |
|---|---|---|---|
(input = output = open(
"/dev/tty"
,
02
)) == -1) {
if (flags & 0x02) {
(*__errno_location()) = 25;
return (((void *)0));
}
input = 0;
output = 2;
} | int open(char *__file, int __oflag, ...)
{
halt_baddata();
} | libbsd-0.11.7 | ghidra |
void print_rlimtype(n, addnl) rlim_t n;
int addnl;
{
char s[(((sizeof(rlim_t) * 8) - (!((rlim_t)0 < (rlim_t)-1))) * 302 / 1000 +
1 + (!((rlim_t)0 < (rlim_t)-1))) +
1],
*p;
p = s + sizeof(s);
*--p = '\0';
if (n < 0) {
do
*--p = '0' - n % 10;
while ((n /= 10) != 0);
*--p = '-';
} else {
do
*--p = '0' + n % 10;
while ((n /= 10) != 0);
}
printf("%s%s", p, addnl ? "\n" : "");
} | long long print_rlimtype(unsigned long a0, unsigned long a1) {
unsigned long long v0;
char *v1;
char v2;
unsigned int v4;
v0 = a0;
v1 = &v2;
v1 -= 1;
*(v1) = 0;
do {
v1 -= 1;
*(v1) = (v0 - (v0 * 14757395258967641293 >> 64 >> 3) * 10) + 48;
v0 = v0 * 14757395258967641293 >> 64 >> 3;
} while (v0);
if (!a1)
v4 = &g_4034bd;
else
v4 = "\n";
printf("%s%s", v1, v4);
return 0;
} | bash | angr_sailr |
&& !sshkey_equal_public(prv, id->key)) {
sshlog("sshconnect2.c", __func__, 1269, 1,
SYSLOG_LEVEL_ERROR, ((void *)0),
"private key %s contents do not match public",
id->filename);
r = -46;
goto out;
} | void sshkey_equal_public(void)
{
halt_baddata();
} | openssh-portable | ghidra |
int builtin_handler(self, defs, arg)
char *self;
DEF_FILE *defs;
char *arg;
{
BUILTIN_DESC *new;
char *name;
if (building_builtin) {
line_error(defs, "%s found before $END", self);
return (-1);
}
output_cpp_line_info++;
name = get_arg(self, defs, arg);
if (!defs->builtins)
defs->builtins = array_create(sizeof(BUILTIN_DESC *));
new = (BUILTIN_DESC *)xmalloc(sizeof(BUILTIN_DESC));
new->name = name;
new->function = (char *)((void *)0);
new->shortdoc = (char *)((void *)0);
new->docname = (char *)((void *)0);
new->longdoc = (ARRAY *)((void *)0);
new->dependencies = (ARRAY *)((void *)0);
new->flags = 0;
if (is_special_builtin(name))
new->flags |= 0x01;
if (is_assignment_builtin(name))
new->flags |= 0x02;
if (is_localvar_builtin(name))
new->flags |= 0x04;
if (is_posix_builtin(name))
new->flags |= 0x08;
if (is_arrayvar_builtin(name))
new->flags |= 0x10;
array_add((char *)new, defs->builtins);
building_builtin = 1;
return (0);
} | long long builtin_handler(unsigned int a0, void *a1, char *a2,
unsigned int a3) {
unsigned long long v0;
struct_1 *v1;
unsigned long long v3;
if (building_builtin) {
line_error(a1, "%s found before $END", a0, a3);
v3 = 4294967295;
} else {
output_cpp_line_info = output_cpp_line_info + 1;
v0 = get_arg(a0, a1, a2, a1);
if (!a1[40])
*(&a1[40]) = array_create(0x8);
v1 = xmalloc(0x38);
v1->field_0 = v0;
v1->field_8 = 0;
v1->field_10 = 0;
v1->field_18 = 0;
v1->field_20 = 0;
v1->field_28 = 0;
v1->field_30 = 0;
if (is_special_builtin(v0))
v1->field_30 = v1->field_30 | 1;
if (is_assignment_builtin(v0))
v1->field_30 = v1->field_30 | 2;
if (is_localvar_builtin(v0))
v1->field_30 = v1->field_30 | 4;
if (is_posix_builtin(v0))
v1->field_30 = v1->field_30 | 8;
if (is_arrayvar_builtin(v0))
v1->field_30 = v1->field_30 | 16;
array_add(v1, a1[40]);
building_builtin = 1;
v3 = 0;
}
return v3;
} | bash | angr_phoenix |
inline __u16 ext2fs_swab16(__u16 val) { return (val >> 8) | (__u16)(val << 8); } | void ext2fs_swab16(void)
{
halt_baddata();
} | e2fsprogs-1.46.5 | ghidra |
static inline void initialize_exit_failure(int status) {
if (status != 1)
exit_failure = status;
} | void initialize_exit_failure(int param_1)
{
if (param_1 != 1) {
exit_failure = param_1;
}
return;
} | coreutils | ghidra |
static void send_tree(tree, max_code) ct_data *tree;
int max_code;
{
int n;
int prevlen = -1;
int curlen;
int nextlen = tree[0].dl.len;
int count = 0;
int max_count = 7;
int min_count = 4;
if (nextlen == 0)
max_count = 138, min_count = 3;
for (n = 0; n <= max_code; n++) {
curlen = nextlen;
nextlen = tree[n + 1].dl.len;
if (++count < max_count && curlen == nextlen) {
continue;
} else if (count < min_count) {
do {
send_bits(bl_tree[curlen].fc.code, bl_tree[curlen].dl.len);
} while (--count != 0);
} else if (curlen != 0) {
if (curlen != prevlen) {
send_bits(bl_tree[curlen].fc.code, bl_tree[curlen].dl.len);
count--;
};
send_bits(bl_tree[16].fc.code, bl_tree[16].dl.len);
send_bits(count - 3, 2);
} else if (count <= 10) {
send_bits(bl_tree[17].fc.code, bl_tree[17].dl.len);
send_bits(count - 3, 3);
} else {
send_bits(bl_tree[18].fc.code, bl_tree[18].dl.len);
send_bits(count - 11, 7);
}
count = 0;
prevlen = curlen;
if (nextlen == 0) {
max_count = 138, min_count = 3;
} else if (curlen == nextlen) {
max_count = 6, min_count = 3;
} else {
max_count = 7, min_count = 4;
}
}
} | long send_tree(long a1, int a2) {
long result;
int i;
int v4;
int v5;
int v6;
int v7;
int v8;
int v9;
v4 = -1;
v5 = *(unsigned short *)(a1 + 2);
v6 = 0;
v7 = 7;
v8 = 4;
if (!*(_WORD *)(a1 + 2)) {
v7 = 138;
v8 = 3;
}
for (i = 0;; ++i) {
result = (unsigned int)i;
if (i > a2)
break;
v9 = v5;
v5 = *(unsigned short *)(4 * (i + 1LL) + a1 + 2);
if (++v6 >= v7 || v9 != v5) {
if (v6 >= v8) {
if (v9) {
if (v9 != v4) {
send_bits(*((unsigned short *)&bl_tree + 2 * v9),
word_2E42[2 * v9]);
--v6;
}
send_bits((unsigned short)word_2E80, (unsigned short)word_2E82);
send_bits((unsigned int)(v6 - 3), 2LL);
} else if (v6 > 10) {
send_bits((unsigned short)word_2E88, (unsigned short)word_2E8A);
send_bits((unsigned int)(v6 - 11), 7LL);
} else {
send_bits((unsigned short)word_2E84, (unsigned short)word_2E86);
send_bits((unsigned int)(v6 - 3), 3LL);
}
} else {
do {
send_bits(*((unsigned short *)&bl_tree + 2 * v9), word_2E42[2 * v9]);
--v6;
} while (v6);
}
v6 = 0;
v4 = v9;
if (v5) {
if (v9 == v5) {
v7 = 6;
v8 = 3;
} else {
v7 = 7;
v8 = 4;
}
} else {
v7 = 138;
v8 = 3;
}
}
}
return result;
} | gzip-1.12 | ida |
static const char *const he_errlist[] = {
"OK",
"unknown error",
"malloc() failed",
"first event not found",
"last event not found",
"empty list",
"no next event",
"no previous event",
"current event is invalid",
"event not found",
"can't read history from file",
"can't write history",
"required parameter(s) not supplied",
"history size negative",
"function not allowed with other history-functions-set the default",
"bad parameters"}; | void *malloc(size_t __size)
{
halt_baddata();
} | libedit | ghidra |
static int put_bitmap(struct sshbuf *buf, struct bitmap *bitmap) {
size_t len;
u_char *blob;
int r;
len = bitmap_nbytes(bitmap);
if ((blob = malloc(len)) == ((void *)0))
return -2;
if (bitmap_to_string(bitmap, blob, len) != 0) {
free(blob);
return -1;
}
r = sshbuf_put_bignum2_bytes(buf, blob, len);
free(blob);
return r;
} | int put_bitmap(unsigned long long a0, unsigned long long a1) {
unsigned int v0;
unsigned long v1;
void *v2;
unsigned int v4;
v1 = bitmap_nbytes(a1);
v2 = malloc(v1);
if (!v2) {
v4 = -2;
} else {
v4 = bitmap_to_string(a1, v2, v1, v2);
if (v4) {
free(v2);
v4 = -1;
} else {
v0 = sshbuf_put_bignum2_bytes(a0, v2, v1, v2);
free(v2);
v4 = v0;
}
}
return v4;
} | openssh-portable | angr_dream |
void rl_cleanup_after_signal(void) {
_rl_clean_up_for_exit();
if (rl_deprep_term_function)
(*rl_deprep_term_function)();
rl_clear_pending_input();
rl_clear_signals();
} | void rl_cleanup_after_signal(void)
{
_rl_clean_up_for_exit();
if (rl_deprep_term_function != (code *)0x0) {
(*rl_deprep_term_function)();
}
rl_clear_pending_input();
rl_clear_signals();
return;
} | bash | ghidra |
struct pkginfo *deppossi_pkg_iter_next(struct deppossi_pkg_iterator *iter) {
struct pkginfo *pkg_cur;
struct pkgbin *pkgbin;
while ((pkg_cur = iter->pkg_next)) {
iter->pkg_next = pkg_cur->arch_next;
switch (iter->which_pkgbin) {
case wpb_installed:
pkgbin = &pkg_cur->installed;
break;
case wpb_available:
pkgbin = &pkg_cur->available;
break;
case wpb_by_istobe:
if (pkg_cur->clientdata &&
pkg_cur->clientdata->istobe == PKG_ISTOBE_INSTALLNEW)
pkgbin = &pkg_cur->available;
else
pkgbin = &pkg_cur->installed;
break;
default:
do_internerr("depcon.c", 85, __func__, "unknown which_pkgbin %d",
iter->which_pkgbin);
}
if (archsatisfied(pkgbin, iter->possi))
return pkg_cur;
}
return ((void *)0);
} | int deppossi_pkg_iter_next(struct_0 *a0) {
unsigned long long v0;
struct_1 *v1;
unsigned int v3;
while (true) {
v1 = a0->field_8;
if (!v1) {
v3 = 0;
return v3;
}
a0->field_8 = v1->field_8;
switch (a0->field_10) {
case 2:
if (!v1->field_138 || v1->field_138->field_0 != 2) {
v0 = &v1->padding_10[56];
break;
} else {
v0 = &v1->padding_10[176];
break;
}
case 0:
v0 = &v1->padding_10[56];
break;
case 1:
v0 = &v1->padding_10[176];
break;
default:
do_internerr("depcon.c", 0x55, "deppossi_pkg_iter_next",
"unknown which_pkgbin %d", a0->field_10);
}
if (archsatisfied(v0, a0->field_0, a0->field_0)) {
v3 = v1;
return v3;
}
}
} | dpkg | 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 COMMAND [ARG]...\n or: %s OPTION\n")
,
program_name, program_name);
fputs_unlocked(gettext("Run COMMAND, ignoring hangup signals.\n\n"), stdout)
;
fputs_unlocked(gettext(" --help display this help and exit\n"),
stdout);
fputs_unlocked(
gettext(" --version output version information and exit\n"),
stdout);
printf(
gettext(
"\nIf standard input is a terminal, redirect it from an unreadable "
"file.\nIf standard output is a terminal, append output to "
"'nohup.out' if possible,\n'$HOME/nohup.out' otherwise.\nIf "
"standard error is a terminal, redirect it to standard output.\nTo "
"save output to FILE, use '%s COMMAND > FILE'.\n")
,
program_name);
printf(gettext("\n"
"NOTE: your shell may have its own version of %s, which "
"usually supersedes\n"
"the version described here. Please refer to your shell's "
"documentation\n"
"for details about the options it supports.\n"),
"nohup");
emit_ancillary_info("nohup");
}
exit(status);
} | void usage(int param_1)
{
FILE *pFVar1;
undefined8 uVar2;
char *pcVar3;
uVar2 = program_name;
if (param_1 == 0) {
pcVar3 = (char *)gettext("Usage: %s COMMAND [ARG]...\n or: %s OPTION\n");
printf(pcVar3, uVar2, uVar2);
pFVar1 = stdout;
pcVar3 = (char *)gettext("Run COMMAND, ignoring hangup signals.\n\n");
fputs_unlocked(pcVar3, pFVar1);
pFVar1 = stdout;
pcVar3 =
(char *)gettext(" --help display this help and exit\n");
fputs_unlocked(pcVar3, pFVar1);
pFVar1 = stdout;
pcVar3 = (char *)gettext(
" --version output version information and exit\n");
fputs_unlocked(pcVar3, pFVar1);
uVar2 = program_name;
pcVar3 = (char *)gettext(
"\nIf standard input is a terminal, redirect it from an unreadable "
"file.\nIf standard output is a terminal, append output to "
"\'nohup.out\' if possible,\n\'$HOME/nohup.out\' otherwise.\nIf "
"standard error is a terminal, redirect it to standard output.\nTo "
"save output to FILE, use \'%s COMMAND > FILE\'.\n");
printf(pcVar3, uVar2);
pcVar3 = (char *)gettext(
"\nNOTE: your shell may have its own version of %s, which usually "
"supersedes\nthe version described here. Please refer to your "
"shell\'s documentation\nfor details about the options it supports.\n");
printf(pcVar3, "nohup");
emit_ancillary_info();
} else {
pcVar3 = (char *)gettext("Try \'%s --help\' for more information.\n");
fprintf(stderr, pcVar3, uVar2);
}
exit(param_1);
} | coreutils | ghidra |
void _rl_clear_screen(int clrscr) {
if (_rl_term_clrpag) {
tputs(_rl_term_clrpag, 1, _rl_output_character_function);
if (clrscr && _rl_term_clrscroll)
tputs(_rl_term_clrscroll, 1, _rl_output_character_function);
} else
rl_crlf();
} | long long _rl_clear_screen(unsigned long a0) {
unsigned long long v1;
if (_rl_term_clrpag) {
v1 = tputs(_rl_term_clrpag, 0x1, got._rl_output_character_function);
if (a0) {
v1 = _rl_term_clrscroll;
if (_rl_term_clrscroll)
v1 = tputs(_rl_term_clrscroll, 0x1, got._rl_output_character_function);
}
} else {
v1 = rl_crlf();
}
return v1;
} | bash | angr_dream |
void phash_create() {
if (hashed_filenames == 0)
hashed_filenames = hash_create(256);
} | void phash_create(void)
{
if (hashed_filenames == 0) {
hashed_filenames = hash_create(0x100);
}
return;
} | bash | ghidra |
void print_key_material(gnutls_session_t session, const char *label,
size_t size) {
gnutls_datum_t bin = {((void *)0), 0}, hex = {((void *)0), 0};
int ret;
bin.data = gnutls_malloc(size);
if (!bin.data) {
fprintf(stderr, "Error in gnutls_malloc: %s\n", gnutls_strerror(-25));
goto out;
}
bin.size = size;
ret = gnutls_prf_rfc5705(session, strlen(label), label, 0, ((void *)0), size,
(char *)bin.data);
if (ret < 0) {
fprintf(stderr, "Error in gnutls_prf_rfc5705: %s\n", gnutls_strerror(ret));
goto out;
}
ret = gnutls_hex_encode2(&bin, &hex);
if (ret < 0) {
fprintf(stderr, "Error in hex encoding: %s\n", gnutls_strerror(ret));
goto out;
}
log_msg(stdout, "- Key material: %s\n", hex.data);
fflush(stdout);
out:
gnutls_free((void *)(bin.data)), bin.data = ((void *)0);
gnutls_free((void *)(hex.data)), hex.data = ((void *)0);
} | unsigned long print_key_material(long a1, const char *a2, long a3) {
const char *v3;
size_t v4;
const char *v5;
long v6;
long v7;
long v8;
const char *v9;
int v12;
int v13;
long v14;
int v15;
long v16;
int v17;
unsigned long v18;
v18 = __readfsqword(0x28u);
v15 = 0;
v16 = 0LL;
v17 = 0;
v14 = gnutls_malloc(a3);
if (v14) {
v15 = a3;
v4 = strlen(a2);
v12 = gnutls_prf_rfc5705(a1, v4, a2, 0LL, 0LL, a3, v14);
if (v12 >= 0) {
v13 = gnutls_hex_encode2(&v14, &v16);
if (v13 >= 0) {
log_msg(stdout, "- Key material: %s\n", v16, v6, v7, v8);
fflush(stdout);
} else {
v9 = (const char *)gnutls_strerror((unsigned int)v13);
fprintf(stderr, "Error in hex encoding: %s\n", v9);
}
} else {
v5 = (const char *)gnutls_strerror((unsigned int)v12);
fprintf(stderr, "Error in gnutls_prf_rfc5705: %s\n", v5);
}
} else {
v3 = (const char *)gnutls_strerror(4294967271LL);
fprintf(stderr, "Error in gnutls_malloc: %s\n", v3);
}
gnutls_free(v14);
v14 = 0LL;
gnutls_free(v16);
return __readfsqword(0x28u) ^ v18;
} | gnutls | ida |
static const char *mode_to_filetype(mode_t m) {
if (m == 0100000) {
return "f";
};
if (m == 0040000) {
return "d";
};
if (m == 0120000) {
return "l";
};
if (m == 0140000) {
return "s";
};
if (m == 0060000) {
return "b";
};
if (m == 0020000) {
return "c";
};
if (m == 0010000) {
return "p";
};
return "U";
} | int mode_to_filetype(unsigned long a0) {
unsigned int v1;
if (a0 == 0x8000) {
v1 = &g_403603;
} else if (a0 == 0x4000) {
v1 = &g_403605;
} else if (a0 == 0xa000) {
v1 = &g_403607;
} else if (a0 == 0xc000) {
v1 = &g_403609;
} else if (a0 == 0x6000) {
v1 = &g_40360b;
} else if (a0 == 0x2000) {
v1 = &g_40360d;
} else if (a0 == 0x1000) {
v1 = &g_40360f;
} else {
v1 = &g_403611;
}
return v1;
} | findutils | angr_phoenix |
static inline __u64 rta_getattr_u64(const struct rtattr *rta) {
__u64 tmp;
memcpy(&tmp,
((void *)(((char *)(rta)) +
((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0)))),
sizeof(__u64));
return tmp;
} | int rta_getattr_u64(unsigned long a0) {
char v0;
memcpy(&v0, a0 + 4, 0x8);
return *(&v0);
} | iproute2-6.0.0 | angr_phoenix |
static _Bool
sparse_scan_file_wholesparse(struct tar_sparse_file *file) {
struct tar_stat_info *st = file->stat_info;
struct sp_array sp = {0, 0};
if (((st->stat).st_blocks) == 0) {
st->archive_file_size = 0;
sp.offset = st->stat.st_size;
sparse_add_map(st, &sp);
return 1;
}
return 0;
} | bool sparse_scan_file_wholesparse(long param_1)
{
long lVar1;
long in_FS_OFFSET;
bool bVar2;
undefined8 local_28;
undefined8 local_20;
long local_10;
local_10 = *(long *)(in_FS_OFFSET + 0x28);
lVar1 = *(long *)(param_1 + 0x18);
local_28 = 0;
local_20 = 0;
bVar2 = *(long *)(lVar1 + 0x98) == 0;
if (bVar2) {
*(undefined8 *)(lVar1 + 0x118) = 0;
local_28 = *(undefined8 *)(lVar1 + 0x88);
sparse_add_map(lVar1, &local_28);
}
if (local_10 == *(long *)(in_FS_OFFSET + 0x28)) {
return bVar2;
}
__stack_chk_fail();
} | tar | ghidra |
void sys_wait_for_child(pid_t child_pid, _Bool eof) {
if (child_pid) {
int wait_status;
while (waitpid(child_pid, &wait_status, 0) == -1)
if ((*__errno_location()) != 4) {
waitpid_error(use_compress_program_option);
break;
}
if ((((signed char)(((wait_status) & 0x7f) + 1) >> 1) > 0)) {
int sig = ((wait_status) & 0x7f);
if (!(!eof && sig == 13))
do {
if (error_hook)
error_hook();
error(0, 0, gettext("Child died with signal %d"), sig);
fatal_exit();
} while (0);
} else if ((((wait_status) & 0xff00) >> 8) != 0)
do {
if (error_hook)
error_hook();
error(0, 0, gettext("Child returned status %d"),
(((wait_status) & 0xff00) >> 8));
fatal_exit();
} while (0);
}
} | long long sys_wait_for_child(unsigned long a0, unsigned long long a1,
unsigned long long a2, unsigned long a3,
unsigned long long a4, unsigned long long a5) {
char v0;
unsigned int v1;
if (!a0)
return 0;
do {
if (waitpid(a0, &v0, 0x0) != -1)
goto LABEL_40025a;
} while (*(__errno_location()) == 4);
waitpid_error(use_compress_program_option);
LABEL_40025a:
if (((*(&v0) & 127) + 1 >> 1) > 0) {
v1 = *(&v0) & 127;
if (!a1 && v1 == 13)
return 0;
if (error_hook)
*(5243000)();
a1 = 0;
error(0x0, 0x0, gettext("Child died with signal %d"));
fatal_exit(0x0, reg_64, a2, v1, a4, a5);
}
if (!(*(&v0) >> 8))
return 0;
if (error_hook)
*(5243000)();
a1 = 0;
error(0x0, 0x0, gettext("Child returned status %d"));
fatal_exit(0x0, a1, a2, *(&v0) >> 8, a4, a5);
return 0;
} | tar | angr_sailr |
static z_size_t gz_write(state, buf, len)
gz_statep state;
voidpc buf;
z_size_t len;
{
z_size_t put = len;
if (len == 0)
return 0;
if (state->size == 0 && gz_init(state) == -1)
return 0;
if (state->seek) {
state->seek = 0;
if (gz_zero(state, state->skip) == -1)
return 0;
}
if (len < state->size) {
do {
unsigned have, copy;
if (state->strm.avail_in == 0)
state->strm.next_in = state->in;
have =
(unsigned)((state->strm.next_in + state->strm.avail_in) - state->in);
copy = state->size - have;
if (copy > len)
copy = (unsigned)len;
memcpy(state->in + have, buf, copy);
state->strm.avail_in += copy;
state->x.pos += copy;
buf = (const char *)buf + copy;
len -= copy;
if (len && gz_comp(state, 0) == -1)
return 0;
} while (len);
} else {
if (state->strm.avail_in && gz_comp(state, 0) == -1)
return 0;
state->strm.next_in = (Bytef *)buf;
do {
unsigned n = (unsigned)-1;
if (n > len)
n = (unsigned)len;
state->strm.avail_in = n;
state->x.pos += n;
if (gz_comp(state, 0) == -1)
return 0;
len -= n;
} while (len);
}
return put;
} | int gz_write(struct_0 *a0, void *a1, unsigned long a2) {
unsigned long v0;
void *v1;
unsigned int v2;
unsigned int v3;
unsigned int v4;
unsigned long v5;
unsigned int v7;
v1 = a1;
v0 = a2;
v5 = v0;
if (!v0) {
v7 = 0;
return v7;
}
if (!a0->field_28 && gz_init(a0) == -1) {
v7 = 0;
return v7;
}
if (a0->field_70) {
a0->field_70 = 0;
if (gz_zero(a0, a0->field_68) == -1) {
v7 = 0;
return v7;
}
}
if (v0 < a0->field_28) {
do {
if (!a0->field_88)
a0->field_80 = a0->field_30;
v4 = a0->field_80 + a0->field_88 - a0->field_30;
v2 = a0->field_28 - v4;
if (v0 < v2)
v2 = v0;
memcpy(a0->field_30 + v4, v1, v2);
a0->field_88 = a0->field_88 + v2;
a0->field_10 = a0->field_10 + v2;
v1 += v2;
v0 -= v2;
if (v0 && gz_comp(a0, 0x0) == -1) {
v7 = 0;
return v7;
}
} while (v0);
} else {
if (a0->field_88 && gz_comp(a0, 0x0) == -1) {
v7 = 0;
return v7;
}
a0->field_80 = v1;
do {
v3 = -1;
if (v0 < v3)
v3 = v0;
a0->field_88 = v3;
a0->field_10 = a0->field_10 + v3;
if (gz_comp(a0, 0x0) == -1) {
v7 = 0;
return v7;
}
v0 -= v3;
} while (v0);
}
v7 = v5;
return v7;
} | zlib | angr_sailr |
static void del_keys_by_name(char *name) {
struct pkcs11_keyinfo *ki, *nxt;
for (ki = ((&pkcs11_keylist)->tqh_first); ki; ki = nxt) {
nxt = ((ki)->next.tqe_next);
if (!strcmp(ki->providername, name)) {
do {
if (((ki)->next.tqe_next) != ((void *)0))
(ki)->next.tqe_next->next.tqe_prev = (ki)->next.tqe_prev;
else
(&pkcs11_keylist)->tqh_last = (ki)->next.tqe_prev;
*(ki)->next.tqe_prev = (ki)->next.tqe_next;
;
;
} while (0);
free(ki->providername);
free(ki->label);
sshkey_free(ki->key);
free(ki);
}
}
} | void del_keys_by_name(char *a0) {
unsigned long long v0;
unsigned long long v1;
unsigned long long v3;
unsigned long long v4;
v3 = 15588516631309289800;
for (v0 = 15588516631309289800; v0; v0 = v1) {
v1 = *((v0 + 24));
if (!strcmp(*((v0 + 8)), a0)) {
if (*((v0 + 24)))
*((*((v0 + 24)) + 32)) = *((v0 + 32));
else
g_400018 = *((v0 + 32));
*(*((v0 + 32))) = *((v0 + 24));
free(*((v0 + 8)));
free(*((v0 + 16)));
sshkey_free(*(v0));
free(v0);
}
v4 = v1;
}
return;
} | openssh-portable | angr_sailr |
static Keymap get_cmd_xmap_from_keymap(kmap)
Keymap kmap;
{
if (emacs_std_cmd_xmap == 0)
init_unix_command_map();
if (kmap == emacs_standard_keymap)
return emacs_std_cmd_xmap;
else if (kmap == emacs_meta_keymap)
return ((Keymap)(emacs_std_cmd_xmap[(('[') & 0x1f)].function));
else if (kmap == emacs_ctlx_keymap)
return ((Keymap)(emacs_std_cmd_xmap[(('X') & 0x1f)].function));
else if (kmap == vi_insertion_keymap)
return vi_insert_cmd_xmap;
else if (kmap == vi_movement_keymap)
return vi_movement_cmd_xmap;
else
return (Keymap)((void *)0);
} | int get_cmd_xmap_from_keymap(unsigned long a0) {
unsigned int v1;
if (!emacs_std_cmd_xmap)
init_unix_command_map();
if (a0 == 5244816) {
v1 = emacs_std_cmd_xmap;
} else if (a0 == 5243128) {
v1 = *((emacs_std_cmd_xmap + 440));
} else if (a0 == 5243064) {
v1 = *((emacs_std_cmd_xmap + 392));
} else if (a0 == 5242896) {
v1 = vi_insert_cmd_xmap;
} else if (a0 == 5243160) {
v1 = vi_movement_cmd_xmap;
} else {
v1 = 0;
}
return v1;
} | bash | angr_dream |
static int globextend(const Char *path, _ssh_compat_glob_t *pglob,
struct glob_lim *limitp, struct stat *sb) {
char **pathv;
size_t i, newn, len;
char *copy = ((void *)0);
const Char *p;
struct stat **statv;
newn = 2 + pglob->gl_pathc + pglob->gl_offs;
if (pglob->gl_offs >= 0x7fffffffffffffffL ||
pglob->gl_pathc >= 0x7fffffffffffffffL || newn >= 0x7fffffffffffffffL ||
(18446744073709551615UL) / sizeof(*pathv) <= newn ||
(18446744073709551615UL) / sizeof(*statv) <= newn) {
nospace:
for (i = pglob->gl_offs; i < newn - 2; i++) {
if (pglob->gl_pathv && pglob->gl_pathv[i])
free(pglob->gl_pathv[i]);
if ((pglob->gl_flags & 0x4000) != 0 && pglob->gl_pathv &&
pglob->gl_pathv[i])
free(pglob->gl_statv[i]);
}
free(pglob->gl_pathv);
pglob->gl_pathv = ((void *)0);
free(pglob->gl_statv);
pglob->gl_statv = ((void *)0);
return ((-1));
}
pathv = reallocarray(pglob->gl_pathv, newn, sizeof(*pathv));
if (pathv == ((void *)0))
goto nospace;
if (pglob->gl_pathv == ((void *)0) && pglob->gl_offs > 0) {
pathv += pglob->gl_offs;
for (i = pglob->gl_offs; i > 0; i--)
*--pathv = ((void *)0);
}
pglob->gl_pathv = pathv;
if ((pglob->gl_flags & 0x4000) != 0) {
statv = reallocarray(pglob->gl_statv, newn, sizeof(*statv));
if (statv == ((void *)0))
goto nospace;
if (pglob->gl_statv == ((void *)0) && pglob->gl_offs > 0) {
statv += pglob->gl_offs;
for (i = pglob->gl_offs; i > 0; i--)
*--statv = ((void *)0);
}
pglob->gl_statv = statv;
if (sb == ((void *)0))
statv[pglob->gl_offs + pglob->gl_pathc] = ((void *)0);
else {
limitp->glim_malloc += sizeof(**statv);
if ((pglob->gl_flags & 0x2000) && limitp->glim_malloc >= 65536) {
(*__errno_location()) = 0;
return ((-1));
}
if ((statv[pglob->gl_offs + pglob->gl_pathc] = malloc(sizeof(**statv))) ==
((void *)0))
goto copy_error;
memcpy(statv[pglob->gl_offs + pglob->gl_pathc], sb, sizeof(*sb));
}
statv[pglob->gl_offs + pglob->gl_pathc + 1] = ((void *)0);
}
for (p = path; *p++;)
;
len = (size_t)(p - path);
limitp->glim_malloc += len;
if ((copy = malloc(len)) != ((void *)0)) {
if (g_Ctoc(path, copy, len)) {
free(copy);
return ((-1));
}
pathv[pglob->gl_offs + pglob->gl_pathc++] = copy;
}
pathv[pglob->gl_offs + pglob->gl_pathc] = ((void *)0);
if ((pglob->gl_flags & 0x2000) &&
(newn * sizeof(*pathv)) + limitp->glim_malloc > 65536) {
(*__errno_location()) = 0;
return ((-1));
}
copy_error:
return (copy == ((void *)0) ? (-1) : 0);
} | void globextend(unsigned long long a0, unsigned long a1, unsigned long long *a2,
void *a3) {
unsigned long long *v0;
int tmp_9;
int tmp_26;
struct_0 *v1;
unsigned long long *v2;
unsigned long long *v3;
void *v4;
unsigned short *v5;
unsigned long long *v6;
unsigned int v7;
unsigned long long v8;
unsigned long long v10;
unsigned long long *v11;
unsigned long long v12;
unsigned short v13;
unsigned long long v14;
unsigned long long v15;
unsigned long long v16;
unsigned long long v17;
void *v18;
v1 = a1;
v0 = a2;
v4 = 0;
*(&v7) = v1->field_10 + v1->field_0 + 2;
if (v1->field_10 > 9223372036854775806) {
LABEL_401cff:
goto LABEL_401d06;
} else {
if (!(v1->field_0 <= 9223372036854775806))
goto LABEL_401cff;
if (!(*(&v7) <= 9223372036854775806))
goto LABEL_401cff;
if (!(*(&v7) <= 2305843009213693950))
goto LABEL_401cff;
if (!(*(&v7) <= 2305843009213693950))
goto LABEL_401cff;
v2 = reallocarray(v1->field_20, *(&v7), 0x8);
if (!v2) {
LABEL_401d06:
for (v3 = v1->field_10; v3 < *(&v7) - 2; v3 = v3 + 1) {
if (v1->field_20 && *((v1->field_20 + (v3 << 3))))
free(*((v1->field_20 + v3 * 8)));
if ((v1->field_18 & 0x4000) && v1->field_20 &&
*((v1->field_20 + (v3 << 3))))
free(*((v1->field_28 + v3 * 8)));
}
free(v1->field_20);
v1->field_20 = 0;
free(v1->field_28);
v1->field_28 = 0;
v10 = 4294967295;
} else {
if (!v1->field_20 && v1->field_10) {
v2 = &v2[v1->field_10];
for (v3 = v1->field_10; v3; v3 -= 1) {
v2 += 1;
*(v2) = 0;
}
}
v1->field_20 = v2;
if (!(v1->field_18 & 0x4000)) {
LABEL_402052:
v5 = a0;
do {
tmp_9 = v5;
v5 += 1;
v13 = *(tmp_9);
} while (v13);
v8 = __subvdi3(v5, a0) >> 1;
*(a2) = *(a2) + v8;
v4 = malloc(v8);
if (v4) {
if (!g_Ctoc(a0, v4, v8)) {
v14 = v1->field_10;
tmp_26 = v1->field_0;
v1->field_0 = v1->field_0 + 1;
v2[v14 + tmp_26] = v4;
} else {
free(v4);
v15 = 4294967295;
goto LABEL_402192;
}
}
v2[v1->field_10 + v1->field_0] = 0;
if ((v1->field_18 & 0x2000) && *(a2) + (*(&v7) << 3) > 0x10000) {
*(__errno_location()) = 0;
v16 = 4294967295;
goto LABEL_402192;
}
if (!v4)
v17 = 4294967295;
else
v18 = 0;
} else {
v6 = reallocarray(v1->field_28, *(&v7), 0x8);
if (v6) {
if (!v1->field_28 && v1->field_10) {
v6 = &v6[v1->field_10];
for (v3 = v1->field_10; v3; v3 -= 1) {
v6 += 1;
*(v6) = 0;
}
}
v1->field_28 = v6;
if (!a3) {
v6[v1->field_10 + v1->field_0] = 0;
} else {
*(a2) = *(a2) + 144;
if ((v1->field_18 & 0x2000) && *(a2) > 65535) {
*(__errno_location()) = 0;
v12 = 4294967295;
goto LABEL_402192;
}
v11 = &v6[v1->field_10 + v1->field_0];
v6[v1->field_10 + v1->field_0] = malloc(0x90);
memcpy(v6[v1->field_10 + v1->field_0], a3, 0x90);
}
v6[1 + v1->field_10 + v1->field_0] = 0;
goto LABEL_402052;
}
}
}
}
LABEL_402192:
return;
} | openssh-portable | angr_phoenix |
void deppossi_pkg_iter_free(struct deppossi_pkg_iterator *iter) { free(iter); } | void deppossi_pkg_iter_free(void *a0) {
unsigned long long v1;
v1 = free(a0);
return;
} | dpkg | angr_phoenix |
static void revoked_certs_free(struct revoked_certs *rc) {
struct revoked_serial *rs, *trs;
struct revoked_key_id *rki, *trki;
for ((rs) = revoked_serial_tree_RB_MINMAX(&rc->revoked_serials, -1);
((rs) != ((void *)0)) && ((trs) = revoked_serial_tree_RB_NEXT(rs), 1);
(rs) = (trs)) {
revoked_serial_tree_RB_REMOVE(&rc->revoked_serials, rs);
free(rs);
}
for ((rki) = revoked_key_id_tree_RB_MINMAX(&rc->revoked_key_ids, -1);
((rki) != ((void *)0)) && ((trki) = revoked_key_id_tree_RB_NEXT(rki), 1);
(rki) = (trki)) {
revoked_key_id_tree_RB_REMOVE(&rc->revoked_key_ids, rki);
free(rki->key_id);
free(rki);
}
sshkey_free(rc->ca_key);
} | void revoked_certs_free(unsigned long long *a0) {
unsigned long v0;
unsigned long long *v1;
unsigned long v2;
unsigned long v3;
unsigned long long v5;
for (v0 = revoked_serial_tree_RB_MINMAX(a0 + 1, 0xffffffff); v0; v0 = v3) {
v3 = revoked_serial_tree_RB_NEXT(v0);
revoked_serial_tree_RB_REMOVE(a0 + 1, v0);
free(v0);
}
for (v1 = revoked_key_id_tree_RB_MINMAX(a0 + 2, 0xffffffff); v1; v1 = v2) {
v2 = revoked_key_id_tree_RB_NEXT(v1);
revoked_key_id_tree_RB_REMOVE(a0 + 2, v1);
free(*(v1));
free(v1);
}
v5 = sshkey_free(*(a0));
return;
} | openssh-portable | angr_sailr |
static __attribute__((unused)) inline int
ERR_GET_REASON(unsigned long errcode) {
if ((((errcode) & ((unsigned int)0x7fffffff + 1)) != 0))
return errcode & ((unsigned int)0x7fffffff);
return errcode & 0X7FFFFF;
} | int ERR_GET_REASON(unsigned long a0) {
unsigned int v1;
if ((a0 & 0x80000000))
v1 = a0 & 2147483647;
else
v1 = a0 & 8388607;
return v1;
} | openssh-portable | angr_phoenix |
SHELL_VAR *assign_array_element(name, value, flags, estatep)
char *name, *value;
int flags;
array_eltstate_t *estatep;
{
char *sub, *vname;
int sublen, isassoc, avflags;
SHELL_VAR *entry;
avflags = 0;
if (flags & 0x0080)
avflags |= 0x020;
if (flags & 0x1000)
avflags |= 0x040;
vname = array_variable_name(name, avflags, &sub, &sublen);
if (vname == 0)
return ((SHELL_VAR *)((void *)0));
entry = find_variable(vname);
isassoc = entry && ((((entry)->attributes) & (0x0000040)));
if (((isassoc == 0 || (flags & (0x0080 | 0x0800)) == 0) &&
(((sub[0]) == '@' || (sub[0]) == '*') && sub[1] == ']')) ||
(sublen <= 1) || (sub[sublen] != '\0')) {
sh_xfree((vname), "arrayfunc.c", 375);
err_badarraysub(name);
return ((SHELL_VAR *)((void *)0));
}
entry = assign_array_element_internal(entry, name, vname, sub, sublen, value,
flags, estatep);
sh_xfree((vname), "arrayfunc.c", 390);
return entry;
} | long assign_array_element(undefined8 param_1, undefined8 param_2, uint param_3,
undefined8 param_4, undefined8 param_5,
undefined8 param_6)
{
long lVar1;
long in_FS_OFFSET;
int local_34;
uint local_30;
int local_2c;
char *local_28;
long local_20;
long local_18;
long local_10;
local_10 = *(long *)(in_FS_OFFSET + 0x28);
local_30 = 0;
if ((param_3 & 0x80) != 0) {
local_30 = 0x20;
}
if ((param_3 & 0x1000) != 0) {
local_30 = local_30 | 0x40;
}
local_20 = array_variable_name(param_1, local_30, &local_28, &local_34,
param_5, param_6, param_4);
if (local_20 == 0) {
lVar1 = 0;
} else {
local_18 = find_variable();
if ((local_18 == 0) || ((*(uint *)(local_18 + 0x28) & 0x40) == 0)) {
local_2c = 0;
} else {
local_2c = 1;
}
if (((((local_2c == 0) || ((param_3 & 0x880) == 0)) &&
((*local_28 == '@' || (*local_28 == '*')))) &&
(local_28[1] == ']')) ||
((local_34 < 2 || (local_28[local_34] != '\0')))) {
sh_xfree(local_20, "arrayfunc.c", 0x177);
err_badarraysub(param_1);
lVar1 = 0;
} else {
local_18 =
assign_array_element_internal(local_18, param_1, local_20, local_28,
local_34, param_2, param_3, param_4);
sh_xfree(local_20, "arrayfunc.c", 0x186);
lVar1 = local_18;
}
}
if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) {
__stack_chk_fail();
}
return lVar1;
} | bash | ghidra |
static char *unescape(char *c) {
int i, l;
l = strlen(c);
i = 0;
while (i < l && c[i]) {
if (c[i] == '\a') {
if (c[i + 1])
memmove(c + i, c + i + 1, l - i);
else {
c[i] = '\0';
break;
}
}
i++;
}
return c;
} | const char *unescape(const char *a1) {
int i;
int v3;
v3 = strlen(a1);
for (i = 0; i < v3 && a1[i]; ++i) {
if (a1[i] == 7) {
if (!a1[i + 1]) {
a1[i] = 0;
return a1;
}
memmove((void *)&a1[i], &a1[i + 1], v3 - i);
}
}
return a1;
} | bash | ida |
static _Bool
parse_regex(const struct parser_table *entry, char **argv, int *arg_ptr) {
return insert_regex(argv, arg_ptr, entry, options.regex_options);
} | void parse_regex(undefined8 param_1, undefined8 param_2, undefined8 param_3)
{
insert_regex(param_2, param_3, param_1, DAT_0010923c);
return;
} | findutils | ghidra |
static void linkpath_decoder(struct tar_stat_info *st,
char const *keyword __attribute__((unused)),
char const *arg,
size_t size __attribute__((unused))) {
decode_string(&st->link_name, arg);
} | void linkpath_decoder(long param_1, undefined8 param_2, undefined8 param_3)
{
decode_string(param_1 + 0x18, param_3);
return;
} | tar | ghidra |
static _Bool
parse_ilname(const struct parser_table *entry, char **argv, int *arg_ptr) {
const char *name;
if (collect_arg(argv, arg_ptr, &name)) {
struct predicate *our_pred = insert_primary(entry, name);
our_pred->args.str = name;
our_pred->est_success_rate = 0.1f * estimate_pattern_match_rate(name, 0);
return 1;
} else {
return 0;
}
} | long long parse_ilname(unsigned long long a0, unsigned long long a1,
unsigned long long a2) {
char v0;
struct_0 *v1;
unsigned long long v3;
unsigned int v4;
if (!collect_arg(a1, a2, &v0)) {
v3 = 0;
return v3;
}
v1 = insert_primary(a0, *(&v0), *(&v0));
v1->field_38 = *(&v0);
estimate_pattern_match_rate(*(&v0), 0x0);
v1->field_24 = v4 * 4333543705447025869;
v3 = 1;
return v3;
} | findutils | angr_sailr |
int deflateInit2_(strm, level, method, windowBits, memLevel, strategy, version,
stream_size)
z_streamp strm;
int level;
int method;
int windowBits;
int memLevel;
int strategy;
const char *version;
int stream_size;
{
deflate_state *s;
int wrap = 1;
static const char my_version[] = "1.2.13";
if (version == 0 || version[0] != my_version[0] ||
stream_size != 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;
if (level == (-1))
level = 6;
if (windowBits < 0) {
wrap = 0;
if (windowBits < -15)
return (-2);
windowBits = -windowBits;
}
else if (windowBits > 15) {
wrap = 2;
windowBits -= 16;
}
if (memLevel < 1 || memLevel > 9 || method != 8 || windowBits < 8 ||
windowBits > 15 || level < 0 || level > 9 || strategy < 0 ||
strategy > 4 || (windowBits == 8 && wrap != 1)) {
return (-2);
}
if (windowBits == 8)
windowBits = 9;
s = (deflate_state *)(*((strm)->zalloc))((strm)->opaque, (1),
(sizeof(deflate_state)));
if (s == 0)
return (-4);
strm->state = (struct internal_state *)s;
s->strm = strm;
s->status = 42;
s->wrap = wrap;
s->gzhead = 0;
s->w_bits = (uInt)windowBits;
s->w_size = 1 << s->w_bits;
s->w_mask = s->w_size - 1;
s->hash_bits = (uInt)memLevel + 7;
s->hash_size = 1 << s->hash_bits;
s->hash_mask = s->hash_size - 1;
s->hash_shift = ((s->hash_bits + 3 - 1) / 3);
s->window = (Bytef *)(*((strm)->zalloc))((strm)->opaque, (s->w_size),
(2 * sizeof(Byte)));
s->prev =
(Posf *)(*((strm)->zalloc))((strm)->opaque, (s->w_size), (sizeof(Pos)));
s->head = (Posf *)(*((strm)->zalloc))((strm)->opaque, (s->hash_size),
(sizeof(Pos)));
s->high_water = 0;
s->lit_bufsize = 1 << (memLevel + 6);
s->pending_buf =
(uchf *)(*((strm)->zalloc))((strm)->opaque, (s->lit_bufsize), (4));
s->pending_buf_size = (ulg)s->lit_bufsize * 4;
if (s->window == 0 || s->prev == 0 || s->head == 0 || s->pending_buf == 0) {
s->status = 666;
strm->msg = z_errmsg[2 - ((-4))];
deflateEnd(strm);
return (-4);
}
s->sym_buf = s->pending_buf + s->lit_bufsize;
s->sym_end = (s->lit_bufsize - 1) * 3;
s->level = level;
s->strategy = strategy;
s->method = (Byte)method;
return deflateReset(strm);
} | void deflateInit2_(unsigned long long a0[11], unsigned long a1,
unsigned long a2, unsigned long a3, unsigned long a4,
unsigned long a5, char *v4, unsigned int a6) {
unsigned int v0;
unsigned int v1;
unsigned int v2;
struct_0 *v3;
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;
v1 = a1;
v0 = a3;
v2 = 1;
if (!v4) {
LABEL_40015e:
v5 = 4294967290;
} else {
if (!(*(v4) == my_version.3358))
goto LABEL_40015e;
if (!(a6 == 112))
goto LABEL_40015e;
if (!a0) {
v6 = 4294967294;
} else {
a0[6] = 0;
if (!a0[8]) {
a0[8] = &zcalloc;
a0[10] = 0;
}
if (!a0[9])
a0[9] = &zcfree;
if (v1 == -1)
v1 = 6;
if (v0 < 0) {
v2 = 0;
if (v0 < -15) {
v7 = 4294967294;
goto LABEL_400546;
} else {
v0 = -(v0);
}
} else if (v0 > 15) {
v2 = 2;
v0 -= 16;
}
if (a4 <= 0) {
LABEL_40024b:
v8 = 4294967294;
} else {
if (!(a4 <= 9))
goto LABEL_40024b;
if (!(a2 == 8))
goto LABEL_40024b;
if (v0 <= 7)
goto LABEL_40024b;
if (!(v0 <= 15))
goto LABEL_40024b;
if (v1 < 0)
goto LABEL_40024b;
if (!(v1 <= 9))
goto LABEL_40024b;
if (a5 < 0)
goto LABEL_40024b;
if (!(a5 <= 4))
goto LABEL_40024b;
if (v0 != 8) {
LABEL_400255:
if (v0 == 8)
v0 = 9;
v3 = a0[8](a0[10], 1, 5952, a0[8]);
if (!v3) {
v9 = 0xfffffffc;
} else {
a0[7] = v3;
v3->field_0 = a0;
v3->field_8 = 42;
v3->field_30 = v2;
v3->field_38 = 0;
v3->field_54 = v0;
v3->field_50 = 1 << (v3->field_54 & 31);
v3->field_58 = v3->field_50 - 1;
v3->field_88 = a4 + 7;
v3->field_84 = 1 << (v3->field_88 & 31);
v3->field_8c = v3->field_84 - 1;
v3->field_90 = (v3->field_88 + 2) * 2863311531 >> 33;
v3->field_60 = a0[8](a0[10], v3->field_50, 2, v3->field_50, a0[8]);
v10 = v3->field_50;
v11 = v3->field_50;
v3->field_70 = a0[8](a0[10], v3->field_50, 2, v3->field_50, a0[8]);
v3->field_78 = a0[8](a0[10], v3->field_84, 2, v3->field_84, a0[8]);
v3->field_1738 = 0;
v3->field_1708 = 1 << (a4 + 6 & 31);
v3->field_10 =
a0[8](a0[10], v3->field_1708, 4, v3->field_1708, a0[8]);
v3->field_18 = v3->field_1708 * 4;
if (!v3->field_60) {
LABEL_4004a8:
v3->field_8 = 666;
a0[6] = _tr_flush_bits;
deflateEnd(a0);
v13 = 0xfffffffc;
} else {
if (!v3->field_70)
goto LABEL_4004a8;
if (!v3->field_78)
goto LABEL_4004a8;
if (!v3->field_10)
goto LABEL_4004a8;
v3->field_1700 = v3->field_10 + v3->field_1708;
v3->field_1710 = v3->field_1708 * 3 - 3;
v3->field_c4 = v1;
v3->field_c8 = a5;
v3->field_48 = a2;
v12 = deflateReset(a0, v11, a2, v10);
}
}
} else {
if (v2 == 1)
goto LABEL_400255;
goto LABEL_40024b;
}
}
}
}
LABEL_400546:
return;
} | zlib | angr_phoenix |
static void process_queued_listen_addrs(ServerOptions *options) {
u_int i;
struct queued_listenaddr *qla;
if (options->num_ports == 0)
options->ports[options->num_ports++] = 22;
if (options->address_family == -1)
options->address_family = 0;
for (i = 0; i < options->num_queued_listens; i++) {
qla = &options->queued_listen_addrs[i];
add_listen_addr(options, qla->addr, qla->rdomain, qla->port);
free(qla->addr);
free(qla->rdomain);
}
free(options->queued_listen_addrs);
options->queued_listen_addrs = ((void *)0);
options->num_queued_listens = 0;
} | void process_queued_listen_addrs(struct_0 *a0) {
struct_0 *v0;
int tmp_10;
unsigned int v1;
struct_2 *v2;
struct_0 *v4;
v0 = a0;
if (!a0->field_0) {
tmp_10 = a0->field_0;
a0->field_0 = a0->field_0 + 1;
*(&a0->padding_4[4 + 4 * tmp_10]) = 22;
}
if (a0->field_424 == -1)
a0->field_424 = 0;
for (v1 = 0; v1 < a0->field_410; v1 += 1) {
v2 = v1 * 24 + a0->field_408;
add_listen_addr(a0, v2->field_0, v2->field_10, v2->field_8);
free(v2->field_0);
free(v2->field_10);
}
free(a0->field_408);
a0->field_408 = 0;
v4 = a0;
a0->field_410 = 0;
return;
} | openssh-portable | angr_phoenix |
SyslogFacility log_facility_number(char *name) {
int i;
if (name != ((void *)0))
for (i = 0; log_facilities[i].name; i++)
if (strcasecmp(log_facilities[i].name, name) == 0)
return log_facilities[i].val;
return SYSLOG_FACILITY_NOT_SET;
} | long log_facility_number(const char *a1) {
int i;
if (a1) {
for (i = 0; (&log_facilities)[2 * i]; ++i) {
if (!strcasecmp((&log_facilities)[2 * i], a1))
return *((unsigned int *)&unk_1228 + 4 * i);
}
}
return 0xFFFFFFFFLL;
} | openssh-portable | ida |
void _rl_add_executing_keyseq(int key) {
do {
if (rl_key_sequence_length + 2 >= _rl_executing_keyseq_size) {
_rl_executing_keyseq_size += 16;
rl_executing_keyseq =
xrealloc(rl_executing_keyseq, _rl_executing_keyseq_size);
}
} while (0);
;
rl_executing_keyseq[rl_key_sequence_length++] = key;
} | long long _rl_add_executing_keyseq(unsigned long a0) {
int tmp_15;
unsigned long long v1;
if (rl_key_sequence_length + 2 >= _rl_executing_keyseq_size) {
_rl_executing_keyseq_size = _rl_executing_keyseq_size + 16;
rl_executing_keyseq =
xrealloc(rl_executing_keyseq, _rl_executing_keyseq_size,
_rl_executing_keyseq_size);
}
tmp_15 = rl_key_sequence_length;
rl_key_sequence_length = rl_key_sequence_length + 1;
v1 = tmp_15 + rl_executing_keyseq;
*((tmp_15 + rl_executing_keyseq)) = a0;
return v1;
} | bash | angr_sailr |
gnutls_datum_t *load_secret_key(int mand, common_info_st *info) {
static char raw_key[64];
size_t raw_key_size = sizeof(raw_key);
static gnutls_datum_t key;
gnutls_datum_t hex_key;
int ret;
if (info->verbose)
fprintf(stderr, "Loading secret key...\n");
if (info->secret_key == ((void *)0)) {
if (mand) {
fprintf(stderr, "missing --secret-key\n");
app_exit(1);
} else
return ((void *)0);
}
hex_key.data = (void *)info->secret_key;
hex_key.size = strlen(info->secret_key);
ret = gnutls_hex_decode(&hex_key, raw_key, &raw_key_size);
if (ret < 0) {
fprintf(stderr, "hex_decode: %s\n", gnutls_strerror(ret));
app_exit(1);
}
key.data = (void *)raw_key;
key.size = raw_key_size;
return &key;
} | long long load_secret_key(unsigned long a0, struct_0 *a1) {
unsigned int v0;
unsigned long long v1;
unsigned long v2;
unsigned int v3;
unsigned long long v5;
v1 = 64;
if (a1->field_c4)
fprintf(stderr, "Loading secret key...\n");
if (!a1->field_0) {
if (a0) {
fprintf(stderr, "missing --secret-key\n");
app_exit(0x1);
}
v5 = 0;
} else {
v2 = a1->field_0;
v3 = strlen(a1->field_0);
v0 = gnutls_hex_decode(&v2, &raw_key.12448, &v1);
if (v0 < 0) {
fprintf(stderr, "hex_decode: %s\n", gnutls_strerror(v0));
app_exit(0x1);
}
key.12450 = &raw_key.12448;
g_4044c8 = v1;
v5 = &key.12450;
}
return v5;
} | gnutls | angr_dream |
static int check_directory(e2fsck_t ctx, ext2_ino_t dir,
struct problem_context *pctx) {
ext2_filsys fs = ctx->fs;
ext2_ino_t ino = dir, parent;
int loop_pass = 0, parent_count = 0;
while (1) {
if (ext2fs_mark_inode_bitmap2(inode_done_map, ino))
break;
if (e2fsck_dir_info_get_parent(ctx, ino, &parent)) {
fix_problem(ctx, 0x030016, pctx);
return 0;
}
if (!parent ||
(loop_pass && (ext2fs_test_inode_bitmap2(inode_loop_detect, parent)))) {
pctx->ino = ino;
if (fix_problem(ctx, 0x030003, pctx)) {
if (e2fsck_reconnect_file(ctx, pctx->ino))
ext2fs_unmark_valid(fs);
else {
fix_dotdot(ctx, pctx->ino, ctx->lost_and_found);
parent = ctx->lost_and_found;
}
}
break;
}
ino = parent;
if (loop_pass) {
ext2fs_mark_inode_bitmap2(inode_loop_detect, ino);
} else if (parent_count++ > 2048) {
loop_pass = 1;
if (inode_loop_detect)
ext2fs_clear_inode_bitmap(inode_loop_detect);
else {
pctx->errcode = e2fsck_allocate_inode_bitmap(
fs, (gettext("inode loop detection bitmap")), 3,
"inode_loop_detect", &inode_loop_detect);
if (pctx->errcode) {
pctx->num = 1;
fix_problem(ctx, 0x030011, pctx);
ctx->flags |= 0x0001;
return -1;
}
}
ino = dir;
}
}
pctx->ino = dir;
if (e2fsck_dir_info_get_dotdot(ctx, dir, &pctx->ino2) ||
e2fsck_dir_info_get_parent(ctx, dir, &pctx->dir)) {
fix_problem(ctx, 0x030016, pctx);
return 0;
}
if (pctx->ino2 != pctx->dir) {
if (fix_problem(ctx, 0x030005, pctx))
fix_dotdot(ctx, dir, pctx->dir);
}
return 0;
} | undefined8 check_directory(undefined8 *param_1, int param_2, long *param_3)
{
int iVar1;
bool bVar2;
int iVar3;
undefined8 uVar4;
long lVar5;
long in_FS_OFFSET;
int local_28;
int local_24;
int local_20;
int local_1c;
undefined8 local_18;
long local_10;
local_10 = *(long *)(in_FS_OFFSET + 0x28);
local_18 = *param_1;
local_20 = 0;
local_1c = 0;
iVar3 = param_2;
LAB_00100aaf:
do {
local_24 = iVar3;
iVar3 = ext2fs_mark_inode_bitmap2(inode_done_map, local_24);
if (iVar3 != 0) {
LAB_00100c9d:
*(int *)(param_3 + 1) = param_2;
iVar3 = e2fsck_dir_info_get_dotdot(param_1, param_2, (long)param_3 + 0xc);
if ((iVar3 == 0) &&
(iVar3 = e2fsck_dir_info_get_parent(param_1, param_2, param_3 + 2),
iVar3 == 0)) {
if ((*(int *)((long)param_3 + 0xc) != *(int *)(param_3 + 2)) &&
(iVar3 = fix_problem(param_1, 0x30005, param_3), iVar3 != 0)) {
fix_dotdot(param_1, param_2, *(undefined4 *)(param_3 + 2));
}
uVar4 = 0;
} else {
fix_problem(param_1, 0x30016, param_3);
uVar4 = 0;
}
goto LAB_00100d45;
}
iVar3 = e2fsck_dir_info_get_parent(param_1, local_24, &local_28);
if (iVar3 != 0) {
fix_problem(param_1, 0x30016, param_3);
uVar4 = 0;
goto LAB_00100d45;
}
if ((local_28 == 0) ||
((local_20 != 0 &&
(iVar3 = ext2fs_test_inode_bitmap2(inode_loop_detect),
iVar3 != 0)))) {
*(int *)(param_3 + 1) = local_24;
iVar3 = fix_problem(param_1, 0x30003, param_3);
if (iVar3 != 0) {
iVar3 = e2fsck_reconnect_file(param_1, *(undefined4 *)(param_3 + 1));
if (iVar3 == 0) {
fix_dotdot(param_1, *(undefined4 *)(param_3 + 1),
*(undefined4 *)(param_1 + 0x45));
local_28 = *(int *)(param_1 + 0x45);
} else {
ext2fs_unmark_valid(local_18);
}
}
goto LAB_00100c9d;
}
local_24 = local_28;
if (local_20 == 0)
break;
ext2fs_mark_inode_bitmap2(inode_loop_detect, local_28);
iVar3 = local_24;
} while (true);
iVar1 = local_1c + 1;
bVar2 = 0x800 < local_1c;
iVar3 = local_24;
local_1c = iVar1;
if (bVar2) {
local_20 = 1;
if (inode_loop_detect == 0) {
uVar4 = gettext("inode loop detection bitmap");
lVar5 = e2fsck_allocate_inode_bitmap(
local_18, uVar4, 3, "inode_loop_detect", &inode_loop_detect);
*param_3 = lVar5;
iVar3 = param_2;
if (*param_3 != 0) {
param_3[10] = 1;
fix_problem(param_1, 0x30011, param_3);
*(uint *)(param_1 + 9) = *(uint *)(param_1 + 9) | 1;
uVar4 = 0xffffffff;
LAB_00100d45:
if (local_10 == *(long *)(in_FS_OFFSET + 0x28)) {
return uVar4;
}
__stack_chk_fail();
}
} else {
ext2fs_clear_inode_bitmap(inode_loop_detect);
iVar3 = param_2;
}
}
goto LAB_00100aaf;
} | e2fsprogs-1.46.5 | ghidra |
static void history_def_clear(void *p, HistEventW *ev) {
history_t *h = (history_t *)p;
while (h->list.prev != &h->list)
history_def_delete(h, ev, h->list.prev);
h->cursor = &h->list;
h->eventid = 0;
h->cur = 0;
} | void history_def_clear(struct_0 *a0, unsigned int a1) {
struct_0 *v1;
while (a0->field_20 != a0) {
history_def_delete(a0, a1, a0->field_20);
}
a0->field_28 = a0;
a0->field_38 = 0;
v1 = a0;
a0->field_34 = 0;
return;
} | libedit | angr_sailr |
static int execute_in_subshell(command, asynchronous, pipe_in, pipe_out,
fds_to_close)
COMMAND *command;
int asynchronous;
int pipe_in, pipe_out;
struct fd_bitmap *fds_to_close;
{
volatile int user_subshell, user_coproc, invert;
int return_code, function_value, should_redir_stdin, ois, result;
volatile COMMAND *tcom;
((void)&(user_subshell));
((void)&(user_coproc));
((void)&(invert));
((void)&(tcom));
((void)&(asynchronous));
subshell_level++;
should_redir_stdin =
(asynchronous && (command->flags & 0x400) && pipe_in == -1 &&
stdin_redirects(command->redirects) == 0);
invert = (command->flags & 0x04) != 0;
user_subshell =
command->type == cm_subshell || ((command->flags & 0x01) != 0);
user_coproc = command->type == cm_coproc;
command->flags &= ~(0x02 | 0x01 | 0x04);
if (asynchronous) {
original_pgrp = -1;
ois = interactive_shell;
interactive_shell = 0;
if (ois != interactive_shell)
expand_aliases = 0;
}
login_shell = interactive = 0;
if (shell_compatibility_level > 44)
loop_level = 0;
if (user_subshell) {
subshell_environment = 0x02;
if (asynchronous)
subshell_environment |= 0x01;
} else {
subshell_environment = 0;
if (asynchronous)
subshell_environment |= 0x01;
if (pipe_in != -1 || pipe_out != -1)
subshell_environment |= 0x10;
if (user_coproc)
subshell_environment |= 0x40;
}
do {
if (terminating_signal)
termsig_handler(terminating_signal);
if (interrupt_state)
throw_to_top_level();
} while (0);
do {
if (terminating_signal)
termsig_handler(terminating_signal);
} while (0);
reset_terminating_signals();
clear_pending_traps();
reset_signal_handlers();
subshell_environment |= 0x80;
subshell_environment &= ~0x100;
if (running_trap > 0) {
run_trap_cleanup(running_trap - 1);
running_trap = 0;
}
if (asynchronous) {
setup_async_signals();
asynchronous = 0;
} else
set_sigint_handler();
set_sigchld_handler();
without_job_control();
if (fds_to_close)
close_fd_bitmap(fds_to_close);
do_piping(pipe_in, pipe_out);
coproc_closeall();
clear_fifo_list();
if (user_subshell) {
stdin_redir = stdin_redirects(command->redirects) || pipe_in != -1;
} else if (shell_control_structure(command->type) && pipe_in != -1)
stdin_redir = 1;
if (should_redir_stdin && stdin_redir == 0)
async_redirect_stdin();
default_buffered_input = -1;
if (user_subshell && command->type == cm_subshell)
optimize_subshell_command(command->value.Subshell->command);
if (command->redirects) {
if (do_redirections(command->redirects, 0x01) != 0)
exit(invert ? 0 : 1);
dispose_redirects(command->redirects);
command->redirects = (REDIRECT *)((void *)0);
}
if (command->type == cm_subshell)
tcom = command->value.Subshell->command;
else if (user_coproc)
tcom = command->value.Coproc->command;
else
tcom = command;
if (command->flags & 0x80)
tcom->flags |= 0x80;
if (command->flags & 0x100)
tcom->flags |= 0x100;
if ((command->flags & 0x08) && tcom != command)
tcom->flags |= 0x08;
if ((user_subshell || user_coproc) &&
(tcom->type == cm_simple || tcom->type == cm_subshell) &&
((tcom->flags & 0x80) == 0) && ((tcom->flags & 0x04) == 0)) {
tcom->flags |= 0x40;
if (tcom->type == cm_simple)
tcom->value.Simple->flags |= 0x40;
}
invert = (tcom->flags & 0x04) != 0;
tcom->flags &= ~0x04;
result = __sigsetjmp((top_level), 0);
function_value = 0;
if (return_catch_flag)
function_value = __sigsetjmp((return_catch), 0);
if (result == 3 || result == 6)
invert = 0, return_code = last_command_exit_value;
else if (result)
return_code = (last_command_exit_value == 0) ? 1 : last_command_exit_value;
else if (function_value)
return_code = return_catch_value;
else
return_code = execute_command_internal((COMMAND *)tcom, asynchronous, -1,
-1, fds_to_close);
if (invert)
return_code = (return_code == 0) ? 1 : 0;
if (user_subshell && signal_is_trapped(0)) {
last_command_exit_value = return_code;
return_code = run_exit_trap();
}
return (return_code);
} | long long execute_in_subshell(struct_0 *a0, unsigned long a1, unsigned long a2,
unsigned long long a3, void *a4,
unsigned long long a5) {
unsigned long v0;
int tmp_23;
int tmp_21;
unsigned int v1;
unsigned int v2;
unsigned int v3;
unsigned int v4;
unsigned int v5;
unsigned int v6;
unsigned int v7;
unsigned int v8;
unsigned int v9;
struct_1 *v10;
unsigned int v12;
unsigned int v13;
unsigned long v14;
unsigned int v16;
unsigned long long v17;
v1 = a1;
v0 = a2;
subshell_level = subshell_level + 1;
if (!v1 || !(a0->field_4 & 0x400) || v0 != -1 ||
stdin_redirects(a0->field_10))
v12 = 0;
else
v12 = 1;
v8 = v12;
v4 = (a0->field_4 & 4);
if (a0->field_0 == 13 || (a0->field_4 & 1))
v13 = 1;
else
v13 = 0;
v2 = v13;
v3 = a0->field_0 == 14;
a0->field_4 = a0->field_4 & -8;
if (v1) {
original_pgrp = -1;
v9 = interactive_shell;
interactive_shell = 0;
if (v9 != interactive_shell)
expand_aliases = 0;
}
interactive = 0;
login_shell = interactive;
if (shell_compatibility_level > 44)
loop_level = 0;
if (!v2) {
line_number_for_err_trap = 0;
if (v1)
line_number_for_err_trap = 2372415452829272149 | 1;
if (v0 != -1 || a3 != -1)
line_number_for_err_trap = 2372415452829272149 | 16;
if (v3)
line_number_for_err_trap = 2372415452829272149 | 64;
} else {
line_number_for_err_trap = 2;
if (v1)
line_number_for_err_trap = 2372415452829272149 | 1;
}
if (terminating_signal)
termsig_handler(terminating_signal);
if (interrupt_state)
throw_to_top_level();
if (terminating_signal)
termsig_handler(terminating_signal);
reset_terminating_signals();
clear_pending_traps(a0, a1, a2, a3, a4, a5);
reset_signal_handlers(a0, a1, a2, a3, a4, a5);
*(&line_number_for_err_trap) = 15042888 CONCAT 85 | 128;
v14 = 2372415452829272149;
*(&v14) = 72;
tmp_23 = v14;
line_number_for_err_trap = tmp_23;
if (running_trap > 0) {
run_trap_cleanup(running_trap - 1);
running_trap = 0;
}
if (!v1) {
set_sigint_handler();
} else {
setup_async_signals();
v1 = 0;
}
set_sigchld_handler(a0, a1, a2, a3, a4, a5);
without_job_control(a0, a1, a2, a3, a4, a5);
if (a4)
close_fd_bitmap(a4);
do_piping(v0, a3);
coproc_closeall();
clear_fifo_list(*(&v10), a1, a2, a3, a4, a5);
if (v2) {
if (stdin_redirects(*((*(&v10) + 16))) || v0 != -1)
*(&v14) = 1;
else
*(&v14) = 0;
line_number_for_err_trap = v14;
} else if (shell_control_structure(*(*(&v10))) && v0 != -1) {
line_number_for_err_trap = 1;
}
if (v8 && false)
async_redirect_stdin(*(&v10), a1, a2);
default_buffered_input = -1;
if (v2 && *(*(&v10)) == 13)
optimize_subshell_command(*((*((*(&v10) + 24)) + 8)));
if (*((*(&v10) + 16))) {
if (do_redirections(*((*(&v10) + 16)), 0x1))
exit(!v4);
dispose_redirects(*((*(&v10) + 16)));
*((*(&v10) + 16)) = 0;
}
if (*(*(&v10)) == 13) {
v10 = *((*((*(&v10) + 24)) + 8));
} else if (!v3) {
v10 = &a0->field_0;
} else {
v10 = *((*((*(&v10) + 24)) + 16));
}
if ((*((*(&v10) + 4)) & 128)) {
v16 = v10->field_4;
*(&v16) = *((*(&v10) + 4)) | 128;
v10->field_4 = v16;
}
if ((*((*(&v10) + 4)) & 0x100)) {
v17 = v10->field_4;
*(&v17) = (v10->field_4 >> 8) | 1;
tmp_21 = v17;
v10->field_4 = tmp_21;
}
if ((*((*(&v10) + 4)) & 8) && false)
v10->field_4 = v10->field_4 | 8;
if (v2 || v3) {
switch (v10->field_0) {
case 4:
case 13:
if (!(*((*(&v10) + 4)) & 128) && !(*((*(&v10) + 4)) & 4)) {
v10->field_4 = v10->field_4 | 64;
if (v10->field_0 == 4) {
v10->field_18->field_0 = v10->field_18->field_0 | 64;
break;
}
}
default:
goto LABEL_4027f4;
}
}
LABEL_4027f4:
v4 = (v10->field_4 & 4);
v10->field_4 = v10->field_4 & -5;
v7 = __sigsetjmp(0x500230, 0x0, v10->field_4 & -5);
v6 = 0;
v6 = __sigsetjmp(&SB, 0x0, v10->field_4 & -5);
switch (v7) {
case 3:
case 6:
v4 = 0;
v5 = 2372415452829272149;
break;
case 0:
if (v6) {
v5 = 2372415452829272149;
break;
} else {
v5 = execute_command_internal(v10, v1, 0xffffffff, 0xffffffff, a4, a5);
break;
}
default:
*(&v14) = (!2372415452829272149 ? 2372415452829272149 : 1);
v5 = v14;
break;
}
if (v4)
v5 = !v5;
if (!v2) {
return v5;
} else if (!signal_is_trapped(0x0)) {
return v5;
} else {
line_number_for_err_trap = v5;
v5 = run_exit_trap();
return v5;
}
} | bash | angr_sailr |
static enum section check_section(void) {
size_t len = line_buf.length - 1;
if (len < 2 || footer_del_len < 2 || memcmp(line_buf.buffer, section_del, 2))
return Text;
if (len == header_del_len &&
!memcmp(line_buf.buffer, header_del, header_del_len))
return Header;
if (len == body_del_len && !memcmp(line_buf.buffer, body_del, body_del_len))
return Body;
if (len == footer_del_len &&
!memcmp(line_buf.buffer, footer_del, footer_del_len))
return Footer;
return Text;
} | long check_section() {
size_t v1;
v1 = n - 1;
if (n - 1 <= 1 || footer_del_len <= 1 || memcmp(s1, section_del, 2uLL))
return 3LL;
if (v1 == header_del_len && !memcmp(s1, header_del, header_del_len))
return 0LL;
if (v1 == body_del_len && !memcmp(s1, body_del, body_del_len))
return 1LL;
if (v1 == footer_del_len && !memcmp(s1, footer_del, footer_del_len))
return 2LL;
return 3LL;
} | coreutils | ida |
static int cmp(char const *a, size_t a_len, char const *b, size_t b_len) {
if (a_len < b_len)
return -1;
if (b_len < a_len)
return 1;
return (memcmp(a, b, a_len));
} | int cmp(void *a0, unsigned int a1, void *a2, unsigned long a3) {
unsigned int v1;
if (a1 < a3) {
v1 = -1;
} else if (a3 < a1) {
v1 = 1;
} else {
v1 = memcmp(a0, a2, a1);
}
return v1;
} | coreutils | angr_dream |
static inline int is_basic(char c) {
return (is_basic_table[(unsigned char)c >> 5] >> ((unsigned char)c & 31)) & 1;
} | long is_basic(unsigned char a1) {
return (is_basic_table[a1 >> 5] >> (a1 & 0x1F)) & 1;
} | bash | ida |
static void print_cert(struct sshkey *key) {
char valid[64], *key_fp, *ca_fp;
u_int i;
key_fp = sshkey_fingerprint(key, fingerprint_hash, SSH_FP_DEFAULT);
ca_fp = sshkey_fingerprint(key->cert->signature_key, fingerprint_hash,
SSH_FP_DEFAULT);
if (key_fp == ((void *)0) || ca_fp == ((void *)0))
sshfatal("ssh-keygen.c", __func__, 2111, 1, SYSLOG_LEVEL_FATAL, ((void *)0),
"sshkey_fingerprint fail");
sshkey_format_cert_validity(key->cert, valid, sizeof(valid));
printf(" Type: %s %s certificate\n", sshkey_ssh_name(key),
sshkey_cert_type(key));
printf(" Public key: %s %s\n", sshkey_type(key), key_fp);
printf(" Signing CA: %s %s (using %s)\n",
sshkey_type(key->cert->signature_key), ca_fp,
key->cert->signature_type);
printf(" Key ID: \"%s\"\n", key->cert->key_id);
printf(" Serial: %llu\n", (unsigned long long)key->cert->serial);
printf(" Valid: %s\n", valid);
printf(" Principals: ");
if (key->cert->nprincipals == 0)
printf("(none)\n");
else {
for (i = 0; i < key->cert->nprincipals; i++)
printf("\n %s", key->cert->principals[i]);
printf("\n");
}
printf(" Critical Options: ");
if (sshbuf_len(key->cert->critical) == 0)
printf("(none)\n");
else {
printf("\n");
show_options(key->cert->critical, 1);
}
printf(" Extensions: ");
if (sshbuf_len(key->cert->extensions) == 0)
printf("(none)\n");
else {
printf("\n");
show_options(key->cert->extensions, 0);
}
} | void print_cert(struct_0 *a0) {
unsigned int v0;
unsigned long v1;
unsigned long v2;
char v3;
char v4;
unsigned long long *v6;
unsigned long long v7;
v1 = sshkey_fingerprint(a0, fingerprint_hash, 0x0, fingerprint_hash);
v2 = sshkey_fingerprint(a0->field_80->field_50, fingerprint_hash, 0x0,
fingerprint_hash);
if (!v1 || !v2)
sshfatal("ssh-keygen.c", "print_cert", 0x83f, 0x1, 0x1, 0x0,
"sshkey_fingerprint fail");
sshkey_format_cert_validity(a0->field_80, &v3, 0x40, &v3);
printf(" Type: %s %s certificate\n", sshkey_ssh_name(a0),
sshkey_cert_type(a0));
printf(" Public key: %s %s\n", sshkey_type(a0), v1);
printf(" Signing CA: %s %s (using %s)\n",
sshkey_type(a0->field_80->field_50), v2, a0->field_80->field_58);
printf(" Key ID: \"%s\"\n", a0->field_80->field_18);
printf(" Serial: %llu\n", a0->field_80->field_10);
printf(" Valid: %s\n", &v3);
printf(" Principals: ");
if (!a0->field_80->field_20) {
printf("(none)\n");
} else {
for (v0 = 0; v0 < a0->field_80->field_20; v0 += 1) {
printf("\n %s", *((a0->field_80->field_28 + v0 * 8)));
}
printf("\n");
}
printf(" Critical Options: ");
if (sshbuf_len(a0->field_80->field_40)) {
printf("\n");
show_options(a0->field_80->field_40, 0x1);
} else {
printf("(none)\n");
}
printf(" Extensions: ");
if (sshbuf_len(a0->field_80->field_48)) {
printf("\n");
show_options(a0->field_80->field_48, 0x0);
} else {
printf("(none)\n");
}
v7 = *(&v4) ^ v6[5];
return;
} | openssh-portable | angr_sailr |
em_yank(EditLine *el, wint_t c __attribute__((__unused__))) {
wchar_t *kp, *cp;
if (el->el_chared.c_kill.last == el->el_chared.c_kill.buf)
return 0;
if (el->el_line.lastchar +
(el->el_chared.c_kill.last - el->el_chared.c_kill.buf) >=
el->el_line.limit)
return 6;
el->el_chared.c_kill.mark = el->el_line.cursor;
cp = el->el_line.cursor;
c_insert(el, (int)(el->el_chared.c_kill.last - el->el_chared.c_kill.buf));
for (kp = el->el_chared.c_kill.buf; kp < el->el_chared.c_kill.last; kp++)
*cp++ = *kp;
if (el->el_state.argument == 1)
el->el_line.cursor = cp;
return 4;
} | long long em_yank(struct_0 *a0, unsigned long a1) {
unsigned int v0;
unsigned int *v1;
unsigned long long v2;
unsigned long long v4;
unsigned int *v5;
v0 = a1;
if (a0->field_388 == a0->field_380) {
v4 = 0;
} else if (a0->field_60 + a0->field_388 - a0->field_380 >= a0->field_68) {
v4 = 6;
} else {
a0->field_390 = a0->field_58;
v2 = a0->field_58;
c_insert(a0, a0->field_388 - a0->field_380 >> 2,
a0->field_388 - a0->field_380 >> 2);
for (v1 = a0->field_380; v1 < a0->field_388; v1 += 1) {
v5 = v2;
v2 += 4;
*(v5) = *(v1);
}
if (a0->field_78 == 1)
a0->field_58 = v2;
v4 = 4;
}
return v4;
} | libedit | angr_dream |
static int punch_hole(int fd, off_t offset, off_t length) {
int ret = 0;
ret = fallocate(fd, 0x02 | 0x01, offset, length);
if (ret < 0 &&
(is_ENOTSUP((*__errno_location())) || (*__errno_location()) == 38))
ret = 0;
return ret;
} | long punch_hole(int a1, __off_t a2, __off_t a3) {
int *v3;
int v5;
v5 = fallocate(a1, 3, a2, a3);
if (v5 < 0) {
v3 = _errno_location();
if (is_ENOTSUP(*v3) || *_errno_location() == 38)
return 0;
}
return (unsigned int)v5;
} | coreutils | ida |
static int xfrm_spd_setinfo(int argc, char **argv) {
struct rtnl_handle rth;
struct {
struct nlmsghdr n;
__u32 flags;
char buf[2048];
} req = {
.n.nlmsg_len =
((sizeof(__u32)) +
((int)(((sizeof(struct nlmsghdr)) + 4U - 1) & ~(4U - 1)))),
.n.nlmsg_flags = 0x01,
.n.nlmsg_type = XFRM_MSG_NEWSPDINFO,
.flags = 0XFFFFFFFF,
};
char *thr4 = ((void *)0);
char *thr6 = ((void *)0);
while (argc > 0) {
if (strcmp(*argv, "hthresh4") == 0) {
struct xfrmu_spdhthresh thr;
if (thr4)
duparg("hthresh4", *argv);
thr4 = *argv;
do {
argv++;
if (--argc <= 0)
incomplete_command();
} while (0);
if (get_u8(&thr.lbits, *argv, 0) || thr.lbits > 32)
invarg("hthresh4 LBITS value is invalid", *argv);
do {
argv++;
if (--argc <= 0)
incomplete_command();
} while (0);
if (get_u8(&thr.rbits, *argv, 0) || thr.rbits > 32)
invarg("hthresh4 RBITS value is invalid", *argv);
addattr_l(&req.n, sizeof(req), XFRMA_SPD_IPV4_HTHRESH, (void *)&thr,
sizeof(thr));
} else if (strcmp(*argv, "hthresh6") == 0) {
struct xfrmu_spdhthresh thr;
if (thr6)
duparg("hthresh6", *argv);
thr6 = *argv;
do {
argv++;
if (--argc <= 0)
incomplete_command();
} while (0);
if (get_u8(&thr.lbits, *argv, 0) || thr.lbits > 128)
invarg("hthresh6 LBITS value is invalid", *argv);
do {
argv++;
if (--argc <= 0)
incomplete_command();
} while (0);
if (get_u8(&thr.rbits, *argv, 0) || thr.rbits > 128)
invarg("hthresh6 RBITS value is invalid", *argv);
addattr_l(&req.n, sizeof(req), XFRMA_SPD_IPV6_HTHRESH, (void *)&thr,
sizeof(thr));
} else {
invarg("unknown", *argv);
}
argc--;
argv++;
}
if (rtnl_open_byproto(&rth, 0, 6) < 0)
exit(1);
if (rtnl_talk(&rth, &req.n, ((void *)0)) < 0)
exit(2);
rtnl_close(&rth);
return 0;
} | undefined8 xfrm_spd_setinfo(int param_1, char **param_2)
{
int iVar1;
long lVar2;
undefined8 *puVar3;
long in_FS_OFFSET;
char **local_888;
int local_87c;
char *local_878;
char *local_870;
byte local_868;
byte local_867[63];
undefined8 local_828;
undefined4 local_818;
long local_10;
local_10 = *(long *)(in_FS_OFFSET + 0x28);
puVar3 = &local_828;
for (lVar2 = 0x102; lVar2 != 0; lVar2 = lVar2 + -1) {
*puVar3 = 0;
puVar3 = puVar3 + 1;
}
*(undefined4 *)puVar3 = 0;
local_828._0_4_ = 0x14;
local_828._4_2_ = 0x24;
local_828._6_2_ = 1;
local_818 = 0xffffffff;
local_878 = (char *)0x0;
local_870 = (char *)0x0;
local_888 = param_2;
for (local_87c = param_1; 0 < local_87c; local_87c = local_87c + -1) {
iVar1 = strcmp(*local_888, "hthresh4");
if (iVar1 == 0) {
if (local_878 != (char *)0x0) {
duparg("hthresh4", *local_888);
}
local_878 = *local_888;
if (local_87c + -1 < 1) {
incomplete_command();
}
iVar1 = get_u8(&local_868, local_888[1], 0);
if ((iVar1 != 0) || (0x20 < local_868)) {
invarg("hthresh4 LBITS value is invalid", local_888[1]);
}
local_888 = local_888 + 2;
local_87c = local_87c + -2;
if (local_87c < 1) {
incomplete_command();
}
iVar1 = get_u8(local_867, *local_888, 0);
if ((iVar1 != 0) || (0x20 < local_867[0])) {
invarg("hthresh4 RBITS value is invalid", *local_888);
}
addattr_l(&local_828, 0x814, 3, &local_868, 2);
} else {
iVar1 = strcmp(*local_888, "hthresh6");
if (iVar1 == 0) {
if (local_870 != (char *)0x0) {
duparg("hthresh6", *local_888);
}
local_870 = *local_888;
if (local_87c + -1 < 1) {
incomplete_command();
}
iVar1 = get_u8(&local_868, local_888[1], 0);
if ((iVar1 != 0) || (0x80 < local_868)) {
invarg("hthresh6 LBITS value is invalid", local_888[1]);
}
local_888 = local_888 + 2;
local_87c = local_87c + -2;
if (local_87c < 1) {
incomplete_command();
}
iVar1 = get_u8(local_867, *local_888, 0);
if ((iVar1 != 0) || (0x80 < local_867[0])) {
invarg("hthresh6 RBITS value is invalid", *local_888);
}
addattr_l(&local_828, 0x814, 4, &local_868, 2);
} else {
invarg("unknown", *local_888);
}
}
local_888 = local_888 + 1;
}
iVar1 = rtnl_open_byproto(&local_868, 0, 6);
if (iVar1 < 0) {
exit(1);
}
iVar1 = rtnl_talk(&local_868, &local_828, 0);
if (iVar1 < 0) {
exit(2);
}
rtnl_close(&local_868);
if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) {
__stack_chk_fail();
}
return 0;
} | iproute2-6.0.0 | ghidra |
static void deferred_dec_badcount(struct clone_struct *cs) {
if (!cs->save_dup_cluster)
return;
decrement_badcount(cs->ctx, cs->save_blocknr, cs->save_dup_cluster);
cs->save_dup_cluster = ((void *)0);
} | void deferred_dec_badcount(long param_1)
{
if (*(long *)(param_1 + 0x38) != 0) {
decrement_badcount(*(undefined8 *)(param_1 + 0x28),
*(undefined8 *)(param_1 + 0x40),
*(undefined8 *)(param_1 + 0x38));
*(undefined8 *)(param_1 + 0x38) = 0;
}
return;
} | e2fsprogs-1.46.5 | ghidra |
int send_ocsp_request(const char *server, gnutls_x509_crt_t cert,
gnutls_x509_crt_t issuer, gnutls_datum_t *resp_data,
gnutls_datum_t *nonce) {
gnutls_datum_t ud;
int ret;
gnutls_datum_t req;
char *url = (void *)server;
char headers[1024];
char service[16];
unsigned char *p;
const char *hostname;
const char *path = "";
unsigned i;
unsigned int headers_size = 0, port;
socket_st hd;
sockets_init();
if (url == ((void *)0)) {
gnutls_datum_t data;
i = 0;
do {
ret = gnutls_x509_crt_get_authority_info_access(cert, i++,
GNUTLS_IA_OCSP_URI, &data,
((void *)0));
} while (ret == -105);
if (ret < 0) {
i = 0;
do {
ret = gnutls_x509_crt_get_authority_info_access(
issuer, i++, GNUTLS_IA_OCSP_URI, &data, ((void *)0));
} while (ret == -105);
}
if (ret < 0) {
fprintf(stderr, "*** Cannot find OCSP server URI in certificate: %s\n",
gnutls_strerror(ret));
return ret;
}
url = malloc(data.size + 1);
if (url == ((void *)0)) {
return -1;
}
memcpy(url, data.data, data.size);
url[data.size] = 0;
gnutls_free((void *)(data.data)), data.data = ((void *)0);
}
hostname = host_from_url(url, &port, &path);
if (port != 0)
snprintf(service, sizeof(service), "%u", port);
else
strcpy(service, "80");
fprintf(stderr, "Connecting to OCSP server: %s...\n", hostname);
memset(&ud, 0, sizeof(ud));
_generate_request(cert, issuer, &req, nonce);
snprintf(headers, sizeof(headers),
"POST /%s HTTP/1.0\r\n"
"Host: %s\r\n"
"Accept: */*\r\n"
"Content-Type: application/ocsp-request\r\n"
"Content-Length: %u\r\n"
"Connection: close\r\n\r\n",
path, hostname, (unsigned int)req.size);
headers_size = strlen(headers);
socket_open2(&hd, hostname, service, ((void *)0), (1 << 3) | (1 << 5),
"Connecting to", ((void *)0), ((void *)0), ((void *)0),
((void *)0));
socket_send(&hd, headers, headers_size);
socket_send(&hd, req.data, req.size);
gnutls_free((void *)(req.data)), req.data = ((void *)0);
do {
ret = socket_recv(&hd, buffer, sizeof(buffer));
if (ret > 0)
get_data(buffer, ret, 1, &ud);
} while (ret > 0);
if (ret < 0 || ud.size == 0) {
perror("recv");
ret = -1;
goto cleanup;
}
socket_bye(&hd, 0);
p = memmem(ud.data, ud.size, "\r\n\r\n", 4);
if (p == ((void *)0)) {
fprintf(stderr, "Cannot interpret HTTP response\n");
ret = -1;
goto cleanup;
}
p += 4;
resp_data->size = ud.size - (p - ud.data);
resp_data->data = malloc(resp_data->size);
if (resp_data->data == ((void *)0)) {
perror("recv");
ret = -1;
goto cleanup;
}
memcpy(resp_data->data, p, resp_data->size);
ret = 0;
cleanup:
free(ud.data);
if (url != server)
free(url);
return ret;
} | long long send_ocsp_request(void *a0, unsigned long long a1,
unsigned long long a2, struct_0 *a3,
unsigned long long a4) {
int tmp_9;
void *v0;
unsigned long long v1;
char v2;
unsigned int v3;
unsigned int v4;
unsigned int v5;
unsigned long long v6;
char *v7;
unsigned long long v8;
unsigned long v9;
char v10;
char v11;
void *v12;
char v13;
char v14;
char v15;
char v16;
unsigned long long v20;
v1 = a1;
v7 = a0;
v6 = &g_402240;
v5 = 0;
sockets_init();
if (!v7) {
v4 = 0;
do {
tmp_9 = v4;
v4 += 1;
v3 = gnutls_x509_crt_get_authority_info_access(v1, tmp_9, 0x2716, &v12,
0x0);
} while (v3 == -105);
if (v3 < 0) {
v4 = 0;
do {
tmp_9 = v4;
v4 += 1;
v3 = gnutls_x509_crt_get_authority_info_access(a2, tmp_9, 0x2716, &v12,
0x0);
} while (v3 == -105);
}
if (v3 < 0) {
fprintf(*(&stderr),
"*** Cannot find OCSP server URI in certificate: %s\n",
gnutls_strerror(v3));
v20 = v3;
goto LABEL_4008bc;
}
v7 = malloc(*(&v13) + 1);
if (!v7) {
v20 = 4294967295;
goto LABEL_4008bc;
} else {
memcpy(v7, *(&v12), *(&v13));
v7[*(&v13)] = 0;
*(5243032)(*(&v12));
v12 = 0;
}
}
v8 = host_from_url(v7, &v2, &v6);
if (!*(&v2))
strcpy(&v15, "80");
else
snprintf(&v15, 0x10, "%u", *(&v2));
fprintf(*(&stderr), "Connecting to OCSP server: %s...\n", v8);
memset(&v10, 0x0, 0x10);
_generate_request(v1, a2, &v12, a4);
snprintf(&v16, 0x400,
"POST /%s HTTP/1.0\r\nHost: %s\r\nAccept: */*\r\nContent-Type: "
"application/ocsp-request\r\nContent-Length: %u\r\nConnection: "
"close\r\n\r\n",
v6, v8, *(&v13));
v5 = strlen(&v16);
v0 = 0;
socket_open2(&v14, v8, &v15, 0x0, 0x28, "Connecting to", 0x0, 0x0, 0x0);
socket_send(&v14, &v16, v5, &v16);
socket_send(&v14, v12, *(&v13), v12);
*(5243032)(v12);
v12 = 0;
do {
v3 = socket_recv(&v14, &buffer, 0x1001);
if (v3 > 0)
get_data(&buffer, v3, 0x1, &v10);
} while (v3 > 0);
if (v3 < 0) {
LABEL_400751:
perror("recv");
v3 = -1;
} else {
if (!*(&v11))
goto LABEL_400751;
socket_bye(&v14, 0x0);
v9 = memmem(*(&v10), *(&v11), "\r\n\r\n", 0x4);
if (!v9) {
fprintf(*(&stderr), "Cannot interpret HTTP response\n");
v3 = -1;
} else {
v9 += 4;
a3->field_8 = *(&v11) - (v9 - *(&v10));
a3->field_0 = malloc(a3->field_8);
if (!a3->field_0) {
perror("recv");
v3 = -1;
} else {
memcpy(a3->field_0, v9, a3->field_8);
v3 = 0;
}
}
}
free(*(&v10));
if (v7 != a0)
free(v7);
v20 = v3;
LABEL_4008bc:
return v20;
} | gnutls | angr_phoenix |
void uwp_init() {
do {
(uwcache).data =
sh_xmalloc(((128) * sizeof(UNWIND_ELT *)), "unwind_prot.c", 108);
(uwcache).cs = (128);
(uwcache).nc = 0;
} while (0);
} | void uwp_init(void)
{
uwcache._0_8_ = sh_xmalloc(0x400, "unwind_prot.c", 0x6c);
uwcache._8_4_ = 0x80;
uwcache._12_4_ = 0;
return;
} | bash | ghidra |
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 NAME [SUFFIX]\n or: %s OPTION... NAME...\n")
,
program_name, program_name);
fputs_unlocked(
gettext("Print NAME with any leading directory components removed.\nIf "
"specified, also remove a trailing SUFFIX.\n"),
stdout)
;
emit_mandatory_arg_note();
fputs_unlocked(
gettext(" -a, --multiple support multiple arguments and treat "
"each as a NAME\n -s, --suffix=SUFFIX remove a trailing "
"SUFFIX; implies -a\n -z, --zero end each output "
"line with 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);
printf(gettext("\nExamples:\n %s /usr/bin/sort -> \"sort\"\n %s "
"include/stdio.h .h -> \"stdio\"\n %s -s .h "
"include/stdio.h -> \"stdio\"\n %s -a any/str1 any/str2 "
"-> \"str1\" followed by \"str2\"\n")
,
program_name, program_name, program_name, program_name);
emit_ancillary_info("basename");
}
exit(status);
} | void usage(int a1) {
long v1;
char *v2;
long v3;
long v4;
char *v5;
FILE *v6;
char *v7;
FILE *v8;
char *v9;
FILE *v10;
char *v11;
FILE *v12;
char *v13;
long v14;
long v15;
long v16;
long v17;
char *v18;
if (a1) {
v1 = program_name;
v2 = gettext("Try '%s --help' for more information.\n");
fprintf(stderr, v2, v1);
} else {
v3 = program_name;
v4 = program_name;
v5 = gettext("Usage: %s NAME [SUFFIX]\n or: %s OPTION... NAME...\n");
printf(v5, v4, v3);
v6 = stdout;
v7 = gettext("Print NAME with any leading directory components "
"removed.\nIf specified, also remove a trailing SUFFIX.\n");
fputs_unlocked(v7, v6);
emit_mandatory_arg_note();
v8 = stdout;
v9 = gettext(
" -a, --multiple support multiple arguments and treat each as a "
"NAME\n"
" -s, --suffix=SUFFIX remove a trailing SUFFIX; implies -a\n"
" -z, --zero end each output line with NUL, not newline\n");
fputs_unlocked(v9, v8);
v10 = stdout;
v11 = gettext(" --help display this help and exit\n");
fputs_unlocked(v11, v10);
v12 = stdout;
v13 = gettext(" --version output version information and exit\n");
fputs_unlocked(v13, v12);
v14 = program_name;
v15 = program_name;
v16 = program_name;
v17 = program_name;
v18 = gettext(
"\n"
"Examples:\n"
" %s /usr/bin/sort -> \"sort\"\n"
" %s include/stdio.h .h -> \"stdio\"\n"
" %s -s .h include/stdio.h -> \"stdio\"\n"
" %s -a any/str1 any/str2 -> \"str1\" followed by \"str2\"\n");
printf(v18, v17, v16, v15, v14);
emit_ancillary_info("basename");
}
exit(a1);
} | coreutils | ida |
int strnvis(char *mbdst, size_t dlen, const char *mbsrc, int flags) {
return istrsenvisxl(&mbdst, &dlen, mbsrc, flags, "", ((void *)0));
} | long long strnvis(unsigned long a0, unsigned long a1, char *a2,
unsigned long a3) {
unsigned long v0;
unsigned long v1;
v1 = a0;
v0 = a1;
return istrsenvisxl(&v1, &v0, a2, a3, &g_4018e8, 0x0);
} | libedit | angr_phoenix |
static void check_perms_nopam(const struct passwd *pw) {
const struct spwd *spwd = ((void *)0);
const char *password = pw->pw_passwd;
sighandler_t oldsig;
if (caller_is_root) {
return;
}
if (strcmp(pw->pw_passwd, "") == 0) {
char *prevent_no_auth = getdef_str("PREVENT_NO_AUTH");
if (prevent_no_auth == ((void *)0)) {
prevent_no_auth = "superuser";
}
if (strcmp(prevent_no_auth, "yes") == 0) {
fprintf(stderr, gettext("Password field is empty, this is forbidden for "
"all accounts.\n"));
exit(1);
} else if ((pw->pw_uid == 0) &&
(strcmp(prevent_no_auth, "superuser") == 0)) {
fprintf(
stderr,
gettext(
"Password field is empty, this is forbidden for super-user.\n"));
exit(1);
}
}
if ((0 == pw->pw_uid) && getdef_bool("SU_WHEEL_ONLY") &&
!iswheel(caller_name)) {
fprintf(stderr, gettext("You are not authorized to su %s\n"), name);
exit(1);
}
spwd = getspnam(name);
if (strcmp(pw->pw_passwd, "x") == 0) {
if (((void *)0) != spwd) {
password = spwd->sp_pwdp;
}
}
switch (check_su_auth(caller_name, name, 0 == pw->pw_uid)) {
case 0:
break;
case 1:
password = "";
break;
case 2:
(void)puts(gettext("(Enter your own password)"));
password = caller_pass;
break;
default:
fprintf(stderr, gettext("You are not authorized to su %s\n"), name);
exit(1);
}
die(0);
oldsig = signal(3, die);
if (pw_auth(password, name, 1, (char *)0) != 0) {
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((pw->pw_uid != 0) ? 5 : 4, "Authentication failed for %s", name);
if (((void *)0) != saved_locale) {
(void)setlocale(6, saved_locale);
free(saved_locale);
}
} while (0);
fprintf(stderr, gettext("%s: Authentication failure\n"), Prog);
su_failure(caller_tty, 0 == pw->pw_uid);
}
(void)signal(3, oldsig);
if (((void *)0) != spwd) {
(void)expire(pw, spwd);
}
if (!isttytime(name, "SU", time((time_t *)0))) {
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((0 != pw->pw_uid) ? 4 : 2, "SU by %s to restricted account %s",
caller_name, name);
if (((void *)0) != saved_locale) {
(void)setlocale(6, saved_locale);
free(saved_locale);
}
} while (0)
;
fprintf(stderr, gettext("%s: You are not authorized to su at that time\n"),
Prog);
su_failure(caller_tty, 0 == pw->pw_uid);
}
} | void check_perms_nopam(struct_0 *a0) {
unsigned long long v0;
unsigned long long v1;
void *v2;
void *v3;
void *v4;
unsigned long long v5;
char *v6;
char *v7;
unsigned long long v9;
unsigned int v10;
unsigned int v11;
v4 = 0;
v0 = a0->field_8;
v9 = caller_is_root;
if (caller_is_root) {
LABEL_40089e:
return;
}
if (!strcmp(a0->field_8, &g_4059c7)) {
v1 = getdef_str("PREVENT_NO_AUTH");
if (!v1)
v1 = "superuser";
if (!strcmp(v1, "yes")) {
fprintf(*(&stderr), gettext("Password field is empty, this is forbidden "
"for all accounts.\n"));
exit(0x1);
} else if (!a0->field_10 && !strcmp(v1, "superuser")) {
fprintf(
*(&stderr),
gettext(
"Password field is empty, this is forbidden for super-user.\n"));
exit(0x1);
}
}
if (!a0->field_10 && getdef_bool("SU_WHEEL_ONLY")) {
*(&v9) = iswheel(&caller_name) ^ 1;
if (v9) {
fprintf(*(&stderr), gettext("You are not authorized to su %s\n"));
exit(0x1);
}
}
v4 = getspnam(&name);
if (!strcmp(a0->field_8, "x") && v4)
v0 = v4->field_8;
v10 = check_su_auth(&caller_name, &name, !a0->field_10);
if (v10 == 2) {
puts(gettext("(Enter your own password)"));
v0 = caller_pass;
LABEL_40061c:
die(0x0);
v5 = signal(0x3, die);
if (pw_auth(v0, &name, 0x1, 0x0)) {
v6 = setlocale(0x6, NULL);
v2 = 0;
if (v6)
v2 = strdup(v6);
if (v2)
setlocale(0x6, "C");
if (!a0->field_10)
v10 = 4;
else
v10 = 5;
syslog(v10, "Authentication failed for %s");
if (v2) {
setlocale(0x6, v2);
free(v2);
}
fprintf(*(&stderr), gettext("%s: Authentication failure\n"));
su_failure(*(&caller_tty), !a0->field_10);
} else {
signal(0x3, v5);
if (v4)
expire(a0, v4, v4);
v11 = isttytime(&name, "SU", time(NULL)) ^ 1;
if (v11) {
v7 = setlocale(0x6, NULL);
v3 = 0;
if (v7)
v3 = strdup(v7);
if (v3)
setlocale(0x6, "C");
if (!a0->field_10)
v11 = 2;
else
v11 = 4;
syslog(v11, "SU by %s to restricted account %s");
if (v3) {
setlocale(0x6, v3);
free(v3);
}
fprintf(*(&stderr),
gettext("%s: You are not authorized to su at that time\n"));
su_failure(*(&caller_tty), !a0->field_10);
}
}
goto LABEL_40089e;
} else {
if (v10 <= 2) {
if (!v10)
goto LABEL_40061c;
if (v10 == 1) {
v0 = &g_4059c7;
goto LABEL_40061c;
}
}
fprintf(*(&stderr), gettext("You are not authorized to su %s\n"));
exit(0x1);
}
} | shadow | angr_phoenix |
static _Bool
disable_core_dumps(void) {
if (prctl(4, 0) == 0)
return 1;
error(0, (*__errno_location()),
gettext("warning: disabling core dumps failed"));
return 0;
} | int disable_core_dumps() {
unsigned int v1;
v1 = prctl(0x4, 0x0);
if (!v1) {
v1 = 1;
} else {
error(0x0, *(__errno_location()),
gettext("warning: disabling core dumps failed"));
v1 = 0;
}
return v1;
} | coreutils | angr_dream |
static struct argp_option const *find_argp_option(struct argp *ap, int key) {
struct argp_option const *p = ((void *)0);
struct argp_child const *child;
p = find_argp_option_key(ap->options, key);
if (!p && ap->children) {
for (child = ap->children; child->argp; child++) {
p = find_argp_option_key(child->argp->options, key);
if (p)
break;
}
}
return p;
} | long find_argp_option(undefined8 *param_1, undefined4 param_2)
{
long local_18;
long *local_10;
local_18 = find_argp_option_key(*param_1, param_2);
if ((local_18 == 0) && (param_1[4] != 0)) {
local_10 = (long *)param_1[4];
while ((*local_10 != 0 &&
(local_18 = find_argp_option_key(*(undefined8 *)*local_10, param_2),
local_18 == 0))) {
local_10 = local_10 + 4;
}
}
return local_18;
} | tar | ghidra |
void blf_cbc_decrypt(blf_ctx *c, u_int8_t *iva, u_int8_t *data, u_int32_t len) {
u_int32_t l, r;
u_int8_t *iv;
u_int32_t i, j;
iv = data + len - 16;
data = data + len - 8;
for (i = len - 8; i >= 8; i -= 8) {
l = data[0] << 24 | data[1] << 16 | data[2] << 8 | data[3];
r = data[4] << 24 | data[5] << 16 | data[6] << 8 | data[7];
Blowfish_decipher(c, &l, &r);
data[0] = l >> 24 & 0xff;
data[1] = l >> 16 & 0xff;
data[2] = l >> 8 & 0xff;
data[3] = l & 0xff;
data[4] = r >> 24 & 0xff;
data[5] = r >> 16 & 0xff;
data[6] = r >> 8 & 0xff;
data[7] = r & 0xff;
for (j = 0; j < 8; j++)
data[j] ^= iv[j];
iv -= 8;
data -= 8;
}
l = data[0] << 24 | data[1] << 16 | data[2] << 8 | data[3];
r = data[4] << 24 | data[5] << 16 | data[6] << 8 | data[7];
Blowfish_decipher(c, &l, &r);
data[0] = l >> 24 & 0xff;
data[1] = l >> 16 & 0xff;
data[2] = l >> 8 & 0xff;
data[3] = l & 0xff;
data[4] = r >> 24 & 0xff;
data[5] = r >> 16 & 0xff;
data[6] = r >> 8 & 0xff;
data[7] = r & 0xff;
for (j = 0; j < 8; j++)
data[j] ^= iva[j];
} | long long blf_cbc_decrypt(unsigned int *a0, char *a1, unsigned long a2,
unsigned long a3) {
char v0[8];
unsigned int v1;
unsigned int v2;
unsigned int v3;
unsigned int v4;
unsigned long v5;
v0 = a2;
v5 = v0 + a3 - 16;
*(&v0[0]) = v0 + a3 - 8;
for (v3 = a3 - 8; v3 > 7; v3 -= 8) {
v1 = v0[3] | (v0[0] * 0x1000000) | (v0[1] * 0x10000) | (v0[2] * 0x100);
v2 = v0[7] | (v0[4] * 0x1000000) | (v0[5] * 0x10000) | (v0[6] * 0x100);
Blowfish_decipher(a0, &v1, &v2);
v0[0] = v1 >> 24;
v0[1] = v1 >> 16;
v0[2] = v1 >> 8;
v0[3] = v1;
v0[4] = v2 >> 24;
v0[5] = v2 >> 16;
v0[6] = v2 >> 8;
v0[7] = v2;
for (v4 = 0; v4 <= 7; v4 += 1) {
v0[v4] = v0[v4] ^ v5[v4];
}
v5 += 8;
*(&v0[0]) = v0 + 1;
}
v1 = v0[3] | (v0[0] * 0x1000000) | (v0[1] * 0x10000) | (v0[2] * 0x100);
v2 = v0[7] | (v0[4] * 0x1000000) | (v0[5] * 0x10000) | (v0[6] * 0x100);
Blowfish_decipher(a0, &v1, &v2);
v0[0] = v1 >> 24;
v0[1] = v1 >> 16;
v0[2] = v1 >> 8;
v0[3] = v1;
v0[4] = v2 >> 24;
v0[5] = v2 >> 16;
v0[6] = v2 >> 8;
v0[7] = v2;
for (v4 = 0; v4 <= 7; v4 += 1) {
v0[v4] = v0[v4] ^ a1[v4];
}
return 0;
} | openssh-portable | angr_phoenix |
static inline void emit_ancillary_info(char const *program) {
struct infomap {
char const *program;
char const *node;
} const infomap[] = {
{"[", "test invocation"}, {"coreutils", "Multi-call invocation"},
{"sha224sum", "sha2 utilities"}, {"sha256sum", "sha2 utilities"},
{"sha384sum", "sha2 utilities"}, {"sha512sum", "sha2 utilities"},
{((void *)0), ((void *)0)}};
char const *node = program;
struct infomap const *map_prog = infomap;
while (map_prog->program && !(strcmp(program, map_prog->program) == 0))
map_prog++;
if (map_prog->node)
node = map_prog->node;
printf (gettext ("\n%s online help: <%s>\n"), "GNU coreutils", "https:
char const *lc_messages = setlocale (
5
,
((void *)0)
);
if (lc_messages && strncmp (lc_messages, "" "en_" "", sizeof ("en_") - 1))
{
fputs_unlocked (gettext ("Report any translation bugs to " "<https:
stdout
)
;
}
char const *url_program = (strcmp (program, "[") == 0) ? "test" : program;
printf (gettext ("Full documentation <%s%s>\n"),
"https:
printf (gettext ("or available locally via: info '(coreutils) %s%s'\n"),
node, node == program ? " invocation" : "");
} | void emit_ancillary_info(char *a0) {
unsigned long long v0;
unsigned long long v1[2];
char *v2;
unsigned long long v3;
unsigned long long v4;
unsigned long long v5;
unsigned long long v6;
unsigned long long v7;
unsigned long long v8;
unsigned long long v9;
unsigned long long v10;
unsigned long long v11;
unsigned long long v12;
unsigned long long v13;
unsigned long long v14;
unsigned long long v15;
void *v16;
void *v17;
char v18;
unsigned long long v23;
unsigned long long *v24;
unsigned long long v25;
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;
for (v1[0] = &v4; v1[0]; v1[0] = v1 + 1) {
if (!strcmp(a0, v1[0]))
break;
}
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, "["))
v23 = a0;
else
v23 = "test";
v3 = v23;
printf(gettext("Full documentation <%s%s>\n"));
printf(gettext("or available locally via: info '(coreutils) %s%s'\n"));
v25 = *(&v18) ^ v24[5];
return;
} | coreutils | angr_dream |
void tnl_print_encap(struct rtattr *tb[], int encap_type, int encap_flags,
int encap_sport, int encap_dport) {
__u16 type, flags, sport, dport;
if (!tb[encap_type])
return;
type = rta_getattr_u16(tb[encap_type]);
if (type == TUNNEL_ENCAP_NONE)
return;
flags = rta_getattr_u16(tb[encap_flags]);
sport = rta_getattr_u16(tb[encap_sport]);
dport = rta_getattr_u16(tb[encap_dport]);
open_json_object("encap");
print_string(PRINT_FP, ((void *)0), "encap ", ((void *)0));
switch (type) {
case TUNNEL_ENCAP_FOU:
print_string(PRINT_ANY, "type", "%s ", "fou");
break;
case TUNNEL_ENCAP_GUE:
print_string(PRINT_ANY, "type", "%s ", "gue");
break;
default:
print_null(PRINT_ANY, "type", "%s ", "unknown");
break;
}
if (is_json_context()) {
print_uint(PRINT_JSON, "sport", ((void *)0), ntohs(sport));
print_uint(PRINT_JSON, "dport", ((void *)0), ntohs(dport));
print_bool(PRINT_JSON, "csum", ((void *)0), flags & (1 << 0));
print_bool(PRINT_JSON, "csum6", ((void *)0), flags & (1 << 1));
print_bool(PRINT_JSON, "remcsum", ((void *)0), flags & (1 << 2));
close_json_object();
} else {
int t;
t = sport ? ntohs(sport) + 1 : 0;
print_string(PRINT_FP, ((void *)0), "%s", tnl_encap_str("sport", 1, t));
t = ntohs(dport) + 1;
print_string(PRINT_FP, ((void *)0), "%s", tnl_encap_str("dport", 1, t));
t = flags & (1 << 0);
print_string(PRINT_FP, ((void *)0), "%s", tnl_encap_str("csum", t, -1));
t = flags & (1 << 1);
print_string(PRINT_FP, ((void *)0), "%s", tnl_encap_str("csum6", t, -1));
t = flags & (1 << 2);
print_string(PRINT_FP, ((void *)0), "%s", tnl_encap_str("remcsum", t, -1));
}
} | long long tnl_print_encap(unsigned long long *a0, unsigned long a1,
unsigned long a2, unsigned long long a3,
unsigned long long a4, unsigned long long a5) {
unsigned long long v0;
unsigned short v1;
unsigned short v2;
unsigned short v3;
unsigned int v4;
unsigned long long v6;
unsigned long long v7;
unsigned long long v8;
unsigned long long v9;
v6 = a0[a1];
if (!a0[a1])
return v0;
v7 = rta_getattr_u16(a0[a1]);
*(&v0) = v7;
if (!v0)
return v0;
v1 = rta_getattr_u16(a0[a2]);
v2 = rta_getattr_u16(a0[a3]);
v3 = rta_getattr_u16(a0[a4]);
open_json_object("encap");
print_string(0x1, 0x0, "encap ", 0x0);
switch (v0) {
case 1:
print_string(0x4, "type", "%s ", "fou");
break;
case 2:
print_string(0x4, "type", "%s ", "gue");
break;
default:
print_null(0x4, "type", "%s ", "unknown");
break;
}
if (is_json_context()) {
print_uint(0x2, "sport", 0x0, ntohs(v2));
print_uint(0x2, "dport", 0x0, ntohs(v3));
print_bool(0x2, "csum", 0x0, (v1 & 1));
print_bool(0x2, "csum6", 0x0, (v1 & 2));
print_bool(0x2, "remcsum", 0x0, (v1 & 4));
v8 = close_json_object(0x2, "remcsum", 0x0, a3, a4, a5);
return v0;
}
*(&v7) = (!v2 ? ntohs(v2) + 1 : 0);
v4 = v7;
print_string(0x1, 0x0, "%s", tnl_encap_str("sport", 0x1, v4));
v4 = ntohs(v3) + 1;
print_string(0x1, 0x0, "%s", tnl_encap_str("dport", 0x1, v4));
v4 = v1 & 1;
print_string(0x1, 0x0, "%s", tnl_encap_str("csum", v4, 0xffffffff));
v4 = v1 & 2;
print_string(0x1, 0x0, "%s", tnl_encap_str("csum6", v4, 0xffffffff));
v4 = v1 & 4;
v9 = print_string(0x1, 0x0, "%s", tnl_encap_str("remcsum", v4, 0xffffffff));
return v0;
} | iproute2-6.0.0 | angr_sailr |
static int bash_vi_complete(count, key)
int count, key;
{
int p, r;
char *t;
if ((rl_point < rl_end) && (!(((rl_line_buffer[rl_point]) == ' ') ||
((rl_line_buffer[rl_point]) == '\t')))) {
if (!(((rl_line_buffer[rl_point + 1]) == ' ') ||
((rl_line_buffer[rl_point + 1]) == '\t')))
rl_vi_end_word(1, 'E');
rl_point++;
}
t = 0;
if (rl_point > 0) {
p = rl_point;
rl_vi_bWord(1, 'B');
r = rl_point;
rl_point = p;
p = r;
t = substring(rl_line_buffer, p, rl_point);
}
if (t && completion_glob_pattern(t) == 0)
rl_explicit_arg = 1;
do {
if (t)
sh_xfree((t), "bashline.c", 4047);
} while (0);
if (key == '*')
r = bash_glob_expand_word(count, key);
else if (key == '=')
r = bash_glob_list_expansions(count, key);
else if (key == '\\')
r = bash_glob_complete_word(count, key);
else
r = rl_complete(0, key);
if (key == '*' || key == '\\')
rl_vi_start_inserting(key, 1, 1);
return (r);
} | long long bash_vi_complete(unsigned long a0, unsigned long a1) {
unsigned int v0;
unsigned int v1;
void *v2;
if (rl_point < rl_end) {
switch (*((rl_point + rl_line_buffer))) {
case 9:
case 32:
break;
default:
switch (*((rl_line_buffer + rl_point + 1))) {
case 9:
case 32:
break;
default:
rl_vi_end_word(0x1, 0x45);
}
rl_point = rl_point + 1;
break;
}
}
v2 = 0;
if (rl_point > 0) {
v1 = rl_point;
rl_vi_bWord(0x1, 0x42);
v0 = rl_point;
rl_point = v1;
v1 = v0;
v2 = substring(rl_line_buffer, v1, rl_point);
}
if (v2 && !completion_glob_pattern(v2))
rl_explicit_arg = 1;
if (v2)
sh_xfree(v2, "bashline.c", 0xfcf);
switch (a1) {
case 42:
v0 = bash_glob_expand_word(a0, a1);
break;
case 61:
v0 = bash_glob_list_expansions(a0, a1);
break;
case 92:
v0 = bash_glob_complete_word(a0, a1);
break;
default:
v0 = rl_complete(0x0, a1);
break;
}
switch (a1) {
case 42:
case 92:
rl_vi_start_inserting(a1, 0x1, 0x1);
default:
goto LABEL_40863a;
}
LABEL_40863a:
return v0;
} | bash | angr_sailr |
static void deferred_configure_ghost_conffile(struct pkginfo *pkg,
struct conffile *conff) {
struct pkginfo *otherpkg;
struct conffile *otherconff;
for (otherpkg = &pkg->set->pkg; otherpkg; otherpkg = otherpkg->arch_next) {
if (otherpkg == pkg)
continue;
if (otherpkg->status <= PKG_STAT_HALFCONFIGURED)
continue;
for (otherconff = otherpkg->installed.conffiles; otherconff;
otherconff = otherconff->next) {
if (otherconff->obsolete || otherconff->remove_on_upgrade)
continue;
if (strcmp(otherconff->name, conff->name) == 0) {
conff->hash = otherconff->hash;
modstatdb_note(pkg);
return;
}
}
}
} | void deferred_configure_ghost_conffile(long *param_1, long param_2)
{
int iVar1;
long *local_18;
undefined8 *local_10;
local_18 = (long *)(*param_1 + 0x10);
do {
if (local_18 == (long *)0x0) {
return;
}
if ((local_18 != param_1) && (4 < *(uint *)(local_18 + 3))) {
for (local_10 = (undefined8 *)local_18[0x16];
local_10 != (undefined8 *)0x0; local_10 = (undefined8 *)*local_10) {
if (((*(char *)(local_10 + 3) == '\0') &&
(*(char *)((long)local_10 + 0x19) == '\0')) &&
(iVar1 = strcmp((char *)local_10[1], *(char **)(param_2 + 8)),
iVar1 == 0)) {
*(undefined8 *)(param_2 + 0x10) = local_10[2];
modstatdb_note(param_1);
return;
}
}
}
local_18 = (long *)local_18[1];
} while (true);
} | dpkg | ghidra |
static struct dns_response *parse_dns_response(const u_char *answer, int size) {
struct dns_response *resp;
const u_char *cp;
resp = calloc(1, sizeof(*resp));
if (resp == ((void *)0))
return (((void *)0));
cp = answer;
memcpy(&resp->header, cp, 12);
cp += 12;
resp->header.qdcount = ntohs(resp->header.qdcount);
resp->header.ancount = ntohs(resp->header.ancount);
resp->header.nscount = ntohs(resp->header.nscount);
resp->header.arcount = ntohs(resp->header.arcount);
if (resp->header.qdcount < 1) {
free_dns_response(resp);
return (((void *)0));
}
resp->query = parse_dns_qsection(answer, size, &cp, resp->header.qdcount);
if (resp->header.qdcount && resp->query == ((void *)0)) {
free_dns_response(resp);
return (((void *)0));
}
resp->answer = parse_dns_rrsection(answer, size, &cp, resp->header.ancount);
if (resp->header.ancount && resp->answer == ((void *)0)) {
free_dns_response(resp);
return (((void *)0));
}
resp->authority =
parse_dns_rrsection(answer, size, &cp, resp->header.nscount);
if (resp->header.nscount && resp->authority == ((void *)0)) {
free_dns_response(resp);
return (((void *)0));
}
resp->additional =
parse_dns_rrsection(answer, size, &cp, resp->header.arcount);
if (resp->header.arcount && resp->additional == ((void *)0)) {
free_dns_response(resp);
return (((void *)0));
}
return (resp);
} | int parse_dns_response(void *a0, unsigned long a1) {
unsigned long v0;
struct_0 *v1;
unsigned int v3;
v1 = calloc(0x1, 0x30);
if (!v1) {
v3 = 0;
} else {
v0 = a0;
memcpy(v1, v0, 0xc);
v0 += 12;
v1->field_4 = ntohs(v1->field_4);
v1->field_6 = ntohs(v1->field_6);
v1->field_8 = ntohs(v1->field_8);
v1->field_a = ntohs(v1->field_a);
if (!v1->field_4) {
free_dns_response(v1);
v3 = 0;
} else {
v1->field_10 = parse_dns_qsection(a0, a1, &v0, v1->field_4);
if (v1->field_4 && !v1->field_10) {
free_dns_response(v1);
v3 = 0;
goto LABEL_400a6f;
}
v1->field_18 = parse_dns_rrsection(a0, a1, &v0, v1->field_6);
if (v1->field_6 && !v1->field_18) {
free_dns_response(v1);
v3 = 0;
goto LABEL_400a6f;
}
v1->field_20 = parse_dns_rrsection(a0, a1, &v0, v1->field_8);
if (v1->field_8 && !v1->field_20) {
free_dns_response(v1);
v3 = 0;
goto LABEL_400a6f;
}
v1->field_28 = parse_dns_rrsection(a0, a1, &v0, v1->field_a);
if (v1->field_a && !v1->field_28) {
free_dns_response(v1);
v3 = 0;
goto LABEL_400a6f;
}
v3 = v1;
}
}
LABEL_400a6f:
return v3;
} | openssh-portable | angr_phoenix |
void rl_clear_history(void) {
HIST_ENTRY **hlist, *hent;
register int i;
UNDO_LIST *ul, *saved_undo_list;
saved_undo_list = rl_undo_list;
hlist = history_list();
for (i = 0; i < history_length; i++) {
hent = hlist[i];
if (ul = (UNDO_LIST *)hent->data) {
if (ul == saved_undo_list)
saved_undo_list = 0;
_rl_free_undo_list(ul);
hent->data = 0;
}
_rl_free_history_entry(hent);
}
history_offset = history_length = 0;
rl_undo_list = saved_undo_list;
} | void rl_clear_history(void)
{
long lVar1;
long lVar2;
long lVar3;
int iVar4;
long local_38;
local_38 = rl_undo_list;
lVar3 = history_list();
for (iVar4 = 0; iVar4 < history_length; iVar4 = iVar4 + 1) {
lVar1 = *(long *)(lVar3 + (long)iVar4 * 8);
lVar2 = *(long *)(lVar1 + 0x10);
if (lVar2 != 0) {
if (lVar2 == local_38) {
local_38 = 0;
}
_rl_free_undo_list(lVar2);
*(undefined8 *)(lVar1 + 0x10) = 0;
}
_rl_free_history_entry(lVar1);
}
rl_undo_list = local_38;
history_length = 0;
_history_offset = 0;
return;
} | bash | ghidra |
static char const *find_int(char const *string) {
char const *p;
char const *number_start;
for (p = string; ((*__ctype_b_loc())[(int)((to_uchar(*p)))] &
(unsigned short int)_ISblank);
p++)
continue;
if (*p == '+') {
p++;
number_start = p;
} else {
number_start = p;
p += (*p == '-');
}
if (((unsigned int)(*p++) - '0' <= 9)) {
while (((unsigned int)(*p) - '0' <= 9))
p++;
while (((*__ctype_b_loc())[(int)((to_uchar(*p)))] &
(unsigned short int)_ISblank))
p++;
if (!*p)
return number_start;
}
test_syntax_error(gettext("invalid integer %s"), quote(string));
} | int find_int(unsigned long long a0) {
char *v0;
int tmp_12;
char *v1;
unsigned short v4;
unsigned int v5;
unsigned int v6;
unsigned int v8;
v0 = a0;
while (true) {
v4 = *((to_uchar(*(v0)) * 2 + *(__ctype_b_loc())));
v5 = v4 & 1;
if (!v5)
break;
v0 += 1;
}
if (*(v0) == 43) {
v0 += 1;
v1 = v0;
} else {
v1 = v0;
v0 = &v0[*(v0) == 45];
}
tmp_12 = v0;
v0 += 1;
*(&v5) = *(tmp_12);
if (v6 <= 9) {
for (v6 = v5 - 48; *(v0)-48 <= 9; v0 += 1)
;
while (true) {
*(&v6) = *((to_uchar(*(v0)) * 2 + *(__ctype_b_loc())));
v8 = v6 & 1;
if (!v8)
break;
v0 += 1;
}
if (!*(v0))
return v1;
}
if (v6 > 9 || *(v0))
test_syntax_error(gettext("invalid integer %s"), quote(a0));
} | coreutils | angr_dream |
test_code_t test_tls1_1_fallback(gnutls_session_t session) {
int ret;
if (tls1_1_ok)
return TEST_IGNORE;
sprintf(prio_str,
"NONE:"
"+CIPHER-ALL:+ARCFOUR-128:+3DES-CBC"
":+GOST28147-TC26Z-CNT"
":"
"+COMP-NULL"
":+VERS-TLS1.1:+VERS-TLS1.0:+VERS-SSL3.0:"
"+MAC-ALL:+MD5:+SHA1"
":+GOST28147-TC26Z-IMIT"
":"
"+RSA:+DHE-RSA:+DHE-DSS:+ANON-DH:+ECDHE-RSA:+ECDHE-ECDSA:+ANON-ECDH"
":+VKO-GOST-12"
":%s",
rest);
{
int _ret;
if ((_ret = __gnutls_priority_set_direct(session, prio_str, 1183)) !=
TEST_SUCCEED) {
return _ret;
}
};
gnutls_credentials_set(session, GNUTLS_CRD_CERTIFICATE, xcred);
ret = test_do_handshake(session);
if (ret != TEST_SUCCEED)
return TEST_FAILED;
if (gnutls_protocol_get_version(session) == GNUTLS_TLS1)
return TEST_SUCCEED;
else if (gnutls_protocol_get_version(session) == GNUTLS_SSL3)
return TEST_UNSURE;
return TEST_FAILED;
} | long long test_tls1_1_fallback(unsigned long long a0) {
unsigned int v0;
unsigned int v1;
unsigned long long v3;
if (tls1_1_ok) {
v3 = 3;
} else {
sprintf(&prio_str,
"NONE:+CIPHER-ALL:+ARCFOUR-128:+3DES-CBC:+GOST28147-TC26Z-CNT:+"
"COMP-NULL:+VERS-TLS1.1:+VERS-TLS1.0:+VERS-SSL3.0:+MAC-ALL:+MD5:+"
"SHA1:+GOST28147-TC26Z-IMIT:+RSA:+DHE-RSA:+DHE-DSS:+ANON-DH:+ECDHE-"
"RSA:+ECDHE-ECDSA:+ANON-ECDH:+VKO-GOST-12:%s",
&rest);
v0 = __gnutls_priority_set_direct(a0, &prio_str, 0x49f);
if (v0) {
v3 = v0;
} else {
gnutls_credentials_set(a0, 0x1, xcred);
v1 = test_do_handshake(a0);
if (v1) {
v3 = 1;
} else if (gnutls_protocol_get_version(a0) == 2) {
v3 = 0;
} else if (gnutls_protocol_get_version(a0) == 1) {
v3 = 2;
} else {
v3 = 1;
}
}
}
return v3;
} | gnutls | angr_phoenix |
void e2fsck_clear_progbar(e2fsck_t ctx) {
if (!(ctx->flags & 0x0020))
return;
printf("%s%s\r%s", ctx->start_meta, spaces + (sizeof(spaces) - 80),
ctx->stop_meta);
fflush(stdout);
ctx->flags &= ~0x0020;
} | void e2fsck_clear_progbar(struct_0 *a0) {
unsigned long long v1;
struct_0 *v2;
v1 = a0->field_48 & 32;
if ((a0->field_48 & 32)) {
printf("%s%s\r%s", a0 + 732, &g_4069d0, a0 + 734);
fflush(stdout);
v2 = a0;
a0->field_48 = a0->field_48 & -33;
return;
}
return;
} | e2fsprogs-1.46.5 | angr_sailr |
void readline_internal_setup(void) {
char *nprompt;
_rl_in_stream = rl_instream;
_rl_out_stream = rl_outstream;
if (_rl_enable_meta & (rl_readline_state & (0x0000004)))
_rl_enable_meta_key();
run_startup_hooks();
rl_deactivate_mark();
if (rl_editing_mode == 0)
rl_vi_insertion_mode(1, 'i');
else
if (_rl_show_mode_in_prompt)
_rl_reset_prompt();
if (_rl_echoing_p == 0 && rl_redisplay_function == rl_redisplay) {
if (rl_prompt && rl_already_prompted == 0) {
nprompt = _rl_strip_prompt(rl_prompt);
fprintf(_rl_out_stream, "%s", nprompt);
fflush(_rl_out_stream);
xfree(nprompt);
}
} else {
if (rl_prompt && rl_already_prompted)
rl_on_new_line_with_prompt();
else
rl_on_new_line();
(*rl_redisplay_function)();
}
if (rl_pre_input_hook)
(*rl_pre_input_hook)();
do {
if (_rl_caught_signal)
_rl_signal_handler(_rl_caught_signal);
} while (0);
} | long long readline_internal_setup(unsigned long long a0, unsigned long long a1,
unsigned long long a2, unsigned long long a3,
unsigned long long a4,
unsigned long long a5) {
unsigned long long v0;
unsigned long long v2;
_rl_dispatching_keymap = rl_instream;
_rl_dispatching_keymap = rl_outstream;
if (((rl_readline_state & _rl_enable_meta) & 4))
_rl_enable_meta_key();
run_startup_hooks();
rl_deactivate_mark(a0, a1, _rl_enable_meta, a3, a4, a5);
if (!rl_editing_mode) {
rl_vi_insertion_mode(0x1, 0x69);
} else if (_rl_show_mode_in_prompt) {
_rl_reset_prompt();
}
if (!_rl_echoing_p && rl_redisplay_function == got.rl_redisplay) {
if (*(&rl_prompt) && !*(&rl_already_prompted)) {
v0 = _rl_strip_prompt(*(&rl_prompt));
fprintf(0xf87d894810ec8348, "%s", v0);
fflush(0xf87d894810ec8348);
xfree(v0);
}
goto LABEL_400291;
}
if (*(&rl_prompt) && *(&rl_already_prompted)) {
rl_on_new_line_with_prompt();
goto LABEL_400285;
}
rl_on_new_line();
LABEL_400285:
*(5243008)(1, 105, a2, a3, a4, a5);
LABEL_400291:
if (rl_pre_input_hook)
*(4202880)();
v2 = _rl_caught_signal;
if (_rl_caught_signal)
v2 = _rl_signal_handler(_rl_caught_signal);
return v2;
} | bash | angr_phoenix |
static void Rounded_decode(Fq *r, const unsigned char *s) {
crypto_uint16 R[761], M[761];
int i;
for (i = 0; i < 761; ++i)
M[i] = (4591 + 2) / 3;
Decode(R, s, M, 761);
for (i = 0; i < 761; ++i)
r[i] = R[i] * 3 - ((4591 - 1) / 2);
} | void Rounded_decode(unsigned short *a0, unsigned long long a1,
unsigned long long a2) {
unsigned int v0;
char v1;
char v2;
char v3;
unsigned long long *v5;
unsigned long long v6;
for (v0 = 0; v0 <= 760; v0 = __addvsi3(v0, 0x1, a2)) {
*(&(&v2)[2 * v0]) = 1531;
}
Decode(&v1, a1, &v2, 0x2f9);
for (v0 = 0; v0 <= 760;
v0 = __addvsi3(v0, 0x1, *(&(&v1)[2 * v0]) * 3 - 2295)) {
a0[v0] = *(&(&v1)[2 * v0]) * 3 - 2295;
}
v6 = *(&v3) ^ v5[5];
return;
} | openssh-portable | angr_phoenix |
int killcmd(argc, argv)
int argc;
char **argv;
{
int signo = -1;
int list = 0;
int i;
pid_t pid;
struct job *jp;
if (argc <= 1) {
usage:
sh_error("Usage: kill [-s sigspec | -signum | -sigspec] [pid | job]... or\n"
"kill -l [exitstatus]");
}
if (**++argv == '-') {
signo = decode_signal(*argv + 1, 1);
if (signo < 0) {
int c;
while ((c = nextopt("ls:")) != '\0')
switch (c) {
default:
case 'l':
list = 1;
break;
case 's':
signo = decode_signal(optionarg, 1);
if (signo < 0) {
sh_error("invalid signal number or name: %s", optionarg);
}
break;
}
argv = argptr;
} else
argv++;
}
if (!list && signo < 0)
signo = 15;
if ((signo < 0 || !*argv) ^ list) {
goto usage;
}
if (list) {
struct output *out;
out = out1;
if (!*argv) {
outstr("0\n", out);
for (i = 1; i < (64 + 1); i++) {
outfmt(out, snlfmt, signal_names[i]);
}
return 0;
}
signo = number(*argv);
if (signo > 128)
signo -= 128;
if (0 < signo && signo < (64 + 1))
outfmt(out, snlfmt, signal_names[signo]);
else
sh_error("invalid signal number or exit status: %s", *argv);
return 0;
}
i = 0;
do {
if (**argv == '%') {
jp = getjob(*argv, 0);
pid = -jp->ps[0].pid;
} else
pid = **argv == '-' ? -number(*argv + 1) : number(*argv);
if (kill(pid, signo) != 0) {
sh_warnx("%s\n", strerror((*dash_errno)));
i = 1;
}
} while (*++argv);
return i;
} | long killcmd(int a1, const char **a2) {
int v2;
int v4;
__pid_t v5;
char *v6;
int sig;
int v9;
int i;
unsigned int v11;
int pid;
int v13;
long v14;
sig = -1;
v9 = 0;
if (a1 > 1)
goto LABEL_3;
do {
sh_error("Usage: kill [-s sigspec | -signum | -sigspec] [pid | job]... "
"or\nkill -l [exitstatus]");
LABEL_3:
if (**++a2 == 45) {
sig = decode_signal(*a2 + 1, 1LL);
if (sig >= 0) {
++a2;
} else {
while (1) {
v13 = nextopt("ls:");
if (!v13)
break;
if (v13 == 115) {
sig = decode_signal(optionarg, 1LL);
if (sig < 0)
sh_error("invalid signal number or name: %s", optionarg);
} else {
v9 = 1;
}
}
a2 = (const char **)argptr;
}
}
if (!v9 && sig < 0)
sig = 15;
v2 = sig < 0 || !*a2;
} while (v2 != v9);
if (v9) {
v14 = out1;
if (!*a2) {
outstr("0\n", out1);
for (i = 1; i <= 64; ++i)
outfmt(v14, (const char *)&snlfmt, signal_names[i]);
return 0LL;
}
sig = number(*a2);
if (sig > 128)
sig -= 128;
if (sig > 0 && sig <= 64) {
outfmt(v14, (const char *)&snlfmt, signal_names[sig]);
return 0LL;
}
sh_error("invalid signal number or exit status: %s", *a2);
}
v11 = 0;
do {
if (**a2 == 37) {
pid = -**(_DWORD **)(getjob(*a2, 0) + 16);
v4 = kill(pid, sig);
} else {
if (**a2 == 45)
v5 = -(int)number(*a2 + 1);
else
v5 = number(*a2);
v4 = kill(v5, sig);
}
if (v4) {
v6 = strerror(*dash_errno);
sh_warnx("%s\n", v6);
v11 = 1;
}
++a2;
} while (*a2);
return v11;
} | dash-0.5.11+git20210903+057cd650a4ed | ida |
static void cmd_parser(int argc, char **argv) {
int ret, privkey_op = 0;
common_info_st cinfo;
const char *proto = "tcp";
char service[32] = "443";
process_options(argc, argv);
if (danetool_options.present.outfile) {
outfile = safe_open_rw(danetool_options.arg.outfile, privkey_op);
if (outfile == ((void *)0)) {
fprintf(stderr, "%s", danetool_options.arg.outfile);
app_exit(1);
}
outfile_name = danetool_options.arg.outfile;
} else
outfile = stdout;
default_dig = GNUTLS_DIG_UNKNOWN;
if (danetool_options.present.hash) {
if (strcasecmp(danetool_options.arg.hash, "md5") == 0) {
fprintf(stderr, "Warning: MD5 is broken, and should not be used any more "
"for digital signatures.\n");
default_dig = GNUTLS_DIG_MD5;
} else if (strcasecmp(danetool_options.arg.hash, "sha1") == 0)
default_dig = GNUTLS_DIG_SHA1;
else if (strcasecmp(danetool_options.arg.hash, "sha256") == 0)
default_dig = GNUTLS_DIG_SHA256;
else if (strcasecmp(danetool_options.arg.hash, "sha224") == 0)
default_dig = GNUTLS_DIG_SHA224;
else if (strcasecmp(danetool_options.arg.hash, "sha384") == 0)
default_dig = GNUTLS_DIG_SHA384;
else if (strcasecmp(danetool_options.arg.hash, "sha512") == 0)
default_dig = GNUTLS_DIG_SHA512;
else if (strcasecmp(danetool_options.arg.hash, "rmd160") == 0)
default_dig = GNUTLS_DIG_RMD160;
else {
fprintf(stderr, "invalid hash: %s", danetool_options.arg.hash);
app_exit(1);
}
}
gnutls_global_set_log_function(tls_log_func);
if (danetool_options.present.debug) {
gnutls_global_set_log_level(danetool_options.value.debug);
printf("Setting log level to %d\n", (int)danetool_options.value.debug);
}
if ((ret = gnutls_global_init()) < 0) {
fprintf(stderr, "global_init: %s", gnutls_strerror(ret));
app_exit(1);
}
pkcs11_common(((void *)0));
memset(&cinfo, 0, sizeof(cinfo));
if (danetool_options.present.inder)
cinfo.incert_format = GNUTLS_X509_FMT_DER;
else
cinfo.incert_format = GNUTLS_X509_FMT_PEM;
if (danetool_options.present.verbose)
cinfo.verbose = 1;
if (danetool_options.present.load_pubkey)
cinfo.pubkey = danetool_options.arg.load_pubkey;
if (danetool_options.present.load_certificate)
cinfo.cert = danetool_options.arg.load_certificate;
if (danetool_options.present.port) {
snprintf(service, sizeof(service), "%s", danetool_options.arg.port);
} else {
if (danetool_options.present.starttls_proto)
snprintf(service, sizeof(service), "%s",
starttls_proto_to_service(danetool_options.arg.starttls_proto));
}
if (danetool_options.present.proto)
proto = danetool_options.arg.proto;
if (danetool_options.present.tlsa_rr)
dane_info(danetool_options.arg.host, proto, service,
danetool_options.present.ca, danetool_options.enabled.domain,
&cinfo);
else if (danetool_options.present.check)
dane_check(danetool_options.arg.check, proto, service, &cinfo);
else
usage(stdout, (1));
fclose(outfile);
gnutls_pkcs11_deinit();
gnutls_global_deinit();
} | void cmd_parser(undefined4 param_1, undefined8 param_2)
{
int iVar1;
undefined8 uVar2;
long in_FS_OFFSET;
undefined *local_120;
undefined local_118[16];
undefined8 local_108;
uint local_fc;
undefined8 local_f0;
undefined4 local_54;
undefined8 local_38;
undefined8 local_30;
undefined8 local_28;
undefined8 local_20;
long local_10;
local_10 = *(long *)(in_FS_OFFSET + 0x28);
local_120 = &DAT_00101cea;
local_38 = 0x333434;
local_30 = 0;
local_28 = 0;
local_20 = 0;
process_options(param_1, param_2);
if (DAT_0010304a == '\0') {
outfile = (FILE *)CONCAT44(_DAT_0010305c, _stdout);
} else {
outfile = (FILE *)safe_open_rw(_gnutls_global_set_log_level, 0);
if (outfile == (FILE *)0x0) {
fprintf(stderr, "%s", _gnutls_global_set_log_level);
app_exit(1);
}
outfile_name = _gnutls_global_set_log_level;
}
default_dig = 0;
if (DAT_0010304e != '\0') {
iVar1 = strcasecmp(_pkcs11_common, "md5");
if (iVar1 == 0) {
fprintf(stderr, "Warning: MD5 is broken, and should not be used any more "
"for digital signatures.\n");
default_dig = 2;
} else {
iVar1 = strcasecmp(_pkcs11_common, "sha1");
if (iVar1 == 0) {
default_dig = 3;
} else {
iVar1 = strcasecmp(_pkcs11_common, "sha256");
if (iVar1 == 0) {
default_dig = 6;
} else {
iVar1 = strcasecmp(_pkcs11_common, "sha224");
if (iVar1 == 0) {
default_dig = 9;
} else {
iVar1 = strcasecmp(_pkcs11_common, "sha384");
if (iVar1 == 0) {
default_dig = 7;
} else {
iVar1 = strcasecmp(_pkcs11_common, "sha512");
if (iVar1 == 0) {
default_dig = 8;
} else {
iVar1 = strcasecmp(_pkcs11_common, "rmd160");
if (iVar1 != 0) {
fprintf(stderr, "invalid hash: %s", _pkcs11_common);
app_exit(1);
}
default_dig = 4;
}
}
}
}
}
}
}
gnutls_global_set_log_function(tls_log_func);
if (danetool_options != '\0') {
gnutls_global_set_log_level(_gnutls_global_deinit);
printf("Setting log level to %d\n", (ulong)_gnutls_global_deinit);
}
iVar1 = gnutls_global_init();
if (iVar1 < 0) {
uVar2 = gnutls_strerror(iVar1);
fprintf(stderr, "global_init: %s", uVar2);
app_exit(1);
}
pkcs11_common(0);
memset(local_118, 0, 0xd8);
local_fc = (uint)((char)_DAT_0010305c == '\0');
if (DAT_00103049 != '\0') {
local_54 = 1;
}
if (DAT_0010304b != '\0') {
local_108 = _printf;
}
if (DAT_0010304c != '\0') {
local_f0 = _gnutls_global_init;
}
if (DAT_00103055 == '\0') {
if (DAT_00103056 != '\0') {
uVar2 = starttls_proto_to_service(_fclose);
snprintf((char *)&local_38, 0x20, "%s", uVar2);
}
} else {
snprintf((char *)&local_38, 0x20, "%s", _usage);
}
if (DAT_00103054 != '\0') {
local_120 = _starttls_proto_to_service;
}
if (DAT_00103052 == '\0') {
if (DAT_0010304f == '\0') {
usage(CONCAT44(_DAT_0010305c, _stdout), 1);
} else {
dane_check(_memset, local_120, &local_38, local_118);
}
} else {
dane_info(_snprintf, local_120, &local_38, DAT_00103057, DAT_001030dd,
local_118);
}
fclose(outfile);
gnutls_pkcs11_deinit();
gnutls_global_deinit();
if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) {
__stack_chk_fail();
}
return;
} | gnutls | ghidra |
search_end(EditLine *el) {
free(el->el_search.patbuf);
el->el_search.patbuf = ((void *)0);
} | long long search_end(struct_0 *a0) {
free(a0->field_498);
a0->field_498 = 0;
return a0;
} | libedit | 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(char *a0, char *a1) {
char *v0;
char v1;
unsigned long long v2;
unsigned long long v4;
v2 = *(&v2);
v0 = readlink(a1, &v1, 0x1000);
if (v0 > 0) {
*((v0 + &v1)) = 0;
v4 = history_rename(a0, &v1);
} else {
v4 = history_rename(a0, a1);
}
return v4;
} | bash | angr_dream |
static int do_chflags(const char *dev, __u32 flags, __u32 mask) {
struct ifreq ifr;
int fd;
int err;
strlcpy(ifr.ifr_ifrn.ifrn_name, dev, 16);
fd = get_ctl_fd();
if (fd < 0)
return -1;
err = ioctl(fd, 0x8913, &ifr);
if (err) {
perror("SIOCGIFFLAGS");
close(fd);
return -1;
}
if ((ifr.ifr_ifru.ifru_flags ^ flags) & mask) {
ifr.ifr_ifru.ifru_flags &= ~mask;
ifr.ifr_ifru.ifru_flags |= mask & flags;
err = ioctl(fd, 0x8914, &ifr);
if (err)
perror("SIOCSIFFLAGS");
}
close(fd);
return err;
} | void do_chflags(unsigned long long a0, unsigned long a1, unsigned long a2) {
unsigned int v0;
unsigned int v1;
unsigned int v2;
char v3;
unsigned short v4;
unsigned long long v6;
unsigned long long v7;
unsigned long long v8;
v0 = a2;
strlcpy(&v3, a0, 0x10, a0);
v2 = get_ctl_fd();
if (v2 < 0) {
v6 = 4294967295;
} else {
v1 = ioctl(v2, 0x8913);
if (v1) {
perror("SIOCGIFFLAGS");
close(v2);
v7 = 4294967295;
} else {
if (((*(&v4) ^ a1) & a2)) {
v4 = !(v0) & *(&v4);
v4 = a1 & a2 | *(&v4);
v1 = ioctl(v2, 0x8914);
if (v1)
perror("SIOCSIFFLAGS");
}
close(v2);
v8 = v1;
}
}
return;
} | iproute2-6.0.0 | angr_dream |
int main(int argc, char **argv) {
char *wd;
_Bool logical = (getenv("POSIXLY_CORRECT") != ((void *)0));
;
set_program_name(argv[0]);
setlocale(6, "");
bindtextdomain("coreutils", "/usr/local/share/locale");
textdomain("coreutils");
atexit(close_stdout);
while (1) {
int c = getopt_long(argc, argv, "LP", longopts, ((void *)0));
if (c == -1)
break;
switch (c) {
case 'L':
logical = 1;
break;
case 'P':
logical = 0;
break;
case GETOPT_HELP_CHAR:
usage(0);
break;
;
case GETOPT_VERSION_CHAR:
version_etc(stdout, "pwd", "GNU coreutils", Version, ("Jim Meyering"),
(char *)((void *)0));
exit(0);
break;
;
default:
usage(1);
}
}
if (optind < argc)
error(0, 0, gettext("ignoring non-option arguments"));
if (logical) {
wd = logical_getcwd();
if (wd) {
puts(wd);
return 0;
}
}
wd = xgetcwd();
if (wd != ((void *)0)) {
puts(wd);
free(wd);
} else {
struct file_name *file_name = file_name_init();
robust_getcwd(file_name);
puts(file_name->start);
file_name_free(file_name);
}
return 0;
} | int main(int argc, const char **argv, const char **envp) {
char *v3;
bool v5;
int v6;
const char *s;
char *sa;
void **v9;
v5 = getenv("POSIXLY_CORRECT") != 0LL;
set_program_name(*argv);
setlocale(6, locale);
bindtextdomain("coreutils", "/usr/local/share/locale");
textdomain("coreutils");
atexit((void (*)(void))&close_stdout);
while (1) {
v6 = getopt_long(argc, (char *const *)argv, "LP", &longopts, 0LL);
if (v6 == -1)
break;
if (v6 == 80) {
v5 = 0;
} else {
if (v6 > 80)
goto LABEL_14;
if (v6 != 76) {
if (v6 <= 76) {
if (v6 == -131) {
version_etc(stdout, "pwd", "GNU coreutils", Version, "Jim Meyering",
0LL);
exit(0);
}
if (v6 == -130)
usage(0);
}
LABEL_14:
usage(1);
}
v5 = 1;
}
}
if (argc > optind) {
v3 = gettext("ignoring non-option arguments");
error(0, 0, v3);
}
if (v5 && (s = logical_getcwd()) != 0LL) {
puts(s);
return 0;
} else {
sa = (char *)xgetcwd();
if (sa) {
puts(sa);
free(sa);
} else {
v9 = (void **)file_name_init();
robust_getcwd((long)v9);
puts((const char *)v9[2]);
file_name_free(v9);
}
return 0;
}
} | coreutils | ida |
static inline int patmatch(char *pattern, const char *string) {
return !fnmatch((preglob(pattern, 0)), (string), 0);
} | int patmatch(unsigned long a0, char *a1) {
return !fnmatch(preglob(a0, 0x0), a1, 0x0);
} | dash-0.5.11+git20210903+057cd650a4ed | angr_dream |
static void flush(void) {} | void flush(void)
{
return;
} | bash | ghidra |
void initialize_server_options(ServerOptions *options) {
memset(options, 0, sizeof(*options));
options->use_pam = -1;
options->num_ports = 0;
options->ports_from_cmdline = 0;
options->queued_listen_addrs = ((void *)0);
options->num_queued_listens = 0;
options->listen_addrs = ((void *)0);
options->num_listen_addrs = 0;
options->address_family = -1;
options->routing_domain = ((void *)0);
options->num_host_key_files = 0;
options->num_host_cert_files = 0;
options->host_key_agent = ((void *)0);
options->pid_file = ((void *)0);
options->login_grace_time = -1;
options->permit_root_login = -1;
options->ignore_rhosts = -1;
options->ignore_user_known_hosts = -1;
options->print_motd = -1;
options->print_lastlog = -1;
options->x11_forwarding = -1;
options->x11_display_offset = -1;
options->x11_use_localhost = -1;
options->permit_tty = -1;
options->permit_user_rc = -1;
options->xauth_location = ((void *)0);
options->strict_modes = -1;
options->tcp_keep_alive = -1;
options->log_facility = SYSLOG_FACILITY_NOT_SET;
options->log_level = SYSLOG_LEVEL_NOT_SET;
options->num_log_verbose = 0;
options->log_verbose = ((void *)0);
options->hostbased_authentication = -1;
options->hostbased_uses_name_from_packet_only = -1;
options->hostbased_accepted_algos = ((void *)0);
options->hostkeyalgorithms = ((void *)0);
options->pubkey_authentication = -1;
options->pubkey_auth_options = -1;
options->pubkey_accepted_algos = ((void *)0);
options->kerberos_authentication = -1;
options->kerberos_or_local_passwd = -1;
options->kerberos_ticket_cleanup = -1;
options->kerberos_get_afs_token = -1;
options->gss_authentication = -1;
options->gss_cleanup_creds = -1;
options->gss_strict_acceptor = -1;
options->password_authentication = -1;
options->kbd_interactive_authentication = -1;
options->permit_empty_passwd = -1;
options->permit_user_env = -1;
options->permit_user_env_allowlist = ((void *)0);
options->compression = -1;
options->rekey_limit = -1;
options->rekey_interval = -1;
options->allow_tcp_forwarding = -1;
options->allow_streamlocal_forwarding = -1;
options->allow_agent_forwarding = -1;
options->num_allow_users = 0;
options->num_deny_users = 0;
options->num_allow_groups = 0;
options->num_deny_groups = 0;
options->ciphers = ((void *)0);
options->macs = ((void *)0);
options->kex_algorithms = ((void *)0);
options->ca_sign_algorithms = ((void *)0);
options->fwd_opts.gateway_ports = -1;
options->fwd_opts.streamlocal_bind_mask = (mode_t)-1;
options->fwd_opts.streamlocal_bind_unlink = -1;
options->num_subsystems = 0;
options->max_startups_begin = -1;
options->max_startups_rate = -1;
options->max_startups = -1;
options->per_source_max_startups = -1;
options->per_source_masklen_ipv4 = -1;
options->per_source_masklen_ipv6 = -1;
options->max_authtries = -1;
options->max_sessions = -1;
options->banner = ((void *)0);
options->use_dns = -1;
options->client_alive_interval = -1;
options->client_alive_count_max = -1;
options->num_authkeys_files = 0;
options->num_accept_env = 0;
options->num_setenv = 0;
options->permit_tun = -1;
options->permitted_opens = ((void *)0);
options->permitted_listens = ((void *)0);
options->adm_forced_command = ((void *)0);
options->chroot_directory = ((void *)0);
options->authorized_keys_command = ((void *)0);
options->authorized_keys_command_user = ((void *)0);
options->revoked_keys_file = ((void *)0);
options->sk_provider = ((void *)0);
options->trusted_user_ca_keys = ((void *)0);
options->authorized_principals_file = ((void *)0);
options->authorized_principals_command = ((void *)0);
options->authorized_principals_command_user = ((void *)0);
options->ip_qos_interactive = -1;
options->ip_qos_bulk = -1;
options->version_addendum = ((void *)0);
options->fingerprint_hash = -1;
options->disable_forwarding = -1;
options->expose_userauth_info = -1;
options->required_rsa_size = -1;
} | void initialize_server_options(struct_0 *a0) {
struct_0 *v1;
memset(a0, 0x0, 0x1ec8);
a0->field_1e18 = -1;
a0->field_0 = 0;
a0->field_4 = 0;
a0->field_408 = 0;
a0->field_410 = 0;
a0->field_418 = 0;
a0->field_420 = 0;
a0->field_424 = -1;
a0->field_428 = 0;
a0->field_440 = 0;
a0->field_450 = 0;
a0->field_458 = 0;
a0->field_460 = 0;
a0->field_470 = -1;
a0->field_474 = -1;
a0->field_478 = -1;
a0->field_47c = -1;
a0->field_480 = -1;
a0->field_484 = -1;
a0->field_488 = -1;
a0->field_48c = -1;
a0->field_490 = -1;
a0->field_4a0 = -1;
a0->field_4a4 = -1;
a0->field_498 = 0;
a0->field_4a8 = -1;
a0->field_4ac = -1;
a0->field_4dc = -1;
a0->field_4e0 = -1;
a0->field_4e4 = 0;
a0->field_4e8 = 0;
a0->field_4f0 = -1;
a0->field_4f4 = -1;
a0->field_4f8 = 0;
a0->field_500 = 0;
a0->field_510 = -1;
a0->field_520 = -1;
a0->field_518 = 0;
a0->field_524 = -1;
a0->field_528 = -1;
a0->field_52c = -1;
a0->field_530 = -1;
a0->field_534 = -1;
a0->field_538 = -1;
a0->field_53c = -1;
a0->field_540 = -1;
a0->field_544 = -1;
a0->field_548 = -1;
a0->field_54c = -1;
a0->field_550 = 0;
a0->field_558 = -1;
a0->field_1e80 = -1;
a0->field_1e88 = -1;
a0->field_55c = -1;
a0->field_560 = -1;
a0->field_564 = -1;
a0->field_56c = 0;
a0->field_578 = 0;
a0->field_588 = 0;
a0->field_598 = 0;
a0->field_4b8 = 0;
a0->field_4c0 = 0;
a0->field_4c8 = 0;
a0->field_508 = 0;
a0->field_4d0 = -1;
a0->field_4d4 = -1;
a0->field_4d8 = -1;
a0->field_5a8 = 0;
a0->field_1dd0 = -1;
a0->field_1dd4 = -1;
a0->field_1dd8 = -1;
a0->field_1ddc = -1;
a0->field_1de0 = -1;
a0->field_1de4 = -1;
a0->field_1de8 = -1;
a0->field_1dec = -1;
a0->field_1df0 = 0;
a0->field_1df8 = -1;
a0->field_1dfc = -1;
a0->field_1e00 = -1;
a0->field_1e04 = 0;
a0->field_1db0 = 0;
a0->field_1dc0 = 0;
a0->field_1e1c = -1;
a0->field_1e20 = 0;
a0->field_1e30 = 0;
a0->field_1e10 = 0;
a0->field_1e40 = 0;
a0->field_1e58 = 0;
a0->field_1e60 = 0;
a0->field_1e48 = 0;
a0->field_1eb8 = 0;
a0->field_1e50 = 0;
a0->field_1e68 = 0;
a0->field_1e70 = 0;
a0->field_1e78 = 0;
a0->field_4b0 = -1;
a0->field_4b4 = -1;
a0->field_1e90 = 0;
a0->field_1ea8 = -1;
a0->field_568 = -1;
a0->field_1eac = -1;
v1 = a0;
a0->field_1ec0 = -1;
return;
} | openssh-portable | angr_phoenix |
static void xfields(struct line *line) {
char *ptr = line->buf.buffer;
char const *lim = ptr + line->buf.length - 1;
if (ptr == lim)
return;
if (0 <= tab && tab != '\n') {
char *sep;
for (; (sep = memchr(ptr, tab, lim - ptr)) != ((void *)0); ptr = sep + 1)
extract_field(line, ptr, sep - ptr);
} else if (tab < 0) {
while (field_sep(*ptr))
if (++ptr == lim)
return;
do {
char *sep;
for (sep = ptr + 1; sep != lim && !field_sep(*sep); sep++)
continue;
extract_field(line, ptr, sep - ptr);
if (sep == lim)
return;
for (ptr = sep + 1; ptr != lim && field_sep(*ptr); ptr++)
continue;
} while (ptr != lim);
}
extract_field(line, ptr, lim - ptr);
} | unsigned char *xfields(_QWORD *a1) {
long v1;
unsigned char *result;
unsigned char *s;
unsigned char *i;
unsigned char *v5;
char *v6;
s = (unsigned char *)a1[2];
v1 = a1[1] - 1LL;
v5 = &s[v1];
result = s;
if (s != &s[v1]) {
if (tab >= 0 && tab != 10) {
while (1) {
v6 = (char *)memchr(s, tab, v5 - s);
if (!v6)
break;
extract_field(a1, (long)s, v6 - (char *)s);
s = (unsigned char *)(v6 + 1);
}
return (unsigned char *)extract_field(a1, (long)s, v5 - s);
}
if (tab >= 0)
return (unsigned char *)extract_field(a1, (long)s, v5 - s);
while (field_sep(*s)) {
result = ++s;
if (s == v5)
return result;
}
while (1) {
for (i = s + 1; i != v5 && !field_sep(*i); ++i)
;
extract_field(a1, (long)s, i - s);
result = i;
if (i == v5)
break;
for (s = i + 1; s != v5 && field_sep(*s); ++s)
;
if (s == v5)
return (unsigned char *)extract_field(a1, (long)s, v5 - s);
}
}
return result;
} | coreutils | ida |
static __inline void _rs_rekey(unsigned char *dat, size_t datlen) {
chacha_encrypt_bytes(&rsx->rs_chacha, rsx->rs_buf, rsx->rs_buf,
sizeof(rsx->rs_buf));
if (dat) {
size_t i, m;
m = ((datlen) < (32 + 8) ? (datlen) : (32 + 8));
for (i = 0; i < m; i++)
rsx->rs_buf[i] ^= dat[i];
}
_rs_init(rsx->rs_buf, 32 + 8);
memset(rsx->rs_buf, 0, 32 + 8);
rs->rs_have = sizeof(rsx->rs_buf) - 32 - 8;
} | void _rs_rekey(long param_1, ulong param_2)
{
ulong uVar1;
ulong local_18;
chacha_encrypt_bytes(rsx, rsx + 0x40, rsx + 0x40);
if (param_1 != 0) {
uVar1 = 0x28;
if (param_2 < 0x29) {
uVar1 = param_2;
}
for (local_18 = 0; local_18 < uVar1; local_18 = local_18 + 1) {
*(byte *)(local_18 + rsx + 0x40) =
*(byte *)(local_18 + rsx + 0x40) ^ *(byte *)(local_18 + param_1);
}
}
_rs_init(rsx + 0x40, 0x28);
memset((void *)(rsx + 0x40), 0, 0x28);
*rs = 0x3d8;
return;
} | libbsd-0.11.7 | ghidra |
static void print_proto_down(FILE *f, struct rtattr *tb[]) {
struct rtattr *preason[IFLA_PROTO_DOWN_REASON_MAX + 1];
if (tb[IFLA_PROTO_DOWN]) {
if (rta_getattr_u8(tb[IFLA_PROTO_DOWN]))
print_bool(PRINT_ANY, "proto_down", " protodown on ", 1);
}
if (tb[IFLA_PROTO_DOWN_REASON]) {
char buf[255];
__u32 reason;
int i, start = 1;
(parse_rtattr_flags(
(preason), (IFLA_PROTO_DOWN_REASON_MAX),
((void *)(((char *)(tb[IFLA_PROTO_DOWN_REASON])) +
((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0)))),
((int)((tb[IFLA_PROTO_DOWN_REASON])->rta_len) -
((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0))),
(1 << 15)));
if (!tb[IFLA_PROTO_DOWN_REASON_VALUE])
return;
reason = rta_getattr_u8(preason[IFLA_PROTO_DOWN_REASON_VALUE]);
if (!reason)
return;
open_json_array(PRINT_ANY, is_json_context() ? "proto_down_reason"
: "protodown_reason <");
for (i = 0; reason; i++, reason >>= 1) {
if (reason & 0x1) {
if (protodown_reason_n2a(i, buf, sizeof(buf)))
break;
print_string(PRINT_ANY, ((void *)0), start ? "%s" : ",%s", buf);
start = 0;
}
}
close_json_array(PRINT_ANY, ">");
}
} | unsigned long print_proto_down(long a1, _QWORD *a2) {
long v2;
unsigned char v3;
const char *v4;
const char *v5;
unsigned int v7;
unsigned int v8;
int v9;
char v10[16];
long v11;
char v12[264];
unsigned long v13;
v13 = __readfsqword(0x28u);
if (a2[39] && (unsigned char)rta_getattr_u8(a2[39]))
print_bool(4u, (long)"proto_down", (long)" protodown on ", 1u);
if (a2[55]) {
v9 = 1;
parse_rtattr_flags(v10, 2LL, a2[55] + 4LL,
(unsigned int)*(unsigned short *)a2[55] - 4, 0x8000LL);
if (a2[2]) {
v2 = v11;
v3 = rta_getattr_u8(v11);
v7 = v3;
if (v3) {
if ((unsigned char)is_json_context(v2))
v4 = "proto_down_reason";
else
v4 = "protodown_reason <";
open_json_array(4LL, v4);
v8 = 0;
while (v7) {
if ((v7 & 1) != 0) {
if ((unsigned int)protodown_reason_n2a(v8, v12, 255LL))
break;
if (v9)
v5 = "%s";
else
v5 = ",%s";
print_string(4u, 0LL, v5, (long)v12);
v9 = 0;
}
++v8;
v7 >>= 1;
}
close_json_array(4LL, ">");
}
}
}
return __readfsqword(0x28u) ^ v13;
} | iproute2-6.0.0 | ida |
static int64_t read_int_with_default(const char *input_str, long def) {
char *endptr;
int64_t l;
static char input[512];
fprintf(stderr, input_str, def);
if (fgets(input, sizeof(input), stdin) == ((void *)0))
return def;
if (((input[0] == '\n') || (input[0] == '\r')))
return def;
l = strtol(input, &endptr, 0);
if (*endptr != '\0' && *endptr != '\r' && *endptr != '\n') {
fprintf(stderr, "Trailing garbage ignored: `%s'\n", endptr);
return 0;
} else {
*endptr = 0;
}
if (l <= (-0x7fffffffffffffffL - 1L) || l >= 0x7fffffffffffffffL) {
fprintf(stderr, "Integer out of range: `%s' (max: %lu)\n", input,
0x7fffffffffffffffL - 1);
return 0;
}
if (input == endptr)
l = def;
return l;
} | void read_int_with_default(char *param_1, undefined8 param_2)
{
fprintf(*ppFRam000000000010463c, param_1, param_2);
} | gnutls | ghidra |
void array_dispose(a) ARRAY *a;
{
if (a == 0)
return;
array_flush(a);
array_dispose_element(a->head);
sh_xfree((a), "array.c", 123);
} | void array_dispose(struct_0 *a0) {
unsigned long long v1;
if (a0) {
array_flush(a0);
array_dispose_element(a0->field_10);
v1 = sh_xfree(a0, "array.c", 0x7b);
}
return;
} | bash | angr_dream |
static int history_getsize(HistoryW *h, HistEventW *ev) {
if (h->h_next != history_def_next) {
{
ev->num = 14;
ev->str = he_errlist[14];
};
return -1;
}
ev->num = (((history_t *)h->h_ref)->cur);
if (ev->num < -1) {
{
ev->num = 13;
ev->str = he_errlist[13];
};
return -1;
}
return 0;
} | int history_getsize(struct_0 *a0, struct_2 *a1) {
unsigned int v1;
if (a0->field_18 != history_def_next) {
a1->field_0 = 14;
a1->field_8 = "f";
v1 = -1;
return v1;
}
a1->field_0 = a0->field_0->field_34;
if (a1->field_0 >= -1) {
v1 = 0;
return v1;
}
a1->field_0 = 13;
a1->field_8 = "h";
v1 = -1;
return v1;
} | libedit | angr_sailr |
static void gnu_flush_read(void) {
flush_read_ptr = simple_flush_read;
_gnu_flush_read();
flush_read_ptr = gnu_flush_read;
} | void gnu_flush_read(void)
{
flush_read_ptr = simple_flush_read;
_gnu_flush_read();
flush_read_ptr = gnu_flush_read;
return;
} | tar | ghidra |
static __inline__ int get_user_hz(void) {
if (__iproute2_user_hz_internal == 0)
__iproute2_user_hz_internal = __get_user_hz();
return __iproute2_user_hz_internal;
} | long get_user_hz() {
if (!_iproute2_user_hz_internal)
_iproute2_user_hz_internal = _get_user_hz();
return _iproute2_user_hz_internal;
} | iproute2-6.0.0 | ida |
static struct sshkey_cert *cert_new(void) {
struct sshkey_cert *cert;
if ((cert = calloc(1, sizeof(*cert))) == ((void *)0))
return ((void *)0);
if ((cert->certblob = sshbuf_new()) == ((void *)0) ||
(cert->critical = sshbuf_new()) == ((void *)0) ||
(cert->extensions = sshbuf_new()) == ((void *)0)) {
cert_free(cert);
return ((void *)0);
}
cert->key_id = ((void *)0);
cert->principals = ((void *)0);
cert->signature_key = ((void *)0);
cert->signature_type = ((void *)0);
return cert;
} | int cert_new() {
unsigned long long v0[12];
unsigned int v2;
v0[0] = calloc(0x1, 0x60);
if (!v0) {
v2 = 0;
} else {
v0[0] = sshbuf_new();
if (v0[0]) {
v0[8] = sshbuf_new();
if (v0[8]) {
v0[9] = sshbuf_new();
if (v0[9]) {
v0[3] = 0;
v0[5] = 0;
v0[10] = 0;
v0[11] = 0;
v2 = v0;
}
}
}
if (!v0[0] || !v0[9] || !v0[8]) {
cert_free(v0);
v2 = 0;
}
}
return v2;
} | openssh-portable | angr_dream |
static void close_fd(int fd, char const *filename) {
if (fd != -1 && fd != 0 && close(fd)) {
error(0, (*__errno_location()), gettext("closing %s (fd=%d)"),
quotearg_style(shell_escape_always_quoting_style, filename), fd);
}
} | void close_fd(unsigned long a0, unsigned long long a1) {
unsigned long long v2;
unsigned long long v3;
if (a0 == -1) {
return;
} else if (!a0) {
return;
} else if (!close(a0)) {
return;
} else {
v2 = quotearg_style(0x4, a1);
v3 = error(0x0, *(__errno_location()), gettext("closing %s (fd=%d)"));
return;
}
} | coreutils | angr_sailr |
int template_parse(const char *template) {
unsigned int i;
int ret;
cfg_option_t pov;
cfg_option_t val;
char tmpstr[256];
pov = cfg_load(template);
if (pov == ((void *)0)) {
perror("configFileLoad");
fprintf(stderr, "Error loading template: %s\n", template);
exit(1);
}
for (val = pov; val->name; val++) {
if (handle_option(val) == 0) {
fprintf(stderr, "Warning: skipping unknown option '%s'\n", val->name);
}
}
val = cfg_next(pov, "unit");
if (val != ((void *)0)) {
if (cfg.unit == ((void *)0)) {
i = 0;
cfg.unit = malloc(sizeof(char *) * 128);
if (cfg.unit == ((void *)0)) {
fprintf(stderr, "memory error\n");
exit(1);
};
do {
if (val && strcmp(val->name, "unit") != 0)
continue;
cfg.unit[i] = strdup(val->value);
i++;
if (i >= 128)
break;
} while ((val = cfg_next(val + 1, val->name)) != ((void *)0));
cfg.unit[i] = ((void *)0);
}
};
if (cfg.unit == ((void *)0)) {
val = cfg_next(pov, "ou");
if (val != ((void *)0)) {
if (cfg.unit == ((void *)0)) {
i = 0;
cfg.unit = malloc(sizeof(char *) * 128);
if (cfg.unit == ((void *)0)) {
fprintf(stderr, "memory error\n");
exit(1);
};
do {
if (val && strcmp(val->name, "ou") != 0)
continue;
cfg.unit[i] = strdup(val->value);
i++;
if (i >= 128)
break;
} while ((val = cfg_next(val + 1, val->name)) != ((void *)0));
cfg.unit[i] = ((void *)0);
}
};
}
val = cfg_next(pov, "organization");
if (val != ((void *)0)) {
if (cfg.organization == ((void *)0)) {
i = 0;
cfg.organization = malloc(sizeof(char *) * 128);
if (cfg.organization == ((void *)0)) {
fprintf(stderr, "memory error\n");
exit(1);
};
do {
if (val && strcmp(val->name, "organization") != 0)
continue;
cfg.organization[i] = strdup(val->value);
i++;
if (i >= 128)
break;
} while ((val = cfg_next(val + 1, val->name)) != ((void *)0));
cfg.organization[i] = ((void *)0);
}
};
if (cfg.organization == ((void *)0)) {
val = cfg_next(pov, "o");
if (val != ((void *)0)) {
if (cfg.organization == ((void *)0)) {
i = 0;
cfg.organization = malloc(sizeof(char *) * 128);
if (cfg.organization == ((void *)0)) {
fprintf(stderr, "memory error\n");
exit(1);
};
do {
if (val && strcmp(val->name, "o") != 0)
continue;
cfg.organization[i] = strdup(val->value);
i++;
if (i >= 128)
break;
} while ((val = cfg_next(val + 1, val->name)) != ((void *)0));
cfg.organization[i] = ((void *)0);
}
};
}
val = cfg_next(pov, "locality");
if (val != ((void *)0))
cfg.locality = strdup(val->value);
val = cfg_next(pov, "state");
if (val != ((void *)0))
cfg.state = strdup(val->value);
val = cfg_next(pov, "dn");
if (val != ((void *)0))
cfg.dn = strdup(val->value);
val = cfg_next(pov, "cn");
if (val != ((void *)0))
cfg.cn = strdup(val->value);
val = cfg_next(pov, "uid");
if (val != ((void *)0))
cfg.uid = strdup(val->value);
val = cfg_next(pov, "issuer_unique_id");
if (val != ((void *)0)) {
gnutls_datum_t _input = {(void *)val->value, strlen(val->value)};
gnutls_datum_t _output;
ret = gnutls_hex_decode2(&_input, &_output);
if (ret < 0) {
fprintf(stderr, "error in hex ID: %s\n", val->value);
exit(1);
}
cfg.issuer_unique_id = _output.data;
cfg.issuer_unique_id_size = _output.size;
};
val = cfg_next(pov, "subject_unique_id");
if (val != ((void *)0)) {
gnutls_datum_t _input = {(void *)val->value, strlen(val->value)};
gnutls_datum_t _output;
ret = gnutls_hex_decode2(&_input, &_output);
if (ret < 0) {
fprintf(stderr, "error in hex ID: %s\n", val->value);
exit(1);
}
cfg.subject_unique_id = _output.data;
cfg.subject_unique_id_size = _output.size;
};
val = cfg_next(pov, "challenge_password");
if (val != ((void *)0))
cfg.challenge_password = strdup(val->value);
val = cfg_next(pov, "password");
if (val != ((void *)0))
cfg.password = strdup(val->value);
val = cfg_next(pov, "pkcs9_email");
if (val != ((void *)0))
cfg.pkcs9_email = strdup(val->value);
val = cfg_next(pov, "country");
if (val != ((void *)0))
cfg.country = strdup(val->value);
val = cfg_next(pov, "expiration_date");
if (val != ((void *)0))
cfg.expiration_date = strdup(val->value);
val = cfg_next(pov, "activation_date");
if (val != ((void *)0))
cfg.activation_date = strdup(val->value);
val = cfg_next(pov, "crl_revocation_date");
if (val != ((void *)0))
cfg.revocation_date = strdup(val->value);
val = cfg_next(pov, "crl_this_update_date");
if (val != ((void *)0))
cfg.this_update_date = strdup(val->value);
val = cfg_next(pov, "crl_next_update_date");
if (val != ((void *)0))
cfg.next_update_date = strdup(val->value);
val = cfg_next(pov, "inhibit_anypolicy_skip_certs");
if (val != ((void *)0)) {
cfg.skip_certs = strtol(val->value, ((void *)0), 10);
};
for (i = 0; i < 8; i++) {
snprintf(tmpstr, sizeof(tmpstr), "policy%d", i + 1);
val = cfg_next(pov, tmpstr);
if (val != ((void *)0))
cfg.policy_oid[i] = strdup(val->value);
if (cfg.policy_oid[i] != ((void *)0)) {
snprintf(tmpstr, sizeof(tmpstr), "policy%d_url", i + 1);
val = cfg_next(pov, tmpstr);
if (val != ((void *)0))
cfg.policy_url[i] = strdup(val->value);
snprintf(tmpstr, sizeof(tmpstr), "policy%d_txt", i + 1);
val = cfg_next(pov, tmpstr);
if (val != ((void *)0)) {
cfg.policy_txt[i] = strdup(val->value);
}
}
}
val = cfg_next(pov, "dc");
if (val != ((void *)0)) {
if (cfg.dc == ((void *)0)) {
i = 0;
cfg.dc = malloc(sizeof(char *) * 128);
if (cfg.dc == ((void *)0)) {
fprintf(stderr, "memory error\n");
exit(1);
};
do {
if (val && strcmp(val->name, "dc") != 0)
continue;
cfg.dc[i] = strdup(val->value);
i++;
if (i >= 128)
break;
} while ((val = cfg_next(val + 1, val->name)) != ((void *)0));
cfg.dc[i] = ((void *)0);
}
};
val = cfg_next(pov, "dns_name");
if (val != ((void *)0)) {
if (cfg.dns_name == ((void *)0)) {
i = 0;
cfg.dns_name = malloc(sizeof(char *) * 128);
if (cfg.dns_name == ((void *)0)) {
fprintf(stderr, "memory error\n");
exit(1);
};
do {
if (val && strcmp(val->name, "dns_name") != 0)
continue;
cfg.dns_name[i] = strdup(val->value);
i++;
if (i >= 128)
break;
} while ((val = cfg_next(val + 1, val->name)) != ((void *)0));
cfg.dns_name[i] = ((void *)0);
}
};
val = cfg_next(pov, "uri");
if (val != ((void *)0)) {
if (cfg.uri == ((void *)0)) {
i = 0;
cfg.uri = malloc(sizeof(char *) * 128);
if (cfg.uri == ((void *)0)) {
fprintf(stderr, "memory error\n");
exit(1);
};
do {
if (val && strcmp(val->name, "uri") != 0)
continue;
cfg.uri[i] = strdup(val->value);
i++;
if (i >= 128)
break;
} while ((val = cfg_next(val + 1, val->name)) != ((void *)0));
cfg.uri[i] = ((void *)0);
}
};
val = cfg_next(pov, "krb5_principal");
if (val != ((void *)0)) {
if (cfg.krb5_principal == ((void *)0)) {
i = 0;
cfg.krb5_principal = malloc(sizeof(char *) * 128);
if (cfg.krb5_principal == ((void *)0)) {
fprintf(stderr, "memory error\n");
exit(1);
};
do {
if (val && strcmp(val->name, "krb5_principal") != 0)
continue;
cfg.krb5_principal[i] = strdup(val->value);
i++;
if (i >= 128)
break;
} while ((val = cfg_next(val + 1, val->name)) != ((void *)0));
cfg.krb5_principal[i] = ((void *)0);
}
};
val = cfg_next(pov, "other_name");
if (val != ((void *)0)) {
char *str;
char *p;
if (cfg.other_name == ((void *)0)) {
i = 0;
cfg.other_name = malloc(sizeof(char *) * 128);
if (cfg.other_name == ((void *)0)) {
fprintf(stderr, "memory error\n");
exit(1);
};
do {
if (val && strcmp(val->name, "other_name") != 0)
continue;
str = strdup(val->value);
if (str == ((void *)0)) {
fprintf(stderr, "memory error\n");
exit(1);
};
if ((p = strchr(str, ' ')) == ((void *)0) &&
(p = strchr(str, '\t')) == ((void *)0)) {
fprintf(stderr, "Error parsing %s\n", "other_name");
exit(1);
}
p[0] = 0;
p++;
cfg.other_name[i] = strdup(str);
while (*p == ' ' || *p == '\t')
p++;
if (p[0] == 0) {
fprintf(stderr, "Error (2) parsing %s\n", "other_name");
exit(1);
}
cfg.other_name[i + 1] = strdup(p);
i += 2;
free(str);
if (i >= 128)
break;
} while ((val = cfg_next(val + 1, val->name)) != ((void *)0));
cfg.other_name[i] = ((void *)0);
}
};
val = cfg_next(pov, "other_name_octet");
if (val != ((void *)0)) {
char *str;
char *p;
if (cfg.other_name_octet == ((void *)0)) {
i = 0;
cfg.other_name_octet = malloc(sizeof(char *) * 128);
if (cfg.other_name_octet == ((void *)0)) {
fprintf(stderr, "memory error\n");
exit(1);
};
do {
if (val && strcmp(val->name, "other_name_octet") != 0)
continue;
str = strdup(val->value);
if (str == ((void *)0)) {
fprintf(stderr, "memory error\n");
exit(1);
};
if ((p = strchr(str, ' ')) == ((void *)0) &&
(p = strchr(str, '\t')) == ((void *)0)) {
fprintf(stderr, "Error parsing %s\n", "other_name_octet");
exit(1);
}
p[0] = 0;
p++;
cfg.other_name_octet[i] = strdup(str);
while (*p == ' ' || *p == '\t')
p++;
if (p[0] == 0) {
fprintf(stderr, "Error (2) parsing %s\n", "other_name_octet");
exit(1);
}
cfg.other_name_octet[i + 1] = strdup(p);
i += 2;
free(str);
if (i >= 128)
break;
} while ((val = cfg_next(val + 1, val->name)) != ((void *)0));
cfg.other_name_octet[i] = ((void *)0);
}
};
val = cfg_next(pov, "other_name_utf8");
if (val != ((void *)0)) {
char *str;
char *p;
if (cfg.other_name_utf8 == ((void *)0)) {
i = 0;
cfg.other_name_utf8 = malloc(sizeof(char *) * 128);
if (cfg.other_name_utf8 == ((void *)0)) {
fprintf(stderr, "memory error\n");
exit(1);
};
do {
if (val && strcmp(val->name, "other_name_utf8") != 0)
continue;
str = strdup(val->value);
if (str == ((void *)0)) {
fprintf(stderr, "memory error\n");
exit(1);
};
if ((p = strchr(str, ' ')) == ((void *)0) &&
(p = strchr(str, '\t')) == ((void *)0)) {
fprintf(stderr, "Error parsing %s\n", "other_name_utf8");
exit(1);
}
p[0] = 0;
p++;
cfg.other_name_utf8[i] = strdup(str);
while (*p == ' ' || *p == '\t')
p++;
if (p[0] == 0) {
fprintf(stderr, "Error (2) parsing %s\n", "other_name_utf8");
exit(1);
}
cfg.other_name_utf8[i + 1] = strdup(p);
i += 2;
free(str);
if (i >= 128)
break;
} while ((val = cfg_next(val + 1, val->name)) != ((void *)0));
cfg.other_name_utf8[i] = ((void *)0);
}
};
val = cfg_next(pov, "xmpp_name");
if (val != ((void *)0)) {
if (cfg.xmpp_name == ((void *)0)) {
i = 0;
cfg.xmpp_name = malloc(sizeof(char *) * 128);
if (cfg.xmpp_name == ((void *)0)) {
fprintf(stderr, "memory error\n");
exit(1);
};
do {
if (val && strcmp(val->name, "xmpp_name") != 0)
continue;
cfg.xmpp_name[i] = strdup(val->value);
i++;
if (i >= 128)
break;
} while ((val = cfg_next(val + 1, val->name)) != ((void *)0));
cfg.xmpp_name[i] = ((void *)0);
}
};
val = cfg_next(pov, "ip_address");
if (val != ((void *)0)) {
if (cfg.ip_addr == ((void *)0)) {
i = 0;
cfg.ip_addr = malloc(sizeof(char *) * 128);
if (cfg.ip_addr == ((void *)0)) {
fprintf(stderr, "memory error\n");
exit(1);
};
do {
if (val && strcmp(val->name, "ip_address") != 0)
continue;
cfg.ip_addr[i] = strdup(val->value);
i++;
if (i >= 128)
break;
} while ((val = cfg_next(val + 1, val->name)) != ((void *)0));
cfg.ip_addr[i] = ((void *)0);
}
};
val = cfg_next(pov, "email");
if (val != ((void *)0)) {
if (cfg.email == ((void *)0)) {
i = 0;
cfg.email = malloc(sizeof(char *) * 128);
if (cfg.email == ((void *)0)) {
fprintf(stderr, "memory error\n");
exit(1);
};
do {
if (val && strcmp(val->name, "email") != 0)
continue;
cfg.email[i] = strdup(val->value);
i++;
if (i >= 128)
break;
} while ((val = cfg_next(val + 1, val->name)) != ((void *)0));
cfg.email[i] = ((void *)0);
}
};
val = cfg_next(pov, "key_purpose_oid");
if (val != ((void *)0)) {
if (cfg.key_purpose_oids == ((void *)0)) {
i = 0;
cfg.key_purpose_oids = malloc(sizeof(char *) * 128);
if (cfg.key_purpose_oids == ((void *)0)) {
fprintf(stderr, "memory error\n");
exit(1);
};
do {
if (val && strcmp(val->name, "key_purpose_oid") != 0)
continue;
cfg.key_purpose_oids[i] = strdup(val->value);
i++;
if (i >= 128)
break;
} while ((val = cfg_next(val + 1, val->name)) != ((void *)0));
cfg.key_purpose_oids[i] = ((void *)0);
}
};
val = cfg_next(pov, "nc_exclude_ip");
if (val != ((void *)0)) {
if (cfg.excluded_nc_ip == ((void *)0)) {
i = 0;
cfg.excluded_nc_ip = malloc(sizeof(char *) * 128);
if (cfg.excluded_nc_ip == ((void *)0)) {
fprintf(stderr, "memory error\n");
exit(1);
};
do {
if (val && strcmp(val->name, "nc_exclude_ip") != 0)
continue;
cfg.excluded_nc_ip[i] = strdup(val->value);
i++;
if (i >= 128)
break;
} while ((val = cfg_next(val + 1, val->name)) != ((void *)0));
cfg.excluded_nc_ip[i] = ((void *)0);
}
};
val = cfg_next(pov, "nc_exclude_dns");
if (val != ((void *)0)) {
if (cfg.excluded_nc_dns == ((void *)0)) {
i = 0;
cfg.excluded_nc_dns = malloc(sizeof(char *) * 128);
if (cfg.excluded_nc_dns == ((void *)0)) {
fprintf(stderr, "memory error\n");
exit(1);
};
do {
if (val && strcmp(val->name, "nc_exclude_dns") != 0)
continue;
cfg.excluded_nc_dns[i] = strdup(val->value);
i++;
if (i >= 128)
break;
} while ((val = cfg_next(val + 1, val->name)) != ((void *)0));
cfg.excluded_nc_dns[i] = ((void *)0);
}
};
val = cfg_next(pov, "nc_exclude_email");
if (val != ((void *)0)) {
if (cfg.excluded_nc_email == ((void *)0)) {
i = 0;
cfg.excluded_nc_email = malloc(sizeof(char *) * 128);
if (cfg.excluded_nc_email == ((void *)0)) {
fprintf(stderr, "memory error\n");
exit(1);
};
do {
if (val && strcmp(val->name, "nc_exclude_email") != 0)
continue;
cfg.excluded_nc_email[i] = strdup(val->value);
i++;
if (i >= 128)
break;
} while ((val = cfg_next(val + 1, val->name)) != ((void *)0));
cfg.excluded_nc_email[i] = ((void *)0);
}
};
val = cfg_next(pov, "nc_permit_ip");
if (val != ((void *)0)) {
if (cfg.permitted_nc_ip == ((void *)0)) {
i = 0;
cfg.permitted_nc_ip = malloc(sizeof(char *) * 128);
if (cfg.permitted_nc_ip == ((void *)0)) {
fprintf(stderr, "memory error\n");
exit(1);
};
do {
if (val && strcmp(val->name, "nc_permit_ip") != 0)
continue;
cfg.permitted_nc_ip[i] = strdup(val->value);
i++;
if (i >= 128)
break;
} while ((val = cfg_next(val + 1, val->name)) != ((void *)0));
cfg.permitted_nc_ip[i] = ((void *)0);
}
};
val = cfg_next(pov, "nc_permit_dns");
if (val != ((void *)0)) {
if (cfg.permitted_nc_dns == ((void *)0)) {
i = 0;
cfg.permitted_nc_dns = malloc(sizeof(char *) * 128);
if (cfg.permitted_nc_dns == ((void *)0)) {
fprintf(stderr, "memory error\n");
exit(1);
};
do {
if (val && strcmp(val->name, "nc_permit_dns") != 0)
continue;
cfg.permitted_nc_dns[i] = strdup(val->value);
i++;
if (i >= 128)
break;
} while ((val = cfg_next(val + 1, val->name)) != ((void *)0));
cfg.permitted_nc_dns[i] = ((void *)0);
}
};
val = cfg_next(pov, "nc_permit_email");
if (val != ((void *)0)) {
if (cfg.permitted_nc_email == ((void *)0)) {
i = 0;
cfg.permitted_nc_email = malloc(sizeof(char *) * 128);
if (cfg.permitted_nc_email == ((void *)0)) {
fprintf(stderr, "memory error\n");
exit(1);
};
do {
if (val && strcmp(val->name, "nc_permit_email") != 0)
continue;
cfg.permitted_nc_email[i] = strdup(val->value);
i++;
if (i >= 128)
break;
} while ((val = cfg_next(val + 1, val->name)) != ((void *)0));
cfg.permitted_nc_email[i] = ((void *)0);
}
};
val = cfg_next(pov, "dn_oid");
if (val != ((void *)0)) {
char *str;
char *p;
if (cfg.dn_oid == ((void *)0)) {
i = 0;
cfg.dn_oid = malloc(sizeof(char *) * 128);
if (cfg.dn_oid == ((void *)0)) {
fprintf(stderr, "memory error\n");
exit(1);
};
do {
if (val && strcmp(val->name, "dn_oid") != 0)
continue;
str = strdup(val->value);
if (str == ((void *)0)) {
fprintf(stderr, "memory error\n");
exit(1);
};
if ((p = strchr(str, ' ')) == ((void *)0) &&
(p = strchr(str, '\t')) == ((void *)0)) {
fprintf(stderr, "Error parsing %s\n", "dn_oid");
exit(1);
}
p[0] = 0;
p++;
cfg.dn_oid[i] = strdup(str);
while (*p == ' ' || *p == '\t')
p++;
if (p[0] == 0) {
fprintf(stderr, "Error (2) parsing %s\n", "dn_oid");
exit(1);
}
cfg.dn_oid[i + 1] = strdup(p);
i += 2;
free(str);
if (i >= 128)
break;
} while ((val = cfg_next(val + 1, val->name)) != ((void *)0));
cfg.dn_oid[i] = ((void *)0);
}
};
val = cfg_next(pov, "add_extension");
if (val != ((void *)0)) {
char *str;
char *p;
if (cfg.extensions == ((void *)0)) {
i = 0;
cfg.extensions = malloc(sizeof(char *) * 128);
if (cfg.extensions == ((void *)0)) {
fprintf(stderr, "memory error\n");
exit(1);
};
do {
if (val && strcmp(val->name, "add_extension") != 0)
continue;
str = strdup(val->value);
if (str == ((void *)0)) {
fprintf(stderr, "memory error\n");
exit(1);
};
if ((p = strchr(str, ' ')) == ((void *)0) &&
(p = strchr(str, '\t')) == ((void *)0)) {
fprintf(stderr, "Error parsing %s\n", "add_extension");
exit(1);
}
p[0] = 0;
p++;
cfg.extensions[i] = strdup(str);
while (*p == ' ' || *p == '\t')
p++;
if (p[0] == 0) {
fprintf(stderr, "Error (2) parsing %s\n", "add_extension");
exit(1);
}
cfg.extensions[i + 1] = strdup(p);
i += 2;
free(str);
if (i >= 128)
break;
} while ((val = cfg_next(val + 1, val->name)) != ((void *)0));
cfg.extensions[i] = ((void *)0);
}
};
val = cfg_next(pov, "add_critical_extension");
if (val != ((void *)0)) {
char *str;
char *p;
if (cfg.crit_extensions == ((void *)0)) {
i = 0;
cfg.crit_extensions = malloc(sizeof(char *) * 128);
if (cfg.crit_extensions == ((void *)0)) {
fprintf(stderr, "memory error\n");
exit(1);
};
do {
if (val && strcmp(val->name, "add_critical_extension") != 0)
continue;
str = strdup(val->value);
if (str == ((void *)0)) {
fprintf(stderr, "memory error\n");
exit(1);
};
if ((p = strchr(str, ' ')) == ((void *)0) &&
(p = strchr(str, '\t')) == ((void *)0)) {
fprintf(stderr, "Error parsing %s\n", "add_critical_extension");
exit(1);
}
p[0] = 0;
p++;
cfg.crit_extensions[i] = strdup(str);
while (*p == ' ' || *p == '\t')
p++;
if (p[0] == 0) {
fprintf(stderr, "Error (2) parsing %s\n", "add_critical_extension");
exit(1);
}
cfg.crit_extensions[i + 1] = strdup(p);
i += 2;
free(str);
if (i >= 128)
break;
} while ((val = cfg_next(val + 1, val->name)) != ((void *)0));
cfg.crit_extensions[i] = ((void *)0);
}
};
val = cfg_next(pov, "crl_dist_points");
if (val != ((void *)0)) {
if (cfg.crl_dist_points == ((void *)0)) {
i = 0;
cfg.crl_dist_points = malloc(sizeof(char *) * 128);
if (cfg.crl_dist_points == ((void *)0)) {
fprintf(stderr, "memory error\n");
exit(1);
};
do {
if (val && strcmp(val->name, "crl_dist_points") != 0)
continue;
cfg.crl_dist_points[i] = strdup(val->value);
i++;
if (i >= 128)
break;
} while ((val = cfg_next(val + 1, val->name)) != ((void *)0));
cfg.crl_dist_points[i] = ((void *)0);
}
};
val = cfg_next(pov, "pkcs12_key_name");
if (val != ((void *)0))
cfg.pkcs12_key_name = strdup(val->value);
val = cfg_next(pov, "serial");
if (val != ((void *)0)) {
gnutls_datum_t _output;
ret = serial_decode(val->value, &_output);
if (ret < 0) {
fprintf(stderr, "error parsing number: %s\n", val->value);
exit(1);
}
cfg.serial = _output.data;
cfg.serial_size = _output.size;
};
val = cfg_next(pov, "expiration_days");
if (val != ((void *)0)) {
cfg.expiration_days = strtol(val->value, ((void *)0), 10);
};
val = cfg_next(pov, "crl_next_update");
if (val != ((void *)0)) {
cfg.crl_next_update = strtol(val->value, ((void *)0), 10);
};
val = cfg_next(pov, "crl_number");
if (val != ((void *)0)) {
gnutls_datum_t _output;
ret = serial_decode(val->value, &_output);
if (ret < 0) {
fprintf(stderr, "error parsing number: %s\n", val->value);
exit(1);
}
cfg.crl_number = _output.data;
cfg.crl_number_size = _output.size;
};
val = cfg_next(pov, "path_len");
if (val != ((void *)0)) {
cfg.path_len = strtol(val->value, ((void *)0), 10);
};
val = cfg_next(pov, "proxy_policy_language");
if (val != ((void *)0))
cfg.proxy_policy_language = strdup(val->value);
val = cfg_next(pov, "ocsp_uri");
if (val != ((void *)0)) {
if (cfg.ocsp_uris == ((void *)0)) {
i = 0;
cfg.ocsp_uris = malloc(sizeof(char *) * 128);
if (cfg.ocsp_uris == ((void *)0)) {
fprintf(stderr, "memory error\n");
exit(1);
};
do {
if (val && strcmp(val->name, "ocsp_uri") != 0)
continue;
cfg.ocsp_uris[i] = strdup(val->value);
i++;
if (i >= 128)
break;
} while ((val = cfg_next(val + 1, val->name)) != ((void *)0));
cfg.ocsp_uris[i] = ((void *)0);
}
};
val = cfg_next(pov, "ca_issuers_uri");
if (val != ((void *)0)) {
if (cfg.ca_issuers_uris == ((void *)0)) {
i = 0;
cfg.ca_issuers_uris = malloc(sizeof(char *) * 128);
if (cfg.ca_issuers_uris == ((void *)0)) {
fprintf(stderr, "memory error\n");
exit(1);
};
do {
if (val && strcmp(val->name, "ca_issuers_uri") != 0)
continue;
cfg.ca_issuers_uris[i] = strdup(val->value);
i++;
if (i >= 128)
break;
} while ((val = cfg_next(val + 1, val->name)) != ((void *)0));
cfg.ca_issuers_uris[i] = ((void *)0);
}
};
val = cfg_next(pov, "ca");
if (val != ((void *)0)) {
cfg.ca = 1;
};
val = cfg_next(pov, "honor_crq_extensions");
if (val != ((void *)0)) {
cfg.honor_crq_extensions = 1;
};
val = cfg_next(pov, "honor_crq_ext");
if (val != ((void *)0)) {
if (cfg.exts_to_honor == ((void *)0)) {
i = 0;
cfg.exts_to_honor = malloc(sizeof(char *) * 128);
if (cfg.exts_to_honor == ((void *)0)) {
fprintf(stderr, "memory error\n");
exit(1);
};
do {
if (val && strcmp(val->name, "honor_crq_ext") != 0)
continue;
cfg.exts_to_honor[i] = strdup(val->value);
i++;
if (i >= 128)
break;
} while ((val = cfg_next(val + 1, val->name)) != ((void *)0));
cfg.exts_to_honor[i] = ((void *)0);
}
};
val = cfg_next(pov, "tls_www_client");
if (val != ((void *)0)) {
cfg.tls_www_client = 1;
};
val = cfg_next(pov, "tls_www_server");
if (val != ((void *)0)) {
cfg.tls_www_server = 1;
};
val = cfg_next(pov, "signing_key");
if (val != ((void *)0)) {
cfg.signing_key = 1;
};
val = cfg_next(pov, "encryption_key");
if (val != ((void *)0)) {
cfg.encryption_key = 1;
};
val = cfg_next(pov, "cert_signing_key");
if (val != ((void *)0)) {
cfg.cert_sign_key = 1;
};
val = cfg_next(pov, "crl_signing_key");
if (val != ((void *)0)) {
cfg.crl_sign_key = 1;
};
val = cfg_next(pov, "code_signing_key");
if (val != ((void *)0)) {
cfg.code_sign_key = 1;
};
val = cfg_next(pov, "ocsp_signing_key");
if (val != ((void *)0)) {
cfg.ocsp_sign_key = 1;
};
val = cfg_next(pov, "time_stamping_key");
if (val != ((void *)0)) {
cfg.time_stamping_key = 1;
};
val = cfg_next(pov, "email_protection_key");
if (val != ((void *)0)) {
cfg.email_protection_key = 1;
};
val = cfg_next(pov, "ipsec_ike_key");
if (val != ((void *)0)) {
cfg.ipsec_ike_key = 1;
};
val = cfg_next(pov, "data_encipherment");
if (val != ((void *)0)) {
cfg.data_encipherment = 1;
};
val = cfg_next(pov, "key_agreement");
if (val != ((void *)0)) {
cfg.key_agreement = 1;
};
val = cfg_next(pov, "non_repudiation");
if (val != ((void *)0)) {
cfg.non_repudiation = 1;
};
val = cfg_next(pov, "tls_feature");
if (val != ((void *)0)) {
if (cfg.tls_features == ((void *)0)) {
i = 0;
cfg.tls_features = malloc(sizeof(char *) * 128);
if (cfg.tls_features == ((void *)0)) {
fprintf(stderr, "memory error\n");
exit(1);
};
do {
if (val && strcmp(val->name, "tls_feature") != 0)
continue;
cfg.tls_features[i] = strdup(val->value);
i++;
if (i >= 128)
break;
} while ((val = cfg_next(val + 1, val->name)) != ((void *)0));
cfg.tls_features[i] = ((void *)0);
}
};
cfg_free(pov);
return 0;
} | undefined8 template_parse(undefined8 param_1)
{
int iVar1;
long *plVar2;
long lVar3;
long in_FS_OFFSET;
uint local_1c0;
long *local_1b8;
undefined8 local_138;
undefined4 local_130;
char local_128[264];
long local_20;
local_20 = *(long *)(in_FS_OFFSET + 0x28);
plVar2 = (long *)cfg_load(param_1);
local_1b8 = plVar2;
if (plVar2 == (long *)0x0) {
perror("configFileLoad");
fprintf(*ppFRam000000000010020b, "Error loading template: %s\n", param_1);
}
for (; *local_1b8 != 0; local_1b8 = local_1b8 + 2) {
iVar1 = handle_option(local_1b8);
if (iVar1 == 0) {
fprintf(*ppFRam0000000000100267,
"Warning: skipping unknown option \'%s\'\n", *local_1b8);
}
}
lVar3 = cfg_next(plVar2, &DAT_0010a740);
if ((lVar3 != 0) && (*(long *)(lRam00000000001002c7 + 8) == 0)) {
malloc(0x400);
}
if (((*(long *)(lRam00000000001003f5 + 8) == 0) &&
(lVar3 = cfg_next(plVar2, &DAT_0010a745), lVar3 != 0)) &&
(*(long *)(lRam0000000000100434 + 8) == 0)) {
malloc(0x400);
}
lVar3 = cfg_next(plVar2, "organization");
if ((lVar3 != 0) && (*plRam000000000010058d == 0)) {
malloc(0x400);
}
if (((*plRam00000000001006b6 == 0) &&
(lVar3 = cfg_next(plVar2, &DAT_0010a755), lVar3 != 0)) &&
(*plRam00000000001006f4 == 0)) {
malloc(0x400);
}
lVar3 = cfg_next(plVar2, "locality");
if (lVar3 != 0) {
strdup(*(char **)(lVar3 + 8));
}
lVar3 = cfg_next(plVar2, "state");
if (lVar3 != 0) {
strdup(*(char **)(lVar3 + 8));
}
lVar3 = cfg_next(plVar2, &DAT_0010a889);
if (lVar3 != 0) {
strdup(*(char **)(lVar3 + 8));
}
lVar3 = cfg_next(plVar2, &DAT_0010a88c);
if (lVar3 != 0) {
strdup(*(char **)(lVar3 + 8));
}
lVar3 = cfg_next(plVar2, &DAT_0010a88f);
if (lVar3 != 0) {
strdup(*(char **)(lVar3 + 8));
}
lVar3 = cfg_next(plVar2, "issuer_unique_id");
if (lVar3 != 0) {
strlen(*(char **)(lVar3 + 8));
}
lVar3 = cfg_next(plVar2, "subject_unique_id");
if (lVar3 != 0) {
strlen(*(char **)(lVar3 + 8));
}
lVar3 = cfg_next(plVar2, "challenge_password");
if (lVar3 != 0) {
strdup(*(char **)(lVar3 + 8));
}
lVar3 = cfg_next(plVar2, "password");
if (lVar3 != 0) {
strdup(*(char **)(lVar3 + 8));
}
lVar3 = cfg_next(plVar2, "pkcs9_email");
if (lVar3 != 0) {
strdup(*(char **)(lVar3 + 8));
}
lVar3 = cfg_next(plVar2, "country");
if (lVar3 != 0) {
strdup(*(char **)(lVar3 + 8));
}
lVar3 = cfg_next(plVar2, "expiration_date");
if (lVar3 != 0) {
strdup(*(char **)(lVar3 + 8));
}
lVar3 = cfg_next(plVar2, "activation_date");
if (lVar3 != 0) {
strdup(*(char **)(lVar3 + 8));
}
lVar3 = cfg_next(plVar2, "crl_revocation_date");
if (lVar3 != 0) {
strdup(*(char **)(lVar3 + 8));
}
lVar3 = cfg_next(plVar2, "crl_this_update_date");
if (lVar3 != 0) {
strdup(*(char **)(lVar3 + 8));
}
lVar3 = cfg_next(plVar2, "crl_next_update_date");
if (lVar3 != 0) {
strdup(*(char **)(lVar3 + 8));
}
lVar3 = cfg_next(plVar2, "inhibit_anypolicy_skip_certs");
if (lVar3 != 0) {
strtol(*(char **)(lVar3 + 8), (char **)0x0, 10);
}
for (local_1c0 = 0; local_1c0 < 8; local_1c0 = local_1c0 + 1) {
snprintf(local_128, 0x100, "policy%d", (ulong)(local_1c0 + 1));
lVar3 = cfg_next(plVar2, local_128);
if (lVar3 != 0) {
strdup(*(char **)(lVar3 + 8));
}
if (*(long *)(lRam0000000000100ea7 + ((ulong)local_1c0 + 0xe) * 8) != 0) {
snprintf(local_128, 0x100, "policy%d_url", (ulong)(local_1c0 + 1));
lVar3 = cfg_next(plVar2, local_128);
if (lVar3 != 0) {
strdup(*(char **)(lVar3 + 8));
}
snprintf(local_128, 0x100, "policy%d_txt", (ulong)(local_1c0 + 1));
lVar3 = cfg_next(plVar2, local_128);
if (lVar3 != 0) {
strdup(*(char **)(lVar3 + 8));
}
}
}
lVar3 = cfg_next(plVar2, &DAT_0010a757);
if ((lVar3 != 0) && (*(long *)(lRam0000000000101004 + 0x130) == 0)) {
malloc(0x400);
}
lVar3 = cfg_next(plVar2, "dns_name");
if ((lVar3 != 0) && (*(long *)(lRam000000000010116c + 0x138) == 0)) {
malloc(0x400);
}
lVar3 = cfg_next(plVar2, &DAT_0010a85e);
if ((lVar3 != 0) && (*(long *)(lRam00000000001012d4 + 0x140) == 0)) {
malloc(0x400);
}
lVar3 = cfg_next(plVar2, "krb5_principal");
if ((lVar3 != 0) && (*(long *)(lRam000000000010143c + 0x158) == 0)) {
malloc(0x400);
}
lVar3 = cfg_next(plVar2, "other_name");
if ((lVar3 != 0) && (*(long *)(lRam00000000001015a4 + 0x160) == 0)) {
malloc(0x400);
}
lVar3 = cfg_next(plVar2, "other_name_octet");
if ((lVar3 != 0) && (*(long *)(lRam0000000000101888 + 0x170) == 0)) {
malloc(0x400);
}
lVar3 = cfg_next(plVar2, "other_name_utf8");
if ((lVar3 != 0) && (*(long *)(lRam0000000000101b6c + 0x168) == 0)) {
malloc(0x400);
}
lVar3 = cfg_next(plVar2, "xmpp_name");
if ((lVar3 != 0) && (*(long *)(lRam0000000000101e50 + 0x178) == 0)) {
malloc(0x400);
}
lVar3 = cfg_next(plVar2, "ip_address");
if ((lVar3 != 0) && (*(long *)(lRam0000000000101fb8 + 0x148) == 0)) {
malloc(0x400);
}
lVar3 = cfg_next(plVar2, "email");
if ((lVar3 != 0) && (*(long *)(lRam0000000000102120 + 0x150) == 0)) {
malloc(0x400);
}
lVar3 = cfg_next(plVar2, "key_purpose_oid");
if ((lVar3 != 0) && (*(long *)(lRam0000000000102288 + 0x260) == 0)) {
malloc(0x400);
}
lVar3 = cfg_next(plVar2, "nc_exclude_ip");
if ((lVar3 != 0) && (*(long *)(lRam00000000001023f0 + 0x1a0) == 0)) {
malloc(0x400);
}
lVar3 = cfg_next(plVar2, "nc_exclude_dns");
if ((lVar3 != 0) && (*(long *)(lRam0000000000102558 + 0x1b0) == 0)) {
malloc(0x400);
}
lVar3 = cfg_next(plVar2, "nc_exclude_email");
if ((lVar3 != 0) && (*(long *)(lRam00000000001026c0 + 0x1c0) == 0)) {
malloc(0x400);
}
lVar3 = cfg_next(plVar2, "nc_permit_ip");
if ((lVar3 != 0) && (*(long *)(lRam0000000000102828 + 0x198) == 0)) {
malloc(0x400);
}
lVar3 = cfg_next(plVar2, "nc_permit_dns");
if ((lVar3 != 0) && (*(long *)(lRam0000000000102990 + 0x1a8) == 0)) {
malloc(0x400);
}
lVar3 = cfg_next(plVar2, "nc_permit_email");
if ((lVar3 != 0) && (*(long *)(lRam0000000000102af8 + 0x1b8) == 0)) {
malloc(0x400);
}
lVar3 = cfg_next(plVar2, "dn_oid");
if ((lVar3 != 0) && (*(long *)(lRam0000000000102c60 + 0x180) == 0)) {
malloc(0x400);
}
lVar3 = cfg_next(plVar2, "add_extension");
if ((lVar3 != 0) && (*(long *)(lRam0000000000102f44 + 0x188) == 0)) {
malloc(0x400);
}
lVar3 = cfg_next(plVar2, "add_critical_extension");
if ((lVar3 != 0) && (*(long *)(lRam0000000000103228 + 400) == 0)) {
malloc(0x400);
}
lVar3 = cfg_next(plVar2, "crl_dist_points");
if ((lVar3 != 0) && (*(long *)(lRam000000000010350c + 0x1c8) == 0)) {
malloc(0x400);
}
lVar3 = cfg_next(plVar2, "pkcs12_key_name");
if (lVar3 != 0) {
strdup(*(char **)(lVar3 + 8));
}
lVar3 = cfg_next(plVar2, "serial");
if (lVar3 != 0) {
iVar1 = serial_decode(*(undefined8 *)(lVar3 + 8), &local_138);
if (iVar1 < 0) {
fprintf(*ppFRam00000000001036f6, "error parsing number: %s\n",
*(undefined8 *)(lVar3 + 8));
}
*(undefined8 *)(lRam0000000000103725 + 0x208) = local_138;
*(undefined4 *)(lRam0000000000103739 + 0x210) = local_130;
}
lVar3 = cfg_next(plVar2, "expiration_days");
if (lVar3 == 0) {
lVar3 = cfg_next(plVar2, "crl_next_update");
if (lVar3 != 0) {
strtol(*(char **)(lVar3 + 8), (char **)0x0, 10);
}
lVar3 = cfg_next(plVar2, "crl_number");
if (lVar3 != 0) {
iVar1 = serial_decode(*(undefined8 *)(lVar3 + 8), &local_138);
if (iVar1 < 0) {
fprintf(*ppFRam000000000010384e, "error parsing number: %s\n",
*(undefined8 *)(lVar3 + 8));
}
*(undefined8 *)(lRam000000000010387d + 0x270) = local_138;
*(undefined4 *)(lRam0000000000103891 + 0x278) = local_130;
}
lVar3 = cfg_next(plVar2, "path_len");
if (lVar3 != 0) {
strtol(*(char **)(lVar3 + 8), (char **)0x0, 10);
}
lVar3 = cfg_next(plVar2, "proxy_policy_language");
if (lVar3 != 0) {
strdup(*(char **)(lVar3 + 8));
}
lVar3 = cfg_next(plVar2, "ocsp_uri");
if ((lVar3 != 0) && (*(long *)(lRam0000000000103967 + 0x290) == 0)) {
malloc(0x400);
}
lVar3 = cfg_next(plVar2, "ca_issuers_uri");
if ((lVar3 != 0) && (*(long *)(lRam0000000000103acf + 0x298) == 0)) {
malloc(0x400);
}
lVar3 = cfg_next(plVar2, &DAT_0010a9ca);
if (lVar3 != 0) {
*(undefined4 *)(lRam0000000000103c33 + 0x21c) = 1;
}
lVar3 = cfg_next(plVar2, "honor_crq_extensions");
if (lVar3 != 0) {
*(undefined4 *)(lRam0000000000103c6b + 0x27c) = 1;
}
lVar3 = cfg_next(plVar2, "honor_crq_ext");
if ((lVar3 != 0) && (*(long *)(lRam0000000000103ca7 + 0x288) == 0)) {
malloc(0x400);
}
lVar3 = cfg_next(plVar2, "tls_www_client");
if (lVar3 != 0) {
*(undefined4 *)(lRam0000000000103e0b + 0x224) = 1;
}
lVar3 = cfg_next(plVar2, "tls_www_server");
if (lVar3 != 0) {
*(undefined4 *)(lRam0000000000103e43 + 0x228) = 1;
}
lVar3 = cfg_next(plVar2, "signing_key");
if (lVar3 != 0) {
*(undefined4 *)(lRam0000000000103e7b + 0x22c) = 1;
}
lVar3 = cfg_next(plVar2, "encryption_key");
if (lVar3 != 0) {
*(undefined4 *)(lRam0000000000103eb3 + 0x230) = 1;
}
lVar3 = cfg_next(plVar2, "cert_signing_key");
if (lVar3 != 0) {
*(undefined4 *)(lRam0000000000103eeb + 0x234) = 1;
}
lVar3 = cfg_next(plVar2, "crl_signing_key");
if (lVar3 != 0) {
*(undefined4 *)(lRam0000000000103f23 + 0x238) = 1;
}
lVar3 = cfg_next(plVar2, "code_signing_key");
if (lVar3 != 0) {
*(undefined4 *)(lRam0000000000103f5b + 0x248) = 1;
}
lVar3 = cfg_next(plVar2, "ocsp_signing_key");
if (lVar3 != 0) {
*(undefined4 *)(lRam0000000000103f93 + 0x24c) = 1;
}
lVar3 = cfg_next(plVar2, "time_stamping_key");
if (lVar3 != 0) {
*(undefined4 *)(lRam0000000000103fcb + 0x250) = 1;
}
lVar3 = cfg_next(plVar2, "email_protection_key");
if (lVar3 != 0) {
*(undefined4 *)(lRam0000000000104003 + 0x254) = 1;
}
lVar3 = cfg_next(plVar2, "ipsec_ike_key");
if (lVar3 != 0) {
*(undefined4 *)(lRam000000000010403b + 600) = 1;
}
lVar3 = cfg_next(plVar2, "data_encipherment");
if (lVar3 != 0) {
*(undefined4 *)(lRam0000000000104073 + 0x240) = 1;
}
lVar3 = cfg_next(plVar2, "key_agreement");
if (lVar3 != 0) {
*(undefined4 *)(lRam00000000001040ab + 0x244) = 1;
}
lVar3 = cfg_next(plVar2, "non_repudiation");
if (lVar3 != 0) {
*(undefined4 *)(lRam00000000001040e3 + 0x23c) = 1;
}
lVar3 = cfg_next(plVar2, "tls_feature");
if ((lVar3 != 0) && (*(long *)(lRam000000000010411f + 0x2a0) == 0)) {
malloc(0x400);
}
cfg_free(plVar2);
if (local_20 == *(long *)(in_FS_OFFSET + 0x28)) {
return 0;
}
__stack_chk_fail();
}
strtol(*(char **)(lVar3 + 8), (char **)0x0, 10);
} | gnutls | ghidra |
static inline void emit_size_note(void) {
fputs_unlocked(
gettext("\nThe SIZE argument is an integer and optional unit (example: "
"10K is 10*1024).\nUnits are K,M,G,T,P,E,Z,Y (powers of 1024) or "
"KB,MB,... (powers of 1000).\nBinary prefixes can be used, too: "
"KiB=K, MiB=M, and so on.\n"),
stdout)
;
} | void emit_size_note(void)
{
char *__s;
FILE *__stream;
__stream = stdout;
__s =
(char *)gettext("\nThe SIZE argument is an integer and optional unit "
"(example: 10K is 10*1024).\nUnits are K,M,G,T,P,E,Z,Y "
"(powers of 1024) or KB,MB,... (powers of 1000).\nBinary "
"prefixes can be used, too: KiB=K, MiB=M, and so on.\n");
fputs_unlocked(__s, __stream);
return;
} | coreutils | ghidra |
static int bash_event_hook() {
int sig;
if (sigterm_received) {
return 0;
}
sig = 0;
if (terminating_signal)
sig = terminating_signal;
else if (interrupt_state)
sig = 2;
else if (read_timeout && read_timeout->alrmflag)
sig = 14;
else if ((rl_readline_state & (0x4000000))) {
sig = 14;
if (read_timeout)
read_timeout->alrmflag = 1;
} else
sig = first_pending_trap();
if (terminating_signal || interrupt_state ||
(read_timeout && read_timeout->alrmflag))
rl_cleanup_after_signal();
bashline_reset_event_hook();
(rl_readline_state &= ~(0x4000000));
if (posixly_correct && this_shell_builtin == read_builtin && sig == 2) {
last_command_exit_value = 128 | 2;
throw_to_top_level();
}
check_signals_and_traps();
return 0;
} | long long bash_event_hook() {
unsigned int v0;
if (sigterm_received)
return 0;
v0 = 0;
if (terminating_signal) {
v0 = terminating_signal;
} else if (interrupt_state) {
v0 = 2;
} else if (!(!read_timeout || !*((read_timeout + 24)))) {
v0 = 14;
} else if (!(rl_readline_state & 0x4000000)) {
v0 = first_pending_trap();
} else {
v0 = 14;
if (read_timeout)
*((read_timeout + 24)) = 1;
}
if (terminating_signal || interrupt_state ||
read_timeout && *((read_timeout + 24)))
rl_cleanup_after_signal();
bashline_reset_event_hook();
rl_readline_state = rl_readline_state & -67108865;
if (posixly_correct && this_shell_builtin == got.read_builtin && v0 == 2) {
last_command_exit_value = 130;
throw_to_top_level();
}
check_signals_and_traps();
return 0;
} | bash | angr_sailr |
static void uname_decoder(struct tar_stat_info *st,
char const *keyword __attribute__((unused)),
char const *arg,
size_t size __attribute__((unused))) {
decode_string(&st->uname, arg);
} | void uname_decoder(long param_1, undefined8 param_2, undefined8 param_3)
{
decode_string(param_1 + 0x20, param_3);
return;
} | tar | ghidra |
static char *get_history_word_specifier(char *spec, char *from,
int *caller_index) {
register int i = *caller_index;
int first, last;
int expecting_word_spec = 0;
char *result;
first = last = 0;
result = (char *)((void *)0);
if (spec[i] == ':') {
i++;
expecting_word_spec++;
}
if (spec[i] == '%') {
*caller_index = i + 1;
return (search_match
? strcpy(xmalloc(1 + strlen(search_match)), (search_match))
: strcpy(xmalloc(1 + strlen("")), ("")));
}
if (spec[i] == '*') {
*caller_index = i + 1;
result = history_arg_extract(1, '$', from);
return (result ? result : strcpy(xmalloc(1 + strlen("")), ("")));
}
if (spec[i] == '$') {
*caller_index = i + 1;
return (history_arg_extract('$', '$', from));
}
if (spec[i] == '-')
first = 0;
else if (spec[i] == '^') {
first = 1;
i++;
} else if (((spec[i]) >= '0' && (spec[i]) <= '9') && expecting_word_spec) {
for (first = 0; ((spec[i]) >= '0' && (spec[i]) <= '9'); i++)
first = (first * 10) + ((spec[i]) - '0');
} else
return ((char *)((void *)0));
if (spec[i] == '^' || spec[i] == '*') {
last = (spec[i] == '^') ? 1 : '$';
i++;
} else if (spec[i] != '-')
last = first;
else {
i++;
if (((spec[i]) >= '0' && (spec[i]) <= '9')) {
for (last = 0; ((spec[i]) >= '0' && (spec[i]) <= '9'); i++)
last = (last * 10) + ((spec[i]) - '0');
} else if (spec[i] == '$') {
i++;
last = '$';
} else if (spec[i] == '^') {
i++;
last = 1;
}
else
last = -1;
}
*caller_index = i;
if (last >= first || last == '$' || last < 0)
result = history_arg_extract(first, last, from);
return (result ? result : (char *)&error_pointer);
} | int get_history_word_specifier(char *a0, unsigned long long a1,
unsigned int *a2) {
unsigned int v0;
unsigned int v1;
unsigned int v2;
void *v3;
char *v5;
unsigned int v6;
unsigned int v7;
v5 = *(a2);
v2 = 0;
v1 = 0;
v0 = v1;
v3 = 0;
if (a0[*(a2)] == 58) {
v5 = *(a2) + 1;
v2 += 1;
}
if (*((a0 + v5)) == 37) {
*(a2) = v5 + 1;
if (!search_match)
v7 = strcpy(xmalloc(strlen(&g_403c84) + 1), &g_403c84);
else
v7 = strcpy(xmalloc(strlen(search_match) + 1), search_match);
} else if (*((a0 + v5)) == 42) {
*(a2) = v5 + 1;
v3 = history_arg_extract(0x1, 0x24, a1);
if (v3)
v7 = v3;
else
v7 = strcpy(xmalloc(strlen(&g_403c84) + 1), &g_403c84);
} else if (*((a0 + v5)) == 36) {
*(a2) = v5 + 1;
v7 = history_arg_extract(0x24, 0x24, a1);
} else {
if (*((a0 + v5)) == 45)
v0 = 0;
if (*((a0 + v5)) == 94) {
v0 = 1;
v5 = v5 + 1;
}
if (*((a0 + v5)) <= 47) {
LABEL_402e6f:
v7 = 0;
} else {
if (!(*((a0 + v5)) <= 57))
goto LABEL_402e6f;
if (!v2)
goto LABEL_402e6f;
v0 = 0;
while (true) {
if (*((a0 + v5)) <= 47)
break;
if (*((a0 + v5)) > 57)
break;
v0 = *((a0 + v5)) - 48 + ((v0 * 4) + v0) * 2;
v5 = v5 + 1;
}
if (*((a0 + v5)) == 94) {
LABEL_402e9c:
if (*((a0 + v5)) != 94)
v6 = 36;
else
v6 = 1;
v1 = v6;
*(&v5) = v5 + 1;
} else {
if (*((a0 + v5)) == 42)
goto LABEL_402e9c;
if (*((a0 + v5)) != 45) {
v1 = v0;
} else {
v5 = v5 + 1;
if (*((a0 + v5)) > 47 && *((a0 + v5)) <= 57) {
v1 = 0;
while (true) {
if (*((a0 + v5)) <= 47)
break;
if (*((a0 + v5)) > 57)
break;
v1 = *((a0 + v5)) - 48 + ((v1 * 4) + v1) * 2;
v5 = v5 + 1;
}
goto LABEL_402f9f;
}
if (*((a0 + v5)) == 36) {
*(&v5) = v5 + 1;
v1 = 36;
} else if (*((a0 + v5)) != 94) {
v1 = -1;
} else {
*(&v5) = v5 + 1;
v1 = 1;
}
}
}
LABEL_402f9f:
*(a2) = v5;
if (v1 < v0 && v1 != 36 && !(v1 < 0))
goto LABEL_402fd0;
v3 = history_arg_extract(v0, v1, a1);
LABEL_402fd0:
if (!v3)
v7 = &error_pointer;
else
v7 = v3;
}
}
return v7;
} | bash | angr_phoenix |
int history_truncate_file(const char *filename, int nlines) {
int ret = 0;
FILE *fp, *tp;
char template[sizeof(_history_tmp_template)];
char buf[4096];
int fd;
char *cp;
off_t off;
int count = 0;
ssize_t left = 0;
if (filename == ((void *)0) &&
(filename = _default_history_file()) == ((void *)0))
return (*__errno_location());
if ((fp = fopen(filename, "r+")) == ((void *)0))
return (*__errno_location());
strcpy(template, _history_tmp_template);
if ((fd = mkstemp(template)) == -1) {
ret = (*__errno_location());
goto out1;
}
if ((tp = fdopen(fd, "r+")) == ((void *)0)) {
close(fd);
ret = (*__errno_location());
goto out2;
}
for (;;) {
if (fread(buf, sizeof(buf), (size_t)1, fp) != 1) {
if (ferror(fp)) {
ret = (*__errno_location());
break;
}
if (fseeko(fp, (off_t)sizeof(buf) * count, 0) == (off_t)-1) {
ret = (*__errno_location());
break;
}
left = (ssize_t)fread(buf, (size_t)1, sizeof(buf), fp);
if (ferror(fp)) {
ret = (*__errno_location());
break;
}
if (left == 0) {
count--;
left = sizeof(buf);
} else if (fwrite(buf, (size_t)left, (size_t)1, tp) != 1) {
ret = (*__errno_location());
break;
}
fflush(tp);
break;
}
if (fwrite(buf, sizeof(buf), (size_t)1, tp) != 1) {
ret = (*__errno_location());
break;
}
count++;
}
if (ret)
goto out3;
cp = buf + left - 1;
if (*cp != '\n')
cp++;
for (;;) {
while (--cp >= buf) {
if (*cp == '\n') {
if (--nlines == 0) {
if (++cp >= buf + sizeof(buf)) {
count++;
cp = buf;
}
break;
}
}
}
if (nlines <= 0 || count == 0)
break;
count--;
if (fseeko(tp, (off_t)sizeof(buf) * count, 0) < 0) {
ret = (*__errno_location());
break;
}
if (fread(buf, sizeof(buf), (size_t)1, tp) != 1) {
if (ferror(tp)) {
ret = (*__errno_location());
break;
}
ret = 11;
break;
}
cp = buf + sizeof(buf);
}
if (ret || nlines > 0)
goto out3;
if (fseeko(fp, (off_t)0, 0) == (off_t)-1) {
ret = (*__errno_location());
goto out3;
}
if (fseeko(tp, (off_t)sizeof(buf) * count + (cp - buf), 0) == (off_t)-1) {
ret = (*__errno_location());
goto out3;
}
for (;;) {
if ((left = (ssize_t)fread(buf, (size_t)1, sizeof(buf), tp)) == 0) {
if (ferror(fp))
ret = (*__errno_location());
break;
}
if (fwrite(buf, (size_t)left, (size_t)1, fp) != 1) {
ret = (*__errno_location());
break;
}
}
fflush(fp);
if ((off = ftello(fp)) > 0)
(void)ftruncate(fileno(fp), off);
out3:
fclose(tp);
out2:
unlink(template);
out1:
fclose(fp);
return ret;
} | int history_truncate_file(char *param_1, int param_2)
{
int iVar1;
int *piVar2;
FILE *__stream;
FILE *__s;
size_t sVar3;
char *pcVar4;
__off_t _Var5;
long in_FS_OFFSET;
int local_1084;
char *local_1080;
int local_106c;
int local_1068;
char *local_1060;
size_t local_1058;
char local_1038[31];
char acStack4121[4097];
char acStack24[8];
long local_10;
local_10 = *(long *)(in_FS_OFFSET + 0x28);
local_106c = 0;
local_1068 = 0;
local_1058 = 0;
local_1080 = param_1;
if ((param_1 == (char *)0x0) && (local_1080 = (char *)_default_history_file(),
local_1080 == (char *)0x0)) {
piVar2 = __errno_location();
local_106c = *piVar2;
goto LAB_001033c1;
}
__stream = fopen(local_1080, "r+");
if (__stream == (FILE *)0x0) {
piVar2 = __errno_location();
local_106c = *piVar2;
goto LAB_001033c1;
}
strcpy(local_1038, "/tmp/.historyXXXXXX");
iVar1 = mkstemp(local_1038);
if (iVar1 != -1) {
__s = fdopen(iVar1, "r+");
if (__s != (FILE *)0x0) {
while (sVar3 = fread(acStack4121 + 1, 0x1000, 1, __stream), sVar3 == 1) {
sVar3 = fwrite(acStack4121 + 1, 0x1000, 1, __s);
if (sVar3 != 1) {
piVar2 = __errno_location();
local_106c = *piVar2;
goto LAB_00103088;
}
local_1068 = local_1068 + 1;
}
iVar1 = ferror(__stream);
if (iVar1 == 0) {
iVar1 = fseeko(__stream, (long)local_1068 << 0xc, 0);
if (iVar1 == -1) {
piVar2 = __errno_location();
local_106c = *piVar2;
} else {
local_1058 = fread(acStack4121 + 1, 1, 0x1000, __stream);
iVar1 = ferror(__stream);
if (iVar1 == 0) {
if (local_1058 == 0) {
local_1068 = local_1068 + -1;
local_1058 = 0x1000;
} else {
sVar3 = fwrite(acStack4121 + 1, local_1058, 1, __s);
if (sVar3 != 1) {
piVar2 = __errno_location();
local_106c = *piVar2;
goto LAB_00103088;
}
}
fflush(__s);
} else {
piVar2 = __errno_location();
local_106c = *piVar2;
}
}
} else {
piVar2 = __errno_location();
local_106c = *piVar2;
}
LAB_00103088:
if (local_106c == 0) {
pcVar4 = acStack4121 + local_1058;
local_1084 = param_2;
if (*pcVar4 != '\n') {
pcVar4 = pcVar4 + 1;
}
LAB_0010311c:
local_1060 = pcVar4;
pcVar4 = local_1060 + -1;
if (acStack4121 + 1 <= pcVar4)
goto LAB_001030c9;
goto LAB_00103137;
}
goto LAB_0010338e;
}
close(iVar1);
piVar2 = __errno_location();
local_106c = *piVar2;
goto LAB_0010339d;
}
piVar2 = __errno_location();
local_106c = *piVar2;
goto LAB_001033ac;
LAB_001030c9:
if ((*pcVar4 != '\n') || (local_1084 = local_1084 + -1, local_1084 != 0))
goto LAB_0010311c;
pcVar4 = local_1060;
if (acStack24 <= local_1060) {
local_1068 = local_1068 + 1;
pcVar4 = acStack4121 + 1;
}
LAB_00103137:
local_1060 = pcVar4;
if ((local_1084 < 1) || (local_1068 == 0))
goto LAB_00103201;
local_1068 = local_1068 + -1;
iVar1 = fseeko(__s, (long)local_1068 << 0xc, 0);
if (iVar1 < 0) {
piVar2 = __errno_location();
local_106c = *piVar2;
goto LAB_00103201;
}
sVar3 = fread(acStack4121 + 1, 0x1000, 1, __s);
if (sVar3 == 1) {
pcVar4 = acStack24;
goto LAB_0010311c;
}
iVar1 = ferror(__s);
if (iVar1 == 0) {
local_106c = 0xb;
} else {
piVar2 = __errno_location();
local_106c = *piVar2;
}
LAB_00103201:
if ((local_106c == 0) && (local_1084 < 1)) {
iVar1 = fseeko(__stream, 0, 0);
if (iVar1 == -1) {
piVar2 = __errno_location();
local_106c = *piVar2;
} else {
iVar1 = fseeko(__s,
(__off_t)(local_1060 + ((long)local_1068 * 0x1000 -
(long)(acStack4121 + 1))),
0);
if (iVar1 == -1) {
piVar2 = __errno_location();
local_106c = *piVar2;
} else {
do {
sVar3 = fread(acStack4121 + 1, 1, 0x1000, __s);
if (sVar3 == 0) {
iVar1 = ferror(__stream);
if (iVar1 != 0) {
piVar2 = __errno_location();
local_106c = *piVar2;
}
goto LAB_00103334;
}
sVar3 = fwrite(acStack4121 + 1, sVar3, 1, __stream);
} while (sVar3 == 1);
piVar2 = __errno_location();
local_106c = *piVar2;
LAB_00103334:
fflush(__stream);
_Var5 = ftello(__stream);
if (0 < _Var5) {
fileno(__stream);
}
}
}
}
LAB_0010338e:
fclose(__s);
LAB_0010339d:
unlink(local_1038);
LAB_001033ac:
fclose(__stream);
LAB_001033c1:
if (local_10 == *(long *)(in_FS_OFFSET + 0x28)) {
return local_106c;
}
__stack_chk_fail();
} | libedit | ghidra |
static void set_process_rdomain(struct ssh *ssh, const char *name) {
sshfatal("sshd.c", __func__, 1483, 0, SYSLOG_LEVEL_FATAL, ((void *)0),
"Unable to set routing domain: not supported in this platform");
} | void set_process_rdomain(void)
{
char *pcVar1;
int iVar2;
undefined8 uVar3;
undefined8 uVar4;
char **ppcVar5;
undefined *puVar6;
undefined *puVar7;
char *apcStack184[10];
char *pcStack104;
int iStack92;
long lStack88;
undefined8 uStack80;
byte *pbStack72;
apcStack184[9] = "set_process_rdomain";
pcStack104 = "sshd.c";
sshfatal("sshd.c", "set_process_rdomain", 0x5cb, 0, 1, 0);
ppcVar5 = apcStack184 + 9;
if (ctx_21501 == 0) {
apcStack184[8] = (char *)0x103bc3;
ctx_21501 = ssh_digest_start(4);
ppcVar5 = apcStack184 + 9;
if (ctx_21501 == 0) {
ppcVar5 = apcStack184 + 7;
apcStack184[7] = "ssh_digest_start";
sshfatal("sshd.c", "accumulate_host_timing_secret", 0x5da, 1, 1, 0);
}
}
if (apcStack184[9] == (char *)0x0) {
*(undefined8 *)((long)ppcVar5 + -8) = 0x103c27;
uVar3 = sshbuf_len(pcStack104);
*(undefined8 *)((long)ppcVar5 + -8) = 0x103c36;
uVar4 = sshbuf_ptr(pcStack104);
*(undefined8 *)((long)ppcVar5 + -8) = 0x103c4e;
iVar2 = ssh_digest_update(ctx_21501, uVar4, uVar3);
puVar7 = (undefined *)ppcVar5;
if (iVar2 != 0) {
puVar7 = (undefined *)((long)ppcVar5 + -0x10);
*(char **)((long)ppcVar5 + -0x10) = "ssh_digest_update";
*(undefined8 *)((long)ppcVar5 + -0x18) = 0x103c8c;
sshfatal("sshd.c", "accumulate_host_timing_secret", 0x5df, 1, 1, 0);
}
*(undefined8 *)(puVar7 + -8) = 0x103c96;
uStack80 = ssh_digest_bytes(4);
*(undefined8 *)(puVar7 + -8) = 0x103ca6;
pbStack72 = (byte *)xmalloc(uStack80);
*(undefined8 *)(puVar7 + -8) = 0x103cc4;
iVar2 = ssh_digest_final(ctx_21501, pbStack72, uStack80);
puVar6 = puVar7;
if (iVar2 != 0) {
puVar6 = puVar7 + -0x10;
*(char **)(puVar7 + -0x10) = "ssh_digest_final";
*(undefined8 *)(puVar7 + -0x18) = 0x103d02;
sshfatal("sshd.c", "accumulate_host_timing_secret", 0x5e3, 1, 1, 0);
}
options._7856_8_ =
(ulong)pbStack72[7] | (ulong)*pbStack72 << 0x38 |
(ulong)pbStack72[1] << 0x30 | (ulong)pbStack72[2] << 0x28 |
(ulong)pbStack72[3] << 0x20 | (ulong)pbStack72[4] << 0x18 |
(ulong)pbStack72[5] << 0x10 | (ulong)pbStack72[6] << 8;
*(undefined8 *)(puVar6 + -8) = 0x103dbc;
freezero(pbStack72, uStack80);
*(undefined8 *)(puVar6 + -8) = 0x103dcb;
ssh_digest_free(ctx_21501);
ctx_21501 = 0;
} else {
*(undefined8 *)((long)ppcVar5 + -8) = 0x103de0;
lStack88 = sshbuf_new();
puVar7 = (undefined *)ppcVar5;
if (lStack88 == 0) {
puVar7 = (undefined *)((long)ppcVar5 + -0x10);
*(char **)((long)ppcVar5 + -0x10) = "could not allocate buffer";
*(undefined8 *)((long)ppcVar5 + -0x18) = 0x103e25;
sshfatal("sshd.c", "accumulate_host_timing_secret", 0x5eb, 1, 1, 0);
}
pcVar1 = apcStack184[9];
*(undefined8 *)(puVar7 + -8) = 0x103e38;
iStack92 = sshkey_private_serialize(pcVar1, lStack88);
puVar6 = puVar7;
if (iStack92 != 0) {
*(undefined8 *)(puVar7 + -8) = 0x103e4b;
uVar3 = ssh_err(iStack92);
puVar6 = puVar7 + -0x10;
*(char **)(puVar7 + -0x10) = "decode key";
*(undefined8 *)(puVar7 + -0x18) = 0x103e82;
sshfatal("sshd.c", "accumulate_host_timing_secret", 0x5ed, 1, 1, uVar3);
}
*(undefined8 *)(puVar6 + -8) = 0x103e8e;
uVar3 = sshbuf_len(lStack88);
*(undefined8 *)(puVar6 + -8) = 0x103e9d;
uVar4 = sshbuf_ptr(lStack88);
*(undefined8 *)(puVar6 + -8) = 0x103eb5;
iVar2 = ssh_digest_update(ctx_21501, uVar4, uVar3);
puVar7 = puVar6;
if (iVar2 != 0) {
puVar7 = puVar6 + -0x10;
*(char **)(puVar6 + -0x10) = "ssh_digest_update";
*(undefined8 *)(puVar6 + -0x18) = 0x103ef3;
sshfatal("sshd.c", "accumulate_host_timing_secret", 0x5ef, 1, 1, 0);
}
*(undefined8 *)(puVar7 + -8) = 0x103eff;
sshbuf_reset(lStack88);
*(undefined8 *)(puVar7 + -8) = 0x103f0b;
sshbuf_free(lStack88);
}
return;
} | openssh-portable | ghidra |
static void cleanup_socket(void) {
if (cleanup_pid != 0 && getpid() != cleanup_pid)
return;
sshlog("ssh-agent.c", __func__, 1951, 1, SYSLOG_LEVEL_DEBUG1, ((void *)0),
"cleanup");
if (socket_name[0])
unlink(socket_name);
if (socket_dir[0])
rmdir(socket_dir);
} | void cleanup_socket(unsigned long a0, unsigned long a1, unsigned long a2,
unsigned long a3, unsigned long a4, unsigned long a5,
unsigned long long v2) {
char v0;
char v1;
unsigned long long v4;
unsigned long long v5;
if (cleanup_pid && getpid() != cleanup_pid)
return;
sshlog("ssh-agent.c", "cleanup_socket", 0x79f, 0x1, 0x5, 0x0, "cleanup",
*(&v0), &v1, *(&v1), v2);
unlink(&lock_pwhash);
v4 = 14378102485636827368;
if (false)
return;
v5 = rmdir(&lock_pwhash);
return;
} | openssh-portable | angr_sailr |
(uint64_t)verify_time < sigopts->valid_after) {
format_absolute_time(sigopts->valid_after, tvalid, sizeof(tvalid));
sshlog("sshsig.c", __func__, 945, 0, SYSLOG_LEVEL_ERROR, ((void *)0),
"%s:%lu: key is not yet valid: "
"verify time %s < valid-after %s",
path, linenum, tverify, tvalid)
;
goto done;
} | void format_absolute_time(void)
{
halt_baddata();
} | openssh-portable | ghidra |
int rl_vi_undo(int count, int key) { return (rl_undo_command(count, key)); } | void rl_vi_undo(undefined4 param_1, undefined4 param_2)
{
rl_undo_command(param_1, param_2);
return;
} | bash | ghidra |
static char *commandtext(union node *n) {
char *name;
((cmdnextc) = ((void *)stacknxt));
cmdtxt(n);
name = ((void *)stacknxt);
;
return savestr(name);
} | int commandtext(unsigned long long a0) {
unsigned long long v0;
cmdnextc = stacknxt;
cmdtxt(a0);
v0 = stacknxt;
return savestr(v0);
} | dash-0.5.11+git20210903+057cd650a4ed | angr_sailr |
int ssh_hmac_final(struct ssh_hmac_ctx *ctx, u_char *d, size_t dlen)
__attribute__(());
void ssh_hmac_free(struct ssh_hmac_ctx *ctx);
struct ssh_hmac_ctx {
int alg;
struct ssh_digest_ctx *ictx;
struct ssh_digest_ctx *octx;
struct ssh_digest_ctx *digest;
u_char *buf;
size_t buf_len;
}; | long long ssh_hmac_final(struct_0 *a0, unsigned long long a1,
unsigned long long a2) {
unsigned long long v0;
unsigned long long v2;
unsigned long long v3;
unsigned long long v4;
unsigned long long v5;
unsigned long long v6;
v0 = ssh_digest_bytes(a0->field_0);
if (a2 >= v0) {
v2 = ssh_digest_final(a0->field_18, a0->field_20, v0, a0->field_20);
if (!v2) {
v4 = ssh_digest_copy_state(a0->field_10, a0->field_18, a0->field_18);
if (v4 >= 0) {
v5 = ssh_digest_update(a0->field_18, a0->field_20, v0, a0->field_20);
if (v5 >= 0) {
v6 = ssh_digest_final(a0->field_18, a1, a2, a1);
if (v6 >= 0)
v3 = 0;
}
}
if (v6 < 0 || v5 < 0 || v4 < 0)
v3 = 4294967295;
}
}
if (a2 < v0 || v2)
v3 = 4294967295;
return v3;
} | openssh-portable | angr_dream |
static void usage(void) { print_usage(stderr); } | void usage(void)
{
print_usage(stderr);
return;
} | iproute2-6.0.0 | ghidra |
void set_follow_state(enum SymlinkOption opt) {
switch (opt) {
case SYMLINK_ALWAYS_DEREF:
options.xstat = optionl_stat;
options.x_getfilecon = optionl_getfilecon;
options.no_leaf_check = 1;
break;
case SYMLINK_NEVER_DEREF:
options.xstat = optionp_stat;
options.x_getfilecon = optionp_getfilecon;
break;
case SYMLINK_DEREF_ARGSONLY:
options.xstat = optionh_stat;
options.x_getfilecon = optionh_getfilecon;
options.no_leaf_check = 1;
}
options.symlink_handling = opt;
if (options.debug_options & DebugStat) {
options.xstat = debug_stat;
}
} | void set_follow_state(unsigned long a0) {
unsigned long long v1;
unsigned long long v2;
if (a0 == 2) {
gettext = got.optionh_stat;
get_stat_atime = optionh_getfilecon;
g_500014 = 1;
} else if (a0 <= 2) {
if (!a0) {
gettext = got.optionp_stat;
get_stat_atime = optionp_getfilecon;
} else if (a0 == 1) {
gettext = got.optionl_stat;
get_stat_atime = optionl_getfilecon;
g_500014 = 1;
}
}
got.pred_prune = a0;
v1 = pred_prune & 2;
if ((pred_prune & 2)) {
v2 = got.debug_stat;
gettext = got.debug_stat;
}
return;
} | findutils | angr_dream |
void coproc_flush() { coproc_dispose(&sh_coproc); } | long long coproc_flush() { return coproc_dispose(&sh_coproc); } | bash | angr_dream |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.