input stringlengths 26 172k | output stringlengths 18 318k | repo_name stringclasses 23 values | decompiler stringclasses 5 values |
|---|---|---|---|
int ipstats_print(struct nlmsghdr *n, void *arg) {
struct ipstats_stat_enabled_one one = {
.desc = &ipstats_stat_desc_offload_hw_s_info,
};
struct ipstats_stat_enabled enabled = {
.enabled = &one,
.nenabled = 1,
};
FILE *fp = arg;
int rc;
rc = ipstats_process_ifsm(n, &enabled);
if (rc)
return rc;
fflush(fp);
return 0;
} | long ipstats_print(_DWORD *a1, FILE *a2) {
unsigned int v3;
long v4[2];
long v5[6];
v5[5] = __readfsqword(0x28u);
memset(&v5[1], 0, 24);
v5[0] = (long)&ipstats_stat_desc_offload_hw_s_info;
v4[0] = (long)v5;
v4[1] = 1LL;
v3 = ipstats_process_ifsm(a1, v4);
if (v3)
return v3;
fflush(a2);
return 0LL;
} | iproute2-6.0.0 | ida |
int do_limits(struct sftp_conn *conn, struct sftp_limits *limits) {
u_int id, msg_id;
u_char type;
struct sshbuf *msg;
int r;
if ((conn->exts & 0x00000040) == 0) {
sshlog("sftp-client.c", __func__, 617, 0, SYSLOG_LEVEL_ERROR, ((void *)0),
"Server does not support limits@openssh.com extension");
return -1;
}
if ((msg = sshbuf_new()) == ((void *)0))
sshfatal("sftp-client.c", __func__, 622, 1, SYSLOG_LEVEL_FATAL, ((void *)0),
"sshbuf_new failed");
id = conn->msg_id++;
if ((r = sshbuf_put_u8(msg, 200)) != 0 ||
(r = sshbuf_put_u32(msg, id)) != 0 ||
(r = sshbuf_put_cstring(msg, "limits@openssh.com")) != 0)
sshfatal("sftp-client.c", __func__, 628, 1, SYSLOG_LEVEL_FATAL, ssh_err(r),
"compose");
send_msg(conn, msg);
sshlog("sftp-client.c", __func__, 630, 0, SYSLOG_LEVEL_DEBUG3, ((void *)0),
"Sent message limits@openssh.com I:%u", id);
get_msg(conn, msg);
if ((r = sshbuf_get_u8(msg, &type)) != 0 ||
(r = sshbuf_get_u32(msg, &msg_id)) != 0)
sshfatal("sftp-client.c", __func__, 636, 1, SYSLOG_LEVEL_FATAL, ssh_err(r),
"parse");
sshlog("sftp-client.c", __func__, 638, 0, SYSLOG_LEVEL_DEBUG3, ((void *)0),
"Received limits reply T:%u I:%u", type, msg_id);
if (id != msg_id)
sshfatal("sftp-client.c", __func__, 640, 0, SYSLOG_LEVEL_FATAL, ((void *)0),
"ID mismatch (%u != %u)", msg_id, id);
if (type != 201) {
sshlog("sftp-client.c", __func__, 642, 1, SYSLOG_LEVEL_DEBUG1, ((void *)0),
"expected SSH2_FXP_EXTENDED_REPLY(%u) packet, got %u", 201, type);
conn->exts &= ~0x00000040;
sshbuf_free(msg);
return 0;
}
memset(limits, 0, sizeof(*limits));
if ((r = sshbuf_get_u64(msg, &limits->packet_length)) != 0 ||
(r = sshbuf_get_u64(msg, &limits->read_length)) != 0 ||
(r = sshbuf_get_u64(msg, &limits->write_length)) != 0 ||
(r = sshbuf_get_u64(msg, &limits->open_handles)) != 0)
sshfatal("sftp-client.c", __func__, 655, 1, SYSLOG_LEVEL_FATAL, ssh_err(r),
"parse limits");
sshbuf_free(msg);
return 0;
} | long do_limits(unsigned int *a1, char *a2) {
unsigned int v3;
long v4;
long v5;
long v6;
unsigned char v7;
unsigned int v8;
unsigned int u8;
unsigned int v10;
long v11;
unsigned long v12;
v12 = __readfsqword(0x28u);
if ((a1[7] & 0x40) != 0) {
v11 = sshbuf_new();
if (!v11)
sshfatal("sftp-client.c", "do_limits", 622LL, 1LL, 1LL, 0LL,
"sshbuf_new failed");
v3 = a1[6];
a1[6] = v3 + 1;
v10 = v3;
u8 = sshbuf_put_u8(v11, 200LL);
if (u8 || (u8 = sshbuf_put_u32(v11, v10)) != 0 ||
(u8 = sshbuf_put_cstring(v11, "limits@openssh.com")) != 0) {
v4 = ssh_err(u8);
sshfatal("sftp-client.c", "do_limits", 628LL, 1LL, 1LL, v4, "compose");
}
send_msg((long)a1, v11);
sshlog("sftp-client.c", "do_limits", 630LL, 0LL, 7LL, 0LL,
"Sent message limits@openssh.com I:%u", v10);
get_msg(a1, v11);
u8 = sshbuf_get_u8(v11, &v7);
if (u8 || (u8 = sshbuf_get_u32(v11, &v8)) != 0) {
v5 = ssh_err(u8);
sshfatal("sftp-client.c", "do_limits", 636LL, 1LL, 1LL, v5, "parse");
}
sshlog("sftp-client.c", "do_limits", 638LL, 0LL, 7LL, 0LL,
"Received limits reply T:%u I:%u", v7, v8);
if (v10 != v8)
sshfatal("sftp-client.c", "do_limits", 640LL, 0LL, 1LL, 0LL,
"ID mismatch (%u != %u)", v8, v10);
if (v7 == 0xC9) {
memset(a2, 0, 0x20uLL);
u8 = sshbuf_get_u64(v11, a2);
if (u8 || (u8 = sshbuf_get_u64(v11, a2 + 8)) != 0 ||
(u8 = sshbuf_get_u64(v11, a2 + 16)) != 0 ||
(u8 = sshbuf_get_u64(v11, a2 + 24)) != 0) {
v6 = ssh_err(u8);
sshfatal("sftp-client.c", "do_limits", 655LL, 1LL, 1LL, v6,
"parse limits");
}
sshbuf_free(v11);
return 0LL;
} else {
sshlog("sftp-client.c", "do_limits", 642LL, 1LL, 5LL, 0LL,
"expected SSH2_FXP_EXTENDED_REPLY(%u) packet, got %u", 201LL, v7);
a1[7] &= ~0x40u;
sshbuf_free(v11);
return 0LL;
}
} else {
sshlog("sftp-client.c", "do_limits", 617LL, 0LL, 2LL, 0LL,
"Server does not support limits@openssh.com extension");
return 0xFFFFFFFFLL;
}
} | openssh-portable | ida |
static void replace_control_chars(char *cell) {
char *p = cell;
while (*p) {
if (c_iscntrl(to_uchar(*p)))
*p = '?';
p++;
}
} | void replace_control_chars(unsigned long a0) {
char *v0;
unsigned long long v2;
v0 = a0;
while (true) {
v2 = *(v0);
if (!*(v0))
break;
if (c_iscntrl(to_uchar(*(v0))))
*(v0) = 63;
v0 += 1;
}
return;
} | coreutils | angr_phoenix |
static char *preproc_filterpat(pat, text)
char *pat;
const char *text;
{
char *ret;
ret = strcreplace(pat, '&', text, 1);
return ret;
} | int preproc_filterpat(unsigned long long a0, unsigned long long a1) {
unsigned long v0;
v0 = strcreplace(a0, 0x26, a1, 0x1);
return v0;
} | bash | angr_sailr |
static void map_init_nls(EditLine *el) {
int i;
el_action_t *map = el->el_map.key;
for (i = 0200; i <= 0377; i++)
if (iswprint(i))
map[i] = 9;
} | void map_init_nls(struct_0 *a0) {
unsigned int v0;
char *v1;
unsigned long long v3;
unsigned long long v5;
v3 = a0->field_3f8;
v1 = a0->field_3f8;
for (v0 = 128; v0 <= 255; v0 += 1) {
if (iswprint(v0)) {
v5 = &v1[v0];
v1[v0] = 9;
}
}
return;
} | libedit | angr_phoenix |
re_clear_lines(EditLine *el) {
if (((el)->el_terminal.t_flags & 0x004)) {
int i;
for (i = el->el_refresh.r_oldcv; i >= 0; i--) {
terminal_move_to_line(el, i);
terminal_move_to_char(el, 0);
terminal_clear_EOL(el, el->el_terminal.t_size.h);
}
} else {
terminal_move_to_line(el, el->el_refresh.r_oldcv);
terminal__putc(el, '\r');
terminal__putc(el, '\n');
}
} | long re_clear_lines(unsigned int *a1) {
long result;
int i;
if ((a1[38] & 4) != 0) {
result = a1[198];
for (i = a1[198]; i >= 0; --i) {
terminal_move_to_line(a1, (unsigned int)i);
terminal_move_to_char(a1, 0LL);
result = terminal_clear_EOL(a1, a1[36]);
}
} else {
terminal_move_to_line(a1, a1[198]);
terminal__putc(a1, 13LL);
return terminal__putc(a1, 10LL);
}
return result;
} | libedit | ida |
size_t malloc_usable_size(mem) void *mem;
{
register union mhead *p;
register char *ap;
if ((ap = (char *)mem) == 0)
return 0;
p = (union mhead *)ap - 1;
if (p->minfo.mi_alloc == ((char)0xd6)) {
ap -= p->minfo.mi_nbytes;
p = (union mhead *)ap - 1;
}
if (p->minfo.mi_alloc == ((char)0x54))
return 0;
return (p->minfo.mi_nbytes);
} | long long malloc_usable_size(struct_0 *a0) {
struct_0 *v1;
void *v2;
struct_1 *v3;
v1 = a0;
if (!a0) {
v2 = 0;
return v2;
}
v3 = &v1->padding_0[16];
if (v1->padding_0[16] == 214)
v3 = &a0->padding_0[-(*(&a0->padding_0[12])) + 16];
v2 = (v3->field_0 == 84 ? v3->field_4 : 0);
return v2;
} | bash | angr_sailr |
static void get_icvlen(__u8 *icvlen, char *arg) {
int ret = get_u8(icvlen, arg, 10);
if (ret)
invarg("expected ICV length", arg);
if (*icvlen < 8 || *icvlen > 16)
invarg("ICV length must be in the range {"
"8"
".."
"16"
"}",
arg);
} | long get_icvlen(_BYTE *a1, long a2) {
long result;
if ((unsigned int)get_u8(a1, a2, 10LL))
invarg("expected ICV length", a2);
if (*a1 <= 7u)
return invarg("ICV length must be in the range {8..16}", a2);
result = (unsigned char)*a1;
if ((unsigned char)result > 0x10u)
return invarg("ICV length must be in the range {8..16}", a2);
return result;
} | iproute2-6.0.0 | ida |
test_code_t test_certificate(gnutls_session_t session) {
int ret;
FILE *fp;
(void)remove("debug-certs.out");
if (verbose == 0)
return TEST_IGNORE;
sprintf(prio_str,
"NONE:"
"+CIPHER-ALL:+ARCFOUR-128:+3DES-CBC"
":+GOST28147-TC26Z-CNT"
":"
"+COMP-NULL"
":%s:"
"+MAC-ALL:+MD5:+SHA1"
":+GOST28147-TC26Z-IMIT"
":"
"+RSA:+DHE-RSA:+DHE-DSS:+ANON-DH:+ECDHE-RSA:+ECDHE-ECDSA:+ANON-ECDH"
":+VKO-GOST-12"
":%s",
protocol_str, rest);
{
int _ret;
if ((_ret = __gnutls_priority_set_direct(session, prio_str, 1537)) !=
TEST_SUCCEED) {
return _ret;
}
};
gnutls_credentials_set(session, GNUTLS_CRD_CERTIFICATE, xcred);
ret = test_do_handshake(session);
if (ret == TEST_FAILED)
return ret;
fp = fopen("debug-certs.out", "w");
if (fp != ((void *)0)) {
fprintf(fp, "\n");
print_cert_info2(session, GNUTLS_CRT_PRINT_FULL, fp, verbose);
fclose(fp);
ext_text = "saved in debug-certs.out";
return TEST_SUCCEED;
}
return TEST_FAILED;
} | long long test_certificate(unsigned long long a0) {
unsigned int v0;
unsigned int v1;
void *v2;
unsigned long long v4;
remove("debug-certs.out");
if (!verbose) {
v4 = 3;
return v4;
}
sprintf(&prio_str,
"NONE:+CIPHER-ALL:+ARCFOUR-128:+3DES-CBC:+GOST28147-TC26Z-CNT:+COMP-"
"NULL:%s:+MAC-ALL:+MD5:+SHA1:+GOST28147-TC26Z-IMIT:+RSA:+DHE-RSA:+"
"DHE-DSS:+ANON-DH:+ECDHE-RSA:+ECDHE-ECDSA:+ANON-ECDH:+VKO-GOST-12:%s",
&protocol_str, &rest);
v0 = __gnutls_priority_set_direct(a0, &prio_str, 0x601);
if (v0) {
v4 = v0;
return v4;
}
gnutls_credentials_set(a0, 0x1, xcred);
v1 = test_do_handshake(a0);
if (v1 == 1) {
v4 = v1;
return v4;
}
v2 = fopen("debug-certs.out", "w");
if (!v2) {
v4 = 1;
return v4;
}
fprintf(v2, "\n");
print_cert_info2(a0, 0x0, v2, verbose);
fclose(v2);
ext_text = "saved in debug-certs.out";
v4 = 0;
return v4;
} | gnutls | angr_sailr |
static void usage(void) {
fprintf(stderr, "Usage: ip vrf show [NAME] ...\n"
" ip vrf exec [NAME] cmd ...\n"
" ip vrf identify [PID]\n"
" ip vrf pids [NAME]\n");
exit(-1);
} | void usage() {
fprintf(stderr, "Usage:\tip vrf show [NAME] ...\n\tip vrf exec [NAME] cmd "
"...\n\tip vrf identify [PID]\n\tip vrf pids [NAME]\n");
exit(0xffffffff);
} | iproute2-6.0.0 | angr_dream |
int kex_gen_server(struct ssh *ssh) {
sshlog("kexgen.c", __func__, 260, 0, SYSLOG_LEVEL_DEBUG1, ((void *)0),
"expecting SSH2_MSG_KEX_ECDH_INIT");
ssh_dispatch_set(ssh, 30, &input_kex_gen_init);
return 0;
} | undefined8 kex_gen_server(undefined8 param_1)
{
sshlog("kexgen.c", "kex_gen_server", 0x104, 0, 5, 0,
"expecting SSH2_MSG_KEX_ECDH_INIT");
ssh_dispatch_set(param_1, 0x1e, input_kex_gen_init);
return 0;
} | openssh-portable | ghidra |
char *_rl_strindex(const char *s1, const char *s2) {
register int i, l, len;
for (i = 0, l = strlen(s2), len = strlen(s1); (len - i) >= l; i++)
if (strncasecmp(s1 + i, s2, l) == 0)
return ((char *)(s1 + i));
return ((char *)((void *)0));
} | char *_rl_strindex(char *param_1, char *param_2)
{
int iVar1;
size_t sVar2;
size_t sVar3;
int iVar4;
iVar4 = 0;
sVar2 = strlen(param_2);
sVar3 = strlen(param_1);
while (true) {
if ((int)sVar3 - iVar4 < (int)sVar2) {
return (char *)0x0;
}
iVar1 = strncasecmp(param_1 + iVar4, param_2, (long)(int)sVar2);
if (iVar1 == 0)
break;
iVar4 = iVar4 + 1;
}
return param_1 + iVar4;
} | bash | ghidra |
static inline void emit_ancillary_info(char const *program) {
struct infomap {
char const *program;
char const *node;
} const infomap[] = {
{"[", "test invocation"}, {"coreutils", "Multi-call invocation"},
{"sha224sum", "sha2 utilities"}, {"sha256sum", "sha2 utilities"},
{"sha384sum", "sha2 utilities"}, {"sha512sum", "sha2 utilities"},
{((void *)0), ((void *)0)}};
char const *node = program;
struct infomap const *map_prog = infomap;
while (map_prog->program && !(strcmp(program, map_prog->program) == 0))
map_prog++;
if (map_prog->node)
node = map_prog->node;
printf (gettext ("\n%s online help: <%s>\n"), "GNU coreutils", "https:
char const *lc_messages = setlocale (
5
,
((void *)0)
);
if (lc_messages && strncmp (lc_messages, "" "en_" "", sizeof ("en_") - 1))
{
fputs_unlocked (gettext ("Report any translation bugs to " "<https:
stdout
)
;
}
char const *url_program = (strcmp (program, "[") == 0) ? "test" : program;
printf (gettext ("Full documentation <%s%s>\n"),
"https:
printf (gettext ("or available locally via: info '(coreutils) %s%s'\n"),
node, node == program ? " invocation" : "");
} | void emit_ancillary_info(char *a0) {
unsigned long v0;
unsigned long long v1[2];
char *v2;
unsigned long v3;
unsigned long long v4;
unsigned long long v5;
unsigned long long v6;
unsigned long long v7;
unsigned long long v8;
unsigned long long v9;
unsigned long long v10;
unsigned long long v11;
unsigned long long v12;
unsigned long long v13;
unsigned long long v14;
unsigned long long v15;
void *v16;
void *v17;
char v18;
unsigned long long *v21;
unsigned long long v22;
v4 = "[";
v5 = "test invocation";
v6 = "coreutils";
v7 = "Multi-call invocation";
v8 = "sha224sum";
v9 = "sha2 utilities";
v10 = "sha256sum";
v11 = "sha2 utilities";
v12 = "sha384sum";
v13 = "sha2 utilities";
v14 = "sha512sum";
v15 = "sha2 utilities";
v16 = 0;
v17 = 0;
v0 = a0;
for (v1[0] = &v4; v1[0] && strcmp(a0, v1[0]); v1[0] = v1 + 1)
;
if (v1[1])
v0 = v1[1];
printf(gettext("\n%s online help: <%s>\n"));
v2 = setlocale(0x5, NULL);
if (v2 && strncmp(v2, "en_", 0x3))
fputs_unlocked(gettext("Report any translation bugs to <https:
*(&v3) = (!strcmp(a0, "[") ? a0 : "test");
printf(gettext("Full documentation <%s%s>\n"));
printf(gettext("or available locally via: info '(coreutils) %s%s'\n"));
v22 = *(&v18) ^ v21[5];
return;
} | coreutils | angr_sailr |
test_code_t test_ssl3(gnutls_session_t session) {
int ret;
sprintf(prio_str,
"NONE:"
"+ARCFOUR-128:+3DES-CBC"
":"
"+COMP-NULL"
":+VERS-SSL3.0:%%NO_EXTENSIONS:"
"+MD5:+SHA1"
":"
"+RSA:+DHE-RSA:+DHE-DSS"
":%s",
rest);
{
int _ret;
if ((_ret = __gnutls_priority_set_direct(session, prio_str, 625)) !=
TEST_SUCCEED) {
return _ret;
}
};
gnutls_credentials_set(session, GNUTLS_CRD_CERTIFICATE, xcred);
ret = test_do_handshake(session);
if (ret == TEST_SUCCEED)
ssl3_ok = 1;
return ret;
} | long long test_ssl3(unsigned long long a0) {
unsigned int v0;
unsigned int v1;
unsigned long long v3;
sprintf(&prio_str,
"NONE:+ARCFOUR-128:+3DES-CBC:+COMP-NULL:+VERS-SSL3.0:%%NO_EXTENSIONS:"
"+MD5:+SHA1:+RSA:+DHE-RSA:+DHE-DSS:%s",
&rest);
v0 = __gnutls_priority_set_direct(a0, &prio_str, 0x271);
if (v0) {
v3 = v0;
return v3;
}
gnutls_credentials_set(a0, 0x1, xcred);
v1 = test_do_handshake(a0);
if (!v1)
ssl3_ok = 1;
v3 = v1;
return v3;
} | gnutls | angr_sailr |
extern void cleanup_file_list_stdin(void) {
if (have_read_stdin && rpl_fclose(stdin) != 0)
((!!sizeof(struct {
_Static_assert(
1, "verify_expr ("
"1"
", "
"(error (1, (*__errno_location ()), \"-\"), assume (false))"
")");
int _gl_dummy;
}))
? ((error(1, (*__errno_location()), "-"),
((0) ? (void)0 : __builtin_unreachable())))
: ((error(1, (*__errno_location()), "-"),
((0) ? (void)0 : __builtin_unreachable()))));
} | long long cleanup_file_list_stdin() {
unsigned long long v1;
v1 = have_read_stdin;
if (!have_read_stdin)
return v1;
v1 = rpl_fclose(stdin);
if (!v1)
return v1;
error(0x1, *(__errno_location()), "-");
} | coreutils | angr_sailr |
static void usage(int status) {
FILE *usageout = (0 != status) ? stderr : stdout;
(void)fprintf(usageout,
gettext("Usage: %s [options] LOGIN\n"
"\n"
"Options:\n")
,
Prog);
(void)fputs(gettext(" -d, --lastday LAST_DAY set date of last "
"password change to LAST_DAY\n"),
usageout);
(void)fputs(gettext(" -E, --expiredate EXPIRE_DATE set account expiration "
"date to EXPIRE_DATE\n"),
usageout);
(void)fputs(gettext(" -h, --help display this help "
"message and exit\n"),
usageout);
(void)fputs(gettext(" -i, --iso8601 use YYYY-MM-DD when "
"printing dates\n"),
usageout);
(void)fputs(gettext(" -I, --inactive INACTIVE set password inactive "
"after expiration\n"
" to INACTIVE\n"),
usageout);
(void)fputs(
gettext(
" -l, --list show account aging information\n"),
usageout);
(void)fputs(gettext(" -m, --mindays MIN_DAYS set minimum number of "
"days before password\n"
" change to MIN_DAYS\n"),
usageout);
(void)fputs(gettext(" -M, --maxdays MAX_DAYS set maximum number of "
"days before password\n"
" change to MAX_DAYS\n"),
usageout);
(void)fputs(
gettext(" -R, --root CHROOT_DIR directory to chroot into\n"),
usageout);
(void)fputs(gettext(" -W, --warndays WARN_DAYS set expiration warning "
"days to WARN_DAYS\n"),
usageout);
(void)fputs("\n", usageout);
exit(status);
} | void usage(unsigned long a0) {
void *v0;
unsigned long v1;
unsigned long v3;
v1 = v3;
*(&v0) = (!a0 ? stderr : stdout);
fprintf(v0, gettext("Usage: %s [options] LOGIN\n\nOptions:\n"));
fputs(gettext(" -d, --lastday LAST_DAY set date of last password "
"change to LAST_DAY\n"),
v0);
fputs(gettext(" -E, --expiredate EXPIRE_DATE set account expiration date "
"to EXPIRE_DATE\n"),
v0);
fputs(gettext(" -h, --help display this help message and "
"exit\n"),
v0);
fputs(gettext(" -i, --iso8601 use YYYY-MM-DD when printing "
"dates\n"),
v0);
fputs(gettext(" -I, --inactive INACTIVE set password inactive after "
"expiration\n to INACTIVE\n"),
v0);
fputs(gettext(
" -l, --list show account aging information\n"),
v0);
fputs(gettext(
" -m, --mindays MIN_DAYS set minimum number of days before "
"password\n change to MIN_DAYS\n"),
v0);
fputs(gettext(
" -M, --maxdays MAX_DAYS set maximum number of days before "
"password\n change to MAX_DAYS\n"),
v0);
fputs(gettext(" -R, --root CHROOT_DIR directory to chroot into\n"),
v0);
fputs(gettext(" -W, --warndays WARN_DAYS set expiration warning days "
"to WARN_DAYS\n"),
v0);
fputs("\n", v0);
exit(a0);
} | shadow | angr_sailr |
void sh_set_lines_and_columns(lines, cols) int lines, cols;
{
char val[(((sizeof(int) * 8) - (!((int)0 < (int)-1))) * 302 / 1000 + 1 +
(!((int)0 < (int)-1))) +
1],
*v;
if (winsize_assignment)
return;
v = inttostr(lines, val, sizeof(val));
bind_variable("LINES", v, 0);
v = inttostr(cols, val, sizeof(val));
bind_variable("COLUMNS", v, 0);
} | void sh_set_lines_and_columns(int param_1, int param_2)
{
undefined8 uVar1;
long in_FS_OFFSET;
undefined local_1c[12];
long local_10;
local_10 = *(long *)(in_FS_OFFSET + 0x28);
if (winsize_assignment == 0) {
uVar1 = inttostr((long)param_1, local_1c, 0xc);
bind_variable("LINES", uVar1, 0);
uVar1 = inttostr((long)param_2, local_1c, 0xc);
bind_variable("COLUMNS", uVar1, 0);
}
if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) {
__stack_chk_fail();
}
return;
} | bash | ghidra |
static void amt_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[]) {
if (!tb)
return;
if (tb[IFLA_AMT_MODE])
print_string(PRINT_ANY, "mode", "%s ",
modename[rta_getattr_u32(tb[IFLA_AMT_MODE])]);
if (tb[IFLA_AMT_GATEWAY_PORT])
print_uint(PRINT_ANY, "gateway_port", "gateway_port %u ",
rta_getattr_be16(tb[IFLA_AMT_GATEWAY_PORT]));
if (tb[IFLA_AMT_RELAY_PORT])
print_uint(PRINT_ANY, "relay_port", "relay_port %u ",
rta_getattr_be16(tb[IFLA_AMT_RELAY_PORT]));
if (tb[IFLA_AMT_LOCAL_IP]) {
__be32 addr = rta_getattr_u32(tb[IFLA_AMT_LOCAL_IP]);
print_string(PRINT_ANY, "local", "local %s ", format_host(2, 4, &addr));
}
if (tb[IFLA_AMT_REMOTE_IP]) {
__be32 addr = rta_getattr_u32(tb[IFLA_AMT_REMOTE_IP]);
print_string(PRINT_ANY, "remote", "remote %s ", format_host(2, 4, &addr));
}
if (tb[IFLA_AMT_DISCOVERY_IP]) {
__be32 addr = rta_getattr_u32(tb[IFLA_AMT_DISCOVERY_IP]);
print_string(PRINT_ANY, "discovery", "discovery %s ",
format_host(2, 4, &addr));
}
if (tb[IFLA_AMT_LINK]) {
unsigned int link = rta_getattr_u32(tb[IFLA_AMT_LINK]);
print_string(PRINT_ANY, "link", "dev %s ", ll_index_to_name(link));
}
if (tb[IFLA_AMT_MAX_TUNNELS])
print_uint(PRINT_ANY, "max_tunnels", "max_tunnels %u ",
rta_getattr_u32(tb[IFLA_AMT_MAX_TUNNELS]));
} | long long amt_print_opt(unsigned long a0, unsigned long a1,
unsigned long long a2[9]) {
unsigned long v0;
unsigned long v1;
unsigned int v2;
unsigned int v3;
v1 = a0;
v0 = a1;
if (a2) {
if (a2[1])
print_string(0x4, "mode", "%s ", (&modename)[rta_getattr_u32(a2[1])]);
if (a2[3])
print_uint(0x4, "gateway_port", "gateway_port %u ",
rta_getattr_be16(a2[3]));
if (a2[2])
print_uint(0x4, "relay_port", "relay_port %u ", rta_getattr_be16(a2[2]));
if (a2[5]) {
v2 = rta_getattr_u32(a2[5]);
print_string(0x4, "local", "local %s ", format_host(0x2, 0x4, &v2));
}
if (a2[6]) {
v2 = rta_getattr_u32(a2[6]);
print_string(0x4, "remote", "remote %s ", format_host(0x2, 0x4, &v2));
}
if (a2[7]) {
v2 = rta_getattr_u32(a2[7]);
print_string(0x4, "discovery", "discovery %s ",
format_host(0x2, 0x4, &v2));
}
if (a2[4]) {
v3 = rta_getattr_u32(a2[4]);
print_string(0x4, "link", "dev %s ", ll_index_to_name(v3));
}
if (a2[8])
print_uint(0x4, "max_tunnels", "max_tunnels %u ", rta_getattr_u32(a2[8]));
}
return 0;
} | iproute2-6.0.0 | angr_dream |
static errcode_t
e2fsck_handle_write_error(io_channel channel, unsigned long block, int count,
const void *data, size_t size __attribute__((unused)),
int actual __attribute__((unused)), errcode_t error) {
int i;
const char *p;
ext2_filsys fs = (ext2_filsys)channel->app_data;
e2fsck_t ctx;
ctx = (e2fsck_t)fs->priv_data;
if (ctx->flags & 0x1000)
return 0;
if (count > 1) {
p = (const char *)data;
for (i = 0; i < count; i++, p += channel->block_size, block++) {
error = io_channel_write_blk64(channel, block, 1, p);
if (error)
return error;
}
return 0;
}
if (operation)
printf((gettext("Error writing block %lu (%s) while %s. ")), block,
error_message(error), operation);
else
printf((gettext("Error writing block %lu (%s). ")), block,
error_message(error));
preenhalt(ctx);
if (ask(ctx, (gettext("Ignore error")), 1))
return 0;
return error;
} | long long e2fsck_handle_write_error(struct_0 *a0, unsigned long long a1,
unsigned long a2, unsigned long long a3,
unsigned long a4, unsigned long a5,
unsigned long long v7) {
unsigned long v0;
unsigned int v1;
unsigned long long v2;
unsigned int v3;
unsigned long long v4;
struct_1 *v5;
struct_2 *v6;
void *v8;
unsigned long long v9;
unsigned long long v10;
unsigned long long v11;
v2 = a1;
v0 = a4;
v1 = a5;
v5 = a0->field_b0;
v6 = v5->field_e0;
if ((v6->field_48 & 0x1000)) {
v8 = 0;
} else if (a2 > 1) {
v4 = a3;
v3 = 0;
while (true) {
if (v3 < a2) {
v7 = io_channel_write_blk64(a0, v2, 0x1, v4);
if (v7) {
v8 = v7;
break;
} else {
v3 += 1;
v4 += a0->field_18;
v2 += 1;
}
} else {
v8 = 0;
break;
}
}
} else {
if (operation) {
v10 = error_message(v7);
printf(gettext("Error writing block %lu (%s) while %s. "));
} else {
v9 = error_message(v7);
printf(gettext("Error writing block %lu (%s). "));
}
preenhalt(v6);
v11 = gettext("Ignore error");
if (ask(v6, v11, 0x1, v11))
v8 = 0;
else
v8 = v7;
}
return v8;
} | e2fsprogs-1.46.5 | angr_dream |
static int bash_complete_filename_internal(what_to_do)
int what_to_do;
{
rl_compentry_func_t *orig_func;
rl_completion_func_t *orig_attempt_func;
rl_icppfunc_t *orig_dir_func;
rl_compignore_func_t *orig_ignore_func;
const char *orig_rl_completer_word_break_characters;
int r;
orig_func = rl_completion_entry_function;
orig_attempt_func = rl_attempted_completion_function;
orig_ignore_func = rl_ignore_some_completions_function;
orig_rl_completer_word_break_characters = rl_completer_word_break_characters;
orig_dir_func = save_directory_hook();
rl_completion_entry_function = rl_filename_completion_function;
rl_attempted_completion_function = (rl_completion_func_t *)((void *)0);
rl_ignore_some_completions_function = filename_completion_ignore;
rl_completer_word_break_characters = " \t\n\"\'";
r = rl_complete_internal(what_to_do);
rl_completion_entry_function = orig_func;
rl_attempted_completion_function = orig_attempt_func;
rl_ignore_some_completions_function = orig_ignore_func;
rl_completer_word_break_characters = orig_rl_completer_word_break_characters;
restore_directory_hook(orig_dir_func);
return r;
} | void bash_complete_filename_internal(unsigned long a0) {
unsigned int v0;
unsigned long long v1;
unsigned long long v2;
unsigned long long v3;
unsigned long long v4;
unsigned long long v5;
unsigned long long v7;
v1 = rl_completion_entry_function;
v2 = rl_attempted_completion_function;
v3 = rl_ignore_some_completions_function;
v4 = rl_completer_word_break_characters;
v5 = save_directory_hook();
rl_completion_entry_function = got.rl_filename_completion_function;
rl_attempted_completion_function = 0;
rl_ignore_some_completions_function = filename_completion_ignore;
rl_completer_word_break_characters = " \t\n\"\'";
v0 = rl_complete_internal(a0);
rl_completion_entry_function = v1;
rl_attempted_completion_function = v2;
rl_ignore_some_completions_function = v3;
rl_completer_word_break_characters = v4;
restore_directory_hook(v5);
v7 = v0;
return;
} | bash | angr_phoenix |
char *stputs(const char *s, char *p) { return stnputs(s, strlen(s), p); } | long long stputs(void *a0, unsigned long a1) {
return stnputs(a0, strlen(a0), a1);
} | dash-0.5.11+git20210903+057cd650a4ed | angr_dream |
static void add_to_grand_total(struct field_values_t *bv,
struct field_values_t *iv) {
if (known_value(iv->total))
grand_fsu.fsu_files += iv->total;
if (known_value(iv->available))
grand_fsu.fsu_ffree += iv->available;
if (known_value(bv->total))
grand_fsu.fsu_blocks += bv->input_units * bv->total;
if (known_value(bv->available_to_root))
grand_fsu.fsu_bfree += bv->input_units * bv->available_to_root;
if (known_value(bv->available))
add_uint_with_neg_flag(
&grand_fsu.fsu_bavail, &grand_fsu.fsu_bavail_top_bit_set,
bv->input_units * bv->available, bv->negate_available);
} | void add_to_grand_total(struct_0 *a0, unsigned long long a1[4]) {
unsigned long long v2;
if (known_value(a1[2]))
g_404068 = a1[2] + g_404068;
if (known_value(a1[3]))
g_404070 = a1[3] + g_404070;
if (known_value(a0->field_10))
g_404048 = a0->field_0 * a0->field_10 + g_404048;
if (known_value(a0->field_28))
g_404050 = a0->field_0 * a0->field_28 + g_404050;
if (known_value(a0->field_18)) {
v2 = add_uint_with_neg_flag(&g_404058, &g_404060,
a0->field_0 * a0->field_18, a0->field_20);
return;
}
return;
} | coreutils | angr_sailr |
int crlf(void) { return rl_crlf(); } | long long crlf() { return rl_crlf(); } | bash | angr_phoenix |
static char *strgrow(char *old, int len) {
char *new = realloc(old, (strlen(old) + len + 1) * sizeof(char));
if (!new) {
fprintf(stderr, "man2html: out of memory");
exit(1);
}
return new;
} | long long strgrow(void *a0, unsigned long a1) {
unsigned long v0;
v0 = realloc(a0, strlen(a0) + a1 + 1);
if (v0)
return v0;
fprintf(stderr, "man2html: out of memory");
exit(0x1);
} | bash | angr_phoenix |
static void bind_bracketed_paste_prefix(void) {
Keymap xkeymap;
xkeymap = _rl_keymap;
_rl_keymap = emacs_standard_keymap;
rl_bind_keyseq_if_unbound("\033[200~", rl_bracketed_paste_begin);
_rl_keymap = vi_insertion_keymap;
rl_bind_keyseq_if_unbound("\033[200~", rl_bracketed_paste_begin);
_rl_keymap = xkeymap;
} | void bind_bracketed_paste_prefix(void)
{
_rl_keymap = &emacs_standard_keymap;
rl_bind_keyseq_if_unbound(&DAT_001022ba, uRam0000000000101c3a);
} | bash | ghidra |
static void exit_cleanup(void) {
if (temphead) {
struct cs_status cs;
cs_enter(&cs);
cleanup();
cs_leave(&cs);
}
close_stdout();
} | void exit_cleanup(void) {
unsigned char v0[136];
unsigned long v1;
v1 = __readfsqword(0x28u);
if (temphead) {
cs_enter((long)v0);
cleanup();
cs_leave(v0);
}
close_stdout();
} | coreutils | ida |
static int rmmod_do_remove_module(struct kmod_module *mod) {
const char *modname = kmod_module_get_name(mod);
unsigned long long interval_msec = 0, t0_msec = 0, tend_msec = 0;
int flags = 0, err;
_show("rmmod %s\n", modname);
if (dry_run)
return 0;
if (force)
flags |= KMOD_REMOVE_FORCE;
if (wait_msec)
flags |= KMOD_REMOVE_NOLOG;
do {
err = kmod_module_remove_module(mod, flags);
if (err == -17) {
if (!first_time)
err = 0;
else
log_printf(log_priority, "Module %s is not in kernel.\n", modname);
break;
} else if (err == -11 && wait_msec) {
unsigned long long until_msec;
if (!t0_msec) {
t0_msec = now_msec();
tend_msec = t0_msec + wait_msec;
interval_msec = 1;
}
until_msec = get_backoff_delta_msec(t0_msec, tend_msec, &interval_msec);
err = sleep_until_msec(until_msec);
if (!t0_msec)
err = -95;
if (err < 0) {
log_printf(3, "Failed to sleep: %s\n", strerror(-err));
err = -11;
break;
}
} else {
break;
}
} while (interval_msec);
if (err < 0 && wait_msec)
log_printf(3, "could not remove '%s': %s\n", modname, strerror(-err));
return err;
} | long rmmod_do_remove_module(long a1) {
long v1;
long v2;
long v3;
long v4;
char *v6;
char *v7;
unsigned int v8;
int v9;
long v10;
long v11;
long v12;
const char *name;
long backoff_delta_msec;
unsigned long v15;
v15 = __readfsqword(0x28u);
name = (const char *)kmod_module_get_name(a1);
v10 = 0LL;
v11 = 0LL;
v12 = 0LL;
v8 = 0;
show("rmmod %s\n", (long)name, v1, v2, v3, v4);
if (dry_run)
return 0LL;
if (force)
v8 = 512;
if (wait_msec)
v8 |= 1u;
while (1) {
v9 = kmod_module_remove_module(a1, v8);
if (v9 == -17)
break;
if (v9 != -11 || !wait_msec)
goto LABEL_20;
if (!v11) {
v11 = now_msec();
v12 = wait_msec + v11;
v10 = 1LL;
}
backoff_delta_msec = get_backoff_delta_msec(v11, v12, &v10);
v9 = sleep_until_msec(backoff_delta_msec);
if (!v11)
v9 = -95;
if (v9 < 0) {
v6 = strerror(-v9);
log_printf(3LL, "Failed to sleep: %s\n", v6);
v9 = -11;
goto LABEL_20;
}
if (!v10)
goto LABEL_20;
}
if (first_time)
log_printf((unsigned int)log_priority, "Module %s is not in kernel.\n",
name);
else
v9 = 0;
LABEL_20:
if (v9 < 0) {
if (wait_msec) {
v7 = strerror(-v9);
log_printf(3LL, "could not remove '%s': %s\n", name, v7);
}
}
return (unsigned int)v9;
} | kmod | ida |
static void flush_line(void) {
int c;
while ((c = getchar_unlocked()) != '\n' && c != (-1))
continue;
if (ferror_unlocked(stdin))
perror_fatal(gettext("read failed"));
} | int flush_line() {
int result;
char *v1;
int v2;
do
v2 = getchar_unlocked();
while (v2 != 10 && v2 != -1);
result = ferror_unlocked(stdin);
if (result) {
v1 = gettext("read failed");
perror_fatal(v1);
}
return result;
} | diffutils | ida |
static void add_backref_segment(struct transform *tf, size_t ref) {
struct replace_segm *segm = add_segment(tf);
segm->type = segm_backref;
segm->v.ref = ref;
} | _QWORD *add_backref_segment(long a1, long a2) {
_QWORD *result;
result = add_segment(a1);
*((_DWORD *)result + 2) = 1;
result[2] = a2;
return result;
} | tar | ida |
int main(int argc, char **argv) {
int ret;
int i;
char portname[6];
socket_st hd;
_Bool socket_opened = 0;
char app_proto[32] = "";
cmd_parser(argc, argv);
signal(13, ((__sighandler_t)1));
sockets_init();
if (gnutls_global_init() < 0) {
fprintf(stderr, "global state initialization error\n");
exit(1);
}
gnutls_global_set_log_function(tls_log_func);
gnutls_global_set_log_level(debug);
snprintf(portname, sizeof(portname), "%d", port);
if (gnutls_certificate_allocate_credentials(&xcred) < 0) {
fprintf(stderr, "memory error\n");
exit(1);
}
if (gnutls_srp_allocate_client_credentials(&srp_cred) < 0) {
fprintf(stderr, "memory error\n");
exit(1);
}
if (gnutls_anon_allocate_client_credentials(&anon_cred) < 0) {
fprintf(stderr, "memory error\n");
exit(1);
}
if (gnutls_cli_debug_options.present.starttls_proto) {
snprintf(app_proto, sizeof(app_proto), "%s",
gnutls_cli_debug_options.arg.starttls_proto);
}
if (app_proto[0] == 0) {
snprintf(app_proto, sizeof(app_proto), "%s",
port_to_service(portname, "tcp"));
}
sockets_init();
printf("GnuTLS debug client %s\n", gnutls_check_version(((void *)0)));
canonicalize_host(hostname, portname, sizeof(portname));
printf("Checking %s:%s\n", hostname, portname);
for (i = 0; tls_tests[i].test_name != ((void *)0); i++) {
if (strcmp(app_proto, "https") != 0 && tls_tests[i].https_only != 0) {
continue;
}
if (!socket_opened) {
socket_open2(&hd, hostname, portname, app_proto, (1 << 2) | (1 << 3),
((void *)0), ((void *)0), ((void *)0), ((void *)0),
((void *)0));
hd.verbose = verbose;
socket_opened = 1;
}
ret = tls_tests[i].func(hd.session);
if ((ret != TEST_IGNORE && ret != TEST_IGNORE2) || verbose) {
printf("%58s...", tls_tests[i].test_name);
fflush(stdout);
}
if (ret == TEST_SUCCEED) {
if (tls_tests[i].suc_str == ((void *)0))
printf(" %s\n", ext_text);
else
printf(" %s\n", tls_tests[i].suc_str);
} else if (ret == TEST_FAILED)
printf(" %s\n", tls_tests[i].fail_str);
else if (ret == TEST_UNSURE)
printf(" %s\n", tls_tests[i].unsure_str);
else if ((ret == TEST_IGNORE || ret == TEST_IGNORE2) && verbose) {
printf(" skipped\n");
}
if (ret != TEST_IGNORE) {
socket_bye(&hd, 1);
socket_opened = 0;
}
if (ret == TEST_FAILED && tls_tests[i].fatal_failure)
break;
}
gnutls_srp_free_client_credentials(srp_cred);
gnutls_certificate_free_credentials(xcred);
gnutls_anon_free_client_credentials(anon_cred);
gnutls_global_deinit();
return 0;
} | int main(int argc, const char **argv, const char **envp) {
char *v3;
const char *v4;
const char *v5;
long v6;
char v8;
int i;
int v10;
char v11[8];
long v12;
int v13;
char s[6];
char s1[8];
long v16;
long v17;
long v18;
unsigned long v19;
v19 = __readfsqword(0x28u);
v8 = 0;
*(_QWORD *)s1 = 0LL;
v16 = 0LL;
v17 = 0LL;
v18 = 0LL;
cmd_parser(argc, (long)argv);
signal(13, handler);
sockets_init(13LL);
if ((int)gnutls_global_init(13LL) < 0) {
fprintf(stderr, "global state initialization error\n");
exit(1);
}
gnutls_global_set_log_function(tls_log_func);
gnutls_global_set_log_level((unsigned int)debug);
snprintf(s, 6uLL, "%d", (unsigned int)port);
if ((int)gnutls_certificate_allocate_credentials(&xcred) < 0) {
fprintf(stderr, "memory error\n");
exit(1);
}
if ((int)gnutls_srp_allocate_client_credentials(&srp_cred) < 0) {
fprintf(stderr, "memory error\n");
exit(1);
}
v3 = (char *)&anon_cred;
if ((int)gnutls_anon_allocate_client_credentials(&anon_cred) < 0) {
fprintf(stderr, "memory error\n");
exit(1);
}
if (*((_BYTE *)&gnutls_cli_debug_options + 3)) {
v3 = s1;
snprintf(s1, 0x20uLL, "%s",
*((const char **)&gnutls_cli_debug_options + 3));
}
if (!s1[0]) {
v4 = (const char *)port_to_service(s, "tcp");
v3 = s1;
snprintf(s1, 0x20uLL, "%s", v4);
}
sockets_init(v3);
v5 = (const char *)gnutls_check_version(0LL);
printf("GnuTLS debug client %s\n", v5);
canonicalize_host(hostname, s, 6LL);
printf("Checking %s:%s\n", (const char *)hostname, s);
for (i = 0; (&tls_tests)[6 * i]; ++i) {
if (!strcmp(s1, "https") || !*((_DWORD *)&unk_1368 + 12 * i)) {
if (v8 != 1) {
socket_open2(v11, hostname, s, s1, 12LL, 0LL, 0LL, 0LL, 0LL, 0LL);
v13 = verbose;
v8 = 1;
}
v10 = ((long (*)(long)) * (&off_1348 + 6 * i))(v12);
if (v10 != 3 && v10 != 4 || verbose) {
printf("%58s...", (&tls_tests)[6 * i]);
fflush(stdout);
}
if (v10) {
if (v10 == 1) {
printf(" %s\n", off_1358[6 * i]);
} else if (v10 == 2) {
printf(" %s\n", (&off_1360)[6 * i]);
} else if ((v10 == 3 || v10 == 4) && verbose) {
printf(" skipped\n");
}
} else if (off_1350[6 * i]) {
printf(" %s\n", off_1350[6 * i]);
} else {
printf(" %s\n", ext_text);
}
if (v10 != 3) {
socket_bye(v11, 1LL);
v8 = 0;
}
if (v10 == 1 && *((_DWORD *)&unk_136C + 12 * i))
break;
}
}
gnutls_srp_free_client_credentials(srp_cred);
gnutls_certificate_free_credentials(xcred);
v6 = anon_cred;
gnutls_anon_free_client_credentials(anon_cred);
gnutls_global_deinit(v6);
return 0;
} | gnutls | ida |
int sshpkt_putb(struct ssh *ssh, const struct sshbuf *b) {
return sshbuf_putb(ssh->state->outgoing_packet, b);
} | void sshpkt_putb(long *param_1, undefined8 param_2)
{
sshbuf_putb(*(undefined8 *)(*param_1 + 0x30), param_2);
return;
} | openssh-portable | ghidra |
uLong crc32_combine(crc1, crc2, len2)
uLong crc1;
uLong crc2;
off_t len2;
{
return crc32_combine64(crc1, crc2, (off64_t)len2);
} | void crc32_combine(undefined8 param_1, undefined8 param_2, undefined8 param_3)
{
crc32_combine64(param_1, param_2, param_3);
return;
} | zlib | ghidra |
int main(int argc, char *argv[]) {
size_t i;
if (argc < 2) {
fprintf(stderr, "Usage: fstab-decode command [arguments]\n");
return 1;
}
for (i = 2; i < (size_t)argc; i++)
decode(argv[i]);
execvp(argv[1], argv + 1);
fprintf(stderr, "fstab-decode: %s: %s\n", argv[1],
strerror((*__errno_location())));
return 127;
} | undefined8 main(int param_1, long param_2)
{
undefined8 uVar1;
int *piVar2;
char *pcVar3;
ulong local_10;
if (param_1 < 2) {
fprintf(stderr, "Usage: fstab-decode command [arguments]\n");
uVar1 = 1;
} else {
for (local_10 = 2; local_10 < (ulong)(long)param_1;
local_10 = local_10 + 1) {
decode(*(undefined8 *)(param_2 + local_10 * 8));
}
execvp(*(char **)(param_2 + 8), (char **)(param_2 + 8));
piVar2 = __errno_location();
pcVar3 = strerror(*piVar2);
fprintf(stderr, "fstab-decode: %s: %s\n", *(undefined8 *)(param_2 + 8),
pcVar3);
uVar1 = 0x7f;
}
return uVar1;
} | sysvinit | ghidra |
static void version() {
license();
printf("\n");
printf("Written by Jean-loup Gailly.\n");
} | void version(void)
{
license();
printf("\n");
printf("Written by Jean-loup Gailly.\n");
return;
} | gzip-1.12 | ghidra |
static void save_to_hold_area(char *start, idx_t num) {
free(hold_area);
hold_area = start;
hold_count = num;
} | void save_to_hold_area(unsigned long long a0, unsigned long long a1) {
unsigned long long v1;
free(hold_area);
hold_area = a0;
v1 = a1;
hold_count = a1;
return;
} | coreutils | angr_sailr |
void print_cache_nexthop_id(FILE *fp, const char *fp_prefix, const char *jsobj,
__u32 nh_id) {
struct nh_entry *nhe = ipnh_cache_get(nh_id);
if (!nhe) {
nhe = ipnh_cache_add(nh_id);
if (!nhe)
return;
}
if (fp_prefix)
print_string(PRINT_FP, ((void *)0), "%s", fp_prefix);
__print_nexthop_entry(fp, jsobj, nhe, 0);
} | void print_cache_nexthop_id(undefined8 param_1, long param_2,
undefined8 param_3, undefined4 param_4)
{
long local_10;
local_10 = ipnh_cache_get(param_4);
if ((local_10 == 0) && (local_10 = ipnh_cache_add(param_4), local_10 == 0)) {
return;
}
if (param_2 != 0) {
print_string(1, 0, &DAT_00105def, param_2);
}
__print_nexthop_entry(param_1, param_3, local_10, 0);
return;
} | iproute2-6.0.0 | ghidra |
int note_err(const char *, ...) __attribute__((__format__(printf, 1, 2)));
void verifydir(char *);
struct passwd *pwd;
uid_t userid;
int errs, remin, remout, remin2, remout2;
int Tflag, pflag, iamremote, iamrecursive, targetshouldbedirectory;
char cmd[64];
enum scp_mode_e { MODE_SCP, MODE_SFTP }; | long note_err(long a1, long a2, long a3, long a4, long a5, long a6, ...) {
gcc_va_list va;
unsigned long v8;
long v9;
long v10;
long v11;
long v12;
long v13;
v9 = a2;
v10 = a3;
v11 = a4;
v12 = a5;
v13 = a6;
v8 = __readfsqword(0x28u);
if (a1) {
++errs;
if (!emsg_8360) {
va_start(va, a6);
vasnmprintf(&emsg_8360, 0x7FFFFFFFLL, 0LL, a1, va);
}
return 0xFFFFFFFFLL;
} else if (emsg_8360) {
run_err("%s", (long)emsg_8360, a3, a4, a5, a6);
free(emsg_8360);
emsg_8360 = 0LL;
return 0xFFFFFFFFLL;
} else {
return 0LL;
}
} | openssh-portable | ida |
int acl_extended_fd(int fd) {
int base_size = sizeof(acl_ea_header) + 3 * sizeof(acl_ea_entry);
int retval;
retval = fgetxattr(fd, "system.posix_acl_access", ((void *)0), 0);
if (retval < 0 && (*__errno_location()) != 61 && (*__errno_location()) != 61)
return -1;
if (retval > base_size)
return 1;
retval = fgetxattr(fd, "system.posix_acl_default", ((void *)0), 0);
if (retval < 0 && (*__errno_location()) != 61 && (*__errno_location()) != 61)
return -1;
if (retval >= base_size)
return 1;
return 0;
} | undefined8 acl_extended_fd(int param_1)
{
ssize_t sVar1;
int *piVar2;
undefined8 uVar3;
sVar1 = fgetxattr(param_1, "system.posix_acl_access", (void *)0x0, 0);
if ((((int)sVar1 < 0) && (piVar2 = __errno_location(), *piVar2 != 0x3d)) &&
(piVar2 = __errno_location(), *piVar2 != 0x3d)) {
return 0xffffffff;
}
if ((int)sVar1 < 0x1d) {
sVar1 = fgetxattr(param_1, "system.posix_acl_default", (void *)0x0, 0);
if ((((int)sVar1 < 0) && (piVar2 = __errno_location(), *piVar2 != 0x3d)) &&
(piVar2 = __errno_location(), *piVar2 != 0x3d)) {
return 0xffffffff;
}
if ((int)sVar1 < 0x1c) {
uVar3 = 0;
} else {
uVar3 = 1;
}
} else {
uVar3 = 1;
}
return uVar3;
} | acl-2.3.1 | ghidra |
static void process_fsetstat(u_int32_t id) {
Attrib a;
int handle, fd, r;
int status = 0;
if ((r = get_handle(iqueue, &handle)) != 0 ||
(r = decode_attrib(iqueue, &a)) != 0)
sshfatal("sftp-server.c", __func__, 1042, 1, SYSLOG_LEVEL_FATAL, ssh_err(r),
"parse");
sshlog("sftp-server.c", __func__, 1044, 0, SYSLOG_LEVEL_DEBUG1, ((void *)0),
"request %u: fsetstat handle %d", id, handle);
fd = handle_to_fd(handle);
if (fd < 0)
status = 4;
else {
char *name = handle_to_name(handle);
if (a.flags & 0x00000001) {
sshlog("sftp-server.c", __func__, 1052, 0, SYSLOG_LEVEL_INFO, ((void *)0),
"set \"%s\" size %llu", name, (unsigned long long)a.size);
r = ftruncate(fd, a.size);
if (r == -1)
status = errno_to_portable((*__errno_location()));
}
if (a.flags & 0x00000004) {
sshlog("sftp-server.c", __func__, 1059, 0, SYSLOG_LEVEL_INFO, ((void *)0),
"set \"%s\" mode %04o", name, a.perm);
r = fchmod(fd, a.perm & 07777);
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__, 1074, 0, SYSLOG_LEVEL_INFO, ((void *)0),
"set \"%s\" modtime %s", name, buf);
r = futimes(fd, attrib_to_tv(&a));
if (r == -1)
status = errno_to_portable((*__errno_location()));
}
if (a.flags & 0x00000002) {
sshlog("sftp-server.c", __func__, 1084, 0, SYSLOG_LEVEL_INFO, ((void *)0),
"set \"%s\" owner %lu group %lu", name, (u_long)a.uid,
(u_long)a.gid);
r = fchown(fd, a.uid, a.gid);
if (r == -1)
status = errno_to_portable((*__errno_location()));
}
}
send_status(id, status);
} | long long process_fsetstat(unsigned long a0) {
unsigned long long v0;
unsigned int v1;
char v2;
unsigned int v3;
unsigned int v4;
unsigned int v5;
unsigned long v6;
unsigned long v7;
char v8;
char v9;
char v10;
char v11;
char v12;
char v13;
char v14;
unsigned long long v15;
unsigned long v16;
unsigned long v17;
unsigned long v18;
char v19;
v1 = a0;
v4 = 0;
v3 = get_handle(0xe87d894820ec8348, &v2);
if (v3 || (v3 = decode_attrib(0xe87d894820ec8348, &v8, &v8), v3)) {
v0 = "parse";
sshfatal("sftp-server.c", "process_fsetstat", 0x412, 0x1, 0x1, ssh_err(v3));
}
v17 = *(&v2);
v16 = v1;
v15 = "request %u: fsetstat handle %d";
sshlog("sftp-server.c", "process_fsetstat", 0x414, 0x0, 0x5, 0x0, *(&v19));
v5 = handle_to_fd(*(&v2));
if (v5 < 0) {
v4 = 4;
} else {
v7 = handle_to_name(*(&v2));
if ((*(&v8) & 1)) {
v17 = *(&v9);
v16 = v7;
v15 = "set \"%s\" size %llu";
sshlog("sftp-server.c", "process_fsetstat", 0x41c, 0x0, 0x3, 0x0,
*(&v19));
v3 = ftruncate(v5, *(&v9));
if (v3 == -1)
v4 = errno_to_portable(*(__errno_location()));
}
if ((*(&v8) & 4)) {
v17 = *(&v12);
v16 = v7;
v15 = "set \"%s\" mode %04o";
sshlog("sftp-server.c", "process_fsetstat", 0x423, 0x0, 0x3, 0x0,
*(&v19));
v3 = fchmod(v5, *(&v12) & 4095);
if (v3 == -1)
v4 = errno_to_portable(*(__errno_location()));
}
if ((*(&v8) & 8)) {
v6 = *(&v13);
strftime(&v14, 0x40, "%Y%m%d-%H:%M:%S", localtime(&v6));
v17 = &v14;
v16 = v7;
v15 = "set \"%s\" modtime %s";
sshlog("sftp-server.c", "process_fsetstat", 0x432, 0x0, 0x3, 0x0,
*(&v19));
v3 = futimes(v5, attrib_to_tv(&v8));
if (v3 == -1)
v4 = errno_to_portable(*(__errno_location()));
}
if ((*(&v8) & 2)) {
v18 = *(&v11);
v17 = *(&v10);
v16 = v7;
v15 = "set \"%s\" owner %lu group %lu";
sshlog("sftp-server.c", "process_fsetstat", 0x43c, 0x0, 0x3, 0x0,
*(&v19));
v3 = fchown(v5, *(&v10), *(&v11));
if (v3 == -1)
v4 = errno_to_portable(*(__errno_location()));
}
}
send_status(v1, v4);
return 0;
} | openssh-portable | angr_sailr |
void el_deletestr(EditLine *el, int n) {
if (n <= 0)
return;
if (el->el_line.cursor < &el->el_line.buffer[n])
return;
c_delbefore(el, n);
el->el_line.cursor -= n;
if (el->el_line.cursor < el->el_line.buffer)
el->el_line.cursor = el->el_line.buffer;
} | void el_deletestr(long param_1, int param_2)
{
if ((0 < param_2) &&
((ulong)(*(long *)(param_1 + 0x50) + (long)param_2 * 4) <=
*(ulong *)(param_1 + 0x58))) {
c_delbefore(param_1, param_2);
*(long *)(param_1 + 0x58) = (long)param_2 * -4 + *(long *)(param_1 + 0x58);
if (*(ulong *)(param_1 + 0x58) < *(ulong *)(param_1 + 0x50)) {
*(undefined8 *)(param_1 + 0x58) = *(undefined8 *)(param_1 + 0x50);
}
}
return;
} | libedit | ghidra |
void read_error() {
int e = (*__errno_location());
fprintf(stderr, "\n%s: ", program_name);
if (e != 0) {
(*__errno_location()) = e;
perror(ifname);
} else {
fprintf(stderr, "%s: unexpected end of file\n", ifname);
}
abort_gzip();
} | void read_error() {
unsigned int v0;
char v1;
unsigned long long v2;
unsigned int v3;
unsigned int v4;
unsigned long long v5;
unsigned long long v6;
unsigned long long v7;
unsigned long long v8;
unsigned long long v9;
unsigned long long v10;
v0 = *(__errno_location());
v3 = program_name;
fprintf(stderr, "\n%s: ", program_name);
if (!v0) {
v4 = &ifname;
fprintf(stderr, "%s: unexpected end of file\n", &ifname);
} else {
*(__errno_location()) = v0;
perror(&ifname);
}
abort_gzip(v5, v6, v7, v8, v9, v10, *(&v1), v2);
} | gzip-1.12 | angr_phoenix |
static _Bool
major_to_chars(int v, char *p, size_t s) {
return to_chars(v < 0, (uintmax_t)v, sizeof v, 0, p, s, "major_t");
} | int major_to_chars(unsigned long a0, char *a1, unsigned long long a2) {
return to_chars(a0 >> 31, a0, 0x4, 0x0, a1, a2, "major_t");
} | tar | angr_sailr |
long get_clk_tck() {
static long retval = 0;
if (retval != 0)
return (retval);
retval = sysconf(_SC_CLK_TCK);
return (retval);
} | long get_clk_tck(void)
{
if (retval_3359 == 0) {
retval_3359 = sysconf(2);
}
return retval_3359;
} | bash | ghidra |
int unquote_string(char *string) {
int result = 1;
char *source = string;
char *destination = string;
while (*source)
if (*source == '\\')
switch (*++source) {
case '\\':
*destination++ = '\\';
source++;
break;
case 'a':
*destination++ = '\a';
source++;
break;
case 'b':
*destination++ = '\b';
source++;
break;
case 'f':
*destination++ = '\f';
source++;
break;
case 'n':
*destination++ = '\n';
source++;
break;
case 'r':
*destination++ = '\r';
source++;
break;
case 't':
*destination++ = '\t';
source++;
break;
case 'v':
*destination++ = '\v';
source++;
break;
case '?':
*destination++ = 0177;
source++;
break;
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7': {
int value = *source++ - '0';
if (*source < '0' || *source > '7') {
*destination++ = value;
break;
}
value = value * 8 + *source++ - '0';
if (*source < '0' || *source > '7') {
*destination++ = value;
break;
}
value = value * 8 + *source++ - '0';
*destination++ = value;
break;
}
default:
result = 0;
*destination++ = '\\';
if (*source)
*destination++ = *source++;
break;
}
else if (source != destination)
*destination++ = *source++;
else
source++, destination++;
if (source != destination)
*destination = '\0';
return result;
} | long long unquote_string(unsigned long long a0) {
unsigned int v0;
int tmp_15;
int tmp_29;
int tmp_14;
int tmp_10;
unsigned int v1;
char *v2;
char *v3;
char *v5;
char *v7;
char *v8;
char *v9;
char *v10;
char *v11;
char *v12;
char *v13;
char *v14;
char *v15;
char *v17;
char *v19;
char *v21;
char *v23;
v0 = 1;
v2 = a0;
v3 = a0;
while (true) {
switch (*(v2)) {
case 0:
if (v2 != v3) {
*(v3) = 0;
goto LABEL_0x400425;
}
case 92:
v2 += 1;
switch (*(v2)) {
case 48:
case 49:
case 50:
case 51:
case 52:
case 53:
case 54:
case 55:
tmp_15 = v2;
v2 += 1;
v1 = *(tmp_15)-48;
if (*(v2) <= 47 || *(v2) > 55) {
v19 = v3;
v3 += 1;
*(v19) = v1;
break;
} else {
tmp_29 = v2;
v2 += 1;
v1 = *(tmp_29) + (v1 * 8) - 48;
if (*(v2) <= 47 || *(v2) > 55) {
v21 = v3;
v3 += 1;
*(v21) = v1;
break;
} else {
tmp_29 = v2;
v2 += 1;
v1 = *(tmp_29) + (v1 * 8) - 48;
v23 = v3;
v3 += 1;
*(v23) = v1;
break;
}
}
case 63:
v10 = v3;
v3 += 1;
*(v10) = 127;
v2 += 1;
break;
case 92:
v8 = v3;
v3 += 1;
*(v8) = 92;
v2 += 1;
break;
case 97:
v15 = v3;
v3 += 1;
*(v15) = 7;
v2 += 1;
break;
case 98:
v13 = v3;
v3 += 1;
*(v13) = 8;
v2 += 1;
break;
case 102:
v11 = v3;
v3 += 1;
*(v11) = 12;
v2 += 1;
break;
case 110:
v9 = v3;
v3 += 1;
*(v9) = 10;
v2 += 1;
break;
case 114:
v7 = v3;
v3 += 1;
*(v7) = 13;
v2 += 1;
break;
case 116:
v14 = v3;
v3 += 1;
*(v14) = 9;
v2 += 1;
break;
case 118:
v12 = v3;
v3 += 1;
*(v12) = 11;
v2 += 1;
break;
default:
v0 = 0;
tmp_14 = v3;
v3 += 1;
*(tmp_14) = 92;
if (*(v2)) {
tmp_10 = v2;
v2 += 1;
v17 = v3;
v3 += 1;
*(v17) = *(tmp_10);
}
break;
}
break;
default:
if (v2 == v3) {
v2 += 1;
v3 += 1;
break;
} else {
tmp_10 = v2;
v2 += 1;
v5 = v3;
v3 += 1;
*(v5) = *(tmp_10);
break;
}
}
}
return v0;
} | tar | angr_sailr |
static void md5hash_prev_conffile(struct pkginfo *pkg, char *oldhash,
const char *oldname,
struct fsys_namenode *namenode) {
struct pkginfo *otherpkg;
struct conffile *conff;
debug(dbg_conffdetail, "tarobject looking for shared conffile %s",
namenode->name);
for (otherpkg = &pkg->set->pkg; otherpkg; otherpkg = otherpkg->arch_next) {
if (otherpkg == pkg)
continue;
if (otherpkg->status <= PKG_STAT_UNPACKED &&
dpkg_version_compare(&otherpkg->installed.version,
&otherpkg->configversion) != 0)
continue;
for (conff = otherpkg->installed.conffiles; conff; conff = conff->next) {
if (conff->obsolete || conff->remove_on_upgrade)
continue;
if (strcmp(conff->name, namenode->name) == 0)
break;
}
if (conff) {
strcpy(oldhash, conff->hash);
debug(dbg_conffdetail,
"tarobject found shared conffile, from pkg %s (%s); hash=%s",
pkg_name(otherpkg, pnaw_always), pkg_status_name(otherpkg),
oldhash);
break;
}
}
if (otherpkg == ((void *)0)) {
md5hash(pkg, oldhash, oldname);
debug(dbg_conffdetail,
"tarobject found shared conffile, from disk; hash=%s", oldhash);
}
} | void md5hash_prev_conffile(unsigned long long *a0, char *a1,
unsigned long long a2, struct_0 *a3) {
struct_1 *v0;
struct_2 *v1;
unsigned long long v3;
unsigned long long v4;
unsigned long long v5;
unsigned long long v6;
debug(0x80, "tarobject looking for shared conffile %s", a3->field_8, a3);
v3 = *(a0) + 16;
v0 = *(a0) + 16;
while (true) {
if (!v0)
break;
if (v0 != a0 &&
(v0->field_18 > 3 ||
!dpkg_version_compare(&v0->padding_1c[124], &v0->padding_1c[20],
&v0->padding_1c[20]))) {
v1 = v0->field_b0;
while (true) {
if (!v1)
break;
if (!(v1->field_18 || v1->field_19) &&
!strcmp(v1->field_8, a3->field_8))
break;
v1 = v1->field_0;
}
if (v1) {
strcpy(a1, v1->field_10);
v5 = debug(0x80,
"tarobject found shared conffile, from pkg %s (%s); hash=%s",
pkg_name(v0, 0x3), pkg_status_name(v0));
break;
}
}
v4 = v0->field_8;
v0 = v0->field_8;
}
if (!v0) {
md5hash(a0, a1, a2, a1);
v6 = debug(0x80, "tarobject found shared conffile, from disk; hash=%s", a1,
a3);
return;
}
return;
} | dpkg | angr_sailr |
int file_has_acl_at(int fd, char const *file, struct stat const *st) {
;
if (fd == -100 || (((file)[0]) == '/'))
return (file_has_acl(file, st));
{
struct saved_cwd saved_cwd;
int saved_errno;
int err;
{
char proc_buf[((4096) < (4096 - 64) ? (4096) : (4096 - 64))];
char *proc_file = openat_proc_name(proc_buf, fd, file);
if (proc_file) {
int proc_result = (file_has_acl(proc_file, st));
int proc_errno = (*__errno_location());
if (proc_file != proc_buf)
free(proc_file);
if (-1 != proc_result)
return proc_result;
if (!((proc_errno) == 20 || (proc_errno) == 2 || (proc_errno) == 1 ||
(proc_errno) == 13 || (proc_errno) == 38 || (proc_errno) == 95)) {
(*__errno_location()) = proc_errno;
return proc_result;
}
}
}
if (save_cwd(&saved_cwd) != 0)
openat_save_fail((*__errno_location()));
if (0 <= fd && fd == saved_cwd.desc) {
free_cwd(&saved_cwd);
(*__errno_location()) = 9;
return -1;
}
if (fchdir(fd) != 0) {
saved_errno = (*__errno_location());
free_cwd(&saved_cwd);
(*__errno_location()) = saved_errno;
return -1;
}
err = (file_has_acl(file, st));
saved_errno = (err == -1 ? (*__errno_location()) : 0);
if (restore_cwd(&saved_cwd) != 0)
openat_restore_fail((*__errno_location()));
free_cwd(&saved_cwd);
if (saved_errno)
(*__errno_location()) = saved_errno;
return err;
}
} | ulong file_has_acl_at(int param_1, char *param_2, undefined8 param_3)
{
uint uVar1;
int iVar2;
int iVar3;
ulong uVar4;
undefined *__ptr;
int *piVar5;
long in_FS_OFFSET;
int local_fe8[4];
undefined local_fd8[4040];
long local_10;
local_10 = *(long *)(in_FS_OFFSET + 0x28);
if ((param_1 == -100) || (*param_2 == '/')) {
uVar4 = file_has_acl(param_2, param_3);
goto LAB_00100a0f;
}
__ptr = (undefined *)openat_proc_name(local_fd8, param_1, param_2);
if (__ptr != (undefined *)0x0) {
uVar1 = file_has_acl(__ptr, param_3);
piVar5 = __errno_location();
iVar2 = *piVar5;
if (__ptr != local_fd8) {
free(__ptr);
}
if (uVar1 != 0xffffffff) {
uVar4 = (ulong)uVar1;
goto LAB_00100a0f;
}
if (((((iVar2 != 0x14) && (iVar2 != 2)) && (iVar2 != 1)) &&
((iVar2 != 0xd && (iVar2 != 0x26)))) &&
(iVar2 != 0x5f)) {
piVar5 = __errno_location();
*piVar5 = iVar2;
uVar4 = 0xffffffff;
goto LAB_00100a0f;
}
}
iVar2 = save_cwd();
if (iVar2 != 0) {
__errno_location();
openat_save_fail();
}
if ((param_1 < 0) || (param_1 != local_fe8[0])) {
iVar2 = fchdir(param_1);
if (iVar2 == 0) {
uVar1 = file_has_acl(param_2, param_3);
if (uVar1 == 0xffffffff) {
piVar5 = __errno_location();
iVar2 = *piVar5;
} else {
iVar2 = 0;
}
iVar3 = restore_cwd(local_fe8);
if (iVar3 != 0) {
piVar5 = __errno_location();
openat_restore_fail(*piVar5);
}
free_cwd(local_fe8);
if (iVar2 != 0) {
piVar5 = __errno_location();
*piVar5 = iVar2;
}
uVar4 = (ulong)uVar1;
} else {
piVar5 = __errno_location();
iVar2 = *piVar5;
free_cwd(local_fe8);
piVar5 = __errno_location();
*piVar5 = iVar2;
uVar4 = 0xffffffff;
}
} else {
free_cwd(local_fe8);
piVar5 = __errno_location();
*piVar5 = 9;
uVar4 = 0xffffffff;
}
LAB_00100a0f:
if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) {
__stack_chk_fail();
}
return uVar4;
} | tar | ghidra |
static void free_ent(struct fileinfo *f) {
free(f->name);
free(f->linkname);
free(f->absolute_name);
if (f->scontext != UNKNOWN_SECURITY_CONTEXT) {
if (is_smack_enabled())
free(f->scontext);
else
freecon(f->scontext);
}
} | void free_ent(void **a1) {
free(*a1);
free(a1[1]);
free(a1[2]);
if (a1[22] != &UNKNOWN_SECURITY_CONTEXT) {
if ((unsigned char)is_smack_enabled())
free(a1[22]);
else
freecon(a1[22]);
}
} | coreutils | ida |
static void do_ssh2_kex(struct ssh *ssh) {
char *myproposal[PROPOSAL_MAX] = {
"sntrup761x25519-sha512@openssh.com,"
"curve25519-sha256,"
"curve25519-sha256@libssh.org,"
"ecdh-sha2-nistp256,"
"ecdh-sha2-nistp384,"
"ecdh-sha2-nistp521,"
"diffie-hellman-group-exchange-sha256,"
"diffie-hellman-group16-sha512,"
"diffie-hellman-group18-sha512,"
"diffie-hellman-group14-sha256",
"ssh-ed25519-cert-v01@openssh.com,"
"ecdsa-sha2-nistp256-cert-v01@openssh.com,"
"ecdsa-sha2-nistp384-cert-v01@openssh.com,"
"ecdsa-sha2-nistp521-cert-v01@openssh.com,"
"sk-ssh-ed25519-cert-v01@openssh.com,"
"sk-ecdsa-sha2-nistp256-cert-v01@openssh.com,"
"rsa-sha2-512-cert-v01@openssh.com,"
"rsa-sha2-256-cert-v01@openssh.com,"
"ssh-ed25519,"
"ecdsa-sha2-nistp256,"
"ecdsa-sha2-nistp384,"
"ecdsa-sha2-nistp521,"
"sk-ssh-ed25519@openssh.com,"
"sk-ecdsa-sha2-nistp256@openssh.com,"
"rsa-sha2-512,"
"rsa-sha2-256",
"chacha20-poly1305@openssh.com,"
"aes128-ctr,aes192-ctr,aes256-ctr,"
"aes128-gcm@openssh.com,aes256-gcm@openssh.com",
"chacha20-poly1305@openssh.com,"
"aes128-ctr,aes192-ctr,aes256-ctr,"
"aes128-gcm@openssh.com,aes256-gcm@openssh.com",
"umac-64-etm@openssh.com,"
"umac-128-etm@openssh.com,"
"hmac-sha2-256-etm@openssh.com,"
"hmac-sha2-512-etm@openssh.com,"
"hmac-sha1-etm@openssh.com,"
"umac-64@openssh.com,"
"umac-128@openssh.com,"
"hmac-sha2-256,"
"hmac-sha2-512,"
"hmac-sha1",
"umac-64-etm@openssh.com,"
"umac-128-etm@openssh.com,"
"hmac-sha2-256-etm@openssh.com,"
"hmac-sha2-512-etm@openssh.com,"
"hmac-sha1-etm@openssh.com,"
"umac-64@openssh.com,"
"umac-128@openssh.com,"
"hmac-sha2-256,"
"hmac-sha2-512,"
"hmac-sha1",
"none,zlib@openssh.com",
"none,zlib@openssh.com",
"",
""};
struct kex *kex;
char *prop_kex = ((void *)0), *prop_enc = ((void *)0),
*prop_hostkey = ((void *)0);
int r;
myproposal[PROPOSAL_KEX_ALGS] = prop_kex =
compat_kex_proposal(ssh, options.kex_algorithms);
myproposal[PROPOSAL_ENC_ALGS_CTOS] = myproposal[PROPOSAL_ENC_ALGS_STOC] =
prop_enc = compat_cipher_proposal(ssh, options.ciphers);
myproposal[PROPOSAL_MAC_ALGS_CTOS] = myproposal[PROPOSAL_MAC_ALGS_STOC] =
options.macs;
if (options.compression == 0) {
myproposal[PROPOSAL_COMP_ALGS_CTOS] = myproposal[PROPOSAL_COMP_ALGS_STOC] =
"none";
}
if (options.rekey_limit || options.rekey_interval)
ssh_packet_set_rekey_limits(ssh, options.rekey_limit,
options.rekey_interval);
myproposal[PROPOSAL_SERVER_HOST_KEY_ALGS] = prop_hostkey =
compat_pkalg_proposal(ssh, list_hostkey_types());
if ((r = kex_setup(ssh, myproposal)) != 0)
sshfatal("sshd.c", __func__, 2403, 0, SYSLOG_LEVEL_FATAL, ssh_err(r),
"kex_setup");
kex = ssh->kex;
kex->kex[KEX_DH_GRP1_SHA1] = kex_gen_server;
kex->kex[KEX_DH_GRP14_SHA1] = kex_gen_server;
kex->kex[KEX_DH_GRP14_SHA256] = kex_gen_server;
kex->kex[KEX_DH_GRP16_SHA512] = kex_gen_server;
kex->kex[KEX_DH_GRP18_SHA512] = kex_gen_server;
kex->kex[KEX_DH_GEX_SHA1] = kexgex_server;
kex->kex[KEX_DH_GEX_SHA256] = kexgex_server;
kex->kex[KEX_ECDH_SHA2] = kex_gen_server;
kex->kex[KEX_C25519_SHA256] = kex_gen_server;
kex->kex[KEX_KEM_SNTRUP761X25519_SHA512] = kex_gen_server;
kex->load_host_public_key = &get_hostkey_public_by_type;
kex->load_host_private_key = &get_hostkey_private_by_type;
kex->host_key_index = &get_hostkey_index;
kex->sign = sshd_hostkey_sign;
ssh_dispatch_run_fatal(ssh, DISPATCH_BLOCK, &kex->done);
free(prop_kex);
free(prop_enc);
free(prop_hostkey);
sshlog("sshd.c", __func__, 2437, 0, SYSLOG_LEVEL_DEBUG1, ((void *)0),
"KEX done");
} | void do_ssh2_kex(long param_1)
{
undefined8 uVar1;
char **ppcVar2;
long in_FS_OFFSET;
char *pcStack184;
undefined8 uStack176;
undefined auStack168[8];
long local_a0;
int local_8c;
char *local_88;
void *local_80;
void *local_78;
long local_70;
char *local_68;
char *local_60;
char *local_58;
char *local_50;
char *local_48;
char *local_40;
char *local_38;
char *local_30;
undefined *local_28;
undefined *local_20;
long local_10;
ppcVar2 = (char **)auStack168;
local_10 = *(long *)(in_FS_OFFSET + 0x28);
local_68 =
"sntrup761x25519-sha512@openssh.com,curve25519-sha256,curve25519-sha256@"
"libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,"
"diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,"
"diffie-hellman-group18-sha512,diffie-hellman-group14-sha256";
local_60 =
"ssh-ed25519-cert-v01@openssh.com,ecdsa-sha2-nistp256-cert-v01@openssh."
"com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-"
"v01@openssh.com,sk-ssh-ed25519-cert-v01@openssh.com,sk-ecdsa-sha2-"
"nistp256-cert-v01@openssh.com,rsa-sha2-512-cert-v01@openssh.com,rsa-"
"sha2-256-cert-v01@openssh.com,ssh-ed25519,ecdsa-sha2-nistp256,ecdsa-"
"sha2-nistp384,ecdsa-sha2-nistp521,sk-ssh-ed25519@openssh.com,sk-ecdsa-"
"sha2-nistp256@openssh.com,rsa-sha2-512,rsa-sha2-256";
local_58 = "chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,"
"aes128-gcm@openssh.com,aes256-gcm@openssh.com";
local_50 = "chacha20-poly1305@openssh.com,aes128-ctr,aes192-ctr,aes256-ctr,"
"aes128-gcm@openssh.com,aes256-gcm@openssh.com";
local_48 = "umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-"
"etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@"
"openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-"
"256,hmac-sha2-512,hmac-sha1";
local_40 = "umac-64-etm@openssh.com,umac-128-etm@openssh.com,hmac-sha2-256-"
"etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@"
"openssh.com,umac-64@openssh.com,umac-128@openssh.com,hmac-sha2-"
"256,hmac-sha2-512,hmac-sha1";
local_38 = "none,zlib@openssh.com";
local_30 = "none,zlib@openssh.com";
local_28 = &DAT_0010737c;
local_20 = &DAT_0010737c;
local_88 = (char *)0x0;
local_80 = (void *)0x0;
local_78 = (void *)0x0;
uStack176 = 0x106c17;
local_a0 = param_1;
local_88 = (char *)compat_kex_proposal(param_1, options._1224_8_);
uStack176 = 0x106c3c;
local_68 = local_88;
local_80 = (void *)compat_cipher_proposal(local_a0, options._1208_8_);
local_40 = (char *)options._1216_8_;
local_48 = (char *)options._1216_8_;
if (options._1368_4_ == 0) {
local_30 = "none";
local_38 = "none";
}
local_58 = (char *)local_80;
local_50 = (char *)local_80;
if ((options._7808_8_ != 0) || (options._7816_4_ != 0)) {
uStack176 = 0x106cba;
ssh_packet_set_rekey_limits(local_a0, options._7808_8_, options._7816_4_);
}
uStack176 = 0x106cbf;
uVar1 = list_hostkey_types();
uStack176 = 0x106cd4;
local_78 = (void *)compat_pkalg_proposal(local_a0, uVar1);
uStack176 = 0x106cf6;
local_60 = (char *)local_78;
local_8c = kex_setup(local_a0, &local_68);
if (local_8c != 0) {
uStack176 = 0x106d12;
uVar1 = ssh_err(local_8c);
ppcVar2 = &pcStack184;
pcStack184 = "kex_setup";
sshfatal("sshd.c", "do_ssh2_kex", 0x963, 0, 1, uVar1);
}
local_70 = *(long *)(local_a0 + 8);
*(undefined8 *)(local_70 + 200) = uRam0000000000106d63;
*(undefined8 *)(local_70 + 0xd0) = uRam0000000000106d75;
*(undefined8 *)(local_70 + 0xd8) = uRam0000000000106d87;
*(undefined8 *)(local_70 + 0xe0) = uRam0000000000106d99;
*(undefined8 *)(local_70 + 0xe8) = uRam0000000000106dab;
*(undefined8 *)(local_70 + 0xf0) = uRam0000000000106dbd;
*(undefined8 *)(local_70 + 0xf8) = uRam0000000000106dcf;
*(undefined8 *)(local_70 + 0x100) = uRam0000000000106de1;
*(undefined8 *)(local_70 + 0x108) = uRam0000000000106df3;
*(undefined8 *)(local_70 + 0x110) = uRam0000000000106e05;
*(code **)(local_70 + 0xa8) = get_hostkey_public_by_type;
*(code **)(local_70 + 0xb0) = get_hostkey_private_by_type;
*(code **)(local_70 + 0xb8) = get_hostkey_index;
*(code **)(local_70 + 0xc0) = sshd_hostkey_sign;
*(undefined8 *)((long)ppcVar2 + -8) = 0x106e73;
ssh_dispatch_run_fatal(local_a0, 0, local_70 + 0x88);
*(undefined8 *)((long)ppcVar2 + -8) = 0x106e7f;
free(local_88);
*(undefined8 *)((long)ppcVar2 + -8) = 0x106e8b;
free(local_80);
*(undefined8 *)((long)ppcVar2 + -8) = 0x106e97;
free(local_78);
*(char **)((long)ppcVar2 + -0x10) = "KEX done";
*(undefined8 *)((long)ppcVar2 + -0x18) = 0x106ed1;
sshlog("sshd.c", "do_ssh2_kex", 0x985, 0, 5, 0);
if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) {
*(undefined8 *)((long)ppcVar2 + -8) = 0x106eea;
__stack_chk_fail();
}
return;
} | openssh-portable | ghidra |
static inline __u32 rta_getattr_u32(const struct rtattr *rta) {
return *(__u32 *)((
void *)(((char *)(rta)) +
((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0))));
} | int rta_getattr_u32(struct_0 *a0) { return a0->field_4; } | iproute2-6.0.0 | angr_sailr |
int rl_stuff_char(int c) {
char buf[2];
buf[0] = (char)c;
buf[1] = '\0';
el_insertstr(e, buf);
return 1;
} | undefined8 rl_stuff_char(undefined param_1)
{
long in_FS_OFFSET;
undefined local_12;
undefined local_11;
long local_10;
local_10 = *(long *)(in_FS_OFFSET + 0x28);
local_11 = 0;
local_12 = param_1;
el_insertstr(e, &local_12);
if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) {
__stack_chk_fail();
}
return 1;
} | libedit | ghidra |
static void process_flags(int argc, char **argv) {
int c;
int bad_s;
static struct option long_options[] = {{"badname", 0, ((void *)0), 'b'},
{"crypt-method", 1, ((void *)0), 'c'},
{"help", 0, ((void *)0), 'h'},
{"system", 0, ((void *)0), 'r'},
{"root", 1, ((void *)0), 'R'},
{"sha-rounds", 1, ((void *)0), 's'},
{((void *)0), 0, ((void *)0), '\0'}};
while ((c = getopt_long(argc, argv,
"c:bhrs:",
long_options, ((void *)0))) != -1) {
switch (c) {
case 'b':
allow_bad_names = 1;
break;
case 'c':
crypt_method = optarg;
break;
case 'h':
usage(0);
break;
case 'r':
rflg = 1;
break;
case 'R':
break;
case 's':
sflg = 1;
bad_s = 0;
if ((((0 == strcmp(crypt_method, "SHA256")) ||
(0 == strcmp(crypt_method, "SHA512"))) &&
(0 == getlong(optarg, &sha_rounds)))) {
bad_s = 1;
}
if (bad_s != 0) {
fprintf(stderr, gettext("%s: invalid numeric argument '%s'\n"), Prog,
optarg);
usage(1);
}
break;
default:
usage(1);
break;
}
}
if ((optind != argc) && (optind + 1 != argc)) {
usage(1);
}
if (argv[optind] != ((void *)0)) {
if (freopen(argv[optind], "r", stdin) == ((void *)0)) {
char buf[8192];
snprintf(buf, sizeof buf, "%s: %s", Prog, argv[1]);
perror(buf);
fail_exit(1);
}
}
check_flags();
} | void process_flags(unsigned long a0, unsigned long long a1[2]) {
unsigned int v0;
unsigned int v1;
char v2;
char v3;
char v4;
char v5;
unsigned long long *v7;
unsigned long long v8;
v4 = *(&v4);
v3 = *(&v3);
while (true) {
v1 = getopt_long(a0, a1, "c:bhrs:", &long_options.6002, NULL);
if (v1 == -1) {
if (a0 != optind && a0 != optind + 1)
usage(0x1);
if (a1[optind] && !freopen(a1[optind], "r", stdin)) {
snprintf(&v2, 0x2000, "%s: %s", 3968026707, a1[1]);
perror(&v2);
fail_exit(0x1);
}
check_flags();
v8 = *(&v5) ^ v7[5];
break;
} else {
switch (v1) {
case 82:
break;
case 98:
allow_bad_names = 1;
continue;
case 99:
crypt_method = *(&optarg);
continue;
case 104:
usage(0x0);
case 114:
rflg = 1;
continue;
case 115:
sflg = 1;
v0 = 0;
if (strcmp(crypt_method, "SHA256") &&
!(!strcmp(crypt_method, "SHA512")))
goto LABEL_40131e;
if (!getlong(*(&optarg), &sha_rounds))
v0 = 1;
LABEL_40131e:
if (v0) {
fprintf(stderr, gettext("%s: invalid numeric argument '%s'\n"));
usage(0x1);
}
break;
default:
usage(0x1);
}
}
}
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]...\n")
,
program_name);
printf(gettext("Print the first %d lines of each FILE to standard "
"output.\nWith more than one FILE, precede each with a "
"header giving the file name.\n")
,
10);
emit_stdin_note();
emit_mandatory_arg_note();
printf(
gettext(" -c, --bytes=[-]NUM print the first NUM bytes of each "
"file;\n with the leading '-', "
"print all but the last\n NUM "
"bytes of each file\n -n, --lines=[-]NUM print the "
"first NUM lines instead of the first %d;\n "
" with the leading '-', print all but the last\n "
" NUM lines of each file\n")
,
10);
fputs_unlocked(gettext(" -q, --quiet, --silent never print headers "
"giving file names\n -v, --verbose "
"always print headers giving file names\n"),
stdout)
;
fputs_unlocked(
gettext(
" -z, --zero-terminated line delimiter is NUL, not newline\n"),
stdout)
;
fputs_unlocked(gettext(" --help display this help and exit\n"),
stdout);
fputs_unlocked(
gettext(" --version output version information and exit\n"),
stdout);
fputs_unlocked(
gettext("\nNUM may have a multiplier suffix:\nb 512, kB 1000, K 1024, "
"MB 1000*1000, M 1024*1024,\nGB 1000*1000*1000, G "
"1024*1024*1024, and so on for T, P, E, Z, Y.\nBinary prefixes "
"can be used, too: KiB=K, MiB=M, and so on.\n"),
stdout)
;
emit_ancillary_info("head");
}
exit(status);
} | void usage(unsigned long a0) {
unsigned long v0;
unsigned long v2;
v0 = v2;
if (a0) {
fprintf(stderr, gettext("Try '%s --help' for more information.\n"));
} else {
printf(gettext("Usage: %s [OPTION]... [FILE]...\n"));
printf(gettext(
"Print the first %d lines of each FILE to standard output.\nWith more "
"than one FILE, precede each with a header giving the file name.\n"));
emit_stdin_note();
emit_mandatory_arg_note();
printf(gettext(
" -c, --bytes=[-]NUM print the first NUM bytes of each file;\n "
" with the leading '-', print all but the "
"last\n NUM bytes of each file\n -n, "
"--lines=[-]NUM print the first NUM lines instead of the first "
"%d;\n with the leading '-', print all but "
"the last\n NUM lines of each file\n"));
fputs_unlocked(gettext(" -q, --quiet, --silent never print headers "
"giving file names\n -v, --verbose "
"always print headers giving file names\n"),
stdout);
fputs_unlocked(
gettext(
" -z, --zero-terminated line delimiter is NUL, not newline\n"),
stdout);
fputs_unlocked(gettext(" --help display this help and exit\n"),
stdout);
fputs_unlocked(
gettext(" --version output version information and exit\n"),
stdout);
fputs_unlocked(
gettext("\nNUM may have a multiplier suffix:\nb 512, kB 1000, K 1024, "
"MB 1000*1000, M 1024*1024,\nGB 1000*1000*1000, G "
"1024*1024*1024, and so on for T, P, E, Z, Y.\nBinary prefixes "
"can be used, too: KiB=K, MiB=M, and so on.\n"),
stdout);
emit_ancillary_info("head");
}
exit(a0);
} | coreutils | angr_sailr |
gnutls_sec_param_t str_to_sec_param(const char *str) {
if (strcasecmp(str, "low") == 0) {
return GNUTLS_SEC_PARAM_LOW;
} else if (strcasecmp(str, "legacy") == 0) {
return GNUTLS_SEC_PARAM_LEGACY;
} else if (strcasecmp(str, "normal") == 0 || strcasecmp(str, "medium") == 0) {
return GNUTLS_SEC_PARAM_MEDIUM;
} else if (strcasecmp(str, "high") == 0) {
return GNUTLS_SEC_PARAM_HIGH;
} else if (strcasecmp(str, "ultra") == 0) {
return GNUTLS_SEC_PARAM_ULTRA;
} else if (strcasecmp(str, "future") == 0) {
return GNUTLS_SEC_PARAM_FUTURE;
} else {
fprintf(stderr, "Unknown security parameter string: %s\n", str);
app_exit(1);
}
} | int str_to_sec_param(char *a0) {
unsigned int v1;
v1 = strcasecmp(a0, "low");
if (!v1) {
v1 = 25;
} else {
v1 = strcasecmp(a0, "legacy");
if (!v1) {
v1 = 30;
} else {
v1 = strcasecmp(a0, "normal");
if (v1) {
v1 = strcasecmp(a0, "medium");
if (v1) {
v1 = strcasecmp(a0, "high");
if (!v1) {
v1 = 40;
} else {
v1 = strcasecmp(a0, "ultra");
if (!v1) {
v1 = 45;
} else {
v1 = strcasecmp(a0, "future");
if (!v1) {
v1 = 50;
} else {
fprintf(stderr, "Unknown security parameter string: %s\n", a0);
v1 = app_exit(0x1);
}
}
}
}
}
if (!v1 || !v1)
v1 = 35;
}
}
return v1;
} | gnutls | angr_dream |
int acl_add_perm(acl_permset_t permset_d, acl_perm_t perm) {
acl_permset_obj *acl_permset_obj_p =
((acl_permset_obj *)__ext2int_and_check(permset_d, (0x1ED5)));
if (!acl_permset_obj_p || (perm & ~((0x04) | (0x02) | (0x01))))
return -1;
acl_permset_obj_p->i.s_perm |= perm;
return 0;
} | long long acl_add_perm(unsigned long long a0, unsigned long a1) {
struct_0 *v0;
unsigned long long v2;
v0 = __ext2int_and_check(a0, 0x1ed5);
if (!v0) {
v2 = 4294967295;
return v2;
} else if ((a1 & -8)) {
v2 = 4294967295;
return v2;
} else {
v0->field_8 = v0->field_8 | a1;
v2 = 0;
return v2;
}
} | acl-2.3.1 | angr_sailr |
void put_command_name_into_env(command_name) char *command_name;
{
update_export_env_inplace("_=", 2, command_name);
} | long long put_command_name_into_env(void *a0) {
return update_export_env_inplace("_=", 0x2, a0);
} | bash | angr_phoenix |
void copy_set_server_options(ServerOptions *dst, ServerOptions *src,
int preauth) {
do {
if (src->password_authentication != -1)
dst->password_authentication = src->password_authentication;
} while (0);
do {
if (src->gss_authentication != -1)
dst->gss_authentication = src->gss_authentication;
} while (0);
do {
if (src->pubkey_authentication != -1)
dst->pubkey_authentication = src->pubkey_authentication;
} while (0);
do {
if (src->pubkey_auth_options != -1)
dst->pubkey_auth_options = src->pubkey_auth_options;
} while (0);
do {
if (src->kerberos_authentication != -1)
dst->kerberos_authentication = src->kerberos_authentication;
} while (0);
do {
if (src->hostbased_authentication != -1)
dst->hostbased_authentication = src->hostbased_authentication;
} while (0);
do {
if (src->hostbased_uses_name_from_packet_only != -1)
dst->hostbased_uses_name_from_packet_only =
src->hostbased_uses_name_from_packet_only;
} while (0);
do {
if (src->kbd_interactive_authentication != -1)
dst->kbd_interactive_authentication = src->kbd_interactive_authentication;
} while (0);
do {
if (src->permit_root_login != -1)
dst->permit_root_login = src->permit_root_login;
} while (0);
do {
if (src->permit_empty_passwd != -1)
dst->permit_empty_passwd = src->permit_empty_passwd;
} while (0);
do {
if (src->ignore_rhosts != -1)
dst->ignore_rhosts = src->ignore_rhosts;
} while (0);
do {
if (src->allow_tcp_forwarding != -1)
dst->allow_tcp_forwarding = src->allow_tcp_forwarding;
} while (0);
do {
if (src->allow_streamlocal_forwarding != -1)
dst->allow_streamlocal_forwarding = src->allow_streamlocal_forwarding;
} while (0);
do {
if (src->allow_agent_forwarding != -1)
dst->allow_agent_forwarding = src->allow_agent_forwarding;
} while (0);
do {
if (src->disable_forwarding != -1)
dst->disable_forwarding = src->disable_forwarding;
} while (0);
do {
if (src->expose_userauth_info != -1)
dst->expose_userauth_info = src->expose_userauth_info;
} while (0);
do {
if (src->permit_tun != -1)
dst->permit_tun = src->permit_tun;
} while (0);
do {
if (src->fwd_opts.gateway_ports != -1)
dst->fwd_opts.gateway_ports = src->fwd_opts.gateway_ports;
} while (0);
do {
if (src->fwd_opts.streamlocal_bind_unlink != -1)
dst->fwd_opts.streamlocal_bind_unlink =
src->fwd_opts.streamlocal_bind_unlink;
} while (0);
do {
if (src->x11_display_offset != -1)
dst->x11_display_offset = src->x11_display_offset;
} while (0);
do {
if (src->x11_forwarding != -1)
dst->x11_forwarding = src->x11_forwarding;
} while (0);
do {
if (src->x11_use_localhost != -1)
dst->x11_use_localhost = src->x11_use_localhost;
} while (0);
do {
if (src->permit_tty != -1)
dst->permit_tty = src->permit_tty;
} while (0);
do {
if (src->permit_user_rc != -1)
dst->permit_user_rc = src->permit_user_rc;
} while (0);
do {
if (src->max_sessions != -1)
dst->max_sessions = src->max_sessions;
} while (0);
do {
if (src->max_authtries != -1)
dst->max_authtries = src->max_authtries;
} while (0);
do {
if (src->client_alive_count_max != -1)
dst->client_alive_count_max = src->client_alive_count_max;
} while (0);
do {
if (src->client_alive_interval != -1)
dst->client_alive_interval = src->client_alive_interval;
} while (0);
do {
if (src->ip_qos_interactive != -1)
dst->ip_qos_interactive = src->ip_qos_interactive;
} while (0);
do {
if (src->ip_qos_bulk != -1)
dst->ip_qos_bulk = src->ip_qos_bulk;
} while (0);
do {
if (src->rekey_limit != -1)
dst->rekey_limit = src->rekey_limit;
} while (0);
do {
if (src->rekey_interval != -1)
dst->rekey_interval = src->rekey_interval;
} while (0);
do {
if (src->log_level != -1)
dst->log_level = src->log_level;
} while (0);
do {
if (src->required_rsa_size != -1)
dst->required_rsa_size = src->required_rsa_size;
} while (0);
if (src->fwd_opts.streamlocal_bind_mask != (mode_t)-1) {
dst->fwd_opts.streamlocal_bind_mask = src->fwd_opts.streamlocal_bind_mask;
}
do {
do {
if (src->banner != ((void *)0) && dst->banner != src->banner) {
free(dst->banner);
dst->banner = src->banner;
}
} while (0);
do {
if (src->trusted_user_ca_keys != ((void *)0) &&
dst->trusted_user_ca_keys != src->trusted_user_ca_keys) {
free(dst->trusted_user_ca_keys);
dst->trusted_user_ca_keys = src->trusted_user_ca_keys;
}
} while (0);
do {
if (src->revoked_keys_file != ((void *)0) &&
dst->revoked_keys_file != src->revoked_keys_file) {
free(dst->revoked_keys_file);
dst->revoked_keys_file = src->revoked_keys_file;
}
} while (0);
do {
if (src->authorized_keys_command != ((void *)0) &&
dst->authorized_keys_command != src->authorized_keys_command) {
free(dst->authorized_keys_command);
dst->authorized_keys_command = src->authorized_keys_command;
}
} while (0);
do {
if (src->authorized_keys_command_user != ((void *)0) &&
dst->authorized_keys_command_user !=
src->authorized_keys_command_user) {
free(dst->authorized_keys_command_user);
dst->authorized_keys_command_user = src->authorized_keys_command_user;
}
} while (0);
do {
if (src->authorized_principals_file != ((void *)0) &&
dst->authorized_principals_file != src->authorized_principals_file) {
free(dst->authorized_principals_file);
dst->authorized_principals_file = src->authorized_principals_file;
}
} while (0);
do {
if (src->authorized_principals_command != ((void *)0) &&
dst->authorized_principals_command !=
src->authorized_principals_command) {
free(dst->authorized_principals_command);
dst->authorized_principals_command = src->authorized_principals_command;
}
} while (0);
do {
if (src->authorized_principals_command_user != ((void *)0) &&
dst->authorized_principals_command_user !=
src->authorized_principals_command_user) {
free(dst->authorized_principals_command_user);
dst->authorized_principals_command_user =
src->authorized_principals_command_user;
}
} while (0);
do {
if (src->hostbased_accepted_algos != ((void *)0) &&
dst->hostbased_accepted_algos != src->hostbased_accepted_algos) {
free(dst->hostbased_accepted_algos);
dst->hostbased_accepted_algos = src->hostbased_accepted_algos;
}
} while (0);
do {
if (src->pubkey_accepted_algos != ((void *)0) &&
dst->pubkey_accepted_algos != src->pubkey_accepted_algos) {
free(dst->pubkey_accepted_algos);
dst->pubkey_accepted_algos = src->pubkey_accepted_algos;
}
} while (0);
do {
if (src->ca_sign_algorithms != ((void *)0) &&
dst->ca_sign_algorithms != src->ca_sign_algorithms) {
free(dst->ca_sign_algorithms);
dst->ca_sign_algorithms = src->ca_sign_algorithms;
}
} while (0);
do {
if (src->routing_domain != ((void *)0) &&
dst->routing_domain != src->routing_domain) {
free(dst->routing_domain);
dst->routing_domain = src->routing_domain;
}
} while (0);
do {
if (src->permit_user_env_allowlist != ((void *)0) &&
dst->permit_user_env_allowlist != src->permit_user_env_allowlist) {
free(dst->permit_user_env_allowlist);
dst->permit_user_env_allowlist = src->permit_user_env_allowlist;
}
} while (0);
do {
u_int i;
if (src->num_authkeys_files != 0) {
for (i = 0; i < dst->num_authkeys_files; i++)
free(dst->authorized_keys_files[i]);
free(dst->authorized_keys_files);
dst->authorized_keys_files = xcalloc(
src->num_authkeys_files, sizeof(*dst->authorized_keys_files));
for (i = 0; i < src->num_authkeys_files; i++)
dst->authorized_keys_files[i] =
xstrdup(src->authorized_keys_files[i]);
dst->num_authkeys_files = src->num_authkeys_files;
}
} while (0);
do {
u_int i;
if (src->num_allow_users != 0) {
for (i = 0; i < dst->num_allow_users; i++)
free(dst->allow_users[i]);
free(dst->allow_users);
dst->allow_users =
xcalloc(src->num_allow_users, sizeof(*dst->allow_users));
for (i = 0; i < src->num_allow_users; i++)
dst->allow_users[i] = xstrdup(src->allow_users[i]);
dst->num_allow_users = src->num_allow_users;
}
} while (0);
do {
u_int i;
if (src->num_deny_users != 0) {
for (i = 0; i < dst->num_deny_users; i++)
free(dst->deny_users[i]);
free(dst->deny_users);
dst->deny_users =
xcalloc(src->num_deny_users, sizeof(*dst->deny_users));
for (i = 0; i < src->num_deny_users; i++)
dst->deny_users[i] = xstrdup(src->deny_users[i]);
dst->num_deny_users = src->num_deny_users;
}
} while (0);
do {
u_int i;
if (src->num_allow_groups != 0) {
for (i = 0; i < dst->num_allow_groups; i++)
free(dst->allow_groups[i]);
free(dst->allow_groups);
dst->allow_groups =
xcalloc(src->num_allow_groups, sizeof(*dst->allow_groups));
for (i = 0; i < src->num_allow_groups; i++)
dst->allow_groups[i] = xstrdup(src->allow_groups[i]);
dst->num_allow_groups = src->num_allow_groups;
}
} while (0);
do {
u_int i;
if (src->num_deny_groups != 0) {
for (i = 0; i < dst->num_deny_groups; i++)
free(dst->deny_groups[i]);
free(dst->deny_groups);
dst->deny_groups =
xcalloc(src->num_deny_groups, sizeof(*dst->deny_groups));
for (i = 0; i < src->num_deny_groups; i++)
dst->deny_groups[i] = xstrdup(src->deny_groups[i]);
dst->num_deny_groups = src->num_deny_groups;
}
} while (0);
do {
u_int i;
if (src->num_accept_env != 0) {
for (i = 0; i < dst->num_accept_env; i++)
free(dst->accept_env[i]);
free(dst->accept_env);
dst->accept_env =
xcalloc(src->num_accept_env, sizeof(*dst->accept_env));
for (i = 0; i < src->num_accept_env; i++)
dst->accept_env[i] = xstrdup(src->accept_env[i]);
dst->num_accept_env = src->num_accept_env;
}
} while (0);
do {
u_int i;
if (src->num_setenv != 0) {
for (i = 0; i < dst->num_setenv; i++)
free(dst->setenv[i]);
free(dst->setenv);
dst->setenv = xcalloc(src->num_setenv, sizeof(*dst->setenv));
for (i = 0; i < src->num_setenv; i++)
dst->setenv[i] = xstrdup(src->setenv[i]);
dst->num_setenv = src->num_setenv;
}
} while (0);
do {
u_int i;
if (src->num_auth_methods != 0) {
for (i = 0; i < dst->num_auth_methods; i++)
free(dst->auth_methods[i]);
free(dst->auth_methods);
dst->auth_methods =
xcalloc(src->num_auth_methods, sizeof(*dst->auth_methods));
for (i = 0; i < src->num_auth_methods; i++)
dst->auth_methods[i] = xstrdup(src->auth_methods[i]);
dst->num_auth_methods = src->num_auth_methods;
}
} while (0);
do {
u_int i;
if (src->num_permitted_opens != 0) {
for (i = 0; i < dst->num_permitted_opens; i++)
free(dst->permitted_opens[i]);
free(dst->permitted_opens);
dst->permitted_opens =
xcalloc(src->num_permitted_opens, sizeof(*dst->permitted_opens));
for (i = 0; i < src->num_permitted_opens; i++)
dst->permitted_opens[i] = xstrdup(src->permitted_opens[i]);
dst->num_permitted_opens = src->num_permitted_opens;
}
} while (0);
do {
u_int i;
if (src->num_permitted_listens != 0) {
for (i = 0; i < dst->num_permitted_listens; i++)
free(dst->permitted_listens[i]);
free(dst->permitted_listens);
dst->permitted_listens = xcalloc(src->num_permitted_listens,
sizeof(*dst->permitted_listens));
for (i = 0; i < src->num_permitted_listens; i++)
dst->permitted_listens[i] = xstrdup(src->permitted_listens[i]);
dst->num_permitted_listens = src->num_permitted_listens;
}
} while (0);
do {
u_int i;
if (src->num_log_verbose != 0) {
for (i = 0; i < dst->num_log_verbose; i++)
free(dst->log_verbose[i]);
free(dst->log_verbose);
dst->log_verbose =
xcalloc(src->num_log_verbose, sizeof(*dst->log_verbose));
for (i = 0; i < src->num_log_verbose; i++)
dst->log_verbose[i] = xstrdup(src->log_verbose[i]);
dst->num_log_verbose = src->num_log_verbose;
}
} while (0);
} while (0);
assemble_algorithms(dst);
if (preauth)
return;
do {
if (src->adm_forced_command != ((void *)0) &&
dst->adm_forced_command != src->adm_forced_command) {
free(dst->adm_forced_command);
dst->adm_forced_command = src->adm_forced_command;
}
} while (0);
if (option_clear_or_none(dst->adm_forced_command)) {
free(dst->adm_forced_command);
dst->adm_forced_command = ((void *)0);
}
do {
if (src->chroot_directory != ((void *)0) &&
dst->chroot_directory != src->chroot_directory) {
free(dst->chroot_directory);
dst->chroot_directory = src->chroot_directory;
}
} while (0);
if (option_clear_or_none(dst->chroot_directory)) {
free(dst->chroot_directory);
dst->chroot_directory = ((void *)0);
}
} | void copy_set_server_options(long a1, long a2, int a3) {
_QWORD *v3;
_QWORD *v4;
_QWORD *v5;
_QWORD *v6;
_QWORD *v7;
_QWORD *v8;
_QWORD *v9;
_QWORD *v10;
_QWORD *v11;
_QWORD *v12;
_QWORD *v13;
unsigned int i;
unsigned int j;
unsigned int k;
unsigned int m;
unsigned int n;
unsigned int ii;
unsigned int jj;
unsigned int kk;
unsigned int mm;
unsigned int nn;
unsigned int i1;
unsigned int i2;
unsigned int i3;
unsigned int i4;
unsigned int i5;
unsigned int i6;
unsigned int i7;
unsigned int i8;
unsigned int i9;
unsigned int i10;
unsigned int i11;
unsigned int i12;
if (*(_DWORD *)(a2 + 1344) != -1)
*(_DWORD *)(a1 + 1344) = *(_DWORD *)(a2 + 1344);
if (*(_DWORD *)(a2 + 1332) != -1)
*(_DWORD *)(a1 + 1332) = *(_DWORD *)(a2 + 1332);
if (*(_DWORD *)(a2 + 1296) != -1)
*(_DWORD *)(a1 + 1296) = *(_DWORD *)(a2 + 1296);
if (*(_DWORD *)(a2 + 1312) != -1)
*(_DWORD *)(a1 + 1312) = *(_DWORD *)(a2 + 1312);
if (*(_DWORD *)(a2 + 1316) != -1)
*(_DWORD *)(a1 + 1316) = *(_DWORD *)(a2 + 1316);
if (*(_DWORD *)(a2 + 1264) != -1)
*(_DWORD *)(a1 + 1264) = *(_DWORD *)(a2 + 1264);
if (*(_DWORD *)(a2 + 1268) != -1)
*(_DWORD *)(a1 + 1268) = *(_DWORD *)(a2 + 1268);
if (*(_DWORD *)(a2 + 1348) != -1)
*(_DWORD *)(a1 + 1348) = *(_DWORD *)(a2 + 1348);
if (*(_DWORD *)(a2 + 1140) != -1)
*(_DWORD *)(a1 + 1140) = *(_DWORD *)(a2 + 1140);
if (*(_DWORD *)(a2 + 1352) != -1)
*(_DWORD *)(a1 + 1352) = *(_DWORD *)(a2 + 1352);
if (*(_DWORD *)(a2 + 1144) != -1)
*(_DWORD *)(a1 + 1144) = *(_DWORD *)(a2 + 1144);
if (*(_DWORD *)(a2 + 1372) != -1)
*(_DWORD *)(a1 + 1372) = *(_DWORD *)(a2 + 1372);
if (*(_DWORD *)(a2 + 1376) != -1)
*(_DWORD *)(a1 + 1376) = *(_DWORD *)(a2 + 1376);
if (*(_DWORD *)(a2 + 1380) != -1)
*(_DWORD *)(a1 + 1380) = *(_DWORD *)(a2 + 1380);
if (*(_DWORD *)(a2 + 1384) != -1)
*(_DWORD *)(a1 + 1384) = *(_DWORD *)(a2 + 1384);
if (*(_DWORD *)(a2 + 7852) != -1)
*(_DWORD *)(a1 + 7852) = *(_DWORD *)(a2 + 7852);
if (*(_DWORD *)(a2 + 7708) != -1)
*(_DWORD *)(a1 + 7708) = *(_DWORD *)(a2 + 7708);
if (*(_DWORD *)(a2 + 1232) != -1)
*(_DWORD *)(a1 + 1232) = *(_DWORD *)(a2 + 1232);
if (*(_DWORD *)(a2 + 1240) != -1)
*(_DWORD *)(a1 + 1240) = *(_DWORD *)(a2 + 1240);
if (*(_DWORD *)(a2 + 1164) != -1)
*(_DWORD *)(a1 + 1164) = *(_DWORD *)(a2 + 1164);
if (*(_DWORD *)(a2 + 1160) != -1)
*(_DWORD *)(a1 + 1160) = *(_DWORD *)(a2 + 1160);
if (*(_DWORD *)(a2 + 1168) != -1)
*(_DWORD *)(a1 + 1168) = *(_DWORD *)(a2 + 1168);
if (*(_DWORD *)(a2 + 1184) != -1)
*(_DWORD *)(a1 + 1184) = *(_DWORD *)(a2 + 1184);
if (*(_DWORD *)(a2 + 1188) != -1)
*(_DWORD *)(a1 + 1188) = *(_DWORD *)(a2 + 1188);
if (*(_DWORD *)(a2 + 7660) != -1)
*(_DWORD *)(a1 + 7660) = *(_DWORD *)(a2 + 7660);
if (*(_DWORD *)(a2 + 7656) != -1)
*(_DWORD *)(a1 + 7656) = *(_DWORD *)(a2 + 7656);
if (*(_DWORD *)(a2 + 7680) != -1)
*(_DWORD *)(a1 + 7680) = *(_DWORD *)(a2 + 7680);
if (*(_DWORD *)(a2 + 7676) != -1)
*(_DWORD *)(a1 + 7676) = *(_DWORD *)(a2 + 7676);
if (*(_DWORD *)(a2 + 1200) != -1)
*(_DWORD *)(a1 + 1200) = *(_DWORD *)(a2 + 1200);
if (*(_DWORD *)(a2 + 1204) != -1)
*(_DWORD *)(a1 + 1204) = *(_DWORD *)(a2 + 1204);
if (*(_QWORD *)(a2 + 7808) != -1LL)
*(_QWORD *)(a1 + 7808) = *(_QWORD *)(a2 + 7808);
if (*(_DWORD *)(a2 + 7816) != -1)
*(_DWORD *)(a1 + 7816) = *(_DWORD *)(a2 + 7816);
if (*(_DWORD *)(a2 + 1248) != -1)
*(_DWORD *)(a1 + 1248) = *(_DWORD *)(a2 + 1248);
if (*(_DWORD *)(a2 + 7872) != -1)
*(_DWORD *)(a1 + 7872) = *(_DWORD *)(a2 + 7872);
if (*(_DWORD *)(a2 + 1236) != -1)
*(_DWORD *)(a1 + 1236) = *(_DWORD *)(a2 + 1236);
if (*(_QWORD *)(a2 + 7664) &&
*(_QWORD *)(a1 + 7664) != *(_QWORD *)(a2 + 7664)) {
free(*(void **)(a1 + 7664));
*(_QWORD *)(a1 + 7664) = *(_QWORD *)(a2 + 7664);
}
if (*(_QWORD *)(a2 + 7760) &&
*(_QWORD *)(a1 + 7760) != *(_QWORD *)(a2 + 7760)) {
free(*(void **)(a1 + 7760));
*(_QWORD *)(a1 + 7760) = *(_QWORD *)(a2 + 7760);
}
if (*(_QWORD *)(a2 + 7752) &&
*(_QWORD *)(a1 + 7752) != *(_QWORD *)(a2 + 7752)) {
free(*(void **)(a1 + 7752));
*(_QWORD *)(a1 + 7752) = *(_QWORD *)(a2 + 7752);
}
if (*(_QWORD *)(a2 + 7768) &&
*(_QWORD *)(a1 + 7768) != *(_QWORD *)(a2 + 7768)) {
free(*(void **)(a1 + 7768));
*(_QWORD *)(a1 + 7768) = *(_QWORD *)(a2 + 7768);
}
if (*(_QWORD *)(a2 + 7776) &&
*(_QWORD *)(a1 + 7776) != *(_QWORD *)(a2 + 7776)) {
free(*(void **)(a1 + 7776));
*(_QWORD *)(a1 + 7776) = *(_QWORD *)(a2 + 7776);
}
if (*(_QWORD *)(a2 + 7784) &&
*(_QWORD *)(a1 + 7784) != *(_QWORD *)(a2 + 7784)) {
free(*(void **)(a1 + 7784));
*(_QWORD *)(a1 + 7784) = *(_QWORD *)(a2 + 7784);
}
if (*(_QWORD *)(a2 + 7792) &&
*(_QWORD *)(a1 + 7792) != *(_QWORD *)(a2 + 7792)) {
free(*(void **)(a1 + 7792));
*(_QWORD *)(a1 + 7792) = *(_QWORD *)(a2 + 7792);
}
if (*(_QWORD *)(a2 + 7800) &&
*(_QWORD *)(a1 + 7800) != *(_QWORD *)(a2 + 7800)) {
free(*(void **)(a1 + 7800));
*(_QWORD *)(a1 + 7800) = *(_QWORD *)(a2 + 7800);
}
if (*(_QWORD *)(a2 + 1272) &&
*(_QWORD *)(a1 + 1272) != *(_QWORD *)(a2 + 1272)) {
free(*(void **)(a1 + 1272));
*(_QWORD *)(a1 + 1272) = *(_QWORD *)(a2 + 1272);
}
if (*(_QWORD *)(a2 + 1304) &&
*(_QWORD *)(a1 + 1304) != *(_QWORD *)(a2 + 1304)) {
free(*(void **)(a1 + 1304));
*(_QWORD *)(a1 + 1304) = *(_QWORD *)(a2 + 1304);
}
if (*(_QWORD *)(a2 + 1288) &&
*(_QWORD *)(a1 + 1288) != *(_QWORD *)(a2 + 1288)) {
free(*(void **)(a1 + 1288));
*(_QWORD *)(a1 + 1288) = *(_QWORD *)(a2 + 1288);
}
if (*(_QWORD *)(a2 + 1064) &&
*(_QWORD *)(a1 + 1064) != *(_QWORD *)(a2 + 1064)) {
free(*(void **)(a1 + 1064));
*(_QWORD *)(a1 + 1064) = *(_QWORD *)(a2 + 1064);
}
if (*(_QWORD *)(a2 + 1360) &&
*(_QWORD *)(a1 + 1360) != *(_QWORD *)(a2 + 1360)) {
free(*(void **)(a1 + 1360));
*(_QWORD *)(a1 + 1360) = *(_QWORD *)(a2 + 1360);
}
if (*(_DWORD *)(a2 + 7684)) {
for (i = 0; i < *(_DWORD *)(a1 + 7684); ++i)
free(*(void **)(8LL * i + *(_QWORD *)(a1 + 7688)));
free(*(void **)(a1 + 7688));
*(_QWORD *)(a1 + 7688) = xcalloc(*(unsigned int *)(a2 + 7684), 8LL);
for (j = 0; j < *(_DWORD *)(a2 + 7684); ++j) {
v3 = (_QWORD *)(*(_QWORD *)(a1 + 7688) + 8LL * j);
*v3 = xstrdup(*(_QWORD *)(8LL * j + *(_QWORD *)(a2 + 7688)));
}
*(_DWORD *)(a1 + 7684) = *(_DWORD *)(a2 + 7684);
}
if (*(_DWORD *)(a2 + 1388)) {
for (k = 0; k < *(_DWORD *)(a1 + 1388); ++k)
free(*(void **)(8LL * k + *(_QWORD *)(a1 + 1392)));
free(*(void **)(a1 + 1392));
*(_QWORD *)(a1 + 1392) = xcalloc(*(unsigned int *)(a2 + 1388), 8LL);
for (m = 0; m < *(_DWORD *)(a2 + 1388); ++m) {
v4 = (_QWORD *)(*(_QWORD *)(a1 + 1392) + 8LL * m);
*v4 = xstrdup(*(_QWORD *)(8LL * m + *(_QWORD *)(a2 + 1392)));
}
*(_DWORD *)(a1 + 1388) = *(_DWORD *)(a2 + 1388);
}
if (*(_DWORD *)(a2 + 1400)) {
for (n = 0; n < *(_DWORD *)(a1 + 1400); ++n)
free(*(void **)(8LL * n + *(_QWORD *)(a1 + 1408)));
free(*(void **)(a1 + 1408));
*(_QWORD *)(a1 + 1408) = xcalloc(*(unsigned int *)(a2 + 1400), 8LL);
for (ii = 0; ii < *(_DWORD *)(a2 + 1400); ++ii) {
v5 = (_QWORD *)(*(_QWORD *)(a1 + 1408) + 8LL * ii);
*v5 = xstrdup(*(_QWORD *)(8LL * ii + *(_QWORD *)(a2 + 1408)));
}
*(_DWORD *)(a1 + 1400) = *(_DWORD *)(a2 + 1400);
}
if (*(_DWORD *)(a2 + 1416)) {
for (jj = 0; jj < *(_DWORD *)(a1 + 1416); ++jj)
free(*(void **)(8LL * jj + *(_QWORD *)(a1 + 1424)));
free(*(void **)(a1 + 1424));
*(_QWORD *)(a1 + 1424) = xcalloc(*(unsigned int *)(a2 + 1416), 8LL);
for (kk = 0; kk < *(_DWORD *)(a2 + 1416); ++kk) {
v6 = (_QWORD *)(*(_QWORD *)(a1 + 1424) + 8LL * kk);
*v6 = xstrdup(*(_QWORD *)(8LL * kk + *(_QWORD *)(a2 + 1424)));
}
*(_DWORD *)(a1 + 1416) = *(_DWORD *)(a2 + 1416);
}
if (*(_DWORD *)(a2 + 1432)) {
for (mm = 0; mm < *(_DWORD *)(a1 + 1432); ++mm)
free(*(void **)(8LL * mm + *(_QWORD *)(a1 + 1440)));
free(*(void **)(a1 + 1440));
*(_QWORD *)(a1 + 1440) = xcalloc(*(unsigned int *)(a2 + 1432), 8LL);
for (nn = 0; nn < *(_DWORD *)(a2 + 1432); ++nn) {
v7 = (_QWORD *)(*(_QWORD *)(a1 + 1440) + 8LL * nn);
*v7 = xstrdup(*(_QWORD *)(8LL * nn + *(_QWORD *)(a2 + 1440)));
}
*(_DWORD *)(a1 + 1432) = *(_DWORD *)(a2 + 1432);
}
if (*(_DWORD *)(a2 + 7600)) {
for (i1 = 0; i1 < *(_DWORD *)(a1 + 7600); ++i1)
free(*(void **)(8LL * i1 + *(_QWORD *)(a1 + 7608)));
free(*(void **)(a1 + 7608));
*(_QWORD *)(a1 + 7608) = xcalloc(*(unsigned int *)(a2 + 7600), 8LL);
for (i2 = 0; i2 < *(_DWORD *)(a2 + 7600); ++i2) {
v8 = (_QWORD *)(*(_QWORD *)(a1 + 7608) + 8LL * i2);
*v8 = xstrdup(*(_QWORD *)(8LL * i2 + *(_QWORD *)(a2 + 7608)));
}
*(_DWORD *)(a1 + 7600) = *(_DWORD *)(a2 + 7600);
}
if (*(_DWORD *)(a2 + 7616)) {
for (i3 = 0; i3 < *(_DWORD *)(a1 + 7616); ++i3)
free(*(void **)(8LL * i3 + *(_QWORD *)(a1 + 7624)));
free(*(void **)(a1 + 7624));
*(_QWORD *)(a1 + 7624) = xcalloc(*(unsigned int *)(a2 + 7616), 8LL);
for (i4 = 0; i4 < *(_DWORD *)(a2 + 7616); ++i4) {
v9 = (_QWORD *)(*(_QWORD *)(a1 + 7624) + 8LL * i4);
*v9 = xstrdup(*(_QWORD *)(8LL * i4 + *(_QWORD *)(a2 + 7624)));
}
*(_DWORD *)(a1 + 7616) = *(_DWORD *)(a2 + 7616);
}
if (*(_DWORD *)(a2 + 7832)) {
for (i5 = 0; i5 < *(_DWORD *)(a1 + 7832); ++i5)
free(*(void **)(8LL * i5 + *(_QWORD *)(a1 + 7840)));
free(*(void **)(a1 + 7840));
*(_QWORD *)(a1 + 7840) = xcalloc(*(unsigned int *)(a2 + 7832), 8LL);
for (i6 = 0; i6 < *(_DWORD *)(a2 + 7832); ++i6) {
v10 = (_QWORD *)(*(_QWORD *)(a1 + 7840) + 8LL * i6);
*v10 = xstrdup(*(_QWORD *)(8LL * i6 + *(_QWORD *)(a2 + 7840)));
}
*(_DWORD *)(a1 + 7832) = *(_DWORD *)(a2 + 7832);
}
if (*(_DWORD *)(a2 + 7720)) {
for (i7 = 0; i7 < *(_DWORD *)(a1 + 7720); ++i7)
free(*(void **)(8LL * i7 + *(_QWORD *)(a1 + 7712)));
free(*(void **)(a1 + 7712));
*(_QWORD *)(a1 + 7712) = xcalloc(*(unsigned int *)(a2 + 7720), 8LL);
for (i8 = 0; i8 < *(_DWORD *)(a2 + 7720); ++i8) {
v11 = (_QWORD *)(*(_QWORD *)(a1 + 7712) + 8LL * i8);
*v11 = xstrdup(*(_QWORD *)(8LL * i8 + *(_QWORD *)(a2 + 7712)));
}
*(_DWORD *)(a1 + 7720) = *(_DWORD *)(a2 + 7720);
}
if (*(_DWORD *)(a2 + 7736)) {
for (i9 = 0; i9 < *(_DWORD *)(a1 + 7736); ++i9)
free(*(void **)(8LL * i9 + *(_QWORD *)(a1 + 7728)));
free(*(void **)(a1 + 7728));
*(_QWORD *)(a1 + 7728) = xcalloc(*(unsigned int *)(a2 + 7736), 8LL);
for (i10 = 0; i10 < *(_DWORD *)(a2 + 7736); ++i10) {
v12 = (_QWORD *)(*(_QWORD *)(a1 + 7728) + 8LL * i10);
*v12 = xstrdup(*(_QWORD *)(8LL * i10 + *(_QWORD *)(a2 + 7728)));
}
*(_DWORD *)(a1 + 7736) = *(_DWORD *)(a2 + 7736);
}
if (*(_DWORD *)(a2 + 1252)) {
for (i11 = 0; i11 < *(_DWORD *)(a1 + 1252); ++i11)
free(*(void **)(8LL * i11 + *(_QWORD *)(a1 + 1256)));
free(*(void **)(a1 + 1256));
*(_QWORD *)(a1 + 1256) = xcalloc(*(unsigned int *)(a2 + 1252), 8LL);
for (i12 = 0; i12 < *(_DWORD *)(a2 + 1252); ++i12) {
v13 = (_QWORD *)(*(_QWORD *)(a1 + 1256) + 8LL * i12);
*v13 = xstrdup(*(_QWORD *)(8LL * i12 + *(_QWORD *)(a2 + 1256)));
}
*(_DWORD *)(a1 + 1252) = *(_DWORD *)(a2 + 1252);
}
assemble_algorithms(a1);
if (!a3) {
if (*(_QWORD *)(a2 + 7696) &&
*(_QWORD *)(a1 + 7696) != *(_QWORD *)(a2 + 7696)) {
free(*(void **)(a1 + 7696));
*(_QWORD *)(a1 + 7696) = *(_QWORD *)(a2 + 7696);
}
if (option_clear_or_none(*(const char **)(a1 + 7696))) {
free(*(void **)(a1 + 7696));
*(_QWORD *)(a1 + 7696) = 0LL;
}
if (*(_QWORD *)(a2 + 7744) &&
*(_QWORD *)(a1 + 7744) != *(_QWORD *)(a2 + 7744)) {
free(*(void **)(a1 + 7744));
*(_QWORD *)(a1 + 7744) = *(_QWORD *)(a2 + 7744);
}
if (option_clear_or_none(*(const char **)(a1 + 7744))) {
free(*(void **)(a1 + 7744));
*(_QWORD *)(a1 + 7744) = 0LL;
}
}
} | openssh-portable | ida |
static inline int is_basic(char c) {
return (is_basic_table[(unsigned char)c >> 5] >> ((unsigned char)c & 31)) & 1;
} | int is_basic(unsigned long a0) {
return (*((4 * (a0 >> 5) + &is_basic_table)) >> (a0 & 31 & 31)) & 1;
} | bash | angr_dream |
static void do_ca_sign(struct passwd *pw, const char *ca_key_path,
int prefer_agent, unsigned long long cert_serial,
int cert_serial_autoinc, int argc, char **argv) {
int r, i, found, agent_fd = -1;
u_int n;
struct sshkey *ca, *public;
char valid[64], *otmp, *tmp, *cp, *out, *comment;
char *ca_fp = ((void *)0), **plist = ((void *)0), *pin = ((void *)0);
struct ssh_identitylist *agent_ids;
size_t j;
struct notifier_ctx *notifier = ((void *)0);
pkcs11_init(1);
tmp = tilde_expand_filename(ca_key_path, pw->pw_uid);
if (pkcs11provider != ((void *)0)) {
if ((ca = load_pkcs11_key(tmp)) == ((void *)0))
sshfatal("ssh-keygen.c", __func__, 1762, 0, SYSLOG_LEVEL_FATAL,
((void *)0), "No PKCS#11 key matching %s found", ca_key_path);
} else if (prefer_agent) {
if ((r = sshkey_load_public(tmp, &ca, ((void *)0))) != 0)
sshfatal("ssh-keygen.c", __func__, 1770, 0, SYSLOG_LEVEL_FATAL,
ssh_err(r), "Cannot load CA public key %s", tmp);
if ((r = ssh_get_authentication_socket(&agent_fd)) != 0)
sshfatal("ssh-keygen.c", __func__, 1772, 0, SYSLOG_LEVEL_FATAL,
ssh_err(r), "Cannot use public key for CA signature");
if ((r = ssh_fetch_identitylist(agent_fd, &agent_ids)) != 0)
sshfatal("ssh-keygen.c", __func__, 1774, 0, SYSLOG_LEVEL_FATAL,
ssh_err(r), "Retrieve agent key list");
found = 0;
for (j = 0; j < agent_ids->nkeys; j++) {
if (sshkey_equal(ca, agent_ids->keys[j])) {
found = 1;
break;
}
}
if (!found)
sshfatal("ssh-keygen.c", __func__, 1783, 0, SYSLOG_LEVEL_FATAL,
((void *)0), "CA key %s not found in agent", tmp);
ssh_free_identitylist(agent_ids);
ca->flags |= 0x0001;
} else {
ca = load_identity(tmp, ((void *)0));
if (sshkey_is_sk(ca) && (ca->sk_flags & 0x04)) {
if ((pin = read_passphrase("Enter PIN for CA key: ", 0x0002)) ==
((void *)0))
sshfatal("ssh-keygen.c", __func__, 1793, 1, SYSLOG_LEVEL_FATAL,
((void *)0), "couldn't read PIN");
}
}
free(tmp);
if (key_type_name != ((void *)0)) {
if (sshkey_type_from_name(key_type_name) != ca->type) {
sshfatal("ssh-keygen.c", __func__, 1800, 0, SYSLOG_LEVEL_FATAL,
((void *)0), "CA key type %s doesn't match specified %s",
sshkey_ssh_name(ca), key_type_name);
}
} else if (ca->type == KEY_RSA) {
key_type_name = "rsa-sha2-512";
}
ca_fp = sshkey_fingerprint(ca, fingerprint_hash, SSH_FP_DEFAULT);
finalise_cert_exts();
for (i = 0; i < argc; i++) {
n = 0;
if (cert_principals != ((void *)0)) {
otmp = tmp = xstrdup(cert_principals);
plist = ((void *)0);
for (; (cp = strsep(&tmp, ",")) != ((void *)0); n++) {
plist = xreallocarray(plist, n + 1, sizeof(*plist));
if (*(plist[n] = xstrdup(cp)) == '\0')
sshfatal("ssh-keygen.c", __func__, 1819, 0, SYSLOG_LEVEL_FATAL,
((void *)0), "Empty principal name");
}
free(otmp);
}
if (n > 256)
sshfatal("ssh-keygen.c", __func__, 1824, 0, SYSLOG_LEVEL_FATAL,
((void *)0), "Too many certificate principals specified");
tmp = tilde_expand_filename(argv[i], pw->pw_uid);
if ((r = sshkey_load_public(tmp, &public, &comment)) != 0)
sshfatal("ssh-keygen.c", __func__, 1828, 0, SYSLOG_LEVEL_FATAL,
ssh_err(r), "load pubkey \"%s\"", tmp);
if (sshkey_is_cert(public))
sshfatal("ssh-keygen.c", __func__, 1830, 1, SYSLOG_LEVEL_FATAL,
((void *)0), "key \"%s\" type %s cannot be certified", tmp,
sshkey_type(public));
if ((r = sshkey_to_certified(public)) != 0)
sshfatal("ssh-keygen.c", __func__, 1835, 0, SYSLOG_LEVEL_FATAL,
ssh_err(r), "Could not upgrade key %s to certificate", tmp);
public->cert->type = cert_key_type;
public->cert->serial = (u_int64_t)cert_serial;
public->cert->key_id = xstrdup(cert_key_id);
public->cert->nprincipals = n;
public->cert->principals = plist;
public->cert->valid_after = cert_valid_from;
public->cert->valid_before = cert_valid_to;
prepare_options_buf(public->cert->critical, 1);
prepare_options_buf(public->cert->extensions, 2);
if ((r = sshkey_from_private(ca, &public->cert->signature_key)) != 0)
sshfatal("ssh-keygen.c", __func__, 1848, 0, SYSLOG_LEVEL_FATAL,
ssh_err(r), "sshkey_from_private (ca key)");
if (agent_fd != -1 && (ca->flags & 0x0001) != 0) {
if ((r = sshkey_certify_custom(public, ca, key_type_name, sk_provider,
((void *)0), agent_signer, &agent_fd)) !=
0)
sshfatal("ssh-keygen.c", __func__, 1854, 0, SYSLOG_LEVEL_FATAL,
ssh_err(r), "Couldn't certify %s via agent", tmp);
} else {
if (sshkey_is_sk(ca) && (ca->sk_flags & 0x01)) {
notifier = notify_start(0, "Confirm user presence for key %s %s",
sshkey_type(ca), ca_fp);
}
r = sshkey_certify(public, ca, key_type_name, sk_provider, pin);
notify_complete(notifier, "User presence confirmed");
if (r != 0)
sshfatal("ssh-keygen.c", __func__, 1866, 0, SYSLOG_LEVEL_FATAL,
ssh_err(r), "Couldn't certify key %s", tmp);
}
if ((cp = strrchr(tmp, '.')) != ((void *)0) && strcmp(cp, ".pub") == 0)
*cp = '\0';
xasprintf(&out, "%s-cert.pub", tmp);
free(tmp);
if ((r = sshkey_save_public(public, out, comment)) != 0) {
sshfatal("ssh-keygen.c", __func__, 1875, 0, SYSLOG_LEVEL_FATAL,
ssh_err(r), "Unable to save public key to %s", identity_file);
}
if (!quiet) {
sshkey_format_cert_validity(public->cert, valid, sizeof(valid));
sshlog("ssh-keygen.c", __func__, 1882, 0, SYSLOG_LEVEL_INFO, ((void *)0),
"Signed %s key %s: id \"%s\" serial %llu%s%s "
"valid %s",
sshkey_cert_type(public), out, public->cert->key_id,
(unsigned long long)public->cert->serial,
cert_principals != ((void *)0) ? " for " : "",
cert_principals != ((void *)0) ? cert_principals : "", valid)
;
}
sshkey_free(public);
free(out);
if (cert_serial_autoinc)
cert_serial++;
}
if (pin != ((void *)0))
freezero(pin, strlen(pin));
free(ca_fp);
pkcs11_terminate();
exit(0);
} | void do_ca_sign(long param_1, undefined8 param_2, int param_3, long param_4,
int param_5, int param_6, long param_7)
{
char **ppcVar1;
undefined4 uVar2;
long lVar3;
undefined8 uVar4;
void *pvVar5;
int iVar6;
undefined8 uVar7;
undefined8 uVar8;
size_t sVar9;
undefined *puVar10;
char **ppcVar11;
long *plVar12;
undefined *puVar13;
char *pcVar14;
long in_FS_OFFSET;
char *apcStack432[15];
long local_138;
int local_12c;
long local_128;
int local_120;
int local_11c;
undefined8 local_118;
long local_110;
int local_104;
int local_100;
int local_fc;
uint local_f8;
int local_f4;
int *local_f0;
long local_e8;
char *local_e0;
void *local_d8;
undefined8 local_d0;
ulong *local_c8;
long local_c0;
char *local_b8;
ulong local_b0;
undefined8 local_a8;
void *local_a0;
char *local_98;
char *local_90;
undefined local_88[72];
undefined8 local_40;
ppcVar11 = (char **)&local_138;
local_138 = param_7;
local_40 = *(undefined8 *)(in_FS_OFFSET + 0x28);
local_104 = -1;
local_a0 = (void *)0x0;
local_c0 = 0;
local_b8 = (char *)0x0;
local_a8 = 0;
apcStack432[14] = (char *)0x1066c2;
local_12c = param_6;
local_128 = param_4;
local_120 = param_5;
local_11c = param_3;
local_118 = param_2;
local_110 = param_1;
pkcs11_init(1);
apcStack432[14] = (char *)0x1066dd;
local_e0 = (char *)tilde_expand_filename(local_118,
*(undefined4 *)(local_110 + 0x10));
if (pkcs11provider == 0) {
LAB_00106752:
if (local_11c == 0) {
*(undefined8 *)((long)ppcVar11 + -8) = 0x106996;
local_f0 = (int *)load_identity(local_e0, 0);
*(undefined8 *)((long)ppcVar11 + -8) = 0x1069ac;
iVar6 = sshkey_is_sk(local_f0);
plVar12 = (long *)ppcVar11;
if ((iVar6 != 0) && ((*(byte *)(local_f0 + 0x1a) & 4) != 0)) {
*(undefined8 *)((long)ppcVar11 + -8) = 0x1069d6;
local_b8 = (char *)read_passphrase("Enter PIN for CA key: ", 2);
if (local_b8 == (char *)0x0) {
plVar12 = (long *)((long)ppcVar11 + -0x10);
*(char **)((long)ppcVar11 + -0x10) = "couldn\'t read PIN";
*(undefined8 *)((long)ppcVar11 + -0x18) = 0x106a21;
sshfatal("ssh-keygen.c", "do_ca_sign", 0x701, 1, 1, 0);
}
}
} else {
*(undefined8 *)((long)ppcVar11 + -8) = 0x10677d;
local_f4 = sshkey_load_public(local_e0, &local_f0, 0);
pcVar14 = local_e0;
puVar13 = (undefined *)ppcVar11;
if (local_f4 != 0) {
*(undefined8 *)((long)ppcVar11 + -8) = 0x1067a0;
uVar7 = ssh_err(local_f4);
*(char **)((long)ppcVar11 + -8) = pcVar14;
puVar13 = (undefined *)((long)ppcVar11 + -0x10);
*(char **)((long)ppcVar11 + -0x10) = "Cannot load CA public key %s";
*(undefined8 *)((long)ppcVar11 + -0x18) = 0x1067d4;
sshfatal("ssh-keygen.c", "do_ca_sign", 0x6ea, 0, 1, uVar7);
}
*(undefined8 *)(puVar13 + -8) = 0x1067e3;
local_f4 = ssh_get_authentication_socket(&local_104);
puVar10 = puVar13;
if (local_f4 != 0) {
*(undefined8 *)(puVar13 + -8) = 0x1067ff;
uVar7 = ssh_err(local_f4);
puVar10 = puVar13 + -0x10;
*(char **)(puVar13 + -0x10) = "Cannot use public key for CA signature";
*(undefined8 *)(puVar13 + -0x18) = 0x106836;
sshfatal("ssh-keygen.c", "do_ca_sign", 0x6ec, 0, 1, uVar7);
}
*(undefined8 *)(puVar10 + -8) = 0x10684d;
local_f4 = ssh_fetch_identitylist(local_104, &local_c8);
puVar13 = puVar10;
if (local_f4 != 0) {
*(undefined8 *)(puVar10 + -8) = 0x106869;
uVar7 = ssh_err(local_f4);
puVar13 = puVar10 + -0x10;
*(char **)(puVar10 + -0x10) = "Retrieve agent key list";
*(undefined8 *)(puVar10 + -0x18) = 0x1068a0;
sshfatal("ssh-keygen.c", "do_ca_sign", 0x6ee, 0, 1, uVar7);
}
local_fc = 0;
for (local_b0 = 0; local_b0 < *local_c8; local_b0 = local_b0 + 1) {
uVar7 = *(undefined8 *)(local_c8[1] + local_b0 * 8);
*(undefined8 *)(puVar13 + -8) = 0x1068e5;
iVar6 = sshkey_equal(local_f0, uVar7);
if (iVar6 != 0) {
local_fc = 1;
break;
}
}
puVar10 = puVar13;
if (local_fc == 0) {
*(char **)(puVar13 + -8) = local_e0;
puVar10 = puVar13 + -0x10;
*(char **)(puVar13 + -0x10) = "CA key %s not found in agent";
*(undefined8 *)(puVar13 + -0x18) = 0x106957;
sshfatal("ssh-keygen.c", "do_ca_sign", 0x6f7, 0, 1, 0);
}
*(undefined8 *)(puVar10 + -8) = 0x106966;
ssh_free_identitylist(local_c8);
local_f0[1] = local_f0[1] | 1;
plVar12 = (long *)puVar10;
}
} else {
apcStack432[14] = (char *)0x1066ff;
local_f0 = (int *)load_pkcs11_key(local_e0);
plVar12 = &local_138;
if (local_f0 == (int *)0x0) {
apcStack432[14] = (char *)local_118;
ppcVar11 = apcStack432 + 0xd;
apcStack432[13] = "No PKCS#11 key matching %s found";
sshfatal("ssh-keygen.c", "do_ca_sign", 0x6e2, 0, 1, 0);
goto LAB_00106752;
}
}
*(undefined8 *)((long)plVar12 + -8) = 0x106a30;
free(local_e0);
puVar13 = (undefined *)plVar12;
if (key_type_name != (char *)0x0) {
*(undefined8 *)((long)plVar12 + -8) = 0x106a4b;
iVar6 = sshkey_type_from_name(key_type_name);
pcVar14 = key_type_name;
if (iVar6 == *local_f0)
goto LAB_00106ac5;
*(undefined8 *)((long)plVar12 + -8) = 0x106a6e;
uVar7 = sshkey_ssh_name(local_f0);
*(char **)((long)plVar12 + -0x10) = pcVar14;
*(undefined8 *)((long)plVar12 + -0x18) = uVar7;
puVar13 = (undefined *)((long)plVar12 + -0x20);
*(char **)((long)plVar12 + -0x20) =
"CA key type %s doesn\'t match specified %s";
*(undefined8 *)((long)plVar12 + -0x28) = 0x106aaa;
sshfatal("ssh-keygen.c", "do_ca_sign", 0x708, 0, 1, 0);
}
if (*local_f0 == 0) {
key_type_name = "rsa-sha2-512";
}
LAB_00106ac5:
*(undefined8 *)(puVar13 + -8) = 0x106ae1;
local_a0 = (void *)sshkey_fingerprint(local_f0, fingerprint_hash, 0);
*(undefined8 *)(puVar13 + -8) = 0x106aed;
finalise_cert_exts();
local_100 = 0;
do {
if (local_12c <= local_100) {
if (local_b8 != (char *)0x0) {
*(undefined8 *)(puVar13 + -8) = 0x107358;
sVar9 = strlen(local_b8);
*(undefined8 *)(puVar13 + -8) = 0x10736d;
freezero(local_b8, sVar9);
}
*(undefined8 *)(puVar13 + -8) = 0x10737c;
free(local_a0);
*(undefined8 *)(puVar13 + -8) = 0x107381;
pkcs11_terminate();
*(code **)(puVar13 + -8) = parse_relative_time;
exit(0);
}
local_f8 = 0;
if (cert_principals != (undefined *)0x0) {
*(undefined8 *)(puVar13 + -8) = 0x106b25;
local_e0 = (char *)xstrdup(cert_principals);
local_c0 = 0;
local_98 = local_e0;
while (true) {
*(undefined8 *)(puVar13 + -8) = 0x106bff;
local_90 = strsep(&local_e0, ",");
if (local_90 == (char *)0x0)
break;
*(undefined8 *)(puVar13 + -8) = 0x106b6c;
local_c0 = xreallocarray(local_c0, local_f8 + 1, 8);
ppcVar1 = (char **)((ulong)local_f8 * 8 + local_c0);
*(undefined8 *)(puVar13 + -8) = 0x106b9b;
pcVar14 = (char *)xstrdup(local_90);
*ppcVar1 = pcVar14;
puVar10 = puVar13;
if (**ppcVar1 == '\0') {
puVar10 = puVar13 + -0x10;
*(char **)(puVar13 + -0x10) = "Empty principal name";
*(undefined8 *)(puVar13 + -0x18) = 0x106be2;
sshfatal("ssh-keygen.c", "do_ca_sign", 0x71b, 0, 1, 0);
}
local_f8 = local_f8 + 1;
puVar13 = puVar10;
}
*(undefined8 *)(puVar13 + -8) = 0x106c23;
free(local_98);
}
puVar10 = puVar13;
if (0x100 < local_f8) {
puVar10 = puVar13 + -0x10;
*(char **)(puVar13 + -0x10) = "Too many certificate principals specified";
*(undefined8 *)(puVar13 + -0x18) = 0x106c69;
sshfatal("ssh-keygen.c", "do_ca_sign", 0x720, 0, 1, 0);
}
uVar2 = *(undefined4 *)(local_110 + 0x10);
uVar7 = *(undefined8 *)(local_138 + (long)local_100 * 8);
*(undefined8 *)(puVar10 + -8) = 0x106c9a;
local_e0 = (char *)tilde_expand_filename(uVar7, uVar2);
*(undefined8 *)(puVar10 + -8) = 0x106cc1;
local_f4 = sshkey_load_public(local_e0, &local_e8, &local_d0);
pcVar14 = local_e0;
puVar13 = puVar10;
if (local_f4 != 0) {
*(undefined8 *)(puVar10 + -8) = 0x106ce4;
uVar7 = ssh_err(local_f4);
*(char **)(puVar10 + -8) = pcVar14;
puVar13 = puVar10 + -0x10;
*(char **)(puVar10 + -0x10) = "load pubkey \"%s\"";
*(undefined8 *)(puVar10 + -0x18) = 0x106d18;
sshfatal("ssh-keygen.c", "do_ca_sign", 0x724, 0, 1, uVar7);
}
*(undefined8 *)(puVar13 + -8) = 0x106d27;
iVar6 = sshkey_is_cert(local_e8);
puVar10 = puVar13;
if (iVar6 != 0) {
*(undefined8 *)(puVar13 + -8) = 0x106d3a;
uVar7 = sshkey_type(local_e8);
*(undefined8 *)(puVar13 + -0x10) = uVar7;
*(char **)(puVar13 + -0x18) = local_e0;
puVar10 = puVar13 + -0x20;
*(char **)(puVar13 + -0x20) = "key \"%s\" type %s cannot be certified";
*(undefined8 *)(puVar13 + -0x28) = 0x106d7d;
sshfatal("ssh-keygen.c", "do_ca_sign", 0x726, 1, 1, 0);
}
*(undefined8 *)(puVar10 + -8) = 0x106d8c;
local_f4 = sshkey_to_certified(local_e8);
pcVar14 = local_e0;
puVar13 = puVar10;
if (local_f4 != 0) {
*(undefined8 *)(puVar10 + -8) = 0x106daf;
uVar7 = ssh_err(local_f4);
*(char **)(puVar10 + -8) = pcVar14;
puVar13 = puVar10 + -0x10;
*(char **)(puVar10 + -0x10) = "Could not upgrade key %s to certificate";
*(undefined8 *)(puVar10 + -0x18) = 0x106de3;
sshfatal("ssh-keygen.c", "do_ca_sign", 0x72b, 0, 1, uVar7);
}
*(undefined4 *)(*(long *)(local_e8 + 0x80) + 8) = cert_key_type;
*(long *)(*(long *)(local_e8 + 0x80) + 0x10) = local_128;
lVar3 = *(long *)(local_e8 + 0x80);
*(undefined8 *)(puVar13 + -8) = 0x106e30;
uVar7 = xstrdup(cert_key_id);
*(undefined8 *)(lVar3 + 0x18) = uVar7;
*(uint *)(*(long *)(local_e8 + 0x80) + 0x20) = local_f8;
*(long *)(*(long *)(local_e8 + 0x80) + 0x28) = local_c0;
*(undefined8 *)(*(long *)(local_e8 + 0x80) + 0x30) = cert_valid_from;
*(undefined8 *)(*(long *)(local_e8 + 0x80) + 0x38) = cert_valid_to;
uVar7 = *(undefined8 *)(*(long *)(local_e8 + 0x80) + 0x40);
*(undefined8 *)(puVar13 + -8) = 0x106eb5;
prepare_options_buf(uVar7, 1);
uVar7 = *(undefined8 *)(*(long *)(local_e8 + 0x80) + 0x48);
*(undefined8 *)(puVar13 + -8) = 0x106ed4;
prepare_options_buf(uVar7, 2);
lVar3 = *(long *)(local_e8 + 0x80);
*(undefined8 *)(puVar13 + -8) = 0x106ef8;
local_f4 = sshkey_from_private(local_f0, lVar3 + 0x50);
puVar10 = puVar13;
if (local_f4 != 0) {
*(undefined8 *)(puVar13 + -8) = 0x106f14;
uVar7 = ssh_err(local_f4);
puVar10 = puVar13 + -0x10;
*(char **)(puVar13 + -0x10) = "sshkey_from_private (ca key)";
*(undefined8 *)(puVar13 + -0x18) = 0x106f4b;
sshfatal("ssh-keygen.c", "do_ca_sign", 0x738, 0, 1, uVar7);
}
puVar13 = puVar10;
if ((local_104 == -1) || ((local_f0[1] & 1U) == 0)) {
LAB_0010700b:
*(undefined8 *)(puVar13 + -8) = 0x10701a;
iVar6 = sshkey_is_sk(local_f0);
if ((iVar6 != 0) && ((*(byte *)(local_f0 + 0x1a) & 1) != 0)) {
*(undefined8 *)(puVar13 + -8) = 0x107042;
uVar7 = sshkey_type(local_f0);
*(undefined8 *)(puVar13 + -8) = 0x107065;
local_a8 = notify_start(0, "Confirm user presence for key %s %s", uVar7,
local_a0);
}
*(undefined8 *)(puVar13 + -8) = 0x10709a;
local_f4 = sshkey_certify(local_e8, local_f0, key_type_name, sk_provider,
local_b8);
*(undefined8 *)(puVar13 + -8) = 0x1070bb;
notify_complete(local_a8, "User presence confirmed");
pcVar14 = local_e0;
puVar10 = puVar13;
if (local_f4 != 0) {
*(undefined8 *)(puVar13 + -8) = 0x1070d8;
uVar7 = ssh_err(local_f4);
*(char **)(puVar13 + -8) = pcVar14;
puVar10 = puVar13 + -0x10;
*(char **)(puVar13 + -0x10) = "Couldn\'t certify key %s";
*(undefined8 *)(puVar13 + -0x18) = 0x10710c;
sshfatal("ssh-keygen.c", "do_ca_sign", 0x74a, 0, 1, uVar7);
}
} else {
*(int **)(puVar10 + -0x10) = &local_104;
*(undefined8 *)(puVar10 + -0x18) = 0x106fac;
local_f4 = sshkey_certify_custom(local_e8, local_f0, key_type_name,
sk_provider, 0, agent_signer);
pcVar14 = local_e0;
if (local_f4 != 0) {
*(undefined8 *)(puVar10 + -8) = 0x106fd7;
uVar7 = ssh_err(local_f4);
*(char **)(puVar10 + -8) = pcVar14;
puVar13 = puVar10 + -0x10;
*(char **)(puVar10 + -0x10) = "Couldn\'t certify %s via agent";
*(undefined8 *)(puVar10 + -0x18) = 0x10700b;
sshfatal("ssh-keygen.c", "do_ca_sign", 0x73e, 0, 1, uVar7);
goto LAB_0010700b;
}
}
*(undefined8 *)(puVar10 + -8) = 0x107120;
local_90 = strrchr(local_e0, 0x2e);
if (local_90 != (char *)0x0) {
*(undefined8 *)(puVar10 + -8) = 0x107147;
iVar6 = strcmp(local_90, ".pub");
if (iVar6 == 0) {
*local_90 = '\0';
}
}
*(undefined8 *)(puVar10 + -8) = 0x107177;
xasprintf(&local_d8, "%s-cert.pub", local_e0);
*(undefined8 *)(puVar10 + -8) = 0x107186;
free(local_e0);
*(undefined8 *)(puVar10 + -8) = 0x1071a6;
local_f4 = sshkey_save_public(local_e8, local_d8, local_d0);
puVar13 = puVar10;
if (local_f4 != 0) {
*(undefined8 *)(puVar10 + -8) = 0x1071c2;
uVar7 = ssh_err(local_f4);
*(undefined1 **)(puVar10 + -8) = identity_file;
puVar13 = puVar10 + -0x10;
*(char **)(puVar10 + -0x10) = "Unable to save public key to %s";
*(undefined8 *)(puVar10 + -0x18) = 0x1071fd;
sshfatal("ssh-keygen.c", "do_ca_sign", 0x753, 0, 1, uVar7);
}
if (quiet == 0) {
uVar7 = *(undefined8 *)(local_e8 + 0x80);
*(undefined8 *)(puVar13 + -8) = 0x10722d;
sshkey_format_cert_validity(uVar7, local_88, 0x40);
pvVar5 = local_d8;
if (cert_principals == (undefined *)0x0) {
puVar10 = &DAT_00110d75;
pcVar14 = "";
} else {
pcVar14 = " for ";
puVar10 = cert_principals;
}
uVar7 = *(undefined8 *)(*(long *)(local_e8 + 0x80) + 0x10);
uVar4 = *(undefined8 *)(*(long *)(local_e8 + 0x80) + 0x18);
*(undefined8 *)(puVar13 + -8) = 0x10729f;
uVar8 = sshkey_cert_type(local_e8);
*(undefined **)(puVar13 + -8) = local_88;
*(undefined **)(puVar13 + -0x10) = puVar10;
*(char **)(puVar13 + -0x18) = pcVar14;
*(undefined8 *)(puVar13 + -0x20) = uVar7;
*(undefined8 *)(puVar13 + -0x28) = uVar4;
*(void **)(puVar13 + -0x30) = pvVar5;
*(undefined8 *)(puVar13 + -0x38) = uVar8;
*(char **)(puVar13 + -0x40) =
"Signed %s key %s: id \"%s\" serial %llu%s%s valid %s";
*(undefined8 *)(puVar13 + -0x48) = 0x1072e4;
sshlog("ssh-keygen.c", "do_ca_sign", 0x75a, 0, 3, 0);
}
*(undefined8 *)(puVar13 + -8) = 0x1072f7;
sshkey_free(local_e8);
*(undefined8 *)(puVar13 + -8) = 0x107306;
free(local_d8);
if (local_120 != 0) {
local_128 = local_128 + 1;
}
*(undefined8 *)(puVar13 + -8) = 0x107327;
local_100 = __addvsi3(local_100);
} while (true);
} | openssh-portable | ghidra |
void pad_archive(off_t size_left) {
union block *blk;
while (size_left > 0) {
blk = find_next_block();
memset(blk->buffer, 0, 512);
set_next_block_after(blk);
size_left -= 512;
}
} | void pad_archive(unsigned long a0) {
unsigned long v0;
void *v1;
unsigned long long v3;
for (v0 = a0; v0 > 0; v0 -= 0x200) {
v1 = find_next_block();
memset(v1, 0x0, 0x200);
v3 = set_next_block_after(v1);
}
return;
} | tar | angr_dream |
static int try_link(char *dest, void *arg) {
struct link_arg *a = arg;
return linkat(a->srcdir, a->srcname, a->dstdir, dest, a->flags);
} | void try_link(char *param_1, int *param_2)
{
linkat(*param_2, *(char **)(param_2 + 2), param_2[4], param_1, param_2[5]);
return;
} | coreutils | ghidra |
time_t get_expiration_date(void) {
return get_int_date(cfg.expiration_date, cfg.expiration_days,
"The certificate will expire in (days): ");
} | long long get_expiration_date() {
return get_int_date(*((got.cfg + 480)), *((got.cfg + 532)),
"The certificate will expire in (days): ");
} | gnutls | angr_sailr |
HIST_ENTRY *replace_history_entry(int num, const char *line, histdata_t data) {
HIST_ENTRY *he;
HistEvent ev;
int curr_num;
if (h == ((void *)0) || e == ((void *)0))
rl_initialize();
if (history(h, &ev, 8) != 0)
return ((void *)0);
curr_num = ev.num;
if (history(h, &ev, 4) != 0)
return ((void *)0);
if ((he = malloc(sizeof(*he))) == ((void *)0))
return ((void *)0);
if (history(h, &ev, 23, num, &he->data))
goto out;
he->line = strdup(ev.str);
if (he->line == ((void *)0))
goto out;
if (history(h, &ev, 25, line, data))
goto out;
if (history(h, &ev, 7, curr_num))
goto out;
return he;
out:
free(he);
return ((void *)0);
} | void replace_history_entry(void)
{
long in_FS_OFFSET;
undefined local_28[24];
undefined8 local_10;
local_10 = *(undefined8 *)(in_FS_OFFSET + 0x28);
if ((h != 0) && (e != 0)) {
history(h, local_28, 8);
}
rl_initialize();
} | libedit | ghidra |
static char *fingerprint_b64(const char *alg, u_char *dgst_raw,
size_t dgst_raw_len) {
char *ret;
size_t plen = strlen(alg) + 1;
size_t rlen = ((dgst_raw_len + 2) / 3) * 4 + plen + 1;
if (dgst_raw_len > 65536 || (ret = calloc(1, rlen)) == ((void *)0))
return ((void *)0);
strlcpy(ret, alg, rlen);
strlcat(ret, ":", rlen);
if (dgst_raw_len == 0)
return ret;
if (__b64_ntop(dgst_raw, dgst_raw_len, ret + plen, rlen - plen) == -1) {
freezero(ret, rlen);
return ((void *)0);
}
ret[strcspn(ret, "=")] = '\0';
return ret;
} | int fingerprint_b64(char *a0, unsigned long long a1, unsigned long long a2) {
unsigned long v0;
unsigned long v1;
char *v2;
unsigned int v4;
v0 = strlen(a0) + 1;
v1 = v0 + ((a2 + 2) * 12297829382473034411 >> 64 >> 1) * 4 + 1;
if (a2 > 0x10000) {
v4 = 0;
return v4;
}
v2 = calloc(0x1, v1);
if (!v2) {
v4 = 0;
return v4;
}
strlcpy(v2, a0, v1, a0);
strlcat(v2, ":", v1);
if (!a2) {
v4 = v2;
return v4;
} else if (__b64_ntop(a1, a2, &v2[v0], v1 - v0) != -1) {
v2[strcspn(v2, "=")] = 0;
v4 = v2;
return v4;
} else {
freezero(v2, v1);
v4 = 0;
return v4;
}
} | openssh-portable | angr_sailr |
char *timetostr(const time_t time) {
static char s[29];
if (time != 0)
strftime(s, 29, "%a %b %d %T %Y %Z", localtime(&time));
else
s[0] = '\0';
return s;
} | char *timetostr(time_t a1) {
struct tm *v1;
time_t timer;
timer = a1;
if (a1) {
v1 = localtime(&timer);
strftime(&s_4426, 0x1DuLL, "%a %b %d %T %Y %Z", v1);
} else {
s_4426 = 0;
}
return &s_4426;
} | sysvinit | ida |
static void terminal_free_display(EditLine *el) {
terminal_free_buffer(&el->el_display);
terminal_free_buffer(&el->el_vdisplay);
} | void terminal_free_display(unsigned long a0) {
unsigned long long v1;
terminal_free_buffer(a0 + 56);
v1 = terminal_free_buffer(a0 + 64);
return;
} | libedit | angr_phoenix |
static int xfrm_str_to_policy(char *name, uint8_t *policy) {
if (strcmp(name, "block") == 0) {
*policy = 1;
return 0;
} else if (strcmp(name, "accept") == 0) {
*policy = 2;
return 0;
}
return -1;
} | int xfrm_str_to_policy(char *a0, char *a1) {
unsigned int v1;
v1 = strcmp(a0, "block");
if (!v1) {
*(a1) = 1;
v1 = 0;
} else {
v1 = strcmp(a0, "accept");
if (!v1) {
*(a1) = 2;
v1 = 0;
} else {
v1 = -1;
}
}
return v1;
} | iproute2-6.0.0 | angr_dream |
void e2fsck_free_dir_info(e2fsck_t ctx) {
if (ctx->dir_info) {
if (ctx->dir_info->tdb)
ext2fs_tdb_close(ctx->dir_info->tdb);
if (ctx->dir_info->tdb_fn) {
if (unlink(ctx->dir_info->tdb_fn) < 0)
com_err("e2fsck_free_dir_info", (*__errno_location()),
(gettext("while freeing dir_info tdb file")));
ext2fs_free_mem(&ctx->dir_info->tdb_fn);
}
if (ctx->dir_info->array)
ext2fs_free_mem(&ctx->dir_info->array);
ctx->dir_info->array = 0;
ctx->dir_info->size = 0;
ctx->dir_info->count = 0;
ext2fs_free_mem(&ctx->dir_info);
ctx->dir_info = 0;
}
} | long long e2fsck_free_dir_info(struct_0 *a0) {
struct_1 *v1;
v1 = a0->field_230;
if (a0->field_230) {
if (a0->field_230->field_20)
ext2fs_tdb_close(a0->field_230->field_20);
if (a0->field_230->field_18) {
if (unlink(a0->field_230->field_18) < 0)
com_err("e2fsck_free_dir_info", *(__errno_location()),
gettext("while freeing dir_info tdb file"));
ext2fs_free_mem(&a0->field_230->field_18);
}
if (a0->field_230->field_8)
ext2fs_free_mem(&a0->field_230->field_8);
a0->field_230->field_8 = 0;
a0->field_230->field_4 = 0;
a0->field_230->field_0 = 0;
ext2fs_free_mem(&a0->field_230);
v1 = a0;
a0->field_230 = 0;
}
return v1;
} | e2fsprogs-1.46.5 | angr_dream |
static void print_rxsc_list(struct rtattr *sc) {
int rem = ((int)((sc)->rta_len) -
((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0)));
struct rtattr *c;
open_json_array(PRINT_JSON, "rx_sc");
for (c = ((void *)(((char *)(sc)) +
((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0))));
((rem) >= (int)sizeof(struct rtattr) &&
(c)->rta_len >= sizeof(struct rtattr) && (c)->rta_len <= (rem));
c = ((rem) -= ((((c)->rta_len) + 4U - 1) & ~(4U - 1)),
(struct rtattr *)(((char *)(c)) +
((((c)->rta_len) + 4U - 1) & ~(4U - 1))))) {
struct rtattr *sc_attr[MACSEC_RXSC_ATTR_MAX + 1];
open_json_object(((void *)0));
(parse_rtattr_flags(
(sc_attr), (MACSEC_RXSC_ATTR_MAX),
((void *)(((char *)(c)) +
((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0)))),
((int)((c)->rta_len) -
((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0))),
(1 << 15)));
print_rx_sc(" ", rta_getattr_u64(sc_attr[MACSEC_RXSC_ATTR_SCI]),
rta_getattr_u32(sc_attr[MACSEC_RXSC_ATTR_ACTIVE]),
sc_attr[MACSEC_RXSC_ATTR_STATS],
sc_attr[MACSEC_RXSC_ATTR_SA_LIST]);
close_json_object();
}
close_json_array(PRINT_JSON, ((void *)0));
} | void print_rxsc_list(ushort *param_1)
{
undefined8 uVar1;
undefined8 uVar2;
undefined uVar3;
undefined8 uVar4;
long in_FS_OFFSET;
int local_74;
ushort *local_70;
undefined local_68[8];
undefined8 local_60;
undefined8 local_58;
undefined8 local_50;
undefined8 local_48;
long local_30;
local_30 = *(long *)(in_FS_OFFSET + 0x28);
local_74 = *param_1 - 4;
open_json_array(2, "rx_sc");
for (local_70 = param_1 + 2; ((3 < local_74 && (3 < *local_70)) &&
((int)(uint)*local_70 <= local_74));
local_70 =
(ushort *)((long)local_70 + (ulong)(*local_70 + 3 & 0xfffffffc))) {
open_json_object(0);
parse_rtattr_flags(local_68, 5, local_70 + 2, *local_70 - 4, 0x8000);
uVar2 = local_48;
uVar1 = local_50;
uVar3 = rta_getattr_u32(local_58);
uVar4 = rta_getattr_u64(local_60);
print_rx_sc(&DAT_001048f8, uVar4, uVar3, uVar2, uVar1);
close_json_object();
local_74 = local_74 - (*local_70 + 3 & 0xfffffffc);
}
close_json_array(2, 0);
if (local_30 != *(long *)(in_FS_OFFSET + 0x28)) {
__stack_chk_fail();
}
return;
} | iproute2-6.0.0 | ghidra |
_Bool
name_match (const char *file_name)
{
size_t length = strlen(file_name);
while (1) {
struct name *cursor = namelist;
if (!cursor)
return 1;
if (cursor->name[0] == 0) {
chdir_do(cursor->change_dir);
namelist = ((void *)0);
nametail = ((void *)0);
return 1;
}
cursor = namelist_match(file_name, length);
if (starting_file_option) {
if (cursor == namelist)
starting_file_option = 0;
else
cursor = ((void *)0);
}
if (cursor) {
if (!(((file_name[cursor->length]) == '/') && recursion_option) ||
cursor->found_count == 0)
cursor->found_count++;
chdir_do(cursor->change_dir);
return (occurrence_option == 0
? (cursor)->found_count != 0
: (cursor)->found_count == occurrence_option);
}
if (same_order_option && namelist->found_count) {
name_gather();
if (namelist->found_count)
return 0;
} else
return 0;
}
} | long long name_match(char *a0) {
void *v0;
unsigned int v1;
unsigned long long v3;
*(&v1) = strlen(a0);
while (true) {
v0 = namelist;
if (!v0) {
v3 = 1;
return v3;
}
if (!v0->field_10->field_0) {
chdir_do(v0->field_28);
namelist = 0;
nametail = 0;
v3 = 1;
return v3;
}
v0 = namelist_match(a0, *(&v1));
if (starting_file_option) {
if (v0 != namelist)
v0 = 0;
else
starting_file_option = 0;
}
if (v0)
break;
if (!same_order_option) {
v3 = 0;
return v3;
} else if (namelist[48]) {
name_gather();
if (namelist[48]) {
v3 = 0;
return v3;
}
} else {
v3 = 0;
return v3;
}
}
if (a0[v0[24]] != 47 || !recursion_option || !v0[48])
*(&v0[48]) = v0[48] + 1;
chdir_do(v0->field_28);
if (!occurrence_option) {
v3 = v0[48];
*(&v3) = v0[48];
return v3;
}
v3 = occurrence_option;
*(&v3) = v0[48] == occurrence_option;
return v3;
} | tar | angr_sailr |
multiSubmitMsg2(multi_submit_t *const pMultiSub) {
qqueue_t *pQueue;
ruleset_t *pRuleset;
rsRetVal iRet = RS_RET_OK;
if (pMultiSub->nElem == 0)
goto finalize_it;
;
pRuleset = ((pMultiSub->ppMsgs[0])->pRuleset);
pQueue = (pRuleset == ((void *)0)) ? runConf->pMsgQueue
: ruleset.GetRulesetQueue(pRuleset);
if (pQueue == ((void *)0)) {
if (Debug) {
r_dbgprintf("rsyslogd.c", "multiSubmitMsg() could not submit message - "
"queue does (no longer?) exist - ignored\n");
};
goto finalize_it;
;
}
iRet = pQueue->MultiEnq(pQueue, pMultiSub);
pMultiSub->nElem = 0;
finalize_it:
return iRet;
} | int multiSubmitMsg2(struct_0 *a0) {
unsigned int v0;
unsigned long long v1;
struct_2 *v2;
unsigned long long v4;
v0 = 0;
if (!a0->field_2)
return v0;
v1 = *(a0->field_8)->field_100;
if (!v1)
v4 = *((runConf + 808));
else
v4 = g_4044a8(v1);
v2 = v4;
if (v2) {
v0 = v2->field_e0(v2, a0, a0, v2->field_e0);
a0->field_2 = 0;
return v0;
} else if (!Debug) {
return v0;
} else {
r_dbgprintf("rsyslogd.c",
"multiSubmitMsg() could not submit message - queue does (no "
"longer?) exist - ignored\n",
g_4044a8);
return v0;
}
} | rsyslog-8.2210.0 | angr_sailr |
static inline void emit_stdin_note(void) {
fputs_unlocked(
gettext("\nWith no FILE, or when FILE is -, read standard input.\n"),
stdout)
;
} | int emit_stdin_note() {
FILE *v0;
char *v1;
v0 = stdout;
v1 = gettext("\nWith no FILE, or when FILE is -, read standard input.\n");
return fputs_unlocked(v1, v0);
} | coreutils | ida |
const char *subcommand_string(enum subcommand c) {
switch (c) {
case UNKNOWN_SUBCOMMAND:
return "unknown?";
case APPEND_SUBCOMMAND:
return "-r";
case CAT_SUBCOMMAND:
return "-A";
case CREATE_SUBCOMMAND:
return "-c";
case DELETE_SUBCOMMAND:
return "-D";
case DIFF_SUBCOMMAND:
return "-d";
case EXTRACT_SUBCOMMAND:
return "-x";
case LIST_SUBCOMMAND:
return "-t";
case UPDATE_SUBCOMMAND:
return "-u";
case TEST_LABEL_SUBCOMMAND:
return "--test-label";
}
abort();
} | const char *subcommand_string(int a1) {
const char *result;
switch (a1) {
case 0:
result = "unknown?";
break;
case 1:
result = "-r";
break;
case 2:
result = "-A";
break;
case 3:
result = "-c";
break;
case 4:
result = "-D";
break;
case 5:
result = "-d";
break;
case 6:
result = "-x";
break;
case 7:
result = "-t";
break;
case 8:
result = "-u";
break;
case 9:
result = "--test-label";
break;
default:
abort();
}
return result;
} | tar | ida |
static char **do_setup_env(struct ssh *ssh, Session *s, const char *shell) {
char buf[256];
size_t n;
u_int i, envsize;
char *ocp, *cp, *value, **env, *laddr;
struct passwd *pw = s->pw;
char *path = ((void *)0);
envsize = 100;
env = xcalloc(envsize, sizeof(char *));
env[0] = ((void *)0);
for (i = 0; i < s->num_env; i++)
child_set_env(&env, &envsize, s->env[i].name, s->env[i].val);
child_set_env(&env, &envsize, "USER", pw->pw_name);
child_set_env(&env, &envsize, "LOGNAME", pw->pw_name);
child_set_env(&env, &envsize, "HOME", pw->pw_dir);
if (path == ((void *)0) || *path == '\0') {
child_set_env(&env, &envsize, "PATH",
s->pw->pw_uid == 0
? "/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin"
: "/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin");
}
if (!options.use_pam) {
snprintf(buf, sizeof buf, "%.200s/%.50s",
"/var/mail", pw->pw_name);
child_set_env(&env, &envsize, "MAIL", buf);
}
child_set_env(&env, &envsize, "SHELL", shell);
if (getenv("TZ"))
child_set_env(&env, &envsize, "TZ", getenv("TZ"));
if (s->term)
child_set_env(&env, &envsize, "TERM", s->term);
if (s->display)
child_set_env(&env, &envsize, "DISPLAY", s->display);
{
char *cp;
if ((cp = getenv("KRB5CCNAME")) != ((void *)0))
child_set_env(&env, &envsize, "KRB5CCNAME", cp);
}
if (auth_sock_name != ((void *)0))
child_set_env(&env, &envsize, "SSH_AUTH_SOCK", auth_sock_name);
if (options.permit_user_env) {
for (n = 0; n < auth_opts->nenv; n++) {
ocp = xstrdup(auth_opts->env[n]);
cp = strchr(ocp, '=');
if (cp != ((void *)0)) {
*cp = '\0';
if (options.permit_user_env_allowlist == ((void *)0) ||
match_pattern_list(ocp, options.permit_user_env_allowlist, 0) == 1)
child_set_env(&env, &envsize, ocp, cp + 1);
}
free(ocp);
}
}
if (options.permit_user_env) {
snprintf(buf, sizeof buf, "%.200s/%s/environment", pw->pw_dir, ".ssh");
read_environment_file(&env, &envsize, buf,
options.permit_user_env_allowlist);
}
for (i = 0; i < options.num_setenv; i++) {
cp = xstrdup(options.setenv[i]);
if ((value = strchr(cp, '=')) == ((void *)0)) {
sshfatal("session.c", __func__, 1158, 0, SYSLOG_LEVEL_FATAL, ((void *)0),
"Invalid config SetEnv: %s", options.setenv[i]);
}
*value++ = '\0';
child_set_env(&env, &envsize, cp, value);
}
snprintf(buf, sizeof buf, "%.50s %d %d", ssh_remote_ipaddr(ssh),
ssh_remote_port(ssh), ssh_local_port(ssh));
child_set_env(&env, &envsize, "SSH_CLIENT", buf);
laddr = get_local_ipaddr(ssh_packet_get_connection_in(ssh));
snprintf(buf, sizeof buf, "%.50s %d %.50s %d", ssh_remote_ipaddr(ssh),
ssh_remote_port(ssh), laddr, ssh_local_port(ssh));
free(laddr);
child_set_env(&env, &envsize, "SSH_CONNECTION", buf);
if (tun_fwd_ifnames != ((void *)0))
child_set_env(&env, &envsize, "SSH_TUNNEL", tun_fwd_ifnames);
if (auth_info_file != ((void *)0))
child_set_env(&env, &envsize, "SSH_USER_AUTH", auth_info_file);
if (s->ttyfd != -1)
child_set_env(&env, &envsize, "SSH_TTY", s->tty);
if (original_command)
child_set_env(&env, &envsize, "SSH_ORIGINAL_COMMAND", original_command);
if (debug_flag) {
fprintf(stderr, "Environment:\n");
for (i = 0; env[i]; i++)
fprintf(stderr, " %.200s\n", env[i]);
}
return env;
} | int do_setup_env(unsigned long long a0, struct_0 *a1, unsigned long long a2) {
unsigned int v0;
int tmp_12;
unsigned int v1;
unsigned long long *v2;
void *v3;
unsigned long long v4[5];
void *v5;
unsigned long long v6;
void *v7;
char *v8;
void *v9;
unsigned long long v10;
char v11;
unsigned long v12;
unsigned long v13;
char v14;
v4[0] = a1->field_10;
v5 = 0;
v0 = 100;
v2 = xcalloc(v0, 0x8);
*(v2) = 0;
for (v1 = 0; v1 < a1->field_d8; v1 += 1) {
child_set_env(&v2, &v0, *((a1->field_e0 + v1 * 16)),
*((a1->field_e0 + v1 * 16 + 8)));
}
child_set_env(&v2, &v0, "USER", v4[0]);
child_set_env(&v2, &v0, "LOGNAME", v4[0]);
child_set_env(&v2, &v0, "HOME", v4[4]);
if (v5 && !(!*(v5)))
goto LABEL_401d9b;
child_set_env(&v2, &v0, "PATH",
"/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin");
LABEL_401d9b:
if (!*(5250776)) {
snprintf(&v11, 0x100, "%.200s/%.50s", &g_40799a, v4[0]);
child_set_env(&v2, &v0, "MAIL", &v11);
}
child_set_env(&v2, &v0, "SHELL", a2);
if (getenv("TZ"))
child_set_env(&v2, &v0, "TZ", getenv("TZ"));
if (a1->field_28)
child_set_env(&v2, &v0, "TERM", a1->field_28);
if (a1->field_90)
child_set_env(&v2, &v0, "DISPLAY", a1->field_90);
v6 = getenv("KRB5CCNAME");
if (v6)
child_set_env(&v2, &v0, "KRB5CCNAME", v6);
if (auth_sock_name)
child_set_env(&v2, &v0, "SSH_AUTH_SOCK", auth_sock_name);
if (g_50060c) {
v3 = 0;
while (true) {
if (v3 >= *((auth_opts + 64)))
break;
v7 = xstrdup(*((*((auth_opts + 72)) + v3 * 8)));
v8 = strchr(v7, 0x3d);
if (v8) {
*(v8) = 0;
if (g_500610 && !(match_pattern_list(v7, g_500610, 0x0, g_500610) == 1))
goto LABEL_402029;
child_set_env(&v2, &v0, v7, v8 + 1);
}
LABEL_402029:
free(v7);
v3 += 1;
}
}
if (g_50060c) {
snprintf(&v11, 0x100, "%.200s/%s/environment", v4[4], &g_4079e5);
read_environment_file(&v2, &v0, &v11, g_500610);
}
for (v1 = 0; v1 < *(5250688); v1 += 1) {
v8 = xstrdup(*((*(5250696) + v1 * 8)));
v10 = strchr(v8, 0x3d);
if (!v10) {
v13 = *((*(5250696) + v1 * 8));
v12 = "Invalid config SetEnv: %s";
sshfatal("session.c", "do_setup_env", 0x486, 0x0, 0x1, 0x0);
}
tmp_12 = v10;
v10 += 1;
*(tmp_12) = 0;
child_set_env(&v2, &v0, v8, v10);
}
snprintf(&v11, 0x100, "%.50s %d %d", ssh_remote_ipaddr(a0),
ssh_remote_port(a0), ssh_local_port(a0));
child_set_env(&v2, &v0, "SSH_CLIENT", &v11);
v9 = get_local_ipaddr(ssh_packet_get_connection_in(a0));
v12 = ssh_local_port(a0);
snprintf(&v11, 0x100, "%.50s %d %.50s %d", ssh_remote_ipaddr(a0),
ssh_remote_port(a0), v9, *(&v14));
free(v9);
child_set_env(&v2, &v0, "SSH_CONNECTION", &v11);
if (tun_fwd_ifnames)
child_set_env(&v2, &v0, "SSH_TUNNEL", tun_fwd_ifnames);
if (auth_info_file)
child_set_env(&v2, &v0, "SSH_USER_AUTH", auth_info_file);
if (a1->field_34 != -1)
child_set_env(&v2, &v0, "SSH_TTY", &a1->padding_38[20]);
if (original_command)
child_set_env(&v2, &v0, "SSH_ORIGINAL_COMMAND", original_command);
if (debug_flag) {
fprintf(stderr, "Environment:\n");
for (v1 = 0; v2[v1]; v1 += 1) {
fprintf(stderr, " %.200s\n", v2[v1]);
}
}
return v2;
} | openssh-portable | angr_phoenix |
static const char *parse_awaiter_package(void) {
struct dpkg_error err = {DPKG_MSG_NONE, 0, ((void *)0)};
struct pkginfo *pkg;
if (!f_await)
bypackage = "-";
if (bypackage == ((void *)0)) {
const char *pkgname, *archname;
pkgname = getenv("DPKG_MAINTSCRIPT_PACKAGE");
archname = getenv("DPKG_MAINTSCRIPT_ARCH");
if (pkgname == ((void *)0) || archname == ((void *)0))
badusage(gettext("must be called from a maintainer script"
" (or with a --by-package option)"));
pkg = pkg_spec_find_pkg(pkgname, archname, &err);
} else if (strcmp(bypackage, "-") == 0) {
pkg = ((void *)0);
} else {
pkg = pkg_spec_parse_pkg(bypackage, &err);
}
if (pkg)
bypackage = pkg_name(pkg, pnaw_nonambig);
return err.str;
} | long parse_awaiter_package() {
char *v0;
long pkg;
char *v3;
char *v4;
int v5[2];
long v6;
unsigned long v7;
v7 = __readfsqword(0x28u);
v5[0] = 0;
v5[1] = 0;
v6 = 0LL;
if (!f_await)
bypackage = "-";
if (bypackage) {
if (!strcmp(bypackage, "-"))
pkg = 0LL;
else
pkg = pkg_spec_parse_pkg(bypackage, v5);
} else {
v3 = getenv("DPKG_MAINTSCRIPT_PACKAGE");
v4 = getenv("DPKG_MAINTSCRIPT_ARCH");
if (!v3 || !v4) {
v0 = gettext("must be called from a maintainer script (or with a "
"--by-package option)");
badusage(v0);
}
pkg = pkg_spec_find_pkg(v3, v4, v5);
}
if (pkg)
bypackage = (char *)pkg_name(pkg, 1LL);
return v6;
} | dpkg | ida |
static void session_close_single_x11(struct ssh *ssh, int id, void *arg) {
Session *s;
u_int i;
sshlog("session.c", __func__, 2343, 1, SYSLOG_LEVEL_DEBUG3, ((void *)0),
"channel %d", id);
channel_cancel_cleanup(ssh, id);
if ((s = session_by_x11_channel(id)) == ((void *)0))
sshfatal("session.c", __func__, 2346, 1, SYSLOG_LEVEL_FATAL, ((void *)0),
"no x11 channel %d", id);
for (i = 0; s->x11_chanids[i] != -1; i++) {
sshlog("session.c", __func__, 2348, 1, SYSLOG_LEVEL_DEBUG1, ((void *)0),
"session %d: closing channel %d", s->self, s->x11_chanids[i]);
if (s->x11_chanids[i] != id)
session_close_x11(ssh, s->x11_chanids[i]);
}
free(s->x11_chanids);
s->x11_chanids = ((void *)0);
free(s->display);
s->display = ((void *)0);
free(s->auth_proto);
s->auth_proto = ((void *)0);
free(s->auth_data);
s->auth_data = ((void *)0);
free(s->auth_display);
s->auth_display = ((void *)0);
} | long long session_close_single_x11(unsigned long long a0, unsigned long a1,
unsigned long a2) {
unsigned long long v0;
unsigned long v1;
unsigned long v2;
unsigned long long v3;
unsigned long v4;
unsigned int v5;
struct_0 *v6;
v3 = a0;
v2 = a2;
v1 = a1;
v0 = "channel %d";
sshlog("session.c", "session_close_single_x11", 0x927, 0x1, 0x7, 0x0);
channel_cancel_cleanup(v3, a1, a1);
v6 = session_by_x11_channel(a1);
if (!v6) {
v1 = a1;
v0 = "no x11 channel %d";
sshfatal("session.c", "session_close_single_x11", 0x92a, 0x1, 0x1, 0x0);
}
for (v5 = 0; *((v6->field_c0 + (v5 << 2))) != -1; v5 = *((&v4 + 4)) + 1) {
v6 = *((v6->field_c0 + v5 * 4));
v4 = v6->field_4;
v3 = "session %d: closing channel %d";
sshlog("session.c", "session_close_single_x11", 0x92c, 0x1, 0x5, 0x0);
if (a1 != *((v6->field_c0 + (v5 << 2))))
session_close_x11(v3, *((v6->field_c0 + v5 * 4)));
}
free(v6->field_c0);
v6->field_c0 = 0;
free(v6->field_90);
v6->field_90 = 0;
free(v6->field_a8);
v6->field_a8 = 0;
free(v6->field_b0);
v6->field_b0 = 0;
free(v6->field_a0);
v6->field_a0 = 0;
return v6;
} | openssh-portable | angr_dream |
static void ipnh_destroy_entry(struct nh_entry *nhe) {
if (nhe->nh_encap)
free(nhe->nh_encap);
if (nhe->nh_groups)
free(nhe->nh_groups);
} | void ipnh_destroy_entry(unsigned long long a0[14]) {
unsigned long long v1;
unsigned long long v2;
if (a0[7])
free(a0[7]);
v1 = a0[13];
if (a0[13])
v2 = free(a0[13]);
return;
} | iproute2-6.0.0 | angr_sailr |
static void write_long_link(struct tar_stat_info *st) {
switch (archive_format) {
case POSIX_FORMAT:
xheader_store("linkpath", st, ((void *)0));
break;
case V7_FORMAT:
case USTAR_FORMAT:
case STAR_FORMAT:
do {
if (error_hook)
error_hook();
error(0, 0, gettext("%s: link name is too long; not dumped"),
quotearg_colon(st->link_name));
exit_status = 2;
} while (0)
;
break;
case OLDGNU_FORMAT:
case GNU_FORMAT:
write_gnu_long_link(st, st->link_name, 'K');
break;
default:
abort();
}
} | void write_long_link(unsigned long long a0) {
unsigned long long v1;
unsigned long long v2;
unsigned long long v3;
unsigned long long v4;
switch (archive_format) {
case 1:
case 3:
case 5:
if (error_hook)
*(5242912)();
v3 = quotearg_colon(*((a0 + 24)));
v4 = error(0x0, 0x0, gettext("%s: link name is too long; not dumped"));
exit_status = 2;
return;
case 2:
case 6:
v2 = write_gnu_long_link(a0, *((a0 + 24)), 0x4b);
return;
case 4:
v1 = xheader_store("linkpath", a0, 0x0);
return;
default:
abort();
}
} | tar | angr_sailr |
static void can_print_tdc_opt(FILE *f, struct rtattr *tdc_attr) {
struct rtattr *tb[IFLA_CAN_TDC_MAX + 1];
(parse_rtattr_flags(
(tb), (IFLA_CAN_TDC_MAX),
((void *)(((char *)(tdc_attr)) +
((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0)))),
((int)((tdc_attr)->rta_len) -
((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0))),
(1 << 15)));
if (tb[IFLA_CAN_TDC_TDCV] || tb[IFLA_CAN_TDC_TDCO] || tb[IFLA_CAN_TDC_TDCF]) {
open_json_object("tdc");
can_print_nl_indent();
if (tb[IFLA_CAN_TDC_TDCV]) {
__u32 *tdcv =
((void *)(((char *)(tb[IFLA_CAN_TDC_TDCV])) +
((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0))));
print_uint(PRINT_ANY, "tdcv", " tdcv %u", *tdcv);
}
if (tb[IFLA_CAN_TDC_TDCO]) {
__u32 *tdco =
((void *)(((char *)(tb[IFLA_CAN_TDC_TDCO])) +
((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0))));
print_uint(PRINT_ANY, "tdco", " tdco %u", *tdco);
}
if (tb[IFLA_CAN_TDC_TDCF]) {
__u32 *tdcf =
((void *)(((char *)(tb[IFLA_CAN_TDC_TDCF])) +
((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0))));
print_uint(PRINT_ANY, "tdcf", " tdcf %u", *tdcf);
}
close_json_object();
}
} | unsigned long can_print_tdc_opt(long a1, unsigned short *a2) {
long v2;
unsigned short *v3;
const char *v4;
const char *v5;
long v6;
long v7;
long v8;
long v9;
char v11[56];
long v12;
long v13;
long v14;
unsigned long v15;
v15 = __readfsqword(0x28u);
v2 = (unsigned int)*a2 - 4;
v3 = a2 + 2;
v4 = (_BYTE *)(&loc_8 + 1);
parse_rtattr_flags(v11, 9LL, v3, v2, 0x8000LL);
if (v12 || v13 || v14) {
v5 = "tdc";
open_json_object("tdc");
can_print_nl_indent();
if (v12) {
v4 = "tdcv";
v5 = (_BYTE *)&loc_4;
print_uint(4u, (long)"tdcv", (long)" tdcv %u", *(_DWORD *)(v12 + 4));
}
if (v13) {
v4 = "tdco";
v5 = (_BYTE *)&loc_4;
print_uint(4u, (long)"tdco", (long)" tdco %u", *(_DWORD *)(v13 + 4));
}
if (v14) {
v4 = "tdcf";
v5 = (_BYTE *)&loc_4;
print_uint(4u, (long)"tdcf", (long)" tdcf %u", *(_DWORD *)(v14 + 4));
}
close_json_object(v5, v4, v6, v7, v8, v9);
}
return __readfsqword(0x28u) ^ v15;
} | iproute2-6.0.0 | ida |
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)
return;
v0 = 1;
while (true) {
if (v0 > (longestFileName - strlen(a0)))
break;
fprintf(stderr, " ");
v0 += 1;
}
return;
} | bzip2 | angr_sailr |
int BSDgetopt(int nargc, char *const *nargv, const char *options) {
return (getopt_internal(nargc, nargv, options, ((void *)0), ((void *)0), 0));
} | long long BSDgetopt(unsigned long a0, unsigned long long *a1, char *a2) {
return getopt_internal(a0, a1, a2, NULL, NULL, 0x0);
} | openssh-portable | angr_sailr |
static void close_files(void) {
if ((gr_close() == 0) && !list) {
fprintf(stderr, gettext("%s: failure while writing changes to %s\n"), Prog,
gr_dbname());
do {
char *old_locale = setlocale(6, ((void *)0));
char *saved_locale = ((void *)0);
if (((void *)0) != old_locale) {
saved_locale = strdup(old_locale);
}
if (((void *)0) != saved_locale) {
(void)setlocale(6, "C");
}
syslog(3, "failure while writing changes to %s", gr_dbname());
if (((void *)0) != saved_locale) {
(void)setlocale(6, saved_locale);
free(saved_locale);
}
} while (0);
fail_exit(2);
}
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);
}
gr_locked = 0;
}
if (is_shadowgrp) {
if ((sgr_close() == 0) && !list) {
fprintf(stderr, gettext("%s: failure while writing changes to %s\n"),
Prog, sgr_dbname());
do {
char *old_locale = setlocale(6, ((void *)0));
char *saved_locale = ((void *)0);
if (((void *)0) != old_locale) {
saved_locale = strdup(old_locale);
}
if (((void *)0) != saved_locale) {
(void)setlocale(6, "C");
}
syslog(3, "failure while writing changes to %s", sgr_dbname());
if (((void *)0) != saved_locale) {
(void)setlocale(6, saved_locale);
free(saved_locale);
}
} while (0);
fail_exit(2);
}
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);
}
sgr_locked = 0;
}
}
} | void close_files(void)
{
int iVar1;
undefined8 uVar2;
char *pcVar3;
undefined8 uVar4;
char *local_58;
char *local_50;
char *local_48;
char *local_40;
iVar1 = gr_close();
if ((iVar1 == 0) && (list != '\x01')) {
uVar2 = gr_dbname();
uVar4 = Prog;
pcVar3 = (char *)gettext("%s: failure while writing changes to %s\n");
fprintf(stderr, pcVar3, uVar4, uVar2);
pcVar3 = setlocale(6, (char *)0x0);
local_58 = (char *)0x0;
if (pcVar3 != (char *)0x0) {
local_58 = strdup(pcVar3);
}
if (local_58 != (char *)0x0) {
setlocale(6, "C");
}
uVar4 = gr_dbname();
syslog(3, "failure while writing changes to %s", uVar4);
if (local_58 != (char *)0x0) {
setlocale(6, local_58);
free(local_58);
}
fail_exit(2);
}
if (gr_locked != '\0') {
iVar1 = gr_unlock();
if (iVar1 == 0) {
uVar2 = gr_dbname();
uVar4 = Prog;
pcVar3 = (char *)gettext("%s: failed to unlock %s\n");
fprintf(stderr, pcVar3, uVar4, uVar2);
pcVar3 = setlocale(6, (char *)0x0);
local_50 = (char *)0x0;
if (pcVar3 != (char *)0x0) {
local_50 = strdup(pcVar3);
}
if (local_50 != (char *)0x0) {
setlocale(6, "C");
}
uVar4 = gr_dbname();
syslog(3, "failed to unlock %s", uVar4);
if (local_50 != (char *)0x0) {
setlocale(6, local_50);
free(local_50);
}
}
gr_locked = '\0';
}
if (is_shadowgrp != '\0') {
iVar1 = sgr_close();
if ((iVar1 == 0) && (list != '\x01')) {
uVar2 = sgr_dbname();
uVar4 = Prog;
pcVar3 = (char *)gettext("%s: failure while writing changes to %s\n");
fprintf(stderr, pcVar3, uVar4, uVar2);
pcVar3 = setlocale(6, (char *)0x0);
local_48 = (char *)0x0;
if (pcVar3 != (char *)0x0) {
local_48 = strdup(pcVar3);
}
if (local_48 != (char *)0x0) {
setlocale(6, "C");
}
uVar4 = sgr_dbname();
syslog(3, "failure while writing changes to %s", uVar4);
if (local_48 != (char *)0x0) {
setlocale(6, local_48);
free(local_48);
}
fail_exit(2);
}
if (sgr_locked != '\0') {
iVar1 = sgr_unlock();
if (iVar1 == 0) {
uVar2 = sgr_dbname();
uVar4 = Prog;
pcVar3 = (char *)gettext("%s: failed to unlock %s\n");
fprintf(stderr, pcVar3, uVar4, uVar2);
pcVar3 = setlocale(6, (char *)0x0);
local_40 = (char *)0x0;
if (pcVar3 != (char *)0x0) {
local_40 = strdup(pcVar3);
}
if (local_40 != (char *)0x0) {
setlocale(6, "C");
}
uVar4 = sgr_dbname();
syslog(3, "failed to unlock %s", uVar4);
if (local_40 != (char *)0x0) {
setlocale(6, local_40);
free(local_40);
}
}
sgr_locked = '\0';
}
}
return;
} | shadow | ghidra |
static _Bool
find_closing_delim(const struct E_string *es, size_t start_idx,
char pre_bracket_char, size_t *result_idx) {
for (size_t i = start_idx; i < es->len - 1; i++)
if (es->s[i] == pre_bracket_char && es->s[i + 1] == ']' &&
!es->escaped[i] && !es->escaped[i + 1]) {
*result_idx = i;
return 1;
}
return 0;
} | long find_closing_delim(_QWORD *a1, unsigned long a2, char a3,
unsigned long *a4) {
while (a2 < a1[2] - 1LL) {
if (a3 == *(_BYTE *)(*a1 + a2) && *(_BYTE *)(a2 + 1 + *a1) == 93 &&
*(_BYTE *)(a1[1] + a2) != 1 && *(_BYTE *)(a2 + 1 + a1[1]) != 1) {
*a4 = a2;
return 1LL;
}
++a2;
}
return 0LL;
} | coreutils | ida |
static int history_def_next(void *p, HistEventW *ev) {
history_t *h = (history_t *)p;
if (h->cursor == &h->list) {
{
ev->num = 5;
ev->str = he_errlist[5];
};
return -1;
}
if (h->cursor->next == &h->list) {
{
ev->num = 6;
ev->str = he_errlist[6];
};
return -1;
}
h->cursor = h->cursor->next;
*ev = h->cursor->ev;
return 0;
} | long long history_def_next(struct_0 *a0, struct_2 *a1) {
unsigned long long v1;
unsigned long long v2;
if (a0->field_28 == a0) {
a1->field_0 = 5;
a1->field_8 = "e";
v1 = 4294967295;
return v1;
} else if (a0->field_28->field_18 != a0) {
a0->field_28 = a0->field_28->field_18;
v2 = a0->field_28->field_8;
*(&a1->field_0) = a0->field_28->field_0;
a1->field_8 = v2;
v1 = 0;
return v1;
} else {
a1->field_0 = 6;
a1->field_8 = "n";
v1 = 4294967295;
return v1;
}
} | libedit | angr_sailr |
re_refresh(EditLine *el) {
int i, rhdiff;
wchar_t *cp, *st;
coord_t cur;
;
literal_clear(el);
el->el_refresh.r_cursor.h = 0;
el->el_refresh.r_cursor.v = 0;
terminal_move_to_char(el, 0);
prompt_print(el, 12);
el->el_refresh.r_cursor.h = 0;
el->el_refresh.r_cursor.v = 0;
if (el->el_line.cursor >= el->el_line.lastchar) {
if (el->el_map.current == el->el_map.alt &&
el->el_line.lastchar != el->el_line.buffer)
el->el_line.cursor = el->el_line.lastchar - 1;
else
el->el_line.cursor = el->el_line.lastchar;
}
cur.h = -1;
cur.v = 0;
prompt_print(el, 0);
st = el->el_line.buffer;
for (cp = st; cp < el->el_line.lastchar; cp++) {
if (cp == el->el_line.cursor) {
int w = wcwidth(*cp);
cur.h = el->el_refresh.r_cursor.h;
cur.v = el->el_refresh.r_cursor.v;
if (w > 1 && el->el_refresh.r_cursor.h + w > el->el_terminal.t_size.h) {
cur.h = 0;
cur.v++;
}
}
re_addc(el, *cp);
}
if (cur.h == -1) {
cur.h = el->el_refresh.r_cursor.h;
cur.v = el->el_refresh.r_cursor.v;
}
rhdiff = el->el_terminal.t_size.h - el->el_refresh.r_cursor.h -
el->el_rprompt.p_pos.h;
if (el->el_rprompt.p_pos.h && !el->el_rprompt.p_pos.v &&
!el->el_refresh.r_cursor.v && rhdiff > 1) {
while (--rhdiff > 0)
re_putc(el, ' ', 1);
prompt_print(el, 12);
} else {
el->el_rprompt.p_pos.h = 0;
el->el_rprompt.p_pos.v = 0;
}
re_putc(el, '\0', 0);
el->el_refresh.r_newcv = el->el_refresh.r_cursor.v;
;
;
for (i = 0; i <= el->el_refresh.r_newcv; i++) {
re_update_line(el, (wchar_t *)el->el_display[i],
(wchar_t *)el->el_vdisplay[i], i);
re__copy_and_pad((wchar_t *)el->el_display[i],
(wchar_t *)el->el_vdisplay[i],
(size_t)el->el_terminal.t_size.h);
}
;
if (el->el_refresh.r_oldcv > el->el_refresh.r_newcv)
for (; i <= el->el_refresh.r_oldcv; i++) {
terminal_move_to_line(el, i);
terminal_move_to_char(el, 0);
terminal_clear_EOL(el, (int)wcslen((const wchar_t *)el->el_display[i]));
el->el_display[i][0] = '\0';
}
el->el_refresh.r_oldcv = el->el_refresh.r_newcv;
;
terminal_move_to_line(el, cur.v);
terminal_move_to_char(el, cur.h);
} | void re_refresh(struct_0 *a0) {
unsigned int v0;
unsigned int v1;
unsigned int v2;
unsigned int *v3;
unsigned long v4;
unsigned int v5;
unsigned int v6;
unsigned long long v8;
unsigned long long v9;
literal_clear(a0);
a0->field_310 = 0;
a0->field_314 = 0;
terminal_move_to_char(a0, 0x0);
prompt_print(a0, 0xc);
a0->field_310 = 0;
a0->field_314 = 0;
if (a0->field_58 >= a0->field_60) {
if (a0->field_400 == a0->field_3f0 && a0->field_60 != a0->field_50) {
a0->field_58 = a0->field_60 - 4;
goto LABEL_4005cf;
}
a0->field_58 = a0->field_60;
}
LABEL_4005cf:
v5 = -1;
v6 = 0;
prompt_print(a0, 0x0);
v4 = a0->field_50;
for (v3 = v4; v3 < a0->field_60; v3 += 1) {
if (v3 == a0->field_58) {
v2 = wcwidth(*(v3));
v5 = a0->field_310;
v6 = a0->field_314;
if (v2 > 1 && a0->field_310 + v2 > a0->field_90) {
v5 = 0;
v6 += 1;
}
}
re_addc(a0, *(v3));
}
if (v5 == -1) {
v5 = a0->field_310;
v6 = a0->field_314;
}
v1 = a0->field_90 - a0->field_310 - a0->field_340;
if (a0->field_340 && !a0->field_344 && !a0->field_314 && v1 > 1) {
while (true) {
v1 -= 1;
if (v1 <= 0)
break;
re_putc(a0, 0x20, 0x1);
}
prompt_print(a0, 0xc);
goto LABEL_400769;
}
a0->field_340 = 0;
a0->field_344 = 0;
LABEL_400769:
re_putc(a0, 0x0, 0x0);
a0->field_31c = a0->field_314;
for (v0 = 0; v0 <= a0->field_31c; v0 += 1) {
re_update_line(a0, *((a0->field_38 + v0 * 8)), *((a0->field_40 + v0 * 8)),
v0);
re__copy_and_pad(*((a0->field_38 + v0 * 8)), *((a0->field_40 + v0 * 8)),
a0->field_90);
}
if (a0->field_318 > a0->field_31c) {
for (; v0 <= a0->field_318; v0 += 1) {
terminal_move_to_line(a0, v0, v0);
terminal_move_to_char(a0, 0x0);
v8 = wcslen(*((a0->field_38 + v0 * 8)));
terminal_clear_EOL(a0, v8, v8);
*(*((a0->field_38 + v0 * 8))) = 0;
}
}
a0->field_318 = a0->field_31c;
terminal_move_to_line(a0, v6, v6);
v9 = terminal_move_to_char(a0, v5);
return;
} | libedit | angr_phoenix |
int ssh_krl_from_blob(struct sshbuf *buf, struct ssh_krl **krlp,
const struct sshkey **sign_ca_keys,
size_t nsign_ca_keys) {
struct sshbuf *copy = ((void *)0), *sect = ((void *)0);
struct ssh_krl *krl = ((void *)0);
char timestamp[64];
int r = -1, sig_seen;
struct sshkey *key = ((void *)0), **ca_used = ((void *)0), **tmp_ca_used;
u_char type;
const u_char *blob;
size_t i, j, sig_off, sects_off, blen, nca_used;
u_int format_version;
nca_used = 0;
*krlp = ((void *)0);
if (sshbuf_len(buf) < sizeof("SSHKRL\n\0") - 1 ||
memcmp(sshbuf_ptr(buf), "SSHKRL\n\0", sizeof("SSHKRL\n\0") - 1) != 0) {
sshlog("krl.c", __func__, 998, 1, SYSLOG_LEVEL_DEBUG3, ((void *)0),
"not a KRL");
return -50;
}
if ((copy = sshbuf_fromb(buf)) == ((void *)0)) {
r = -2;
goto out;
}
if ((r = sshbuf_consume(copy, sizeof("SSHKRL\n\0") - 1)) != 0)
goto out;
if ((krl = ssh_krl_init()) == ((void *)0)) {
sshlog("krl.c", __func__, 1011, 1, SYSLOG_LEVEL_ERROR, ((void *)0),
"alloc failed");
goto out;
}
if ((r = sshbuf_get_u32(copy, &format_version)) != 0)
goto out;
if (format_version != 1) {
r = -4;
goto out;
}
if ((r = sshbuf_get_u64(copy, &krl->krl_version)) != 0 ||
(r = sshbuf_get_u64(copy, &krl->generated_date)) != 0 ||
(r = sshbuf_get_u64(copy, &krl->flags)) != 0 ||
(r = sshbuf_get_string_direct(copy, ((void *)0), ((void *)0))) != 0 ||
(r = sshbuf_get_cstring(copy, &krl->comment, ((void *)0))) != 0)
goto out;
format_timestamp(krl->generated_date, timestamp, sizeof(timestamp));
sshlog("krl.c", __func__, 1029, 0, SYSLOG_LEVEL_DEBUG1, ((void *)0),
"KRL version %llu generated at %s%s%s",
(long long unsigned)krl->krl_version, timestamp,
*krl->comment ? ": " : "", krl->comment)
;
sig_seen = 0;
if (sshbuf_len(buf) < sshbuf_len(copy)) {
r = -1;
goto out;
}
sects_off = sshbuf_len(buf) - sshbuf_len(copy);
while (sshbuf_len(copy) > 0) {
if ((r = sshbuf_get_u8(copy, &type)) != 0 ||
(r = sshbuf_get_string_direct(copy, &blob, &blen)) != 0)
goto out;
;
if (type != 4) {
if (sig_seen) {
sshlog("krl.c", __func__, 1051, 0, SYSLOG_LEVEL_ERROR, ((void *)0),
"KRL contains non-signature section "
"after signature");
r = -4;
goto out;
}
continue;
}
sig_seen = 1;
if ((r = sshkey_from_blob(blob, blen, &key)) != 0) {
r = -4;
goto out;
}
if (sshbuf_len(buf) < sshbuf_len(copy)) {
r = -1;
goto out;
}
sig_off = sshbuf_len(buf) - sshbuf_len(copy);
if ((r = sshbuf_get_string_direct(copy, &blob, &blen)) != 0) {
r = -4;
goto out;
}
if ((r = sshkey_verify(key, blob, blen, sshbuf_ptr(buf), sig_off,
((void *)0), 0, ((void *)0))) != 0)
goto out;
for (i = 0; i < nca_used; i++) {
if (sshkey_equal(ca_used[i], key)) {
sshlog("krl.c", __func__, 1083, 0, SYSLOG_LEVEL_ERROR, ((void *)0),
"KRL signed more than once with "
"the same key");
r = -4;
goto out;
}
}
tmp_ca_used =
recallocarray(ca_used, nca_used, nca_used + 1, sizeof(*ca_used));
if (tmp_ca_used == ((void *)0)) {
r = -2;
goto out;
}
ca_used = tmp_ca_used;
ca_used[nca_used++] = key;
key = ((void *)0);
}
if (sshbuf_len(copy) != 0) {
r = -1;
goto out;
}
sshbuf_free(copy);
if ((copy = sshbuf_fromb(buf)) == ((void *)0)) {
r = -2;
goto out;
}
if ((r = sshbuf_consume(copy, sects_off)) != 0)
goto out;
while (sshbuf_len(copy) > 0) {
sshbuf_free(sect);
sect = ((void *)0);
if ((r = sshbuf_get_u8(copy, &type)) != 0 ||
(r = sshbuf_froms(copy, §)) != 0)
goto out;
;
switch (type) {
case 1:
if ((r = parse_revoked_certs(sect, krl)) != 0)
goto out;
break;
case 2:
if ((r = blob_section(sect, &krl->revoked_keys, 0)) != 0)
goto out;
break;
case 3:
if ((r = blob_section(sect, &krl->revoked_sha1s, 20)) != 0)
goto out;
break;
case 5:
if ((r = blob_section(sect, &krl->revoked_sha256s, 32)) != 0)
goto out;
break;
case 4:
sshbuf_free(sect);
sect = ((void *)0);
if ((r = sshbuf_get_string_direct(copy, ((void *)0), ((void *)0))) != 0)
goto out;
break;
default:
sshlog("krl.c", __func__, 1154, 0, SYSLOG_LEVEL_ERROR, ((void *)0),
"Unsupported KRL section %u", type);
r = -4;
goto out;
}
if (sect != ((void *)0) && sshbuf_len(sect) > 0) {
sshlog("krl.c", __func__, 1159, 0, SYSLOG_LEVEL_ERROR, ((void *)0),
"KRL section contains unparsed data");
r = -4;
goto out;
}
}
sig_seen = 0;
for (i = 0; i < nca_used; i++) {
if (ssh_krl_check_key(krl, ca_used[i]) == 0)
sig_seen = 1;
else {
sshkey_free(ca_used[i]);
ca_used[i] = ((void *)0);
}
}
if (nca_used && !sig_seen) {
sshlog("krl.c", __func__, 1176, 0, SYSLOG_LEVEL_ERROR, ((void *)0),
"All keys used to sign KRL were revoked");
r = -51;
goto out;
}
if (sig_seen && nsign_ca_keys != 0) {
sig_seen = 0;
for (i = 0; !sig_seen && i < nsign_ca_keys; i++) {
for (j = 0; j < nca_used; j++) {
if (ca_used[j] == ((void *)0))
continue;
if (sshkey_equal(ca_used[j], sign_ca_keys[i])) {
sig_seen = 1;
break;
}
}
}
if (!sig_seen) {
r = -21;
sshlog("krl.c", __func__, 1196, 0, SYSLOG_LEVEL_ERROR, ((void *)0),
"KRL not signed with any trusted key");
goto out;
}
}
*krlp = krl;
r = 0;
out:
if (r != 0)
ssh_krl_free(krl);
for (i = 0; i < nca_used; i++)
sshkey_free(ca_used[i]);
free(ca_used);
sshkey_free(key);
sshbuf_free(copy);
sshbuf_free(sect);
return r;
} | long ssh_krl_from_blob(long a1, _QWORD *a2, long a3, unsigned long a4) {
const char *v5;
unsigned long v6;
long v7;
unsigned long v8;
long v9;
long v10;
long v11;
unsigned char v14;
int v15;
unsigned int u32;
int v17;
long v18;
long v19;
long v20;
long v21;
long v22;
long *v23;
void *ptr;
unsigned long i;
unsigned long j;
unsigned long v27;
long v28;
long v29;
void *v30;
char v31[72];
unsigned long v32;
v32 = __readfsqword(0x28u);
v22 = 0LL;
v18 = 0LL;
v23 = 0LL;
u32 = -1;
v19 = 0LL;
ptr = 0LL;
v27 = 0LL;
*a2 = 0LL;
if ((unsigned long)sshbuf_len(a1) > 7 &&
!strcmp((const char *)sshbuf_ptr(a1), "SSHKRL\n")) {
v22 = sshbuf_fromb(a1);
if (v22) {
u32 = sshbuf_consume(v22, 8LL);
if (!u32) {
v23 = ssh_krl_init();
if (v23) {
u32 = sshbuf_get_u32(v22, &v15);
if (!u32) {
if (v15 == 1) {
u32 = sshbuf_get_u64(v22, v23);
if (!u32) {
u32 = sshbuf_get_u64(v22, v23 + 1);
if (!u32) {
u32 = sshbuf_get_u64(v22, v23 + 2);
if (!u32) {
u32 = sshbuf_get_string_direct(v22, 0LL, 0LL);
if (!u32) {
u32 = sshbuf_get_cstring(v22, v23 + 3, 0LL);
if (!u32) {
format_timestamp(v23[1], v31, 0x40uLL);
if (*(_BYTE *)v23[3])
v5 = ": ";
else
v5 = (const char *)&unk_722C;
sshlog("krl.c", "ssh_krl_from_blob", 1029LL, 0LL, 5LL,
0LL, "KRL version %llu generated at %s%s%s",
*v23, v31, v5, (const char *)v23[3]);
v17 = 0;
v6 = sshbuf_len(a1);
if (v6 >= sshbuf_len(v22)) {
v7 = sshbuf_len(a1);
v28 = v7 - sshbuf_len(v22);
while (sshbuf_len(v22)) {
u32 = sshbuf_get_u8(v22, &v14);
if (u32)
goto LABEL_92;
u32 = sshbuf_get_string_direct(v22, &v20, &v21);
if (u32)
goto LABEL_92;
if (v14 == 4) {
v17 = 1;
u32 = sshkey_from_blob(v20, v21, &v19);
if (u32) {
u32 = -4;
goto LABEL_92;
}
v8 = sshbuf_len(a1);
if (v8 < sshbuf_len(v22)) {
u32 = -1;
goto LABEL_92;
}
v9 = sshbuf_len(a1);
v29 = v9 - sshbuf_len(v22);
u32 = sshbuf_get_string_direct(v22, &v20, &v21);
if (u32) {
u32 = -4;
goto LABEL_92;
}
v10 = sshbuf_ptr(a1);
u32 = sshkey_verify(v19, v20, v21, v10, v29, 0LL,
0LL, 0LL);
if (u32)
goto LABEL_92;
for (i = 0LL; i < v27; ++i) {
if ((unsigned int)sshkey_equal(
*((_QWORD *)ptr + i), v19)) {
sshlog("krl.c", "ssh_krl_from_blob", 1083LL,
0LL, 2LL, 0LL,
"KRL signed more than once with the "
"same key");
u32 = -4;
goto LABEL_92;
}
}
v30 =
(void *)recallocarray(ptr, v27, v27 + 1, 8LL);
if (!v30) {
u32 = -2;
goto LABEL_92;
}
ptr = v30;
v11 = v27++;
*((_QWORD *)v30 + v11) = v19;
v19 = 0LL;
} else if (v17) {
sshlog("krl.c", "ssh_krl_from_blob", 1051LL, 0LL,
2LL, 0LL,
"KRL contains non-signature section after "
"signature");
u32 = -4;
goto LABEL_92;
}
}
if (sshbuf_len(v22)) {
u32 = -1;
} else {
sshbuf_free(v22);
v22 = sshbuf_fromb(a1);
if (v22) {
u32 = sshbuf_consume(v22, v28);
if (!u32) {
while (2) {
if (sshbuf_len(v22)) {
sshbuf_free(v18);
v18 = 0LL;
u32 = sshbuf_get_u8(v22, &v14);
if (!u32) {
u32 = sshbuf_froms(v22, &v18);
if (!u32) {
switch (v14) {
case 1u:
u32 = parse_revoked_certs(v18,
(long)v23);
if (!u32)
goto LABEL_64;
break;
case 2u:
u32 = blob_section(v18, v23 + 4, 0LL);
if (!u32)
goto LABEL_64;
break;
case 3u:
u32 =
blob_section(v18, v23 + 5,
(char *)&loc_10 + 4);
if (!u32)
goto LABEL_64;
break;
case 4u:
sshbuf_free(v18);
v18 = 0LL;
u32 = sshbuf_get_string_direct(
v22, 0LL, 0LL);
if (!u32)
goto LABEL_64;
break;
case 5u:
u32 =
blob_section(v18, v23 + 6,
(char *)&loc_1D + 3);
if (!u32) {
LABEL_64:
if (!v18 || !sshbuf_len(v18))
continue;
sshlog("krl.c", "ssh_krl_from_blob",
1159LL, 0LL, 2LL, 0LL,
"KRL section contains "
"unparsed data");
u32 = -4;
}
break;
default:
sshlog("krl.c", "ssh_krl_from_blob",
1154LL, 0LL, 2LL, 0LL,
"Unsupported KRL section %u",
v14);
u32 = -4;
break;
}
}
}
} else {
v17 = 0;
for (i = 0LL; i < v27; ++i) {
if ((unsigned int)ssh_krl_check_key(
v23, *((_QWORD *)ptr + i))) {
sshkey_free(*((_QWORD *)ptr + i));
*((_QWORD *)ptr + i) = 0LL;
} else {
v17 = 1;
}
}
if (!v27 || v17) {
if (!v17 || !a4)
goto LABEL_91;
v17 = 0;
for (i = 0LL; !v17 && i < a4; ++i) {
for (j = 0LL; j < v27; ++j) {
if (*((_QWORD *)ptr + j) &&
(unsigned int)sshkey_equal(
*((_QWORD *)ptr + j),
*(_QWORD *)(8 * i + a3))) {
v17 = 1;
break;
}
}
}
if (!v17) {
u32 = -21;
sshlog("krl.c", "ssh_krl_from_blob",
1196LL, 0LL, 2LL, 0LL,
"KRL not signed with any "
"trusted key");
} else {
LABEL_91:
*a2 = v23;
u32 = 0;
}
} else {
sshlog("krl.c", "ssh_krl_from_blob",
1176LL, 0LL, 2LL, 0LL,
"All keys used to sign KRL were "
"revoked");
u32 = -51;
}
}
break;
}
}
} else {
u32 = -2;
}
}
} else {
u32 = -1;
}
}
}
}
}
}
} else {
u32 = -4;
}
}
} else {
sshlog("krl.c", "ssh_krl_from_blob", 1011LL, 1LL, 2LL, 0LL,
"alloc failed");
}
}
} else {
u32 = -2;
}
LABEL_92:
if (u32)
ssh_krl_free((long)v23);
for (i = 0LL; i < v27; ++i)
sshkey_free(*((_QWORD *)ptr + i));
free(ptr);
sshkey_free(v19);
sshbuf_free(v22);
sshbuf_free(v18);
return u32;
} else {
sshlog("krl.c", "ssh_krl_from_blob", 998LL, 1LL, 7LL, 0LL, "not a KRL");
return 4294967246LL;
}
} | openssh-portable | ida |
int forkshell(struct job *jp, union node *n, int mode) {
int pid;
;
pid = fork();
if (pid == 0)
forkchild(jp, n, mode);
else
forkparent(jp, n, mode, pid);
return pid;
} | long long forkshell(unsigned int a0, unsigned long long a1, unsigned long a2) {
unsigned int v0;
v0 = fork();
if (!v0) {
forkchild(a0, a1, a2);
return v0;
}
forkparent(a0, a1, a2, v0);
return v0;
} | dash-0.5.11+git20210903+057cd650a4ed | angr_sailr |
static void locale_setblanks() {
int x;
for (x = 0; x < sh_syntabsiz; x++) {
if (((*__ctype_b_loc())[(int)(((unsigned char)x))] &
(unsigned short int)_ISblank))
sh_syntaxtab[x] |= 0x0002 | 0x2000;
else if (((x) ? ((char *)mbschr(("()<>;&| \t\n"), (x)) !=
(char *)((void *)0))
: 0)) {
sh_syntaxtab[x] |= 0x0002;
sh_syntaxtab[x] &= ~0x2000;
} else
sh_syntaxtab[x] &= ~(0x0002 | 0x2000);
}
} | void locale_setblanks() {
unsigned int v0;
int tmp_80;
unsigned long long v2;
unsigned long long v3;
v0 = 0;
while (true) {
v2 = sh_syntabsiz;
if (v0 >= sh_syntabsiz)
break;
*(&v2) = *((*(__ctype_b_loc()) + v0 * 2));
*(&v2) = v2 & 1;
if (v2) {
*(&(&sh_syntaxtab)[4 * v0]) = *(&(&sh_syntaxtab)[4 * v0]) | 8194;
goto LABEL_401370;
}
if (v0 && mbschr("()<>;&| \t\n", v0)) {
*(&(&sh_syntaxtab)[4 * v0]) = *(&(&sh_syntaxtab)[4 * v0]) | 2;
v3 = *(&(&sh_syntaxtab)[4 * v0]);
*(&v3) = (*(&(&sh_syntaxtab)[4 * v0]) >> 8) & 223;
tmp_80 = v3;
*(&(&sh_syntaxtab)[4 * v0]) = tmp_80;
goto LABEL_401370;
}
*(&(&sh_syntaxtab)[4 * v0]) = *(&(&sh_syntaxtab)[4 * v0]) & -8195;
LABEL_401370:
v0 += 1;
}
return;
} | bash | angr_phoenix |
static void tilde_expand_paths(char **paths, u_int num_paths) {
u_int i;
char *cp;
for (i = 0; i < num_paths; i++) {
cp = tilde_expand_filename(paths[i], getuid());
free(paths[i]);
paths[i] = cp;
}
} | long tilde_expand_paths(long a1, unsigned int a2) {
__uid_t v2;
long result;
unsigned int i;
long v5;
for (i = 0;; ++i) {
result = i;
if (i >= a2)
break;
v2 = getuid();
v5 = tilde_expand_filename(*(_QWORD *)(8LL * i + a1), v2);
free(*(void **)(8LL * i + a1));
*(_QWORD *)(a1 + 8LL * i) = v5;
}
return result;
} | openssh-portable | ida |
static int sshsk_ecdsa_sig(struct sk_sign_response *resp, struct sshbuf *sig) {
struct sshbuf *inner_sig = ((void *)0);
int r = -1;
if (resp->sig_r == ((void *)0) || resp->sig_s == ((void *)0)) {
sshlog("ssh-sk.c", __func__, 570, 1, SYSLOG_LEVEL_ERROR, ((void *)0),
"sk_sign response invalid");
r = -4;
goto out;
}
if ((inner_sig = sshbuf_new()) == ((void *)0)) {
r = -2;
goto out;
}
if ((r = sshbuf_put_bignum2_bytes(inner_sig, resp->sig_r, resp->sig_r_len)) !=
0 ||
(r = sshbuf_put_bignum2_bytes(inner_sig, resp->sig_s, resp->sig_s_len)) !=
0) {
sshlog("ssh-sk.c", __func__, 583, 1, SYSLOG_LEVEL_ERROR, ssh_err(r),
"compose inner");
goto out;
}
if ((r = sshbuf_put_stringb(sig, inner_sig)) != 0 ||
(r = sshbuf_put_u8(sig, resp->flags)) != 0 ||
(r = sshbuf_put_u32(sig, resp->counter)) != 0) {
sshlog("ssh-sk.c", __func__, 589, 1, SYSLOG_LEVEL_ERROR, ssh_err(r),
"compose");
goto out;
}
r = 0;
out:
sshbuf_free(inner_sig);
return r;
} | int sshsk_ecdsa_sig(struct_0 *a0, unsigned long long a1) {
unsigned long long v0;
unsigned int v1;
void *v2;
v2 = 0;
v1 = -1;
if (!a0->field_8) {
LABEL_401902:
v0 = "sk_sign response invalid";
sshlog("ssh-sk.c", "sshsk_ecdsa_sig", 0x23a, 0x1, 0x2, 0x0);
v1 = -0x4;
} else {
if (!a0->field_18)
goto LABEL_401902;
v2 = sshbuf_new();
if (!v2) {
v1 = -2;
} else {
v1 = sshbuf_put_bignum2_bytes(v2, a0->field_8, a0->field_10, a0->field_8);
if (v1) {
LABEL_4019b8:
v0 = "compose inner";
sshlog("ssh-sk.c", "sshsk_ecdsa_sig", 0x247, 0x1, 0x2, ssh_err(v1));
} else {
v1 = sshbuf_put_bignum2_bytes(v2, a0->field_18, a0->field_20,
a0->field_18);
if (!(!v1))
goto LABEL_4019b8;
v1 = sshbuf_put_stringb(a1, v2, v2);
if (v1) {
LABEL_401a5d:
v0 = "compose";
sshlog("ssh-sk.c", "sshsk_ecdsa_sig", 0x24d, 0x1, 0x2, ssh_err(v1));
} else {
v1 = sshbuf_put_u8(a1, a0->field_0, a0->field_0);
if (!(!v1))
goto LABEL_401a5d;
v1 = sshbuf_put_u32(a1, a0->field_4);
if (!(!v1))
goto LABEL_401a5d;
v1 = 0;
}
}
}
}
sshbuf_free(v2);
return v1;
} | openssh-portable | angr_phoenix |
static struct file_name *file_name_init(void) {
struct file_name *p = xmalloc(sizeof *p);
p->n_alloc = (((2 * 4096) < (32 * 1024)) ? (2 * 4096) : (32 * 1024));
p->buf = xmalloc(p->n_alloc);
p->start = p->buf + (p->n_alloc - 1);
p->start[0] = '\0';
return p;
} | _QWORD *file_name_init() {
_QWORD *v1;
v1 = (_QWORD *)xmalloc(24LL);
v1[1] = 0x2000LL;
*v1 = xmalloc(v1[1]);
v1[2] = v1[1] - 1LL + *v1;
*(_BYTE *)v1[2] = 0;
return v1;
} | coreutils | ida |
static int match(Char *name, Char *pat, Char *patend) {
int ok, negate_range;
Char c, k;
Char *nextp = ((void *)0);
Char *nextn = ((void *)0);
loop:
while (pat < patend) {
c = *pat++;
switch (c & 0xffff) {
case ((Char)(('*') | 0x8000)):
while (pat < patend && (*pat & 0xffff) == ((Char)(('*') | 0x8000)))
pat++;
if (pat == patend)
return (1);
if (*name == '\0')
return (0);
nextn = name + 1;
nextp = pat - 1;
break;
case ((Char)(('?') | 0x8000)):
if (*name++ == '\0')
goto fail;
break;
case ((Char)(('[') | 0x8000)):
ok = 0;
if ((k = *name++) == '\0')
goto fail;
if ((negate_range = ((*pat & 0xffff) == ((Char)(('!') | 0x8000)))) !=
'\0')
++pat;
while (((c = *pat++) & 0xffff) != ((Char)((']') | 0x8000))) {
if ((c & 0xffff) == ((Char)((':') | 0x8000))) {
Char idx = *pat & 0xffff;
if (idx < (sizeof(cclasses) / sizeof(cclasses[0]) - 1) &&
cclasses[idx].isctype(k))
ok = 1;
++pat;
}
if ((*pat & 0xffff) == ((Char)(('-') | 0x8000))) {
if (c <= k && k <= pat[1])
ok = 1;
pat += 2;
} else if (c == k)
ok = 1;
}
if (ok == negate_range)
goto fail;
break;
default:
if (*name++ != c)
goto fail;
break;
}
}
if (*name == '\0')
return (1);
fail:
if (nextn) {
pat = nextp;
name = nextn;
goto loop;
}
return (0);
} | undefined8 match(ushort *param_1, ushort *param_2, ushort *param_3)
{
ushort uVar1;
ushort uVar2;
ushort uVar3;
bool bVar4;
ushort *puVar5;
int iVar6;
ushort *local_38;
ushort *local_30;
ushort *local_18;
ushort *local_10;
local_18 = (ushort *)0x0;
local_10 = (ushort *)0x0;
local_38 = param_2;
local_30 = param_1;
LAB_001023a3:
if (local_38 < param_3) {
puVar5 = local_38 + 1;
uVar1 = *local_38;
if (uVar1 != 0x805b) {
local_38 = puVar5;
if (uVar1 < 0x805c) {
if (uVar1 == 0x802a) {
for (; (local_38 < param_3 && (*local_38 == 0x802a));
local_38 = local_38 + 1) {
}
if (local_38 == param_3) {
return 1;
}
if (*local_30 == 0) {
return 0;
}
local_10 = local_30 + 1;
local_18 = local_38 + -1;
} else {
if (uVar1 != 0x803f)
goto LAB_0010238d;
uVar1 = *local_30;
local_30 = local_30 + 1;
if (uVar1 == 0)
goto LAB_001023d1;
}
} else {
LAB_0010238d:
uVar3 = *local_30;
local_30 = local_30 + 1;
if (uVar1 != uVar3)
goto LAB_001023d1;
}
goto LAB_001023a3;
}
bVar4 = false;
uVar1 = *local_30;
if (uVar1 == 0)
goto LAB_001023d1;
uVar3 = *puVar5;
if (uVar3 == 0x8021) {
puVar5 = local_38 + 2;
}
while (true) {
local_38 = puVar5;
puVar5 = local_38 + 1;
uVar2 = *local_38;
if (uVar2 == 0x805d)
break;
if (uVar2 == 0x803a) {
if ((*puVar5 < 0xc) &&
(iVar6 = (**(code **)(cclasses + (long)(int)(uint)*puVar5 * 0x10 +
8))(uVar1),
iVar6 != 0)) {
bVar4 = true;
}
puVar5 = local_38 + 2;
}
local_38 = puVar5;
if (*local_38 == 0x802d) {
if ((uVar2 <= uVar1) && (uVar1 <= local_38[1])) {
bVar4 = true;
}
puVar5 = local_38 + 2;
} else {
puVar5 = local_38;
if (uVar2 == uVar1) {
bVar4 = true;
}
}
}
local_38 = puVar5;
local_30 = local_30 + 1;
if (bVar4 != (uVar3 == 0x8021))
goto LAB_001023a3;
} else if (*local_30 == 0) {
return 1;
}
LAB_001023d1:
if (local_10 == (ushort *)0x0) {
return 0;
}
local_38 = local_18;
local_30 = local_10;
goto LAB_001023a3;
} | openssh-portable | ghidra |
int rl_emacs_editing_mode(int count, int key) {
rl_editing_mode = 1;
_rl_set_insert_mode(1, 1);
_rl_keymap = emacs_standard_keymap;
if (_rl_show_mode_in_prompt)
_rl_reset_prompt();
return 0;
} | long long rl_emacs_editing_mode(unsigned long a0, unsigned long a1) {
unsigned int v0;
unsigned int v1;
v1 = a0;
v0 = a1;
rl_editing_mode = 1;
_rl_set_insert_mode(0x1, 0x1);
_rl_keymap = &emacs_standard_keymap;
if (_rl_show_mode_in_prompt)
_rl_reset_prompt();
return 0;
} | bash | angr_dream |
static void
hostkeys_find_by_key(const char *host, const char *ip, const struct sshkey *key,
char **user_hostfiles, u_int num_user_hostfiles,
char **system_hostfiles, u_int num_system_hostfiles,
char ***names, u_int *nnames) {
struct find_by_key_ctx ctx = {0, 0, 0, 0, 0};
u_int i;
*names = ((void *)0);
*nnames = 0;
if (key == ((void *)0) || sshkey_is_cert(key))
return;
ctx.host = host;
ctx.ip = ip;
ctx.key = key;
for (i = 0; i < num_user_hostfiles; i++) {
if (hostkeys_find_by_key_hostfile(user_hostfiles[i], "user", &ctx) != 0)
goto fail;
}
for (i = 0; i < num_system_hostfiles; i++) {
if (hostkeys_find_by_key_hostfile(system_hostfiles[i], "system", &ctx) != 0)
goto fail;
}
*names = ctx.names;
*nnames = ctx.nnames;
ctx.names = ((void *)0);
ctx.nnames = 0;
return;
fail:
for (i = 0; i < ctx.nnames; i++)
free(ctx.names[i]);
free(ctx.names);
} | void hostkeys_find_by_key(undefined8 param_1, undefined8 param_2, long param_3,
long param_4, uint param_5, long param_6,
uint param_7, void **param_8, uint *param_9)
{
int iVar1;
long in_FS_OFFSET;
uint local_3c;
undefined8 local_38;
undefined8 local_30;
long local_28;
void *local_20;
uint local_18;
long local_10;
local_10 = *(long *)(in_FS_OFFSET + 0x28);
local_38 = 0;
local_30 = 0;
local_28 = 0;
local_20 = (void *)0x0;
local_18 = 0;
*param_8 = (void *)0x0;
*param_9 = 0;
if ((param_3 != 0) && (iVar1 = sshkey_is_cert(param_3), iVar1 == 0)) {
local_38 = param_1;
local_30 = param_2;
local_28 = param_3;
for (local_3c = 0; local_3c < param_5; local_3c = local_3c + 1) {
iVar1 = hostkeys_find_by_key_hostfile(
*(undefined8 *)(param_4 + (ulong)local_3c * 8), &DAT_00105ef7,
&local_38);
if (iVar1 != 0)
goto LAB_00102189;
}
for (local_3c = 0; local_3c < param_7; local_3c = local_3c + 1) {
iVar1 = hostkeys_find_by_key_hostfile(
*(undefined8 *)(param_6 + (ulong)local_3c * 8), "system", &local_38);
if (iVar1 != 0)
goto LAB_00102189;
}
*param_8 = local_20;
*param_9 = local_18;
local_20 = (void *)0x0;
local_18 = 0;
}
LAB_001021c6:
if (local_10 == *(long *)(in_FS_OFFSET + 0x28)) {
return;
}
__stack_chk_fail();
LAB_00102189:
for (local_3c = 0; local_3c < local_18; local_3c = local_3c + 1) {
free(*(void **)((long)local_20 + (ulong)local_3c * 8));
}
free(local_20);
goto LAB_001021c6;
} | openssh-portable | ghidra |
hist_get(EditLine *el) {
const wchar_t *hp;
int h;
size_t blen, hlen;
if (el->el_history.eventno == 0) {
(void)wcsncpy(el->el_line.buffer, el->el_history.buf, el->el_history.sz);
el->el_line.lastchar =
el->el_line.buffer + (el->el_history.last - el->el_history.buf);
if (el->el_map.type == 1)
el->el_line.cursor = el->el_line.buffer;
else
el->el_line.cursor = el->el_line.lastchar;
return 4;
}
if (el->el_history.ref == ((void *)0))
return 6;
hp = (((el)->el_flags & 0x040)
? hist_convert(el, 3, ((void *)0))
: ((((*(el)->el_history.fun)((el)->el_history.ref,
&(el)->el_history.ev, 3,
((void *)0))) == -1)
? ((void *)0)
: (el)->el_history.ev.str));
if (hp == ((void *)0))
return 6;
for (h = 1; h < el->el_history.eventno; h++)
if ((hp = (((el)->el_flags & 0x040)
? hist_convert(el, 6, ((void *)0))
: ((((*(el)->el_history.fun)((el)->el_history.ref,
&(el)->el_history.ev, 6,
((void *)0))) == -1)
? ((void *)0)
: (el)->el_history.ev.str))) == ((void *)0))
goto out;
hlen = wcslen(hp) + 1;
blen = (size_t)(el->el_line.limit - el->el_line.buffer);
if (hlen > blen && !ch_enlargebufs(el, hlen))
goto out;
memcpy(el->el_line.buffer, hp, hlen * sizeof(*hp));
el->el_line.lastchar = el->el_line.buffer + hlen - 1;
if (el->el_line.lastchar > el->el_line.buffer &&
el->el_line.lastchar[-1] == '\n')
el->el_line.lastchar--;
if (el->el_line.lastchar > el->el_line.buffer &&
el->el_line.lastchar[-1] == ' ')
el->el_line.lastchar--;
if (el->el_map.type == 1)
el->el_line.cursor = el->el_line.buffer;
else
el->el_line.cursor = el->el_line.lastchar;
return 4;
out:
el->el_history.eventno = h;
return 6;
} | long long hist_get(struct_0 *a0) {
unsigned int v0;
void *v1;
unsigned long v2;
unsigned long long v3;
unsigned long long v5;
void *v6;
void *v9;
unsigned long long v10;
if (!a0->field_470) {
wcsncpy(a0->field_50, a0->field_458, a0->field_460);
a0->field_60 = a0->field_50 + a0->field_468 - a0->field_458;
if (a0->field_420 == 1)
a0->field_58 = a0->field_50;
else
a0->field_58 = a0->field_60;
v5 = 4;
} else if (!a0->field_478) {
v5 = 6;
} else {
if ((a0->field_2c & 64)) {
v6 = hist_convert(a0, 0x3, 0x0);
} else if (a0->field_480(a0->field_478, &a0->padding_488, 3, 0,
a0->field_480) != -1) {
v6 = a0->field_490;
} else {
v6 = 0;
}
v1 = v6;
if (!v1) {
v5 = 6;
} else {
v0 = 1;
while (true) {
if (v0 < a0->field_470) {
if ((a0->field_2c & 64)) {
v9 = hist_convert(a0, 0x6, 0x0);
} else if (a0->field_480(a0->field_478, &a0->padding_488, 6, 0,
a0->field_480) != -1) {
v9 = a0->field_490;
} else {
v9 = 0;
}
v1 = v9;
if (v1) {
v0 += 1;
continue;
}
} else {
v2 = wcslen(v1) + 1;
v3 = a0->field_68 - a0->field_50 >> 2;
if (v2 > v3)
v10 = ch_enlargebufs(a0, v2, v2);
if (v2 <= v3 || v10) {
memcpy(a0->field_50, v1, v2 * 4);
a0->field_60 = v2 * 4 - 4 + a0->field_50;
if (a0->field_60 > a0->field_50 && *((a0->field_60 - 4)) == 10)
a0->field_60 = a0->field_60 - 4;
if (a0->field_60 > a0->field_50 && *((a0->field_60 - 4)) == 32)
a0->field_60 = a0->field_60 - 4;
if (a0->field_420 == 1)
a0->field_58 = a0->field_50;
else
a0->field_58 = a0->field_60;
v5 = 4;
break;
}
}
if ((!v10 || v0 < a0->field_470) && (!v1 || v0 >= a0->field_470) &&
(v0 < a0->field_470 || v2 > v3)) {
a0->field_470 = v0;
v5 = 6;
break;
}
}
}
}
return v5;
} | libedit | angr_dream |
void
sys_error (const char *format, ...)
{
int e;
va_list args;
e = (*__errno_location());
error_prolog(0);
__builtin_va_start(args, format);
vfprintf(stderr, format, args);
fprintf(stderr, ": %s\n", strerror(e));
__builtin_va_end(args);
} | void sys_error(undefined4 param_1, undefined4 param_2, undefined4 param_3,
undefined4 param_4, undefined4 param_5, undefined4 param_6,
undefined4 param_7, undefined4 param_8, char *param_9,
undefined8 param_10, undefined8 param_11, undefined8 param_12,
undefined8 param_13, undefined8 param_14)
{
int __errnum;
char in_AL;
int *piVar1;
char *pcVar2;
long in_FS_OFFSET;
undefined4 local_d8;
undefined4 local_d4;
undefined *local_d0;
undefined *local_c8;
long local_c0;
undefined local_b8[8];
undefined8 local_b0;
undefined8 local_a8;
undefined8 local_a0;
undefined8 local_98;
undefined8 local_90;
undefined4 local_88;
undefined4 local_78;
undefined4 local_68;
undefined4 local_58;
undefined4 local_48;
undefined4 local_38;
undefined4 local_28;
undefined4 local_18;
if (in_AL != '\0') {
local_88 = param_1;
local_78 = param_2;
local_68 = param_3;
local_58 = param_4;
local_48 = param_5;
local_38 = param_6;
local_28 = param_7;
local_18 = param_8;
}
local_c0 = *(long *)(in_FS_OFFSET + 0x28);
local_b0 = param_10;
local_a8 = param_11;
local_a0 = param_12;
local_98 = param_13;
local_90 = param_14;
piVar1 = __errno_location();
__errnum = *piVar1;
error_prolog(0);
local_d8 = 8;
local_d4 = 0x30;
local_d0 = &stack0x00000008;
local_c8 = local_b8;
vfprintf(stderr, param_9, &local_d8);
pcVar2 = strerror(__errnum);
fprintf(stderr, ": %s\n", pcVar2);
if (local_c0 != *(long *)(in_FS_OFFSET + 0x28)) {
__stack_chk_fail();
}
return;
} | bash | ghidra |
static void check_inputs(char *const *files, size_t nfiles) {
for (size_t i = 0; i < nfiles; i++) {
if ((strcmp(files[i], "-") == 0))
continue;
if (euidaccess(files[i], 4) != 0)
sort_die(gettext("cannot read"), files[i]);
}
} | void check_inputs(void *a0, unsigned long a1) {
void *v0;
void *v2;
unsigned long long v3;
unsigned long long v4;
unsigned int v5;
v0 = 0;
while (true) {
v2 = v0;
if (v0 < a1) {
v3 = strcmp(*((a0 + 0x8 * v0)), "-");
if (v3) {
v4 = euidaccess(*((a0 + 0x8 * v0)), 0x4, v0 * 8);
if (v4)
sort_die(gettext("cannot read"), *((a0 + 0x8 * v0)), v5);
}
if (!v4 || !v3)
v0 += 1;
} else {
return;
}
}
} | coreutils | angr_dream |
int skip_to_histexp(string, start, delims, flags)
char *string;
int start;
char *delims;
int flags;
{
int i, pass_next, backq, dquote, c, oldjmp;
int histexp_comsub, histexp_backq, old_dquote;
size_t slen;
mbstate_t state;
memset(&state, '\0', sizeof(mbstate_t));
slen = strlen(string + start) + start;
oldjmp = no_longjmp_on_fatal_error;
if (flags & 0x001)
no_longjmp_on_fatal_error = 1;
histexp_comsub = histexp_backq = old_dquote = 0;
i = start;
pass_next = backq = dquote = 0;
while (c = string[i]) {
if (pass_next) {
pass_next = 0;
if (c == 0)
do {
no_longjmp_on_fatal_error = oldjmp;
return (i);
} while (0);
do {
if (locale_mb_cur_max > 1) {
mbstate_t state_bak;
size_t mblength;
int _f;
_f = is_basic((string)[i]);
if (_f)
mblength = 1;
else if (locale_utf8locale && (((string)[i] & 0x80) == 0))
mblength = (string)[i] != 0;
else {
state_bak = state;
mblength = mbrlen((string) + (i), (slen) - (i), &state);
}
if (mblength == (size_t)-2 || mblength == (size_t)-1) {
state = state_bak;
(i)++;
} else if (mblength == 0)
(i)++;
else
(i) += mblength;
} else
(i)++;
} while (0);
continue;
} else if (c == '\\') {
pass_next = 1;
i++;
continue;
} else if (backq && c == '`') {
backq = 0;
histexp_backq--;
dquote = old_dquote;
i++;
continue;
} else if (c == '`') {
backq = 1;
histexp_backq++;
old_dquote = dquote;
dquote = 0;
i++;
continue;
}
else if (dquote && c == delims[0] && string[i + 1] == '"') {
i++;
continue;
} else if (c == delims[0])
break;
else if (dquote && c == '\'') {
i++;
continue;
} else if (c == '\'')
i = skip_single_quoted(string, slen, ++i, 0);
else if (posixly_correct == 0 && c == '"') {
dquote = 1 - dquote;
i++;
continue;
} else if (c == '"')
i = skip_double_quoted(string, slen, ++i, 0);
else if ((c == '$' || c == '<' || c == '>') && string[i + 1] == '(' &&
string[i + 2] != '(')
{
if (string[i + 2] == '\0')
do {
no_longjmp_on_fatal_error = oldjmp;
return (i + 2);
} while (0);
i += 2;
histexp_comsub++;
old_dquote = dquote;
dquote = 0;
} else if (histexp_comsub && c == ')') {
histexp_comsub--;
dquote = old_dquote;
i++;
continue;
} else if (backq) {
do {
if (locale_mb_cur_max > 1) {
mbstate_t state_bak;
size_t mblength;
int _f;
_f = is_basic((string)[i]);
if (_f)
mblength = 1;
else if (locale_utf8locale && (((string)[i] & 0x80) == 0))
mblength = (string)[i] != 0;
else {
state_bak = state;
mblength = mbrlen((string) + (i), (slen) - (i), &state);
}
if (mblength == (size_t)-2 || mblength == (size_t)-1) {
state = state_bak;
(i)++;
} else if (mblength == 0)
(i)++;
else
(i) += mblength;
} else
(i)++;
} while (0);
continue;
} else
do {
if (locale_mb_cur_max > 1) {
mbstate_t state_bak;
size_t mblength;
int _f;
_f = is_basic((string)[i]);
if (_f)
mblength = 1;
else if (locale_utf8locale && (((string)[i] & 0x80) == 0))
mblength = (string)[i] != 0;
else {
state_bak = state;
mblength = mbrlen((string) + (i), (slen) - (i), &state);
}
if (mblength == (size_t)-2 || mblength == (size_t)-1) {
state = state_bak;
(i)++;
} else if (mblength == 0)
(i)++;
else
(i) += mblength;
} else
(i)++;
} while (0);
}
do {
no_longjmp_on_fatal_error = oldjmp;
return (i);
} while (0);
} | long long skip_to_histexp(char *a0, unsigned long a1, char *a2,
unsigned long a3) {
unsigned int v0;
unsigned int v1;
unsigned int v2;
unsigned int v3;
unsigned int v4;
unsigned int v5;
unsigned int v6;
unsigned int v7;
unsigned int v8;
unsigned int v9;
unsigned int v10;
unsigned int v11;
unsigned long long v12;
unsigned long long v13;
unsigned long long v14;
unsigned int v15;
unsigned long long v16;
unsigned long long v17;
unsigned long long v19;
memset(&v16, 0x0, 0x8);
*(&v15) = strlen(&a0[a1]) + a1;
v7 = no_longjmp_on_fatal_error;
if ((a3 & 1))
no_longjmp_on_fatal_error = 1;
v6 = 0;
v5 = v6;
v4 = v5;
v0 = a1;
v3 = 0;
v2 = v3;
v1 = v2;
while (true) {
v8 = a0[v0];
if (!v8) {
LABEL_405eb7:
no_longjmp_on_fatal_error = v7;
v19 = v0;
break;
} else {
if (v1) {
v1 = 0;
if (!v8) {
no_longjmp_on_fatal_error = v7;
v19 = v0;
break;
}
if (*(&locale_mb_cur_max) <= 1) {
v0 += 1;
LABEL_405abe:
continue;
}
v11 = is_basic(a0[v0]);
if (v11) {
v12 = 1;
goto LABEL_405a7b;
}
if (*(&locale_utf8locale) && a0[v0] >= 0) {
v12 = a0[v0];
goto LABEL_405a7b;
}
v17 = v16;
v12 = mbrlen(&a0[v0], *(&v15) - v0, &v16, &a0[v0]);
LABEL_405a7b:
if (v12 != -2 && v12 != -1) {
if (v12) {
v0 = v0 + v12;
continue;
} else {
v0 += 1;
}
continue;
}
v16 = v17;
v0 += 1;
goto LABEL_405abe;
}
if (v8 == 92) {
v1 = 1;
v0 += 1;
continue;
}
if (v2 && v8 == 96) {
v2 = 0;
v5 -= 1;
v3 = v6;
v0 += 1;
continue;
}
if (v8 == 96) {
v2 = 1;
v5 += 1;
v6 = v3;
v3 = 0;
v0 += 1;
continue;
}
if (v3 && v8 == *(a2) && a0[1 + v0] == 34) {
v0 += 1;
continue;
}
if (v8 == *(a2))
goto LABEL_405eb7;
if (v3 && v8 == 39) {
v0 += 1;
continue;
}
if (v8 == 39) {
v0 += 1;
v0 = skip_single_quoted(a0, *(&v15), v0, 0x0);
continue;
}
if (!posixly_correct && v8 == 34) {
v3 = 1 - v3;
v0 += 1;
continue;
}
if (v8 == 34) {
v0 += 1;
v0 = skip_double_quoted(a0, *(&v15), v0, 0x0);
continue;
}
if (v8 != 36 && v8 != 60 && !(v8 == 62))
goto LABEL_405c86;
if (a0[1 + v0] == 40 && a0[2 + v0] != 40) {
if (!a0[2 + v0]) {
no_longjmp_on_fatal_error = v7;
v19 = v0 + 2;
break;
} else {
v0 += 2;
v4 += 1;
v6 = v3;
v3 = 0;
continue;
}
}
LABEL_405c86:
if (v4 && v8 == 41) {
v4 -= 1;
v3 = v6;
v0 += 1;
continue;
}
if (!v2) {
if (*(&locale_mb_cur_max) <= 1) {
v0 += 1;
continue;
}
v9 = is_basic(a0[v0]);
if (v9) {
v14 = 1;
goto LABEL_405e57;
}
if (*(&locale_utf8locale) && a0[v0] >= 0) {
v14 = a0[v0];
goto LABEL_405e57;
}
v17 = v16;
v14 = mbrlen(&a0[v0], *(&v15) - v0, &v16, &a0[v0]);
LABEL_405e57:
if (v14 != -2 && v14 != -1) {
if (v14) {
v0 = v0 + v14;
continue;
} else {
v0 += 1;
}
continue;
}
v16 = v17;
v0 += 1;
} else if (*(&locale_mb_cur_max) <= 1) {
v0 += 1;
LABEL_405da2:
} else {
v10 = is_basic(a0[v0]);
if (v10) {
v13 = 1;
goto LABEL_405d5f;
}
if (*(&locale_utf8locale) && a0[v0] >= 0) {
v13 = a0[v0];
goto LABEL_405d5f;
}
v17 = v16;
v13 = mbrlen(&a0[v0], *(&v15) - v0, &v16, &a0[v0]);
LABEL_405d5f:
if (v13 != -2 && v13 != -1) {
if (v13) {
v0 = v0 + v13;
continue;
} else {
v0 += 1;
}
continue;
}
v16 = v17;
v0 += 1;
goto LABEL_405da2;
}
}
}
return v19;
} | bash | angr_phoenix |
acl_t acl_init(int count) {
acl_obj *obj;
if (count < 0) {
(*__errno_location()) = 22;
return ((void *)0);
}
obj = __acl_init_obj(count);
return ((obj) ? &(obj)->i : ((void *)0));
} | long long acl_init(unsigned long a0) {
unsigned long v0;
void *v2;
if (a0 < 0) {
*(__errno_location()) = 22;
v2 = 0;
} else {
v0 = __acl_init_obj(a0);
if (!v0)
v2 = 0;
else
v2 = v0 + 8;
}
return v2;
} | acl-2.3.1 | angr_phoenix |
char *mac_alg_list(char sep) {
char *ret = ((void *)0), *tmp;
size_t nlen, rlen = 0;
const struct macalg *m;
for (m = macs; m->name != ((void *)0); m++) {
if (ret != ((void *)0))
ret[rlen++] = sep;
nlen = strlen(m->name);
if ((tmp = realloc(ret, rlen + nlen + 2)) == ((void *)0)) {
free(ret);
return ((void *)0);
}
ret = tmp;
memcpy(ret + rlen, m->name, nlen + 1);
rlen += nlen;
}
return ret;
} | _BYTE *mac_alg_list(char a1) {
long v1;
_BYTE *ptr;
long v4;
const char **i;
size_t v6;
char *v7;
ptr = 0LL;
v4 = 0LL;
for (i = (const char **)&macs; *i; i += 4) {
if (ptr) {
v1 = v4++;
ptr[v1] = a1;
}
v6 = strlen(*i);
v7 = (char *)realloc(ptr, v4 + v6 + 2);
if (!v7) {
free(ptr);
return 0LL;
}
ptr = v7;
memcpy(&v7[v4], *i, v6 + 1);
v4 += v6;
}
return ptr;
} | openssh-portable | ida |
void decode_header(union block *header, struct tar_stat_info *stat_info,
enum archive_format *format_pointer, int do_user_group) {
enum archive_format format;
_Bool hbits;
mode_t mode = mode_from_header(header->header.mode,
sizeof(header->header.mode), &hbits);
if (strcmp(header->header.magic, "ustar") == 0) {
if (header->star_header.prefix[130] == 0 &&
((header->star_header.atime[0]) >= '0' &&
(header->star_header.atime[0]) <= '7') &&
header->star_header.atime[11] == ' ' &&
((header->star_header.ctime[0]) >= '0' &&
(header->star_header.ctime[0]) <= '7') &&
header->star_header.ctime[11] == ' ')
format = STAR_FORMAT;
else if (stat_info->xhdr.size)
format = POSIX_FORMAT;
else
format = USTAR_FORMAT;
} else if (strcmp(header->buffer +
__builtin_offsetof(struct posix_header, magic),
"ustar ") == 0)
format = hbits ? OLDGNU_FORMAT : GNU_FORMAT;
else
format = V7_FORMAT;
*format_pointer = format;
stat_info->stat.st_mode = mode;
stat_info->mtime.tv_sec =
time_from_header(header->header.mtime, sizeof(header->header.mtime));
stat_info->mtime.tv_nsec = 0;
assign_string_n(&stat_info->uname,
header->header.uname[0] ? header->header.uname : ((void *)0),
sizeof(header->header.uname));
assign_string_n(&stat_info->gname,
header->header.gname[0] ? header->header.gname : ((void *)0),
sizeof(header->header.gname));
xheader_xattr_init(stat_info);
if (format == OLDGNU_FORMAT && incremental_option) {
stat_info->atime.tv_sec = time_from_header(
header->oldgnu_header.atime, sizeof(header->oldgnu_header.atime));
stat_info->ctime.tv_sec = time_from_header(
header->oldgnu_header.ctime, sizeof(header->oldgnu_header.ctime));
stat_info->atime.tv_nsec = stat_info->ctime.tv_nsec = 0;
} else if (format == STAR_FORMAT) {
stat_info->atime.tv_sec = time_from_header(
header->star_header.atime, sizeof(header->star_header.atime));
stat_info->ctime.tv_sec = time_from_header(
header->star_header.ctime, sizeof(header->star_header.ctime));
stat_info->atime.tv_nsec = stat_info->ctime.tv_nsec = 0;
} else
stat_info->atime = stat_info->ctime = start_time;
if (format == V7_FORMAT) {
stat_info->stat.st_uid =
uid_from_header(header->header.uid, sizeof(header->header.uid));
stat_info->stat.st_gid =
gid_from_header(header->header.gid, sizeof(header->header.gid));
stat_info->stat.st_rdev = 0;
} else {
if (do_user_group) {
if (numeric_owner_option || !*header->header.uname ||
!uname_to_uid(header->header.uname, &stat_info->stat.st_uid))
stat_info->stat.st_uid =
uid_from_header(header->header.uid, sizeof(header->header.uid));
if (numeric_owner_option || !*header->header.gname ||
!gname_to_gid(header->header.gname, &stat_info->stat.st_gid))
stat_info->stat.st_gid =
gid_from_header(header->header.gid, sizeof(header->header.gid));
}
switch (header->header.typeflag) {
case '4':
case '3':
stat_info->stat.st_rdev =
gnu_dev_makedev(major_from_header(header->header.devmajor,
sizeof(header->header.devmajor)),
minor_from_header(header->header.devminor,
sizeof(header->header.devminor)))
;
break;
default:
stat_info->stat.st_rdev = 0;
}
}
xheader_decode(stat_info);
if (sparse_member_p(stat_info)) {
sparse_fixup_header(stat_info);
stat_info->is_sparse = 1;
} else {
stat_info->is_sparse = 0;
if (((current_format == GNU_FORMAT || current_format == OLDGNU_FORMAT) &&
current_header->header.typeflag == 'D') ||
stat_info->dumpdir)
stat_info->is_dumpdir = 1;
}
} | void decode_header(char a0[500], struct_0 *a1, unsigned long a2,
unsigned long a3) {
unsigned int *v0;
char v1;
unsigned int v2;
unsigned int v3;
char v4;
unsigned int v7;
void *v8;
void *v9;
unsigned long long v10;
unsigned long long *v14;
unsigned long long v15;
v0 = a2;
v3 = mode_from_header(&a0[100], 0x8, &v1);
if (!strcmp(&a0[257], "ustar")) {
if (!a0[475] && a0[476] > 47 && a0[476] <= 55 && a0[487] == 32 &&
a0[488] > 47 && a0[488] <= 55 && a0[499] == 32)
v2 = 5;
if (a0[476] <= 47 || a0[488] <= 47 || a0[475] || a0[487] != 32 ||
a0[476] > 55 || a0[499] != 32 || a0[488] > 55) {
if (a1->field_170)
v2 = 4;
else
v2 = 3;
}
} else {
v7 = strcmp(&a0[257], "ustar ");
if (!v7) {
if (v1)
v7 = 2;
else
v7 = 6;
v2 = v7;
} else {
v2 = 1;
}
}
*(v0) = v2;
a1->field_70 = v3;
a1->field_f8 = time_from_header(&a0[136], 0xc);
a1->field_100 = 0;
if (a0[265])
v8 = &a0[265];
else
v8 = 0;
assign_string_n(&a1->padding_0[32], v8, 0x20, &a1->padding_0[32]);
if (a0[297])
v9 = &a0[297];
else
v9 = 0;
assign_string_n(&a1->padding_0[40], v9, 0x20, &a1->padding_0[40]);
xheader_xattr_init(a1);
if (v2 == 2 && incremental_option) {
a1->field_e8 = time_from_header(&a0[345], 0xc);
a1->field_108 = time_from_header(&a0[357], 0xc);
a1->field_110 = 0;
a1->field_f0 = a1->field_110;
}
if (!incremental_option || v2 != 2) {
if (v2 == 5) {
a1->field_e8 = time_from_header(&a0[476], 0xc);
a1->field_108 = time_from_header(&a0[488], 0xc);
a1->field_110 = 0;
a1->field_f0 = a1->field_110;
} else {
a1->field_108 = start_time;
a1->field_110 = numeric_owner_option;
v10 = a1->field_110;
a1->field_e8 = a1->field_108;
a1->field_f0 = v10;
}
}
if (v2 == 1) {
a1->field_74 = uid_from_header(&a0[108], 0x8);
a1->field_78 = gid_from_header(&a0[116], 0x8);
a1->field_80 = 0;
} else {
if (a3) {
if (!uname_to_uid(&a0[265], &a1->field_74, &a1->field_74) || !a0[265] ||
numeric_owner_option)
a1->field_74 = uid_from_header(&a0[108], 0x8);
if (!a0[297] || !gname_to_gid(&a0[297], &a1->field_78, &a1->field_78) ||
numeric_owner_option)
a1->field_78 = gid_from_header(&a0[116], 0x8);
}
if (a0[156] - 51 <= 1)
a1->field_80 = gnu_dev_makedev(major_from_header(&a0[329], 0x8),
minor_from_header(&a0[337], 0x8));
else
a1->field_80 = 0;
}
xheader_decode(a1);
if (sparse_member_p(a1)) {
sparse_fixup_header(a1);
a1->field_120 = 1;
} else {
a1->field_120 = 0;
if (a1->field_190)
a1->field_188 = 1;
}
v15 = *(&v4) ^ v14[5];
return;
} | tar | angr_dream |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.