input
stringlengths
26
172k
output
stringlengths
18
318k
repo_name
stringclasses
23 values
decompiler
stringclasses
5 values
void usage(int status) { if (status != 0) do { fprintf(stderr, gettext("Try '%s --help' for more information.\n"), program_name); } while (0); else { printf(gettext("Usage: %s EXPRESSION\n or: %s OPTION\n") , program_name, program_name); putchar_unlocked('\n'); fputs_unlocked(gettext(" --help display this help and exit\n"), stdout); fputs_unlocked( gettext(" --version output version information and exit\n"), stdout); fputs_unlocked( gettext("\nPrint the value of EXPRESSION to standard output. A blank " "line below\nseparates increasing precedence groups. " "EXPRESSION may be:\n\n ARG1 | ARG2 ARG1 if it is " "neither null nor 0, otherwise ARG2\n\n ARG1 & ARG2 " "ARG1 if neither argument is null or 0, otherwise 0\n"), stdout) ; fputs_unlocked( gettext("\n ARG1 < ARG2 ARG1 is less than ARG2\n ARG1 <= ARG2 " " ARG1 is less than or equal to ARG2\n ARG1 = ARG2 " "ARG1 is equal to ARG2\n ARG1 != ARG2 ARG1 is unequal to " "ARG2\n ARG1 >= ARG2 ARG1 is greater than or equal to " "ARG2\n ARG1 > ARG2 ARG1 is greater than ARG2\n"), stdout) ; fputs_unlocked( gettext("\n ARG1 + ARG2 arithmetic sum of ARG1 and ARG2\n ARG1 " "- ARG2 arithmetic difference of ARG1 and ARG2\n"), stdout) ; fputs_unlocked( gettext( "\n ARG1 * ARG2 arithmetic product of ARG1 and ARG2\n ARG1 " "/ ARG2 arithmetic quotient of ARG1 divided by ARG2\n ARG1 " "% ARG2 arithmetic remainder of ARG1 divided by ARG2\n"), stdout) ; fputs_unlocked( gettext( "\n STRING : REGEXP anchored pattern match of REGEXP in " "STRING\n\n match STRING REGEXP same as STRING : REGEXP\n " "substr STRING POS LENGTH substring of STRING, POS counted from " "1\n index STRING CHARS index in STRING where any CHARS " "is found, or 0\n length STRING length of STRING\n"), stdout) ; fputs_unlocked( gettext(" + TOKEN interpret TOKEN as a string, " "even if it is a\n keyword like " "'match' or an operator like '/'\n\n ( EXPRESSION ) " " value of EXPRESSION\n"), stdout) ; fputs_unlocked( gettext("\nBeware that many operators need to be escaped or quoted for " "shells.\nComparisons are arithmetic if both ARGs are numbers, " "else lexicographical.\nPattern matches return the string " "matched between \\( and \\) or null; if\n\\( and \\) are not " "used, they return the number of characters matched or 0.\n"), stdout) ; fputs_unlocked( gettext("\nExit status is 0 if EXPRESSION is neither null nor 0, 1 if " "EXPRESSION is null\nor 0, 2 if EXPRESSION is syntactically " "invalid, and 3 if an error occurred.\n"), stdout) ; emit_ancillary_info("expr"); } exit(status); }
void usage(unsigned long a0) { unsigned long v0; unsigned long v1; unsigned long v3; unsigned long v4; v1 = v3; v0 = v4; if (a0) { fprintf(stderr, gettext("Try '%s --help' for more information.\n")); } else { printf(gettext("Usage: %s EXPRESSION\n or: %s OPTION\n")); putchar_unlocked(0xa); fputs_unlocked(gettext(" --help display this help and exit\n"), stdout); fputs_unlocked( gettext(" --version output version information and exit\n"), stdout); fputs_unlocked( gettext("\nPrint the value of EXPRESSION to standard output. A blank " "line below\nseparates increasing precedence groups. " "EXPRESSION may be:\n\n ARG1 | ARG2 ARG1 if it is " "neither null nor 0, otherwise ARG2\n\n ARG1 & ARG2 " "ARG1 if neither argument is null or 0, otherwise 0\n"), stdout); fputs_unlocked( gettext("\n ARG1 < ARG2 ARG1 is less than ARG2\n ARG1 <= ARG2 " " ARG1 is less than or equal to ARG2\n ARG1 = ARG2 " "ARG1 is equal to ARG2\n ARG1 != ARG2 ARG1 is unequal to " "ARG2\n ARG1 >= ARG2 ARG1 is greater than or equal to " "ARG2\n ARG1 > ARG2 ARG1 is greater than ARG2\n"), stdout); fputs_unlocked( gettext("\n ARG1 + ARG2 arithmetic sum of ARG1 and ARG2\n ARG1 " "- ARG2 arithmetic difference of ARG1 and ARG2\n"), stdout); fputs_unlocked( gettext( "\n ARG1 * ARG2 arithmetic product of ARG1 and ARG2\n ARG1 " "/ ARG2 arithmetic quotient of ARG1 divided by ARG2\n ARG1 " "% ARG2 arithmetic remainder of ARG1 divided by ARG2\n"), stdout); fputs_unlocked( gettext( "\n STRING : REGEXP anchored pattern match of REGEXP in " "STRING\n\n match STRING REGEXP same as STRING : REGEXP\n " "substr STRING POS LENGTH substring of STRING, POS counted from " "1\n index STRING CHARS index in STRING where any CHARS " "is found, or 0\n length STRING length of STRING\n"), stdout); fputs_unlocked( gettext(" + TOKEN interpret TOKEN as a string, " "even if it is a\n keyword like " "'match' or an operator like '/'\n\n ( EXPRESSION ) " " value of EXPRESSION\n"), stdout); fputs_unlocked( gettext("\nBeware that many operators need to be escaped or quoted for " "shells.\nComparisons are arithmetic if both ARGs are numbers, " "else lexicographical.\nPattern matches return the string " "matched between \\( and \\) or null; if\n\\( and \\) are not " "used, they return the number of characters matched or 0.\n"), stdout); fputs_unlocked( gettext("\nExit status is 0 if EXPRESSION is neither null nor 0, 1 if " "EXPRESSION is null\nor 0, 2 if EXPRESSION is syntactically " "invalid, and 3 if an error occurred.\n"), stdout); emit_ancillary_info("expr"); } exit(a0); }
coreutils
angr_dream
static void simple_flush_write(size_t level __attribute__((unused))) { ssize_t status; status = _flush_write(); if (status != record_size) archive_write_error(status); else { records_written++; bytes_written += status; } }
double simple_flush_write(long long a0) { unsigned long v0; unsigned long long v1; unsigned long long v4; unsigned long long v6; v0 = a0; *(&v1) = _flush_write(); if (v1 != record_size) archive_write_error(v1); continued_file_offset = 16752697132039570249; v4 = v1; xmm0lq<8> = Conv(128->64, (Conv(64->128, Load(addr = 0x404ae8 < 64 >, size = 8, endness = Iend_LE)) + xmm1<16>)) bytes_written = L Conv(128->64, (Conv(64->128, Load(addr = 0x404ae8 < 64 >, size = 8, endness = Iend_LE)) + xmm1<16>))<8> return v6; }
tar
angr_dream
!matches(*argv, "hoplimit") || !matches(*argv, "hlim")) { do { argv++; if (--argc <= 0) incomplete_command(); } while (0); if (strcmp(*argv, "inherit") != 0) { if (get_u8(&ttl, *argv, 0)) invarg("invalid TTL\n", *argv); } else ttl = 0; } else if (!matches(*argv, "tos") ||
(cVar1 = matches(*local_5a0,"hoplimit"), cVar1 == '\x01')) && (cVar1 = matches(*local_5a0,&DAT_001025fb), cVar1 == '\x01')) { cVar1 = matches( *local_5a0, &DAT_00102615); if (((cVar1 == '\x01') && (cVar1 = matches( *local_5a0, "tclass"), cVar1 == '\x01')) && (cVar1 = matches( *local_5a0, "dsfield"), cVar1 == '\x01')) { iVar3 = strcmp( *local_5a0, "noencap"); if (iVar3 == 0) { local_570 = 0; } else { iVar3 = strcmp( *local_5a0, "encap"); if (iVar3 == 0) { local_5a0 = local_5a0 + 1; local_594 = local_594 + -1; if (local_594 < 1) { incomplete_command(); } iVar3 = strcmp( *local_5a0, "fou"); if (iVar3 == 0) { local_570 = 1; } else { iVar3 = strcmp( *local_5a0, "gue"); if (iVar3 == 0) { local_570 = 2; } else { iVar3 = strcmp( *local_5a0, "none"); if (iVar3 != 0) { invarg( "Inva" "lid " "enca" "p " "type" ".", *local_5a0); goto LAB_00101174; } local_570 = 0; } } } else { LAB_00101174: iVar3 = strcmp( *local_5a0, "encap-" "sport"); if (iVar3 == 0) { local_5a0 = local_5a0 + 1; local_594 = local_594 + -1; if (local_594 < 1) { incomplete_command(); } iVar3 = strcmp( *local_5a0, "auto"); if (iVar3 == 0) { local_576 = 0; } else { iVar3 = get_u16( &local_576, *local_5a0, 0); if (iVar3 != 0) { invarg( "Inva" "lid " "sour" "ce " "port" ".", *local_5a0); goto LAB_0010121f; } } } else { LAB_0010121f: iVar3 = strcmp( *local_5a0, "encap-" "dport"); if (iVar3 == 0) { local_5a0 = local_5a0 + 1; local_594 = local_594 + -1; if (local_594 < 1) { incomplete_command(); } iVar3 = get_u16( &local_574, *local_5a0, 0); if (iVar3 == 0) goto LAB_0010176c; invarg( "Invali" "d " "destin" "ation " "port.", *local_5a0); } iVar3 = strcmp( *local_5a0, "encap-" "csum"); if (iVar3 == 0) { local_56e = local_56e | 1; } else { iVar3 = strcmp( *local_5a0, "noenca" "p-" "csum"); if (iVar3 == 0) { local_56e = local_56e & 0xfffe; } else { iVar3 = strcmp( *local_5a0, "enca" "p-" "udp6" "-csu" "m"); if (iVar3 == 0) { local_56e = local_56e | 2; } else { iVar3 = strcmp( *local_5a0, "no" "en" "ca" "p-" "ud" "p6" "-c" "su" "m"); if (iVar3 == 0) { local_56e = local_56e & 0xfffd; } else { iVar3 = strcmp( *local_5a0, "encap-remcsum"); if (iVar3 == 0) { local_56e = local_56e | 4; } else { iVar3 = strcmp( *local_5a0, "noencap-remcsum"); if (iVar3 == 0) { local_56e = local_56e & 0xfffb; } else { iVar3 = strcmp( *local_5a0, "external"); if (iVar3 == 0) { local_57d = '\x01'; } else { iVar3 = strcmp( *local_5a0, "ignore-df"); if (iVar3 == 0) { local_57e = 1; } else { iVar3 = strcmp( *local_5a0, "noignore-df"); if (iVar3 == 0) { local_57e = 2; } else { iVar3 = strcmp( *local_5a0, "fwmark"); if (iVar3 == 0) { local_5a0 = local_5a0 + 1; local_594 = local_594 + -1; if (local_594 < 1) { incomplete_command(); } iVar3 = get_u32( &local_56c, *local_5a0, 0); if (iVar3 == 0) goto LAB_0010176c; invarg( "invalid fwmark\n", *local_5a0); } if ((local_57b != '\0') && (iVar3 = strcmp( *local_5a0, "erspan"), iVar3 == 0)) { local_5a0 = local_5a0 + 1; local_594 = local_594 + -1; if (local_594 < 1) { incomplete_command(); } iVar3 = get_u32( &local_568, *local_5a0, 0); if (iVar3 != 0) { invarg( "invalid erspan index\n", *local_5a0); } if (((local_568 & 0xfff00000) == 0) && (local_568 != 0)) goto LAB_0010176c; invarg( "erspan index must be > 0 and <= 20-bit\n", *local_5a0); } if ((local_57b != '\0') && (iVar3 = strcmp( *local_5a0, "erspan_ver"), iVar3 == 0)) { local_5a0 = local_5a0 + 1; local_594 = local_594 + -1; if (local_594 < 1) { incomplete_command(); } iVar3 = get_u8( &local_57f, *local_5a0, 0); if (iVar3 != 0) { invarg( "invalid erspan version\n", *local_5a0); } if (local_57f < 3) goto LAB_0010176c; invarg( "erspan version must be 0/1/2\n", *local_5a0); } if ((local_57b == '\0') || (iVar3 = strcmp( *local_5a0, "erspan_dir"), iVar3 != 0)) { LAB_001016ba: if ((local_57b != '\0') && (iVar3 = strcmp( *local_5a0, "erspan_hwid"), iVar3 == 0)) { local_5a0 = local_5a0 + 1; local_594 = local_594 + -1; if (local_594 < 1) { incomplete_command(); } iVar3 = get_u16( &local_572, *local_5a0, 0); if (iVar3 == 0) goto LAB_0010176c; invarg( "invalid erspan hwid\n", *local_5a0); } gre_print_help( param_1, local_594, local_5a0, stderr); uVar4 = 0xffffffff; goto LAB_00101bd8; } local_5a0 = local_5a0 + 1; local_594 = local_594 + -1; if (local_594 < 1) { incomplete_command(); } cVar1 = matches( *local_5a0, "ingress"); if (cVar1 == '\x01') { cVar1 = matches( *local_5a0, "egress"); if (cVar1 == '\x01') { invarg( "Invalid erspan direction.", *local_5a0); goto LAB_001016ba; } local_57c = 1; } else { local_57c = 0; } } } } } } } } } } } } } } else { local_5a0 = local_5a0 + 1; local_594 = local_594 + -1; if (local_594 < 1) { incomplete_command(); } iVar3 = strcmp( *local_5a0, "inherit"); if (iVar3 == 0) { local_581 = 1; } else { iVar3 = rtnl_dsfield_a2n( &local_564, *local_5a0); if (iVar3 != 0) { invarg( "bad TOS " "value", *local_5a0); } local_581 = (undefined) local_564; } } }
iproute2-6.0.0
ghidra
static _Bool parse_execdir(const struct parser_table *entry, char **argv, int *arg_ptr) { return insert_exec_ok("-execdir", entry, argv, arg_ptr); }
long parse_execdir(long a1, long a2, int *a3) { return insert_exec_ok((long)"-execdir", a1, a2, a3); }
findutils
ida
uintmax_t uintmax_from_header(const char *p, size_t s) { return from_header(p, s, "uintmax_t", 0, (18446744073709551615UL), 0, 0); }
void uintmax_from_header(undefined8 param_1, undefined8 param_2) { from_header(param_1, param_2, "uintmax_t", 0, 0xffffffffffffffff, 0, 0); return; }
tar
ghidra
int inflateValidate(strm, check) z_streamp strm; int check; { struct inflate_state *state; if (inflateStateCheck(strm)) return (-2); state = (struct inflate_state *)strm->state; if (check && state->wrap) state->wrap |= 4; else state->wrap &= ~4; return 0; }
long long inflateValidate(struct_0 *a0, unsigned long a1) { struct_1 *v0; unsigned long long v3; if (inflateStateCheck(a0)) { v3 = 4294967294; } else { v0 = a0->field_38; if (a1 && v0->field_10) v0->field_10 = v0->field_10 | 4; if (!v0->field_10 || !a1) v0->field_10 = v0->field_10 & -5; v3 = 0; } return v3; }
zlib
angr_dream
static int __ipnh_get_id(struct rtnl_handle *rthp, __u32 nh_id, struct nlmsghdr **answer) { struct { struct nlmsghdr n; struct nhmsg nhm; char buf[1024]; } req = { .n.nlmsg_len = ((sizeof(struct nhmsg)) + ((int)(((sizeof(struct nlmsghdr)) + 4U - 1) & ~(4U - 1)))), .n.nlmsg_flags = 0x01, .n.nlmsg_type = RTM_GETNEXTHOP, .nhm.nh_family = preferred_family, }; addattr32(&req.n, sizeof(req), NHA_ID, nh_id); return rtnl_talk(rthp, &req.n, answer); }
int __ipnh_get_id(unsigned long long a0, unsigned long a1, unsigned long long a2) { unsigned long long v0; void *v1; unsigned short v2; unsigned short v3; char v4; unsigned long long v6; unsigned long long *v7; unsigned long v8; v0 = a0; v6 = 131; for (v7 = &v1; v6; v7 = &v7[v8]) { v6 -= 1; v1 = 0; } v1 = 24; v2 = 106; v3 = 1; v4 = preferred_family; addattr32(&v1, 0x418, 0x1, a1); return rtnl_talk(v0, &v1, a2); }
iproute2-6.0.0
angr_dream
static int waitproc(int block, int *status) { sigset_t oldmask; int flags = block == 1 ? 0 : 1; int err; if (jobctl) flags |= 2; do { gotsigchld = 0; do err = wait3(status, flags, ((void *)0)); while (err < 0 && (*dash_errno) == 4); if (err || (err = -!block)) break; sigblockall(&oldmask); while (!gotsigchld && !pending_sig) sigsuspend(&oldmask); sigclearmask(); } while (gotsigchld); return err; }
long waitproc(int a1, __WAIT_STATUS a2) { int options; __pid_t v4; sigset_t set; unsigned long v6; v6 = __readfsqword(0x28u); options = a1 != 1; if (jobctl) options |= 2u; do { gotsigchld = 0; do v4 = wait3(a2, options, 0LL); while (v4 < 0 && *dash_errno == 4); if (v4) break; v4 = -(a1 == 0); if (!a1) break; sigblockall(&set); while (!gotsigchld && !pending_sig) sigsuspend(&set); sigclearmask(); } while (gotsigchld); return (unsigned int)v4; }
dash-0.5.11+git20210903+057cd650a4ed
ida
static void ipstats_stat_desc_enable_bit(struct ipstats_stat_dump_filters *filters, unsigned int group, unsigned int subgroup) { filters->mask[0] |= (1 << (group - 1)); if (subgroup) filters->mask[group] |= (1 << (subgroup - 1)); }
void ipstats_stat_desc_enable_bit(uint *param_1, uint param_2, int param_3) { *param_1 = 1 << ((char)param_2 - 1U & 0x1f) | *param_1; if (param_3 != 0) { param_1[param_2] = param_1[param_2] | 1 << ((char)param_3 - 1U & 0x1f); } return; }
iproute2-6.0.0
ghidra
static void ctime_coder(struct tar_stat_info const *st, char const *keyword, struct xheader *xhdr, void const *data __attribute__((unused))) { code_time(st->ctime, keyword, xhdr); }
long long ctime_coder(unsigned long long a0[35], unsigned long a1, void *a2, unsigned long a3) { unsigned long v0; v0 = a3; return code_time(a0[33], a0[34], a1, a2); }
tar
angr_sailr
static inline void emit_ancillary_info(char const *program) { struct infomap { char const *program; char const *node; } const infomap[] = { {"[", "test invocation"}, {"coreutils", "Multi-call invocation"}, {"sha224sum", "sha2 utilities"}, {"sha256sum", "sha2 utilities"}, {"sha384sum", "sha2 utilities"}, {"sha512sum", "sha2 utilities"}, {((void *)0), ((void *)0)}}; char const *node = program; struct infomap const *map_prog = infomap; while (map_prog->program && !(strcmp(program, map_prog->program) == 0)) map_prog++; if (map_prog->node) node = map_prog->node; printf (gettext ("\n%s online help: <%s>\n"), "GNU coreutils", "https: char const *lc_messages = setlocale ( 5 , ((void *)0) ); if (lc_messages && strncmp (lc_messages, "" "en_" "", sizeof ("en_") - 1)) { fputs_unlocked (gettext ("Report any translation bugs to " "<https: stdout ) ; } char const *url_program = (strcmp (program, "[") == 0) ? "test" : program; printf (gettext ("Full documentation <%s%s>\n"), "https: printf (gettext ("or available locally via: info '(coreutils) %s%s'\n"), node, node == program ? " invocation" : ""); }
void emit_ancillary_info(char *a0) { unsigned long long v0; unsigned long long v1[2]; char *v2; unsigned long long v3; unsigned long long v4; unsigned long long v5; unsigned long long v6; unsigned long long v7; unsigned long long v8; unsigned long long v9; unsigned long long v10; unsigned long long v11; unsigned long long v12; unsigned long long v13; unsigned long long v14; unsigned long long v15; void *v16; void *v17; char v18; unsigned long long v23; unsigned long long *v24; unsigned long long v25; v4 = "["; v5 = "test invocation"; v6 = "coreutils"; v7 = "Multi-call invocation"; v8 = "sha224sum"; v9 = "sha2 utilities"; v10 = "sha256sum"; v11 = "sha2 utilities"; v12 = "sha384sum"; v13 = "sha2 utilities"; v14 = "sha512sum"; v15 = "sha2 utilities"; v16 = 0; v17 = 0; v0 = a0; for (v1[0] = &v4; v1[0]; v1[0] = v1 + 1) { if (!strcmp(a0, v1[0])) break; } if (v1[1]) v0 = v1[1]; printf(gettext("\n%s online help: <%s>\n")); v2 = setlocale(0x5, NULL); if (v2 && strncmp(v2, "en_", 0x3)) fputs_unlocked(gettext("Report any translation bugs to <https: if (strcmp(a0, "[")) v23 = a0; else v23 = "test"; v3 = v23; printf(gettext("Full documentation <%s%s>\n")); printf(gettext("or available locally via: info '(coreutils) %s%s'\n")); v25 = *(&v18) ^ v24[5]; return; }
coreutils
angr_dream
int netns_identify_pid(const char *pidstr, char *name, int len) { char net_path[4096]; int netns = -1, ret = -1; struct stat netst; DIR *dir; struct dirent *entry; name[0] = '\0'; snprintf(net_path, sizeof(net_path), "/proc/%s/ns/net", pidstr); netns = open(net_path, 00); if (netns < 0) { fprintf(stderr, "Cannot open network namespace: %s\n", strerror((*__errno_location()))); goto out; } if (fstat(netns, &netst) < 0) { fprintf(stderr, "Stat of netns failed: %s\n", strerror((*__errno_location()))); goto out; } dir = opendir("/var/run/netns"); if (!dir) { if ((*__errno_location()) == 2) { ret = 0; goto out; } fprintf(stderr, "Failed to open directory %s:%s\n", "/var/run/netns", strerror((*__errno_location()))); goto out; } while ((entry = readdir(dir))) { char name_path[4096]; struct stat st; if (strcmp(entry->d_name, ".") == 0) continue; if (strcmp(entry->d_name, "..") == 0) continue; snprintf(name_path, sizeof(name_path), "%s/%s", "/var/run/netns", entry->d_name); if (stat(name_path, &st) != 0) continue; if ((st.st_dev == netst.st_dev) && (st.st_ino == netst.st_ino)) { strlcpy(name, entry->d_name, len); } } ret = 0; closedir(dir); out: if (netns >= 0) close(netns); return ret; }
undefined4 netns_identify_pid(undefined8 param_1, undefined *param_2, int param_3) { int __fd; int iVar1; int *piVar2; char *pcVar3; DIR *__dirp; dirent64 *pdVar4; long in_FS_OFFSET; undefined4 local_2150; stat64 local_2138; stat64 local_20a8; char local_2018[4096]; char local_1018[4104]; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); local_2150 = 0xffffffff; *param_2 = 0; snprintf(local_2018, 0x1000, "/proc/%s/ns/net", param_1); __fd = open64(local_2018, 0); if (__fd < 0) { piVar2 = __errno_location(); pcVar3 = strerror(*piVar2); fprintf(stderr, "Cannot open network namespace: %s\n", pcVar3); } else { iVar1 = fstat64(__fd, &local_2138); if (iVar1 < 0) { piVar2 = __errno_location(); pcVar3 = strerror(*piVar2); fprintf(stderr, "Stat of netns failed: %s\n", pcVar3); } else { __dirp = opendir("/var/run/netns"); if (__dirp == (DIR *)0x0) { piVar2 = __errno_location(); if (*piVar2 == 2) { local_2150 = 0; } else { piVar2 = __errno_location(); pcVar3 = strerror(*piVar2); fprintf(stderr, "Failed to open directory %s:%s\n", "/var/run/netns", pcVar3); } } else { while (pdVar4 = readdir64(__dirp), pdVar4 != (dirent64 *)0x0) { iVar1 = strcmp(pdVar4->d_name, "."); if ((iVar1 != 0) && (iVar1 = strcmp(pdVar4->d_name, ".."), iVar1 != 0)) { snprintf(local_1018, 0x1000, "%s/%s", "/var/run/netns", pdVar4->d_name); iVar1 = stat64(local_1018, &local_20a8); if ((iVar1 == 0) && ((local_20a8.st_dev == local_2138.st_dev && (local_20a8.st_ino == local_2138.st_ino)))) { strlcpy(param_2, pdVar4->d_name, (long)param_3); } } } local_2150 = 0; closedir(__dirp); } } } if (-1 < __fd) { close(__fd); } if (local_10 == *(long *)(in_FS_OFFSET + 0x28)) { return local_2150; } __stack_chk_fail(); }
iproute2-6.0.0
ghidra
static int parse_encap_ila(struct rtattr *rta, size_t len, int *argcp, char ***argvp) { __u64 locator; int argc = *argcp; char **argv = *argvp; int ret = 0; if (get_addr64(&locator, *argv) < 0) { fprintf(stderr, "Bad locator: %s\n", *argv); exit(1); } argc--; argv++; if (rta_addattr64(rta, len, ILA_ATTR_LOCATOR, locator)) return -1; while (argc > 0) { if (strcmp(*argv, "csum-mode") == 0) { int csum_mode; do { argv++; if (--argc <= 0) incomplete_command(); } while (0); csum_mode = ila_csum_name2mode(*argv); if (csum_mode < 0) invarg("\"csum-mode\" value is invalid\n", *argv); ret = rta_addattr8(rta, len, ILA_ATTR_CSUM_MODE, (__u8)csum_mode); argc--; argv++; } else if (strcmp(*argv, "ident-type") == 0) { int ident_type; do { argv++; if (--argc <= 0) incomplete_command(); } while (0); ident_type = ila_ident_name2type(*argv); if (ident_type < 0) invarg("\"ident-type\" value is invalid\n", *argv); ret = rta_addattr8(rta, len, ILA_ATTR_IDENT_TYPE, (__u8)ident_type); argc--; argv++; } else if (strcmp(*argv, "hook-type") == 0) { int hook_type; do { argv++; if (--argc <= 0) incomplete_command(); } while (0); hook_type = ila_hook_name2type(*argv); if (hook_type < 0) invarg("\"hook-type\" value is invalid\n", *argv); ret = rta_addattr8(rta, len, ILA_ATTR_HOOK_TYPE, (__u8)hook_type); argc--; argv++; } else { break; } if (ret) break; } *argcp = argc + 1; *argvp = argv - 1; return ret; }
int parse_encap_ila(undefined8 param_1, undefined4 param_2, int *param_3, long *param_4) { int iVar1; uint uVar2; long in_FS_OFFSET; int local_34; int local_30; undefined8 local_20; char **local_18; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); local_34 = *param_3; local_18 = (char **)*param_4; local_30 = 0; iVar1 = get_addr64(&local_20, *local_18); if (iVar1 < 0) { fprintf(stderr, "Bad locator: %s\n", *local_18); exit(1); } local_34 = local_34 + -1; local_18 = local_18 + 1; iVar1 = rta_addattr64(param_1, param_2, 1, local_20); if (iVar1 == 0) { do { if (local_34 < 1) break; iVar1 = strcmp(*local_18, "csum-mode"); if (iVar1 == 0) { local_18 = local_18 + 1; if (local_34 + -1 < 1) { incomplete_command(); } uVar2 = ila_csum_name2mode(*local_18); if ((int)uVar2 < 0) { invarg("\"csum-mode\" value is invalid\n", *local_18); } local_30 = rta_addattr8(param_1, param_2, 7, uVar2 & 0xff); local_18 = local_18 + 1; } else { iVar1 = strcmp(*local_18, "ident-type"); if (iVar1 == 0) { local_18 = local_18 + 1; if (local_34 + -1 < 1) { incomplete_command(); } uVar2 = ila_ident_name2type(*local_18); if ((int)uVar2 < 0) { invarg("\"ident-type\" value is invalid\n", *local_18); } local_30 = rta_addattr8(param_1, param_2, 8, uVar2 & 0xff); local_18 = local_18 + 1; } else { iVar1 = strcmp(*local_18, "hook-type"); if (iVar1 != 0) break; local_18 = local_18 + 1; if (local_34 + -1 < 1) { incomplete_command(); } uVar2 = ila_hook_name2type(*local_18); if ((int)uVar2 < 0) { invarg("\"hook-type\" value is invalid\n", *local_18); } local_30 = rta_addattr8(param_1, param_2, 9, uVar2 & 0xff); local_18 = local_18 + 1; } } local_34 = local_34 + -2; } while (local_30 == 0); *param_3 = local_34 + 1; *param_4 = (long)(local_18 + -1); } else { local_30 = -1; } if (local_10 == *(long *)(in_FS_OFFSET + 0x28)) { return local_30; } __stack_chk_fail(); }
iproute2-6.0.0
ghidra
void sh_wrerror() { builtin_error(gettext("write error: %s"), strerror((*__errno_location()))); }
void sh_wrerror() { unsigned long long v1; strerror(*(__errno_location())); gettext("write error: %s"); v1 = builtin_error(); return; }
bash
angr_dream
static void getuidtty(char **userp, char **ttyp) { struct passwd *pwd; uid_t uid; char *tty; static char uidbuf[32]; static char ttynm[32 + 4]; static int init = 0; if (!init) { uid = getuid(); if ((pwd = getpwuid(uid)) != ((void *)0)) { uidbuf[0] = 0; strncat(uidbuf, pwd->pw_name, sizeof(uidbuf) - 1); } else { if (uid) sprintf(uidbuf, "uid %d", (int)uid); else sprintf(uidbuf, "root"); } if ((tty = ttyname(0)) != ((void *)0)) { const size_t plen = strlen("/dev/"); if (strncmp(tty, "/dev/", plen) == 0) { tty += plen; if (tty[0] == '/') tty++; } snprintf(ttynm, sizeof(ttynm), "(%.*s) ", 32, tty); } else ttynm[0] = 0; init++; } *userp = uidbuf; *ttyp = ttynm; }
void getuidtty(unsigned long long *a0, unsigned long long *a1) { unsigned int v0; char *v1; unsigned long long *v2; unsigned int v3; unsigned long long *v6; if (!init.4542) { v0 = getuid(); v2 = &getpwuid(v0)->pw_name; if (v2) { uidbuf.4540 = 0; strncat(&uidbuf.4540, *(v2), 0x1f); } else if (v0) { sprintf(&uidbuf.4540, "uid %d", v0); } else { sprintf(&uidbuf.4540, "root"); } v1 = ttyname(0x0); if (v1) { *(&v3) = strlen("/dev/"); if (!strncmp(v1, "/dev/", *(&v3))) { v1 = &v1[*(&v3)]; if (*(v1) == 47) v1 += 1; } snprintf(&ttynm.4541, 0x24, "(%.*s) ", 32); } else { ttynm.4541 = 0; } init.4542 = init.4542 + 1; } *(a0) = &uidbuf.4540; v6 = a1; *(a1) = &ttynm.4541; return; }
sysvinit
angr_dream
void xattrs_xattrs_set(struct tar_stat_info const *st, char const *file_name, char typeflag, int later_run) { if (xattrs_option > 0) { size_t scan = 0; if (!st->xattr_map_size) return; for (; scan < st->xattr_map_size; ++scan) { char *keyword = st->xattr_map[scan].xkey; keyword += strlen("SCHILY.xattr."); if (typeflag == '0' && later_run == !!strcmp(keyword, "security.capability")) continue; if (xattrs_masked_out(keyword, 0)) continue; xattrs__fd_set(st, file_name, typeflag, keyword, st->xattr_map[scan].xval_ptr, st->xattr_map[scan].xval_len); } } }
void xattrs_xattrs_set(long param_1, undefined8 param_2, char param_3, uint param_4) { long lVar1; char *__s1; char cVar2; int iVar3; size_t sVar4; ulong local_18; if ((0 < xattrs_option) && (local_18 = 0, *(long *)(param_1 + 0x158) != 0)) { for (; local_18 < *(ulong *)(param_1 + 0x158); local_18 = local_18 + 1) { lVar1 = *(long *)(local_18 * 0x18 + *(long *)(param_1 + 0x160)); sVar4 = strlen("SCHILY.xattr."); __s1 = (char *)(lVar1 + sVar4); if (((param_3 != '0') || (iVar3 = strcmp(__s1, "security.capability"), param_4 != (iVar3 != 0))) && (cVar2 = xattrs_masked_out(__s1, 0), cVar2 == '\0')) { xattrs__fd_set( param_1, param_2, (int)param_3, __s1, *(undefined8 *)(local_18 * 0x18 + *(long *)(param_1 + 0x160) + 8), *(undefined8 *)(local_18 * 0x18 + *(long *)(param_1 + 0x160) + 0x10)); } } } return; }
tar
ghidra
struct sshkey *_ssh_host_private_key(int type, int nid, struct ssh *ssh) { struct key_entry *k; sshlog("ssh_api.c", __func__, 486, 1, SYSLOG_LEVEL_DEBUG3, ((void *)0), "need %d", type); for ((k) = ((&ssh->private_keys)->tqh_first); (k) != ((void *)0); (k) = ((k)->next.tqe_next)) { sshlog("ssh_api.c", __func__, 488, 1, SYSLOG_LEVEL_DEBUG3, ((void *)0), "check %s", sshkey_type(k->key)); if (k->key->type == type && (type != KEY_ECDSA || k->key->ecdsa_nid == nid)) return (k->key); } return (((void *)0)); }
undefined8 _ssh_host_private_key(int param_1, int param_2, long param_3) { undefined8 uVar1; undefined8 *local_10; sshlog("ssh_api.c", "_ssh_host_private_key", 0x1e6, 1, 7, 0, "need %d", param_1); local_10 = *(undefined8 **)(param_3 + 0x840); while (true) { if (local_10 == (undefined8 *)0x0) { return 0; } uVar1 = sshkey_type(local_10[2]); sshlog("ssh_api.c", "_ssh_host_private_key", 0x1e8, 1, 7, 0, "check %s", uVar1); if ((param_1 == *(int *)local_10[2]) && ((param_1 != 2 || (param_2 == *(int *)(local_10[2] + 0x18))))) break; local_10 = (undefined8 *)*local_10; } return local_10[2]; }
openssh-portable
ghidra
void crypto_sign_ed25519_ref_fe25519_mul( crypto_sign_ed25519_ref_fe25519 *r, const crypto_sign_ed25519_ref_fe25519 *x, const crypto_sign_ed25519_ref_fe25519 *y) { int i, j; crypto_uint32 t[63]; for (i = 0; i < 63; i++) t[i] = 0; for (i = 0; i < 32; i++) for (j = 0; j < 32; j++) t[i + j] += x->v[i] * y->v[j]; for (i = 32; i < 63; i++) r->v[i - 32] = t[i - 32] + times38(t[i]); r->v[31] = t[31]; reduce_mul(r); }
void crypto_sign_ed25519_ref_fe25519_mul(unsigned int a0[32], unsigned int *a1, unsigned int *a2) { unsigned int v0; unsigned int v1; char v2; char v3; char v4; unsigned long long v7; unsigned int v9[32]; unsigned long long *v10; unsigned long long v11; for (v0 = 0; v0 <= 62; v0 = __addvsi3(v0, 0x1, a2)) { *(&(&v2)[4 * v0]) = 0; } for (v0 = 0; v0 <= 31; v0 = __addvsi3(v0, 0x1, v7 + a2[v1] * a1[v0])) { for (v1 = 0; v1 <= 31; v1 = __addvsi3(v1, 0x1, v7 + a2[v1] * a1[v0])) { v7 = *(&(&v2)[4 * __addvsi3(v0, v1, v7 + a2[v1] * a1[v0])]); *(&(&v2)[4 * __addvsi3(v0, v1, v1)]) = v7 + a2[v1] * a1[v0]; } } for (v0 = 32; v0 <= 62; v0 = __addvsi3(v0, 0x1, v9)) { v9[0] = __addvsi3(v0, 0xffffffe0, a2); *((&a0[0] + 0x4 * &v9[0])) = *(&(&v2)[4 * __addvsi3(v0, 0xffffffe0, a2)]) + times38(*(&(&v2)[4 * v0])); } a0[31] = *(&v3); reduce_mul(a0); v11 = *(&v4) ^ v10[5]; return; }
openssh-portable
angr_phoenix
static rsRetVal TCPSendBuf(wrkrInstanceData_t *pWrkrData, uchar *buf, unsigned len, sbool bIsFlush) { rsRetVal iRet = RS_RET_OK; if (pWrkrData->pData->compressionMode >= 2) iRet = TCPSendBufCompressed(pWrkrData, buf, len, bIsFlush); else iRet = TCPSendBufUncompressed(pWrkrData, buf, len); return iRet; }
undefined4 TCPSendBuf(long *param_1, undefined8 param_2, undefined4 param_3, char param_4) { undefined4 local_c; if (*(byte *)(*param_1 + 0xcc) < 2) { local_c = TCPSendBufUncompressed(param_1, param_2, param_3); } else { local_c = TCPSendBufCompressed(param_1, param_2, param_3, (int)param_4); } return local_c; }
rsyslog-8.2210.0
ghidra
int history_expand(char *hstring, char **output) { register int j; int i, r, l, passc, cc, modified, eindex, only_printing, dquote, squote, flag; char *string; int result_len; char *result; char mb[16]; mbstate_t ps; char *temp; if (output == 0) return 0; if (history_expansion_char == 0) { *output = strcpy(xmalloc(1 + strlen(hstring)), (hstring)); return (0); } result = (char *)xmalloc(result_len = 256); result[0] = '\0'; only_printing = modified = 0; l = strlen(hstring); if (hstring[0] == history_subst_char) { string = (char *)xmalloc(l + 5); string[0] = string[1] = history_expansion_char; string[2] = ':'; string[3] = 's'; strcpy(string + 4, hstring); l += 4; } else { memset(&ps, 0, sizeof(mbstate_t)); string = hstring; dquote = history_quoting_state == '"'; squote = history_quoting_state == '\''; i = 0; if (squote && history_quotes_inhibit_expansion) { hist_string_extract_single_quoted(string, &i, 0); squote = 0; if (string[i]) i++; } for (; string[i]; i++) { if ((__ctype_get_mb_cur_max()) > 1 && rl_byte_oriented == 0) { int v; v = _rl_get_char_len(string + i, &ps); if (v > 1) { i += v - 1; continue; } } cc = string[i + 1]; if (history_comment_char && string[i] == history_comment_char && dquote == 0 && (i == 0 || ((string[i - 1]) ? ((char *)strchr((history_word_delimiters), (string[i - 1])) != (char *)((void *)0)) : 0))) { while (string[i]) i++; break; } else if (string[i] == history_expansion_char) { if (cc == 0 || ((cc) ? ((char *)strchr((history_no_expand_chars), (cc)) != (char *)((void *)0)) : 0)) continue; else if (dquote && cc == '"') continue; else if (history_inhibit_expansion_function && (*history_inhibit_expansion_function)(string, i)) continue; else break; } else if (dquote && string[i] == '\\' && cc == '"') i++; else if (history_quotes_inhibit_expansion && string[i] == '"') { dquote = 1 - dquote; } else if (dquote == 0 && history_quotes_inhibit_expansion && string[i] == '\'') { flag = (i > 0 && string[i - 1] == '$'); i++; hist_string_extract_single_quoted(string, &i, flag); } else if (history_quotes_inhibit_expansion && string[i] == '\\') { if (cc == '\'' || cc == history_expansion_char) i++; } } if (string[i] != history_expansion_char) { xfree(result); *output = strcpy(xmalloc(1 + strlen(string)), (string)); return (0); } } dquote = history_quoting_state == '"'; squote = history_quoting_state == '\''; i = j = 0; if (squote && history_quotes_inhibit_expansion) { int c; hist_string_extract_single_quoted(string, &i, 0); squote = 0; for (c = 0; c < i; c++) do { if (j >= result_len - 1) result = (char *)xrealloc(result, result_len += 64); result[j++] = string[c]; result[j] = '\0'; } while (0); if (string[i]) { do { if (j >= result_len - 1) result = (char *)xrealloc(result, result_len += 64); result[j++] = string[i]; result[j] = '\0'; } while (0); i++; } } for (passc = 0; i < l; i++) { int qc, tchar = string[i]; if (passc) { passc = 0; do { if (j >= result_len - 1) result = (char *)xrealloc(result, result_len += 64); result[j++] = tchar; result[j] = '\0'; } while (0); continue; } if ((__ctype_get_mb_cur_max()) > 1 && rl_byte_oriented == 0) { int k, c; c = tchar; memset(mb, 0, sizeof(mb)); for (k = 0; k < 16; k++) { mb[k] = (char)c; memset(&ps, 0, sizeof(mbstate_t)); if (_rl_get_char_len(mb, &ps) == -2) c = string[++i]; else break; } if (strlen(mb) > 1) { do { int sl = strlen(mb); j += sl; if (j >= result_len) { while (j >= result_len) result_len += 128; result = (char *)xrealloc(result, result_len); } strcpy(result + j - sl, mb); } while (0); continue; } } if (tchar == history_expansion_char) tchar = -3; else if (tchar == history_comment_char) tchar = -2; switch (tchar) { default: do { if (j >= result_len - 1) result = (char *)xrealloc(result, result_len += 64); result[j++] = string[i]; result[j] = '\0'; } while (0); break; case '\\': passc++; do { if (j >= result_len - 1) result = (char *)xrealloc(result, result_len += 64); result[j++] = tchar; result[j] = '\0'; } while (0); break; case '"': dquote = 1 - dquote; do { if (j >= result_len - 1) result = (char *)xrealloc(result, result_len += 64); result[j++] = tchar; result[j] = '\0'; } while (0); break; case '\'': { if (squote) { squote = 0; do { if (j >= result_len - 1) result = (char *)xrealloc(result, result_len += 64); result[j++] = tchar; result[j] = '\0'; } while (0); } else if (dquote == 0 && history_quotes_inhibit_expansion) { int quote, slen; flag = (i > 0 && string[i - 1] == '$'); quote = i++; hist_string_extract_single_quoted(string, &i, flag); slen = i - quote + 2; temp = (char *)xmalloc(slen); strncpy(temp, string + quote, slen); temp[slen - 1] = '\0'; do { int sl = strlen(temp); j += sl; if (j >= result_len) { while (j >= result_len) result_len += 128; result = (char *)xrealloc(result, result_len); } strcpy(result + j - sl, temp); } while (0); xfree(temp); } else if (dquote == 0 && squote == 0 && history_quotes_inhibit_expansion == 0) { squote = 1; do { if (j >= result_len - 1) result = (char *)xrealloc(result, result_len += 64); result[j++] = string[i]; result[j] = '\0'; } while (0); } else do { if (j >= result_len - 1) result = (char *)xrealloc(result, result_len += 64); result[j++] = string[i]; result[j] = '\0'; } while (0); break; } case -2: if ((dquote == 0 || history_quotes_inhibit_expansion == 0) && (i == 0 || ((string[i - 1]) ? ((char *)strchr((history_word_delimiters), (string[i - 1])) != (char *)((void *)0)) : 0))) { temp = (char *)xmalloc(l - i + 1); strcpy(temp, string + i); do { int sl = strlen(temp); j += sl; if (j >= result_len) { while (j >= result_len) result_len += 128; result = (char *)xrealloc(result, result_len); } strcpy(result + j - sl, temp); } while (0); xfree(temp); i = l; } else do { if (j >= result_len - 1) result = (char *)xrealloc(result, result_len += 64); result[j++] = string[i]; result[j] = '\0'; } while (0); break; case -3: cc = string[i + 1]; if (cc == 0 || ((cc) ? ((char *)strchr((history_no_expand_chars), (cc)) != (char *)((void *)0)) : 0) || (dquote && cc == '"')) { do { if (j >= result_len - 1) result = (char *)xrealloc(result, result_len += 64); result[j++] = string[i]; result[j] = '\0'; } while (0); break; } if (history_inhibit_expansion_function) { int save_j, temp; save_j = j; do { if (j >= result_len - 1) result = (char *)xrealloc(result, result_len += 64); result[j++] = string[i]; result[j] = '\0'; } while (0); do { if (j >= result_len - 1) result = (char *)xrealloc(result, result_len += 64); result[j++] = cc; result[j] = '\0'; } while (0); temp = (*history_inhibit_expansion_function)(result, save_j); if (temp) { result[--j] = '\0'; break; } else result[j = save_j] = '\0'; } qc = squote ? '\'' : (dquote ? '"' : 0); r = history_expand_internal(string, i, qc, &eindex, &temp, result); if (r < 0) { *output = temp; xfree(result); if (string != hstring) xfree(string); return -1; } else { if (temp) { modified++; if (*temp) do { int sl = strlen(temp); j += sl; if (j >= result_len) { while (j >= result_len) result_len += 128; result = (char *)xrealloc(result, result_len); } strcpy(result + j - sl, temp); } while (0); xfree(temp); } only_printing += r == 1; i = eindex; } break; } } *output = result; if (string != hstring) xfree(string); if (only_printing) { return (2); } return (modified != 0); }
long long history_expand(char a0[4], unsigned long long *a1) { unsigned int v0; int tmp_33; int tmp_34; int tmp_12; int tmp_16; int tmp_29; int tmp_36; int tmp_18; char v1; unsigned int v2; unsigned int v3; unsigned int v4; unsigned int v5; unsigned int v6; unsigned int v7; unsigned int v8; unsigned int v9; unsigned int v10; unsigned int v11; unsigned int v12; unsigned int v13; unsigned int v14; unsigned int v15; unsigned int v16; unsigned int v17; unsigned int v18; unsigned int v19; unsigned int v20; unsigned int v21; unsigned int v22; unsigned int v23; unsigned int v24; unsigned int v25; char *v26; char v27[4]; void *v28; char v29; char v30; unsigned long long v32; unsigned int v33; void *v34; unsigned int v35; unsigned int v36; unsigned int v37; void *v38; unsigned int v39; void *v40; unsigned int v41; unsigned int v42; if (!a1) { v32 = 0; return v32; } else if (!history_expansion_char) { *(a1) = strcpy(xmalloc(strlen(a0) + 1), a0); v32 = 0; return v32; } else { v8 = 0x100; v28 = xmalloc(0x100); *(v28) = 0; v4 = 0; v5 = v4; v2 = strlen(a0); if (a0[0] == history_subst_char) { *(&v27) = xmalloc(v2 + 5); v27[1] = history_expansion_char; v27[0] = v27[1]; v27[2] = 58; v27[3] = 115; strcpy(v27 + 1, a0); v2 += 4; } else { memset(&v29, 0x0, 0x8); *(&v27) = a0; v6 = history_quoting_state == 34; v7 = history_quoting_state == 39; v0 = 0; if (v7 && history_quotes_inhibit_expansion) { hist_string_extract_single_quoted(v27, &v0, 0x0); v7 = 0; if (v27[v0]) v0 += 1; } while (true) { if (!v27[v0]) break; if (__ctype_get_mb_cur_max() > 1 && !rl_byte_oriented && (v13 = _rl_get_char_len(v0 + v27, &v29, v0 + v27), v13 > 1)) { v0 += v13 - 1; } else if (history_comment_char && v27[v0] == history_comment_char && !v6 && (!v0 || v27[1 + v0] && strchr(history_word_delimiters, v27[1 + v0]))) { for (v14 = v27[1 + v0]; v27[v0]; v0 += 1) ; } else if (v27[v0] != history_expansion_char) { if (!(!v6 || v27[v0] != 92 || v14 != 34)) { v0 += 1; } else if (!(!history_quotes_inhibit_expansion || v27[v0] != 34)) { v6 = 1 - v6; } else if (!(v6 || !history_quotes_inhibit_expansion || v27[v0] != 39)) { if (v0 <= 0 || v27[1 + v0] != 36) v33 = 0; else v33 = 1; v15 = v33; v0 += 1; hist_string_extract_single_quoted(v27, &v0, v15); } else if (history_quotes_inhibit_expansion && v27[v0] == 92 && (v14 == 39 || v14 == history_expansion_char)) { v0 += 1; } } else { if (!(!v14 || v14 && strchr(history_no_expand_chars, v14)) && (!(v6) || !(v14 == 34)) && !(5215428417093325889(v27, v0, v0, 5215428417093325889))) break; } v0 += 1; } if (v27[v0] != history_expansion_char) { xfree(v28); *(a1) = strcpy(xmalloc(strlen(v27) + 1), v27); v32 = 0; return v32; } } v6 = history_quoting_state == 34; v7 = history_quoting_state == 39; v34 = 0; v0 = 0; if (v7 && history_quotes_inhibit_expansion) { hist_string_extract_single_quoted(v27, &v0, 0x0); v7 = 0; for (v9 = 0; v9 < v0; v9 += 1) { if (v34 >= v8 - 1) { v8 += 64; v28 = xrealloc(v28, v8, v8); } tmp_33 = v34; v34 += 1; *(tmp_33 + v28) = v27[v9]; *((v28 + v34)) = 0; } if (v27[v0]) { if (v34 >= v8 - 1) { v8 += 64; v28 = xrealloc(v28, v8, v8); } tmp_34 = v34; v34 += 1; *(tmp_34 + v28) = v27[v0]; *((v28 + v34)) = 0; v0 += 1; } } for (v3 = 0; true; v0 += 1) { if (v2 <= v0) { *(a1) = v28; if (v27 != a0) xfree(v27); v32 = (!v5 ? 2 : v4); break; } v10 = v27[v0]; if (v3) { v3 = 0; if (v34 >= v8 - 1) { v8 += 64; v28 = xrealloc(v28, v8, v8); } tmp_12 = v34; v34 += 1; *(v28 + tmp_12) = v10; *((v28 + v34)) = 0; continue; } if (__ctype_get_mb_cur_max() > 1 && !rl_byte_oriented) { v12 = v10; memset(&v30, 0x0, 0x10); v11 = 0; while (true) { if (v11 > 15) break; (&v30)[v11] = v12; memset(&v29, 0x0, 0x8); if (_rl_get_char_len(&v30, &v29, &v29) != -2) break; v0 += 1; v12 = v27[v0]; v11 += 1; } if (strlen(&v30) > 1) { v16 = strlen(&v30); v35 = v16 + v34; if (v35 >= v8) { for (v34 = v16 + v34; v34 >= v8; v8 -= -128) ; v28 = xrealloc(v28, v8, v8); } strcpy(v34 - v16 + v28, &v30); continue; } } if (v10 == history_expansion_char) { v10 = -3; } else if (v10 == history_comment_char) { v10 = -2; } switch (v10) { case 92: v3 += 1; if (v34 >= v8 - 1) { v8 += 64; v28 = xrealloc(v28, v8, v8); } tmp_12 = v34; v34 += 1; *(v28 + tmp_12) = v10; *((v28 + v34)) = 0; break; case 39: if (v7) { v7 = 0; if (v34 >= v8 - 1) { v8 += 64; v28 = xrealloc(v28, v8, v8); } tmp_12 = v34; v34 += 1; *(v28 + tmp_12) = v10; *((v28 + v34)) = 0; break; } else if (!(v6 || !history_quotes_inhibit_expansion)) { if (v0 <= 0 || v27[1 + v0] != 36) v36 = 0; else v36 = 1; v15 = v36; tmp_16 = v0; v0 += 1; v17 = tmp_16; hist_string_extract_single_quoted(v27, &v0, v15); v18 = v0 - v17 + 2; v26 = xmalloc(v18); strncpy(v26, &v27[v17], v18); v26[1 + v18] = 0; v19 = strlen(v26); v37 = v19 + v34; if (v37 >= v8) { for (v34 = v19 + v34; v34 >= v8; v8 -= -128) ; v28 = xrealloc(v28, v8, v8); } strcpy(v28 + v34 - v19, v26); xfree(v26); break; } else if (v6 || v7 || history_quotes_inhibit_expansion) { if (v34 >= v8 - 1) { v8 += 64; v28 = xrealloc(v28, v8, v8); } tmp_29 = v34; v34 += 1; *(tmp_29 + v28) = v27[v0]; *((v28 + v34)) = 0; break; } else { v7 = 1; if (v34 >= v8 - 1) { v8 += 64; v28 = xrealloc(v28, v8, v8); } tmp_29 = v34; v34 += 1; *(tmp_29 + v28) = v27[v0]; *((v28 + v34)) = 0; break; } case 34: v6 = 1 - v6; if (v34 >= v8 - 1) { v8 += 64; v28 = xrealloc(v28, v8, v8); } tmp_12 = v34; v34 += 1; *(v28 + tmp_12) = v10; *((v28 + v34)) = 0; break; case 4294967293: v14 = v27[1 + v0]; if (!v14 || v14 && strchr(history_no_expand_chars, v14) || v6 && v14 == 34) { if (v34 >= v8 - 1) { v8 += 64; v28 = xrealloc(v28, v8, v8); } tmp_29 = v34; v34 += 1; *(tmp_29 + v28) = v27[v0]; *((v28 + v34)) = 0; break; } if (false) { v41 = (!v7 ? 39 : (!v6 ? 34 : 0)); goto LABEL_402a8d; } else { v21 = v34; if (v34 >= v8 - 1) { v8 += 64; v28 = xrealloc(v28, v8, v8); } tmp_36 = v34; v38 = v34 + 1; *(tmp_36 + v28) = v27[v0]; *((v28 + v38)) = 0; if (v38 >= v8 - 1) { v8 += 64; v28 = xrealloc(v28, v8, v8); } tmp_18 = v38; v40 = v38 + 1; *(v28 + tmp_18) = v14; *((v28 + v40)) = 0; v22 = 5215428417093325889(v28, v21, v21, 5215428417093325889); if (v22) { v34 = v40 - 1; *((v28 + v34)) = 0; break; } else { v34 = v21; *(v28 + v21) = 0; v41 = (!v7 ? 39 : (!v6 ? 34 : 0)); LABEL_402a8d: v23 = v41; v24 = history_expand_internal(v27, v0, v23, &v1, &v26, v28); if (v24 >= 0) { if (v26) { v4 += 1; if (*(v26)) { v25 = strlen(v26); v42 = v25 + v34; if (v42 >= v8) { for (v34 = v25 + v34; v34 >= v8; v8 -= -128) ; v28 = xrealloc(v28, v8, v8); } strcpy(v28 + v34 - v25, v26); } xfree(v26); } v5 += v24 == 1; v0 = *(&v1); break; } else { *(a1) = v26; xfree(v28); if (v27 == a0) { v32 = 4294967295; return v32; } xfree(v27); v32 = 4294967295; return v32; } } v0 += 1; continue; } case 4294967294: if (v6 && history_quotes_inhibit_expansion || v0 && (!v27[1 + v0] || !strchr(history_word_delimiters, v27[1 + v0]))) { if (v34 >= v8 - 1) { v8 += 64; v28 = xrealloc(v28, v8, v8); } tmp_29 = v34; v34 += 1; *(tmp_29 + v28) = v27[v0]; *((v28 + v34)) = 0; break; } else { v26 = xmalloc(v2 - v0 + 1); strcpy(v26, &v27[v0]); v20 = strlen(v26); v39 = v20 + v34; if (v39 >= v8) { for (v34 = v20 + v34; v34 >= v8; v8 -= -128) ; v28 = xrealloc(v28, v8, v8); } strcpy(v28 + v34 - v20, v26); xfree(v26); v0 = v2; break; } default: if (v34 >= v8 - 1) { v8 += 64; v28 = xrealloc(v28, v8, v8); } tmp_29 = v34; v34 += 1; *(tmp_29 + v28) = v27[v0]; *((v28 + v34)) = 0; break; } } return v32; } }
bash
angr_sailr
static _Bool devlist_compare(void const *x, void const *y) { struct devlist const *a = x; struct devlist const *b = y; return a->dev_num == b->dev_num; }
ulong devlist_compare(ulong *param_1, ulong *param_2) { return *param_2 & 0xffffffffffffff00 | (ulong)(*param_1 == *param_2); }
coreutils
ghidra
void ssh_digest_free(struct ssh_digest_ctx *ctx) { if (ctx == ((void *)0)) return; EVP_MD_CTX_free(ctx->mdctx); freezero(ctx, sizeof(*ctx)); }
void ssh_digest_free(struct_0 *a0) { unsigned long long v1; if (a0) { EVP_MD_CTX_free(a0->field_8); v1 = freezero(a0, 0x10); } return; }
openssh-portable
angr_phoenix
static inline void emit_ancillary_info(char const *program) { struct infomap { char const *program; char const *node; } const infomap[] = { {"[", "test invocation"}, {"coreutils", "Multi-call invocation"}, {"sha224sum", "sha2 utilities"}, {"sha256sum", "sha2 utilities"}, {"sha384sum", "sha2 utilities"}, {"sha512sum", "sha2 utilities"}, {((void *)0), ((void *)0)}}; char const *node = program; struct infomap const *map_prog = infomap; while (map_prog->program && !(strcmp(program, map_prog->program) == 0)) map_prog++; if (map_prog->node) node = map_prog->node; printf (gettext ("\n%s online help: <%s>\n"), "GNU coreutils", "https: char const *lc_messages = setlocale ( 5 , ((void *)0) ); if (lc_messages && strncmp (lc_messages, "" "en_" "", sizeof ("en_") - 1)) { fputs_unlocked (gettext ("Report any translation bugs to " "<https: stdout ) ; } char const *url_program = (strcmp (program, "[") == 0) ? "test" : program; printf (gettext ("Full documentation <%s%s>\n"), "https: printf (gettext ("or available locally via: info '(coreutils) %s%s'\n"), node, node == program ? " invocation" : ""); }
void emit_ancillary_info(char *a0) { unsigned long v0; unsigned long long v1[2]; char *v2; unsigned long v3; unsigned long long v4; unsigned long long v5; unsigned long long v6; unsigned long long v7; unsigned long long v8; unsigned long long v9; unsigned long long v10; unsigned long long v11; unsigned long long v12; unsigned long long v13; unsigned long long v14; unsigned long long v15; void *v16; void *v17; char v18; unsigned long long *v21; unsigned long long v22; v4 = "["; v5 = "test invocation"; v6 = "coreutils"; v7 = "Multi-call invocation"; v8 = "sha224sum"; v9 = "sha2 utilities"; v10 = "sha256sum"; v11 = "sha2 utilities"; v12 = "sha384sum"; v13 = "sha2 utilities"; v14 = "sha512sum"; v15 = "sha2 utilities"; v16 = 0; v17 = 0; v0 = a0; for (v1[0] = &v4; v1[0] && strcmp(a0, v1[0]); v1[0] = v1 + 1) ; if (v1[1]) v0 = v1[1]; printf(gettext("\n%s online help: <%s>\n")); v2 = setlocale(0x5, NULL); if (v2 && strncmp(v2, "en_", 0x3)) fputs_unlocked(gettext("Report any translation bugs to <https: *(&v3) = (!strcmp(a0, "[") ? a0 : "test"); printf(gettext("Full documentation <%s%s>\n")); printf(gettext("or available locally via: info '(coreutils) %s%s'\n")); v22 = *(&v18) ^ v21[5]; return; }
coreutils
angr_sailr
static struct name *namelist_match(char const *file_name, size_t length) { struct name *p; for (p = namelist; p; p = p->next) { if (p->name[0] && exclude_fnmatch(p->name, file_name, p->matching_flags)) return p; } return ((void *)0); }
long long namelist_match(unsigned long long a0, unsigned long a1) { unsigned long v0; struct_0 *v1; unsigned long long v3; void *v4; v0 = a1; v1 = namelist; while (true) { if (v1) { if (v1->field_10->field_0) { v3 = exclude_fnmatch(v1->field_10, a0, v1->field_20, a0); if (v3) { v4 = v1; break; } } if (!v1->field_10->field_0 || !v3) v1 = v1->field_0; } else { v4 = 0; break; } } return v4; }
tar
angr_dream
int note_err(const char *, ...) __attribute__((__format__(printf, 1, 2))); void verifydir(char *); struct passwd *pwd; uid_t userid; int errs, remin, remout, remin2, remout2; int Tflag, pflag, iamremote, iamrecursive, targetshouldbedirectory; char cmd[64]; enum scp_mode_e { MODE_SCP, MODE_SFTP };
void note_err(unsigned long long a0, unsigned long a1, unsigned long a2) { unsigned int v0; unsigned int v1; unsigned long v2; unsigned long v3; unsigned long v4; char v5; unsigned long v6; unsigned long v7; unsigned long v8; unsigned long v9; unsigned long v10; int v11; int v12; int v13; int v14; int v15; int v16; int v17; int v18; unsigned long v19; unsigned long v20; unsigned long v21; unsigned long v22; char v23; int v24; int v25; int v26; int v27; int v28; int v29; int v30; int v31; unsigned long long *v32; void *v33; unsigned long long v34; unsigned long long v35; unsigned long long v36; v6 = a1; v7 = a2; v8 = v20; v9 = v21; v10 = v22; if (v23) { v11 = v24; v12 = v25; v13 = v26; v14 = v27; v15 = v28; v16 = v29; v17 = v30; v18 = v31; } v4 = v32[5]; if (a0) { targetshouldbedirectory = __addvsi3(0x10ec8348e5894855, 0x1); if (emsg.8360) { v34 = 4294967295; } else { v0 = 8; v1 = 48; v2 = &v19; v3 = &v5; vasnmprintf(&emsg.8360, 0x7fffffff, 0x0, a0, &v0); v36 = 4294967295; } } else if (!emsg.8360) { v33 = 0; } else { run_err(); free(emsg.8360); emsg.8360 = 0; v35 = 4294967295; } if ((v4 ^ v32[5])) __stack_chk_fail(); return; }
openssh-portable
angr_dream
static _Bool elide_tail_bytes_pipe(char const *filename, int fd, uintmax_t n_elide_0, off_t current_pos) { size_t n_elide = n_elide_0; uintmax_t desired_pos = current_pos; _Bool ok = 1; if ((18446744073709551615UL) < n_elide_0 + 8192) { char umax_buf[( (((((sizeof(n_elide_0) * 8) - (!((__typeof__(n_elide_0))0 < (__typeof__(n_elide_0))-1))) * 146 + 484) / 485) + (!((__typeof__(n_elide_0))0 < (__typeof__(n_elide_0))-1))) + 1)]; ((!!sizeof(struct { _Static_assert( 1, "verify_expr (" "1" ", " "(error (1, 0, gettext (\"%s: number of bytes is too large\"), " "umaxtostr (n_elide_0, umax_buf)), assume (false))" ")"); int _gl_dummy; })) ? ((error(1, 0, gettext("%s: number of bytes is too large"), umaxtostr(n_elide_0, umax_buf)), ((0) ? (void)0 : __builtin_unreachable()))) : ((error(1, 0, gettext("%s: number of bytes is too large"), umaxtostr(n_elide_0, umax_buf)), ((0) ? (void)0 : __builtin_unreachable())))); } if (n_elide <= 1024 * 1024) { _Bool first = 1; _Bool eof = 0; size_t n_to_read = 8192 + n_elide; _Bool i; char *b[2]; b[0] = xnmalloc(2, n_to_read); b[1] = b[0] + n_to_read; for (i = 0; !eof; i = !i) { size_t n_read = full_read(fd, b[i], n_to_read); size_t delta = 0; if (n_read < n_to_read) { if ((*__errno_location()) != 0) { error(0, (*__errno_location()), gettext("error reading %s"), quotearg_style(shell_escape_always_quoting_style, filename)); ok = 0; break; } if (n_read <= n_elide) { if (first) { } else { delta = n_elide - n_read; } } eof = 1; } if (!first) { desired_pos += n_elide - delta; xwrite_stdout(b[!i] + 8192, n_elide - delta); } first = 0; if (n_elide < n_read) { desired_pos += n_read - n_elide; xwrite_stdout(b[i], n_read - n_elide); } } free(b[0]); } else { _Bool eof = 0; size_t n_read; _Bool buffered_enough; size_t i, i_next; char **b = ((void *)0); size_t rem = 8192 - (n_elide % 8192); size_t n_elide_round = n_elide + rem; size_t n_bufs = n_elide_round / 8192 + 1; size_t n_alloc = 0; size_t n_array_alloc = 0; buffered_enough = 0; for (i = 0, i_next = 1; !eof; i = i_next, i_next = (i_next + 1) % n_bufs) { if (n_array_alloc == i) { if (n_array_alloc == 0) n_array_alloc = (((n_bufs) < (16)) ? (n_bufs) : (16)); else if (n_array_alloc <= n_bufs / 2) n_array_alloc *= 2; else n_array_alloc = n_bufs; b = xnrealloc(b, n_array_alloc, sizeof *b); } if (!buffered_enough) { b[i] = xmalloc(8192); n_alloc = i + 1; } n_read = full_read(fd, b[i], 8192); if (n_read < 8192) { if ((*__errno_location()) != 0) { error(0, (*__errno_location()), gettext("error reading %s"), quotearg_style(shell_escape_always_quoting_style, filename)); ok = 0; goto free_mem; } eof = 1; } if (i + 1 == n_bufs) buffered_enough = 1; if (buffered_enough) { desired_pos += n_read; xwrite_stdout(b[i_next], n_read); } } if (rem) { if (buffered_enough) { size_t n_bytes_left_in_b_i = 8192 - n_read; desired_pos += rem; if (rem < n_bytes_left_in_b_i) { xwrite_stdout(b[i] + n_read, rem); } else { xwrite_stdout(b[i] + n_read, n_bytes_left_in_b_i); xwrite_stdout(b[i_next], rem - n_bytes_left_in_b_i); } } else if (i + 1 == n_bufs) { size_t y = 8192 - rem; size_t x = n_read - y; desired_pos += x; xwrite_stdout(b[i_next], x); } } free_mem: for (i = 0; i < n_alloc; i++) free(b[i]); free(b); } if (0 <= current_pos && elseek(fd, desired_pos, 0, filename) < 0) ok = 0; return ok; }
void elide_tail_bytes_pipe(unsigned long long a0, unsigned long a1, unsigned long a2, unsigned long a3) { char v0; char v1; char v2; char v3; char v4; char v5; unsigned long v6; void *v7; unsigned long v8; unsigned long long v9; unsigned long long v10; unsigned long long v11; unsigned long v12; unsigned long long v13; unsigned long v14; unsigned long v15; unsigned long long v16; unsigned long v17; unsigned long v18; unsigned long v19; unsigned long long v20; unsigned long v21; void *v22; unsigned long v23; unsigned long long v25; unsigned long long v27; unsigned long long v28; unsigned long long v29; v6 = a3; v0 = 1; if (a2 <= 0x100000) { v1 = 1; v2 = 0; v20 = a2 + 0x2000; v22 = xnmalloc(0x2, v20); v23 = v20 + v22; v3 = 0; while (true) { if (!(v2 ^ 1)) break; v21 = full_read(a1, (&v22)[v3], v20, (&v22)[v3]); v7 = 0; if (v21 < v20) { if (!*(__errno_location())) { if (v21 <= a2 && !v1) v7 = a2 - v21; v2 = 1; } else { v28 = quotearg_style(0x4, a0); error(0x0, *(__errno_location()), gettext("error reading %s")); v0 = 0; break; } } if ((v1 ^ 1)) { v6 += a2 - v7; xwrite_stdout((&v22)[v3 ^ 1] + 0x2000, (a2 - v7)); } v1 = 0; if (a2 < v21) { v6 += v21 - a2; xwrite_stdout((&v22)[v3], v21 - a2); } v3 = !(v3); v3 &= 1; } free(v22); } else { v4 = 0; v11 = 0; v14 = 0x2000 - (a2 & 8191); v15 = v14 + a2; v16 = (v15 >> 13) + 1; v12 = 0; v13 = 0; v5 = 0; v9 = 0; v10 = 1; while (true) { if (!(v4 ^ 1)) { if (v14) { if (v5) { v19 = 0x2000 - v8; v6 += v14; if (v14 < v19) { xwrite_stdout(*((v11 + v9 * 8)) + v8, v14); break; } else { xwrite_stdout(*((v11 + v9 * 8)) + v8, v19); xwrite_stdout(*((v11 + v10 * 8)), v14 - v19); break; } } else if (v16 == v9 + 1) { v17 = 0x2000 - v14; v18 = v8 - v17; v6 += v18; xwrite_stdout(*((v11 + v10 * 8)), v18); break; } } break; } else { if (v13 == v9) { if (!v13) { if (v16 <= 16) v25 = v16; else v25 = 16; v13 = v25; } else if (v13 <= v16 >> 1) { v13 *= 2; } else { v13 = v16; } v11 = xnrealloc(v11, v13, 0x8, v13); } if ((v5 ^ 1)) { *((v9 * 8 + v11)) = xmalloc(0x2000); v12 = v9 + 1; } v8 = full_read(a1, *((v11 + v9 * 8)), 0x2000, *((v11 + v9 * 8))); if (v8 <= 8191) { *(&v25) = *(__errno_location()); if (!v25) { v4 = 1; } else { v27 = quotearg_style(0x4, a0); error(0x0, *(__errno_location()), gettext("error reading %s")); v0 = 0; break; } } if (v16 == v9 + 1) v5 = 1; if (v5) { v6 += v8; xwrite_stdout(*((v11 + v10 * 8)), v8); } v9 = v10; v10 = (0 CONCAT v10 + 1) / m v16 >> 64; } } for (v9 = 0; v9 < v12; v9 += 1) { free(*((v11 + v9 * 8))); } free(v11); } if (!((a3 - 0 >> 63)) && elseek(a1, *(&v6), 0x0, a0) < 0) v0 = 0; v29 = v0; return; }
coreutils
angr_phoenix
int chachapoly_crypt(struct chachapoly_ctx *ctx, u_int seqnr, u_char *dest, const u_char *src, u_int len, u_int aadlen, u_int authlen, int do_encrypt) { u_char seqbuf[16]; int r = -1; u_char expected_tag[16], poly_key[32]; memset(seqbuf, 0, sizeof(seqbuf)); do { const u_int64_t __v = (seqnr); ((u_char *)(seqbuf + 8))[0] = (__v >> 56) & 0xff; ((u_char *)(seqbuf + 8))[1] = (__v >> 48) & 0xff; ((u_char *)(seqbuf + 8))[2] = (__v >> 40) & 0xff; ((u_char *)(seqbuf + 8))[3] = (__v >> 32) & 0xff; ((u_char *)(seqbuf + 8))[4] = (__v >> 24) & 0xff; ((u_char *)(seqbuf + 8))[5] = (__v >> 16) & 0xff; ((u_char *)(seqbuf + 8))[6] = (__v >> 8) & 0xff; ((u_char *)(seqbuf + 8))[7] = __v & 0xff; } while (0); memset(poly_key, 0, sizeof(poly_key)); if (!EVP_CipherInit(ctx->main_evp, ((void *)0), ((void *)0), seqbuf, 1) || EVP_Cipher(ctx->main_evp, poly_key, poly_key, sizeof(poly_key)) < 0) { r = -22; goto out; } if (!do_encrypt) { const u_char *tag = src + aadlen + len; poly1305_auth(expected_tag, src, aadlen + len, poly_key); if (timingsafe_bcmp(expected_tag, tag, 16) != 0) { r = -30; goto out; } } if (aadlen) { if (!EVP_CipherInit(ctx->header_evp, ((void *)0), ((void *)0), seqbuf, 1) || EVP_Cipher(ctx->header_evp, dest, src, aadlen) < 0) { r = -22; goto out; } } seqbuf[0] = 1; if (!EVP_CipherInit(ctx->main_evp, ((void *)0), ((void *)0), seqbuf, 1) || EVP_Cipher(ctx->main_evp, dest + aadlen, src + aadlen, len) < 0) { r = -22; goto out; } if (do_encrypt) { poly1305_auth(dest + aadlen + len, dest, aadlen + len, poly_key); } r = 0; out: explicit_bzero(expected_tag, sizeof(expected_tag)); explicit_bzero(seqbuf, sizeof(seqbuf)); explicit_bzero(poly_key, sizeof(poly_key)); return r; }
long long chachapoly_crypt(unsigned long long a0[2], unsigned long a1, unsigned long long a2, unsigned long long a3, unsigned long a4, unsigned long a5, unsigned int v13) { unsigned int v0; unsigned long long v1; char v2; char v3; char v4; char v5; char v6; char v7; char v8; char v9; char v10; char v11; char v12; char v14; v0 = -1; memset(&v2, 0x0, 0x10); v3 = a1 >> 56; v4 = a1 >> 48; v5 = a1 >> 40; v6 = a1 >> 32; v7 = a1 >> 24; v8 = a1 >> 16; v9 = a1 >> 8; v10 = a1; memset(&v12, 0x0, 0x20); if (!EVP_CipherInit(a0[0], 0x0, 0x0, &v2, 0x1)) { LABEL_400279: v0 = -22; } else { if (EVP_Cipher(a0[0], &v12, &v12, 0x20) < 0) goto LABEL_400279; if (!*(&v14)) { v1 = a3 + a5 + a4; poly1305_auth(&v11, a3, a4 + a5, &v12); if (timingsafe_bcmp(&v11, v1, 0x10, v1)) { v0 = -30; goto LABEL_40041d; } } if (!a5) { LABEL_40035f: v2 = 1; if (!EVP_CipherInit(a0[0], 0x0, 0x0, &v2, 0x1)) { LABEL_4003ca: v0 = -22; } else { if (EVP_Cipher(a0[0], a5 + a2, a5 + a3, a4) < 0) goto LABEL_4003ca; if (*(&v14)) poly1305_auth(a5 + a4 + a2, a2, a4 + a5, &v12); v0 = 0; } } else { if (EVP_CipherInit(a0[1], 0x0, 0x0, &v2, 0x1) && !(EVP_Cipher(a0[1], a2, a3, a5) < 0)) goto LABEL_40035f; v0 = -22; } } LABEL_40041d: explicit_bzero(&v11, 0x10); explicit_bzero(&v2, 0x10); explicit_bzero(&v12, 0x20); return v0; }
openssh-portable
angr_phoenix
static void log_gpasswd_failure(const char *suffix) { if (aflg) { 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, "%s failed to add user %s to group %s%s", myname, user, group, suffix); if (((void *)0) != saved_locale) { (void)setlocale(6, saved_locale); free(saved_locale); } } while (0) ; } else if (dflg) { 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, "%s failed to remove user %s from group %s%s", myname, user, group, suffix); if (((void *)0) != saved_locale) { (void)setlocale(6, saved_locale); free(saved_locale); } } while (0) ; } else if (rflg) { 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, "%s failed to remove password of group %s%s", myname, group, suffix); if (((void *)0) != saved_locale) { (void)setlocale(6, saved_locale); free(saved_locale); } } while (0) ; } else if (Rflg) { 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, "%s failed to restrict access to group %s%s", myname, group, suffix); if (((void *)0) != saved_locale) { (void)setlocale(6, saved_locale); free(saved_locale); } } while (0) ; } else if (Aflg || Mflg) { if (Aflg) { 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, "%s failed to set the administrators of group %s to %s%s", myname, group, admins, suffix); if (((void *)0) != saved_locale) { (void)setlocale(6, saved_locale); free(saved_locale); } } while (0) ; } if (Mflg) { 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, "%s failed to set the members of group %s to %s%s", myname, group, members, suffix); if (((void *)0) != saved_locale) { (void)setlocale(6, saved_locale); free(saved_locale); } } while (0) ; } } else { 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, "%s failed to change password of group %s%s", myname, group, suffix); if (((void *)0) != saved_locale) { (void)setlocale(6, saved_locale); free(saved_locale); } } while (0) ; } }
void log_gpasswd_failure(unsigned long a0) { unsigned long v0; void *v1; void *v2; void *v3; void *v4; void *v5; void *v6; void *v7; char *v8; char *v9; char *v10; char *v11; char *v12; char *v13; char *v14; unsigned long long v16; unsigned long long v17; unsigned long long v18; unsigned long long v19; unsigned long long v20; unsigned long long v21; unsigned long long v22; unsigned long long v23; unsigned long long v24; unsigned long long v25; unsigned long long v26; unsigned long long v27; unsigned long long v28; v0 = a0; if (aflg) { v14 = setlocale(0x6, NULL); v1 = 0; if (v14) v1 = strdup(v14); if (v1) setlocale(0x6, "C"); v16 = syslog(0x3, "%s failed to add user %s to group %s%s"); if (v1) { setlocale(0x6, v1); v20 = free(v1); } } else if (dflg) { v13 = setlocale(0x6, NULL); v2 = 0; if (v13) v2 = strdup(v13); if (v2) setlocale(0x6, "C"); v17 = syslog(0x3, "%s failed to remove user %s from group %s%s"); if (v2) { setlocale(0x6, v2); v21 = free(v2); } } else if (rflg) { v12 = setlocale(0x6, NULL); v3 = 0; if (v12) v3 = strdup(v12); if (v3) setlocale(0x6, "C"); v18 = syslog(0x3, "%s failed to remove password of group %s%s"); if (v3) { setlocale(0x6, v3); v23 = free(v3); } } else if (Rflg) { v11 = setlocale(0x6, NULL); v4 = 0; if (v11) v4 = strdup(v11); if (v4) setlocale(0x6, "C"); v19 = syslog(0x3, "%s failed to restrict access to group %s%s"); if (v4) { setlocale(0x6, v4); v24 = free(v4); } } else if (Aflg) { LABEL_400bc7: if (Aflg) { v9 = setlocale(0x6, NULL); v5 = 0; if (v9) v5 = strdup(v9); if (v5) setlocale(0x6, "C"); syslog(0x3, "%s failed to set the administrators of group %s to %s%s"); if (v5) { setlocale(0x6, v5); free(v5); } } v26 = Mflg; if (Mflg) { v10 = setlocale(0x6, NULL); v6 = 0; if (v10) v6 = strdup(v10); if (v6) setlocale(0x6, "C"); v27 = syslog(0x3, "%s failed to set the members of group %s to %s%s"); if (v6) { setlocale(0x6, v6); v28 = free(v6); } } } else { if (!(!Mflg)) goto LABEL_400bc7; v8 = setlocale(0x6, NULL); v7 = 0; if (v8) v7 = strdup(v8); if (v7) setlocale(0x6, "C"); v22 = syslog(0x3, "%s failed to change password of group %s%s"); if (v7) { setlocale(0x6, v7); v25 = free(v7); } } return; }
shadow
angr_phoenix
static int filecopy(const char *src, const char *dst) { FILE *fp, *fp2; char line[5 * 1024]; char *p; fp = fopen(dst, "w"); if (fp == ((void *)0)) { fprintf(stderr, "Cannot open '%s' for write\n", dst); return -1; } fp2 = fopen(src, "r"); if (fp2 == ((void *)0)) { fclose(fp); return 0; } line[sizeof(line) - 1] = 0; do { p = fgets(line, sizeof(line) - 1, fp2); if (p == ((void *)0)) break; fputs(line, fp); } while (1); fclose(fp); fclose(fp2); return 0; }
undefined8 filecopy(char *param_1, char *param_2) { FILE *__stream; undefined8 uVar1; FILE *__stream_00; char *pcVar2; long in_FS_OFFSET; char local_1418[5119]; undefined local_19; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); __stream = fopen(param_2, "w"); if (__stream == (FILE *)0x0) { fprintf(stderr, "Cannot open \'%s\' for write\n", param_2); uVar1 = 0xffffffff; } else { __stream_00 = fopen(param_1, "r"); if (__stream_00 == (FILE *)0x0) { fclose(__stream); uVar1 = 0; } else { local_19 = 0; while (true) { pcVar2 = fgets(local_1418, 0x13ff, __stream_00); if (pcVar2 == (char *)0x0) break; fputs(local_1418, __stream); } fclose(__stream); fclose(__stream_00); uVar1 = 0; } } if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) { __stack_chk_fail(); } return uVar1; }
gnutls
ghidra
int strcmp_until(const char *left, const char *right, char until) { while (*left && *left != until && *left == *right) { left++; right++; } if ((*left == '\0' || *left == until) && (*right == '\0' || *right == until)) { return (0); } return (*left - *right); }
int strcmp_until(unsigned long a0, unsigned long a1, unsigned long a2) { char *v0; char *v1; unsigned int v3; v1 = a0; v0 = a1; while (true) { if (!*(v1)) break; if (a2 == *(v1)) break; if (*(v1) != *(v0)) break; v1 += 1; v0 += 1; } if (*(v1) && !(a2 == *(v1))) goto LABEL_400194; if (!*(v0)) { LABEL_40018d: v3 = 0; } else { if (a2 == *(v0)) goto LABEL_40018d; LABEL_400194: v3 = *(v1) - *(v0); } return v3; }
cronie
angr_phoenix
static const char *host_from_url(const char *url, unsigned int *port, const char **path) { static char hostname[512]; char *p; *port = 0; *path = ""; if ((p = strstr(url, "http: ((void *)0) ) { snprintf(hostname, sizeof(hostname), "%s", p + 7); p = strchr(hostname, '/'); if (p != ((void *)0)) { *p = 0; *path = p + 1; } p = strchr(hostname, ':'); if (p != ((void *)0)) { *p = 0; *port = atoi(p + 1); } return hostname; } else { return url; } }
int host_from_url(char *a0, unsigned int *a1, unsigned long long *a2) { char *v0; unsigned int v2; *(a1) = 0; *(a2) = &g_402240; v0 = strstr(a0, "http: if (!v0) { v2 = a0; } else { snprintf(&hostname.12197, 0x200, "%s", (v0 + 7)); v0 = strchr(&hostname.12197, 0x2f); if (v0) { *(v0) = 0; *(a2) = v0 + 1; } v0 = strchr(&hostname.12197, 0x3a); if (v0) { *(v0) = 0; *(a1) = atoi(v0 + 1); } v2 = &hostname.12197; } return v2; }
gnutls
angr_phoenix
const char *cipher_warning_message(const struct sshcipher_ctx *cc) { if (cc == ((void *)0) || cc->cipher == ((void *)0)) return ((void *)0); return ((void *)0); }
long cipher_warning_message(long a1) { if (a1 && *(_QWORD *)(a1 + 288)) return 0LL; else return 0LL; }
openssh-portable
ida
static __inline__ int isnetfs(const char *type) { static const char *netfs[] = {"nfs", "nfs4", "smbfs", "cifs", "afs", "ncpfs", (char *)0}; int n; for (n = 0; netfs[n]; n++) { if (!strcasecmp(netfs[n], type)) return 1; } return 0; }
int isnetfs(char *a0) { unsigned int v0; unsigned int v2; for (v0 = 0; netfs.4428 [v0]; v0 += 1) { if (!strcasecmp(netfs.4428 [v0], a0)) { v2 = 1; return v2; } } v2 = 0; return v2; }
sysvinit
angr_sailr
char **strvec_from_word_list(list, alloc, starting_index, ip) WORD_LIST *list; int alloc, starting_index, *ip; { int count; char **array; count = list_length(list); array = (char **)sh_xmalloc(((1 + count + starting_index) * sizeof(char *)), "stringvec.c", 228); for (count = 0; count < starting_index; count++) array[count] = (char *)((void *)0); for (count = starting_index; list; count++, list = list->next) array[count] = alloc ? (char *)strcpy(sh_xmalloc((1 + strlen(list->word->word)), "stringvec.c", 233), (list->word->word)) : list->word->word; array[count] = (char *)((void *)0); if (ip) *ip = count; return (array); }
long long strvec_from_word_list(unsigned long long a0, unsigned long a1, unsigned long a2, unsigned int *a3) { struct_0 *v0; unsigned int v1; unsigned long long *v2; unsigned long long v4; v0 = a0; v1 = list_length(v0); v2 = sh_xmalloc((a2 + v1 + 1) * 8, "stringvec.c", 0xe4); for (v1 = 0; v1 < a2; v1 += 1) { v2[v1] = 0; } for (v1 = a2; v0; v0 = v0->field_0) { if (a1) v4 = strcpy( sh_xmalloc(strlen(v0->field_8->field_0) + 1, "stringvec.c", 0xe9), v0->field_8->field_0); else v4 = v0->field_8->field_0; v2[v1] = v4; v1 += 1; } v2[v1] = 0; if (a3) *(a3) = v1; return v2; }
bash
angr_phoenix
static struct mount_entry *get_file_system_list(_Bool need_fs_type) { static struct mount_entry *mount_list = ((void *)0); static _Bool has_fstype = 0; if (mount_list && !has_fstype && need_fs_type) { free_file_system_list(mount_list); mount_list = ((void *)0); } if (!mount_list) { mount_list = read_file_system_list(need_fs_type); has_fstype = need_fs_type; } return mount_list; }
int get_file_system_list(unsigned long a0) { if (mount_list.5899 && (has_fstype.5900 ^ 1) && a0) { free_file_system_list(mount_list.5899); mount_list.5899 = 0; } if (!mount_list.5899) { mount_list.5899 = read_file_system_list(a0); has_fstype.5900 = a0; } return mount_list.5899; }
findutils
angr_phoenix
static void free_dollar_vars() { int i; for (i = 1; i < 10; i++) { do { if (dollar_vars[i]) sh_xfree((dollar_vars[i]), "variables.c", 5602); } while (0); dollar_vars[i] = (char *)((void *)0); } }
void free_dollar_vars() { unsigned int v0; unsigned long long v2; for (v0 = 1; v0 <= 9; v0 += 1) { if (nameref_invalid_value[v0]) sh_xfree(nameref_invalid_value[v0], "variables.c", 0x15e2); v2 = &nameref_invalid_value[0]; nameref_invalid_value[v0] = 0; } return; }
bash
angr_sailr
static int bash_glob_complete_word(count, key) int count, key; { int r; rl_quote_func_t *orig_quoting_function; if (rl_editing_mode == 1) rl_explicit_arg = 1; orig_quoting_function = rl_filename_quoting_function; rl_filename_quoting_function = bash_glob_quote_filename; r = bash_glob_completion_internal( rl_completion_mode(bash_glob_complete_word)); rl_filename_quoting_function = orig_quoting_function; return r; }
long bash_glob_complete_word() { unsigned int v0; unsigned int v2; long v3; if (rl_editing_mode == 1) rl_explicit_arg = 1; v3 = rl_filename_quoting_function; rl_filename_quoting_function = bash_glob_quote_filename; v0 = rl_completion_mode(bash_glob_complete_word); v2 = bash_glob_completion_internal(v0); rl_filename_quoting_function = v3; return v2; }
bash
ida
int sshbuf_putf(struct sshbuf *buf, const char *fmt, ...) { va_list ap; int r; __builtin_va_start(ap, fmt); r = sshbuf_putfv(buf, fmt, ap); __builtin_va_end(ap); return r; }
undefined4 sshbuf_putf(undefined4 param_1, undefined4 param_2, undefined4 param_3, undefined4 param_4, undefined4 param_5, undefined4 param_6, undefined4 param_7, undefined4 param_8, undefined8 param_9, undefined8 param_10, undefined8 param_11, undefined8 param_12, undefined8 param_13, undefined8 param_14) { char in_AL; undefined4 uVar1; long in_FS_OFFSET; undefined4 local_d8; undefined4 local_d4; undefined *local_d0; undefined *local_c8; long local_c0; undefined local_b8[16]; undefined8 local_a8; undefined8 local_a0; undefined8 local_98; undefined8 local_90; undefined4 local_88; undefined4 local_78; undefined4 local_68; undefined4 local_58; undefined4 local_48; undefined4 local_38; undefined4 local_28; undefined4 local_18; if (in_AL != '\0') { local_88 = param_1; local_78 = param_2; local_68 = param_3; local_58 = param_4; local_48 = param_5; local_38 = param_6; local_28 = param_7; local_18 = param_8; } local_c0 = *(long *)(in_FS_OFFSET + 0x28); local_d8 = 0x10; local_d4 = 0x30; local_d0 = &stack0x00000008; local_c8 = local_b8; local_a8 = param_11; local_a0 = param_12; local_98 = param_13; local_90 = param_14; uVar1 = sshbuf_putfv(param_9, param_10, &local_d8); if (local_c0 != *(long *)(in_FS_OFFSET + 0x28)) { __stack_chk_fail(); } return uVar1; }
openssh-portable
ghidra
int get_bits(gnutls_pk_algorithm_t key_type, int info_bits, const char *info_sec_param, int warn) { int bits; if (info_bits != 0) { static int warned = 0; if (warned == 0 && warn != 0 && (((unsigned int)(info_bits)) & 0x80000000) == 0) { warned = 1; fprintf(stderr, "** Note: You may use '--sec-param %s' instead of '--bits %d'\n", bits_to_sp(key_type, info_bits), info_bits); } bits = info_bits; } else { if (info_sec_param == 0) { info_sec_param = "HIGH"; } bits = gnutls_sec_param_to_pk_bits(key_type, str_to_sec_param(info_sec_param)); } return bits; }
int get_bits(unsigned long a0, unsigned long a1, char *a2, unsigned long a3) { unsigned long long v0; unsigned int v1; unsigned long long v3; v0 = a2; if (!a1) { if (!v0) v0 = "HIGH"; v3 = str_to_sec_param(v0); v1 = gnutls_sec_param_to_pk_bits(a0, v3, v3); } else { if (!warned.12578 && a3 && a1 >= 0) { warned.12578 = 1; fprintf(stderr, "** Note: You may use '--sec-param %s' instead of '--bits %d'\n", bits_to_sp(a0, a1), a1); } v1 = a1; } return v1; }
gnutls
angr_phoenix
static void install_cleanup(int sigterm) { struct sigaction sa; sigemptyset(&sa.sa_mask); sa.__sigaction_handler.sa_handler = cleanup; sa.sa_flags = 0x10000000; sigaction(14, &sa, ((void *)0)); sigaction(2, &sa, ((void *)0)); sigaction(3, &sa, ((void *)0)); sigaction(1, &sa, ((void *)0)); sigaction(15, &sa, ((void *)0)); sigaction(sigterm, &sa, ((void *)0)); }
unsigned long install_cleanup(int a1) { struct sigaction v2; unsigned long v3; v3 = __readfsqword(0x28u); sigemptyset(&v2.sa_mask); v2.sa_handler = (__sighandler_t)cleanup; v2.sa_flags = 0x10000000; sigaction(14, &v2, 0LL); sigaction(2, &v2, 0LL); sigaction(3, &v2, 0LL); sigaction(1, &v2, 0LL); sigaction(15, &v2, 0LL); sigaction(a1, &v2, 0LL); return __readfsqword(0x28u) ^ v3; }
coreutils
ida
static int ipstats_req_add_filters(struct ipstats_req *req, void *data) { struct ipstats_stat_dump_filters dump_filters = {}; struct ipstats_stat_enabled *enabled = data; _Bool get_filters = 0; int i; for (i = 0; i < enabled->nenabled; i++) enabled->enabled[i].desc->pack(&dump_filters, enabled->enabled[i].desc); for (i = 1; i < (sizeof(dump_filters.mask) / sizeof((dump_filters.mask)[0])); i++) { if (ipstats_req_should_filter_at(&dump_filters, i)) { get_filters = 1; break; } } req->ifsm.filter_mask = dump_filters.mask[0]; if (get_filters) { struct rtattr *nest; nest = addattr_nest(&req->nlh, sizeof(*req), IFLA_STATS_GET_FILTERS | (1 << 15)); for (i = 1; i < (sizeof(dump_filters.mask) / sizeof((dump_filters.mask)[0])); i++) { if (ipstats_req_should_filter_at(&dump_filters, i)) addattr32(&req->nlh, sizeof(*req), i, dump_filters.mask[i]); } addattr_nest_end(&req->nlh, nest); } return 0; }
void ipstats_req_add_filters(struct_1 *a0, unsigned long long a1[2]) { char v0; unsigned int v1; unsigned long long v2; void *v3; void *v4; void *v5; void *v7; v3 = 0; v4 = 0; v5 = 0; v0 = 0; for (v1 = 0; v1 < a1[1]; v1 += 1) { *((*((a1[0] + v1 * 32)) + 16))(&v3, *((a1[0] + v1 * 32)), *((a1[0] + v1 * 32)), *((*((a1[0] + v1 * 32)) + 16))); } v1 = 1; while (true) { if (v1 > 5) break; if (!ipstats_req_should_filter_at(&v3, v1)) { v1 += 1; } else { v0 = 1; break; } } a0->field_18 = v3; if (v0) { v2 = addattr_nest(a0, 0x9c, 0x8001); for (v1 = 1; v1 <= 5; v1 += 1) { if (ipstats_req_should_filter_at(&v3, v1)) addattr32(a0, 0x9c, v1, *((&v3 + 4 * v1))); } addattr_nest_end(a0, v2, v2); } v7 = 0; return; }
iproute2-6.0.0
angr_phoenix
static void signal_restore(void) { signal_setup(0); }
void signal_restore(void) { signal_setup(0); return; }
coreutils
ghidra
static int iproute_restore(void) { int pos, prio; if (route_dump_check_magic()) return -1; pos = ftell(stdin); if (pos == -1) { perror("Failed to restore: ftell"); return -1; } for (prio = 0; prio < 3; prio++) { int err; err = rtnl_from_file(stdin, &restore_handler, &prio); if (err) return -2; if (fseek(stdin, pos, 0) == -1) { perror("Failed to restore: fseek"); return -1; } } return 0; }
void iproute_restore() { unsigned int v0; unsigned int v1; unsigned int v2; unsigned long long v5; unsigned long long v7; void *v8; unsigned long long v9; unsigned long long v10; if (route_dump_check_magic()) { v5 = 4294967295; } else { v1 = ftell(stdin); if (v1 == -1) { perror("Failed to restore: ftell"); v7 = 4294967295; } else { v0 = 0; while (true) { if (v0 <= 2) { v2 = rtnl_from_file(stdin, restore_handler, &v0); if (v2) { v9 = 4294967294; break; } else if (fseek(stdin, v1, 0x0) == -1) { perror("Failed to restore: fseek"); v10 = 4294967295; break; } else { v0 += 1; } } else { v8 = 0; break; } } } } return; }
iproute2-6.0.0
angr_dream
static int depmod_load_dependencies(struct depmod *depmod) { struct mod **itr, **itr_end; log_printf(7, "load dependencies (%zd modules, %u symbols)\n", depmod->modules.count, hash_get_count(depmod->symbols)); itr = (struct mod **)depmod->modules.array; itr_end = itr + depmod->modules.count; for (; itr < itr_end; itr++) { struct mod *mod = *itr; if (mod->dep_sym_list == ((void *)0)) { log_printf(7, "ignoring %s: no dependency symbols\n", mod->path); continue; } depmod_load_module_dependencies(depmod, mod); } log_printf(7, "loaded dependencies (%zd modules, %u symbols)\n", depmod->modules.count, hash_get_count(depmod->symbols)); return 0; }
undefined8 depmod_load_dependencies(long param_1) { long lVar1; undefined4 uVar2; long *plVar3; long *local_20; uVar2 = hash_get_count(*(undefined8 *)(param_1 + 0x40)); log_printf(7, "load dependencies (%zd modules, %u symbols)\n", *(undefined8 *)(param_1 + 0x18), uVar2); local_20 = *(long **)(param_1 + 0x10); plVar3 = local_20 + *(long *)(param_1 + 0x18); for (; local_20 < plVar3; local_20 = local_20 + 1) { lVar1 = *local_20; if (*(long *)(lVar1 + 0x28) == 0) { log_printf(7, "ignoring %s: no dependency symbols\n", *(undefined8 *)(lVar1 + 8)); } else { depmod_load_module_dependencies(param_1, lVar1); } } uVar2 = hash_get_count(*(undefined8 *)(param_1 + 0x40)); log_printf(7, "loaded dependencies (%zd modules, %u symbols)\n", *(undefined8 *)(param_1 + 0x18), uVar2); return 0; }
kmod
ghidra
void hash_dispose(table) HASH_TABLE *table; { sh_xfree((table->bucket_array), "hashlib.c", 412); sh_xfree((table), "hashlib.c", 413); }
long long hash_dispose(unsigned long long *a0) { sh_xfree(*(a0), "hashlib.c", 0x19c); return sh_xfree(a0, "hashlib.c", 0x19d); }
bash
angr_sailr
void crypto_sign_ed25519_ref_sc25519_window3( signed char r[85], const crypto_sign_ed25519_ref_sc25519 *s) { char carry; int i; for (i = 0; i < 10; i++) { r[8 * i + 0] = s->v[3 * i + 0] & 7; r[8 * i + 1] = (s->v[3 * i + 0] >> 3) & 7; r[8 * i + 2] = (s->v[3 * i + 0] >> 6) & 7; r[8 * i + 2] ^= (s->v[3 * i + 1] << 2) & 7; r[8 * i + 3] = (s->v[3 * i + 1] >> 1) & 7; r[8 * i + 4] = (s->v[3 * i + 1] >> 4) & 7; r[8 * i + 5] = (s->v[3 * i + 1] >> 7) & 7; r[8 * i + 5] ^= (s->v[3 * i + 2] << 1) & 7; r[8 * i + 6] = (s->v[3 * i + 2] >> 2) & 7; r[8 * i + 7] = (s->v[3 * i + 2] >> 5) & 7; } r[8 * i + 0] = s->v[3 * i + 0] & 7; r[8 * i + 1] = (s->v[3 * i + 0] >> 3) & 7; r[8 * i + 2] = (s->v[3 * i + 0] >> 6) & 7; r[8 * i + 2] ^= (s->v[3 * i + 1] << 2) & 7; r[8 * i + 3] = (s->v[3 * i + 1] >> 1) & 7; r[8 * i + 4] = (s->v[3 * i + 1] >> 4) & 7; carry = 0; for (i = 0; i < 84; i++) { r[i] += carry; r[i + 1] += r[i] >> 3; r[i] &= 7; carry = r[i] >> 2; r[i] -= carry << 3; } r[84] += carry; }
long crypto_sign_ed25519_ref_sc25519_window3(long a1, long a2) { long result; char v3; int i; int j; for (i = 0; i <= 9; ++i) { *(_BYTE *)(8 * i + a1) = *(_DWORD *)(a2 + 12LL * i) & 7; *(_BYTE *)(8 * i + 1 + a1) = (*(_DWORD *)(a2 + 12LL * i) >> 3) & 7; *(_BYTE *)(8 * i + 2 + a1) = (*(_DWORD *)(a2 + 12LL * i) >> 6) & 7; *(_BYTE *)(8 * i + 2 + a1) ^= (4 * *(_DWORD *)(a2 + 4LL * (3 * i + 1))) & 7; *(_BYTE *)(8 * i + 3 + a1) = (*(_DWORD *)(a2 + 4LL * (3 * i + 1)) >> 1) & 7; *(_BYTE *)(8 * i + 4 + a1) = (*(_DWORD *)(a2 + 4LL * (3 * i + 1)) >> 4) & 7; *(_BYTE *)(8 * i + 5 + a1) = (*(_DWORD *)(a2 + 4LL * (3 * i + 1)) >> 7) & 7; *(_BYTE *)(8 * i + 5 + a1) ^= (2 * *(_DWORD *)(a2 + 4LL * (3 * i + 2))) & 7; *(_BYTE *)(8 * i + 6 + a1) = (*(_DWORD *)(a2 + 4LL * (3 * i + 2)) >> 2) & 7; *(_BYTE *)(8 * i + 7 + a1) = (*(_DWORD *)(a2 + 4LL * (3 * i + 2)) >> 5) & 7; } *(_BYTE *)(8 * i + a1) = *(_DWORD *)(a2 + 12LL * i) & 7; *(_BYTE *)(8 * i + 1 + a1) = (*(_DWORD *)(a2 + 12LL * i) >> 3) & 7; *(_BYTE *)(8 * i + 2 + a1) = (*(_DWORD *)(a2 + 12LL * i) >> 6) & 7; *(_BYTE *)(8 * i + 2 + a1) ^= (4 * *(_DWORD *)(a2 + 4LL * (3 * i + 1))) & 7; *(_BYTE *)(8 * i + 3 + a1) = (*(_DWORD *)(a2 + 4LL * (3 * i + 1)) >> 1) & 7; *(_BYTE *)(8 * i + 4 + a1) = (*(_DWORD *)(a2 + 4LL * (3 * i + 1)) >> 4) & 7; v3 = 0; for (j = 0; j <= 83; ++j) { *(_BYTE *)(j + a1) += v3; *(_BYTE *)(j + 1 + a1) += *(char *)(j + a1) >> 3; *(_BYTE *)(j + a1) &= 7u; v3 = *(char *)(j + a1) >> 2; *(_BYTE *)(j + a1) -= 8 * v3; } result = a1 + 84; *(_BYTE *)(a1 + 84) += v3; return result; }
openssh-portable
ida
static void mainloop(unsigned int work[64], const unsigned char e[32]) { unsigned int xzm1[64]; unsigned int xzm[64]; unsigned int xzmb[64]; unsigned int xzm1b[64]; unsigned int xznb[64]; unsigned int xzn1b[64]; unsigned int a0[64]; unsigned int a1[64]; unsigned int b0[64]; unsigned int b1[64]; unsigned int c1[64]; unsigned int r[32]; unsigned int s[32]; unsigned int t[32]; unsigned int u[32]; unsigned int j; unsigned int b; int pos; for (j = 0; j < 32; ++j) xzm1[j] = work[j]; xzm1[32] = 1; for (j = 33; j < 64; ++j) xzm1[j] = 0; xzm[0] = 1; for (j = 1; j < 64; ++j) xzm[j] = 0; for (pos = 254; pos >= 0; --pos) { b = e[pos / 8] >> (pos & 7); b &= 1; select(xzmb, xzm1b, xzm, xzm1, b); add(a0, xzmb, xzmb + 32); sub(a0 + 32, xzmb, xzmb + 32); add(a1, xzm1b, xzm1b + 32); sub(a1 + 32, xzm1b, xzm1b + 32); square(b0, a0); square(b0 + 32, a0 + 32); mult(b1, a1, a0 + 32); mult(b1 + 32, a1 + 32, a0); add(c1, b1, b1 + 32); sub(c1 + 32, b1, b1 + 32); square(r, c1 + 32); sub(s, b0, b0 + 32); mult121665(t, s); add(u, t, b0); mult(xznb, b0, b0 + 32); mult(xznb + 32, s, u); square(xzn1b, c1); mult(xzn1b + 32, r, work); select(xzm, xzm1, xznb, xzn1b, b); } for (j = 0; j < 64; ++j) work[j] = xzm[j]; }
void mainloop(unsigned int *a0, char *a1) { unsigned int v0; unsigned int v1; unsigned int v2; char v3; char v4; char v5; char v6; char v7; unsigned int v8; unsigned int v9; char v10; char v11; char v12; char v13; char v14; char v15; char v16; char v17; char v18; char v19; char v20; char v21; char v22; char v23; char v24; char v25; char v26; char v27; char v28; unsigned long long *v31; unsigned long long v32; for (v0 = 0; v0 <= 31; v0 += 1) { *(&(&v7)[4 * v0]) = a0[v0]; } v8 = 1; for (v0 = 33; v0 <= 63; v0 += 1) { *(&(&v7)[4 * v0]) = 0; } v9 = 1; for (v0 = 1; v0 <= 63; v0 += 1) { (&v9)[v0] = 0; } for (v1 = 254; v1 >= 0; v1 = __addvsi3(v1, 0xffffffff)) { v2 = a1[(v1 < 0 ? v1 + 7 : v1) >> 3] >> ((v1 & 7) & 31); v2 &= 1; select(&v10, &v12, &v9, &v7, v2); add(&v18, &v10, &v11); sub(&v19, &v10, &v11); add(&v20, &v12, &v13); sub(&v21, &v12, &v13); square(&v22, &v18); square(&v23, &v19); mult(&v24, &v20, &v19); mult(&v25, &v21, &v18); add(&v26, &v24, &v25); sub(&v27, &v24, &v25); square(&v3, &v27); sub(&v4, &v22, &v23); mult121665(&v5, &v4); add(&v6, &v5, &v22); mult(&v14, &v22, &v23); mult(&v15, &v4, &v6); square(&v16, &v26); mult(&v17, &v3, a0); select(&v9, &v7, &v14, &v16, v2); } for (v0 = 0; v0 <= 63; v0 += 1) { a0[v0] = (&v9)[v0]; } v32 = *(&v28) ^ v31[5]; return; }
openssh-portable
angr_dream
void usage(int status) { if (status != 0) do { fprintf(stderr, gettext("Try '%s --help' for more information.\n"), program_name); } while (0); else { printf(gettext("Usage: %s EXPRESSION\n or: %s OPTION\n") , program_name, program_name); putchar_unlocked('\n'); fputs_unlocked(gettext(" --help display this help and exit\n"), stdout); fputs_unlocked( gettext(" --version output version information and exit\n"), stdout); fputs_unlocked( gettext("\nPrint the value of EXPRESSION to standard output. A blank " "line below\nseparates increasing precedence groups. " "EXPRESSION may be:\n\n ARG1 | ARG2 ARG1 if it is " "neither null nor 0, otherwise ARG2\n\n ARG1 & ARG2 " "ARG1 if neither argument is null or 0, otherwise 0\n"), stdout) ; fputs_unlocked( gettext("\n ARG1 < ARG2 ARG1 is less than ARG2\n ARG1 <= ARG2 " " ARG1 is less than or equal to ARG2\n ARG1 = ARG2 " "ARG1 is equal to ARG2\n ARG1 != ARG2 ARG1 is unequal to " "ARG2\n ARG1 >= ARG2 ARG1 is greater than or equal to " "ARG2\n ARG1 > ARG2 ARG1 is greater than ARG2\n"), stdout) ; fputs_unlocked( gettext("\n ARG1 + ARG2 arithmetic sum of ARG1 and ARG2\n ARG1 " "- ARG2 arithmetic difference of ARG1 and ARG2\n"), stdout) ; fputs_unlocked( gettext( "\n ARG1 * ARG2 arithmetic product of ARG1 and ARG2\n ARG1 " "/ ARG2 arithmetic quotient of ARG1 divided by ARG2\n ARG1 " "% ARG2 arithmetic remainder of ARG1 divided by ARG2\n"), stdout) ; fputs_unlocked( gettext( "\n STRING : REGEXP anchored pattern match of REGEXP in " "STRING\n\n match STRING REGEXP same as STRING : REGEXP\n " "substr STRING POS LENGTH substring of STRING, POS counted from " "1\n index STRING CHARS index in STRING where any CHARS " "is found, or 0\n length STRING length of STRING\n"), stdout) ; fputs_unlocked( gettext(" + TOKEN interpret TOKEN as a string, " "even if it is a\n keyword like " "'match' or an operator like '/'\n\n ( EXPRESSION ) " " value of EXPRESSION\n"), stdout) ; fputs_unlocked( gettext("\nBeware that many operators need to be escaped or quoted for " "shells.\nComparisons are arithmetic if both ARGs are numbers, " "else lexicographical.\nPattern matches return the string " "matched between \\( and \\) or null; if\n\\( and \\) are not " "used, they return the number of characters matched or 0.\n"), stdout) ; fputs_unlocked( gettext("\nExit status is 0 if EXPRESSION is neither null nor 0, 1 if " "EXPRESSION is null\nor 0, 2 if EXPRESSION is syntactically " "invalid, and 3 if an error occurred.\n"), stdout) ; emit_ancillary_info("expr"); } exit(status); }
void usage(unsigned long a0) { unsigned long v0; unsigned long v1; unsigned long v3; unsigned long v4; v1 = v3; v0 = v4; if (a0) { fprintf(stderr, gettext("Try '%s --help' for more information.\n")); } else { printf(gettext("Usage: %s EXPRESSION\n or: %s OPTION\n")); putchar_unlocked(0xa); fputs_unlocked(gettext(" --help display this help and exit\n"), stdout); fputs_unlocked( gettext(" --version output version information and exit\n"), stdout); fputs_unlocked( gettext("\nPrint the value of EXPRESSION to standard output. A blank " "line below\nseparates increasing precedence groups. " "EXPRESSION may be:\n\n ARG1 | ARG2 ARG1 if it is " "neither null nor 0, otherwise ARG2\n\n ARG1 & ARG2 " "ARG1 if neither argument is null or 0, otherwise 0\n"), stdout); fputs_unlocked( gettext("\n ARG1 < ARG2 ARG1 is less than ARG2\n ARG1 <= ARG2 " " ARG1 is less than or equal to ARG2\n ARG1 = ARG2 " "ARG1 is equal to ARG2\n ARG1 != ARG2 ARG1 is unequal to " "ARG2\n ARG1 >= ARG2 ARG1 is greater than or equal to " "ARG2\n ARG1 > ARG2 ARG1 is greater than ARG2\n"), stdout); fputs_unlocked( gettext("\n ARG1 + ARG2 arithmetic sum of ARG1 and ARG2\n ARG1 " "- ARG2 arithmetic difference of ARG1 and ARG2\n"), stdout); fputs_unlocked( gettext( "\n ARG1 * ARG2 arithmetic product of ARG1 and ARG2\n ARG1 " "/ ARG2 arithmetic quotient of ARG1 divided by ARG2\n ARG1 " "% ARG2 arithmetic remainder of ARG1 divided by ARG2\n"), stdout); fputs_unlocked( gettext( "\n STRING : REGEXP anchored pattern match of REGEXP in " "STRING\n\n match STRING REGEXP same as STRING : REGEXP\n " "substr STRING POS LENGTH substring of STRING, POS counted from " "1\n index STRING CHARS index in STRING where any CHARS " "is found, or 0\n length STRING length of STRING\n"), stdout); fputs_unlocked( gettext(" + TOKEN interpret TOKEN as a string, " "even if it is a\n keyword like " "'match' or an operator like '/'\n\n ( EXPRESSION ) " " value of EXPRESSION\n"), stdout); fputs_unlocked( gettext("\nBeware that many operators need to be escaped or quoted for " "shells.\nComparisons are arithmetic if both ARGs are numbers, " "else lexicographical.\nPattern matches return the string " "matched between \\( and \\) or null; if\n\\( and \\) are not " "used, they return the number of characters matched or 0.\n"), stdout); fputs_unlocked( gettext("\nExit status is 0 if EXPRESSION is neither null nor 0, 1 if " "EXPRESSION is null\nor 0, 2 if EXPRESSION is syntactically " "invalid, and 3 if an error occurred.\n"), stdout); emit_ancillary_info("expr"); } exit(a0); }
coreutils
angr_phoenix
int get_data_encipherment_status(void) { if (batch) { return cfg.data_encipherment; } else { return read_yesno( "Will the certificate be used for data encryption? (y/N): ", 0); } }
long long get_data_encipherment_status() { unsigned long long v1; if (*(got.batch)) { v1 = *((got.cfg + 576)); return v1; } v1 = read_yesno("Will the certificate be used for data encryption? (y/N): ", 0x0); return v1; }
gnutls
angr_sailr
static void print_full_info(char const *username) { struct passwd *pwd; struct group *grp; printf(gettext("uid=%s"), uidtostr_ptr(&(ruid))); pwd = getpwuid(ruid); if (pwd) printf("(%s)", pwd->pw_name); printf(gettext(" gid=%s"), gidtostr_ptr(&(rgid))); grp = getgrgid(rgid); if (grp) printf("(%s)", grp->gr_name); if (euid != ruid) { printf(gettext(" euid=%s"), uidtostr_ptr(&(euid))); pwd = getpwuid(euid); if (pwd) printf("(%s)", pwd->pw_name); } if (egid != rgid) { printf(gettext(" egid=%s"), gidtostr_ptr(&(egid))); grp = getgrgid(egid); if (grp) printf("(%s)", grp->gr_name); } { gid_t *groups; gid_t primary_group; if (username) primary_group = pwd ? pwd->pw_gid : -1; else primary_group = egid; int n_groups = xgetgroups(username, primary_group, &groups); if (n_groups < 0) { if (username) error(0, (*__errno_location()), gettext("failed to get groups for user %s"), quote(username)); else error(0, (*__errno_location()), gettext("failed to get groups for the current process")); ok &= 0; return; } if (n_groups > 0) fputs_unlocked(gettext(" groups="), stdout); for (int i = 0; i < n_groups; i++) { if (i > 0) putchar_unlocked(','); fputs_unlocked(gidtostr_ptr(&(groups[i])), stdout); grp = getgrgid(groups[i]); if (grp) printf("(%s)", grp->gr_name); } free(groups); } if (context) printf(gettext(" context=%s"), context); }
void print_full_info(unsigned long long a0) { unsigned int v0; unsigned int v1; unsigned int v2; char v3; struct_0 *v4; unsigned long long *v5; char v6; unsigned long long v8; unsigned long long v9; unsigned long long v10; unsigned long long v11; unsigned long long v13; unsigned long long *v14; unsigned long long v15; v8 = uidtostr_ptr(&ruid); printf(gettext("uid=%s")); v4 = &getpwuid(ruid)->pw_name; if (v4) printf("(%s)", v4->field_0); v9 = gidtostr_ptr(&rgid); printf(gettext(" gid=%s")); v5 = &getgrgid(rgid)->gr_name; if (v5) printf("(%s)", *(v5)); if (euid != ruid) { v10 = uidtostr_ptr(&euid); printf(gettext(" euid=%s")); v4 = &getpwuid(euid)->pw_name; if (v4) printf("(%s)", v4->field_0); } if (egid != rgid) { v11 = gidtostr_ptr(&egid); printf(gettext(" egid=%s")); v5 = &getgrgid(egid)->gr_name; if (v5) printf("(%s)", *(v5)); } if (!a0) v0 = egid; else v0 = (!v4 ? v4->field_14 : -1); v2 = xgetgroups(a0, v0, &v3, v0); if (v2 < 0) { if (a0) { v13 = quote(a0); error(0x0, *(__errno_location()), gettext("failed to get groups for user %s")); } else { error(0x0, *(__errno_location()), gettext("failed to get groups for the current process")); } ok = 0; } else { if (v2 > 0) fputs_unlocked(gettext(" groups="), stdout); for (v1 = 0; v1 < v2; v1 += 1) { if (v1 > 0) putchar_unlocked(0x2c); fputs_unlocked(gidtostr_ptr(*(&v3) + v1 * 4), stdout); v5 = &getgrgid(*((*(&v3) + v1 * 4)))->gr_name; if (v5) printf("(%s)", *(v5)); } free(*(&v3)); if (context) printf(gettext(" context=%s")); } v15 = *(&v6) ^ v14[5]; return; }
coreutils
angr_sailr
static const char *legal_pathopt(const char *opt, const char *term, int magic) { switch (magic) { case 0: opt = ((void *)0); break; case 1: opt = prefix(opt, "builtin") ?: prefix(opt, "func"); break; default: opt += strcspn(opt, term); break; } if (opt && *opt == '%') opt++; return opt; }
int legal_pathopt(char *a0, char *a1, unsigned long a2) { void *v0; unsigned long long v2; v0 = a0; if (!a2) { v0 = 0; } else if (a2 != 1) { v0 = &v0[strcspn(v0, a1)]; } else { v2 = prefix(v0, "builtin"); if (!v2) v2 = prefix(v0, "func"); v0 = v2; } if (v0 && *(v0) == 37) v0 += 1; return v0; }
dash-0.5.11+git20210903+057cd650a4ed
angr_phoenix
int channel_still_open(struct ssh *ssh) { u_int i; Channel *c; for (i = 0; i < ssh->chanctxt->channels_alloc; i++) { c = ssh->chanctxt->channels[i]; if (c == ((void *)0)) continue; switch (c->type) { case 1: case 2: case 11: case 15: case 5: case 6: case 13: case 21: case 12: case 14: case 17: case 18: case 19: continue; case 10: continue; case 3: case 4: case 22: case 7: case 16: case 20: return 1; default: sshfatal("channels.c", __func__, 801, 1, SYSLOG_LEVEL_FATAL, ((void *)0), "bad channel type %d", c->type); } } return 0; }
long channel_still_open(long a1) { long result; unsigned int i; unsigned int *v3; for (i = 0;; ++i) { if (i >= *(_DWORD *)(*(_QWORD *)(a1 + 2152) + 8LL)) return 0LL; v3 = *(unsigned int **)(8LL * i + **(_QWORD **)(a1 + 2152)); if (v3) break; LABEL_6:; } switch (*v3) { case 1u: case 2u: case 5u: case 6u: case 0xAu: case 0xBu: case 0xCu: case 0xDu: case 0xEu: case 0xFu: case 0x11u: case 0x12u: case 0x13u: case 0x15u: goto LABEL_6; case 3u: case 4u: case 7u: case 0x10u: case 0x14u: case 0x16u: result = 1LL; break; default: sshfatal("channels.c", "channel_still_open", 801LL, 1LL, 1LL, 0LL, "bad channel type %d", *v3); goto LABEL_6; } return result; }
openssh-portable
ida
(r = sshbuf_get_u8(m, &sig_details_present)) != 0) sshfatal("monitor_wrap.c", __func__, 532, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "parse"); if (sig_details_present && encoded_ret == 0) { if ((r = sshbuf_get_u32(m, &counter)) != 0 || (r = sshbuf_get_u8(m, &flags)) != 0) sshfatal("monitor_wrap.c", __func__, 536, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "parse sig_details"); if (sig_detailsp != ((void *)0)) { *sig_detailsp = xcalloc(1, sizeof(**sig_detailsp)); (*sig_detailsp)->sk_counter = counter; (*sig_detailsp)->sk_flags = flags; } }
void sshbuf_get_u8(void) { halt_baddata(); }
openssh-portable
ghidra
static _Bool proctab_comparator(void const *e1, void const *e2) { struct tempnode const *n1 = e1; struct tempnode const *n2 = e2; return n1->pid == n2->pid; }
bool proctab_comparator(long a1, long a2) { return *(_DWORD *)(a1 + 8) == *(_DWORD *)(a2 + 8); }
coreutils
ida
void ipv64_normalise_mapped(struct sockaddr_storage *addr, socklen_t *len) { struct sockaddr_in6 *a6 = (struct sockaddr_in6 *)addr; struct sockaddr_in *a4 = (struct sockaddr_in *)addr; struct in_addr inaddr; u_int16_t port; if (addr->ss_family != 10 || !(__extension__({ const struct in6_addr *__a = (const struct in6_addr *)(&a6->sin6_addr); __a->__in6_u.__u6_addr32[0] == 0 && __a->__in6_u.__u6_addr32[1] == 0 && __a->__in6_u.__u6_addr32[2] == htonl(0xffff); }))) return; sshlog("canohost.c", __func__, 50, 0, SYSLOG_LEVEL_DEBUG3, ((void *)0), "Normalising mapped IPv4 in IPv6 address"); memcpy(&inaddr, ((char *)&a6->sin6_addr) + 12, sizeof(inaddr)); port = a6->sin6_port; memset(a4, 0, sizeof(*a4)); a4->sin_family = 2; *len = sizeof(*a4); memcpy(&a4->sin_addr, &inaddr, sizeof(inaddr)); a4->sin_port = port; }
void ipv64_normalise_mapped(unsigned short a0[2], unsigned int *a1) { unsigned long long v0; unsigned short v1; char v2; unsigned short v3[2]; unsigned short v4[2]; unsigned int v5[3]; char v6; unsigned int v8; unsigned long long *v9; unsigned long long v10; *(&v3) = a0; *(&v4) = a0; if (a0[0] == 10) { *(&v5[0]) = v3 + 2; if (v5[0] || v5[1] || v5[2] != htonl(0xffff)) v8 = 0; else v8 = 1; if (v8) { v0 = "Normalising mapped IPv4 in IPv6 address"; sshlog("canohost.c", "ipv64_normalise_mapped", 0x32, 0x0, 0x7, 0x0); memcpy(&v2, v3 + 5, 0x4); v1 = v3[1]; memset(v4, 0x0, 0x10); v4[0] = 2; *(a1) = 16; memcpy(v4 + 1, &v2, 0x4); v4[1] = v1; } } v10 = *(&v6) ^ v9[5]; return; }
openssh-portable
angr_sailr
int strnvisx(char *mbdst, size_t dlen, const char *mbsrc, size_t len, int flags) { return istrsenvisxna(mbdst, &dlen, mbsrc, len, flags, "", ((void *)0)); }
long strnvisx(char *a1, size_t a2, const char *a3, unsigned long a4, unsigned int a5) { size_t v6[2]; v6[1] = (size_t)a1; v6[0] = a2; return istrsenvisxna(a1, v6, a3, a4, a5, byte_18FC, 0LL); }
libbsd-0.11.7
ida
void job_add(entry *e, user *u) { job *j; struct passwd *newpwd; struct passwd *temppwd; const char *uname; for (j = jhead; j != ((void *)0); j = j->next) if (j->e == e && j->u == u) return; uname = e->pwd->pw_name; if ((temppwd = getpwnam(uname)) != ((void *)0)) { char **tenvp; if ((DebugFlags & (0x0002 | 0x0001)) != 0) printf("user [%s:%ld:%ld:...] cmd=\"%s\"\n", e->pwd->pw_name, (long)temppwd->pw_uid, (long)temppwd->pw_gid, e->cmd) ; if ((newpwd = pw_dup(temppwd)) == ((void *)0)) { log_it(uname, getpid(), "ERROR", "memory allocation failed", (*__errno_location())); return; } free(e->pwd); e->pwd = newpwd; if ((tenvp = env_update_home(e->envp, e->pwd->pw_dir)) == ((void *)0)) { log_it(uname, getpid(), "ERROR", "memory allocation failed", (*__errno_location())); return; } e->envp = tenvp; } else { log_it(uname, getpid(), "ERROR", "getpwnam() failed - user unknown", (*__errno_location())); if ((DebugFlags & (0x0002 | 0x0001)) != 0) printf("%s:%d pid=%d time=%lld getpwnam(%s) failed errno=%d error=%s\n", "src/job.c", 76, getpid(), (long long)time(((void *)0)), uname, (*__errno_location()), strerror((*__errno_location()))); return; } if ((j = (job *)malloc(sizeof(job))) == ((void *)0)) return; j->next = ((void *)0); j->e = e; j->u = u; if (jhead == ((void *)0)) jhead = j; else jtail->next = j; jtail = j; }
long long job_add(struct_0 *a0, unsigned long a1) { unsigned long long v0[3]; char *v1; unsigned int v2[6]; unsigned long v3; unsigned long v4; unsigned long long v6[3]; v0[0] = jhead; while (true) { if (v0) { if (a0 == v0[1]) { v6 = v0[2]; if (a1 == v0[2]) break; } if (a1 != v0[2]) v0[0] = v0[0]; } else { v1 = a0->field_8->field_0; *(&v2[0]) = getpwnam(v1); if (v2) { if ((*(&DebugFlags) & 3)) printf("user [%s:%ld:%ld:...] cmd=\"%s\"\n", a0->field_8->field_0, v2[4], v2[5], a0->field_18); v3 = pw_dup(v2); if (!v3) { v6 = log_it(v1, getpid(), "ERROR", "memory allocation failed", *(__errno_location())); break; } else { free(a0->field_8); a0->field_8 = v3; v4 = env_update_home(a0->field_10, a0->field_8->field_20, a0->field_8->field_20); if (!v4) { v6 = log_it(v1, getpid(), "ERROR", "memory allocation failed", *(__errno_location())); break; } else { a0->field_10 = v4; v6 = malloc(0x18); v0[0] = v6; if (!v0) break; if (v0) { v0[0] = 0; v0[1] = a0; v0[2] = a1; if (!jhead) jhead[0] = v0; else jtail[0] = v0; v6 = v0; jtail[0] = v0; break; } } } } else { log_it(v1, getpid(), "ERROR", "getpwnam() failed - user unknown", *(__errno_location())); v6 = *(&DebugFlags) & 3; if ((*(&DebugFlags) & 3)) v6 = printf( "%s:%d pid=%d time=%lld getpwnam(%s) failed errno=%d error=%s\n", &g_4003a9, 76, getpid(), time(NULL), v1, *(__errno_location()), strerror(*(__errno_location()))); break; } } } return v6; }
cronie
angr_dream
static int history_def_curr(void *p, HistEventW *ev) { history_t *h = (history_t *)p; if (h->cursor != &h->list) *ev = h->cursor->ev; else { { ev->num = (h->cur > 0) ? 8 : 5; ev->str = he_errlist[(h->cur > 0) ? 8 : 5]; }; return -1; } return 0; }
long long history_def_curr(struct_0 *a0, struct_2 *a1) { unsigned long long v1; unsigned long long v2; unsigned int v3; unsigned long long v4; if (a0->field_28 != a0) { v1 = a0->field_28->field_8; *(&a1->field_0) = a0->field_28->field_0; a1->field_8 = v1; v2 = 0; } else { if (a0->field_34 > 0) v3 = 8; else v3 = 5; a1->field_0 = v3; if (a0->field_34 > 0) v4 = 8; else v4 = 5; a1->field_8 = (&he_errlist)[v4]; v2 = 4294967295; } return v2; }
libedit
angr_dream
void ct_init(attr, methodp) ush *attr; int *methodp; { int n; int bits; int length; int code; int dist; file_type = attr; file_method = methodp; compressed_len = input_len = 0L; if (static_dtree[0].dl.len != 0) return; length = 0; for (code = 0; code < 29 - 1; code++) { base_length[code] = length; for (n = 0; n < (1 << extra_lbits[code]); n++) { length_code[length++] = (uch)code; } }; length_code[length - 1] = (uch)code; dist = 0; for (code = 0; code < 16; code++) { base_dist[code] = dist; for (n = 0; n < (1 << extra_dbits[code]); n++) { dist_code[dist++] = (uch)code; } }; dist >>= 7; for (; code < 30; code++) { base_dist[code] = dist << 7; for (n = 0; n < (1 << (extra_dbits[code] - 7)); n++) { dist_code[256 + dist++] = (uch)code; } }; for (bits = 0; bits <= 15; bits++) bl_count[bits] = 0; n = 0; while (n <= 143) static_ltree[n++].dl.len = 8, bl_count[8]++; while (n <= 255) static_ltree[n++].dl.len = 9, bl_count[9]++; while (n <= 279) static_ltree[n++].dl.len = 7, bl_count[7]++; while (n <= 287) static_ltree[n++].dl.len = 8, bl_count[8]++; gen_codes((ct_data *)static_ltree, (256 + 1 + 29) + 1); for (n = 0; n < 30; n++) { static_dtree[n].dl.len = 5; static_dtree[n].fc.code = bi_reverse(n, 5); } init_block(); }
long long ct_init(unsigned long long a0, unsigned long long a1) { unsigned int v0; int tmp_12; int tmp_15; int tmp_13; unsigned int v1; unsigned int v2; unsigned int v3; unsigned int v4; unsigned long long v6; file_type = a0; file_method = a1; input_len = 0; compressed_len = input_len; v6 = g_402dc2; if (g_402dc2) return v6; v2 = 0; for (v3 = 0; v3 <= 27; v3 += 1) { *((4 * v3 + &base_length)) = v2; for (v0 = 0; v0 < (1 << (extra_lbits[v3] & 31)); v0 += 1) { tmp_12 = v2; v2 += 1; *(tmp_12 + &length_code) = v3; } } *(v2 + &g_403a3f) = v3; v4 = 0; for (v3 = 0; v3 <= 15; v3 += 1) { *((4 * v3 + &base_dist)) = v4; for (v0 = 0; v0 < (1 << (extra_dbits[v3] & 31)); v0 += 1) { tmp_12 = v4; v4 += 1; *(tmp_12 + &dist_code) = v3; } } for (v4 >>= 7; v3 <= 29; v3 += 1) { *((4 * v3 + &base_dist)) = v4 * 128; for (v0 = 0; v0 < (1 << ((extra_dbits[v3] - 7) & 31)); v0 += 1) { tmp_15 = v4; v4 += 1; *(tmp_15 + &g_403c40) = v3; } } for (v1 = 0; v1 <= 15; v1 += 1) { *((2 * v1 + &bl_count)) = 0; } for (v0 = 0; v0 <= 143; g_402ef0 = g_402ef0 + 1) { tmp_13 = v0; v0 += 1; *((4 * tmp_13 + &g_402942)) = 8; } for (; v0 <= 255; g_402ef2 = g_402ef2 + 1) { tmp_13 = v0; v0 += 1; *((4 * tmp_13 + &g_402942)) = 9; } for (; v0 <= 279; g_402eee = g_402eee + 1) { tmp_13 = v0; v0 += 1; *((4 * tmp_13 + &g_402942)) = 7; } for (; v0 <= 287; g_402ef0 = g_402ef0 + 1) { tmp_13 = v0; v0 += 1; *((4 * tmp_13 + &g_402942)) = 8; } gen_codes(&static_ltree, 0x11f); for (v0 = 0; v0 <= 29; v0 += 1) { *((4 * v0 + &g_402dc2)) = 5; *((4 * v0 + &static_dtree)) = bi_reverse(v0, 0x5, v0 * 4); } v6 = init_block(); return v6; }
gzip-1.12
angr_sailr
char *tilde_expand(char *name) { return fn_tilde_expand(name); }
void tilde_expand(undefined8 param_1) { fn_tilde_expand(param_1); return; }
libedit
ghidra
static void cleanup(int sig) { if (sig == 14) { timed_out = 1; sig = term_signal; } if (monitored_pid) { if (kill_after) { int saved_errno = (*__errno_location()); term_signal = 9; settimeout(kill_after, 0); kill_after = 0; (*__errno_location()) = saved_errno; } if (verbose) { char signame[( (((sizeof "SIGRTMAX" + (((((sizeof(int) * 8) - (!((__typeof__(int))0 < (__typeof__(int))-1))) * 146 + 484) / 485) + (!((__typeof__(int))0 < (__typeof__(int))-1))) - 1)) > (((((((sizeof(int) * 8) - (!((__typeof__(int))0 < (__typeof__(int))-1))) * 146 + 484) / 485) + (!((__typeof__(int))0 < (__typeof__(int))-1))) + 1))) ? ((sizeof "SIGRTMAX" + (((((sizeof(int) * 8) - (!((__typeof__(int))0 < (__typeof__(int))-1))) * 146 + 484) / 485) + (!((__typeof__(int))0 < (__typeof__(int))-1))) - 1)) : (((((((sizeof(int) * 8) - (!((__typeof__(int))0 < (__typeof__(int))-1))) * 146 + 484) / 485) + (!((__typeof__(int))0 < (__typeof__(int))-1))) + 1)))]; if (sig2str(sig, signame) != 0) snprintf(signame, sizeof signame, "%d", sig); error(0, 0, gettext("sending signal %s to command %s"), signame, quote(command)); } send_sig(monitored_pid, sig); if (!foreground) { send_sig(0, sig); if (sig != 9 && sig != 18) { send_sig(monitored_pid, 18); send_sig(0, 18); } } } else _exit(128 + sig); }
long long cleanup(unsigned long a0, unsigned int a1, unsigned int a2) { unsigned int v0; unsigned int v1; char v2; unsigned long long v4; v0 = a0; if (v0 == 14) { timed_out = 1; v0 = term_signal; } if (!monitored_pid) _exit(v0 - -128); if ((((BinaryOp CmpF & 69) >> 2) & 1) || (((BinaryOp CmpF & 69) >> 6) & 1) != 1) { v1 = *(__errno_location()); term_signal = 9; settimeout(0x0, a1, a2); kill_after = 0; *(__errno_location()) = v1; } if (verbose) { if (sig2str(v0, &v2, &v2)) snprintf(&v2, 0x13, "%d", v0); v4 = quote(command); error(0x0, 0x0, gettext("sending signal %s to command %s")); } send_sig(monitored_pid, v0); if (!(foreground ^ 1)) return 0; send_sig(0x0, v0); switch (v0) { case 9: case 18: return 0; default: send_sig(monitored_pid, 0x12); send_sig(0x0, 0x12); return 0; } }
coreutils
angr_sailr
static off_t file_position(int f) { static _Bool positioned[2]; static off_t position[2]; if (!positioned[f]) { positioned[f] = 1; position[f] = lseek(file_desc[f], ignore_initial[f], 1); } return position[f]; }
undefined8 file_position(int param_1) { __off_t _Var1; if (*(char *)((long)&positioned_5461 + (long)param_1) != '\x01') { *(undefined *)((long)&positioned_5461 + (long)param_1) = 1; _Var1 = lseek(*(int *)((long)&file_desc + (long)param_1 * 4), *(__off_t *)(ignore_initial + (long)param_1 * 8), 1); *(__off_t *)(position_5462 + (long)param_1 * 8) = _Var1; } return *(undefined8 *)(position_5462 + (long)param_1 * 8); }
diffutils
ghidra
_Bool cachedir_file_p (int fd) { char tagbuf[(sizeof "Signature: 8a477f597d28d172789f06886806bc55" - 1)]; return (read(fd, tagbuf, (sizeof "Signature: 8a477f597d28d172789f06886806bc55" - 1)) == (sizeof "Signature: 8a477f597d28d172789f06886806bc55" - 1) && memcmp(tagbuf, "Signature: 8a477f597d28d172789f06886806bc55", (sizeof "Signature: 8a477f597d28d172789f06886806bc55" - 1)) == 0); }
_BOOL8 cachedir_file_p(int a1) { char buf[56]; unsigned long v4; v4 = __readfsqword(0x28u); return read(a1, buf, 0x2BuLL) == 43 && !memcmp(buf, "Signature: 8a477f597d28d172789f06886806bc55", 0x2BuLL); }
tar
ida
static int uhash_update(uhash_ctx_t ctx, const u_char *input, long len) { UWORD bytes_hashed, bytes_remaining; UINT64 result_buf[(8 / 4)]; UINT8 *nh_result = (UINT8 *)&result_buf; if (ctx->msg_len + len <= 1024) { nh_update(&ctx->hash, (const UINT8 *)input, len); ctx->msg_len += len; } else { bytes_hashed = ctx->msg_len % 1024; if (ctx->msg_len == 1024) bytes_hashed = 1024; if (bytes_hashed + len >= 1024) { if (bytes_hashed) { bytes_remaining = (1024 - bytes_hashed); nh_update(&ctx->hash, (const UINT8 *)input, bytes_remaining); nh_final(&ctx->hash, nh_result); ctx->msg_len += bytes_remaining; poly_hash(ctx, (UINT32 *)nh_result); len -= bytes_remaining; input += bytes_remaining; } while (len >= 1024) { nh(&ctx->hash, (const UINT8 *)input, 1024, 1024, nh_result); ctx->msg_len += 1024; len -= 1024; input += 1024; poly_hash(ctx, (UINT32 *)nh_result); } } if (len) { nh_update(&ctx->hash, (const UINT8 *)input, len); ctx->msg_len += len; } } return (1); }
undefined8 uhash_update(long param_1, long param_2, ulong param_3) { long lVar1; long in_FS_OFFSET; ulong local_50; long local_48; uint local_38; undefined local_28[24]; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); lVar1 = __addvdi3(*(undefined4 *)(param_1 + 0x4d0), param_3); if (lVar1 < 0x401) { nh_update(param_1, param_2, param_3 & 0xffffffff); *(int *)(param_1 + 0x4d0) = (int)param_3 + *(int *)(param_1 + 0x4d0); } else { local_38 = *(uint *)(param_1 + 0x4d0) & 0x3ff; if (*(int *)(param_1 + 0x4d0) == 0x400) { local_38 = 0x400; } lVar1 = __addvdi3(local_38, param_3); local_50 = param_3; local_48 = param_2; if (0x3ff < lVar1) { if (local_38 != 0) { local_38 = 0x400 - local_38; nh_update(param_1, param_2, local_38); nh_final(param_1, local_28); *(uint *)(param_1 + 0x4d0) = *(int *)(param_1 + 0x4d0) + local_38; poly_hash(param_1, local_28); local_50 = __subvdi3(param_3, local_38); local_48 = param_2 + (ulong)local_38; } while (0x3ff < (long)local_50) { nh(param_1, local_48, 0x400, 0x400, local_28); *(int *)(param_1 + 0x4d0) = *(int *)(param_1 + 0x4d0) + 0x400; local_50 = __addvdi3(local_50, 0xfffffffffffffc00); local_48 = local_48 + 0x400; poly_hash(param_1, local_28); } } if (local_50 != 0) { nh_update(param_1, local_48, local_50 & 0xffffffff); *(int *)(param_1 + 0x4d0) = (int)local_50 + *(int *)(param_1 + 0x4d0); } } if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) { __stack_chk_fail(); } return 1; }
openssh-portable
ghidra
static void can_print_opt(struct link_util *lu, FILE *f, struct rtattr *tb[]) { if (!tb) return; if (tb[IFLA_CAN_CTRLMODE]) { struct can_ctrlmode *cm = ((void *)(((char *)(tb[IFLA_CAN_CTRLMODE])) + ((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0)))); print_ctrlmode(PRINT_ANY, cm->flags, "ctrlmode"); if (tb[IFLA_CAN_CTRLMODE_EXT]) can_print_ctrlmode_ext(f, tb[IFLA_CAN_CTRLMODE_EXT], cm->flags); } if (tb[IFLA_CAN_STATE]) { uint32_t state = rta_getattr_u32(tb[IFLA_CAN_STATE]); print_string(PRINT_ANY, "state", "state %s ", state < CAN_STATE_MAX ? can_state_names[state] : "UNKNOWN"); } if (tb[IFLA_CAN_BERR_COUNTER]) { struct can_berr_counter *bc = ((void *)(((char *)(tb[IFLA_CAN_BERR_COUNTER])) + ((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0)))); open_json_object("berr_counter"); print_uint(PRINT_ANY, "tx", "(berr-counter tx %u", bc->txerr); print_uint(PRINT_ANY, "rx", " rx %u) ", bc->rxerr); close_json_object(); } if (tb[IFLA_CAN_RESTART_MS]) { __u32 *restart_ms = ((void *)(((char *)(tb[IFLA_CAN_RESTART_MS])) + ((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0)))); print_uint(PRINT_ANY, "restart_ms", "restart-ms %u ", *restart_ms); } if (tb[IFLA_CAN_BITTIMING] && !tb[IFLA_CAN_BITRATE_CONST]) { struct can_bittiming *bt = ((void *)(((char *)(tb[IFLA_CAN_BITTIMING])) + ((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0)))); char sp[6]; open_json_object("bittiming"); can_print_nl_indent(); print_uint(PRINT_ANY, "bitrate", " bitrate %u", bt->bitrate); snprintf(sp, sizeof(sp), "%.3f", bt->sample_point / 1000.); print_string(PRINT_ANY, "sample_point", " sample-point %s", sp); can_print_nl_indent(); print_uint(PRINT_ANY, "tq", " tq %u", bt->tq); print_uint(PRINT_ANY, "prop_seg", " prop-seg %u", bt->prop_seg); print_uint(PRINT_ANY, "phase_seg1", " phase-seg1 %u", bt->phase_seg1); print_uint(PRINT_ANY, "phase_seg2", " phase-seg2 %u", bt->phase_seg2); print_uint(PRINT_ANY, "sjw", " sjw %u", bt->sjw); print_uint(PRINT_ANY, "brp", " brp %u", bt->brp); close_json_object(); } if (tb[IFLA_CAN_BITTIMING_CONST] && !tb[IFLA_CAN_BITRATE_CONST]) { struct can_bittiming_const *btc = ((void *)(((char *)(tb[IFLA_CAN_BITTIMING_CONST])) + ((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0)))); open_json_object("bittiming_const"); can_print_nl_indent(); print_string(PRINT_ANY, "name", " %s:", btc->name); can_print_timing_min_max("tseg1", " tseg1", btc->tseg1_min, btc->tseg1_max); can_print_timing_min_max("tseg2", " tseg2", btc->tseg2_min, btc->tseg2_max); can_print_timing_min_max("sjw", " sjw", 1, btc->sjw_max); can_print_timing_min_max("brp", " brp", btc->brp_min, btc->brp_max); print_uint(PRINT_ANY, "brp_inc", " brp_inc %u", btc->brp_inc); close_json_object(); } if (tb[IFLA_CAN_BITRATE_CONST]) { __u32 *bitrate_const = ((void *)(((char *)(tb[IFLA_CAN_BITRATE_CONST])) + ((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0)))); int bitrate_cnt = ((int)((tb[IFLA_CAN_BITRATE_CONST])->rta_len) - ((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0))) / sizeof(*bitrate_const); int i; __u32 bitrate = 0; if (tb[IFLA_CAN_BITTIMING]) { struct can_bittiming *bt = ((void *)(((char *)(tb[IFLA_CAN_BITTIMING])) + ((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0)))); bitrate = bt->bitrate; } can_print_nl_indent(); print_uint(PRINT_ANY, "bittiming_bitrate", " bitrate %u", bitrate); can_print_nl_indent(); open_json_array(PRINT_ANY, is_json_context() ? "bitrate_const" : " ["); for (i = 0; i < bitrate_cnt; ++i) { if (!(i % 6) && i) { can_print_nl_indent(); print_string(PRINT_FP, ((void *)0), "%s", " "); } print_uint(PRINT_ANY, ((void *)0), i < bitrate_cnt - 1 ? "%8u, " : "%8u", bitrate_const[i]); } close_json_array(PRINT_JSON, " ]"); } if (tb[IFLA_CAN_DATA_BITTIMING] && !tb[IFLA_CAN_DATA_BITRATE_CONST]) { struct can_bittiming *dbt = ((void *)(((char *)(tb[IFLA_CAN_DATA_BITTIMING])) + ((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0)))); char dsp[6]; open_json_object("data_bittiming"); can_print_nl_indent(); print_uint(PRINT_ANY, "bitrate", " dbitrate %u", dbt->bitrate); snprintf(dsp, sizeof(dsp), "%.3f", dbt->sample_point / 1000.); print_string(PRINT_ANY, "sample_point", " dsample-point %s", dsp); can_print_nl_indent(); print_uint(PRINT_ANY, "tq", " dtq %u", dbt->tq); print_uint(PRINT_ANY, "prop_seg", " dprop-seg %u", dbt->prop_seg); print_uint(PRINT_ANY, "phase_seg1", " dphase-seg1 %u", dbt->phase_seg1); print_uint(PRINT_ANY, "phase_seg2", " dphase-seg2 %u", dbt->phase_seg2); print_uint(PRINT_ANY, "sjw", " dsjw %u", dbt->sjw); print_uint(PRINT_ANY, "brp", " dbrp %u", dbt->brp); if (tb[IFLA_CAN_TDC]) can_print_tdc_opt(f, tb[IFLA_CAN_TDC]); close_json_object(); } if (tb[IFLA_CAN_DATA_BITTIMING_CONST] && !tb[IFLA_CAN_DATA_BITRATE_CONST]) { struct can_bittiming_const *dbtc = ((void *)(((char *)(tb[IFLA_CAN_DATA_BITTIMING_CONST])) + ((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0)))); open_json_object("data_bittiming_const"); can_print_nl_indent(); print_string(PRINT_ANY, "name", " %s:", dbtc->name); can_print_timing_min_max("tseg1", " dtseg1", dbtc->tseg1_min, dbtc->tseg1_max); can_print_timing_min_max("tseg2", " dtseg2", dbtc->tseg2_min, dbtc->tseg2_max); can_print_timing_min_max("sjw", " dsjw", 1, dbtc->sjw_max); can_print_timing_min_max("brp", " dbrp", dbtc->brp_min, dbtc->brp_max); print_uint(PRINT_ANY, "brp_inc", " dbrp_inc %u", dbtc->brp_inc); if (tb[IFLA_CAN_TDC]) can_print_tdc_const_opt(f, tb[IFLA_CAN_TDC]); close_json_object(); } if (tb[IFLA_CAN_DATA_BITRATE_CONST]) { __u32 *dbitrate_const = ((void *)(((char *)(tb[IFLA_CAN_DATA_BITRATE_CONST])) + ((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0)))); int dbitrate_cnt = ((int)((tb[IFLA_CAN_DATA_BITRATE_CONST])->rta_len) - ((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0))) / sizeof(*dbitrate_const); int i; __u32 dbitrate = 0; if (tb[IFLA_CAN_DATA_BITTIMING]) { struct can_bittiming *dbt = ((void *)(((char *)(tb[IFLA_CAN_DATA_BITTIMING])) + ((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0)))); dbitrate = dbt->bitrate; } can_print_nl_indent(); print_uint(PRINT_ANY, "data_bittiming_bitrate", " dbitrate %u", dbitrate); can_print_nl_indent(); open_json_array(PRINT_ANY, is_json_context() ? "data_bitrate_const" : " ["); for (i = 0; i < dbitrate_cnt; ++i) { if (!(i % 6) && i) { can_print_nl_indent(); print_string(PRINT_FP, ((void *)0), "%s", " "); } print_uint(PRINT_ANY, ((void *)0), i < dbitrate_cnt - 1 ? "%8u, " : "%8u", dbitrate_const[i]); } close_json_array(PRINT_JSON, " ]"); } if (tb[IFLA_CAN_TERMINATION_CONST] && tb[IFLA_CAN_TERMINATION]) { __u16 *trm = ((void *)(((char *)(tb[IFLA_CAN_TERMINATION])) + ((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0)))); __u16 *trm_const = ((void *)(((char *)(tb[IFLA_CAN_TERMINATION_CONST])) + ((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0)))); int trm_cnt = ((int)((tb[IFLA_CAN_TERMINATION_CONST])->rta_len) - ((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0))) / sizeof(*trm_const); int i; can_print_nl_indent(); print_hu(PRINT_ANY, "termination", " termination %hu [ ", *trm); open_json_array(PRINT_JSON, "termination_const"); for (i = 0; i < trm_cnt; ++i) print_hu(PRINT_ANY, ((void *)0), i < trm_cnt - 1 ? "%hu, " : "%hu", trm_const[i]); close_json_array(PRINT_JSON, " ]"); } if (tb[IFLA_CAN_CLOCK]) { struct can_clock *clock = ((void *)(((char *)(tb[IFLA_CAN_CLOCK])) + ((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0)))); can_print_nl_indent(); print_uint(PRINT_ANY, "clock", " clock %u ", clock->freq); } }
long long can_print_opt(unsigned long long a0, unsigned long a1, struct_0 *a2, unsigned long long a3, unsigned long a4, unsigned long long a5) { unsigned long v0; unsigned long 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; struct_2 *v11; unsigned short v12[2]; unsigned int *v13; unsigned int v14[8]; unsigned int v15[12]; unsigned int *v16; unsigned int *v17; unsigned int v18[8]; unsigned int v19[12]; unsigned int *v20; unsigned int *v21; unsigned short *v22; unsigned short *v23; unsigned int *v24; char v25; unsigned long long v27; unsigned long long v29; unsigned long long v30; unsigned long long v32; unsigned long long v33; unsigned long long v34; v1 = a0; v0 = a1; if (a2) { if (a2->field_28) { v11 = a2->field_28 + 4; print_ctrlmode(0x4, v11->field_4, "ctrlmode"); if (a2->field_88) can_print_ctrlmode_ext(v0, a2->field_88, v11->field_4); } if (a2->field_20) { v7 = rta_getattr_u32(a2->field_20); if (v7 <= 5) v27 = (&can_state_names)[v7]; else v27 = "UNKNOWN"; print_string(0x4, "state", "state %s ", v27); } if (a2->field_40) { *(&v12) = a2->field_40 + 4; open_json_object("berr_counter"); print_uint(0x4, "tx", "(berr-counter tx %u", v12[0]); print_uint(0x4, "rx", " rx %u) ", v12[1]); close_json_object(0x4, "rx", " rx %u) ", a3, a4, a5); } if (a2->field_30) { v13 = a2->field_30 + 4; print_uint(0x4, "restart_ms", "restart-ms %u ", *(v13)); } if (a2->field_8 && !a2->field_68) { *(&v14[0]) = a2->field_8 + 4; open_json_object("bittiming"); can_print_nl_indent(); print_uint(0x4, "bitrate", " bitrate %u", v14[0]); snprintf(&v25, 0x6, "%.3f", v14[0]); print_string(0x4, "sample_point", " sample-point %s", &v25); can_print_nl_indent(); print_uint(0x4, "tq", " tq %u", v14[2]); print_uint(0x4, "prop_seg", " prop-seg %u", v14[3]); print_uint(0x4, "phase_seg1", " phase-seg1 %u", v14[4]); print_uint(0x4, "phase_seg2", " phase-seg2 %u", v14[5]); print_uint(0x4, "sjw", " sjw %u", v14[6]); print_uint(0x4, "brp", " brp %u", v14[7]); close_json_object(0x4, "brp", " brp %u", a3, a4, a5); } if (a2->field_10 && !a2->field_68) { *(&v15[0]) = a2->field_10 + 4; open_json_object("bittiming_const"); can_print_nl_indent(); print_string(0x4, "name", " %s:", v15); can_print_timing_min_max("tseg1", " tseg1", v15[4], v15[5], a4, a5); can_print_timing_min_max("tseg2", " tseg2", v15[6], v15[7], a4, a5); can_print_timing_min_max("sjw", " sjw", 0x1, v15[8], a4, a5); can_print_timing_min_max("brp", " brp", v15[9], v15[10], a4, a5); print_uint(0x4, "brp_inc", " brp_inc %u", v15[11]); close_json_object(0x4, "brp_inc", " brp_inc %u", a3, a4, a5); } if (a2->field_68) { v16 = &a2->field_68[2]; v8 = a2->field_68->field_0 - 4 >> 2; v3 = 0; if (a2->field_8) { v17 = a2->field_8 + 4; v3 = *(v17); } can_print_nl_indent(); print_uint(0x4, "bittiming_bitrate", " bitrate %u", v3); can_print_nl_indent(); if (is_json_context()) v29 = "bitrate_const"; else v29 = " ["; open_json_array(0x4, v29, " bitrate %u"); for (v2 = 0; v2 < v8; v2 += 1) { if (!v2 - ((((v2 * 715827883 >> 32) - (v2 >> 31)) << 1) + ((v2 * 715827883 >> 32) - (v2 >> 31)) << 1) && v2) { can_print_nl_indent(); print_string(0x1, 0x0, "%s", " "); } if (v2 < v8 - 1) v30 = "%8u, "; else v30 = "%8u"; print_uint(0x4, 0x0, v30, v16[v2]); } close_json_array(0x2, " ]"); } if (a2->field_48 && !a2->field_70) { *(&v18[0]) = a2->field_48 + 4; open_json_object("data_bittiming"); can_print_nl_indent(); print_uint(0x4, "bitrate", " dbitrate %u", v18[0]); snprintf(&v25, 0x6, "%.3f", v18[0]); print_string(0x4, "sample_point", " dsample-point %s", &v25); can_print_nl_indent(); print_uint(0x4, "tq", " dtq %u", v18[2]); print_uint(0x4, "prop_seg", " dprop-seg %u", v18[3]); print_uint(0x4, "phase_seg1", " dphase-seg1 %u", v18[4]); print_uint(0x4, "phase_seg2", " dphase-seg2 %u", v18[5]); print_uint(0x4, "sjw", " dsjw %u", v18[6]); print_uint(0x4, "brp", " dbrp %u", v18[7]); if (a2[128102389400760774].field_20) can_print_tdc_opt(v0, a2[128102389400760774].field_20, a2[128102389400760774].field_20, a3, a4, a5); close_json_object(a0, a1, v11->field_4, a3, a4, a5); } if (a2->field_50 && !a2->field_70) { *(&v19[0]) = a2->field_50 + 4; open_json_object("data_bittiming_const"); can_print_nl_indent(); print_string(0x4, "name", " %s:", v19); can_print_timing_min_max("tseg1", " dtseg1", v19[4], v19[5], a4, a5); can_print_timing_min_max("tseg2", " dtseg2", v19[6], v19[7], a4, a5); can_print_timing_min_max("sjw", " dsjw", 0x1, v19[8], a4, a5); can_print_timing_min_max("brp", " dbrp", v19[9], v19[10], a4, a5); print_uint(0x4, "brp_inc", " dbrp_inc %u", v19[11]); if (a2[128102389400760774].field_20) can_print_tdc_const_opt(v0, a2[128102389400760774].field_20, a2[128102389400760774].field_20, a3, a4, a5); close_json_object(a0, a1, v11->field_4, a3, a4, a5); } if (a2->field_70) { v20 = &a2->field_70[2]; v9 = a2->field_70->field_0 - 4 >> 2; v5 = 0; if (a2->field_48) { v21 = a2->field_48 + 4; v5 = *(v21); } can_print_nl_indent(); print_uint(0x4, "data_bittiming_bitrate", " dbitrate %u", v5); can_print_nl_indent(); if (is_json_context()) v32 = "data_bitrate_const"; else v32 = " ["; open_json_array(0x4, v32, " dbitrate %u"); for (v4 = 0; v4 < v9; v4 += 1) { if (!v4 - ((((v4 * 715827883 >> 32) - (v4 >> 31)) << 1) + ((v4 * 715827883 >> 32) - (v4 >> 31)) << 1) && v4) { can_print_nl_indent(); print_string(0x1, 0x0, "%s", " "); } if (v4 < v9 - 1) v33 = "%8u, "; else v33 = "%8u"; print_uint(0x4, 0x0, v33, v20[v4]); } close_json_array(0x2, " ]"); } if (a2->field_60 && a2->field_58) { v22 = a2->field_58 + 4; v23 = &a2->field_60[2].field_0; v10 = a2->field_60->field_0 - 4 >> 1; can_print_nl_indent(); print_hu(0x4, "termination", " termination %hu [ ", *(v22)); open_json_array(0x2, "termination_const", " termination %hu [ "); for (v6 = 0; v6 < v10; v6 += 1) { if (v6 < v10 - 1) v34 = "%hu, "; else v34 = "%hu"; print_hu(0x4, 0x0, v34, v23[v6]); } close_json_array(0x2, " ]"); } if (a2->field_18) { v24 = a2->field_18 + 4; can_print_nl_indent(); print_uint(0x4, "clock", " clock %u ", *(v24)); } } return 0; }
iproute2-6.0.0
angr_dream
char *sshbuf_dtob16(struct sshbuf *buf) { size_t i, j, len = sshbuf_len(buf); const u_char *p = sshbuf_ptr(buf); char *ret; const char hex[] = "0123456789abcdef"; if (len == 0) return strdup(""); if ((18446744073709551615UL) / 2 <= len || (ret = malloc(len * 2 + 1)) == ((void *)0)) return ((void *)0); for (i = j = 0; i < len; i++) { ret[j++] = hex[(p[i] >> 4) & 0xf]; ret[j++] = hex[p[i] & 0xf]; } ret[j] = '\0'; return ret; }
char *sshbuf_dtob16(undefined8 param_1) { long lVar1; ulong uVar2; long lVar3; char *pcVar4; long in_FS_OFFSET; ulong local_50; long local_48; undefined8 local_28; undefined8 local_20; undefined local_18; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); uVar2 = sshbuf_len(param_1); lVar3 = sshbuf_ptr(param_1); local_28 = 0x3736353433323130; local_20 = 0x6665646362613938; local_18 = 0; if (uVar2 == 0) { pcVar4 = strdup(""); } else { if (uVar2 < 0x7fffffffffffffff) { pcVar4 = (char *)malloc(uVar2 * 2 + 1); if (pcVar4 != (char *)0x0) { local_48 = 0; for (local_50 = 0; local_50 < uVar2; local_50 = local_50 + 1) { lVar1 = local_48 + 1; pcVar4[local_48] = *(char *)((long)&local_28 + (long)(int)(uint)(*(byte *)(local_50 + lVar3) >> 4)); local_48 = local_48 + 2; pcVar4[lVar1] = *(char *)((long)&local_28 + (long)(int)(*(byte *)(local_50 + lVar3) & 0xf)); } pcVar4[local_48] = '\0'; goto LAB_00100374; } } pcVar4 = (char *)0x0; } LAB_00100374: if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) { __stack_chk_fail(); } return pcVar4; }
openssh-portable
ghidra
static struct group *get_local_group(char *grp_name) { const struct group *grp; struct group *result_grp = ((void *)0); long long int gid; char *endptr; gid = strtoll(grp_name, &endptr, 10); if (('\0' != *grp_name) && ('\0' == *endptr) && (34 != (*__errno_location())) && (gid == (gid_t)gid)) { grp = gr_locate_gid((gid_t)gid); } else { grp = gr_locate(grp_name); } if (grp != ((void *)0)) { result_grp = __gr_dup(grp); if (((void *)0) == result_grp) { fprintf(stderr, gettext("%s: Out of memory. Cannot find group '%s'.\n"), Prog, grp_name); fail_exit(10); } } return result_grp; }
int get_local_group(char *a0) { char v0; unsigned long long v1; void *v2; unsigned long long v3; v2 = 0; v3 = strtoll(a0, &v0, 0xa); if (*(a0) && !*(*(&v0)) && *(__errno_location()) != 34) { v1 = gr_locate_gid(v3); goto LABEL_401dea; } v1 = gr_locate(a0); LABEL_401dea: if (v1) { v2 = __gr_dup(v1); if (!v2) { fprintf(stderr, gettext("%s: Out of memory. Cannot find group '%s'.\n")); fail_exit(0xa); } } return v2; }
shadow
angr_phoenix
char *string_list_dollar_star(list, quoted, flags) WORD_LIST *list; int quoted, flags; { char *ret; char sep[(__ctype_get_mb_cur_max()) + 1]; if (ifs_firstc_len == 1) { sep[0] = ifs_firstc[0]; sep[1] = '\0'; } else { memcpy(sep, ifs_firstc, ifs_firstc_len); sep[ifs_firstc_len] = '\0'; } ret = string_list_internal(list, sep); return ret; }
undefined8 string_list_dollar_star(undefined8 param_1, undefined4 param_2, undefined4 param_3) { long lVar1; undefined8 uVar2; undefined *puVar3; ulong uVar4; undefined4 *puVar5; long in_FS_OFFSET; undefined4 local_68; undefined4 local_64; undefined8 local_60; size_t local_58; undefined *local_50; undefined8 local_48; long local_40; local_40 = *(long *)(in_FS_OFFSET + 0x28); local_68 = param_3; local_64 = param_2; local_60 = param_1; local_58 = __ctype_get_mb_cur_max(); uVar4 = ((local_58 + 0x10) / 0x10) * 0x10; for (puVar5 = &local_68; puVar5 != (undefined4 *)((long)&local_68 - (uVar4 & 0xfffffffffffff000)); puVar5 = (undefined4 *)((long)puVar5 + -0x1000)) { *(undefined8 *)((long)puVar5 + -8) = *(undefined8 *)((long)puVar5 + -8); } lVar1 = -(ulong)((uint)uVar4 & 0xfff); if ((uVar4 & 0xfff) != 0) { *(undefined8 *)((long)puVar5 + ((ulong)((uint)uVar4 & 0xfff) - 8) + lVar1) = *(undefined8 *)((long)puVar5 + ((ulong)((uint)uVar4 & 0xfff) - 8) + lVar1); } local_50 = (undefined *)((long)puVar5 + lVar1); if (ifs_firstc_len == 1) { *(undefined *)((long)puVar5 + lVar1) = ifs_firstc[0]; local_50[1] = 0; } else { *(undefined8 *)((long)puVar5 + lVar1 + -8) = 0x107366; memcpy((undefined *)((long)puVar5 + lVar1), ifs_firstc, ifs_firstc_len); local_50[ifs_firstc_len] = 0; } puVar3 = local_50; uVar2 = local_60; *(undefined8 *)((long)puVar5 + lVar1 + -8) = 0x107388; local_48 = string_list_internal(uVar2, puVar3); if (local_40 != *(long *)(in_FS_OFFSET + 0x28)) { __stack_chk_fail(); } return local_48; }
bash
ghidra
static inline __u16 rta_getattr_u16(const struct rtattr *rta) { return *(__u16 *)(( void *)(((char *)(rta)) + ((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0)))); }
undefined2 rta_getattr_u16(long param_1) { return *(undefined2 *)(param_1 + 4); }
iproute2-6.0.0
ghidra
static void dump_file0(struct tar_stat_info *st, char const *name, char const *p) { union block *header; char type; off_t original_size; struct timespec original_ctime; off_t block_ordinal = -1; int fd = 0; _Bool is_dir; struct tar_stat_info const *parent = st->parent; _Bool top_level = !parent; int parentfd = top_level ? chdir_fd : parent->fd; void (*diag)(char const *) = 0; if (interactive_option && !confirm("add", p)) return; assign_string(&st->orig_file_name, p); assign_string(&st->file_name, safer_name_suffix(p, 0, absolute_names_option)); transform_name(&st->file_name, 0x01); if (parentfd < 0 && !top_level) { (*__errno_location()) = -parentfd; diag = open_diag; } else if (fstatat(parentfd, name, &st->stat, fstatat_flags) != 0) diag = stat_diag; else if (file_dumpable_p(&st->stat)) { fd = subfile_open(parent, name, open_read_flags); if (fd < 0) diag = open_diag; else { st->fd = fd; if (fstat(fd, &st->stat) != 0) diag = stat_diag; } } if (diag) { file_removed_diag(p, top_level, diag); return; } st->archive_file_size = original_size = st->stat.st_size; st->atime = get_stat_atime(&st->stat); st->mtime = get_stat_mtime(&st->stat); st->ctime = original_ctime = get_stat_ctime(&st->stat); if (!(incremental_option && !top_level) && !((((st->stat.st_mode)) & 0170000) == (0040000)) && (timespec_cmp((*st).mtime, newer_mtime_option) < 0) && (!after_date_option || (timespec_cmp((*st).ctime, newer_mtime_option) < 0))) { if (!incremental_option && verbose_option) do { if ((warning_option & (0x00000100))) do { if (error_hook) error_hook(); error(0, 0, gettext("%s: file is unchanged; not dumped"), quotearg_colon(p)); } while (0); } while (0) ; return; } if (sys_file_is_archive(st)) { do { if ((warning_option & (0x00000400))) do { if (error_hook) error_hook(); error(0, 0, gettext("%s: file is the archive; not dumped"), quotearg_colon(p)); } while (0); } while (0) ; return; } is_dir = ((((st->stat.st_mode)) & 0170000) == (0040000)) != 0; if (!is_dir && dump_hard_link(st)) return; if (is_dir || ((((st->stat.st_mode)) & 0170000) == (0100000)) || 0) { _Bool ok; struct stat final_stat; xattrs_acls_get(parentfd, name, st, 0, !is_dir); xattrs_selinux_get(parentfd, name, st, fd); xattrs_xattrs_get(parentfd, name, st, fd); if (is_dir) { const char *tag_file_name; ensure_slash(&st->orig_file_name); ensure_slash(&st->file_name); if (check_exclusion_tags(st, &tag_file_name) == exclusion_tag_all) { exclusion_tag_warning(st->orig_file_name, tag_file_name, gettext("directory not dumped")); return; } ok = dump_dir(st); fd = st->fd; parentfd = top_level ? chdir_fd : parent->fd; } else { enum dump_status status; if (fd && sparse_option && (((st->stat).st_blocks) < ((st->stat).st_size / 512 + ((st->stat).st_size % 512 != 0 && (st->stat).st_size / 512 != 0)))) { status = sparse_dump_file(fd, st); if (status == dump_status_not_implemented) status = dump_regular_file(fd, st); } else status = dump_regular_file(fd, st); switch (status) { case dump_status_ok: case dump_status_short: file_count_links(st); break; case dump_status_fail: break; case dump_status_not_implemented: abort(); } ok = status == dump_status_ok; } if (ok) { if (fd < 0) { (*__errno_location()) = -fd; ok = 0; } else if (fd == 0) { if (parentfd < 0 && !top_level) { (*__errno_location()) = -parentfd; ok = 0; } else ok = fstatat(parentfd, name, &final_stat, fstatat_flags) == 0; } else ok = fstat(fd, &final_stat) == 0; if (!ok) file_removed_diag(p, top_level, stat_diag); } if (ok) { if ((timespec_cmp(get_stat_ctime(&final_stat), original_ctime) != 0 && !(remove_files_option && is_dir)) || original_size < final_stat.st_size) { do { if ((warning_option & (0x00000010))) do { if (error_hook) error_hook(); error(0, 0, gettext("%s: file changed as we read it"), quotearg_colon(p)); } while (0); } while (0) ; set_exit_status(1); } else if (atime_preserve_option == replace_atime_preserve && fd && (is_dir || original_size != 0) && set_file_atime(fd, parentfd, name, st->atime) != 0) utime_error(p); } ok &= tar_stat_close(st); if (ok && remove_files_option) queue_deferred_unlink(p, is_dir); return; } else if (((((st->stat.st_mode)) & 0170000) == (0120000))) { st->link_name = areadlinkat_with_size(parentfd, name, st->stat.st_size); if (!st->link_name) { if ((*__errno_location()) == 12) xalloc_die(); file_removed_diag(p, top_level, readlink_diag); return; } transform_name(&st->link_name, 0x04); if (100 - (archive_format == OLDGNU_FORMAT) < strlen(st->link_name)) write_long_link(st); xattrs_selinux_get(parentfd, name, st, 0); xattrs_xattrs_get(parentfd, name, st, 0); block_ordinal = current_block_ordinal(); st->stat.st_size = 0; header = start_header(st); if (!header) return; tar_copy_str(header->header.linkname, st->link_name, 100); header->header.typeflag = '2'; finish_header(st, header, block_ordinal); if (remove_files_option) queue_deferred_unlink(p, 0); file_count_links(st); return; } else if (((((st->stat.st_mode)) & 0170000) == (0020000))) { type = '3'; xattrs_acls_get(parentfd, name, st, 0, 1); xattrs_selinux_get(parentfd, name, st, 0); xattrs_xattrs_get(parentfd, name, st, 0); } else if (((((st->stat.st_mode)) & 0170000) == (0060000))) { type = '4'; xattrs_acls_get(parentfd, name, st, 0, 1); xattrs_selinux_get(parentfd, name, st, 0); xattrs_xattrs_get(parentfd, name, st, 0); } else if (((((st->stat.st_mode)) & 0170000) == (0010000))) { type = '6'; xattrs_acls_get(parentfd, name, st, 0, 1); xattrs_selinux_get(parentfd, name, st, 0); xattrs_xattrs_get(parentfd, name, st, 0); } else if (((((st->stat.st_mode)) & 0170000) == (0140000))) { do { if ((warning_option & (0x00000020))) do { if (error_hook) error_hook(); error(0, 0, gettext("%s: socket ignored"), quotearg_colon(p)); } while (0); } while (0); return; } else if (0) { do { if ((warning_option & (0x00000020))) do { if (error_hook) error_hook(); error(0, 0, gettext("%s: door ignored"), quotearg_colon(p)); } while (0); } while (0); return; } else { unknown_file_error(p); return; } if (archive_format == V7_FORMAT) { unknown_file_error(p); return; } block_ordinal = current_block_ordinal(); st->stat.st_size = 0; header = start_header(st); if (!header) return; header->header.typeflag = type; if (type != '6') { major_to_chars(gnu_dev_major(st->stat.st_rdev), header->header.devmajor, sizeof(header->header.devmajor)); minor_to_chars(gnu_dev_minor(st->stat.st_rdev), header->header.devminor, sizeof(header->header.devminor)); } finish_header(st, header, block_ordinal); if (remove_files_option) queue_deferred_unlink(p, 0); }
void dump_file0(undefined8 *param_1, char *param_2, undefined8 param_3) { char cVar1; byte bVar2; int iVar3; uint uVar4; undefined8 uVar5; int *piVar6; undefined8 uVar7; long lVar8; size_t sVar9; ulong uVar10; long in_FS_OFFSET; bool bVar11; bool bVar12; undefined auVar13[16]; byte local_108; char local_107; int local_104; int local_100; uint local_fc; undefined8 local_f8; long local_f0; undefined8 local_e8; long local_e0; long local_d8; long local_d0; undefined local_c8[16]; stat local_b8; long local_20; local_20 = *(long *)(in_FS_OFFSET + 0x28); local_e8 = 0xffffffffffffffff; local_100 = 0; local_e0 = param_1[0x33]; bVar11 = local_e0 == 0; local_104 = chdir_fd; if (!bVar11) { local_104 = *(int *)(local_e0 + 0x1a8); } local_f0 = 0; if (interactive_option != '\0') { iVar3 = confirm(&DAT_00104f5d, param_3); if (iVar3 == 0) goto LAB_00104aab; } assign_string(param_1, param_3); uVar5 = safer_name_suffix(param_3, 0, absolute_names_option); assign_string(param_1 + 1, uVar5); transform_name(param_1 + 1, 1); if ((-1 < local_104) || (bVar11)) { iVar3 = fstatat(local_104, param_2, (stat *)(param_1 + 0xb), fstatat_flags); if (iVar3 == 0) { cVar1 = file_dumpable_p(param_1 + 0xb); if (cVar1 != '\0') { local_100 = subfile_open(local_e0, param_2, open_read_flags); if (local_100 < 0) { local_f0 = lRam0000000000103d0a; } else { *(int *)(param_1 + 0x35) = local_100; iVar3 = fstat(local_100, (stat *)(param_1 + 0xb)); if (iVar3 != 0) { local_f0 = lRam0000000000103d4c; } } } } else { local_f0 = lRam0000000000103cb2; } } else { piVar6 = __errno_location(); *piVar6 = -local_104; local_f0 = lRam0000000000103c71; } if (local_f0 != 0) { file_removed_diag(param_3, bVar11, local_f0); goto LAB_00104aab; } local_d8 = param_1[0x11]; param_1[0x23] = local_d8; auVar13 = get_stat_atime(param_1 + 0xb); param_1[0x1d] = SUB168(auVar13, 0); param_1[0x1e] = SUB168(auVar13 >> 0x40, 0); auVar13 = get_stat_mtime(param_1 + 0xb); param_1[0x1f] = SUB168(auVar13, 0); param_1[0x20] = SUB168(auVar13 >> 0x40, 0); local_c8 = get_stat_ctime(param_1 + 0xb); param_1[0x21] = SUB168(local_c8, 0); param_1[0x22] = SUB168(local_c8 >> 0x40, 0); if (((incremental_option != '\x01') || (bVar11)) && ((*(uint *)(param_1 + 0xe) & 0xf000) != 0x4000)) { iVar3 = timespec_cmp(param_1[0x1f], param_1[0x20], newer_mtime_option, CONCAT44(after_date_option._4_4_, (int)after_date_option)); if (iVar3 < 0) { if ((int)after_date_option != 0) { iVar3 = timespec_cmp( param_1[0x21], param_1[0x22], newer_mtime_option, CONCAT44(after_date_option._4_4_, (int)after_date_option)); if (-1 < iVar3) goto LAB_00103f6f; } if (((incremental_option != '\x01') && (verbose_option != 0)) && ((warning_option & 0x100) != 0)) { if (error_hook != (code *)0x0) { (*error_hook)(); } uVar5 = quotearg_colon(param_3); uVar7 = gettext("%s: file is unchanged; not dumped"); error(0, 0, uVar7, uVar5); } goto LAB_00104aab; } } LAB_00103f6f: cVar1 = sys_file_is_archive(); if (cVar1 != '\0') { if ((warning_option & 0x400) != 0) { if (error_hook != (code *)0x0) { (*error_hook)(); } uVar5 = quotearg_colon(param_3); uVar7 = gettext("%s: file is the archive; not dumped"); error(0, 0, uVar7, uVar5); } goto LAB_00104aab; } bVar12 = (*(uint *)(param_1 + 0xe) & 0xf000) == 0x4000; if (!bVar12) { cVar1 = dump_hard_link(); if (cVar1 != '\0') goto LAB_00104aab; } if ((!bVar12) && ((*(uint *)(param_1 + 0xe) & 0xf000) != 0x8000)) { if ((*(uint *)(param_1 + 0xe) & 0xf000) == 0xa000) { uVar5 = areadlinkat_with_size(local_104, param_2, param_1[0x11]); param_1[3] = uVar5; if (param_1[3] == 0) { piVar6 = __errno_location(); if (*piVar6 == 0xc) { xalloc_die(); } file_removed_diag(param_3, bVar11, uRam00000000001045da); } else { transform_name(param_1 + 3, 4); if (archive_format == 2) { uVar10 = 99; } else { uVar10 = 100; } sVar9 = strlen((char *)param_1[3]); if (uVar10 < sVar9) { write_long_link(param_1); } xattrs_selinux_get(local_104, param_2, param_1, 0); xattrs_xattrs_get(local_104, param_2, param_1, 0); local_e8 = current_block_ordinal(); param_1[0x11] = 0; local_d0 = start_header(param_1); if (local_d0 != 0) { tar_copy_str(local_d0 + 0x9d, param_1[3], 100); *(undefined *)(local_d0 + 0x9c) = 0x32; finish_header(param_1, local_d0, local_e8); if (remove_files_option != '\0') { queue_deferred_unlink(param_3, 0); } file_count_links(param_1); } } } else { if ((*(uint *)(param_1 + 0xe) & 0xf000) == 0x2000) { local_107 = '3'; xattrs_acls_get(local_104, param_2, param_1, 0, 1); xattrs_selinux_get(local_104, param_2, param_1, 0); xattrs_xattrs_get(local_104, param_2, param_1, 0); } else if ((*(uint *)(param_1 + 0xe) & 0xf000) == 0x6000) { local_107 = '4'; xattrs_acls_get(local_104, param_2, param_1, 0, 1); xattrs_selinux_get(local_104, param_2, param_1, 0); xattrs_xattrs_get(local_104, param_2, param_1, 0); } else { if ((*(uint *)(param_1 + 0xe) & 0xf000) != 0x1000) { if ((*(uint *)(param_1 + 0xe) & 0xf000) == 0xc000) { if ((warning_option & 0x20) != 0) { if (error_hook != (code *)0x0) { (*error_hook)(); } uVar5 = quotearg_colon(param_3); uVar7 = gettext("%s: socket ignored"); error(0, 0, uVar7, uVar5); } } else { unknown_file_error(param_3); } goto LAB_00104aab; } local_107 = '6'; xattrs_acls_get(local_104, param_2, param_1, 0, 1); xattrs_selinux_get(local_104, param_2, param_1, 0); xattrs_xattrs_get(local_104, param_2, param_1, 0); } if (archive_format == 1) { unknown_file_error(param_3); } else { local_e8 = current_block_ordinal(); param_1[0x11] = 0; local_d0 = start_header(param_1); if (local_d0 != 0) { *(char *)(local_d0 + 0x9c) = local_107; if (local_107 != '6') { lVar8 = local_d0 + 0x149; uVar4 = gnu_dev_major(param_1[0x10]); major_to_chars(uVar4, lVar8, 8); lVar8 = local_d0 + 0x151; uVar4 = gnu_dev_minor(param_1[0x10]); minor_to_chars(uVar4, lVar8, 8); } finish_header(param_1, local_d0, local_e8); if (remove_files_option != '\0') { queue_deferred_unlink(param_3, 0); } } } } goto LAB_00104aab; } xattrs_acls_get(local_104, param_2, param_1, 0, !bVar12); xattrs_selinux_get(local_104, param_2, param_1); xattrs_xattrs_get(local_104, param_2, param_1); if (bVar12) { ensure_slash(param_1); ensure_slash(param_1 + 1); iVar3 = check_exclusion_tags(param_1, &local_f8); if (iVar3 == 3) { uVar5 = gettext("directory not dumped"); exclusion_tag_warning(*param_1, local_f8, uVar5); goto LAB_00104aab; } local_108 = dump_dir(); local_100 = *(int *)(param_1 + 0x35); local_104 = chdir_fd; if (!bVar11) { local_104 = *(int *)(local_e0 + 0x1a8); } } else { if ((local_100 == 0) || (sparse_option == '\0')) { LAB_00104268: local_fc = dump_regular_file(local_100, param_1); } else { lVar8 = param_1[0x11]; if (lVar8 < 0) { lVar8 = lVar8 + 0x1ff; } if (((param_1[0x11] & 0x1ff) == 0) || (param_1[0x11] + 0x1ff < 0x3ff)) { iVar3 = 0; } else { iVar3 = 1; } if ((long)iVar3 + (lVar8 >> 9) <= (long)param_1[0x13]) goto LAB_00104268; local_fc = sparse_dump_file(local_100, param_1); if (local_fc == 3) { local_fc = dump_regular_file(local_100, param_1); } } if (local_fc == 3) { abort(); } if ((local_fc < 4) && (local_fc < 2)) { file_count_links(); } local_108 = local_fc == 0; } if (local_108 != 0) { if (local_100 < 0) { piVar6 = __errno_location(); *piVar6 = -local_100; local_108 = false; } else if (local_100 == 0) { if ((-1 < local_104) || (bVar11)) { iVar3 = fstatat(local_104, param_2, &local_b8, fstatat_flags); local_108 = iVar3 == 0; } else { piVar6 = __errno_location(); *piVar6 = -local_104; local_108 = false; } } else { iVar3 = fstat(local_100, &local_b8); local_108 = iVar3 == 0; } if ((bool)local_108 != true) { file_removed_diag(param_3, bVar11, uRam00000000001043ab); } } if (local_108 != 0) { auVar13 = get_stat_ctime(&local_b8); iVar3 = timespec_cmp(SUB168(auVar13, 0), SUB168(auVar13 >> 0x40, 0), local_c8._0_8_, local_c8._8_8_); if (((iVar3 == 0) || ((remove_files_option == '\x01' && (bVar12)))) && (local_b8.st_size <= local_d8)) { if (((atime_preserve_option == 1) && (local_100 != 0)) && ((bVar12 || (local_d8 != 0)))) { iVar3 = set_file_atime(local_100, local_104, param_2, param_1[0x1d], param_1[0x1e]); if (iVar3 != 0) { utime_error(param_3); } } } else { if ((warning_option & 0x10) != 0) { if (error_hook != (code *)0x0) { (*error_hook)(); } uVar5 = quotearg_colon(param_3); uVar7 = gettext("%s: file changed as we read it"); error(0, 0, uVar7, uVar5); } set_exit_status(1); } } bVar2 = tar_stat_close(param_1); if (((bVar2 & local_108) != 0) && (remove_files_option != '\0')) { queue_deferred_unlink(param_3, bVar12); } LAB_00104aab: if (local_20 == *(long *)(in_FS_OFFSET + 0x28)) { return; } __stack_chk_fail(); }
tar
ghidra
char *get_array_value(s, flags, estatep) const char *s; int flags; array_eltstate_t *estatep; { char *retval; retval = array_value_internal(s, 0, flags, estatep); return retval; }
long long get_array_value(char *a0, unsigned long a1, void *a2) { unsigned long v0; v0 = array_value_internal(a0, 0x0, a1, a2); return v0; }
bash
angr_sailr
int get_encrypt_status(int server) { const char *msg; if (batch) { return cfg.encryption_key; } else { if (server) msg = "Will the certificate be used for encryption (RSA ciphersuites)? " "(Y/n): "; else msg = "Will the certificate be used for encryption (not required for " "TLS)? (Y/n): "; return read_yesno(msg, 1); } }
long get_encrypt_status(int a1) { if (batch) return (unsigned int)cfg[140]; if (a1) return read_yesno("Will the certificate be used for encryption (RSA " "ciphersuites)? (Y/n): ", 1u); return read_yesno("Will the certificate be used for encryption (not required " "for TLS)? (Y/n): ", 1u); }
gnutls
ida
void *xmalloc(size_t size) { void *ptr; if (size == 0) sshfatal("xmalloc.c", __func__, 39, 0, SYSLOG_LEVEL_FATAL, ((void *)0), "xmalloc: zero size"); ptr = malloc(size); if (ptr == ((void *)0)) sshfatal("xmalloc.c", __func__, 42, 0, SYSLOG_LEVEL_FATAL, ((void *)0), "xmalloc: out of memory (allocating %zu bytes)", size); return ptr; }
void *xmalloc(size_t a1) { void *v2; if (!a1) sshfatal("xmalloc.c", "xmalloc", 39LL, 0LL, 1LL, 0LL, "xmalloc: zero size"); v2 = malloc(a1); if (!v2) sshfatal("xmalloc.c", "xmalloc", 42LL, 0LL, 1LL, 0LL, "xmalloc: out of memory (allocating %zu bytes)", a1); return v2; }
openssh-portable
ida
WORD_LIST *list_rest_of_args() { register WORD_LIST *list, *args; int i; for (i = 1, list = (WORD_LIST *)((void *)0); i < 10 && dollar_vars[i]; i++) list = make_word_list(make_bare_word(dollar_vars[i]), list); for (args = rest_of_args; args; args = args->next) list = make_word_list(make_bare_word(args->word->word), list); return (((list && list->next) ? (WORD_LIST *)list_reverse((GENERIC_LIST *)list) : (WORD_LIST *)(list))); }
int list_rest_of_args() { unsigned int v0; void *v2; unsigned long long v3; struct_0 *v4; unsigned long v5; v0 = 1; for (v2 = 0; v0 <= 9; v0 += 1) { if (!dollar_vars[v0]) break; v2 = make_word_list(make_bare_word(dollar_vars[v0]), v2, v3); } for (v4 = rest_of_args; v4; v4 = v4->field_0) { v2 = make_word_list(make_bare_word(v4->field_8->field_0), v2, v3); } if (v2 && *(v2)) v5 = list_reverse(v2); if (!*(v2) || !v2) v5 = v2; return v5; }
bash
angr_dream
int _rl_arg_callback(_rl_arg_cxt cxt) { int c, r; c = _rl_arg_getchar(); if (c < 0) return (1); if (_rl_argcxt & 0x04) { _rl_argcxt &= ~0x04; rl_restore_prompt(); rl_clear_message(); (rl_readline_state &= ~(0x0000400)); rl_execute_next(c); return 0; } r = _rl_arg_dispatch(cxt, c); if (r > 0) rl_message("(arg: %d) ", rl_arg_sign * rl_numeric_arg); return (r != 1); }
bool _rl_arg_callback(undefined4 param_1) { int iVar1; bool bVar2; iVar1 = _rl_arg_getchar(); if (iVar1 < 0) { bVar2 = true; } else if ((_rl_argcxt & 4) == 0) { iVar1 = _rl_arg_dispatch(param_1, iVar1); if (0 < iVar1) { rl_message("(arg: %d) ", rl_numeric_arg * rl_arg_sign); } bVar2 = iVar1 != 1; } else { _rl_argcxt = _rl_argcxt & 0xfffffffb; rl_restore_prompt(); rl_clear_message(); rl_readline_state = rl_readline_state & 0xfffffffffffffbff; rl_execute_next(iVar1); bVar2 = false; } return bVar2; }
bash
ghidra
test_code_t test_ecdhe(gnutls_session_t session) { int ret; if (tls_ext_ok == 0) return TEST_IGNORE; sprintf(prio_str, "NONE:" "+CIPHER-ALL:+ARCFOUR-128:+3DES-CBC" ":+GOST28147-TC26Z-CNT" ":" "+COMP-NULL" ":%s:" "+MAC-ALL:+MD5:+SHA1" ":+GOST28147-TC26Z-IMIT" ":+ECDHE-RSA:+ECDHE-ECDSA:+CURVE-ALL:%s", protocol_all_str, rest); { int _ret; if ((_ret = __gnutls_priority_set_direct(session, prio_str, 266)) != TEST_SUCCEED) { return _ret; } }; gnutls_credentials_set(session, GNUTLS_CRD_CERTIFICATE, xcred); ret = test_do_handshake(session); if (ret < 0) return TEST_FAILED; return ret; }
int test_ecdhe(undefined8 param_1) { int iVar1; if (tls_ext_ok == 0) { iVar1 = 3; } else { sprintf(prio_str, "NONE:+CIPHER-ALL:+ARCFOUR-128:+3DES-CBC:+GOST28147-TC26Z-CNT:+" "COMP-NULL:%s:+MAC-ALL:+MD5:+SHA1:+GOST28147-TC26Z-IMIT:+ECDHE-RSA:" "+ECDHE-ECDSA:+CURVE-ALL:%s", protocol_all_str, rest); iVar1 = __gnutls_priority_set_direct(param_1, prio_str, 0x10a); if (iVar1 == 0) { gnutls_credentials_set(param_1, 1, xcred); iVar1 = test_do_handshake(param_1); if (iVar1 < 0) { iVar1 = 1; } } } return iVar1; }
gnutls
ghidra
int crypto_sign_ed25519_ref_isneutral_vartime( const crypto_sign_ed25519_ref_ge25519 *p) { int ret = 1; if (!crypto_sign_ed25519_ref_fe25519_iszero(&p->x)) ret = 0; if (!crypto_sign_ed25519_ref_fe25519_iseq_vartime(&p->y, &p->z)) ret = 0; return ret; }
long long crypto_sign_ed25519_ref_isneutral_vartime(unsigned long long a0) { unsigned int v0; v0 = 1; if (!crypto_sign_ed25519_ref_fe25519_iszero(a0)) v0 = 0; if (!crypto_sign_ed25519_ref_fe25519_iseq_vartime(a0 - -128, a0 + 0x100, a0 + 0x100)) v0 = 0; return v0; }
openssh-portable
angr_phoenix
char *filesystem_type(const struct stat *statp, const char *path) { static _Bool fstype_known = 0; static char *current_fstype = ((void *)0); static dev_t current_dev; if (current_fstype != ((void *)0)) { if (fstype_known && statp->st_dev == current_dev) return current_fstype; free(current_fstype); } current_dev = statp->st_dev; current_fstype = file_system_type_uncached(statp, path, &fstype_known); return current_fstype; }
void *filesystem_type(long *a1, long a2) { if (current_fstype_5906) { if (fstype_known_5905 && *a1 == current_dev_5907) return current_fstype_5906; free(current_fstype_5906); } current_dev_5907 = *a1; current_fstype_5906 = (void *)file_system_type_uncached(a1, a2, (bool *)&fstype_known_5905); return current_fstype_5906; }
findutils
ida
int main(int argc, const char *const *argv) { int ret; dpkg_set_report_piped_mode(0); dpkg_locales_init("dpkg"); dpkg_program_init("dpkg-query"); dpkg_options_parse(&argv, cmdinfos, printforhelp); admindir = dpkg_db_set_dir(admindir); if (!cipaction) badusage(gettext("need an action option")); ret = cipaction->action(argv); dpkg_program_done(); dpkg_locales_done(); return !!ret; }
int main(int argc, const char **argv, const char **envp) { char *v3; void *v5; int v6; int v7; v6 = argc; v5 = argv; dpkg_set_report_piped_mode(0LL, argv, envp); dpkg_locales_init("dpkg"); dpkg_program_init("dpkg-query"); dpkg_options_parse(&v5, &cmdinfos, "Use --help for help about querying packages."); admindir = dpkg_db_set_dir(admindir); if (!cipaction) { v3 = gettext("need an action option"); badusage(v3); } v7 = (*(long (**)(void *))(cipaction + 56LL))(v5); dpkg_program_done(); dpkg_locales_done(); return v7 != 0; }
dpkg
ida
int rl_backward_char(int count, int key) { int point; if ((__ctype_get_mb_cur_max()) == 1 || rl_byte_oriented) return (rl_backward_byte(count, key)); if (count < 0) return (rl_forward_char(-count, key)); if (count > 0) { point = rl_point; while (count > 0 && point > 0) { point = _rl_find_prev_mbchar(rl_line_buffer, point, 0x01); count--; } if (count > 0) { rl_point = 0; rl_ding(); } else rl_point = point; } return 0; }
long rl_backward_char(int a1, unsigned int a2) { int v3; int prev_mbchar; v3 = a1; if (_ctype_get_mb_cur_max() == 1 || rl_byte_oriented) return rl_backward_byte(a1, a2); if (a1 < 0) return rl_forward_char(-a1, a2); if (a1 > 0) { prev_mbchar = rl_point; while (v3 > 0 && prev_mbchar > 0) { prev_mbchar = rl_find_prev_mbchar(rl_line_buffer, (unsigned int)prev_mbchar, 1LL); --v3; } if (v3 <= 0) { rl_point = prev_mbchar; } else { rl_point = 0; rl_ding(); } } return 0LL; }
bash
ida
static void channel_post_mux_listener(struct ssh *ssh, Channel *c) { Channel *nc; struct sockaddr_storage addr; socklen_t addrlen; int newsock; uid_t euid; gid_t egid; if ((c->io_ready & 0x10) == 0) return; sshlog("channels.c", __func__, 2310, 0, SYSLOG_LEVEL_DEBUG1, ((void *)0), "multiplexing control connection"); memset(&addr, 0, sizeof(addr)); addrlen = sizeof(addr); if ((newsock = accept(c->sock, (struct sockaddr *)&addr, &addrlen)) == -1) { sshlog("channels.c", __func__, 2319, 1, SYSLOG_LEVEL_ERROR, ((void *)0), "accept: %s", strerror((*__errno_location()))); if ((*__errno_location()) == 24 || (*__errno_location()) == 23) c->notbefore = monotime() + 1; return; } if (getpeereid(newsock, &euid, &egid) == -1) { sshlog("channels.c", __func__, 2326, 1, SYSLOG_LEVEL_ERROR, ((void *)0), "getpeereid failed: %s", strerror((*__errno_location()))); close(newsock); return; } if ((euid != 0) && (getuid() != euid)) { sshlog("channels.c", __func__, 2331, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "multiplex uid mismatch: peer euid %u != uid %u", (u_int)euid, (u_int)getuid()); close(newsock); return; } nc = channel_new(ssh, "multiplex client", 16, newsock, newsock, -1, c->local_window_max, c->local_maxpacket, 0, "mux-control", 1); nc->mux_rcb = c->mux_rcb; sshlog("channels.c", __func__, 2340, 1, SYSLOG_LEVEL_DEBUG3, ((void *)0), "new mux channel %d fd %d", nc->self, nc->sock); nc->mux_rcb(ssh, nc); nc->flags |= 0x10; }
long long channel_post_mux_listener(void *a0, struct_0 *a1) { unsigned long v0; unsigned int v1; char v2; char v3; unsigned int v4; struct_1 *v5; char v6; if (!(a1->field_30 & 16)) return 0; sshlog("channels.c", "channel_post_mux_listener", 0x906, 0x0, 0x5, 0x0, "multiplexing control connection"); memset(&v6, 0x0, 0x80); v1 = 128; v4 = accept(a1->field_28, &v6, &v1); if (v4 == -1) { v0 = strerror(*(__errno_location())); sshlog("channels.c", "channel_post_mux_listener", 0x90f, 0x1, 0x2, 0x0, "accept: %s"); if (*(__errno_location()) != 24 && *(__errno_location()) != 23) return 0; a1->field_58 = __addvdi3(monotime(), 0x1); return 0; } else if (getpeereid(v4, &v2, &v3, &v2) == -1) { v0 = strerror(*(__errno_location())); sshlog("channels.c", "channel_post_mux_listener", 0x916, 0x1, 0x2, 0x0, "getpeereid failed: %s"); close(v4); return 0; } else { if (*(&v2) && getuid() != *(&v2)) { getuid(); sshlog("channels.c", "channel_post_mux_listener", 0x91b, 0x0, 0x2, 0x0, "multiplex uid mismatch: peer euid %u != uid %u"); close(v4); return 0; } v5 = channel_new(a0, "multiplex client", 0x10, v4, v4, 0xffffffff, a1->field_b4, a1->field_bc, 0x0, "mux-control", 0x1); v5->field_148 = a1->field_148; sshlog("channels.c", "channel_post_mux_listener", 0x924, 0x1, 0x7, 0x0, "new mux channel %d fd %d"); v5->field_148(a0, v5, v5, v5->field_148); v5->field_18 = v5->field_18 | 16; return 0; } }
openssh-portable
angr_sailr
static ssize_t iread_fullblock(int fd, char *buf, idx_t size) { ssize_t nread = 0; while (0 < size) { ssize_t ncurr = iread(fd, buf, size); if (ncurr < 0) return ncurr; if (ncurr == 0) break; nread += ncurr; buf += ncurr; size -= ncurr; } return nread; }
long long iread_fullblock(unsigned long a0, unsigned long a1, unsigned long a2, unsigned long a3, unsigned long a4, unsigned long a5) { unsigned long v0; unsigned long v1; void *v2; unsigned long long v3; void *v5; v1 = a1; v0 = a2; v2 = 0; while (true) { if (v0 <= 0) { LABEL_4017f2: v5 = v2; break; } else { v3 = iread(a0, v1, v0, v1, a4, a5); if ((v3 - 0 >> 63)) { v5 = v3; break; } if (!v3) goto LABEL_4017f2; v2 += v3; v1 += v3; v0 -= v3; } } return v5; }
coreutils
angr_phoenix
static int ifsync(int fd) { int ret; do { process_signals(); ret = fsync(fd); } while (ret < 0 && (*__errno_location()) == 4); return ret; }
int ifsync(unsigned long a0) { unsigned int v0; unsigned int v2; unsigned int v3; unsigned long long v4; unsigned int v5; unsigned int v6; while (true) { process_signals(a0, v2, v3, v4, v5, v6); v0 = fsync(a0); if (v0 >= 0) break; if (*(__errno_location()) != 4) break; } return v0; }
coreutils
angr_dream
void reset_shell_flags() { mark_modified_vars = disallow_filename_globbing = 0; place_keywords_in_env = read_but_dont_execute = just_one_command = 0; noclobber = unbound_vars_is_error = 0; echo_command_at_execute = jobs_m_flag = forced_interactive = 0; no_symbolic_links = 0; privileged_mode = pipefail_opt = 0; error_trace_mode = function_trace_mode = 0; exit_immediately_on_error = errexit_flag = 0; echo_input_at_read = verbose_flag = 0; hashing_enabled = interactive_comments = 1; asynchronous_notification = 0; histexp_flag = 0; brace_expansion = 1; restricted = 0; }
void reset_shell_flags(void) { hashing_enabled = 1; interactive_comments = 1; brace_expansion = 1; mark_modified_vars = 0; asynchronous_notification = 0; errexit_flag = 0; exit_immediately_on_error = 0; disallow_filename_globbing = 0; place_keywords_in_env = 0; read_but_dont_execute = 0; just_one_command = 0; noclobber = 0; unbound_vars_is_error = 0; echo_input_at_read = 0; verbose_flag = 0; echo_command_at_execute = 0; jobs_m_flag = 0; forced_interactive = 0; no_symbolic_links = 0; histexp_flag = 0; restricted = 0; privileged_mode = 0; function_trace_mode = 0; error_trace_mode = 0; pipefail_opt = 0; return; }
bash
ghidra
acl_t acl_copy_int(const void *buf_p) { const struct __acl *ext_acl = (struct __acl *)buf_p; const struct __acl_entry *ent_p, *end_p; size_t size; int entries; acl_obj *acl_obj_p; acl_entry_obj *entry_obj_p; if (!ext_acl || ext_acl->x_size < sizeof(struct __acl)) { (*__errno_location()) = 22; return ((void *)0); } ent_p = ext_acl->x_entries; size = ext_acl->x_size - sizeof(struct __acl); if (size % sizeof(struct __acl_entry)) { (*__errno_location()) = 22; return ((void *)0); } entries = size / sizeof(struct __acl_entry); acl_obj_p = __acl_init_obj(entries); if (acl_obj_p == ((void *)0)) return ((void *)0); end_p = ext_acl->x_entries + entries; for (; ent_p != end_p; ent_p++) { entry_obj_p = __acl_create_entry_obj(acl_obj_p); if (!entry_obj_p) goto fail; entry_obj_p->i.e_entry = *ent_p; } if (__acl_reorder_obj_p(acl_obj_p)) goto fail; return ((acl_obj_p) ? &(acl_obj_p)->i : ((void *)0)); fail: __acl_free_acl_obj(acl_obj_p); return ((void *)0); }
long long acl_copy_int(unsigned long long *a0) { unsigned int v0; int tmp_25; unsigned long long v1[5]; unsigned long v2; unsigned long long v3; unsigned long v4; unsigned long long v5[9]; void *v7; unsigned long long v8; if (!a0) { LABEL_40002d: *(__errno_location()) = 22; v7 = 0; } else { if (*(a0) <= 7) goto LABEL_40002d; v1[0] = a0 + 1; v2 = *(a0)-8; if (v2 - ((v2 * 14757395258967641293 >> 64 >> 5 << 2) + (v2 * 14757395258967641293 >> 64 >> 5) << 3)) { *(__errno_location()) = 22; v7 = 0; } else { v0 = v2 * 14757395258967641293 >> 64 >> 5; v3 = __acl_init_obj(v0); if (!v3) { v7 = 0; } else { v4 = &a0[5 * v0] + 1; while (true) { if (v1 != v4) { v5[0] = __acl_create_entry_obj(v3); if (!v5) goto LABEL_400183; tmp_25 = v1[1]; v5[4] = v1[0]; v5[5] = tmp_25; v8 = v1[3]; v5[6] = v1[2]; v5[7] = v8; v5[8] = v1[4]; v1[0] = v1 + 1; } else { if (!__acl_reorder_obj_p(v3)) { if (v3) { v7 = v3 + 8; break; } else { v7 = 0; break; } } LABEL_400183: __acl_free_acl_obj(v3); v7 = 0; break; } } } } } return v7; }
acl-2.3.1
angr_phoenix
static void _response_info(const gnutls_datum_t *data, unsigned force_print) { gnutls_ocsp_resp_t resp; int ret; gnutls_datum_t buf, rbuf; if (data->size == 0) { fprintf(stderr, "Received empty response\n"); app_exit(1); } ret = gnutls_ocsp_resp_init(&resp); if (ret < 0) { fprintf(stderr, "ocsp_resp_init: %s\n", gnutls_strerror(ret)); app_exit(1); } ret = gnutls_ocsp_resp_import2(resp, data, incert_format); if (ret == -207) { int ret2 = gnutls_ocsp_resp_import(resp, data); if (ret2 >= 0) ret = ret2; } if (ret < 0) { fprintf(stderr, "error importing response: %s\n", gnutls_strerror(ret)); app_exit(1); } if (ocsptool_options.enabled.verbose) ret = gnutls_ocsp_resp_print(resp, GNUTLS_OCSP_PRINT_FULL, &buf); else ret = gnutls_ocsp_resp_print(resp, GNUTLS_OCSP_PRINT_COMPACT, &buf); if (ret != 0) { fprintf(stderr, "ocsp_resp_print: %s\n", gnutls_strerror(ret)); app_exit(1); } if (ocsptool_options.present.outfile) { ret = gnutls_ocsp_resp_export2(resp, &rbuf, outcert_format); if (ret < 0) { fprintf(stderr, "error exporting response: %s\n", gnutls_strerror(ret)); app_exit(1); } if (outcert_format == GNUTLS_X509_FMT_PEM) fprintf(outfile, "%.*s\n", buf.size, buf.data); fwrite(rbuf.data, 1, rbuf.size, outfile); if (outcert_format == GNUTLS_X509_FMT_PEM) fprintf(outfile, "\n"); gnutls_free((void *)(rbuf.data)), rbuf.data = ((void *)0); } if (force_print || !ocsptool_options.present.outfile) { ret = gnutls_ocsp_resp_export2(resp, &rbuf, GNUTLS_X509_FMT_PEM); if (ret < 0) { fprintf(stderr, "error exporting response: %s\n", gnutls_strerror(ret)); app_exit(1); } fprintf(stdout, "%.*s\n", buf.size, buf.data); fwrite(rbuf.data, 1, rbuf.size, stdout); gnutls_free((void *)(rbuf.data)), rbuf.data = ((void *)0); } gnutls_free((void *)(buf.data)), buf.data = ((void *)0); gnutls_ocsp_resp_deinit(resp); }
void _response_info(long param_1, int param_2) { int iVar1; undefined8 uVar2; long in_FS_OFFSET; int local_48; undefined8 local_40; undefined8 local_38; uint local_30; void *local_28; uint local_20; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); if (*(int *)(param_1 + 8) == 0) { fprintf(stderr, "Received empty response\n"); app_exit(1); } iVar1 = gnutls_ocsp_resp_init(&local_40); if (iVar1 < 0) { uVar2 = gnutls_strerror(iVar1); fprintf(stderr, "ocsp_resp_init: %s\n", uVar2); app_exit(1); } local_48 = gnutls_ocsp_resp_import2(local_40, param_1, incert_format); if (local_48 == -0xcf) { iVar1 = gnutls_ocsp_resp_import(local_40, param_1); if (-1 < iVar1) { local_48 = iVar1; } } if (local_48 < 0) { uVar2 = gnutls_strerror(local_48); fprintf(stderr, "error importing response: %s\n", uVar2); app_exit(1); } if (DAT_001030bd == '\0') { local_48 = gnutls_ocsp_resp_print(local_40, 1, &local_38); } else { local_48 = gnutls_ocsp_resp_print(local_40, 0, &local_38); } if (local_48 != 0) { uVar2 = gnutls_strerror(local_48); fprintf(stderr, "ocsp_resp_print: %s\n", uVar2); app_exit(1); } if (DAT_0010303b != '\0') { iVar1 = gnutls_ocsp_resp_export2(local_40, &local_28, outcert_format); if (iVar1 < 0) { uVar2 = gnutls_strerror(iVar1); fprintf(stderr, "error exporting response: %s\n", uVar2); app_exit(1); } if (outcert_format == 1) { fprintf(outfile, "%.*s\n", (ulong)local_30, local_38); } fwrite(local_28, 1, (ulong)local_20, outfile); if (outcert_format == 1) { fprintf(outfile, "\n"); } (*gnutls_free)(local_28); local_28 = (void *)0x0; } if ((param_2 != 0) || (DAT_0010303b != '\x01')) { iVar1 = gnutls_ocsp_resp_export2(local_40, &local_28, 1); if (iVar1 < 0) { uVar2 = gnutls_strerror(iVar1); fprintf(stderr, "error exporting response: %s\n", uVar2); app_exit(1); } fprintf(stdout, "%.*s\n", (ulong)local_30, local_38); fwrite(local_28, 1, (ulong)local_20, stdout); (*gnutls_free)(local_28); local_28 = (void *)0x0; } (*gnutls_free)(local_38); local_38 = 0; gnutls_ocsp_resp_deinit(local_40); if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) { __stack_chk_fail(); } return; }
gnutls
ghidra
void rl_message(const char *format, ...) __attribute__((__format__(__printf__, 1, 2))); void rl_save_prompt(void); void rl_restore_prompt(void); int rl_kill_text(int, int); Keymap rl_get_keymap(void); void rl_set_keymap(Keymap); Keymap rl_make_bare_keymap(void); int rl_generic_bind(int, const char *, const char *, Keymap); int rl_bind_key_in_map(int, rl_command_func_t *, Keymap); int rl_set_key(const char *, rl_command_func_t *, Keymap); void rl_cleanup_after_signal(void); void rl_free_line_state(void); int rl_set_keyboard_input_timeout(int); int rl_abort(int, int); int rl_set_keymap_name(const char *, Keymap); histdata_t free_history_entry(HIST_ENTRY *); void _rl_erase_entire_line(void); typedef struct editline EditLine; typedef struct lineinfo { const char *buffer; const char *cursor; const char *lastchar; } LineInfo;
unsigned long rl_message(const char *a1, long a2, long a3, long a4, long a5, long a6, ...) { long v6; gcc_va_list arg; char s[168]; unsigned long v10; long v11; long v12; long v13; long v14; long v15; va_start(arg, a6); v11 = a2; v12 = a3; v13 = a4; v14 = a5; v15 = a6; v10 = __readfsqword(0x28u); arg[0].gp_offset = 8; vsnprintf(s, 0xA0uLL, a1, arg); rl_set_prompt(s); rl_forced_update_display((long)s, 160LL, v6); return __readfsqword(0x28u) ^ v10; }
libedit
ida
(r = sshpkt_put(ssh, cp, have)) != 0 || (r = sshpkt_send(ssh)) != 0) { sshlog("channels.c", __func__, 3072, 1, SYSLOG_LEVEL_ERROR, ssh_err(r), "send"); goto out; }
void sshpkt_put(void) { halt_baddata(); }
openssh-portable
ghidra
static void display_window_size(_Bool fancy, char const *device_name) { struct winsize win; if (get_win_size(0, &win)) { if ((*__errno_location()) != 22) ((!!sizeof(struct { _Static_assert( 1, "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), \"%s\", quotearg_n_style_colon " "(0, shell_escape_quoting_style, device_name)), assume (false))" ")"); int _gl_dummy; })) ? ((error(1, (*__errno_location()), "%s", quotearg_n_style_colon(0, shell_escape_quoting_style, device_name)), ((0) ? (void)0 : __builtin_unreachable()))) : ((error(1, (*__errno_location()), "%s", quotearg_n_style_colon(0, shell_escape_quoting_style, device_name)), ((0) ? (void)0 : __builtin_unreachable())))); if (!fancy) ((!!sizeof(struct { _Static_assert( 1, "verify_expr (" "1" ", " "(error (1, 0, gettext (\"%s: no size information for this " "device\"), quotearg_n_style_colon (0, " "shell_escape_quoting_style, device_name)), assume (false))" ")"); int _gl_dummy; })) ? ((error(1, 0, gettext("%s: no size information for this device"), quotearg_n_style_colon(0, shell_escape_quoting_style, device_name)), ((0) ? (void)0 : __builtin_unreachable()))) : ((error(1, 0, gettext("%s: no size information for this device"), quotearg_n_style_colon(0, shell_escape_quoting_style, device_name)), ((0) ? (void)0 : __builtin_unreachable())))) ; } else { wrapf(fancy ? "rows %d; columns %d;" : "%d %d\n", win.ws_row, win.ws_col); if (!fancy) current_col = 0; } }
void display_window_size(unsigned long a0, unsigned long long a1) { char v0; char v1; unsigned long long v4; unsigned long long v5; unsigned long long *v6; unsigned long long v7; if (!get_win_size(0x0, &v0)) { wrapf(); if ((a0 ^ 1)) current_col = 0; } else if (*(__errno_location()) != 22) { v4 = quotearg_n_style_colon(0x0, 0x3, a1); error(0x1, *(__errno_location()), "%s"); } else if ((a0 ^ 1)) { v5 = quotearg_n_style_colon(0x0, 0x3, a1); error(0x1, 0x0, gettext("%s: no size information for this device")); } v7 = *(&v1) ^ v6[5]; return; }
coreutils
angr_phoenix
int showvars(const char *prefix, int on, int off) { const char *sep; char **ep, **epend; ep = listvars(on, off, &epend); qsort(ep, epend - ep, sizeof(char *), vpcmp); sep = *prefix ? spcstr : prefix; for (; ep < epend; ep++) { const char *p; const char *q; p = strchrnul(*ep, '='); q = nullstr; if (*p) q = single_quote(++p); out1fmt("%s%s%.*s%s\n", prefix, sep, (int)(p - *ep), *ep, q); } return 0; }
void showvars(char *a0, unsigned long a1, unsigned long a2) { char v0; unsigned long long *v1; char *v2; unsigned long long v3; unsigned long long v4; void *v7; v1 = listvars(a1, a2, &v0); qsort(v1, *(&v0) + -0x1 * v1 >> 3, 0x8, vpcmp); for (*(&v4) = (!*(a0) ? &spcstr : a0); v1 < *(&v0); v1 += 1) { v2 = strchrnul(*(v1), 0x3d); v3 = &nullstr; if (*(v2)) { v2 += 1; v3 = single_quote(v2); } out1fmt("%s%s%.*s%s\n", a0, v4, &v2[-1 * *(v1)], *(v1), v3); } v7 = 0; return; }
dash-0.5.11+git20210903+057cd650a4ed
angr_sailr
static struct index_node *index_create(void) { struct index_node *node; node = (calloc(sizeof(struct index_node), 1)); node->prefix = (strdup("")); node->first = 128; return node; }
int index_create() { struct_0 *v0; v0 = calloc(0x418, 0x1); v0->field_0 = strdup(&g_4004fd); v0->field_10 = 128; return v0; }
kmod
angr_sailr
static int collequiv(c, equiv) int c, equiv; { if (charcmp(c, equiv, 1) == 0) return 1; return 0; }
int collequiv(unsigned long a0, unsigned long a1) { unsigned int v1; v1 = charcmp(a0, a1, 0x1); if (!v1) v1 = 1; else v1 = 0; return v1; }
bash
angr_dream
static void sshsk_free_sign_response(struct sk_sign_response *r) { if (r == ((void *)0)) return; freezero(r->sig_r, r->sig_r_len); freezero(r->sig_s, r->sig_s_len); freezero(r, sizeof(*r)); }
void sshsk_free_sign_response(long param_1) { if (param_1 != 0) { freezero(*(undefined8 *)(param_1 + 8), *(undefined8 *)(param_1 + 0x10)); freezero(*(undefined8 *)(param_1 + 0x18), *(undefined8 *)(param_1 + 0x20)); freezero(param_1, 0x28); } return; }
openssh-portable
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; }
int main(int argc, const char **argv, const char **envp) { char *decimal_point; unsigned int v4; char *v5; bool v6; char v8; char v9; bool v10; int i; int v12; char *haystack; char *v14; struct lconv *v15; v8 = 0; v9 = 0; haystack = 0LL; v10 = 1; set_program_name(*argv, argv, envp); setlocale(6, locale); bindtextdomain("coreutils", "/usr/local/share/locale"); textdomain("coreutils"); v15 = localeconv(); if (*v15->decimal_point) decimal_point = v15->decimal_point; else decimal_point = "."; _decimal_point = decimal_point; decimal_point_len = strlen(decimal_point); atexit((void (*)(void))&close_stdout); while (1) { v12 = getopt_long(argc, (char *const *)argv, "c:fLt", &long_options, 0LL); if (v12 == -1) break; if (v12 == 128) { haystack = optarg; interpret_backslash_escapes = 1; trailing_delim = (char *)locale; } else { if (v12 > 128) goto LABEL_31; if (v12 == 116) { v9 = 1; } else { if (v12 > 116) goto LABEL_31; if (v12 == 102) { v8 = 1; } else { if (v12 > 102) goto LABEL_31; if (v12 == 99) { haystack = optarg; interpret_backslash_escapes = 0; trailing_delim = "\n"; } else { if (v12 > 99) goto LABEL_31; if (v12 == 76) { follow_links = 1; } else { if (v12 > 76) goto LABEL_31; if (v12) { if (v12 <= 0) { if (v12 == -131) { version_etc(stdout, "stat", "GNU coreutils", Version, "Michael Meskes", 0LL); exit(0); } if (v12 == -130) usage(0); } LABEL_31: usage(1); } v4 = cached_modes[_xargmatch_internal("--cached", optarg, cached_args, cached_modes, 4LL, argmatch_die, 1LL)]; if (v4 == 2) { force_sync = 0; dont_sync = 1; } else if (v4 <= 2) { force_sync = v4 != 0; dont_sync = 0; } } } } } } } if (argc == optind) { v5 = gettext("missing operand"); error(0, 0, v5); usage(1); } if (haystack) { if (strstr(haystack, needle)) getenv_quoting_style(); v14 = haystack; } else { haystack = (char *)default_format(v8, v9, 0); v14 = (char *)default_format(v8, v9, 1); } for (i = optind; i < argc; ++i) { if (v8) v6 = do_statfs(argv[i], haystack); else v6 = do_stat(argv[i], haystack, v14); v10 = v10 && v6; } return !v10; }
coreutils
ida
static void mark_ancestor_dirs(FTSENT *ent) { FTSENT *p; for (p = ent->fts_parent; 0 <= p->fts_level; p = p->fts_parent) { if (p->fts_number) break; p->fts_number = 1; } }
void mark_ancestor_dirs(struct_0 *a0) { unsigned long long v0[12]; unsigned long long v2; unsigned long long v3; v0[0] = a0->field_8; while (true) { v2 = v0[11]; if (v0[11] < 0) break; v3 = v0[4]; if (v0[4]) break; v0[4] = 1; v0[0] = v0[1]; } return; }
coreutils
angr_dream
static _Bool pax_sparse_member_p(struct tar_sparse_file *file) { return file->stat_info->sparse_map_avail > 0 || file->stat_info->sparse_major > 0; }
long long pax_sparse_member_p(struct_0 *a0) { unsigned int v1; unsigned long long v2; if (!a0->field_18->field_130 && !a0->field_18->field_124) v1 = 0; if (a0->field_18->field_124 || a0->field_18->field_130) v1 = 1; v2 = v1 & 1; return v2; }
tar
angr_dream
timezone_t tzalloc(char const *name) { size_t name_size = name ? strlen(name) + 1 : 0; size_t abbr_size = name_size < ABBR_SIZE_MIN ? ABBR_SIZE_MIN : name_size + 1; timezone_t tz = malloc(((__builtin_offsetof(struct tm_zone, abbrs) + _Alignof(struct tm_zone) - 1 + (abbr_size)) & ~(_Alignof(struct tm_zone) - 1))); if (tz) { tz->next = ((void *)0); tz->tz_is_set = !!name; tz->abbrs[0] = '\0'; if (name) extend_abbrs(tz->abbrs, name, name_size); } return tz; }
_BYTE *tzalloc(const char *a1) { size_t v1; long v2; size_t v4; _BYTE *v5; if (a1) v1 = strlen(a1) + 1; else v1 = 0LL; v4 = v1; v2 = 118LL; if (v4 >= 0x76) v2 = v4; v5 = malloc((v2 + 17) & 0xFFFFFFFFFFFFFFF8LL); if (v5) { *(_QWORD *)v5 = 0LL; v5[8] = a1 != 0LL; v5[9] = 0; if (a1) extend_abbrs(v5 + 9, a1, v4); } return v5; }
gnutls
ida
int execcmd(int argc, char **argv) { if (argc > 1) { optlist[3] = 0; optlist[4] = 0; optschanged(); shellexec(argv + 1, ((&(&(&varinit[0])[1])[1])[1].text + 5), 0); } return 0; }
long execcmd(int a1, long a2) { if (a1 > 1) { *((_BYTE *)&optlist + 3) = 0; *((_BYTE *)&optlist + 4) = 0; optschanged(); shellexec(a2 + 8, varinit[14] + 5LL, 0LL); } return 0LL; }
dash-0.5.11+git20210903+057cd650a4ed
ida
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; }
void dot_or_dotdot(unsigned long long a0) { char v0; void *v2; unsigned long long v3; unsigned int v4; unsigned long long v5; if (*(a0) == 46) { if (*((a0 + 1)) == 46) v3 = 2; else v3 = 1; v0 = *((a0 + v3)); if (v0 && v0 != 47) v4 = 0; if (v0 == 47 || !v0) v4 = 1; v5 = v4 & 1; } else { v2 = 0; } return; }
coreutils
angr_dream
static void process_write(u_int32_t id) { u_int64_t off; size_t len; int r, handle, fd, ret, status; u_char *data; if ((r = get_handle(iqueue, &handle)) != 0 || (r = sshbuf_get_u64(iqueue, &off)) != 0 || (r = sshbuf_get_string(iqueue, &data, &len)) != 0) sshfatal("sftp-server.c", __func__, 864, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "parse"); sshlog("sftp-server.c", __func__, 866, 0, SYSLOG_LEVEL_DEBUG1, ((void *)0), "request %u: write \"%s\" (handle %d) off %llu len %zu", id, handle_to_name(handle), handle, (unsigned long long)off, len); fd = handle_to_fd(handle); if (fd < 0) status = 4; else { if (!(handle_to_flags(handle) & 02000) && lseek(fd, off, 0) == -1) { status = errno_to_portable((*__errno_location())); sshlog("sftp-server.c", __func__, 876, 1, SYSLOG_LEVEL_ERROR, ((void *)0), "seek \"%.100s\": %s", handle_to_name(handle), strerror((*__errno_location()))); } else { ret = write(fd, data, len); if (ret == -1) { status = errno_to_portable((*__errno_location())); sshlog("sftp-server.c", __func__, 883, 1, SYSLOG_LEVEL_ERROR, ((void *)0), "write \"%.100s\": %s", handle_to_name(handle), strerror((*__errno_location()))); } else if ((size_t)ret == len) { status = 0; handle_update_write(handle, ret); } else { sshlog("sftp-server.c", __func__, 889, 1, SYSLOG_LEVEL_DEBUG2, ((void *)0), "nothing at all written"); status = 4; } } } send_status(id, status); free(data); }
long long process_write(unsigned long a0) { unsigned long long v0; unsigned int v1; char v2; unsigned int v3; unsigned int v4; unsigned int v5; unsigned int v6; char v7; char v8; char v9; unsigned long long v10; unsigned long v11; unsigned long long v12; unsigned long v13; unsigned long long v14; unsigned long long v15; char v16; unsigned long long v19; unsigned long long v20; unsigned int v23; unsigned long long v24; unsigned long long v25; v1 = a0; v3 = get_handle(0xe87d894820ec8348, &v2); if (v3) { LABEL_4026a3: v0 = "parse"; sshfatal("sftp-server.c", "process_write", 0x360, 0x1, 0x1, ssh_err(v3)); } else { v3 = sshbuf_get_u64(0xe87d894820ec8348, &v7, &v7); if (v3 || (v3 = sshbuf_get_string(0xe87d894820ec8348, &v9, &v8, &v9), v3)) goto LABEL_4026a3; } v19 = *(&v7); v20 = *(&v2); v15 = *(&v8); v14 = v19; v13 = v20; v12 = handle_to_name(*(&v2)); v11 = v1; v10 = "request %u: write \"%s\" (handle %d) off %llu len %zu"; sshlog("sftp-server.c", "process_write", 0x362, 0x0, 0x5, 0x0, *(&v16)); v5 = handle_to_fd(*(&v2)); if (v5 < 0) { v4 = 4; } else { v23 = handle_to_flags(*(&v2)) & 0x400; if (v23 || lseek(v5, *(&v7), 0x0) != -1) { v6 = write(v5, *(&v9), *(&v8)); if (v6 == -1) { v4 = errno_to_portable(*(__errno_location())); v25 = *(&v2); v14 = strerror(*(__errno_location())); v13 = handle_to_name(v25); v12 = "write \"%.100s\": %s"; sshlog("sftp-server.c", "process_write", 0x373, 0x1, 0x2, 0x0, *(&v16)); } else if (v6 == *(&v8)) { v4 = 0; handle_update_write(*(&v2), v6); } else { v14 = "nothing at all written"; sshlog("sftp-server.c", "process_write", 0x379, 0x1, 0x6, 0x0, *(&v16)); v4 = 4; } } else { v4 = errno_to_portable(*(__errno_location())); v24 = *(&v2); v14 = strerror(*(__errno_location())); v13 = handle_to_name(v24); v12 = "seek \"%.100s\": %s"; sshlog("sftp-server.c", "process_write", 0x36c, 0x1, 0x2, 0x0, *(&v16)); } } send_status(v1, v4); free(*(&v9)); return 0; }
openssh-portable
angr_sailr