input
stringlengths
26
172k
output
stringlengths
18
318k
repo_name
stringclasses
23 values
decompiler
stringclasses
5 values
static void check_perms(void) { if (!amroot && !lflg) { fprintf(stderr, gettext("%s: Permission denied.\n"), Prog); fail_exit(1); } }
void check_perms() { unsigned long long v1; unsigned long long v2; v1 = amroot ^ 1; if ((amroot ^ 1)) { v2 = lflg ^ 1; if ((lflg ^ 1)) { fprintf(stderr, gettext("%s: Permission denied.\n")); fail_exit(0x1); } } if (!(amroot ^ 1) || !(lflg ^ 1)) return; }
shadow
angr_dream
static void xdup2(int from, int into) { if (from != into) { int status = close(into); if (status != 0 && (*__errno_location()) != 9) { int e = (*__errno_location()); do { if (error_hook) error_hook(); error(0, e, gettext("Cannot close")); fatal_exit(); } while (0); } status = dup(from); if (status != into) { if (status < 0) { int e = (*__errno_location()); do { if (error_hook) error_hook(); error(0, e, gettext("Cannot dup")); fatal_exit(); } while (0); } abort(); } xclose(from); } }
void xdup2(unsigned long a0, unsigned long long a1, unsigned long long a2, unsigned long long a3, unsigned long long a4, unsigned long long a5) { unsigned int v0; unsigned int v1; unsigned int v2; unsigned int v3; unsigned long long v5; unsigned long long v6; v0 = a0; v5 = a0; if (a0 != a1) { v1 = close(a1); if (v1) { *(&v5) = *(__errno_location()); if (v5 != 9) { v2 = *(__errno_location()); if (error_hook) *(5243000)(); a1 = v2; error(0x0, v2, gettext("Cannot close")); fatal_exit(0x0, reg_64, a2, a3, a4, a5); } } v1 = dup(a0); if (v1 != v2) { if (v1 < 0) { v3 = *(__errno_location()); if (error_hook) *(5243000)(); *(&a1) = v3; error(0x0, v3, gettext("Cannot dup")); fatal_exit(0x0, a1, a2, a3, a4, a5); } abort(); } else { v6 = xclose(a0); } } if (a0 == a1 || v1 == v2) return; }
tar
angr_dream
static void usage(int status) { FILE *usageout = (0 != status) ? stderr : stdout; (void)fprintf(usageout, gettext("Usage: %s [options]\n" "\n" "Options:\n") , Prog); (void)fputs(gettext(" -h, --help display this help " "message and exit\n"), usageout); (void)fputs( gettext(" -R, --root CHROOT_DIR directory to chroot into\n"), usageout); (void)fputs("\n", usageout); exit(status); }
void usage(unsigned long a0) { void *v0; unsigned long v1; unsigned long v3; v1 = v3; *(&v0) = (!a0 ? stderr : stdout); fprintf(v0, gettext("Usage: %s [options]\n\nOptions:\n")); fputs(gettext(" -h, --help display this help message and " "exit\n"), v0); fputs(gettext(" -R, --root CHROOT_DIR directory to chroot into\n"), v0); fputs("\n", v0); exit(a0); }
shadow
angr_sailr
int cert_verify(gnutls_session_t session, const char *hostname, const char *purpose) { int rc; unsigned int status = 0; gnutls_datum_t out; int type; gnutls_typed_vdata_st data[2]; unsigned elements = 0; memset(data, 0, sizeof(data)); if (hostname) { data[elements].type = GNUTLS_DT_DNS_HOSTNAME; data[elements].data = (void *)hostname; elements++; } if (purpose) { data[elements].type = GNUTLS_DT_KEY_PURPOSE_OID; data[elements].data = (void *)purpose; elements++; } rc = gnutls_certificate_verify_peers(session, data, elements, &status); if (rc == -49) { log_msg(stdout, "- Peer did not send any certificate.\n"); return 0; } if (rc < 0) { log_msg(stdout, "- Could not verify certificate (err: %s)\n", gnutls_strerror(rc)); return 0; } type = gnutls_certificate_type_get(session); rc = gnutls_certificate_verification_status_print(status, type, &out, 0); if (rc < 0) { log_msg(stdout, "- Could not print verification flags (err: %s)\n", gnutls_strerror(rc)); return 0; } log_msg(stdout, "- Status: %s\n", out.data); gnutls_free((void *)(out.data)), out.data = ((void *)0); if (status) { if (!(status & GNUTLS_CERT_INVALID)) abort(); return 0; } return 1; }
long cert_verify(long a1, long a2, long a3) { long v3; long v4; long v5; long v6; long v8; long v9; long v10; long v11; long v12; long v13; long v14; long v15; long v16; long v17; long v18; unsigned int v20; unsigned int v21; unsigned int v22; unsigned int v23; long v24; _QWORD s[8]; s[7] = __readfsqword(0x28u); v20 = 0; v21 = 0; memset(s, 0, 0x30uLL); if (a2) { LODWORD(s[3 * v21]) = 1; s[3 * v21++ + 1] = a2; } if (a3) { LODWORD(s[3 * v21]) = 2; s[3 * v21++ + 1] = a3; } v22 = gnutls_certificate_verify_peers(a1, s, v21, &v20); if (v22 == -49) { log_msg(stdout, "- Peer did not send any certificate.\n", v3, v4, v5, v6); return 0LL; } else if ((v22 & 0x80000000) == 0) { v23 = gnutls_certificate_type_get(a1); v22 = gnutls_certificate_verification_status_print(v20, v23, &v24, 0LL); if ((v22 & 0x80000000) == 0) { log_msg(stdout, "- Status: %s\n", v24, v12, v13, v14); gnutls_free(v24); v24 = 0LL; if (v20) { if ((v20 & 2) == 0) abort(); return 0LL; } else { return 1LL; } } else { v15 = gnutls_strerror(v22); log_msg(stdout, "- Could not print verification flags (err: %s)\n", v15, v16, v17, v18); return 0LL; } } else { v8 = gnutls_strerror(v22); log_msg(stdout, "- Could not verify certificate (err: %s)\n", v8, v9, v10, v11); return 0LL; } }
gnutls
ida
void dotrap(void) { char *p; char *q; int i; int status, last_status; if (!pending_sig) return; status = savestatus; last_status = status; if (__builtin_expect(!!(status < 0), 1)) { status = exitstatus; savestatus = status; } pending_sig = 0; ({ __asm__ __volatile__("" : : : "memory"); }); for (i = 0, q = gotsig; i < (64 + 1) - 1; i++, q++) { if (!*q) continue; if (evalskip) { pending_sig = i + 1; break; } *q = 0; p = trap[i + 1]; if (!p) continue; evalstring(p, 0); if (evalskip != (1 << 2)) exitstatus = status; } savestatus = last_status; }
long long dotrap() { unsigned int v0; unsigned int v1; unsigned int v2; unsigned long long v3; unsigned long long v4; unsigned long long v6; v6 = 17042544940070553685; v1 = savestatus; v2 = v1; if ((v1 >> 31)) { v1 = exitstatus; savestatus = v1; } gotsigchld = 0; v0 = 0; v3 = &gotsig; while (true) { if (v0 > 63) break; if (*(v3)) { if (!evalskip) { *(v3) = 0; v4 = (&sigmode)[1 + v0]; if (v4) { evalstring(v4, 0x0); if (evalskip != 4) exitstatus = v1; } } else { gotsigchld = v0 + 1; break; } } v0 += 1; v3 += 1; } v6 = v2; savestatus = v2; return v6; }
dash-0.5.11+git20210903+057cd650a4ed
angr_phoenix
static void volume_size_decoder(struct tar_stat_info *st, char const *keyword, char const *arg, size_t size) { uintmax_t u; if (decode_num( &u, arg, ((uintmax_t)(!(!((uintmax_t)0 < (uintmax_t)-1)) ? (uintmax_t)-1 : ((((uintmax_t)1 << ((sizeof(uintmax_t) * 8) - 2)) - 1) * 2 + 1))), keyword)) continued_file_size = u; }
long long volume_size_decoder(unsigned long a0, unsigned int a1, unsigned long a2, unsigned long a3) { unsigned long v0; unsigned long v1; char v2; v1 = a0; v0 = a3; if (decode_num(&v2, a2, 0xffffffffffffffff, a1)) continued_file_size = *(&v2); return 0; }
tar
angr_dream
static _Bool tar_sparse_dump_header(struct tar_sparse_file *file) { if (file->optab->dump_header) return file->optab->dump_header(file); return 0; }
undefined8 tar_sparse_dump_header(long param_1) { undefined8 uVar1; if (*(long *)(*(long *)(param_1 + 0x20) + 0x18) == 0) { uVar1 = 0; } else { uVar1 = (**(code **)(*(long *)(param_1 + 0x20) + 0x18))(param_1); } return uVar1; }
tar
ghidra
int inflateBackInit_(strm, windowBits, window, version, stream_size) z_streamp strm; int windowBits; unsigned char *window; const char *version; int stream_size; { struct inflate_state *state; if (version == 0 || version[0] != "1.2.13"[0] || stream_size != (int)(sizeof(z_stream))) return (-6); if (strm == 0 || window == 0 || windowBits < 8 || windowBits > 15) return (-2); strm->msg = 0; if (strm->zalloc == (alloc_func)0) { strm->zalloc = zcalloc; strm->opaque = (voidpf)0; } if (strm->zfree == (free_func)0) strm->zfree = zcfree; state = (struct inflate_state *)(*((strm)->zalloc))( (strm)->opaque, (1), (sizeof(struct inflate_state))); if (state == 0) return (-4); ; strm->state = (struct internal_state *)state; state->dmax = 32768U; state->wbits = (uInt)windowBits; state->wsize = 1U << windowBits; state->window = window; state->wnext = 0; state->whave = 0; state->sane = 1; return 0; }
long inflateBackInit_(_QWORD *a1, int a2, long a3, _BYTE *a4, int a5) { long v7; if (!a4 || *a4 != 49 || a5 != 112) return 4294967290LL; if (!a1 || !a3 || a2 <= 7 || a2 > 15) return 4294967294LL; a1[6] = 0LL; if (!a1[8]) { a1[8] = &zcalloc; a1[10] = 0LL; } if (!a1[9]) a1[9] = &zcfree; v7 = ((long (*)(_QWORD, long, long))a1[8])(a1[10], 1LL, 7160LL); if (!v7) return 4294967292LL; a1[7] = v7; *(_DWORD *)(v7 + 28) = 0x8000; *(_DWORD *)(v7 + 56) = a2; *(_DWORD *)(v7 + 60) = 1 << a2; *(_QWORD *)(v7 + 72) = a3; *(_DWORD *)(v7 + 68) = 0; *(_DWORD *)(v7 + 64) = 0; *(_DWORD *)(v7 + 7144) = 1; return 0LL; }
zlib
ida
static z_word_t byte_swap(word) z_word_t word; { return (word & 0xff00000000000000) >> 56 | (word & 0xff000000000000) >> 40 | (word & 0xff0000000000) >> 24 | (word & 0xff00000000) >> 8 | (word & 0xff000000) << 8 | (word & 0xff0000) << 24 | (word & 0xff00) << 40 | (word & 0xff) << 56; }
ulong byte_swap(ulong param_1) { return param_1 << 0x38 | param_1 >> 0x38 | (ulong)((uint)(param_1 >> 0x28) & 0xff00) | (ulong)((uint)(param_1 >> 0x18) & 0xff0000) | (ulong)((uint)(param_1 >> 8) & 0xff000000) | (param_1 & 0xff000000) << 8 | (param_1 & 0xff0000) << 0x18 | (param_1 & 0xff00) << 0x28; }
zlib
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 *param_1) { FILE *__stream; int iVar1; char *pcVar2; char *pcVar3; long in_FS_OFFSET; char *local_b8; char **local_b0; char *local_98; char *local_90; char *local_88; char *local_80; char *local_78; char *local_70; char *local_68; char *local_60; char *local_58; char *local_50; char *local_48; char *local_40; undefined8 local_38; undefined8 local_30; long local_20; local_20 = *(long *)(in_FS_OFFSET + 0x28); local_98 = "["; local_90 = "test invocation"; local_88 = "coreutils"; local_80 = "Multi-call invocation"; local_78 = "sha224sum"; local_70 = "sha2 utilities"; local_68 = "sha256sum"; local_60 = "sha2 utilities"; local_58 = "sha384sum"; local_50 = "sha2 utilities"; local_48 = "sha512sum"; local_40 = "sha2 utilities"; local_38 = 0; local_30 = 0; local_b0 = &local_98; while ((*local_b0 != (char *)0x0 && (iVar1 = strcmp(param_1, *local_b0), iVar1 != 0))) { local_b0 = local_b0 + 2; } local_b8 = param_1; if (local_b0[1] != (char *)0x0) { local_b8 = local_b0[1]; } pcVar2 = (char *)gettext("\n%s online help: <%s>\n"); printf(pcVar2,"GNU coreutils","https: pcVar2 = setlocale(5,(char *)0x0); if ((pcVar2 != (char *)0x0) && (iVar1 = strncmp(pcVar2,"en_",3), __stream = stdout, iVar1 != 0)) { pcVar2 = (char *)gettext("Report any translation bugs to <https: ); fputs_unlocked(pcVar2, __stream); } iVar1 = strcmp(param_1,"["); pcVar2 = param_1; if (iVar1 == 0) { pcVar2 = "test"; } pcVar3 = (char *)gettext("Full documentation <%s%s>\n"); printf(pcVar3,"https: if (local_b8 == param_1) { pcVar2 = " invocation"; } else { pcVar2 = ""; } pcVar3 = (char *)gettext("or available locally via: info \'(coreutils) %s%s\'\n"); printf(pcVar3,local_b8,pcVar2); if (local_20 == *(long *)(in_FS_OFFSET + 0x28)) { return; } __stack_chk_fail(); }
coreutils
ghidra
static inline __u16 rta_getattr_u16(const struct rtattr *rta) { return *(__u16 *)(( void *)(((char *)(rta)) + ((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0)))); }
int rta_getattr_u16(struct_0 *a0) { return a0->field_4; }
iproute2-6.0.0
angr_sailr
int zip(in, out) int in, out; { uch flags = 0; ush attr = 0; ush deflate_flags = 0; ulg stamp; ifd = in; ofd = out; outcnt = 0; method = 8; { outbuf[outcnt++] = (uch)("\037\213"[0]); if (outcnt == 0x40000) flush_outbuf(); }; { outbuf[outcnt++] = (uch)("\037\213"[1]); if (outcnt == 0x40000) flush_outbuf(); }; { outbuf[outcnt++] = (uch)(8); if (outcnt == 0x40000) flush_outbuf(); }; if (save_orig_name) { flags |= 0x08; } { outbuf[outcnt++] = (uch)(flags); if (outcnt == 0x40000) flush_outbuf(); }; if (time_stamp.tv_nsec < 0) stamp = 0; else if (0 < time_stamp.tv_sec && time_stamp.tv_sec <= 0xffffffff) stamp = time_stamp.tv_sec; else { warning("file timestamp out of range for gzip format"); stamp = 0; } { { if (outcnt < 0x40000 - 2) { outbuf[outcnt++] = (uch)(((stamp) & 0xffff) & 0xff); outbuf[outcnt++] = (uch)((ush)((stamp) & 0xffff) >> 8); } else { { outbuf[outcnt++] = (uch)((uch)(((stamp) & 0xffff) & 0xff)); if (outcnt == 0x40000) flush_outbuf(); }; { outbuf[outcnt++] = (uch)((uch)((ush)((stamp) & 0xffff) >> 8)); if (outcnt == 0x40000) flush_outbuf(); }; } }; { if (outcnt < 0x40000 - 2) { outbuf[outcnt++] = (uch)((((ulg)(stamp)) >> 16) & 0xff); outbuf[outcnt++] = (uch)((ush)(((ulg)(stamp)) >> 16) >> 8); } else { { outbuf[outcnt++] = (uch)((uch)((((ulg)(stamp)) >> 16) & 0xff)); if (outcnt == 0x40000) flush_outbuf(); }; { outbuf[outcnt++] = (uch)((uch)((ush)(((ulg)(stamp)) >> 16) >> 8)); if (outcnt == 0x40000) flush_outbuf(); }; } }; }; updcrc(((void *)0), 0); bi_init(out); ct_init(&attr, &method); if (level == 1) deflate_flags |= FAST; else if (level == 9) deflate_flags |= SLOW; { outbuf[outcnt++] = (uch)((uch)deflate_flags); if (outcnt == 0x40000) flush_outbuf(); }; { outbuf[outcnt++] = (uch)(0x03); if (outcnt == 0x40000) flush_outbuf(); }; if (save_orig_name) { char *p = gzip_base_name(ifname); do { { outbuf[outcnt++] = (uch)(*p); if (outcnt == 0x40000) flush_outbuf(); }; } while (*p++); } header_bytes = (off_t)outcnt; deflate(level); if (ifile_size != -1L && bytes_in != ifile_size) { fprintf(stderr, "%s: %s: file size changed while zipping\n", program_name, ifname); } { { if (outcnt < 0x40000 - 2) { outbuf[outcnt++] = (uch)(((getcrc()) & 0xffff) & 0xff); outbuf[outcnt++] = (uch)((ush)((getcrc()) & 0xffff) >> 8); } else { { outbuf[outcnt++] = (uch)((uch)(((getcrc()) & 0xffff) & 0xff)); if (outcnt == 0x40000) flush_outbuf(); }; { outbuf[outcnt++] = (uch)((uch)((ush)((getcrc()) & 0xffff) >> 8)); if (outcnt == 0x40000) flush_outbuf(); }; } }; { if (outcnt < 0x40000 - 2) { outbuf[outcnt++] = (uch)((((ulg)(getcrc())) >> 16) & 0xff); outbuf[outcnt++] = (uch)((ush)(((ulg)(getcrc())) >> 16) >> 8); } else { { outbuf[outcnt++] = (uch)((uch)((((ulg)(getcrc())) >> 16) & 0xff)); if (outcnt == 0x40000) flush_outbuf(); }; { outbuf[outcnt++] = (uch)((uch)((ush)(((ulg)(getcrc())) >> 16) >> 8)); if (outcnt == 0x40000) flush_outbuf(); }; } }; }; { { if (outcnt < 0x40000 - 2) { outbuf[outcnt++] = (uch)((((ulg)bytes_in) & 0xffff) & 0xff); outbuf[outcnt++] = (uch)((ush)(((ulg)bytes_in) & 0xffff) >> 8); } else { { outbuf[outcnt++] = (uch)((uch)((((ulg)bytes_in) & 0xffff) & 0xff)); if (outcnt == 0x40000) flush_outbuf(); }; { outbuf[outcnt++] = (uch)((uch)((ush)(((ulg)bytes_in) & 0xffff) >> 8)); if (outcnt == 0x40000) flush_outbuf(); }; } }; { if (outcnt < 0x40000 - 2) { outbuf[outcnt++] = (uch)((((ulg)((ulg)bytes_in)) >> 16) & 0xff); outbuf[outcnt++] = (uch)((ush)(((ulg)((ulg)bytes_in)) >> 16) >> 8); } else { { outbuf[outcnt++] = (uch)((uch)((((ulg)((ulg)bytes_in)) >> 16) & 0xff)); if (outcnt == 0x40000) flush_outbuf(); }; { outbuf[outcnt++] = (uch)((uch)((ush)(((ulg)((ulg)bytes_in)) >> 16) >> 8)); if (outcnt == 0x40000) flush_outbuf(); }; } }; }; header_bytes += 2 * 4; flush_outbuf(); return 0; }
undefined8 zip(undefined4 param_1, undefined4 param_2) { char *pcVar1; char cVar2; undefined uVar3; undefined extraout_AH; undefined extraout_AH_00; undefined extraout_var; undefined extraout_var_00; undefined extraout_var_01; undefined extraout_var_02; ulong uVar4; long in_FS_OFFSET; undefined local_25; undefined2 local_24; ushort local_22; long local_20; char *local_18; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); local_25 = 0; if (save_orig_name != 0) { local_25 = 8; } DAT_0010102b = local_25; DAT_0010102a = 8; DAT_00101029 = 0x8b; outbuf = 0x1f; local_22 = 0; local_24 = 0; _method = 8; outcnt = 4; ifd = param_1; _ofd = param_2; if (_warning < 0) { local_20 = 0; } else if ((time_stamp < 1) || (0xffffffff < time_stamp)) { warning("file timestamp out of range for gzip format"); local_20 = 0; } else { local_20 = time_stamp; } if (outcnt < 0x3fffe) { uVar4 = (ulong)outcnt; outcnt = outcnt + 1; (&outbuf)[uVar4] = (char)local_20; uVar4 = (ulong)outcnt; outcnt = outcnt + 1; (&outbuf)[uVar4] = (char)((ulong)local_20 >> 8); } else { uVar4 = (ulong)outcnt; outcnt = outcnt + 1; (&outbuf)[uVar4] = (char)local_20; if (outcnt == 0x40000) { flush_outbuf(); } uVar4 = (ulong)outcnt; outcnt = outcnt + 1; (&outbuf)[uVar4] = (char)((ulong)local_20 >> 8); if (outcnt == 0x40000) { flush_outbuf(); } } uVar3 = (undefined)((ulong)local_20 >> 0x10); if (outcnt < 0x3fffe) { uVar4 = (ulong)outcnt; outcnt = outcnt + 1; (&outbuf)[uVar4] = uVar3; uVar4 = (ulong)outcnt; outcnt = outcnt + 1; (&outbuf)[uVar4] = (char)((ulong)local_20 >> 0x18); } else { uVar4 = (ulong)outcnt; outcnt = outcnt + 1; (&outbuf)[uVar4] = uVar3; if (outcnt == 0x40000) { flush_outbuf(); } uVar4 = (ulong)outcnt; outcnt = outcnt + 1; (&outbuf)[uVar4] = (char)((ulong)local_20 >> 0x18); if (outcnt == 0x40000) { flush_outbuf(); } } updcrc(0, 0); bi_init(param_2); ct_init(&local_24, &method); if (level == 1) { local_22 = local_22 | 4; } else if (level == 9) { local_22 = local_22 | 2; } uVar4 = (ulong)outcnt; outcnt = outcnt + 1; (&outbuf)[uVar4] = (char)local_22; if (outcnt == 0x40000) { flush_outbuf(); } uVar4 = (ulong)outcnt; outcnt = outcnt + 1; (&outbuf)[uVar4] = 3; if (outcnt == 0x40000) { flush_outbuf(); } if (save_orig_name != 0) { local_18 = (char *)gzip_base_name(&ifname); do { uVar4 = (ulong)outcnt; outcnt = outcnt + 1; (&outbuf)[uVar4] = *local_18; if (outcnt == 0x40000) { flush_outbuf(); } pcVar1 = local_18 + 1; cVar2 = *local_18; local_18 = pcVar1; } while (cVar2 != '\0'); } header_bytes = (ulong)outcnt; deflate(level); if ((ifile_size != -1) && (bytes_in != ifile_size)) { fprintf(stderr, "%s: %s: file size changed while zipping\n", program_name, &ifname); } if (outcnt < 0x3fffe) { uVar3 = getcrc(); uVar4 = (ulong)outcnt; outcnt = outcnt + 1; (&outbuf)[uVar4] = uVar3; getcrc(); uVar4 = (ulong)outcnt; outcnt = outcnt + 1; (&outbuf)[uVar4] = extraout_AH; } else { uVar3 = getcrc(); uVar4 = (ulong)outcnt; outcnt = outcnt + 1; (&outbuf)[uVar4] = uVar3; if (outcnt == 0x40000) { flush_outbuf(); } getcrc(); uVar4 = (ulong)outcnt; outcnt = outcnt + 1; (&outbuf)[uVar4] = extraout_AH_00; if (outcnt == 0x40000) { flush_outbuf(); } } if (outcnt < 0x3fffe) { getcrc(); uVar4 = (ulong)outcnt; outcnt = outcnt + 1; (&outbuf)[uVar4] = extraout_var; getcrc(); uVar4 = (ulong)outcnt; outcnt = outcnt + 1; (&outbuf)[uVar4] = extraout_var_01; } else { getcrc(); uVar4 = (ulong)outcnt; outcnt = outcnt + 1; (&outbuf)[uVar4] = extraout_var_00; if (outcnt == 0x40000) { flush_outbuf(); } getcrc(); uVar4 = (ulong)outcnt; outcnt = outcnt + 1; (&outbuf)[uVar4] = extraout_var_02; if (outcnt == 0x40000) { flush_outbuf(); } } if (outcnt < 0x3fffe) { uVar4 = (ulong)outcnt; outcnt = outcnt + 1; (&outbuf)[uVar4] = (char)bytes_in; uVar4 = (ulong)outcnt; outcnt = outcnt + 1; (&outbuf)[uVar4] = (char)((ulong)bytes_in >> 8); } else { uVar4 = (ulong)outcnt; outcnt = outcnt + 1; (&outbuf)[uVar4] = (char)bytes_in; if (outcnt == 0x40000) { flush_outbuf(); } uVar4 = (ulong)outcnt; outcnt = outcnt + 1; (&outbuf)[uVar4] = (char)((ulong)bytes_in >> 8); if (outcnt == 0x40000) { flush_outbuf(); } } uVar3 = (undefined)((ulong)bytes_in >> 0x10); if (outcnt < 0x3fffe) { uVar4 = (ulong)outcnt; outcnt = outcnt + 1; (&outbuf)[uVar4] = uVar3; uVar4 = (ulong)outcnt; outcnt = outcnt + 1; (&outbuf)[uVar4] = (char)((ulong)bytes_in >> 0x18); } else { uVar4 = (ulong)outcnt; outcnt = outcnt + 1; (&outbuf)[uVar4] = uVar3; if (outcnt == 0x40000) { flush_outbuf(); } uVar4 = (ulong)outcnt; outcnt = outcnt + 1; (&outbuf)[uVar4] = (char)((ulong)bytes_in >> 0x18); if (outcnt == 0x40000) { flush_outbuf(); } } header_bytes = header_bytes + 8; flush_outbuf(); if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) { __stack_chk_fail(); } return 0; }
gzip-1.12
ghidra
static int sig_sign(const char *keypath, const char *sig_namespace, int require_agent, int argc, char **argv, char *const *opts, size_t nopts) { int i, fd = -1, r, ret = -1; int agent_fd = -1; struct sshkey *pubkey = ((void *)0), *privkey = ((void *)0), *signkey = ((void *)0); sshsig_signer *signer = ((void *)0); char *hashalg = ((void *)0); for (i = 0; i < argc; i++) { if (strcmp(argv[i], "-") != 0) continue; if (i > 0 || argc > 1) sshfatal("ssh-keygen.c", __func__, 2702, 0, SYSLOG_LEVEL_FATAL, ((void *)0), "Cannot sign mix of paths and standard input"); } if (sig_process_opts(opts, nopts, &hashalg, ((void *)0), ((void *)0)) != 0) goto done; if ((r = sshkey_load_public(keypath, &pubkey, ((void *)0))) != 0) { sshlog("ssh-keygen.c", __func__, 2709, 0, SYSLOG_LEVEL_ERROR, ssh_err(r), "Couldn't load public key %s", keypath); goto done; } if ((r = ssh_get_authentication_socket(&agent_fd)) != 0) { if (require_agent) sshfatal("ssh-keygen.c", __func__, 2715, 0, SYSLOG_LEVEL_FATAL, ((void *)0), "Couldn't get agent socket"); sshlog("ssh-keygen.c", __func__, 2716, 0, SYSLOG_LEVEL_DEBUG1, ssh_err(r), "Couldn't get agent socket"); } else { if ((r = ssh_agent_has_key(agent_fd, pubkey)) == 0) signer = agent_signer; else { if (require_agent) sshfatal("ssh-keygen.c", __func__, 2722, 0, SYSLOG_LEVEL_FATAL, ((void *)0), "Couldn't find key in agent"); sshlog("ssh-keygen.c", __func__, 2723, 0, SYSLOG_LEVEL_DEBUG1, ssh_err(r), "Couldn't find key in agent"); } } if (signer == ((void *)0)) { if ((privkey = load_sign_key(keypath, pubkey)) == ((void *)0)) goto done; signkey = privkey; } else { signkey = pubkey; } if (argc == 0) { if ((r = sign_one(signkey, "(stdin)", 0, sig_namespace, hashalg, signer, &agent_fd)) != 0) goto done; } else { for (i = 0; i < argc; i++) { if (strcmp(argv[i], "-") == 0) fd = 0; else if ((fd = open(argv[i], 00)) == -1) { sshlog("ssh-keygen.c", __func__, 2746, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "Cannot open %s for signing: %s", argv[i], strerror((*__errno_location()))); goto done; } if ((r = sign_one(signkey, argv[i], fd, sig_namespace, hashalg, signer, &agent_fd)) != 0) goto done; if (fd != 0) close(fd); fd = -1; } } ret = 0; done: if (fd != -1 && fd != 0) close(fd); sshkey_free(pubkey); sshkey_free(privkey); free(hashalg); return ret; }
undefined4 sig_sign(undefined8 param_1, undefined8 param_2, int param_3, int param_4, long param_5, undefined8 param_6, undefined8 param_7) { undefined8 uVar1; long lVar2; void *pvVar3; code *pcVar4; int iVar5; undefined8 uVar6; int *piVar7; char *pcVar8; undefined *puVar9; undefined *puVar10; long in_FS_OFFSET; char *apcStack160[3]; undefined auStack136[8]; undefined8 local_80; long local_78; int local_70; int local_6c; undefined8 local_68; undefined8 local_60; undefined4 local_4c; int local_48; int local_44; undefined4 local_40; int local_3c; long local_38; void *local_30; long local_28; long local_20; code *local_18; long local_10; local_60 = param_1; local_68 = param_2; local_6c = param_3; local_70 = param_4; local_78 = param_5; local_80 = param_6; local_10 = *(long *)(in_FS_OFFSET + 0x28); local_44 = -1; local_40 = 0xffffffff; local_4c = 0xffffffff; local_38 = 0; local_28 = 0; local_20 = 0; local_18 = (code *)0x0; local_30 = (void *)0x0; puVar10 = auStack136; for (local_48 = 0; local_48 < local_70; local_48 = __addvsi3(local_48, 1)) { pcVar8 = *(char **)(local_78 + (long)local_48 * 8); *(undefined8 *)(puVar10 + -8) = 0x10ae09; iVar5 = strcmp(pcVar8, "-"); puVar9 = puVar10; if ((iVar5 == 0) && ((0 < local_48 || (1 < local_70)))) { puVar9 = puVar10 + -0x10; *(char **)(puVar10 + -0x10) = "Cannot sign mix of paths and standard input"; *(undefined8 *)(puVar10 + -0x18) = 0x10ae53; sshfatal("ssh-keygen.c", "sig_sign", 0xa8e, 0, 1, 0); } *(undefined8 *)(puVar9 + -8) = 0x10ae61; puVar10 = puVar9; } *(undefined8 *)(puVar10 + -8) = 0x10ae8f; iVar5 = sig_process_opts(local_80, param_7, &local_30, 0, 0); if (iVar5 == 0) { *(undefined8 *)(puVar10 + -8) = 0x10aeaf; local_3c = sshkey_load_public(local_60, &local_38, 0); if (local_3c == 0) { *(undefined8 *)(puVar10 + -8) = 0x10af0d; local_3c = ssh_get_authentication_socket(); if (local_3c == 0) { *(undefined8 *)(puVar10 + -8) = 0x10afb5; local_3c = ssh_agent_has_key(local_4c, local_38); if (local_3c == 0) { local_18 = agent_signer; } else { if (local_6c != 0) { *(char **)(puVar10 + -0x10) = "Couldn\'t find key in agent"; *(undefined8 *)(puVar10 + -0x18) = 0x10b00e; sshfatal("ssh-keygen.c", "sig_sign", 0xaa2, 0, 1, 0); puVar10 = puVar10 + -0x10; } iVar5 = local_3c; *(undefined8 *)(puVar10 + -8) = 0x10b018; uVar6 = ssh_err(iVar5); *(char **)(puVar10 + -0x10) = "Couldn\'t find key in agent"; *(undefined8 *)(puVar10 + -0x18) = 0x10b04f; sshlog("ssh-keygen.c", "sig_sign", 0xaa3, 0, 5, uVar6); } } else { if (local_6c != 0) { *(char **)(puVar10 + -0x10) = "Couldn\'t get agent socket"; *(undefined8 *)(puVar10 + -0x18) = 0x10af5a; sshfatal("ssh-keygen.c", "sig_sign", 0xa9b, 0, 1, 0); puVar10 = puVar10 + -0x10; } iVar5 = local_3c; *(undefined8 *)(puVar10 + -8) = 0x10af64; uVar6 = ssh_err(iVar5); *(char **)(puVar10 + -0x10) = "Couldn\'t get agent socket"; *(undefined8 *)(puVar10 + -0x18) = 0x10af9b; sshlog("ssh-keygen.c", "sig_sign", 0xa9c, 0, 5, uVar6); } lVar2 = local_38; uVar6 = local_60; if (local_18 == (code *)0x0) { *(undefined8 *)(puVar10 + -8) = 0x10b06d; local_28 = load_sign_key(uVar6, lVar2); if (local_28 == 0) goto LAB_0010b24a; local_20 = local_28; } else { local_20 = local_38; } pcVar4 = local_18; lVar2 = local_20; pvVar3 = local_30; uVar6 = local_68; if (local_70 == 0) { *(undefined4 **)(puVar10 + -0x10) = &local_4c; *(undefined8 *)(puVar10 + -0x18) = 0x10b0ca; local_3c = sign_one(lVar2, "(stdin)", 0, uVar6, pvVar3, pcVar4); if (local_3c != 0) goto LAB_0010b24a; } else { local_48 = 0; while (local_48 < local_70) { pcVar8 = *(char **)(local_78 + (long)local_48 * 8); *(undefined8 *)(puVar10 + -8) = 0x10b112; iVar5 = strcmp(pcVar8, "-"); if (iVar5 == 0) { local_44 = 0; } else { pcVar8 = *(char **)(local_78 + (long)local_48 * 8); *(undefined8 *)(puVar10 + -8) = 0x10b14b; local_44 = open(pcVar8, 0); if (local_44 == -1) { *(undefined8 *)(puVar10 + -8) = 0x10b159; piVar7 = __errno_location(); iVar5 = *piVar7; *(undefined8 *)(puVar10 + -8) = 0x10b162; pcVar8 = strerror(iVar5); uVar6 = *(undefined8 *)(local_78 + (long)local_48 * 8); *(char **)(puVar10 + -0x10) = pcVar8; *(undefined8 *)(puVar10 + -0x18) = uVar6; *(char **)(puVar10 + -0x20) = "Cannot open %s for signing: %s"; *(undefined8 *)(puVar10 + -0x28) = 0x10b1b6; sshlog("ssh-keygen.c", "sig_sign", 0xaba, 0, 2, 0); goto LAB_0010b24a; } } pcVar4 = local_18; lVar2 = local_20; pvVar3 = local_30; iVar5 = local_44; uVar1 = local_68; uVar6 = *(undefined8 *)(local_78 + (long)local_48 * 8); *(undefined4 **)(puVar10 + -0x10) = &local_4c; *(undefined8 *)(puVar10 + -0x18) = 0x10b1fa; local_3c = sign_one(lVar2, uVar6, iVar5, uVar1, pvVar3, pcVar4); iVar5 = local_44; if (local_3c != 0) goto LAB_0010b24a; if (local_44 != 0) { *(undefined8 *)(puVar10 + -8) = 0x10b217; close(iVar5); } iVar5 = local_48; local_44 = -1; *(undefined8 *)(puVar10 + -8) = 0x10b22b; local_48 = __addvsi3(iVar5, 1); } } local_40 = 0; } else { *(undefined8 *)(puVar10 + -8) = 0x10aec2; uVar6 = ssh_err(local_3c); *(undefined8 *)(puVar10 + -8) = local_60; *(char **)(puVar10 + -0x10) = "Couldn\'t load public key %s"; *(undefined8 *)(puVar10 + -0x18) = 0x10aef8; sshlog("ssh-keygen.c", "sig_sign", 0xa95, 0, 2, uVar6); } } LAB_0010b24a: iVar5 = local_44; if ((local_44 != -1) && (local_44 != 0)) { *(undefined8 *)(puVar10 + -8) = 0x10b260; close(iVar5); } lVar2 = local_38; *(undefined8 *)(puVar10 + -8) = 0x10b26c; sshkey_free(lVar2); lVar2 = local_28; *(undefined8 *)(puVar10 + -8) = 0x10b278; sshkey_free(lVar2); pvVar3 = local_30; *(undefined8 *)(puVar10 + -8) = 0x10b284; free(pvVar3); if (local_10 == *(long *)(in_FS_OFFSET + 0x28)) { return local_40; } *(undefined8 *)(puVar10 + -8) = 0x10b29b; __stack_chk_fail(); }
openssh-portable
ghidra
static void tty__getchar(struct termios *td, unsigned char *s) { s[0] = td->c_cc[0]; s[1] = td->c_cc[1]; s[2] = td->c_cc[2]; s[3] = td->c_cc[3]; s[4] = td->c_cc[4]; s[5] = td->c_cc[11]; s[6] = td->c_cc[16]; s[10] = td->c_cc[8]; s[11] = td->c_cc[9]; s[12] = td->c_cc[14]; s[13] = td->c_cc[10]; s[15] = td->c_cc[12]; s[16] = td->c_cc[13]; s[17] = td->c_cc[15]; s[23] = td->c_cc[6]; s[24] = td->c_cc[5]; }
void tty__getchar(char a0[34], char a1[25]) { char v0; unsigned long long v2; unsigned long long v3; a1[0] = a0[17]; a1[1] = a0[18]; a1[2] = a0[19]; a1[3] = a0[20]; a1[4] = a0[21]; a1[5] = a0[28]; a1[6] = a0[33]; a1[10] = a0[25]; a1[11] = a0[26]; a1[12] = a0[31]; a1[13] = a0[27]; a1[15] = a0[29]; a1[16] = a0[30]; a1[17] = a0[32]; a1[23] = a0[23]; v2 = a0[22]; a1[24] = a0[22]; v3 = *(&v0); return; }
libedit
angr_sailr
static char *host_specific_filename(const char *prefix, const char *suffix) { static char safename[4096]; char hostname[4096]; if (gethostname(hostname, sizeof hostname) != 0) return ((void *)0); if (prefix) { if (!glue_strings(safename, sizeof safename, prefix, hostname, '.')) return ((void *)0); strcpy(hostname, safename); } if (suffix) { if (!glue_strings(safename, sizeof safename, hostname, suffix, '.')) return ((void *)0); } return safename; }
int host_specific_filename(unsigned long long a0, unsigned long long a1) { char v0; unsigned long long v1; unsigned int v3; v1 = *(&v1); if (gethostname(&v0, 0x1000)) { v3 = 0; } else { if (a0) { if (!glue_strings(&safename.4843, 0x1000, a0, &v0, 0x2e)) { v3 = 0; goto LABEL_4011ef; } else { strcpy(&v0, &safename.4843); } } if (a1 && !glue_strings(&safename.4843, 0x1000, &v0, a1, 0x2e)) { v3 = 0; goto LABEL_4011ef; } v3 = &safename.4843; } LABEL_4011ef: return v3; }
cronie
angr_phoenix
static char *gidtostr_ptr(gid_t const *gid) { static char buf[((((((sizeof(uintmax_t) * 8) - (!((__typeof__(uintmax_t))0 < (__typeof__(uintmax_t))-1))) * 146 + 484) / 485) + (!((__typeof__(uintmax_t))0 < (__typeof__(uintmax_t))-1))) + 1)]; return umaxtostr(*gid, buf); }
long gidtostr_ptr(unsigned int *a1) { return umaxtostr(*a1, &buf_5863); }
coreutils
ida
int xstrmatch(pattern, string, flags) char *pattern; char *string; int flags; { int ret; size_t n; wchar_t *wpattern, *wstring; size_t plen, slen, mplen, mslen; if ((__ctype_get_mb_cur_max()) == 1) return (internal_strmatch((unsigned char *)pattern, (unsigned char *)string, flags)); if (mbsmbchar(string) == 0 && mbsmbchar(pattern) == 0 && posix_cclass_only(pattern)) return (internal_strmatch((unsigned char *)pattern, (unsigned char *)string, flags)); n = xdupmbstowcs(&wpattern, ((void *)0), pattern); if (n == (size_t)-1 || n == (size_t)-2) return (internal_strmatch((unsigned char *)pattern, (unsigned char *)string, flags)); n = xdupmbstowcs(&wstring, ((void *)0), string); if (n == (size_t)-1 || n == (size_t)-2) { sh_xfree((wpattern), "smatch.c", 625); return (internal_strmatch((unsigned char *)pattern, (unsigned char *)string, flags)); } ret = internal_wstrmatch(wpattern, wstring, flags); sh_xfree((wpattern), "smatch.c", 631); sh_xfree((wstring), "smatch.c", 632); return ret; }
long long xstrmatch(char *a0, char *a1, unsigned long a2, unsigned long long a3, unsigned long long a4, unsigned long long a5) { unsigned int v0; char v1; char v2; unsigned long v3; unsigned long long v5; if (__ctype_get_mb_cur_max(a0, a1, a2, a3, a4, a5) == 1) { v5 = internal_strmatch(a0, a1, a2); } else { if (!mbsmbchar(a1) && !mbsmbchar(a0) && posix_cclass_only(a0)) { v5 = internal_strmatch(a0, a1, a2); goto LABEL_4048d3; } v3 = xdupmbstowcs(&v1, 0x0, a0); if (v3 == -1) { LABEL_404815: v5 = internal_strmatch(a0, a1, a2); } else { if (v3 == -2) goto LABEL_404815; v3 = xdupmbstowcs(&v2, 0x0, a1); if (v3 == -1) { LABEL_404857: sh_xfree(*(&v1), "smatch.c", 0x271); v5 = internal_strmatch(a0, a1, a2); } else { if (v3 == -2) goto LABEL_404857; v0 = internal_wstrmatch(*(&v1), *(&v2), a2); sh_xfree(*(&v1), "smatch.c", 0x277); sh_xfree(*(&v2), "smatch.c", 0x278); v5 = v0; } } } LABEL_4048d3: return v5; }
bash
angr_phoenix
struct sshkey *_ssh_host_public_key(int type, int nid, struct ssh *ssh) { struct key_entry *k; sshlog("ssh_api.c", __func__, 471, 1, SYSLOG_LEVEL_DEBUG3, ((void *)0), "need %d", type); for ((k) = ((&ssh->public_keys)->tqh_first); (k) != ((void *)0); (k) = ((k)->next.tqe_next)) { sshlog("ssh_api.c", __func__, 473, 1, SYSLOG_LEVEL_DEBUG3, ((void *)0), "check %s", sshkey_type(k->key)); if (k->key->type == type && (type != KEY_ECDSA || k->key->ecdsa_nid == nid)) return (k->key); } return (((void *)0)); }
long long _ssh_host_public_key(unsigned long a0, unsigned long a1, struct_0 *a2) { struct_1 *v0; void *v2; sshlog("ssh_api.c", "_ssh_host_public_key", 0x1d7, 0x1, 0x7, 0x0, "need %d", a0); v0 = a2->field_850; while (true) { if (!v0) { v2 = 0; return v2; } sshlog("ssh_api.c", "_ssh_host_public_key", 0x1d9, 0x1, 0x7, 0x0, "check %s", sshkey_type(v0->field_10)); if (!(a0 != *(v0->field_10)) && (!(a0 == 2) || !(a1 != v0->field_10[24]))) break; v0 = v0->field_0; } v2 = v0->field_10; return v2; }
openssh-portable
angr_sailr
static void prepare_failure_reports(void) { info_group.name = group_name; info_gshadow.name = group_name; info_passwd.name = group_name; info_group.audit_msg = xmalloc(512); info_gshadow.audit_msg = xmalloc(512); info_passwd.audit_msg = xmalloc(512); (void)snprintf(info_group.audit_msg, 511, "changing %s; ", gr_dbname()); (void)snprintf(info_gshadow.audit_msg, 511, "changing %s; ", sgr_dbname()); (void)snprintf(info_passwd.audit_msg, 511, "changing %s; ", pw_dbname()); info_group.action = info_group.audit_msg + strlen(info_group.audit_msg); info_gshadow.action = info_gshadow.audit_msg + strlen(info_gshadow.audit_msg); info_passwd.action = info_passwd.audit_msg + strlen(info_passwd.audit_msg); (void)snprintf(info_group.action, 511 - strlen(info_group.audit_msg), "group %s/%lu", group_name, (unsigned long int)group_id); (void)snprintf(info_gshadow.action, 511 - strlen(info_group.audit_msg), "group %s", group_name); (void)snprintf(info_passwd.action, 511 - strlen(info_group.audit_msg), "group %s/%lu", group_name, (unsigned long int)group_id); if (nflg) { strncat(info_group.action, ", new name: ", 511 - strlen(info_group.audit_msg)); strncat(info_group.action, group_newname, 511 - strlen(info_group.audit_msg)); strncat(info_gshadow.action, ", new name: ", 511 - strlen(info_gshadow.audit_msg)); strncat(info_gshadow.action, group_newname, 511 - strlen(info_gshadow.audit_msg)); strncat(info_passwd.action, ", new name: ", 511 - strlen(info_passwd.audit_msg)); strncat(info_passwd.action, group_newname, 511 - strlen(info_passwd.audit_msg)); } if (pflg) { strncat(info_group.action, ", new password", 511 - strlen(info_group.audit_msg)); strncat(info_gshadow.action, ", new password", 511 - strlen(info_gshadow.audit_msg)); } if (gflg) { strncat(info_group.action, ", new gid: ", 511 - strlen(info_group.audit_msg)); (void)snprintf(info_group.action + strlen(info_group.action), 511 - strlen(info_group.audit_msg), "%lu", (unsigned long int)group_newid); strncat(info_passwd.action, ", new gid: ", 511 - strlen(info_passwd.audit_msg)); (void)snprintf(info_passwd.action + strlen(info_passwd.action), 511 - strlen(info_passwd.audit_msg), "%lu", (unsigned long int)group_newid); } info_group.audit_msg[511] = '\0'; info_gshadow.audit_msg[511] = '\0'; info_passwd.audit_msg[511] = '\0'; add_cleanup(cleanup_report_mod_group, &info_group); if (is_shadow_grp && (pflg || nflg)) { add_cleanup(cleanup_report_mod_gshadow, &info_gshadow); } if (gflg) { add_cleanup(cleanup_report_mod_passwd, &info_passwd); } }
long long prepare_failure_reports() { unsigned long long v3; g_401b10 = group_name; g_401b30 = group_name; g_401af0 = group_name; info_group = xmalloc(0x200); info_gshadow = xmalloc(0x200); info_passwd = xmalloc(0x200); snprintf(info_group, 0x1ff, "changing %s; ", gr_dbname()); snprintf(info_gshadow, 0x1ff, "changing %s; ", sgr_dbname()); snprintf(info_passwd, 0x1ff, "changing %s; ", pw_dbname()); g_401b08 = strlen(info_group) + info_group; g_401b28 = strlen(info_gshadow) + info_gshadow; g_401ae8 = strlen(info_passwd) + info_passwd; snprintf(g_401b08, 511 - strlen(info_group), "group %s/%lu", group_name, group_id); snprintf(g_401b28, 511 - strlen(info_group), "group %s", group_name); snprintf(g_401ae8, 511 - strlen(info_group), "group %s/%lu", group_name, group_id); if (nflg) { strncat(g_401b08, ", new name: ", 511 - strlen(info_group)); strncat(g_401b08, group_newname, 511 - strlen(info_group)); strncat(g_401b28, ", new name: ", 511 - strlen(info_gshadow)); strncat(g_401b28, group_newname, 511 - strlen(info_gshadow)); strncat(g_401ae8, ", new name: ", 511 - strlen(info_passwd)); strncat(g_401ae8, group_newname, 511 - strlen(info_passwd)); } if (pflg) { strncat(g_401b08, ", new password", 511 - strlen(info_group)); strncat(g_401b28, ", new password", 511 - strlen(info_gshadow)); } if (gflg) { strncat(g_401b08, ", new gid: ", 511 - strlen(info_group)); snprintf(strlen(g_401b08) + g_401b08, 511 - strlen(info_group), "%lu", group_newid); strncat(g_401ae8, ", new gid: ", 511 - strlen(info_passwd)); snprintf(strlen(g_401ae8) + g_401ae8, 511 - strlen(info_passwd), "%lu", group_newid); } *((info_group + 511)) = 0; *((info_gshadow + 511)) = 0; *((info_passwd + 511)) = 0; add_cleanup(got.cleanup_report_mod_group, &info_group); if (is_shadow_grp) { if (!pflg && !nflg) goto LABEL_4012d5; add_cleanup(got.cleanup_report_mod_gshadow, &info_gshadow); } LABEL_4012d5: v3 = gflg; if (gflg) v3 = add_cleanup(got.cleanup_report_mod_passwd, &info_passwd); return v3; }
shadow
angr_phoenix
_Bool pred_quit (const char *pathname, struct stat *stat_buf, struct predicate *pred_ptr) { (void)pathname; (void)stat_buf; (void)pred_ptr; cleanup(); exit(state.exit_status); }
void pred_quit(EVP_PKEY_CTX *param_1) { cleanup(param_1); exit(DAT_0010404c); }
findutils
ghidra
void ipstats_stat_desc_pack_xstats(struct ipstats_stat_dump_filters *filters, const struct ipstats_stat_desc *desc) { struct ipstats_stat_desc_xstats *xdesc; xdesc = ({ const typeof(((struct ipstats_stat_desc_xstats *)0)->desc) *__mptr = (desc); (struct ipstats_stat_desc_xstats *)((char *)__mptr - __builtin_offsetof( struct ipstats_stat_desc_xstats, desc)); }); ipstats_stat_desc_enable_bit(filters, xdesc->xstats_at, 0); }
long long ipstats_stat_desc_pack_xstats(unsigned int *a0, struct_0 *a1) { return ipstats_stat_desc_enable_bit(a0, a1->field_20, 0x0); }
iproute2-6.0.0
angr_phoenix
static char **do_setup_env(struct ssh *ssh, Session *s, const char *shell) { char buf[256]; size_t n; u_int i, envsize; char *ocp, *cp, *value, **env, *laddr; struct passwd *pw = s->pw; char *path = ((void *)0); envsize = 100; env = xcalloc(envsize, sizeof(char *)); env[0] = ((void *)0); for (i = 0; i < s->num_env; i++) child_set_env(&env, &envsize, s->env[i].name, s->env[i].val); child_set_env(&env, &envsize, "USER", pw->pw_name); child_set_env(&env, &envsize, "LOGNAME", pw->pw_name); child_set_env(&env, &envsize, "HOME", pw->pw_dir); if (path == ((void *)0) || *path == '\0') { child_set_env(&env, &envsize, "PATH", s->pw->pw_uid == 0 ? "/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin" : "/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin"); } if (!options.use_pam) { snprintf(buf, sizeof buf, "%.200s/%.50s", "/var/mail", pw->pw_name); child_set_env(&env, &envsize, "MAIL", buf); } child_set_env(&env, &envsize, "SHELL", shell); if (getenv("TZ")) child_set_env(&env, &envsize, "TZ", getenv("TZ")); if (s->term) child_set_env(&env, &envsize, "TERM", s->term); if (s->display) child_set_env(&env, &envsize, "DISPLAY", s->display); { char *cp; if ((cp = getenv("KRB5CCNAME")) != ((void *)0)) child_set_env(&env, &envsize, "KRB5CCNAME", cp); } if (auth_sock_name != ((void *)0)) child_set_env(&env, &envsize, "SSH_AUTH_SOCK", auth_sock_name); if (options.permit_user_env) { for (n = 0; n < auth_opts->nenv; n++) { ocp = xstrdup(auth_opts->env[n]); cp = strchr(ocp, '='); if (cp != ((void *)0)) { *cp = '\0'; if (options.permit_user_env_allowlist == ((void *)0) || match_pattern_list(ocp, options.permit_user_env_allowlist, 0) == 1) child_set_env(&env, &envsize, ocp, cp + 1); } free(ocp); } } if (options.permit_user_env) { snprintf(buf, sizeof buf, "%.200s/%s/environment", pw->pw_dir, ".ssh"); read_environment_file(&env, &envsize, buf, options.permit_user_env_allowlist); } for (i = 0; i < options.num_setenv; i++) { cp = xstrdup(options.setenv[i]); if ((value = strchr(cp, '=')) == ((void *)0)) { sshfatal("session.c", __func__, 1158, 0, SYSLOG_LEVEL_FATAL, ((void *)0), "Invalid config SetEnv: %s", options.setenv[i]); } *value++ = '\0'; child_set_env(&env, &envsize, cp, value); } snprintf(buf, sizeof buf, "%.50s %d %d", ssh_remote_ipaddr(ssh), ssh_remote_port(ssh), ssh_local_port(ssh)); child_set_env(&env, &envsize, "SSH_CLIENT", buf); laddr = get_local_ipaddr(ssh_packet_get_connection_in(ssh)); snprintf(buf, sizeof buf, "%.50s %d %.50s %d", ssh_remote_ipaddr(ssh), ssh_remote_port(ssh), laddr, ssh_local_port(ssh)); free(laddr); child_set_env(&env, &envsize, "SSH_CONNECTION", buf); if (tun_fwd_ifnames != ((void *)0)) child_set_env(&env, &envsize, "SSH_TUNNEL", tun_fwd_ifnames); if (auth_info_file != ((void *)0)) child_set_env(&env, &envsize, "SSH_USER_AUTH", auth_info_file); if (s->ttyfd != -1) child_set_env(&env, &envsize, "SSH_TTY", s->tty); if (original_command) child_set_env(&env, &envsize, "SSH_ORIGINAL_COMMAND", original_command); if (debug_flag) { fprintf(stderr, "Environment:\n"); for (i = 0; env[i]; i++) fprintf(stderr, " %.200s\n", env[i]); } return env; }
_QWORD *do_setup_env(long a1, long a2, long a3) { long v3; long v4; long v5; long v6; long v7; long v8; long v9; long v10; long v11; long v12; long v13; long v14; char *v15; long v16; long v17; long v18; long v19; long v20; long v21; long v22; long v23; char *v24; unsigned int v25; unsigned int v26; const char *v27; long v28; long v29; unsigned int connection_in; long v31; unsigned int v32; const char *v33; long v34; long v35; long v36; long v37; int v40; unsigned int i; _QWORD *v42; unsigned long j; const char **v44; _BYTE *v45; char *v46; char *v47; char *v48; void *ptr; char *v50; char s[264]; unsigned long v52; v52 = __readfsqword(0x28u); v44 = *(const char ***)(a2 + 16); v45 = 0LL; v40 = 100; v42 = (_QWORD *)xcalloc(100LL, 8LL); *v42 = 0LL; for (i = 0; i < *(_DWORD *)(a2 + 216); ++i) child_set_env(&v42, &v40, *(_QWORD *)(16LL * i + *(_QWORD *)(a2 + 224)), *(_QWORD *)(16LL * i + *(_QWORD *)(a2 + 224) + 8), v3, v4); child_set_env(&v42, &v40, "USER", *v44, v3, v4); child_set_env(&v42, &v40, "LOGNAME", *v44, v5, v6); child_set_env(&v42, &v40, "HOME", v44[4], v7, v8); if (!v45 || !*v45) child_set_env(&v42, &v40, "PATH", "/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin", v9, v10); if (!options[1926]) { snprintf(s, 0x100uLL, "%.200s/%.50s", "/var/mail", *v44); child_set_env(&v42, &v40, "MAIL", s, v11, v12); } child_set_env(&v42, &v40, "SHELL", a3, v9, v10); if (getenv("TZ")) { v15 = getenv("TZ"); child_set_env(&v42, &v40, "TZ", v15, v16, v17); } if (*(_QWORD *)(a2 + 40)) child_set_env(&v42, &v40, "TERM", *(_QWORD *)(a2 + 40), v13, v14); if (*(_QWORD *)(a2 + 144)) child_set_env(&v42, &v40, "DISPLAY", *(_QWORD *)(a2 + 144), v13, v14); v46 = getenv("KRB5CCNAME"); if (v46) child_set_env(&v42, &v40, "KRB5CCNAME", v46, v18, v19); if (auth_sock_name) child_set_env(&v42, &v40, "SSH_AUTH_SOCK", auth_sock_name, v18, v19); if (options[339]) { for (j = 0LL; j < *(_QWORD *)(auth_opts + 64LL); ++j) { v47 = (char *)xstrdup(*(_QWORD *)(8 * j + *(_QWORD *)(auth_opts + 72LL))); v48 = strchr(v47, 61); if (v48) { *v48 = 0; if (!*(_QWORD *)&options[340] || (unsigned int)match_pattern_list(v47, *(_QWORD *)&options[340], 0LL) == 1) child_set_env(&v42, &v40, v47, v48 + 1, v20, v21); } free(v47); } } if (options[339]) { snprintf(s, 0x100uLL, "%.200s/%s/environment", v44[4], ".ssh"); read_environment_file((long)&v42, (long)&v40, s, *(_QWORD *)&options[340]); } for (i = 0; i < options[1904]; ++i) { v48 = (char *)xstrdup(*(_QWORD *)(8LL * i + *(_QWORD *)&options[1906])); v50 = strchr(v48, 61); if (!v50) sshfatal("session.c", "do_setup_env", 1158LL, 0LL, 1LL, 0LL, "Invalid config SetEnv: %s", *(const char **)(8LL * i + *(_QWORD *)&options[1906])); v24 = v50++; *v24 = 0; child_set_env(&v42, &v40, v48, v50, v22, v23); } v25 = ssh_local_port(a1); v26 = ssh_remote_port(a1); v27 = (const char *)ssh_remote_ipaddr(a1); snprintf(s, 0x100uLL, "%.50s %d %d", v27, v26, v25); child_set_env(&v42, &v40, "SSH_CLIENT", s, v28, v29); connection_in = ssh_packet_get_connection_in(a1); ptr = (void *)get_local_ipaddr(connection_in); v31 = (unsigned int)ssh_local_port(a1); v32 = ssh_remote_port(a1); v33 = (const char *)ssh_remote_ipaddr(a1); snprintf(s, 0x100uLL, "%.50s %d %.50s %d", v33, v32, (const char *)ptr, v31); free(ptr); child_set_env(&v42, &v40, "SSH_CONNECTION", s, v34, v35); if (tun_fwd_ifnames) child_set_env(&v42, &v40, "SSH_TUNNEL", tun_fwd_ifnames, v36, v37); if (auth_info_file) child_set_env(&v42, &v40, "SSH_USER_AUTH", auth_info_file, v36, v37); if (*(_DWORD *)(a2 + 52) != -1) child_set_env(&v42, &v40, "SSH_TTY", a2 + 76, v36, v37); if (original_command) child_set_env(&v42, &v40, "SSH_ORIGINAL_COMMAND", original_command, v36, v37); if (debug_flag) { fprintf(stderr, "Environment:\n"); for (i = 0; v42[i]; ++i) fprintf(stderr, " %.200s\n", (const char *)v42[i]); } return v42; }
openssh-portable
ida
static inline _Bool dot_or_dotdot(char const *file_name) { if (file_name[0] == '.') { char sep = file_name[(file_name[1] == '.') + 1]; return (!sep || ((sep) == '/')); } else return 0; }
_BOOL8 dot_or_dotdot(_BYTE *a1) { long v1; char v4; if (*a1 != 46) return 0LL; if (a1[1] == 46) v1 = 2LL; else v1 = 1LL; v4 = a1[v1]; return !v4 || v4 == 47; }
coreutils
ida
static void xfrm_auth_trunc_print(struct xfrm_algo_auth *algo, int len, FILE *fp, const char *prefix, _Bool nokeys) { struct xfrm_algo *base_algo = __builtin_alloca(sizeof(*base_algo) + algo->alg_key_len / 8); memcpy(base_algo->alg_name, algo->alg_name, sizeof(base_algo->alg_name)); base_algo->alg_key_len = algo->alg_key_len; memcpy(base_algo->alg_key, algo->alg_key, algo->alg_key_len / 8); __xfrm_algo_print(base_algo, XFRMA_ALG_AUTH_TRUNC, len, fp, prefix, 0, nokeys); fprintf(fp, " %d", algo->alg_trunc_len); fprintf(fp, "%s", _SL_); }
unsigned long xfrm_auth_trunc_print(long a1, int a2, long a3, long a4, char a5) { unsigned long v5; void *v6; _BYTE var30[56]; *(_QWORD *)&var30[24] = a1; *(_DWORD *)&var30[20] = a2; *(_QWORD *)&var30[8] = a3; *(_QWORD *)var30 = a4; var30[16] = a5; *(_QWORD *)&var30[40] = __readfsqword(0x28u); v5 = 16 * (((unsigned long)(*(_DWORD *)(a1 + 64) >> 3) + 91) / 0x10); while (var30 != &var30[-(v5 & 0xFFFFFFFFFFFFF000LL)]) ; v6 = alloca(v5 & 0xFFF); if ((v5 & 0xFFF) != 0) *(_QWORD *)&var30[(v5 & 0xFFF) - 8] = *(_QWORD *)&var30[(v5 & 0xFFF) - 8]; *(_QWORD *)&var30[32] = var30; memcpy(var30, *(const void **)&var30[24], 0x40uLL); *(_DWORD *)(*(_QWORD *)&var30[32] + 64LL) = *(_DWORD *)(*(_QWORD *)&var30[24] + 64LL); memcpy((void *)(*(_QWORD *)&var30[32] + 68LL), (const void *)(*(_QWORD *)&var30[24] + 72LL), *(_DWORD *)(*(_QWORD *)&var30[24] + 64LL) >> 3); _xfrm_algo_print(*(long *)&var30[32], 0x14u, *(unsigned int *)&var30[20], *(FILE **)&var30[8], *(const char **)var30, 0, var30[16]); fprintf(*(FILE **)&var30[8], " %d", *(unsigned int *)(*(_QWORD *)&var30[24] + 68LL)); fprintf(*(FILE **)&var30[8], "%s", SL_); return __readfsqword(0x28u) ^ *(_QWORD *)&var30[40]; }
iproute2-6.0.0
ida
int e2fsck_dir_info_set_dotdot(e2fsck_t ctx, ext2_ino_t ino, ext2_ino_t dotdot) { struct dir_info *p; p = e2fsck_get_dir_info(ctx, ino); if (!p) return 1; p->dotdot = dotdot; e2fsck_put_dir_info(ctx, p); return 0; }
long e2fsck_dir_info_set_dotdot(long a1, unsigned int a2, int a3) { int *dir_info; dir_info = e2fsck_get_dir_info(a1, a2); if (!dir_info) return 1LL; dir_info[1] = a3; e2fsck_put_dir_info(a1, (long)dir_info); return 0LL; }
e2fsprogs-1.46.5
ida
int sshpkt_getb_froms(struct ssh *ssh, struct sshbuf **valp) { return sshbuf_froms(ssh->state->incoming_packet, valp); }
long long sshpkt_getb_froms(struct struct_0 **a0, unsigned long long a1) { return sshbuf_froms(*(a0)->field_38, a1, a1); }
openssh-portable
angr_dream
char *sshkey_alg_list(int certs_only, int plain_only, int include_sigonly, char sep) { char *tmp, *ret = ((void *)0); size_t nlen, rlen = 0; const struct keytype *kt; for (kt = keytypes; kt->type != -1; kt++) { if (kt->name == ((void *)0)) continue; if (!include_sigonly && kt->sigonly) continue; if ((certs_only && !kt->cert) || (plain_only && kt->cert)) continue; if (ret != ((void *)0)) ret[rlen++] = sep; nlen = strlen(kt->name); if ((tmp = realloc(ret, rlen + nlen + 2)) == ((void *)0)) { free(ret); return ((void *)0); } ret = tmp; memcpy(ret + rlen, kt->name, nlen + 1); rlen += nlen; } return ret; }
_BYTE *sshkey_alg_list(int a1, int a2, int a3, char a4) { long v4; _BYTE *ptr; long v9; char **i; size_t v11; char *v12; ptr = 0LL; v9 = 0LL; for (i = keytypes; *((_DWORD *)i + 6) != -1; i += 5) { if (*i && (a3 || !*((_DWORD *)i + 9)) && (!a1 || *((_DWORD *)i + 8)) && (!a2 || !*((_DWORD *)i + 8))) { if (ptr) { v4 = v9++; ptr[v4] = a4; } v11 = strlen(*i); v12 = (char *)realloc(ptr, v9 + v11 + 2); if (!v12) { free(ptr); return 0LL; } ptr = v12; memcpy(&v12[v9], *i, v11 + 1); v9 += v11; } } return ptr; }
openssh-portable
ida
ed_delete_prev_word(EditLine *el, wint_t c __attribute__((__unused__))) { wchar_t *cp, *p, *kp; if (el->el_line.cursor == el->el_line.buffer) return 6; cp = c__prev_word(el->el_line.cursor, el->el_line.buffer, el->el_state.argument, ce__isword); for (p = cp, kp = el->el_chared.c_kill.buf; p < el->el_line.cursor; p++) *kp++ = *p; el->el_chared.c_kill.last = kp; c_delbefore(el, (int)(el->el_line.cursor - cp)); el->el_line.cursor = cp; if (el->el_line.cursor < el->el_line.buffer) el->el_line.cursor = el->el_line.buffer; return 4; }
long ed_delete_prev_word(long a1) { _DWORD *v2; _DWORD *v3; _DWORD *v4; long word; if (*(_QWORD *)(a1 + 88) == *(_QWORD *)(a1 + 80)) return 6LL; word = c__prev_word(*(_QWORD *)(a1 + 88), *(_QWORD *)(a1 + 80), *(unsigned int *)(a1 + 120), &ce__isword); v3 = (_DWORD *)word; v4 = *(_DWORD **)(a1 + 896); while ((unsigned long)v3 < *(_QWORD *)(a1 + 88)) { v2 = v4++; *v2 = *v3++; } *(_QWORD *)(a1 + 904) = v4; c_delbefore(a1, (unsigned int)((*(_QWORD *)(a1 + 88) - word) >> 2)); *(_QWORD *)(a1 + 88) = word; if (*(_QWORD *)(a1 + 88) < *(_QWORD *)(a1 + 80)) *(_QWORD *)(a1 + 88) = *(_QWORD *)(a1 + 80); return 4LL; }
libedit
ida
static int do_modprobe(int argc, char **orig_argv) { struct kmod_ctx *ctx; char **args = ((void *)0), **argv; const char **config_paths = ((void *)0); int nargs = 0, n_config_paths = 0; char dirname_buf[4096]; const char *dirname = ((void *)0); const char *root = ((void *)0); const char *kversion = ((void *)0); int use_all = 0; int do_remove = 0; int do_show_config = 0; int do_show_modversions = 0; int do_show_exports = 0; int err; argv = prepend_options_from_env(&argc, orig_argv); if (argv == ((void *)0)) { log_printf(3, "Could not prepend options from command line\n"); return 1; } for (;;) { int c, idx = 0; c = getopt_long(argc, argv, cmdopts_s, cmdopts, &idx); if (c == -1) break; switch (c) { case 'a': log_priority = 4; use_all = 1; break; case 'r': do_remove = 1; break; case 5: remove_holders = 1; break; case 'w': { char *endptr = ((void *)0); wait_msec = strtoul(optarg, &endptr, 0); if (!*optarg || *endptr) { log_printf(3, "unexpected wait value '%s'.\n", optarg); err = -1; goto done; } break; } case 3: first_time = 1; break; case 'i': ignore_commands = 1; break; case 'b': use_blacklist = 1; break; case 'f': force = 1; break; case 2: strip_modversion = 1; break; case 1: strip_vermagic = 1; break; case 'D': ignore_loaded = 1; dry_run = 1; do_show = 1; break; case 'R': lookup_only = 1; break; case 'c': do_show_config = 1; break; case 4: do_show_modversions = 1; break; case 6: do_show_exports = 1; break; case 'n': dry_run = 1; break; case 'C': { size_t bytes = sizeof(char *) * (n_config_paths + 2); void *tmp = realloc(config_paths, bytes); if (!tmp) { log_printf(3, "out-of-memory\n"); err = -1; goto done; } config_paths = tmp; config_paths[n_config_paths] = optarg; n_config_paths++; config_paths[n_config_paths] = ((void *)0); env_modprobe_options_append("-C"); env_modprobe_options_append(optarg); break; } case 'd': root = optarg; break; case 'S': kversion = optarg; break; case 's': env_modprobe_options_append("-s"); use_syslog = 1; break; case 'q': env_modprobe_options_append("-q"); verbose = 0; break; case 'v': env_modprobe_options_append("-v"); verbose++; break; case 'V': puts("kmod" " version " "30"); puts("-ZSTD -XZ -ZLIB -LIBCRYPTO -EXPERIMENTAL"); err = 0; goto done; case 'h': help(); err = 0; goto done; case '?': err = -1; goto done; default: log_printf(3, "unexpected getopt_long() value '%c'.\n", c); err = -1; goto done; } } args = argv + optind; nargs = argc - optind; log_open(use_syslog); if (!do_show_config) { if (nargs == 0) { log_printf(3, "missing parameters. See -h.\n"); err = -1; goto done; } } if (root != ((void *)0) || kversion != ((void *)0)) { struct utsname u; if (root == ((void *)0)) root = ""; if (kversion == ((void *)0)) { if (uname(&u) < 0) { log_printf(3, "uname() failed: %m\n"); err = -1; goto done; } kversion = u.release; } snprintf(dirname_buf, sizeof(dirname_buf), "%s/lib/modules/%s", root, kversion); dirname = dirname_buf; } ctx = kmod_new(dirname, config_paths); if (!ctx) { log_printf(3, "kmod_new() failed!\n"); err = -1; goto done; } log_setup_kmod_log(ctx, verbose); kmod_load_resources(ctx); if (do_show_config) err = show_config(ctx); else if (do_show_modversions) err = show_modversions(ctx, args[0]); else if (do_show_exports) err = show_exports(ctx, args[0]); else if (do_remove) err = rmmod_all(ctx, args, nargs); else if (use_all) err = insmod_all(ctx, args, nargs); else { char *opts; err = options_from_array(args, nargs, &opts); if (err == 0) { err = insmod(ctx, args[0], opts); free(opts); } } kmod_unref(ctx); done: log_close(); if (argv != orig_argv) free(argv); free(config_paths); return err >= 0 ? 0 : 1; }
long long do_modprobe(unsigned long a0, unsigned long long *a1) { char v0; unsigned int v1; unsigned int v2; unsigned int v3; unsigned int v4; unsigned int v5; unsigned int v6; unsigned int v7; unsigned int v8; unsigned int v9; unsigned int v10; void *v11; void *v12; void *v13; unsigned long long v14; void *v15; unsigned long long *v16; void *v17; unsigned int v18; unsigned long v19; unsigned long long v20; char v21; char v22; char v23; char v24; unsigned long long v26; unsigned long long v27; unsigned long long v28; unsigned long long v29; v24 = *(&v24); v16 = 0; v12 = 0; v9 = 0; v2 = 0; v13 = 0; v14 = 0; v15 = 0; v3 = 0; v4 = 0; v5 = 0; v6 = 0; v7 = 0; v17 = prepend_options_from_env(&v0, a1); if (!v17) { log_printf(0x3, "Could not prepend options from command line\n", v26); v27 = 1; } else { while (true) { v1 = 0; v10 = getopt_long(a0, v17, "arw:RibfDcnC:d:S:sqvVh", &cmdopts, &v1); if (v10 == -1) { v16 = v17 + 8 * optind; v9 = a0 - optind; log_open(use_syslog); if (!v5 && !v9) { log_printf(0x3, "missing parameters. See -h.\n", "arw:RibfDcnC:d:S:sqvVh"); v8 = -1; break; } if (v9 || v5) { if ((v15 || v14) && !v14) v14 = &g_400bf1; if (!v15 && v14) { v28 = uname(&v21); if (v28 < 0) { log_printf(0x3, "uname() failed: %m\n", "arw:RibfDcnC:d:S:sqvVh"); v8 = -1; break; } else { v15 = &v22; } } if (v15 || v28 >= 0 && v14) { snprintf(&v23, 0x1000, "%s/lib/modules/%s", v14, v15); v13 = &v23; } if (!v14 || v28 >= 0 || v15) { v20 = kmod_new(v13, v12, v12); if (!v20) { log_printf(0x3, "kmod_new() failed!\n", v29); v8 = -1; break; } else { log_setup_kmod_log(v20, verbose, verbose); kmod_load_resources(v20); if (v5) { v8 = show_config(v20); } else if (v6) { v8 = show_modversions(v20, *(v16)); } else if (v7) { v8 = show_exports(v20, *(v16)); } else if (v4) { v8 = rmmod_all(v20, v16, v9); } else if (v3) { v8 = insmod_all(v20, v16, v9); } else { v8 = options_from_array(v16, v9, &v11); if (!v8) { v8 = insmod(v20, *(v16), v11); free(v11); } } kmod_unref(v20); break; } } } } else { switch (v10) { case 1: strip_vermagic = 1; break; case 2: strip_modversion = 1; break; case 3: first_time = 1; break; case 4: v6 = 1; break; case 5: remove_holders = 1; break; case 6: v7 = 1; break; case 63: v8 = -1; case 67: *(&v18) = (v2 + 2) * 8; v19 = realloc(v12, *(&v18)); if (!v19) { log_printf(0x3, "out-of-memory\n", "arw:RibfDcnC:d:S:sqvVh"); v8 = -1; } else { v12 = v19; v12[v2] = *(&optarg); v2 += 1; v12[v2] = 0; env_modprobe_options_append("-C"); env_modprobe_options_append(*(&optarg)); break; } case 68: ignore_loaded = 1; dry_run = 1; do_show = 1; break; case 82: lookup_only = 1; break; case 83: v15 = *(&optarg); break; case 86: puts("kmod version 30"); puts("-ZSTD -XZ -ZLIB -LIBCRYPTO -EXPERIMENTAL"); v8 = 0; case 97: log_priority = 4; v3 = 1; break; case 98: use_blacklist = 1; break; case 99: v5 = 1; break; case 100: v14 = *(&optarg); break; case 102: force = 1; break; case 104: help(); v8 = 0; case 105: ignore_commands = 1; break; case 110: dry_run = 1; break; case 113: env_modprobe_options_append("-q"); verbose = 0; break; case 114: v4 = 1; break; case 115: env_modprobe_options_append("-s"); use_syslog = 1; break; case 118: env_modprobe_options_append("-v"); verbose = verbose + 1; break; case 119: v11 = 0; wait_msec = strtoul(*(&optarg), &v11, 0x0, &v11); if (!*(*(&optarg)) || *(v11)) { log_printf(0x3, "unexpected wait value '%s'.\n", *(&optarg)); v8 = -1; } default: log_printf(0x3, "unexpected getopt_long() value '%c'.\n", v10); v8 = -1; } } } log_close(); if (v17 != a1) free(v17); free(v12); v27 = v8 >> 31; } return v27; }
kmod
angr_dream
static int server_input_channel_open(int type, u_int32_t seq, struct ssh *ssh) { Channel *c = ((void *)0); char *ctype = ((void *)0); const char *errmsg = ((void *)0); int r, reason = 2; u_int rchan = 0, rmaxpack = 0, rwindow = 0; if ((r = sshpkt_get_cstring(ssh, &ctype, ((void *)0))) != 0 || (r = sshpkt_get_u32(ssh, &rchan)) != 0 || (r = sshpkt_get_u32(ssh, &rwindow)) != 0 || (r = sshpkt_get_u32(ssh, &rmaxpack)) != 0) sshpkt_fatal(ssh, r, "%s: parse packet", __func__); sshlog("serverloop.c", __func__, 635, 1, SYSLOG_LEVEL_DEBUG1, ((void *)0), "ctype %s rchan %u win %u max %u", ctype, rchan, rwindow, rmaxpack); if (strcmp(ctype, "session") == 0) { c = server_request_session(ssh); } else if (strcmp(ctype, "direct-tcpip") == 0) { c = server_request_direct_tcpip(ssh, &reason, &errmsg); } else if (strcmp(ctype, "direct-streamlocal@openssh.com") == 0) { c = server_request_direct_streamlocal(ssh); } else if (strcmp(ctype, "tun@openssh.com") == 0) { c = server_request_tun(ssh); } if (c != ((void *)0)) { sshlog("serverloop.c", __func__, 648, 1, SYSLOG_LEVEL_DEBUG1, ((void *)0), "confirm %s", ctype); c->remote_id = rchan; c->have_remote_id = 1; c->remote_window = rwindow; c->remote_maxpacket = rmaxpack; if (c->type != 12) { if ((r = sshpkt_start(ssh, 91)) != 0 || (r = sshpkt_put_u32(ssh, c->remote_id)) != 0 || (r = sshpkt_put_u32(ssh, c->self)) != 0 || (r = sshpkt_put_u32(ssh, c->local_window)) != 0 || (r = sshpkt_put_u32(ssh, c->local_maxpacket)) != 0 || (r = sshpkt_send(ssh)) != 0) { sshpkt_fatal(ssh, r, "%s: send open confirm", __func__); } } } else { sshlog("serverloop.c", __func__, 665, 1, SYSLOG_LEVEL_DEBUG1, ((void *)0), "failure %s", ctype); if ((r = sshpkt_start(ssh, 92)) != 0 || (r = sshpkt_put_u32(ssh, rchan)) != 0 || (r = sshpkt_put_u32(ssh, reason)) != 0 || (r = sshpkt_put_cstring(ssh, errmsg ? errmsg : "open failed")) != 0 || (r = sshpkt_put_cstring(ssh, "")) != 0 || (r = sshpkt_send(ssh)) != 0) { sshpkt_fatal(ssh, r, "%s: send open failure", __func__); } } free(ctype); return 0; }
undefined8 server_input_channel_open(undefined8 param_1, undefined4 param_2, undefined8 param_3) { int iVar1; char *pcVar2; long in_FS_OFFSET; undefined8 uVar3; undefined4 local_3c; int local_38; int local_34; int local_30; int local_2c; char *local_28; char *local_20; int *local_18; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); local_18 = (int *)0x0; local_28 = (char *)0x0; local_20 = (char *)0x0; local_3c = 2; local_38 = 0; local_34 = 0; local_30 = 0; local_2c = sshpkt_get_cstring(param_3, &local_28, 0); if (((local_2c == 0) && (local_2c = sshpkt_get_u32(param_3), local_2c == 0)) && (local_2c = sshpkt_get_u32(param_3), local_2c == 0)) { uVar3 = 0x101986; local_2c = sshpkt_get_u32(param_3); if (local_2c != 0) goto LAB_0010198f; } else { LAB_0010198f: uVar3 = 0x1019b1; sshpkt_fatal(param_3, local_2c, "%s: parse packet"); } sshlog("serverloop.c", "server_input_channel_open", 0x27b, 1, 5, 0, "ctype %s rchan %u win %u max %u", local_28, local_38, local_30, local_34, uVar3, param_3, param_2); iVar1 = strcmp(local_28, "session"); if (iVar1 == 0) { local_18 = (int *)server_request_session(param_3); } else { iVar1 = strcmp(local_28, "direct-tcpip"); if (iVar1 == 0) { local_18 = (int *)server_request_direct_tcpip(param_3, &local_3c, &local_20); } else { iVar1 = strcmp(local_28, "direct-streamlocal@openssh.com"); if (iVar1 == 0) { local_18 = (int *)server_request_direct_streamlocal(param_3); } else { iVar1 = strcmp(local_28, "tun@openssh.com"); if (iVar1 == 0) { local_18 = (int *)server_request_tun(param_3); } } } } if (local_18 != (int *)0x0) { sshlog("serverloop.c", "server_input_channel_open", 0x288, 1, 5, 0, "confirm %s", local_28); local_18[2] = local_38; local_18[3] = 1; local_18[0x2a] = local_30; local_18[0x2b] = local_34; if ((*local_18 == 0xc) || ((((local_2c = sshpkt_start(param_3, 0x5b), local_2c == 0 && (local_2c = sshpkt_put_u32(param_3, local_18[2]), local_2c == 0)) && ((local_2c = sshpkt_put_u32(param_3, local_18[1]), local_2c == 0 && ((local_2c = sshpkt_put_u32(param_3, local_18[0x2c]), local_2c == 0 && (local_2c = sshpkt_put_u32(param_3, local_18[0x2f]), local_2c == 0)))))) && (local_2c = sshpkt_send(param_3), local_2c == 0)))) goto LAB_00101d25; sshpkt_fatal(param_3, local_2c, "%s: send open confirm", "server_input_channel_open"); } sshlog("serverloop.c", "server_input_channel_open", 0x299, 1, 5, 0, "failure %s", local_28); local_2c = sshpkt_start(param_3, 0x5c); if (((local_2c == 0) && (local_2c = sshpkt_put_u32(param_3, local_38), local_2c == 0)) && (local_2c = sshpkt_put_u32(param_3, local_3c), local_2c == 0)) { pcVar2 = local_20; if (local_20 == (char *)0x0) { pcVar2 = "open failed"; } local_2c = sshpkt_put_cstring(param_3, pcVar2); if (((local_2c == 0) && (local_2c = sshpkt_put_cstring(param_3, &DAT_00103301), local_2c == 0)) && (local_2c = sshpkt_send(param_3), local_2c == 0)) goto LAB_00101d25; } sshpkt_fatal(param_3, local_2c, "%s: send open failure", "server_input_channel_open"); LAB_00101d25: free(local_28); if (local_10 == *(long *)(in_FS_OFFSET + 0x28)) { return 0; } __stack_chk_fail(); }
openssh-portable
ghidra
static struct sshkey *load_identity(const char *filename, char **commentp) { char *pass; struct sshkey *prv; int r; if (commentp != ((void *)0)) *commentp = ((void *)0); if ((r = sshkey_load_private(filename, "", &prv, commentp)) == 0) return prv; if (r != -43) sshfatal("ssh-keygen.c", __func__, 327, 0, SYSLOG_LEVEL_FATAL, ssh_err(r), "Load key \"%s\"", filename); if (identity_passphrase) pass = xstrdup(identity_passphrase); else pass = read_passphrase("Enter passphrase: ", 0x0002); r = sshkey_load_private(filename, pass, &prv, commentp); freezero(pass, strlen(pass)); if (r != 0) sshfatal("ssh-keygen.c", __func__, 335, 0, SYSLOG_LEVEL_FATAL, ssh_err(r), "Load key \"%s\"", filename); return prv; }
long load_identity(const char *a1, _QWORD *a2) { long v3; size_t v4; long v5; unsigned int v6; unsigned int v7; long v8; char *s; unsigned long v10; v10 = __readfsqword(0x28u); if (a2) *a2 = 0LL; v6 = sshkey_load_private(a1, s2, &v8, a2); if (!v6) return v8; if (v6 != -43) { v3 = ssh_err(v6); sshfatal("ssh-keygen.c", "load_identity", 327LL, 0LL, 1LL, v3, "Load key \"%s\"", a1); } if (identity_passphrase) s = (char *)xstrdup(identity_passphrase); else s = (char *)read_passphrase("Enter passphrase: ", 2LL); v7 = sshkey_load_private(a1, s, &v8, a2); v4 = strlen(s); freezero(s, v4); if (v7) { v5 = ssh_err(v7); sshfatal("ssh-keygen.c", "load_identity", 335LL, 0LL, 1LL, v5, "Load key \"%s\"", a1); } return v8; }
openssh-portable
ida
int main(int argc, char **argv) { int optc; _Bool ok; _Bool delim_specified = 0; _Bool byte_mode = 0; char *spec_list_string = ((void *)0); ; set_program_name(argv[0]); setlocale(6, ""); bindtextdomain("coreutils", "/usr/local/share/locale"); textdomain("coreutils"); atexit(close_stdout); suppress_non_delimited = 0; delim = '\0'; have_read_stdin = 0; while ((optc = getopt_long(argc, argv, "b:c:d:f:nsz", longopts, ((void *)0))) != -1) { switch (optc) { case 'b': case 'c': byte_mode = 1; __attribute__((__fallthrough__)); case 'f': if (spec_list_string) do { error(0, 0, (gettext("only one list may be specified"))); usage(1); } while (0); spec_list_string = optarg; break; case 'd': if (optarg[0] != '\0' && optarg[1] != '\0') do { error(0, 0, (gettext("the delimiter must be a single character"))); usage(1); } while (0); delim = optarg[0]; delim_specified = 1; break; case OUTPUT_DELIMITER_OPTION: output_delimiter_length = (optarg[0] == '\0' ? 1 : strlen(optarg)); output_delimiter_string = optarg; break; case 'n': break; case 's': suppress_non_delimited = 1; break; case 'z': line_delim = '\0'; break; case COMPLEMENT_OPTION: complement = 1; break; case GETOPT_HELP_CHAR: usage(0); break; ; case GETOPT_VERSION_CHAR: version_etc(stdout, "cut", "GNU coreutils", Version, ("David M. Ihnat"), ("David MacKenzie"), ("Jim Meyering"), (char *)((void *)0)); exit(0); break; ; default: usage(1); } } if (!spec_list_string) do { error( 0, 0, (gettext("you must specify a list of bytes, characters, or fields"))); usage(1); } while (0); if (byte_mode) { if (delim_specified) do { error(0, 0, (gettext("an input delimiter may be specified only when " "operating on fields"))); usage(1); } while (0); if (suppress_non_delimited) do { error(0, 0, (gettext("suppressing non-delimited lines makes sense\n\tonly " "when operating on fields"))); usage(1); } while (0); } set_fields(spec_list_string, ((byte_mode ? SETFLD_ERRMSG_USE_POS : 0) | (complement ? SETFLD_COMPLEMENT : 0))); if (!delim_specified) delim = '\t'; if (output_delimiter_string == ((void *)0)) { output_delimiter_default[0] = delim; output_delimiter_string = output_delimiter_default; output_delimiter_length = 1; } void (*cut_stream)(FILE *) = byte_mode ? cut_bytes : cut_fields; if (optind == argc) ok = cut_file("-", cut_stream); else for (ok = 1; optind < argc; optind++) ok &= cut_file(argv[optind], cut_stream); if (have_read_stdin && rpl_fclose(stdin) == (-1)) { error(0, (*__errno_location()), "-"); ok = 0; } return ok ? 0 : 1; }
int main(int argc, const char **argv, const char **envp) { char *v3; char *v4; size_t v5; char *v6; char *v7; char *v8; int v9; int v10; void (*v11)(struct _IO_FILE *); int *v12; char v14; char v15; char v16; int v17; char *v18; void (*v19)(struct _IO_FILE *); v15 = 0; v16 = 0; v18 = 0LL; set_program_name(*argv, argv, envp); setlocale(6, locale); bindtextdomain("coreutils", "/usr/local/share/locale"); textdomain("coreutils"); atexit((void (*)(void))&close_stdout); suppress_non_delimited = 0; delim = 0; have_read_stdin = 0; while (2) { v17 = getopt_long(argc, (char *const *)argv, "b:c:d:f:nsz", &longopts, 0LL); if (v17 != -1) { if (v17 <= 129) { if (v17 >= 98) { switch (v17) { case 98: case 99: v16 = 1; goto LABEL_9; case 100: if (*optarg && optarg[1]) { v4 = gettext("the delimiter must be a single character"); error(0, 0, v4); usage(1); } delim = *optarg; v15 = 1; continue; case 102: LABEL_9: if (v18) { v3 = gettext("only one list may be specified"); error(0, 0, v3); usage(1); } v18 = optarg; continue; case 110: continue; case 115: suppress_non_delimited = 1; continue; case 122: line_delim = 0; continue; case 128: if (*optarg) v5 = strlen(optarg); else v5 = 1LL; output_delimiter_length = v5; output_delimiter_string = optarg; continue; case 129: complement = 1; continue; default: goto LABEL_25; } } if (v17 == -131) { version_etc(stdout, "cut", "GNU coreutils", Version, "David M. Ihnat", "David MacKenzie", "Jim Meyering", 0LL); exit(0); } if (v17 == -130) usage(0); } LABEL_25: usage(1); } break; } if (!v18) { v6 = gettext("you must specify a list of bytes, characters, or fields"); error(0, 0, v6); usage(1); } if (v16) { if (v15) { v7 = gettext( "an input delimiter may be specified only when operating on fields"); error(0, 0, v7); usage(1); } if (suppress_non_delimited) { v8 = gettext("suppressing non-delimited lines makes sense\n\tonly when " "operating on fields"); error(0, 0, v8); usage(1); } } if (v16) v9 = 4; else v9 = 0; if (complement) v10 = 2; else v10 = 0; set_fields(v18, v9 | (unsigned int)v10); if (v15 != 1) delim = 9; if (!output_delimiter_string) { output_delimiter_default = delim; output_delimiter_string = &output_delimiter_default; output_delimiter_length = 1LL; } if (v16) v11 = (void (*)(struct _IO_FILE *))cut_bytes; else v11 = (void (*)(struct _IO_FILE *))cut_fields; v19 = v11; if (argc == optind) { v14 = cut_file("-", v11); } else { v14 = 1; while (argc > optind) { v14 = (unsigned char)(v14 & cut_file(argv[optind], v19)) != 0; ++optind; } } if (have_read_stdin && (unsigned int)rpl_fclose(stdin) == -1) { v12 = _errno_location(); error(0, *v12, "-"); v14 = 0; } return (unsigned char)v14 ^ 1; }
coreutils
ida
static void sort_found_occurs(void) { if (number_of_occurs[0]) qsort(occurs_table[0], number_of_occurs[0], sizeof **occurs_table, compare_occurs); }
void sort_found_occurs() { unsigned long long v1; unsigned long long v2; v1 = number_of_occurs; if (number_of_occurs) v2 = qsort(occurs_table, number_of_occurs, 0x30, compare_occurs); return; }
coreutils
angr_phoenix
_Bool force_conflicts(struct deppossi *possi) { return in_force(FORCE_CONFLICTS); }
long long force_conflicts(unsigned long a0) { unsigned long v0; v0 = a0; return in_force(0x800); }
dpkg
angr_dream
static inline void emit_stdin_note(void) { fputs_unlocked( gettext("\nWith no FILE, or when FILE is -, read standard input.\n"), stdout) ; }
void emit_stdin_note() { unsigned long long v1; v1 = fputs_unlocked( gettext("\nWith no FILE, or when FILE is -, read standard input.\n"), stdout); return; }
coreutils
angr_phoenix
static void note_key(struct pkcs11_provider *p, CK_ULONG slotidx, const char *context, struct sshkey *key) { char *fp; if ((fp = sshkey_fingerprint(key, 2, SSH_FP_DEFAULT)) == ((void *)0)) { sshlog("ssh-pkcs11.c", __func__, 1091, 1, SYSLOG_LEVEL_ERROR, ((void *)0), "sshkey_fingerprint failed"); return; } sshlog("ssh-pkcs11.c", __func__, 1094, 0, SYSLOG_LEVEL_DEBUG2, ((void *)0), "%s: provider %s slot %lu: %s %s", context, p->name, (u_long)slotidx, sshkey_type(key), fp); free(fp); }
void note_key(unsigned long long *a0, unsigned long a1, unsigned long a2, unsigned long long a3) { unsigned long v0; unsigned long v1; unsigned long v2; unsigned long v3; void *v4; unsigned long long v6; unsigned long long v7; v4 = sshkey_fingerprint(a3, 0x2, 0x0); if (!v4) { v6 = sshlog("ssh-pkcs11.c", "note_key", 0x443, 0x1, 0x2, 0x0, "sshkey_fingerprint failed"); } else { sshkey_type(a3); v3 = v4; v2 = a1; v1 = *(a0); v0 = a2; sshlog("ssh-pkcs11.c", "note_key", 0x446, 0x0, 0x6, 0x0, "%s: provider %s slot %lu: %s %s"); v7 = free(v4); } return; }
openssh-portable
angr_phoenix
static _Bool cwrite(_Bool new_file_flag, char const *bp, size_t bytes) { if (new_file_flag) { if (!bp && bytes == 0 && elide_empty_files) return 1; closeout(((void *)0), output_desc, filter_pid, outfile); next_file_name(); output_desc = create(outfile); if (output_desc < 0) ((!!sizeof(struct { _Static_assert( 1, "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), \"%s\", quotearg_n_style_colon " "(0, shell_escape_quoting_style, outfile)), assume (false))" ")"); int _gl_dummy; })) ? ((error(1, (*__errno_location()), "%s", quotearg_n_style_colon(0, shell_escape_quoting_style, outfile)), ((0) ? (void)0 : __builtin_unreachable()))) : ((error(1, (*__errno_location()), "%s", quotearg_n_style_colon(0, shell_escape_quoting_style, outfile)), ((0) ? (void)0 : __builtin_unreachable())))); } if (full_write(output_desc, bp, bytes) == bytes) return 1; else { if (!ignorable((*__errno_location()))) ((!!sizeof(struct { _Static_assert( 1, "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), \"%s\", quotearg_n_style_colon " "(0, shell_escape_quoting_style, outfile)), assume (false))" ")"); int _gl_dummy; })) ? ((error(1, (*__errno_location()), "%s", quotearg_n_style_colon(0, shell_escape_quoting_style, outfile)), ((0) ? (void)0 : __builtin_unreachable()))) : ((error(1, (*__errno_location()), "%s", quotearg_n_style_colon(0, shell_escape_quoting_style, outfile)), ((0) ? (void)0 : __builtin_unreachable())))); return 0; } }
long cwrite(char a1, long a2, long a3) { const char *v4; int *v5; int *v6; const char *v7; int *v8; if (a1) { if (!a2 && !a3 && elide_empty_files) return 1LL; closeout(0LL, output_desc, filter_pid, (long)outfile); next_file_name(); output_desc = create((const char *)outfile); if (output_desc < 0) { v4 = (const char *)quotearg_n_style_colon(0LL, 3LL, outfile); v5 = _errno_location(); error(1, *v5, "%s", v4); } } if (a3 == full_write((unsigned int)output_desc, a2, a3)) return 1LL; v6 = _errno_location(); if (!ignorable(*v6)) { v7 = (const char *)quotearg_n_style_colon(0LL, 3LL, outfile); v8 = _errno_location(); error(1, *v8, "%s", v7); } return 0LL; }
coreutils
ida
static VALUE *str_value(char const *s) { VALUE *v = xmalloc(sizeof *v); v->type = string; v->u.s = xstrdup(s); return v; }
int str_value(unsigned long long a0) { struct_0 *v0; v0 = xmalloc(0x18); v0->field_0 = 1; v0->field_8 = xstrdup(a0); return v0; }
coreutils
angr_sailr
int rl_vi_overstrike(int count, int key) { if (_rl_vi_doing_insert == 0) { _rl_vi_doing_insert = 1; rl_begin_undo_group(); } if (count > 0) { if (_rl_overwrite_char(count, key) != 0) return (1); vi_replace_count += count; } return (0); }
int rl_vi_overstrike(unsigned long long a0, unsigned long long a1, unsigned long long a2, unsigned long long a3, unsigned long long a4, unsigned long long a5) { char v0; unsigned int v1; unsigned int v2; unsigned int v4; v2 = a0; v1 = a1; if (!_rl_vi_doing_insert) { _rl_vi_doing_insert = 1; rl_begin_undo_group(a0, a1, a2, a3, a4, a5, *(&v0), *(&v1)); } if (v2 > 0) { if (_rl_overwrite_char(v2, v1, v1)) { v4 = 1; goto LABEL_40422a; } else { vi_replace_count = v2 + vi_replace_count; } } v4 = 0; LABEL_40422a: return v4; }
bash
angr_phoenix
static _Bool get_comp_type(const char **str, enum comparison_type *comp_type) { switch (**str) { case '+': *comp_type = COMP_GT; (*str)++; break; case '-': *comp_type = COMP_LT; (*str)++; break; default: *comp_type = COMP_EQ; break; } return 1; }
int get_comp_type(char **a0, unsigned int *a1) { if (*(*(a0)) == 43) { *(a1) = 0; *(a0) = *(a0) + 1; } else if (*(*(a0)) == 45) { *(a1) = 1; *(a0) = *(a0) + 1; } else { *(a1) = 2; } return 1; }
findutils
angr_phoenix
static void sshsk_free_sign_response(struct sk_sign_response *r) { if (r == ((void *)0)) return; freezero(r->sig_r, r->sig_r_len); freezero(r->sig_s, r->sig_s_len); freezero(r, sizeof(*r)); }
void sshsk_free_sign_response(unsigned long long a0[5]) { unsigned long long v1; unsigned long long v2; if (a0) { freezero(a0[1], a0[2], a0[2]); freezero(a0[3], a0[4], a0[4]); v2 = freezero(a0, 0x28, v1); } return; }
openssh-portable
angr_phoenix
hasevery(struct tree const *a, struct tree const *b) { if (!b) return 1; if (!hasevery(a, b->llink)) return 0; if (!hasevery(a, b->rlink)) return 0; while (a && b->label != a->label) if (b->label < a->label) a = a->llink; else a = a->rlink; return !!a; }
int hasevery(unsigned long long a0, struct_0 *a1) { struct_0 *v0; unsigned int v2; v0 = a0; if (!a1) { v2 = 1; } else if ((hasevery(v0, a1->field_0) ^ 1)) { v2 = 0; } else { v2 = hasevery(v0, a1->field_8) ^ 1; if (v2) { v2 = 0; } else { while (true) { if (!v0) break; v2 = v0->field_18; if (a1->field_18 == v0->field_18) break; if (a1->field_18 >= v0->field_18) { v2 = v0->field_8; v0 = v0->field_8; } else { v2 = v0->field_0; v0 = v0->field_0; } } *(&v2) = v0; } } return v2; }
grep
angr_phoenix
static _Bool sync_arg(enum sync_mode mode, char const *file) { _Bool ret = 1; int open_flags = 00 | 04000; int fd; fd = open(file, open_flags); if (fd < 0) { int rd_errno = (*__errno_location()); if (open_flags != (01 | 04000)) fd = open(file, 01 | 04000); if (fd < 0) { error(0, rd_errno, gettext("error opening %s"), quotearg_style(shell_escape_always_quoting_style, file)); return 0; } } int fdflags = rpl_fcntl(fd, 3); if (fdflags == -1 || rpl_fcntl(fd, 4, fdflags & ~04000) < 0) { error(0, (*__errno_location()), gettext("couldn't reset non-blocking mode %s"), quotearg_style(shell_escape_always_quoting_style, file)); ret = 0; } if (ret == 1) { int sync_status = -1; switch (mode) { case MODE_DATA: sync_status = fdatasync(fd); break; case MODE_FILE: sync_status = fsync(fd); break; case MODE_FILE_SYSTEM: sync_status = syncfs(fd); break; default: ((void)sizeof(("invalid sync_mode") ? 1 : 0), __extension__({ if ("invalid sync_mode") ; else __assert_fail("\"invalid sync_mode\"", "src/sync.c", 152, __extension__ __PRETTY_FUNCTION__); })); } if (sync_status < 0) { error(0, (*__errno_location()), gettext("error syncing %s"), quotearg_style(shell_escape_always_quoting_style, file)); ret = 0; } } if (close(fd) < 0) { error(0, (*__errno_location()), gettext("failed to close %s"), quotearg_style(shell_escape_always_quoting_style, file)); ret = 0; } return ret; }
int sync_arg(unsigned long a0, char *a1) { char v0; unsigned int v1; unsigned int v2; unsigned int v3; unsigned int v4; unsigned int v5; unsigned long long v8; unsigned int v9; unsigned long long v10; unsigned long long v11; unsigned long long v12; v0 = 1; v3 = 0x800; v1 = open(a1, v3, v3); if (v1 < 0) { v4 = *(__errno_location()); if (v3 != 2049) v1 = open(a1, 0x801, v3); if (v1 < 0) { v8 = quotearg_style(0x4, a1); error(0x0, v4, gettext("error opening %s")); v9 = 0; goto LABEL_4005c6; } } v5 = rpl_fcntl(v1, 0x3); if (v5 != -1 && !(rpl_fcntl(v1, 0x4) < 0)) goto LABEL_4004cf; v10 = quotearg_style(0x4, a1); error(0x0, *(__errno_location()), gettext("couldn't reset non-blocking mode %s")); v0 = 0; LABEL_4004cf: if (v0) { v2 = -1; if (a0 == 2) { v2 = syncfs(v1); } else if (a0 <= 2) { if (!a0) { v2 = fsync(v1); } else if (a0 == 1) { v2 = fdatasync(v1); } } if (v2 < 0) { v11 = quotearg_style(0x4, a1); error(0x0, *(__errno_location()), gettext("error syncing %s")); v0 = 0; } } if (close(v1) < 0) { v12 = quotearg_style(0x4, a1); error(0x0, *(__errno_location()), gettext("failed to close %s")); v0 = 0; } v9 = v0; LABEL_4005c6: return v9; }
coreutils
angr_phoenix
static char const *long_double_format(char const *fmt, struct layout *layout) { size_t i; size_t prefix_len = 0; size_t suffix_len = 0; size_t length_modifier_offset; _Bool has_L; for (i = 0; !(fmt[i] == '%' && fmt[i + 1] != '%'); i += (fmt[i] == '%') + 1) { if (!fmt[i]) ((!!sizeof(struct { _Static_assert(1, "verify_expr (" "1" ", " "(error (1, 0, gettext (\"format %s has no %% " "directive\"), quote (fmt)), assume (false))" ")"); int _gl_dummy; })) ? ((error(1, 0, gettext("format %s has no %% directive"), quote(fmt)), ((0) ? (void)0 : __builtin_unreachable()))) : ((error(1, 0, gettext("format %s has no %% directive"), quote(fmt)), ((0) ? (void)0 : __builtin_unreachable())))); prefix_len++; } i++; i += strspn(fmt + i, "-+#0 '"); i += strspn(fmt + i, "0123456789"); if (fmt[i] == '.') { i++; i += strspn(fmt + i, "0123456789"); } length_modifier_offset = i; has_L = (fmt[i] == 'L'); i += has_L; if (fmt[i] == '\0') ((!!sizeof(struct { _Static_assert(1, "verify_expr (" "1" ", " "(error (1, 0, gettext (\"format %s ends in %%\"), " "quote (fmt)), assume (false))" ")"); int _gl_dummy; })) ? ((error(1, 0, gettext("format %s ends in %%"), quote(fmt)), ((0) ? (void)0 : __builtin_unreachable()))) : ((error(1, 0, gettext("format %s ends in %%"), quote(fmt)), ((0) ? (void)0 : __builtin_unreachable())))); if (!strchr("efgaEFGA", fmt[i])) ((!!sizeof(struct { _Static_assert(1, "verify_expr (" "1" ", " "(error (1, 0, gettext (\"format %s has unknown %%%c " "directive\"), quote (fmt), fmt[i]), assume (false))" ")"); int _gl_dummy; })) ? ((error(1, 0, gettext("format %s has unknown %%%c directive"), quote(fmt), fmt[i]), ((0) ? (void)0 : __builtin_unreachable()))) : ((error(1, 0, gettext("format %s has unknown %%%c directive"), quote(fmt), fmt[i]), ((0) ? (void)0 : __builtin_unreachable())))); for (i++;; i += (fmt[i] == '%') + 1) if (fmt[i] == '%' && fmt[i + 1] != '%') ((!!sizeof(struct { _Static_assert(1, "verify_expr (" "1" ", " "(error (1, 0, gettext (\"format %s has too many %% " "directives\"), quote (fmt)), assume (false))" ")"); int _gl_dummy; })) ? ((error(1, 0, gettext("format %s has too many %% directives"), quote(fmt)), ((0) ? (void)0 : __builtin_unreachable()))) : ((error(1, 0, gettext("format %s has too many %% directives"), quote(fmt)), ((0) ? (void)0 : __builtin_unreachable())))); else if (fmt[i]) suffix_len++; else { size_t format_size = i + 1; char *ldfmt = xmalloc(format_size + 1); memcpy(ldfmt, fmt, length_modifier_offset); ldfmt[length_modifier_offset] = 'L'; strcpy(ldfmt + length_modifier_offset + 1, fmt + length_modifier_offset + has_L); layout->prefix_len = prefix_len; layout->suffix_len = suffix_len; return ldfmt; } }
int long_double_format(void *a0, unsigned long long a1[2]) { char v0; void *v1; void *v2; void *v3; void *v4; void *v5; void *v6; unsigned long long v8; unsigned long long v9; unsigned long long v11; unsigned long long v12; unsigned long long v13; unsigned long long v14; v2 = 0; v3 = 0; v1 = 0; while (true) { if (*((v1 + a0)) == 37) { if (*((a0 + v1 + 1)) != 37) break; } if (!*((v1 + a0))) { v9 = quote(a0); error(0x1, 0x0, gettext("format %s has no %% directive")); } v2 += 1; if (*((v1 + a0)) == 37) v8 = 2; else v8 = 1; v1 += v8; } v1 += 1; v1 += strspn(v1 + a0, "-+#0 '"); v1 += strspn(v1 + a0, "0123456789"); if (*((v1 + a0)) == 46) { v1 += 1; v1 += strspn(v1 + a0, "0123456789"); } v4 = v1; v0 = *((v1 + a0)) == 76; v1 += v0; if (!*((v1 + a0))) { v11 = quote(a0); error(0x1, 0x0, gettext("format %s ends in %%")); } else if (!strchr("efgaEFGA", *((v1 + a0)))) { v13 = quote(a0); error(0x1, 0x0, gettext("format %s has unknown %%%c directive")); } else { v1 += 1; while (true) { if (*((v1 + a0)) == 37 && *((a0 + v1 + 1)) != 37) { v14 = quote(a0); error(0x1, 0x0, gettext("format %s has too many %% directives")); } if (*((a0 + v1 + 1)) == 37 || *((v1 + a0)) != 37) { if (*((v1 + a0))) { v3 += 1; if (*((v1 + a0)) == 37) v12 = 2; else v12 = 1; v1 += v12; } else { v5 = v1 + 1; v6 = xmalloc(v5 + 1); memcpy(v6, a0, v4); *((v4 + v6)) = 76; strcpy(v6 + v4 + 1, v0 + v4 + a0); a1[0] = v2; a1[1] = v3; return v6; } } } } }
coreutils
angr_dream
static void verify_response(gnutls_datum_t *nonce) { gnutls_datum_t dat; size_t size; gnutls_x509_crt_t signer; common_info_st info; int v; gnutls_x509_crt_t chain[8]; unsigned chain_size = 0, i; if (ocsptool_options.present.load_response) dat.data = (void *)_gnutls_read_file(ocsptool_options.arg.load_response, 0x1, &size); else dat.data = (void *)_gnutls_fread_file(infile, 0, &size); if (dat.data == ((void *)0)) { fprintf(stderr, "error reading response\n"); app_exit(1); } dat.size = size; if (ocsptool_options.present.load_chain) { chain_size = load_chain(chain); if (chain_size < 1) { fprintf(stderr, "Empty chain found; cannot verify\n"); app_exit(1); } if (chain_size == 1) signer = chain[0]; else signer = chain[1]; v = _verify_response(&dat, nonce, signer, 1); for (i = 0; i < chain_size; i++) gnutls_x509_crt_deinit(chain[i]); } else if (ocsptool_options.present.load_trust) { v = _verify_response(&dat, nonce, ((void *)0), 1); } else { memset(&info, 0, sizeof(info)); info.verbose = verbose; if (!ocsptool_options.present.load_signer) { fprintf(stderr, "Missing option --load-signer or --load-chain\n"); app_exit(1); } info.cert = ocsptool_options.arg.load_signer; signer = load_cert(1, &info); v = _verify_response(&dat, nonce, signer, 1); gnutls_x509_crt_deinit(signer); } free(dat.data); if (v && !ocsptool_options.present.ignore_errors) app_exit(1); }
void verify_response(void *a0) { unsigned int v0; unsigned int v1; unsigned int v2; char v3; unsigned long long v4; void *v5; unsigned int v6; char v7; unsigned long v8; unsigned int v9; char v10; char v11; char v12; unsigned long long *v14; unsigned long long v15; v2 = 0; if (g_50004b) v5 = _gnutls_read_file(gnutls_ocsp_resp_import, 0x1, &v3); else v5 = _gnutls_fread_file(infile, 0x0, &v3); if (!v5) { fprintf(*(&stderr), "error reading response\n"); app_exit(0x1); } v6 = *(&v3); if (g_500042) { v2 = load_chain(&v10); if (!v2) { fprintf(*(&stderr), "Empty chain found; cannot verify\n"); app_exit(0x1); } if (v2 == 1) v4 = *(&v10); else v4 = *(&v11); v0 = _verify_response(&v5, a0, v4, 0x1); for (v1 = 0; v1 < v2; v1 += 1) { gnutls_x509_crt_deinit(*(&(&v10)[8 * v1])); } } else if (g_500045) { v0 = _verify_response(&v5, a0, 0x0, 0x1); } else { memset(&v7, 0x0, 0xd8); v9 = verbose; if ((g_500046 ^ 1)) { fprintf(*(&stderr), "Missing option --load-signer or --load-chain\n"); app_exit(0x1); } v8 = gnutls_ocsp_resp_init; v4 = load_cert(0x1, &v7); v0 = _verify_response(&v5, a0, v4, 0x1); gnutls_x509_crt_deinit(v4); } if (!(g_500046 ^ 1) && !g_500042 || !g_500042 && g_500045 || v2 && g_500042) { free(v5); if (v0 && (g_50004c ^ 1)) app_exit(0x1); if (!v0 || !(g_50004c ^ 1)) { v15 = *(&v12) ^ v14[5]; return; } } }
gnutls
angr_dream
static int bash_check_expchar(dirname, need_closer, nextp, closerp) char *dirname; int need_closer; int *nextp, *closerp; { char *t; int ret, n, c; ret = n = c = 0; if (t = mbschr(dirname, '$')) { ret = '$'; n = t[1]; if (n == '(') c = ')'; else if (n == '{') c = '}'; else n = 0; if (c && need_closer) { int p; char delims[2]; delims[0] = c; delims[1] = 0; p = skip_to_delim(t, 1, delims, 0x001 | 0x100); if (t[p] != c) ret = 0; } } else if (dirname[0] == '~') ret = '~'; else { t = mbschr(dirname, '`'); if (t) { if (need_closer == 0) ret = '`'; else if (unclosed_pair(dirname, strlen(dirname), "`") == 0) ret = '`'; } } if (nextp) *nextp = n; if (closerp) *closerp = c; return ret; }
int bash_check_expchar(char *a0, unsigned long a1, unsigned int *a2, unsigned int *a3) { unsigned int v0; unsigned int v1; unsigned int v2; unsigned int v3; unsigned long v4; char v5; char v6; v2 = 0; v1 = v2; v0 = v1; *(&v4) = mbschr(a0, 0x24, a2); if (v4) { v0 = 36; v1 = v4[1]; if (v1 == 40) { v2 = 41; } else { if (v1 == 123) v2 = 125; else v1 = 0; } if (v2 && a1) { v5 = v2; v6 = 0; v3 = skip_to_delim(v4, 0x1, &v5, 0x101); if (v2 != v4[v3]) v0 = 0; } } else if (*(a0) == 126) { v0 = 126; } else { v4 = mbschr(a0, 0x60, a2); if (v4) { if (!a1) { v0 = 96; } else if (!unclosed_pair(a0, strlen(a0), "`", strlen(a0))) { v0 = 96; } } } if (a2) *(a2) = v1; if (a3) *(a3) = v2; return v0; }
bash
angr_phoenix
static struct sshsk_provider *sshsk_open(const char *path) { struct sshsk_provider *ret = ((void *)0); uint32_t version; if (path == ((void *)0) || *path == '\0') { sshlog("ssh-sk.c", __func__, 113, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "No FIDO SecurityKeyProvider specified"); return ((void *)0); } if ((ret = calloc(1, sizeof(*ret))) == ((void *)0)) { sshlog("ssh-sk.c", __func__, 117, 1, SYSLOG_LEVEL_ERROR, ((void *)0), "calloc failed"); return ((void *)0); } if ((ret->path = strdup(path)) == ((void *)0)) { sshlog("ssh-sk.c", __func__, 121, 1, SYSLOG_LEVEL_ERROR, ((void *)0), "strdup failed"); goto fail; } if (strcasecmp(ret->path, "internal") == 0) { sshlog("ssh-sk.c", __func__, 132, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "internal security key support not enabled"); goto fail; } if ((ret->dlhandle = dlopen(path, 0x00002)) == ((void *)0)) { sshlog("ssh-sk.c", __func__, 137, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "Provider \"%s\" dlopen failed: %s", path, dlerror()); goto fail; } if ((ret->sk_api_version = dlsym(ret->dlhandle, "sk_api_version")) == ((void *)0)) { sshlog("ssh-sk.c", __func__, 142, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "Provider \"%s\" dlsym(sk_api_version) failed: %s", path, dlerror()); goto fail; } version = ret->sk_api_version(); sshlog("ssh-sk.c", __func__, 147, 1, SYSLOG_LEVEL_DEBUG1, ((void *)0), "provider %s implements version 0x%08lx", ret->path, (u_long)version); if ((version & 0xffff0000) != 0x000a0000) { sshlog("ssh-sk.c", __func__, 150, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "Provider \"%s\" implements unsupported " "version 0x%08lx (supported: 0x%08lx)", path, (u_long)version, (u_long)0x000a0000) ; goto fail; } if ((ret->sk_enroll = dlsym(ret->dlhandle, "sk_enroll")) == ((void *)0)) { sshlog("ssh-sk.c", __func__, 156, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "Provider %s dlsym(sk_enroll) failed: %s", path, dlerror()); goto fail; } if ((ret->sk_sign = dlsym(ret->dlhandle, "sk_sign")) == ((void *)0)) { sshlog("ssh-sk.c", __func__, 161, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "Provider \"%s\" dlsym(sk_sign) failed: %s", path, dlerror()); goto fail; } if ((ret->sk_load_resident_keys = dlsym(ret->dlhandle, "sk_load_resident_keys")) == ((void *)0)) { sshlog("ssh-sk.c", __func__, 167, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "Provider \"%s\" dlsym(sk_load_resident_keys) " "failed: %s", path, dlerror()); goto fail; } return ret; fail: sshsk_free(ret); return ((void *)0); }
int sshsk_open(char *a0) { unsigned long long v0; char *v1; unsigned long v2; unsigned long long v3; unsigned int v4; unsigned long long v5[6]; unsigned int v7; v5 = 0; if (a0 && *(a0)) { v5[0] = calloc(0x1, 0x30); if (!v5) { v2 = "calloc failed"; sshlog("ssh-sk.c", "sshsk_open", 0x75, 0x1, 0x2, 0x0); v7 = 0; } else { v5[0] = strdup(a0); if (!v5[0]) { v2 = "strdup failed"; sshlog("ssh-sk.c", "sshsk_open", 0x79, 0x1, 0x2, 0x0); } else { v7 = strcasecmp(v5[0], "internal"); if (!v7) { v2 = "internal security key support not enabled"; sshlog("ssh-sk.c", "sshsk_open", 0x84, 0x0, 0x2, 0x0); } else { v5[1] = dlopen(a0, 0x2); if (!v5[1]) { v2 = dlerror(); v1 = a0; v0 = "Provider \"%s\" dlopen failed: %s"; sshlog("ssh-sk.c", "sshsk_open", 0x89, 0x0, 0x2, 0x0); } else { v5[2] = dlsym(v5[1], "sk_api_version"); if (!v5[2]) { v2 = dlerror(); v1 = a0; v0 = "Provider \"%s\" dlsym(sk_api_version) failed: %s"; sshlog("ssh-sk.c", "sshsk_open", 0x8e, 0x0, 0x2, 0x0); } else { v4 = *(((stack_base)[16] + 16))(); v2 = v4; v1 = v5[0]; v0 = "provider %s implements version 0x%08lx"; sshlog("ssh-sk.c", "sshsk_open", 0x93, 0x1, 0x5, 0x0); *(&v7) = v4; *(&v7) = 0; if (v7 != 0xa0000) { v3 = 0xa0000; v2 = v4; v1 = a0; v0 = "Provider \"%s\" implements unsupported version 0x%08lx " "(supported: 0x%08lx)"; sshlog("ssh-sk.c", "sshsk_open", 0x96, 0x0, 0x2, 0x0); } else { v5[3] = dlsym(v5[1], "sk_enroll"); if (!v5[3]) { v2 = dlerror(); v1 = a0; v0 = "Provider %s dlsym(sk_enroll) failed: %s"; sshlog("ssh-sk.c", "sshsk_open", 0x9c, 0x0, 0x2, 0x0); } else { v5[4] = dlsym(v5[1], "sk_sign"); if (!v5[4]) { v2 = dlerror(); v1 = a0; v0 = "Provider \"%s\" dlsym(sk_sign) failed: %s"; sshlog("ssh-sk.c", "sshsk_open", 0xa1, 0x0, 0x2, 0x0); } else { v5[5] = dlsym(v5[1], "sk_load_resident_keys"); if (!v5[5]) { v2 = dlerror(); v1 = a0; v0 = "Provider \"%s\" dlsym(sk_load_resident_keys) " "failed: %s"; sshlog("ssh-sk.c", "sshsk_open", 0xa7, 0x0, 0x2, 0x0); } else { *(&v7) = v5; } } } } } } } } if (!v5[5] || !v5[4] || !v5[1] || !v7 || !v5[2] || !v5[0] || !v5[3] || v7 != 0xa0000) { sshsk_free(v5); *(&v7) = 0; } } } if (!a0 || !*(a0)) { v2 = "No FIDO SecurityKeyProvider specified"; sshlog("ssh-sk.c", "sshsk_open", 0x71, 0x0, 0x2, 0x0); v7 = 0; } return v7; }
openssh-portable
angr_dream
static void usage(void) { iplink_usage(); }
void usage() { iplink_usage(); }
iproute2-6.0.0
ida
static int iplink_modify(int cmd, unsigned int flags, int argc, char **argv) { char *type = ((void *)0); struct iplink_req req = { .n.nlmsg_len = ((sizeof(struct ifinfomsg)) + ((int)(((sizeof(struct nlmsghdr)) + 4U - 1) & ~(4U - 1)))), .n.nlmsg_flags = 0x01 | flags, .n.nlmsg_type = cmd, .i.ifi_family = preferred_family, }; int ret; ret = iplink_parse(argc, argv, &req, &type); if (ret < 0) return ret; if (type) { struct link_util *lu; struct rtattr *linkinfo; char *ulinep = strchr(type, '_'); int iflatype; linkinfo = addattr_nest(&req.n, sizeof(req), IFLA_LINKINFO); addattr_l(&req.n, sizeof(req), IFLA_INFO_KIND, type, strlen(type)); lu = get_link_kind(type); if (ulinep && !strcmp(ulinep, "_slave")) iflatype = IFLA_INFO_SLAVE_DATA; else iflatype = IFLA_INFO_DATA; argc -= ret; argv += ret; if (lu && argc) { struct rtattr *data; data = addattr_nest(&req.n, sizeof(req), iflatype); if (lu->parse_opt && lu->parse_opt(lu, argc, argv, &req.n)) return -1; addattr_nest_end(&req.n, data); } else if (argc) { if (matches(*argv, "help") == 0) usage(); fprintf( stderr, "Garbage instead of arguments \"%s ...\". Try \"ip link help\".\n", *argv); return -1; } addattr_nest_end(&req.n, linkinfo); } else if (flags & 0x400) { fprintf(stderr, "Not enough information: \"type\" argument is required\n"); return -1; } if (rtnl_talk(&rth, &req.n, ((void *)0)) < 0) return -2; ll_drop_by_index(req.i.ifi_index); return 0; }
long iplink_modify(short a1, short a2, unsigned int a3, const char **a4) { unsigned int v5; const char **v7; unsigned int v9; unsigned int v10; int v11; char *s; char *s1; long v14; _QWORD *link_kind; long v16; int v17[266]; unsigned long v18; v18 = __readfsqword(0x28u); s = 0LL; memset(v17, 0, 0x420uLL); v17[0] = 32; LOWORD(v17[1]) = a1; HIWORD(v17[1]) = a2 | 1; LOBYTE(v17[4]) = preferred_family; v11 = iplink_parse(a3, a4, (long)v17, (const char **)&s); if (v11 < 0) return (unsigned int)v11; if (!s) { if ((a2 & 0x400) != 0) { fprintf(stderr, "Not enough information: \"type\" argument is required\n"); return 0xFFFFFFFFLL; } goto LABEL_21; } s1 = strchr(s, 95); v14 = addattr_nest(v17, 1056LL, 18LL); v5 = strlen(s); addattr_l(v17, 1056LL, 1LL, s, v5); link_kind = get_link_kind(s); if (s1 && !strcmp(s1, "_slave")) v10 = 5; else v10 = 2; v9 = a3 - v11; v7 = &a4[v11]; if (link_kind && v9) { v16 = addattr_nest(v17, 1056LL, v10); if (link_kind[3] && ((unsigned int (*)(_QWORD *, _QWORD, const char **, int *))link_kind[3])(link_kind, v9, v7, v17)) { return 0xFFFFFFFFLL; } addattr_nest_end(v17, v16); goto LABEL_18; } if (!v9) { LABEL_18: addattr_nest_end(v17, v14); LABEL_21: if ((int)rtnl_talk(&rth, v17, 0LL) < 0) return 4294967294LL; ll_drop_by_index((unsigned int)v17[5]); return 0LL; } if ((unsigned char)matches(*v7, "help") != 1) usage(); fprintf(stderr, "Garbage instead of arguments \"%s ...\". Try \"ip link help\".\n", *v7); return 0xFFFFFFFFLL; }
iproute2-6.0.0
ida
int sshsig_armor(const struct sshbuf *blob, struct sshbuf **out) { struct sshbuf *buf = ((void *)0); int r = -1; *out = ((void *)0); if ((buf = sshbuf_new()) == ((void *)0)) { sshlog("sshsig.c", __func__, 57, 1, SYSLOG_LEVEL_ERROR, ((void *)0), "sshbuf_new failed"); r = -2; goto out; } if ((r = sshbuf_put(buf, "-----BEGIN SSH SIGNATURE-----\n", sizeof("-----BEGIN SSH SIGNATURE-----\n") - 1)) != 0) { sshlog("sshsig.c", __func__, 64, 1, SYSLOG_LEVEL_ERROR, ssh_err(r), "sshbuf_putf"); goto out; } if ((r = sshbuf_dtob64(blob, buf, 1)) != 0) { sshlog("sshsig.c", __func__, 69, 1, SYSLOG_LEVEL_ERROR, ssh_err(r), "base64 encode signature"); goto out; } if ((r = sshbuf_put(buf, "-----END SSH SIGNATURE-----", sizeof("-----END SSH SIGNATURE-----") - 1)) != 0 || (r = sshbuf_put_u8(buf, '\n')) != 0) { sshlog("sshsig.c", __func__, 76, 1, SYSLOG_LEVEL_ERROR, ssh_err(r), "sshbuf_put"); goto out; } *out = buf; buf = ((void *)0); r = 0; out: sshbuf_free(buf); return r; }
long long sshsig_armor(unsigned long long a0, unsigned long long *a1) { unsigned long long v0; unsigned int v1; void *v2; v2 = 0; v1 = -1; *(a1) = 0; v2 = sshbuf_new(); if (!v2) { v0 = "sshbuf_new failed"; sshlog("sshsig.c", "sshsig_armor", 0x39, 0x1, 0x2, 0x0); v1 = -2; } else { v1 = sshbuf_put(v2, "-----BEGIN SSH SIGNATURE-----\n", 0x1e); if (v1) { v0 = "sshbuf_putf"; sshlog("sshsig.c", "sshsig_armor", 0x40, 0x1, 0x2, ssh_err(v1)); } else { v1 = sshbuf_dtob64(a0, v2, 0x1, v2); if (v1) { v0 = "base64 encode signature"; sshlog("sshsig.c", "sshsig_armor", 0x45, 0x1, 0x2, ssh_err(v1)); } else { v1 = sshbuf_put(v2, "-----END SSH SIGNATURE-----", 0x1b); if (!v1) { v1 = sshbuf_put_u8(v2, 0xa); if (!v1) { *(a1) = v2; v2 = 0; v1 = 0; } } if (v1 || v1) { v0 = "sshbuf_put"; sshlog("sshsig.c", "sshsig_armor", 0x4c, 0x1, 0x2, ssh_err(v1)); } } } } sshbuf_free(v2); return v1; }
openssh-portable
angr_dream
static void rl_signal_handler(int sig) { _rl_caught_signal = sig; return; }
long long rl_signal_handler(unsigned long a0) { _rl_caught_signal = a0; return a0; }
bash
angr_sailr
static void quote_array_assignment_chars(list) WORD_LIST *list; { char *nword; WORD_LIST *l; for (l = list; l; l = l->next) { if (l->word == 0 || l->word->word == 0 || l->word->word[0] == '\0') continue; if ((l->word->flags & (1 << 2)) == 0) continue; if (l->word->word[0] != '[' || mbschr(l->word->word, '=') == 0) continue; nword = quote_assign(l->word->word); sh_xfree((l->word->word), "arrayfunc.c", 1099); l->word->word = nword; l->word->flags |= (1 << 5); } }
void quote_array_assignment_chars(unsigned long long a0) { struct_0 *v0; unsigned long v1; unsigned long long v3; unsigned long long v5; v3 = a0; for (v0 = a0; v0; v0 = v0->field_0) { if (v0->field_8 && v0->field_8->field_0 && *(v0->field_8->field_0) && (v0->field_8->field_8 & 4) && *(v0->field_8->field_0) == 91 && mbschr(v0->field_8->field_0, 0x3d)) { v1 = quote_assign(v0->field_8->field_0); sh_xfree(v0->field_8->field_0, "arrayfunc.c", 0x44b); v0->field_8->field_0 = v1; v0->field_8->field_8 = v0->field_8->field_8 | 32; } v5 = v0->field_0; } return; }
bash
angr_dream
static void KEM_KeyGen(unsigned char *pk, unsigned char *sk) { int i; ZKeyGen(pk, sk); sk += (2 * ((761 + 3) / 4)); for (i = 0; i < 1158; ++i) *sk++ = pk[i]; arc4random_buf((sk), (((761 + 3) / 4))); sk += ((761 + 3) / 4); Hash_prefix(sk, 4, pk, 1158); }
void KEM_KeyGen(char *a0, unsigned long long a1) { char *v0; int tmp_27; unsigned int v1; unsigned long long v3; v0 = a1; ZKeyGen(a0, v0); v0 += 382; for (v1 = 0; v1 <= 1157; v1 = __addvsi3(v1, 0x1, a0[v1])) { tmp_27 = v0; v0 += 1; *(tmp_27) = a0[v1]; } arc4random_buf(v0, 0xbf); v0 += 191; v3 = Hash_prefix(v0, 0x4, a0, 0x486); return; }
openssh-portable
angr_dream
static char *evalvar(char *p, int flag) { int subtype; int varflags; char *var; int patloc; int startloc; ssize_t varlen; int discard; int quoted; varflags = *p++; subtype = varflags & 0x0f; quoted = flag & 0x100; var = p; startloc = expdest - (char *)((void *)stacknxt); p = strchr(p, '=') + 1; again: varlen = varvalue(var, varflags, flag, quoted); if (varflags & 0x10) varlen--; discard = varlen < 0 ? 0x400 : 0; switch (subtype) { case 0x3: discard ^= 0x400; case 0: case 0x2: p = argstr(p, flag | 0x2 | 0x80 | (discard ^ 0x400)); goto record; case 0x5: case 0x4: p = subevalvar(p, var, 0, startloc, varflags, (flag & ~(0x1 | 0x10)) | (discard ^ 0x400)); if ((flag | ~discard) & 0x400) goto record; varflags &= ~0x10; subtype = 0x1; goto again; } if ((discard & ~flag) && optlist[14]) varunset(p, var, 0, 0); if (subtype == 0xa) { p++; if (flag & 0x400) return p; cvtnum(varlen > 0 ? varlen : 0, flag); goto really_record; } if (subtype == 0x1) goto record; flag |= discard; if (!(flag & 0x400)) { ((expdest) = _STPUTC(('\0'), (expdest))); } patloc = expdest - (char *)((void *)stacknxt); p = subevalvar(p, ((void *)0), patloc, startloc, varflags, flag); record: if ((flag | discard) & 0x400) return p; really_record: if (quoted) { quoted = *var == '@' && shellparam.nparam; if (!quoted) return p; } recordregion(startloc, expdest - (char *)((void *)stacknxt), quoted); return p; }
int evalvar(unsigned long a0, unsigned long a1) { unsigned int v0; int tmp_45; int tmp_19; int tmp_30; int tmp_39; void *v1; unsigned int v2; unsigned int v3; unsigned int v4; unsigned int v5; unsigned int v6; unsigned int v7; unsigned long long v8; char *v9; unsigned long v12; unsigned long long v14; v1 = a0; v0 = a1; tmp_45 = v1; v1 += 1; v3 = *(tmp_45); v2 = v3 & 15; v5 = v0 & 0x100; v9 = v1; v6 = expdest - stacknxt; v12 = strchr(v1, 0x3d) + 1; v1 = v12; while (true) { v8 = varvalue(v9, v3, v0, v5); if ((v3 & 16)) v8 -= 1; v4 = (v8 >> 53) & 0x400; if (v2 <= 5) { if (v2 < 4) { if (v2 == 3) v4 ^= 0x400; if ((v2 <= 3 || v2 == 3) && (!v2 || v2 == 3 || v2 == 2)) { v14 = v0; *(&v14) = v0 | 130; tmp_19 = v14; v12 = v4; *(&v12) = (v4 >> 8) ^ 4; tmp_30 = v12; v1 = argstr(v1, tmp_19 | tmp_30); } } else { v12 = v4; *(&v12) = (v4 >> 8) ^ 4; tmp_39 = v12; v1 = subevalvar(v1, v9, 0x0, v6, v3, v0 & -18 | tmp_39); if (!((!(v4) | v0) & 0x400)) { v3 &= -17; v2 = 1; continue; } } } if ((!(v0)&v4) && (v2 < 4 || v2 > 5) && (v2 > 5 || v2 != 3) && (v2 > 5 || v2 > 3 || v2) && (v2 > 5 || v2 > 3 || v2 != 2) && g_5000f6) varunset(v1, v9, 0x0, 0x0); if ((!(!(v0)&v4) || !g_5000f6) && (v2 < 4 || v2 > 5) && (v2 > 5 || v2 != 3) && (v2 > 5 || v2 > 3 || v2) && (v2 > 5 || v2 > 3 || v2 != 2)) { if (v2 == 10) { v1 += 1; if ((v0 & 0x400)) { *(&v12) = v1; break; } else { if ((v8 - 0 >> 63 ^ 1)) v12 = v8; else v12 = 0; cvtnum(v12, v0); } } else if (v2 != 1) { v0 |= v4; if (!(v0 & 0x400)) expdest = _STPUTC(0x0, expdest); v7 = expdest - stacknxt; v1 = subevalvar(v1, 0x0, v7, v6, v3, v0); } } if ((v2 <= 5 && ((!(v4) | v0) & 0x400) && v2 >= 4 || v2 <= 5 && v2 < 4 && (v2 <= 3 || v2 == 3) && (!v2 || v2 == 3 || v2 == 2) || v2 != 10 && (!(!(v0)&v4) || !g_5000f6) && (v2 < 4 || v2 > 5) && (v2 > 5 || v2 != 3) && (v2 > 5 || v2 > 3 || v2) && (v2 > 5 || v2 > 3 || v2 != 2)) && ((v0 | v4) & 0x400)) { *(&v12) = v1; break; } if (v2 == 10 && !(v0 & 0x400) && (!(!(v0)&v4) || !g_5000f6) && (v2 < 4 || v2 > 5) && (v2 > 5 || v2 != 3) && (v2 > 5 || v2 > 3 || v2) && (v2 > 5 || v2 > 3 || v2 != 2) || (v2 <= 5 && ((!(v4) | v0) & 0x400) && v2 >= 4 || v2 <= 5 && v2 < 4 && (v2 <= 3 || v2 == 3) && (!v2 || v2 == 3 || v2 == 2) || v2 != 10 && (!(!(v0)&v4) || !g_5000f6) && (v2 < 4 || v2 > 5) && (v2 > 5 || v2 != 3) && (v2 > 5 || v2 > 3 || v2) && (v2 > 5 || v2 > 3 || v2 != 2)) && !((v0 | v4) & 0x400)) { if (v5) { if (*(v9) == 64 && shellparam) *(&v12) = 1; if (!shellparam || *(v9) != 64) *(&v12) = 0; v5 = v12; if (!v5) { *(&v12) = v1; break; } } if (!v5 || v5) { recordregion(v6, expdest - stacknxt, v5); *(&v12) = v1; break; } } } return v12; }
dash-0.5.11+git20210903+057cd650a4ed
angr_dream
int assign_in_env(word, flags) WORD_DESC *word; int flags; { int offset, aflags; char *name, *temp, *value, *newname; SHELL_VAR *var; const char *string; string = word->word; aflags = 0; offset = assignment(string, 0); newname = name = (char *)strcpy( sh_xmalloc((1 + strlen(string)), "variables.c", 3605), (string)); value = (char *)((void *)0); if (name[offset] == '=') { name[offset] = 0; if (name[offset - 1] == '+') { name[offset - 1] = '\0'; aflags |= 0x0001; } if (legal_identifier(name) == 0) { sh_invalidid(name); sh_xfree((name), "variables.c", 3622); return (0); } var = find_variable(name); if (var == 0) { var = find_variable_last_nameref(name, 1); if (var && ((((var)->attributes) & (0x0000800))) && valid_nameref_value(((var)->value), 2)) { newname = ((var)->value); var = 0; } } else newname = ((var)->name); if (var && (((((var)->attributes) & (0x0000002))) || ((((var)->attributes) & (0x0004000))))) { if (((((var)->attributes) & (0x0000002)))) err_readonly(name); sh_xfree((name), "variables.c", 3651); return (0); } temp = name + offset + 1; value = expand_assignment_string_to_string(temp, 0); if (var && (aflags & 0x0001)) { if (value == 0) { value = (char *)sh_xmalloc((1), "variables.c", 3662); value[0] = '\0'; } temp = make_variable_value(var, value, aflags); do { if (value) sh_xfree((value), "variables.c", 3666); } while (0); value = temp; } } if (temporary_env == 0) temporary_env = hash_create(4); var = hash_lookup(newname, temporary_env); if (var == 0) var = make_new_variable(newname, temporary_env); else do { if (((var)->value)) sh_xfree((((var)->value)), "variables.c", 3678); } while (0); if (value == 0) { value = (char *)sh_xmalloc((1), "variables.c", 3682); value[0] = '\0'; } ((var)->value = (value)); var->attributes |= (0x0000001 | 0x0100000); var->context = variable_context; do { if ((var)->exportstr) { sh_xfree(((var)->exportstr), "variables.c", 3690); (var)->exportstr = (char *)((void *)0); } } while (0); var->exportstr = mk_env_string(newname, value, 0); array_needs_making = 1; if (flags) { if (((newname)[0] == ("POSIXLY_CORRECT")[0] && strcmp(newname, "POSIXLY_CORRECT") == 0) || ((newname)[0] == ("POSIX_PEDANDTIC")[0] && strcmp(newname, "POSIX_PEDANDTIC") == 0)) save_posix_options(); stupidly_hack_special_variables(newname); } if (echo_command_at_execute) xtrace_print_assignment(name, value, 0, 1); sh_xfree((name), "variables.c", 3707); return 1; }
undefined8 assign_in_env(char **param_1, int param_2) { int iVar1; int iVar2; size_t sVar3; char *__dest; char *pcVar4; undefined *puVar5; undefined8 uVar6; bool bVar7; undefined *local_38; char *local_30; char **local_28; pcVar4 = *param_1; iVar1 = assignment(pcVar4, 0); sVar3 = strlen(pcVar4); __dest = (char *)sh_xmalloc(sVar3 + 1, "variables.c", 0xe15); pcVar4 = strcpy(__dest, pcVar4); local_38 = (undefined *)0x0; puVar5 = local_38; local_30 = pcVar4; if (pcVar4[iVar1] == '=') { pcVar4[iVar1] = '\0'; bVar7 = pcVar4[(long)iVar1 + -1] == '+'; if (bVar7) { pcVar4[(long)iVar1 + -1] = '\0'; } iVar2 = legal_identifier(pcVar4); if (iVar2 == 0) { sh_invalidid(pcVar4); sh_xfree(pcVar4, "variables.c", 0xe26); return 0; } local_28 = (char **)find_variable(pcVar4); if (local_28 == (char **)0x0) { local_28 = (char **)find_variable_last_nameref(pcVar4, 1); if (((local_28 != (char **)0x0) && ((*(uint *)(local_28 + 5) & 0x800) != 0)) && (iVar2 = valid_nameref_value(local_28[1], 2), iVar2 != 0)) { local_30 = local_28[1]; local_28 = (char **)0x0; } } else { local_30 = *local_28; } if ((local_28 != (char **)0x0) && (((*(uint *)(local_28 + 5) & 2) != 0 || ((*(uint *)(local_28 + 5) & 0x4000) != 0)))) { if ((*(uint *)(local_28 + 5) & 2) != 0) { err_readonly(pcVar4); } sh_xfree(pcVar4, "variables.c", 0xe43); return 0; } local_38 = (undefined *)expand_assignment_string_to_string( pcVar4 + (long)iVar1 + 1, 0); puVar5 = local_38; if ((local_28 != (char **)0x0) && (bVar7)) { if (local_38 == (undefined *)0x0) { local_38 = (undefined *)sh_xmalloc(1, "variables.c", 0xe4e); *local_38 = 0; } puVar5 = (undefined *)make_variable_value(local_28, local_38, bVar7); if (local_38 != (undefined *)0x0) { sh_xfree(local_38, "variables.c", 0xe52); } } } local_38 = puVar5; if (temporary_env == 0) { temporary_env = hash_create(4); } local_28 = (char **)hash_lookup(local_30, temporary_env); if (local_28 == (char **)0x0) { local_28 = (char **)make_new_variable(local_30, temporary_env); } else if (*(long *)((long)local_28 + 8) != 0) { sh_xfree(*(undefined8 *)((long)local_28 + 8), "variables.c", 0xe5e); } if (local_38 == (undefined *)0x0) { local_38 = (undefined *)sh_xmalloc(1, "variables.c", 0xe62); *local_38 = 0; } *(undefined **)((long)local_28 + 8) = local_38; *(uint *)((long)local_28 + 0x28) = *(uint *)((long)local_28 + 0x28) | 0x100001; *(undefined4 *)((long)local_28 + 0x2c) = variable_context; if (*(long *)((long)local_28 + 0x10) != 0) { sh_xfree(*(undefined8 *)((long)local_28 + 0x10), "variables.c", 0xe6a); *(undefined8 *)((long)local_28 + 0x10) = 0; } uVar6 = mk_env_string(local_30, local_38, 0); *(undefined8 *)((long)local_28 + 0x10) = uVar6; array_needs_making = 1; if (param_2 != 0) { if (((*local_30 == 'P') && (iVar1 = strcmp(local_30, "POSIXLY_CORRECT"), iVar1 == 0)) || ((*local_30 == 'P' && (iVar1 = strcmp(local_30, "POSIX_PEDANDTIC"), iVar1 == 0)))) { save_posix_options(); } stupidly_hack_special_variables(local_30); } if (echo_command_at_execute != 0) { xtrace_print_assignment(pcVar4, local_38, 0, 1); } sh_xfree(pcVar4, "variables.c", 0xe7b); return 1; }
bash
ghidra
StringList *sl_init(void) { StringList *sl; sl = malloc(sizeof(StringList)); if (sl == ((void *)0)) return ((void *)0); sl->sl_cur = 0; sl->sl_max = 20; sl->sl_str = reallocarray(((void *)0), sl->sl_max, sizeof(char *)); if (sl->sl_str == ((void *)0)) { free(sl); sl = ((void *)0); } return sl; }
long *sl_init(void) { long lVar1; long *local_10; local_10 = (long *)malloc(0x18); if (local_10 == (long *)0x0) { local_10 = (long *)0x0; } else { local_10[2] = 0; local_10[1] = 0x14; lVar1 = reallocarray(0, local_10[1], 8); *local_10 = lVar1; if (*local_10 == 0) { free(local_10); local_10 = (long *)0x0; } } return local_10; }
libbsd-0.11.7
ghidra
static void ip6_tnl_parm_init(struct ip6_tnl_parm2 *p, int apply_default) { memset(p, 0, sizeof(*p)); p->proto = IPPROTO_IPV6; if (apply_default) { p->hop_limit = (64); p->encap_limit = 4; } }
void ip6_tnl_parm_init(char a0[23], unsigned long a1) { char v1[23]; char v2[23]; memset(a0, 0x0, 0x4c); v1 = a0; a0[20] = 41; if (a1) { a0[22] = 64; v2 = a0; a0[21] = 4; return; } return; }
iproute2-6.0.0
angr_sailr
static int do_modify_txsa(enum cmd c, int argc, char **argv, int ifindex) { struct sa_desc txsa = {0}; enum macsec_nl_commands cmd; txsa.an = 0xff; txsa.active = 0xff; if (argc == 0 || !get_sa(&argc, &argv, &txsa.an)) ipmacsec_usage(); if (c == CMD_DEL) goto modify; if (parse_sa_args(&argc, &argv, &txsa)) return -1; if (check_sa_args(c, &txsa)) return -1; modify: cmd = macsec_commands[c][1][0]; return do_modify_nl(c, cmd, ifindex, ((void *)0), &txsa); }
void do_modify_txsa(unsigned long a0, unsigned long a1, unsigned long a2, unsigned long a3) { unsigned int v0; unsigned long v1; char v2; unsigned int v3; unsigned int v4; char v5; char v6; unsigned long long v8; unsigned long long *v9; unsigned long v10; char v11; unsigned long long v12; unsigned long long v13; unsigned long long v14; unsigned long long v15; unsigned long long v16; v3 = a0; v1 = a2; v0 = a3; v8 = 20; for (v9 = &v5; v8; v9 = &v9[v10]) { v8 -= 1; v5 = 0; } v5 = 255; v6 = 255; if (a1) { v11 = get_sa(&v2, &v1, &v5) ^ 1; if (!v11) { if (v3 != 1) { v12 = parse_sa_args(&v2, &v1, &v5); if (v12) { v13 = 4294967295; } else { v14 = check_sa_args(v3, &v5); if (v14) v15 = 4294967295; } } if (v3 == 1 || !v12 && !v14) { v4 = (&g_404568)[2 * v3]; v16 = do_modify_nl(v3, v4, v0, 0x0, &v5); } return; } } if (!a1 || v11) ipmacsec_usage(); }
iproute2-6.0.0
angr_dream
static int skiploop(void) { int skip = evalskip; switch (skip) { case 0: break; case (1 << 0): case (1 << 1): if (__builtin_expect(!!(--skipcount <= 0), 1)) { evalskip = 0; break; } skip = (1 << 0); break; } return skip; }
int skiploop(void) { int local_c; local_c = evalskip; if (((evalskip != 0) && (-1 < evalskip)) && (evalskip - 1U < 2)) { skipcount = skipcount + -1; if (skipcount < 1) { evalskip = 0; } else { local_c = 1; } } return local_c; }
dash-0.5.11+git20210903+057cd650a4ed
ghidra
static inline __u32 rta_getattr_u32(const struct rtattr *rta) { return *(__u32 *)(( void *)(((char *)(rta)) + ((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0)))); }
long rta_getattr_u32(long a1) { return *(unsigned int *)(a1 + 4); }
iproute2-6.0.0
ida
map_init_emacs(EditLine *el) { int i; wchar_t buf[3]; el_action_t *key = el->el_map.key; el_action_t *alt = el->el_map.alt; const el_action_t *emacs = el->el_map.emacs; el->el_map.type = 0; el->el_map.current = el->el_map.key; keymacro_reset(el); for (i = 0; i < 256; i++) { key[i] = emacs[i]; alt[i] = 28; } map_init_meta(el); map_init_nls(el); buf[0] = (('X') & 037); buf[1] = (('X') & 037); buf[2] = 0; keymacro_add(el, buf, keymacro_map_cmd(el, 35), 0); tty_bind_char(el, 1); terminal_bind_arrow(el); }
void map_init_emacs(long param_1) { long lVar1; long lVar2; long lVar3; undefined8 uVar4; long in_FS_OFFSET; int local_3c; undefined4 local_1c; undefined4 local_18; undefined4 local_14; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); lVar1 = *(long *)(param_1 + 0x3f8); lVar2 = *(long *)(param_1 + 0x3f0); lVar3 = *(long *)(param_1 + 0x408); *(undefined4 *)(param_1 + 0x420) = 0; *(undefined8 *)(param_1 + 0x400) = *(undefined8 *)(param_1 + 0x3f8); keymacro_reset(param_1); for (local_3c = 0; local_3c < 0x100; local_3c = local_3c + 1) { *(undefined *)(lVar1 + local_3c) = *(undefined *)(lVar3 + local_3c); *(undefined *)(lVar2 + local_3c) = 0x1c; } map_init_meta(param_1); map_init_nls(param_1); local_1c = 0x18; local_18 = 0x18; local_14 = 0; uVar4 = keymacro_map_cmd(param_1, 0x23); keymacro_add(param_1, &local_1c, uVar4, 0); tty_bind_char(param_1, 1); terminal_bind_arrow(param_1); if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) { __stack_chk_fail(); } return; }
libedit
ghidra
static int optionp_getfilecon(int fd, const char *name, char **p) { return lgetfileconat(fd, name, p); }
long long optionp_getfilecon(unsigned long a0, unsigned long long a1, unsigned long long a2) { return lgetfileconat(a0, a1, a2, a1); }
findutils
angr_dream
static int compare_ts(struct timespec ts1, struct timespec ts2) { if ((ts1.tv_sec == ts2.tv_sec) && (ts1.tv_nsec == ts2.tv_nsec)) { return 0; } else { double diff = ts_difference(ts1, ts2); return diff < 0.0 ? -1 : +1; } }
int compare_ts(unsigned long a0, unsigned int a1, unsigned long a2, unsigned int a3) { unsigned int v1; unsigned long v2; if (a0 == a2 && a1 == a3) { v1 = 0; return v1; } ts_difference(a0, a1, a2, a3); v1 = (((BinaryOp CmpF & 69 | (BinaryOp CmpF & 69) >> 6) & 1) == 1 ? -1 : 1); return v1; }
findutils
angr_sailr
static void sh_seedrand() { int d; static int seeded = 0; if (seeded == 0) { struct timeval tv; gettimeofday(&tv, ((void *)0)); srandom(tv.tv_sec ^ tv.tv_usec ^ (getpid() << 16) ^ (uintptr_t)&d); seeded = 1; } }
void sh_seedrand(void) { __pid_t _Var1; long in_FS_OFFSET; undefined local_3c[4]; uint local_38; uint local_30; long local_20; local_20 = *(long *)(in_FS_OFFSET + 0x28); if (seeded_7563 == 0) { gettimeofday((timeval *)&local_38, (__timezone_ptr_t)0x0); _Var1 = getpid(); srandom((uint)local_3c ^ _Var1 << 0x10 ^ local_38 ^ local_30); seeded_7563 = 1; } if (local_20 != *(long *)(in_FS_OFFSET + 0x28)) { __stack_chk_fail(); } return; }
bash
ghidra
static _Bool dc_parse_stream(FILE *fp, char const *filename) { size_t line_number = 0; char const *next_G_line = G_line; char *input_line = ((void *)0); size_t input_line_size = 0; char const *line; char const *term; char const *colorterm; _Bool ok = 1; enum { ST_TERMNO, ST_TERMYES, ST_TERMSURE, ST_GLOBAL } state = ST_GLOBAL; term = getenv("TERM"); if (term == ((void *)0) || *term == '\0') term = "none"; colorterm = getenv("COLORTERM"); if (colorterm == ((void *)0)) colorterm = ""; while (1) { char *keywd, *arg; _Bool unrecognized; ++line_number; if (fp) { if (getline(&input_line, &input_line_size, fp) <= 0) { free(input_line); break; } line = input_line; } else { if (next_G_line == G_line + sizeof G_line) break; line = next_G_line; next_G_line += strlen(next_G_line) + 1; } parse_line(line, &keywd, &arg); if (keywd == ((void *)0)) continue; if (arg == ((void *)0)) { error(0, 0, gettext("%s:%lu: invalid line; missing second token"), quotearg_n_style_colon(0, shell_escape_quoting_style, filename), (unsigned long int)line_number); ok = 0; free(keywd); continue; } unrecognized = 0; if (c_strcasecmp(keywd, "TERM") == 0) { if (state != ST_TERMSURE) state = fnmatch(arg, term, 0) == 0 ? ST_TERMSURE : ST_TERMNO; } else if (c_strcasecmp(keywd, "COLORTERM") == 0) { if (state != ST_TERMSURE) state = fnmatch(arg, colorterm, 0) == 0 ? ST_TERMSURE : ST_TERMNO; } else { if (state == ST_TERMSURE) state = ST_TERMYES; if (state != ST_TERMNO) { if (keywd[0] == '.') append_entry('*', keywd, arg); else if (keywd[0] == '*') append_entry(0, keywd, arg); else if (c_strcasecmp(keywd, "OPTIONS") == 0 || c_strcasecmp(keywd, "COLOR") == 0 || c_strcasecmp(keywd, "EIGHTBIT") == 0) { } else { int i; for (i = 0; slack_codes[i] != ((void *)0); ++i) if (c_strcasecmp(keywd, slack_codes[i]) == 0) break; if (slack_codes[i] != ((void *)0)) append_entry(0, ls_codes[i], arg); else unrecognized = 1; } } else unrecognized = 1; } if (unrecognized && (state == ST_TERMSURE || state == ST_TERMYES)) { error(0, 0, gettext("%s:%lu: unrecognized keyword %s"), (filename ? quotearg_n_style_colon(0, shell_escape_quoting_style, filename) : gettext("<internal>")), (unsigned long int)line_number, keywd); ok = 0; } free(keywd); free(arg); } return ok; }
long dc_parse_stream(FILE *a1, long a2) { long v2; char *v3; int v4; int v5; void *v6; char *v7; char *v8; unsigned char v10; char v11; int v12; int i; char *lineptr; size_t n; void *ptr; char *pattern; long v18; char *s; unsigned char *v20; char *name; char *v22; unsigned long v23; v23 = __readfsqword(0x28u); v18 = 0LL; s = "# Configuration file for dircolors, a utility to help you set the"; lineptr = 0LL; n = 0LL; v10 = 1; v12 = 3; name = getenv("TERM"); if (!name || !*name) name = "none"; v22 = getenv("COLORTERM"); if (!v22) v22 = (char *)locale; while (1) { ++v18; if (a1) break; if (s == "NORMAL") return v10; v20 = (unsigned char *)s; s += strlen(s) + 1; LABEL_12: parse_line(v20, &ptr, (long *)&pattern); if (ptr) { if (pattern) { v11 = 0; if ((unsigned int)c_strcasecmp(ptr, "TERM")) { if ((unsigned int)c_strcasecmp(ptr, "COLORTERM")) { if (v12 == 2) v12 = 1; if (v12) { if (*(_BYTE *)ptr == 46) { append_entry(42, (char *)ptr, pattern); } else if (*(_BYTE *)ptr == 42) { append_entry(0, (char *)ptr, pattern); } else if ((unsigned int)c_strcasecmp(ptr, "OPTIONS") && (unsigned int)c_strcasecmp(ptr, "COLOR") && (unsigned int)c_strcasecmp(ptr, "EIGHTBIT")) { for (i = 0; slack_codes[i] && (unsigned int)c_strcasecmp(ptr, slack_codes[i]); ++i) ; if (slack_codes[i]) append_entry(0, ls_codes[i], pattern); else v11 = 1; } } else { v11 = 1; } } else if (v12 != 2) { if (fnmatch(pattern, v22, 0)) v5 = 0; else v5 = 2; v12 = v5; } } else if (v12 != 2) { if (fnmatch(pattern, name, 0)) v4 = 0; else v4 = 2; v12 = v4; } if (v11 && (v12 == 2 || v12 == 1)) { v6 = ptr; if (a2) v7 = (char *)quotearg_n_style_colon(0LL, 3LL, a2); else v7 = gettext("<internal>"); v8 = gettext("%s:%lu: unrecognized keyword %s"); error(0, 0, v8, v7, v18, v6); v10 = 0; } free(ptr); free(pattern); } else { v2 = quotearg_n_style_colon(0LL, 3LL, a2); v3 = gettext("%s:%lu: invalid line; missing second token"); error(0, 0, v3, v2, v18); v10 = 0; free(ptr); } } } if (getline(&lineptr, &n, a1) > 0) { v20 = (unsigned char *)lineptr; goto LABEL_12; } free(lineptr); return v10; }
coreutils
ida
static char *list_remove_pattern(list, pattern, patspec, itype, quoted) WORD_LIST *list; char *pattern; int patspec, itype, quoted; { WORD_LIST *new, *l; WORD_DESC *w; char *tword; for (new = (WORD_LIST *)((void *)0), l = list; l; l = l->next) { tword = remove_pattern(l->word->word, pattern, patspec); w = alloc_word_desc(); w->word = tword ? tword : (char *)strcpy( sh_xmalloc((1 + strlen("")), "subst.c", 5789), ("")); new = make_word_list(w, new); } l = ((new && new->next) ? (WORD_LIST *)list_reverse((GENERIC_LIST *)new) : (WORD_LIST *)(new)); tword = string_list_pos_params(itype, l, quoted, 0); dispose_words(l); return (tword); }
int list_remove_pattern(unsigned long a0, char *a1, unsigned long a2, unsigned long a3, unsigned long a4, unsigned long long a5) { void *v0; struct_0 *v1; unsigned long v2; unsigned long long *v3; unsigned long long v5; void *v6; v0 = 0; for (v1 = a0; v1; v1 = v1->field_0) { v2 = remove_pattern(v1->field_8->field_0, a1, a2, a1, a4, a5); v3 = alloc_word_desc(); if (!v2) v5 = strcpy(sh_xmalloc(strlen(&g_41fa65) + 1, "subst.c", 0x169d), &g_41fa65); else v5 = v2; *(v3) = v5; v0 = make_word_list(v3, v0, v0); } if (v0 && *(v0)) { v6 = list_reverse(v0); goto LABEL_40e8a7; } v6 = v0; LABEL_40e8a7: v1 = v6; v2 = string_list_pos_params(a3, v1, a4, 0x0, a4, a5); dispose_words(v1); return v2; }
bash
angr_phoenix
static void clear_v2_journal_fields(journal_t *journal) { e2fsck_t ctx = journal->j_dev->k_ctx; struct problem_context pctx; clear_problem_context(&pctx); if (!fix_problem(ctx, 0x00002A, &pctx)) return; ctx->flags |= 0x4000; memset(((char *)journal->j_superblock) + 0x0024, 0, ctx->fs->blocksize - 0x0024); mark_buffer_dirty(journal->j_sb_buffer); }
unsigned long clear_v2_journal_fields(long a1) { int v1; _DWORD *v3; char v4[104]; unsigned long v5; v5 = __readfsqword(0x28u); v3 = **(_DWORD ***)(a1 + 104); clear_problem_context(v4); if ((unsigned int)fix_problem(v3, 42LL, v4)) { v1 = v3[18]; BYTE1(v1) |= 0x40u; v3[18] = v1; memset((void *)(*(_QWORD *)(a1 + 24) + 36LL), 0, (unsigned int)(*(_DWORD *)(*(_QWORD *)v3 + 40LL) - 36)); mark_buffer_dirty(*(_QWORD *)(a1 + 16)); } return __readfsqword(0x28u) ^ v5; }
e2fsprogs-1.46.5
ida
ed_delete_prev_char(EditLine *el, wint_t c __attribute__((__unused__))) { if (el->el_line.cursor <= el->el_line.buffer) return 6; c_delbefore(el, el->el_state.argument); el->el_line.cursor -= el->el_state.argument; if (el->el_line.cursor < el->el_line.buffer) el->el_line.cursor = el->el_line.buffer; return 4; }
long long ed_delete_prev_char(struct_0 *a0, unsigned long a1) { unsigned int v0; unsigned long long v2; v0 = a1; if (a0->field_58 <= a0->field_50) { v2 = 6; return v2; } c_delbefore(a0, a0->field_78, a0->field_78); a0->field_58 = a0->field_58 + -(a0->field_78 << 2); if (a0->field_58 < a0->field_50) { a0->field_58 = a0->field_50; v2 = 4; return v2; } v2 = 4; return v2; }
libedit
angr_sailr
int umac_update(struct umac_ctx *ctx, const u_char *input, long len) { uhash_update(&ctx->hash, input, len); return (1); }
long long umac_update(void *a0, void *a1, unsigned int a2) { uhash_update(a0, a1, a2); return 1; }
openssh-portable
angr_dream
int rl_end_of_history(int count, int key) { rl_maybe_replace_line(); using_history(); rl_maybe_unsave_line(); return 0; }
long long rl_end_of_history(unsigned long a0, unsigned long a1) { unsigned int v0; unsigned int v1; v1 = a0; v0 = a1; rl_maybe_replace_line(); using_history(); rl_maybe_unsave_line(); return 0; }
bash
angr_phoenix
static int atdir_set(char const *dir, ptrdiff_t dirlen) { enum { try_opening_directories = 1 }; if (try_opening_directories && !atdir_eq(dir, dirlen)) { if (0 <= dfd) close(dfd); if (dirlen == 0) dir = &dot, dirlen = 1; memcpy(dfname, dir, dirlen); dfname[dirlen] = '\0'; dfd = open_safer(dfname, 00 | 0200000); } return dfd; }
int atdir_set(void *a0, unsigned int a1) { unsigned long long v0; unsigned long long v1; v1 = a0; *(&v0) = a1; if ((atdir_eq(v1, v0) ^ 1)) { if (dfd >= 0) close(dfd); if (!v0) { v1 = "."; v0 = 1; } memcpy(&dfname, v1, v0); *(v0 + &dfname) = 0; dfd = open_safer(&dfname, 0x10000, &dfname); } return dfd; }
gzip-1.12
angr_phoenix
static void decode_string(char **string, char const *arg) { if (*string) { free(*string); *string = ((void *)0); } if (!utf8_convert(0, arg, string)) { assign_string(string, arg); } }
void decode_string(unsigned long long *a0, unsigned long long a1) { unsigned long long v2; if (*(a0)) { free(*(a0)); *(a0) = 0; } if ((utf8_convert(0x0, a1, a0) ^ 1)) { v2 = assign_string(a0, a1, a1); return; } return; }
tar
angr_sailr
static void unblock_signal(int sig) { sigset_t unblock_set; sigemptyset(&unblock_set); sigaddset(&unblock_set, sig); if (sigprocmask(1, &unblock_set, ((void *)0)) != 0) error(0, (*__errno_location()), gettext("warning: sigprocmask")); }
void unblock_signal(unsigned long a0) { char v0; char v1; unsigned long long *v3; unsigned long long v4; sigemptyset(&v0); sigaddset(&v0, a0); if (sigprocmask(0x1, &v0, NULL)) error(0x0, *(__errno_location()), gettext("warning: sigprocmask")); v4 = *(&v1) ^ v3[5]; return; }
coreutils
angr_sailr
static _Bool paste_serial(size_t nfiles, char **fnamptr) { _Bool ok = 1; int charnew, charold; char const *delimptr; FILE *fileptr; for (; nfiles; nfiles--, fnamptr++) { int saved_errno; _Bool is_stdin = (strcmp(*fnamptr, "-") == 0); if (is_stdin) { have_read_stdin = 1; fileptr = stdin; } else { fileptr = fopen(*fnamptr, "r"); if (fileptr == ((void *)0)) { error(0, (*__errno_location()), "%s", quotearg_n_style_colon(0, shell_escape_quoting_style, *fnamptr)); ok = 0; continue; } fadvise(fileptr, FADVISE_SEQUENTIAL); } delimptr = delims; charold = getc_unlocked(fileptr); saved_errno = (*__errno_location()); if (charold != (-1)) { while ((charnew = getc_unlocked(fileptr)) != (-1)) { if (charold == line_delim) { if (*delimptr != '\0') xputchar(*delimptr); if (++delimptr == delim_end) delimptr = delims; } else xputchar(charold); charold = charnew; } saved_errno = (*__errno_location()); xputchar(charold); } if (charold != line_delim) xputchar(line_delim); if (!ferror_unlocked(fileptr)) saved_errno = 0; if (is_stdin) clearerr_unlocked(fileptr); else if (rpl_fclose(fileptr) != 0 && !saved_errno) saved_errno = (*__errno_location()); if (saved_errno) { error(0, saved_errno, "%s", quotearg_n_style_colon(0, shell_escape_quoting_style, *fnamptr)); ok = 0; } } return ok; }
long paste_serial(long a1, const char **a2) { int v2; const char *v3; int *v4; const char *v5; unsigned char v9; bool v10; int v11; int errnum; int v13; char *v14; FILE *stream; v9 = 1; while (a1) { v2 = strcmp(*a2, "-"); v10 = v2 == 0; if (v2) { stream = fopen(*a2, "r"); if (!stream) { v3 = (const char *)quotearg_n_style_colon(0LL, 3LL, *a2); v4 = _errno_location(); error(0, *v4, "%s", v3); v9 = 0; goto LABEL_29; } fadvise(stream, 2LL); } else { have_read_stdin = 1; stream = stdin; } v14 = (char *)delims; v11 = getc_unlocked(stream); errnum = *_errno_location(); if (v11 != -1) { while (1) { v13 = getc_unlocked(stream); if (v13 == -1) break; if (v11 == (unsigned char)line_delim) { if (*v14) xputchar(*v14); if (++v14 == (char *)delim_end) v14 = (char *)delims; } else { xputchar(v11); } v11 = v13; } errnum = *_errno_location(); xputchar(v11); } if (v11 != (unsigned char)line_delim) xputchar(line_delim); if (!ferror_unlocked(stream)) errnum = 0; if (v10) { clearerr_unlocked(stream); } else if ((unsigned int)rpl_fclose(stream) && !errnum) { errnum = *_errno_location(); } if (errnum) { v5 = (const char *)quotearg_n_style_colon(0LL, 3LL, *a2); error(0, errnum, "%s", v5); v9 = 0; } LABEL_29: --a1; ++a2; } return v9; }
coreutils
ida
_Bool pred_uid (const char *pathname, struct stat *stat_buf, struct predicate *pred_ptr) { (void)pathname; switch (pred_ptr->args.numinfo.kind) { case COMP_GT: if (stat_buf->st_uid > pred_ptr->args.numinfo.l_val) return (1); break; case COMP_LT: if (stat_buf->st_uid < pred_ptr->args.numinfo.l_val) return (1); break; case COMP_EQ: if (stat_buf->st_uid == pred_ptr->args.numinfo.l_val) return (1); break; } return (0); }
undefined8 pred_uid(undefined8 param_1, long param_2, long param_3) { uint uVar1; uVar1 = *(uint *)(param_3 + 0x38); if (uVar1 == 2) { if ((ulong) * (uint *)(param_2 + 0x1c) == *(ulong *)(param_3 + 0x40)) { return 1; } } else if (uVar1 < 3) { if (uVar1 == 0) { if (*(ulong *)(param_3 + 0x40) < (ulong) * (uint *)(param_2 + 0x1c)) { return 1; } } else if ((uVar1 == 1) && ((ulong) * (uint *)(param_2 + 0x1c) < *(ulong *)(param_3 + 0x40))) { return 1; } } return 0; }
findutils
ghidra
int session_open(Authctxt *authctxt, int chanid) { Session *s = session_new(); sshlog("session.c", __func__, 1799, 0, SYSLOG_LEVEL_DEBUG1, ((void *)0), "session_open: channel %d", chanid); if (s == ((void *)0)) { sshlog("session.c", __func__, 1801, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "no more sessions"); return 0; } s->authctxt = authctxt; s->pw = authctxt->pw; if (s->pw == ((void *)0) || !authctxt->valid) sshfatal("session.c", __func__, 1807, 0, SYSLOG_LEVEL_FATAL, ((void *)0), "no user for session %d", s->self); sshlog("session.c", __func__, 1808, 0, SYSLOG_LEVEL_DEBUG1, ((void *)0), "session_open: session %d: link with channel %d", s->self, chanid); s->chanid = chanid; return 1; }
long long session_open(unsigned long a0, unsigned long a1) { unsigned long long v0; unsigned long v1; struct_1 *v2; unsigned long v3; unsigned int v4[48]; unsigned long long v6; v2 = a0; v4 = session_new(); v1 = a1; v0 = "session_open: channel %d"; sshlog("session.c", "session_open", 0x707, 0x0, 0x5, 0x0); if (!v4) { v0 = "no more sessions"; sshlog("session.c", "session_open", 0x709, 0x0, 0x2, 0x0); v6 = 0; } else { v4->field_18 = v2; v4->field_10 = v2->field_30; if (v4->field_10 && !(!v2->field_c)) goto LABEL_403fd7; v1 = v4->field_4; v0 = "no user for session %d"; sshfatal("session.c", "session_open", 0x70f, 0x0, 0x1, 0x0); LABEL_403fd7: *(&v4[0]) = a1; v3 = v4->field_4; v2 = "session_open: session %d: link with channel %d"; sshlog("session.c", "session_open", 0x710, 0x0, 0x5, 0x0); v4[47] = a1; v6 = 1; } return v6; }
openssh-portable
angr_phoenix
static void lbuf_putc(char c) { *lbuf.end++ = c; if (c == '\n') { size_t buffered = lbuf.end - lbuf.buf; static int line_buffered = -1; if (line_buffered == -1) line_buffered = isatty(0) || isatty(1); if (line_buffered) lbuf_flush(); else if (buffered >= 512) { char const *tend = lbuf.end; char *tlend = lbuf.buf + 512; while (*--tlend != '\n') ; tlend++; lbuf.end = tlend; lbuf_flush(); memcpy(lbuf.buf, tlend, tend - tlend); lbuf.end = lbuf.buf + (tend - tlend); } } }
void lbuf_putc(char param_1) { char *pcVar1; char *pcVar2; int iVar3; ulong uVar4; char *local_20; pcVar1 = lbuf._8_8_ + 1; *lbuf._8_8_ = param_1; lbuf._8_8_ = pcVar1; if (param_1 == '\n') { uVar4 = (long)lbuf._8_8_ - (long)lbuf._0_8_; if (line_buffered_8011 == -1) { iVar3 = isatty(0); if ((iVar3 == 0) && (iVar3 = isatty(1), iVar3 == 0)) { line_buffered_8011 = 0; } else { line_buffered_8011 = 1; } } pcVar1 = lbuf._8_8_; if (line_buffered_8011 == 0) { if (0x1ff < uVar4) { pcVar2 = (char *)((long)lbuf._0_8_ + 0x200); do { local_20 = pcVar2; pcVar2 = local_20 + -1; } while (local_20[-1] != '\n'); lbuf._8_8_ = local_20; lbuf_flush(); memcpy(lbuf._0_8_, local_20, (long)pcVar1 - (long)local_20); lbuf._8_8_ = (char *)(((long)pcVar1 - (long)local_20) + (long)lbuf._0_8_); } } else { lbuf_flush(); } } return; }
coreutils
ghidra
static int ipstats_print_moo(enum output_type t, const char *key, const char *fmt, enum ipstats_maybe_on_off moo) { if (!moo) return 0; return print_on_off(t, key, fmt, ipstats_moo_to_bool(moo)); }
undefined8 ipstats_print_moo(undefined4 param_1, undefined8 param_2, undefined8 param_3, int param_4) { undefined uVar1; undefined8 uVar2; if (param_4 == 0) { uVar2 = 0; } else { uVar1 = ipstats_moo_to_bool(param_4); uVar2 = print_on_off(param_1, param_2, param_3, uVar1); } return uVar2; }
iproute2-6.0.0
ghidra
static int sshsk_add_option(struct sk_option ***optsp, size_t *noptsp, const char *name, const char *value, uint8_t required) { struct sk_option **opts = *optsp; size_t nopts = *noptsp; if ((opts = recallocarray(opts, nopts, nopts + 2, sizeof(*opts))) == ((void *)0)) { sshlog("ssh-sk.c", __func__, 389, 1, SYSLOG_LEVEL_ERROR, ((void *)0), "array alloc failed"); return -2; } *optsp = opts; *noptsp = nopts + 1; if ((opts[nopts] = calloc(1, sizeof(**opts))) == ((void *)0)) { sshlog("ssh-sk.c", __func__, 395, 1, SYSLOG_LEVEL_ERROR, ((void *)0), "alloc failed"); return -2; } if ((opts[nopts]->name = strdup(name)) == ((void *)0) || (opts[nopts]->value = strdup(value)) == ((void *)0)) { sshlog("ssh-sk.c", __func__, 400, 1, SYSLOG_LEVEL_ERROR, ((void *)0), "alloc failed"); return -2; } opts[nopts]->required = required; return 0; }
undefined8 sshsk_add_option(long *param_1, long *param_2, char *param_3, char *param_4, undefined param_5) { void **ppvVar1; long lVar2; char **ppcVar3; long lVar4; long lVar5; void *pvVar6; char *pcVar7; undefined8 uVar8; lVar2 = *param_2; uVar8 = 0x100f52; lVar5 = recallocarray(*param_1, lVar2, lVar2 + 2, 8); if (lVar5 == 0) { sshlog("ssh-sk.c", "sshsk_add_option", 0x185, 1, 2, 0, "array alloc failed", uVar8); } else { *param_1 = lVar5; *param_2 = lVar2 + 1; ppvVar1 = (void **)(lVar2 * 8 + lVar5); uVar8 = 0x100fe2; pvVar6 = calloc(1, 0x18); *ppvVar1 = pvVar6; if (*ppvVar1 == (void *)0x0) { sshlog("ssh-sk.c", "sshsk_add_option", 0x18b, 1, 2, 0, "alloc failed", uVar8); } else { ppcVar3 = *(char ***)(lVar5 + lVar2 * 8); uVar8 = 0x101057; pcVar7 = strdup(param_3); *ppcVar3 = pcVar7; if (*ppcVar3 != (char *)0x0) { lVar4 = *(long *)(lVar5 + lVar2 * 8); uVar8 = 0x101084; pcVar7 = strdup(param_4); *(char **)(lVar4 + 8) = pcVar7; if (*(long *)(lVar4 + 8) != 0) { *(undefined *)(*(long *)(lVar5 + lVar2 * 8) + 0x10) = param_5; return 0; } } sshlog("ssh-sk.c", "sshsk_add_option", 400, 1, 2, 0, "alloc failed", uVar8); } } return 0xfffffffe; }
openssh-portable
ghidra
static void bond_print_help(struct link_util *lu, int argc, char **argv, FILE *f) { print_explain(f); }
int bond_print_help(long a1, long a2, long a3, FILE *a4) { return print_explain(a4); }
iproute2-6.0.0
ida
const char *human_addr(const struct sockaddr *sa, socklen_t salen, char *buf, size_t buflen) { const char *save_buf = buf; size_t l; if (!buf || !buflen) return "(error)"; *buf = 0; switch (sa->sa_family) { case 10: snprintf(buf, buflen, "IPv6 "); break; case 2: snprintf(buf, buflen, "IPv4 "); break; } l = 5; buf += l; buflen -= l; if (getnameinfo(sa, salen, buf, buflen, ((void *)0), 0, 1) != 0) { return "(error)"; } l = strlen(buf); buf += l; buflen -= l; if (buflen < 8) return save_buf; strcat(buf, " port "); buf += 6; buflen -= 6; if (getnameinfo(sa, salen, ((void *)0), 0, buf, buflen, 2) != 0) { snprintf(buf, buflen, "%s", " unknown"); } return save_buf; }
int human_addr(unsigned short *a0, unsigned long a1, char *a2, unsigned int a3) { unsigned long long v0; unsigned long v1; char *v2; char *v3; unsigned long long v4; unsigned int v6; v2 = a2; v1 = a3; v3 = v2; if (!v2) { v6 = &g_405ea0; return v6; } else if (*(&v1)) { *(v2) = 0; switch (*(a0)) { case 2: snprintf(v2, *(&v1), "IPv4 "); break; case 10: snprintf(v2, *(&v1), "IPv6 "); break; default: goto LABEL_401c31; } LABEL_401c31: v4 = 5; v2 = &v2[v4]; v1 = *(&v1) - v4; v0 = 1; if (getnameinfo(a0, a1, v2, v1, 0x0, 0x0)) { v6 = &g_405ea0; return v6; } v4 = strlen(v2); v2 = &v2[v4]; v1 = *(&v1) - v4; if (v1 <= 7) { v6 = v3; return v6; } strcat(v2, " port "); v2 += 6; v1 -= 6; v0 = 2; if (getnameinfo(a0, a1, 0x0, 0x0, v2, v1)) snprintf(v2, v1, "%s", &g_405ebb); v6 = v3; return v6; } else { v6 = &g_405ea0; return v6; } }
gnutls
angr_sailr
static _Bool collect_arg_stat_info(char **argv, int *arg_ptr, struct stat *p, const char **argument) { const char *filename; if (collect_arg(argv, arg_ptr, &filename)) { *argument = filename; if (0 != (options.xstat)(filename, p)) { fatal_target_file_error((*__errno_location()), filename); } return 1; } else { *argument = ((void *)0); return 0; } }
long collect_arg_stat_info(long a1, int *a2, long a3, _QWORD *a4) { long v4; int *v5; long v8[4]; v8[1] = __readfsqword(0x28u); if ((unsigned char)collect_arg(a1, a2, v8)) { *a4 = v8[0]; if (options[10](v8[0])) { v4 = v8[0]; v5 = _errno_location(); fatal_target_file_error((unsigned int)*v5, v4); } return 1LL; } else { *a4 = 0LL; return 0LL; } }
findutils
ida
static void pdf_gen_xor(pdf_ctx *pc, const UINT8 nonce[8], UINT8 buf[8]) { union { UINT8 tmp_nonce_lo[4]; UINT32 align; } t; int ndx = nonce[7] & 1; *(UINT32 *)t.tmp_nonce_lo = ((const UINT32 *)nonce)[1]; t.tmp_nonce_lo[3] &= ~1; if ((((UINT32 *)t.tmp_nonce_lo)[0] != ((UINT32 *)pc->nonce)[1]) || (((const UINT32 *)nonce)[0] != ((UINT32 *)pc->nonce)[0])) { ((UINT32 *)pc->nonce)[0] = ((const UINT32 *)nonce)[0]; ((UINT32 *)pc->nonce)[1] = ((UINT32 *)t.tmp_nonce_lo)[0]; AES_encrypt((u_char *)(pc->nonce), (u_char *)(pc->cache), (AES_KEY *)pc->prf_key); } *((UINT64 *)buf) ^= ((UINT64 *)pc->cache)[ndx]; }
void pdf_gen_xor(uchar *param_1, int *param_2, ulong *param_3) { byte bVar1; long lVar2; long in_FS_OFFSET; uint local_14; lVar2 = *(long *)(in_FS_OFFSET + 0x28); bVar1 = *(byte *)((long)param_2 + 7); local_14 = param_2[1] & 0xfeffffff; if ((local_14 != *(uint *)(param_1 + 0x14)) || (*param_2 != *(int *)(param_1 + 0x10))) { *(int *)(param_1 + 0x10) = *param_2; *(uint *)(param_1 + 0x14) = local_14; AES_encrypt(param_1 + 0x10, param_1, (AES_KEY *)(param_1 + 0x20)); } *param_3 = *param_3 ^ *(ulong *)(param_1 + (long)(int)(bVar1 & 1) * 8); if (lVar2 != *(long *)(in_FS_OFFSET + 0x28)) { __stack_chk_fail(); } return; }
openssh-portable
ghidra
static int input_kex_dh_gex_init(int type, u_int32_t seq, struct ssh *ssh) { struct kex *kex = ssh->kex; BIGNUM *dh_client_pub = ((void *)0); const BIGNUM *pub_key, *dh_p, *dh_g; struct sshbuf *shared_secret = ((void *)0); struct sshbuf *server_host_key_blob = ((void *)0); struct sshkey *server_host_public, *server_host_private; u_char *signature = ((void *)0); u_char hash[64]; size_t slen, hashlen; int r; sshlog("kexgexs.c", __func__, 141, 0, SYSLOG_LEVEL_DEBUG1, ((void *)0), "SSH2_MSG_KEX_DH_GEX_INIT received"); ssh_dispatch_set(ssh, 32, &kex_protocol_error); if ((r = kex_load_hostkey(ssh, &server_host_private, &server_host_public)) != 0) goto out; if ((r = sshpkt_get_bignum2(ssh, &dh_client_pub)) != 0 || (r = sshpkt_get_end(ssh)) != 0) goto out; if ((shared_secret = sshbuf_new()) == ((void *)0)) { r = -2; goto out; } if ((r = kex_dh_compute_key(kex, dh_client_pub, shared_secret)) != 0) goto out; if ((server_host_key_blob = sshbuf_new()) == ((void *)0)) { r = -2; goto out; } if ((r = sshkey_putb(server_host_public, server_host_key_blob)) != 0) goto out; DH_get0_key(kex->dh, &pub_key, ((void *)0)); DH_get0_pqg(kex->dh, &dh_p, ((void *)0), &dh_g); hashlen = sizeof(hash); if ((r = kexgex_hash(kex->hash_alg, kex->client_version, kex->server_version, kex->peer, kex->my, server_host_key_blob, kex->min, kex->nbits, kex->max, dh_p, dh_g, dh_client_pub, pub_key, sshbuf_ptr(shared_secret), sshbuf_len(shared_secret), hash, &hashlen)) != 0) goto out; if ((r = kex->sign(ssh, server_host_private, server_host_public, &signature, &slen, hash, hashlen, kex->hostkey_alg)) < 0) goto out; if ((r = sshpkt_start(ssh, 33)) != 0 || (r = sshpkt_put_stringb(ssh, server_host_key_blob)) != 0 || (r = sshpkt_put_bignum2(ssh, pub_key)) != 0 || (r = sshpkt_put_string(ssh, signature, slen)) != 0 || (r = sshpkt_send(ssh)) != 0) goto out; if ((r = kex_derive_keys(ssh, hash, hashlen, shared_secret)) != 0 || (r = kex_send_newkeys(ssh)) != 0) goto out; if (kex->initial_hostkey == ((void *)0) && (r = sshkey_from_private(server_host_public, &kex->initial_hostkey)) != 0) goto out; out: explicit_bzero(hash, sizeof(hash)); DH_free(kex->dh); kex->dh = ((void *)0); BN_clear_free(dh_client_pub); sshbuf_free(shared_secret); sshbuf_free(server_host_key_blob); free(signature); return r; }
long long input_kex_dh_gex_init(unsigned long a0, unsigned long a1, struct_0 *a2) { unsigned long v0; unsigned int v1; unsigned int v2; unsigned int v3; unsigned int v4; unsigned int v5; void *v6; char v7; char v8; char v9; char v10; char v11; void *v12; char v13; unsigned long long v14; void *v15; void *v16; struct_1 *v17; char v18; v4 = a0; v3 = a1; v17 = a2->field_8; v6 = 0; v15 = 0; v16 = 0; v12 = 0; sshlog("kexgexs.c", "input_kex_dh_gex_init", 0x8d, 0x0, 0x5, 0x0); ssh_dispatch_set(a2, 0x20, got.kex_protocol_error); v5 = kex_load_hostkey(a2, &v11, &v10, &v11); if (!v5) { v5 = sshpkt_get_bignum2(a2, &v6, &v6); if (!v5) { v5 = sshpkt_get_end(a2); if (!v5) { v15 = sshbuf_new(); if (!v15) { v5 = -2; goto LABEL_40099b; } else { v5 = kex_dh_compute_key(v17, v6, v15, v6); if (!v5) { v16 = sshbuf_new(); if (!v16) { v5 = -2; goto LABEL_40099b; } else { v5 = sshkey_putb(*(&v10), v16, v16); if (!v5) { DH_get0_key(v17->field_118, &v7, 0x0, &v7); DH_get0_pqg(v17->field_118, &v8, 0x0, &v9); v14 = 64; v2 = v17->field_124; v1 = v17->field_128; v5 = kexgex_hash( v17->field_90, v17->field_60, v17->field_68, v17->field_58, v17->field_50, v16, v17->field_120, v1, v2, *(&v8), *(&v9), v6, *(&v7), sshbuf_ptr(v15), sshbuf_len(v15), &v18); if (!v5) { v0 = v17->field_28; v5 = *(((stack_base)[144] + 192))(a2, *(&v11), *(&v10), &v12, &v13, &v18, v14); if (v5 >= 0) { v5 = sshpkt_start(a2, 0x21); if (!v5) { v5 = sshpkt_put_stringb(a2, v16, v16); if (!v5) { v5 = sshpkt_put_bignum2(a2, *(&v7), *(&v7)); if (!v5) { v5 = sshpkt_put_string(a2, v12, *(&v13), v12); if (!v5) { v5 = sshpkt_send(a2); if (!v5) { v5 = kex_derive_keys(a2, &v18, v14, v15); if (!v5) { v5 = kex_send_newkeys(a2); if (!v5) { if (!v17->field_80) v5 = sshkey_from_private(*(&v10), &v17->field_80, &v17->field_80); goto LABEL_40099b; } } goto LABEL_40099b; } } } } } goto LABEL_40099b; } } } } } } } } } LABEL_40099b: explicit_bzero(&v18, 0x40); DH_free(v17->field_118); v17->field_118 = 0; BN_clear_free(v6); sshbuf_free(v15); sshbuf_free(v16); free(v12); return v5; }
openssh-portable
angr_phoenix
static _Bool dev_ino_compare(void const *x, void const *y) { struct dev_ino const *a = x; struct dev_ino const *b = y; return ((*a).st_ino == (*b).st_ino && (*a).st_dev == (*b).st_dev) ? 1 : 0; }
long long dev_ino_compare(unsigned long long a0[2], unsigned long long a1[2]) { unsigned int v1; unsigned long long v2; if (a0[0] != a1[0] || a0[1] != a1[1]) v1 = 0; else v1 = 1; v2 = v1 & 1; return v2; }
coreutils
angr_sailr
static void ensure_minimum_time_since(double start, double seconds) { struct timespec ts; double elapsed = monotime_double() - start, req = seconds, remain; while ((remain = seconds - elapsed) < 0.0) seconds *= 2; ts.tv_sec = remain; ts.tv_nsec = (remain - ts.tv_sec) * 1000000000; sshlog("auth2.c", __func__, 254, 1, SYSLOG_LEVEL_DEBUG3, ((void *)0), "elapsed %0.3lfms, delaying %0.3lfms (requested %0.3lfms)", elapsed * 1000, remain * 1000, req * 1000); nanosleep(&ts, ((void *)0)); }
void ensure_minimum_time_since() { unsigned long v0; unsigned long v1; unsigned long v2; unsigned long v3; unsigned long long v4; unsigned long long v5; char v7; unsigned long v9; unsigned long v10; int v11; unsigned long long v13; unsigned long long *v15; unsigned long long v16; v1 = v9; v0 = v10; monotime_double(); s_40 = L Conv(128->64, (xmm0<16> - Conv(64->128, Load(addr = stack_base - 80, size = 8, endness = Iend_LE))))<8> v3 = v0; while (true) { v4 = v0 - v2; if ((((BinaryOp CmpF & 69) | ((BinaryOp CmpF & 69) >> 6)) & 1) == 1) break; v0 += v0; } v5 = v4; v13 = v5; s_20 = L Conv(128->64, (0x41cdcd6500000000 < 128 > *(Conv(64->128, Load(addr = stack_base - 48, size = 8, endness = Iend_LE)) - xmm1<16>)))<8> sshlog("auth2.c", "ensure_minimum_time_since", 0xfe, 0x1, 0x7, 0x0, "elapsed %0.3lfms, delaying %0.3lfms (requested %0.3lfms)"); nanosleep(&v5, NULL); v16 = *(&v7) ^ v15[5]; return; }
openssh-portable
angr_phoenix
static void _rl_update_pos(void) { const LineInfo *li = el_line(e); rl_point = (int)(li->cursor - li->buffer); rl_end = (int)(li->lastchar - li->buffer); rl_line_buffer[rl_end] = '\0'; }
void _rl_update_pos(void) { undefined8 *puVar1; puVar1 = (undefined8 *)el_line(e); *piRam0000000000105046 = (int)puVar1[1] - (int)*puVar1; *piRam0000000000105066 = (int)puVar1[2] - (int)*puVar1; *(undefined *)((long)*piRam0000000000105079 + *plRam000000000010506f) = 0; return; }
libedit
ghidra
static inline void __jiffies_to_tv(struct timeval *tv, unsigned long jiffies) { unsigned long long tvusec; tvusec = 10000ULL * jiffies; tv->tv_sec = tvusec / 1000000; tv->tv_usec = tvusec - 1000000 * tv->tv_sec; }
void __jiffies_to_tv(ulong *param_1, long param_2) { *param_1 = (ulong)(param_2 * 10000) / 1000000; param_1[1] = param_2 * 10000 + *param_1 * -1000000; return; }
iproute2-6.0.0
ghidra
void ssh_packet_set_tos(struct ssh *ssh, int tos) { if (!ssh_packet_connection_is_on_socket(ssh) || tos == 0x7fffffff) return; set_sock_tos(ssh->state->connection_in, tos); }
void ssh_packet_set_tos(unsigned int **a0, unsigned long a1) { unsigned long long v2; if (ssh_packet_connection_is_on_socket(a0) && a1 != 2147483647) v2 = set_sock_tos(*(*(a0)), a1, a1); return; }
openssh-portable
angr_phoenix
static inline void emit_stdin_note(void) { fputs_unlocked( gettext("\nWith no FILE, or when FILE is -, read standard input.\n"), stdout) ; }
int emit_stdin_note() { FILE *v0; char *v1; v0 = stdout; v1 = gettext("\nWith no FILE, or when FILE is -, read standard input.\n"); return fputs_unlocked(v1, v0); }
coreutils
ida
static char *convert_abs_rel(char const *from, char const *target) { char *targetdir = dir_name(target); char *realdest = canonicalize_filename_mode(targetdir, CAN_MISSING); char *realfrom = canonicalize_filename_mode(from, CAN_MISSING); char *relative_from = ((void *)0); if (realdest && realfrom) { relative_from = xmalloc(4096); if (!relpath(realfrom, realdest, relative_from, 4096)) { free(relative_from); relative_from = ((void *)0); } } free(targetdir); free(realdest); free(realfrom); return relative_from ? relative_from : xstrdup(from); }
int convert_abs_rel(unsigned long long a0, unsigned long long a1) { void *v0; void *v1; void *v2; void *v3; unsigned long v6; v1 = dir_name(a1); v2 = canonicalize_filename_mode(v1, 0x2); v3 = canonicalize_filename_mode(a0, 0x2); v0 = 0; if (v2 && v3) { v0 = xmalloc(0x1000); if ((relpath(v3, v2, v0, 0x1000) ^ 1)) { free(v0); v0 = 0; } } free(v1); free(v2); free(v3); if (v0) v6 = v0; else v6 = xstrdup(a0); return v6; }
coreutils
angr_phoenix
int _rl_set_mark_at_pos(int position) { if (position < 0 || position > rl_end) return 1; rl_mark = position; return 0; }
void _rl_set_mark_at_pos(unsigned long a0) { unsigned long long v1; void *v2; if (a0 < 0) { LABEL_402c67: v1 = 1; } else { if (!(a0 <= rl_end)) goto LABEL_402c67; rl_mark = a0; v2 = 0; } return; }
bash
angr_phoenix
int shtimer_alrm(sh_timer *t) { return 0; }
long long shtimer_alrm(unsigned long a0) { unsigned long v0; v0 = a0; return 0; }
bash
angr_sailr
vi_delete_prev_char(EditLine *el, wint_t c __attribute__((__unused__))) { if (el->el_line.cursor <= el->el_line.buffer) return 6; c_delbefore1(el); el->el_line.cursor--; return 4; }
long long vi_delete_prev_char(unsigned long long a0[12], unsigned long a1) { unsigned int v0; unsigned long long v2; v0 = a1; if (a0[11] <= a0[10]) { v2 = 6; } else { c_delbefore1(a0); a0[11] = a0[11] - 4; v2 = 4; } return v2; }
libedit
angr_phoenix
static inline void closefrom_close(int fd) { (void)close(fd); }
void closefrom_close(int param_1) { close(param_1); return; }
libbsd-0.11.7
ghidra
static void split_file(void) { for (idx_t i = 0; i < control_used; i++) { intmax_t j; if (controls[i].regexpr) { for (j = 0; (controls[i].repeat_forever || j <= controls[i].repeat); j++) process_regexp(&controls[i], j); } else { for (j = 0; (controls[i].repeat_forever || j <= controls[i].repeat); j++) process_line_count(&controls[i], j); } } create_output_file(); dump_rest_of_file(); close_output_file(); }
void split_file() { void *v0; void *v1; unsigned long long v3; for (v0 = 0; v0 < control_used; v0 += 1) { if (!*((((v0 << 1) + v0 << 5) + controls + 30))) { v1 = 0; while (true) { if (!*((((v0 << 1) + v0 << 5) + controls + 28)) && v1 > *((((v0 << 1) + v0 << 5) + controls + 16))) break; process_line_count(controls + v0 * 96, v1); v1 += 1; } } else { v1 = 0; while (true) { if (!*((((v0 << 1) + v0 << 5) + controls + 28)) && v1 > *((((v0 << 1) + v0 << 5) + controls + 16))) break; process_regexp(controls + v0 * 96, v1); v1 += 1; } } } create_output_file(); dump_rest_of_file(); v3 = close_output_file(); return; }
coreutils
angr_phoenix
static void regexp_error(struct control *p, intmax_t repetition, _Bool ignore) { fprintf(stderr, gettext("%s: %s: match not found"), program_name, quote(global_argv[p->argnum])); if (repetition) { char buf[((((((sizeof(intmax_t) * 8) - (!((__typeof__(intmax_t))0 < (__typeof__(intmax_t))-1))) * 146 + 484) / 485) + (!((__typeof__(intmax_t))0 < (__typeof__(intmax_t))-1))) + 1)]; fprintf(stderr, gettext(" on repetition %s\n"), imaxtostr(repetition, buf)); } else fprintf(stderr, "\n"); if (!ignore) { dump_rest_of_file(); close_output_file(); } cleanup_fatal(); }
void regexp_error(struct_0 *a0, unsigned long long a1, unsigned long a2) { char v0; unsigned long v1; unsigned long v2; unsigned long v3; unsigned long v5; unsigned long v6; unsigned long long *v7; unsigned long long v8; unsigned long long v9; v3 = v5; v2 = v6; v1 = v7[5]; v8 = quote(*((a0->field_18 * 8 + global_argv))); fprintf(stderr, gettext("%s: %s: match not found")); if (!a1) { fprintf(stderr, "\n"); } else { v9 = imaxtostr(a1, &v0, &v0); fprintf(stderr, gettext(" on repetition %s\n")); } if ((a2 ^ 1)) { dump_rest_of_file(); close_output_file(); } cleanup_fatal(); }
coreutils
angr_phoenix
static int test_key(int agent_fd, const char *filename) { struct sshkey *key = ((void *)0); u_char *sig = ((void *)0); size_t slen = 0; int r, ret = -1; char data[1024]; if ((r = sshkey_load_public(filename, &key, ((void *)0))) != 0) { sshlog("ssh-add.c", __func__, 485, 0, SYSLOG_LEVEL_ERROR, ssh_err(r), "Couldn't read public key %s", filename); return -1; } arc4random_buf(data, sizeof(data)); if ((r = ssh_agent_sign(agent_fd, key, &sig, &slen, data, sizeof(data), ((void *)0), 0)) != 0) { sshlog("ssh-add.c", __func__, 491, 0, SYSLOG_LEVEL_ERROR, ssh_err(r), "Agent signature failed for %s", filename); goto done; } if ((r = sshkey_verify(key, sig, slen, data, sizeof(data), ((void *)0), 0, ((void *)0))) != 0) { sshlog("ssh-add.c", __func__, 496, 0, SYSLOG_LEVEL_ERROR, ssh_err(r), "Signature verification failed for %s", filename); goto done; } ret = 0; done: free(sig); sshkey_free(key); return ret; }
long test_key(unsigned int a1, const char *a2) { long v2; long v4; const char *v5; long v6; unsigned int v8; unsigned int v9; unsigned int v10; unsigned int v11; long v12; void *ptr; long v14; char v15[1032]; unsigned long v16; v16 = __readfsqword(0x28u); v12 = 0LL; ptr = 0LL; v14 = 0LL; v8 = -1; v9 = sshkey_load_public(a2, &v12, 0LL); if (v9) { v2 = ssh_err(v9); sshlog("ssh-add.c", "test_key", 485LL, 0LL, 2LL, v2, "Couldn't read public key %s", a2); return 0xFFFFFFFFLL; } else { arc4random_buf(v15, 1024LL); v10 = ssh_agent_sign(a1, v12, &ptr, &v14, v15, 1024LL, 0LL, 0LL); if (v10) { v4 = ssh_err(v10); v5 = "test_key"; sshlog("ssh-add.c", "test_key", 491LL, 0LL, 2LL, v4, "Agent signature failed for %s", a2); } else { v5 = (const char *)ptr; v11 = sshkey_verify(v12, ptr, v14, v15, 1024LL, 0LL, 0LL, 0LL); if (v11) { v6 = ssh_err(v11); v5 = "test_key"; sshlog("ssh-add.c", "test_key", 496LL, 0LL, 2LL, v6, "Signature verification failed for %s", a2); } else { v8 = 0; } } free(ptr); sshkey_free(v12, v5); return v8; } }
openssh-portable
ida
static table const *lookup_word(parser_control const *pc, char *word) { char *p; char *q; idx_t wordlen; table const *tp; _Bool period_found; _Bool abbrev; for (p = word; *p; p++) *p = c_toupper(to_uchar(*p)); for (tp = meridian_table; tp->name; tp++) if (strcmp(word, tp->name) == 0) return tp; wordlen = strlen(word); abbrev = wordlen == 3 || (wordlen == 4 && word[3] == '.'); for (tp = month_and_day_table; tp->name; tp++) if ((abbrev ? strncmp(word, tp->name, 3) : strcmp(word, tp->name)) == 0) return tp; if ((tp = lookup_zone(pc, word))) return tp; if (strcmp(word, dst_table[0].name) == 0) return dst_table; for (tp = time_units_table; tp->name; tp++) if (strcmp(word, tp->name) == 0) return tp; if (word[wordlen - 1] == 'S') { word[wordlen - 1] = '\0'; for (tp = time_units_table; tp->name; tp++) if (strcmp(word, tp->name) == 0) return tp; word[wordlen - 1] = 'S'; } for (tp = relative_time_table; tp->name; tp++) if (strcmp(word, tp->name) == 0) return tp; if (wordlen == 1) for (tp = military_table; tp->name; tp++) if (word[0] == tp->name[0]) return tp; for (period_found = 0, p = q = word; (*p = *q); q++) if (*q == '.') period_found = 1; else p++; if (period_found && (tp = lookup_zone(pc, word))) return tp; return ((void *)0); }
const char **lookup_word(long a1, const char *a2) { unsigned char v2; bool v4; bool v5; char v6; bool v7; unsigned char *i; char *v9; const char *v10; const char **j; const char **k; const char **v13; const char **m; const char **n; const char **ii; char **jj; const char **v18; size_t v19; for (i = (unsigned char *)a2; *i; ++i) { v2 = to_uchar(*i); *i = c_toupper(v2); } for (j = (const char **)&meridian_table; *j; j += 2) { if (!strcmp(a2, *j)) return j; } v19 = strlen(a2); v4 = v19 == 3 || v19 == 4 && a2[3] == 46; v7 = v4; for (k = (const char **)&month_and_day_table; *k; k += 2) { if (v7) v5 = strncmp(a2, *k, 3uLL) == 0; else v5 = strcmp(a2, *k) == 0; if (v5) return k; } v13 = lookup_zone(a1, a2); if (v13) return v13; if (!strcmp(a2, "DST")) return (const char **)&dst_table; for (m = (const char **)&time_units_table; *m; m += 2) { if (!strcmp(a2, *m)) return m; } if (a2[v19 - 1] == 83) { a2[v19 - 1] = 0; for (n = (const char **)&time_units_table; *n; n += 2) { if (!strcmp(a2, *n)) return n; } a2[v19 - 1] = 83; } for (ii = (const char **)&relative_time_table; *ii; ii += 2) { if (!strcmp(a2, *ii)) return ii; } if (v19 == 1) { for (jj = &military_table; *jj; jj += 2) { if (*a2 == **jj) return (const char **)jj; } } v6 = 0; v10 = a2; v9 = (char *)a2; while (1) { *v9 = *v10; if (!*v9) break; if (*v10 == 46) v6 = 1; else ++v9; ++v10; } if (v6 && (v18 = lookup_zone(a1, a2)) != 0LL) return v18; else return 0LL; }
gnutls
ida
void coproc_close(cp) struct coproc *cp; { if (cp->c_rfd >= 0) { close(cp->c_rfd); cp->c_rfd = -1; } if (cp->c_wfd >= 0) { close(cp->c_wfd); cp->c_wfd = -1; } cp->c_rsave = cp->c_wsave = -1; }
void coproc_close(unsigned int a0[7]) { unsigned int v1[7]; if (a0[3] >= 0) { close(a0[3]); a0[3] = -1; } if (a0[4] >= 0) { close(a0[4]); a0[4] = -1; } a0[6] = -1; v1 = a0; a0[5] = a0[6]; return; }
bash
angr_dream