input
stringlengths
26
172k
output
stringlengths
18
318k
repo_name
stringclasses
23 values
decompiler
stringclasses
5 values
void libbsd_MD5Final(uint8_t digest[16], MD5_CTX *context) { MD5Final(digest, context); }
long libbsd_MD5Final(long a1, long a2) { return MD5Final(a1, a2); }
libbsd-0.11.7
ida
char *path_append(const char *p1, const char *p2) { char *ret; size_t len = strlen(p1) + strlen(p2) + 2; ret = xmalloc(len); strlcpy(ret, p1, len); if (p1[0] != '\0' && p1[strlen(p1) - 1] != '/') strlcat(ret, "/", len); strlcat(ret, p2, len); return (ret); }
int path_append(char *a0, char *a1) { unsigned long long v0; unsigned long long v1; v0 = strlen(a1) + strlen(a0) + 2; v1 = xmalloc(v0); strlcpy(v1, a0, v0, a0); if (*(a0) && a0[1 + strlen(a0)] != 47) strlcat(v1, "/", v0); strlcat(v1, a1, v0); return v1; }
openssh-portable
angr_sailr
0 ) do { fprintf(stderr, gettext("Try '%s --help' for more information.\n"), program_name); } while (0) ;
int fprintf(FILE *__stream, char *__format, ...) { halt_baddata(); }
coreutils
ghidra
int acl_set_file(const char *path_p, acl_type_t type, acl_t acl) { acl_obj *acl_obj_p = ((acl_obj *)__ext2int_and_check(acl, (0x712C))); char *ext_acl_p; const char *name; size_t size; int error; if (!acl_obj_p) return -1; switch (type) { case (0x8000): name = "system.posix_acl_access"; break; case (0x4000): name = "system.posix_acl_default"; break; default: (*__errno_location()) = 22; return -1; } ext_acl_p = __acl_to_xattr(acl_obj_p, &size); if (!ext_acl_p) return -1; error = setxattr(path_p, name, (char *)ext_acl_p, size, 0); free(ext_acl_p); return error; }
long long acl_set_file(unsigned long long a0, unsigned long a1, unsigned long long a2) { unsigned int v0; char v1; unsigned long long v2; unsigned long long v3; void *v4; unsigned long long v6; v3 = __ext2int_and_check(a2, 0x712c); if (!v3) { v6 = 4294967295; } else { if (a1 == 0x4000) { v2 = "system.posix_acl_default"; } else if (a1 != 0x8000) { *(__errno_location()) = 22; v6 = 4294967295; } if (a1 == 0x8000) v2 = "system.posix_acl_access"; if (a1 == 0x4000 || a1 == 0x8000) { v4 = __acl_to_xattr(v3, &v1, &v1); if (!v4) { v6 = 4294967295; } else { v0 = setxattr(a0, v2, v4, *(&v1), 0x0); free(v4); v6 = v0; } } } return v6; }
acl-2.3.1
angr_dream
static void grp_update(void) { struct group grp; struct sgrp sgrp; add_cleanup(cleanup_report_add_group_group, group_name); if (is_shadow_grp) { add_cleanup(cleanup_report_add_group_gshadow, group_name); } new_grent(&grp); new_sgent(&sgrp); if (is_shadow_grp && pflg) { grp.gr_passwd = "x"; } if (user_list) { char *token; token = strtok(user_list, ","); while (token) { if (prefix_getpwnam(token) == ((void *)0)) { fprintf(stderr, gettext("Invalid member username %s\n"), token); exit(10); } grp.gr_mem = add_list(grp.gr_mem, token); token = strtok(((void *)0), ","); } } if (gr_update(&grp) == 0) { fprintf(stderr, gettext("%s: failed to prepare the new %s entry '%s'\n"), Prog, gr_dbname(), grp.gr_name); exit(10); } if (is_shadow_grp && (sgr_update(&sgrp) == 0)) { fprintf(stderr, gettext("%s: failed to prepare the new %s entry '%s'\n"), Prog, sgr_dbname(), sgrp.sg_name); exit(10); } }
void grp_update(void) { undefined8 uVar1; int iVar2; long lVar3; undefined8 uVar4; char *pcVar5; long in_FS_OFFSET; char *local_80; undefined8 local_78; undefined *local_70; undefined8 local_60; undefined8 local_58[5]; long local_30; local_30 = *(long *)(in_FS_OFFSET + 0x28); add_cleanup(uRam00000000001002c5, group_name); if (is_shadow_grp != '\0') { add_cleanup(uRam00000000001002e9, group_name); } new_grent(&local_78); new_sgent(local_58); if ((is_shadow_grp != '\0') && (pflg != '\0')) { local_70 = &DAT_0010133e; } if (user_list != (char *)0x0) { local_80 = strtok(user_list, ","); while (local_80 != (char *)0x0) { lVar3 = prefix_getpwnam(local_80); if (lVar3 == 0) { pcVar5 = (char *)gettext("Invalid member username %s\n"); fprintf(stderr, pcVar5, local_80); exit(10); } local_60 = add_list(local_60, local_80); local_80 = strtok((char *)0x0, ","); } } iVar2 = gr_update(&local_78); if (iVar2 == 0) { uVar4 = gr_dbname(); uVar1 = Prog; pcVar5 = (char *)gettext("%s: failed to prepare the new %s entry \'%s\'\n"); fprintf(stderr, pcVar5, uVar1, uVar4, local_78); exit(10); } if (is_shadow_grp != '\0') { iVar2 = sgr_update(local_58); if (iVar2 == 0) { uVar4 = sgr_dbname(); uVar1 = Prog; pcVar5 = (char *)gettext("%s: failed to prepare the new %s entry \'%s\'\n"); fprintf(stderr, pcVar5, uVar1, uVar4, local_58[0]); exit(10); } } if (local_30 != *(long *)(in_FS_OFFSET + 0x28)) { __stack_chk_fail(); } return; }
shadow
ghidra
int sshbuf_put_bignum2(struct sshbuf *buf, const BIGNUM *v) { u_char d[(16384 / 8) + 1]; int len = ((BN_num_bits(v) + 7) / 8), prepend = 0, r; if (len < 0 || len > (16384 / 8)) return -10; *d = '\0'; if (BN_bn2bin(v, d + 1) != len) return -1; if (len > 0 && (d[1] & 0x80) != 0) prepend = 1; if ((r = sshbuf_put_string(buf, d + 1 - prepend, len + prepend)) < 0) { explicit_bzero(d, sizeof(d)); return r; } explicit_bzero(d, sizeof(d)); return 0; }
int sshbuf_put_bignum2(undefined8 param_1, BIGNUM *param_2) { int iVar1; int iVar2; long in_FS_OFFSET; int local_824; undefined local_818; uchar local_817[2055]; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); iVar1 = BN_num_bits(param_2); iVar1 = __addvsi3(iVar1, 7); if (iVar1 < 0) { iVar1 = iVar1 + 7; } iVar1 = iVar1 >> 3; local_824 = 0; if ((iVar1 < 0) || (0x800 < iVar1)) { iVar1 = -10; } else { local_818 = 0; iVar2 = BN_bn2bin(param_2, local_817); if (iVar1 == iVar2) { if ((0 < iVar1) && ((char)local_817[0] < '\0')) { local_824 = 1; } iVar1 = __addvsi3(iVar1, local_824); iVar1 = sshbuf_put_string(param_1, local_817 + -(long)local_824, (long)iVar1); if (iVar1 < 0) { explicit_bzero(&local_818, 0x801); } else { explicit_bzero(&local_818, 0x801); iVar1 = 0; } } else { iVar1 = -1; } } if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) { __stack_chk_fail(); } return iVar1; }
openssh-portable
ghidra
static int parse_getput_flags(const char *cmd, char **argv, int argc, int *aflag, int *fflag, int *pflag, int *rflag) { int ch; BSDoptind = BSDoptreset = 1; BSDopterr = 0; *aflag = *fflag = *rflag = *pflag = 0; while ((ch = BSDgetopt(argc, argv, "afPpRr")) != -1) { switch (ch) { case 'a': *aflag = 1; break; case 'f': *fflag = 1; break; case 'p': case 'P': *pflag = 1; break; case 'r': case 'R': *rflag = 1; break; default: sshlog("sftp.c", __func__, 426, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "%s: Invalid flag -%c", cmd, BSDoptopt); return -1; } } return BSDoptind; }
int parse_getput_flags(unsigned long long a0, unsigned long long a1, unsigned long a2, unsigned int *a3, unsigned int *a4, unsigned int *a5, unsigned int *v2) { unsigned long v0; unsigned int v1; unsigned int v3; BSDoptreset = 1; BSDoptind = BSDoptreset; BSDopterr = 0; *(a5) = 0; *(v2) = *(a5); *(a4) = *(v2); *(a3) = *(a4); while (true) { v1 = BSDgetopt(a2, a1, "afPpRr", a1); if (v1 != -1) { v3 = __addvsi3(v1, 0xffffffb0); switch (v3) { case 0: case 32: *(a5) = 1; break; case 2: case 34: *(v2) = 1; break; case 17: *(a3) = 1; break; case 22: *(a4) = 1; break; default: v0 = BSDoptopt; sshlog("sftp.c", "parse_getput_flags", 0x1aa, 0x0, 0x2, 0x0, "%s: Invalid flag -%c", a0); v3 = -1; goto LABEL_4007c5; } } else { v3 = BSDoptind; break; } } LABEL_4007c5: return v3; }
openssh-portable
angr_phoenix
static int ext4_fc_replay_scan(journal_t *j, struct buffer_head *bh, int off, tid_t expected_tid) { e2fsck_t ctx = j->j_fs_dev->k_ctx; struct e2fsck_fc_replay_state *state; int ret = 1; struct ext4_fc_add_range ext; struct ext4_fc_tl tl; struct ext4_fc_tail tail; __u8 *start, *cur, *end, *val; struct ext4_fc_head head; struct ext2fs_extent ext2fs_ex = {0}; state = &ctx->fc_replay_state; start = (__u8 *)bh->b_data; end = (__u8 *)bh->b_data + j->j_blocksize - 1; do { if ((1) <= (-1)) { printf("" "(%s, %d): %s: ", "journal.c", 296, __FUNCTION__); printf("Scan phase starting, expected %d", expected_tid); } } while (0); if (state->fc_replay_expected_off == 0) { memset(state, 0, sizeof(*state)); if (((__u16)(__le16)(((struct ext4_fc_tl *)start)->fc_tag)) != 0x0009) { do { if ((1) <= (-1)) { printf("" "(%s, %d): %s: ", "journal.c", 302, __FUNCTION__); printf("Ending early!, not a head tag"); } } while (0); return 0; } } if (off != state->fc_replay_expected_off) { ret = -(2133571502L); goto out_err; } state->fc_replay_expected_off++; for (cur = start; cur < end; cur = cur + ((__u16)(__le16)(tl.fc_len)) + sizeof(tl)) { memcpy(&tl, cur, sizeof(tl)); val = cur + sizeof(tl); do { if ((3) <= (-1)) { printf("" "(%s, %d): %s: ", "journal.c", 317, __FUNCTION__); printf("Scan phase, tag:%s, blk %lld\n", tag2str(((__u16)(__le16)(tl.fc_tag))), bh->b_blocknr); } } while (0); switch (((__u16)(__le16)(tl.fc_tag))) { case 0x0001: memcpy(&ext, val, sizeof(ext)); ret = ext2fs_decode_extent(&ext2fs_ex, (void *)&ext.fc_ex, sizeof(ext.fc_ex)); if (ret) ret = 0; else ret = 1; case 0x0002: case 0x0004: case 0x0005: case 0x0003: case 0x0006: case 0x0007: state->fc_cur_tag++; state->fc_crc = jbd2_chksum(j, state->fc_crc, cur, sizeof(tl) + ext4_fc_tag_len(&tl)); break; case 0x0008: state->fc_cur_tag++; memcpy(&tail, val, sizeof(tail)); state->fc_crc = jbd2_chksum(j, state->fc_crc, cur, sizeof(tl) + __builtin_offsetof(struct ext4_fc_tail, fc_crc) ); do { if ((1) <= (-1)) { printf("" "(%s, %d): %s: ", "journal.c", 347, __FUNCTION__); printf("tail tid %d, expected %d\n", ((__u32)(__le32)(tail.fc_tid)), expected_tid); } } while (0); if (((__u32)(__le32)(tail.fc_tid)) == expected_tid && ((__u32)(__le32)(tail.fc_crc)) == state->fc_crc) { state->fc_replay_num_tags = state->fc_cur_tag; } else { ret = state->fc_replay_num_tags ? 0 : -(2133571503L); } state->fc_crc = 0; break; case 0x0009: memcpy(&head, val, sizeof(head)); if (((__u32)(__le32)(head.fc_features)) & ~0x0) { ret = -95; break; } if (((__u32)(__le32)(head.fc_tid)) != expected_tid) { ret = -22; break; } state->fc_cur_tag++; state->fc_crc = jbd2_chksum(j, state->fc_crc, cur, sizeof(tl) + ext4_fc_tag_len(&tl)); break; default: ret = state->fc_replay_num_tags ? 0 : -125; } if (ret < 0 || ret == 0) break; } out_err: return ret; }
void ext4_fc_replay_scan(struct_0 *a0, unsigned long a1, unsigned long a2, unsigned long a3) { unsigned int v0; char v1; char v2; unsigned short *v3; unsigned long v4; unsigned int v5[17]; unsigned short *v6; unsigned long v7; void *v8; char v9; char v10; char v11; char v12; void *v13; void *v14; void *v15; char v16; char v17; void *v19; unsigned int v20; unsigned int v22; unsigned int v23; unsigned long long v24; v4 = a0->field_70->field_0; v0 = 1; v13 = 0; v14 = 0; v15 = 0; *(&v5[0]) = v4 + 944; v6 = a1 + 40; v7 = a0->field_78 - 1 + a1 + 40; if (!v5[13]) { memset(v5, 0x0, 0x48); if (*(v6) != 9) { v19 = 0; goto LABEL_4013ab; } } if (a2 != v5[13]) { v0 = 2161395794; } else { v5[13] = v5[13] + 1; v3 = v6; while (true) { if (v3 >= v7) break; memcpy(&v1, v3, 0x4); v8 = v3 + 2; v20 = *(&v1); if (*(&v1) == 9) { memcpy(&v11, v8, 0x8); if (*(&v11)) { v0 = -95; goto LABEL_401372; } else if (a3 == *(&v12)) { v5[15] = v5[15] + 1; v5[16] = jbd2_chksum(a0, v5[16], v3, ext4_fc_tag_len(&v1) + 4); goto LABEL_401372; } else { v0 = -22; goto LABEL_401372; } } if (v20 <= 9) { if (v20 == 8) { v5[15] = v5[15] + 1; memcpy(&v9, v8, 0x8); v5[16] = jbd2_chksum(a0, v5[16], v3, 0x8); if (a3 == *(&v9) && *(&v10) == v5[16]) { v5[12] = v5[15]; goto LABEL_4012bd; } if (!v5[12]) v23 = 2161395793; else v23 = 0; v0 = v23; LABEL_4012bd: v5[16] = 0; goto LABEL_401372; } else if (v20 <= 8) { if (v20 == 1) { memcpy(&v16, v8, 0x10); v0 = ext2fs_decode_extent(&v13, &v17, 0xc, &v17); if (v0) v0 = 0; else v0 = 1; LABEL_4011df: v5[15] = v5[15] + 1; v5[16] = jbd2_chksum(a0, v5[16], v3, ext4_fc_tag_len(&v1) + 4); goto LABEL_401372; } else if (v20 > 0) { if (!(v20 - 2 <= 5)) goto LABEL_401355; goto LABEL_4011df; } } } LABEL_401355: if (v5[12]) v22 = 0; else v22 = -125; v0 = v22; LABEL_401372: if (v0 < 0) break; if (!v0) break; v3 = 4 + v3 + *(&v2); } } v24 = v0; LABEL_4013ab: return; }
e2fsprogs-1.46.5
angr_phoenix
char **make_builtin_argv(list, ip) WORD_LIST *list; int *ip; { char **argv; argv = strvec_from_word_list(list, 0, 1, ip); argv[0] = this_command_name; return argv; }
long long make_builtin_argv(unsigned long long a0, unsigned long long a1) { unsigned long long *v0; v0 = strvec_from_word_list(a0, 0x0, 0x1, a1); *(v0) = this_command_name; return v0; }
bash
angr_phoenix
char const *getprogname(void) { return program_invocation_short_name; }
long long getprogname() { return *(got.program_invocation_short_name); }
gnutls
angr_dream
) { fprintf(stderr, "%s", systemkey_tool_options.arg.outfile); app_exit(1); }
int fprintf(FILE *__stream, char *__format, ...) { halt_baddata(); }
gnutls
ghidra
(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(undefined8 *param_1, undefined4 param_2) { undefined8 uVar1; long in_FS_OFFSET; long local_88[10]; undefined8 local_38; long local_20; local_20 = *(long *)(in_FS_OFFSET + 0x28); if (param_1[0x2e] == 0) { clear_problem_context(local_88); uVar1 = gettext("bad inode map"); local_88[0] = e2fsck_allocate_inode_bitmap(*param_1, uVar1, 2, "inode_bad_map", param_1 + 0x2e); if (local_88[0] != 0) { local_38 = 3; fix_problem(param_1, 0x10024, local_88); *(uint *)(param_1 + 9) = *(uint *)(param_1 + 9) | 1; goto LAB_0010613d; } } ext2fs_mark_inode_bitmap2(param_1[0x2e], param_2); LAB_0010613d: if (local_20 != *(long *)(in_FS_OFFSET + 0x28)) { __stack_chk_fail(); } return; }
e2fsprogs-1.46.5
ghidra
static _Bool fillbuf(struct buffer *buf, FILE *fp, char const *file) { struct keyfield const *key = keylist; char eol = eolchar; size_t line_bytes = buf->line_bytes; size_t mergesize = merge_buffer_size - (2 + sizeof(struct line)); if (buf->eof) return 0; if (buf->used != buf->left) { memmove(buf->buf, buf->buf + buf->used - buf->left, buf->left); buf->used = buf->left; buf->nlines = 0; } while (1) { char *ptr = buf->buf + buf->used; struct line *linelim = buffer_linelim(buf); struct line *line = linelim - buf->nlines; size_t avail = (char *)linelim - buf->nlines * line_bytes - ptr; char *line_start = buf->nlines ? line->text + line->length : buf->buf; while (line_bytes + 1 < avail) { size_t readsize = (avail - 1) / (line_bytes + 1); size_t bytes_read = fread_unlocked(ptr, 1, readsize, fp); char *ptrlim = ptr + bytes_read; char *p; avail -= bytes_read; if (bytes_read != readsize) { if (ferror_unlocked(fp)) sort_die(gettext("read failed"), file); if (feof_unlocked(fp)) { buf->eof = 1; if (buf->buf == ptrlim) return 0; if (line_start != ptrlim && ptrlim[-1] != eol) *ptrlim++ = eol; } } while ((p = memchr(ptr, eol, ptrlim - ptr))) { *p = '\0'; ptr = p + 1; line--; line->text = line_start; line->length = ptr - line_start; mergesize = (((mergesize) > (line->length)) ? (mergesize) : (line->length)); avail -= line_bytes; if (key) { line->keylim = (key->eword == (18446744073709551615UL) ? p : limfield(line, key)); if (key->sword != (18446744073709551615UL)) line->keybeg = begfield(line, key); else { if (key->skipsblanks) while (blanks[to_uchar(*line_start)]) line_start++; line->keybeg = line_start; } } line_start = ptr; } ptr = ptrlim; if (buf->eof) break; } buf->used = ptr - buf->buf; buf->nlines = buffer_linelim(buf) - line; if (buf->nlines != 0) { buf->left = ptr - line_start; merge_buffer_size = mergesize + (2 + sizeof(struct line)); return 1; } { size_t line_alloc = buf->alloc / sizeof(struct line); buf->buf = x2nrealloc(buf->buf, &line_alloc, sizeof(struct line)); buf->alloc = line_alloc * sizeof(struct line); } } }
undefined8 fillbuf(char **param_1, FILE *param_2) { char **ppcVar1; char cVar2; byte bVar3; int iVar4; undefined8 uVar5; char *pcVar6; long lVar7; char *pcVar8; long in_FS_OFFSET; ulong local_78; char *local_70; char *local_68; char **local_60; char *local_58; char *local_50; char *local_48; long *local_40; char *local_38; long local_30; ulong local_28; size_t local_20; char *local_18; long local_10; cVar2 = eolchar; local_10 = *(long *)(in_FS_OFFSET + 0x28); local_40 = keylist; local_38 = param_1[5]; local_70 = merge_buffer_size + -0x22; if (*(char *)(param_1 + 6) == '\0') { if (param_1[1] != param_1[4]) { memmove(*param_1, *param_1 + ((long)param_1[1] - (long)param_1[4]), (size_t)param_1[4]); param_1[1] = param_1[4]; param_1[2] = (char *)0x0; } do { local_68 = param_1[1] + (long)*param_1; local_30 = buffer_linelim(param_1); local_60 = (char **)(local_30 + (long)param_1[2] * -0x20); local_58 = (char *)((local_30 - (long)param_1[2] * (long)local_38) - (long)local_68); if (param_1[2] == (char *)0x0) { local_50 = *param_1; } else { local_50 = local_60[1] + (long)*local_60; } do { if (local_58 <= local_38 + 1) break; local_28 = (ulong)(local_58 + -1) / (ulong)(local_38 + 1); local_20 = fread_unlocked(local_68, 1, local_28, param_2); local_48 = local_68 + local_20; local_58 = local_58 + -local_20; if (local_20 != local_28) { iVar4 = ferror_unlocked(param_2); if (iVar4 != 0) { uVar5 = gettext("read failed"); sort_die(uVar5); } iVar4 = feof_unlocked(param_2); if (iVar4 != 0) { *(undefined *)(param_1 + 6) = 1; if (local_48 == *param_1) { uVar5 = 0; goto LAB_00102e37; } if ((local_50 != local_48) && (cVar2 != local_48[-1])) { *local_48 = cVar2; local_48 = local_48 + 1; } } } while (pcVar8 = (char *)memchr(local_68, (int)cVar2, (long)local_48 - (long)local_68), local_18 = pcVar8, pcVar8 != (char *)0x0) { *pcVar8 = '\0'; local_68 = pcVar8 + 1; ppcVar1 = local_60 + -4; *ppcVar1 = local_50; local_60[-3] = local_68 + -(long)local_50; pcVar6 = local_60[-3]; if (local_60[-3] <= local_70) { pcVar6 = local_70; } local_58 = local_58 + -(long)local_38; local_70 = pcVar6; local_60 = ppcVar1; if (local_40 != (long *)0x0) { if (local_40[2] != -1) { pcVar8 = (char *)limfield(ppcVar1); } local_60[3] = pcVar8; if (*local_40 == -1) { if (*(char *)(local_40 + 6) != '\0') { while (bVar3 = to_uchar((int)*local_50), blanks[(int)(uint)bVar3] != '\0') { local_50 = local_50 + 1; } } local_60[2] = local_50; } else { pcVar8 = (char *)begfield(local_60); local_60[2] = pcVar8; } } local_50 = local_68; } local_68 = local_48; } while (*(char *)(param_1 + 6) == '\0'); param_1[1] = local_68 + -(long)*param_1; lVar7 = buffer_linelim(param_1); param_1[2] = (char *)(lVar7 - (long)local_60 >> 5); if (param_1[2] != (char *)0x0) goto code_r0x00102db5; local_78 = (ulong)param_1[3] >> 5; pcVar8 = (char *)x2nrealloc(*param_1, &local_78, 0x20); *param_1 = pcVar8; param_1[3] = (char *)(local_78 << 5); } while (true); } uVar5 = 0; LAB_00102e37: if (local_10 == *(long *)(in_FS_OFFSET + 0x28)) { return uVar5; } __stack_chk_fail(); code_r0x00102db5: param_1[4] = local_68 + -(long)local_50; merge_buffer_size = local_70 + 0x22; uVar5 = 1; goto LAB_00102e37; }
coreutils
ghidra
char *sh_backslash_quote(string, table, flags) char *string; char *table; int flags; { int c, mb_cur_max; size_t slen; char *result, *r, *s, *backslash_table, *send; mbstate_t state; memset(&state, '\0', sizeof(mbstate_t)); slen = strlen(string); send = string + slen; result = (char *)sh_xmalloc((2 * slen + 1), "shquote.c", 274); backslash_table = table ? table : (char *)bstab; mb_cur_max = (__ctype_get_mb_cur_max()); for (r = result, s = string; s && (c = *s); s++) { if (c >= 0 && c <= 127 && backslash_table[(unsigned char)c] == 1) { *r++ = '\\'; *r++ = c; continue; } if ((locale_utf8locale && (c & 0x80)) || (locale_utf8locale == 0 && mb_cur_max > 1 && is_basic(c) == 0)) { do { if (locale_mb_cur_max > 1) { mbstate_t state_bak; size_t mblength; int _k; _k = is_basic(*(s)); if (_k) mblength = 1; else if (locale_utf8locale && ((*(s) & 0x80) == 0)) mblength = *(s) != 0; else { state_bak = state; mblength = mbrlen((s), (send) - (s), &state); } if (mblength == (size_t)-2 || mblength == (size_t)-1) { state = state_bak; mblength = 1; } else mblength = (mblength < 1) ? 1 : mblength; for (_k = 0; _k < mblength; _k++) *(r)++ = *(s)++; } else *(r)++ = *(s)++; } while (0); s--; continue; } if (backslash_table[(unsigned char)c] == 1) *r++ = '\\'; else if (c == '#' && s == string) *r++ = '\\'; else if ((flags & 1) && c == '~' && (s == string || s[-1] == ':' || s[-1] == '=')) *r++ = '\\'; else if ((flags & 2) && (sh_syntaxtab[(unsigned char)((unsigned char)c)] & 0x2000)) *r++ = '\\'; *r++ = c; } *r = '\0'; return (result); }
int sh_backslash_quote(char *a0, unsigned long long a1, unsigned long long a2, unsigned long long a3, unsigned long long a4, unsigned long long a5) { int tmp_11; int tmp_19; unsigned int v0; int tmp_14; int tmp_10; unsigned int v1; unsigned int v2; char *v3; char *v4; unsigned long long v5; unsigned long v6; unsigned long v7; char *v8; unsigned long long v9; unsigned long long v10; unsigned long long v11; unsigned long long v13; char *v15; char *v16; char *v17; char *v18; unsigned long long v19; char *v20; char *v21; char *v22; memset(&v10, 0x0, 0x8); v6 = strlen(a0); v7 = &a0[v6]; v8 = sh_xmalloc(v6 * 2 + 1, "shquote.c", 0x112); if (a1) v13 = a1; else v13 = &bstab; v9 = v13; v1 = __ctype_get_mb_cur_max(a0, "shquote.c", 0x112, a3, a4, a5); v3 = v8; for (v4 = a0; v4; v4 += 1) { v2 = *(v4); if (!v2) break; if (v2) { if (v2 >= 0 && v2 <= 127 && *((v9 + v2)) == 1) { tmp_11 = v3; v3 += 1; *(tmp_11) = 92; tmp_19 = v3; v3 += 1; *(tmp_19) = v2; } if (v2 < 0 || v2 > 127 || *((v9 + v2)) != 1) { if ((!is_basic(v2) || locale_utf8locale) && (!locale_utf8locale || (v2 & 128)) && (locale_utf8locale || v1 > 1)) { if (locale_mb_cur_max > 1) { v0 = is_basic(*(v4)); if (v0) { v5 = 1; } else { if (locale_utf8locale && *(v4) >= 0) v5 = *(v4); if (*(v4) < 0 || !locale_utf8locale) { v11 = v10; v5 = mbrlen(v4, v7 + -0x1 * v4, &v10, v7 + -0x1 * v4); } } if (v5 != -2 && v5 != -1) { if (v5) v19 = v5; else v19 = 1; v5 = v19; } if (v5 == -2 || v5 == -1) { v10 = v11; v5 = 1; } for (v0 = 0; v5 > v0; v0 += 1) { tmp_14 = v4; v4 += 1; v22 = v3; v3 += 1; *(&a2) = *(tmp_14); *(v22) = a2; } } else { tmp_10 = v4; v4 += 1; v15 = v3; v3 += 1; *(&a2) = *(tmp_10); *(v15) = a2; } v4 += 1; } else { if (*((v9 + v2)) == 1) { v16 = v3; v3 += 1; *(v16) = 92; } else { if (v2 == 35 && v4 == a0) { v17 = v3; v3 += 1; *(v17) = 92; } if (v4 != a0 || v2 != 35) { if ((a2 & 1) && v2 == 126 && (v4[1] == 61 || v4 == a0 || v4[1] == 58)) { v18 = v3; v3 += 1; *(v18) = 92; } if ((!(a2 & 1) || v2 != 126 || v4[1] != 61 && v4 != a0 && v4[1] != 58) && (a2 & 2) && (sh_syntaxtab[v2] & 0x2000)) { v20 = v3; v3 += 1; *(v20) = 92; } } } v21 = v3; v3 += 1; *(v21) = v2; } } } } *(v3) = 0; return v8; }
bash
angr_dream
static inline _Bool is_smack_enabled(void) { return 0; }
long is_smack_enabled() { return 0LL; }
coreutils
ida
int acl_calc_mask(acl_t *acl_p) { acl_obj *acl_obj_p; acl_entry_obj *entry_obj_p, *mask_obj_p = ((void *)0); permset_t perm = (0x0000); if (!acl_p) { (*__errno_location()) = 22; return -1; } acl_obj_p = ((acl_obj *)__ext2int_and_check(*acl_p, (0x712C))); if (!acl_obj_p) return -1; for ((entry_obj_p) = (acl_obj_p)->i.a_next; (entry_obj_p) != (acl_entry_obj *)(acl_obj_p); (entry_obj_p) = (entry_obj_p)->i.e_next) { switch (entry_obj_p->i.e_entry.e_tag) { case (0x01): case (0x20): break; case (0x10): mask_obj_p = entry_obj_p; break; case (0x02): case (0x04): case (0x08): perm |= entry_obj_p->i.e_entry.e_perm.i.s_perm; break; default: (*__errno_location()) = 22; return -1; } } if (mask_obj_p == ((void *)0)) { mask_obj_p = __acl_create_entry_obj(acl_obj_p); if (mask_obj_p == ((void *)0)) return -1; mask_obj_p->i.e_entry.e_tag = (0x10); __acl_reorder_entry_obj_p(mask_obj_p); } mask_obj_p->i.e_entry.e_perm.i.s_perm = perm; return 0; }
long long acl_calc_mask(unsigned long long *a0) { unsigned int v0; struct_1 *v1; void *v2; struct_0 *v3; unsigned long long v5; v2 = 0; v0 = 0; if (!a0) { *(__errno_location()) = 22; v5 = 4294967295; return v5; } v3 = __ext2int_and_check(*(a0), 0x712c); if (!v3) { v5 = 4294967295; return v5; } for (v1 = v3->field_10; v1 != v3; v1 = v1->field_10) { switch (v1->field_20) { case 1: case 32: break; case 2: case 4: case 8: v0 |= v1->field_40; break; case 16: v2 = v1; break; default: *(__errno_location()) = 22; v5 = 4294967295; return v5; } } if (!v2) { v2 = __acl_create_entry_obj(v3); if (!v2) { v5 = 4294967295; return v5; } *(&v2[32]) = 16; __acl_reorder_entry_obj_p(v2); } *(&v2[64]) = v0; v5 = 0; return v5; }
acl-2.3.1
angr_sailr
static int diversion_truename(const char *const *argv) { const char *filename = argv[0]; struct fsys_namenode *namenode; if (!filename || argv[1]) badusage(gettext("--%s needs a single argument"), cipaction->olong); diversion_check_filename(filename); namenode = fsys_hash_find_node(filename, FHFF_NONE); if (namenode && namenode->divert && namenode->divert->useinstead) printf("%s\n", namenode->divert->useinstead->name); else printf("%s\n", filename); return 0; }
long long diversion_truename(unsigned long long a0[2], unsigned long a1, unsigned long long a2) { char *v0; struct_0 *v1; v0 = a0[0]; if (!v0 || a0[1]) badusage(gettext("--%s needs a single argument"), *(cipaction), a2); diversion_check_filename(v0); v1 = fsys_hash_find_node(v0, 0x2); if (v1 && v1->field_18 && *(v1->field_18)) printf("%s\n", *(v1->field_18)->field_8); if (!*(v1->field_18) || !v1->field_18 || !v1) printf("%s\n", v0); return 0; }
dpkg
angr_dream
void set_next_block_after(union block *block) { while (block >= current_block) current_block++; if (current_block > record_end) abort(); }
void set_next_block_after(ulong param_1) { for (; current_block <= param_1; current_block = current_block + 0x200) { } if (record_end < current_block) { abort(); } return; }
tar
ghidra
inline errcode_t ext2fs_get_mem(unsigned long size, void *ptr) { void *pp; pp = malloc(size); if (!pp) return (2133571398L); memcpy(ptr, &pp, sizeof(pp)); return 0; }
void ext2fs_get_mem(void) { halt_baddata(); }
e2fsprogs-1.46.5
ghidra
int xfrm_selector_parse(struct xfrm_selector *sel, int *argcp, char ***argvp) { int argc = *argcp; char **argv = *argvp; inet_prefix dst = {}; inet_prefix src = {}; char *upspecp = ((void *)0); while (1) { if (strcmp(*argv, "src") == 0) { do { argv++; if (--argc <= 0) incomplete_command(); } while (0); get_prefix(&src, *argv, preferred_family); if (src.family == 0) invarg("value after \"src\" has an unrecognized address family", *argv); sel->family = src.family; memcpy(&sel->saddr, &src.data, sizeof(sel->saddr)); sel->prefixlen_s = src.bitlen; filter.sel_src_mask = src.bitlen; } else if (strcmp(*argv, "dst") == 0) { do { argv++; if (--argc <= 0) incomplete_command(); } while (0); get_prefix(&dst, *argv, preferred_family); if (dst.family == 0) invarg("value after \"dst\" has an unrecognized address family", *argv); sel->family = dst.family; memcpy(&sel->daddr, &dst.data, sizeof(sel->daddr)); sel->prefixlen_d = dst.bitlen; filter.sel_dst_mask = dst.bitlen; } else if (strcmp(*argv, "dev") == 0) { int ifindex; do { argv++; if (--argc <= 0) incomplete_command(); } while (0); if (strcmp(*argv, "none") == 0) ifindex = 0; else { ifindex = ll_name_to_index(*argv); if (ifindex <= 0) invarg("DEV value is invalid", *argv); } sel->ifindex = ifindex; filter.sel_dev_mask = (~0); } else { if (upspecp) { do { argv--; argc++; } while (0); break; } else { upspecp = *argv; xfrm_selector_upspec_parse(sel, &argc, &argv); } } if (!(argc - 1 > 0)) break; do { argv++; if (--argc <= 0) incomplete_command(); } while (0); } if (src.family && dst.family && (src.family != dst.family)) invarg("the same address family is required between values after \"src\" " "and \"dst\"", *argv); if (argc == *argcp) missarg("SELECTOR"); *argcp = argc; *argvp = argv; return 0; }
long long xfrm_selector_parse(void *a0, unsigned int *a1, unsigned long long *a2) { struct_0 *v0; unsigned int v1; unsigned int v2; unsigned long long *v3; unsigned long v4; char v5; char v6; char v7; char v8; unsigned long long v10; unsigned long long *v11; unsigned long v12; unsigned long long *v13; unsigned long long v14; v0 = a0; v1 = *(a1); v3 = *(a2); v10 = 33; for (v11 = &v5; v10; v11 = &v11[v12]) { v10 -= 1; v5 = 0; } v14 = 33; for (v13 = &v7; v14; v13 = &v13[v12]) { v14 -= 1; v7 = 0; } v4 = 0; do { if (!strcmp(*(v3), "src")) { v3 = v3 + 1; v1 -= 1; if (v1 <= 0) incomplete_command(); get_prefix(&v7, *(v3), *(&preferred_family), *(v3)); if (!*((&v7 + 6))) invarg("value after \"src\" has an unrecognized address family", *(v3)); v0->field_28 = *((&v7 + 6)); memcpy(&v0->padding_0[16], &v8, 0x10); v0->field_2b = *((&v7 + 4)); g_4001c9 = *((&v7 + 4)); } else if (!strcmp(*(v3), "dst")) { v3 = v3 + 1; v1 -= 1; if (v1 <= 0) incomplete_command(); get_prefix(&v5, *(v3), *(&preferred_family), *(v3)); if (!*((&v5 + 6))) invarg("value after \"dst\" has an unrecognized address family", *(v3)); v0->field_28 = *((&v5 + 6)); memcpy(v0, &v6, 0x10); v0->field_2a = *((&v5 + 4)); g_4001ca = *((&v5 + 4)); } else if (!strcmp(*(v3), "dev")) { v3 = v3 + 1; v1 -= 1; if (v1 <= 0) incomplete_command(); if (!strcmp(*(v3), "none")) { v2 = 0; } else { v2 = ll_name_to_index(*(v3)); if (v2 <= 0) invarg("DEV value is invalid", *(v3)); } v0->field_30 = v2; g_4001cc = -1; } else if (!v4) { v4 = *(v3); xfrm_selector_upspec_parse(v0, &v1, &v3); } else { v3 += 1; v1 += 1; goto LABEL_404b79; } if (v1 <= 1) goto LABEL_404b79; } while ((v3 = v3 + 1, v1 -= 1, v1 > 0)); incomplete_command(); LABEL_404b79: if (*((&v7 + 6)) && *((&v5 + 6)) && *((&v7 + 6)) != *((&v5 + 6))) invarg("the same address family is required between values after \"src\" " "and \"dst\"", *(v3)); if (*(a1) == v1) missarg("SELECTOR"); *(a1) = v1; *(a2) = v3; return 0; }
iproute2-6.0.0
angr_sailr
_Bool sci_complete(_Bool sci, _Bool port, _Bool addr, _Bool port_only) { return sci || (port && (addr || port_only)); }
int sci_complete(unsigned long a0, unsigned long a1, unsigned long a2, unsigned long a3) { unsigned int v1; unsigned int v2; if (!a0 && (!a2 || !a1) && (!a1 || !a3)) v1 = 0; if (a0 || a2 && a1 || a1 && a3) v1 = 1; v2 = v1 & 1; return v2; }
iproute2-6.0.0
angr_dream
static inline void initialize_exit_failure(int status) { if (status != 1) exit_failure = status; }
void initialize_exit_failure(unsigned long long a0) { unsigned long long v1; if (a0 != 1) { v1 = a0; exit_failure = a0; } return; }
coreutils
angr_dream
get_stat_mtime(struct stat const *st) { return ((st)->st_mtim); }
void get_stat_mtime(void) { halt_baddata(); }
coreutils
ghidra
static void flush_pending(strm) z_streamp strm; { unsigned len; deflate_state *s = strm->state; _tr_flush_bits(s); len = s->pending; if (len > strm->avail_out) len = strm->avail_out; if (len == 0) return; memcpy(strm->next_out, s->pending_out, len); strm->next_out += len; s->pending_out += len; strm->total_out += len; strm->avail_out -= len; s->pending -= len; if (s->pending == 0) { s->pending_out = s->pending_buf; } }
void flush_pending(struct_0 *a0, unsigned long long a1, unsigned long long a2, unsigned long long a3) { unsigned int v0; unsigned long long v1[6]; unsigned long long v3; unsigned long long v4; unsigned long long v5; unsigned long long v6[6]; v1[0] = a0->field_38; _tr_flush_bits(v1, a1, a2, a3); v0 = v1[5]; v3 = a0->field_20; if (v0 > a0->field_20) { v4 = a0->field_20; v0 = a0->field_20; } if (v0) { memcpy(a0->field_18, v1[4], v0); a0->field_18 = a0->field_18 + v0; v1[4] = v1[4] + v0; a0->field_28 = a0->field_28 + v0; a0->field_20 = a0->field_20 - v0; v1[5] = v1[5] - v0; v5 = v1[5]; if (!v1[5]) { v6 = v1; v1[4] = v1[2]; } } return; }
zlib
angr_dream
static void malloc_debug_dummy() { write(1, "malloc_debug_dummy\n", 19); }
long long malloc_debug_dummy() { return write(0x1, "malloc_debug_dummy\n", 0x13); }
bash
angr_sailr
static int match_pattern(string, pat, mtype, sp, ep) char *string, *pat; int mtype; char **sp, **ep; { int ret; size_t n; wchar_t *wstring, *wpat; char **indices; if (string == 0 || pat == 0 || *pat == 0) return (0); if ((__ctype_get_mb_cur_max()) > 1) { if (mbsmbchar(string) == 0 && mbsmbchar(pat) == 0) return (match_upattern(string, pat, mtype, sp, ep)); n = xdupmbstowcs(&wpat, ((void *)0), pat); if (n == (size_t)-1) return (match_upattern(string, pat, mtype, sp, ep)); n = xdupmbstowcs(&wstring, &indices, string); if (n == (size_t)-1) { sh_xfree((wpat), "subst.c", 5680); return (match_upattern(string, pat, mtype, sp, ep)); } ret = match_wpattern(wstring, indices, n, wpat, mtype, sp, ep); sh_xfree((wpat), "subst.c", 5685); sh_xfree((wstring), "subst.c", 5686); sh_xfree((indices), "subst.c", 5687); return (ret); } else return (match_upattern(string, pat, mtype, sp, ep)); }
int match_pattern(void *a0, char *a1, unsigned long a2, unsigned long long *a3, unsigned long long *a4, unsigned long long a5) { unsigned int v0; char v1; char v2; char v3; unsigned long long v4; char v5; unsigned long long v6; char v7; unsigned int v8; if (!a0) { LABEL_40e4ed: v8 = 0; } else { if (!a1) goto LABEL_40e4ed; if (!*(a1)) goto LABEL_40e4ed; if (__ctype_get_mb_cur_max(a0, a1, a2, a3, a4, a5, *(&v5), v6, *(&v7)) <= 1) { v8 = match_upattern(a0, a1, a2, a3, a4); } else { if (!mbsmbchar(a0) && !mbsmbchar(a1)) { v8 = match_upattern(a0, a1, a2, a3, a4); goto LABEL_40e689; } v4 = xdupmbstowcs(&v2, 0x0, a1); if (v4 == -1) { v8 = match_upattern(a0, a1, a2, a3, a4); } else { v4 = xdupmbstowcs(&v1, &v3, a0); if (v4 == -1) { sh_xfree(*(&v2), "subst.c", 0x1630); v8 = match_upattern(a0, a1, a2, a3, a4); } else { v0 = match_wpattern(*(&v1), *(&v3), v4, *(&v2), a2, a3, a4); sh_xfree(*(&v2), "subst.c", 0x1635); sh_xfree(*(&v1), "subst.c", 0x1636); sh_xfree(*(&v3), "subst.c", 0x1637); v8 = v0; } } } } LABEL_40e689: return v8; }
bash
angr_phoenix
static void alarm_handler(int signo) { benchmark_must_finish = 1; }
long long alarm_handler(unsigned long a0) { unsigned int v0; unsigned long v2; v0 = a0; benchmark_must_finish = 1; return v2; }
gnutls
angr_phoenix
static inline _Bool is_addrtype_inet_not_unspec(const inet_prefix *p) { return (p->flags & ADDRTYPE_INET_UNSPEC) == ADDRTYPE_INET; }
int is_addrtype_inet_not_unspec(unsigned short *a0) { unsigned int v1; v1 = *(a0) & 6; *(&v1) = (*(a0) & 6) == 2; return v1; }
iproute2-6.0.0
angr_sailr
int chan_is_dead(struct ssh *ssh, Channel *c, int do_send) { if (c->type == 14) { sshlog("nchan.c", __func__, 336, 0, SYSLOG_LEVEL_DEBUG2, ((void *)0), "channel %d: zombie", c->self); return 1; } if (c->istate != 3 || c->ostate != 3) return 0; if ((ssh->compat & 0x00200000) && c->extended_usage == 2 && c->efd != -1 && sshbuf_len(c->extended) > 0) { sshlog("nchan.c", __func__, 345, 0, SYSLOG_LEVEL_DEBUG2, ((void *)0), "channel %d: active efd: %d len %zu", c->self, c->efd, sshbuf_len(c->extended)); return 0; } if (c->flags & 0x10) { sshlog("nchan.c", __func__, 350, 0, SYSLOG_LEVEL_DEBUG2, ((void *)0), "channel %d: is dead (local)", c->self); return 1; } if (!(c->flags & 0x01)) { if (do_send) { chan_send_close2(ssh, c); } else { if (c->flags & 0x02) { sshlog("nchan.c", __func__, 359, 0, SYSLOG_LEVEL_DEBUG2, ((void *)0), "channel %d: almost dead", c->self); return 1; } } } if ((c->flags & 0x01) && (c->flags & 0x02)) { sshlog("nchan.c", __func__, 367, 0, SYSLOG_LEVEL_DEBUG2, ((void *)0), "channel %d: is dead", c->self); return 1; } return 0; }
long long chan_is_dead(struct_1 *a0, struct_0 *a1, unsigned long a2) { char v0; unsigned long long v2; unsigned long long v3; if (a1->field_0 == 14) { sshlog("nchan.c", "chan_is_dead", 0x150, 0x0, 0x6, 0x0, "channel %d: zombie", a1->field_4, *(&v0)); v2 = 1; } else { if (a1->field_10 == 3 && a1->field_14 == 3) { if ((a0->field_83c & 0x200000) && a1->field_c0 == 2 && a1->field_24 != -1) { v3 = sshbuf_len(a1->field_78); if (v3) { sshbuf_len(a1->field_78); sshlog("nchan.c", "chan_is_dead", 0x159, 0x0, 0x6, 0x0, "channel %d: active efd: %d len %zu", a1->field_4, a1->field_24); v2 = 0; } } if (a1->field_24 == -1 || !(a0->field_83c & 0x200000) || !v3 || a1->field_c0 != 2) { if ((a1->field_18 & 16)) { sshlog("nchan.c", "chan_is_dead", 0x15e, 0x0, 0x6, 0x0, "channel %d: is dead (local)", a1->field_4, *(&v0)); v2 = 1; } else { if (!(a1->field_18 & 1)) { if (a2) { chan_send_close2(a0, a1); } else if ((a1->field_18 & 2)) { sshlog("nchan.c", "chan_is_dead", 0x167, 0x0, 0x6, 0x0, "channel %d: almost dead", a1->field_4, *(&v0)); v2 = 1; } } if (!(a1->field_18 & 2) || (a1->field_18 & 1) || a2) { if ((a1->field_18 & 1) && (a1->field_18 & 2)) { sshlog("nchan.c", "chan_is_dead", 0x16f, 0x0, 0x6, 0x0, "channel %d: is dead", a1->field_4, *(&v0)); v2 = 1; } if (!(a1->field_18 & 1) || !(a1->field_18 & 2)) v2 = 0; } } } } if (a1->field_14 != 3 || a1->field_10 != 3) v2 = 0; } return v2; }
openssh-portable
angr_dream
static int bc_queue_len_arg(const char *arg) { fprintf(stderr, "Error: argument of \"bcqueuelen\" must be a positive integer " "[0-4294967295], not \"%s\"\n", arg); return -1; }
void bc_queue_len_arg(unsigned long a0) { unsigned long long v1; fprintf(stderr, "Error: argument of \"bcqueuelen\" must be a positive integer " "[0-4294967295], not \"%s\"\n", a0); v1 = 4294967295; return; }
iproute2-6.0.0
angr_phoenix
static int putx(c) int c; { int x; x = putc(c, rl_outstream); return x; }
long long putx(unsigned long a0) { unsigned int v0; v0 = putc(a0, rl_outstream); return v0; }
bash
angr_dream
static int copy_rest(FILE *f, int c) { char const *s; out_column = 0; if (in_column > next_prefix_indent || (c != '\n' && c != (-1))) { put_space(next_prefix_indent); for (s = prefix; out_column != in_column && *s; out_column++) putchar_unlocked(*s++); if (c != (-1) && c != '\n') put_space(in_column - out_column); if (c == (-1) && in_column >= next_prefix_indent + prefix_length) putchar_unlocked('\n'); } while (c != '\n' && c != (-1)) { putchar_unlocked(c); c = getc_unlocked(f); } return c; }
int copy_rest(FILE *param_1, int param_2) { int local_24; char *local_10; out_column = 0; local_24 = param_2; if ((next_prefix_indent < in_column) || ((param_2 != 10 && (param_2 != -1)))) { put_space(); local_10 = prefix; while ((out_column != in_column && (*local_10 != '\0'))) { putchar_unlocked((int)*local_10); out_column = out_column + 1; local_10 = local_10 + 1; } if ((param_2 != -1) && (param_2 != 10)) { put_space(); } if ((param_2 == -1) && (next_prefix_indent + prefix_length <= in_column)) { putchar_unlocked(10); } } while ((local_24 != 10 && (local_24 != -1))) { putchar_unlocked(local_24); local_24 = getc_unlocked(param_1); } return local_24; }
coreutils
ghidra
void update_primary_groups(gid_t ogid, gid_t ngid) { struct passwd *pwd; prefix_setpwent(); while ((pwd = prefix_getpwent()) != ((void *)0)) { if (pwd->pw_gid == ogid) { const struct passwd *lpwd; struct passwd npwd; lpwd = pw_locate(pwd->pw_name); if (((void *)0) == lpwd) { fprintf(stderr, gettext("%s: user '%s' does not exist in %s\n"), Prog, pwd->pw_name, pw_dbname()); exit(10); } else { npwd = *lpwd; npwd.pw_gid = ngid; if (pw_update(&npwd) == 0) { fprintf(stderr, gettext("%s: failed to prepare the new %s entry '%s'\n"), Prog, pw_dbname(), npwd.pw_name); exit(10); } } } } prefix_endpwent(); }
void update_primary_groups(int param_1, uint param_2) { undefined8 uVar1; undefined8 uVar2; int iVar3; undefined8 *puVar4; undefined8 uVar5; char *pcVar6; undefined8 *puVar7; long in_FS_OFFSET; undefined8 local_68; undefined8 local_60; ulong local_58; undefined8 local_50; undefined8 local_48; undefined8 local_40; long local_30; local_30 = *(long *)(in_FS_OFFSET + 0x28); prefix_setpwent(); do { do { puVar7 = (undefined8 *)prefix_getpwent(); if (puVar7 == (undefined8 *)0x0) { prefix_endpwent(); if (local_30 != *(long *)(in_FS_OFFSET + 0x28)) { __stack_chk_fail(); } return; } } while (param_1 != *(int *)((long)puVar7 + 0x14)); puVar4 = (undefined8 *)pw_locate(*puVar7); if (puVar4 == (undefined8 *)0x0) { uVar5 = pw_dbname(); uVar2 = Prog; uVar1 = *puVar7; pcVar6 = (char *)gettext("%s: user \'%s\' does not exist in %s\n"); fprintf(stderr, pcVar6, uVar2, uVar1, uVar5); exit(10); } local_68 = *puVar4; local_60 = puVar4[1]; local_50 = puVar4[3]; local_40 = puVar4[5]; local_48 = puVar4[4]; local_58 = puVar4[2] & 0xffffffff | (ulong)param_2 << 0x20; iVar3 = pw_update(&local_68); uVar1 = local_68; } while (iVar3 != 0); uVar5 = pw_dbname(); uVar2 = Prog; pcVar6 = (char *)gettext("%s: failed to prepare the new %s entry \'%s\'\n"); fprintf(stderr, pcVar6, uVar2, uVar5, uVar1); exit(10); }
shadow
ghidra
void printcrontab(user *u) { printf(" - user: \"%s\"\n", u->name); printf(" crontab: %s\n", u->tabname); printf(" system: %d\n", u->system); printf(" entries:\n"); }
void printcrontab(struct_0 *a0) { unsigned long long v1; printf(" - user: \"%s\"\n", a0->field_10); printf(" crontab: %s\n", a0->field_18); printf(" system: %d\n", a0->field_34); v1 = printf(" entries:\n"); return; }
cronie
angr_dream
static _Bool mp_prime_p(mpz_t n) { _Bool is_prime; mpz_t q, a, nm1, tmp; struct mp_factors factors; if ((__builtin_constant_p(1) && (1) == 0 ? ((n)->_mp_size < 0 ? -1 : (n)->_mp_size > 0) : __gmpz_cmp_ui(n, 1)) <= 0) return 0; if ((__builtin_constant_p((long)5003 * 5003) && ((long)5003 * 5003) == 0 ? ((n)->_mp_size < 0 ? -1 : (n)->_mp_size > 0) : __gmpz_cmp_ui(n, (long)5003 * 5003)) < 0) return 1; __gmpz_inits(q, a, nm1, tmp, ((void *)0)); __gmpz_sub_ui(nm1, n, 1); unsigned long int k = __gmpz_scan1(nm1, 0); __gmpz_tdiv_q_2exp(q, nm1, k); __gmpz_set_ui(a, 2); if (!mp_millerrabin(n, nm1, a, tmp, q, k)) { is_prime = 0; goto ret2; } if (flag_prove_primality) { __gmpz_set(tmp, nm1); mp_factor(tmp, &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 long int i = 0; i < factors.nfactors && is_prime; i++) { __gmpz_divexact(tmp, nm1, factors.p[i]); __gmpz_powm(tmp, a, tmp, n); is_prime = (__builtin_constant_p(1) && (1) == 0 ? ((tmp)->_mp_size < 0 ? -1 : (tmp)->_mp_size > 0) : __gmpz_cmp_ui(tmp, 1)) != 0; } } else { is_prime = (r == 25 - 1); } if (is_prime) goto ret1; __gmpz_add_ui(a, a, primes_diff[r]); if (!mp_millerrabin(n, nm1, a, tmp, q, k)) { is_prime = 0; goto ret1; } } error(0, 0, gettext("Lucas prime test failure. This should not happen")); abort(); ret1: if (flag_prove_primality) mp_factor_clear(&factors); ret2: __gmpz_clears(q, a, nm1, tmp, ((void *)0)); return is_prime; }
long long mp_prime_p(unsigned long long a0, unsigned long a1, unsigned long long a2) { char v0; unsigned int v1; void *v2; unsigned long v3; char v4; char v5; char v6; char v7; char v8; char v9; unsigned long long v11; if (__gmpz_cmp_ui(a0, 0x1, a2) <= 0) { v11 = 0; return v11; } else if (__gmpz_cmp_ui(a0, 0x17ded79, a2) >= 0) { __gmpz_inits(&v6, &v7, &v8, &v9, 0x0); __gmpz_sub_ui(&v8, a0, 0x1, a0); v3 = __gmpz_scan1(&v8, 0x0); __gmpz_tdiv_q_2exp(&v6, &v8, v3, &v8); __gmpz_set_ui(&v7, 0x2); if ((mp_millerrabin(a0, &v8, &v7, &v9, &v6, v3) ^ 1)) { v0 = 0; } else { if (flag_prove_primality) { __gmpz_set(&v9, &v8, &v8, &v9); mp_factor(&v9, &v4, &v4); } v1 = 0; while (true) { if (v1 > 667) { error(0x0, 0x0, gettext("Lucas prime test failure. This should not happen")); abort(); } if (!flag_prove_primality) { v0 = v1 == 24; } else { v0 = 1; for (v2 = 0; v2 < *(&v5) && v0; v2 += 1) { __gmpz_divexact(&v9, &v8, v2 * 16 + *(&v4), &v8); __gmpz_powm(&v9, &v7, &v9, a0); v0 = __gmpz_cmp_ui(&v9, 0x1, &v9); } } if (v0) break; __gmpz_add_ui(&v7, &v7, *(v1 + &primes_diff), &v7); if (!(mp_millerrabin(a0, &v8, &v7, &v9, &v6, v3) ^ 1)) { v1 += 1; } else { v0 = 0; break; } } if (flag_prove_primality) mp_factor_clear(&v4); } __gmpz_clears(&v6, &v7, &v8, &v9, 0x0); v11 = v0; return v11; } else { v11 = 1; return v11; } }
coreutils
angr_sailr
static int tunnel_mode_is_ipv6(char *tunnel_mode) { static const char *const ipv6_modes[] = { "ipv6/ipv6", "ip6ip6", "vti6", "ip/ipv6", "ipv4/ipv6", "ipip6", "ip4ip6", "ip6gre", "gre/ipv6", "any/ipv6", "any"}; int i; for (i = 0; i < (sizeof(ipv6_modes) / sizeof((ipv6_modes)[0])); i++) { if (strcmp(ipv6_modes[i], tunnel_mode) == 0) return 1; } return 0; }
int tunnel_mode_is_ipv6(char *a0) { unsigned int v0; unsigned int v2; v0 = 0; while (true) { if (v0 > 10) { v2 = 0; return v2; } else if (strcmp(ipv6_modes.8832 [v0], a0)) { v0 += 1; } else { v2 = 1; return v2; } } }
iproute2-6.0.0
angr_sailr
static char *history_backupfile(const char *filename) { const char *fn; char *ret, linkbuf[4096 + 1]; size_t len; ssize_t n; struct stat fs; fn = filename; if ((n = readlink(filename, linkbuf, sizeof(linkbuf) - 1)) > 0) { linkbuf[n] = '\0'; fn = linkbuf; } len = strlen(fn); ret = xmalloc(len + 2); strcpy(ret, fn); ret[len] = '-'; ret[len + 1] = '\0'; return ret; }
long long history_backupfile(char *a0) { char *v0; char *v1; char *v2; char *v3; char v4; unsigned long long v5; v5 = *(&v5); v0 = a0; v1 = readlink(a0, &v4, 0x1000); if (v1 > 0) { *((v1 + &v4)) = 0; v0 = &v4; } v2 = strlen(v0); v3 = xmalloc(v2 + 2); strcpy(v3, v0); *((v2 + v3)) = 45; *((v3 + v2 + 1)) = 0; return v3; }
bash
angr_phoenix
off_t seek_archive(off_t size) { off_t start = current_block_ordinal(); off_t offset; off_t nrec, nblk; off_t skipped = (blocking_factor - (current_block - record_start)) * 512; if (size <= skipped) return 0; nrec = (size - skipped) / record_size; if (nrec == 0) return 0; offset = (((archive) >= (1 << 30)) ? rmt_lseek__(archive - (1 << 30), nrec * record_size, 1) : lseek(archive, nrec * record_size, 1)); if (offset < 0) return offset; if (offset % record_size) do { if (error_hook) error_hook(); error(0, 0, gettext("rmtlseek not stopped at a record boundary")); fatal_exit(); } while (0); offset /= 512; nblk = offset - start; records_read += nblk / blocking_factor; record_start_block = offset - blocking_factor; current_block = record_end; return nblk; }
__off_t seek_archive(long a1) { __off_t result; char *v2; long v3; long v4; unsigned long v5; __off_t v6; v3 = current_block_ordinal(); v4 = (blocking_factor - ((current_block - (long)record_start) >> 9)) << 9; if (a1 <= v4) return 0LL; v5 = (unsigned long)(a1 - v4) / record_size; if (!v5) return 0LL; if (archive <= 0x3FFFFFFF) result = lseek(archive, v5 * record_size, 1); else result = rmt_lseek__((unsigned int)(archive - 0x40000000), v5 * record_size, 1LL); v6 = result; if (result >= 0) { if ((unsigned long)result % record_size) { if (error_hook) error_hook(); v2 = gettext("rmtlseek not stopped at a record boundary"); error(0, 0, v2); fatal_exit(); } records_read += (v6 / 512 - v3) / blocking_factor; record_start_block = v6 / 512 - blocking_factor; current_block = (long)record_end; return v6 / 512 - v3; } return result; }
tar
ida
static float getrate(const struct predicate *p) { if (p) return p->est_success_rate; else return 1.0f; }
void getrate(unsigned long long a0) { unsigned long long v1; if (a0) v1 = a0; return; }
findutils
angr_dream
static void uint32_divmod_uint14(crypto_uint32 *q, crypto_uint16 *r, crypto_uint32 x, crypto_uint16 m) { crypto_uint32 v = 0x80000000; crypto_uint32 qpart; crypto_uint32 mask; v /= m; *q = 0; qpart = (x * (crypto_uint64)v) >> 31; x -= qpart * m; *q += qpart; qpart = (x * (crypto_uint64)v) >> 31; x -= qpart * m; *q += qpart; x -= m; *q += 1; mask = -(x >> 31); x += mask & (crypto_uint32)m; *q += mask; *r = x; }
void uint32_divmod_uint14(unsigned int *a0, unsigned short *a1, unsigned long a2, unsigned long a3) { unsigned int v0; unsigned int *v1; unsigned int v2; unsigned int v3; unsigned int v4; char v5; unsigned short *v7; unsigned long long v8; v1 = a0; v0 = a2; v2 = 0x80000000; v2 = (0 CONCAT v2) / m a3; *(a0) = 0; v3 = v0 * v2 >> 31; v0 -= v3 * a3; *(a0) = *(a0) + v3; v3 = v0 * v2 >> 31; v0 -= v3 * a3; *(a0) = *(a0) + v3; v0 -= a3; *(a0) = *(a0) + 1; v4 = v0 >> 31; v0 += a3 & v4; *(a0) = *(a0) + v4; v7 = a1; *(a1) = v0; v8 = *(&v5); return; }
openssh-portable
angr_sailr
static intmax_t eval_arith_for_expr(l, okp) WORD_LIST *l; int *okp; { WORD_LIST *new; intmax_t expresult; int r, eflag; char *expr, *temp; expr = l->next ? string_list(l) : l->word->word; temp = expand_arith_string(expr, 0x001 | 0x100); if (l->next) sh_xfree((expr), "execute_cmd.c", 3051); new = make_word_list(make_word(temp), (WORD_LIST *)((void *)0)); sh_xfree((temp), "execute_cmd.c", 3053); if (new) { if (echo_command_at_execute) xtrace_print_arith_cmd(new); command_string_index = 0; print_arith_command(new); if (signal_in_progress((64 + 1)) == 0 && running_trap == 0) { do { if (the_printed_command_except_trap) sh_xfree((the_printed_command_except_trap), "execute_cmd.c", 3064); } while (0); the_printed_command_except_trap = (char *)strcpy( sh_xmalloc((1 + strlen(the_printed_command)), "execute_cmd.c", 3065), (the_printed_command)); } r = run_debug_trap(); eflag = (shell_compatibility_level > 51) ? 0 : 0x01; this_command_name = "(("; if (debugging_mode == 0 || r == 0) expresult = evalexp(new->word->word, eflag, okp); else { expresult = 0; if (okp) *okp = 1; } dispose_words(new); } else { expresult = 0; if (okp) *okp = 1; } return (expresult); }
long eval_arith_for_expr(long a1, _DWORD *a2) { long v2; long word; size_t v4; const char *v5; char *v6; int v9; long v10; long v11; long v12; long word_list; if (*(_QWORD *)a1) v2 = string_list(a1); else v2 = **(_QWORD **)(a1 + 8); v11 = v2; v12 = expand_arith_string(v2, 257LL); if (*(_QWORD *)a1) sh_xfree(v11, "execute_cmd.c", 3051LL); word = make_word(v12); word_list = make_word_list(word, 0LL); sh_xfree(v12, "execute_cmd.c", 3053LL); if (word_list) { if (echo_command_at_execute) xtrace_print_arith_cmd(word_list); command_string_index = 0; print_arith_command(word_list); if (!(unsigned int)signal_in_progress(65LL) && !running_trap) { if (the_printed_command_except_trap) sh_xfree(the_printed_command_except_trap, "execute_cmd.c", 3064LL); v4 = strlen(the_printed_command); v5 = the_printed_command; v6 = (char *)sh_xmalloc(v4 + 1, "execute_cmd.c", 3065LL); the_printed_command_except_trap = strcpy(v6, v5); } v9 = run_debug_trap(); this_command_name = (long)"(("; if (debugging_mode && v9) { v10 = 0LL; if (a2) *a2 = 1; } else { v10 = evalexp(**(_QWORD **)(word_list + 8), shell_compatibility_level <= 51, a2); } dispose_words(word_list); } else { v10 = 0LL; if (a2) *a2 = 1; } return v10; }
bash
ida
int check_quietlogin(Session *s, const char *command) { char buf[256]; struct passwd *pw = s->pw; struct stat st; if (command != ((void *)0)) return 1; snprintf(buf, sizeof(buf), "%.200s/.hushlogin", pw->pw_dir); if (stat(buf, &st) >= 0) return 1; return 0; }
int check_quietlogin(struct_0 *a0, unsigned long a1) { struct_1 *v0; char v1; char v2; unsigned int v4; v0 = a0->field_10; if (a1) { v4 = 1; return v4; } snprintf(&v2, 0x100, "%.200s/.hushlogin", v0->field_20); v4 = (stat(&v2, &v1) < 0 ? 1 : 0); return v4; }
openssh-portable
angr_sailr
int validate_inherited_value(var, type) SHELL_VAR *var; int type; { if (type == 0x0000004 && ((((var)->attributes) & (0x0000040)))) return 0; else if (type == 0x0000040 && ((((var)->attributes) & (0x0000004)))) return 0; else return 1; }
long long validate_inherited_value(struct_0 *a0, unsigned long a1) { unsigned long long v1; if (a1 == 4 && (a0->field_28 & 64)) v1 = 0; if (!(a0->field_28 & 64) || a1 != 4) { if (a1 == 64 && (a0->field_28 & 4)) v1 = 0; if (!(a0->field_28 & 4) || a1 != 64) v1 = 1; } return v1; }
bash
angr_dream
char *array_to_assign(a, quoted) ARRAY *a; int quoted; { char *result, *valstr, *is; char indstr[(((sizeof(intmax_t) * 8) - (!((intmax_t)0 < (intmax_t)-1))) * 302 / 1000 + 1 + (!((intmax_t)0 < (intmax_t)-1))) + 1]; ARRAY_ELEMENT *ae; int rsize, rlen, elen; if (a == 0 || ((a)->num_elements == 0)) return ((char *)((void *)0)); result = (char *)sh_xmalloc((rsize = 128), "array.c", 1018); result[0] = '('; rlen = 1; for (ae = ((a->head)->next); ae != a->head; ae = ((ae)->next)) { is = inttostr(((ae)->ind), indstr, sizeof(indstr)); valstr = ((ae)->value) ? (ansic_shouldquote(((ae)->value)) ? ansic_quote(((ae)->value), 0, (int *)0) : sh_double_quote(((ae)->value))) : (char *)((void *)0); elen = (((is) && (is)[0]) ? ((is)[1] ? ((is)[2] ? strlen(is) : 2) : 1) : 0) + 8 + (((valstr) && (valstr)[0]) ? ((valstr)[1] ? ((valstr)[2] ? strlen(valstr) : 2) : 1) : 0); do { if ((rlen) + ((elen + 1)) >= rsize) { while ((rlen) + ((elen + 1)) >= rsize) rsize += (rsize); result = sh_xrealloc((result), (rsize), "array.c", 1030); } } while (0); result[rlen++] = '['; strcpy(result + rlen, is); rlen += (((is) && (is)[0]) ? ((is)[1] ? ((is)[2] ? strlen(is) : 2) : 1) : 0); result[rlen++] = ']'; result[rlen++] = '='; if (valstr) { strcpy(result + rlen, valstr); rlen += (((valstr) && (valstr)[0]) ? ((valstr)[1] ? ((valstr)[2] ? strlen(valstr) : 2) : 1) : 0); } if (((ae)->next) != a->head) result[rlen++] = ' '; do { if (valstr) sh_xfree((valstr), "array.c", 1045); } while (0); } do { if ((rlen) + (1) >= rsize) { while ((rlen) + (1) >= rsize) rsize += (8); result = sh_xrealloc((result), (rsize), "array.c", 1047); } } while (0); result[rlen++] = ')'; result[rlen] = '\0'; if (quoted) { valstr = sh_single_quote(result); sh_xfree((result), "array.c", 1053); result = valstr; } return (result); }
long long array_to_assign(struct_0 *a0, unsigned long a1) { unsigned int v0; int tmp_18; int tmp_42; int tmp_61; int tmp_10; int tmp_20; unsigned int v1; unsigned int v2; void *v3; unsigned long long v4[3]; void *v5; char v6[3]; char v7; void *v9; void *v10; unsigned long long v12; unsigned long v13; if (a0 && a0->field_8) { v0 = 128; v3 = sh_xmalloc(0x80, "array.c", 0x3fa); *(v3) = 40; v1 = 1; for (v4[0] = a0->field_10->field_10; v4 != a0->field_10; v4[0] = v4[2]) { *(&v6) = inttostr(v4[0], &v7, 0x16, &v7); if (!v4[1]) { v10 = 0; } else if (ansic_shouldquote(v4[1])) { v10 = ansic_quote(v4[1], 0x0, 0x0); } else { v10 = sh_double_quote(v4[1]); } v5 = v10; if (v6 && v6[0]) { if (!v6[1]) { v12 = 9; } else if (v6[2]) { v12 = strlen(v6) + 8; } else { v12 = 10; } } if (!v6[0] || !v6) v12 = 8; if (v5 && *(v5)) { if (!v5[1]) { v13 = 1; } else if (v5[2]) { v13 = strlen(v5); } else { v13 = 2; } } if (!*(v5) || !v5) v13 = 0; if (v0 <= v1 + v2 + 1) { for (v2 = v13 + v12; v0 <= v1 + v2 + 1; v0 *= 2) ; v3 = sh_xrealloc(v3, v0, "array.c", 0x406); } tmp_18 = v1; v1 += 1; *(v3 + tmp_18) = 91; strcpy(v1 + v3, v6); if (v6 && v6[0]) { if (!v6[1]) { *(&v13) = 1; } else if (v6[2]) { v13 = strlen(v6); } else { *(&v13) = 2; } } if (!v6 || !v6[0]) *(&v13) = 0; v1 = v13 + v1; tmp_42 = v1; v1 += 1; *(v3 + tmp_42) = 93; tmp_61 = v1; v1 += 1; *(v3 + tmp_61) = 61; if (v5) { strcpy(v1 + v3, v5); if (v5 && *(v5)) { if (!v5[1]) { *(&v13) = 1; } else if (v5[2]) { v13 = strlen(v5); } else { *(&v13) = 2; } } if (!*(v5) || !v5) *(&v13) = 0; *(&v13) = v13 + v1; v1 = v13; } if (v4[2] != a0->field_10) { tmp_10 = v1; v1 += 1; *(v3 + tmp_10) = 32; } if (v5) sh_xfree(v5, "array.c", 0x415); } if (v0 <= v1 + 1) { for (; v0 <= v1 + 1; v0 += 8) ; v3 = sh_xrealloc(v3, v0, "array.c", 0x417); } tmp_20 = v1; v1 += 1; *(v3 + tmp_20) = 41; *(v3 + v1) = 0; if (a1) { v5 = sh_single_quote(v3); sh_xfree(v3, "array.c", 0x41d); v3 = v5; } v9 = v3; } if (!a0 || !a0->field_8) v9 = 0; return v9; }
bash
angr_dream
int gname_to_gid(char const *gname, gid_t *gidp) { struct group *group; if (cached_no_such_gname && strcmp(gname, cached_no_such_gname) == 0) return 0; if (!cached_gname || gname[0] != cached_gname[0] || strcmp(gname, cached_gname) != 0) { group = getgrnam(gname); if (group) { cached_gid = group->gr_gid; assign_string(&cached_gname, gname); } else { assign_string(&cached_no_such_gname, gname); return 0; } } *gidp = cached_gid; return 1; }
long long gname_to_gid(char *a0, unsigned int *a1) { struct_0 *v0; unsigned long long v2; if (cached_no_such_gname && !strcmp(a0, cached_no_such_gname)) { v2 = 0; goto LABEL_400925; } if (cached_gname && *(a0) == *(cached_gname) && !strcmp(a0, cached_gname)) goto LABEL_400914; v0 = &getgrnam(a0)->gr_name; if (!v0) { assign_string(&cached_no_such_gname, a0); v2 = 0; goto LABEL_400925; } else { cached_gid = v0->field_10; assign_string(&cached_gname, a0); } LABEL_400914: *(a1) = cached_gid; v2 = 1; LABEL_400925: return v2; }
tar
angr_phoenix
static void close_output_file(void) { if (output_stream) { if (ferror_unlocked(output_stream)) { error(0, 0, gettext("write error for %s"), quotearg_style(shell_escape_always_quoting_style, output_filename)); output_stream = ((void *)0); cleanup_fatal(); } if (rpl_fclose(output_stream) != 0) { error(0, (*__errno_location()), "%s", quotearg_n_style_colon(0, shell_escape_quoting_style, output_filename)); output_stream = ((void *)0); cleanup_fatal(); } if (bytes_written == 0 && elide_empty_files) { sigset_t oldset; _Bool unlink_ok; int unlink_errno; sigprocmask(0, &caught_signals, &oldset); unlink_ok = (unlink(output_filename) == 0); unlink_errno = (*__errno_location()); files_created--; sigprocmask(2, &oldset, ((void *)0)); if (!unlink_ok && unlink_errno != 2) error(0, unlink_errno, "%s", quotearg_n_style_colon(0, shell_escape_quoting_style, output_filename)); } else { if (!suppress_count) { char buf[((((((sizeof(intmax_t) * 8) - (!((__typeof__(intmax_t))0 < (__typeof__(intmax_t))-1))) * 146 + 484) / 485) + (!((__typeof__(intmax_t))0 < (__typeof__(intmax_t))-1))) + 1)]; fprintf(stdout, "%s\n", imaxtostr(bytes_written, buf)); } } output_stream = ((void *)0); } }
unsigned long close_output_file() { long v0; char *v1; const char *v2; int *v3; const char *v4; const char *v5; bool v7; int errnum; sigset_t oset; char v10[24]; unsigned long v11; v11 = __readfsqword(0x28u); if (output_stream) { if (ferror_unlocked(output_stream)) { v0 = quotearg_style(4LL, output_filename); v1 = gettext("write error for %s"); error(0, 0, v1, v0); output_stream = 0LL; cleanup_fatal(); } if ((unsigned int)rpl_fclose(output_stream)) { v2 = (const char *)quotearg_n_style_colon(0LL, 3LL, output_filename); v3 = _errno_location(); error(0, *v3, "%s", v2); output_stream = 0LL; cleanup_fatal(); } if (bytes_written || !elide_empty_files) { if (suppress_count != 1) { v5 = (const char *)imaxtostr(bytes_written, v10); fprintf(stdout, "%s\n", v5); } } else { sigprocmask(0, &caught_signals, &oset); v7 = unlink(output_filename) == 0; errnum = *_errno_location(); --files_created; sigprocmask(2, &oset, 0LL); if (!v7 && errnum != 2) { v4 = (const char *)quotearg_n_style_colon(0LL, 3LL, output_filename); error(0, errnum, "%s", v4); } } output_stream = 0LL; } return __readfsqword(0x28u) ^ v11; }
coreutils
ida
static void print_login(const STRUCT_UTMP *utmp_ent) { char *comment = make_id_equals_comment(utmp_ent); char pidstr[(((((sizeof(utmp_ent->ut_pid) * 8) - (!((__typeof__(utmp_ent->ut_pid))0 < (__typeof__(utmp_ent->ut_pid))-1))) * 146 + 484) / 485) + (!((__typeof__(utmp_ent->ut_pid))0 < (__typeof__(utmp_ent->ut_pid))-1))) + 1]; sprintf(pidstr, "%ld", (long int)(utmp_ent->ut_pid)); print_line(-1, gettext("LOGIN"), ' ', sizeof utmp_ent->ut_line, utmp_ent->ut_line, time_string(utmp_ent), "", pidstr, comment, ""); free(comment); }
void print_login(struct_0 *a0) { unsigned long v0; char v1; char v2; unsigned long long *v4; unsigned long long v5; v0 = make_id_equals_comment(a0); sprintf(&v1, "%ld", a0->field_4); print_line(0xffffffff, gettext("LOGIN"), 0x20, 0x20, a0 + 1, time_string(a0), &g_401de3, &v1, v0, &g_401de3); free(v0); v5 = *(&v2) ^ v4[5]; return; }
coreutils
angr_phoenix
static Bool isempty_RL(EState *s) { if (s->state_in_ch < 256 && s->state_in_len > 0) return ((Bool)0); else return ((Bool)1); }
undefined8 isempty_RL(long param_1) { undefined8 uVar1; if ((*(uint *)(param_1 + 0x5c) < 0x100) && (0 < *(int *)(param_1 + 0x60))) { uVar1 = 0; } else { uVar1 = 1; } return uVar1; }
bzip2
ghidra
void monitor_child_preauth(struct ssh *ssh, struct monitor *pmonitor) { struct mon_table *ent; int authenticated = 0, partial = 0; sshlog("monitor.c", __func__, 275, 0, SYSLOG_LEVEL_DEBUG3, ((void *)0), "preauth child monitor started"); if (pmonitor->m_recvfd >= 0) close(pmonitor->m_recvfd); if (pmonitor->m_log_sendfd >= 0) close(pmonitor->m_log_sendfd); pmonitor->m_log_sendfd = pmonitor->m_recvfd = -1; authctxt = (Authctxt *)ssh->authctxt; memset(authctxt, 0, sizeof(*authctxt)); ssh->authctxt = authctxt; authctxt->loginmsg = loginmsg; mon_dispatch = mon_dispatch_proto20; monitor_permit(mon_dispatch, MONITOR_REQ_MODULI, 1); monitor_permit(mon_dispatch, MONITOR_REQ_SIGN, 1); while (!authenticated) { partial = 0; auth_method = "unknown"; auth_submethod = ((void *)0); auth2_authctxt_reset_info(authctxt); authenticated = (monitor_read(ssh, pmonitor, mon_dispatch, &ent) == 1); if (options.num_auth_methods != 0) { if (authenticated && !auth2_update_methods_lists(authctxt, auth_method, auth_submethod)) { sshlog("monitor.c", __func__, 309, 1, SYSLOG_LEVEL_DEBUG3, ((void *)0), "method %s: partial", auth_method); authenticated = 0; partial = 1; } } if (authenticated) { if (!(ent->flags & 0x0008)) sshfatal("monitor.c", __func__, 317, 1, SYSLOG_LEVEL_FATAL, ((void *)0), "unexpected authentication from %d", ent->type); if (authctxt->pw->pw_uid == 0 && !auth_root_allowed(ssh, auth_method)) authenticated = 0; } if (ent->flags & (0x0008 | 0x0020)) { auth_log(ssh, authenticated, partial, auth_method, auth_submethod); if (!partial && !authenticated) authctxt->failures++; if (authenticated || partial) { auth2_update_session_info(authctxt, auth_method, auth_submethod); } } } if (!authctxt->valid) sshfatal("monitor.c", __func__, 351, 1, SYSLOG_LEVEL_FATAL, ((void *)0), "authenticated invalid user"); if (strcmp(auth_method, "unknown") == 0) sshfatal("monitor.c", __func__, 353, 1, SYSLOG_LEVEL_FATAL, ((void *)0), "authentication method name unknown"); sshlog("monitor.c", __func__, 355, 1, SYSLOG_LEVEL_DEBUG1, ((void *)0), "user %s authenticated by privileged process", authctxt->user); ssh->authctxt = ((void *)0); ssh_packet_set_log_preamble(ssh, "user %s", authctxt->user); mm_get_keystate(ssh, pmonitor); while (pmonitor->m_log_recvfd != -1 && monitor_read_log(pmonitor) == 0) ; if (pmonitor->m_recvfd >= 0) close(pmonitor->m_recvfd); if (pmonitor->m_log_sendfd >= 0) close(pmonitor->m_log_sendfd); pmonitor->m_sendfd = pmonitor->m_log_recvfd = -1; }
void monitor_child_preauth(long param_1, int *param_2) { void *pvVar1; undefined4 uVar2; int iVar3; long in_FS_OFFSET; bool bVar4; undefined *puVar5; undefined8 uVar6; int local_2c; undefined4 *local_28; long local_20; local_20 = *(long *)(in_FS_OFFSET + 0x28); bVar4 = false; sshlog("monitor.c", "monitor_child_preauth", 0x113, 0, 7, 0, "preauth child monitor started"); if (-1 < *param_2) { close(*param_2); } if (-1 < param_2[3]) { close(param_2[3]); } *param_2 = -1; param_2[3] = *param_2; authctxt = *(void **)(param_1 + 0x860); memset(authctxt, 0, 0x90); *(void **)(param_1 + 0x860) = authctxt; *(undefined8 *)((long)authctxt + 0x60) = loginmsg; mon_dispatch = mon_dispatch_proto20; monitor_permit(mon_dispatch_proto20, 0, 1); puVar5 = (undefined *)0x100221; monitor_permit(mon_dispatch, 6, 1); while (bVar4 == false) { local_2c = 0; auth_method = s_unknown_00105dc0; auth_submethod = 0; auth2_authctxt_reset_info(authctxt); puVar5 = (undefined *)0x100270; iVar3 = monitor_read(param_1, param_2, mon_dispatch, &local_28); bVar4 = iVar3 == 1; if ((_DAT_00109ed0 != 0) && (bVar4)) { puVar5 = (undefined *)0x1002ac; iVar3 = auth2_update_methods_lists(authctxt, auth_method, auth_submethod); if (iVar3 == 0) { puVar5 = auth_method; sshlog("monitor.c", "monitor_child_preauth", 0x135, 1, 7, 0, "method %s: partial", auth_method); bVar4 = false; local_2c = 1; } } if (bVar4 != false) { if ((local_28[1] & 8) == 0) { sshfatal("monitor.c", "monitor_child_preauth", 0x13d, 1, 1, 0, "unexpected authentication from %d", *local_28); } if (*(int *)(*(long *)((long)authctxt + 0x30) + 0x10) == 0) { puVar5 = (undefined *)0x100379; iVar3 = auth_root_allowed(param_1, auth_method); if (iVar3 == 0) { bVar4 = false; } } } if ((local_28[1] & 0x28) != 0) { puVar5 = (undefined *)0x1003b5; auth_log(param_1, bVar4, local_2c, auth_method, auth_submethod); pvVar1 = authctxt; if ((local_2c == 0) && (bVar4 == false)) { puVar5 = (undefined *)0x1003d7; uVar2 = __addvsi3(*(undefined4 *)((long)authctxt + 0x14), 1); *(undefined4 *)((long)pvVar1 + 0x14) = uVar2; } if ((bVar4 != false) || (local_2c != 0)) { puVar5 = (undefined *)0x100406; auth2_update_session_info(authctxt, auth_method, auth_submethod); } } } if (*(int *)((long)authctxt + 0xc) == 0) { sshfatal("monitor.c", "monitor_child_preauth", 0x15f, 1, 1, 0, "authenticated invalid user", puVar5); } uVar6 = 0x10046e; iVar3 = strcmp(auth_method, "unknown"); if (iVar3 == 0) { sshfatal("monitor.c", "monitor_child_preauth", 0x161, 1, 1, 0, "authentication method name unknown", uVar6); } sshlog("monitor.c", "monitor_child_preauth", 0x163, 1, 5, 0, "user %s authenticated by privileged process", *(undefined8 *)((long)authctxt + 0x20)); *(undefined8 *)(param_1 + 0x860) = 0; ssh_packet_set_log_preamble(param_1, "user %s", *(undefined8 *)((long)authctxt + 0x20)); mm_get_keystate(param_1, param_2); do { if (param_2[2] == -1) break; iVar3 = monitor_read_log(); } while (iVar3 == 0); if (-1 < *param_2) { close(*param_2); } if (-1 < param_2[3]) { close(param_2[3]); } param_2[2] = -1; param_2[1] = param_2[2]; if (local_20 != *(long *)(in_FS_OFFSET + 0x28)) { __stack_chk_fail(); } return; }
openssh-portable
ghidra
int rl_beg_of_line(int count, int key) { rl_point = 0; return 0; }
void rl_beg_of_line(unsigned long a0, unsigned long a1) { unsigned int v0; unsigned int v1; char v2; void *v4; unsigned long long v5; v1 = a0; v0 = a1; rl_point = 0; v4 = 0; v5 = *(&v2); return; }
bash
angr_sailr
static void open_files(void) { if (pw_lock() == 0) { fprintf(stderr, gettext("%s: cannot lock %s; try again later.\n"), Prog, pw_dbname()); fail_exit(1); } pw_locked = 1; if (is_shadow) { if (spw_lock() == 0) { fprintf(stderr, gettext("%s: cannot lock %s; try again later.\n"), Prog, spw_dbname()); fail_exit(1); } spw_locked = 1; } if (gr_lock() == 0) { fprintf(stderr, gettext("%s: cannot lock %s; try again later.\n"), Prog, gr_dbname()); fail_exit(1); } gr_locked = 1; if (is_shadow_grp) { if (sgr_lock() == 0) { fprintf(stderr, gettext("%s: cannot lock %s; try again later.\n"), Prog, sgr_dbname()); fail_exit(1); } sgr_locked = 1; } if (is_sub_uid) { if (sub_uid_lock() == 0) { fprintf(stderr, gettext("%s: cannot lock %s; try again later.\n"), Prog, sub_uid_dbname()); fail_exit(1); } sub_uid_locked = 1; } if (is_sub_gid) { if (sub_gid_lock() == 0) { fprintf(stderr, gettext("%s: cannot lock %s; try again later.\n"), Prog, sub_gid_dbname()); fail_exit(1); } sub_gid_locked = 1; } if (pw_open(0100 | 02) == 0) { fprintf(stderr, gettext("%s: cannot open %s\n"), Prog, pw_dbname()); fail_exit(1); } if (is_shadow && (spw_open(0100 | 02) == 0)) { fprintf(stderr, gettext("%s: cannot open %s\n"), Prog, spw_dbname()); fail_exit(1); } if (gr_open(0100 | 02) == 0) { fprintf(stderr, gettext("%s: cannot open %s\n"), Prog, gr_dbname()); fail_exit(1); } if (is_shadow_grp && (sgr_open(0100 | 02) == 0)) { fprintf(stderr, gettext("%s: cannot open %s\n"), Prog, sgr_dbname()); fail_exit(1); } if (is_sub_uid) { if (sub_uid_open(0100 | 02) == 0) { fprintf(stderr, gettext("%s: cannot open %s\n"), Prog, sub_uid_dbname()); fail_exit(1); } } if (is_sub_gid) { if (sub_gid_open(0100 | 02) == 0) { fprintf(stderr, gettext("%s: cannot open %s\n"), Prog, sub_gid_dbname()); fail_exit(1); } } }
void open_files() { unsigned long long v1; unsigned long long 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 v13; unsigned long long v14; if (!pw_lock()) { v1 = pw_dbname(); fprintf(*(&stderr), gettext("%s: cannot lock %s; try again later.\n")); fail_exit(0x1); } pw_locked = 1; if (is_shadow) { if (spw_lock()) { spw_locked = 1; } else { v2 = spw_dbname(); fprintf(*(&stderr), gettext("%s: cannot lock %s; try again later.\n")); fail_exit(0x1); } } if (!gr_lock()) { v3 = gr_dbname(); fprintf(*(&stderr), gettext("%s: cannot lock %s; try again later.\n")); fail_exit(0x1); } gr_locked = 1; if (is_shadow_grp) { if (sgr_lock()) { sgr_locked = 1; } else { v4 = sgr_dbname(); fprintf(*(&stderr), gettext("%s: cannot lock %s; try again later.\n")); fail_exit(0x1); } } if (is_sub_uid) { if (sub_uid_lock()) { sub_uid_locked = 1; } else { v5 = sub_uid_dbname(); fprintf(*(&stderr), gettext("%s: cannot lock %s; try again later.\n")); fail_exit(0x1); } } if (is_sub_gid) { if (sub_gid_lock()) { sub_gid_locked = 1; } else { v6 = sub_gid_dbname(); fprintf(*(&stderr), gettext("%s: cannot lock %s; try again later.\n")); fail_exit(0x1); } } if (!pw_open(0x42)) { v7 = pw_dbname(); fprintf(*(&stderr), gettext("%s: cannot open %s\n")); fail_exit(0x1); } if (is_shadow && !spw_open(0x42)) { v8 = spw_dbname(); fprintf(*(&stderr), gettext("%s: cannot open %s\n")); fail_exit(0x1); } if (!gr_open(0x42)) { v9 = gr_dbname(); fprintf(*(&stderr), gettext("%s: cannot open %s\n")); fail_exit(0x1); } if (is_shadow_grp && !sgr_open(0x42)) { v10 = sgr_dbname(); fprintf(*(&stderr), gettext("%s: cannot open %s\n")); fail_exit(0x1); } if (is_sub_uid && !sub_uid_open(0x42)) { v13 = sub_uid_dbname(); fprintf(*(&stderr), gettext("%s: cannot open %s\n")); fail_exit(0x1); } v11 = is_sub_gid; if (is_sub_gid && !sub_gid_open(0x42)) { v14 = sub_gid_dbname(); fprintf(*(&stderr), gettext("%s: cannot open %s\n")); fail_exit(0x1); } return; }
shadow
angr_phoenix
int umac_delete(struct umac_ctx *ctx) { if (ctx) { if (16) ctx = (struct umac_ctx *)ctx->free_ptr; freezero(ctx, sizeof(*ctx) + 16); } return (1); }
long long umac_delete(unsigned long a0) { struct_0 *v0; v0 = a0; if (v0) { v0 = v0->field_5f0; freezero(v0, 0x608); } return 1; }
openssh-portable
angr_dream
static int is_posix_builtin(name) char *name; { return (_find_in_table(name, posix_builtins)); }
int is_posix_builtin(unsigned long long a0) { return _find_in_table(a0, &posix_builtins); }
bash
angr_phoenix
inline int lchownat(int fd, char const *file, uid_t owner, gid_t group) { return fchownat(fd, file, owner, group, 0x100); }
void lchownat(void) { halt_baddata(); }
coreutils
ghidra
static int ipstats_stat_desc_show_cpu_hit(struct ipstats_stat_show_attrs *attrs, const struct ipstats_stat_desc *desc) { print_nl(); return ipstats_show_64(attrs, IFLA_STATS_LINK_OFFLOAD_XSTATS, IFLA_OFFLOAD_XSTATS_CPU_HIT); }
void ipstats_stat_desc_show_cpu_hit(undefined8 param_1) { print_nl(); ipstats_show_64(param_1, 4, 1); return; }
iproute2-6.0.0
ghidra
int kex_dh_enc(struct kex *kex, const struct sshbuf *client_blob, struct sshbuf **server_blobp, struct sshbuf **shared_secretp) { const BIGNUM *pub_key; struct sshbuf *server_blob = ((void *)0); int r; *server_blobp = ((void *)0); *shared_secretp = ((void *)0); if ((r = kex_dh_keygen(kex)) != 0) goto out; DH_get0_key(kex->dh, &pub_key, ((void *)0)); if ((server_blob = sshbuf_new()) == ((void *)0)) { r = -2; goto out; } if ((r = sshbuf_put_bignum2(server_blob, pub_key)) != 0 || (r = sshbuf_get_u32(server_blob, ((void *)0))) != 0) goto out; if ((r = kex_dh_dec(kex, client_blob, shared_secretp)) != 0) goto out; *server_blobp = server_blob; server_blob = ((void *)0); out: DH_free(kex->dh); kex->dh = ((void *)0); sshbuf_free(server_blob); return r; }
int kex_dh_enc(long param_1, undefined8 param_2, long *param_3, undefined8 *param_4) { long in_FS_OFFSET; int local_24; undefined8 local_20; long local_18; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); local_18 = 0; *param_3 = 0; *param_4 = 0; local_24 = kex_dh_keygen(param_1); if (local_24 == 0) { DH_get0_key(*(undefined8 *)(param_1 + 0x118), &local_20, 0); local_18 = sshbuf_new(); if (local_18 == 0) { local_24 = -2; } else { local_24 = sshbuf_put_bignum2(local_18, local_20); if (((local_24 == 0) && (local_24 = sshbuf_get_u32(local_18, 0), local_24 == 0)) && (local_24 = kex_dh_dec(param_1, param_2, param_4), local_24 == 0)) { *param_3 = local_18; local_18 = 0; } } } DH_free(*(DH **)(param_1 + 0x118)); *(undefined8 *)(param_1 + 0x118) = 0; sshbuf_free(local_18); if (local_10 == *(long *)(in_FS_OFFSET + 0x28)) { return local_24; } __stack_chk_fail(); }
openssh-portable
ghidra
int _rl_vi_domove_callback(_rl_vimotion_cxt *m) { int c, r; m->motion = c = rl_vi_domove_getchar(m); if (c < 0) return 1; r = rl_domove_read_callback(m); return ((r == 0) ? r : 1); }
long long _rl_vi_domove_callback(struct_0 *a0, unsigned int a1, unsigned long a2, unsigned long long a3, unsigned long long a4, unsigned long long a5) { unsigned int v0; unsigned int v1; unsigned long long v3; v0 = rl_vi_domove_getchar(a0); a0->field_20 = v0; if (v0 < 0) { v3 = 1; } else { v1 = rl_domove_read_callback(a0, a1, v0, a3, a4, a5); v3 = v1; } return v3; }
bash
angr_dream
void cfree(mem) void *mem; { internal_cfree(mem, (char *)((void *)0), 0, 0); }
long long cfree(unsigned long a0) { return internal_cfree(a0, 0x0, 0x0, 0x0); }
bash
angr_phoenix
_Bool _rl_print_color_indicator (const char *f) { enum indicator_no colored_filetype; COLOR_EXT_TYPE *ext; size_t len; const char *name; char *filename; struct stat astat, linkstat; mode_t mode; int linkok; int stat_ok; name = f; filename = 0; if (rl_filename_stat_hook) { filename = strcpy((char *)xmalloc(1 + strlen(f)), (f)); (*rl_filename_stat_hook)(&filename); name = filename; } stat_ok = lstat(name, &astat); if (stat_ok == 0) { mode = astat.st_mode; if (((((mode)) & 0170000) == (0120000))) { linkok = stat(name, &linkstat) == 0; if (linkok && strncmp(_rl_color_indicator[C_LINK].string, "target", 6) == 0) mode = linkstat.st_mode; } else linkok = 1; } else linkok = -1; if (linkok == -1 && _rl_color_indicator[C_MISSING].string != ((void *)0)) colored_filetype = C_MISSING; else if (linkok == 0 && _rl_color_indicator[C_ORPHAN].string != ((void *)0)) colored_filetype = C_ORPHAN; else if (stat_ok != 0) { static enum indicator_no filetype_indicator[] = { C_ORPHAN, C_FIFO, C_CHR, C_DIR, C_BLK, C_FILE, C_LINK, C_SOCK, C_FILE, C_DIR}; colored_filetype = filetype_indicator[normal]; } else { if (((((mode)) & 0170000) == (0100000))) { colored_filetype = C_FILE; if ((mode & 04000) != 0 && is_colored(C_SETUID)) colored_filetype = C_SETUID; else if ((mode & 02000) != 0 && is_colored(C_SETGID)) colored_filetype = C_SETGID; else if (is_colored(C_CAP) && 0) colored_filetype = C_CAP; else if ((mode & (0100 | (0100 >> 3) | ((0100 >> 3) >> 3))) != 0 && is_colored(C_EXEC)) colored_filetype = C_EXEC; else if ((1 < astat.st_nlink) && is_colored(C_MULTIHARDLINK)) colored_filetype = C_MULTIHARDLINK; } else if (((((mode)) & 0170000) == (0040000))) { colored_filetype = C_DIR; if ((mode & 01000) && (mode & ((0200 >> 3) >> 3)) && is_colored(C_STICKY_OTHER_WRITABLE)) colored_filetype = C_STICKY_OTHER_WRITABLE; else if ((mode & ((0200 >> 3) >> 3)) != 0 && is_colored(C_OTHER_WRITABLE)) colored_filetype = C_OTHER_WRITABLE; else if ((mode & 01000) != 0 && is_colored(C_STICKY)) colored_filetype = C_STICKY; } else if (((((mode)) & 0170000) == (0120000))) colored_filetype = C_LINK; else if (((((mode)) & 0170000) == (0010000))) colored_filetype = C_FIFO; else if (((((mode)) & 0170000) == (0140000))) colored_filetype = C_SOCK; else if (((((mode)) & 0170000) == (0060000))) colored_filetype = C_BLK; else if (((((mode)) & 0170000) == (0020000))) colored_filetype = C_CHR; else { colored_filetype = C_ORPHAN; } } ext = ((void *)0); if (colored_filetype == C_FILE) { len = strlen(name); name += len; for (ext = _rl_color_ext_list; ext != ((void *)0); ext = ext->next) { if (ext->ext.len <= len && strncmp(name - ext->ext.len, ext->ext.string, ext->ext.len) == 0) break; } } free(filename); { const struct bin_str *const s = ext ? &(ext->seq) : &_rl_color_indicator[colored_filetype]; if (s->string != ((void *)0)) { if (is_colored(C_NORM)) restore_default_color(); _rl_put_indicator(&_rl_color_indicator[C_LEFT]); _rl_put_indicator(s); _rl_put_indicator(&_rl_color_indicator[C_RIGHT]); return 0; } else return 1; } }
undefined8 _rl_print_color_indicator(char *param_1) { char cVar1; int iVar2; int iVar3; size_t sVar4; char *__dest; undefined8 uVar5; long in_FS_OFFSET; uint local_170; uint local_16c; uint local_168; char *local_160; ulong *local_158; char *local_150; size_t local_148; ulong *local_140; stat local_138; stat local_a8; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); local_160 = (char *)0x0; local_150 = param_1; if (rl_filename_stat_hook != (code *)0x0) { sVar4 = strlen(param_1); __dest = (char *)xmalloc(sVar4 + 1); local_160 = strcpy(__dest, param_1); (*rl_filename_stat_hook)(&local_160); local_150 = local_160; } iVar2 = lstat(local_150, &local_138); if (iVar2 == 0) { local_16c = local_138.st_mode; if ((local_138.st_mode & 0xf000) == 0xa000) { iVar3 = stat(local_150, &local_a8); local_168 = (uint)(iVar3 == 0); if ((local_168 != 0) && (iVar3 = strncmp(_DAT_00101088, "target", 6), iVar3 == 0)) { local_16c = local_a8.st_mode; } } else { local_168 = 1; } } else { local_168 = 0xffffffff; } if ((local_168 == 0xffffffff) && (_DAT_001010d8 != 0)) { local_170 = 0xc; } else if ((local_168 == 0) && (_DAT_001010e8 != 0)) { local_170 = 0xd; } else if (iVar2 == 0) { if ((local_16c & 0xf000) == 0x8000) { local_170 = 5; if (((local_16c & 0x800) == 0) || (cVar1 = is_colored(0x10), cVar1 == '\0')) { if (((local_16c & 0x400) == 0) || (cVar1 = is_colored(0x11), cVar1 == '\0')) { is_colored(0x15); if (((local_16c & 0x49) == 0) || (cVar1 = is_colored(0xe), cVar1 == '\0')) { if ((1 < local_138.st_nlink) && (cVar1 = is_colored(0x16), cVar1 != '\0')) { local_170 = 0x16; } } else { local_170 = 0xe; } } else { local_170 = 0x11; } } else { local_170 = 0x10; } } else if ((local_16c & 0xf000) == 0x4000) { local_170 = 6; if ((((local_16c & 0x200) == 0) || ((local_16c & 2) == 0)) || (cVar1 = is_colored(0x14), cVar1 == '\0')) { if (((local_16c & 2) == 0) || (cVar1 = is_colored(0x13), cVar1 == '\0')) { if (((local_16c & 0x200) != 0) && (cVar1 = is_colored(0x12), cVar1 != '\0')) { local_170 = 0x12; } } else { local_170 = 0x13; } } else { local_170 = 0x14; } } else if ((local_16c & 0xf000) == 0xa000) { local_170 = 7; } else if ((local_16c & 0xf000) == 0x1000) { local_170 = 8; } else if ((local_16c & 0xf000) == 0xc000) { local_170 = 9; } else if ((local_16c & 0xf000) == 0x6000) { local_170 = 10; } else if ((local_16c & 0xf000) == 0x2000) { local_170 = 0xb; } else { local_170 = 0xd; } } else { local_170 = filetype_indicator_4832._20_4_; } local_158 = (ulong *)0x0; if (local_170 == 5) { local_148 = strlen(local_150); local_150 = local_150 + local_148; local_158 = _rl_color_ext_list; while ((local_158 != (ulong *)0x0 && ((local_148 < *local_158 || (iVar2 = strncmp(local_150 + -*local_158, (char *)local_158[1], *local_158), iVar2 != 0))))) { local_158 = (ulong *)local_158[4]; } } free(local_160); if (local_158 == (ulong *)0x0) { local_140 = (ulong *)(&_rl_color_indicator + (ulong)local_170 * 0x10); } else { local_140 = local_158 + 2; } if (local_140[1] == 0) { uVar5 = 1; } else { cVar1 = is_colored(4); if (cVar1 != '\0') { restore_default_color(); } _rl_put_indicator(&_rl_color_indicator); _rl_put_indicator(local_140); _rl_put_indicator(strlen); uVar5 = 0; } if (local_10 == *(long *)(in_FS_OFFSET + 0x28)) { return uVar5; } __stack_chk_fail(); }
bash
ghidra
static int count_tags(journal_t *journal, struct buffer_head *bh) { char *tagp; journal_block_tag_t tag; int nr = 0, size = journal->j_blocksize; int tag_bytes = journal_tag_bytes(journal); if (jbd2_journal_has_csum_v2or3(journal)) size -= sizeof(struct jbd2_journal_block_tail); tagp = &bh->b_data[sizeof(journal_header_t)]; while ((tagp - bh->b_data + tag_bytes) <= size) { memcpy(&tag, tagp, sizeof(tag)); nr++; tagp += tag_bytes; if (!(tag.t_flags & ((__be16)ext2fs_swab16((__u16)(2))))) tagp += 16; if (tag.t_flags & ((__be16)ext2fs_swab16((__u16)(8)))) break; } return nr; }
int count_tags(long param_1, long param_2) { ushort uVar1; ushort uVar2; ushort uVar3; int iVar4; int iVar5; long in_FS_OFFSET; int local_44; int local_40; void *local_38; undefined local_2c[6]; ushort local_26; long local_20; local_20 = *(long *)(in_FS_OFFSET + 0x28); local_44 = 0; local_40 = *(int *)(param_1 + 0x78); iVar4 = journal_tag_bytes(param_1); iVar5 = jbd2_journal_has_csum_v2or3(param_1); if (iVar5 != 0) { local_40 = local_40 + -4; } local_38 = (void *)(param_2 + 0x34); do { if ((long)local_40 < (long)local_38 + ((long)iVar4 - (param_2 + 0x28))) break; memcpy(local_2c, local_38, 0xc); uVar3 = local_26; local_44 = local_44 + 1; local_38 = (void *)((long)local_38 + (long)iVar4); uVar2 = ext2fs_swab16(2); uVar1 = local_26; if ((uVar2 & uVar3) == 0) { local_38 = (void *)((long)local_38 + 0x10); } uVar3 = ext2fs_swab16(8); } while ((uVar3 & uVar1) == 0); if (local_20 == *(long *)(in_FS_OFFSET + 0x28)) { return local_44; } __stack_chk_fail(); }
e2fsprogs-1.46.5
ghidra
static int add_nh_group_attr(struct nlmsghdr *n, int maxlen, char *argv) { struct nexthop_grp *grps = ((void *)0); int count = 0, i; int err = -1; char *sep, *wsep; if (*argv != '\0') count = 1; sep = strchr(argv, '/'); while (sep) { count++; sep = strchr(sep + 1, '/'); } if (count == 0) goto out; grps = calloc(count, sizeof(*grps)); if (!grps) goto out; for (i = 0; i < count; ++i) { sep = strchr(argv, '/'); if (sep) *sep = '\0'; wsep = strchr(argv, ','); if (wsep) *wsep = '\0'; if (get_unsigned(&grps[i].id, argv, 0)) goto out; if (wsep) { unsigned int w; wsep++; if (get_unsigned(&w, wsep, 0) || w == 0 || w > 256) invarg("\"weight\" is invalid\n", wsep); grps[i].weight = w - 1; } if (!sep) break; argv = sep + 1; } err = addattr_l(n, maxlen, NHA_GROUP, grps, count * sizeof(*grps)); out: free(grps); return err; }
undefined4 add_nh_group_attr(undefined8 param_1, undefined4 param_2, char *param_3) { int iVar1; long in_FS_OFFSET; char *local_50; uint local_38; uint local_34; int local_30; undefined4 local_2c; void *local_28; char *local_20; char *local_18; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); local_28 = (void *)0x0; local_2c = 0xffffffff; local_34 = (uint)(*param_3 != '\0'); for (local_20 = strchr(param_3, 0x2f); local_20 != (char *)0x0; local_20 = strchr(local_20 + 1, 0x2f)) { local_34 = local_34 + 1; } if ((local_34 != 0) && (local_28 = calloc((long)(int)local_34, 8), local_28 != (void *)0x0)) { local_50 = param_3; for (local_30 = 0; local_30 < (int)local_34; local_30 = local_30 + 1) { local_20 = strchr(local_50, 0x2f); if (local_20 != (char *)0x0) { *local_20 = '\0'; } local_18 = strchr(local_50, 0x2c); if (local_18 != (char *)0x0) { *local_18 = '\0'; } iVar1 = get_unsigned((void *)((long)local_28 + (long)local_30 * 8), local_50, 0); if (iVar1 != 0) goto LAB_00101f4e; if (local_18 != (char *)0x0) { local_18 = local_18 + 1; iVar1 = get_unsigned(&local_38, local_18, 0); if (((iVar1 != 0) || (local_38 == 0)) || (0x100 < local_38)) { invarg("\"weight\" is invalid\n", local_18); } *(char *)((long)local_28 + (long)local_30 * 8 + 4) = (char)local_38 + -1; } if (local_20 == (char *)0x0) break; local_50 = local_20 + 1; } local_2c = addattr_l(param_1, param_2, 2, local_28, local_34 << 3); } LAB_00101f4e: free(local_28); if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) { __stack_chk_fail(); } return local_2c; }
iproute2-6.0.0
ghidra
static void trapsigs(void) { int i; catchaction.sa_flags = 0x10000000; sigemptyset(&catchaction.sa_mask); for (i = 0; i < NUM_SIGS; i++) sigaddset(&catchaction.sa_mask, sigs[i]); for (i = 0; i < NUM_SIGS; i++) { sigaction(sigs[i], 0, &initial_action[i]); if ((initial_action[i].__sigaction_handler.sa_handler) != ((__sighandler_t)1)) signal_handler(sigs[i], catchsig); } signal(17, ((__sighandler_t)0)); sigs_trapped = 1; }
void trapsigs() { unsigned int v0; unsigned long long v2; g_402748 = 0x10000000; sigemptyset(&g_4026c8); for (v0 = 0; v0 <= 6; v0 += 1) { sigaddset(&g_4026c8, *((4 * v0 + &sigs))); } for (v0 = 0; v0 <= 6; v0 += 1) { sigaction(*((4 * v0 + &sigs)), 0x0, &initial_action[19 * v0]); if (initial_action[16 * v0 + 2 * v0 + v0] != 1) signal_handler(*((4 * v0 + &sigs)), catchsig); } v2 = signal(0x11, 0x0); sigs_trapped = 1; return; }
diffutils
angr_phoenix
static void enforce_one_top_level(char **pfile_name) { char *file_name = *pfile_name; char *p; for (p = file_name; *p && (((*p) == '/') || *p == '.'); p++) ; if (*p) { int pos = strlen(one_top_level_dir); if (strncmp(p, one_top_level_dir, pos) == 0) { if (((p[pos]) == '/') || p[pos] == 0) return; } *pfile_name = make_file_name(one_top_level_dir, file_name); normalize_filename_x(*pfile_name); } else *pfile_name = xstrdup(one_top_level_dir); free(file_name); }
void enforce_one_top_level(unsigned long long *a0) { unsigned int v0; char *v1; void *v2; unsigned long long v4; unsigned long long v5; unsigned long long v6; v2 = *(a0); v1 = v2; while (true) { switch (*(v1)) { case 46: case 47: v1 += 1; break; default: goto LABEL_4001a6; } } LABEL_4001a6: if (!*(v1)) { *(a0) = xstrdup(*(&one_top_level_dir)); v6 = free(v2); return; } v0 = strlen(*(&one_top_level_dir)); if (strncmp(v1, *(&one_top_level_dir), v0)) { LABEL_40020f: *(a0) = make_file_name(*(&one_top_level_dir), v2, v2); normalize_filename_x(*(a0)); v6 = free(v2); return; } v4 = v1[v0]; switch (v1[v0]) { case 47: return; case 0: v5 = v1[v0]; return; default: v5 = v1[v0]; break; } goto LABEL_40020f; }
tar
angr_sailr
static char *whoami(void) { struct group *grp = getgrgid(getgid()); struct passwd *usr = getpwuid(getuid()); if ((((void *)0) != usr) && (((void *)0) != grp) && (0 == strcmp(usr->pw_name, grp->gr_name))) { return xstrdup(usr->pw_name); } else { return ((void *)0); } }
int whoami() { unsigned long long *v0; unsigned long long *v1; unsigned int v3; v0 = &getgrgid(getgid())->gr_name; v1 = &getpwuid(getuid())->pw_name; if (v1 && v0 && !strcmp(*(v1), *(v0))) { v3 = xstrdup(*(v1)); goto LABEL_40006d; } v3 = 0; LABEL_40006d: return v3; }
shadow
angr_phoenix
static int do_modify(enum cmd c, int argc, char **argv) { int ifindex; if (argc == 0) ipmacsec_usage(); ifindex = ll_name_to_index(*argv); if (!ifindex) { fprintf(stderr, "Device \"%s\" does not exist.\n", *argv); return -1; } argc--; argv++; if (argc == 0) ipmacsec_usage(); if (strcmp(*argv, "tx") == 0) return do_modify_txsa(c, argc - 1, argv + 1, ifindex); if (strcmp(*argv, "rx") == 0) return do_modify_rxsci(c, argc - 1, argv + 1, ifindex); ipmacsec_usage(); return -1; }
void do_modify(unsigned long a0, unsigned long a1, unsigned long a2) { unsigned long long *v0; unsigned int v1; unsigned int v2; unsigned long long v4; unsigned long long v5; unsigned long long v6; v1 = a1; v0 = a2; if (!v1) ipmacsec_usage(); v2 = ll_name_to_index(*(v0)); if (!v2) { fprintf(stderr, "Device \"%s\" does not exist.\n", *(v0)); v4 = 4294967295; return; } v1 -= 1; v0 += 1; if (!v1) { ipmacsec_usage(); } else if (!strcmp(*(v0), "tx")) { v5 = do_modify_txsa(a0, v1 - 1, v0 + 1, v2); return; } else if (strcmp(*(v0), "rx")) { ipmacsec_usage(); } else { v6 = do_modify_rxsci(a0, v1 - 1, v0 + 1, v2); return; } }
iproute2-6.0.0
angr_sailr
static int iproute_restore(void) { int pos, prio; if (route_dump_check_magic()) return -1; pos = ftell(stdin); if (pos == -1) { perror("Failed to restore: ftell"); return -1; } for (prio = 0; prio < 3; prio++) { int err; err = rtnl_from_file(stdin, &restore_handler, &prio); if (err) return -2; if (fseek(stdin, pos, 0) == -1) { perror("Failed to restore: fseek"); return -1; } } return 0; }
void iproute_restore() { unsigned int v0; unsigned int v1; unsigned int v2; unsigned long long v4; unsigned long long v5; void *v6; unsigned long long v7; unsigned long long v8; if (route_dump_check_magic()) { v4 = 4294967295; } else { v1 = ftell(stdin); if (v1 == -1) { perror("Failed to restore: ftell"); v5 = 4294967295; } else { v0 = 0; while (true) { if (v0 > 2) { v6 = 0; break; } else { v2 = rtnl_from_file(stdin, restore_handler, &v0); if (v2) { v7 = 4294967294; break; } else if (fseek(stdin, v1, 0x0) != -1) { v0 += 1; } else { perror("Failed to restore: fseek"); v8 = 4294967295; break; } } } } } return; }
iproute2-6.0.0
angr_phoenix
int get_statinfo(const char *pathname, const char *name, struct stat *p) { if (!state.have_stat) { set_stat_placeholders(p); if (0 == (*options.xstat)(name, p)) { if (00000 == p->st_mode) { error(0, 0, gettext("WARNING: file %s appears to have mode 0000"), quotearg_n_style(0, options.err_quoting_style, name)); state.exit_status = 1; } } else { if (!options.ignore_readdir_race || ((*__errno_location()) != 2)) { nonfatal_target_file_error((*__errno_location()), pathname); } return -1; } } state.have_stat = 1; state.have_type = 1; state.type = p->st_mode; return 0; }
undefined8 get_statinfo(undefined8 param_1, undefined8 param_2, long param_3) { int iVar1; undefined8 uVar2; undefined8 uVar3; int *piVar4; if (DAT_00104054 != '\x01') { set_stat_placeholders(param_3); iVar1 = (*_run_in_dir)(param_2, param_3); if (iVar1 != 0) { if ((quotearg_n_style._6_1_ != '\x01') || (piVar4 = __errno_location(), *piVar4 != 2)) { piVar4 = __errno_location(); nonfatal_target_file_error(*piVar4, param_1); } return 0xffffffff; } if (*(int *)(param_3 + 0x18) == 0) { uVar2 = quotearg_n_style(0, DAT_001040c4, param_2); uVar3 = gettext("WARNING: file %s appears to have mode 0000"); error(0, 0, uVar3, uVar2); _DAT_00104074 = 1; } } DAT_00104054 = 1; DAT_00104055 = 1; options = *(undefined4 *)(param_3 + 0x18); return 0; }
findutils
ghidra
static const char *group_name(gid_t gid) { struct group *group = getgrgid(gid); if (group != ((void *)0)) return group->gr_name; else return ((void *)0); }
int group_name(unsigned long a0) { unsigned long long *v0; v0 = &getgrgid(a0)->gr_name; return (!v0 ? *(v0) : 0); }
acl-2.3.1
angr_sailr
int get_ca_status(void) { if (batch) { return cfg.ca; } else { return read_yesno("Does the certificate belong to an authority? (y/N): ", 0); } }
long long get_ca_status() { unsigned long long v1; if (*(got.batch)) v1 = *((got.cfg + 540)); else v1 = read_yesno("Does the certificate belong to an authority? (y/N): ", 0x0); return v1; }
gnutls
angr_dream
int kex_setup(struct ssh *ssh, char *proposal[PROPOSAL_MAX]) { int r; if ((r = kex_ready(ssh, proposal)) != 0) return r; if ((r = kex_send_kexinit(ssh)) != 0) { kex_free(ssh->kex); ssh->kex = ((void *)0); return r; } return 0; }
long kex_setup(long a1, long a2) { unsigned int v3; unsigned int v4; v3 = kex_ready(a1, a2); if (v3) return v3; v4 = kex_send_kexinit(a1); if (!v4) return 0LL; kex_free(*(_QWORD *)(a1 + 8)); *(_QWORD *)(a1 + 8) = 0LL; return v4; }
openssh-portable
ida
int sshpkt_disconnect(struct ssh *ssh, const char *fmt, ...) { char buf[1024]; va_list args; int r; __builtin_va_start(args, fmt); vsnprintf(buf, sizeof(buf), fmt, args); __builtin_va_end(args); if ((r = sshpkt_start(ssh, 1)) != 0 || (r = sshpkt_put_u32(ssh, 2)) != 0 || (r = sshpkt_put_cstring(ssh, buf)) != 0 || (r = sshpkt_put_cstring(ssh, "")) != 0 || (r = sshpkt_send(ssh)) != 0) return r; return 0; }
int sshpkt_disconnect() { unsigned int v0; unsigned int v1; unsigned int v2; unsigned long v3; unsigned long v4; char v5; unsigned long v6; char v7; unsigned long v8; unsigned long v9; unsigned long v10; unsigned long v11; int v12; int v13; int v14; int v15; int v16; int v17; int v18; int v19; unsigned long v20; unsigned long long v21; unsigned long v22; unsigned long long v23; unsigned long long v24; char v25; int v26; int v27; int v28; int v29; int v30; int v31; int v32; int v33; unsigned long long *v34; char *v35; unsigned long long v36; unsigned int v37; v8 = v21; v9 = v22; v10 = v23; v11 = v24; if (v25) { v12 = v26; v13 = v27; v14 = v28; v15 = v29; v16 = v30; v17 = v31; v18 = v32; v19 = v33; } v6 = v34[5]; v1 = 16; v2 = 48; v3 = &v20; v4 = &v7; vsnprintf(&v5, 0x400, v35, &v1); v0 = sshpkt_start(v36, 0x1); if (v0) { LABEL_406fbe: v37 = v0; } else { v0 = sshpkt_put_u32(v36, 0x2); if (!(!v0)) goto LABEL_406fbe; v0 = sshpkt_put_cstring(v36, &v5); if (!(!v0)) goto LABEL_406fbe; v0 = sshpkt_put_cstring(v36, &g_407061); if (!(!v0)) goto LABEL_406fbe; v0 = sshpkt_send(v36, &g_407061, v21, &v1, v23, v24); if (!(!v0)) goto LABEL_406fbe; v37 = 0; } if (!(v6 ^ v34[5])) return v37; __stack_chk_fail(); }
openssh-portable
angr_phoenix
void sshsigopt_free(struct sshsigopt *opts) { if (opts == ((void *)0)) return; free(opts->namespaces); free(opts); }
void sshsigopt_free(struct_0 *a0) { unsigned long long v1; if (a0) { free(a0->field_8); v1 = free(a0); return; } return; }
openssh-portable
angr_sailr
static struct argp_option const * find_argp_option_key(struct argp_option const *o, int key) { for (; !(o->name == ((void *)0) && o->key == 0 && o->arg == 0 && o->flags == 0 && o->doc == ((void *)0)); o++) if (o->key == key) return o; return ((void *)0); }
long find_argp_option_key(long a1, int a2) { while (*(_QWORD *)a1 || *(_DWORD *)(a1 + 8) || *(_QWORD *)(a1 + 16) || *(_DWORD *)(a1 + 24) || *(_QWORD *)(a1 + 32)) { if (a2 == *(_DWORD *)(a1 + 8)) return a1; a1 += 48LL; } return 0LL; }
tar
ida
void rl_clear_history(void) { HIST_ENTRY **hlist, *hent; register int i; UNDO_LIST *ul, *saved_undo_list; saved_undo_list = rl_undo_list; hlist = history_list(); for (i = 0; i < history_length; i++) { hent = hlist[i]; if (ul = (UNDO_LIST *)hent->data) { if (ul == saved_undo_list) saved_undo_list = 0; _rl_free_undo_list(ul); hent->data = 0; } _rl_free_history_entry(hent); } history_offset = history_length = 0; rl_undo_list = saved_undo_list; }
long rl_clear_history() { int i; long result; long v2; long v3; long v4; long v5; v2 = rl_undo_list; v3 = history_list(); for (i = 0; i < history_length; ++i) { v4 = *(_QWORD *)(8LL * i + v3); v5 = *(_QWORD *)(v4 + 16); if (v5) { if (v5 == v2) v2 = 0LL; rl_free_undo_list(v5); *(_QWORD *)(v4 + 16) = 0LL; } rl_free_history_entry((void **)v4); } history_length = 0; history_offset = 0; result = v2; rl_undo_list = v2; return result; }
bash
ida
static _Bool sparse_scan_file_seek(struct tar_sparse_file *file) { struct tar_stat_info *st = file->stat_info; int fd = file->fd; struct sp_array sp = {0, 0}; off_t offset = 0; off_t data_offset; off_t hole_offset; st->archive_file_size = 0; for (;;) { data_offset = lseek(fd, offset, 3); if (data_offset == (off_t)-1) { if ((*__errno_location()) == 6) { sp.numbytes = 0; sp.offset = st->stat.st_size; sparse_add_map(st, &sp); return 1; } return 0; } hole_offset = lseek(fd, data_offset, 4); if (offset == 0 && data_offset == 0 && hole_offset == st->stat.st_size) { lseek(fd, 0, 0); return 0; } sp.offset = data_offset; sp.numbytes = hole_offset - data_offset; sparse_add_map(st, &sp); st->archive_file_size += sp.numbytes; offset = hole_offset; } return 1; }
int sparse_scan_file_seek(struct_0 *a0) { unsigned int v0; void *v1; unsigned long long v2[36]; unsigned int v3; unsigned int v4; unsigned long v5; void *v6; unsigned int v8; v2[0] = a0->field_18; v0 = a0->field_0; v5 = 0; v6 = 0; v1 = 0; v2[35] = 0; while (true) { *(&v3) = lseek(v0, v1, 0x3); if (*(&v3) != -1) { *(&v4) = lseek(v0, *(&v3), 0x4); if (!v1 && !*(&v3) && *(&v4) == v2[17]) { lseek(v0, 0x0, 0x0); v8 = 0; break; } if (v1 || *(&v4) != v2[17] || *(&v3)) { v5 = *(&v3); v6 = *(&v4) - *(&v3); sparse_add_map(v2, &v5); v2[35] = v2[35] + v6; v1 = *(&v4); } } else if (*(__errno_location()) == 6) { v6 = 0; v5 = v2[17]; sparse_add_map(v2, &v5); v8 = 1; break; } else { v8 = 0; break; } } return v8; }
tar
angr_dream
void hash_dispose(table) HASH_TABLE *table; { sh_xfree((table->bucket_array), "hashlib.c", 412); sh_xfree((table), "hashlib.c", 413); }
long hash_dispose(_QWORD *a1) { sh_xfree(*a1, "hashlib.c", 412LL); return sh_xfree(a1, "hashlib.c", 413LL); }
bash
ida
static int needs_dquote_escaping(char c) { switch (c) { case '"': case '\\': case '`': case '$': return 1; default: return 0; } }
undefined8 needs_dquote_escaping(char param_1) { undefined8 uVar1; if (((int)param_1 - 0x22U < 0x3f) && ((1 << ((byte)((int)param_1 - 0x22U) & 0x3f) & 0x4400000000000005U) != 0)) { uVar1 = 1; } else { uVar1 = 0; } return uVar1; }
libedit
ghidra
static inline __u8 rta_getattr_u8(const struct rtattr *rta) { return *(__u8 *)(( void *)(((char *)(rta)) + ((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0)))); }
int rta_getattr_u8(struct_0 *a0) { return a0->field_4; }
iproute2-6.0.0
angr_sailr
SHELL_VAR *find_shell_variable(name) const char *name; { SHELL_VAR *var; var = var_lookup(name, shell_variables); if (var && ((((var)->attributes) & (0x0000800)))) var = find_variable_nameref(var); if (var == 0) return ((SHELL_VAR *)((void *)0)); return (var->dynamic_value ? (*(var->dynamic_value))(var) : var); }
long find_shell_variable(undefined8 param_1) { long local_10; local_10 = var_lookup(param_1, shell_variables); if ((local_10 != 0) && ((*(uint *)(local_10 + 0x28) & 0x800) != 0)) { local_10 = find_variable_nameref(local_10); } if (local_10 == 0) { local_10 = 0; } else if (*(long *)(local_10 + 0x18) != 0) { local_10 = (**(code **)(local_10 + 0x18))(local_10); } return local_10; }
bash
ghidra
static char *vdollar_percent_expand(int *parseerror, int dollar, int percent, const char *string, va_list ap) { u_int num_keys = 0, i; struct { const char *key; const char *repl; } keys[16]; struct sshbuf *buf; int r, missingvar = 0; char *ret = ((void *)0), *var, *varend, *val; size_t len; if ((buf = sshbuf_new()) == ((void *)0)) sshfatal("misc.c", __func__, 1235, 1, SYSLOG_LEVEL_FATAL, ((void *)0), "sshbuf_new failed"); if (parseerror == ((void *)0)) sshfatal("misc.c", __func__, 1237, 1, SYSLOG_LEVEL_FATAL, ((void *)0), "null parseerror arg"); *parseerror = 1; if (percent) { for (num_keys = 0; num_keys < 16; num_keys++) { keys[num_keys].key = __builtin_va_arg(ap, char *); if (keys[num_keys].key == ((void *)0)) break; keys[num_keys].repl = __builtin_va_arg(ap, char *); if (keys[num_keys].repl == ((void *)0)) { sshfatal("misc.c", __func__, 1248, 1, SYSLOG_LEVEL_FATAL, ((void *)0), "NULL replacement for token %s", keys[num_keys].key); } } if (num_keys == 16 && __builtin_va_arg(ap, char *) != ((void *)0)) sshfatal("misc.c", __func__, 1253, 1, SYSLOG_LEVEL_FATAL, ((void *)0), "too many keys"); if (num_keys == 0) sshfatal("misc.c", __func__, 1255, 1, SYSLOG_LEVEL_FATAL, ((void *)0), "percent expansion without token list"); } for (i = 0; *string != '\0'; string++) { if (dollar && string[0] == '$' && string[1] == '{') { string += 2; if ((varend = strchr(string, '}')) == ((void *)0)) { sshlog("misc.c", __func__, 1264, 1, SYSLOG_LEVEL_ERROR, ((void *)0), "environment variable '%s' missing " "closing '}'", string); goto out; } len = varend - string; if (len == 0) { sshlog("misc.c", __func__, 1270, 1, SYSLOG_LEVEL_ERROR, ((void *)0), "zero-length environment variable"); goto out; } var = xmalloc(len + 1); (void)strlcpy(var, string, len + 1); if ((val = getenv(var)) == ((void *)0)) { sshlog("misc.c", __func__, 1276, 1, SYSLOG_LEVEL_ERROR, ((void *)0), "env var ${%s} has no value", var); missingvar = 1; } else { sshlog("misc.c", __func__, 1279, 1, SYSLOG_LEVEL_DEBUG3, ((void *)0), "expand ${%s} -> '%s'", var, val); if ((r = sshbuf_put(buf, val, strlen(val))) != 0) sshfatal("misc.c", __func__, 1281, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "sshbuf_put ${}"); } free(var); string += len; continue; } if (*string != '%' || !percent) { append: if ((r = sshbuf_put_u8(buf, *string)) != 0) sshfatal("misc.c", __func__, 1296, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "sshbuf_put_u8 %%"); continue; } string++; if (*string == '%') goto append; if (*string == '\0') { sshlog("misc.c", __func__, 1304, 1, SYSLOG_LEVEL_ERROR, ((void *)0), "invalid format"); goto out; } for (i = 0; i < num_keys; i++) { if (strchr(keys[i].key, *string) != ((void *)0)) { if ((r = sshbuf_put(buf, keys[i].repl, strlen(keys[i].repl))) != 0) sshfatal("misc.c", __func__, 1311, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "sshbuf_put %%-repl"); break; } } if (i >= num_keys) { sshlog("misc.c", __func__, 1316, 1, SYSLOG_LEVEL_ERROR, ((void *)0), "unknown key %%%c", *string); goto out; } }
int vdollar_percent_expand(unsigned int *a0, unsigned long a1, unsigned long a2, unsigned long a3, struct_0 *a4) { struct_0 *v0; unsigned int s_14c; char v1[2]; unsigned int v2; unsigned int v3; unsigned int v4; void *v5; unsigned long long v6; unsigned long long v7; unsigned long v8; void *v9; char *v10; char v11; char v12; unsigned long long v13; unsigned long v14; unsigned long long v15; unsigned long v16; char v17; unsigned long long v18; unsigned long long *v19; unsigned long long *v20; unsigned long long *v21; unsigned long long v22; unsigned int v23; *(&v1) = a3; v0 = a4; v2 = 0; v4 = 0; v5 = 0; v6 = sshbuf_new(); if (!v6) sshfatal("misc.c", "vdollar_percent_expand", 0x4d3, 0x1, 0x1, 0x0, "sshbuf_new failed"); if (!a0) { v15 = "null parseerror arg"; sshfatal("misc.c", "vdollar_percent_expand", 0x4d5, 0x1, 0x1, 0x0, *(&v17)); } *(a0) = 1; if (a2) { for (v2 = 0; v2 <= 15; v2 += 1) { if (a4->field_0 <= 47) { v19 = a4->field_0 + a4->field_10; a4->field_0 = a4->field_0 + 8; } else { v19 = a4->field_8; a4->field_8 = a4->field_8 + 8; } *(&(&v11)[16 * v2]) = *(v19); if (!*(&(&v11)[16 * v2])) break; if (*(&(&v11)[16 * v2])) { if (a4->field_0 <= 47) { v20 = a4->field_0 + a4->field_10; a4->field_0 = a4->field_0 + 8; } else { v20 = a4->field_8; a4->field_8 = a4->field_8 + 8; } *(&(&v12)[16 * v2]) = *(v20); if (!*(&(&v12)[16 * v2])) { v16 = *(&(&v11)[16 * v2]); v15 = "NULL replacement for token %s"; sshfatal("misc.c", "vdollar_percent_expand", 0x4e0, 0x1, 0x1, 0x0, *(&v17)); } } } if (v2 == 16) { if (a4->field_0 <= 47) { v21 = a4->field_0 + a4->field_10; a4->field_0 = a4->field_0 + 8; } else { v21 = a4->field_8; a4->field_8 = a4->field_8 + 8; } v22 = *(v21); if (v22) { v15 = "too many keys"; sshfatal("misc.c", "vdollar_percent_expand", 0x4e5, 0x1, 0x1, 0x0, *(&v17)); } } if (!v2) { v15 = "percent expansion without token list"; sshfatal("misc.c", "vdollar_percent_expand", 0x4e7, 0x1, 0x1, 0x0, *(&v17)); } } v3 = 0; while (true) { if (v1[0]) { if (a1 && v1[0] == 36 && v1[1] == 123) { v1 = &v1[1]; v7 = strchr(v1, 0x7d); if (!v7) { v16 = v1; v15 = "environment variable '%s' missing closing '}'"; sshlog("misc.c", "vdollar_percent_expand", 0x4f0, 0x1, 0x2, 0x0, *(&v17), v18); break; } else { v8 = __subvdi3(v7, v1); if (!v8) { v15 = "zero-length environment variable"; sshlog("misc.c", "vdollar_percent_expand", 0x4f6, 0x1, 0x2, 0x0, *(&v17), v18); break; } else { v9 = xmalloc(v8 + 1); strlcpy(v9, v1, v8 + 1, v1); v10 = getenv(v9); if (!v10) { v16 = v9; v15 = "env var ${%s} has no value"; sshlog("misc.c", "vdollar_percent_expand", 0x4fc, 0x1, 0x2, 0x0, *(&v17), v18); v4 = 1; } else { v15 = v10; v14 = v9; v13 = "expand ${%s} -> '%s'"; sshlog("misc.c", "vdollar_percent_expand", 0x4ff, 0x1, 0x7, 0x0, *(&v17), v18); s_14c = sshbuf_put(v6, v10, strlen(v10), v10); if (s_14c) { v15 = "sshbuf_put ${}"; sshfatal("misc.c", "vdollar_percent_expand", 0x501, 0x1, 0x1, ssh_err(s_14c), *(&v17)); } } free(v9); *(&v1) = &v1[v8]; } } } if ((!a1 || v1[0] != 36 || v1[1] != 123) && v1[0] != 37 && (v1[0] == 37 || s_14c) && (a2 || s_14c)) { if (!v1[0]) { v15 = "invalid format"; sshlog("misc.c", "vdollar_percent_expand", 0x518, 0x1, 0x2, 0x0, *(&v17), v18); break; } else { for (v3 = 0; v3 < v2; v3 += 1) { v23 = strchr(*(&(&v11)[16 * v3]), v1[0]); if (v23) { v23 = sshbuf_put(v6, *(&(&v12)[16 * v3]), strlen(*(&(&v12)[16 * v3])), *(&(&v12)[16 * v3])); if (!v23) break; if (s_14c) { v15 = "sshbuf_put %%-repl"; sshfatal("misc.c", "vdollar_percent_expand", 0x51f, 0x1, 0x1, ssh_err(s_14c), *(&v17)); } } } if (v3 >= v2) { v16 = v1[0]; v15 = "unknown key %%%c"; sshlog("misc.c", "vdollar_percent_expand", 0x524, 0x1, 0x2, 0x0, *(&v17), v18); break; } } } if (v1[1] != 123 || v1[0] == 37) { v23 = sshbuf_put_u8(v6, v1[0], v1[0]); v23 = v23; } if (s_14c && (v1[0] == 37 || !a2 || v1[0] != 37) && (v1[0] == 37 || !a1 || v1[0] != 36 || v1[1] != 123)) { v15 = "sshbuf_put_u8 %%"; sshfatal("misc.c", "vdollar_percent_expand", 0x510, 0x1, 0x1, ssh_err(s_14c), *(&v17)); } if (v1[1] != 123 || s_14c || v3 >= v2) *(&v1) = &v1[1]; if (v1[0] == 36 && v1[1] == 123 && v7 && a1 && v8 || v1[0] != 37 && v1[0] && (v1[0] == 37 || s_14c) && (a2 || s_14c) && (!a1 || v1[0] != 36 || v1[1] != 123) && v3 < v2 || (v1[0] == 37 || !a2 && !a1 || !a2 && v1[0] != 36 || !a2 && v1[1] != 123 || !a1 && v1[0] != 37 || v1[0] != 36 && v1[0] != 37 || v1[1] != 123 && v1[0] != 37) && !v23) *(&v1) = &v1[1]; } else { if (!v4) { v5 = sshbuf_dup_string(v6); if (!v5) { v15 = "sshbuf_dup_string failed"; sshfatal("misc.c", "vdollar_percent_expand", 0x529, 0x1, 0x1, 0x0, *(&v17)); } } *(a0) = 0; break; } }
openssh-portable
angr_dream
static void print_mptcp_addr_flags(unsigned int flags) { unsigned int i; for (i = 0; i < (sizeof(mptcp_addr_flag_names) / sizeof((mptcp_addr_flag_names)[0])); i++) { unsigned long mask = mptcp_addr_flag_names[i].value; if (flags & mask) { print_string(PRINT_FP, ((void *)0), "%s ", mptcp_addr_flag_names[i].name); print_bool(PRINT_JSON, mptcp_addr_flag_names[i].name, ((void *)0), 1); } flags &= ~mask; } if (flags) { char b1[64]; snprintf(b1, sizeof(b1), "%02x", flags); print_string(PRINT_ANY, "rawflags", "rawflags %s ", b1); } }
void print_mptcp_addr_flags(unsigned long a0) { unsigned int v0; unsigned int v1; unsigned long v2; char v3; char v4; unsigned long long *v6; unsigned long long v7; v0 = a0; for (v1 = 0; v1 <= 5; v1 += 1) { v2 = (&g_402388)[2 * v1]; if ((v0 & v2)) { print_string(0x1, 0x0, "%s ", (&mptcp_addr_flag_names)[2 * v1]); print_bool(0x2, (&mptcp_addr_flag_names)[2 * v1], 0x0, 0x1); } v0 &= !(v2); } if (v0) { snprintf(&v3, 0x40, "%02x", v0); print_string(0x4, "rawflags", "rawflags %s ", &v3); } v7 = *(&v4) ^ v6[5]; return; }
iproute2-6.0.0
angr_sailr
static _Bool is_colored(enum indicator_no colored_filetype) { size_t len = _rl_color_indicator[colored_filetype].len; char const *s = _rl_color_indicator[colored_filetype].string; return !(len == 0 || (len == 1 && strncmp(s, "0", 1) == 0) || (len == 2 && strncmp(s, "00", 2) == 0)); }
undefined4 is_colored(uint param_1) { long lVar1; char *__s1; int iVar2; undefined4 uVar3; lVar1 = *(long *)(&_rl_color_indicator + (ulong)param_1 * 0x10); __s1 = *(char **)(strncmp + (ulong)param_1 * 0x10); if (lVar1 == 0) { LAB_001000ce: uVar3 = 0; } else { if (lVar1 == 1) { iVar2 = strncmp(__s1, "0", 1); if (iVar2 == 0) goto LAB_001000ce; } if (lVar1 == 2) { iVar2 = strncmp(__s1, "00", 2); if (iVar2 == 0) goto LAB_001000ce; } uVar3 = 1; } return uVar3; }
bash
ghidra
static void dunlink_reclaim(struct deferred_unlink *p) { free(p->file_name); p->next = dunlink_avail; dunlink_avail = p; }
void dunlink_reclaim(undefined8 *param_1) { free((void *)param_1[2]); *param_1 = dunlink_avail; dunlink_avail = param_1; return; }
tar
ghidra
!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); } }
_BOOL8 ext2fs_has_feature_quota(long a1) { return (*(_DWORD *)(a1 + 100) & 0x100) != 0; }
e2fsprogs-1.46.5
ida
static int process_dir(char *dir, struct savewd *wd, void *options) { struct cp_options const *x = options; int ret = (make_dir_parents(dir, wd, make_ancestor, options, dir_mode, announce_mkdir, dir_mode_bits, owner_id, group_id, 0) ? 0 : 1); if (ret == 0 && x->set_security_context) { if (!restorecon(x->set_security_context, last_component(dir), 0) && !ignorable_ctx_err((*__errno_location()))) error(0, (*__errno_location()), gettext("failed to restore context for %s"), quotearg_style(shell_escape_always_quoting_style, dir)); } return ret; }
long process_dir(long a1, long a2, long a3) { unsigned char dir_parents; long component; int *v5; long v6; char *v7; int *v8; unsigned int v10; dir_parents = make_dir_parents(a1, a2, make_ancestor, a3, (unsigned int)dir_mode, announce_mkdir, (unsigned int)dir_mode_bits, (unsigned int)owner_id, (unsigned int)group_id, 0LL); v10 = dir_parents ^ 1; if (dir_parents == 1) { if (*(_QWORD *)(a3 + 40)) { component = last_component(a1); if ((unsigned char)restorecon(*(_QWORD *)(a3 + 40), component, 0LL) != 1) { v5 = _errno_location(); if (!ignorable_ctx_err(*v5)) { v6 = quotearg_style(4LL, a1); v7 = gettext("failed to restore context for %s"); v8 = _errno_location(); error(0, *v8, v7, v6); } } } } return v10; }
coreutils
ida
static rsRetVal doWrite(instanceData *__restrict__ const pData, uchar *__restrict__ const pszBuf, const int lenBuf) { rsRetVal iRet = RS_RET_OK; ((void)(0)); ((void)(0)); if (Debug) { r_dbgprintf("omfile.c", "omfile: write to stream, pData->pStrm %p, lenBuf %d, strt " "data %.128s\n", pData->pStrm, lenBuf, pszBuf); }; if (pData->pStrm != ((void *)0)) { if ((iRet = strm.Write(pData->pStrm, pszBuf, lenBuf)) != RS_RET_OK) goto finalize_it; if (pData->useSigprov) { if ((iRet = pData->sigprov.OnRecordWrite(pData->sigprovFileData, pszBuf, lenBuf)) != RS_RET_OK) goto finalize_it; } } finalize_it: return iRet; }
int doWrite(struct_0 *a0, unsigned long long a1, unsigned long a2) { unsigned int v0; v0 = 0; if (Debug) r_dbgprintf("omfile.c", "omfile: write to stream, pData->pStrm %p, lenBuf " "%d, strt data %.128s\n"); if (a0->field_38) { v0 = g_405420(a0->field_38, a1, a2, a1, g_405420); if (!(!v0)) goto LABEL_40181e; if (a0->field_c8) v0 = a0->field_a8(a0->field_c0, a1, a2, a1, a0->field_a8); } LABEL_40181e: return v0; }
rsyslog-8.2210.0
angr_phoenix
static _Bool delete_proc(pid_t pid) { struct tempnode test; test.pid = pid; struct tempnode *node = hash_remove(proctab, &test); if (!node) return 0; node->state = REAPED; return 1; }
bool delete_proc(undefined4 param_1) { long lVar1; long in_FS_OFFSET; undefined local_28[8]; undefined4 local_20; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); local_20 = param_1; lVar1 = hash_remove(proctab, local_28); if (lVar1 != 0) { *(undefined *)(lVar1 + 0xc) = 2; } if (local_10 == *(long *)(in_FS_OFFSET + 0x28)) { return lVar1 != 0; } __stack_chk_fail(); }
coreutils
ghidra
static int get_sock_port(int sock, int local) { struct sockaddr_storage from; socklen_t fromlen; char strport[32]; int r; fromlen = sizeof(from); memset(&from, 0, sizeof(from)); if (local) { if (getsockname(sock, (struct sockaddr *)&from, &fromlen) == -1) { sshlog("canohost.c", __func__, 168, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "getsockname failed: %.100s", strerror((*__errno_location()))); return 0; } } else { if (getpeername(sock, (struct sockaddr *)&from, &fromlen) == -1) { sshlog("canohost.c", __func__, 173, 0, SYSLOG_LEVEL_DEBUG1, ((void *)0), "getpeername failed: %.100s", strerror((*__errno_location()))); return -1; } } if (from.ss_family == 10) fromlen = sizeof(struct sockaddr_in6); if (from.ss_family != 2 && from.ss_family != 10) return 0; if ((r = getnameinfo((struct sockaddr *)&from, fromlen, ((void *)0), 0, strport, sizeof(strport), 2)) != 0) sshfatal("canohost.c", __func__, 189, 1, SYSLOG_LEVEL_FATAL, ((void *)0), "getnameinfo NI_NUMERICSERV failed: %s", ssh_gai_strerror(r)); return atoi(strport); }
void get_sock_port(unsigned long a0, unsigned long a1) { unsigned long v0; unsigned int v1; unsigned int v2; char v3; char v4; unsigned long long v6; void *v7; void *v8; unsigned long long v9; v1 = 128; memset(&v3, 0x0, 0x80); if (a1) { if (getsockname(a0, &v3, &v1) == -1) { v0 = strerror(*(__errno_location())); sshlog("canohost.c", "get_sock_port", 0xa8, 0x0, 0x2, 0x0); v7 = 0; goto LABEL_400703; } } else { if (getpeername(a0, &v3, &v1) == -1) { v0 = strerror(*(__errno_location())); sshlog("canohost.c", "get_sock_port", 0xad, 0x0, 0x5, 0x0); v6 = 4294967295; goto LABEL_400703; } } if (*(&v3) == 10) v1 = 28; if (*(&v3) != 2 && *(&v3) != 10) { v8 = 0; goto LABEL_400703; } v2 = getnameinfo(&v3, v1, 0x0, 0x0, &v4, 0x20); if (v2) { v0 = ssh_gai_strerror(v2); sshfatal("canohost.c", "get_sock_port", 0xbd, 0x1, 0x1, 0x0, "getnameinfo NI_NUMERICSERV failed: %s"); } v9 = atoi(&v4); LABEL_400703: return; }
openssh-portable
angr_phoenix
static size_t ck_fread(char *buf, size_t size, FILE *f) { size_t r = fread_unlocked(buf, sizeof(char), size, f); if (r == 0 && ferror_unlocked(f)) perror_fatal(gettext("read failed")); return r; }
size_t ck_fread(void *a1, size_t a2, FILE *a3) { char *v3; size_t v6; v6 = fread_unlocked(a1, 1uLL, a2, a3); if (!v6 && ferror_unlocked(a3)) { v3 = gettext("read failed"); perror_fatal(v3); } return v6; }
diffutils
ida
void print_word_list(list, separator) WORD_LIST *list; char *separator; { _print_word_list(list, separator, xprintf); }
long *print_word_list(long *a1, const char *a2, void (*a3)(const char *, ...)) { long *result; const char *v4; long *i; result = a1; for (i = a1; i; i = (long *)*i) { if (*i) v4 = a2; else v4 = (const char *)&unk_3583; a3("%s%s", *(const char **)i[1], v4); result = (long *)*i; } return result; }
bash
ida
static void parameter_brace_expand_error(name, value, check_null) char *name, *value; int check_null; { WORD_LIST *l; char *temp; set_exit_status(1); if (value && *value) { l = expand_string(value, 0); temp = string_list(l); report_error("%s: %s", name, temp ? temp : ""); do { if (temp) sh_xfree((temp), "subst.c", 7939); } while (0); dispose_words(l); } else if (check_null == 0) report_error(gettext("%s: parameter not set"), name); else report_error(gettext("%s: parameter null or not set"), name); sh_xfree((name), "subst.c", 7949); do { if (value) sh_xfree((value), "subst.c", 7950); } while (0); }
void parameter_brace_expand_error(unsigned long long a0, char *a1, unsigned int a2, unsigned long long a3, unsigned long long a4, unsigned long long a5) { void *v0; unsigned long long v1; unsigned long long v3; unsigned long long v4; unsigned long long v5; unsigned long long v6; unsigned long long v7; set_exit_status(0x1); if (a1 && *(a1)) { v0 = expand_string(a1, 0x0, a2, a3, a4, a5); v1 = string_list(v0); if (!v1) v5 = &g_41fa65; else v5 = v1; report_error("%s: %s", a0, v5, a0); if (v1) sh_xfree(v1, "subst.c", 0x1f03); dispose_words(v0); goto LABEL_41270b; } if (a2) { v4 = gettext("%s: parameter null or not set"); report_error(v4, a0, v4, a3); } else { v3 = gettext("%s: parameter not set"); report_error(v3, a0, v3, a3); } LABEL_41270b: v6 = sh_xfree(a0, "subst.c", 0x1f0d); if (a1) v7 = sh_xfree(a1, "subst.c", 0x1f0e); return; }
bash
angr_phoenix
static void print_usage(FILE *f) { fprintf(f, "Usage:\tip link add name NAME type hsr slave1 SLAVE1-IF slave2 " "SLAVE2-IF\n" "\t[ supervision ADDR-BYTE ] [version VERSION] [proto PROTOCOL]\n" "\n" "NAME\n" " name of new hsr device (e.g. hsr0)\n" "SLAVE1-IF, SLAVE2-IF\n" " the two slave devices bound to the HSR device\n" "ADDR-BYTE\n" " 0-255; the last byte of the multicast address used for HSR " "supervision\n" " frames (default = 0)\n" "VERSION\n" " 0,1; the protocol version to be used. (default = 0)\n" "PROTOCOL\n" " 0 - HSR, 1 - PRP. (default = 0 - HSR)\n"); }
int print_usage(FILE *a1) { return fprintf( a1, "Usage:\tip link add name NAME type hsr slave1 SLAVE1-IF slave2 " "SLAVE2-IF\n" "\t[ supervision ADDR-BYTE ] [version VERSION] [proto PROTOCOL]\n" "\n" "NAME\n" "\tname of new hsr device (e.g. hsr0)\n" "SLAVE1-IF, SLAVE2-IF\n" "\tthe two slave devices bound to the HSR device\n" "ADDR-BYTE\n" "\t0-255; the last byte of the multicast address used for HSR " "supervision\n" "\tframes (default = 0)\n" "VERSION\n" "\t0,1; the protocol version to be used. (default = 0)\n" "PROTOCOL\n" "\t0 - HSR, 1 - PRP. (default = 0 - HSR)\n"); }
iproute2-6.0.0
ida
static FILE *stream_open(char const *file, char const *how) { FILE *fp; if (*how == 'r') { if ((strcmp(file, "-") == 0)) { have_read_stdin = 1; fp = stdin; } else { int fd = open(file, 00 | 02000000); fp = fd < 0 ? ((void *)0) : fdopen(fd, how); } fadvise(fp, FADVISE_SEQUENTIAL); } else if (*how == 'w') { if (file && ftruncate(1, 0) != 0) { int ftruncate_errno = (*__errno_location()); struct stat *outst = get_outstatus(); if (!outst || ((((outst->st_mode)) & 0170000) == (0100000)) || ((outst)->st_mode - (outst)->st_mode)) ((!!sizeof(struct { _Static_assert( SORT_FAILURE, "verify_expr (" "SORT_FAILURE" ", " "(error (SORT_FAILURE, ftruncate_errno, gettext (\"%s: error " "truncating\"), quotearg_n_style_colon (0, " "shell_escape_quoting_style, file)), assume (false))" ")"); int _gl_dummy; })) ? ((error(SORT_FAILURE, ftruncate_errno, gettext("%s: error truncating"), quotearg_n_style_colon(0, shell_escape_quoting_style, file)), ((0) ? (void)0 : __builtin_unreachable()))) : ((error(SORT_FAILURE, ftruncate_errno, gettext("%s: error truncating"), quotearg_n_style_colon(0, shell_escape_quoting_style, file)), ((0) ? (void)0 : __builtin_unreachable())))); } fp = stdout; } else ((void)sizeof((!"unexpected mode passed to stream_open") ? 1 : 0), __extension__({ if (!"unexpected mode passed to stream_open") ; else __assert_fail("!\"unexpected mode passed to stream_open\"", "src/sort.c", 981, __extension__ __PRETTY_FUNCTION__); })); return fp; }
struct _IO_FILE *stream_open(const char *a1, const char *a2) { FILE *v2; long v3; char *v4; int errnum; int fd; struct _IO_FILE *v8; struct stat *outstatus; if (*a2 == 114) { if (!strcmp(a1, "-")) { have_read_stdin = 1; v8 = stdin; fadvise(stdin, 2LL); } else { fd = open(a1, 0x80000); if (fd < 0) v2 = 0LL; else v2 = fdopen(fd, a2); v8 = v2; fadvise(v2, 2LL); } } else { if (*a2 != 119) _assert_fail("!\"unexpected mode passed to stream_open\"", "src/sort.c", 0x3D5u, "stream_open"); if (a1) { if (ftruncate(1, 0LL)) { errnum = *_errno_location(); outstatus = get_outstatus(); if (!outstatus || (outstatus->st_mode & 0xF000) == 0x8000) { v3 = quotearg_n_style_colon(0LL, 3LL, a1); v4 = gettext("%s: error truncating"); error(2, errnum, v4, v3); } } } return stdout; } return v8; }
coreutils
ida
static void put_paragraph(WORD *finish) { WORD *w; put_line(unused_word_type, first_indent); for (w = unused_word_type->next_break; w != finish; w = w->next_break) put_line(w, other_indent); }
void put_paragraph(unsigned long a0) { struct_0 *v0; struct_0 *v2; put_line(&unused_word_type, first_indent); v0 = g_402f40; while (true) { v2 = v0; if (v0 == a0) break; put_line(v0, other_indent); v0 = v0->field_20; } return; }
coreutils
angr_sailr
static int display_shell_version(count, c) int count, c; { rl_crlf(); show_shell_version(0); putc('\r', rl_outstream); fflush(rl_outstream); rl_on_new_line(); rl_redisplay(); return 0; }
long long display_shell_version(unsigned long long a0, unsigned long long a1, unsigned long long a2, unsigned long long a3, unsigned long long a4, unsigned long long a5) { unsigned int v0; unsigned int v1; v1 = a0; v0 = a1; rl_crlf(); show_shell_version(0x0); putc(0xd, rl_outstream); fflush(rl_outstream); rl_on_new_line(a0, a1, a2, a3, a4, a5); rl_redisplay(a0, a1, a2, a3, a4, a5); return 0; }
bash
angr_phoenix
static _Bool parse_help(const struct parser_table *entry, char **argv, int *arg_ptr) { (void)entry; (void)argv; (void)arg_ptr; usage(0); }
long long parse_help(unsigned long a0, unsigned long a1) { unsigned long v0; unsigned long v1; unsigned long v2; unsigned long v4; v2 = a0; v1 = a1; v0 = v4; usage(0x0); }
findutils
angr_sailr
char *command_word_completion_function(hint_text, state) const char *hint_text; int state; { static char *hint = (char *)((void *)0); static char *path = (char *)((void *)0); static char *val = (char *)((void *)0); static char *filename_hint = (char *)((void *)0); static char *fnhint = (char *)((void *)0); static char *dequoted_hint = (char *)((void *)0); static char *directory_part = (char *)((void *)0); static char **glob_matches = (char **)((void *)0); static int path_index, hint_len, istate, igncase; static int mapping_over, local_index, searching_path, hint_is_dir; static int old_glob_ignore_case, globpat; static SHELL_VAR **varlist = (SHELL_VAR **)((void *)0); static alias_t **alias_list = (alias_t **)((void *)0); char *temp, *cval; if (state == 0) { rl_filename_stat_hook = bash_command_name_stat_hook; if (dequoted_hint && dequoted_hint != hint) sh_xfree((dequoted_hint), "bashline.c", 1993); if (hint) sh_xfree((hint), "bashline.c", 1995); mapping_over = searching_path = 0; hint_is_dir = (absolute_pathname(hint_text) == 0 && absolute_program(hint_text) == 0 && *(hint_text) != '~' && test_for_directory(hint_text)); val = (char *)((void *)0); temp = rl_variable_value("completion-ignore-case"); igncase = ((temp)[0] == 'o' && (temp)[1] == 'n' && (temp)[2] == '\0'); old_glob_ignore_case = glob_ignore_case; if (glob_matches) { sh_xfree((glob_matches), "bashline.c", 2008); glob_matches = (char **)((void *)0); } globpat = completion_glob_pattern((char *)hint_text); if (globpat || absolute_program(hint_text)) { if (*hint_text == '~') { hint = bash_tilde_expand(hint_text, 0); directory_part = (char *)strcpy( sh_xmalloc((1 + strlen(hint_text)), "bashline.c", 2027), (hint_text)); temp = strchr(directory_part, '/'); if (temp) *temp = 0; else { sh_xfree((directory_part), "bashline.c", 2033); directory_part = (char *)((void *)0); } } else if (dircomplete_expand) { hint = (char *)strcpy( sh_xmalloc((1 + strlen(hint_text)), "bashline.c", 2039), (hint_text)); bash_directory_completion_hook(&hint); } else hint = (char *)strcpy( sh_xmalloc((1 + strlen(hint_text)), "bashline.c", 2043), (hint_text)); dequoted_hint = hint; if (rl_completion_found_quote && rl_completion_quote_character == 0) { dequoted_hint = bash_dequote_filename(hint, 0); sh_xfree((hint), "bashline.c", 2054); hint = dequoted_hint; } hint_len = strlen(hint); if (filename_hint) sh_xfree((filename_hint), "bashline.c", 2060); fnhint = filename_hint = (char *)strcpy( sh_xmalloc((1 + strlen(hint)), "bashline.c", 2062), (hint)); istate = 0; if (globpat) { mapping_over = 5; goto globword; } else { if (dircomplete_expand && path_dot_or_dotdot(filename_hint)) { dircomplete_expand = 0; set_directory_hook(); dircomplete_expand = 1; } mapping_over = 4; goto inner; } } dequoted_hint = hint = (char *)strcpy( sh_xmalloc((1 + strlen(hint_text)), "bashline.c", 2084), (hint_text)); hint_len = strlen(hint); if (rl_completion_found_quote && rl_completion_quote_character == 0) dequoted_hint = bash_dequote_filename(hint, 0); path = get_string_value("PATH"); path_index = dot_in_path = 0; local_index = 0; if (varlist) sh_xfree((varlist), "bashline.c", 2097); varlist = all_visible_functions(); if (alias_list) sh_xfree((alias_list), "bashline.c", 2103); alias_list = all_aliases(); } switch (mapping_over) { case 0: while (alias_list && alias_list[local_index]) { register char *alias; alias = alias_list[local_index++]->name; if (igncase == 0 && (((hint_len == 0) ? (1) : ((alias)[0] == (hint)[0] && strncmp(alias, hint, hint_len) == 0)))) return ((char *)strcpy( sh_xmalloc((1 + strlen(alias)), "bashline.c", 2123), (alias))); else if (igncase && strncasecmp(alias, hint, hint_len) == 0) return ((char *)strcpy( sh_xmalloc((1 + strlen(alias)), "bashline.c", 2125), (alias))); } local_index = 0; mapping_over++; case 1: { while (word_token_alist[local_index].word) { register char *reserved_word; reserved_word = word_token_alist[local_index++].word; if (((hint_len == 0) ? (1) : ((reserved_word)[0] == (hint)[0] && strncmp(reserved_word, hint, hint_len) == 0))) return ((char *)strcpy( sh_xmalloc((1 + strlen(reserved_word)), "bashline.c", 2140), (reserved_word))); } local_index = 0; mapping_over++; } case 2: while (varlist && varlist[local_index]) { register char *varname; varname = varlist[local_index++]->name; if (igncase == 0 && (((hint_len == 0) ? (1) : ((varname)[0] == (hint)[0] && strncmp(varname, hint, hint_len) == 0)))) return ((char *)strcpy( sh_xmalloc((1 + strlen(varname)), "bashline.c", 2155), (varname))); else if (igncase && strncasecmp(varname, hint, hint_len) == 0) return ((char *)strcpy( sh_xmalloc((1 + strlen(varname)), "bashline.c", 2157), (varname))); } local_index = 0; mapping_over++; case 3: for (; local_index < num_shell_builtins; local_index++) { if (!shell_builtins[local_index].function || (shell_builtins[local_index].flags & 0x01) == 0) continue; if (((hint_len == 0) ? (1) : ((shell_builtins[local_index].name)[0] == (hint)[0] && strncmp(shell_builtins[local_index].name, hint, hint_len) == 0))) { int i = local_index++; return ((char *)strcpy(sh_xmalloc((1 + strlen(shell_builtins[i].name)), "bashline.c", 2175), (shell_builtins[i].name))); } } local_index = 0; mapping_over++; } globword: if (globpat) { if (state == 0) { rl_filename_completion_desired = 1; glob_ignore_case = igncase; glob_matches = shell_glob_filename(hint, 0); glob_ignore_case = old_glob_ignore_case; if ((glob_matches) == (char **)&glob_error_return || glob_matches == 0) { glob_matches = (char **)((void *)0); return ((char *)((void *)0)); } local_index = 0; if (glob_matches[1] && rl_completion_type == '\t') return ((char *)((void *)0)); } while (val = glob_matches[local_index++]) { if (executable_or_directory(val)) { if (*hint_text == '~' && directory_part) { temp = maybe_restore_tilde(val, directory_part); sh_xfree((val), "bashline.c", 2216); val = temp; } return (val); } sh_xfree((val), "bashline.c", 2221); } glob_ignore_case = old_glob_ignore_case; return ((char *)((void *)0)); } if (hint_is_dir) { hint_is_dir = 0; return ((char *)strcpy( sh_xmalloc((1 + strlen(hint_text)), "bashline.c", 2235), (hint_text))); } outer: istate = (val != (char *)((void *)0)); if (istate == 0) { char *current_path; if (path == 0 || path[path_index] == 0 || (current_path = extract_colon_unit(path, &path_index)) == 0) return ((char *)((void *)0)); searching_path = 1; if (*current_path == 0) { sh_xfree((current_path), "bashline.c", 2258); current_path = (char *)strcpy( sh_xmalloc((1 + strlen(".")), "bashline.c", 2259), (".")); } if (*current_path == '~') { char *t; t = bash_tilde_expand(current_path, 0); sh_xfree((current_path), "bashline.c", 2267); current_path = t; } if (current_path[0] == '.' && current_path[1] == '\0') dot_in_path = 1; if (fnhint && fnhint != filename_hint) sh_xfree((fnhint), "bashline.c", 2275); if (filename_hint) sh_xfree((filename_hint), "bashline.c", 2277); filename_hint = sh_makepath(current_path, hint, 0); if (strpbrk(filename_hint, "\"'\\")) fnhint = sh_backslash_quote(filename_hint, filename_bstab, 0); else fnhint = filename_hint; sh_xfree((current_path), "bashline.c", 2288); } inner: val = rl_filename_completion_function(fnhint, istate); if (mapping_over == 4 && dircomplete_expand) set_directory_hook(); istate = 1; if (val == 0) { if (absolute_program(hint)) return ((char *)((void *)0)); goto outer; } else { int match, freetemp; if (absolute_program(hint)) { match = 1; if (*hint_text == '~') temp = maybe_restore_tilde(val, directory_part); else temp = (char *)strcpy(sh_xmalloc((1 + strlen(val)), "bashline.c", 2329), (val)); freetemp = 1; } else { temp = strrchr(val, '/'); if (temp) { temp++; if (igncase == 0) freetemp = match = strncmp(temp, hint, hint_len) == 0; else freetemp = match = strncasecmp(temp, hint, hint_len) == 0; if (match) temp = (char *)strcpy( sh_xmalloc((1 + strlen(temp)), "bashline.c", 2344), (temp)); } else freetemp = match = 0; } cval = val; if (match && executable_completion((searching_path ? val : cval), searching_path)) { if (cval != val) sh_xfree((cval), "bashline.c", 2381); sh_xfree((val), "bashline.c", 2382); val = ""; return (temp); } else { if (freetemp) sh_xfree((temp), "bashline.c", 2389); if (cval != val) sh_xfree((cval), "bashline.c", 2391); sh_xfree((val), "bashline.c", 2392); goto inner; } } }
char *command_word_completion_function(char *param_1, int param_2) { int iVar1; char *pcVar2; size_t sVar3; char *pcVar4; long lVar5; bool bVar6; char *local_38; char *local_30; if (param_2 == 0) { _rl_filename_stat_hook = bash_command_name_stat_hook; if ((dequoted_hint_11525 != (char *)0x0) && (dequoted_hint_11525 != hint_11520)) { sh_xfree(dequoted_hint_11525, "bashline.c", 0x7c9); } if (hint_11520 != (char *)0x0) { sh_xfree(hint_11520, "bashline.c", 0x7cb); } searching_path_11534 = 0; mapping_over_11532 = 0; iVar1 = absolute_pathname(param_1); if ((((iVar1 == 0) && (iVar1 = absolute_program(param_1), iVar1 == 0)) && (*param_1 != '~')) && (iVar1 = test_for_directory(param_1), iVar1 != 0)) { hint_is_dir_11535 = 1; } else { hint_is_dir_11535 = 0; } val_11522 = (char *)0x0; pcVar2 = (char *)rl_variable_value("completion-ignore-case"); if (((*pcVar2 == 'o') && (pcVar2[1] == 'n')) && (pcVar2[2] == '\0')) { igncase_11531 = 1; } else { igncase_11531 = 0; } old_glob_ignore_case_11536 = glob_ignore_case; if (glob_matches_11527 != (undefined *)0x0) { sh_xfree(glob_matches_11527, "bashline.c", 0x7d8); glob_matches_11527 = (undefined *)0x0; } globpat_11537 = completion_glob_pattern(param_1); if ((globpat_11537 != 0) || (iVar1 = absolute_program(param_1), iVar1 != 0)) { if (*param_1 == '~') { hint_11520 = (char *)bash_tilde_expand(param_1, 0); sVar3 = strlen(param_1); pcVar2 = (char *)sh_xmalloc(sVar3 + 1, "bashline.c", 0x7eb); directory_part_11526 = strcpy(pcVar2, param_1); pcVar2 = strchr(directory_part_11526, 0x2f); if (pcVar2 == (char *)0x0) { sh_xfree(directory_part_11526, "bashline.c", 0x7f1); directory_part_11526 = (char *)0x0; } else { *pcVar2 = '\0'; } } else if (dircomplete_expand == 0) { sVar3 = strlen(param_1); pcVar2 = (char *)sh_xmalloc(sVar3 + 1, "bashline.c", 0x7fb); hint_11520 = strcpy(pcVar2, param_1); } else { sVar3 = strlen(param_1); pcVar2 = (char *)sh_xmalloc(sVar3 + 1, "bashline.c", 0x7f7); hint_11520 = strcpy(pcVar2, param_1); bash_directory_completion_hook(&hint_11520); } dequoted_hint_11525 = hint_11520; if ((rl_completion_found_quote != 0) && (rl_completion_quote_character == 0)) { dequoted_hint_11525 = (char *)bash_dequote_filename(hint_11520, 0); sh_xfree(hint_11520, "bashline.c", 0x806); hint_11520 = dequoted_hint_11525; } dequoted_hint_11525 = hint_11520; sVar3 = strlen(hint_11520); hint_len_11529 = (int)sVar3; if (filename_hint_11523 != (char *)0x0) { sh_xfree(filename_hint_11523, "bashline.c", 0x80c); } pcVar2 = hint_11520; sVar3 = strlen(hint_11520); pcVar4 = (char *)sh_xmalloc(sVar3 + 1, "bashline.c", 0x80e); filename_hint_11523 = strcpy(pcVar4, pcVar2); istate_11530 = 0; fnhint_11524 = filename_hint_11523; if (globpat_11537 == 0) { if ((dircomplete_expand != 0) && (iVar1 = path_dot_or_dotdot(filename_hint_11523), iVar1 != 0)) { dircomplete_expand = 0; set_directory_hook(); dircomplete_expand = 1; } mapping_over_11532 = 4; goto LAB_00104c9d; } mapping_over_11532 = 5; goto LAB_0010487d; } sVar3 = strlen(param_1); pcVar2 = (char *)sh_xmalloc(sVar3 + 1, "bashline.c", 0x824); dequoted_hint_11525 = strcpy(pcVar2, param_1); hint_11520 = dequoted_hint_11525; sVar3 = strlen(dequoted_hint_11525); hint_len_11529 = (int)sVar3; if ((rl_completion_found_quote != 0) && (rl_completion_quote_character == 0)) { dequoted_hint_11525 = (char *)bash_dequote_filename(hint_11520, 0); } path_11521 = get_string_value(&DAT_0010a558); dot_in_path = 0; path_index_11528 = 0; local_index_11533 = 0; if (varlist_11538 != 0) { sh_xfree(varlist_11538, "bashline.c", 0x831); } varlist_11538 = all_visible_functions(); if (alias_list_11539 != 0) { sh_xfree(alias_list_11539, "bashline.c", 0x837); } alias_list_11539 = all_aliases(); } if (mapping_over_11532 != 3) { if (3 < mapping_over_11532) goto LAB_0010487d; if (mapping_over_11532 != 2) { if (2 < mapping_over_11532) goto LAB_0010487d; if (mapping_over_11532 == 0) { while (( alias_list_11539 != 0 && (*(long *)(alias_list_11539 + (long)local_index_11533 * 8) != 0))) { iVar1 = local_index_11533 + 1; pcVar2 = **(char ***)((long)local_index_11533 * 8 + alias_list_11539); local_index_11533 = iVar1; if ((igncase_11531 == 0) && ((hint_len_11529 == 0 || ((*pcVar2 == *hint_11520 && (iVar1 = strncmp(pcVar2, hint_11520, (long)hint_len_11529), iVar1 == 0)))))) { sVar3 = strlen(pcVar2); pcVar4 = (char *)sh_xmalloc(sVar3 + 1, "bashline.c", 0x84b); pcVar2 = strcpy(pcVar4, pcVar2); return pcVar2; } if ((igncase_11531 != 0) && (iVar1 = strncasecmp(pcVar2, hint_11520, (long)hint_len_11529), iVar1 == 0)) { sVar3 = strlen(pcVar2); pcVar4 = (char *)sh_xmalloc(sVar3 + 1, "bashline.c", 0x84d); pcVar2 = strcpy(pcVar4, pcVar2); return pcVar2; } } local_index_11533 = 0; mapping_over_11532 = mapping_over_11532 + 1; } else if (mapping_over_11532 != 1) goto LAB_0010487d; while ((&word_token_alist)[(long)local_index_11533 * 2] != 0) { iVar1 = local_index_11533 + 1; pcVar2 = (char *)(&word_token_alist)[(long)local_index_11533 * 2]; local_index_11533 = iVar1; if ((hint_len_11529 == 0) || ((*pcVar2 == *hint_11520 && (iVar1 = strncmp(pcVar2, hint_11520, (long)hint_len_11529), iVar1 == 0)))) { sVar3 = strlen(pcVar2); pcVar4 = (char *)sh_xmalloc(sVar3 + 1, "bashline.c", 0x85c); pcVar2 = strcpy(pcVar4, pcVar2); return pcVar2; } } local_index_11533 = 0; mapping_over_11532 = mapping_over_11532 + 1; } while ((varlist_11538 != 0 && (*(long *)(varlist_11538 + (long)local_index_11533 * 8) != 0))) { iVar1 = local_index_11533 + 1; pcVar2 = **(char ***)((long)local_index_11533 * 8 + varlist_11538); local_index_11533 = iVar1; if ((igncase_11531 == 0) && ((hint_len_11529 == 0 || ((*pcVar2 == *hint_11520 && (iVar1 = strncmp(pcVar2, hint_11520, (long)hint_len_11529), iVar1 == 0)))))) { sVar3 = strlen(pcVar2); pcVar4 = (char *)sh_xmalloc(sVar3 + 1, "bashline.c", 0x86b); pcVar2 = strcpy(pcVar4, pcVar2); return pcVar2; } if ((igncase_11531 != 0) && (iVar1 = strncasecmp(pcVar2, hint_11520, (long)hint_len_11529), iVar1 == 0)) { sVar3 = strlen(pcVar2); pcVar4 = (char *)sh_xmalloc(sVar3 + 1, "bashline.c", 0x86d); pcVar2 = strcpy(pcVar4, pcVar2); return pcVar2; } } local_index_11533 = 0; mapping_over_11532 = mapping_over_11532 + 1; } for (; local_index_11533 < num_shell_builtins; local_index_11533 = local_index_11533 + 1) { if (((*(long *)((long)local_index_11533 * 0x30 + shell_builtins + 8) != 0) && ((*(uint *)((long)local_index_11533 * 0x30 + shell_builtins + 0x10) & 1) != 0)) && ((hint_len_11529 == 0 || ((**(char **)((long)local_index_11533 * 0x30 + shell_builtins) == *hint_11520 && (iVar1 = strncmp( *(char **)((long)local_index_11533 * 0x30 + shell_builtins), hint_11520, (long)hint_len_11529), iVar1 == 0)))))) { pcVar2 = *(char **)((long)local_index_11533 * 0x30 + shell_builtins); lVar5 = (long)local_index_11533; local_index_11533 = local_index_11533 + 1; sVar3 = strlen(*(char **)(lVar5 * 0x30 + shell_builtins)); pcVar4 = (char *)sh_xmalloc(sVar3 + 1, "bashline.c", 0x87f); pcVar2 = strcpy(pcVar4, pcVar2); return pcVar2; } } local_index_11533 = 0; mapping_over_11532 = mapping_over_11532 + 1; LAB_0010487d: if (globpat_11537 == 0) { if (hint_is_dir_11535 != 0) { hint_is_dir_11535 = 0; sVar3 = strlen(param_1); pcVar2 = (char *)sh_xmalloc(sVar3 + 1, "bashline.c", 0x8bb); pcVar2 = strcpy(pcVar2, param_1); return pcVar2; } do { istate_11530 = (uint)(val_11522 != (char *)0x0); if (istate_11530 == 0) { if (((path_11521 == 0) || (*(char *)(path_index_11528 + path_11521) == '\0')) || (local_30 = (char *)extract_colon_unit(path_11521, &path_index_11528), local_30 == (char *)0x0)) { return (char *)0x0; } searching_path_11534 = 1; if (*local_30 == '\0') { sh_xfree(local_30, "bashline.c", 0x8d2); sVar3 = strlen("."); pcVar2 = (char *)sh_xmalloc(sVar3 + 1, "bashline.c", 0x8d3); local_30 = strcpy(pcVar2, "."); } if (*local_30 == '~') { pcVar2 = (char *)bash_tilde_expand(local_30, 0); sh_xfree(local_30, "bashline.c", 0x8db); local_30 = pcVar2; } if ((*local_30 == '.') && (local_30[1] == '\0')) { dot_in_path = 1; } if ((fnhint_11524 != (char *)0x0) && (fnhint_11524 != filename_hint_11523)) { sh_xfree(fnhint_11524, "bashline.c", 0x8e3); } if (filename_hint_11523 != (char *)0x0) { sh_xfree(filename_hint_11523, "bashline.c", 0x8e5); } filename_hint_11523 = (char *)sh_makepath(local_30, hint_11520, 0); pcVar2 = strpbrk(filename_hint_11523, "\"\'\\"); if (pcVar2 == (char *)0x0) { fnhint_11524 = filename_hint_11523; } else { fnhint_11524 = (char *)sh_backslash_quote(filename_hint_11523, filename_bstab, 0); } sh_xfree(local_30, "bashline.c", 0x8f0); } LAB_00104c9d: while (true) { val_11522 = (char *)rl_filename_completion_function(fnhint_11524, istate_11530); if ((mapping_over_11532 == 4) && (dircomplete_expand != 0)) { set_directory_hook(); } istate_11530 = 1; if (val_11522 == (char *)0x0) break; iVar1 = absolute_program(hint_11520); pcVar2 = val_11522; if (iVar1 == 0) { local_38 = strrchr(val_11522, 0x2f); if (local_38 == (char *)0x0) { bVar6 = false; } else { local_38 = local_38 + 1; if (igncase_11531 == 0) { iVar1 = strncmp(local_38, hint_11520, (long)hint_len_11529); } else { iVar1 = strncasecmp(local_38, hint_11520, (long)hint_len_11529); } bVar6 = iVar1 == 0; if (bVar6) { sVar3 = strlen(local_38); pcVar2 = (char *)sh_xmalloc(sVar3 + 1, "bashline.c", 0x928); local_38 = strcpy(pcVar2, local_38); } } } else { if (*param_1 == '~') { local_38 = (char *)maybe_restore_tilde(val_11522, directory_part_11526); } else { sVar3 = strlen(val_11522); pcVar4 = (char *)sh_xmalloc(sVar3 + 1, "bashline.c", 0x919); local_38 = strcpy(pcVar4, pcVar2); } bVar6 = true; } pcVar2 = val_11522; if ((bVar6) && (iVar1 = executable_completion(val_11522, searching_path_11534), iVar1 != 0)) { if (pcVar2 != val_11522) { sh_xfree(pcVar2, "bashline.c", 0x94d); } sh_xfree(val_11522, "bashline.c", 0x94e); val_11522 = &DAT_0010a4a2; return local_38; } if (bVar6) { sh_xfree(local_38, "bashline.c", 0x955); } if (pcVar2 != val_11522) { sh_xfree(pcVar2, "bashline.c", 0x957); } sh_xfree(val_11522, "bashline.c", 0x958); } iVar1 = absolute_program(hint_11520); if (iVar1 != 0) { return (char *)0x0; } } while (true); } if (param_2 == 0) { _rl_filename_completion_desired = 1; glob_ignore_case = igncase_11531; glob_matches_11527 = (undefined *)shell_glob_filename(hint_11520, 0); glob_ignore_case = old_glob_ignore_case_11536; if ((glob_matches_11527 == &glob_error_return) || (glob_matches_11527 == (undefined *)0x0)) { glob_matches_11527 = (undefined *)0x0; glob_ignore_case = old_glob_ignore_case_11536; return (char *)0x0; } local_index_11533 = 0; if ((*(long *)(glob_matches_11527 + 8) != 0) && (rl_completion_type == 9)) { local_index_11533 = 0; glob_ignore_case = old_glob_ignore_case_11536; return (char *)0x0; } } while (true) { val_11522 = *(char **)(glob_matches_11527 + (long)local_index_11533 * 8); if (val_11522 == (char *)0x0) { local_index_11533 = local_index_11533 + 1; glob_ignore_case = old_glob_ignore_case_11536; return (char *)0x0; } local_index_11533 = local_index_11533 + 1; iVar1 = executable_or_directory(val_11522); if (iVar1 != 0) break; sh_xfree(val_11522, "bashline.c", 0x8ad); } if (*param_1 != '~') { return val_11522; } if (directory_part_11526 == (char *)0x0) { return val_11522; } pcVar2 = (char *)maybe_restore_tilde(val_11522, directory_part_11526); sh_xfree(val_11522, "bashline.c", 0x8a8); val_11522 = pcVar2; return pcVar2; }
bash
ghidra
static void explain(void) { print_explain(stderr); }
int explain() { return print_explain(stderr); }
iproute2-6.0.0
ida
static _Noreturn void xexec(const char *cmd) { char *argv[4]; argv[0] = (char *)"/bin/sh"; argv[1] = (char *)"-c"; argv[2] = (char *)cmd; argv[3] = ((void *)0); execv("/bin/sh", argv); exec_fatal(cmd); }
void xexec(unsigned long long a0) { unsigned long long v0; unsigned long long v1; unsigned long v2; void *v3; unsigned long v4; unsigned long long *v6; v4 = v6[5]; v0 = "/bin/sh"; v1 = "-c"; v2 = a0; v3 = 0; execv("/bin/sh", &v0); exec_fatal(a0); }
tar
angr_sailr
int do_crossload(struct sftp_conn *from, struct sftp_conn *to, const char *from_path, const char *to_path, Attrib *a, int preserve_flag) { struct sshbuf *msg; int write_error, read_error, r; u_int64_t offset = 0, size; u_int id, buflen, num_req, max_req, status = 0; u_int num_upload_req; off_t progress_counter; u_char *from_handle, *to_handle; size_t from_handle_len, to_handle_len; struct requests requests; struct request *req; u_char type; sshlog("sftp-client.c", __func__, 2404, 1, SYSLOG_LEVEL_DEBUG2, ((void *)0), "crossload src \"%s\" to dst \"%s\"", from_path, to_path); do { (&requests)->tqh_first = ((void *)0); (&requests)->tqh_last = &(&requests)->tqh_first; } while (0); if (a == ((void *)0) && (a = do_stat(from, from_path, 0)) == ((void *)0)) return -1; if ((a->flags & 0x00000004) && (!((((a->perm)) & 0170000) == (0100000)))) { sshlog("sftp-client.c", __func__, 2413, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "download \"%s\": not a regular file", from_path); return (-1); } if (a->flags & 0x00000001) size = a->size; else size = 0; buflen = from->download_buflen; if (buflen > to->upload_buflen) buflen = to->upload_buflen; if (send_open(from, from_path, "origin", 0x00000001, ((void *)0), &from_handle, &from_handle_len) != 0) return -1; a->flags &= ~0x00000001; a->flags &= ~0x00000002; a->perm &= 0777; if (!preserve_flag) a->flags &= ~0x00000008; if (send_open(to, to_path, "dest", 0x00000002 | 0x00000008 | 0x00000010, a, &to_handle, &to_handle_len) != 0) { do_close(from, from_handle, from_handle_len); return -1; } offset = 0; write_error = read_error = num_req = num_upload_req = 0; max_req = 1; progress_counter = 0; if (showprogress && size != 0) { start_progress_meter(progress_meter_path(from_path), size, &progress_counter); } if ((msg = sshbuf_new()) == ((void *)0)) sshfatal("sftp-client.c", __func__, 2454, 1, SYSLOG_LEVEL_FATAL, ((void *)0), "sshbuf_new failed"); while (num_req > 0 || max_req > 0) { u_char *data; size_t len; if (interrupted) { if (num_req == 0) break; max_req = 0; } while (num_req < max_req) { sshlog("sftp-client.c", __func__, 2471, 0, SYSLOG_LEVEL_DEBUG3, ((void *)0), "Request range %llu -> %llu (%d/%d)", (unsigned long long)offset, (unsigned long long)offset + buflen - 1, num_req, max_req) ; req = request_enqueue(&requests, from->msg_id++, buflen, offset); offset += buflen; num_req++; send_read_request(from, req->id, req->offset, req->len, from_handle, from_handle_len); } handle_dest_replies(to, to_path, 0, &num_upload_req, &write_error); sshbuf_reset(msg); get_msg(from, msg); if ((r = sshbuf_get_u8(msg, &type)) != 0 || (r = sshbuf_get_u32(msg, &id)) != 0) sshfatal("sftp-client.c", __func__, 2491, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "parse"); sshlog("sftp-client.c", __func__, 2492, 0, SYSLOG_LEVEL_DEBUG3, ((void *)0), "Received origin reply T:%u I:%u R:%d", type, id, max_req); if ((req = request_find(&requests, id)) == ((void *)0)) sshfatal("sftp-client.c", __func__, 2497, 0, SYSLOG_LEVEL_FATAL, ((void *)0), "Unexpected reply %u", id); switch (type) { case 101: if ((r = sshbuf_get_u32(msg, &status)) != 0) sshfatal("sftp-client.c", __func__, 2502, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "parse status"); if (status != 1) read_error = 1; max_req = 0; do { if (((req)->tq.tqe_next) != ((void *)0)) (req)->tq.tqe_next->tq.tqe_prev = (req)->tq.tqe_prev; else (&requests)->tqh_last = (req)->tq.tqe_prev; *(req)->tq.tqe_prev = (req)->tq.tqe_next; ; ; } while (0); free(req); num_req--; break; case 103: if ((r = sshbuf_get_string(msg, &data, &len)) != 0) sshfatal("sftp-client.c", __func__, 2512, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "parse data"); sshlog("sftp-client.c", __func__, 2513, 0, SYSLOG_LEVEL_DEBUG3, ((void *)0), "Received data %llu -> %llu", (unsigned long long)req->offset, (unsigned long long)req->offset + len - 1) ; if (len > req->len) sshfatal("sftp-client.c", __func__, 2517, 0, SYSLOG_LEVEL_FATAL, ((void *)0), "Received more data than asked for " "%zu > %zu", len, req->len); sshbuf_reset(msg); if ((r = sshbuf_put_u8(msg, 6)) != 0 || (r = sshbuf_put_u32(msg, to->msg_id++)) != 0 || (r = sshbuf_put_string(msg, to_handle, to_handle_len)) != 0 || (r = sshbuf_put_u64(msg, req->offset)) != 0 || (r = sshbuf_put_string(msg, data, len)) != 0) sshfatal("sftp-client.c", __func__, 2528, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "compose write"); send_msg(to, msg); sshlog("sftp-client.c", __func__, 2530, 0, SYSLOG_LEVEL_DEBUG3, ((void *)0), "Sent message SSH2_FXP_WRITE I:%u O:%llu S:%zu", id, (unsigned long long)offset, len); num_upload_req++; progress_counter += len; free(data); if (len == req->len) { do { if (((req)->tq.tqe_next) != ((void *)0)) (req)->tq.tqe_next->tq.tqe_prev = (req)->tq.tqe_prev; else (&requests)->tqh_last = (req)->tq.tqe_prev; *(req)->tq.tqe_prev = (req)->tq.tqe_next; ; ; } while (0); free(req); num_req--; } else { sshlog("sftp-client.c", __func__, 2542, 0, SYSLOG_LEVEL_DEBUG3, ((void *)0), "Short data block, re-requesting " "%llu -> %llu (%2d)", (unsigned long long)req->offset + len, (unsigned long long)req->offset + req->len - 1, num_req) ; req->id = from->msg_id++; req->len -= len; req->offset += len; send_read_request(from, req->id, req->offset, req->len, from_handle, from_handle_len); if (len < buflen) buflen = (((512) > (len)) ? (512) : (len)); } if (max_req > 0) { if (size > 0 && offset > size) { sshlog("sftp-client.c", __func__, 2561, 0, SYSLOG_LEVEL_DEBUG3, ((void *)0), "Finish at %llu (%2d)", (unsigned long long)offset, num_req) ; max_req = 1; } else if (max_req < from->num_requests) { ++max_req; } } break; default: sshfatal("sftp-client.c", __func__, 2571, 0, SYSLOG_LEVEL_FATAL, ((void *)0), "Expected SSH2_FXP_DATA(%u) packet, got %u", 103, type); } } if (showprogress && size) stop_progress_meter(); sshlog("sftp-client.c", __func__, 2580, 1, SYSLOG_LEVEL_DEBUG3, ((void *)0), "waiting for %u replies from destination", num_upload_req); handle_dest_replies(to, to_path, 1, &num_upload_req, &write_error); if (((&requests)->tqh_first) != ((void *)0)) sshfatal("sftp-client.c", __func__, 2585, 0, SYSLOG_LEVEL_FATAL, ((void *)0), "Transfer complete, but requests still in queue"); if (read_error || write_error || interrupted) { sshlog("sftp-client.c", __func__, 2588, 0, SYSLOG_LEVEL_DEBUG1, ((void *)0), "truncating \"%s\" at 0", to_path); do_close(to, to_handle, to_handle_len); free(to_handle); if (send_open(to, to_path, "dest", 0x00000002 | 0x00000008 | 0x00000010, a, &to_handle, &to_handle_len) != 0) { sshlog("sftp-client.c", __func__, 2594, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "dest truncate \"%s\" failed", to_path); to_handle = ((void *)0); } } if (read_error) { sshlog("sftp-client.c", __func__, 2599, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "read origin \"%s\": %s", from_path, fx2txt(status)); status = -1; do_close(from, from_handle, from_handle_len); if (to_handle != ((void *)0)) do_close(to, to_handle, to_handle_len); } else if (write_error) { sshlog("sftp-client.c", __func__, 2605, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "write dest \"%s\": %s", to_path, fx2txt(write_error)); status = 4; do_close(from, from_handle, from_handle_len); if (to_handle != ((void *)0)) do_close(to, to_handle, to_handle_len); } else { if (do_close(from, from_handle, from_handle_len) != 0 || interrupted) status = -1; else status = 0; if (to_handle != ((void *)0)) { if (preserve_flag) do_fsetstat(to, to_handle, to_handle_len, a); do_close(to, to_handle, to_handle_len); } } sshbuf_free(msg); free(from_handle); free(to_handle); return status == 0 ? 0 : -1; }
int do_crossload(unsigned int a0[7], void *a1, char *a2, unsigned long long a3, unsigned long long a4, unsigned long a5) { unsigned long long v0; int tmp_22; int tmp_13; int tmp_42; void *v1; unsigned long v2; unsigned long v3; unsigned long v4; unsigned long v5; struct_0 *v6; unsigned int v7[7]; unsigned int v8[7]; char v9; unsigned int v10; char v11; unsigned int v12; unsigned int v13; unsigned int v14; unsigned int v15; unsigned int v16; unsigned int v17; unsigned int v18; void *v19; char v20; void *v21; char v22; char v23; char v24; char v25; void *v26; void *v27; unsigned long long v28; struct_1 *v29; void *v30; unsigned long long *v31; unsigned long long v32; unsigned long v33; unsigned long v34; unsigned long v35; char v36; unsigned int v38; *(&v8[0]) = a0; *(&v7[0]) = a1; v6 = a4; v26 = 0; v12 = 0; v4 = a2; sshlog("sftp-client.c", "do_crossload", 0x964, 0x1, 0x6, 0x0, "crossload src \"%s\" to dst \"%s\""); v30 = 0; v31 = &v30; if (!v6) { v6 = do_stat(a0, a2, 0x0); if (!v6) v38 = -1; } if (v6 || v6) { if ((v6->field_0 & 4) && (v6->field_18 & 0xf000) != 0x8000) { v5 = a2; sshlog("sftp-client.c", "do_crossload", 0x96d, 0x0, 0x2, 0x0, "download \"%s\": not a regular file"); v38 = -1; } if (!(v6->field_0 & 4) || (v6->field_18 & 0xf000) == 0x8000) { if ((v6->field_0 & 1)) v27 = v6->field_8; else v27 = 0; v16 = a0[2]; if (v16 > v7[3]) v16 = v7[3]; v38 = send_open(a0, a2, "origin", 0x1, 0x0, &v20, &v22); if (v38) { v38 = -1; } else { v6->field_0 = v6->field_0 & -2; v6->field_0 = v6->field_0 & -3; v6->field_18 = v6->field_18 & 511; if (!a5) v6->field_0 = v6->field_0 & -9; v38 = send_open(v7, a3, "dest", 0x1a, v6, &v21, &v23); if (v38) { do_close(a0, *(&v20), *(&v22)); v38 = -1; } else { v26 = 0; v13 = 0; v17 = v13; v14 = v17; v10 = v14; v18 = 1; v19 = 0; if (showprogress && v27) { v38 = progress_meter_path(a2); start_progress_meter(v38, v27, &v19, v38); } v28 = sshbuf_new(); if (!v28) sshfatal("sftp-client.c", "do_crossload", 0x996, 0x1, 0x1, 0x0, "sshbuf_new failed"); while (true) { if (!v17) { if (!v18) break; } if (interrupted) { if (!v17) break; if (v17) v18 = 0; } while (v17 < v18) { v3 = v17; v2 = v26 + v16 - 1; v1 = v26; v0 = "Request range %llu -> %llu (%d/%d)"; sshlog("sftp-client.c", "do_crossload", 0x9a7, 0x0, 0x7, 0x0, *(&v36)); tmp_22 = a0[6]; a0[6] = a0[6] + 1; v29 = request_enqueue(&v30, tmp_22, v16, v26); v26 += v16; v17 += 1; send_read_request(a0, v29->field_0, v29->field_10, v29->field_8, *(&v20), *(&v22)); } handle_dest_replies(v7, a3, 0x0, &v13, &v10); sshbuf_reset(v28); get_msg(a0, v28); v15 = sshbuf_get_u8(v28, &v9, &v9); if (!v15) v15 = sshbuf_get_u32(v28, &v11, &v11); if (v15 || v15) sshfatal("sftp-client.c", "do_crossload", 0x9bb, 0x1, 0x1, ssh_err(v15), *(&v36)); v35 = v18; v34 = *(&v11); v33 = v9; v32 = "Received origin reply T:%u I:%u R:%d"; sshlog("sftp-client.c", "do_crossload", 0x9bc, 0x0, 0x7, 0x0, *(&v36)); v29 = request_find(&v30, *(&v11)); if (!v29) { v35 = *(&v11); v34 = "Unexpected reply %u"; sshfatal("sftp-client.c", "do_crossload", 0x9c1, 0x0, 0x1, 0x0, *(&v36)); } v38 = v9; if (v9 == 101) { v15 = sshbuf_get_u32(v28, &v12, &v12); if (v15) { v34 = "parse status"; sshfatal("sftp-client.c", "do_crossload", 0x9c6, 0x1, 0x1, ssh_err(v15), *(&v36)); } if (v12 != 1) v14 = 1; v18 = 0; if (v29->field_18) v29->field_18->field_20 = v29->field_20; else v31 = &v29->field_20->field_0; v29->field_20->field_0 = v29->field_18; free(v29); v17 -= 1; } else if (v38 == 103) { v15 = sshbuf_get_string(v28, &v24, &v25, &v24); if (v15) { v34 = "parse data"; sshfatal("sftp-client.c", "do_crossload", 0x9d0, 0x1, 0x1, ssh_err(v15), *(&v36)); } v34 = *(&v25) + v29->field_10 - 1; v33 = v29->field_10; v32 = "Received data %llu -> %llu"; sshlog("sftp-client.c", "do_crossload", 0x9d1, 0x0, 0x7, 0x0, *(&v36)); if (v29->field_8 < *(&v25)) { v34 = v29->field_8; v33 = *(&v25); v32 = "Received more data than asked for %zu > %zu"; sshfatal("sftp-client.c", "do_crossload", 0x9d5, 0x0, 0x1, 0x0, *(&v36)); } sshbuf_reset(v28); v15 = sshbuf_put_u8(v28, 0x6, a2); if (!v15) { tmp_13 = v7[6]; v7[6] = v7[6] + 1; v15 = sshbuf_put_u32(v28, tmp_13, v28); if (!v15) { v15 = sshbuf_put_string(v28, v21, *(&v23), v21); if (!v15) { v15 = sshbuf_put_u64(v28, v29->field_10); if (!v15) v15 = sshbuf_put_string(v28, *(&v24), *(&v25), *(&v24)); } } } if (v15 || v15 || v15 || v15 || v15) { v34 = "compose write"; sshfatal("sftp-client.c", "do_crossload", 0x9e0, 0x1, 0x1, ssh_err(v15), *(&v36)); } send_msg(v7, v28); v35 = *(&v25); v34 = v26; v33 = *(&v11); v32 = "Sent message SSH2_FXP_WRITE I:%u O:%llu S:%zu"; sshlog("sftp-client.c", "do_crossload", 0x9e2, 0x0, 0x7, 0x0, *(&v36)); v13 += 1; v19 = *(&v25) + v19; free(*(&v24)); if (v29->field_8 == *(&v25)) { if (v29->field_18) v29->field_18->field_20 = v29->field_20; else v31 = &v29->field_20->field_0; v29->field_20->field_0 = v29->field_18; free(v29); v17 -= 1; } else { v35 = v17; v34 = v29->field_8 + v29->field_10 - 1; v33 = v29->field_10 + *(&v25); v32 = "Short data block, re-requesting %llu -> %llu (%2d)"; sshlog("sftp-client.c", "do_crossload", 0x9ee, 0x0, 0x7, 0x0, *(&v36)); tmp_42 = a0[6]; a0[6] = a0[6] + 1; v29->field_0 = tmp_42; v29->field_8 = v29->field_8 - *(&v25); v29->field_10 = v29->field_10 + *(&v25); send_read_request(a0, v29->field_0, v29->field_10, v29->field_8, *(&v20), *(&v22)); if (v16 > *(&v25)) { v38 = *(&v25); if (*(&v25) < 0x200) v38 = 0x200; v16 = v38; } } if (v18) { if (v27 && v26 > v27) { v34 = v17; v33 = v26; v32 = "Finish at %llu (%2d)"; sshlog("sftp-client.c", "do_crossload", 0xa01, 0x0, 0x7, 0x0, *(&v36)); v18 = 1; } if ((!v27 || v26 <= v27) && v18 < a0[4]) v18 += 1; } } else { v34 = v9; v33 = 103; v32 = "Expected SSH2_FXP_DATA(%u) packet, got %u"; sshfatal("sftp-client.c", "do_crossload", 0xa0b, 0x0, 0x1, 0x0, *(&v36)); } } if (showprogress && v27) stop_progress_meter(); v35 = v13; v34 = "waiting for %u replies from destination"; sshlog("sftp-client.c", "do_crossload", 0xa14, 0x1, 0x7, 0x0, *(&v36)); handle_dest_replies(v7, a3, 0x1, &v13, &v10); if (v30) { v34 = "Transfer complete, but requests still in queue"; sshfatal("sftp-client.c", "do_crossload", 0xa19, 0x0, 0x1, 0x0, *(&v36)); } if (v10 || interrupted || v14) { v35 = a3; v34 = "truncating \"%s\" at 0"; sshlog("sftp-client.c", "do_crossload", 0xa1c, 0x0, 0x5, 0x0, *(&v36)); do_close(v7, v21, *(&v23)); free(v21); v34 = &v23; v38 = send_open(v7, a3, "dest", 0x1a, v6, &v21, *(&v36)); if (v38) { v35 = a3; v34 = "dest truncate \"%s\" failed"; sshlog("sftp-client.c", "do_crossload", 0xa22, 0x0, 0x2, 0x0, *(&v36)); v21 = 0; } } if (v14) { v34 = fx2txt(v12); v33 = a2; v32 = "read origin \"%s\": %s"; sshlog("sftp-client.c", "do_crossload", 0xa27, 0x0, 0x2, 0x0, *(&v36)); v12 = -1; do_close(a0, *(&v20), *(&v22)); if (v21) do_close(v7, v21, *(&v23)); } else if (v10) { v34 = fx2txt(v10); v33 = a3; v32 = "write dest \"%s\": %s"; sshlog("sftp-client.c", "do_crossload", 0xa2d, 0x0, 0x2, 0x0, *(&v36)); v12 = 4; do_close(a0, *(&v20), *(&v22)); if (v21) do_close(v7, v21, *(&v23)); } else { v38 = do_close(a0, *(&v20), *(&v22)); if (!v38 && !interrupted) v12 = 0; if (v38 || interrupted) v12 = -1; if (v21) { if (a5) do_fsetstat(v7, v21, *(&v23), v6); do_close(v7, v21, *(&v23)); } } sshbuf_free(v28); free(*(&v20)); free(v21); if (!v12) v38 = 0; else v38 = -1; } } } } return v38; }
openssh-portable
angr_dream