input stringlengths 26 172k | output stringlengths 18 318k | repo_name stringclasses 23 values | decompiler stringclasses 5 values |
|---|---|---|---|
static uintmax_t factor_using_division(uintmax_t *t1p, uintmax_t t1,
uintmax_t t0, struct factors *factors) {
if (t0 % 2 == 0) {
unsigned int cnt;
if (t0 == 0) {
do {
;
__asm__("bsf\t%1, %q0" : "=r"(cnt) : "rm"((UDItype)(t1)));
} while (0);
t0 = t1 >> cnt;
t1 = 0;
cnt += 64;
} else {
do {
;
__asm__("bsf\t%1, %q0" : "=r"(cnt) : "rm"((UDItype)(t0)));
} while (0);
do {
(t0) = ((t1) << (64 - (cnt))) | ((t0) >> (cnt));
(t1) = (t1) >> (cnt);
} while (0);
}
factor_insert_multiplicity(factors, 2, cnt);
}
uintmax_t p = 3;
unsigned int i;
for (i = 0;
t1 > 0 && i < (sizeof(primes_diff) / sizeof(primes_diff[0]) - 8 + 1);
i++) {
for (;;) {
uintmax_t q1, q0, hi;
__attribute__((__unused__)) uintmax_t lo;
q0 = t0 * primes_dtab[i].binv;
__asm__("mulq\t%3"
: "=a"(lo), "=d"(hi)
: "%0"((UDItype)(q0)), "rm"((UDItype)(p)));
if (hi > t1)
break;
hi = t1 - hi;
q1 = hi * primes_dtab[i].binv;
if (__builtin_expect((q1 > primes_dtab[i].lim), 1))
break;
t1 = q1;
t0 = q0;
factor_insert_multiplicity(factors, p, 1);
}
p += primes_diff[i + 1];
}
if (t1p)
*t1p = t1;
for (; i < (sizeof(primes_diff) / sizeof(primes_diff[0]) - 8 + 1); i += 8) {
uintmax_t q;
const struct primes_dtab *pd = &primes_dtab[i];
do {
for (;;) {
q = t0 * pd[0].binv;
if (__builtin_expect((q > pd[0].lim), 1))
break;
t0 = q;
factor_insert_refind(factors, p, i + 1, 0);
}
} while (0);
do {
for (;;) {
q = t0 * pd[1].binv;
if (__builtin_expect((q > pd[1].lim), 1))
break;
t0 = q;
factor_insert_refind(factors, p, i + 1, 1);
}
} while (0);
do {
for (;;) {
q = t0 * pd[2].binv;
if (__builtin_expect((q > pd[2].lim), 1))
break;
t0 = q;
factor_insert_refind(factors, p, i + 1, 2);
}
} while (0);
do {
for (;;) {
q = t0 * pd[3].binv;
if (__builtin_expect((q > pd[3].lim), 1))
break;
t0 = q;
factor_insert_refind(factors, p, i + 1, 3);
}
} while (0);
do {
for (;;) {
q = t0 * pd[4].binv;
if (__builtin_expect((q > pd[4].lim), 1))
break;
t0 = q;
factor_insert_refind(factors, p, i + 1, 4);
}
} while (0);
do {
for (;;) {
q = t0 * pd[5].binv;
if (__builtin_expect((q > pd[5].lim), 1))
break;
t0 = q;
factor_insert_refind(factors, p, i + 1, 5);
}
} while (0);
do {
for (;;) {
q = t0 * pd[6].binv;
if (__builtin_expect((q > pd[6].lim), 1))
break;
t0 = q;
factor_insert_refind(factors, p, i + 1, 6);
}
} while (0);
do {
for (;;) {
q = t0 * pd[7].binv;
if (__builtin_expect((q > pd[7].lim), 1))
break;
t0 = q;
factor_insert_refind(factors, p, i + 1, 7);
}
} while (0);
p += primes_diff8[i];
if (p * p > t0)
break;
}
return t0;
} | ulong factor_using_division(ulong *param_1, ulong param_2, ulong param_3,
undefined8 param_4)
{
long lVar1;
byte bVar2;
long lVar3;
ulong uVar4;
ulong local_60;
ulong local_58;
int iStack72;
uint local_44;
ulong local_40;
local_60 = param_3;
local_58 = param_2;
if ((param_3 & 1) == 0) {
if (param_3 == 0) {
lVar3 = 0;
if (param_2 != 0) {
for (; (param_2 >> lVar3 & 1) == 0; lVar3 = lVar3 + 1) {
}
}
local_60 = param_2 >> ((byte)lVar3 & 0x3f);
local_58 = 0;
iStack72 = (int)lVar3 + 0x40;
} else {
lVar3 = 0;
if (param_3 != 0) {
for (; (param_3 >> lVar3 & 1) == 0; lVar3 = lVar3 + 1) {
}
}
iStack72 = (int)lVar3;
bVar2 = (byte)lVar3;
local_60 = param_3 >> (bVar2 & 0x3f) | param_2 << (0x40 - bVar2 & 0x3f);
local_58 = param_2 >> (bVar2 & 0x3f);
}
factor_insert_multiplicity(param_4, 2, iStack72);
}
local_40 = 3;
for (local_44 = 0; (local_58 != 0 && (local_44 < 0x29c));
local_44 = local_44 + 1) {
while (true) {
lVar3 = *(long *)(primes_dtab + (ulong)local_44 * 0x10);
uVar4 = SUB168(ZEXT816(lVar3 * local_60) * ZEXT816(local_40) >> 0x40, 0);
if ((local_58 < uVar4) ||
(uVar4 = *(long *)(primes_dtab + (ulong)local_44 * 0x10) *
(local_58 - uVar4),
*(ulong *)(primes_dtab + (ulong)local_44 * 0x10 + 8) < uVar4))
break;
factor_insert_multiplicity(param_4, local_40, 1);
local_60 = lVar3 * local_60;
local_58 = uVar4;
}
local_40 = local_40 + (byte)primes_diff[local_44 + 1];
}
if (param_1 != (ulong *)0x0) {
*param_1 = local_58;
}
while (true) {
if (0x29b < local_44) {
return local_60;
}
lVar3 = (ulong)local_44 * 0x10;
while (lVar1 = *(long *)(primes_dtab + lVar3),
lVar1 * local_60 <= *(ulong *)(primes_dtab + lVar3 + 8)) {
factor_insert_refind(param_4, local_40, local_44 + 1, 0);
local_60 = lVar1 * local_60;
}
while (lVar1 = *(long *)(primes_dtab + lVar3 + 0x10),
lVar1 * local_60 <= *(ulong *)(primes_dtab + lVar3 + 0x18)) {
factor_insert_refind(param_4, local_40, local_44 + 1, 1);
local_60 = lVar1 * local_60;
}
while (lVar1 = *(long *)(primes_dtab + lVar3 + 0x20),
lVar1 * local_60 <= *(ulong *)(primes_dtab + lVar3 + 0x28)) {
factor_insert_refind(param_4, local_40, local_44 + 1, 2);
local_60 = lVar1 * local_60;
}
while (lVar1 = *(long *)(primes_dtab + lVar3 + 0x30),
lVar1 * local_60 <= *(ulong *)(primes_dtab + lVar3 + 0x38)) {
factor_insert_refind(param_4, local_40, local_44 + 1, 3);
local_60 = lVar1 * local_60;
}
while (lVar1 = *(long *)(primes_dtab + lVar3 + 0x40),
lVar1 * local_60 <= *(ulong *)(primes_dtab + lVar3 + 0x48)) {
factor_insert_refind(param_4, local_40, local_44 + 1, 4);
local_60 = lVar1 * local_60;
}
while (lVar1 = *(long *)(primes_dtab + lVar3 + 0x50),
lVar1 * local_60 <= *(ulong *)(primes_dtab + lVar3 + 0x58)) {
factor_insert_refind(param_4, local_40, local_44 + 1, 5);
local_60 = lVar1 * local_60;
}
while (lVar1 = *(long *)(primes_dtab + lVar3 + 0x60),
lVar1 * local_60 <= *(ulong *)(primes_dtab + lVar3 + 0x68)) {
factor_insert_refind(param_4, local_40, local_44 + 1, 6);
local_60 = lVar1 * local_60;
}
while (lVar1 = *(long *)(primes_dtab + lVar3 + 0x70),
lVar1 * local_60 <= *(ulong *)(primes_dtab + lVar3 + 0x78)) {
factor_insert_refind(param_4, local_40, local_44 + 1, 7);
local_60 = lVar1 * local_60;
}
local_40 = local_40 + (byte)primes_diff8[local_44];
if (local_60 < local_40 * local_40)
break;
local_44 = local_44 + 8;
}
return local_60;
} | coreutils | ghidra |
void kwsfree(kwset_t kwset) {
__extension__({
struct obstack *__o = (&kwset->obstack);
void *__obj = (void *)(((void *)0));
if (__obj > (void *)__o->chunk && __obj < (void *)__o->chunk_limit)
__o->next_free = __o->object_base = (char *)__obj;
else
_obstack_free(__o, __obj);
});
free(kwset);
} | long long kwsfree(unsigned long long a0[5]) {
void *v0;
v0 = 0;
if (v0 > a0[1] && v0 < a0[4]) {
a0[2] = v0;
a0[3] = a0[2];
goto LABEL_402e32;
}
_obstack_free(a0, v0);
LABEL_402e32:
return free(a0);
} | grep | angr_phoenix |
void file_block_read(struct file_data *current, size_t size) {
if (size && !current->eof) {
size_t s = block_read(
current->desc, ((char *)(current)->buffer) + current->buffered, size);
if (s == (18446744073709551615UL))
pfatal_with_name(current->name);
current->buffered += s;
current->eof = s < size;
}
} | void file_block_read(unsigned int *a1, unsigned long a2) {
unsigned long v2;
if (a2 && *((_BYTE *)a1 + 289) != 1) {
v2 = block_read(*a1, *((_QWORD *)a1 + 20) + *((_QWORD *)a1 + 22), a2);
if (v2 == -1LL)
pfatal_with_name(*((_QWORD *)a1 + 1));
*((_QWORD *)a1 + 22) += v2;
*((_BYTE *)a1 + 289) = v2 < a2;
}
} | diffutils | ida |
printversion(const struct cmdinfo *ci, const char *value) {
printf(gettext("Debian %s package trigger utility version %s.\n"),
dpkg_get_progname(),
"1.20.12"
" ("
"amd64"
")");
printf(gettext(
"This is free software; see the GNU General Public License version 2 or\n"
"later for copying conditions. There is NO warranty.\n")
);
m_output(stdout, gettext("<standard output>"));
exit(0);
} | long long printversion() {
unsigned long v0;
unsigned long v1;
unsigned long v2;
unsigned long v4;
unsigned long v5;
unsigned long v6;
unsigned long long v7;
unsigned long long v8;
v2 = v4;
v1 = v5;
v0 = v6;
v7 = dpkg_get_progname();
printf(gettext("Debian %s package trigger utility version %s.\n"));
printf(gettext(
"This is free software; see the GNU General Public License version 2 "
"or\nlater for copying conditions. There is NO warranty.\n"));
v8 = gettext("<standard output>");
m_output(stdout, v8, v8);
exit(0x0);
} | dpkg | angr_phoenix |
static void certificate_fpr(common_info_st *cinfo) {
gnutls_x509_crt_t crt;
size_t size;
int ret = 0;
gnutls_datum_t pem, tmp;
unsigned int crt_num;
uint8_t fpr[64];
char txt[64 * 2 + 1];
size_t fpr_size;
crt = load_cert(0, cinfo);
if (crt == ((void *)0)) {
pem.data = (void *)_gnutls_fread_file(infile, 0, &size);
pem.size = size;
if (!pem.data) {
fprintf(stderr, "%s", infile ? "file" : "standard input");
app_exit(1);
}
crt_num = 1;
ret =
gnutls_x509_crt_list_import(&crt, &crt_num, &pem, incert_format,
GNUTLS_X509_CRT_LIST_IMPORT_FAIL_IF_EXCEED);
if (ret == -51) {
fprintf(stderr, "too many certificates (%d).", crt_num);
} else if (ret >= 0 && crt_num == 0) {
fprintf(stderr, "no certificates were found.\n");
}
free(pem.data);
}
if (ret < 0) {
fprintf(stderr, "import error: %s\n", gnutls_strerror(ret));
app_exit(1);
}
fpr_size = sizeof(fpr);
if (cinfo->hash == GNUTLS_DIG_UNKNOWN)
cinfo->hash = GNUTLS_DIG_SHA1;
ret = gnutls_x509_crt_get_fingerprint(crt, cinfo->hash, fpr, &fpr_size);
if (ret < 0) {
fprintf(stderr, "get_key_id: %s\n", gnutls_strerror(ret));
app_exit(1);
}
tmp.data = fpr;
tmp.size = fpr_size;
size = sizeof(txt);
ret = gnutls_hex_encode(&tmp, txt, &size);
if (ret < 0) {
fprintf(stderr, "hex_encode: %s\n", gnutls_strerror(ret));
app_exit(1);
}
fputs(txt, outfile);
fputs("\n", outfile);
gnutls_x509_crt_deinit(crt);
return;
} | void certificate_fpr(struct_0 *a0) {
unsigned int v0;
unsigned int v1;
unsigned long long v2;
unsigned long long v3;
unsigned long long v4;
void *v5;
unsigned int v6;
unsigned long v7;
unsigned int v8;
char v9;
char v10;
char v11;
unsigned int v13;
unsigned long long *v14;
unsigned long long v15;
v1 = 0;
v2 = load_cert(0x0, a0);
if (!v2) {
v5 = _gnutls_fread_file(infile, 0x0, &v3);
v6 = *(&v3);
if (v5) {
v0 = 1;
v1 = gnutls_x509_crt_list_import(&v2, &v0, &v5, incert_format, 0x1);
if (v1 == -51) {
fprintf(*(&stderr), "too many certificates (%d).", v0);
} else if (v1 >= 0 && !v0) {
fprintf(*(&stderr), "no certificates were found.\n");
}
free(v5);
} else {
if (!infile)
v13 = &g_40b4c4;
else
v13 = "file";
fprintf(*(&stderr), "%s", v13);
app_exit(0x1);
}
}
if (v1 < 0) {
fprintf(*(&stderr), "import error: %s\n", gnutls_strerror(v1));
app_exit(0x1);
}
v4 = 64;
if (!a0->field_b0)
a0->field_b0 = 3;
v1 = gnutls_x509_crt_get_fingerprint(v2, a0->field_b0, &v9, &v4);
if (v1 < 0) {
fprintf(*(&stderr), "get_key_id: %s\n", gnutls_strerror(v1));
app_exit(0x1);
}
v7 = &v9;
v8 = v4;
v3 = 129;
v1 = gnutls_hex_encode(&v7, &v10, &v3, &v10);
if (v1 < 0) {
fprintf(*(&stderr), "hex_encode: %s\n", gnutls_strerror(v1));
app_exit(0x1);
}
fputs(&v10, outfile);
fputs("\n", outfile);
gnutls_x509_crt_deinit(v2);
v15 = *(&v11) ^ v14[5];
return;
} | gnutls | angr_phoenix |
static void add_to_index(int level, char *item) {
char *c = ((void *)0);
label[3]++;
if (label[3] > 'Z') {
label[3] = 'A';
label[2]++;
}
if (level != subs) {
if (subs) {
strmaxcpy(manidx + mip, "</DL>\n", 10000 - mip);
mip += 6;
} else {
strmaxcpy(manidx + mip, "<DL>\n", 10000 - mip);
mip += 5;
}
}
subs = level;
scan_troff(item, 1, &c);
sprintf(manidx + mip, "<DT><A HREF=\"#%s\">%s</A><DD>\n", label, c);
if (c)
free(c);
while (manidx[mip])
mip++;
} | void add_to_index(unsigned long a0, unsigned long long a1) {
void *v0;
char v1;
unsigned long long *v3;
unsigned long long v4;
v0 = 0;
g_40a8e7 = g_40a8e7 + 1;
if (g_40a8e7 > 90) {
g_40a8e7 = 65;
g_40a8e6 = g_40a8e6 + 1;
}
if (a0 != subs) {
if (!subs) {
strmaxcpy(&(&manidx)[mip], "<DL>\n", 10000 - mip);
mip = mip + 5;
} else {
strmaxcpy(&(&manidx)[mip], "</DL>\n", 10000 - mip);
mip = mip + 6;
}
}
subs = a0;
scan_troff(a1, 0x1, &v0);
sprintf(&(&manidx)[mip], "<DT><A HREF=\"#%s\">%s</A><DD>\n", &label, v0);
if (v0)
free(v0);
for (; *(&(&manidx)[mip]); mip = mip + 1)
;
v4 = *(&v1) ^ v3[5];
return;
} | bash | angr_phoenix |
void channel_set_af(struct ssh *ssh, int af) { ssh->chanctxt->IPv4or6 = af; } | long long channel_set_af(struct_0 *a0, unsigned long a1) {
struct_1 *v1;
v1 = a0->field_868;
a0->field_868->field_9c = a1;
return v1;
} | openssh-portable | angr_dream |
static void hg_addfn(struct exclude *ex, char const *pattern, int options,
void *data) {
int *hgopt = data;
size_t len;
while (((*__ctype_b_loc())[(int)((*pattern))] & (unsigned short int)_ISspace))
++pattern;
if (*pattern == 0 || *pattern == '#')
return;
if (strncmp(pattern, "syntax:", 7) == 0) {
for (pattern += 7;
((*__ctype_b_loc())[(int)((*pattern))] & (unsigned short int)_ISspace);
++pattern)
;
if (strcmp(pattern, "regexp") == 0)
*hgopt = (1 << 27);
else if (strcmp(pattern, "glob") == 0)
*hgopt = (1 << 28);
return;
}
len = strlen(pattern);
if (pattern[len - 1] == '/') {
char *p;
--len;
p = xmalloc(len + 1);
memcpy(p, pattern, len);
p[len] = 0;
pattern = p;
exclude_add_pattern_buffer(ex, p);
options |= (1 << 3) | (1 << 26);
}
add_exclude(ex, pattern,
((*hgopt == (1 << 27)) ? (options & ~(1 << 28))
: (options & ~(1 << 27))) |
*hgopt);
} | long long hg_addfn(unsigned long long a0, void *a1, unsigned long a2,
unsigned int *a3) {
unsigned long long v0;
char *v1;
unsigned long v2;
char *v3;
unsigned int v6;
unsigned long long v7;
v1 = a1;
*(&v0) = a2;
while (true) {
v6 = *((*(v1) * 2 + *(__ctype_b_loc()))) & 0x2000;
if (!v6)
break;
v1 += 1;
}
v7 = *(v1);
if (*(v1)) {
v7 = *(v1);
if (*(v1) != 35) {
if (strncmp(v1, "syntax:", 0x7)) {
v2 = strlen(v1);
if (v1[1 + v2] == 47) {
v2 -= 1;
v3 = xmalloc(v2 + 1);
memcpy(v3, v1, v2);
*((v2 + v3)) = 0;
v1 = v3;
exclude_add_pattern_buffer(a0, v3, v3);
*(&v0) = v0 | 67108872;
}
if (*(a3) != 0x8000000)
*(&v7) = v0 & -134217729;
else
*(&v7) = v0 & 4026531839;
v7 = add_exclude(a0, v1, *(a3) | v7, v1);
} else {
v1 += 7;
while (true) {
*(&v7) = *((*(v1) * 2 + *(__ctype_b_loc())));
*(&v7) = v7 & 0x2000;
if (!v7)
break;
v1 += 1;
}
if (!strcmp(v1, "regexp")) {
v7 = a3;
*(a3) = 0x8000000;
} else {
v7 = strcmp(v1, "glob");
if (!v7) {
v7 = a3;
*(a3) = 0x10000000;
}
}
}
}
}
return v7;
} | tar | angr_phoenix |
static int quota_inum_is_super(struct ext2_super_block *sb, ext2_ino_t ino) {
enum quota_type qtype;
for (qtype = 0; qtype < MAXQUOTAS; qtype++)
if (*quota_sb_inump(sb, qtype) == ino)
return 1;
return 0;
} | int quota_inum_is_super(unsigned int a0, unsigned long a1) {
unsigned int v0;
unsigned int v3;
v0 = 0;
while (true) {
if (v0 > 2) {
v3 = 0;
return v3;
} else if (a1 != *(quota_sb_inump(a0, v0))) {
v0 += 1;
} else {
v3 = 1;
return v3;
}
}
} | e2fsprogs-1.46.5 | angr_sailr |
static int isgrp(const char *name, const char *group) {
struct group *grp;
grp = getgrnam(group);
if (!grp || !grp->gr_mem)
return 0;
return is_on_list(grp->gr_mem, name);
} | undefined isgrp(undefined8 param_1, char *param_2)
{
undefined uVar1;
group *pgVar2;
pgVar2 = getgrnam(param_2);
if ((pgVar2 == (group *)0x0) || (pgVar2->gr_mem == (char **)0x0)) {
uVar1 = 0;
} else {
uVar1 = is_on_list(pgVar2->gr_mem, param_1);
}
return uVar1;
} | shadow | ghidra |
ptrdiff_t Pexecute(void *vcp, char const *buf, idx_t size, idx_t *match_size,
char const *start_ptr) {
char const *p = start_ptr ? start_ptr : buf;
_Bool bol = p[-1] == eolbyte;
char const *line_start = buf;
int e = (-1);
char const *line_end;
struct pcre_comp *pc = vcp;
size_t *sub = pcre2_get_ovector_pointer_8(pc->data);
char const *subject = buf;
do {
line_end = rawmemchr(p, eolbyte);
if ((18446744073709551615UL) < line_end - p)
((!!sizeof(struct {
_Static_assert(EXIT_TROUBLE,
"verify_expr ("
"EXIT_TROUBLE"
", "
"(error (EXIT_TROUBLE, 0, gettext(\"exceeded PCRE's "
"line length limit\")), assume (false))"
")");
int _gl_dummy;
}))
? ((error(EXIT_TROUBLE, 0,
gettext("exceeded PCRE's line length limit")),
((0) ? (void)0 : __builtin_unreachable())))
: ((error(EXIT_TROUBLE, 0,
gettext("exceeded PCRE's line length limit")),
((0) ? (void)0 : __builtin_unreachable()))));
for (;;) {
while (localeinfo.sbclen[to_uchar(*p)] == -1) {
p++;
subject = p;
bol = 0;
}
idx_t search_offset = p - subject;
if (p == line_end) {
sub[0] = sub[1] = search_offset;
e = pc->empty_match[bol];
break;
}
int options = 0;
if (!bol)
options |= 0x00000001u;
e = jit_exec(pc, subject, line_end - subject, search_offset, options);
if (!bad_utf8_from_pcre2(e))
break;
idx_t valid_bytes = pcre2_get_startchar_8(pc->data);
if (search_offset <= valid_bytes) {
if (valid_bytes == 0) {
sub[0] = valid_bytes;
sub[1] = 0;
e = pc->empty_match[bol];
} else
e = jit_exec(pc, subject, valid_bytes, search_offset,
options | 0x40000000u | 0x00000002u);
if (e != (-1))
break;
p = subject + valid_bytes + 1;
bol = 0;
}
subject += valid_bytes + 1;
}
if (e != (-1))
break;
bol = 1;
p = subject = line_start = line_end + 1;
} while (p < buf + size);
if (e <= 0) {
switch (e) {
case (-1):
break;
case (-48):
((!!sizeof(struct {
_Static_assert(EXIT_TROUBLE,
"verify_expr ("
"EXIT_TROUBLE"
", "
"(error (EXIT_TROUBLE, 0, gettext(\"%s: memory "
"exhausted\"), input_filename ()), assume (false))"
")");
int _gl_dummy;
}))
? ((error(EXIT_TROUBLE, 0, gettext("%s: memory exhausted"),
input_filename()),
((0) ? (void)0 : __builtin_unreachable())))
: ((error(EXIT_TROUBLE, 0, gettext("%s: memory exhausted"),
input_filename()),
((0) ? (void)0 : __builtin_unreachable()))));
case (-46):
((!!sizeof(struct {
_Static_assert(EXIT_TROUBLE,
"verify_expr ("
"EXIT_TROUBLE"
", "
"(error (EXIT_TROUBLE, 0, gettext(\"%s: exhausted PCRE "
"JIT stack\"), input_filename ()), assume (false))"
")");
int _gl_dummy;
}))
? ((error(EXIT_TROUBLE, 0, gettext("%s: exhausted PCRE JIT stack"),
input_filename()),
((0) ? (void)0 : __builtin_unreachable())))
: ((error(EXIT_TROUBLE, 0, gettext("%s: exhausted PCRE JIT stack"),
input_filename()),
((0) ? (void)0 : __builtin_unreachable()))));
case (-47):
((!!sizeof(struct {
_Static_assert(
EXIT_TROUBLE,
"verify_expr ("
"EXIT_TROUBLE"
", "
"(error (EXIT_TROUBLE, 0, gettext(\"%s: exceeded PCRE's "
"backtracking limit\"), input_filename ()), assume (false))"
")");
int _gl_dummy;
}))
? ((error(EXIT_TROUBLE, 0,
gettext("%s: exceeded PCRE's backtracking limit"),
input_filename()),
((0) ? (void)0 : __builtin_unreachable())))
: ((error(EXIT_TROUBLE, 0,
gettext("%s: exceeded PCRE's backtracking limit"),
input_filename()),
((0) ? (void)0 : __builtin_unreachable()))));
case (-53):
((!!sizeof(struct {
_Static_assert(
EXIT_TROUBLE,
"verify_expr ("
"EXIT_TROUBLE"
", "
"(error (EXIT_TROUBLE, 0, gettext(\"%s: exceeded PCRE's nested "
"backtracking limit\"), input_filename ()), assume (false))"
")");
int _gl_dummy;
}))
? ((error(EXIT_TROUBLE, 0,
gettext("%s: exceeded PCRE's nested backtracking limit"),
input_filename()),
((0) ? (void)0 : __builtin_unreachable())))
: ((error(EXIT_TROUBLE, 0,
gettext("%s: exceeded PCRE's nested backtracking limit"),
input_filename()),
((0) ? (void)0 : __builtin_unreachable()))))
;
case (-52):
((!!sizeof(struct {
_Static_assert(EXIT_TROUBLE,
"verify_expr ("
"EXIT_TROUBLE"
", "
"(error (EXIT_TROUBLE, 0, gettext(\"%s: PCRE detected "
"recurse loop\"), input_filename ()), assume (false))"
")");
int _gl_dummy;
}))
? ((error(EXIT_TROUBLE, 0, gettext("%s: PCRE detected recurse loop"),
input_filename()),
((0) ? (void)0 : __builtin_unreachable())))
: ((error(EXIT_TROUBLE, 0, gettext("%s: PCRE detected recurse loop"),
input_filename()),
((0) ? (void)0 : __builtin_unreachable()))));
case (-63):
((!!sizeof(struct {
_Static_assert(EXIT_TROUBLE,
"verify_expr ("
"EXIT_TROUBLE"
", "
"(error (EXIT_TROUBLE, 0, gettext(\"%s: exceeded PCRE's "
"heap limit\"), input_filename ()), assume (false))"
")");
int _gl_dummy;
}))
? ((error(EXIT_TROUBLE, 0, gettext("%s: exceeded PCRE's heap limit"),
input_filename()),
((0) ? (void)0 : __builtin_unreachable())))
: ((error(EXIT_TROUBLE, 0, gettext("%s: exceeded PCRE's heap limit"),
input_filename()),
((0) ? (void)0 : __builtin_unreachable()))));
default:
((!!sizeof(struct {
_Static_assert(EXIT_TROUBLE,
"verify_expr ("
"EXIT_TROUBLE"
", "
"(error (EXIT_TROUBLE, 0, gettext(\"%s: internal PCRE "
"error: %d\"), input_filename (), e), assume (false))"
")");
int _gl_dummy;
}))
? ((error(EXIT_TROUBLE, 0, gettext("%s: internal PCRE error: %d"),
input_filename(), e),
((0) ? (void)0 : __builtin_unreachable())))
: ((error(EXIT_TROUBLE, 0, gettext("%s: internal PCRE error: %d"),
input_filename(), e),
((0) ? (void)0 : __builtin_unreachable()))));
}
return -1;
} else {
char const *matchbeg = subject + sub[0];
char const *matchend = subject + sub[1];
char const *beg;
char const *end;
if (start_ptr) {
beg = matchbeg;
end = matchend;
} else {
beg = line_start;
end = line_end + 1;
}
*match_size = end - beg;
return beg - buf;
}
} | long long Pexecute(struct_0 *a0, void *a1, unsigned long a2,
unsigned long long *a3, unsigned long a4) {
char v0;
unsigned int v1;
unsigned int v2;
char *v3;
char *v4;
char *v5;
char *v6;
char *v7;
unsigned long long v8[2];
unsigned long v9;
unsigned long long v10;
unsigned long long v11;
unsigned long v12;
unsigned long v13;
unsigned long long v16;
unsigned long long v17;
unsigned long long v18;
unsigned long long v19;
unsigned long long v20;
unsigned long long v21;
unsigned long long v22;
unsigned long long v23;
unsigned long long v24;
*(&v3) = (!a4 ? a4 : a1);
v0 = v3[1] == eolbyte;
v4 = a1;
v1 = -1;
v8[0] = pcre2_get_ovector_pointer_8(a0->field_18);
v5 = a1;
do {
v9 = rawmemchr(v3, eolbyte);
while (true) {
while (true) {
v16 = to_uchar(*(v3));
*(&v16) = *((v16 + 5242995));
if (v16 != 255)
break;
v3 += 1;
v5 = v3;
v0 = 0;
}
v10 = v3 - v5;
if (v3 == v9) {
v8[1] = v10;
v8[0] = v8[1];
v1 = (&a0->field_0)[v0 + 12];
break;
} else {
v2 = 0;
if ((v0 ^ 1))
v2 |= 1;
v1 = jit_exec(a0, v5, v9 + -0x1 * v5, v10, v2);
*(&v16) = bad_utf8_from_pcre2(v1) ^ 1;
if (v16)
break;
v11 = pcre2_get_startchar_8(a0->field_18);
if (v10 <= v11) {
if (!v11) {
v8[0] = v11;
v8[1] = 0;
v1 = (&a0->field_0)[v0 + 12];
} else {
v1 = jit_exec(a0, v5, v11, v10, v2 | 1073741826);
}
if (v1 != -1)
break;
v3 = &v5[1 + v11];
v0 = 0;
}
v5 = &v5[1 + v11];
}
}
if (!(v1 == -1) ||
!((v0 = 1, v4 = (v9 + 1), v5 = v4, v3 = v5, v3 < a1 + a2)))
break;
} while ((v0 = 1, v4 = (v9 + 1), v5 = v4, v3 = v5, v3 < a1 + a2));
if (v1 > 0) {
v12 = &v5[v8[0]];
v13 = &v5[v8[1]];
if (a4) {
v6 = v12;
v7 = v13;
} else {
v6 = v4;
v7 = v9 + 1;
}
*(a3) = v7 - v6;
v17 = v6 - a1;
return v17;
}
if (v1 > -46) {
if (!(v1 == -1))
goto LABEL_400b0b;
v17 = -1;
return v17;
}
if (v1 < -63)
goto LABEL_400b0b;
switch (v1) {
case -63:
v24 = input_filename();
error(0x2, 0x0, gettext("%s: exceeded PCRE's heap limit"));
case -53:
v19 = input_filename();
error(0x2, 0x0, gettext("%s: exceeded PCRE's nested backtracking limit"));
case -52:
v21 = input_filename();
error(0x2, 0x0, gettext("%s: PCRE detected recurse loop"));
case -48:
v23 = input_filename();
error(0x2, 0x0, gettext("%s: memory exhausted"));
case -47:
v22 = input_filename();
error(0x2, 0x0, gettext("%s: exceeded PCRE's backtracking limit"));
case -46:
v20 = input_filename();
error(0x2, 0x0, gettext("%s: exhausted PCRE JIT stack"));
default:
LABEL_400b0b:
v18 = input_filename();
error(0x2, 0x0, gettext("%s: internal PCRE error: %d"));
}
} | grep | angr_sailr |
HIST_ENTRY *previous_history(void) {
HistEvent ev;
if (history_offset == 0)
return ((void *)0);
if (history(h, &ev, 4) != 0)
return ((void *)0);
history_offset--;
return current_history();
} | long long previous_history() {
char v0;
void *v2;
if (!*(got.history_offset)) {
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_phoenix |
static void assign_time_option(char **sval, time_t *tval, const char *input) {
char *p;
struct timespec t = decode_timespec(input, &p, 0);
if (!valid_timespec(t) || *p)
do {
if (error_hook)
error_hook();
error(0, 0, gettext("Time stamp is out of allowed range"));
exit_status = 2;
} while (0);
else {
*tval = t.tv_sec;
assign_string(sval, input);
}
} | void assign_time_option(undefined8 param_1, undefined8 *param_2,
undefined8 param_3)
{
char cVar1;
undefined8 uVar2;
long in_FS_OFFSET;
char *local_30;
undefined local_28[24];
long local_10;
local_10 = *(long *)(in_FS_OFFSET + 0x28);
local_28._0_16_ = decode_timespec(param_3, &local_30, 0);
cVar1 = valid_timespec(SUB168(local_28._0_16_, 0),
SUB168(local_28._0_16_ >> 0x40, 0));
if ((cVar1 == '\x01') && (*local_30 == '\0')) {
*param_2 = local_28._0_8_;
assign_string(param_1, param_3);
} else {
if (error_hook != (code *)0x0) {
(*error_hook)();
}
uVar2 = gettext("Time stamp is out of allowed range");
error(0, 0, uVar2);
_exit_status = 2;
}
if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) {
__stack_chk_fail();
}
return;
} | tar | ghidra |
static _Bool
fgrep_icase_available(char const *pat, idx_t patlen) {
mbstate_t mbs = {
0,
};
for (idx_t i = 0; i < patlen;) {
int n = fgrep_icase_charlen(pat + i, patlen - i, &mbs);
if (n < 0)
return 0;
i += n;
}
return 1;
} | int fgrep_icase_available(unsigned long a0, unsigned long a1) {
unsigned int v0;
void *v1;
void *v2;
unsigned int v4;
v2 = 0;
v1 = 0;
while (true) {
if (v1 < a1) {
v0 = fgrep_icase_charlen(v1 + a0, a1 - v1, &v2);
if (v0 < 0) {
v4 = 0;
return v4;
}
v1 += v0;
} else {
v4 = 1;
return v4;
}
}
} | grep | angr_sailr |
host, host_key, options.hash_known_hosts) &&
add_host_to_hostfile(user_hostfiles[0], ip,
host_key, options.hash_known_hosts);
}
else { | {
v19 = (unsigned int)add_host_to_hostfile(*a8, v48, a5, options[1245]) &&
(unsigned int)add_host_to_hostfile(*a8, s2, a5, options[1245]);
v31 = v19;
} | openssh-portable | ida |
static inline __u32 rta_getattr_u32(const struct rtattr *rta) {
return *(__u32 *)((
void *)(((char *)(rta)) +
((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0))));
} | long rta_getattr_u32(long a1) { return *(unsigned int *)(a1 + 4); } | iproute2-6.0.0 | ida |
static char *prepare_proctitle(int ac, char **av) {
char *ret = ((void *)0);
int i;
for (i = 0; i < ac; i++)
xextendf(&ret, " ", "%s", av[i]);
return ret;
} | int prepare_proctitle(unsigned long a0, unsigned long long *a1) {
unsigned int v0;
void *v1;
v1 = 0;
for (v0 = 0; v0 < a0; v0 = __addvsi3(v0, 0x1)) {
xextendf(&v1, " ", "%s", a1[v0]);
}
return v1;
} | openssh-portable | angr_sailr |
static _Bool
oldgnu_fixup_header(struct tar_sparse_file *file) {
off_t realsize =
off_from_header(current_header->oldgnu_header.realsize,
sizeof(current_header->oldgnu_header.realsize));
file->stat_info->archive_file_size = file->stat_info->stat.st_size;
file->stat_info->stat.st_size = ((0) < (realsize) ? (realsize) : (0));
return 0 <= realsize;
} | ulong oldgnu_fixup_header(long param_1)
{
ulong uVar1;
ulong uVar2;
uVar1 = off_from_header(current_header + 0x1e3, 0xc);
*(undefined8 *)(*(long *)(param_1 + 0x18) + 0x118) =
*(undefined8 *)(*(long *)(param_1 + 0x18) + 0x88);
uVar2 = 0;
if (-1 < (long)uVar1) {
uVar2 = uVar1;
}
*(ulong *)(*(long *)(param_1 + 0x18) + 0x88) = uVar2;
return ~uVar1 >> 0x3f;
} | tar | ghidra |
void channel_send_window_changes(struct ssh *ssh) {
struct ssh_channels *sc = ssh->chanctxt;
struct winsize ws;
int r;
u_int i;
for (i = 0; i < sc->channels_alloc; i++) {
if (sc->channels[i] == ((void *)0) || !sc->channels[i]->client_tty ||
sc->channels[i]->type != 4)
continue;
if (ioctl(sc->channels[i]->rfd, 0x5413, &ws) == -1)
continue;
channel_request_start(ssh, i, "window-change", 0);
if ((r = sshpkt_put_u32(ssh, (u_int)ws.ws_col)) != 0 ||
(r = sshpkt_put_u32(ssh, (u_int)ws.ws_row)) != 0 ||
(r = sshpkt_put_u32(ssh, (u_int)ws.ws_xpixel)) != 0 ||
(r = sshpkt_put_u32(ssh, (u_int)ws.ws_ypixel)) != 0 ||
(r = sshpkt_send(ssh)) != 0)
sshfatal("channels.c", __func__, 4726, 1, SYSLOG_LEVEL_FATAL, ssh_err(r),
"channel %u; send window-change", i);
}
} | void channel_send_window_changes(long param_1)
{
int iVar1;
undefined8 uVar2;
undefined *puVar3;
undefined *puVar4;
long in_FS_OFFSET;
char *apcStack80[2];
ulong uStack64;
undefined auStack56[8];
long local_30;
int local_28;
uint local_24;
long *local_20;
undefined2 local_18;
undefined2 local_16;
undefined2 local_14;
undefined2 local_12;
long local_10;
local_10 = *(long *)(in_FS_OFFSET + 0x28);
local_20 = *(long **)(param_1 + 0x868);
local_24 = 0;
puVar4 = auStack56;
local_30 = param_1;
do {
if (*(uint *)(local_20 + 1) <= local_24) {
if (local_10 == *(long *)(in_FS_OFFSET + 0x28)) {
return;
}
*(undefined8 *)(puVar4 + -8) = 0x10f8f0;
__stack_chk_fail();
}
puVar3 = puVar4;
if (((*(long *)(*local_20 + (ulong)local_24 * 8) != 0) &&
(*(int *)(*(long *)(*local_20 + (ulong)local_24 * 8) + 0x4c) != 0)) &&
(**(int **)(*local_20 + (ulong)local_24 * 8) == 4)) {
iVar1 = *(int *)(*(long *)(*local_20 + (ulong)local_24 * 8) + 0x1c);
*(undefined8 *)(puVar4 + -8) = 0x10f7ce;
iVar1 = ioctl(iVar1, 0x5413, &local_18);
if (iVar1 != -1) {
*(undefined8 *)(puVar4 + -8) = 0x10f7f2;
channel_request_start(local_30, local_24, "window-change", 0);
*(undefined8 *)(puVar4 + -8) = 0x10f807;
local_28 = sshpkt_put_u32(local_30, local_16);
if (local_28 == 0) {
*(undefined8 *)(puVar4 + -8) = 0x10f825;
local_28 = sshpkt_put_u32(local_30, local_18);
if (local_28 == 0) {
*(undefined8 *)(puVar4 + -8) = 0x10f843;
local_28 = sshpkt_put_u32(local_30, local_14);
if (local_28 == 0) {
*(undefined8 *)(puVar4 + -8) = 0x10f861;
local_28 = sshpkt_put_u32(local_30, local_12);
if (local_28 == 0) {
*(undefined8 *)(puVar4 + -8) = 0x10f876;
local_28 = sshpkt_send();
if (local_28 == 0)
goto LAB_0010f8c7;
}
}
}
}
*(undefined8 *)(puVar4 + -8) = 0x10f889;
uVar2 = ssh_err(local_28);
*(ulong *)(puVar4 + -8) = (ulong)local_24;
puVar3 = puVar4 + -0x10;
*(char **)(puVar4 + -0x10) = "channel %u; send window-change";
*(undefined8 *)(puVar4 + -0x18) = 0x10f8c3;
sshfatal("channels.c", "channel_send_window_changes", 0x1276, 1, 1,
uVar2);
}
}
LAB_0010f8c7:
local_24 = local_24 + 1;
puVar4 = puVar3;
} while (true);
} | openssh-portable | ghidra |
static void check_flags(void) {
if (sflg && !(((void *)0) != crypt_method)) {
fprintf(stderr, gettext("%s: %s flag is only allowed with the %s flag\n"),
Prog, "-s", "-c");
usage(2);
}
if ((eflg && (md5flg || (((void *)0) != crypt_method))) ||
(md5flg && (((void *)0) != crypt_method))) {
fprintf(stderr, gettext("%s: the -c, -e, and -m flags are exclusive\n"),
Prog);
usage(2);
}
if ((((void *)0) != crypt_method)) {
if ((!((crypt_method != ((void *)0) && strcmp(crypt_method, "DES") == 0)
? 1
: 0)) &&
(!((crypt_method != ((void *)0) && strcmp(crypt_method, "MD5") == 0)
? 1
: 0)) &&
(!((crypt_method != ((void *)0) && strcmp(crypt_method, "NONE") == 0)
? 1
: 0))
&&
(!((crypt_method != ((void *)0) && strcmp(crypt_method, "SHA256") == 0)
? 1
: 0)) &&
(!((crypt_method != ((void *)0) && strcmp(crypt_method, "SHA512") == 0)
? 1
: 0))
) {
fprintf(stderr, gettext("%s: unsupported crypt method: %s\n"), Prog,
crypt_method);
usage(2);
}
}
} | void check_flags() {
unsigned long long v1;
if (sflg && !crypt_method) {
fprintf(*(&stderr),
gettext("%s: %s flag is only allowed with the %s flag\n"));
usage(0x2);
}
if (eflg) {
if (!(!md5flg))
goto LABEL_400544;
if (!(!crypt_method))
goto LABEL_400544;
}
if (!md5flg) {
LABEL_40057e:
v1 = crypt_method;
if (crypt_method) {
if (crypt_method && !strcmp(crypt_method, "DES"))
goto LABEL_400699;
if (crypt_method && !strcmp(crypt_method, "MD5"))
goto LABEL_400699;
if (crypt_method && !strcmp(crypt_method, "NONE"))
goto LABEL_400699;
if (crypt_method && !strcmp(crypt_method, "SHA256"))
goto LABEL_400699;
if (!crypt_method) {
LABEL_400658:
fprintf(*(&stderr), gettext("%s: unsupported crypt method: %s\n"));
usage(0x2);
}
if (!(!strcmp(crypt_method, "SHA512")))
goto LABEL_400658;
}
LABEL_400699:
return;
} else if (!crypt_method) {
goto LABEL_40057e;
}
LABEL_400544:
fprintf(*(&stderr), gettext("%s: the -c, -e, and -m flags are exclusive\n"));
usage(0x2);
} | shadow | angr_phoenix |
int _rl_abort_internal(void) {
if ((rl_readline_state & (0x4000000)) == 0)
rl_ding();
rl_clear_message();
_rl_reset_argument();
rl_clear_pending_input();
rl_deactivate_mark();
while (rl_executing_macro)
_rl_pop_executing_macro();
_rl_kill_kbd_macro();
(rl_readline_state &= ~(0x0200000));
rl_last_func = (rl_command_func_t *)((void *)0);
siglongjmp((_rl_top_level), (1));
return (0);
} | void _rl_abort_internal(void)
{
if ((rl_readline_state & 0x4000000) == 0) {
rl_ding();
}
rl_clear_message();
_rl_reset_argument();
rl_clear_pending_input();
rl_deactivate_mark();
while (rl_executing_macro != 0) {
_rl_pop_executing_macro();
}
_rl_kill_kbd_macro();
rl_readline_state = rl_readline_state & 0xffffffffffdfffff;
_rl_last_func = 0;
siglongjmp((__jmp_buf_tag *)&_rl_top_level, 1);
} | bash | ghidra |
static int receive_state(int fd) {
FILE *f;
char old_version[256];
CHILD **pp;
f = fdopen(fd, "r");
if (get_cmd(f) != 1) {
fclose(f);
return -1;
}
get_string(old_version, sizeof(old_version), f);
oops_error = 0;
for (pp = &family; (*pp = get_record(f)) != ((void *)0); pp = &((*pp)->next))
;
fclose(f);
return oops_error;
} | void receive_state(unsigned long a0, unsigned long a1, unsigned long a2,
unsigned long a3, unsigned long long a4, unsigned int a5) {
unsigned long long v0;
void *v1;
char v2;
unsigned long long v4;
unsigned long long v5;
v1 = fdopen(a0, "r");
if (get_cmd(v1) != 1) {
fclose(v1);
v4 = 4294967295;
} else {
get_string(&v2, 0x100, v1);
oops_error = 0;
v0 = &family;
while (true) {
*(v0) = get_record(v1, 0x100, v0, a3, a4, a5);
if (!*(v0))
break;
v0 = *(v0) + 192;
}
fclose(v1);
v5 = 874961156424106824;
}
return;
} | sysvinit | angr_phoenix |
static void process_flags(int argc, char **argv) {
int c;
static struct option long_options[] = {{"help", 0, ((void *)0), 'h'},
{"force", 0, ((void *)0), 'f'},
{"root", 1, ((void *)0), 'R'},
{"prefix", 1, ((void *)0), 'P'},
{((void *)0), 0, ((void *)0), '\0'}};
while ((c = getopt_long(argc, argv, "hfR:P:", long_options, ((void *)0))) !=
-1) {
switch (c) {
case 'h':
usage(0);
break;
case 'R':
break;
case 'P':
break;
case 'f':
check_group_busy = 0;
break;
default:
usage(2);
}
}
if (optind != argc - 1) {
usage(2);
}
group_name = argv[optind];
} | void process_flags(int param_1, long param_2)
{
int iVar1;
do {
while (true) {
while (true) {
iVar1 = getopt_long(param_1, param_2, "hfR:P:", long_options_5783, 0);
if (iVar1 == -1) {
if (param_1 + -1 != optind) {
usage(2);
}
group_name = *(undefined8 *)(param_2 + (long)optind * 8);
return;
}
if (iVar1 != 0x68)
break;
usage();
}
if (iVar1 < 0x69)
break;
LAB_001008a5:
usage();
}
if (iVar1 == 0x66) {
check_group_busy = 0;
} else if ((0x66 < iVar1) || ((iVar1 != 0x50 && (iVar1 != 0x52))))
goto LAB_001008a5;
} while (true);
} | shadow | ghidra |
static void queue_check_insert(struct merge_node_queue *queue,
struct merge_node *node) {
if (!node->queued) {
_Bool lo_avail = (node->lo - node->end_lo) != 0;
_Bool hi_avail = (node->hi - node->end_hi) != 0;
if (lo_avail ? hi_avail || !node->nhi : hi_avail && !node->nlo)
queue_insert(queue, node);
}
} | int queue_check_insert(long a1, long a2) {
int result;
bool v3;
bool v4;
result = *(unsigned char *)(a2 + 84) ^ 1;
if (*(_BYTE *)(a2 + 84) != 1) {
if (*(_QWORD *)a2 == *(_QWORD *)(a2 + 16)) {
v4 = *(_QWORD *)(a2 + 8) != *(_QWORD *)(a2 + 24) && !*(_QWORD *)(a2 + 40);
result = v4;
} else {
v3 = *(_QWORD *)(a2 + 8) != *(_QWORD *)(a2 + 24) || !*(_QWORD *)(a2 + 48);
result = v3;
}
if ((_BYTE)result)
return queue_insert(a1, a2);
}
return result;
} | coreutils | ida |
static inline __u64 rta_getattr_u64(const struct rtattr *rta) {
__u64 tmp;
memcpy(&tmp,
((void *)(((char *)(rta)) +
((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0)))),
sizeof(__u64));
return tmp;
} | int rta_getattr_u64(unsigned long a0) {
char v0;
memcpy(&v0, a0 + 4, 0x8);
return *(&v0);
} | iproute2-6.0.0 | angr_sailr |
void seedrand32() {
unsigned int iv;
iv = genseed();
sbrand32(iv);
} | long long seedrand32() {
unsigned int v0;
v0 = genseed();
return sbrand32(v0);
} | bash | angr_sailr |
void hash_reset_tuning(Hash_tuning *tuning) { *tuning = default_tuning; } | long hash_reset_tuning(long a1) {
long result;
*(_DWORD *)a1 = 0;
*(_DWORD *)(a1 + 4) = 1065353216;
*(_DWORD *)(a1 + 8) = 1061997773;
*(_DWORD *)(a1 + 12) = 1068826100;
result = a1;
*(_BYTE *)(a1 + 16) = 0;
return result;
} | gnutls | ida |
static _Bool
mode_changed(int dir_fd, char const *file, char const *file_full_name,
mode_t old_mode, mode_t new_mode) {
if (new_mode & (04000 | 02000 | 01000)) {
struct stat new_stats;
if (fstatat(dir_fd, file, &new_stats, 0) != 0) {
if (!force_silent)
error(
0, (*__errno_location()), gettext("getting new attributes of %s"),
quotearg_style(shell_escape_always_quoting_style, file_full_name));
return 0;
}
new_mode = new_stats.st_mode;
}
return ((old_mode ^ new_mode) &
(04000 | 02000 | 01000 | (0400 | 0200 | 0100) |
((0400 | 0200 | 0100) >> 3) | (((0400 | 0200 | 0100) >> 3) >> 3))) !=
0;
} | bool mode_changed(int a1, const char *a2, long a3, unsigned short a4,
unsigned short a5) {
long v5;
char *v6;
int *v7;
unsigned short st_mode;
struct stat buf;
unsigned long v13;
st_mode = a5;
v13 = __readfsqword(0x28u);
if ((a5 & 0xE00) == 0)
return ((st_mode ^ a4) & 0xFFF) != 0;
if (!fstatat(a1, a2, &buf, 0)) {
st_mode = buf.st_mode;
return ((st_mode ^ a4) & 0xFFF) != 0;
}
if (force_silent != 1) {
v5 = quotearg_style(4LL, a3);
v6 = gettext("getting new attributes of %s");
v7 = _errno_location();
error(0, *v7, v6, v5);
}
return 0;
} | coreutils | ida |
int main(int argc, char **argv) {
const struct spwd *sp;
uid_t ruid;
gid_t rgid;
const struct passwd *pw;
Prog = Basename(argv[0]);
log_set_progname(Prog);
log_set_logfd(stderr);
sanitize_env();
(void)setlocale(6, "");
(void)bindtextdomain("shadow", "/usr/share/locale");
(void)textdomain("shadow");
process_root_flag("-R", argc, argv);
openlog("chage", (0x01), (10 << 3));
ruid = getuid();
rgid = getgid();
amroot = (ruid == 0);
process_flags(argc, argv);
check_perms();
if (!spw_file_present()) {
fprintf(stderr, gettext("%s: the shadow password file is not present\n"),
Prog);
do {
char *old_locale = setlocale(6, ((void *)0));
char *saved_locale = ((void *)0);
if (((void *)0) != old_locale) {
saved_locale = strdup(old_locale);
}
if (((void *)0) != saved_locale) {
(void)setlocale(6, "C");
}
syslog(4, "can't find the shadow password file");
if (((void *)0) != saved_locale) {
(void)setlocale(6, saved_locale);
free(saved_locale);
}
} while (0);
closelog();
exit(15);
}
open_files(lflg);
if (lflg && ((setregid(rgid, rgid) != 0) || (setreuid(ruid, ruid) != 0))) {
fprintf(stderr, gettext("%s: failed to drop privileges (%s)\n"), Prog,
strerror((*__errno_location())));
fail_exit(1);
}
pw = pw_locate(argv[optind]);
if (((void *)0) == pw) {
fprintf(stderr, gettext("%s: user '%s' does not exist in %s\n"), Prog,
argv[optind], pw_dbname());
closelog();
fail_exit(1);
}
(strncpy((user_name), (pw->pw_name), sizeof(user_name) - 1),
(user_name)[sizeof(user_name) - 1] = '\0');
user_uid = pw->pw_uid;
sp = spw_locate(argv[optind]);
get_defaults(sp);
if (lflg) {
if (!amroot && (ruid != user_uid)) {
fprintf(stderr, gettext("%s: Permission denied.\n"), Prog);
fail_exit(1);
}
list_fields();
fail_exit(0);
}
if (!mflg && !Mflg && !dflg && !Wflg && !Iflg && !Eflg) {
printf(gettext("Changing the aging information for %s\n"), user_name);
if (new_fields() == 0) {
fprintf(stderr, gettext("%s: error changing fields\n"), Prog);
fail_exit(1);
}
} else {
}
update_age(sp, pw);
close_files();
do {
char *old_locale = setlocale(6, ((void *)0));
char *saved_locale = ((void *)0);
if (((void *)0) != old_locale) {
saved_locale = strdup(old_locale);
}
if (((void *)0) != saved_locale) {
(void)setlocale(6, "C");
}
syslog(6, "changed password expiry for %s", user_name);
if (((void *)0) != saved_locale) {
(void)setlocale(6, saved_locale);
free(saved_locale);
}
} while (0);
closelog();
exit(0);
} | int main(int argc, const char **argv, const char **envp) {
long v3;
char *v4;
int *v5;
char *v6;
long v7;
char *v8;
long v9;
const char *v10;
long v11;
char *v12;
long v13;
char *v14;
char *v15;
long v16;
char *v17;
__uid_t ruid;
__gid_t rgid;
char *locale;
char *v21;
long v22;
_QWORD *v23;
const char *v24;
const char *s;
Prog = Basename(*argv, argv, envp);
log_set_progname(Prog);
log_set_logfd(stderr);
sanitize_env();
setlocale(6, &byte_4394);
bindtextdomain("shadow", "/usr/share/locale");
textdomain("shadow");
process_root_flag("-R", (unsigned int)argc, argv);
openlog("chage", 1, 80);
ruid = getuid();
rgid = getgid();
amroot = ruid == 0;
process_flags(argc, (char *const *)argv);
check_perms();
if ((unsigned char)spw_file_present() != 1) {
v3 = Prog;
v4 = gettext("%s: the shadow password file is not present\n");
fprintf(stderr, v4, v3);
s = setlocale(6, 0LL);
locale = 0LL;
if (s)
locale = strdup(s);
if (locale)
setlocale(6, "C");
syslog(4, "can't find the shadow password file");
if (locale) {
setlocale(6, locale);
free(locale);
}
closelog();
exit(15);
}
open_files(lflg);
if (lflg && (setregid(rgid, rgid) || setreuid(ruid, ruid))) {
v5 = _errno_location();
v6 = strerror(*v5);
v7 = Prog;
v8 = gettext("%s: failed to drop privileges (%s)\n");
fprintf(stderr, v8, v7, v6);
fail_exit(1);
}
v22 = pw_locate(argv[optind]);
if (!v22) {
v9 = pw_dbname();
v10 = argv[optind];
v11 = Prog;
v12 = gettext("%s: user '%s' does not exist in %s\n");
fprintf(stderr, v12, v11, v10, v9);
closelog();
fail_exit(1);
}
strncpy(user_name, *(const char **)v22, 0x1FFFuLL);
byte_3F5F = 0;
user_uid = *(_DWORD *)(v22 + 16);
v23 = (_QWORD *)spw_locate(argv[optind]);
get_defaults(v23);
if (lflg) {
if (amroot != 1 && ruid != user_uid) {
v13 = Prog;
v14 = gettext("%s: Permission denied.\n");
fprintf(stderr, v14, v13);
fail_exit(1);
}
list_fields();
fail_exit(0);
}
if (mflg != 1 && Mflg != 1 && dflg != 1 && Wflg != 1 && Iflg != 1 &&
Eflg != 1) {
v15 = gettext("Changing the aging information for %s\n");
printf(v15, user_name);
if (!(unsigned int)new_fields()) {
v16 = Prog;
v17 = gettext("%s: error changing fields\n");
fprintf(stderr, v17, v16);
fail_exit(1);
}
}
update_age(v23, (long *)v22);
close_files();
v24 = setlocale(6, 0LL);
v21 = 0LL;
if (v24)
v21 = strdup(v24);
if (v21)
setlocale(6, "C");
syslog(6, "changed password expiry for %s", user_name);
if (v21) {
setlocale(6, v21);
free(v21);
}
closelog();
exit(0);
} | shadow | ida |
sh_timer *shtimer_alloc(void) {
sh_timer *t;
t = (sh_timer *)sh_xmalloc((sizeof(sh_timer)), "timers.c", 76);
shtimer_zero(t);
return t;
} | long long shtimer_alloc() {
void *v0;
v0 = sh_xmalloc(0x108, "timers.c", 0x4c);
shtimer_zero(v0);
return v0;
} | bash | angr_sailr |
static int parse_encap_seg6local(struct rtattr *rta, size_t len, int *argcp,
char ***argvp) {
int segs_ok = 0, hmac_ok = 0, table_ok = 0, vrftable_ok = 0;
int action_ok = 0, srh_ok = 0, bpf_ok = 0, counters_ok = 0;
int nh4_ok = 0, nh6_ok = 0, iif_ok = 0, oif_ok = 0;
__u32 action = 0, table, vrftable, iif, oif;
struct ipv6_sr_hdr *srh;
char **argv = *argvp;
int argc = *argcp;
char segbuf[1024];
inet_prefix addr;
__u32 hmac = 0;
int ret = 0;
while (argc > 0) {
if (strcmp(*argv, "action") == 0) {
do {
argv++;
if (--argc <= 0)
incomplete_command();
} while (0);
if (action_ok++)
duparg2("action", *argv);
action = read_action_type(*argv);
if (!action)
invarg("\"action\" value is invalid\n", *argv);
ret = rta_addattr32(rta, len, SEG6_LOCAL_ACTION, action);
} else if (strcmp(*argv, "table") == 0) {
do {
argv++;
if (--argc <= 0)
incomplete_command();
} while (0);
if (table_ok++)
duparg2("table", *argv);
if (rtnl_rttable_a2n(&table, *argv))
invarg("invalid table id\n", *argv);
ret = rta_addattr32(rta, len, SEG6_LOCAL_TABLE, table);
} else if (strcmp(*argv, "vrftable") == 0) {
do {
argv++;
if (--argc <= 0)
incomplete_command();
} while (0);
if (vrftable_ok++)
duparg2("vrftable", *argv);
if (rtnl_rttable_a2n(&vrftable, *argv))
invarg("invalid vrf table id\n", *argv);
ret = rta_addattr32(rta, len, SEG6_LOCAL_VRFTABLE, vrftable);
} else if (strcmp(*argv, "nh4") == 0) {
do {
argv++;
if (--argc <= 0)
incomplete_command();
} while (0);
if (nh4_ok++)
duparg2("nh4", *argv);
get_addr(&addr, *argv, 2);
ret = rta_addattr_l(rta, len, SEG6_LOCAL_NH4, &addr.data, addr.bytelen);
} else if (strcmp(*argv, "nh6") == 0) {
do {
argv++;
if (--argc <= 0)
incomplete_command();
} while (0);
if (nh6_ok++)
duparg2("nh6", *argv);
get_addr(&addr, *argv, 10);
ret = rta_addattr_l(rta, len, SEG6_LOCAL_NH6, &addr.data, addr.bytelen);
} else if (strcmp(*argv, "iif") == 0) {
do {
argv++;
if (--argc <= 0)
incomplete_command();
} while (0);
if (iif_ok++)
duparg2("iif", *argv);
iif = ll_name_to_index(*argv);
if (!iif)
exit(nodev(*argv));
ret = rta_addattr32(rta, len, SEG6_LOCAL_IIF, iif);
} else if (strcmp(*argv, "oif") == 0) {
do {
argv++;
if (--argc <= 0)
incomplete_command();
} while (0);
if (oif_ok++)
duparg2("oif", *argv);
oif = ll_name_to_index(*argv);
if (!oif)
exit(nodev(*argv));
ret = rta_addattr32(rta, len, SEG6_LOCAL_OIF, oif);
} else if (strcmp(*argv, "count") == 0) {
if (counters_ok++)
duparg2("count", *argv);
ret = seg6local_fill_counters(rta, len, SEG6_LOCAL_COUNTERS);
} else if (strcmp(*argv, "srh") == 0) {
do {
argv++;
if (--argc <= 0)
incomplete_command();
} while (0);
if (srh_ok++)
duparg2("srh", *argv);
if (strcmp(*argv, "segs") != 0)
invarg("missing \"segs\" attribute for srh\n", *argv);
do {
argv++;
if (--argc <= 0)
incomplete_command();
} while (0);
if (segs_ok++)
duparg2("segs", *argv);
strncpy(segbuf, *argv, 1024);
segbuf[1023] = 0;
if (!(argc - 1 > 0))
break;
do {
argv++;
if (--argc <= 0)
incomplete_command();
} while (0);
if (strcmp(*argv, "hmac") == 0) {
do {
argv++;
if (--argc <= 0)
incomplete_command();
} while (0);
if (hmac_ok++)
duparg2("hmac", *argv);
get_u32(&hmac, *argv, 0);
} else {
continue;
}
} else if (strcmp(*argv, "endpoint") == 0) {
do {
argv++;
if (--argc <= 0)
incomplete_command();
} while (0);
if (bpf_ok++)
duparg2("endpoint", *argv);
if (lwt_parse_bpf(rta, len, &argc, &argv, SEG6_LOCAL_BPF,
BPF_PROG_TYPE_LWT_SEG6LOCAL) < 0)
exit(-1);
} else {
break;
}
if (ret)
return ret;
argc--;
argv++;
}
if (!action) {
fprintf(stderr, "Missing action type\n");
exit(-1);
}
if (srh_ok) {
int srhlen;
srh = parse_srh(segbuf, hmac, action == SEG6_LOCAL_ACTION_END_B6_ENCAP);
srhlen = (srh->hdrlen + 1) << 3;
ret = rta_addattr_l(rta, len, SEG6_LOCAL_SRH, srh, srhlen);
free(srh);
}
*argcp = argc + 1;
*argvp = argv - 1;
return ret;
} | long parse_encap_seg6local(long a1, unsigned int a2, int *a3,
const char ***a4) {
int v10;
int v12;
unsigned int v21;
unsigned int v22;
int v23;
uint32_t v24;
int v25;
int v26;
int v27;
int v28;
int v29;
int v30;
int v31;
int v32;
int v33;
int v34;
int v35;
int v36;
unsigned int action_type;
unsigned int v38;
unsigned int v39;
unsigned int v40;
unsigned int v41;
const char **v42;
void *ptr;
char v44[2];
unsigned short v45;
_BYTE v46[264];
char dest[1032];
unsigned long v48;
v48 = __readfsqword(0x28u);
v25 = 0;
v26 = 0;
v27 = 0;
v28 = 0;
v29 = 0;
v30 = 0;
v31 = 0;
v32 = 0;
v33 = 0;
v34 = 0;
v35 = 0;
v36 = 0;
action_type = 0;
v42 = *a4;
v23 = *a3;
v24 = 0;
v38 = 0;
while (v23 > 0) {
if (!strcmp(*v42, "action")) {
++v42;
if (--v23 <= 0)
incomplete_command();
if (v29++)
duparg2("action", *v42);
action_type = read_action_type(*v42);
if (!action_type)
invarg("\"action\" value is invalid\n", *v42);
v38 = rta_addattr32(a1, a2, 1LL, action_type);
goto LABEL_85;
}
if (!strcmp(*v42, "table")) {
++v42;
if (--v23 <= 0)
incomplete_command();
if (v27++)
duparg2("table", *v42);
if ((unsigned int)rtnl_rttable_a2n(&v21, *v42))
invarg("invalid table id\n", *v42);
v38 = rta_addattr32(a1, a2, 3LL, v21);
goto LABEL_85;
}
if (!strcmp(*v42, "vrftable")) {
++v42;
if (--v23 <= 0)
incomplete_command();
if (v28++)
duparg2("vrftable", *v42);
if ((unsigned int)rtnl_rttable_a2n(&v22, *v42))
invarg("invalid vrf table id\n", *v42);
v38 = rta_addattr32(a1, a2, 9LL, v22);
goto LABEL_85;
}
if (!strcmp(*v42, "nh4")) {
++v42;
if (--v23 <= 0)
incomplete_command();
if (v33++)
duparg2("nh4", *v42);
get_addr(v44, *v42, 2LL);
v38 = rta_addattr_l(a1, a2, 4LL, v46, v45);
goto LABEL_85;
}
if (!strcmp(*v42, "nh6")) {
++v42;
if (--v23 <= 0)
incomplete_command();
if (v34++)
duparg2("nh6", *v42);
get_addr(v44, *v42, 10LL);
v38 = rta_addattr_l(a1, a2, 5LL, v46, v45);
goto LABEL_85;
}
if (!strcmp(*v42, "iif")) {
++v42;
if (--v23 <= 0)
incomplete_command();
if (v35++)
duparg2("iif", *v42);
v40 = ll_name_to_index(*v42);
if (!v40) {
v10 = nodev(*v42);
exit(v10);
}
v38 = rta_addattr32(a1, a2, 6LL, v40);
goto LABEL_85;
}
if (!strcmp(*v42, "oif")) {
++v42;
if (--v23 <= 0)
incomplete_command();
if (v36++)
duparg2("oif", *v42);
v39 = ll_name_to_index(*v42);
if (!v39) {
v12 = nodev(*v42);
exit(v12);
}
v38 = rta_addattr32(a1, a2, 7LL, v39);
goto LABEL_85;
}
if (!strcmp(*v42, "count")) {
if (v32++)
duparg2("count", *v42);
v38 = seg6local_fill_counters(a1, a2, 0xAu);
goto LABEL_85;
}
if (!strcmp(*v42, "srh")) {
++v42;
if (--v23 <= 0)
incomplete_command();
if (v30++)
duparg2("srh", *v42);
if (strcmp(*v42, "segs"))
invarg("missing \"segs\" attribute for srh\n", *v42);
++v42;
if (--v23 <= 0)
incomplete_command();
if (v25++)
duparg2("segs", *v42);
strncpy(dest, *v42, 0x400uLL);
dest[1023] = 0;
if (v23 <= 1)
break;
++v42;
if (--v23 <= 0)
incomplete_command();
if (!strcmp(*v42, "hmac")) {
++v42;
if (--v23 <= 0)
incomplete_command();
if (v26++)
duparg2("hmac", *v42);
get_u32(&v24, *v42, 0LL);
goto LABEL_85;
}
} else {
if (strcmp(*v42, "endpoint"))
break;
++v42;
if (--v23 <= 0)
incomplete_command();
if (v31++)
duparg2("endpoint", *v42);
if ((int)lwt_parse_bpf(a1, a2, &v23, (long *)&v42, 8u, 19) < 0)
exit(-1);
LABEL_85:
if (v38)
return v38;
--v23;
++v42;
}
}
if (!action_type) {
fprintf(stderr, "Missing action type\n");
exit(-1);
}
if (v30) {
ptr = parse_srh(dest, v24, action_type == 10);
v41 = 8 * (*((unsigned char *)ptr + 1) + 1);
v38 = rta_addattr_l(a1, a2, 2LL, ptr, v41);
free(ptr);
}
*a3 = v23 + 1;
*a4 = v42 - 1;
return v38;
} | iproute2-6.0.0 | ida |
ed_unassigned(EditLine *el __attribute__((__unused__)),
wint_t c __attribute__((__unused__))) {
return 6;
} | undefined8 ed_unassigned(void)
{
return 6;
} | libedit | ghidra |
int xfrm_sctx_parse(char *ctxstr, char *s, struct xfrm_user_sec_ctx *sctx) {
int slen;
slen = strlen(s) + 1;
sctx->exttype = XFRMA_SEC_CTX;
sctx->ctx_doi = 1;
sctx->ctx_alg = 1;
sctx->ctx_len = slen;
sctx->len = sizeof(struct xfrm_user_sec_ctx) + slen;
memcpy(ctxstr, s, slen);
return 0;
} | undefined8 xfrm_sctx_parse(void *param_1, char *param_2, short *param_3)
{
int iVar1;
size_t sVar2;
short sVar3;
sVar2 = strlen(param_2);
iVar1 = (int)sVar2 + 1;
param_3[1] = 8;
*(undefined *)((long)param_3 + 5) = 1;
*(undefined *)(param_3 + 2) = 1;
sVar3 = (short)iVar1;
param_3[3] = sVar3;
*param_3 = sVar3 + 8;
memcpy(param_1, param_2, (long)iVar1);
return 0;
} | iproute2-6.0.0 | ghidra |
void usage(int status) {
if (status != 0)
do {
fprintf(stderr, gettext("Try '%s --help' for more information.\n"),
program_name);
} while (0);
else {
printf(gettext("Usage: %s [OPTION]... FILE1 FILE2\n")
,
program_name);
fputs_unlocked(
gettext("Compare sorted files FILE1 and FILE2 line by line.\n"), stdout)
;
fputs_unlocked(
gettext(
"\nWhen FILE1 or FILE2 (not both) is -, read standard input.\n"),
stdout)
;
fputs_unlocked(gettext("\nWith no options, produce three-column output. "
"Column one contains\nlines unique to FILE1, column "
"two contains lines unique to FILE2,\nand column "
"three contains lines common to both files.\n"),
stdout)
;
fputs_unlocked(
gettext("\n -1 suppress column 1 (lines unique "
"to FILE1)\n -2 suppress column 2 (lines "
"unique to FILE2)\n -3 suppress column 3 "
"(lines that appear in both files)\n"),
stdout)
;
fputs_unlocked(
gettext("\n --check-order check that the input is correctly "
"sorted, even\n if all input lines "
"are pairable\n --nocheck-order do not check that the "
"input is correctly sorted\n"),
stdout)
;
fputs_unlocked(
gettext(" --output-delimiter=STR separate columns with STR\n"),
stdout)
;
fputs_unlocked(gettext(" --total output a summary\n"),
stdout)
;
fputs_unlocked(
gettext(
" -z, --zero-terminated line delimiter is NUL, not newline\n"),
stdout)
;
fputs_unlocked(gettext(" --help display this help and exit\n"),
stdout);
fputs_unlocked(
gettext(" --version output version information and exit\n"),
stdout);
fputs_unlocked(
gettext(
"\nNote, comparisons honor the rules specified by 'LC_COLLATE'.\n"),
stdout)
;
printf(gettext("\nExamples:\n %s -12 file1 file2 Print only lines "
"present in both file1 and file2.\n %s -3 file1 file2 "
"Print lines in file1 not in file2, and vice versa.\n")
,
program_name, program_name);
emit_ancillary_info("comm");
}
exit(status);
} | void usage(int a1) {
long v1;
char *v2;
char *v3;
FILE *v4;
char *v5;
FILE *v6;
char *v7;
FILE *v8;
char *v9;
FILE *v10;
char *v11;
FILE *v12;
char *v13;
FILE *v14;
char *v15;
FILE *v16;
char *v17;
FILE *v18;
char *v19;
FILE *v20;
char *v21;
FILE *v22;
char *v23;
FILE *v24;
char *v25;
long v26;
long v27;
char *v28;
v1 = program_name;
if (a1) {
v2 = gettext("Try '%s --help' for more information.\n");
fprintf(stderr, v2, v1);
} else {
v3 = gettext("Usage: %s [OPTION]... FILE1 FILE2\n");
printf(v3, v1);
v4 = stdout;
v5 = gettext("Compare sorted files FILE1 and FILE2 line by line.\n");
fputs_unlocked(v5, v4);
v6 = stdout;
v7 = gettext(
"\nWhen FILE1 or FILE2 (not both) is -, read standard input.\n");
fputs_unlocked(v7, v6);
v8 = stdout;
v9 = gettext(
"\n"
"With no options, produce three-column output. Column one contains\n"
"lines unique to FILE1, column two contains lines unique to FILE2,\n"
"and column three contains lines common to both files.\n");
fputs_unlocked(v9, v8);
v10 = stdout;
v11 = gettext(
"\n"
" -1 suppress column 1 (lines unique to FILE1)\n"
" -2 suppress column 2 (lines unique to FILE2)\n"
" -3 suppress column 3 (lines that appear in "
"both files)\n");
fputs_unlocked(v11, v10);
v12 = stdout;
v13 =
gettext("\n"
" --check-order check that the input is correctly "
"sorted, even\n"
" if all input lines are pairable\n"
" --nocheck-order do not check that the input is "
"correctly sorted\n");
fputs_unlocked(v13, v12);
v14 = stdout;
v15 = gettext(" --output-delimiter=STR separate columns with STR\n");
fputs_unlocked(v15, v14);
v16 = stdout;
v17 = gettext(" --total output a summary\n");
fputs_unlocked(v17, v16);
v18 = stdout;
v19 = gettext(
" -z, --zero-terminated line delimiter is NUL, not newline\n");
fputs_unlocked(v19, v18);
v20 = stdout;
v21 = gettext(" --help display this help and exit\n");
fputs_unlocked(v21, v20);
v22 = stdout;
v23 = gettext(" --version output version information and exit\n");
fputs_unlocked(v23, v22);
v24 = stdout;
v25 = gettext(
"\nNote, comparisons honor the rules specified by 'LC_COLLATE'.\n");
fputs_unlocked(v25, v24);
v26 = program_name;
v27 = program_name;
v28 = gettext("\n"
"Examples:\n"
" %s -12 file1 file2 Print only lines present in both "
"file1 and file2.\n"
" %s -3 file1 file2 Print lines in file1 not in file2, and "
"vice versa.\n");
printf(v28, v27, v26);
emit_ancillary_info("comm");
}
exit(a1);
} | coreutils | ida |
static char *human_time(struct timespec t) {
static char str[((((((sizeof(intmax_t) * 8) - (!((__typeof__(intmax_t))0 <
(__typeof__(intmax_t))-1))) *
146 +
484) /
485) +
(!((__typeof__(intmax_t))0 < (__typeof__(intmax_t))-1))) +
1) +
(((((sizeof(int) * 8) -
(!((__typeof__(int))0 < (__typeof__(int))-1))) *
146 +
484) /
485) +
(!((__typeof__(int))0 < (__typeof__(int))-1))) +
1 + sizeof "-MM-DD HH:MM:SS.NNNNNNNNN +"];
static timezone_t tz;
if (!tz)
tz = tzalloc(getenv("TZ"));
struct tm tm;
int ns = t.tv_nsec;
if (localtime_rz(tz, &t.tv_sec, &tm))
nstrftime(str, sizeof str, "%Y-%m-%d %H:%M:%S.%N %z", &tm, tz, ns);
else {
char secbuf[((((((sizeof(intmax_t) * 8) -
(!((__typeof__(intmax_t))0 < (__typeof__(intmax_t))-1))) *
146 +
484) /
485) +
(!((__typeof__(intmax_t))0 < (__typeof__(intmax_t))-1))) +
1)];
sprintf(str, "%s.%09d", timetostr(t.tv_sec, secbuf), ns);
}
return str;
} | char *human_time(long a1, long a2) {
char *v2;
const char *v3;
long v5;
long v6;
unsigned int v7;
char v8[64];
char v9[24];
unsigned long v10;
v5 = a1;
v6 = a2;
v10 = __readfsqword(0x28u);
if (!tz_6653) {
v2 = getenv("TZ");
tz_6653 = tzalloc(v2);
}
v7 = v6;
if (localtime_rz(tz_6653, &v5, v8)) {
nstrftime(str_6652, 61LL, "%Y-%m-%d %H:%M:%S.%N %z", v8, tz_6653, v7, v5);
} else {
v3 = (const char *)timetostr(v5, (long)v9);
sprintf(str_6652, "%s.%09d", v3, v7);
}
return str_6652;
} | coreutils | ida |
) {
gnutls_certificate_set_verify_function(
cert_cred, cert_verify_callback);
gnutls_credentials_set(session, GNUTLS_CRD_CERTIFICATE,
cert_cred);
} | void gnutls_certificate_set_verify_function(void)
{
halt_baddata();
} | gnutls | ghidra |
histdata_t free_history_entry(HIST_ENTRY *he) {
return he ? ((void *)0) : ((void *)0);
} | long long free_history_entry(unsigned long a0) {
unsigned long v0;
v0 = a0;
return 0;
} | libedit | angr_dream |
void wordinit(void) {
for (int i = 0; i < NCHAR; i++)
sbwordchar[i] = wordchar(localeinfo.sbctowc[i]);
} | void wordinit(void)
{
undefined uVar1;
int local_c;
for (local_c = 0; local_c < 0x100; local_c = local_c + 1) {
uVar1 =
wordchar(*(undefined4 *)(&DAT_0010100c + ((long)local_c + 0x40) * 4));
sbwordchar[local_c] = uVar1;
}
return;
} | grep | ghidra |
static int handle_close(int handle) {
int ret = -1;
if (handle_is_ok(handle, HANDLE_FILE)) {
ret = close(handles[handle].fd);
free(handles[handle].name);
handle_unused(handle);
} else if (handle_is_ok(handle, HANDLE_DIR)) {
ret = closedir(handles[handle].dirp);
free(handles[handle].name);
handle_unused(handle);
} else {
(*__errno_location()) = 2;
}
return ret;
} | int handle_close(unsigned long a0) {
unsigned int v0;
v0 = -1;
if (handle_is_ok(a0, 0x2)) {
v0 = close(*((a0 * 56 + *(&handles) + 16)));
free(*((a0 * 56 + *(&handles) + 24)));
handle_unused(a0);
return v0;
} else if (handle_is_ok(a0, 0x1)) {
v0 = closedir(*((a0 * 56 + *(&handles) + 8)));
free(*((a0 * 56 + *(&handles) + 24)));
handle_unused(a0);
return v0;
} else {
*(__errno_location()) = 2;
return v0;
}
} | openssh-portable | angr_sailr |
static inline void emit_ancillary_info(char const *program) {
struct infomap {
char const *program;
char const *node;
} const infomap[] = {
{"[", "test invocation"}, {"coreutils", "Multi-call invocation"},
{"sha224sum", "sha2 utilities"}, {"sha256sum", "sha2 utilities"},
{"sha384sum", "sha2 utilities"}, {"sha512sum", "sha2 utilities"},
{((void *)0), ((void *)0)}};
char const *node = program;
struct infomap const *map_prog = infomap;
while (map_prog->program && !(strcmp(program, map_prog->program) == 0))
map_prog++;
if (map_prog->node)
node = map_prog->node;
printf (gettext ("\n%s online help: <%s>\n"), "GNU coreutils", "https:
char const *lc_messages = setlocale (
5
,
((void *)0)
);
if (lc_messages && strncmp (lc_messages, "" "en_" "", sizeof ("en_") - 1))
{
fputs_unlocked (gettext ("Report any translation bugs to " "<https:
stdout
)
;
}
char const *url_program = (strcmp (program, "[") == 0) ? "test" : program;
printf (gettext ("Full documentation <%s%s>\n"),
"https:
printf (gettext ("or available locally via: info '(coreutils) %s%s'\n"),
node, node == program ? " invocation" : "");
} | unsigned long emit_ancillary_info(const char *a1) {
char *v1;
FILE *v2;
char *v3;
const char *v4;
char *v5;
const char *v6;
char *v7;
const char *v9;
long *i;
const char *v11;
const char *v12;
long v13[15];
unsigned long v14;
v14 = __readfsqword(0x28u);
v13[0] = (long)"[";
v13[1] = (long)"test invocation";
v13[2] = (long)"coreutils";
v13[3] = (long)"Multi-call invocation";
v13[4] = (long)"sha224sum";
v13[5] = (long)"sha2 utilities";
v13[6] = (long)"sha256sum";
v13[7] = (long)"sha2 utilities";
v13[8] = (long)"sha384sum";
v13[9] = (long)"sha2 utilities";
v13[10] = (long)"sha512sum";
v13[11] = (long)"sha2 utilities";
v13[12] = 0LL;
v13[13] = 0LL;
v9 = a1;
for (i = v13; *i && strcmp(a1, (const char *)*i); i += 2)
;
if (i[1])
v9 = (const char *)i[1];
v1 = gettext("\n%s online help: <%s>\n");
printf(v1, "GNU coreutils", "https:
v11 = setlocale(5, 0LL);
if ( v11 && strncmp(v11, "en_", 3uLL) )
{
v2 = stdout;
v3 = gettext("Report any translation bugs to <https:
fputs_unlocked(v3, v2);
}
if ( !strcmp(a1, "[") )
v4 = "test";
else
v4 = a1;
v12 = v4;
v5 = gettext("Full documentation <%s%s>\n");
printf(v5, "https:
if ( v9 == a1 )
v6 = " invocation";
else
v6 = locale;
v7 = gettext("or available locally via: info '(coreutils) %s%s'\n");
printf(v7, v9, v6);
return __readfsqword(0x28u) ^ v14;
} | coreutils | ida |
int kex_dh_compute_key(struct kex *kex, BIGNUM *dh_pub, struct sshbuf *out) {
BIGNUM *shared_secret = ((void *)0);
u_char *kbuf = ((void *)0);
size_t klen = 0;
int kout, r;
if (!dh_pub_is_valid(kex->dh, dh_pub)) {
r = -3;
goto out;
}
klen = DH_size(kex->dh);
if ((kbuf = malloc(klen)) == ((void *)0) ||
(shared_secret = BN_new()) == ((void *)0)) {
r = -2;
goto out;
}
if ((kout = DH_compute_key(kbuf, dh_pub, kex->dh)) < 0 ||
BN_bin2bn(kbuf, kout, shared_secret) == ((void *)0)) {
r = -22;
goto out;
}
r = sshbuf_put_bignum2(out, shared_secret);
out:
freezero(kbuf, klen);
BN_clear_free(shared_secret);
return r;
} | long kex_dh_compute_key(long a1, long a2, long a3) {
unsigned int v5;
int v6;
long v7;
void *v8;
size_t size;
v7 = 0LL;
v8 = 0LL;
size = 0LL;
if ((unsigned int)dh_pub_is_valid(*(_QWORD *)(a1 + 280), a2)) {
size = (int)DH_size(*(_QWORD *)(a1 + 280));
v8 = malloc(size);
if (v8 && (v7 = BN_new()) != 0) {
v6 = DH_compute_key(v8, a2, *(_QWORD *)(a1 + 280));
if (v6 >= 0 && BN_bin2bn(v8, (unsigned int)v6, v7))
v5 = sshbuf_put_bignum2(a3, v7);
else
v5 = -22;
} else {
v5 = -2;
}
} else {
v5 = -3;
}
freezero(v8, size);
BN_clear_free(v7);
return v5;
} | openssh-portable | ida |
static void signal_progress_on(int sig __attribute__((unused))) {
e2fsck_t ctx = e2fsck_global_ctx;
if (!ctx)
return;
ctx->progress = e2fsck_update_progress;
} | long long signal_progress_on(unsigned long a0) {
unsigned int v0;
unsigned long long v1;
unsigned long long v3;
v0 = a0;
v3 = 2692097647170653000;
v1 = 2692097647170653000;
if (v1) {
v3 = v1;
*((v1 + 352)) = e2fsck_update_progress;
}
return v3;
} | e2fsprogs-1.46.5 | angr_dream |
static _Bool
parse_mindepth(const struct parser_table *entry, char **argv, int *arg_ptr) {
return insert_depthspec(entry, argv, arg_ptr, &options.mindepth);
} | long long parse_mindepth(unsigned long long a0, unsigned long long a1,
unsigned long long a2) {
return insert_depthspec(a0, a1, a2, 0x500010);
} | findutils | angr_sailr |
int trap_builtin(list)
WORD_LIST *list;
{
int list_signal_names, display, result, opt;
list_signal_names = display = 0;
result = 0;
reset_internal_getopt();
while ((opt = internal_getopt(list, "lp")) != -1) {
switch (opt) {
case 'l':
list_signal_names++;
break;
case 'p':
display++;
break;
case -99:
builtin_help();
return (258);
default:
builtin_usage();
return (258);
}
}
list = loptend;
opt = 0x02 | 0x01;
if (list_signal_names)
return (sh_chkwrite(display_signal_list((WORD_LIST *)((void *)0), 1)));
else if (display || list == 0) {
initialize_terminating_signals();
get_all_original_signals();
return (sh_chkwrite(display_traps(list, display && posixly_correct)));
} else {
char *first_arg;
int operation, sig, first_signal;
operation = 0;
first_arg = list->word->word;
first_signal = first_arg && *first_arg && all_digits(first_arg) &&
(decode_signal(first_arg, opt) != -1);
if (first_signal)
operation = 1;
else if (posixly_correct == 0 && first_arg && *first_arg &&
(*first_arg != '-' || first_arg[1]) &&
(decode_signal(first_arg, opt) != -1) && list->next == 0)
operation = 1;
else {
list = list->next;
if (list == 0) {
builtin_usage();
return (258);
} else if (*first_arg == '\0')
operation = 2;
else if (first_arg[0] == '-' && !first_arg[1])
operation = 1;
}
if (subshell_environment & 0x80) {
free_trap_strings();
subshell_environment &= ~0x80;
}
while (list) {
sig = decode_signal(list->word->word, opt);
if (sig == -1) {
sh_invalidsig(list->word->word);
result = 1;
} else {
switch (operation) {
case 0:
set_signal(sig, first_arg);
break;
case 1:
restore_default_signal(sig);
switch (sig) {
case 2:
if (interactive)
set_signal_handler(2, sigint_sighandler);
else if (interactive_shell &&
(sourcelevel || running_trap || parse_and_execute_level))
set_signal_handler(2, sigint_sighandler);
else
set_signal_handler(2, termsig_sighandler);
break;
case 3:
set_signal_handler(3, ((__sighandler_t)1));
break;
case 15:
case 21:
case 22:
case 20:
if (interactive)
set_signal_handler(sig, ((__sighandler_t)1));
break;
}
break;
case 2:
ignore_signal(sig);
break;
}
}
list = list->next;
}
}
return (result);
} | long long trap_builtin(unsigned long long a0, unsigned long a1,
unsigned long long a2, unsigned long long a3,
unsigned long long a4, unsigned long long a5) {
struct_0 *v0;
unsigned int v1;
unsigned int v2;
unsigned int v3;
unsigned int v4;
unsigned int v5;
unsigned int v6;
unsigned int v7;
char v8[2];
unsigned long long v10;
unsigned long long v11;
unsigned int v12;
unsigned int v13;
v0 = a0;
v2 = 0;
v1 = v2;
v3 = 0;
reset_internal_getopt();
while (true) {
v5 = internal_getopt(v0, "lp");
if (v5 == -1) {
v0 = loptend;
v5 = 3;
if (v1) {
v10 = sh_chkwrite(display_signal_list(0x0, 0x1));
break;
}
if (!v2 && v0) {
v4 = 0;
*(&v8) = v0->field_8->field_0;
if (v8 && v8[0] && all_digits(v8) && decode_signal(v8, v5, v5) != -1) {
v12 = 1;
goto LABEL_400163;
}
v12 = 0;
LABEL_400163:
v6 = v12;
if (v6) {
v4 = 1;
goto LABEL_40022f;
}
if (!*(&posixly_correct) && v8 && v8[0]) {
if (v8[0] == 45 && !v8[1])
goto LABEL_4001d9;
if (decode_signal(v8, v5, v5) != -1 && !v0->field_0) {
v4 = 1;
goto LABEL_40022f;
}
}
LABEL_4001d9:
v0 = v0->field_0;
if (!v0) {
builtin_usage();
v10 = 258;
break;
} else if (!v8[0]) {
v4 = 2;
} else if (v8[0] == 45 && !v8[1]) {
v4 = 1;
}
LABEL_40022f:
if ((subshell_environment & 128)) {
free_trap_strings();
v13 = subshell_environment;
*(&v13) = subshell_environment & 127;
subshell_environment = v13;
}
while (true) {
if (!v0)
goto LABEL_4003dc;
v7 = decode_signal(v0->field_8->field_0, v5, v5);
if (v7 == -1) {
sh_invalidsig(v0->field_8->field_0);
v3 = 1;
goto LABEL_4003c5;
}
if (v4 == 2) {
ignore_signal(v7);
goto LABEL_4003c5;
}
if (!(v4 <= 2))
goto LABEL_4003c5;
if (!v4) {
set_signal(v7, v8, v8);
goto LABEL_4003c5;
}
if (!(v4 == 1))
goto LABEL_4003c5;
restore_default_signal(v7);
if (v7 <= 22)
break;
LABEL_4003c5:
v0 = v0->field_0;
}
if (v7 < 20 && v7 != 15) {
if (!(v7 <= 15))
goto LABEL_4003c5;
if (v7 != 2) {
if (!(v7 == 3))
goto LABEL_4003c5;
set_signal_handler(0x3, 0x1);
}
if (*(&interactive))
set_signal_handler(0x2, *(&got.sigint_sighandler));
if (!interactive_shell) {
LABEL_400376:
set_signal_handler(0x2, got.termsig_sighandler);
} else {
if (!sourcelevel && !running_trap && !parse_and_execute_level)
goto LABEL_400376;
set_signal_handler(0x2, *(&got.sigint_sighandler));
}
}
if (*(&interactive))
set_signal_handler(v7, 0x1);
LABEL_4003dc:
v10 = v3;
break;
}
initialize_terminating_signals();
get_all_original_signals(a0, "lp", a2, a3, a4, a5);
if (v2 && *(&posixly_correct)) {
v11 = 1;
goto LABEL_4000ef;
}
v11 = 0;
LABEL_4000ef:
v10 = sh_chkwrite(display_traps(v0, v11, v11));
break;
}
if (v5 == 112) {
v2 += 1;
continue;
}
if (v5 > 112) {
LABEL_40005e:
builtin_usage();
v10 = 258;
break;
} else {
if (v5 == -99) {
builtin_help();
v10 = 258;
break;
}
if (!(v5 == 108))
goto LABEL_40005e;
v1 += 1;
}
}
return v10;
} | bash | angr_phoenix |
static void send_rexec_state(int fd, struct sshbuf *conf) {
struct sshbuf *m = ((void *)0), *inc = ((void *)0);
struct include_item *item = ((void *)0);
int r;
sshlog("sshd.c", __func__, 918, 1, SYSLOG_LEVEL_DEBUG3, ((void *)0),
"entering fd = %d config len %zu", fd, sshbuf_len(conf));
if ((m = sshbuf_new()) == ((void *)0) || (inc = sshbuf_new()) == ((void *)0))
sshfatal("sshd.c", __func__, 922, 1, SYSLOG_LEVEL_FATAL, ((void *)0),
"sshbuf_new failed");
for ((item) = ((&includes)->tqh_first); (item) != ((void *)0);
(item) = ((item)->entry.tqe_next)) {
if ((r = sshbuf_put_cstring(inc, item->selector)) != 0 ||
(r = sshbuf_put_cstring(inc, item->filename)) != 0 ||
(r = sshbuf_put_stringb(inc, item->contents)) != 0)
sshfatal("sshd.c", __func__, 929, 1, SYSLOG_LEVEL_FATAL, ssh_err(r),
"compose includes");
}
if ((r = sshbuf_put_stringb(m, conf)) != 0 ||
(r = sshbuf_put_stringb(m, inc)) != 0)
sshfatal("sshd.c", __func__, 944, 1, SYSLOG_LEVEL_FATAL, ssh_err(r),
"compose config");
if (ssh_msg_send(fd, 0, m) == -1)
sshlog("sshd.c", __func__, 949, 1, SYSLOG_LEVEL_ERROR, ((void *)0),
"ssh_msg_send failed");
sshbuf_free(m);
sshbuf_free(inc);
sshlog("sshd.c", __func__, 954, 1, SYSLOG_LEVEL_DEBUG3, ((void *)0), "done");
} | void send_rexec_state(undefined4 param_1, undefined8 param_2)
{
undefined4 uVar1;
long lVar2;
int iVar3;
undefined8 uVar4;
char **ppcVar5;
undefined *puVar6;
undefined *puVar7;
char *pcStack72;
undefined8 uStack64;
undefined8 local_38;
undefined4 local_2c;
int local_24;
undefined8 *local_20;
long local_18;
long local_10;
ppcVar5 = (char **)&local_38;
local_18 = 0;
local_10 = 0;
local_20 = (undefined8 *)0x0;
uStack64 = 0x101bb0;
local_38 = param_2;
local_2c = param_1;
pcStack72 = (char *)sshbuf_len(param_2);
sshlog("sshd.c", "send_rexec_state", 0x396, 1, 7, 0,
"entering fd = %d config len %zu", local_2c);
uStack64 = 0x101bf8;
local_18 = sshbuf_new();
if (local_18 == 0) {
LAB_00101c13:
ppcVar5 = &pcStack72;
pcStack72 = "sshbuf_new failed";
sshfatal("sshd.c", "send_rexec_state", 0x39a, 1, 1, 0);
} else {
uStack64 = 0x101c08;
local_10 = sshbuf_new();
if (local_10 == 0)
goto LAB_00101c13;
}
puVar7 = (undefined *)ppcVar5;
for (local_20 = includes._0_8_;
uVar4 = local_38, local_20 != (undefined8 *)0x0;
local_20 = (undefined8 *)local_20[3]) {
uVar4 = *local_20;
*(undefined8 *)(puVar7 + -8) = 0x101c73;
local_24 = sshbuf_put_cstring(local_10, uVar4);
if (local_24 == 0) {
uVar4 = local_20[1];
*(undefined8 *)(puVar7 + -8) = 0x101c93;
local_24 = sshbuf_put_cstring(local_10, uVar4);
if (local_24 != 0)
goto LAB_00101cbc;
uVar4 = local_20[2];
*(undefined8 *)(puVar7 + -8) = 0x101cb3;
local_24 = sshbuf_put_stringb(local_10, uVar4);
puVar6 = puVar7;
if (local_24 != 0)
goto LAB_00101cbc;
} else {
LAB_00101cbc:
*(undefined8 *)(puVar7 + -8) = 0x101cc6;
uVar4 = ssh_err(local_24);
puVar6 = puVar7 + -0x10;
*(char **)(puVar7 + -0x10) = "compose includes";
*(undefined8 *)(puVar7 + -0x18) = 0x101cfd;
sshfatal("sshd.c", "send_rexec_state", 0x3a1, 1, 1, uVar4);
}
puVar7 = puVar6;
}
*(undefined8 *)(puVar7 + -8) = 0x101d27;
local_24 = sshbuf_put_stringb(local_18, uVar4);
if (local_24 == 0) {
*(undefined8 *)(puVar7 + -8) = 0x101d43;
local_24 = sshbuf_put_stringb(local_18, local_10);
puVar6 = puVar7;
if (local_24 == 0)
goto LAB_00101d8d;
}
*(undefined8 *)(puVar7 + -8) = 0x101d56;
uVar4 = ssh_err(local_24);
puVar6 = puVar7 + -0x10;
*(char **)(puVar7 + -0x10) = "compose config";
*(undefined8 *)(puVar7 + -0x18) = 0x101d8d;
sshfatal("sshd.c", "send_rexec_state", 0x3b0, 1, 1, uVar4);
LAB_00101d8d:
lVar2 = local_18;
uVar1 = local_2c;
*(undefined8 *)(puVar6 + -8) = 0x101da0;
iVar3 = ssh_msg_send(uVar1, 0, lVar2);
if (iVar3 == -1) {
*(char **)(puVar6 + -0x10) = "ssh_msg_send failed";
*(undefined8 *)(puVar6 + -0x18) = 0x101ddf;
sshlog("sshd.c", "send_rexec_state", 0x3b5, 1, 2, 0);
}
lVar2 = local_18;
*(undefined8 *)(puVar6 + -8) = 0x101def;
sshbuf_free(lVar2);
lVar2 = local_10;
*(undefined8 *)(puVar6 + -8) = 0x101dfb;
sshbuf_free(lVar2);
*(undefined **)(puVar6 + -0x10) = &DAT_0010773c;
*(undefined8 *)(puVar6 + -0x18) = 0x101e35;
sshlog("sshd.c", "send_rexec_state", 0x3ba, 1, 7, 0);
return;
} | openssh-portable | ghidra |
static rsRetVal loadTCPSupport(void) {
rsRetVal iRet = RS_RET_OK;
if ((iRet = obj.UseObj("omfwd.c", (uchar *)"netstrms", (uchar *)"lmnetstrms",
(void *)&netstrms)) != RS_RET_OK)
goto finalize_it;
if ((iRet = obj.UseObj("omfwd.c", (uchar *)"netstrm", (uchar *)"lmnetstrms",
(void *)&netstrm)) != RS_RET_OK)
goto finalize_it;
if ((iRet = obj.UseObj("omfwd.c", (uchar *)"tcpclt", (uchar *)"lmtcpclt",
(void *)&tcpclt)) != RS_RET_OK)
goto finalize_it;
finalize_it:
return iRet;
} | int loadTCPSupport() {
unsigned int v0;
v0 = 0;
v0 = *(4216200)("omfwd.c", "netstrms", "lmnetstrms", &netstrms);
if (v0)
return v0;
v0 = *(4216200)("omfwd.c", "netstrm", "lmnetstrms", &netstrm);
if (!v0) {
v0 = *(4216200)("omfwd.c", "tcpclt", "lmtcpclt", &tcpclt);
return v0;
}
return v0;
} | rsyslog-8.2210.0 | angr_sailr |
static void uid_coder(struct tar_stat_info const *st, char const *keyword,
struct xheader *xhdr,
void const *data __attribute__((unused))) {
code_signed_num(
st->stat.st_uid, keyword,
((uid_t) ~(
(uid_t)(!(!((uid_t)0 < (uid_t)-1))
? (uid_t)-1
: ((((uid_t)1 << ((sizeof(uid_t) * 8) - 2)) - 1) * 2 +
1)))),
((uid_t)(!(!((uid_t)0 < (uid_t)-1))
? (uid_t)-1
: ((((uid_t)1 << ((sizeof(uid_t) * 8) - 2)) - 1) * 2 + 1))),
xhdr);
} | long long uid_coder(struct_0 *a0, unsigned long a1, void *a2,
unsigned long a3) {
unsigned long v0;
v0 = a3;
return code_signed_num(a0->field_74, a1, 0x0, 0xffffffff, a2);
} | tar | angr_sailr |
int ssh_krl_check_key(struct ssh_krl *krl, const struct sshkey *key) {
int r;
;
if ((r = is_key_revoked(krl, key)) != 0)
return r;
if (sshkey_is_cert(key)) {
sshlog("krl.c", __func__, 1322, 1, SYSLOG_LEVEL_DEBUG2, ((void *)0),
"checking CA key");
if ((r = is_key_revoked(krl, key->cert->signature_key)) != 0)
return r;
};
return 0;
} | long ssh_krl_check_key(long *a1, long a2) {
unsigned int v3;
unsigned int v4;
v3 = is_key_revoked(a1, a2);
if (v3)
return v3;
if ((unsigned int)sshkey_is_cert(a2)) {
sshlog("krl.c", "ssh_krl_check_key", 1322LL, 1LL, 6LL, 0LL,
"checking CA key");
v4 = is_key_revoked(a1, *(_QWORD *)(*(_QWORD *)(a2 + 128) + 80LL));
if (v4)
return v4;
}
return 0LL;
} | openssh-portable | ida |
struct sshkey *get_hostkey_public_by_type(int type, int nid, struct ssh *ssh) {
return get_hostkey_by_type(type, nid, 0, ssh);
} | long long get_hostkey_public_by_type(unsigned long a0, unsigned long a1,
unsigned long long a2) {
return get_hostkey_by_type(a0, a1, 0x0, a2);
} | openssh-portable | angr_phoenix |
int unbind_function_def(name) const char *name;
{
BUCKET_CONTENTS *elt;
FUNCTION_DEF *funcdef;
elt = hash_remove(name, shell_function_defs, 0);
if (elt == 0)
return -1;
funcdef = (FUNCTION_DEF *)elt->data;
if (funcdef)
dispose_function_def(funcdef);
sh_xfree((elt->key), "variables.c", 3941);
sh_xfree((elt), "variables.c", 3942);
return 0;
} | long unbind_function_def(long a1) {
long v2;
long v3;
v2 = hash_remove(a1, shell_function_defs, 0LL);
if (!v2)
return 0xFFFFFFFFLL;
v3 = *(_QWORD *)(v2 + 16);
if (v3)
dispose_function_def(v3);
sh_xfree(*(_QWORD *)(v2 + 8), "variables.c", 3941LL);
sh_xfree(v2, "variables.c", 3942LL);
return 0LL;
} | bash | ida |
static int sshkey_private_to_blob_pem_pkcs8(struct sshkey *key,
struct sshbuf *buf, int format,
const char *_passphrase,
const char *comment) {
int was_shielded = sshkey_is_shielded(key);
int success, r;
int blen, len = strlen(_passphrase);
u_char *passphrase = (len > 0) ? (u_char *)_passphrase : ((void *)0);
const EVP_CIPHER *cipher = (len > 0) ? EVP_aes_128_cbc() : ((void *)0);
char *bptr;
BIO *bio = ((void *)0);
struct sshbuf *blob;
EVP_PKEY *pkey = ((void *)0);
if (len > 0 && len <= 4)
return -40;
if ((blob = sshbuf_new()) == ((void *)0))
return -2;
if ((bio = BIO_new(BIO_s_mem())) == ((void *)0)) {
r = -2;
goto out;
}
if (format == SSHKEY_PRIVATE_PKCS8 &&
(pkey = EVP_PKEY_new()) == ((void *)0)) {
r = -2;
goto out;
}
if ((r = sshkey_unshield_private(key)) != 0)
goto out;
switch (key->type) {
case KEY_DSA:
if (format == SSHKEY_PRIVATE_PEM) {
success = PEM_write_bio_DSAPrivateKey(bio, key->dsa, cipher, passphrase,
len, ((void *)0), ((void *)0));
} else {
success = EVP_PKEY_set1_DSA(pkey, key->dsa);
}
break;
case KEY_ECDSA:
if (format == SSHKEY_PRIVATE_PEM) {
success = PEM_write_bio_ECPrivateKey(bio, key->ecdsa, cipher, passphrase,
len, ((void *)0), ((void *)0));
} else {
success = EVP_PKEY_set1_EC_KEY(pkey, key->ecdsa);
}
break;
case KEY_RSA:
if (format == SSHKEY_PRIVATE_PEM) {
success = PEM_write_bio_RSAPrivateKey(bio, key->rsa, cipher, passphrase,
len, ((void *)0), ((void *)0));
} else {
success = EVP_PKEY_set1_RSA(pkey, key->rsa);
}
break;
default:
success = 0;
break;
}
if (success == 0) {
r = -22;
goto out;
}
if (format == SSHKEY_PRIVATE_PKCS8) {
if ((success = PEM_write_bio_PrivateKey(bio, pkey, cipher, passphrase, len,
((void *)0), ((void *)0))) == 0) {
r = -22;
goto out;
}
}
if ((blen = BIO_ctrl(bio, 3, 0, (char *)(&bptr))) <= 0) {
r = -1;
goto out;
}
if ((r = sshbuf_put(blob, bptr, blen)) != 0)
goto out;
r = 0;
out:
if (was_shielded)
r = sshkey_shield_private(key);
if (r == 0)
r = sshbuf_putb(buf, blob);
EVP_PKEY_free(pkey);
sshbuf_free(blob);
BIO_free(bio);
return r;
} | long sshkey_private_to_blob_pem_pkcs8(long *a1, long a2, int a3,
const char *a4) {
const char *v4;
long v5;
long v7;
int v8;
int v12;
unsigned int v13;
_BOOL4 is_shielded;
int v15;
int v16;
long v17;
long v18;
const char *v19;
long v20;
long v21;
long v22;
unsigned long v23;
v23 = __readfsqword(0x28u);
is_shielded = sshkey_is_shielded((long)a1);
v15 = strlen(a4);
if (v15 <= 0)
v4 = 0LL;
else
v4 = a4;
v19 = v4;
if (v15 <= 0)
v5 = 0LL;
else
v5 = EVP_aes_128_cbc();
v20 = v5;
v21 = 0LL;
v18 = 0LL;
if (v15 > 0 && v15 <= 4)
return 4294967256LL;
v22 = sshbuf_new(a4);
if (!v22)
return 4294967294LL;
v7 = BIO_s_mem();
v21 = BIO_new(v7);
if (v21) {
if (a3 == 2) {
v18 = EVP_PKEY_new();
if (!v18) {
v13 = -2;
goto LABEL_41;
}
}
v13 = sshkey_unshield_private(a1);
if (v13)
goto LABEL_41;
v8 = *(_DWORD *)a1;
if (*(_DWORD *)a1 == 2) {
if (a3 == 1)
v12 = PEM_write_bio_ECPrivateKey(v21, a1[4], v20, v19,
(unsigned int)v15, 0LL, 0LL);
else
v12 = EVP_PKEY_set1_EC_KEY(v18, a1[4]);
} else {
if (v8 > 2)
goto LABEL_31;
if (v8) {
if (v8 == 1) {
if (a3 == 1)
v12 = PEM_write_bio_DSAPrivateKey(v21, a1[2], v20, v19,
(unsigned int)v15, 0LL, 0LL);
else
v12 = EVP_PKEY_set1_DSA(v18, a1[2]);
goto LABEL_32;
}
LABEL_31:
v12 = 0;
goto LABEL_32;
}
if (a3 == 1)
v12 = PEM_write_bio_RSAPrivateKey(v21, a1[1], v20, v19,
(unsigned int)v15, 0LL, 0LL);
else
v12 = EVP_PKEY_set1_RSA(v18, a1[1]);
}
LABEL_32:
if (v12) {
if (a3 != 2 || (unsigned int)PEM_write_bio_PrivateKey(
v21, v18, v20, v19, (unsigned int)v15, 0LL, 0LL)) {
v16 = BIO_ctrl(v21, 3LL, 0LL, &v17);
if (v16 > 0) {
v13 = sshbuf_put(v22, v17, v16);
if (!v13)
v13 = 0;
} else {
v13 = -1;
}
} else {
v13 = -22;
}
} else {
v13 = -22;
}
goto LABEL_41;
}
v13 = -2;
LABEL_41:
if (is_shielded)
v13 = sshkey_shield_private(a1);
if (!v13)
v13 = sshbuf_putb(a2, v22);
EVP_PKEY_free(v18);
sshbuf_free(v22);
BIO_free(v21);
return v13;
} | openssh-portable | ida |
static int read_encap_type(const char *name) {
if (strcmp(name, "mpls") == 0)
return LWTUNNEL_ENCAP_MPLS;
else if (strcmp(name, "ip") == 0)
return LWTUNNEL_ENCAP_IP;
else if (strcmp(name, "ip6") == 0)
return LWTUNNEL_ENCAP_IP6;
else if (strcmp(name, "ila") == 0)
return LWTUNNEL_ENCAP_ILA;
else if (strcmp(name, "bpf") == 0)
return LWTUNNEL_ENCAP_BPF;
else if (strcmp(name, "seg6") == 0)
return LWTUNNEL_ENCAP_SEG6;
else if (strcmp(name, "seg6local") == 0)
return LWTUNNEL_ENCAP_SEG6_LOCAL;
else if (strcmp(name, "rpl") == 0)
return LWTUNNEL_ENCAP_RPL;
else if (strcmp(name, "ioam6") == 0)
return LWTUNNEL_ENCAP_IOAM6;
else if (strcmp(name, "help") == 0)
encap_type_usage();
return LWTUNNEL_ENCAP_NONE;
} | int read_encap_type(char *a0) {
unsigned int v1;
v1 = strcmp(a0, "mpls");
if (!v1) {
v1 = 1;
} else {
v1 = strcmp(a0, "ip");
if (!v1) {
v1 = 2;
} else {
v1 = strcmp(a0, "ip6");
if (!v1) {
v1 = 4;
} else {
v1 = strcmp(a0, "ila");
if (!v1) {
v1 = 3;
} else {
v1 = strcmp(a0, "bpf");
if (!v1) {
v1 = 6;
} else {
v1 = strcmp(a0, "seg6");
if (!v1) {
v1 = 5;
} else {
v1 = strcmp(a0, "seg6local");
if (!v1) {
v1 = 7;
} else {
v1 = strcmp(a0, "rpl");
if (!v1) {
v1 = 8;
} else {
v1 = strcmp(a0, "ioam6");
if (!v1) {
v1 = 9;
} else {
v1 = strcmp(a0, "help");
if (!v1)
encap_type_usage();
v1 = 0;
}
}
}
}
}
}
}
}
}
if (...)
return v1;
} | iproute2-6.0.0 | angr_dream |
static void vi_save_insert_buffer(int start, int len) {
if (len >= vi_insert_buffer_size) {
vi_insert_buffer_size += (len + 32) - (len % 32);
vi_insert_buffer =
(char *)xrealloc(vi_insert_buffer, vi_insert_buffer_size);
}
strncpy(vi_insert_buffer, rl_line_buffer + start, len - 1);
vi_insert_buffer[len - 1] = '\0';
} | void vi_save_insert_buffer(unsigned long a0, unsigned long a1) {
unsigned long long v1;
if (a1 >= vi_insert_buffer_size) {
vi_insert_buffer_size = vi_insert_buffer_size + a1 + 32 -
((a1 + (a1 >> 31 >> 27) & 31) - (a1 >> 31 >> 27));
vi_insert_buffer =
xrealloc(vi_insert_buffer, vi_insert_buffer_size, vi_insert_buffer_size,
a1 + 32 - ((a1 + (a1 >> 31 >> 27) & 31) - (a1 >> 31 >> 27)));
}
strncpy(vi_insert_buffer, rl_line_buffer + a0, a1 - 1);
v1 = vi_insert_buffer + a1 - 1;
*((vi_insert_buffer + a1 - 1)) = 0;
return;
} | bash | angr_sailr |
ARRAY *array_dequote_escapes(array)
ARRAY *array;
{
ARRAY_ELEMENT *a;
char *t;
if (array == 0 || ((array)->head) == 0 || ((array)->num_elements == 0))
return (ARRAY *)((void *)0);
for (a = ((array->head)->next); a != array->head; a = ((a)->next)) {
t = dequote_escapes(a->value);
do {
if (a->value)
sh_xfree((a->value), "array.c", 373);
} while (0);
a->value = t;
}
return array;
} | long long array_dequote_escapes(void *a0) {
unsigned long long v0[3];
unsigned long v1;
void *v3;
if (a0 && a0[16] && a0[8]) {
for (v0[0] = *((a0[16] + 16)); v0 != a0[16]; v0[0] = v0[2]) {
v1 = dequote_escapes(v0[1]);
if (v0[1])
sh_xfree(v0[1], "array.c", 0x175);
v0[1] = v1;
}
v3 = a0;
}
if (!a0 || !a0[16] || !a0[8])
v3 = 0;
return v3;
} | bash | angr_dream |
int cipher_init(struct sshcipher_ctx **ccp, const struct sshcipher *cipher,
const u_char *key, u_int keylen, const u_char *iv, u_int ivlen,
int do_encrypt) {
struct sshcipher_ctx *cc = ((void *)0);
int ret = -1;
const EVP_CIPHER *type;
int klen;
*ccp = ((void *)0);
if ((cc = calloc(sizeof(*cc), 1)) == ((void *)0))
return -2;
cc->plaintext = (cipher->flags & (1 << 3)) != 0;
cc->encrypt = do_encrypt;
if (keylen < cipher->key_len ||
(iv != ((void *)0) && ivlen < cipher_ivlen(cipher))) {
ret = -10;
goto out;
}
cc->cipher = cipher;
if ((cc->cipher->flags & (1 << 1)) != 0) {
cc->cp_ctx = chachapoly_new(key, keylen);
ret = cc->cp_ctx != ((void *)0) ? 0 : -10;
goto out;
}
if ((cc->cipher->flags & (1 << 3)) != 0) {
ret = 0;
goto out;
}
type = (*cipher->evptype)();
if ((cc->evp = EVP_CIPHER_CTX_new()) == ((void *)0)) {
ret = -2;
goto out;
}
if (EVP_CipherInit(cc->evp, type, ((void *)0), (u_char *)iv,
(do_encrypt == 1)) == 0) {
ret = -22;
goto out;
}
if (cipher_authlen(cipher) &&
!EVP_CIPHER_CTX_ctrl(cc->evp, 0x12, -1, (u_char *)iv)) {
ret = -22;
goto out;
}
klen = EVP_CIPHER_CTX_get_key_length(cc->evp);
if (klen > 0 && keylen != (u_int)klen) {
if (EVP_CIPHER_CTX_set_key_length(cc->evp, keylen) == 0) {
ret = -22;
goto out;
}
}
if (EVP_CipherInit(cc->evp, ((void *)0), (u_char *)key, ((void *)0), -1) ==
0) {
ret = -22;
goto out;
}
ret = 0;
out:
if (ret == 0) {
*ccp = cc;
} else {
if (cc != ((void *)0)) {
EVP_CIPHER_CTX_free(cc->evp);
freezero(cc, sizeof(*cc));
}
}
return ret;
} | int cipher_init(uint **param_1, long param_2, uchar *param_3, uint param_4,
uchar *param_5, uint param_6, uint param_7)
{
uint uVar1;
int iVar2;
uint *puVar3;
undefined8 uVar4;
EVP_CIPHER *cipher;
EVP_CIPHER_CTX *pEVar5;
int local_20;
*param_1 = (uint *)0x0;
puVar3 = (uint *)calloc(0x128, 1);
if (puVar3 == (uint *)0x0) {
local_20 = -2;
} else {
*puVar3 = (uint)((*(uint *)(param_2 + 0x18) & 8) != 0);
puVar3[1] = param_7;
if ((param_4 < *(uint *)(param_2 + 0xc)) ||
((param_5 != (uchar *)0x0 &&
(uVar1 = cipher_ivlen(param_2), param_6 < uVar1)))) {
local_20 = -10;
} else {
*(long *)(puVar3 + 0x48) = param_2;
if ((*(uint *)(*(long *)(puVar3 + 0x48) + 0x18) & 2) == 0) {
if ((*(uint *)(*(long *)(puVar3 + 0x48) + 0x18) & 8) == 0) {
cipher = (EVP_CIPHER *)(**(code **)(param_2 + 0x20))();
pEVar5 = EVP_CIPHER_CTX_new();
*(EVP_CIPHER_CTX **)(puVar3 + 2) = pEVar5;
if (*(long *)(puVar3 + 2) == 0) {
local_20 = -2;
} else {
iVar2 = EVP_CipherInit(*(EVP_CIPHER_CTX **)(puVar3 + 2), cipher,
(uchar *)0x0, param_5, (uint)(param_7 == 1));
if (iVar2 == 0) {
local_20 = -0x16;
} else {
iVar2 = cipher_authlen(param_2);
if ((iVar2 == 0) ||
(iVar2 = EVP_CIPHER_CTX_ctrl(*(EVP_CIPHER_CTX **)(puVar3 + 2),
0x12, -1, param_5),
iVar2 != 0)) {
uVar1 =
EVP_CIPHER_CTX_get_key_length(*(undefined8 *)(puVar3 + 2));
if ((((int)uVar1 < 1) || (param_4 == uVar1)) ||
(iVar2 = EVP_CIPHER_CTX_set_key_length(
*(EVP_CIPHER_CTX **)(puVar3 + 2), param_4),
iVar2 != 0)) {
iVar2 = EVP_CipherInit(*(EVP_CIPHER_CTX **)(puVar3 + 2),
(EVP_CIPHER *)0x0, param_3,
(uchar *)0x0, -1);
if (iVar2 == 0) {
local_20 = -0x16;
} else {
local_20 = 0;
}
} else {
local_20 = -0x16;
}
} else {
local_20 = -0x16;
}
}
}
} else {
local_20 = 0;
}
} else {
uVar4 = chachapoly_new(param_3, param_4);
*(undefined8 *)(puVar3 + 4) = uVar4;
if (*(long *)(puVar3 + 4) == 0) {
local_20 = -10;
} else {
local_20 = 0;
}
}
}
if (local_20 == 0) {
*param_1 = puVar3;
} else if (puVar3 != (uint *)0x0) {
EVP_CIPHER_CTX_free(*(EVP_CIPHER_CTX **)(puVar3 + 2));
freezero(puVar3, 0x128);
}
}
return local_20;
} | openssh-portable | ghidra |
SHELL_VAR *assign_array_from_string(name, value, flags)
char *name, *value;
int flags;
{
SHELL_VAR *var;
int vflags;
vflags = 1;
if (flags & 0x0004)
vflags |= 2;
var = find_or_make_array_variable(name, vflags);
if (var == 0)
return ((SHELL_VAR *)((void *)0));
return (assign_array_var_from_string(var, value, flags));
} | long assign_array_from_string(long a1, _BYTE *a2, unsigned int a3) {
char v5;
long array_variable;
v5 = 1;
if ((a3 & 4) != 0)
v5 = 3;
array_variable = find_or_make_array_variable(a1, v5);
if (array_variable)
return assign_array_var_from_string(array_variable, a2, a3);
else
return 0LL;
} | bash | ida |
int acl_set_permset(acl_entry_t entry_d, acl_permset_t permset_d) {
acl_entry_obj *entry_obj_p =
((acl_entry_obj *)__ext2int_and_check(entry_d, (0x9D6B)));
acl_permset_obj *acl_permset_obj_p =
((acl_permset_obj *)__ext2int_and_check(permset_d, (0x1ED5)));
if (!entry_obj_p || !acl_permset_obj_p)
return -1;
entry_obj_p->i.e_entry.e_perm.i = acl_permset_obj_p->i;
return 0;
} | long long acl_set_permset(unsigned long long a0, unsigned long long a1) {
struct_0 *v0;
struct_1 *v1;
unsigned long long v3;
v0 = __ext2int_and_check(a0, 0x9d6b);
v1 = __ext2int_and_check(a1, 0x1ed5);
if (v0 && v1) {
v0->field_40 = v1->field_8;
v3 = 0;
}
if (!v0 || !v1)
v3 = 4294967295;
return v3;
} | acl-2.3.1 | angr_dream |
static void do_authenticated2(struct ssh *ssh, Authctxt *authctxt) {
server_loop2(ssh, authctxt);
} | void do_authenticated2(undefined8 param_1, undefined8 param_2)
{
server_loop2(param_1, param_2);
return;
} | openssh-portable | ghidra |
static void atime_coder(struct tar_stat_info const *st, char const *keyword,
struct xheader *xhdr,
void const *data __attribute__((unused))) {
code_time(st->atime, keyword, xhdr);
} | unsigned long atime_coder(long a1, char *a2, long a3) {
return code_time(*(_QWORD *)(a1 + 232), *(_QWORD *)(a1 + 240), a2, a3);
} | tar | ida |
static void sshsk_free_sign_response(struct sk_sign_response *r) {
if (r == ((void *)0))
return;
freezero(r->sig_r, r->sig_r_len);
freezero(r->sig_s, r->sig_s_len);
freezero(r, sizeof(*r));
} | void sshsk_free_sign_response(unsigned long long a0[5]) {
unsigned long long v1;
unsigned long long v2;
if (a0) {
freezero(a0[1], a0[2], a0[2]);
freezero(a0[3], a0[4], a0[4]);
v2 = freezero(a0, 0x28, v1);
}
return;
} | openssh-portable | angr_dream |
int set_debug_flags(const char *flags) {
const char *pc = flags;
DebugFlags = 0;
while (*pc) {
const char **test;
int mask;
for (test = DebugFlagNames, mask = 1;
*test != ((void *)0) && strcmp_until(*test, pc, ',');
test++, mask <<= 1)
;
if (!*test) {
fprintf(stderr, "unrecognized debug flag <%s> <%s>\n", flags, pc);
return (0);
}
DebugFlags |= mask;
while (*pc && *pc != ',')
pc++;
if (*pc == ',')
pc++;
}
if (DebugFlags) {
int flag;
fprintf(stderr, "debug flags enabled:");
for (flag = 0; DebugFlagNames[flag]; flag++)
if (DebugFlags & (1 << flag))
fprintf(stderr, " %s", DebugFlagNames[flag]);
fprintf(stderr, "\n");
}
return (1);
} | long long set_debug_flags(unsigned int a0) {
unsigned int v0;
unsigned int v1;
char *v2;
unsigned long long v3;
unsigned long long v6;
*(&v2) = a0;
DebugFlags = 0;
while (true) {
if (*(v2)) {
v3 = &DebugFlagNames[0];
for (v0 = 1; *(v3); v0 *= 2) {
if (!strcmp_until(*(v3), v2, 0x2c))
break;
v3 += 8;
}
if (!*(v3)) {
fprintf(*(&stderr), "unrecognized debug flag <%s> <%s>\n", a0, v2);
v6 = 0;
break;
} else {
for (DebugFlags = DebugFlags | v0; *(v2); v2 += 1) {
if (*(v2) == 44)
break;
}
if (*(v2) != 44)
continue;
v2 += 1;
}
} else {
if (DebugFlags) {
fprintf(*(&stderr), "debug flags enabled:");
for (v1 = 0; DebugFlagNames[v1]; v1 += 1) {
if (((DebugFlags >> (v1 & 31)) & 1))
fprintf(*(&stderr), " %s", DebugFlagNames[v1]);
}
fprintf(*(&stderr), "\n");
}
v6 = 1;
break;
}
}
return v6;
} | cronie | angr_dream |
int ssh_packet_connection_is_on_socket(struct ssh *ssh) {
struct session_state *state;
struct sockaddr_storage from, to;
socklen_t fromlen, tolen;
if (ssh == ((void *)0) || ssh->state == ((void *)0))
return 0;
state = ssh->state;
if (state->connection_in == -1 || state->connection_out == -1)
return 0;
if (state->connection_in == state->connection_out)
return 1;
fromlen = sizeof(from);
memset(&from, 0, sizeof(from));
if (getpeername(state->connection_in, (struct sockaddr *)&from, &fromlen) ==
-1)
return 0;
tolen = sizeof(to);
memset(&to, 0, sizeof(to));
if (getpeername(state->connection_out, (struct sockaddr *)&to, &tolen) == -1)
return 0;
if (fromlen != tolen || memcmp(&from, &to, fromlen) != 0)
return 0;
if (from.ss_family != 2 && from.ss_family != 10)
return 0;
return 1;
} | _BOOL8 ssh_packet_connection_is_on_socket(int **a1) {
socklen_t len;
socklen_t v3;
int *v4;
struct sockaddr s[8];
struct sockaddr addr[8];
unsigned long v7;
v7 = __readfsqword(0x28u);
if (!a1 || !*a1)
return 0LL;
v4 = *a1;
if (*v4 == -1 || v4[1] == -1)
return 0LL;
if (*v4 == v4[1])
return 1LL;
len = 128;
memset(s, 0, sizeof(s));
if (getpeername(*v4, s, &len) == -1)
return 0LL;
v3 = 128;
memset(addr, 0, sizeof(addr));
if (getpeername(v4[1], addr, &v3) == -1)
return 0LL;
if (len != v3 || memcmp(s, addr, len))
return 0LL;
return s[0].sa_family == 2 || s[0].sa_family == 10;
} | openssh-portable | ida |
static void print_tcp_metrics(struct rtattr *a) {
struct rtattr *m[(__TCP_METRIC_MAX - 1) + 1 + 1];
unsigned long rtt = 0, rttvar = 0;
int i;
(parse_rtattr_flags(
(m), ((__TCP_METRIC_MAX - 1) + 1),
((void *)(((char *)(a)) +
((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0)))),
((int)((a)->rta_len) -
((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0))),
(1 << 15)));
for (i = 0; i < (__TCP_METRIC_MAX - 1) + 1; i++) {
const char *name;
__u32 val;
char b1[64];
a = m[i + 1];
if (!a)
continue;
val = rta_getattr_u32(a);
switch (i) {
case TCP_METRIC_RTT:
if (!rtt)
rtt = (val * 1000UL) >> 3;
continue;
case TCP_METRIC_RTTVAR:
if (!rttvar)
rttvar = (val * 1000UL) >> 2;
continue;
case TCP_METRIC_RTT_US:
rtt = val >> 3;
continue;
case TCP_METRIC_RTTVAR_US:
rttvar = val >> 2;
continue;
case TCP_METRIC_SSTHRESH:
case TCP_METRIC_CWND:
case TCP_METRIC_REORDERING:
name = metric_name[i];
break;
default:
snprintf(b1, sizeof(b1), " metric_%d ", i);
name = b1;
}
print_uint(PRINT_JSON, name, ((void *)0), val);
print_string(PRINT_FP, ((void *)0), " %s ", name);
print_uint(PRINT_FP, ((void *)0), "%u", val);
}
if (rtt) {
print_float(PRINT_JSON, "rtt", ((void *)0), (double)rtt / usec_per_sec);
print_u64(PRINT_FP, ((void *)0), " rtt %luus", rtt);
}
if (rttvar) {
print_float(PRINT_JSON, "rttvar", ((void *)0),
(double)rttvar / usec_per_sec);
print_u64(PRINT_FP, ((void *)0), " rttvar %luus", rttvar);
}
} | void print_tcp_metrics(unsigned long a0) {
void *v0;
unsigned int v1;
unsigned int v2;
void *v3;
unsigned long long v4;
unsigned long long v5;
char v6;
char v7;
char v8;
unsigned long long *v10;
unsigned long long v11;
v0 = a0;
v3 = 0;
v4 = 0;
parse_rtattr_flags(&v6, 0x7, v0 + 2, *(v0)-4, 0x8000);
for (v1 = 0; v1 <= 6; v1 += 1) {
v0 = *(&(&v6)[8 + 8 * v1]);
if (v0) {
v2 = rta_getattr_u32(v0);
switch (v1) {
case 0:
if (!v3)
v3 = v2 * 1000 >> 3;
break;
case 1:
if (!v4)
v4 = v2 * 1000 >> 2;
break;
case 2:
case 3:
case 4:
v5 = (&metric_name)[v1];
case 5:
v3 = v2 >> 3;
break;
case 6:
v4 = v2 >> 2;
break;
default:
snprintf(&v7, 0x40, " metric_%d ", v1);
v5 = &v7;
}
print_uint(0x2, v5, 0x0, v2);
print_string(0x1, 0x0, " %s ", v5);
print_uint(0x1, 0x0, "%u", v2);
}
}
if (v3) {
print_float(0x2, "rtt", 0x0);
print_u64(0x1, 0x0, " rtt %luus", v3);
}
if (v4) {
print_float(0x2, "rttvar", 0x0);
print_u64(0x1, 0x0, " rttvar %luus", v4);
}
v11 = *(&v8) ^ v10[5];
return;
} | iproute2-6.0.0 | angr_dream |
int addr_ntop(const struct xaddr *n, char *p, size_t len) {
struct sockaddr_storage ss;
socklen_t slen = sizeof(ss);
if (addr_xaddr_to_sa(n, ((struct sockaddr *)(&ss)), &slen, 0) == -1)
return -1;
if (p == ((void *)0) || len == 0)
return -1;
if (getnameinfo(((struct sockaddr *)(&ss)), slen, p, len, ((void *)0), 0,
1) == -1)
return -1;
return 0;
} | undefined8 addr_ntop(undefined8 param_1, char *param_2, long param_3)
{
int iVar1;
undefined8 uVar2;
long in_FS_OFFSET;
socklen_t local_9c;
sockaddr local_98[8];
long local_10;
local_10 = *(long *)(in_FS_OFFSET + 0x28);
local_9c = 0x80;
iVar1 = addr_xaddr_to_sa(param_1, local_98, &local_9c);
if (iVar1 == -1) {
uVar2 = 0xffffffff;
} else if ((param_2 == (char *)0x0) || (param_3 == 0)) {
uVar2 = 0xffffffff;
} else {
iVar1 = getnameinfo(local_98, local_9c, param_2, (socklen_t)param_3,
(char *)0x0, 0, 1);
if (iVar1 == -1) {
uVar2 = 0xffffffff;
} else {
uVar2 = 0;
}
}
if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) {
__stack_chk_fail();
}
return uVar2;
} | openssh-portable | ghidra |
void restore_pipestatus_array(a) ARRAY *a;
{
SHELL_VAR *v;
ARRAY *a2;
v = find_variable("PIPESTATUS");
if (v == 0 || ((((v)->attributes) & (0x0000004))) == 0 ||
(ARRAY *)((v)->value) == 0)
return;
a2 = (ARRAY *)((v)->value);
((v)->value = (char *)(a));
array_dispose(a2);
} | long long restore_pipestatus_array(unsigned long a0) {
struct_0 *v0;
unsigned long long v1;
unsigned long long v3;
v3 = find_variable("PIPESTATUS");
v0 = v3;
if (!v0)
return v3;
v3 = v0->field_28 & 4;
if (!(v0->field_28 & 4))
return v3;
v3 = v0->field_8;
if (v0->field_8) {
v1 = v0->field_8;
v0->field_8 = a0;
v3 = array_dispose(v1);
return v3;
}
return v3;
} | bash | angr_sailr |
static int builtin_status(result)
int result;
{
int r;
switch (result) {
case 258:
case 257:
r = 2;
break;
case 259:
case 260:
case 261:
r = 1;
break;
default:
r = (result > 256) ? 1 : 0;
break;
}
return (r);
} | long builtin_status(int a1) {
if (a1 > 258) {
if ((unsigned int)(a1 - 259) > 2)
return a1 > 256;
return 1;
} else {
if (a1 < 257)
return a1 > 256;
return 2;
}
} | bash | ida |
int rl_end_kbd_macro(int count, int ignore) {
if ((rl_readline_state & (0x0001000)) == 0) {
_rl_abort_internal();
return 1;
}
current_macro_index -= rl_key_sequence_length;
if (current_macro_index < 0)
current_macro_index = 0;
current_macro[current_macro_index] = '\0';
(rl_readline_state &= ~(0x0001000));
return (rl_call_last_kbd_macro(--count, 0));
} | long long rl_end_kbd_macro(unsigned long long a0, unsigned long long a1,
unsigned long long a2, unsigned long long a3,
unsigned long long a4, unsigned long long a5) {
unsigned int v0;
int tmp_26;
unsigned int v1;
unsigned long long v3;
unsigned long long v4;
v1 = a0;
v0 = a1;
if (!(rl_readline_state & 0x1000)) {
_rl_abort_internal(a0, a1, a2, a3, a4, a5);
v3 = 1;
return v3;
}
current_macro_index = current_macro_index - rl_key_sequence_length;
if (current_macro_index < 0)
current_macro_index = 0;
*((current_macro_index + current_macro)) = 0;
v4 = rl_readline_state;
*(&v4) = (rl_readline_state >> 8) & 239;
tmp_26 = v4;
rl_readline_state = tmp_26;
v1 -= 1;
v3 = rl_call_last_kbd_macro(v1, 0x0, current_macro, a3, a4, a5);
return v3;
} | bash | angr_sailr |
static int test_key(int agent_fd, const char *filename) {
struct sshkey *key = ((void *)0);
u_char *sig = ((void *)0);
size_t slen = 0;
int r, ret = -1;
char data[1024];
if ((r = sshkey_load_public(filename, &key, ((void *)0))) != 0) {
sshlog("ssh-add.c", __func__, 485, 0, SYSLOG_LEVEL_ERROR, ssh_err(r),
"Couldn't read public key %s", filename);
return -1;
}
arc4random_buf(data, sizeof(data));
if ((r = ssh_agent_sign(agent_fd, key, &sig, &slen, data, sizeof(data),
((void *)0), 0)) != 0) {
sshlog("ssh-add.c", __func__, 491, 0, SYSLOG_LEVEL_ERROR, ssh_err(r),
"Agent signature failed for %s", filename);
goto done;
}
if ((r = sshkey_verify(key, sig, slen, data, sizeof(data),
((void *)0), 0, ((void *)0))) != 0) {
sshlog("ssh-add.c", __func__, 496, 0, SYSLOG_LEVEL_ERROR, ssh_err(r),
"Signature verification failed for %s", filename);
goto done;
}
ret = 0;
done:
free(sig);
sshkey_free(key);
return ret;
} | int test_key(unsigned long a0, unsigned long long a1) {
void *v0;
unsigned int v1;
unsigned int v2;
void *v3;
void *v4;
void *v5;
char v6;
unsigned int v8;
v3 = 0;
v4 = 0;
v5 = 0;
v1 = -1;
v2 = sshkey_load_public(a1, &v3, 0x0, &v3);
if (v2) {
v0 = a1;
sshlog("ssh-add.c", "test_key", 0x1e5, 0x0, 0x2, ssh_err(v2),
"Couldn't read public key %s");
v8 = -1;
return v8;
}
arc4random_buf(&v6, 0x400);
v0 = 0;
v2 = ssh_agent_sign(a0, v3, &v4, &v5, &v6, 0x400, 0x0);
if (!v2) {
v0 = 0;
v2 = sshkey_verify(v3, v4, v5, &v6, 0x400, 0x0, 0x0);
if (!v2) {
v1 = 0;
} else {
v0 = a1;
sshlog("ssh-add.c", "test_key", 0x1f0, 0x0, 0x2, ssh_err(v2),
"Signature verification failed for %s");
}
} else {
v0 = a1;
sshlog("ssh-add.c", "test_key", 0x1eb, 0x0, 0x2, ssh_err(v2),
"Agent signature failed for %s");
}
free(v4);
sshkey_free(v3);
v8 = v1;
return v8;
} | openssh-portable | angr_sailr |
static void ip_short(uhash_ctx_t ahc, UINT8 *nh_res, u_char *res) {
UINT64 t;
UINT64 *nhp = (UINT64 *)nh_res;
t = ip_aux(0, ahc->ip_keys, nhp[0]);
put_u32((UINT32 *)res + 0, ip_reduce_p36(t) ^ ahc->ip_trans[0]);
t = ip_aux(0, ahc->ip_keys + 4, nhp[1]);
put_u32((UINT32 *)res + 1, ip_reduce_p36(t) ^ ahc->ip_trans[1]);
} | void ip_short(unsigned int a0[308], unsigned long long a1[2],
unsigned long long a2) {
unsigned int v0;
unsigned long long v4;
*(&v0) = ip_aux(0x0, &a0[290], a1[0]);
put_u32(a2, a0[306] ^ ip_reduce_p36(*(&v0)), a0[306] ^ ip_reduce_p36(*(&v0)));
*(&v0) = ip_aux(0x0, &a0[298], a1[1]);
v4 = put_u32(a2 + 4, a0[307] ^ ip_reduce_p36(*(&v0)),
a0[307] ^ ip_reduce_p36(*(&v0)));
return;
} | openssh-portable | angr_dream |
!strcmp(handle_to_name(read_handle), handle_to_name(write_handle))) {
status = 4;
goto out;
} | int strcmp(char *__s1, char *__s2)
{
halt_baddata();
} | openssh-portable | ghidra |
static void fatal(char const *msgid) {
error(0, 0, "%s", gettext(msgid));
exiterr();
} | void fatal(const char *a1) {
char *v1;
v1 = gettext(a1);
error(0, 0, "%s", v1);
exiterr();
} | diffutils | ida |
int number(const char *s) {
intmax_t n = atomax10(s);
if (n < 0 || n > 0x7fffffff)
badnum(s);
return n;
} | long long number(char *a0) {
unsigned long v0;
v0 = atomax10(a0);
if (!((v0 - 0 >> 63)) && v0 < 0x80000000)
return v0;
badnum(a0);
} | dash-0.5.11+git20210903+057cd650a4ed | angr_sailr |
static _Bool
zero_block_p(char const *buffer, size_t size) {
while (size--)
if (*buffer++)
return 0;
return 1;
} | int zero_block_p(unsigned long a0, unsigned long long a1) {
unsigned long long v0;
int tmp_9;
char *v1;
unsigned int v3;
v1 = a0;
v0 = a1;
do {
v3 = v0;
v0 -= 1;
if (!v3) {
v3 = 1;
goto LABEL_40041b;
}
tmp_9 = v1;
v1 += 1;
*(&v3) = *(tmp_9);
} while (!v3);
v3 = 0;
LABEL_40041b:
return v3;
} | tar | angr_phoenix |
ARRAY *array_dequote(array)
ARRAY *array;
{
ARRAY_ELEMENT *a;
char *t;
if (array == 0 || ((array)->head) == 0 || ((array)->num_elements == 0))
return (ARRAY *)((void *)0);
for (a = ((array->head)->next); a != array->head; a = ((a)->next)) {
t = dequote_string(a->value);
do {
if (a->value)
sh_xfree((a->value), "array.c", 356);
} while (0);
a->value = t;
}
return array;
} | long long array_dequote(void *a0) {
unsigned long long v0[3];
unsigned long v1;
void *v3;
if (!a0) {
v3 = 0;
return v3;
} else if (!a0[16]) {
v3 = 0;
return v3;
} else if (!a0[8]) {
v3 = 0;
return v3;
} else {
for (v0[0] = *((a0[16] + 16)); v0 != a0[16]; v0[0] = v0[2]) {
v1 = dequote_string(v0[1]);
if (v0[1])
sh_xfree(v0[1], "array.c", 0x164);
v0[1] = v1;
}
v3 = a0;
return v3;
}
} | bash | angr_sailr |
Prog, "/var/log/faillog", strerror (
(*__errno_location ())
));
exit(1);
}
if (fstat(fileno(fail), &statbuf) != 0) {
fprintf(stderr, gettext("%s: Cannot get the size of %s: %s\n"),
Prog, "/var/log/faillog", strerror((*__errno_location())));
exit(1);
} | char *strerror(int __errnum)
{
halt_baddata();
} | shadow | ghidra |
static _Bool
uintmax_to_chars(uintmax_t v, char *p, size_t s) {
return to_chars(0, v, sizeof v, 0, p, s, "uintmax_t");
} | void uintmax_to_chars(unsigned int a0, char *a1, unsigned long long a2) {
unsigned long long v1;
v1 = to_chars(0x0, a0, 0x8, 0x0, a1, a2, "uintmax_t");
return;
} | tar | angr_phoenix |
static int delete_file(int agent_fd, const char *filename, int key_only,
int qflag) {
struct sshkey *public, *cert = ((void *)0);
char *certpath = ((void *)0), *comment = ((void *)0);
int r, ret = -1;
if (strcmp(filename, "-") == 0)
return delete_stdin(agent_fd, qflag);
if ((r = sshkey_load_public(filename, &public, &comment)) != 0) {
printf("Bad key file %s: %s\n", filename, ssh_err(r));
return -1;
}
if (delete_one(agent_fd, public, comment, filename, qflag) == 0)
ret = 0;
if (key_only)
goto out;
free(comment);
comment = ((void *)0);
xasprintf(&certpath, "%s-cert.pub", filename);
if ((r = sshkey_load_public(certpath, &cert, &comment)) != 0) {
if (r != -24 || (*__errno_location()) != 2)
sshlog("ssh-add.c", __func__, 189, 0, SYSLOG_LEVEL_ERROR, ssh_err(r),
"Failed to load certificate \"%s\"", certpath);
goto out;
}
if (!sshkey_equal_public(cert, public))
sshfatal("ssh-add.c", __func__, 194, 0, SYSLOG_LEVEL_FATAL, ((void *)0),
"Certificate %s does not match private key %s", certpath,
filename);
if (delete_one(agent_fd, cert, comment, certpath, qflag) == 0)
ret = 0;
out:
sshkey_free(cert);
sshkey_free(public);
free(certpath);
free(comment);
return ret;
} | int delete_file(unsigned long a0, unsigned long a1, unsigned long a2,
unsigned long a3) {
unsigned long long v0;
void *v1;
void *v2;
unsigned int v3;
unsigned int v4;
char v5;
void *v6;
void *v7;
void *v8;
unsigned int v10;
v6 = 0;
v7 = 0;
v8 = 0;
v3 = -1;
if (!strcmp(a1, "-")) {
v10 = delete_stdin(a0, a3);
} else {
v4 = sshkey_load_public(a1, &v5, &v8, &v5);
if (v4) {
printf("Bad key file %s: %s\n", a1, ssh_err(v4));
v10 = -1;
} else {
if (!delete_one(a0, *(&v5), v8, a1, a3))
v3 = 0;
if (!a2) {
free(v8);
v8 = 0;
xasprintf(&v7, "%s-cert.pub", a1);
v4 = sshkey_load_public(v7, &v6, &v8, &v6);
if (!v4) {
if (!sshkey_equal_public(v6, *(&v5), *(&v5))) {
v1 = v7;
v0 = "Certificate %s does not match private key %s";
sshfatal("ssh-add.c", "delete_file", 0xc2, 0x0, 0x1, 0x0);
}
if (!delete_one(a0, v6, v8, v7, a3))
v3 = 0;
} else {
if (v4 == -24 && *(__errno_location()) == 2)
goto LABEL_400534;
v2 = v7;
sshlog("ssh-add.c", "delete_file", 0xbd, 0x0, 0x2, ssh_err(v4),
"Failed to load certificate \"%s\"");
LABEL_400534:
}
}
sshkey_free(v6);
sshkey_free(*(&v5));
free(v7);
free(v8);
v10 = v3;
}
}
return v10;
} | openssh-portable | angr_phoenix |
void log_it(const char *username, pid_t xpid, const char *event,
const char *detail, int err) {
pid_t pid = xpid;
if (!syslog_open) {
openlog(ProgramName, 0x01, (9 << 3));
syslog_open = 1;
}
syslog(err != 0 ? 3 : 6, "(%s) %s (%s)%s%s", username, event, detail,
err != 0 ? ": " : "", err != 0 ? strerror(err) : "");
if (DebugFlags) {
fprintf(stderr, "log_it: (%s %ld) %s (%s)%s%s\n", username, (long)pid,
event, detail, err != 0 ? ": " : "", err != 0 ? strerror(err) : "");
}
} | void log_it(unsigned long a0, unsigned long a1, unsigned long long a2,
unsigned long a3, unsigned long a4) {
unsigned long long v0;
unsigned int v2;
unsigned long long v3;
unsigned long long v4;
v0 = a2;
if (!syslog_open) {
openlog(ProgramName, 0x1, 0x48);
syslog_open = 1;
}
if (a4)
strerror(a4);
if (a4)
v2 = 3;
else
v2 = 6;
syslog(v2, "(%s) %s (%s)%s%s");
v3 = DebugFlags;
if (DebugFlags) {
if (a4)
v3 = strerror(a4);
else
*(&v3) = &g_441309;
if (a4)
a2 = ": ";
else
a2 = &g_441309;
v4 = fprintf(stderr, "log_it: (%s %ld) %s (%s)%s%s\n", a0, a1, v0, a3, a2,
v3);
}
return;
} | cronie | angr_dream |
static int fc_do_one_pass(journal_t *journal, struct recovery_info *info,
enum passtype pass) {
unsigned int expected_commit_id = info->end_transaction;
unsigned long next_fc_block;
struct buffer_head *bh;
int err = 0;
next_fc_block = journal->j_fc_first;
if (!journal->j_fc_replay_callback)
return 0;
while (next_fc_block <= journal->j_fc_last) {
do {
if ((3) <= (-1)) {
printf(""
"(%s, %d): %s: ",
"recovery.c", 248, __FUNCTION__);
printf("Fast commit replay: next block %ld\n", next_fc_block);
}
} while (0);
err = jread(&bh, journal, next_fc_block);
if (err) {
do {
if ((3) <= (-1)) {
printf(""
"(%s, %d): %s: ",
"recovery.c", 252, __FUNCTION__);
printf("Fast commit replay: read error\n");
}
} while (0);
break;
}
err = journal->j_fc_replay_callback(journal, bh, pass,
next_fc_block - journal->j_fc_first,
expected_commit_id);
next_fc_block++;
if (err < 0 || err == 0)
break;
err = 0;
}
if (err)
do {
if ((3) <= (-1)) {
printf(""
"(%s, %d): %s: ",
"recovery.c", 266, __FUNCTION__);
printf("Fast commit replay failed, err = %d\n", err);
}
} while (0);
return err;
} | int fc_do_one_pass(unsigned long long a0[26], struct_0 *a1, unsigned long a2) {
unsigned int v0;
unsigned int v1;
unsigned int v3;
unsigned int v5;
v1 = a1->field_4;
v0 = 0;
if (!a0[25]) {
v5 = 0;
return v5;
}
for (*(&v3) = a0[7]; *(&v3) <= a0[9] && !v0 && v0 >= 0 && v0; v0 = 0)
;
v5 = v0;
return v5;
} | e2fsprogs-1.46.5 | angr_sailr |
static unsigned long int integer_arg(char const *s, unsigned long int maxval) {
return xnumtoumax(s, 0, 0, maxval, "bB", gettext("invalid integer argument"),
0);
} | int integer_arg(unsigned long long a0, unsigned long long a1) {
void *v0;
v0 = 0;
return xnumtoumax(a0, 0x0, 0x0, a1, "bB",
gettext("invalid integer argument"));
} | coreutils | angr_dream |
char **bash_default_completion(text, start, end, qc, compflags) const
char *text;
int start, end, qc, compflags;
{
char **matches, *t;
matches = (char **)((void *)0);
if (*text == '$') {
if (qc != '\'' && text[1] == '(')
matches = rl_completion_matches(text, command_subst_completion_function);
else {
matches = rl_completion_matches(text, variable_completion_function);
if (matches && matches[0] && matches[1] == 0) {
t = (char *)strcpy(
sh_xmalloc((1 + strlen(matches[0])), "bashline.c", 1820),
(matches[0]));
bash_filename_stat_hook(&t);
if (file_isdir(t))
rl_completion_append_character = '/';
sh_xfree((t), "bashline.c", 1826);
}
}
}
if (matches == 0 && *text == '~' && mbschr(text, '/') == 0)
matches = rl_completion_matches(text, rl_username_completion_function);
if (matches == 0 && perform_hostname_completion && *text == '@')
matches = rl_completion_matches(text, hostname_completion_function);
if (matches == 0 && (compflags & 1)) {
if (no_empty_command_completion && end == start && text[0] == '\0') {
matches = (char **)((void *)0);
rl_ignore_some_completions_function = bash_ignore_everything;
} else {
dot_in_path = 0;
matches = rl_completion_matches(text, command_word_completion_function);
if (matches == (char **)((void *)0))
rl_ignore_some_completions_function = bash_ignore_filenames;
else if (matches[1] == 0 &&
(absolute_pathname(matches[0]) == 0 &&
absolute_program(matches[0]) == 0 && *(matches[0]) != '~' &&
test_for_directory(matches[0])) &&
dot_in_path == 0)
{
rl_completion_suppress_append = 1;
rl_filename_completion_desired = 0;
} else if (matches[0] && matches[1] &&
((matches[0])[0] == (matches[1])[0] &&
strcmp(matches[0], matches[1]) == 0) &&
(absolute_pathname(matches[0]) == 0 &&
absolute_program(matches[0]) == 0 && *(matches[0]) != '~' &&
test_for_directory(matches[0]))) {
rl_completion_suppress_append = 1;
rl_filename_completion_desired = 0;
}
}
}
if (!matches && completion_glob_pattern((char *)text)) {
matches = rl_completion_matches(text, glob_complete_word);
if (matches && matches[1] && rl_completion_type == '\t') {
strvec_dispose(matches);
matches = (char **)0;
} else if (matches && matches[1] && rl_completion_type == '!') {
rl_completion_suppress_append = 1;
rl_filename_completion_desired = 0;
}
}
return (matches);
} | long long bash_default_completion(char a0[2], unsigned long long a1,
unsigned long a2, unsigned long a3,
unsigned long a4) {
unsigned long long v0;
void *v1;
v1 = 0;
if (a0[0] == 36) {
if (a3 == 39 || a0[1] != 40) {
v1 = rl_completion_matches(a0, variable_completion_function);
if (v1 && *(v1) && !v1[8]) {
v0 = strcpy(sh_xmalloc(strlen(*(v1)) + 1, "bashline.c", 0x71c), *(v1));
bash_filename_stat_hook(&v0, a1, 0x71c);
if (file_isdir(v0))
rl_completion_append_character = 47;
sh_xfree(v0, "bashline.c", 0x722);
}
} else {
v1 = rl_completion_matches(a0, command_subst_completion_function);
}
}
if (!v1 && a0[0] == 126 && !mbschr(a0, 0x2f, 0x722))
v1 = rl_completion_matches(a0, got.rl_username_completion_function);
if (!v1 && perform_hostname_completion && a0[0] == 64)
v1 = rl_completion_matches(a0, hostname_completion_function);
if (!v1 && (a4 & 1)) {
if (a2 != a1 || a0[0]) {
dot_in_path = 0;
v1 = rl_completion_matches(a0, command_word_completion_function);
if (!v1) {
rl_ignore_some_completions_function = bash_ignore_filenames;
} else if (!(v1[8] || absolute_pathname(*(v1)) ||
absolute_program(*(v1)) || *(*(v1)) == 126 ||
!test_for_directory(*(v1)) || dot_in_path)) {
rl_completion_suppress_append = 1;
rl_filename_completion_desired = 0;
} else if (*(v1) && v1[8] && *(*(v1)) == *(v1[8]) &&
!strcmp(*(v1), v1[8]) && !absolute_pathname(*(v1)) &&
!absolute_program(*(v1)) && *(*(v1)) != 126 &&
test_for_directory(*(v1))) {
rl_completion_suppress_append = 1;
rl_filename_completion_desired = 0;
}
} else {
v1 = 0;
rl_ignore_some_completions_function = bash_ignore_everything;
}
}
if (v1) {
return v1;
} else if (!completion_glob_pattern(a0)) {
return v1;
} else {
v1 = rl_completion_matches(a0, glob_complete_word);
if (v1 && v1[8] && rl_completion_type == 9) {
strvec_dispose(v1);
v1 = 0;
return v1;
}
if (v1 && v1[8] && rl_completion_type == 33) {
rl_completion_suppress_append = 1;
rl_filename_completion_desired = 0;
}
return v1;
}
} | bash | angr_sailr |
static void print_select_list(list, list_len, max_elem_len,
indices_len) WORD_LIST *list;
int list_len, max_elem_len, indices_len;
{
int ind, row, elem_len, pos, cols, rows;
int first_column_indices_len, other_indices_len;
if (list == 0) {
putc('\n', stderr);
return;
}
cols = max_elem_len ? COLS / max_elem_len : 1;
if (cols == 0)
cols = 1;
rows = list_len ? list_len / cols + (list_len % cols != 0) : 1;
cols = list_len ? list_len / rows + (list_len % rows != 0) : 1;
if (rows == 1) {
rows = cols;
cols = 1;
}
first_column_indices_len =
((rows < 10)
? 1
: ((rows < 100)
? 2
: ((rows < 1000)
? 3
: ((rows < 10000) ? 4 : ((rows < 100000) ? 5 : 6)))));
other_indices_len = indices_len;
for (row = 0; row < rows; row++) {
ind = row;
pos = 0;
while (1) {
indices_len = (pos == 0) ? first_column_indices_len : other_indices_len;
elem_len = print_index_and_element(indices_len, ind + 1, list);
elem_len += indices_len + 2;
ind += rows;
if (ind >= list_len)
break;
indent(pos + elem_len, pos + max_elem_len);
pos += max_elem_len;
}
putc('\n', stderr);
}
} | void print_select_list(unsigned long long a0, unsigned long a1,
unsigned long a2, unsigned long a3) {
unsigned long long v0;
unsigned int v1;
unsigned int v2;
unsigned int v3;
unsigned int v4;
unsigned int v5;
unsigned int v6;
unsigned long long v7;
unsigned int v8;
unsigned long long v10;
unsigned int v11;
unsigned int v12;
unsigned int v13;
unsigned int v14;
unsigned int v15;
*(&v0) = a3;
if (!a0) {
v10 = putc(0xa, *(&stderr));
} else {
if (!a2)
v11 = 1;
else
v11 = (COLS >> 31 CONCAT COLS) / m a2;
v4 = v11;
if (!v4)
v4 = 1;
if (!a1)
v12 = 1;
else
v12 = ((a1 >> 31 CONCAT a1) / m v4 >> 32) + (a1 >> 31 CONCAT a1) / m v4;
v5 = v12;
if (!a1)
v13 = 1;
else
v13 = ((a1 >> 31 CONCAT a1) / m v5 >> 32) + (a1 >> 31 CONCAT a1) / m v5;
v4 = v13;
if (v5 == 1) {
v5 = v4;
v4 = 1;
}
if (v5 <= 9) {
v14 = 1;
} else if (v5 <= 99) {
v14 = 2;
} else if (v5 <= 999) {
v14 = 3;
} else if (v5 <= 9999) {
v14 = 4;
} else if (v5 <= 99999) {
v14 = 5;
} else {
v14 = 6;
}
v6 = v14;
*(&v7) = v0;
v2 = 0;
while (true) {
v15 = v2;
if (v2 >= v5)
break;
v1 = v2;
v3 = 0;
while (true) {
if (v3)
v15 = v7;
else
v15 = v6;
v0 = v15;
v8 = print_index_and_element(v0, v1 + 1, a0);
v8 += v0 + 2;
v1 += v5;
if (v1 >= a1)
break;
indent(v8 + v3, v3 + a2);
v3 += a2;
}
putc(0xa, *(&stderr));
v2 += 1;
}
}
return;
} | bash | angr_phoenix |
static int netns_get_name(int nsid, char *name) {
struct dirent *entry;
DIR *dir;
int id;
if (nsid < 0)
return -22;
dir = opendir("/var/run/netns");
if (!dir)
return -2;
while ((entry = readdir(dir)) != ((void *)0)) {
if (strcmp(entry->d_name, ".") == 0)
continue;
if (strcmp(entry->d_name, "..") == 0)
continue;
id = get_netnsid_from_name(entry->d_name);
if (id >= 0 && nsid == id) {
strcpy(name, entry->d_name);
closedir(dir);
return 0;
}
}
closedir(dir);
return -2;
} | int netns_get_name(unsigned long a0, char *a1) {
unsigned int v0;
unsigned long long v1;
unsigned long v2;
unsigned int v4;
if (a0 < 0) {
v4 = -22;
return v4;
}
v1 = opendir("/var/run/netns");
if (!v1) {
v4 = -2;
return v4;
}
do {
do {
do {
do {
v2 = readdir64(v1);
if (!v2) {
closedir(v1);
v4 = -2;
return v4;
}
} while (!strcmp(v2 + 19, "."));
} while (!strcmp(v2 + 19, ".."));
} while ((v0 = get_netnsid_from_name(v2 + 19), v0 < 0));
} while (a0 != v0);
strcpy(a1, v2 + 19);
closedir(v1);
v4 = 0;
return v4;
} | iproute2-6.0.0 | angr_sailr |
static _Bool
get_num(const char *str, uintmax_t *num, enum comparison_type *comp_type) {
char *pend;
if (str == ((void *)0))
return 0;
if (comp_type) {
if (!get_comp_type(&str, comp_type))
return 0;
}
return xstrtoumax(str, &pend, 10, num, "") == LONGINT_OK;
} | int get_num(unsigned long long a0, unsigned long long a1,
unsigned long long a2) {
char v0;
char v1;
unsigned int v3;
if (!a0) {
v3 = 0;
return v3;
}
if (a2 && (get_comp_type(&v0, a2) ^ 1)) {
v3 = 0;
return v3;
}
v3 = xstrtoumax(a0, &v1, 0xa, a1, &g_406c06);
*(&v3) = !v3;
return v3;
} | findutils | angr_sailr |
keymacro_get(EditLine *el, wchar_t *ch, keymacro_value_t *val) {
return node_trav(el, el->el_keymacro.map, ch, val);
} | void keymacro_get(long param_1, undefined8 param_2, undefined8 param_3)
{
node_trav(param_1, *(undefined8 *)(param_1 + 0x448), param_2, param_3);
return;
} | libedit | ghidra |
static void max_mtime(const char *dir_name, struct stat *max_st) {
DIR *dir;
struct dirent *dp;
struct stat st;
if (!(dir = opendir(dir_name))) {
max_st->st_mtim.tv_sec = 0;
return;
}
while (((void *)0) != (dp = readdir(dir))) {
char tabname[255 + 1];
if (not_a_crontab(dp) && strcmp(dp->d_name, ".cron.hostname") != 0)
continue;
if (!glue_strings(tabname, sizeof tabname, dir_name, dp->d_name, '/'))
continue;
if (stat(tabname, &st) < 0)
continue;
if (st.st_mtim.tv_sec > max_st->st_mtim.tv_sec)
max_st->st_mtim.tv_sec = st.st_mtim.tv_sec;
}
closedir(dir);
} | void max_mtime(unsigned long long a0, struct_0 *a1) {
unsigned long long v0;
unsigned long long v1;
char v2;
char v3;
char v4;
char v5;
unsigned long long *v7;
unsigned long long v8;
v0 = opendir(a0);
if (!v0) {
a1->field_58 = 0;
} else {
while (true) {
v1 = readdir(v0);
if (!v1)
break;
if ((!not_a_crontab(v1) || !strcmp(v1 + 19, ".cron.hostname")) &&
glue_strings(&v4, 0x100, a0, v1 + 19, 0x2f) && stat(&v4, &v2) >= 0 &&
*(&v3) > a1->field_58)
a1->field_58 = *(&v3);
}
closedir(v0);
}
v8 = *(&v5) ^ v7[5];
return;
} | cronie | angr_sailr |
int platform_sys_dir_uid(uid_t uid) {
if (uid == 0)
return 1;
return 0;
} | long long platform_sys_dir_uid(unsigned long a0) {
unsigned long long v1;
if (!a0)
v1 = 1;
else
v1 = 0;
return v1;
} | openssh-portable | angr_phoenix |
char **shell_glob_filename(pathname, qflags) const char *pathname;
int qflags;
{
char *temp, **results;
int gflags, quoted_pattern;
noglob_dot_filenames = glob_dot_filenames == 0;
temp = quote_string_for_globbing(pathname, 0x02 | qflags);
gflags = glob_star ? 0x400 : 0;
results = glob_filename(temp, gflags);
sh_xfree((temp), "pathexp.c", 419);
if (results && (((results) == (char **)&glob_error_return) == 0)) {
if (should_ignore_glob_matches())
ignore_glob_matches(results);
if (results && results[0])
strvec_sort(results, 1);
else {
do {
if (results)
sh_xfree((results), "pathexp.c", 429);
} while (0);
results = (char **)&glob_error_return;
}
}
return (results);
} | long long shell_glob_filename(void *a0, unsigned long a1) {
unsigned int v0;
unsigned long long v1;
unsigned long long v2;
noglob_dot_filenames = !5023220010551146633;
v2 = quote_string_for_globbing(a0, a1 | 2);
v0 = (!glob_star ? 0x400 : 0);
v1 = glob_filename(v2, v0, v0);
sh_xfree(v2, "pathexp.c", 0x1a3);
switch (v1) {
case 0:
case 5242968:
break;
default:
if (should_ignore_glob_matches())
ignore_glob_matches(v1);
if (!v1 || !*(v1)) {
if (v1)
sh_xfree(v1, "pathexp.c", 0x1ad);
v1 = &glob_error_return;
break;
} else {
strvec_sort(v1, 0x1);
break;
}
}
return v1;
} | bash | angr_sailr |
static char *mklong(const char *str, const char *ch) {
char *copy;
size_t len;
len = ch - str +
sizeof("l"
"d");
((copy) = ((void *)stacknxt));
copy = makestrspace(len, copy);
memcpy(copy, str,
len - sizeof("l"
"d"));
memcpy(copy + len -
sizeof("l"
"d"),
"l"
"d",
sizeof("l"
"d"));
copy[len - 2] = *ch;
return (copy);
} | void *mklong(void *param_1, undefined *param_2)
{
size_t __n;
void *__dest;
__n = (long)param_2 - (long)param_1;
__dest = (void *)makestrspace(__n + 3, stacknxt);
memcpy(__dest, param_1, __n);
memcpy((void *)((long)__dest + __n), &DAT_00101074, 3);
*(undefined *)(__n + 1 + (long)__dest) = *param_2;
return __dest;
} | dash-0.5.11+git20210903+057cd650a4ed | ghidra |
static __inline void _rs_stir_if_needed(size_t len) {
_rs_forkdetect();
if (!rs || rs->rs_count <= len)
_rs_stir();
if (rs->rs_count <= len)
rs->rs_count = 0;
else
rs->rs_count -= len;
} | void _rs_stir_if_needed(unsigned long a0) {
struct_0 *v1;
struct_0 *v2;
_rs_forkdetect();
if (!rs || a0 >= *((rs + 8)))
_rs_stir();
if (a0 >= *((rs + 8))) {
v1 = rs;
*((rs + 8)) = 0;
} else {
v2 = rs;
*((rs + 8)) = *((rs + 8)) - a0;
}
return;
} | openssh-portable | angr_dream |
static void install_signal_handlers(void) {
static int const sig[] = {
20,
14, 1, 2, 13, 3, 15,
29,
27,
26,
24,
25,
};
enum { nsigs = sizeof(sig) / sizeof *(sig) };
{
int j;
struct sigaction act;
sigemptyset(&caught_signals);
for (j = 0; j < nsigs; j++) {
sigaction(sig[j], ((void *)0), &act);
if (act.__sigaction_handler.sa_handler != ((__sighandler_t)1))
sigaddset(&caught_signals, sig[j]);
}
act.sa_mask = caught_signals;
act.sa_flags = 0x10000000;
for (j = 0; j < nsigs; j++)
if (sigismember(&caught_signals, sig[j])) {
act.__sigaction_handler.sa_handler =
sig[j] == 20 ? stophandler : sighandler;
sigaction(sig[j], &act, ((void *)0));
}
}
} | void install_signal_handlers(void)
{
int iVar1;
long in_FS_OFFSET;
int local_ac;
sigaction local_a8;
long local_10;
local_10 = *(long *)(in_FS_OFFSET + 0x28);
sigemptyset((sigset_t *)caught_signals);
for (local_ac = 0; local_ac < 0xc; local_ac = local_ac + 1) {
sigaction(*(int *)(sig_5610 + (long)local_ac * 4), (sigaction *)0x0,
&local_a8);
if (local_a8.__sigaction_handler != (code *)0x1) {
sigaddset((sigset_t *)caught_signals,
*(int *)(sig_5610 + (long)local_ac * 4));
}
}
local_a8.sa_mask.__val[0] = caught_signals._0_8_;
local_a8.sa_mask.__val[1] = caught_signals._8_8_;
local_a8.sa_mask.__val[2] = caught_signals._16_8_;
local_a8.sa_mask.__val[3] = caught_signals._24_8_;
local_a8.sa_mask.__val[4] = caught_signals._32_8_;
local_a8.sa_mask.__val[5] = caught_signals._40_8_;
local_a8.sa_mask.__val[6] = caught_signals._48_8_;
local_a8.sa_mask.__val[7] = caught_signals._56_8_;
local_a8.sa_mask.__val[8] = caught_signals._64_8_;
local_a8.sa_mask.__val[9] = caught_signals._72_8_;
local_a8.sa_mask.__val[10] = caught_signals._80_8_;
local_a8.sa_mask.__val[11] = caught_signals._88_8_;
local_a8.sa_mask.__val[12] = caught_signals._96_8_;
local_a8.sa_mask.__val[13] = caught_signals._104_8_;
local_a8.sa_mask.__val[14] = caught_signals._112_8_;
local_a8.sa_mask.__val[15] = caught_signals._120_8_;
local_a8.sa_flags = 0x10000000;
for (local_ac = 0; local_ac < 0xc; local_ac = local_ac + 1) {
iVar1 = sigismember((sigset_t *)caught_signals,
*(int *)(sig_5610 + (long)local_ac * 4));
if (iVar1 != 0) {
if (*(int *)(sig_5610 + (long)local_ac * 4) == 0x14) {
local_a8.__sigaction_handler = stophandler;
} else {
local_a8.__sigaction_handler = sighandler;
}
sigaction(*(int *)(sig_5610 + (long)local_ac * 4), &local_a8,
(sigaction *)0x0);
}
}
if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) {
__stack_chk_fail();
}
return;
} | diffutils | ghidra |
void get_state_crq_set(gnutls_x509_crq_t crq) {
int ret;
if (batch) {
if (!cfg.state)
return;
ret = gnutls_x509_crq_set_dn_by_oid(crq, "2.5.4.8", 0, cfg.state,
strlen(cfg.state));
if (ret < 0) {
fprintf(stderr, "set_dn: %s\n", gnutls_strerror(ret));
exit(1);
}
} else {
read_crq_set(crq, "State or province name: ", "2.5.4.8");
}
} | long long get_state_crq_set(unsigned long long a0) {
unsigned int v0;
unsigned long long v2;
if (!*(got.batch)) {
v2 = read_crq_set(a0, "State or province name: ", "2.5.4.8");
return v2;
}
v2 = *((got.cfg + 24));
if (!*((got.cfg + 24)))
return v2;
v2 = gnutls_x509_crq_set_dn_by_oid(a0, "2.5.4.8", 0x0, *((got.cfg + 24)),
strlen(*((got.cfg + 24))));
v0 = v2;
if (v0 < 0) {
fprintf(*(got.stderr), "set_dn: %s\n", gnutls_strerror(v0));
exit(0x1);
}
return v2;
} | gnutls | angr_sailr |
static char const *decimal_absval_add_one(char *buf) {
_Bool negative = (buf[1] == '-');
char *absnum = buf + 1 + negative;
char *p = absnum + strlen(absnum);
absnum[-1] = '0';
while (*--p == '9')
*p = '0';
++*p;
char *result = (((absnum) < (p)) ? (absnum) : (p));
if (negative)
*--result = '-';
return result;
} | int decimal_absval_add_one(struct_0 *a0) {
char v0;
char *v1;
char *v2;
char *v3;
unsigned long long v5;
char *v6;
v0 = a0->field_1 == 45;
v3 = &(&a0->field_1)[v0];
v1 = &v3[strlen(v3)];
v3[1] = 48;
while (true) {
v1 += 1;
if (*(v1) != 57)
break;
*(v1) = 48;
}
v5 = *(v1) + 1;
*(v1) = *(v1) + 1;
v6 = v3;
if (v1 <= v5)
v6 = v1;
v2 = v6;
if (v0) {
v2 += 1;
*(v2) = 45;
}
return v2;
} | coreutils | angr_phoenix |
static void usage(int status) {
FILE *usageout = (0 != status) ? stderr : stdout;
(void)fprintf(usageout,
gettext("Usage: %s [options] [LOGIN]\n"
"\n"
"Options:\n")
,
Prog);
(void)fputs(
gettext(" -f, --full-name FULL_NAME change user's full name\n"),
usageout);
(void)fputs(
gettext(
" -h, --home-phone HOME_PHONE change user's home phone number\n"),
usageout);
(void)fputs(gettext(" -o, --other OTHER_INFO change user's other "
"GECOS information\n"),
usageout);
(void)fputs(
gettext(" -r, --room ROOM_NUMBER change user's room number\n"),
usageout);
(void)fputs(
gettext(" -R, --root CHROOT_DIR directory to chroot into\n"),
usageout);
(void)fputs(gettext(" -u, --help display this help "
"message and exit\n"),
usageout);
(void)fputs(gettext(" -w, --work-phone WORK_PHONE change user's office "
"phone number\n"),
usageout);
(void)fputs("\n", usageout);
exit(status);
} | void usage(unsigned long a0) {
void *v0;
unsigned long v1;
unsigned long v3;
void *v4;
v1 = v3;
if (a0)
v4 = stderr;
else
v4 = stdout;
v0 = v4;
fprintf(v0, gettext("Usage: %s [options] [LOGIN]\n\nOptions:\n"));
fputs(gettext(" -f, --full-name FULL_NAME change user's full name\n"),
v0);
fputs(
gettext(
" -h, --home-phone HOME_PHONE change user's home phone number\n"),
v0);
fputs(gettext(" -o, --other OTHER_INFO change user's other GECOS "
"information\n"),
v0);
fputs(gettext(" -r, --room ROOM_NUMBER change user's room number\n"),
v0);
fputs(gettext(" -R, --root CHROOT_DIR directory to chroot into\n"),
v0);
fputs(gettext(" -u, --help display this help message and "
"exit\n"),
v0);
fputs(gettext(" -w, --work-phone WORK_PHONE change user's office phone "
"number\n"),
v0);
fputs("\n", v0);
exit(a0);
} | shadow | angr_dream |
int bsd_getopt(int argc, char *const argv[], const char *shortopts) {
if (optreset == 1) {
optreset = 0;
optind = 0;
}
return (getopt)(argc, argv, shortopts);
} | long long bsd_getopt(unsigned long a0, char **a1, char *a2) {
if (*(got.optreset) == 1) {
*(got.optreset) = 0;
*(got.optind) = 0;
}
return getopt(a0, a1, a2);
} | libbsd-0.11.7 | angr_phoenix |
static void print_rcs_hunk(struct change *hunk) {
lin i, f0, l0, f1, l1;
printint tf0, tl0, tf1, tl1;
enum changes changes = analyze_hunk(hunk, &f0, &l0, &f1, &l1);
if (!changes)
return;
begin_output();
translate_range(&files[0], f0, l0, &tf0, &tl0);
if (changes & OLD) {
fprintf(outfile,
"d%"
"l"
"d %"
"l"
"d\n",
tf0, tf0 <= tl0 ? tl0 - tf0 + 1 : 1);
}
if (changes & NEW) {
translate_range(&files[1], f1, l1, &tf1, &tl1);
fprintf(outfile,
"a%"
"l"
"d %"
"l"
"d\n",
tl0, tf1 <= tl1 ? tl1 - tf1 + 1 : 1);
for (i = f1; i <= l1; i++)
print_1_line("", &files[1].linbuf[i]);
}
} | long long print_rcs_hunk(unsigned long long a0) {
unsigned int v0;
char v1;
char v2;
char v3;
char v4;
char v5;
char v6;
char v7;
char v8;
unsigned long long v9;
unsigned int v11;
unsigned int v12;
v0 = analyze_hunk(a0, &v1, &v2, &v3, &v4);
if (v0) {
begin_output();
translate_range(0x500028, *(&v1), *(&v2), &v5, &v6);
if ((v0 & 1)) {
if (*(&v5) > *(&v6))
v11 = 1;
else
v11 = *(&v6) - *(&v5) + 1;
fprintf(outfile, "d%ld %ld\n", *(&v5), v11);
}
if ((v0 & 2)) {
translate_range(0x500158, *(&v3), *(&v4), &v7, &v8);
if (*(&v7) > *(&v8))
v12 = 1;
else
v12 = *(&v8) - *(&v7) + 1;
fprintf(outfile, "a%ld %ld\n", *(&v6), v12);
for (v9 = *(&v3); v9 <= *(&v4); v9 += 1) {
print_1_line(&g_4004e5, *(5243408) + v9 * 8, v9 * 8);
}
}
}
return 0;
} | diffutils | angr_phoenix |
char *array_to_kvpair(a, quoted)
ARRAY *a;
int quoted;
{
char *result, *valstr, *is;
char indstr[(((sizeof(intmax_t) * 8) - (!((intmax_t)0 < (intmax_t)-1))) *
302 / 1000 +
1 + (!((intmax_t)0 < (intmax_t)-1))) +
1];
ARRAY_ELEMENT *ae;
int rsize, rlen, elen;
if (a == 0 || ((a)->num_elements == 0))
return ((char *)((void *)0));
result = (char *)sh_xmalloc((rsize = 128), "array.c", 964);
result[rlen = 0] = '\0';
for (ae = ((a->head)->next); ae != a->head; ae = ((ae)->next)) {
is = inttostr(((ae)->ind), indstr, sizeof(indstr));
valstr = ((ae)->value) ? (ansic_shouldquote(((ae)->value))
? ansic_quote(((ae)->value), 0, (int *)0)
: sh_double_quote(((ae)->value)))
: (char *)((void *)0);
elen =
(((is) && (is)[0]) ? ((is)[1] ? ((is)[2] ? strlen(is) : 2) : 1) : 0) +
8 +
(((valstr) && (valstr)[0])
? ((valstr)[1] ? ((valstr)[2] ? strlen(valstr) : 2) : 1)
: 0);
do {
if ((rlen) + ((elen + 1)) >= rsize) {
while ((rlen) + ((elen + 1)) >= rsize)
rsize += (rsize);
result = sh_xrealloc((result), (rsize), "array.c", 975);
}
} while (0);
strcpy(result + rlen, is);
rlen +=
(((is) && (is)[0]) ? ((is)[1] ? ((is)[2] ? strlen(is) : 2) : 1) : 0);
result[rlen++] = ' ';
if (valstr) {
strcpy(result + rlen, valstr);
rlen += (((valstr) && (valstr)[0])
? ((valstr)[1] ? ((valstr)[2] ? strlen(valstr) : 2) : 1)
: 0);
} else {
strcpy(result + rlen, "\"\"");
rlen += 2;
}
if (((ae)->next) != a->head)
result[rlen++] = ' ';
do {
if (valstr)
sh_xfree((valstr), "array.c", 991);
} while (0);
}
do {
if ((rlen) + (1) >= rsize) {
while ((rlen) + (1) >= rsize)
rsize += (8);
result = sh_xrealloc((result), (rsize), "array.c", 993);
}
} while (0);
result[rlen] = '\0';
if (quoted) {
valstr = sh_single_quote(result);
sh_xfree((result), "array.c", 999);
result = valstr;
}
return (result);
} | char *array_to_kvpair(long a1, int a2) {
long v3;
int v4;
int v5;
int v6;
int v7;
int v8;
int v9;
int v10;
int v11;
int v12;
_BYTE *v13;
_QWORD *i;
char *src;
char *srca;
char *s;
char v18[24];
unsigned long v19;
v19 = __readfsqword(0x28u);
if (!a1 || !*(_QWORD *)(a1 + 8))
return 0LL;
v10 = 128;
v13 = (_BYTE *)sh_xmalloc(128LL, "array.c", 964LL);
v11 = 0;
*v13 = 0;
for (i = *(_QWORD **)(*(_QWORD *)(a1 + 16) + 16LL);
i != *(_QWORD **)(a1 + 16); i = (_QWORD *)i[2]) {
s = (char *)inttostr(*i, v18, 22LL);
if (i[1]) {
if ((unsigned int)ansic_shouldquote(i[1]))
v3 = ansic_quote(i[1], 0LL, 0LL);
else
v3 = sh_double_quote(i[1]);
} else {
v3 = 0LL;
}
src = (char *)v3;
if (s && *s) {
if (s[1]) {
if (s[2])
v4 = strlen(s) + 8;
else
v4 = 10;
} else {
v4 = 9;
}
} else {
v4 = 8;
}
if (src && *src) {
if (src[1]) {
if (src[2])
v5 = strlen(src);
else
v5 = 2;
} else {
v5 = 1;
}
} else {
v5 = 0;
}
if (v10 <= v4 + v5 + 1 + v11) {
while (v10 <= v4 + v5 + 1 + v11)
v10 *= 2;
v13 = (_BYTE *)sh_xrealloc(v13, v10, "array.c", 975LL);
}
strcpy(&v13[v11], s);
if (s && *s) {
if (s[1]) {
if (s[2])
v6 = strlen(s);
else
v6 = 2;
} else {
v6 = 1;
}
} else {
v6 = 0;
}
v7 = v11 + v6;
v12 = v7 + 1;
v13[v7] = 32;
if (src) {
strcpy(&v13[v12], src);
if (*src) {
if (src[1]) {
if (src[2])
v8 = strlen(src);
else
v8 = 2;
} else {
v8 = 1;
}
} else {
v8 = 0;
}
v11 = v12 + v8;
} else {
strcpy(&v13[v12], "\"\"");
v11 = v12 + 2;
}
if (i[2] != *(_QWORD *)(a1 + 16)) {
v9 = v11++;
v13[v9] = 32;
}
if (src)
sh_xfree(src, "array.c", 991LL);
}
if (v10 <= v11 + 1) {
while (v10 <= v11 + 1)
v10 += 8;
v13 = (_BYTE *)sh_xrealloc(v13, v10, "array.c", 993LL);
}
v13[v11] = 0;
if (a2) {
srca = (char *)sh_single_quote(v13);
sh_xfree(v13, "array.c", 999LL);
return srca;
}
return v13;
} | bash | ida |
test_code_t test_safe_renegotiation_scsv(gnutls_session_t session) {
int ret;
if (ssl3_ok == 0)
return TEST_IGNORE;
sprintf(prio_str,
"NONE:"
"+CIPHER-ALL:+ARCFOUR-128:+3DES-CBC"
":+GOST28147-TC26Z-CNT"
":"
"+COMP-NULL"
":+VERS-TLS1.0:"
"+MAC-ALL:+MD5:+SHA1"
":+GOST28147-TC26Z-IMIT"
":"
"+RSA:+DHE-RSA:+DHE-DSS:+ANON-DH:+ECDHE-RSA:+ECDHE-ECDSA:+ANON-ECDH"
":+VKO-GOST-12"
":%%SAFE_RENEGOTIATION");
{
int _ret;
if ((_ret = __gnutls_priority_set_direct(session, prio_str, 520)) !=
TEST_SUCCEED) {
return _ret;
}
};
gnutls_credentials_set(session, GNUTLS_CRD_CERTIFICATE, xcred);
ret = test_do_handshake(session);
return ret;
} | int test_safe_renegotiation_scsv(undefined8 param_1)
{
int iVar1;
if (ssl3_ok == 0) {
iVar1 = 3;
} else {
sprintf(prio_str,
"NONE:+CIPHER-ALL:+ARCFOUR-128:+3DES-CBC:+GOST28147-TC26Z-CNT:+"
"COMP-NULL:+VERS-TLS1.0:+MAC-ALL:+MD5:+SHA1:+GOST28147-TC26Z-IMIT:+"
"RSA:+DHE-RSA:+DHE-DSS:+ANON-DH:+ECDHE-RSA:+ECDHE-ECDSA:+ANON-ECDH:"
"+VKO-GOST-12:%%SAFE_RENEGOTIATION");
iVar1 = __gnutls_priority_set_direct(param_1, prio_str, 0x208);
if (iVar1 == 0) {
gnutls_credentials_set(param_1, 1, xcred);
iVar1 = test_do_handshake(param_1);
}
}
return iVar1;
} | gnutls | ghidra |
static int sshkey_parse_private_pem_fileblob(struct sshbuf *blob, int type,
const char *passphrase,
struct sshkey **keyp) {
EVP_PKEY *pk = ((void *)0);
struct sshkey *prv = ((void *)0);
BIO *bio = ((void *)0);
int r;
if (keyp != ((void *)0))
*keyp = ((void *)0);
if ((bio = BIO_new(BIO_s_mem())) == ((void *)0) ||
sshbuf_len(blob) > 0x7fffffff)
return -2;
if (BIO_write(bio, sshbuf_ptr(blob), sshbuf_len(blob)) !=
(int)sshbuf_len(blob)) {
r = -2;
goto out;
}
clear_libcrypto_errors();
if ((pk = PEM_read_bio_PrivateKey(bio, ((void *)0), pem_passphrase_cb,
(char *)passphrase)) == ((void *)0)) {
if (passphrase != ((void *)0) && *passphrase != '\0')
r = -43;
else
r = convert_libcrypto_error();
goto out;
}
if (EVP_PKEY_get_base_id(pk) == 6 &&
(type == KEY_UNSPEC || type == KEY_RSA)) {
if ((prv = sshkey_new(KEY_UNSPEC)) == ((void *)0)) {
r = -2;
goto out;
}
prv->rsa = EVP_PKEY_get1_RSA(pk);
prv->type = KEY_RSA;
if (RSA_blinding_on(prv->rsa, ((void *)0)) != 1) {
r = -22;
goto out;
}
if ((r = sshkey_check_rsa_length(prv, 0)) != 0)
goto out;
} else if (EVP_PKEY_get_base_id(pk) == 116 &&
(type == KEY_UNSPEC || type == KEY_DSA)) {
if ((prv = sshkey_new(KEY_UNSPEC)) == ((void *)0)) {
r = -2;
goto out;
}
prv->dsa = EVP_PKEY_get1_DSA(pk);
prv->type = KEY_DSA;
} else if (EVP_PKEY_get_base_id(pk) == 408 &&
(type == KEY_UNSPEC || type == KEY_ECDSA)) {
if ((prv = sshkey_new(KEY_UNSPEC)) == ((void *)0)) {
r = -2;
goto out;
}
prv->ecdsa = EVP_PKEY_get1_EC_KEY(pk);
prv->type = KEY_ECDSA;
prv->ecdsa_nid = sshkey_ecdsa_key_to_nid(prv->ecdsa);
if (prv->ecdsa_nid == -1 ||
sshkey_curve_nid_to_name(prv->ecdsa_nid) == ((void *)0) ||
sshkey_ec_validate_public(EC_KEY_get0_group(prv->ecdsa),
EC_KEY_get0_public_key(prv->ecdsa)) != 0 ||
sshkey_ec_validate_private(prv->ecdsa) != 0) {
r = -4;
goto out;
}
} else {
r = -4;
goto out;
}
r = 0;
if (keyp != ((void *)0)) {
*keyp = prv;
prv = ((void *)0);
}
out:
BIO_free(bio);
EVP_PKEY_free(pk);
sshkey_free(prv);
return r;
} | void sshkey_parse_private_pem_fileblob(unsigned long long a0, unsigned long a1,
char *a2, unsigned long long *a3) {
unsigned int v0;
void *v1;
void *v2;
void *v3;
unsigned long long v5;
unsigned long long v6;
unsigned long long v7;
unsigned long long v10;
unsigned long long v11;
unsigned long long v12;
unsigned long long v13;
unsigned long long v14;
unsigned long long v15;
unsigned long long v16;
unsigned long long v17;
v1 = 0;
v2 = 0;
v3 = 0;
if (a3)
*(a3) = 0;
v3 = BIO_new(BIO_s_mem());
if (v3) {
v5 = sshbuf_len(a0);
if (v5 < 0x80000000) {
v7 = sshbuf_ptr(a0);
if (BIO_write(v3, v7, sshbuf_len(a0), v7) != sshbuf_len(a0)) {
v0 = -2;
} else {
clear_libcrypto_errors();
v1 = PEM_read_bio_PrivateKey(v3, 0x0, pem_passphrase_cb, a2);
if (!v1) {
if (a2 && *(a2))
v0 = -43;
if (!*(a2) || !a2)
v0 = convert_libcrypto_error();
} else {
v10 = EVP_PKEY_get_base_id(v1);
if (v10 == 6 && (a1 == 14 || !a1)) {
v2 = sshkey_new(0xe);
if (!v2) {
v0 = -2;
} else {
*(&v2[8]) = EVP_PKEY_get1_RSA(v1);
*(v2) = 0;
v12 = RSA_blinding_on(v2[8], 0x0);
if (v12 != 1)
v0 = -22;
else
v0 = sshkey_check_rsa_length(v2, 0x0);
}
}
if (v10 != 6 || a1 != 14 && a1)
v11 = EVP_PKEY_get_base_id(v1);
if (v11 == 116 && (v10 != 6 || a1 != 14 && a1) &&
(a1 == 1 || a1 == 14)) {
v2 = sshkey_new(0xe);
if (!v2) {
v0 = -2;
} else {
*(&v2[16]) = EVP_PKEY_get1_DSA(v1);
*(v2) = 1;
}
}
if ((a1 != 1 || v11 != 116) &&
(v10 != 6 && a1 != 14 || v10 != 6 && v11 != 116 ||
a1 != 14 && a1)) {
v13 = EVP_PKEY_get_base_id(v1);
if (v13 == 408 && (a1 == 2 || a1 == 14)) {
v2 = sshkey_new(0xe);
if (!v2) {
v0 = -2;
} else {
*(&v2[32]) = EVP_PKEY_get1_EC_KEY(v1);
*(v2) = 2;
*(&v2[24]) = sshkey_ecdsa_key_to_nid(v2[32]);
if (v2[24] != -1) {
v14 = sshkey_curve_nid_to_name(v2[24]);
if (v14) {
v15 = sshkey_ec_validate_public(
EC_KEY_get0_group(v2[32]),
EC_KEY_get0_public_key(v2[32]));
if (!v15)
v16 = sshkey_ec_validate_private(v2[32]);
}
}
}
}
if ((v13 != 408 || a1 != 2) && (v13 != 408 || a1 != 14))
v0 = -0x4;
}
if (v13 == 408 && !v15 && v2 && v2[24] != -1 && v14 &&
(a1 == 2 || a1 == 14) && (a1 != 1 || v11 != 116) &&
(v10 != 6 || a1 != 14) && (v10 != 6 || a1) &&
(a1 != 14 || v11 != 116) && v16 ||
v13 == 408 && v2 && v2[24] != -1 && v14 &&
(a1 == 2 || a1 == 14) && (a1 != 1 || v11 != 116) &&
(v10 != 6 || a1 != 14) && (v10 != 6 || a1) &&
(a1 != 14 || v11 != 116) && v15 ||
v13 == 408 && v2 && v2[24] != -1 && (a1 == 2 || a1 == 14) &&
(a1 != 1 || v11 != 116) && (v10 != 6 || a1 != 14) &&
(v10 != 6 || a1) && (a1 != 14 || v11 != 116) && !v14 ||
v13 == 408 && v2 && (a1 == 2 || a1 == 14) &&
(a1 != 1 || v11 != 116) && (v10 != 6 || a1 != 14) &&
(v10 != 6 || a1) && (a1 != 14 || v11 != 116) && v2[24] == -1)
v0 = -0x4;
if (v10 == 6 && v12 == 1 && v2 && (a1 == 14 || !a1) && !v0 ||
v11 == 116 && v2 && (a1 == 1 || a1 == 14) &&
(v10 != 6 || a1 != 14) && (v10 != 6 || a1) ||
v13 == 408 && !v15 && v2 && v2[24] != -1 && v14 &&
(a1 == 2 || a1 == 14) && (a1 != 1 || v11 != 116) &&
(v10 != 6 || a1 != 14) && (v10 != 6 || a1) &&
(a1 != 14 || v11 != 116) && !v16) {
v0 = 0;
if (a3) {
*(a3) = v2;
v2 = 0;
}
}
}
}
BIO_free(v3);
EVP_PKEY_free(v1);
sshkey_free(v2);
v17 = v0;
}
}
if (!v3 || v5 >= 0x80000000)
v6 = 4294967294;
return;
} | openssh-portable | angr_dream |
static void print(void) {
const struct passwd *pwent;
unsigned long lastlog_uid_max;
lastlog_uid_max = getdef_ulong("LASTLOG_UID_MAX", 0xFFFFFFFFUL);
if ((has_umin && umin > lastlog_uid_max) ||
(has_umax && umax > lastlog_uid_max)) {
fprintf(
stderr,
gettext("%s: Selected uid(s) are higher than LASTLOG_UID_MAX (%lu),\n"
"\tthe output might be incorrect.\n"),
Prog, lastlog_uid_max);
}
if (uflg && has_umin && has_umax && (umin == umax)) {
print_one(getpwuid((uid_t)umin));
} else {
setpwent();
while ((pwent = getpwent()) != ((void *)0)) {
if (uflg && ((has_umin && (pwent->pw_uid < (uid_t)umin)) ||
(has_umax && (pwent->pw_uid > (uid_t)umax)))) {
continue;
} else if (!uflg && pwent->pw_uid > (uid_t)lastlog_uid_max) {
continue;
}
print_one(pwent);
}
endpwent();
}
} | void print() {
unsigned long v0;
struct_0 *v1;
unsigned long long v3;
unsigned long long v4;
v0 = getdef_ulong("LASTLOG_UID_MAX", 0xffffffff);
if (has_umin && v0 < umin)
goto LABEL_400493;
if (!has_umax)
goto LABEL_4004c7;
if (!(v0 < umax))
goto LABEL_4004c7;
LABEL_400493:
fprintf(stderr, gettext("%s: Selected uid(s) are higher than LASTLOG_UID_MAX "
"(%lu),\n\tthe output might be incorrect.\n"));
LABEL_4004c7:
if (uflg && has_umin && has_umax && umin == umax) {
v3 = print_one(getpwuid(umin));
goto LABEL_4005a9;
}
setpwent();
while (true) {
v1 = &getpwent()->pw_name;
if (!v1)
break;
if (uflg) {
if (has_umin && v1->field_10 < umin)
continue;
if (has_umax && !(v1->field_10 <= umax))
continue;
}
if ((uflg ^ 1) && !(v1->field_10 <= v0))
continue;
print_one(v1);
}
v4 = endpwent();
LABEL_4005a9:
return;
} | shadow | angr_phoenix |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.