input stringlengths 26 172k | output stringlengths 18 318k | repo_name stringclasses 23 values | decompiler stringclasses 5 values |
|---|---|---|---|
const char *log_level_name(LogLevel level) {
u_int i;
for (i = 0; log_levels[i].name != ((void *)0); i++)
if (log_levels[i].val == level)
return log_levels[i].name;
return ((void *)0);
} | long long log_level_name(unsigned long a0) {
unsigned int v0;
void *v2;
v0 = 0;
while (true) {
if (!log_levels[2 * v0]) {
v2 = 0;
break;
} else if (a0 == g_401308[4 * v0]) {
v2 = log_levels[2 * v0];
break;
} else {
v0 += 1;
}
}
return v2;
} | openssh-portable | angr_dream |
static void print_date(time_t date) {
struct tm *tp;
char buf[80];
tp = gmtime(&date);
if (((void *)0) == tp) {
(void)printf("time_t: %lu\n", (unsigned long)date);
} else {
(void)strftime(buf, sizeof buf, iflg ? "%Y-%m-%d" : "%b %d, %Y", tp);
(void)puts(buf);
}
} | void print_date(unsigned long a0) {
char v0;
void *v1;
char v2;
char v3;
unsigned long long v5;
unsigned long long *v6;
unsigned long long v7;
v1 = gmtime(&v0);
if (!v1) {
printf("time_t: %lu\n", a0);
} else {
if (iflg)
v5 = "%Y-%m-%d";
else
v5 = "%b %d, %Y";
strftime(&v2, 0x50, v5, v1);
puts(&v2);
}
v7 = *(&v3) ^ v6[5];
return;
} | shadow | angr_phoenix |
static wchar_t *do_mbyte(wchar_t *dst, wint_t c, int flags, wint_t nextc,
int iswextra) {
if (flags & 0x0002) {
switch (c) {
case L'\n':
*dst++ = L'\\';
*dst++ = L'n';
return dst;
case L'\r':
*dst++ = L'\\';
*dst++ = L'r';
return dst;
case L'\b':
*dst++ = L'\\';
*dst++ = L'b';
return dst;
case L'\a':
*dst++ = L'\\';
*dst++ = L'a';
return dst;
case L'\v':
*dst++ = L'\\';
*dst++ = L'v';
return dst;
case L'\t':
*dst++ = L'\\';
*dst++ = L't';
return dst;
case L'\f':
*dst++ = L'\\';
*dst++ = L'f';
return dst;
case L' ':
*dst++ = L'\\';
*dst++ = L's';
return dst;
case L'\0':
*dst++ = L'\\';
*dst++ = L'0';
if ((((u_char)(nextc)) >= L'0' && ((u_char)(nextc)) <= L'7')) {
*dst++ = L'0';
*dst++ = L'0';
}
return dst;
case L'n':
case L'r':
case L'b':
case L'a':
case L'v':
case L't':
case L'f':
case L's':
case L'0':
case L'M':
case L'^':
case L'$':
break;
default:
if ((((flags) & 0x4000)
? ((*__ctype_b_loc())[(int)((c))] & (unsigned short int)_ISgraph)
: iswgraph(c)) &&
!(((u_char)(c)) >= L'0' && ((u_char)(c)) <= L'7')) {
*dst++ = L'\\';
*dst++ = c;
return dst;
}
}
}
if (iswextra || ((c & 0177) == L' ') || (flags & 0x0001)) {
*dst++ = L'\\';
*dst++ = (u_char)(((u_int32_t)(u_char)c >> 6) & 03) + L'0';
*dst++ = (u_char)(((u_int32_t)(u_char)c >> 3) & 07) + L'0';
*dst++ = (c & 07) + L'0';
} else {
if ((flags & 0x0040) == 0)
*dst++ = L'\\';
if (c & 0200) {
c &= 0177;
*dst++ = L'M';
}
if (iswcntrl(c)) {
*dst++ = L'^';
if (c == 0177)
*dst++ = L'?';
else
*dst++ = c + L'@';
} else {
*dst++ = L'-';
*dst++ = c;
}
}
return dst;
} | int do_mbyte(unsigned long long a0, unsigned long a1, unsigned long a2,
unsigned long a3, unsigned long a4) {
unsigned int v0;
int tmp_14;
int tmp_22;
int tmp_10;
int tmp_18;
int tmp_11;
int tmp_19;
int tmp_12;
int tmp_20;
int tmp_44;
int tmp_70;
int tmp_109;
int tmp_135;
unsigned int *v1;
unsigned int v3;
unsigned int *v5;
unsigned int *v6;
unsigned int *v7;
v1 = a0;
v0 = a1;
if ((a2 & 2)) {
switch (v0) {
case 0:
tmp_14 = v1;
v1 = v1 + 1;
*(tmp_14) = 92;
tmp_22 = v1;
v1 = v1 + 1;
*(tmp_22) = 48;
if (a3 > 47 && a3 <= 55) {
tmp_10 = v1;
v1 = v1 + 1;
*(tmp_10) = 48;
tmp_18 = v1;
v1 = v1 + 1;
*(tmp_18) = 48;
}
v3 = v1;
break;
case 7:
tmp_11 = v1;
v1 = v1 + 1;
*(tmp_11) = 92;
tmp_19 = v1;
v1 = v1 + 1;
*(tmp_19) = 97;
v3 = v1;
break;
case 8:
tmp_11 = v1;
v1 = v1 + 1;
*(tmp_11) = 92;
tmp_19 = v1;
v1 = v1 + 1;
*(tmp_19) = 98;
v3 = v1;
break;
case 9:
tmp_11 = v1;
v1 = v1 + 1;
*(tmp_11) = 92;
tmp_19 = v1;
v1 = v1 + 1;
*(tmp_19) = 116;
v3 = v1;
break;
case 10:
tmp_11 = v1;
v1 = v1 + 1;
*(tmp_11) = 92;
tmp_19 = v1;
v1 = v1 + 1;
*(tmp_19) = 110;
v3 = v1;
break;
case 11:
tmp_11 = v1;
v1 = v1 + 1;
*(tmp_11) = 92;
tmp_19 = v1;
v1 = v1 + 1;
*(tmp_19) = 118;
v3 = v1;
break;
case 12:
tmp_11 = v1;
v1 = v1 + 1;
*(tmp_11) = 92;
tmp_19 = v1;
v1 = v1 + 1;
*(tmp_19) = 102;
v3 = v1;
break;
case 13:
tmp_11 = v1;
v1 = v1 + 1;
*(tmp_11) = 92;
tmp_19 = v1;
v1 = v1 + 1;
*(tmp_19) = 114;
v3 = v1;
break;
case 32:
tmp_11 = v1;
v1 = v1 + 1;
*(tmp_11) = 92;
tmp_19 = v1;
v1 = v1 + 1;
*(tmp_19) = 115;
v3 = v1;
break;
default:
if ((a2 & 0x4000)) {
v3 = *((*(__ctype_b_loc()) + v0 * 2));
*(&v3) = v3 >> 15;
} else {
v3 = iswgraph(v0);
}
}
}
if (v3 && v0 <= 47) {
tmp_12 = v1;
v1 = v1 + 1;
*(tmp_12) = 92;
tmp_20 = v1;
v1 = v1 + 1;
*(tmp_20) = v0;
*(&v3) = v1;
}
if (!a4 && (v0 & 127) != 32 && !(a2 & 1)) {
if (!(a2 & 64)) {
v5 = v1;
v1 = v1 + 1;
*(v5) = 92;
}
if ((v0 & 128)) {
v0 &= 127;
v6 = v1;
v1 = v1 + 1;
*(v6) = 77;
}
v3 = iswcntrl(v0);
if (v3) {
v7 = v1;
v1 = v1 + 1;
*(v7) = 94;
if (v0 == 127) {
v3 = v1;
v1 = v1 + 1;
*(v3) = 63;
} else {
v3 = v1;
v1 = v1 + 1;
*(v3) = v0 + 64;
}
} else {
tmp_11 = v1;
v1 = v1 + 1;
*(tmp_11) = 45;
tmp_19 = v1;
v1 = v1 + 1;
*(tmp_19) = v0;
}
}
if ((v0 & 127) == 32 || (a2 & 1) || a4) {
tmp_44 = v1;
v1 = v1 + 1;
*(tmp_44) = 92;
tmp_70 = v1;
v1 += 1;
*(tmp_70) = (v0 >> 6) + 48;
tmp_109 = v1;
v1 += 1;
*(tmp_109) = ((v0 >> 3) & 7) + 48;
tmp_135 = v1;
v1 += 1;
*(tmp_135) = (v0 & 7) + 48;
}
*(&v3) = v1;
return v3;
} | libedit | angr_dream |
static int redir_open(filename, flags, mode, ri)
char *filename;
int flags, mode;
enum r_instruction ri;
{
int fd, r, e;
r = find_string_in_alist(filename, _redir_special_filenames, 1);
if (r >= 0)
return (redir_special_open(r, filename, flags, mode, ri));
if (noclobber && (ri == r_output_direction || ri == r_err_and_out)) {
fd = noclobber_open(filename, flags, mode, ri);
if (fd == -2)
return (-2);
} else {
do {
fd = open(filename, flags, mode);
e = (*__errno_location());
if (fd < 0 && e == 4) {
do {
if (terminating_signal)
termsig_handler(terminating_signal);
if (interrupt_state)
throw_to_top_level();
} while (0);
run_pending_traps();
}
(*__errno_location()) = e;
} while (fd < 0 && (*__errno_location()) == 4);
}
return fd;
} | int redir_open(char *a0, unsigned long a1, unsigned long a2, unsigned long a3) {
unsigned int v0;
unsigned int v1;
unsigned int v2;
unsigned int v4;
v1 = find_string_in_alist(a0, &_redir_special_filenames, 0x1);
if (v1 >= 0) {
v4 = redir_special_open(v1, a0, a1, a2, a3);
} else if (!noclobber) {
while (true) {
LABEL_400fd9:
v4 = open(a0, a1, a2);
v0 = v4;
v4 = *(__errno_location());
v2 = v4;
if (v0 < 0 && v2 == 4) {
if (terminating_signal)
termsig_handler(terminating_signal);
if (interrupt_state)
throw_to_top_level();
run_pending_traps();
}
*(__errno_location()) = v2;
if (v0 >= 0)
break;
v4 = *(__errno_location());
if (v4 != 4)
break;
}
v4 = v0;
} else {
if (a3 && !(a3 == 10))
goto LABEL_400fd9;
v0 = noclobber_open(a0, a1, a2, a3);
if (v0 == -2)
v4 = -2;
}
return v4;
} | bash | angr_phoenix |
void invalidate_cached_quoted_dollar_at() {
dispose_words(cached_quoted_dollar_at);
cached_quoted_dollar_at = 0;
} | long long invalidate_cached_quoted_dollar_at() {
cached_quoted_dollar_at = 0;
return dispose_words(cached_quoted_dollar_at);
} | bash | angr_phoenix |
static COPROC_COM *copy_coproc_command(com)
COPROC_COM *com;
{
COPROC_COM *new_coproc;
new_coproc =
(COPROC_COM *)sh_xmalloc((sizeof(COPROC_COM)), "copy_cmd.c", 242);
new_coproc->name = (char *)strcpy(
sh_xmalloc((1 + strlen(com->name)), "copy_cmd.c", 243), (com->name));
new_coproc->command = copy_command(com->command);
new_coproc->flags = com->flags;
return (new_coproc);
} | int copy_coproc_command(struct_0 *a0) {
struct_0 *v0;
v0 = sh_xmalloc(0x18, "copy_cmd.c", 0xf2);
v0->field_8 = strcpy(sh_xmalloc(strlen(a0->field_8) + 1, "copy_cmd.c", 0xf3),
a0->field_8);
v0->field_10 = copy_command(a0->field_10);
v0->field_0 = a0->field_0;
return v0;
} | bash | angr_dream |
const char *safely_quote_err_filename(int n, char const *arg) {
return quotearg_n_style(n, options.err_quoting_style, arg);
} | int safely_quote_err_filename(unsigned long a0, unsigned long long a1) {
return quotearg_n_style(a0, g_5000c4, a1);
} | findutils | angr_dream |
static int is_regular_file(const char *name) {
struct stat stbuf;
if (stat(name, &stbuf) == 0)
return ((((stbuf.st_mode)) & 0170000) == (0100000));
else
return (*__errno_location()) == 2;
} | int is_regular_file(char *a0) {
char v0;
char v1;
return (!stat(a0, &v0) ? *(__errno_location()) == 2
: (*(&v1) & 0xf000) == 0x8000);
} | tar | angr_sailr |
static void tok_finish(Tokenizer *tok) {
*tok->wptr = '\0';
if ((tok->flags & 1) || tok->wptr != tok->wstart) {
tok->argv[tok->argc++] = tok->wstart;
tok->argv[tok->argc] = ((void *)0);
tok->wstart = ++tok->wptr;
}
tok->flags &= ~1;
} | void tok_finish(struct_0 *a0) {
struct_2 *v0;
int tmp_53;
unsigned long long *v2;
struct_2 *v3;
v0 = &a0->padding_0;
a0->field_20->field_0 = 0;
if ((a0->field_44 & 1) || a0->field_20 != a0->field_30) {
v2 = a0->field_18;
tmp_53 = a0->field_8;
a0->field_8 = a0->field_8 + 1;
v2[tmp_53] = a0->field_30;
*((a0->field_8 * 8 + a0->field_18)) = 0;
a0->field_20 = a0->field_20 + 1;
a0->field_30 = a0->field_20;
}
v3 = a0;
a0->field_44 = a0->field_44 & -2;
return;
} | libedit | angr_sailr |
void *malloc_watch(addr) void *addr;
{
register int i;
void *ret;
if (addr == 0)
return addr;
ret = (void *)0;
return ret;
} | long malloc_watch() { return 0LL; } | bash | ida |
static _Bool
unquote(char const *s, struct E_string *es) {
size_t len = strlen(s);
es->s = xmalloc(len);
es->escaped = xcalloc(len, sizeof es->escaped[0]);
unsigned int j = 0;
for (unsigned int i = 0; s[i]; i++) {
unsigned char c;
int oct_digit;
switch (s[i]) {
case '\\':
es->escaped[j] = 1;
switch (s[i + 1]) {
case '\\':
c = '\\';
break;
case 'a':
c = '\a';
break;
case 'b':
c = '\b';
break;
case 'f':
c = '\f';
break;
case 'n':
c = '\n';
break;
case 'r':
c = '\r';
break;
case 't':
c = '\t';
break;
case 'v':
c = '\v';
break;
case '0':
case '1':
case '2':
case '3':
case '4':
case '5':
case '6':
case '7':
c = s[i + 1] - '0';
oct_digit = s[i + 2] - '0';
if (0 <= oct_digit && oct_digit <= 7) {
c = 8 * c + oct_digit;
++i;
oct_digit = s[i + 2] - '0';
if (0 <= oct_digit && oct_digit <= 7) {
if (8 * c + oct_digit < N_CHARS) {
c = 8 * c + oct_digit;
++i;
} else {
error(0, 0,
gettext("warning: the ambiguous octal escape \\%c%c%c is "
"being\n\tinterpreted as the 2-byte sequence "
"\\0%c%c, %c"),
s[i], s[i + 1], s[i + 2], s[i], s[i + 1], s[i + 2]);
}
}
}
break;
case '\0':
error(0, 0,
gettext("warning: an unescaped backslash "
"at end of string is not portable"));
es->escaped[j] = 0;
i--;
c = '\\';
break;
default:
c = s[i + 1];
break;
}
++i;
es->s[j++] = c;
break;
default:
es->s[j++] = s[i];
break;
}
}
es->len = j;
return 1;
} | undefined8 unquote(char *param_1, long *param_2)
{
char cVar1;
char cVar2;
char cVar3;
char cVar4;
char cVar5;
char cVar6;
uint uVar7;
int iVar8;
size_t sVar9;
long lVar10;
undefined8 uVar11;
undefined8 uVar12;
byte local_4d;
uint local_4c;
uint local_48;
sVar9 = strlen(param_1);
lVar10 = xmalloc(sVar9);
*param_2 = lVar10;
lVar10 = xcalloc(sVar9, 1);
param_2[1] = lVar10;
local_4c = 0;
local_48 = 0;
do {
if (param_1[local_48] == '\0') {
param_2[2] = (ulong)local_4c;
return 1;
}
if (param_1[local_48] == '\\') {
*(undefined *)((ulong)local_4c + param_2[1]) = 1;
cVar1 = param_1[local_48 + 1];
iVar8 = (int)cVar1;
if (cVar1 == '\0') {
uVar11 = gettext(
"warning: an unescaped backslash at end of string is not portable");
error(0, 0, uVar11);
*(undefined *)((ulong)local_4c + param_2[1]) = 0;
local_4d = 0x5c;
uVar7 = local_48 - 1;
goto LAB_00100986;
}
uVar7 = local_48;
if (((cVar1 < '\0') || (0x76 < iVar8)) || (iVar8 < 0x30)) {
switchD_00100776_caseD_38:
local_4d = param_1[local_48 + 1];
} else {
switch (iVar8) {
case 0x30:
case 0x31:
case 0x32:
case 0x33:
case 0x34:
case 0x35:
case 0x36:
case 0x37:
local_4d = param_1[local_48 + 1] - 0x30;
iVar8 = param_1[local_48 + 2] + -0x30;
if ((-1 < iVar8) && (iVar8 < 8)) {
local_4d = local_4d * '\b' + (char)iVar8;
uVar7 = local_48 + 1;
iVar8 = param_1[local_48 + 3] + -0x30;
if ((-1 < iVar8) && (iVar8 < 8)) {
if ((int)(iVar8 + (uint)local_4d * 8) < 0x100) {
local_4d = local_4d * '\b' + (char)iVar8;
uVar7 = local_48 + 2;
} else {
cVar1 = param_1[local_48 + 3];
cVar2 = param_1[local_48 + 2];
cVar3 = param_1[uVar7];
cVar4 = param_1[local_48 + 3];
cVar5 = param_1[local_48 + 2];
cVar6 = param_1[uVar7];
uVar12 = 0x100900;
uVar11 = gettext(
"warning: the ambiguous octal escape \\%c%c%c is "
"being\n\tinterpreted as the 2-byte sequence \\0%c%c, %c");
error(0, 0, uVar11, (int)cVar6, (int)cVar5, (int)cVar4,
(int)cVar3, (int)cVar2, (int)cVar1, uVar12);
}
}
}
break;
default:
goto switchD_00100776_caseD_38;
case 0x5c:
local_4d = 0x5c;
break;
case 0x61:
local_4d = 7;
break;
case 0x62:
local_4d = 8;
break;
case 0x66:
local_4d = 0xc;
break;
case 0x6e:
local_4d = 10;
break;
case 0x72:
local_4d = 0xd;
break;
case 0x74:
local_4d = 9;
break;
case 0x76:
local_4d = 0xb;
}
}
LAB_00100986:
local_48 = uVar7;
local_48 = local_48 + 1;
*(byte *)(*param_2 + (ulong)local_4c) = local_4d;
} else {
*(char *)(*param_2 + (ulong)local_4c) = param_1[local_48];
}
local_4c = local_4c + 1;
local_48 = local_48 + 1;
} while (true);
} | coreutils | ghidra |
int main(int argc, char *argv[]) {
int c;
_Bool fs = 0;
_Bool terse = 0;
char *format = ((void *)0);
char *format2;
_Bool ok = 1;
;
set_program_name(argv[0]);
setlocale(6, "");
bindtextdomain("coreutils", "/usr/local/share/locale");
textdomain("coreutils");
struct lconv const *locale = localeconv();
decimal_point = (locale->decimal_point[0] ? locale->decimal_point : ".");
decimal_point_len = strlen(decimal_point);
atexit(close_stdout);
while ((c = getopt_long(argc, argv, "c:fLt", long_options, ((void *)0))) !=
-1) {
switch (c) {
case PRINTF_OPTION:
format = optarg;
interpret_backslash_escapes = 1;
trailing_delim = "";
break;
case 'c':
format = optarg;
interpret_backslash_escapes = 0;
trailing_delim = "\n";
break;
case 'L':
follow_links = 1;
break;
case 'f':
fs = 1;
break;
case 't':
terse = 1;
break;
case 0:
switch (((cached_modes)[__xargmatch_internal(
"--cached", optarg, cached_args, (void const *)(cached_modes),
sizeof *(cached_modes), argmatch_die, 1)])) {
case cached_never:
force_sync = 1;
dont_sync = 0;
break;
case cached_always:
force_sync = 0;
dont_sync = 1;
break;
case cached_default:
force_sync = 0;
dont_sync = 0;
}
break;
case GETOPT_HELP_CHAR:
usage(0);
break;
;
case GETOPT_VERSION_CHAR:
version_etc(stdout, "stat", "GNU coreutils", Version, ("Michael Meskes"),
(char *)((void *)0));
exit(0);
break;
;
default:
usage(1);
}
}
if (argc == optind) {
error(0, 0, gettext("missing operand"));
usage(1);
}
if (format) {
if (strstr(format, "%N"))
getenv_quoting_style();
format2 = format;
} else {
format = default_format(fs, terse, 0);
format2 = default_format(fs, terse, 1);
}
for (int i = optind; i < argc; i++)
ok &= (fs ? do_statfs(argv[i], format) : do_stat(argv[i], format, format2));
return ok ? 0 : 1;
} | byte main(int param_1, undefined8 *param_2)
{
uint uVar1;
byte bVar2;
int iVar3;
lconv *plVar4;
long lVar5;
char *pcVar6;
undefined8 uVar7;
char local_2b;
undefined local_2a;
bool local_29;
int local_28;
char *local_20;
char *local_18;
local_2b = '\0';
local_2a = 0;
local_20 = (char *)0x0;
local_29 = true;
set_program_name(*param_2);
setlocale(6, "");
bindtextdomain("coreutils", "/usr/local/share/locale");
textdomain("coreutils");
plVar4 = localeconv();
if (*plVar4->decimal_point == '\0') {
decimal_point = ".";
} else {
decimal_point = plVar4->decimal_point;
}
decimal_point_len = strlen(decimal_point);
atexit(p_Ram0000000000103f67);
LAB_00104167:
while (true) {
uVar7 = 0x104189;
iVar3 = getopt_long(param_1, param_2, "c:fLt", long_options, 0);
if (iVar3 == -1) {
if (param_1 == optind) {
uVar7 = gettext("missing operand");
error(0, 0, uVar7);
usage(1);
}
if (local_20 == (char *)0x0) {
local_20 = (char *)default_format(local_2b, local_2a, 0);
local_18 = (char *)default_format(local_2b, local_2a, 1);
} else {
pcVar6 = strstr(local_20, "%N");
if (pcVar6 != (char *)0x0) {
getenv_quoting_style();
}
local_18 = local_20;
}
for (local_28 = optind; local_28 < param_1; local_28 = local_28 + 1) {
if (local_2b == '\0') {
bVar2 = do_stat(param_2[local_28], local_20, local_18);
} else {
bVar2 = do_statfs(param_2[local_28], local_20);
}
local_29 = (bVar2 & local_29) != 0;
}
return local_29 ^ 1;
}
if (iVar3 != 0x80)
break;
local_20 = optarg;
interpret_backslash_escapes = 1;
trailing_delim = &DAT_00104503;
}
if (iVar3 < 0x81) {
if (iVar3 == 0x74) {
local_2a = 1;
goto LAB_00104167;
}
if (0x74 < iVar3)
goto LAB_0010415d;
if (iVar3 == 0x66) {
local_2b = '\x01';
goto LAB_00104167;
}
if (iVar3 < 0x67) {
if (iVar3 == 99) {
local_20 = optarg;
interpret_backslash_escapes = 0;
trailing_delim = &DAT_00105f36;
goto LAB_00104167;
}
if (iVar3 < 100) {
if (iVar3 == 0x4c) {
follow_links = 1;
goto LAB_00104167;
}
if (iVar3 < 0x4d) {
if (iVar3 == 0) {
lVar5 =
__xargmatch_internal("--cached", optarg, cached_args,
cached_modes, 4, argmatch_die, 1, uVar7);
uVar1 = *(uint *)(cached_modes + lVar5 * 4);
if (uVar1 == 2) {
force_sync = 0;
dont_sync = 1;
} else if (uVar1 < 3) {
if (uVar1 == 0) {
force_sync = 0;
dont_sync = 0;
} else if (uVar1 == 1) {
force_sync = 1;
dont_sync = 0;
}
}
goto LAB_00104167;
}
if (iVar3 < 1) {
if (iVar3 == -0x83) {
LAB_0010411a:
version_etc(stdout, &DAT_00105f17, "GNU coreutils", Version,
"Michael Meskes", 0);
exit(0);
}
if (iVar3 == -0x82) {
usage(0);
goto LAB_0010411a;
}
}
}
}
}
}
LAB_0010415d:
usage();
goto LAB_00104167;
} | coreutils | ghidra |
int ssh_dss_sign(const struct sshkey *key, u_char **sigp, size_t *lenp,
const u_char *data, size_t datalen, u_int compat) {
DSA_SIG *sig = ((void *)0);
const BIGNUM *sig_r, *sig_s;
u_char digest[64], sigblob[(2 * 20)];
size_t rlen, slen, len, dlen = ssh_digest_bytes(1);
struct sshbuf *b = ((void *)0);
int ret = -10;
if (lenp != ((void *)0))
*lenp = 0;
if (sigp != ((void *)0))
*sigp = ((void *)0);
if (key == ((void *)0) || key->dsa == ((void *)0) ||
sshkey_type_plain(key->type) != KEY_DSA)
return -10;
if (dlen == 0)
return -1;
if ((ret = ssh_digest_memory(1, data, datalen, digest, sizeof(digest))) != 0)
goto out;
if ((sig = DSA_do_sign(digest, dlen, key->dsa)) == ((void *)0)) {
ret = -22;
goto out;
}
DSA_SIG_get0(sig, &sig_r, &sig_s);
rlen = ((BN_num_bits(sig_r) + 7) / 8);
slen = ((BN_num_bits(sig_s) + 7) / 8);
if (rlen > 20 || slen > 20) {
ret = -1;
goto out;
}
explicit_bzero(sigblob, (2 * 20));
BN_bn2bin(sig_r, sigblob + (2 * 20) - 20 - rlen);
BN_bn2bin(sig_s, sigblob + (2 * 20) - slen);
if ((b = sshbuf_new()) == ((void *)0)) {
ret = -2;
goto out;
}
if ((ret = sshbuf_put_cstring(b, "ssh-dss")) != 0 ||
(ret = sshbuf_put_string(b, sigblob, (2 * 20))) != 0)
goto out;
len = sshbuf_len(b);
if (sigp != ((void *)0)) {
if ((*sigp = malloc(len)) == ((void *)0)) {
ret = -2;
goto out;
}
memcpy(*sigp, sshbuf_ptr(b), len);
}
if (lenp != ((void *)0))
*lenp = len;
ret = 0;
out:
explicit_bzero(digest, sizeof(digest));
DSA_SIG_free(sig);
sshbuf_free(b);
return ret;
} | int ssh_dss_sign(undefined4 *param_1, void **param_2, size_t *param_3,
undefined8 param_4, undefined8 param_5)
{
int iVar1;
void *pvVar2;
long in_FS_OFFSET;
int local_cc;
BIGNUM *local_c8;
BIGNUM *local_c0;
DSA_SIG *local_b8;
long local_b0;
long local_a8;
ulong local_a0;
ulong local_98;
size_t local_90;
undefined local_88[20];
uchar auStack116[20];
uchar auStack96[8];
uchar local_58[72];
long local_10;
local_10 = *(long *)(in_FS_OFFSET + 0x28);
local_b8 = (DSA_SIG *)0x0;
local_a8 = ssh_digest_bytes(1);
local_b0 = 0;
if (param_3 != (size_t *)0x0) {
*param_3 = 0;
}
if (param_2 != (void **)0x0) {
*param_2 = (void *)0x0;
}
if (((param_1 == (undefined4 *)0x0) || (*(long *)(param_1 + 4) == 0)) ||
(iVar1 = sshkey_type_plain(*param_1), iVar1 != 1)) {
local_cc = -10;
goto LAB_001003cd;
}
if (local_a8 == 0) {
local_cc = -1;
goto LAB_001003cd;
}
local_cc = ssh_digest_memory(1, param_4, param_5, local_58, 0x40);
if (local_cc == 0) {
local_b8 = DSA_do_sign(local_58, (int)local_a8, *(DSA **)(param_1 + 4));
if (local_b8 == (DSA_SIG *)0x0) {
local_cc = -0x16;
} else {
DSA_SIG_get0(local_b8, &local_c8, &local_c0);
iVar1 = BN_num_bits(local_c8);
iVar1 = __addvsi3(iVar1, 7);
if (iVar1 < 0) {
iVar1 = iVar1 + 7;
}
local_a0 = (ulong)(iVar1 >> 3);
iVar1 = BN_num_bits(local_c0);
iVar1 = __addvsi3(iVar1, 7);
if (iVar1 < 0) {
iVar1 = iVar1 + 7;
}
local_98 = (ulong)(iVar1 >> 3);
if ((local_a0 < 0x15) && (local_98 < 0x15)) {
explicit_bzero(local_88, 0x28);
BN_bn2bin(local_c8, auStack116 + -local_a0);
BN_bn2bin(local_c0, auStack96 + -local_98);
local_b0 = sshbuf_new();
if (local_b0 == 0) {
local_cc = -2;
} else {
local_cc = sshbuf_put_cstring(local_b0, "ssh-dss");
if ((local_cc == 0) &&
(local_cc = sshbuf_put_string(local_b0, local_88, 0x28),
local_cc == 0)) {
local_90 = sshbuf_len(local_b0);
if (param_2 != (void **)0x0) {
pvVar2 = malloc(local_90);
*param_2 = pvVar2;
if (*param_2 == (void *)0x0) {
local_cc = -2;
goto LAB_00100398;
}
pvVar2 = (void *)sshbuf_ptr(local_b0);
memcpy(*param_2, pvVar2, local_90);
}
if (param_3 != (size_t *)0x0) {
*param_3 = local_90;
}
local_cc = 0;
}
}
} else {
local_cc = -1;
}
}
}
LAB_00100398:
explicit_bzero(local_58, 0x40);
DSA_SIG_free(local_b8);
sshbuf_free(local_b0);
LAB_001003cd:
if (local_10 == *(long *)(in_FS_OFFSET + 0x28)) {
return local_cc;
}
__stack_chk_fail();
} | openssh-portable | ghidra |
static int prog_load(int idx) {
struct bpf_insn prog[] = {
((struct bpf_insn){.code = 0x07 | 0xb0 | 0x08,
.dst_reg = BPF_REG_6,
.src_reg = BPF_REG_1,
.off = 0,
.imm = 0}),
((struct bpf_insn){.code = 0x07 | 0xb0 | 0x00,
.dst_reg = BPF_REG_3,
.src_reg = 0,
.off = 0,
.imm = idx}),
((struct bpf_insn){.code = 0x07 | 0xb0 | 0x00,
.dst_reg = BPF_REG_2,
.src_reg = 0,
.off = 0,
.imm =
((size_t)&((struct bpf_sock *)0)->bound_dev_if)}),
((struct bpf_insn){.code = 0x03 | ((0x00) & 0x18) | 0x60,
.dst_reg = BPF_REG_1,
.src_reg = BPF_REG_3,
.off = ((size_t)&((struct bpf_sock *)0)->bound_dev_if),
.imm = 0}),
((struct bpf_insn){.code = 0x07 | 0xb0 | 0x00,
.dst_reg = BPF_REG_0,
.src_reg = 0,
.off = 0,
.imm = 1}),
((struct bpf_insn){
.code = 0x05 | 0x90, .dst_reg = 0, .src_reg = 0, .off = 0, .imm = 0}),
};
return bpf_program_load(BPF_PROG_TYPE_CGROUP_SOCK, prog, sizeof(prog), "GPL",
bpf_log_buf, sizeof(bpf_log_buf));
} | int prog_load(unsigned long a0) {
char v0;
char v1;
unsigned short v2;
unsigned int v3;
char v4;
char v5;
unsigned short v6;
unsigned int v7;
char v8;
char v9;
unsigned short v10;
unsigned int v11;
char v12;
char v13;
unsigned short v14;
unsigned int v15;
char v16;
char v17;
unsigned short v18;
unsigned int v19;
char v20;
char v21;
unsigned short v22;
unsigned int v23;
v0 = 191;
v1 = v1 & 0xfffffff0 | 6;
v1 = v1 & 15 | 16;
v2 = 0;
v3 = 0;
v4 = 183;
v5 = v5 & 0xfffffff0 | 3;
v5 &= 15;
v6 = 0;
v7 = a0;
v8 = 183;
v9 = v9 & 0xfffffff0 | 2;
v9 &= 15;
v10 = 0;
v11 = 0;
v12 = 99;
v13 = v13 & 0xfffffff0 | 1;
v13 = v13 & 15 | 48;
v14 = 0;
v15 = 0;
v16 = 183;
v17 &= 0xfffffff0;
v17 &= 15;
v18 = 0;
v19 = 1;
v20 = 149;
v21 &= 0xfffffff0;
v21 &= 15;
v22 = 0;
v23 = 0;
return bpf_program_load(0x9, &v0, 0x30, "GPL", &bpf_log_buf, 0x40000);
} | iproute2-6.0.0 | angr_sailr |
static void name_add_option(int rpl_option, const char *arg) {
struct name_elt *elt = name_elt_alloc();
elt->type = NELT_OPTION;
elt->v.opt.rpl_option = rpl_option;
elt->v.opt.arg = arg;
} | _QWORD *name_add_option(int a1, long a2) {
_QWORD *result;
result = name_elt_alloc();
*((_DWORD *)result + 4) = 4;
*((_DWORD *)result + 6) = a1;
result[4] = a2;
return result;
} | tar | ida |
static _Bool
detect_loop(struct item *k) {
if (k->count > 0) {
if (loop == ((void *)0))
loop = k;
else {
struct successor **p = &k->top;
while (*p) {
if ((*p)->suc == loop) {
if (k->qlink) {
while (loop) {
struct item *tmp = loop->qlink;
error(0, 0, "%s", (loop->str));
if (loop == k) {
struct successor *s = *p;
s->suc->count--;
*p = s->next;
;
break;
}
loop->qlink = ((void *)0);
loop = tmp;
}
while (loop) {
struct item *tmp = loop->qlink;
loop->qlink = ((void *)0);
loop = tmp;
}
return 1;
} else {
k->qlink = loop;
loop = k;
break;
}
}
p = &(*p)->next;
}
}
}
return 0;
} | long detect_loop(long a1) {
long i;
long v3;
_QWORD *v4;
long v5;
if (*(_QWORD *)(a1 + 32)) {
if (loop) {
for (i = a1 + 48; *(_QWORD *)i; i = *(_QWORD *)i + 8LL) {
if (**(_QWORD **)i == loop) {
if (!*(_QWORD *)(a1 + 40)) {
*(_QWORD *)(a1 + 40) = loop;
loop = a1;
return 0LL;
}
while (loop) {
v3 = *(_QWORD *)(loop + 40);
error(0, 0, "%s", *(const char **)loop);
if (a1 == loop) {
v4 = *(_QWORD **)i;
*(_QWORD *)(*v4 + 32LL) =
*(_QWORD *)(**(_QWORD **)i + 32LL) - 1LL;
*(_QWORD *)i = v4[1];
break;
}
*(_QWORD *)(loop + 40) = 0LL;
loop = v3;
}
while (loop) {
v5 = *(_QWORD *)(loop + 40);
*(_QWORD *)(loop + 40) = 0LL;
loop = v5;
}
return 1LL;
}
}
} else {
loop = a1;
}
}
return 0LL;
} | coreutils | ida |
static operand scan_arg(char const *arg) {
operand ret;
if (!xstrtold(arg, ((void *)0), &ret.value, cl_strtold)) {
error(0, 0, gettext("invalid floating point argument: %s"), quote(arg));
usage(1);
}
if (((ret.value) != (ret.value))) {
error(0, 0, gettext("invalid %s argument: %s"), quote_n(0, "not-a-number"),
quote_n(1, arg));
usage(1);
}
while (((*__ctype_b_loc())[(int)((to_uchar(*arg)))] &
(unsigned short int)_ISspace) ||
*arg == '+')
arg++;
ret.width = 0;
ret.precision = 0x7fffffff;
char const *decimal_point = strchr(arg, '.');
if (!decimal_point && !strchr(arg, 'p'))
ret.precision = 0;
if (!arg[strcspn(arg, "xX")] && ((ret.value) * 0 == 0)) {
size_t fraction_len = 0;
ret.width = strlen(arg);
if (decimal_point) {
fraction_len = strcspn(decimal_point + 1, "eE");
if (fraction_len <= 0x7fffffff)
ret.precision = fraction_len;
ret.width += (fraction_len == 0
? -1
: (decimal_point == arg ||
!((unsigned int)(decimal_point[-1]) - '0' <= 9)));
}
char const *e = strchr(arg, 'e');
if (!e)
e = strchr(arg, 'E');
if (e) {
long exponent =
(((strtol(e + 1, ((void *)0), 10)) > (-0x7fffffffffffffffL))
? (strtol(e + 1, ((void *)0), 10))
: (-0x7fffffffffffffffL));
ret.precision += exponent < 0
? -exponent
: -(((ret.precision) < (exponent)) ? (ret.precision)
: (exponent));
ret.width -= strlen(arg) - (e - arg);
if (exponent < 0) {
if (decimal_point) {
if (e == decimal_point + 1)
ret.width++;
} else
ret.width++;
exponent = -exponent;
} else {
if (decimal_point && ret.precision == 0 && fraction_len)
ret.width--;
exponent -=
(((fraction_len) < (exponent)) ? (fraction_len) : (exponent));
}
ret.width += exponent;
}
}
return ret;
} | void scan_arg(unsigned long long a0[4], char *a1) {
char *v0;
void *v1;
unsigned long v2;
unsigned long long v3;
unsigned long v4;
char v5;
char v6;
void *v7;
unsigned int v8;
unsigned long long v11;
unsigned short v13;
unsigned long v14;
unsigned long long v15;
unsigned long long v16;
unsigned long long v17;
unsigned long long v18;
unsigned long long v20;
unsigned long long v21;
unsigned long long v22;
unsigned long long v23;
unsigned long long v24[4];
v0 = a1;
if ((xstrtold(v0, 0x0, &v5, got.cl_strtold) ^ 1)) {
v11 = quote(v0);
error(0x0, 0x0, gettext("invalid floating point argument: %s"));
usage(0x1);
}
[D] t1 = DIRTY 1 TODO(effects):: : amd64g_dirtyhelper_loadF80le(
t2) if ([D] GetI(968 : I8x8)[t4, 0]){
[D] t1 = DIRTY 1 TODO(effects):: : amd64g_dirtyhelper_loadF80le(t2)[D] PutI(
904 : F64x8)[t4, 0] = t7[D] PutI(968 : I8x8)[t4, 0] = 0x01
} else {
[D] t1 = DIRTY 1 TODO(effects):: : amd64g_dirtyhelper_loadF80le(t2)[D] PutI(
904 : F64x8)[t4, 0] = t7[D] PutI(968 : I8x8)[t4, 0] = 0x01
}[D] t1 = DIRTY 1 TODO(effects)::
: amd64g_dirtyhelper_loadF80le(t2) if ([D] GetI(968 : I8x8)[t4, 0]){
[D] t1 = DIRTY 1 TODO(effects):: :
amd64g_dirtyhelper_loadF80le(t2)[D] PutI(904 : F64x8)[t4, 0] =
t7[D] PutI(968 : I8x8)[t4, 0] = 0x01
} else {
[D] t1 = DIRTY 1 TODO(effects):: :
amd64g_dirtyhelper_loadF80le(t2)[D] PutI(904 : F64x8)[t4, 0] =
t7[D] PutI(968 : I8x8)[t4, 0] = 0x01
} if (!(((BinaryOp CmpF & 69) >> 2) & 1)) {
[D] PutI(968 : I8x8)[t6, 0] = 0x00 [D] PutI(904 : F64x8)[t18, 0] =
t21[D] PutI(968 : I8x8)[t18, 0] = 0x01 [D] PutI(968 : I8x8)[t18, 0] =
0x00 if ((((BinaryOp CmpF & 69) >> 6) & 1) == 1) {
while (true) {
v13 = *((to_uchar(*(v0)) * 2 + *(__ctype_b_loc())));
v14 = v13 & 0x2000;
if (!v14) {
if (*(v0) != 43)
break;
}
v0 += 1;
}
v7 = 0;
v8 = 2147483647;
v4 = strchr(v0, 0x2e);
if (!v4) {
v14 = strchr(v0, 0x70);
if (!v14)
v8 = 0;
}
*(&v14) = v0[strcspn(v0, "xX")];
if (!v14) {
[D] t1 = DIRTY 1 TODO(effects)::
: amd64g_dirtyhelper_loadF80le(t2) if ([D] GetI(968 : I8x8)[t4, 0]){
[D] t1 = DIRTY 1 TODO(effects):: :
amd64g_dirtyhelper_loadF80le(t2)[D] PutI(904 : F64x8)[t4, 0] =
t7[D] PutI(968 : I8x8)[t4, 0] = 0x01
} else {
[D] t1 = DIRTY 1 TODO(effects):: :
amd64g_dirtyhelper_loadF80le(t2)[D] PutI(904 : F64x8)[t4, 0] =
t7[D] PutI(968 : I8x8)[t4, 0] = 0x01
}[D] PutI(904 : F64x8)[t0, 0] = t3[D] PutI(968 : I8x8)[t0, 0] =
0x01 [D] PutI(904 : F64x8)[t10, 1] = t11[D] PutI(
968 : I8x8)[t10, 1] = 0x01 [D] PutI(968 : I8x8)[t10, 0] =
0x00 [D] PutI(904 : F64x8)[t30, 0] =
t33[D] PutI(968 : I8x8)[t30, 0] =
0x01 [D] PutI(968 : I8x8)[t46, 0] =
0x00 if (!(((BinaryOp CmpF & 69) >> 2) & 1)) {
[D] PutI(904 : F64x8)[t0, 0] = t3[D] PutI(968 : I8x8)[t0, 0] =
0x01 [D] PutI(968 : I8x8)[t0, 0] =
0x00 [D] PutI(904 : F64x8)[t28, 0] =
t31[D] PutI(968 : I8x8)[t28, 0] =
0x01 [D] PutI(968 : I8x8)[t28, 0] =
0x00 if ((((BinaryOp CmpF & 69) >> 6) & 1) == 1) {
v1 = 0;
v7 = strlen(v0);
if (v4) {
v1 = strcspn(v4 + 1, "eE");
if (v1 < 0x80000000)
v8 = v1;
if (v1) {
if (v4 != v0 && *((v4 - 1)) - 48 <= 9)
v17 = 0;
if (v4 == v0 || *((v4 - 1)) - 48 > 9)
v17 = 1;
} else {
v17 = -1;
}
v18 = v17 + v7;
v7 = v18;
}
v2 = strchr(v0, 0x65);
if (!v2)
v2 = strchr(v0, 0x45);
if (v2) {
if (strtol(v2 + 1, NULL, 0xa) >= 9223372036854775810)
v20 = strtol(v2 + 1, NULL, 0xa);
else
v20 = 9223372036854775809;
v3 = v20;
if ((v3 - 0 >> 63)) {
v21 = -(v3);
} else {
*(&v20) = v8;
if (v3 <= v8)
*(&v20) = v3;
v21 = -(v20);
}
v8 = v21 + v8;
v7 = (v2 + -0x1 * v0 + -1 * strlen(v0)) + v7;
if ((v3 - 0 >> 63)) {
if (!v4) {
v7 += 1;
} else if (v2 == v4 + 1) {
v7 += 1;
}
v3 = -(v3);
} else {
if (v4 && !v8 && v1)
v7 -= 1;
v22 = v3;
if (v1 <= v3)
v22 = v1;
v23 = v3 - v22;
v3 = v23;
}
v7 = v3 + v7;
}
}
}
else {[D] PutI(904 : F64x8)[t0, 0] = t1[D] PutI(968 : I8x8)[t0, 0] =
0x01 [D] PutI(968 : I8x8)[t0, 0] = 0x00}
}
a0[0] = *(&v5);
a0[1] = *(&v6);
a0[2] = v7;
a0[3] = *(&v8);
v24 = a0;
return;
}
}
else {[D] PutI(904 : F64x8)[t0, 0] = t1[D] PutI(968 : I8x8)[t0, 0] =
0x01 [D] PutI(968 : I8x8)[t0, 0] =
0x00 [D] PutI(904 : F64x8)[t10, 0] =
t13[D] PutI(968 : I8x8)[t10, 0] =
0x01 [D] PutI(968 : I8x8)[t10, 0] =
0x00} if ((((BinaryOp CmpF & 69) >> 2) & 1) ||
(((BinaryOp CmpF & 69) >> 6) & 1) != 1) {
v15 = quote_n(0x1, v0);
v16 = quote_n(0x0, "not-a-number");
error(0x0, 0x0, gettext("invalid %s argument: %s"));
usage(0x1);
}
} | coreutils | angr_dream |
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(char *param_1, long param_2)
{
int iVar1;
DIR *__dirp;
dirent *pdVar2;
long in_FS_OFFSET;
stat local_1a8;
char local_118[264];
long local_10;
local_10 = *(long *)(in_FS_OFFSET + 0x28);
__dirp = opendir(param_1);
if (__dirp == (DIR *)0x0) {
*(undefined8 *)(param_2 + 0x58) = 0;
} else {
while (pdVar2 = readdir(__dirp), pdVar2 != (dirent *)0x0) {
iVar1 = not_a_crontab(pdVar2);
if ((((iVar1 == 0) ||
(iVar1 = strcmp(pdVar2->d_name, ".cron.hostname"), iVar1 == 0)) &&
(iVar1 =
glue_strings(local_118, 0x100, param_1, pdVar2->d_name, 0x2f),
iVar1 != 0)) &&
((iVar1 = stat(local_118, &local_1a8),
-1 < iVar1 &&
(*(long *)(param_2 + 0x58) < local_1a8.st_mtim.tv_sec)))) {
*(__time_t *)(param_2 + 0x58) = local_1a8.st_mtim.tv_sec;
}
}
closedir(__dirp);
}
if (local_10 == *(long *)(in_FS_OFFSET + 0x28)) {
return;
}
__stack_chk_fail();
} | cronie | ghidra |
static void __xfrm_algo_print(struct xfrm_algo *algo, int type, int len,
FILE *fp, const char *prefix, int newline,
_Bool nokeys) {
int keylen;
int i;
if (prefix)
fputs(prefix, fp);
fprintf(fp, "%s ", strxf_algotype(type));
if (len < sizeof(*algo)) {
fprintf(fp, "(ERROR truncated)");
goto fin;
}
len -= sizeof(*algo);
fprintf(fp, "%s ", algo->alg_name);
keylen = algo->alg_key_len / 8;
if (len < keylen) {
fprintf(fp, "(ERROR truncated)");
goto fin;
}
if (nokeys)
fprintf(fp, "<<Keys hidden>>");
else if (keylen > 0) {
fprintf(fp, "0x");
for (i = 0; i < keylen; i++)
fprintf(fp, "%.2x", (unsigned char)algo->alg_key[i]);
if (show_stats > 0)
fprintf(fp, " (%d bits)", algo->alg_key_len);
}
fin:
if (newline)
fprintf(fp, "%s", _SL_);
} | void __xfrm_algo_print(struct_0 *a0, unsigned long a1, unsigned long a2,
void *a3, char *a4, unsigned long a5, unsigned int v4) {
char v0;
unsigned int v1;
unsigned int v2;
unsigned int v3;
unsigned long long v5;
unsigned long long v6;
unsigned long long v7;
unsigned long long v8;
unsigned long long v9;
unsigned long long v10;
unsigned long long v11;
v1 = a2;
v0 = v4;
if (a4)
fputs(a4, a3);
fprintf(a3, "%s ", strxf_algotype(a1));
if (v1 <= 67) {
v5 = fprintf(a3, "(ERROR truncated)");
} else {
v1 -= 68;
fprintf(a3, "%s ", a0);
v3 = a0->field_40 >> 3;
v6 = v1;
if (v1 < v3) {
v7 = fprintf(a3, "(ERROR truncated)");
} else if (v0) {
v8 = fprintf(a3, "<<Keys hidden>>");
} else if (v3 > 0) {
fprintf(a3, "0x");
for (v2 = 0; v2 < v3; v2 += 1) {
fprintf(a3, "%.2x", a0[1].padding_0[v2]);
}
v9 = show_stats;
if (show_stats > 0)
v10 = fprintf(a3, " (%d bits)", a0->field_40);
}
}
if (a5)
v11 = fprintf(a3, "%s", _SL_);
return;
} | iproute2-6.0.0 | angr_dream |
static void doHUP(void) {
char buf[512];
if (ourConf->globals.bLogStatusMsgs) {
snprintf(buf, sizeof(buf),
"[origin software=\"rsyslogd\" "
"swVersion=\""
"8.2210.0"
"\" x-pid=\"%d\" x-info=\"https:
(int)glbl_ourpid);
(*__errno_location()) = 0;
logmsgInternal(-1, (5 << 3) | 6, (uchar *)buf, 0);
}
queryLocalHostname();
ruleset.IterateAllActions(ourConf, doHUPActions, ((void *)0));
modDoHUP();
lookupDoHUP();
errmsgDoHUP();
} | void doHUP(unsigned long long a0, unsigned long a1, unsigned long a2,
unsigned long long a3, unsigned long long a4,
unsigned long long a5) {
char v0;
char v1;
unsigned long long *v3;
unsigned long long v4;
if (*((ourConf + 36))) {
snprintf(&v0, 0x200, "[origin software=\"rsyslogd\" swVersion=\"8.2210.0\" x-pid=\"%d\" x-info=\"https:
*(__errno_location()) = 0;
logmsgInternal(0xffffffff, 0x2e, &v0, 0x0);
}
queryLocalHostname();
g_4044b8(ourConf, doHUPActions, 0, g_4044b8);
modDoHUP(a0, doHUPActions, 0x0, a3, a4, a5);
lookupDoHUP(a0, doHUPActions, 0x0, a3, a4, a5);
errmsgDoHUP(a0, doHUPActions, 0x0, a3, a4, a5);
v4 = *(&v1) ^ v3[5];
return;
} | rsyslog-8.2210.0 | angr_dream |
) {
sshlog("sftp.c", __func__, 1031, 0,
SYSLOG_LEVEL_ERROR, ((void *)0),
"no stat information for %s", fname);
continue;
} | void sshlog(void)
{
halt_baddata();
} | openssh-portable | ghidra |
static void short_pinky(char const *filename, const int argc_names,
char *const argv_names[]) {
size_t n_users;
STRUCT_UTMP *utmp_buf = ((void *)0);
if (read_utmp(filename, &n_users, &utmp_buf, 0) != 0)
((!!sizeof(struct {
_Static_assert(
1,
"verify_expr ("
"1"
", "
"(error (1, (*__errno_location ()), \"%s\", quotearg_n_style_colon "
"(0, shell_escape_quoting_style, filename)), assume (false))"
")");
int _gl_dummy;
}))
? ((error(1, (*__errno_location()), "%s",
quotearg_n_style_colon(0, shell_escape_quoting_style,
filename)),
((0) ? (void)0 : __builtin_unreachable())))
: ((error(1, (*__errno_location()), "%s",
quotearg_n_style_colon(0, shell_escape_quoting_style,
filename)),
((0) ? (void)0 : __builtin_unreachable()))));
scan_entries(n_users, utmp_buf, argc_names, argv_names);
exit(0);
} | void short_pinky(unsigned long long a0, unsigned long a1) {
char v0;
void *v1;
unsigned long v2;
unsigned long v3;
unsigned long v5;
unsigned long long *v6;
unsigned long long *v8;
unsigned long long v9;
v3 = v5;
v2 = v6[5];
v1 = 0;
if (read_utmp(a0, &v0, &v1, 0x0)) {
v9 = quotearg_n_style_colon(0x0, 0x3, a0);
error(0x1, *(__errno_location()), "%s");
}
scan_entries(*(&v0), v1, a1, v8);
exit(0x0);
} | coreutils | angr_dream |
int __acl_reorder_entry_obj_p(acl_entry_obj *entry_obj_p) {
acl_obj *acl_obj_p = entry_obj_p->i.e_container;
acl_entry_obj *here_obj_p;
if (acl_obj_p->i.a_used <= 1)
return 0;
switch (entry_obj_p->i.e_entry.e_tag) {
case (0x00):
return 1;
case (0x02):
case (0x08):
if (((entry_obj_p->i.e_entry.e_id).i.q_id) == ((id_t)-1))
return 1;
}
entry_obj_p->i.e_prev->i.e_next = entry_obj_p->i.e_next;
entry_obj_p->i.e_next->i.e_prev = entry_obj_p->i.e_prev;
for ((here_obj_p) = (acl_obj_p)->i.a_next;
(here_obj_p) != (acl_entry_obj *)(acl_obj_p);
(here_obj_p) = (here_obj_p)->i.e_next) {
if (__acl_entry_p_compare(here_obj_p, entry_obj_p) > 0)
break;
}
entry_obj_p->i.e_prev = here_obj_p->i.e_prev;
entry_obj_p->i.e_next = here_obj_p;
entry_obj_p->i.e_prev->i.e_next = entry_obj_p;
entry_obj_p->i.e_next->i.e_prev = entry_obj_p;
return 0;
} | undefined8 __acl_reorder_entry_obj_p(long param_1)
{
long lVar1;
int iVar2;
long local_18;
lVar1 = *(long *)(param_1 + 0x18);
if (*(ulong *)(lVar1 + 0x30) < 2) {
return 0;
}
iVar2 = *(int *)(param_1 + 0x20);
if (iVar2 != 8) {
if (8 < iVar2)
goto LAB_00100116;
if (iVar2 == 0) {
return 1;
}
if (iVar2 != 2)
goto LAB_00100116;
}
if (*(int *)(param_1 + 0x30) == -1) {
return 1;
}
LAB_00100116:
*(undefined8 *)(*(long *)(param_1 + 8) + 0x10) =
*(undefined8 *)(param_1 + 0x10);
*(undefined8 *)(*(long *)(param_1 + 0x10) + 8) = *(undefined8 *)(param_1 + 8);
local_18 = *(long *)(lVar1 + 0x10);
while ((local_18 != lVar1 &&
(iVar2 = __acl_entry_p_compare(local_18, param_1), iVar2 < 1))) {
local_18 = *(long *)(local_18 + 0x10);
}
*(undefined8 *)(param_1 + 8) = *(undefined8 *)(local_18 + 8);
*(long *)(param_1 + 0x10) = local_18;
*(long *)(*(long *)(param_1 + 8) + 0x10) = param_1;
*(long *)(*(long *)(param_1 + 0x10) + 8) = param_1;
return 0;
} | acl-2.3.1 | ghidra |
static void re_update_line(EditLine *el, wchar_t *old, wchar_t *new, int i) {
wchar_t *o, *n, *p, c;
wchar_t *ofd, *ols, *oe, *nfd, *nls, *ne;
wchar_t *osb, *ose, *nsb, *nse;
int fx, sx;
size_t len;
for (o = old, n = new; *o && (*o == *n); o++, n++)
continue;
ofd = o;
nfd = n;
while (*o)
o++;
while (ofd < o) {
if (o[-1] != ' ')
break;
o--;
}
oe = o;
*oe = '\0';
while (*n)
n++;
while (nfd < n) {
if (n[-1] != ' ')
break;
n--;
}
ne = n;
*ne = '\0';
if (*ofd == '\0' && *nfd == '\0') {
;
return;
}
while ((o > ofd) && (n > nfd) && (*--o == *--n))
continue;
ols = ++o;
nls = ++n;
osb = ols;
nsb = nls;
ose = ols;
nse = nls;
if (*ofd) {
for (c = *ofd, n = nfd; n < nls; n++) {
if (c == *n) {
for (o = ofd, p = n; p < nls && o < ols && *o == *p; o++, p++)
continue;
if (((nse - nsb) < (p - n)) && (2 * (p - n) > n - nfd)) {
nsb = n;
nse = p;
osb = ofd;
ose = o;
}
}
}
}
if (*nfd) {
for (c = *nfd, o = ofd; o < ols; o++) {
if (c == *o) {
for (n = nfd, p = o; p < ols && n < nls && *p == *n; p++, n++)
continue;
if (((ose - osb) < (p - o)) && (2 * (p - o) > o - ofd)) {
nsb = nfd;
nse = n;
osb = o;
ose = p;
}
}
}
}
if ((oe - ols) < 4) {
ols = oe;
nls = ne;
}
fx = (int)((nsb - nfd) - (osb - ofd));
sx = (int)((nls - nse) - (ols - ose));
if (!((el)->el_terminal.t_flags & 0x001)) {
if (fx > 0) {
osb = ols;
ose = ols;
nsb = nls;
nse = nls;
}
if (sx > 0) {
ols = oe;
nls = ne;
}
if ((ols - ofd) < (nls - nfd)) {
ols = oe;
nls = ne;
}
}
if (!((el)->el_terminal.t_flags & 0x002)) {
if (fx < 0) {
osb = ols;
ose = ols;
nsb = nls;
nse = nls;
}
if (sx < 0) {
ols = oe;
nls = ne;
}
if ((ols - ofd) > (nls - nfd)) {
ols = oe;
nls = ne;
}
}
if ((ose - osb) < 4) {
osb = ols;
ose = ols;
nsb = nls;
nse = nls;
}
fx = (int)((nsb - nfd) - (osb - ofd));
sx = (int)((nls - nse) - (ols - ose));
;
;
;
;
;
terminal_move_to_line(el, i);
p = (ols != oe) ? oe : ose;
if ((nsb != nfd) && fx > 0 && ((p - old) + fx <= el->el_terminal.t_size.h)) {
;
terminal_move_to_char(el, (int)(nfd - new));
if (nsb != ne) {
;
if (fx > 0) {
;
terminal_insertwrite(el, nfd, fx);
re_insert(el, old, (int)(ofd - old), el->el_terminal.t_size.h, nfd, fx);
}
len = (size_t)((nsb - nfd) - fx);
terminal_overwrite(el, (nfd + fx), len);
re__strncopy(ofd + fx, nfd + fx, len);
} else {
;
len = (size_t)(nsb - nfd);
terminal_overwrite(el, nfd, len);
re__strncopy(ofd, nfd, len);
return;
}
} else if (fx < 0) {
;
terminal_move_to_char(el, (int)(ofd - old));
if (osb != oe) {
;
if (fx < 0) {
;
terminal_deletechars(el, -fx);
re_delete(el, old, (int)(ofd - old), el->el_terminal.t_size.h, -fx);
}
len = (size_t)(nsb - nfd);
terminal_overwrite(el, nfd, len);
re__strncopy(ofd, nfd, len);
} else {
;
terminal_overwrite(el, nfd, (size_t)(nsb - nfd));
re_clear_eol(el, fx, sx, (int)((oe - old) - (ne - new)));
return;
}
} else
fx = 0;
if (sx < 0 && (ose - old) + fx < el->el_terminal.t_size.h) {
;
terminal_move_to_char(el, (int)((ose - old) + fx));
if (ols != oe) {
;
if (sx < 0) {
;
terminal_deletechars(el, -sx);
}
terminal_overwrite(el, nse, (size_t)(nls - nse));
} else {
;
terminal_overwrite(el, nse, (size_t)(nls - nse));
re_clear_eol(el, fx, sx, (int)((oe - old) - (ne - new)));
}
}
if ((nsb != nfd) && (osb - ofd) <= (nsb - nfd) && (fx == 0)) {
;
terminal_move_to_char(el, (int)(nfd - new));
if (nsb != ne) {
;
fx = (int)((nsb - nfd) - (osb - ofd));
if (fx > 0) {
;
terminal_insertwrite(el, nfd, fx);
re_insert(el, old, (int)(ofd - old), el->el_terminal.t_size.h, nfd, fx);
}
len = (size_t)((nsb - nfd) - fx);
terminal_overwrite(el, (nfd + fx), len);
re__strncopy(ofd + fx, nfd + fx, len);
} else {
;
len = (size_t)(nsb - nfd);
terminal_overwrite(el, nfd, len);
re__strncopy(ofd, nfd, len);
}
}
if (sx >= 0) {
;
terminal_move_to_char(el, (int)(nse - new));
if (ols != oe) {
;
if (sx > 0) {
;
terminal_insertwrite(el, nse, sx);
}
terminal_overwrite(el, (nse + sx), (size_t)((nls - nse) - sx));
} else {
;
terminal_overwrite(el, nse, (size_t)(nls - nse));
}
};
} | void re_update_line(long param_1, int *param_2, int *param_3,
undefined4 param_4)
{
int *piVar1;
int *piVar2;
int *piVar3;
int *piVar4;
int *piVar5;
int iVar6;
int iVar7;
long lVar8;
int local_84;
int *local_78;
int *local_70;
int *local_68;
int *local_60;
int *local_58;
int *local_50;
int *local_48;
int *local_40;
int *local_38;
local_70 = param_3;
for (local_78 = param_2; (piVar3 = local_70, piVar1 = local_78,
*local_78 != 0 && (*local_78 == *local_70));
local_78 = local_78 + 1) {
local_70 = local_70 + 1;
}
for (; *local_78 != 0; local_78 = local_78 + 1) {
}
for (; (piVar2 = local_78, piVar1 < local_78 && (local_78[-1] == 0x20));
local_78 = local_78 + -1) {
}
*local_78 = 0;
for (; *local_70 != 0; local_70 = local_70 + 1) {
}
for (; (piVar4 = local_70, piVar3 < local_70 && (local_70[-1] == 0x20));
local_70 = local_70 + -1) {
}
*local_70 = 0;
if ((*piVar1 != 0) || (*piVar3 != 0)) {
do {
if ((local_78 <= piVar1) || (local_70 <= piVar3))
break;
local_78 = local_78 + -1;
local_70 = local_70 + -1;
} while (*local_78 == *local_70);
local_60 = local_78 + 1;
local_58 = local_70 + 1;
local_50 = local_60;
local_48 = local_60;
local_40 = local_58;
local_38 = local_58;
if (*piVar1 != 0) {
for (local_70 = piVar3; local_70 < local_58; local_70 = local_70 + 1) {
if (*piVar1 == *local_70) {
local_68 = local_70;
for (local_78 = piVar1;
((local_68 < local_58 && (local_78 < local_60)) &&
(*local_78 == *local_68));
local_78 = local_78 + 1) {
local_68 = local_68 + 1;
}
if (((long)local_38 - (long)local_40 <
(long)local_68 - (long)local_70) &&
((long)local_70 - (long)piVar3 >> 2 <
(long)local_68 - (long)local_70 >> 1)) {
local_40 = local_70;
local_38 = local_68;
local_50 = piVar1;
local_48 = local_78;
}
}
}
}
if (*piVar3 != 0) {
for (local_78 = piVar1; local_78 < local_60; local_78 = local_78 + 1) {
if (*piVar3 == *local_78) {
local_70 = piVar3;
for (local_68 = local_78;
((local_68 < local_60 && (local_70 < local_58)) &&
(*local_68 == *local_70));
local_68 = local_68 + 1) {
local_70 = local_70 + 1;
}
if (((long)local_48 - (long)local_50 <
(long)local_68 - (long)local_78) &&
((long)local_78 - (long)piVar1 >> 2 <
(long)local_68 - (long)local_78 >> 1)) {
local_40 = piVar3;
local_38 = local_70;
local_50 = local_78;
local_48 = local_68;
}
}
}
}
if ((long)piVar2 - (long)local_60 < 0xd) {
local_60 = piVar2;
local_58 = piVar4;
}
iVar6 = (int)((long)local_40 - (long)piVar3 >> 2) -
(int)((long)local_50 - (long)piVar1 >> 2);
iVar7 = (int)((long)local_58 - (long)local_38 >> 2) -
(int)((long)local_60 - (long)local_48 >> 2);
if ((*(uint *)(param_1 + 0x98) & 1) == 0) {
if (0 < iVar6) {
local_50 = local_60;
local_48 = local_60;
local_40 = local_58;
local_38 = local_58;
}
if (0 < iVar7) {
local_60 = piVar2;
local_58 = piVar4;
}
if ((long)local_60 - (long)piVar1 < (long)local_58 - (long)piVar3) {
local_60 = piVar2;
local_58 = piVar4;
}
}
if ((*(uint *)(param_1 + 0x98) & 2) == 0) {
if (iVar6 < 0) {
local_50 = local_60;
local_48 = local_60;
local_40 = local_58;
local_38 = local_58;
}
if (iVar7 < 0) {
local_60 = piVar2;
local_58 = piVar4;
}
if ((long)local_58 - (long)piVar3 < (long)local_60 - (long)piVar1) {
local_60 = piVar2;
local_58 = piVar4;
}
}
if ((long)local_48 - (long)local_50 < 0xd) {
local_50 = local_60;
local_48 = local_60;
local_40 = local_58;
local_38 = local_58;
}
local_84 = (int)((long)local_40 - (long)piVar3 >> 2) -
(int)((long)local_50 - (long)piVar1 >> 2);
iVar6 = (int)((long)local_58 - (long)local_38 >> 2) -
(int)((long)local_60 - (long)local_48 >> 2);
terminal_move_to_line(param_1, param_4);
piVar5 = local_48;
if (local_60 != piVar2) {
piVar5 = piVar2;
}
if (((local_40 == piVar3) || (local_84 < 1)) ||
((long)*(int *)(param_1 + 0x90) <
((long)piVar5 - (long)param_2 >> 2) + (long)local_84)) {
if (local_84 < 0) {
terminal_move_to_char(param_1,
(long)piVar1 - (long)param_2 >> 2 & 0xffffffff);
if (local_50 == piVar2) {
terminal_overwrite(param_1, piVar3,
(long)local_40 - (long)piVar3 >> 2);
re_clear_eol(param_1, local_84, iVar6,
(int)((long)piVar2 - (long)param_2 >> 2) -
(int)((long)piVar4 - (long)param_3 >> 2));
return;
}
if (local_84 < 0) {
terminal_deletechars(param_1, -local_84);
re_delete(param_1, param_2,
(long)piVar1 - (long)param_2 >> 2 & 0xffffffff,
*(undefined4 *)(param_1 + 0x90), -local_84);
}
lVar8 = (long)local_40 - (long)piVar3 >> 2;
terminal_overwrite(param_1, piVar3, lVar8);
re__strncopy(piVar1, piVar3, lVar8);
} else {
local_84 = 0;
}
} else {
terminal_move_to_char(param_1,
(long)piVar3 - (long)param_3 >> 2 & 0xffffffff);
if (local_40 == piVar4) {
lVar8 = (long)local_40 - (long)piVar3 >> 2;
terminal_overwrite(param_1, piVar3, lVar8);
re__strncopy(piVar1, piVar3, lVar8);
return;
}
if (0 < local_84) {
terminal_insertwrite(param_1, piVar3, local_84);
re_insert(param_1, param_2,
(long)piVar1 - (long)param_2 >> 2 & 0xffffffff,
*(undefined4 *)(param_1 + 0x90), piVar3, local_84);
}
lVar8 = ((long)local_40 - (long)piVar3 >> 2) - (long)local_84;
terminal_overwrite(param_1, piVar3 + local_84, lVar8);
re__strncopy(piVar1 + local_84, piVar3 + local_84, lVar8);
}
if ((iVar6 < 0) && (((long)local_48 - (long)param_2 >> 2) + (long)local_84 <
(long)*(int *)(param_1 + 0x90))) {
terminal_move_to_char(
param_1, local_84 + (int)((long)local_48 - (long)param_2 >> 2));
if (local_60 == piVar2) {
terminal_overwrite(param_1, local_38,
(long)local_58 - (long)local_38 >> 2);
re_clear_eol(param_1, local_84, iVar6,
(int)((long)piVar2 - (long)param_2 >> 2) -
(int)((long)piVar4 - (long)param_3 >> 2));
} else {
if (iVar6 < 0) {
terminal_deletechars(param_1, -iVar6);
}
terminal_overwrite(param_1, local_38,
(long)local_58 - (long)local_38 >> 2);
}
}
if (((local_40 != piVar3) &&
((long)local_50 - (long)piVar1 <= (long)local_40 - (long)piVar3)) &&
(local_84 == 0)) {
terminal_move_to_char(param_1,
(long)piVar3 - (long)param_3 >> 2 & 0xffffffff);
if (local_40 == piVar4) {
lVar8 = (long)local_40 - (long)piVar3 >> 2;
terminal_overwrite(param_1, piVar3, lVar8);
re__strncopy(piVar1, piVar3, lVar8);
} else {
iVar7 = (int)((long)local_40 - (long)piVar3 >> 2) -
(int)((long)local_50 - (long)piVar1 >> 2);
if (0 < iVar7) {
terminal_insertwrite(param_1, piVar3, iVar7);
re_insert(param_1, param_2,
(long)piVar1 - (long)param_2 >> 2 & 0xffffffff,
*(undefined4 *)(param_1 + 0x90), piVar3, iVar7);
}
lVar8 = ((long)local_40 - (long)piVar3 >> 2) - (long)iVar7;
terminal_overwrite(param_1, piVar3 + iVar7, lVar8);
re__strncopy(piVar1 + iVar7, piVar3 + iVar7, lVar8);
}
}
if (-1 < iVar6) {
terminal_move_to_char(param_1,
(long)local_38 - (long)param_3 >> 2 & 0xffffffff);
if (local_60 == piVar2) {
terminal_overwrite(param_1, local_38,
(long)local_58 - (long)local_38 >> 2);
} else {
if (0 < iVar6) {
terminal_insertwrite(param_1, local_38, iVar6);
}
terminal_overwrite(param_1, local_38 + iVar6,
((long)local_58 - (long)local_38 >> 2) -
(long)iVar6);
}
}
}
return;
} | libedit | ghidra |
int glthread_once_singlethreaded(pthread_once_t *once_control) {
char *firstbyte = (char *)once_control;
if (*firstbyte == *(const char *)&fresh_once) {
*firstbyte = ~*(const char *)&fresh_once;
return 1;
} else
return 0;
} | bool glthread_once_singlethreaded(byte *param_1)
{
bool bVar1;
bVar1 = *param_1 == (byte)fresh_once;
if (bVar1) {
*param_1 = ~(byte)fresh_once;
}
return bVar1;
} | gnutls | ghidra |
static int newerf(const char *f1, const char *f2) {
struct stat64 b1, b2;
return (stat64(f1, &b1) == 0 && stat64(f2, &b2) == 0 &&
(b1.st_mtim.tv_sec > b2.st_mtim.tv_sec ||
(b1.st_mtim.tv_sec == b2.st_mtim.tv_sec &&
(b1.st_mtim.tv_nsec > b2.st_mtim.tv_nsec))));
} | void newerf(char *a0, char *a1) {
char v0;
char v1;
char v2;
char v3;
char v4;
char v5;
void *v7;
unsigned long long v8;
if (!stat64(a0, &v0) && !stat64(a1, &v3)) {
if (*(&v1) > *(&v4)) {
LABEL_400c8b:
v8 = 1;
goto LABEL_400c97;
} else if (*(&v1) == *(&v4) && !(*(&v2) <= *(&v5))) {
goto LABEL_400c8b;
}
}
v7 = 0;
LABEL_400c97:
return;
} | dash-0.5.11+git20210903+057cd650a4ed | angr_phoenix |
int ssh_get_authentication_socket_path(const char *authsocket, int *fdp) {
int sock, oerrno;
struct sockaddr_un sunaddr;
sshlog("authfd.c", __func__, 95, 1, SYSLOG_LEVEL_DEBUG3, ((void *)0),
"path '%s'", authsocket);
memset(&sunaddr, 0, sizeof(sunaddr));
sunaddr.sun_family = 1;
strlcpy(sunaddr.sun_path, authsocket, sizeof(sunaddr.sun_path));
if ((sock = socket(1, SOCK_STREAM, 0)) == -1)
return -24;
if (fcntl(sock, 2, 1) == -1 ||
connect(sock, (struct sockaddr *)&sunaddr, sizeof(sunaddr)) == -1) {
oerrno = (*__errno_location());
close(sock);
(*__errno_location()) = oerrno;
return -24;
}
if (fdp != ((void *)0))
*fdp = sock;
else
close(sock);
return 0;
} | long ssh_get_authentication_socket_path(const char *a1, int *a2) {
int fd;
int v4;
sockaddr s[7];
unsigned long v6;
v6 = __readfsqword(0x28u);
sshlog("authfd.c", "ssh_get_authentication_socket_path", 95LL, 1LL, 7LL, 0LL,
"path '%s'", a1);
memset(s, 0, 0x6EuLL);
s[0].sa_family = 1;
strlcpy(s[0].sa_data, a1, 108LL);
fd = socket(1, 1, 0);
if (fd == -1)
return 4294967272LL;
if (fcntl(fd, 2, 1LL) == -1 || connect(fd, s, 0x6Eu) == -1) {
v4 = *_errno_location();
close(fd);
*_errno_location() = v4;
return 4294967272LL;
} else {
if (a2)
*a2 = fd;
else
close(fd);
return 0LL;
}
} | openssh-portable | ida |
DH *mm_choose_dh(int min, int nbits, int max) { return (((void *)0)); } | long long mm_choose_dh(unsigned long a0, unsigned long a1, unsigned long a2) {
unsigned int v0;
unsigned int v1;
unsigned int v2;
v2 = a0;
v1 = a1;
v0 = a2;
return 0;
} | openssh-portable | angr_phoenix |
static int xstrcoll(char const *a, char const *b) {
int diff;
(*__errno_location()) = 0;
diff = strcoll(a, b);
if ((*__errno_location())) {
error(0, (*__errno_location()),
gettext("cannot compare file names %s and %s"), quote_n(0, a),
quote_n(1, b));
set_exit_status(0);
longjmp(failed_strcoll, 1);
}
return diff;
} | int xstrcoll(char *param_1, char *param_2)
{
int iVar1;
int *piVar2;
undefined8 uVar3;
undefined8 uVar4;
undefined8 uVar5;
piVar2 = __errno_location();
*piVar2 = 0;
iVar1 = strcoll(param_1, param_2);
piVar2 = __errno_location();
if (*piVar2 != 0) {
uVar3 = quote_n(1, param_2);
uVar4 = quote_n(0, param_1);
uVar5 = gettext("cannot compare file names %s and %s");
piVar2 = __errno_location();
error(0, *piVar2, uVar5, uVar4, uVar3);
set_exit_status(0);
longjmp((__jmp_buf_tag *)failed_strcoll, 1);
}
return iVar1;
} | coreutils | ghidra |
static inline void emit_ancillary_info(char const *program) {
struct infomap {
char const *program;
char const *node;
} const infomap[] = {
{"[", "test invocation"}, {"coreutils", "Multi-call invocation"},
{"sha224sum", "sha2 utilities"}, {"sha256sum", "sha2 utilities"},
{"sha384sum", "sha2 utilities"}, {"sha512sum", "sha2 utilities"},
{((void *)0), ((void *)0)}};
char const *node = program;
struct infomap const *map_prog = infomap;
while (map_prog->program && !(strcmp(program, map_prog->program) == 0))
map_prog++;
if (map_prog->node)
node = map_prog->node;
printf (gettext ("\n%s online help: <%s>\n"), "GNU coreutils", "https:
char const *lc_messages = setlocale (
5
,
((void *)0)
);
if (lc_messages && strncmp (lc_messages, "" "en_" "", sizeof ("en_") - 1))
{
fputs_unlocked (gettext ("Report any translation bugs to " "<https:
stdout
)
;
}
char const *url_program = (strcmp (program, "[") == 0) ? "test" : program;
printf (gettext ("Full documentation <%s%s>\n"),
"https:
printf (gettext ("or available locally via: info '(coreutils) %s%s'\n"),
node, node == program ? " invocation" : "");
} | void emit_ancillary_info(char *param_1)
{
FILE *__stream;
int iVar1;
char *pcVar2;
char *pcVar3;
long in_FS_OFFSET;
char *local_b8;
char **local_b0;
char *local_98;
char *local_90;
char *local_88;
char *local_80;
char *local_78;
char *local_70;
char *local_68;
char *local_60;
char *local_58;
char *local_50;
char *local_48;
char *local_40;
undefined8 local_38;
undefined8 local_30;
long local_20;
local_20 = *(long *)(in_FS_OFFSET + 0x28);
local_98 = "[";
local_90 = "test invocation";
local_88 = "coreutils";
local_80 = "Multi-call invocation";
local_78 = "sha224sum";
local_70 = "sha2 utilities";
local_68 = "sha256sum";
local_60 = "sha2 utilities";
local_58 = "sha384sum";
local_50 = "sha2 utilities";
local_48 = "sha512sum";
local_40 = "sha2 utilities";
local_38 = 0;
local_30 = 0;
local_b0 = &local_98;
while ((*local_b0 != (char *)0x0 &&
(iVar1 = strcmp(param_1, *local_b0), iVar1 != 0))) {
local_b0 = local_b0 + 2;
}
local_b8 = param_1;
if (local_b0[1] != (char *)0x0) {
local_b8 = local_b0[1];
}
pcVar2 = (char *)gettext("\n%s online help: <%s>\n");
printf(pcVar2,"GNU coreutils","https:
pcVar2 = setlocale(5,(char *)0x0);
if ((pcVar2 != (char *)0x0) && (iVar1 = strncmp(pcVar2,"en_",3), __stream = stdout, iVar1 != 0)) {
pcVar2 = (char *)gettext("Report any translation bugs to <https:
);
fputs_unlocked(pcVar2, __stream);
}
iVar1 = strcmp(param_1,"[");
pcVar2 = param_1;
if (iVar1 == 0) {
pcVar2 = "test";
}
pcVar3 = (char *)gettext("Full documentation <%s%s>\n");
printf(pcVar3,"https:
if (local_b8 == param_1) {
pcVar2 = " invocation";
}
else {
pcVar2 = "";
}
pcVar3 = (char *)gettext("or available locally via: info \'(coreutils) %s%s\'\n");
printf(pcVar3,local_b8,pcVar2);
if (local_20 == *(long *)(in_FS_OFFSET + 0x28)) {
return;
}
__stack_chk_fail();
} | coreutils | ghidra |
static void client_process_net_input(struct ssh *ssh) {
int r;
schedule_server_alive_check();
if ((r = ssh_packet_process_read(ssh, connection_in)) == 0)
return;
if (r == -24) {
if ((*__errno_location()) == 11 || (*__errno_location()) == 4 ||
(*__errno_location()) == 11)
return;
if ((*__errno_location()) == 32) {
quit_message("Connection to %s closed by remote host.", host);
return;
}
}
quit_message("Read from remote host %s: %s", host, ssh_err(r));
} | void client_process_net_input(undefined8 param_1)
{
int iVar1;
int *piVar2;
undefined8 uVar3;
schedule_server_alive_check();
iVar1 = ssh_packet_process_read(param_1, connection_in);
if (iVar1 == 0) {
return;
}
if (iVar1 == -0x18) {
piVar2 = __errno_location();
if (*piVar2 == 0xb) {
return;
}
piVar2 = __errno_location();
if (*piVar2 == 4) {
return;
}
piVar2 = __errno_location();
if (*piVar2 == 0xb) {
return;
}
piVar2 = __errno_location();
if (*piVar2 == 0x20) {
quit_message("Connection to %s closed by remote host.", host);
return;
}
}
uVar3 = ssh_err(iVar1);
quit_message("Read from remote host %s: %s", host, uVar3);
return;
} | openssh-portable | ghidra |
static void print_explain(struct link_util *lu, FILE *f) {
fprintf(f,
"Usage: ... %s mode MODE [flag MODE_FLAG] MODE_OPTS [bcqueuelen "
"BC_QUEUE_LEN]\n"
"\n"
"MODE: private | vepa | bridge | passthru | source\n"
"MODE_FLAG: null | nopromisc | nodst\n"
"MODE_OPTS: for mode \"source\":\n"
"\tmacaddr { { add | del } <macaddr> | set [ <macaddr> [ <macaddr> "
"... ] ] | flush }\n"
"BC_QUEUE_LEN: Length of the rx queue for broadcast/multicast: "
"[0-4294967295]\n",
lu->id);
} | void print_explain(long param_1, FILE *param_2)
{
fprintf(param_2,
"Usage: ... %s mode MODE [flag MODE_FLAG] MODE_OPTS [bcqueuelen "
"BC_QUEUE_LEN]\n\nMODE: private | vepa | bridge | passthru | "
"source\nMODE_FLAG: null | nopromisc | nodst\nMODE_OPTS: for mode "
"\"source\":\n\tmacaddr { { add | del } <macaddr> | set [ <macaddr> "
"[ <macaddr> ... ] ] | flush }\nBC_QUEUE_LEN: Length of the rx "
"queue for broadcast/multicast: [0-4294967295]\n",
*(undefined8 *)(param_1 + 8));
return;
} | iproute2-6.0.0 | ghidra |
static rsRetVal bufOptRemove(int *opt, char **arg) {
rsRetVal iRet = RS_RET_OK;
bufOpt_t *pBuf;
if (bufOptRoot == ((void *)0))
do {
iRet = RS_RET_END_OF_LINKEDLIST;
goto finalize_it;
} while (0);
pBuf = bufOptRoot;
*opt = pBuf->optchar;
*arg = pBuf->arg;
bufOptRoot = pBuf->pNext;
free(pBuf);
finalize_it:
return iRet;
} | int bufOptRemove(unsigned int *a0, unsigned long long *a1) {
unsigned int v0;
struct_0 *v1;
v0 = 0;
if (!bufOptRoot) {
v0 = -2014;
return v0;
}
v1 = bufOptRoot;
*(a0) = v1->field_8;
*(a1) = v1->field_10;
bufOptRoot = v1->field_0;
free(v1);
return v0;
} | rsyslog-8.2210.0 | angr_sailr |
int main(int argc, char **argv) {
char buf[8192];
char *name;
char *newpwd;
char *cp;
const char *salt;
int errors = 0;
int line = 0;
Prog = Basename(argv[0]);
log_set_progname(Prog);
log_set_logfd(stderr);
(void)setlocale(6, "");
(void)bindtextdomain("shadow", "/usr/share/locale");
(void)textdomain("shadow");
process_flags(argc, argv);
salt = get_salt();
process_root_flag("-R", argc, argv);
openlog("chpasswd", (0x01), (10 << 3));
check_perms();
{
is_shadow_pwd = spw_file_present();
open_files();
}
while (fgets(buf, (int)sizeof buf, stdin) != (char *)0) {
line++;
cp = strrchr(buf, '\n');
if (((void *)0) != cp) {
*cp = '\0';
} else {
if (feof(stdin) == 0) {
while (fgets(buf, (int)sizeof buf, stdin) != (char *)0) {
cp = strchr(buf, '\n');
if (cp != ((void *)0)) {
break;
}
}
fprintf(stderr, gettext("%s: line %d: line too long\n"), Prog, line);
errors++;
continue;
}
}
name = buf;
cp = strchr(name, ':');
if (((void *)0) != cp) {
*cp = '\0';
cp++;
} else {
fprintf(stderr, gettext("%s: line %d: missing new password\n"), Prog,
line);
errors++;
continue;
}
newpwd = cp;
{
const struct spwd *sp;
struct spwd newsp;
const struct passwd *pw;
struct passwd newpw;
if (salt) {
cp = pw_encrypt(newpwd, salt);
if (((void *)0) == cp) {
fprintf(stderr,
gettext("%s: failed to crypt password with salt '%s': %s\n"),
Prog, salt, strerror((*__errno_location())));
fail_exit(1);
}
}
pw = pw_locate(name);
if (((void *)0) == pw) {
fprintf(stderr, gettext("%s: line %d: user '%s' does not exist\n"),
Prog, line, name);
errors++;
continue;
}
if (is_shadow_pwd) {
sp = spw_locate(name);
if ((((void *)0) == sp) && (strcmp(pw->pw_passwd, "x") == 0)) {
newsp.sp_namp = name;
newsp.sp_min = getdef_num("PASS_MIN_DAYS", -1);
newsp.sp_max = getdef_num("PASS_MAX_DAYS", -1);
newsp.sp_warn = getdef_num("PASS_WARN_AGE", -1);
newsp.sp_inact = -1;
newsp.sp_expire = -1;
newsp.sp_flag = ((unsigned long int)-1);
sp = &newsp;
}
} else {
sp = ((void *)0);
}
if (((void *)0) != sp) {
newsp = *sp;
newsp.sp_pwdp = cp;
newsp.sp_lstchg = (long)gettime() / (24L * 3600L);
if (0 == newsp.sp_lstchg) {
newsp.sp_lstchg = -1;
}
}
if ((((void *)0) == sp) || (strcmp(pw->pw_passwd, "x") != 0)) {
newpw = *pw;
newpw.pw_passwd = cp;
}
if (((void *)0) != sp) {
if (spw_update(&newsp) == 0) {
fprintf(
stderr,
gettext("%s: line %d: failed to prepare the new %s entry '%s'\n"),
Prog, line, spw_dbname(), newsp.sp_namp);
errors++;
continue;
}
}
if ((((void *)0) == sp) || (strcmp(pw->pw_passwd, "x") != 0)) {
if (pw_update(&newpw) == 0) {
fprintf(
stderr,
gettext("%s: line %d: failed to prepare the new %s entry '%s'\n"),
Prog, line, pw_dbname(), newpw.pw_name);
errors++;
continue;
}
}
}
}
if (0 != errors) {
{
fprintf(stderr, gettext("%s: error detected, changes ignored\n"), Prog);
}
fail_exit(1);
}
{
close_files();
}
nscd_flush_cache("passwd");
sssd_flush_cache(0x001);
return (0);
} | int main(unsigned 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;
unsigned int v1;
unsigned long long v2;
void *v3;
unsigned long long v4;
char *v5;
unsigned long long v6;
unsigned long long v7[6];
unsigned long v8;
unsigned long v9;
unsigned long v10;
unsigned long v11;
unsigned long v12;
unsigned long v13;
unsigned long v14;
unsigned long v15;
unsigned long v16;
unsigned long v17;
unsigned long v18;
unsigned long v19;
unsigned long long v20;
unsigned long v21;
unsigned long long v22;
char v23;
unsigned long long v24;
char v25;
unsigned long long v28;
unsigned long long v29;
v25 = *(&v25);
v24 = *(&v24);
v0 = 0;
v1 = 0;
Prog = Basename(*(a1));
log_set_progname(0x8930ec8348535441);
log_set_logfd(stderr);
setlocale(0x6, &g_4018a4);
bindtextdomain("shadow", "/usr/share/locale");
textdomain("shadow");
process_flags(a0, a1);
v4 = get_salt();
process_root_flag("-R", a0, a1);
openlog("chpasswd", 0x1, 0x50);
check_perms();
is_shadow_pwd = spw_file_present("chpasswd", 0x1, a2, a3, a4, a5);
open_files();
for (; true; v0 += 1) {
if (!fgets(&v23, 0x2000, stdin))
break;
v1 += 1;
v2 = strrchr(&v23, 0xa);
if (v2) {
*(v2) = 0;
} else if (!feof(stdin)) {
while (fgets(&v23, 0x2000, stdin) && (v2 = strchr(&v23, 0xa), !v2))
;
fprintf(stderr, gettext("%s: line %d: line too long\n"));
continue;
}
v5 = &v23;
v2 = strchr(v5, 0x3a);
if (!v2) {
fprintf(stderr, gettext("%s: line %d: missing new password\n"));
} else {
*(v2) = 0;
v2 += 1;
v6 = v2;
if (v4) {
v2 = pw_encrypt(v6, v4, v4);
if (!v2) {
strerror(*(__errno_location()));
fprintf(stderr,
gettext("%s: failed to crypt password with salt '%s': %s\n"));
fail_exit(0x1);
}
}
v7[0] = pw_locate(v5);
if (!v7) {
fprintf(stderr, gettext("%s: line %d: user '%s' does not exist\n"));
} else {
if (!is_shadow_pwd) {
v3 = 0;
} else {
v3 = spw_locate(v5);
if (!v3 && !strcmp(v7[1], "x")) {
v14 = v5;
v17 = getdef_num("PASS_MIN_DAYS", 0xffffffff);
v18 = getdef_num("PASS_MAX_DAYS", 0xffffffff);
v19 = getdef_num("PASS_WARN_AGE", 0xffffffff);
v20 = -1;
v21 = -1;
v22 = -1;
v3 = &v14;
}
}
if (v3) {
v14 = *(v3);
v15 = v3[8];
v16 = v3[16];
v17 = v3[24];
v18 = v3[32];
v19 = v3[40];
v20 = v3[48];
v21 = v3[56];
v22 = v3[64];
v15 = v2;
v16 =
(gettime() * 1749024623285053783 >> 64 >> 13) - (gettime() >> 63);
if (!v16)
v16 = -1;
}
if (!v3 || strcmp(v7[1], "x")) {
v8 = v7[0];
v9 = v7[1];
v10 = v7[2];
v11 = v7[3];
v12 = v7[4];
v13 = v7[5];
v9 = v2;
}
if (!(!v3 || spw_update(&v14))) {
v28 = spw_dbname();
fprintf(
stderr,
gettext(
"%s: line %d: failed to prepare the new %s entry '%s'\n"));
} else if ((!v3 || strcmp(v7[1], "x")) && !pw_update(&v8)) {
v29 = pw_dbname();
fprintf(
stderr,
gettext(
"%s: line %d: failed to prepare the new %s entry '%s'\n"));
}
}
}
}
if (!v0) {
close_files();
nscd_flush_cache("passwd");
sssd_flush_cache(0x1);
return 0;
}
fprintf(stderr, gettext("%s: error detected, changes ignored\n"));
fail_exit(0x1);
} | shadow | angr_sailr |
static int output_builtin_alias_bin(struct depmod *depmod, FILE *out) {
FILE *in;
struct index_node *idx;
int ret;
if (out == stdout)
return 0;
in = dfdopen(depmod->cfg->dirname, "modules.builtin.modinfo", 00, "r");
if (in == ((void *)0))
return 0;
idx = index_create();
if (idx == ((void *)0)) {
fclose(in);
return -12;
}
while (!feof(in) && !ferror(in)) {
char alias[4096];
char modname[4096];
char value[4096];
size_t len;
len = flush_stream_to(in, '.', modname, sizeof(modname));
modname[len] = '\0';
if (!len)
continue;
len = flush_stream_to(in, '=', value, sizeof(value));
value[len] = '\0';
if (!(strcmp((value), ("alias")) == 0)) {
flush_stream(in, '\0');
continue;
}
len = flush_stream_to(in, '\0', value, sizeof(value));
value[len] = '\0';
if (!len)
continue;
alias[0] = '\0';
if (alias_normalize(value, alias, ((void *)0)) < 0) {
log_printf(4, "Unmatched bracket in %s\n", value);
continue;
}
index_insert(idx, alias, modname, 0);
}
if (ferror(in)) {
ret = -22;
} else {
index_write(idx, out);
ret = 0;
}
index_destroy(idx);
fclose(in);
return ret;
} | undefined4 output_builtin_alias_bin(long *param_1, long param_2)
{
int iVar1;
FILE *__stream;
long lVar2;
long in_FS_OFFSET;
undefined4 local_3034;
undefined local_3018[4096];
undefined local_2018[4096];
char local_1018[4104];
long local_10;
local_10 = *(long *)(in_FS_OFFSET + 0x28);
if (param_2 == stdout) {
local_3034 = 0;
} else {
__stream = (FILE *)dfdopen(*param_1 + 8, "modules.builtin.modinfo", 0,
&DAT_0010064f);
if (__stream == (FILE *)0x0) {
local_3034 = 0;
} else {
lVar2 = index_create();
if (lVar2 == 0) {
fclose(__stream);
local_3034 = 0xfffffff4;
} else {
while ((iVar1 = feof(__stream),
iVar1 == 0 && (iVar1 = ferror(__stream), iVar1 == 0))) {
iVar1 = flush_stream_to(__stream, 0x2e, local_2018, 0x1000);
local_2018[iVar1] = 0;
if ((long)iVar1 != 0) {
iVar1 = flush_stream_to(__stream, 0x3d, local_1018, 0x1000);
local_1018[iVar1] = '\0';
iVar1 = strcmp(local_1018, "alias");
if (iVar1 == 0) {
iVar1 = flush_stream_to(__stream, 0, local_1018, 0x1000);
local_1018[iVar1] = '\0';
if ((long)iVar1 != 0) {
local_3018[0] = 0;
iVar1 = alias_normalize(local_1018, local_3018, 0);
if (iVar1 < 0) {
log_printf(4, "Unmatched bracket in %s\n", local_1018);
} else {
index_insert(lVar2, local_3018, local_2018, 0);
}
}
} else {
flush_stream(__stream, 0);
}
}
}
iVar1 = ferror(__stream);
if (iVar1 == 0) {
index_write(lVar2, param_2);
local_3034 = 0;
} else {
local_3034 = 0xffffffea;
}
index_destroy(lVar2);
fclose(__stream);
}
}
}
if (local_10 == *(long *)(in_FS_OFFSET + 0x28)) {
return local_3034;
}
__stack_chk_fail();
} | kmod | ghidra |
compare_patterns(void const *a, void const *b) {
intptr_t a_offset = (intptr_t)a - 1;
intptr_t b_offset = (intptr_t)b - 1;
char const *p = pattern_array + a_offset;
char const *q = pattern_array + b_offset;
for (; *p == *q; p++, q++)
if (*p == '\n')
return 1;
return 0;
} | long long compare_patterns(unsigned long a0, unsigned long a1) {
char *v0;
char *v1;
unsigned long v2;
unsigned long v3;
unsigned long long v5;
v2 = a0 - 1;
v3 = a1 - 1;
v0 = v2 + pattern_array;
v1 = v3 + pattern_array;
while (true) {
if (*(v0) != *(v1)) {
v5 = 0;
return v5;
} else if (*(v0) != 10) {
v0 += 1;
v1 += 1;
} else {
v5 = 1;
return v5;
}
}
} | grep | angr_sailr |
static void e2fsck_clear_recover(e2fsck_t ctx, int error) {
ext2fs_clear_feature_journal_needs_recovery(ctx->fs->super);
if (error)
ctx->fs->super->s_state &= ~0x0001;
ext2fs_mark_super_dirty(ctx->fs);
} | void e2fsck_clear_recover(struct struct_0 **a0, unsigned long a1) {
unsigned long long v1;
ext2fs_clear_feature_journal_needs_recovery(*(a0)->field_20);
if (a1)
*(a0)->field_20->field_3a = *(a0)->field_20->field_3a & 4294967294;
v1 = ext2fs_mark_super_dirty(*(a0));
return;
} | e2fsprogs-1.46.5 | angr_dream |
void set_warning_option(const char *arg) {
int negate = 0;
int option;
if (strcmp(arg, "none") == 0) {
warning_option = 0;
return;
}
if (strlen(arg) > 2 && memcmp(arg, "no-", 3) == 0) {
negate = 1;
arg += 3;
}
option = ((warning_types)[__xargmatch_internal(
"--warning", arg, warning_args, (void const *)(warning_types),
sizeof *(warning_types), argmatch_die)]);
if (negate)
warning_option &= ~option;
else
warning_option |= option;
} | void set_warning_option(char *param_1)
{
bool bVar1;
int iVar2;
size_t sVar3;
long lVar4;
char *local_20;
bVar1 = false;
iVar2 = strcmp(param_1, "none");
if (iVar2 == 0) {
warning_option = 0;
} else {
sVar3 = strlen(param_1);
local_20 = param_1;
if (2 < sVar3) {
iVar2 = memcmp(param_1, &DAT_001002b5, 3);
if (iVar2 == 0) {
bVar1 = true;
local_20 = param_1 + 3;
}
}
lVar4 = __xargmatch_internal("--warning", local_20, warning_args,
warning_types, 4, argmatch_die);
if (bVar1) {
warning_option = warning_option & ~*(uint *)(warning_types + lVar4 * 4);
} else {
warning_option = warning_option | *(uint *)(warning_types + lVar4 * 4);
}
}
return;
} | tar | ghidra |
static int inflate_dynamic(void) {
int i;
unsigned j;
unsigned l;
unsigned m;
unsigned n;
unsigned w;
struct huft *tl;
struct huft *td;
int bl;
int bd;
unsigned nb;
unsigned nl;
unsigned nd;
unsigned ll[286 + 30];
register ulg b;
register unsigned k;
b = bb;
k = bk;
w = outcnt;
{
while (k < (5)) {
b |= ((ulg)(uch)(inptr < insize ? inbuf[inptr++]
: (outcnt = w, fill_inbuf(0))))
<< k;
k += 8;
}
}
nl = 257 + ((unsigned)b & 0x1f);
{
b >>= (5);
k -= (5);
}
{
while (k < (5)) {
b |= ((ulg)(uch)(inptr < insize ? inbuf[inptr++]
: (outcnt = w, fill_inbuf(0))))
<< k;
k += 8;
}
}
nd = 1 + ((unsigned)b & 0x1f);
{
b >>= (5);
k -= (5);
}
{
while (k < (4)) {
b |= ((ulg)(uch)(inptr < insize ? inbuf[inptr++]
: (outcnt = w, fill_inbuf(0))))
<< k;
k += 8;
}
}
nb = 4 + ((unsigned)b & 0xf);
{
b >>= (4);
k -= (4);
}
if (nl > 286 || nd > 30)
return 1;
for (j = 0; j < nb; j++) {
{
while (k < (3)) {
b |= ((ulg)(uch)(inptr < insize ? inbuf[inptr++]
: (outcnt = w, fill_inbuf(0))))
<< k;
k += 8;
}
}
ll[border[j]] = (unsigned)b & 7;
{
b >>= (3);
k -= (3);
}
}
for (; j < 19; j++)
ll[border[j]] = 0;
bl = 7;
if ((i = huft_build(ll, 19, 19, ((void *)0), ((void *)0), &tl, &bl)) != 0) {
if (i == 1)
huft_free(tl);
return i;
}
if (tl == ((void *)0))
return 2;
n = nl + nd;
m = mask_bits[bl];
i = l = 0;
while ((unsigned)i < n) {
{
while (k < ((unsigned)bl)) {
b |= ((ulg)(uch)(inptr < insize ? inbuf[inptr++]
: (outcnt = w, fill_inbuf(0))))
<< k;
k += 8;
}
}
j = (td = tl + ((unsigned)b & m))->b;
{
b >>= (j);
k -= (j);
}
if (td->e == 99) {
huft_free(tl);
return 2;
}
j = td->v.n;
if (j < 16)
ll[i++] = l = j;
else if (j == 16) {
{
while (k < (2)) {
b |= ((ulg)(uch)(inptr < insize ? inbuf[inptr++]
: (outcnt = w, fill_inbuf(0))))
<< k;
k += 8;
}
}
j = 3 + ((unsigned)b & 3);
{
b >>= (2);
k -= (2);
}
if ((unsigned)i + j > n)
return 1;
while (j--)
ll[i++] = l;
} else if (j == 17) {
{
while (k < (3)) {
b |= ((ulg)(uch)(inptr < insize ? inbuf[inptr++]
: (outcnt = w, fill_inbuf(0))))
<< k;
k += 8;
}
}
j = 3 + ((unsigned)b & 7);
{
b >>= (3);
k -= (3);
}
if ((unsigned)i + j > n)
return 1;
while (j--)
ll[i++] = 0;
l = 0;
} else {
{
while (k < (7)) {
b |= ((ulg)(uch)(inptr < insize ? inbuf[inptr++]
: (outcnt = w, fill_inbuf(0))))
<< k;
k += 8;
}
}
j = 11 + ((unsigned)b & 0x7f);
{
b >>= (7);
k -= (7);
}
if ((unsigned)i + j > n)
return 1;
while (j--)
ll[i++] = 0;
l = 0;
}
}
huft_free(tl);
bb = b;
bk = k;
bl = lbits;
if ((i = huft_build(ll, nl, 257, cplens, cplext, &tl, &bl)) != 0) {
if (i == 1) {
;
huft_free(tl);
}
return i;
}
bd = dbits;
if ((i = huft_build(ll + nl, nd, 0, cpdist, cpdext, &td, &bd)) != 0) {
if (i == 1) {
;
huft_free(td);
}
huft_free(tl);
return i;
}
{
int err = inflate_codes(tl, td, bl, bd) ? 1 : 0;
huft_free(tl);
huft_free(td);
return err;
}
} | void inflate_dynamic() {
int tmp_5;
unsigned int v0;
int tmp_17;
int tmp_9;
int tmp_7;
int tmp_6;
unsigned int v1;
unsigned int v2;
unsigned int v3;
unsigned int v4;
unsigned int v5;
unsigned int v6;
unsigned int v7;
unsigned int v8;
unsigned int v9;
unsigned int v10;
unsigned int v11;
char v12;
struct_0 *v13;
char v14;
unsigned long long v16;
struct_1 *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;
unsigned long long v25;
unsigned long long v26;
unsigned long long v27;
unsigned long long v28;
unsigned long long v29;
unsigned long long v30;
unsigned long long v31;
unsigned long long v32;
unsigned long long v33;
unsigned long long v34;
unsigned long long v35;
unsigned long long v36;
unsigned long long v37;
unsigned long long v38;
unsigned long long v39;
unsigned long long v40;
unsigned long long v41;
unsigned long long v42;
unsigned long long v43;
unsigned long long v44;
unsigned long long v45;
unsigned long long v46;
unsigned long long v47;
unsigned long long v48;
unsigned long long v49;
v16 = bb;
v17 = bk;
for (v5 = outcnt; v17 <= 4; v17 = v17 + 8) {
if (inptr < insize) {
inptr = inptr + 1;
v18 = *(inptr + &inbuf);
} else {
outcnt = v5;
v18 = fill_inbuf(0x0);
}
v19 = v18 << (v17 & 63);
v16 |= v19;
}
v6 = (v16 & 31) + 257;
v20 = v16 / 32;
for (v21 = v17 - 5; v21 <= 4; v21 = v21 + 8) {
if (inptr < insize) {
tmp_5 = inptr;
inptr = inptr + 1;
v22 = *(tmp_5 + &inbuf);
} else {
outcnt = v5;
v22 = fill_inbuf(0x0);
}
v23 = v22 << (v21 & 63);
v20 |= v23;
}
v7 = (v20 & 31) + 1;
v24 = v20 / 32;
for (v25 = v21 - 5; v25 <= 3; v25 = v25 + 8) {
if (inptr < insize) {
tmp_5 = inptr;
inptr = inptr + 1;
v26 = *(tmp_5 + &inbuf);
} else {
outcnt = v5;
v26 = fill_inbuf(0x0);
}
v27 = v26 << (v25 & 63);
v24 |= v27;
}
v8 = (v24 & 15) + 4;
v40 = v24 / 16;
v41 = v25 - 4;
if (v6 <= 286 && v7 <= 30) {
for (; v3 < v8; v3 += 1) {
for (v3 = 0; v41 <= 2; v41 = v41 + 8) {
if (inptr < insize) {
tmp_5 = inptr;
inptr = inptr + 1;
v29 = *(tmp_5 + &inbuf);
} else {
outcnt = v5;
v29 = fill_inbuf(0x0);
}
v30 = v29 << (v41 & 63);
v40 |= v30;
}
*(&(&v14)[4 * *((4 * v3 + &border))]) = v40 & 7;
v40 /= 8;
v41 = v41 - 3;
}
for (; v3 <= 18; v3 += 1) {
*(&(&v14)[4 * *((4 * v3 + &border))]) = 0;
}
v0 = 7;
v2 = huft_build(&v14, 0x13, 0x13, 0x0, NULL, &v12, &v0);
if (v2) {
if (v2 == 1)
huft_free(*(&v12));
v42 = v2;
} else if (!*(&v12)) {
v31 = 2;
} else {
v9 = v7 + v6;
v10 = *((2 * v0 + &mask_bits));
v4 = 0;
while (true) {
if (v9 > v2) {
for (v2 = 0; v41 < v0; v41 = v41 + 8) {
if (inptr < insize) {
tmp_5 = inptr;
inptr = inptr + 1;
v32 = *(tmp_5 + &inbuf);
} else {
outcnt = v5;
v32 = fill_inbuf(0x0);
}
v33 = v32 << (v41 & 63);
v40 |= v33;
}
v13 = *(&v12) + (v40 & v10) * 16;
v3 = v13->field_1;
v40 >>= v3 & 63;
v41 = v41 - v3;
if (v13->field_0 == 99) {
huft_free(*(&v12));
v46 = 2;
break;
} else if (v3 <= 15) {
v4 = v3;
tmp_17 = v2;
v2 += 1;
*(&(&v14)[4 * tmp_17]) = v4;
} else if (v3 == 16) {
for (v3 = v13->field_8; v41 <= 1; v41 = v41 + 8) {
if (inptr < insize) {
tmp_5 = inptr;
inptr = inptr + 1;
v34 = *(tmp_5 + &inbuf);
} else {
outcnt = v5;
v34 = fill_inbuf(0x0);
}
v35 = v34 << (v41 & 63);
v40 |= v35;
}
v3 = (v40 & 3) + 3;
v40 /= 4;
*(&v41) = v41 - 2;
if (v9 < v3 + v2) {
v44 = 1;
break;
} else {
while (true) {
tmp_9 = v3;
v3 -= 1;
if (!tmp_9)
break;
tmp_7 = v2;
v2 += 1;
*(&(&v14)[4 * tmp_7]) = v4;
}
}
} else if (v3 == 17) {
for (; v41 <= 2; v41 = v41 + 8) {
if (inptr < insize) {
tmp_5 = inptr;
inptr = inptr + 1;
v38 = *(tmp_5 + &inbuf);
} else {
outcnt = v5;
v38 = fill_inbuf(0x0);
}
v39 = v38 << (v41 & 63);
v40 |= v39;
}
v3 = (v40 & 7) + 3;
v40 /= 8;
*(&v41) = v41 - 3;
if (v9 < v3 + v2) {
v45 = 1;
break;
} else {
while (true) {
tmp_9 = v3;
v3 -= 1;
if (!tmp_9)
break;
tmp_6 = v2;
v2 += 1;
*(&(&v14)[4 * tmp_6]) = 0;
}
v4 = 0;
}
} else {
for (; v41 <= 6; v41 = v41 + 8) {
if (inptr < insize) {
tmp_5 = inptr;
inptr = inptr + 1;
v36 = *(tmp_5 + &inbuf);
} else {
outcnt = v5;
v36 = fill_inbuf(0x0);
}
v37 = v36 << (v41 & 63);
v40 |= v37;
}
v3 = (v40 & 127) + 11;
v40 /= 128;
*(&v41) = v41 - 7;
if (v9 < v3 + v2) {
v43 = 1;
break;
} else {
while (true) {
tmp_9 = v3;
v3 -= 1;
if (!tmp_9)
break;
tmp_6 = v2;
v2 += 1;
*(&(&v14)[4 * tmp_6]) = 0;
}
v4 = 0;
}
}
} else {
huft_free(*(&v12));
bb = v40;
bk = v41;
v0 = lbits;
v2 = huft_build(&v14, v6, 0x101, &cplens, &cplext, &v12, &v0);
if (v2) {
if (v2 == 1)
huft_free(*(&v12));
v47 = v2;
break;
} else {
v1 = dbits;
v2 = huft_build(&(&v14)[4 * v6], v7, 0x0, &cpdist, &cpdext, &v13,
&v1);
if (v2) {
if (v2 == 1)
huft_free(v13);
huft_free(*(&v12));
v48 = v2;
break;
} else {
v11 = inflate_codes(*(&v12), v13, v0, v1);
huft_free(*(&v12));
huft_free(v13);
v49 = v11;
break;
}
}
}
}
}
}
if (v6 > 286 || v7 > 30)
v28 = 1;
return;
} | gzip-1.12 | angr_dream |
static int rl_vi_overstrike_kill_line(int count, int key) {
int r, end;
end = rl_end;
r = rl_unix_line_discard(count, key);
vi_replace_count -= end - rl_end;
return r;
} | long rl_vi_overstrike_kill_line(unsigned int a1, unsigned int a2) {
int v3;
unsigned int v4;
v3 = rl_end;
v4 = rl_unix_line_discard(a1, a2);
vi_replace_count -= v3 - rl_end;
return v4;
} | bash | ida |
int _rl_prev_macro_key(void) {
if (rl_executing_macro == 0)
return (0);
if (executing_macro_index == 0)
return (0);
executing_macro_index--;
return (rl_executing_macro[executing_macro_index]);
} | int _rl_prev_macro_key(void)
{
int iVar1;
if (rl_executing_macro == 0) {
iVar1 = 0;
} else if (executing_macro_index == 0) {
iVar1 = 0;
} else {
executing_macro_index = executing_macro_index + -1;
iVar1 = (int)*(char *)(executing_macro_index + rl_executing_macro);
}
return iVar1;
} | bash | ghidra |
static inline _Bool
dot_or_dotdot(char const *file_name) {
if (file_name[0] == '.') {
char sep = file_name[(file_name[1] == '.') + 1];
return (!sep || ((sep) == '/'));
} else
return 0;
} | int dot_or_dotdot(unsigned long long a0) {
char v0;
unsigned int v2;
unsigned long long v3;
unsigned int v4;
if (*(a0) != 46) {
v2 = 0;
} else {
if (*((a0 + 1)) == 46)
v3 = 2;
else
v3 = 1;
v0 = *((a0 + v3));
if (!v0) {
LABEL_400047:
v4 = 1;
} else {
if (v0 == 47)
goto LABEL_400047;
v4 = 0;
}
v2 = v4 & 1;
}
return v2;
} | coreutils | angr_phoenix |
void kill_all_local_variables() {
VAR_CONTEXT *vc;
for (vc = shell_variables; vc; vc = vc->down)
if ((((vc)->flags & 0x04) != 0) && vc->scope == variable_context)
break;
if (vc == 0)
return;
if (vc->table && (((vc)->flags & 0x01) != 0)) {
delete_all_variables(vc->table);
hash_dispose(vc->table);
}
vc->table = (HASH_TABLE *)((void *)0);
} | long kill_all_local_variables() {
long result;
long i;
result = shell_variables;
for (i = shell_variables; i; i = result) {
if ((*(_DWORD *)(i + 12) & 4) != 0) {
result = (unsigned int)variable_context;
if (*(_DWORD *)(i + 8) == variable_context)
break;
}
result = *(_QWORD *)(i + 24);
}
if (i) {
if (*(_QWORD *)(i + 32)) {
if ((*(_DWORD *)(i + 12) & 1) != 0) {
delete_all_variables(*(_QWORD *)(i + 32));
hash_dispose(*(_QWORD *)(i + 32));
}
}
result = i;
*(_QWORD *)(i + 32) = 0LL;
}
return result;
} | bash | ida |
static int exec_name_should_ignore(name) const char *name;
{
struct ign *p;
for (p = execignore.ignores; p && p->val; p++)
if (strmatch(p->val, (char *)name,
(extended_glob ? (1 << 5) : 0) | (1 << 4)) != 1)
return 1;
return 0;
} | int exec_name_should_ignore(unsigned long long a0) {
unsigned long long *v0;
unsigned int v2;
v0 = g_401088;
while (true) {
if (v0 && *(v0)) {
v2 = strmatch(*(v0), a0);
if (v2 != 1) {
v2 = 1;
break;
} else {
v0 += 2;
continue;
}
}
if (!*(v0) || !v0) {
v2 = 0;
break;
}
}
return v2;
} | bash | angr_dream |
static SHELL_VAR *assign_dirstack(self, value, ind, key)
SHELL_VAR *self;
char *value;
arrayind_t ind;
char *key;
{
set_dirstack_element(ind, 1, value);
return self;
} | long assign_dirstack(long a1, long a2, long a3) {
set_dirstack_element(a3, 1LL, a2);
return a1;
} | bash | ida |
static void print_only_size(uintmax_t n_bytes) {
char buf[((2 * sizeof(uintmax_t) * 8 * 146 / 485 + 1) * (16 + 1) - 16 + 1 +
3) +
1];
fputs_unlocked((n_bytes == (18446744073709551615UL)
? gettext("Infinity")
: human_readable(n_bytes, buf, human_output_opts, 1,
output_block_size)),
stdout)
;
} | unsigned long print_only_size(long a1) {
FILE *v1;
char *v2;
char v4[664];
unsigned long v5;
v5 = __readfsqword(0x28u);
v1 = stdout;
if (a1 == -1)
v2 = gettext("Infinity");
else
v2 = (char *)human_readable(a1, v4, (unsigned int)human_output_opts, 1LL,
output_block_size);
fputs_unlocked(v2, v1);
return __readfsqword(0x28u) ^ v5;
} | coreutils | ida |
static void interrupt_handler(int sig) {
delete_all_files(1);
signal(sig, ((__sighandler_t)0));
raise(sig);
} | long long interrupt_handler(unsigned long a0) {
delete_all_files(0x1);
signal(a0, 0x0);
return raise(a0);
} | coreutils | angr_sailr |
static void applySavedTimeInfoToOutputFile(Char *dstName) {
IntNative retVal;
struct utimbuf uTimBuf;
uTimBuf.actime = fileMetaInfo.st_atim.tv_sec;
uTimBuf.modtime = fileMetaInfo.st_mtim.tv_sec;
retVal = utime(dstName, &uTimBuf);
{
if ((retVal) != 0)
ioError();
};
} | unsigned long applySavedTimeInfoToOutputFile(const char *a1) {
struct utimbuf file_times;
unsigned long v3;
v3 = __readfsqword(0x28u);
file_times.actime = qword_52C8;
file_times.modtime = qword_52D8;
if (utime(a1, &file_times))
ioError();
return v3 - __readfsqword(0x28u);
} | bzip2 | ida |
int el_deletestr1(EditLine *el, int start, int end) {
size_t line_length, len;
wchar_t *p1, *p2;
if (end <= start)
return 0;
line_length = (size_t)(el->el_line.lastchar - el->el_line.buffer);
if (start >= (int)line_length || end >= (int)line_length)
return 0;
len = (size_t)(end - start);
if (len > line_length - (size_t)end)
len = line_length - (size_t)end;
p1 = el->el_line.buffer + start;
p2 = el->el_line.buffer + end;
for (size_t i = 0; i < len; i++) {
*p1++ = *p2++;
el->el_line.lastchar--;
}
if (el->el_line.cursor < el->el_line.buffer)
el->el_line.cursor = el->el_line.buffer;
return end - start;
} | long long el_deletestr1(unsigned long long a0[13], unsigned long a1,
unsigned long a2) {
unsigned long v0;
int tmp_19;
int tmp_27;
unsigned int *v1;
unsigned int *v2;
void *v3;
unsigned long long v4;
void *v6;
if (a2 <= a1) {
v6 = 0;
return v6;
}
v4 = a0[12] - a0[10] >> 2;
if (a1 >= v4) {
v6 = 0;
return v6;
} else if (a2 < v4) {
v0 = a2 - a1;
if (v0 > v4 - a2)
v0 = v4 - a2;
v1 = a0[10] + a1 * 4;
v2 = a0[10] + a2 * 4;
for (v3 = 0; v3 < v0; v3 += 1) {
tmp_19 = v2;
v2 += 1;
tmp_27 = v1;
v1 += 1;
*(tmp_27) = *(tmp_19);
a0[12] = a0[12] - 4;
}
if (a0[11] < a0[10])
a0[11] = a0[10];
v6 = a2 - a1;
return v6;
} else {
v6 = 0;
return v6;
}
} | libedit | angr_sailr |
static int tuntap_filter_req(struct nlmsghdr *nlh, int reqlen) {
struct rtattr *linkinfo;
int err;
linkinfo = addattr_nest(nlh, reqlen, IFLA_LINKINFO);
err = addattr_l(nlh, reqlen, IFLA_INFO_KIND, drv_name, sizeof(drv_name) - 1);
if (err)
return err;
addattr_nest_end(nlh, linkinfo);
return 0;
} | long long tuntap_filter_req(unsigned long long a0, unsigned long a1) {
unsigned int v0;
unsigned long long v1;
void *v3;
v1 = addattr_nest(a0, a1, 0x12, a1);
v0 = addattr_l(a0, a1, 0x1, "tun", 0x3);
if (v0) {
v3 = v0;
} else {
addattr_nest_end(a0, v1, v1);
v3 = 0;
}
return v3;
} | iproute2-6.0.0 | angr_dream |
static int jobno(const struct job *jp) { return jp - jobtab + 1; } | int jobno(unsigned long a0) {
return ((a0 - jobtab >> 3) * 14757395258967641293) + 1;
} | dash-0.5.11+git20210903+057cd650a4ed | angr_phoenix |
static void process_request_identities(SocketEntry *e) {
Identity *id;
struct sshbuf *msg, *keys;
int r;
u_int nentries = 0;
sshlog("ssh-agent.c", __func__, 519, 1, SYSLOG_LEVEL_DEBUG2, ((void *)0),
"entering");
if ((msg = sshbuf_new()) == ((void *)0) ||
(keys = sshbuf_new()) == ((void *)0))
sshfatal("ssh-agent.c", __func__, 522, 1, SYSLOG_LEVEL_FATAL, ((void *)0),
"sshbuf_new failed");
for ((id) = ((&idtab->idlist)->tqh_first); (id) != ((void *)0);
(id) = ((id)->next.tqe_next)) {
if (identity_permitted(id, e, ((void *)0), ((void *)0), ((void *)0)) != 0)
continue;
if ((r = sshkey_puts_opts(id->key, keys, SSHKEY_SERIALIZE_INFO)) != 0 ||
(r = sshbuf_put_cstring(keys, id->comment)) != 0) {
sshlog("ssh-agent.c", __func__, 530, 1, SYSLOG_LEVEL_ERROR, ssh_err(r),
"compose key/comment");
continue;
}
nentries++;
}
sshlog("ssh-agent.c", __func__, 535, 1, SYSLOG_LEVEL_DEBUG2, ((void *)0),
"replying with %u allowed of %u available keys", nentries,
idtab->nentries);
if ((r = sshbuf_put_u8(msg, 12)) != 0 ||
(r = sshbuf_put_u32(msg, nentries)) != 0 ||
(r = sshbuf_putb(msg, keys)) != 0)
sshfatal("ssh-agent.c", __func__, 540, 1, SYSLOG_LEVEL_FATAL, ssh_err(r),
"compose");
if ((r = sshbuf_put_stringb(e->output, msg)) != 0)
sshfatal("ssh-agent.c", __func__, 542, 1, SYSLOG_LEVEL_FATAL, ssh_err(r),
"enqueue");
sshbuf_free(msg);
sshbuf_free(keys);
} | void process_request_identities(struct_0 *a0) {
char v0;
char v1;
unsigned int v2;
unsigned int v3;
unsigned long long v4[4];
unsigned long long v5;
unsigned long long v6;
char v7;
unsigned long long v8;
char v9;
char v10;
char v11;
unsigned long long v13;
v3 = 0;
sshlog("ssh-agent.c", "process_request_identities", 0x207, 0x1, 0x6, 0x0,
"entering", *(&v0), *(&v1), a0, *(&v2));
v5 = sshbuf_new("ssh-agent.c", "process_request_identities", 0x207, 0x1, 0x6,
0x0, *(&v7));
if (v5)
v6 = sshbuf_new("ssh-agent.c", "process_request_identities", 0x207, 0x1,
0x6, 0x0, *(&v7));
if (!v5 || !v6)
sshfatal("ssh-agent.c", "process_request_identities", 0x20a, 0x1, 0x1, 0x0);
for (v4[0] = *(16752697131771134800); v4; v4[0] = v4[0]) {
if (!identity_permitted(v4, a0, 0x0, NULL, NULL)) {
v2 = sshkey_puts_opts(v4[2], v6, 0xfe, v6);
if (!v2) {
v2 = sshbuf_put_cstring(v6, v4[3], v4[3]);
if (!v2)
v3 = (&v2)[1] + 1;
}
if (v2 || v2) {
v6 = "compose key/comment";
sshlog("ssh-agent.c", "process_request_identities", 0x212, 0x1, 0x2,
ssh_err(v2), *(&v7), v8, *(&v9), *(&v10), *(&v11));
}
}
}
v6 = *(16752697131771134792);
v5 = (&v2)[1];
v4 = "replying with %u allowed of %u available keys";
sshlog("ssh-agent.c", "process_request_identities", 0x217, 0x1, 0x6, 0x0,
*(&v7), v8, *(&v9), *(&v10), *(&v11));
v2 = sshbuf_put_u8(v5, 0xc);
if (!v2) {
v2 = sshbuf_put_u32(v5, (&v2)[1]);
if (!v2)
v2 = sshbuf_putb(v5, v6, v6);
}
if (v2 || v2 || v2) {
v6 = "compose";
sshfatal("ssh-agent.c", "process_request_identities", 0x21c, 0x1, 0x1,
ssh_err(v2));
}
v2 = sshbuf_put_stringb(a0->field_10, v5, v5);
if (v2) {
v6 = "enqueue";
sshfatal("ssh-agent.c", "process_request_identities", 0x21e, 0x1, 0x1,
ssh_err(v2));
}
sshbuf_free(v5);
v13 = sshbuf_free(v6);
return;
} | openssh-portable | angr_dream |
int auth2_update_methods_lists(Authctxt *authctxt, const char *method,
const char *submethod) {
u_int i, found = 0;
sshlog("auth2.c", __func__, 705, 1, SYSLOG_LEVEL_DEBUG3, ((void *)0),
"updating methods list after \"%s\"", method);
for (i = 0; i < authctxt->num_auth_methods; i++) {
if (!remove_method(&(authctxt->auth_methods[i]), method, submethod))
continue;
found = 1;
if (*authctxt->auth_methods[i] == '\0') {
sshlog("auth2.c", __func__, 712, 0, SYSLOG_LEVEL_DEBUG2, ((void *)0),
"authentication methods list %d complete", i);
return 1;
}
sshlog("auth2.c", __func__, 715, 0, SYSLOG_LEVEL_DEBUG3, ((void *)0),
"authentication methods list %d remaining: \"%s\"", i,
authctxt->auth_methods[i]);
}
if (!found)
sshfatal("auth2.c", __func__, 720, 1, SYSLOG_LEVEL_FATAL, ((void *)0),
"method not in AuthenticationMethods");
return 0;
} | int auth2_update_methods_lists(struct_0 *a0, unsigned long long a1,
unsigned long long a2) {
unsigned long v0;
unsigned long v1;
unsigned int v2;
unsigned int v3;
unsigned int v5;
v3 = 0;
v1 = a1;
sshlog("auth2.c", "auth2_update_methods_lists", 0x2c1, 0x1, 0x7, 0x0,
"updating methods list after \"%s\"");
v2 = 0;
while (true) {
if (v2 >= a0->field_48) {
if (!v3)
sshfatal("auth2.c", "auth2_update_methods_lists", 0x2d0, 0x1, 0x1, 0x0);
v5 = 0;
break;
} else {
if (remove_method(a0->field_40 + (v2 << 3), a1, a2)) {
v3 = 1;
if (*(*((a0->field_40 + (v2 << 3))))) {
v0 = v2;
sshlog("auth2.c", "auth2_update_methods_lists", 0x2cb, 0x0, 0x7, 0x0,
"authentication methods list %d remaining: \"%s\"");
} else {
v1 = v2;
sshlog("auth2.c", "auth2_update_methods_lists", 0x2c8, 0x0, 0x6, 0x0,
"authentication methods list %d complete");
v5 = 1;
break;
}
}
v2 += 1;
}
}
return v5;
} | openssh-portable | angr_phoenix |
void sv_ignoreeof(name) char *name;
{
SHELL_VAR *tmp_var;
char *temp;
eof_encountered = 0;
tmp_var = find_variable(name);
ignoreeof = tmp_var && ((tmp_var)->value != 0);
temp = tmp_var ? ((tmp_var)->value) : (char *)((void *)0);
if (temp)
eof_encountered_limit = (*temp && all_digits(temp)) ? atoi(temp) : 10;
set_shellopts();
} | void sv_ignoreeof(unsigned long long a0, unsigned long long a1,
unsigned long long a2, unsigned long long a3,
unsigned long long a4, unsigned long long a5) {
struct_0 *v0;
unsigned long v1;
unsigned int v3;
unsigned long v4;
unsigned long long v5;
eof_encountered = 0;
v0 = find_variable(a0);
if (v0 && v0->field_8) {
v3 = 1;
goto LABEL_40af4a;
}
v3 = 0;
LABEL_40af4a:
ignoreeof = v3;
if (!v0)
v4 = 0;
else
v4 = v0->field_8;
v1 = v4;
if (v1) {
if (*(v1) && all_digits(v1)) {
v4 = atoi(v1);
goto LABEL_40af9f;
}
*(&v4) = 10;
LABEL_40af9f:
eof_encountered_limit = v4;
}
v5 = set_shellopts(a0, a1, a2, a3, a4, a5);
return;
} | bash | angr_phoenix |
static struct item *new_item(char const *str) {
struct item *k = xzalloc(sizeof *k);
if (str)
k->str = xstrdup(str);
return k;
} | int new_item(unsigned long long a0) {
unsigned long long *v0;
v0 = xzalloc(0x38);
if (a0) {
*(v0) = xstrdup(a0);
return v0;
}
return v0;
} | coreutils | angr_sailr |
static int read_seg6mode_type(const char *mode) {
int i;
for (i = 0; i < (sizeof(seg6_mode_types) / sizeof((seg6_mode_types)[0]));
i++) {
if (strcmp(mode, seg6_mode_types[i]) == 0)
return i;
}
return -1;
} | uint read_seg6mode_type(char *param_1)
{
int iVar1;
uint local_c;
local_c = 0;
while (true) {
if (4 < local_c) {
return 0xffffffff;
}
iVar1 =
strcmp(param_1, *(char **)(seg6_mode_types + (long)(int)local_c * 8));
if (iVar1 == 0)
break;
local_c = local_c + 1;
}
return local_c;
} | iproute2-6.0.0 | ghidra |
static int geneve_parse_opt(struct link_util *lu, int argc, char **argv,
struct nlmsghdr *n) {
inet_prefix daddr;
__u32 vni = 0;
__u32 label = 0;
__u8 ttl = 0;
__u8 tos = 0;
__u16 dstport = 0;
_Bool metadata = 0;
__u8 udpcsum = 0;
__u8 udp6zerocsumtx = 0;
__u8 udp6zerocsumrx = 0;
__u64 attrs = 0;
_Bool set_op = (n->nlmsg_type == RTM_NEWLINK && !(n->nlmsg_flags & 0x400));
_Bool inner_proto_inherit = 0;
inet_prefix_reset(&daddr);
while (argc > 0) {
if (!matches(*argv, "id") || !matches(*argv, "vni")) {
do {
argv++;
if (--argc <= 0)
incomplete_command();
} while (0);
check_duparg(&attrs, IFLA_GENEVE_ID, "id", *argv);
if (get_u32(&vni, *argv, 0) || vni >= 1u << 24)
invarg("invalid id", *argv);
} else if (!matches(*argv, "remote")) {
do {
argv++;
if (--argc <= 0)
incomplete_command();
} while (0);
check_duparg(&attrs, IFLA_GENEVE_REMOTE, "remote", *argv);
get_addr(&daddr, *argv, 0);
if (!is_addrtype_inet_not_multi(&daddr))
invarg("invalid remote address", *argv);
} else if (!matches(*argv, "ttl") || !matches(*argv, "hoplimit")) {
unsigned int uval;
do {
argv++;
if (--argc <= 0)
incomplete_command();
} while (0);
check_duparg(&attrs, IFLA_GENEVE_TTL, "ttl", *argv);
if (strcmp(*argv, "inherit") == 0) {
addattr8(n, 1024, IFLA_GENEVE_TTL_INHERIT, 1);
} else if (strcmp(*argv, "auto") != 0) {
if (get_unsigned(&uval, *argv, 0))
invarg("invalid TTL", *argv);
if (uval > 255)
invarg("TTL must be <= 255", *argv);
ttl = uval;
}
} else if (!matches(*argv, "tos") || !matches(*argv, "dsfield")) {
__u32 uval;
do {
argv++;
if (--argc <= 0)
incomplete_command();
} while (0);
check_duparg(&attrs, IFLA_GENEVE_TOS, "tos", *argv);
if (strcmp(*argv, "inherit") != 0) {
if (rtnl_dsfield_a2n(&uval, *argv))
invarg("bad TOS value", *argv);
tos = uval;
} else
tos = 1;
} else if (!matches(*argv, "df")) {
enum ifla_geneve_df df;
do {
argv++;
if (--argc <= 0)
incomplete_command();
} while (0);
check_duparg(&attrs, IFLA_GENEVE_DF, "df", *argv);
if (strcmp(*argv, "unset") == 0)
df = GENEVE_DF_UNSET;
else if (strcmp(*argv, "set") == 0)
df = GENEVE_DF_SET;
else if (strcmp(*argv, "inherit") == 0)
df = GENEVE_DF_INHERIT;
else
invarg("DF must be 'unset', 'set' or 'inherit'", *argv);
addattr8(n, 1024, IFLA_GENEVE_DF, df);
} else if (!matches(*argv, "label") || !matches(*argv, "flowlabel")) {
__u32 uval;
do {
argv++;
if (--argc <= 0)
incomplete_command();
} while (0);
check_duparg(&attrs, IFLA_GENEVE_LABEL, "flowlabel", *argv);
if (get_u32(&uval, *argv, 0) || (uval & ~0xFFFFFU))
invarg("invalid flowlabel", *argv);
label = htonl(uval);
} else if (!matches(*argv, "dstport")) {
do {
argv++;
if (--argc <= 0)
incomplete_command();
} while (0);
check_duparg(&attrs, IFLA_GENEVE_PORT, "dstport", *argv);
if (get_u16(&dstport, *argv, 0))
invarg("dstport", *argv);
} else if (!matches(*argv, "external")) {
check_duparg(&attrs, IFLA_GENEVE_COLLECT_METADATA, *argv, *argv);
metadata = 1;
} else if (!matches(*argv, "noexternal")) {
check_duparg(&attrs, IFLA_GENEVE_COLLECT_METADATA, *argv, *argv);
metadata = 0;
} else if (!matches(*argv, "udpcsum")) {
check_duparg(&attrs, IFLA_GENEVE_UDP_CSUM, *argv, *argv);
udpcsum = 1;
} else if (!matches(*argv, "noudpcsum")) {
check_duparg(&attrs, IFLA_GENEVE_UDP_CSUM, *argv, *argv);
udpcsum = 0;
} else if (!matches(*argv, "udp6zerocsumtx")) {
check_duparg(&attrs, IFLA_GENEVE_UDP_ZERO_CSUM6_TX, *argv, *argv);
udp6zerocsumtx = 1;
} else if (!matches(*argv, "noudp6zerocsumtx")) {
check_duparg(&attrs, IFLA_GENEVE_UDP_ZERO_CSUM6_TX, *argv, *argv);
udp6zerocsumtx = 0;
} else if (!matches(*argv, "udp6zerocsumrx")) {
check_duparg(&attrs, IFLA_GENEVE_UDP_ZERO_CSUM6_RX, *argv, *argv);
udp6zerocsumrx = 1;
} else if (!matches(*argv, "noudp6zerocsumrx")) {
check_duparg(&attrs, IFLA_GENEVE_UDP_ZERO_CSUM6_RX, *argv, *argv);
udp6zerocsumrx = 0;
} else if (!strcmp(*argv, "innerprotoinherit")) {
check_duparg(&attrs, IFLA_GENEVE_INNER_PROTO_INHERIT, *argv, *argv);
inner_proto_inherit = 1;
} else if (matches(*argv, "help") == 0) {
explain();
return -1;
} else {
fprintf(stderr, "geneve: unknown command \"%s\"?\n", *argv);
explain();
return -1;
}
argc--, argv++;
}
if (metadata && (((attrs) & (1L << (IFLA_GENEVE_ID))) != 0)) {
fprintf(stderr, "geneve: both 'external' and vni cannot be specified\n");
return -1;
}
if (!metadata) {
if (!(((attrs) & (1L << (IFLA_GENEVE_ID))) != 0)) {
fprintf(stderr, "geneve: missing virtual network identifier\n");
return -1;
}
if (!set_op && !is_addrtype_inet(&daddr)) {
fprintf(stderr, "geneve: remote link partner not specified\n");
return -1;
}
}
addattr32(n, 1024, IFLA_GENEVE_ID, vni);
if (is_addrtype_inet(&daddr)) {
int type = (daddr.family == 2) ? IFLA_GENEVE_REMOTE : IFLA_GENEVE_REMOTE6;
addattr_l(n, 1024, type, daddr.data, daddr.bytelen);
}
if (!set_op || (((attrs) & (1L << (IFLA_GENEVE_LABEL))) != 0))
addattr32(n, 1024, IFLA_GENEVE_LABEL, label);
if (!set_op || (((attrs) & (1L << (IFLA_GENEVE_TTL))) != 0))
addattr8(n, 1024, IFLA_GENEVE_TTL, ttl);
if (!set_op || (((attrs) & (1L << (IFLA_GENEVE_TOS))) != 0))
addattr8(n, 1024, IFLA_GENEVE_TOS, tos);
if (dstport)
addattr16(n, 1024, IFLA_GENEVE_PORT, htons(dstport));
if (metadata)
addattr(n, 1024, IFLA_GENEVE_COLLECT_METADATA);
if (inner_proto_inherit)
addattr(n, 1024, IFLA_GENEVE_INNER_PROTO_INHERIT);
if ((((attrs) & (1L << (IFLA_GENEVE_UDP_CSUM))) != 0))
addattr8(n, 1024, IFLA_GENEVE_UDP_CSUM, udpcsum);
if ((((attrs) & (1L << (IFLA_GENEVE_UDP_ZERO_CSUM6_TX))) != 0))
addattr8(n, 1024, IFLA_GENEVE_UDP_ZERO_CSUM6_TX, udp6zerocsumtx);
if ((((attrs) & (1L << (IFLA_GENEVE_UDP_ZERO_CSUM6_RX))) != 0))
addattr8(n, 1024, IFLA_GENEVE_UDP_ZERO_CSUM6_RX, udp6zerocsumrx);
return 0;
} | undefined8 geneve_parse_opt(undefined8 param_1, int param_2, char **param_3,
long param_4)
{
bool bVar1;
bool bVar2;
bool bVar3;
char cVar4;
uint16_t uVar5;
int iVar6;
undefined8 uVar7;
long in_FS_OFFSET;
char **local_160;
int local_154;
undefined local_13e;
undefined local_13d;
undefined local_13b;
undefined local_13a;
undefined local_139;
uint16_t local_136;
uint local_134;
uint local_130;
uint32_t local_12c;
uint local_128;
undefined4 local_124;
ulong local_120;
undefined local_118[2];
undefined2 local_116;
short local_112;
undefined local_110[256];
long local_10;
local_10 = *(long *)(in_FS_OFFSET + 0x28);
local_134 = 0;
local_12c = 0;
local_13e = 0;
local_13d = 0;
local_136 = 0;
bVar1 = false;
local_13b = 0;
local_13a = 0;
local_139 = 0;
local_120 = 0;
if ((*(short *)(param_4 + 4) == 0x10) &&
((*(ushort *)(param_4 + 6) & 0x400) == 0)) {
bVar3 = true;
} else {
bVar3 = false;
}
bVar2 = false;
inet_prefix_reset(local_118);
local_160 = param_3;
for (local_154 = param_2; 0 < local_154; local_154 = local_154 + -1) {
cVar4 = matches(*local_160, &DAT_00101866);
if ((cVar4 == '\x01') &&
(cVar4 = matches(*local_160, &DAT_00101869), cVar4 == '\x01')) {
LAB_001003f7:
cVar4 = matches(*local_160, "remote");
if (cVar4 != '\x01') {
local_160 = local_160 + 1;
local_154 = local_154 + -1;
if (local_154 < 1) {
incomplete_command();
}
check_duparg(&local_120, 2, "remote", *local_160);
get_addr(local_118, *local_160, 0);
cVar4 = is_addrtype_inet_not_multi(local_118);
if (cVar4 == '\x01')
goto LAB_00100d23;
invarg("invalid remote address", *local_160);
}
cVar4 = matches(*local_160, &DAT_00101896);
if ((cVar4 == '\x01') &&
(cVar4 = matches(*local_160, "hoplimit"), cVar4 == '\x01')) {
cVar4 = matches(*local_160, &DAT_001018cf);
if ((cVar4 == '\x01') &&
(cVar4 = matches(*local_160, "dsfield"), cVar4 == '\x01')) {
cVar4 = matches(*local_160, &DAT_001018e9);
if (cVar4 == '\x01') {
cVar4 = matches(*local_160, "label");
if ((cVar4 == '\x01') &&
(cVar4 = matches(*local_160, "flowlabel"), cVar4 == '\x01')) {
cVar4 = matches(*local_160, "dstport");
if (cVar4 != '\x01') {
local_160 = local_160 + 1;
local_154 = local_154 + -1;
if (local_154 < 1) {
incomplete_command();
}
check_duparg(&local_120, 5, "dstport", *local_160);
iVar6 = get_u16(&local_136, *local_160, 0);
if (iVar6 == 0)
goto LAB_00100d23;
invarg("dstport", *local_160);
}
cVar4 = matches(*local_160, "external");
if (cVar4 == '\x01') {
cVar4 = matches(*local_160, "noexternal");
if (cVar4 == '\x01') {
cVar4 = matches(*local_160, "udpcsum");
if (cVar4 == '\x01') {
cVar4 = matches(*local_160, "noudpcsum");
if (cVar4 == '\x01') {
cVar4 = matches(*local_160, "udp6zerocsumtx");
if (cVar4 == '\x01') {
cVar4 = matches(*local_160, "noudp6zerocsumtx");
if (cVar4 == '\x01') {
cVar4 = matches(*local_160, "udp6zerocsumrx");
if (cVar4 == '\x01') {
cVar4 = matches(*local_160, "noudp6zerocsumrx");
if (cVar4 == '\x01') {
iVar6 = strcmp(*local_160, "innerprotoinherit");
if (iVar6 != 0) {
cVar4 = matches(*local_160, &DAT_001019c1);
if (cVar4 == '\x01') {
fprintf(stderr,
"geneve: unknown command \"%s\"?\n",
*local_160);
explain();
uVar7 = 0xffffffff;
} else {
explain();
uVar7 = 0xffffffff;
}
goto LAB_00101067;
}
check_duparg(&local_120, 0xe, *local_160,
*local_160);
bVar2 = true;
} else {
check_duparg(&local_120, 10, *local_160,
*local_160);
local_139 = 0;
}
} else {
check_duparg(&local_120, 10, *local_160,
*local_160);
local_139 = 1;
}
} else {
check_duparg(&local_120, 9, *local_160, *local_160);
local_13a = 0;
}
} else {
check_duparg(&local_120, 9, *local_160, *local_160);
local_13a = 1;
}
} else {
check_duparg(&local_120, 8, *local_160, *local_160);
local_13b = 0;
}
} else {
check_duparg(&local_120, 8, *local_160, *local_160);
local_13b = 1;
}
} else {
check_duparg(&local_120, 6, *local_160, *local_160);
bVar1 = false;
}
} else {
check_duparg(&local_120, 6, *local_160, *local_160);
bVar1 = true;
}
} else {
local_160 = local_160 + 1;
local_154 = local_154 + -1;
if (local_154 < 1) {
incomplete_command();
}
check_duparg(&local_120, 0xb, "flowlabel", *local_160);
iVar6 = get_u32(&local_130, *local_160, 0);
if ((iVar6 != 0) || ((local_130 & 0xfff00000) != 0)) {
invarg("invalid flowlabel", *local_160);
}
local_12c = htonl(local_130);
}
} else {
local_160 = local_160 + 1;
local_154 = local_154 + -1;
if (local_154 < 1) {
incomplete_command();
}
check_duparg(&local_120, 0xd, &DAT_001018e9, *local_160);
iVar6 = strcmp(*local_160, "unset");
if (iVar6 == 0) {
local_128 = 0;
} else {
iVar6 = strcmp(*local_160, "set");
if (iVar6 == 0) {
local_128 = 1;
} else {
iVar6 = strcmp(*local_160, "inherit");
if (iVar6 == 0) {
local_128 = 2;
} else {
invarg("DF must be \'unset\', \'set\' or \'inherit\'",
*local_160);
}
}
}
addattr8(param_4, 0x400, 0xd, local_128 & 0xff);
}
} else {
local_160 = local_160 + 1;
local_154 = local_154 + -1;
if (local_154 < 1) {
incomplete_command();
}
check_duparg(&local_120, 4, &DAT_001018cf, *local_160);
iVar6 = strcmp(*local_160, "inherit");
if (iVar6 == 0) {
local_13d = 1;
} else {
iVar6 = rtnl_dsfield_a2n(&local_130, *local_160);
if (iVar6 != 0) {
invarg("bad TOS value", *local_160);
}
local_13d = (undefined)local_130;
}
}
} else {
local_160 = local_160 + 1;
local_154 = local_154 + -1;
if (local_154 < 1) {
incomplete_command();
}
check_duparg(&local_120, 3, &DAT_00101896, *local_160);
iVar6 = strcmp(*local_160, "inherit");
if (iVar6 == 0) {
addattr8(param_4, 0x400, 0xc, 1);
} else {
iVar6 = strcmp(*local_160, "auto");
if (iVar6 != 0) {
iVar6 = get_unsigned(&local_130, *local_160, 0);
if (iVar6 != 0) {
invarg("invalid TTL", *local_160);
}
if (0xff < local_130) {
invarg("TTL must be <= 255", *local_160);
}
local_13e = (undefined)local_130;
}
}
}
} else {
local_160 = local_160 + 1;
local_154 = local_154 + -1;
if (local_154 < 1) {
incomplete_command();
}
check_duparg(&local_120, 1, &DAT_00101866, *local_160);
iVar6 = get_u32(&local_134, *local_160, 0);
if ((iVar6 != 0) || (0xffffff < local_134)) {
invarg("invalid id", *local_160);
goto LAB_001003f7;
}
}
LAB_00100d23:
local_160 = local_160 + 1;
}
if ((bVar1) && ((local_120 & 2) != 0)) {
fprintf(stderr, "geneve: both \'external\' and vni cannot be specified\n");
uVar7 = 0xffffffff;
goto LAB_00101067;
}
if (!bVar1) {
if ((local_120 & 2) == 0) {
fprintf(stderr, "geneve: missing virtual network identifier\n");
uVar7 = 0xffffffff;
goto LAB_00101067;
}
if ((!bVar3) && (cVar4 = is_addrtype_inet(local_118), cVar4 != '\x01')) {
fprintf(stderr, "geneve: remote link partner not specified\n");
uVar7 = 0xffffffff;
goto LAB_00101067;
}
}
addattr32(param_4, 0x400, 1, local_134);
cVar4 = is_addrtype_inet();
if (cVar4 != '\0') {
if (local_112 == 2) {
local_124 = 2;
} else {
local_124 = 7;
}
addattr_l(param_4, 0x400, local_124, local_110, local_116);
}
if ((!bVar3) || ((local_120 & 0x800) != 0)) {
addattr32(param_4, 0x400, 0xb, local_12c);
}
if ((!bVar3) || ((local_120 & 8) != 0)) {
addattr8(param_4, 0x400, 3, local_13e);
}
if ((!bVar3) || ((local_120 & 0x10) != 0)) {
addattr8(param_4, 0x400, 4, local_13d);
}
if (local_136 != 0) {
uVar5 = htons(local_136);
addattr16(param_4, 0x400, 5, uVar5);
}
if (bVar1) {
addattr(param_4, 0x400, 6);
}
if (bVar2) {
addattr(param_4, 0x400, 0xe);
}
if ((local_120 & 0x100) != 0) {
addattr8(param_4, 0x400, 8, local_13b);
}
if ((local_120 & 0x200) != 0) {
addattr8(param_4, 0x400, 9, local_13a);
}
if ((local_120 & 0x400) != 0) {
addattr8(param_4, 0x400, 10, local_139);
}
uVar7 = 0;
LAB_00101067:
if (local_10 == *(long *)(in_FS_OFFSET + 0x28)) {
return uVar7;
}
__stack_chk_fail();
} | iproute2-6.0.0 | ghidra |
static _Bool
parse_path(const struct parser_table *entry, char **argv, int *arg_ptr) {
return insert_path_check(entry, argv, arg_ptr, "path", pred_path);
} | void parse_path(undefined8 param_1, undefined8 param_2, undefined8 param_3)
{
insert_path_check(param_1, param_2, param_3, &DAT_00105c9c,
uRam0000000000102c9c);
return;
} | findutils | ghidra |
WORD_DESC *make_bare_word(string) const char *string;
{
WORD_DESC *temp;
temp = alloc_word_desc();
if (*string)
temp->word = (char *)strcpy(
sh_xmalloc((1 + strlen(string)), "make_cmd.c", 91), (string));
else {
temp->word = (char *)sh_xmalloc((1), "make_cmd.c", 94);
temp->word[0] = '\0';
}
return (temp);
} | int make_bare_word(char *a0) {
char **v0;
v0 = alloc_word_desc();
if (!*(a0)) {
*(v0) = sh_xmalloc(0x1, "make_cmd.c", 0x5e);
*(*(v0)) = 0;
} else {
*(v0) = strcpy(sh_xmalloc(strlen(a0) + 1, "make_cmd.c", 0x5b), a0);
}
return v0;
} | bash | angr_phoenix |
void udequote_pathname(pathname) char *pathname;
{
register int i, j;
for (i = j = 0; pathname && pathname[i];) {
if (pathname[i] == '\\')
i++;
pathname[j++] = pathname[i++];
if (pathname[i - 1] == 0)
break;
}
if (pathname)
pathname[j] = '\0';
} | void udequote_pathname(void *a0) {
int tmp_19;
int tmp_36;
void *v1;
void *v2;
unsigned long long v3;
unsigned long long v4;
unsigned long long v5;
v1 = 0;
v2 = 0;
while (a0) {
v3 = *((a0 + v2));
if (!*((a0 + v2)))
break;
if (*((a0 + v2)) && *((a0 + v2)) == 92)
v2 = v2 + 1;
tmp_19 = v2;
v2 += 1;
tmp_36 = v1;
v1 += 1;
*(&v3) = *(tmp_19 + a0);
*(tmp_36 + a0) = v3;
v4 = *((a0 + v2 - 1));
if (!*((a0 + v2 - 1)))
break;
}
if (a0) {
v5 = a0 + v1;
*((a0 + v1)) = 0;
}
return;
} | bash | angr_dream |
int tnl_prl_ioctl(int cmd, const char *name, void *p) {
return tnl_gen_ioctl(cmd, name, p, -1);
} | long long tnl_prl_ioctl(unsigned long a0, unsigned long long a1,
unsigned int a2) {
return tnl_gen_ioctl(a0, a1, a2, 0xffffffff);
} | iproute2-6.0.0 | angr_dream |
void rl_set_screen_size(int rows, int cols) {
char buf[64];
(void)snprintf(buf, sizeof(buf), "%d", rows);
el_set(e, 6, "li", buf, ((void *)0));
(void)snprintf(buf, sizeof(buf), "%d", cols);
el_set(e, 6, "co", buf, ((void *)0));
} | long long rl_set_screen_size(unsigned long a0, unsigned long a1) {
char v0;
snprintf(&v0, 0x40, "%d", a0);
el_set(e, 0x6, "li");
snprintf(&v0, 0x40, "%d", a1);
el_set(e, 0x6, "co");
return 0;
} | libedit | angr_sailr |
static void scan_entries(size_t n, const STRUCT_UTMP *utmp_buf) {
char *ttyname_b;
time_t boottime = ((time_t)~(
(time_t)(!(!((time_t)0 < (time_t)-1))
? (time_t)-1
: ((((time_t)1 << ((sizeof(time_t) * 8) - 2)) - 1) * 2 +
1))));
if (include_heading)
print_heading();
if (my_line_only) {
ttyname_b = ttyname(0);
if (!ttyname_b)
return;
if (strncmp(ttyname_b,
""
"/dev/"
"",
sizeof("/dev/") - 1) == 0)
ttyname_b += (sizeof("/dev/") - 1);
}
while (n--) {
if (!my_line_only || (strncmp(ttyname_b, utmp_buf->ut_line,
sizeof(utmp_buf->ut_line)) == 0)) {
if (need_users && (((utmp_buf)->ut_user)[0] &&
(((utmp_buf)->ut_type == (7)) ||
(0 && ((utmp_buf)->ut_tv.tv_sec) != 0))))
print_user(utmp_buf, boottime);
else if (need_runlevel && ((utmp_buf)->ut_type == (1)))
print_runlevel(utmp_buf);
else if (need_boottime && ((utmp_buf)->ut_type == (2)))
print_boottime(utmp_buf);
else if (need_clockchange && ((utmp_buf)->ut_type == (3)))
print_clockchange(utmp_buf);
else if (need_initspawn && ((utmp_buf)->ut_type == (5)))
print_initspawn(utmp_buf);
else if (need_login && ((utmp_buf)->ut_type == (6)))
print_login(utmp_buf);
else if (need_deadprocs && ((utmp_buf)->ut_type == (8)))
print_deadprocs(utmp_buf);
}
if (((utmp_buf)->ut_type == (2)))
boottime = ((utmp_buf)->ut_tv.tv_sec);
utmp_buf++;
}
} | void scan_entries(unsigned long long a0, void *a1) {
struct_0 *v0;
unsigned long long v1;
char *v2;
unsigned long long v3;
unsigned long long v6;
v1 = a0;
v0 = a1;
v3 = 0x8000000000000000;
if (include_heading)
print_heading();
if (my_line_only) {
v2 = ttyname(0x0);
if (!v2)
goto LABEL_4015bf;
if (!strncmp(v2, "/dev/", 0x5))
v2 += 5;
}
while (true) {
v6 = v1;
v1 -= 1;
if (!v6)
break;
if (!(my_line_only ^ 1) && !(!strncmp(v2, &v0->padding_2[6], 0x20)))
goto LABEL_401582;
if (need_users && v0->field_2c && v0->field_0 == 7) {
print_user(v0, v3);
goto LABEL_401582;
}
if (need_runlevel && v0->field_0 == 1) {
print_runlevel(v0);
goto LABEL_401582;
}
if (need_boottime && v0->field_0 == 2) {
print_boottime(v0);
goto LABEL_401582;
}
if (need_clockchange && v0->field_0 == 3) {
print_clockchange(v0);
goto LABEL_401582;
}
if (need_initspawn && v0->field_0 == 5) {
print_initspawn(v0);
goto LABEL_401582;
}
if (need_login && v0->field_0 == 6) {
print_login(v0);
goto LABEL_401582;
}
if (need_deadprocs && v0->field_0 == 8)
print_deadprocs(v0);
LABEL_401582:
if (v0->field_0 == 2)
v3 = v0->field_154;
v0 = &v0[1].padding_2[38];
}
LABEL_4015bf:
return;
} | coreutils | angr_phoenix |
tty_bind_char(EditLine *el, int force) {
unsigned char *t_n = el->el_tty.t_c[1];
unsigned char *t_o = el->el_tty.t_ed.c_cc;
wchar_t new[2], old[2];
const ttymap_t *tp;
el_action_t *map, *alt;
const el_action_t *dmap, *dalt;
new[1] = old[1] = '\0';
map = el->el_map.key;
alt = el->el_map.alt;
if (el->el_map.type == 1) {
dmap = el->el_map.vii;
dalt = el->el_map.vic;
} else {
dmap = el->el_map.emacs;
dalt = ((void *)0);
}
for (tp = tty_map; tp->nch != (wint_t)-1; tp++) {
new[0] = (wchar_t)t_n[tp->nch];
old[0] = (wchar_t)t_o[tp->och];
if (new[0] == old[0] && !force)
continue;
keymacro_clear(el, map, old);
map[(unsigned char)old[0]] = dmap[(unsigned char)old[0]];
keymacro_clear(el, map, new);
map[(unsigned char)new[0]] = tp->bind[el->el_map.type];
if (dalt) {
keymacro_clear(el, alt, old);
alt[(unsigned char)old[0]] = dalt[(unsigned char)old[0]];
keymacro_clear(el, alt, new);
alt[(unsigned char)new[0]] = tp->bind[el->el_map.type + 1];
}
}
} | void tty_bind_char(struct_0 *a0, unsigned long a1) {
unsigned long long v0;
char *v1;
void *v2;
char *v3;
char *v4;
char *v5;
char *v6;
unsigned int v7;
unsigned int v8;
unsigned int v9;
unsigned int v10;
char v11;
unsigned long long *v13;
unsigned long long v14;
v3 = &a0->padding_0[473];
v4 = &a0->padding_0[661];
v10 = 0;
v8 = v10;
v5 = a0->field_3f8;
v6 = a0->field_3f0;
if (a0->field_420 == 1) {
v1 = a0->field_418;
v2 = a0->field_410;
} else {
v1 = a0->field_408;
v2 = 0;
}
for (v0 = &tty_map; *(v0) != -1; v0 += 12) {
v7 = v3[*(v0)];
v9 = v4[*((v0 + 4))];
if (a1 || v7 != v9) {
keymacro_clear(a0, v5, &v9, v5);
v5[v9] = v1[v9];
keymacro_clear(a0, v5, &v7, v5);
v5[v7] = *((v0 + a0->field_420 + 8));
if (v2) {
keymacro_clear(a0, v6, &v9, v6);
v6[v9] = *(v2 + v9);
keymacro_clear(a0, v6, &v7, v6);
v6[v7] = *((v0 + a0->field_420 + 1 + 8));
}
}
}
v14 = *(&v11) ^ v13[5];
return;
} | libedit | angr_dream |
static wint_t **terminal_alloc_buffer(EditLine *el) {
wint_t **b;
coord_t *c = &el->el_terminal.t_size;
int i;
b = calloc((size_t)(c->v + 1), sizeof(*b));
if (b == ((void *)0))
return ((void *)0);
for (i = 0; i < c->v; i++) {
b[i] = calloc((size_t)(c->h + 1), sizeof(**b));
if (b[i] == ((void *)0)) {
while (--i >= 0)
free(b[i]);
free(b);
return ((void *)0);
}
}
b[c->v] = ((void *)0);
return b;
} | int terminal_alloc_buffer(unsigned long a0) {
unsigned int v0;
unsigned int v1[2];
unsigned long long *v2;
unsigned int v4;
*(&v1[0]) = a0 + 144;
v2 = calloc(v1[1] + 1, 0x8);
if (!v2) {
v4 = 0;
return v4;
}
for (v0 = 0; v0 < v1[1]; v0 += 1) {
v2[v0] = calloc(v1[0] + 1, 0x4);
if (!v2[v0]) {
while (true) {
v0 -= 1;
if (v0 < 0)
break;
free(v2[v0]);
}
free(v2);
v4 = 0;
return v4;
}
}
v2[v1[1]] = 0;
v4 = v2;
return v4;
} | libedit | angr_sailr |
static gnutls_x509_trust_list_t load_tl(common_info_st *cinfo) {
gnutls_x509_trust_list_t list;
int ret;
ret = gnutls_x509_trust_list_init(&list, 0);
if (ret < 0) {
fprintf(stderr, "gnutls_x509_trust_list_init: %s\n", gnutls_strerror(ret));
app_exit(1);
}
if (cinfo->ca == ((void *)0)) {
ret = gnutls_x509_trust_list_add_system_trust(list, 0, 0);
if (ret < 0) {
fprintf(stderr, "Error loading system trust: %s\n", gnutls_strerror(ret));
app_exit(1);
}
fprintf(stderr, "Loaded system trust (%d CAs available)\n", ret);
} else if (cinfo->ca != ((void *)0)) {
ret = gnutls_x509_trust_list_add_trust_file(list, cinfo->ca, cinfo->crl,
cinfo->incert_format, 0, 0);
if (ret < 0) {
int ret2 = gnutls_x509_trust_list_add_trust_file(
list, cinfo->ca, cinfo->crl, GNUTLS_X509_FMT_PEM, 0, 0);
if (ret2 >= 0)
ret = ret2;
}
if (ret < 0) {
fprintf(stderr, "gnutls_x509_trust_add_trust_file: %s\n",
gnutls_strerror(ret));
app_exit(1);
}
fprintf(stderr, "Loaded CAs (%d available)\n", ret);
}
return list;
} | int load_tl(struct_0 *a0) {
unsigned int v0;
unsigned int v1;
char v2;
v0 = gnutls_x509_trust_list_init(&v2, 0x0);
if (v0 < 0) {
fprintf(*(&stderr), "gnutls_x509_trust_list_init: %s\n",
gnutls_strerror(v0));
app_exit(0x1);
}
if (!a0->field_40) {
v0 = gnutls_x509_trust_list_add_system_trust(*(&v2), 0x0, 0x0);
if (v0 < 0) {
fprintf(*(&stderr), "Error loading system trust: %s\n",
gnutls_strerror(v0));
app_exit(0x1);
}
fprintf(*(&stderr), "Loaded system trust (%d CAs available)\n", v0);
} else if (a0->field_40) {
v0 = gnutls_x509_trust_list_add_trust_file(
*(&v2), a0->field_40, a0->field_38, a0->field_1c, 0x0, 0x0);
if (v0 < 0) {
v1 = gnutls_x509_trust_list_add_trust_file(*(&v2), a0->field_40,
a0->field_38, 0x1, 0x0, 0x0);
if (v1 >= 0)
v0 = v1;
}
if (v0 < 0) {
fprintf(*(&stderr), "gnutls_x509_trust_add_trust_file: %s\n",
gnutls_strerror(v0));
app_exit(0x1);
}
fprintf(*(&stderr), "Loaded CAs (%d available)\n", v0);
}
if (!a0->field_40 && v0 >= 0 || !a0->field_40 && a0->field_40 ||
a0->field_40 && v0 >= 0)
return *(&v2);
} | gnutls | angr_dream |
static inline void emit_mandatory_arg_note(void) {
fputs_unlocked(gettext("\nMandatory arguments to long options are mandatory "
"for short options too.\n"),
stdout)
;
} | void emit_mandatory_arg_note() {
unsigned long long v1;
v1 = fputs_unlocked(gettext("\nMandatory arguments to long options are "
"mandatory for short options too.\n"),
stdout);
return;
} | coreutils | angr_sailr |
int rl_vi_insertion_mode(int count, int key) {
_rl_keymap = vi_insertion_keymap;
_rl_vi_last_key_before_insert = key;
if (_rl_show_mode_in_prompt)
_rl_reset_prompt();
return (0);
} | long rl_vi_insertion_mode(long a1, int a2) {
rl_keymap = &vi_insertion_keymap;
rl_vi_last_key_before_insert = a2;
if (rl_show_mode_in_prompt)
rl_reset_prompt();
return 0LL;
} | bash | ida |
static void enqueue_pending(void) {
struct pkg_hash_iter *iter;
struct pkginfo *pkg;
iter = pkg_hash_iter_new();
while ((pkg = pkg_hash_iter_next_pkg(iter)) != ((void *)0)) {
switch (cipaction->arg_int) {
case act_configure:
if (!(pkg->status == PKG_STAT_UNPACKED ||
pkg->status == PKG_STAT_HALFCONFIGURED || pkg->trigpend_head))
continue;
if (pkg->want != PKG_WANT_INSTALL && pkg->want != PKG_WANT_HOLD)
continue;
break;
case act_triggers:
if (!pkg->trigpend_head)
continue;
if (pkg->want != PKG_WANT_INSTALL && pkg->want != PKG_WANT_HOLD)
continue;
break;
case act_remove:
case act_purge:
if (pkg->want != PKG_WANT_PURGE) {
if (pkg->want != PKG_WANT_DEINSTALL)
continue;
if (pkg->status == PKG_STAT_CONFIGFILES)
continue;
}
if (pkg->status == PKG_STAT_NOTINSTALLED)
continue;
break;
default:
do_internerr("packages.c", 109, __func__, "unknown action '%d'",
cipaction->arg_int);
}
enqueue_package(pkg);
}
pkg_hash_iter_free(iter);
} | void enqueue_pending() {
unsigned long long v0;
struct_0 *v1;
unsigned long long v3;
v0 = pkg_hash_iter_new();
while (true) {
while (true) {
v1 = pkg_hash_iter_next_pkg(v0);
if (v1) {
if (*((cipaction + 40)) <= 6) {
if (*((cipaction + 40)) < 5) {
if (*((cipaction + 40)) == 2) {
if (v1->field_18 != 3 && v1->field_18 == 4)
continue;
if (v1->field_10 == 1)
continue;
}
if (*((cipaction + 40)) == 4) {
if (!v1->field_160)
continue;
if (v1->field_10 == 1)
break;
if (v1->field_10 != 1) {
if (v1->field_10 == 2)
break;
}
}
} else {
if (v1->field_10 != 4) {
if (v1->field_10 != 3)
continue;
continue;
}
continue;
}
}
if (*((cipaction + 40)) > 6 || *((cipaction + 40)) < 5 &&
*((cipaction + 40)) != 4 &&
*((cipaction + 40)) != 2)
do_internerr("packages.c", 0x6d, "enqueue_pending",
"unknown action '%d'", *((cipaction + 40)));
if (*((cipaction + 40)) != 4)
enqueue_package(v1);
} else {
v3 = pkg_hash_iter_free(v0);
return;
}
}
}
} | dpkg | angr_dream |
int typecmd(int argc, char **argv) {
int i;
int err = 0;
for (i = 1; i < argc; i++) {
err |= describe_command(out1, argv[i], ((void *)0), 1);
}
return err;
} | long typecmd(int a1, long a2) {
int i;
unsigned int v4;
v4 = 0;
for (i = 1; i < a1; ++i)
v4 |= describe_command(out1, *(char **)(8LL * i + a2), 0LL, 1);
return v4;
} | dash-0.5.11+git20210903+057cd650a4ed | ida |
_Bool
pred_inum (const char *pathname, struct stat *stat_buf, struct predicate *pred_ptr)
{
(void)pathname;
switch (pred_ptr->args.numinfo.kind) {
case COMP_GT:
if (stat_buf->st_ino > pred_ptr->args.numinfo.l_val)
return (1);
break;
case COMP_LT:
if (stat_buf->st_ino < pred_ptr->args.numinfo.l_val)
return (1);
break;
case COMP_EQ:
if (stat_buf->st_ino == pred_ptr->args.numinfo.l_val)
return (1);
break;
}
return (0);
} | long long pred_inum(unsigned long a0, struct_0 *a1, struct_1 *a2) {
unsigned long v0;
unsigned long long v2;
v0 = a0;
if (a2->field_38 != 2) {
if (a2->field_38 <= 2) {
if (!a2->field_38) {
if (a1->field_8 > a2->field_40) {
v2 = 1;
goto LABEL_400d0c;
}
} else {
if (a2->field_38 == 1 && a1->field_8 < a2->field_40) {
v2 = 1;
goto LABEL_400d0c;
}
}
}
} else {
if (a1->field_8 == a2->field_40) {
v2 = 1;
goto LABEL_400d0c;
}
}
v2 = 0;
LABEL_400d0c:
return v2;
} | findutils | angr_phoenix |
const char *get_confirmed_pass(_Bool empty_ok) {
if (batch && !ask_pass)
return cfg.password;
else {
const char *pass = ((void *)0);
char *copy = ((void *)0);
do {
if (pass)
fprintf(stderr, "Password mismatch, try again.\n");
free(copy);
pass = getpass("Enter password: ");
copy = strdup(pass);
if (copy == ((void *)0)) {
fprintf(stderr, "memory error\n");
exit(1);
};
pass = getpass("Confirm password: ");
} while (strcmp(pass, copy) != 0 && !(empty_ok && *pass == '\0'));
free(copy);
return pass;
}
} | long long get_confirmed_pass(unsigned long a0) {
void *v0;
void *v1;
void *v3;
if (*(got.batch) && !*(got.ask_pass)) {
v3 = *((got.cfg + 464));
goto LABEL_404cc2;
}
v0 = 0;
v1 = 0;
while (true) {
if (v0)
fprintf(*(got.stderr), "Password mismatch, try again.\n");
free(v1);
v0 = getpass("Enter password: ");
v1 = strdup(v0);
if (!v1) {
fprintf(*(got.stderr), "memory error\n");
exit(0x1);
}
v0 = getpass("Confirm password: ");
if (!strcmp(v0, v1))
break;
if (!(!(a0 ^ 1)))
continue;
if (!*(v0))
break;
}
free(v1);
v3 = v0;
LABEL_404cc2:
return v3;
} | gnutls | angr_phoenix |
int auth2_methods_valid(const char *_methods, int need_enable) {
char *methods, *omethods, *method, *p;
u_int i, found;
int ret = -1;
if (*_methods == '\0') {
sshlog("auth2.c", __func__, 561, 0, SYSLOG_LEVEL_ERROR, ((void *)0),
"empty authentication method list");
return -1;
}
omethods = methods = xstrdup(_methods);
while ((method = strsep(&methods, ",")) != ((void *)0)) {
for (found = i = 0; !found && authmethods[i] != ((void *)0); i++) {
if ((p = strchr(method, ':')) != ((void *)0))
*p = '\0';
if (strcmp(method, authmethods[i]->name) != 0)
continue;
if (need_enable) {
if (authmethods[i]->enabled == ((void *)0) ||
*(authmethods[i]->enabled) == 0) {
sshlog("auth2.c", __func__, 574, 0, SYSLOG_LEVEL_ERROR, ((void *)0),
"Disabled method \"%s\" in "
"AuthenticationMethods list \"%s\"",
method, _methods)
;
goto out;
}
}
found = 1;
break;
}
if (!found) {
sshlog("auth2.c", __func__, 584, 0, SYSLOG_LEVEL_ERROR, ((void *)0),
"Unknown authentication method \"%s\" in list", method);
goto out;
}
}
ret = 0;
out:
free(omethods);
return ret;
} | long auth2_methods_valid(const char *a1, int a2) {
unsigned int v3;
int v4;
unsigned int v5;
char *stringp;
void *ptr;
char *s;
char *v9;
unsigned long v10;
v10 = __readfsqword(0x28u);
v5 = -1;
if (*a1) {
stringp = (char *)xstrdup(a1);
ptr = stringp;
while (1) {
s = strsep(&stringp, ",");
if (!s)
break;
v3 = 0;
v4 = 0;
while (*(&authmethods + v3)) {
v9 = strchr(s, 58);
if (v9)
*v9 = 0;
if (!strcmp(s, *(const char **)*(&authmethods + v3))) {
if (a2 && (!*((_QWORD *)*(&authmethods + v3) + 3) ||
!**((_DWORD **)*(&authmethods + v3) + 3))) {
sshlog(
"auth2.c", "auth2_methods_valid", 574LL, 0LL, 2LL, 0LL,
"Disabled method \"%s\" in AuthenticationMethods list \"%s\"",
s, a1);
goto LABEL_19;
}
v4 = 1;
break;
}
++v3;
}
if (!v4) {
sshlog("auth2.c", "auth2_methods_valid", 584LL, 0LL, 2LL, 0LL,
"Unknown authentication method \"%s\" in list", s);
goto LABEL_19;
}
}
v5 = 0;
LABEL_19:
free(ptr);
return v5;
} else {
sshlog("auth2.c", "auth2_methods_valid", 561LL, 0LL, 2LL, 0LL,
"empty authentication method list");
return 0xFFFFFFFFLL;
}
} | openssh-portable | ida |
stderr
, gettext("Configuration file '%s' (actually '%s')\n"),
cfgfile, realold);
if (what & CFOF_IS_NEW) {
fprintf(
stderr,
gettext(" ==> File on system created by you or by a script.\n"
" ==> File also in package provided by package "
"maintainer.\n"));
} else { | void gettext(void)
{
halt_baddata();
} | dpkg | ghidra |
int parse_jump(const char *s, Options *o, int active) {
char *orig, *sdup, *cp;
char *host = ((void *)0), *user = ((void *)0);
int r, ret = -1, port = -1, first;
active &= o->proxy_command == ((void *)0) && o->jump_host == ((void *)0);
orig = sdup = xstrdup(s);
if ((cp = strchr(orig, '#')) != ((void *)0))
*cp = '\0';
rtrim(orig);
first = active;
do {
if (strcasecmp(s, "none") == 0)
break;
if ((cp = strrchr(sdup, ',')) == ((void *)0))
cp = sdup;
else
*cp++ = '\0';
if (first) {
r = parse_ssh_uri(cp, &user, &host, &port);
if (r == -1 ||
(r == 1 && parse_user_host_port(cp, &user, &host, &port) != 0))
goto out;
} else {
r = parse_ssh_uri(cp, ((void *)0), ((void *)0), ((void *)0));
if (r == -1 ||
(r == 1 && parse_user_host_port(cp, ((void *)0), ((void *)0),
((void *)0)) != 0))
goto out;
}
first = 0;
} while (cp != sdup);
if (active) {
if (strcasecmp(s, "none") == 0) {
o->jump_host = xstrdup("none");
o->jump_port = 0;
} else {
o->jump_user = user;
o->jump_host = host;
o->jump_port = port;
o->proxy_command = xstrdup("none");
user = host = ((void *)0);
if ((cp = strrchr(s, ',')) != ((void *)0) && cp != s) {
o->jump_extra = xstrdup(s);
o->jump_extra[cp - s] = '\0';
}
}
}
ret = 0;
out:
free(orig);
free(user);
free(host);
return ret;
} | undefined4 parse_jump(char *param_1, long param_2, uint param_3)
{
long lVar1;
uint uVar2;
int iVar3;
char *pcVar4;
undefined8 uVar5;
long lVar6;
long in_FS_OFFSET;
undefined4 local_58;
undefined4 local_54;
uint local_50;
int local_4c;
void *local_48;
void *local_40;
char *local_38;
char *local_30;
char *local_28;
long local_20;
local_20 = *(long *)(in_FS_OFFSET + 0x28);
local_48 = (void *)0x0;
local_40 = (void *)0x0;
local_54 = 0xffffffff;
local_58 = 0xffffffff;
if ((*(long *)(param_2 + 0xd8) == 0) && (*(long *)(param_2 + 0x16f8) == 0)) {
uVar2 = 1;
} else {
uVar2 = 0;
}
local_30 = (char *)xstrdup(param_1);
local_28 = local_30;
local_38 = strchr(local_30, 0x23);
if (local_38 != (char *)0x0) {
*local_38 = '\0';
}
rtrim(local_28);
local_50 = param_3 & uVar2;
do {
iVar3 = strcasecmp(param_1, "none");
if (iVar3 == 0)
break;
pcVar4 = strrchr(local_30, 0x2c);
if (pcVar4 == (char *)0x0) {
local_38 = local_30;
} else {
local_38 = pcVar4 + 1;
*pcVar4 = '\0';
}
if (local_50 == 0) {
local_4c = parse_ssh_uri(local_38, 0, 0, 0);
if (local_4c == -1)
goto LAB_00109540;
if (local_4c == 1) {
iVar3 = parse_user_host_port(local_38, 0, 0, 0);
goto joined_r0x0010941d;
}
} else {
local_4c = parse_ssh_uri(local_38, &local_40, &local_48, &local_58);
if (local_4c == -1)
goto LAB_00109540;
if (local_4c == 1) {
iVar3 = parse_user_host_port(local_38, &local_40, &local_48, &local_58);
joined_r0x0010941d:
if (iVar3 != 0)
goto LAB_00109540;
}
}
local_50 = 0;
} while (local_38 != local_30);
if ((param_3 & uVar2) != 0) {
iVar3 = strcasecmp(param_1, "none");
if (iVar3 == 0) {
uVar5 = xstrdup(&DAT_0010b811);
*(undefined8 *)(param_2 + 0x16f8) = uVar5;
*(undefined4 *)(param_2 + 0x1700) = 0;
} else {
*(void **)(param_2 + 0x16f0) = local_40;
*(void **)(param_2 + 0x16f8) = local_48;
*(undefined4 *)(param_2 + 0x1700) = local_58;
uVar5 = xstrdup(&DAT_0010b811);
*(undefined8 *)(param_2 + 0xd8) = uVar5;
local_48 = (void *)0x0;
local_40 = (void *)0x0;
local_38 = strrchr(param_1, 0x2c);
if ((local_38 != (char *)0x0) && (local_38 != param_1)) {
uVar5 = xstrdup(param_1);
*(undefined8 *)(param_2 + 0x1708) = uVar5;
lVar1 = *(long *)(param_2 + 0x1708);
lVar6 = __subvdi3(local_38, param_1);
*(undefined *)(lVar6 + lVar1) = 0;
}
}
}
local_54 = 0;
LAB_00109540:
free(local_28);
free(local_40);
free(local_48);
if (local_20 != *(long *)(in_FS_OFFSET + 0x28)) {
__stack_chk_fail();
}
return local_54;
} | openssh-portable | ghidra |
int array_shift_element(a, v)
ARRAY *a;
char *v;
{
return (array_rshift(a, 1, v));
} | long long array_shift_element(void *a0, char *a1) {
return array_rshift(a0, 0x1, a1);
} | bash | angr_phoenix |
char *named_function_string(name, command, flags)
char *name;
COMMAND *command;
int flags;
{
char *result;
int old_indent, old_amount;
COMMAND *cmdcopy;
REDIRECT *func_redirects;
old_indent = indentation;
old_amount = indentation_amount;
command_string_index = was_heredoc = 0;
deferred_heredocs = 0;
printing_comsub = 0;
if (name && *name) {
if (find_reserved_word(name) >= 0)
cprintf("function ");
cprintf("%s ", name);
}
cprintf("() ");
if ((flags & 0x01) == 0) {
indentation = 1;
indentation_amount = 0;
} else {
cprintf("\n");
indentation += indentation_amount;
}
inside_function_def++;
cprintf((flags & 0x01) ? "{ \n" : "{ ");
cmdcopy = copy_command(command);
func_redirects = (REDIRECT *)((void *)0);
if (cmdcopy->type == cm_group) {
func_redirects = cmdcopy->redirects;
cmdcopy->redirects = (REDIRECT *)((void *)0);
}
make_command_string_internal(
cmdcopy->type == cm_group ? cmdcopy->value.Group->command : cmdcopy);
do {
if (deferred_heredocs)
print_deferred_heredocs("");
} while (0);
indentation = old_indent;
indentation_amount = old_amount;
inside_function_def--;
if (func_redirects) {
newline("} ");
print_redirection_list(func_redirects);
cmdcopy->redirects = func_redirects;
} else
newline("}");
result = the_printed_command;
if ((flags & 0x01) == 0) {
if (result[2] == '\n')
memmove(result + 2, result + 3, strlen(result) - 2);
}
dispose_command(cmdcopy);
if (flags & 0x02)
result = remove_quoted_escapes(result);
return (result);
} | char *named_function_string(char *param_1, undefined8 param_2, uint param_3)
{
int iVar1;
char *pcVar2;
int iVar3;
int iVar4;
undefined *puVar5;
int *piVar6;
int *piVar7;
size_t sVar8;
char *local_20;
long local_18;
iVar3 = indentation;
iVar1 = indentation_amount;
was_heredoc = 0;
command_string_index = 0;
deferred_heredocs = 0;
printing_comsub = 0;
if ((param_1 != (char *)0x0) && (*param_1 != '\0')) {
iVar4 = find_reserved_word(param_1);
if (-1 < iVar4) {
cprintf("function ");
}
cprintf(&DAT_00103733, param_1);
}
cprintf(&DAT_001038ce);
if ((param_3 & 1) == 0) {
indentation = 1;
indentation_amount = 0;
} else {
cprintf(&DAT_0010359f);
indentation = indentation_amount + indentation;
}
inside_function_def = inside_function_def + 1;
if ((param_3 & 1) == 0) {
puVar5 = &DAT_001036f4;
} else {
puVar5 = &DAT_001038bd;
}
cprintf(puVar5);
piVar6 = (int *)copy_command(param_2);
local_18 = 0;
if (*piVar6 == 9) {
local_18 = *(long *)(piVar6 + 4);
*(undefined8 *)(piVar6 + 4) = 0;
}
piVar7 = piVar6;
if (*piVar6 == 9) {
piVar7 = *(int **)(*(long *)(piVar6 + 6) + 8);
}
make_command_string_internal(piVar7);
if (deferred_heredocs != 0) {
print_deferred_heredocs(&DAT_00103583);
}
inside_function_def = inside_function_def + -1;
indentation_amount = iVar1;
indentation = iVar3;
if (local_18 == 0) {
newline(&DAT_001036f7);
} else {
newline(&DAT_001038c1);
print_redirection_list(local_18);
*(long *)(piVar6 + 4) = local_18;
}
pcVar2 = the_printed_command;
local_20 = the_printed_command;
if (((param_3 & 1) == 0) && (the_printed_command[2] == '\n')) {
sVar8 = strlen(the_printed_command);
memmove(pcVar2 + 2, pcVar2 + 3, sVar8 - 2);
}
dispose_command(piVar6);
if ((param_3 & 2) != 0) {
local_20 = (char *)remove_quoted_escapes(pcVar2);
}
return local_20;
} | bash | ghidra |
static void process_mkdir(u_int32_t id) {
Attrib a;
char *name;
int r, mode, status = 4;
if ((r = sshbuf_get_cstring(iqueue, &name, ((void *)0))) != 0 ||
(r = decode_attrib(iqueue, &a)) != 0)
sshfatal("sftp-server.c", __func__, 1211, 1, SYSLOG_LEVEL_FATAL, ssh_err(r),
"parse");
mode = (a.flags & 0x00000004) ? a.perm & 07777 : 0777;
sshlog("sftp-server.c", __func__, 1215, 0, SYSLOG_LEVEL_DEBUG3, ((void *)0),
"request %u: mkdir", id);
sshlog("sftp-server.c", __func__, 1216, 0, SYSLOG_LEVEL_INFO, ((void *)0),
"mkdir name \"%s\" mode 0%o", name, mode);
r = mkdir(name, mode);
status = (r == -1) ? errno_to_portable((*__errno_location())) : 0;
send_status(id, status);
free(name);
} | long long process_mkdir(unsigned long a0) {
unsigned long long v0;
unsigned int v1;
unsigned int v2;
unsigned int v3;
char v4;
char v5;
char v6;
unsigned long long v7;
unsigned long long v8;
unsigned long v9;
unsigned int v12;
v2 = 4;
v1 = sshbuf_get_cstring(0xe87d894820ec8348, &v4, 0x0, &v4);
if (v1 || (v1 = decode_attrib(0xe87d894820ec8348, &v5, &v5), v1)) {
v0 = "parse";
sshfatal("sftp-server.c", "process_mkdir", 0x4bb, 0x1, 0x1, ssh_err(v1));
}
v3 = (!(*(&v5) & 4) ? *(&v6) & 4095 : 511);
v8 = a0;
v7 = "request %u: mkdir";
sshlog("sftp-server.c", "process_mkdir", 0x4bf, 0x0, 0x7, 0x0, *(&v9));
v9 = v3;
v8 = *(&v4);
v7 = "mkdir name \"%s\" mode 0%o";
sshlog("sftp-server.c", "process_mkdir", 0x4c0, 0x0, 0x3, 0x0, v3);
v1 = mkdir(*(&v4), v3);
if (v1 != -1)
v12 = 0;
else
v12 = errno_to_portable(*(__errno_location()));
v2 = v12;
send_status(a0, v2);
free(*(&v4));
return 0;
} | openssh-portable | angr_sailr |
void *sh_calloc(n, s, file, line)
size_t n, s;
const char *file;
int line;
{
return internal_calloc(n, s, file, line, 0x01);
} | long long sh_calloc(unsigned int a0, unsigned long a1, unsigned long long a2,
unsigned long a3) {
return internal_calloc(a0, a1, a2, a3, 0x1);
} | bash | angr_sailr |
static void perror_with_exit(char const *string) {
((!!sizeof(struct {
_Static_assert(
2, "verify_expr ("
"2"
", "
"(error (2, (*__errno_location ()), \"%s\", string), assume (false))"
")");
int _gl_dummy;
}))
? ((error(2, (*__errno_location()), "%s", string),
((0) ? (void)0 : __builtin_unreachable())))
: ((error(2, (*__errno_location()), "%s", string),
((0) ? (void)0 : __builtin_unreachable()))));
} | void perror_with_exit(const char *a1) {
int *v1;
v1 = _errno_location();
error(2, *v1, "%s", a1);
JUMPOUT(0x3455LL);
} | diffutils | ida |
void ssh_packet_send_debug(struct ssh *ssh, const char *fmt, ...) {
char buf[1024];
va_list args;
int r;
if ((ssh->compat & 0x00000040))
return;
__builtin_va_start(args, fmt);
vsnprintf(buf, sizeof(buf), fmt, args);
__builtin_va_end(args);
sshlog("packet.c", __func__, 1840, 0, SYSLOG_LEVEL_DEBUG3, ((void *)0),
"sending debug message: %s", buf);
if ((r = sshpkt_start(ssh, 4)) != 0 || (r = sshpkt_put_u8(ssh, 0)) != 0 ||
(r = sshpkt_put_cstring(ssh, buf)) != 0 ||
(r = sshpkt_put_cstring(ssh, "")) != 0 || (r = sshpkt_send(ssh)) != 0 ||
(r = ssh_packet_write_wait(ssh)) != 0)
sshfatal("packet.c", __func__, 1848, 1, SYSLOG_LEVEL_FATAL, ssh_err(r),
"send DEBUG");
} | long long ssh_packet_send_debug() {
unsigned long long v0;
unsigned long v1;
unsigned int v2;
unsigned int v3;
unsigned int v4;
unsigned long v5;
unsigned long v6;
char v7;
unsigned long v8;
char v9;
unsigned long v10;
unsigned long v11;
unsigned long v12;
unsigned long v13;
int v14;
int v15;
int v16;
int v17;
int v18;
int v19;
int v20;
int v21;
unsigned long v22;
unsigned long v23;
unsigned long v24;
unsigned long v25;
unsigned long v26;
char v27;
int v28;
int v29;
int v30;
int v31;
int v32;
int v33;
int v34;
int v35;
unsigned long long *v36;
struct_0 *v37;
char *v38;
v10 = v23;
v11 = v24;
v12 = v25;
v13 = v26;
if (v27) {
v14 = v28;
v15 = v29;
v16 = v30;
v17 = v31;
v18 = v32;
v19 = v33;
v20 = v34;
v21 = v35;
}
v8 = v36[5];
if (!(v37->field_83c & 64)) {
v3 = 16;
v4 = 48;
v5 = &v22;
v6 = &v9;
vsnprintf(&v7, 0x400, v38, &v3);
v1 = &v7;
v0 = "sending debug message: %s";
sshlog("packet.c", "ssh_packet_send_debug", 0x730, 0x0, 0x7, 0x0);
v2 = sshpkt_start(v37, 0x4);
if (!v2) {
v2 = sshpkt_put_u8(v37, 0x0);
if (!v2) {
v2 = sshpkt_put_cstring(v37, &v7);
if (!v2) {
v2 = sshpkt_put_cstring(v37, &g_407061);
if (!v2) {
v2 = sshpkt_send(v37, &g_407061, 0x730, 0x0, 0x7, 0x0);
if (!v2)
v2 = ssh_packet_write_wait(v37);
}
}
}
}
if (v2 || v2 || v2 || v2 || v2 || v2) {
v0 = "send DEBUG";
sshfatal("packet.c", "ssh_packet_send_debug", 0x738, 0x1, 0x1,
ssh_err(v2));
}
}
if ((v8 ^ v36[5]))
__stack_chk_fail();
return 0;
} | openssh-portable | angr_dream |
static void fail_exit(int code) {
if (spw_locked) {
if (spw_unlock() == 0) {
fprintf(stderr, gettext("%s: failed to unlock %s\n"), Prog, spw_dbname());
do {
char *old_locale = setlocale(6, ((void *)0));
char *saved_locale = ((void *)0);
if (((void *)0) != old_locale) {
saved_locale = strdup(old_locale);
}
if (((void *)0) != saved_locale) {
(void)setlocale(6, "C");
}
syslog(3, "failed to unlock %s", spw_dbname());
if (((void *)0) != saved_locale) {
(void)setlocale(6, saved_locale);
free(saved_locale);
}
} while (0);
}
}
if (pw_locked) {
if (pw_unlock() == 0) {
fprintf(stderr, gettext("%s: failed to unlock %s\n"), Prog, pw_dbname());
do {
char *old_locale = setlocale(6, ((void *)0));
char *saved_locale = ((void *)0);
if (((void *)0) != old_locale) {
saved_locale = strdup(old_locale);
}
if (((void *)0) != saved_locale) {
(void)setlocale(6, "C");
}
syslog(3, "failed to unlock %s", pw_dbname());
if (((void *)0) != saved_locale) {
(void)setlocale(6, saved_locale);
free(saved_locale);
}
} while (0);
}
}
closelog();
exit(code);
} | void fail_exit(int a1) {
long v1;
long v2;
char *v3;
const char *v4;
long v5;
long v6;
char *v7;
const char *v8;
char *locale;
char *v10;
const char *s;
const char *v12;
if (spw_locked && !(unsigned int)spw_unlock()) {
v1 = spw_dbname();
v2 = Prog;
v3 = gettext("%s: failed to unlock %s\n");
fprintf(stderr, v3, v2, v1);
s = setlocale(6, 0LL);
locale = 0LL;
if (s)
locale = strdup(s);
if (locale)
setlocale(6, "C");
v4 = (const char *)spw_dbname();
syslog(3, "failed to unlock %s", v4);
if (locale) {
setlocale(6, locale);
free(locale);
}
}
if (pw_locked && !(unsigned int)pw_unlock()) {
v5 = pw_dbname();
v6 = Prog;
v7 = gettext("%s: failed to unlock %s\n");
fprintf(stderr, v7, v6, v5);
v12 = setlocale(6, 0LL);
v10 = 0LL;
if (v12)
v10 = strdup(v12);
if (v10)
setlocale(6, "C");
v8 = (const char *)pw_dbname();
syslog(3, "failed to unlock %s", v8);
if (v10) {
setlocale(6, v10);
free(v10);
}
}
closelog();
exit(a1);
} | shadow | ida |
void hostfile_create_user_ssh_dir(const char *filename, int notify) {
char *dotsshdir = ((void *)0), *p;
size_t len;
struct stat st;
if ((p = strrchr(filename, '/')) == ((void *)0))
return;
len = p - filename;
dotsshdir = tilde_expand_filename("~/"
".ssh",
getuid());
if (strlen(dotsshdir) > len || strncmp(filename, dotsshdir, len) != 0)
goto out;
if (stat(dotsshdir, &st) == 0)
goto out;
else if ((*__errno_location()) != 2)
sshlog("hostfile.c", __func__, 491, 0, SYSLOG_LEVEL_ERROR, ((void *)0),
"Could not stat %s: %s", dotsshdir, strerror((*__errno_location())));
else {
if (mkdir(dotsshdir, 0700) == -1)
sshlog("hostfile.c", __func__, 497, 0, SYSLOG_LEVEL_ERROR, ((void *)0),
"Could not create directory '%.200s' (%s).", dotsshdir,
strerror((*__errno_location())));
else if (notify)
sshlog("hostfile.c", __func__, 500, 0, SYSLOG_LEVEL_INFO, ((void *)0),
"Created directory '%s'.", dotsshdir);
}
out:
free(dotsshdir);
} | void hostfile_create_user_ssh_dir(char *a0, unsigned long a1) {
unsigned long long v0;
unsigned long v1;
unsigned long v2;
unsigned long v3;
void *v4;
unsigned long long v5;
unsigned int v6;
char v7;
char v8;
unsigned long long *v11;
unsigned long long v12;
v4 = 0;
v5 = strrchr(a0, 0x2f);
if (v5) {
*(&v6) = __subvdi3(v5, a0);
v4 = tilde_expand_filename("~/.ssh", getuid());
if (*(&v6) >= strlen(v4) && !strncmp(a0, v4, *(&v6)) && stat(v4, &v7)) {
if (*(__errno_location()) != 2) {
v2 = strerror(*(__errno_location()));
v1 = v4;
v0 = "Could not stat %s: %s";
sshlog("hostfile.c", "hostfile_create_user_ssh_dir", 0x1eb, 0x0, 0x2,
0x0);
} else if (mkdir(v4, 0x1c0) == -1) {
v2 = strerror(*(__errno_location()));
v1 = v4;
v0 = "Could not create directory '%.200s' (%s).";
sshlog("hostfile.c", "hostfile_create_user_ssh_dir", 0x1f1, 0x0, 0x2,
0x0);
} else if (a1) {
v3 = v4;
v2 = "Created directory '%s'.";
sshlog("hostfile.c", "hostfile_create_user_ssh_dir", 0x1f4, 0x0, 0x3,
0x0);
}
}
free(v4);
}
v12 = *(&v8) ^ v11[5];
return;
} | openssh-portable | angr_phoenix |
static errcode_t try_open_fs(e2fsck_t ctx, int flags, io_manager io_ptr,
ext2_filsys *ret_fs) {
errcode_t retval;
*ret_fs = ((void *)0);
if (ctx->superblock && ctx->blocksize) {
retval = ext2fs_open2(ctx->filesystem_name, ctx->io_options, flags,
ctx->superblock, ctx->blocksize, io_ptr, ret_fs);
} else if (ctx->superblock) {
int blocksize;
for (blocksize = (1 << 10); blocksize <= (1 << 16); blocksize *= 2) {
if (*ret_fs) {
ext2fs_free(*ret_fs);
*ret_fs = ((void *)0);
}
retval = ext2fs_open2(ctx->filesystem_name, ctx->io_options, flags,
ctx->superblock, blocksize, io_ptr, ret_fs);
if (!retval)
break;
}
} else
retval = ext2fs_open2(ctx->filesystem_name, ctx->io_options, flags, 0, 0,
io_ptr, ret_fs);
if (retval == 0) {
(*ret_fs)->priv_data = ctx;
e2fsck_set_bitmap_type(*ret_fs, 2, "default", ((void *)0));
}
return retval;
} | int try_open_fs(struct_1 *a0, unsigned long a1, unsigned long long a2,
struct struct_0 **a3) {
unsigned long long *v0;
unsigned int v1;
unsigned long v2;
*(a3) = 0;
if (a0->field_60 && a0->field_50) {
v0 = a3;
v2 = ext2fs_open2(a0->field_10, a0->field_20, a1, a0->field_60,
a0->field_50, a2);
}
if (!a0->field_60 || !a0->field_50) {
if (a0->field_60) {
for (v1 = 0x400; v1 <= 0x10000; v1 *= 2) {
if (*(a3)) {
ext2fs_free(*(a3));
*(a3) = 0;
}
v0 = a3;
v2 = ext2fs_open2(a0->field_10, a0->field_20, a1, a0->field_60, v1, a2);
if (!v2)
break;
}
} else {
v0 = a3;
v2 = ext2fs_open2(a0->field_10, a0->field_20, a1, 0x0, 0x0, a2);
}
}
if (!v2) {
*(a3)->field_e0 = a0;
e2fsck_set_bitmap_type(*(a3), 0x2, "default", 0x0);
}
return v2;
} | e2fsprogs-1.46.5 | angr_dream |
void print_case_command_head(case_command) CASE_COM *case_command;
{
cprintf("case %s in ", case_command->word->word);
} | void print_case_command_head(unsigned long a0) {
unsigned long v0;
unsigned long long v2;
v0 = a0;
v2 = cprintf("case %s in ");
return;
} | bash | angr_dream |
static void print_one(const struct passwd *pw, _Bool force) {
static _Bool once = 0;
struct tm *tm;
off_t offset;
struct faillog fl;
time_t now;
char *cp;
char ptime[80];
if (((void *)0) == pw) {
return;
}
offset = (off_t)pw->pw_uid * sizeof(fl);
if (offset + sizeof(fl) <= statbuf.st_size) {
int err = fseeko(fail, offset, 0);
((void)sizeof((0 == err) ? 1 : 0), __extension__({
if (0 == err)
;
else
__assert_fail("0 == err", "faillog.c", 102,
__extension__ __PRETTY_FUNCTION__);
}));
if (fread((char *)&fl, sizeof(fl), 1, fail) != 1) {
fprintf(stderr, gettext("%s: Failed to get the entry for UID %lu\n"),
Prog, (unsigned long int)pw->pw_uid);
return;
}
} else {
explicit_bzero((&fl), (sizeof(fl)));
}
if (!force && (0 == fl.fail_time)) {
return;
}
(void)time(&now);
if (tflg && ((now - fl.fail_time) > seconds)) {
return;
}
if (!once) {
puts(gettext("Login Failures Maximum Latest On\n"));
once = 1;
}
tm = localtime(&fl.fail_time);
if (!tm) {
fprintf(stderr, "Cannot read time from faillog.\n");
return;
}
strftime(ptime, sizeof(ptime), "%D %H:%M:%S %z", tm);
cp = ptime;
printf("%-9s %5d %5d ", pw->pw_name, fl.fail_cnt, fl.fail_max);
printf("%s %s", cp, fl.fail_line);
if (0 != fl.fail_locktime) {
if (((fl.fail_time + fl.fail_locktime) > now) && (0 != fl.fail_cnt)) {
printf(gettext(" [%lus left]"),
(unsigned long)fl.fail_time + fl.fail_locktime - now);
} else {
printf(gettext(" [%lds lock]"), fl.fail_locktime);
}
}
putchar('\n');
} | void print_one(struct_0 *a0, unsigned long a1) {
unsigned int v0;
char v1;
unsigned int v2;
void *v3;
unsigned long v4;
char v5;
char v6;
char v7;
char v8;
char v9;
char v10;
unsigned long long v12;
unsigned long long *v13;
unsigned long long v14;
if (a0) {
*(&v2) = a0->field_10 * 32;
if (*(&v2) + 32 <= g_401630) {
v0 = fseeko(fail, *(&v2), 0x0);
if (v0)
__assert_fail();
v12 = fread(&v5, 0x20, 0x1, fail);
if (v12 != 1)
fprintf(*(&stderr),
gettext("%s: Failed to get the entry for UID %lu\n"));
} else {
explicit_bzero(&v5, 0x20);
}
if ((v12 == 1 || *(&v2) + 32 > g_401630) &&
(!v0 || *(&v2) + 32 > g_401630) && (!(a1 ^ 1) || *(&v7))) {
time(&v1);
if (!tflg || *(&v1) - *(&v7) <= seconds) {
if ((once.5514 ^ 1)) {
puts(gettext(
"Login Failures Maximum Latest On\n"));
once.5514 = 1;
}
v3 = localtime(&v7);
if (!v3) {
fprintf(*(&stderr), "Cannot read time from faillog.\n");
} else {
strftime(&v9, 0x50, "%D %H:%M:%S %z", v3);
v4 = &v9;
printf("%-9s %5d %5d ", a0->field_0, *(&v5));
printf("%s %s", v4, &v6);
if (*(&v8)) {
if (*(&v7) + *(&v8) > *(&v1) && *(&v5))
printf(gettext(" [%lus left]"));
if (*(&v7) + *(&v8) <= *(&v1) || !*(&v5))
printf(gettext(" [%lds lock]"));
}
putchar(0xa);
}
}
}
}
if (!a0 || !v0 || *(&v2) + 32 > g_401630) {
v14 = *(&v10) ^ v13[5];
return;
}
} | shadow | angr_dream |
int main(int argc, char **argv) {
set_start_time();
set_program_name(argv[0]);
setlocale(6, "");
bindtextdomain("tar", "/usr/local/share/locale");
textdomain("tar");
exit_failure = 2;
exit_status = 0;
error_hook = checkpoint_flush_actions;
set_quoting_style(0, escape_quoting_style);
close_stdout_set_file_name(gettext("stdout"));
if (stdopen())
do {
if (error_hook)
error_hook();
error(0, 0, "%s",
gettext("failed to assert availability of the standard file "
"descriptors"));
fatal_exit();
} while (0);
allocated_archive_names = 10;
archive_name_array = xmalloc(sizeof(const char *) * allocated_archive_names);
archive_names = 0;
signal(17, ((__sighandler_t)0));
priv_set_remove_linkdir();
decode_options(argc, argv);
name_init();
if (volno_file_option)
init_volume_number();
switch (subcommand_option) {
case UNKNOWN_SUBCOMMAND:
do {
if (error_hook)
error_hook();
error(0, 0,
gettext("You must specify one of the '-Acdtrux', '--delete' or "
"'--test-label' options"));
usage(2);
} while (0);
case CAT_SUBCOMMAND:
case UPDATE_SUBCOMMAND:
case APPEND_SUBCOMMAND:
update_archive();
break;
case DELETE_SUBCOMMAND:
delete_archive_members();
break;
case CREATE_SUBCOMMAND:
create_archive();
break;
case EXTRACT_SUBCOMMAND:
extr_init();
read_and(extract_archive);
extract_finish();
break;
case LIST_SUBCOMMAND:
read_and(list_archive);
break;
case DIFF_SUBCOMMAND:
diff_init();
read_and(diff_archive);
break;
case TEST_LABEL_SUBCOMMAND:
test_archive_label();
}
checkpoint_finish();
if (totals_option)
print_total_stats();
if (check_links_option)
check_links();
if (volno_file_option)
closeout_volume_number();
free(archive_name_array);
xattrs_clear_setup();
name_term();
if (exit_status == 2)
error(0, 0, gettext("Exiting with failure status due to previous errors"));
if (stdlis == stdout)
close_stdout();
else if (ferror_unlocked(stderr) || fclose(stderr) != 0)
set_exit_status(2);
return exit_status;
} | int main(unsigned int a0, unsigned long long *a1, unsigned long long a2,
unsigned long a3, unsigned long long a4, unsigned long long a5) {
unsigned long long v2;
set_start_time();
set_program_name(*(a1));
setlocale(0x6, &g_407b53);
bindtextdomain("tar", "/usr/local/share/locale");
textdomain("tar");
exit_failure = 2;
exit_status = 0;
error_hook = got.checkpoint_flush_actions;
set_quoting_style(0x0, 0x7);
close_stdout_set_file_name(gettext("stdout"));
if (stdopen(a0, 0x7, a2, a3, a4, a5)) {
if (error_hook)
*(5242888)();
a3 = gettext(
"failed to assert availability of the standard file descriptors");
error(0x0, 0x0, "%s");
fatal_exit(0x0, 0x0, "%s", a3, a4, a5);
}
allocated_archive_names = 10;
root_device = xmalloc(allocated_archive_names * 8);
root_device = 0;
signal(0x11, 0x0);
priv_set_remove_linkdir(0x11, 0x0, "%s", a3, a4, a5);
decode_options(a0, a1, a1, a3, a4, a5);
name_init(a0, a1, a1, a3, a4, a5);
init_volume_number();
switch (13872494295903503755) {
case 0:
if (error_hook)
*(5242888)();
error(0x0, 0x0,
gettext("You must specify one of the '-Acdtrux', '--delete' or "
"'--test-label' options"));
usage(0x2);
case 1:
case 2:
case 8:
update_archive();
break;
case 3:
create_archive();
break;
case 4:
delete_archive_members();
break;
case 5:
diff_init();
read_and(got.diff_archive);
break;
case 6:
extr_init();
read_and(got.extract_archive);
extract_finish(a0, a1, &g_40871c, a3, a4, a5);
break;
case 7:
read_and(got.list_archive);
break;
case 9:
test_archive_label();
}
checkpoint_finish();
print_total_stats(a0, a1, a2, a3, a4, a5);
if (check_links_option)
check_links();
closeout_volume_number();
free(0x5dc0950fc085000f);
xattrs_clear_setup(0x5dc0950fc085000f, a1, a2, a3, a4, a5);
name_term(0x5dc0950fc085000f, a1, a2, a3, a4, a5);
if (exit_status == 2) {
a1 = 0;
a0 = 0;
error(0x0, 0x0,
gettext("Exiting with failure status due to previous errors"));
}
if (stdlis == stdout) {
close_stdout(a0, a1, stdlis, a3, a4, a5);
} else {
v2 = ferror_unlocked(stderr);
if (v2 || fclose(stderr))
set_exit_status(0x2);
}
return exit_status;
} | tar | angr_dream |
static int open_match(struct permission *allowed_open,
const char *requestedhost, int requestedport) {
if (allowed_open->host_to_connect == ((void *)0))
return 0;
if (allowed_open->port_to_connect != 0 &&
allowed_open->port_to_connect != requestedport)
return 0;
if (strcmp(allowed_open->host_to_connect, "*") != 0 &&
strcmp(allowed_open->host_to_connect, requestedhost) != 0)
return 0;
return 1;
} | _BOOL8 open_match(long a1, const char *a2, int a3) {
if (!*(_QWORD *)a1)
return 0LL;
if (*(_DWORD *)(a1 + 8) && a3 != *(_DWORD *)(a1 + 8))
return 0LL;
return !strcmp(*(const char **)a1, "*") || !strcmp(*(const char **)a1, a2);
} | openssh-portable | ida |
gl_linked_next_node(gl_list_t list, gl_list_node_t node) {
return (node->next != &list->root ? node->next : ((void *)0));
} | long long gl_linked_next_node(unsigned long a0, unsigned long long *a1) {
return (*(a1) == a0 + 40 ? *(a1) : 0);
} | gnutls | angr_sailr |
static const char *pick_salt(void) {
struct passwd *pw;
char *passwd, *p;
size_t typelen;
static char salt[32];
if (salt[0] != '\0')
return salt;
strlcpy(salt, "xx", sizeof(salt));
setpwent();
while ((pw = getpwent()) != ((void *)0)) {
if ((passwd = shadow_pw(pw)) == ((void *)0))
continue;
if (passwd[0] == '$' && (p = strrchr(passwd + 1, '$')) != ((void *)0)) {
typelen = p - passwd + 1;
strlcpy(salt, passwd,
(((typelen) < (sizeof(salt))) ? (typelen) : (sizeof(salt))));
explicit_bzero(passwd, strlen(passwd));
goto out;
}
}
out:
endpwent();
return salt;
} | char *pick_salt() {
long v1;
size_t v2;
struct passwd *v3;
char *s;
char *v5;
if (salt_5921)
return &salt_5921;
strlcpy(&salt_5921, &unk_1C0, 32LL);
setpwent();
while (1) {
v3 = getpwent();
if (!v3)
break;
s = shadow_pw((long)v3);
if (s) {
if (*s == 36) {
v5 = strrchr(s + 1, 36);
if (v5) {
v1 = 32LL;
if ((unsigned long)(v5 - s + 1) <= 0x20)
v1 = v5 - s + 1;
strlcpy(&salt_5921, s, v1);
v2 = strlen(s);
explicit_bzero(s, v2);
break;
}
}
}
}
endpwent();
return &salt_5921;
} | openssh-portable | ida |
static _Bool
pax_dump_header_1(struct tar_sparse_file *file) {
off_t block_ordinal = current_block_ordinal();
union block *blk;
char *p, *q;
size_t i;
char nbuf[((((((sizeof(uintmax_t) * 8) -
(!((__typeof__(uintmax_t))0 < (__typeof__(uintmax_t))-1))) *
146 +
484) /
485) +
(!((__typeof__(uintmax_t))0 < (__typeof__(uintmax_t))-1))) +
1)];
off_t size = 0;
struct sp_array *map = file->stat_info->sparse_map;
char *save_file_name = file->stat_info->file_name;
p = umaxtostr(file->stat_info->sparse_map_avail, nbuf);
size += strlen(p) + 1;
for (i = 0; i < file->stat_info->sparse_map_avail; i++) {
p = umaxtostr(map[i].offset, nbuf);
size += strlen(p) + 1;
p = umaxtostr(map[i].numbytes, nbuf);
size += strlen(p) + 1;
}
size = (size + 512 - 1) / 512;
file->stat_info->archive_file_size += size * 512;
file->dumped_size += size * 512;
xheader_store("GNU.sparse.major", file->stat_info, ((void *)0));
xheader_store("GNU.sparse.minor", file->stat_info, ((void *)0));
xheader_store("GNU.sparse.name", file->stat_info, ((void *)0));
xheader_store("GNU.sparse.realsize", file->stat_info, ((void *)0));
file->stat_info->file_name =
xheader_format_name(file->stat_info, "%d/GNUSparseFile.%p/%f", 0);
if (strlen(file->stat_info->file_name) > 100)
file->stat_info->file_name[100] = 0;
blk = pax_start_header(file->stat_info);
finish_header(file->stat_info, blk, block_ordinal);
free(file->stat_info->file_name);
file->stat_info->file_name = save_file_name;
blk = find_next_block();
q = blk->buffer;
p = umaxtostr(file->stat_info->sparse_map_avail, nbuf);
do {
char *endp = blk->buffer + 512;
char const *srcp = p;
while (*srcp) {
if (q == endp) {
set_next_block_after(blk);
blk = find_next_block();
q = blk->buffer;
endp = blk->buffer + 512;
}
*q++ = *srcp++;
}
} while (0);
do {
char *endp = blk->buffer + 512;
char const *srcp = "\n";
while (*srcp) {
if (q == endp) {
set_next_block_after(blk);
blk = find_next_block();
q = blk->buffer;
endp = blk->buffer + 512;
}
*q++ = *srcp++;
}
} while (0);
for (i = 0; i < file->stat_info->sparse_map_avail; i++) {
p = umaxtostr(map[i].offset, nbuf);
do {
char *endp = blk->buffer + 512;
char const *srcp = p;
while (*srcp) {
if (q == endp) {
set_next_block_after(blk);
blk = find_next_block();
q = blk->buffer;
endp = blk->buffer + 512;
}
*q++ = *srcp++;
}
} while (0);
do {
char *endp = blk->buffer + 512;
char const *srcp = "\n";
while (*srcp) {
if (q == endp) {
set_next_block_after(blk);
blk = find_next_block();
q = blk->buffer;
endp = blk->buffer + 512;
}
*q++ = *srcp++;
}
} while (0);
p = umaxtostr(map[i].numbytes, nbuf);
do {
char *endp = blk->buffer + 512;
char const *srcp = p;
while (*srcp) {
if (q == endp) {
set_next_block_after(blk);
blk = find_next_block();
q = blk->buffer;
endp = blk->buffer + 512;
}
*q++ = *srcp++;
}
} while (0);
do {
char *endp = blk->buffer + 512;
char const *srcp = "\n";
while (*srcp) {
if (q == endp) {
set_next_block_after(blk);
blk = find_next_block();
q = blk->buffer;
endp = blk->buffer + 512;
}
*q++ = *srcp++;
}
} while (0);
}
memset(q, 0, 512 - (q - blk->buffer));
set_next_block_after(blk);
return 1;
} | undefined8 pax_dump_header_1(long param_1)
{
long lVar1;
undefined8 uVar2;
undefined8 uVar3;
char *pcVar4;
size_t sVar5;
size_t sVar6;
long lVar7;
undefined8 uVar8;
long in_FS_OFFSET;
char *local_d8;
char *local_d0;
ulong local_c8;
long local_c0;
char *local_b8;
char *local_b0;
char *local_a8;
char *local_a0;
char *local_98;
char *local_90;
char *local_88;
char *local_80;
char *local_78;
char *local_70;
char *local_68;
char *local_60;
undefined local_38[24];
long local_20;
local_20 = *(long *)(in_FS_OFFSET + 0x28);
uVar3 = current_block_ordinal();
lVar1 = *(long *)(*(long *)(param_1 + 0x18) + 0x140);
uVar2 = *(undefined8 *)(*(long *)(param_1 + 0x18) + 8);
pcVar4 = (char *)umaxtostr(*(undefined8 *)(*(long *)(param_1 + 0x18) + 0x130),
local_38);
sVar5 = strlen(pcVar4);
local_c0 = sVar5 + 1;
for (local_c8 = 0; local_c8 < *(ulong *)(*(long *)(param_1 + 0x18) + 0x130);
local_c8 = local_c8 + 1) {
pcVar4 =
(char *)umaxtostr(*(undefined8 *)(lVar1 + local_c8 * 0x10), local_38);
sVar5 = strlen(pcVar4);
pcVar4 = (char *)umaxtostr(*(undefined8 *)(lVar1 + local_c8 * 0x10 + 8),
local_38);
sVar6 = strlen(pcVar4);
local_c0 = sVar6 + sVar5 + local_c0 + 2;
}
lVar7 = local_c0 + 0x1ff;
if (local_c0 + 0x1ff < 0) {
lVar7 = local_c0 + 0x3fe;
}
*(long *)(*(long *)(param_1 + 0x18) + 0x118) =
*(long *)(*(long *)(param_1 + 0x18) + 0x118) + (lVar7 >> 9) * 0x200;
*(long *)(param_1 + 0x10) = (lVar7 >> 9) * 0x200 + *(long *)(param_1 + 0x10);
xheader_store("GNU.sparse.major", *(undefined8 *)(param_1 + 0x18), 0);
xheader_store("GNU.sparse.minor", *(undefined8 *)(param_1 + 0x18), 0);
xheader_store("GNU.sparse.name", *(undefined8 *)(param_1 + 0x18), 0);
xheader_store("GNU.sparse.realsize", *(undefined8 *)(param_1 + 0x18), 0);
lVar7 = *(long *)(param_1 + 0x18);
uVar8 = xheader_format_name(*(undefined8 *)(param_1 + 0x18),
"%d/GNUSparseFile.%p/%f", 0);
*(undefined8 *)(lVar7 + 8) = uVar8;
sVar5 = strlen(*(char **)(*(long *)(param_1 + 0x18) + 8));
if (100 < sVar5) {
*(undefined *)(*(long *)(*(long *)(param_1 + 0x18) + 8) + 100) = 0;
}
uVar8 = pax_start_header(*(undefined8 *)(param_1 + 0x18));
finish_header(*(undefined8 *)(param_1 + 0x18), uVar8, uVar3);
free(*(void **)(*(long *)(param_1 + 0x18) + 8));
*(undefined8 *)(*(long *)(param_1 + 0x18) + 8) = uVar2;
local_d8 = (char *)find_next_block();
local_b0 = (char *)umaxtostr(
*(undefined8 *)(*(long *)(param_1 + 0x18) + 0x130), local_38);
local_b8 = local_d8 + 0x200;
local_d0 = local_d8;
while (*local_b0 != '\0') {
if (local_d0 == local_b8) {
set_next_block_after(local_d8);
local_d8 = (char *)find_next_block();
local_b8 = local_d8 + 0x200;
local_d0 = local_d8;
}
*local_d0 = *local_b0;
local_d0 = local_d0 + 1;
local_b0 = local_b0 + 1;
}
local_a8 = local_d8 + 0x200;
local_a0 = "\n";
while (*local_a0 != '\0') {
if (local_d0 == local_a8) {
set_next_block_after(local_d8);
local_d8 = (char *)find_next_block();
local_a8 = local_d8 + 0x200;
local_d0 = local_d8;
}
*local_d0 = *local_a0;
local_d0 = local_d0 + 1;
local_a0 = local_a0 + 1;
}
for (local_c8 = 0; local_c8 < *(ulong *)(*(long *)(param_1 + 0x18) + 0x130);
local_c8 = local_c8 + 1) {
local_90 =
(char *)umaxtostr(*(undefined8 *)(lVar1 + local_c8 * 0x10), local_38);
local_98 = local_d8 + 0x200;
while (*local_90 != '\0') {
if (local_d0 == local_98) {
set_next_block_after(local_d8);
local_d8 = (char *)find_next_block();
local_98 = local_d8 + 0x200;
local_d0 = local_d8;
}
*local_d0 = *local_90;
local_d0 = local_d0 + 1;
local_90 = local_90 + 1;
}
local_88 = local_d8 + 0x200;
local_80 = "\n";
while (*local_80 != '\0') {
if (local_d0 == local_88) {
set_next_block_after(local_d8);
local_d8 = (char *)find_next_block();
local_88 = local_d8 + 0x200;
local_d0 = local_d8;
}
*local_d0 = *local_80;
local_d0 = local_d0 + 1;
local_80 = local_80 + 1;
}
local_70 = (char *)umaxtostr(*(undefined8 *)(lVar1 + local_c8 * 0x10 + 8),
local_38);
local_78 = local_d8 + 0x200;
while (*local_70 != '\0') {
if (local_d0 == local_78) {
set_next_block_after(local_d8);
local_d8 = (char *)find_next_block();
local_78 = local_d8 + 0x200;
local_d0 = local_d8;
}
*local_d0 = *local_70;
local_d0 = local_d0 + 1;
local_70 = local_70 + 1;
}
local_68 = local_d8 + 0x200;
local_60 = "\n";
while (*local_60 != '\0') {
if (local_d0 == local_68) {
set_next_block_after(local_d8);
local_d8 = (char *)find_next_block();
local_68 = local_d8 + 0x200;
local_d0 = local_d8;
}
*local_d0 = *local_60;
local_d0 = local_d0 + 1;
local_60 = local_60 + 1;
}
}
memset(local_d0, 0, 0x200 - ((long)local_d0 - (long)local_d8));
set_next_block_after(local_d8);
if (local_20 != *(long *)(in_FS_OFFSET + 0x28)) {
__stack_chk_fail();
}
return 1;
} | tar | ghidra |
void hash_print_statistics(const Hash_table *table, FILE *stream) {
size_t n_entries = hash_get_n_entries(table);
size_t n_buckets = hash_get_n_buckets(table);
size_t n_buckets_used = hash_get_n_buckets_used(table);
size_t max_bucket_length = hash_get_max_bucket_length(table);
fprintf(stream, "# entries: %lu\n", (unsigned long int)n_entries);
fprintf(stream, "# buckets: %lu\n", (unsigned long int)n_buckets);
fprintf(stream, "# buckets used: %lu (%.2f%%)\n",
(unsigned long int)n_buckets_used,
(100.0 * n_buckets_used) / n_buckets);
fprintf(stream, "max bucket length: %lu\n",
(unsigned long int)max_bucket_length);
} | long long hash_print_statistics(void *a0, void *a1) {
unsigned long v0;
unsigned long v1;
unsigned long v2;
unsigned long v3;
unsigned int v5;
v0 = hash_get_n_entries(a0);
v1 = hash_get_n_buckets(a0);
v2 = hash_get_n_buckets_used(a0);
v3 = hash_get_max_bucket_length(a0);
fprintf(a1, "# entries: %", v0);
fprintf(a1, "# buckets: %lu\n", v1);
fprintf(a1, "# buckets used: %lu (%.2f%%)\n", v2, v5);
return fprintf(a1, "max bucket length: %lu\n", v3);
} | gnutls | angr_sailr |
static int check_follow_cname(int direct, char **namep, const char *cname) {
int i;
struct allowed_cname *rule;
if (*cname == '\0' || !config_has_permitted_cnames(&options) ||
strcmp(*namep, cname) == 0)
return 0;
if (options.canonicalize_hostname == 0)
return 0;
if (!direct && options.canonicalize_hostname != 2)
return 0;
sshlog("ssh.c", __func__, 398, 1, SYSLOG_LEVEL_DEBUG3, ((void *)0),
"check \"%s\" CNAME \"%s\"", *namep, cname);
for (i = 0; i < options.num_permitted_cnames; i++) {
rule = options.permitted_cnames + i;
if (match_pattern_list(*namep, rule->source_list, 1) != 1 ||
match_pattern_list(cname, rule->target_list, 1) != 1)
continue;
sshlog("ssh.c", __func__, 404, 0, SYSLOG_LEVEL_VERBOSE, ((void *)0),
"Canonicalized DNS aliased hostname "
"\"%s\" => \"%s\"",
*namep, cname);
free(*namep);
*namep = xstrdup(cname);
return 1;
}
return 0;
} | undefined8 check_follow_cname(int param_1, char **param_2, char *param_3)
{
int iVar1;
char *pcVar2;
undefined8 uVar3;
int local_14;
if ((*param_3 != '\0') &&
(iVar1 = config_has_permitted_cnames(options), iVar1 != 0)) {
uVar3 = 0x100a98;
iVar1 = strcmp(*param_2, param_3);
if (iVar1 != 0) {
if (options._5312_4_ == 0) {
return 0;
}
if ((param_1 == 0) && (options._5312_4_ != 2)) {
return 0;
}
sshlog("ssh.c", "check_follow_cname", 0x18e, 1, 7, 0,
"check \"%s\" CNAME \"%s\"", *param_2, param_3, uVar3);
local_14 = 0;
do {
if (options._5324_4_ <= local_14) {
return 0;
}
iVar1 = match_pattern_list(
*param_2, *(undefined8 *)(options + (long)local_14 * 0x10 + 0x14d0),
1);
if (iVar1 == 1) {
uVar3 = 0x100b83;
iVar1 = match_pattern_list(
param_3,
*(undefined8 *)(options + (long)local_14 * 0x10 + 0x14d8), 1);
if (iVar1 == 1) {
sshlog("ssh.c", "check_follow_cname", 0x194, 0, 4, 0,
"Canonicalized DNS aliased hostname \"%s\" => \"%s\"",
*param_2, param_3, uVar3);
free(*param_2);
pcVar2 = (char *)xstrdup(param_3);
*param_2 = pcVar2;
return 1;
}
}
local_14 = __addvsi3(local_14, 1);
} while (true);
}
}
return 0;
} | openssh-portable | ghidra |
long long strtonum(const char *numstr, long long minval, long long maxval,
const char **errstrp) {
long long ll = 0;
char *ep;
int error = 0;
struct errval {
const char *errstr;
int err;
} ev[4] = {
{((void *)0), 0},
{"invalid", 22},
{"too small", 34},
{"too large", 34},
};
ev[0].err = (*__errno_location());
(*__errno_location()) = 0;
if (minval > maxval)
error = 1;
else {
ll = strtoll(numstr, &ep, 10);
if (numstr == ep || *ep != '\0')
error = 1;
else if ((ll == (-0x7fffffffffffffffLL - 1LL) &&
(*__errno_location()) == 34) ||
ll < minval)
error = 2;
else if ((ll == 0x7fffffffffffffffLL && (*__errno_location()) == 34) ||
ll > maxval)
error = 3;
}
if (errstrp != ((void *)0))
*errstrp = ev[error].errstr;
(*__errno_location()) = ev[error].err;
if (error)
ll = 0;
return (ll);
} | long strtonum(char *a1, long a2, long a3, _QWORD *a4) {
int v7;
char *endptr;
long v9;
long v10;
int v11[2];
const char *v12;
int v13;
const char *v14;
int v15;
const char *v16;
int v17;
unsigned long v18;
v18 = __readfsqword(0x28u);
v9 = 0LL;
v7 = 0;
v10 = 0LL;
v11[0] = 0;
v12 = "invalid";
v13 = 22;
v14 = "too small";
v15 = 34;
v16 = "too large";
v17 = 34;
v11[0] = *_errno_location();
*_errno_location() = 0;
if (a2 <= a3) {
v9 = strtoll(a1, &endptr, 10);
if (a1 == endptr || *endptr) {
v7 = 1;
} else if (v9 == 0x8000000000000000LL && *_errno_location() == 34 ||
v9 < a2) {
v7 = 2;
} else if (v9 == 0x7FFFFFFFFFFFFFFFLL && *_errno_location() == 34 ||
v9 > a3) {
v7 = 3;
}
} else {
v7 = 1;
}
if (a4)
*a4 = *(_QWORD *)&v11[4 * v7 - 2];
*_errno_location() = v11[4 * v7];
if (v7)
return 0LL;
return v9;
} | openssh-portable | ida |
static __inline__ int get_user_hz(void) {
if (__iproute2_user_hz_internal == 0)
__iproute2_user_hz_internal = __get_user_hz();
return __iproute2_user_hz_internal;
} | int get_user_hz() {
if (!__iproute2_user_hz_internal)
__iproute2_user_hz_internal = __get_user_hz();
return __iproute2_user_hz_internal;
} | iproute2-6.0.0 | angr_dream |
static void print_context_number_range(struct file_data const *file, lin a,
lin b) {
printint trans_a, trans_b;
translate_range(file, a, b, &trans_a, &trans_b);
if (trans_b <= trans_a)
fprintf(outfile,
"%"
"l"
"d",
trans_b);
else
fprintf(outfile,
"%"
"l"
"d,%"
"l"
"d",
trans_a, trans_b);
} | void print_context_number_range(unsigned long long a0, unsigned long long a1,
unsigned long long a2) {
char v0;
char v1;
char v2;
unsigned long long *v4;
unsigned long long v5;
translate_range(a0, a1, a2, &v0, &v1);
if (*(&v1) > *(&v0))
fprintf(*(&outfile), "%ld,%ld", *(&v0), *(&v1));
else
fprintf(*(&outfile), "%ld", *(&v1));
v5 = *(&v2) ^ v4[5];
return;
} | diffutils | angr_phoenix |
static void remove_user(const char *user, const struct group *grp) {
struct group *newgrp;
if (!is_on_list(grp->gr_mem, user)) {
fprintf(stderr, gettext("%s: user '%s' is not a member of '%s'\n"), Prog,
user, grp->gr_name);
fail_exit(6);
}
newgrp = __gr_dup(grp);
if (((void *)0) == newgrp) {
fprintf(stderr, gettext("%s: Out of memory. Cannot update %s.\n"), Prog,
gr_dbname());
fail_exit(13);
}
newgrp->gr_mem = del_list(newgrp->gr_mem, user);
if (is_shadowgrp) {
const struct sgrp *sg = sgr_locate(newgrp->gr_name);
struct sgrp *newsg;
if (((void *)0) == sg) {
static struct sgrp sgrent;
sgrent.sg_name = xstrdup(newgrp->gr_name);
sgrent.sg_mem = dup_list(newgrp->gr_mem);
sgrent.sg_adm = (char **)xmalloc(sizeof(char *));
{
sgrent.sg_adm[0] = ((void *)0);
}
sgrent.sg_passwd = newgrp->gr_passwd;
newgrp->gr_passwd = "x";
newsg = &sgrent;
} else {
newsg = __sgr_dup(sg);
if (((void *)0) == newsg) {
fprintf(stderr, gettext("%s: Out of memory. Cannot update %s.\n"), Prog,
sgr_dbname());
fail_exit(13);
}
newsg->sg_mem = del_list(newsg->sg_mem, user);
newsg->sg_adm = del_list(newsg->sg_adm, user);
}
if (sgr_update(newsg) == 0) {
fprintf(stderr, gettext("%s: failed to prepare the new %s entry '%s'\n"),
Prog, sgr_dbname(), newsg->sg_name);
fail_exit(13);
}
}
if (gr_update(newgrp) == 0) {
fprintf(stderr, gettext("%s: failed to prepare the new %s entry '%s'\n"),
Prog, gr_dbname(), newgrp->gr_name);
fail_exit(13);
}
} | void remove_user(undefined8 param_1, undefined8 *param_2)
{
char cVar1;
int iVar2;
char *pcVar3;
undefined8 *puVar4;
undefined8 uVar5;
undefined8 uVar6;
long lVar7;
undefined8 uVar8;
undefined1 *local_40;
cVar1 = is_on_list(param_2[3], param_1);
uVar6 = Prog;
if (cVar1 != '\x01') {
uVar5 = *param_2;
pcVar3 = (char *)gettext("%s: user \'%s\' is not a member of \'%s\'\n");
fprintf(stderr, pcVar3, uVar6, param_1, uVar5);
fail_exit(6);
}
puVar4 = (undefined8 *)__gr_dup(param_2);
if (puVar4 == (undefined8 *)0x0) {
uVar5 = gr_dbname();
uVar6 = Prog;
pcVar3 = (char *)gettext("%s: Out of memory. Cannot update %s.\n");
fprintf(stderr, pcVar3, uVar6, uVar5);
fail_exit(0xd);
}
uVar6 = del_list(puVar4[3], param_1);
puVar4[3] = uVar6;
if (is_shadowgrp != '\0') {
lVar7 = sgr_locate(*puVar4);
if (lVar7 == 0) {
sgrent_5670._0_8_ = xstrdup(*puVar4);
sgrent_5670._24_8_ = dup_list(puVar4[3]);
sgrent_5670._16_8_ = (undefined8 *)xmalloc(8);
*sgrent_5670._16_8_ = 0;
sgrent_5670._8_8_ = puVar4[1];
puVar4[1] = &DAT_00101756;
local_40 = sgrent_5670;
} else {
local_40 = (undefined1 *)__sgr_dup(lVar7);
if ((undefined8 *)local_40 == (undefined8 *)0x0) {
uVar5 = sgr_dbname();
uVar6 = Prog;
pcVar3 = (char *)gettext("%s: Out of memory. Cannot update %s.\n");
fprintf(stderr, pcVar3, uVar6, uVar5);
fail_exit(0xd);
}
uVar6 = del_list(*(undefined8 *)((long)local_40 + 0x18), param_1);
*(undefined8 *)((long)local_40 + 0x18) = uVar6;
uVar6 = del_list(*(undefined8 *)((long)local_40 + 0x10), param_1);
*(undefined8 *)((long)local_40 + 0x10) = uVar6;
}
iVar2 = sgr_update(local_40);
if (iVar2 == 0) {
uVar6 = *(undefined8 *)local_40;
uVar8 = sgr_dbname();
uVar5 = Prog;
pcVar3 =
(char *)gettext("%s: failed to prepare the new %s entry \'%s\'\n");
fprintf(stderr, pcVar3, uVar5, uVar8, uVar6);
fail_exit(0xd);
}
}
iVar2 = gr_update(puVar4);
if (iVar2 == 0) {
uVar6 = *puVar4;
uVar8 = gr_dbname();
uVar5 = Prog;
pcVar3 = (char *)gettext("%s: failed to prepare the new %s entry \'%s\'\n");
fprintf(stderr, pcVar3, uVar5, uVar8, uVar6);
fail_exit(0xd);
}
return;
} | shadow | ghidra |
static int do_modify_nl(enum cmd c, enum macsec_nl_commands cmd, int ifindex,
struct rxsc_desc *rxsc, struct sa_desc *sa) {
struct rtattr *attr_sa;
struct {
struct nlmsghdr n;
struct genlmsghdr g;
char buf[(((0) + 4U - 1) & ~(4U - 1)) + (1024)];
} req = {
.n =
{
.nlmsg_type = (genl_family),
.nlmsg_flags = (0x01),
.nlmsg_len =
(((((sizeof(struct genlmsghdr)) + 4U - 1) & ~(4U - 1)) +
(0)) +
((int)(((sizeof(struct nlmsghdr)) + 4U - 1) & ~(4U - 1)))),
},
.g =
{
.cmd = (cmd),
.version = (1),
},
};
addattr32(&req.n, 1024, MACSEC_ATTR_IFINDEX, ifindex);
if (rxsc) {
struct rtattr *attr_rxsc;
attr_rxsc = addattr_nest(&req.n, 1024, MACSEC_ATTR_RXSC_CONFIG);
addattr64(&req.n, 1024, MACSEC_RXSC_ATTR_SCI, rxsc->sci);
if (c != CMD_DEL && rxsc->active != 0xff)
addattr8(&req.n, 1024, MACSEC_RXSC_ATTR_ACTIVE, rxsc->active);
addattr_nest_end(&req.n, attr_rxsc);
}
if (sa->an == 0xff)
goto talk;
attr_sa = addattr_nest(&req.n, 1024, MACSEC_ATTR_SA_CONFIG);
addattr8(&req.n, 1024, MACSEC_SA_ATTR_AN, sa->an);
if (c != CMD_DEL) {
if (sa->pn)
addattr32(&req.n, 1024, MACSEC_SA_ATTR_PN, sa->pn);
if (sa->key_len) {
addattr_l(&req.n, 1024, MACSEC_SA_ATTR_KEYID, sa->key_id, 16);
addattr_l(&req.n, 1024, MACSEC_SA_ATTR_KEY, sa->key, sa->key_len);
}
if (sa->active != 0xff) {
addattr8(&req.n, 1024, MACSEC_SA_ATTR_ACTIVE, sa->active);
}
}
addattr_nest_end(&req.n, attr_sa);
talk:
if (rtnl_talk(&genl_rth, &req.n, ((void *)0)) < 0)
return -2;
return 0;
} | long do_modify_nl(int a1, char a2, unsigned int a3, long a4,
unsigned char *a5) {
long v8;
long v9;
int v10[262];
unsigned long v11;
v11 = __readfsqword(0x28u);
memset(v10, 0, 1044);
v10[0] = 20;
LOWORD(v10[1]) = genl_family;
HIWORD(v10[1]) = 1;
LOBYTE(v10[4]) = a2;
BYTE1(v10[4]) = 1;
addattr32(v10, 1024LL, 1LL, a3);
if (a4) {
v8 = addattr_nest(v10, 1024LL, 2LL);
addattr64(v10, 1024LL, 1LL, *(_QWORD *)(a4 + 8));
if (a1 != 1 && *(_BYTE *)(a4 + 16) != 0xFF)
addattr8(v10, 1024LL, 2LL, *(unsigned char *)(a4 + 16));
addattr_nest_end(v10, v8);
}
if (*a5 != 0xFF) {
v9 = addattr_nest(v10, 1024LL, 3LL);
addattr8(v10, 1024LL, 1LL, *a5);
if (a1 != 1) {
if (*((_DWORD *)a5 + 1))
addattr32(v10, 1024LL, 3LL, *((unsigned int *)a5 + 1));
if (*((_DWORD *)a5 + 6)) {
addattr_l(v10, 1024LL, 5LL, a5 + 8, 16LL);
addattr_l(v10, 1024LL, 4LL, a5 + 28, *((unsigned int *)a5 + 6));
}
if (a5[156] != 0xFF)
addattr8(v10, 1024LL, 2LL, a5[156]);
}
addattr_nest_end(v10, v9);
}
if ((int)rtnl_talk(&genl_rth, v10, 0LL) >= 0)
return 0LL;
else
return 4294967294LL;
} | iproute2-6.0.0 | ida |
static void print_heading(void) {
print_line(-1, gettext("NAME"), ' ', -1, gettext("LINE"), gettext("TIME"),
gettext("IDLE"), gettext("PID"), gettext("COMMENT"),
gettext("EXIT"));
} | void print_heading(void)
{
undefined8 uVar1;
undefined8 uVar2;
undefined8 uVar3;
undefined8 uVar4;
undefined8 uVar5;
undefined8 uVar6;
undefined8 uVar7;
uVar1 = gettext(&DAT_00101f8a);
uVar2 = gettext("COMMENT");
uVar3 = gettext(&DAT_00101f97);
uVar4 = gettext(&DAT_00101f9b);
uVar5 = gettext(&DAT_00101fa0);
uVar6 = gettext(&DAT_00101fa5);
uVar7 = gettext(&DAT_00101faa);
print_line(0xffffffff, uVar7, 0x20, 0xffffffff, uVar6, uVar5, uVar4, uVar3,
uVar2, uVar1);
return;
} | coreutils | ghidra |
static gnutls_x509_trust_list_t load_tl_from_cert_chain(const char *cert,
int cert_size) {
gnutls_datum_t tmp;
gnutls_x509_crt_t *x509_cert_list = ((void *)0);
gnutls_x509_crl_t *x509_crl_list = ((void *)0);
unsigned x509_ncerts, x509_ncrls = 0;
unsigned i;
int ret;
gnutls_x509_trust_list_t list;
ret = gnutls_x509_trust_list_init(&list, 0);
if (ret < 0) {
fprintf(stderr, "gnutls_x509_trust_list_init: %s\n", gnutls_strerror(ret));
app_exit(1);
}
tmp.data = (void *)cert;
tmp.size = cert_size;
ret = gnutls_x509_crt_list_import2(&x509_cert_list, &x509_ncerts, &tmp,
GNUTLS_X509_FMT_PEM, 0);
if (ret < 0 || x509_ncerts < 1) {
fprintf(stderr, "error parsing CRTs: %s\n", gnutls_strerror(ret));
app_exit(1);
}
ret = gnutls_x509_crl_list_import2(&x509_crl_list, &x509_ncrls, &tmp,
GNUTLS_X509_FMT_PEM, 0);
if (ret < 0) {
x509_crl_list = ((void *)0);
x509_ncrls = 0;
}
ret = gnutls_x509_trust_list_add_cas(list, &x509_cert_list[x509_ncerts - 1],
1, 0);
if (ret < 0) {
fprintf(stderr, "gnutls_x509_trust_add_cas: %s\n", gnutls_strerror(ret));
app_exit(1);
}
if (x509_ncrls > 0) {
ret =
gnutls_x509_trust_list_add_crls(list, x509_crl_list, x509_ncrls, 0, 0);
if (ret < 0) {
fprintf(stderr, "gnutls_x509_trust_add_crls: %s\n", gnutls_strerror(ret));
app_exit(1);
}
}
if (x509_ncerts > 1) {
for (i = 0; i < x509_ncerts - 1; i++)
gnutls_x509_crt_deinit(x509_cert_list[i]);
}
gnutls_free((void *)(x509_cert_list)), x509_cert_list = ((void *)0);
gnutls_free((void *)(x509_crl_list)), x509_crl_list = ((void *)0);
return list;
} | long load_tl_from_cert_chain(long a1, int a2) {
const char *v2;
const char *v3;
const char *v4;
const char *v5;
unsigned int v7;
unsigned int v8;
unsigned int i;
char v10[12];
long v11;
long v12;
long v13;
int v14;
unsigned long v15;
v15 = __readfsqword(0x28u);
*(_DWORD *)&v10[8] = 0;
v11 = 0LL;
v8 = 0;
*(_QWORD *)v10 = (unsigned int)gnutls_x509_trust_list_init(&v12, 0LL);
if (*(int *)v10 < 0) {
v2 = (const char *)gnutls_strerror(*(unsigned int *)v10);
fprintf(stderr, "gnutls_x509_trust_list_init: %s\n", v2);
app_exit(1);
}
v13 = a1;
v14 = a2;
*(_DWORD *)v10 = gnutls_x509_crt_list_import2(&v10[4], &v7, &v13, 1LL, 0LL);
if (*(int *)v10 < 0 || !v7) {
v3 = (const char *)gnutls_strerror(*(unsigned int *)v10);
fprintf(stderr, "error parsing CRTs: %s\n", v3);
app_exit(1);
}
*(_DWORD *)v10 = gnutls_x509_crl_list_import2(&v11, &v8, &v13, 1LL, 0LL);
if (*(int *)v10 < 0) {
v11 = 0LL;
v8 = 0;
}
*(_DWORD *)v10 = gnutls_x509_trust_list_add_cas(
v12, *(_QWORD *)&v10[4] + 8LL * (v7 - 1), 1LL, 0LL);
if (*(int *)v10 < 0) {
v4 = (const char *)gnutls_strerror(*(unsigned int *)v10);
fprintf(stderr, "gnutls_x509_trust_add_cas: %s\n", v4);
app_exit(1);
}
if (v8) {
*(_DWORD *)v10 = gnutls_x509_trust_list_add_crls(v12, v11, v8, 0LL, 0LL);
if (*(int *)v10 < 0) {
v5 = (const char *)gnutls_strerror(*(unsigned int *)v10);
fprintf(stderr, "gnutls_x509_trust_add_crls: %s\n", v5);
app_exit(1);
}
}
if (v7 > 1) {
for (i = 0; i < v7 - 1; ++i)
gnutls_x509_crt_deinit(*(_QWORD *)(8LL * i + *(_QWORD *)&v10[4]));
}
gnutls_free(*(_QWORD *)&v10[4]);
*(_QWORD *)&v10[4] = 0LL;
gnutls_free(v11);
return v12;
} | gnutls | ida |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.