input
stringlengths
26
172k
output
stringlengths
18
318k
repo_name
stringclasses
23 values
decompiler
stringclasses
5 values
static void bsPutUChar(BitStream *bs, UChar c) { Int32 i; for (i = 7; i >= 0; i--) bsPutBit(bs, (((UInt32)c) >> i) & 0x1); }
void bsPutUChar(void *a0, unsigned long long a1) { unsigned int v0; unsigned long long v2; unsigned long long v3; v2 = a1; for (v0 = 7; v0 >= 0; v0 -= 1) { v3 = bsPutBit(a0, (a1 >> (v0 & 31)) & 1); } return; }
bzip2
angr_sailr
static void read_igmp(struct ma_info **result_p) { struct ma_info m = { .addr.family = 2, .addr.bitlen = 32, .addr.bytelen = 4, }; char buf[256]; FILE *fp = fopen("/proc/net/igmp", "r"); if (!fp) return; if (!fgets(buf, sizeof(buf), fp)) { fclose(fp); return; } while (fgets(buf, sizeof(buf), fp)) { struct ma_info *ma; if (buf[0] != '\t') { size_t len; sscanf(buf, "%d%s", &m.index, m.name); len = strlen(m.name); if (m.name[len - 1] == ':') m.name[len - 1] = '\0'; continue; } if (filter.dev && strcmp(filter.dev, m.name)) continue; sscanf(buf, "%08x%d", (__u32 *)&m.addr.data, &m.users); ma = malloc(sizeof(m)); memcpy(ma, &m, sizeof(m)); maddr_ins(result_p, ma); } fclose(fp); }
void read_igmp(undefined8 param_1) { int iVar1; char *pcVar2; size_t sVar3; void *__dest; long lVar4; undefined8 *puVar5; long in_FS_OFFSET; undefined8 local_270; FILE *local_260; undefined8 local_248; undefined local_240[4]; undefined local_23c[11]; char acStack561[19]; undefined2 local_21e; undefined2 local_21c; undefined2 local_21a; undefined local_218[256]; char local_118[264]; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); puVar5 = &local_248; for (lVar4 = 0x26; lVar4 != 0; lVar4 = lVar4 + -1) { *puVar5 = 0; puVar5 = puVar5 + 1; } local_21e = 4; local_21c = 0x20; local_21a = 2; local_260 = fopen64("/proc/net/igmp", "r"); if (local_260 != (FILE *)0x0) { pcVar2 = fgets(local_118, 0x100, local_260); local_270 = param_1; if (pcVar2 == (char *)0x0) { fclose(local_260); } else { while (pcVar2 = fgets(local_118, 0x100, local_260), pcVar2 != (char *)0x0) { if (local_118[0] == '\t') { if ((filter._0_8_ == (char *)0x0) || (iVar1 = strcmp(filter._0_8_, acStack561 + 1), iVar1 == 0)) { __isoc99_sscanf(local_118, "%08x%d", local_218, local_23c); __dest = malloc(0x130); memcpy(__dest, &local_248, 0x130); maddr_ins(local_270, __dest); } } else { __isoc99_sscanf(local_118, &DAT_00101104, local_240, acStack561 + 1); sVar3 = strlen(acStack561 + 1); if (acStack561[sVar3] == ':') { acStack561[sVar3] = '\0'; } } } fclose(local_260); } } if (local_10 == *(long *)(in_FS_OFFSET + 0x28)) { return; } __stack_chk_fail(); }
iproute2-6.0.0
ghidra
static inline int ext4_fc_tag_len(struct ext4_fc_tl *tl) { return ((__u16)(__le16)(tl->fc_len)); }
long ext4_fc_tag_len(long a1) { return *(unsigned short *)(a1 + 2); }
e2fsprogs-1.46.5
ida
static _Bool archive_is_dev(void) { struct stat st; if (fstat(archive, &st)) { stat_diag(*archive_name_cursor); return 0; } return ((((st.st_mode)) & 0170000) == (0060000)) || ((((st.st_mode)) & 0170000) == (0020000)); }
undefined4 archive_is_dev(void) { int iVar1; undefined4 uVar2; long in_FS_OFFSET; stat local_a8; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); iVar1 = fstat(archive, &local_a8); if (iVar1 == 0) { if (((local_a8.st_mode & 0xf000) == 0x6000) || ((local_a8.st_mode & 0xf000) == 0x2000)) { uVar2 = 1; } else { uVar2 = 0; } } else { stat_diag(*archive_name_cursor); uVar2 = 0; } if (local_10 == *(long *)(in_FS_OFFSET + 0x28)) { return uVar2; } __stack_chk_fail(); }
tar
ghidra
char *mk_msgstr(string, foundnlp) char *string; int *foundnlp; { register int c, len; char *result, *r, *s; for (len = 0, s = string; s && *s; s++) { len++; if (*s == '"' || *s == '\\') len++; else if (*s == '\n') len += 5; } r = result = (char *)sh_xmalloc((len + 3), "locale.c", 483); *r++ = '"'; for (s = string; s && (c = *s); s++) { if (c == '\n') { *r++ = '\\'; *r++ = 'n'; *r++ = '"'; *r++ = '\n'; *r++ = '"'; if (foundnlp) *foundnlp = 1; continue; } if (c == '"' || c == '\\') *r++ = '\\'; *r++ = c; } *r++ = '"'; *r++ = '\0'; return result; }
_BYTE *mk_msgstr(_BYTE *a1, _DWORD *a2) { int v2; _BYTE *v3; _BYTE *v4; _BYTE *v5; int v6; _BYTE *v8; _BYTE *i; _BYTE *j; _BYTE *v11; v2 = 0; for (i = a1; i && *i; ++i) { ++v2; if (*i == 34 || *i == 92) { ++v2; } else if (*i == 10) { v2 += 5; } } v11 = (_BYTE *)sh_xmalloc(v2 + 3, "locale.c", 483LL); v8 = v11 + 1; *v11 = 34; for (j = a1; j; ++j) { v6 = (char)*j; if (!*j) break; if (v6 == 10) { *v8 = 92; v8[1] = 110; v8[2] = 34; v8[3] = 10; v3 = v8 + 4; v8 += 5; *v3 = 34; if (a2) *a2 = 1; } else { if (v6 == 34 || v6 == 92) { v4 = v8++; *v4 = 92; } v5 = v8++; *v5 = v6; } } *v8 = 34; v8[1] = 0; return v11; }
bash
ida
unsigned int login_get_lastlog_time(const uid_t uid) { struct logininfo li; if (login_get_lastlog(&li, uid)) return (li.tv_sec); else return (0); }
long long login_get_lastlog_time(unsigned long a0) { char v0; char v1; void *v4; if (login_get_lastlog(&v0, a0)) v4 = *(&v1); else v4 = 0; return v4; }
openssh-portable
angr_dream
COMMAND *command_connect(com1, com2, connector) COMMAND *com1, *com2; int connector; { CONNECTION *temp; temp = (CONNECTION *)sh_xmalloc((sizeof(CONNECTION)), "make_cmd.c", 192); temp->connector = connector; temp->first = com1; temp->second = com2; return (make_command(cm_connection, (SIMPLE_COM *)temp)); }
int command_connect(unsigned long a0, unsigned long a1, unsigned long a2) { struct_0 *v0; v0 = sh_xmalloc(0x20, "make_cmd.c", 0xc0); v0->field_18 = a2; v0->field_8 = a0; v0->field_10 = a1; return make_command(0x6, v0); }
bash
angr_sailr
static void ge25519_mixadd2(crypto_sign_ed25519_ref_ge25519 *r, const ge25519_aff *q) { crypto_sign_ed25519_ref_fe25519 a, b, t1, t2, c, d, e, f, g, h, qt; crypto_sign_ed25519_ref_fe25519_mul(&qt, &q->x, &q->y); crypto_sign_ed25519_ref_fe25519_sub(&a, &r->y, &r->x); crypto_sign_ed25519_ref_fe25519_add(&b, &r->y, &r->x); crypto_sign_ed25519_ref_fe25519_sub(&t1, &q->y, &q->x); crypto_sign_ed25519_ref_fe25519_add(&t2, &q->y, &q->x); crypto_sign_ed25519_ref_fe25519_mul(&a, &a, &t1); crypto_sign_ed25519_ref_fe25519_mul(&b, &b, &t2); crypto_sign_ed25519_ref_fe25519_sub(&e, &b, &a); crypto_sign_ed25519_ref_fe25519_add(&h, &b, &a); crypto_sign_ed25519_ref_fe25519_mul(&c, &r->t, &qt); crypto_sign_ed25519_ref_fe25519_mul(&c, &c, &ge25519_ec2d); crypto_sign_ed25519_ref_fe25519_add(&d, &r->z, &r->z); crypto_sign_ed25519_ref_fe25519_sub(&f, &d, &c); crypto_sign_ed25519_ref_fe25519_add(&g, &d, &c); crypto_sign_ed25519_ref_fe25519_mul(&r->x, &e, &f); crypto_sign_ed25519_ref_fe25519_mul(&r->y, &h, &g); crypto_sign_ed25519_ref_fe25519_mul(&r->z, &g, &f); crypto_sign_ed25519_ref_fe25519_mul(&r->t, &e, &h); }
unsigned long ge25519_mixadd2(long a1, long a2) { char v5[128]; char v6[128]; char v7[128]; char v8[128]; char v9[128]; char v10[128]; char v11[128]; char v12[128]; char v13[128]; char v14[128]; char v15[136]; unsigned long v16; v16 = __readfsqword(0x28u); crypto_sign_ed25519_ref_fe25519_mul(v15, a2, a2 + 128); crypto_sign_ed25519_ref_fe25519_sub(v5, a1 + 128, a1); crypto_sign_ed25519_ref_fe25519_add(v6, a1 + 128, a1); crypto_sign_ed25519_ref_fe25519_sub(v7, a2 + 128, a2); crypto_sign_ed25519_ref_fe25519_add(v8, a2 + 128, a2); crypto_sign_ed25519_ref_fe25519_mul(v5, v5, v7); crypto_sign_ed25519_ref_fe25519_mul(v6, v6, v8); crypto_sign_ed25519_ref_fe25519_sub(v11, v6, v5); crypto_sign_ed25519_ref_fe25519_add(v14, v6, v5); crypto_sign_ed25519_ref_fe25519_mul(v9, a1 + 384, v15); crypto_sign_ed25519_ref_fe25519_mul(v9, v9, &ge25519_ec2d); crypto_sign_ed25519_ref_fe25519_add(v10, a1 + 256, a1 + 256); crypto_sign_ed25519_ref_fe25519_sub(v12, v10, v9); crypto_sign_ed25519_ref_fe25519_add(v13, v10, v9); crypto_sign_ed25519_ref_fe25519_mul(a1, v11, v12); crypto_sign_ed25519_ref_fe25519_mul(a1 + 128, v14, v13); crypto_sign_ed25519_ref_fe25519_mul(a1 + 256, v13, v12); crypto_sign_ed25519_ref_fe25519_mul(a1 + 384, v11, v14); return __readfsqword(0x28u) ^ v16; }
openssh-portable
ida
static void debug_print_relative_time(char const *item, parser_control const *pc) { _Bool space = 0; if (!debugging(pc)) return; dbg_printf(gettext("parsed %s part: "), item); if (pc->rel.year == 0 && pc->rel.month == 0 && pc->rel.day == 0 && pc->rel.hour == 0 && pc->rel.minutes == 0 && pc->rel.seconds == 0 && pc->rel.ns == 0) { fputs(gettext("today/this/now\n"), stderr); return; } space = print_rel_part(space, pc->rel.year, "year(s)"); space = print_rel_part(space, pc->rel.month, "month(s)"); space = print_rel_part(space, pc->rel.day, "day(s)"); space = print_rel_part(space, pc->rel.hour, "hour(s)"); space = print_rel_part(space, pc->rel.minutes, "minutes"); space = print_rel_part(space, pc->rel.seconds, "seconds"); print_rel_part(space, pc->rel.ns, "nanoseconds"); fputc('\n', stderr); }
void debug_print_relative_time(unsigned long a0, struct_0 *a1) { unsigned long v0; char v1; unsigned long long v4; unsigned long long v5; v0 = a0; v1 = 0; if ((debugging(a1) ^ 1)) return; gettext("parsed %s part: "); dbg_printf(); if (!a1->field_68 && !a1->field_70 && !a1->field_78 && !a1->field_80 && !a1->field_88 && !a1->field_90 && !a1->field_98) { v4 = fputs(gettext("today/this/now\n"), *(*(&got.stderr))); return; } v1 = print_rel_part(v1, a1->field_68, "year(s)"); v1 = print_rel_part(v1, a1->field_70, "month(s)"); v1 = print_rel_part(v1, a1->field_78, "day(s)"); v1 = print_rel_part(v1, a1->field_80, "hour(s)"); v1 = print_rel_part(v1, a1->field_88, "minutes"); v1 = print_rel_part(v1, a1->field_90, "seconds"); print_rel_part(v1, a1->field_98, "nanoseconds"); v5 = fputc(0xa, *(*(&got.stderr))); return; }
gnutls
angr_sailr
Keymap rl_make_keymap(void) { register int i; Keymap newmap; newmap = rl_make_bare_keymap(); for (i = ' '; i < 127; i++) newmap[i].function = rl_insert; newmap['\t'].function = rl_insert; newmap[0x7f].function = rl_rubout; newmap[(('H') & 0x1f)].function = rl_rubout; for (i = 128; i < 256; i++) newmap[i].function = rl_insert; return (newmap); }
long long rl_make_keymap() { unsigned long long v0[256]; unsigned long long v2; unsigned long long v3; v0[0] = rl_make_bare_keymap(); for (v2 = 32; v2 <= 126; v2 = v2 + 1) { v0[1 + 2 * v2] = got.rl_insert; } v0[19] = got.rl_insert; v0[255] = got.rl_rubout; v0[9007199254740991 + 239] = got.rl_rubout; for (v3 = 128; v3 <= 255; v3 = v3 + 1) { v0[1 + 2 * v3] = got.rl_insert; } return v0; }
bash
angr_sailr
int kex_send_newkeys(struct ssh *ssh) { int r; kex_reset_dispatch(ssh); if ((r = sshpkt_start(ssh, 21)) != 0 || (r = sshpkt_send(ssh)) != 0) return r; sshlog("kex.c", __func__, 465, 0, SYSLOG_LEVEL_DEBUG1, ((void *)0), "SSH2_MSG_NEWKEYS sent"); ssh_dispatch_set(ssh, 21, &kex_input_newkeys); if (ssh->kex->ext_info_c && (ssh->kex->flags & 0x0002) != 0) if ((r = kex_send_ext_info(ssh)) != 0) return r; sshlog("kex.c", __func__, 470, 0, SYSLOG_LEVEL_DEBUG1, ((void *)0), "expecting SSH2_MSG_NEWKEYS"); return 0; }
int kex_send_newkeys(long param_1) { int iVar1; undefined8 uVar2; kex_reset_dispatch(param_1); iVar1 = sshpkt_start(param_1, 0x15); if (iVar1 == 0) { uVar2 = 0x100f63; iVar1 = sshpkt_send(param_1); if (iVar1 == 0) { sshlog("kex.c", "kex_send_newkeys", 0x1d1, 0, 5, 0, "SSH2_MSG_NEWKEYS sent", uVar2); uVar2 = 0x100fca; ssh_dispatch_set(param_1, 0x15, kex_input_newkeys); if ((*(int *)(*(long *)(param_1 + 8) + 0x48) != 0) && ((*(uint *)(*(long *)(param_1 + 8) + 0x8c) & 2) != 0)) { uVar2 = 0x100ffa; iVar1 = kex_send_ext_info(param_1); if (iVar1 != 0) { return iVar1; } } sshlog("kex.c", "kex_send_newkeys", 0x1d6, 0, 5, 0, "expecting SSH2_MSG_NEWKEYS", uVar2); iVar1 = 0; } } return iVar1; }
openssh-portable
ghidra
static void index_write(const struct index_node *node, FILE *out) { long initial_offset, final_offset; uint32_t u; u = htonl(0xB007F457); fwrite(&u, sizeof(u), 1, out); u = htonl(((0x0002 << 16) | 0x0001)); fwrite(&u, sizeof(u), 1, out); initial_offset = ftell(out); ((void)sizeof((initial_offset >= 0) ? 1 : 0), __extension__({ if (initial_offset >= 0) ; else __assert_fail("initial_offset >= 0", "tools/depmod.c", 417, __extension__ __PRETTY_FUNCTION__); })); u = 0; fwrite(&u, sizeof(uint32_t), 1, out); u = htonl(index_write__node(node, out)); final_offset = ftell(out); ((void)sizeof((final_offset >= 0) ? 1 : 0), __extension__({ if (final_offset >= 0) ; else __assert_fail("final_offset >= 0", "tools/depmod.c", 426, __extension__ __PRETTY_FUNCTION__); })); (void)fseek(out, initial_offset, 0); fwrite(&u, sizeof(uint32_t), 1, out); (void)fseek(out, final_offset, 0); }
void index_write(void *a0, void *a1) { unsigned int v0; unsigned int v1; unsigned int v2; char v3; unsigned long long *v5; unsigned long long v6; v0 = htonl(0xb007f457); fwrite(&v0, 0x4, 0x1, a1); v0 = htonl(0x20001); fwrite(&v0, 0x4, 0x1, a1); *(&v1) = ftell(a1); if ((*(&v1) - 0 >> 63)) __assert_fail(); v0 = 0; fwrite(&v0, 0x4, 0x1, a1); v0 = htonl(index_write__node(a0, a1)); *(&v2) = ftell(a1); if ((*(&v2) - 0 >> 63)) __assert_fail(); fseek(a1, *(&v1), 0x0); fwrite(&v0, 0x4, 0x1, a1); fseek(a1, *(&v2), 0x0); v6 = *(&v3) ^ v5[5]; return; }
kmod
angr_phoenix
static int numcompare(char const *a, char const *b) { while (blanks[to_uchar(*a)]) a++; while (blanks[to_uchar(*b)]) b++; return strnumcmp(a, b, decimal_point, thousands_sep); }
int numcompare(unsigned long long a0, unsigned long long a1) { char *v0; char *v1; v1 = a0; v0 = a1; while (true) { if (!*(to_uchar(*(v1)) + &blanks)) break; v1 += 1; } while (true) { if (!*(to_uchar(*(v0)) + &blanks)) break; v0 += 1; } return strnumcmp(v1, v0, decimal_point, thousands_sep); }
coreutils
angr_dream
Channel *channel_by_id(struct ssh *ssh, int id) { Channel *c; if (id < 0 || (u_int)id >= ssh->chanctxt->channels_alloc) { sshlog("channels.c", __func__, 245, 1, SYSLOG_LEVEL_INFO, ((void *)0), "%d: bad id", id); return ((void *)0); } c = ssh->chanctxt->channels[id]; if (c == ((void *)0)) { sshlog("channels.c", __func__, 250, 1, SYSLOG_LEVEL_INFO, ((void *)0), "%d: bad id: channel free", id); return ((void *)0); } return c; }
int channel_by_id(struct_0 *a0, unsigned long a1) { unsigned long v0; unsigned long v1; unsigned int v3; if (a1 < 0) { LABEL_4000e6: v0 = a1; sshlog("channels.c", "channel_by_id", 0xf5, 0x1, 0x3, 0x0, "%d: bad id"); v3 = 0; } else { if (a0->field_868->field_8 <= a1) goto LABEL_4000e6; v1 = *((a0->field_868->field_0 + a1 * 8)); if (v1) { v3 = v1; } else { v0 = a1; sshlog("channels.c", "channel_by_id", 0xfa, 0x1, 0x3, 0x0, "%d: bad id: channel free"); v3 = 0; } } return v3; }
openssh-portable
angr_phoenix
uLong adler32_z(adler, buf, len) uLong adler; const Bytef *buf; z_size_t len; { unsigned long sum2; unsigned n; sum2 = (adler >> 16) & 0xffff; adler &= 0xffff; if (len == 1) { adler += buf[0]; if (adler >= 65521U) adler -= 65521U; sum2 += adler; if (sum2 >= 65521U) sum2 -= 65521U; return adler | (sum2 << 16); } if (buf == 0) return 1L; if (len < 16) { while (len--) { adler += *buf++; sum2 += adler; } if (adler >= 65521U) adler -= 65521U; sum2 %= 65521U; return adler | (sum2 << 16); } while (len >= 5552) { len -= 5552; n = 5552 / 16; do { { adler += (buf)[0]; sum2 += adler; }; { adler += (buf)[0 + 1]; sum2 += adler; }; ; { adler += (buf)[0 + 2]; sum2 += adler; }; { adler += (buf)[0 + 2 + 1]; sum2 += adler; }; ; ; { adler += (buf)[0 + 4]; sum2 += adler; }; { adler += (buf)[0 + 4 + 1]; sum2 += adler; }; ; { adler += (buf)[0 + 4 + 2]; sum2 += adler; }; { adler += (buf)[0 + 4 + 2 + 1]; sum2 += adler; }; ; ; ; { adler += (buf)[8]; sum2 += adler; }; { adler += (buf)[8 + 1]; sum2 += adler; }; ; { adler += (buf)[8 + 2]; sum2 += adler; }; { adler += (buf)[8 + 2 + 1]; sum2 += adler; }; ; ; { adler += (buf)[8 + 4]; sum2 += adler; }; { adler += (buf)[8 + 4 + 1]; sum2 += adler; }; ; { adler += (buf)[8 + 4 + 2]; sum2 += adler; }; { adler += (buf)[8 + 4 + 2 + 1]; sum2 += adler; }; ; ; ; ; buf += 16; } while (--n); adler %= 65521U; sum2 %= 65521U; } if (len) { while (len >= 16) { len -= 16; { adler += (buf)[0]; sum2 += adler; }; { adler += (buf)[0 + 1]; sum2 += adler; }; ; { adler += (buf)[0 + 2]; sum2 += adler; }; { adler += (buf)[0 + 2 + 1]; sum2 += adler; }; ; ; { adler += (buf)[0 + 4]; sum2 += adler; }; { adler += (buf)[0 + 4 + 1]; sum2 += adler; }; ; { adler += (buf)[0 + 4 + 2]; sum2 += adler; }; { adler += (buf)[0 + 4 + 2 + 1]; sum2 += adler; }; ; ; ; { adler += (buf)[8]; sum2 += adler; }; { adler += (buf)[8 + 1]; sum2 += adler; }; ; { adler += (buf)[8 + 2]; sum2 += adler; }; { adler += (buf)[8 + 2 + 1]; sum2 += adler; }; ; ; { adler += (buf)[8 + 4]; sum2 += adler; }; { adler += (buf)[8 + 4 + 1]; sum2 += adler; }; ; { adler += (buf)[8 + 4 + 2]; sum2 += adler; }; { adler += (buf)[8 + 4 + 2 + 1]; sum2 += adler; }; ; ; ; ; buf += 16; } while (len--) { adler += *buf++; sum2 += adler; } adler %= 65521U; sum2 %= 65521U; } return adler | (sum2 << 16); }
unsigned long adler32_z(int a1, unsigned char *a2, unsigned long a3) { unsigned char *v4; unsigned char *v6; unsigned long v8; unsigned char *v9; unsigned long v10; unsigned long v11; unsigned long v12; unsigned long v13; unsigned long v14; unsigned long v15; unsigned long v16; unsigned long v17; unsigned long v18; unsigned long v19; unsigned long v20; long v21; long v22; long v23; long v24; long v25; long v26; unsigned long v27; unsigned long v28; unsigned long v29; unsigned long v30; unsigned long v31; unsigned long v32; unsigned long v33; unsigned long v34; unsigned long v35; long v36; long v37; long v38; long v39; long v40; long v41; int v42; unsigned long v43; unsigned long v44; long v45; long v46; long v47; long v48; long v49; long v50; long v51; long v52; long v53; long v54; long v55; long v56; long v57; long v58; long v59; long v60; long v61; long v62; long v63; long v64; long v65; long v66; long v67; long v68; long v69; long v70; long v71; long v72; long v73; long v74; v9 = a2; v8 = a3; v43 = HIWORD(a1); v10 = (unsigned short)a1; if (a3 == 1) { v11 = *a2 + (unsigned long)(unsigned short)a1; if (v11 > 0xFFF0) v11 -= 65521LL; v44 = v11 + HIWORD(a1); if (v44 > 0xFFF0) v44 -= 65521LL; return v11 | (v44 << 16); } else if (a2) { if (a3 > 0xF) { while (v8 > 0x15AF) { v8 -= 5552LL; v42 = 347; do { v12 = *v9 + v10; v45 = v12 + v43; v13 = v9[1] + v12; v46 = v13 + v45; v14 = v9[2] + v13; v47 = v14 + v46; v15 = v9[3] + v14; v48 = v15 + v47; v16 = v9[4] + v15; v49 = v16 + v48; v17 = v9[5] + v16; v50 = v17 + v49; v18 = v9[6] + v17; v51 = v18 + v50; v19 = v9[7] + v18; v52 = v19 + v51; v20 = v9[8] + v19; v53 = v20 + v52; v21 = v9[9] + v20; v54 = v21 + v53; v22 = v9[10] + v21; v55 = v22 + v54; v23 = v9[11] + v22; v56 = v23 + v55; v24 = v9[12] + v23; v57 = v24 + v56; v25 = v9[13] + v24; v58 = v25 + v57; v26 = v9[14] + v25; v59 = v26 + v58; v10 = v9[15] + v26; v43 = v10 + v59; v9 += 16; --v42; } while (v42); v10 %= 0xFFF1uLL; v43 %= 0xFFF1uLL; } if (v8) { while (v8 > 0xF) { v8 -= 16LL; v27 = *v9 + v10; v60 = v27 + v43; v28 = v9[1] + v27; v61 = v28 + v60; v29 = v9[2] + v28; v62 = v29 + v61; v30 = v9[3] + v29; v63 = v30 + v62; v31 = v9[4] + v30; v64 = v31 + v63; v32 = v9[5] + v31; v65 = v32 + v64; v33 = v9[6] + v32; v66 = v33 + v65; v34 = v9[7] + v33; v67 = v34 + v66; v35 = v9[8] + v34; v68 = v35 + v67; v36 = v9[9] + v35; v69 = v36 + v68; v37 = v9[10] + v36; v70 = v37 + v69; v38 = v9[11] + v37; v71 = v38 + v70; v39 = v9[12] + v38; v72 = v39 + v71; v40 = v9[13] + v39; v73 = v40 + v72; v41 = v9[14] + v40; v74 = v41 + v73; v10 = v9[15] + v41; v43 = v10 + v74; v9 += 16; } while (v8--) { v6 = v9++; v10 += *v6; v43 += v10; } v10 %= 0xFFF1uLL; v43 %= 0xFFF1uLL; } return v10 | (v43 << 16); } else { while (v8--) { v4 = v9++; v10 += *v4; v43 += v10; } if (v10 > 0xFFF0) v10 -= 65521LL; return v10 | ((v43 % 0xFFF1) << 16); } } else { return 1LL; } }
zlib
ida
void tok_wreset(TokenizerW *tok) { tok->argc = 0; tok->wstart = tok->wspace; tok->wptr = tok->wspace; tok->flags = 0; tok->quote = Q_none; }
long long tok_wreset(struct_0 *a0) { a0->field_8 = 0; a0->field_30 = a0->field_38; a0->field_20 = a0->field_38; a0->field_44 = 0; a0->field_40 = 0; return a0; }
libedit
angr_sailr
static inline void emit_mandatory_arg_note(void) { fputs_unlocked(gettext("\nMandatory arguments to long options are mandatory " "for short options too.\n"), stdout) ; }
int emit_mandatory_arg_note() { FILE *v0; char *v1; v0 = stdout; v1 = gettext("\nMandatory arguments to long options are mandatory for short " "options too.\n"); return fputs_unlocked(v1, v0); }
coreutils
ida
char *acl_to_text(acl_t acl, ssize_t *len_p) { return __acl_to_any_text(acl, len_p, ((void *)0), '\n', "\n", 0x01); }
void acl_to_text(undefined8 param_1, undefined8 param_2) { __acl_to_any_text(param_1, param_2, 0, 10, &DAT_0010003d, 1); return; }
acl-2.3.1
ghidra
static void print_sep(char sep) { pr_sgr_start_if(sep_color); putchar_errno(sep); pr_sgr_end_if(sep_color); }
void print_sep(unsigned long a0) { unsigned long long v1; pr_sgr_start_if(sep_color); putchar_errno(a0); v1 = pr_sgr_end_if(sep_color); return; }
grep
angr_sailr
int rl_vi_search_again(int count, int key) { switch (key) { case 'n': rl_noninc_reverse_search_again(count, key); break; case 'N': rl_noninc_forward_search_again(count, key); break; } return (0); }
long rl_vi_search_again(unsigned int a1, int a2) { if (a2 == 78) { rl_noninc_forward_search_again(a1, 78LL); } else if (a2 == 110) { rl_noninc_reverse_search_again(a1, 110LL); } return 0LL; }
bash
ida
static void dummy_coder(struct tar_stat_info const *st __attribute__((unused)), char const *keyword __attribute__((unused)), struct xheader *xhdr __attribute__((unused)), void const *data __attribute__((unused))) {}
long long dummy_coder(unsigned long a0, unsigned long a1, unsigned long a2, unsigned long a3) { unsigned long v0; unsigned long v1; unsigned long v2; unsigned long v3; unsigned long v5; v3 = a0; v2 = a1; v1 = a2; v0 = a3; return v5; }
tar
angr_sailr
static int print_sadinfo(struct nlmsghdr *n, void *arg) { FILE *fp = (FILE *)arg; __u32 *f = ((void *)(((char *)n) + ((int)(((sizeof(struct nlmsghdr)) + 4U - 1) & ~(4U - 1))))); struct rtattr *tb[(__XFRMA_SAD_MAX - 1) + 1]; struct rtattr *rta; int len = n->nlmsg_len; len -= ((sizeof(__u32)) + ((int)(((sizeof(struct nlmsghdr)) + 4U - 1) & ~(4U - 1)))); if (len < 0) { fprintf(stderr, "SADinfo: Wrong len %d\n", len); return -1; } rta = ((struct rtattr *)(((char *)(f)) + (((sizeof(__u32)) + 4U - 1) & ~(4U - 1)))); parse_rtattr(tb, (__XFRMA_SAD_MAX - 1), rta, len); if (tb[XFRMA_SAD_CNT]) { __u32 cnt; fprintf(fp, "\t SAD"); cnt = rta_getattr_u32(tb[XFRMA_SAD_CNT]); fprintf(fp, " count %u", cnt); } else { fprintf(fp, "BAD SAD info returned\n"); return -1; } if (show_stats) { if (tb[XFRMA_SAD_HINFO]) { struct xfrmu_sadhinfo *si; if (((int)((tb[XFRMA_SAD_HINFO])->rta_len) - ((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0))) < sizeof(*si)) { fprintf(fp, "BAD SAD length returned\n"); return -1; } si = ((void *)(((char *)(tb[XFRMA_SAD_HINFO])) + ((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0)))); fprintf(fp, " (buckets "); fprintf(fp, "count %d", si->sadhcnt); fprintf(fp, " Max %d", si->sadhmcnt); fprintf(fp, ")"); } } fprintf(fp, "\n"); return 0; }
void print_sadinfo(unsigned int *a0, void *a1) { unsigned int v0; unsigned int v1; unsigned long v2; unsigned long long v3; unsigned int v4[2]; char v5; char v6; char v7; unsigned long long v9; unsigned long long v10; unsigned long long v11; void *v12; v2 = a0 + 4; v0 = *(a0); v0 -= 20; if (v0 < 0) { fprintf(stderr, "SADinfo: Wrong len %d\n", v0); v9 = 4294967295; } else { v3 = v2 + 4; parse_rtattr(&v5, 0x2, v3, v0); if (!*(&v6)) { fprintf(a1, "BAD SAD info returned\n"); v10 = 4294967295; } else { fprintf(a1, "\t SAD"); v1 = rta_getattr_u32(*(&v6)); fprintf(a1, " count %u", v1); if (show_stats && *(&v7)) { if (*(*(&v7)) - 4 <= 7) { fprintf(a1, "BAD SAD length returned\n"); v11 = 4294967295; goto LABEL_404587; } else { *(&v4[0]) = *(&v7) + 4; fprintf(a1, " (buckets "); fprintf(a1, "count %d", v4[0]); fprintf(a1, " Max %d", v4[1]); fprintf(a1, ")"); } } fprintf(a1, "\n"); v12 = 0; } } LABEL_404587: return; }
iproute2-6.0.0
angr_phoenix
int auth_rhosts2(struct passwd *pw, const char *client_user, const char *hostname, const char *ipaddr) { char *path = ((void *)0); struct stat st; static const char *const rhosts_files[] = {".shosts", ".rhosts", ((void *)0)}; u_int rhosts_file_index; int r; sshlog("auth-rhosts.c", __func__, 200, 1, SYSLOG_LEVEL_DEBUG2, ((void *)0), "clientuser %s hostname %s ipaddr %s", client_user, hostname, ipaddr); temporarily_use_uid(pw); for (rhosts_file_index = 0; rhosts_files[rhosts_file_index]; rhosts_file_index++) { xasprintf(&path, "%s/%s", pw->pw_dir, rhosts_files[rhosts_file_index]); r = stat(path, &st); free(path); if (r >= 0) break; } restore_uid(); if (!rhosts_files[rhosts_file_index] && stat("/etc/hosts.equiv", &st) == -1 && stat("/usr/local/etc" "/shosts.equiv", &st) == -1) { sshlog("auth-rhosts.c", __func__, 231, 1, SYSLOG_LEVEL_DEBUG3, ((void *)0), "no hosts access files exist"); return 0; } if (pw->pw_uid == 0) sshlog("auth-rhosts.c", __func__, 240, 1, SYSLOG_LEVEL_DEBUG3, ((void *)0), "root user, ignoring system hosts files"); else { if (check_rhosts_file("/etc/hosts.equiv", hostname, ipaddr, client_user, pw->pw_name)) { auth_debug_add("Accepted for %.100s [%.100s] by " "/etc/hosts.equiv.", hostname, ipaddr); return 1; } if (check_rhosts_file("/usr/local/etc" "/shosts.equiv", hostname, ipaddr, client_user, pw->pw_name)) { auth_debug_add("Accepted for %.100s [%.100s] by " "%.100s.", hostname, ipaddr, "/usr/local/etc" "/shosts.equiv"); return 1; } } if (stat(pw->pw_dir, &st) == -1) { sshlog("auth-rhosts.c", __func__, 261, 0, SYSLOG_LEVEL_INFO, ((void *)0), "Rhosts authentication refused for %.100s: " "no home directory %.200s", pw->pw_name, pw->pw_dir); auth_debug_add("Rhosts authentication refused for %.100s: " "no home directory %.200s", pw->pw_name, pw->pw_dir); return 0; } if (options.strict_modes && ((st.st_uid != 0 && st.st_uid != pw->pw_uid) || (st.st_mode & 022) != 0)) { sshlog("auth-rhosts.c", __func__, 270, 0, SYSLOG_LEVEL_INFO, ((void *)0), "Rhosts authentication refused for %.100s: " "bad ownership or modes for home directory.", pw->pw_name); auth_debug_add("Rhosts authentication refused for %.100s: " "bad ownership or modes for home directory.", pw->pw_name); return 0; } temporarily_use_uid(pw); for (rhosts_file_index = 0; rhosts_files[rhosts_file_index]; rhosts_file_index++) { xasprintf(&path, "%s/%s", pw->pw_dir, rhosts_files[rhosts_file_index]); if (stat(path, &st) == -1) { free(path); continue; } if (options.strict_modes && ((st.st_uid != 0 && st.st_uid != pw->pw_uid) || (st.st_mode & 022) != 0)) { sshlog("auth-rhosts.c", __func__, 299, 0, SYSLOG_LEVEL_INFO, ((void *)0), "Rhosts authentication refused for %.100s: " "bad modes for %.200s", pw->pw_name, path); auth_debug_add("Bad file modes for %.200s", path); free(path); continue; } if (options.ignore_rhosts == 1 || (options.ignore_rhosts == 2 && strcmp(rhosts_files[rhosts_file_index], ".shosts") != 0)) { auth_debug_add("Server has been configured to " "ignore %.100s.", rhosts_files[rhosts_file_index]); free(path); continue; } if (check_rhosts_file(path, hostname, ipaddr, client_user, pw->pw_name)) { auth_debug_add("Accepted by %.100s.", rhosts_files[rhosts_file_index]); restore_uid(); auth_debug_add("Accepted host %s ip %s client_user " "%s server_user %s", hostname, ipaddr, client_user, pw->pw_name); free(path); return 1; } free(path); } restore_uid(); return 0; }
long long auth_rhosts2(struct_0 *a0, char *a1, char *a2, unsigned long long a3) { unsigned int v0; unsigned int v1; void *v2; char v3; char v4; char v5; unsigned long long v7; v2 = 0; sshlog("auth-rhosts.c", "auth_rhosts2", 0xc8, 0x1, 0x6, 0x0, "clientuser %s hostname %s ipaddr %s", a1); temporarily_use_uid(a0); v0 = 0; while (true) { if (!rhosts_files.15040 [v0]) break; xasprintf(&v2, "%s/%s", a0->field_20, rhosts_files.15040 [v0]); v1 = stat(v2, &v3); free(v2); if (v1 >= 0) break; v0 += 1; } restore_uid(); if (!rhosts_files.15040 [v0] && stat("/etc/hosts.equiv", &v3) == -1 && stat("/usr/local/etc/shosts.equiv", &v3) == -1) { sshlog("auth-rhosts.c", "auth_rhosts2", 0xe7, 0x1, 0x7, 0x0, "no hosts access files exist", a3); v7 = 0; return v7; } if (!a0->field_10) { sshlog("auth-rhosts.c", "auth_rhosts2", 0xf0, 0x1, 0x7, 0x0, "root user, ignoring system hosts files", a3); } else if (check_rhosts_file("/etc/hosts.equiv", a2, a3, a1, a0->field_0)) { auth_debug_add("Accepted for %.100s [%.100s] by /etc/hosts.equiv.", a2); v7 = 1; return v7; } else if (check_rhosts_file("/usr/local/etc/shosts.equiv", a2, a3, a1, a0->field_0)) { auth_debug_add("Accepted for %.100s [%.100s] by %.100s.", a2); v7 = 1; return v7; } if (stat(a0->field_20, &v3) == -1) { sshlog("auth-rhosts.c", "auth_rhosts2", 0x105, 0x0, 0x3, 0x0, "Rhosts authentication refused for %.100s: no home directory %.200s", a0->field_0); auth_debug_add( "Rhosts authentication refused for %.100s: no home directory %.200s", a0->field_0); v7 = 0; return v7; } if (*(5244240) && (!(!*(&v5)) && !(*(&v5) == a0->field_10) || !(!(*(&v4) & 18)))) { sshlog("auth-rhosts.c", "auth_rhosts2", 0x10e, 0x0, 0x3, 0x0, "Rhosts authentication refused for %.100s: bad ownership or modes " "for home directory.", a0->field_0); auth_debug_add("Rhosts authentication refused for %.100s: bad ownership or " "modes for home directory.", a0->field_0); v7 = 0; return v7; } temporarily_use_uid(a0); v0 = 0; while (true) { if (rhosts_files.15040 [v0]) { xasprintf(&v2, "%s/%s", a0->field_20, rhosts_files.15040 [v0]); if (stat(v2, &v3) == -1) { free(v2); } else if (!*(5244240) || (!*(&v5) || *(&v5) == a0->field_10) && !(*(&v4) & 18)) { switch (*(5244192)) { case 1: LABEL_400b0c: auth_debug_add("Server has been configured to ignore %.100s.", rhosts_files.15040 [v0]); free(v2); break; case 2: if (!strcmp(rhosts_files.15040 [v0], ".shosts")) goto LABEL_400b4d; else goto LABEL_400b0c; default: LABEL_400b4d: if (check_rhosts_file(v2, a2, a3, a1, a0->field_0)) { auth_debug_add("Accepted by %.100s.", rhosts_files.15040 [v0]); restore_uid(); auth_debug_add( "Accepted host %s ip %s client_user %s server_user %s", a2); free(v2); v7 = 1; return v7; } free(v2); } } else { sshlog("auth-rhosts.c", "auth_rhosts2", 0x12b, 0x0, 0x3, 0x0, "Rhosts authentication refused for %.100s: bad modes for %.200s", a0->field_0); auth_debug_add("Bad file modes for %.200s", v2); free(v2); } v0 += 1; } else { restore_uid(); v7 = 0; return v7; } } }
openssh-portable
angr_sailr
{ return ext2fs_has_feature_metadata_csum(fs->super) || ext2fs_has_feature_gdt_csum(fs->super); }
_BOOL8 ext2fs_has_feature_metadata_csum(long a1) { return (*(_DWORD *)(a1 + 100) & 0x400) != 0; }
e2fsprogs-1.46.5
ida
static void terminal_init_arrow(EditLine *el) { funckey_t *arrow = el->el_terminal.t_fkey; arrow[0].name = L"down"; arrow[0].key = 16; arrow[0].fun.cmd = 15; arrow[0].type = 0; arrow[1].name = L"up"; arrow[1].key = 19; arrow[1].fun.cmd = 18; arrow[1].type = 0; arrow[2].name = L"left"; arrow[2].key = 17; arrow[2].fun.cmd = 17; arrow[2].type = 0; arrow[3].name = L"right"; arrow[3].key = 18; arrow[3].fun.cmd = 14; arrow[3].type = 0; arrow[4].name = L"home"; arrow[4].key = 36; arrow[4].fun.cmd = 11; arrow[4].type = 0; arrow[5].name = L"end"; arrow[5].key = 37; arrow[5].fun.cmd = 12; arrow[5].type = 0; arrow[6].name = L"delete"; arrow[6].key = 38; arrow[6].fun.cmd = 3; arrow[6].type = 0; }
void terminal_init_arrow(struct_0 *a0) { struct_1 *v0; unsigned long long v2; v0 = a0->field_c8; v0->field_0 = "d"; v0->field_8 = 16; v0->field_10 = 15; v0->field_18 = 0; v0->field_20 = "u"; v0->field_28 = 19; v0->field_30 = 18; v0->field_38 = 0; v0->field_40 = "l"; v0->field_48 = 17; v0->field_50 = 17; v0->field_58 = 0; v0->field_60 = "r"; v0->field_68 = 18; v0->field_70 = 14; v0->field_78 = 0; *(&v0[83848836698679779].padding_6c) = "h"; *((&v0[83848836698679779].field_60 + 4)) = 36; v0[83848836698679779].padding_5c[0] = 11; *(&v0[83848836698679779].padding_51[3]) = 0; v0->field_a0 = "e"; v0->field_a8 = 37; v0->field_b0 = 12; v0->field_b8 = 0; v0->field_c0 = "d"; v0->field_c8 = 38; v0->field_d0 = 3; v2 = &v0->field_c0; v0->field_d8 = 0; return; }
libedit
angr_dream
static int compute_number_width(size_t nfiles, struct fstatus const *fstatus) { int width = 1; if (0 < nfiles && fstatus[0].failed <= 0) { int minimum_width = 1; uintmax_t regular_total = 0; for (size_t i = 0; i < nfiles; i++) if (!fstatus[i].failed) { if (((((fstatus[i].st.st_mode)) & 0170000) == (0100000))) regular_total += fstatus[i].st.st_size; else minimum_width = 7; } for (; 10 <= regular_total; regular_total /= 10) width++; if (width < minimum_width) width = minimum_width; } return width; }
int compute_number_width(unsigned long a0, unsigned int *a1) { unsigned int v0; unsigned int v1; unsigned long long v2; void *v3; v0 = 1; if (!a0) { return v0; } else if (*(a1) > 0) { return v0; } else { v1 = 1; v2 = 0; for (v3 = 0; v3 < a0; v3 += 1) { if (!*((a1 + 0x80 * v3 + 0x10 * v3 + 0x8 * v3))) { if ((*((32 + a1 + 0x80 * v3 + 0x10 * v3 + 0x8 * v3)) & 0xf000) == 0x8000) v2 += *((56 + a1 + 0x98 * v3)); else v1 = 7; } } for (; v2 > 9; v2 = v2 * 14757395258967641293 >> 64 >> 3) { v0 += 1; } if (v0 < v1) v0 = v1; return v0; } }
coreutils
angr_sailr
|| (strcmp (method, "SHA512") == 0) ) { pass_max_len = -1; } else {
int strcmp(char *__s1, char *__s2) { halt_baddata(); }
shadow
ghidra
static int on_off(const char *msg, const char *realval) { fprintf(stderr, "Error: argument of \"%s\" must be \"on\" or \"off\", not \"%s\"\n", msg, realval); return -1; }
void on_off(unsigned long a0, unsigned long a1) { unsigned long long v1; fprintf(stderr, "Error: argument of \"%s\" must be \"on\" or \"off\", not \"%s\"\n", a0, a1); v1 = 4294967295; return; }
iproute2-6.0.0
angr_phoenix
void flushout(struct output *dest) { size_t len; len = dest->nextc - dest->buf; if (!len || dest->fd < 0) return; dest->nextc = dest->buf; if ((xwrite(dest->fd, dest->buf, len))) dest->flags |= 01; }
void flushout(struct_0 *a0) { unsigned long long v0; unsigned long long v2; unsigned long long v3; struct_0 *v5; v2 = a0->field_0 - a0->field_10; v0 = a0->field_0 - a0->field_10; if (v0) { v3 = a0->field_20; if (a0->field_20 >= 0) { a0->field_0 = a0->field_10; if (xwrite(a0->field_20, a0->field_10, v0)) { v5 = a0; a0->field_24 = a0->field_24 | 1; } } } return; }
dash-0.5.11+git20210903+057cd650a4ed
angr_phoenix
int match_pattern_list(const char *string, const char *pattern, int dolower) { char sub[1024]; int negated; int got_positive; u_int i, subi, len = strlen(pattern); got_positive = 0; for (i = 0; i < len;) { if (pattern[i] == '!') { negated = 1; i++; } else negated = 0; for (subi = 0; i < len && subi < sizeof(sub) - 1 && pattern[i] != ','; subi++, i++) sub[subi] = dolower && ((*__ctype_b_loc())[(int)(((u_char)pattern[i]))] & (unsigned short int)_ISupper) ? tolower((u_char)pattern[i]) : pattern[i]; if (subi >= sizeof(sub) - 1) return 0; if (i < len && pattern[i] == ',') i++; sub[subi] = '\0'; if (match_pattern(string, sub)) { if (negated) return -1; else got_positive = 1; } } return got_positive; }
undefined4 match_pattern_list(undefined8 param_1, char *param_2, int param_3) { char cVar1; char cVar2; uint uVar3; int iVar4; size_t sVar5; ushort **ppuVar6; long in_FS_OFFSET; undefined4 local_428; uint local_424; uint local_420; char local_418[1032]; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); sVar5 = strlen(param_2); uVar3 = (uint)sVar5; local_428 = 0; local_424 = 0; do { if (uVar3 <= local_424) { LAB_00100353: if (local_10 == *(long *)(in_FS_OFFSET + 0x28)) { return local_428; } __stack_chk_fail(); } cVar1 = param_2[local_424]; if (cVar1 == '!') { local_424 = local_424 + 1; } local_420 = 0; for (; ((local_424 < uVar3 && (local_420 < 0x3ff)) && (param_2[local_424] != ',')); local_424 = local_424 + 1) { if ((param_3 == 0) || (ppuVar6 = __ctype_b_loc(), ((*ppuVar6)[(byte)param_2[local_424]] & 0x100) == 0)) { cVar2 = param_2[local_424]; } else { iVar4 = tolower((uint)(byte)param_2[local_424]); cVar2 = (char)iVar4; } local_418[local_420] = cVar2; local_420 = local_420 + 1; } if (0x3fe < local_420) { local_428 = 0; goto LAB_00100353; } if ((local_424 < uVar3) && (param_2[local_424] == ',')) { local_424 = local_424 + 1; } local_418[local_420] = '\0'; iVar4 = match_pattern(param_1, local_418); if (iVar4 != 0) { if (cVar1 == '!') { local_428 = 0xffffffff; goto LAB_00100353; } local_428 = 1; } } while (true); }
openssh-portable
ghidra
void sh_warnx(const char *fmt, ...) { va_list ap; __builtin_va_start(ap, fmt); exvwarning2(fmt, ap); __builtin_va_end(ap); }
unsigned long sh_warnx(long a1, long a2, long a3, long a4, long a5, long a6, ...) { gcc_va_list va; unsigned long v8; long v9; long v10; long v11; long v12; long v13; va_start(va, a6); v9 = a2; v10 = a3; v11 = a4; v12 = a5; v13 = a6; v8 = __readfsqword(0x28u); va[0].gp_offset = 8; exvwarning2(a1, (long)va); return __readfsqword(0x28u) ^ v8; }
dash-0.5.11+git20210903+057cd650a4ed
ida
void oom_adjust_restore(void) { FILE *fp; sshlog("port-linux.c", __func__, 296, 0, SYSLOG_LEVEL_DEBUG3, ((void *)0), "%s", __func__); if (oom_adj_save == (-0x7fffffff - 1) || oom_adj_path == ((void *)0) || (fp = fopen(oom_adj_path, "w")) == ((void *)0)) return; if (fprintf(fp, "%d\n", oom_adj_save) <= 0) sshlog("port-linux.c", __func__, 302, 0, SYSLOG_LEVEL_VERBOSE, ((void *)0), "error writing %s: %s", oom_adj_path, strerror((*__errno_location()))); else sshlog("port-linux.c", __func__, 304, 0, SYSLOG_LEVEL_DEBUG1, ((void *)0), "Set %s to %d", oom_adj_path, oom_adj_save); fclose(fp); return; }
void oom_adjust_restore(void) { int iVar1; FILE *__stream; int *piVar2; char *pcVar3; undefined8 uVar4; sshlog("port-linux.c", "oom_adjust_restore", 0x128, 0, 7, 0, &DAT_00100409, "oom_adjust_restore"); if ((oom_adj_save != 0x80000000) && (oom_adj_path != (char *)0x0)) { __stream = fopen(oom_adj_path, "w"); if (__stream != (FILE *)0x0) { uVar4 = 0x100304; iVar1 = fprintf(__stream, "%d\n", (ulong)oom_adj_save); if (iVar1 < 1) { piVar2 = __errno_location(); uVar4 = 0x100316; pcVar3 = strerror(*piVar2); sshlog("port-linux.c", "oom_adjust_restore", 0x12e, 0, 4, 0, "error writing %s: %s", oom_adj_path, pcVar3, uVar4); } else { sshlog("port-linux.c", "oom_adjust_restore", 0x130, 0, 5, 0, "Set %s to %d", oom_adj_path, oom_adj_save, uVar4); } fclose(__stream); } } return; }
openssh-portable
ghidra
static void do_convert_from_pem(struct sshkey **k, int *private) { FILE *fp; RSA *rsa; if ((fp = fopen(identity_file, "r")) == ((void *)0)) sshfatal("ssh-keygen.c", __func__, 737, 0, SYSLOG_LEVEL_FATAL, ((void *)0), "%s: %s: %s", __progname, identity_file, strerror((*__errno_location()))); if ((rsa = PEM_read_RSAPublicKey(fp, ((void *)0), ((void *)0), ((void *)0))) != ((void *)0)) { if ((*k = sshkey_new(KEY_UNSPEC)) == ((void *)0)) sshfatal("ssh-keygen.c", __func__, 740, 0, SYSLOG_LEVEL_FATAL, ((void *)0), "sshkey_new failed"); (*k)->type = KEY_RSA; (*k)->rsa = rsa; fclose(fp); return; } sshfatal("ssh-keygen.c", __func__, 746, 1, SYSLOG_LEVEL_FATAL, ((void *)0), "unrecognised raw private key format"); }
void do_convert_from_pem(struct struct_0 **a0, unsigned long a1) { unsigned long v0; unsigned long long v1; unsigned long v2; unsigned long v3; void *v4; unsigned long long v5; char v6; unsigned long long v8; unsigned long long v9; v3 = a1; v4 = fopen(&identity_file, "r"); if (!v4) { v2 = strerror(*(__errno_location())); v1 = &identity_file; v0 = __progname; sshfatal("ssh-keygen.c", "do_convert_from_pem", 0x2e1, 0x0, 0x1, 0x0, "%s: %s: %s"); } v5 = PEM_read_RSAPublicKey(v4, 0x0, 0x0, 0x0); if (v5) { *(a0) = sshkey_new(0xe); if (!*(a0)) { v5 = "sshkey_new failed"; sshfatal("ssh-keygen.c", "do_convert_from_pem", 0x2e4, 0x0, 0x1, 0x0, *(&v6)); } *(a0)->field_0 = 0; *(a0)->field_8 = v5; v9 = fclose(v4); } else { v5 = "unrecognised raw private key format"; v8 = sshfatal("ssh-keygen.c", "do_convert_from_pem", 0x2ea, 0x1, 0x1, 0x0, *(&v6)); } return; }
openssh-portable
angr_dream
static void tostring(VALUE *v) { switch (v->type) { case integer: { char *s = __gmpz_get_str(((void *)0), 10, v->u.i); __gmpz_clear(v->u.i); v->u.s = s; v->type = string; } break; case string: break; default: abort(); } }
void tostring(struct_0 *a0) { unsigned long v0; unsigned long long v2; struct_0 *v3; v2 = a0->field_0; switch (a0->field_0) { case 0: v0 = __gmpz_get_str(0x0, 0xa, &a0->field_8); __gmpz_clear(&a0->field_8); a0->field_8 = v0; v3 = a0; a0->field_0 = 1; case 1: return; default: abort(); } }
coreutils
angr_sailr
int hasttygrp(void) { struct group *grp; if ((grp = getgrnam("tty")) != ((void *)0)) return 1; return 0; }
_BOOL8 hasttygrp() { return getgrnam("tty") != 0LL; }
sysvinit
ida
static int ssh_connect_direct(struct ssh *ssh, const char *host, struct addrinfo *aitop, struct sockaddr_storage *hostaddr, u_short port, int connection_attempts, int *timeout_ms, int want_keepalive) { int on = 1, saved_timeout_ms = *timeout_ms; int oerrno, sock = -1, attempt; char ntop[1025], strport[32]; struct addrinfo *ai; sshlog("sshconnect.c", __func__, 457, 1, SYSLOG_LEVEL_DEBUG3, ((void *)0), "entering"); memset(ntop, 0, sizeof(ntop)); memset(strport, 0, sizeof(strport)); for (attempt = 0; attempt < connection_attempts; attempt++) { if (attempt > 0) { sleep(1); sshlog("sshconnect.c", __func__, 465, 0, SYSLOG_LEVEL_DEBUG1, ((void *)0), "Trying again..."); } for (ai = aitop; ai; ai = ai->ai_next) { if (ai->ai_family != 2 && ai->ai_family != 10) { (*__errno_location()) = 97; continue; } if (getnameinfo(ai->ai_addr, ai->ai_addrlen, ntop, sizeof(ntop), strport, sizeof(strport), 1 | 2) != 0) { oerrno = (*__errno_location()); sshlog("sshconnect.c", __func__, 481, 1, SYSLOG_LEVEL_ERROR, ((void *)0), "getnameinfo failed"); (*__errno_location()) = oerrno; continue; } sshlog("sshconnect.c", __func__, 485, 0, SYSLOG_LEVEL_DEBUG1, ((void *)0), "Connecting to %.200s [%.100s] port %s.", host, ntop, strport); sock = ssh_create_socket(ai); if (sock < 0) { (*__errno_location()) = 0; continue; } *timeout_ms = saved_timeout_ms; if (timeout_connect(sock, ai->ai_addr, ai->ai_addrlen, timeout_ms) >= 0) { memcpy(hostaddr, ai->ai_addr, ai->ai_addrlen); break; } else { oerrno = (*__errno_location()); sshlog("sshconnect.c", __func__, 504, 0, SYSLOG_LEVEL_DEBUG1, ((void *)0), "connect to address %s port %s: %s", ntop, strport, strerror((*__errno_location()))); close(sock); sock = -1; (*__errno_location()) = oerrno; } } if (sock != -1) break; } if (sock == -1) { sshlog("sshconnect.c", __func__, 517, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "ssh: connect to host %s port %s: %s", host, strport, (*__errno_location()) == 0 ? "failure" : strerror((*__errno_location()))); return -1; } sshlog("sshconnect.c", __func__, 522, 0, SYSLOG_LEVEL_DEBUG1, ((void *)0), "Connection established."); if (want_keepalive && setsockopt(sock, 1, 9, (void *)&on, sizeof(on)) == -1) sshlog("sshconnect.c", __func__, 528, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "setsockopt SO_KEEPALIVE: %.100s", strerror((*__errno_location()))); if (ssh_packet_set_connection(ssh, sock, sock) == ((void *)0)) return -1; return 0; }
long ssh_connect_direct(long a1, const char *a2, int *a3, void *a4, long a5, int a6, int *a7, int a8) { int *v8; char *v9; int *v10; char *v11; int *v13; char *v14; int optval; int fd; int i; int v21; int v22; int *j; char serv[32]; char s[1032]; unsigned long v26; v26 = __readfsqword(0x28u); optval = 1; v21 = *a7; fd = -1; sshlog("sshconnect.c", "ssh_connect_direct", 457LL, 1LL, 7LL, 0LL, "entering"); memset(s, 0, 0x401uLL); memset(serv, 0, sizeof(serv)); for (i = 0; i < a6; ++i) { if (i > 0) { sleep(1u); sshlog("sshconnect.c", "ssh_connect_direct", 465LL, 0LL, 5LL, 0LL, "Trying again..."); } for (j = a3; j; j = (int *)*((_QWORD *)j + 5)) { if (j[1] == 2 || j[1] == 10) { if (getnameinfo(*((const struct sockaddr **)j + 3), j[4], s, 0x401u, serv, 0x20u, 3)) { v22 = *_errno_location(); sshlog("sshconnect.c", "ssh_connect_direct", 481LL, 1LL, 2LL, 0LL, "getnameinfo failed"); *_errno_location() = v22; } else { sshlog("sshconnect.c", "ssh_connect_direct", 485LL, 0LL, 5LL, 0LL, "Connecting to %.200s [%.100s] port %s.", a2, s, serv); fd = ssh_create_socket(j); if (fd >= 0) { *a7 = v21; if ((int)timeout_connect((unsigned int)fd, *((_QWORD *)j + 3), (unsigned int)j[4], a7) >= 0) { memcpy(a4, *((const void **)j + 3), (unsigned int)j[4]); break; } v22 = *_errno_location(); v8 = _errno_location(); v9 = strerror(*v8); sshlog("sshconnect.c", "ssh_connect_direct", 504LL, 0LL, 5LL, 0LL, "connect to address %s port %s: %s", s, serv, v9); close(fd); fd = -1; *_errno_location() = v22; } else { *_errno_location() = 0; } } } else { *_errno_location() = 97; } } if (fd != -1) break; } if (fd == -1) { if (*_errno_location()) { v10 = _errno_location(); v11 = strerror(*v10); } else { v11 = "failure"; } sshlog("sshconnect.c", "ssh_connect_direct", 517LL, 0LL, 2LL, 0LL, "ssh: connect to host %s port %s: %s", a2, serv, v11); return 0xFFFFFFFFLL; } else { sshlog("sshconnect.c", "ssh_connect_direct", 522LL, 0LL, 5LL, 0LL, "Connection established."); if (a8 && setsockopt(fd, 1, 9, &optval, 4u) == -1) { v13 = _errno_location(); v14 = strerror(*v13); sshlog("sshconnect.c", "ssh_connect_direct", 528LL, 0LL, 2LL, 0LL, "setsockopt SO_KEEPALIVE: %.100s", v14); } if (ssh_packet_set_connection(a1, (unsigned int)fd, (unsigned int)fd)) return 0LL; else return 0xFFFFFFFFLL; } }
openssh-portable
ida
static void get_old_fields(const char *gecos) { char *cp; char old_gecos[8192]; (strncpy((old_gecos), (gecos), sizeof(old_gecos) - 1), (old_gecos)[sizeof(old_gecos) - 1] = '\0'); cp = copy_field(old_gecos, fflg ? (char *)0 : fullnm, slop); if (((void *)0) != cp) { cp = copy_field(cp, rflg ? (char *)0 : roomno, slop); } if (((void *)0) != cp) { cp = copy_field(cp, wflg ? (char *)0 : workph, slop); } if (((void *)0) != cp) { cp = copy_field(cp, hflg ? (char *)0 : homeph, slop); } if ((((void *)0) != cp) && !oflg) { if ('\0' != slop[0]) { strcat(slop, ","); } strcat(slop, cp); } }
void get_old_fields(char *a0) { char *v0; char v1; char v2; char v3; char v4; char v5; unsigned long long *v11; unsigned long long v12; v3 = *(&v3); v2 = *(&v2); strncpy(&v1, a0, 0x1fff); v4 = 0; v0 = copy_field(&v1, (!fflg ? 0 : &fullnm), &slop); if (v0) v0 = copy_field(v0, (!rflg ? 0 : &roomno), &slop); if (v0) v0 = copy_field(v0, (!wflg ? 0 : &workph), &slop); if (v0) v0 = copy_field(v0, (!hflg ? 0 : &homeph), &slop); if (v0 && (oflg ^ 1)) { if (slop) strcat(&slop, ","); strcat(&slop, v0); } v12 = *(&v5) ^ v11[5]; return; }
shadow
angr_sailr
void initialize_terminating_signals() { register int i; struct sigaction act, oact; if (termsigs_initialized) return; act.__sigaction_handler.sa_handler = termsig_sighandler; act.sa_flags = 0; sigemptyset(&act.sa_mask); sigemptyset(&oact.sa_mask); for (i = 0; i < (sizeof(terminating_signals) / sizeof(struct termsig)); i++) sigaddset(&act.sa_mask, (terminating_signals[i].signum)); for (i = 0; i < (sizeof(terminating_signals) / sizeof(struct termsig)); i++) { if (signal_is_trapped((terminating_signals[i].signum))) continue; sigaction((terminating_signals[i].signum), &act, &oact); (terminating_signals[i].orig_handler) = oact.__sigaction_handler.sa_handler; (terminating_signals[i].orig_flags) = oact.sa_flags; set_original_signal((terminating_signals[i].signum), act.__sigaction_handler.sa_handler); if (interactive_shell == 0 && (terminating_signals[i].orig_handler) == ((__sighandler_t)1)) { sigaction((terminating_signals[i].signum), &oact, &act); set_signal_hard_ignored((terminating_signals[i].signum)); } if ((terminating_signals[i].signum) == 27 && (terminating_signals[i].orig_handler) != ((__sighandler_t)0) && (terminating_signals[i].orig_handler) != ((__sighandler_t)1)) sigaction((terminating_signals[i].signum), &oact, (struct sigaction *)((void *)0)); } termsigs_initialized = 1; }
void initialize_terminating_signals() { unsigned long long v0; char v1; unsigned int v2; char v3; char v4; char v5; char v6; void *v8; void *v9; unsigned long long v10; unsigned long long *v11; unsigned long long v12; if (!termsigs_initialized) { v0 = termsig_sighandler; v2 = 0; sigemptyset(&v1); sigemptyset(&v4); for (v8 = 0; v8 <= 16; v8 = v8 + 1) { sigaddset(&v1, *((0x18 * v8 + &terminating_signals[0]))); } for (v9 = 0; v9 <= 16; v9 = v9 + 1) { v10 = signal_is_trapped(*((0x18 * v9 + &terminating_signals[0]))); if (!v10) { sigaction(*((0x18 * v9 + &terminating_signals[0])), &v0, &v3, &v0); *((0x18 * v9 + &g_400e48[0])) = *(&v3); *((0x18 * v9 + &g_400e50)) = *(&v5); set_original_signal(*((0x18 * v9 + &terminating_signals[0])), v0, v9 * 24, v0); if (!interactive_shell && *((0x10 * v9 + 0x8 * v9 + &g_400e48[0])) == 1) { sigaction(*((0x18 * v9 + &terminating_signals[0])), &v3, &v0, &v3); set_signal_hard_ignored(*((0x18 * v9 + &terminating_signals[0]))); } if (*((0x10 * v9 + 0x8 * v9 + &terminating_signals[0])) == 27 && *((0x10 * v9 + 0x8 * v9 + &g_400e48[0])) && *((0x10 * v9 + 0x8 * v9 + &g_400e48[0])) != 1) sigaction(*((0x18 * v9 + &terminating_signals[0])), &v3, 0x0, &v3); } } termsigs_initialized = 1; } v12 = *(&v6) ^ v11[5]; return; }
bash
angr_dream
s->strategy == 3 ? deflate_rle(s, flush) : (*(configuration_table[s->level].func))(s, flush); if (bstate == finish_started || bstate == finish_done) { s->status = 666; }
undefined8 deflate_rle(long *param_1, int param_2) { char cVar1; uint uVar2; char *pcVar3; byte bVar4; char *pcVar5; long lVar6; bool bVar7; char *local_18; do { if (*(uint *)((long)param_1 + 0xb4) < 0x103) { fill_window(); if ((*(uint *)((long)param_1 + 0xb4) < 0x103) && (param_2 == 0)) { return 0; } if (*(int *)((long)param_1 + 0xb4) == 0) { *(undefined4 *)((long)param_1 + 0x172c) = 0; if (param_2 == 4) { if (param_1[0x13] < 0) { lVar6 = 0; } else { lVar6 = param_1[0xc] + (param_1[0x13] & 0xffffffffU); } _tr_flush_block( param_1, lVar6, (ulong) * (uint *)((long)param_1 + 0xac) - param_1[0x13], 1); param_1[0x13] = (ulong) * (uint *)((long)param_1 + 0xac); flush_pending(*param_1); if (*(int *)(*param_1 + 0x20) == 0) { return 2; } return 3; } if (*(int *)((long)param_1 + 0x170c) != 0) { if (param_1[0x13] < 0) { lVar6 = 0; } else { lVar6 = param_1[0xc] + (param_1[0x13] & 0xffffffffU); } _tr_flush_block( param_1, lVar6, (ulong) * (uint *)((long)param_1 + 0xac) - param_1[0x13], 0); param_1[0x13] = (ulong) * (uint *)((long)param_1 + 0xac); flush_pending(*param_1); if (*(int *)(*param_1 + 0x20) == 0) { return 0; } } return 1; } } *(undefined4 *)(param_1 + 0x14) = 0; if ((2 < *(uint *)((long)param_1 + 0xb4)) && (*(int *)((long)param_1 + 0xac) != 0)) { local_18 = (char *)(((ulong) * (uint *)((long)param_1 + 0xac) - 1) + param_1[0xc]); cVar1 = *local_18; if ((cVar1 == local_18[1]) && ((cVar1 == local_18[2] && (local_18 = local_18 + 3, cVar1 == *local_18)))) { pcVar5 = (char *)((ulong) * (uint *)((long)param_1 + 0xac) + 0x102 + param_1[0xc]); do { pcVar3 = local_18 + 1; if (((((cVar1 != local_18[1]) || (pcVar3 = local_18 + 2, cVar1 != local_18[2])) || (pcVar3 = local_18 + 3, cVar1 != local_18[3])) || ((pcVar3 = local_18 + 4, cVar1 != local_18[4] || (pcVar3 = local_18 + 5, cVar1 != local_18[5])))) || ((pcVar3 = local_18 + 6, cVar1 != local_18[6] || ((pcVar3 = local_18 + 7, cVar1 != local_18[7] || (local_18 = local_18 + 8, pcVar3 = local_18, cVar1 != *local_18)))))) break; } while (local_18 < pcVar5); local_18 = pcVar3; *(int *)(param_1 + 0x14) = 0x102 - ((int)pcVar5 - (int)local_18); if (*(uint *)((long)param_1 + 0xb4) < *(uint *)(param_1 + 0x14)) { *(undefined4 *)(param_1 + 0x14) = *(undefined4 *)((long)param_1 + 0xb4); } } } if (*(uint *)(param_1 + 0x14) < 3) { bVar4 = *(byte *)((ulong) * (uint *)((long)param_1 + 0xac) + param_1[0xc]); uVar2 = *(uint *)((long)param_1 + 0x170c); *(uint *)((long)param_1 + 0x170c) = uVar2 + 1; *(undefined *)((ulong)uVar2 + param_1[0x2e0]) = 0; uVar2 = *(uint *)((long)param_1 + 0x170c); *(uint *)((long)param_1 + 0x170c) = uVar2 + 1; *(undefined *)((ulong)uVar2 + param_1[0x2e0]) = 0; uVar2 = *(uint *)((long)param_1 + 0x170c); *(uint *)((long)param_1 + 0x170c) = uVar2 + 1; *(byte *)(param_1[0x2e0] + (ulong)uVar2) = bVar4; *(short *)((long)param_1 + ((long)(int)(uint)bVar4 + 0x34) * 4 + 4) = *(short *)((long)param_1 + ((long)(int)(uint)bVar4 + 0x34) * 4 + 4) + 1; bVar7 = *(int *)((long)param_1 + 0x170c) == *(int *)(param_1 + 0x2e2); *(int *)((long)param_1 + 0xb4) = *(int *)((long)param_1 + 0xb4) + -1; *(int *)((long)param_1 + 0xac) = *(int *)((long)param_1 + 0xac) + 1; } else { bVar4 = (char)*(undefined4 *)(param_1 + 0x14) - 3; uVar2 = *(uint *)((long)param_1 + 0x170c); *(uint *)((long)param_1 + 0x170c) = uVar2 + 1; *(undefined *)((ulong)uVar2 + param_1[0x2e0]) = 1; uVar2 = *(uint *)((long)param_1 + 0x170c); *(uint *)((long)param_1 + 0x170c) = uVar2 + 1; *(undefined *)((ulong)uVar2 + param_1[0x2e0]) = 0; uVar2 = *(uint *)((long)param_1 + 0x170c); *(uint *)((long)param_1 + 0x170c) = uVar2 + 1; *(byte *)(param_1[0x2e0] + (ulong)uVar2) = bVar4; *(short *)((long)param_1 + ((long)(int)((byte)(&_length_code)[(int)(uint)bVar4] + 0x101) + 0x34) * 4 + 4) = *(short *)((long)param_1 + ((long)(int)((byte)(&_length_code)[(int)(uint)bVar4] + 0x101) + 0x34) * 4 + 4) + 1; *(short *)((long)param_1 + ((long)(int)(uint)_dist_code + 0x270) * 4 + 8) = *(short *)((long)param_1 + ((long)(int)(uint)_dist_code + 0x270) * 4 + 8) + 1; bVar7 = *(int *)((long)param_1 + 0x170c) == *(int *)(param_1 + 0x2e2); *(int *)((long)param_1 + 0xb4) = *(int *)((long)param_1 + 0xb4) - *(int *)(param_1 + 0x14); *(int *)((long)param_1 + 0xac) = *(int *)((long)param_1 + 0xac) + *(int *)(param_1 + 0x14); *(undefined4 *)(param_1 + 0x14) = 0; } if (bVar7) { if (param_1[0x13] < 0) { lVar6 = 0; } else { lVar6 = param_1[0xc] + (param_1[0x13] & 0xffffffffU); } _tr_flush_block(param_1, lVar6, (ulong) * (uint *)((long)param_1 + 0xac) - param_1[0x13]); param_1[0x13] = (ulong) * (uint *)((long)param_1 + 0xac); flush_pending(); if (*(int *)(*param_1 + 0x20) == 0) { return 0; } } } while (true); }
zlib
ghidra
void crypto_sign_ed25519_ref_sc25519_2interleave2( unsigned char r[127], const crypto_sign_ed25519_ref_sc25519 *s1, const crypto_sign_ed25519_ref_sc25519 *s2) { int i; for (i = 0; i < 31; i++) { r[4 * i] = (s1->v[i] & 3) ^ ((s2->v[i] & 3) << 2); r[4 * i + 1] = ((s1->v[i] >> 2) & 3) ^ (((s2->v[i] >> 2) & 3) << 2); r[4 * i + 2] = ((s1->v[i] >> 4) & 3) ^ (((s2->v[i] >> 4) & 3) << 2); r[4 * i + 3] = ((s1->v[i] >> 6) & 3) ^ (((s2->v[i] >> 6) & 3) << 2); } r[124] = (s1->v[31] & 3) ^ ((s2->v[31] & 3) << 2); r[125] = ((s1->v[31] >> 2) & 3) ^ (((s2->v[31] >> 2) & 3) << 2); r[126] = ((s1->v[31] >> 4) & 3) ^ (((s2->v[31] >> 4) & 3) << 2); }
_BYTE *crypto_sign_ed25519_ref_sc25519_2interleave2(_BYTE *a1, long a2, long a3) { _BYTE *result; int i; for (i = 0; i <= 30; ++i) { a1[4 * i] = (4 * *(_DWORD *)(a3 + 4LL * i)) & 0xC | *(_BYTE *)(a2 + 4LL * i) & 3; a1[4 * i + 1] = (4 * (*(_DWORD *)(a3 + 4LL * i) >> 2)) & 0xC | (*(_DWORD *)(a2 + 4LL * i) >> 2) & 3; a1[4 * i + 2] = (4 * (*(_DWORD *)(a3 + 4LL * i) >> 4)) & 0xC | (*(_DWORD *)(a2 + 4LL * i) >> 4) & 3; a1[4 * i + 3] = (4 * (*(_DWORD *)(a3 + 4LL * i) >> 6)) & 0xC | (*(_DWORD *)(a2 + 4LL * i) >> 6) & 3; } a1[124] = *(_DWORD *)(a2 + 124) & 3 | (4 * *(_DWORD *)(a3 + 124)) & 0xC; a1[125] = (*(_DWORD *)(a2 + 124) >> 2) & 3 | (4 * (*(_DWORD *)(a3 + 124) >> 2)) & 0xC; result = a1 + 126; a1[126] = (*(_DWORD *)(a2 + 124) >> 4) & 3 | (4 * (*(_DWORD *)(a3 + 124) >> 4)) & 0xC; return result; }
openssh-portable
ida
void checkpoint_flush_actions(void) { struct checkpoint_action *p; for (p = checkpoint_action; p; p = p->next) { switch (p->opcode) { case cop_ttyout: if (tty && tty_cleanup) { long w = getwidth(tty); while (w--) fputc_unlocked(' ', tty); fputc_unlocked('\r', tty); fflush_unlocked(tty); } break; default:; } } }
void checkpoint_flush_actions() { struct_0 *v0; unsigned long long v1; unsigned long long v3; unsigned long long v4; unsigned long long v5; v3 = checkpoint_action; for (v0 = checkpoint_action; v0; v0 = v0->field_0) { if (v0->field_8 == 3 && tty && tty_cleanup) { v1 = getwidth(tty); while (true) { v4 = v1; v1 -= 1; if (!v4) break; fputc_unlocked(0x20, tty); } fputc_unlocked(0xd, tty); fflush_unlocked(tty); } v5 = v0->field_0; } return; }
tar
angr_sailr
static struct ipv6_rpl_sr_hdr *parse_rpl_srh(char *segbuf) { struct ipv6_rpl_sr_hdr *srh; int nsegs = 0; int srhlen; char *s; int i; s = segbuf; for (i = 0; *s; *s++ == ',' ? i++ : *s) ; nsegs = i + 1; srhlen = 8 + 16 * nsegs; srh = calloc(1, srhlen); srh->hdrlen = (srhlen >> 3) - 1; srh->type = 3; srh->segments_left = nsegs; for (s = strtok(segbuf, ","); s; s = strtok(((void *)0), ",")) { inet_prefix addr; get_addr(&addr, s, 10); memcpy(&srh->segments.addr[i], addr.data, sizeof(struct in6_addr)); i--; } return srh; }
_BYTE *parse_rpl_srh(char *a1) { char *v1; int v3; int v4; char *v5; char *i; _BYTE *v7; char v8[8]; _BYTE v9[16]; unsigned long v10; v10 = __readfsqword(0x28u); v5 = a1; v3 = 0; while (*v5) { v1 = v5++; if (*v1 == 44) ++v3; } v4 = 16 * (v3 + 1) + 8; v7 = calloc(1uLL, v4); v7[1] = (v4 >> 3) - 1; v7[2] = 3; v7[3] = v3 + 1; for (i = strtok(a1, ","); i; i = strtok(0LL, ",")) { get_addr(v8, i, 10LL); memcpy(&v7[16 * v3-- + 8], v9, 0x10uLL); } return v7; }
iproute2-6.0.0
ida
static void can_print_tdc_opt(FILE *f, struct rtattr *tdc_attr) { struct rtattr *tb[IFLA_CAN_TDC_MAX + 1]; (parse_rtattr_flags( (tb), (IFLA_CAN_TDC_MAX), ((void *)(((char *)(tdc_attr)) + ((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0)))), ((int)((tdc_attr)->rta_len) - ((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0))), (1 << 15))); if (tb[IFLA_CAN_TDC_TDCV] || tb[IFLA_CAN_TDC_TDCO] || tb[IFLA_CAN_TDC_TDCF]) { open_json_object("tdc"); can_print_nl_indent(); if (tb[IFLA_CAN_TDC_TDCV]) { __u32 *tdcv = ((void *)(((char *)(tb[IFLA_CAN_TDC_TDCV])) + ((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0)))); print_uint(PRINT_ANY, "tdcv", " tdcv %u", *tdcv); } if (tb[IFLA_CAN_TDC_TDCO]) { __u32 *tdco = ((void *)(((char *)(tb[IFLA_CAN_TDC_TDCO])) + ((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0)))); print_uint(PRINT_ANY, "tdco", " tdco %u", *tdco); } if (tb[IFLA_CAN_TDC_TDCF]) { __u32 *tdcf = ((void *)(((char *)(tb[IFLA_CAN_TDC_TDCF])) + ((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0)))); print_uint(PRINT_ANY, "tdcf", " tdcf %u", *tdcf); } close_json_object(); } }
void can_print_tdc_opt(unsigned long long a0, unsigned short *a1, unsigned long long a2, unsigned long long a3, unsigned long a4, unsigned long long a5) { unsigned long v0; unsigned int *v1; unsigned int *v2; unsigned int *v3; char v4; char v5; char v6; char v7; char v8; unsigned long long *v10; unsigned long long v11; v0 = a0; parse_rtattr_flags(&v4, 0x9, a1 + 2, *(a1)-4, 0x8000); if (!*(&v5) && !*(&v6) && !*(&v7)) goto LABEL_4017b6; open_json_object("tdc"); can_print_nl_indent(); if (*(&v5)) { v1 = *(&v5) + 4; print_uint(0x4, "tdcv", " tdcv %u", *(v1)); } if (*(&v6)) { v2 = *(&v6) + 4; print_uint(0x4, "tdco", " tdco %u", *(v2)); } if (*(&v7)) { v3 = *(&v7) + 4; print_uint(0x4, "tdcf", " tdcf %u", *(v3)); } close_json_object(a0, a1, a2, a3, 0x8000, a5); LABEL_4017b6: v11 = *(&v8) ^ v10[5]; return; }
iproute2-6.0.0
angr_phoenix
== gr) { fputs(gettext("Group 'mail' not found. Creating the user mailbox " "file with 0600 mode.\n"), stderr); gid = user_gid; mode = 0600; } else {
int fputs(char *__s, FILE *__stream) { halt_baddata(); }
shadow
ghidra
int send_ocsp_request(const char *server, gnutls_x509_crt_t cert, gnutls_x509_crt_t issuer, gnutls_datum_t *resp_data, gnutls_datum_t *nonce) { gnutls_datum_t ud; int ret; gnutls_datum_t req; char *url = (void *)server; char headers[1024]; char service[16]; unsigned char *p; const char *hostname; const char *path = ""; unsigned i; unsigned int headers_size = 0, port; socket_st hd; sockets_init(); if (url == ((void *)0)) { gnutls_datum_t data; i = 0; do { ret = gnutls_x509_crt_get_authority_info_access(cert, i++, GNUTLS_IA_OCSP_URI, &data, ((void *)0)); } while (ret == -105); if (ret < 0) { i = 0; do { ret = gnutls_x509_crt_get_authority_info_access( issuer, i++, GNUTLS_IA_OCSP_URI, &data, ((void *)0)); } while (ret == -105); } if (ret < 0) { fprintf(stderr, "*** Cannot find OCSP server URI in certificate: %s\n", gnutls_strerror(ret)); return ret; } url = malloc(data.size + 1); if (url == ((void *)0)) { return -1; } memcpy(url, data.data, data.size); url[data.size] = 0; gnutls_free((void *)(data.data)), data.data = ((void *)0); } hostname = host_from_url(url, &port, &path); if (port != 0) snprintf(service, sizeof(service), "%u", port); else strcpy(service, "80"); fprintf(stderr, "Connecting to OCSP server: %s...\n", hostname); memset(&ud, 0, sizeof(ud)); _generate_request(cert, issuer, &req, nonce); snprintf(headers, sizeof(headers), "POST /%s HTTP/1.0\r\n" "Host: %s\r\n" "Accept: */*\r\n" "Content-Type: application/ocsp-request\r\n" "Content-Length: %u\r\n" "Connection: close\r\n\r\n", path, hostname, (unsigned int)req.size); headers_size = strlen(headers); socket_open2(&hd, hostname, service, ((void *)0), (1 << 3) | (1 << 5), "Connecting to", ((void *)0), ((void *)0), ((void *)0), ((void *)0)); socket_send(&hd, headers, headers_size); socket_send(&hd, req.data, req.size); gnutls_free((void *)(req.data)), req.data = ((void *)0); do { ret = socket_recv(&hd, buffer, sizeof(buffer)); if (ret > 0) get_data(buffer, ret, 1, &ud); } while (ret > 0); if (ret < 0 || ud.size == 0) { perror("recv"); ret = -1; goto cleanup; } socket_bye(&hd, 0); p = memmem(ud.data, ud.size, "\r\n\r\n", 4); if (p == ((void *)0)) { fprintf(stderr, "Cannot interpret HTTP response\n"); ret = -1; goto cleanup; } p += 4; resp_data->size = ud.size - (p - ud.data); resp_data->data = malloc(resp_data->size); if (resp_data->data == ((void *)0)) { perror("recv"); ret = -1; goto cleanup; } memcpy(resp_data->data, p, resp_data->size); ret = 0; cleanup: free(ud.data); if (url != server) free(url); return ret; }
long long send_ocsp_request(void *a0, unsigned long long a1, unsigned long long a2, struct_0 *a3, unsigned long long a4) { int tmp_9; void *v0; unsigned long long v1; char v2; unsigned int v3; unsigned int v4; unsigned int v5; unsigned long long v6; char *v7; unsigned long long v8; unsigned long v9; char v10; char v11; void *v12; char v13; char v14; char v15; char v16; unsigned long long v18; unsigned long long v19; unsigned long long v20; v1 = a1; v7 = a0; v6 = &g_402240; v5 = 0; sockets_init(); if (!v7) { v4 = 0; do { tmp_9 = v4; v4 += 1; v18 = tmp_9; } while ((v3 = gnutls_x509_crt_get_authority_info_access(v1, v18, 0x2716, &v12, 0x0), v3 == -105)); if (v3 < 0) { v4 = 0; do { tmp_9 = v4; v4 += 1; v19 = tmp_9; } while ((v3 = gnutls_x509_crt_get_authority_info_access(v1, v18, 0x2716, &v12, 0x0), v3 == -105)); } if (v3 < 0) { fprintf(*(&stderr), "*** Cannot find OCSP server URI in certificate: %s\n", gnutls_strerror(v3)); v20 = v3; return v20; } v7 = malloc(*(&v13) + 1); if (!v7) { v20 = 4294967295; return v20; } memcpy(v7, *(&v12), *(&v13)); v7[*(&v13)] = 0; *(5243032)(*(&v12)); v12 = 0; } v8 = host_from_url(v7, &v2, &v6); if (!*(&v2)) strcpy(&v15, "80"); else snprintf(&v15, 0x10, "%u", *(&v2)); fprintf(*(&stderr), "Connecting to OCSP server: %s...\n", v8); memset(&v10, 0x0, 0x10); _generate_request(v1, a2, &v12, a4); snprintf(&v16, 0x400, "POST /%s HTTP/1.0\r\nHost: %s\r\nAccept: */*\r\nContent-Type: " "application/ocsp-request\r\nContent-Length: %u\r\nConnection: " "close\r\n\r\n", v6, v8, *(&v13)); v5 = strlen(&v16); v0 = 0; socket_open2(&v14, v8, &v15, 0x0, 0x28, "Connecting to", 0x0, 0x0, 0x0); socket_send(&v14, &v16, v5, &v16); socket_send(&v14, v12, *(&v13), v12); *(5243032)(v12); v12 = 0; do { v3 = socket_recv(&v14, &buffer, 0x1001); if (v3 > 0) get_data(&buffer, v3, 0x1, &v10); } while (v3 > 0); if (v3 < 0 || !*(&v11)) { perror("recv"); v3 = -1; } else { socket_bye(&v14, 0x0); v9 = memmem(*(&v10), *(&v11), "\r\n\r\n", 0x4); if (v9) { v9 += 4; a3->field_8 = *(&v11) - (v9 - *(&v10)); a3->field_0 = malloc(a3->field_8); if (a3->field_0) { memcpy(a3->field_0, v9, a3->field_8); v3 = 0; } else { perror("recv"); v3 = -1; } } else { fprintf(*(&stderr), "Cannot interpret HTTP response\n"); v3 = -1; } } free(*(&v10)); if (v7 != a0) free(v7); v20 = v3; return v20; }
gnutls
angr_sailr
static void input_from_argv(char **operand, int n_operands, char eolbyte) { char *p; size_t size = n_operands; int i; for (i = 0; i < n_operands; i++) size += strlen(operand[i]); p = xmalloc(size); for (i = 0; i < n_operands; i++) { char *p1 = stpcpy(p, operand[i]); operand[i] = p; p = p1; *p++ = eolbyte; } operand[n_operands] = p; }
char *input_from_argv(long a1, int a2, char a3) { char *result; int i; int j; char *dest; long v8; char *v9; v8 = a2; for (i = 0; i < a2; ++i) v8 += strlen(*(const char **)(8LL * i + a1)); dest = (char *)xmalloc(v8); for (j = 0; j < a2; ++j) { v9 = stpcpy(dest, *(const char **)(8LL * j + a1)); *(_QWORD *)(a1 + 8LL * j) = dest; dest = v9 + 1; *v9 = a3; } result = dest; *(_QWORD *)(a1 + 8LL * a2) = dest; return result; }
coreutils
ida
int crypto_verify_32(const unsigned char *x, const unsigned char *y) { unsigned int differentbits = 0; differentbits |= x[0] ^ y[0]; differentbits |= x[1] ^ y[1]; differentbits |= x[2] ^ y[2]; differentbits |= x[3] ^ y[3]; differentbits |= x[4] ^ y[4]; differentbits |= x[5] ^ y[5]; differentbits |= x[6] ^ y[6]; differentbits |= x[7] ^ y[7]; differentbits |= x[8] ^ y[8]; differentbits |= x[9] ^ y[9]; differentbits |= x[10] ^ y[10]; differentbits |= x[11] ^ y[11]; differentbits |= x[12] ^ y[12]; differentbits |= x[13] ^ y[13]; differentbits |= x[14] ^ y[14]; differentbits |= x[15] ^ y[15]; differentbits |= x[16] ^ y[16]; differentbits |= x[17] ^ y[17]; differentbits |= x[18] ^ y[18]; differentbits |= x[19] ^ y[19]; differentbits |= x[20] ^ y[20]; differentbits |= x[21] ^ y[21]; differentbits |= x[22] ^ y[22]; differentbits |= x[23] ^ y[23]; differentbits |= x[24] ^ y[24]; differentbits |= x[25] ^ y[25]; differentbits |= x[26] ^ y[26]; differentbits |= x[27] ^ y[27]; differentbits |= x[28] ^ y[28]; differentbits |= x[29] ^ y[29]; differentbits |= x[30] ^ y[30]; differentbits |= x[31] ^ y[31]; return (1 & ((differentbits - 1) >> 8)) - 1; }
long long crypto_verify_32(char a0[32], char a1[32]) { unsigned int v0; v0 = 0; v0 |= a1[0] ^ a0[0]; v0 |= a1[1] ^ a0[1]; v0 |= a1[2] ^ a0[2]; v0 |= a1[3] ^ a0[3]; v0 |= a1[4] ^ a0[4]; v0 |= a1[5] ^ a0[5]; v0 |= a1[6] ^ a0[6]; v0 |= a1[7] ^ a0[7]; v0 |= a1[8] ^ a0[8]; v0 |= a1[9] ^ a0[9]; v0 |= a1[10] ^ a0[10]; v0 |= a1[11] ^ a0[11]; v0 |= a1[12] ^ a0[12]; v0 |= a1[13] ^ a0[13]; v0 |= a1[14] ^ a0[14]; v0 |= a1[15] ^ a0[15]; v0 |= a1[16] ^ a0[16]; v0 |= a1[17] ^ a0[17]; v0 |= a1[18] ^ a0[18]; v0 |= a1[19] ^ a0[19]; v0 |= a1[20] ^ a0[20]; v0 |= a1[21] ^ a0[21]; v0 |= a1[22] ^ a0[22]; v0 |= a1[23] ^ a0[23]; v0 |= a1[24] ^ a0[24]; v0 |= a1[25] ^ a0[25]; v0 |= a1[26] ^ a0[26]; v0 |= a1[27] ^ a0[27]; v0 |= a1[28] ^ a0[28]; v0 |= a1[29] ^ a0[29]; v0 |= a1[30] ^ a0[30]; v0 |= a1[31] ^ a0[31]; return ((v0 - 1 >> 8) & 1) - 1; }
openssh-portable
angr_phoenix
static void stophandler(int sig) { if (!1) signal(sig, stophandler); if (!interrupt_signal) stop_signal_count++; }
long long stophandler(unsigned long a0) { unsigned int v0; unsigned long long v2; v0 = a0; v2 = interrupt_signal; if (!interrupt_signal) { v2 = stop_signal_count + 1; stop_signal_count = stop_signal_count + 1; } return v2; }
coreutils
angr_sailr
static int optc_to_fileno(int c) { int ret = -1; switch (c) { case 'e': ret = 2; break; case 'i': ret = 0; break; case 'o': ret = 1; break; } return ret; }
long optc_to_fileno(int a1) { unsigned int v2; v2 = -1; if (a1 == 111) { return 1; } else if (a1 <= 111) { if (a1 == 101) { return 2; } else if (a1 == 105) { return 0; } } return v2; }
coreutils
ida
static void store_columns(void) { int i, j; unsigned int line = 0; unsigned int buff_start; int last_col; COLUMN *p; buff_current = 0; buff_start = 0; if (balance_columns) last_col = columns; else last_col = columns - 1; for (i = 1, p = column_vector; i <= last_col; ++i, ++p) p->lines_stored = 0; for (i = 1, p = column_vector; i <= last_col && files_ready_to_read; ++i, ++p) { p->current_line = line; for (j = lines_per_body; j && files_ready_to_read; --j) if (p->status == OPEN) { input_position = 0; if (!read_line(p)) read_rest_of_line(p); if (p->status == OPEN || buff_start != buff_current) { ++p->lines_stored; line_vector[line] = buff_start; end_vector[line++] = input_position; buff_start = buff_current; } } } line_vector[line] = buff_start; if (balance_columns) balance(line); }
void store_columns() { unsigned int v0; int tmp_76; unsigned int v1; unsigned int v2; unsigned int v3; unsigned int v4; struct_0 *v5; unsigned long long v8; unsigned long long v9; v2 = 0; buff_current = 0; v3 = 0; if (balance_columns) v4 = *(&columns); else v4 = *(&columns) - 1; v0 = 1; for (v5 = column_vector; v0 <= v4; v5 = &v5[1].padding_0[16]) { v5->field_2c = 0; v0 += 1; } v0 = 1; for (*(&v5[0]) = column_vector; v0 <= v4 && files_ready_to_read; *(&v5[0]) = &v5[1].padding_0[16]) { v5[10] = v2; for (v1 = lines_per_body; v1 && files_ready_to_read; v1 -= 1) { if (!v5[4]) { input_position = 0; if ((read_line(v5) ^ 1)) read_rest_of_line(v5); if (!v5[4] || v3 != buff_current) { v5->field_2c = v5->field_2c + 1; *((v2 * 4 + line_vector)) = v3; tmp_76 = v2; v2 += 1; *((end_vector + tmp_76 * 4)) = input_position; v3 = buff_current; } } } v0 += 1; } *((v2 * 4 + line_vector)) = v3; v8 = balance_columns; if (balance_columns) v9 = balance(v2); return; }
coreutils
angr_sailr
(r = sshbuf_get_cstring(iqueue, &pin, ((void *)0) )) != 0) sshfatal("ssh-pkcs11-helper.c", __func__, 133, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "parse"); if ((nkeys = pkcs11_add_provider(name, pin, &keys, &labels)) > 0) { if ((r = sshbuf_put_u8(msg, 12)) != 0 || (r = sshbuf_put_u32(msg, nkeys)) != 0) sshfatal("ssh-pkcs11-helper.c", __func__, 138, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "compose"); for (i = 0; i < nkeys; i++) { if ((r = sshkey_to_blob(keys[i], &blob, &blen)) != 0) { sshlog("ssh-pkcs11-helper.c", __func__, 141, 1, SYSLOG_LEVEL_DEBUG1, ssh_err(r), "encode key"); continue; } if ((r = sshbuf_put_string(msg, blob, blen)) != 0 || (r = sshbuf_put_cstring(msg, labels[i])) != 0) sshfatal("ssh-pkcs11-helper.c", __func__, 146, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "compose key"); free(blob); add_key(keys[i], name, labels[i]); free(labels[i]); } } else if ((r = sshbuf_put_u8(msg, 5)) != 0 ||
void sshbuf_get_cstring(void) { halt_baddata(); }
openssh-portable
ghidra
int sshpkt_start(struct ssh *ssh, u_char type) { u_char buf[6]; ; memset(buf, 0, sizeof(buf)); buf[sizeof(buf) - 1] = type; sshbuf_reset(ssh->state->outgoing_packet); return sshbuf_put(ssh->state->outgoing_packet, buf, sizeof(buf)); }
void sshpkt_start(long *param_1, undefined param_2) { long in_FS_OFFSET; undefined local_16[5]; undefined local_11; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); memset(local_16, 0, 6); local_11 = param_2; sshbuf_reset(*(undefined8 *)(*param_1 + 0x30)); sshbuf_put(*(undefined8 *)(*param_1 + 0x30), local_16, 6); if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) { __stack_chk_fail(); } return; }
openssh-portable
ghidra
void *e2fsck_allocate_memory(e2fsck_t ctx, unsigned long size, const char *description) { void *ret; char buf[256]; if (ext2fs_get_memzero(size, &ret)) { sprintf(buf, "Can't allocate %lu bytes for %s\n", size, description); fatal_error(ctx, buf); } return ret; }
long long e2fsck_allocate_memory(unsigned long a0, unsigned long long a1, unsigned long a2) { unsigned long v0; char v1; char v2; v0 = a0; if (ext2fs_get_memzero(a1, &v1, &v1)) { sprintf(&v2, "Can't allocate %lu bytes for %s\n", a1, a2); fatal_error(); } return *(&v1); }
e2fsprogs-1.46.5
angr_dream
static int check_host_key(char *hostname, const struct ssh_conn_info *cinfo, struct sockaddr *hostaddr, u_short port, struct sshkey *host_key, int readonly, int clobber_port, char **user_hostfiles, u_int num_user_hostfiles, char **system_hostfiles, u_int num_system_hostfiles, const char *hostfile_command) { HostStatus host_status = -1, ip_status = -1; struct sshkey *raw_key = ((void *)0); char *ip = ((void *)0), *host = ((void *)0); char hostline[1000], *hostp, *fp, *ra; char msg[1024]; const char *type, *fail_reason; const struct hostkey_entry *host_found = ((void *)0), *ip_found = ((void *)0); int len, cancelled_forwarding = 0, confirmed; int local = sockaddr_is_local(hostaddr); int r, want_cert = sshkey_is_cert(host_key), host_ip_differ = 0; int hostkey_trusted = 0; struct hostkeys *host_hostkeys, *ip_hostkeys; u_int i; if (options.no_host_authentication_for_localhost == 1 && local && options.host_key_alias == ((void *)0)) { sshlog("sshconnect.c", __func__, 957, 0, SYSLOG_LEVEL_DEBUG1, ((void *)0), "Forcing accepting of host key for " "loopback/localhost."); options.update_hostkeys = 0; return 0; } get_hostfile_hostname_ipaddr(hostname, hostaddr, clobber_port ? 0 : port, &host, &ip); if (options.check_host_ip && (local || strcmp(hostname, ip) == 0 || options.proxy_command != ((void *)0))) options.check_host_ip = 0; host_hostkeys = init_hostkeys(); for (i = 0; i < num_user_hostfiles; i++) load_hostkeys(host_hostkeys, host, user_hostfiles[i], 0); for (i = 0; i < num_system_hostfiles; i++) load_hostkeys(host_hostkeys, host, system_hostfiles[i], 0); if (hostfile_command != ((void *)0) && !clobber_port) { load_hostkeys_command(host_hostkeys, hostfile_command, "HOSTNAME", cinfo, host_key, host); } ip_hostkeys = ((void *)0); if (!want_cert && options.check_host_ip) { ip_hostkeys = init_hostkeys(); for (i = 0; i < num_user_hostfiles; i++) load_hostkeys(ip_hostkeys, ip, user_hostfiles[i], 0); for (i = 0; i < num_system_hostfiles; i++) load_hostkeys(ip_hostkeys, ip, system_hostfiles[i], 0); if (hostfile_command != ((void *)0) && !clobber_port) { load_hostkeys_command(ip_hostkeys, hostfile_command, "ADDRESS", cinfo, host_key, ip); } } retry: want_cert = sshkey_is_cert(host_key); type = sshkey_type(host_key); host_status = check_key_in_hostkeys(host_hostkeys, host_key, &host_found); if (!readonly && (num_user_hostfiles == 0 || (host_found != ((void *)0) && host_found->note != 0))) readonly = 1; if (!want_cert && ip_hostkeys != ((void *)0)) { ip_status = check_key_in_hostkeys(ip_hostkeys, host_key, &ip_found); if (host_status == HOST_CHANGED && (ip_status != HOST_CHANGED || (ip_found != ((void *)0) && !sshkey_equal(ip_found->key, host_found->key)))) host_ip_differ = 1; } else ip_status = host_status; switch (host_status) { case HOST_OK: sshlog("sshconnect.c", __func__, 1040, 0, SYSLOG_LEVEL_DEBUG1, ((void *)0), "Host '%.200s' is known and matches the %s host %s.", host, type, want_cert ? "certificate" : "key"); sshlog("sshconnect.c", __func__, 1042, 0, SYSLOG_LEVEL_DEBUG1, ((void *)0), "Found %s in %s:%lu", want_cert ? "CA key" : "key", host_found->file, host_found->line); if (want_cert) { if (sshkey_cert_check_host( host_key, options.host_key_alias == ((void *)0) ? hostname : options.host_key_alias, 0, options.ca_sign_algorithms, &fail_reason) != 0) { sshlog("sshconnect.c", __func__, 1049, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "%s", fail_reason); goto fail; } if (options.update_hostkeys != 0) { options.update_hostkeys = 0; sshlog("sshconnect.c", __func__, 1058, 1, SYSLOG_LEVEL_DEBUG3, ((void *)0), "certificate host key in use; " "disabling UpdateHostkeys"); } } if (options.update_hostkeys != 0 && (path_in_hostfiles(host_found->file, system_hostfiles, num_system_hostfiles) || (ip_status == HOST_OK && ip_found != ((void *)0) && path_in_hostfiles(ip_found->file, system_hostfiles, num_system_hostfiles)))) { options.update_hostkeys = 0; sshlog("sshconnect.c", __func__, 1070, 1, SYSLOG_LEVEL_DEBUG3, ((void *)0), "host key found in GlobalKnownHostsFile; " "disabling UpdateHostkeys"); } if (options.update_hostkeys != 0 && host_found->note) { options.update_hostkeys = 0; sshlog("sshconnect.c", __func__, 1075, 1, SYSLOG_LEVEL_DEBUG3, ((void *)0), "host key found via KnownHostsCommand; " "disabling UpdateHostkeys"); } if (options.check_host_ip && ip_status == HOST_NEW) { if (readonly || want_cert) sshlog("sshconnect.c", __func__, 1080, 0, SYSLOG_LEVEL_INFO, ((void *)0), "%s host key for IP address " "'%.128s' not in list of known hosts.", type, ip) ; else if (!add_host_to_hostfile(user_hostfiles[0], ip, host_key, options.hash_known_hosts)) sshlog("sshconnect.c", __func__, 1085, 0, SYSLOG_LEVEL_INFO, ((void *)0), "Failed to add the %s host key for IP " "address '%.128s' to the list of known " "hosts (%.500s).", type, ip, user_hostfiles[0]) ; else sshlog("sshconnect.c", __func__, 1090, 0, SYSLOG_LEVEL_INFO, ((void *)0), "Warning: Permanently added the %s host " "key for IP address '%.128s' to the list " "of known hosts.", type, ip) ; } else if (options.visual_host_key) { fp = sshkey_fingerprint(host_key, options.fingerprint_hash, SSH_FP_DEFAULT); ra = sshkey_fingerprint(host_key, options.fingerprint_hash, SSH_FP_RANDOMART); if (fp == ((void *)0) || ra == ((void *)0)) sshfatal("sshconnect.c", __func__, 1099, 1, SYSLOG_LEVEL_FATAL, ((void *)0), "sshkey_fingerprint failed"); sshlog("sshconnect.c", __func__, 1100, 0, SYSLOG_LEVEL_INFO, ((void *)0), "Host key fingerprint is %s\n%s", fp, ra); free(ra); free(fp); } hostkey_trusted = 1; break; case HOST_NEW: if (options.host_key_alias == ((void *)0) && port != 0 && port != 22 && !clobber_port) { sshlog("sshconnect.c", __func__, 1109, 0, SYSLOG_LEVEL_DEBUG1, ((void *)0), "checking without port identifier"); if (check_host_key(hostname, cinfo, hostaddr, 0, host_key, 2, 1, user_hostfiles, num_user_hostfiles, system_hostfiles, num_system_hostfiles, hostfile_command) == 0) { sshlog("sshconnect.c", __func__, 1115, 0, SYSLOG_LEVEL_DEBUG1, ((void *)0), "found matching key w/out port"); break; } } if (readonly || want_cert) goto fail; if (options.strict_host_key_checking == 2) { sshlog("sshconnect.c", __func__, 1129, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "No %s host key is known for %.200s and you " "have requested strict checking.", type, host); goto fail; } else if (options.strict_host_key_checking == 3) { char *msg1 = ((void *)0), *msg2 = ((void *)0); xasprintf(&msg1, "The authenticity of host " "'%.200s (%s)' can't be established", host, ip); if (show_other_keys(host_hostkeys, host_key)) { xextendf(&msg1, "\n", "but keys of different " "type are already known for this host."); } else xextendf(&msg1, "", "."); fp = sshkey_fingerprint(host_key, options.fingerprint_hash, SSH_FP_DEFAULT); ra = sshkey_fingerprint(host_key, options.fingerprint_hash, SSH_FP_RANDOMART); if (fp == ((void *)0) || ra == ((void *)0)) sshfatal("sshconnect.c", __func__, 1150, 1, SYSLOG_LEVEL_FATAL, ((void *)0), "sshkey_fingerprint failed"); xextendf(&msg1, "\n", "%s key fingerprint is %s.", type, fp); if (options.visual_host_key) xextendf(&msg1, "\n", "%s", ra); if (options.verify_host_key_dns) { xextendf(&msg1, "\n", "%s host key fingerprint found in DNS.", matching_host_key_dns ? "Matching" : "No matching"); } if ((msg2 = other_hostkeys_message(host, ip, host_key, user_hostfiles, num_user_hostfiles, system_hostfiles, num_system_hostfiles)) != ((void *)0)) xextendf(&msg1, "\n", "%s", msg2); xextendf(&msg1, "\n", "Are you sure you want to continue connecting " "(yes/no/[fingerprint])? "); confirmed = confirm(msg1, fp); free(ra); free(fp); free(msg1); free(msg2); if (!confirmed) goto fail; hostkey_trusted = 1; } if (options.check_host_ip && ip_status == HOST_NEW) { snprintf(hostline, sizeof(hostline), "%s,%s", host, ip); hostp = hostline; if (options.hash_known_hosts) { r = add_host_to_hostfile(user_hostfiles[0], host, host_key, options.hash_known_hosts) && add_host_to_hostfile(user_hostfiles[0], ip, host_key, options.hash_known_hosts); } else { r = add_host_to_hostfile(user_hostfiles[0], hostline, host_key, options.hash_known_hosts); } } else { r = add_host_to_hostfile(user_hostfiles[0], host, host_key, options.hash_known_hosts); hostp = host; } if (!r) sshlog("sshconnect.c", __func__, 1206, 0, SYSLOG_LEVEL_INFO, ((void *)0), "Failed to add the host to the list of known " "hosts (%.500s).", user_hostfiles[0]); else sshlog("sshconnect.c", __func__, 1209, 0, SYSLOG_LEVEL_INFO, ((void *)0), "Warning: Permanently added '%.200s' (%s) to the " "list of known hosts.", hostp, type); break; case HOST_REVOKED: sshlog("sshconnect.c", __func__, 1213, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"); sshlog("sshconnect.c", __func__, 1214, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "@ WARNING: REVOKED HOST KEY DETECTED! @"); sshlog("sshconnect.c", __func__, 1215, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"); sshlog("sshconnect.c", __func__, 1216, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "The %s host key for %s is marked as revoked.", type, host); sshlog("sshconnect.c", __func__, 1217, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "This could mean that a stolen key is being used to"); sshlog("sshconnect.c", __func__, 1218, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "impersonate this host."); if (options.strict_host_key_checking != 0) { sshlog("sshconnect.c", __func__, 1226, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "%s host key for %.200s was revoked and you have " "requested strict checking.", type, host); goto fail; } goto continue_unsafe; case HOST_CHANGED: if (want_cert) { sshlog("sshconnect.c", __func__, 1239, 0, SYSLOG_LEVEL_DEBUG1, ((void *)0), "Host certificate authority does not " "match %s in %s:%lu", "@cert-authority", host_found->file, host_found->line) ; goto fail; } if (readonly == 2) goto fail; if (options.check_host_ip && host_ip_differ) { char *key_msg; if (ip_status == HOST_NEW) key_msg = "is unknown"; else if (ip_status == HOST_OK) key_msg = "is unchanged"; else key_msg = "has a different value"; sshlog("sshconnect.c", __func__, 1254, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"); sshlog("sshconnect.c", __func__, 1255, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "@ WARNING: POSSIBLE DNS SPOOFING DETECTED! @"); sshlog("sshconnect.c", __func__, 1256, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"); sshlog("sshconnect.c", __func__, 1257, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "The %s host key for %s has changed,", type, host); sshlog("sshconnect.c", __func__, 1258, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "and the key for the corresponding IP address %s", ip); sshlog("sshconnect.c", __func__, 1259, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "%s. This could either mean that", key_msg); sshlog("sshconnect.c", __func__, 1260, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "DNS SPOOFING is happening or the IP address for the host"); sshlog("sshconnect.c", __func__, 1261, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "and its host key have changed at the same time."); if (ip_status != HOST_NEW) sshlog("sshconnect.c", __func__, 1263, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "Offending key for IP in %s:%lu", ip_found->file, ip_found->line); } warn_changed_key(host_key); sshlog("sshconnect.c", __func__, 1268, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "Add correct host key in %.100s to get rid of this message.", user_hostfiles[0]); sshlog("sshconnect.c", __func__, 1270, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "Offending %s key in %s:%lu", sshkey_type(host_found->key), host_found->file, host_found->line) ; if (options.strict_host_key_checking != 0) { sshlog("sshconnect.c", __func__, 1280, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "Host key for %.200s has changed and you have " "requested strict checking.", host); goto fail; } continue_unsafe: if (options.password_authentication) { sshlog("sshconnect.c", __func__, 1292, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "Password authentication is disabled to avoid " "man-in-the-middle attacks."); options.password_authentication = 0; cancelled_forwarding = 1; } if (options.kbd_interactive_authentication) { sshlog("sshconnect.c", __func__, 1298, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "Keyboard-interactive authentication is disabled" " to avoid man-in-the-middle attacks."); options.kbd_interactive_authentication = 0; cancelled_forwarding = 1; } if (options.forward_agent) { sshlog("sshconnect.c", __func__, 1304, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "Agent forwarding is disabled to avoid " "man-in-the-middle attacks."); options.forward_agent = 0; cancelled_forwarding = 1; } if (options.forward_x11) { sshlog("sshconnect.c", __func__, 1310, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "X11 forwarding is disabled to avoid " "man-in-the-middle attacks."); options.forward_x11 = 0; cancelled_forwarding = 1; } if (options.num_local_forwards > 0 || options.num_remote_forwards > 0) { sshlog("sshconnect.c", __func__, 1317, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "Port forwarding is disabled to avoid " "man-in-the-middle attacks."); options.num_local_forwards = options.num_remote_forwards = 0; cancelled_forwarding = 1; } if (options.tun_open != 0x00) { sshlog("sshconnect.c", __func__, 1324, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "Tunnel forwarding is disabled to avoid " "man-in-the-middle attacks."); options.tun_open = 0x00; cancelled_forwarding = 1; } if (options.update_hostkeys != 0) { sshlog("sshconnect.c", __func__, 1330, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "UpdateHostkeys is disabled because the host " "key is not trusted."); options.update_hostkeys = 0; } if (options.exit_on_forward_failure && cancelled_forwarding) sshfatal("sshconnect.c", __func__, 1335, 0, SYSLOG_LEVEL_FATAL, ((void *)0), "Error: forwarding disabled due to host key " "check failure"); break; case HOST_FOUND: sshfatal("sshconnect.c", __func__, 1347, 0, SYSLOG_LEVEL_FATAL, ((void *)0), "internal error"); break; } if (options.check_host_ip && host_status != HOST_CHANGED && ip_status == HOST_CHANGED) { snprintf(msg, sizeof(msg), "Warning: the %s host key for '%.200s' " "differs from the key for the IP address '%.128s'" "\nOffending key for IP in %s:%lu", type, host, ip, ip_found->file, ip_found->line); if (host_status == HOST_OK) { len = strlen(msg); snprintf(msg + len, sizeof(msg) - len, "\nMatching host key in %s:%lu", host_found->file, host_found->line); } if (options.strict_host_key_checking == 3) { strlcat(msg, "\nAre you sure you want " "to continue connecting (yes/no)? ", sizeof(msg)); if (!confirm(msg, ((void *)0))) goto fail; } else if (options.strict_host_key_checking != 0) { sshlog("sshconnect.c", __func__, 1372, 0, SYSLOG_LEVEL_INFO, ((void *)0), "%s", msg); sshlog("sshconnect.c", __func__, 1373, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "Exiting, you have requested strict checking."); goto fail; } else { sshlog("sshconnect.c", __func__, 1376, 0, SYSLOG_LEVEL_INFO, ((void *)0), "%s", msg); } } if (!hostkey_trusted && options.update_hostkeys) { sshlog("sshconnect.c", __func__, 1381, 1, SYSLOG_LEVEL_DEBUG1, ((void *)0), "hostkey not known or explicitly trusted: " "disabling UpdateHostkeys"); options.update_hostkeys = 0; } free(ip); free(host); if (host_hostkeys != ((void *)0)) free_hostkeys(host_hostkeys); if (ip_hostkeys != ((void *)0)) free_hostkeys(ip_hostkeys); return 0; fail: if (want_cert && host_status != HOST_REVOKED) { sshlog("sshconnect.c", __func__, 1400, 0, SYSLOG_LEVEL_DEBUG1, ((void *)0), "No matching CA found. Retry with plain key"); if ((r = sshkey_from_private(host_key, &raw_key)) != 0) sshfatal("sshconnect.c", __func__, 1402, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "decode key"); if ((r = sshkey_drop_cert(raw_key)) != 0) sshfatal("sshconnect.c", __func__, 1404, 0, SYSLOG_LEVEL_FATAL, ssh_err(r), "Couldn't drop certificate"); host_key = raw_key; goto retry; } sshkey_free(raw_key); free(ip); free(host); if (host_hostkeys != ((void *)0)) free_hostkeys(host_hostkeys); if (ip_hostkeys != ((void *)0)) free_hostkeys(ip_hostkeys); return -1; }
int check_host_key(char *a0, unsigned long a1, void *a2, unsigned long long a3, unsigned long long a4, unsigned long a5, unsigned int v39, unsigned long long *a6, unsigned int a7, unsigned long long *a8, unsigned int a9, unsigned long long a10) { unsigned long long v0; unsigned long long *v1; unsigned long long *v2; void *v3; unsigned int v4; unsigned short v5; unsigned int v6; unsigned int v7; unsigned int v8; unsigned int v9; unsigned int v10; unsigned int v11; unsigned int v12; unsigned int v13; unsigned int v14; unsigned int v15; unsigned int v16; void *v17; void *v18; void *v19; char v20; void *v21; void *v22; void *v23; void *v24; unsigned long long v25; unsigned long long v26; unsigned long long v27; unsigned long long v28; unsigned int v29; void *v30; void *v31; char v32; char v33; unsigned long long v34; unsigned long v35; unsigned long long v36; unsigned long v37; unsigned long long v38; unsigned long long v40; unsigned long long v42; unsigned long long v43; v3 = a4; v4 = a5; v5 = a3; v2 = a6; v1 = a8; v0 = a10; v12 = -1; v6 = -1; v17 = 0; v18 = 0; v19 = 0; v21 = 0; v22 = 0; v7 = 0; v13 = sockaddr_is_local(a2); v14 = sshkey_is_cert(v3); v9 = 0; v10 = 0; if (*(5247796) == 1 && v13 && !strcmp) { sshlog("sshconnect.c", "check_host_key", 0x3bd, 0x0, 0x5, 0x0, "Forcing accepting of host key for loopback/localhost."); g_5016dc = 0; v40 = 0; goto LABEL_40487c; } if (v39) v40 = 0; else v40 = v5; get_hostfile_hostname_ipaddr(a0, a2, v40, &v19, &v18); if (g_50005c) { if (!v13 && strcmp(a0, v18) && !htonl) goto LABEL_402bcb; g_50005c = 0; } LABEL_402bcb: v27 = init_hostkeys(); for (v11 = 0; v11 < a7; v11 += 1) { load_hostkeys(v27, v19, v2[v11], 0x0); } for (v11 = 0; v11 < a9; v11 += 1) { load_hostkeys(v27, v19, v1[v11], 0x0); } if (v0 && !v39) load_hostkeys_command(v27, v0, "HOSTNAME", a1, v3, v19); v25 = 0; if (!v14 && g_50005c) { v25 = init_hostkeys(); for (v11 = 0; v11 < a7; v11 += 1) { load_hostkeys(v25, v18, v2[v11], 0x0); } for (v11 = 0; v11 < a9; v11 += 1) { load_hostkeys(v25, v18, v1[v11], 0x0); } if (v0 && !v39) load_hostkeys_command(v25, v0, "ADDRESS", a1, v3, v18); } while (true) { v14 = sshkey_is_cert(v3); v28 = sshkey_type(v3); v12 = check_key_in_hostkeys(v27, v3, &v21, v3); if (!v4) { if (a7) { if (!v21) goto LABEL_402e76; if (!v21[36]) goto LABEL_402e76; } v4 = 1; } LABEL_402e76: if (v14) { LABEL_402efe: v6 = v12; goto LABEL_402f0c; } else { if (!v25) goto LABEL_402efe; v6 = check_key_in_hostkeys(v25, v3, &v22, v3); if (v12 == 2) { if (v6 == 2) { if (!v22) goto LABEL_402f0c; if (!(!sshkey_equal(v22[24], v21[24], v21[24]))) goto LABEL_402f0c; } v9 = 1; } LABEL_402f0c: switch (v12) { case 0: if (!v14) v42 = "key"; else v42 = "certificate"; v37 = v42; v36 = v28; v35 = v19; v34 = "Host '%.200s' is known and matches the %s host %s."; sshlog("sshconnect.c", "check_host_key", 0x410, 0x0, 0x5, 0x0, v38); if (v14) v40 = "CA key"; else v40 = "key"; v37 = v21[16]; v36 = v21[8]; v35 = v40; v34 = "Found %s in %s:%lu"; sshlog("sshconnect.c", "check_host_key", 0x412, 0x0, 0x5, 0x0, v38); if (v14) { if (strcmp) v40 = strcmp; else v40 = a0; if (sshkey_cert_check_host(v3, v40, 0x0, ssh_signal, &v20)) { v37 = *(&v20); v36 = "%s"; sshlog("sshconnect.c", "check_host_key", 0x419, 0x0, 0x2, 0x0, v38); break; } else if (g_5016dc) { g_5016dc = 0; v36 = "certificate host key in use; disabling UpdateHostkeys"; sshlog("sshconnect.c", "check_host_key", 0x422, 0x1, 0x7, 0x0, v38); } } if (g_5016dc) { if (!path_in_hostfiles(v21[8], v1, a9)) { if (!(!v6)) goto LABEL_4031b0; if (!v22) goto LABEL_4031b0; if (!path_in_hostfiles(v22[8], v1, a9)) goto LABEL_4031b0; } g_5016dc = 0; v36 = "host key found in GlobalKnownHostsFile; disabling " "UpdateHostkeys"; sshlog("sshconnect.c", "check_host_key", 0x42e, 0x1, 0x7, 0x0, v38); } LABEL_4031b0: if (g_5016dc && v21[36]) { g_5016dc = 0; v36 = "host key found via KnownHostsCommand; disabling UpdateHostkeys"; sshlog("sshconnect.c", "check_host_key", 0x433, 0x1, 0x7, 0x0, v38); } if (g_50005c && v6 == 1) { if (!v4 && !v14) { if (!add_host_to_hostfile(*(v2), v18, v3, *(5247860))) { v37 = *(v2); v36 = v18; v35 = v28; v34 = "Failed to add the %s host key for IP address '%.128s' to " "the list of known hosts (%.500s)."; sshlog("sshconnect.c", "check_host_key", 0x43d, 0x0, 0x3, 0x0, v38); goto LABEL_40346b; } else { v36 = v18; v35 = v28; v34 = "Warning: Permanently added the %s host key for IP address " "'%.128s' to the list of known hosts."; sshlog("sshconnect.c", "check_host_key", 0x442, 0x0, 0x3, 0x0, v38); goto LABEL_40346b; } } v36 = v18; v35 = v28; v34 = "%s host key for IP address '%.128s' not in list of known hosts."; sshlog("sshconnect.c", "check_host_key", 0x438, 0x0, 0x3, 0x0, v38); goto LABEL_40346b; } if (!*(5247904)) { LABEL_40346b: v10 = 1; goto LABEL_404415; } v30 = sshkey_fingerprint(v3, *(5248728), 0x0, *(5248728)); a3 = *(5248728); v31 = sshkey_fingerprint(v3, *(5248728), 0x4, *(5248728)); if (v30 && !(!v31)) goto LABEL_403403; v36 = "sshkey_fingerprint failed"; sshfatal("sshconnect.c", "check_host_key", 0x44b, 0x1, 0x1, 0x0, v38); LABEL_403403: v36 = v31; v35 = v30; v34 = "Host key fingerprint is %s\n%s"; sshlog("sshconnect.c", "check_host_key", 0x44c, 0x0, 0x3, 0x0, v38); free(v31); free(v30); goto LABEL_40346b; case 1: if (!strcmp && v5 && v5 != 22 && !v39) { v36 = "checking without port identifier"; sshlog("sshconnect.c", "check_host_key", 0x455, 0x0, 0x5, 0x0, v38); v39 = v0; v38 = a9; v37 = v1; v36 = a7; v35 = v2; v34 = 1; v40 = check_host_key(a0, a1, a2, 0x0, v3, 0x2, a9, v0, a6, v18, a8, *(&a9)); if (!v40) { v36 = "found matching key w/out port"; sshlog("sshconnect.c", "check_host_key", 0x45b, 0x0, 0x5, 0x0, a9); goto LABEL_404415; } } if (!v4 && !v14) { if (*(&fork) == 2) { v36 = v19; v35 = v28; v34 = "No %s host key is known for %.200s and you have requested " "strict checking."; sshlog("sshconnect.c", "check_host_key", 0x469, 0x0, 0x2, 0x0, v38); break; } if (*(&fork) != 3) { LABEL_403900: if (g_50005c && v6 == 1) { snprintf(&v32, 0x3e8, "%s,%s", v19, v18); v24 = &v32; if (!*(5247860)) { v8 = add_host_to_hostfile(*(v2), &v32, v3, *(5247860)); goto LABEL_403a37; } else { if (add_host_to_hostfile(*(v2), v19, v3, *(5247860))) { a3 = *(5247860); if (add_host_to_hostfile(*(v2), v18, v3, *(5247860))) { v40 = 1; goto LABEL_4039c7; } } v40 = 0; LABEL_4039c7: v8 = v40; goto LABEL_403a37; } } v8 = add_host_to_hostfile(*(v2), v19, v3, *(5247860)); v24 = v19; LABEL_403a37: if (v8) { v36 = v28; v35 = v24; v34 = "Warning: Permanently added '%.200s' (%s) to the list of " "known hosts."; sshlog("sshconnect.c", "check_host_key", 0x4b9, 0x0, 0x3, 0x0, v38); goto LABEL_404415; } else { v37 = *(v2); v36 = "Failed to add the host to the list of known hosts (%.500s)."; sshlog("sshconnect.c", "check_host_key", 0x4b6, 0x0, 0x3, 0x0, v38); goto LABEL_404415; } } v23 = 0; v29 = 0; xasprintf( &v23, "The authenticity of host '%.200s (%s)' can't be established", v19); if (!show_other_keys(v27, v3)) xextendf(&v23, &g_40640e, ".", a3); else xextendf( &v23, "\n", "but keys of different type are already known for this host.", a3); v30 = sshkey_fingerprint(v3, *(5248728), 0x0, *(5248728)); a3 = *(5248728); v31 = sshkey_fingerprint(v3, *(5248728), 0x4, *(5248728)); if (v30 && !(!v31)) goto LABEL_403742; v36 = "sshkey_fingerprint failed"; sshfatal("sshconnect.c", "check_host_key", 0x47e, 0x1, 0x1, 0x0, v38); LABEL_403742: xextendf(&v23, "\n", "%s key fingerprint is %s.", v28); if (*(5247904)) xextendf(&v23, "\n", "%s", v31); if (*(5243680)) { if (matching_host_key_dns) v43 = "Matching"; else v43 = "No matching"; xextendf(&v23, "\n", "%s host key fingerprint found in DNS.", v43); } v36 = a9; v40 = other_hostkeys_message(v19, v18, v3, v2, a7, v1, v38); v29 = v40; if (*(&v29)) xextendf(&v23, "\n", "%s", *(&v29)); xextendf(&v23, "\n", "Are you sure you want to continue connecting " "(yes/no/[fingerprint])? ", *(5248728)); v15 = confirm(v23, v30); free(v31); free(v30); free(v23); free(*(&v29)); if (!v15) break; v10 = 1; goto LABEL_403900; } if (!v14) { LABEL_404818: sshkey_free(v17); free(v18); free(v19); if (v27) free_hostkeys(v27); if (v25) free_hostkeys(v25); v40 = -1; goto LABEL_40487c; } else { if (v12 == 3) goto LABEL_404818; v36 = "No matching CA found. Retry with plain key"; sshlog("sshconnect.c", "check_host_key", 0x578, 0x0, 0x5, 0x0, v38); v8 = sshkey_from_private(v3, &v17, &v17); if (v8) { v36 = "decode key"; sshfatal("sshconnect.c", "check_host_key", 0x57a, 0x1, 0x1, ssh_err(v8), v38); } v8 = sshkey_drop_cert(v17); if (v8) { v36 = "Couldn't drop certificate"; sshfatal("sshconnect.c", "check_host_key", 0x57c, 0x0, 0x1, ssh_err(v8), v38); } v3 = v17; continue; } case 3: v36 = "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"; sshlog("sshconnect.c", "check_host_key", 0x4bd, 0x0, 0x2, 0x0, *(&v38)); v38 = "@ WARNING: REVOKED HOST KEY DETECTED! @"; sshlog("sshconnect.c", "check_host_key", 0x4be, 0x0, 0x2, 0x0, "@ WARNING: REVOKED HOST KEY DETECTED! @"); v38 = "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"; sshlog("sshconnect.c", "check_host_key", 0x4bf, 0x0, 0x2, 0x0, "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"); v38 = v19; v37 = v28; v36 = "The %s host key for %s is marked as revoked."; sshlog("sshconnect.c", "check_host_key", 0x4c0, 0x0, 0x2, 0x0, v19); a6 = "This could mean that a stolen key is being used to"; sshlog("sshconnect.c", "check_host_key", 0x4c1, 0x0, 0x2, 0x0, v19); v38 = "impersonate this host."; sshlog("sshconnect.c", "check_host_key", 0x4c2, 0x0, 0x2, 0x0, "impersonate this host."); if (*(&fork)) { v36 = v19; v35 = v28; v34 = "%s host key for %.200s was revoked and you have requested " "strict checking."; sshlog("sshconnect.c", "check_host_key", 0x4ca, 0x0, 0x2, 0x0, "impersonate this host."); break; } case 2: if (v14) { v37 = v21[16]; v36 = v21[8]; v35 = "@cert-authority"; v34 = "Host certificate authority does not match %s in %s:%lu"; sshlog("sshconnect.c", "check_host_key", 0x4d7, 0x0, 0x5, 0x0, *(&v38)); break; } if (v4 == 2) break; if (g_50005c && v9) { if (v6 == 1) { v26 = "is unknown"; } else if (v6) { v26 = "has a different value"; } else { v26 = "is unchanged"; } v36 = "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"; sshlog("sshconnect.c", "check_host_key", 0x4e6, 0x0, 0x2, 0x0, v38); v38 = "@ WARNING: POSSIBLE DNS SPOOFING DETECTED! @"; sshlog("sshconnect.c", "check_host_key", 0x4e7, 0x0, 0x2, 0x0, "@ WARNING: POSSIBLE DNS SPOOFING DETECTED! @"); v38 = "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"; sshlog("sshconnect.c", "check_host_key", 0x4e8, 0x0, 0x2, 0x0, "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"); v38 = v19; v37 = v28; v36 = "The %s host key for %s has changed,"; sshlog("sshconnect.c", "check_host_key", 0x4e9, 0x0, 0x2, 0x0, v19); a7 = v18; a6 = "and the key for the corresponding IP address %s"; sshlog("sshconnect.c", "check_host_key", 0x4ea, 0x0, 0x2, 0x0, v19); v39 = v26; v38 = "%s. This could either mean that"; sshlog("sshconnect.c", "check_host_key", 0x4eb, 0x0, 0x2, 0x0, "%s. This could either mean that"); v38 = "DNS SPOOFING is happening or the IP address for the host"; sshlog("sshconnect.c", "check_host_key", 0x4ec, 0x0, 0x2, 0x0, "DNS SPOOFING is happening or the IP address for the host"); v38 = "and its host key have changed at the same time."; sshlog("sshconnect.c", "check_host_key", 0x4ed, 0x0, 0x2, 0x0, "and its host key have changed at the same time."); if (v6 != 1) { v36 = v22[16]; v35 = v22[8]; v34 = "Offending key for IP in %s:%lu"; sshlog("sshconnect.c", "check_host_key", 0x4ef, 0x0, 0x2, 0x0, "and its host key have changed at the same time."); } } warn_changed_key(v3); v37 = *(v2); v36 = "Add correct host key in %.100s to get rid of this message."; sshlog("sshconnect.c", "check_host_key", 0x4f4, 0x0, 0x2, 0x0, v38); v37 = v21[16]; v36 = v21[8]; v35 = sshkey_type(v21[24]); v34 = "Offending %s key in %s:%lu"; sshlog("sshconnect.c", "check_host_key", 0x4f6, 0x0, 0x2, 0x0, v38); if (*(&fork)) { v37 = v19; v36 = "Host key for %.200s has changed and you have requested strict " "checking."; sshlog("sshconnect.c", "check_host_key", 0x500, 0x0, 0x2, 0x0, v38); break; } if (g_500044) { v36 = "Password authentication is disabled to avoid " "man-in-the-middle attacks."; sshlog("sshconnect.c", "check_host_key", 0x50c, 0x0, 0x2, 0x0, v38); g_500044 = 0; v7 = 1; } if (strerror) { v36 = "Keyboard-interactive authentication is disabled to avoid " "man-in-the-middle attacks."; sshlog("sshconnect.c", "check_host_key", 0x512, 0x0, 0x2, 0x0, v38); strerror = 0; v7 = 1; } if (options) { v36 = "Agent forwarding is disabled to avoid man-in-the-middle " "attacks."; sshlog("sshconnect.c", "check_host_key", 0x518, 0x0, 0x2, 0x0, v38); options = 0; v7 = 1; } if (xasprintf) { v36 = "X11 forwarding is disabled to avoid man-in-the-middle attacks."; sshlog("sshconnect.c", "check_host_key", 0x51e, 0x0, 0x2, 0x0, v38); xasprintf = 0; v7 = 1; } if (g_5012e0 <= 0 && g_5012f0 <= 0) goto LABEL_4042df; v36 = "Port forwarding is disabled to avoid man-in-the-middle attacks."; sshlog("sshconnect.c", "check_host_key", 0x525, 0x0, 0x2, 0x0, v38); g_5012f0 = 0; g_5012e0 = g_5012f0; v7 = 1; LABEL_4042df: if (g_501378) { v36 = "Tunnel forwarding is disabled to avoid man-in-the-middle " "attacks."; sshlog("sshconnect.c", "check_host_key", 0x52c, 0x0, 0x2, 0x0, v38); g_501378 = 0; v7 = 1; } if (g_5016dc) { v36 = "UpdateHostkeys is disabled because the host key is not trusted."; sshlog("sshconnect.c", "check_host_key", 0x532, 0x0, 0x2, 0x0, v38); g_5016dc = 0; } if (!g_50001c) goto LABEL_404414; if (!v7) goto LABEL_404414; v36 = "Error: forwarding disabled due to host key check failure"; sshfatal("sshconnect.c", "check_host_key", 0x537, 0x0, 0x1, 0x0, v38); case 4: v36 = "internal error"; sshfatal("sshconnect.c", "check_host_key", 0x543, 0x0, 0x1, 0x0, v38); LABEL_404414: goto LABEL_404415; default: LABEL_404415: if (!g_50005c) { LABEL_404623: if (!v10 && g_5016dc) { v36 = "hostkey not known or explicitly trusted: disabling " "UpdateHostkeys"; sshlog("sshconnect.c", "check_host_key", 0x565, 0x1, 0x5, 0x0, v38); g_5016dc = 0; } free(v18); free(v19); if (v27) free_hostkeys(v27); if (v25) free_hostkeys(v25); v40 = 0; goto LABEL_40487c; } else { if (v12 == 2) goto LABEL_404623; if (!(v6 == 2)) goto LABEL_404623; v37 = v22[16]; v36 = v22[8]; snprintf( &v33, 0x400, "Warning: the %s host key for '%.200s' differs from the key for " "the IP address '%.128s'\nOffending key for IP in %s:%lu", v28, v19, v18, v38, v39); if (!v12) { v16 = strlen(&v33); snprintf(&(&v33)[v16], 0x400 - v16, "\nMatching host key in %s:%lu", v21[8], v21[16]); } if (*(&fork) == 3) { strlcat(&v33, "\nAre you sure you want to continue connecting (yes/no)? ", 0x400); if (!(!confirm(&v33, NULL))) goto LABEL_404623; break; } else if (*(&fork)) { v37 = &v33; v36 = "%s"; sshlog("sshconnect.c", "check_host_key", 0x55c, 0x0, 0x3, 0x0, v38); v38 = "Exiting, you have requested strict checking."; sshlog("sshconnect.c", "check_host_key", 0x55d, 0x0, 0x2, 0x0, "Exiting, you have requested strict checking."); break; } else { v37 = &v33; v36 = "%s"; sshlog("sshconnect.c", "check_host_key", 0x560, 0x0, 0x3, 0x0, v38); goto LABEL_404623; } } } } } LABEL_40487c: return v40; }
openssh-portable
angr_phoenix
static char *hist_error(char *s, int start, int current, int errtype) { char *temp; const char *emsg; int ll, elen; ll = current - start; switch (errtype) { case 0: emsg = "event not found"; elen = 15; break; case 1: emsg = "bad word specifier"; elen = 18; break; case 2: emsg = "substitution failed"; elen = 19; break; case 3: emsg = "unrecognized history modifier"; elen = 29; break; case 4: emsg = "no previous substitution"; elen = 24; break; default: emsg = "unknown expansion error"; elen = 23; break; } temp = (char *)xmalloc(ll + elen + 3); if (s[start]) strncpy(temp, s + start, ll); else ll = 0; temp[ll] = ':'; temp[ll + 1] = ' '; strcpy(temp + ll + 2, emsg); return (temp); }
char *hist_error(long param_1, int param_2, int param_3, undefined4 param_4) { char *__dest; int local_20; int local_1c; char *local_18; local_20 = param_3 - param_2; switch (param_4) { case 0: local_18 = "event not found"; local_1c = 0xf; break; case 1: local_18 = "bad word specifier"; local_1c = 0x12; break; case 2: local_18 = "substitution failed"; local_1c = 0x13; break; case 3: local_18 = "unrecognized history modifier"; local_1c = 0x1d; break; case 4: local_18 = "no previous substitution"; local_1c = 0x18; break; default: local_18 = "unknown expansion error"; local_1c = 0x17; } __dest = (char *)xmalloc((long)(local_1c + local_20 + 3)); if (*(char *)(param_1 + param_2) == '\0') { local_20 = 0; } else { strncpy(__dest, (char *)(param_2 + param_1), (long)local_20); } __dest[local_20] = ':'; __dest[(long)local_20 + 1] = ' '; strcpy(__dest + (long)local_20 + 2, local_18); return __dest; }
bash
ghidra
static struct predicate *set_new_parent(struct predicate *curr, enum predicate_precedence high_prec, struct predicate **prevp) { struct predicate *new_parent; new_parent = xzalloc(sizeof(struct predicate)); new_parent->p_type = BI_OP; new_parent->p_prec = high_prec; new_parent->p_cost = NeedsNothing; switch (high_prec) { case COMMA_PREC: new_parent->pred_func = pred_comma; new_parent->p_name = ","; new_parent->est_success_rate = 1.0; break; case OR_PREC: new_parent->pred_func = pred_or; new_parent->p_name = "-o"; new_parent->est_success_rate = constrain_rate(curr->est_success_rate); break; case AND_PREC: new_parent->pred_func = pred_and; new_parent->p_name = "-a"; new_parent->est_success_rate = constrain_rate(curr->est_success_rate); break; default:; } new_parent->pred_right = curr; *prevp = new_parent; return new_parent; }
int set_new_parent(struct_0 *a0, unsigned long a1, unsigned long long *a2) { struct_1 *v0; v0 = xzalloc(0x138); v0->field_10 = 3; v0->field_14 = a1; v0->field_20 = 0; if (a1 == 3) { v0->field_0 = got.pred_and; v0->field_8 = "-a"; constrain_rate(); v0->field_24 = a0->field_24; } else if (a1 <= 3) { if (a1 == 1) { v0->field_0 = got.pred_comma; v0->field_8 = ","; v0->field_24 = g_403c34; } else if (a1 == 2) { v0->field_0 = got.pred_or; v0->field_8 = "-o"; constrain_rate(); v0->field_24 = a0->field_24; } } v0->field_118 = a0; *(a2) = v0; return v0; }
findutils
angr_dream
static int getchr(void) { int val = 0; if (*gargv) val = **gargv++; return val; }
int getchr(void) { int local_c; local_c = 0; if (*gargv != (char *)0x0) { local_c = (int)**gargv; gargv = gargv + 1; } return local_c; }
dash-0.5.11+git20210903+057cd650a4ed
ghidra
const char *fmtcheck(const char *f1, const char *f2) { const char *f1p, *f2p; EFT f1t, f2t; if (!f1) return f2; f1p = f1; f1t = FMTCHECK_START; f2p = f2; f2t = FMTCHECK_START; while ((f1t = get_next_format(&f1p, f1t)) != FMTCHECK_DONE) { if (f1t == FMTCHECK_UNKNOWN) return f2; f2t = get_next_format(&f2p, f2t); if (f1t != f2t) return f2; } return f1; }
long long fmtcheck(unsigned long long a0, unsigned long long a1) { unsigned int v0; unsigned int v1; unsigned long v2; unsigned long v3; unsigned long long v5; if (!a0) { v5 = a1; } else { v2 = a0; v0 = 0; v3 = a1; v1 = 0; do { v0 = get_next_format(&v2, v0); if (v0 == 24) { v5 = a0; goto LABEL_40083a; } if (v0 == 25) { v5 = a1; goto LABEL_40083a; } v1 = get_next_format(&v3, v1); } while (v0 == v1); v5 = a1; } LABEL_40083a: return v5; }
libbsd-0.11.7
angr_phoenix
ed_argument_digit(EditLine *el, wint_t c) { if (!iswdigit(c)) return 6; if (el->el_state.doingarg) { if (el->el_state.argument > 1000000) return 6; el->el_state.argument = (el->el_state.argument * 10) + (c - '0'); } else { el->el_state.argument = c - '0'; el->el_state.doingarg = 1; } return 3; }
long long ed_argument_digit(unsigned int a0[31], unsigned long a1) { char v0; unsigned long long v2; if (!iswdigit(a1)) { v2 = 6; return v2; } else if (!a0[29]) { a0[30] = *(&v0) - 48; a0[29] = 1; v2 = 3; return v2; } else if (a0[30] <= 1000000) { a0[30] = *(&v0) + ((a0[30] * 4) + a0[30]) * 2 - 48; v2 = 3; return v2; } else { v2 = 6; return v2; } }
libedit
angr_sailr
static double uInt64_to_double(UInt64 *n) { Int32 i; double base = 1.0; double sum = 0.0; for (i = 0; i < 8; i++) { sum += base * (double)(n->b[i]); base *= 256.0; } return sum; }
void uInt64_to_double(char *a0) { unsigned int v0; unsigned long long v1; void *v2; uint128_t v4; uint128_t v5; void *v6; v1 = 0x3ff0000000000000; v2 = 0; for (v0 = 0; v0 <= 7; v0 += 1) { v4 = 0; *(&v4) = a0[v0]; xmm0<16> = ((xmm0<16> * Conv(64->128, Load(addr = stack_base - 24, size = 8, endness = Iend_LE))) + Conv(64->128, Load(addr = stack_base - 16, size = 8, endness = Iend_LE))) v2 = v5; s_18 = L Conv(128->64, (0x4070000000000000 < 128 > *Conv(64->128, Load(addr = stack_base - 24, size = 8, endness = Iend_LE))))<8> } v6 = v2; return; }
bzip2
angr_phoenix
static inline void emit_ancillary_info(char const *program) { struct infomap { char const *program; char const *node; } const infomap[] = { {"[", "test invocation"}, {"coreutils", "Multi-call invocation"}, {"sha224sum", "sha2 utilities"}, {"sha256sum", "sha2 utilities"}, {"sha384sum", "sha2 utilities"}, {"sha512sum", "sha2 utilities"}, {((void *)0), ((void *)0)}}; char const *node = program; struct infomap const *map_prog = infomap; while (map_prog->program && !(strcmp(program, map_prog->program) == 0)) map_prog++; if (map_prog->node) node = map_prog->node; printf (gettext ("\n%s online help: <%s>\n"), "GNU coreutils", "https: char const *lc_messages = setlocale ( 5 , ((void *)0) ); if (lc_messages && strncmp (lc_messages, "" "en_" "", sizeof ("en_") - 1)) { fputs_unlocked (gettext ("Report any translation bugs to " "<https: stdout ) ; } char const *url_program = (strcmp (program, "[") == 0) ? "test" : program; printf (gettext ("Full documentation <%s%s>\n"), "https: printf (gettext ("or available locally via: info '(coreutils) %s%s'\n"), node, node == program ? " invocation" : ""); }
unsigned long emit_ancillary_info(const char *a1) { char *v1; FILE *v2; char *v3; const char *v4; char *v5; const char *v6; char *v7; const char *v9; long *i; const char *v11; const char *v12; long v13[15]; unsigned long v14; v14 = __readfsqword(0x28u); v13[0] = (long)"["; v13[1] = (long)"test invocation"; v13[2] = (long)"coreutils"; v13[3] = (long)"Multi-call invocation"; v13[4] = (long)"sha224sum"; v13[5] = (long)"sha2 utilities"; v13[6] = (long)"sha256sum"; v13[7] = (long)"sha2 utilities"; v13[8] = (long)"sha384sum"; v13[9] = (long)"sha2 utilities"; v13[10] = (long)"sha512sum"; v13[11] = (long)"sha2 utilities"; v13[12] = 0LL; v13[13] = 0LL; v9 = a1; for (i = v13; *i && strcmp(a1, (const char *)*i); i += 2) ; if (i[1]) v9 = (const char *)i[1]; v1 = gettext("\n%s online help: <%s>\n"); printf(v1, "GNU coreutils", "https: v11 = setlocale(5, 0LL); if ( v11 && strncmp(v11, "en_", 3uLL) ) { v2 = stdout; v3 = gettext("Report any translation bugs to <https: fputs_unlocked(v3, v2); } if ( !strcmp(a1, "[") ) v4 = "test"; else v4 = a1; v12 = v4; v5 = gettext("Full documentation <%s%s>\n"); printf(v5, "https: if ( v9 == a1 ) v6 = " invocation"; else v6 = locale; v7 = gettext("or available locally via: info '(coreutils) %s%s'\n"); printf(v7, v9, v6); return __readfsqword(0x28u) ^ v14; }
coreutils
ida
get_stat_birthtime(struct stat const *st __attribute__((__unused__))) { struct timespec t; t.tv_sec = -1; t.tv_nsec = -1; return t; }
void get_stat_birthtime(void) { halt_baddata(); }
tar
ghidra
static void check_perms(void) { if (!list) { } }
void check_perms(void) { return; }
shadow
ghidra
static void print_compoptions(copts, full) unsigned long copts; int full; { const struct _compopt *co; for (co = compopts; co->optname; co++) if (copts & co->optflag) printf("-o %s ", co->optname); else if (full) printf("+o %s ", co->optname); }
const char *print_compoptions(long a1, int a2) { const char *result; const char **i; for (i = (const char **)&compopts;; i += 2) { result = *i; if (!*i) break; if ((a1 & (unsigned long)i[1]) != 0) { printf("-o %s ", *i); } else if (a2) { printf("+o %s ", *i); } } return result; }
bash
ida
static char *format_forward(u_int ftype, struct Forward *fwd) { char *ret; switch (ftype) { case 1: xasprintf(&ret, "local forward %.200s:%d -> %.200s:%d", (fwd->listen_path != ((void *)0)) ? fwd->listen_path : (fwd->listen_host == ((void *)0)) ? (options.fwd_opts.gateway_ports ? "*" : "LOCALHOST") : fwd->listen_host, fwd->listen_port, (fwd->connect_path != ((void *)0)) ? fwd->connect_path : fwd->connect_host, fwd->connect_port); break; case 3: xasprintf(&ret, "dynamic forward %.200s:%d -> *", (fwd->listen_host == ((void *)0)) ? (options.fwd_opts.gateway_ports ? "*" : "LOCALHOST") : fwd->listen_host, fwd->listen_port); break; case 2: xasprintf(&ret, "remote forward %.200s:%d -> %.200s:%d", (fwd->listen_path != ((void *)0)) ? fwd->listen_path : (fwd->listen_host == ((void *)0)) ? "LOCALHOST" : fwd->listen_host, fwd->listen_port, (fwd->connect_path != ((void *)0)) ? fwd->connect_path : fwd->connect_host, fwd->connect_port); break; default: sshfatal("mux.c", __func__, 560, 1, SYSLOG_LEVEL_FATAL, ((void *)0), "unknown forward type %u", ftype); } return ret; }
undefined8 format_forward(uint param_1, char **param_2) { char *pcVar1; char *pcVar2; char ***pppcVar3; long in_FS_OFFSET; char *pcStack56; ulong uStack48; char **local_28; uint local_1c; undefined8 local_18; long local_10; pppcVar3 = &local_28; local_10 = *(long *)(in_FS_OFFSET + 0x28); local_28 = param_2; local_1c = param_1; if (param_1 == 3) { if (*param_2 == (char *)0x0) { if (_sshbuf_get_cstring == 0) { pcVar1 = "LOCALHOST"; } else { pcVar1 = "*"; } } else { pcVar1 = *param_2; } uStack48 = 0x101644; xasprintf(&local_18, "dynamic forward %.200s:%d -> *", pcVar1, *(undefined4 *)(param_2 + 1)); goto LAB_00101703; } if (param_1 < 4) { if (param_1 == 1) { if (param_2[5] == (char *)0x0) { pcVar1 = param_2[3]; } else { pcVar1 = param_2[5]; } if (param_2[2] == (char *)0x0) { if (*param_2 == (char *)0x0) { if (_sshbuf_get_cstring == 0) { pcVar2 = "LOCALHOST"; } else { pcVar2 = "*"; } } else { pcVar2 = *param_2; } } else { pcVar2 = param_2[2]; } uStack48 = 0x1015ef; xasprintf(&local_18, "local forward %.200s:%d -> %.200s:%d", pcVar2, *(undefined4 *)(param_2 + 1), pcVar1, *(undefined4 *)(param_2 + 4)); pppcVar3 = &local_28; goto LAB_00101703; } if (param_1 == 2) { if (param_2[5] == (char *)0x0) { pcVar1 = param_2[3]; } else { pcVar1 = param_2[5]; } if (param_2[2] == (char *)0x0) { if (*param_2 == (char *)0x0) { pcVar2 = "LOCALHOST"; } else { pcVar2 = *param_2; } } else { pcVar2 = param_2[2]; } uStack48 = 0x1016c7; xasprintf(&local_18, "remote forward %.200s:%d -> %.200s:%d", pcVar2, *(undefined4 *)(param_2 + 1), pcVar1, *(undefined4 *)(param_2 + 4)); pppcVar3 = &local_28; goto LAB_00101703; } } uStack48 = (ulong)param_1; pcStack56 = "unknown forward type %u"; sshfatal("mux.c", "format_forward", 0x230, 1, 1, 0); pppcVar3 = (char ***)&pcStack56; LAB_00101703: if (local_10 == *(long *)(in_FS_OFFSET + 0x28)) { return local_18; } *(undefined8 *)((long)pppcVar3 + -8) = 0x10171b; __stack_chk_fail(); }
openssh-portable
ghidra
test_code_t test_dhe_group(gnutls_session_t session) { int ret, ret2; gnutls_datum_t gen, prime, pubkey2; const char *print; FILE *fp; (void)remove("debug-dh.out"); if (verbose == 0 || pubkey.data == ((void *)0)) return TEST_IGNORE; sprintf(prio_str, "NONE:" "+CIPHER-ALL:+ARCFOUR-128:+3DES-CBC" ":+GOST28147-TC26Z-CNT" ":" "+COMP-NULL" ":%s:" "+MAC-ALL:+MD5:+SHA1" ":+GOST28147-TC26Z-IMIT" ":+DHE-RSA:+DHE-DSS:%s", protocol_str, rest); { int _ret; if ((_ret = __gnutls_priority_set_direct(session, prio_str, 544)) != TEST_SUCCEED) { return _ret; } }; gnutls_credentials_set(session, GNUTLS_CRD_CERTIFICATE, xcred); ret = test_do_handshake(session); ret2 = gnutls_dh_get_group(session, &gen, &prime); if (ret2 >= 0) { fp = fopen("debug-dh.out", "w"); if (fp == ((void *)0)) return TEST_FAILED; ext_text = "saved in debug-dh.out"; print = raw_to_string(gen.data, gen.size); if (print) { fprintf(fp, " Generator [%d bits]: %s\n", gen.size * 8, print); } print = raw_to_string(prime.data, prime.size); if (print) { fprintf(fp, " Prime [%d bits]: %s\n", prime.size * 8, print); } gnutls_dh_get_pubkey(session, &pubkey2); print = raw_to_string(pubkey2.data, pubkey2.size); if (print) { fprintf(fp, " Pubkey [%d bits]: %s\n", pubkey2.size * 8, print); } if (pubkey2.data && pubkey2.size == pubkey.size && memcmp(pubkey.data, pubkey2.data, pubkey.size) == 0) { fprintf(fp, " (public key seems to be static among sessions)\n"); } { gnutls_dh_params_t dhp; gnutls_datum_t p3; ret2 = gnutls_dh_params_init(&dhp); if (ret2 < 0) { fclose(fp); return TEST_FAILED; } ret2 = gnutls_dh_params_import_raw(dhp, &prime, &gen); if (ret2 < 0) { gnutls_dh_params_deinit(dhp); fclose(fp); return TEST_FAILED; } ret2 = gnutls_dh_params_export2_pkcs3(dhp, GNUTLS_X509_FMT_PEM, &p3); if (ret2 < 0) { gnutls_dh_params_deinit(dhp); fclose(fp); return TEST_FAILED; } gnutls_dh_params_deinit(dhp); fprintf(fp, "\n%s\n", p3.data); gnutls_free((void *)(p3.data)), p3.data = ((void *)0); } fclose(fp); } return ret; }
long long test_dhe_group(unsigned long long a0) { unsigned int v0; unsigned int v1; unsigned int v2; char v3; void *v4; unsigned long v5; char v6; char v7; char v8; char v9; char v10; char v11; void *v12; unsigned long long v14; remove("debug-dh.out"); if (!verbose) { v14 = 3; return v14; } else if (!pubkey) { v14 = 3; return v14; } else { sprintf(&prio_str, "NONE:+CIPHER-ALL:+ARCFOUR-128:+3DES-CBC:+GOST28147-TC26Z-CNT:+" "COMP-NULL:%s:+MAC-ALL:+MD5:+SHA1:+GOST28147-TC26Z-IMIT:+DHE-RSA:+" "DHE-DSS:%s", &protocol_str, &rest); v0 = __gnutls_priority_set_direct(a0, &prio_str, 0x220); if (v0) { v14 = v0; return v14; } gnutls_credentials_set(a0, 0x1, xcred); v1 = test_do_handshake(a0); v2 = gnutls_dh_get_group(a0, &v6, &v8, &v6); if (v2 >= 0) { v4 = fopen("debug-dh.out", "w"); if (!v4) { v14 = 1; return v14; } ext_text = "saved in debug-dh.out"; v5 = raw_to_string(*(&v6), *(&v7), *(&v7)); if (v5) fprintf(v4, " Generator [%d bits]: %s\n", (*(&v7) * 8), v5); v5 = raw_to_string(*(&v8), *(&v9), *(&v9)); if (v5) fprintf(v4, " Prime [%d bits]: %s\n", (*(&v9) * 8), v5); gnutls_dh_get_pubkey(a0, &v10); v5 = raw_to_string(*(&v10), *(&v11), *(&v11)); if (v5) fprintf(v4, " Pubkey [%d bits]: %s\n", (*(&v11) * 8), v5); if (*(&v10) && *(&v11) == g_403c88 && !memcmp(pubkey, *(&v10), g_403c88)) fprintf(v4, " (public key seems to be static among sessions)\n"); v2 = gnutls_dh_params_init(&v3); if (v2 < 0) { fclose(v4); v14 = 1; return v14; } v2 = gnutls_dh_params_import_raw(*(&v3), &v8, &v6, &v8); if (v2 < 0) { gnutls_dh_params_deinit(*(&v3)); fclose(v4); v14 = 1; return v14; } v2 = gnutls_dh_params_export2_pkcs3(*(&v3), 0x1, &v12); if (v2 < 0) { gnutls_dh_params_deinit(*(&v3)); fclose(v4); v14 = 1; return v14; } gnutls_dh_params_deinit(*(&v3)); fprintf(v4, "\n%s\n", *(&v12)); *(5243192)(*(&v12)); v12 = 0; fclose(v4); } v14 = v1; return v14; } }
gnutls
angr_sailr
int kexc25519_shared_key_ext(const u_char key[32], const u_char pub[32], struct sshbuf *out, int raw) { u_char shared_key[32]; u_char zero[32]; int r; crypto_scalarmult_curve25519(shared_key, key, pub); explicit_bzero(zero, 32); if (timingsafe_bcmp(zero, shared_key, 32) == 0) return -20; if (raw) r = sshbuf_put(out, shared_key, 32); else r = sshbuf_put_bignum2_bytes(out, shared_key, 32); explicit_bzero(shared_key, 32); return r; }
long kexc25519_shared_key_ext(long a1, long a2, long a3, int a4) { unsigned int v7; char v8[32]; char v9[40]; unsigned long v10; v10 = __readfsqword(0x28u); crypto_scalarmult_curve25519(v8, a1, a2); explicit_bzero(v9, 32LL); if (!(unsigned int)timingsafe_bcmp(v9, v8, 32LL)) return 4294967276LL; if (a4) v7 = sshbuf_put(a3, v8, 32LL); else v7 = sshbuf_put_bignum2_bytes(a3, v8, 32LL); explicit_bzero(v8, 32LL); return v7; }
openssh-portable
ida
static int ext4_fc_handle_link_and_create(e2fsck_t ctx, struct ext4_fc_tl *tl, __u8 *val) { struct dentry_info_args darg; ext2_filsys fs = ctx->fs; struct ext2_inode_large inode_large; int ret, filetype, mode; ret = tl_to_darg(&darg, tl, val); if (ret) return ret; ext4_fc_flush_extents(ctx, 0); ret = __errcode_to_errno( ext2fs_read_inode(fs, darg.ino, (struct ext2_inode *)&inode_large), __func__, 674); if (ret) goto out; mode = inode_large.i_mode; if ((((mode) & 00170000) == 0100000)) filetype = 1; else if ((((mode) & 00170000) == 0040000)) filetype = 2; else if ((((mode) & 00170000) == 0020000)) filetype = 3; else if ((((mode) & 00170000) == 0060000)) filetype = 4; else if ((((mode) & 00170000) == 0120000)) return 7; else if ((((mode) & 00170000) == 0010000)) filetype = 5; else if ((((mode) & 00170000) == 0140000)) filetype = 6; else { ret = -22; goto out; } ext2fs_unlink(fs, darg.parent_ino, darg.dname, darg.ino, 0x1); ret = __errcode_to_errno( ext2fs_link(fs, darg.parent_ino, darg.dname, darg.ino, filetype), __func__, 707) ; out: free(darg.dname); return ret; }
int ext4_fc_handle_link_and_create(unsigned long long *a0, unsigned short *a1, void *a2) { unsigned int v0; unsigned int v1; unsigned int v2; unsigned long long v3; char v4; char v5; char v6; char v7; unsigned int v9; v3 = *(a0); v0 = tl_to_darg(&v4, a1, a2); if (v0) { v9 = v0; return v9; } ext4_fc_flush_extents(a0, 0x0); v0 = __errcode_to_errno(ext2fs_read_inode(v3, *(&v5), &v7, *(&v5)), "ext4_fc_handle_link_and_create", 0x2a2); if (v0) { free(*(&v6)); v9 = v0; return v9; } v2 = *(&v7); switch (v2 & 0xf000) { case 32768: v1 = 1; break; case 16384: v1 = 2; break; case 8192: v1 = 3; break; case 24576: v1 = 4; break; case 40960: v9 = 7; return v9; case 4096: v1 = 5; break; case 49152: v1 = 6; break; default: v0 = -22; free(*(&v6)); v9 = v0; return v9; } ext2fs_unlink(v3, *(&v4), *(&v6), *(&v5), 0x1); v0 = __errcode_to_errno(ext2fs_link(v3, *(&v4), *(&v6), *(&v5), v1), "ext4_fc_handle_link_and_create", 0x2c3); free(*(&v6)); v9 = v0; return v9; }
e2fsprogs-1.46.5
angr_sailr
static void tr_static_init() {}
void tr_static_init() { char v0; unsigned long long v2; v2 = *(&v0); return; }
zlib
angr_dream
static void expand_logfn(e2fsck_t ctx, const char *log_fn, struct string *s) { const char *cp; int i; int flags = 0; alloc_string(s, 100); for (cp = log_fn; *cp; cp++) { if (cp[0] == '%') { cp++; expand_percent_expression(ctx, *cp, s, &flags); continue; } for (i = 0; cp[i]; i++) if (cp[i] == '%') break; append_string(s, cp, i); cp += i - 1; } }
void expand_logfn(undefined8 param_1, char *param_2, undefined8 param_3) { long in_FS_OFFSET; undefined4 local_20; int local_1c; char *local_18; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); local_20 = 0; alloc_string(param_3, 100); for (local_18 = param_2; *local_18 != '\0'; local_18 = local_18 + 1) { if (*local_18 == '%') { local_18 = local_18 + 1; expand_percent_expression(param_1, (int)*local_18, param_3, &local_20); } else { for (local_1c = 0; (local_18[local_1c] != '\0' && (local_18[local_1c] != '%')); local_1c = local_1c + 1) { } append_string(param_3, local_18, local_1c); local_18 = local_18 + (long)local_1c + -1; } } if (local_10 == *(long *)(in_FS_OFFSET + 0x28)) { return; } __stack_chk_fail(); }
e2fsprogs-1.46.5
ghidra
static _Bool do_arm_swaps(struct predicate *p) { if (p) { _Bool swapped; do { swapped = 0; if (consider_arm_swap(p) || do_arm_swaps(p->pred_left) || do_arm_swaps(p->pred_right)) { swapped = 1; } } while (swapped); return swapped; } else { return 0; } }
long do_arm_swaps(long a1) { char v2; if (!a1) return 0LL; do { v2 = 0; if ((unsigned char)consider_arm_swap(a1) || (unsigned char)do_arm_swaps(*(_QWORD *)(a1 + 272)) || (unsigned char)do_arm_swaps(*(_QWORD *)(a1 + 280))) { v2 = 1; } } while (v2); return 0LL; }
findutils
ida
void usage(int status) { if (status != 0) do { fprintf(stderr, gettext("Try '%s --help' for more information.\n"), program_name); } while (0); else { printf(gettext("Usage: %s [OPTION]...\n"), program_name); fputs_unlocked(gettext("Print the file name of the terminal connected to " "standard input.\n\n -s, --silent, --quiet print " "nothing, only return an exit status\n"), stdout) ; fputs_unlocked(gettext(" --help display this help and exit\n"), stdout); fputs_unlocked( gettext(" --version output version information and exit\n"), stdout); emit_ancillary_info("tty"); } exit(status); }
void usage(unsigned long a0) { unsigned long v0; unsigned long v2; v0 = v2; if (a0) { fprintf(stderr, gettext("Try '%s --help' for more information.\n")); } else { printf(gettext("Usage: %s [OPTION]...\n")); fputs_unlocked(gettext("Print the file name of the terminal connected to " "standard input.\n\n -s, --silent, --quiet print " "nothing, only return an exit status\n"), stdout); fputs_unlocked(gettext(" --help display this help and exit\n"), stdout); fputs_unlocked( gettext(" --version output version information and exit\n"), stdout); emit_ancillary_info("tty"); } exit(a0); }
coreutils
angr_sailr
static void print_cache_flags(FILE *fp, __u32 flags) { json_writer_t *jw = get_json_writer(); flags &= ~0xFFFF; if (jw) { jsonw_name(jw, "cache"); jsonw_start_array(jw); } else { fprintf(fp, "%s cache ", _SL_); if (flags == 0) return; putc('<', fp); } if (flags & 0x80000000) { flags &= ~0x80000000; if (jw) jsonw_string(jw, "local"); else fprintf(fp, "%s%s", "local", flags ? "," : "> "); }; if (flags & 0x40000000) { flags &= ~0x40000000; if (jw) jsonw_string(jw, "reject"); else fprintf(fp, "%s%s", "reject", flags ? "," : "> "); }; if (flags & 0x20000000) { flags &= ~0x20000000; if (jw) jsonw_string(jw, "mc"); else fprintf(fp, "%s%s", "mc", flags ? "," : "> "); }; if (flags & 0x10000000) { flags &= ~0x10000000; if (jw) jsonw_string(jw, "brd"); else fprintf(fp, "%s%s", "brd", flags ? "," : "> "); }; if (flags & 0x08000000) { flags &= ~0x08000000; if (jw) jsonw_string(jw, "dst-nat"); else fprintf(fp, "%s%s", "dst-nat", flags ? "," : "> "); }; if (flags & 0x00800000) { flags &= ~0x00800000; if (jw) jsonw_string(jw, "src-nat"); else fprintf(fp, "%s%s", "src-nat", flags ? "," : "> "); }; if (flags & 0x00400000) { flags &= ~0x00400000; if (jw) jsonw_string(jw, "masq"); else fprintf(fp, "%s%s", "masq", flags ? "," : "> "); }; if (flags & 0x00020000) { flags &= ~0x00020000; if (jw) jsonw_string(jw, "dst-direct"); else fprintf(fp, "%s%s", "dst-direct", flags ? "," : "> "); }; if (flags & 0x04000000) { flags &= ~0x04000000; if (jw) jsonw_string(jw, "src-direct"); else fprintf(fp, "%s%s", "src-direct", flags ? "," : "> "); }; if (flags & 0x00040000) { flags &= ~0x00040000; if (jw) jsonw_string(jw, "redirected"); else fprintf(fp, "%s%s", "redirected", flags ? "," : "> "); }; if (flags & 0x01000000) { flags &= ~0x01000000; if (jw) jsonw_string(jw, "redirect"); else fprintf(fp, "%s%s", "redirect", flags ? "," : "> "); }; if (flags & 0x00200000) { flags &= ~0x00200000; if (jw) jsonw_string(jw, "fastroute"); else fprintf(fp, "%s%s", "fastroute", flags ? "," : "> "); }; if (flags & 0x00010000) { flags &= ~0x00010000; if (jw) jsonw_string(jw, "notify"); else fprintf(fp, "%s%s", "notify", flags ? "," : "> "); }; if (flags & 0x00080000) { flags &= ~0x00080000; if (jw) jsonw_string(jw, "proxy"); else fprintf(fp, "%s%s", "proxy", flags ? "," : "> "); }; if (flags) print_hex(PRINT_ANY, "flags", "%x>", flags); if (jw) jsonw_end_array(jw); }
void print_cache_flags(void *a0, unsigned long a1) { unsigned int v0; unsigned long long v1; unsigned int v3; unsigned int v4; unsigned long long v5; unsigned long long v6; unsigned long long v7; unsigned long long v8; v0 = a1; v1 = get_json_writer(); v0 &= -0x10000; if (v1) { jsonw_name(v1, "cache"); jsonw_start_array(v1); } else { v3 = fprintf(a0, "%s cache ", _SL_); if (!v0) goto LABEL_4018a6; putc(0x3c, a0); } if (v0 < 0) { v0 &= 2147483647; if (v1) { jsonw_string(v1, "local"); } else { if (!v0) v3 = &g_409ff7; else v3 = ","; fprintf(a0, "%s%s", &g_409fef, v3); } } if ((v0 & 0x40000000)) { v0 &= 3221225471; if (v1) { jsonw_string(v1, "reject"); } else { if (!v0) v3 = &g_409ff7; else v3 = ","; fprintf(a0, "%s%s", &g_409fff, v3); } } if ((v0 & 0x20000000)) { v0 &= 3758096383; if (v1) { jsonw_string(v1, "mc"); } else { if (!v0) v3 = &g_409ff7; else v3 = ","; fprintf(a0, "%s%s", &g_40a006, v3); } } if ((v0 & 0x10000000)) { v0 &= 4026531839; if (v1) { jsonw_string(v1, "brd"); } else { if (!v0) v3 = &g_409ff7; else v3 = ","; fprintf(a0, "%s%s", &g_40a009, v3); } } if ((v0 & 0x8000000)) { v0 &= -134217729; if (v1) { jsonw_string(v1, "dst-nat"); } else { if (!v0) v3 = &g_409ff7; else v3 = ","; fprintf(a0, "%s%s", &g_40a00d, v3); } } if ((v0 & 0x800000)) { v0 &= -8388609; if (v1) { jsonw_string(v1, "src-nat"); } else { if (!v0) v3 = &g_409ff7; else v3 = ","; fprintf(a0, "%s%s", &g_40a015, v3); } } if ((v0 & rta_getattr_u8)) { v0 &= -4194305; if (v1) { jsonw_string(v1, "masq"); } else { if (!v0) v3 = &g_409ff7; else v3 = ","; fprintf(a0, "%s%s", &g_40a01d, v3); } } if ((v0 & 0x20000)) { v0 &= -131073; if (v1) { jsonw_string(v1, "dst-direct"); } else { if (!v0) v3 = &g_409ff7; else v3 = ","; fprintf(a0, "%s%s", &g_40a022, v3); } } if ((v0 & 0x4000000)) { v0 &= -67108865; if (v1) { jsonw_string(v1, "src-direct"); } else { if (!v0) v3 = &g_409ff7; else v3 = ","; fprintf(a0, "%s%s", &g_40a02d, v3); } } if ((v0 & 0x40000)) { v0 &= -262145; if (v1) { jsonw_string(v1, "redirected"); } else { if (!v0) v3 = &g_409ff7; else v3 = ","; fprintf(a0, "%s%s", &g_40a038, v3); } } if ((v0 & 0x1000000)) { v0 &= -16777217; if (v1) { jsonw_string(v1, "redirect"); } else { if (!v0) v3 = &g_409ff7; else v3 = ","; fprintf(a0, "%s%s", &g_40a043, v3); } } if ((v0 & 0x200000)) { v0 &= -2097153; if (v1) { jsonw_string(v1, "fastroute"); } else { if (!v0) v3 = &g_409ff7; else v3 = ","; fprintf(a0, "%s%s", &g_40a04c, v3); } } if ((v0 & 0x10000)) { v0 &= -65537; if (v1) { jsonw_string(v1, "notify"); } else { if (!v0) v3 = &g_409ff7; else v3 = ","; fprintf(a0, "%s%s", &g_409f7c, v3); } } v4 = v0 & 0x80000; if ((v0 & 0x80000)) { v0 &= -524289; if (v1) { v5 = jsonw_string(v1, "proxy"); } else { if (!v0) v4 = &g_409ff7; else v4 = ","; v6 = fprintf(a0, "%s%s", &g_40a056, v4); } } if (v0) v7 = print_hex(0x4, "flags", "%x>", v0); if (v1) v8 = jsonw_end_array(v1); LABEL_4018a6: return; }
iproute2-6.0.0
angr_phoenix
static int parse_sshsig_request(struct sshbuf *msg) { int r; struct sshbuf *b; if ((b = sshbuf_fromb(msg)) == ((void *)0)) sshfatal("ssh-agent.c", __func__, 663, 1, SYSLOG_LEVEL_FATAL, ((void *)0), "sshbuf_fromb"); if ((r = sshbuf_cmp(b, 0, "SSHSIG", 6)) != 0 || (r = sshbuf_consume(b, 6)) != 0 || (r = sshbuf_get_cstring(b, ((void *)0), ((void *)0))) != 0 || (r = sshbuf_get_string_direct(b, ((void *)0), ((void *)0))) != 0 || (r = sshbuf_get_cstring(b, ((void *)0), ((void *)0))) != 0 || (r = sshbuf_get_string_direct(b, ((void *)0), ((void *)0))) != 0) goto out; if (sshbuf_len(b) != 0) { r = -4; goto out; } r = 0; out: sshbuf_free(b); return r; }
int parse_sshsig_request(unsigned long long a0) { unsigned long long v0; unsigned int v1; unsigned long long v2; v2 = sshbuf_fromb(a0); if (!v2) { v0 = "sshbuf_fromb"; sshfatal("ssh-agent.c", "parse_sshsig_request", 0x297, 0x1, 0x1, 0x0); } v1 = sshbuf_cmp(v2, 0x0, "SSHSIG", 0x6); if (!v1) { v1 = sshbuf_consume(v2, 0x6); if (!v1) { v1 = sshbuf_get_cstring(v2, 0x0, 0x0, 0x6); if (!v1) { v1 = sshbuf_get_string_direct(v2, 0x0, 0x0); if (!v1) { v1 = sshbuf_get_cstring(v2, 0x0, 0x0, 0x6); if (!v1) { v1 = sshbuf_get_string_direct(v2, 0x0, 0x0); if (!v1) { if (sshbuf_len(v2)) v1 = -0x4; else v1 = 0; } } } } } } sshbuf_free(v2); return v1; }
openssh-portable
angr_dream
static void dumpdir_decoder(struct tar_stat_info *st, char const *keyword __attribute__((unused)), char const *arg, size_t size) { st->dumpdir = xmalloc(size); memcpy(st->dumpdir, arg, size); }
long long dumpdir_decoder(struct_0 *a0, unsigned long a1, void *a2, unsigned long a3) { unsigned long v0; v0 = a1; a0->field_190 = xmalloc(a3); return memcpy(a0->field_190, a2, a3); }
tar
angr_dream
void auth2_update_session_info(Authctxt *authctxt, const char *method, const char *submethod) { int r; if (authctxt->session_info == ((void *)0)) { if ((authctxt->session_info = sshbuf_new()) == ((void *)0)) sshfatal("auth2.c", __func__, 817, 1, SYSLOG_LEVEL_FATAL, ((void *)0), "sshbuf_new"); } if ((r = sshbuf_putf(authctxt->session_info, "%s%s%s", method, submethod == ((void *)0) ? "" : "/", submethod == ((void *)0) ? "" : submethod)) != 0) sshfatal("auth2.c", __func__, 824, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "append method"); if (authctxt->auth_method_key != ((void *)0)) { if ((r = sshbuf_put_u8(authctxt->session_info, ' ')) != 0 || (r = sshkey_format_text(authctxt->auth_method_key, authctxt->session_info)) != 0) sshfatal("auth2.c", __func__, 831, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "append key"); } if (authctxt->auth_method_info != ((void *)0)) { if (strchr(authctxt->auth_method_info, '\n') != ((void *)0)) sshfatal("auth2.c", __func__, 837, 1, SYSLOG_LEVEL_FATAL, ((void *)0), "auth_method_info contains \\n"); if ((r = sshbuf_put_u8(authctxt->session_info, ' ')) != 0 || (r = sshbuf_putf(authctxt->session_info, "%s", authctxt->auth_method_info)) != 0) { sshfatal("auth2.c", __func__, 841, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "append method info"); } } if ((r = sshbuf_put_u8(authctxt->session_info, '\n')) != 0) sshfatal("auth2.c", __func__, 845, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "append"); }
long auth2_update_session_info(long a1, const char *a2, const char *a3) { const char *v3; const char *v4; long v5; long v6; long v7; long result; long v9; unsigned int v11; unsigned int v12; unsigned int v13; if (!*(_QWORD *)(a1 + 136)) { *(_QWORD *)(a1 + 136) = sshbuf_new(); if (!*(_QWORD *)(a1 + 136)) sshfatal("auth2.c", "auth2_update_session_info", 817LL, 1LL, 1LL, 0LL, "sshbuf_new"); } if (a3) v3 = a3; else v3 = (const char *)&unk_2830; if (a3) v4 = "/"; else v4 = (const char *)&unk_2830; v11 = sshbuf_putf(*(_QWORD *)(a1 + 136), "%s%s%s", a2, v4, v3); if (v11) { v5 = ssh_err(v11); sshfatal("auth2.c", "auth2_update_session_info", 824LL, 1LL, 1LL, v5, "append method"); } if (*(_QWORD *)(a1 + 120)) { v12 = sshbuf_put_u8(*(_QWORD *)(a1 + 136), 32LL); if (v12 || (v12 = sshkey_format_text(*(_QWORD *)(a1 + 120), *(_QWORD *)(a1 + 136))) != 0) { v6 = ssh_err(v12); sshfatal("auth2.c", "auth2_update_session_info", 831LL, 1LL, 1LL, v6, "append key"); } } if (*(_QWORD *)(a1 + 128)) { if (strchr(*(const char **)(a1 + 128), 10)) sshfatal("auth2.c", "auth2_update_session_info", 837LL, 1LL, 1LL, 0LL, "auth_method_info contains \\n"); v13 = sshbuf_put_u8(*(_QWORD *)(a1 + 136), 32LL); if (v13 || (v13 = sshbuf_putf(*(_QWORD *)(a1 + 136), "%s", *(const char **)(a1 + 128))) != 0) { v7 = ssh_err(v13); sshfatal("auth2.c", "auth2_update_session_info", 841LL, 1LL, 1LL, v7, "append method info"); } } result = sshbuf_put_u8(*(_QWORD *)(a1 + 136), 10LL); if ((_DWORD)result) { v9 = ssh_err((unsigned int)result); return sshfatal("auth2.c", "auth2_update_session_info", 845LL, 1LL, 1LL, v9, "append"); } return result; }
openssh-portable
ida
static void print_element(char const *element) { static _Bool printed; if (printed) putchar_unlocked(' '); printed = 1; fputs_unlocked(element, stdout); }
void print_element(char *a0) { unsigned long long v1; if (printed.5758) putchar_unlocked(0x20); printed.5758 = 1; v1 = fputs_unlocked(a0, stdout); return; }
coreutils
angr_sailr
const char *tnl_strproto(__u8 proto) { switch (proto) { case IPPROTO_IPIP: return "ip"; case IPPROTO_GRE: return "gre"; case IPPROTO_IPV6: return "ipv6"; case IPPROTO_ESP: return "esp"; case IPPROTO_MPLS: return "mpls"; case 0: return "any"; default: return "unknown"; } }
long long tnl_strproto(unsigned long a0) { unsigned long long v1; if (a0 == 137) { v1 = "mpls"; } else { if (a0 <= 137) { if (a0 == 50) { v1 = "esp"; goto LABEL_400182; } if (a0 <= 50) { if (a0 == 47) { v1 = "gre"; goto LABEL_400182; } if (a0 <= 47) { if (a0 == 41) { v1 = "ipv6"; goto LABEL_400182; } if (a0 <= 41) { if (!a0) { v1 = "any"; goto LABEL_400182; } else if (a0 == 4) { v1 = "ip"; goto LABEL_400182; } } } } } v1 = "unknown"; } LABEL_400182: return v1; }
iproute2-6.0.0
angr_phoenix
vi_comment_out(EditLine *el, wint_t c __attribute__((__unused__))) { el->el_line.cursor = el->el_line.buffer; c_insert(el, 1); *el->el_line.cursor = '#'; re_refresh(el); return ed_newline(el, 0); }
long long vi_comment_out(struct_0 *a0, unsigned long a1) { unsigned int v0; unsigned long long v2; v0 = a1; v2 = a0->field_50; a0->field_58 = a0->field_50; c_insert(a0, 0x1, v2); a0->field_58->field_0 = 35; re_refresh(a0); return ed_newline(a0, 0x0); }
libedit
angr_phoenix
int jobscmd(int argc, char **argv) { int mode, m; struct output *out; mode = 0; while ((m = nextopt("lp"))) if (m == 'l') mode = 0x04; else mode = 0x01; out = out1; argv = argptr; if (*argv) do showjob(out, getjob(*argv, 0), mode); while (*++argv); else showjobs(out, mode); return 0; }
long long jobscmd(unsigned long a0, unsigned long a1) { unsigned long long *v0; unsigned int v1; unsigned int v2; unsigned int v3; unsigned long v4; v1 = a0; v0 = a1; v2 = 0; while (true) { v3 = nextopt("lp"); switch (v3) { case 0: v4 = out1; v0 = argptr; if (!*(v0)) { showjobs(v4, v2); return 0; } do { showjob(v4, getjob(*(v0), 0x0), v2); v0 += 1; } while (*(v0)); return 0; case 108: v2 = 4; break; default: v2 = 1; break; } } }
dash-0.5.11+git20210903+057cd650a4ed
angr_sailr
static struct delayed_set_stat *find_direct_ancestor(char const *file_name) { struct delayed_set_stat *h = delayed_set_stat_head; while (h) { if (!h->after_links && strncmp(file_name, h->file_name, h->file_name_len) == 0 && ((file_name[h->file_name_len]) == '/') && (last_component(file_name) == file_name + h->file_name_len + 1)) break; h = h->next; } return h; }
undefined8 *find_direct_ancestor(char *param_1) { int iVar1; char *pcVar2; undefined8 *local_10; local_10 = delayed_set_stat_head; while ((local_10 != (undefined8 *)0x0 && ((((*(char *)(local_10 + 0xb) == '\x01' || (iVar1 = strncmp(param_1, (char *)local_10[0x14], local_10[0x13]), iVar1 != 0)) || (param_1[local_10[0x13]] != '/')) || (pcVar2 = (char *)last_component(param_1), pcVar2 != param_1 + local_10[0x13] + 1))))) { local_10 = (undefined8 *)*local_10; } return local_10; }
tar
ghidra
static _Bool parse_iwholename(const struct parser_table *entry, char **argv, int *arg_ptr) { return insert_path_check(entry, argv, arg_ptr, "iwholename", pred_ipath); }
void parse_iwholename(undefined8 param_1, undefined8 param_2, undefined8 param_3) { insert_path_check(param_1, param_2, param_3, "iwholename", uRam0000000000102d59); return; }
findutils
ghidra
long long strtonum(const char *numstr, long long minval, long long maxval, const char **errstrp) { long long ll = 0; char *ep; int error = 0; struct errval { const char *errstr; int err; } ev[4] = { {((void *)0), 0}, {"invalid", 22}, {"too small", 34}, {"too large", 34}, }; ev[0].err = (*__errno_location()); (*__errno_location()) = 0; if (minval > maxval) error = 1; else { ll = strtoll(numstr, &ep, 10); if (numstr == ep || *ep != '\0') error = 1; else if ((ll == (-0x7fffffffffffffffLL - 1LL) && (*__errno_location()) == 34) || ll < minval) error = 2; else if ((ll == 0x7fffffffffffffffLL && (*__errno_location()) == 34) || ll > maxval) error = 3; } if (errstrp != ((void *)0)) *errstrp = ev[error].errstr; (*__errno_location()) = ev[error].err; if (error) ll = 0; return (ll); }
longlong strtonum(char *param_1, long param_2, long param_3, undefined8 *param_4) { int *piVar1; long in_FS_OFFSET; int local_6c; char *local_68; longlong local_60; undefined8 local_58; int local_50[2]; char *local_48; undefined4 local_40; char *local_38; undefined4 local_30; char *local_28; undefined4 local_20; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); local_60 = 0; local_6c = 0; local_58 = 0; local_50[0] = 0; local_48 = "invalid"; local_40 = 0x16; local_38 = "too small"; local_30 = 0x22; local_28 = "too large"; local_20 = 0x22; piVar1 = __errno_location(); local_50[0] = *piVar1; piVar1 = __errno_location(); *piVar1 = 0; if (param_3 < param_2) { local_6c = 1; goto LAB_0010014f; } local_60 = strtoll(param_1, &local_68, 10); if ((param_1 == local_68) || (*local_68 != '\0')) { local_6c = 1; goto LAB_0010014f; } if (local_60 == -0x8000000000000000) { piVar1 = __errno_location(); if (*piVar1 != 0x22) goto LAB_0010010c; } else { LAB_0010010c: if (param_2 <= local_60) { if (local_60 == 0x7fffffffffffffff) { piVar1 = __errno_location(); if (*piVar1 != 0x22) goto LAB_0010013b; } else { LAB_0010013b: if (local_60 <= param_3) goto LAB_0010014f; } local_6c = 3; goto LAB_0010014f; } } local_6c = 2; LAB_0010014f: if (param_4 != (undefined8 *)0x0) { *param_4 = (&local_58)[(long)local_6c * 2]; } piVar1 = __errno_location(); *piVar1 = local_50[(long)local_6c * 4]; if (local_6c != 0) { local_60 = 0; } if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) { __stack_chk_fail(); } return local_60; }
openssh-portable
ghidra
static struct diff_block *process_diff(char const *filea, char const *fileb, struct diff_block **last_block, char **buf_to_free) { char *diff_contents; char *diff_limit; char *scan_diff; enum diff_type dt; lin i; struct diff_block *block_list; struct diff_block **block_list_end = &block_list; struct diff_block *bptr; size_t too_many_lines = ((9223372036854775807L) / ((sizeof *bptr->lines[1]) <= (sizeof *bptr->lengths[1]) ? (sizeof *bptr->lines[1]) : (sizeof *bptr->lengths[1]))); diff_limit = read_diff(filea, fileb, &diff_contents); *buf_to_free = diff_contents; scan_diff = diff_contents; while (scan_diff < diff_limit) { bptr = xmalloc(sizeof *bptr); bptr->lines[0] = bptr->lines[1] = 0; bptr->lengths[0] = bptr->lengths[1] = 0; dt = process_diff_control(&scan_diff, bptr); if (dt == ERROR || *scan_diff != '\n') { fprintf(stderr, gettext("%s: diff failed: "), program_name); do { putc_unlocked(*scan_diff, stderr); } while (*scan_diff++ != '\n'); exit(2); } scan_diff++; switch (dt) { case ADD: bptr->ranges[0][0]++; break; case DELETE: bptr->ranges[1][0]++; break; case CHANGE: break; default: fatal("internal error: invalid diff type in process_diff"); break; } if (dt != ADD) { lin numlines = (((bptr)->ranges[0][1]) - ((bptr)->ranges[0][0]) + 1); if (too_many_lines <= numlines) xalloc_die(); bptr->lines[0] = xmalloc(numlines * sizeof *bptr->lines[0]); bptr->lengths[0] = xmalloc(numlines * sizeof *bptr->lengths[0]); for (i = 0; i < numlines; i++) scan_diff = scan_diff_line(scan_diff, &(bptr->lines[0][i]), &(bptr->lengths[0][i]), diff_limit, '<'); } if (dt == CHANGE) { if (strncmp(scan_diff, "---\n", 4)) fatal("invalid diff format; invalid change separator"); scan_diff += 4; } if (dt != DELETE) { lin numlines = (((bptr)->ranges[1][1]) - ((bptr)->ranges[1][0]) + 1); if (too_many_lines <= numlines) xalloc_die(); bptr->lines[1] = xmalloc(numlines * sizeof *bptr->lines[1]); bptr->lengths[1] = xmalloc(numlines * sizeof *bptr->lengths[1]); for (i = 0; i < numlines; i++) scan_diff = scan_diff_line(scan_diff, &(bptr->lines[1][i]), &(bptr->lengths[1][i]), diff_limit, '>'); } *block_list_end = bptr; block_list_end = &bptr->next; } *block_list_end = ((void *)0); *last_block = bptr; return block_list; }
int process_diff(unsigned long long a0, unsigned long long a1, unsigned long long *a2, unsigned long long *a3) { unsigned int v0; int tmp_9; char v1; char *v2; char v3; void *v4; unsigned long long *v5; unsigned long long v6[8]; unsigned long long v7; unsigned long long v8; unsigned long long v9; unsigned long long v10; unsigned long long v12; v5 = &v3; v7 = 1152921504606846975; v8 = read_diff(a0, a1, &v1); *(a3) = *(&v1); v2 = *(&v1); while (true) { if (v8 > v2) { v6[0] = xmalloc(0x48); v6[5] = 0; v6[4] = v6[5]; v6[7] = 0; v6[6] = v6[7]; v0 = process_diff_control(&v2, v6); if (v0 && *(v2) == 10) { v2 += 1; if (v0 != 3) { if (v0 <= 3 && v0 == 1) v6[0] = v6[0] + 1; if ((v0 != 2 || v0 > 3) && (v0 != 1 || v0 > 3)) fatal("internal error: invalid diff type in process_diff"); } else { v6[2] = v6[2] + 1; } if (v0 == 3 || v0 == 2 && v0 <= 3 || v0 == 1 && v0 <= 3) { if (v0 != 1) { v9 = v6[1] - v6[0] + 1; if (v7 <= v9) xalloc_die(); v6[4] = xmalloc(v9 * 8); v6[6] = xmalloc(v9 * 8); for (v4 = 0; v4 < v9; v4 += 1) { v2 = scan_diff_line(v2, v6[4] + v4 * 8, v6[6] + v4 * 8, v8, 0x3c); } } if (v0 == 1 || v7 > v9) { if (v0 == 2) { v12 = strncmp(v2, "---\n", 0x4); if (v12) fatal("invalid diff format; invalid change separator"); v2 += 4; } if (!v12 || v0 != 2) { if (v0 != 3) { v10 = v6[3] - v6[2] + 1; if (v7 <= v10) xalloc_die(); v6[5] = xmalloc(v10 * 8); v6[7] = xmalloc(v10 * 8); for (v4 = 0; v4 < v10; v4 += 1) { v2 = scan_diff_line(v2, v6[5] + v4 * 8, v6[7] + v4 * 8, v8, 0x3e); } } if (v0 == 3 || v7 > v10) { *(v5) = v6; v5 = &v6[1]; continue; } } } } } if (!v0 || *(v2) != 10) { fprintf(stderr, gettext("%s: diff failed: ")); break; } } else { *(v5) = 0; *(a2) = v6; return *(&v3); } } while (true) { putc_unlocked(*(v2), stderr); tmp_9 = v2; v2 += 1; *(&v12) = *(tmp_9); if (v12 == 10) break; } exit(0x2); }
diffutils
angr_dream
static void set_ignore_depends(const struct cmdinfo *cip, const char *value) { char *copy, *p; copy = m_malloc(strlen(value) + 2); strcpy(copy, value); copy[strlen(value) + 1] = '\0'; for (p = copy; *p; p++) { if (*p != ',') continue; *p++ = '\0'; if (!*p || *p == ',' || p == copy + 1) badusage( gettext("null package name in --%s comma-separated list '%.250s'"), cip->olong, value); } p = copy; while (*p) { struct pkginfo *pkg; pkg = dpkg_options_parse_pkgname(cip, p); pkg_list_prepend(&ignoredependss, pkg); p += strlen(p) + 1; } free(copy); }
void set_ignore_depends(undefined8 *param_1, char *param_2) { char *pcVar1; size_t sVar2; char *__dest; undefined8 uVar3; undefined8 uVar4; char *local_30; sVar2 = strlen(param_2); __dest = (char *)m_malloc(sVar2 + 2); strcpy(__dest, param_2); sVar2 = strlen(param_2); __dest[sVar2 + 1] = '\0'; for (local_30 = __dest; pcVar1 = __dest, *local_30 != '\0'; local_30 = local_30 + 1) { if (*local_30 == ',') { pcVar1 = local_30 + 1; *local_30 = '\0'; local_30 = pcVar1; if (((*pcVar1 == '\0') || (*pcVar1 == ',')) || (pcVar1 == __dest + 1)) { uVar4 = *param_1; uVar3 = gettext( "null package name in --%s comma-separated list \'%.250s\'"); badusage(uVar3, uVar4, param_2); } } } while (local_30 = pcVar1, *local_30 != '\0') { uVar4 = dpkg_options_parse_pkgname(param_1, local_30); pkg_list_prepend(&ignoredependss, uVar4); sVar2 = strlen(local_30); pcVar1 = local_30 + sVar2 + 1; } free(__dest); return; }
dpkg
ghidra
static void do_convert_to_pem(struct sshkey *k) { switch (sshkey_type_plain(k->type)) { case KEY_RSA: if (!PEM_write_RSAPublicKey(stdout, k->rsa)) sshfatal("ssh-keygen.c", __func__, 405, 0, SYSLOG_LEVEL_FATAL, ((void *)0), "PEM_write_RSAPublicKey failed"); break; case KEY_DSA: if (!PEM_write_DSA_PUBKEY(stdout, k->dsa)) sshfatal("ssh-keygen.c", __func__, 409, 0, SYSLOG_LEVEL_FATAL, ((void *)0), "PEM_write_DSA_PUBKEY failed"); break; case KEY_ECDSA: if (!PEM_write_EC_PUBKEY(stdout, k->ecdsa)) sshfatal("ssh-keygen.c", __func__, 414, 0, SYSLOG_LEVEL_FATAL, ((void *)0), "PEM_write_EC_PUBKEY failed"); break; default: sshfatal("ssh-keygen.c", __func__, 418, 1, SYSLOG_LEVEL_FATAL, ((void *)0), "unsupported key type %s", sshkey_type(k)); } exit(0); }
void do_convert_to_pem(undefined4 *param_1) { DSA *x; EC_KEY *x_00; int iVar1; undefined8 uVar2; code **ppcVar3; undefined *puVar4; undefined *puVar5; undefined *puVar6; code *pcStack96; char *apcStack88[8]; undefined auStack24[8]; undefined4 *local_10; ppcVar3 = (code **)auStack24; puVar4 = auStack24; puVar6 = auStack24; apcStack88[7] = (char *)0x100aaf; local_10 = param_1; iVar1 = sshkey_type_plain(*param_1); if (iVar1 == 2) { LAB_00100b87: x_00 = *(EC_KEY **)(local_10 + 8); *(undefined8 *)(puVar4 + -8) = 0x100ba1; iVar1 = PEM_write_EC_PUBKEY(stdout, x_00); puVar6 = puVar4; if (iVar1 != 0) goto LAB_00100c2d; *(char **)(puVar4 + -0x10) = "PEM_write_EC_PUBKEY failed"; *(undefined8 *)(puVar4 + -0x18) = 0x100be3; sshfatal("ssh-keygen.c", "do_convert_to_pem", 0x19e, 0, 1, 0); puVar5 = puVar4 + -0x10; } else { puVar5 = auStack24; if (iVar1 < 3) { if (iVar1 == 0) { apcStack88[7] = (char *)0x100ae9; iVar1 = PEM_write_RSAPublicKey(stdout, *(RSA **)(local_10 + 2)); if (iVar1 != 0) goto LAB_00100c2d; ppcVar3 = &pcStack96 + 7; apcStack88[6] = "PEM_write_RSAPublicKey failed"; sshfatal("ssh-keygen.c", "do_convert_to_pem", 0x195, 0, 1, 0); } else { puVar5 = auStack24; if (iVar1 != 1) goto LAB_00100be3; } x = *(DSA **)(local_10 + 4); *(undefined8 *)((long)ppcVar3 + -8) = 0x100b45; iVar1 = PEM_write_DSA_PUBKEY(stdout, x); puVar6 = (undefined *)ppcVar3; if (iVar1 != 0) goto LAB_00100c2d; puVar4 = (undefined *)((long)ppcVar3 + -0x10); *(char **)((long)ppcVar3 + -0x10) = "PEM_write_DSA_PUBKEY failed"; *(undefined8 *)((long)ppcVar3 + -0x18) = 0x100b87; sshfatal("ssh-keygen.c", "do_convert_to_pem", 0x199, 0, 1, 0); goto LAB_00100b87; } } LAB_00100be3: *(undefined8 *)(puVar5 + -8) = 0x100bef; uVar2 = sshkey_type(local_10); *(undefined8 *)(puVar5 + -8) = uVar2; puVar6 = puVar5 + -0x10; *(char **)(puVar5 + -0x10) = "unsupported key type %s"; *(undefined8 *)(puVar5 + -0x18) = 0x100c26; sshfatal("ssh-keygen.c", "do_convert_to_pem", 0x1a2, 1, 1, 0); LAB_00100c2d: *(code **)(puVar6 + -8) = do_convert_to; exit(0); }
openssh-portable
ghidra
char *normalize_filename(int cdidx, const char *name) { char *copy = ((void *)0); if ((!(((name)[0]) == '/'))) { const char *cdpath = tar_getcdpath(cdidx); size_t copylen; _Bool need_separator; copylen = strlen(cdpath); need_separator = !(0 && copylen == 2 && ((cdpath[1]) == '/')); copy = xmalloc(copylen + need_separator + strlen(name) + 1); strcpy(copy, cdpath); copy[copylen] = '/'; strcpy(copy + copylen + need_separator, name); } if (!copy) copy = xstrdup(name); normalize_filename_x(copy); return copy; }
long long normalize_filename(unsigned long a0, char *a1) { char v0; void *v1; char *v2; void *v3; v1 = 0; if (*(a1) != 47) { v2 = tar_getcdpath(a0); v3 = strlen(v2); v0 = 1; v1 = xmalloc(strlen(a1) + v0 + v3 + 1); strcpy(v1, v2); *((v3 + v1)) = 47; strcpy(v0 + v3 + v1, a1); } if (!v1) v1 = xstrdup(a1); normalize_filename_x(v1); return v1; }
tar
angr_sailr
int process_options(int argc, char **argv) { struct p11tool_options *opts = &p11tool_options; int opt; while ((opt = getopt_long(argc, argv, "!8d:hv:", long_options, ((void *)0))) != (-1)) switch (opt) { case '\0': break; case 0x7f + 1: opts->present.list_tokens = 1; opts->enabled.list_tokens = 1; break; case 0x7f + 2: opts->present.list_token_urls = 1; opts->enabled.list_token_urls = 1; break; case 0x7f + 3: opts->present.list_mechanisms = 1; opts->enabled.list_mechanisms = 1; break; case 0x7f + 4: opts->present.initialize = 1; opts->enabled.initialize = 1; break; case 0x7f + 5: opts->present.initialize_pin = 1; opts->enabled.initialize_pin = 1; break; case 0x7f + 6: opts->present.initialize_so_pin = 1; opts->enabled.initialize_so_pin = 1; break; case 0x7f + 7: opts->present.set_pin = 1; opts->arg.set_pin = optarg; opts->enabled.set_pin = 1; break; case 0x7f + 8: opts->present.set_so_pin = 1; opts->arg.set_so_pin = optarg; opts->enabled.set_so_pin = 1; break; case 0x7f + 9: opts->present.list_all = 1; opts->enabled.list_all = 1; break; case 0x7f + 10: opts->present.list_all_certs = 1; opts->enabled.list_all_certs = 1; break; case 0x7f + 11: opts->present.list_certs = 1; opts->enabled.list_certs = 1; break; case 0x7f + 12: case 0x7f + 13: case 0x7f + 14: opts->present.list_all_privkeys = 1; opts->enabled.list_all_privkeys = 1; break; case 0x7f + 15: opts->present.list_all_trusted = 1; opts->enabled.list_all_trusted = 1; break; case 0x7f + 16: opts->present.export = 1; opts->enabled.export = 1; break; case 0x7f + 17: opts->present.export_stapled = 1; opts->enabled.export_stapled = 1; break; case 0x7f + 18: opts->present.export_chain = 1; opts->enabled.export_chain = 1; break; case 0x7f + 19: opts->present.export_pubkey = 1; opts->enabled.export_pubkey = 1; break; case 0x7f + 20: opts->present.info = 1; opts->enabled.info = 1; break; case 0x7f + 23: opts->present.generate_privkey = 1; opts->arg.generate_privkey = optarg; opts->enabled.generate_privkey = 1; break; case 0x7f + 24: opts->present.generate_rsa = 1; opts->enabled.generate_rsa = 1; break; case 0x7f + 25: opts->present.generate_dsa = 1; opts->enabled.generate_dsa = 1; break; case 0x7f + 26: opts->present.generate_ecc = 1; opts->enabled.generate_ecc = 1; break; case 0x7f + 27: opts->present.bits = 1; opts->arg.bits = optarg; opts->value.bits = parse_number(optarg); opts->enabled.bits = 1; break; case 0x7f + 28: opts->present.curve = 1; opts->arg.curve = optarg; opts->enabled.curve = 1; break; case 0x7f + 29: opts->present.sec_param = 1; opts->arg.sec_param = optarg; opts->enabled.sec_param = 1; break; case 0x7f + 30: opts->present.set_id = 1; opts->arg.set_id = optarg; opts->enabled.set_id = 1; break; case 0x7f + 31: opts->present.set_label = 1; opts->arg.set_label = optarg; opts->enabled.set_label = 1; break; case 0x7f + 32: opts->present.write = 1; opts->enabled.write = 1; break; case 0x7f + 33: opts->present.delete = 1; opts->enabled.delete = 1; break; case 0x7f + 34: opts->present.label = 1; opts->arg.label = optarg; opts->enabled.label = 1; break; case 0x7f + 35: opts->present.id = 1; opts->arg.id = optarg; opts->enabled.id = 1; break; case 0x7f + 36: opts->present.mark_wrap = 1; opts->enabled.mark_wrap = 1; break; case 0x7f + 37: opts->present.mark_wrap = 1; opts->enabled.mark_wrap = 0; break; case 0x7f + 38: case 0x7f + 21: opts->present.mark_trusted = 1; opts->enabled.mark_trusted = 1; break; case 0x7f + 39: opts->present.mark_trusted = 1; opts->enabled.mark_trusted = 0; break; case 0x7f + 40: case 0x7f + 22: opts->present.mark_distrusted = 1; opts->enabled.mark_distrusted = 1; break; case 0x7f + 41: opts->present.mark_decrypt = 1; opts->enabled.mark_decrypt = 1; break; case 0x7f + 42: opts->present.mark_decrypt = 1; opts->enabled.mark_decrypt = 0; break; case 0x7f + 43: opts->present.mark_sign = 1; opts->enabled.mark_sign = 1; break; case 0x7f + 44: opts->present.mark_sign = 1; opts->enabled.mark_sign = 0; break; case 0x7f + 45: case 0x7f + 49: opts->present.mark_ca = 1; opts->enabled.mark_ca = 1; break; case 0x7f + 46: opts->present.mark_ca = 1; opts->enabled.mark_ca = 0; break; case 0x7f + 47: case 0x7f + 50: opts->present.mark_private = 1; opts->enabled.mark_private = 1; break; case 0x7f + 48: opts->present.mark_private = 1; opts->enabled.mark_private = 0; break; case 0x7f + 51: opts->present.mark_always_authenticate = 1; opts->enabled.mark_always_authenticate = 1; break; case 0x7f + 52: opts->present.mark_always_authenticate = 1; opts->enabled.mark_always_authenticate = 0; break; case 0x7f + 53: opts->present.secret_key = 1; opts->arg.secret_key = optarg; opts->enabled.secret_key = 1; break; case 0x7f + 54: opts->present.load_privkey = 1; opts->arg.load_privkey = optarg; opts->enabled.load_privkey = 1; break; case 0x7f + 55: opts->present.load_pubkey = 1; opts->arg.load_pubkey = optarg; opts->enabled.load_pubkey = 1; break; case 0x7f + 56: opts->present.load_certificate = 1; opts->arg.load_certificate = optarg; opts->enabled.load_certificate = 1; break; case 'd': opts->present.debug = 1; opts->arg.debug = optarg; opts->value.debug = parse_number(optarg); opts->enabled.debug = 1; break; case 0x7f + 57: opts->present.outfile = 1; opts->arg.outfile = optarg; opts->enabled.outfile = 1; break; case 0x7f + 58: opts->present.login = 1; opts->enabled.login = 1; break; case 0x7f + 59: opts->present.login = 1; opts->enabled.login = 0; break; case 0x7f + 60: case 0x7f + 62: opts->present.so_login = 1; opts->enabled.so_login = 1; break; case 0x7f + 61: opts->present.so_login = 1; opts->enabled.so_login = 0; break; case 0x7f + 63: opts->present.test_sign = 1; opts->enabled.test_sign = 1; break; case 0x7f + 64: opts->present.sign_params = 1; opts->arg.sign_params = optarg; opts->enabled.sign_params = 1; break; case 0x7f + 65: opts->present.hash = 1; opts->arg.hash = optarg; opts->enabled.hash = 1; break; case 0x7f + 66: opts->present.generate_random = 1; opts->arg.generate_random = optarg; opts->value.generate_random = parse_number(optarg); opts->enabled.generate_random = 1; break; case '8': opts->present.pkcs8 = 1; opts->enabled.pkcs8 = 1; break; case 0x7f + 67: case 0x7f + 69: opts->present.inder = 1; opts->enabled.inder = 1; break; case 0x7f + 68: opts->present.inder = 1; opts->enabled.inder = 0; break; case 0x7f + 70: case 0x7f + 72: opts->present.outder = 1; opts->enabled.outder = 1; break; case 0x7f + 71: opts->present.outder = 1; opts->enabled.outder = 0; break; case 0x7f + 73: opts->present.provider = 1; opts->arg.provider = optarg; opts->enabled.provider = 1; break; case 0x7f + 74: opts->present.provider_opts = 1; opts->arg.provider_opts = optarg; opts->enabled.provider_opts = 1; break; case 0x7f + 75: opts->present.detailed_url = 1; opts->enabled.detailed_url = 1; break; case 0x7f + 76: opts->present.detailed_url = 1; opts->enabled.detailed_url = 0; break; case 0x7f + 77: opts->present.only_urls = 1; opts->enabled.only_urls = 1; break; case 0x7f + 78: opts->present.batch = 1; opts->enabled.batch = 1; break; case 'v': opts->present.version = 1; opts->arg.version = optarg; opts->enabled.version = 1; break; case 'h': opts->present.help = 1; opts->enabled.help = 1; break; case '!': opts->present.more_help = 1; opts->enabled.more_help = 1; break; default: usage(stderr, 1); break; } if (p11tool_options.present.export && p11tool_options.present.export_stapled) { error(1, 0, "the '%s' and '%s' options conflict", "export", "export_stapled"); } if (p11tool_options.present.export && p11tool_options.present.export_chain) { error(1, 0, "the '%s' and '%s' options conflict", "export", "export_chain"); } if (p11tool_options.present.export && p11tool_options.present.export_pubkey) { error(1, 0, "the '%s' and '%s' options conflict", "export", "export_pubkey"); } if (p11tool_options.present.export_stapled && p11tool_options.present.export) { error(1, 0, "the '%s' and '%s' options conflict", "export-stapled", "export"); } if (p11tool_options.present.export_stapled && p11tool_options.present.export_chain) { error(1, 0, "the '%s' and '%s' options conflict", "export-stapled", "export_chain"); } if (p11tool_options.present.export_stapled && p11tool_options.present.export_pubkey) { error(1, 0, "the '%s' and '%s' options conflict", "export-stapled", "export_pubkey"); } if (p11tool_options.present.export_chain && p11tool_options.present.export_stapled) { error(1, 0, "the '%s' and '%s' options conflict", "export-chain", "export_stapled"); } if (p11tool_options.present.export_chain && p11tool_options.present.export) { error(1, 0, "the '%s' and '%s' options conflict", "export-chain", "export"); } if (p11tool_options.present.export_chain && p11tool_options.present.export_pubkey) { error(1, 0, "the '%s' and '%s' options conflict", "export-chain", "export_pubkey"); } if (p11tool_options.present.export_pubkey && p11tool_options.present.export_stapled) { error(1, 0, "the '%s' and '%s' options conflict", "export-pubkey", "export_stapled"); } if (p11tool_options.present.export_pubkey && p11tool_options.present.export) { error(1, 0, "the '%s' and '%s' options conflict", "export-pubkey", "export"); } if (p11tool_options.present.export_pubkey && p11tool_options.present.export_chain) { error(1, 0, "the '%s' and '%s' options conflict", "export-pubkey", "export_chain"); } if (p11tool_options.present.set_id && p11tool_options.present.write) { error(1, 0, "the '%s' and '%s' options conflict", "set-id", "write"); } if (p11tool_options.present.set_label && p11tool_options.present.write) { error(1, 0, "the '%s' and '%s' options conflict", "set-label", "write"); } if (p11tool_options.present.set_label && p11tool_options.present.set_id) { error(1, 0, "the '%s' and '%s' options conflict", "set-label", "set_id"); } if (p11tool_options.present.mark_trusted && p11tool_options.present.mark_distrusted) { error(1, 0, "the '%s' and '%s' options conflict", "mark-trusted", "mark_distrusted"); } if (p11tool_options.present.mark_distrusted && p11tool_options.present.mark_trusted) { error(1, 0, "the '%s' and '%s' options conflict", "mark-distrusted", "mark_trusted"); } if (p11tool_options.present.debug && p11tool_options.value.debug < 0) { error(1, 0, "%s option value %d is out of range.", "debug", opts->value.debug); } if (p11tool_options.present.debug && p11tool_options.value.debug > 9999) { error(1, 0, "%s option value %d is out of range", "debug", opts->value.debug); } if (p11tool_options.present.help) { usage(stdout, (0)); } if (p11tool_options.present.more_help) { pid_t pid; int pfds[2]; if (pipe(pfds) < 0) error(1, (*__errno_location()), "pipe"); pid = fork(); if (pid < 0) error(1, (*__errno_location()), "fork"); if (pid == 0) { close(pfds[0]); dup2(pfds[1], 1); close(pfds[1]); usage(stdout, 0); } else { const char *args[2]; const char *envvar; close(pfds[1]); dup2(pfds[0], 0); close(pfds[0]); envvar = secure_getenv("PAGER"); if (!envvar || *envvar == '\0') args[0] = "more"; else args[0] = envvar; args[1] = ((void *)0); execvp(args[0], (char *const *)args); exit(1); } } if (p11tool_options.present.version) { if (!p11tool_options.arg.version || !strcmp(p11tool_options.arg.version, "c")) { const char str[] = "p11tool 3.7.8\n" "Copyright (C) 2000-2021 Free Software Foundation, and others\n" "This is free software. It is licensed for use, modification and\n" "redistribution under the terms of the GNU General Public License,\n" "version 3 or later <http: "\n" "Please send bug reports to: <bugs@gnutls.org> \n"; fprintf(stdout, "%s", str); exit(0); } else if (!strcmp(p11tool_options.arg.version, "v")) { const char str[] = "p11tool 3.7.8\n"; fprintf(stdout, "%s", str); exit(0); } else if (!strcmp(p11tool_options.arg.version, "n")) { const char str[] = "p11tool 3.7.8\n" "Copyright (C) 2000-2021 Free Software Foundation, and others\n" "This is free software. It is licensed for use, modification and\n" "redistribution under the terms of the GNU General Public License,\n" "version 3 or later <http: "\n" "gnutls is free software: you can redistribute it and/or\n" "modify it under the terms of the GNU General Public License\n" "as published by the Free Software Foundation,\n" "either version 3 of the License, or (at your option) any later " "version.\n" "\n" "gnutls is distributed in the hope that it will be useful,\n" "but WITHOUT ANY WARRANTY; without even the implied warranty\n" "of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n" "See the GNU General Public License for more details.\n" "\n" "You should have received a copy of the GNU General Public License\n" "along with this program. If not, see <http: "\n" "Please send bug reports to: <bugs@gnutls.org> \n"; fprintf(stdout, "%s", str); exit(0); } else { error(1, 0, "version option argument 'a' invalid. Use:\n" " 'v' - version only\n" " 'c' - version and copyright\n" " 'n' - version and full copyright notice"); } } return optind; }
long long process_options(unsigned long a0, char **a1) { char **v0; unsigned int v1; unsigned int v2; unsigned int v3; struct_0 *v4; char *v5; char v6; char v7; unsigned long long v8; void *v9; unsigned long v10; unsigned int v11; unsigned short v12; char v13; unsigned long long v15; unsigned long v16; unsigned long long v17; unsigned long long *v18; unsigned long long v19; unsigned long long *v20; unsigned long long v21; unsigned long v22; v1 = a0; v0 = a1; v4 = got.p11tool_options; while (true) { v2 = getopt_long(v1, v0, "!8d:hv:", &long_options, NULL); if (v2 == -1) break; switch (v2) { case 0: break; case 33: v4->field_3d = 1; v4->field_139 = 1; break; case 56: v4->field_33 = 1; v4->field_12f = 1; break; case 100: v4->field_2b = 1; v4->field_b0 = *(*(&got.optarg)); v4->field_f4 = parse_number(*(*(&got.optarg))); v4->field_127 = 1; break; case 104: v4->field_3c = 1; v4->field_138 = 1; break; case 118: v4->field_3b = 1; v4->field_e8 = *(*(&got.optarg)); v4->field_137 = 1; break; case 128: v4->field_0 = 1; v4->field_fc = 1; break; case 129: v4->field_1 = 1; v4->field_fd = 1; break; case 130: v4->field_2 = 1; v4->field_fe = 1; break; case 131: v4->field_3 = 1; v4->field_ff = 1; break; case 132: v4->field_4 = 1; v4->field_100 = 1; break; case 133: v4->field_5 = 1; v4->field_101 = 1; break; case 134: v4->field_6 = 1; v4->field_40 = *(*(&got.optarg)); v4->field_102 = 1; break; case 135: v4->field_7 = 1; v4->field_48 = *(*(&got.optarg)); v4->field_103 = 1; break; case 136: v4->field_8 = 1; v4->field_104 = 1; break; case 137: v4->field_9 = 1; v4->field_105 = 1; break; case 138: v4->field_a = 1; v4->field_106 = 1; break; case 139: case 140: case 141: v4->field_b = 1; v4->field_107 = 1; break; case 142: v4->field_c = 1; v4->field_108 = 1; break; case 143: v4->field_d = 1; v4->field_109 = 1; break; case 144: v4->field_e = 1; v4->field_10a = 1; break; case 145: v4->field_f = 1; v4->field_10b = 1; break; case 146: v4->field_10 = 1; v4->field_10c = 1; break; case 147: v4->field_11 = 1; v4->field_10d = 1; break; case 148: case 165: v4->field_20 = 1; v4->field_11c = 1; break; case 149: case 167: v4->field_21 = 1; v4->field_11d = 1; break; case 150: v4->field_12 = 1; v4->field_50 = *(*(&got.optarg)); v4->field_10e = 1; break; case 151: v4->field_13 = 1; v4->field_10f = 1; break; case 152: v4->field_14 = 1; v4->field_110 = 1; break; case 153: v4->field_15 = 1; v4->field_111 = 1; break; case 154: v4->field_16 = 1; v4->field_58 = *(*(&got.optarg)); v4->field_f0 = parse_number(*(*(&got.optarg))); v4->field_112 = 1; break; case 155: v4->field_17 = 1; v4->field_60 = *(*(&got.optarg)); v4->field_113 = 1; break; case 156: v4->field_18 = 1; v4->field_68 = *(*(&got.optarg)); v4->field_114 = 1; break; case 157: v4->field_19 = 1; v4->field_70 = *(*(&got.optarg)); v4->field_115 = 1; break; case 158: v4->field_1a = 1; v4->field_78 = *(*(&got.optarg)); v4->field_116 = 1; break; case 159: v4->field_1b = 1; v4->field_117 = 1; break; case 160: v4->field_1c = 1; v4->field_118 = 1; break; case 161: v4->field_1d = 1; v4->field_80 = *(*(&got.optarg)); v4->field_119 = 1; break; case 162: v4->field_1e = 1; v4->field_88 = *(*(&got.optarg)); v4->field_11a = 1; break; case 163: v4->field_1f = 1; v4->field_11b = 1; break; case 164: v4->field_1f = 1; v4->field_11b = 0; break; case 166: v4->field_20 = 1; v4->field_11c = 0; break; case 168: v4->field_22 = 1; v4->field_11e = 1; break; case 169: v4->field_22 = 1; v4->field_11e = 0; break; case 170: v4->field_23 = 1; v4->field_11f = 1; break; case 171: v4->field_23 = 1; v4->field_11f = 0; break; case 172: case 176: v4->field_24 = 1; v4->field_120 = 1; break; case 173: v4->field_24 = 1; v4->field_120 = 0; break; case 174: case 177: v4->field_25 = 1; v4->field_121 = 1; break; case 175: v4->field_25 = 1; v4->field_121 = 0; break; case 178: v4->field_26 = 1; v4->field_122 = 1; break; case 179: v4->field_26 = 1; v4->field_122 = 0; break; case 180: v4->field_27 = 1; v4->field_90 = *(*(&got.optarg)); v4->field_123 = 1; break; case 181: v4->field_28 = 1; v4->field_98 = *(*(&got.optarg)); v4->field_124 = 1; break; case 182: v4->field_29 = 1; v4->field_a0 = *(*(&got.optarg)); v4->field_125 = 1; break; case 183: v4->field_2a = 1; v4->field_a8 = *(*(&got.optarg)); v4->field_126 = 1; break; case 184: v4->field_2c = 1; v4->field_b8 = *(*(&got.optarg)); v4->field_128 = 1; break; case 185: v4->field_2d = 1; v4->field_129 = 1; break; case 186: v4->field_2d = 1; v4->field_129 = 0; break; case 187: case 189: v4->field_2e = 1; v4->field_12a = 1; break; case 188: v4->field_2e = 1; v4->field_12a = 0; break; case 190: v4->field_2f = 1; v4->field_12b = 1; break; case 191: v4->field_30 = 1; v4->field_c0 = *(*(&got.optarg)); v4->field_12c = 1; break; case 192: v4->field_31 = 1; v4->field_c8 = *(*(&got.optarg)); v4->field_12d = 1; break; case 193: v4->field_32 = 1; v4->field_d0 = *(*(&got.optarg)); v4->field_f8 = parse_number(*(*(&got.optarg))); v4->field_12e = 1; break; case 194: case 196: v4->field_34 = 1; v4->field_130 = 1; break; case 195: v4->field_34 = 1; v4->field_130 = 0; break; case 197: case 199: v4->field_35 = 1; v4->field_131 = 1; break; case 198: v4->field_35 = 1; v4->field_131 = 0; break; case 200: v4->field_36 = 1; v4->field_d8 = *(*(&got.optarg)); v4->field_132 = 1; break; case 201: v4->field_37 = 1; v4->field_e0 = *(*(&got.optarg)); v4->field_133 = 1; break; case 202: v4->field_38 = 1; v4->field_134 = 1; break; case 203: v4->field_38 = 1; v4->field_134 = 0; break; case 204: v4->field_39 = 1; v4->field_135 = 1; break; case 205: v4->field_3a = 1; v4->field_136 = 1; break; default: usage(*(got.stderr), 0x1); } } if (*((got.p11tool_options + 13)) && *((got.p11tool_options + 14))) error(0x1, 0x0, "the '%s' and '%s' options conflict"); if (*((got.p11tool_options + 13)) && *((got.p11tool_options + 15))) error(0x1, 0x0, "the '%s' and '%s' options conflict"); if (*((got.p11tool_options + 13)) && *((got.p11tool_options + 16))) error(0x1, 0x0, "the '%s' and '%s' options conflict"); if (*((got.p11tool_options + 14)) && *((got.p11tool_options + 13))) error(0x1, 0x0, "the '%s' and '%s' options conflict"); if (*((got.p11tool_options + 14)) && *((got.p11tool_options + 15))) error(0x1, 0x0, "the '%s' and '%s' options conflict"); if (*((got.p11tool_options + 14)) && *((got.p11tool_options + 16))) error(0x1, 0x0, "the '%s' and '%s' options conflict"); if (*((got.p11tool_options + 15)) && *((got.p11tool_options + 14))) error(0x1, 0x0, "the '%s' and '%s' options conflict"); if (*((got.p11tool_options + 15)) && *((got.p11tool_options + 13))) error(0x1, 0x0, "the '%s' and '%s' options conflict"); if (*((got.p11tool_options + 15)) && *((got.p11tool_options + 16))) error(0x1, 0x0, "the '%s' and '%s' options conflict"); if (*((got.p11tool_options + 16)) && *((got.p11tool_options + 14))) error(0x1, 0x0, "the '%s' and '%s' options conflict"); if (*((got.p11tool_options + 16)) && *((got.p11tool_options + 13))) error(0x1, 0x0, "the '%s' and '%s' options conflict"); if (*((got.p11tool_options + 16)) && *((got.p11tool_options + 15))) error(0x1, 0x0, "the '%s' and '%s' options conflict"); if (*((got.p11tool_options + 25)) && *((got.p11tool_options + 27))) error(0x1, 0x0, "the '%s' and '%s' options conflict"); if (*((got.p11tool_options + 26)) && *((got.p11tool_options + 27))) error(0x1, 0x0, "the '%s' and '%s' options conflict"); if (*((got.p11tool_options + 26)) && *((got.p11tool_options + 25))) error(0x1, 0x0, "the '%s' and '%s' options conflict"); if (*((got.p11tool_options + 32)) && *((got.p11tool_options + 33))) error(0x1, 0x0, "the '%s' and '%s' options conflict"); if (*((got.p11tool_options + 33)) && *((got.p11tool_options + 32))) error(0x1, 0x0, "the '%s' and '%s' options conflict"); if (*((got.p11tool_options + 43)) && *((got.p11tool_options + 244)) < 0) error(0x1, 0x0, "%s option value %d is out of range."); if (*((got.p11tool_options + 43)) && *((got.p11tool_options + 244)) > 9999) error(0x1, 0x0, "%s option value %d is out of range"); if (*((got.p11tool_options + 60))) usage(*(*(&got.stdout)), 0x0); if (*((got.p11tool_options + 61))) { if (pipe(&v6) >= 0) { v3 = fork(); if (v3 < 0) { error(0x1, *(__errno_location()), "fork"); } else if (v3) { close(*(&v7)); dup2(*(&v6), 0x0); close(*(&v6)); v5 = secure_getenv("PAGER"); if (!v5 || !*(v5)) v8 = "more"; else v8 = v5; v9 = 0; execvp(v8, &v8); exit(0x1); } else { close(*(&v6)); dup2(*(&v7), 0x1); close(*(&v7)); usage(*(*(&got.stdout)), 0x0); } } else { error(0x1, *(__errno_location()), "pipe"); } } else { if (!*((got.p11tool_options + 59))) return *(got.optind); if (*((got.p11tool_options + 232)) && strcmp(*((got.p11tool_options + 232)), "c")) { if (!strcmp(*((got.p11tool_options + 232)), "v")) { v10 = 2336364831179878768; v11 = 775368243; v12 = 2616; v13 = 0; fprintf(*(*(&got.stdout)), "%s", &v10); exit(0x0); } else if (strcmp(*((got.p11tool_options + 232)), "n")) { error(0x1, 0x0, "version option argument 'a' invalid. Use:\n\t'v' - version " "only\n\t'c' - version and copyright\n\t'n' - version and full " "copyright notice"); } else { v19 = 115; v20 = &v10; for (v21 = "p11tool 3.7.8\nCopyright (C) 2000-2021 Free Software Foundation, and others\nThis is free software. It is licensed for use, modification and\nredistribution under the terms of the GNU General Public License,\nversion 3 or later <http: v19 -= 1; v10 = *(v21); v20 = &v20[v22]; } fprintf(*(*(&got.stdout)), "%s", &v10); exit(0x0); } } v15 = 40; v18 = &v10; for (v17 = "p11tool 3.7.8\nCopyright (C) 2000-2021 Free Software Foundation, and others\nThis is free software. It is licensed for use, modification and\nredistribution under the terms of the GNU General Public License,\nversion 3 or later <http: v15 -= 1; v10 = *(v17); v18 = &v18[v16]; } fprintf(*(*(&got.stdout)), "%s", &v10); exit(0x0); } }
gnutls
angr_sailr
errcode_t e2fsck_read_extents(e2fsck_t ctx, struct extent_list *extents) { struct ext2_inode_large inode; errcode_t retval; extents->extents = ((void *)0); extents->count = 0; extents->blocks_freed = 0; extents->ext_read = 0; extents->size = 341; retval = ext2fs_get_array(341, sizeof(struct ext2fs_extent), &extents->extents); if (retval) return 12; retval = ext2fs_read_inode(ctx->fs, extents->ino, EXT2_INODE(&inode)); if (retval) goto err_out; retval = load_extents(ctx, extents); if (!retval) return 0; err_out: ext2fs_free_mem(&extents->extents); extents->size = 0; extents->count = 0; return retval; }
long long e2fsck_read_extents(unsigned long long *a0, struct_0 *a1) { unsigned long long v0; char v1; unsigned long long v3; a1->field_8 = 0; a1->field_10 = 0; a1->field_0 = 0; a1->field_18 = 0; a1->field_14 = 341; v0 = ext2fs_get_array(0x155, 0x18, &a1->field_8); if (v0) { v3 = 12; } else { v0 = ext2fs_read_inode(*(a0), a1->field_28, EXT2_INODE(&v1), a1->field_28); if (!v0) { v0 = load_extents(a0, a1); if (!v0) v3 = 0; } if (v0 || v0) { ext2fs_free_mem(&a1->field_8); a1->field_14 = 0; a1->field_10 = 0; v3 = v0; } } return v3; }
e2fsprogs-1.46.5
angr_dream
static _Noreturn void test_syntax_error(char const *format, ...) { va_list ap; __builtin_va_start(ap, format); verror(0, 0, format, ap); exit(TEST_FAILURE); }
void test_syntax_error(unsigned long long a0, unsigned long a1) { unsigned int v0; unsigned int v1; unsigned long v2; unsigned long v3; unsigned long v4; char v5; unsigned long v6; unsigned long v7; unsigned long v8; unsigned long v9; unsigned long v10; int v11; int v12; int v13; int v14; int v15; int v16; int v17; int v18; unsigned long v19; unsigned long v20; unsigned long v21; unsigned long v22; unsigned long v23; char v24; int v25; int v26; int v27; int v28; int v29; int v30; int v31; int v32; unsigned long long *v33; v6 = a1; v7 = v20; v8 = v21; v9 = v22; v10 = v23; if (v24) { v11 = v25; v12 = v26; v13 = v27; v14 = v28; v15 = v29; v16 = v30; v17 = v31; v18 = v32; } v4 = v33[5]; v0 = 8; v1 = 48; v2 = &v19; v3 = &v5; verror(0x0, 0x0, a0, &v0); exit(0x2); }
coreutils
angr_dream
int sshbuf_check_reserve(const struct sshbuf *buf, size_t len) { int r; if ((r = sshbuf_check_sanity(buf)) != 0) return r; if (buf->readonly || buf->refcount > 1) return -49; ; if (len > buf->max_size || buf->max_size - len < buf->size - buf->off) return -9; return 0; }
int sshbuf_check_reserve(struct_0 *a0, unsigned long a1) { unsigned int v0; unsigned int v2; v0 = sshbuf_check_sanity(a0); if (v0) { v2 = v0; return v2; } else if (a0->field_30) { v2 = -49; return v2; } else if (a0->field_38 > 1) { v2 = -49; return v2; } else if (a1 > a0->field_20) { v2 = -9; return v2; } else if (a0->field_20 - a1 < a0->field_18 - a0->field_10) { v2 = -9; return v2; } else { v2 = 0; return v2; } }
openssh-portable
angr_sailr
int falsecmd(int argc, char **argv) { return 1; }
undefined8 falsecmd(void) { return 1; }
dash-0.5.11+git20210903+057cd650a4ed
ghidra
static inline __u32 rta_getattr_u32(const struct rtattr *rta) { return *(__u32 *)(( void *)(((char *)(rta)) + ((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0)))); }
long rta_getattr_u32(long a1) { return *(unsigned int *)(a1 + 4); }
iproute2-6.0.0
ida
static inline void emit_ancillary_info(char const *program) { struct infomap { char const *program; char const *node; } const infomap[] = { {"[", "test invocation"}, {"coreutils", "Multi-call invocation"}, {"sha224sum", "sha2 utilities"}, {"sha256sum", "sha2 utilities"}, {"sha384sum", "sha2 utilities"}, {"sha512sum", "sha2 utilities"}, {((void *)0), ((void *)0)}}; char const *node = program; struct infomap const *map_prog = infomap; while (map_prog->program && !(strcmp(program, map_prog->program) == 0)) map_prog++; if (map_prog->node) node = map_prog->node; printf (gettext ("\n%s online help: <%s>\n"), "GNU coreutils", "https: char const *lc_messages = setlocale ( 5 , ((void *)0) ); if (lc_messages && strncmp (lc_messages, "" "en_" "", sizeof ("en_") - 1)) { fputs_unlocked (gettext ("Report any translation bugs to " "<https: stdout ) ; } char const *url_program = (strcmp (program, "[") == 0) ? "test" : program; printf (gettext ("Full documentation <%s%s>\n"), "https: printf (gettext ("or available locally via: info '(coreutils) %s%s'\n"), node, node == program ? " invocation" : ""); }
void emit_ancillary_info(char *a0) { unsigned long long v0; unsigned long long v1[2]; char *v2; unsigned long long v3; unsigned long long v4; unsigned long long v5; unsigned long long v6; unsigned long long v7; unsigned long long v8; unsigned long long v9; unsigned long long v10; unsigned long long v11; unsigned long long v12; unsigned long long v13; unsigned long long v14; unsigned long long v15; void *v16; void *v17; char v18; unsigned long long v23; unsigned long long *v24; unsigned long long v25; v4 = "["; v5 = "test invocation"; v6 = "coreutils"; v7 = "Multi-call invocation"; v8 = "sha224sum"; v9 = "sha2 utilities"; v10 = "sha256sum"; v11 = "sha2 utilities"; v12 = "sha384sum"; v13 = "sha2 utilities"; v14 = "sha512sum"; v15 = "sha2 utilities"; v16 = 0; v17 = 0; v0 = a0; for (v1[0] = &v4; v1[0]; v1[0] = v1 + 1) { if (!strcmp(a0, v1[0])) break; } if (v1[1]) v0 = v1[1]; printf(gettext("\n%s online help: <%s>\n")); v2 = setlocale(0x5, NULL); if (v2 && strncmp(v2, "en_", 0x3)) fputs_unlocked(gettext("Report any translation bugs to <https: if (strcmp(a0, "[")) v23 = a0; else v23 = "test"; v3 = v23; printf(gettext("Full documentation <%s%s>\n")); printf(gettext("or available locally via: info '(coreutils) %s%s'\n")); v25 = *(&v18) ^ v24[5]; return; }
coreutils
angr_dream
static unsigned long read_checkpoint(char *cpfile) { FILE *fp; unsigned long lineno = 0; if ((fp = fopen(cpfile, "r")) == ((void *)0)) return 0; if (fscanf(fp, "%lu\n", &lineno) < 1) sshlog("moduli.c", __func__, 490, 0, SYSLOG_LEVEL_INFO, ((void *)0), "Failed to load checkpoint from '%s'", cpfile); else sshlog("moduli.c", __func__, 492, 0, SYSLOG_LEVEL_INFO, ((void *)0), "Loaded checkpoint from '%s' line %lu", cpfile, lineno); fclose(fp); return lineno; }
undefined8 read_checkpoint(char *param_1) { int iVar1; long in_FS_OFFSET; undefined8 uVar2; undefined8 local_20; FILE *local_18; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); local_20 = 0; local_18 = fopen(param_1, "r"); if (local_18 == (FILE *)0x0) { uVar2 = 0; } else { uVar2 = 0x1011ab; iVar1 = __isoc99_fscanf(local_18, &DAT_00102870, &local_20); if (iVar1 < 1) { sshlog("moduli.c", "read_checkpoint", 0x1ea, 0, 3, 0, "Failed to load checkpoint from \'%s\'", param_1); } else { sshlog("moduli.c", "read_checkpoint", 0x1ec, 0, 3, 0, "Loaded checkpoint from \'%s\' line %lu", param_1, local_20, uVar2); } fclose(local_18); uVar2 = local_20; } if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) { __stack_chk_fail(); } return uVar2; }
openssh-portable
ghidra
static struct job *growjobtab(void) { size_t len; ptrdiff_t offset; struct job *jp, *jq; len = njobs * sizeof(*jp); jq = jobtab; jp = ckrealloc(jq, len + 4 * sizeof(*jp)); offset = (char *)jp - (char *)jq; if (offset) { size_t l = len; jq = (struct job *)((char *)jq + l); while (l) { l -= sizeof(*jp); jq--; if (__builtin_expect( !!(((struct job *)((char *)(jp) + l))->ps == &jq->ps0), 1)) (((struct job *)((char *)(jp) + l))->ps) = (void *)((char *)(((struct job *)((char *)(jp) + l))->ps) + offset); if (((struct job *)((char *)(jp) + l))->prev_job) (((struct job *)((char *)(jp) + l))->prev_job) = (void *)((char *)(((struct job *)((char *)(jp) + l))->prev_job) + offset); } if (curjob) (curjob) = (void *)((char *)(curjob) + offset); } njobs += 4; jobtab = jp; jp = (struct job *)((char *)jp + len); jq = jp + 3; do { jq->used = 0; } while (--jq >= jp); return jp; }
int growjobtab() { struct_2 *v0; unsigned long v1; unsigned long v2; unsigned long long v3; unsigned long v4; v2 = njobs * 40; v0 = jobtab; v3 = ckrealloc(v0, v2 + 160, v2 + 160); v4 = v3 - v0; if (v4) { v1 = v2; v0 += v1; while (true) { if (!v1) break; v1 -= 40; v0 -= 40; if (*((v1 + v3 + 16)) == v0) *((v1 + v3 + 16)) = v4 + *((v1 + v3 + 16)); if (!*((v1 + v3 + 32))) continue; *((v1 + v3 + 32)) = v4 + *((v1 + v3 + 32)); } if (curjob) curjob = v4 + curjob; } njobs = njobs + 4; jobtab = v3; v3 += v2; v0 = v3 + 120; do { v0->field_1f = v0->field_1f & 4294967287; v0 -= 40; } while (v0 >= v3); return v3; }
dash-0.5.11+git20210903+057cd650a4ed
angr_phoenix
int rl_show_char(int c) { int n = 1; if (((c) > 0x07f && (c) <= 255) && (_rl_output_meta_chars == 0)) { fprintf(rl_outstream, "M-"); n += 2; c = ((c) & (~0x080)); } if ((((c) < 0x020 && (((c) & 0x80) == 0)) && c != '\t') || c == 0x7f) { fprintf(rl_outstream, "C-"); n += 2; c = ((c) < 0x020 && (((c) & 0x80) == 0)) ? ((1 && (1 && ((*__ctype_b_loc())[(int)(((unsigned char)((c) | 0x40)))] & (unsigned short int)_ISlower))) ? toupper((unsigned char)(((c) | 0x40))) : (((c) | 0x40))) : '?'; } putc(c, rl_outstream); fflush(rl_outstream); return n; }
long long rl_show_char(unsigned long a0) { unsigned int v0; unsigned int v1; unsigned int v4; unsigned int v6; v0 = a0; v1 = 1; if (v0 > 127 && v0 <= 255 && !_rl_output_meta_chars) { fprintf(rl_outstream, "M-"); v1 += 2; v0 &= -129; } if (v0 == 127 || v0 <= 31 && !(v0 & 128) && v0 != 9) { fprintf(rl_outstream, "C-"); v1 += 2; if (v0 <= 31 && !(v0 & 128)) { v6 = *((*(__ctype_b_loc()) + (v0 | 64) * 2)) & 0x200; if (v6) v4 = toupper(v0 | 64); else v4 = v0 | 64; } if (v0 > 31 || (v0 & 128)) v4 = 63; v0 = v4; } putc(v0, rl_outstream); fflush(rl_outstream); return v1; }
bash
angr_dream
int waitforjob(struct job *jp) { int st; ; dowait(jp ? 1 : 0, jp); if (!jp) return exitstatus; st = getstatus(jp); if (jp->jobctl) { xtcsetpgrp(ttyfd, rootpid); if (jp->sigint) raise(2); } if (!1 || jp->state == 2) freejob(jp); return st; }
int waitforjob(char a0[32]) { unsigned int v0; unsigned int v2; dowait(a0, a0); if (!a0) { v2 = exitstatus; return v2; } v0 = getstatus(a0); if ((a0[31] & 2)) { xtcsetpgrp(ttyfd, rootpid); if ((a0[31] & 1)) raise(0x2); } if (a0[30] == 2) freejob(a0); v2 = v0; return v2; }
dash-0.5.11+git20210903+057cd650a4ed
angr_sailr
char *getbtmp() { static char btmp[2048 + 5]; char *p; memset(btmp, '\0', 2048 + 5); strncpy(btmp, "/var/log/wtmp", 2048); if ((p = strrchr(btmp, '/')) == ((void *)0)) p = btmp; else p++; *p = 0; strcat(btmp, "btmp"); return btmp; }
int getbtmp() { unsigned long long v0; memset(&btmp.5486, 0x0, 0x805); strncpy(&btmp.5486, "/var/log/wtmp", 0x800); v0 = strrchr(&btmp.5486, 0x2f); if (!v0) v0 = &btmp.5486; else v0 += 1; *(v0) = 0; strcat(&btmp.5486, "btmp"); return &btmp.5486; }
sysvinit
angr_sailr
static void log_gpasswd_failure(const char *suffix) { if (aflg) { do { char *old_locale = setlocale(6, ((void *)0)); char *saved_locale = ((void *)0); if (((void *)0) != old_locale) { saved_locale = strdup(old_locale); } if (((void *)0) != saved_locale) { (void)setlocale(6, "C"); } syslog(3, "%s failed to add user %s to group %s%s", myname, user, group, suffix); if (((void *)0) != saved_locale) { (void)setlocale(6, saved_locale); free(saved_locale); } } while (0) ; } else if (dflg) { do { char *old_locale = setlocale(6, ((void *)0)); char *saved_locale = ((void *)0); if (((void *)0) != old_locale) { saved_locale = strdup(old_locale); } if (((void *)0) != saved_locale) { (void)setlocale(6, "C"); } syslog(3, "%s failed to remove user %s from group %s%s", myname, user, group, suffix); if (((void *)0) != saved_locale) { (void)setlocale(6, saved_locale); free(saved_locale); } } while (0) ; } else if (rflg) { do { char *old_locale = setlocale(6, ((void *)0)); char *saved_locale = ((void *)0); if (((void *)0) != old_locale) { saved_locale = strdup(old_locale); } if (((void *)0) != saved_locale) { (void)setlocale(6, "C"); } syslog(3, "%s failed to remove password of group %s%s", myname, group, suffix); if (((void *)0) != saved_locale) { (void)setlocale(6, saved_locale); free(saved_locale); } } while (0) ; } else if (Rflg) { do { char *old_locale = setlocale(6, ((void *)0)); char *saved_locale = ((void *)0); if (((void *)0) != old_locale) { saved_locale = strdup(old_locale); } if (((void *)0) != saved_locale) { (void)setlocale(6, "C"); } syslog(3, "%s failed to restrict access to group %s%s", myname, group, suffix); if (((void *)0) != saved_locale) { (void)setlocale(6, saved_locale); free(saved_locale); } } while (0) ; } else if (Aflg || Mflg) { if (Aflg) { do { char *old_locale = setlocale(6, ((void *)0)); char *saved_locale = ((void *)0); if (((void *)0) != old_locale) { saved_locale = strdup(old_locale); } if (((void *)0) != saved_locale) { (void)setlocale(6, "C"); } syslog(3, "%s failed to set the administrators of group %s to %s%s", myname, group, admins, suffix); if (((void *)0) != saved_locale) { (void)setlocale(6, saved_locale); free(saved_locale); } } while (0) ; } if (Mflg) { do { char *old_locale = setlocale(6, ((void *)0)); char *saved_locale = ((void *)0); if (((void *)0) != old_locale) { saved_locale = strdup(old_locale); } if (((void *)0) != saved_locale) { (void)setlocale(6, "C"); } syslog(3, "%s failed to set the members of group %s to %s%s", myname, group, members, suffix); if (((void *)0) != saved_locale) { (void)setlocale(6, saved_locale); free(saved_locale); } } while (0) ; } } else { do { char *old_locale = setlocale(6, ((void *)0)); char *saved_locale = ((void *)0); if (((void *)0) != old_locale) { saved_locale = strdup(old_locale); } if (((void *)0) != saved_locale) { (void)setlocale(6, "C"); } syslog(3, "%s failed to change password of group %s%s", myname, group, suffix); if (((void *)0) != saved_locale) { (void)setlocale(6, saved_locale); free(saved_locale); } } while (0) ; } }
void log_gpasswd_failure(undefined8 param_1) { char *pcVar1; char *local_78; char *local_70; char *local_68; char *local_60; char *local_58; char *local_50; char *local_48; if (aflg == '\0') { if (dflg == '\0') { if (rflg == '\0') { if (Rflg == '\0') { if ((Aflg == '\0') && (Mflg == '\0')) { pcVar1 = setlocale(6, (char *)0x0); local_48 = (char *)0x0; if (pcVar1 != (char *)0x0) { local_48 = strdup(pcVar1); } if (local_48 != (char *)0x0) { setlocale(6, "C"); } syslog(3, "%s failed to change password of group %s%s", myname, group, param_1); if (local_48 != (char *)0x0) { setlocale(6, local_48); free(local_48); } } else { if (Aflg != '\0') { pcVar1 = setlocale(6, (char *)0x0); local_58 = (char *)0x0; if (pcVar1 != (char *)0x0) { local_58 = strdup(pcVar1); } if (local_58 != (char *)0x0) { setlocale(6, "C"); } syslog(3, "%s failed to set the administrators of group %s to %s%s", myname, group, admins, param_1); if (local_58 != (char *)0x0) { setlocale(6, local_58); free(local_58); } } if (Mflg != '\0') { pcVar1 = setlocale(6, (char *)0x0); local_50 = (char *)0x0; if (pcVar1 != (char *)0x0) { local_50 = strdup(pcVar1); } if (local_50 != (char *)0x0) { setlocale(6, "C"); } syslog(3, "%s failed to set the members of group %s to %s%s", myname, group, members, param_1); if (local_50 != (char *)0x0) { setlocale(6, local_50); free(local_50); } } } } else { pcVar1 = setlocale(6, (char *)0x0); local_60 = (char *)0x0; if (pcVar1 != (char *)0x0) { local_60 = strdup(pcVar1); } if (local_60 != (char *)0x0) { setlocale(6, "C"); } syslog(3, "%s failed to restrict access to group %s%s", myname, group, param_1); if (local_60 != (char *)0x0) { setlocale(6, local_60); free(local_60); } } } else { pcVar1 = setlocale(6, (char *)0x0); local_68 = (char *)0x0; if (pcVar1 != (char *)0x0) { local_68 = strdup(pcVar1); } if (local_68 != (char *)0x0) { setlocale(6, "C"); } syslog(3, "%s failed to remove password of group %s%s", myname, group, param_1); if (local_68 != (char *)0x0) { setlocale(6, local_68); free(local_68); } } } else { pcVar1 = setlocale(6, (char *)0x0); local_70 = (char *)0x0; if (pcVar1 != (char *)0x0) { local_70 = strdup(pcVar1); } if (local_70 != (char *)0x0) { setlocale(6, "C"); } syslog(3, "%s failed to remove user %s from group %s%s", myname, user, group, param_1); if (local_70 != (char *)0x0) { setlocale(6, local_70); free(local_70); } } } else { pcVar1 = setlocale(6, (char *)0x0); local_78 = (char *)0x0; if (pcVar1 != (char *)0x0) { local_78 = strdup(pcVar1); } if (local_78 != (char *)0x0) { setlocale(6, "C"); } syslog(3, "%s failed to add user %s to group %s%s", myname, user, group, param_1); if (local_78 != (char *)0x0) { setlocale(6, local_78); free(local_78); } } return; }
shadow
ghidra