input stringlengths 26 172k | output stringlengths 18 318k | repo_name stringclasses 23 values | decompiler stringclasses 5 values |
|---|---|---|---|
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;
} | void *strgrow(char *a1, int a2) {
size_t v2;
void *v4;
v2 = strlen(a1);
v4 = realloc(a1, a2 + v2 + 1);
if (!v4) {
fprintf(stderr, "man2html: out of memory");
exit(1);
}
return v4;
} | bash | ida |
static void socket_starttls(socket_st *socket) {
char buf[512];
if (socket->secure)
return;
if (socket->app_proto == ((void *)0) ||
strcasecmp(socket->app_proto, "https") == 0)
return;
if (strcasecmp(socket->app_proto, "smtp") == 0 ||
strcasecmp(socket->app_proto, "submission") == 0) {
if (socket->verbose)
log_msg(stdout, "Negotiating SMTP STARTTLS\n");
wait_for_text(socket, "220 ", 4);
snprintf(buf, sizeof(buf), "EHLO %s\r\n", socket->hostname);
send_line(socket, buf);
wait_for_text(socket, "250 ", 4);
send_line(socket, "STARTTLS\r\n");
wait_for_text(socket, "220 ", 4);
} else if (strcasecmp(socket->app_proto, "imap") == 0 ||
strcasecmp(socket->app_proto, "imap2") == 0) {
if (socket->verbose)
log_msg(stdout, "Negotiating IMAP STARTTLS\n");
send_line(socket, "a CAPABILITY\r\n");
wait_for_text(socket, "a OK", 4);
send_line(socket, "a STARTTLS\r\n");
wait_for_text(socket, "a OK", 4);
} else if (strcasecmp(socket->app_proto, "xmpp") == 0) {
if (socket->verbose)
log_msg(stdout, "Negotiating XMPP STARTTLS\n");
snprintf(buf, sizeof(buf), "<stream:stream xmlns:stream='http:
send_line(socket, buf);
wait_for_text(socket, "<?", 2);
send_line(socket, "<starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>");
wait_for_text(socket, "<proceed", 8);
} else if (strcasecmp(socket->app_proto, "ldap") == 0) {
if (socket->verbose)
log_msg(stdout, "Negotiating LDAP STARTTLS\n");
send(socket->fd,
"\x30\x1d\x02\x01\x01\x77\x18\x80\x16\x31\x2e\x33\x2e\x36\x2e\x31\x2e"
"\x34\x2e\x31\x2e\x31\x34\x36\x36\x2e\x32\x30\x30\x33\x37",
sizeof(
"\x30\x1d\x02\x01\x01\x77\x18\x80\x16\x31\x2e\x33\x2e\x36\x2e\x31"
"\x2e\x34\x2e\x31\x2e\x31\x34\x36\x36\x2e\x32\x30\x30\x33\x37") -
1,
0);
wait_for_text(socket, ((void *)0), 0);
} else if (strcasecmp(socket->app_proto, "ftp") == 0 ||
strcasecmp(socket->app_proto, "ftps") == 0) {
if (socket->verbose)
log_msg(stdout, "Negotiating FTP STARTTLS\n");
send_line(socket, "FEAT\r\n");
wait_for_text(socket, "211 ", 4);
send_line(socket, "AUTH TLS\r\n");
wait_for_text(socket, "234", 3);
} else if (strcasecmp(socket->app_proto, "lmtp") == 0) {
if (socket->verbose)
log_msg(stdout, "Negotiating LMTP STARTTLS\n");
wait_for_text(socket, "220 ", 4);
snprintf(buf, sizeof(buf), "LHLO %s\r\n", socket->hostname);
send_line(socket, buf);
wait_for_text(socket, "250 ", 4);
send_line(socket, "STARTTLS\r\n");
wait_for_text(socket, "220 ", 4);
} else if (strcasecmp(socket->app_proto, "pop3") == 0) {
if (socket->verbose)
log_msg(stdout, "Negotiating POP3 STARTTLS\n");
wait_for_text(socket, "+OK", 3);
send_line(socket, "STLS\r\n");
wait_for_text(socket, "+OK", 3);
} else if (strcasecmp(socket->app_proto, "nntp") == 0) {
if (socket->verbose)
log_msg(stdout, "Negotiating NNTP STARTTLS\n");
wait_for_text(socket, "200 ", 4);
send_line(socket, "STARTTLS\r\n");
wait_for_text(socket, "382 ", 4);
} else if (strcasecmp(socket->app_proto, "sieve") == 0) {
if (socket->verbose)
log_msg(stdout, "Negotiating Sieve STARTTLS\n");
wait_for_text(socket, "OK ", 3);
send_line(socket, "STARTTLS\r\n");
wait_for_text(socket, "OK ", 3);
} else if (strcasecmp(socket->app_proto, "postgres") == 0 ||
strcasecmp(socket->app_proto, "postgresql") == 0) {
if (socket->verbose)
log_msg(stdout, "Negotiating PostgreSQL STARTTLS\n");
send(socket->fd, "\x00\x00\x00\x08\x04\xD2\x16\x2F",
sizeof("\x00\x00\x00\x08\x04\xD2\x16\x2F") - 1, 0);
wait_for_text(socket, ((void *)0), 0);
} else {
if (!c_isdigit(socket->app_proto[0])) {
static int warned = 0;
if (warned == 0) {
fprintf(stderr, "unknown protocol '%s'\n", socket->app_proto);
warned = 1;
}
}
}
return;
} | void socket_starttls(struct_0 *a0) {
char v0;
char v1;
unsigned long long *v4;
unsigned long long v5;
if (!a0->field_10 && a0->field_20 && strcasecmp(a0->field_20, "https")) {
if (!strcasecmp(a0->field_20, "smtp")) {
LABEL_400736:
if (a0->field_48)
log_msg(*(&stdout), "Negotiating SMTP STARTTLS\n");
wait_for_text(a0, "220 ", 0x4);
snprintf(&v0, 0x200, "EHLO %s\r\n", a0->field_18);
send_line(a0, &v0);
wait_for_text(a0, "250 ", 0x4);
send_line(a0, "STARTTLS\r\n");
wait_for_text(a0, "220 ", 0x4);
goto LABEL_400edd;
} else {
if (!strcasecmp(a0->field_20, "submission"))
goto LABEL_400736;
if (!strcasecmp(a0->field_20, "imap")) {
LABEL_400852:
if (a0->field_48)
log_msg(*(&stdout), "Negotiating IMAP STARTTLS\n");
send_line(a0, "a CAPABILITY\r\n");
wait_for_text(a0, "a OK", 0x4);
send_line(a0, "a STARTTLS\r\n");
wait_for_text(a0, "a OK", 0x4);
goto LABEL_400edd;
} else {
if (!strcasecmp(a0->field_20, "imap2"))
goto LABEL_400852;
if (!strcasecmp(a0->field_20, "xmpp")) {
if (a0->field_48)
log_msg(*(&stdout), "Negotiating XMPP STARTTLS\n");
snprintf(&v0, 0x200, "<stream:stream xmlns:stream='http:
send_line(a0, &v0);
wait_for_text(a0, "<?", 0x2);
send_line(a0, "<starttls xmlns='urn:ietf:params:xml:ns:xmpp-tls'/>");
wait_for_text(a0, "<proceed", 0x8);
goto LABEL_400ee5;
}
if (!strcasecmp(a0->field_20, "ldap")) {
if (a0->field_48)
log_msg(*(&stdout), "Negotiating LDAP STARTTLS\n");
send(a0->field_0, &g_4021e8, 0x1f, 0x0);
wait_for_text(a0, NULL, 0x0);
goto LABEL_400ee5;
}
if (!strcasecmp(a0->field_20, "ftp")) {
LABEL_400a8b:
if (a0->field_48)
log_msg(*(&stdout), "Negotiating FTP STARTTLS\n");
send_line(a0, "FEAT\r\n");
wait_for_text(a0, "211 ", 0x4);
send_line(a0, "AUTH TLS\r\n");
wait_for_text(a0, "234", 0x3);
goto LABEL_400edd;
} else {
if (!strcasecmp(a0->field_20, "ftps"))
goto LABEL_400a8b;
if (!strcasecmp(a0->field_20, "lmtp")) {
if (a0->field_48)
log_msg(*(&stdout), "Negotiating LMTP STARTTLS\n");
wait_for_text(a0, "220 ", 0x4);
snprintf(&v0, 0x200, "LHLO %s\r\n", a0->field_18);
send_line(a0, &v0);
wait_for_text(a0, "250 ", 0x4);
send_line(a0, "STARTTLS\r\n");
wait_for_text(a0, "220 ", 0x4);
goto LABEL_400ee5;
}
if (!strcasecmp(a0->field_20, "pop3")) {
if (a0->field_48)
log_msg(*(&stdout), "Negotiating POP3 STARTTLS\n");
wait_for_text(a0, "+OK", 0x3);
send_line(a0, "STLS\r\n");
wait_for_text(a0, "+OK", 0x3);
goto LABEL_400ee5;
}
if (!strcasecmp(a0->field_20, "nntp")) {
if (a0->field_48)
log_msg(*(&stdout), "Negotiating NNTP STARTTLS\n");
wait_for_text(a0, "200 ", 0x4);
send_line(a0, "STARTTLS\r\n");
wait_for_text(a0, "382 ", 0x4);
goto LABEL_400ee5;
}
if (!strcasecmp(a0->field_20, "sieve")) {
if (a0->field_48)
log_msg(*(&stdout), "Negotiating Sieve STARTTLS\n");
wait_for_text(a0, "OK ", 0x3);
send_line(a0, "STARTTLS\r\n");
wait_for_text(a0, "OK ", 0x3);
goto LABEL_400ee5;
}
if (strcasecmp(a0->field_20, "postgres") &&
strcasecmp(a0->field_20, "postgresql") &&
(c_isdigit(a0->field_20->field_0) ^ 1) && !warned.11693) {
fprintf(stderr, "unknown protocol '%s'\n", a0->field_20);
warned.11693 = 1;
goto LABEL_400ee5;
}
if (a0->field_48)
log_msg(*(&stdout), "Negotiating PostgreSQL STARTTLS\n");
send(a0->field_0, &g_402321, 0x8, 0x0);
wait_for_text(a0, NULL, 0x0);
LABEL_400edd:
}
}
}
LABEL_400ee5:
goto LABEL_400ee6;
}
LABEL_400ee6:
v5 = *(&v1) ^ v4[5];
return;
} | gnutls | angr_phoenix |
static void tarobject_set_perms(struct tar_entry *te, const char *path,
struct file_stat *st) {
int rc;
if (te->type == TAR_FILETYPE_FILE)
return;
if (te->type == TAR_FILETYPE_SYMLINK) {
rc = lchown(path, st->uid, st->gid);
if (forcible_nonroot_error(rc))
ohshite(gettext("error setting ownership of symlink '%.255s'"), path);
} else {
rc = chown(path, st->uid, st->gid);
if (forcible_nonroot_error(rc))
ohshite(gettext("error setting ownership of '%.255s'"), path);
rc = chmod(path, st->mode & ~0170000);
if (forcible_nonroot_error(rc))
ohshite(gettext("error setting permissions of '%.255s'"), path);
}
} | void tarobject_set_perms(struct_0 *a0, char *a1, unsigned int a2[3]) {
unsigned int v0;
int tmp_18;
unsigned long long v2;
unsigned long long v3;
unsigned long long v4;
unsigned long long v6;
unsigned long long v7;
unsigned long long v8;
v2 = a0->field_4;
if (a0->field_4 != 48) {
if (a0->field_4 == 50) {
v0 = lchown(a1, a2[0], a2[1], a2[0]);
v3 = forcible_nonroot_error(v0);
ohshite(gettext("error setting ownership of symlink '%.255s'"));
}
v0 = chown(a1, a2[0], a2[1]);
if (forcible_nonroot_error(v0))
ohshite(gettext("error setting ownership of '%.255s'"));
v4 = a2[2];
*(&v4) = (a2[2] >> 8) & 15;
tmp_18 = v4;
v6 = chmod(a1, tmp_18);
v0 = v6;
v7 = forcible_nonroot_error(v0);
v8 = ohshite(gettext("error setting permissions of '%.255s'"));
}
return;
} | dpkg | angr_phoenix |
static inline void emit_backup_suffix_note(void) {
fputs_unlocked(
gettext(
"\nThe backup suffix is '~', unless set with --suffix or "
"SIMPLE_BACKUP_SUFFIX.\nThe version control method may be selected "
"via the --backup option or through\nthe VERSION_CONTROL environment "
"variable. Here are the values:\n\n"),
stdout)
;
fputs_unlocked(
gettext(" none, off never make backups (even if --backup is "
"given)\n numbered, t make numbered backups\n existing, "
"nil numbered if numbered backups exist, simple otherwise\n "
"simple, never always make simple backups\n"),
stdout)
;
} | int emit_backup_suffix_note() {
FILE *v0;
char *v1;
FILE *v2;
char *v3;
v0 = stdout;
v1 = gettext(
"\n"
"The backup suffix is '~', unless set with --suffix or "
"SIMPLE_BACKUP_SUFFIX.\n"
"The version control method may be selected via the --backup option or "
"through\n"
"the VERSION_CONTROL environment variable. Here are the values:\n"
"\n");
fputs_unlocked(v1, v0);
v2 = stdout;
v3 = gettext(
" none, off never make backups (even if --backup is given)\n"
" numbered, t make numbered backups\n"
" existing, nil numbered if numbered backups exist, simple otherwise\n"
" simple, never always make simple backups\n");
return fputs_unlocked(v3, v2);
} | coreutils | ida |
SHELL_VAR *bind_global_variable(name, value, flags) const char *name;
char *value;
int flags;
{
if (shell_variables == 0)
create_variable_tables();
return (
bind_variable_internal(name, value, global_variables->table, 0, flags));
} | void bind_global_variable(unsigned long long a0, unsigned long long a1,
unsigned long a2) {
unsigned long long v1;
if (!shell_variables)
create_variable_tables();
v1 = bind_variable_internal(a0, a1, *((global_variables + 32)), 0x0, a2);
return;
} | bash | angr_phoenix |
static void maybe_close_stdout(void) {
if (!stdout_closed)
close_stdout();
else if (close_stream(stderr) != 0)
_exit(1);
} | long long maybe_close_stdout() {
unsigned long long v1;
if ((stdout_closed ^ 1)) {
v1 = close_stdout();
} else {
v1 = close_stream(stderr);
if (v1)
_exit(0x1);
}
if (!v1 || (stdout_closed ^ 1))
return v1;
} | coreutils | angr_dream |
static inline int __acl_entry_p_compare(const acl_entry_obj *a_p,
const acl_entry_obj *b_p) {
if (a_p->i.e_entry.e_tag < b_p->i.e_entry.e_tag)
return -1;
else if (a_p->i.e_entry.e_tag > b_p->i.e_entry.e_tag)
return 1;
if (a_p->i.e_entry.e_id.i.q_id < b_p->i.e_entry.e_id.i.q_id)
return -1;
else if (a_p->i.e_entry.e_id.i.q_id > b_p->i.e_entry.e_id.i.q_id)
return 1;
else
return 0;
} | int __acl_entry_p_compare(unsigned int a0[13], unsigned int a1[13]) {
unsigned int v1;
if (a0[8] < a1[8]) {
v1 = -1;
} else if (a0[8] > a1[8]) {
v1 = 1;
} else if (a0[12] < a1[12]) {
v1 = -1;
} else if (a0[12] > a1[12]) {
v1 = 1;
} else {
v1 = 0;
}
return v1;
} | acl-2.3.1 | angr_phoenix |
static unsigned load_chain(gnutls_x509_crt_t chain[8]) {
if (ocsptool_options.present.load_chain) {
common_info_st info;
size_t list_size;
memset(&info, 0, sizeof(info));
gnutls_x509_crt_t *list;
unsigned i;
info.verbose = verbose;
info.cert = ocsptool_options.arg.load_chain;
info.sort_chain = 1;
list = load_cert_list(1, &list_size, &info);
if (list_size > 8) {
fprintf(stderr, "Too many certificates in chain\n");
app_exit(1);
}
for (i = 0; i < list_size; i++)
chain[i] = list[i];
gnutls_free((void *)(list)), list = ((void *)0);
return list_size;
} else {
common_info_st info;
memset(&info, 0, sizeof(info));
info.verbose = verbose;
if (!ocsptool_options.present.load_cert) {
fprintf(stderr, "Missing option --load-cert\n");
app_exit(1);
}
info.cert = ocsptool_options.arg.load_cert;
chain[0] = load_cert(1, &info);
memset(&info, 0, sizeof(info));
info.verbose = verbose;
if (!ocsptool_options.present.load_issuer) {
fprintf(stderr, "Missing option --load-issuer\n");
app_exit(1);
}
info.cert = ocsptool_options.arg.load_issuer;
chain[1] = load_cert(1, &info);
return 2;
}
} | ulong load_chain(undefined8 *param_1)
{
undefined8 uVar1;
long in_FS_OFFSET;
uint local_10c;
ulong local_108;
long local_100;
undefined local_f8[40];
code *local_d0;
undefined4 local_34;
undefined4 local_2c;
long local_20;
local_20 = *(long *)(in_FS_OFFSET + 0x28);
if (DAT_00103042 == '\0') {
memset(local_f8, 0, 0xd8);
local_34 = verbose;
if (DAT_00103044 != '\x01') {
fprintf(stderr, "Missing option --load-cert\n");
app_exit(1);
}
local_d0 = (code *)_gnutls_ocsp_req_deinit;
uVar1 = load_cert(1, local_f8);
*param_1 = uVar1;
memset(local_f8, 0, 0xd8);
local_34 = verbose;
if (DAT_00103043 != '\x01') {
fprintf(stderr, "Missing option --load-issuer\n");
app_exit(1);
}
local_d0 = _printf;
uVar1 = load_cert(1, local_f8);
param_1[1] = uVar1;
local_108 = 2;
} else {
memset(local_f8, 0, 0xd8);
local_34 = verbose;
local_d0 = gnutls_free;
local_2c = 1;
local_100 = load_cert_list(1, &local_108, local_f8);
if (8 < local_108) {
fprintf(stderr, "Too many certificates in chain\n");
app_exit(1);
}
for (local_10c = 0; local_10c < local_108; local_10c = local_10c + 1) {
param_1[local_10c] = *(undefined8 *)(local_100 + (ulong)local_10c * 8);
}
(*gnutls_free)(local_100);
local_100 = 0;
}
if (local_20 != *(long *)(in_FS_OFFSET + 0x28)) {
__stack_chk_fail();
}
return local_108;
} | gnutls | ghidra |
static int ext4_del_extent_from_list(e2fsck_t ctx, struct extent_list *list,
struct ext2fs_extent *ex) {
return ext4_modify_extent_list(ctx, list, ex, 1);
} | void ext4_del_extent_from_list(void **a0, void *a1, void *a2) {
unsigned long long v1;
v1 = ext4_modify_extent_list(a0, a1, a2, 0x1);
return;
} | e2fsprogs-1.46.5 | angr_phoenix |
void monotime_ts(struct timespec *ts) {
struct timeval tv;
static int gettime_failed = 0;
if (!gettime_failed) {
if (clock_gettime(7, ts) == 0)
return;
if (clock_gettime(1, ts) == 0)
return;
if (clock_gettime(0, ts) == 0)
return;
sshlog("misc.c", __func__, 1680, 0, SYSLOG_LEVEL_DEBUG3, ((void *)0),
"clock_gettime: %s", strerror((*__errno_location())));
gettime_failed = 1;
}
gettimeofday(&tv, ((void *)0));
ts->tv_sec = tv.tv_sec;
ts->tv_nsec = (long)tv.tv_usec * 1000;
} | void monotime_ts(unsigned long long a0[2]) {
char v0;
char v1;
char v2;
unsigned long long v4;
unsigned long long v5;
unsigned long long v6;
unsigned long long *v7;
unsigned long long v8;
if (!gettime_failed.13126) {
v4 = clock_gettime(0x7, a0);
if (v4) {
v5 = clock_gettime(0x1, a0);
if (v5) {
v6 = clock_gettime(0x0, a0);
if (v6) {
sshlog("misc.c", "monotime_ts", 0x690, 0x0, 0x7, 0x0,
"clock_gettime: %s", strerror(*(__errno_location())));
gettime_failed.13126 = 1;
}
}
}
}
if (gettime_failed.13126 || v4 && v6 && v5) {
gettimeofday(&v0, NULL);
a0[0] = *(&v0);
a0[1] = __mulvdi3(*(&v1), 0x3e8);
}
v8 = *(&v2) ^ v7[5];
return;
} | openssh-portable | angr_dream |
static void print_rawpk_info(gnutls_session_t session, FILE *out, int flag,
int print_cert, int print_crt_status) {
gnutls_pcert_st pk_cert;
gnutls_pk_algorithm_t pk_algo;
const gnutls_datum_t *cert_list;
unsigned int cert_list_size = 0;
int ret;
cert_list = gnutls_certificate_get_peers(session, &cert_list_size);
if (cert_list_size == 0) {
if (print_crt_status)
fprintf(stderr, "No certificates found!\n");
return;
}
log_msg(out, "- Certificate type: Raw Public Key\n");
log_msg(out, "- Got %d Raw public-key(s).\n", cert_list_size);
ret = gnutls_pcert_import_rawpk_raw(&pk_cert, cert_list, GNUTLS_X509_FMT_DER,
0, 0);
if (ret < 0) {
fprintf(stderr, "Decoding error: %s\n", gnutls_strerror(ret));
return;
}
pk_algo = gnutls_pubkey_get_pk_algorithm(pk_cert.pubkey, ((void *)0));
log_msg(out, "- Raw pk info:\n");
log_msg(out, " - PK algo: %s\n", gnutls_pk_algorithm_get_name(pk_algo));
if (print_cert) {
gnutls_datum_t pem;
ret = gnutls_pubkey_export2(pk_cert.pubkey, GNUTLS_X509_FMT_PEM, &pem);
if (ret < 0) {
fprintf(stderr, "Encoding error: %s\n", gnutls_strerror(ret));
return;
}
log_msg(out, "\n%s\n", (char *)pem.data);
gnutls_free((void *)(pem.data)), pem.data = ((void *)0);
}
} | void print_rawpk_info(undefined8 param_1, undefined8 param_2,
undefined8 param_3, int param_4, int param_5)
{
undefined8 uVar1;
long in_FS_OFFSET;
int local_5c;
int local_58;
undefined4 local_54;
undefined8 local_50;
undefined8 local_48[2];
undefined8 local_38[5];
long local_10;
local_10 = *(long *)(in_FS_OFFSET + 0x28);
local_5c = 0;
local_50 = gnutls_certificate_get_peers(param_1, &local_5c);
if (local_5c == 0) {
if (param_5 != 0) {
fprintf(stderr, "No certificates found!\n");
}
} else {
log_msg(param_2, "- Certificate type: Raw Public Key\n");
log_msg(param_2, "- Got %d Raw public-key(s).\n", local_5c);
local_58 = gnutls_pcert_import_rawpk_raw(local_38, local_50, 0, 0, 0);
if (local_58 < 0) {
uVar1 = gnutls_strerror(local_58);
fprintf(stderr, "Decoding error: %s\n", uVar1);
} else {
local_54 = gnutls_pubkey_get_pk_algorithm(local_38[0], 0);
log_msg(param_2, "- Raw pk info:\n");
uVar1 = gnutls_pk_algorithm_get_name(local_54);
log_msg(param_2, " - PK algo: %s\n", uVar1);
if (param_4 != 0) {
local_58 = gnutls_pubkey_export2(local_38[0], 1, local_48);
if (local_58 < 0) {
uVar1 = gnutls_strerror(local_58);
fprintf(stderr, "Encoding error: %s\n", uVar1);
} else {
log_msg(param_2, &DAT_0010474c, local_48[0]);
(*gnutls_free)(local_48[0]);
local_48[0] = 0;
}
}
}
}
if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) {
__stack_chk_fail();
}
return;
} | gnutls | ghidra |
static void explain(void) { print_explain(stderr); } | int explain() { return print_explain(stderr); } | iproute2-6.0.0 | ida |
int forcible_nonroot_error(int rc) {
if (in_force(FORCE_NON_ROOT) && (*__errno_location()) == 1)
return 0;
return rc;
} | long long forcible_nonroot_error(unsigned long a0) {
void *v2;
if (in_force(0x10000) && *(__errno_location()) == 1) {
v2 = 0;
return v2;
}
v2 = a0;
return v2;
} | dpkg | angr_sailr |
static VARLIST *vlist_alloc(nentries)
int nentries;
{
VARLIST *vlist;
vlist = (VARLIST *)sh_xmalloc((sizeof(VARLIST)), "variables.c", 4171);
vlist->list = (SHELL_VAR **)sh_xmalloc(((nentries + 1) * sizeof(SHELL_VAR *)),
"variables.c", 4172);
vlist->list_size = nentries;
vlist->list_len = 0;
vlist->list[0] = (SHELL_VAR *)((void *)0);
return vlist;
} | int vlist_alloc(unsigned long a0) {
struct_0 *v0;
v0 = sh_xmalloc(0x10, "variables.c", 0x104b);
v0->field_0 = sh_xmalloc((a0 + 1) * 8, "variables.c", 0x104c);
v0->field_8 = a0;
v0->field_c = 0;
v0->field_0->field_0 = 0;
return v0;
} | bash | angr_phoenix |
static struct globval *finddirs(pat, sdir, flags, ep, np)
char *pat;
char *sdir;
int flags;
struct globval **ep;
int *np;
{
char **r, *n;
int ndirs;
struct globval *ret, *e, *g;
e = ret = 0;
r = glob_vector(pat, sdir, flags);
if (r == 0 || r[0] == 0) {
if (np)
*np = 0;
if (ep)
*ep = 0;
if (r && r != &glob_error_return)
sh_xfree((r), "glob.c", 620);
return (struct globval *)0;
}
for (ndirs = 0; r[ndirs] != 0; ndirs++) {
g = (struct globval *)sh_malloc((sizeof(struct globval)), "glob.c", 625);
if (g == 0) {
while (ret) {
g = ret->next;
sh_xfree((ret), "glob.c", 631);
ret = g;
}
sh_xfree((r), "glob.c", 635);
if (np)
*np = 0;
if (ep)
*ep = 0;
return (&finddirs_error_return);
}
if (e == 0)
e = g;
g->next = ret;
ret = g;
g->name = r[ndirs];
}
sh_xfree((r), "glob.c", 651);
if (ep)
*ep = e;
if (np)
*np = ndirs;
return ret;
} | int finddirs(unsigned long long a0, unsigned long long a1, unsigned long a2,
unsigned long long *a3, unsigned int *a4) {
unsigned int v0;
void *v1;
void *v2;
unsigned long long *v3;
void *v4;
unsigned int v6;
v1 = 0;
v2 = v1;
v3 = glob_vector(a0, a1, a2);
if (!v3) {
LABEL_400efc:
if (a4)
*(a4) = 0;
if (a3)
*(a3) = 0;
if (v3 && v3 != 4194312)
sh_xfree(v3, "glob.c", 0x26c);
v6 = 0;
} else {
if (!*(v3))
goto LABEL_400efc;
v0 = 0;
while (true) {
if (!v3[v0]) {
sh_xfree(v3, "glob.c", 0x28b);
if (a3)
*(a3) = v2;
if (a4)
*(a4) = v0;
v6 = v1;
break;
} else if (v4) {
if (!v2)
v2 = v4;
*(v4) = v1;
v1 = v4;
*(&v4[8]) = v3[v0];
v0 += 1;
} else {
for (v4 = sh_malloc(0x10, "glob.c", 0x271); v1; v1 = v4) {
v4 = *(v1);
sh_xfree(v1, "glob.c", 0x277);
}
sh_xfree(v3, "glob.c", 0x27b);
if (a4)
*(a4) = 0;
if (a3)
*(a3) = 0;
v6 = &finddirs_error_return;
break;
}
}
}
return v6;
} | bash | angr_phoenix |
static uint64 getClockFileAccess(void) {
return __sync_fetch_and_add(&clockFileAccess, 1);
} | int getClockFileAccess(unsigned long a0, unsigned long a1, unsigned long a2,
unsigned long a3, unsigned long a4, unsigned long a5,
unsigned long v0, unsigned long a6) {
int tmp_11;
int tmp_4;
int tmp_0;
unsigned long long v1;
v1 = 1;
while (true) {
clockFileAccess = clockFileAccess + v1;
tmp_11 = BinaryOp CasCmpNE;
v1 = clockFileAccess;
return clockFileAccess;
}
} | rsyslog-8.2210.0 | angr_dream |
void crypto_sign_ed25519_ref_sc25519_from_shortsc(
crypto_sign_ed25519_ref_sc25519 *r,
const crypto_sign_ed25519_ref_shortsc25519 *x) {
int i;
for (i = 0; i < 16; i++)
r->v[i] = x->v[i];
for (i = 0; i < 16; i++)
r->v[16 + i] = 0;
} | void crypto_sign_ed25519_ref_sc25519_from_shortsc(unsigned int *a0,
unsigned int *a1) {
unsigned int v0;
unsigned long long v3;
unsigned int *v4;
for (v0 = 0; v0 <= 15; v0 = __addvsi3(v0, 0x1, v0)) {
a0[v0] = a1[v0];
}
for (v0 = 0; v0 <= 15; v0 = __addvsi3(v0, 0x1, v4)) {
v4 = __addvsi3(v0, 0x10, v3);
*((a0 + 0x4 * v4)) = 0;
}
return;
} | openssh-portable | angr_dream |
static void restore_default_color(void) {
put_indicator(&color_indicator[C_LEFT]);
put_indicator(&color_indicator[C_RIGHT]);
} | void restore_default_color() {
unsigned long long v1;
put_indicator(&color_indicator);
v1 = put_indicator(&g_410710);
return;
} | coreutils | angr_dream |
void push_dollar_vars() {
if (dollar_arg_stack_index + 2 > dollar_arg_stack_slots) {
dollar_arg_stack = (struct saved_dollar_vars *)sh_xrealloc(
(dollar_arg_stack),
((dollar_arg_stack_slots += 10) * sizeof(struct saved_dollar_vars)),
"variables.c", 5660);
}
dollar_arg_stack[dollar_arg_stack_index].count = posparam_count;
dollar_arg_stack[dollar_arg_stack_index].first_ten = save_dollar_vars();
dollar_arg_stack[dollar_arg_stack_index++].rest = rest_of_args;
rest_of_args = (WORD_LIST *)((void *)0);
posparam_count = 0;
dollar_arg_stack[dollar_arg_stack_index].first_ten = (char **)((void *)0);
dollar_arg_stack[dollar_arg_stack_index].rest = (WORD_LIST *)((void *)0);
} | void push_dollar_vars(void)
{
undefined8 *puVar1;
undefined8 uVar2;
long lVar3;
if (dollar_arg_stack_slots <= dollar_arg_stack_index + 1) {
dollar_arg_stack_slots = dollar_arg_stack_slots + 10;
dollar_arg_stack =
sh_xrealloc(dollar_arg_stack, (long)dollar_arg_stack_slots * 0x18,
"variables.c", 0x161c);
}
*(undefined4 *)(dollar_arg_stack + (long)dollar_arg_stack_index * 0x18 +
0x10) = posparam_count;
puVar1 =
(undefined8 *)(dollar_arg_stack + (long)dollar_arg_stack_index * 0x18);
uVar2 = save_dollar_vars();
*puVar1 = uVar2;
lVar3 = (long)dollar_arg_stack_index;
dollar_arg_stack_index = dollar_arg_stack_index + 1;
*(undefined8 *)(dollar_arg_stack + lVar3 * 0x18 + 8) = rest_of_args;
rest_of_args = 0;
posparam_count = 0;
*(undefined8 *)((long)dollar_arg_stack_index * 0x18 + dollar_arg_stack) = 0;
*(undefined8 *)((long)dollar_arg_stack_index * 0x18 + dollar_arg_stack + 8) =
0;
return;
} | bash | ghidra |
static inline void emit_stdin_note(void) {
fputs_unlocked(
gettext("\nWith no FILE, or when FILE is -, read standard input.\n"),
stdout)
;
} | void emit_stdin_note() {
unsigned long long v1;
v1 = fputs_unlocked(
gettext("\nWith no FILE, or when FILE is -, read standard input.\n"),
stdout);
return;
} | coreutils | angr_sailr |
terminal_clear_EOL(EditLine *el, int num) {
int i;
if (((el)->el_terminal.t_flags & 0x004) &&
(el->el_terminal.t_str[3] != ((void *)0) &&
el->el_terminal.t_str[3][0] != '\0'))
terminal_tputs(el, el->el_terminal.t_str[3], 1);
else {
for (i = 0; i < num; i++)
terminal__putc(el, ' ');
el->el_cursor.h += num;
}
} | int terminal_clear_EOL(long a1, int a2) {
int result;
int i;
if ((*(_DWORD *)(a1 + 152) & 4) != 0 &&
*(_QWORD *)(*(_QWORD *)(a1 + 176) + 24LL) &&
**(_BYTE **)(*(_QWORD *)(a1 + 176) + 24LL)) {
return terminal_tputs(a1, *(const char **)(*(_QWORD *)(a1 + 176) + 24LL),
1);
}
for (i = 0; i < a2; ++i)
terminal__putc(a1, 0x20u);
result = a1;
*(_DWORD *)(a1 + 48) += a2;
return result;
} | libedit | ida |
char *gzip_base_name(fname)
char *fname;
{
fname = last_component(fname);
if (('A') == 'a')
strlwr(fname);
return fname;
} | undefined8 gzip_base_name(undefined8 param_1)
{
undefined8 uVar1;
uVar1 = last_component(param_1);
return uVar1;
} | gzip-1.12 | ghidra |
static const char *idname_lookup(struct idname_tree *tree, u_int id) {
struct idname idname, *found;
memset(&idname, 0, sizeof(idname));
idname.id = id;
if ((found = idname_tree_RB_FIND(tree, &idname)) != ((void *)0))
return found->name;
return ((void *)0);
} | long idname_lookup(long *a1, int a2) {
long v3;
int s[14];
unsigned long v5;
v5 = __readfsqword(0x28u);
memset(s, 0, 0x30uLL);
s[0] = a2;
v3 = idname_tree_RB_FIND(a1, s);
if (v3)
return *(_QWORD *)(v3 + 8);
else
return 0LL;
} | openssh-portable | ida |
static void do_convert_to_pem(struct sshkey *k) {
switch (sshkey_type_plain(k->type)) {
case KEY_RSA:
if (!PEM_write_RSAPublicKey(stdout, k->rsa))
sshfatal("ssh-keygen.c", __func__, 405, 0, SYSLOG_LEVEL_FATAL,
((void *)0), "PEM_write_RSAPublicKey failed");
break;
case KEY_DSA:
if (!PEM_write_DSA_PUBKEY(stdout, k->dsa))
sshfatal("ssh-keygen.c", __func__, 409, 0, SYSLOG_LEVEL_FATAL,
((void *)0), "PEM_write_DSA_PUBKEY failed");
break;
case KEY_ECDSA:
if (!PEM_write_EC_PUBKEY(stdout, k->ecdsa))
sshfatal("ssh-keygen.c", __func__, 414, 0, SYSLOG_LEVEL_FATAL,
((void *)0), "PEM_write_EC_PUBKEY failed");
break;
default:
sshfatal("ssh-keygen.c", __func__, 418, 1, SYSLOG_LEVEL_FATAL, ((void *)0),
"unsupported key type %s", sshkey_type(k));
}
exit(0);
} | void do_convert_to_pem(unsigned long long a0) {
unsigned long long v0;
unsigned long v1;
char v2;
unsigned long long v4;
v0 = a0;
v4 = sshkey_type_plain(*(v0));
if (v4 != 2) {
if (!(v4 <= 2))
goto LABEL_400be3;
if (!v4) {
if (!(!PEM_write_RSAPublicKey(stdout, *((v0 + 8)), *((v0 + 8)))))
goto LABEL_400c26;
sshfatal("ssh-keygen.c", "do_convert_to_pem", 0x195, 0x0, 0x1, 0x0,
"PEM_write_RSAPublicKey failed");
} else if (!(v4 == 1)) {
goto LABEL_400be3;
}
if (!(!PEM_write_DSA_PUBKEY(stdout, *((v0 + 16)), *((v0 + 16)))))
goto LABEL_400c26;
v0 = "PEM_write_DSA_PUBKEY failed";
sshfatal("ssh-keygen.c", "do_convert_to_pem", 0x199, 0x0, 0x1, 0x0, *(&v2));
}
if (!(!PEM_write_EC_PUBKEY(stdout, *((v0 + 32)), *((v0 + 32)))))
goto LABEL_400c26;
v0 = "PEM_write_EC_PUBKEY failed";
sshfatal("ssh-keygen.c", "do_convert_to_pem", 0x19e, 0x0, 0x1, 0x0, *(&v2));
LABEL_400be3:
v1 = sshkey_type(v0);
v0 = "unsupported key type %s";
sshfatal("ssh-keygen.c", "do_convert_to_pem", 0x1a2, 0x1, 0x1, 0x0, *(&v2));
LABEL_400c26:
exit(0x0);
} | openssh-portable | angr_phoenix |
char *remove_backslashes(string)
char *string;
{
char *r, *ret, *s;
r = ret = (char *)sh_xmalloc((strlen(string) + 1), "subst.c", 4079);
for (s = string; s && *s;) {
if (*s == '\\')
s++;
if (*s == 0)
break;
*r++ = *s++;
}
*r = '\0';
return ret;
} | long remove_backslashes(const char *a1) {
size_t v1;
const char *v2;
char *v3;
char *v5;
const char *v6;
long v7;
v1 = strlen(a1);
v7 = sh_xmalloc(v1 + 1, "subst.c", 4079LL);
v5 = (char *)v7;
v6 = a1;
while (v6 && *v6) {
if (*v6 == 92)
++v6;
if (!*v6)
break;
v2 = v6++;
v3 = v5++;
*v3 = *v2;
}
*v5 = 0;
return v7;
} | bash | ida |
static u_int get_status(struct sftp_conn *conn, u_int expected_id) {
struct sshbuf *msg;
u_char type;
u_int id, status;
int r;
if ((msg = sshbuf_new()) == ((void *)0))
sshfatal("sftp-client.c", __func__, 280, 1, SYSLOG_LEVEL_FATAL, ((void *)0),
"sshbuf_new failed");
get_msg(conn, msg);
if ((r = sshbuf_get_u8(msg, &type)) != 0 ||
(r = sshbuf_get_u32(msg, &id)) != 0)
sshfatal("sftp-client.c", __func__, 284, 1, SYSLOG_LEVEL_FATAL, ssh_err(r),
"compose");
if (id != expected_id)
sshfatal("sftp-client.c", __func__, 287, 0, SYSLOG_LEVEL_FATAL, ((void *)0),
"ID mismatch (%u != %u)", id, expected_id);
if (type != 101)
sshfatal("sftp-client.c", __func__, 289, 0, SYSLOG_LEVEL_FATAL, ((void *)0),
"Expected SSH2_FXP_STATUS(%u) packet, got %u", 101, type);
if ((r = sshbuf_get_u32(msg, &status)) != 0)
sshfatal("sftp-client.c", __func__, 293, 1, SYSLOG_LEVEL_FATAL, ssh_err(r),
"parse");
sshbuf_free(msg);
sshlog("sftp-client.c", __func__, 296, 0, SYSLOG_LEVEL_DEBUG3, ((void *)0),
"SSH2_FXP_STATUS %u", status);
return status;
} | long get_status(unsigned int *a1, unsigned int a2) {
long v2;
long v3;
unsigned char v5;
unsigned int v6;
unsigned int v7;
unsigned int u8;
long v9;
unsigned long v10;
v10 = __readfsqword(0x28u);
v9 = sshbuf_new();
if (!v9)
sshfatal("sftp-client.c", "get_status", 280LL, 1LL, 1LL, 0LL,
"sshbuf_new failed");
get_msg(a1, v9);
u8 = sshbuf_get_u8(v9, &v5);
if (u8 || (u8 = sshbuf_get_u32(v9, &v6)) != 0) {
v2 = ssh_err(u8);
sshfatal("sftp-client.c", "get_status", 284LL, 1LL, 1LL, v2, "compose");
}
if (a2 != v6)
sshfatal("sftp-client.c", "get_status", 287LL, 0LL, 1LL, 0LL,
"ID mismatch (%u != %u)", v6, a2);
if (v5 != 101)
sshfatal("sftp-client.c", "get_status", 289LL, 0LL, 1LL, 0LL,
"Expected SSH2_FXP_STATUS(%u) packet, got %u", 101LL, v5);
u8 = sshbuf_get_u32(v9, &v7);
if (u8) {
v3 = ssh_err(u8);
sshfatal("sftp-client.c", "get_status", 293LL, 1LL, 1LL, v3, "parse");
}
sshbuf_free(v9);
sshlog("sftp-client.c", "get_status", 296LL, 0LL, 7LL, 0LL,
"SSH2_FXP_STATUS %u", v7);
return v7;
} | openssh-portable | ida |
char *env_get(const char *name, char **envp) {
size_t len = strlen(name);
char *p, *q;
while ((p = *envp++) != ((void *)0)) {
if (!(q = strchr(p, '=')))
continue;
if ((size_t)(q - p) == len && !strncmp(p, name, len))
return (q + 1);
}
return (((void *)0));
} | int env_get(char *a0, unsigned long a1) {
unsigned long long *v0;
int tmp_11;
unsigned int v1;
char *v2;
unsigned long v3;
unsigned int v5;
v0 = a1;
*(&v1) = strlen(a0);
while (true) {
tmp_11 = v0;
v0 += 1;
v2 = *(tmp_11);
if (v2) {
v3 = strchr(v2, 0x3d);
if (!v3)
continue;
if (v3 + -0x1 * v2 != *(&v1))
continue;
v5 = strncmp(v2, a0, *(&v1));
if (v5)
continue;
v5 = v3 + 1;
break;
} else {
v5 = 0;
break;
}
}
return v5;
} | cronie | angr_dream |
static void zero_pad(UINT8 *p, int nbytes) {
if (nbytes >= (int)sizeof(UWORD)) {
while ((ptrdiff_t)p % sizeof(UWORD)) {
*p = 0;
nbytes--;
p++;
}
while (nbytes >= (int)sizeof(UWORD)) {
*(UWORD *)p = 0;
nbytes -= sizeof(UWORD);
p += sizeof(UWORD);
}
}
while (nbytes) {
*p = 0;
nbytes--;
p++;
}
} | void zero_pad(unsigned long a0, unsigned long a1) {
unsigned int v0;
void *v1;
unsigned long long v3;
unsigned long long v4;
v1 = a0;
v0 = a1;
if (v0 > 3) {
while (true) {
v3 = v1 & 3;
if (!(v1 & 3))
break;
*(v1) = 0;
v0 = __addvsi3(v0, 0xffffffff);
v1 += 1;
}
for (; v0 > 3; v1 += 4) {
*(v1) = 0;
v4 = v0 - 4;
v0 = v0 - 4;
}
}
for (; v0; v1 += 1) {
*(v1) = 0;
v0 = __addvsi3(v0, 0xffffffff);
}
return;
} | openssh-portable | angr_phoenix |
static int output_symbols(struct depmod *depmod, FILE *out) {
struct hash_iter iter;
const void *v;
fputs("# Aliases for symbols, used by symbol_request().\n", out);
hash_iter_init(depmod->symbols, &iter);
while (hash_iter_next(&iter, ((void *)0), &v)) {
const struct symbol *sym = v;
if (sym->owner == ((void *)0))
continue;
fprintf(out, "alias symbol:%s %s\n", sym->name, sym->owner->modname);
}
return 0;
} | long output_symbols(long a1, FILE *a2) {
const char *v3;
const char *v4;
char v5[24];
unsigned long v6;
v6 = __readfsqword(0x28u);
fputs("# Aliases for symbols, used by symbol_request().\n", a2);
hash_iter_init(*(_QWORD *)(a1 + 64), v5);
while ((unsigned char)hash_iter_next(v5, 0LL, &v3)) {
v4 = v3;
if (*(_QWORD *)v3)
fprintf(a2, "alias symbol:%s %s\n", v4 + 16,
(const char *)(*(_QWORD *)v4 + 120LL));
}
return 0LL;
} | kmod | ida |
void cfg_init(void) {
memset(&cfg, 0, sizeof(cfg));
cfg.path_len = -1;
cfg.skip_certs = -1;
} | _DWORD *cfg_init() {
_DWORD *result;
memset(cfg, 0, 0x2A8uLL);
cfg[136] = -1;
result = cfg;
cfg[134] = -1;
return result;
} | gnutls | ida |
int do_rename(struct sftp_conn *conn, const char *oldpath, const char *newpath,
int force_legacy) {
struct sshbuf *msg;
u_int status, id;
int r, use_ext = (conn->exts & 0x00000001) && !force_legacy;
if ((msg = sshbuf_new()) == ((void *)0))
sshfatal("sftp-client.c", __func__, 1216, 1, SYSLOG_LEVEL_FATAL,
((void *)0), "sshbuf_new failed");
id = conn->msg_id++;
if (use_ext) {
sshlog("sftp-client.c", __func__, 1221, 0, SYSLOG_LEVEL_DEBUG2, ((void *)0),
"Sending SSH2_FXP_EXTENDED(posix-rename@openssh.com) "
"\"%s\" to \"%s\"",
oldpath, newpath);
if ((r = sshbuf_put_u8(msg, 200)) != 0 ||
(r = sshbuf_put_u32(msg, id)) != 0 ||
(r = sshbuf_put_cstring(msg, "posix-rename@openssh.com")) != 0)
sshfatal("sftp-client.c", __func__, 1227, 1, SYSLOG_LEVEL_FATAL,
ssh_err(r), "compose posix-rename");
} else {
sshlog("sftp-client.c", __func__, 1229, 0, SYSLOG_LEVEL_DEBUG2, ((void *)0),
"Sending SSH2_FXP_RENAME \"%s\" to \"%s\"", oldpath, newpath);
if ((r = sshbuf_put_u8(msg, 18)) != 0 || (r = sshbuf_put_u32(msg, id)) != 0)
sshfatal("sftp-client.c", __func__, 1233, 1, SYSLOG_LEVEL_FATAL,
ssh_err(r), "compose rename");
}
if ((r = sshbuf_put_cstring(msg, oldpath)) != 0 ||
(r = sshbuf_put_cstring(msg, newpath)) != 0)
sshfatal("sftp-client.c", __func__, 1237, 1, SYSLOG_LEVEL_FATAL, ssh_err(r),
"compose paths");
send_msg(conn, msg);
sshlog("sftp-client.c", __func__, 1239, 0, SYSLOG_LEVEL_DEBUG3, ((void *)0),
"Sent message %s \"%s\" -> \"%s\"",
use_ext ? "posix-rename@openssh.com" : "SSH2_FXP_RENAME", oldpath,
newpath)
;
sshbuf_free(msg);
status = get_status(conn, id);
if (status != 0)
sshlog("sftp-client.c", __func__, 1246, 0, SYSLOG_LEVEL_ERROR, ((void *)0),
"remote rename \"%s\" to \"%s\": %s", oldpath, newpath,
fx2txt(status));
return status == 0 ? 0 : -1;
} | long do_rename(unsigned int *a1, const char *a2, const char *a3, int a4) {
_BOOL4 v4;
unsigned int v5;
long v6;
long v7;
long v8;
const char *v9;
const char *v10;
unsigned int v13;
unsigned int v14;
unsigned int v15;
_BOOL4 v16;
unsigned int v17;
unsigned int status;
long v19;
v4 = (a1[7] & 1) != 0 && !a4;
v16 = v4;
v19 = sshbuf_new();
if (!v19)
sshfatal("sftp-client.c", "do_rename", 1216LL, 1LL, 1LL, 0LL,
"sshbuf_new failed");
v5 = a1[6];
a1[6] = v5 + 1;
v17 = v5;
if (v16) {
sshlog(
"sftp-client.c", "do_rename", 1221LL, 0LL, 6LL, 0LL,
"Sending SSH2_FXP_EXTENDED(posix-rename@openssh.com) \"%s\" to \"%s\"",
a2, a3);
v13 = sshbuf_put_u8(v19, 200LL);
if (!v13) {
v13 = sshbuf_put_u32(v19, v17);
if (!v13) {
v13 = sshbuf_put_cstring(v19, "posix-rename@openssh.com");
if (!v13)
goto LABEL_15;
}
}
v6 = ssh_err(v13);
sshfatal("sftp-client.c", "do_rename", 1227LL, 1LL, 1LL, v6,
"compose posix-rename");
}
sshlog("sftp-client.c", "do_rename", 1229LL, 0LL, 6LL, 0LL,
"Sending SSH2_FXP_RENAME \"%s\" to \"%s\"", a2, a3);
v14 = sshbuf_put_u8(v19, 18LL);
if (v14 || (v14 = sshbuf_put_u32(v19, v17)) != 0) {
v7 = ssh_err(v14);
sshfatal("sftp-client.c", "do_rename", 1233LL, 1LL, 1LL, v7,
"compose rename");
}
LABEL_15:
v15 = sshbuf_put_cstring(v19, a2);
if (v15 || (v15 = sshbuf_put_cstring(v19, a3)) != 0) {
v8 = ssh_err(v15);
sshfatal("sftp-client.c", "do_rename", 1237LL, 1LL, 1LL, v8,
"compose paths");
}
send_msg((long)a1, v19);
if (v16)
v9 = "posix-rename@openssh.com";
else
v9 = "SSH2_FXP_RENAME";
sshlog("sftp-client.c", "do_rename", 1239LL, 0LL, 7LL, 0LL,
"Sent message %s \"%s\" -> \"%s\"", v9, a2, a3);
sshbuf_free(v19);
status = get_status(a1, v17);
if (!status)
return 0LL;
v10 = (const char *)fx2txt(status);
sshlog("sftp-client.c", "do_rename", 1246LL, 0LL, 2LL, 0LL,
"remote rename \"%s\" to \"%s\": %s", a2, a3, v10);
return 0xFFFFFFFFLL;
} | openssh-portable | ida |
static intmax_t and(int token, union yystype *val, int op, int noeval) {
intmax_t a = binop(token, val, op, noeval);
intmax_t b;
op = last_token;
if (op != 3)
return a;
token = yylex();
*val = yylval;
b = and(token, val, yylex(), noeval | !a);
return a && b;
} | long and(undefined4 param_1, undefined8 *param_2, undefined4 param_3,
uint param_4)
{
undefined4 uVar1;
undefined4 uVar2;
int iVar3;
long lVar4;
long lVar5;
lVar4 = binop(param_1, param_2, param_3, param_4);
if (last_token == 3) {
uVar1 = yylex();
*param_2 = yylval;
uVar2 = yylex();
lVar5 = and(uVar1, param_2, uVar2, lVar4 == 0 | param_4);
if ((lVar4 == 0) || (lVar5 == 0)) {
iVar3 = 0;
} else {
iVar3 = 1;
}
lVar4 = (long)iVar3;
}
return lVar4;
} | dash-0.5.11+git20210903+057cd650a4ed | ghidra |
z_size_t gzfwrite(buf, size, nitems, file)
voidpc buf;
z_size_t size;
z_size_t nitems;
gzFile file;
{
z_size_t len;
gz_statep state;
if (file == ((void *)0))
return 0;
state = (gz_statep)file;
if (state->mode != 31153 || state->err != 0)
return 0;
len = nitems * size;
if (size && len / size != nitems) {
gz_error(state, (-2), "request does not fit in a size_t");
return 0;
}
return len ? gz_write(state, buf, len) / size : 0;
} | long long gzfwrite(void *a0, unsigned int a1, unsigned long a2,
unsigned int a3[30]) {
unsigned int v0;
void *v2;
if (!a3) {
v2 = 0;
} else {
if (a3[6] == 31153 && !a3[29]) {
*(&v0) = a1 * a2;
if (a1 && a2 != (0 CONCAT * (&v0)) / m a1) {
gz_error(a3, 0xfffffffe, "request does not fit in a size_t");
v2 = 0;
}
if (!a1 || a2 == (0 CONCAT * (&v0)) / m a1) {
if (*(&v0))
v2 = (0 CONCAT gz_write(a3, a0, *(&v0))) / m a1;
else
v2 = 0;
}
}
if (a3[6] != 31153 || a3[29])
v2 = 0;
}
return v2;
} | zlib | angr_dream |
void monotime_ts(struct timespec *ts) {
struct timeval tv;
static int gettime_failed = 0;
if (!gettime_failed) {
if (clock_gettime(7, ts) == 0)
return;
if (clock_gettime(1, ts) == 0)
return;
if (clock_gettime(0, ts) == 0)
return;
sshlog("misc.c", __func__, 1680, 0, SYSLOG_LEVEL_DEBUG3, ((void *)0),
"clock_gettime: %s", strerror((*__errno_location())));
gettime_failed = 1;
}
gettimeofday(&tv, ((void *)0));
ts->tv_sec = tv.tv_sec;
ts->tv_nsec = (long)tv.tv_usec * 1000;
} | void monotime_ts(unsigned long long a0[2]) {
char v0;
char v1;
char v2;
unsigned long long *v4;
unsigned long long v5;
if (gettime_failed.13126) {
gettimeofday(&v0, NULL);
a0[0] = *(&v0);
a0[1] = __mulvdi3(*(&v1), 0x3e8);
} else if (clock_gettime(0x7, a0) && clock_gettime(0x1, a0) &&
clock_gettime(0x0, a0)) {
sshlog("misc.c", "monotime_ts", 0x690, 0x0, 0x7, 0x0, "clock_gettime: %s",
strerror(*(__errno_location())));
gettime_failed.13126 = 1;
gettimeofday(&v0, NULL);
a0[0] = *(&v0);
a0[1] = __mulvdi3(*(&v1), 0x3e8);
}
v5 = *(&v2) ^ v4[5];
return;
} | openssh-portable | angr_sailr |
static off_t xlseek(int fd, off_t offset, int whence, char const *filename) {
off_t new_offset = lseek(fd, offset, whence);
char buf[((((((sizeof(offset) * 8) -
(!((__typeof__(offset))0 < (__typeof__(offset))-1))) *
146 +
484) /
485) +
(!((__typeof__(offset))0 < (__typeof__(offset))-1))) +
1)];
char *s;
if (0 <= new_offset)
return new_offset;
s = offtostr(offset, buf);
switch (whence) {
case 0:
error(0, (*__errno_location()), gettext("%s: cannot seek to offset %s"),
quotearg_n_style_colon(0, shell_escape_quoting_style, filename), s);
break;
case 1:
error(0, (*__errno_location()),
gettext("%s: cannot seek to relative offset %s"),
quotearg_n_style_colon(0, shell_escape_quoting_style, filename), s);
break;
case 2:
error(0, (*__errno_location()),
gettext("%s: cannot seek to end-relative offset %s"),
quotearg_n_style_colon(0, shell_escape_quoting_style, filename), s);
break;
default:
abort();
}
exit(1);
} | __off_t xlseek(int a1, __off_t a2, int a3, long a4) {
long v5;
char *v6;
int *v7;
long v8;
char *v9;
int *v10;
long v11;
char *v12;
int *v13;
__off_t v16;
long v17;
char v18[24];
unsigned long v19;
v19 = __readfsqword(0x28u);
v16 = lseek(a1, a2, a3);
if (v16 < 0) {
v17 = offtostr(a2, v18);
if (a3 == 2) {
v11 = quotearg_n_style_colon(0LL, 3LL, a4);
v12 = gettext("%s: cannot seek to end-relative offset %s");
v13 = _errno_location();
error(0, *v13, v12, v11, v17);
} else {
if (a3 > 2)
goto LABEL_11;
if (a3) {
if (a3 != 1)
LABEL_11:
abort();
v8 = quotearg_n_style_colon(0LL, 3LL, a4);
v9 = gettext("%s: cannot seek to relative offset %s");
v10 = _errno_location();
error(0, *v10, v9, v8, v17);
} else {
v5 = quotearg_n_style_colon(0LL, 3LL, a4);
v6 = gettext("%s: cannot seek to offset %s");
v7 = _errno_location();
error(0, *v7, v6, v5, v17);
}
}
exit(1);
}
return v16;
} | coreutils | ida |
static Int32 bsGetBit(BitStream *bs) {
if (bs->buffLive > 0) {
bs->buffLive--;
return (((bs->buffer) >> (bs->buffLive)) & 0x1);
} else {
Int32 retVal = getc(bs->handle);
if (retVal == (-1)) {
if ((*__errno_location()) != 0)
readError();
return 2;
}
bs->buffLive = 7;
bs->buffer = retVal;
return (((bs->buffer) >> 7) & 0x1);
}
} | long bsGetBit(long a1) {
int v2;
if (*(int *)(a1 + 12) <= 0) {
v2 = getc(*(FILE **)a1);
if (v2 == -1) {
if (*_errno_location())
readError();
return 2LL;
} else {
*(_DWORD *)(a1 + 12) = 7;
*(_DWORD *)(a1 + 8) = v2;
return (*(int *)(a1 + 8) >> 7) & 1;
}
} else {
return (*(int *)(a1 + 8) >> --*(_DWORD *)(a1 + 12)) & 1;
}
} | bzip2 | ida |
static inline void emit_ancillary_info(char const *program) {
struct infomap {
char const *program;
char const *node;
} const infomap[] = {
{"[", "test invocation"}, {"coreutils", "Multi-call invocation"},
{"sha224sum", "sha2 utilities"}, {"sha256sum", "sha2 utilities"},
{"sha384sum", "sha2 utilities"}, {"sha512sum", "sha2 utilities"},
{((void *)0), ((void *)0)}};
char const *node = program;
struct infomap const *map_prog = infomap;
while (map_prog->program && !(strcmp(program, map_prog->program) == 0))
map_prog++;
if (map_prog->node)
node = map_prog->node;
printf (gettext ("\n%s online help: <%s>\n"), "GNU coreutils", "https:
char const *lc_messages = setlocale (
5
,
((void *)0)
);
if (lc_messages && strncmp (lc_messages, "" "en_" "", sizeof ("en_") - 1))
{
fputs_unlocked (gettext ("Report any translation bugs to " "<https:
stdout
)
;
}
char const *url_program = (strcmp (program, "[") == 0) ? "test" : program;
printf (gettext ("Full documentation <%s%s>\n"),
"https:
printf (gettext ("or available locally via: info '(coreutils) %s%s'\n"),
node, node == program ? " invocation" : "");
} | void emit_ancillary_info(char *a0) {
unsigned long v0;
unsigned long long v1[2];
char *v2;
unsigned long long v3;
unsigned long long v4;
unsigned long long v5;
unsigned long long v6;
unsigned long long v7;
unsigned long long v8;
unsigned long long v9;
unsigned long long v10;
unsigned long long v11;
unsigned long long v12;
unsigned long long v13;
unsigned long long v14;
unsigned long long v15;
void *v16;
void *v17;
char v18;
unsigned long long v20;
unsigned long long *v21;
unsigned long long v22;
v4 = "[";
v5 = "test invocation";
v6 = "coreutils";
v7 = "Multi-call invocation";
v8 = "sha224sum";
v9 = "sha2 utilities";
v10 = "sha256sum";
v11 = "sha2 utilities";
v12 = "sha384sum";
v13 = "sha2 utilities";
v14 = "sha512sum";
v15 = "sha2 utilities";
v16 = 0;
v17 = 0;
v0 = a0;
v1[0] = &v4;
while (true) {
if (!v1[0])
break;
if (!strcmp(a0, v1[0]))
break;
v1[0] = v1 + 1;
}
if (v1[1])
v0 = v1[1];
printf(gettext("\n%s online help: <%s>\n"));
v2 = setlocale(0x5, NULL);
if (v2 && strncmp(v2, "en_", 0x3))
fputs_unlocked(gettext("Report any translation bugs to <https:
if (!strcmp(a0, "["))
v20 = "test";
else
v20 = a0;
v3 = v20;
printf(gettext("Full documentation <%s%s>\n"));
printf(gettext("or available locally via: info '(coreutils) %s%s'\n"));
v22 = *(&v18) ^ v21[5];
return;
} | coreutils | angr_phoenix |
read_finish(EditLine *el) {
if ((el->el_flags & 0x008) == 0)
(void)tty_cookedmode(el);
if (el->el_flags & 0x001)
sig_clr(el);
} | void read_finish(struct_0 *a0) {
unsigned long long v1;
unsigned long long v2;
if (!(a0->field_2c & 8))
tty_cookedmode(a0);
v1 = a0->field_2c & 1;
if ((a0->field_2c & 1))
v2 = sig_clr(a0);
return;
} | libedit | angr_phoenix |
static void atime_coder(struct tar_stat_info const *st, char const *keyword,
struct xheader *xhdr,
void const *data __attribute__((unused))) {
code_time(st->atime, keyword, xhdr);
} | long long atime_coder(unsigned long long a0[31], unsigned long a1, void *a2,
unsigned long a3) {
unsigned long v0;
v0 = a3;
return code_time(a0[29], a0[30], a1, a2);
} | tar | angr_sailr |
static _Bool
parse_exec(const struct parser_table *entry, char **argv, int *arg_ptr) {
return insert_exec_ok("-exec", entry, argv, arg_ptr);
} | long parse_exec(long a1, long a2, int *a3) {
return insert_exec_ok((long)"-exec", a1, a2, a3);
} | findutils | ida |
static SHELL_VAR *assign_dirstack(self, value, ind, key)
SHELL_VAR *self;
char *value;
arrayind_t ind;
char *key;
{
set_dirstack_element(ind, 1, value);
return self;
} | undefined8 assign_dirstack(undefined8 param_1, undefined8 param_2,
undefined8 param_3)
{
set_dirstack_element(param_3, 1, param_2);
return param_1;
} | bash | ghidra |
static void print_tunsrc(struct rtattr *attrs[]) {
const char *dst = rt_addr_n2a(
10, 16,
((void *)(((char *)(attrs[SEG6_ATTR_DST])) +
((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0)))));
print_string(PRINT_ANY, "tunsrc", "tunsrc addr %s\n", dst);
} | void print_tunsrc(struct_0 *a0) {
unsigned long long v0;
unsigned long long v2;
v0 = rt_addr_n2a(0xa, 0x10, a0->field_8 + 4);
v2 = print_string(0x4, "tunsrc", "tunsrc addr %s\n", v0);
return;
} | iproute2-6.0.0 | angr_dream |
int mm_send_fd(int sock, int fd) {
struct msghdr msg;
union {
struct cmsghdr hdr;
char buf[(
(((sizeof(int)) + sizeof(size_t) - 1) & (size_t)~(sizeof(size_t) - 1)) +
(((sizeof(struct cmsghdr)) + sizeof(size_t) - 1) &
(size_t)~(sizeof(size_t) - 1)))];
} cmsgbuf;
struct cmsghdr *cmsg;
struct iovec vec;
char ch = '\0';
ssize_t n;
struct pollfd pfd;
memset(&msg, 0, sizeof(msg));
memset(&cmsgbuf, 0, sizeof(cmsgbuf));
msg.msg_control = (caddr_t)&cmsgbuf.buf;
msg.msg_controllen = sizeof(cmsgbuf.buf);
cmsg = ((size_t)(&msg)->msg_controllen >= sizeof(struct cmsghdr)
? (struct cmsghdr *)(&msg)->msg_control
: (struct cmsghdr *)0);
cmsg->cmsg_len = ((((sizeof(struct cmsghdr)) + sizeof(size_t) - 1) &
(size_t)~(sizeof(size_t) - 1)) +
(sizeof(int)));
cmsg->cmsg_level = 1;
cmsg->cmsg_type = SCM_RIGHTS;
*(int *)((cmsg)->__cmsg_data) = fd;
vec.iov_base = &ch;
vec.iov_len = 1;
msg.msg_iov = &vec;
msg.msg_iovlen = 1;
pfd.fd = sock;
pfd.events = 0x004;
while ((n = sendmsg(sock, &msg, 0)) == -1 &&
((*__errno_location()) == 11 || (*__errno_location()) == 4)) {
sshlog("monitor_fdpass.c", __func__, 92, 1, SYSLOG_LEVEL_DEBUG3,
((void *)0), "sendmsg(%d): %s", fd, strerror((*__errno_location())));
(void)poll(&pfd, 1, -1);
}
if (n == -1) {
sshlog("monitor_fdpass.c", __func__, 96, 1, SYSLOG_LEVEL_ERROR, ((void *)0),
"sendmsg(%d): %s", fd, strerror((*__errno_location())));
return -1;
}
if (n != 1) {
sshlog("monitor_fdpass.c", __func__, 101, 1, SYSLOG_LEVEL_ERROR,
((void *)0), "sendmsg: expected sent 1 got %zd", n);
return -1;
}
return 0;
} | long long mm_send_fd(unsigned long a0, unsigned long a1) {
char v0;
void *v1;
unsigned long long v2;
unsigned int v3;
unsigned short v4;
unsigned long v5;
unsigned long long v6;
char v7;
unsigned long v8;
unsigned long long v9;
void *v10;
unsigned long long v11;
char v12;
void *v14;
unsigned long long v15;
v0 = 0;
memset(&v7, 0x0, 0x38);
memset(&v12, 0x0, 0x18);
v10 = &v12;
v11 = 24;
if (v11 <= 15)
v14 = 0;
else
v14 = v10;
v1 = v14;
*(v1) = 20;
*(&v1[8]) = 1;
*(&v1[12]) = 1;
*(&v1[16]) = a1;
v5 = &v0;
v6 = 1;
v8 = &v5;
v9 = 1;
v3 = a0;
v4 = 4;
while (true) {
v2 = sendmsg(a0, &v7, 0x0, &v7);
if (v2 != -1)
break;
*(&v14) = *(__errno_location());
if (v14 != 11) {
*(&v14) = *(__errno_location());
if (v14 != 4)
break;
}
strerror(*(__errno_location()));
sshlog("monitor_fdpass.c", "mm_send_fd", 0x5c, 0x1, 0x7, 0x0,
"sendmsg(%d): %s", a1);
poll(&a0, 0x1, 0xffffffff);
}
if (v2 == -1) {
strerror(*(__errno_location()));
sshlog("monitor_fdpass.c", "mm_send_fd", 0x60, 0x1, 0x2, 0x0,
"sendmsg(%d): %s", a1);
v15 = 4294967295;
} else if (v2 == 1) {
v15 = 0;
} else {
sshlog("monitor_fdpass.c", "mm_send_fd", 0x65, 0x1, 0x2, 0x0,
"sendmsg: expected sent 1 got %zd", v2);
v15 = 4294967295;
}
return v15;
} | openssh-portable | angr_phoenix |
static const struct ifa_flag_data_t *
lookup_flag_data_by_name(const char *flag_name) {
unsigned int i;
for (i = 0; i < (sizeof(ifa_flag_data) / sizeof((ifa_flag_data)[0])); ++i) {
if (strcmp(flag_name, ifa_flag_data[i].name) == 0)
return &ifa_flag_data[i];
}
return ((void *)0);
} | int lookup_flag_data_by_name(char *a0) {
unsigned int v0;
unsigned int v2;
v0 = 0;
while (true) {
if (v0 > 12) {
v2 = 0;
return v2;
} else if (strcmp(a0, ifa_flag_data[2 * v0 + v0])) {
v0 += 1;
} else {
v2 = &ifa_flag_data[3 * v0];
return v2;
}
}
} | iproute2-6.0.0 | angr_sailr |
static _Bool
paste_parallel(size_t nfiles, char **fnamptr) {
_Bool ok = 1;
char *delbuf = xmalloc(nfiles + 2);
FILE **fileptr = xnmalloc(nfiles + 1, sizeof *fileptr);
size_t files_open;
_Bool opened_stdin = 0;
for (files_open = 0; files_open < nfiles; ++files_open) {
if ((strcmp(fnamptr[files_open], "-") == 0)) {
have_read_stdin = 1;
fileptr[files_open] = stdin;
} else {
fileptr[files_open] = fopen(fnamptr[files_open], "r");
if (fileptr[files_open] == ((void *)0))
((!!sizeof(struct {
_Static_assert(
1, "verify_expr ("
"1"
", "
"(error (1, (*__errno_location ()), \"%s\", "
"quotearg_n_style_colon (0, shell_escape_quoting_style, "
"fnamptr[files_open])), assume (false))"
")");
int _gl_dummy;
}))
? ((error(1, (*__errno_location()), "%s",
quotearg_n_style_colon(0, shell_escape_quoting_style,
fnamptr[files_open])),
((0) ? (void)0 : __builtin_unreachable())))
: ((error(1, (*__errno_location()), "%s",
quotearg_n_style_colon(0, shell_escape_quoting_style,
fnamptr[files_open])),
((0) ? (void)0 : __builtin_unreachable()))));
else if (fileno(fileptr[files_open]) == 0)
opened_stdin = 1;
fadvise(fileptr[files_open], FADVISE_SEQUENTIAL);
}
}
if (opened_stdin && have_read_stdin)
((!!sizeof(struct {
_Static_assert(1, "verify_expr ("
"1"
", "
"(error (1, 0, gettext (\"standard input is "
"closed\")), assume (false))"
")");
int _gl_dummy;
}))
? ((error(1, 0, gettext("standard input is closed")),
((0) ? (void)0 : __builtin_unreachable())))
: ((error(1, 0, gettext("standard input is closed")),
((0) ? (void)0 : __builtin_unreachable()))));
while (files_open) {
_Bool somedone = 0;
char const *delimptr = delims;
size_t delims_saved = 0;
for (size_t i = 0; i < nfiles && files_open; i++) {
int chr;
int err;
_Bool sometodo = 0;
if (fileptr[i]) {
chr = getc_unlocked(fileptr[i]);
err = (*__errno_location());
if (chr != (-1) && delims_saved) {
if (fwrite_unlocked(delbuf, 1, delims_saved, stdout) != delims_saved)
write_error();
delims_saved = 0;
}
while (chr != (-1)) {
sometodo = 1;
if (chr == line_delim)
break;
xputchar(chr);
chr = getc_unlocked(fileptr[i]);
err = (*__errno_location());
}
}
if (!sometodo) {
if (fileptr[i]) {
if (!ferror_unlocked(fileptr[i]))
err = 0;
if (fileptr[i] == stdin)
clearerr_unlocked(fileptr[i]);
else if (rpl_fclose(fileptr[i]) == (-1) && !err)
err = (*__errno_location());
if (err) {
error(0, err, "%s",
quotearg_n_style_colon(0, shell_escape_quoting_style,
fnamptr[i]));
ok = 0;
}
fileptr[i] = ((void *)0);
files_open--;
}
if (i + 1 == nfiles) {
if (somedone) {
if (delims_saved) {
if (fwrite_unlocked(delbuf, 1, delims_saved, stdout) !=
delims_saved)
write_error();
delims_saved = 0;
}
xputchar(line_delim);
}
continue;
} else {
if (*delimptr != '\0')
delbuf[delims_saved++] = *delimptr;
if (++delimptr == delim_end)
delimptr = delims;
}
} else {
somedone = 1;
if (i + 1 != nfiles) {
if (chr != line_delim && chr != (-1))
xputchar(chr);
if (*delimptr != '\0')
xputchar(*delimptr);
if (++delimptr == delim_end)
delimptr = delims;
} else {
char c = (chr == (-1) ? line_delim : chr);
xputchar(c);
}
}
}
}
free(fileptr);
free(delbuf);
return ok;
} | undefined paste_parallel(ulong param_1, long param_2)
{
bool bVar1;
bool bVar2;
byte bVar3;
int iVar4;
void *__ptr;
void *__ptr_00;
FILE *pFVar5;
undefined8 uVar6;
int *piVar7;
size_t sVar8;
undefined local_55;
uint local_50;
int local_4c;
ulong local_48;
char *local_40;
size_t local_38;
ulong local_30;
local_55 = 1;
__ptr = (void *)xmalloc(param_1 + 2);
__ptr_00 = (void *)xnmalloc(param_1 + 1, 8);
bVar1 = false;
for (local_48 = 0; local_48 < param_1; local_48 = local_48 + 1) {
iVar4 = strcmp(*(char **)(param_2 + local_48 * 8), "-");
if (iVar4 == 0) {
have_read_stdin = '\x01';
*(long *)(local_48 * 8 + (long)__ptr_00) = stdin;
} else {
pFVar5 = fopen(*(char **)(param_2 + local_48 * 8), "r");
*(FILE **)(local_48 * 8 + (long)__ptr_00) = pFVar5;
if (*(long *)((long)__ptr_00 + local_48 * 8) == 0) {
uVar6 = quotearg_n_style_colon(0, 3,
*(undefined8 *)(param_2 + local_48 * 8));
piVar7 = __errno_location();
error(1, *piVar7, &DAT_00101380, uVar6);
}
iVar4 = fileno(*(FILE **)((long)__ptr_00 + local_48 * 8));
if (iVar4 == 0) {
bVar1 = true;
}
fadvise(*(undefined8 *)((long)__ptr_00 + local_48 * 8), 2);
}
}
if (!bVar1)
goto LAB_00100a5e;
if (have_read_stdin == '\0')
goto LAB_00100a5e;
uVar6 = gettext("standard input is closed");
error(1, 0, uVar6);
do {
bVar1 = false;
local_40 = delims;
local_38 = 0;
local_30 = 0;
while ((local_30 < param_1 && (local_48 != 0))) {
bVar2 = false;
if (*(long *)((long)__ptr_00 + local_30 * 8) != 0) {
local_50 = getc_unlocked(*(FILE **)((long)__ptr_00 + local_30 * 8));
piVar7 = __errno_location();
local_4c = *piVar7;
if ((local_50 != 0xffffffff) && (local_38 != 0)) {
sVar8 = fwrite_unlocked(__ptr, 1, local_38, stdout);
if (local_38 != sVar8) {
write_error();
}
local_38 = 0;
}
while ((local_50 != 0xffffffff &&
(bVar2 = true, local_50 != line_delim))) {
xputchar((int)(char)local_50);
local_50 = getc_unlocked(*(FILE **)((long)__ptr_00 + local_30 * 8));
piVar7 = __errno_location();
local_4c = *piVar7;
}
}
if (bVar2) {
bVar1 = true;
if (param_1 == local_30 + 1) {
bVar3 = line_delim;
if (local_50 != 0xffffffff) {
bVar3 = (byte)local_50;
}
xputchar((int)(char)bVar3);
} else {
if ((local_50 != line_delim) && (local_50 != 0xffffffff)) {
xputchar((int)(char)(byte)local_50);
}
if (*local_40 != '\0') {
xputchar((int)*local_40);
}
local_40 = local_40 + 1;
if (local_40 == delim_end) {
local_40 = delims;
}
}
} else {
if (*(long *)((long)__ptr_00 + local_30 * 8) != 0) {
iVar4 = ferror_unlocked(*(FILE **)((long)__ptr_00 + local_30 * 8));
if (iVar4 == 0) {
local_4c = 0;
}
if (*(long *)((long)__ptr_00 + local_30 * 8) == stdin) {
clearerr_unlocked(*(FILE **)((long)__ptr_00 + local_30 * 8));
} else {
iVar4 = rpl_fclose();
if ((iVar4 == -1) && (local_4c == 0)) {
piVar7 = __errno_location();
local_4c = *piVar7;
}
}
if (local_4c != 0) {
uVar6 = quotearg_n_style_colon(
0, 3, *(undefined8 *)(param_2 + local_30 * 8));
error(0, local_4c, &DAT_00101380, uVar6);
local_55 = 0;
}
*(undefined8 *)((long)__ptr_00 + local_30 * 8) = 0;
local_48 = local_48 - 1;
}
if (param_1 == local_30 + 1) {
if (bVar1) {
if (local_38 != 0) {
sVar8 = fwrite_unlocked(__ptr, 1, local_38, stdout);
if (local_38 != sVar8) {
write_error();
}
local_38 = 0;
}
xputchar((int)(char)line_delim);
}
} else {
if (*local_40 != '\0') {
*(char *)((long)__ptr + local_38) = *local_40;
local_38 = local_38 + 1;
}
local_40 = local_40 + 1;
if (local_40 == delim_end) {
local_40 = delims;
}
}
}
local_30 = local_30 + 1;
}
LAB_00100a5e:
} while (local_48 != 0);
free(__ptr_00);
free(__ptr);
return local_55;
} | coreutils | ghidra |
static int sshsk_ecdsa_assemble(struct sk_enroll_response *resp,
struct sshkey **keyp) {
struct sshkey *key = ((void *)0);
struct sshbuf *b = ((void *)0);
EC_POINT *q = ((void *)0);
int r;
*keyp = ((void *)0);
if ((key = sshkey_new(KEY_ECDSA_SK)) == ((void *)0)) {
sshlog("ssh-sk.c", __func__, 213, 1, SYSLOG_LEVEL_ERROR, ((void *)0),
"sshkey_new failed");
r = -2;
goto out;
}
key->ecdsa_nid = 415;
if ((key->ecdsa = EC_KEY_new_by_curve_name(key->ecdsa_nid)) == ((void *)0) ||
(q = EC_POINT_new(EC_KEY_get0_group(key->ecdsa))) == ((void *)0) ||
(b = sshbuf_new()) == ((void *)0)) {
sshlog("ssh-sk.c", __func__, 221, 1, SYSLOG_LEVEL_ERROR, ((void *)0),
"allocation failed");
r = -2;
goto out;
}
if ((r = sshbuf_put_string(b, resp->public_key, resp->public_key_len)) != 0) {
sshlog("ssh-sk.c", __func__, 227, 1, SYSLOG_LEVEL_ERROR, ssh_err(r),
"sshbuf_put_string");
goto out;
}
if ((r = sshbuf_get_ec(b, q, EC_KEY_get0_group(key->ecdsa))) != 0) {
sshlog("ssh-sk.c", __func__, 231, 1, SYSLOG_LEVEL_ERROR, ssh_err(r),
"parse");
r = -4;
goto out;
}
if (sshkey_ec_validate_public(EC_KEY_get0_group(key->ecdsa), q) != 0) {
sshlog("ssh-sk.c", __func__, 236, 0, SYSLOG_LEVEL_ERROR, ((void *)0),
"Authenticator returned invalid ECDSA key");
r = -20;
goto out;
}
if (EC_KEY_set_public_key(key->ecdsa, q) != 1) {
sshlog("ssh-sk.c", __func__, 242, 1, SYSLOG_LEVEL_ERROR, ((void *)0),
"allocation failed");
r = -2;
goto out;
}
*keyp = key;
key = ((void *)0);
r = 0;
out:
EC_POINT_free(q);
sshkey_free(key);
sshbuf_free(b);
return r;
} | int sshsk_ecdsa_assemble(unsigned long long a0[3], unsigned long long *a1) {
unsigned long long v0;
unsigned int v1;
void *v2;
void *v3;
void *v4;
v2 = 0;
v3 = 0;
v4 = 0;
*(a1) = 0;
v2 = sshkey_new(0xa);
if (!v2) {
v0 = "sshkey_new failed";
sshlog("ssh-sk.c", "sshsk_ecdsa_assemble", 0xd5, 0x1, 0x2, 0x0);
v1 = -2;
} else {
*(&v2[24]) = 415;
*(&v2[32]) = EC_KEY_new_by_curve_name(v2[24]);
if (!v2[32]) {
LABEL_40071d:
v0 = "allocation failed";
sshlog("ssh-sk.c", "sshsk_ecdsa_assemble", 0xdd, 0x1, 0x2, 0x0);
v1 = -2;
} else {
v4 = EC_POINT_new(EC_KEY_get0_group(v2[32]));
if (!v4)
goto LABEL_40071d;
v3 = sshbuf_new();
if (!v3)
goto LABEL_40071d;
v1 = sshbuf_put_string(v3, a0[1], a0[2], a0[1]);
if (v1) {
v0 = "sshbuf_put_string";
sshlog("ssh-sk.c", "sshsk_ecdsa_assemble", 0xe3, 0x1, 0x2, ssh_err(v1));
} else {
v1 = sshbuf_get_ec(v3, v4, EC_KEY_get0_group(v2[32]), v4);
if (v1) {
v0 = "parse";
sshlog("ssh-sk.c", "sshsk_ecdsa_assemble", 0xe7, 0x1, 0x2,
ssh_err(v1));
v1 = -0x4;
} else if (sshkey_ec_validate_public(EC_KEY_get0_group(v2[32]), v4,
EC_KEY_get0_group(v2[32]))) {
v0 = "Authenticator returned invalid ECDSA key";
sshlog("ssh-sk.c", "sshsk_ecdsa_assemble", 0xec, 0x0, 0x2, 0x0);
v1 = -20;
} else if (EC_KEY_set_public_key(v2[32], v4, v4) == 1) {
*(a1) = v2;
v2 = 0;
v1 = 0;
} else {
v0 = "allocation failed";
sshlog("ssh-sk.c", "sshsk_ecdsa_assemble", 0xf2, 0x1, 0x2, 0x0);
v1 = -2;
}
}
}
}
EC_POINT_free(v4);
sshkey_free(v2);
sshbuf_free(v3);
return v1;
} | openssh-portable | angr_phoenix |
static inline __be16 rta_getattr_be16(const struct rtattr *rta) {
return ntohs(rta_getattr_u16(rta));
} | uint16_t rta_getattr_be16(long a1) {
uint16_t v1;
v1 = rta_getattr_u16(a1);
return ntohs(v1);
} | iproute2-6.0.0 | ida |
int kex_c25519_enc(struct kex *kex, const struct sshbuf *client_blob,
struct sshbuf **server_blobp,
struct sshbuf **shared_secretp) {
struct sshbuf *server_blob = ((void *)0);
struct sshbuf *buf = ((void *)0);
const u_char *client_pub;
u_char *server_pub;
u_char server_key[32];
int r;
*server_blobp = ((void *)0);
*shared_secretp = ((void *)0);
if (sshbuf_len(client_blob) != 32) {
r = -21;
goto out;
}
client_pub = sshbuf_ptr(client_blob);
if ((server_blob = sshbuf_new()) == ((void *)0)) {
r = -2;
goto out;
}
if ((r = sshbuf_reserve(server_blob, 32, &server_pub)) != 0)
goto out;
kexc25519_keygen(server_key, server_pub);
if ((buf = sshbuf_new()) == ((void *)0)) {
r = -2;
goto out;
}
if ((r = kexc25519_shared_key_ext(server_key, client_pub, buf, 0)) < 0)
goto out;
*server_blobp = server_blob;
*shared_secretp = buf;
server_blob = ((void *)0);
buf = ((void *)0);
out:
explicit_bzero(server_key, sizeof(server_key));
sshbuf_free(server_blob);
sshbuf_free(buf);
return r;
} | int kex_c25519_enc(undefined8 param_1, undefined8 param_2, long *param_3,
long *param_4)
{
long lVar1;
long in_FS_OFFSET;
int local_5c;
undefined8 local_58;
long local_50;
long local_48;
undefined8 local_40;
undefined local_38[40];
long local_10;
local_10 = *(long *)(in_FS_OFFSET + 0x28);
local_50 = 0;
local_48 = 0;
*param_3 = 0;
*param_4 = 0;
lVar1 = sshbuf_len(param_2);
if (lVar1 == 0x20) {
local_40 = sshbuf_ptr(param_2);
local_50 = sshbuf_new();
if (local_50 == 0) {
local_5c = -2;
} else {
local_5c = sshbuf_reserve(local_50, 0x20, &local_58);
if (local_5c == 0) {
kexc25519_keygen(local_38, local_58);
local_48 = sshbuf_new();
if (local_48 == 0) {
local_5c = -2;
} else {
local_5c = kexc25519_shared_key_ext(local_38, local_40, local_48, 0);
if (-1 < local_5c) {
*param_3 = local_50;
*param_4 = local_48;
local_50 = 0;
local_48 = 0;
}
}
}
}
} else {
local_5c = -0x15;
}
explicit_bzero(local_38, 0x20);
sshbuf_free(local_50);
sshbuf_free(local_48);
if (local_10 == *(long *)(in_FS_OFFSET + 0x28)) {
return local_5c;
}
__stack_chk_fail();
} | openssh-portable | ghidra |
static void channel_post_open(struct ssh *ssh, Channel *c) {
channel_handle_rfd(ssh, c);
channel_handle_wfd(ssh, c);
channel_handle_efd(ssh, c);
channel_check_window(ssh, c);
} | long long channel_post_open(unsigned long a0, void *a1) {
channel_handle_rfd(a0, a1);
channel_handle_wfd(a0, a1);
channel_handle_efd(a0, a1);
return channel_check_window(a0, a1);
} | openssh-portable | angr_phoenix |
void coproc_fdchk(fd) int fd;
{
coproc_checkfd(&sh_coproc, fd);
} | long long coproc_fdchk(unsigned long a0) {
return coproc_checkfd(&sh_coproc, a0);
} | bash | angr_phoenix |
void print_e2fsck_message(FILE *f, e2fsck_t ctx, const char *msg,
struct problem_context *pctx, int first,
int recurse) {
ext2_filsys fs = ctx->fs;
const char *cp;
int i, width;
e2fsck_clear_progbar(ctx);
for (cp = msg; *cp; cp++) {
if (cp[0] == '@') {
cp++;
expand_at_expression(f, ctx, *cp, pctx, &first, recurse);
} else if (cp[0] == '%') {
cp++;
width = 0;
while (
((*__ctype_b_loc())[(int)((cp[0]))] & (unsigned short int)_ISdigit)) {
width = (width * 10) + cp[0] - '0';
cp++;
}
if (cp[0] == 'I') {
cp++;
expand_inode_expression(f, fs, *cp, pctx);
} else if (cp[0] == 'D') {
cp++;
expand_dirent_expression(f, fs, *cp, pctx);
} else {
expand_percent_expression(f, fs, *cp, width, &first, pctx);
}
} else {
for (i = 0; cp[i]; i++)
if ((cp[i] == '@') || cp[i] == '%')
break;
fprintf(f, "%.*s", i, cp);
cp += i - 1;
}
first = 0;
}
} | void print_e2fsck_message(unsigned long long a0, unsigned long long *a1,
unsigned long a2, unsigned long long a3,
unsigned long a4, unsigned long a5) {
unsigned int v0;
unsigned int v1;
unsigned int v2;
char *v3;
unsigned long long v4;
unsigned long long v6;
v0 = a4;
v4 = *(a1);
e2fsck_clear_progbar(a1);
v3 = a2;
while (true) {
v6 = *(v3);
switch (*(v3)) {
case 0:
return;
case 64:
v3 += 1;
expand_at_expression(a0, a1, *(v3), a3, &v0, a5);
break;
case 37:
v3 += 1;
v2 = 0;
while (true) {
*(&v6) = *((*(v3) * 2 + *(__ctype_b_loc())));
*(&v6) = v6 & 0x800;
if (!v6)
break;
v2 = *(v3) + ((v2 * 4) + v2) * 2 - 48;
v3 += 1;
}
switch (*(v3)) {
case 73:
v3 += 1;
expand_inode_expression(a0, v4, *(v3), a3);
break;
case 68:
v3 += 1;
expand_dirent_expression(a0, v4, *(v3), a3);
break;
default:
expand_percent_expression(a0, v4, *(v3), v2, &v0, a3);
break;
}
default:
v1 = 0;
while (true) {
switch (v3[v1]) {
case 0:
case 37:
case 64:
break;
default:
v1 += 1;
continue;
}
}
fprintf(a0, "%.*s", v1);
v3 = &v3[1 + v1];
break;
}
v0 = 0;
v3 += 1;
}
} | e2fsprogs-1.46.5 | angr_sailr |
static void _rl_handle_signal(int sig) {
int block_sig;
sigset_t set, oset;
(rl_readline_state |= (0x0008000));
if (_rl_sigcleanup) {
(*_rl_sigcleanup)(sig, _rl_sigcleanarg);
_rl_sigcleanup = 0;
_rl_sigcleanarg = 0;
}
block_sig = 0;
sigemptyset(&set);
sigprocmask(0, (sigset_t *)((void *)0), &set);
switch (sig) {
case 2:
_rl_reset_completion_state();
rl_free_line_state();
rl_callback_sigcleanup();
case 20:
case 21:
case 22:
if (block_sig == 0) {
sigaddset(&set, 22);
block_sig = 1;
}
case 1:
case 15:
case 14:
if (sig == 14)
_rl_timeout_handle_sigalrm();
case 3:
if (block_sig)
sigprocmask(0, &set, &oset);
rl_echo_signal_char(sig);
rl_cleanup_after_signal();
if (block_sig)
sigprocmask(1, &oset, (sigset_t *)((void *)0));
kill(getpid(), sig);
rl_reset_after_signal();
}
(rl_readline_state &= ~(0x0008000));
return;
} | void _rl_handle_signal(unsigned long a0, unsigned int a1, unsigned long a2,
unsigned long a3, unsigned long long a4,
unsigned long long a5) {
int tmp_42;
unsigned int v0;
int tmp_12;
char v1;
char v2;
char v3;
unsigned long long v5;
unsigned int v6;
unsigned long long v7;
unsigned long long v8;
unsigned long long *v9;
unsigned long long v10;
v5 = rl_readline_state;
*(&v5) = (rl_readline_state >> 8) | 128;
tmp_42 = v5;
rl_readline_state = tmp_42;
14410530935326671688(a0, 14410530935326671688, 14410530935326671688,
14410530935326671688);
_rl_sigcleanarg = 0;
_rl_sigcleanarg = 0;
v0 = 0;
sigemptyset(&v1);
v6 = 0;
sigprocmask(0x0, NULL, &v1);
switch (0) {
case 2:
_rl_reset_completion_state();
rl_free_line_state(reg_72, 0x0, &v1, 0xc7fc7d8910ec8348, a4, a5);
rl_callback_sigcleanup(reg_72, 0x0, &v1, 0xc7fc7d8910ec8348, a4, a5);
case 20:
case 21:
case 22:
if (!v0) {
a1 = 22;
sigaddset(&v1, 0x16);
v0 = 1;
goto LABEL_40018f;
}
case 1:
case 14:
case 15:
LABEL_40018f:
if (false)
_rl_timeout_handle_sigalrm();
goto LABEL_40019d;
case 3:
LABEL_40019d:
if (v0)
sigprocmask(0x0, &v1, &v2);
rl_echo_signal_char(0x0);
rl_cleanup_after_signal(reg_72, a1, a2, 0xc7fc7d8910ec8348);
if (v0)
sigprocmask(0x1, &v2, NULL);
v7 = getpid();
a1 = 0;
kill(v7, 0x0);
rl_reset_after_signal(v7, a1, a2, 0xc7fc7d8910ec8348);
break;
}
v8 = rl_readline_state;
*(&v8) = (rl_readline_state >> 8) & 127;
tmp_12 = v8;
rl_readline_state = tmp_12;
v10 = *(&v3) ^ v9[5];
return;
} | bash | angr_phoenix |
static void fail_exit(int code) {
if (pw_locked) {
if (pw_unlock() == 0) {
fprintf(stderr, gettext("%s: failed to unlock %s\n"), Prog, pw_dbname());
do {
char *old_locale = setlocale(6, ((void *)0));
char *saved_locale = ((void *)0);
if (((void *)0) != old_locale) {
saved_locale = strdup(old_locale);
}
if (((void *)0) != saved_locale) {
(void)setlocale(6, "C");
}
syslog(3, "failed to unlock %s", pw_dbname());
if (((void *)0) != saved_locale) {
(void)setlocale(6, saved_locale);
free(saved_locale);
}
} while (0);
}
}
if (spw_locked) {
if (spw_unlock() == 0) {
fprintf(stderr, gettext("%s: failed to unlock %s\n"), Prog, spw_dbname());
do {
char *old_locale = setlocale(6, ((void *)0));
char *saved_locale = ((void *)0);
if (((void *)0) != old_locale) {
saved_locale = strdup(old_locale);
}
if (((void *)0) != saved_locale) {
(void)setlocale(6, "C");
}
syslog(3, "failed to unlock %s", spw_dbname());
if (((void *)0) != saved_locale) {
(void)setlocale(6, saved_locale);
free(saved_locale);
}
} while (0);
}
}
exit(code);
} | void fail_exit(int param_1)
{
int iVar1;
undefined8 uVar2;
char *pcVar3;
undefined8 uVar4;
char *local_38;
char *local_30;
if (pw_locked != '\0') {
iVar1 = pw_unlock();
if (iVar1 == 0) {
uVar2 = pw_dbname();
uVar4 = Prog;
pcVar3 = (char *)gettext("%s: failed to unlock %s\n");
fprintf(stderr, pcVar3, uVar4, uVar2);
pcVar3 = setlocale(6, (char *)0x0);
local_38 = (char *)0x0;
if (pcVar3 != (char *)0x0) {
local_38 = strdup(pcVar3);
}
if (local_38 != (char *)0x0) {
setlocale(6, "C");
}
uVar4 = pw_dbname();
syslog(3, "failed to unlock %s", uVar4);
if (local_38 != (char *)0x0) {
setlocale(6, local_38);
free(local_38);
}
}
}
if (spw_locked != '\0') {
iVar1 = spw_unlock();
if (iVar1 == 0) {
uVar2 = spw_dbname();
uVar4 = Prog;
pcVar3 = (char *)gettext("%s: failed to unlock %s\n");
fprintf(stderr, pcVar3, uVar4, uVar2);
pcVar3 = setlocale(6, (char *)0x0);
local_30 = (char *)0x0;
if (pcVar3 != (char *)0x0) {
local_30 = strdup(pcVar3);
}
if (local_30 != (char *)0x0) {
setlocale(6, "C");
}
uVar4 = spw_dbname();
syslog(3, "failed to unlock %s", uVar4);
if (local_30 != (char *)0x0) {
setlocale(6, local_30);
free(local_30);
}
}
}
exit(param_1);
} | shadow | 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" : "");
} | unsigned long emit_ancillary_info(const char *a1) {
char *v1;
FILE *v2;
char *v3;
const char *v4;
char *v5;
const char *v6;
char *v7;
const char *v9;
long *i;
const char *v11;
const char *v12;
long v13[15];
unsigned long v14;
v14 = __readfsqword(0x28u);
v13[0] = (long)"[";
v13[1] = (long)"test invocation";
v13[2] = (long)"coreutils";
v13[3] = (long)"Multi-call invocation";
v13[4] = (long)"sha224sum";
v13[5] = (long)"sha2 utilities";
v13[6] = (long)"sha256sum";
v13[7] = (long)"sha2 utilities";
v13[8] = (long)"sha384sum";
v13[9] = (long)"sha2 utilities";
v13[10] = (long)"sha512sum";
v13[11] = (long)"sha2 utilities";
v13[12] = 0LL;
v13[13] = 0LL;
v9 = a1;
for (i = v13; *i && strcmp(a1, (const char *)*i); i += 2)
;
if (i[1])
v9 = (const char *)i[1];
v1 = gettext("\n%s online help: <%s>\n");
printf(v1, "GNU coreutils", "https:
v11 = setlocale(5, 0LL);
if ( v11 && strncmp(v11, "en_", 3uLL) )
{
v2 = stdout;
v3 = gettext("Report any translation bugs to <https:
fputs_unlocked(v3, v2);
}
if ( !strcmp(a1, "[") )
v4 = "test";
else
v4 = a1;
v12 = v4;
v5 = gettext("Full documentation <%s%s>\n");
printf(v5, "https:
if ( v9 == a1 )
v6 = " invocation";
else
v6 = locale;
v7 = gettext("or available locally via: info '(coreutils) %s%s'\n");
printf(v7, v9, v6);
return __readfsqword(0x28u) ^ v14;
} | coreutils | ida |
int timeout_connect(int sockfd, const struct sockaddr *serv_addr,
socklen_t addrlen, int *timeoutp) {
int optval = 0;
socklen_t optlen = sizeof(optval);
if (timeoutp == ((void *)0) || *timeoutp <= 0)
return connect(sockfd, serv_addr, addrlen);
set_nonblock(sockfd);
for (;;) {
if (connect(sockfd, serv_addr, addrlen) == 0) {
unset_nonblock(sockfd);
return 0;
} else if ((*__errno_location()) == 4)
continue;
else if ((*__errno_location()) != 115)
return -1;
break;
}
if (waitfd(sockfd, timeoutp, 0x001 | 0x004) == -1)
return -1;
if (getsockopt(sockfd, 1, 4, &optval, &optlen) == -1) {
sshlog("misc.c", __func__, 381, 0, SYSLOG_LEVEL_DEBUG1, ((void *)0),
"getsockopt: %s", strerror((*__errno_location())));
return -1;
}
if (optval != 0) {
(*__errno_location()) = optval;
return -1;
}
unset_nonblock(sockfd);
return 0;
} | long long timeout_connect(unsigned long a0, void *a1, unsigned long a2,
unsigned int *a3) {
unsigned int v0;
unsigned int v1;
unsigned long long v3;
unsigned int v4;
v0 = 0;
v1 = 4;
if (!a3) {
LABEL_400b75:
v3 = connect(a0, a1, a2);
} else {
if (*(a3) <= 0)
goto LABEL_400b75;
set_nonblock(a0);
do {
if (!connect(a0, a1, a2)) {
unset_nonblock(a0);
v3 = 0;
goto LABEL_400cac;
}
v4 = *(__errno_location());
} while (v4 == 4);
if (*(__errno_location()) != 115) {
v3 = 4294967295;
} else if (waitfd(a0, a3, 0x5) == -1) {
v3 = 4294967295;
} else if (getsockopt(a0, 0x1, 0x4, &v0, &v1) == -1) {
sshlog("misc.c", "timeout_connect", 0x17d, 0x0, 0x5, 0x0,
"getsockopt: %s", strerror(*(__errno_location())));
v3 = 4294967295;
} else if (v0) {
*(__errno_location()) = v0;
v3 = 4294967295;
} else {
unset_nonblock(a0);
v3 = 0;
}
}
LABEL_400cac:
return v3;
} | openssh-portable | angr_phoenix |
WORD_LIST *array_to_kvpair_list(a)
ARRAY *a;
{
WORD_LIST *list;
ARRAY_ELEMENT *ae;
char *k, *v;
if (a == 0 || ((a)->num_elements == 0))
return ((WORD_LIST *)((void *)0));
list = (WORD_LIST *)((void *)0);
for (ae = ((a->head)->next); ae != a->head; ae = ((ae)->next)) {
k = itos(((ae)->ind));
v = ((ae)->value);
list = make_word_list(make_bare_word(k), list);
list = make_word_list(make_bare_word(v), list);
sh_xfree((k), "array.c", 812);
}
return (((list && list->next)
? (WORD_LIST *)list_reverse((GENERIC_LIST *)list)
: (WORD_LIST *)(list)));
} | long long array_to_kvpair_list(struct_0 *a0) {
void *v0;
unsigned long long v1[3];
unsigned long long v2;
unsigned long long v3;
void *v5;
unsigned long long v6;
unsigned long long v7;
if (!a0) {
LABEL_401746:
v5 = 0;
} else {
if (!a0->field_8)
goto LABEL_401746;
v0 = 0;
for (v1[0] = a0->field_10->field_10; v1 != a0->field_10; v1[0] = v1[2]) {
v2 = itos(v1[0]);
v3 = v1[1];
v6 = make_bare_word(v2);
v0 = make_word_list(v6, v0, v6);
v7 = make_bare_word(v3);
v0 = make_word_list(v7, v0, v7);
sh_xfree(v2, "array.c", 0x32c);
}
if (v0 && *(v0)) {
v5 = list_reverse(v0);
goto LABEL_401830;
}
v5 = v0;
}
LABEL_401830:
return v5;
} | bash | angr_phoenix |
static char *history_filename(const char *filename) {
char *return_val;
const char *home;
int home_len;
return_val = filename ? strcpy(xmalloc(1 + strlen(filename)), (filename))
: (char *)((void *)0);
if (return_val)
return (return_val);
home = sh_get_env_value("HOME");
if (home == 0)
return (((void *)0));
else
home_len = strlen(home);
return_val = (char *)xmalloc(2 + home_len + 8);
strcpy(return_val, home);
return_val[home_len] = '/';
strcpy(return_val + home_len + 1, ".history");
return (return_val);
} | char *history_filename(char *param_1)
{
int iVar1;
size_t sVar2;
char *pcVar3;
char *__s;
if (param_1 == (char *)0x0) {
pcVar3 = (char *)0x0;
} else {
sVar2 = strlen(param_1);
pcVar3 = (char *)xmalloc(sVar2 + 1);
pcVar3 = strcpy(pcVar3, param_1);
}
if (pcVar3 == (char *)0x0) {
__s = (char *)sh_get_env_value(&DAT_001019ac);
if (__s == (char *)0x0) {
pcVar3 = (char *)0x0;
} else {
sVar2 = strlen(__s);
iVar1 = (int)sVar2;
pcVar3 = (char *)xmalloc((long)(iVar1 + 10));
strcpy(pcVar3, __s);
pcVar3[iVar1] = '/';
strcpy(pcVar3 + (long)iVar1 + 1, ".history");
}
}
return pcVar3;
} | bash | ghidra |
void usage(int status) {
if (status != 0)
do {
fprintf(stderr, gettext("Try '%s --help' for more information.\n"),
program_name);
} while (0);
else {
printf(gettext("Usage: %s [OPTION]... [-T] SOURCE DEST\n or: %s "
"[OPTION]... SOURCE... DIRECTORY\n or: %s [OPTION]... -t "
"DIRECTORY SOURCE...\n")
,
program_name, program_name, program_name);
fputs_unlocked(
gettext("Copy SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY.\n"),
stdout)
;
emit_mandatory_arg_note();
fputs_unlocked(
gettext(
" -a, --archive same as -dR --preserve=all\n "
"--attributes-only don't copy the file data, just the "
"attributes\n --backup[=CONTROL] make a backup of each "
"existing destination file\n -b like "
"--backup but does not accept an argument\n --copy-contents "
" copy contents of special files when recursive\n -d "
" same as --no-dereference --preserve=links\n"),
stdout)
;
fputs_unlocked(
gettext(
" -f, --force if an existing destination file "
"cannot be\n opened, remove it and "
"try again (this option\n is "
"ignored when the -n option is also used)\n -i, --interactive "
" prompt before overwrite (overrides a previous -n\n "
" option)\n -H "
"follow command-line symbolic links in SOURCE\n"),
stdout)
;
fputs_unlocked(gettext(" -l, --link hard link files "
"instead of copying\n -L, --dereference "
"always follow symbolic links in SOURCE\n"),
stdout)
;
fputs_unlocked(
gettext(" -n, --no-clobber do not overwrite an existing "
"file (overrides\n a previous "
"-i option)\n -P, --no-dereference never follow "
"symbolic links in SOURCE\n"),
stdout)
;
fputs_unlocked(
gettext(" -p same as "
"--preserve=mode,ownership,timestamps\n "
"--preserve[=ATTR_LIST] preserve the specified attributes "
"(default:\n "
"mode,ownership,timestamps), if possible\n "
" additional attributes: context, links, xattr,\n "
" all\n"),
stdout)
;
fputs_unlocked(gettext(" --no-preserve=ATTR_LIST don't preserve the "
"specified attributes\n --parents "
" use full source file name under DIRECTORY\n"),
stdout)
;
fputs_unlocked(
gettext(" -R, -r, --recursive copy directories recursively\n "
" --reflink[=WHEN] control clone/CoW copies. See "
"below\n --remove-destination remove each existing "
"destination file before\n "
"attempting to open it (contrast with --force)\n"),
stdout)
;
fputs_unlocked(
gettext(" --sparse=WHEN control creation of sparse "
"files. See below\n --strip-trailing-slashes remove any "
"trailing slashes from each SOURCE\n "
" argument\n"),
stdout)
;
fputs_unlocked(
gettext(" -s, --symbolic-link make symbolic links instead of "
"copying\n -S, --suffix=SUFFIX override the usual "
"backup suffix\n -t, --target-directory=DIRECTORY copy all "
"SOURCE arguments into DIRECTORY\n -T, --no-target-directory "
" treat DEST as a normal file\n"),
stdout)
;
fputs_unlocked(
gettext(
" -u, --update copy only when the SOURCE file is "
"newer\n than the destination file "
"or when the\n destination file is "
"missing\n -v, --verbose explain what is being "
"done\n -x, --one-file-system stay on this file system\n"),
stdout)
;
fputs_unlocked(
gettext(" -Z set SELinux security context "
"of destination\n file to "
"default type\n --context[=CTX] like -Z, or if "
"CTX is specified then set the\n "
" SELinux or SMACK security context to CTX\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(
"\nBy default, sparse SOURCE files are detected by a crude "
"heuristic and the\ncorresponding DEST file is made sparse as "
"well. That is the behavior\nselected by --sparse=auto. Specify "
"--sparse=always to create a sparse DEST\nfile whenever the SOURCE "
"file contains a long enough sequence of zero bytes.\nUse "
"--sparse=never to inhibit creation of sparse files.\n"),
stdout)
;
fputs_unlocked(
gettext("\nWhen --reflink[=always] is specified, perform a lightweight "
"copy, where the\ndata blocks are copied only when modified. "
"If this is not possible the copy\nfails, or if --reflink=auto "
"is specified, fall back to a standard copy.\nUse "
"--reflink=never to ensure a standard copy is performed.\n"),
stdout)
;
emit_backup_suffix_note();
fputs_unlocked(
gettext("\nAs a special case, cp makes a backup of SOURCE when the "
"force and backup\noptions are given and SOURCE and DEST are "
"the same name for an existing,\nregular file.\n"),
stdout)
;
emit_ancillary_info("cp");
}
exit(status);
} | void usage(unsigned long a0) {
unsigned long v0;
unsigned long v1;
unsigned long v2;
unsigned long v4;
unsigned long v5;
unsigned long v6;
v2 = v4;
v1 = v5;
v0 = v6;
if (a0) {
fprintf(stderr, gettext("Try '%s --help' for more information.\n"));
} else {
printf(gettext(
"Usage: %s [OPTION]... [-T] SOURCE DEST\n or: %s [OPTION]... "
"SOURCE... DIRECTORY\n or: %s [OPTION]... -t DIRECTORY SOURCE...\n"));
fputs_unlocked(
gettext("Copy SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY.\n"),
stdout);
emit_mandatory_arg_note();
fputs_unlocked(
gettext(
" -a, --archive same as -dR --preserve=all\n "
"--attributes-only don't copy the file data, just the "
"attributes\n --backup[=CONTROL] make a backup of each "
"existing destination file\n -b like "
"--backup but does not accept an argument\n --copy-contents "
" copy contents of special files when recursive\n -d "
" same as --no-dereference --preserve=links\n"),
stdout);
fputs_unlocked(
gettext(
" -f, --force if an existing destination file "
"cannot be\n opened, remove it and "
"try again (this option\n is "
"ignored when the -n option is also used)\n -i, --interactive "
" prompt before overwrite (overrides a previous -n\n "
" option)\n -H "
"follow command-line symbolic links in SOURCE\n"),
stdout);
fputs_unlocked(gettext(" -l, --link hard link files "
"instead of copying\n -L, --dereference "
"always follow symbolic links in SOURCE\n"),
stdout);
fputs_unlocked(
gettext(" -n, --no-clobber do not overwrite an existing "
"file (overrides\n a previous "
"-i option)\n -P, --no-dereference never follow "
"symbolic links in SOURCE\n"),
stdout);
fputs_unlocked(
gettext(" -p same as "
"--preserve=mode,ownership,timestamps\n "
"--preserve[=ATTR_LIST] preserve the specified attributes "
"(default:\n "
"mode,ownership,timestamps), if possible\n "
" additional attributes: context, links, xattr,\n "
" all\n"),
stdout);
fputs_unlocked(gettext(" --no-preserve=ATTR_LIST don't preserve the "
"specified attributes\n --parents "
" use full source file name under DIRECTORY\n"),
stdout);
fputs_unlocked(
gettext(" -R, -r, --recursive copy directories recursively\n "
" --reflink[=WHEN] control clone/CoW copies. See "
"below\n --remove-destination remove each existing "
"destination file before\n "
"attempting to open it (contrast with --force)\n"),
stdout);
fputs_unlocked(
gettext(" --sparse=WHEN control creation of sparse "
"files. See below\n --strip-trailing-slashes remove any "
"trailing slashes from each SOURCE\n "
" argument\n"),
stdout);
fputs_unlocked(
gettext(" -s, --symbolic-link make symbolic links instead of "
"copying\n -S, --suffix=SUFFIX override the usual "
"backup suffix\n -t, --target-directory=DIRECTORY copy all "
"SOURCE arguments into DIRECTORY\n -T, --no-target-directory "
" treat DEST as a normal file\n"),
stdout);
fputs_unlocked(
gettext(
" -u, --update copy only when the SOURCE file is "
"newer\n than the destination file "
"or when the\n destination file is "
"missing\n -v, --verbose explain what is being "
"done\n -x, --one-file-system stay on this file system\n"),
stdout);
fputs_unlocked(
gettext(" -Z set SELinux security context "
"of destination\n file to "
"default type\n --context[=CTX] like -Z, or if "
"CTX is specified then set the\n "
" SELinux or SMACK security context to CTX\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(
"\nBy default, sparse SOURCE files are detected by a crude "
"heuristic and the\ncorresponding DEST file is made sparse as "
"well. That is the behavior\nselected by --sparse=auto. Specify "
"--sparse=always to create a sparse DEST\nfile whenever the SOURCE "
"file contains a long enough sequence of zero bytes.\nUse "
"--sparse=never to inhibit creation of sparse files.\n"),
stdout);
fputs_unlocked(
gettext("\nWhen --reflink[=always] is specified, perform a lightweight "
"copy, where the\ndata blocks are copied only when modified. "
"If this is not possible the copy\nfails, or if --reflink=auto "
"is specified, fall back to a standard copy.\nUse "
"--reflink=never to ensure a standard copy is performed.\n"),
stdout);
emit_backup_suffix_note();
fputs_unlocked(
gettext("\nAs a special case, cp makes a backup of SOURCE when the "
"force and backup\noptions are given and SOURCE and DEST are "
"the same name for an existing,\nregular file.\n"),
stdout);
emit_ancillary_info("cp");
}
exit(a0);
} | coreutils | angr_sailr |
ARRAY *array_dequote(array)
ARRAY *array;
{
ARRAY_ELEMENT *a;
char *t;
if (array == 0 || ((array)->head) == 0 || ((array)->num_elements == 0))
return (ARRAY *)((void *)0);
for (a = ((array->head)->next); a != array->head; a = ((a)->next)) {
t = dequote_string(a->value);
do {
if (a->value)
sh_xfree((a->value), "array.c", 356);
} while (0);
a->value = t;
}
return array;
} | long array_dequote(long param_1)
{
undefined8 uVar1;
long local_18;
if (((param_1 == 0) || (*(long *)(param_1 + 0x10) == 0)) ||
(*(long *)(param_1 + 8) == 0)) {
param_1 = 0;
} else {
for (local_18 = *(long *)(*(long *)(param_1 + 0x10) + 0x10);
local_18 != *(long *)(param_1 + 0x10);
local_18 = *(long *)(local_18 + 0x10)) {
uVar1 = dequote_string(*(undefined8 *)(local_18 + 8));
if (*(long *)(local_18 + 8) != 0) {
sh_xfree(*(undefined8 *)(local_18 + 8), "array.c", 0x164);
}
*(undefined8 *)(local_18 + 8) = uVar1;
}
}
return param_1;
} | bash | ghidra |
static _Bool
errno_rmdir_non_empty(int error_number) {
return error_number == 39 || error_number == 17;
} | int errno_rmdir_non_empty(unsigned long a0) {
unsigned int v1;
unsigned int v2;
if (a0 == 39) {
LABEL_4003e5:
v1 = 1;
} else {
if (a0 == 17)
goto LABEL_4003e5;
v1 = 0;
}
v2 = v1 & 1;
return v2;
} | coreutils | angr_phoenix |
static int do_statx(int fd, char const *name, struct stat *st, int flags,
unsigned int mask) {
struct statx stx;
_Bool want_btime = mask & 0x00000800U;
int ret = statx(fd, name, flags | 0x800, mask, &stx);
if (ret >= 0) {
statx_to_stat(&stx, st);
if (want_btime) {
if (stx.stx_mask & 0x00000800U)
st->st_mtim = statx_timestamp_to_timespec(stx.stx_btime);
else
st->st_mtim.tv_sec = st->st_mtim.tv_nsec = -1;
}
}
return ret;
} | long do_statx(unsigned int a1, long a2, long a3, unsigned int a4,
unsigned int a5) {
unsigned int v5;
long v6;
bool v9;
int v10;
short v11[40];
long v12;
unsigned long v13;
v13 = __readfsqword(0x28u);
v9 = (a5 & 0x800) != 0;
v5 = a4;
BYTE1(v5) = BYTE1(a4) | 8;
v10 = statx(a1, a2, v5, a5, v11);
if (v10 >= 0) {
statx_to_stat((long)v11, a3);
if (v9) {
if ((v11[0] & 0x800) != 0) {
*(_QWORD *)(a3 + 88) = statx_timestamp_to_timespec(v12);
*(_QWORD *)(a3 + 96) = v6;
} else {
*(_QWORD *)(a3 + 96) = -1LL;
*(_QWORD *)(a3 + 88) = *(_QWORD *)(a3 + 96);
}
}
}
return (unsigned int)v10;
} | coreutils | ida |
static inline struct ext2_inode *
EXT2_INODE(struct ext2_inode_large *large_inode) {
return (struct ext2_inode *)large_inode;
} | int EXT2_INODE(unsigned long a0) { return a0; } | e2fsprogs-1.46.5 | angr_phoenix |
void *hash_lookup(const Hash_table *table, const void *entry) {
struct hash_entry const *bucket = safe_hasher(table, entry);
struct hash_entry const *cursor;
if (bucket->data == ((void *)0))
return ((void *)0);
for (cursor = bucket; cursor; cursor = cursor->next)
if (entry == cursor->data || table->comparator(entry, cursor->data))
return cursor->data;
return ((void *)0);
} | long long hash_lookup(struct_0 *a0, unsigned long long a1) {
unsigned long long v0[2];
unsigned long long *v1;
void *v3;
v1 = safe_hasher(a0, a1);
if (!*(v1)) {
v3 = 0;
} else {
v0[0] = v1;
while (true) {
if (!v0) {
v3 = 0;
break;
}
if (a1 == v0[0]) {
LABEL_400356:
v3 = v0[0];
break;
} else {
if (!(!a0->field_38(a1, v0[0], v0[0], a0->field_38)))
goto LABEL_400356;
v0[0] = v0[1];
}
}
}
return v3;
} | gnutls | angr_phoenix |
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;
} | long long acl_extended_fd(unsigned long a0) {
unsigned int v0;
unsigned int v1;
unsigned long long v7;
v0 = 28;
v1 = fgetxattr(a0, "system.posix_acl_access", 0x0, 0x0);
if (v1 < 0 && *(__errno_location()) != 61 && *(__errno_location()) != 61) {
v7 = 4294967295;
return v7;
}
if (v1 > v0) {
v7 = 1;
return v7;
}
v1 = fgetxattr(a0, "system.posix_acl_default", 0x0, 0x0);
if (v1 < 0 && *(__errno_location()) != 61 && *(__errno_location()) != 61) {
v7 = 4294967295;
return v7;
}
v7 = (v1 < v0 ? 1 : 0);
return v7;
} | acl-2.3.1 | angr_sailr |
void print_clock_t(fp, t) FILE *fp;
clock_t t;
{
time_t timestamp;
long minutes;
int seconds, seconds_fraction;
clock_t_to_secs(t, ×tamp, &seconds_fraction);
minutes = timestamp / 60;
seconds = timestamp % 60;
fprintf(fp, "%ldm%d%c%03ds", minutes, seconds, locale_decpoint(),
seconds_fraction);
} | long long print_clock_t(void *a0, unsigned long a1, unsigned long a2,
unsigned long a3, unsigned long long a4,
unsigned long long a5) {
char v0;
unsigned int v1;
char v2;
unsigned long v3;
clock_t_to_secs(a1, &v2, &v0);
v3 = ((*(&v2) * 9838263505978427529 >> 64) + *(&v2) >> 5) - (*(&v2) >> 63);
v1 = *(&v2) -
(((*(&v2) * 9838263505978427529 >> 64) + *(&v2) >> 5) - (*(&v2) >> 63)) *
60;
fprintf(a0, "%ldm%d%c%03ds", v3, v1,
locale_decpoint(
a0, &v2,
*(&v2) - (((*(&v2) * 9838263505978427529 >> 64) + *(&v2) >> 5) -
(*(&v2) >> 63)) *
60,
*(&v2) - (((*(&v2) * 9838263505978427529 >> 64) + *(&v2) >> 5) -
(*(&v2) >> 63)) *
60,
a4, a5, a1),
*(&v0));
return 0;
} | bash | angr_dream |
_Bool
millerrabin2 (const uintmax_t *np, uintmax_t ni, const uintmax_t *bp,
const uintmax_t *qp, unsigned int k, const uintmax_t *one)
{
uintmax_t y1, y0, nm1_1, nm1_0, r1m;
y0 = powm2(&r1m, bp, qp, np, ni, one);
y1 = r1m;
if (y0 == one[0] && y1 == one[1])
return 1;
__asm__("subq %5,%q1\n\tsbbq %3,%q0"
: "=r"(nm1_1), "=&r"(nm1_0)
: "0"((UDItype)(np[1])), "rme"((UDItype)(one[1])),
"1"((UDItype)(np[0])), "rme"((UDItype)(one[0])));
if (y0 == nm1_0 && y1 == nm1_1)
return 1;
for (unsigned int i = 1; i < k; i++) {
y0 = mulredc2(&r1m, y1, y0, y1, y0, np[1], np[0], ni);
y1 = r1m;
if (y0 == nm1_0 && y1 == nm1_1)
return 1;
if (y0 == one[0] && y1 == one[1])
return 0;
}
return 0;
} | long millerrabin2(long a1, long a2, long *a3, unsigned long *a4,
unsigned int a5, long *a6) {
__int128 v7;
long v8;
unsigned int i;
unsigned long v12;
__int128 v13;
__int128 v14;
unsigned long v15;
v15 = __readfsqword(0x28u);
*((_QWORD *)&v13 + 1) =
powm2((long *)&v12, a3, a4, (unsigned long *)a1, a2, a6);
*(_QWORD *)&v13 = v12;
if (v13 == __PAIR128__(*a6, a6[1]))
return 1LL;
v7 = *(_OWORD *)a1 - *(_OWORD *)a6;
*(_QWORD *)&v14 = *((_QWORD *)&v7 + 1);
*((_QWORD *)&v14 + 1) = v7;
if (v13 == __PAIR128__(v7, *((unsigned long *)&v7 + 1)))
return 1LL;
for (i = 1; i < a5; ++i) {
v8 = mulredc2(&v12, v13, *((unsigned long *)&v13 + 1), v13,
*((unsigned long *)&v13 + 1), *(_QWORD *)(a1 + 8),
*(_QWORD *)a1, a2);
*((_QWORD *)&v13 + 1) = v8;
*(_QWORD *)&v13 = v12;
if (__PAIR128__(v8, v12) == v14)
return 1LL;
if (v13 == __PAIR128__(*a6, a6[1]))
return 0LL;
}
return 0LL;
} | coreutils | ida |
char *search_for_command(pathname, flags) const char *pathname;
int flags;
{
char *hashed_file, *command, *path_list;
int temp_path, st;
SHELL_VAR *path;
hashed_file = command = (char *)((void *)0);
path = find_variable_tempenv("PATH");
temp_path = path && ((((path)->attributes) & (0x0100000)));
if (temp_path == 0 && (flags & 0x02) == 0 && absolute_program(pathname) == 0)
hashed_file = phash_search(pathname);
if (hashed_file && (posixly_correct || check_hashed_filenames)) {
st = file_status(hashed_file);
if ((st & (0x1 | 0x2)) != (0x1 | 0x2)) {
phash_remove(pathname);
sh_xfree((hashed_file), "findcmd.c", 367);
hashed_file = (char *)((void *)0);
}
}
if (hashed_file)
command = hashed_file;
else if (absolute_program(pathname))
command = (char *)strcpy(
sh_xmalloc((1 + strlen(pathname)), "findcmd.c", 377), (pathname));
else {
if (flags & 0x02)
path_list = conf_standard_path();
else if (temp_path || path)
path_list = ((path)->value);
else
path_list = 0;
command = find_user_command_in_path(pathname, path_list, 0x4 | 0x20, &st);
if (command && hashing_enabled && temp_path == 0 && (flags & 0x01)) {
if (((command)[0] == (pathname)[0] && strcmp(command, pathname) == 0)) {
if (st & 0x2)
phash_insert((char *)pathname, command, dot_found_in_search, 1);
}
else if (posixly_correct || check_hashed_filenames) {
if (st & 0x2)
phash_insert((char *)pathname, command, dot_found_in_search, 1);
} else
phash_insert((char *)pathname, command, dot_found_in_search, 1);
}
if (flags & 0x02)
sh_xfree((path_list), "findcmd.c", 411);
}
return (command);
} | char *search_for_command(char *param_1, uint param_2)
{
int iVar1;
size_t sVar2;
char *__dest;
long in_FS_OFFSET;
uint local_38;
int local_34;
char *local_30;
char *local_28;
undefined8 local_20;
long local_18;
long local_10;
local_10 = *(long *)(in_FS_OFFSET + 0x28);
local_28 = (char *)0x0;
local_30 = (char *)0x0;
local_18 = find_variable_tempenv(&DAT_0010105b);
if ((local_18 == 0) || ((*(uint *)(local_18 + 0x28) & 0x100000) == 0)) {
local_34 = 0;
} else {
local_34 = 1;
}
if ((local_34 == 0) && ((param_2 & 2) == 0)) {
iVar1 = absolute_program(param_1);
if (iVar1 == 0) {
local_30 = (char *)phash_search(param_1);
}
}
if ((local_30 != (char *)0x0) &&
((posixly_correct != 0 || (check_hashed_filenames != 0)))) {
local_38 = file_status(local_30);
if ((local_38 & 3) != 3) {
phash_remove(param_1);
sh_xfree(local_30, "findcmd.c", 0x16f);
local_30 = (char *)0x0;
}
}
if (local_30 != (char *)0x0) {
local_28 = local_30;
goto LAB_00100686;
}
iVar1 = absolute_program(param_1);
if (iVar1 != 0) {
sVar2 = strlen(param_1);
__dest = (char *)sh_xmalloc(sVar2 + 1, "findcmd.c", 0x179);
local_28 = strcpy(__dest, param_1);
goto LAB_00100686;
}
if ((param_2 & 2) == 0) {
if ((local_34 == 0) && (local_18 == 0)) {
local_20 = 0;
} else {
local_20 = *(undefined8 *)(local_18 + 8);
}
} else {
local_20 = conf_standard_path();
}
local_28 =
(char *)find_user_command_in_path(param_1, local_20, 0x24, &local_38);
if ((((local_28 != (char *)0x0) && (hashing_enabled != 0)) &&
(local_34 == 0)) &&
((param_2 & 1) != 0)) {
if (*local_28 == *param_1) {
iVar1 = strcmp(local_28, param_1);
if (iVar1 == 0) {
if ((local_38 & 2) != 0) {
phash_insert(param_1, local_28, dot_found_in_search, 1);
}
goto LAB_00100664;
}
}
if ((posixly_correct == 0) && (check_hashed_filenames == 0)) {
phash_insert(param_1, local_28, dot_found_in_search, 1);
} else if ((local_38 & 2) != 0) {
phash_insert(param_1, local_28, dot_found_in_search, 1);
}
}
LAB_00100664:
if ((param_2 & 2) != 0) {
sh_xfree(local_20, "findcmd.c", 0x19b);
}
LAB_00100686:
if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) {
__stack_chk_fail();
}
return local_28;
} | bash | ghidra |
, "unexpected getopt_long() value '%c'.\n", c)
;
return 1;
}
}
if (optind >= argc) {
log_printf(3, "missing filename.\n");
return 1;
} | void getopt_long(void)
{
halt_baddata();
} | kmod | ghidra |
int u32tochar(x, s)
unsigned long x;
char *s;
{
int l;
l = (x <= (0x7f * 2 + 1)) ? 1 : ((x <= (0x7fff * 2 + 1)) ? 2 : 4);
if (x <= (0x7f * 2 + 1))
s[0] = x & 0xFF;
else if (x <= (0x7fff * 2 + 1)) {
s[0] = (x >> 8) & 0xFF;
s[1] = x & 0xFF;
} else {
s[0] = (x >> 24) & 0xFF;
s[1] = (x >> 16) & 0xFF;
s[2] = (x >> 8) & 0xFF;
s[3] = x & 0xFF;
}
s[l] = '\0';
return l;
} | long long u32tochar(unsigned long a0, char a1[4]) {
unsigned int v0;
unsigned int v2;
if (a0 <= 255) {
v2 = 1;
} else if (a0 <= 65535) {
v2 = 2;
} else {
v2 = 4;
}
v0 = v2;
if (a0 <= 255) {
a1[0] = a0;
} else if (a0 <= 65535) {
a1[0] = a0 / 0x100;
a1[1] = a0;
} else {
a1[0] = a0 / 0x1000000;
a1[1] = a0 / 0x10000;
a1[2] = a0 / 0x100;
a1[3] = a0;
}
a1[v0] = 0;
return v0;
} | bash | angr_dream |
static int can_parse_opt(struct link_util *lu, int argc, char **argv,
struct nlmsghdr *n) {
struct can_bittiming bt = {}, dbt = {};
struct can_ctrlmode cm = {0};
struct rtattr *tdc;
__u32 tdcv = -1, tdco = -1, tdcf = -1;
while (argc > 0) {
if (matches(*argv, "bitrate") == 0) {
do {
argv++;
if (--argc <= 0)
incomplete_command();
} while (0);
if (get_u32(&bt.bitrate, *argv, 0))
invarg("invalid \"bitrate\" value\n", *argv);
} else if (matches(*argv, "sample-point") == 0) {
float sp;
do {
argv++;
if (--argc <= 0)
incomplete_command();
} while (0);
if (get_float(&sp, *argv))
invarg("invalid \"sample-point\" value\n", *argv);
bt.sample_point = (__u32)(sp * 1000);
} else if (matches(*argv, "tq") == 0) {
do {
argv++;
if (--argc <= 0)
incomplete_command();
} while (0);
if (get_u32(&bt.tq, *argv, 0))
invarg("invalid \"tq\" value\n", *argv);
} else if (matches(*argv, "prop-seg") == 0) {
do {
argv++;
if (--argc <= 0)
incomplete_command();
} while (0);
if (get_u32(&bt.prop_seg, *argv, 0))
invarg("invalid \"prop-seg\" value\n", *argv);
} else if (matches(*argv, "phase-seg1") == 0) {
do {
argv++;
if (--argc <= 0)
incomplete_command();
} while (0);
if (get_u32(&bt.phase_seg1, *argv, 0))
invarg("invalid \"phase-seg1\" value\n", *argv);
} else if (matches(*argv, "phase-seg2") == 0) {
do {
argv++;
if (--argc <= 0)
incomplete_command();
} while (0);
if (get_u32(&bt.phase_seg2, *argv, 0))
invarg("invalid \"phase-seg2\" value\n", *argv);
} else if (matches(*argv, "sjw") == 0) {
do {
argv++;
if (--argc <= 0)
incomplete_command();
} while (0);
if (get_u32(&bt.sjw, *argv, 0))
invarg("invalid \"sjw\" value\n", *argv);
} else if (matches(*argv, "dbitrate") == 0) {
do {
argv++;
if (--argc <= 0)
incomplete_command();
} while (0);
if (get_u32(&dbt.bitrate, *argv, 0))
invarg("invalid \"dbitrate\" value\n", *argv);
} else if (matches(*argv, "dsample-point") == 0) {
float sp;
do {
argv++;
if (--argc <= 0)
incomplete_command();
} while (0);
if (get_float(&sp, *argv))
invarg("invalid \"dsample-point\" value\n", *argv);
dbt.sample_point = (__u32)(sp * 1000);
} else if (matches(*argv, "dtq") == 0) {
do {
argv++;
if (--argc <= 0)
incomplete_command();
} while (0);
if (get_u32(&dbt.tq, *argv, 0))
invarg("invalid \"dtq\" value\n", *argv);
} else if (matches(*argv, "dprop-seg") == 0) {
do {
argv++;
if (--argc <= 0)
incomplete_command();
} while (0);
if (get_u32(&dbt.prop_seg, *argv, 0))
invarg("invalid \"dprop-seg\" value\n", *argv);
} else if (matches(*argv, "dphase-seg1") == 0) {
do {
argv++;
if (--argc <= 0)
incomplete_command();
} while (0);
if (get_u32(&dbt.phase_seg1, *argv, 0))
invarg("invalid \"dphase-seg1\" value\n", *argv);
} else if (matches(*argv, "dphase-seg2") == 0) {
do {
argv++;
if (--argc <= 0)
incomplete_command();
} while (0);
if (get_u32(&dbt.phase_seg2, *argv, 0))
invarg("invalid \"dphase-seg2\" value\n", *argv);
} else if (matches(*argv, "dsjw") == 0) {
do {
argv++;
if (--argc <= 0)
incomplete_command();
} while (0);
if (get_u32(&dbt.sjw, *argv, 0))
invarg("invalid \"dsjw\" value\n", *argv);
} else if (matches(*argv, "tdcv") == 0) {
do {
argv++;
if (--argc <= 0)
incomplete_command();
} while (0);
if (get_u32(&tdcv, *argv, 0))
invarg("invalid \"tdcv\" value\n", *argv);
} else if (matches(*argv, "tdco") == 0) {
do {
argv++;
if (--argc <= 0)
incomplete_command();
} while (0);
if (get_u32(&tdco, *argv, 0))
invarg("invalid \"tdco\" value\n", *argv);
} else if (matches(*argv, "tdcf") == 0) {
do {
argv++;
if (--argc <= 0)
incomplete_command();
} while (0);
if (get_u32(&tdcf, *argv, 0))
invarg("invalid \"tdcf\" value\n", *argv);
} else if (matches(*argv, "loopback") == 0) {
do {
argv++;
if (--argc <= 0)
incomplete_command();
} while (0);
set_ctrlmode("loopback", *argv, &cm, 0x01);
} else if (matches(*argv, "listen-only") == 0) {
do {
argv++;
if (--argc <= 0)
incomplete_command();
} while (0);
set_ctrlmode("listen-only", *argv, &cm, 0x02);
} else if (matches(*argv, "triple-sampling") == 0) {
do {
argv++;
if (--argc <= 0)
incomplete_command();
} while (0);
set_ctrlmode("triple-sampling", *argv, &cm, 0x04);
} else if (matches(*argv, "one-shot") == 0) {
do {
argv++;
if (--argc <= 0)
incomplete_command();
} while (0);
set_ctrlmode("one-shot", *argv, &cm, 0x08);
} else if (matches(*argv, "berr-reporting") == 0) {
do {
argv++;
if (--argc <= 0)
incomplete_command();
} while (0);
set_ctrlmode("berr-reporting", *argv, &cm, 0x10);
} else if (matches(*argv, "fd") == 0) {
do {
argv++;
if (--argc <= 0)
incomplete_command();
} while (0);
set_ctrlmode("fd", *argv, &cm, 0x20);
} else if (matches(*argv, "fd-non-iso") == 0) {
do {
argv++;
if (--argc <= 0)
incomplete_command();
} while (0);
set_ctrlmode("fd-non-iso", *argv, &cm, 0x80);
} else if (matches(*argv, "presume-ack") == 0) {
do {
argv++;
if (--argc <= 0)
incomplete_command();
} while (0);
set_ctrlmode("presume-ack", *argv, &cm, 0x40);
} else if (matches(*argv, "cc-len8-dlc") == 0) {
do {
argv++;
if (--argc <= 0)
incomplete_command();
} while (0);
set_ctrlmode("cc-len8-dlc", *argv, &cm, 0x100);
} else if (matches(*argv, "tdc-mode") == 0) {
do {
argv++;
if (--argc <= 0)
incomplete_command();
} while (0);
if (strcmp(*argv, "auto") == 0) {
cm.flags |= 0x200;
cm.mask |= 0x200;
} else if (strcmp(*argv, "manual") == 0) {
cm.flags |= 0x400;
cm.mask |= 0x400;
} else if (strcmp(*argv, "off") == 0) {
cm.mask |= 0x200 | 0x400;
} else {
fprintf(stderr,
"Error: argument of \"tdc-mode\" must be \"auto\", \"manual\" "
"or \"off\", not \"%s\"\n",
*argv);
exit(-1);
}
} else if (matches(*argv, "restart") == 0) {
__u32 val = 1;
addattr32(n, 1024, IFLA_CAN_RESTART, val);
} else if (matches(*argv, "restart-ms") == 0) {
__u32 val;
do {
argv++;
if (--argc <= 0)
incomplete_command();
} while (0);
if (get_u32(&val, *argv, 0))
invarg("invalid \"restart-ms\" value\n", *argv);
addattr32(n, 1024, IFLA_CAN_RESTART_MS, val);
} else if (matches(*argv, "termination") == 0) {
__u16 val;
do {
argv++;
if (--argc <= 0)
incomplete_command();
} while (0);
if (get_u16(&val, *argv, 0))
invarg("invalid \"termination\" value\n", *argv);
addattr16(n, 1024, IFLA_CAN_TERMINATION, val);
} else if (matches(*argv, "help") == 0) {
usage();
return -1;
} else {
fprintf(stderr, "can: unknown option \"%s\"\n", *argv);
usage();
return -1;
}
argc--, argv++;
}
if (bt.bitrate || bt.tq)
addattr_l(n, 1024, IFLA_CAN_BITTIMING, &bt, sizeof(bt));
if (dbt.bitrate || dbt.tq)
addattr_l(n, 1024, IFLA_CAN_DATA_BITTIMING, &dbt, sizeof(dbt));
if (cm.mask)
addattr_l(n, 1024, IFLA_CAN_CTRLMODE, &cm, sizeof(cm));
if (tdcv != -1 || tdco != -1 || tdcf != -1) {
tdc = addattr_nest(n, 1024, IFLA_CAN_TDC | (1 << 15));
if (tdcv != -1)
addattr32(n, 1024, IFLA_CAN_TDC_TDCV, tdcv);
if (tdco != -1)
addattr32(n, 1024, IFLA_CAN_TDC_TDCO, tdco);
if (tdcf != -1)
addattr32(n, 1024, IFLA_CAN_TDC_TDCF, tdcf);
addattr_nest_end(n, tdc);
}
return 0;
} | long long can_parse_opt(unsigned long a0, unsigned long a1, unsigned long a2,
unsigned long long a3) {
unsigned long long *v0;
int tmp_18;
int tmp_27;
int tmp_13;
unsigned int v1;
unsigned long v2;
unsigned int v3;
unsigned int v4;
unsigned int v5;
char v6;
unsigned int v7;
unsigned long long v8;
unsigned int v9;
unsigned int v10;
void *v11;
void *v13;
void *v14;
void *v15;
void *v16;
void *v18;
void *v19;
void *v20;
unsigned long long v51;
unsigned long long v52;
unsigned long long v54;
unsigned long long v55;
unsigned long long v56;
unsigned long long v58;
v2 = a0;
v1 = a1;
v0 = a2;
v11 = 0;
v13 = 0;
v14 = 0;
v15 = 0;
v16 = 0;
v18 = 0;
v19 = 0;
v20 = 0;
v9 = 0;
v3 = -1;
v4 = -1;
for (v5 = -1; true; v0 += 1) {
if (v1 <= 0) {
if (v11 || v13)
addattr_l(a3, 0x400, 0x1, &v11, 0x20);
if (v16 || v18)
addattr_l(a3, 0x400, 0x9, &v16, 0x20);
if (v9)
addattr_l(a3, 0x400, 0x5, &v9, 0x8);
if (v3 != -1 || v4 != -1 || v5 != -1) {
v8 = addattr_nest(a3, 0x400, 0x8010);
if (v3 != -1)
addattr32(a3, 0x400, 0x7, v3);
if (v4 != -1)
addattr32(a3, 0x400, 0x8, v4);
if (v5 != -1)
addattr32(a3, 0x400, 0x9, v5);
addattr_nest_end(a3, v8, v8);
}
v58 = 0;
break;
} else {
if ((matches(*(v0), "bitrate") ^ 1)) {
v0 = v0 + 1;
v1 -= 1;
if (v1 <= 0)
incomplete_command();
if (get_u32(&v11, *(v0), 0x0, *(v0))) {
invarg("invalid \"bitrate\" value\n", *(v0));
} else {
v1 -= 1;
continue;
}
}
if ((matches(*(v0), "sample-point") ^ 1)) {
v0 = v0 + 1;
v1 -= 1;
if (v1 <= 0)
incomplete_command();
if (get_float(&v6, *(v0)))
invarg("invalid \"sample-point\" value\n", *(v0));
s_54 = L Conv(128->32,
(0x447a0000 < 128 >
*Conv(32->128, Load(addr = stack_base - 112, size = 4,
endness = Iend_LE))))<4>
v1 -= 1;
} else {
if ((matches(*(v0), "tq") ^ 1)) {
v0 = v0 + 1;
v1 -= 1;
if (v1 <= 0)
incomplete_command();
if (get_u32(&v13, *(v0), 0x0, &v13)) {
invarg("invalid \"tq\" value\n", *(v0));
} else {
v1 -= 1;
continue;
}
}
if ((matches(*(v0), "prop-seg") ^ 1)) {
v0 = v0 + 1;
v1 -= 1;
if (v1 <= 0)
incomplete_command();
if (get_u32(&v13, *(v0), 0x0, &v13)) {
invarg("invalid \"prop-seg\" value\n", *(v0));
} else {
v1 -= 1;
continue;
}
}
if ((matches(*(v0), "phase-seg1") ^ 1)) {
v0 = v0 + 1;
v1 -= 1;
if (v1 <= 0)
incomplete_command();
if (get_u32(&v14, *(v0), 0x0, &v14)) {
invarg("invalid \"phase-seg1\" value\n", *(v0));
} else {
v1 -= 1;
continue;
}
}
if ((matches(*(v0), "phase-seg2") ^ 1)) {
v0 = v0 + 1;
v1 -= 1;
if (v1 <= 0)
incomplete_command();
if (get_u32(&v14, *(v0), 0x0, &v14)) {
invarg("invalid \"phase-seg2\" value\n", *(v0));
} else {
v1 -= 1;
continue;
}
}
if ((matches(*(v0), "sjw") ^ 1)) {
v0 = v0 + 1;
v1 -= 1;
if (v1 <= 0)
incomplete_command();
if (get_u32(&v15, *(v0), 0x0, &v15)) {
invarg("invalid \"sjw\" value\n", *(v0));
} else {
v1 -= 1;
continue;
}
}
if ((matches(*(v0), "dbitrate") ^ 1)) {
v0 = v0 + 1;
v1 -= 1;
if (v1 <= 0)
incomplete_command();
if (get_u32(&v16, *(v0), 0x0, *(v0))) {
invarg("invalid \"dbitrate\" value\n", *(v0));
} else {
v1 -= 1;
continue;
}
}
if ((matches(*(v0), "dsample-point") ^ 1)) {
v0 = v0 + 1;
v1 -= 1;
if (v1 <= 0)
incomplete_command();
if (get_float(&v6, *(v0)))
invarg("invalid \"dsample-point\" value\n", *(v0));
s_34 = L Conv(128->32,
(0x447a0000 < 128 >
*Conv(32->128, Load(addr = stack_base - 112, size = 4,
endness = Iend_LE))))<4>
v1 -= 1;
} else {
if ((matches(*(v0), "dtq") ^ 1)) {
v0 = v0 + 1;
v1 -= 1;
if (v1 <= 0)
incomplete_command();
if (get_u32(&v18, *(v0), 0x0, &v18)) {
invarg("invalid \"dtq\" value\n", *(v0));
} else {
v1 -= 1;
continue;
}
}
if ((matches(*(v0), "dprop-seg") ^ 1)) {
v0 = v0 + 1;
v1 -= 1;
if (v1 <= 0)
incomplete_command();
if (get_u32(&v18, *(v0), 0x0, &v18)) {
invarg("invalid \"dprop-seg\" value\n", *(v0));
} else {
v1 -= 1;
continue;
}
}
if ((matches(*(v0), "dphase-seg1") ^ 1)) {
v0 = v0 + 1;
v1 -= 1;
if (v1 <= 0)
incomplete_command();
if (get_u32(&v19, *(v0), 0x0, &v19)) {
invarg("invalid \"dphase-seg1\" value\n", *(v0));
} else {
v1 -= 1;
continue;
}
}
if ((matches(*(v0), "dphase-seg2") ^ 1)) {
v0 = v0 + 1;
v1 -= 1;
if (v1 <= 0)
incomplete_command();
if (get_u32(&v19, *(v0), 0x0, &v19)) {
invarg("invalid \"dphase-seg2\" value\n", *(v0));
} else {
v1 -= 1;
continue;
}
}
if ((matches(*(v0), "dsjw") ^ 1)) {
v0 = v0 + 1;
v1 -= 1;
if (v1 <= 0)
incomplete_command();
if (get_u32(&v20, *(v0), 0x0, &v20)) {
invarg("invalid \"dsjw\" value\n", *(v0));
} else {
v1 -= 1;
continue;
}
}
if ((matches(*(v0), "tdcv") ^ 1)) {
v0 = v0 + 1;
v1 -= 1;
if (v1 <= 0)
incomplete_command();
if (get_u32(&v3, *(v0), 0x0, *(v0))) {
invarg("invalid \"tdcv\" value\n", *(v0));
} else {
v1 -= 1;
continue;
}
}
if ((matches(*(v0), "tdco") ^ 1)) {
v0 = v0 + 1;
v1 -= 1;
if (v1 <= 0)
incomplete_command();
if (get_u32(&v4, *(v0), 0x0, *(v0))) {
invarg("invalid \"tdco\" value\n", *(v0));
} else {
v1 -= 1;
continue;
}
}
if ((matches(*(v0), "tdcf") ^ 1)) {
v0 = v0 + 1;
v1 -= 1;
if (v1 <= 0)
incomplete_command();
if (get_u32(&v5, *(v0), 0x0, *(v0))) {
invarg("invalid \"tdcf\" value\n", *(v0));
} else {
v1 -= 1;
continue;
}
}
if ((matches(*(v0), "loopback") ^ 1)) {
v0 = v0 + 1;
v1 -= 1;
if (v1 <= 0)
incomplete_command();
set_ctrlmode("loopback", *(v0), &v9, 0x1);
} else if ((matches(*(v0), "listen-only") ^ 1)) {
v0 = v0 + 1;
v1 -= 1;
if (v1 <= 0)
incomplete_command();
set_ctrlmode("listen-only", *(v0), &v9, 0x2);
} else if ((matches(*(v0), "triple-sampling") ^ 1)) {
v0 = v0 + 1;
v1 -= 1;
if (v1 <= 0)
incomplete_command();
set_ctrlmode("triple-sampling", *(v0), &v9, 0x4);
} else if ((matches(*(v0), "one-shot") ^ 1)) {
v0 = v0 + 1;
v1 -= 1;
if (v1 <= 0)
incomplete_command();
set_ctrlmode("one-shot", *(v0), &v9, 0x8);
} else if ((matches(*(v0), "berr-reporting") ^ 1)) {
v0 = v0 + 1;
v1 -= 1;
if (v1 <= 0)
incomplete_command();
set_ctrlmode("berr-reporting", *(v0), &v9, 0x10);
} else if ((matches(*(v0), "fd") ^ 1)) {
v0 = v0 + 1;
v1 -= 1;
if (v1 <= 0)
incomplete_command();
set_ctrlmode("fd", *(v0), &v9, 0x20);
} else if ((matches(*(v0), "fd-non-iso") ^ 1)) {
v0 = v0 + 1;
v1 -= 1;
if (v1 <= 0)
incomplete_command();
set_ctrlmode("fd-non-iso", *(v0), &v9, 0x80);
} else if ((matches(*(v0), "presume-ack") ^ 1)) {
v0 = v0 + 1;
v1 -= 1;
if (v1 <= 0)
incomplete_command();
set_ctrlmode("presume-ack", *(v0), &v9, 0x40);
} else if ((matches(*(v0), "cc-len8-dlc") ^ 1)) {
v0 = v0 + 1;
v1 -= 1;
if (v1 <= 0)
incomplete_command();
set_ctrlmode("cc-len8-dlc", *(v0), &v9, 0x100);
} else if ((matches(*(v0), "tdc-mode") ^ 1)) {
v0 = v0 + 1;
v1 -= 1;
if (v1 <= 0)
incomplete_command();
if (!strcmp(*(v0), "auto")) {
v51 = *((&v9 + 4));
*(&v51) = (*((&v9 + 4)) >> 8) | 2;
tmp_18 = v51;
v10 = tmp_18;
v52 = v9;
*(&v52) = (v9 >> 8) | 2;
tmp_27 = v52;
v9 = tmp_27;
} else {
if (!strcmp(*(v0), "manual")) {
v54 = *((&v9 + 4));
*(&v54) = (*((&v9 + 4)) >> 8) | 4;
tmp_18 = v54;
v10 = tmp_18;
v55 = v9;
*(&v55) = (v9 >> 8) | 4;
tmp_27 = v55;
v9 = tmp_27;
} else {
if (strcmp(*(v0), "off")) {
fprintf(*(&stderr),
"Error: argument of \"tdc-mode\" must be \"auto\", "
"\"manual\" or \"off\", not \"%s\"\n",
*(v0));
exit(0xffffffff);
}
v56 = v9;
*(&v56) = (v9 >> 8) | 6;
tmp_13 = v56;
v9 = tmp_13;
}
}
} else if ((matches(*(v0), "restart") ^ 1)) {
v7 = 1;
addattr32(a3, 0x400, 0x7, v7);
} else if ((matches(*(v0), "restart-ms") ^ 1)) {
v0 = v0 + 1;
v1 -= 1;
if (v1 <= 0)
incomplete_command();
if (get_u32(&v6, *(v0), 0x0, *(v0)))
invarg("invalid \"restart-ms\" value\n", *(v0));
addattr32(a3, 0x400, 0x6, *(&v6));
} else if ((matches(*(v0), "termination") ^ 1)) {
v0 = v0 + 1;
v1 -= 1;
if (v1 <= 0)
incomplete_command();
if (get_u16(&v6, *(v0), 0x0, *(v0)))
invarg("invalid \"termination\" value\n", *(v0));
addattr16(a3, 0x400, 0xb, *(&v6));
} else if ((matches(*(v0), "help") ^ 1)) {
usage();
v58 = 4294967295;
break;
} else {
fprintf(*(&stderr), "can: unknown option \"%s\"\n", *(v0));
usage();
v58 = 4294967295;
break;
}
v1 -= 1;
}
}
}
}
return v58;
} | iproute2-6.0.0 | angr_sailr |
int _ssh_send_banner(struct ssh *ssh, struct sshbuf *banner) {
char *cp;
int r;
if ((r = sshbuf_putf(banner, "SSH-2.0-%.100s\r\n", "OpenSSH_9.1")) != 0)
return r;
if ((r = sshbuf_putb(ssh_packet_get_output(ssh), banner)) != 0)
return r;
if ((r = sshbuf_consume_end(banner, 2)) != 0)
return r;
if ((cp = sshbuf_dup_string(banner)) == ((void *)0))
return -2;
sshlog("ssh_api.c", __func__, 422, 0, SYSLOG_LEVEL_DEBUG1, ((void *)0),
"Local version string %.100s", cp);
free(cp);
return 0;
} | int _ssh_send_banner(unsigned long long a0, unsigned long long a1) {
unsigned int v0;
void *v1;
unsigned int v3;
v0 = sshbuf_putf(a1, "SSH-2.0-%.100s\r\n", "OpenSSH_9.1");
if (v0) {
v3 = v0;
return v3;
}
v3 = ssh_packet_get_output(a0);
v0 = sshbuf_putb(v3, a1, v3);
if (v0) {
v3 = v0;
return v3;
}
v0 = sshbuf_consume_end(a1, 0x2);
if (v0) {
v3 = v0;
return v3;
}
v1 = sshbuf_dup_string(a1);
if (!v1) {
v3 = -2;
return v3;
}
sshlog("ssh_api.c", "_ssh_send_banner", 0x1a6, 0x0, 0x5, 0x0,
"Local version string %.100s", v1);
free(v1);
v3 = 0;
return v3;
} | openssh-portable | angr_sailr |
void post_postinst_tasks(struct pkginfo *pkg, enum pkgstatus new_status) {
if (new_status < PKG_STAT_TRIGGERSAWAITED)
pkg_set_status(pkg, new_status);
else if (pkg->trigaw.head)
pkg_set_status(pkg, PKG_STAT_TRIGGERSAWAITED);
else if (pkg->trigpend_head)
pkg_set_status(pkg, PKG_STAT_TRIGGERSPENDING);
else
pkg_set_status(pkg, PKG_STAT_INSTALLED);
modstatdb_note(pkg);
debug(dbg_triggersdetail, "post_postinst_tasks - trig_incorporate");
trig_incorporate(modstatdb_get_status());
} | long post_postinst_tasks(long a1, unsigned int a2) {
unsigned int status;
if (a2 > 4) {
if (*(_QWORD *)(a1 + 328)) {
pkg_set_status(a1, 5LL);
} else if (*(_QWORD *)(a1 + 352)) {
pkg_set_status(a1, 6LL);
} else {
pkg_set_status(a1, 7LL);
}
} else {
pkg_set_status(a1, a2);
}
modstatdb_note(a1);
debug(0x2000LL, "post_postinst_tasks - trig_incorporate");
status = modstatdb_get_status();
return trig_incorporate(status);
} | dpkg | ida |
int match_user(const char *user, const char *host, const char *ipaddr,
const char *pattern) {
char *p, *pat;
int ret;
if (user == ((void *)0) && host == ((void *)0) && ipaddr == ((void *)0)) {
if ((p = strchr(pattern, '@')) != ((void *)0) &&
match_host_and_ip(((void *)0), ((void *)0), p + 1) < 0)
return -1;
return 0;
}
if ((p = strchr(pattern, '@')) == ((void *)0))
return match_pattern(user, pattern);
pat = xstrdup(pattern);
p = strchr(pat, '@');
*p++ = '\0';
if ((ret = match_pattern(user, pat)) == 1)
ret = match_host_and_ip(host, ipaddr, p);
free(pat);
return ret;
} | long long match_user(unsigned long long a0, unsigned long long a1,
unsigned long long a2, char *a3) {
int tmp_14;
unsigned int v0;
char *v1;
void *v2;
unsigned long long v4;
if (!a0 && !a1 && !a2) {
v1 = strchr(a3, 0x40);
if (!v1) {
v4 = 0;
return v4;
} else if (match_host_and_ip(0x0, 0x0, v1 + 1) >= 0) {
v4 = 0;
return v4;
} else {
v4 = 4294967295;
return v4;
}
}
v1 = strchr(a3, 0x40);
if (!v1) {
v4 = match_pattern(a0, a3);
return v4;
}
v2 = xstrdup(a3);
v1 = strchr(v2, 0x40);
tmp_14 = v1;
v1 += 1;
*(tmp_14) = 0;
v0 = match_pattern(a0, v2);
if (v0 == 1)
v0 = match_host_and_ip(a1, a2, v1);
free(v2);
v4 = v0;
return v4;
} | openssh-portable | angr_sailr |
int pkcs11_init(int interactive) { return (0); } | undefined8 pkcs11_init(void)
{
return 0;
} | openssh-portable | ghidra |
static gl_list_t gl_linked_nx_create(gl_list_implementation_t implementation,
gl_listelement_equals_fn equals_fn,
gl_listelement_hashcode_fn hashcode_fn,
gl_listelement_dispose_fn dispose_fn,
_Bool allow_duplicates, size_t count,
const void **contents) {
struct gl_list_impl *list =
(struct gl_list_impl *)malloc(sizeof(struct gl_list_impl));
gl_list_node_t tail;
if (list == ((void *)0))
return ((void *)0);
list->base.vtable = implementation;
list->base.equals_fn = equals_fn;
list->base.hashcode_fn = hashcode_fn;
list->base.dispose_fn = dispose_fn;
list->base.allow_duplicates = allow_duplicates;
list->count = count;
tail = &list->root;
for (; count > 0; contents++, count--) {
gl_list_node_t node =
(struct gl_list_node_impl *)malloc(sizeof(struct gl_list_node_impl));
if (node == ((void *)0))
goto fail2;
node->value = *contents;
node->prev = tail;
tail->next = node;
tail = node;
}
tail->next = &list->root;
list->root.prev = tail;
return list;
fail2: {
gl_list_node_t node;
for (node = tail; node != &list->root;) {
gl_list_node_t prev = node->prev;
free(node);
node = prev;
}
}
free(list);
return ((void *)0);
} | long long gl_linked_nx_create(unsigned long a0, unsigned long a1,
unsigned long a2, unsigned long a3,
unsigned long a4, unsigned long a5,
unsigned long long *v6) {
unsigned long v0;
unsigned long long v1[3];
unsigned long long v2[3];
void *v3;
unsigned long long v4[3];
void *v5;
void *v7;
v0 = a5;
v3 = malloc(0x48);
if (!v3) {
v7 = 0;
} else {
*(v3) = a0;
*(&v3[8]) = a1;
*(&v3[16]) = a2;
*(&v3[24]) = a3;
*(&v3[32]) = a4;
*(&v3[64]) = v0;
v1[0] = v3 + 40;
while (true) {
if (!v0) {
v1[0] = v3 + 40;
*(&v3[48]) = v1;
v7 = v3;
break;
} else {
v4[0] = malloc(0x18);
if (v4) {
v4[2] = *(v6);
v4[1] = v1;
v1[0] = v4;
v1[0] = v4;
v6 += 1;
v0 -= 1;
} else {
for (v2[0] = v1; v2 != v3 + 40; v2[0] = v5) {
v5 = v2[1];
free(v2);
}
free(v3);
v7 = 0;
break;
}
}
}
}
return v7;
} | gnutls | angr_phoenix |
static WORD_LIST *expand_string_leave_quoted(string, quoted)
char *string;
int quoted;
{
WORD_LIST *tlist;
WORD_LIST *tresult;
if (string == 0 || *string == '\0')
return ((WORD_LIST *)((void *)0));
tlist = expand_string_internal(string, quoted);
if (tlist) {
tresult = word_list_split(tlist);
dispose_words(tlist);
return (tresult);
}
return ((WORD_LIST *)((void *)0));
} | int expand_string_leave_quoted(char *a0, unsigned int a1, unsigned int a2,
unsigned long a3, unsigned int a4,
unsigned long long a5) {
unsigned long v0;
unsigned long v1;
unsigned int v3;
if (!a0) {
LABEL_40b73f:
v3 = 0;
} else {
if (!*(a0))
goto LABEL_40b73f;
v0 = expand_string_internal(a0, a1);
if (!v0) {
v3 = 0;
} else {
v1 = word_list_split(v0, a1, a2, a3, a4, a5);
dispose_words(v0);
v3 = v1;
}
}
return v3;
} | bash | angr_phoenix |
static void tty_update_char(EditLine *el, int mode, int c) {
if (!((el->el_tty.t_t[mode][4].t_setmask & ((unsigned int)(1 << (c))))) &&
(el->el_tty.t_c[2][c] != el->el_tty.t_c[0][c]))
el->el_tty.t_c[mode][c] = el->el_tty.t_c[2][c];
if (el->el_tty.t_t[mode][4].t_clrmask & ((unsigned int)(1 << (c))))
el->el_tty.t_c[mode][c] = el->el_tty.t_vdisable;
} | void tty_update_char(struct_4 *a0, unsigned long a1, unsigned long a2) {
unsigned long v1;
unsigned long long v2;
if (!((1 << (a2 & 31)) & *(&a0->padding_0[280 + 64 * a1 + 16 * a1])) &&
a0->padding_0[498 + a2] != a0->padding_0[448 + a2])
a0->padding_0[448 + 25 * a1 + a2] = a0->padding_0[498 + a2];
v1 = (1 << (a2 & 31)) & *(&a0->padding_0[284 + 80 * a1]);
if (((1 << (a2 & 31)) & *(&a0->padding_0[284 + 64 * a1 + 16 * a1]))) {
v2 = &a0->padding_0[25 * a1 + a2 + 448];
a0->padding_0[448 + 25 * a1 + a2] = a0->field_309;
}
return;
} | libedit | angr_sailr |
int main(int argc, char **argv) {
int c;
_Bool args_specified;
_Bool arg_data = 0, arg_file_system = 0;
enum sync_mode mode;
_Bool ok = 1;
;
set_program_name(argv[0]);
setlocale(6, "");
bindtextdomain("coreutils", "/usr/local/share/locale");
textdomain("coreutils");
atexit(close_stdout);
while ((c = getopt_long(argc, argv, "df", long_options, ((void *)0))) != -1) {
switch (c) {
case 'd':
arg_data = 1;
break;
case 'f':
arg_file_system = 1;
break;
case GETOPT_HELP_CHAR:
usage(0);
break;
;
case GETOPT_VERSION_CHAR:
version_etc(stdout, "sync", "GNU coreutils", Version, ("Jim Meyering"),
("Giuseppe Scrivano"), (char *)((void *)0));
exit(0);
break;
;
default:
usage(1);
}
}
args_specified = optind < argc;
if (arg_data && arg_file_system) {
((!!sizeof(struct {
_Static_assert(1, "verify_expr ("
"1"
", "
"(error (1, 0, gettext (\"cannot specify both --data "
"and --file-system\")), assume (false))"
")");
int _gl_dummy;
}))
? ((error(1, 0,
gettext("cannot specify both --data and --file-system")),
((0) ? (void)0 : __builtin_unreachable())))
: ((error(1, 0,
gettext("cannot specify both --data and --file-system")),
((0) ? (void)0 : __builtin_unreachable()))));
}
if (!args_specified && arg_data)
((!!sizeof(struct {
_Static_assert(1, "verify_expr ("
"1"
", "
"(error (1, 0, gettext (\"--data needs at least one "
"argument\")), assume (false))"
")");
int _gl_dummy;
}))
? ((error(1, 0, gettext("--data needs at least one argument")),
((0) ? (void)0 : __builtin_unreachable())))
: ((error(1, 0, gettext("--data needs at least one argument")),
((0) ? (void)0 : __builtin_unreachable()))));
if (!args_specified || (arg_file_system && !1))
mode = MODE_SYNC;
else if (arg_file_system)
mode = MODE_FILE_SYSTEM;
else if (!arg_data)
mode = MODE_FILE;
else
mode = MODE_DATA;
if (mode == MODE_SYNC)
sync();
else {
for (; optind < argc; optind++)
ok &= sync_arg(mode, argv[optind]);
}
return ok ? 0 : 1;
} | int main(unsigned long a0, unsigned long long *a1) {
void *v0;
char v1;
char v2;
char v3;
char v4;
unsigned int v5;
unsigned int v6;
v1 = 0;
v2 = 0;
v3 = 1;
set_program_name(*(a1));
setlocale(0x6, &g_400963);
bindtextdomain("coreutils", "/usr/local/share/locale");
textdomain("coreutils");
atexit(got.close_stdout);
while (true) {
v6 = getopt_long(a0, a1, "df", &long_options, NULL);
if (v6 == -1) {
v4 = optind < a0;
if (v1 && v2)
error(0x1, 0x0,
gettext("cannot specify both --data and --file-system"));
if ((v4 ^ 1) && v1)
error(0x1, 0x0, gettext("--data needs at least one argument"));
if ((v4 ^ 1)) {
v5 = 3;
break;
} else if (v2) {
v5 = 2;
break;
} else if (!(v1 ^ 1)) {
v5 = 1;
break;
} else {
v5 = 0;
break;
}
}
if (v6 == 102) {
v2 = 1;
continue;
}
if (v6 > 102) {
LABEL_4006d5:
usage(0x1);
} else if (v6 == 100) {
v1 = 1;
} else {
if (v6 <= 100) {
if (v6 == -131) {
v0 = 0;
version_etc(stdout, "sync", "GNU coreutils", Version, "Jim Meyering",
"Giuseppe Scrivano");
exit(0x0);
} else if (v6 == -130) {
usage(0x0);
}
}
goto LABEL_4006d5;
}
}
if (v5 == 3) {
sync();
} else {
for (; a0 > optind; optind = optind + 1) {
v3 = (sync_arg(v5, a1[optind]) & v3);
}
}
return v3 ^ 1;
} | coreutils | angr_phoenix |
static void process_extended_hardlink(u_int32_t id) {
char *oldpath, *newpath;
int r, status;
if ((r = sshbuf_get_cstring(iqueue, &oldpath, ((void *)0))) != 0 ||
(r = sshbuf_get_cstring(iqueue, &newpath, ((void *)0))) != 0)
sshfatal("sftp-server.c", __func__, 1438, 1, SYSLOG_LEVEL_FATAL, ssh_err(r),
"parse");
sshlog("sftp-server.c", __func__, 1440, 0, SYSLOG_LEVEL_DEBUG3, ((void *)0),
"request %u: hardlink", id);
sshlog("sftp-server.c", __func__, 1441, 0, SYSLOG_LEVEL_INFO, ((void *)0),
"hardlink old \"%s\" new \"%s\"", oldpath, newpath);
r = link(oldpath, newpath);
status = (r == -1) ? errno_to_portable((*__errno_location())) : 0;
send_status(id, status);
free(oldpath);
free(newpath);
} | long long process_extended_hardlink(unsigned long a0) {
unsigned long long v0;
unsigned int v1;
unsigned int v2;
char v3;
char v4;
unsigned long long v5;
unsigned long long v6;
char v7;
unsigned int v9;
v1 = sshbuf_get_cstring(0xe87d894820ec8348, &v3, 0x0, &v3);
if (v1 || (v1 = sshbuf_get_cstring(0xe87d894820ec8348, &v4, 0x0, &v4), v1)) {
v0 = "parse";
sshfatal("sftp-server.c", "process_extended_hardlink", 0x59e, 0x1, 0x1,
ssh_err(v1));
}
v6 = a0;
v5 = "request %u: hardlink";
sshlog("sftp-server.c", "process_extended_hardlink", 0x5a0, 0x0, 0x7, 0x0,
*(&v7));
v7 = *(&v4);
v6 = *(&v3);
v5 = "hardlink old \"%s\" new \"%s\"";
sshlog("sftp-server.c", "process_extended_hardlink", 0x5a1, 0x0, 0x3, 0x0,
*(&v4));
v1 = link(*(&v3), *(&v4));
if (v1 != -1)
v9 = 0;
else
v9 = errno_to_portable(*(__errno_location()));
v2 = v9;
send_status(a0, v2);
free(*(&v3));
free(*(&v4));
return 0;
} | openssh-portable | angr_sailr |
static void print_explain(FILE *f) {
fprintf(f, "Usage: ... bond [ mode BONDMODE ] [ active_slave SLAVE_DEV ]\n"
" [ clear_active_slave ] [ miimon MIIMON ]\n"
" [ updelay UPDELAY ] [ downdelay DOWNDELAY ]\n"
" [ peer_notify_delay DELAY ]\n"
" [ use_carrier USE_CARRIER ]\n"
" [ arp_interval ARP_INTERVAL ]\n"
" [ arp_validate ARP_VALIDATE ]\n"
" [ arp_all_targets ARP_ALL_TARGETS ]\n"
" [ arp_ip_target [ ARP_IP_TARGET, ... ] ]\n"
" [ ns_ip6_target [ NS_IP6_TARGET, ... ] ]\n"
" [ primary SLAVE_DEV ]\n"
" [ primary_reselect PRIMARY_RESELECT ]\n"
" [ fail_over_mac FAIL_OVER_MAC ]\n"
" [ xmit_hash_policy XMIT_HASH_POLICY ]\n"
" [ resend_igmp RESEND_IGMP ]\n"
" [ num_grat_arp|num_unsol_na "
"NUM_GRAT_ARP|NUM_UNSOL_NA ]\n"
" [ all_slaves_active ALL_SLAVES_ACTIVE ]\n"
" [ min_links MIN_LINKS ]\n"
" [ lp_interval LP_INTERVAL ]\n"
" [ packets_per_slave PACKETS_PER_SLAVE ]\n"
" [ tlb_dynamic_lb TLB_DYNAMIC_LB ]\n"
" [ lacp_rate LACP_RATE ]\n"
" [ lacp_active LACP_ACTIVE]\n"
" [ ad_select AD_SELECT ]\n"
" [ ad_user_port_key PORTKEY ]\n"
" [ ad_actor_sys_prio SYSPRIO ]\n"
" [ ad_actor_system LLADDR ]\n"
" [ arp_missed_max MISSED_MAX ]\n"
"\n"
"BONDMODE := "
"balance-rr|active-backup|balance-xor|broadcast|802.3ad|balance-"
"tlb|balance-alb\n"
"ARP_VALIDATE := "
"none|active|backup|all|filter|filter_active|filter_backup\n"
"ARP_ALL_TARGETS := any|all\n"
"PRIMARY_RESELECT := always|better|failure\n"
"FAIL_OVER_MAC := none|active|follow\n"
"XMIT_HASH_POLICY := "
"layer2|layer2+3|layer3+4|encap2+3|encap3+4|vlan+srcmac\n"
"LACP_ACTIVE := off|on\n"
"LACP_RATE := slow|fast\n"
"AD_SELECT := stable|bandwidth|count\n");
} | void print_explain(void *a0) {
unsigned long long v1;
v1 = fprintf(
a0, "Usage: ... bond [ mode BONDMODE ] [ active_slave SLAVE_DEV ]\n "
" [ clear_active_slave ] [ miimon MIIMON ]\n "
"[ updelay UPDELAY ] [ downdelay DOWNDELAY ]\n [ "
"peer_notify_delay DELAY ]\n [ use_carrier "
"USE_CARRIER ]\n [ arp_interval ARP_INTERVAL ]\n "
" [ arp_validate ARP_VALIDATE ]\n [ "
"arp_all_targets ARP_ALL_TARGETS ]\n [ arp_ip_target "
"[ ARP_IP_TARGET, ... ] ]\n [ ns_ip6_target [ "
"NS_IP6_TARGET, ... ] ]\n [ primary SLAVE_DEV ]\n "
" [ primary_reselect PRIMARY_RESELECT ]\n [ "
"fail_over_mac FAIL_OVER_MAC ]\n [ xmit_hash_policy "
"XMIT_HASH_POLICY ]\n [ resend_igmp RESEND_IGMP ]\n "
" [ num_grat_arp|num_unsol_na NUM_GRAT_ARP|NUM_UNSOL_NA "
"]\n [ all_slaves_active ALL_SLAVES_ACTIVE ]\n "
" [ min_links MIN_LINKS ]\n [ lp_interval "
"LP_INTERVAL ]\n [ packets_per_slave PACKETS_PER_SL");
return;
} | iproute2-6.0.0 | angr_sailr |
static SHELL_VAR *hash_lookup(name, hashed_vars) const char *name;
HASH_TABLE *hashed_vars;
{
BUCKET_CONTENTS *bucket;
bucket = hash_search(name, hashed_vars, 0);
if (bucket)
last_table_searched = hashed_vars;
return (bucket ? (SHELL_VAR *)bucket->data : (SHELL_VAR *)((void *)0));
} | int hash_lookup(unsigned long long a0, unsigned long long a1) {
struct_0 *v0;
unsigned int v2;
v0 = hash_search(a0, a1, 0x0, a1);
if (v0)
last_table_searched = a1;
if (!v0)
v2 = 0;
else
v2 = v0->field_10;
return v2;
} | bash | angr_phoenix |
static void usage(void) {
fprintf(stderr, "Usage: ip tcp_metrics/tcpmetrics { COMMAND | help }\n"
" ip tcp_metrics { show | flush } SELECTOR\n"
" ip tcp_metrics delete [ address ] ADDRESS\n"
"SELECTOR := [ [ address ] PREFIX ]\n");
exit(-1);
} | void usage() {
fprintf(stderr,
"Usage:\tip tcp_metrics/tcpmetrics { COMMAND | help }\n\tip "
"tcp_metrics { show | flush } SELECTOR\n\tip tcp_metrics delete [ "
"address ] ADDRESS\nSELECTOR := [ [ address ] PREFIX ]\n");
exit(0xffffffff);
} | iproute2-6.0.0 | angr_phoenix |
static int it_init_shopts(itp)
ITEMLIST *itp;
{
STRINGLIST *sl;
sl = strlist_create(0);
sl->list = get_shopt_options();
sl->list_len = strvec_len(sl->list);
itp->slist = sl;
itp->flags |= 0x020;
return 0;
} | long long it_init_shopts(struct_0 *a0, unsigned long long a1,
unsigned long long a2, unsigned long long a3,
unsigned long long a4, unsigned long long a5) {
char v0;
struct_0 *v1;
struct_1 *v2;
v1 = a0;
v2 = strlist_create(0x0);
v2->field_0 = get_shopt_options(0x0, a1, a2, a3, a4, a5, *(&v0));
v2->field_c = strvec_len(v2->field_0);
a0->field_10 = v2;
a0->field_0 = a0->field_0 | 32;
return 0;
} | bash | angr_dream |
static void nh_reset(nh_ctx *hc)
{
hc->bytes_hashed = 0;
hc->next_data_empty = 0;
hc->state[0] = 0;
hc->state[1] = 0;
} | void nh_reset(struct_0 *a0) {
char v0;
struct_0 *v2;
unsigned long long v3;
a0->field_454 = 0;
a0->field_450 = 0;
a0->field_458 = 0;
v2 = a0;
a0->field_460 = 0;
v3 = *(&v0);
return;
} | openssh-portable | angr_dream |
char *read_passphrase(const char *prompt, int flags) {
char cr = '\r', *askpass = ((void *)0), *ret, buf[1024];
int rppflags, ttyfd, use_askpass = 0, allow_askpass = 0;
const char *askpass_hint = ((void *)0);
const char *s;
if ((s = getenv("DISPLAY")) != ((void *)0))
allow_askpass = *s != '\0';
if ((s = getenv("SSH_ASKPASS_REQUIRE")) != ((void *)0)) {
if (strcasecmp(s, "force") == 0) {
use_askpass = 1;
allow_askpass = 1;
} else if (strcasecmp(s, "prefer") == 0)
use_askpass = allow_askpass;
else if (strcasecmp(s, "never") == 0)
allow_askpass = 0;
}
rppflags = (flags & 0x0001) ? 0x01 : 0x00;
if (use_askpass)
sshlog("readpass.c", __func__, 144, 1, SYSLOG_LEVEL_DEBUG1, ((void *)0),
"requested to askpass");
else if (flags & 0x0008)
use_askpass = 1;
else if (flags & 0x0002) {
if (!isatty(0)) {
sshlog("readpass.c", __func__, 149, 1, SYSLOG_LEVEL_DEBUG1, ((void *)0),
"stdin is not a tty");
use_askpass = 1;
}
} else {
rppflags |= 0x02;
ttyfd = open("/dev/tty", 02);
if (ttyfd >= 0) {
(void)write(ttyfd, &cr, 1);
close(ttyfd);
} else {
sshlog("readpass.c", __func__, 165, 1, SYSLOG_LEVEL_DEBUG1, ((void *)0),
"can't open %s: %s", "/dev/tty", strerror((*__errno_location())));
use_askpass = 1;
}
}
if ((flags & 0x0008) && !allow_askpass)
return (flags & 0x0004) ? ((void *)0) : xstrdup("");
if (use_askpass && allow_askpass) {
if (getenv("SSH_ASKPASS"))
askpass = getenv("SSH_ASKPASS");
else
askpass = "/usr/local/libexec/ssh-askpass";
if ((flags & 0x8000) != 0)
askpass_hint = "confirm";
if ((ret = ssh_askpass(askpass, prompt, askpass_hint)) == ((void *)0))
if (!(flags & 0x0004))
return xstrdup("");
return ret;
}
if (readpassphrase(prompt, buf, sizeof buf, rppflags) == ((void *)0)) {
if (flags & 0x0004)
return ((void *)0);
return xstrdup("");
}
ret = xstrdup(buf);
explicit_bzero(buf, sizeof(buf));
return ret;
} | int read_passphrase(unsigned long long a0, unsigned long a1, unsigned long a2) {
unsigned long long v0;
char v1;
unsigned int v2;
unsigned int v3;
unsigned int v4;
unsigned int v5;
unsigned long long v6;
unsigned long long v7;
char *v8;
unsigned long v9;
char v10;
unsigned int v12;
v1 = 13;
v6 = 0;
v3 = 0;
v4 = 0;
v7 = 0;
v8 = getenv("DISPLAY");
if (v8)
v4 = *(v8);
v8 = getenv("SSH_ASKPASS_REQUIRE");
if (v8) {
v12 = strcasecmp(v8, "force");
if (!v12) {
v3 = 1;
v4 = 1;
} else {
v12 = strcasecmp(v8, "prefer");
if (!v12) {
v3 = v4;
} else {
v12 = strcasecmp(v8, "never");
if (!v12)
v4 = 0;
}
}
}
v2 = a1 & 1;
if (v3) {
sshlog("readpass.c", "read_passphrase", 0x90, 0x1, 0x5, 0x0,
"requested to askpass");
} else if ((a1 & 8)) {
v3 = 1;
} else if ((a1 & 2)) {
v12 = isatty(0x0);
if (!v12) {
sshlog("readpass.c", "read_passphrase", 0x95, 0x1, 0x5, 0x0,
"stdin is not a tty");
v3 = 1;
}
} else {
v2 |= 2;
v5 = open("/dev/tty", 0x2, a2);
if (v5 >= 0) {
write(v5, &v1, 0x1);
close(v5);
} else {
strerror(*(__errno_location()));
v0 = "/dev/tty";
sshlog("readpass.c", "read_passphrase", 0xa5, 0x1, 0x5, 0x0,
"can't open %s: %s");
v3 = 1;
}
}
if ((a1 & 8) && !v4) {
if (!(a1 & 4))
v12 = xstrdup(&g_40126a);
else
v12 = 0;
}
if (!(a1 & 8) || v4) {
if (v3 && v4) {
v12 = getenv("SSH_ASKPASS");
if (v12)
v6 = getenv("SSH_ASKPASS");
else
v6 = "/usr/local/libexec/ssh-askpass";
if ((a1 & 0x8000))
v7 = "confirm";
v9 = ssh_askpass(v6, a0, v7);
if (!v9 && !(a1 & 4))
v12 = xstrdup(&g_40126a);
if (v9 || (a1 & 4))
v12 = v9;
}
if (!v4 || !v3) {
v12 = readpassphrase(a0, &v10, 0x400, v2);
if (v12) {
v9 = xstrdup(&v10);
explicit_bzero(&v10, 0x400);
v12 = v9;
} else if ((a1 & 4)) {
v12 = 0;
} else {
v12 = xstrdup(&g_40126a);
}
}
}
return v12;
} | openssh-portable | angr_dream |
SHELL_VAR *find_variable_notempenv(name) const char *name;
{
SHELL_VAR *var;
var = find_variable_internal(name, 0);
if (var && ((((var)->attributes) & (0x0000800))))
var = find_variable_nameref(var);
return (var);
} | long long find_variable_notempenv(unsigned long long a0) {
struct_0 *v0;
v0 = find_variable_internal(a0, 0x0);
if (v0 && (v0->field_28 & 0x800))
v0 = find_variable_nameref(v0);
return v0;
} | bash | angr_phoenix |
char *sh_strvis(string) const char *string;
{
size_t slen, sind;
char *ret;
size_t retind, retsize;
unsigned char c;
mbstate_t state;
memset(&state, '\0', sizeof(mbstate_t));
if (string == 0)
return 0;
if (*string == '\0') {
if ((ret = (char *)malloc(1)) == 0)
return 0;
ret[0] = '\0';
return ret;
}
slen = strlen(string);
retsize = 3 * slen + 1;
ret = (char *)malloc(retsize);
if (ret == 0)
return 0;
retind = 0;
sind = 0;
while (string[sind])
sind = sh_charvis(string, &sind, slen, ret, &retind);
ret[retind] = '\0';
return ret;
} | long long sh_strvis(void *a0) {
void *v0;
void *v1;
unsigned int v2;
unsigned int v3;
void *v4;
char v5;
void *v7;
memset(&v5, 0x0, 0x8);
if (!a0) {
v7 = 0;
} else if (*(a0)) {
*(&v2) = strlen(a0);
*(&v3) = *(&v2) * 3 + 1;
v4 = malloc(*(&v3));
if (!v4) {
v7 = 0;
} else {
v1 = 0;
for (v0 = 0; *((a0 + v0)); v0 = sh_charvis(a0, &v0, *(&v2), v4, &v1))
;
*((v4 + v1)) = 0;
v7 = v4;
}
} else {
v4 = malloc(0x1);
if (!v4) {
v7 = 0;
} else {
*(v4) = 0;
v7 = v4;
}
}
return v7;
} | bash | angr_phoenix |
int process_options(int argc, char **argv) {
struct ocsptool_options *opts = &ocsptool_options;
int opt;
while ((opt = getopt_long(argc, argv, "!Q:S:Vd:ehijqv:", long_options,
((void *)0))) != (-1))
switch (opt) {
case '\0':
break;
case 'd':
opts->present.debug = 1;
opts->arg.debug = optarg;
opts->value.debug = parse_number(optarg);
opts->enabled.debug = 1;
break;
case 'V':
opts->present.verbose = 1;
opts->enabled.verbose = 1;
break;
case 0x7f + 1:
opts->present.infile = 1;
opts->arg.infile = optarg;
opts->enabled.infile = 1;
break;
case 0x7f + 2:
opts->present.outfile = 1;
opts->arg.outfile = optarg;
opts->enabled.outfile = 1;
break;
case 0x7f + 3:
opts->present.ask = 1;
opts->arg.ask = optarg;
opts->enabled.ask = 1;
break;
case 'e':
opts->present.verify_response = 1;
opts->enabled.verify_response = 1;
break;
case 'i':
opts->present.request_info = 1;
opts->enabled.request_info = 1;
break;
case 'j':
opts->present.response_info = 1;
opts->enabled.response_info = 1;
break;
case 'q':
opts->present.generate_request = 1;
opts->enabled.generate_request = 1;
break;
case 0x7f + 4:
opts->present.nonce = 1;
opts->enabled.nonce = 1;
break;
case 0x7f + 5:
opts->present.nonce = 1;
opts->enabled.nonce = 0;
break;
case 0x7f + 6:
opts->present.load_chain = 1;
opts->arg.load_chain = optarg;
opts->enabled.load_chain = 1;
break;
case 0x7f + 7:
opts->present.load_issuer = 1;
opts->arg.load_issuer = optarg;
opts->enabled.load_issuer = 1;
break;
case 0x7f + 8:
opts->present.load_cert = 1;
opts->arg.load_cert = optarg;
opts->enabled.load_cert = 1;
break;
case 0x7f + 9:
opts->present.load_trust = 1;
opts->arg.load_trust = optarg;
opts->enabled.load_trust = 1;
break;
case 0x7f + 10:
opts->present.load_signer = 1;
opts->arg.load_signer = optarg;
opts->enabled.load_signer = 1;
break;
case 0x7f + 11:
opts->present.inder = 1;
opts->enabled.inder = 1;
break;
case 0x7f + 12:
opts->present.inder = 1;
opts->enabled.inder = 0;
break;
case 0x7f + 13:
opts->present.outder = 1;
opts->enabled.outder = 1;
break;
case 0x7f + 14:
opts->present.outpem = 1;
opts->enabled.outpem = 1;
break;
case 'Q':
opts->present.load_request = 1;
opts->arg.load_request = optarg;
opts->enabled.load_request = 1;
break;
case 'S':
opts->present.load_response = 1;
opts->arg.load_response = optarg;
opts->enabled.load_response = 1;
break;
case 0x7f + 15:
opts->present.ignore_errors = 1;
opts->enabled.ignore_errors = 1;
break;
case 0x7f + 16:
opts->present.verify_allow_broken = 1;
opts->enabled.verify_allow_broken = 1;
break;
case 'v':
opts->present.version = 1;
opts->arg.version = optarg;
opts->enabled.version = 1;
break;
case 'h':
opts->present.help = 1;
opts->enabled.help = 1;
break;
case '!':
opts->present.more_help = 1;
opts->enabled.more_help = 1;
break;
default:
usage(stderr, 1);
break;
}
if (ocsptool_options.present.debug && ocsptool_options.value.debug < 0) {
error(1, 0, "%s option value %d is out of range.", "debug",
opts->value.debug);
}
if (ocsptool_options.present.debug && ocsptool_options.value.debug > 9999) {
error(1, 0, "%s option value %d is out of range", "debug",
opts->value.debug);
}
if (ocsptool_options.present.load_trust &&
ocsptool_options.present.load_signer) {
error(1, 0, "the '%s' and '%s' options conflict", "load-trust",
"load_signer");
}
if (ocsptool_options.present.load_signer &&
ocsptool_options.present.load_trust) {
error(1, 0, "the '%s' and '%s' options conflict", "load-signer",
"load_trust");
}
if (optind < argc) {
error(1, 0, "Command line arguments are not allowed.");
}
if (ocsptool_options.present.help) {
usage(stdout, (0));
}
if (ocsptool_options.present.more_help)
{
pid_t pid;
int pfds[2];
if (pipe(pfds) < 0)
error(1, (*__errno_location()), "pipe");
pid = fork();
if (pid < 0)
error(1, (*__errno_location()), "fork");
if (pid == 0) {
close(pfds[0]);
dup2(pfds[1], 1);
close(pfds[1]);
usage(stdout, 0);
} else {
const char *args[2];
const char *envvar;
close(pfds[1]);
dup2(pfds[0], 0);
close(pfds[0]);
envvar = secure_getenv("PAGER");
if (!envvar || *envvar == '\0')
args[0] = "more";
else
args[0] = envvar;
args[1] = ((void *)0);
execvp(args[0], (char *const *)args);
exit(1);
}
}
if (ocsptool_options.present.version) {
if (!ocsptool_options.arg.version ||
!strcmp(ocsptool_options.arg.version, "c")) {
const char str[] =
"ocsptool 3.7.8\n"
"Copyright (C) 2000-2021 Free Software Foundation, and others\n"
"This is free software. It is licensed for use, modification and\n"
"redistribution under the terms of the GNU General Public License,\n"
"version 3 or later <http:
"\n"
"Please send bug reports to: <bugs@gnutls.org> \n";
fprintf(stdout, "%s", str);
exit(0);
} else if (!strcmp(ocsptool_options.arg.version, "v")) {
const char str[] = "ocsptool 3.7.8\n";
fprintf(stdout, "%s", str);
exit(0);
} else if (!strcmp(ocsptool_options.arg.version, "n")) {
const char str[] =
"ocsptool 3.7.8\n"
"Copyright (C) 2000-2021 Free Software Foundation, and others\n"
"This is free software. It is licensed for use, modification and\n"
"redistribution under the terms of the GNU General Public License,\n"
"version 3 or later <http:
"\n"
"gnutls is free software: you can redistribute it and/or\n"
"modify it under the terms of the GNU General Public License\n"
"as published by the Free Software Foundation,\n"
"either version 3 of the License, or (at your option) any later "
"version.\n"
"\n"
"gnutls is distributed in the hope that it will be useful,\n"
"but WITHOUT ANY WARRANTY; without even the implied warranty\n"
"of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n"
"See the GNU General Public License for more details.\n"
"\n"
"You should have received a copy of the GNU General Public License\n"
"along with this program. If not, see <http:
"\n"
"Please send bug reports to: <bugs@gnutls.org> \n";
fprintf(stdout, "%s", str);
exit(0);
} else {
error(1, 0,
"version option argument 'a' invalid. Use:\n"
" 'v' - version only\n"
" 'c' - version and copyright\n"
" 'n' - version and full copyright notice");
}
}
return optind;
} | long long process_options(unsigned long a0, char **a1) {
char **v0;
unsigned int v1;
unsigned int v2;
unsigned int v3;
struct_0 *v4;
unsigned long long v5;
char v6;
char v7;
unsigned long long v8;
void *v9;
unsigned long v10;
unsigned long long v11;
unsigned long long v13;
unsigned long v14;
unsigned long long v15;
void *v16;
unsigned long long v17;
void *v18;
unsigned long long v19;
unsigned long v20;
v1 = a0;
v0 = a1;
v4 = got.ocsptool_options;
while (true) {
v2 = getopt_long(v1, v0, "!Q:S:Vd:ehijqv:", &long_options, NULL);
if (v2 == -1)
break;
switch (v2) {
case 0:
break;
case 33:
v4->field_18 = 1;
v4->field_9c = 1;
break;
case 81:
v4->field_12 = 1;
v4->field_68 = *(*(&got.optarg));
v4->field_96 = 1;
break;
case 83:
v4->field_13 = 1;
v4->field_70 = *(*(&got.optarg));
v4->field_97 = 1;
break;
case 86:
v4->field_1 = 1;
v4->field_85 = 1;
break;
case 100:
v4->field_0 = 1;
v4->field_20 = *(*(&got.optarg));
v4->field_80 = parse_number(*(*(&got.optarg)));
v4->field_84 = 1;
break;
case 101:
v4->field_5 = 1;
v4->field_89 = 1;
break;
case 104:
v4->field_17 = 1;
v4->field_9b = 1;
break;
case 105:
v4->field_6 = 1;
v4->field_8a = 1;
break;
case 106:
v4->field_7 = 1;
v4->field_8b = 1;
break;
case 113:
v4->field_8 = 1;
v4->field_8c = 1;
break;
case 118:
v4->field_16 = 1;
v4->field_78 = *(*(&got.optarg));
v4->field_9a = 1;
break;
case 128:
v4->field_2 = 1;
v4->field_28 = *(*(&got.optarg));
v4->field_86 = 1;
break;
case 129:
v4->field_3 = 1;
v4->field_30 = *(*(&got.optarg));
v4->field_87 = 1;
break;
case 130:
v4->field_4 = 1;
v4->field_38 = *(*(&got.optarg));
v4->field_88 = 1;
break;
case 131:
v4->field_9 = 1;
v4->field_8d = 1;
break;
case 132:
v4->field_9 = 1;
v4->field_8d = 0;
break;
case 133:
v4->field_a = 1;
v4->field_40 = *(*(&got.optarg));
v4->field_8e = 1;
break;
case 134:
v4->field_b = 1;
v4->field_48 = *(*(&got.optarg));
v4->field_8f = 1;
break;
case 135:
v4->field_c = 1;
v4->field_50 = *(*(&got.optarg));
v4->field_90 = 1;
break;
case 136:
v4->field_d = 1;
v4->field_58 = *(*(&got.optarg));
v4->field_91 = 1;
break;
case 137:
v4->field_e = 1;
v4->field_60 = *(*(&got.optarg));
v4->field_92 = 1;
break;
case 138:
v4->field_f = 1;
v4->field_93 = 1;
break;
case 139:
v4->field_f = 1;
v4->field_93 = 0;
break;
case 140:
v4->field_10 = 1;
v4->field_94 = 1;
break;
case 141:
v4->field_11 = 1;
v4->field_95 = 1;
break;
case 142:
v4->field_14 = 1;
v4->field_98 = 1;
break;
case 143:
v4->field_15 = 1;
v4->field_99 = 1;
break;
default:
usage(*(got.stderr), 0x1);
}
}
if (*(got.ocsptool_options) && *((got.ocsptool_options + 128)) < 0)
error(0x1, 0x0, "%s option value %d is out of range.");
if (*(got.ocsptool_options) && *((got.ocsptool_options + 128)) > 9999)
error(0x1, 0x0, "%s option value %d is out of range");
if (*((got.ocsptool_options + 13)) && *((got.ocsptool_options + 14)))
error(0x1, 0x0, "the '%s' and '%s' options conflict");
if (*((got.ocsptool_options + 14)) && *((got.ocsptool_options + 13)))
error(0x1, 0x0, "the '%s' and '%s' options conflict");
if (v1 > *(got.optind))
error(0x1, 0x0, "Command line arguments are not allowed.");
if (*((got.ocsptool_options + 23)))
usage(*(*(&got.stdout)), 0x0);
if (*((got.ocsptool_options + 24))) {
if (pipe(&v6) >= 0) {
v3 = fork();
if (v3 < 0) {
error(0x1, *(__errno_location()), "fork");
} else if (v3) {
close(*(&v7));
dup2(*(&v6), 0x0);
close(*(&v6));
v5 = secure_getenv("PAGER");
if (!v5 || !*(v5))
v8 = "more";
else
v8 = v5;
v9 = 0;
execvp(v8, &v8);
exit(0x1);
} else {
close(*(&v6));
dup2(*(&v7), 0x1);
close(*(&v7));
usage(*(*(&got.stdout)), 0x0);
}
} else {
error(0x1, *(__errno_location()), "pipe");
}
} else {
if (!*((got.ocsptool_options + 22)))
return *(got.optind);
if (*((got.ocsptool_options + 120)) &&
strcmp(*((got.ocsptool_options + 120)), "c")) {
if (!strcmp(*((got.ocsptool_options + 120)), "v")) {
v10 = 7813586424404599663;
v11 = 2876520912532256;
fprintf(*(*(&got.stdout)), "%s", &v10);
exit(0x0);
} else if (strcmp(*((got.ocsptool_options + 120)), "n")) {
error(0x1, 0x0,
"version option argument 'a' invalid. Use:\n\t'v' - version "
"only\n\t'c' - version and copyright\n\t'n' - version and full "
"copyright notice");
} else {
v17 = 115;
v18 = &v10;
for (v19 = "ocsptool 3.7.8\nCopyright (C) 2000-2021 Free Software Foundation, and others\nThis is free software. It is licensed for use, modification and\nredistribution under the terms of the GNU General Public License,\nversion 3 or later <http:
v17 -= 1;
v10 = *(v19);
v18 += v20 * 8;
}
*(v18) = *(v19);
fprintf(*(*(&got.stdout)), "%s", &v10);
exit(0x0);
}
}
v13 = 40;
v16 = &v10;
for (v15 = "ocsptool 3.7.8\nCopyright (C) 2000-2021 Free Software Foundation, and others\nThis is free software. It is licensed for use, modification and\nredistribution under the terms of the GNU General Public License,\nversion 3 or later <http:
v13 -= 1;
v10 = *(v15);
v16 += v14 * 8;
}
*(v16) = *(v15);
fprintf(*(*(&got.stdout)), "%s", &v10);
exit(0x0);
}
} | gnutls | angr_sailr |
static _Bool
parse_anewer(const struct parser_table *entry, char **argv, int *arg_ptr) {
struct stat stat_newer;
const char *arg;
set_stat_placeholders(&stat_newer);
if (collect_arg_stat_info(argv, arg_ptr, &stat_newer, &arg)) {
struct predicate *our_pred = insert_primary(entry, arg);
our_pred->args.reftime.xval = XVAL_ATIME;
our_pred->args.reftime.ts = get_stat_mtime(&stat_newer);
our_pred->args.reftime.kind = COMP_GT;
our_pred->est_success_rate =
estimate_timestamp_success_rate(stat_newer.st_mtim.tv_sec);
return 1;
}
return 0;
} | long long parse_anewer(unsigned long long a0, unsigned long long a1,
unsigned long long a2) {
char v0;
struct_0 *v1;
char v2;
char v3;
unsigned long long v6;
struct_0 *v7;
unsigned int v8;
set_stat_placeholders(&v2);
if (collect_arg_stat_info(a1, a2, &v2, &v0)) {
v1 = insert_primary(a0, *(&v0), *(&v0));
v1->field_38 = 0;
v7 = v1;
v7->field_40 = get_stat_mtime(&v2);
v7->field_48 = a2;
v1->field_3c = 0;
estimate_timestamp_success_rate(*(&v3));
v1->field_24 = v8;
v6 = 1;
} else {
v6 = 0;
}
return v6;
} | findutils | angr_dream |
static void show_processes(const char *name) {
glob_t globbuf = {};
char **fd_path;
int err;
err = glob("/proc/[0-9]*/fd/[0-9]*", (1 << 2),
((void *)0), &globbuf);
if (err)
return;
open_json_array(PRINT_JSON, "processes");
fd_path = globbuf.gl_pathv;
while (*fd_path) {
const char *dev_net_tun = "/dev/net/tun";
const size_t linkbuf_len = strlen(dev_net_tun) + 2;
char linkbuf[linkbuf_len], *fdinfo;
int pid, fd;
FILE *f;
if (sscanf(*fd_path, "/proc/%d/fd/%d", &pid, &fd) != 2)
goto next;
if (pid == getpid())
goto next;
err = readlink(*fd_path, linkbuf, linkbuf_len - 1);
if (err < 0) {
perror("readlink");
goto next;
}
linkbuf[err] = '\0';
if (strcmp(dev_net_tun, linkbuf))
goto next;
if (asprintf(&fdinfo, "/proc/%d/fdinfo/%d", pid, fd) < 0)
goto next;
f = fopen(fdinfo, "r");
free(fdinfo);
if (!f) {
perror("fopen");
goto next;
}
while (!feof(f)) {
char *key = ((void *)0), *value = ((void *)0);
err = fscanf(f, "%m[^:]: %ms\n", &key, &value);
if (err == (-1)) {
if (ferror(f))
perror("fscanf");
break;
} else if (err == 2 && !strcmp("iff", key) && !strcmp(name, value)) {
char pname[64];
if (get_task_name(pid, pname, sizeof(pname)))
print_string(PRINT_ANY, "name", "%s", "<NULL>");
else
print_string(PRINT_ANY, "name", "%s", pname);
print_uint(PRINT_ANY, "pid", "(%d)", pid);
}
free(key);
free(value);
}
if (fclose(f))
perror("fclose");
next:
++fd_path;
}
close_json_array(PRINT_JSON, ((void *)0));
globfree(&globbuf);
} | void show_processes(char *a0) {
char v0;
char v1;
char v2;
unsigned int v3;
char v4;
void *v5;
void *v6;
void *v7;
unsigned long long v8;
unsigned long v9;
unsigned long v10;
char *v11;
void *v12;
void *v13;
void *v14;
void *v15;
void *v16;
void *v17;
void *v18;
void *v19;
void *v20;
void *v21;
char v22;
char v23;
unsigned long long v24;
char v25;
unsigned long long v35;
unsigned long long *v37;
unsigned long long v38;
v13 = 0;
v14 = 0;
v15 = 0;
v16 = 0;
v17 = 0;
v18 = 0;
v19 = 0;
v20 = 0;
v21 = 0;
v3 = glob64("/proc/[0-9]*/fd/[0-9]*", 0x4, 0x0, &v13);
if (!v3) {
open_json_array(0x2, "processes");
for (v7 = v14; *(v7); v7 += 8) {
v8 = "/dev/net/tun";
v9 = strlen(v8) + 2;
for (v10 = v9 - 1;
&v25 != &(&v0)[-1 * ((0 CONCAT v9 + 15) / m 16 * 16 & -0x1000)];
v24 = v24)
;
if ((((0 CONCAT v9 + 15) / m 16 * 16) & 4095))
*((&v24 + (((0 CONCAT v9 + 15) / m 16 * 16) & 4095))) =
*((&v24 + (((0 CONCAT v9 + 15) / m 16 * 16) & 4095)));
v11 = &v25;
if (__isoc99_sscanf(*(v7), "/proc/%d/fd/%d", &v1, &v2) == 2 &&
getpid() != *(&v1)) {
v3 = readlink(*(v7), v11, v9 - 1);
if (v3 < 0) {
perror("readlink");
} else {
v11[v3] = 0;
if (!strcmp(v8, v11) &&
asprintf(&v4, "/proc/%d/fdinfo/%d", *(&v1), *(&v2)) >= 0) {
v12 = fopen64(*(&v4), "r");
free(*(&v4));
if (!v12) {
perror("fopen");
} else {
while (true) {
if (feof(v12))
break;
v5 = 0;
v6 = 0;
v3 = __isoc99_fscanf(v12, "%m[^:]: %ms\n");
if (v3 == -1) {
v35 = ferror(v12);
if (!v35)
break;
if (v35) {
perror("fscanf");
break;
}
} else {
if (v3 == 2 && !strcmp("iff", v5) && !strcmp(a0, v6)) {
if (get_task_name(*(&v1), &v22, 0x40, &v22))
print_string(0x4, "name", "%s", "<NULL>");
else
print_string(0x4, "name", "%s", &v22);
print_uint(0x4, "pid", "(%d)", *(&v1));
}
free(v5);
free(v6);
}
}
if (fclose(v12))
perror("fclose");
}
}
}
}
}
close_json_array(0x2, 0x0);
globfree64(&v13);
}
v38 = *(&v23) ^ v37[5];
return;
} | iproute2-6.0.0 | angr_dream |
static size_t strtodest(const char *p, int flags) {
size_t len = strlen(p);
memtodest(p, len, flags);
return len;
} | int strtodest(char *a0, unsigned long a1) {
unsigned long long v0;
v0 = strlen(a0);
memtodest(a0, v0, a1);
return v0;
} | dash-0.5.11+git20210903+057cd650a4ed | angr_dream |
__u32 ipvrf_get_table(const char *name) {
struct {
struct nlmsghdr n;
struct ifinfomsg i;
char buf[1024];
} req = {
.n =
{
.nlmsg_len =
((sizeof(struct ifinfomsg)) +
((int)(((sizeof(struct nlmsghdr)) + 4U - 1) & ~(4U - 1)))),
.nlmsg_flags = 0x01,
.nlmsg_type = RTM_GETLINK,
},
.i =
{
.ifi_family = preferred_family,
},
};
struct nlmsghdr *answer;
struct rtattr *tb[(__IFLA_MAX - 1) + 1];
struct rtattr *li[(__IFLA_INFO_MAX - 1) + 1];
struct rtattr *vrf_attr[(__IFLA_VRF_MAX - 1) + 1];
struct ifinfomsg *ifi;
__u32 tb_id = 0;
int len;
addattr_l(&req.n, sizeof(req), IFLA_IFNAME, name, strlen(name) + 1);
if (rtnl_talk_suppress_rtnl_errmsg(&rth, &req.n, &answer) < 0) {
if ((*__errno_location()) == 19 && !strcmp(name, "default"))
if (rtnl_rttable_a2n(&tb_id, "main"))
fprintf(stderr, "BUG: RTTable \"main\" not found.\n");
return tb_id;
}
ifi = ((void *)(((char *)answer) +
((int)(((sizeof(struct nlmsghdr)) + 4U - 1) & ~(4U - 1)))));
len = answer->nlmsg_len -
((sizeof(*ifi)) +
((int)(((sizeof(struct nlmsghdr)) + 4U - 1) & ~(4U - 1))));
if (len < 0) {
fprintf(stderr, "BUG: Invalid response to link query.\n");
goto out;
}
parse_rtattr(
tb, (__IFLA_MAX - 1),
((struct rtattr *)(((char *)(ifi)) +
(((sizeof(struct ifinfomsg)) + 4U - 1) & ~(4U - 1)))),
len);
if (!tb[IFLA_LINKINFO])
goto out;
(parse_rtattr_flags(
(li), ((__IFLA_INFO_MAX - 1)),
((void *)(((char *)(tb[IFLA_LINKINFO])) +
((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0)))),
((int)((tb[IFLA_LINKINFO])->rta_len) -
((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0))),
(1 << 15)));
if (!li[IFLA_INFO_KIND] || !li[IFLA_INFO_DATA])
goto out;
if (strcmp(
((void *)(((char *)(li[IFLA_INFO_KIND])) +
((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0)))),
"vrf"))
goto out;
(parse_rtattr_flags(
(vrf_attr), ((__IFLA_VRF_MAX - 1)),
((void *)(((char *)(li[IFLA_INFO_DATA])) +
((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0)))),
((int)((li[IFLA_INFO_DATA])->rta_len) -
((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0))),
(1 << 15)));
if (vrf_attr[IFLA_VRF_TABLE])
tb_id = rta_getattr_u32(vrf_attr[IFLA_VRF_TABLE]);
if (!tb_id)
fprintf(stderr, "BUG: VRF %s is missing table id\n", name);
out:
free(answer);
return tb_id;
} | long long ipvrf_get_table(char *a0) {
char *v0;
unsigned int v1;
unsigned int v2;
char v3;
unsigned long v4;
char v5;
char v6;
char v7;
char v8;
char v9;
char v10;
char v11;
char v12;
unsigned short v13;
unsigned short v14;
char v15;
unsigned long long v17;
unsigned long long *v18;
unsigned long v19;
unsigned long long v20;
unsigned long long v24;
v0 = a0;
v17 = 132;
for (v18 = &v12; v17; v18 = &v18[v19]) {
v17 -= 1;
v12 = 0;
}
v12 = 32;
v13 = 18;
v14 = 1;
v15 = preferred_family;
v1 = 0;
addattr_l(&v12, 0x420, 0x3, v0, strlen(v0) + 1);
v20 = rtnl_talk_suppress_rtnl_errmsg(0x500060, &v12, &v3);
if (v20 < 0) {
*(&v20) = *(__errno_location());
if (v20 == 19 && !strcmp(v0, "default") &&
rtnl_rttable_a2n(&v1, "main", &v3))
fprintf(*(&stderr), "BUG: RTTable \"main\" not found.\n");
v24 = v1;
} else {
v4 = *(&v3) + 16;
v2 = *(*(&v3)) - 32;
if (v2 < 0) {
fprintf(*(&stderr), "BUG: Invalid response to link query.\n");
} else {
parse_rtattr(&v10, 0x3c, v4 + 16, v2);
if (*(&v11)) {
parse_rtattr_flags(&v7, 0x5, *(&v11) + 4, *(*(&v11)) - 4, 0x8000);
if (*(&v8) && *(&v9) && !strcmp(*(&v8) + 4, "vrf")) {
parse_rtattr_flags(&v5, 0x1, *(&v9) + 4, *(*(&v9)) - 4, 0x8000);
if (*(&v6))
v1 = rta_getattr_u32(*(&v6));
if (!v1)
fprintf(*(&stderr), "BUG: VRF %s is missing table id\n", v0);
}
}
}
free(*(&v3));
v24 = v1;
}
return v24;
} | iproute2-6.0.0 | angr_dream |
test_code_t test_no_extensions(gnutls_session_t session) {
int ret;
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, 1082)) !=
TEST_SUCCEED) {
return _ret;
}
};
gnutls_credentials_set(session, GNUTLS_CRD_CERTIFICATE, xcred);
gnutls_record_set_max_size(session, 4096);
ret = test_do_handshake(session);
if (ret == TEST_SUCCEED) {
tls_ext_ok = 1;
} else {
sprintf(prio_str,
"NONE:"
"+3DES-CBC:+AES-128-CBC:+CAMELLIA-128-CBC:+AES-256-CBC:+CAMELLIA-"
"256-CBC"
":"
"+COMP-NULL"
":+VERS-TLS1.2:+VERS-TLS1.1:+VERS-TLS1.0:-VERS-SSL3.0:"
"+MAC-ALL:+MD5:+SHA1"
":+GOST28147-TC26Z-IMIT"
":"
"+RSA:+DHE-RSA:+DHE-DSS:+ANON-DH:+ECDHE-RSA:+ECDHE-ECDSA:+ANON-ECDH"
":+VKO-GOST-12"
":%%NO_EXTENSIONS:%s",
rest);
{
int _ret;
if ((_ret = __gnutls_priority_set_direct(session, prio_str, 1093)) !=
TEST_SUCCEED) {
return _ret;
}
};
gnutls_credentials_set(session, GNUTLS_CRD_CERTIFICATE, xcred);
ret = test_do_handshake(session);
if (ret == TEST_SUCCEED) {
tls_ext_ok = 0;
strcat(rest, ":%NO_EXTENSIONS");
} else
ret = TEST_IGNORE2;
}
return ret;
} | int test_no_extensions(undefined8 param_1)
{
int local_14;
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);
local_14 = __gnutls_priority_set_direct(param_1, prio_str, 0x43a);
if (local_14 == 0) {
gnutls_credentials_set(param_1, 1, xcred);
gnutls_record_set_max_size(param_1, 0x1000);
local_14 = test_do_handshake(param_1);
if (local_14 == 0) {
tls_ext_ok = 1;
} else {
sprintf(prio_str,
"NONE:+3DES-CBC:+AES-128-CBC:+CAMELLIA-128-CBC:+AES-256-CBC:+"
"CAMELLIA-256-CBC:+COMP-NULL:+VERS-TLS1.2:+VERS-TLS1.1:+VERS-"
"TLS1.0:-VERS-SSL3.0:+MAC-ALL:+MD5:+SHA1:+GOST28147-TC26Z-IMIT:+"
"RSA:+DHE-RSA:+DHE-DSS:+ANON-DH:+ECDHE-RSA:+ECDHE-ECDSA:+ANON-"
"ECDH:+VKO-GOST-12:%%NO_EXTENSIONS:%s",
rest);
local_14 = __gnutls_priority_set_direct(param_1, prio_str, 0x445);
if (local_14 == 0) {
gnutls_credentials_set(param_1, 1, xcred);
local_14 = test_do_handshake(param_1);
if (local_14 == 0) {
tls_ext_ok = 0;
strcat(rest, ":%NO_EXTENSIONS");
} else {
local_14 = 4;
}
}
}
}
return local_14;
} | gnutls | ghidra |
static void set_root(const struct cmdinfo *cip, const char *value) {
instdir = dpkg_fsys_set_dir(value);
admindir = dpkg_fsys_get_path("/usr/local/var/lib/dpkg");
} | long long set_root(unsigned long a0, unsigned long long a1) {
unsigned long v0;
v0 = a0;
instdir = dpkg_fsys_set_dir(a1);
admindir = dpkg_fsys_get_path("/usr/local/var/lib/dpkg");
return admindir;
} | dpkg | angr_dream |
int main(int argc, char **argv) {
int optc;
int n_users;
;
set_program_name(argv[0]);
setlocale(6, "");
bindtextdomain("coreutils", "/usr/local/share/locale");
textdomain("coreutils");
atexit(close_stdout);
while ((optc = getopt_long(argc, argv, "sfwiqbhlp", longopts, ((void *)0))) !=
-1) {
switch (optc) {
case 's':
do_short_format = 1;
break;
case 'l':
do_short_format = 0;
break;
case 'f':
include_heading = 0;
break;
case 'w':
include_fullname = 0;
break;
case 'i':
include_fullname = 0;
include_where = 0;
break;
case 'q':
include_fullname = 0;
include_where = 0;
include_idle = 0;
break;
case 'h':
include_project = 0;
break;
case 'p':
include_plan = 0;
break;
case 'b':
include_home_and_shell = 0;
break;
case GETOPT_HELP_CHAR:
usage(0);
break;
;
case GETOPT_VERSION_CHAR:
version_etc(stdout, "pinky", "GNU coreutils", Version,
("Joseph Arceneaux"), ("David MacKenzie"), ("Kaveh Ghazi"),
(char *)((void *)0));
exit(0);
break;
;
default:
usage(1);
}
}
n_users = argc - optind;
if (!do_short_format && n_users == 0) {
error(0, 0,
gettext("no username specified; at least one must be specified when "
"using -l"));
usage(1);
}
if (do_short_format)
short_pinky("/var/run/utmp", n_users, argv + optind);
else
long_pinky(n_users, argv + optind);
return 0;
} | int main(int argc, const char **argv, const char **envp) {
char *v3;
int v5;
int v6;
set_program_name(*argv, argv, envp);
setlocale(6, locale);
bindtextdomain("coreutils", "/usr/local/share/locale");
textdomain("coreutils");
atexit((void (*)(void))&close_stdout);
while (2) {
v5 = getopt_long(argc, (char *const *)argv, "sfwiqbhlp", &longopts, 0LL);
if (v5 != -1) {
if (v5 <= 119) {
if (v5 >= 98) {
switch (v5) {
case 'b':
include_home_and_shell = 0;
continue;
case 'f':
include_heading = 0;
continue;
case 'h':
include_project = 0;
continue;
case 'i':
include_fullname = 0;
include_where = 0;
continue;
case 'l':
do_short_format = 0;
continue;
case 'p':
include_plan = 0;
continue;
case 'q':
include_fullname = 0;
include_where = 0;
include_idle = 0;
continue;
case 's':
do_short_format = 1;
continue;
case 'w':
include_fullname = 0;
continue;
default:
goto LABEL_19;
}
}
if (v5 == -131) {
version_etc(stdout, "pinky", "GNU coreutils", Version,
"Joseph Arceneaux", "David MacKenzie", "Kaveh Ghazi",
0LL);
exit(0);
}
if (v5 == -130)
usage(0);
}
LABEL_19:
usage(1);
}
break;
}
v6 = argc - optind;
if (do_short_format != 1 && !v6) {
v3 = gettext(
"no username specified; at least one must be specified when using -l");
error(0, 0, v3);
usage(1);
}
if (do_short_format)
short_pinky((long)"/var/run/utmp", v6, (long)&argv[optind]);
long_pinky(v6, (long)&argv[optind]);
return 0;
} | coreutils | ida |
int main(int argc, char **argv) {
struct stat *stats = ((void *)0);
;
set_program_name(argv[0]);
setlocale(6, "");
bindtextdomain("coreutils", "/usr/local/share/locale");
textdomain("coreutils");
atexit(close_stdout);
fs_select_list = ((void *)0);
fs_exclude_list = ((void *)0);
show_all_fs = 0;
show_listed_fs = 0;
human_output_opts = -1;
print_type = 0;
file_systems_processed = 0;
exit_status = 0;
print_grand_total = 0;
grand_fsu.fsu_blocksize = 1;
_Bool posix_format = 0;
char const *msg_mut_excl =
gettext("options %s and %s are mutually exclusive");
while (1) {
int oi = -1;
int c = getopt_long(argc, argv, "aB:iF:hHklmPTt:vx:", long_options, &oi);
if (c == -1)
break;
switch (c) {
case 'a':
show_all_fs = 1;
break;
case 'B': {
enum strtol_error e =
human_options(optarg, &human_output_opts, &output_block_size);
if (e != LONGINT_OK)
xstrtol_fatal(e, oi, c, long_options, optarg);
} break;
case 'i':
if (header_mode == OUTPUT_MODE) {
error(0, 0, msg_mut_excl, "-i", "--output");
usage(1);
}
header_mode = INODES_MODE;
break;
case 'h':
human_output_opts = human_autoscale | human_SI | human_base_1024;
output_block_size = 1;
break;
case 'H':
human_output_opts = human_autoscale | human_SI;
output_block_size = 1;
break;
case 'k':
human_output_opts = 0;
output_block_size = 1024;
break;
case 'l':
show_local_fs = 1;
break;
case 'm':
human_output_opts = 0;
output_block_size = 1024 * 1024;
break;
case 'T':
if (header_mode == OUTPUT_MODE) {
error(0, 0, msg_mut_excl, "-T", "--output");
usage(1);
}
print_type = 1;
break;
case 'P':
if (header_mode == OUTPUT_MODE) {
error(0, 0, msg_mut_excl, "-P", "--output");
usage(1);
}
posix_format = 1;
break;
case SYNC_OPTION:
require_sync = 1;
break;
case NO_SYNC_OPTION:
require_sync = 0;
break;
case 'F':
case 't':
add_fs_type(optarg);
break;
case 'v':
break;
case 'x':
add_excluded_fs_type(optarg);
break;
case OUTPUT_OPTION:
if (header_mode == INODES_MODE) {
error(0, 0, msg_mut_excl, "-i", "--output");
usage(1);
}
if (posix_format && header_mode == DEFAULT_MODE) {
error(0, 0, msg_mut_excl, "-P", "--output");
usage(1);
}
if (print_type) {
error(0, 0, msg_mut_excl, "-T", "--output");
usage(1);
}
header_mode = OUTPUT_MODE;
if (optarg)
decode_output_arg(optarg);
break;
case TOTAL_OPTION:
print_grand_total = 1;
break;
case GETOPT_HELP_CHAR:
usage(0);
break;
;
case GETOPT_VERSION_CHAR:
version_etc(stdout, "df", "GNU coreutils", Version, ("Torbjorn Granlund"),
("David MacKenzie"), ("Paul Eggert"), (char *)((void *)0));
exit(0);
break;
;
default:
usage(1);
}
}
if (human_output_opts == -1) {
if (posix_format) {
human_output_opts = 0;
output_block_size = (getenv("POSIXLY_CORRECT") ? 512 : 1024);
} else
human_options(getenv("DF_BLOCK_SIZE"), &human_output_opts,
&output_block_size);
}
if (header_mode == INODES_MODE || header_mode == OUTPUT_MODE)
;
else if (human_output_opts & human_autoscale)
header_mode = HUMAN_MODE;
else if (posix_format)
header_mode = POSIX_MODE;
{
_Bool match = 0;
struct fs_type_list *fs_incl;
for (fs_incl = fs_select_list; fs_incl; fs_incl = fs_incl->fs_next) {
struct fs_type_list *fs_excl;
for (fs_excl = fs_exclude_list; fs_excl; fs_excl = fs_excl->fs_next) {
if ((strcmp(fs_incl->fs_name, fs_excl->fs_name) == 0)) {
error(0, 0, gettext("file system type %s both selected and excluded"),
quote(fs_incl->fs_name));
match = 1;
break;
}
}
}
if (match)
return 1;
}
((0 < optind) ? (void)0 : __builtin_unreachable());
if (optind < argc) {
stats = xnmalloc(argc - optind, sizeof *stats);
for (int i = optind; i < argc; ++i) {
int err = automount_stat_err(argv[i], &stats[i - optind]);
if (err != 0) {
error(0, err, "%s",
quotearg_n_style_colon(0, shell_escape_quoting_style, argv[i]));
exit_status = 1;
argv[i] = ((void *)0);
}
}
}
mount_list = read_file_system_list(
(fs_select_list != ((void *)0)
|| fs_exclude_list != ((void *)0)
|| print_type || field_data[FSTYPE_FIELD].used || show_local_fs));
if (mount_list == ((void *)0)) {
int status = 0;
if (!(optind < argc) ||
(show_all_fs || show_local_fs || fs_select_list != ((void *)0)
|| fs_exclude_list != ((void *)0))) {
status = 1;
}
char const *warning = (status == 0 ? gettext("Warning: ") : "");
error(status, (*__errno_location()), "%s%s", warning,
gettext("cannot read table of mounted file systems"));
}
if (require_sync)
sync();
get_field_list();
get_header();
if (stats) {
show_listed_fs = 1;
for (int i = optind; i < argc; ++i)
if (argv[i])
get_entry(argv[i], &stats[i - optind]);
} else
get_all_entries();
if (file_systems_processed) {
if (print_grand_total)
get_dev("total", (field_data[SOURCE_FIELD].used ? "-" : "total"),
((void *)0), ((void *)0), ((void *)0), 0, 0, &grand_fsu, 0);
print_table();
} else {
if (exit_status == 0)
((!!sizeof(struct {
_Static_assert(1, "verify_expr ("
"1"
", "
"(error (1, 0, gettext (\"no file systems "
"processed\")), assume (false))"
")");
int _gl_dummy;
}))
? ((error(1, 0, gettext("no file systems processed")),
((0) ? (void)0 : __builtin_unreachable())))
: ((error(1, 0, gettext("no file systems processed")),
((0) ? (void)0 : __builtin_unreachable()))));
}
return exit_status;
} | int main(unsigned long a0, unsigned long long *a1) {
void *v0;
char v1;
char v2;
unsigned int v3;
unsigned int v4;
unsigned int v5;
unsigned int v6;
unsigned int v7;
unsigned int v8;
unsigned int v9;
void *v10;
unsigned long long v11[2];
unsigned long long v12[2];
char *v13;
unsigned long long v14;
unsigned long v16;
unsigned long long v17;
unsigned long long v18;
unsigned long long v19;
v10 = 0;
set_program_name(*(a1));
setlocale(0x6, &g_4043db);
bindtextdomain("coreutils", "/usr/local/share/locale");
textdomain("coreutils");
atexit(got.close_stdout);
fs_select_list = 0;
fs_exclude_list = 0;
show_all_fs = 0;
show_listed_fs = 0;
human_output_opts = -1;
print_type = 0;
file_systems_processed = 0;
exit_status = 0;
print_grand_total = 0;
grand_fsu = 1;
v1 = 0;
v13 = gettext("options %s and %s are mutually exclusive");
while (true) {
v3 = -1;
v7 = getopt_long(a0, a1, "aB:iF:hHklmPTt:vx:", &long_options, &v3);
if (v7 == -1)
break;
if (!(v7 <= 131))
goto LABEL_403aed;
if (v7 >= 66) {
switch (v7) {
case 66:
v8 = human_options(*(&optarg), &human_output_opts, &output_block_size);
if (v8)
xstrtol_fatal(v8, v3, v7, &long_options, *(&optarg));
continue;
case 70:
case 116:
add_fs_type(*(&optarg));
break;
case 72:
human_output_opts = 144;
output_block_size = 1;
break;
case 80:
if (header_mode != 4) {
v1 = 1;
break;
} else {
error(0x0, 0x0, v13);
usage(0x1);
}
case 84:
if (header_mode != 4) {
print_type = 1;
break;
} else {
error(0x0, 0x0, v13);
usage(0x1);
}
case 97:
show_all_fs = 1;
break;
case 104:
human_output_opts = 176;
output_block_size = 1;
break;
case 105:
if (header_mode == 4) {
error(0x0, 0x0, v13);
usage(0x1);
}
header_mode = 1;
break;
case 107:
human_output_opts = 0;
output_block_size = 0x400;
break;
case 108:
show_local_fs = 1;
break;
case 109:
human_output_opts = 0;
output_block_size = 0x100000;
break;
case 118:
continue;
case 120:
add_excluded_fs_type(*(&optarg));
break;
case 128:
require_sync = 0;
break;
case 129:
require_sync = 1;
break;
case 130:
print_grand_total = 1;
break;
case 131:
if (header_mode == 1) {
error(0x0, 0x0, v13);
usage(0x1);
}
if (v1 && !header_mode) {
error(0x0, 0x0, v13);
usage(0x1);
}
if (print_type) {
error(0x0, 0x0, v13);
usage(0x1);
}
header_mode = 4;
if (*(&optarg))
decode_output_arg(*(&optarg));
break;
default:
LABEL_403aed:
usage(0x1);
}
} else if (v7 == -131) {
v0 = 0;
version_etc(stdout, "df", "GNU coreutils", Version, "Torbjorn Granlund",
"David MacKenzie", "Paul Eggert");
exit(0x0);
} else if (v7 == -130) {
usage(0x0);
}
}
if (human_output_opts == -1) {
if (!v1) {
human_options(getenv("DF_BLOCK_SIZE"), &human_output_opts,
&output_block_size);
} else {
human_output_opts = 0;
if (!getenv("POSIXLY_CORRECT"))
v16 = 0x400;
else
v16 = 0x200;
output_block_size = v16;
}
}
if (header_mode != 1 && header_mode != 4) {
if ((human_output_opts & 16)) {
header_mode = 2;
} else if (v1) {
header_mode = 3;
}
}
v2 = 0;
for (v11[0] = fs_select_list; v11; v11[0] = v11[1]) {
v12[0] = fs_exclude_list;
while (true) {
if (!v12)
break;
if (strcmp(v11[0], v12[0])) {
v12[0] = v12[1];
} else {
v17 = quote(v11[0]);
error(0x0, 0x0,
gettext("file system type %s both selected and excluded"));
v2 = 1;
break;
}
}
}
if (v2) {
*(&v16) = 1;
} else {
if (a0 > optind) {
v10 = xnmalloc(a0 - optind, 0x90, a0 - optind, v17);
for (v4 = optind; v4 < a0; v4 += 1) {
v9 = automount_stat_err(a1[v4], (v4 - optind) * 144 + v10,
(v4 - optind) * 144 + v10);
if (v9) {
quotearg_n_style_colon(0x0, 0x3, a1[v4]);
error(0x0, v9, "%s");
exit_status = 1;
a1[v4] = 0;
}
}
}
if (fs_select_list) {
LABEL_403da6:
*(&v16) = 1;
} else {
if (!(!fs_exclude_list))
goto LABEL_403da6;
if (!(!print_type))
goto LABEL_403da6;
if (!(!g_40517c))
goto LABEL_403da6;
if (!(!show_local_fs))
goto LABEL_403da6;
*(&v16) = 0;
}
v16 = v16 & 1;
mount_list = read_file_system_list(v16);
if (!mount_list) {
v5 = 0;
if (a0 > optind && !show_all_fs && !show_local_fs && !fs_select_list &&
!fs_exclude_list)
goto LABEL_403e1d;
v5 = 1;
LABEL_403e1d:
if (v5)
v18 = &g_4043db;
else
v18 = gettext("Warning: ");
v14 = v18;
v19 = gettext("cannot read table of mounted file systems");
error(v5, *(__errno_location()), "%s%s");
} else {
if (require_sync)
sync();
get_field_list();
get_header();
if (!v10) {
get_all_entries();
} else {
show_listed_fs = 1;
for (v6 = optind; v6 < a0; v6 += 1) {
if (a1[v6])
get_entry(a1[v6], (v6 - optind) * 144 + v10);
}
}
if (file_systems_processed) {
if (print_grand_total) {
if (g_40514c)
v16 = "-";
else
v16 = "total";
get_dev("total", v16, 0x0, NULL, NULL, 0x0, 0x0, &grand_fsu, 0x0);
}
print_table();
} else if (!exit_status) {
error(0x1, 0x0, gettext("no file systems processed"));
}
*(&v16) = exit_status;
}
}
return v16;
} | coreutils | angr_phoenix |
void sigblockall(sigset_t *oldmask) {
sigset_t mask;
sigfillset(&mask);
sigprocmask(2, &mask, oldmask);
} | unsigned long sigblockall(sigset_t *a1) {
sigset_t set;
unsigned long v3;
v3 = __readfsqword(0x28u);
sigfillset(&set);
sigprocmask(2, &set, a1);
return __readfsqword(0x28u) ^ v3;
} | dash-0.5.11+git20210903+057cd650a4ed | ida |
void redirection_error(temp, error, fn) REDIRECT *temp;
int error;
char *fn;
{
char *filename, *allocname;
int oflags;
allocname = 0;
if ((temp->rflags & 0x01) && error < 0)
filename = allocname =
(char *)strcpy(sh_xmalloc((1 + strlen(temp->redirector.filename->word)),
"redir.c", 146),
(temp->redirector.filename->word));
else if ((temp->rflags & 0x01) == 0 && temp->redirector.dest < 0)
filename = gettext("file descriptor out of range");
else if (error != -2 && temp->redirector.dest >= 0 && error == 9) {
switch (temp->instruction) {
case r_duplicating_input:
case r_duplicating_output:
case r_move_input:
case r_move_output:
filename = allocname = itos(temp->redirectee.dest);
break;
case r_duplicating_input_word:
if (temp->redirector.dest == 0)
filename = temp->redirectee.filename->word;
else
filename = allocname = itos(temp->redirector.dest);
break;
case r_duplicating_output_word:
if (temp->redirector.dest == 1)
filename = temp->redirectee.filename->word;
else
filename = allocname = itos(temp->redirector.dest);
break;
default:
filename = allocname = itos(temp->redirector.dest);
break;
}
}
else if (fn)
filename = fn;
else if (expandable_redirection_filename(temp)) {
oflags = temp->redirectee.filename->flags;
if (posixly_correct && interactive_shell == 0)
temp->redirectee.filename->flags |= (1 << 5);
temp->redirectee.filename->flags |= (1 << 10);
filename = allocname = redirection_expand(temp->redirectee.filename);
temp->redirectee.filename->flags = oflags;
if (filename == 0)
filename = temp->redirectee.filename->word;
} else if (temp->redirectee.dest < 0)
filename = gettext("file descriptor out of range");
else
filename = allocname = itos(temp->redirectee.dest);
switch (error) {
case -1:
internal_error(gettext("%s: ambiguous redirect"), filename);
break;
case -2:
internal_error(gettext("%s: cannot overwrite existing file"), filename);
break;
case -3:
internal_error(gettext("%s: restricted: cannot redirect output"), filename);
break;
case -4:
internal_error(gettext("cannot create temp file for here-document: %s"),
strerror(heredoc_errno));
break;
case -5:
internal_error(gettext("%s: cannot assign fd to variable"), filename);
break;
default:
internal_error("%s: %s", filename, strerror(error));
break;
}
do {
if (allocname)
sh_xfree((allocname), "redir.c", 231);
} while (0);
} | void redirection_error(struct_0 *a0, unsigned long a1, unsigned long long a2) {
unsigned long long v0;
int tmp_33;
unsigned int v1;
void *v2;
void *v3;
unsigned long long v5;
unsigned long long v6;
unsigned long long v7;
unsigned long long v8;
unsigned long long v9;
unsigned long long v10;
unsigned long long v11;
unsigned long long v12;
unsigned long long v13;
unsigned long long v14;
unsigned long long v15;
unsigned long long v16;
v0 = a2;
v3 = 0;
if ((a0->field_10 & 1) && a1 < 0) {
v3 = strcpy(sh_xmalloc(strlen(a0->field_8->field_0) + 1, "redir.c", 0x92),
a0->field_8->field_0);
v2 = v3;
goto LABEL_4002c7;
}
if (!(a0->field_10 & 1) && a0->field_8 < 0) {
v2 = gettext("file descriptor out of range");
goto LABEL_4002c7;
}
if (a1 != -2 && a0->field_8 >= 0 && a1 == 9) {
if (a0->field_18 <= 16) {
if (a0->field_18 >= 15) {
LABEL_400113:
v3 = itos(a0->field_20);
v2 = v3;
goto LABEL_4001ca;
} else {
if (a0->field_18 == 14) {
if (a0->field_8 == 1) {
v2 = a0->field_20->field_0;
goto LABEL_4001ca;
} else {
v3 = itos(a0->field_8);
v2 = v3;
goto LABEL_4001ca;
}
}
if (a0->field_18 <= 14) {
if (a0->field_18 <= 7) {
if (a0->field_18 < 6)
goto LABEL_4001ac;
goto LABEL_400113;
} else if (a0->field_18 == 13) {
if (!a0->field_8) {
v2 = a0->field_20->field_0;
goto LABEL_4001ca;
} else {
v3 = itos(a0->field_8);
v2 = v3;
goto LABEL_4001ca;
}
}
}
}
}
LABEL_4001ac:
v3 = itos(a0->field_8);
v2 = v3;
LABEL_4001ca:
goto LABEL_4002c7;
}
if (v0) {
v2 = v0;
} else if (expandable_redirection_filename(a0)) {
v1 = a0->field_20->field_8;
if (posixly_correct && !interactive_shell)
a0->field_20->field_8 = a0->field_20->field_8 | 32;
v5 = a0->field_20->field_8;
*(&v5) = (a0->field_20->field_8 >> 8) | 4;
tmp_33 = v5;
a0->field_20->field_8 = tmp_33;
v3 = redirection_expand(a0->field_20);
v2 = v3;
a0->field_20->field_8 = v1;
if (!v2)
v2 = a0->field_20->field_0;
} else if (a0->field_20 < 0) {
v2 = gettext("file descriptor out of range");
} else {
v3 = itos(a0->field_20);
v2 = v3;
}
LABEL_4002c7:
switch (a1 + 5) {
case 0:
v9 = gettext("%s: cannot assign fd to variable");
v14 = internal_error(v9, v2, v9);
break;
case 1:
v15 =
internal_error(gettext("cannot create temp file for here-document: %s"),
strerror(heredoc_errno), a0->field_20->field_8);
break;
case 2:
v7 = gettext("%s: restricted: cannot redirect output");
v12 = internal_error(v7, v2, v7);
break;
case 3:
v6 = gettext("%s: cannot overwrite existing file");
v11 = internal_error(v6, v2, v6);
break;
case 4:
v8 = gettext("%s: ambiguous redirect");
v13 = internal_error(v8, v2, v8);
break;
default:
v10 = internal_error("%s: %s", v2, strerror(a1));
break;
}
if (v3)
v16 = sh_xfree(v3, "redir.c", 0xe7);
return;
} | bash | angr_phoenix |
static int channel_cancel_rport_listener_tcpip(struct ssh *ssh,
const char *host, u_short port) {
u_int i;
int found = 0;
for (i = 0; i < ssh->chanctxt->channels_alloc; i++) {
Channel *c = ssh->chanctxt->channels[i];
if (c == ((void *)0) || c->type != 11)
continue;
if (strcmp(c->path, host) == 0 && c->listening_port == port) {
sshlog("channels.c", __func__, 3827, 1, SYSLOG_LEVEL_DEBUG2, ((void *)0),
"close channel %d", i);
channel_free(ssh, c);
found = 1;
}
}
return found;
} | void channel_cancel_rport_listener_tcpip(struct_0 *a0, char *a1,
unsigned long a2) {
unsigned long v0;
unsigned int v1;
unsigned int v2;
struct_2 *v3;
unsigned long long v5;
v2 = 0;
v1 = 0;
while (true) {
if (v1 >= a0->field_868->field_8)
break;
v3 = *((a0->field_868->field_0 + v1 * 8));
if (v3 && v3->field_0 == 11 && !strcmp(v3->field_80, a1) &&
v3->field_88 == a2) {
v0 = v1;
sshlog("channels.c", "channel_cancel_rport_listener_tcpip", 0xef3, 0x1,
0x6, 0x0, "close channel %d");
channel_free(a0, v3);
v2 = 1;
}
v1 += 1;
}
v5 = v2;
return;
} | openssh-portable | angr_phoenix |
static _Bool
needs_quoting(char const *name) {
char test[2];
size_t len =
quotearg_buffer(test, sizeof test, name, -1, filename_quoting_options);
return *name != *test || strlen(name) != len;
} | undefined4 needs_quoting(char *param_1)
{
undefined4 uVar1;
size_t sVar2;
size_t sVar3;
long in_FS_OFFSET;
char local_12[2];
long local_10;
local_10 = *(long *)(in_FS_OFFSET + 0x28);
sVar2 = quotearg_buffer(local_12, 2, param_1, 0xffffffffffffffff,
filename_quoting_options);
if (*param_1 == local_12[0]) {
sVar3 = strlen(param_1);
if (sVar2 == sVar3) {
uVar1 = 0;
goto LAB_00104a7c;
}
}
uVar1 = 1;
LAB_00104a7c:
if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) {
__stack_chk_fail();
}
return uVar1;
} | coreutils | ghidra |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.