input stringlengths 26 172k | output stringlengths 18 318k | repo_name stringclasses 23 values | decompiler stringclasses 5 values |
|---|---|---|---|
static int nh_dump_bucket_filter(struct nlmsghdr *nlh, int reqlen) {
struct rtattr *nest;
int err = 0;
err = nh_dump_filter(nlh, reqlen);
if (err)
return err;
if (filter.id) {
err = addattr32(nlh, reqlen, NHA_ID, filter.id);
if (err)
return err;
}
if (filter.nhid) {
nest = addattr_nest(nlh, reqlen, NHA_RES_BUCKET);
nest->rta_type |= (1 << 15);
err = addattr32(nlh, reqlen, NHA_RES_BUCKET_NH_ID, filter.nhid);
if (err)
return err;
addattr_nest_end(nlh, nest);
}
return err;
} | int nh_dump_bucket_filter(undefined8 param_1, undefined4 param_2)
{
long lVar1;
int local_14;
local_14 = nh_dump_filter(param_1, param_2);
if ((local_14 == 0) &&
(((filter._24_4_ == 0 ||
(local_14 = addattr32(param_1, param_2, 1, filter._24_4_),
local_14 == 0)) &&
(filter._28_4_ != 0)))) {
lVar1 = addattr_nest(param_1, param_2, 0xd);
*(ushort *)(lVar1 + 2) = *(ushort *)(lVar1 + 2) | 0x8000;
local_14 = addattr32(param_1, param_2, 3, filter._28_4_);
if (local_14 == 0) {
addattr_nest_end(param_1, lVar1);
}
}
return local_14;
} | iproute2-6.0.0 | ghidra |
static struct cstring *find_line(intmax_t linenum) {
struct buffer_record *b;
if (head == ((void *)0) && !load_buffer())
return ((void *)0);
if (linenum < head->start_line)
return ((void *)0);
for (b = head;;) {
((void)sizeof((b) ? 1 : 0), __extension__({
if (b)
;
else
__assert_fail("b", "src/csplit.c", 583,
__extension__ __PRETTY_FUNCTION__);
}));
if (linenum < b->start_line + b->num_lines) {
struct line *l;
idx_t offset;
l = b->line_start;
offset = linenum - b->start_line;
while (offset >= 80) {
l = l->next;
offset -= 80;
}
return &l->starts[offset];
}
if (b->next == ((void *)0) && !load_buffer())
return ((void *)0);
b = b->next;
}
} | int find_line(unsigned long a0) {
unsigned long long v0[9];
struct_0 *v1;
unsigned long v2;
unsigned int v5;
if (!head && (load_buffer() ^ 1)) {
v5 = 0;
goto LABEL_400d45;
}
if (a0 < *((head + 16))) {
v5 = 0;
} else {
v0[0] = head;
while (true) {
if (!v0)
__assert_fail();
if (a0 < v0[4] + v0[2]) {
v1 = v0[6];
for (v2 = a0 - v0[2]; v2 > 79; v2 -= 80) {
v1 = v1->field_518;
}
v5 = &v1->padding_0[16 + 16 * v2 + 8];
break;
} else {
if (!v0[8] && (load_buffer() ^ 1)) {
v5 = 0;
break;
}
v0[0] = v0[8];
}
}
}
LABEL_400d45:
return v5;
} | coreutils | angr_phoenix |
static void set_invoke_hook(const struct cmdinfo *cip, const char *value) {
struct invoke_list *hook_list = cip->arg_ptr;
struct invoke_hook *hook_new;
hook_new = m_malloc(sizeof(*hook_new));
hook_new->command = m_strdup(value);
hook_new->next = ((void *)0);
*hook_list->tail = hook_new;
hook_list->tail = &hook_new->next;
} | void set_invoke_hook(long param_1, undefined8 param_2)
{
long lVar1;
undefined8 *puVar2;
undefined8 uVar3;
lVar1 = *(long *)(param_1 + 0x30);
puVar2 = (undefined8 *)m_malloc(0x10);
uVar3 = m_strdup(param_2);
puVar2[1] = uVar3;
*puVar2 = 0;
**(undefined8 **)(lVar1 + 8) = puVar2;
*(undefined8 **)(lVar1 + 8) = puVar2;
return;
} | dpkg | ghidra |
int sshbuf_get_string(struct sshbuf *buf, u_char **valp, size_t *lenp) {
const u_char *val;
size_t len;
int r;
if (valp != ((void *)0))
*valp = ((void *)0);
if (lenp != ((void *)0))
*lenp = 0;
if ((r = sshbuf_get_string_direct(buf, &val, &len)) < 0)
return r;
if (valp != ((void *)0)) {
if ((*valp = malloc(len + 1)) == ((void *)0)) {
;
return -2;
}
if (len != 0)
memcpy(*valp, val, len);
(*valp)[len] = '\0';
}
if (lenp != ((void *)0))
*lenp = len;
return 0;
} | long long sshbuf_get_string(unsigned long long a0, unsigned long long *a1,
unsigned long long *a2) {
unsigned int v0;
char v1;
char v2;
unsigned long long v4;
if (a1)
*(a1) = 0;
if (a2)
*(a2) = 0;
v0 = sshbuf_get_string_direct(a0, &v1, &v2);
if (v0 < 0) {
v4 = v0;
return v4;
}
if (a1) {
*(a1) = malloc(*(&v2) + 1);
if (!*(a1)) {
v4 = 4294967294;
return v4;
}
if (*(&v2))
memcpy(*(a1), *(&v1), *(&v2));
*((*(&v2) + *(a1))) = 0;
}
if (a2)
*(a2) = *(&v2);
v4 = 0;
return v4;
} | openssh-portable | angr_sailr |
static inline __u8 rta_getattr_u8(const struct rtattr *rta) {
return *(__u8 *)((
void *)(((char *)(rta)) +
((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0))));
} | int rta_getattr_u8(struct_0 *a0) { return a0->field_4; } | iproute2-6.0.0 | angr_sailr |
static void usage(int status) {
FILE *usageout = (0 != status) ? stderr : stdout;
(void)fprintf(usageout,
gettext("Usage: %s [options]\n"
"\n"
"Options:\n")
,
Prog);
(void)fputs(gettext(" -h, --help display this help "
"message and exit\n"),
usageout);
(void)fputs(
gettext(" -R, --root CHROOT_DIR directory to chroot into\n"),
usageout);
(void)fputs("\n", usageout);
exit(status);
} | void usage(unsigned long a0) {
void *v0;
unsigned long v1;
unsigned long v3;
void *v4;
v1 = v3;
if (a0)
v4 = stderr;
else
v4 = stdout;
v0 = v4;
fprintf(v0, gettext("Usage: %s [options]\n\nOptions:\n"));
fputs(gettext(" -h, --help display this help message and "
"exit\n"),
v0);
fputs(gettext(" -R, --root CHROOT_DIR directory to chroot into\n"),
v0);
fputs("\n", v0);
exit(a0);
} | shadow | angr_dream |
struct fsys_namenode *namenodetouse(struct fsys_namenode *namenode,
struct pkginfo *pkg,
struct pkgbin *pkgbin) {
struct fsys_namenode *fnn;
if (!namenode->divert)
return namenode;
debug(dbg_eachfile, "namenodetouse namenode='%s' pkg=%s", namenode->name,
pkgbin_name(pkg, pkgbin, pnaw_always));
fnn = (namenode->divert->useinstead && namenode->divert->pkgset != pkg->set)
? namenode->divert->useinstead
: namenode;
debug(dbg_eachfile,
"namenodetouse ... useinstead=%s camefrom=%s pkg=%s return %s",
namenode->divert->useinstead ? namenode->divert->useinstead->name
: "<none>",
namenode->divert->camefrom ? namenode->divert->camefrom->name
: "<none>",
namenode->divert->pkgset ? namenode->divert->pkgset->name : "<none>",
fnn->name);
return fnn;
} | long namenodetouse(long a1, _QWORD *a2, long a3) {
const char *v4;
long v5;
const char *v6;
const char *v7;
const char *v8;
const char *v9;
long v10;
if (!*(_QWORD *)(a1 + 24))
return a1;
v4 = (const char *)pkgbin_name(a2, a3, 3LL);
debug(8LL, "namenodetouse namenode='%s' pkg=%s", *(const char **)(a1 + 8),
v4);
if (!**(_QWORD **)(a1 + 24) ||
*(_QWORD *)(*(_QWORD *)(a1 + 24) + 16LL) == *a2)
v5 = a1;
else
v5 = **(_QWORD **)(a1 + 24);
v10 = v5;
v6 = *(const char **)(v5 + 8);
if (*(_QWORD *)(*(_QWORD *)(a1 + 24) + 16LL))
v7 = *(const char **)(*(_QWORD *)(*(_QWORD *)(a1 + 24) + 16LL) + 8LL);
else
v7 = "<none>";
if (*(_QWORD *)(*(_QWORD *)(a1 + 24) + 8LL))
v8 = *(const char **)(*(_QWORD *)(*(_QWORD *)(a1 + 24) + 8LL) + 8LL);
else
v8 = "<none>";
if (**(_QWORD **)(a1 + 24))
v9 = *(const char **)(**(_QWORD **)(a1 + 24) + 8LL);
else
v9 = "<none>";
debug(8LL, "namenodetouse ... useinstead=%s camefrom=%s pkg=%s return %s", v9,
v8, v7, v6);
return v10;
} | dpkg | ida |
void get_remote_user_groups_from_glob(struct sftp_conn *conn,
_ssh_compat_glob_t *g) {
u_int *uids = ((void *)0), nuids = 0, *gids = ((void *)0), ngids = 0;
if (!can_get_users_groups_by_id(conn))
return;
collect_ids_from_glob(g, 1, &uids, &nuids);
collect_ids_from_glob(g, 0, &gids, &ngids);
lookup_and_record(conn, uids, nuids, gids, ngids);
free(uids);
free(gids);
} | long long get_remote_user_groups_from_glob(unsigned long long a0, void *a1) {
unsigned int v0;
unsigned int v1;
void *v2;
void *v3;
v2 = 0;
v0 = 0;
v3 = 0;
v1 = 0;
if (can_get_users_groups_by_id(a0)) {
collect_ids_from_glob(a1, 0x1, &v2, &v0);
collect_ids_from_glob(a1, 0x0, &v3, &v1);
lookup_and_record(a0, v2, v0, v3, v1);
free(v2);
free(v3);
}
return 0;
} | openssh-portable | angr_phoenix |
void init_volume_number(void) {
FILE *file = fopen(volno_file_option, "r");
if (file) {
if (fscanf(file, "%d", &global_volno) != 1 || global_volno < 0)
do {
if (error_hook)
error_hook();
error(0, 0, gettext("%s: contains invalid volume number"),
quotearg_colon(volno_file_option));
fatal_exit();
} while (0);
if (ferror_unlocked(file))
read_error(volno_file_option);
if (fclose(file) != 0)
close_error(volno_file_option);
} else if ((*__errno_location()) != 2)
open_error(volno_file_option);
} | void init_volume_number(void)
{
int iVar1;
FILE *__stream;
undefined8 uVar2;
undefined8 uVar3;
int *piVar4;
__stream = fopen(volno_file_option, "r");
if (__stream == (FILE *)0x0) {
piVar4 = __errno_location();
if (*piVar4 != 2) {
open_error(volno_file_option);
}
} else {
iVar1 = __isoc99_fscanf(__stream, &DAT_001050b4, &global_volno);
if ((iVar1 != 1) || (global_volno < 0)) {
if (error_hook != (code *)0x0) {
(*error_hook)();
}
uVar2 = quotearg_colon(volno_file_option);
uVar3 = gettext("%s: contains invalid volume number");
error(0, 0, uVar3, uVar2);
fatal_exit();
}
iVar1 = ferror_unlocked(__stream);
if (iVar1 != 0) {
read_error(volno_file_option);
}
iVar1 = fclose(__stream);
if (iVar1 != 0) {
close_error(volno_file_option);
}
}
return;
} | tar | ghidra |
int ssh_digest_memory(int alg, const void *m, size_t mlen, u_char *d,
size_t dlen) {
const struct ssh_digest *digest = ssh_digest_by_alg(alg);
u_int mdlen;
if (digest == ((void *)0))
return -10;
if (dlen > (0x7fffffff * 2U + 1U))
return -10;
if (dlen < digest->digest_len)
return -10;
mdlen = dlen;
if (!EVP_Digest(m, mlen, d, &mdlen, digest->mdfunc(), ((void *)0)))
return -22;
return 0;
} | undefined8 ssh_digest_memory(undefined4 param_1, void *param_2, size_t param_3,
uchar *param_4, ulong param_5)
{
int iVar1;
undefined8 uVar2;
EVP_MD *type;
long in_FS_OFFSET;
uint local_1c;
long local_18;
long local_10;
local_10 = *(long *)(in_FS_OFFSET + 0x28);
local_18 = ssh_digest_by_alg(param_1);
if (local_18 == 0) {
uVar2 = 0xfffffff6;
} else if (param_5 < 0x100000000) {
if (param_5 < *(ulong *)(local_18 + 0x10)) {
uVar2 = 0xfffffff6;
} else {
local_1c = (uint)param_5;
type = (EVP_MD *)(**(code **)(local_18 + 0x18))();
iVar1 =
EVP_Digest(param_2, param_3, param_4, &local_1c, type, (ENGINE *)0x0);
if (iVar1 == 0) {
uVar2 = 0xffffffea;
} else {
uVar2 = 0;
}
}
} else {
uVar2 = 0xfffffff6;
}
if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) {
__stack_chk_fail();
}
return uVar2;
} | openssh-portable | ghidra |
int strvec_len(array)
char **array;
{
register int i;
for (i = 0; array[i]; i++)
;
return (i);
} | int strvec_len(unsigned long long *a0) {
void *v1;
for (v1 = 0; *((a0 + 0x8 * v1)); v1 = v1 + 1)
;
return v1;
} | bash | angr_dream |
int acl_cmp(acl_t acl1, acl_t acl2) {
acl_obj *acl1_obj_p = ((acl_obj *)__ext2int_and_check(acl1, (0x712C))),
*acl2_obj_p = ((acl_obj *)__ext2int_and_check(acl2, (0x712C)));
acl_entry_obj *p1_obj_p, *p2_obj_p;
if (!acl1_obj_p || !acl2_obj_p)
return -1;
if (acl1_obj_p->i.a_used != acl2_obj_p->i.a_used)
return 1;
p2_obj_p = acl2_obj_p->i.a_next;
for ((p1_obj_p) = (acl1_obj_p)->i.a_next;
(p1_obj_p) != (acl_entry_obj *)(acl1_obj_p);
(p1_obj_p) = (p1_obj_p)->i.e_next) {
if (p1_obj_p->i.e_entry.e_tag != p2_obj_p->i.e_entry.e_tag)
return 1;
if (!((p1_obj_p->i.e_entry.e_perm).i.s_perm ==
(p2_obj_p->i.e_entry.e_perm).i.s_perm))
return 1;
switch (p1_obj_p->i.e_entry.e_tag) {
case (0x02):
case (0x08):
if (((p1_obj_p->i.e_entry.e_id).i.q_id) !=
((p2_obj_p->i.e_entry.e_id).i.q_id))
return 1;
}
p2_obj_p = p2_obj_p->i.e_next;
}
return 0;
} | long long acl_cmp(unsigned long long a0, unsigned long long a1) {
struct_0 *v0;
struct_0 *v1;
unsigned long long v2[7];
unsigned long long v3[7];
unsigned long long v5;
v2[0] = __ext2int_and_check(a0, 0x712c);
v3[0] = __ext2int_and_check(a1, 0x712c);
if (v2 && v3) {
if (v2[6] != v3[6]) {
v5 = 1;
} else {
v1 = v3[2];
v0 = v2[2];
while (true) {
if (v0 == v2) {
v5 = 0;
break;
} else if (v0->field_20 != v1->field_20) {
v5 = 1;
break;
} else if (v0->field_40 != v1->field_40) {
v5 = 1;
break;
} else {
if ((v0->field_20 == 2 || v0->field_20 == 8) &&
v0->field_30 != v1->field_30) {
v5 = 1;
break;
}
if (v0->field_30 == v1->field_30 ||
v0->field_20 != 2 && v0->field_20 != 8) {
v1 = v1->field_10;
v0 = v0->field_10;
}
}
}
}
}
if (!v2 || !v3)
v5 = 4294967295;
return v5;
} | acl-2.3.1 | angr_dream |
char *expand_string_to_string(string, quoted)
char *string;
int quoted;
{
return (expand_string_to_string_internal(string, quoted, expand_string));
} | long long expand_string_to_string(char *a0, unsigned long a1) {
return expand_string_to_string_internal(a0, a1, expand_string);
} | bash | angr_sailr |
static _Bool
validate_file_name(char *file, _Bool check_basic_portability,
_Bool check_extra_portability) {
size_t filelen = strlen(file);
char *start;
_Bool check_component_lengths;
_Bool file_exists = 0;
if (check_extra_portability && !no_leading_hyphen(file))
return 0;
if ((check_basic_portability || check_extra_portability) && filelen == 0) {
error(0, 0, gettext("empty file name"));
return 0;
}
if (check_basic_portability) {
if (!portable_chars_only(file, filelen))
return 0;
} else {
struct stat st;
if (lstat(file, &st) == 0)
file_exists = 1;
else if ((*__errno_location()) != 2 || filelen == 0) {
error(0, (*__errno_location()), "%s",
quotearg_n_style_colon(0, shell_escape_quoting_style, file));
return 0;
}
}
if (check_basic_portability || (!file_exists && 256 <= filelen)) {
size_t maxsize;
if (check_basic_portability)
maxsize = 256;
else {
long int size;
char const *dir = (*file == '/' ? "/" : ".");
(*__errno_location()) = 0;
size = pathconf(dir, _PC_PATH_MAX);
if (size < 0 && (*__errno_location()) != 0) {
error(0, (*__errno_location()),
gettext("%s: unable to determine maximum file name length"), dir);
return 0;
}
maxsize =
(((size) < (0x7fffffffffffffffL)) ? (size) : (0x7fffffffffffffffL));
}
if (maxsize <= filelen) {
unsigned long int len = filelen;
unsigned long int maxlen = maxsize - 1;
error(0, 0, gettext("limit %lu exceeded by length %lu of file name %s"),
maxlen, len,
quotearg_style(shell_escape_always_quoting_style, file));
return 0;
}
}
check_component_lengths = check_basic_portability;
if (!check_component_lengths && !file_exists) {
for (start = file; *(start = component_start(start));) {
size_t length = component_len(start);
if (14 < length) {
check_component_lengths = 1;
break;
}
start += length;
}
}
if (check_component_lengths) {
size_t name_max = 14;
size_t known_name_max = (check_basic_portability ? 14 : 0);
for (start = file; *(start = component_start(start));) {
size_t length;
if (known_name_max)
name_max = known_name_max;
else {
long int len;
char const *dir = (start == file ? "." : file);
char c = *start;
(*__errno_location()) = 0;
*start = '\0';
len = pathconf(dir, _PC_NAME_MAX);
*start = c;
if (0 <= len)
name_max =
(((len) < (0x7fffffffffffffffL)) ? (len) : (0x7fffffffffffffffL));
else
switch ((*__errno_location())) {
case 0:
name_max = (18446744073709551615UL);
break;
case 2:
known_name_max = name_max;
break;
default:
*start = '\0';
error(0, (*__errno_location()), "%s",
quotearg_n_style_colon(0, shell_escape_quoting_style, dir));
*start = c;
return 0;
}
}
length = component_len(start);
if (name_max < length) {
unsigned long int len = length;
unsigned long int maxlen = name_max;
char c = start[len];
start[len] = '\0';
error(0, 0,
gettext("limit %lu exceeded by length %lu "
"of file name component %s"),
maxlen, len, quote(start));
start[len] = c;
return 0;
}
start += length;
}
}
return 1;
} | undefined8 validate_file_name(char *param_1, char param_2, char param_3)
{
bool bVar1;
char cVar2;
int iVar3;
size_t sVar4;
undefined8 uVar5;
char *pcVar6;
undefined8 uVar7;
int *piVar8;
ulong uVar9;
long in_FS_OFFSET;
char local_134;
char *local_130;
ulong local_128;
ulong local_120;
ulong local_118;
stat local_b8;
long local_20;
local_20 = *(long *)(in_FS_OFFSET + 0x28);
sVar4 = strlen(param_1);
bVar1 = false;
if ((param_3 == '\0') ||
(cVar2 = no_leading_hyphen(param_1), cVar2 == '\x01')) {
if (((param_2 == '\0') && (param_3 == '\0')) || (sVar4 != 0)) {
if (param_2 == '\0') {
iVar3 = lstat(param_1, &local_b8);
if (iVar3 == 0) {
bVar1 = true;
} else {
piVar8 = __errno_location();
if ((*piVar8 != 2) || (sVar4 == 0)) {
uVar5 = quotearg_n_style_colon(0, 3, param_1);
piVar8 = __errno_location();
error(0, *piVar8, &DAT_00101209, uVar5);
uVar5 = 0;
goto LAB_00100dba;
}
}
} else {
cVar2 = portable_chars_only(param_1, sVar4);
if (cVar2 != '\x01') {
uVar5 = 0;
goto LAB_00100dba;
}
}
if ((param_2 != '\0') || ((!bVar1 && (0xff < sVar4)))) {
if (param_2 == '\0') {
if (*param_1 == '/') {
pcVar6 = "/";
} else {
pcVar6 = ".";
}
piVar8 = __errno_location();
*piVar8 = 0;
local_128 = pathconf(pcVar6, 4);
if (((long)local_128 < 0) &&
(piVar8 = __errno_location(), *piVar8 != 0)) {
uVar5 = gettext("%s: unable to determine maximum file name length");
piVar8 = __errno_location();
error(0, *piVar8, uVar5, pcVar6);
uVar5 = 0;
goto LAB_00100dba;
}
} else {
local_128 = 0x100;
}
if (local_128 <= sVar4) {
uVar5 = quotearg_style(4, param_1);
uVar7 = gettext("limit %lu exceeded by length %lu of file name %s");
error(0, 0, uVar7, local_128 - 1, sVar4, uVar5);
uVar5 = 0;
goto LAB_00100dba;
}
}
local_134 = param_2;
if ((param_2 != '\x01') && (local_130 = param_1, !bVar1)) {
while (local_130 = (char *)component_start(local_130),
*local_130 != '\0') {
uVar9 = component_len(local_130);
if (0xe < uVar9) {
local_134 = '\x01';
break;
}
local_130 = local_130 + uVar9;
}
}
if (local_134 != '\0') {
local_120 = 0xe;
if (param_2 == '\0') {
local_118 = 0;
local_130 = param_1;
} else {
local_118 = 0xe;
local_130 = param_1;
}
while (local_130 = (char *)component_start(local_130),
*local_130 != '\0') {
if (local_118 == 0) {
pcVar6 = param_1;
if (local_130 == param_1) {
pcVar6 = ".";
}
cVar2 = *local_130;
piVar8 = __errno_location();
*piVar8 = 0;
*local_130 = '\0';
uVar9 = pathconf(pcVar6, 3);
*local_130 = cVar2;
if ((long)uVar9 < 0) {
piVar8 = __errno_location();
if (*piVar8 == 0) {
local_120 = 0xffffffffffffffff;
uVar9 = local_120;
} else {
if (*piVar8 != 2) {
*local_130 = '\0';
uVar5 = quotearg_n_style_colon(0, 3, pcVar6);
piVar8 = __errno_location();
error(0, *piVar8, &DAT_00101209, uVar5);
*local_130 = cVar2;
uVar5 = 0;
goto LAB_00100dba;
}
local_118 = local_120;
uVar9 = local_120;
}
}
} else {
local_120 = local_118;
uVar9 = local_120;
}
local_120 = uVar9;
uVar9 = component_len(local_130);
if (local_120 < uVar9) {
cVar2 = local_130[uVar9];
local_130[uVar9] = '\0';
uVar5 = quote(local_130);
uVar7 = gettext(
"limit %lu exceeded by length %lu of file name component %s");
error(0, 0, uVar7, local_120, uVar9, uVar5);
local_130[uVar9] = cVar2;
uVar5 = 0;
goto LAB_00100dba;
}
local_130 = local_130 + uVar9;
}
}
uVar5 = 1;
} else {
uVar5 = gettext("empty file name");
error(0, 0, uVar5);
uVar5 = 0;
}
} else {
uVar5 = 0;
}
LAB_00100dba:
if (local_20 == *(long *)(in_FS_OFFSET + 0x28)) {
return uVar5;
}
__stack_chk_fail();
} | coreutils | ghidra |
void libbsd_MD5Update(MD5_CTX *context, const uint8_t *data, size_t len) {
MD5Update(context, data, len);
} | long libbsd_MD5Update(long a1, long a2, long a3) {
return MD5Update(a1, a2, a3);
} | libbsd-0.11.7 | ida |
char *sh_makepath(path, dir, flags) const char *path, *dir;
int flags;
{
int dirlen, pathlen;
char *ret, *xpath, *xdir, *r, *s;
if (path == 0 || *path == '\0') {
if (flags & 0x02) {
xpath = get_working_directory("sh_makepath");
if (xpath == 0) {
ret = get_string_value("PWD");
if (ret)
xpath = (char *)strcpy(
sh_xmalloc((1 + strlen(ret)), "makepath.c", 86), (ret));
}
if (xpath == 0)
do {
xpath = (char *)sh_xmalloc((2), "makepath.c", 89);
xpath[0] = '.';
xpath[1] = '\0';
pathlen = 1;
} while (0);
else
pathlen = strlen(xpath);
} else
do {
xpath = (char *)sh_xmalloc((2), "makepath.c", 94);
xpath[0] = '.';
xpath[1] = '\0';
pathlen = 1;
} while (0);
} else if ((flags & 0x08) && path[0] == '.' &&
(path[1] == '\0' || (path[1] == '/' && path[2] == '\0'))) {
xpath = nullpath;
pathlen = 0;
} else {
xpath = ((flags & 0x01) && *path == '~') ? bash_tilde_expand(path, 0)
: (char *)path;
pathlen = strlen(xpath);
}
xdir = (char *)dir;
dirlen = strlen(xdir);
if ((flags & 0x04) && dir[0] == '.' && dir[1] == '/') {
xdir += 2;
dirlen -= 2;
}
r = ret = (char *)sh_xmalloc((2 + dirlen + pathlen), "makepath.c", 116);
s = xpath;
while (*s)
*r++ = *s++;
if (s > xpath && s[-1] != '/')
*r++ = '/';
s = xdir;
while (*r++ = *s++)
;
if (xpath != path && xpath != nullpath)
sh_xfree((xpath), "makepath.c", 126);
return (ret);
} | long long sh_makepath(char a0[3], char a1[2], unsigned long a2) {
unsigned int v0;
int tmp_10;
int tmp_14;
int tmp_22;
unsigned int v1;
char v2[3];
char v3[2];
char *v4;
char v5[3];
char *v6;
char v8[3];
if (!(!a0 || !a0[0])) {
if (!(a2 & 8))
goto LABEL_400184;
if (!(a0[0] == 46))
goto LABEL_400184;
switch (a0[1]) {
case 0:
LABEL_400170:
*(&v2) = nullpath;
v1 = 0;
break;
case 47:
if (!a0[2])
goto LABEL_400170;
else
goto LABEL_400184;
default:
LABEL_400184:
if (!(a2 & 1) || a0[0] != 126)
v8 = a0;
else
*(&v8) = bash_tilde_expand(a0, 0x0);
*(&v2) = v8;
v1 = strlen(v2);
break;
}
} else if (!(a2 & 2)) {
*(&v8) = sh_xmalloc(0x2, "makepath.c", 0x5e);
*(&v2) = v8;
v2[0] = 46;
v2[1] = 0;
v1 = 1;
} else {
*(&v8) = get_working_directory("sh_makepath");
*(&v2) = v8;
if (!v2) {
v6 = get_string_value("PWD");
if (v6)
*(&v2) = strcpy(sh_xmalloc(strlen(v6) + 1, "makepath.c", 0x56), v6);
}
if (!v2) {
*(&v8) = sh_xmalloc(0x2, "makepath.c", 0x59);
*(&v2) = v8;
v2[0] = 46;
v2[1] = 0;
v1 = 1;
} else {
v1 = strlen(v2);
}
}
*(&v3) = a1;
v0 = strlen(v3);
if ((a2 & 4) && a1[0] == 46 && a1[1] == 47) {
*(&v3) = v3 + 1;
v0 -= 2;
}
v6 = sh_xmalloc(v1 + v0 + 2, "makepath.c", 0x74);
v4 = v6;
for (*(&v5) = v2; v5[0]; *(v8) = a2) {
tmp_10 = v5;
*(&v5) = &v5[1];
v8 = v4;
v4 += 1;
a2 = *(tmp_10);
}
if (v5 > v2 && v5[1] != 47) {
v8 = v4;
v4 += 1;
*(v8) = 47;
}
*(&v5) = v3;
do {
tmp_14 = v5;
*(&v5) = &v5[1];
tmp_22 = v4;
v4 += 1;
*(&a2) = *(tmp_14);
*(tmp_22) = a2;
*(&v8) = *(tmp_22);
} while (v8);
if (v2 != a0 && v2 != nullpath)
sh_xfree(v2, "makepath.c", 0x7e);
return v6;
} | bash | angr_sailr |
static void process_extended_lsetstat(u_int32_t id) {
Attrib a;
char *name;
int r, status = 0;
if ((r = sshbuf_get_cstring(iqueue, &name, ((void *)0))) != 0 ||
(r = decode_attrib(iqueue, &a)) != 0)
sshfatal("sftp-server.c", __func__, 1476, 1, SYSLOG_LEVEL_FATAL, ssh_err(r),
"parse");
sshlog("sftp-server.c", __func__, 1478, 0, SYSLOG_LEVEL_DEBUG1, ((void *)0),
"request %u: lsetstat name \"%s\"", id, name);
if (a.flags & 0x00000001) {
status = 5;
goto out;
}
if (a.flags & 0x00000004) {
sshlog("sftp-server.c", __func__, 1485, 0, SYSLOG_LEVEL_INFO, ((void *)0),
"set \"%s\" mode %04o", name, a.perm);
r = fchmodat(-100, name, a.perm & 07777, 0x100);
if (r == -1)
status = errno_to_portable((*__errno_location()));
}
if (a.flags & 0x00000008) {
char buf[64];
time_t t = a.mtime;
strftime(buf, sizeof(buf), "%Y%m%d-%H:%M:%S", localtime(&t));
sshlog("sftp-server.c", __func__, 1497, 0, SYSLOG_LEVEL_INFO, ((void *)0),
"set \"%s\" modtime %s", name, buf);
r = utimensat(-100, name, attrib_to_ts(&a), 0x100);
if (r == -1)
status = errno_to_portable((*__errno_location()));
}
if (a.flags & 0x00000002) {
sshlog("sftp-server.c", __func__, 1504, 0, SYSLOG_LEVEL_INFO, ((void *)0),
"set \"%s\" owner %lu group %lu", name, (u_long)a.uid,
(u_long)a.gid);
r = fchownat(-100, name, a.uid, a.gid,
0x100);
if (r == -1)
status = errno_to_portable((*__errno_location()));
}
out:
send_status(id, status);
free(name);
} | long long process_extended_lsetstat(unsigned long a0) {
unsigned long long v0;
unsigned int v1;
unsigned int v2;
char v3;
unsigned long v4;
char v5;
char v6;
char v7;
char v8;
char v9;
char v10;
unsigned long long v11;
unsigned long long v12;
unsigned long v13;
unsigned long v14;
char v15;
v2 = 0;
v1 = sshbuf_get_cstring(0xe87d894820ec8348, &v3, 0x0, &v3);
if (v1 || (v1 = decode_attrib(0xe87d894820ec8348, &v5, &v5), v1)) {
v0 = "parse";
sshfatal("sftp-server.c", "process_extended_lsetstat", 0x5c4, 0x1, 0x1,
ssh_err(v1));
}
v13 = *(&v3);
v12 = a0;
v11 = "request %u: lsetstat name \"%s\"";
sshlog("sftp-server.c", "process_extended_lsetstat", 0x5c6, 0x0, 0x5, 0x0,
*(&v15));
if ((*(&v5) & 1)) {
v2 = 5;
} else {
if ((*(&v5) & 4)) {
v13 = *(&v8);
v12 = *(&v3);
v11 = "set \"%s\" mode %04o";
sshlog("sftp-server.c", "process_extended_lsetstat", 0x5cd, 0x0, 0x3, 0x0,
*(&v15));
v1 = fchmodat(0xffffff9c, *(&v3), *(&v8) & 4095, 0x100);
if (v1 == -1)
v2 = errno_to_portable(*(__errno_location()));
}
if ((*(&v5) & 8)) {
v4 = *(&v9);
strftime(&v10, 0x40, "%Y%m%d-%H:%M:%S", localtime(&v4));
v13 = &v10;
v12 = *(&v3);
v11 = "set \"%s\" modtime %s";
sshlog("sftp-server.c", "process_extended_lsetstat", 0x5d9, 0x0, 0x3, 0x0,
*(&v15));
v1 = utimensat(0xffffff9c, *(&v3), attrib_to_ts(&v5), 0x100);
if (v1 == -1)
v2 = errno_to_portable(*(__errno_location()));
}
if ((*(&v5) & 2)) {
v14 = *(&v7);
v13 = *(&v6);
v12 = *(&v3);
v11 = "set \"%s\" owner %lu group %lu";
sshlog("sftp-server.c", "process_extended_lsetstat", 0x5e0, 0x0, 0x3, 0x0,
*(&v15));
v1 = fchownat(0xffffff9c, *(&v3), *(&v6), *(&v7), 0x100);
if (v1 == -1)
v2 = errno_to_portable(*(__errno_location()));
}
}
send_status(a0, v2);
free(*(&v3));
return 0;
} | openssh-portable | angr_sailr |
static void pad(Char *s) {
Int32 i;
if ((Int32)strlen(s) >= longestFileName)
return;
for (i = 1; i <= longestFileName - (Int32)strlen(s); i++)
fprintf(stderr, " ");
} | void pad(char *a0) {
unsigned int v0;
unsigned long long v2;
v2 = longestFileName;
if (strlen(a0) < longestFileName) {
v0 = 1;
while (true) {
if (v0 > (longestFileName - strlen(a0)))
break;
fprintf(stderr, " ");
v0 += 1;
}
}
return;
} | bzip2 | angr_phoenix |
static int terminal_putc(int c) {
if (terminal_outfile == ((void *)0))
return -1;
return fputc(c, terminal_outfile);
} | int terminal_putc(int param_1)
{
int iVar1;
if (terminal_outfile == (FILE *)0x0) {
iVar1 = -1;
} else {
iVar1 = fputc(param_1, terminal_outfile);
}
return iVar1;
} | libedit | ghidra |
static int history_def_prev(void *p, HistEvent *ev) {
history_t *h = (history_t *)p;
if (h->cursor == &h->list) {
{
ev->num = (h->cur > 0) ? 6 : 5;
ev->str = he_errlist[(h->cur > 0) ? 6 : 5];
};
return -1;
}
if (h->cursor->prev == &h->list) {
{
ev->num = 7;
ev->str = he_errlist[7];
};
return -1;
}
h->cursor = h->cursor->prev;
*ev = h->cursor->ev;
return 0;
} | long long history_def_prev(struct_1 *a0, struct_0 *a1) {
unsigned int v1;
unsigned long long v2;
unsigned long long v3;
unsigned long long v4;
if (a0->field_28 == a0) {
if (a0->field_34 <= 0)
v1 = 5;
else
v1 = 6;
a1->field_0 = v1;
if (a0->field_34 > 0)
v3 = 6;
else
v3 = 5;
a1->field_8 = (&he_errlist)[v3];
v4 = 4294967295;
} else if (a0->field_28->field_20 == a0) {
a1->field_0 = 7;
a1->field_8 = "no previous event";
v4 = 4294967295;
} else {
a0->field_28 = a0->field_28->field_20;
v2 = a0->field_28->field_8;
*(&a1->field_0) = a0->field_28->field_0;
a1->field_8 = v2;
v4 = 0;
}
return v4;
} | libedit | angr_phoenix |
const char *session_get_remote_name_or_ip(struct ssh *ssh, u_int utmp_size,
int use_dns) {
const char *remote = "";
if (utmp_size > 0)
remote = auth_get_canonical_hostname(ssh, use_dns);
if (utmp_size == 0 || strlen(remote) > utmp_size)
remote = ssh_remote_ipaddr(ssh);
return remote;
} | int session_get_remote_name_or_ip(unsigned long long a0, unsigned long a1,
unsigned long a2) {
unsigned long long v0;
v0 = &g_407897;
if (a1)
v0 = auth_get_canonical_hostname(a0, a2, a2);
if (!a1 || strlen(v0) > a1)
v0 = ssh_remote_ipaddr(a0);
return v0;
} | openssh-portable | angr_dream |
int rl_add_funmap_entry(const char *name, rl_command_func_t *function) {
if (funmap_entry + 2 >= funmap_size) {
funmap_size += 64;
funmap = (FUNMAP **)xrealloc(funmap, funmap_size * sizeof(FUNMAP *));
}
funmap[funmap_entry] = (FUNMAP *)xmalloc(sizeof(FUNMAP));
funmap[funmap_entry]->name = name;
funmap[funmap_entry]->function = function;
funmap[++funmap_entry] = (FUNMAP *)((void *)0);
return funmap_entry;
} | long rl_add_funmap_entry(long a1, long a2) {
_QWORD *v2;
if (funmap_entry + 2 >= funmap_size) {
funmap_size += 64;
funmap = xrealloc(funmap, 8LL * funmap_size);
}
v2 = (_QWORD *)(funmap + 8LL * funmap_entry);
*v2 = xmalloc(16LL);
**(_QWORD **)(8LL * funmap_entry + funmap) = a1;
*(_QWORD *)(*(_QWORD *)(8LL * funmap_entry++ + funmap) + 8LL) = a2;
*(_QWORD *)(8LL * funmap_entry + funmap) = 0LL;
return (unsigned int)funmap_entry;
} | bash | ida |
static void scan_entries(size_t n, const STRUCT_UTMP *utmp_buf) {
char *ttyname_b;
time_t boottime = ((time_t)~(
(time_t)(!(!((time_t)0 < (time_t)-1))
? (time_t)-1
: ((((time_t)1 << ((sizeof(time_t) * 8) - 2)) - 1) * 2 +
1))));
if (include_heading)
print_heading();
if (my_line_only) {
ttyname_b = ttyname(0);
if (!ttyname_b)
return;
if (strncmp(ttyname_b,
""
"/dev/"
"",
sizeof("/dev/") - 1) == 0)
ttyname_b += (sizeof("/dev/") - 1);
}
while (n--) {
if (!my_line_only || (strncmp(ttyname_b, utmp_buf->ut_line,
sizeof(utmp_buf->ut_line)) == 0)) {
if (need_users && (((utmp_buf)->ut_user)[0] &&
(((utmp_buf)->ut_type == (7)) ||
(0 && ((utmp_buf)->ut_tv.tv_sec) != 0))))
print_user(utmp_buf, boottime);
else if (need_runlevel && ((utmp_buf)->ut_type == (1)))
print_runlevel(utmp_buf);
else if (need_boottime && ((utmp_buf)->ut_type == (2)))
print_boottime(utmp_buf);
else if (need_clockchange && ((utmp_buf)->ut_type == (3)))
print_clockchange(utmp_buf);
else if (need_initspawn && ((utmp_buf)->ut_type == (5)))
print_initspawn(utmp_buf);
else if (need_login && ((utmp_buf)->ut_type == (6)))
print_login(utmp_buf);
else if (need_deadprocs && ((utmp_buf)->ut_type == (8)))
print_deadprocs(utmp_buf);
}
if (((utmp_buf)->ut_type == (2)))
boottime = ((utmp_buf)->ut_tv.tv_sec);
utmp_buf++;
}
} | void scan_entries(long param_1, short *param_2)
{
int iVar1;
short *local_28;
long local_20;
char *local_18;
long local_10;
local_10 = -0x8000000000000000;
if (include_heading != '\0') {
print_heading();
}
local_28 = param_2;
local_20 = param_1;
if (my_line_only != '\0') {
local_18 = ttyname(0);
if (local_18 == (char *)0x0) {
return;
}
iVar1 = strncmp(local_18, "/dev/", 5);
local_20 = param_1;
if (iVar1 == 0) {
local_18 = local_18 + 5;
local_20 = param_1;
}
}
while (local_20 != 0) {
if ((my_line_only != '\x01') ||
(iVar1 = strncmp(local_18, (char *)(local_28 + 4), 0x20), iVar1 == 0)) {
if ((need_users == '\0') ||
((*(char *)(local_28 + 0x16) == '\0' || (*local_28 != 7)))) {
if ((need_runlevel == '\0') || (*local_28 != 1)) {
if ((need_boottime == '\0') || (*local_28 != 2)) {
if ((need_clockchange == '\0') || (*local_28 != 3)) {
if ((need_initspawn == '\0') || (*local_28 != 5)) {
if ((need_login == '\0') || (*local_28 != 6)) {
if ((need_deadprocs != '\0') && (*local_28 == 8)) {
print_deadprocs(local_28);
}
} else {
print_login(local_28);
}
} else {
print_initspawn(local_28);
}
} else {
print_clockchange(local_28);
}
} else {
print_boottime(local_28);
}
} else {
print_runlevel(local_28);
}
} else {
print_user(local_28, local_10);
}
}
if (*local_28 == 2) {
local_10 = (long)*(int *)(local_28 + 0xaa);
}
local_28 = local_28 + 0xc0;
local_20 = local_20 + -1;
}
return;
} | coreutils | ghidra |
static int getissuer_callback(const gnutls_x509_trust_list_t tlist,
const gnutls_x509_crt_t cert,
gnutls_x509_crt_t **issuers,
unsigned int *issuers_size) {
gnutls_datum_t ud;
int ret;
gnutls_datum_t resp;
char *url = ((void *)0);
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;
gnutls_x509_crt_t issuer;
gnutls_datum_t data = {((void *)0), 0};
static char buffer[4096 + 1];
sockets_init();
i = 0;
do {
ret = gnutls_x509_crt_get_authority_info_access(
cert, i++, GNUTLS_IA_CAISSUERS_URI, &data,
((void *)0));
} while (ret == -105);
if (ret < 0) {
fprintf(stderr, "*** Cannot find caIssuer URI in certificate: %s\n",
gnutls_strerror(ret));
return 0;
}
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 caIssuer server: %s...\n", _hostname);
memset(&ud, 0, sizeof(ud));
snprintf(headers, sizeof(headers),
"GET /%s HTTP/1.0\r\n"
"Host: %s\r\n"
"Accept: */*\r\n"
"Connection: close\r\n\r\n",
path, _hostname);
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);
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;
socket_bye(&hd, 0);
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.size = ud.size - (p - ud.data);
resp.data = p;
ret = gnutls_x509_crt_init(&issuer);
if (ret < 0) {
fprintf(stderr, "Memory error\n");
ret = -1;
goto cleanup;
}
ret = gnutls_x509_crt_list_import2(issuers, issuers_size, &resp,
GNUTLS_X509_FMT_DER, 0);
if (ret < 0) {
fprintf(stderr, "Decoding error: %s\n", gnutls_strerror(ret));
ret = -1;
goto cleanup;
}
ret = 0;
cleanup:
gnutls_free((void *)(data.data)), data.data = ((void *)0);
free(ud.data);
free(url);
return ret;
} | long long getissuer_callback(unsigned long a0, unsigned long long a1,
unsigned long long a2, unsigned long long a3) {
int tmp_9;
void *v0;
unsigned long long v1;
unsigned long v2;
char v3;
unsigned int v4;
unsigned int v5;
unsigned int v6;
unsigned long long v7;
char v8;
void *v9;
unsigned long long v10;
unsigned long v11;
char v12;
char v13;
unsigned long v14;
unsigned int v15;
void *v16;
unsigned int v17;
char v18;
char v19;
char v20;
unsigned long long v23;
v2 = a0;
v1 = a1;
v9 = 0;
v7 = &g_407819;
v6 = 0;
v16 = 0;
v17 = 0;
sockets_init();
v5 = 0;
do {
tmp_9 = v5;
v5 += 1;
} while ((v4 = gnutls_x509_crt_get_authority_info_access(v1, tmp_9, 0x277a,
&v16, 0x0),
v4 == -105));
if (v4 < 0) {
fprintf(*(&stderr), "*** Cannot find caIssuer URI in certificate: %s\n",
gnutls_strerror(v4));
v23 = 0;
return v23;
}
v9 = malloc(v17 + 1);
if (!v9) {
v23 = 4294967295;
return v23;
}
memcpy(v9, v16, v17);
v9[v17] = 0;
*(5243000)(v16);
v16 = 0;
v10 = host_from_url(v9, &v3, &v7);
if (!*(&v3))
strcpy(&v19, "80");
else
snprintf(&v19, 0x10, "%u", *(&v3));
fprintf(*(&stderr), "Connecting to caIssuer server: %s...\n", v10);
memset(&v12, 0x0, 0x10);
snprintf(&v20, 0x400,
"GET /%s HTTP/1.0\r\nHost: %s\r\nAccept: */*\r\nConnection: "
"close\r\n\r\n",
v7, v10);
v6 = strlen(&v20);
v0 = 0;
socket_open2(&v18, v10, &v19, 0x0, 0x28, "Connecting to", 0x0, 0x0, 0x0);
socket_send(&v18, &v20, v6, &v20);
do {
v4 = socket_recv(&v18, &buffer.13622, 0x1001, a3);
if (v4 > 0)
get_data(&buffer.13622, v4, 0x1, &v12);
} while (v4 > 0);
if (v4 < 0 || !*(&v13)) {
perror("recv");
v4 = -1;
socket_bye(&v18, 0x0);
} else {
socket_bye(&v18, 0x0);
v11 = memmem(*(&v12), *(&v13), "\r\n\r\n", 0x4);
if (v11) {
v11 += 4;
v15 = *(&v13) - (v11 - *(&v12));
v14 = v11;
v4 = gnutls_x509_crt_init(&v8);
if (v4 >= 0) {
v4 = gnutls_x509_crt_list_import2(a2, a3, &v14, 0x0, 0x0);
if (v4 >= 0) {
v4 = 0;
} else {
fprintf(*(&stderr), "Decoding error: %s\n", gnutls_strerror(v4));
v4 = -1;
}
} else {
fprintf(*(&stderr), "Memory error\n");
v4 = -1;
}
} else {
fprintf(*(&stderr), "Cannot interpret HTTP response\n");
v4 = -1;
}
}
*(5243000)(v16);
v16 = 0;
free(*(&v12));
free(v9);
v23 = v4;
return v23;
} | gnutls | angr_sailr |
static _Bool
selected_fstype(char const *fstype) {
const struct fs_type_list *fsp;
if (fs_select_list == ((void *)0) || fstype == ((void *)0))
return 1;
for (fsp = fs_select_list; fsp; fsp = fsp->fs_next)
if ((strcmp(fstype, fsp->fs_name) == 0))
return 1;
return 0;
} | int selected_fstype(char *a0) {
unsigned long long v0[2];
unsigned int v2;
if (!fs_select_list) {
v2 = 1;
return v2;
}
if (!a0) {
v2 = 1;
return v2;
}
v0[0] = fs_select_list;
while (true) {
if (!v0) {
v2 = 0;
return v2;
} else if (strcmp(a0, v0[0])) {
v0[0] = v0[1];
} else {
v2 = 1;
return v2;
}
}
} | coreutils | angr_sailr |
static int mroute_list(int argc, char **argv) {
char *id = ((void *)0);
int family = preferred_family;
ipmroute_reset_filter(0);
if (family == 2 || family == 0) {
family = 128;
filter.af = 128;
filter.tb = RT_TABLE_DEFAULT;
} else if (family == 10) {
family = 129;
filter.af = 129;
} else {
return 0;
}
filter.msrc.family = filter.mdst.family = family;
while (argc > 0) {
if (matches(*argv, "table") == 0) {
__u32 tid;
do {
argv++;
if (--argc <= 0)
incomplete_command();
} while (0);
if (rtnl_rttable_a2n(&tid, *argv)) {
if (strcmp(*argv, "all") == 0) {
filter.tb = 0;
} else if (strcmp(*argv, "help") == 0) {
usage();
} else {
invarg("table id value is invalid\n", *argv);
}
} else
filter.tb = tid;
} else if (strcmp(*argv, "iif") == 0) {
do {
argv++;
if (--argc <= 0)
incomplete_command();
} while (0);
id = *argv;
} else if (matches(*argv, "from") == 0) {
do {
argv++;
if (--argc <= 0)
incomplete_command();
} while (0);
if (get_prefix(&filter.msrc, *argv, family))
invarg("from value is invalid\n", *argv);
} else {
if (strcmp(*argv, "to") == 0) {
do {
argv++;
if (--argc <= 0)
incomplete_command();
} while (0);
}
if (matches(*argv, "help") == 0)
usage();
if (get_prefix(&filter.mdst, *argv, family))
invarg("to value is invalid\n", *argv);
}
argc--;
argv++;
}
ll_init_map(&rth);
if (id) {
int idx;
idx = ll_name_to_index(id);
if (!idx)
return nodev(id);
filter.iif = idx;
}
if (rtnl_routedump_req(&rth, filter.af, iproute_dump_filter) < 0) {
perror("Cannot send dump request");
return 1;
}
new_json_obj(json);
if (rtnl_dump_filter_nc(&rth, print_mroute, stdout, 0) < 0) {
delete_json_obj();
fprintf(stderr, "Dump terminated\n");
exit(1);
}
delete_json_obj();
return 0;
} | undefined8 mroute_list(int param_1, char **param_2)
{
char cVar1;
int iVar2;
undefined8 uVar3;
long in_FS_OFFSET;
char **local_38;
int local_2c;
undefined4 local_24;
int local_20;
int local_1c;
char *local_18;
long local_10;
local_10 = *(long *)(in_FS_OFFSET + 0x28);
local_18 = (char *)0x0;
local_20 = preferred_family;
ipmroute_reset_filter(0);
if ((local_20 == 2) || (local_20 == 0)) {
local_20 = 0x80;
filter._4_4_ = 0x80;
filter._0_4_ = 0xfd;
} else {
if (local_20 != 10) {
uVar3 = 0;
goto LAB_00100f1e;
}
local_20 = 0x81;
filter._4_4_ = 0x81;
}
filter._18_2_ = (undefined2)local_20;
filter._282_2_ = filter._18_2_;
local_38 = param_2;
for (local_2c = param_1; 0 < local_2c; local_2c = local_2c + -1) {
cVar1 = matches(*local_38, "table");
if (cVar1 == '\x01') {
iVar2 = strcmp(*local_38, "iif");
if (iVar2 == 0) {
local_38 = local_38 + 1;
local_2c = local_2c + -1;
if (local_2c < 1) {
incomplete_command();
}
local_18 = *local_38;
} else {
cVar1 = matches(*local_38, &DAT_001014c2);
if (cVar1 != '\x01') {
local_38 = local_38 + 1;
local_2c = local_2c + -1;
if (local_2c < 1) {
incomplete_command();
}
iVar2 = get_prefix(0x101154, *local_38, local_20);
if (iVar2 == 0)
goto LAB_00100e30;
invarg("from value is invalid\n", *local_38);
}
iVar2 = strcmp(*local_38, "to");
if (iVar2 == 0) {
local_38 = local_38 + 1;
local_2c = local_2c + -1;
if (local_2c < 1) {
incomplete_command();
}
}
cVar1 = matches(*local_38, &DAT_001014a2);
if (cVar1 != '\x01') {
usage();
}
iVar2 = get_prefix(0x10104c, *local_38, local_20);
if (iVar2 != 0) {
invarg("to value is invalid\n", *local_38);
}
}
} else {
local_38 = local_38 + 1;
local_2c = local_2c + -1;
if (local_2c < 1) {
incomplete_command();
}
iVar2 = rtnl_rttable_a2n(&local_24, *local_38);
if (iVar2 != 0) {
iVar2 = strcmp(*local_38, "all");
if (iVar2 == 0) {
filter._0_4_ = 0;
goto LAB_00100e30;
}
iVar2 = strcmp(*local_38, "help");
if (iVar2 == 0) {
usage();
}
invarg("table id value is invalid\n", *local_38);
}
filter._0_4_ = local_24;
}
LAB_00100e30:
local_38 = local_38 + 1;
}
ll_init_map(&rth);
iVar2 = filter._8_4_;
if ((local_18 == (char *)0x0) || (local_1c = ll_name_to_index(local_18),
iVar2 = local_1c, local_1c != 0)) {
filter._8_4_ = iVar2;
iVar2 = rtnl_routedump_req(&rth, filter._4_4_, iproute_dump_filter);
if (iVar2 < 0) {
perror("Cannot send dump request");
uVar3 = 1;
} else {
new_json_obj(json);
iVar2 = rtnl_dump_filter_nc(&rth, print_mroute, stdout, 0);
if (iVar2 < 0) {
delete_json_obj();
fprintf(stderr, "Dump terminated\n");
exit(1);
}
delete_json_obj();
uVar3 = 0;
}
} else {
uVar3 = nodev(local_18);
}
LAB_00100f1e:
if (local_10 == *(long *)(in_FS_OFFSET + 0x28)) {
return uVar3;
}
__stack_chk_fail();
} | iproute2-6.0.0 | ghidra |
void log_setup_kmod_log(struct kmod_ctx *ctx, int priority) {
log_priority = priority;
kmod_set_log_priority(ctx, log_priority);
kmod_set_log_fn(ctx, log_kmod, ((void *)0));
} | void log_setup_kmod_log(undefined8 param_1, undefined4 param_2)
{
log_priority = param_2;
kmod_set_log_priority(param_1, param_2);
kmod_set_log_fn(param_1, log_kmod, 0);
return;
} | kmod | ghidra |
static enum RM_status excise(FTS *fts, FTSENT *ent, struct rm_options const *x,
_Bool is_dir) {
int flag = is_dir ? 0x200 : 0;
if (unlinkat(fts->fts_cwd_fd, ent->fts_accpath, flag) == 0) {
if (x->verbose) {
printf((is_dir ? gettext("removed directory %s\n")
: gettext("removed %s\n")),
quotearg_style(shell_escape_always_quoting_style, ent->fts_path));
}
return RM_OK;
}
if ((*__errno_location()) == 30) {
struct stat st;
if (!(fstatat(fts->fts_cwd_fd, ent->fts_accpath, &st,
0x100) &&
(*__errno_location()) == 2))
(*__errno_location()) = 30;
}
if (ignorable_missing(x, (*__errno_location())))
return RM_OK;
if (ent->fts_info == 4 &&
((*__errno_location()) == 39 || (*__errno_location()) == 21 ||
(*__errno_location()) == 20
|| (*__errno_location()) == 17) &&
(ent->fts_errno == 1 || ent->fts_errno == 13))
(*__errno_location()) = ent->fts_errno;
error(0, (*__errno_location()), gettext("cannot remove %s"),
quotearg_style(shell_escape_always_quoting_style, ent->fts_path));
mark_ancestor_dirs(ent);
return RM_ERROR;
} | int excise(struct_2 *a0, struct_0 *a1, char *a2, unsigned long a3) {
unsigned int v0;
char v1;
unsigned int v3;
unsigned long long v5;
unsigned long long v11;
v3 = (!a3 ? 0x200 : 0);
v0 = v3;
if (unlinkat(a0->field_2c, a1->field_30, v0, a1->field_30)) {
if (*(__errno_location()) == 30 &&
(!fstatat(a0->field_2c, a1->field_30, &v1, 0x100) ||
*(__errno_location()) != 2))
*(__errno_location()) = 30;
if (ignorable_missing(a2, *(__errno_location()))) {
v3 = 2;
return v3;
}
if (a1->field_68 == 4) {
if (!(*(__errno_location()) != 39) || !(*(__errno_location()) != 21)) {
LABEL_400a05:
switch (a1->field_40) {
case 1:
case 13:
*(__errno_location()) = a1->field_40;
break;
default:
goto LABEL_400a34;
}
} else {
if (*(__errno_location()) == 20 || *(__errno_location()) == 17)
goto LABEL_400a05;
}
}
LABEL_400a34:
v11 = quotearg_style(0x4, a1->field_38);
error(0x0, *(__errno_location()), gettext("cannot remove %s"));
mark_ancestor_dirs(a1);
v3 = 4;
return v3;
} else if (!a2[26]) {
v3 = 2;
return v3;
} else {
v5 = quotearg_style(0x4, a1->field_38);
if (!a3)
v3 = gettext("removed %s\n");
else
v3 = gettext("removed directory %s\n");
printf(v3);
v3 = 2;
return v3;
}
} | coreutils | angr_sailr |
static int netns_set(int argc, char **argv) {
char netns_path[4096];
const char *name;
int netns, nsid;
if (argc < 1) {
fprintf(stderr, "No netns name specified\n");
return -1;
}
if (argc < 2) {
fprintf(stderr, "No nsid specified\n");
return -1;
}
name = argv[0];
if (strcmp(argv[1], "auto") == 0)
nsid = -1;
else if (get_integer(&nsid, argv[1], 0))
invarg("Invalid \"netnsid\" value", argv[1]);
else if (nsid < 0)
invarg("\"netnsid\" value should be >= 0", argv[1]);
snprintf(netns_path, sizeof(netns_path), "%s/%s", "/var/run/netns", name);
netns = open(netns_path, 00 | 02000000);
if (netns < 0) {
fprintf(stderr, "Cannot open network namespace \"%s\": %s\n", name,
strerror((*__errno_location())));
return -1;
}
return set_netnsid_from_name(name, nsid);
} | undefined8 netns_set(int param_1, undefined8 *param_2)
{
int iVar1;
undefined8 uVar2;
int *piVar3;
char *pcVar4;
long in_FS_OFFSET;
int local_1028;
int local_1024;
undefined8 local_1020;
char local_1018[4104];
long local_10;
local_10 = *(long *)(in_FS_OFFSET + 0x28);
if (param_1 < 1) {
fprintf(stderr, "No netns name specified\n");
uVar2 = 0xffffffff;
} else if (param_1 < 2) {
fprintf(stderr, "No nsid specified\n");
uVar2 = 0xffffffff;
} else {
local_1020 = *param_2;
iVar1 = strcmp((char *)param_2[1], "auto");
if (iVar1 == 0) {
local_1028 = -1;
} else {
iVar1 = get_integer(&local_1028, param_2[1], 0);
if (iVar1 != 0) {
invarg("Invalid \"netnsid\" value", param_2[1]);
}
if (local_1028 < 0) {
invarg("\"netnsid\" value should be >= 0", param_2[1]);
}
}
snprintf(local_1018, 0x1000, "%s/%s", "/var/run/netns", local_1020);
local_1024 = open64(local_1018, 0x80000);
if (local_1024 < 0) {
piVar3 = __errno_location();
pcVar4 = strerror(*piVar3);
fprintf(stderr, "Cannot open network namespace \"%s\": %s\n", local_1020,
pcVar4);
uVar2 = 0xffffffff;
} else {
uVar2 = set_netnsid_from_name(local_1020, local_1028);
}
}
if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) {
__stack_chk_fail();
}
return uVar2;
} | iproute2-6.0.0 | ghidra |
static struct pkginfo *pkg_array_mapper(const char *name) {
struct pkginfo *pkg;
pkg = dpkg_options_parse_pkgname(cipaction, name);
if (pkg->status == PKG_STAT_NOTINSTALLED)
notice(gettext("package '%s' is not installed"),
pkg_name(pkg, pnaw_nonambig));
return pkg;
} | long long pkg_array_mapper(unsigned long long a0) {
struct_0 *v0;
v0 = dpkg_options_parse_pkgname(cipaction, a0, a0);
if (!v0->field_18)
notice(gettext("package '%s' is not installed"), pkg_name(v0, 0x1));
return v0;
} | dpkg | angr_phoenix |
void quit_handler() {
printf("Interrupted %s\n", showdate());
signal(3, quit_handler);
} | long long quit_handler() {
printf("Interrupted %s\n", showdate());
return signal(0x3, quit_handler);
} | sysvinit | angr_dream |
static inline void inet_prefix_reset(inet_prefix *p) { p->flags = 0; } | void inet_prefix_reset(undefined2 *param_1)
{
*param_1 = 0;
return;
} | iproute2-6.0.0 | ghidra |
static void mp_factor_using_division(mpz_t t, struct mp_factors *factors) {
mpz_t q;
unsigned long int p;
do {
if (dev_debug)
fprintf(stderr, "[trial division] ");
} while (0);
__gmpz_init(q);
p = __gmpz_scan1(t, 0);
__gmpz_fdiv_q_2exp(t, t, p);
while (p) {
mp_factor_insert_ui(factors, 2);
--p;
}
p = 3;
for (unsigned int i = 1;
i <= (sizeof(primes_diff) / sizeof(primes_diff[0]) - 8 + 1);) {
if (!__gmpz_divisible_ui_p(t, p)) {
p += primes_diff[i++];
if ((__builtin_constant_p(p * p) && (p * p) == 0
? ((t)->_mp_size < 0 ? -1 : (t)->_mp_size > 0)
: __gmpz_cmp_ui(t, p * p)) < 0)
break;
} else {
__gmpz_tdiv_q_ui(t, t, p);
mp_factor_insert_ui(factors, p);
}
}
__gmpz_clear(q);
} | unsigned long mp_factor_using_division(long a1, long *a2) {
unsigned int v2;
unsigned int v4;
long v5;
long v6;
char v7[24];
unsigned long v8;
v8 = __readfsqword(0x28u);
if (dev_debug)
fprintf(stderr, "[trial division] ");
_gmpz_init(v7);
v5 = _gmpz_scan1(a1, 0LL);
_gmpz_fdiv_q_2exp(a1, a1, v5);
while (v5) {
mp_factor_insert_ui(a2, 2LL);
--v5;
}
v6 = 3LL;
v4 = 1;
while (v4 <= 0x29C) {
if ((unsigned int)_gmpz_divisible_ui_p(a1, v6)) {
_gmpz_tdiv_q_ui(a1, a1, v6);
mp_factor_insert_ui(a2, v6);
} else {
v2 = v4++;
v6 += primes_diff[v2];
if ((int)_gmpz_cmp_ui(a1, v6 * v6) < 0)
break;
}
}
_gmpz_clear(v7);
return __readfsqword(0x28u) ^ v8;
} | coreutils | ida |
static void sparse_numbytes_coder(struct tar_stat_info const *st,
char const *keyword, struct xheader *xhdr,
void const *data) {
size_t const *pi = data;
code_num(st->sparse_map[*pi].numbytes, keyword, xhdr);
} | unsigned long sparse_numbytes_coder(long a1, char *a2, long a3, _QWORD *a4) {
return code_num(*(_QWORD *)(*(_QWORD *)(a1 + 320) + 16LL * *a4 + 8), a2, a3);
} | tar | ida |
int sshbuf_poke_u8(struct sshbuf *buf, size_t offset, u_char val) {
u_char *p = ((void *)0);
int r;
if ((r = check_woffset(buf, offset, 1, &p)) != 0)
return r;
*p = val;
return 0;
} | long long sshbuf_poke_u8(unsigned long long a0, unsigned long a1,
unsigned long a2) {
unsigned int v0;
void *v1;
void *v3;
v1 = 0;
v0 = check_woffset(a0, a1, 0x1, &v1);
if (v0) {
v3 = v0;
} else {
*(v1) = a2;
v3 = 0;
}
return v3;
} | openssh-portable | angr_phoenix |
uint32_t arc4random(void) {
uint32_t val;
;
_rs_random_u32(&val);
;
return val;
} | long long arc4random() {
char v0;
_rs_random_u32(&v0);
return *(&v0);
} | openssh-portable | angr_dream |
static void match_volume_label(void) {
if (!volume_label) {
union block *label = find_next_block();
if (!label)
do {
if (error_hook)
error_hook();
error(0, 0, gettext("Archive not labeled to match %s"),
quote(volume_label_option));
fatal_exit();
} while (0);
if (label->header.typeflag == 'V') {
assign_string_n(&volume_label, label->header.name,
sizeof(label->header.name));
} else if (label->header.typeflag == 'g') {
struct tar_stat_info st;
tar_stat_init(&st);
xheader_read(
&st.xhdr, label,
off_from_header(label->header.size, sizeof(label->header.size)));
xheader_decode(&st);
tar_stat_destroy(&st);
}
}
if (!volume_label)
do {
if (error_hook)
error_hook();
error(0, 0, gettext("Archive not labeled to match %s"),
quote(volume_label_option));
fatal_exit();
} while (0);
if (!check_label_pattern(volume_label))
do {
if (error_hook)
error_hook();
error(0, 0, gettext("Volume %s does not match %s"),
quote_n(0, volume_label), quote_n(1, volume_label_option));
fatal_exit();
} while (0)
;
} | void match_volume_label(unsigned long a0, unsigned int a1,
unsigned long long a2, unsigned long a3,
unsigned long long a4, unsigned long long a5) {
struct_0 *v0;
char v1;
char v2;
char v3;
unsigned long long *v10;
unsigned long long v11;
if (false) {
v0 = find_next_block();
if (!v0) {
if (error_hook)
*(5243096)();
a1 = 0;
error(0x0, 0x0, gettext("Archive not labeled to match %s"));
fatal_exit(0x0, a1, a2, quote(volume_label_option), a4, a5);
}
if (v0->field_9c == 86) {
assign_string_n(&continued_file_offset, v0, 0x64);
} else if (v0->field_9c == 103) {
tar_stat_init(&v1);
xheader_read(&v2, v0, off_from_header(&v0->padding_0[124], 0xc), &v2);
xheader_decode(&v1);
tar_stat_destroy(&v1);
}
}
if (false) {
if (error_hook)
*(5243096)();
a1 = 0;
error(0x0, 0x0, gettext("Archive not labeled to match %s"));
fatal_exit(0x0, a1, a2, quote(volume_label_option), a4, a5);
}
if ((check_label_pattern(0xe87d894830ec8348) ^ 1)) {
if (error_hook)
*(5243096)();
error(0x0, 0x0, gettext("Volume %s does not match %s"));
fatal_exit(0x0, 3900541256 CONCAT 0, a2, quote_n(0x0, 0xe87d894830ec8348),
quote_n(0x1, volume_label_option), a5);
}
v11 = *(&v3) ^ v10[5];
return;
} | tar | angr_phoenix |
static const char *str_days(parser_control *pc, char *buffer, int n) {
static char const ordinal_values[][11] = {
"last", "this", "next/first", "(SECOND)", "third",
"fourth", "fifth", "sixth", "seventh", "eight",
"ninth", "tenth", "eleventh", "twelfth"};
static char const days_values[][4] = {"Sun", "Mon", "Tue", "Wed",
"Thu", "Fri", "Sat"};
int len;
if (pc->debug_ordinal_day_seen) {
len = (-1 <= pc->day_ordinal && pc->day_ordinal <= 12
? snprintf(buffer, n, "%s", ordinal_values[pc->day_ordinal + 1])
: snprintf(buffer, n,
"%"
"l"
"d",
pc->day_ordinal));
} else {
buffer[0] = '\0';
len = 0;
}
if (0 <= pc->day_number && pc->day_number <= 6 && 0 <= len && len < n)
snprintf(buffer + len, n - len, &" %s"[len == 0],
days_values[pc->day_number]);
else {
}
return buffer;
} | char *str_days(long a1, char *a2, int a3) {
int v3;
int v6;
if (*(_BYTE *)(a1 + 223)) {
if (*(long *)(a1 + 8) < -1 || *(long *)(a1 + 8) > 12)
v3 = snprintf(a2, a3, "%ld", *(_QWORD *)(a1 + 8));
else
v3 = snprintf(a2, a3, "%s",
&ordinal_values_4078[11 * *(_QWORD *)(a1 + 8) + 11]);
v6 = v3;
} else {
*a2 = 0;
v6 = 0;
}
if (*(_DWORD *)(a1 + 16) <= 6u && v6 >= 0 && v6 < a3)
snprintf(&a2[v6], a3 - v6, &aS_0[v6 == 0],
(char *)&days_values_4079 + 4 * *(int *)(a1 + 16));
return a2;
} | gnutls | ida |
terminal_set(EditLine *el, const char *term) {
int i;
char buf[((size_t)2048)];
char *area;
const struct termcapstr *t;
sigset_t oset, nset;
int lins, cols;
(void)sigemptyset(&nset);
(void)sigaddset(&nset, 28);
(void)sigprocmask(0, &nset, &oset);
area = buf;
if (term == ((void *)0))
term = getenv("TERM");
if (!term || !term[0])
term = "dumb";
if (strcmp(term, "emacs") == 0)
el->el_flags |= 0x004;
(void)memset(el->el_terminal.t_cap, 0, ((size_t)2048));
i = tgetent(el->el_terminal.t_cap, term);
if (i <= 0) {
if (i == -1)
(void)fprintf(el->el_errfile, "Cannot read termcap database;\n");
else if (i == 0)
(void)fprintf(el->el_errfile, "No entry for terminal type \"%s\";\n",
term);
(void)fprintf(el->el_errfile, "using dumb terminal settings.\n");
el->el_terminal.t_val[3] = 80;
el->el_terminal.t_val[1] = el->el_terminal.t_val[4] =
el->el_terminal.t_val[2] = 0;
el->el_terminal.t_val[5] = el->el_terminal.t_val[7];
for (t = tstr; t->name != ((void *)0); t++)
terminal_alloc(el, t, ((void *)0));
} else {
el->el_terminal.t_val[0] = tgetflag("am");
el->el_terminal.t_val[6] = tgetflag("xn");
el->el_terminal.t_val[1] = tgetflag("pt");
el->el_terminal.t_val[5] = tgetflag("xt");
el->el_terminal.t_val[4] = tgetflag("km");
el->el_terminal.t_val[7] = tgetflag("MT");
el->el_terminal.t_val[3] = tgetnum("co");
el->el_terminal.t_val[2] = tgetnum("li");
for (t = tstr; t->name != ((void *)0); t++) {
terminal_alloc(el, t, tgetstr(strchr(t->name, *t->name), &area));
}
}
if (el->el_terminal.t_val[3] < 2)
el->el_terminal.t_val[3] = 80;
if (el->el_terminal.t_val[2] < 1)
el->el_terminal.t_val[2] = 24;
el->el_terminal.t_size.v = el->el_terminal.t_val[3];
el->el_terminal.t_size.h = el->el_terminal.t_val[2];
terminal_setflags(el);
(void)terminal_get_size(el, &lins, &cols);
if (terminal_change_size(el, lins, cols) == -1)
return -1;
(void)sigprocmask(2, &oset, ((void *)0));
terminal_bind_arrow(el);
el->el_terminal.t_name = term;
return i <= 0 ? -1 : 0;
} | void terminal_set(struct_0 *a0, char *a1) {
unsigned long long v0;
int tmp_47;
int tmp_12;
struct_2 *v1;
char v2;
char v3;
unsigned int v4;
unsigned long v5;
unsigned long long v6;
char v7;
char v8;
char v9;
unsigned long long v11;
unsigned long long v12;
unsigned long v13;
v1 = &a0->padding_0;
v0 = a1;
sigemptyset(&v8);
sigaddset(&v8, 0x1c);
sigprocmask(0x0, &v8, &v7);
v5 = &v9;
if (!v0)
v0 = getenv("TERM");
if (!v0 || !*(v0))
v0 = "dumb";
if (!strcmp(v0, "emacs"))
a0->field_2c = a0->field_2c | 4;
memset(a0->field_c0, 0x0, 0x800);
v4 = tgetent(a0->field_c0, v0, v0);
if (v4 <= 0) {
if (v4 == -1) {
fprintf(a0->field_18, "Cannot read termcap database;\n");
} else if (!v4) {
fprintf(a0->field_18, "No entry for terminal type \"%s\";\n", v0);
}
fprintf(a0->field_18, "using dumb terminal settings.\n");
a0->field_b8->field_c = 80;
tmp_47 = &a0->field_b8->field_8;
a0->field_b8->field_8 = 0;
tmp_12 = &a0->field_b8->field_10;
a0->field_b8->field_10 = *(tmp_47);
a0->field_b8->field_4 = *(tmp_12);
a0->field_b8->field_14 = a0->field_b8->field_1c;
for (v6 = &tstr; *(v6); v6 += 16) {
terminal_alloc(a0, v6, 0x0);
}
} else {
a0->field_b8->field_0 = tgetflag("am");
a0->field_b8->field_18 = tgetflag("xn");
a0->field_b8->field_4 = tgetflag("pt");
a0->field_b8->field_14 = tgetflag("xt");
a0->field_b8->field_10 = tgetflag("km");
a0->field_b8->field_1c = tgetflag("MT");
a0->field_b8->field_c = tgetnum("co");
a0->field_b8->field_8 = tgetnum("li");
for (v6 = &tstr; *(v6); v6 += 16) {
v11 = strchr(*(v6), *(*(v6)));
terminal_alloc(a0, v6, tgetstr(v11, &v5, v11));
}
}
if (a0->field_b8->field_c <= 1)
a0->field_b8->field_c = 80;
if (a0->field_b8->field_8 <= 0)
a0->field_b8->field_8 = 24;
a0->field_94 = a0->field_b8->field_c;
a0->field_90 = a0->field_b8->field_8;
terminal_setflags(a0);
terminal_get_size(a0, &v2, &v3);
if (terminal_change_size(a0, *(&v2), *(&v3)) == -1) {
v12 = 4294967295;
return;
}
sigprocmask(0x2, &v7, NULL);
terminal_bind_arrow(a0);
a0->field_88 = v0;
v13 = (v4 <= 0 ? 0 : 4294967295);
return;
} | libedit | angr_sailr |
int sshkey_puts_opts(const struct sshkey *key, struct sshbuf *b,
enum sshkey_serialize_rep opts) {
struct sshbuf *tmp;
int r;
if ((tmp = sshbuf_new()) == ((void *)0))
return -2;
r = to_blob_buf(key, tmp, 0, opts);
if (r == 0)
r = sshbuf_put_stringb(b, tmp);
sshbuf_free(tmp);
return r;
} | void sshkey_puts_opts(unsigned long long a0, unsigned long long a1,
unsigned long a2) {
unsigned int v0;
unsigned long long v1;
unsigned long long v3;
unsigned long long v4;
v1 = sshbuf_new();
if (!v1) {
v3 = 4294967294;
} else {
v0 = to_blob_buf(a0, v1, 0x0, a2);
if (!v0)
v0 = sshbuf_put_stringb(a1, v1, v1);
sshbuf_free(v1);
v4 = v0;
}
return;
} | openssh-portable | angr_dream |
static void cpe_dispose(cpe) struct cpelement *cpe;
{
sh_xfree((cpe), "execute_cmd.c", 1798);
} | long long cpe_dispose(unsigned long long a0) {
return sh_xfree(a0, "execute_cmd.c", 0x706);
} | bash | angr_sailr |
acl_t acl_get_file(const char *path_p, acl_type_t type) {
const size_t size_guess = acl_ea_size(16);
char *ext_acl_p = __builtin_alloca(size_guess);
const char *name;
int retval;
switch (type) {
case (0x8000):
name = "system.posix_acl_access";
break;
case (0x4000):
name = "system.posix_acl_default";
break;
default:
(*__errno_location()) = 22;
return ((void *)0);
}
if (!ext_acl_p)
return ((void *)0);
retval = getxattr(path_p, name, ext_acl_p, size_guess);
if (retval == -1 && (*__errno_location()) == 34) {
retval = getxattr(path_p, name, ((void *)0), 0);
if (retval > 0) {
ext_acl_p = __builtin_alloca(retval);
if (!ext_acl_p)
return ((void *)0);
retval = getxattr(path_p, name, ext_acl_p, retval);
}
}
if (retval > 0) {
acl_t acl = __acl_from_xattr(ext_acl_p, retval);
return acl;
} else if (retval == 0 || (*__errno_location()) == 61 ||
(*__errno_location()) == 61) {
struct stat st;
if (stat(path_p, &st) != 0)
return ((void *)0);
if (type == (0x4000)) {
if (((((st.st_mode)) & 0170000) == (0040000)))
return acl_init(0);
else {
(*__errno_location()) = 13;
return ((void *)0);
}
} else
return acl_from_mode(st.st_mode);
} else
return ((void *)0);
} | long long acl_get_file(char *a0, unsigned long a1) {
char v0;
unsigned int v1;
unsigned long long v2;
unsigned long long v3;
unsigned long long v4;
unsigned long long v5;
char v6;
char v7;
unsigned long long v8;
char v9;
unsigned long v10;
void *v11;
for (v4 = acl_ea_size(0x10);
&v9 != &(&v0)[-1 * ((0 CONCAT 15 + v4 + 8) / m 16 * 16 & -0x1000)];
v8 = v8)
;
if ((((0 CONCAT 15 + v4 + 8) / m 16 * 16) & 4095))
*((&v8 + (((0 CONCAT 15 + v4 + 8) / m 16 * 16) & 4095))) =
*((&v8 + (((0 CONCAT 15 + v4 + 8) / m 16 * 16) & 4095)));
v2 = (&v10 >> 4) * 16;
switch (a1) {
case 16384:
v3 = "system.posix_acl_default";
break;
case 32768:
v3 = "system.posix_acl_access";
break;
default:
*(__errno_location()) = 22;
v11 = 0;
return v11;
}
if (!v2) {
v11 = 0;
return v11;
}
v1 = getxattr(a0, v3, v2, v4);
if (v1 == -1 && *(__errno_location()) == 34) {
if (v1 > 0) {
for (v1 = getxattr(a0, v3, 0x0, 0x0);
&v9 != &(&v9)[-1 * ((0 CONCAT 15 + v1 + 8) / m 16 * 16 & -0x1000)];
v8 = v8)
;
if ((((0 CONCAT 15 + v1 + 8) / m 16 * 16) & 4095))
*((&v8 + (((0 CONCAT 15 + v1 + 8) / m 16 * 16) & 4095))) =
*((&v8 + (((0 CONCAT 15 + v1 + 8) / m 16 * 16) & 4095)));
v2 = (&v10 >> 4) * 16;
if (!v2) {
v11 = 0;
return v11;
}
v1 = getxattr(a0, v3, v2, v1);
}
}
if (v1 > 0) {
v5 = __acl_from_xattr(v2, v1, v1);
v11 = v5;
return v11;
}
if (v1 && *(__errno_location()) != 61 && *(__errno_location()) != 61) {
v11 = 0;
return v11;
}
if (stat(a0, &v6)) {
v11 = 0;
return v11;
} else if (a1 != 0x4000) {
v11 = acl_from_mode(*(&v7));
return v11;
} else if ((*(&v7) & 0xf000) != 0x4000) {
*(__errno_location()) = 13;
v11 = 0;
return v11;
} else {
v11 = acl_init(0x0);
return v11;
}
} | acl-2.3.1 | angr_sailr |
void channel_clear_permission(struct ssh *ssh, int who, int where) {
struct permission **permp;
u_int *npermp;
permission_set_get_array(ssh, who, where, &permp, &npermp);
*permp = xrecallocarray(*permp, *npermp, 0, sizeof(**permp));
*npermp = 0;
} | unsigned long channel_clear_permission(long a1, unsigned int a2,
unsigned int a3) {
_QWORD *v3;
_QWORD *v5;
_DWORD *v6;
unsigned long v7;
v7 = __readfsqword(0x28u);
permission_set_get_array(a1, a2, a3, &v5, (long *)&v6);
v3 = v5;
*v3 = xrecallocarray(*v5, (unsigned int)*v6, 0LL, 48LL);
*v6 = 0;
return __readfsqword(0x28u) ^ v7;
} | openssh-portable | ida |
char *tohex(const void *vp, size_t l) {
const u_char *p = (const u_char *)vp;
char b[3], *r;
size_t i, hl;
if (l > 65536)
return xstrdup("tohex: length > 65536");
hl = l * 2 + 1;
r = xcalloc(1, hl);
for (i = 0; i < l; i++) {
snprintf(b, sizeof(b), "%02x", p[i]);
strlcat(r, b, hl);
}
return (r);
} | undefined8 tohex(long param_1, ulong param_2)
{
undefined8 uVar1;
long lVar2;
long in_FS_OFFSET;
ulong local_38;
char local_13[3];
long local_10;
local_10 = *(long *)(in_FS_OFFSET + 0x28);
if (param_2 < 0x10001) {
lVar2 = param_2 * 2 + 1;
uVar1 = xcalloc(1, lVar2);
for (local_38 = 0; local_38 < param_2; local_38 = local_38 + 1) {
snprintf(local_13, 3, "%02x", (ulong) * (byte *)(local_38 + param_1));
strlcat(uVar1, local_13, lVar2);
}
} else {
uVar1 = xstrdup("tohex: length > 65536");
}
if (local_10 == *(long *)(in_FS_OFFSET + 0x28)) {
return uVar1;
}
__stack_chk_fail();
} | openssh-portable | ghidra |
void log_action(const char *action, struct pkginfo *pkg,
struct pkgbin *pkgbin) {
log_message("%s %s %s %s", action, pkgbin_name(pkg, pkgbin, pnaw_always),
versiondescribe_c(&pkg->installed.version, vdew_nonambig),
versiondescribe_c(&pkg->available.version, vdew_nonambig));
statusfd_send("processing: %s: %s", action,
pkgbin_name(pkg, pkgbin, pnaw_nonambig));
} | void log_action(undefined8 param_1, long param_2, undefined8 param_3)
{
undefined8 uVar1;
undefined8 uVar2;
undefined8 uVar3;
uVar1 = versiondescribe_c(param_2 + 0x110, 1);
uVar2 = versiondescribe_c(param_2 + 0x98, 1);
uVar3 = pkgbin_name(param_2, param_3, 3);
log_message("%s %s %s %s", param_1, uVar3, uVar2, uVar1);
uVar1 = pkgbin_name(param_2, param_3, 1);
statusfd_send("processing: %s: %s", param_1, uVar1);
return;
} | dpkg | 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 [OPTION]...\n"), program_name);
fputs_unlocked(gettext("Print the number of processing units available to "
"the current process,\nwhich may be less than the "
"number of online processors\n\n"),
stdout)
;
fputs_unlocked(
gettext(" --all print the number of installed processors\n "
" --ignore=N if possible, exclude N processing units\n"),
stdout)
;
fputs_unlocked(gettext(" --help display this help and exit\n"),
stdout);
fputs_unlocked(
gettext(" --version output version information and exit\n"),
stdout);
emit_ancillary_info("nproc");
}
exit(status);
} | void usage(unsigned long a0) {
unsigned long v0;
unsigned long v2;
v0 = v2;
if (a0) {
fprintf(stderr, gettext("Try '%s --help' for more information.\n"));
} else {
printf(gettext("Usage: %s [OPTION]...\n"));
fputs_unlocked(gettext("Print the number of processing units available to "
"the current process,\nwhich may be less than the "
"number of online processors\n\n"),
stdout);
fputs_unlocked(
gettext(" --all print the number of installed processors\n "
" --ignore=N if possible, exclude N processing units\n"),
stdout);
fputs_unlocked(gettext(" --help display this help and exit\n"),
stdout);
fputs_unlocked(
gettext(" --version output version information and exit\n"),
stdout);
emit_ancillary_info("nproc");
}
exit(a0);
} | coreutils | angr_sailr |
static int client_input_global_request(int type, u_int32_t seq,
struct ssh *ssh) {
char *rtype;
u_char want_reply;
int r, success = 0;
if ((r = sshpkt_get_cstring(ssh, &rtype, ((void *)0))) != 0 ||
(r = sshpkt_get_u8(ssh, &want_reply)) != 0)
goto out;
sshlog("clientloop.c", __func__, 2435, 0, SYSLOG_LEVEL_DEBUG1, ((void *)0),
"client_input_global_request: rtype %s want_reply %d", rtype,
want_reply);
if (strcmp(rtype, "hostkeys-00@openssh.com") == 0)
success = client_input_hostkeys(ssh);
if (want_reply) {
if ((r = sshpkt_start(ssh, success ? 81 : 82)) != 0 ||
(r = sshpkt_send(ssh)) != 0 || (r = ssh_packet_write_wait(ssh)) != 0)
goto out;
}
r = 0;
out:
free(rtype);
return r;
} | long long client_input_global_request(unsigned long a0, unsigned long a1,
unsigned long long a2) {
unsigned long long v0;
unsigned long long v1;
unsigned long v2;
unsigned long long v3;
unsigned int v4;
unsigned int v5;
char v6;
unsigned int v7;
unsigned int v8;
char v9;
unsigned long long v12;
v5 = a0;
v4 = a1;
v3 = a2;
v8 = 0;
v7 = sshpkt_get_cstring(v3, &v9, 0x0, &v9);
if (!v7) {
v7 = sshpkt_get_u8(v3, &v6, &v6);
if (!v7) {
v2 = v6;
v1 = *(&v9);
v0 = "client_input_global_request: rtype %s want_reply %d";
sshlog("clientloop.c", "client_input_global_request", 0x983, 0x0, 0x5,
0x0);
if (!strcmp(*(&v9), "hostkeys-00@openssh.com"))
v8 = client_input_hostkeys(v3);
if (v6) {
if (v8)
v12 = 81;
else
v12 = 82;
v7 = sshpkt_start(v3, v12);
if (!v7) {
v7 = sshpkt_send(v3);
if (!v7)
v7 = ssh_packet_write_wait(v3);
}
}
if (!v6 || !v7 && !v7 && !v7)
v7 = 0;
}
}
free(*(&v9));
return v7;
} | openssh-portable | angr_dream |
void cu_cidir(int argc, void **argv) {
char *cidir = (char *)argv[0];
char *cidirrest = (char *)argv[1];
cidirrest[-1] = '\0';
path_remove_tree(cidir);
free(cidir);
} | long long cu_cidir(unsigned long a0, unsigned long long a1[2]) {
unsigned int v0;
void *v1;
unsigned long v2;
v0 = a0;
v1 = a1[0];
v2 = a1[1];
*((v2 - 1)) = 0;
path_remove_tree(v1);
return free(v1);
} | dpkg | angr_sailr |
(r = sshbuf_put_cstring(tosign, hashalg)) != 0 ||
(r = sshbuf_put_stringb(tosign, h_message)) != 0) {
sshlog("sshsig.c", __func__, 177, 1, SYSLOG_LEVEL_ERROR, ssh_err(r),
"assemble message to sign");
goto done;
} | void sshbuf_put_cstring(void)
{
halt_baddata();
} | openssh-portable | ghidra |
void tzfree(timezone_t tz) {
if (tz != local_tz)
while (tz) {
timezone_t next = tz->next;
free(tz);
tz = next;
}
} | void tzfree(void *a0) {
unsigned long long *v0;
void *v1;
unsigned long long v3;
unsigned long long v4;
v0 = a0;
if (v0 != 1) {
for (v3 = 1; v0; v0 = v1) {
v1 = *(v0);
free(v0);
v4 = v1;
}
}
return;
} | gnutls | angr_dream |
char **bash_default_completion(text, start, end, qc, compflags) const
char *text;
int start, end, qc, compflags;
{
char **matches, *t;
matches = (char **)((void *)0);
if (*text == '$') {
if (qc != '\'' && text[1] == '(')
matches = rl_completion_matches(text, command_subst_completion_function);
else {
matches = rl_completion_matches(text, variable_completion_function);
if (matches && matches[0] && matches[1] == 0) {
t = (char *)strcpy(
sh_xmalloc((1 + strlen(matches[0])), "bashline.c", 1820),
(matches[0]));
bash_filename_stat_hook(&t);
if (file_isdir(t))
rl_completion_append_character = '/';
sh_xfree((t), "bashline.c", 1826);
}
}
}
if (matches == 0 && *text == '~' && mbschr(text, '/') == 0)
matches = rl_completion_matches(text, rl_username_completion_function);
if (matches == 0 && perform_hostname_completion && *text == '@')
matches = rl_completion_matches(text, hostname_completion_function);
if (matches == 0 && (compflags & 1)) {
if (no_empty_command_completion && end == start && text[0] == '\0') {
matches = (char **)((void *)0);
rl_ignore_some_completions_function = bash_ignore_everything;
} else {
dot_in_path = 0;
matches = rl_completion_matches(text, command_word_completion_function);
if (matches == (char **)((void *)0))
rl_ignore_some_completions_function = bash_ignore_filenames;
else if (matches[1] == 0 &&
(absolute_pathname(matches[0]) == 0 &&
absolute_program(matches[0]) == 0 && *(matches[0]) != '~' &&
test_for_directory(matches[0])) &&
dot_in_path == 0)
{
rl_completion_suppress_append = 1;
rl_filename_completion_desired = 0;
} else if (matches[0] && matches[1] &&
((matches[0])[0] == (matches[1])[0] &&
strcmp(matches[0], matches[1]) == 0) &&
(absolute_pathname(matches[0]) == 0 &&
absolute_program(matches[0]) == 0 && *(matches[0]) != '~' &&
test_for_directory(matches[0]))) {
rl_completion_suppress_append = 1;
rl_filename_completion_desired = 0;
}
}
}
if (!matches && completion_glob_pattern((char *)text)) {
matches = rl_completion_matches(text, glob_complete_word);
if (matches && matches[1] && rl_completion_type == '\t') {
strvec_dispose(matches);
matches = (char **)0;
} else if (matches && matches[1] && rl_completion_type == '!') {
rl_completion_suppress_append = 1;
rl_filename_completion_desired = 0;
}
}
return (matches);
} | long long bash_default_completion(char a0[2], unsigned long long a1,
unsigned long a2, unsigned long a3,
unsigned long a4) {
unsigned long long v0;
void *v1;
v1 = 0;
if (a0[0] == 36) {
if (a3 != 39 && a0[1] == 40) {
v1 = rl_completion_matches(a0, command_subst_completion_function);
goto LABEL_4039be;
}
v1 = rl_completion_matches(a0, variable_completion_function);
if (v1 && *(v1) && !v1[8]) {
v0 = strcpy(sh_xmalloc(strlen(*(v1)) + 1, "bashline.c", 0x71c), *(v1));
bash_filename_stat_hook(&v0, a1, 0x71c);
if (file_isdir(v0))
rl_completion_append_character = 47;
sh_xfree(v0, "bashline.c", 0x722);
}
}
LABEL_4039be:
if (!v1 && a0[0] == 126 && !mbschr(a0, 0x2f, 0x722))
v1 = rl_completion_matches(a0, got.rl_username_completion_function);
if (!v1 && perform_hostname_completion && a0[0] == 64)
v1 = rl_completion_matches(a0, hostname_completion_function);
if (!v1 && (a4 & 1)) {
if (a2 == a1 && !a0[0]) {
v1 = 0;
rl_ignore_some_completions_function = bash_ignore_everything;
goto LABEL_403bf5;
}
dot_in_path = 0;
v1 = rl_completion_matches(a0, command_word_completion_function);
if (!v1) {
rl_ignore_some_completions_function = bash_ignore_filenames;
} else {
if (!v1[8] && !absolute_pathname(*(v1)) && !absolute_program(*(v1)) &&
*(*(v1)) != 126 && test_for_directory(*(v1)) && !dot_in_path) {
rl_completion_suppress_append = 1;
rl_filename_completion_desired = 0;
goto LABEL_403bf5;
}
if (*(v1) && v1[8] && *(*(v1)) == *(v1[8]) && !strcmp(*(v1), v1[8]) &&
!absolute_pathname(*(v1)) && !absolute_program(*(v1)) &&
*(*(v1)) != 126 && test_for_directory(*(v1))) {
rl_completion_suppress_append = 1;
rl_filename_completion_desired = 0;
}
}
}
LABEL_403bf5:
if (!v1 && completion_glob_pattern(a0)) {
v1 = rl_completion_matches(a0, glob_complete_word);
if (v1 && v1[8] && rl_completion_type == 9) {
strvec_dispose(v1);
v1 = 0;
goto LABEL_403c99;
}
if (v1 && v1[8] && rl_completion_type == 33) {
rl_completion_suppress_append = 1;
rl_filename_completion_desired = 0;
}
}
LABEL_403c99:
return v1;
} | bash | angr_phoenix |
static void free_pending_ent(struct pending *p) {
free(p->name);
free(p->realname);
free(p);
} | void free_pending_ent(unsigned long long a0[2]) {
unsigned long long v1;
free(a0[0]);
free(a0[1]);
v1 = free(a0);
return;
} | coreutils | angr_sailr |
int set_expand_once(nval, uwp)
int nval, uwp;
{
int oa;
oa = assoc_expand_once;
if (shell_compatibility_level > 51) {
if (uwp)
unwind_protect_mem((char *)&(assoc_expand_once),
sizeof(assoc_expand_once));
assoc_expand_once = nval;
}
return oa;
} | undefined4 set_expand_once(undefined4 param_1, int param_2)
{
undefined4 uVar1;
undefined4 uVar2;
uVar1 = assoc_expand_once;
uVar2 = assoc_expand_once;
if ((0x33 < shell_compatibility_level) && (uVar2 = param_1, param_2 != 0)) {
unwind_protect_mem(&assoc_expand_once, 4);
uVar2 = param_1;
}
assoc_expand_once = uVar2;
return uVar1;
} | bash | ghidra |
static int _rl_nsearch_dispatch(_rl_search_cxt *cxt, int c) {
int n;
if (c < 0)
c = (('C') & 0x1f);
switch (c) {
case (('W') & 0x1f):
rl_unix_word_rubout(1, c);
break;
case (('U') & 0x1f):
rl_unix_line_discard(1, c);
break;
case (('M') & 0x1f):
case '\n':
return 0;
case (('H') & 0x1f):
case 0x7f:
if (rl_point == 0) {
_rl_nsearch_abort(cxt);
return -1;
}
_rl_rubout_char(1, c);
break;
case (('C') & 0x1f):
case (('G') & 0x1f):
rl_ding();
_rl_nsearch_abort(cxt);
return -1;
case (('[') & 0x1f):
if (_rl_enable_bracketed_paste &&
((n = _rl_nchars_available()) >= (6 - 1))) {
if (_rl_read_bracketed_paste_prefix(c) == 1)
rl_bracketed_paste_begin(1, c);
else {
c = rl_read_key();
_rl_insert_char(1, c);
}
} else
_rl_insert_char(1, c);
break;
default:
if ((__ctype_get_mb_cur_max()) > 1 && rl_byte_oriented == 0)
rl_insert_text(cxt->mb);
else
_rl_insert_char(1, c);
break;
}
(*rl_redisplay_function)();
rl_deactivate_mark();
return 1;
} | undefined8 _rl_nsearch_dispatch(long param_1, int param_2)
{
int iVar1;
undefined4 uVar2;
size_t sVar3;
int local_24;
local_24 = param_2;
if (param_2 < 0) {
local_24 = 3;
}
if (local_24 < 0x1c) {
if (2 < local_24) {
switch (local_24) {
case 3:
case 7:
rl_ding();
_rl_nsearch_abort(param_1);
return 0xffffffff;
default:
goto switchD_0010058b_caseD_4;
case 8:
goto switchD_0010058b_caseD_8;
case 10:
case 0xd:
return 0;
case 0x15:
rl_unix_line_discard(1, local_24);
break;
case 0x17:
rl_unix_word_rubout(1, local_24);
break;
case 0x1b:
if ((_rl_enable_bracketed_paste == 0) ||
(iVar1 = _rl_nchars_available(), iVar1 < 5)) {
_rl_insert_char(1, local_24);
} else {
iVar1 = _rl_read_bracketed_paste_prefix(local_24);
if (iVar1 == 1) {
rl_bracketed_paste_begin(1, local_24);
} else {
uVar2 = rl_read_key();
_rl_insert_char(1, uVar2);
}
}
}
goto LAB_001006b5;
}
} else if (local_24 == 0x7f) {
switchD_0010058b_caseD_8:
if (rl_point == 0) {
_rl_nsearch_abort(param_1);
return 0xffffffff;
}
_rl_rubout_char(1, local_24);
goto LAB_001006b5;
}
switchD_0010058b_caseD_4:
sVar3 = __ctype_get_mb_cur_max();
if ((sVar3 < 2) || (rl_byte_oriented != 0)) {
_rl_insert_char(1, local_24);
} else {
rl_insert_text(param_1 + 0x70);
}
LAB_001006b5:
(*rl_redisplay_function)();
rl_deactivate_mark();
return 1;
} | bash | ghidra |
static void show_valid_debug_options(int full) {
size_t i;
fputs(gettext("Valid arguments for -D:\n"), stdout);
if (full) {
for (i = 0; i < (sizeof(debugassoc) / sizeof(debugassoc[0])); ++i) {
fprintf(stdout, "%-10s %s\n", debugassoc[i].name,
debugassoc[i].docstring);
}
} else {
for (i = 0; i < (sizeof(debugassoc) / sizeof(debugassoc[0])); ++i) {
fprintf(stdout, "%s%s", (i > 0 ? ", " : ""), debugassoc[i].name);
}
}
} | void show_valid_debug_options(int param_1)
{
FILE *__stream;
char *__s;
undefined *puVar1;
ulong local_20;
__stream = stdout;
__s = (char *)gettext("Valid arguments for -D:\n");
fputs(__s, __stream);
if (param_1 == 0) {
for (local_20 = 0; local_20 < 9; local_20 = local_20 + 1) {
if (local_20 == 0) {
puVar1 = &DAT_00101e1d;
} else {
puVar1 = &DAT_00101e1a;
}
fprintf(stdout, "%s%s", puVar1,
*(undefined8 *)(debugassoc + local_20 * 0x18));
}
} else {
for (local_20 = 0; local_20 < 9; local_20 = local_20 + 1) {
fprintf(stdout, "%-10s %s\n",
*(undefined8 *)(debugassoc + local_20 * 0x18),
*(undefined8 *)(debugassoc + local_20 * 0x18 + 0x10));
}
}
return;
} | findutils | ghidra |
int cron_change_user_permanently(struct passwd *pw, char *homedir) {
if (setreuid(pw->pw_uid, pw->pw_uid) != 0) {
log_it("CRON", getpid(), "ERROR", "setreuid failed", (*__errno_location()));
return -1;
}
if (chdir(homedir) == -1) {
log_it("CRON", getpid(), "ERROR chdir failed", homedir,
(*__errno_location()));
return -1;
}
log_close();
return 0;
} | long cron_change_user_permanently(long a1, const char *a2) {
unsigned int v2;
unsigned int v3;
unsigned int v5;
unsigned int v6;
if (setreuid(*(_DWORD *)(a1 + 16), *(_DWORD *)(a1 + 16))) {
v2 = *_errno_location();
v3 = getpid();
log_it("CRON", v3, "ERROR", "setreuid failed", v2);
return 0xFFFFFFFFLL;
} else if (chdir(a2) == -1) {
v5 = *_errno_location();
v6 = getpid();
log_it("CRON", v6, "ERROR chdir failed", a2, v5);
return 0xFFFFFFFFLL;
} else {
log_close();
return 0LL;
}
} | cronie | ida |
static WORD_LIST *expand_word_list_internal(list, eflags)
WORD_LIST *list;
int eflags;
{
WORD_LIST *new_list, *temp_list;
tempenv_assign_error = 0;
if (list == 0)
return ((WORD_LIST *)((void *)0));
garglist = new_list = copy_word_list(list);
if (eflags & 0x001) {
garglist = new_list = separate_out_assignments(new_list);
if (new_list == 0) {
if (subst_assign_varlist)
do_assignment_statements(subst_assign_varlist, (char *)((void *)0), 1);
dispose_words(subst_assign_varlist);
subst_assign_varlist = (WORD_LIST *)((void *)0);
return ((WORD_LIST *)((void *)0));
}
}
if ((eflags & 0x002) && brace_expansion && new_list)
new_list = brace_expand_word_list(new_list, eflags);
new_list = shell_expand_word_list(new_list, eflags);
if (new_list) {
if ((eflags & 0x010) && disallow_filename_globbing == 0)
new_list = glob_expand_word_list(new_list, eflags);
else
new_list = dequote_list(new_list);
}
if ((eflags & 0x001) && subst_assign_varlist) {
do_assignment_statements(subst_assign_varlist,
(new_list && new_list->word) ? new_list->word->word
: (char *)((void *)0),
new_list == 0);
dispose_words(subst_assign_varlist);
subst_assign_varlist = (WORD_LIST *)((void *)0);
}
return (new_list);
} | void expand_word_list_internal(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;
void *v2;
void *v3;
void *v6;
struct_2 *v7;
tempenv_assign_error = 0;
if (!a0) {
v2 = 0;
} else {
v0 = copy_word_list(a0);
garglist = v0;
if ((a1 & 1)) {
v0 = separate_out_assignments(v0);
garglist = v0;
if (!v0) {
if (subst_assign_varlist)
do_assignment_statements(subst_assign_varlist, 0x0, 0x1);
dispose_words(subst_assign_varlist);
subst_assign_varlist = 0;
v3 = 0;
goto LABEL_41f846;
}
}
if ((a1 & 2) && brace_expansion && v0)
v0 = brace_expand_word_list(v0, a1);
*(&v0) = shell_expand_word_list(v0, a1, a1, a3, a4, a5);
if (v0) {
if ((a1 & 16) && !disallow_filename_globbing) {
*(&v0) = glob_expand_word_list(v0, a1, a1, a3);
goto LABEL_41f7cf;
}
v0 = dequote_list(v0);
}
LABEL_41f7cf:
if ((a1 & 1) && subst_assign_varlist) {
if (v0 && v0->field_8) {
v6 = v0->field_8->field_0;
goto LABEL_41f816;
}
v6 = 0;
LABEL_41f816:
do_assignment_statements(subst_assign_varlist, v6, !v0);
dispose_words(subst_assign_varlist);
subst_assign_varlist = 0;
}
v7 = v0;
}
LABEL_41f846:
return;
} | bash | angr_phoenix |
int rl_maybe_unsave_line(void) {
if (_rl_saved_line_for_history) {
rl_replace_line(_rl_saved_line_for_history->line, 0);
rl_undo_list = (UNDO_LIST *)_rl_saved_line_for_history->data;
_rl_free_history_entry(_rl_saved_line_for_history);
_rl_saved_line_for_history = (HIST_ENTRY *)((void *)0);
rl_point = rl_end;
} else
rl_ding();
return 0;
} | void rl_maybe_unsave_line() {
void *v1;
if (_rl_saved_line_for_history) {
rl_replace_line(*(_rl_saved_line_for_history), 0x0);
rl_undo_list = _rl_saved_line_for_history[16];
_rl_free_history_entry(_rl_saved_line_for_history);
_rl_saved_line_for_history = 0;
rl_point = rl_end;
} else {
rl_ding();
}
v1 = 0;
return;
} | bash | angr_dream |
static int authmethod_is_enabled(Authmethod *method) {
if (method == ((void *)0))
return 0;
if (method->enabled == ((void *)0) || *method->enabled == 0)
return 0;
if (method->batch_flag != ((void *)0) && *method->batch_flag != 0)
return 0;
return 1;
} | undefined8 authmethod_is_enabled(long param_1)
{
undefined8 uVar1;
if (param_1 == 0) {
uVar1 = 0;
} else if ((*(long *)(param_1 + 0x18) == 0) ||
(**(int **)(param_1 + 0x18) == 0)) {
uVar1 = 0;
} else if ((*(long *)(param_1 + 0x20) == 0) ||
(**(int **)(param_1 + 0x20) == 0)) {
uVar1 = 1;
} else {
uVar1 = 0;
}
return uVar1;
} | openssh-portable | ghidra |
static
void
evaltreenr(union node *n, int flags)
{
evaltree(n, flags);
abort();
} | void evaltreenr(undefined8 param_1, undefined4 param_2)
{
evaltree(param_1, param_2);
abort();
} | dash-0.5.11+git20210903+057cd650a4ed | ghidra |
const z_crc_t *get_crc_table() { return (const z_crc_t *)crc_table; } | long long get_crc_table() { return &crc_table; } | zlib | angr_phoenix |
static void fail_exit(int code) {
if (gr_locked) {
if (gr_unlock() == 0) {
fprintf(stderr, gettext("%s: failed to unlock %s\n"), Prog, gr_dbname());
do {
char *old_locale = setlocale(6, ((void *)0));
char *saved_locale = ((void *)0);
if (((void *)0) != old_locale) {
saved_locale = strdup(old_locale);
}
if (((void *)0) != saved_locale) {
(void)setlocale(6, "C");
}
syslog(3, "failed to unlock %s", gr_dbname());
if (((void *)0) != saved_locale) {
(void)setlocale(6, saved_locale);
free(saved_locale);
}
} while (0);
}
}
if (sgr_locked) {
if (sgr_unlock() == 0) {
fprintf(stderr, gettext("%s: failed to unlock %s\n"), Prog, sgr_dbname());
do {
char *old_locale = setlocale(6, ((void *)0));
char *saved_locale = ((void *)0);
if (((void *)0) != old_locale) {
saved_locale = strdup(old_locale);
}
if (((void *)0) != saved_locale) {
(void)setlocale(6, "C");
}
syslog(3, "failed to unlock %s", sgr_dbname());
if (((void *)0) != saved_locale) {
(void)setlocale(6, saved_locale);
free(saved_locale);
}
} while (0);
}
}
if (spw_locked) {
if (spw_unlock() == 0) {
fprintf(stderr, gettext("%s: failed to unlock %s\n"), Prog, spw_dbname());
do {
char *old_locale = setlocale(6, ((void *)0));
char *saved_locale = ((void *)0);
if (((void *)0) != old_locale) {
saved_locale = strdup(old_locale);
}
if (((void *)0) != saved_locale) {
(void)setlocale(6, "C");
}
syslog(3, "failed to unlock %s", spw_dbname());
if (((void *)0) != saved_locale) {
(void)setlocale(6, saved_locale);
free(saved_locale);
}
} while (0);
}
}
if (pw_locked) {
if (pw_unlock() == 0) {
fprintf(stderr, gettext("%s: failed to unlock %s\n"), Prog, pw_dbname());
do {
char *old_locale = setlocale(6, ((void *)0));
char *saved_locale = ((void *)0);
if (((void *)0) != old_locale) {
saved_locale = strdup(old_locale);
}
if (((void *)0) != saved_locale) {
(void)setlocale(6, "C");
}
syslog(3, "failed to unlock %s", pw_dbname());
if (((void *)0) != saved_locale) {
(void)setlocale(6, saved_locale);
free(saved_locale);
}
} while (0);
}
}
if (sub_uid_locked) {
if (sub_uid_unlock() == 0) {
fprintf(stderr, gettext("%s: failed to unlock %s\n"), Prog,
sub_uid_dbname());
do {
char *old_locale = setlocale(6, ((void *)0));
char *saved_locale = ((void *)0);
if (((void *)0) != old_locale) {
saved_locale = strdup(old_locale);
}
if (((void *)0) != saved_locale) {
(void)setlocale(6, "C");
}
syslog(3, "failed to unlock %s", sub_uid_dbname());
if (((void *)0) != saved_locale) {
(void)setlocale(6, saved_locale);
free(saved_locale);
}
} while (0);
}
}
if (sub_gid_locked) {
if (sub_gid_unlock() == 0) {
fprintf(stderr, gettext("%s: failed to unlock %s\n"), Prog,
sub_gid_dbname());
do {
char *old_locale = setlocale(6, ((void *)0));
char *saved_locale = ((void *)0);
if (((void *)0) != old_locale) {
saved_locale = strdup(old_locale);
}
if (((void *)0) != saved_locale) {
(void)setlocale(6, "C");
}
syslog(3, "failed to unlock %s", sub_gid_dbname());
if (((void *)0) != saved_locale) {
(void)setlocale(6, saved_locale);
free(saved_locale);
}
} while (0);
}
}
exit(code);
} | void fail_exit(int a1) {
long v1;
long v2;
char *v3;
const char *v4;
long v5;
long v6;
char *v7;
const char *v8;
long v9;
long v10;
char *v11;
const char *v12;
long v13;
long v14;
char *v15;
const char *v16;
long v17;
long v18;
char *v19;
const char *v20;
long v21;
long v22;
char *v23;
const char *v24;
char *locale;
char *v26;
char *v27;
char *v28;
char *v29;
char *v30;
const char *s;
const char *v32;
const char *v33;
const char *v34;
const char *v35;
const char *v36;
if (gr_locked && !(unsigned int)gr_unlock()) {
v1 = gr_dbname();
v2 = Prog;
v3 = gettext("%s: failed to unlock %s\n");
fprintf(stderr, v3, v2, v1);
s = setlocale(6, 0LL);
locale = 0LL;
if (s)
locale = strdup(s);
if (locale)
setlocale(6, "C");
v4 = (const char *)gr_dbname();
syslog(3, "failed to unlock %s", v4);
if (locale) {
setlocale(6, locale);
free(locale);
}
}
if (sgr_locked && !(unsigned int)sgr_unlock()) {
v5 = sgr_dbname();
v6 = Prog;
v7 = gettext("%s: failed to unlock %s\n");
fprintf(stderr, v7, v6, v5);
v32 = setlocale(6, 0LL);
v26 = 0LL;
if (v32)
v26 = strdup(v32);
if (v26)
setlocale(6, "C");
v8 = (const char *)sgr_dbname();
syslog(3, "failed to unlock %s", v8);
if (v26) {
setlocale(6, v26);
free(v26);
}
}
if (spw_locked && !(unsigned int)spw_unlock()) {
v9 = spw_dbname();
v10 = Prog;
v11 = gettext("%s: failed to unlock %s\n");
fprintf(stderr, v11, v10, v9);
v33 = setlocale(6, 0LL);
v27 = 0LL;
if (v33)
v27 = strdup(v33);
if (v27)
setlocale(6, "C");
v12 = (const char *)spw_dbname();
syslog(3, "failed to unlock %s", v12);
if (v27) {
setlocale(6, v27);
free(v27);
}
}
if (pw_locked && !(unsigned int)pw_unlock()) {
v13 = pw_dbname();
v14 = Prog;
v15 = gettext("%s: failed to unlock %s\n");
fprintf(stderr, v15, v14, v13);
v34 = setlocale(6, 0LL);
v28 = 0LL;
if (v34)
v28 = strdup(v34);
if (v28)
setlocale(6, "C");
v16 = (const char *)pw_dbname();
syslog(3, "failed to unlock %s", v16);
if (v28) {
setlocale(6, v28);
free(v28);
}
}
if (sub_uid_locked && !(unsigned int)sub_uid_unlock()) {
v17 = sub_uid_dbname();
v18 = Prog;
v19 = gettext("%s: failed to unlock %s\n");
fprintf(stderr, v19, v18, v17);
v35 = setlocale(6, 0LL);
v29 = 0LL;
if (v35)
v29 = strdup(v35);
if (v29)
setlocale(6, "C");
v20 = (const char *)sub_uid_dbname();
syslog(3, "failed to unlock %s", v20);
if (v29) {
setlocale(6, v29);
free(v29);
}
}
if (sub_gid_locked && !(unsigned int)sub_gid_unlock()) {
v21 = sub_gid_dbname();
v22 = Prog;
v23 = gettext("%s: failed to unlock %s\n");
fprintf(stderr, v23, v22, v21);
v36 = setlocale(6, 0LL);
v30 = 0LL;
if (v36)
v30 = strdup(v36);
if (v30)
setlocale(6, "C");
v24 = (const char *)sub_gid_dbname();
syslog(3, "failed to unlock %s", v24);
if (v30) {
setlocale(6, v30);
free(v30);
}
}
exit(a1);
} | shadow | ida |
void platform_pre_listen(void) { oom_adjust_setup(); } | long long platform_pre_listen() { return oom_adjust_setup(); } | openssh-portable | angr_sailr |
static int known_hosts_find_delete(struct hostkey_foreach_line *l, void *_ctx) {
struct known_hosts_ctx *ctx = (struct known_hosts_ctx *)_ctx;
enum sshkey_fp_rep rep;
int fptype;
char *fp = ((void *)0), *ra = ((void *)0);
fptype = print_bubblebabble ? 1 : fingerprint_hash;
rep = print_bubblebabble ? SSH_FP_BUBBLEBABBLE : SSH_FP_DEFAULT;
if (l->status == 3) {
if (ctx->delete_host) {
if (l->marker != MRK_NONE) {
fprintf(ctx->out, "%s\n", l->line);
} else {
ctx->found_key = 1;
if (!quiet)
printf("# Host %s found: line %lu\n", ctx->host, l->linenum);
}
return 0;
} else if (ctx->find_host) {
ctx->found_key = 1;
if (!quiet) {
printf("# Host %s found: line %lu %s\n", ctx->host, l->linenum,
l->marker == MRK_CA
? "CA"
: (l->marker == MRK_REVOKE ? "REVOKED" : ""));
}
if (ctx->hash_hosts)
known_hosts_hash(l, ctx);
else if (print_fingerprint) {
fp = sshkey_fingerprint(l->key, fptype, rep);
ra = sshkey_fingerprint(l->key, fingerprint_hash, SSH_FP_RANDOMART);
if (fp == ((void *)0) || ra == ((void *)0))
sshfatal("ssh-keygen.c", __func__, 1270, 1, SYSLOG_LEVEL_FATAL,
((void *)0), "sshkey_fingerprint failed");
mprintf("%s %s %s%s%s\n", ctx->host, sshkey_type(l->key), fp,
l->comment[0] ? " " : "", l->comment);
if (log_level_get() >= SYSLOG_LEVEL_VERBOSE)
printf("%s\n", ra);
free(ra);
free(fp);
} else
fprintf(ctx->out, "%s\n", l->line);
return 0;
}
} else if (ctx->delete_host) {
if (l->status == 1) {
ctx->invalid = 1;
sshlog("ssh-keygen.c", __func__, 1287, 0, SYSLOG_LEVEL_INFO, ((void *)0),
"%s:%lu: invalid line", l->path, l->linenum);
}
fprintf(ctx->out, "%s\n", l->line);
}
return 0;
} | long long known_hosts_find_delete(struct_0 *a0, struct_2 *a1) {
unsigned int v0;
unsigned int v1;
void *v2;
void *v3;
unsigned int v5;
unsigned int v6;
unsigned int v7;
unsigned long long v8;
unsigned long long v9;
unsigned long long v10;
unsigned long long v11;
v2 = 0;
v3 = 0;
if (print_bubblebabble)
v5 = 1;
else
v5 = fingerprint_hash;
v0 = v5;
if (!print_bubblebabble)
v6 = 0;
else
v6 = 3;
v1 = v6;
if (a0->field_10 == 3) {
if (a1->field_24) {
if (a0->field_20 != 1) {
fprintf(a1->field_8, "%s\n", a0->field_18);
} else {
a1->field_14 = 1;
if (!*(&quiet))
printf("# Host %s found: line %lu\n", a1->field_0, a0->field_8);
}
}
if (a1->field_20) {
a1->field_14 = 1;
if (!*(&quiet)) {
if (a0->field_20 == 3) {
v7 = &g_4115ea;
} else {
if (a0->field_20 == 2)
v7 = "REVOKED";
else
v7 = &g_410d75;
}
printf("# Host %s found: line %lu %s\n", a1->field_0, a0->field_8, v7);
}
if (a1->field_1c) {
known_hosts_hash(a0, a1);
} else {
if (!print_fingerprint) {
fprintf(a1->field_8, "%s\n", a0->field_18);
} else {
v2 = sshkey_fingerprint(a0->field_40, v0, v1, v0);
v3 = sshkey_fingerprint(a0->field_40, fingerprint_hash, 0x4,
fingerprint_hash);
if (v2 && !(!v3))
goto LABEL_40469a;
sshfatal("ssh-keygen.c", "known_hosts_find_delete", 0x4f6, 0x1, 0x1,
0x0, "sshkey_fingerprint failed");
LABEL_40469a:
if (a0->field_48->field_0)
v8 = " ";
else
v8 = &g_410d75;
mprintf("%s %s %s%s%s\n", a1->field_0, sshkey_type(a0->field_40), v2,
v8);
if (log_level_get("%s %s %s%s%s\n", a1, v9, v10, v11, 0x0) > 3)
printf("%s\n", v3);
free(v3);
free(v2);
}
}
}
} else if (a1->field_24) {
if (a0->field_10 == 1) {
*(&a1->padding_18[0]) = 1;
sshlog("ssh-keygen.c", "known_hosts_find_delete", 0x507, 0x0, 0x3, 0x0,
"%s:%lu: invalid line", a0->field_0);
}
fprintf(a1->field_8, "%s\n", a0->field_18);
}
return 0;
} | openssh-portable | angr_phoenix |
static _Bool
has_uuid_suffix(char const *s) {
size_t len = strlen(s);
return (36 < len && strspn(s + len - 36, "-0123456789abcdefABCDEF") == 36);
} | int has_uuid_suffix(char *a0) {
unsigned long v0;
unsigned int v2;
v0 = strlen(a0);
if (v0 > 36) {
v2 = strspn(&a0[36 + v0], "-0123456789abcdefABCDEF");
if (v2 == 36)
v2 = 1;
}
if (v0 <= 36 || v2 != 36)
v2 = 0;
v2 &= 1;
return v2;
} | coreutils | angr_dream |
int get_job_spec(list)
WORD_LIST *list;
{
register char *word;
int job, jflags;
if (list == 0)
return (js.j_current);
word = list->word->word;
if (*word == '\0')
return (-1);
if (*word == '%')
word++;
if (((*word) >= '0' && (*word) <= '9') && all_digits(word)) {
job = atoi(word);
return ((job < 0 || job > js.j_jobslots) ? -1 : job - 1);
}
jflags = 0;
switch (*word) {
case 0:
case '%':
case '+':
return (js.j_current);
case '-':
return (js.j_previous);
case '?':
jflags |= 0x02;
word++;
default:
return get_job_by_name(word, jflags);
}
} | long long get_job_spec(struct_0 *a0) {
unsigned int v0;
unsigned int v1;
unsigned long long v3;
char *v4;
if (!a0) {
v3 = *(&signal_name);
} else {
v4 = *(a0->field_8);
if (!*(a0->field_8)->field_0) {
v3 = 4294967295;
} else {
if (*(a0->field_8)->field_0 == 37)
v4 = *(a0->field_8) + 1;
if (*(v4) > 47 && *(v4) <= 57 && all_digits(v4)) {
v1 = atoi(v4);
if (v1 >= 0 && v1 <= g_5001bc) {
v3 = v1 - 1;
goto LABEL_401533;
}
v3 = 4294967295;
goto LABEL_401533;
}
v0 = 0;
if (*(v4) == 63) {
v0 |= 2;
v4 += 1;
} else if (*(v4) <= 63) {
if (*(v4) == 45) {
v3 = g_5001d4;
goto LABEL_401533;
}
if (*(v4) <= 45) {
if (*(v4) == 43) {
LABEL_40150e:
v3 = *(&signal_name);
goto LABEL_401533;
} else if (*(v4) <= 43 && *(v4)) {
if (!(*(v4) == 37))
goto LABEL_401526;
goto LABEL_40150e;
}
}
}
LABEL_401526:
v3 = get_job_by_name(v4, v0);
}
}
LABEL_401533:
return v3;
} | bash | angr_phoenix |
int rl_tty_status(int count, int key) {
rl_ding();
return 0;
} | long long rl_tty_status(unsigned long a0, unsigned long a1) {
unsigned int v0;
unsigned int v1;
v1 = a0;
v0 = a1;
rl_ding();
return 0;
} | bash | angr_dream |
static int parseRFCStructuredData(uchar **pp2parse, uchar *pResult,
int *pLenStr) {
uchar *p2parse;
int bCont = 1;
int iRet = 0;
int lenStr;
((void)(0));
((void)(0));
((void)(0));
p2parse = *pp2parse;
lenStr = *pLenStr;
if (lenStr == 0 || (*p2parse != '[' && *p2parse != '-'))
return 1;
if (*p2parse == '-') {
*pResult++ = '-';
++p2parse;
--lenStr;
} else {
while (bCont) {
if (lenStr < 2) {
if (lenStr > 0 && *p2parse == ']') {
*pResult++ = *p2parse;
p2parse++;
lenStr--;
bCont = 0;
} else {
iRet = 1;
bCont = 0;
}
} else if (*p2parse == '\\' && *(p2parse + 1) == ']') {
*pResult++ = *p2parse++;
*pResult++ = *p2parse++;
lenStr -= 2;
} else if (*p2parse == ']' && *(p2parse + 1) == ' ') {
*pResult++ = *p2parse;
p2parse += 1;
lenStr -= 1;
bCont = 0;
} else {
*pResult++ = *p2parse++;
--lenStr;
}
}
}
if (lenStr > 0 && *p2parse == ' ') {
++p2parse;
--lenStr;
} else {
iRet = 1;
}
*pResult = '\0';
*pp2parse = p2parse;
*pLenStr = lenStr;
return iRet;
} | void parseRFCStructuredData(unsigned long long *a0, unsigned long long a1,
unsigned int *a2) {
char *v0;
int tmp_22;
int tmp_30;
int tmp_42;
int tmp_50;
int tmp_14;
unsigned int v1;
unsigned int v2;
unsigned int v3;
char v4[2];
unsigned long long v6;
char *v7;
char *v9;
char *v10;
char *v11;
unsigned long long v12;
v0 = a1;
v1 = 1;
v2 = 0;
*(&v4) = *(a0);
v3 = *(a2);
if (!v3) {
v6 = 1;
return;
}
switch (v4[0]) {
case 45:
case 91:
if (v4[0] == 45) {
v11 = v0;
v0 += 1;
*(v11) = 45;
*(&v4) = &v4[1];
v3 -= 1;
} else {
while (v1) {
if (v3 > 1) {
if (!(v4[0] != 92 || v4[1] != 93)) {
tmp_22 = v4;
v4 = &v4[1];
tmp_30 = v0;
v0 += 1;
*(tmp_30) = *(tmp_22);
tmp_42 = v4;
*(&v4) = &v4[1];
tmp_50 = v0;
v0 += 1;
a2 = *(tmp_42);
*(tmp_50) = a2;
v3 -= 2;
} else if (v4[0] != 93 || v4[1] != 32) {
tmp_14 = v4;
v4 = &v4[1];
v9 = v0;
v0 += 1;
a2 = *(tmp_14);
*(v9) = a2;
v3 -= 1;
} else {
v10 = v0;
v0 += 1;
*(v10) = v4[0];
*(&v4) = &v4[1];
v3 -= 1;
v1 = 0;
}
} else {
if (v3 <= 0 || v4[0] != 93) {
v2 = 1;
v1 = 0;
} else {
v7 = v0;
v0 += 1;
*(v7) = v4[0];
*(&v4) = &v4[1];
v3 -= 1;
v1 = 0;
}
}
}
}
if (v3 <= 0 || v4[0] != 32) {
v2 = 1;
break;
} else {
*(&v4) = &v4[1];
v3 -= 1;
break;
}
*(v0) = 0;
*(a0) = v4;
*(a2) = v3;
v12 = v2;
return;
default:
v6 = 1;
return;
}
} | rsyslog-8.2210.0 | angr_sailr |
char *prefix(const char *string, const char *pfx) {
while (*pfx) {
if (*pfx++ != *string++)
return 0;
}
return (char *)string;
} | char *prefix(char *param_1, char *param_2)
{
char cVar1;
char cVar2;
char *local_18;
char *local_10;
local_18 = param_2;
local_10 = param_1;
do {
if (*local_18 == '\0') {
return local_10;
}
cVar1 = *local_18;
cVar2 = *local_10;
local_18 = local_18 + 1;
local_10 = local_10 + 1;
} while (cVar1 == cVar2);
return (char *)0x0;
} | dash-0.5.11+git20210903+057cd650a4ed | ghidra |
static void check_perms(void) {
if (!list) {
}
} | void check_perms() {
char v0;
unsigned long long v2;
v2 = *(&v0);
return;
} | shadow | angr_phoenix |
void usage(int status) {
if (status != 0)
do {
fprintf(stderr, gettext("Try '%s --help' for more information.\n"),
program_name);
} while (0);
else {
printf(gettext("Usage: %s [OPTION]... [ FILE | ARG1 ARG2 ]\n"),
program_name);
fputs_unlocked(
gettext("Print information about users who are currently logged in.\n"),
stdout)
;
fputs_unlocked(gettext("\n -a, --all same as -b -d --login -p -r "
"-t -T -u\n -b, --boot time of last system "
"boot\n -d, --dead print dead processes\n "
"-H, --heading print line of column headings\n"),
stdout)
;
fputs_unlocked(
gettext(" -l, --login print system login processes\n"), stdout)
;
fputs_unlocked(
gettext(
" --lookup attempt to canonicalize hostnames via DNS\n "
"-m only hostname and user associated with stdin\n "
"-p, --process print active processes spawned by init\n"),
stdout)
;
fputs_unlocked(
gettext(" -q, --count all login names and number of users "
"logged on\n -r, --runlevel print current runlevel\n -s, "
"--short print only name, line, and time (default)\n "
"-t, --time print last system clock change\n"),
stdout)
;
fputs_unlocked(
gettext(" -T, -w, --mesg add user's message status as +, - or ?\n "
"-u, --users list users logged in\n --message "
"same as -T\n --writable same as -T\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 FILE is not specified, use %s. %s as FILE is common.\nIf "
"ARG1 ARG2 given, -m presumed: 'am i' or 'mom likes' are usual.\n")
,
"/var/run/utmp", "/var/log/wtmp");
emit_ancillary_info("who");
}
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 [OPTION]... [ FILE | ARG1 ARG2 ]\n");
printf(pcVar3, uVar2);
pFVar1 = stdout;
pcVar3 = (char *)gettext(
"Print information about users who are currently logged in.\n");
fputs_unlocked(pcVar3, pFVar1);
pFVar1 = stdout;
pcVar3 = (char *)gettext(
"\n -a, --all same as -b -d --login -p -r -t -T -u\n -b, "
"--boot time of last system boot\n -d, --dead print "
"dead processes\n -H, --heading print line of column headings\n");
fputs_unlocked(pcVar3, pFVar1);
pFVar1 = stdout;
pcVar3 =
(char *)gettext(" -l, --login print system login processes\n");
fputs_unlocked(pcVar3, pFVar1);
pFVar1 = stdout;
pcVar3 = (char *)gettext(
" --lookup attempt to canonicalize hostnames via DNS\n -m "
" only hostname and user associated with stdin\n -p, "
"--process print active processes spawned by init\n");
fputs_unlocked(pcVar3, pFVar1);
pFVar1 = stdout;
pcVar3 = (char *)gettext(
" -q, --count all login names and number of users logged on\n "
"-r, --runlevel print current runlevel\n -s, --short print "
"only name, line, and time (default)\n -t, --time print last "
"system clock change\n");
fputs_unlocked(pcVar3, pFVar1);
pFVar1 = stdout;
pcVar3 = (char *)gettext(
" -T, -w, --mesg add user\'s message status as +, - or ?\n -u, "
"--users list users logged in\n --message same as -T\n "
" --writable same as -T\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);
pcVar3 = (char *)gettext(
"\nIf FILE is not specified, use %s. %s as FILE is common.\nIf ARG1 "
"ARG2 given, -m presumed: \'am i\' or \'mom likes\' are usual.\n");
printf(pcVar3, "/var/run/utmp", "/var/log/wtmp");
emit_ancillary_info();
} else {
pcVar3 = (char *)gettext("Try \'%s --help\' for more information.\n");
fprintf(stderr, pcVar3, uVar2);
}
exit(param_1);
} | coreutils | ghidra |
static _Bool
binary_operator(_Bool l_is_l) {
int op;
struct stat stat_buf, stat_spare;
_Bool r_is_l;
if (l_is_l)
advance(0);
op = pos + 1;
if ((op < argc - 2) && (strcmp(argv[op + 1], "-l") == 0)) {
r_is_l = 1;
advance(0);
} else
r_is_l = 0;
if (argv[op][0] == '-') {
if ((((argv[op][1] == 'l' || argv[op][1] == 'g') &&
(argv[op][2] == 'e' || argv[op][2] == 't')) ||
(argv[op][1] == 'e' && argv[op][2] == 'q') ||
(argv[op][1] == 'n' && argv[op][2] == 'e')) &&
!argv[op][3]) {
char lbuf[((((((sizeof(uintmax_t) * 8) - (!((__typeof__(uintmax_t))0 <
(__typeof__(uintmax_t))-1))) *
146 +
484) /
485) +
(!((__typeof__(uintmax_t))0 < (__typeof__(uintmax_t))-1))) +
1)];
char rbuf[((((((sizeof(uintmax_t) * 8) - (!((__typeof__(uintmax_t))0 <
(__typeof__(uintmax_t))-1))) *
146 +
484) /
485) +
(!((__typeof__(uintmax_t))0 < (__typeof__(uintmax_t))-1))) +
1)];
char const *l = (l_is_l ? umaxtostr(strlen(argv[op - 1]), lbuf)
: find_int(argv[op - 1]));
char const *r = (r_is_l ? umaxtostr(strlen(argv[op + 2]), rbuf)
: find_int(argv[op + 1]));
int cmp = strintcmp(l, r);
_Bool xe_operator = (argv[op][2] == 'e');
pos += 3;
return (argv[op][1] == 'l' ? cmp < xe_operator
: argv[op][1] == 'g' ? cmp > -xe_operator
: (cmp != 0) == xe_operator);
}
switch (argv[op][1]) {
default:
break;
case 'n':
if (argv[op][2] == 't' && !argv[op][3]) {
struct timespec lt, rt;
_Bool le, re;
pos += 3;
if (l_is_l || r_is_l)
test_syntax_error(gettext("-nt does not accept -l"));
le = get_mtime(argv[op - 1], <);
re = get_mtime(argv[op + 1], &rt);
return le && (!re || timespec_cmp(lt, rt) > 0);
}
break;
case 'e':
if (argv[op][2] == 'f' && !argv[op][3]) {
pos += 3;
if (l_is_l || r_is_l)
test_syntax_error(gettext("-ef does not accept -l"));
return (stat(argv[op - 1], &stat_buf) == 0 &&
stat(argv[op + 1], &stat_spare) == 0 &&
stat_buf.st_dev == stat_spare.st_dev &&
stat_buf.st_ino == stat_spare.st_ino);
}
break;
case 'o':
if ('t' == argv[op][2] && '\000' == argv[op][3]) {
struct timespec lt, rt;
_Bool le, re;
pos += 3;
if (l_is_l || r_is_l)
test_syntax_error(gettext("-ot does not accept -l"));
le = get_mtime(argv[op - 1], <);
re = get_mtime(argv[op + 1], &rt);
return re && (!le || timespec_cmp(lt, rt) < 0);
}
break;
}
test_syntax_error(gettext("%s: unknown binary operator"), quote(argv[op]));
}
if (argv[op][0] == '=' &&
(!argv[op][1] || ((argv[op][1] == '=') && !argv[op][2]))) {
_Bool value = (strcmp(argv[pos], argv[pos + 2]) == 0);
pos += 3;
return value;
}
if ((strcmp(argv[op], "!=") == 0)) {
_Bool value = !(strcmp(argv[pos], argv[pos + 2]) == 0);
pos += 3;
return value;
}
abort();
} | int binary_operator(unsigned long a0) {
char v0;
char v1;
char v2;
char v3;
char v4;
char v5;
char v6;
char v7;
unsigned int v8;
unsigned int v9;
unsigned long long v10;
unsigned int v11;
char v12;
char v13;
char v14;
char v15;
char v16;
char v17;
char v18;
char v19;
char v20;
char v21;
unsigned int v23;
unsigned long long v24;
unsigned long long v25;
unsigned long long v26;
if (a0)
advance(0x0);
v8 = pos + 1;
if (v8 < argc - 2) {
v23 = strcmp(*((argv + (v8 + 1) * 8)), "-l");
if (!v23) {
v0 = 1;
advance(0x0);
}
}
if (v8 >= argc - 2 || v23)
v0 = 0;
if (*(*((argv + (v8 << 3)))) != 45) {
if (*(*((argv + (v8 << 3)))) == 61 &&
(!*((*((argv + (v8 << 3))) + 1)) || !*((*((argv + (v8 << 3))) + 2))) &&
(!*((*((argv + (v8 << 3))) + 1)) ||
*((*((argv + (v8 << 3))) + 1)) == 61)) {
v1 = !strcmp(*((argv + (pos << 3))), *((argv + (pos + 2 << 3))));
pos = pos + 3;
v23 = v1;
}
if (*(*((argv + (v8 << 3)))) != 61 ||
*((*((argv + (v8 << 3))) + 1)) && *((*((argv + (v8 << 3))) + 2)) ||
*((*((argv + (v8 << 3))) + 1)) &&
*((*((argv + (v8 << 3))) + 1)) != 61) {
v23 = strcmp(*((argv + v8 * 8)), "!=");
if (!v23) {
v2 = strcmp(*((argv + (pos << 3))), *((argv + (pos + 2 << 3))));
pos = pos + 3;
v23 = v2;
} else {
abort();
}
}
}
if (...) {
if (a0) {
v25 = strlen(*((argv + v8 * 8 - 8)));
v24 = umaxtostr(v25, &v20, v25);
} else {
v24 = find_int(*((argv + v8 * 8 - 8)));
}
v10 = v24;
if (v0) {
v26 = strlen(*((argv + (v8 + 2) * 8)));
v23 = umaxtostr(v26, &v21, v26);
} else {
v23 = find_int(*((argv + (v8 + 1) * 8)));
}
v11 = v23;
v9 = strintcmp(v10, *(&v11), *(&v11));
v3 = *((*((argv + (v8 << 3))) + 2)) == 101;
pos = pos + 3;
if (*((*((argv + (v8 << 3))) + 1)) == 108) {
v23 = v3;
*(&v23) = v9 < v3;
} else if (*((*((argv + (v8 << 3))) + 1)) == 103) {
v23 = -(v3);
*(&v23) = -(v3) < v9;
} else {
v23 = v3;
*(&v23) = v9 == v3;
}
}
if (...) {
if (*((*((argv + (v8 << 3))) + 1)) != 111) {
if (*((*((argv + (v8 << 3))) + 1)) <= 111) {
if (*((*((argv + (v8 << 3))) + 1)) != 101) {
if (*((*((argv + (v8 << 3))) + 2)) == 116 &&
*((*((argv + (v8 << 3))) + 1)) == 110 &&
!*((*((argv + (v8 << 3))) + 3))) {
pos = pos + 3;
if (!a0 && !v0) {
v6 = get_mtime(*((argv + v8 * 8 - 8)), &v12);
v7 = get_mtime(*((argv + (v8 + 1) * 8)), &v14);
if (v6) {
if (!(v7 ^ 1))
v23 = timespec_cmp(*(&v12), *(&v13), *(&v14), *(&v15));
if (v23 > 0 || (v7 ^ 1))
v23 = 1;
}
if (!v6 || v23 <= 0 && !(v7 ^ 1))
v23 = 0;
v23 &= 1;
}
}
} else {
if (*((*((argv + (v8 << 3))) + 2)) == 102 &&
!*((*((argv + (v8 << 3))) + 3))) {
pos = pos + 3;
if (!a0 && !v0) {
v23 = stat(*((argv + v8 * 8 - 8)), &v16);
if (!v23) {
v23 = stat(*((argv + (v8 + 1) * 8)), &v18);
if (!v23 && *(&v16) == *(&v18) && *(&v17) == *(&v19))
v23 = 1;
}
if (v23 || v23 || *(&v16) != *(&v18) || *(&v17) != *(&v19))
v23 = 0;
v23 &= 1;
}
}
}
}
} else {
if (*((*((argv + (v8 << 3))) + 2)) == 116 &&
!*((*((argv + (v8 << 3))) + 3))) {
pos = pos + 3;
if (!a0 && !v0) {
v4 = get_mtime(*((argv + v8 * 8 - 8)), &v12);
v5 = get_mtime(*((argv + (v8 + 1) * 8)), &v14);
if (v5) {
if (!(v4 ^ 1))
v23 = timespec_cmp(*(&v12), *(&v13), *(&v14), *(&v15));
if (v23 < 0 || (v4 ^ 1))
v23 = 1;
}
if (!v5 || !(v4 ^ 1) && v23 >= 0)
v23 = 0;
v23 &= 1;
}
}
}
}
if (...)
test_syntax_error(gettext("-ot does not accept -l"), "-l");
if (...)
test_syntax_error(gettext("-ef does not accept -l"), "-l");
if (...)
test_syntax_error(gettext("%s: unknown binary operator"),
quote(*((argv + v8 * 8))));
if (...)
test_syntax_error(gettext("-nt does not accept -l"), "-l");
if (...)
return v23;
} | coreutils | angr_dream |
void dispose_variable(var) SHELL_VAR *var;
{
if (var == 0)
return;
if (((((var)->attributes) & (0x0020000))) == 0)
dispose_variable_value(var);
do {
if ((var)->exportstr)
sh_xfree(((var)->exportstr), "variables.c", 3793);
} while (0);
sh_xfree((var->name), "variables.c", 3795);
if (((((var)->attributes) & (0x0000001))))
array_needs_making = 1;
sh_xfree((var), "variables.c", 3800);
} | void dispose_variable(struct_0 *a0) {
unsigned long long v1;
if (a0) {
if (!(a0->field_28 & 0x20000))
dispose_variable_value(a0);
if (a0->field_10)
sh_xfree(a0->field_10, "variables.c", 0xed1);
sh_xfree(a0->field_0, "variables.c", 0xed3);
if ((a0->field_28 & 1))
array_needs_making = 1;
v1 = sh_xfree(a0, "variables.c", 0xed8);
}
return;
} | bash | angr_phoenix |
int assertlongfilenames(const char *const *argv) {
struct dpkg_version version = {0, "1.4.1.17", ((void *)0)};
return assert_version_support(argv, &version, gettext("long filenames"));
} | long assertlongfilenames(_QWORD *a1) {
char *v1;
int v3;
const char *v4;
long v5;
unsigned long v6;
v6 = __readfsqword(0x28u);
v3 = 0;
v4 = "1.4.1.17";
v5 = 0LL;
v1 = gettext("long filenames");
return assert_version_support(a1, (long)&v3, (long)v1);
} | dpkg | ida |
static void compare_members_lists(const char *groupname, char **members,
char **other_members, const char *file,
const char *other_file) {
char **pmem, **other_pmem;
for (pmem = members; ((void *)0) != *pmem; pmem++) {
for (other_pmem = other_members; ((void *)0) != *other_pmem; other_pmem++) {
if (strcmp(*pmem, *other_pmem) == 0) {
break;
}
}
if (!silence_warnings && *other_pmem == ((void *)0)) {
printf("'%s' is a member of the '%s' group in %s but not in %s\n", *pmem,
groupname, file, other_file);
}
}
} | void compare_members_lists(unsigned long a0, unsigned long a1, unsigned long a2,
unsigned long a3, unsigned long a4) {
unsigned long long *v0;
unsigned long long *v1;
unsigned long long v3;
v0 = a1;
while (true) {
v3 = *(v0);
if (!*(v0))
break;
for (v1 = a2; *(v1) && strcmp(*(v0), *(v1)); v1 += 1)
;
if ((silence_warnings ^ 1) && !*(v1))
printf("'%s' is a member of the '%s' group in %s but not in %s\n", *(v0),
a0, a3, a4);
v0 += 1;
}
return;
} | shadow | angr_sailr |
static int make_room(struct extent_list *list, int i) {
int ret;
if (list->count == list->size) {
unsigned int new_size = (list->size + 341) * sizeof(struct ext2fs_extent);
ret = __errcode_to_errno(ext2fs_resize_mem(0, new_size, &list->extents),
__func__, 408);
if (ret)
return ret;
list->size += 341;
}
memmove(&list->extents[i + 1], &list->extents[i],
sizeof(list->extents[0]) * (list->count - i));
list->count++;
return 0;
} | int make_room(struct_0 *a0, unsigned long a1) {
unsigned int v0;
unsigned int v1;
unsigned int v3;
if (a0->field_10 == a0->field_14) {
v0 = (a0->field_14 * 24) + 8184;
v1 = __errcode_to_errno(ext2fs_resize_mem(0x0, v0, &a0->field_8),
"make_room", 0x198);
if (v1)
v3 = v1;
else
a0->field_14 = a0->field_14 + 341;
}
if (!v1 || a0->field_10 != a0->field_14) {
memmove((a1 + 1) * 24 + a0->field_8, a0->field_8 + a1 * 24,
(a0->field_10 - a1) * 24);
a0->field_10 = a0->field_10 + 1;
v3 = 0;
}
return v3;
} | e2fsprogs-1.46.5 | angr_dream |
const char *lookup_env_in_list(const char *env, char *const *envs,
size_t nenvs) {
size_t i, envlen;
envlen = strlen(env);
for (i = 0; i < nenvs; i++) {
if (strncmp(envs[i], env, envlen) == 0 && envs[i][envlen] == '=') {
return envs[i] + envlen + 1;
}
}
return ((void *)0);
} | size_t lookup_env_in_list(const char *a1, long a2, unsigned long a3) {
unsigned long i;
size_t n;
n = strlen(a1);
for (i = 0LL; i < a3; ++i) {
if (!strncmp(*(const char **)(8 * i + a2), a1, n) &&
*(_BYTE *)(*(_QWORD *)(8 * i + a2) + n) == 61)
return n + 1 + *(_QWORD *)(8 * i + a2);
}
return 0LL;
} | openssh-portable | ida |
static Channel *server_request_direct_tcpip(struct ssh *ssh, int *reason,
const char **errmsg) {
Channel *c = ((void *)0);
char *target = ((void *)0), *originator = ((void *)0);
u_int target_port = 0, originator_port = 0;
int r;
if ((r = sshpkt_get_cstring(ssh, &target, ((void *)0))) != 0 ||
(r = sshpkt_get_u32(ssh, &target_port)) != 0 ||
(r = sshpkt_get_cstring(ssh, &originator, ((void *)0))) != 0 ||
(r = sshpkt_get_u32(ssh, &originator_port)) != 0 ||
(r = sshpkt_get_end(ssh)) != 0)
sshpkt_fatal(ssh, r, "%s: parse packet", __func__);
if (target_port > 0xFFFF) {
sshlog("serverloop.c", __func__, 443, 1, SYSLOG_LEVEL_ERROR, ((void *)0),
"invalid target port");
*reason = 1;
goto out;
}
if (originator_port > 0xFFFF) {
sshlog("serverloop.c", __func__, 448, 1, SYSLOG_LEVEL_ERROR, ((void *)0),
"invalid originator port");
*reason = 1;
goto out;
}
sshlog("serverloop.c", __func__, 453, 1, SYSLOG_LEVEL_DEBUG1, ((void *)0),
"originator %s port %u, target %s port %u", originator,
originator_port, target, target_port);
if ((options.allow_tcp_forwarding & (1 << 1)) != 0 &&
auth_opts->permit_port_forwarding_flag && !options.disable_forwarding) {
c = channel_connect_to_port(ssh, target, target_port, "direct-tcpip",
"direct-tcpip", reason, errmsg);
} else {
sshlog("serverloop.c", __func__, 463, 0, SYSLOG_LEVEL_INFO, ((void *)0),
"refused local port forward: "
"originator %s port %d, target %s port %d",
originator, originator_port, target, target_port)
;
if (reason != ((void *)0))
*reason = 1;
}
out:
free(originator);
free(target);
return c;
} | long server_request_direct_tcpip(long a1, _DWORD *a2, long a3) {
unsigned int v5;
unsigned int v6;
unsigned int cstring;
void *v8;
void *ptr;
long v10;
unsigned long v11;
v11 = __readfsqword(0x28u);
v10 = 0LL;
v8 = 0LL;
ptr = 0LL;
v5 = 0;
v6 = 0;
cstring = sshpkt_get_cstring(a1, &v8, 0LL);
if (cstring || (cstring = sshpkt_get_u32(a1, &v5)) != 0 ||
(cstring = sshpkt_get_cstring(a1, &ptr, 0LL)) != 0 ||
(cstring = sshpkt_get_u32(a1, &v6)) != 0 ||
(cstring = sshpkt_get_end(a1)) != 0) {
sshpkt_fatal(a1, cstring, "%s: parse packet",
"server_request_direct_tcpip");
}
if (v5 <= 0xFFFF) {
if (v6 <= 0xFFFF) {
sshlog("serverloop.c", "server_request_direct_tcpip", 453LL, 1LL, 5LL,
0LL, "originator %s port %u, target %s port %u", (const char *)ptr,
v6, (const char *)v8, v5);
if ((options[343] & 2) != 0 && *auth_opts && !options[346]) {
v10 = channel_connect_to_port(a1, v8, (unsigned short)v5,
"direct-tcpip", "direct-tcpip", a2, a3);
} else {
sshlog("serverloop.c", "server_request_direct_tcpip", 463LL, 0LL, 3LL,
0LL,
"refused local port forward: originator %s port %d, target %s "
"port %d",
(const char *)ptr, v6, (const char *)v8, v5);
if (a2)
*a2 = 1;
}
} else {
sshlog("serverloop.c", "server_request_direct_tcpip", 448LL, 1LL, 2LL,
0LL, "invalid originator port");
*a2 = 1;
}
} else {
sshlog("serverloop.c", "server_request_direct_tcpip", 443LL, 1LL, 2LL, 0LL,
"invalid target port");
*a2 = 1;
}
free(ptr);
free(v8);
return v10;
} | openssh-portable | ida |
test_code_t test_tls1_3(gnutls_session_t session) {
int ret;
sprintf(prio_str,
"NONE:"
"+CIPHER-ALL:+ARCFOUR-128:+3DES-CBC"
":+GOST28147-TC26Z-CNT"
":"
"+COMP-NULL"
":+VERS-TLS1.3:"
"+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, 1142)) !=
TEST_SUCCEED) {
return _ret;
}
};
gnutls_credentials_set(session, GNUTLS_CRD_CERTIFICATE, xcred);
ret = test_do_handshake(session);
if (ret == TEST_SUCCEED)
tls1_3_ok = 1;
return ret;
} | long test_tls1_3(long a1) {
unsigned int v2;
unsigned int v3;
sprintf(prio_str,
"NONE:+CIPHER-ALL:+ARCFOUR-128:+3DES-CBC:+GOST28147-TC26Z-CNT:+COMP-"
"NULL:+VERS-TLS1.3:+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);
v2 = _gnutls_priority_set_direct(a1, prio_str, 0x476u);
if (v2)
return v2;
gnutls_credentials_set(a1, 1LL, xcred);
v3 = test_do_handshake(a1);
if (!v3)
tls1_3_ok = 1;
return v3;
} | gnutls | ida |
static int has_unaligned_cluster_map(e2fsck_t ctx, blk64_t last_pblk,
blk64_t last_lblk, blk64_t pblk,
blk64_t lblk) {
blk64_t cluster_mask;
if (!ctx->fs->cluster_ratio_bits)
return 0;
cluster_mask = ((1 << (ctx->fs)->cluster_ratio_bits) - 1);
if ((lblk & cluster_mask) != (pblk & cluster_mask))
return 1;
if (last_pblk && (lblk & cluster_mask) != 0 &&
((lblk) >> (ctx->fs)->cluster_ratio_bits) ==
((last_lblk) >> (ctx->fs)->cluster_ratio_bits) &&
((pblk) >> (ctx->fs)->cluster_ratio_bits) !=
((last_pblk) >> (ctx->fs)->cluster_ratio_bits))
return 1;
return 0;
} | int has_unaligned_cluster_map(struct struct_0 **a0, unsigned long a1,
unsigned long a2, unsigned long a3,
unsigned long a4) {
unsigned long v0;
unsigned int v2;
if (!*(a0)->field_c0) {
v2 = 0;
return v2;
}
v0 = (1 << (*(a0)->field_c0 & 31)) - 1;
if (((a4 ^ a3) & v0)) {
v2 = 1;
return v2;
} else if (!a1) {
v2 = 0;
return v2;
} else if (!(a4 & v0)) {
v2 = 0;
return v2;
} else if (a4 >> (*(a0)->field_c0 & 63) != a2 >> (*(a0)->field_c0 & 63)) {
v2 = 0;
return v2;
} else if (a3 >> (*(a0)->field_c0 & 63) == a1 >> (*(a0)->field_c0 & 63)) {
v2 = 0;
return v2;
} else {
v2 = 1;
return v2;
}
} | e2fsprogs-1.46.5 | angr_sailr |
static void init_funcs(void) {
int i, h, h_next;
COLUMN *p;
h = chars_per_margin;
if (!truncate_lines)
h_next = 0;
else {
if (parallel_files && numbered_lines)
h_next = h + chars_per_column + number_width;
else
h_next = h + chars_per_column;
}
h = h + col_sep_length;
for (p = column_vector, i = 1; i < columns; ++p, ++i) {
if (storing_columns) {
p->char_func = store_char;
p->print_func = print_stored;
} else
{
p->char_func = print_char;
p->print_func = read_line;
}
p->numbered = numbered_lines && (!parallel_files || i == 1);
p->start_position = h;
if (!truncate_lines) {
h = 0;
h_next = 0;
} else {
h = h_next + col_sep_length;
h_next = h + chars_per_column;
}
}
if (storing_columns && balance_columns) {
p->char_func = store_char;
p->print_func = print_stored;
} else {
p->char_func = print_char;
p->print_func = read_line;
}
p->numbered = numbered_lines && (!parallel_files || i == 1);
p->start_position = h;
} | _QWORD *init_funcs() {
bool v0;
bool v1;
_QWORD *result;
int i;
int v4;
int v5;
_QWORD *v6;
if (truncate_lines != 1) {
v5 = 0;
} else if (parallel_files && numbered_lines) {
v5 = chars_per_margin + chars_per_column + number_width;
} else {
v5 = chars_per_column + chars_per_margin;
}
v4 = col_sep_length + chars_per_margin;
v6 = column_vector;
for (i = 1; i < columns; ++i) {
if (storing_columns) {
v6[4] = store_char;
v6[3] = print_stored;
} else {
v6[4] = print_char;
v6[3] = read_line;
}
v0 = numbered_lines && (parallel_files != 1 || i == 1);
*((_BYTE *)v6 + 56) = v0;
*((_DWORD *)v6 + 13) = v4;
if (truncate_lines != 1) {
v4 = 0;
v5 = 0;
} else {
v4 = col_sep_length + v5;
v5 += chars_per_column + col_sep_length;
}
v6 += 8;
}
if (storing_columns && balance_columns) {
v6[4] = store_char;
v6[3] = print_stored;
} else {
v6[4] = print_char;
v6[3] = read_line;
}
v1 = numbered_lines && (parallel_files != 1 || i == 1);
*((_BYTE *)v6 + 56) = v1;
result = v6;
*((_DWORD *)v6 + 13) = v4;
return result;
} | coreutils | ida |
ARRAY *array_dequote(array)
ARRAY *array;
{
ARRAY_ELEMENT *a;
char *t;
if (array == 0 || ((array)->head) == 0 || ((array)->num_elements == 0))
return (ARRAY *)((void *)0);
for (a = ((array->head)->next); a != array->head; a = ((a)->next)) {
t = dequote_string(a->value);
do {
if (a->value)
sh_xfree((a->value), "array.c", 356);
} while (0);
a->value = t;
}
return array;
} | long array_dequote(long a1) {
long i;
long v3;
if (!a1 || !*(_QWORD *)(a1 + 16) || !*(_QWORD *)(a1 + 8))
return 0LL;
for (i = *(_QWORD *)(*(_QWORD *)(a1 + 16) + 16LL); i != *(_QWORD *)(a1 + 16);
i = *(_QWORD *)(i + 16)) {
v3 = dequote_string(*(_QWORD *)(i + 8));
if (*(_QWORD *)(i + 8))
sh_xfree(*(_QWORD *)(i + 8), "array.c", 356LL);
*(_QWORD *)(i + 8) = v3;
}
return a1;
} | bash | ida |
static void xattrs__acls_get_d(int parentfd, char const *file_name,
struct tar_stat_info *st, char **ret_ptr,
size_t *ret_len) {
char *val = ((void *)0);
acl_t acl;
if (!(acl = acl_get_file_at(parentfd, file_name, (0x4000)))) {
if ((*__errno_location()) != 95)
call_arg_warn("acl_get_file_at", file_name);
return;
}
val = acl_to_text(acl, ((void *)0));
acl_free(acl);
if (!val) {
call_arg_warn("acl_to_text", file_name);
return;
}
*ret_ptr = xstrdup(val);
xattrs_acls_cleanup(*ret_ptr, ret_len);
acl_free(val);
} | void xattrs__acls_get_d(unsigned long a0, char *a1, unsigned long a2,
unsigned long long *a3, unsigned long long *a4) {
unsigned long v0;
unsigned long long v1;
unsigned long long v2;
unsigned long long v5;
unsigned long long v6;
unsigned long long v7;
v0 = a2;
v1 = 0;
v2 = acl_get_file_at(a0, a1, 0x4000);
if (v2) {
v1 = acl_to_text(v2, 0x0);
acl_free(v2);
if (!v1) {
v6 = call_arg_warn("acl_to_text", a1);
return;
}
*(a3) = xstrdup(v1);
xattrs_acls_cleanup(*(a3), a4);
v7 = acl_free(v1);
return;
} else if (*(__errno_location()) == 95) {
return;
} else {
v5 = call_arg_warn("acl_get_file_at", a1);
return;
}
} | tar | angr_sailr |
static void channel_post_auth_listener(struct ssh *ssh, Channel *c) {
Channel *nc;
int r, newsock;
struct sockaddr_storage addr;
socklen_t addrlen;
if ((c->io_ready & 0x10) == 0)
return;
addrlen = sizeof(addr);
newsock = accept(c->sock, (struct sockaddr *)&addr, &addrlen);
if (newsock == -1) {
sshlog("channels.c", __func__, 1850, 0, SYSLOG_LEVEL_ERROR, ((void *)0),
"accept from auth socket: %.100s", strerror((*__errno_location())));
if ((*__errno_location()) == 24 || (*__errno_location()) == 23)
c->notbefore = monotime() + 1;
return;
}
nc = channel_new(ssh, "accepted auth socket", 3, newsock, newsock, -1,
c->local_window_max, c->local_maxpacket, 0,
"accepted auth socket", 1);
open_preamble(ssh, __func__, nc, "auth-agent@openssh.com");
if ((r = sshpkt_send(ssh)) != 0)
sshfatal("channels.c", __func__, 1861, 1, SYSLOG_LEVEL_FATAL, ssh_err(r),
"channel %i", c->self);
} | long long channel_post_auth_listener(void *a0, struct_0 *a1) {
unsigned long v0;
unsigned int v1;
unsigned int v2;
unsigned int v3;
void *v4;
char v5;
if ((a1->field_30 & 16)) {
v1 = 128;
v2 = accept(a1->field_28, &v5, &v1);
if (v2 == -1) {
v0 = strerror(*(__errno_location()));
sshlog("channels.c", "channel_post_auth_listener", 0x73a, 0x0, 0x2, 0x0,
"accept from auth socket: %.100s");
if (*(__errno_location()) != 24 && !(*(__errno_location()) == 23))
goto LABEL_405af0;
a1->field_58 = __addvdi3(monotime(), 0x1);
LABEL_405af0:
}
v4 = channel_new(a0, "accepted auth socket", 0x3, v2, v2, 0xffffffff,
a1->field_b4, a1->field_bc, 0x0, "accepted auth socket",
0x1);
open_preamble(a0, "channel_post_auth_listener", v4,
"auth-agent@openssh.com");
v3 = sshpkt_send(a0);
v0 = a1->field_4;
sshfatal("channels.c", "channel_post_auth_listener", 0x745, 0x1, 0x1,
ssh_err(v3));
}
return 0;
} | openssh-portable | angr_phoenix |
SHELL_VAR *bind_var_to_int(var, val, flags)
char *var;
intmax_t val;
int flags;
{
char ibuf[(((sizeof(intmax_t) * 8) - (!((intmax_t)0 < (intmax_t)-1))) * 302 /
1000 +
1 + (!((intmax_t)0 < (intmax_t)-1))) +
1],
*p;
p = fmtulong(val, 10, ibuf, sizeof(ibuf), 0);
return (bind_int_variable(var, p, flags));
} | void bind_var_to_int(undefined8 param_1, undefined8 param_2, undefined4 param_3)
{
undefined8 uVar1;
long in_FS_OFFSET;
undefined local_28[24];
long local_10;
local_10 = *(long *)(in_FS_OFFSET + 0x28);
uVar1 = fmtulong(param_2, 10, local_28, 0x16, 0);
bind_int_variable(param_1, uVar1, param_3);
if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) {
__stack_chk_fail();
}
return;
} | bash | ghidra |
void strmode(mode_t mode, char *p) {
switch (mode & 0170000) {
case 0040000:
*p++ = 'd';
break;
case 0020000:
*p++ = 'c';
break;
case 0060000:
*p++ = 'b';
break;
case 0100000:
*p++ = '-';
break;
case 0120000:
*p++ = 'l';
break;
case 0140000:
*p++ = 's';
break;
case 0010000:
*p++ = 'p';
break;
default:
*p++ = '?';
break;
}
if (mode & 0400)
*p++ = 'r';
else
*p++ = '-';
if (mode & 0200)
*p++ = 'w';
else
*p++ = '-';
switch (mode & (0100 | 04000)) {
case 0:
*p++ = '-';
break;
case 0100:
*p++ = 'x';
break;
case 04000:
*p++ = 'S';
break;
case 0100 | 04000:
*p++ = 's';
break;
}
if (mode & (0400 >> 3))
*p++ = 'r';
else
*p++ = '-';
if (mode & (0200 >> 3))
*p++ = 'w';
else
*p++ = '-';
switch (mode & ((0100 >> 3) | 02000)) {
case 0:
*p++ = '-';
break;
case (0100 >> 3):
*p++ = 'x';
break;
case 02000:
*p++ = 'S';
break;
case (0100 >> 3) | 02000:
*p++ = 's';
break;
}
if (mode & ((0400 >> 3) >> 3))
*p++ = 'r';
else
*p++ = '-';
if (mode & ((0200 >> 3) >> 3))
*p++ = 'w';
else
*p++ = '-';
switch (mode & (((0100 >> 3) >> 3) | 01000)) {
case 0:
*p++ = '-';
break;
case ((0100 >> 3) >> 3):
*p++ = 'x';
break;
case 01000:
*p++ = 'T';
break;
case ((0100 >> 3) >> 3) | 01000:
*p++ = 't';
break;
}
*p++ = ' ';
*p = '\0';
} | long long strmode(unsigned long a0, unsigned long long a1) {
unsigned long long v0;
int tmp_13;
char *v2;
char *v3;
char *v4;
char *v5;
char *v6;
char *v7;
char *v8;
char *v9;
char *v10;
char *v11;
char *v12;
char *v13;
char *v14;
char *v15;
char *v16;
char *v17;
char *v18;
char *v19;
char *v20;
char *v21;
char *v22;
char *v23;
char *v24;
char *v25;
char *v26;
char *v27;
char *v28;
char *v29;
char *v30;
char *v31;
char *v32;
char *v33;
v0 = a1;
if ((a0 & 0xf000) == 0xc000) {
v2 = v0;
v0 += 1;
*(v2) = 115;
} else if (!((a0 & 0xf000) <= 0xc000) || !((a0 & 0xf000) != 0xa000) ||
!((a0 & 0xf000) <= 0xa000)) {
v3 = v0;
v0 += 1;
if ((a0 & 0xf000) <= 0xc000 && (a0 & 0xf000) == 0xa000)
*(v3) = 108;
else
*(v8) = 63;
} else {
if ((a0 & 0xf000) != 0x8000) {
if (!((a0 & 0xf000) <= 0x8000))
goto LABEL_0x4000cd;
if ((a0 & 0xf000) == 0x6000)
goto LABEL_0x4000ab;
if (!((a0 & 0xf000) <= 0x6000))
goto LABEL_0x4000cd;
if ((a0 & 0xf000) == 0x4000) {
v6 = v0;
v0 += 1;
if ((a0 & 0xf000) == 0x4000) {
*(v6) = 100;
goto LABEL_400110;
} else {
*(v9) = 99;
goto LABEL_400110;
}
}
if (!((a0 & 0xf000) <= 0x4000))
goto LABEL_0x4000cd;
if ((a0 & 0xf000) != 0x1000) {
if ((a0 & 0xf000) == 0x2000)
goto LABEL_0x400089;
goto LABEL_0x4000cd;
}
}
v5 = v0;
v0 += 1;
if ((a0 & 0xf000) == 0x6000) {
*(v5) = 98;
} else if ((a0 & 0xf000) == 0x8000) {
*(v4) = 45;
} else {
*(v7) = 112;
}
}
LABEL_400110:
if ((a0 & 0x100)) {
v10 = v0;
v0 += 1;
*(v10) = 114;
} else {
v11 = v0;
v0 += 1;
*(v11) = 45;
}
if ((a0 & 128)) {
v12 = v0;
v0 += 1;
*(v12) = 119;
} else {
v13 = v0;
v0 += 1;
*(v13) = 45;
}
if ((a0 & 2112) == 2112) {
v14 = v0;
v0 += 1;
*(v14) = 115;
} else if ((a0 & 2112) <= 2112) {
if ((a0 & 2112) == 0x800) {
v15 = v0;
v0 += 1;
*(v15) = 83;
} else if ((a0 & 2112) <= 0x800) {
switch (a0 & 2112) {
case 0:
v16 = v0;
v0 += 1;
*(v16) = 45;
break;
case 64:
v17 = v0;
v0 += 1;
*(v17) = 120;
break;
default:
goto LABEL_4001da;
}
}
}
LABEL_4001da:
if ((a0 & 32)) {
v18 = v0;
v0 += 1;
*(v18) = 114;
} else {
v19 = v0;
v0 += 1;
*(v19) = 45;
}
if ((a0 & 16)) {
v20 = v0;
v0 += 1;
*(v20) = 119;
} else {
v21 = v0;
v0 += 1;
*(v21) = 45;
}
if ((a0 & 1032) == 1032) {
v22 = v0;
v0 += 1;
*(v22) = 115;
} else if ((a0 & 1032) <= 1032) {
if ((a0 & 1032) == 0x400) {
v23 = v0;
v0 += 1;
*(v23) = 83;
} else if ((a0 & 1032) <= 0x400) {
switch (a0 & 1032) {
case 0:
v24 = v0;
v0 += 1;
*(v24) = 45;
break;
case 8:
v25 = v0;
v0 += 1;
*(v25) = 120;
break;
default:
goto LABEL_4002a0;
}
}
}
LABEL_4002a0:
if ((a0 & 4)) {
v26 = v0;
v0 += 1;
*(v26) = 114;
} else {
v27 = v0;
v0 += 1;
*(v27) = 45;
}
if ((a0 & 2)) {
v28 = v0;
v0 += 1;
*(v28) = 119;
} else {
v29 = v0;
v0 += 1;
*(v29) = 45;
}
switch (a0 & 513) {
case 513:
v30 = v0;
v0 += 1;
*(v30) = 116;
break;
case 512:
v31 = v0;
v0 += 1;
*(v31) = 84;
break;
case 0:
v32 = v0;
v0 += 1;
*(v32) = 45;
break;
case 1:
v33 = v0;
v0 += 1;
*(v33) = 120;
break;
default:
goto LABEL_400366;
}
LABEL_400366:
tmp_13 = v0;
v0 += 1;
*(tmp_13) = 32;
*(v0) = 0;
return v0;
} | libbsd-0.11.7 | angr_sailr |
errcode_t e2fsck_adjust_inode_count(e2fsck_t ctx, ext2_ino_t ino, int adj) {
ext2_filsys fs = ctx->fs;
errcode_t retval;
struct ext2_inode inode;
if (!ino)
return 0;
retval = ext2fs_read_inode(fs, ino, &inode);
if (retval)
return retval;
if (adj == 1) {
ext2fs_icount_increment(ctx->inode_count, ino, 0);
if (inode.i_links_count == (__u16)~0)
return 0;
ext2fs_icount_increment(ctx->inode_link_info, ino, 0);
inode.i_links_count++;
} else if (adj == -1) {
ext2fs_icount_decrement(ctx->inode_count, ino, 0);
if (inode.i_links_count == 0)
return 0;
ext2fs_icount_decrement(ctx->inode_link_info, ino, 0);
inode.i_links_count--;
}
retval = ext2fs_write_inode(fs, ino, &inode);
if (retval)
return retval;
return 0;
} | void e2fsck_adjust_inode_count(unsigned long long a0[57], unsigned long a1,
unsigned long a2) {
unsigned long long v0;
unsigned long long v1;
char v2;
char v3;
void *v5;
unsigned long long v6;
void *v7;
void *v8;
unsigned long v9;
v0 = a0[0];
if (!a1) {
v5 = 0;
return;
}
v1 = ext2fs_read_inode(v0, a1, &v2, a1);
if (v1) {
v6 = v1;
return;
}
if (a2 == 1) {
ext2fs_icount_increment(a0[55], a1, 0x0, a1);
if (*(&v3) == 65535) {
v7 = 0;
return;
}
ext2fs_icount_increment(a0[56], a1, 0x0, a1);
v3 = *(&v3) + 1;
} else if (a2 == -1) {
ext2fs_icount_decrement(a0[55], a1, 0x0, a1);
if (!*(&v3)) {
v8 = 0;
return;
}
ext2fs_icount_decrement(a0[56], a1, 0x0, a1);
v3 = *(&v3) - 1;
}
v1 = ext2fs_write_inode(v0, a1, &v2, a1);
v9 = (!v1 ? v1 : 0);
return;
} | e2fsprogs-1.46.5 | angr_sailr |
static inline void __jiffies_to_tv(struct timeval *tv, unsigned long jiffies) {
unsigned long long tvusec;
tvusec = 10000ULL * jiffies;
tv->tv_sec = tvusec / 1000000;
tv->tv_usec = tvusec - 1000000 * tv->tv_sec;
} | void __jiffies_to_tv(unsigned long long a0[2], unsigned long a1) {
unsigned long v0;
char v1;
unsigned long long v3[2];
unsigned long long v4;
v0 = a1 * 10000;
a0[0] = v0 * 4835703278458516699 >> 64 >> 18;
v3 = a0;
a0[1] = v0 - a0[0] * 1000000;
v4 = *(&v1);
return;
} | iproute2-6.0.0 | angr_sailr |
static void terminal_free_buffer(wint_t ***bp) {
wint_t **b;
wint_t **bufp;
if (*bp == ((void *)0))
return;
b = *bp;
*bp = ((void *)0);
for (bufp = b; *bufp != ((void *)0); bufp++)
free(*bufp);
free(b);
} | void terminal_free_buffer(unsigned long long *a0) {
unsigned long long *v0;
void *v1;
unsigned long long v3;
unsigned long long v4;
v3 = *(a0);
if (*(a0)) {
v1 = *(a0);
*(a0) = 0;
for (v0 = v1; *(v0); v0 += 1) {
free(*(v0));
}
v4 = free(v1);
}
return;
} | libedit | angr_dream |
static char *parameter_list_remove_pattern(itype, pattern, patspec, quoted)
int itype;
char *pattern;
int patspec, quoted;
{
char *ret;
WORD_LIST *list;
list = list_rest_of_args();
if (list == 0)
return ((char *)((void *)0));
ret = list_remove_pattern(list, pattern, patspec, itype, quoted);
dispose_words(list);
return (ret);
} | char *parameter_list_remove_pattern(int a1, _BYTE *a2, int a3, int a4) {
long ***v7;
char *v8;
v7 = (long ***)list_rest_of_args();
if (!v7)
return 0LL;
v8 = list_remove_pattern(v7, a2, a3, a1, a4);
dispose_words(v7);
return v8;
} | bash | ida |
static int control_show(const char *const *argv) {
struct pkginfo *pkg;
const char *pkgname;
const char *filename;
const char *control_file;
pkgname = *argv++;
if (!pkgname || !*argv)
badusage(gettext("--%s takes exactly two arguments"), cipaction->olong);
control_file = *argv++;
if (!control_file || *argv)
badusage(gettext("--%s takes exactly two arguments"), cipaction->olong);
pkg_infodb_check_filetype(control_file);
modstatdb_open(msdbrw_readonly);
pkg = dpkg_options_parse_pkgname(cipaction, pkgname);
if (pkg->status == PKG_STAT_NOTINSTALLED)
ohshit(gettext("package '%s' is not installed"),
pkg_name(pkg, pnaw_nonambig));
if (pkg_infodb_has_file(pkg, &pkg->installed, control_file))
filename = pkg_infodb_get_file(pkg, &pkg->installed, control_file);
else
ohshit(gettext("control file '%s' does not exist"), control_file);
modstatdb_shutdown();
file_show(filename);
return 0;
} | long long control_show(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;
int tmp_27;
int tmp_11;
unsigned long long v1;
char *v2;
struct_0 *v3;
unsigned long long v4;
v0 = a0;
tmp_27 = v0;
v0 += 1;
v1 = *(tmp_27);
if (!v1 || !*(v0))
badusage(gettext("--%s takes exactly two arguments"));
tmp_11 = v0;
v0 += 1;
v2 = *(tmp_11);
if (!v2 || *(v0))
badusage(gettext("--%s takes exactly two arguments"));
pkg_infodb_check_filetype(v2);
modstatdb_open(0x0);
v3 = dpkg_options_parse_pkgname(cipaction, v1, v1);
if (!v3->field_18)
ohshit(gettext("package '%s' is not installed"), pkg_name(v3, 0x1, a2));
if (pkg_infodb_has_file(v3, &v3[2].padding_0[16], v2, &v3[2].padding_0[16]))
v4 =
pkg_infodb_get_file(v3, &v3[2].padding_0[16], v2, &v3[2].padding_0[16]);
else
ohshit(gettext("control file '%s' does not exist"), v2);
modstatdb_shutdown(a0, a1, a2, a3, a4, a5);
file_show(v4);
return 0;
} | dpkg | angr_dream |
test_code_t test_ecdhe_secp384r1(gnutls_session_t session) {
return test_ecdhe_curve(session, "+CURVE-SECP384R1",
GNUTLS_ECC_CURVE_SECP384R1);
} | long long test_ecdhe_secp384r1(unsigned long long a0) {
return test_ecdhe_curve(a0, "+CURVE-SECP384R1", 0x3);
} | gnutls | angr_dream |
HostStatus check_key_in_hostfiles(struct passwd *pw, struct sshkey *key,
const char *host, const char *sysfile,
const char *userfile) {
char *user_hostfile;
struct stat st;
HostStatus host_status;
struct hostkeys *hostkeys;
const struct hostkey_entry *found;
hostkeys = init_hostkeys();
load_hostkeys(hostkeys, host, sysfile, 0);
if (userfile != ((void *)0)) {
user_hostfile = tilde_expand_filename(userfile, pw->pw_uid);
if (options.strict_modes && (stat(user_hostfile, &st) == 0) &&
((st.st_uid != 0 && st.st_uid != pw->pw_uid) ||
(st.st_mode & 022) != 0)) {
sshlog("auth.c", __func__, 436, 0, SYSLOG_LEVEL_INFO, ((void *)0),
"Authentication refused for %.100s: "
"bad owner or modes for %.200s",
pw->pw_name, user_hostfile)
;
auth_debug_add("Ignored %.200s: bad ownership or modes", user_hostfile);
} else {
temporarily_use_uid(pw);
load_hostkeys(hostkeys, host, user_hostfile, 0);
restore_uid();
}
free(user_hostfile);
}
host_status = check_key_in_hostkeys(hostkeys, key, &found);
if (host_status == HOST_REVOKED)
sshlog("auth.c", __func__, 450, 0, SYSLOG_LEVEL_ERROR, ((void *)0),
"WARNING: revoked key for %s attempted authentication", host);
else if (host_status == HOST_OK)
sshlog("auth.c", __func__, 453, 1, SYSLOG_LEVEL_DEBUG1, ((void *)0),
"key for %s found at %s:%ld", found->host, found->file, found->line);
else
sshlog("auth.c", __func__, 456, 1, SYSLOG_LEVEL_DEBUG1, ((void *)0),
"key for host %s not found", host);
free_hostkeys(hostkeys);
return host_status;
} | long check_key_in_hostfiles(long a1, long a2, const char *a3, long a4,
long a5) {
long v5;
long v6;
long v7;
long v8;
unsigned int v13;
long v14;
long inited;
char *file;
struct stat v17;
unsigned long v18;
v18 = __readfsqword(0x28u);
inited = init_hostkeys();
load_hostkeys(inited, a3, a4, 0LL);
if (a5) {
file = (char *)tilde_expand_filename(a5, *(unsigned int *)(a1 + 16));
if (options[298] && !stat(file, &v17) &&
(v17.st_uid && v17.st_uid != *(_DWORD *)(a1 + 16) ||
(v17.st_mode & 0x12) != 0)) {
sshlog("auth.c", "check_key_in_hostfiles", 436LL, 0LL, 3LL, 0LL,
"Authentication refused for %.100s: bad owner or modes for %.200s",
*(const char **)a1, file);
auth_debug_add("Ignored %.200s: bad ownership or modes", (long)file, v5,
v6, v7, v8);
} else {
temporarily_use_uid(a1);
load_hostkeys(inited, a3, file, 0LL);
restore_uid();
}
free(file);
}
v13 = check_key_in_hostkeys(inited, a2, &v14);
if (v13 == 3) {
sshlog("auth.c", "check_key_in_hostfiles", 450LL, 0LL, 2LL, 0LL,
"WARNING: revoked key for %s attempted authentication", a3);
} else if (v13) {
sshlog("auth.c", "check_key_in_hostfiles", 456LL, 1LL, 5LL, 0LL,
"key for host %s not found", a3);
} else {
sshlog("auth.c", "check_key_in_hostfiles", 453LL, 1LL, 5LL, 0LL,
"key for %s found at %s:%ld", *(const char **)v14,
*(const char **)(v14 + 8), *(_QWORD *)(v14 + 16));
}
free_hostkeys(inited);
return v13;
} | openssh-portable | ida |
(r = sshbuf_put_u32(m, life)) != 0)
goto out;
}
if (confirm != 0) {
if ((r = sshbuf_put_u8(m, 2)) != 0)
goto out;
} | void sshbuf_put_u32(void)
{
halt_baddata();
} | openssh-portable | ghidra |
static int history_def_enter(void *p, HistEvent *ev, const char *str) {
history_t *h = (history_t *)p;
if ((h->flags & 1) != 0 && h->list.next != &h->list &&
strcmp(h->list.next->ev.str, str) == 0)
return 0;
if (history_def_insert(h, ev, str) == -1)
return -1;
while (h->cur > h->max && h->cur > 0)
history_def_delete(h, ev, h->list.prev);
return 1;
} | undefined8 history_def_enter(long param_1, undefined8 param_2, char *param_3)
{
int iVar1;
undefined8 uVar2;
if ((((*(uint *)(param_1 + 0x3c) & 1) != 0) &&
(*(long *)(param_1 + 0x18) != param_1)) &&
(iVar1 = strcmp(*(char **)(*(long *)(param_1 + 0x18) + 8), param_3),
iVar1 == 0)) {
return 0;
}
iVar1 = history_def_insert(param_1, param_2, param_3);
if (iVar1 == -1) {
uVar2 = 0xffffffff;
} else {
while ((*(int *)(param_1 + 0x30) < *(int *)(param_1 + 0x34) &&
(0 < *(int *)(param_1 + 0x34)))) {
history_def_delete(param_1, param_2, *(undefined8 *)(param_1 + 0x20));
}
uVar2 = 1;
}
return uVar2;
} | libedit | ghidra |
int main(int argc, char **argv) {
FILE *fp;
struct timeval tv;
fd_set fds;
char buf[1024];
char *p;
char *logfile;
char *pidfile;
int rotate;
int dontfork;
int ptm, pts;
int n, m, i;
int todo;
int considx;
struct real_cons cons[16];
int num_consoles, consoles_left;
int print_escape_sequence = 0;
fp = ((void *)0);
logfile = "/var/log/boot";
pidfile = ((void *)0);
rotate = 0;
dontfork = 0;
while ((i = getopt(argc, argv, "cdesl:p:rv")) != (-1))
switch (i) {
case 'l':
logfile = optarg;
break;
case 'r':
rotate = 1;
break;
case 'v':
printf("bootlogd - %s\n", "3.05");
exit(0);
break;
case 'p':
pidfile = optarg;
break;
case 'c':
createlogfile = 1;
break;
case 'd':
dontfork = 1;
break;
case 'e':
print_escape_sequence = 1;
break;
case 's':
syncalot = 1;
break;
default:
usage();
break;
}
if (optind < argc)
usage();
signal(15, handler);
signal(3, handler);
signal(2, handler);
signal(21, ((__sighandler_t)1));
signal(22, ((__sighandler_t)1));
signal(20, ((__sighandler_t)1));
if ((num_consoles = consolenames(cons, 16)) <= 0)
return 1;
consoles_left = num_consoles;
for (considx = 0; considx < num_consoles; considx++) {
if (strcmp(cons[considx].name, "/dev/tty0") == 0)
strcpy(cons[considx].name, "/dev/tty1");
if (strcmp(cons[considx].name, "/dev/vc/0") == 0)
strcpy(cons[considx].name, "/dev/vc/1");
if ((cons[considx].fd = open_nb(cons[considx].name)) < 0) {
fprintf(stderr, "bootlogd: %s: %s\n", cons[considx].name,
strerror((*__errno_location())));
consoles_left--;
}
}
if (!consoles_left)
return 1;
ptm = -1;
pts = -1;
buf[0] = 0;
if (findpty(&ptm, &pts, buf) < 0) {
fprintf(stderr, "bootlogd: cannot allocate pseudo tty: %s\n",
strerror((*__errno_location())));
return 1;
}
(void)ioctl(0, 0x541D, ((void *)0));
if ((n = open("/dev/tty0", 02)) >= 0) {
(void)ioctl(n, 0x541D, ((void *)0));
close(n);
}
if (ioctl(pts, 0x541D, ((void *)0)) < 0)
{
fprintf(stderr, "bootlogd: ioctl(%s, TIOCCONS): %s\n", buf,
strerror((*__errno_location())));
return 1;
}
if (!dontfork) {
pid_t child_pid = fork();
switch (child_pid) {
case -1:
fprintf(stderr, "bootlogd: fork failed: %s\n",
strerror((*__errno_location())));
exit(1);
break;
case 0:
break;
default:
exit(0);
break;
}
setsid();
}
if (pidfile) {
unlink(pidfile);
if ((fp = fopen(pidfile, "w")) != ((void *)0)) {
fprintf(fp, "%d\n", (int)getpid());
fclose(fp);
}
fp = ((void *)0);
}
while (!got_signal) {
tv.tv_sec = 0;
tv.tv_usec = 500000;
do {
unsigned int __i;
fd_set *__arr = (&fds);
for (__i = 0; __i < sizeof(fd_set) / sizeof(__fd_mask); ++__i)
((__arr)->fds_bits)[__i] = 0;
} while (0);
((void)(((&fds)->fds_bits)[((ptm) / (8 * (int)sizeof(__fd_mask)))] |=
((__fd_mask)(1UL << ((ptm) % (8 * (int)sizeof(__fd_mask)))))));
if (select(ptm + 1, &fds, ((void *)0), ((void *)0), &tv) == 1) {
if ((n = read(ptm, inptr, endptr - inptr)) >= 0) {
for (considx = 0; considx < num_consoles; considx++) {
if (cons[considx].fd < 0)
continue;
m = n;
p = inptr;
while (m > 0) {
i = write(cons[considx].fd, p, m);
if (i >= 0) {
m -= i;
p += i;
continue;
}
cons[considx].fd =
write_err(pts, cons[considx].fd, cons[considx].name,
(*__errno_location()));
if (cons[considx].fd >= 0)
continue;
if (--consoles_left <= 0)
got_signal = 1;
break;
}
}
inptr += n;
if (inptr - n < outptr && inptr > outptr)
outptr = inptr;
if (inptr >= endptr)
inptr = ringbuf;
if (outptr >= endptr)
outptr = ringbuf;
}
}
if (fp == ((void *)0) && access(logfile, 0) == 0) {
if (rotate) {
snprintf(buf, sizeof(buf), "%s~", logfile);
rename(logfile, buf);
}
fp = fopen(logfile, "a");
}
if (fp == ((void *)0) && createlogfile)
fp = fopen(logfile, "a");
if (inptr >= outptr)
todo = inptr - outptr;
else
todo = endptr - outptr;
if (fp && todo)
writelog(fp, (unsigned char *)outptr, todo, print_escape_sequence);
}
if (fp) {
if (!didnl)
fputc('\n', fp);
fclose(fp);
}
close(pts);
close(ptm);
for (considx = 0; considx < num_consoles; considx++) {
close(cons[considx].fd);
}
return 0;
} | int main() {
char v0;
unsigned long long v1;
unsigned long v2;
unsigned int v3;
unsigned int v4;
unsigned int v5;
unsigned int v6;
void *v7;
unsigned long long v8;
void *v9;
char v10;
unsigned long v11;
unsigned int v12;
unsigned int v13;
unsigned int v14;
unsigned int v15;
unsigned int v16;
unsigned int v17;
unsigned int v18;
unsigned int v19;
unsigned int v20;
unsigned int v21;
unsigned int v22;
unsigned int v23;
unsigned int v24;
unsigned int v25;
void *v26;
void *v27;
char *v28;
char *v29;
unsigned long long *v30;
void *v31;
unsigned long long v32;
char v33;
char v34;
char v35;
unsigned long v36;
char v37;
char v38;
unsigned int v39;
unsigned int v40;
unsigned long long *v41;
do {
v1 = v1;
} while (&v1 != &v0);
v3 = v39;
*(&v2) = v40;
v36 = v41[5];
v6 = 0;
v7 = 0;
v8 = "/var/log/boot";
v9 = 0;
v4 = 0;
v5 = 0;
while (true) {
v22 = getopt(*((&v11 + 4)), *(&v10), "cdesl:p:rv");
if (v22 == -1)
break;
switch (v22) {
case 99:
createlogfile = 1;
break;
case 100:
v15 = 1;
break;
case 101:
v20 = 1;
break;
case 108:
v28 = *(&optarg);
break;
case 112:
v29 = *(&optarg);
break;
case 114:
v14 = 1;
break;
case 115:
syncalot = 1;
break;
case 118:
printf("bootlogd - %s\n", &g_401dd8);
exit(0x0);
default:
usage();
}
}
if (*((&v11 + 4)) > optind)
usage();
signal(0xf, handler);
signal(0x3, handler);
signal(0x2, handler);
signal(0x15, 0x1);
signal(0x16, 0x1);
signal(0x14, 0x1);
v23 = consolenames(&v34, 0x10);
if (v23 > 0) {
v19 = v23;
for (v18 = 0; v18 < v23; v18 += 1) {
if (!strcmp(&(&v34)[0x400 * v18 + 4 * v18], "/dev/tty0"))
strcpy(&(&v34)[1028 * v18], "/dev/tty1");
if (!strcmp(&(&v34)[0x400 * v18 + 4 * v18], "/dev/vc/0"))
strcpy(&(&v34)[1028 * v18], "/dev/vc/1");
*(&(&v35)[1028 * v18]) = open_nb(&(&v34)[1028 * v18], v40, v18);
if (*(&(&v35)[0x400 * v18 + 4 * v18]) < 0) {
fprintf(stderr, "bootlogd: %s: %s\n", &(&v34)[1028 * v18],
strerror(*(__errno_location())));
v19 -= 1;
}
}
if (v19) {
v12 = -1;
v13 = -1;
v37 = 0;
if (findpty(&v12, &v13, &v37) < 0) {
fprintf(stderr, "bootlogd: cannot allocate pseudo tty: %s\n",
strerror(*(__errno_location())));
} else {
ioctl(0x0, 0x541d);
v24 = open("/dev/tty0", 0x2, 0x0);
if (v24 >= 0) {
ioctl(v24, 0x541d);
close(v24);
}
if (ioctl(v13, 0x541d) < 0) {
fprintf(stderr, "bootlogd: ioctl(%s, TIOCCONS): %s\n", &v37,
strerror(*(__errno_location())));
} else {
if (!v15) {
v25 = fork();
if (v25 == -1) {
fprintf(stderr, "bootlogd: fork failed: %s\n",
strerror(*(__errno_location())));
exit(0x1);
} else if (!v25) {
setsid();
} else {
exit(0x0);
}
}
if (v29) {
unlink(v29);
v26 = fopen(v29, "w");
if (v26) {
fprintf(v26, "%d\n", getpid());
fclose(v26);
}
v26 = 0;
}
while (!got_signal) {
v31 = 0;
v32 = 500000;
v30 = &v33;
for (v21 = 0; v21 <= 15; v21 += 1) {
v30[v21] = 0;
}
*(&(&v33)[8 * ((v12 < 0 ? v12 + 63 : v12) >> 6)]) =
*(&(&v33)[8 * ((v12 < 0 ? v12 + 63 : v12) >> 6)]) |
1 << (((v12 + (v12 >> 31 >> 26) & 63) - (v12 >> 31 >> 26)) &
63);
if (select(v12 + 1, &v33, NULL, NULL, &v31) == 1) {
v24 = read(v12, inptr, endptr - inptr);
if (v24 >= 0) {
for (v18 = 0; v18 < v23; v18 += 1) {
if (*(&(&v35)[0x400 * v18 + 4 * v18]) >= 0) {
v16 = v24;
v27 = inptr;
do {
if (v16 <= 0)
goto LABEL_40181a;
v22 = write(*(&(&v35)[1028 * v18]), v27, v16);
if (v22 >= 0) {
v16 -= v22;
v27 += v22;
continue;
}
*(&(&v35)[1028 * v18]) =
write_err(v13, *(&(&v35)[1028 * v18]),
&(&v34)[1028 * v18], *(__errno_location()));
} while (*(&(&v35)[0x400 * v18 + 4 * v18]) >= 0);
v19 -= 1;
if (v19 <= 0)
got_signal = 1;
}
LABEL_40181a:
}
inptr = v24 + inptr;
if (!(v24) + inptr < outptr && inptr > outptr)
outptr = inptr;
if (inptr >= endptr)
inptr = &ringbuf;
if (outptr >= endptr)
outptr = &ringbuf;
}
}
if (!v26 && !access(v28, 0x0)) {
if (v14) {
snprintf(&v37, 0x400, "%s~", v28);
rename(v28, &v37);
}
v26 = fopen(v28, "a");
}
if (!v26 && createlogfile)
v26 = fopen(v28, "a");
if (inptr >= outptr)
v17 = inptr - outptr;
else
v17 = endptr - outptr;
if (v26 && v17)
writelog(v26, outptr, v17, v20);
}
if (v26) {
if (!didnl)
fputc(0xa, v26);
fclose(v26);
}
close(v13);
close(v12);
for (v18 = 0; v18 < v23; v18 += 1) {
close(*(&(&v35)[1028 * v18]));
}
}
}
}
}
if (!(*(&v38) ^ v41[5]))
return;
__stack_chk_fail();
} | sysvinit | angr_phoenix |
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(unsigned long long a0[9]) {
unsigned long long v1;
unsigned long long v2[9];
v1 = a0[7];
if (a0[7]) {
decrement_badcount(a0[5], a0[8], a0[7]);
v2 = a0;
a0[7] = 0;
}
return;
} | e2fsprogs-1.46.5 | angr_phoenix |
void print_e2fsck_message(FILE *f, e2fsck_t ctx, const char *msg,
struct problem_context *pctx, int first,
int recurse) {
ext2_filsys fs = ctx->fs;
const char *cp;
int i, width;
e2fsck_clear_progbar(ctx);
for (cp = msg; *cp; cp++) {
if (cp[0] == '@') {
cp++;
expand_at_expression(f, ctx, *cp, pctx, &first, recurse);
} else if (cp[0] == '%') {
cp++;
width = 0;
while (
((*__ctype_b_loc())[(int)((cp[0]))] & (unsigned short int)_ISdigit)) {
width = (width * 10) + cp[0] - '0';
cp++;
}
if (cp[0] == 'I') {
cp++;
expand_inode_expression(f, fs, *cp, pctx);
} else if (cp[0] == 'D') {
cp++;
expand_dirent_expression(f, fs, *cp, pctx);
} else {
expand_percent_expression(f, fs, *cp, width, &first, pctx);
}
} else {
for (i = 0; cp[i]; i++)
if ((cp[i] == '@') || cp[i] == '%')
break;
fprintf(f, "%.*s", i, cp);
cp += i - 1;
}
first = 0;
}
} | long print_e2fsck_message(FILE *a1, long *a2, const char *a3, long a4, int a5,
int a6) {
long result;
int v8;
long v9;
const char *v10;
long *v11;
FILE *stream;
int j;
int v14;
char *i;
long v16;
stream = a1;
v11 = a2;
v10 = a3;
v9 = a4;
v8 = a5;
v16 = *a2;
e2fsck_clear_progbar(a2);
for (i = (char *)v10;; ++i) {
result = (unsigned char)*i;
if (!(_BYTE)result)
break;
if (*i == 64) {
expand_at_expression(stream, v11, *++i, v9, &v8, a6);
} else if (*i == 37) {
++i;
v14 = 0;
while (((*_ctype_b_loc())[*i] & 0x800) != 0)
v14 = 10 * v14 + *i++ - 48;
if (*i == 73) {
expand_inode_expression(stream, v16, *++i, v9);
} else if (*i == 68) {
expand_dirent_expression(stream, v16, *++i, v9);
} else {
expand_percent_expression(stream, v16, *i, v14, &v8, v9);
}
} else {
for (j = 0; i[j] && i[j] != 64 && i[j] != 37; ++j)
;
fprintf(stream, "%.*s", j, i);
i += j - 1;
}
v8 = 0;
}
return result;
} | e2fsprogs-1.46.5 | ida |
static void rl_maybe_restore_sighandler(int sig, sighandler_cxt *handler) {
sighandler_cxt dummy;
sigemptyset(&dummy.sa_mask);
dummy.sa_flags = 0;
if (handler->__sigaction_handler.sa_handler != ((__sighandler_t)1))
sigaction(sig, handler, &dummy);
} | void rl_maybe_restore_sighandler(unsigned long a0, unsigned long long *a1) {
char v0;
char v1;
unsigned int v2;
char v3;
unsigned long long *v5;
unsigned long long v6;
sigemptyset(&v1);
v2 = 0;
if (*(a1) != 1)
sigaction(a0, a1, &v0, a1);
v6 = *(&v3) ^ v5[5];
return;
} | bash | angr_dream |
static intmax_t cond(int token, union yystype *val, int op, int noeval) {
intmax_t a = or(token, val, op, noeval);
intmax_t b;
intmax_t c;
if (last_token != 37)
return a;
b = assignment(yylex(), noeval | !a);
if (last_token != 38)
yyerror("expecting ':'");
token = yylex();
*val = yylval;
c = cond(token, val, yylex(), noeval | !!a);
return a ? b : c;
} | int cond(unsigned long a0, unsigned long long *a1, unsigned long a2,
unsigned long a3) {
unsigned int v0;
unsigned long v1;
unsigned long v2;
unsigned long v3;
unsigned int v5;
v0 = a0;
v1 = or(v0, a1, a2, a3);
if (last_token != 37) {
v5 = v1;
return v5;
}
v2 = assignment(yylex(), !v1 | a3);
yyerror("expecting ':'");
if (false) {
v0 = yylex();
*(a1) = -541125437600005304;
v3 = cond(v0, a1, yylex(), v1 | a3);
if (v1)
v5 = v2;
else
v5 = v3;
}
} | dash-0.5.11+git20210903+057cd650a4ed | angr_dream |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.