input
stringlengths
26
172k
output
stringlengths
18
318k
repo_name
stringclasses
23 values
decompiler
stringclasses
5 values
static inline unsigned long int select_plural(uintmax_t n) { enum { PLURAL_REDUCER = 1000000 }; return (n <= (0x7fffffffffffffffL * 2UL + 1UL) ? n : n % PLURAL_REDUCER + PLURAL_REDUCER); }
int select_plural(unsigned long a0) { return a0; }
coreutils
angr_sailr
_Bool transform_name_fp (char **pinput, int flags, char *(*fun)(char *, void *), void *dat) { char *str; _Bool ret = _transform_name_to_obstack(flags, *pinput, &str); if (ret) { assign_string(pinput, fun ? fun(str, dat) : str); __extension__({ struct obstack *__o = (&stk); void *__obj = (void *)(str); if (__obj > (void *)__o->chunk && __obj < (void *)__o->chunk_limit) __o->next_free = __o->object_base = (char *)__obj; else _obstack_free(__o, __obj); }); } else if (fun) { *pinput = ((void *)0); assign_string(pinput, fun(str, dat)); free(str); ret = 1; } return ret; }
void transform_name_fp(unsigned long long *a0, unsigned long a1, unsigned long long a2, unsigned long long a3) { char v0; char v1; unsigned long long v2; unsigned long long v3; unsigned long long v5; unsigned long long v6; unsigned long long v7; v0 = _transform_name_to_obstack(a1, *(a0), &v1); if (v0) { if (!a2) v6 = *(&v1); else v6 = (stack_base)[80](*(&v1), a3, a3, a2); assign_string(a0, v6, a0); v2 = &stk; v3 = *(&v1); if (v3 > *((v2 + 8)) && v3 < *((v2 + 32))) { *((v2 + 16)) = v3; *((v2 + 24)) = *((v2 + 16)); goto LABEL_401b01; } _obstack_free(v2, v3); } else if (a2) { *(a0) = 0; v5 = (stack_base)[80](*(&v1), a3, a3, a2); assign_string(a0, v5, v5); free(*(&v1)); v0 = 1; } LABEL_401b01: v7 = v0; return; }
tar
angr_phoenix
void tar_stat_init(struct tar_stat_info *st) { memset(st, 0, sizeof(*st)); }
void tar_stat_init(void *param_1) { memset(param_1, 0, 0x1b8); return; }
tar
ghidra
static inline _Bool is_ENOTSUP(int err) { return err == 95 || (95 != 95 && err == 95); }
int is_ENOTSUP(unsigned long a0) { char v1; unsigned int v2; v1 = a0 == 95; return v2; }
coreutils
angr_phoenix
static block_state deflate_fast(s, flush) deflate_state *s; int flush; { IPos hash_head; int bflush; for (;;) { if (s->lookahead < (258 + 3 + 1)) { fill_window(s); if (s->lookahead < (258 + 3 + 1) && flush == 0) { return need_more; } if (s->lookahead == 0) break; } hash_head = 0; if (s->lookahead >= 3) { ((s->ins_h = (((s->ins_h) << s->hash_shift) ^ (s->window[(s->strstart) + (3 - 1)])) & s->hash_mask), hash_head = s->prev[(s->strstart) & s->w_mask] = s->head[s->ins_h], s->head[s->ins_h] = (Pos)(s->strstart)); } if (hash_head != 0 && s->strstart - hash_head <= ((s)->w_size - (258 + 3 + 1))) { s->match_length = longest_match(s, hash_head); } if (s->match_length >= 3) { ; { uch len = (uch)(s->match_length - 3); ush dist = (ush)(s->strstart - s->match_start); s->sym_buf[s->sym_next++] = (uch)dist; s->sym_buf[s->sym_next++] = (uch)(dist >> 8); s->sym_buf[s->sym_next++] = len; dist--; s->dyn_ltree[_length_code[len] + 256 + 1].fc.freq++; s->dyn_dtree[((dist) < 256 ? _dist_code[dist] : _dist_code[256 + ((dist) >> 7)])] .fc.freq++; bflush = (s->sym_next == s->sym_end); }; s->lookahead -= s->match_length; if (s->match_length <= s->max_lazy_match && s->lookahead >= 3) { s->match_length--; do { s->strstart++; ((s->ins_h = (((s->ins_h) << s->hash_shift) ^ (s->window[(s->strstart) + (3 - 1)])) & s->hash_mask), hash_head = s->prev[(s->strstart) & s->w_mask] = s->head[s->ins_h], s->head[s->ins_h] = (Pos)(s->strstart)); } while (--s->match_length != 0); s->strstart++; } else { s->strstart += s->match_length; s->match_length = 0; s->ins_h = s->window[s->strstart]; (s->ins_h = (((s->ins_h) << s->hash_shift) ^ (s->window[s->strstart + 1])) & s->hash_mask); } } else { ; { uch cc = (s->window[s->strstart]); s->sym_buf[s->sym_next++] = 0; s->sym_buf[s->sym_next++] = 0; s->sym_buf[s->sym_next++] = cc; s->dyn_ltree[cc].fc.freq++; bflush = (s->sym_next == s->sym_end); }; s->lookahead--; s->strstart++; } if (bflush) { { _tr_flush_block(s, (s->block_start >= 0L ? (charf *)&s->window[(unsigned)s->block_start] : (charf *)0), (ulg)((long)s->strstart - s->block_start), (0)); s->block_start = s->strstart; flush_pending(s->strm); ; }; if (s->strm->avail_out == 0) return (0) ? finish_started : need_more; }; } s->insert = s->strstart < 3 - 1 ? s->strstart : 3 - 1; if (flush == 4) { { { _tr_flush_block(s, (s->block_start >= 0L ? (charf *)&s->window[(unsigned)s->block_start] : (charf *)0), (ulg)((long)s->strstart - s->block_start), (1)); s->block_start = s->strstart; flush_pending(s->strm); ; }; if (s->strm->avail_out == 0) return (1) ? finish_started : need_more; }; return finish_done; } if (s->sym_next) { { _tr_flush_block(s, (s->block_start >= 0L ? (charf *)&s->window[(unsigned)s->block_start] : (charf *)0), (ulg)((long)s->strstart - s->block_start), (0)); s->block_start = s->strstart; flush_pending(s->strm); ; }; if (s->strm->avail_out == 0) return (0) ? finish_started : need_more; }; return block_done; }
long deflate_fast(long a1, int a2) { _WORD *v3; long v4; unsigned int v5; long v6; unsigned int v7; long v8; unsigned int v9; int v10; int v11; long v12; unsigned int v13; long v14; unsigned int v15; long v16; unsigned int v17; long v18; int v19; long v20; long v21; unsigned char v23; unsigned char v24; short v25; unsigned short v26; unsigned int v27; _BOOL4 v28; while (1) { if (*(_DWORD *)(a1 + 180) <= 0x105u) { fill_window(a1); if (*(_DWORD *)(a1 + 180) <= 0x105u && !a2) return 0LL; if (!*(_DWORD *)(a1 + 180)) break; } v27 = 0; if (*(_DWORD *)(a1 + 180) > 2u) { *(_DWORD *)(a1 + 128) = *(_DWORD *)(a1 + 140) & (*(unsigned char *)(*(_QWORD *)(a1 + 96) + (unsigned int)(*(_DWORD *)(a1 + 172) + 2)) ^ (*(_DWORD *)(a1 + 128) << *(_DWORD *)(a1 + 144))); v3 = (_WORD *)(*(_QWORD *)(a1 + 112) + 2LL * (unsigned int)(*(_DWORD *)(a1 + 172) & *(_DWORD *)(a1 + 88))); *v3 = *(_WORD *)(2LL * *(unsigned int *)(a1 + 128) + *(_QWORD *)(a1 + 120)); v27 = (unsigned short)*v3; *(_WORD *)(*(_QWORD *)(a1 + 120) + 2LL * *(unsigned int *)(a1 + 128)) = *(_DWORD *)(a1 + 172); } if (v27 && *(_DWORD *)(a1 + 172) - v27 <= *(_DWORD *)(a1 + 80) - 262) *(_DWORD *)(a1 + 160) = longest_match(a1, v27); if (*(_DWORD *)(a1 + 160) <= 2u) { v23 = *(_BYTE *)(*(_QWORD *)(a1 + 96) + *(unsigned int *)(a1 + 172)); v12 = *(_QWORD *)(a1 + 5888); v13 = *(_DWORD *)(a1 + 5900); *(_DWORD *)(a1 + 5900) = v13 + 1; *(_BYTE *)(v12 + v13) = 0; v14 = *(_QWORD *)(a1 + 5888); v15 = *(_DWORD *)(a1 + 5900); *(_DWORD *)(a1 + 5900) = v15 + 1; *(_BYTE *)(v14 + v15) = 0; v16 = *(_QWORD *)(a1 + 5888); v17 = *(_DWORD *)(a1 + 5900); *(_DWORD *)(a1 + 5900) = v17 + 1; *(_BYTE *)(v16 + v17) = v23; ++*(_WORD *)(a1 + 4 * (v23 + 52LL) + 4); v28 = *(_DWORD *)(a1 + 5900) == *(_DWORD *)(a1 + 5904); --*(_DWORD *)(a1 + 180); ++*(_DWORD *)(a1 + 172); } else { v24 = *(_DWORD *)(a1 + 160) - 3; v25 = *(_DWORD *)(a1 + 172) - *(_DWORD *)(a1 + 176); v4 = *(_QWORD *)(a1 + 5888); v5 = *(_DWORD *)(a1 + 5900); *(_DWORD *)(a1 + 5900) = v5 + 1; *(_BYTE *)(v4 + v5) = v25; v6 = *(_QWORD *)(a1 + 5888); v7 = *(_DWORD *)(a1 + 5900); *(_DWORD *)(a1 + 5900) = v7 + 1; *(_BYTE *)(v6 + v7) = HIBYTE(v25); v8 = *(_QWORD *)(a1 + 5888); v9 = *(_DWORD *)(a1 + 5900); *(_DWORD *)(a1 + 5900) = v9 + 1; *(_BYTE *)(v8 + v9) = v24; v26 = v25 - 1; v10 = *((unsigned char *)&length_code + v24) + 257; ++*(_WORD *)(a1 + 4 * (v10 + 52LL) + 4); if (v26 > 0xFFu) v11 = dist_code[(v26 >> 7) + 256]; else v11 = dist_code[v26]; ++*(_WORD *)(a1 + 4 * (v11 + 624LL) + 8); v28 = *(_DWORD *)(a1 + 5900) == *(_DWORD *)(a1 + 5904); *(_DWORD *)(a1 + 180) -= *(_DWORD *)(a1 + 160); if (*(_DWORD *)(a1 + 160) > *(_DWORD *)(a1 + 192) || *(_DWORD *)(a1 + 180) <= 2u) { *(_DWORD *)(a1 + 172) += *(_DWORD *)(a1 + 160); *(_DWORD *)(a1 + 160) = 0; *(_DWORD *)(a1 + 128) = *(unsigned char *)(*(_QWORD *)(a1 + 96) + *(unsigned int *)(a1 + 172)); *(_DWORD *)(a1 + 128) = *(_DWORD *)(a1 + 140) & (*(unsigned char *)(*(_QWORD *)(a1 + 96) + (unsigned int)(*(_DWORD *)(a1 + 172) + 1)) ^ (*(_DWORD *)(a1 + 128) << *(_DWORD *)(a1 + 144))); } else { --*(_DWORD *)(a1 + 160); do { *(_DWORD *)(a1 + 128) = *(_DWORD *)(a1 + 140) & (*(unsigned char *)(*(_QWORD *)(a1 + 96) + (unsigned int)(++*(_DWORD *)(a1 + 172) + 2)) ^ (*(_DWORD *)(a1 + 128) << *(_DWORD *)(a1 + 144))); *(_WORD *)(*(_QWORD *)(a1 + 112) + 2LL * (unsigned int)(*(_DWORD *)(a1 + 172) & *(_DWORD *)(a1 + 88))) = *(_WORD *)(2LL * *(unsigned int *)(a1 + 128) + *(_QWORD *)(a1 + 120)); *(_WORD *)(*(_QWORD *)(a1 + 120) + 2LL * *(unsigned int *)(a1 + 128)) = *(_DWORD *)(a1 + 172); --*(_DWORD *)(a1 + 160); } while (*(_DWORD *)(a1 + 160)); ++*(_DWORD *)(a1 + 172); } } if (v28) { v18 = *(long *)(a1 + 152) < 0 ? 0LL : *(_QWORD *)(a1 + 96) + (unsigned int)*(_QWORD *)(a1 + 152); tr_flush_block(a1, v18, *(unsigned int *)(a1 + 172) - *(_QWORD *)(a1 + 152), 0LL); *(_QWORD *)(a1 + 152) = *(unsigned int *)(a1 + 172); flush_pending(*(_QWORD *)a1); if (!*(_DWORD *)(*(_QWORD *)a1 + 32LL)) return 0LL; } } v19 = 2; if (*(_DWORD *)(a1 + 172) <= 2u) v19 = *(_DWORD *)(a1 + 172); *(_DWORD *)(a1 + 5932) = v19; if (a2 != 4) return !*(_DWORD *)(a1 + 5900) || (*(long *)(a1 + 152) < 0 ? (v21 = 0LL) : (v21 = *(_QWORD *)(a1 + 96) + (unsigned int)*(_QWORD *)(a1 + 152)), tr_flush_block(a1, v21, *(unsigned int *)(a1 + 172) - *(_QWORD *)(a1 + 152), 0LL), *(_QWORD *)(a1 + 152) = *(unsigned int *)(a1 + 172), flush_pending(*(_QWORD *)a1), *(_DWORD *)(*(_QWORD *)a1 + 32LL)); if (*(long *)(a1 + 152) < 0) v20 = 0LL; else v20 = *(_QWORD *)(a1 + 96) + (unsigned int)*(_QWORD *)(a1 + 152); tr_flush_block(a1, v20, *(unsigned int *)(a1 + 172) - *(_QWORD *)(a1 + 152), 1LL); *(_QWORD *)(a1 + 152) = *(unsigned int *)(a1 + 172); flush_pending(*(_QWORD *)a1); if (*(_DWORD *)(*(_QWORD *)a1 + 32LL)) return 3LL; else return 2LL; }
zlib
ida
char *auth2_read_banner(void) { struct stat st; char *banner = ((void *)0); size_t len, n; int fd; if ((fd = open(options.banner, 00)) == -1) return (((void *)0)); if (fstat(fd, &st) == -1) { close(fd); return (((void *)0)); } if (st.st_size <= 0 || st.st_size > 1 * 1024 * 1024) { close(fd); return (((void *)0)); } len = (size_t)st.st_size; banner = xmalloc(len + 1); n = atomicio(read, fd, banner, len); close(fd); if (n != len) { free(banner); return (((void *)0)); } banner[n] = '\0'; return (banner); }
_BYTE *auth2_read_banner() { unsigned int fd; _BYTE *ptr; __off_t st_size; long v4; struct stat buf; unsigned long v6; v6 = __readfsqword(0x28u); fd = open(*(const char **)&options[1916], 0); if (fd == -1) return 0LL; if (fstat(fd, &buf) == -1 || buf.st_size <= 0 || buf.st_size > 0x100000) { close(fd); return 0LL; } else { st_size = buf.st_size; ptr = (_BYTE *)xmalloc(buf.st_size + 1); v4 = atomicio(&read, fd, ptr, st_size); close(fd); if (v4 == st_size) { ptr[v4] = 0; return ptr; } else { free(ptr); return 0LL; } } }
openssh-portable
ida
static inline SHELL_VAR *set_string_value(SHELL_VAR *var, const char *value, int flags) { char *p; if (value && *value) p = (char *)strcpy(sh_xmalloc((1 + strlen(value)), "variables.c", 1332), (value)); else { p = (char *)sh_xmalloc((1), "variables.c", 1335); p[0] = '\0'; } do { if (((var)->value)) sh_xfree((((var)->value)), "variables.c", 1338); } while (0); ((var)->value = (p)); return (var); }
void set_string_value(struct_0 *a0, char *a1, unsigned long a2) { unsigned int v0; char *v1; struct_0 *v3; v0 = a2; if (!a1 || !*(a1)) { v1 = sh_xmalloc(0x1, "variables.c", 0x537); *(v1) = 0; } else { v1 = strcpy(sh_xmalloc(strlen(a1) + 1, "variables.c", 0x534), a1); } if (a0->field_8) sh_xfree(a0->field_8, "variables.c", 0x53a); a0->field_8 = v1; v3 = a0; return; }
bash
angr_sailr
int mac_check(struct sshmac *mac, u_int32_t seqno, const u_char *data, size_t dlen, const u_char *theirmac, size_t mlen) { u_char ourmac[64]; int r; if (mac->mac_len > mlen) return -10; if ((r = mac_compute(mac, seqno, data, dlen, ourmac, sizeof(ourmac))) != 0) return r; if (timingsafe_bcmp(ourmac, theirmac, mac->mac_len) != 0) return -30; return 0; }
long mac_check(long a1, unsigned int a2, long a3, int a4, long a5, unsigned long a6) { unsigned int v8; char v9[72]; unsigned long v10; v10 = __readfsqword(0x28u); if (a6 < *(unsigned int *)(a1 + 12)) return 4294967286LL; v8 = mac_compute(a1, a2, a3, a4, v9, 0x40uLL); if (v8) return v8; if ((unsigned int)timingsafe_bcmp(v9, a5, *(unsigned int *)(a1 + 12))) return 4294967266LL; return 0LL; }
openssh-portable
ida
static void ssh_session2_setup(struct ssh *ssh, int id, int success, void *arg) { const char *display, *term; int r, interactive = tty_flag; char *proto = ((void *)0), *data = ((void *)0); if (!success) return; display = getenv("DISPLAY"); if (display == ((void *)0) && options.forward_x11) sshlog("ssh.c", __func__, 2035, 0, SYSLOG_LEVEL_DEBUG1, ((void *)0), "X11 forwarding requested but DISPLAY not set"); if (options.forward_x11 && client_x11_get_proto(ssh, display, options.xauth_location, options.forward_x11_trusted, options.forward_x11_timeout, &proto, &data) == 0) { sshlog("ssh.c", __func__, 2040, 0, SYSLOG_LEVEL_DEBUG1, ((void *)0), "Requesting X11 forwarding with authentication " "spoofing."); x11_request_forwarding_with_spoofing(ssh, id, display, proto, data, 1); client_expect_confirm(ssh, id, "X11 forwarding", CONFIRM_WARN); interactive = 1; } check_agent_present(); if (options.forward_agent) { sshlog("ssh.c", __func__, 2051, 0, SYSLOG_LEVEL_DEBUG1, ((void *)0), "Requesting authentication agent forwarding."); channel_request_start(ssh, id, "auth-agent-req@openssh.com", 0); if ((r = sshpkt_send(ssh)) != 0) sshfatal("ssh.c", __func__, 2054, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "send packet"); } ssh_packet_set_interactive(ssh, interactive, options.ip_qos_interactive, options.ip_qos_bulk); if ((term = lookup_env_in_list("TERM", options.setenv, options.num_setenv)) == ((void *)0) || *term == '\0') term = getenv("TERM"); client_session2_setup(ssh, id, tty_flag, options.session_type == 1, term, ((void *)0), fileno(stdin), command, environ); }
long long ssh_session2_setup(unsigned long long a0, unsigned long a1, unsigned long a2, unsigned long a3) { char v0; unsigned long v1; unsigned int v2; unsigned int v3; void *v4; void *v5; char *v6; unsigned long long v7; unsigned long v8; unsigned long long v9; unsigned long v10; char v11; unsigned long long v12; v1 = a3; v2 = tty_flag; v4 = 0; v5 = 0; if (a2) { v7 = getenv("DISPLAY"); if (!v7) sshlog("ssh.c", "ssh_session2_setup", 0x7f3, 0x0, 0x5, 0x0, "X11 forwarding requested but DISPLAY not set", *(&v0)); if (!client_x11_get_proto(a0, v7, 0xeb00000000f445c7, 0xe47589e87d894820, 0x7d894820ec8348e5, &v4)) { sshlog("ssh.c", "ssh_session2_setup", 0x7f8, 0x0, 0x5, 0x0, "Requesting X11 forwarding with authentication spoofing.", *(&v0)); x11_request_forwarding_with_spoofing(a0, a1, v7, v4, v5, 0x1); client_expect_confirm(a0, a1, "X11 forwarding", 0x0); v2 = 1; } check_agent_present(); sshlog("ssh.c", "ssh_session2_setup", 0x803, 0x0, 0x5, 0x0, "Requesting authentication agent forwarding.", *(&v0)); channel_request_start(a0, a1, "auth-agent-req@openssh.com", 0x0); v3 = sshpkt_send(a0); if (v3) sshfatal("ssh.c", "ssh_session2_setup", 0x806, 0x1, 0x1, ssh_err(v3)); ssh_packet_set_interactive(a0, v2, 0x48f4458b000fff98, 0xc5148d48f4458b); v6 = lookup_env_in_list("TERM", 0xb8000074, 0xe53d8d4800008f74); if (v6 && !(!*(v6))) goto LABEL_4073fd; v6 = getenv("TERM"); LABEL_4073fd: v10 = environ; v9 = 5188164362665560904; v8 = fileno(stdin); client_session2_setup(a0, a1, tty_flag, 203409651139000 == 1, v6, 0x0, *(&v11), v12); } return 0; }
openssh-portable
angr_phoenix
static void *myMalloc(Int32 n) { void *p; p = malloc((size_t)n); if (p == ((void *)0)) outOfMemory(); return p; }
void *myMalloc(int param_1) { void *pvVar1; pvVar1 = malloc((long)param_1); if (pvVar1 == (void *)0x0) { outOfMemory(); } return pvVar1; }
bzip2
ghidra
int main(int argc, char **argv) { int debug_flag = 0, log_level = SYSLOG_LEVEL_INFO; int opt, fopt_count = 0, j; char *tname, *cp, *line = ((void *)0); size_t linesize = 0; FILE *fp; __progname = ssh_get_progname(argv[0]); seed_rng(); do { (&tq)->tqh_first = ((void *)0); (&tq)->tqh_last = &(&tq)->tqh_first; } while (0); sanitise_stdfd(); if (argc <= 1) usage(); while ((opt = BSDgetopt(argc, argv, "cDHv46p:T:t:f:")) != -1) { switch (opt) { case 'H': hash_hosts = 1; break; case 'c': get_cert = 1; break; case 'D': print_sshfp = 1; break; case 'p': ssh_port = a2port(BSDoptarg); if (ssh_port <= 0) { fprintf(stderr, "Bad port '%s'\n", BSDoptarg); exit(1); } break; case 'T': timeout = convtime(BSDoptarg); if (timeout == -1 || timeout == 0) { fprintf(stderr, "Bad timeout '%s'\n", BSDoptarg); usage(); } break; case 'v': if (!debug_flag) { debug_flag = 1; log_level = SYSLOG_LEVEL_DEBUG1; } else if (log_level < SYSLOG_LEVEL_DEBUG3) log_level++; else sshfatal("ssh-keyscan.c", __func__, 725, 0, SYSLOG_LEVEL_FATAL, ((void *)0), "Too high debugging level."); break; case 'f': if (strcmp(BSDoptarg, "-") == 0) BSDoptarg = ((void *)0); argv[fopt_count++] = BSDoptarg; break; case 't': get_keytypes = 0; tname = strtok(BSDoptarg, ","); while (tname) { int type = sshkey_type_from_name(tname); switch (type) { case KEY_DSA: get_keytypes |= (1); break; case KEY_ECDSA: get_keytypes |= (1 << 2); break; case KEY_RSA: get_keytypes |= (1 << 1); break; case KEY_ED25519: get_keytypes |= (1 << 3); break; case KEY_XMSS: get_keytypes |= (1 << 4); break; case KEY_ED25519_SK: get_keytypes |= (1 << 6); break; case KEY_ECDSA_SK: get_keytypes |= (1 << 5); break; case KEY_UNSPEC: default: sshfatal("ssh-keyscan.c", __func__, 762, 0, SYSLOG_LEVEL_FATAL, ((void *)0), "Unknown key type \"%s\"", tname); } tname = strtok(((void *)0), ","); } break; case '4': IPv4or6 = 2; break; case '6': IPv4or6 = 10; break; case '?': default: usage(); } } if (BSDoptind == argc && !fopt_count) usage(); log_init("ssh-keyscan", log_level, SYSLOG_FACILITY_USER, 1); maxfd = fdlim_get(1); if (maxfd < 0) sshfatal("ssh-keyscan.c", __func__, 785, 0, SYSLOG_LEVEL_FATAL, ((void *)0), "%s: fdlim_get: bad value", __progname); if (maxfd > 256) maxfd = 256; if ((maxfd - 10) <= 0) sshfatal("ssh-keyscan.c", __func__, 789, 0, SYSLOG_LEVEL_FATAL, ((void *)0), "%s: not enough file descriptors", __progname); if (maxfd > fdlim_get(0)) fdlim_set(maxfd); fdcon = xcalloc(maxfd, sizeof(con)); read_wait = xcalloc(maxfd, sizeof(struct pollfd)); for (j = 0; j < maxfd; j++) read_wait[j].fd = -1; for (j = 0; j < fopt_count; j++) { if (argv[j] == ((void *)0)) fp = stdin; else if ((fp = fopen(argv[j], "r")) == ((void *)0)) sshfatal("ssh-keyscan.c", __func__, 801, 0, SYSLOG_LEVEL_FATAL, ((void *)0), "%s: %s: %s", __progname, argv[j], strerror((*__errno_location()))); while (getline(&line, &linesize, fp) != -1) { if ((cp = strchr(line, '#')) == ((void *)0)) cp = line + strlen(line) - 1; while (cp >= line) { if (*cp == ' ' || *cp == '\t' || *cp == '\n' || *cp == '#') *cp-- = '\0'; else break; } if (*line == '\0') continue; do_host(line); } if (ferror(fp)) sshfatal("ssh-keyscan.c", __func__, 823, 0, SYSLOG_LEVEL_FATAL, ((void *)0), "%s: %s: %s", __progname, argv[j], strerror((*__errno_location()))); fclose(fp); } free(line); while (BSDoptind < argc) do_host(argv[BSDoptind++]); while (ncon > 0) conloop(); return found_one ? 0 : 1; }
int main(unsigned long a0, unsigned long long *a1, unsigned long long a2, unsigned long long a3, unsigned long long a4, unsigned long long a5) { unsigned long v0; unsigned long v1; unsigned int v2; unsigned int v3; unsigned int v4; unsigned int v5; unsigned int v6; unsigned int v7; void *v8; void *v9; unsigned long long v10; char *v11; void *v12; struct_0 *v14; unsigned long long *v16; char *v19; v2 = 0; v3 = 3; v4 = 0; v8 = 0; v9 = 0; __progname = ssh_get_progname(*(a1)); seed_rng(a0, a1, a2, a3, a4, a5); tq = 0; g_400018 = &tq; sanitise_stdfd(a0, a1, a2, a3, a4, a5); if (a0 <= 1) usage(); while (true) { v6 = BSDgetopt(a0, a1, "cDHv46p:T:t:f:", a1); if (v6 == -1) break; v14 = __addvsi3(v6, 0xffffffcc, "cDHv46p:T:t:f:", a3); switch (v14) { case 0: IPv4or6 = 2; break; case 2: IPv4or6 = 10; break; case 16: print_sshfp = 1; break; case 20: hash_hosts = 1; break; case 32: timeout = convtime(BSDoptarg); if (!(timeout != -1) || !(timeout)) { fprintf(*(&stderr), "Bad timeout '%s'\n", BSDoptarg); usage(); } break; case 47: get_cert = 1; break; case 50: if (!strcmp(BSDoptarg, "-")) BSDoptarg = 0; v16 = v4; v4 = __addvsi3(v4, 0x1, &g_4034d8, a3); *((0x8 * v16 + a1)) = BSDoptarg; break; case 60: ssh_port = a2port(BSDoptarg); if (ssh_port <= 0) { fprintf(*(&stderr), "Bad port '%s'\n", BSDoptarg); exit(0x1); } break; case 64: get_keytypes = 0; for (v10 = strtok(BSDoptarg, ","); v10; v10 = strtok(NULL, ",")) { v7 = sshkey_type_from_name(v10); switch (v7) { case 0: get_keytypes = get_keytypes | 2; break; case 1: get_keytypes = get_keytypes | 1; break; case 2: get_keytypes = get_keytypes | 4; break; case 3: get_keytypes = get_keytypes | 8; break; case 8: get_keytypes = get_keytypes | 16; break; case 10: get_keytypes = get_keytypes | 32; break; case 12: get_keytypes = get_keytypes | 64; break; default: v1 = v10; sshfatal("ssh-keyscan.c", "main", 0x2fa, 0x0, 0x1, 0x0, "Unknown key type \"%s\""); } } case 66: if (!v2) { v2 = 1; v3 = 5; break; } else { if (v3 > 6) sshfatal("ssh-keyscan.c", "main", 0x2d5, 0x0, 0x1, 0x0, "Too high debugging level."); v3 = __addvsi3(v3, 0x1, &g_4034d8, a3); break; } default: usage(); } } if (a0 == BSDoptind && !v4) usage(); log_init("ssh-keyscan", v3, 0x1, 0x1); ncon = fdlim_get(0x1); if (3525336957436119125 < 0) { v1 = __progname; sshfatal("ssh-keyscan.c", "main", 0x311, 0x0, 0x1, 0x0, "%s: fdlim_get: bad value"); } if (false) ncon = 0x100; if (__addvsi3(0x30ec8348e5894855, 0xfffffff6, 0x1, 0x1) <= 0) { v1 = __progname; sshfatal("ssh-keyscan.c", "main", 0x315, 0x0, 0x1, 0x0, "%s: not enough file descriptors"); } if (fdlim_get(0x0) < 3850979413) fdlim_set(0x30ec8348e5894855); fdcon = xcalloc(0x30ec8348e5894855, 0x70); fdcon = xcalloc(0x30ec8348e5894855, 0x8); for (v5 = 0; v5 < 3850979413; v5 = __addvsi3(v5, 0x1, v5 * 8, 0x1)) { *((7267821926853935944 + v5 * 8)) = -1; } v5 = 0; while (true) { if (v5 < v4) { if (!a1[v5]) { v12 = stdin; } else { v12 = fopen(a1[v5], "r"); if (!v12) { v1 = strerror(*(__errno_location())); v0 = __progname; sshfatal("ssh-keyscan.c", "main", 0x321, 0x0, 0x1, 0x0, "%s: %s: %s"); } } while (getline(&v8, &v9, v12) != -1) { a1 = 35; v11 = strchr(v8, 0x23); if (!v11) v11 = -1 + strlen(v8) + v8; while (true) { if (v11 < v8) break; switch (*(v11)) { case 9: case 10: case 32: case 35: v19 = v11; v11 += 1; *(v19) = 0; break; default: goto LABEL_4028c0; } } LABEL_4028c0: if (*(v8)) do_host(v8, reg_64, v11 + 1, 0x1); } if (ferror(v12)) { v1 = strerror(*(__errno_location())); v0 = __progname; sshfatal("ssh-keyscan.c", "main", 0x337, 0x0, 0x1, 0x0, "%s: %s: %s"); } fclose(v12); v5 = __addvsi3(v5, 0x1, v11 + 1, 0x1); } else { free(v8); while (a0 > BSDoptind) { BSDoptind = __addvsi3(BSDoptind, 0x1, v11 + 1, 0x1); do_host(a1[BSDoptind], 0x1, BSDoptind * 8, 0x1); } while (false) { conloop(a0, a1, v11 + 1, 0x1); } return !found_one; } } }
openssh-portable
angr_sailr
static inline _Bool print_kth(uintmax_t k) { return current_rp->lo <= k; }
int print_kth(unsigned long a0) { unsigned int v1; v1 = *(current_rp); *(&v1) = *(current_rp) <= a0; return v1; }
coreutils
angr_dream
static FILEINFO *alloc_mail_file(filename, msg) char *filename, *msg; { FILEINFO *mf; mf = (FILEINFO *)sh_xmalloc((sizeof(FILEINFO)), "mailcheck.c", 216); mf->name = filename; mf->msg = msg ? (char *)strcpy( sh_xmalloc((1 + strlen(msg)), "mailcheck.c", 218), (msg)) : (char *)((void *)0); mf->flags = 0; return mf; }
long alloc_mail_file(long a1, const char *a2) { size_t v2; char *v3; char *v4; long v6; v6 = sh_xmalloc(48LL, "mailcheck.c", 216LL); *(_QWORD *)v6 = a1; if (a2) { v2 = strlen(a2); v3 = (char *)sh_xmalloc(v2 + 1, "mailcheck.c", 218LL); v4 = strcpy(v3, a2); } else { v4 = 0LL; } *(_QWORD *)(v6 + 8) = v4; *(_DWORD *)(v6 + 40) = 0; return v6; }
bash
ida
void compat_banner(struct ssh *ssh, const char *version) { int i; static struct { char *pat; int bugs; } check[] = {{"OpenSSH_2.*," "OpenSSH_3.0*," "OpenSSH_3.1*", 0x00200000 | 0x01000000 | 0x00000002}, {"OpenSSH_3.*", 0x01000000 | 0x00000002}, {"Sun_SSH_1.0*", 0x00008000 | 0x00200000 | 0x00000002}, {"OpenSSH_2*," "OpenSSH_3*," "OpenSSH_4*", 0x00000002}, {"OpenSSH_5*", 0x04000000 | 0x08000000 | 0x00000002}, {"OpenSSH_6.6.1*", 0x04000000 | 0x00000002}, {"OpenSSH_6.5*," "OpenSSH_6.6*", 0x04000000 | 0x10000000 | 0x00000002}, {"OpenSSH_7.4*", 0x04000000 | 0x00000002 | 0x00000004}, {"OpenSSH_7.0*," "OpenSSH_7.1*," "OpenSSH_7.2*," "OpenSSH_7.3*," "OpenSSH_7.5*," "OpenSSH_7.6*," "OpenSSH_7.7*", 0x04000000 | 0x00000002}, {"OpenSSH*", 0x04000000}, {"*MindTerm*", 0}, {"3.0.*", 0x00000040}, {"3.0 SecureCRT*", 0x00000010}, {"1.7 SecureFX*", 0x00000010}, {"1.2.18*," "1.2.19*," "1.2.20*," "1.2.21*," "1.2.22*", 0x00000100}, {"1.3.2*", 0x00000100}, {"Cisco-1.*", 0x40000000 | 0x20000000}, {"*SSH Compatible Server*", 0x00000400}, {"*OSU_0*," "OSU_1.0*," "OSU_1.1*," "OSU_1.2*," "OSU_1.3*," "OSU_1.4*," "OSU_1.5alpha1*," "OSU_1.5alpha2*," "OSU_1.5alpha3*", 0x00000400}, {"*SSH_Version_Mapper*", 0x00000800}, {"PuTTY_Local:*," "PuTTY-Release-0.5*," "PuTTY_Release_0.5*," "PuTTY_Release_0.60*," "PuTTY_Release_0.61*," "PuTTY_Release_0.62*," "PuTTY_Release_0.63*," "PuTTY_Release_0.64*", 0x00004000}, {"FuTTY*", 0x00004000}, {"Probe-*", 0x00400000}, {"TeraTerm SSH*," "TTSSH/1.5.*," "TTSSH/2.1*," "TTSSH/2.2*," "TTSSH/2.3*," "TTSSH/2.4*," "TTSSH/2.5*," "TTSSH/2.6*," "TTSSH/2.70*," "TTSSH/2.71*," "TTSSH/2.72*", 0x20000000}, {"WinSCP_release_4*," "WinSCP_release_5.0*," "WinSCP_release_5.1," "WinSCP_release_5.1.*," "WinSCP_release_5.5," "WinSCP_release_5.5.*," "WinSCP_release_5.6," "WinSCP_release_5.6.*," "WinSCP_release_5.7," "WinSCP_release_5.7.1," "WinSCP_release_5.7.2," "WinSCP_release_5.7.3," "WinSCP_release_5.7.4", 0x00004000}, {"ConfD-*", 0x00000001}, {"Twisted_*", 0}, {"Twisted*", 0x00000040}, {((void *)0), 0}}; ssh->compat = 0; for (i = 0; check[i].pat; i++) { if (match_pattern_list(version, check[i].pat, 0) == 1) { sshlog("compat.c", __func__, 150, 1, SYSLOG_LEVEL_DEBUG1, ((void *)0), "match: %s pat %s compat 0x%08x", version, check[i].pat, check[i].bugs); ssh->compat = check[i].bugs; return; } } sshlog("compat.c", __func__, 156, 1, SYSLOG_LEVEL_DEBUG1, ((void *)0), "no match: %s", version); }
long long compat_banner(struct_0 *a0, unsigned long long a1) { unsigned int v0; struct_0 *v2; a0->field_83c = 0; v0 = 0; while (true) { if (!check.12623 [2 * v0]) { v2 = sshlog("compat.c", "compat_banner", 0x9c, 0x1, 0x5, 0x0, "no match: %s", a1, a1); return v2; } else if (match_pattern_list(a1, check.12623 [2 * v0], 0x0, check.12623 [2 * v0]) != 1) { v0 = __addvsi3(v0, 0x1); } else { sshlog("compat.c", "compat_banner", 0x96, 0x1, 0x5, 0x0, "match: %s pat %s compat 0x%08x", a1, check.12623 [2 * v0]); v2 = a0; a0->field_83c = (&g_400cc8)[2 * v0]; return v2; } } }
openssh-portable
angr_sailr
static char *get_tmpdir(flags) int flags; { char *tdir; tdir = (flags & 0x0001) ? get_string_value("TMPDIR") : (char *)((void *)0); if (tdir && (file_iswdir(tdir) == 0 || strlen(tdir) > 4096)) tdir = 0; if (tdir == 0) tdir = get_sys_tmpdir(); if (tmpnamelen == -1) tmpnamelen = pathconf(tdir, _PC_NAME_MAX); return tdir; }
int get_tmpdir(unsigned long a0) { void *v0; void *v2; if (!(a0 & 1)) v2 = 0; else v2 = get_string_value("TMPDIR"); v0 = v2; if (v0 && (!file_iswdir(v0) || strlen(v0) > 0x1000)) v0 = 0; if (!v0) *(&v0) = get_sys_tmpdir(); if (tmpnamelen == -1) { tmpnamelen = pathconf(v0, 0x3); return v0; } return v0; }
bash
angr_sailr
static int output_devname(struct depmod *depmod, FILE *out) { size_t i; _Bool empty = 1; for (i = 0; i < depmod->modules.count; i++) { const struct mod *mod = depmod->modules.array[i]; struct kmod_list *l; const char *devname = ((void *)0); char type = '\0'; unsigned int major = 0, minor = 0; for (l = ((mod->info_list) == ((void *)0)) ? ((void *)0) : (mod->info_list); l != ((void *)0); l = (l->node.next == &((mod->info_list)->node)) ? ((void *)0) : ((struct kmod_list *)((char *)(l->node.next) - __builtin_offsetof(struct kmod_list, node)) - ((typeof(*(l->node.next)) *)0 != (typeof(((struct kmod_list *)0)->node) *)0))) { const char *key = kmod_module_info_get_key(l); const char *value = kmod_module_info_get_value(l); unsigned int maj, min; if (!(strcmp((key), ("alias")) == 0)) continue; if ((strncmp(value, "devname:", strlen("devname:")) == 0)) devname = value + sizeof("devname:") - 1; else if (sscanf(value, "char-major-%u-%u", &maj, &min) == 2) { type = 'c'; major = maj; minor = min; } else if (sscanf(value, "block-major-%u-%u", &maj, &min) == 2) { type = 'b'; major = maj; minor = min; } if (type != '\0' && devname != ((void *)0)) break; } if (devname != ((void *)0)) { if (type != '\0') { if (empty) { fputs("# Device nodes to trigger on-demand module loading.\n", out); empty = 0; } fprintf(out, "%s %s %c%u:%u\n", mod->modname, devname, type, major, minor); } else log_printf(3, "Module '%s' has devname (%s) but " "lacks major and minor information. " "Ignoring.\n", mod->modname, devname) ; } } return 0; }
long output_devname(long a1, FILE *a2) { size_t v2; _QWORD *v3; char v5; char v6; unsigned int v7; unsigned int v8; unsigned int v9; unsigned int v10; unsigned long i; _QWORD *j; const char *v13; long v14; char *s1; char *value; unsigned long v17; v17 = __readfsqword(0x28u); v5 = 1; for (i = 0LL; i < *(_QWORD *)(a1 + 24); ++i) { v14 = *(_QWORD *)(8 * i + *(_QWORD *)(a1 + 16)); v13 = 0LL; v6 = 0; v9 = 0; v10 = 0; for (j = *(_QWORD **)(v14 + 32); j; j = v3) { s1 = (char *)kmod_module_info_get_key(j); value = (char *)kmod_module_info_get_value(j); if (!strcmp(s1, "alias")) { v2 = strlen("devname:"); if (!strncmp(value, "devname:", v2)) { v13 = value + 8; } else if ((unsigned int)_isoc99_sscanf(value, "char-major-%u-%u", &v7, &v8) == 2) { v6 = 99; v9 = v7; v10 = v8; } else if ((unsigned int)_isoc99_sscanf(value, "block-major-%u-%u", &v7, &v8) == 2) { v6 = 98; v9 = v7; v10 = v8; } if (v6 && v13) break; } if (*j == *(_QWORD *)(v14 + 32)) v3 = 0LL; else v3 = (_QWORD *)*j; } if (v13) { if (v6) { if (v5) { fputs("# Device nodes to trigger on-demand module loading.\n", a2); v5 = 0; } fprintf(a2, "%s %s %c%u:%u\n", (const char *)(v14 + 120), v13, (unsigned int)v6, v9, v10); } else { log_printf(3LL, "Module '%s' has devname (%s) but lacks major and minor " "information. Ignoring.\n", (const char *)(v14 + 120), v13); } } } return 0LL; }
kmod
ida
int BSDgetopt(int nargc, char *const *nargv, const char *options) { return (getopt_internal(nargc, nargv, options, ((void *)0), ((void *)0), 0)); }
long BSDgetopt(int a1, long a2, char *a3) { return getopt_internal(a1, a2, a3, 0LL, 0LL, 0); }
openssh-portable
ida
static void process_crontab(const char *uname, const char *fname, const char *tabname, cron_db *new_db, cron_db *old_db) { struct passwd *pw = ((void *)0); int crontab_fd = -1; user *u = ((void *)0); time_t mtime; int crond_crontab = (fname == ((void *)0)) && (strcmp(tabname, "/usr/local/etc/crontab") != 0); if (fname == ((void *)0)) { fname = "*system*"; } else if ((pw = getpwnam(uname)) == ((void *)0)) { log_it(uname, getpid(), "ORPHAN", "no passwd entry", 0); add_orphan(uname, fname, tabname); goto next_crontab; } if ((crontab_fd = check_open(tabname, uname, pw, &mtime)) == -1) goto next_crontab; mtime = ((new_db->mtime) < (mtime) ? (new_db->mtime) : (mtime)); if ((DebugFlags & (0x0010)) != 0) printf("\t%s:", fname); if (old_db != ((void *)0)) u = find_user(old_db, fname, crond_crontab ? tabname : ((void *)0)); if (u != ((void *)0)) { if (u->mtime == mtime) { if ((DebugFlags & (0x0010)) != 0) printf(" [no change, using old data]"); unlink_user(old_db, u); link_user(new_db, u); goto next_crontab; } if ((DebugFlags & (0x0010)) != 0) printf(" [delete old data]"); unlink_user(old_db, u); free_user(u); log_it(fname, getpid(), "RELOAD", tabname, 0); } u = load_user(crontab_fd, pw, uname, fname, tabname); crontab_fd = -1; if (u != ((void *)0)) { u->mtime = mtime; link_user(new_db, u); } next_crontab: if (crontab_fd != -1) { if ((DebugFlags & (0x0010)) != 0) printf(" [done]\n"); close(crontab_fd); } }
void process_crontab(char *param_1, char *param_2, char *param_3, long param_4, long param_5) { bool bVar1; int iVar2; __pid_t _Var3; char *pcVar4; long in_FS_OFFSET; char *local_48; int local_30; long local_28; passwd *local_20; long local_18; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); local_20 = (passwd *)0x0; local_30 = -1; local_18 = 0; if ((param_2 == (char *)0x0) && (iVar2 = strcmp(param_3, "/usr/local/etc/crontab"), iVar2 != 0)) { bVar1 = true; } else { bVar1 = false; } if (param_2 == (char *)0x0) { local_48 = "*system*"; } else { local_20 = getpwnam(param_1); local_48 = param_2; if (local_20 == (passwd *)0x0) { _Var3 = getpid(); log_it(param_1, _Var3, "ORPHAN", "no passwd entry", 0); add_orphan(param_1, param_2, param_3); goto LAB_001008bb; } } local_30 = check_open(param_3, param_1, local_20, &local_28); if (local_30 != -1) { if (*(long *)(param_4 + 0x10) <= local_28) { local_28 = *(long *)(param_4 + 0x10); } if ((DebugFlags & 0x10) != 0) { printf("\t%s:", local_48); } if (param_5 != 0) { pcVar4 = param_3; if (!bVar1) { pcVar4 = (char *)0x0; } local_18 = find_user(param_5, local_48, pcVar4); } if (local_18 != 0) { if (*(long *)(local_18 + 0x20) == local_28) { if ((DebugFlags & 0x10) != 0) { printf(" [no change, using old data]"); } unlink_user(param_5, local_18); link_user(param_4, local_18); goto LAB_001008bb; } if ((DebugFlags & 0x10) != 0) { printf(" [delete old data]"); } unlink_user(param_5, local_18); free_user(local_18); _Var3 = getpid(); log_it(local_48, _Var3, "RELOAD", param_3, 0); } local_18 = load_user(local_30, local_20, param_1, local_48, param_3); local_30 = -1; if (local_18 != 0) { *(long *)(local_18 + 0x20) = local_28; link_user(param_4, local_18); } } LAB_001008bb: if (local_30 != -1) { if ((DebugFlags & 0x10) != 0) { printf(" [done]\n"); } close(local_30); } if (local_10 == *(long *)(in_FS_OFFSET + 0x28)) { return; } __stack_chk_fail(); }
cronie
ghidra
static void print_explain(FILE *f) { fprintf(f, "Usage: ... ipoib [ pkey PKEY ]\n" " [ mode {datagram | connected} ]\n" " [ umcast {0|1} ]\n" "\n" "PKEY := 0x8001-0xffff\n"); }
void print_explain(void *a0) { unsigned long long v1; v1 = fprintf( a0, "Usage: ... ipoib [ pkey PKEY ]\n\t\t [ mode {datagram | connected} " "]\n\t\t [ umcast {0|1} ]\n\nPKEY := 0x8001-0xffff\n"); return; }
iproute2-6.0.0
angr_sailr
char *cond_expand_word(w, special) WORD_DESC *w; int special; { char *r, *p; WORD_LIST *l; int qflags; if (w->word == 0 || w->word[0] == '\0') return ((char *)((void *)0)); expand_no_split_dollar_star = 1; w->flags |= (1 << 6); qflags = (special == 3) ? 0x100 : 0; l = call_expand_word_internal(w, qflags, 0, (int *)0, (int *)0); expand_no_split_dollar_star = 0; if (l) { if (special == 0) { if (l->word) word_list_remove_quoted_nulls(l); dequote_list(l); r = string_list(l); } else if (special == 3) { if (l->word) word_list_remove_quoted_nulls(l); dequote_list(l); r = string_list(l); } else { qflags = 0x01 | 0x08; if (special == 2) qflags |= 0x04; word_list_remove_quoted_nulls(l); p = string_list(l); r = quote_string_for_globbing(p, qflags); sh_xfree((p), "subst.c", 4148); } dispose_words(l); } else r = (char *)((void *)0); return r; }
long long cond_expand_word(struct_0 *a0, unsigned long a1) { unsigned int v0; unsigned long v1; struct_2 *v2; unsigned long long v3; void *v5; unsigned int v6; if (a0->field_0 && a0->field_0->field_0) { expand_no_split_dollar_star = 1; a0->field_8 = a0->field_8 | 64; if (a1 == 3) v6 = 0x100; else v6 = 0; v0 = v6; v2 = call_expand_word_internal(a0, v0, 0x0, 0x0, 0x0); expand_no_split_dollar_star = 0; if (v2) { if (!a1) { if (v2->field_8) word_list_remove_quoted_nulls(v2); dequote_list(v2); v1 = string_list(v2); } else if (a1 == 3) { if (v2->field_8) word_list_remove_quoted_nulls(v2); dequote_list(v2); v1 = string_list(v2); } else { v0 = 9; if (a1 == 2) v0 |= 4; word_list_remove_quoted_nulls(v2); v3 = string_list(v2); v1 = quote_string_for_globbing(v3, v0, v0); sh_xfree(v3, "subst.c", 0x1034); } dispose_words(v2); } else { v1 = 0; } v5 = v1; } if (!a0->field_0 || !a0->field_0->field_0) v5 = 0; return v5; }
bash
angr_dream
static void display_settings(enum output_type output_type, struct termios *mode, char const *device_name) { switch (output_type) { case changed: display_changed(mode); break; case all: display_all(mode, device_name); break; case recoverable: display_recoverable(mode); break; } }
void display_settings(unsigned long a0, unsigned long long a1, unsigned long long a2) { unsigned long long v1; unsigned long long v2; unsigned long long v3; if (a0 == 2) { v1 = display_recoverable(a1); } else if (a0 <= 2) { if (!a0) { v2 = display_changed(a1); } else if (a0 == 1) { v3 = display_all(a1, a2); } } return; }
coreutils
angr_phoenix
static int optloc_eq(struct option_locus *a, struct option_locus *b) { if (a->source != b->source) return 0; if (a->source == OPTS_COMMAND_LINE) return 1; return strcmp(a->name, b->name) == 0; }
bool optloc_eq(int *param_1, int *param_2) { int iVar1; bool bVar2; if (*param_1 == *param_2) { if (*param_1 == 1) { bVar2 = true; } else { iVar1 = strcmp(*(char **)(param_1 + 2), *(char **)(param_2 + 2)); bVar2 = iVar1 == 0; } } else { bVar2 = false; } return bVar2; }
tar
ghidra
static const char *diversion_current(const char *filename) { static struct varbuf str = {0, 0, ((void *)0)}; if (opt_pkgname_match_any) { varbuf_reset(&str); if (opt_divertto == ((void *)0)) varbuf_printf(&str, gettext("any diversion of %s"), filename); else varbuf_printf(&str, gettext("any diversion of %s to %s"), filename, opt_divertto); } else { return varbuf_diversion(&str, opt_pkgname, filename, opt_divertto); } return str.buf; }
long diversion_current(long a1) { char *v1; long v2; char *v3; char *v4; long v5; if (!opt_pkgname_match_any) return varbuf_diversion((long)&str_4978, (long)opt_pkgname, a1, (long)opt_divertto); varbuf_reset(&str_4978); if (opt_divertto) { v3 = opt_divertto; v4 = gettext("any diversion of %s to %s"); varbuf_printf(&str_4978, v4, a1, v3, v5); } else { v1 = gettext("any diversion of %s"); varbuf_printf(&str_4978, v1, a1, v1, v2); } return qword_1DF0; }
dpkg
ida
static void warn_changed_key(struct sshkey *host_key) { char *fp; fp = sshkey_fingerprint(host_key, options.fingerprint_hash, SSH_FP_DEFAULT); if (fp == ((void *)0)) sshfatal("sshconnect.c", __func__, 1622, 1, SYSLOG_LEVEL_FATAL, ((void *)0), "sshkey_fingerprint fail"); sshlog("sshconnect.c", __func__, 1624, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"); sshlog("sshconnect.c", __func__, 1625, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @"); sshlog("sshconnect.c", __func__, 1626, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"); sshlog("sshconnect.c", __func__, 1627, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!"); sshlog("sshconnect.c", __func__, 1628, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "Someone could be eavesdropping on you right now (man-in-the-middle " "attack)!"); sshlog("sshconnect.c", __func__, 1629, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "It is also possible that a host key has just been changed."); sshlog("sshconnect.c", __func__, 1630, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "The fingerprint for the %s key sent by the remote host is\n%s.", sshkey_type(host_key), fp); sshlog("sshconnect.c", __func__, 1632, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "Please contact your system administrator."); free(fp); }
void warn_changed_key(unsigned long long a0) { unsigned long long v0; unsigned long v1; unsigned long long v2; unsigned long long v3; unsigned long long v5; unsigned long long v6; v0 = a0; v2 = sshkey_fingerprint(v0, *(5248728), 0x0, *(5248728)); if (!v2) sshfatal("sshconnect.c", "warn_changed_key", 0x656, 0x1, 0x1, 0x0, "sshkey_fingerprint fail"); v2 = "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"; sshlog("sshconnect.c", "warn_changed_key", 0x658, 0x0, 0x2, 0x0, *(&v3)); v3 = "@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @"; sshlog("sshconnect.c", "warn_changed_key", 0x659, 0x0, 0x2, 0x0, "@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @"); v3 = "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"; sshlog("sshconnect.c", "warn_changed_key", 0x65a, 0x0, 0x2, 0x0, "@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@"); v3 = "IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!"; sshlog("sshconnect.c", "warn_changed_key", 0x65b, 0x0, 0x2, 0x0, "IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!"); v3 = "Someone could be eavesdropping on you right now (man-in-the-middle " "attack)!"; sshlog("sshconnect.c", "warn_changed_key", 0x65c, 0x0, 0x2, 0x0, "Someone could be eavesdropping on you right now (man-in-the-middle " "attack)!"); v3 = "It is also possible that a host key has just been changed."; sshlog("sshconnect.c", "warn_changed_key", 0x65d, 0x0, 0x2, 0x0, "It is also possible that a host key has just been changed."); v2 = v2; v1 = sshkey_type(v0); v0 = "The fingerprint for the %s key sent by the remote host is\n%s."; sshlog("sshconnect.c", "warn_changed_key", 0x65e, 0x0, 0x2, 0x0, "It is also possible that a host key has just been changed."); v5 = "Please contact your system administrator."; sshlog("sshconnect.c", "warn_changed_key", 0x660, 0x0, 0x2, 0x0, "It is also possible that a host key has just been changed."); v6 = free(v2); return; }
openssh-portable
angr_sailr
static inline void inet_prefix_reset(inet_prefix *p) { p->flags = 0; }
void inet_prefix_reset(unsigned short *a0) { char v0; unsigned short *v2; unsigned long long v3; v2 = a0; *(a0) = 0; v3 = *(&v0); return; }
iproute2-6.0.0
angr_dream
static void read_timespec(FILE *fp, struct timespec *pval) { intmax_t s, ns; if (read_num( fp, "sec", ((time_t)~( (time_t)(!(!((time_t)0 < (time_t)-1)) ? (time_t)-1 : ((((time_t)1 << ((sizeof(time_t) * 8) - 2)) - 1) * 2 + 1)))), ((time_t)(!(!((time_t)0 < (time_t)-1)) ? (time_t)-1 : ((((time_t)1 << ((sizeof(time_t) * 8) - 2)) - 1) * 2 + 1))), &s) && read_num(fp, "nsec", 0, BILLION - 1, &ns)) { pval->tv_sec = s; pval->tv_nsec = ns; } else { do { if (error_hook) error_hook(); error(0, 0, "%s: %s", quotearg_colon(listed_incremental_option), gettext("Unexpected EOF in snapshot file")); fatal_exit(); } while (0) ; } }
void read_timespec(void *a0, unsigned long long a1[2], unsigned long a2, unsigned long a3, unsigned long a4, unsigned long long a5) { char v0; char v1; unsigned long long v2; unsigned long long *v4; unsigned long long v5; unsigned int v8; unsigned int v9; v2 = v4[5]; if (read_num(a0, 0x404e34, 0x8000000000000000, 0x7fffffffffffffff, &v0) && read_num(a0, 0x404e38, 0x0, 0x3b9ac9ff, &v1)) { a1[0] = *(&v0); a1[1] = *(&v1); v5 = v2 ^ v4[5]; if (!(v2 ^ v4[5])) return; goto LABEL_40313f; } if (error_hook) *(5243072)(); v8 = 0; v9 = 0; error(0x0, 0x0, "%s: %s"); fatal_exit(reg_72, reg_64, "%s: %s", quotearg_colon(listed_incremental_option), gettext("Unexpected EOF in snapshot file"), a5); LABEL_40313f: __stack_chk_fail(); }
tar
angr_phoenix
static void list_entries_who(size_t n, const STRUCT_UTMP *utmp_buf) { unsigned long int entries = 0; char const *separator = ""; while (n--) { if ((((utmp_buf)->ut_user)[0] && (((utmp_buf)->ut_type == (7)) || (0 && ((utmp_buf)->ut_tv.tv_sec) != 0)))) { char *trimmed_name; trimmed_name = extract_trimmed_name(utmp_buf); printf("%s%s", separator, trimmed_name); free(trimmed_name); separator = " "; entries++; } utmp_buf++; } printf(gettext("\n# users=%lu\n"), entries); }
void list_entries_who(unsigned long long a0, unsigned long long a1) { struct_0 *v0; unsigned long long v1; void *v2; unsigned long long v3; void *v4; unsigned long long v6; unsigned long long v7; v1 = a0; v0 = a1; v2 = 0; v3 = &g_401de3; while (true) { v6 = v1; v1 -= 1; if (!v6) break; if (v0->field_2c && v0->field_0 == 7) { v4 = extract_trimmed_name(v0); printf("%s%s", v3, v4); free(v4); v3 = " "; v2 += 1; } v0 = &v0[8].padding_2[22]; } v7 = printf(gettext("\n# users=%lu\n")); return; }
coreutils
angr_phoenix
static void print_wide_uint(wide_uint n, int nesting, unsigned wide_uint_bits) { int hex_digits_per_literal = 7; int bits_per_literal = hex_digits_per_literal * 4; unsigned remainder = n & ((1 << bits_per_literal) - 1); if (n != remainder) { int needs_parentheses = n >> bits_per_literal >> bits_per_literal != 0; if (needs_parentheses) printf("("); print_wide_uint(n >> bits_per_literal, nesting + 1, wide_uint_bits); if (needs_parentheses) printf(")\n%*s", nesting + 3, ""); printf(" << %d | ", bits_per_literal); } else if (nesting) { printf("(uintmax_t) "); hex_digits_per_literal = ((wide_uint_bits - 1) % bits_per_literal) % 4 + 1; } printf("0x%0*xU", hex_digits_per_literal, remainder); }
int print_wide_uint(unsigned __int128 a1, int a2, unsigned int a3) { unsigned int v6; v6 = 7; if (*((_QWORD *)&a1 + 1) | (unsigned long)a1 ^ a1 & 0xFFFFFFF) { if (a1 >> 56 != 0) printf("("); print_wide_uint(a1 >> 28, a2 + 1, a3); if (a1 >> 56 != 0) printf(")\n%*s", a2 + 3, (const char *)&unk_882); printf(" << %d | ", 28LL); } else if (a2) { printf("(uintmax_t) "); v6 = (((a3 - 1) % 0x1C) & 3) + 1; } return printf("0x%0*xU", v6, (unsigned int)a1 & 0xFFFFFFF); }
coreutils
ida
static void sigterm_handler(int sig) { received_sigterm = sig; }
void sigterm_handler(undefined4 param_1) { received_sigterm = param_1; return; }
openssh-portable
ghidra
static unsigned int cols_ready_to_print(void) { COLUMN *q; unsigned int i; unsigned int n; n = 0; for (q = column_vector, i = 0; i < columns; ++q, ++i) if (q->status == OPEN || q->status == FF_FOUND || (storing_columns && q->lines_stored > 0 && q->lines_to_print > 0)) ++n; return n; }
int cols_ready_to_print() { unsigned int v0; unsigned int v1; unsigned int v2[13]; v1 = 0; *(&v2[0]) = column_vector; for (v0 = 0; v0 < columns; v0 += 1) { switch (v2[4]) { case 0: case 1: LABEL_400395: v1 += 1; break; default: if (storing_columns && v2[11] > 0 && v2[12] > 0) goto LABEL_400395; else goto LABEL_400399; } LABEL_400399: *(&v2[0]) = &v2[1 + 3]; } return v1; }
coreutils
angr_sailr
static int valid_length_expression(name) char *name; { return ( name[1] == '\0' || ((sh_syntaxtab[(unsigned char)name[1]] & 0x0800) && name[2] == '\0') || (((name[1]) >= '0' && (name[1]) <= '9') && all_digits(name + 1)) || valid_array_reference(name + 1, 0) || legal_identifier(name + 1)); }
int valid_length_expression(char a0[3]) { unsigned int v1; if (a0[1] && (!(sh_syntaxtab[a0[1]] & 0x800) || a0[2])) { if (a0[1] > 47 && a0[1] <= 57) v1 = all_digits(&a0[1]); if (!v1 || a0[1] <= 47 || a0[1] > 57) { v1 = valid_array_reference(&a0[1], 0x0); if (!v1) { v1 = legal_identifier(&a0[1]); if (!v1) v1 = 0; } } } if (!a0[1] || v1 || v1 || !a0[2] && (sh_syntaxtab[a0[1]] & 0x800) || a0[1] <= 57 && v1 && a0[1] > 47) v1 = 1; return v1; }
bash
angr_dream
static int it_init_stopped(itp) ITEMLIST *itp; { return (it_init_joblist(itp, 1)); }
long long it_init_stopped(unsigned long long a0) { return it_init_joblist(a0, 0x1); }
bash
angr_dream
rsRetVal multiSubmitMsg(multi_submit_t *pMultiSub) { return multiSubmitMsg2(pMultiSub); }
long multiSubmitMsg(long a1) { return multiSubmitMsg2(a1); }
rsyslog-8.2210.0
ida
static int name_cmp(const void *a, const void *b) { const struct hash_entry *he_a = (const struct hash_entry *)a; const struct hash_entry *he_b = (const struct hash_entry *)b; unsigned int he_a_len, he_b_len, min_len; int ret; he_a_len = ext2fs_dirent_name_len(he_a->dir); he_b_len = ext2fs_dirent_name_len(he_b->dir); min_len = he_a_len; if (min_len > he_b_len) min_len = he_b_len; ret = memcmp(he_a->dir->name, he_b->dir->name, min_len); if (ret == 0) { if (he_a_len > he_b_len) ret = 1; else if (he_a_len < he_b_len) ret = -1; else ret = he_b->dir->inode - he_a->dir->inode; } return ret; }
int name_cmp(struct_0 *a0, struct_0 *a1) { unsigned int v0; unsigned int v1; unsigned int v2; unsigned int v3; v2 = ext2fs_dirent_name_len(a0->field_10); v3 = ext2fs_dirent_name_len(a1->field_10); v0 = v2; if (v0 > v3) v0 = v3; v1 = memcmp(a0->field_10 + 2, a1->field_10 + 2, v0); if (!v1) { if (v2 > v3) { v1 = 1; } else if (v2 < v3) { v1 = -1; } else { v1 = a1->field_10->field_0 - a0->field_10->field_0; } } return v1; }
e2fsprogs-1.46.5
angr_phoenix
static int print_spdinfo(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_SPD_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, "SPDinfo: Wrong len %d\n", len); return -1; } rta = ((struct rtattr *)(((char *)(f)) + (((sizeof(__u32)) + 4U - 1) & ~(4U - 1)))); parse_rtattr(tb, (__XFRMA_SPD_MAX - 1), rta, len); fprintf(fp, "\t SPD"); if (tb[XFRMA_SPD_INFO]) { struct xfrmu_spdinfo *si; if (((int)((tb[XFRMA_SPD_INFO])->rta_len) - ((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0))) < sizeof(*si)) { fprintf(stderr, "SPDinfo: Wrong len %d\n", len); return -1; } si = ((void *)(((char *)(tb[XFRMA_SPD_INFO])) + ((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0)))); fprintf(fp, " IN %d", si->incnt); fprintf(fp, " OUT %d", si->outcnt); fprintf(fp, " FWD %d", si->fwdcnt); if (show_stats) { fprintf(fp, " (Sock:"); fprintf(fp, " IN %d", si->inscnt); fprintf(fp, " OUT %d", si->outscnt); fprintf(fp, " FWD %d", si->fwdscnt); fprintf(fp, ")"); } fprintf(fp, "%s", _SL_); } if (show_stats > 1) { struct xfrmu_spdhinfo *sh; if (tb[XFRMA_SPD_HINFO]) { if (((int)((tb[XFRMA_SPD_HINFO])->rta_len) - ((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0))) < sizeof(*sh)) { fprintf(stderr, "SPDinfo: Wrong len %d\n", len); return -1; } sh = ((void *)(((char *)(tb[XFRMA_SPD_HINFO])) + ((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0)))); fprintf(fp, "\t SPD buckets:"); fprintf(fp, " count %d", sh->spdhcnt); fprintf(fp, " Max %d", sh->spdhmcnt); fprintf(fp, "%s", _SL_); } if (tb[XFRMA_SPD_IPV4_HTHRESH]) { struct xfrmu_spdhthresh *th; if (((int)((tb[XFRMA_SPD_IPV4_HTHRESH])->rta_len) - ((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0))) < sizeof(*th)) { fprintf(stderr, "SPDinfo: Wrong len %d\n", len); return -1; } th = ((void *)(((char *)(tb[XFRMA_SPD_IPV4_HTHRESH])) + ((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0)))); fprintf(fp, "\t SPD IPv4 thresholds:"); fprintf(fp, " local %d", th->lbits); fprintf(fp, " remote %d", th->rbits); fprintf(fp, "%s", _SL_); } if (tb[XFRMA_SPD_IPV6_HTHRESH]) { struct xfrmu_spdhthresh *th; if (((int)((tb[XFRMA_SPD_IPV6_HTHRESH])->rta_len) - ((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0))) < sizeof(*th)) { fprintf(stderr, "SPDinfo: Wrong len %d\n", len); return -1; } th = ((void *)(((char *)(tb[XFRMA_SPD_IPV6_HTHRESH])) + ((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0)))); fprintf(fp, "\t SPD IPv6 thresholds:"); fprintf(fp, " local %d", th->lbits); fprintf(fp, " remote %d", th->rbits); fprintf(fp, "%s", _SL_); } } if (oneline) fprintf(fp, "\n"); return 0; }
void print_spdinfo(unsigned int *a0, void *a1) { unsigned int v0; unsigned long v1; unsigned long long v2; unsigned int v3[6]; unsigned int v4[2]; char v5[2]; char v6[2]; char v7; char v8; char v9; char v10; char v11; unsigned long long v13; unsigned long long v14; unsigned long long v15; unsigned long long v16; unsigned long long v17; void *v18; v1 = a0 + 4; v0 = *(a0); v0 -= 20; if (v0 < 0) { fprintf(*(&stderr), "SPDinfo: Wrong len %d\n", v0); v13 = 4294967295; } else { v2 = v1 + 4; parse_rtattr(&v7, 0x4, v2, v0); fprintf(a1, "\t SPD"); if (*(&v8)) { if (*(*(&v8)) - 4 <= 23) { fprintf(*(&stderr), "SPDinfo: Wrong len %d\n", v0); v14 = 4294967295; goto LABEL_403218; } else { *(&v3[0]) = *(&v8) + 4; fprintf(a1, " IN %d", v3[0]); fprintf(a1, " OUT %d", v3[1]); fprintf(a1, " FWD %d", v3[2]); if (show_stats) { fprintf(a1, " (Sock:"); fprintf(a1, " IN %d", v3[3]); fprintf(a1, " OUT %d", v3[4]); fprintf(a1, " FWD %d", v3[5]); fprintf(a1, ")"); } fprintf(a1, "%s", _SL_); } } if (show_stats > 1) { if (*(&v9)) { if (*(*(&v9)) - 4 <= 7) { fprintf(*(&stderr), "SPDinfo: Wrong len %d\n", v0); v15 = 4294967295; goto LABEL_403218; } else { *(&v4[0]) = *(&v9) + 4; fprintf(a1, "\t SPD buckets:"); fprintf(a1, " count %d", v4[0]); fprintf(a1, " Max %d", v4[1]); fprintf(a1, "%s", _SL_); } } if (*(&v10)) { if (*(*(&v10)) - 4 <= 1) { fprintf(*(&stderr), "SPDinfo: Wrong len %d\n", v0); v16 = 4294967295; goto LABEL_403218; } else { *(&v5) = *(&v10) + 4; fprintf(a1, "\t SPD IPv4 thresholds:"); fprintf(a1, " local %d", v5[0]); fprintf(a1, " remote %d", v5[1]); fprintf(a1, "%s", _SL_); } } if (*(&v11)) { if (*(*(&v11)) - 4 <= 1) { fprintf(*(&stderr), "SPDinfo: Wrong len %d\n", v0); v17 = 4294967295; goto LABEL_403218; } else { *(&v6) = *(&v11) + 4; fprintf(a1, "\t SPD IPv6 thresholds:"); fprintf(a1, " local %d", v6[0]); fprintf(a1, " remote %d", v6[1]); fprintf(a1, "%s", _SL_); } } } if (oneline) fprintf(a1, "\n"); v18 = 0; } LABEL_403218: return; }
iproute2-6.0.0
angr_phoenix
VAR_CONTEXT *new_var_context(name, flags) char *name; int flags; { VAR_CONTEXT *vc; vc = (VAR_CONTEXT *)sh_xmalloc((sizeof(VAR_CONTEXT)), "variables.c", 5227); vc->name = name ? (char *)strcpy(sh_xmalloc((1 + strlen(name)), "variables.c", 5228), (name)) : (char *)((void *)0); vc->scope = variable_context; vc->flags = flags; vc->up = vc->down = (VAR_CONTEXT *)((void *)0); vc->table = (HASH_TABLE *)((void *)0); return vc; }
char **new_var_context(char *param_1, undefined4 param_2) { char **ppcVar1; size_t sVar2; char *pcVar3; ppcVar1 = (char **)sh_xmalloc(0x28, "variables.c", 0x146b); if (param_1 == (char *)0x0) { pcVar3 = (char *)0x0; } else { sVar2 = strlen(param_1); pcVar3 = (char *)sh_xmalloc(sVar2 + 1, "variables.c", 0x146c); pcVar3 = strcpy(pcVar3, param_1); } *ppcVar1 = pcVar3; *(undefined4 *)(ppcVar1 + 1) = variable_context; *(undefined4 *)((long)ppcVar1 + 0xc) = param_2; ppcVar1[3] = (char *)0x0; ppcVar1[2] = ppcVar1[3]; ppcVar1[4] = (char *)0x0; return ppcVar1; }
bash
ghidra
static _Bool read_header0(struct tar_stat_info *info) { enum read_header rc; tar_stat_init(info); rc = read_header(&current_header, info, read_header_auto); if (rc == HEADER_SUCCESS) { set_next_block_after(current_header); return 1; } do { if (error_hook) error_hook(); error(0, 0, gettext("This does not look like a tar archive")); exit_status = 2; } while (0); return 0; }
int read_header0(unsigned long long a0) { unsigned int v0; unsigned int v2; tar_stat_init(a0); v0 = read_header(0x500350, a0, 0x0); if (v0 == 1) { set_next_block_after(current_header); v2 = 1; } else { if (error_hook) *(5243096)(); error(0x0, 0x0, gettext("This does not look like a tar archive")); exit_status = 2; v2 = 0; } return v2; }
tar
angr_phoenix
static void gl_linked_list_free(gl_list_t list) { gl_listelement_dispose_fn dispose = list->base.dispose_fn; gl_list_node_t node; for (node = list->root.next; node != &list->root;) { gl_list_node_t next = node->next; if (dispose != ((void *)0)) dispose(node->value); free(node); node = next; } free(list); }
long long gl_linked_list_free(unsigned long long a0[6]) { unsigned long long v0[3]; unsigned long v1; void *v2; v1 = a0[3]; for (v0[0] = a0[5]; v0 != &a0[5]; v0[0] = v2) { v2 = v0[0]; if (v1) (stack_base)[24](v0[2]); free(v0); } return free(a0); }
gnutls
angr_phoenix
static void compressedStreamEOF(void) { if (noisy) { fprintf(stderr, "\n%s: Compressed file ends unexpectedly;\n\t" "perhaps it is corrupted? *Possible* reason follows.\n", progName); perror(progName); showFileNames(); cadvise(); } cleanUpAndFail(2); }
void compressedStreamEOF() { if (noisy) { fprintf(stderr, "\n%s: Compressed file ends unexpectedly;\n\tperhaps it is " "corrupted? *Possible* reason follows.\n", progName); perror(progName); showFileNames(); cadvise(); } cleanUpAndFail(0x2); }
bzip2
angr_phoenix
int get_code_sign_status(void) { if (batch) { return cfg.code_sign_key; } else { return read_yesno("Will the certificate be used to sign code? (y/N): ", 0); } }
long long get_code_sign_status() { unsigned long long v1; if (*(got.batch)) { v1 = *((got.cfg + 584)); return v1; } v1 = read_yesno("Will the certificate be used to sign code? (y/N): ", 0x0); return v1; }
gnutls
angr_sailr
static void vlan_print_flags(FILE *fp, __u32 flags) { open_json_array(PRINT_ANY, is_json_context() ? "flags" : "<"); if (flags & VLAN_FLAG_REORDER_HDR) { flags &= ~VLAN_FLAG_REORDER_HDR; print_string(PRINT_ANY, ((void *)0), flags ? "%s," : "%s", "REORDER_HDR"); }; if (flags & VLAN_FLAG_GVRP) { flags &= ~VLAN_FLAG_GVRP; print_string(PRINT_ANY, ((void *)0), flags ? "%s," : "%s", "GVRP"); }; if (flags & VLAN_FLAG_MVRP) { flags &= ~VLAN_FLAG_MVRP; print_string(PRINT_ANY, ((void *)0), flags ? "%s," : "%s", "MVRP"); }; if (flags & VLAN_FLAG_LOOSE_BINDING) { flags &= ~VLAN_FLAG_LOOSE_BINDING; print_string(PRINT_ANY, ((void *)0), flags ? "%s," : "%s", "LOOSE_BINDING"); }; if (flags & VLAN_FLAG_BRIDGE_BINDING) { flags &= ~VLAN_FLAG_BRIDGE_BINDING; print_string(PRINT_ANY, ((void *)0), flags ? "%s," : "%s", "BRIDGE_BINDING"); }; if (flags) print_hex(PRINT_ANY, ((void *)0), "%x", flags); close_json_array(PRINT_ANY, "> "); }
long vlan_print_flags(long a1, unsigned int a2) { const char *v2; const char *v3; const char *v4; const char *v5; const char *v6; const char *v7; unsigned int v9; v9 = a2; if ((unsigned char)is_json_context()) v2 = "flags"; else v2 = "<"; open_json_array(4LL, v2); if ((a2 & 1) != 0) { v9 = a2 & 0xFFFFFFFE; if ((a2 & 0xFFFFFFFE) != 0) v3 = "%s,"; else v3 = "%s"; print_string(4u, 0LL, (long)v3, (long)"REORDER_HDR"); } if ((v9 & 2) != 0) { v9 &= ~2u; if (v9) v4 = "%s,"; else v4 = "%s"; print_string(4u, 0LL, (long)v4, (long)"GVRP"); } if ((v9 & 8) != 0) { v9 &= ~8u; if (v9) v5 = "%s,"; else v5 = "%s"; print_string(4u, 0LL, (long)v5, (long)"MVRP"); } if ((v9 & 4) != 0) { v9 &= ~4u; if (v9) v6 = "%s,"; else v6 = "%s"; print_string(4u, 0LL, (long)v6, (long)"LOOSE_BINDING"); } if ((v9 & 0x10) != 0) { v9 &= ~0x10u; if (v9) v7 = "%s,"; else v7 = "%s"; print_string(4u, 0LL, (long)v7, (long)"BRIDGE_BINDING"); } if (v9) print_hex(4u, 0LL, (long)"%x", v9); return close_json_array(4LL, "> "); }
iproute2-6.0.0
ida
static int ipvlan_parse_opt(struct link_util *lu, int argc, char **argv, struct nlmsghdr *n) { __u16 flags = 0; _Bool mflag_given = 0; while (argc > 0) { if (matches(*argv, "mode") == 0) { __u16 mode = 0; do { argv++; if (--argc <= 0) incomplete_command(); } while (0); if (strcmp(*argv, "l2") == 0) mode = IPVLAN_MODE_L2; else if (strcmp(*argv, "l3") == 0) mode = IPVLAN_MODE_L3; else if (strcmp(*argv, "l3s") == 0) mode = IPVLAN_MODE_L3S; else { fprintf(stderr, "Error: argument of \"mode\" must be either \"l2\", " "\"l3\" or \"l3s\"\n"); return -1; } addattr16(n, 1024, IFLA_IPVLAN_MODE, mode); } else if (matches(*argv, "private") == 0 && !mflag_given) { flags |= 0x01; mflag_given = 1; } else if (matches(*argv, "vepa") == 0 && !mflag_given) { flags |= 0x02; mflag_given = 1; } else if (matches(*argv, "bridge") == 0 && !mflag_given) { mflag_given = 1; } else if (matches(*argv, "help") == 0) { print_explain(lu, stderr); return -1; } else { fprintf(stderr, "%s: unknown option \"%s\"?\n", lu->id, *argv); print_explain(lu, stderr); return -1; } argc--; argv++; } addattr16(n, 1024, IFLA_IPVLAN_FLAGS, flags); return 0; }
long long ipvlan_parse_opt(void *a0, unsigned long a1, unsigned long a2, unsigned long long a3) { unsigned long long *v0; unsigned int v1; char v2; unsigned short v3; unsigned short v4; unsigned long long v12; v1 = a1; v0 = a2; v3 = 0; v2 = 0; while (true) { if (v1 <= 0) { addattr16(a3, 0x400, 0x2, v3); v12 = 0; break; } if ((matches(*(v0), "mode") ^ 1)) { v4 = 0; v0 += 1; v1 -= 1; if (v1 <= 0) incomplete_command(); if (!strcmp(*(v0), "l2")) { v4 = 0; } else if (!strcmp(*(v0), "l3")) { v4 = 1; } else if (!strcmp(*(v0), "l3s")) { v4 = 2; } else { fprintf(*(&stderr), "Error: argument of \"mode\" must be either " "\"l2\", \"l3\" or \"l3s\"\n"); v12 = 4294967295; break; } addattr16(a3, 0x400, 0x1, v4); goto LABEL_4002e7; } if ((matches(*(v0), "private") ^ 1) && (v2 ^ 1)) { v3 |= 1; v2 = 1; goto LABEL_4002e7; } if ((matches(*(v0), "vepa") ^ 1) && (v2 ^ 1)) { v3 |= 2; v2 = 1; goto LABEL_4002e7; } if (!(matches(*(v0), "bridge") ^ 1)) { LABEL_400266: if ((matches(*(v0), "help") ^ 1)) { print_explain(a0, *(&stderr)); v12 = 4294967295; break; } else { fprintf(*(&stderr), "%s: unknown option \"%s\"?\n", a0[8], *(v0)); print_explain(a0, *(&stderr)); v12 = 4294967295; break; } } else { if (!(v2 ^ 1)) goto LABEL_400266; v2 = 1; LABEL_4002e7: v1 -= 1; v0 += 1; } } return v12; }
iproute2-6.0.0
angr_phoenix
static _Bool do_parse_xmin(const struct parser_table *entry, char **argv, int *arg_ptr, enum xval xv) { const char *minutes; const int saved_argc = *arg_ptr; if (collect_arg(argv, arg_ptr, &minutes)) { struct time_val tval; struct timespec origin = options.cur_day_start; tval.xval = xv; origin.tv_sec += 86400; if (get_relative_timestamp(minutes, &tval, origin, 60, "arithmetic overflow while converting %s " "minutes to a number of seconds")) { struct predicate *our_pred = insert_primary(entry, minutes); our_pred->args.reftime = tval; our_pred->est_success_rate = estimate_timestamp_success_rate(tval.ts.tv_sec); return 1; } else { *arg_ptr = saved_argc; } } return 0; }
long do_parse_xmin(long a1, long a2, int *a3, int a4) { unsigned int (*v4)(long); __m128i v5; _QWORD *inserted; long v7; int v11; long v12; _QWORD *v13; unsigned int (*v14)(long); unsigned int (*v15)(long); long v16; long v17; long v18; unsigned long v19; v19 = __readfsqword(0x28u); v11 = *a3; if ((unsigned char)collect_arg(a2, a3, &v12)) { v4 = options[6]; v14 = options[5]; v15 = v4; LODWORD(v16) = a4; v14 = (unsigned int (*)(long))((char *)v14 + 86400); v5 = (__m128i)0x404E000000000000uLL; if ((unsigned char)get_relative_timestamp( v12, (long)&v16, (long)v14, (int)v4, "arithmetic overflow while converting %s minutes to a number of " "seconds", 60.0)) { inserted = (_QWORD *)insert_primary(a1, v12); v13 = inserted; v7 = v17; inserted[7] = v16; inserted[8] = v7; inserted[9] = v18; *(float *)v5.m128i_i32 = estimate_timestamp_success_rate(v17); *((_DWORD *)v13 + 9) = _mm_cvtsi128_si32(v5); return 1LL; } *a3 = v11; } return 0LL; }
findutils
ida
void handler(int sig) { got_signal = sig; }
long long handler(unsigned long a0) { got_signal = a0; return a0; }
sysvinit
angr_dream
static _Bool insert_type(char **argv, int *arg_ptr, const struct parser_table *entry, PRED_FUNC which_pred) { struct predicate *our_pred; const char *typeletter; const char *pred_string = which_pred == pred_xtype ? "-xtype" : "-type"; if (!collect_arg(argv, arg_ptr, &typeletter)) return 0; if (!*typeletter) { ((!!sizeof(struct { _Static_assert(1, "verify_expr (" "1" ", " "(error (1, 0, gettext (\"Arguments to %s should contain " "at least one letter\"), pred_string), assume (false))" ")"); int _gl_dummy; })) ? ((error( 1, 0, gettext("Arguments to %s should contain at least one letter"), pred_string), ((0) ? (void)0 : __builtin_unreachable()))) : ((error( 1, 0, gettext("Arguments to %s should contain at least one letter"), pred_string), ((0) ? (void)0 : __builtin_unreachable())))) ; return 0; } our_pred = insert_primary_withpred(entry, which_pred, typeletter); our_pred->est_success_rate = 0.0; if (which_pred == pred_xtype) { our_pred->need_stat = 1; our_pred->need_type = 0; } else { our_pred->need_stat = 0; our_pred->need_type = 1; } for (; *typeletter;) { unsigned int type_cell; float rate = 0.01; switch (*typeletter) { case 'b': type_cell = FTYPE_BLK; rate = 0.000888f; break; case 'c': type_cell = FTYPE_CHR; rate = 0.000443f; break; case 'd': type_cell = FTYPE_DIR; rate = 0.0922f; break; case 'f': type_cell = FTYPE_REG; rate = 0.875f; break; case 'l': type_cell = FTYPE_LNK; rate = 0.0311f; break; case 'p': type_cell = FTYPE_FIFO; rate = 7.554e-6f; break; case 's': type_cell = FTYPE_SOCK; rate = 1.59e-5f; break; case 'D': type_cell = 0; ((!!sizeof(struct { _Static_assert( 1, "verify_expr (" "1" ", " "(error (1, 0, gettext (\"%s %c is not supported because " "Solaris doors \" \"are not supported on the platform find was " "compiled on.\"), pred_string, (*typeletter)), assume (false))" ")"); int _gl_dummy; })) ? ((error(1, 0, gettext("%s %c is not supported because Solaris doors " "are not supported on the platform find was " "compiled on."), pred_string, (*typeletter)), ((0) ? (void)0 : __builtin_unreachable()))) : ((error(1, 0, gettext("%s %c is not supported because Solaris doors " "are not supported on the platform find was " "compiled on."), pred_string, (*typeletter)), ((0) ? (void)0 : __builtin_unreachable())))) ; break; default: type_cell = 0; ((!!sizeof(struct { _Static_assert(1, "verify_expr (" "1" ", " "(error (1, 0, gettext (\"Unknown argument to %s: " "%c\"), pred_string, (*typeletter)), assume (false))" ")"); int _gl_dummy; })) ? ((error(1, 0, gettext("Unknown argument to %s: %c"), pred_string, (*typeletter)), ((0) ? (void)0 : __builtin_unreachable()))) : ((error(1, 0, gettext("Unknown argument to %s: %c"), pred_string, (*typeletter)), ((0) ? (void)0 : __builtin_unreachable())))); return 0; } if (our_pred->args.types[type_cell]) { ((!!sizeof(struct { _Static_assert( 1, "verify_expr (" "1" ", " "(error (1, 0, gettext (\"Duplicate file type '%c' in the argument " "list to %s.\"), (*typeletter), pred_string), assume (false))" ")"); int _gl_dummy; })) ? ((error( 1, 0, gettext( "Duplicate file type '%c' in the argument list to %s."), (*typeletter), pred_string), ((0) ? (void)0 : __builtin_unreachable()))) : ((error( 1, 0, gettext( "Duplicate file type '%c' in the argument list to %s."), (*typeletter), pred_string), ((0) ? (void)0 : __builtin_unreachable())))) ; } our_pred->est_success_rate += rate; our_pred->args.types[type_cell] = 1; typeletter++; if (*typeletter) { if (*typeletter != ',') { ((!!sizeof(struct { _Static_assert( 1, "verify_expr (" "1" ", " "(error (1, 0, gettext (\"Must separate multiple arguments to " "%s using: ','\"), pred_string), assume (false))" ")"); int _gl_dummy; })) ? ((error(1, 0, gettext( "Must separate multiple arguments to %s using: ','"), pred_string), ((0) ? (void)0 : __builtin_unreachable()))) : ((error(1, 0, gettext( "Must separate multiple arguments to %s using: ','"), pred_string), ((0) ? (void)0 : __builtin_unreachable())))) ; return 0; } typeletter++; if (!*typeletter) { ((!!sizeof(struct { _Static_assert(1, "verify_expr (" "1" ", " "(error (1, 0, gettext (\"Last file type in list " "argument to %s \" \"is missing, i.e., list is " "ending on: ','\"), pred_string), assume (false))" ")"); int _gl_dummy; })) ? ((error(1, 0, gettext("Last file type in list argument to %s " "is missing, i.e., list is ending on: ','"), pred_string), ((0) ? (void)0 : __builtin_unreachable()))) : ((error(1, 0, gettext("Last file type in list argument to %s " "is missing, i.e., list is ending on: ','"), pred_string), ((0) ? (void)0 : __builtin_unreachable())))) ; return 0; } } } return 1; }
void insert_type(unsigned long long *a0, unsigned int *a1, unsigned long long a2, unsigned long long a3) { unsigned int v0; unsigned int v1; char *v2; unsigned long long v3; struct_1 *v4; unsigned long long v6; void *v7; unsigned long long v8; if (a3 == got.pred_xtype) v6 = "-xtype"; else v6 = "-type"; v3 = v6; *(&v6) = collect_arg(a0, a1, &v2) ^ 1; if (v6) { v7 = 0; } else if (!*(v2)) { error(0x1, 0x0, gettext("Arguments to %s should contain at least one letter")); } else { v4 = insert_primary_withpred(a2, a3, v2, a3); v4->field_24 = 0; if (a3 == got.pred_xtype) { v4->field_1a = 1; v4->field_1b = 0; } else { v4->field_1a = 0; v4->field_1b = 1; } while (true) { if (*(v2)) { v1 = 4575657222417405706; switch (*(v2)) { case 68: v0 = 0; error(0x1, 0x0, gettext("%s %c is not supported because Solaris doors are not " "supported on the platform find was compiled on.")); case 98: v0 = 0; v1 = 4172658121722349740; break; case 99: v0 = 1; v1 = 4448662920702214772; break; case 100: v0 = 2; v1 = 4566650023189467995; break; case 102: v0 = 3; v1 = 0x3cfec56d3f600000; break; case 108: v0 = 4; v1 = 3962455593301493101; break; case 112: v0 = 5; v1 = 4000710484654127198; break; case 115: v0 = 6; v1 = 931487997; break; default: v0 = 0; error(0x1, 0x0, gettext("Unknown argument to %s: %c")); } if (v4[1].padding_0[16 + v0]) error( 0x1, 0x0, gettext("Duplicate file type '%c' in the argument list to %s.")); v4->field_24 = v4->field_24 + v1; v4[1].padding_0[16 + v0] = 1; v2 += 1; if (!*(v2)) continue; if (*(v2) != 44) error(0x1, 0x0, gettext("Must separate multiple arguments to %s using: ','")); v2 += 1; if (*(v2)) continue; error(0x1, 0x0, gettext("Last file type in list argument to %s is missing, i.e., " "list is ending on: ','")); } else { v8 = 1; break; } } } if (*(v2) || v6) return; }
findutils
angr_dream
void channel_close_all(struct ssh *ssh) { u_int i; for (i = 0; i < ssh->chanctxt->channels_alloc; i++) if (ssh->chanctxt->channels[i] != ((void *)0)) channel_close_fds(ssh, ssh->chanctxt->channels[i]); }
long long channel_close_all(struct_0 *a0) { unsigned int v0; for (v0 = 0; v0 < a0->field_868->field_8; v0 += 1) { if (*((a0->field_868->field_0 + (v0 << 3)))) channel_close_fds(a0, *((a0->field_868->field_0 + v0 * 8))); } return a0->field_868->field_8; }
openssh-portable
angr_sailr
static inline void emit_ancillary_info(char const *program) { struct infomap { char const *program; char const *node; } const infomap[] = { {"[", "test invocation"}, {"coreutils", "Multi-call invocation"}, {"sha224sum", "sha2 utilities"}, {"sha256sum", "sha2 utilities"}, {"sha384sum", "sha2 utilities"}, {"sha512sum", "sha2 utilities"}, {((void *)0), ((void *)0)}}; char const *node = program; struct infomap const *map_prog = infomap; while (map_prog->program && !(strcmp(program, map_prog->program) == 0)) map_prog++; if (map_prog->node) node = map_prog->node; printf (gettext ("\n%s online help: <%s>\n"), "GNU coreutils", "https: char const *lc_messages = setlocale ( 5 , ((void *)0) ); if (lc_messages && strncmp (lc_messages, "" "en_" "", sizeof ("en_") - 1)) { fputs_unlocked (gettext ("Report any translation bugs to " "<https: stdout ) ; } char const *url_program = (strcmp (program, "[") == 0) ? "test" : program; printf (gettext ("Full documentation <%s%s>\n"), "https: printf (gettext ("or available locally via: info '(coreutils) %s%s'\n"), node, node == program ? " invocation" : ""); }
void emit_ancillary_info(char *a0) { unsigned long v0; unsigned long long v1[2]; char *v2; unsigned long v3; unsigned long long v4; unsigned long long v5; unsigned long long v6; unsigned long long v7; unsigned long long v8; unsigned long long v9; unsigned long long v10; unsigned long long v11; unsigned long long v12; unsigned long long v13; unsigned long long v14; unsigned long long v15; void *v16; void *v17; char v18; unsigned long long v23; unsigned long long *v24; unsigned long long v25; v4 = "["; v5 = "test invocation"; v6 = "coreutils"; v7 = "Multi-call invocation"; v8 = "sha224sum"; v9 = "sha2 utilities"; v10 = "sha256sum"; v11 = "sha2 utilities"; v12 = "sha384sum"; v13 = "sha2 utilities"; v14 = "sha512sum"; v15 = "sha2 utilities"; v16 = 0; v17 = 0; v0 = a0; for (v1[0] = &v4; v1[0]; v1[0] = v1 + 1) { if (!strcmp(a0, v1[0])) break; } if (v1[1]) v0 = v1[1]; printf(gettext("\n%s online help: <%s>\n")); v2 = setlocale(0x5, NULL); if (v2 && strncmp(v2, "en_", 0x3)) fputs_unlocked(gettext("Report any translation bugs to <https: if (strcmp(a0, "[")) v23 = a0; else v23 = "test"; v3 = v23; printf(gettext("Full documentation <%s%s>\n")); printf(gettext("or available locally via: info '(coreutils) %s%s'\n")); v25 = *(&v18) ^ v24[5]; return; }
coreutils
angr_dream
int auth_check_authkey_line(struct passwd *pw, struct sshkey *key, char *cp, const char *remote_ip, const char *remote_host, const char *loc, struct sshauthopt **authoptsp) { int want_keytype = sshkey_is_cert(key) ? KEY_UNSPEC : key->type; struct sshkey *found = ((void *)0); struct sshauthopt *keyopts = ((void *)0), *certopts = ((void *)0), *finalopts = ((void *)0); char *key_options = ((void *)0), *fp = ((void *)0); const char *reason = ((void *)0); int ret = -1; if (authoptsp != ((void *)0)) *authoptsp = ((void *)0); if ((found = sshkey_new(want_keytype)) == ((void *)0)) { sshlog("auth2-pubkeyfile.c", __func__, 280, 1, SYSLOG_LEVEL_DEBUG3, ((void *)0), "keytype %d failed", want_keytype); goto out; } if (sshkey_read(found, &cp) != 0) { sshlog("auth2-pubkeyfile.c", __func__, 288, 0, SYSLOG_LEVEL_DEBUG2, ((void *)0), "%s: check options: '%s'", loc, cp); key_options = cp; if (sshkey_advance_past_options(&cp) != 0) { reason = "invalid key option string"; goto fail_reason; } skip_space(&cp); if (sshkey_read(found, &cp) != 0) { sshlog("auth2-pubkeyfile.c", __func__, 297, 0, SYSLOG_LEVEL_DEBUG2, ((void *)0), "%s: advance: '%s'", loc, cp); goto out; } } if ((keyopts = sshauthopt_parse(key_options, &reason)) == ((void *)0)) { sshlog("auth2-pubkeyfile.c", __func__, 303, 0, SYSLOG_LEVEL_DEBUG1, ((void *)0), "%s: bad key options: %s", loc, reason); auth_debug_add("%s: bad key options: %s", loc, reason); goto out; } if (sshkey_is_cert(key)) { if (!sshkey_equal(found, key->cert->signature_key) || !keyopts->cert_authority) goto out; } else { if (!sshkey_equal(found, key) || keyopts->cert_authority) goto out; } if ((fp = sshkey_fingerprint(found, 2, SSH_FP_DEFAULT)) == ((void *)0)) sshfatal("auth2-pubkeyfile.c", __func__, 322, 1, SYSLOG_LEVEL_FATAL, ((void *)0), "fingerprint failed"); sshlog("auth2-pubkeyfile.c", __func__, 324, 0, SYSLOG_LEVEL_DEBUG1, ((void *)0), "%s: matching %s found: %s %s", loc, sshkey_is_cert(key) ? "CA" : "key", sshkey_type(found), fp); if (auth_authorise_keyopts(pw, keyopts, sshkey_is_cert(key), remote_ip, remote_host, loc) != 0) { reason = "Refused by key options"; goto fail_reason; } if (!sshkey_is_cert(key)) { sshlog("auth2-pubkeyfile.c", __func__, 334, 0, SYSLOG_LEVEL_VERBOSE, ((void *)0), "Accepted key %s %s found at %s", sshkey_type(found), fp, loc); finalopts = keyopts; keyopts = ((void *)0); goto success; } if ((certopts = sshauthopt_from_cert(key)) == ((void *)0)) { reason = "Invalid certificate options"; goto fail_reason; } if (auth_authorise_keyopts(pw, certopts, 0, remote_ip, remote_host, loc) != 0) { reason = "Refused by certificate options"; goto fail_reason; } if ((finalopts = sshauthopt_merge(keyopts, certopts, &reason)) == ((void *)0)) goto fail_reason; if (keyopts->cert_principals != ((void *)0) && !match_principals_option(keyopts->cert_principals, key->cert)) { reason = "Certificate does not contain an authorized principal"; goto fail_reason; } if (sshkey_cert_check_authority_now( key, 0, 0, 0, keyopts->cert_principals == ((void *)0) ? pw->pw_name : ((void *)0), &reason) != 0) goto fail_reason; sshlog("auth2-pubkeyfile.c", __func__, 373, 0, SYSLOG_LEVEL_VERBOSE, ((void *)0), "Accepted certificate ID \"%s\" (serial %llu) " "signed by CA %s %s found at %s", key->cert->key_id, (unsigned long long)key->cert->serial, sshkey_type(found), fp, loc) ; success: if (finalopts == ((void *)0)) sshfatal("auth2-pubkeyfile.c", __func__, 381, 1, SYSLOG_LEVEL_FATAL, ((void *)0), "internal error: missing options"); if (authoptsp != ((void *)0)) { *authoptsp = finalopts; finalopts = ((void *)0); } ret = 0; goto out; fail_reason: sshlog("auth2-pubkeyfile.c", __func__, 391, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "%s", reason); auth_debug_add("%s", reason); out: free(fp); sshauthopt_free(keyopts); sshauthopt_free(certopts); sshauthopt_free(finalopts); sshkey_free(found); return ret; }
int auth_check_authkey_line(unsigned long long *a0, struct_0 *a1, unsigned long long a2, unsigned long long a3, unsigned long long a4, unsigned long long a5, unsigned long long v16) { unsigned long long *v0; unsigned long long v1; unsigned int v2; unsigned int v3; unsigned long long v4; void *v5; void *v6; void *v7; void *v8; unsigned long long v9; unsigned long long v10; unsigned long v11; unsigned long v12; unsigned long long v13; unsigned long v14; char v15; v1 = a2; v0 = v16; v3 = (!sshkey_is_cert(a1) ? 14 : a1->field_0); v10 = 0; v5 = 0; v6 = 0; v7 = 0; v8 = 0; v9 = 0; v4 = 0; v2 = -1; if (v0) *(v0) = 0; v10 = sshkey_new(v3); if (!v10) { sshlog("auth2-pubkeyfile.c", "auth_check_authkey_line", 0x118, 0x1, 0x7, 0x0, "keytype %d failed", v3); } else if (!sshkey_read(v10, &v1, &v1)) { LABEL_400be5: v5 = sshauthopt_parse(v8, &v4, &v4); if (!v5) { sshlog("auth2-pubkeyfile.c", "auth_check_authkey_line", 0x12f, 0x0, 0x5, 0x0, "%s: bad key options: %s", a5); auth_debug_add("%s: bad key options: %s", a5, v4); } else if (sshkey_is_cert(a1)) { if (!(sshkey_equal(v10, a1->field_80->field_50, a1->field_80->field_50)) || !(v5[32])) goto LABEL_4010ca; LABEL_400ce0: v9 = sshkey_fingerprint(v10, 0x2, 0x0); if (!v9) sshfatal("auth2-pubkeyfile.c", "auth_check_authkey_line", 0x142, 0x1, 0x1, 0x0); v13 = v9; v12 = sshkey_type(v10); *(&v11) = (!sshkey_is_cert(a1) ? "CA" : "key"); v10 = a5; v9 = "%s: matching %s found: %s %s"; sshlog("auth2-pubkeyfile.c", "auth_check_authkey_line", 0x144, 0x0, 0x5, 0x0, *(&v15), v16); if (!auth_authorise_keyopts(a0, v5, sshkey_is_cert(a1), a3, a4, a5)) { if (sshkey_is_cert(a1)) { v6 = sshauthopt_from_cert(a1); if (!v6) { v4 = "Invalid certificate options"; v14 = v4; v13 = "%s"; sshlog("auth2-pubkeyfile.c", "auth_check_authkey_line", 0x187, 0x0, 0x2, 0x0, *(&v15), v16); auth_debug_add("%s", v4, 0x187); goto LABEL_4010ca; } if (auth_authorise_keyopts(a0, v6, 0x0, a3, a4, a5)) { v4 = "Refused by certificate options"; v14 = v4; v13 = "%s"; sshlog("auth2-pubkeyfile.c", "auth_check_authkey_line", 0x187, 0x0, 0x2, 0x0, *(&v15), v16); auth_debug_add("%s", v4, 0x187); goto LABEL_4010ca; } v7 = sshauthopt_merge(v5, v6, &v4, v6); if (!v7) { v14 = v4; v13 = "%s"; sshlog("auth2-pubkeyfile.c", "auth_check_authkey_line", 0x187, 0x0, 0x2, 0x0, *(&v15), v16); auth_debug_add("%s", v4, 0x187); goto LABEL_4010ca; } if (v5[40] && !match_principals_option(v5[40], a1->field_80)) { v4 = "Certificate does not contain an authorized principal"; v14 = v4; v13 = "%s"; sshlog("auth2-pubkeyfile.c", "auth_check_authkey_line", 0x187, 0x0, 0x2, 0x0, *(&v15), v16); auth_debug_add("%s", v4, 0x187); goto LABEL_4010ca; } else { if (sshkey_cert_check_authority_now(a1, 0x0, 0x0, 0x0, (!v5[40] ? 0 : *(a0)), &v4)) { v14 = v4; v13 = "%s"; sshlog("auth2-pubkeyfile.c", "auth_check_authkey_line", 0x187, 0x0, 0x2, 0x0, *(&v15), v16); auth_debug_add("%s", v4, 0x187); goto LABEL_4010ca; } } } v14 = a5; v13 = v9; v12 = sshkey_type(v10); if (!sshkey_is_cert(a1)) { v11 = "Accepted key %s %s found at %s"; sshlog("auth2-pubkeyfile.c", "auth_check_authkey_line", 0x14e, 0x0, 0x4, 0x0, *(&v15), v16); v7 = v5; v5 = 0; } else { v11 = a1->field_80->field_10; v10 = a1->field_80->field_18; v9 = "Accepted certificate ID \"%s\" (serial %llu) signed by CA %s " "%s found at %s"; sshlog("auth2-pubkeyfile.c", "auth_check_authkey_line", 0x175, 0x0, 0x4, 0x0, *(&v15), v16); } if (!v7) { v13 = "internal error: missing options"; sshfatal("auth2-pubkeyfile.c", "auth_check_authkey_line", 0x17d, 0x1, 0x1, 0x0); } if (v0) { *(v0) = v7; v7 = 0; } v2 = 0; } else { v4 = "Refused by key options"; v14 = v4; v13 = "%s"; sshlog("auth2-pubkeyfile.c", "auth_check_authkey_line", 0x187, 0x0, 0x2, 0x0, *(&v15), v16); auth_debug_add("%s", v4, 0x187); } } else if (sshkey_equal(v10, a1, a1) && !v5[32]) { goto LABEL_400ce0; } } else { sshlog("auth2-pubkeyfile.c", "auth_check_authkey_line", 0x120, 0x0, 0x6, 0x0, "%s: check options: '%s'", a5); v8 = v1; if (sshkey_advance_past_options(&v1)) { v4 = "invalid key option string"; v14 = v4; v13 = "%s"; sshlog("auth2-pubkeyfile.c", "auth_check_authkey_line", 0x187, 0x0, 0x2, 0x0, *(&v15), v16); auth_debug_add("%s", v4, 0x187); } else { skip_space(&v1); if (!sshkey_read(v10, &v1, &v1)) goto LABEL_400be5; sshlog("auth2-pubkeyfile.c", "auth_check_authkey_line", 0x129, 0x0, 0x6, 0x0, "%s: advance: '%s'", a5); } } LABEL_4010ca: free(v9); sshauthopt_free(v5); sshauthopt_free(v6); sshauthopt_free(v7); sshkey_free(v10); return v2; }
openssh-portable
angr_sailr
void addargs(arglist *args, char *fmt, ...) { va_list ap; char *cp; u_int nalloc; int r; __builtin_va_start(ap, fmt); r = vasprintf(&cp, fmt, ap); __builtin_va_end(ap); if (r == -1) sshfatal("misc.c", __func__, 1072, 1, SYSLOG_LEVEL_FATAL, ((void *)0), "argument too long"); nalloc = args->nalloc; if (args->list == ((void *)0)) { nalloc = 32; args->num = 0; } else if (args->num > (256 * 1024)) sshfatal("misc.c", __func__, 1079, 1, SYSLOG_LEVEL_FATAL, ((void *)0), "too many arguments"); else if (args->num >= args->nalloc) sshfatal("misc.c", __func__, 1081, 1, SYSLOG_LEVEL_FATAL, ((void *)0), "arglist corrupt"); else if (args->num + 2 >= nalloc) nalloc *= 2; args->list = xrecallocarray(args->list, args->nalloc, nalloc, sizeof(char *)); args->nalloc = nalloc; args->list[args->num++] = cp; args->list[args->num] = ((void *)0); }
unsigned long addargs(long *a1, const char *a2, long a3, long a4, long a5, long a6, ...) { long v6; unsigned int v7; unsigned int v9; char *ptr; gcc_va_list arg; unsigned long v12; long v13; long v14; long v15; long v16; va_start(arg, a6); v13 = a3; v14 = a4; v15 = a5; v16 = a6; v12 = __readfsqword(0x28u); arg[0].gp_offset = 16; if (vasprintf(&ptr, a2, arg) == -1) sshfatal("misc.c", "addargs", 1072LL, 1LL, 1LL, 0LL, "argument too long"); v9 = *((_DWORD *)a1 + 3); if (*a1) { if (*((_DWORD *)a1 + 2) > 0x40000u) sshfatal("misc.c", "addargs", 1079LL, 1LL, 1LL, 0LL, "too many arguments"); if (*((_DWORD *)a1 + 2) >= *((_DWORD *)a1 + 3)) sshfatal("misc.c", "addargs", 1081LL, 1LL, 1LL, 0LL, "arglist corrupt"); if (v9 <= *((_DWORD *)a1 + 2) + 2) v9 *= 2; } else { v9 = 32; *((_DWORD *)a1 + 2) = 0; } *a1 = xrecallocarray(*a1, *((unsigned int *)a1 + 3), v9, 8LL); *((_DWORD *)a1 + 3) = v9; v6 = *a1; v7 = *((_DWORD *)a1 + 2); *((_DWORD *)a1 + 2) = v7 + 1; *(_QWORD *)(v6 + 8LL * v7) = ptr; *(_QWORD *)(*a1 + 8LL * *((unsigned int *)a1 + 2)) = 0LL; return __readfsqword(0x28u) ^ v12; }
openssh-portable
ida
static _Bool check(char const *file_name, char checkonly) { FILE *fp = xfopen(file_name, "r"); struct buffer buf; struct line temp; size_t alloc = 0; uintmax_t line_number = 0; struct keyfield const *key = keylist; _Bool nonunique = !unique; _Bool ordered = 1; initbuf(&buf, sizeof(struct line), (((merge_buffer_size) > (sort_size)) ? (merge_buffer_size) : (sort_size))); temp.text = ((void *)0); while (fillbuf(&buf, fp, file_name)) { struct line const *line = buffer_linelim(&buf); struct line const *linebase = line - buf.nlines; if (alloc && nonunique <= compare(&temp, line - 1)) { found_disorder: { if (checkonly == 'c') { struct line const *disorder_line = line - 1; uintmax_t disorder_line_number = buffer_linelim(&buf) - disorder_line + line_number; char hr_buf[((((((sizeof(disorder_line_number) * 8) - (!((__typeof__(disorder_line_number))0 < (__typeof__(disorder_line_number))-1))) * 146 + 484) / 485) + (!((__typeof__(disorder_line_number))0 < (__typeof__(disorder_line_number))-1))) + 1)]; fprintf(stderr, gettext("%s: %s:%s: disorder: "), program_name, file_name, umaxtostr(disorder_line_number, hr_buf)); write_line(disorder_line, stderr, gettext("standard error")); } ordered = 0; break; } } while (linebase < --line) if (nonunique <= compare(line, line - 1)) goto found_disorder; line_number += buf.nlines; if (alloc < line->length) { do { alloc *= 2; if (!alloc) { alloc = line->length; break; } } while (alloc < line->length); free(temp.text); temp.text = xmalloc(alloc); } memcpy(temp.text, line->text, line->length); temp.length = line->length; if (key) { temp.keybeg = temp.text + (line->keybeg - line->text); temp.keylim = temp.text + (line->keylim - line->text); } } xfclose(fp, file_name); free(buf.buf); free(temp.text); return ordered; }
long check(char *a1, char a2) { size_t v2; long v3; long v4; char *v5; char *v6; unsigned char v8; _BYTE v9[9]; long v10; unsigned long v11; FILE *v12; long v13; unsigned long v14; long v15; void *ptr[4]; void *v17[2]; long v18; char v19[24]; unsigned long v20; v20 = __readfsqword(0x28u); v12 = xfopen(a1, "r"); v9[8] = 0; v10 = 0LL; v13 = keylist; *(_QWORD *)v9 = unique == 0; v9[0] = unique == 0; v8 = 1; v2 = sort_size; if (sort_size < (unsigned long)merge_buffer_size) v2 = merge_buffer_size; initbuf((long)v17, 32LL, v2); ptr[0] = 0LL; while ((unsigned char)fillbuf(v17, v12, a1)) { v11 = buffer_linelim(v17); v14 = -32 * v18 + v11; if (*(_QWORD *)&v9[1] && v9[0] <= (int)compare((unsigned char **)ptr, (unsigned char **)(v11 - 32))) { LABEL_6: if (a2 == 99) { v15 = ((long)(buffer_linelim(v17) - (v11 - 32)) >> 5) + v10; v3 = umaxtostr(v15, v19); v4 = program_name; v5 = gettext("%s: %s:%s: disorder: "); fprintf(stderr, v5, v4, a1, v3); v6 = gettext("standard error"); write_line((void **)(v11 - 32), stderr, v6); } v8 = 0; break; } while (1) { v11 -= 32LL; if (v11 <= v14) break; if (v9[0] <= (int)compare((unsigned char **)v11, (unsigned char **)(v11 - 32))) goto LABEL_6; } v10 += v18; if (*(_QWORD *)&v9[1] < *(_QWORD *)(v11 + 8)) { while (1) { *(_QWORD *)&v9[1] *= 2LL; if (!*(_QWORD *)&v9[1]) break; if (*(_QWORD *)&v9[1] >= *(_QWORD *)(v11 + 8)) goto LABEL_15; } *(_QWORD *)&v9[1] = *(_QWORD *)(v11 + 8); LABEL_15: free(ptr[0]); ptr[0] = (void *)xmalloc(*(_QWORD *)&v9[1]); } memcpy(ptr[0], *(const void **)v11, *(_QWORD *)(v11 + 8)); ptr[1] = *(void **)(v11 + 8); if (v13) { ptr[2] = (char *)ptr[0] + *(_QWORD *)(v11 + 16) - *(_QWORD *)v11; ptr[3] = (char *)ptr[0] + *(_QWORD *)(v11 + 24) - *(_QWORD *)v11; } } xfclose(v12, a1); free(v17[0]); free(ptr[0]); return v8; }
coreutils
ida
static int evalpipe(union node *n, int flags) { struct job *jp; struct nodelist *lp; int pipelen; int prevfd; int pip[2]; int status = 0; ; pipelen = 0; for (lp = n->npipe.cmdlist; lp; lp = lp->next) pipelen++; flags |= 01; ({ suppressint++; ({ __asm__ __volatile__("" : : : "memory"); }); 0; }); jp = makejob(n, pipelen); prevfd = -1; for (lp = n->npipe.cmdlist; lp; lp = lp->next) { prehash(lp->n); pip[1] = -1; if (lp->next) { if (pipe(pip) < 0) { close(prevfd); sh_error("Pipe call failed"); } } if (forkshell(jp, lp->n, n->npipe.backgnd) == 0) { ({ ({ __asm__ __volatile__("" : : : "memory"); }); if (--suppressint == 0 && intpending) onint(); 0; }); if (pip[1] >= 0) { close(pip[0]); } if (prevfd > 0) { dup2(prevfd, 0); close(prevfd); } if (pip[1] > 1) { dup2(pip[1], 1); close(pip[1]); } evaltreenr(lp->n, flags); } if (prevfd >= 0) close(prevfd); prevfd = pip[0]; close(pip[1]); } if (n->npipe.backgnd == 0) { status = waitforjob(jp); ; } ({ ({ __asm__ __volatile__("" : : : "memory"); }); if (--suppressint == 0 && intpending) onint(); 0; }); return status; }
undefined4 evalpipe(long param_1, uint param_2) { int iVar1; undefined8 uVar2; long in_FS_OFFSET; int local_34; int local_30; undefined4 local_2c; long **local_28; int local_18; int local_14; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); local_2c = 0; local_34 = 0; for (local_28 = *(long ***)(param_1 + 8); local_28 != (long **)0x0; local_28 = (long **)*local_28) { local_34 = local_34 + 1; } suppressint = suppressint + 1; uVar2 = makejob(param_1, local_34); local_30 = -1; for (local_28 = *(long ***)(param_1 + 8); local_28 != (long **)0x0; local_28 = (long **)*local_28) { prehash(local_28[1]); local_14 = -1; if (*local_28 != (long *)0x0) { iVar1 = pipe(&local_18); if (iVar1 < 0) { close(local_30); sh_error("Pipe call failed"); } } iVar1 = forkshell(uVar2, local_28[1], *(undefined4 *)(param_1 + 4)); if (iVar1 == 0) { suppressint = suppressint + -1; if ((suppressint == 0) && (intpending != 0)) { onint(); } if (-1 < local_14) { close(local_18); } if (0 < local_30) { dup2(local_30, 0); close(local_30); } if (1 < local_14) { dup2(local_14, 1); close(local_14); } evaltreenr(local_28[1], param_2 | 1); } if (-1 < local_30) { close(local_30); } local_30 = local_18; close(local_14); } if (*(int *)(param_1 + 4) == 0) { local_2c = waitforjob(uVar2); } suppressint = suppressint + -1; if ((suppressint == 0) && (intpending != 0)) { onint(); } if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) { __stack_chk_fail(); } return local_2c; }
dash-0.5.11+git20210903+057cd650a4ed
ghidra
(r = sshbuf_get_cstring(original, &listen_host, ((void *)0) )) != 0 || (r = sshbuf_get_u32(original, &listen_port)) != 0) { sshlog("channels.c", __func__, 3036, 1, SYSLOG_LEVEL_ERROR, ssh_err(r), "parse"); goto out; }
(local_4c = sshbuf_get_cstring(local_28,&local_38,0), local_4c == 0)) { uVar4 = 0x10a1ae; local_4c = sshbuf_get_u32(local_28, &local_54); if (local_4c == 0) { if (local_54 < 0x10000) { permission_set_add(param_1, 0x101, 2, "<mux>", 0xffffffff, local_38, 0, local_54, param_2, uVar4); local_38 = (void *)0x0; goto LAB_0010a355; } sshlog("channels.c", "channel_proxy_downstream", 0xbe0, 1, 2, 0, "tcpip-forward for %s: bad port %u", local_38, local_54); goto LAB_0010a498; } }
openssh-portable
ghidra
static void advance(_Bool f) { ++pos; if (f && pos >= argc) beyond(); }
void advance(unsigned long a0) { unsigned long long v1; unsigned long long v2; v1 = pos + 1; pos = pos + 1; if (a0) { v2 = argc; if (pos >= argc) beyond(); } if (!a0 || pos < argc) return; }
coreutils
angr_dream
inline void ext2fs_dirent_set_name_len(struct ext2_dir_entry *entry, int len) { entry->name_len = (entry->name_len & 0xff00) | (len & 0xff); }
void ext2fs_dirent_set_name_len(void) { halt_baddata(); }
e2fsprogs-1.46.5
ghidra
static int name2sig(char *name) { if (strcmp(name, "HUP") == 0) return 1; if (strcmp(name, "INT") == 0) return 2; if (strcmp(name, "KILL") == 0) return 9; if (strcmp(name, "QUIT") == 0) return 3; if (strcmp(name, "TERM") == 0) return 15; if (strcmp(name, "USR1") == 0) return 10; if (strcmp(name, "USR2") == 0) return 12; return -1; }
int name2sig(char *a0) { unsigned int v1; v1 = strcmp(a0, "HUP"); if (!v1) { v1 = 1; } else { v1 = strcmp(a0, "INT"); if (!v1) { v1 = 2; } else { v1 = strcmp(a0, "KILL"); if (!v1) { v1 = 9; } else { v1 = strcmp(a0, "QUIT"); if (!v1) { v1 = 3; } else { v1 = strcmp(a0, "TERM"); if (!v1) { v1 = 15; } else { v1 = strcmp(a0, "USR1"); if (!v1) { v1 = 10; } else { v1 = strcmp(a0, "USR2"); if (!v1) v1 = 12; else v1 = -1; } } } } } } return v1; }
openssh-portable
angr_dream
char *env_get(const char *name, char **envp) { size_t len = strlen(name); char *p, *q; while ((p = *envp++) != ((void *)0)) { if (!(q = strchr(p, '='))) continue; if ((size_t)(q - p) == len && !strncmp(p, name, len)) return (q + 1); } return (((void *)0)); }
char *env_get(char *param_1, char **param_2) { char **ppcVar1; char *__s; int iVar2; size_t __n; char *pcVar3; char **local_38; __n = strlen(param_1); local_38 = param_2; do { ppcVar1 = local_38 + 1; __s = *local_38; if (__s == (char *)0x0) { return (char *)0x0; } pcVar3 = strchr(__s, 0x3d); local_38 = ppcVar1; } while (((pcVar3 == (char *)0x0) || ((long)pcVar3 - (long)__s != __n)) || (iVar2 = strncmp(__s, param_1, __n), iVar2 != 0)); return pcVar3 + 1; }
cronie
ghidra
void array_add(element, array) char *element; ARRAY *array; { if (array->sindex + 2 > array->size) array->array = (char **)xrealloc( array->array, (array->size += array->growth_rate) * array->width); array->array[array->sindex++] = element; array->array[array->sindex] = (char *)((void *)0); }
_QWORD *array_add(long a1, long a2) { long v2; int v3; _QWORD *result; if (*(_DWORD *)(a2 + 4) + 1 >= *(_DWORD *)a2) { *(_DWORD *)a2 += *(_DWORD *)(a2 + 12); *(_QWORD *)(a2 + 16) = xrealloc(*(void **)(a2 + 16), *(_DWORD *)(a2 + 8) * *(_DWORD *)a2); } v2 = *(_QWORD *)(a2 + 16); v3 = *(_DWORD *)(a2 + 4); *(_DWORD *)(a2 + 4) = v3 + 1; *(_QWORD *)(v2 + 8LL * v3) = a1; result = (_QWORD *)(*(_QWORD *)(a2 + 16) + 8LL * *(int *)(a2 + 4)); *result = 0LL; return result; }
bash
ida
static int execute_until_command(while_command) WHILE_COM *while_command; { return (execute_while_or_until(while_command, 1)); }
long long execute_until_command(unsigned long long a0) { return execute_while_or_until(a0, 1); }
bash
angr_phoenix
1 , 0, gettext ("invalid suffix %s, contains directory separator"), quote (suffix)), (( 0 ) ? (void) 0 : __builtin_unreachable ())))) ; } x_count = count_consecutive_X_s(template, suffix - template); if (x_count < 3) ((!!sizeof (struct { _Static_assert(1, "verify_expr (" "1" ", " "(error (1, 0, gettext (\"too few X's in template %s\"), " "quote (template)), assume (false))" ")"); int _gl_dummy; })) ? ((error (
void gettext(void) { halt_baddata(); }
coreutils
ghidra
int auth2_update_methods_lists(Authctxt *authctxt, const char *method, const char *submethod) { u_int i, found = 0; sshlog("auth2.c", __func__, 705, 1, SYSLOG_LEVEL_DEBUG3, ((void *)0), "updating methods list after \"%s\"", method); for (i = 0; i < authctxt->num_auth_methods; i++) { if (!remove_method(&(authctxt->auth_methods[i]), method, submethod)) continue; found = 1; if (*authctxt->auth_methods[i] == '\0') { sshlog("auth2.c", __func__, 712, 0, SYSLOG_LEVEL_DEBUG2, ((void *)0), "authentication methods list %d complete", i); return 1; } sshlog("auth2.c", __func__, 715, 0, SYSLOG_LEVEL_DEBUG3, ((void *)0), "authentication methods list %d remaining: \"%s\"", i, authctxt->auth_methods[i]); } if (!found) sshfatal("auth2.c", __func__, 720, 1, SYSLOG_LEVEL_FATAL, ((void *)0), "method not in AuthenticationMethods"); return 0; }
int auth2_update_methods_lists(struct_0 *a0, unsigned long long a1, unsigned long long a2) { unsigned long v0; unsigned long v1; unsigned int v2; unsigned int v3; unsigned int v5; v3 = 0; v1 = a1; sshlog("auth2.c", "auth2_update_methods_lists", 0x2c1, 0x1, 0x7, 0x0, "updating methods list after \"%s\""); for (v2 = 0; v2 < a0->field_48; v2 += 1) { if (remove_method(a0->field_40 + (v2 << 3), a1, a2)) { v3 = 1; if (!*(*((a0->field_40 + (v2 << 3))))) { v1 = v2; sshlog("auth2.c", "auth2_update_methods_lists", 0x2c8, 0x0, 0x6, 0x0, "authentication methods list %d complete"); v5 = 1; return v5; } v0 = v2; sshlog("auth2.c", "auth2_update_methods_lists", 0x2cb, 0x0, 0x7, 0x0, "authentication methods list %d remaining: \"%s\""); } } if (!v3) sshfatal("auth2.c", "auth2_update_methods_lists", 0x2d0, 0x1, 0x1, 0x0); v5 = 0; return v5; }
openssh-portable
angr_sailr
static char *read_quoted_value(struct parser_st *parser) { struct buffer_st buffer; int c, quote_char; memset(&buffer, 0, sizeof(buffer)); c = parser_getc(parser); if (c == (-1)) { ((void)sizeof((0) ? 1 : 0), __extension__({ if (0) ; else __assert_fail("false", "cfg.c", 240, __extension__ __PRETTY_FUNCTION__); })); return ((void *)0); } if (c == '"' || c == '\'') { quote_char = c; } else { ((void)sizeof((0) ? 1 : 0), __extension__({ if (0) ; else __assert_fail("false", "cfg.c", 247, __extension__ __PRETTY_FUNCTION__); })); return ((void *)0); } for (;;) { c = parser_getc(parser); if (c == (-1)) { break; } if (c == '\\') { c = parser_getc(parser); if (c == (-1)) { free(buffer.data); return ((void *)0); } if (c == '\n') { buffer_append(&buffer, ' '); } else if (c == quote_char) { buffer_append(&buffer, c); } } else if (c == quote_char) { break; } else { buffer_append(&buffer, c); } } buffer_append(&buffer, '\0'); return buffer.data; }
void read_quoted_value(void *a0) { unsigned int v0; unsigned int v1; char v2; unsigned long long v4; void *v5; memset(&v2, 0x0, 0x18); v0 = parser_getc(a0); switch (v0) { case 34: case 39: v1 = v0; while (true) { v0 = parser_getc(a0); if (v0 == -1) break; if (v0 == 92) { v0 = parser_getc(a0); if (v0 == -1) { free(*(&v2)); v5 = 0; return; } else if (v0 == 10) { buffer_append(&v2, 0x20); continue; } else if (v0 == v1) { buffer_append(&v2, v0); } } else { if (v0 == v1) break; buffer_append(&v2, v0); } } buffer_append(&v2, 0x0); v4 = *(&v2); return; default: __assert_fail(); } }
gnutls
angr_sailr
static int bash_complete_username(ignore, ignore2) int ignore, ignore2; { return bash_complete_username_internal( rl_completion_mode(bash_complete_username)); }
long bash_complete_username() { unsigned int v0; v0 = rl_completion_mode(bash_complete_username); return bash_complete_username_internal(v0); }
bash
ida
static void print_clockchange(const STRUCT_UTMP *utmp_ent) { print_line(-1, "", ' ', -1, gettext("clock change"), time_string(utmp_ent), "", "", "", ""); }
void print_clockchange(void *a0) { unsigned long long v1; v1 = print_line(0xffffffff, &g_401de3, 0x20, 0xffffffff, gettext("clock change"), time_string(a0), &g_401de3, &g_401de3, &g_401de3, &g_401de3); return; }
coreutils
angr_dream
static void help(void) { printf("Usage:\n" "\t%s [options] <modulename|filename> [args]\n" "Options:\n" "\t-a, --author Print only 'author'\n" "\t-d, --description Print only 'description'\n" "\t-l, --license Print only 'license'\n" "\t-p, --parameters Print only 'parm'\n" "\t-n, --filename Print only 'filename'\n" "\t-0, --null Use \\0 instead of \\n\n" "\t-m, --modname Handle argument as module name instead " "of alias or filename\n" "\t-F, --field=FIELD Print only provided FIELD\n" "\t-k, --set-version=VERSION Use VERSION instead of `uname -r`\n" "\t-b, --basedir=DIR Use DIR as filesystem root for " "/lib/modules\n" "\t-V, --version Show version\n" "\t-h, --help Show this help\n", program_invocation_short_name); }
void help() { unsigned long long v1; v1 = printf( "Usage:\n\t%s [options] <modulename|filename> [args]\nOptions:\n\t-a, " "--author Print only 'author'\n\t-d, --description " " Print only 'description'\n\t-l, --license Print only " "'license'\n\t-p, --parameters Print only 'parm'\n\t-n, " "--filename Print only 'filename'\n\t-0, --null " " Use \\0 instead of \\n\n\t-m, --modname Handle " "argument as module name instead of alias or filename\n\t-F, " "--field=FIELD Print only provided FIELD\n\t-k, " "--set-version=VERSION Use VERSION instead of `uname -r`\n\t-b, " "--basedir=DIR Use DIR as filesystem root for " "/lib/modules\n\t-V, --version Show version\n\t-h, --help " " Show this help\n", program_invocation_short_name); return; }
kmod
angr_dream
static int modinfo_params_do(const struct kmod_list *list) { const struct kmod_list *l; struct param *params = ((void *)0); int err = 0; for (l = list; l != ((void *)0); l = kmod_list_next(list, l)) { const char *key = kmod_module_info_get_key(l); const char *value = kmod_module_info_get_value(l); if (!(strcmp((key), ("parm")) == 0) && !(strcmp((key), ("parmtype")) == 0)) continue; err = process_parm(key, value, &params); if (err < 0) goto end; } while (params != ((void *)0)) { struct param *p = params; params = p->next; if (p->param == ((void *)0)) printf("%.*s: (%.*s)%c", p->namelen, p->name, p->typelen, p->type, separator); else if (p->type != ((void *)0)) printf("%.*s:%.*s (%.*s)%c", p->namelen, p->name, p->paramlen, p->param, p->typelen, p->type, separator); else printf("%.*s:%.*s%c", p->namelen, p->name, p->paramlen, p->param, separator); free(p); } end: while (params != ((void *)0)) { void *tmp = params; params = params->next; free(tmp); } return err; }
int modinfo_params_do(unsigned long long a0) { unsigned long v0; unsigned long v1; unsigned int v2; void *v3; unsigned long long v4; void *v5; char *v6; void *v7; void *v8; v3 = 0; v2 = 0; v4 = a0; while (true) { if (!v4) { while (v3) { v5 = v3; v3 = *(v5); if (!v5[16]) { printf("%.*s: (%.*s)%c", v5[32], v5[8], v5[40]); } else if (v5[24]) { v1 = separator; v0 = v5[24]; printf("%.*s:%.*s (%.*s)%c", v5[32], v5[8], v5[36], v5[16]); } else { printf("%.*s:%.*s%c", v5[32], v5[8], v5[36]); } free(v5); } } else { v6 = kmod_module_info_get_key(v4); v7 = kmod_module_info_get_value(v4); if ((!(strcmp(v6, "parm")) || !(strcmp(v6, "parmtype"))) && !((v2 = process_parm(v6, v7, &v3), v2 >= 0))) break; v4 = kmod_list_next(a0, v4, v4); } } while (v3) { v8 = v3; v3 = *(v3); free(v8); } return v2; }
kmod
angr_sailr
strerror( (*__errno_location ()) )); exit(1); } if (pid == 0) { setsid(); (void)ioctl(ftty, 0x540E, 1); exit(0); }
char *strerror(int __errnum) { halt_baddata(); }
sysvinit
ghidra
static struct sshbuf *reply_error(int r, char *fmt, ...) { char *msg; va_list ap; struct sshbuf *resp; __builtin_va_start(ap, fmt); xvasprintf(&msg, fmt, ap); __builtin_va_end(ap); sshlog("ssh-sk-helper.c", __func__, 66, 0, SYSLOG_LEVEL_DEBUG1, ((void *)0), "%s: %s", __progname, msg); free(msg); if (r >= 0) sshfatal("ssh-sk-helper.c", __func__, 70, 1, SYSLOG_LEVEL_FATAL, ((void *)0), "invalid error code %d", r); if ((resp = sshbuf_new()) == ((void *)0)) sshfatal("ssh-sk-helper.c", __func__, 73, 0, SYSLOG_LEVEL_FATAL, ((void *)0), "%s: sshbuf_new failed", __progname); if (sshbuf_put_u32(resp, 0) != 0 || sshbuf_put_u32(resp, (u_int)-r) != 0) sshfatal("ssh-sk-helper.c", __func__, 76, 0, SYSLOG_LEVEL_FATAL, ((void *)0), "%s: buffer error", __progname); return resp; }
int reply_error(unsigned long a0, unsigned long long a1, unsigned long a2, unsigned long a3, unsigned long a4, unsigned long a5) { unsigned long v0; char v1; unsigned long long v2; unsigned int v3; unsigned int v4; unsigned long v5; unsigned long v6; unsigned long v7; char v8; unsigned long v9; unsigned long v10; unsigned long v11; unsigned long v12; int v13; int v14; int v15; int v16; int v17; int v18; int v19; int v20; unsigned long long v21; unsigned long v22; char v23; unsigned long v24; char v25; int v26; int v27; int v28; int v29; int v30; int v31; int v32; int v33; unsigned long long *v34; unsigned long long v35; v9 = a2; v10 = a3; v11 = a4; v12 = a5; if (v25) { v13 = v26; v14 = v27; v15 = v28; v16 = v29; v17 = v30; v18 = v31; v19 = v32; v20 = v33; } v7 = v34[5]; v3 = 16; v4 = 48; v5 = &v24; v6 = &v8; xvasprintf(&v1, a1, &v3, a1); sshlog("ssh-sk-helper.c", "reply_error", 0x42, 0x0, 0x5, 0x0, "%s: %s", __progname); free(*(&v1)); if (a0 >= 0) { v0 = a0; sshfatal("ssh-sk-helper.c", "reply_error", 0x46, 0x1, 0x1, 0x0, "invalid error code %d"); } v2 = sshbuf_new(); if (!v2) { v22 = __progname; v21 = "%s: sshbuf_new failed"; sshfatal("ssh-sk-helper.c", "reply_error", 0x49, 0x0, 0x1, 0x0, *(&v23)); } v35 = sshbuf_put_u32(v2, 0x0); if (v35 || sshbuf_put_u32(v2, __negvsi2(a0))) { v22 = __progname; v21 = "%s: buffer error"; sshfatal("ssh-sk-helper.c", "reply_error", 0x4c, 0x0, 0x1, 0x0, *(&v23)); } if ((v7 ^ v34[5])) __stack_chk_fail(); return v2; }
openssh-portable
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; } else if (a0->field_30) { LABEL_40093c: v2 = -49; } else { if (!(a0->field_38 <= 1)) goto LABEL_40093c; if (a1 > a0->field_20) { LABEL_40097b: v2 = -9; } else { if (a0->field_20 - a1 < a0->field_18 - a0->field_10) goto LABEL_40097b; v2 = 0; } } return v2; }
openssh-portable
angr_phoenix
static void set_mtime_to_now(struct stat *st) { gettime(&((st)->st_mtim)); }
void set_mtime_to_now(long param_1) { gettime(param_1 + 0x58); return; }
diffutils
ghidra
static speed_t string_to_baud(char const *arg) { for (int i = 0; speeds[i].string != ((void *)0); ++i) if ((strcmp(arg, speeds[i].string) == 0)) return speeds[i].speed; return (speed_t)-1; }
int string_to_baud(char *a0) { unsigned int v0; unsigned int v2; v0 = 0; while (true) { if (!speeds[2 * v0 + v0]) { v2 = -1; break; } else if (strcmp(a0, speeds[2 * v0 + v0])) { v0 += 1; } else { v2 = (&g_407288)[3 * v0]; break; } } return v2; }
coreutils
angr_phoenix
_Bool is_exec_in_local_dir (const PRED_FUNC pred_func) { return pred_execdir == pred_func || pred_okdir == pred_func; }
long long is_exec_in_local_dir(unsigned long a0) { unsigned int v1; unsigned long long v2; if (a0 != got.pred_execdir && a0 != got.pred_okdir) v1 = 0; if (a0 == got.pred_execdir || a0 == got.pred_okdir) v1 = 1; v2 = v1 & 1; return v2; }
findutils
angr_dream
static int try_resume(socket_st *hd) { int ret, socket_flags = (1 << 6); gnutls_datum_t rdata = {((void *)0), 0}; gnutls_datum_t edata = {((void *)0), 0}; if (gnutls_session_is_resumed(hd->session) == 0) { do { ret = gnutls_session_get_data2(hd->session, &rdata); if (ret < 0) { rdata.data = ((void *)0); } if ((gnutls_protocol_get_version(hd->session) != GNUTLS_TLS1_3) || ((gnutls_session_get_flags(hd->session) & GNUTLS_SFLAGS_SESSION_TICKET))) { break; } } while (waitresumption); } else { rdata.data = hd->rdata.data; rdata.size = hd->rdata.size; hd->rdata.data = ((void *)0); } log_msg(stdout, "- Disconnecting\n"); socket_bye(hd, 1); canonicalize_host(hostname, service, sizeof(service)); log_msg(stdout, "\n\n- Connecting again- trying to resume previous session\n"); if (gnutls_cli_options.present.starttls_proto) socket_flags |= (1 << 2); else if (fastopen) socket_flags |= (1 << 1); if (udp) socket_flags |= 1; if (gnutls_cli_options.present.earlydata) { FILE *fp; size_t size; fp = fopen(gnutls_cli_options.arg.earlydata, "r"); if (fp == ((void *)0)) { fprintf(stderr, "could not open %s\n", gnutls_cli_options.arg.earlydata); exit(1); } edata.data = (void *)_gnutls_fread_file(fp, 0, &size); edata.size = size; fclose(fp); } socket_open2(hd, hostname, service, gnutls_cli_options.arg.starttls_proto, socket_flags, "Connecting to", &rdata, &edata, ((void *)0), ((void *)0)); log_msg(stdout, "- Resume Handshake was completed\n"); if (gnutls_session_is_resumed(hd->session) != 0) log_msg(stdout, "*** This is a resumed session\n"); return 0; }
int try_resume(struct_0 *a0) { void *v0; unsigned int v1; unsigned int v2; char v3; void *v4; void *v5; unsigned int v6; unsigned long v7; unsigned int v8; v1 = 64; v5 = 0; v6 = 0; v7 = 0; v8 = 0; if (gnutls_session_is_resumed(a0->field_8)) { v5 = a0->field_e8; v6 = a0->field_f0; a0->field_e8 = 0; } else { while (true) { v2 = gnutls_session_get_data2(a0->field_8, &v5, &v5); if (v2 < 0) v5 = 0; if (gnutls_protocol_get_version(a0->field_8) != 5) break; if ((gnutls_session_get_flags(a0->field_8) & 128)) break; if (!waitresumption) break; } } log_msg(stdout, "- Disconnecting\n", &v5); socket_bye(a0, 0x1); canonicalize_host(hostname, &service, 0x20); log_msg(stdout, "\n\n- Connecting again- trying to resume previous session\n", 0x20); if (g_500106) { v1 |= 4; } else if (fastopen) { v1 |= 2; } if (udp) v1 |= 1; if (g_500101) { v4 = fopen(gnutls_ocsp_status_request_is_checked, "r"); if (!v4) { fprintf(stderr, "could not open %s\n", gnutls_ocsp_status_request_is_checked); exit(0x1); } v7 = _gnutls_fread_file(v4, 0x0, &v3); v8 = *(&v3); fclose(v4); } v0 = 0; socket_open2(a0, hostname, &service, dane_strerror, v1, "Connecting to", &v5, &v7, 0x0); log_msg(stdout, "- Resume Handshake was completed\n", &service); if (gnutls_session_is_resumed(a0->field_8)) log_msg(stdout, "*** This is a resumed session\n", &service); return 0; }
gnutls
angr_phoenix
void init_freeenv(char **e) { int n; for (n = 0; e[n]; n++) free(e[n]); free(e); }
void init_freeenv(unsigned long long *a0) { unsigned int v0; unsigned long long v2; for (v0 = 0; a0[v0]; v0 += 1) { free(a0[v0]); } v2 = free(a0); return; }
sysvinit
angr_phoenix
static int do_read(int fd) { int c; char *n; char buffer[4096]; c = read(fd, buffer, sizeof(buffer) - 1); if (c <= 0) return c; n = realloc(outbuf, outbufsize + c); if (n) { outbuf = n; memcpy(((char *)outbuf) + outbufsize, buffer, c); outbufsize += c; } return c; }
long do_read(int a1) { int v2; char *v3; char buf[16]; unsigned long v5; v5 = __readfsqword(0x28u); v2 = read(a1, buf, 0xFFFuLL); if (v2 <= 0) return (unsigned int)v2; v3 = (char *)realloc(outbuf, outbufsize + v2); if (v3) { outbuf = v3; memcpy(&v3[outbufsize], buf, v2); outbufsize += v2; } return (unsigned int)v2; }
e2fsprogs-1.46.5
ida
int strsvis(char *mbdst, const char *mbsrc, int flags, const char *mbextra) { return istrsenvisxl(mbdst, ((void *)0), mbsrc, flags, mbextra, ((void *)0)); }
void strsvis(undefined8 param_1, undefined8 param_2, undefined4 param_3, undefined8 param_4) { istrsenvisxl(param_1, 0, param_2, param_3, param_4, 0); return; }
libbsd-0.11.7
ghidra
terminal_gettc(EditLine *el, int argc __attribute__((__unused__)), char **argv) { const struct termcapstr *ts; const struct termcapval *tv; char *what; void *how; if (argv == ((void *)0) || argv[1] == ((void *)0) || argv[2] == ((void *)0)) return -1; what = argv[1]; how = argv[2]; for (ts = tstr; ts->name != ((void *)0); ts++) if (strcmp(ts->name, what) == 0) break; if (ts->name != ((void *)0)) { *(char **)how = el->el_terminal.t_str[ts - tstr]; return 0; } for (tv = tval; tv->name != ((void *)0); tv++) if (strcmp(tv->name, what) == 0) break; if (tv->name == ((void *)0)) return -1; if (tv == &tval[1] || tv == &tval[4] || tv == &tval[0] || tv == &tval[6]) { static char yes[] = "yes"; static char no[] = "no"; if (el->el_terminal.t_val[tv - tval]) *(char **)how = yes; else *(char **)how = no; return 0; } else { *(int *)how = el->el_terminal.t_val[tv - tval]; return 0; } }
long long terminal_gettc(struct_1 *a0, unsigned long a1, unsigned long long a2[3]) { unsigned int v0; unsigned long long v1; unsigned long long v2; char *v3; void *v4; unsigned long long v6; v0 = a1; if (!a2) { v6 = 4294967295; return v6; } else if (!a2[1]) { v6 = 4294967295; return v6; } else if (!a2[2]) { v6 = 4294967295; return v6; } else { v3 = a2[1]; v4 = a2[2]; for (v1 = &tstr; *(v1) && strcmp(*(v1), v3); v1 += 16) ; if (*(v1)) { *(v4) = *((*(&a0->padding_0[176]) + (v1 + -0x1 * &tstr >> 4) * 8)); v6 = 0; return v6; } for (v2 = &tval; *(v2) && strcmp(*(v2), v3); v2 += 16) ; if (!*(v2)) { v6 = 4294967295; return v6; } switch (v2) { case 4215328: case 4215344: case 4215392: case 4215424: if (!*((a0->field_b8 + (v2 + -0x1 * &tval >> 4 << 2)))) { *(v4) = "no"; v6 = 0; return v6; } *(v4) = "yes"; v6 = 0; return v6; default: *(v4) = *((a0->field_b8 + (v2 + -0x1 * &tval >> 4) * 4)); v6 = 0; return v6; } } }
libedit
angr_sailr
static _Bool valid_file_spec(struct File_spec const *f) { return ((f->fd == -1) ^ (f->errnum == 0)); }
int valid_file_spec(unsigned int a0[16]) { unsigned int v1; v1 = !a0[15] ^ a0[14] == -1; *(&v1) = (!a0[15] ^ a0[14] == -1); return v1; }
coreutils
angr_phoenix
static int insmod(struct kmod_ctx *ctx, const char *alias, const char *extra_options) { struct kmod_list *l, *list = ((void *)0); int err, flags = 0; void (*show)(struct kmod_module *m, _Bool install, const char *options) = ((void *)0); err = kmod_module_new_from_lookup(ctx, alias, &list); if (list == ((void *)0) || err < 0) { log_printf(log_priority, "Module %s not found in directory %s\n", alias, ctx ? kmod_get_dirname(ctx) : "(missing)"); return -2; } if (strip_modversion || force) flags |= KMOD_PROBE_FORCE_MODVERSION; if (strip_vermagic || force) flags |= KMOD_PROBE_FORCE_VERMAGIC; if (ignore_commands) flags |= KMOD_PROBE_IGNORE_COMMAND; if (ignore_loaded) flags |= KMOD_PROBE_IGNORE_LOADED; if (dry_run) flags |= KMOD_PROBE_DRY_RUN; if (do_show || verbose > 4) show = &print_action; flags |= KMOD_PROBE_APPLY_BLACKLIST_ALIAS_ONLY; if (use_blacklist) flags |= KMOD_PROBE_APPLY_BLACKLIST; if (first_time) flags |= KMOD_PROBE_FAIL_ON_LOADED; for (l = list; l != ((void *)0); l = kmod_list_next(list, l)) { struct kmod_module *mod = kmod_module_get_module(l); if (lookup_only) printf("%s\n", kmod_module_get_name(mod)); else { err = kmod_module_probe_insert_module(mod, flags, extra_options, ((void *)0), ((void *)0), show); } if (err >= 0) err = 0; else { switch (err) { case -17: log_printf(3, "could not insert '%s': Module already in kernel\n", kmod_module_get_name(mod)); break; case -2: log_printf(3, "could not insert '%s': Unknown symbol in module, " "or unknown parameter (see dmesg)\n", kmod_module_get_name(mod)) ; break; default: log_printf(3, "could not insert '%s': %s\n", kmod_module_get_name(mod), strerror(-err)) ; break; } } kmod_module_unref(mod); } kmod_module_unref_list(list); return err; }
int insmod(unsigned long long a0, unsigned long long a1, unsigned long long a2) { unsigned int v0; unsigned int v1; void *v2; void *v3; unsigned long long v4; unsigned long long v5; unsigned int v7; v2 = 0; v1 = 0; v4 = 0; v0 = kmod_module_new_from_lookup(a0, a1, &v2, a1); if (!v2) { LABEL_40248b: if (a0) kmod_get_dirname(a0); log_printf(log_priority, "Module %s not found in directory %s\n", a1); v7 = -2; } else { if (v0 < 0) goto LABEL_40248b; if (!strip_modversion && !force) goto LABEL_4024e7; v1 |= 2; LABEL_4024e7: if (!strip_vermagic && !force) goto LABEL_4024ff; v1 |= 1; LABEL_4024ff: if (ignore_commands) v1 |= 4; if (ignore_loaded) v1 |= 8; if (dry_run) v1 |= 16; if (!do_show && verbose <= 4) goto LABEL_402549; v4 = print_action; LABEL_402549: v1 |= 0x40000; if (use_blacklist) v1 |= 0x20000; if (first_time) v1 |= 32; for (v3 = v2; v3; v3 = kmod_list_next(v2, v3, v3)) { v5 = kmod_module_get_module(v3); if (lookup_only) printf("%s\n", kmod_module_get_name(v5)); else v0 = kmod_module_probe_insert_module(v5, v1, a2, 0x0, 0x0, v4); if (v0 >= 0) { v0 = 0; } else if (v0 == -17) { log_printf(0x3, "could not insert '%s': Module already in kernel\n", kmod_module_get_name(v5)); } else if (v0 != -2) { strerror(-(v0)); log_printf(0x3, "could not insert '%s': %s\n", kmod_module_get_name(v5)); } else { log_printf(0x3, "could not insert '%s': Unknown symbol in module, or " "unknown parameter (see dmesg)\n", kmod_module_get_name(v5)); } kmod_module_unref(v5); } kmod_module_unref_list(v2); v7 = v0; } return v7; }
kmod
angr_phoenix
int printf_fetchargs(va_list args, arguments *a) { size_t i; argument *ap; for (i = 0, ap = &a->arg[0]; i < a->count; i++, ap++) switch (ap->type) { case TYPE_SCHAR: ap->a.a_schar = __builtin_va_arg(args, int); break; case TYPE_UCHAR: ap->a.a_uchar = __builtin_va_arg(args, int); break; case TYPE_SHORT: ap->a.a_short = __builtin_va_arg(args, int); break; case TYPE_USHORT: ap->a.a_ushort = __builtin_va_arg(args, int); break; case TYPE_INT: ap->a.a_int = __builtin_va_arg(args, int); break; case TYPE_UINT: ap->a.a_uint = __builtin_va_arg(args, unsigned int); break; case TYPE_LONGINT: ap->a.a_longint = __builtin_va_arg(args, long int); break; case TYPE_ULONGINT: ap->a.a_ulongint = __builtin_va_arg(args, unsigned long int); break; case TYPE_LONGLONGINT: ap->a.a_longlongint = __builtin_va_arg(args, long long int); break; case TYPE_ULONGLONGINT: ap->a.a_ulonglongint = __builtin_va_arg(args, unsigned long long int); break; case TYPE_DOUBLE: ap->a.a_double = __builtin_va_arg(args, double); break; case TYPE_LONGDOUBLE: ap->a.a_longdouble = __builtin_va_arg(args, long double); break; case TYPE_CHAR: ap->a.a_char = __builtin_va_arg(args, int); break; case TYPE_WIDE_CHAR: ap->a.a_wide_char = (sizeof(wint_t) < sizeof(int) ? (wint_t) __builtin_va_arg(args, int) : __builtin_va_arg(args, wint_t)); break; case TYPE_STRING: ap->a.a_string = __builtin_va_arg(args, const char *); if (ap->a.a_string == ((void *)0)) ap->a.a_string = "(NULL)"; break; case TYPE_WIDE_STRING: ap->a.a_wide_string = __builtin_va_arg(args, const wchar_t *); if (ap->a.a_wide_string == ((void *)0)) { static const wchar_t wide_null_string[] = { (wchar_t)'(', (wchar_t)'N', (wchar_t)'U', (wchar_t)'L', (wchar_t)'L', (wchar_t)')', (wchar_t)0}; ap->a.a_wide_string = wide_null_string; } break; case TYPE_POINTER: ap->a.a_pointer = __builtin_va_arg(args, void *); break; case TYPE_COUNT_SCHAR_POINTER: ap->a.a_count_schar_pointer = __builtin_va_arg(args, signed char *); break; case TYPE_COUNT_SHORT_POINTER: ap->a.a_count_short_pointer = __builtin_va_arg(args, short *); break; case TYPE_COUNT_INT_POINTER: ap->a.a_count_int_pointer = __builtin_va_arg(args, int *); break; case TYPE_COUNT_LONGINT_POINTER: ap->a.a_count_longint_pointer = __builtin_va_arg(args, long int *); break; case TYPE_COUNT_LONGLONGINT_POINTER: ap->a.a_count_longlongint_pointer = __builtin_va_arg(args, long long int *); break; default: return -1; } return 0; }
long long printf_fetchargs(struct_0 *a0, unsigned long long a1[2]) { struct_0 *v0; void *v1; struct_1 *v2; unsigned int *v4; unsigned long long *v5; unsigned int *v6; unsigned long long *v7; unsigned int *v8; unsigned int *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; unsigned int *v16; unsigned int *v17; unsigned int *v18; unsigned long long *v19; unsigned long long *v20; unsigned long long *v21; unsigned int *v22; unsigned long long *v23; unsigned long long *v24; unsigned long long v25; v0 = a0; v1 = 0; v2 = a1[1]; while (true) { if (v1 < a1[0]) { switch (v2->field_0) { case 1: if (a0->field_0 > 47) { v17 = a0->field_8; a0->field_8 = a0->field_8 + 8; } else { v17 = a0->field_0 + a0->field_10; a0->field_0 = a0->field_0 + 8; } v2->field_10 = *(v17); break; case 2: if (a0->field_0 > 47) { v9 = a0->field_8; a0->field_8 = a0->field_8 + 8; } else { v9 = a0->field_0 + a0->field_10; a0->field_0 = a0->field_0 + 8; } v2->field_10 = *(v9); break; case 3: if (a0->field_0 > 47) { v4 = a0->field_8; a0->field_8 = a0->field_8 + 8; } else { v4 = a0->field_0 + a0->field_10; a0->field_0 = a0->field_0 + 8; } *(&v2->field_10) = *(v4); break; case 4: if (a0->field_0 > 47) { v16 = a0->field_8; a0->field_8 = a0->field_8 + 8; } else { v16 = a0->field_0 + a0->field_10; a0->field_0 = a0->field_0 + 8; } *(&v2->field_10) = *(v16); break; case 5: if (a0->field_0 > 47) { v8 = a0->field_8; a0->field_8 = a0->field_8 + 8; } else { v8 = a0->field_0 + a0->field_10; a0->field_0 = a0->field_0 + 8; } *(&v2->field_10) = *(v8); break; case 6: if (a0->field_0 > 47) { v22 = a0->field_8; a0->field_8 = a0->field_8 + 8; } else { v22 = a0->field_0 + a0->field_10; a0->field_0 = a0->field_0 + 8; } *(&v2->field_10) = *(v22); break; case 7: if (a0->field_0 > 47) { v15 = a0->field_8; a0->field_8 = a0->field_8 + 8; } else { v15 = a0->field_0 + a0->field_10; a0->field_0 = a0->field_0 + 8; } *(&v2->field_10) = *(v15); break; case 8: if (a0->field_0 > 47) { v24 = a0->field_8; a0->field_8 = a0->field_8 + 8; } else { v24 = a0->field_0 + a0->field_10; a0->field_0 = a0->field_0 + 8; } *(&v2->field_10) = *(v24); break; case 9: if (a0->field_0 > 47) { v20 = a0->field_8; a0->field_8 = a0->field_8 + 8; } else { v20 = a0->field_0 + a0->field_10; a0->field_0 = a0->field_0 + 8; } *(&v2->field_10) = *(v20); break; case 10: if (a0->field_0 > 47) { v13 = a0->field_8; a0->field_8 = a0->field_8 + 8; } else { v13 = a0->field_0 + a0->field_10; a0->field_0 = a0->field_0 + 8; } *(&v2->field_10) = *(v13); break; case 11: if (a0->field_4 > 175) { v5 = a0->field_8; a0->field_8 = a0->field_8 + 8; } else { v5 = a0->field_4 + a0->field_10; a0->field_4 = a0->field_4 + 16; } *(&v2->field_10) = *(v5); break; case 12: a0->field_8 = (a0->field_8 + 15 & -0x10) + 16; [D] t12 = DIRTY 1 TODO(effects):: : amd64g_dirtyhelper_loadF80le(t5)[D] PutI( 904 : F64x8)[t29, 0] = t32[D] PutI(968 : I8x8)[t29, 0] = 0x01 [D] t4294967295 = DIRTY 1 TODO(effects):: : amd64g_dirtyhelper_storeF80le(t42, t44)[D] PutI( 968 : I8x8)[t29, 0] = 0x00 break; case 13: if (a0->field_0 > 47) { v6 = a0->field_8; a0->field_8 = a0->field_8 + 8; } else { v6 = a0->field_0 + a0->field_10; a0->field_0 = a0->field_0 + 8; } *(&v2->field_10) = *(v6); break; case 14: if (a0->field_0 > 47) { v18 = a0->field_8; a0->field_8 = a0->field_8 + 8; } else { v18 = a0->field_0 + a0->field_10; a0->field_0 = a0->field_0 + 8; } *(&v2->field_10) = *(v18); break; case 15: if (a0->field_0 <= 47) { v11 = a0->field_0 + a0->field_10; a0->field_0 = a0->field_0 + 8; } else { v11 = a0->field_8; a0->field_8 = a0->field_8 + 8; } *(&v2->field_10) = *(v11); if (!*(&v2->field_10)) *(&v2->field_10) = "(NULL)"; break; case 16: if (a0->field_0 > 47) { v10 = a0->field_8; a0->field_8 = a0->field_8 + 8; } else { v10 = a0->field_0 + a0->field_10; a0->field_0 = a0->field_0 + 8; } *(&v2->field_10) = *(v10); if (!*(&v2->field_10)) *(&v2->field_10) = "("; break; case 17: if (a0->field_0 > 47) { v7 = a0->field_8; a0->field_8 = a0->field_8 + 8; } else { v7 = a0->field_0 + a0->field_10; a0->field_0 = a0->field_0 + 8; } *(&v2->field_10) = *(v7); break; case 18: if (a0->field_0 > 47) { v21 = a0->field_8; a0->field_8 = a0->field_8 + 8; } else { v21 = a0->field_0 + a0->field_10; a0->field_0 = a0->field_0 + 8; } *(&v2->field_10) = *(v21); break; case 19: if (a0->field_0 > 47) { v14 = a0->field_8; a0->field_8 = a0->field_8 + 8; } else { v14 = a0->field_0 + a0->field_10; a0->field_0 = a0->field_0 + 8; } *(&v2->field_10) = *(v14); break; case 20: if (a0->field_0 > 47) { v23 = a0->field_8; a0->field_8 = a0->field_8 + 8; } else { v23 = a0->field_0 + a0->field_10; a0->field_0 = a0->field_0 + 8; } *(&v2->field_10) = *(v23); break; case 21: if (a0->field_0 > 47) { v19 = a0->field_8; a0->field_8 = a0->field_8 + 8; } else { v19 = a0->field_0 + a0->field_10; a0->field_0 = a0->field_0 + 8; } *(&v2->field_10) = *(v19); break; case 22: if (a0->field_0 > 47) { v12 = a0->field_8; a0->field_8 = a0->field_8 + 8; } else { v12 = a0->field_0 + a0->field_10; a0->field_0 = a0->field_0 + 8; } *(&v2->field_10) = *(v12); break; default: v25 = 4294967295; return v25; } v1 += 1; v2 = &v2[1].padding_4[11]; } else { v25 = 0; return v25; } } }
gzip-1.12
angr_sailr
void parse_server_match_config(ServerOptions *options, struct include_list *includes, struct connection_info *connectinfo) { ServerOptions mo; initialize_server_options(&mo); parse_server_config(&mo, "reprocess config", cfg, includes, connectinfo, 0); copy_set_server_options(options, &mo, 0); }
long long parse_server_match_config(void *a0, unsigned long long a1, unsigned long long a2) { char v0; char v1; v1 = *(&v1); initialize_server_options(&v0); parse_server_config(&v0, "reprocess config", cfg, a1, a2, 0x0); copy_set_server_options(a0, &v0, 0x0); return 0; }
openssh-portable
angr_phoenix
static _Bool parse_user(const struct parser_table *entry, char **argv, int *arg_ptr) { const char *username; if (collect_arg(argv, arg_ptr, &username)) { struct predicate *our_pred; uid_t uid; struct passwd *cur_pwd = getpwnam(username); endpwent(); if (cur_pwd != ((void *)0)) { uid = cur_pwd->pw_uid; } else { const size_t uid_len = strspn(username, "0123456789"); if (uid_len && (username[uid_len] == 0)) { uid = safe_atoi(username, options.err_quoting_style); } else { if (username[0]) { ((!!sizeof(struct { _Static_assert( 1, "verify_expr (" "1" ", " "(error (1, 0, gettext (\"%s is not the name of a known " "user\"), quotearg_n_style (0, options.err_quoting_style, " "username)), assume (false))" ")"); int _gl_dummy; })) ? ((error(1, 0, gettext("%s is not the name of a known user"), quotearg_n_style(0, options.err_quoting_style, username)), ((0) ? (void)0 : __builtin_unreachable()))) : ((error(1, 0, gettext("%s is not the name of a known user"), quotearg_n_style(0, options.err_quoting_style, username)), ((0) ? (void)0 : __builtin_unreachable())))) ; } else { ((!!sizeof(struct { _Static_assert(1, "verify_expr (" "1" ", " "(error (1, 0, gettext (\"The argument to -user " "should not be empty\")), assume (false))" ")"); int _gl_dummy; })) ? ((error(1, 0, gettext("The argument to -user should not be empty")), ((0) ? (void)0 : __builtin_unreachable()))) : ((error(1, 0, gettext("The argument to -user should not be empty")), ((0) ? (void)0 : __builtin_unreachable())))); } return 0; } } our_pred = insert_primary(entry, username); our_pred->args.uid = uid; our_pred->est_success_rate = (our_pred->args.uid < 100) ? 0.99 : 0.2; return 1; } return 0; }
long parse_user(long a1, long a2, int *a3) { long v3; char *v4; char *v5; int v6; __uid_t pw_uid; char *name; struct passwd *v10; size_t v11; long inserted; unsigned long v13; v13 = __readfsqword(0x28u); if (!(unsigned char)collect_arg(a2, a3, &name)) return 0LL; v10 = getpwnam(name); endpwent(); if (v10) { pw_uid = v10->pw_uid; } else { v11 = strspn(name, "0123456789"); if (!v11 || name[v11]) { if (*name) { v3 = quotearg_n_style(0LL, HIDWORD(options[13]), name); v4 = gettext("%s is not the name of a known user"); error(1, 0, v4, v3); } v5 = gettext("The argument to -user should not be empty"); error(1, 0, v5); } else { pw_uid = safe_atoi(name, HIDWORD(options[13])); } } inserted = insert_primary(a1, name); *(_DWORD *)(inserted + 56) = pw_uid; if (*(_DWORD *)(inserted + 56) > 0x63u) v6 = 1045220557; else v6 = 1065185444; *(_DWORD *)(inserted + 36) = v6; return 1LL; }
findutils
ida
const char *gzerror(file, errnum) gzFile file; int *errnum; { gz_statep state; if (file == ((void *)0)) return ((void *)0); state = (gz_statep)file; if (state->mode != 7247 && state->mode != 31153) return ((void *)0); if (errnum != ((void *)0)) *errnum = state->err; return state->err == (-4) ? "out of memory" : (state->msg == ((void *)0) ? "" : state->msg); }
long long gzerror(struct_0 *a0, unsigned int *a1) { void *v1; if (!a0) { v1 = 0; return v1; } switch (a0->field_18) { case 7247: case 31153: if (a1) { *(a1) = a0->field_74; break; } v1 = (a0->field_74 == -0x4 ? (!a0->field_78 ? a0->field_78 : &g_400e8c) : "out of memory"); return v1; default: v1 = 0; return v1; } }
zlib
angr_sailr
char *uinttostr(i, buf, len) uintmax_t i; char *buf; size_t len; { return (fmtumax(i, 10, buf, len, 0x08)); }
long long uinttostr(unsigned long long a0, unsigned long long a1, unsigned long long a2) { return fmtumax(a0, 0xa, a1, a2, 0x8); }
bash
angr_dream
int rl_vi_delete_to(int count, int key) { int c, r; _rl_vimotion_cxt *savecxt; savecxt = 0; if (_rl_vi_redoing) { savecxt = _rl_vimvcxt; _rl_vimvcxt = _rl_mvcxt_alloc(0x01, key); } else if (_rl_vimvcxt) _rl_mvcxt_init(_rl_vimvcxt, 0x01, key); else _rl_vimvcxt = _rl_mvcxt_alloc(0x01, key); _rl_vimvcxt->start = rl_point; rl_mark = rl_point; if ((1 && (1 && ((*__ctype_b_loc())[(int)(((unsigned char)key))] & (unsigned short int)_ISupper)))) { _rl_vimvcxt->motion = '$'; r = rl_domove_motion_callback(_rl_vimvcxt); } else if (_rl_vi_redoing && _rl_vi_last_motion != 'd') { _rl_vimvcxt->motion = _rl_vi_last_motion; r = rl_domove_motion_callback(_rl_vimvcxt); } else if (_rl_vi_redoing) { _rl_vimvcxt->motion = _rl_vi_last_motion; rl_mark = rl_end; rl_beg_of_line(1, key); (rl_readline_state &= ~(0x0100000)); r = vidomove_dispatch(_rl_vimvcxt); } else if ((rl_readline_state & (0x0080000))) { (rl_readline_state |= (0x0100000)); return (0); } else r = rl_vi_domove(key, &c); if (r < 0) { rl_ding(); r = -1; } _rl_mvcxt_dispose(_rl_vimvcxt); _rl_vimvcxt = savecxt; return r; }
long long rl_vi_delete_to(unsigned long a0, unsigned long a1, unsigned long a2, unsigned long long a3, unsigned long long a4, unsigned long long a5) { unsigned int v0; char v1; unsigned int v2; void *v3; unsigned int v6; void *v7; v0 = a0; v3 = 0; if (true) { v3 = _rl_vimvcxt; _rl_vimvcxt = _rl_mvcxt_alloc(0x1, a1); } else if (!_rl_vimvcxt) { _rl_vimvcxt = _rl_mvcxt_alloc(0x1, a1); } else { _rl_mvcxt_init(_rl_vimvcxt, 0x1, a1); } *(&_rl_vimvcxt[20]) = rl_point; rl_mark = rl_point; v6 = *((*(__ctype_b_loc()) + a1 * 2)) & 0x100; if (v6) { *(&_rl_vimvcxt[32]) = 36; v2 = rl_domove_motion_callback(_rl_vimvcxt, a1, a1 * 2, a3, a4, a5); } else if (true) { *(&_rl_vimvcxt[32]) = _rl_vi_last_motion; if (_rl_vi_last_motion != 100) { v2 = rl_domove_motion_callback(_rl_vimvcxt, a1, _rl_vi_last_motion, a3, a4, a5); } else { rl_mark = rl_end; rl_beg_of_line(0x1, a1); rl_readline_state = rl_readline_state & -1048577; v2 = vidomove_dispatch(_rl_vimvcxt, a1, a1 * 2, a3, a4, a5); } } else if (!(rl_readline_state & 0x80000)) { v2 = rl_vi_domove(a1, &v1, &v1, a3, a4, a5); } else { rl_readline_state = rl_readline_state | 0x100000; v7 = 0; return v7; } if (v2 < 0) { rl_ding(); v2 = -1; } _rl_mvcxt_dispose(_rl_vimvcxt); _rl_vimvcxt = v3; v7 = v2; return v7; }
bash
angr_sailr
static int inflateStateCheck(strm) z_streamp strm; { struct inflate_state *state; if (strm == 0 || strm->zalloc == (alloc_func)0 || strm->zfree == (free_func)0) return 1; state = (struct inflate_state *)strm->state; if (state == 0 || state->strm != strm || state->mode < HEAD || state->mode > SYNC) return 1; return 0; }
int inflateStateCheck(unsigned long long a0[10]) { struct_0 *v0; unsigned int v2; if (!a0) { LABEL_40002d: v2 = 1; } else { if (!a0[8]) goto LABEL_40002d; if (!a0[9]) goto LABEL_40002d; v0 = a0[7]; if (!v0) { LABEL_400070: v2 = 1; } else { if (!(a0 == v0->field_0)) goto LABEL_400070; if (v0->field_8 <= 16179) goto LABEL_400070; if (!(v0->field_8 <= 16211)) goto LABEL_400070; v2 = 0; } } return v2; }
zlib
angr_phoenix
static void wait_for_grandchild(pid_t pid) { int wait_status; int exit_code = 0; while (waitpid(pid, &wait_status, 0) == -1) if ((*__errno_location()) != 4) { waitpid_error(use_compress_program_option); break; } if ((((signed char)(((wait_status) & 0x7f) + 1) >> 1) > 0)) raise(((wait_status) & 0x7f)); else if ((((wait_status) & 0xff00) >> 8) != 0) exit_code = (((wait_status) & 0xff00) >> 8); exit(exit_code); }
void wait_for_grandchild(unsigned long a0) { char v0; unsigned int v1; unsigned long v2; unsigned long long *v4; unsigned int v5; v2 = v4[5]; v1 = 0; do { if (waitpid(a0, &v0, 0x0) != -1) goto LABEL_400714; v5 = *(__errno_location()); } while (v5 == 4); waitpid_error(use_compress_program_option); LABEL_400714: if (((*(&v0) & 127) + 1 >> 1) > 0) { raise(*(&v0) & 127); } else if ((*(&v0) >> 8)) { v1 = (*(&v0) >> 8) & 255; } exit(v1); }
tar
angr_phoenix
static void dispose_temporary_env(pushf) sh_free_func_t *pushf; { int i; HASH_TABLE *disposer; tempvar_list = strvec_create(((temporary_env) ? (temporary_env)->nentries : 0) + 1); tempvar_list[tvlist_ind = 0] = 0; disposer = temporary_env; temporary_env = (HASH_TABLE *)((void *)0); hash_flush(disposer, pushf); hash_dispose(disposer); tempvar_list[tvlist_ind] = 0; array_needs_making = 1; for (i = 0; i < tvlist_ind; i++) stupidly_hack_special_variables(tempvar_list[i]); strvec_dispose(tempvar_list); tempvar_list = 0; tvlist_ind = 0; }
long dispose_temporary_env(long a1) { unsigned int v1; long result; int i; long v4; if (temporary_env) v1 = *(_DWORD *)(temporary_env + 12) + 1; else v1 = 1; tempvar_list = strvec_create(v1); tvlist_ind = 0; *(_QWORD *)tempvar_list = 0LL; v4 = temporary_env; temporary_env = 0LL; hash_flush(v4, a1); hash_dispose(v4); *(_QWORD *)(8LL * tvlist_ind + tempvar_list) = 0LL; array_needs_making = 1; for (i = 0; i < tvlist_ind; ++i) stupidly_hack_special_variables(*(const char **)(8LL * i + tempvar_list)); result = strvec_dispose(tempvar_list); tempvar_list = 0LL; tvlist_ind = 0; return result; }
bash
ida
static void sparse_offset_decoder(struct tar_stat_info *st, char const *keyword, char const *arg, size_t size __attribute__((unused))) { uintmax_t u; if (decode_num( &u, arg, ((off_t)(!(!((off_t)0 < (off_t)-1)) ? (off_t)-1 : ((((off_t)1 << ((sizeof(off_t) * 8) - 2)) - 1) * 2 + 1))), keyword)) { if (st->sparse_map_avail < st->sparse_map_size) st->sparse_map[st->sparse_map_avail].offset = u; else do { if (error_hook) error_hook(); error(0, 0, gettext("Malformed extended header: excess %s=%s"), "GNU.sparse.offset", arg); exit_status = 2; } while (0); } }
long long sparse_offset_decoder(unsigned long long a0[41], unsigned int a1, unsigned long a2, unsigned long a3) { unsigned long v0; char v1; v0 = a3; if (decode_num(&v1, a2, 0x7fffffffffffffff, a1)) { if (a0[38] < a0[39]) { *((a0[38] * 16 + a0[40])) = *(&v1); } else { if (error_hook) *(5242936)(); error(0x0, 0x0, gettext("Malformed extended header: excess %s=%s")); exit_status = 2; } } return 0; }
tar
angr_phoenix
int sshkey_plain_to_blob(const struct sshkey *key, u_char **blobp, size_t *lenp) { return to_blob(key, blobp, lenp, 1, SSHKEY_SERIALIZE_DEFAULT); }
long long sshkey_plain_to_blob(void *a0, unsigned long long *a1, unsigned long long *a2) { return to_blob(a0, a1, a2, 0x1, 0x0); }
openssh-portable
angr_dream
static int ipaddr_restore(void) { if (ipadd_dump_check_magic()) exit(-1); exit(rtnl_from_file(stdin, &restore_handler, ((void *)0))); }
void ipaddr_restore() { if (!ipadd_dump_check_magic()) exit(rtnl_from_file(stdin, restore_handler, 0x0)); exit(0xffffffff); }
iproute2-6.0.0
angr_sailr
void file_error(filename) char *filename; { perror(filename); exit(2); }
void file_error(char *a0) { perror(a0); exit(0x2); }
bash
angr_dream
static void double_to_human(long double val, int precision, char *buf, size_t buf_size, enum scale_type scale, int group, enum round_type round) { int num_size; char fmt[64]; _Static_assert( sizeof(fmt) > (((((((sizeof(zero_padding_width) * 8) - (!((__typeof__(zero_padding_width))0 < (__typeof__(zero_padding_width))-1))) * 146 + 484) / 485) + (!((__typeof__(zero_padding_width))0 < (__typeof__(zero_padding_width))-1))) + 1) + ((((((sizeof(precision) * 8) - (!((__typeof__(precision))0 < (__typeof__(precision))-1))) * 146 + 484) / 485) + (!((__typeof__(precision))0 < (__typeof__(precision))-1))) + 1) + 10), "verify (" "sizeof (fmt) > (INT_BUFSIZE_BOUND (zero_padding_width) + " "INT_BUFSIZE_BOUND (precision) + 10 )" ")") ; char *pfmt = fmt; *pfmt++ = '%'; if (group) *pfmt++ = '\''; if (zero_padding_width) pfmt += snprintf(pfmt, sizeof(fmt) - 2, "0%ld", zero_padding_width); do { if (dev_debug) fprintf(stderr, "double_to_human:\n"); } while (0); if (scale == scale_none) { val *= powerld(10, precision); val = simple_round(val, round); val /= powerld(10, precision); do { if (dev_debug) fprintf(stderr, (group) ? " no scaling, returning (grouped) value: %'.*Lf\n" : " no scaling, returning value: %.*Lf\n", precision, val); } while (0) ; stpcpy(pfmt, ".*Lf"); num_size = snprintf(buf, buf_size, fmt, precision, val); if (num_size < 0 || num_size >= (int)buf_size) ((!!sizeof(struct { _Static_assert(1, "verify_expr (" "1" ", " "(error (1, 0, gettext (\"failed to prepare value " "'%Lf' for printing\"), val), assume (false))" ")"); int _gl_dummy; })) ? ((error(1, 0, gettext("failed to prepare value '%Lf' for printing"), val), ((0) ? (void)0 : __builtin_unreachable()))) : ((error(1, 0, gettext("failed to prepare value '%Lf' for printing"), val), ((0) ? (void)0 : __builtin_unreachable())))); return; } double scale_base = default_scale_base(scale); unsigned int power = 0; val = expld(val, scale_base, &power); do { if (dev_debug) fprintf(stderr, " scaled value to %Lf * %0.f ^ %u\n", val, scale_base, power); } while (0); unsigned int power_adjust = 0; if (user_precision != -1) power_adjust = (((power * 3) < (user_precision)) ? (power * 3) : (user_precision)); else if (absld(val) < 10) { power_adjust = 1; } val *= powerld(10, power_adjust); val = simple_round(val, round); val /= powerld(10, power_adjust); if (absld(val) >= scale_base) { val /= scale_base; power++; } int show_decimal_point = (val != 0) && (absld(val) < 10) && (power > 0); do { if (dev_debug) fprintf(stderr, " after rounding, value=%Lf * %0.f ^ %u\n", val, scale_base, power); } while (0); stpcpy(pfmt, ".*Lf%s"); int prec = user_precision == -1 ? show_decimal_point : user_precision; num_size = snprintf(buf, buf_size - 1, fmt, prec, val, suffix_power_char(power)); if (num_size < 0 || num_size >= (int)buf_size - 1) ((!!sizeof(struct { _Static_assert(1, "verify_expr (" "1" ", " "(error (1, 0, gettext (\"failed to prepare value " "'%Lf' for printing\"), val), assume (false))" ")"); int _gl_dummy; })) ? ((error(1, 0, gettext("failed to prepare value '%Lf' for printing"), val), ((0) ? (void)0 : __builtin_unreachable()))) : ((error(1, 0, gettext("failed to prepare value '%Lf' for printing"), val), ((0) ? (void)0 : __builtin_unreachable())))); if (scale == scale_IEC_I && power > 0) strncat(buf, "i", buf_size - num_size - 1); do { if (dev_debug) fprintf(stderr, " returning value: %s\n", quote(buf)); } while (0); return; }
void double_to_human(uint param_1, char *param_2, size_t param_3, int param_4, int param_5, undefined4 param_6) { int iVar1; char *__format; undefined8 uVar2; ulong uVar3; long in_FS_OFFSET; float10 in_ST1; float10 in_ST2; float10 in_ST3; float10 in_ST4; float10 in_ST5; float10 in_ST6; undefined8 uStack0000000000000008; undefined2 uStack0000000000000010; uint local_7c; undefined4 local_78; uint local_74; uint local_70; int local_6c; char *local_68; FILE *local_60; char local_58; char cStack87; char acStack86[70]; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); local_68 = &cStack87; local_58 = '%'; if (param_5 != 0) { local_68 = acStack86; cStack87 = '\''; } if (zero_padding_width != 0) { iVar1 = snprintf(local_68, 0x3e, "0%ld", zero_padding_width); local_68 = local_68 + iVar1; } if (dev_debug != '\0') { fprintf(stderr, "double_to_human:\n"); } if (param_4 == 0) { in_ST1 = in_ST4; in_ST2 = in_ST5; in_ST3 = in_ST6; powerld(param_1); in_ST4 = in_ST3; in_ST5 = in_ST3; simple_round(param_6); powerld(param_1); in_ST6 = in_ST5; if (dev_debug != '\0') { if (param_5 == 0) { __format = " no scaling, returning value: %.*Lf\n"; } else { __format = " no scaling, returning (grouped) value: %\'.*Lf\n"; } fprintf(stderr, __format, (ulong)param_1); } stpcpy(local_68, ".*Lf"); local_6c = snprintf(param_2, param_3, &local_58, (ulong)param_1); if ((-1 < local_6c) && (local_6c < (int)param_3)) goto LAB_00101323; uVar2 = gettext("failed to prepare value \'%Lf\' for printing"); error(1, 0, uVar2); } iVar1 = default_scale_base(param_4); local_60 = (FILE *)(double)iVar1; local_7c = 0; expld((long)(double)local_60 & 0xffffffff, &local_7c); if (dev_debug != '\0') { fprintf(local_60, (char *)stderr, " scaled value to %Lf * %0.f ^ %u\n", (ulong)local_7c); } local_78 = 0; if (user_precision == 0xffffffffffffffff) { in_ST2 = in_ST3; in_ST3 = in_ST4; in_ST4 = in_ST5; in_ST5 = in_ST6; absld(); if (in_ST1 < _DAT_00105240) { local_78 = 1; } } else { uVar3 = user_precision; if ((long)(ulong)(local_7c * 3) <= (long)user_precision) { uVar3 = (ulong)(local_7c * 3); } local_78 = (undefined4)uVar3; } powerld(local_78); simple_round(param_6); powerld(local_78); in_ST2 = in_ST2 / in_ST3; uStack0000000000000008 = SUB108(in_ST2, 0); uStack0000000000000010 = (undefined2)((unkuint10)in_ST2 >> 0x40); absld(); if ((float10)(double)local_60 <= in_ST4) { uStack0000000000000008 = SUB108(in_ST2 / (float10)(double)local_60, 0); uStack0000000000000010 = (undefined2)((unkuint10)(in_ST2 / (float10)(double)local_60) >> 0x40); local_7c = local_7c + 1; } if ((((float10)0 == (float10)CONCAT28(uStack0000000000000010, uStack0000000000000008)) || (absld(), _DAT_00105240 <= in_ST5)) || (local_7c == 0)) { local_74 = 0; } else { local_74 = 1; } if (dev_debug != '\0') { fprintf(local_60, (char *)stderr, " after rounding, value=%Lf * %0.f ^ %u\n", (ulong)local_7c); } stpcpy(local_68, ".*Lf%s"); local_70 = local_74; if (user_precision != 0xffffffffffffffff) { local_70 = (uint)user_precision; } uVar2 = suffix_power_char(local_7c); local_6c = snprintf(param_2, param_3 - 1, &local_58, (ulong)local_70, uVar2); if ((local_6c < 0) || ((int)param_3 + -1 <= local_6c)) { uVar2 = gettext("failed to prepare value \'%Lf\' for printing"); error(1, 0, uVar2); } if ((param_4 == 4) && (local_7c != 0)) { strncat(param_2, "i", (param_3 - (long)local_6c) - 1); } if (dev_debug != '\0') { uVar2 = quote(param_2); fprintf(stderr, " returning value: %s\n", uVar2); } LAB_00101323: if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) { __stack_chk_fail(); } return; }
coreutils
ghidra
static int should_drop_connection(int startups) { int p, r; if (startups < options.max_startups_begin) return 0; if (startups >= options.max_startups) return 1; if (options.max_startups_rate == 100) return 1; p = 100 - options.max_startups_rate; p *= startups - options.max_startups_begin; p /= options.max_startups - options.max_startups_begin; p += options.max_startups_rate; r = arc4random_uniform(100); sshlog("sshd.c", __func__, 836, 1, SYSLOG_LEVEL_DEBUG1, ((void *)0), "p %d, r %d", p, r); return (r < p) ? 1 : 0; }
_BOOL8 should_drop_connection(int a1) { int v2; long v3; long v4; unsigned int v5; int v6; unsigned int v7; unsigned int v8; if (a1 < options[1908]) return 0LL; if (a1 >= options[1910]) return 1LL; if (options[1909] == 100) return 1LL; v6 = (100 - options[1909]) * (a1 - options[1908]); v2 = options[1910] - options[1908]; v3 = (unsigned int)(v6 >> 31); LODWORD(v3) = v6 % v2; v4 = (unsigned int)options[1909]; v5 = v6 / v2 + v4; v7 = v5; v8 = arc4random_uniform(100LL, v4, v3); sshlog("sshd.c", "should_drop_connection", 836LL, 1LL, 5LL, 0LL, "p %d, r %d", v7, v8); return (int)v8 < (int)v7; }
openssh-portable
ida
static void sane_mode(struct termios *mode) { int i; tcflag_t *bitsp; for (i = 0; control_info[i].name; ++i) { mode->c_cc[control_info[i].offset] = control_info[i].saneval; } for (i = 0; mode_info[i].name != ((void *)0); ++i) { if (mode_info[i].flags & 16) continue; if (mode_info[i].flags & 1) { bitsp = mode_type_flag(mode_info[i].type, mode); ((void)sizeof((bitsp) ? 1 : 0), __extension__({ if (bitsp) ; else __assert_fail("bitsp", "src/stty.c", 2252, __extension__ __PRETTY_FUNCTION__); })); *bitsp = (*bitsp & ~mode_info[i].mask) | mode_info[i].bits; } else if (mode_info[i].flags & 2) { bitsp = mode_type_flag(mode_info[i].type, mode); ((void)sizeof((bitsp) ? 1 : 0), __extension__({ if (bitsp) ; else __assert_fail("bitsp", "src/stty.c", 2258, __extension__ __PRETTY_FUNCTION__); })); *bitsp = *bitsp & ~mode_info[i].mask & ~mode_info[i].bits; } } }
void sane_mode(long param_1) { uint *puVar1; int local_14; local_14 = 0; while (*(long *)(control_info + (long)local_14 * 0x18) != 0) { *(undefined1 *)(param_1 + 0x11 + *(long *)(control_info + (long)local_14 * 0x18 + 0x10)) = control_info[(long)local_14 * 0x18 + 8]; local_14 = local_14 + 1; } local_14 = 0; do { if (*(long *)(mode_info + (long)local_14 * 0x20) == 0) { return; } if ((mode_info[(long)local_14 * 0x20 + 0xc] & 0x10) == 0) { if ((mode_info[(long)local_14 * 0x20 + 0xc] & 1) == 0) { if ((mode_info[(long)local_14 * 0x20 + 0xc] & 2) != 0) { puVar1 = (uint *)mode_type_flag( *(undefined4 *)(mode_info + (long)local_14 * 0x20 + 8), param_1); if (puVar1 == (uint *)0x0) { __assert_fail("bitsp", "src/stty.c", 0x8d2, "sane_mode"); } *puVar1 = *puVar1 & ~(uint) * (undefined8 *)(mode_info + (long)local_14 * 0x20 + 0x18) & ~(uint) * (undefined8 *)(mode_info + (long)local_14 * 0x20 + 0x10); } } else { puVar1 = (uint *)mode_type_flag( *(undefined4 *)(mode_info + (long)local_14 * 0x20 + 8), param_1); if (puVar1 == (uint *)0x0) { __assert_fail("bitsp", "src/stty.c", 0x8cc, "sane_mode"); } *puVar1 = *puVar1 & ~(uint) * (undefined8 *)(mode_info + (long)local_14 * 0x20 + 0x18) | (uint) * (undefined8 *)(mode_info + (long)local_14 * 0x20 + 0x10); } } local_14 = local_14 + 1; } while (true); }
coreutils
ghidra
static inline void emit_ancillary_info(char const *program) { struct infomap { char const *program; char const *node; } const infomap[] = { {"[", "test invocation"}, {"coreutils", "Multi-call invocation"}, {"sha224sum", "sha2 utilities"}, {"sha256sum", "sha2 utilities"}, {"sha384sum", "sha2 utilities"}, {"sha512sum", "sha2 utilities"}, {((void *)0), ((void *)0)}}; char const *node = program; struct infomap const *map_prog = infomap; while (map_prog->program && !(strcmp(program, map_prog->program) == 0)) map_prog++; if (map_prog->node) node = map_prog->node; printf (gettext ("\n%s online help: <%s>\n"), "GNU coreutils", "https: char const *lc_messages = setlocale ( 5 , ((void *)0) ); if (lc_messages && strncmp (lc_messages, "" "en_" "", sizeof ("en_") - 1)) { fputs_unlocked (gettext ("Report any translation bugs to " "<https: stdout ) ; } char const *url_program = (strcmp (program, "[") == 0) ? "test" : program; printf (gettext ("Full documentation <%s%s>\n"), "https: printf (gettext ("or available locally via: info '(coreutils) %s%s'\n"), node, node == program ? " invocation" : ""); }
void emit_ancillary_info(char *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 v20; unsigned long long *v21; unsigned long long v22; v4 = "["; v5 = "test invocation"; v6 = "coreutils"; v7 = "Multi-call invocation"; v8 = "sha224sum"; v9 = "sha2 utilities"; v10 = "sha256sum"; v11 = "sha2 utilities"; v12 = "sha384sum"; v13 = "sha2 utilities"; v14 = "sha512sum"; v15 = "sha2 utilities"; v16 = 0; v17 = 0; v0 = a0; v1[0] = &v4; while (true) { if (!v1[0]) break; if (!strcmp(a0, v1[0])) break; v1[0] = v1 + 1; } if (v1[1]) v0 = v1[1]; printf(gettext("\n%s online help: <%s>\n")); v2 = setlocale(0x5, NULL); if (v2 && strncmp(v2, "en_", 0x3)) fputs_unlocked(gettext("Report any translation bugs to <https: if (!strcmp(a0, "[")) v20 = "test"; else v20 = a0; v3 = v20; printf(gettext("Full documentation <%s%s>\n")); printf(gettext("or available locally via: info '(coreutils) %s%s'\n")); v22 = *(&v18) ^ v21[5]; return; }
coreutils
angr_phoenix
static void enforce_one_top_level(char **pfile_name) { char *file_name = *pfile_name; char *p; for (p = file_name; *p && (((*p) == '/') || *p == '.'); p++) ; if (*p) { int pos = strlen(one_top_level_dir); if (strncmp(p, one_top_level_dir, pos) == 0) { if (((p[pos]) == '/') || p[pos] == 0) return; } *pfile_name = make_file_name(one_top_level_dir, file_name); normalize_filename_x(*pfile_name); } else *pfile_name = xstrdup(one_top_level_dir); free(file_name); }
void enforce_one_top_level(unsigned long long *a0) { unsigned int v0; char *v1; void *v2; unsigned long long v4; unsigned long long v5; unsigned long long v6; v2 = *(a0); v1 = v2; while (true) { if (!*(v1)) break; if (*(v1) != 47 && *(v1) != 46) break; v1 += 1; } if (!*(v1)) { *(a0) = xstrdup(*(&one_top_level_dir)); LABEL_400256: v6 = free(v2); goto LABEL_400265; } v0 = strlen(*(&one_top_level_dir)); if (strncmp(v1, *(&one_top_level_dir), v0)) { LABEL_40020f: *(a0) = make_file_name(*(&one_top_level_dir), v2, v2); normalize_filename_x(*(a0)); goto LABEL_400256; } else { v4 = v1[v0]; if (v1[v0] != 47) { v5 = v1[v0]; if (!(!v1[v0])) goto LABEL_40020f; } } LABEL_400265: return; }
tar
angr_phoenix
static _Bool xattrs_matches_mask(const char *kw, struct xattrs_mask_map *mm) { int i; if (!mm->size) return 0; for (i = 0; i < mm->used; i++) if (fnmatch(mm->masks[i], kw, 0) == 0) return 1; return 0; }
long xattrs_matches_mask(const char *a1, _QWORD *a2) { int i; if (!a2[1]) return 0LL; for (i = 0; (unsigned long)i < a2[2]; ++i) { if (!fnmatch(*(const char **)(8LL * i + *a2), a1, 0)) return 1LL; } return 0LL; }
tar
ida
static void ip_short(uhash_ctx_t ahc, UINT8 *nh_res, u_char *res) { UINT64 t; UINT64 *nhp = (UINT64 *)nh_res; t = ip_aux(0, ahc->ip_keys, nhp[0]); put_u32((UINT32 *)res + 0, ip_reduce_p36(t) ^ ahc->ip_trans[0]); t = ip_aux(0, ahc->ip_keys + 4, nhp[1]); put_u32((UINT32 *)res + 1, ip_reduce_p36(t) ^ ahc->ip_trans[1]); t = ip_aux(0, ahc->ip_keys + 8, nhp[2]); put_u32((UINT32 *)res + 2, ip_reduce_p36(t) ^ ahc->ip_trans[2]); t = ip_aux(0, ahc->ip_keys + 12, nhp[3]); put_u32((UINT32 *)res + 3, ip_reduce_p36(t) ^ ahc->ip_trans[3]); }
void ip_short(unsigned int a0[346], unsigned long long a1[4], unsigned long long a2) { unsigned int v0; unsigned long long v6; *(&v0) = ip_aux(0x0, &a0[310], a1[0]); put_u32(a2, a0[342] ^ ip_reduce_p36(*(&v0)), a0[342] ^ ip_reduce_p36(*(&v0))); *(&v0) = ip_aux(0x0, &a0[318], a1[1]); put_u32(a2 + 4, a0[343] ^ ip_reduce_p36(*(&v0)), a0[343] ^ ip_reduce_p36(*(&v0))); *(&v0) = ip_aux(0x0, &a0[326], a1[2]); put_u32(a2 + 8, a0[344] ^ ip_reduce_p36(*(&v0)), a0[344] ^ ip_reduce_p36(*(&v0))); *(&v0) = ip_aux(0x0, &a0[334], a1[3]); v6 = put_u32(a2 + 12, a0[345] ^ ip_reduce_p36(*(&v0)), a0[345] ^ ip_reduce_p36(*(&v0))); return; }
openssh-portable
angr_phoenix
static void request_info(void) { gnutls_ocsp_req_t req; int ret; gnutls_datum_t dat, rbuf; size_t size; ret = gnutls_ocsp_req_init(&req); if (ret < 0) { fprintf(stderr, "ocsp_req_init: %s\n", gnutls_strerror(ret)); app_exit(1); } if (ocsptool_options.present.load_request) dat.data = (void *)_gnutls_read_file(ocsptool_options.arg.load_request, 0x1, &size); else dat.data = (void *)_gnutls_fread_file(infile, 0, &size); if (dat.data == ((void *)0)) { fprintf(stderr, "error reading request\n"); app_exit(1); } dat.size = size; ret = gnutls_ocsp_req_import(req, &dat); free(dat.data); if (ret < 0) { fprintf(stderr, "error importing request: %s\n", gnutls_strerror(ret)); app_exit(1); } ret = gnutls_ocsp_req_print(req, GNUTLS_OCSP_PRINT_FULL, &dat); if (ret != 0) { fprintf(stderr, "ocsp_req_print: %s\n", gnutls_strerror(ret)); app_exit(1); } if (ocsptool_options.present.outfile) { ret = gnutls_ocsp_req_export(req, &rbuf); if (ret < 0) { fprintf(stderr, "error exporting request: %s\n", gnutls_strerror(ret)); app_exit(1); } if (outcert_format == GNUTLS_X509_FMT_PEM) { fprintf(stderr, "Cannot export requests into PEM form\n"); app_exit(1); } else { fwrite(rbuf.data, 1, rbuf.size, outfile); } gnutls_free((void *)(rbuf.data)), rbuf.data = ((void *)0); } else { printf("%.*s", dat.size, dat.data); } gnutls_free((void *)(dat.data)), dat.data = ((void *)0); gnutls_ocsp_req_deinit(req); }
void request_info() { unsigned int v0; char v1; char v2; void *v3; unsigned int v4; void *v5; char v6; char v7; unsigned long long *v9; unsigned long long v10; v0 = gnutls_ocsp_req_init(&v1); if (v0 < 0) { fprintf(*(&stderr), "ocsp_req_init: %s\n", gnutls_strerror(v0)); app_exit(0x1); } if (!g_50004a) v3 = _gnutls_fread_file(infile, 0x0, &v2); else v3 = _gnutls_read_file(gnutls_ocsp_resp_import2, 0x1, &v2); if (!v3) { fprintf(*(&stderr), "error reading request\n"); app_exit(0x1); } v4 = *(&v2); v0 = gnutls_ocsp_req_import(*(&v1), &v3, &v3); free(v3); if (v0 < 0) { fprintf(*(&stderr), "error importing request: %s\n", gnutls_strerror(v0)); app_exit(0x1); } v0 = gnutls_ocsp_req_print(*(&v1), 0x0, &v3); if (v0) { fprintf(*(&stderr), "ocsp_req_print: %s\n", gnutls_strerror(v0)); app_exit(0x1); } if (!g_50003b) { printf("%.*s", v4); } else { v0 = gnutls_ocsp_req_export(*(&v1), &v5, &v5); if (v0 < 0) { fprintf(*(&stderr), "error exporting request: %s\n", gnutls_strerror(v0)); app_exit(0x1); } else if (outcert_format == 1) { fprintf(*(&stderr), "Cannot export requests into PEM form\n"); app_exit(0x1); } else { fwrite(*(&v5), 0x1, *(&v6), outfile); *(5243000)(*(&v5)); v5 = 0; } } *(5243000)(v3); v3 = 0; gnutls_ocsp_req_deinit(*(&v1)); v10 = *(&v7) ^ v9[5]; return; }
gnutls
angr_phoenix
_Bool is_fts_enabled (int *fts_options) { *fts_options = ftsoptions; return 1; }
long long is_fts_enabled(unsigned int *a0) { *(a0) = ftsoptions; return 1; }
findutils
angr_phoenix