input
stringlengths
26
172k
output
stringlengths
18
318k
repo_name
stringclasses
23 values
decompiler
stringclasses
5 values
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; }
undefined4 dot_or_dotdot(char *param_1) { undefined4 uVar1; long lVar2; if (*param_1 == '.') { if (param_1[1] == '.') { lVar2 = 2; } else { lVar2 = 1; } if ((param_1[lVar2] == '\0') || (param_1[lVar2] == '/')) { uVar1 = 1; } else { uVar1 = 0; } } else { uVar1 = 0; } return uVar1; }
coreutils
ghidra
static char *get_next_path_element(path_list, path_index_pointer) char *path_list; int *path_index_pointer; { char *path; path = extract_colon_unit(path_list, path_index_pointer); if (path == 0) return (path); if (*path == '\0') { sh_xfree((path), "findcmd.c", 321); path = (char *)strcpy(sh_xmalloc((1 + strlen(".")), "findcmd.c", 322), (".")); } return (path); }
int get_next_path_element(unsigned long long a0, unsigned long long a1) { char *v0; unsigned int v2; v0 = extract_colon_unit(a0, a1, a1); if (!v0) { v2 = v0; } else { if (!*(v0)) { sh_xfree(v0, "findcmd.c", 0x141); v0 = strcpy(sh_xmalloc(strlen(".") + 1, "findcmd.c", 0x142), "."); } v2 = v0; } return v2; }
bash
angr_phoenix
static int hostget_cmd(void) { char n[4096]; FILE *f; if (!glue_strings(n, sizeof n, "/usr/local/var/spool/cron", ".cron.hostname", '/')) { fprintf(stderr, "path too long\n"); return (-2); } if (!(f = fopen(n, "r"))) { if ((*__errno_location()) == 2) fprintf(stderr, "File %s not found\n", n); else perror(n); return (-2); } if (get_string(Host, sizeof Host, f, "\n") == (-1)) { fprintf(stderr, "Error reading from %s\n", n); fclose(f); return (-2); } fclose(f); printf("%s\n", Host); fflush(stdout); log_it(RealUser, Pid, "GET HOST", Host, 0); return (0); }
int hostget_cmd() { void *v0; char v1; char v2; unsigned int v4; v2 = *(&v2); v4 = glue_strings(&v1, 0x1000, "/usr/local/var/spool/cron", ".cron.hostname", 0x2f); if (!v4) { fprintf(*(&stderr), "path too long\n"); v4 = -2; } else { v0 = fopen(&v1, "r"); if (!v0) { v4 = *(__errno_location()); if (v4 == 2) fprintf(*(&stderr), "File %s not found\n", &v1); else perror(&v1); v4 = -2; } else { v4 = get_string(&Host, 0x40, v0, "\n"); if (v4 == -1) { fprintf(*(&stderr), "Error reading from %s\n", &v1); fclose(v0); v4 = -2; } else { fclose(v0); printf("%s\n", &Host); fflush(stdout); log_it(&RealUser, Pid, "GET HOST", &Host, 0x0); v4 = 0; } } } return v4; }
cronie
angr_dream
(inode->osd2.linux2.l_i_blocks_hi != 0)) mark_inode_bad(ctx, ino); if (inode->i_flags & 0x00002000) { if (imagic_fs) { if (!ctx->inode_imagic_map) alloc_imagic_map(ctx); ext2fs_mark_inode_bitmap2(ctx->inode_imagic_map, ino); } else { if (fix_problem(ctx, 0x01002F, &pctx)) { inode->i_flags &= ~0x00002000; e2fsck_write_inode(ctx, ino, inode, "pass1"); failed_csum = 0; } } }
void mark_inode_bad(struct_0 *a0, unsigned long long a1) { unsigned long v0; unsigned long long v1; char v2; unsigned long long *v4; unsigned long long v5; if (a0->field_170) { ext2fs_mark_inode_bitmap2(a0->field_170, a1, a1); } else { clear_problem_context(&v0); v0 = e2fsck_allocate_inode_bitmap(a0->field_0, gettext("bad inode map"), 0x2, "inode_bad_map", &a0->field_170); if (v0) { v1 = 3; fix_problem(a0, 0x10024, &v0); a0->field_48 = a0->field_48 | 1; } else { ext2fs_mark_inode_bitmap2(a0->field_170, a1, a1); } } v5 = *(&v2) ^ v4[5]; return; }
e2fsprogs-1.46.5
angr_sailr
void progcomp_flush() { if (prog_completes) hash_flush(prog_completes, free_progcomp); }
long long progcomp_flush() { unsigned long long v1; v1 = prog_completes; if (prog_completes) v1 = hash_flush(prog_completes, free_progcomp); return v1; }
bash
angr_phoenix
int kex_names_valid(const char *names) { char *s, *cp, *p; if (names == ((void *)0) || strcmp(names, "") == 0) return 0; if ((s = cp = strdup(names)) == ((void *)0)) return 0; for ((p = strsep(&cp, ",")); p && *p != '\0'; (p = strsep(&cp, ","))) { if (kex_alg_by_name(p) == ((void *)0)) { sshlog("kex.c", __func__, 168, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "Unsupported KEX algorithm \"%.100s\"", p); free(s); return 0; } } sshlog("kex.c", __func__, 173, 0, SYSLOG_LEVEL_DEBUG3, ((void *)0), "kex names ok: [%s]", names); free(s); return 1; }
long long kex_names_valid(char *a0) { unsigned long v0; void *v1; char *v2; void *v3; unsigned long long v5; if (!a0) { LABEL_400182: v5 = 0; } else { if (!strcmp(a0, &g_404683)) goto LABEL_400182; v1 = strdup(a0); v3 = v1; if (!v3) { v5 = 0; } else { v2 = strsep(&v1, ","); while (true) { if (!v2) { LABEL_40025c: v0 = a0; sshlog("kex.c", "kex_names_valid", 0xad, 0x0, 0x7, 0x0, "kex names ok: [%s]"); free(v3); v5 = 1; break; } else { if (!*(v2)) goto LABEL_40025c; if (kex_alg_by_name(v2)) { v2 = strsep(&v1, ","); } else { v0 = v2; sshlog("kex.c", "kex_names_valid", 0xa8, 0x0, 0x2, 0x0, "Unsupported KEX algorithm \"%.100s\""); free(v3); v5 = 0; break; } } } } } return v5; }
openssh-portable
angr_phoenix
static __inline__ void __list_del(struct list_head *prev, struct list_head *next) { next->prev = prev; prev->next = next; }
void __list_del(unsigned long long *a0, struct_0 *a1) { char v0; unsigned long long *v2; unsigned long long v3; a1->field_8 = a0; v2 = a0; *(a0) = a1; v3 = *(&v0); return; }
e2fsprogs-1.46.5
angr_phoenix
void coproc_close(cp) struct coproc *cp; { if (cp->c_rfd >= 0) { close(cp->c_rfd); cp->c_rfd = -1; } if (cp->c_wfd >= 0) { close(cp->c_wfd); cp->c_wfd = -1; } cp->c_rsave = cp->c_wsave = -1; }
void coproc_close(long param_1) { if (-1 < *(int *)(param_1 + 0xc)) { close(*(int *)(param_1 + 0xc)); *(undefined4 *)(param_1 + 0xc) = 0xffffffff; } if (-1 < *(int *)(param_1 + 0x10)) { close(*(int *)(param_1 + 0x10)); *(undefined4 *)(param_1 + 0x10) = 0xffffffff; } *(undefined4 *)(param_1 + 0x18) = 0xffffffff; *(undefined4 *)(param_1 + 0x14) = *(undefined4 *)(param_1 + 0x18); return; }
bash
ghidra
int history_is_stifled(void) { return max_input_history != 0x7fffffff; }
long long history_is_stifled() { return *(got.max_input_history) != 2147483647; }
libedit
angr_sailr
static int sshkey_parse_private_pem_fileblob(struct sshbuf *blob, int type, const char *passphrase, struct sshkey **keyp) { EVP_PKEY *pk = ((void *)0); struct sshkey *prv = ((void *)0); BIO *bio = ((void *)0); int r; if (keyp != ((void *)0)) *keyp = ((void *)0); if ((bio = BIO_new(BIO_s_mem())) == ((void *)0) || sshbuf_len(blob) > 0x7fffffff) return -2; if (BIO_write(bio, sshbuf_ptr(blob), sshbuf_len(blob)) != (int)sshbuf_len(blob)) { r = -2; goto out; } clear_libcrypto_errors(); if ((pk = PEM_read_bio_PrivateKey(bio, ((void *)0), pem_passphrase_cb, (char *)passphrase)) == ((void *)0)) { if (passphrase != ((void *)0) && *passphrase != '\0') r = -43; else r = convert_libcrypto_error(); goto out; } if (EVP_PKEY_get_base_id(pk) == 6 && (type == KEY_UNSPEC || type == KEY_RSA)) { if ((prv = sshkey_new(KEY_UNSPEC)) == ((void *)0)) { r = -2; goto out; } prv->rsa = EVP_PKEY_get1_RSA(pk); prv->type = KEY_RSA; if (RSA_blinding_on(prv->rsa, ((void *)0)) != 1) { r = -22; goto out; } if ((r = sshkey_check_rsa_length(prv, 0)) != 0) goto out; } else if (EVP_PKEY_get_base_id(pk) == 116 && (type == KEY_UNSPEC || type == KEY_DSA)) { if ((prv = sshkey_new(KEY_UNSPEC)) == ((void *)0)) { r = -2; goto out; } prv->dsa = EVP_PKEY_get1_DSA(pk); prv->type = KEY_DSA; } else if (EVP_PKEY_get_base_id(pk) == 408 && (type == KEY_UNSPEC || type == KEY_ECDSA)) { if ((prv = sshkey_new(KEY_UNSPEC)) == ((void *)0)) { r = -2; goto out; } prv->ecdsa = EVP_PKEY_get1_EC_KEY(pk); prv->type = KEY_ECDSA; prv->ecdsa_nid = sshkey_ecdsa_key_to_nid(prv->ecdsa); if (prv->ecdsa_nid == -1 || sshkey_curve_nid_to_name(prv->ecdsa_nid) == ((void *)0) || sshkey_ec_validate_public(EC_KEY_get0_group(prv->ecdsa), EC_KEY_get0_public_key(prv->ecdsa)) != 0 || sshkey_ec_validate_private(prv->ecdsa) != 0) { r = -4; goto out; } } else { r = -4; goto out; } r = 0; if (keyp != ((void *)0)) { *keyp = prv; prv = ((void *)0); } out: BIO_free(bio); EVP_PKEY_free(pk); sshkey_free(prv); return r; }
int sshkey_parse_private_pem_fileblob(undefined8 param_1, int param_2, char *param_3, undefined8 *param_4) { int iVar1; int iVar2; undefined4 uVar3; BIO_METHOD *type; BIO *b; ulong uVar4; void *data; rsa_st *prVar5; dsa_st *pdVar6; ec_key_st *peVar7; long lVar8; EC_POINT *pEVar9; EC_GROUP *pEVar10; int local_34; EVP_PKEY *local_30; undefined4 *local_28; local_30 = (EVP_PKEY *)0x0; local_28 = (undefined4 *)0x0; if (param_4 != (undefined8 *)0x0) { *param_4 = 0; } type = BIO_s_mem(); b = BIO_new(type); if ((b == (BIO *)0x0) || (uVar4 = sshbuf_len(param_1), 0x7fffffff < uVar4)) { return -2; } iVar1 = sshbuf_len(param_1); data = (void *)sshbuf_ptr(param_1); iVar1 = BIO_write(b, data, iVar1); iVar2 = sshbuf_len(param_1); if (iVar1 != iVar2) { local_34 = -2; goto LAB_0010ba1a; } clear_libcrypto_errors(); local_30 = PEM_read_bio_PrivateKey(b, (EVP_PKEY **)0x0, pem_passphrase_cb, param_3); if (local_30 == (EVP_PKEY *)0x0) { if ((param_3 == (char *)0x0) || (*param_3 == '\0')) { local_34 = convert_libcrypto_error(); } else { local_34 = -0x2b; } goto LAB_0010ba1a; } iVar1 = EVP_PKEY_get_base_id(local_30); if ((iVar1 == 6) && ((param_2 == 0xe || (param_2 == 0)))) { local_28 = (undefined4 *)sshkey_new(0xe); if (local_28 == (undefined4 *)0x0) { local_34 = -2; goto LAB_0010ba1a; } prVar5 = EVP_PKEY_get1_RSA(local_30); *(rsa_st **)(local_28 + 2) = prVar5; *local_28 = 0; iVar1 = RSA_blinding_on(*(RSA **)(local_28 + 2), (BN_CTX *)0x0); if (iVar1 != 1) { local_34 = -0x16; goto LAB_0010ba1a; } local_34 = sshkey_check_rsa_length(local_28, 0); if (local_34 != 0) goto LAB_0010ba1a; } else { iVar1 = EVP_PKEY_get_base_id(local_30); if ((iVar1 != 0x74) || ((param_2 != 0xe && (param_2 != 1)))) { iVar1 = EVP_PKEY_get_base_id(local_30); if ((iVar1 != 0x198) || ((param_2 != 0xe && (param_2 != 2)))) { local_34 = -4; goto LAB_0010ba1a; } local_28 = (undefined4 *)sshkey_new(0xe); if (local_28 == (undefined4 *)0x0) { local_34 = -2; goto LAB_0010ba1a; } peVar7 = EVP_PKEY_get1_EC_KEY(local_30); *(ec_key_st **)(local_28 + 8) = peVar7; *local_28 = 2; uVar3 = sshkey_ecdsa_key_to_nid(*(undefined8 *)(local_28 + 8)); local_28[6] = uVar3; if ((local_28[6] != -1) && (lVar8 = sshkey_curve_nid_to_name(local_28[6]), lVar8 != 0)) { pEVar9 = EC_KEY_get0_public_key(*(EC_KEY **)(local_28 + 8)); pEVar10 = EC_KEY_get0_group(*(EC_KEY **)(local_28 + 8)); iVar1 = sshkey_ec_validate_public(pEVar10, pEVar9); if ((iVar1 == 0) && (iVar1 = sshkey_ec_validate_private(*(undefined8 *)(local_28 + 8)), iVar1 == 0)) goto LAB_0010b9f6; } local_34 = -4; goto LAB_0010ba1a; } local_28 = (undefined4 *)sshkey_new(0xe); if (local_28 == (undefined4 *)0x0) { local_34 = -2; goto LAB_0010ba1a; } pdVar6 = EVP_PKEY_get1_DSA(local_30); *(dsa_st **)(local_28 + 4) = pdVar6; *local_28 = 1; } LAB_0010b9f6: local_34 = 0; if (param_4 != (undefined8 *)0x0) { *param_4 = local_28; local_28 = (undefined4 *)0x0; } LAB_0010ba1a: BIO_free(b); EVP_PKEY_free(local_30); sshkey_free(local_28); return local_34; }
openssh-portable
ghidra
static char *glob_complete_word(text, state) const char *text; int state; { static char **matches = (char **)((void *)0); static int ind; int glen; char *ret, *ttext; if (state == 0) { rl_filename_completion_desired = 1; do { if (matches) sh_xfree((matches), "bashline.c", 3897); } while (0); if (globorig != globtext) do { if (globorig) sh_xfree((globorig), "bashline.c", 3899); } while (0); do { if (globtext) sh_xfree((globtext), "bashline.c", 3900); } while (0); ttext = bash_tilde_expand(text, 0); if (rl_explicit_arg) { globorig = (char *)strcpy( sh_xmalloc((1 + strlen(ttext)), "bashline.c", 3906), (ttext)); glen = strlen(ttext); globtext = (char *)sh_xmalloc((glen + 2), "bashline.c", 3908); strcpy(globtext, ttext); globtext[glen] = '*'; globtext[glen + 1] = '\0'; } else globtext = globorig = (char *)strcpy( sh_xmalloc((1 + strlen(ttext)), "bashline.c", 3914), (ttext)); if (ttext != text) sh_xfree((ttext), "bashline.c", 3917); matches = shell_glob_filename(globtext, 0); if ((matches) == (char **)&glob_error_return) matches = (char **)((void *)0); ind = 0; } ret = matches ? matches[ind] : (char *)((void *)0); ind++; return ret; }
undefined8 glob_complete_word(char *param_1, int param_2) { int iVar1; char *__s; size_t sVar2; char *pcVar3; undefined8 uVar4; if (param_2 == 0) { _rl_filename_completion_desired = 1; if (matches_11928 != (undefined *)0x0) { sh_xfree(matches_11928, "bashline.c", 0xf39); } if ((globorig != globtext) && (globorig != (char *)0x0)) { sh_xfree(globorig, "bashline.c", 0xf3b); } if (globtext != (char *)0x0) { sh_xfree(globtext, "bashline.c", 0xf3c); } __s = (char *)bash_tilde_expand(param_1, 0); if (rl_explicit_arg == 0) { sVar2 = strlen(__s); pcVar3 = (char *)sh_xmalloc(sVar2 + 1, "bashline.c", 0xf4a); globtext = strcpy(pcVar3, __s); globorig = globtext; } else { sVar2 = strlen(__s); pcVar3 = (char *)sh_xmalloc(sVar2 + 1, "bashline.c", 0xf42); globorig = strcpy(pcVar3, __s); sVar2 = strlen(__s); iVar1 = (int)sVar2; globtext = (char *)sh_xmalloc((long)(iVar1 + 2), "bashline.c", 0xf44); strcpy(globtext, __s); globtext[iVar1] = '*'; globtext[(long)iVar1 + 1] = '\0'; } if (__s != param_1) { sh_xfree(__s, "bashline.c", 0xf4d); } matches_11928 = (undefined *)shell_glob_filename(globtext, 0); if (matches_11928 == &glob_error_return) { matches_11928 = (undefined *)0x0; } ind_11929 = 0; } if (matches_11928 == (undefined *)0x0) { uVar4 = 0; } else { uVar4 = *(undefined8 *)(matches_11928 + (long)ind_11929 * 8); } ind_11929 = ind_11929 + 1; return uVar4; }
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)))); }
int rta_getattr_u16(struct_0 *a0) { return a0->field_4; }
iproute2-6.0.0
angr_dream
int do_ipmonitor(int argc, char **argv) { unsigned int groups = 0, lmask = 0; char *file = ((void *)0); int ifindex = 0; rtnl_close(&rth); while (argc > 0) { if (matches(*argv, "file") == 0) { do { argv++; if (--argc <= 0) incomplete_command(); } while (0); file = *argv; } else if (matches(*argv, "label") == 0) { prefix_banner = 1; } else if (matches(*argv, "link") == 0) { lmask |= (1UL << (0)); } else if (matches(*argv, "address") == 0) { lmask |= (1UL << (1)); } else if (matches(*argv, "route") == 0) { lmask |= (1UL << (2)); } else if (matches(*argv, "mroute") == 0) { lmask |= (1UL << (3)); } else if (matches(*argv, "prefix") == 0) { lmask |= (1UL << (4)); } else if (matches(*argv, "neigh") == 0) { lmask |= (1UL << (5)); } else if (matches(*argv, "netconf") == 0) { lmask |= (1UL << (6)); } else if (matches(*argv, "rule") == 0) { lmask |= (1UL << (8)); } else if (matches(*argv, "nsid") == 0) { lmask |= (1UL << (9)); } else if (matches(*argv, "nexthop") == 0) { lmask |= (1UL << (10)); } else if (strcmp(*argv, "stats") == 0) { lmask |= (1UL << (7)); } else if (strcmp(*argv, "all") == 0) { prefix_banner = 1; } else if (matches(*argv, "all-nsid") == 0) { listen_all_nsid = 1; } else if (matches(*argv, "help") == 0) { usage(); } else if (strcmp(*argv, "dev") == 0) { do { argv++; if (--argc <= 0) incomplete_command(); } while (0); ifindex = ll_name_to_index(*argv); if (!ifindex) invarg("Device does not exist\n", *argv); } else { fprintf(stderr, "Argument \"%s\" is unknown, try \"ip monitor help\".\n", *argv); exit(-1); } argc--; argv++; } ipaddr_reset_filter(1, ifindex); iproute_reset_filter(ifindex); ipmroute_reset_filter(ifindex); ipneigh_reset_filter(ifindex); ipnetconf_reset_filter(ifindex); if (!lmask) lmask = (~0); if (lmask & (1UL << (0))) groups |= nl_mgrp(RTNLGRP_LINK); if (lmask & (1UL << (1))) { if (!preferred_family || preferred_family == 2) groups |= nl_mgrp(RTNLGRP_IPV4_IFADDR); if (!preferred_family || preferred_family == 10) groups |= nl_mgrp(RTNLGRP_IPV6_IFADDR); } if (lmask & (1UL << (2))) { if (!preferred_family || preferred_family == 2) groups |= nl_mgrp(RTNLGRP_IPV4_ROUTE); if (!preferred_family || preferred_family == 10) groups |= nl_mgrp(RTNLGRP_IPV6_ROUTE); if (!preferred_family || preferred_family == 28) groups |= nl_mgrp(RTNLGRP_MPLS_ROUTE); } if (lmask & (1UL << (3))) { if (!preferred_family || preferred_family == 2) groups |= nl_mgrp(RTNLGRP_IPV4_MROUTE); if (!preferred_family || preferred_family == 10) groups |= nl_mgrp(RTNLGRP_IPV6_MROUTE); } if (lmask & (1UL << (4))) { if (!preferred_family || preferred_family == 10) groups |= nl_mgrp(RTNLGRP_IPV6_PREFIX); } if (lmask & (1UL << (5))) { groups |= nl_mgrp(RTNLGRP_NEIGH); } if (lmask & (1UL << (6))) { if (!preferred_family || preferred_family == 2) groups |= nl_mgrp(RTNLGRP_IPV4_NETCONF); if (!preferred_family || preferred_family == 10) groups |= nl_mgrp(RTNLGRP_IPV6_NETCONF); if (!preferred_family || preferred_family == 28) groups |= nl_mgrp(RTNLGRP_MPLS_NETCONF); } if (lmask & (1UL << (8))) { if (!preferred_family || preferred_family == 2) groups |= nl_mgrp(RTNLGRP_IPV4_RULE); if (!preferred_family || preferred_family == 10) groups |= nl_mgrp(RTNLGRP_IPV6_RULE); } if (lmask & (1UL << (9))) { groups |= nl_mgrp(RTNLGRP_NSID); } if (file) { FILE *fp; int err; fp = fopen(file, "r"); if (fp == ((void *)0)) { perror("Cannot fopen"); exit(-1); } err = rtnl_from_file(fp, accept_msg, stdout); fclose(fp); return err; } if (rtnl_open(&rth, groups) < 0) exit(1); if (lmask & (1UL << (10)) && rtnl_add_nl_group(&rth, RTNLGRP_NEXTHOP) < 0) { fprintf(stderr, "Failed to add nexthop group to list\n"); exit(1); } if (lmask & (1UL << (7)) && rtnl_add_nl_group(&rth, RTNLGRP_STATS) < 0) { fprintf(stderr, "Failed to add stats group to list\n"); exit(1); } if (listen_all_nsid && rtnl_listen_all_nsid(&rth) < 0) exit(1); ll_init_map(&rth); netns_nsid_socket_init(); netns_map_init(); if (rtnl_listen(&rth, accept_msg, stdout) < 0) exit(2); return 0; }
long do_ipmonitor(int a1, char **a2) { unsigned int v5; int v6; unsigned int v7; unsigned int v8; char *filename; FILE *stream; v5 = 0; v6 = 0; filename = 0LL; v7 = 0; rtnl_close(&rth); while (a1 > 0) { if ((unsigned char)matches(*a2, "file") != 1) { ++a2; if (--a1 <= 0) incomplete_command(); filename = *a2; } else if ((unsigned char)matches(*a2, "label") != 1) { prefix_banner = 1; } else if ((unsigned char)matches(*a2, "link") != 1) { v6 |= 1u; } else if ((unsigned char)matches(*a2, "address") != 1) { v6 |= 2u; } else if ((unsigned char)matches(*a2, "route") != 1) { v6 |= 4u; } else if ((unsigned char)matches(*a2, "mroute") != 1) { v6 |= 8u; } else if ((unsigned char)matches(*a2, "prefix") != 1) { v6 |= 0x10u; } else if ((unsigned char)matches(*a2, "neigh") != 1) { v6 |= 0x20u; } else if ((unsigned char)matches(*a2, "netconf") != 1) { v6 |= 0x40u; } else if ((unsigned char)matches(*a2, "rule") != 1) { v6 |= 0x100u; } else if ((unsigned char)matches(*a2, "nsid") != 1) { v6 |= 0x200u; } else if ((unsigned char)matches(*a2, "nexthop") != 1) { v6 |= 0x400u; } else if (!strcmp(*a2, "stats")) { v6 |= 0x80u; } else if (!strcmp(*a2, "all")) { prefix_banner = 1; } else if ((unsigned char)matches(*a2, "all-nsid") != 1) { listen_all_nsid = 1; } else { if ((unsigned char)matches(*a2, "help") != 1) usage(); if (strcmp(*a2, "dev")) goto LABEL_41; ++a2; if (--a1 <= 0) incomplete_command(); v7 = ll_name_to_index(*a2); if (!v7) { invarg("Device does not exist\n", *a2); LABEL_41: fprintf(stderr, "Argument \"%s\" is unknown, try \"ip monitor help\".\n", *a2); exit(-1); } } --a1; ++a2; } ipaddr_reset_filter(1LL, v7); iproute_reset_filter(v7); ipmroute_reset_filter(v7); ipneigh_reset_filter(v7); ipnetconf_reset_filter(v7); if (!v6) LOWORD(v6) = -1; if ((v6 & 1) != 0) v5 = nl_mgrp(1u); if ((v6 & 2) != 0) { if (!preferred_family || preferred_family == 2) v5 |= nl_mgrp(5u); if (!preferred_family || preferred_family == 10) v5 |= nl_mgrp(9u); } if ((v6 & 4) != 0) { if (!preferred_family || preferred_family == 2) v5 |= nl_mgrp(7u); if (!preferred_family || preferred_family == 10) v5 |= nl_mgrp(0xBu); if (!preferred_family || preferred_family == 28) v5 |= nl_mgrp(0x1Bu); } if ((v6 & 8) != 0) { if (!preferred_family || preferred_family == 2) v5 |= nl_mgrp(6u); if (!preferred_family || preferred_family == 10) v5 |= nl_mgrp(0xAu); } if ((v6 & 0x10) != 0 && (!preferred_family || preferred_family == 10)) v5 |= nl_mgrp(0x12u); if ((v6 & 0x20) != 0) v5 |= nl_mgrp(3u); if ((v6 & 0x40) != 0) { if (!preferred_family || preferred_family == 2) v5 |= nl_mgrp(0x18u); if (!preferred_family || preferred_family == 10) v5 |= nl_mgrp(0x19u); if (!preferred_family || preferred_family == 28) v5 |= nl_mgrp(0x1Du); } if ((v6 & 0x100) != 0) { if (!preferred_family || preferred_family == 2) v5 |= nl_mgrp(8u); if (!preferred_family || preferred_family == 10) v5 |= nl_mgrp(0x13u); } if ((v6 & 0x200) != 0) v5 |= nl_mgrp(0x1Cu); if (filename) { stream = fopen64(filename, "r"); if (!stream) { perror("Cannot fopen"); exit(-1); } v8 = rtnl_from_file(stream, accept_msg, stdout); fclose(stream); return v8; } else { if ((int)rtnl_open(&rth, v5) < 0) exit(1); if ((v6 & 0x400) != 0 && (int)rtnl_add_nl_group(&rth, 32LL) < 0) { fprintf(stderr, "Failed to add nexthop group to list\n"); exit(1); } if ((v6 & 0x80) != 0 && (int)rtnl_add_nl_group(&rth, 36LL) < 0) { fprintf(stderr, "Failed to add stats group to list\n"); exit(1); } if (listen_all_nsid && (int)rtnl_listen_all_nsid(&rth) < 0) exit(1); ll_init_map(&rth); netns_nsid_socket_init(); netns_map_init(); if ((int)rtnl_listen(&rth, accept_msg, stdout) < 0) exit(2); return 0LL; } }
iproute2-6.0.0
ida
static __inline int __get_cpuid_count(unsigned int __leaf, unsigned int __subleaf, unsigned int *__eax, unsigned int *__ebx, unsigned int *__ecx, unsigned int *__edx) { unsigned int __ext = __leaf & 0x80000000; unsigned int __maxlevel = __get_cpuid_max(__ext, 0); if (__maxlevel == 0 || __maxlevel < __leaf) return 0; __asm__ __volatile__("cpuid\n\t" : "=a"(*__eax), "=b"(*__ebx), "=c"(*__ecx), "=d"(*__edx) : "0"(__leaf), "2"(__subleaf)); return 1; }
undefined8 __get_cpuid_count(uint param_1, undefined8 param_2, undefined4 *param_3, undefined4 *param_4, undefined4 *param_5, undefined4 *param_6) { undefined4 *puVar1; undefined4 uVar2; undefined4 uVar3; undefined4 uVar4; uint uVar5; undefined8 uVar6; uVar5 = __get_cpuid_max(param_1 & 0x80000000); if ((uVar5 == 0) || (uVar5 < param_1)) { uVar6 = 0; } else { if (param_1 == 0) { puVar1 = (undefined4 *)cpuid_basic_info(0); } else if (param_1 == 1) { puVar1 = (undefined4 *)cpuid_Version_info(1); } else if (param_1 == 2) { puVar1 = (undefined4 *)cpuid_cache_tlb_info(2); } else if (param_1 == 3) { puVar1 = (undefined4 *)cpuid_serial_info(3); } else if (param_1 == 4) { puVar1 = (undefined4 *)cpuid_Deterministic_Cache_Parameters_info(4); } else if (param_1 == 5) { puVar1 = (undefined4 *)cpuid_MONITOR_MWAIT_Features_info(5); } else if (param_1 == 6) { puVar1 = (undefined4 *)cpuid_Thermal_Power_Management_info(6); } else if (param_1 == 7) { puVar1 = (undefined4 *)cpuid_Extended_Feature_Enumeration_info(7); } else if (param_1 == 9) { puVar1 = (undefined4 *)cpuid_Direct_Cache_Access_info(9); } else if (param_1 == 10) { puVar1 = (undefined4 *)cpuid_Architectural_Performance_Monitoring_info(10); } else if (param_1 == 0xb) { puVar1 = (undefined4 *)cpuid_Extended_Topology_info(0xb); } else if (param_1 == 0xd) { puVar1 = (undefined4 *)cpuid_Processor_Extended_States_info(0xd); } else if (param_1 == 0xf) { puVar1 = (undefined4 *)cpuid_Quality_of_Service_info(0xf); } else if (param_1 == 0x80000002) { puVar1 = (undefined4 *)cpuid_brand_part1_info(0x80000002); } else if (param_1 == 0x80000003) { puVar1 = (undefined4 *)cpuid_brand_part2_info(0x80000003); } else if (param_1 == 0x80000004) { puVar1 = (undefined4 *)cpuid_brand_part3_info(0x80000004); } else { puVar1 = (undefined4 *)cpuid(param_1); } uVar2 = puVar1[1]; uVar3 = puVar1[2]; uVar4 = puVar1[3]; *param_3 = *puVar1; *param_4 = uVar2; *param_5 = uVar4; *param_6 = uVar3; uVar6 = 1; } return uVar6; }
coreutils
ghidra
static void path_coder(struct tar_stat_info const *st, char const *keyword, struct xheader *xhdr, void const *data __attribute__((unused))) { code_string(st->file_name, keyword, xhdr); }
long long path_coder(struct_0 *a0, unsigned long long a1, unsigned long long a2, unsigned long a3) { unsigned long v0; v0 = a3; return code_string(a0->field_8, a1, a2); }
tar
angr_dream
void save_builtin(builtin) BUILTIN_DESC *builtin; { BUILTIN_DESC *newbuiltin; newbuiltin = copy_builtin(builtin); if (!saved_builtins) saved_builtins = array_create(sizeof(BUILTIN_DESC *)); array_add((char *)newbuiltin, saved_builtins); }
void save_builtin(void *a0) { unsigned int v0; unsigned long long v2; *(&v0) = copy_builtin(a0); if (!saved_builtins) saved_builtins = array_create(0x8); v2 = array_add(*(&v0), saved_builtins); return; }
bash
angr_sailr
void add_starting_file(char const *file_name) { struct name *name = make_name(file_name); if (starting_file_option) { struct name *head = namelist; remname(head); free_name(head); } name->prev = ((void *)0); name->next = namelist; namelist = name; if (!nametail) nametail = namelist; name->found_count = 0; name->matching_flags = (((wildcards == enable_wildcards) ? (1 << 28) : 0) | include_anchored | matching_flags | recursion_option); name->change_dir = 0; name->directory = ((void *)0); name->parent = ((void *)0); name->cmdline = 1; starting_file_option = 1; }
long long add_starting_file(unsigned long long a0) { struct_0 *v0; void *v1; unsigned long v3; v0 = make_name(a0); if (starting_file_option) { v1 = namelist; remname(v1); free_name(v1); } v0->field_8 = 0; v0->field_0 = namelist; namelist = v0; if (!nametail) nametail = namelist; v0->field_30 = 0; if (wildcards == 2) v3 = 0x10000000; else v3 = 0; v0->field_20 = v3 | include_anchored | matching_flags | recursion_option; v0->field_28 = 0; v0->field_38 = 0; v0->field_40 = 0; v0->field_24 = 1; starting_file_option = 1; return v0; }
tar
angr_sailr
static void readcmd_handle_line(char *s, int ac, char **ap) { struct arglist arglist; struct strlist *sl; s = stalloc((char *)(s) - (char *)((void *)stacknxt)); arglist.lastp = &arglist.list; ifsbreakup(s, ac, &arglist); *arglist.lastp = ((void *)0); ifsfree(); sl = arglist.list; do { if (!sl) { do { setvar(*ap, nullstr, 0); } while (*++ap); return; } _rmescapes((sl->text), 0); setvar(*ap, sl->text, 0); sl = sl->next; } while (*++ap); }
void readcmd_handle_line(long param_1, undefined4 param_2, long *param_3) { undefined8 uVar1; long in_FS_OFFSET; long *local_50; undefined8 *local_30; undefined8 *local_28; undefined8 **local_20; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); uVar1 = stalloc(param_1 - stacknxt); local_20 = &local_28; ifsbreakup(uVar1, param_2, &local_28); local_50 = param_3; *local_20 = (undefined8 *)0x0; ifsfree(); local_30 = local_28; do { if (local_30 == (undefined8 *)0x0) goto LAB_0010007f; _rmescapes(local_30[1], 0); setvar(*local_50, local_30[1], 0); local_30 = (undefined8 *)*local_30; local_50 = local_50 + 1; } while (*local_50 != 0); LAB_00100101: if (local_10 == *(long *)(in_FS_OFFSET + 0x28)) { return; } __stack_chk_fail(); LAB_0010007f: do { setvar(*local_50, &nullstr, 0); local_50 = local_50 + 1; } while (*local_50 != 0); goto LAB_00100101; }
dash-0.5.11+git20210903+057cd650a4ed
ghidra
static Channel *rdynamic_connect_prepare(struct ssh *ssh, char *ctype, char *rname) { Channel *c; int r; c = channel_new(ssh, ctype, 21, -1, -1, -1, (64 * (32 * 1024)), (32 * 1024), 0, rname, 1); c->host_port = 0; c->path = ((void *)0); if ((r = sshpkt_start(ssh, 91)) != 0 || (r = sshpkt_put_u32(ssh, c->remote_id)) != 0 || (r = sshpkt_put_u32(ssh, c->self)) != 0 || (r = sshpkt_put_u32(ssh, c->local_window)) != 0 || (r = sshpkt_put_u32(ssh, c->local_maxpacket)) != 0) sshfatal("channels.c", __func__, 4751, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "channel %i; confirm", c->self); return c; }
void rdynamic_connect_prepare(void *a0, unsigned int a1, unsigned long long a2) { unsigned long v0; unsigned int v1; struct_0 *v2; struct_0 *v5; *(&v2) = channel_new(a0, a1, 0x15, 0xffffffff, 0xffffffff, 0xffffffff, 0x200000, 0x8000, 0x0, a2, 0x1); v2->field_98 = 0; v2->field_80 = 0; v1 = sshpkt_start(a0, 0x5b); if (!v1) { v1 = sshpkt_put_u32(a0, v2->field_8, v2->field_8); if (!v1) { v1 = sshpkt_put_u32(a0, v2->field_4, v2->field_4); if (!v1) { v1 = sshpkt_put_u32(a0, v2->field_b0, v2->field_b0); if (!v1) { v1 = sshpkt_put_u32(a0, v2->field_bc, v2->field_bc); if (!v1) goto LABEL_40fa4e; } } } } v0 = v2->field_4; sshfatal("channels.c", "rdynamic_connect_prepare", 0x128f, 0x1, 0x1, ssh_err(v1)); LABEL_40fa4e: v5 = v2; return; }
openssh-portable
angr_phoenix
void cu_prerminfavour(int argc, void **argv) { struct pkginfo *conflictor = (struct pkginfo *)argv[0]; struct pkginfo *infavour = (struct pkginfo *)argv[1]; if (cleanup_conflictor_failed++) return; maintscript_postinst( conflictor, "abort-remove", "in-favour", pkgbin_name(infavour, &infavour->available, pnaw_nonambig), versiondescribe(&infavour->available.version, vdew_nonambig), ((void *)0)); pkg_clear_eflags(conflictor, PKG_EFLAG_REINSTREQ); post_postinst_tasks(conflictor, PKG_STAT_INSTALLED); cleanup_conflictor_failed--; }
long long cu_prerminfavour(unsigned long a0, unsigned long long a1[2]) { unsigned int v0; unsigned long long v1; unsigned long long v2; unsigned long long v4; v0 = a0; v1 = a1[0]; v2 = a1[1]; v4 = cleanup_conflictor_failed; cleanup_conflictor_failed = cleanup_conflictor_failed + 1; if (!v4) { versiondescribe(v2 + 272, 0x1); maintscript_postinst(v1, "abort-remove", "in-favour", pkgbin_name(v2, v2 + 192, 0x1, v2 + 192)); pkg_clear_eflags(v1, 0x1); post_postinst_tasks(v1, 0x7); v4 = cleanup_conflictor_failed - 1; cleanup_conflictor_failed = cleanup_conflictor_failed - 1; } return v4; }
dpkg
angr_phoenix
static errcode_t alloc_size_dir(ext2_filsys fs, struct out_dir *outdir, blk_t blocks) { errcode_t retval; if (outdir->max) { retval = ext2fs_resize_array(fs->blocksize, outdir->max, blocks, &outdir->buf); if (retval) return retval; retval = ext2fs_resize_array(sizeof(ext2_dirhash_t), outdir->max, blocks, &outdir->hashes); if (retval) return retval; } else { retval = ext2fs_get_array(fs->blocksize, blocks, &outdir->buf); if (retval) return retval; retval = ext2fs_get_array(sizeof(ext2_dirhash_t), blocks, &outdir->hashes); if (retval) return retval; outdir->num = 0; } outdir->max = blocks; return 0; }
long alloc_size_dir(long param_1, undefined4 *param_2, undefined4 param_3) { long lVar1; if (param_2[1] == 0) { lVar1 = ext2fs_get_array(*(undefined4 *)(param_1 + 0x28), param_3, param_2 + 2); if (lVar1 != 0) { return lVar1; } lVar1 = ext2fs_get_array(4, param_3, param_2 + 4); if (lVar1 != 0) { return lVar1; } *param_2 = 0; } else { lVar1 = ext2fs_resize_array(*(undefined4 *)(param_1 + 0x28), param_2[1], param_3, param_2 + 2); if (lVar1 != 0) { return lVar1; } lVar1 = ext2fs_resize_array(4, param_2[1], param_3, param_2 + 4); if (lVar1 != 0) { return lVar1; } } param_2[1] = param_3; return 0; }
e2fsprogs-1.46.5
ghidra
void __print_rta_gateway(FILE *fp, unsigned char family, const char *gateway) { if (is_json_context()) { print_string(PRINT_JSON, "gateway", ((void *)0), gateway); } else { fprintf(fp, "via "); print_color_string(PRINT_FP, ifa_family_color(family), ((void *)0), "%s ", gateway); } }
void __print_rta_gateway(FILE *param_1, undefined param_2, undefined8 param_3) { char cVar1; undefined4 uVar2; cVar1 = is_json_context(); if (cVar1 == '\0') { fprintf(param_1, "via "); uVar2 = ifa_family_color(param_2); print_color_string(1, uVar2, 0, &DAT_00109f5a, param_3); } else { print_string(2, "gateway", 0, param_3); } return; }
iproute2-6.0.0
ghidra
void set_warning_option(const char *arg) { int negate = 0; int option; if (strcmp(arg, "none") == 0) { warning_option = 0; return; } if (strlen(arg) > 2 && memcmp(arg, "no-", 3) == 0) { negate = 1; arg += 3; } option = ((warning_types)[__xargmatch_internal( "--warning", arg, warning_args, (void const *)(warning_types), sizeof *(warning_types), argmatch_die)]); if (negate) warning_option &= ~option; else warning_option |= option; }
int set_warning_option(char *a1) { int result; char *s1; int v3; int v4; s1 = a1; v3 = 0; result = strcmp(a1, "none"); if (result) { if (strlen(a1) > 2 && !memcmp(a1, "no-", 3uLL)) { v3 = 1; s1 = a1 + 3; } v4 = warning_types[_xargmatch_internal("--warning", s1, &warning_args, warning_types, 4LL, argmatch_die)]; if (v3) { result = ~v4 & warning_option; warning_option = result; } else { result = v4 | warning_option; warning_option |= v4; } } else { warning_option = 0; } return result; }
tar
ida
static void write_setgroups(int proc_dir_fd, _Bool allow_setgroups) { int setgroups_fd; const char *policy; char policy_buffer[4096]; policy = "deny\n"; if (allow_setgroups) return; setgroups_fd = openat(proc_dir_fd, "setgroups", 02 | 02000000); if (setgroups_fd < 0) { if (2 == (*__errno_location())) { fprintf(stderr, gettext("%s: kernel doesn't support setgroups restrictions\n"), Prog); goto out; } fprintf(stderr, gettext("%s: couldn't open process setgroups: %s\n"), Prog, strerror((*__errno_location()))); exit(1); } if (read(setgroups_fd, policy_buffer, sizeof(policy_buffer)) < 0) { fprintf(stderr, gettext("%s: failed to read setgroups: %s\n"), Prog, strerror((*__errno_location()))); exit(1); } if (!strncmp(policy_buffer, policy, strlen(policy))) goto out; if (lseek(setgroups_fd, 0, 0) < 0) { fprintf(stderr, gettext("%s: failed to seek setgroups: %s\n"), Prog, strerror((*__errno_location()))); exit(1); } if (dprintf(setgroups_fd, "%s", policy) < 0) { fprintf(stderr, gettext("%s: failed to setgroups %s policy: %s\n"), Prog, policy, strerror((*__errno_location()))); exit(1); } out: close(setgroups_fd); }
unsigned long write_setgroups(int a1, char a2) { long v2; char *v3; int *v4; char *v5; long v6; char *v7; int *v8; char *v9; long v10; char *v11; size_t v12; int *v13; char *v14; long v15; char *v16; int *v17; char *v18; long v19; char *v20; int v22; char buf[16]; unsigned long v24; v24 = __readfsqword(0x28u); if (!a2) { v22 = openat(a1, "setgroups", 524290); if (v22 >= 0) { if (read(v22, buf, 0x1000uLL) < 0) { v8 = _errno_location(); v9 = strerror(*v8); v10 = Prog; v11 = gettext("%s: failed to read setgroups: %s\n"); fprintf(stderr, v11, v10, v9); exit(1); } v12 = strlen("deny\n"); if (strncmp(buf, "deny\n", v12)) { if (lseek(v22, 0LL, 0) < 0) { v13 = _errno_location(); v14 = strerror(*v13); v15 = Prog; v16 = gettext("%s: failed to seek setgroups: %s\n"); fprintf(stderr, v16, v15, v14); exit(1); } if (dprintf(v22, "%s", "deny\n") < 0) { v17 = _errno_location(); v18 = strerror(*v17); v19 = Prog; v20 = gettext("%s: failed to setgroups %s policy: %s\n"); fprintf(stderr, v20, v19, "deny\n", v18); exit(1); } } } else { if (*_errno_location() != 2) { v4 = _errno_location(); v5 = strerror(*v4); v6 = Prog; v7 = gettext("%s: couldn't open process setgroups: %s\n"); fprintf(stderr, v7, v6, v5); exit(1); } v2 = Prog; v3 = gettext("%s: kernel doesn't support setgroups restrictions\n"); fprintf(stderr, v3, v2); } close(v22); } return __readfsqword(0x28u) ^ v24; }
shadow
ida
static void incr(char **s0, size_t *s_len) { char *s = *s0; char *endp = s + *s_len - 1; do { if ((*endp)++ < '9') return; *endp-- = '0'; } while (endp >= s); *--(*s0) = '1'; ++*s_len; }
void incr(char **a0, unsigned long long *a1) { char *v0; int tmp_11; char *v1; unsigned long long v3; unsigned long long *v4; v1 = *(a0); v0 = &v1[1 + *(a1)]; do { v3 = *(v0); *(v0) = *(v0) + 1; if (v3 <= 56) goto LABEL_401046; tmp_11 = v0; v0 += 1; *(tmp_11) = 48; } while (v0 >= v1); *(a0) = *(a0) + 1; *(*(a0)) = 49; v4 = a1; *(a1) = *(a1) + 1; LABEL_401046: return; }
coreutils
angr_phoenix
static int list_files(const char *const *argv) { const char *thisarg; struct fsys_namenode_list *file; struct pkginfo *pkg; struct fsys_namenode *namenode; int failures = 0; if (!*argv) badusage(gettext("--%s needs at least one package name argument"), cipaction->olong); modstatdb_open(msdbrw_readonly); while ((thisarg = *argv++) != ((void *)0)) { pkg = dpkg_options_parse_pkgname(cipaction, thisarg); switch (pkg->status) { case PKG_STAT_NOTINSTALLED: notice(gettext("package '%s' is not installed"), pkg_name(pkg, pnaw_nonambig)); failures++; break; default: ensure_packagefiles_available(pkg); ensure_diversions(); file = pkg->files; if (!file) { printf(gettext("Package '%s' does not contain any files (!)\n"), pkg_name(pkg, pnaw_nonambig)); } else { while (file) { namenode = file->namenode; puts(namenode->name); if (namenode->divert && !namenode->divert->camefrom) { if (!namenode->divert->pkgset) printf(gettext("locally diverted to: %s\n"), namenode->divert->useinstead->name); else if (pkg->set == namenode->divert->pkgset) printf(gettext("package diverts others to: %s\n"), namenode->divert->useinstead->name); else printf(gettext("diverted by %s to: %s\n"), namenode->divert->pkgset->name, namenode->divert->useinstead->name); } file = file->next; } } break; } if (*argv != ((void *)0)) putchar('\n'); } m_output(stdout, gettext("<standard output>")); if (failures) { fputs(gettext("Use dpkg --contents (= dpkg-deb --contents) to list archive " "files contents.\n"), stderr); m_output(stderr, gettext("<standard error>")); } modstatdb_shutdown(); return failures; }
int list_files(long *param_1) { long *plVar1; long lVar2; FILE *__stream; undefined8 uVar3; long *plVar4; undefined8 uVar5; char *pcVar6; long *local_50; int local_3c; undefined8 *local_38; local_3c = 0; if (*param_1 == 0) { uVar5 = *cipaction; uVar3 = gettext("--%s needs at least one package name argument"); badusage(uVar3, uVar5); } modstatdb_open(0); local_50 = param_1; while (true) { plVar1 = local_50 + 1; if (*local_50 == 0) break; plVar4 = (long *)dpkg_options_parse_pkgname(cipaction, *local_50); if (*(int *)(plVar4 + 3) == 0) { uVar5 = pkg_name(plVar4, 1); uVar3 = gettext("package \'%s\' is not installed"); notice(uVar3, uVar5); local_3c = local_3c + 1; } else { ensure_packagefiles_available(plVar4); ensure_diversions(); local_38 = (undefined8 *)plVar4[0x2d]; if (local_38 == (undefined8 *)0x0) { uVar5 = pkg_name(plVar4, 1); pcVar6 = (char *)gettext("Package \'%s\' does not contain any files (!)\n"); printf(pcVar6, uVar5); } else { for (; local_38 != (undefined8 *)0x0; local_38 = (undefined8 *)*local_38) { lVar2 = local_38[1]; puts(*(char **)(lVar2 + 8)); if ((*(long *)(lVar2 + 0x18) != 0) && (*(long *)(*(long *)(lVar2 + 0x18) + 8) == 0)) { if (*(long *)(*(long *)(lVar2 + 0x18) + 0x10) == 0) { uVar5 = *(undefined8 *)(**(long **)(lVar2 + 0x18) + 8); pcVar6 = (char *)gettext("locally diverted to: %s\n"); printf(pcVar6, uVar5); } else if (*plVar4 == *(long *)(*(long *)(lVar2 + 0x18) + 0x10)) { uVar5 = *(undefined8 *)(**(long **)(lVar2 + 0x18) + 8); pcVar6 = (char *)gettext("package diverts others to: %s\n"); printf(pcVar6, uVar5); } else { uVar5 = *(undefined8 *)(**(long **)(lVar2 + 0x18) + 8); uVar3 = *( undefined8 *)(*(long *)(*(long *)(lVar2 + 0x18) + 0x10) + 8); pcVar6 = (char *)gettext("diverted by %s to: %s\n"); printf(pcVar6, uVar3, uVar5); } } } } } local_50 = plVar1; if (*plVar1 != 0) { putchar(10); } } uVar5 = gettext("<standard output>"); m_output(stdout, uVar5); __stream = stderr; if (local_3c != 0) { pcVar6 = (char *)gettext("Use dpkg --contents (= dpkg-deb --contents) to " "list archive files contents.\n"); fputs(pcVar6, __stream); uVar5 = gettext("<standard error>"); m_output(stderr, uVar5); } modstatdb_shutdown(); return local_3c; }
dpkg
ghidra
static int parse_scp_uri(const char *uri, char **userp, char **hostp, int *portp, char **pathp) { int r; r = parse_uri("scp", uri, userp, hostp, portp, pathp); if (r == 0 && *pathp == ((void *)0)) *pathp = xstrdup("."); return r; }
int parse_scp_uri(unsigned long long a0, unsigned long long a1, unsigned long long a2, unsigned long long a3, unsigned long long *a4) { char v0; unsigned int v1; v1 = parse_uri("scp", a0, a1, a2, a3, a4, *(&v0), a4, a3, a2, a1); if (v1) { return v1; } else if (*(a4)) { return v1; } else { *(a4) = xstrdup("."); return v1; } }
openssh-portable
angr_sailr
void ssh_kill_proxy_command(void) { if (proxy_command_pid > 1) kill(proxy_command_pid, 1); }
long long ssh_kill_proxy_command() { unsigned long long v1; v1 = proxy_command_pid; if (proxy_command_pid > 1) v1 = kill(proxy_command_pid, 0x1); return v1; }
openssh-portable
angr_dream
static void volatile_strcpy(char volatile *dst, char const volatile *src) { while ((*dst++ = *src++)) continue; }
void volatile_strcpy(unsigned long long a0, unsigned long a1) { char *v0; int tmp_13; unsigned long long v1; char *v3; unsigned long long v4; v1 = a0; v0 = a1; do { tmp_13 = v0; v0 += 1; v3 = v1; v1 += 1; v4 = *(tmp_13); *(v3) = v4; } while (v4); return; }
gzip-1.12
angr_dream
static int _history_expand_command(const char *command, size_t offs, size_t cmdlen, char **result) { char *tmp, *search = ((void *)0), *aptr, delim; const char *ptr, *cmd; static char *from = ((void *)0), *to = ((void *)0); int start, end, idx, has_mods = 0; int p_on = 0, g_on = 0, ev; *result = ((void *)0); aptr = ((void *)0); ptr = ((void *)0); idx = 0; if (strchr(":^*$", command[offs + 1])) { char str[4]; str[0] = str[1] = '!'; str[2] = '0'; ptr = get_history_event(str, &idx, 0); idx = (command[offs + 1] == ':') ? 1 : 0; has_mods = 1; } else { if (command[offs + 1] == '#') { if ((aptr = calloc(offs + 1, sizeof(*aptr))) == ((void *)0)) return -1; (void)strlcpy(aptr, command, offs + 1); idx = 1; } else { int qchar; qchar = (offs > 0 && command[offs - 1] == '"') ? '"' : '\0'; ptr = get_history_event(command + offs, &idx, qchar); } has_mods = command[offs + (size_t)idx] == ':'; } if (ptr == ((void *)0) && aptr == ((void *)0)) return -1; if (!has_mods) { *result = strdup(aptr ? aptr : ptr); if (aptr) free(aptr); if (*result == ((void *)0)) return -1; return 1; } cmd = command + offs + idx + 1; if (*cmd == '%') tmp = strdup(last_search_match ? last_search_match : ""); else if (strchr("^*$-0123456789", *cmd)) { start = end = -1; if (*cmd == '^') start = end = 1, cmd++; else if (*cmd == '$') start = -1, cmd++; else if (*cmd == '*') start = 1, cmd++; else if (*cmd == '-' || ((*__ctype_b_loc())[(int)(((unsigned char)*cmd))] & (unsigned short int)_ISdigit)) { start = 0; while (*cmd && '0' <= *cmd && *cmd <= '9') start = start * 10 + *cmd++ - '0'; if (*cmd == '-') { if (((*__ctype_b_loc())[(int)(((unsigned char)cmd[1]))] & (unsigned short int)_ISdigit)) { cmd++; end = 0; while (*cmd && '0' <= *cmd && *cmd <= '9') end = end * 10 + *cmd++ - '0'; } else if (cmd[1] == '$') { cmd += 2; end = -1; } else { cmd++; end = -2; } } else if (*cmd == '*') end = -1, cmd++; else end = start; } tmp = history_arg_extract(start, end, aptr ? aptr : ptr); if (tmp == ((void *)0)) { (void)fprintf(rl_outstream, "%s: Bad word specifier", command + offs + idx); if (aptr) free(aptr); return -1; } } else tmp = strdup(aptr ? aptr : ptr); if (aptr) free(aptr); if (*cmd == '\0' || ((size_t)(cmd - (command + offs)) >= cmdlen)) { *result = tmp; return 1; } for (; *cmd; cmd++) { switch (*cmd) { case ':': continue; case 'h': if ((aptr = strrchr(tmp, '/')) != ((void *)0)) *aptr = '\0'; continue; case 't': replace(&tmp, '/'); continue; case 'r': if ((aptr = strrchr(tmp, '.')) != ((void *)0)) *aptr = '\0'; continue; case 'e': replace(&tmp, '.'); continue; case 'p': p_on = 1; continue; case 'g': g_on = 2; continue; case '&': if (from == ((void *)0) || to == ((void *)0)) continue; case 's': ev = -1; delim = *++cmd; if (delim == '\0' || *++cmd == '\0') goto out; if ((ev = getfrom(&cmd, &from, search, delim)) != 1) goto out; if ((ev = getto(&cmd, &to, from, delim)) != 1) goto out; aptr = _rl_compat_sub(tmp, from, to, g_on); if (aptr) { free(tmp); tmp = aptr; } g_on = 0; cmd--; continue; } } *result = tmp; return p_on ? 2 : 1; out: free(tmp); return ev; }
int _history_expand_command(char *a0, unsigned long a1, unsigned long a2, unsigned long long *a3) { int tmp_65; char v0; unsigned int v1; unsigned int v2; unsigned int v3; unsigned int v4; unsigned int v5; unsigned int v6; unsigned int v7; unsigned int v8; void *v9; char v10[2]; void *v11; unsigned long v12; void *v13; char v14; char v15; char v16; unsigned int v18; unsigned long v19; unsigned int v21; unsigned int v23; v13 = 0; v4 = 0; v5 = 0; v6 = 0; *(a3) = 0; v11 = 0; v12 = 0; v1 = 0; if (strchr(":^*$", a0[1 + a1])) { v15 = 33; v14 = v15; v16 = 48; v12 = get_history_event(&v14, &v1, 0x0); v1 = a0[1 + a1] == 58; v4 = 1; } else { if (a0[1 + a1] != 35) { if (a1 && a0[1 + a1] == 34) { v18 = 34; goto LABEL_401997; } v18 = 0; LABEL_401997: v8 = v18; v12 = get_history_event(&a0[a1], &v1, v8); } else { v11 = calloc(a1 + 1, 0x1); if (!v11) { v19 = -1; goto LABEL_402003; } else { strlcpy(v11, a0, a1 + 1, a0); v1 = 1; } } v4 = a0[a1 + v1] == 58; } if (!v12 && !v11) { v19 = -1; goto LABEL_402003; } if (!v4) { if (v11) v19 = v11; else v19 = v12; *(a3) = strdup(v19); if (v11) free(v11); if (!*(a3)) *(&v19) = -1; else *(&v19) = 1; } else { *(&v10) = &a0[1 + v1 + a1]; if (v10[0] == 37) { if (!last_search_match) v19 = &g_406500; else v19 = last_search_match; v9 = strdup(v19); } else if (!strchr("^*$-0123456789", v10[0])) { if (v11) v19 = v11; else v19 = v12; v9 = strdup(v19); } else { v3 = -1; v2 = v3; if (v10[0] == 94) { v3 = 1; v2 = v3; v10 = &v10[1]; } else if (v10[0] == 36) { v2 = -1; v10 = &v10[1]; } else if (v10[0] == 42) { v2 = 1; v10 = &v10[1]; } else { if (v10[0] != 45) { *(&v18) = *((v10[0] * 2 + *(__ctype_b_loc()))); v18 = v18 & 0x800; if (!v18) goto LABEL_401cc4; } v2 = 0; while (true) { if (!v10[0]) break; if (v10[0] <= 47) break; if (v10[0] > 57) break; tmp_65 = v10; *(&v10) = &v10[1]; v18 = *(tmp_65) + ((v2 * 4) + v2) * 2 - 48; v2 = v18; } if (v10[0] == 45) { *(&v18) = *((*(__ctype_b_loc()) + v10[1] * 2)); v21 = v18 & 0x800; if (!v21) { if (v10[1] == 36) { v10 += 1; v3 = -1; } else { v10 = &v10[1]; v3 = -2; } } else { v10 = &v10[1]; v3 = 0; while (true) { if (!v10[0]) break; if (v10[0] <= 47) break; if (v10[0] > 57) break; tmp_65 = v10; *(&v10) = &v10[1]; v23 = *(tmp_65) + ((v3 * 4) + v3) * 2 - 48; v3 = v23; } } } else if (v10[0] == 42) { v3 = -1; v10 = &v10[1]; } else { v3 = v2; } } LABEL_401cc4: if (v11) v19 = v11; else v19 = v12; v9 = history_arg_extract(v2, v3, v19); if (!v9) { fprintf(*(got.rl_outstream), "%s: Bad word specifier", &a0[a1 + v1]); if (v11) free(v11); *(&v19) = -1; goto LABEL_402003; } } if (v11) free(v11); if (!v10[0]) { LABEL_401d98: *(a3) = v9; *(&v19) = 1; } else { if (a2 <= v10 - &a0[a1]) goto LABEL_401d98; while (true) { if (!v10[0]) { *(a3) = v9; if (!v5) { *(&v19) = 1; break; } else { *(&v19) = 2; break; } } if (v10[0] != 38) { if (v10[0] < 38) goto LABEL_401fb3; if (!(v10[0] <= 116)) goto LABEL_401fb3; if (v10[0] < 58) goto LABEL_401fb3; switch (v10[0]) { case 101: replace(&v9, 0x2e); break; case 103: v6 = 2; break; case 104: v11 = strrchr(v9, 0x2f); if (v11) *(v11) = 0; break; case 112: v5 = 1; break; case 114: v11 = strrchr(v9, 0x2e); if (v11) *(v11) = 0; break; case 115: LABEL_401ec6: v7 = -1; v10 = &v10[1]; v0 = *(v10); if (v0) { v10 = &v10[1]; if (*(v10)) { v7 = getfrom(&v10, &from.6646, v13, v0); if (v7 == 1) { v7 = getto(&v10, &to.6647, from.6646, v0); if (v7 == 1) { v11 = _rl_compat_sub(v9, from.6646, to.6647, v6); if (v11) { free(v9); v9 = v11; } v6 = 0; *(&v10) = v10 + 1; break; } } } } free(v9); *(&v19) = v7; goto LABEL_402003; case 116: replace(&v9, 0x2f); break; default: LABEL_401fb3: v10 = &v10[1]; continue; } } else { if (from.6646) if (!to.6647) goto LABEL_401fb2; else goto LABEL_401ec6; LABEL_401fb2: goto LABEL_401fb3; } } } } LABEL_402003: return v19; }
libedit
angr_phoenix
void usage(FILE *out, int status) { const char str[] = "gnutls-cli-debug - GnuTLS debug client\n" "Usage: gnutls-cli-debug [ -<flag> [<val>] | --<name>[{=| }<val>] ]... " "[hostname]\n" "\n" "None:\n" "\n" " -d, --debug=num Enable debugging\n" " - it must be in the range:\n" " 0 to 9999\n" " -V, --verbose More verbose output\n" " -p, --port=num The port to connect to\n" " - it must be in the range:\n" " 0 to 65536\n" " --app-proto an alias for the 'starttls-proto' option\n" " --starttls-proto=str The application protocol to be used to " "obtain the server's certificate (https, ftp, smtp, imap, ldap, xmpp, " "lmtp, pop3, nntp, sieve, postgres)\n" "\n" "Version, usage and configuration options:\n" "\n" " -v, --version[=arg] output version information and exit\n" " -h, --help display extended usage information and " "exit\n" " -!, --more-help extended usage information passed thru " "pager\n" "\n" "Options are specified by doubled hyphens and their name or by a single\n" "hyphen and the flag character.\n" "Operands and options may be intermixed. They will be reordered.\n" "\n" "TLS debug client. It sets up multiple TLS connections to \n" "a server and queries its capabilities. It was created to assist in " "debugging \n" "GnuTLS, but it might be useful to extract a TLS server's capabilities.\n" "It connects to a TLS server, performs tests and print the server's \n" "capabilities. If called with the `-V' parameter more checks will be " "performed.\n" "Can be used to check for servers with special needs or bugs.\n" "\n" "Please send bug reports to: <bugs@gnutls.org>\n" "\n"; fprintf(out, "%s", str); exit(status); }
void usage(void *a0, unsigned long a1) { unsigned int v0; void *v1; unsigned long v2; unsigned long v3; unsigned long long *v5; unsigned long long v6; unsigned long long v7; unsigned long v8; struct_0 *v9; v1 = a0; v0 = a1; v3 = v5[5]; v6 = 188; v9 = &v2; for (v7 = "gnutls-cli-debug - GnuTLS debug client\nUsage: gnutls-cli-debug " "[ -<flag> [<val>] | --<name>[{=| }<val>] ]... " "[hostname]\n\nNone:\n\n -d, --debug=num Enable " "debugging\n\t\t\t\t- it must be in the range:\n\t\t\t\t 0 to " "9999\n -V, --verbose More verbose output\n -p, " "--port=num The port to connect to\n\t\t\t\t- it must " "be in the range:\n\t\t\t\t 0 to 65536\n --app-proto " " an alias for the 'starttls-proto' option\n " "--starttls-proto=str The application protocol to be used to " "obtain the server's certificate (https, ftp, smtp, imap, ldap, " "xmpp, lmtp, pop3, nntp, sieve, postgres)\n\nVersion, usage and " "configuration options:\n\n -v, --version[=arg] output " "version information and exit\n -h, --help " "display extended usage information and exit\n -!, --more-help " " extended usage information passed thru pager\n\nOptions " "are specified by doubled hyphens and their name or by a " "single\nhyphen and the flag character.\nOperands and options may " "be intermixed. The"; v6; v7 += v8 * 8) { v6 -= 1; v2 = *(v7); v9 = v9 + 8 * v8; } *(&v9->field_0) = *(v7); v9->field_4 = *((v7 + 4)); v9->field_6 = *((v7 + 6)); fprintf(v1, "%s", &v2); exit(v0); }
gnutls
angr_phoenix
void ssh_dispatch_run_fatal(struct ssh *ssh, int mode, volatile sig_atomic_t *done) { int r; if ((r = ssh_dispatch_run(ssh, mode, done)) != 0) sshpkt_fatal(ssh, r, "%s", __func__); }
long long ssh_dispatch_run_fatal(void *a0, unsigned long a1, unsigned int *a2) { unsigned int v0; unsigned long long v2; v2 = ssh_dispatch_run(a0, a1, a2); v0 = v2; if (v0) v2 = sshpkt_fatal(a0, v0, "%s", "ssh_dispatch_run_fatal"); return v2; }
openssh-portable
angr_phoenix
ssize_t strnunvis_openbsd(char *dst, const char *src, size_t dlen) { return strnunvisx(dst, dlen, src, 0); }
long strnunvis_openbsd(undefined8 param_1, undefined8 param_2, undefined8 param_3) { int iVar1; iVar1 = strnunvisx(param_1, param_3, param_2, 0); return (long)iVar1; }
libbsd-0.11.7
ghidra
static int pkcs11_start_helper_methods(void) { if (helper_rsa != ((void *)0)) return (0); int (*orig_sign)(int, const unsigned char *, int, unsigned char *, unsigned int *, const BIGNUM *, const BIGNUM *, EC_KEY *) = ((void *)0); if (helper_ecdsa != ((void *)0)) return (0); helper_ecdsa = EC_KEY_METHOD_new(EC_KEY_OpenSSL()); if (helper_ecdsa == ((void *)0)) return (-1); EC_KEY_METHOD_get_sign(helper_ecdsa, &orig_sign, ((void *)0), ((void *)0)); EC_KEY_METHOD_set_sign(helper_ecdsa, orig_sign, ((void *)0), ecdsa_do_sign); if ((helper_rsa = RSA_meth_dup(RSA_get_default_method())) == ((void *)0)) sshfatal("ssh-pkcs11-client.c", __func__, 263, 1, SYSLOG_LEVEL_FATAL, ((void *)0), "RSA_meth_dup failed"); if (!RSA_meth_set1_name(helper_rsa, "ssh-pkcs11-helper") || !RSA_meth_set_priv_enc(helper_rsa, rsa_encrypt)) sshfatal("ssh-pkcs11-client.c", __func__, 266, 1, SYSLOG_LEVEL_FATAL, ((void *)0), "failed to prepare method"); return (0); }
undefined8 pkcs11_start_helper_methods(void) { int iVar1; undefined8 uVar2; RSA_METHOD *pRVar3; char **ppcVar4; char **ppcVar5; long in_FS_OFFSET; char *apcStack64[6]; long local_10; ppcVar4 = apcStack64 + 5; ppcVar5 = apcStack64 + 5; local_10 = *(long *)(in_FS_OFFSET + 0x28); if (helper_rsa != 0) { uVar2 = 0; ppcVar5 = apcStack64 + 5; goto LAB_00100dd8; } apcStack64[5] = (char *)0x0; if (helper_ecdsa != 0) { uVar2 = 0; ppcVar5 = apcStack64 + 5; goto LAB_00100dd8; } apcStack64[4] = (char *)0x100caa; uVar2 = EC_KEY_OpenSSL(); apcStack64[4] = (char *)0x100cb2; helper_ecdsa = EC_KEY_METHOD_new(uVar2); if (helper_ecdsa == 0) { uVar2 = 0xffffffff; goto LAB_00100dd8; } apcStack64[4] = (char *)0x100cec; EC_KEY_METHOD_get_sign(helper_ecdsa, apcStack64 + 5, 0, 0); apcStack64[4] = (char *)0x100d0b; EC_KEY_METHOD_set_sign(helper_ecdsa, apcStack64[5], 0, ecdsa_do_sign); apcStack64[4] = (char *)0x100d10; pRVar3 = RSA_get_default_method(); apcStack64[4] = (char *)0x100d18; helper_rsa = RSA_meth_dup(pRVar3); if (helper_rsa == 0) { ppcVar4 = apcStack64 + 3; apcStack64[3] = "RSA_meth_dup failed"; sshfatal("ssh-pkcs11-client.c", "pkcs11_start_helper_methods", 0x107, 1, 1, 0); } *(undefined8 *)((long)ppcVar4 + -8) = 0x100d7b; iVar1 = RSA_meth_set1_name(helper_rsa, "ssh-pkcs11-helper"); if (iVar1 == 0) { LAB_00100d99: ppcVar5 = (char **)((long)ppcVar4 + -0x10); *(char **)((long)ppcVar4 + -0x10) = "failed to prepare method"; *(undefined8 *)((long)ppcVar4 + -0x18) = 0x100dd3; sshfatal("ssh-pkcs11-client.c", "pkcs11_start_helper_methods", 0x10a, 1, 1, 0); } else { *(undefined8 *)((long)ppcVar4 + -8) = 0x100d95; iVar1 = RSA_meth_set_priv_enc(helper_rsa, rsa_encrypt); ppcVar5 = ppcVar4; if (iVar1 == 0) goto LAB_00100d99; } uVar2 = 0; LAB_00100dd8: if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) { *(undefined8 *)((long)ppcVar5 + -8) = 0x100dec; __stack_chk_fail(); } return uVar2; }
openssh-portable
ghidra
void get_dn_crq_set(gnutls_x509_crq_t crq) { int ret; const char *err; if (batch) { if (!cfg.dn) return; ret = gnutls_x509_crq_set_dn(crq, cfg.dn, &err); if (ret < 0) { fprintf(stderr, "set_dn: %s at: %s\n", gnutls_strerror(ret), err); exit(1); } } }
long long get_dn_crq_set(unsigned long long a0) { unsigned int v0; char v1; if (!*(got.batch)) { return 0; } else if (!*((got.cfg + 32))) { return 0; } else { v0 = gnutls_x509_crq_set_dn(a0, *((got.cfg + 32)), &v1, *((got.cfg + 32))); if (v0 < 0) { fprintf(*(got.stderr), "set_dn: %s at: %s\n", gnutls_strerror(v0), *(&v1)); exit(0x1); } return 0; } }
gnutls
angr_sailr
int main(int argc, char **argv) { int i; int exit_status; off_t offset; install_signal_handlers(); ; set_program_name(argv[0]); setlocale(6, ""); bindtextdomain("coreutils", "/usr/local/share/locale"); textdomain("coreutils"); atexit(maybe_close_stdout); page_size = getpagesize(); parse_gnu_standard_options_only(argc, argv, "dd", "coreutils", Version, 1, usage, ("Paul Rubin"), ("David MacKenzie"), ("Stuart Kemp"), (char const *)((void *)0)); close_stdout_required = 0; for (i = 0; i < 256; i++) trans_table[i] = i; scanargs(argc, argv); apply_translations(); if (input_file == ((void *)0)) { input_file = gettext("standard input"); set_fd_flags(0, input_flags, input_file); } else { if (ifd_reopen(0, input_file, 00 | input_flags, 0) < 0) ((!!sizeof(struct { _Static_assert( 1, "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), gettext (\"failed to open " "%s\"), quotearg_style (shell_escape_always_quoting_style, " "input_file)), assume (false))" ")"); int _gl_dummy; })) ? ((nl_error(1, (*__errno_location()), gettext("failed to open %s"), quotearg_style(shell_escape_always_quoting_style, input_file)), ((0) ? (void)0 : __builtin_unreachable()))) : ((nl_error(1, (*__errno_location()), gettext("failed to open %s"), quotearg_style(shell_escape_always_quoting_style, input_file)), ((0) ? (void)0 : __builtin_unreachable())))); } offset = lseek(0, 0, 1); input_seekable = (0 <= offset); input_offset = (((0) > (offset)) ? (0) : (offset)); input_seek_errno = (*__errno_location()); if (output_file == ((void *)0)) { output_file = gettext("standard output"); set_fd_flags(1, output_flags, output_file); } else { mode_t perms = (0400 | 0200 | (0400 >> 3) | (0200 >> 3) | ((0400 >> 3) >> 3) | ((0200 >> 3) >> 3)); int opts = (output_flags | (conversions_mask & C_NOCREAT ? 0 : 0100) | (conversions_mask & C_EXCL ? 0200 : 0) | (seek_records || (conversions_mask & C_NOTRUNC) ? 0 : 01000)); off_t size; if ((__builtin_mul_overflow(seek_records, output_blocksize, &size) || __builtin_add_overflow(seek_bytes, size, &size)) && !(conversions_mask & C_NOTRUNC)) ((!!sizeof(struct { _Static_assert( 1, "verify_expr (" "1" ", " "(error (1, 0, gettext (\"offset too large: \" \"cannot " "truncate to a length of seek=%\"\"l\" \"d\"\"\" \" (%td-byte) " "blocks\"), seek_records, output_blocksize), assume (false))" ")"); int _gl_dummy; })) ? ((nl_error(1, 0, gettext("offset too large: " "cannot truncate to a length of seek=%" "l" "d" "" " (%td-byte) blocks"), seek_records, output_blocksize), ((0) ? (void)0 : __builtin_unreachable()))) : ((nl_error(1, 0, gettext("offset too large: " "cannot truncate to a length of seek=%" "l" "d" "" " (%td-byte) blocks"), seek_records, output_blocksize), ((0) ? (void)0 : __builtin_unreachable())))) ; if ((!seek_records || ifd_reopen(1, output_file, 02 | opts, perms) < 0) && (ifd_reopen(1, output_file, 01 | opts, perms) < 0)) ((!!sizeof(struct { _Static_assert( 1, "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), gettext (\"failed to open " "%s\"), quotearg_style (shell_escape_always_quoting_style, " "output_file)), assume (false))" ")"); int _gl_dummy; })) ? ((nl_error(1, (*__errno_location()), gettext("failed to open %s"), quotearg_style(shell_escape_always_quoting_style, output_file)), ((0) ? (void)0 : __builtin_unreachable()))) : ((nl_error(1, (*__errno_location()), gettext("failed to open %s"), quotearg_style(shell_escape_always_quoting_style, output_file)), ((0) ? (void)0 : __builtin_unreachable())))); if (seek_records != 0 && !(conversions_mask & C_NOTRUNC)) { if (iftruncate(1, size) != 0) { int ftruncate_errno = (*__errno_location()); struct stat stdout_stat; if (ifstat(1, &stdout_stat) != 0) { nl_error( 0, (*__errno_location()), gettext("cannot fstat %s"), quotearg_style(shell_escape_always_quoting_style, output_file)); exit_status = 1; } else if (((((stdout_stat.st_mode)) & 0170000) == (0100000)) || ((((stdout_stat.st_mode)) & 0170000) == (0040000)) || ((&stdout_stat)->st_mode - (&stdout_stat)->st_mode)) { intmax_t isize = size; nl_error( 0, ftruncate_errno, gettext("failed to truncate to %" "l" "d" " bytes" " in output file %s"), isize, quotearg_style(shell_escape_always_quoting_style, output_file)); exit_status = 1; } } } } start_time = gethrxtime(); next_time = start_time + 1000000000; exit_status = dd_copy(); int sync_status = synchronize_output(); if (sync_status) exit_status = sync_status; if (max_records == 0 && max_bytes == 0) { if (i_nocache && !invalidate_cache(0, 0)) { nl_error( 0, (*__errno_location()), gettext("failed to discard cache for: %s"), quotearg_n_style_colon(0, shell_escape_quoting_style, input_file)); exit_status = 1; } if (o_nocache && !invalidate_cache(1, 0)) { nl_error( 0, (*__errno_location()), gettext("failed to discard cache for: %s"), quotearg_n_style_colon(0, shell_escape_quoting_style, output_file)); exit_status = 1; } } else { if (i_nocache || i_nocache_eof) invalidate_cache(0, 0); if (o_nocache || o_nocache_eof) invalidate_cache(1, 0); } finish_up(); return exit_status; }
int main(undefined4 param_1, undefined8 *param_2) { long lVar1; long lVar2; char cVar3; int iVar4; uint uVar5; int iVar6; __off_t _Var7; int *piVar8; undefined8 uVar9; uint uVar10; long in_FS_OFFSET; bool bVar11; undefined8 uVar12; int local_e8; int local_e4; long local_d0; undefined local_b8[24]; uint local_a0; long local_20; local_20 = *(long *)(in_FS_OFFSET + 0x28); install_signal_handlers(); set_program_name(*param_2); setlocale(6, ""); bindtextdomain("coreutils", "/usr/local/share/locale"); textdomain("coreutils"); atexit(maybe_close_stdout); uVar12 = 0x104778; iVar4 = getpagesize(); page_size = (long)iVar4; parse_gnu_standard_options_only(param_1, param_2, &DAT_00106509, "coreutils", Version, 1, usage, "Paul Rubin", "David MacKenzie", "Stuart Kemp", 0, uVar12); close_stdout_required = 0; for (local_e8 = 0; local_e8 < 0x100; local_e8 = local_e8 + 1) { trans_table[local_e8] = (char)local_e8; } scanargs(param_1, param_2); apply_translations(); if (input_file == 0) { input_file = gettext("standard input"); set_fd_flags(0, input_flags, input_file); } else { iVar4 = ifd_reopen(0, input_file, input_flags, 0); if (iVar4 < 0) { uVar12 = quotearg_style(4, input_file); uVar9 = gettext("failed to open %s"); piVar8 = __errno_location(); nl_error(1, *piVar8, uVar9, uVar12); } } _Var7 = lseek(0, 0, 1); input_seekable = (byte) ~(byte)((ulong)_Var7 >> 0x38) >> 7; input_offset = 0; if (-1 < _Var7) { input_offset = _Var7; } piVar8 = __errno_location(); lVar2 = seek_records; lVar1 = output_blocksize; input_seek_errno = *piVar8; if (output_file == 0) { output_file = gettext("standard output"); set_fd_flags(1, output_flags, output_file); } else { if ((conversions_mask & 0x1000) == 0) { uVar10 = 0x40; } else { uVar10 = 0; } if ((seek_records == 0) && ((conversions_mask & 0x200) == 0)) { uVar5 = 0x200; } else { uVar5 = 0; } uVar5 = uVar5 | uVar10 | output_flags | (int)conversions_mask >> 6 & 0x80U; local_d0 = output_blocksize * seek_records; if (((SEXT816(local_d0) != SEXT816(output_blocksize) * SEXT816(seek_records)) || (bVar11 = SCARRY8(local_d0, seek_bytes), local_d0 = local_d0 + seek_bytes, bVar11)) && ((conversions_mask & 0x200) == 0)) { uVar12 = gettext("offset too large: cannot truncate to a length of " "seek=%ld (%td-byte) blocks"); nl_error(1, 0, uVar12, lVar2, lVar1); } if (((seek_records == 0) || (iVar4 = ifd_reopen(1, output_file, uVar5 | 2, 0x1b6), iVar4 < 0)) && (iVar4 = ifd_reopen(1, output_file, uVar5 | 1, 0x1b6), iVar4 < 0)) { uVar12 = quotearg_style(4, output_file); uVar9 = gettext("failed to open %s"); piVar8 = __errno_location(); nl_error(1, *piVar8, uVar9, uVar12); } if (((seek_records != 0) && ((conversions_mask & 0x200) == 0)) && (iVar4 = iftruncate(1, local_d0), iVar4 != 0)) { piVar8 = __errno_location(); iVar4 = *piVar8; iVar6 = ifstat(1, local_b8); if (iVar6 == 0) { if (((local_a0 & 0xf000) == 0x8000) || ((local_a0 & 0xf000) == 0x4000)) { uVar12 = quotearg_style(4, output_file); uVar9 = gettext("failed to truncate to %ld bytes in output file %s"); nl_error(0, iVar4, uVar9, local_d0, uVar12); } } else { uVar12 = quotearg_style(4, output_file); uVar9 = gettext("cannot fstat %s"); piVar8 = __errno_location(); nl_error(0, *piVar8, uVar9, uVar12); } } } start_time = gethrxtime(); next_time = start_time + 1000000000; local_e4 = dd_copy(); iVar4 = synchronize_output(); if (iVar4 != 0) { local_e4 = iVar4; } if ((max_records == 0) && (max_bytes == 0)) { if ((i_nocache != '\0') && (cVar3 = invalidate_cache(0, 0), cVar3 != '\x01')) { uVar12 = quotearg_n_style_colon(0, 3, input_file); uVar9 = gettext("failed to discard cache for: %s"); piVar8 = __errno_location(); nl_error(0, *piVar8, uVar9, uVar12); local_e4 = 1; } if ((o_nocache != '\0') && (cVar3 = invalidate_cache(1, 0), cVar3 != '\x01')) { uVar12 = quotearg_n_style_colon(0, 3, output_file); uVar9 = gettext("failed to discard cache for: %s"); piVar8 = __errno_location(); nl_error(0, *piVar8, uVar9, uVar12); local_e4 = 1; } } else { if ((i_nocache != '\0') || (i_nocache_eof != '\0')) { invalidate_cache(0, 0); } if ((o_nocache != '\0') || (o_nocache_eof != '\0')) { invalidate_cache(1, 0); } } finish_up(); if (local_20 != *(long *)(in_FS_OFFSET + 0x28)) { __stack_chk_fail(); } return local_e4; }
coreutils
ghidra
struct monitor *monitor_init(void) { struct monitor *mon; mon = xcalloc(1, sizeof(*mon)); monitor_openfds(mon, 1); return mon; }
long long monitor_init() { void *v0; v0 = xcalloc(0x1, 0x20); monitor_openfds(v0, 0x1); return v0; }
openssh-portable
angr_sailr
static int on_netns_del(char *nsname, void *arg) { char netns_path[4096]; snprintf(netns_path, sizeof(netns_path), "%s/%s", "/var/run/netns", nsname); umount2(netns_path, MNT_DETACH); if (unlink(netns_path) < 0) { fprintf(stderr, "Cannot remove namespace file \"%s\": %s\n", netns_path, strerror((*__errno_location()))); return -1; } return 0; }
void on_netns_del(unsigned long a0, unsigned long a1) { unsigned long v0; char v1; char v2; void *v4; unsigned long long v5; v2 = *(&v2); v0 = a1; snprintf(&v1, 0x1000, "%s/%s", &g_40385e, a0); umount2(&v1, 0x2); if (unlink(&v1) >= 0) { v4 = 0; } else { fprintf(stderr, "Cannot remove namespace file \"%s\": %s\n", &v1, strerror(*(__errno_location()))); v5 = 4294967295; } return; }
iproute2-6.0.0
angr_phoenix
void e2fsck_hide_quota(e2fsck_t ctx) { struct ext2_super_block *sb = ctx->fs->super; struct problem_context pctx; ext2_filsys fs = ctx->fs; enum quota_type qtype; ext2_ino_t quota_ino; clear_problem_context(&pctx); if ((ctx->options & 0x0001) || !ext2fs_has_feature_quota(sb)) return; for (qtype = 0; qtype < MAXQUOTAS; qtype++) { pctx.dir = 2; pctx.ino = *quota_sb_inump(sb, qtype); pctx.num = qtype; quota_ino = quota_type2inum(qtype, fs->super); if (pctx.ino && (pctx.ino != quota_ino) && fix_problem(ctx, 0x000041, &pctx)) { if (move_quota_inode(fs, pctx.ino, quota_ino, qtype)) continue; *quota_sb_inump(sb, qtype) = quota_ino; ext2fs_mark_super_dirty(fs); } } return; }
long long e2fsck_hide_quota(struct_0 *a0) { unsigned int v0; unsigned int v1; unsigned long v2; struct_1 *v3; char v4; unsigned int v5; unsigned int v6; unsigned long v7; v2 = a0->field_0->field_20; v3 = a0->field_0; clear_problem_context(&v4); if (!(a0->field_4c & 1) && ext2fs_has_feature_quota(v2)) { for (v0 = 0; v0 <= 2; v0 += 1) { v6 = 2; v5 = *(quota_sb_inump(v2, v0)); v7 = v0; v1 = quota_type2inum(v0, v3->field_20, v3->field_20); if (v5 && v1 != v5 && fix_problem(a0, 0x41, &v4) && !move_quota_inode(v3, v5, v1, v0)) { *(quota_sb_inump(v2, v0)) = v1; ext2fs_mark_super_dirty(v3); } } } return 0; }
e2fsprogs-1.46.5
angr_dream
int rl_previous_screen_line(int count, int key) { int c; c = _rl_term_autowrap ? _rl_screenwidth : (_rl_screenwidth + 1); return (rl_backward_char(c, key)); }
long rl_previous_screen_line(long a1, unsigned int a2) { int v2; if (rl_term_autowrap) v2 = rl_screenwidth; else v2 = rl_screenwidth + 1; return rl_backward_char(v2, a2); }
bash
ida
DH *dh_new_group(BIGNUM *gen, BIGNUM *modulus) { DH *dh; if ((dh = DH_new()) == ((void *)0)) return ((void *)0); if (!DH_set0_pqg(dh, modulus, ((void *)0), gen)) { DH_free(dh); return ((void *)0); } return dh; }
void dh_new_group(unsigned long long a0, unsigned long long a1) { unsigned long long v0; void *v3; unsigned long long v4; void *v5; *(&v0) = DH_new(); if (!v0) { v3 = 0; return; } else if (!DH_set0_pqg(v0, a1, 0x0, a0)) { DH_free(v0); v5 = 0; return; } else { v4 = v0; return; } }
openssh-portable
angr_sailr
static int compare_ranges(const void *a, const void *b) { int a_start = ((const struct field_range_pair *)a)->lo; int b_start = ((const struct field_range_pair *)b)->lo; return a_start < b_start ? -1 : a_start > b_start; }
long long compare_ranges(unsigned long long *a0, unsigned long long *a1) { unsigned int v0; unsigned int v1; unsigned long long v3; v0 = *(a0); v1 = *(a1); if (v0 >= v1) v3 = v1 < v0; else v3 = 4294967295; return v3; }
coreutils
angr_dream
static void deferred_configure_ghost_conffile(struct pkginfo *pkg, struct conffile *conff) { struct pkginfo *otherpkg; struct conffile *otherconff; for (otherpkg = &pkg->set->pkg; otherpkg; otherpkg = otherpkg->arch_next) { if (otherpkg == pkg) continue; if (otherpkg->status <= PKG_STAT_HALFCONFIGURED) continue; for (otherconff = otherpkg->installed.conffiles; otherconff; otherconff = otherconff->next) { if (otherconff->obsolete || otherconff->remove_on_upgrade) continue; if (strcmp(otherconff->name, conff->name) == 0) { conff->hash = otherconff->hash; modstatdb_note(pkg); return; } } } }
long deferred_configure_ghost_conffile(_QWORD *a1, long a2) { long result; long i; long *j; result = *a1 + 16LL; for (i = result; i; i = result) { if ((_QWORD *)i != a1 && *(_DWORD *)(i + 24) > 4u) { for (j = *(long **)(i + 176); j; j = (long *)*j) { if (!*((_BYTE *)j + 24) && !*((_BYTE *)j + 25) && !strcmp((const char *)j[1], *(const char **)(a2 + 8))) { *(_QWORD *)(a2 + 16) = j[2]; return modstatdb_note(a1); } } } result = *(_QWORD *)(i + 8); } return result; }
dpkg
ida
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(struct_0 *a0, unsigned long a1, unsigned long a2, unsigned long long a3) { char v0; char v1; char v2; char v3; unsigned int v4; unsigned int v5; unsigned int v6; char v7; void *v8; unsigned long long v9; struct_2 *v10; unsigned long v11; struct_1 *v12; unsigned long long v13; char v14; char v15; char v16; unsigned int v18; struct_0 *v19; struct_0 *v20; unsigned long long v21; unsigned long long v22; unsigned long long v23; unsigned long long v24; unsigned long long v25; unsigned long long v26; unsigned long long v27; unsigned long long *v28; unsigned long long v29; v9 = -1; v5 = 0; v10 = a0->field_198; v2 = !v10; if (!v2) v18 = v10->field_1a8; else v18 = chdir_fd; v4 = v18; v8 = 0; if (interactive_option && !confirm("add", a2)) goto LABEL_404aab; assign_string(a0, a2, a2); v26 = safer_name_suffix(a2, 0x0, absolute_names_option, a3); assign_string(&a0->padding_8, v26, v26); transform_name(&a0->padding_8, 0x1); if (v4 < 0 && (v2 ^ 1)) { *(__errno_location()) = -(v4); v8 = *(&got.open_diag); goto LABEL_403d53; } if (fstatat(v4, a1, &a0->padding_20[56], fstatat_flags)) { v8 = *(&got.stat_diag); } else if (file_dumpable_p(&a0->padding_20[56])) { v5 = subfile_open(v10, a1, open_read_flags); if (v5 < 0) { v8 = *(&got.open_diag); } else { a0->field_1a8 = v5; if (fstat(v5, &a0->padding_20[56])) v8 = *(&got.stat_diag); } } LABEL_403d53: if (v8) { file_removed_diag(a2, v2, v8, v2); goto LABEL_404aab; } v11 = a0->field_88; a0->field_118 = v11; v19 = a0; v19->field_e8 = get_stat_atime(&a0->padding_20[56]); v19->field_f0 = a2; v20 = a0; v20->field_f8 = get_stat_mtime(&a0->padding_20[56]); v20->field_100 = a2; v13 = get_stat_ctime(&a0->padding_20[56]); a0->field_108 = v13; a0->field_110 = a2; if (!(incremental_option ^ 1) && !v2) goto LABEL_403f6f; if ((a0->field_70 & 0xf000) != 0x4000 && timespec_cmp(a0->field_f8, a0->field_100, newer_mtime_option, after_date_option) < 0) { if (after_date_option && !(timespec_cmp(a0->field_108, a0->field_110, newer_mtime_option, after_date_option) < 0)) goto LABEL_403f6f; if ((incremental_option ^ 1) && verbose_option && (*(&warning_option) & 0x100)) { if (*(&error_hook)) *(5242912)(); v21 = quotearg_colon(a2); error(0x0, 0x0, gettext("%s: file is unchanged; not dumped")); } goto LABEL_404aab; } LABEL_403f6f: if (sys_file_is_archive(a0)) { if ((*(&warning_option) & 0x400)) { if (*(&error_hook)) *(5242912)(); v22 = quotearg_colon(a2); error(0x0, 0x0, gettext("%s: file is the archive; not dumped")); } goto LABEL_404aab; } v3 = (a0->field_70 & 0xf000) == 0x4000; if ((v3 ^ 1) && !(!dump_hard_link(a0))) goto LABEL_404aab; if (!v3 && (a0->field_70 & 0xf000) != 0x8000) { if ((a0->field_70 & 0xf000) != 0xa000) { if ((a0->field_70 & 0xf000) == 0x2000) { v1 = 51; xattrs_acls_get(v4, a1, a0, 0x0, 0x1); xattrs_selinux_get(v4, a1, a0, 0x0); xattrs_xattrs_get(v4, a1, a0, 0x0); } else if ((a0->field_70 & 0xf000) == 0x6000) { v1 = 52; xattrs_acls_get(v4, a1, a0, 0x0, 0x1); xattrs_selinux_get(v4, a1, a0, 0x0); xattrs_xattrs_get(v4, a1, a0, 0x0); } else if ((a0->field_70 & 0xf000) == 0x1000) { v1 = 54; xattrs_acls_get(v4, a1, a0, 0x0, 0x1); xattrs_selinux_get(v4, a1, a0, 0x0); xattrs_xattrs_get(v4, a1, a0, 0x0); } else if ((a0->field_70 & 0xf000) != 0xc000) { unknown_file_error(a2); goto LABEL_404aab; } else { if ((*(&warning_option) & 32)) { if (*(&error_hook)) *(5242912)(); v25 = quotearg_colon(a2); error(0x0, 0x0, gettext("%s: socket ignored")); } goto LABEL_404aab; } if (*(&archive_format) == 1) { unknown_file_error(a2); } else { v9 = current_block_ordinal(); a0->field_88 = 0; v12 = start_header(a0); if (v12) { v12->field_9c = v1; if (v1 != 54) { major_to_chars(gnu_dev_major(a0->field_80), &v12[2].padding_0[15], 0x8); minor_to_chars(gnu_dev_minor(a0->field_80), &v12[2].padding_0[23], 0x8); } finish_header(a0, v12, v9); if (remove_files_option) queue_deferred_unlink(a2, 0x0); } } } else { a0->field_18 = areadlinkat_with_size(v4, a1, a0->field_88, a1); if (a0->field_18) { transform_name(&a0->field_18, 0x4); if (*(&archive_format) == 2) v23 = 99; else v23 = 100; if (v23 < strlen(a0->field_18)) write_long_link(a0); xattrs_selinux_get(v4, a1, a0, 0x0); xattrs_xattrs_get(v4, a1, a0, 0x0); v9 = current_block_ordinal(); a0->field_88 = 0; v12 = start_header(a0); if (v12) { tar_copy_str(v12 + 1, a0->field_18, 0x64); v12->field_9c = 50; finish_header(a0, v12, v9); if (remove_files_option) queue_deferred_unlink(a2, 0x0); file_count_links(a0, a1, a2, 0x0); } } else { *(&v26) = *(__errno_location()); if (v26 == 12) xalloc_die(); file_removed_diag(a2, v2, got.readlink_diag, v2); } } LABEL_404aab: v29 = *(&v16) ^ v28[5]; return; } xattrs_acls_get(v4, a1, a0, 0x0, v3 ^ 1); xattrs_selinux_get(v4, a1, a0, v5); xattrs_xattrs_get(v4, a1, a0, v5); if (!v3) { if (v5 && sparse_option) { a3 = (a0->field_88 < 0 ? a0->field_88 + 511 : a0->field_88) >> 9; if ((a0->field_88 & 511) && a0->field_88 + 511 > 1022) { v24 = 1; goto LABEL_404219; } v24 = 0; LABEL_404219: v26 = v24 + a3; if (a0->field_98 < v26) { v6 = sparse_dump_file(v5, a0, a0); if (v6 == 3) { v6 = dump_regular_file(v5, a0); goto LABEL_404285; } } } v6 = dump_regular_file(v5, a0); LABEL_404285: if (v6 == 3) abort(); if (v6 <= 3 && v6 <= 1) file_count_links(a0, a1, a2, a3); v0 = !v6; } else { ensure_slash(a0); ensure_slash(&a0->padding_8); if (check_exclusion_tags(a0, &v7) == 3) { exclusion_tag_warning(a0->field_0, *(&v7), gettext("directory not dumped")); goto LABEL_404aab; } else { v0 = dump_dir(a0, &v7, a0, a3); v5 = a0->field_1a8; if (!v2) *(&v26) = v10->field_1a8; else *(&v26) = chdir_fd; v4 = v26; } } if (v0) { if (v5 < 0) { *(__errno_location()) = -(v5); v0 = 0; } else if (v5) { *(&v26) = !fstat(v5, &v14); v0 = *(&v26); } else { if (v4 < 0 && (v2 ^ 1)) { *(__errno_location()) = -(v4); v0 = 0; goto LABEL_404388; } *(&v26) = !fstatat(v4, a1, &v14, fstatat_flags); v0 = *(&v26); } LABEL_404388: if ((v0 ^ 1)) file_removed_diag(a2, v2, *(&got.stat_diag), v2); } if (v0) { if (timespec_cmp(get_stat_ctime(&v14), a2, v13, a2)) { if (!(!(remove_files_option ^ 1))) goto LABEL_404426; if (!(!(v3 ^ 1))) goto LABEL_404426; } if (v11 < *(&v15)) { LABEL_404426: if ((*(&warning_option) & 16)) { if (*(&error_hook)) *(5242912)(); v27 = quotearg_colon(a2); error(0x0, 0x0, gettext("%s: file changed as we read it")); } set_exit_status(0x1); } else if (atime_preserve_option == 1 && v5) { if (!v3 && !v11) goto LABEL_4044f8; if (set_file_atime(v5, v4, a1, a0->field_e8, a0->field_f0)) utime_error(a2); } } LABEL_4044f8: v0 = (tar_stat_close(a0) & v0); if (v0 && remove_files_option) queue_deferred_unlink(a2, v3); goto LABEL_404aab; }
tar
angr_phoenix
static int sign_and_send_pubkey(struct ssh *ssh, Identity *id) { Authctxt *authctxt = (Authctxt *)ssh->authctxt; struct sshbuf *b = ((void *)0); Identity *private_id, *sign_id = ((void *)0); u_char *signature = ((void *)0); size_t slen = 0, skip = 0; int r, fallback_sigtype, sent = 0; char *alg = ((void *)0), *fp = ((void *)0); const char *loc = "", *method = "publickey"; int hostbound = 0; if ((ssh->kex->flags & 0x0004) != 0 && (options.pubkey_authentication & 0x02) != 0) { hostbound = 1; method = "publickey-hostbound-v00@openssh.com"; } if ((fp = sshkey_fingerprint(id->key, options.fingerprint_hash, SSH_FP_DEFAULT)) == ((void *)0)) return 0; sshlog("sshconnect2.c", __func__, 1368, 1, SYSLOG_LEVEL_DEBUG3, ((void *)0), "using %s with %s %s", method, sshkey_type(id->key), fp); if (sshkey_is_cert(id->key)) { for ((private_id) = ((&authctxt->keys)->tqh_first); (private_id) != ((void *)0); (private_id) = ((private_id)->next.tqe_next)) { if (sshkey_equal_public(id->key, private_id->key) && id->key->type != private_id->key->type) { sign_id = private_id; break; } } if (sign_id == ((void *)0) && !id->isprivate && id->agent_fd == -1 && (id->key->flags & 0x0001) == 0) { for ((private_id) = ((&authctxt->keys)->tqh_first); (private_id) != ((void *)0); (private_id) = ((private_id)->next.tqe_next)) { if (private_id->key == ((void *)0) && id_filename_matches(id, private_id)) { sign_id = private_id; break; } } } if (sign_id != ((void *)0)) { sshlog("sshconnect2.c", __func__, 1405, 1, SYSLOG_LEVEL_DEBUG2, ((void *)0), "using private key \"%s\"%s for " "certificate", sign_id->filename, sign_id->agent_fd != -1 ? " from agent" : "") ; } else { sshlog("sshconnect2.c", __func__, 1409, 1, SYSLOG_LEVEL_DEBUG1, ((void *)0), "no separate private key for certificate " "\"%s\"", id->filename); } } if (sign_id == ((void *)0)) sign_id = id; for (fallback_sigtype = 0; fallback_sigtype <= 1; fallback_sigtype++) { free(alg); slen = 0; signature = ((void *)0); if ((alg = key_sig_algorithm(fallback_sigtype ? ((void *)0) : ssh, id->key)) == ((void *)0)) { sshlog("sshconnect2.c", __func__, 1428, 1, SYSLOG_LEVEL_ERROR, ((void *)0), "no mutual signature supported"); goto out; } sshlog("sshconnect2.c", __func__, 1431, 1, SYSLOG_LEVEL_DEBUG3, ((void *)0), "signing using %s %s", alg, fp); sshbuf_free(b); if ((b = sshbuf_new()) == ((void *)0)) sshfatal("sshconnect2.c", __func__, 1435, 1, SYSLOG_LEVEL_FATAL, ((void *)0), "sshbuf_new failed"); if (ssh->compat & 0x00000010) { if ((r = sshbuf_putb(b, ssh->kex->session_id)) != 0) sshfatal("sshconnect2.c", __func__, 1438, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "sshbuf_putb"); } else { if ((r = sshbuf_put_stringb(b, ssh->kex->session_id)) != 0) sshfatal("sshconnect2.c", __func__, 1442, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "sshbuf_put_stringb"); } skip = sshbuf_len(b); if ((r = sshbuf_put_u8(b, 50)) != 0 || (r = sshbuf_put_cstring(b, authctxt->server_user)) != 0 || (r = sshbuf_put_cstring(b, authctxt->service)) != 0 || (r = sshbuf_put_cstring(b, method)) != 0 || (r = sshbuf_put_u8(b, 1)) != 0 || (r = sshbuf_put_cstring(b, alg)) != 0 || (r = sshkey_puts(id->key, b)) != 0) { sshfatal("sshconnect2.c", __func__, 1452, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "assemble signed data"); } if (hostbound) { if (ssh->kex->initial_hostkey == ((void *)0)) { sshfatal("sshconnect2.c", __func__, 1456, 1, SYSLOG_LEVEL_FATAL, ((void *)0), "internal error: initial hostkey " "not recorded"); } if ((r = sshkey_puts(ssh->kex->initial_hostkey, b)) != 0) sshfatal("sshconnect2.c", __func__, 1460, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "assemble %s hostkey", method); } r = identity_sign(sign_id, &signature, &slen, sshbuf_ptr(b), sshbuf_len(b), ssh->compat, alg); if (r == 0) break; else if (r == -46) goto out; else if (r == -58 && !fallback_sigtype) { if (sign_id->agent_fd != -1) loc = "agent "; else if ((sign_id->key->flags & 0x0001) != 0) loc = "token "; sshlog("sshconnect2.c", __func__, 1475, 0, SYSLOG_LEVEL_INFO, ((void *)0), "%skey %s %s returned incorrect signature type", loc, sshkey_type(id->key), fp); continue; } sshlog("sshconnect2.c", __func__, 1479, 1, SYSLOG_LEVEL_ERROR, ssh_err(r), "signing failed for %s \"%s\"%s", sshkey_type(sign_id->key), sign_id->filename, id->agent_fd != -1 ? " from agent" : "") ; goto out; } if (slen == 0 || signature == ((void *)0)) sshfatal("sshconnect2.c", __func__, 1485, 1, SYSLOG_LEVEL_FATAL, ((void *)0), "no signature"); if ((r = sshbuf_put_string(b, signature, slen)) != 0) sshfatal("sshconnect2.c", __func__, 1489, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "append signature"); if ((r = sshbuf_consume(b, skip + 1)) != 0) sshfatal("sshconnect2.c", __func__, 1496, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "consume"); if ((r = sshpkt_start(ssh, 50)) != 0 || (r = sshpkt_putb(ssh, b)) != 0 || (r = sshpkt_send(ssh)) != 0) sshfatal("sshconnect2.c", __func__, 1502, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "enqueue request"); sent = 1; out: free(fp); free(alg); sshbuf_free(b); freezero(signature, slen); return sent; }
int sign_and_send_pubkey(void *a0, void *a1) { unsigned long v0; unsigned long v1; unsigned int v2; unsigned int v3; unsigned int v4; unsigned int v5; void *v6; void *v7; void *v8; unsigned long long v9[4]; void *v10; void *v11; void *v12; unsigned long long v13; unsigned long long v14; unsigned long long v15[8]; void *v16; unsigned long long v17; void *v18; unsigned long long v19; unsigned long long v20; char v21; unsigned long long v23; unsigned long long v24; v15[0] = a0[2144]; v8 = 0; v10 = 0; v6 = 0; v7 = 0; v11 = 0; v4 = 0; v12 = 0; v16 = 0; v13 = &g_407745; v14 = "publicke"; v5 = 0; if ((*((a0[8] + 140)) & 4) && (g_500034 & 2)) { v5 = 1; v14 = "publickey-hostbound-v00@"; } v16 = sshkey_fingerprint(a1[24], *(5248728), 0x0, *(5248728)); if (!v16) { v23 = 0; } else { sshkey_type(a1[24]); v1 = v16; v0 = v14; sshlog("sshconnect2.c", "sign_and_send_pubkey", 0x558, 0x1, 0x7, 0x0, "using %s with %s %s"); v23 = sshkey_is_cert(a1[24]); if (v23) { for (v9 = v15[7]; v9; v9 = v9->field_0) { v23 = sshkey_equal_public(a1[24], v9->field_18, v9->field_18); if (v23 && *(a1[24]) != v9->field_18->field_0) { v10 = v9; break; } } if (!v10 && !a1[44] && a1[16] == -1 && !(*((a1[24] + 4)) & 1)) { for (v9[0] = v15[7]; v9; v9[0] = v9[0]) { if (!v9[3]) { v23 = id_filename_matches(a1, v9); if (v23) { v10 = v9; break; } } } } if (v10) { v0 = v10[32]; sshlog("sshconnect2.c", "sign_and_send_pubkey", 0x57d, 0x1, 0x6, 0x0, "using private key \"%s\"%s for certificate"); } else { v1 = a1[32]; sshlog("sshconnect2.c", "sign_and_send_pubkey", 0x581, 0x1, 0x5, 0x0, "no separate private key for certificate \"%s\""); } } if (!v10) v10 = a1; v3 = 0; while (true) { if (v3 <= 1) { free(v12); v7 = 0; v6 = 0; if (!v3) v23 = a0; else v23 = 0; v12 = key_sig_algorithm(v23, a1[24]); if (!v12) { v19 = "no mutual signature supported"; sshlog("sshconnect2.c", "sign_and_send_pubkey", 0x594, 0x1, 0x2, 0x0, *(&v21)); break; } else { v19 = v16; v18 = v12; v17 = "signing using %s %s"; sshlog("sshconnect2.c", "sign_and_send_pubkey", 0x597, 0x1, 0x7, 0x0, *(&v21)); sshbuf_free(v8); v8 = sshbuf_new(a0, "sign_and_send_pubkey", 0x597, 0x1, 0x7, 0x0); if (!v8) { v19 = "sshbuf_new failed"; sshfatal("sshconnect2.c", "sign_and_send_pubkey", 0x59b, 0x1, 0x1, 0x0); } if ((a0[2108] & 16)) { v2 = sshbuf_putb(v8, *((a0[8] + 112)), *((a0[8] + 112))); if (v2) { v19 = "sshbuf_putb"; sshfatal("sshconnect2.c", "sign_and_send_pubkey", 0x59e, 0x1, 0x1, ssh_err(v2)); } } if (!(a0[2108] & 16) || v2) { v2 = sshbuf_put_stringb(v8, *((a0[8] + 112)), *((a0[8] + 112))); if (v2) { v19 = "sshbuf_put_stringb"; sshfatal("sshconnect2.c", "sign_and_send_pubkey", 0x5a2, 0x1, 0x1, ssh_err(v2)); } } v11 = sshbuf_len(v8); v2 = sshbuf_put_u8(v8, 0x32); if (!v2) { v2 = sshbuf_put_cstring(v8, v15[0], v15[0]); if (!v2) { v2 = sshbuf_put_cstring(v8, v15[3], v15[3]); if (!v2) { v2 = sshbuf_put_cstring(v8, v14, v14); if (!v2) { v2 = sshbuf_put_u8(v8, 0x1); if (!v2) { v2 = sshbuf_put_cstring(v8, v12, v12); if (!v2) v2 = sshkey_puts(a1[24], v8, v8); } } } } } if (v2 || v2 || v2 || v2 || v2 || v2 || v2) { v19 = "assemble signed data"; sshfatal("sshconnect2.c", "sign_and_send_pubkey", 0x5ac, 0x1, 0x1, ssh_err(v2)); } if (v5) { if (!*((a0[8] + 128))) { v19 = "internal error: initial hostkey not recorded"; sshfatal("sshconnect2.c", "sign_and_send_pubkey", 0x5b0, 0x1, 0x1, 0x0); } v2 = sshkey_puts(*((a0[8] + 128)), v8, v8); if (v2) { v20 = v14; v19 = "assemble %s hostkey"; sshfatal("sshconnect2.c", "sign_and_send_pubkey", 0x5b4, 0x1, 0x1, ssh_err(v2)); } } v19 = v12; v2 = identity_sign(v10, &v6, &v7, sshbuf_ptr(v8), sshbuf_len(v8), a0[2108], *(&v21)); if (v2) { if (v2 == -46) break; if (v2 != -46) { if (v2 == -58 && !v3) { if (v10[16] != -1) { v13 = "agent "; } else if ((*((v10[24] + 4)) & 1)) { v13 = "token "; } v20 = v16; v19 = sshkey_type(a1[24]); v18 = v13; v17 = "%skey %s %s retu"; sshlog("sshconnect2.c", "sign_and_send_pubkey", 0x5c3, 0x0, 0x3, 0x0, *(&v21)); v3 = __addvsi3(v3, 0x1); continue; } if (v3 || v2 != -58) { if (a1[16] != -1) v24 = " from agent"; else v24 = &g_407745; v20 = v24; v19 = v10[32]; v18 = sshkey_type(v10[24]); v17 = "signing failed for %s \"%s\"%s"; sshlog("sshconnect2.c", "sign_and_send_pubkey", 0x5c7, 0x1, 0x2, ssh_err(v2), *(&v21)); break; } } } } } if (v3 > 1 || !v2 && v12) { if (!v6 || !v7) { v19 = "no signature"; sshfatal("sshconnect2.c", "sign_and_send_pubkey", 0x5cd, 0x1, 0x1, 0x0); } v2 = sshbuf_put_string(v8, v6, v7, v6); if (v2) { v19 = "append signature"; sshfatal("sshconnect2.c", "sign_and_send_pubkey", 0x5d1, 0x1, 0x1, ssh_err(v2)); } v2 = sshbuf_consume(v8, v11 + 1, v11 + 1); if (v2) { v19 = "consume"; sshfatal("sshconnect2.c", "sign_and_send_pubkey", 0x5d8, 0x1, 0x1, ssh_err(v2)); } v2 = sshpkt_start(a0, 0x32); if (!v2) { v2 = sshpkt_putb(a0, v8, v8); if (!v2) v2 = sshpkt_send(a0); } if (v2 || v2 || v2) { v19 = "enqueue request"; sshfatal("sshconnect2.c", "sign_and_send_pubkey", 0x5de, 0x1, 0x1, ssh_err(v2)); } v4 = 1; break; } } free(v16); free(v12); sshbuf_free(v8); freezero(v6, v7, v7); v23 = v4; } return v23; }
openssh-portable
angr_dream
static void print_encap_mpls(FILE *fp, struct rtattr *encap) { struct rtattr *tb[(__MPLS_IPTUNNEL_MAX - 1) + 1]; (parse_rtattr_flags( (tb), ((__MPLS_IPTUNNEL_MAX - 1)), ((void *)(((char *)(encap)) + ((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0)))), ((int)((encap)->rta_len) - ((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0))), (1 << 15))); if (tb[MPLS_IPTUNNEL_DST]) print_string( PRINT_ANY, "dst", " %s ", format_host( 28, ((int)((tb[MPLS_IPTUNNEL_DST])->rta_len) - ((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0))), ((void *)(((char *)(tb[MPLS_IPTUNNEL_DST])) + ((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0)))))); if (tb[MPLS_IPTUNNEL_TTL]) print_uint(PRINT_ANY, "ttl", "ttl %u ", rta_getattr_u8(tb[MPLS_IPTUNNEL_TTL])); }
void print_encap_mpls(undefined8 param_1, ushort *param_2) { undefined uVar1; undefined8 uVar2; undefined8 in_R9; long in_FS_OFFSET; undefined local_28[8]; ushort *local_20; long local_18; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); parse_rtattr_flags(local_28, 2, param_2 + 2, *param_2 - 4, 0x8000, in_R9, param_2, param_1); if (local_20 != (ushort *)0x0) { uVar2 = format_host(0x1c, *local_20 - 4, local_20 + 2); print_string(4, &DAT_00106f03, &DAT_00106efe, uVar2); } if (local_18 != 0) { uVar1 = rta_getattr_u8(local_18); print_uint(4, &DAT_00106f0f, "ttl %u ", uVar1); } if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) { __stack_chk_fail(); } return; }
iproute2-6.0.0
ghidra
int sshkey_fromb(struct sshbuf *b, struct sshkey **keyp) { return sshkey_from_blob_internal(b, keyp, 1); }
int sshkey_fromb(unsigned long long a0, unsigned long long a1) { return sshkey_from_blob_internal(a0, a1, 0x1); }
openssh-portable
angr_dream
int waitrfd(int fd, int *timeoutp) { return waitfd(fd, timeoutp, 0x001); }
long long waitrfd(unsigned long a0, unsigned int *a1) { return waitfd(a0, a1, 0x1); }
openssh-portable
angr_sailr
static _Bool insert_exec_ok(const char *action, const struct parser_table *entry, char **argv, int *arg_ptr) { int start, end; int i; int saw_braces; _Bool allow_plus; int brace_count; const char *brace_arg; PRED_FUNC func = entry->pred_func; enum BC_INIT_STATUS bcstatus; struct predicate *our_pred; struct exec_val *execp; if ((argv == ((void *)0)) || (argv[*arg_ptr] == ((void *)0))) return 0; our_pred = insert_primary_withpred(entry, func, "(some -exec* arguments)"); our_pred->side_effects = our_pred->no_default_print = 1; our_pred->need_type = our_pred->need_stat = 0; execp = &our_pred->args.exec_vec; execp->wd_for_exec = ((void *)0); if ((func != pred_okdir) && (func != pred_ok)) { allow_plus = 1; execp->close_stdin = 0; } else { allow_plus = 0; options.ok_prompt_stdin = 1; execp->close_stdin = 1; } if ((func == pred_execdir) || (func == pred_okdir)) { execp->wd_for_exec = ((void *)0); options.ignore_readdir_race = 0; check_path_safety(action); } else { ((void)sizeof((((void *)0) != initial_wd) ? 1 : 0), __extension__({ if (((void *)0) != initial_wd) ; else __assert_fail("NULL != initial_wd", "parser.c", 2937, __extension__ __PRETTY_FUNCTION__); })); execp->wd_for_exec = initial_wd; } our_pred->args.exec_vec.multiple = 0; start = *arg_ptr; for (end = start, saw_braces = 0, brace_count = 0, brace_arg = ((void *)0); (argv[end] != ((void *)0)) && ((argv[end][0] != ';') || (argv[end][1] != '\0')); end++) { if (allow_plus && argv[end][0] == '+' && argv[end][1] == 0 && saw_braces) { our_pred->args.exec_vec.multiple = 1; break; } saw_braces = 0; if (mbsstr(argv[end], "{}")) { saw_braces = 1; brace_arg = argv[end]; ++brace_count; if (0 == end && (func == pred_execdir || func == pred_okdir)) { ((!!sizeof(struct { _Static_assert( 1, "verify_expr (" "1" ", " "(error (1, 0, gettext (\"You may not use {} within the " "utility name for \" \"-execdir and -okdir, because this is a " "potential \" \"security problem.\")), assume (false))" ")"); int _gl_dummy; })) ? ((error( 1, 0, gettext("You may not use {} within the utility name for " "-execdir and -okdir, because this is a potential " "security problem.")), ((0) ? (void)0 : __builtin_unreachable()))) : ((error( 1, 0, gettext("You may not use {} within the utility name for " "-execdir and -okdir, because this is a potential " "security problem.")), ((0) ? (void)0 : __builtin_unreachable())))) ; } } } if ((end == start) || (argv[end] == ((void *)0))) { *arg_ptr = end; free(our_pred); return 0; } if (our_pred->args.exec_vec.multiple) { const char *suffix; if (func == pred_execdir) suffix = "dir"; else suffix = ""; if (brace_count > 1) { ((!!sizeof(struct { _Static_assert( 1, "verify_expr (" "1" ", " "(error (1, 0, gettext (\"Only one instance of {} is supported " "with -exec%s ... +\"), suffix), assume (false))" ")"); int _gl_dummy; })) ? ((error(1, 0, gettext("Only one instance of {} is supported with " "-exec%s ... +"), suffix), ((0) ? (void)0 : __builtin_unreachable()))) : ((error(1, 0, gettext("Only one instance of {} is supported with " "-exec%s ... +"), suffix), ((0) ? (void)0 : __builtin_unreachable())))) ; } else if (strlen(brace_arg) != 2u) { enum { MsgBufSize = 19 }; char buf[MsgBufSize]; const size_t needed = snprintf(buf, MsgBufSize, "-exec%s ... {} +", suffix); ((void)sizeof((needed <= MsgBufSize) ? 1 : 0), __extension__({ if (needed <= MsgBufSize) ; else __assert_fail("needed <= MsgBufSize", "parser.c", 3014, __extension__ __PRETTY_FUNCTION__); })); ((!!sizeof(struct { _Static_assert( 1, "verify_expr (" "1" ", " "(error (1, 0, gettext (\"In %s the %s must appear by itself, " "but you specified %s\"), quotearg_n_style (0, " "options.err_quoting_style, buf), quotearg_n_style (1, " "options.err_quoting_style, \"{}\"), quotearg_n_style (2, " "options.err_quoting_style, brace_arg)), assume (false))" ")"); int _gl_dummy; })) ? ((error(1, 0, gettext("In %s the %s must appear by itself, but you " "specified %s"), quotearg_n_style(0, options.err_quoting_style, buf), quotearg_n_style(1, options.err_quoting_style, "{}"), quotearg_n_style(2, options.err_quoting_style, brace_arg)), ((0) ? (void)0 : __builtin_unreachable()))) : ((error(1, 0, gettext("In %s the %s must appear by itself, but you " "specified %s"), quotearg_n_style(0, options.err_quoting_style, buf), quotearg_n_style(1, options.err_quoting_style, "{}"), quotearg_n_style(2, options.err_quoting_style, brace_arg)), ((0) ? (void)0 : __builtin_unreachable())))) ; } } bcstatus = bc_init_controlinfo(&execp->ctl, 2048u); switch (bcstatus) { case BC_INIT_ENV_TOO_BIG: case BC_INIT_CANNOT_ACCOMODATE_HEADROOM: ((!!sizeof(struct { _Static_assert(1, "verify_expr (" "1" ", " "(error (1, 0, gettext (\"The environment is too large " "for exec().\")), assume (false))" ")"); int _gl_dummy; })) ? ((error(1, 0, gettext("The environment is too large for exec().")), ((0) ? (void)0 : __builtin_unreachable()))) : ((error(1, 0, gettext("The environment is too large for exec().")), ((0) ? (void)0 : __builtin_unreachable())))); break; case BC_INIT_OK: break; } bc_use_sensible_arg_max(&execp->ctl); execp->ctl.exec_callback = launch; if (our_pred->args.exec_vec.multiple) { execp->replace_vec = ((void *)0); execp->ctl.replace_pat = ((void *)0); execp->ctl.rplen = 0; execp->ctl.lines_per_exec = 0; execp->ctl.args_per_exec = 0; execp->ctl.initial_argc = (end - start) - 1; bc_init_state(&execp->ctl, &execp->state, execp); for (i = start; i < end - 1; ++i) { bc_push_arg(&execp->ctl, &execp->state, argv[i], strlen(argv[i]) + 1, ((void *)0), 0, 1); } } else { execp->num_args = end - start; execp->ctl.replace_pat = "{}"; execp->ctl.rplen = strlen(execp->ctl.replace_pat); execp->ctl.lines_per_exec = 0; execp->ctl.args_per_exec = 0; execp->replace_vec = xmalloc(sizeof(char *) * execp->num_args); bc_init_state(&execp->ctl, &execp->state, execp); for (i = 0; i < execp->num_args; ++i) { execp->replace_vec[i] = argv[i + start]; } } if (argv[end] == ((void *)0)) *arg_ptr = end; else *arg_ptr = end + 1; return 1; }
void insert_exec_ok(unsigned long long a0, struct_0 *a1, char *a2[2], unsigned int *a3) { unsigned long long v0; char v1; unsigned int v2; unsigned int v3; unsigned int v4; unsigned int v5; unsigned int v6; unsigned int v7; void *v8; unsigned long long v9; unsigned long long v10; char v11[57]; struct_1 *v12; unsigned long v13; char v14; void *v16; void *v17; unsigned long long v18; unsigned long long v19; unsigned long long v20; unsigned long long v21; v10 = a1->field_18; if (a2 && a2[*(a3)]) { *(&v11[0]) = insert_primary_withpred(a1, v10, "(some -exec* arguments)", v10); v11[25] = 1; v11[24] = v11[25]; v11[26] = 0; v11[27] = v11[26]; v12 = &v11[56]; v12->field_c0 = 0; if (v10 == got.pred_okdir || v10 == got.pred_ok) { v1 = 0; get_stat_mtime = 1; v12->field_bc = 1; } else { v1 = 1; v12->field_bc = 0; } if (v10 == got.pred_execdir || v10 == got.pred_okdir) { v12->field_c0 = 0; g_500016 = 0; check_path_safety(a0); } else if (initial_wd) { v12->field_c0 = initial_wd; } else { __assert_fail(); } v11[56] = 0; v6 = *(a3); v2 = v6; v4 = 0; v5 = 0; v8 = 0; while (true) { if (!(a2[v2]) || !(a2[v2] != 59) && !(a2[v2 + 1])) { LABEL_404d6d: if (!(v2 != v6) || !(a2[v2])) { *(a3) = v2; free(v11); v17 = 0; return; } if (v11[56]) { if (v10 == got.pred_execdir) v9 = "dir"; else v9 = &g_406c06; if (v5 > 1) error( 0x1, 0x0, gettext( "Only one instance of {} is supported with -exec%s ... +")); if (strlen(v8) != 2) { v13 = snprintf(&v14, 0x13, "-exec%s ... {} +", v9); if (v13 > 19) __assert_fail(); v18 = quotearg_n_style(0x2, g_500074, v8); v19 = quotearg_n_style(0x1, g_500074, "{}"); v20 = quotearg_n_style(0x0, g_500074, &v14); error(0x1, 0x0, gettext("In %s the %s must appear by itself, but you " "specified %s")); } } v7 = bc_init_controlinfo(&v12->padding_0[8], 0x800); if (v7 && v7 - 1 <= 1) error(0x1, 0x0, gettext("The environment is too large for exec().")); bc_use_sensible_arg_max(&v12->padding_0[8]); v12->field_48 = got.launch; if (!v11[56]) { v12->field_b8 = v2 - v6; v12->field_38 = "{}"; v12->field_30 = strlen(v12->field_38); v12->field_50 = 0; v12->field_58 = 0; v12->field_b0 = xmalloc(v12->field_b8 * 8); bc_init_state(&v12->padding_0[8], &v12->padding_60, v12, &v12->padding_0[8]); for (v3 = 0; v3 < v12->field_b8; v3 += 1) { *((v3 * 8 + v12->field_b0)) = a2[v3 + v6]; } } else { v12->field_b0 = 0; v12->field_38 = 0; v12->field_30 = 0; v12->field_50 = 0; v12->field_58 = 0; v12->field_40 = v2 - v6 - 1; bc_init_state(&v12->padding_0[8], &v12->padding_60, v12, &v12->padding_0[8]); for (v3 = v6; v3 < v2 - 1; v3 += 1) { v0 = 1; bc_push_arg(&v12->padding_0[8], &v12->padding_60, a2[v3], strlen(a2[v3]) + 1, 0x0, 0x0); } } } else if (!v1 || a2[v2] != 43 || a2[v2 + 1] || !v4) { v4 = 0; if (mbsstr(a2[v2], "{}", v2 << 3)) { v4 = 1; *(&v8) = a2[v2]; v5 += 1; if (!v2 && (!(v10 != got.pred_execdir) || !(v10 != got.pred_okdir))) error(0x1, 0x0, gettext("You may not use {} within the utility name for " "-execdir and -okdir, because this is a potential " "security problem.")); } v2 += 1; } else { v11[56] = 1; goto LABEL_404d6d; } } if (!a2[v2]) *(a3) = v2; else *(a3) = v2 + 1; v21 = 1; return; } v16 = 0; return; }
findutils
angr_sailr
char *xheader_ghdr_name(void) { if (!globexthdr_name) { size_t len; const char *global_header_template = header_template[pax_global_header][posixly_correct]; const char *tmp = getenv("TMPDIR"); if (!tmp) tmp = "/tmp"; len = strlen(tmp) + strlen(global_header_template) + 1; globexthdr_name = xmalloc(len); strcpy(globexthdr_name, tmp); strcat(globexthdr_name, global_header_template); } return xheader_format_name(((void *)0), globexthdr_name, global_header_count + 1); }
int xheader_ghdr_name() { unsigned long long v0; char *v1; unsigned long long v2; if (globexthdr_name) return xheader_format_name(NULL, globexthdr_name, global_header_count + 1); v1 = (&header_template)[2 + posixly_correct]; v0 = getenv("TMPDIR"); if (!v0) v0 = "/tmp"; v2 = strlen(v1) + strlen(v0) + 1; globexthdr_name = xmalloc(v2); strcpy(globexthdr_name, v0); strcat(globexthdr_name, v1); return xheader_format_name(NULL, globexthdr_name, global_header_count + 1); }
tar
angr_sailr
void malloc_set_tracefn(s, fn) char *s; char *fn; { }
void malloc_set_tracefn() { ; }
bash
ida
static _Bool is_directory(const struct fileinfo *f) { return f->filetype == directory || f->filetype == arg_directory; }
int is_directory(struct_0 *a0) { unsigned int v1; unsigned int v2; switch (a0->field_a8) { case 3: case 9: v1 = 1; break; default: v1 = 0; break; } v2 = v1 & 1; return v2; }
coreutils
angr_sailr
static struct timespec *attrib_to_ts(const Attrib *a) { static struct timespec ts[2]; ts[0].tv_sec = a->atime; ts[0].tv_nsec = 0; ts[1].tv_sec = a->mtime; ts[1].tv_nsec = 0; return ts; }
int attrib_to_ts(unsigned int a0[9]) { ts.13174 = a0[7]; g_407dc8 = 0; g_407dd0 = a0[8]; g_407dd8 = 0; return &ts.13174; }
openssh-portable
angr_dream
static int string_gcd(s1, s2) char *s1, *s2; { register int i; if (s1 == ((void *)0) || s2 == ((void *)0)) return (0); for (i = 0; *s1 && *s2; ++s1, ++s2, ++i) { if (*s1 != *s2) break; } return (i); }
int string_gcd(unsigned long a0, unsigned long a1) { char *v0; char *v1; unsigned int v3; unsigned int v4; v1 = a0; v0 = a1; if (!v1) { v3 = 0; return v3; } else if (!v0) { v3 = 0; return v3; } else { for (v4 = 0; *(v1) && *(v0) && *(v1) == *(v0); v4 += 1) { v1 += 1; v0 += 1; } v3 = v4; return v3; } }
bash
angr_sailr
void libbsd_MD5Pad(MD5_CTX *context) { MD5Pad(context); }
void libbsd_MD5Pad(undefined8 param_1) { MD5Pad(param_1); return; }
libbsd-0.11.7
ghidra
int auth_shadow_pwexpired(Authctxt *ctxt) { struct spwd *spw = ((void *)0); const char *user = ctxt->pw->pw_name; time_t today; int r, daysleft, disabled = 0; if ((spw = getspnam((char *)user)) == ((void *)0)) { sshlog("auth-shadow.c", __func__, 96, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "Could not get shadow information for %.100s", user); return 0; } today = time(((void *)0)) / (24L * 60 * 60); sshlog("auth-shadow.c", __func__, 101, 0, SYSLOG_LEVEL_DEBUG3, ((void *)0), "%s: today %d sp_lstchg %d sp_max %d", __func__, (int)today, (int)spw->sp_lstchg, (int)spw->sp_max); daysleft = spw->sp_lstchg + spw->sp_max - today; if (disabled) { sshlog("auth-shadow.c", __func__, 122, 0, SYSLOG_LEVEL_DEBUG3, ((void *)0), "password expiration disabled"); } else if (spw->sp_lstchg == 0) { sshlog("auth-shadow.c", __func__, 124, 0, SYSLOG_LEVEL_INFO, ((void *)0), "User %.100s password has expired (root forced)", user); return 1; } else if (spw->sp_max == -1) { sshlog("auth-shadow.c", __func__, 127, 0, SYSLOG_LEVEL_DEBUG3, ((void *)0), "password expiration disabled"); } else if (daysleft < 0) { sshlog("auth-shadow.c", __func__, 129, 0, SYSLOG_LEVEL_INFO, ((void *)0), "User %.100s password has expired (password aged)", user); return 1; } else if (daysleft <= spw->sp_warn) { sshlog("auth-shadow.c", __func__, 132, 0, SYSLOG_LEVEL_DEBUG3, ((void *)0), "password will expire in %d days", daysleft); if ((r = sshbuf_putf(loginmsg, "Your password will expire in %d day%s.\n", daysleft, daysleft == 1 ? "" : "s")) != 0) sshfatal("auth-shadow.c", __func__, 136, 0, SYSLOG_LEVEL_FATAL, ((void *)0), "%s: buffer error: %s", __func__, ssh_err(r)); } return 0; }
undefined8 auth_shadow_pwexpired(long param_1) { long lVar1; undefined8 uVar2; time_t tVar3; undefined *puVar4; int iVar5; undefined8 uVar6; uVar2 = **(undefined8 **)(param_1 + 0x30); lVar1 = getspnam(uVar2); if (lVar1 == 0) { sshlog("auth-shadow.c", "auth_shadow_pwexpired", 0x60, 0, 2, 0, "Could not get shadow information for %.100s", uVar2); uVar2 = 0; } else { uVar6 = 0x1002d2; tVar3 = time((time_t *)0x0); sshlog("auth-shadow.c", "auth_shadow_pwexpired", 0x65, 0, 7, 0, "%s: today %d sp_lstchg %d sp_max %d", "auth_shadow_pwexpired", tVar3 / 0x15180, *(ulong *)(lVar1 + 0x10) & 0xffffffff, *(ulong *)(lVar1 + 0x20) & 0xffffffff, uVar6); iVar5 = ((int)*(undefined8 *)(lVar1 + 0x10) + (int)*(undefined8 *)(lVar1 + 0x20)) - (int)(tVar3 / 0x15180); if (*(long *)(lVar1 + 0x10) == 0) { sshlog("auth-shadow.c", "auth_shadow_pwexpired", 0x7c, 0, 3, 0, "User %.100s password has expired (root forced)", uVar2); uVar2 = 1; } else { if (*(long *)(lVar1 + 0x20) == -1) { sshlog("auth-shadow.c", "auth_shadow_pwexpired", 0x7f, 0, 7, 0, "password expiration disabled"); } else { if (iVar5 < 0) { sshlog("auth-shadow.c", "auth_shadow_pwexpired", 0x81, 0, 3, 0, "User %.100s password has expired (password aged)", uVar2); return 1; } if ((long)iVar5 <= *(long *)(lVar1 + 0x28)) { sshlog("auth-shadow.c", "auth_shadow_pwexpired", 0x84, 0, 7, 0, "password will expire in %d days", iVar5); if (iVar5 == 1) { puVar4 = &DAT_0010062f; } else { puVar4 = &DAT_00100630; } iVar5 = sshbuf_putf(loginmsg, "Your password will expire in %d day%s.\n", iVar5, puVar4); if (iVar5 != 0) { uVar6 = 0x100551; uVar2 = ssh_err(iVar5); sshfatal("auth-shadow.c", "auth_shadow_pwexpired", 0x88, 0, 1, 0, "%s: buffer error: %s", "auth_shadow_pwexpired", uVar2, uVar6); } } } uVar2 = 0; } } return uVar2; }
openssh-portable
ghidra
static int find_orphan(const char *uname, const char *fname, const char *tabname) { orphan *o; for (o = orphans; o != ((void *)0); o = o->next) { if (uname && o->uname) { if (strcmp(uname, o->uname) != 0) continue; } else if (uname != o->uname) continue; if (fname && o->fname) { if (strcmp(fname, o->fname) != 0) continue; } else if (fname != o->fname) continue; if (tabname && o->tabname) { if (strcmp(tabname, o->tabname) != 0) continue; } else if (tabname != o->tabname) continue; return 1; } return 0; }
int find_orphan(char *a0, char *a1, char *a2) { unsigned long long v0[4]; unsigned long long v2; v0[0] = orphans; while (true) { if (v0) { if (a0 && v0[1]) v2 = strcmp(a0, v0[1]); if (a1 && (a0 == v0[1] || a0) && (a0 == v0[1] || v0[1]) && (!a0 || !v2 || !v0[1]) && v0[2]) v2 = strcmp(a1, v0[2]); if ((!a0 && a0 == v0[1] || !v0[1] && a0 == v0[1] || !v2 && a0 && v0[1]) && (!v0[2] && a1 == v0[2] || !a1 && a1 == v0[2] || !v2 && v0[2] && a1) && a2 && v0[3]) v2 = strcmp(a2, v0[3]); if ((a0 == v0[1] || a0) && (a0 == v0[1] || v0[1]) && (a1 == v0[2] || v0[2]) && (a1 == v0[2] || a1) && (!a0 || !v2 || !v0[1]) && (!v0[2] || !a1 || !v2) && a2 && v0[3] && !v2 || ((a0 == v0[1] || a0) && (a0 == v0[1] || v0[1]) && (a1 == v0[2] || v0[2]) && (a1 == v0[2] || a1) && (!a0 || !v2 || !v0[1]) && (!v0[2] || !a1 || !v2) && a2 && !v0[3] || (a0 == v0[1] || a0) && (a0 == v0[1] || v0[1]) && (a1 == v0[2] || v0[2]) && (a1 == v0[2] || a1) && (!a0 || !v2 || !v0[1]) && (!v0[2] || !a1 || !v2) && !a2) && a2 == v0[3]) { v2 = 1; break; } if (...) v0[0] = v0[0]; } else { v2 = 0; break; } } return v2; }
cronie
angr_dream
static _Bool may_change_field(int field) { const char *cp; if (amroot) { return 1; } cp = getdef_str("CHFN_RESTRICT"); if (((void *)0) == cp) { cp = ""; } else if (strcmp(cp, "yes") == 0) { cp = "rwh"; } else if (strcmp(cp, "no") == 0) { cp = "frwh"; } if (strchr(cp, field) != ((void *)0)) { return 1; } return 0; }
int may_change_field(unsigned long a0) { unsigned long long v0; unsigned int v2; if (amroot) { v2 = 1; } else { v0 = getdef_str("CHFN_RESTRICT"); if (!v0) { v0 = &g_40ba5b; } else if (!strcmp(v0, "yes")) { v0 = "rwh"; } else if (!strcmp(v0, "no")) { v0 = "frwh"; } if (strchr(v0, a0)) v2 = 1; else v2 = 0; } return v2; }
shadow
angr_phoenix
const char *path, _Bool *fstype_known); static void free_file_system_list( struct mount_entry *p) { while (p) { struct mount_entry *pnext = p->me_next; free_mount_entry(p); p = pnext; } }
void free_file_system_list(long param_1) { long lVar1; long local_20; local_20 = param_1; while (local_20 != 0) { lVar1 = *(long *)(local_20 + 0x30); free_mount_entry(local_20); local_20 = lVar1; } return; }
findutils
ghidra
&& (!obscure (orig, pass, pw) || reuse (pass, pw))) { (void)puts(gettext( "\nWarning: weak password (enter it again to use it anyway).")); warned = 1; continue; }
void obscure(void) { halt_baddata(); }
shadow
ghidra
void match_node_free(struct match_node *node) { free(node->filetype); free(node->filename); free(node); }
long long match_node_free(unsigned long long a0[3]) { free(a0[1]); free(a0[2]); return free(a0); }
dpkg
angr_phoenix
static int print_tuntap(struct nlmsghdr *n, void *arg) { struct ifinfomsg *ifi = ((void *)(((char *)n) + ((int)(((sizeof(struct nlmsghdr)) + 4U - 1) & ~(4U - 1))))); struct rtattr *tb[(__IFLA_MAX - 1) + 1]; struct rtattr *linkinfo[(__IFLA_INFO_MAX - 1) + 1]; const char *name, *kind; long flags, owner = -1, group = -1; if (n->nlmsg_type != RTM_NEWLINK && n->nlmsg_type != RTM_DELLINK) return 0; if (n->nlmsg_len < ((sizeof(*ifi)) + ((int)(((sizeof(struct nlmsghdr)) + 4U - 1) & ~(4U - 1))))) return -1; switch (ifi->ifi_type) { case 0xFFFE: case 1: break; default: return 0; } parse_rtattr( tb, (__IFLA_MAX - 1), ((struct rtattr *)(((char *)(ifi)) + (((sizeof(struct ifinfomsg)) + 4U - 1) & ~(4U - 1)))), ((n)->nlmsg_len - ((((((sizeof(struct ifinfomsg))) + ((int)(((sizeof(struct nlmsghdr)) + 4U - 1) & ~(4U - 1))))) + 4U - 1) & ~(4U - 1)))); if (!tb[IFLA_IFNAME]) return 0; if (!tb[IFLA_LINKINFO]) return 0; (parse_rtattr_flags( (linkinfo), ((__IFLA_INFO_MAX - 1)), ((void *)(((char *)(tb[IFLA_LINKINFO])) + ((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0)))), ((int)((tb[IFLA_LINKINFO])->rta_len) - ((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0))), (1 << 15))); if (!linkinfo[IFLA_INFO_KIND]) return 0; kind = rta_getattr_str(linkinfo[IFLA_INFO_KIND]); if (strcmp(kind, drv_name)) return 0; name = rta_getattr_str(tb[IFLA_IFNAME]); if (read_prop(name, "tun_flags", &flags)) return 0; if (read_prop(name, "owner", &owner)) return 0; if (read_prop(name, "group", &group)) return 0; open_json_object(((void *)0)); print_color_string(PRINT_ANY, COLOR_IFNAME, "ifname", "%s:", name); print_flags(flags); if (owner != -1) print_u64(PRINT_ANY, "user", " user %ld", owner); if (group != -1) print_u64(PRINT_ANY, "group", " group %ld", group); if (show_details) { print_string(PRINT_FP, ((void *)0), "%s\tAttached to processes:", _SL_); show_processes(name); } close_json_object(); print_string(PRINT_FP, ((void *)0), "%s", "\n"); return 0; }
long long print_tuntap(struct_0 *a0, unsigned long a1) { unsigned long v0; char v1; unsigned long long v2; unsigned long long v3; struct_1 *v4; char *v5; char *v6; char v7; char v8; char v9; char v10; char v11; unsigned long long v13; v0 = a1; v4 = &a0[2].field_4; v2 = -1; v3 = -1; if (a0->field_4 != 16 && a0->field_4 != 17) v13 = 0; if (a0->field_4 == 17 || a0->field_4 == 16) { if (a0->field_0 <= 31) { v13 = 4294967295; } else { if (v4->field_2 != 1 && v4->field_2 != 65534) v13 = 0; if (v4->field_2 == 1 || v4->field_2 == 65534) { parse_rtattr(&v9, 0x3c, v4 + 4, a0->field_0 - 32); if (!*(&v10)) { v13 = 0; } else if (!*(&v11)) { v13 = 0; } else { parse_rtattr_flags(&v7, 0x5, *(&v11) + 4, *(*(&v11)) - 4, 0x8000); if (!*(&v8)) { v13 = 0; } else { v5 = rta_getattr_str(*(&v8)); if (strcmp(v5, "tun")) { v13 = 0; } else { v6 = rta_getattr_str(*(&v10)); if (read_prop(v6, "tun_flags", &v1)) { v13 = 0; } else if (read_prop(v6, "owner", &v2)) { v13 = 0; } else if (read_prop(v6, "group", &v3)) { v13 = 0; } else { open_json_object(0x0); print_color_string(0x4, 0x0, "ifname", "%s:", v6); print_flags(*(&v1)); if (v2 != -1) print_u64(0x4, "user", " user %ld", v2); if (v3 != -1) print_u64(0x4, "group", " group %ld", v3); if (show_details) { print_string(0x1, 0x0, "%s\tAttached to processes:", _SL_); show_processes(v6); } close_json_object(); print_string(0x1, 0x0, "%s", "\n"); v13 = 0; } } } } } } } return v13; }
iproute2-6.0.0
angr_dream
void wcdequote_pathname(wpathname) wchar_t *wpathname; { int i, j; for (i = j = 0; wpathname && wpathname[i];) { if (wpathname[i] == L'\\') i++; wpathname[j++] = wpathname[i++]; if (wpathname[i - 1] == L'\0') break; } if (wpathname) wpathname[j] = L'\0'; }
void wcdequote_pathname(unsigned int *a0) { unsigned int v0; int tmp_35; int tmp_60; unsigned int v1; unsigned long long v3; unsigned long long v4; unsigned long long v5; unsigned long long v6; v1 = 0; v3 = v1; v0 = v1; while (true) { if (!a0) goto LABEL_400c1d; v4 = a0[v0]; switch (a0[v0]) { case 0: LABEL_400c1d: if (a0) { v6 = &a0[v1]; a0[v1] = 0; break; } case 92: v0 += 1; goto LABEL_400ba2; default: LABEL_400ba2: tmp_35 = v0; v0 += 1; tmp_60 = v1; v1 += 1; a0[tmp_60] = a0[tmp_35]; v5 = a0[1 + v0]; if (!a0[1 + v0]) goto LABEL_400c1d; continue; } } return; }
bash
angr_sailr
int tun_open(int tun, int mode, char **ifname) { return (sys_tun_open(tun, mode, ifname)); }
long long tun_open(unsigned long a0, unsigned long a1, unsigned long long a2) { return sys_tun_open(a0, a1, a2, a1); }
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 long v3; unsigned long long v4; unsigned long long v5; unsigned long long v6; unsigned long long v7; unsigned long long v8; unsigned long long v9; unsigned long long v10; unsigned long long v11; unsigned long long v12; unsigned long long v13; unsigned long long v14; unsigned long long v15; void *v16; void *v17; char v18; unsigned long long v20; unsigned long long *v21; unsigned long long v22; v4 = "["; v5 = "test invocation"; v6 = "coreutils"; v7 = "Multi-call invocation"; v8 = "sha224sum"; v9 = "sha2 utilities"; v10 = "sha256sum"; v11 = "sha2 utilities"; v12 = "sha384sum"; v13 = "sha2 utilities"; v14 = "sha512sum"; v15 = "sha2 utilities"; v16 = 0; v17 = 0; v0 = a0; v1[0] = &v4; while (true) { if (!v1[0]) break; if (!strcmp(a0, v1[0])) break; v1[0] = v1 + 1; } if (v1[1]) v0 = v1[1]; printf(gettext("\n%s online help: <%s>\n")); v2 = setlocale(0x5, NULL); if (v2 && strncmp(v2, "en_", 0x3)) fputs_unlocked(gettext("Report any translation bugs to <https: if (!strcmp(a0, "[")) v20 = "test"; else v20 = a0; v3 = v20; printf(gettext("Full documentation <%s%s>\n")); printf(gettext("or available locally via: info '(coreutils) %s%s'\n")); v22 = *(&v18) ^ v21[5]; return; }
coreutils
angr_phoenix
static _Bool nomoreargs(void) { return *args == 0; }
bool nomoreargs() { return *(_QWORD *)args == 0LL; }
coreutils
ida
static time_t time_from_header(const char *p, size_t s) { return from_header( p, s, "time_t", ((time_t)~( (time_t)(!(!((time_t)0 < (time_t)-1)) ? (time_t)-1 : ((((time_t)1 << ((sizeof(time_t) * 8) - 2)) - 1) * 2 + 1)))), ((time_t)(!(!((time_t)0 < (time_t)-1)) ? (time_t)-1 : ((((time_t)1 << ((sizeof(time_t) * 8) - 2)) - 1) * 2 + 1))), 0, 0); }
int time_from_header(unsigned long long a0, unsigned long long a1) { return from_header(a0, a1, "time_t", 0x8000000000000000, 0x7fffffffffffffff, 0x0, 0x0); }
tar
angr_sailr
static void write_checkpoint(char *cpfile, u_int32_t lineno) { FILE *fp; char tmp[4096]; int r; r = snprintf(tmp, sizeof(tmp), "%s.XXXXXXXXXX", cpfile); if (r < 0 || r >= 4096) { sshlog("moduli.c", __func__, 459, 0, SYSLOG_LEVEL_INFO, ((void *)0), "write_checkpoint: temp pathname too long"); return; } if ((r = mkstemp(tmp)) == -1) { sshlog("moduli.c", __func__, 463, 0, SYSLOG_LEVEL_INFO, ((void *)0), "mkstemp(%s): %s", tmp, strerror((*__errno_location()))); return; } if ((fp = fdopen(r, "w")) == ((void *)0)) { sshlog("moduli.c", __func__, 467, 0, SYSLOG_LEVEL_INFO, ((void *)0), "write_checkpoint: fdopen: %s", strerror((*__errno_location()))); unlink(tmp); close(r); return; } if (fprintf(fp, "%lu\n", (unsigned long)lineno) > 0 && fclose(fp) == 0 && rename(tmp, cpfile) == 0) sshlog("moduli.c", __func__, 474, 0, SYSLOG_LEVEL_DEBUG3, ((void *)0), "wrote checkpoint line %lu to '%s'", (unsigned long)lineno, cpfile); else sshlog("moduli.c", __func__, 477, 0, SYSLOG_LEVEL_INFO, ((void *)0), "failed to write to checkpoint file '%s': %s", cpfile, strerror((*__errno_location()))); }
void write_checkpoint(char *param_1, uint param_2) { int iVar1; int *piVar2; char *pcVar3; FILE *__stream; long in_FS_OFFSET; undefined8 uVar4; char local_1018[4104]; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); uVar4 = 0x100ed0; iVar1 = snprintf(local_1018, 0x1000, "%s.XXXXXXXXXX", param_1); if ((iVar1 < 0) || (0xfff < iVar1)) { sshlog("moduli.c", "write_checkpoint", 0x1cb, 0, 3, 0, "write_checkpoint: temp pathname too long", uVar4); } else { iVar1 = mkstemp(local_1018); if (iVar1 == -1) { piVar2 = __errno_location(); uVar4 = 0x100f5a; pcVar3 = strerror(*piVar2); sshlog("moduli.c", "write_checkpoint", 0x1cf, 0, 3, 0, "mkstemp(%s): %s", local_1018, pcVar3, uVar4); } else { __stream = fdopen(iVar1, "w"); if (__stream == (FILE *)0x0) { piVar2 = __errno_location(); pcVar3 = strerror(*piVar2); sshlog("moduli.c", "write_checkpoint", 0x1d3, 0, 3, 0, "write_checkpoint: fdopen: %s", pcVar3); unlink(local_1018); close(iVar1); } else { iVar1 = fprintf(__stream, "%lu\n", (ulong)param_2); if (0 < iVar1) { iVar1 = fclose(__stream); if (iVar1 == 0) { uVar4 = 0x101086; iVar1 = rename(local_1018, param_1); if (iVar1 == 0) { sshlog("moduli.c", "write_checkpoint", 0x1da, 0, 7, 0, "wrote checkpoint line %lu to \'%s\'", param_2, param_1, uVar4); goto LAB_0010112a; } } } piVar2 = __errno_location(); uVar4 = 0x1010e5; pcVar3 = strerror(*piVar2); sshlog("moduli.c", "write_checkpoint", 0x1dd, 0, 3, 0, "failed to write to checkpoint file \'%s\': %s", param_1, pcVar3, uVar4); } } } LAB_0010112a: if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) { __stack_chk_fail(); } return; }
openssh-portable
ghidra
void sshkey_sig_details_free(struct sshkey_sig_details *details) { freezero(details, sizeof(*details)); }
long long sshkey_sig_details_free(unsigned long long a0) { return freezero(a0, 0x8); }
openssh-portable
angr_phoenix
int rl_end_of_history(int count, int key) { rl_maybe_replace_line(); using_history(); rl_maybe_unsave_line(); return 0; }
long rl_end_of_history() { rl_maybe_replace_line(); using_history(); rl_maybe_unsave_line(); return 0LL; }
bash
ida
int sshkey_save_public(const struct sshkey *key, const char *path, const char *comment) { int fd, oerrno; FILE *f = ((void *)0); int r = -1; if ((fd = open(path, 01 | 0100 | 01000, 0644)) == -1) return -24; if ((f = fdopen(fd, "w")) == ((void *)0)) { r = -24; close(fd); goto fail; } if ((r = sshkey_write(key, f)) != 0) goto fail; fprintf(f, " %s\n", comment); if (ferror(f)) { r = -24; goto fail; } if (fclose(f) != 0) { r = -24; f = ((void *)0); fail: if (f != ((void *)0)) { oerrno = (*__errno_location()); fclose(f); (*__errno_location()) = oerrno; } return r; } return 0; }
long long sshkey_save_public(unsigned long long a0, char *a1, unsigned long a2) { unsigned int v0; unsigned int v1; unsigned int v2; void *v3; unsigned long long v5; unsigned long long v6; unsigned long long v7; v3 = 0; v0 = -1; v1 = open(a1, 0x241, 0x1a4); if (v1 == -1) { v5 = 4294967272; } else { v3 = fdopen(v1, "w"); if (!v3) { v0 = -24; close(v1); } else { v0 = sshkey_write(a0, v3, v3); if (!v0) { fprintf(v3, " %s\n", a2); v6 = ferror(v3); if (v6) { v0 = -24; } else { v7 = fclose(v3); if (v7) { v0 = -24; v3 = 0; } else { v5 = 0; } } } } if (!v3 || v7 || v0 || v6) { if (v3) { v2 = *(__errno_location()); fclose(v3); *(__errno_location()) = v2; } v5 = v0; } } return v5; }
openssh-portable
angr_dream
static void alloc_string(struct string *s, int len) { s->s = malloc(len); s->len = len; s->end = 0; }
long alloc_string(long a1, int a2) { long result; *(_QWORD *)a1 = malloc(a2); *(_DWORD *)(a1 + 8) = a2; result = a1; *(_DWORD *)(a1 + 12) = 0; return result; }
e2fsprogs-1.46.5
ida
static int readtoken(void) { int t; int kwd = checkkwd; top: t = xxreadtoken(); if (kwd & 0x4) { while (t == 1) { parseheredoc(); checkkwd = 0; t = xxreadtoken(); } } kwd |= checkkwd; checkkwd = 0; if (t != 12 || quoteflag) { goto out; } if (kwd & 0x2) { const char *const *pp; if ((pp = findkwd(wordtext))) { lasttoken = t = pp - parsekwd + 13; ; goto out; } } if (kwd & 0x1) { struct alias *ap; if ((ap = lookupalias(wordtext, 1)) != ((void *)0)) { if (*ap->val) { pushstring(ap->val, ap); } goto top; } } out: return (t); }
(local_48 == 0)) { iVar2 = readtoken(); if (iVar2 != 8) { synexpect(8); } local_20 = *(undefined8 *)(local_38 + 4); iVar2 = goodname(local_20); if ((iVar2 == 0) || ((local_18 = find_builtin(local_20), local_18 != 0 && ((*(uint *)(local_18 + 0x10) & 1) != 0)))) { synerror("Bad function name"); } *local_38 = 0xe; checkkwd = 7; *(undefined8 *)(local_38 + 2) = *(undefined8 *)(local_38 + 4); local_38[1] = *(undefined4 *)(parsefile + 8); uVar3 = command(); *(undefined8 *)(local_38 + 4) = uVar3; goto LAB_00100ebc; }
dash-0.5.11+git20210903+057cd650a4ed
ghidra
static inline __u16 rta_getattr_u16(const struct rtattr *rta) { return *(__u16 *)(( void *)(((char *)(rta)) + ((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0)))); }
int rta_getattr_u16(struct_0 *a0) { return a0->field_4; }
iproute2-6.0.0
angr_phoenix
static int format_user_width(uid_t u) { return format_user_or_group_width(numeric_ids ? ((void *)0) : getuser(u), u); }
int format_user_width(unsigned long a0) { void *v1; if (!numeric_ids) v1 = getuser(a0); else v1 = 0; return format_user_or_group_width(v1, a0); }
coreutils
angr_dream
int rl_set_keymap_name(const char *name, Keymap k) { return name && k ? 0 : 0; }
long long rl_set_keymap_name(unsigned long a0, unsigned long a1) { unsigned long v0; unsigned long v1; v1 = a0; v0 = a1; return 0; }
libedit
angr_sailr
static void can_print_ctrlmode_ext(FILE *f, struct rtattr *ctrlmode_ext_attr, __u32 cm_flags) { struct rtattr *tb[IFLA_CAN_CTRLMODE_MAX + 1]; (parse_rtattr_flags( (tb), (IFLA_CAN_CTRLMODE_MAX), ((void *)(((char *)(ctrlmode_ext_attr)) + ((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0)))), ((int)((ctrlmode_ext_attr)->rta_len) - ((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0))), (1 << 15))); if (tb[IFLA_CAN_CTRLMODE_SUPPORTED]) { __u32 *supported = ((void *)(((char *)(tb[IFLA_CAN_CTRLMODE_SUPPORTED])) + ((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0)))); print_ctrlmode(PRINT_JSON, *supported, "ctrlmode_supported"); print_ctrlmode(PRINT_JSON, cm_flags & ~*supported, "ctrlmode_static"); } }
unsigned long can_print_ctrlmode_ext(long a1, unsigned short *a2, int a3) { _DWORD *v5; char v6[8]; long v7; unsigned long v8; v8 = __readfsqword(0x28u); parse_rtattr_flags(v6, 1LL, a2 + 2, (unsigned int)*a2 - 4, 0x8000LL); if (v7) { v5 = (_DWORD *)(v7 + 4); print_ctrlmode(2u, *(_DWORD *)(v7 + 4), "ctrlmode_supported"); print_ctrlmode(2u, a3 & ~*v5, "ctrlmode_static"); } return __readfsqword(0x28u) ^ v8; }
iproute2-6.0.0
ida
static void cleanup_initial_cwd(void) { if (0 == restore_cwd(initial_wd)) { free_cwd(initial_wd); free(initial_wd); initial_wd = ((void *)0); } else { error(0, (*__errno_location()), gettext("Failed to restore initial working directory%s%s"), (initial_wd->desc < 0 && initial_wd->name) ? ": " : "", (initial_wd->desc < 0 && initial_wd->name) ? initial_wd->name : ""); _exit(1); } }
void cleanup_initial_cwd() { void *v0; const char *v1; char *v2; int *v3; if ((unsigned int)restore_cwd(initial_wd)) { if (*(int *)initial_wd < 0 && *((_QWORD *)initial_wd + 1)) v0 = (void *)*((_QWORD *)initial_wd + 1); else v0 = &unk_1E1D; if (*(int *)initial_wd < 0 && *((_QWORD *)initial_wd + 1)) v1 = ": "; else v1 = (const char *)&unk_1E1D; v2 = gettext("Failed to restore initial working directory%s%s"); v3 = _errno_location(); error(0, *v3, v2, v1, v0); exit(1); } free_cwd(initial_wd); free(initial_wd); initial_wd = 0LL; }
findutils
ida
static int collequiv(c, equiv) int c, equiv; { if (charcmp(c, equiv, 1) == 0) return 1; return 0; }
_BOOL8 collequiv(char a1, char a2) { return charcmp(a1, a2, 1) == 0; }
bash
ida
const char *safe_directory_contents(struct directory *dir) { const char *ret = directory_contents(dir); return ret ? ret : "\0\0\0\0"; }
undefined *safe_directory_contents(undefined8 param_1) { undefined *puVar1; puVar1 = (undefined *)directory_contents(param_1); if (puVar1 == (undefined *)0x0) { puVar1 = &DAT_00104cd8; } return puVar1; }
tar
ghidra
int get_non_repudiation_status(void) { if (batch) { return cfg.non_repudiation; } else { return 0; } }
long long get_non_repudiation_status() { void *v1; if (*(got.batch)) v1 = *((got.cfg + 572)); else v1 = 0; return v1; }
gnutls
angr_dream
char **history_tokenize(const char *string) { return (history_tokenize_internal(string, -1, (int *)((void *)0))); }
int history_tokenize(unsigned long long a0) { return history_tokenize_internal(a0, 0xffffffff, 0x0); }
bash
angr_dream
static void make_command_string_internal(command) COMMAND *command; { char s[3]; if (command == 0) cprintf(""); else { if (skip_this_indent) skip_this_indent--; else indent(indentation); if (command->flags & 0x80) { cprintf("time "); if (command->flags & 0x100) cprintf("-p "); } if (command->flags & 0x04) cprintf("! "); switch (command->type) { case cm_for: print_for_command(command->value.For); break; case cm_arith_for: print_arith_for_command(command->value.ArithFor); break; case cm_select: print_select_command(command->value.Select); break; case cm_case: print_case_command(command->value.Case); break; case cm_while: print_while_command(command->value.While); break; case cm_until: print_until_command(command->value.While); break; case cm_if: print_if_command(command->value.If); break; case cm_arith: print_arith_command(command->value.Arith->exp); break; case cm_cond: print_cond_command(command->value.Cond); break; case cm_simple: print_simple_command(command->value.Simple); break; case cm_connection: skip_this_indent++; printing_connection++; make_command_string_internal(command->value.Connection->first); switch (command->value.Connection->connector) { case '&': case '|': { char c = command->value.Connection->connector; s[0] = ' '; s[1] = c; s[2] = '\0'; print_deferred_heredocs(s); if (c != '&' || command->value.Connection->second) { cprintf(" "); skip_this_indent++; } } break; case 288: print_deferred_heredocs(" && "); if (command->value.Connection->second) skip_this_indent++; break; case 289: print_deferred_heredocs(" || "); if (command->value.Connection->second) skip_this_indent++; break; case ';': case '\n': { char c = command->value.Connection->connector; s[0] = printing_comsub ? c : ';'; s[1] = '\0'; if (deferred_heredocs == 0) { if (was_heredoc == 0) cprintf("%s", s); else was_heredoc = 0; } else print_deferred_heredocs(inside_function_def ? "" : ";"); if (inside_function_def) cprintf("\n"); else { if (c == ';') cprintf(" "); if (command->value.Connection->second) skip_this_indent++; } break; } default: cprintf(gettext("print_command: bad connector `%d'"), command->value.Connection->connector); break; } make_command_string_internal(command->value.Connection->second); do { if (deferred_heredocs) print_deferred_heredocs(""); } while (0); printing_connection--; break; case cm_function_def: print_function_def(command->value.Function_def); break; case cm_group: print_group_command(command->value.Group); break; case cm_subshell: cprintf("( "); skip_this_indent++; make_command_string_internal(command->value.Subshell->command); do { if (deferred_heredocs) print_deferred_heredocs(""); } while (0); cprintf(" )"); break; case cm_coproc: cprintf("coproc %s ", command->value.Coproc->name); skip_this_indent++; make_command_string_internal(command->value.Coproc->command); break; default: command_error("print_command", 1, command->type, 0); break; } if (command->redirects) { cprintf(" "); print_redirection_list(command->redirects); } } }
void make_command_string_internal(struct_0 *a0) { char v0; char v1; char v2; char v3; char v4; char v5; char v7; unsigned long long v8; unsigned long long *v9; unsigned long long v10; if (!a0) { cprintf(&g_403583); } else { if (skip_this_indent) skip_this_indent = skip_this_indent - 1; else indent(indentation); if ((a0->field_4 & 128)) { cprintf("time "); if ((a0->field_4 & 0x100)) cprintf("-p "); } if ((a0->field_4 & 4)) cprintf("! "); switch (a0->field_0) { case 0: print_for_command(a0->field_18); break; case 1: print_case_command(a0->field_18); break; case 2: print_while_command(a0->field_18); break; case 3: print_if_command(a0->field_18); break; case 4: print_simple_command(a0->field_18); break; case 5: print_select_command(a0->field_18); break; case 6: skip_this_indent = skip_this_indent + 1; printing_connection = printing_connection + 1; make_command_string_internal(a0->field_18->field_8); if (a0->field_18->field_18 == 289) { print_deferred_heredocs(" || "); if (a0->field_18->field_10) skip_this_indent = skip_this_indent + 1; } else if (a0->field_18->field_18 > 289) { LABEL_4004e1: cprintf(gettext("print_command: bad connector `%d'")); } else { if (a0->field_18->field_18 == 288) { print_deferred_heredocs(" && "); if (a0->field_18->field_10) skip_this_indent = skip_this_indent + 1; goto LABEL_400513; } if (!(a0->field_18->field_18 <= 288)) goto LABEL_4004e1; if (a0->field_18->field_18 == 124) { LABEL_400330: v0 = a0->field_18->field_18; v2 = 32; v3 = v0; v4 = 0; print_deferred_heredocs(&v2); if (v0 == 38 && !a0->field_18->field_10) goto LABEL_400509; cprintf(" "); skip_this_indent = skip_this_indent + 1; LABEL_400509: goto LABEL_400513; } if (!(a0->field_18->field_18 <= 124)) goto LABEL_4004e1; if (a0->field_18->field_18 != 59) { if (!(a0->field_18->field_18 <= 59)) goto LABEL_4004e1; if (a0->field_18->field_18 != 10) { if (a0->field_18->field_18 == 38) goto LABEL_400330; goto LABEL_4004e1; } } v1 = a0->field_18->field_18; if (!printing_comsub) v7 = 59; else v7 = v1; v2 = v7; v3 = 0; if (*(&deferred_heredocs)) { if (inside_function_def) v8 = &g_403583; else v8 = ";"; print_deferred_heredocs(v8); } else if (was_heredoc) { was_heredoc = 0; } else { cprintf("%s"); } if (inside_function_def) { cprintf("\n"); } else { if (v1 == 59) cprintf(" "); if (a0->field_18->field_10) skip_this_indent = skip_this_indent + 1; } } LABEL_400513: make_command_string_internal(a0->field_18->field_10); if (*(&deferred_heredocs)) print_deferred_heredocs(&g_403583); printing_connection = printing_connection - 1; break; case 7: print_function_def(a0->field_18); break; case 8: print_until_command(a0->field_18); break; case 9: print_group_command(a0->field_18); break; case 10: print_arith_command(a0->field_18->field_8); break; case 11: print_cond_command(a0->field_18); break; case 12: print_arith_for_command(a0->field_18); break; case 13: cprintf("( "); skip_this_indent = skip_this_indent + 1; make_command_string_internal(a0->field_18->field_8); if (*(&deferred_heredocs)) print_deferred_heredocs(&g_403583); cprintf(" )"); break; case 14: cprintf("coproc %s "); skip_this_indent = skip_this_indent + 1; make_command_string_internal(a0->field_18->field_10); break; default: command_error("print_command", 0x1, a0->field_0, 0x0); break; } if (a0->field_10) { cprintf(" "); print_redirection_list(a0->field_10); } } v10 = *(&v5) ^ v9[5]; return; }
bash
angr_phoenix
static int write_random_numbers(struct randint_source *s, size_t count, size_t lo_input, size_t hi_input, char eolbyte) { const randint range = hi_input - lo_input + 1; for (size_t i = 0; i < count; i++) { unsigned long int j = lo_input + randint_choose(s, range); if (printf("%lu%c", j, eolbyte) < 0) return -1; } return 0; }
long write_random_numbers(long a1, unsigned long a2, long a3, long a4, char a5) { unsigned long i; long v9; long v10; v9 = a4 - a3 + 1; for (i = 0LL; i < a2; ++i) { v10 = a3 + randint_choose(a1, v9); if (printf("%lu%c", v10, (unsigned int)a5) < 0) return 0xFFFFFFFFLL; } return 0LL; }
coreutils
ida
static inline void emit_mandatory_arg_note(void) { fputs_unlocked(gettext("\nMandatory arguments to long options are mandatory " "for short options too.\n"), stdout) ; }
void emit_mandatory_arg_note(void) { char *__s; FILE *__stream; __stream = stdout; __s = (char *)gettext("\nMandatory arguments to long options are mandatory " "for short options too.\n"); fputs_unlocked(__s, __stream); return; }
coreutils
ghidra
static _Bool prime_p(uintmax_t n) { int k; _Bool is_prime; uintmax_t a_prim, one, ni; struct factors factors; if (n <= 1) return 0; if (n < (uintmax_t)5003 * 5003) return 1; uintmax_t q = n - 1; for (k = 0; (q & 1) == 0; k++) q >>= 1; uintmax_t a = 2; do { uintmax_t __n = (n); uintmax_t __inv; __inv = binvert_table[(__n / 2) & 0x7F]; if (64 > 8) __inv = 2 * __inv - __inv * __inv * __n; if (64 > 16) __inv = 2 * __inv - __inv * __inv * __n; if (64 > 32) __inv = 2 * __inv - __inv * __inv * __n; if (64 > 64) { int __invbits = 64; do { __inv = 2 * __inv - __inv * __inv * __n; __invbits *= 2; } while (__invbits < 64); } (ni) = __inv; } while (0); do { __attribute__((__unused__)) uintmax_t _redcify_q; do { uintmax_t __d1, __d0, __q, __r1, __r0; ((void)sizeof(((1) < (n)) ? 1 : 0), __extension__({ if ((1) < (n)) ; else __assert_fail("(1) < (n)", "src/factor.c", 1214, __extension__ __PRETTY_FUNCTION__); })); __d1 = (n); __d0 = 0; __r1 = (1); __r0 = (0); __q = 0; for (unsigned int __i = 64; __i > 0; __i--) { do { (__d0) = ((__d1) << (64 - (1))) | ((__d0) >> (1)); (__d1) = (__d1) >> (1); } while (0); __q <<= 1; if (((__r1) > (__d1) || ((__r1) == (__d1) && (__r0) >= (__d0)))) { __q++; __asm__("subq %5,%q1\n\tsbbq %3,%q0" : "=r"(__r1), "=&r"(__r0) : "0"((UDItype)(__r1)), "rme"((UDItype)(__d1)), "1"((UDItype)(__r0)), "rme"((UDItype)(__d0))); } } (one) = __r0; (_redcify_q) = __q; } while (0); } while (0); do { uintmax_t _t = -(uintmax_t)((one) < ((n) - (one))); ((a_prim)) = (((n)) & _t) + ((one)) - (((n) - (one))); } while (0); if (!millerrabin(n, ni, a_prim, q, k, one)) return 0; if (flag_prove_primality) { factor(0, n - 1, &factors); } for (unsigned int r = 0; r < (sizeof(primes_diff) / sizeof(primes_diff[0]) - 8 + 1); r++) { if (flag_prove_primality) { is_prime = 1; for (unsigned int i = 0; i < factors.nfactors && is_prime; i++) { is_prime = powm(a_prim, (n - 1) / factors.p[i], n, ni, one) != one; } } else { is_prime = (r == 25 - 1); } if (is_prime) return 1; a += primes_diff[r]; { uintmax_t s1, s0; __asm__("mulq\t%3" : "=a"(s0), "=d"(s1) : "%0"((UDItype)(one)), "rm"((UDItype)(a))); if (__builtin_expect((s1 == 0), 1)) a_prim = s0 % n; else { __attribute__((__unused__)) uintmax_t dummy; do { uintmax_t __d1, __d0, __q, __r1, __r0; ((void)sizeof(((s1) < (n)) ? 1 : 0), __extension__({ if ((s1) < (n)) ; else __assert_fail("(s1) < (n)", "src/factor.c", 1262, __extension__ __PRETTY_FUNCTION__); })); __d1 = (n); __d0 = 0; __r1 = (s1); __r0 = (s0); __q = 0; for (unsigned int __i = 64; __i > 0; __i--) { do { (__d0) = ((__d1) << (64 - (1))) | ((__d0) >> (1)); (__d1) = (__d1) >> (1); } while (0); __q <<= 1; if (((__r1) > (__d1) || ((__r1) == (__d1) && (__r0) >= (__d0)))) { __q++; __asm__("subq %5,%q1\n\tsbbq %3,%q0" : "=r"(__r1), "=&r"(__r0) : "0"((UDItype)(__r1)), "rme"((UDItype)(__d1)), "1"((UDItype)(__r0)), "rme"((UDItype)(__d0))); } } (a_prim) = __r0; (dummy) = __q; } while (0); } } if (!millerrabin(n, ni, a_prim, q, k, one)) return 0; } error(0, 0, gettext("Lucas prime test failure. This should not happen")); abort(); }
long long prime_p(unsigned long a0) { char v0; unsigned int v1; unsigned int v2; unsigned int v3; unsigned int v4; unsigned int v5; unsigned int v6; unsigned long long v7; unsigned long v8; unsigned long long v9; unsigned long long v10; void *v11; unsigned long long v12; void *v13; unsigned long long v14; unsigned long long v15; void *v16; unsigned long v17; unsigned int v18; unsigned long v19; unsigned long v20; unsigned long v21; void *v22; void *v23; unsigned long v24; unsigned int v25; unsigned long v26; void *v27; char v28; char v29; unsigned long long v31; if (a0 <= 1) { v31 = 0; } else if (a0 <= 25030008) { v31 = 1; } else { v7 = a0 - 1; for (v1 = 0; !(v7 & 1); v1 += 1) { v7 >>= 1; } v8 = 2; v19 = a0; v20 = *(((v19 >> 1) & 127) + &binvert_table); v20 = v20 * 2 - v19 * v20 * v20; v20 = v20 * 2 - v19 * v20 * v20; v20 = v20 * 2 - v19 * v20 * v20; v21 = v20; if (a0 <= 1) __assert_fail(); v9 = a0; v10 = 0; v12 = 1; v13 = 0; v11 = 0; v2 = 64; while (true) { if (!v2) break; v10 = v10 >> 1 | v9 * 0x8000000000000000; v9 >>= 1; v11 *= 2; if (v12 <= v9) { if (!(v12 == v9)) goto LABEL_401c8d; if (v13 < v10) goto LABEL_401c8d; } v11 += 1; v12 = v12 - v9 - (v13 < v10); v13 -= v10; LABEL_401c8d: v2 -= 1; } v22 = v13; v23 = v11; v24 = -(v22 < a0 - v22); *(&v6) = v22 - a0 + (a0 & v24) + v22; if ((millerrabin(a0, v21, *(&v6), v7, v1, v22) ^ 1)) { v31 = 0; } else { if (flag_prove_primality) factor(0, a0 - 1, &v28, a0 - 1); v3 = 0; while (true) { if (v3 > 667) { error(0x0, 0x0, gettext("Lucas prime test failure. This should not happen")); abort(); } if (!flag_prove_primality) { v0 = v3 == 24; } else { v0 = 1; v4 = 0; while (true) { if (v4 >= v29) break; if (!v0) break; v0 = v22 != powm(*(&v6), (0 CONCAT a0 - 1) / m * (&(&v28)[16 + 8 * v4]), a0, v21, v22); v4 += 1; } } if (v0) { v31 = 1; break; } else { v8 += *(v3 + &primes_diff); *(&v25) = v22 * v8; v26 = v22 * v8 >> 64; if (!v26) { *(&v6) = (0 CONCAT * (&v25)) / m a0 >> 64; } else if (v26 >= a0) { __assert_fail(); } else { v14 = a0; v15 = 0; v17 = v26; *(&v18) = *(&v25); v16 = 0; v5 = 64; while (true) { if (!v5) break; v15 = v15 >> 1 | v14 * 0x8000000000000000; v14 >>= 1; v16 *= 2; if (v17 <= v14) { if (!(v17 == v14)) goto LABEL_401fde; if (*(&v18) < v15) goto LABEL_401fde; } v16 += 1; v17 = v17 - v14 - (*(&v18) < v15); v18 = *(&v18) - v15; LABEL_401fde: v5 -= 1; } *(&v6) = *(&v18); v27 = v16; } if (!(millerrabin(a0, v21, *(&v6), v7, v1, v22) ^ 1)) { v3 += 1; } else { v31 = 0; break; } } } } } return v31; }
coreutils
angr_phoenix
static _Bool parse_iwholename(const struct parser_table *entry, char **argv, int *arg_ptr) { return insert_path_check(entry, argv, arg_ptr, "iwholename", pred_ipath); }
long long parse_iwholename(unsigned long long a0, unsigned long long a1, unsigned long long a2) { return insert_path_check(a0, a1, a2, "iwholename", got.pred_ipath); }
findutils
angr_phoenix
static void the_printed_command_resize(length) int length; { if (the_printed_command == 0) { the_printed_command_size = (length + 64 - 1) & ~(64 - 1); the_printed_command = (char *)sh_xmalloc((the_printed_command_size), "print_cmd.c", 1608); command_string_index = 0; } else if ((command_string_index + length) >= the_printed_command_size) { int new; new = command_string_index + length + 1; new = (new + 128 - 1) & ~(128 - 1); the_printed_command_size = new; the_printed_command = (char *)sh_xrealloc( (the_printed_command), (the_printed_command_size), "print_cmd.c", 1620); } }
long the_printed_command_resize(int a1) { long result; if (the_printed_command) { result = (unsigned int)the_printed_command_size; if (a1 + command_string_index >= the_printed_command_size) { the_printed_command_size = (command_string_index + a1 + 128) & 0xFFFFFF80; result = sh_xrealloc(the_printed_command, (int)((command_string_index + a1 + 128) & 0xFFFFFF80), "print_cmd.c", 1620LL); the_printed_command = result; } } else { the_printed_command_size = (a1 + 63) & 0xFFFFFFC0; result = sh_xmalloc((int)((a1 + 63) & 0xFFFFFFC0), "print_cmd.c", 1608LL); the_printed_command = result; command_string_index = 0; } return result; }
bash
ida
void get_uid_crt_set(gnutls_x509_crt_t crt) { int ret; if (batch) { if (!cfg.uid) return; ret = gnutls_x509_crt_set_dn_by_oid(crt, "0.9.2342.19200300.100.1.1", 0, cfg.uid, strlen(cfg.uid)); if (ret < 0) { fprintf(stderr, "set_dn: %s\n", gnutls_strerror(ret)); exit(1); } } else { read_crt_set(crt, "UID: ", "0.9.2342.19200300.100.1.1"); } }
long long get_uid_crt_set(unsigned long long a0) { unsigned int v0; unsigned long long v2; if (!*(got.batch)) { v2 = read_crt_set(a0, "UID: ", "0.9.2342.19200300.100.1.1"); return v2; } v2 = *((got.cfg + 48)); if (!*((got.cfg + 48))) return v2; v2 = gnutls_x509_crt_set_dn_by_oid(a0, "0.9.2342.19200300.100.1.1", 0x0, *((got.cfg + 48)), strlen(*((got.cfg + 48)))); v0 = v2; if (v0 < 0) { fprintf(*(got.stderr), "set_dn: %s\n", gnutls_strerror(v0)); exit(0x1); } return v2; }
gnutls
angr_sailr
static long parse_number(const char *arg) { char *endptr = ((void *)0); (*__errno_location()) = 0; long result; if (strncmp(arg, "0x", 2) == 0) result = strtol(arg + 2, &endptr, 16); else if (strncmp(arg, "0", 1) == 0 && strspn(arg, "012345678") == strlen(optarg)) result = strtol(arg + 1, &endptr, 8); else result = strtol(arg, &endptr, 10); if ((*__errno_location()) != 0 || (endptr && *endptr != '\0')) error(1, (*__errno_location()), "'%s' is not a recognizable number.", arg); return result; }
int parse_number(char *a0) { void *v0; unsigned long v1; v0 = 0; *(__errno_location()) = 0; if (!strncmp(a0, "0x", 0x2)) { v1 = strtol(a0 + 2, &v0, 0x10); } else { if (!strncmp(a0, "0", 0x1) && strspn(a0, "012345678") == strlen(*(got.optarg))) { v1 = strtol(a0 + 1, &v0, 0x8); goto LABEL_4000fb; } v1 = strtol(a0, &v0, 0xa); } LABEL_4000fb: if (!*(__errno_location())) { if (!v0) { LABEL_400140: return v1; } else if (!*(v0)) { goto LABEL_400140; } } error(0x1, *(__errno_location()), "'%s' is not a recognizable number."); }
gnutls
angr_phoenix
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; }
int depmod_load_dependencies(unsigned long long a0[9], unsigned long a1, unsigned long a2, unsigned long long a3, unsigned long long a4) { unsigned long long *v0; unsigned long v1; unsigned long long v2[6]; log_printf(0x7, "load dependencies (%zd modules, %u symbols)\n", a0[3], hash_get_count(a0[8]), a4); v0 = a0[2]; for (v1 = &v0[a0[3]]; v0 < v1; v0 += 1) { v2[0] = *(v0); if (v2[5]) depmod_load_module_dependencies(a0, v2, v2, a3, a4); else log_printf(0x7, "ignoring %s: no dependency symbols\n", v2[1], a3, a4); } log_printf(0x7, "loaded dependencies (%zd modules, %u symbols)\n", a0[3], hash_get_count(a0[8]), a4); return 0; }
kmod
angr_phoenix
static _Bool is_feasible_path_argument(const char *arg, _Bool foldcase) { const char *last = strrchr(arg, '/'); if (last && !last[1]) { if (matches_start_point(arg, foldcase)) { return 1; } else { return 0; } } return 1; }
_BOOL8 is_feasible_path_argument(const char *a1, unsigned char a2) { char *v3; v3 = strrchr(a1, 47); return !v3 || v3[1] || (unsigned char)matches_start_point(a1, a2) != 0; }
findutils
ida
static inline SHELL_VAR *set_int_value(SHELL_VAR *var, intmax_t value, int flags) { char *p; p = itos(value); do { if (((var)->value)) sh_xfree((((var)->value)), "variables.c", 1319); } while (0); ((var)->value = (p)); if (flags & 1) ((var)->attributes |= (0x0000010)); return (var); }
void set_int_value(struct_0 *a0, unsigned long long a1, unsigned long a2) { unsigned long v0; struct_0 *v2; v0 = itos(a1); if (a0->field_8) sh_xfree(a0->field_8, "variables.c", 0x527); a0->field_8 = v0; if ((a2 & 1)) a0->field_28 = a0->field_28 | 16; v2 = a0; return; }
bash
angr_phoenix
static void bsPutUInt32(BitStream *bs, UInt32 c) { Int32 i; for (i = 31; i >= 0; i--) bsPutBit(bs, (c >> i) & 0x1); }
void bsPutUInt32(void *a0, unsigned long a1) { unsigned int v0; unsigned long long v2; for (v0 = 31; v0 >= 0; v0 -= 1) { v2 = bsPutBit(a0, (a1 >> (v0 & 31)) & 1); } return; }
bzip2
angr_phoenix
int sys_tun_infilter(struct ssh *ssh, struct Channel *c, char *buf, int _len) { int r; size_t len; char *ptr = buf; char rbuf[(16 * 1024)]; struct ip iph; u_int32_t af; if (_len < 0) return -1; len = _len; if (len <= sizeof(iph) || len > sizeof(rbuf) - 4) return -1; memcpy(&iph, buf, sizeof(iph)); af = iph.ip_v == 6 ? 24 : 2; memcpy(rbuf + 4, buf, len); len += 4; do { const u_int32_t __v = (af); ((u_char *)(rbuf))[0] = (__v >> 24) & 0xff; ((u_char *)(rbuf))[1] = (__v >> 16) & 0xff; ((u_char *)(rbuf))[2] = (__v >> 8) & 0xff; ((u_char *)(rbuf))[3] = __v & 0xff; } while (0); ptr = rbuf; if ((r = sshbuf_put_string(c->input, ptr, len)) != 0) sshfatal("port-net.c", __func__, 348, 0, SYSLOG_LEVEL_FATAL, ((void *)0), "%s: buffer error: %s", __func__, ssh_err(r)); return (0); }
long long sys_tun_infilter(unsigned long a0, struct_0 *a1, void *a2, unsigned long a3) { unsigned long v0; unsigned int v1; unsigned int v2; unsigned int v3; unsigned long v4; unsigned long long v5; char v6; char v7; char v8; char v9; char v10; char v11; char v12; unsigned long long v13; unsigned long long v14; unsigned long long v15; unsigned long v16; char v17; unsigned long long v18; unsigned long long *v19; unsigned long long v20; unsigned int v21; do { v13 = v13; } while (&v13 != &v12); v0 = a0; v16 = v19[5]; v4 = a2; if (a3 < 0) { v20 = 4294967295; } else { *(&v5) = a3; if (*(&v5) > 20 && *(&v5) <= 16380) { memcpy(&v6, a2, 0x14); if ((v6 & 240) == 96) v21 = 24; else v21 = 2; v1 = v21; memcpy(&v11, a2, *(&v5)); v5 = *(&v5) + 4; v2 = v1; v7 = v2 >> 24; v8 = v2 >> 16; v9 = v2 >> 8; v10 = v2; v4 = &v7; v3 = sshbuf_put_string(a1->field_68, v4, v5, v4); if (v3) { v16 = ssh_err(v3); v15 = "sys_tun_infilter"; v14 = "%s: buffer error: %s"; sshfatal("port-net.c", "sys_tun_infilter", 0x15c, 0x0, 0x1, 0x0, *(&v17), v18); } v20 = 0; } if (*(&v5) <= 20 || *(&v5) > 16380) v20 = 4294967295; } if ((v16 ^ v19[5])) __stack_chk_fail(); return v20; }
openssh-portable
angr_dream
static _Bool init_fps(int number_of_files, char **av) { COLUMN *p; total_files = 0; free(column_vector); column_vector = xnmalloc(columns, sizeof(COLUMN)); if (parallel_files) { int files_left = number_of_files; for (p = column_vector; files_left--; ++p, ++av) { if (!open_file(*av, p)) { --p; --columns; } } if (columns == 0) return 0; init_header("", -1); } else { p = column_vector; if (number_of_files > 0) { if (!open_file(*av, p)) return 0; init_header(*av, fileno(p->fp)); p->lines_stored = 0; } else { p->name = gettext("standard input"); p->fp = stdin; have_read_stdin = 1; p->status = OPEN; p->full_page_printed = 0; ++total_files; init_header("", -1); p->lines_stored = 0; } char const *firstname = p->name; FILE *firstfp = p->fp; int i; for (i = columns - 1, ++p; i; --i, ++p) { p->name = firstname; p->fp = firstfp; p->status = OPEN; p->full_page_printed = 0; p->lines_stored = 0; } } files_ready_to_read = total_files; return 1; }
long init_fps(int a1, const char **a2) { int v4; const char **v5; int v6; int v7; char *i; struct _IO_FILE **v9; char *v10; struct _IO_FILE *v11; FILE *v12; v5 = a2; total_files = 0; free(column_vector); column_vector = (void *)xnmalloc(columns, 64LL); if (parallel_files) { v6 = a1; for (i = (char *)column_vector; v6--; i += 64) { if ((unsigned char)open_file(*v5, (long)i) != 1) { i -= 64; --columns; } ++v5; } if (!columns) return 0LL; init_header(locale, -1); } else { v9 = (struct _IO_FILE **)column_vector; if (a1 <= 0) { v9[1] = (struct _IO_FILE *)gettext("standard input"); *v9 = stdin; have_read_stdin = 1; *((_DWORD *)v9 + 4) = 0; *((_BYTE *)v9 + 57) = 0; ++total_files; init_header(locale, -1); *((_DWORD *)v9 + 11) = 0; } else { if ((unsigned char)open_file(*a2, (long)column_vector) != 1) return 0LL; v4 = fileno(*v9); init_header(*a2, v4); *((_DWORD *)v9 + 11) = 0; } v11 = v9[1]; v12 = *v9; v7 = columns - 1; v10 = (char *)(v9 + 8); while (v7) { *((_QWORD *)v10 + 1) = v11; *(_QWORD *)v10 = v12; *((_DWORD *)v10 + 4) = 0; v10[57] = 0; *((_DWORD *)v10 + 11) = 0; --v7; v10 += 64; } } files_ready_to_read = total_files; return 1LL; }
coreutils
ida
static int fix_inline_data_extents_file(e2fsck_t ctx, ext2_ino_t ino, struct ext2_inode *inode, int inode_size, struct problem_context *pctx) { size_t max_inline_ea_size; ext2_filsys fs = ctx->fs; int dirty = 0; if (!ext2fs_has_feature_extents(fs->super) && !ext2fs_has_feature_inline_data(fs->super)) return 0; if ((((inode->i_mode) & 00170000) == 0020000) || (((inode->i_mode) & 00170000) == 0060000) || (((inode->i_mode) & 00170000) == 0010000) || (((inode->i_mode) & 00170000) == 0140000)) { check_extents_inlinedata(ctx, pctx); return 0; } if (ext2fs_extent_header_verify(inode->i_block, sizeof(inode->i_block)) == 0 && fix_problem(ctx, 0x010077, pctx)) { inode->i_flags &= ~0x10000000; dirty = 1; goto out; } if (inode_size > 128) max_inline_ea_size = inode_size - (128 + ((struct ext2_inode_large *)inode)->i_extra_isize); else max_inline_ea_size = 0; if (((inode)->i_size | ((__u64)(inode)->i_size_high << 32)) < ((sizeof(__u32) * (((12 + 1) + 1) + 1))) + max_inline_ea_size && fix_problem(ctx, 0x010078, pctx)) { inode->i_flags &= ~0x00080000; dirty = 1; goto out; } if (could_be_block_map(fs, inode) && fix_problem(ctx, 0x010079, pctx)) { inode->i_flags &= ~(0x00080000 | 0x10000000); dirty = 1; goto out; } if (fix_problem(ctx, 0x01007A, pctx)) { e2fsck_clear_inode(ctx, ino, inode, 0, "pass1"); return -1; } out: if (dirty) e2fsck_write_inode(ctx, ino, inode, "pass1"); return 0; }
long fix_inline_data_extents_file(long *a1, unsigned int a2, long a3, int a4, long a5) { int v9; long v10; long v11; v11 = *a1; v9 = 0; if (!ext2fs_has_feature_extents(*(_QWORD *)(*a1 + 32)) && !ext2fs_has_feature_inline_data(*(_QWORD *)(v11 + 32))) return 0LL; if ((*(_WORD *)a3 & 0xF000) == 0x2000 || (*(_WORD *)a3 & 0xF000) == 24576 || (*(_WORD *)a3 & 0xF000) == 4096 || (*(_WORD *)a3 & 0xF000) == 49152) { check_extents_inlinedata((long)a1, a5); return 0LL; } if (ext2fs_extent_header_verify(a3 + 40, 60LL) || !(unsigned int)fix_problem(a1, 65655LL, a5)) { if (a4 <= 128) v10 = 0LL; else v10 = a4 - (*(unsigned short *)(a3 + 128) + 128); if ((((unsigned long)*(unsigned int *)(a3 + 108) << 32) | *(unsigned int *)(a3 + 4)) < v10 + 60 && (unsigned int)fix_problem(a1, 65656LL, a5)) { *(_DWORD *)(a3 + 32) &= ~0x80000u; v9 = 1; } else if ((unsigned int)could_be_block_map(v11, a3) && (unsigned int)fix_problem(a1, 65657LL, a5)) { *(_DWORD *)(a3 + 32) &= 0xEFF7FFFF; v9 = 1; } else if ((unsigned int)fix_problem(a1, 65658LL, a5)) { e2fsck_clear_inode((long)a1, a2, a3, 0, (long)"pass1"); return 0xFFFFFFFFLL; } } else { *(_DWORD *)(a3 + 32) &= ~0x10000000u; v9 = 1; } if (v9) e2fsck_write_inode(a1, a2, a3, "pass1"); return 0LL; }
e2fsprogs-1.46.5
ida
static void close_files(void) { if (gr_close() == 0) { fprintf(stderr, gettext("%s: failure while writing changes to %s\n"), Prog, gr_dbname()); exit(10); } do { char *old_locale = setlocale(6, ((void *)0)); char *saved_locale = ((void *)0); if (((void *)0) != old_locale) { saved_locale = strdup(old_locale); } if (((void *)0) != saved_locale) { (void)setlocale(6, "C"); } syslog(6, "group changed in %s (%s)", gr_dbname(), info_group.action); if (((void *)0) != saved_locale) { (void)setlocale(6, saved_locale); free(saved_locale); } } while (0) ; del_cleanup(cleanup_report_mod_group); cleanup_unlock_group(((void *)0)); del_cleanup(cleanup_unlock_group); if (is_shadow_grp && (pflg || nflg)) { if (sgr_close() == 0) { fprintf(stderr, gettext("%s: failure while writing changes to %s\n"), Prog, sgr_dbname()); exit(10); } do { char *old_locale = setlocale(6, ((void *)0)); char *saved_locale = ((void *)0); if (((void *)0) != old_locale) { saved_locale = strdup(old_locale); } if (((void *)0) != saved_locale) { (void)setlocale(6, "C"); } syslog(6, "group changed in %s (%s)", sgr_dbname(), info_gshadow.action); if (((void *)0) != saved_locale) { (void)setlocale(6, saved_locale); free(saved_locale); } } while (0) ; del_cleanup(cleanup_report_mod_gshadow); cleanup_unlock_gshadow(((void *)0)); del_cleanup(cleanup_unlock_gshadow); } if (gflg) { if (pw_close() == 0) { fprintf(stderr, gettext("%s: failure while writing changes to %s\n"), Prog, pw_dbname()); exit(10); } do { char *old_locale = setlocale(6, ((void *)0)); char *saved_locale = ((void *)0); if (((void *)0) != old_locale) { saved_locale = strdup(old_locale); } if (((void *)0) != saved_locale) { (void)setlocale(6, "C"); } syslog(6, "group changed in %s (%s)", pw_dbname(), info_passwd.action); if (((void *)0) != saved_locale) { (void)setlocale(6, saved_locale); free(saved_locale); } } while (0) ; del_cleanup(cleanup_report_mod_passwd); cleanup_unlock_passwd(((void *)0)); del_cleanup(cleanup_unlock_passwd); } }
void close_files(void) { undefined8 uVar1; int iVar2; undefined8 uVar3; char *pcVar4; char *local_48; char *local_40; char *local_38; iVar2 = gr_close(); if (iVar2 == 0) { uVar3 = gr_dbname(); uVar1 = Prog; pcVar4 = (char *)gettext("%s: failure while writing changes to %s\n"); fprintf(stderr, pcVar4, uVar1, uVar3); exit(10); } pcVar4 = setlocale(6, (char *)0x0); local_48 = (char *)0x0; if (pcVar4 != (char *)0x0) { local_48 = strdup(pcVar4); } if (local_48 != (char *)0x0) { setlocale(6, "C"); } uVar1 = info_group._8_8_; uVar3 = gr_dbname(); syslog(6, "group changed in %s (%s)", uVar3, uVar1); if (local_48 != (char *)0x0) { setlocale(6, local_48); free(local_48); } del_cleanup(uRam0000000000100b1f); cleanup_unlock_group(0); del_cleanup(uRam0000000000100b38); if ((is_shadow_grp != '\0') && ((pflg != '\0' || (nflg != '\0')))) { iVar2 = sgr_close(); if (iVar2 == 0) { uVar3 = sgr_dbname(); uVar1 = Prog; pcVar4 = (char *)gettext("%s: failure while writing changes to %s\n"); fprintf(stderr, pcVar4, uVar1, uVar3); exit(10); } pcVar4 = setlocale(6, (char *)0x0); local_40 = (char *)0x0; if (pcVar4 != (char *)0x0) { local_40 = strdup(pcVar4); } if (local_40 != (char *)0x0) { setlocale(6, "C"); } uVar1 = info_gshadow._8_8_; uVar3 = sgr_dbname(); syslog(6, "group changed in %s (%s)", uVar3, uVar1); if (local_40 != (char *)0x0) { setlocale(6, local_40); free(local_40); } del_cleanup(uRam0000000000100c51); cleanup_unlock_gshadow(0); del_cleanup(uRam0000000000100c6a); } if (gflg != '\0') { iVar2 = pw_close(); if (iVar2 == 0) { uVar3 = pw_dbname(); uVar1 = Prog; pcVar4 = (char *)gettext("%s: failure while writing changes to %s\n"); fprintf(stderr, pcVar4, uVar1, uVar3); exit(10); } pcVar4 = setlocale(6, (char *)0x0); local_38 = (char *)0x0; if (pcVar4 != (char *)0x0) { local_38 = strdup(pcVar4); } if (local_38 != (char *)0x0) { setlocale(6, "C"); } uVar1 = info_passwd._8_8_; uVar3 = pw_dbname(); syslog(6, "group changed in %s (%s)", uVar3, uVar1); if (local_38 != (char *)0x0) { setlocale(6, local_38); free(local_38); } del_cleanup(uRam0000000000100d69); cleanup_unlock_passwd(0); del_cleanup(uRam0000000000100d82); } return; }
shadow
ghidra
static int do_del(int argc, char **argv) { struct l2tp_parm p; if (parse_args(argc, argv, L2TP_DEL, &p) < 0) return -1; if (!p.tunnel && !p.session) missarg("tunnel or session"); if ((p.tunnel) && (p.tunnel_id == 0)) missarg("tunnel_id"); if ((p.session) && (p.session_id == 0)) missarg("session_id"); if (p.session_id) return delete_session(&p); else return delete_tunnel(&p); return -1; }
long do_del(int a1, const char **a2) { unsigned int v3; int v4; char v5; unsigned long v6; v6 = __readfsqword(0x28u); if ((int)parse_args(a1, a2, 2LL, &v3) < 0) return 0xFFFFFFFFLL; if ((v5 & 0x20) == 0 && (v5 & 0x40) == 0) missarg("tunnel or session"); if ((v5 & 0x20) != 0 && !v3) missarg("tunnel_id"); if ((v5 & 0x40) != 0 && !v4) missarg("session_id"); if (v4) return delete_session(&v3); else return delete_tunnel(&v3); }
iproute2-6.0.0
ida
static int to_blob_buf(const struct sshkey *key, struct sshbuf *b, int force_plain, enum sshkey_serialize_rep opts) { int type, ret = -1; const char *typename; const BIGNUM *rsa_n, *rsa_e, *dsa_p, *dsa_q, *dsa_g, *dsa_pub_key; if (key == ((void *)0)) return -10; if (sshkey_is_cert(key)) { if (key->cert == ((void *)0)) return -16; if (sshbuf_len(key->cert->certblob) == 0) return -17; } type = force_plain ? sshkey_type_plain(key->type) : key->type; typename = sshkey_ssh_name_from_type_nid(type, key->ecdsa_nid); switch (type) { case KEY_DSA_CERT: case KEY_ECDSA_CERT: case KEY_ECDSA_SK_CERT: case KEY_RSA_CERT: case KEY_ED25519_CERT: case KEY_ED25519_SK_CERT: if ((ret = sshbuf_putb(b, key->cert->certblob)) != 0) return ret; break; case KEY_DSA: if (key->dsa == ((void *)0)) return -10; DSA_get0_pqg(key->dsa, &dsa_p, &dsa_q, &dsa_g); DSA_get0_key(key->dsa, &dsa_pub_key, ((void *)0)); if ((ret = sshbuf_put_cstring(b, typename)) != 0 || (ret = sshbuf_put_bignum2(b, dsa_p)) != 0 || (ret = sshbuf_put_bignum2(b, dsa_q)) != 0 || (ret = sshbuf_put_bignum2(b, dsa_g)) != 0 || (ret = sshbuf_put_bignum2(b, dsa_pub_key)) != 0) return ret; break; case KEY_ECDSA: case KEY_ECDSA_SK: if (key->ecdsa == ((void *)0)) return -10; if ((ret = sshbuf_put_cstring(b, typename)) != 0 || (ret = sshbuf_put_cstring( b, sshkey_curve_nid_to_name(key->ecdsa_nid))) != 0 || (ret = sshbuf_put_eckey(b, key->ecdsa)) != 0) return ret; if (type == KEY_ECDSA_SK) { if ((ret = sshbuf_put_cstring(b, key->sk_application)) != 0) return ret; } break; case KEY_RSA: if (key->rsa == ((void *)0)) return -10; RSA_get0_key(key->rsa, &rsa_n, &rsa_e, ((void *)0)); if ((ret = sshbuf_put_cstring(b, typename)) != 0 || (ret = sshbuf_put_bignum2(b, rsa_e)) != 0 || (ret = sshbuf_put_bignum2(b, rsa_n)) != 0) return ret; break; case KEY_ED25519: case KEY_ED25519_SK: if (key->ed25519_pk == ((void *)0)) return -10; if ((ret = sshbuf_put_cstring(b, typename)) != 0 || (ret = sshbuf_put_string(b, key->ed25519_pk, 32U)) != 0) return ret; if (type == KEY_ED25519_SK) { if ((ret = sshbuf_put_cstring(b, key->sk_application)) != 0) return ret; } break; default: return -14; } return 0; }
int to_blob_buf(struct_0 *a0, unsigned long long a1, unsigned long a2, unsigned long a3) { unsigned int v0; unsigned int v1; unsigned int v2; char v3; char v4; char v5; char v6; char v7; char v8; unsigned long long v9; unsigned int v11; v0 = a3; v1 = -1; if (!a0) { v11 = -10; } else { v11 = sshkey_is_cert(a0); if (v11) { if (!a0->field_80) { v11 = -0x10; } else { v11 = sshbuf_len(a0->field_80->field_0); if (!v11) v11 = -17; } } if (!v11 || a0->field_80 && v11) { if (a2) v11 = sshkey_type_plain(a0->field_0); else v11 = a0->field_0; v2 = v11; v9 = sshkey_ssh_name_from_type_nid(v2, a0->field_18); switch (v2) { case 0: if (!a0->field_8) { v11 = -10; break; } else { RSA_get0_key(a0->field_8, &v3, &v4, 0x0); v1 = sshbuf_put_cstring(a1, v9, v9); if (!v1) { v1 = sshbuf_put_bignum2(a1, *(&v4), *(&v4)); if (!v1) { v1 = sshbuf_put_bignum2(a1, *(&v3), *(&v3)); if (!v1) { v11 = 0; break; } } } else { v11 = v1; break; } } case 1: if (!a0->field_10) { v11 = -10; break; } else { DSA_get0_pqg(a0->field_10, &v5, &v6, &v7); DSA_get0_key(a0->field_10, &v8, 0x0, &v8); v1 = sshbuf_put_cstring(a1, v9, v9); if (!v1) { v1 = sshbuf_put_bignum2(a1, *(&v5), *(&v5)); if (!v1) { v1 = sshbuf_put_bignum2(a1, *(&v6), *(&v6)); if (!v1) { v1 = sshbuf_put_bignum2(a1, *(&v7), *(&v7)); if (!v1) v1 = sshbuf_put_bignum2(a1, *(&v8), *(&v8)); } } } else { v11 = v1; break; } } case 2: case 10: if (!a0->field_20) { v11 = -10; break; } else { v1 = sshbuf_put_cstring(a1, v9, v9); if (!v1) { v11 = sshkey_curve_nid_to_name(a0->field_18); v1 = sshbuf_put_cstring(a1, v11, v11); if (!v1) { v1 = sshbuf_put_eckey(a1, a0->field_20, a0->field_20); if (!v1 && v2 == 10) { v1 = sshbuf_put_cstring(a1, a0->field_60, a0->field_60); if (v1) { v11 = v1; break; } } } } else { v11 = v1; break; } } case 3: case 12: if (!a0->field_30) { v11 = -10; break; } else { v1 = sshbuf_put_cstring(a1, v9, v9); if (!v1) { v1 = sshbuf_put_string(a1, a0->field_30, 0x20, a0->field_30); if (!v1 && v2 == 12) { v1 = sshbuf_put_cstring(a1, a0->field_60, a0->field_60); if (v1) { v11 = v1; break; } } } else { v11 = v1; break; } } case 4: case 5: case 6: case 7: case 11: case 13: v1 = sshbuf_putb(a1, a0->field_80->field_0, a0->field_80->field_0); if (v1) { v11 = v1; break; } default: v11 = -14; break; } } } return v11; }
openssh-portable
angr_dream