input stringlengths 26 172k | output stringlengths 18 318k | repo_name stringclasses 23 values | decompiler stringclasses 5 values |
|---|---|---|---|
int _rl_qsort_string_compare(char **s1, char **s2) {
return (strcoll(*s1, *s2));
} | long long _rl_qsort_string_compare(unsigned long long *a0,
unsigned long long *a1) {
return strcoll(*(a0), *(a1));
} | bash | angr_sailr |
void usage(FILE *out, int status) {
const char str[] =
"gnutls-serv - GnuTLS server\n"
"Usage: gnutls-serv [ -<flag> [<val>] | --<name>[{=| }<val>] ]... \n"
"\n"
"None:\n"
"\n"
" -d, --debug=num Enable debugging\n"
" - it must be in the range:\n"
" 0 to 9999\n"
" --sni-hostname=str Server's hostname for server name "
"extension\n"
" --sni-hostname-fatal Send fatal alert on sni-hostname "
"mismatch\n"
" --alpn=str Specify ALPN protocol to be enabled by "
"the server\n"
" --alpn-fatal Send fatal alert on non-matching ALPN "
"name\n"
" --noticket Don't accept session tickets\n"
" --earlydata Accept early data\n"
" --maxearlydata=num The maximum early data size to accept\n"
" - it must be in the range:\n"
" 1 to 2147483648\n"
" --nocookie Don't require cookie on DTLS sessions\n"
" -g, --generate Generate Diffie-Hellman parameters\n"
" -q, --quiet Suppress some messages\n"
" --nodb Do not use a resumption database\n"
" --http Act as an HTTP server\n"
" --echo Act as an Echo server\n"
" --crlf Do not replace CRLF by LF in Echo server "
"mode\n"
" -u, --udp Use DTLS (datagram TLS) over UDP\n"
" --mtu=num Set MTU for datagram TLS\n"
" - it must be in the range:\n"
" 0 to 17000\n"
" --srtp-profiles=str Offer SRTP profiles\n"
" -a, --disable-client-cert Do not request a client certificate\n"
" - prohibits the option 'require-client-cert'\n"
" -r, --require-client-cert Require a client certificate\n"
" --verify-client-cert If a client certificate is sent then "
"verify it\n"
" --compress-cert=str Compress certificate\n"
" -b, --heartbeat Activate heartbeat support\n"
" --x509fmtder Use DER format for certificates to read "
"from\n"
" --priority=str Priorities string\n"
" --dhparams=file DH params file to use\n"
" - file must pre-exist\n"
" --x509cafile=str Certificate file or PKCS #11 URL to use\n"
" --x509crlfile=file CRL file to use\n"
" - file must pre-exist\n"
" --x509keyfile=str X.509 key file or PKCS #11 URL to use\n"
" --x509certfile=str X.509 Certificate file or PKCS #11 URL to "
"use\n"
" --rawpkkeyfile=str Private key file (PKCS #8 or PKCS #12) or "
"PKCS #11 URL to use\n"
" --rawpkfile=str Raw public-key file to use\n"
" - requires the option 'rawpkkeyfile'\n"
" --srppasswd=file SRP password file to use\n"
" - file must pre-exist\n"
" --srppasswdconf=file SRP password configuration file to use\n"
" - file must pre-exist\n"
" --pskpasswd=file PSK password file to use\n"
" - file must pre-exist\n"
" --pskhint=str PSK identity hint to use\n"
" --ocsp-response=str The OCSP response to send to client\n"
" --ignore-ocsp-response-errors Ignore any errors when setting "
"the OCSP response\n"
" -p, --port=num The port to connect to\n"
" -l, --list Print a list of the supported algorithms "
"and modes\n"
" --provider=file Specify the PKCS #11 provider library\n"
" - file must pre-exist\n"
" --keymatexport=str Label used for exporting keying material\n"
" --keymatexportsize=num Size of the exported keying material\n"
" --recordsize=num The maximum record size to advertise\n"
" - it must be in the range:\n"
" 0 to 16384\n"
" --httpdata=file The data used as HTTP response\n"
" - file must pre-exist\n"
"\n"
"Version, usage and configuration options:\n"
"\n"
" -v, --version[=arg] output version information and exit\n"
" -h, --help display extended usage information and "
"exit\n"
" -!, --more-help extended usage information passed thru "
"pager\n"
"\n"
"Options are specified by doubled hyphens and their name or by a single\n"
"hyphen and the flag character.\n"
"\n"
"Server program that listens to incoming TLS connections.\n"
"\n"
"Please send bug reports to: <bugs@gnutls.org>\n"
"\n";
fprintf(out, "%s", str);
exit(status);
} | void usage(void *a0, unsigned long a1) {
unsigned int v0;
void *v1;
char v2;
unsigned long v3;
unsigned long long *v5;
unsigned long long v6;
unsigned long long v7;
unsigned long v8;
void *v9;
v1 = a0;
v0 = a1;
v3 = v5[5];
v6 = 488;
v9 = &v2;
for (v7 = "gnutls-serv - GnuTLS server\nUsage: gnutls-serv [ -<flag> "
"[<val>] | --<name>[{=| }<val>] ]... \n\nNone:\n\n -d, "
"--debug=num Enable debugging\n\t\t\t\t- it must be in "
"the range:\n\t\t\t\t 0 to 9999\n --sni-hostname=str "
"Server's hostname for server name extension\n "
"--sni-hostname-fatal Send fatal alert on sni-hostname "
"mismatch\n --alpn=str Specify ALPN protocol to "
"be enabled by the server\n --alpn-fatal Send "
"fatal alert on non-matching ALPN name\n --noticket "
" Don't accept session tickets\n --earlydata "
"Accept early data\n --maxearlydata=num The maximum "
"early data size to accept\n\t\t\t\t- it must be in the "
"range:\n\t\t\t\t 1 to 2147483648\n --nocookie "
"Don't require cookie on DTLS sessions\n -g, --generate "
" Generate Diffie-Hellman parameters\n -q, --quiet "
" Suppress some messages\n --nodb Do not "
"use a resumption database\n --http Act as "
"an HTTP server";
v6; v7 += v8 * 8) {
v6 -= 1;
v2 = *(v7);
v9 += v8 * 8;
}
*(v9) = *(v7);
fprintf(v1, "%s", &v2);
exit(v0);
} | gnutls | angr_sailr |
int tt_seteightbit(ttp)
struct termios *ttp;
{
ttp->c_iflag &= ~0000040;
ttp->c_cflag |= 0000060;
ttp->c_cflag &= ~0000400;
return 0;
} | int tt_seteightbit(unsigned int a0[3]) {
int tmp_83;
unsigned long long v1;
a0[0] = a0[0] & -33;
a0[2] = a0[2] | 48;
v1 = a0[2];
*(&v1) = (a0[2] >> 8) & 254;
tmp_83 = v1;
a0[2] = tmp_83;
return 0;
} | bash | angr_dream |
pid_t xfork(void) {
pid_t p = fork();
if (p == (pid_t)-1)
call_arg_fatal("fork", gettext("child process"));
return p;
} | long long xfork() {
unsigned int v0;
v0 = fork();
if (v0 == -1)
call_arg_fatal("fork", gettext("child process"));
return v0;
} | tar | angr_dream |
void line_error(defs, format, arg1, arg2) DEF_FILE *defs;
char *format, *arg1, *arg2;
{
if (defs->filename[0] != '/')
fprintf(stderr, "%s", error_directory ? error_directory : "./");
fprintf(stderr, "%s:%d:", defs->filename, defs->line_number + 1);
fprintf(stderr, format, arg1, arg2);
fprintf(stderr, "\n");
fflush(stderr);
} | int line_error(long a1, const char *a2, long a3, long a4) {
const char *v4;
if (**(_BYTE **)a1 != 47) {
if (error_directory)
v4 = error_directory;
else
v4 = "./";
fprintf(stderr, "%s", v4);
}
fprintf(stderr, "%s:%d:", *(const char **)a1,
(unsigned int)(*(_DWORD *)(a1 + 16) + 1));
fprintf(stderr, a2, a3, a4);
fprintf(stderr, "\n");
return fflush(stderr);
} | bash | ida |
int addr_sa_to_xaddr(struct sockaddr *sa, socklen_t slen, struct xaddr *xa) {
struct sockaddr_in *in4 = (struct sockaddr_in *)sa;
struct sockaddr_in6 *in6 = (struct sockaddr_in6 *)sa;
memset(xa, '\0', sizeof(*xa));
switch (sa->sa_family) {
case 2:
if (slen < (socklen_t)sizeof(*in4))
return -1;
xa->af = 2;
memcpy(&xa->xa.v4, &in4->sin_addr, sizeof(xa->xa.v4));
break;
case 10:
if (slen < (socklen_t)sizeof(*in6))
return -1;
xa->af = 10;
memcpy(&xa->xa.v6, &in6->sin6_addr, sizeof(xa->xa.v6));
xa->scope_id = in6->sin6_scope_id;
break;
default:
return -1;
}
return 0;
} | undefined8 addr_sa_to_xaddr(short *param_1, uint param_2, undefined2 *param_3)
{
memset(param_3, 0, 0x18);
if (*param_1 == 2) {
if (param_2 < 0x10) {
return 0xffffffff;
}
*param_3 = 2;
memcpy(param_3 + 2, param_1 + 2, 4);
} else {
if (*param_1 != 10) {
return 0xffffffff;
}
if (param_2 < 0x1c) {
return 0xffffffff;
}
*param_3 = 10;
memcpy(param_3 + 2, param_1 + 4, 0x10);
*(undefined4 *)(param_3 + 10) = *(undefined4 *)(param_1 + 0xc);
}
return 0;
} | openssh-portable | ghidra |
static void
cprintf(const char *control, ...)
{
register const char *s;
char char_arg[2], *argp,
intbuf[(((sizeof(unsigned int) * 8) -
(!((unsigned int)0 < (unsigned int)-1))) *
302 / 1000 +
1 + (!((unsigned int)0 < (unsigned int)-1))) +
1];
int digit_arg, arg_len, c;
va_list args;
__builtin_va_start(args, control);
arg_len = strlen(control);
the_printed_command_resize(arg_len + 1);
char_arg[1] = '\0';
s = control;
while (s && *s) {
c = *s++;
argp = (char *)((void *)0);
if (c != '%' || !*s) {
char_arg[0] = c;
argp = char_arg;
arg_len = 1;
} else {
c = *s++;
switch (c) {
case '%':
char_arg[0] = c;
argp = char_arg;
arg_len = 1;
break;
case 's':
argp = __builtin_va_arg(args, char *);
arg_len = strlen(argp);
break;
case 'd':
digit_arg = __builtin_va_arg(args, int);
if (digit_arg < 0) {
sprintf(intbuf, "%u", (unsigned int)-1);
argp = intbuf;
} else
argp = inttostr(digit_arg, intbuf, sizeof(intbuf));
arg_len = strlen(argp);
break;
case 'c':
char_arg[0] = __builtin_va_arg(args, int);
argp = char_arg;
arg_len = 1;
break;
default:
programming_error(gettext("cprintf: `%c': invalid format character"),
c);
}
}
if (argp && arg_len) {
the_printed_command_resize(arg_len + 1);
__builtin_memcpy((the_printed_command + command_string_index), (argp),
(arg_len));
command_string_index += arg_len;
}
}
__builtin_va_end(args);
the_printed_command[command_string_index] = '\0';
} | ((*(char *)(the_printed_command + (long)command_string_index + -1) != '&' &&
(*(char *)(the_printed_command + (long)command_string_index + -1) != '\n')))) {
cprintf(&DAT_0010359d);
} | bash | ghidra |
int sshkey_verify(const struct sshkey *key, const u_char *sig, size_t siglen,
const u_char *data, size_t dlen, const char *alg,
u_int compat, struct sshkey_sig_details **detailsp) {
if (detailsp != ((void *)0))
*detailsp = ((void *)0);
if (siglen == 0 || dlen > (1 << 20))
return -10;
switch (key->type) {
case KEY_DSA_CERT:
case KEY_DSA:
return ssh_dss_verify(key, sig, siglen, data, dlen, compat);
case KEY_ECDSA_CERT:
case KEY_ECDSA:
return ssh_ecdsa_verify(key, sig, siglen, data, dlen, compat);
case KEY_ECDSA_SK_CERT:
case KEY_ECDSA_SK:
return ssh_ecdsa_sk_verify(key, sig, siglen, data, dlen, compat, detailsp);
case KEY_RSA_CERT:
case KEY_RSA:
return ssh_rsa_verify(key, sig, siglen, data, dlen, alg);
case KEY_ED25519:
case KEY_ED25519_CERT:
return ssh_ed25519_verify(key, sig, siglen, data, dlen, compat);
case KEY_ED25519_SK:
case KEY_ED25519_SK_CERT:
return ssh_ed25519_sk_verify(key, sig, siglen, data, dlen, compat,
detailsp);
default:
return -14;
}
} | undefined8 sshkey_verify(undefined4 *param_1, undefined8 param_2, long param_3,
undefined8 param_4, ulong param_5, undefined8 param_6,
undefined4 param_7, undefined8 *param_8)
{
undefined8 uVar1;
if (param_8 != (undefined8 *)0x0) {
*param_8 = 0;
}
if ((param_3 == 0) || (0x100000 < param_5)) {
uVar1 = 0xfffffff6;
} else {
switch (*param_1) {
case 0:
case 4:
uVar1 =
ssh_rsa_verify(param_1, param_2, param_3, param_4, param_5, param_6);
break;
case 1:
case 5:
uVar1 =
ssh_dss_verify(param_1, param_2, param_3, param_4, param_5, param_7);
break;
case 2:
case 6:
uVar1 = ssh_ecdsa_verify(param_1, param_2, param_3, param_4, param_5,
param_7);
break;
case 3:
case 7:
uVar1 = ssh_ed25519_verify(param_1, param_2, param_3, param_4, param_5,
param_7);
break;
default:
uVar1 = 0xfffffff2;
break;
case 10:
case 0xb:
uVar1 = ssh_ecdsa_sk_verify(param_1, param_2, param_3, param_4, param_5,
param_7, param_8);
break;
case 0xc:
case 0xd:
uVar1 = ssh_ed25519_sk_verify(param_1, param_2, param_3, param_4, param_5,
param_7, param_8);
}
}
return uVar1;
} | openssh-portable | ghidra |
int evaltree(union node *n, int flags) {
int checkexit = 0;
int (*evalfn)(union node *, int);
struct stackmark smark;
unsigned isor;
int status = 0;
setstackmark(&smark);
if (optlist[5])
goto out;
if (n == ((void *)0)) {
;
goto out;
}
dotrap();
;
switch (n->type) {
default:
case 25:
status = !evaltree(n->nnot.com, 02);
goto setstatus;
case 2:
errlinno = lineno = n->nredir.linno;
if (funcline)
lineno -= funcline - 1;
expredir(n->nredir.redirect);
pushredir(n->nredir.redirect);
status = redirectsafe(n->nredir.redirect, 01)
?: evaltree(n->nredir.n, flags & 02);
if (n->nredir.redirect)
popredir(0);
goto setstatus;
case 0:
evalfn = evalcommand;
checkexit:
checkexit = ~flags & 02;
goto calleval;
case 11:
evalfn = evalfor;
goto calleval;
case 9:
case 10:
evalfn = evalloop;
goto calleval;
case 4:
case 3:
evalfn = evalsubshell;
goto checkexit;
case 1:
evalfn = evalpipe;
goto checkexit;
case 12:
evalfn = evalcase;
goto calleval;
case 5:
case 6:
case 7:
isor = n->type - 5;
status = evaltree(n->nbinary.ch1, (flags | ((isor >> 1) - 1)) & 02);
if ((!status) == isor || evalskip)
break;
n = n->nbinary.ch2;
evaln:
evalfn = evaltree;
calleval:
status = evalfn(n, flags);
goto setstatus;
case 8:
status = evaltree(n->nif.test, 02);
if (evalskip)
break;
if (!status) {
n = n->nif.ifpart;
goto evaln;
} else if (n->nif.elsepart) {
n = n->nif.elsepart;
goto evaln;
}
status = 0;
goto setstatus;
case 14:
defun(n);
setstatus:
exitstatus = status;
break;
}
out:
dotrap();
if (optlist[0] && checkexit && status)
goto exexit;
if (flags & 01) {
exexit:
exraise(3);
}
popstackmark(&smark);
return exitstatus;
} | int evaltree(unsigned long long a0, unsigned long a1) {
unsigned int v0;
unsigned long v1;
unsigned int v2;
unsigned int v3;
unsigned int v4;
unsigned long long v5;
char v6;
unsigned long long v9;
v1 = a0;
v0 = a1;
v2 = 0;
v3 = 0;
setstackmark(&v6);
if (!g_500095 && v1) {
dotrap();
switch (v1->field_0) {
case 0:
v5 = evalcommand;
v2 = !(v0) & 2;
goto LABEL_4004b3;
case 1:
v5 = evalpipe;
v2 = !(v0) & 2;
goto LABEL_4004b3;
case 2:
lineno = v1->field_4;
errlinno = lineno;
if (funcline)
lineno = lineno - (funcline - 1);
expredir(v1->field_10);
pushredir(v1->field_10);
v9 = redirectsafe(v1->field_10, 0x1);
if (!v9)
v9 = evaltree(v1->field_8, a1 & 2);
v3 = v9;
if (v1->field_10)
popredir(0x0);
break;
case 3:
case 4:
v5 = evalsubshell;
v2 = !(v0) & 2;
LABEL_4004b3:
v3 = (stack_base)[48](v1, a1, a1, (stack_base)[48]);
break;
case 5:
case 6:
case 7:
v4 = v1->field_0 - 5;
v3 = evaltree(v1->field_8, (a1 | ((v4 >> 1) - 1)) & 2);
if (true) {
goto LABEL_400548;
} else {
v1 = v1->field_10;
v5 = evaltree;
v3 = (stack_base)[48](v1, a1, a1, (stack_base)[48]);
break;
}
case 8:
v3 = evaltree(v1->field_8, 0x2);
if (!(!17905618636109546312))
goto LABEL_400548;
if (!v3) {
v1 = v1->field_10;
v5 = evaltree;
v3 = (stack_base)[48](v1, a1, a1, (stack_base)[48]);
break;
} else if (!v1->field_18) {
v3 = 0;
break;
} else {
v1 = v1->field_18;
v5 = evaltree;
v3 = (stack_base)[48](v1, a1, a1, (stack_base)[48]);
break;
}
inps4 = v3;
goto LABEL_400548;
case 9:
case 10:
v5 = evalloop;
v3 = (stack_base)[48](v1, a1, a1, (stack_base)[48]);
break;
case 11:
v5 = evalfor;
v3 = (stack_base)[48](v1, a1, a1, (stack_base)[48]);
break;
case 12:
v5 = evalcase;
v3 = (stack_base)[48](v1, a1, a1, (stack_base)[48]);
break;
case 14:
defun(v1);
break;
default:
v3 = !evaltree(v1->field_8, 0x2);
break;
}
}
LABEL_400548:
dotrap();
if (optlist && v2 && v3 || (a1 & 1))
exraise(0x3);
popstackmark(&v6);
return 283935560;
} | dash-0.5.11+git20210903+057cd650a4ed | angr_sailr |
static void
__ipstats_show_hw_s_info_one(const struct ipstats_hw_s_info_one *hwsio) {
if (hwsio == ((void *)0))
return;
ipstats_print_moo(PRINT_ANY, "request", " %s", hwsio->request);
ipstats_print_moo(PRINT_ANY, "used", " used %s", hwsio->used);
} | void __ipstats_show_hw_s_info_one(unsigned int a0[2]) {
unsigned long long v1;
if (a0) {
ipstats_print_moo(0x4, "request", " %s", a0[0]);
v1 = ipstats_print_moo(0x4, "used", " used %s", a0[1]);
}
return;
} | iproute2-6.0.0 | angr_dream |
int el_winsertstr(EditLine *el, const wchar_t *s) {
size_t len;
if (s == ((void *)0) || (len = wcslen(s)) == 0)
return -1;
if (el->el_line.lastchar + len >= el->el_line.limit) {
if (!ch_enlargebufs(el, len))
return -1;
}
c_insert(el, (int)len);
while (*s)
*el->el_line.cursor++ = *s++;
return 0;
} | long long el_winsertstr(unsigned long long a0[14], unsigned short *a1) {
unsigned int *v0;
int tmp_12;
unsigned int v1;
unsigned long long v3;
unsigned long long v4;
unsigned int *v5;
v0 = &a1;
if (v0) {
*(&v1) = wcslen(v0);
if (*(&v1)) {
if ((*(&v1) << 2) + a0[12] >= a0[13]) {
v4 = ch_enlargebufs(a0, *(&v1));
if (!v4)
v3 = 4294967295;
}
if ((*(&v1) << 2) + a0[12] < a0[13] || v4) {
c_insert(a0, *(&v1));
for (; *(v0); *(v5) = *(tmp_12)) {
tmp_12 = v0;
v0 += 1;
v5 = a0[11];
a0[11] = a0[11] + 4;
}
v3 = 0;
}
}
}
if (!*(&v1) || !v0)
v3 = 4294967295;
return v3;
} | libedit | angr_dream |
static int serialise_array(struct sshbuf *m, char **a, size_t n) {
struct sshbuf *b;
size_t i;
int r;
if (n > 0x7fffffff)
return -1;
if ((b = sshbuf_new()) == ((void *)0)) {
return -2;
}
for (i = 0; i < n; i++) {
if ((r = sshbuf_put_cstring(b, a[i])) != 0) {
sshbuf_free(b);
return r;
}
}
if ((r = sshbuf_put_u32(m, n)) != 0 || (r = sshbuf_put_stringb(m, b)) != 0) {
sshbuf_free(b);
return r;
}
return 0;
} | int serialise_array(unsigned long long a0, void *a1, unsigned long long a2) {
unsigned int v0;
void *v1;
unsigned long long v2;
unsigned int v4;
if (a2 >= 0x80000000) {
v4 = -1;
} else {
v2 = sshbuf_new();
if (!v2) {
v4 = -2;
} else {
v1 = 0;
while (true) {
if (v1 < a2) {
v0 = sshbuf_put_cstring(v2, *((a1 + 0x8 * v1)), *((a1 + 0x8 * v1)));
if (v0) {
sshbuf_free(v2);
v4 = v0;
break;
} else {
v1 += 1;
}
} else {
v0 = sshbuf_put_u32(a0, a2, a2);
if (!v0) {
v0 = sshbuf_put_stringb(a0, v2, v2);
if (!v0) {
v4 = 0;
break;
}
}
if (v0 || v0) {
sshbuf_free(v2);
v4 = v0;
break;
}
}
}
}
}
return v4;
} | openssh-portable | angr_dream |
static _Bool
grepfile(int dirdesc, char const *name, _Bool follow, _Bool command_line) {
int oflag = (00 | 0400
| (({ binary ? 0 : 0; })) | (follow ? 0 : 0400000) |
(skip_devices(command_line) ? 04000 : 0));
int desc = openat_safer(dirdesc, name, oflag);
if (desc < 0) {
if (follow || !open_symlink_nofollow_error((*__errno_location())))
suppressible_error((*__errno_location()));
return 1;
}
return grepdesc(desc, command_line);
} | undefined8 grepfile(undefined4 param_1, undefined8 param_2, char param_3,
undefined param_4)
{
char cVar1;
uint uVar2;
int iVar3;
int *piVar4;
undefined8 uVar5;
uint uVar6;
if (param_3 == '\0') {
uVar6 = 0x20100;
} else {
uVar6 = 0x100;
}
cVar1 = skip_devices(param_4);
if (cVar1 == '\0') {
uVar2 = 0;
} else {
uVar2 = 0x800;
}
iVar3 = openat_safer(param_1, param_2, uVar2 | uVar6);
if (iVar3 < 0) {
if (param_3 == '\0') {
piVar4 = __errno_location();
cVar1 = open_symlink_nofollow_error(*piVar4);
if (cVar1 == '\x01') {
return 1;
}
}
piVar4 = __errno_location();
suppressible_error(*piVar4);
return 1;
}
uVar5 = grepdesc(iVar3, param_4);
return uVar5;
} | grep | ghidra |
void mm_request_receive_expect(int sock, enum monitor_reqtype type,
struct sshbuf *m) {
u_char rtype;
int r;
sshlog("monitor_wrap.c", __func__, 170, 1, SYSLOG_LEVEL_DEBUG3, ((void *)0),
"entering, type %d", type);
mm_request_receive(sock, m);
if ((r = sshbuf_get_u8(m, &rtype)) != 0)
sshfatal("monitor_wrap.c", __func__, 174, 1, SYSLOG_LEVEL_FATAL, ssh_err(r),
"parse");
if (rtype != type)
sshfatal("monitor_wrap.c", __func__, 176, 1, SYSLOG_LEVEL_FATAL,
((void *)0), "read: rtype %d != type %d", rtype, type);
} | void mm_request_receive_expect(unsigned long a0, unsigned long a1,
unsigned long long a2) {
unsigned long v0;
unsigned long long v1;
unsigned long v2;
char v3;
unsigned int v4;
unsigned long long v5;
unsigned long long *v7;
unsigned long long v8;
v0 = a1;
sshlog("monitor_wrap.c", "mm_request_receive_expect", 0xaa, 0x1, 0x7, 0x0,
"entering, type %d");
mm_request_receive(a0, a2);
v4 = sshbuf_get_u8(a2, &v3, &v3);
if (v4)
sshfatal("monitor_wrap.c", "mm_request_receive_expect", 0xae, 0x1, 0x1,
ssh_err(v4));
if (a1 != v3) {
v5 = a1;
v2 = v3;
v1 = "read: rtype %d != type %d";
sshfatal("monitor_wrap.c", "mm_request_receive_expect", 0xb0, 0x1, 0x1,
0x0);
}
v8 = v5 ^ v7[5];
return;
} | openssh-portable | angr_dream |
test_code_t test_rfc7919(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"
":+DHE-RSA:+DHE-DSS:+GROUP-ALL:%s",
protocol_str, rest);
{
int _ret;
if ((_ret = __gnutls_priority_set_direct(session, prio_str, 241)) !=
TEST_SUCCEED) {
return _ret;
}
};
gnutls_credentials_set(session, GNUTLS_CRD_CERTIFICATE, xcred);
ret = test_do_handshake(session);
if (ret != TEST_FAILED &&
(gnutls_session_get_flags(session) & GNUTLS_SFLAGS_RFC7919))
return TEST_SUCCEED;
else
return TEST_FAILED;
return TEST_IGNORE;
} | long long test_rfc7919(unsigned long long a0) {
unsigned int v0;
unsigned int v1;
unsigned long long v3;
sprintf(&prio_str,
"NONE:+CIPHER-ALL:+ARCFOUR-128:+3DES-CBC:+GOST28147-TC26Z-CNT:+COMP-"
"NULL:%s:+MAC-ALL:+MD5:+SHA1:+GOST28147-TC26Z-IMIT:+DHE-RSA:+DHE-DSS:"
"+GROUP-ALL:%s",
&protocol_str, &rest);
v0 = __gnutls_priority_set_direct(a0, &prio_str, 0xf1);
if (v0) {
v3 = v0;
return v3;
}
gnutls_credentials_set(a0, 0x1, xcred);
v1 = test_do_handshake(a0);
if (v1 == 1) {
v3 = 1;
return v3;
} else if (!(gnutls_session_get_flags(a0) & 64)) {
v3 = 1;
return v3;
} else {
v3 = 0;
return v3;
}
} | gnutls | angr_sailr |
static void ignore_globbed_names(names, name_func) char **names;
sh_ignore_func_t *name_func;
{
char **newnames;
int n, i;
for (i = 0; names[i]; i++)
;
newnames = strvec_create(i + 1);
for (n = i = 0; names[i]; i++) {
if ((*name_func)(names[i]))
newnames[n++] = names[i];
else
sh_xfree((names[i]), "pathexp.c", 524);
}
newnames[n] = (char *)((void *)0);
if (n == 0) {
names[0] = (char *)((void *)0);
sh_xfree((newnames), "pathexp.c", 532);
return;
}
for (n = 0; newnames[n]; n++)
names[n] = newnames[n];
names[n] = (char *)((void *)0);
sh_xfree((newnames), "pathexp.c", 541);
} | void ignore_globbed_names(unsigned long long *a0, unsigned long a1) {
unsigned long v0;
int tmp_33;
unsigned int v1;
unsigned int v2;
unsigned long long *v3;
unsigned long long v5;
unsigned long long v6;
v0 = a1;
for (v2 = 0; a0[v2]; v2 += 1)
;
v3 = strvec_create(v2 + 1);
v2 = 0;
for (v1 = v2; a0[v2]; v2 += 1) {
if ((stack_base)[40](a0[v2])) {
tmp_33 = v1;
v1 += 1;
v3[tmp_33] = a0[v2];
} else {
sh_xfree(a0[v2], "pathexp.c", 0x20c);
}
}
v3[v1] = 0;
if (!v1) {
*(a0) = 0;
v5 = sh_xfree(v3, "pathexp.c", 0x214);
} else {
for (v1 = 0; v3[v1]; v1 += 1) {
a0[v1] = v3[v1];
}
a0[v1] = 0;
v6 = sh_xfree(v3, "pathexp.c", 0x21d);
}
return;
} | bash | angr_phoenix |
int valid_array_reference(name, flags) const char *name;
int flags;
{
return tokenize_array_reference((char *)name, flags, (char **)((void *)0));
} | long long valid_array_reference(unsigned long long a0, unsigned long a1) {
return tokenize_array_reference(a0, a1, NULL);
} | bash | angr_sailr |
static void usage(void) {
fprintf(
stderr,
"Usage: ip neigh { add | del | change | replace }\n"
" { ADDR [ lladdr LLADDR ] [ nud STATE ] proxy ADDR }\n"
" [ dev DEV ] [ router ] [ use ] [ managed ] [ "
"extern_learn ]\n"
" [ protocol PROTO ]\n"
"\n"
" ip neigh { show | flush } [ proxy ] [ to PREFIX ] [ dev DEV ] [ nud "
"STATE ]\n"
" [ vrf NAME ] [ nomaster ]\n"
" ip neigh get { ADDR | proxy ADDR } dev DEV\n"
"\n"
"STATE := { delay | failed | incomplete | noarp | none |\n"
" permanent | probe | reachable | stale }\n");
exit(-1);
} | void usage() {
fprintf(
stderr,
"Usage: ip neigh { add | del | change | replace }\n"
" { ADDR [ lladdr LLADDR ] [ nud STATE ] proxy ADDR }\n"
" [ dev DEV ] [ router ] [ use ] [ managed ] [ "
"extern_learn ]\n"
" [ protocol PROTO ]\n"
"\n"
"\tip neigh { show | flush } [ proxy ] [ to PREFIX ] [ dev DEV ] [ nud "
"STATE ]\n"
"\t\t\t\t [ vrf NAME ] [ nomaster ]\n"
"\tip neigh get { ADDR | proxy ADDR } dev DEV\n"
"\n"
"STATE := { delay | failed | incomplete | noarp | none |\n"
" permanent | probe | reachable | stale }\n");
exit(-1);
} | iproute2-6.0.0 | ida |
static void restore_lastcom(x) char *x;
{
do {
if (the_printed_command_except_trap)
sh_xfree((the_printed_command_except_trap), "evalstring.c", 83);
} while (0);
the_printed_command_except_trap = x;
} | long long restore_lastcom(unsigned long long a0) {
if (the_printed_command_except_trap)
sh_xfree(the_printed_command_except_trap, "evalstring.c", 0x53);
the_printed_command_except_trap = a0;
return a0;
} | bash | angr_sailr |
char *localetrans(string, len, lenp)
char *string;
int len, *lenp;
{
char *locale, *t;
char *translated;
int tlen;
if (string == 0 || *string == 0) {
if (lenp)
*lenp = 0;
return ((char *)((void *)0));
}
locale = get_locale_var("LC_MESSAGES");
if (locale == 0 || locale[0] == '\0' ||
(locale[0] == 'C' && locale[1] == '\0') ||
((locale)[0] == ("POSIX")[0] && strcmp(locale, "POSIX") == 0)) {
t = (char *)sh_xmalloc((len + 1), "locale.c", 433);
strcpy(t, string);
if (lenp)
*lenp = len;
return (t);
}
if (default_domain && *default_domain)
translated = dgettext(default_domain, string);
else
translated = string;
if (translated == string) {
t = (char *)sh_xmalloc((len + 1), "locale.c", 448);
strcpy(t, string);
if (lenp)
*lenp = len;
} else {
tlen = strlen(translated);
t = (char *)sh_xmalloc((tlen + 1), "locale.c", 456);
strcpy(t, translated);
if (lenp)
*lenp = tlen;
}
return (t);
} | int localetrans(char *a0, unsigned long a1, unsigned int *a2) {
unsigned int v0;
char *v1;
char *v2;
char v3[2];
unsigned int v5;
if (a0 && *(a0)) {
*(&v3) = get_locale_var("LC_MESSAGES");
if (v3 && v3[0] && (v3[0] != 67 || v3[1]) &&
(!(v3[0] == 80) || !(!strcmp(v3, "POSIX")))) {
if (!default_domain || !*(default_domain))
v2 = a0;
else
v2 = dgettext(default_domain, a0);
if (v2 == a0) {
v1 = sh_xmalloc(a1 + 1, "locale.c", 0x1c0);
strcpy(v1, a0);
if (a2)
*(a2) = a1;
} else {
v0 = strlen(v2);
v1 = sh_xmalloc(v0 + 1, "locale.c", 0x1c8);
strcpy(v1, v2);
if (a2)
*(a2) = v0;
}
v5 = v1;
return v5;
}
v1 = sh_xmalloc(a1 + 1, "locale.c", 0x1b1);
strcpy(v1, a0);
if (a2)
*(a2) = a1;
v5 = v1;
return v5;
}
if (a2)
*(a2) = 0;
v5 = 0;
return v5;
} | bash | angr_sailr |
static void read_dev_mcast(struct ma_info **result_p) {
char buf[256];
FILE *fp = fopen("/proc/net/dev_mcast", "r");
if (!fp)
return;
while (fgets(buf, sizeof(buf), fp)) {
char hexa[256];
struct ma_info m = {.addr.family = 17};
int len;
int st;
sscanf(buf, "%d%s%d%d%s", &m.index, m.name, &m.users, &st, hexa);
if (filter.dev && strcmp(filter.dev, m.name))
continue;
len = parse_hex(hexa, (unsigned char *)&m.addr.data, sizeof(m.addr.data));
if (len >= 0) {
struct ma_info *ma = malloc(sizeof(m));
memcpy(ma, &m, sizeof(m));
ma->addr.bytelen = len;
ma->addr.bitlen = len << 3;
if (st)
ma->features = "static";
maddr_ins(result_p, ma);
}
}
fclose(fp);
} | void read_dev_mcast(unsigned long long a0) {
unsigned long long v0;
char v1;
unsigned int v2;
void *v3;
struct_0 *v4;
void *v5;
char v6;
char v7;
char v8;
unsigned short v9;
char v10;
char v11;
char v12;
char v13;
unsigned long long v15;
unsigned long long *v16;
unsigned long v17;
unsigned long long *v18;
unsigned long long v19;
v0 = a0;
v3 = fopen64("/proc/net/dev_mcast", "r");
if (v3) {
while (fgets(&v11, 0x100, v3)) {
v15 = 38;
for (v16 = &v5; v15; v16 = &v16[v17]) {
v15 -= 1;
v5 = 0;
}
v9 = 17;
__isoc99_sscanf(&v11, "%d%s%d%d%s", &v6, &v8, &v7, &v1, &v12);
if (!filter || !strcmp(filter, &v8)) {
v2 = parse_hex(&v12, &v10, 0x100);
if (v2 >= 0) {
v4 = malloc(0x130);
memcpy(v4, &v5, 0x130);
v4->field_2a = v2;
v4->field_2c = v2 * 8;
if (*(&v1))
v4->field_10 = "static";
maddr_ins(v0, v4);
}
}
}
fclose(v3);
}
v19 = *(&v13) ^ v18[5];
return;
} | iproute2-6.0.0 | angr_sailr |
static int get_range(bitstr_t *bits, int low, int high, const char *names[],
FILE *file) {
int ch, i, num1, num2, num3;
num3 = 1;
range_state_t state = R_START;
while (state != R_FINISH && ((ch = get_char(file)) != (-1))) {
switch (state) {
case R_START:
if (ch == '*') {
num1 = low;
num2 = high;
state = R_AST;
break;
}
if (ch == '~') {
num1 = low;
state = R_RANDOM;
break;
}
unget_char(ch, file);
if (get_number(&num1, low, names, file) != (-1)) {
state = R_NUM1;
break;
}
return ((-1));
case R_AST:
if (ch == '/') {
state = R_STEP;
break;
}
if (is_separator(ch)) {
state = R_FINISH;
break;
}
return ((-1));
case R_STEP:
unget_char(ch, file);
if (get_number(&num3, 0, ((const char **)((void *)0)), file) != (-1)
&& num3 != 0) {
state = R_TERMS;
break;
}
return ((-1));
case R_TERMS:
if (is_separator(ch)) {
state = R_FINISH;
break;
}
return ((-1));
case R_NUM1:
if (ch == '-') {
state = R_RANGE;
break;
}
if (ch == '~') {
state = R_RANDOM;
break;
}
if (is_separator(ch)) {
num2 = num1;
state = R_FINISH;
break;
}
return ((-1));
case R_RANGE:
unget_char(ch, file);
if (get_number(&num2, low, names, file) != (-1)) {
state = R_RANGE_NUM2;
break;
}
return ((-1));
case R_RANGE_NUM2:
if (ch == '/') {
state = R_STEP;
break;
}
if (is_separator(ch)) {
state = R_FINISH;
break;
}
return ((-1));
case R_RANDOM:
if (is_separator(ch)) {
num2 = high;
state = R_FINISH;
} else if (unget_char(ch, file),
get_number(&num2, low, names, file) != (-1)) {
state = R_TERMS;
}
else
return ((-1));
if (num1 > num2)
return ((-1));
num1 = num2 = random() % (num2 - num1 + 1) + num1;
break;
default:
return ((-1));
}
}
if (state != R_FINISH || ch == (-1))
return ((-1));
for (i = num1; i <= num2; i += num3)
if ((-1) == set_element(bits, low, high, i)) {
unget_char(ch, file);
return ((-1));
}
return ch;
} | int get_range(unsigned long long a0, unsigned long a1, unsigned long a2,
unsigned long long a3, unsigned long long a4) {
unsigned int v0;
unsigned int v1;
unsigned int v2;
unsigned long long v3;
unsigned int v4;
unsigned int v5;
unsigned int v8;
v2 = 1;
v5 = 0;
while (v5 != 9 && (*(&v3) = get_char(a4), v3 != -1)) {
switch (v5) {
case 0:
switch (v3) {
case 42:
v0 = a1;
v1 = a2;
v5 = 1;
break;
case 126:
v0 = a1;
v5 = 7;
break;
default:
unget_char(v3, a4, a4);
if (get_number(&v0, a1, a3, a4) == -1) {
v8 = -1;
return v8;
}
v5 = 4;
break;
}
case 1:
if (v3 == 47) {
v5 = 2;
break;
} else if (is_separator(v3)) {
v5 = 9;
break;
} else {
v8 = -1;
return v8;
}
case 2:
unget_char(v3, a4, a4);
if (get_number(&v2, 0, 0, a4) == -1) {
v8 = -1;
return v8;
}
if (!v2) {
v8 = -1;
return v8;
}
v5 = 3;
break;
case 3:
if (is_separator(v3)) {
v5 = 9;
break;
} else {
v8 = -1;
return v8;
}
case 4:
switch (v3) {
case 45:
v5 = 5;
break;
case 126:
v5 = 7;
break;
default:
if (is_separator(v3)) {
v1 = v0;
v5 = 9;
break;
} else {
v8 = -1;
return v8;
}
}
case 5:
unget_char(v3, a4, a4);
if (get_number(&v1, a1, a3, a4) == -1) {
v8 = -1;
return v8;
}
v5 = 6;
break;
case 6:
if (v3 == 47) {
v5 = 2;
break;
} else if (is_separator(v3)) {
v5 = 9;
break;
} else {
v8 = -1;
return v8;
}
case 7:
if (is_separator(v3)) {
v1 = a2;
v5 = 9;
} else {
unget_char(v3, a4, a4);
if (get_number(&v1, a1, a3, a4) == -1) {
v8 = -1;
return v8;
}
v5 = 3;
}
if (v0 > v1) {
v8 = -1;
return v8;
}
v8 = random();
v1 = v0 + ((v8 >> 63 CONCAT v8) / m(v1 - v0 + 1) >> 64);
v0 = v1;
break;
default:
v8 = -1;
return v8;
}
}
if (v5 != 9) {
v8 = -1;
return v8;
}
if (v3 == -1) {
v8 = -1;
return v8;
}
v4 = v0;
while (true) {
if (v4 > v1) {
v8 = v3;
return v8;
} else if (set_element(a0, a1, a2, v4) != -1) {
v4 += v2;
} else {
unget_char(v3, a4, a4);
v8 = -1;
return v8;
}
}
} | cronie | angr_sailr |
int compress2(dest, destLen, source, sourceLen, level)
Bytef *dest;
uLongf *destLen;
const Bytef *source;
uLong sourceLen;
int level;
{
z_stream stream;
int err;
const uInt max = (uInt)-1;
uLong left;
left = *destLen;
*destLen = 0;
stream.zalloc = (alloc_func)0;
stream.zfree = (free_func)0;
stream.opaque = (voidpf)0;
err = deflateInit_((&stream), (level), "1.2.13", (int)sizeof(z_stream));
if (err != 0)
return err;
stream.next_out = dest;
stream.avail_out = 0;
stream.next_in = (Bytef *)source;
stream.avail_in = 0;
do {
if (stream.avail_out == 0) {
stream.avail_out = left > (uLong)max ? max : (uInt)left;
left -= stream.avail_out;
}
if (stream.avail_in == 0) {
stream.avail_in = sourceLen > (uLong)max ? max : (uInt)sourceLen;
sourceLen -= stream.avail_in;
}
err = deflate(&stream, sourceLen ? 0 : 4);
} while (err == 0);
*destLen = stream.total_out;
deflateEnd(&stream);
return err == 1 ? 0 : err;
} | long compress2(long a1, unsigned long *a2, long a3, unsigned long a4,
unsigned int a5) {
unsigned int v6;
unsigned int v7;
unsigned int v8;
unsigned int v11;
unsigned int v12;
unsigned long v13;
long v14;
unsigned int v15;
long v16;
unsigned int v17;
unsigned long v18;
long v19;
long v20;
long v21;
unsigned long v22;
v22 = __readfsqword(0x28u);
v13 = *a2;
*a2 = 0LL;
v19 = 0LL;
v20 = 0LL;
v21 = 0LL;
v11 = deflateInit_(&v14, a5, "1.2.13", 112LL);
if (v11)
return v11;
v16 = a1;
v17 = 0;
v14 = a3;
v15 = 0;
do {
if (!v17) {
if (v13 > 0xFFFFFFFF)
v6 = -1;
else
v6 = v13;
v17 = v6;
v13 -= v6;
}
if (!v15) {
if (a4 > 0xFFFFFFFF)
v7 = -1;
else
v7 = a4;
v15 = v7;
a4 -= v7;
}
if (a4)
v8 = 0;
else
v8 = 4;
v12 = deflate(&v14, v8);
} while (!v12);
*a2 = v18;
deflateEnd(&v14);
if (v12 == 1)
return 0LL;
else
return v12;
} | zlib | ida |
static void channel_post_mux_client(struct ssh *ssh, Channel *c) {
channel_post_mux_client_read(ssh, c);
channel_post_mux_client_write(ssh, c);
} | long long channel_post_mux_client(unsigned long long a0, void *a1) {
channel_post_mux_client_read(a0, a1);
return channel_post_mux_client_write(a0, a1);
} | openssh-portable | angr_phoenix |
literal_end(EditLine *el) { literal_clear(el); } | long long literal_end(unsigned int a0) { return literal_clear(a0); } | libedit | angr_sailr |
int acl_cmp(acl_t acl1, acl_t acl2) {
acl_obj *acl1_obj_p = ((acl_obj *)__ext2int_and_check(acl1, (0x712C))),
*acl2_obj_p = ((acl_obj *)__ext2int_and_check(acl2, (0x712C)));
acl_entry_obj *p1_obj_p, *p2_obj_p;
if (!acl1_obj_p || !acl2_obj_p)
return -1;
if (acl1_obj_p->i.a_used != acl2_obj_p->i.a_used)
return 1;
p2_obj_p = acl2_obj_p->i.a_next;
for ((p1_obj_p) = (acl1_obj_p)->i.a_next;
(p1_obj_p) != (acl_entry_obj *)(acl1_obj_p);
(p1_obj_p) = (p1_obj_p)->i.e_next) {
if (p1_obj_p->i.e_entry.e_tag != p2_obj_p->i.e_entry.e_tag)
return 1;
if (!((p1_obj_p->i.e_entry.e_perm).i.s_perm ==
(p2_obj_p->i.e_entry.e_perm).i.s_perm))
return 1;
switch (p1_obj_p->i.e_entry.e_tag) {
case (0x02):
case (0x08):
if (((p1_obj_p->i.e_entry.e_id).i.q_id) !=
((p2_obj_p->i.e_entry.e_id).i.q_id))
return 1;
}
p2_obj_p = p2_obj_p->i.e_next;
}
return 0;
} | long acl_cmp(long a1, long a2) {
int v3;
long i;
long v5;
long v6;
long v7;
v6 = _ext2int_and_check(a1, 28972LL);
v7 = _ext2int_and_check(a2, 28972LL);
if (!v6 || !v7)
return 0xFFFFFFFFLL;
if (*(_QWORD *)(v6 + 48) != *(_QWORD *)(v7 + 48))
return 1LL;
v5 = *(_QWORD *)(v7 + 16);
for (i = *(_QWORD *)(v6 + 16); i != v6; i = *(_QWORD *)(i + 16)) {
if (*(_DWORD *)(i + 32) != *(_DWORD *)(v5 + 32))
return 1LL;
if (*(_DWORD *)(i + 64) != *(_DWORD *)(v5 + 64))
return 1LL;
v3 = *(_DWORD *)(i + 32);
if ((v3 == 2 || v3 == 8) && *(_DWORD *)(i + 48) != *(_DWORD *)(v5 + 48))
return 1LL;
v5 = *(_QWORD *)(v5 + 16);
}
return 0LL;
} | acl-2.3.1 | ida |
int unvis(char *cp, int c, int *astate, int flag) {
unsigned char uc = (unsigned char)c;
unsigned char st, ia, is, lc;
;
;
st = ((*astate) & 0xff);
if (flag & 0x0800) {
switch (st) {
case 5:
case 6:
case 9:
*astate = (((uint32_t)(0) << 24) | (0));
return 1;
case 0:
return 3;
default:
return -1;
}
}
switch (st) {
case 0:
*cp = 0;
if ((flag & 0x0400) == 0 && c == '\\') {
*astate = (((uint32_t)(0) << 24) | (1));
return 3;
}
if ((flag & 0x0080) && c == '%') {
*astate = (((uint32_t)(0) << 24) | (8));
return 3;
}
if ((flag & 0x0200) && c == '&') {
*astate = (((uint32_t)(0) << 24) | (13));
return 3;
}
if ((flag & 0x0100) && c == '=') {
*astate = (((uint32_t)(0) << 24) | (10));
return 3;
}
*cp = c;
return 1;
case 1:
switch (c) {
case '\\':
*cp = c;
*astate = (((uint32_t)(0) << 24) | (0));
return 1;
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
*cp = (c - '0');
*astate = (((uint32_t)(0) << 24) | (5));
return 3;
case 'M':
*cp = (char)0200;
*astate = (((uint32_t)(0) << 24) | (2));
return 3;
case '^':
*astate = (((uint32_t)(0) << 24) | (4));
return 3;
case 'n':
*cp = '\n';
*astate = (((uint32_t)(0) << 24) | (0));
return 1;
case 'r':
*cp = '\r';
*astate = (((uint32_t)(0) << 24) | (0));
return 1;
case 'b':
*cp = '\b';
*astate = (((uint32_t)(0) << 24) | (0));
return 1;
case 'a':
*cp = '\007';
*astate = (((uint32_t)(0) << 24) | (0));
return 1;
case 'v':
*cp = '\v';
*astate = (((uint32_t)(0) << 24) | (0));
return 1;
case 't':
*cp = '\t';
*astate = (((uint32_t)(0) << 24) | (0));
return 1;
case 'f':
*cp = '\f';
*astate = (((uint32_t)(0) << 24) | (0));
return 1;
case 's':
*cp = ' ';
*astate = (((uint32_t)(0) << 24) | (0));
return 1;
case 'E':
*cp = '\033';
*astate = (((uint32_t)(0) << 24) | (0));
return 1;
case 'x':
*astate = (((uint32_t)(0) << 24) | (7));
return 3;
case '\n':
*astate = (((uint32_t)(0) << 24) | (0));
return 3;
case '$':
*astate = (((uint32_t)(0) << 24) | (0));
return 3;
default:
if (((*__ctype_b_loc())[(int)((c))] & (unsigned short int)_ISgraph)) {
*cp = c;
*astate = (((uint32_t)(0) << 24) | (0));
return 1;
}
}
goto bad;
case 2:
if (c == '-')
*astate = (((uint32_t)(0) << 24) | (3));
else if (c == '^')
*astate = (((uint32_t)(0) << 24) | (4));
else
goto bad;
return 3;
case 3:
*astate = (((uint32_t)(0) << 24) | (0));
*cp |= c;
return 1;
case 4:
if (c == '?')
*cp |= 0177;
else
*cp |= c & 037;
*astate = (((uint32_t)(0) << 24) | (0));
return 1;
case 5:
if ((((unsigned char)(uc)) >= '0' && ((unsigned char)(uc)) <= '7')) {
*cp = (*cp << 3) + (c - '0');
*astate = (((uint32_t)(0) << 24) | (6));
return 3;
}
*astate = (((uint32_t)(0) << 24) | (0));
return 2;
case 6:
*astate = (((uint32_t)(0) << 24) | (0));
if ((((unsigned char)(uc)) >= '0' && ((unsigned char)(uc)) <= '7')) {
*cp = (*cp << 3) + (c - '0');
return 1;
}
return 2;
case 7:
if (!((*__ctype_b_loc())[(int)((uc))] & (unsigned short int)_ISxdigit))
goto bad;
case 8:
if (((*__ctype_b_loc())[(int)((uc))] & (unsigned short int)_ISxdigit)) {
*cp = (((*__ctype_b_loc())[(int)((uc))] & (unsigned short int)_ISdigit)
? (uc - '0')
: ((tolower(uc) - 'a') + 10));
*astate = (((uint32_t)(0) << 24) | (9));
return 3;
}
*astate = (((uint32_t)(0) << 24) | (0));
return 2;
case 9:
*astate = 0;
if (((*__ctype_b_loc())[(int)((uc))] & (unsigned short int)_ISxdigit)) {
*cp = (((*__ctype_b_loc())[(int)((uc))] & (unsigned short int)_ISdigit)
? (uc - '0')
: ((tolower(uc) - 'a') + 10)) |
(*cp << 4);
return 1;
}
return 2;
case 10:
if (uc == '\n' || uc == '\r') {
*astate = (((uint32_t)(0) << 24) | (12));
return 3;
}
if (((*__ctype_b_loc())[(int)((uc))] & (unsigned short int)_ISxdigit) &&
(((*__ctype_b_loc())[(int)((uc))] & (unsigned short int)_ISdigit) ||
((*__ctype_b_loc())[(int)((uc))] & (unsigned short int)_ISupper))) {
*cp = (((*__ctype_b_loc())[(int)((uc))] & (unsigned short int)_ISdigit)
? (uc - '0')
: ((uc - 'A') + 10));
*astate = (((uint32_t)(0) << 24) | (11));
return 3;
}
goto bad;
case 11:
if (((*__ctype_b_loc())[(int)((uc))] & (unsigned short int)_ISxdigit) &&
(((*__ctype_b_loc())[(int)((uc))] & (unsigned short int)_ISdigit) ||
((*__ctype_b_loc())[(int)((uc))] & (unsigned short int)_ISupper))) {
*astate = (((uint32_t)(0) << 24) | (0));
*cp = (((*__ctype_b_loc())[(int)((uc))] & (unsigned short int)_ISdigit)
? (uc - '0')
: ((uc - 'A') + 10)) |
(*cp << 4);
return 1;
}
goto bad;
case 12:
switch (uc) {
case '\r':
case '\n':
return 3;
case '=':
*astate = (((uint32_t)(0) << 24) | (10));
return 3;
default:
*cp = uc;
*astate = (((uint32_t)(0) << 24) | (0));
return 1;
}
case 13:
*cp = 0;
if (uc == '#') {
*astate = (((uint32_t)(0) << 24) | (14));
return 3;
}
*astate = (((uint32_t)(0) << 24) | (15));
case 15:
ia = *cp;
is = ((uint32_t)(*astate) >> 24);
lc = is == 0 ? 0 : nv[ia].name[is - 1];
if (uc == ';')
uc = '\0';
for (; ia < (sizeof(nv) / sizeof(nv[0])); ia++) {
if (is != 0 && nv[ia].name[is - 1] != lc)
goto bad;
if (nv[ia].name[is] == uc)
break;
}
if (ia == (sizeof(nv) / sizeof(nv[0])))
goto bad;
if (uc != 0) {
*cp = ia;
*astate = (((uint32_t)(is + 1) << 24) | (15));
return 3;
}
*cp = nv[ia].value;
*astate = (((uint32_t)(0) << 24) | (0));
return 1;
case 14:
if (uc == ';')
return 1;
if (!((*__ctype_b_loc())[(int)((uc))] & (unsigned short int)_ISdigit))
goto bad;
*cp += (*cp * 10) + uc - '0';
return 3;
default:
bad:
*astate = (((uint32_t)(0) << 24) | (0));
return -1;
}
} | long unvis(unsigned char *a1, int a2, int *a3, short a4) {
long result;
unsigned char v5;
int v6;
unsigned char v7;
char v8;
unsigned char v9;
unsigned char v11;
unsigned char v12;
unsigned char v13;
unsigned char v14;
v11 = a2;
v13 = *a3;
if ((a4 & 0x800) != 0) {
if (v13 == 9) {
LABEL_6:
*a3 = 0;
return 1LL;
}
if (v13 <= 9u) {
if (!v13)
return 3LL;
if ((unsigned int)v13 - 5 <= 1)
goto LABEL_6;
}
return 0xFFFFFFFFLL;
} else {
switch (v13) {
case 0u:
*a1 = 0;
if ((a4 & 0x400) != 0 || a2 != 92) {
if ((a4 & 0x80) != 0 && a2 == 37) {
*a3 = 8;
return 3LL;
} else if ((a4 & 0x200) != 0 && a2 == 38) {
*a3 = 13;
return 3LL;
} else if ((a4 & 0x100) != 0 && a2 == 61) {
*a3 = 10;
return 3LL;
} else {
*a1 = a2;
return 1LL;
}
} else {
*a3 = 1;
return 3LL;
}
case 1u:
switch (a2) {
case 10:
*a3 = 0;
result = 3LL;
break;
case 36:
*a3 = 0;
result = 3LL;
break;
case 48:
case 49:
case 50:
case 51:
case 52:
case 53:
case 54:
case 55:
*a1 = a2 - 48;
*a3 = 5;
result = 3LL;
break;
case 69:
*a1 = 27;
*a3 = 0;
result = 1LL;
break;
case 77:
*a1 = 0x80;
*a3 = 2;
result = 3LL;
break;
case 92:
*a1 = a2;
*a3 = 0;
result = 1LL;
break;
case 94:
*a3 = 4;
result = 3LL;
break;
case 97:
*a1 = 7;
*a3 = 0;
result = 1LL;
break;
case 98:
*a1 = 8;
*a3 = 0;
result = 1LL;
break;
case 102:
*a1 = 12;
*a3 = 0;
result = 1LL;
break;
case 110:
*a1 = 10;
*a3 = 0;
result = 1LL;
break;
case 114:
*a1 = 13;
*a3 = 0;
result = 1LL;
break;
case 115:
*a1 = 32;
*a3 = 0;
result = 1LL;
break;
case 116:
*a1 = 9;
*a3 = 0;
result = 1LL;
break;
case 118:
*a1 = 11;
*a3 = 0;
result = 1LL;
break;
case 120:
*a3 = 7;
result = 3LL;
break;
default:
if (((*_ctype_b_loc())[a2] & 0x8000u) == 0)
goto LABEL_118;
*a1 = a2;
*a3 = 0;
result = 1LL;
break;
}
return result;
case 2u:
if (a2 == 45) {
*a3 = 3;
} else {
if (a2 != 94)
goto LABEL_118;
*a3 = 4;
}
return 3LL;
case 3u:
*a3 = 0;
*a1 |= a2;
return 1LL;
case 4u:
if (a2 == 63)
*a1 |= 0x7Fu;
else
*a1 |= a2 & 0x1F;
*a3 = 0;
return 1LL;
case 5u:
if ((unsigned char)a2 <= 0x2Fu || (unsigned char)a2 > 0x37u) {
*a3 = 0;
return 2LL;
} else {
*a1 = a2 + 8 * *a1 - 48;
*a3 = 6;
return 3LL;
}
case 6u:
*a3 = 0;
if ((unsigned char)a2 <= 0x2Fu || (unsigned char)a2 > 0x37u)
return 2LL;
*a1 = a2 + 8 * *a1 - 48;
return 1LL;
case 7u:
if (((*_ctype_b_loc())[(unsigned char)a2] & 0x1000) == 0)
goto LABEL_118;
goto LABEL_61;
case 8u:
LABEL_61:
if (((*_ctype_b_loc())[(unsigned char)a2] & 0x1000) != 0) {
if (((*_ctype_b_loc())[(unsigned char)a2] & 0x800) != 0)
v5 = a2 - 48;
else
v5 = tolower((unsigned char)a2) - 87;
*a1 = v5;
*a3 = 9;
return 3LL;
} else {
*a3 = 0;
return 2LL;
}
case 9u:
*a3 = 0;
if (((*_ctype_b_loc())[(unsigned char)a2] & 0x1000) == 0)
return 2LL;
if (((*_ctype_b_loc())[(unsigned char)a2] & 0x800) != 0)
LOBYTE(v6) = a2 - 48;
else
v6 = tolower((unsigned char)a2) - 87;
*a1 = (16 * *a1) | v6;
return 1LL;
case 0xAu:
if ((_BYTE)a2 == 10 || (_BYTE)a2 == 13) {
*a3 = 12;
return 3LL;
}
if (((*_ctype_b_loc())[(unsigned char)a2] & 0x1000) == 0 ||
((*_ctype_b_loc())[(unsigned char)a2] & 0x800) == 0 &&
((*_ctype_b_loc())[(unsigned char)a2] & 0x100) == 0) {
goto LABEL_118;
}
if (((*_ctype_b_loc())[(unsigned char)a2] & 0x800) != 0)
v7 = a2 - 48;
else
v7 = a2 - 55;
*a1 = v7;
*a3 = 11;
return 3LL;
case 0xBu:
if (((*_ctype_b_loc())[(unsigned char)a2] & 0x1000) == 0 ||
((*_ctype_b_loc())[(unsigned char)a2] & 0x800) == 0 &&
((*_ctype_b_loc())[(unsigned char)a2] & 0x100) == 0) {
goto LABEL_118;
}
*a3 = 0;
if (((*_ctype_b_loc())[(unsigned char)a2] & 0x800) != 0)
v8 = a2 - 48;
else
v8 = a2 - 55;
*a1 = (16 * *a1) | v8;
return 1LL;
case 0xCu:
if ((unsigned char)a2 == 61) {
*a3 = 10;
return 3LL;
} else if ((unsigned char)a2 <= 0x3Du &&
((unsigned char)a2 == 10 || (unsigned char)a2 == 13)) {
return 3LL;
} else {
*a1 = a2;
*a3 = 0;
return 1LL;
}
case 0xDu:
*a1 = 0;
if ((_BYTE)a2 == 35) {
*a3 = 14;
return 3LL;
}
*a3 = 15;
LABEL_100:
v12 = *a1;
v14 = HIBYTE(*a3);
if (v14)
v9 = nv[8 * v12 - 1 + v14];
else
v9 = 0;
if ((_BYTE)a2 == 59)
v11 = 0;
while (v12 <= 0x63u) {
if (v14 && nv[8 * v12 - 1 + v14] != v9)
goto LABEL_118;
if (nv[8 * v12 + v14] != v11) {
++v12;
continue;
}
break;
}
if (v12 == 100)
goto LABEL_118;
if (v11) {
*a1 = v12;
*a3 = ((v14 + 1) << 24) | 0xF;
result = 3LL;
} else {
*a1 = byte_C87[8 * v12];
*a3 = 0;
result = 1LL;
}
break;
case 0xEu:
if ((_BYTE)a2 == 59) {
result = 1LL;
} else if (((*_ctype_b_loc())[(unsigned char)a2] & 0x800) != 0) {
*a1 = *a1 + 10 * *a1 + a2 - 48;
result = 3LL;
} else {
LABEL_118:
*a3 = 0;
result = 0xFFFFFFFFLL;
}
break;
case 0xFu:
goto LABEL_100;
default:
goto LABEL_118;
}
}
return result;
} | libbsd-0.11.7 | ida |
sshbuf_get_bignum2(sigbuf, &sig_s) != 0) {
ret = -4;
goto out;
} | void sshbuf_get_bignum2(void)
{
halt_baddata();
} | openssh-portable | ghidra |
static _Bool
errno_unsupported(int err) {
return (err == 22 || err == 38 || is_ENOTSUP(err));
} | int errno_unsupported(unsigned long a0) {
unsigned int v1;
unsigned int v2;
if (a0 == 22) {
LABEL_40483e:
v1 = 1;
} else {
if (a0 == 38)
goto LABEL_40483e;
if (!(!is_ENOTSUP(a0)))
goto LABEL_40483e;
v1 = 0;
}
v2 = v1 & 1;
return v2;
} | coreutils | angr_phoenix |
char *savestring(const char *s) {
char *ret;
ret = (char *)xmalloc(strlen(s) + 1);
strcpy(ret, s);
return ret;
} | long long savestring(char *a0) {
char *v0;
v0 = xmalloc(strlen(a0) + 1);
strcpy(v0, a0);
return v0;
} | bash | angr_dream |
void describedepcon(struct varbuf *addto, struct dependency *dep) {
struct varbuf depstr = {0, 0, ((void *)0)};
varbufdependency(&depstr, dep);
varbuf_end_str(&depstr);
switch (dep->type) {
case dep_depends:
varbuf_printf(addto, gettext("%s depends on %s"),
pkg_name(dep->up, pnaw_nonambig), depstr.buf);
break;
case dep_predepends:
varbuf_printf(addto, gettext("%s pre-depends on %s"),
pkg_name(dep->up, pnaw_nonambig), depstr.buf);
break;
case dep_recommends:
varbuf_printf(addto, gettext("%s recommends %s"),
pkg_name(dep->up, pnaw_nonambig), depstr.buf);
break;
case dep_suggests:
varbuf_printf(addto, gettext("%s suggests %s"),
pkg_name(dep->up, pnaw_nonambig), depstr.buf);
break;
case dep_breaks:
varbuf_printf(addto, gettext("%s breaks %s"),
pkg_name(dep->up, pnaw_nonambig), depstr.buf);
break;
case dep_conflicts:
varbuf_printf(addto, gettext("%s conflicts with %s"),
pkg_name(dep->up, pnaw_nonambig), depstr.buf);
break;
case dep_enhances:
varbuf_printf(addto, gettext("%s enhances %s"),
pkg_name(dep->up, pnaw_nonambig), depstr.buf);
break;
default:
do_internerr("depcon.c", 277, __func__, "unknown deptype '%d'", dep->type);
}
varbuf_destroy(&depstr);
} | unsigned long describedepcon(long a1, _QWORD *a2) {
long v2;
long v3;
char *v4;
long v5;
long v6;
char *v7;
long v8;
long v9;
char *v10;
long v11;
long v12;
char *v13;
long v14;
long v15;
char *v16;
long v17;
long v18;
char *v19;
long v20;
long v21;
char *v22;
long v24[2];
long v25;
unsigned long v26;
v26 = __readfsqword(0x28u);
v24[0] = 0LL;
v24[1] = 0LL;
v25 = 0LL;
varbufdependency(v24, a2);
varbuf_end_str(v24);
switch (*((_DWORD *)a2 + 6)) {
case 0:
v11 = v25;
v12 = pkg_name(*a2, 1LL);
v13 = gettext("%s suggests %s");
varbuf_printf(a1, v13, v12, v11);
break;
case 1:
v8 = v25;
v9 = pkg_name(*a2, 1LL);
v10 = gettext("%s recommends %s");
varbuf_printf(a1, v10, v9, v8);
break;
case 2:
v2 = v25;
v3 = pkg_name(*a2, 1LL);
v4 = gettext("%s depends on %s");
varbuf_printf(a1, v4, v3, v2);
break;
case 3:
v5 = v25;
v6 = pkg_name(*a2, 1LL);
v7 = gettext("%s pre-depends on %s");
varbuf_printf(a1, v7, v6, v5);
break;
case 4:
v14 = v25;
v15 = pkg_name(*a2, 1LL);
v16 = gettext("%s breaks %s");
varbuf_printf(a1, v16, v15, v14);
break;
case 5:
v17 = v25;
v18 = pkg_name(*a2, 1LL);
v19 = gettext("%s conflicts with %s");
varbuf_printf(a1, v19, v18, v17);
break;
case 8:
v20 = v25;
v21 = pkg_name(*a2, 1LL);
v22 = gettext("%s enhances %s");
varbuf_printf(a1, v22, v21, v20);
break;
default:
do_internerr("depcon.c", 277LL, "describedepcon", "unknown deptype '%d'",
*((unsigned int *)a2 + 6));
break;
}
varbuf_destroy(v24);
return __readfsqword(0x28u) ^ v26;
} | dpkg | ida |
static void parse_chunk(uintmax_t *k_units, uintmax_t *n_units, char *slash) {
*n_units = xdectoumax(slash + 1, 1, (18446744073709551615UL), "",
gettext("invalid number of chunks"), 0);
if (slash != optarg) {
*slash = '\0';
*k_units =
xdectoumax(optarg, 1, *n_units, "", gettext("invalid chunk number"), 0);
}
} | void parse_chunk(undefined8 *param_1, undefined8 *param_2, undefined *param_3)
{
undefined8 uVar1;
uVar1 = gettext("invalid number of chunks");
uVar1 =
xdectoumax(param_3 + 1, 1, 0xffffffffffffffff, &DAT_00104653, uVar1, 0);
*param_2 = uVar1;
if (param_3 != optarg) {
*param_3 = 0;
uVar1 = gettext("invalid chunk number");
uVar1 = xdectoumax(optarg, 1, *param_2, &DAT_00104653, uVar1, 0);
*param_1 = uVar1;
}
return;
} | coreutils | ghidra |
static int run_logger(struct invoke_hook *hook, const char *name) {
pid_t pid;
int p[2];
m_pipe(p);
pid = subproc_fork();
if (pid == 0) {
m_dup2(p[0], 0);
close(1);
close(p[0]);
close(p[1]);
command_shell(hook->command, name);
}
close(p[0]);
return p[1];
} | int run_logger(long param_1, undefined8 param_2)
{
long lVar1;
int iVar2;
long in_FS_OFFSET;
int local_18;
int local_14;
lVar1 = *(long *)(in_FS_OFFSET + 0x28);
m_pipe();
iVar2 = subproc_fork();
if (iVar2 == 0) {
m_dup2(local_18, 0);
close(1);
close(local_18);
close(local_14);
command_shell(*(undefined8 *)(param_1 + 8), param_2);
}
close(local_18);
if (lVar1 != *(long *)(in_FS_OFFSET + 0x28)) {
__stack_chk_fail();
}
return local_14;
} | dpkg | ghidra |
static _Bool
check_rename(struct file *src, struct file *dst) {
file_stat(src);
if (src->stat_state == FILE_STAT_NOFILE)
return 0;
file_stat(dst);
check_writable_dir(src);
check_writable_dir(dst);
if (src->stat_state == FILE_STAT_VALID &&
dst->stat_state == FILE_STAT_VALID &&
!(src->stat.st_dev == dst->stat.st_dev &&
src->stat.st_ino == dst->stat.st_ino))
ohshit(gettext("rename involves overwriting '%s' with\n"
" different file '%s', not allowed"),
dst->name, src->name);
return 1;
} | int check_rename(struct_0 *a0, struct_0 *a1) {
unsigned int v1;
file_stat(a0);
if (a0->field_8 == 2) {
v1 = 0;
return v1;
}
file_stat(a1);
check_writable_dir(a0);
check_writable_dir(a1);
if (a0->field_8 != 1) {
v1 = 1;
return v1;
} else if (a1->field_8 != 1) {
v1 = 1;
return v1;
} else {
if (a0->field_10 == a1->field_10 && a0->field_18 == a1->field_18) {
v1 = 1;
return v1;
}
ohshit(gettext("rename involves overwriting '%s' with\n different file "
"'%s', not allowed"),
a1->field_0, a0->field_0);
v1 = 1;
return v1;
}
} | dpkg | angr_sailr |
static int remove_cmd_completions(list)
WORD_LIST *list;
{
WORD_LIST *l;
int ret;
for (ret = 0, l = list; l; l = l->next) {
if (progcomp_remove(l->word->word) == 0) {
builtin_error(gettext("%s: no completion specification"), l->word->word);
ret = 1;
}
}
return ret;
} | long remove_cmd_completions(long ***a1) {
long v1;
char *v2;
unsigned int v4;
v4 = 0;
while (a1) {
if (!(unsigned int)progcomp_remove(*a1[1])) {
v1 = (long)*a1[1];
v2 = gettext("%s: no completion specification");
builtin_error(v2, v1);
v4 = 1;
}
a1 = (long ***)*a1;
}
return v4;
} | bash | ida |
static void read_rest_of_line(COLUMN *p) {
int c;
FILE *f = p->fp;
while ((c = getc_unlocked(f)) != '\n') {
if (c == '\f') {
if ((c = getc_unlocked(f)) != '\n')
ungetc(c, f);
if (keep_FF)
print_a_FF = 1;
hold_file(p);
break;
} else if (c == (-1)) {
close_file(p);
break;
}
}
} | void read_rest_of_line(unsigned long long *a0) {
unsigned int v0;
void *v1;
unsigned long long v4;
unsigned long long v5;
v1 = *(a0);
do {
v0 = getc_unlocked(v1);
if (v0 == 10)
goto LABEL_4029e1;
if (v0 == 12) {
v0 = getc_unlocked(v1);
if (v0 != 10)
ungetc(v0, v1);
if (keep_FF)
print_a_FF = 1;
v5 = hold_file(a0);
goto LABEL_4029e1;
}
} while (v0 != -1);
v4 = close_file(a0);
LABEL_4029e1:
return;
} | coreutils | angr_phoenix |
int sshpkt_put_u32(struct ssh *ssh, u_int32_t val) {
return sshbuf_put_u32(ssh->state->outgoing_packet, val);
} | long sshpkt_put_u32(long a1, unsigned int a2) {
return sshbuf_put_u32(*(_QWORD *)(*(_QWORD *)a1 + 48LL), a2);
} | openssh-portable | ida |
int acl_equiv_mode(acl_t acl, mode_t *mode_p) {
acl_obj *acl_obj_p = ((acl_obj *)__ext2int_and_check(acl, (0x712C)));
acl_entry_obj *entry_obj_p, *mask_obj_p = ((void *)0);
int not_equiv = 0;
mode_t mode = 0;
if (!acl_obj_p)
return -1;
for ((entry_obj_p) = (acl_obj_p)->i.a_next;
(entry_obj_p) != (acl_entry_obj *)(acl_obj_p);
(entry_obj_p) = (entry_obj_p)->i.e_next) {
switch (entry_obj_p->i.e_entry.e_tag) {
case (0x01):
mode |= (entry_obj_p->i.e_entry.e_perm.i.s_perm &
(((0400 | 0200 | 0100) >> 3) >> 3))
<< 6;
break;
case (0x04):
mode |= (entry_obj_p->i.e_entry.e_perm.i.s_perm &
(((0400 | 0200 | 0100) >> 3) >> 3))
<< 3;
break;
case (0x20):
mode |= (entry_obj_p->i.e_entry.e_perm.i.s_perm &
(((0400 | 0200 | 0100) >> 3) >> 3));
break;
case (0x10):
mask_obj_p = entry_obj_p;
case (0x02):
case (0x08):
not_equiv = 1;
break;
default:
(*__errno_location()) = 22;
return -1;
}
}
if (mode_p) {
if (mask_obj_p)
mode = (mode & ~((0400 | 0200 | 0100) >> 3)) |
((mask_obj_p->i.e_entry.e_perm.i.s_perm &
(((0400 | 0200 | 0100) >> 3) >> 3))
<< 3);
*mode_p = mode;
}
return not_equiv;
} | long long acl_equiv_mode(unsigned long long a0, unsigned int *a1) {
unsigned int v0;
unsigned int v1;
struct_1 *v2;
void *v3;
struct_0 *v4;
unsigned long long v6;
v4 = __ext2int_and_check(a0, 0x712c);
v3 = 0;
v0 = 0;
v1 = 0;
if (!v4) {
v6 = 4294967295;
} else {
v2 = v4->field_10;
while (true) {
if (v2 != v4) {
switch (v2->field_20) {
case 1:
v1 |= (v2->field_40 * 64) & 448;
break;
case 4:
v1 |= (v2->field_40 * 8) & 56;
break;
case 32:
v1 |= v2->field_40 & 7;
break;
case 16:
v3 = v2;
case 2:
case 8:
v0 = 1;
break;
default:
*(__errno_location()) = 22;
v6 = 4294967295;
}
v2 = v2->field_10;
} else {
if (a1) {
if (v3)
v1 = (v3[64] * 8) & 56 | v1 & -57;
*(a1) = v1;
}
v6 = v0;
break;
}
}
}
return v6;
} | acl-2.3.1 | angr_dream |
static void clear_options(struct options_st *options) {
for (size_t i = 0; options->length; i++) {
clear_option(&options->data[i]);
}
} | void clear_options(unsigned long long a0[2]) {
void *v0;
unsigned long long v2;
v0 = 0;
while (true) {
v2 = a0[1];
if (!a0[1])
break;
clear_option(a0[0] + v0 * 16);
v0 += 1;
}
return;
} | gnutls | angr_dream |
static int execute_builtin(builtin, words, flags, subshell)
sh_builtin_func_t *builtin;
WORD_LIST *words;
int flags, subshell;
{
int result, eval_unwind, ignexit_flag;
int isbltinenv, should_keep;
char *error_trap;
error_trap = 0;
should_keep = 0;
if (subshell == 0 && (flags & 0x08) &&
(builtin == eval_builtin || (flags & 0x0800) ||
builtin == source_builtin)) {
begin_unwind_frame("eval_builtin");
unwind_protect_mem((char *)&(exit_immediately_on_error),
sizeof(exit_immediately_on_error));
unwind_protect_mem((char *)&(builtin_ignoring_errexit),
sizeof(builtin_ignoring_errexit));
error_trap = (signal_is_trapped((64 + 1) + 1) &&
signal_is_ignored((64 + 1) + 1) == 0)
? trap_list[(64 + 1) + 1]
: (char *)((void *)0);
if (error_trap) {
error_trap = (char *)strcpy(
sh_xmalloc((1 + strlen(error_trap)), "execute_cmd.c", 4885),
(error_trap));
add_unwind_protect(xfree, error_trap);
add_unwind_protect(set_error_trap, error_trap);
restore_default_signal((64 + 1) + 1);
}
exit_immediately_on_error = 0;
ignexit_flag = builtin_ignoring_errexit;
builtin_ignoring_errexit = 1;
eval_unwind = 1;
} else
eval_unwind = 0;
isbltinenv = (builtin == source_builtin || builtin == eval_builtin ||
builtin == unset_builtin || builtin == mapfile_builtin);
should_keep = isbltinenv && builtin != mapfile_builtin;
if (builtin == fc_builtin || builtin == read_builtin) {
isbltinenv = 1;
should_keep = 0;
}
if (isbltinenv) {
if (subshell == 0)
begin_unwind_frame("builtin_env");
if (temporary_env) {
push_scope(0x08, temporary_env);
if (flags & 0x0800)
should_keep = 0;
if (subshell == 0)
add_unwind_protect(pop_scope, should_keep ? "1" : 0);
temporary_env = (HASH_TABLE *)((void *)0);
}
}
if (subshell == 0 && builtin == eval_builtin) {
if (evalnest_max > 0 && evalnest >= evalnest_max) {
internal_error(gettext("eval: maximum eval nesting level exceeded (%d)"),
evalnest);
evalnest = 0;
jump_to_top_level(2);
}
unwind_protect_mem((char *)&(evalnest), sizeof(evalnest));
evalnest++;
} else if (subshell == 0 && builtin == source_builtin) {
if (sourcenest_max > 0 && sourcenest >= sourcenest_max) {
internal_error(gettext("%s: maximum source nesting level exceeded (%d)"),
this_command_name, sourcenest);
sourcenest = 0;
jump_to_top_level(2);
}
unwind_protect_mem((char *)&(sourcenest), sizeof(sourcenest));
sourcenest++;
}
if (posixly_correct && subshell == 0 && builtin == return_builtin &&
(flags & 0x0800) == 0 && temporary_env) {
begin_unwind_frame("return_temp_env");
add_unwind_protect(merge_temporary_env, (char *)((void *)0));
}
executing_builtin++;
executing_command_builtin |= builtin == command_builtin;
result = ((*builtin)(words->next));
if (posixly_correct && subshell == 0 && builtin == return_builtin &&
temporary_env)
discard_unwind_frame("return_temp_env");
if (subshell == 0 && isbltinenv)
run_unwind_frame("builtin_env");
if (eval_unwind) {
builtin_ignoring_errexit = ignexit_flag;
exit_immediately_on_error = builtin_ignoring_errexit ? 0 : errexit_flag;
if (error_trap) {
set_error_trap(error_trap);
sh_xfree((error_trap), "execute_cmd.c", 4988);
}
discard_unwind_frame("eval_builtin");
}
return (result);
} | long execute_builtin(long (*a1)(_QWORD), _QWORD *a2, short a3, int a4) {
const char *v4;
size_t v5;
char *v6;
_BOOL4 v7;
_BOOL4 v8;
const char *v9;
unsigned int v10;
char *v11;
long v12;
char *v13;
int v14;
int v18;
int v19;
int v20;
_BOOL4 v21;
unsigned int v22;
const char *s;
s = 0LL;
if (!a4 && (a3 & 8) != 0 &&
((char *)a1 == (char *)&eval_builtin || (a3 & 0x800) != 0 ||
(char *)a1 == (char *)&source_builtin)) {
begin_unwind_frame("eval_builtin");
unwind_protect_mem(&exit_immediately_on_error, 4LL);
unwind_protect_mem(&builtin_ignoring_errexit, 4LL);
if (!(unsigned int)signal_is_trapped(66LL) ||
(unsigned int)signal_is_ignored(66LL))
v4 = 0LL;
else
v4 = (const char *)trap_list[66];
s = v4;
if (v4) {
v5 = strlen(v4);
v6 = (char *)sh_xmalloc(v5 + 1, "execute_cmd.c", 4885LL);
s = strcpy(v6, s);
add_unwind_protect(&xfree, s);
add_unwind_protect(&set_error_trap, s);
restore_default_signal(66LL);
}
exit_immediately_on_error = 0;
v19 = builtin_ignoring_errexit;
builtin_ignoring_errexit = 1;
v18 = 1;
} else {
v18 = 0;
}
v7 = (char *)a1 == (char *)&source_builtin ||
(char *)a1 == (char *)&eval_builtin ||
(char *)a1 == (char *)&unset_builtin ||
(char *)a1 == (char *)&mapfile_builtin;
v20 = v7;
v8 = v7 && (char *)a1 != (char *)&mapfile_builtin;
v21 = v8;
if ((char *)a1 == (char *)&fc_builtin ||
(char *)a1 == (char *)&read_builtin) {
v20 = 1;
v21 = 0;
}
if (v20) {
if (!a4)
begin_unwind_frame("builtin_env");
if (temporary_env) {
push_scope(8LL, temporary_env);
if ((a3 & 0x800) != 0)
v21 = 0;
if (!a4) {
if (v21)
v9 = "1";
else
v9 = 0LL;
add_unwind_protect(&pop_scope, v9);
}
temporary_env = 0LL;
}
}
if (a4 || (char *)a1 != (char *)&eval_builtin) {
if (!a4 && (char *)a1 == (char *)&source_builtin) {
if (sourcenest_max > 0 && sourcenest >= sourcenest_max) {
v12 = this_command_name;
v13 = gettext("%s: maximum source nesting level exceeded (%d)");
internal_error(v13, v12);
sourcenest = 0;
jump_to_top_level(2LL);
}
unwind_protect_mem(&sourcenest, 4LL);
++sourcenest;
}
} else {
if (evalnest_max > 0 && evalnest >= evalnest_max) {
v10 = evalnest;
v11 = gettext("eval: maximum eval nesting level exceeded (%d)");
internal_error(v11, v10);
evalnest = 0;
jump_to_top_level(2LL);
}
unwind_protect_mem(&evalnest, 4LL);
++evalnest;
}
if (posixly_correct && !a4 && (char *)a1 == (char *)&return_builtin &&
(a3 & 0x800) == 0 && temporary_env) {
begin_unwind_frame("return_temp_env");
add_unwind_protect(&merge_temporary_env, 0LL);
}
++executing_builtin;
executing_command_builtin |= (char *)a1 == (char *)&command_builtin;
v22 = a1(*a2);
if (posixly_correct && !a4 && (char *)a1 == (char *)&return_builtin &&
temporary_env)
discard_unwind_frame("return_temp_env");
if (!a4 && v20)
run_unwind_frame("builtin_env");
if (v18) {
builtin_ignoring_errexit = v19;
if (v19)
v14 = 0;
else
v14 = errexit_flag;
exit_immediately_on_error = v14;
if (s) {
set_error_trap(s);
sh_xfree(s, "execute_cmd.c", 4988LL);
}
discard_unwind_frame("eval_builtin");
}
return v22;
} | bash | ida |
static void pass1b(e2fsck_t ctx, char *block_buf) {
ext2_filsys fs = ctx->fs;
ext2_ino_t ino = 0;
struct ext2_inode_large inode;
ext2_inode_scan scan;
struct process_block_struct pb;
struct problem_context pctx;
problem_t op;
clear_problem_context(&pctx);
if (!(ctx->options & 0x0002))
fix_problem(ctx, 0x011000, &pctx);
pctx.errcode = ext2fs_open_inode_scan(fs, ctx->inode_buffer_blocks, &scan);
if (pctx.errcode) {
fix_problem(ctx, 0x011004, &pctx);
ctx->flags |= 0x0001;
return;
}
ctx->stashed_inode = EXT2_INODE(&inode);
pb.ctx = ctx;
pb.pctx = &pctx;
pctx.str = "pass1b";
while (1) {
if (ino % (fs->super->s_inodes_per_group * 4) == 1) {
if (e2fsck_mmp_update(fs))
fatal_error(ctx, 0);
}
pctx.errcode = ext2fs_get_next_inode_full(scan, &ino, EXT2_INODE(&inode),
sizeof(inode));
if (pctx.errcode == (2133571394L))
continue;
if (pctx.errcode) {
pctx.ino = ino;
fix_problem(ctx, 0x011004, &pctx);
ctx->flags |= 0x0001;
return;
}
if (!ino)
break;
pctx.ino = ctx->stashed_ino = ino;
if ((ino != 1) && !ext2fs_test_inode_bitmap2(ctx->inode_used_map, ino))
continue;
pb.ino = ino;
pb.dup_blocks = 0;
pb.inode = &inode;
pb.cur_cluster = ~0;
pb.phys_cluster = ~0;
pb.last_blk = 0;
pb.pctx->blk = pb.pctx->blk2 = 0;
if (ext2fs_inode_has_valid_blocks2(fs, EXT2_INODE(&inode)) || (ino == 1))
pctx.errcode = ext2fs_block_iterate3(fs, ino, 8, block_buf,
process_pass1b_block, &pb);
if (ext2fs_has_feature_xattr(fs->super) &&
ext2fs_file_acl_block(fs, EXT2_INODE(&inode))) {
blk64_t blk = ext2fs_file_acl_block(fs, EXT2_INODE(&inode));
process_pass1b_block(fs, &blk, (-5), 0, 0, &pb);
ext2fs_file_acl_block_set(fs, EXT2_INODE(&inode), blk);
}
if (pb.dup_blocks) {
if (ino != 1) {
op = pctx.blk == pctx.blk2 ? 0x011002 : 0x011008;
fix_problem(ctx, op, pb.pctx);
}
end_problem_latch(ctx, 0x0060);
if (ino >= (((fs->super)->s_rev_level == 0) ? 11
: (fs->super)->s_first_ino) ||
ino == 2)
dup_inode_count++;
}
if (pctx.errcode)
fix_problem(ctx, 0x011006, &pctx);
}
ext2fs_close_inode_scan(scan);
e2fsck_use_inode_shortcuts(ctx, 0);
} | void pass1b(struct_0 *a0, unsigned long long a1) {
unsigned int v0;
unsigned int v1;
char v2;
unsigned long long v3;
struct_1 *v4;
struct_0 *v5;
unsigned int v6;
unsigned int v7;
unsigned long long v8;
unsigned long long v9;
void *v10;
unsigned long v11;
unsigned long long v12[7];
unsigned long v13;
unsigned int v14;
char v15;
char v16;
unsigned long long v17;
char v18;
char v19;
unsigned long long v22;
unsigned long long v23;
unsigned long long v25;
unsigned long long v26;
unsigned int v27;
unsigned long long *v28;
unsigned long long v29;
v4 = a0->field_0;
v0 = 0;
clear_problem_context(&v13);
if (!(a0->field_4c & 2))
fix_problem(a0, 0x11000, &v13);
v13 = ext2fs_open_inode_scan(v4, a0->field_25c, &v2, a0->field_25c);
if (v13) {
fix_problem(a0, 0x11004, &v13);
a0->field_48 = a0->field_48 | 1;
} else {
a0->field_220 = EXT2_INODE(&v18);
v5 = a0;
v12[0] = &v13;
v17 = "pass1b";
while (true) {
while (true) {
if ((0 CONCAT v0) / m(v4->field_20->field_28 << 2) >> 32 == 1 &&
e2fsck_mmp_update(v4))
fatal_error(a0, 0x0);
v13 = ext2fs_get_next_inode_full(*(&v2), &v0, EXT2_INODE(&v18), 0xa0);
if (v13 != 2133571394)
break;
}
if (v13) {
v14 = v0;
fix_problem(a0, 0x11004, &v13);
a0->field_48 = a0->field_48 | 1;
break;
} else if (v0) {
a0->field_218 = v0;
v14 = a0->field_218;
if (v0 != 1) {
v22 = ext2fs_test_inode_bitmap2(a0->field_168, v0, v0);
continue;
}
v6 = v0;
v7 = 0;
v11 = &v18;
v8 = -1;
v9 = -1;
v10 = 0;
v12[6] = 0;
v12[5] = v12[6];
v23 = EXT2_INODE(&v18);
if (v0 == 1 || ext2fs_inode_has_valid_blocks2(v4, v23, v23))
v13 =
ext2fs_block_iterate3(v4, v0, 0x8, a1, process_pass1b_block, &v5);
v27 = ext2fs_has_feature_xattr(v4->field_20);
if (v27) {
v25 = EXT2_INODE(&v18);
v27 = ext2fs_file_acl_block(v4, v25, v25);
if (v27) {
v26 = EXT2_INODE(&v18);
v3 = ext2fs_file_acl_block(v4, v26, v26);
process_pass1b_block(v4, &v3, 0xfffffffffffffffb, 0x0, 0x0, &v5);
v27 = EXT2_INODE(&v18);
ext2fs_file_acl_block_set(v4, v27, v3, v27);
}
}
if (v7) {
if (v0 != 1) {
if (*(&v15) == *(&v16))
v27 = 69634;
else
v27 = 69640;
v1 = v27;
fix_problem(a0, v1, v12);
}
end_problem_latch(a0, 0x60);
if (v4->field_20->field_4c)
v27 = v4->field_20->field_54;
else
v27 = 11;
if (v27 <= v0 || v0 == 2)
dup_inode_count = dup_inode_count + 1;
}
if (!v13)
continue;
fix_problem(a0, 0x11006, &v13);
} else {
ext2fs_close_inode_scan(*(&v2));
e2fsck_use_inode_shortcuts(a0, 0x0);
break;
}
}
}
v29 = *(&v19) ^ v28[5];
return;
} | e2fsprogs-1.46.5 | angr_dream |
static void undangle_file_pointers(struct predicate *p) {
if ((((p)->pred_func) == (pred_fprint)) ||
(((p)->pred_func) == (pred_fprintf)) ||
(((p)->pred_func) == (pred_fls)) ||
(((p)->pred_func) == (pred_fprint0))) {
p->args.printf_vec.stream = ((void *)0);
}
} | long long undangle_file_pointers(unsigned long long a0[9]) {
unsigned long long v1[9];
if (a0[0] != got.pred_fprint && a0[0] != got.pred_fprintf &&
a0[0] != got.pred_fls) {
v1 = a0[0];
if (a0[0] != got.pred_fprint0)
return v1;
}
v1 = a0;
a0[8] = 0;
return v1;
} | findutils | angr_sailr |
int sshkey_format_text(const struct sshkey *key, struct sshbuf *b) {
int r = -1;
char *uu = ((void *)0);
if ((r = sshkey_to_base64(key, &uu)) != 0)
goto out;
if ((r = sshbuf_putf(b, "%s %s", sshkey_ssh_name(key), uu)) != 0)
goto out;
r = 0;
out:
free(uu);
return r;
} | int sshkey_format_text(void *a0, unsigned long long a1) {
unsigned int v0;
void *v1;
v0 = -1;
v1 = 0;
v0 = sshkey_to_base64(a0, &v1);
if (!v0) {
v0 = sshbuf_putf(a1, "%s %s", sshkey_ssh_name(a0), v1);
if (!v0)
v0 = 0;
}
free(v1);
return v0;
} | openssh-portable | angr_sailr |
static int channel_handle_efd_read(struct ssh *ssh, Channel *c) {
char buf[(16 * 1024)];
ssize_t len;
int r, force;
force = c->isatty && c->detach_close && c->istate != 3;
if (!force && (c->io_ready & 0x04) == 0)
return 1;
len = read(c->efd, buf, sizeof(buf));
sshlog("channels.c", __func__, 2140, 0, SYSLOG_LEVEL_DEBUG2, ((void *)0),
"channel %d: read %zd from efd %d", c->self, len, c->efd);
if (len == -1 &&
((*__errno_location()) == 4 || (((*__errno_location()) == 11 ||
(*__errno_location()) == 11) &&
!force)))
return 1;
if (len <= 0) {
sshlog("channels.c", __func__, 2145, 0, SYSLOG_LEVEL_DEBUG2, ((void *)0),
"channel %d: closing read-efd %d", c->self, c->efd);
channel_close_fd(ssh, c, &c->efd);
} else if (c->extended_usage == 0)
sshlog("channels.c", __func__, 2148, 0, SYSLOG_LEVEL_DEBUG3, ((void *)0),
"channel %d: discard efd", c->self);
else if ((r = sshbuf_put(c->extended, buf, len)) != 0)
sshfatal("channels.c", __func__, 2150, 1, SYSLOG_LEVEL_FATAL, ssh_err(r),
"channel %i: append", c->self);
return 1;
} | void channel_handle_efd_read(unsigned int a0, struct_0 *a1) {
unsigned int v0;
unsigned int v1;
unsigned long long v2;
char v3;
char v4;
unsigned long long v5;
unsigned long long v6;
unsigned long v7;
unsigned long long v8;
unsigned long v9;
char v10;
unsigned long long *v12;
unsigned int v13;
unsigned long long v14;
unsigned long long v18;
unsigned long long v19;
do {
v5 = v5;
} while (&v5 != &v4);
v6 = v12[5];
if (!a1->field_48 || !a1->field_e8 || a1->field_10 == 3)
v13 = 0;
else
v13 = 1;
v0 = v13;
if (v0 || (a1->field_30 & 4)) {
v2 = read(a1->field_24, &v3, 0x4000);
v9 = a1->field_24;
v8 = v2;
v7 = a1->field_4;
v6 = "channel %d: read %zd from efd %d";
sshlog("channels.c", "channel_handle_efd_read", 0x85c, 0x0, 0x6, 0x0,
*(&v10));
if (v2 != -1) {
LABEL_406f65:
if (v2 <= 0) {
v8 = a1->field_24;
v7 = a1->field_4;
v6 = "channel %d: closing read-efd %d";
sshlog("channels.c", "channel_handle_efd_read", 0x861, 0x0, 0x6, 0x0,
*(&v10));
channel_close_fd(a0, a1, &a1->field_24);
} else if (a1->field_c0) {
v1 = sshbuf_put(a1->field_78, &v3, v2, &v3);
if (v1) {
v9 = a1->field_4;
v8 = "channel %i: append";
sshfatal("channels.c", "channel_handle_efd_read", 0x866, 0x1, 0x1,
ssh_err(v1));
}
} else {
v9 = a1->field_4;
v8 = "channel %d: discard efd";
sshlog("channels.c", "channel_handle_efd_read", 0x864, 0x0, 0x7, 0x0,
*(&v10));
}
v19 = 1;
} else {
if (*(__errno_location()) != 4 &&
(!(*(__errno_location()) == 11) && !(*(__errno_location()) == 11) ||
!(!v0)))
goto LABEL_406f65;
v18 = 1;
}
} else {
v14 = 1;
}
if (!(v6 ^ v12[5]))
return;
__stack_chk_fail();
} | openssh-portable | angr_sailr |
static void syntax_err_report(const char *filename, long err, int line_num) {
fprintf(
stderr,
(gettext("Syntax error in e2fsck config file (%s, line #%d)\n\t%s\n")),
filename, line_num, error_message(err));
exit(8);
} | void syntax_err_report(undefined8 param_1, undefined8 param_2, uint param_3)
{
undefined8 uVar1;
char *__format;
uVar1 = error_message(param_2);
__format = (char *)gettext(
"Syntax error in e2fsck config file (%s, line #%d)\n\t%s\n");
fprintf(stderr, __format, param_1, (ulong)param_3, uVar1);
exit(8);
} | e2fsprogs-1.46.5 | ghidra |
int get_code_sign_status(void) {
if (batch) {
return cfg.code_sign_key;
} else {
return read_yesno("Will the certificate be used to sign code? (y/N): ", 0);
}
} | ulong get_code_sign_status(void)
{
ulong uVar1;
if (*piRam00000000001090bc == 0) {
uVar1 = read_yesno("Will the certificate be used to sign code? (y/N): ", 0);
} else {
uVar1 = (ulong) * (uint *)(lRam00000000001090c9 + 0x248);
}
return uVar1;
} | gnutls | ghidra |
static int getentropy_sysctl(void *buf, size_t len) {
static int mib[] = {CTL_KERN, KERN_RANDOM, RANDOM_UUID};
size_t i;
int save_errno = (*__errno_location());
for (i = 0; i < len;) {
size_t chunk = (((len - i) < (16)) ? (len - i) : (16));
struct __sysctl_args args = {
.name = mib,
.nlen = 3,
.oldval = (char *)buf + i,
.oldlenp = &chunk,
};
if (syscall(156, &args) != 0)
goto sysctlfailed;
i += chunk;
}
if (gotdata(buf, len) == 0) {
(*__errno_location()) = save_errno;
return (0);
}
sysctlfailed:
(*__errno_location()) = 5;
return (-1);
} | undefined8 getentropy_sysctl(long param_1, ulong param_2)
{
int iVar1;
int iVar2;
int *piVar3;
long lVar4;
undefined8 uVar5;
long in_FS_OFFSET;
ulong local_78;
ulong local_70;
undefined1 *local_68;
undefined8 local_60;
long local_58;
ulong *local_50;
undefined8 local_48;
undefined8 local_40;
undefined8 local_38;
undefined8 local_30;
undefined8 local_28;
undefined8 local_20;
long local_10;
local_10 = *(long *)(in_FS_OFFSET + 0x28);
piVar3 = __errno_location();
iVar1 = *piVar3;
for (local_70 = 0; local_70 < param_2; local_70 = local_70 + local_78) {
local_78 = param_2 - local_70;
if (0x10 < local_78) {
local_78 = 0x10;
}
local_48 = 0;
local_40 = 0;
local_38 = 0;
local_30 = 0;
local_28 = 0;
local_20 = 0;
local_68 = mib_6656;
local_60 = 3;
local_58 = local_70 + param_1;
local_50 = &local_78;
lVar4 = syscall(0x9c, &local_68);
if (lVar4 != 0)
goto LAB_00100502;
}
iVar2 = gotdata(param_1, param_2);
if (iVar2 == 0) {
piVar3 = __errno_location();
*piVar3 = iVar1;
uVar5 = 0;
} else {
LAB_00100502:
piVar3 = __errno_location();
*piVar3 = 5;
uVar5 = 0xffffffff;
}
if (local_10 == *(long *)(in_FS_OFFSET + 0x28)) {
return uVar5;
}
__stack_chk_fail();
} | libbsd-0.11.7 | ghidra |
int64_t read_int(const char *input_str) {
return read_int_with_default(input_str, 0);
} | int read_int(unsigned long long a0) { return read_int_with_default(a0, 0x0); } | gnutls | angr_sailr |
static void kwsmusts(struct dfa_comp *dc) {
struct dfamust *dm = dfamust(dc->dfa);
if (!dm)
return;
dc->kwset = kwsinit(0);
if (dm->exact) {
++dc->kwset_exact_matches;
idx_t old_len = strlen(dm->must);
idx_t new_len = old_len + dm->begline + dm->endline;
char *must = ximalloc(new_len);
char *mp = must;
*mp = eolbyte;
mp += dm->begline;
dc->begline |= dm->begline;
memcpy(mp, dm->must, old_len);
if (dm->endline)
mp[old_len] = eolbyte;
kwsincr(dc->kwset, must, new_len);
free(must);
} else {
kwsincr(dc->kwset, dm->must, strlen(dm->must));
}
kwsprep(dc->kwset);
dfamustfree(dm);
} | void kwsmusts(struct_0 *a0) {
char v0[3];
char *v1;
unsigned long long v2;
void *v3;
char *v4;
unsigned long long v7;
*(&v0) = dfamust(a0->field_8);
if (!v0)
return;
a0->field_0 = kwsinit(0x0);
if (v0[0]) {
a0->field_38 = a0->field_38 + 1;
v1 = strlen(v0 + 1);
v2 = &v1[v0[1] + v0[2]];
v3 = ximalloc(v2);
v4 = v3;
*(v4) = eolbyte;
v4 = &v4[v0[1]];
a0->field_40 = (v0[1] | a0->field_40);
memcpy(v4, v0 + 1, v1);
if (v0[2])
*((v1 + v4)) = eolbyte;
kwsincr(a0->field_0, v3, v2, v3);
free(v3);
} else {
kwsincr(a0->field_0, v0 + 1, strlen(v0 + 1), v0 + 1);
}
kwsprep(a0->field_0);
v7 = dfamustfree(v0);
return;
} | grep | angr_sailr |
static int ipaddrlabel_list(int argc, char **argv) {
int af = preferred_family;
if (af == 0)
af = 10;
if (argc > 0) {
fprintf(stderr, "\"ip addrlabel show\" does not take any arguments.\n");
return -1;
}
if (rtnl_addrlbldump_req(&rth, af) < 0) {
perror("Cannot send dump request");
return 1;
}
new_json_obj(json);
if (rtnl_dump_filter_nc(&rth, print_addrlabel, stdout, 0) < 0) {
fprintf(stderr, "Dump terminated\n");
return 1;
}
delete_json_obj();
return 0;
} | void ipaddrlabel_list(unsigned long a0, unsigned long a1) {
unsigned long v0;
unsigned int v1;
unsigned long long v3;
unsigned long long v4;
void *v5;
unsigned long long v6;
v0 = a1;
v1 = preferred_family;
if (!v1)
v1 = 10;
if (a0 > 0) {
fprintf(*(&stderr), "\"ip addrlabel show\" does not take any arguments.\n");
v3 = 4294967295;
} else if (rtnl_addrlbldump_req(0x500070, v1) < 0) {
perror("Cannot send dump request");
v4 = 1;
} else {
new_json_obj(json);
if (rtnl_dump_filter_nc(0x500070, print_addrlabel, stdout, 0x0) >= 0) {
delete_json_obj();
v5 = 0;
} else {
fprintf(*(&stderr), "Dump terminated\n");
v6 = 1;
}
}
return;
} | iproute2-6.0.0 | angr_phoenix |
cron_db database(int installed, char **additional) {
cron_db db = {((void *)0), ((void *)0), (time_t)0};
struct passwd pw;
int fd;
struct stat ss;
user *u;
if (installed)
load_database(&db);
for (; *additional != ((void *)0); additional++) {
fd = open(*additional, 00);
if (fd == -1) {
perror(*additional);
continue;
}
fstat(fd, &ss);
if (((((ss.st_mode)) & 0170000) == (0040000))) {
fprintf(stderr, "%s is a directory - skipping\n", *additional);
close(fd);
continue;
}
memset(&pw, 0, sizeof(pw));
pw.pw_name = *additional;
pw.pw_passwd = "";
pw.pw_dir = ".";
u = load_user(fd, &pw, *additional, *additional, *additional);
if (u == ((void *)0)) {
printf("cannot load crontab %s\n", *additional);
continue;
}
link_user(&db, u);
}
return db;
} | void database(unsigned long long a0[3], unsigned long a1, unsigned long a2) {
unsigned long long *v0;
unsigned int v1;
unsigned long long v2;
void *v3;
void *v4;
void *v5;
unsigned long v6;
unsigned long long v7;
unsigned long long v8;
char v9;
char v10;
unsigned long long v12[3];
v0 = a2;
v3 = 0;
v4 = 0;
v5 = 0;
if (a1)
load_database(&v3);
for (; *(v0); v0 += 1) {
v1 = open(*(v0), 0x0, *(v0));
if (v1 == -1) {
perror(*(v0));
} else {
fstat(v1, &v9);
if ((*(&v10) & 0xf000) == 0x4000) {
fprintf(stderr, "%s is a directory - skipping\n", *(v0));
close(v1);
} else {
memset(&v6, 0x0, 0x30);
v6 = *(v0);
v7 = &g_401244;
v8 = ".";
v2 = load_user(v1, &v6, *(v0), *(v0), *(v0));
if (v2)
link_user(&v3, v2, v2);
else
printf("cannot load crontab %s\n", *(v0));
}
}
}
a0[0] = v3;
a0[1] = v4;
a0[2] = v5;
v12 = a0;
return;
} | cronie | angr_sailr |
rsRetVal logmsgInternal(int iErr, const syslog_pri_t pri,
const uchar *const msg, int flags) {
size_t lenMsg;
unsigned i;
char *bufModMsg = ((void *)0);
rsRetVal iRet = RS_RET_OK;
lenMsg = (strlen((const char *)(msg)));
for (i = 0; i < lenMsg; ++i) {
if (msg[i] < 0x20 || msg[i] == 0x7f) {
if (bufModMsg == ((void *)0)) {
if ((bufModMsg = strdup((char *)msg)) == ((void *)0))
do {
iRet = RS_RET_OUT_OF_MEMORY;
goto finalize_it;
} while (0);
}
bufModMsg[i] = ' ';
}
}
if ((iRet = logmsgInternalSubmit(
iErr, pri, lenMsg,
(bufModMsg == ((void *)0)) ? (char *)msg : bufModMsg, flags)) !=
RS_RET_OK)
goto finalize_it
;
int emit_to_stderr =
(ourConf == ((void *)0)) ? 1 : ourConf->globals.bErrMsgToStderr;
int emit_supress_msg = 0;
if (Debug == 2 || !doFork) {
emit_to_stderr = 1;
}
if (ourConf != ((void *)0) && ourConf->globals.maxErrMsgToStderr != -1) {
if (emit_to_stderr && ourConf->globals.maxErrMsgToStderr != -1 &&
ourConf->globals.maxErrMsgToStderr) {
--ourConf->globals.maxErrMsgToStderr;
if (ourConf->globals.maxErrMsgToStderr == 0)
emit_supress_msg = 1;
} else {
emit_to_stderr = 0;
}
}
if (emit_to_stderr || iConfigVerify) {
if (((pri) & 0x07) == 3)
fprintf(stderr, "rsyslogd: %s\n",
(bufModMsg == ((void *)0)) ? (char *)msg : bufModMsg);
}
if (emit_supress_msg) {
fprintf(stderr, "rsyslogd: configured max number of error messages "
"to stderr reached, further messages will not be output\n"
"Consider adjusting\n"
" global(errorMessagesToStderr.maxNumber=\"xx\")\n"
"if you want more.\n");
}
finalize_it:
free(bufModMsg);
return iRet;
} | void logmsgInternal(unsigned long a0, unsigned long a1, unsigned long a2,
unsigned long a3) {
unsigned int v0;
unsigned int v1;
unsigned int v2;
unsigned int v3;
void *v4;
unsigned long long v5;
unsigned long v7;
unsigned long long v8;
v4 = 0;
v1 = 0;
v5 = strlen(a2);
v0 = 0;
while (true) {
if (v5 > v0) {
if ((*((a2 + v0)) <= 31 || *((a2 + v0)) == 127) && !v4) {
v4 = strdup(a2);
if (!v4) {
v1 = -6;
break;
}
}
if (*((a2 + v0)) == 127 || v4)
*(v4 + v0) = 32;
if (v4)
v0 += 1;
} else {
if (!v4)
v7 = a2;
else
v7 = v4;
v1 = logmsgInternalSubmit(a0, a1, v5, v7, a3);
if (v1)
break;
if (!v1) {
if (ourConf)
*(&v7) = *((ourConf + 40));
else
*(&v7) = 1;
v2 = v7;
v3 = 0;
if (!doFork || Debug == 2)
v2 = 1;
if (ourConf && *((ourConf + 44)) != -1) {
if (v2 && *((ourConf + 44)) != -1 && *((ourConf + 44))) {
*((ourConf + 44)) = *((ourConf + 44)) - 1;
if (!*((ourConf + 44)))
v3 = 1;
}
if (!*((ourConf + 44)) || !v2 || *((ourConf + 44)) == -1)
v2 = 0;
}
if ((iConfigVerify || v2) && (a1 & 7) == 3) {
if (!v4)
*(&v7) = a2;
else
*(&v7) = v4;
fprintf(stderr, "rsyslogd: %s\n", v7);
}
if (!v3)
break;
if (v3) {
fprintf(stderr, "rsyslogd: configured max number of error messages "
"to stderr reached, further messages will not be "
"output\nConsider adjusting\n "
"global(errorMessagesToStderr.maxNumber=\"xx\")\nif "
"you want more.\n");
break;
}
}
}
}
free(v4);
v8 = v1;
return;
} | rsyslog-8.2210.0 | angr_dream |
gl_linked_first_node(gl_list_t list) {
if (list->count > 0)
return list->root.next;
else
return ((void *)0);
} | long gl_linked_first_node(long a1) {
if (*(_QWORD *)(a1 + 64))
return *(_QWORD *)(a1 + 40);
else
return 0LL;
} | gnutls | ida |
HIST_ENTRY *next_history(void) {
HistEvent ev;
if (history_offset >= history_length)
return ((void *)0);
if (history(h, &ev, 4) != 0)
return ((void *)0);
history_offset++;
return current_history();
} | long long next_history() {
char v0;
void *v2;
if (*(got.history_offset) >= *(got.history_length)) {
v2 = 0;
} else if (history(h, &v0, 0x4, &v0)) {
v2 = 0;
} else {
*(got.history_offset) = *(got.history_offset) + 1;
v2 = current_history();
}
return v2;
} | libedit | angr_dream |
static void read_pop(struct macros *ma) {
int i;
free(ma->macro[0]);
for (i = 0; i < ma->level; i++)
ma->macro[i] = ma->macro[i + 1];
ma->level--;
ma->offset = 0;
} | void read_pop(long *param_1)
{
int local_c;
free(*(void **)*param_1);
for (local_c = 0; local_c < *(int *)(param_1 + 1); local_c = local_c + 1) {
*(undefined8 *)((long)local_c * 8 + *param_1) =
*(undefined8 *)(*param_1 + ((long)local_c + 1) * 8);
}
*(int *)(param_1 + 1) = *(int *)(param_1 + 1) + -1;
*(undefined4 *)((long)param_1 + 0xc) = 0;
return;
} | libedit | ghidra |
int rl_history_search_forward(int count, int ignore) {
if (count == 0)
return (0);
if (rl_last_func != rl_history_search_forward &&
rl_last_func != rl_history_search_backward)
rl_history_search_reinit(0x01);
if (_rl_history_search_len == 0)
return (rl_get_next_history(count, ignore));
return (rl_history_search_internal((((count) >= 0) ? (count) : -(count)),
(count > 0) ? 1 : -1));
} | long rl_history_search_forward(int a1, unsigned int a2) {
unsigned int v3;
if (!a1)
return 0LL;
if ((long (*)(int, unsigned int))rl_last_func != rl_history_search_forward &&
(long (*)(int, unsigned int))rl_last_func != rl_history_search_backward) {
rl_history_search_reinit(1);
}
if (!rl_history_search_len)
return rl_get_next_history((unsigned int)a1, a2);
if (a1 <= 0)
v3 = -1;
else
v3 = 1;
return rl_history_search_internal(abs32(a1), v3);
} | bash | ida |
void BZ2_bsInitWrite(EState *s) {
s->bsLive = 0;
s->bsBuff = 0;
} | long BZ2_bsInitWrite(long a1) {
long result;
*(_DWORD *)(a1 + 644) = 0;
result = a1;
*(_DWORD *)(a1 + 640) = 0;
return result;
} | bzip2 | ida |
void BZ2_bzReadClose(int *bzerror, BZFILE *b) {
bzFile *bzf = (bzFile *)b;
{
if (bzerror != ((void *)0))
*bzerror = 0;
if (bzf != ((void *)0))
bzf->lastErr = 0;
};
if (bzf == ((void *)0)) {
{
if (bzerror != ((void *)0))
*bzerror = 0;
if (bzf != ((void *)0))
bzf->lastErr = 0;
};
return;
};
if (bzf->writing) {
{
if (bzerror != ((void *)0))
*bzerror = (-1);
if (bzf != ((void *)0))
bzf->lastErr = (-1);
};
return;
};
if (bzf->initialisedOk)
(void)BZ2_bzDecompressEnd(&(bzf->strm));
free(bzf);
} | void BZ2_bzReadClose(unsigned int *a0, void *a1) {
struct_0 *v0;
unsigned long long v2;
unsigned int *v3;
struct_0 *v4;
unsigned long long v5;
unsigned int *v6;
unsigned int *v7;
unsigned long long v8;
struct_0 *v9;
struct_0 *v10;
v2 = a1;
v0 = a1;
if (a0) {
v3 = a0;
*(a0) = 0;
}
if (v0) {
v4 = v0;
v0->field_13e8 = 0;
}
if (!v0) {
if (a0) {
v6 = a0;
*(a0) = 0;
}
if (v0) {
v9 = v0;
v0->field_13e8 = 0;
}
} else {
v5 = v0->field_1394;
if (v0->field_1394) {
if (a0) {
v7 = a0;
*(a0) = -1;
}
if (v0) {
v10 = v0;
v0->field_13e8 = -1;
}
} else {
if (v0->field_13ec)
BZ2_bzDecompressEnd(&v0->padding_1395[3]);
v8 = free(v0);
}
}
return;
} | bzip2 | angr_dream |
void strmode(int mode, char *p) {
switch (mode & 0170000) {
case 0040000:
*p++ = 'd';
break;
case 0020000:
*p++ = 'c';
break;
case 0060000:
*p++ = 'b';
break;
case 0100000:
*p++ = '-';
break;
case 0120000:
*p++ = 'l';
break;
case 0140000:
*p++ = 's';
break;
case 0010000:
*p++ = 'p';
break;
default:
*p++ = '?';
break;
}
if (mode & 0400)
*p++ = 'r';
else
*p++ = '-';
if (mode & 0200)
*p++ = 'w';
else
*p++ = '-';
switch (mode & (0100 | 04000)) {
case 0:
*p++ = '-';
break;
case 0100:
*p++ = 'x';
break;
case 04000:
*p++ = 'S';
break;
case 0100 | 04000:
*p++ = 's';
break;
}
if (mode & (0400 >> 3))
*p++ = 'r';
else
*p++ = '-';
if (mode & (0200 >> 3))
*p++ = 'w';
else
*p++ = '-';
switch (mode & ((0100 >> 3) | 02000)) {
case 0:
*p++ = '-';
break;
case (0100 >> 3):
*p++ = 'x';
break;
case 02000:
*p++ = 'S';
break;
case (0100 >> 3) | 02000:
*p++ = 's';
break;
}
if (mode & ((0400 >> 3) >> 3))
*p++ = 'r';
else
*p++ = '-';
if (mode & ((0200 >> 3) >> 3))
*p++ = 'w';
else
*p++ = '-';
switch (mode & (((0100 >> 3) >> 3) | 01000)) {
case 0:
*p++ = '-';
break;
case ((0100 >> 3) >> 3):
*p++ = 'x';
break;
case 01000:
*p++ = 'T';
break;
case ((0100 >> 3) >> 3) | 01000:
*p++ = 't';
break;
}
*p++ = ' ';
*p = '\0';
} | void strmode(uint param_1, undefined *param_2)
{
undefined *puVar1;
uint uVar2;
undefined *local_18;
uVar2 = param_1 & 0xf000;
if (uVar2 == 0xc000) {
*param_2 = 0x73;
goto LAB_00100110;
}
if (uVar2 < 0xc001) {
if (uVar2 == 0xa000) {
*param_2 = 0x6c;
goto LAB_00100110;
}
if (uVar2 < 0xa001) {
if (uVar2 == 0x8000) {
*param_2 = 0x2d;
goto LAB_00100110;
}
if (uVar2 < 0x8001) {
if (uVar2 == 0x6000) {
*param_2 = 0x62;
goto LAB_00100110;
}
if (uVar2 < 0x6001) {
if (uVar2 == 0x4000) {
*param_2 = 100;
goto LAB_00100110;
}
if (uVar2 < 0x4001) {
if (uVar2 == 0x1000) {
*param_2 = 0x70;
goto LAB_00100110;
}
if (uVar2 == 0x2000) {
*param_2 = 99;
goto LAB_00100110;
}
}
}
}
}
}
*param_2 = 0x3f;
LAB_00100110:
local_18 = param_2 + 1;
if ((param_1 & 0x100) == 0) {
*local_18 = 0x2d;
} else {
*local_18 = 0x72;
}
local_18 = param_2 + 2;
if ((param_1 & 0x80) == 0) {
*local_18 = 0x2d;
} else {
*local_18 = 0x77;
}
local_18 = param_2 + 3;
uVar2 = param_1 & 0x840;
if (uVar2 == 0x840) {
*local_18 = 0x73;
local_18 = param_2 + 4;
} else if (uVar2 < 0x841) {
if (uVar2 == 0x800) {
*local_18 = 0x53;
local_18 = param_2 + 4;
} else if (uVar2 < 0x801) {
if (uVar2 == 0) {
*local_18 = 0x2d;
local_18 = param_2 + 4;
} else if (uVar2 == 0x40) {
*local_18 = 0x78;
local_18 = param_2 + 4;
}
}
}
puVar1 = local_18;
if ((param_1 & 0x20) == 0) {
*local_18 = 0x2d;
} else {
*local_18 = 0x72;
}
local_18 = local_18 + 1;
if ((param_1 & 0x10) == 0) {
*local_18 = 0x2d;
} else {
*local_18 = 0x77;
}
local_18 = puVar1 + 2;
uVar2 = param_1 & 0x408;
if (uVar2 == 0x408) {
*local_18 = 0x73;
local_18 = puVar1 + 3;
} else if (uVar2 < 0x409) {
if (uVar2 == 0x400) {
*local_18 = 0x53;
local_18 = puVar1 + 3;
} else if (uVar2 < 0x401) {
if (uVar2 == 0) {
*local_18 = 0x2d;
local_18 = puVar1 + 3;
} else if (uVar2 == 8) {
*local_18 = 0x78;
local_18 = puVar1 + 3;
}
}
}
puVar1 = local_18;
if ((param_1 & 4) == 0) {
*local_18 = 0x2d;
} else {
*local_18 = 0x72;
}
local_18 = local_18 + 1;
if ((param_1 & 2) == 0) {
*local_18 = 0x2d;
} else {
*local_18 = 0x77;
}
local_18 = puVar1 + 2;
param_1 = param_1 & 0x201;
if (param_1 == 0x201) {
*local_18 = 0x74;
local_18 = puVar1 + 3;
} else if (param_1 < 0x202) {
if (param_1 == 0x200) {
*local_18 = 0x54;
local_18 = puVar1 + 3;
} else if (param_1 < 0x201) {
if (param_1 == 0) {
*local_18 = 0x2d;
local_18 = puVar1 + 3;
} else if (param_1 == 1) {
*local_18 = 0x78;
local_18 = puVar1 + 3;
}
}
}
*local_18 = 0x20;
local_18[1] = 0;
return;
} | openssh-portable | ghidra |
static struct zip_program const *find_zip_program(enum compress_type type,
int *pstate) {
int i;
for (i = *pstate; zip_program[i].type != ct_none; i++) {
if (zip_program[i].type == type) {
*pstate = i + 1;
return zip_program + i;
}
}
*pstate = i;
return ((void *)0);
} | int find_zip_program(unsigned long a0, unsigned int *a1) {
unsigned int v0;
unsigned int v2;
v0 = *(a1);
while (true) {
if (!zip_program[4 * v0 + 2 * v0]) {
*(a1) = v0;
v2 = 0;
return v2;
} else if (a0 != zip_program[4 * v0 + 2 * v0]) {
v0 += 1;
} else {
*(a1) = v0 + 1;
v2 = &zip_program[6 * v0];
return v2;
}
}
} | tar | angr_sailr |
static _Bool
no_leading_hyphen(char const *file) {
char const *p;
for (p = file; (p = strchr(p, '-')); p++)
if (p == file || p[-1] == '/') {
error(0, 0, gettext("leading '-' in a component of file name %s"),
quotearg_style(shell_escape_always_quoting_style, file));
return 0;
}
return 1;
} | long no_leading_hyphen(char *a1) {
char *i;
long v2;
char *v3;
for (i = strchr(a1, 45); i; i = strchr(i + 1, 45)) {
if (i == a1 || *(i - 1) == 47) {
v2 = quotearg_style(4LL, a1);
v3 = gettext("leading '-' in a component of file name %s");
error(0, 0, v3, v2);
return 0LL;
}
}
return 1LL;
} | coreutils | ida |
static _Bool gre_is_erspan(struct link_util *lu) {
return !strcmp(lu->id, "erspan");
} | int gre_is_erspan(struct_0 *a0) {
unsigned long long v1;
v1 = strcmp(a0->field_8, "erspan");
*(&v1) = !v1;
return v1;
} | iproute2-6.0.0 | angr_dream |
static int wskipname(pat, dname, flags)
wchar_t *pat, *dname;
int flags;
{
int i;
if (glob_always_skip_dot_and_dotdot &&
(dname[0] == L'.' &&
(dname[1] == L'\0' || (dname[1] == L'.' && dname[2] == L'\0'))))
return 1;
if (noglob_dot_filenames == 0 && pat[0] != L'.' &&
(pat[0] != L'\\' || pat[1] != L'.') &&
(dname[0] == L'.' &&
(dname[1] == L'\0' || (dname[1] == L'.' && dname[2] == L'\0'))))
return 1;
else if (noglob_dot_filenames && dname[0] == L'.' && pat[0] != L'.' &&
(pat[0] != L'\\' || pat[1] != L'.'))
return 1;
return 0;
} | int wskipname(unsigned int a0[2], unsigned int a1[3], unsigned long a2) {
unsigned int v0;
unsigned int v2;
v0 = a2;
if (!glob_always_skip_dot_and_dotdot)
goto LABEL_400615;
if (!(a1[0] == 46))
goto LABEL_400615;
switch (a1[1]) {
case 0:
v2 = 1;
return v2;
case 46:
if (!a1[2]) {
v2 = 1;
return v2;
}
default:
LABEL_400615:
if (!(!noglob_dot_filenames))
goto LABEL_400681;
switch (a0[0]) {
case 46:
break;
case 92:
if (a0[1] == 46)
goto LABEL_400681;
else
goto LABEL_400644;
default:
LABEL_400644:
if (!(a1[0] == 46))
goto LABEL_400681;
switch (a1[1]) {
case 0:
v2 = 1;
return v2;
case 46:
if (!a1[2]) {
v2 = 1;
return v2;
}
default:
LABEL_400681:
if (!noglob_dot_filenames) {
v2 = 0;
return v2;
} else if (a1[0] != 46) {
v2 = 0;
return v2;
} else {
switch (a0[0]) {
case 46:
v2 = 0;
return v2;
case 92:
if (a0[1] != 46) {
v2 = 1;
return v2;
}
v2 = 0;
return v2;
default:
v2 = 1;
return v2;
}
}
}
}
}
} | bash | angr_sailr |
static const char *pick_salt(void) {
struct passwd *pw;
char *passwd, *p;
size_t typelen;
static char salt[32];
if (salt[0] != '\0')
return salt;
strlcpy(salt, "xx", sizeof(salt));
setpwent();
while ((pw = getpwent()) != ((void *)0)) {
if ((passwd = shadow_pw(pw)) == ((void *)0))
continue;
if (passwd[0] == '$' && (p = strrchr(passwd + 1, '$')) != ((void *)0)) {
typelen = p - passwd + 1;
strlcpy(salt, passwd,
(((typelen) < (sizeof(salt))) ? (typelen) : (sizeof(salt))));
explicit_bzero(passwd, strlen(passwd));
goto out;
}
}
out:
endpwent();
return salt;
} | undefined1 *pick_salt(void)
{
char *__s;
char *pcVar1;
undefined8 uVar2;
ulong uVar3;
ulong uVar4;
size_t sVar5;
passwd *ppVar6;
if (salt_5921[0] == '\0') {
strlcpy(salt_5921, &DAT_001001c0, 0x20);
setpwent();
do {
ppVar6 = getpwent();
if (ppVar6 == (passwd *)0x0)
goto LAB_00100108;
__s = (char *)shadow_pw(ppVar6);
} while (((__s == (char *)0x0) || (*__s != '$')) ||
(pcVar1 = strrchr(__s + 1, 0x24), pcVar1 == (char *)0x0));
uVar2 = __subvdi3(pcVar1, __s);
uVar3 = __addvdi3(uVar2, 1);
uVar4 = 0x20;
if (uVar3 < 0x21) {
uVar4 = uVar3;
}
strlcpy(salt_5921, __s, uVar4);
sVar5 = strlen(__s);
explicit_bzero(__s, sVar5);
LAB_00100108:
endpwent();
}
return salt_5921;
} | openssh-portable | ghidra |
static void write_error(void) {
((!!sizeof(struct {
_Static_assert(1, "verify_expr ("
"1"
", "
"(error (1, (*__errno_location ()), gettext (\"write "
"error\")), assume (false))"
")");
int _gl_dummy;
}))
? ((error(1, (*__errno_location()), gettext("write error")),
((0) ? (void)0 : __builtin_unreachable())))
: ((error(1, (*__errno_location()), gettext("write error")),
((0) ? (void)0 : __builtin_unreachable()))));
} | void write_error(void)
{
int iVar1;
undefined8 uVar2;
int *piVar3;
char cVar4;
uVar2 = gettext("write error");
piVar3 = __errno_location();
cVar4 = '\x01';
error(1, *piVar3, uVar2);
iVar1 = putchar_unlocked((int)cVar4);
if (iVar1 < 0) {
write_error();
}
return;
} | coreutils | ghidra |
int sshsig_verify_fd(struct sshbuf *signature, int fd,
const char *expect_namespace, struct sshkey **sign_keyp,
struct sshkey_sig_details **sig_details) {
struct sshbuf *b = ((void *)0);
int r = -1;
char *hashalg = ((void *)0);
if (sig_details != ((void *)0))
*sig_details = ((void *)0);
if (sign_keyp != ((void *)0))
*sign_keyp = ((void *)0);
if ((r = sshsig_peek_hashalg(signature, &hashalg)) != 0)
return r;
sshlog("sshsig.c", __func__, 601, 1, SYSLOG_LEVEL_DEBUG1, ((void *)0),
"signature made with hash \"%s\"", hashalg);
if ((r = hash_file(fd, hashalg, &b)) != 0) {
sshlog("sshsig.c", __func__, 603, 1, SYSLOG_LEVEL_ERROR, ssh_err(r),
"hash_file");
goto out;
}
if ((r = sshsig_wrap_verify(signature, hashalg, b, expect_namespace,
sign_keyp, sig_details)) != 0)
goto out;
r = 0;
out:
sshbuf_free(b);
free(hashalg);
return r;
} | long long sshsig_verify_fd(unsigned long long a0, unsigned long a1, char *a2,
unsigned long long *a3, unsigned long long *a4) {
unsigned long long v0;
void *v1;
unsigned int v2;
void *v3;
void *v4;
unsigned long long v6;
v3 = 0;
v2 = -1;
v4 = 0;
if (a4)
*(a4) = 0;
if (a3)
*(a3) = 0;
v2 = sshsig_peek_hashalg(a0, &v4);
if (v2) {
v6 = v2;
} else {
v1 = v4;
v0 = "signature made with hash \"%s\"";
sshlog("sshsig.c", "sshsig_verify_fd", 0x259, 0x1, 0x5, 0x0);
v2 = hash_file(a1, v4, &v3);
if (v2) {
v0 = "hash_file";
sshlog("sshsig.c", "sshsig_verify_fd", 0x25b, 0x1, 0x2, ssh_err(v2));
} else {
v2 = sshsig_wrap_verify(a0, v4, v3, a2, a3, a4);
if (!v2)
v2 = 0;
}
sshbuf_free(v3);
free(v4);
v6 = v2;
}
return v6;
} | openssh-portable | angr_dream |
void xheader_set_option(char *string) {
char *token;
for (token = strtok(string, ","); token; token = strtok(((void *)0), ",")) {
char *p = strchr(token, '=');
if (!p)
xheader_set_single_keyword(token);
else
xheader_set_keyword_equal(token, p);
}
} | void xheader_set_option(char *param_1)
{
char *pcVar1;
char *local_18;
local_18 = strtok(param_1, ",");
while (local_18 != (char *)0x0) {
pcVar1 = strchr(local_18, 0x3d);
if (pcVar1 == (char *)0x0) {
xheader_set_single_keyword(local_18);
}
xheader_set_keyword_equal(local_18, pcVar1);
local_18 = strtok((char *)0x0, ",");
}
return;
} | tar | ghidra |
static struct timespec get_stat_btime(struct stat const *st) {
struct timespec btimespec;
btimespec = get_stat_mtime(st);
return btimespec;
} | long get_stat_btime(long a1) { return get_stat_mtime(a1); } | coreutils | ida |
int do_close(struct sftp_conn *conn, const u_char *handle, u_int handle_len) {
u_int id, status;
struct sshbuf *msg;
int r;
if ((msg = sshbuf_new()) == ((void *)0))
sshfatal("sftp-client.c", __func__, 670, 1, SYSLOG_LEVEL_FATAL, ((void *)0),
"sshbuf_new failed");
id = conn->msg_id++;
if ((r = sshbuf_put_u8(msg, 4)) != 0 || (r = sshbuf_put_u32(msg, id)) != 0 ||
(r = sshbuf_put_string(msg, handle, handle_len)) != 0)
sshfatal("sftp-client.c", __func__, 676, 1, SYSLOG_LEVEL_FATAL, ssh_err(r),
"parse");
send_msg(conn, msg);
sshlog("sftp-client.c", __func__, 678, 0, SYSLOG_LEVEL_DEBUG3, ((void *)0),
"Sent message SSH2_FXP_CLOSE I:%u", id);
status = get_status(conn, id);
if (status != 0)
sshlog("sftp-client.c", __func__, 682, 0, SYSLOG_LEVEL_ERROR, ((void *)0),
"close remote: %s", fx2txt(status));
sshbuf_free(msg);
return status == 0 ? 0 : -1;
} | void do_close(struct_0 *a0, unsigned long long a1, unsigned long a2) {
struct_0 *v0;
int tmp_14;
unsigned int v1;
unsigned int v2;
unsigned int v3;
unsigned long long v4;
unsigned long v5;
char v6;
void *v8;
unsigned long long v9;
v0 = a0;
v4 = sshbuf_new();
if (!v4)
sshfatal("sftp-client.c", "do_close", 0x29e, 0x1, 0x1, 0x0,
"sshbuf_new failed");
tmp_14 = a0->field_18;
a0->field_18 = a0->field_18 + 1;
v2 = tmp_14;
v1 = sshbuf_put_u8(v4, 0x4, a0);
if (!v1) {
v1 = sshbuf_put_u32(v4, v2, v2);
if (!v1)
v1 = sshbuf_put_string(v4, a1, a2, a1);
}
if (v1 || v1 || v1) {
v4 = "parse";
sshfatal("sftp-client.c", "do_close", 0x2a4, 0x1, 0x1, ssh_err(v1), *(&v6));
}
send_msg(a0, v4);
v5 = v2;
v4 = "Sent message SSH2_FXP_CLOSE I:%u";
sshlog("sftp-client.c", "do_close", 0x2a6, 0x0, 0x7, 0x0, *(&v6));
v3 = get_status(a0, v2);
if (v3) {
v5 = fx2txt(v3);
v4 = "close remote: %s";
sshlog("sftp-client.c", "do_close", 0x2aa, 0x0, 0x2, 0x0, *(&v6));
}
sshbuf_free(v4);
if (!v3)
v8 = 0;
else
v9 = 4294967295;
return;
} | openssh-portable | angr_dream |
static mode_t file_or_link_mode(struct fileinfo const *file) {
return (color_symlink_as_referent && file->linkok ? file->linkmode
: file->stat.st_mode);
} | int file_or_link_mode(struct_0 *a0) {
unsigned int v1;
if (color_symlink_as_referent && a0->field_b9) {
v1 = a0->field_ac;
goto LABEL_40056a;
}
v1 = a0->field_30;
LABEL_40056a:
return v1;
} | coreutils | angr_phoenix |
HostStatus check_key_in_hostfiles(struct passwd *pw, struct sshkey *key,
const char *host, const char *sysfile,
const char *userfile) {
char *user_hostfile;
struct stat st;
HostStatus host_status;
struct hostkeys *hostkeys;
const struct hostkey_entry *found;
hostkeys = init_hostkeys();
load_hostkeys(hostkeys, host, sysfile, 0);
if (userfile != ((void *)0)) {
user_hostfile = tilde_expand_filename(userfile, pw->pw_uid);
if (options.strict_modes && (stat(user_hostfile, &st) == 0) &&
((st.st_uid != 0 && st.st_uid != pw->pw_uid) ||
(st.st_mode & 022) != 0)) {
sshlog("auth.c", __func__, 436, 0, SYSLOG_LEVEL_INFO, ((void *)0),
"Authentication refused for %.100s: "
"bad owner or modes for %.200s",
pw->pw_name, user_hostfile)
;
auth_debug_add("Ignored %.200s: bad ownership or modes", user_hostfile);
} else {
temporarily_use_uid(pw);
load_hostkeys(hostkeys, host, user_hostfile, 0);
restore_uid();
}
free(user_hostfile);
}
host_status = check_key_in_hostkeys(hostkeys, key, &found);
if (host_status == HOST_REVOKED)
sshlog("auth.c", __func__, 450, 0, SYSLOG_LEVEL_ERROR, ((void *)0),
"WARNING: revoked key for %s attempted authentication", host);
else if (host_status == HOST_OK)
sshlog("auth.c", __func__, 453, 1, SYSLOG_LEVEL_DEBUG1, ((void *)0),
"key for %s found at %s:%ld", found->host, found->file, found->line);
else
sshlog("auth.c", __func__, 456, 1, SYSLOG_LEVEL_DEBUG1, ((void *)0),
"key for host %s not found", host);
free_hostkeys(hostkeys);
return host_status;
} | int check_key_in_hostfiles(undefined8 *param_1, undefined8 param_2,
undefined8 param_3, undefined8 param_4, long param_5)
{
int iVar1;
long in_FS_OFFSET;
undefined8 uVar2;
undefined8 *local_c0;
undefined8 local_b8;
char *local_b0;
stat local_a8;
long local_10;
local_10 = *(long *)(in_FS_OFFSET + 0x28);
local_b8 = init_hostkeys();
load_hostkeys(local_b8, param_3, param_4, 0);
if (param_5 == 0)
goto LAB_0010117d;
local_b0 =
(char *)tilde_expand_filename(param_5, *(undefined4 *)(param_1 + 2));
if (_DAT_001044a8 == 0) {
LAB_00101138:
temporarily_use_uid(param_1);
load_hostkeys(local_b8, param_3, local_b0, 0);
restore_uid();
} else {
uVar2 = 0x101099;
iVar1 = stat(local_b0, &local_a8);
if ((iVar1 != 0) || (((local_a8.st_uid == 0 ||
(local_a8.st_uid == *(__uid_t *)(param_1 + 2))) &&
((local_a8.st_mode & 0x12) == 0))))
goto LAB_00101138;
sshlog("auth.c", "check_key_in_hostfiles", 0x1b4, 0, 3, 0,
"Authentication refused for %.100s: bad owner or modes for %.200s",
*param_1, local_b0, uVar2);
auth_debug_add("Ignored %.200s: bad ownership or modes", local_b0);
}
free(local_b0);
LAB_0010117d:
iVar1 = check_key_in_hostkeys(local_b8, param_2, &local_c0);
if (iVar1 == 3) {
sshlog("auth.c", "check_key_in_hostfiles", 0x1c2, 0, 2, 0,
"WARNING: revoked key for %s attempted authentication", param_3);
} else if (iVar1 == 0) {
sshlog("auth.c", "check_key_in_hostfiles", 0x1c5, 1, 5, 0,
"key for %s found at %s:%ld", *local_c0, local_c0[1], local_c0[2]);
} else {
sshlog("auth.c", "check_key_in_hostfiles", 0x1c8, 1, 5, 0,
"key for host %s not found", param_3);
}
free_hostkeys(local_b8);
if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) {
__stack_chk_fail();
}
return iVar1;
} | openssh-portable | ghidra |
static void str_to_env(char const *envar, char const *str) {
if (str) {
if (setenv(envar, str, 1) != 0)
xalloc_die();
} else
unsetenv(envar);
} | void str_to_env(char *a0, char *a1) {
unsigned long long v1;
unsigned long long v2;
if (a1) {
v2 = setenv(a0, a1, 0x1);
if (v2)
xalloc_die();
} else {
v1 = unsetenv(a0);
}
if (!v2 || !a1)
return;
} | tar | angr_dream |
static int input_userauth_error(int type, u_int32_t seq, struct ssh *ssh) {
sshfatal("sshconnect2.c", __func__, 590, 1, SYSLOG_LEVEL_FATAL, ((void *)0),
"bad message during authentication: type %d", type);
return 0;
} | long input_userauth_error(unsigned int a1) {
long v1;
sshfatal("sshconnect2.c", "input_userauth_error", 590LL, 1LL, 1LL, 0LL,
"bad message during authentication: type %d", a1);
return input_userauth_banner((long)"sshconnect2.c",
(long)"input_userauth_error", v1);
} | openssh-portable | ida |
char *get_working_directory(for_whom)
char *for_whom;
{
if (no_symbolic_links) {
do {
if (the_current_working_directory)
sh_xfree((the_current_working_directory), "common.c", 629);
} while (0);
the_current_working_directory = (char *)((void *)0);
}
if (the_current_working_directory == 0) {
the_current_working_directory = getcwd(0, 0);
if (the_current_working_directory == 0) {
fprintf(stderr,
gettext("%s: error retrieving current directory: %s: %s\n"),
(for_whom && *for_whom) ? for_whom : get_name_for_error(),
gettext(bash_getcwd_errstr), strerror((*__errno_location())));
return (char *)((void *)0);
}
}
return ((char *)strcpy(
sh_xmalloc((1 + strlen(the_current_working_directory)), "common.c", 649),
(the_current_working_directory)));
} | long long get_working_directory(char *a0) {
void *v1;
unsigned long long v2;
unsigned long long v3;
if (no_symbolic_links) {
if (the_current_working_directory)
sh_xfree(the_current_working_directory, "common.c", 0x275);
the_current_working_directory = 0;
}
if (!the_current_working_directory) {
the_current_working_directory = getcwd(NULL, 0x0);
strerror(*(__errno_location()));
v2 = gettext(bash_getcwd_errstr);
if (!a0 || !*(a0))
v3 = get_name_for_error();
fprintf(stderr,
gettext("%s: error retrieving current directory: %s: %s\n"));
v1 = 0;
} else {
v1 = strcpy(sh_xmalloc(strlen(the_current_working_directory) + 1,
"common.c", 0x289),
the_current_working_directory);
}
return v1;
} | bash | angr_dream |
int el_getc(EditLine *el, char *cp) {
int num_read;
wchar_t wc = 0;
num_read = el_wgetc(el, &wc);
*cp = '\0';
if (num_read <= 0)
return num_read;
num_read = wctob(wc);
if (num_read == (-1)) {
(*__errno_location()) = 34;
return -1;
} else {
*cp = (char)num_read;
return 1;
}
} | long el_getc(long a1, _BYTE *a2) {
wint_t c;
int v4;
unsigned long v5;
v5 = __readfsqword(0x28u);
c = 0;
v4 = el_wgetc(a1, &c);
*a2 = 0;
if (v4 <= 0)
return (unsigned int)v4;
v4 = wctob(c);
if (v4 == -1) {
*_errno_location() = 34;
return 0xFFFFFFFFLL;
} else {
*a2 = v4;
return 1LL;
}
} | libedit | ida |
static int privsep_preauth(struct ssh *ssh) {
int status, r;
pid_t pid;
struct ssh_sandbox *box = ((void *)0);
pmonitor = monitor_init();
pmonitor->m_pkex = &ssh->kex;
if (use_privsep == 1)
box = ssh_sandbox_init(pmonitor);
pid = fork();
if (pid == -1) {
sshfatal("sshd.c", __func__, 488, 0, SYSLOG_LEVEL_FATAL, ((void *)0),
"fork of unprivileged child failed");
} else if (pid != 0) {
sshlog("sshd.c", __func__, 490, 0, SYSLOG_LEVEL_DEBUG2, ((void *)0),
"Network child is on pid %ld", (long)pid);
pmonitor->m_pid = pid;
if (have_agent) {
r = ssh_get_authentication_socket(&auth_sock);
if (r != 0) {
sshlog("sshd.c", __func__, 496, 0, SYSLOG_LEVEL_ERROR, ssh_err(r),
"Could not get agent socket");
have_agent = 0;
}
}
if (box != ((void *)0))
ssh_sandbox_parent_preauth(box, pid);
monitor_child_preauth(ssh, pmonitor);
while (waitpid(pid, &status, 0) == -1) {
if ((*__errno_location()) == 4)
continue;
pmonitor->m_pid = -1;
sshfatal("sshd.c", __func__, 509, 1, SYSLOG_LEVEL_FATAL, ((void *)0),
"waitpid: %s", strerror((*__errno_location())));
}
privsep_is_preauth = 0;
pmonitor->m_pid = -1;
if ((((status) & 0x7f) == 0)) {
if ((((status) & 0xff00) >> 8) != 0)
sshfatal("sshd.c", __func__, 515, 1, SYSLOG_LEVEL_FATAL, ((void *)0),
"preauth child exited with status %d",
(((status) & 0xff00) >> 8));
} else if ((((signed char)(((status) & 0x7f) + 1) >> 1) > 0))
sshfatal("sshd.c", __func__, 518, 1, SYSLOG_LEVEL_FATAL, ((void *)0),
"preauth child terminated by signal %d", ((status) & 0x7f));
if (box != ((void *)0))
ssh_sandbox_parent_finish(box);
return 1;
} else {
close(pmonitor->m_sendfd);
close(pmonitor->m_log_recvfd);
set_log_handler(mm_log_handler, pmonitor);
privsep_preauth_child();
setproctitle("%s", "[net]");
if (box != ((void *)0))
ssh_sandbox_child(box);
return 0;
}
} | undefined8 privsep_preauth(long param_1)
{
int iVar1;
long lVar2;
__pid_t _Var3;
undefined8 uVar4;
int *piVar5;
char *pcVar6;
undefined *puVar7;
undefined *puVar8;
char **ppcVar9;
long in_FS_OFFSET;
char *pcStack72;
undefined8 uStack64;
undefined auStack56[8];
long local_30;
uint local_24;
__pid_t local_20;
int local_1c;
long local_18;
long local_10;
ppcVar9 = (char **)auStack56;
local_10 = *(long *)(in_FS_OFFSET + 0x28);
local_18 = 0;
uStack64 = 0x1007dc;
local_30 = param_1;
pmonitor = monitor_init();
*(long *)(pmonitor + 0x10) = local_30 + 8;
if (use_privsep == 1) {
uStack64 = 0x100810;
local_18 = ssh_sandbox_init();
}
uStack64 = 0x100819;
local_20 = fork();
if (local_20 == -1) {
ppcVar9 = &pcStack72;
pcStack72 = "fork of unprivileged child failed";
sshfatal("sshd.c", "privsep_preauth", 0x1e8, 0, 1, 0);
}
if (local_20 == 0) {
iVar1 = *(int *)(pmonitor + 4);
*(undefined8 *)((long)ppcVar9 + -8) = 0x100ab7;
close(iVar1);
iVar1 = *(int *)(pmonitor + 8);
*(undefined8 *)((long)ppcVar9 + -8) = 0x100ac8;
close(iVar1);
*(undefined8 *)((long)ppcVar9 + -8) = 0x100ae1;
set_log_handler(uRam0000000000100ad9, pmonitor);
*(undefined8 *)((long)ppcVar9 + -8) = 0x100ae6;
privsep_preauth_child();
*(undefined8 *)((long)ppcVar9 + -8) = 0x100afe;
setproctitle(&DAT_00107334, "[net]");
if (local_18 != 0) {
*(undefined8 *)((long)ppcVar9 + -8) = 0x100b11;
ssh_sandbox_child(local_18);
}
uVar4 = 0;
goto LAB_00100b16;
}
*(long *)((long)ppcVar9 + -8) = (long)local_20;
*(char **)((long)ppcVar9 + -0x10) = "Network child is on pid %ld";
*(undefined8 *)((long)ppcVar9 + -0x18) = 0x1008a2;
sshlog("sshd.c", "privsep_preauth", 0x1ea, 0, 6, 0);
*(__pid_t *)(pmonitor + 0x18) = local_20;
if (have_agent != 0) {
*(undefined8 *)((long)ppcVar9 + -8) = 0x1008c9;
local_1c = ssh_get_authentication_socket(&auth_sock);
if (local_1c != 0) {
*(undefined8 *)((long)ppcVar9 + -8) = 0x1008dc;
uVar4 = ssh_err(local_1c);
*(char **)((long)ppcVar9 + -0x10) = "Could not get agent socket";
*(undefined8 *)((long)ppcVar9 + -0x18) = 0x100913;
sshlog("sshd.c", "privsep_preauth", 0x1f0, 0, 2, uVar4);
have_agent = 0;
}
}
if (local_18 != 0) {
*(undefined8 *)((long)ppcVar9 + -8) = 0x100939;
ssh_sandbox_parent_preauth(local_18, local_20);
}
*(undefined8 *)((long)ppcVar9 + -8) = 0x10094f;
monitor_child_preauth(local_30, pmonitor);
puVar7 = (undefined *)ppcVar9;
while (true) {
*(undefined8 *)(puVar7 + -8) = 0x1009c8;
_Var3 = waitpid(local_20, (int *)&local_24, 0);
if (_Var3 != -1)
break;
*(undefined8 *)(puVar7 + -8) = 0x100956;
piVar5 = __errno_location();
if (*piVar5 != 4) {
*(undefined4 *)(pmonitor + 0x18) = 0xffffffff;
*(undefined8 *)(puVar7 + -8) = 0x100972;
piVar5 = __errno_location();
iVar1 = *piVar5;
*(undefined8 *)(puVar7 + -8) = 0x10097b;
pcVar6 = strerror(iVar1);
*(char **)(puVar7 + -8) = pcVar6;
*(char **)(puVar7 + -0x10) = "waitpid: %s";
*(undefined8 *)(puVar7 + -0x18) = 0x1009b2;
sshfatal("sshd.c", "privsep_preauth", 0x1fd, 1, 1, 0);
puVar7 = puVar7 + -0x10;
}
}
privsep_is_preauth = 0;
*(undefined4 *)(pmonitor + 0x18) = 0xffffffff;
puVar8 = puVar7;
if ((local_24 & 0x7f) == 0) {
ppcVar9 = (char **)puVar7;
if (((int)local_24 >> 8 & 0xffU) != 0) {
*(ulong *)(puVar7 + -8) = (ulong)((int)local_24 >> 8 & 0xff);
puVar8 = puVar7 + -0x10;
*(char **)(puVar7 + -0x10) = "preauth child exited with status %d";
*(undefined8 *)(puVar7 + -0x18) = 0x100a40;
sshfatal("sshd.c", "privsep_preauth", 0x203, 1, 1, 0);
goto LAB_00100a40;
}
} else {
LAB_00100a40:
ppcVar9 = (char **)puVar8;
if ('\0' < (char)(((byte)local_24 & 0x7f) + 1) >> 1) {
*(ulong *)(puVar8 + -8) = (ulong)(local_24 & 0x7f);
ppcVar9 = (char **)(puVar8 + -0x10);
*(char **)(puVar8 + -0x10) = "preauth child terminated by signal %d";
*(undefined8 *)(puVar8 + -0x18) = 0x100a8c;
sshfatal("sshd.c", "privsep_preauth", 0x206, 1, 1, 0);
}
}
lVar2 = local_18;
if (local_18 != 0) {
*(undefined8 *)((long)ppcVar9 + -8) = 0x100a9f;
ssh_sandbox_parent_finish(lVar2);
}
uVar4 = 1;
LAB_00100b16:
if (local_10 == *(long *)(in_FS_OFFSET + 0x28)) {
return uVar4;
}
*(undefined8 *)((long)ppcVar9 + -8) = 0x100b2a;
__stack_chk_fail();
} | openssh-portable | ghidra |
void chan_mark_dead(struct ssh *ssh, Channel *c) { c->type = 14; } | long long chan_mark_dead(unsigned long a0, unsigned int *a1) {
unsigned long v0;
v0 = a0;
*(a1) = 14;
return a1;
} | openssh-portable | angr_sailr |
(session, dns, &dns_size, &type, 0) == 0) {
log_msg(stdout, "- Given server name[%d]: %s\n", type, dns);
} | void log_msg() {
unsigned int v0;
unsigned int v1;
unsigned int v2;
unsigned long v3;
unsigned long v4;
unsigned long v5;
char v6;
unsigned long v7;
unsigned long v8;
unsigned long v9;
unsigned long v10;
int v11;
int v12;
int v13;
int v14;
int v15;
int v16;
int v17;
int v18;
unsigned long v19;
unsigned long v20;
unsigned long v21;
unsigned long v22;
unsigned long v23;
char v24;
int v25;
int v26;
int v27;
int v28;
int v29;
int v30;
int v31;
int v32;
unsigned long long *v33;
void *v34;
void *v35;
char *v36;
unsigned long long v37;
v7 = v20;
v8 = v21;
v9 = v22;
v10 = v23;
if (v24) {
v11 = v25;
v12 = v26;
v13 = v27;
v14 = v28;
v15 = v29;
v16 = v30;
v17 = v31;
v18 = v32;
}
v5 = v33[5];
v1 = 16;
v2 = 48;
v3 = &v19;
v4 = &v6;
if (logfile)
v34 = logfile;
else
v34 = v35;
v0 = vfprintf(v34, v36, &v1);
v37 = v0;
if ((v5 ^ v33[5]))
__stack_chk_fail();
return;
} | gnutls | angr_dream |
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);
} | void xlseek(unsigned long a0, unsigned long a1, unsigned long a2,
unsigned long long a3) {
char v0;
unsigned long long v1;
unsigned long v2;
char v3;
unsigned long v4;
unsigned long long *v6;
unsigned long long v7;
unsigned long long v9;
v4 = v6[5];
v1 = lseek(a0, a1, a2);
if ((v1 - 0 >> 63)) {
v2 = offtostr(a1, &v3, &v3);
if (*(&v0) != 2 && (!(*(&v0) <= 2) || !(!*(&v0)) && !(*(&v0) == 1)))
abort();
v9 = quotearg_n_style_colon(0x0, 0x3, a3);
if (!*(&v0)) {
error(0x0, *(__errno_location()),
gettext("%s: cannot seek to offset %s"));
} else if (*(&v0) != 2) {
error(0x0, *(__errno_location()),
gettext("%s: cannot seek to relative offset %s"));
} else {
error(0x0, *(__errno_location()),
gettext("%s: cannot seek to end-relative offset %s"));
}
exit(0x1);
} else {
v7 = v1;
if (!(v4 ^ v6[5]))
return;
__stack_chk_fail();
}
} | coreutils | angr_sailr |
literal_get(EditLine *el, wint_t idx) {
el_literal_t *l = &el->el_literal;
((void)sizeof((idx & ((wint_t)0x80000000)) ? 1 : 0), __extension__({
if (idx & ((wint_t)0x80000000))
;
else
__assert_fail("idx & EL_LITERAL", "literal.c", 134,
__extension__ __PRETTY_FUNCTION__);
}));
idx &= ~((wint_t)0x80000000);
((void)sizeof((l->l_idx > (size_t)idx) ? 1 : 0), __extension__({
if (l->l_idx > (size_t)idx)
;
else
__assert_fail("l->l_idx > (size_t)idx", "literal.c", 136,
__extension__ __PRETTY_FUNCTION__);
}));
return l->l_buf[idx];
} | undefined8 literal_get(long param_1, uint param_2)
{
if (-1 < (int)param_2) {
__assert_fail("idx & EL_LITERAL", "literal.c", 0x86, "literal_get");
}
if (*(ulong *)(param_1 + 0x358) <= (ulong)(param_2 & 0x7fffffff)) {
__assert_fail("l->l_idx > (size_t)idx", "literal.c", 0x88, "literal_get");
}
return *(undefined8 *)(*(long *)(param_1 + 0x350) +
(ulong)(param_2 & 0x7fffffff) * 8);
} | libedit | ghidra |
static void add_multi_volume_header(struct bufmap *map) {
if (archive_format == POSIX_FORMAT) {
off_t d = map->sizetotal - map->sizeleft;
xheader_store("GNU.volume.filename", &dummy, map->file_name);
xheader_store("GNU.volume.size", &dummy, &map->sizeleft);
xheader_store("GNU.volume.offset", &dummy, &d);
} else
gnu_add_multi_volume_header(map);
} | void add_multi_volume_header(unsigned long long a0[5]) {
unsigned long v0;
char v1;
unsigned long long *v3;
unsigned long long v4;
if (archive_format == 4) {
v0 = a0[3] - a0[4];
xheader_store("GNU.volume.filename", &dummy, a0[2]);
xheader_store("GNU.volume.size", &dummy, &a0[4]);
xheader_store("GNU.volume.offset", &dummy, &v0);
} else {
gnu_add_multi_volume_header(a0);
}
v4 = *(&v1) ^ v3[5];
return;
} | tar | angr_dream |
static int compare_names_for_qsort(void const *file1, void const *file2) {
char const *const *f1 = file1;
char const *const *f2 = file2;
char const *name1 = *f1;
char const *name2 = *f2;
if (locale_specific_sorting) {
int diff = compare_collated(name1, name2);
if (diff)
return diff;
}
return strcmp(name1, name2);
} | long long compare_names_for_qsort(unsigned long long *a0,
unsigned long long *a1) {
unsigned int v0;
char *v1;
char *v2;
unsigned long long v4;
v1 = *(a0);
v2 = *(a1);
if (locale_specific_sorting) {
v0 = compare_collated(v1, v2);
if (v0) {
v4 = v0;
goto LABEL_400432;
}
}
v4 = strcmp(v1, v2);
LABEL_400432:
return v4;
} | diffutils | angr_phoenix |
static int fd_i_chmod(int fd, char const *file, mode_t mode, int atflag) {
if (0 <= fd) {
int result = fchmod(fd, mode);
if (result == 0 || implemented((*__errno_location())))
return result;
}
return fchmodat(chdir_fd, file, mode, atflag);
} | int fd_i_chmod(int param_1, char *param_2, __mode_t param_3, int param_4)
{
char cVar1;
int iVar2;
if (-1 < param_1) {
iVar2 = fchmod(param_1, param_3);
if (iVar2 == 0) {
return 0;
}
__errno_location();
cVar1 = implemented();
if (cVar1 != '\0') {
return iVar2;
}
}
iVar2 = fchmodat(chdir_fd, param_2, param_3, param_4);
return iVar2;
} | tar | ghidra |
static int iproute_dump_filter(struct nlmsghdr *nlh, int reqlen) {
int err;
if (filter.tb) {
err = addattr32(nlh, reqlen, RTA_TABLE, filter.tb);
if (err)
return err;
}
return 0;
} | int iproute_dump_filter(undefined8 param_1, undefined4 param_2)
{
int iVar1;
if ((filter._0_4_ == 0) ||
(iVar1 = addattr32(param_1, param_2, 0xf, filter._0_4_), iVar1 == 0)) {
iVar1 = 0;
}
return iVar1;
} | iproute2-6.0.0 | ghidra |
static enum char_class is_valid_cclass(name) const char *name;
{
enum char_class ret;
int i;
ret = CC_NO_CLASS;
for (i = 1; i < (sizeof(cclass_name) / sizeof(cclass_name[0])); i++) {
if (((name)[0] == (cclass_name[i])[0] &&
strcmp(name, cclass_name[i]) == 0)) {
ret = (enum char_class)i;
break;
}
}
return ret;
} | int is_valid_cclass(char *a0) {
unsigned int v0;
unsigned int v1;
unsigned long long v3;
v0 = 0;
for (v1 = 1; v1 <= 14; v1 += 1) {
if (*(a0) == *(cclass_name[v1])) {
v3 = strcmp(a0, cclass_name[v1]);
if (!v3) {
v0 = v1;
break;
}
}
}
return v0;
} | bash | angr_dream |
void ssh_krl_free(struct ssh_krl *krl) {
struct revoked_blob *rb, *trb;
struct revoked_certs *rc, *trc;
if (krl == ((void *)0))
return;
free(krl->comment);
for ((rb) = revoked_blob_tree_RB_MINMAX(&krl->revoked_keys, -1);
((rb) != ((void *)0)) && ((trb) = revoked_blob_tree_RB_NEXT(rb), 1);
(rb) = (trb)) {
revoked_blob_tree_RB_REMOVE(&krl->revoked_keys, rb);
free(rb->blob);
free(rb);
}
for ((rb) = revoked_blob_tree_RB_MINMAX(&krl->revoked_sha1s, -1);
((rb) != ((void *)0)) && ((trb) = revoked_blob_tree_RB_NEXT(rb), 1);
(rb) = (trb)) {
revoked_blob_tree_RB_REMOVE(&krl->revoked_sha1s, rb);
free(rb->blob);
free(rb);
}
for ((rb) = revoked_blob_tree_RB_MINMAX(&krl->revoked_sha256s, -1);
((rb) != ((void *)0)) && ((trb) = revoked_blob_tree_RB_NEXT(rb), 1);
(rb) = (trb)) {
revoked_blob_tree_RB_REMOVE(&krl->revoked_sha256s, rb);
free(rb->blob);
free(rb);
}
for ((rc) = ((&krl->revoked_certs)->tqh_first);
(rc) != ((void *)0) && ((trc) = ((rc)->entry.tqe_next), 1);
(rc) = (trc)) {
do {
if (((rc)->entry.tqe_next) != ((void *)0))
(rc)->entry.tqe_next->entry.tqe_prev = (rc)->entry.tqe_prev;
else
(&krl->revoked_certs)->tqh_last = (rc)->entry.tqe_prev;
*(rc)->entry.tqe_prev = (rc)->entry.tqe_next;
;
;
} while (0);
revoked_certs_free(rc);
}
} | void ssh_krl_free(long a1) {
void **ptr;
void **ptra;
void **ptrb;
_QWORD *i;
_QWORD *v5;
long v6;
long v7;
long v8;
if (a1) {
free(*(void **)(a1 + 24));
for (ptr = (void **)revoked_blob_tree_RB_MINMAX((long *)(a1 + 32), -1); ptr;
ptr = (void **)v6) {
v6 = revoked_blob_tree_RB_NEXT((long)ptr);
revoked_blob_tree_RB_REMOVE((long *)(a1 + 32), (long)ptr);
free(*ptr);
free(ptr);
}
for (ptra = (void **)revoked_blob_tree_RB_MINMAX((long *)(a1 + 40), -1);
ptra; ptra = (void **)v7) {
v7 = revoked_blob_tree_RB_NEXT((long)ptra);
revoked_blob_tree_RB_REMOVE((long *)(a1 + 40), (long)ptra);
free(*ptra);
free(ptra);
}
for (ptrb = (void **)revoked_blob_tree_RB_MINMAX((long *)(a1 + 48), -1);
ptrb; ptrb = (void **)v8) {
v8 = revoked_blob_tree_RB_NEXT((long)ptrb);
revoked_blob_tree_RB_REMOVE((long *)(a1 + 48), (long)ptrb);
free(*ptrb);
free(ptrb);
}
for (i = *(_QWORD **)(a1 + 56); i; i = v5) {
v5 = (_QWORD *)i[3];
if (v5)
*(_QWORD *)(i[3] + 32LL) = i[4];
else
*(_QWORD *)(a1 + 64) = i[4];
*(_QWORD *)i[4] = i[3];
revoked_certs_free(i);
}
}
} | openssh-portable | ida |
static void *myMalloc(Int32 n) {
void *p;
p = malloc((size_t)n);
if (p == ((void *)0))
outOfMemory();
return p;
} | int myMalloc(unsigned long a0) {
unsigned long v0;
v0 = malloc(a0);
if (v0)
return v0;
outOfMemory();
} | bzip2 | angr_phoenix |
static void io_error(void) {
clearerr_unlocked(stdout);
((!!sizeof(struct {
_Static_assert(1, "verify_expr ("
"1"
", "
"(error (1, (*__errno_location ()), gettext (\"write "
"error\")), assume (false))"
")");
int _gl_dummy;
}))
? ((error(1, (*__errno_location()), gettext("write error")),
((0) ? (void)0 : __builtin_unreachable())))
: ((error(1, (*__errno_location()), gettext("write error")),
((0) ? (void)0 : __builtin_unreachable()))));
} | void io_error(void)
{
bool bVar1;
char cVar2;
int iVar3;
undefined8 uVar4;
uint *puVar5;
long extraout_RDX;
undefined8 unaff_RBX;
undefined8 unaff_RBP;
ulong uVar6;
char *__format;
long in_FS_OFFSET;
bool bVar7;
float10 fVar8;
float10 in_stack_00000000;
float10 in_stack_00000010;
char *pcStack128;
char *pcStack120;
float10 fStack112;
undefined8 uStack96;
undefined2 uStack88;
float10 fStack80;
undefined8 uStack64;
undefined2 uStack56;
long lStack40;
undefined2 *puStack32;
undefined2 uStack8;
undefined6 uStack6;
uStack8 = (undefined2)unaff_RBP;
uStack6 = (undefined6)((ulong)unaff_RBP >> 0x10);
puStack32 = (undefined2 *)0x100b92;
clearerr_unlocked(stdout);
puStack32 = (undefined2 *)0x100b9e;
uVar4 = gettext("write error");
puStack32 = (undefined2 *)0x100ba6;
puVar5 = (uint *)__errno_location();
uVar6 = (ulong)*puVar5;
__format = (char *)0x1;
puStack32 = (undefined2 *)0x100bbc;
error(1, uVar6, uVar4);
lStack40 = *(long *)(in_FS_OFFSET + 0x28);
if ((float10)0 <= in_stack_00000000) {
bVar1 = in_stack_00000010 < (float10)CONCAT28(uStack8, unaff_RBX);
} else {
bVar1 = (float10)CONCAT28(uStack8, unaff_RBX) < in_stack_00000010;
}
puStack32 = &uStack8;
if (!bVar1) {
uStack88 = uStack8;
fStack80 = (float10)1;
uStack96 = unaff_RBX;
puStack32 = &uStack8;
while (true) {
uStack64 = uStack96;
uStack56 = uStack88;
iVar3 = printf(__format);
if (iVar3 < 0) {
io_error();
}
if (bVar1)
break;
fVar8 =
(float10)CONCAT28(uStack8, unaff_RBX) + in_stack_00000000 * fStack80;
uStack96 = SUB108(fVar8, 0);
uStack88 = (undefined2)((unkuint10)fVar8 >> 0x40);
if ((float10)0 <= in_stack_00000000) {
bVar1 = in_stack_00000010 < fVar8;
} else {
bVar1 = fVar8 < in_stack_00000010;
}
if (bVar1) {
bVar7 = false;
if (locale_ok != '\0') {
setlocale(1, "C");
}
iVar3 = asprintf(&pcStack128, __format);
if (locale_ok != '\0') {
setlocale(1, "");
}
if (iVar3 < 0) {
xalloc_die();
}
pcStack128[iVar3 - extraout_RDX] = '\0';
cVar2 =
xstrtold(pcStack128 + uVar6, 0, &fStack112, uRam0000000000100d57);
if ((cVar2 != '\0') && (in_stack_00000010 == fStack112)) {
pcStack120 = (char *)0x0;
iVar3 = asprintf(&pcStack120, __format);
if (iVar3 < 0) {
xalloc_die();
}
pcStack120[iVar3 - extraout_RDX] = '\0';
iVar3 = strcmp(pcStack120, pcStack128);
bVar7 = iVar3 != 0;
free(pcStack120);
}
free(pcStack128);
if (!bVar7)
break;
}
iVar3 = fputs_unlocked(separator, stdout);
if (iVar3 == -1) {
io_error();
}
fStack80 = (float10)1 + fStack80;
}
iVar3 = fputs_unlocked((char *)&terminator, stdout);
if (iVar3 == -1) {
io_error();
}
}
if (lStack40 != *(long *)(in_FS_OFFSET + 0x28)) {
__stack_chk_fail();
}
return;
} | coreutils | ghidra |
static _Bool
term(void) {
_Bool value;
_Bool negated = 0;
while (pos < argc && argv[pos][0] == '!' && argv[pos][1] == '\0') {
advance(1);
negated = !negated;
}
if (pos >= argc)
beyond();
if (argv[pos][0] == '(' && argv[pos][1] == '\0') {
int nargs;
advance(1);
for (nargs = 1;
pos + nargs < argc && !(strcmp(argv[pos + nargs], ")") == 0); nargs++)
if (nargs == 4) {
nargs = argc - pos;
break;
}
value = posixtest(nargs);
if (argv[pos] == 0)
test_syntax_error(gettext("%s expected"), quote(")"));
else if (argv[pos][0] != ')' || argv[pos][1])
test_syntax_error(gettext("%s expected, found %s"), quote_n(0, ")"),
quote_n(1, argv[pos]));
advance(0);
}
else if (4 <= argc - pos && (strcmp(argv[pos], "-l") == 0) &&
binop(argv[pos + 2]))
value = binary_operator(1);
else if (3 <= argc - pos && binop(argv[pos + 1]))
value = binary_operator(0);
else if (argv[pos][0] == '-' && argv[pos][1] && argv[pos][2] == '\0')
value = unary_operator();
else {
value = (argv[pos][0] != '\0');
advance(0);
}
return negated ^ value;
} | int term() {
char v0;
char v1;
unsigned int v2;
unsigned long long v4;
unsigned long long v6;
unsigned long long v7;
unsigned long long v8;
for (v1 = 0; pos < argc; v1 &= 1) {
if (*(*((argv + (pos << 3)))) != 33)
break;
if (*(*((argv + (pos << 3)))) == 33) {
if (*((*((argv + (pos << 3))) + 1)))
break;
}
advance(0x1);
v1 = !(v1);
}
if (pos >= argc)
beyond();
if (*(*((argv + (pos << 3)))) == 40 && !*((*((argv + (pos << 3))) + 1))) {
advance(0x1);
for (v2 = 1; pos + v2 < argc; v2 += 1) {
if (!strcmp(*((argv + (v2 + pos) * 8)), ")"))
break;
if (v2 == 4) {
v2 = argc - pos;
break;
}
}
v0 = posixtest(v2);
if (!*((argv + (pos << 3))))
test_syntax_error(gettext("%s expected"), quote(")"));
if (*(*((argv + (pos << 3)))) == 41 && !*((*((argv + (pos << 3))) + 1)))
advance(0x0);
if (*((*((argv + (pos << 3))) + 1)) || *(*((argv + (pos << 3)))) != 41) {
quote_n(0x1, *((argv + pos * 8)), pos * 8);
test_syntax_error(gettext("%s expected, found %s"),
quote_n(0x0, ")", v8));
}
}
if (*((*((argv + (pos << 3))) + 1)) || *(*((argv + (pos << 3)))) != 40) {
if (argc - pos > 3) {
v4 = strcmp(*((argv + pos * 8)), "-l");
if (!v4) {
v6 = binop(*((argv + (pos + 2) * 8)));
if (v6)
v0 = binary_operator(0x1);
}
}
if (!v6 || argc - pos <= 3 || v4) {
if (argc - pos > 2) {
v7 = binop(*((argv + (pos + 1) * 8)));
if (v7)
v0 = binary_operator(0x0);
}
if (!v7 || argc - pos <= 2) {
if (*(*((argv + (pos << 3)))) == 45 &&
*((*((argv + (pos << 3))) + 1)) && !*((*((argv + (pos << 3))) + 2)))
v0 = unary_operator();
if (!*((*((argv + (pos << 3))) + 1)) ||
*(*((argv + (pos << 3)))) != 45 ||
*((*((argv + (pos << 3))) + 2))) {
v0 = *(*((argv + (pos << 3))));
advance(0x0);
}
}
}
}
if (*((*((argv + (pos << 3))) + 1)) || *(*((argv + (pos << 3)))) != 40 ||
!*((*((argv + (pos << 3))) + 1)) && *(*((argv + (pos << 3)))) == 41 &&
*((argv + (pos << 3))))
return (v1 ^ v0);
} | coreutils | angr_dream |
static int depmod_modules_build_array(struct depmod *depmod) {
struct hash_iter module_iter;
const void *v;
int err;
hash_iter_init(depmod->modules_by_name, &module_iter);
while (hash_iter_next(&module_iter, ((void *)0), &v)) {
struct mod *mod = (struct mod *)v;
mod->idx = depmod->modules.count;
err = array_append(&depmod->modules, mod);
if (err < 0)
return err;
}
return 0;
} | int depmod_modules_build_array(unsigned long long a0[8]) {
unsigned long long v0;
char v1;
unsigned long long v2;
char v3;
unsigned int v5;
hash_iter_init(a0[7], &v3, &v3);
while (true) {
v5 = hash_iter_next(&v3, 0x0, &v1);
if (v5) {
v2 = *(&v1);
*((v2 + 104)) = a0[3];
*(&v0) = array_append(&a0[2], v2, &a0[2]);
if (v0 >= 0)
continue;
v5 = v0;
break;
} else {
v5 = 0;
break;
}
}
return v5;
} | kmod | angr_dream |
void rl_callback_handler_remove(void) {
rl_linefunc = ((void *)0);
(rl_readline_state &= ~(0x0080000));
do {
if (_rl_caught_signal)
_rl_signal_handler(_rl_caught_signal);
} while (0);
if (in_handler) {
in_handler = 0;
if (rl_deprep_term_function)
(*rl_deprep_term_function)();
rl_clear_signals();
}
} | void rl_callback_handler_remove(void)
{
rl_linefunc = 0;
rl_readline_state = rl_readline_state & 0xfffffffffff7ffff;
if (_rl_caught_signal != 0) {
_rl_signal_handler(_rl_caught_signal);
}
if (in_handler != 0) {
in_handler = 0;
if (rl_deprep_term_function != (code *)0x0) {
(*rl_deprep_term_function)();
}
rl_clear_signals();
}
return;
} | bash | ghidra |
static void print_forceinfo(const struct forceinfo *fi) {
char *desc, *line;
desc = m_strdup(gettext(fi->desc));
line = strtok(desc, "\n");
print_forceinfo_line(fi->type, fi->name, line);
while ((line = strtok(((void *)0), "\n")))
print_forceinfo_line(FORCETYPE_DISABLED, "", line);
free(desc);
} | void print_forceinfo(long a1) {
char *v1;
char *s;
char *v3;
char *v4;
v1 = gettext(*(const char **)(a1 + 16));
s = (char *)m_strdup(v1);
v3 = strtok(s, "\n");
print_forceinfo_line(*(char *)(a1 + 12), *(const char **)a1, v3);
while (1) {
v4 = strtok(0LL, "\n");
if (!v4)
break;
print_forceinfo_line(0, (const char *)&unk_EE5, v4);
}
free(s);
} | dpkg | ida |
void get_ip_addr_set(int type, void *crt) {
int ret = 0, i;
unsigned char ip[16];
int len;
if (batch) {
if (!cfg.ip_addr)
return;
for (i = 0; cfg.ip_addr[i] != ((void *)0); i++) {
len = string_to_ip(ip, cfg.ip_addr[i]);
if (len <= 0) {
fprintf(stderr, "Error parsing address: %s\n", cfg.ip_addr[i]);
exit(1);
}
if (type == 1)
ret = gnutls_x509_crt_set_subject_alt_name(crt, GNUTLS_SAN_IPADDRESS,
ip, len, 1);
else
ret = gnutls_x509_crq_set_subject_alt_name(crt, GNUTLS_SAN_IPADDRESS,
ip, len, 1);
if (ret < 0)
break;
}
} else {
const char *p;
p = read_str("Enter the IP address of the subject of the certificate: ");
if (!p)
return;
len = string_to_ip(ip, p);
if (len <= 0) {
fprintf(stderr, "Error parsing address: %s\n", p);
exit(1);
}
if (type == 1)
ret = gnutls_x509_crt_set_subject_alt_name(crt, GNUTLS_SAN_IPADDRESS, ip,
len, 1);
else
ret = gnutls_x509_crq_set_subject_alt_name(crt, GNUTLS_SAN_IPADDRESS, ip,
len, 1);
}
if (ret < 0) {
fprintf(stderr, "set_subject_alt_name: %s\n", gnutls_strerror(ret));
exit(1);
}
} | long long get_ip_addr_set(unsigned long a0, unsigned long long a1) {
unsigned int v0;
unsigned int v1;
unsigned int v2;
char *v3;
char v4;
v0 = 0;
if (*(got.batch)) {
if (!*((got.cfg + 328)))
goto LABEL_407808;
v1 = 0;
while (true) {
if (!*((*((got.cfg + 328)) + (v1 << 3))))
break;
v2 = string_to_ip(&v4, *((*((got.cfg + 328)) + v1 * 8)));
if (v2 <= 0) {
fprintf(*(*(&got.stderr)), "Error parsing address: %s\n",
*((*((got.cfg + 328)) + v1 * 8)));
exit(0x1);
}
if (a0 != 1)
v0 = gnutls_x509_crq_set_subject_alt_name(a1, 0x4, &v4, v2, 0x1);
else
v0 = gnutls_x509_crt_set_subject_alt_name(a1, 0x4, &v4, v2, 0x1);
if (v0 < 0)
break;
v1 += 1;
}
} else {
v3 = read_str("Enter the IP address of the subject of the certificate: ");
if (!v3)
goto LABEL_407808;
v2 = string_to_ip(&v4, v3);
if (v2 <= 0) {
fprintf(*(*(&got.stderr)), "Error parsing address: %s\n", v3);
exit(0x1);
} else if (a0 == 1) {
v0 = gnutls_x509_crt_set_subject_alt_name(a1, 0x4, &v4, v2, 0x1);
} else {
v0 = gnutls_x509_crq_set_subject_alt_name(a1, 0x4, &v4, v2, 0x1);
}
}
if (v0 < 0) {
fprintf(*(*(&got.stderr)), "set_subject_alt_name: %s\n",
gnutls_strerror(v0));
exit(0x1);
}
LABEL_407808:
return 0;
} | gnutls | angr_phoenix |
static _Bool
is_invoke_action(enum action action) {
switch (action) {
case act_unpack:
case act_configure:
case act_install:
case act_triggers:
case act_remove:
case act_purge:
case act_arch_add:
case act_arch_remove:
return 1;
default:
return 0;
}
} | undefined8 is_invoke_action(uint param_1)
{
if (param_1 < 7) {
if (param_1 != 0) {
return 1;
}
} else if (param_1 - 0x11 < 2) {
return 1;
}
return 0;
} | dpkg | ghidra |
void start_benchmark(struct benchmark_st *st) {
memset(st, 0, sizeof(*st));
st->old_handler = signal(14, alarm_handler);
clock_gettime(2, &st->start);
benchmark_must_finish = 0;
alarm(5);
} | long long start_benchmark(struct_0 *a0) {
memset(a0, 0x0, 0x20);
a0->field_18 = signal(0xe, alarm_handler);
clock_gettime(0x2, a0, a0);
benchmark_must_finish = 0;
return alarm(0x5);
} | gnutls | angr_dream |
static inline __u16 rta_getattr_u16(const struct rtattr *rta) {
return *(__u16 *)((
void *)(((char *)(rta)) +
((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0))));
} | undefined2 rta_getattr_u16(long param_1)
{
return *(undefined2 *)(param_1 + 4);
} | iproute2-6.0.0 | ghidra |
static void generate_private_key(common_info_st *cinfo) {
gnutls_x509_privkey_t key;
key = generate_private_key_int(cinfo);
print_private_key(outfile, cinfo, key);
gnutls_x509_privkey_deinit(key);
} | void generate_private_key(void *a0) {
unsigned long long v0;
unsigned long long v2;
v0 = generate_private_key_int(a0);
print_private_key(outfile, a0, v0, a0);
v2 = gnutls_x509_privkey_deinit(v0);
return;
} | gnutls | angr_dream |
void sv_globignore(name) char *name;
{
if (privileged_mode == 0)
setup_glob_ignore(name);
} | void sv_globignore(unsigned long long a0) {
unsigned long long v1;
unsigned long long v2;
v1 = privileged_mode;
if (!privileged_mode)
v2 = setup_glob_ignore(a0);
return;
} | bash | angr_phoenix |
test_code_t test_gost_imit(gnutls_session_t session) {
int ret;
if (gnutls_fips140_mode_enabled())
return TEST_IGNORE;
sprintf(prio_str,
"NONE:"
"+CIPHER-ALL:+ARCFOUR-128:+3DES-CBC"
":+GOST28147-TC26Z-CNT"
":"
"+COMP-NULL"
":%s:+GOST28147-TC26Z-IMIT:"
"+RSA:+DHE-RSA:+DHE-DSS:+ANON-DH:+ECDHE-RSA:+ECDHE-ECDSA:+ANON-ECDH"
":+VKO-GOST-12"
":%s",
protocol_all_str, rest);
{
int _ret;
if ((_ret = __gnutls_priority_set_direct(session, prio_str, 920)) !=
TEST_SUCCEED) {
return _ret;
}
};
gnutls_credentials_set(session, GNUTLS_CRD_CERTIFICATE, xcred);
ret = test_do_handshake(session);
return ret;
} | long long test_gost_imit(unsigned long long a0) {
unsigned int v0;
unsigned int v1;
unsigned long long v3;
if (gnutls_fips140_mode_enabled()) {
v3 = 3;
} else {
sprintf(&prio_str,
"NONE:+CIPHER-ALL:+ARCFOUR-128:+3DES-CBC:+GOST28147-TC26Z-CNT:+"
"COMP-NULL:%s:+GOST28147-TC26Z-IMIT:+RSA:+DHE-RSA:+DHE-DSS:+ANON-"
"DH:+ECDHE-RSA:+ECDHE-ECDSA:+ANON-ECDH:+VKO-GOST-12:%s",
&protocol_all_str, &rest);
v0 = __gnutls_priority_set_direct(a0, &prio_str, 0x398);
if (v0) {
v3 = v0;
} else {
gnutls_credentials_set(a0, 0x1, xcred);
v1 = test_do_handshake(a0);
v3 = v1;
}
}
return v3;
} | gnutls | angr_phoenix |
static int xfrm_state_flush_print(struct nlmsghdr *n, void *arg) {
FILE *fp = (FILE *)arg;
struct xfrm_usersa_flush *xsf =
((void *)(((char *)n) +
((int)(((sizeof(struct nlmsghdr)) + 4U - 1) & ~(4U - 1)))));
int len = n->nlmsg_len;
const char *str;
len -= (((((sizeof(*xsf)) +
((int)(((sizeof(struct nlmsghdr)) + 4U - 1) & ~(4U - 1))))) +
4U - 1) &
~(4U - 1));
if (len < 0) {
fprintf(stderr, "BUG: wrong nlmsg len %d\n", len);
return -1;
}
fprintf(fp, "Flushed state ");
str = strxf_xfrmproto(xsf->proto);
if (str)
fprintf(fp, "proto %s", str);
else
fprintf(fp, "proto %u", xsf->proto);
fprintf(fp, "%s", _SL_);
if (oneline)
fprintf(fp, "\n");
fflush(fp);
return 0;
} | void xfrm_state_flush_print(unsigned int *a0, void *a1) {
unsigned int v0;
char *v1;
unsigned long v2;
unsigned long long v4;
void *v5;
v1 = &a0[4];
v0 = *(a0);
v0 -= 20;
if (v0 < 0) {
fprintf(stderr, "BUG: wrong nlmsg len %d\n", v0);
v4 = 4294967295;
} else {
fprintf(a1, "Flushed state ");
v2 = strxf_xfrmproto(*(v1));
if (v2)
fprintf(a1, "proto %s", v2);
else
fprintf(a1, "proto %u", *(v1));
fprintf(a1, "%s", _SL_);
if (oneline)
fprintf(a1, "\n");
fflush(a1);
v5 = 0;
}
return;
} | iproute2-6.0.0 | angr_dream |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.