input
stringlengths
26
172k
output
stringlengths
18
318k
repo_name
stringclasses
23 values
decompiler
stringclasses
5 values
int tok_line(Tokenizer *tok, const LineInfo *line, int *argc, const char ***argv, int *cursorc, int *cursoro) { const char *ptr; int cc, co; cc = co = -1; ptr = line->buffer; for (ptr = line->buffer;; ptr++) { if (ptr >= line->lastchar) ptr = ""; if (ptr == line->cursor) { cc = (int)tok->argc; co = (int)(tok->wptr - tok->wstart); } switch (*ptr) { case '\'': tok->flags |= 1; tok->flags &= ~2; switch (tok->quote) { case Q_none: tok->quote = Q_single; break; case Q_single: tok->quote = Q_none; break; case Q_one: tok->quote = Q_none; *tok->wptr++ = *ptr; break; case Q_double: *tok->wptr++ = *ptr; break; case Q_doubleone: tok->quote = Q_double; *tok->wptr++ = *ptr; break; default: return -1; } break; case '"': tok->flags &= ~2; tok->flags |= 1; switch (tok->quote) { case Q_none: tok->quote = Q_double; break; case Q_double: tok->quote = Q_none; break; case Q_one: tok->quote = Q_none; *tok->wptr++ = *ptr; break; case Q_single: *tok->wptr++ = *ptr; break; case Q_doubleone: tok->quote = Q_double; *tok->wptr++ = *ptr; break; default: return -1; } break; case '\\': tok->flags |= 1; tok->flags &= ~2; switch (tok->quote) { case Q_none: tok->quote = Q_one; break; case Q_double: tok->quote = Q_doubleone; break; case Q_one: *tok->wptr++ = *ptr; tok->quote = Q_none; break; case Q_single: *tok->wptr++ = *ptr; break; case Q_doubleone: tok->quote = Q_double; *tok->wptr++ = *ptr; break; default: return -1; } break; case '\n': tok->flags &= ~2; switch (tok->quote) { case Q_none: goto tok_line_outok; case Q_single: case Q_double: *tok->wptr++ = *ptr; break; case Q_doubleone: tok->flags |= 2; tok->quote = Q_double; break; case Q_one: tok->flags |= 2; tok->quote = Q_none; break; default: return 0; } break; case '\0': switch (tok->quote) { case Q_none: if (tok->flags & 2) { tok->flags &= ~2; return 3; } goto tok_line_outok; case Q_single: return 1; case Q_double: return 2; case Q_doubleone: tok->quote = Q_double; *tok->wptr++ = *ptr; break; case Q_one: tok->quote = Q_none; *tok->wptr++ = *ptr; break; default: return -1; } break; default: tok->flags &= ~2; switch (tok->quote) { case Q_none: if (strchr(tok->ifs, *ptr) != ((void *)0)) tok_finish(tok); else *tok->wptr++ = *ptr; break; case Q_single: case Q_double: *tok->wptr++ = *ptr; break; case Q_doubleone: *tok->wptr++ = '\\'; tok->quote = Q_double; *tok->wptr++ = *ptr; break; case Q_one: tok->quote = Q_none; *tok->wptr++ = *ptr; break; default: return -1; } break; } if (tok->wptr >= tok->wmax - 4) { size_t size = (size_t)(tok->wmax - tok->wspace + 20); char *s = realloc(tok->wspace, size * sizeof(*s)); if (s == ((void *)0)) return -1; if (s != tok->wspace) { size_t i; for (i = 0; i < tok->argc; i++) { tok->argv[i] = (tok->argv[i] - tok->wspace) + s; } tok->wptr = (tok->wptr - tok->wspace) + s; tok->wstart = (tok->wstart - tok->wspace) + s; tok->wspace = s; } tok->wmax = s + size; } if (tok->argc >= tok->amax - 4) { char **p; tok->amax += 10; p = realloc(tok->argv, tok->amax * sizeof(*p)); if (p == ((void *)0)) { tok->amax -= 10; return -1; } tok->argv = p; } } tok_line_outok: if (cc == -1 && co == -1) { cc = (int)tok->argc; co = (int)(tok->wptr - tok->wstart); } if (cursorc != ((void *)0)) *cursorc = cc; if (cursoro != ((void *)0)) *cursoro = co; tok_finish(tok); *argv = (const char **)tok->argv; *argc = (int)tok->argc; return 0; }
void tok_line(struct_0 *a0, unsigned long long a1[3], unsigned int *a2, unsigned long long *a3, unsigned int *a4, unsigned int *a5) { struct_2 *v0; int tmp_21; int tmp_15; unsigned int v1; unsigned int v2; unsigned long long v3; void *v4; unsigned int v5; unsigned long v6; unsigned long v7; char *v9; char *v10; char *v11; char *v12; char *v13; char *v14; char *v15; char *v16; char *v17; char *v18; char *v19; char *v20; char *v22; char *v23; char *v24; unsigned long long v25; void *v26; unsigned long long v27; unsigned long long v28; unsigned long long v29; unsigned long long v30; unsigned long long v31; unsigned long long v32; unsigned long long v33; unsigned long long v34; unsigned long long v35; void *v36; v0 = &a0->field_0; v2 = -1; v1 = v2; v3 = a1[0]; v3 = a1[0]; while (true) { if (v3 >= a1[2]) v3 = &g_400c80; if (v3 == a1[1]) { v1 = a0->field_8; v2 = &a0->field_20[-1 * a0->field_30]; } if (*(v3) != 92) { if (*(v3) <= 92) { if (*(v3) == 39) { a0->field_44 = a0->field_44 | 1; a0->field_44 = a0->field_44 & -3; switch (a0->field_40) { case 0: a0->field_40 = 1; break; case 1: a0->field_40 = 0; break; case 2: v13 = a0->field_20; a0->field_20 = a0->field_20 + 1; *(v13) = *(v3); break; case 3: a0->field_40 = 0; v11 = a0->field_20; a0->field_20 = a0->field_20 + 1; *(v11) = *(v3); break; case 4: a0->field_40 = 2; v12 = a0->field_20; a0->field_20 = a0->field_20 + 1; *(v12) = *(v3); break; default: v28 = 4294967295; } } else if (*(v3) <= 39) { if (*(v3) == 34) { a0->field_44 = a0->field_44 & -3; a0->field_44 = a0->field_44 | 1; switch (a0->field_40) { case 0: a0->field_40 = 2; break; case 1: v16 = a0->field_20; a0->field_20 = a0->field_20 + 1; *(v16) = *(v3); break; case 2: a0->field_40 = 0; break; case 3: a0->field_40 = 0; v14 = a0->field_20; a0->field_20 = a0->field_20 + 1; *(v14) = *(v3); break; case 4: a0->field_40 = 2; v15 = a0->field_20; a0->field_20 = a0->field_20 + 1; *(v15) = *(v3); break; default: v29 = 4294967295; } } else if (*(v3) <= 34) { if (!*(v3)) { switch (a0->field_40) { case 0: if ((a0->field_44 & 2)) { a0->field_44 = a0->field_44 & -3; v35 = 3; break; } case 1: v31 = 1; break; case 2: v32 = 2; break; case 3: a0->field_40 = 0; v19 = a0->field_20; a0->field_20 = a0->field_20 + 1; *(v19) = *(v3); case 4: a0->field_40 = 2; v18 = a0->field_20; a0->field_20 = a0->field_20 + 1; *(v18) = *(v3); default: v30 = 4294967295; break; } } else if (*(v3) == 10) { if (a0->field_40 == 4) { a0->field_44 = a0->field_44 | 2; a0->field_40 = 2; } else if (a0->field_40 <= 4) { if (a0->field_40 == 3) { a0->field_44 = a0->field_44 | 2; a0->field_40 = 0; } else if (a0->field_40 <= 3 && a0->field_40 && a0->field_40 - 1 <= 1) { v23 = a0->field_20; a0->field_20 = a0->field_20 + 1; *(v23) = *(v3); } } } if (*(v3) == 10) a0->field_44 = a0->field_44 & -3; } } } if (*(v3) > 92 || *(v3) > 39 && *(v3) != 39 || *(v3) != 34 && *(v3) > 34 && *(v3) != 39 || *(v3) != 34 && *(v3) != 10 && *(v3) != 39 && *(v3)) { a0->field_44 = a0->field_44 & -3; if (a0->field_40 == 4) { tmp_21 = a0->field_20; a0->field_20 = a0->field_20 + 1; *(tmp_21) = 92; a0->field_40 = 2; v17 = a0->field_20; a0->field_20 = a0->field_20 + 1; *(v17) = *(v3); } else if (a0->field_40 <= 4) { if (a0->field_40 == 3) { a0->field_40 = 0; v20 = a0->field_20; a0->field_20 = a0->field_20 + 1; *(v20) = *(v3); } else if (a0->field_40 <= 3) { if (a0->field_40) { if (a0->field_40 - 1 <= 1) { v22 = a0->field_20; a0->field_20 = a0->field_20 + 1; *(v22) = *(v3); } } else { if (strchr(a0->field_0, *(v3))) { tok_finish(a0); } else { v24 = a0->field_20; a0->field_20 = a0->field_20 + 1; *(v24) = *(v3); } } } } } } else { a0->field_44 = a0->field_44 | 1; a0->field_44 = a0->field_44 & -3; switch (a0->field_40) { case 0: a0->field_40 = 3; break; case 1: v10 = a0->field_20; a0->field_20 = a0->field_20 + 1; *(v10) = *(v3); break; case 2: a0->field_40 = 4; break; case 3: tmp_15 = a0->field_20; a0->field_20 = a0->field_20 + 1; *(tmp_15) = *(v3); a0->field_40 = 0; break; case 4: a0->field_40 = 2; v9 = a0->field_20; a0->field_20 = a0->field_20 + 1; *(v9) = *(v3); break; default: v27 = 4294967295; } } if (...) { if (v1 == -1 && v2 == -1) { v1 = a0->field_8; v2 = &a0->field_20[-1 * a0->field_30]; } if (a4) *(a4) = v1; if (a5) *(a5) = v2; tok_finish(a0); *(a3) = a0->field_18; *(a2) = a0->field_8; v36 = 0; break; } if (...) { v26 = 0; break; } if (a0->field_40 > 4 && *(v3) != 92 && a0->field_40 != 4 && (*(v3) > 92 || *(v3) != 39) && (*(v3) > 39 || *(v3) != 34 || *(v3) > 92) && (*(v3) > 39 || *(v3) != 10 || *(v3) > 34 || *(v3) > 92) && (*(v3) > 39 || *(v3) > 34 || *(v3) > 92 || *(v3)) || a0->field_40 <= 4 && a0->field_40 != 3 && a0->field_40 > 3 && *(v3) != 92 && a0->field_40 != 4 && (*(v3) > 92 || *(v3) != 39) && (*(v3) > 39 || *(v3) != 34 || *(v3) > 92) && (*(v3) > 39 || *(v3) != 10 || *(v3) > 34 || *(v3) > 92) && (*(v3) > 39 || *(v3) > 34 || *(v3) > 92 || *(v3)) || a0->field_40 <= 4 && a0->field_40 <= 3 && a0->field_40 != 3 && a0->field_40 - 1 > 1 && a0->field_40 && *(v3) != 92 && a0->field_40 != 4 && (*(v3) > 92 || *(v3) != 39) && (*(v3) > 39 || *(v3) != 34 || *(v3) > 92) && (*(v3) > 39 || *(v3) != 10 || *(v3) > 34 || *(v3) > 92) && (*(v3) > 39 || *(v3) > 34 || *(v3) > 92 || *(v3))) { v25 = 4294967295; break; } if (a0->field_20 >= a0->field_28 - 4) { *(&v5) = a0->field_28 - a0->field_38 + 20; v6 = realloc(a0->field_38, *(&v5)); if (!v6) { v33 = 4294967295; break; } else { if (v6 != a0->field_38) { for (v4 = 0; v4 < a0->field_8; v4 += 1) { *((a0->field_18 + v4 * 8)) = v6 + *((a0->field_18 + v4 * 8)) - a0->field_38; } a0->field_20 = &a0->field_20[-1 * a0->field_38 + v6]; a0->field_30 = a0->field_30 - a0->field_38 + v6; a0->field_38 = v6; } a0->field_28 = v6 + *(&v5); } } if (a0->field_20 < a0->field_28 - 4 || v6) { if (a0->field_8 >= a0->field_10 - 4) { a0->field_10 = a0->field_10 + 10; v7 = realloc(a0->field_18, a0->field_10 * 8); if (!v7) { a0->field_10 = a0->field_10 - 10; v34 = 4294967295; break; } else { a0->field_18 = v7; } } if (a0->field_8 < a0->field_10 - 4 || v7) { v3 += 1; continue; } } } return; }
libedit
angr_dream
&& getdef_bool ("SU_WHEEL_ONLY") && !iswheel (caller_name)) { fprintf(stderr, gettext("You are not authorized to su %s\n"), name); exit(1); }
void getdef_bool(void) { halt_baddata(); }
shadow
ghidra
static void print_usage(FILE *f) { printf("Usage: ip link <options> type vxcan [peer <options>]\n" "To get <options> type 'ip link add help'\n"); }
void print_usage(unsigned long a0) { unsigned long v0; unsigned long long v2; v0 = a0; v2 = printf("Usage: ip link <options> type vxcan [peer <options>]\nTo get " "<options> type 'ip link add help'\n"); return; }
iproute2-6.0.0
angr_phoenix
ed_insert(EditLine *el, wint_t c) { int count = el->el_state.argument; if (c == '\0') return 6; if (el->el_line.lastchar + el->el_state.argument >= el->el_line.limit) { if (!ch_enlargebufs(el, (size_t)count)) return 6; } if (count == 1) { if (el->el_state.inputmode == 0 || el->el_line.cursor >= el->el_line.lastchar) c_insert(el, 1); *el->el_line.cursor++ = c; re_fastaddc(el); } else { if (el->el_state.inputmode != 2) c_insert(el, el->el_state.argument); while (count-- && el->el_line.cursor < el->el_line.lastchar) *el->el_line.cursor++ = c; re_refresh(el); } if (el->el_state.inputmode == 2) return vi_command_mode(el, 0); return 0; }
long ed_insert(long a1, int a2) { _DWORD *v3; _DWORD *v4; int v5; int v6; v6 = *(_DWORD *)(a1 + 120); if (!a2) return 6LL; if ((unsigned long)(4LL * *(int *)(a1 + 120) + *(_QWORD *)(a1 + 96)) >= *(_QWORD *)(a1 + 104) && !(unsigned int)ch_enlargebufs(a1, v6)) { return 6LL; } if (v6 == 1) { if (!*(_DWORD *)(a1 + 112) || *(_QWORD *)(a1 + 88) >= *(_QWORD *)(a1 + 96)) c_insert(a1, 1LL); v3 = *(_DWORD **)(a1 + 88); *(_QWORD *)(a1 + 88) = v3 + 1; *v3 = a2; re_fastaddc(a1); } else { if (*(_DWORD *)(a1 + 112) != 2) c_insert(a1, *(unsigned int *)(a1 + 120)); while (1) { v5 = v6--; if (!v5 || *(_QWORD *)(a1 + 88) >= *(_QWORD *)(a1 + 96)) break; v4 = *(_DWORD **)(a1 + 88); *(_QWORD *)(a1 + 88) = v4 + 1; *v4 = a2; } re_refresh(a1); } if (*(_DWORD *)(a1 + 112) == 2) return vi_command_mode(a1, 0LL); else return 0LL; }
libedit
ida
char *ct_encode_string(const wchar_t *s, ct_buffer_t *conv) { char *dst; ssize_t used; if (!s) return ((void *)0); dst = conv->cbuff; for (;;) { used = (ssize_t)(dst - conv->cbuff); if ((conv->csize - (size_t)used) < 5) { if (ct_conv_cbuff_resize(conv, conv->csize + ((size_t)1024)) == -1) return ((void *)0); dst = conv->cbuff + used; } if (!*s) break; used = ct_encode_char(dst, (size_t)5, *s); if (used == -1) abort(); ++s; dst += used; } *dst = '\0'; return conv->cbuff; }
long long ct_encode_string(unsigned long a0, unsigned long long a1[2]) { unsigned long v0; char *v1; unsigned long v2; void *v4; unsigned long long v5; v0 = a0; if (!v0) { v4 = 0; } else { v1 = a1[0]; while (true) { v2 = &v1[-1 * a1[0]]; if (a1[1] - v2 <= 4) { v5 = ct_conv_cbuff_resize(a1, a1[1] + 0x400); if (v5 == -1) { v4 = 0; break; } else { v1 = v2 + a1[0]; } } if (v5 != -1 || a1[1] - v2 > 4) { if (*(v0)) { v2 = ct_encode_char(v1, 0x5, *(v0)); if (v2 == -1) abort(); v0 += 1; v1 = &v1[v2]; } else { *(v1) = 0; v4 = a1[0]; break; } } } } return v4; }
libedit
angr_dream
int inflatePrime(strm, bits, value) z_streamp strm; int bits; int value; { struct inflate_state *state; if (inflateStateCheck(strm)) return (-2); state = (struct inflate_state *)strm->state; if (bits < 0) { state->hold = 0; state->bits = 0; return 0; } if (bits > 16 || state->bits + (uInt)bits > 32) return (-2); value &= (1L << bits) - 1; state->hold += (unsigned)value << state->bits; state->bits += (uInt)bits; return 0; }
long long inflatePrime(struct_0 *a0, unsigned long a1, unsigned long a2) { unsigned int v0; struct_1 *v1; unsigned long long v3; v0 = a2; if (inflateStateCheck(a0)) { v3 = 4294967294; return v3; } v1 = a0->field_38; if (a1 < 0) { v1->field_50 = 0; v1->field_58 = 0; v3 = 0; return v3; } else if (a1 > 16) { v3 = 4294967294; return v3; } else if (a1 + v1->field_58 > 32) { v3 = 4294967294; return v3; } else { v0 &= (1 << (a1 & 63)) - 1; v1->field_50 = v1->field_50 + (v0 << (v1->field_58 & 31)); v1->field_58 = v1->field_58 + a1; v3 = 0; return v3; } }
zlib
angr_sailr
int diff_dirs(struct comparison const *cmp, int (*handle_file)(struct comparison const *, char const *, char const *)) { struct dirdata dirdata[2]; int volatile val = 0; int i; if ((cmp->file[0].desc == -1 || dir_loop(cmp, 0)) && (cmp->file[1].desc == -1 || dir_loop(cmp, 1))) { error(0, 0, gettext("%s: recursive directory loop"), cmp->file[cmp->file[0].desc == -1].name); return 2; } for (i = 0; i < 2; i++) if (!dir_read(&cmp->file[i], &dirdata[i])) { perror_with_name(cmp->file[i].name); val = 2; } if (val == 0) { char const **volatile names[2]; names[0] = dirdata[0].names; names[1] = dirdata[1].names; locale_specific_sorting = 1; if (_setjmp(failed_locale_specific_sorting)) locale_specific_sorting = 0; for (i = 0; i < 2; i++) qsort(names[i], dirdata[i].nnames, sizeof *dirdata[i].names, compare_names_for_qsort); if (starting_file && !cmp->parent) { while (*names[0] && compare_names(*names[0], starting_file) < 0) names[0]++; while (*names[1] && compare_names(*names[1], starting_file) < 0) names[1]++; } while (*names[0] || *names[1]) { int nameorder = (!*names[0] ? 1 : !*names[1] ? -1 : compare_names(*names[0], *names[1])); if (nameorder == 0 && ignore_file_name_case) { int raw_order = strcmp(*names[0], *names[1]); if (raw_order != 0) { int greater_side = raw_order < 0; int lesser_side = 1 - greater_side; char const **lesser = names[lesser_side]; char const *greater_name = *names[greater_side]; char const **p; for (p = lesser + 1; *p && compare_names(*p, greater_name) == 0; p++) { int c = strcmp(*p, greater_name); if (0 <= c) { if (c == 0) { memmove(lesser + 1, lesser, (char *)p - (char *)lesser); *lesser = greater_name; } break; } } } } int v1 = (*handle_file)(cmp, 0 < nameorder ? 0 : *names[0]++, nameorder < 0 ? 0 : *names[1]++); if (val < v1) val = v1; } } for (i = 0; i < 2; i++) { free(dirdata[i].names); free(dirdata[i].data); } return val; }
int diff_dirs(int *param_1, code *param_2) { undefined8 uVar1; char **__src; char cVar2; int iVar3; int iVar4; undefined8 uVar5; char *pcVar6; char *pcVar7; long in_FS_OFFSET; int local_a0; int local_9c; char **local_80; char **local_68[2]; size_t local_58; char **local_50; void *apvStack72[2]; char **local_38; long local_20; local_20 = *(long *)(in_FS_OFFSET + 0x28); local_a0 = 0; if (((*param_1 == -1) || (cVar2 = dir_loop(param_1, 0), cVar2 != '\0')) && ((param_1[0x4c] == -1 || (cVar2 = dir_loop(param_1, 1), cVar2 != '\0')))) { uVar1 = *(undefined8 *)(param_1 + (long)(int)(uint)(*param_1 == -1) * 0x4c + 2); uVar5 = gettext("%s: recursive directory loop"); error(0, 0, uVar5, uVar1); local_a0 = 2; } else { for (local_9c = 0; local_9c < 2; local_9c = local_9c + 1) { cVar2 = dir_read(param_1 + (long)local_9c * 0x4c, &local_58 + (long)local_9c * 3); if (cVar2 != '\x01') { perror_with_name(*(undefined8 *)(param_1 + (long)local_9c * 0x4c + 2)); local_a0 = 2; } } if (local_a0 == 0) { local_68[0] = local_50; local_68[1] = local_38; locale_specific_sorting = 1; iVar3 = _setjmp((__jmp_buf_tag *)failed_locale_specific_sorting); if (iVar3 != 0) { locale_specific_sorting = 0; } for (local_9c = 0; local_9c < 2; local_9c = local_9c + 1) { qsort(local_68[local_9c], (&local_58)[(long)local_9c * 3], 8, compare_names_for_qsort); } if ((starting_file != 0) && (*(long *)(param_1 + 0x98) == 0)) { while ( (*local_68[0] != (char *)0x0 && (iVar3 = compare_names(*local_68[0], starting_file), iVar3 < 0))) { local_68[0] = local_68[0] + 1; } while ( (*local_68[1] != (char *)0x0 && (iVar3 = compare_names(*local_68[1], starting_file), iVar3 < 0))) { local_68[1] = local_68[1] + 1; } } while ((*local_68[0] != (char *)0x0 || (*local_68[1] != (char *)0x0))) { if (*local_68[0] == (char *)0x0) { iVar3 = 1; } else if (*local_68[1] == (char *)0x0) { iVar3 = -1; } else { iVar3 = compare_names(*local_68[0], *local_68[1]); } if (((iVar3 == 0) && (ignore_file_name_case != '\0')) && (iVar4 = strcmp(*local_68[0], *local_68[1]), iVar4 != 0)) { __src = local_68[(iVar4 >> 0x1f) + 1]; pcVar7 = *local_68[-(iVar4 >> 0x1f)]; local_80 = __src; do { local_80 = local_80 + 1; if ((*local_80 == (char *)0x0) || (iVar4 = compare_names(*local_80, pcVar7), iVar4 != 0)) goto LAB_00100886; iVar4 = strcmp(*local_80, pcVar7); } while (iVar4 < 0); if (iVar4 == 0) { memmove(__src + 1, __src, (long)local_80 - (long)__src); *__src = pcVar7; } } LAB_00100886: if (iVar3 < 0) { pcVar7 = (char *)0x0; } else { pcVar7 = *local_68[1]; local_68[1] = local_68[1] + 1; } if (iVar3 < 1) { pcVar6 = *local_68[0]; local_68[0] = local_68[0] + 1; } else { pcVar6 = (char *)0x0; } iVar3 = (*param_2)(param_1, pcVar6, pcVar7); if (local_a0 < iVar3) { local_a0 = iVar3; } } } for (local_9c = 0; local_9c < 2; local_9c = local_9c + 1) { free(apvStack72[(long)local_9c * 3 + -1]); free(apvStack72[(long)local_9c * 3]); } } if (local_20 == *(long *)(in_FS_OFFSET + 0x28)) { return local_a0; } __stack_chk_fail(); }
diffutils
ghidra
int main(int argc, char **argv) { _Bool ok; int optc; ; set_program_name(argv[0]); setlocale(6, ""); bindtextdomain("coreutils", "/usr/local/share/locale"); textdomain("coreutils"); atexit(close_stdout); append = 0; ignore_interrupts = 0; while ((optc = getopt_long(argc, argv, "aip", long_options, ((void *)0))) != -1) { switch (optc) { case 'a': append = 1; break; case 'i': ignore_interrupts = 1; break; case 'p': if (optarg) output_error = ((output_error_types)[__xargmatch_internal( "--output-error", optarg, output_error_args, (void const *)(output_error_types), sizeof *(output_error_types), argmatch_die, 1)]); else output_error = output_error_warn_nopipe; break; case GETOPT_HELP_CHAR: usage(0); break; ; case GETOPT_VERSION_CHAR: version_etc(stdout, "tee", "GNU coreutils", Version, ("Mike Parker"), ("Richard M. Stallman"), ("David MacKenzie"), (char *)((void *)0)); exit(0); break; ; default: usage(1); } } if (ignore_interrupts) signal(2, ((__sighandler_t)1)); if (output_error != output_error_sigpipe) signal(13, ((__sighandler_t)1)); ok = tee_files(argc - optind, &argv[optind]); if (close(0) != 0) ((!!sizeof(struct { _Static_assert(1, "verify_expr (" "1" ", " "(error (1, (*__errno_location ()), \"%s\", gettext " "(\"standard input\")), assume (false))" ")"); int _gl_dummy; })) ? ((error(1, (*__errno_location()), "%s", gettext("standard input")), ((0) ? (void)0 : __builtin_unreachable()))) : ((error(1, (*__errno_location()), "%s", gettext("standard input")), ((0) ? (void)0 : __builtin_unreachable())))); return ok ? 0 : 1; }
byte main(int param_1, undefined8 *param_2) { byte bVar1; int iVar2; long lVar3; int *piVar4; undefined8 uVar5; set_program_name(*param_2); setlocale(6, ""); bindtextdomain("coreutils", "/usr/local/share/locale"); textdomain("coreutils"); atexit(p_Ram00000000001003ff); append = 0; ignore_interrupts = '\0'; LAB_00100557: while (true) { uVar5 = 0x100579; iVar2 = getopt_long(param_1, param_2, &DAT_0010126b, long_options, 0); if (iVar2 == -1) { if (ignore_interrupts != '\0') { signal(2, (__sighandler_t)0x1); } if (output_error != 0) { signal(0xd, (__sighandler_t)0x1); } bVar1 = tee_files(param_1 - optind, param_2 + optind); iVar2 = close(0); if (iVar2 != 0) { uVar5 = gettext("standard input"); piVar4 = __errno_location(); error(1, *piVar4, &DAT_0010127e, uVar5); } return bVar1 ^ 1; } if (iVar2 != 0x70) break; if (optarg == 0) { output_error = 2; } else { lVar3 = __xargmatch_internal("--output-error", optarg, output_error_args, output_error_types, 4, argmatch_die, 1, uVar5); output_error = *(int *)(output_error_types + lVar3 * 4); } } if (iVar2 < 0x71) { if (iVar2 == 0x69) { ignore_interrupts = '\x01'; goto LAB_00100557; } if (0x69 < iVar2) goto LAB_0010054d; if (iVar2 == 0x61) { append = 1; goto LAB_00100557; } if (iVar2 < 0x62) { if (iVar2 == -0x83) { LAB_001004fb: version_etc(stdout, &DAT_00101210, "GNU coreutils", Version, "Mike Parker", "Richard M. Stallman", "David MacKenzie", 0); exit(0); } if (iVar2 == -0x82) { usage(0); goto LAB_001004fb; } } } LAB_0010054d: usage(); goto LAB_00100557; }
coreutils
ghidra
static int glob_name_is_acceptable(name) const char *name; { struct ign *p; char *n; int flags; n = strrchr(name, '/'); if (n == 0 || n[1] == 0) n = (char *)name; else n++; if (n[0] == '.' && (n[1] == '\0' || (n[1] == '.' && n[2] == '\0'))) return (0); flags = (1 << 0) | (extended_glob ? (1 << 5) : 0) | (glob_ignore_case ? (1 << 4) : 0); for (p = globignore.ignores; p->val; p++) { if (strmatch(p->val, (char *)name, flags) != 1) return (0); } return (1); }
long long glob_name_is_acceptable(char *a0) { unsigned int v0; unsigned long long *v1; char v2[3]; unsigned long long v4; unsigned int v5; unsigned int v6; v2 = &strrchr(a0, 0x2f); if (!v2) { LABEL_400ea0: *(&v2) = a0; } else { if (!v2->field_1) goto LABEL_400ea0; *(&v2) = &v2->field_1; } if (v2[0] == 46) { if (!v2[1]) { LABEL_400ee7: v4 = 0; goto LABEL_400f67; } else if (v2[1] == 46) { if (!(!v2[2])) goto LABEL_400eee; goto LABEL_400ee7; } } LABEL_400eee: if (!extended_glob) v5 = 1; else v5 = 33; if (!glob_ignore_case) v6 = 0; else v6 = 16; v0 = v6 | v5; v1 = g_4017a8; while (true) { if (!*(v1)) { v4 = 1; break; } else if (strmatch(*(v1), a0, v0, a0) == 1) { v1 += 2; } else { v4 = 0; break; } } LABEL_400f67: return v4; }
bash
angr_phoenix
static SHELL_VAR *get_dirstack(self) SHELL_VAR *self; { ARRAY *a; WORD_LIST *l; l = get_directory_stack(0); a = array_from_word_list(l); array_dispose((ARRAY *)((self)->value)); dispose_words(l); ((self)->value = (char *)(a)); return self; }
long long get_dirstack(struct_0 *a0) { unsigned long long v0; unsigned long v1; v0 = get_directory_stack(0x0); v1 = array_from_word_list(v0); array_dispose(a0->field_8); dispose_words(v0); a0->field_8 = v1; return a0; }
bash
angr_sailr
!= 2 ) { error( 0, (*__errno_location()), gettext("cannot remove %s"), quotearg_style(shell_escape_always_quoting_style, dst_name)); return_val = 0; goto close_src_desc; }
error(0, *v15, v14, v13), *(_BYTE *)(a1 + 50)) ) { return 0xFFFFFFFFLL; }
coreutils
ida
static void process_extended_hardlink(u_int32_t id) { char *oldpath, *newpath; int r, status; if ((r = sshbuf_get_cstring(iqueue, &oldpath, ((void *)0))) != 0 || (r = sshbuf_get_cstring(iqueue, &newpath, ((void *)0))) != 0) sshfatal("sftp-server.c", __func__, 1438, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "parse"); sshlog("sftp-server.c", __func__, 1440, 0, SYSLOG_LEVEL_DEBUG3, ((void *)0), "request %u: hardlink", id); sshlog("sftp-server.c", __func__, 1441, 0, SYSLOG_LEVEL_INFO, ((void *)0), "hardlink old \"%s\" new \"%s\"", oldpath, newpath); r = link(oldpath, newpath); status = (r == -1) ? errno_to_portable((*__errno_location())) : 0; send_status(id, status); free(oldpath); free(newpath); }
void process_extended_hardlink(uint param_1) { int iVar1; undefined8 uVar2; int *piVar3; char **ppcVar4; long in_FS_OFFSET; char *pcStack72; undefined8 uStack64; undefined auStack56[12]; uint local_2c; int local_28; undefined4 local_24; char *local_20; char *local_18; long local_10; ppcVar4 = (char **)auStack56; local_10 = *(long *)(in_FS_OFFSET + 0x28); uStack64 = 0x104e5a; local_2c = param_1; local_28 = sshbuf_get_cstring(iqueue, &local_20, 0); if (local_28 == 0) { uStack64 = 0x104e7e; local_28 = sshbuf_get_cstring(iqueue, &local_18, 0); if (local_28 == 0) goto LAB_00104ec8; } uStack64 = 0x104e91; uVar2 = ssh_err(local_28); ppcVar4 = &pcStack72; pcStack72 = "parse"; sshfatal("sftp-server.c", "process_extended_hardlink", 0x59e, 1, 1, uVar2); LAB_00104ec8: *(ulong *)((long)ppcVar4 + -8) = (ulong)local_2c; *(char **)((long)ppcVar4 + -0x10) = "request %u: hardlink"; *(undefined8 *)((long)ppcVar4 + -0x18) = 0x104f02; sshlog("sftp-server.c", "process_extended_hardlink", 0x5a0, 0, 7, 0); *(char **)((long)ppcVar4 + -0x10) = local_18; *(char **)((long)ppcVar4 + -0x18) = local_20; *(char **)((long)ppcVar4 + -0x20) = "hardlink old \"%s\" new \"%s\""; *(undefined8 *)((long)ppcVar4 + -0x28) = 0x104f4a; sshlog("sftp-server.c", "process_extended_hardlink", 0x5a1, 0, 3, 0); *(undefined8 *)((long)ppcVar4 + -8) = 0x104f61; local_28 = link(local_20, local_18); if (local_28 == -1) { *(undefined8 *)((long)ppcVar4 + -8) = 0x104f6f; piVar3 = __errno_location(); iVar1 = *piVar3; *(undefined8 *)((long)ppcVar4 + -8) = 0x104f78; local_24 = errno_to_portable(iVar1); } else { local_24 = 0; } *(undefined8 *)((long)ppcVar4 + -8) = 0x104f91; send_status(local_2c, local_24); *(undefined8 *)((long)ppcVar4 + -8) = 0x104f9d; free(local_20); *(undefined8 *)((long)ppcVar4 + -8) = 0x104fa9; free(local_18); if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) { *(undefined8 *)((long)ppcVar4 + -8) = 0x104fbe; __stack_chk_fail(); } return; }
openssh-portable
ghidra
static int gz_fetch(state) gz_statep state; { z_streamp strm = &(state->strm); do { switch (state->how) { case 0: if (gz_look(state) == -1) return -1; if (state->how == 0) return 0; break; case 1: if (gz_load(state, state->out, state->size << 1, &(state->x.have)) == -1) return -1; state->x.next = state->out; return 0; case 2: strm->avail_out = state->size << 1; strm->next_out = state->out; if (gz_decomp(state) == -1) return -1; } } while (state->x.have == 0 && (!state->eof || strm->avail_in)); return 0; }
int gz_fetch(struct_0 *a0) { struct_1 *v0; unsigned int v2; v0 = &a0[219604096115589898].field_38; while (true) { if (a0->field_44 == 2) { v0->field_20 = a0->field_28 * 2; v0->field_18 = a0->field_38; if (gz_decomp(a0) == -1) { v2 = -1; break; } } else if (a0->field_44 <= 2) { if (a0->field_44) { if (a0->field_44 == 1) { if (gz_load(a0, a0->field_38, a0->field_28 << 1, a0) != -1) { a0->field_8 = a0->field_38; v2 = 0; break; } else { v2 = -1; break; } } } else { if (gz_look(a0) == -1) { v2 = -1; break; } else if (!a0->field_44) { v2 = 0; break; } } } if (a0->field_0) { LABEL_40076c: v2 = 0; break; } else { if (!a0->field_50) continue; if (!v0->field_8) goto LABEL_40076c; } } return v2; }
zlib
angr_phoenix
static _Bool build_spec_list(const struct E_string *es, struct Spec_list *result) { char const *p = es->s; size_t i; for (i = 0; i + 2 < es->len;) { if (es_match(es, i, '[')) { _Bool matched_multi_char_construct; size_t closing_bracket_idx; unsigned char char_to_repeat; count repeat_count; int err; matched_multi_char_construct = 1; if (es_match(es, i + 1, ':') || es_match(es, i + 1, '=')) { size_t closing_delim_idx; if (find_closing_delim(es, i + 2, p[i + 1], &closing_delim_idx)) { size_t opnd_str_len = closing_delim_idx - 1 - (i + 2) + 1; char const *opnd_str = p + i + 2; if (opnd_str_len == 0) { if (p[i + 1] == ':') error(0, 0, gettext("missing character class name '[::]'")); else error(0, 0, gettext("missing equivalence class character '[==]'")); return 0; } if (p[i + 1] == ':') { if (!append_char_class(result, opnd_str, opnd_str_len)) { if (star_digits_closebracket(es, i + 2)) goto try_bracketed_repeat; else { char *tmp = make_printable_str(opnd_str, opnd_str_len); error(0, 0, gettext("invalid character class %s"), quote(tmp)); free(tmp); return 0; } } } else { if (!append_equiv_class(result, opnd_str, opnd_str_len)) { if (star_digits_closebracket(es, i + 2)) goto try_bracketed_repeat; else { char *tmp = make_printable_str(opnd_str, opnd_str_len); error(0, 0, gettext("%s: equivalence class operand must be a single " "character"), tmp); free(tmp); return 0; } } } i = closing_delim_idx + 2; continue; } } try_bracketed_repeat: err = find_bracketed_repeat(es, i + 1, &char_to_repeat, &repeat_count, &closing_bracket_idx); if (err == 0) { append_repeated_char(result, char_to_repeat, repeat_count); i = closing_bracket_idx + 1; } else if (err == -1) { matched_multi_char_construct = 0; } else { return 0; } if (matched_multi_char_construct) continue; } if (es_match(es, i + 1, '-')) { if (!append_range(result, p[i], p[i + 2])) return 0; i += 3; } else { append_normal_char(result, p[i]); ++i; } } for (; i < es->len; i++) append_normal_char(result, p[i]); return 1; }
int build_spec_list(unsigned long long a0[3], void *a1) { char v0; char v1; unsigned int v2; char v3; char v4; void *v5; void *v6; unsigned int v7; void *v8; void *v9; void *v10; unsigned long long v12; unsigned long long v13; unsigned int v14; unsigned long long v15; v6 = a0[0]; while (true) { if (v5 + 2 < a0[2]) { v12 = es_match(a0, v5, 0x5b); if (v12) { v1 = 1; v13 = es_match(a0, v5 + 1, 0x3a); if (!v13) v14 = es_match(a0, v5 + 1, 0x3d); if (v14 || v13) { v14 = find_closing_delim(a0, v5 + 2, *((v6 + v5 + 1)), &v4); if (v14) { *(&v7) = *(&v4) - v5 - 2; v8 = v6 + v5 + 2; if (!*(&v7)) { if (*((v6 + v5 + 1)) == 58) error(0x0, 0x0, gettext("missing character class name '[::]'")); else error(0x0, 0x0, gettext("missing equivalence class character '[==]'")); v14 = 0; break; } else if (*((v6 + v5 + 1)) == 58) { *(&v14) = append_char_class(a1, v8, *(&v7)) ^ 1; v14 = star_digits_closebracket(a0, v5 + 2); if (!v14) { v10 = make_printable_str(v8, *(&v7)); v15 = quote(v10); error(0x0, 0x0, gettext("invalid character class %s")); free(v10); v14 = 0; break; } } else { *(&v14) = append_equiv_class(a1, v8, *(&v7)) ^ 1; v14 = star_digits_closebracket(a0, v5 + 2); if (!v14) { v9 = make_printable_str(v8, *(&v7)); error(0x0, 0x0, gettext("%s: equivalence class operand must be a single " "character")); free(v9); v14 = 0; break; } } } } if (!v14 || !v14 && !v13 || *((v6 + v5 + 1)) == 58 && *(&v7) && v14 || *(&v7) && *((v6 + v5 + 1)) != 58 && v14) { v2 = find_bracketed_repeat(a0, v5 + 1, &v0, &v4, &v3); if (!v2) { append_repeated_char(a1, v0, *(&v4)); v5 = *(&v3) + 1; } else if (v2 != -1) { v14 = 0; break; } if (v2 == -1) v1 = 0; } } if (false) { v5 = *(&v4) + 2; continue; } if (...) continue; if (...) { v14 = es_match(a0, v5 + 1, 0x2d); if (v14) { *(&v14) = append_range(a1, *((v5 + v6)), *((v6 + v5 + 2))) ^ 1; if (v14) { v14 = 0; break; } else { v5 += 3; } } else { append_normal_char(a1, *((v5 + v6))); v5 += 1; } } } else { for (v5 = 0; v5 < a0[2]; v5 += 1) { append_normal_char(a1, *((v5 + v6))); } v14 = 1; break; } } return v14; }
coreutils
angr_dream
_Bool force_breaks(struct deppossi *possi) { return in_force(FORCE_BREAKS) || ignore_depends_possi(possi) || ignore_depends(possi->up->up); }
undefined4 force_breaks(undefined8 *param_1) { char cVar1; cVar1 = in_force(0x10); if (((cVar1 == '\0') && (cVar1 = ignore_depends_possi(param_1), cVar1 == '\0')) && (cVar1 = ignore_depends(*(undefined8 *)*param_1), cVar1 == '\0')) { return 0; } return 1; }
dpkg
ghidra
char *kex_names_cat(const char *a, const char *b) { char *ret = ((void *)0), *tmp = ((void *)0), *cp, *p, *m; size_t len; if (a == ((void *)0) || *a == '\0') return strdup(b); if (b == ((void *)0) || *b == '\0') return strdup(a); if (strlen(b) > 1024 * 1024) return ((void *)0); len = strlen(a) + strlen(b) + 2; if ((tmp = cp = strdup(b)) == ((void *)0) || (ret = calloc(1, len)) == ((void *)0)) { free(tmp); return ((void *)0); } strlcpy(ret, a, len); for ((p = strsep(&cp, ",")); p && *p != '\0'; (p = strsep(&cp, ","))) { if ((m = match_list(ret, p, ((void *)0))) != ((void *)0)) { free(m); continue; } if (strlcat(ret, ",", len) >= len || strlcat(ret, p, len) >= len) { free(tmp); free(ret); return ((void *)0); } } free(tmp); return ret; }
int kex_names_cat(char *a0, char *a1) { void *v0; char *v1; void *v2; void *v3; unsigned long v4; void *v5; unsigned int v7; v2 = 0; v3 = 0; if (!a0) { LABEL_400306: v7 = strdup(a1); } else { if (!*(a0)) goto LABEL_400306; if (!a1) { LABEL_400329: v7 = strdup(a0); } else { if (!*(a1)) goto LABEL_400329; if (strlen(a1) > 0x100000) { v7 = 0; } else { v4 = strlen(a1) + strlen(a0) + 2; v0 = strdup(a1); v3 = v0; if (!v3) { LABEL_4003b9: free(v3); v7 = 0; } else { v2 = calloc(0x1, v4); if (!v2) goto LABEL_4003b9; strlcpy(v2, a0, v4, a0); v1 = strsep(&v0, ","); while (true) { if (!v1) { LABEL_4004b9: free(v3); v7 = v2; break; } else { if (!*(v1)) goto LABEL_4004b9; v5 = match_list(v2, v1, 0x0, v1); if (v5) { free(v5); } else if (v4 <= strlcat(v2, ",", v4)) { LABEL_40046d: free(v3); free(v2); v7 = 0; break; } else if (v4 <= strlcat(v2, v1, v4)) { goto LABEL_40046d; } v1 = strsep(&v0, ","); } } } } } } return v7; }
openssh-portable
angr_phoenix
u_int sshkey_curve_nid_to_bits(int nid) { switch (nid) { case 415: return 256; case 715: return 384; case 716: return 521; default: return 0; } }
int sshkey_curve_nid_to_bits(unsigned long a0) { unsigned int v1; if (a0 == 716) { v1 = 521; } else { if (a0 <= 716) { if (a0 == 415) { v1 = 0x100; goto LABEL_4009cb; } if (a0 == 715) { v1 = 384; goto LABEL_4009cb; } } v1 = 0; } LABEL_4009cb: return v1; }
openssh-portable
angr_phoenix
int updateavailable(const char *const *argv) { const char *sourcefile = argv[0]; char *availfile; int count = 0; modstatdb_init(); switch (cipaction->arg_int) { case act_avclear: if (sourcefile) badusage(gettext("--%s takes no arguments"), cipaction->olong); break; case act_avreplace: case act_avmerge: if (sourcefile == ((void *)0)) sourcefile = "-"; else if (argv[1]) badusage(gettext("--%s takes at most one Packages-file argument"), cipaction->olong); break; default: do_internerr("update.c", 58, __func__, "unknown action '%d'", cipaction->arg_int); } if (!f_noact) { const char *dbdir = dpkg_db_get_dir(); if (access(dbdir, 2)) { if ((*__errno_location()) != 13) ohshite(gettext("unable to access dpkg database directory '%s' for " "bulk available update"), dbdir); else ohshit(gettext("required write access to dpkg database directory '%s' " "for bulk available update"), dbdir); } modstatdb_lock(); } switch (cipaction->arg_int) { case act_avreplace: printf(gettext("Replacing available packages info, using %s.\n"), sourcefile); break; case act_avmerge: printf(gettext("Updating available packages info, using %s.\n"), sourcefile); break; case act_avclear: break; default: do_internerr("update.c", 85, __func__, "unknown action '%d'", cipaction->arg_int); } availfile = dpkg_db_get_path("available"); if (cipaction->arg_int == act_avmerge) parsedb(availfile, pdb_parse_available, ((void *)0)); if (cipaction->arg_int != act_avclear) count += parsedb(sourcefile, pdb_parse_available | pdb_ignoreolder | pdb_dash_is_stdin, ((void *)0)); if (!f_noact) { writedb(availfile, wdb_dump_available); modstatdb_unlock(); } free(availfile); if (cipaction->arg_int != act_avclear) printf(ngettext("Information about %d package was updated.\n", "Information about %d packages was updated.\n", count), count); modstatdb_done(); return 0; }
long long updateavailable(unsigned long long a0[2], unsigned long a1, char *a2, unsigned long long a3, unsigned long long a4, unsigned long long a5) { unsigned int v0; unsigned long long v1; char *v2; void *v3; unsigned long long v6; unsigned long long v7; v1 = a0[0]; v0 = 0; modstatdb_init(); if (*((cipaction + 40)) == 40) { if (!v1) goto LABEL_4000f6; badusage(gettext("--%s takes no arguments"), *(cipaction)); } else { if (*((cipaction + 40)) < 40) goto LABEL_4000c5; if (!(*((cipaction + 40)) - 41 <= 1)) goto LABEL_4000c5; } if (!v1) { v1 = "-"; } else if (a0[1]) { badusage(gettext("--%s takes at most one Packages-file argument"), *(cipaction)); LABEL_4000c5: do_internerr("update.c", 0x3a, "updateavailable", "unknown action '%d'", *((cipaction + 40))); LABEL_4000f6: } if (!f_noact) { v2 = dpkg_db_get_dir(); if (access(v2, 0x2)) { if (*(__errno_location()) != 13) { v6 = gettext("unable to access dpkg database directory '%s' for bulk " "available update"); ohshite(v6, v2, v6); } v7 = gettext("required write access to dpkg database directory '%s' for " "bulk available update"); ohshit(v7, v2, v7); } modstatdb_lock(); } if (*((cipaction + 40)) == 42) { a2 = gettext("Updating available packages info, using %s.\n"); printf(a2); } else { if (*((cipaction + 40)) <= 42) { if (*((cipaction + 40)) == 40) goto LABEL_400216; if (*((cipaction + 40)) == 41) { a2 = gettext("Replacing available packages info, using %s.\n"); printf(a2); goto LABEL_400217; } } do_internerr("update.c", 0x55, "updateavailable", "unknown action '%d'", *((cipaction + 40))); LABEL_400216: } LABEL_400217: v3 = dpkg_db_get_path("available"); if (*((cipaction + 40)) == 42) parsedb(v3, 0x246, 0x0); if (*((cipaction + 40)) != 40) v0 += parsedb(v1, 0x366, 0x0); if (!f_noact) { writedb(v3, 0x1); modstatdb_unlock(a0, 0x1, a2, a3, a4, a5); } free(v3); if (*((cipaction + 40)) != 40) printf(ngettext("Information about %d package was updated.\n", "Information about %d packages was updated.\n", v0)); modstatdb_done(); return 0; }
dpkg
angr_phoenix
int ssh_ecdsa_sk_verify(const struct sshkey *key, const u_char *signature, size_t signaturelen, const u_char *data, size_t datalen, u_int compat, struct sshkey_sig_details **detailsp) { ECDSA_SIG *sig = ((void *)0); BIGNUM *sig_r = ((void *)0), *sig_s = ((void *)0); u_char sig_flags; u_char msghash[32], apphash[32], sighash[32]; u_int sig_counter; int is_webauthn = 0, ret = -1; struct sshbuf *b = ((void *)0), *sigbuf = ((void *)0), *original_signed = ((void *)0); struct sshbuf *webauthn_wrapper = ((void *)0), *webauthn_exts = ((void *)0); char *ktype = ((void *)0), *webauthn_origin = ((void *)0); struct sshkey_sig_details *details = ((void *)0); if (detailsp != ((void *)0)) *detailsp = ((void *)0); if (key == ((void *)0) || key->ecdsa == ((void *)0) || sshkey_type_plain(key->type) != KEY_ECDSA_SK || signature == ((void *)0) || signaturelen == 0) return -10; if (key->ecdsa_nid != 415) return -1; if ((b = sshbuf_from(signature, signaturelen)) == ((void *)0)) return -2; if ((details = calloc(1, sizeof(*details))) == ((void *)0)) { ret = -2; goto out; } if (sshbuf_get_cstring(b, &ktype, ((void *)0)) != 0) { ret = -4; goto out; } if (strcmp(ktype, "webauthn-sk-ecdsa-sha2-nistp256@openssh.com") == 0) is_webauthn = 1; else if (strcmp(ktype, "sk-ecdsa-sha2-nistp256@openssh.com") != 0) { ret = -4; goto out; } if (sshbuf_froms(b, &sigbuf) != 0 || sshbuf_get_u8(b, &sig_flags) != 0 || sshbuf_get_u32(b, &sig_counter) != 0) { ret = -4; goto out; } if (is_webauthn) { if (sshbuf_get_cstring(b, &webauthn_origin, ((void *)0)) != 0 || sshbuf_froms(b, &webauthn_wrapper) != 0 || sshbuf_froms(b, &webauthn_exts) != 0) { ret = -4; goto out; } } if (sshbuf_len(b) != 0) { ret = -23; goto out; } if (sshbuf_get_bignum2(sigbuf, &sig_r) != 0 || sshbuf_get_bignum2(sigbuf, &sig_s) != 0) { ret = -4; goto out; } if (sshbuf_len(sigbuf) != 0) { ret = -23; goto out; } if ((sig = ECDSA_SIG_new()) == ((void *)0)) { ret = -2; goto out; } if (!ECDSA_SIG_set0(sig, sig_r, sig_s)) { ret = -22; goto out; } sig_r = sig_s = ((void *)0); if ((original_signed = sshbuf_new()) == ((void *)0)) { ret = -2; goto out; } if (is_webauthn) { if ((ret = webauthn_check_prepare_hash( data, datalen, webauthn_origin, webauthn_wrapper, sig_flags, webauthn_exts, msghash, sizeof(msghash))) != 0) goto out; } else if ((ret = ssh_digest_memory(2, data, datalen, msghash, sizeof(msghash))) != 0) goto out; if ((ret = ssh_digest_memory(2, key->sk_application, strlen(key->sk_application), apphash, sizeof(apphash))) != 0) goto out; if ((ret = sshbuf_put(original_signed, apphash, sizeof(apphash))) != 0 || (ret = sshbuf_put_u8(original_signed, sig_flags)) != 0 || (ret = sshbuf_put_u32(original_signed, sig_counter)) != 0 || (ret = sshbuf_putb(original_signed, webauthn_exts)) != 0 || (ret = sshbuf_put(original_signed, msghash, sizeof(msghash))) != 0) goto out; if ((ret = ssh_digest_buffer(2, original_signed, sighash, sizeof(sighash))) != 0) goto out; details->sk_counter = sig_counter; details->sk_flags = sig_flags; switch (ECDSA_do_verify(sighash, sizeof(sighash), sig, key->ecdsa)) { case 1: ret = 0; break; case 0: ret = -21; goto out; default: ret = -22; goto out; } if (detailsp != ((void *)0)) { *detailsp = details; details = ((void *)0); } out: explicit_bzero(&sig_flags, sizeof(sig_flags)); explicit_bzero(&sig_counter, sizeof(sig_counter)); explicit_bzero(msghash, sizeof(msghash)); explicit_bzero(sighash, sizeof(msghash)); explicit_bzero(apphash, sizeof(apphash)); sshkey_sig_details_free(details); sshbuf_free(webauthn_wrapper); sshbuf_free(webauthn_exts); free(webauthn_origin); sshbuf_free(original_signed); sshbuf_free(sigbuf); sshbuf_free(b); ECDSA_SIG_free(sig); BN_clear_free(sig_r); BN_clear_free(sig_s); free(ktype); return ret; }
long ssh_ecdsa_sk_verify(unsigned int *a1, long a2, long a3, long a4, long a5, long a6, _QWORD *a7) { size_t v8; int v9; unsigned char v13; unsigned int v14; int v15; unsigned int v16; long v17; long v18; long v19; long v20; long v21; char *s1; void *ptr; long v24; long v25; _BYTE *v26; long v27; char v28[32]; char v29[32]; char v30[40]; unsigned long v31; v31 = __readfsqword(0x28u); v24 = 0LL; v17 = 0LL; v18 = 0LL; v15 = 0; v16 = -1; v27 = 0LL; v19 = 0LL; v25 = 0LL; v20 = 0LL; v21 = 0LL; s1 = 0LL; ptr = 0LL; v26 = 0LL; if (a7) *a7 = 0LL; if (!a1 || !*((_QWORD *)a1 + 4) || (unsigned int)sshkey_type_plain(*a1) != 10 || !a2 || !a3) return 4294967286LL; if (a1[6] != 415) return 0xFFFFFFFFLL; v27 = sshbuf_from(a2, a3); if (!v27) return 4294967294LL; v26 = calloc(1uLL, 8uLL); if (v26) { if ((unsigned int)sshbuf_get_cstring(v27, &s1, 0LL)) { v16 = -4; } else { if (!strcmp(s1, "webauthn-sk-ecdsa-sha2-nistp256@openssh.com")) { v15 = 1; } else if (strcmp(s1, "sk-ecdsa-sha2-nistp256@openssh.com")) { v16 = -4; goto LABEL_60; } if ((unsigned int)sshbuf_froms(v27, &v19) || (unsigned int)sshbuf_get_u8(v27, &v13) || (unsigned int)sshbuf_get_u32(v27, &v14)) { v16 = -4; } else if (v15 && ((unsigned int)sshbuf_get_cstring(v27, &ptr, 0LL) || (unsigned int)sshbuf_froms(v27, &v20) || (unsigned int)sshbuf_froms(v27, &v21))) { v16 = -4; } else if (sshbuf_len(v27)) { v16 = -23; } else if ((unsigned int)sshbuf_get_bignum2(v19, &v17) || (unsigned int)sshbuf_get_bignum2(v19, &v18)) { v16 = -4; } else if (sshbuf_len(v19)) { v16 = -23; } else { v24 = ECDSA_SIG_new(); if (v24) { if ((unsigned int)ECDSA_SIG_set0(v24, v17, v18)) { v18 = 0LL; v17 = 0LL; v25 = sshbuf_new(); if (v25) { if (v15) { v16 = webauthn_check_prepare_hash( a4, a5, (const char *)ptr, v20, v13, v21, (long)v28, 32LL); if (v16) goto LABEL_60; } else { v16 = ssh_digest_memory(2LL, a4, a5, v28, 32LL); if (v16) goto LABEL_60; } v8 = strlen(*((const char **)a1 + 12)); v16 = ssh_digest_memory(2LL, *((_QWORD *)a1 + 12), v8, v29, 32LL); if (!v16) { v16 = sshbuf_put(v25, v29, 32LL); if (!v16) { v16 = sshbuf_put_u8(v25, v13); if (!v16) { v16 = sshbuf_put_u32(v25, v14); if (!v16) { v16 = sshbuf_putb(v25, v21); if (!v16) { v16 = sshbuf_put(v25, v28, 32LL); if (!v16) { v16 = ssh_digest_buffer(2LL, v25, v30, 32LL); if (!v16) { *(_DWORD *)v26 = v14; v26[4] = v13; v9 = ECDSA_do_verify(v30, 32LL, v24, *((_QWORD *)a1 + 4)); if (v9) { if (v9 == 1) { v16 = 0; if (a7) { *a7 = v26; v26 = 0LL; } } else { v16 = -22; } } else { v16 = -21; } } } } } } } } goto LABEL_60; } v16 = -2; } else { v16 = -22; } } else { v16 = -2; } } } } else { v16 = -2; } LABEL_60: explicit_bzero(&v13, 1LL); explicit_bzero(&v14, 4LL); explicit_bzero(v28, 32LL); explicit_bzero(v30, 32LL); explicit_bzero(v29, 32LL); sshkey_sig_details_free(v26); sshbuf_free(v20); sshbuf_free(v21); free(ptr); sshbuf_free(v25); sshbuf_free(v19); sshbuf_free(v27); ECDSA_SIG_free(v24); BN_clear_free(v17); BN_clear_free(v18); free(s1); return v16; }
openssh-portable
ida
int sshpkt_put_u64(struct ssh *ssh, u_int64_t val) { return sshbuf_put_u64(ssh->state->outgoing_packet, val); }
void sshpkt_put_u64(long *param_1, undefined8 param_2) { sshbuf_put_u64(*(undefined8 *)(*param_1 + 0x30), param_2); return; }
openssh-portable
ghidra
static uintmax_t string_to_integer(_Bool count_lines, char const *n_string) { return xdectoumax(n_string, 0, (18446744073709551615UL), "bkKmMGTPEZY0", count_lines ? gettext("invalid number of lines") : gettext("invalid number of bytes"), 0); }
long string_to_integer(char a1, long a2) { char *v2; if (a1) v2 = gettext("invalid number of lines"); else v2 = gettext("invalid number of bytes"); return xdectoumax(a2, 0LL, -1LL, "bkKmMGTPEZY0", v2, 0LL); }
coreutils
ida
static int optc_to_fileno(int c) { int ret = -1; switch (c) { case 'e': ret = 2; break; case 'i': ret = 0; break; case 'o': ret = 1; break; } return ret; }
int optc_to_fileno(unsigned long a0) { unsigned int v0; v0 = -1; if (a0 == 111) { v0 = 1; } else if (a0 <= 111) { if (a0 == 101) { v0 = 2; } else if (a0 == 105) { v0 = 0; } } return v0; }
coreutils
angr_phoenix
void show_success_rates(const struct predicate *p) { if (options.debug_options & DebugSuccessRates) { fprintf(stderr, "Predicate success rates after completion:\n"); print_optlist(stderr, p); fprintf(stderr, "\n"); } }
long long show_success_rates(void *a0) { unsigned long long v1; v1 = closedir & 64; if ((closedir & 64)) { fprintf(stderr, "Predicate success rates after completion:\n"); print_optlist(stderr, a0); v1 = fprintf(stderr, "\n"); } return v1; }
findutils
angr_phoenix
static void print_rt_pref(FILE *fp, unsigned int pref) { switch (pref) { case 0x3: print_string(PRINT_ANY, "pref", "pref %s", "low"); break; case 0x0: print_string(PRINT_ANY, "pref", "pref %s", "medium"); break; case 0x1: print_string(PRINT_ANY, "pref", "pref %s", "high"); break; default: print_uint(PRINT_ANY, "pref", "%u", pref); } }
long print_rt_pref(long a1, unsigned int a2) { if (a2 == 3) return print_string(4u, (long)"pref", "pref %s", (long)"low"); if (a2 > 3) return print_uint(4u, (long)"pref", (long)"%u", a2); if (!a2) return print_string(4u, (long)"pref", "pref %s", (long)"medium"); if (a2 == 1) return print_string(4u, (long)"pref", "pref %s", (long)"high"); else return print_uint(4u, (long)"pref", (long)"%u", a2); }
iproute2-6.0.0
ida
static void setup_tty(void) { struct termios termio; if (tcgetattr(0, &termio) == 0) { int erasechar; int killchar; termio.c_lflag |= 0000001 | 0000002 | 0000010 | 0000020; termio.c_iflag |= 0000400; termio.c_lflag |= 0004000 | 0001000; termio.c_lflag &= ~(0002000 | 0000200 | 0000400); termio.c_oflag |= 0000004; erasechar = getdef_num("ERASECHAR", (int)termio.c_cc[2]); killchar = getdef_num("KILLCHAR", (int)termio.c_cc[3]); termio.c_cc[2] = (cc_t)erasechar; termio.c_cc[3] = (cc_t)killchar; if (erasechar != (int)termio.c_cc[2]) { fprintf(stderr, gettext("configuration error - cannot parse %s value: '%d'"), "ERASECHAR", erasechar); exit(1); } if (killchar != (int)termio.c_cc[3]) { fprintf(stderr, gettext("configuration error - cannot parse %s value: '%d'"), "KILLCHAR", killchar); exit(1); } (void)tcsetattr(0, 0, &termio); } }
void setup_tty() { int tmp_49; int tmp_58; int tmp_62; unsigned int v0; unsigned int v1; char v2; unsigned int v3; unsigned int v4; char v5; char v6; char v7; unsigned long long v9; unsigned long long v10; unsigned long long *v11; unsigned long long v12; if (!tcgetattr(0x0, &v2)) { v4 = *(&v4) | 27; v9 = *(&v2); *(&v9) = (*(&v2) >> 8) | 1; tmp_49 = v9; v2 = tmp_49; v10 = v4; *(&v10) = (v4 >> 8) | 10; tmp_58 = v10; v4 = tmp_58; tmp_62 = v4; v4 = tmp_62 & -1409; v3 = *(&v3) | 4; v0 = getdef_num("ERASECHAR", v5); v1 = getdef_num("KILLCHAR", v6); v5 = v0; v6 = v1; if (v0 != v5) { fprintf(*(&stderr), gettext("configuration error - cannot parse %s value: '%d'")); exit(0x1); } else if (v1 == v6) { tcsetattr(0x0, 0x0, &v2); } else { fprintf(*(&stderr), gettext("configuration error - cannot parse %s value: '%d'")); exit(0x1); } } v12 = *(&v7) ^ v11[5]; return; }
shadow
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; }
long sync_arg(unsigned int a1, const char *a2) { long v2; char *v3; long v5; char *v6; int *v7; long v8; char *v9; int *v10; long v11; char *v12; int *v13; unsigned char v14; int fildes; int v16; int errnum; v14 = 1; fildes = open(a2, 2048); if (fildes >= 0 || (errnum = *_errno_location(), fildes = open(a2, 2049), fildes >= 0)) { if ((unsigned int)rpl_fcntl((unsigned int)fildes, 3LL) == -1 || (int)rpl_fcntl((unsigned int)fildes, 4LL) < 0) { v5 = quotearg_style(4LL, a2); v6 = gettext("couldn't reset non-blocking mode %s"); v7 = _errno_location(); error(0, *v7, v6, v5); v14 = 0; } if (v14) { v16 = -1; if (a1 == 2) { v16 = syncfs(fildes); } else if (a1 <= 2) { if (a1) v16 = fdatasync(fildes); else v16 = fsync(fildes); } if (v16 < 0) { v8 = quotearg_style(4LL, a2); v9 = gettext("error syncing %s"); v10 = _errno_location(); error(0, *v10, v9, v8); v14 = 0; } } if (close(fildes) < 0) { v11 = quotearg_style(4LL, a2); v12 = gettext("failed to close %s"); v13 = _errno_location(); error(0, *v13, v12, v11); return 0; } return v14; } else { v2 = quotearg_style(4LL, a2); v3 = gettext("error opening %s"); error(0, errnum, v3, v2); return 0LL; } }
coreutils
ida
static void sigterm_handler(int sig) { received_sigterm = sig; }
long sigterm_handler(int a1) { long result; result = (unsigned int)a1; received_sigterm = a1; return result; }
openssh-portable
ida
static _Bool errno_may_be_non_empty(int error_number) { switch (error_number) { case 13: case 1: case 30: case 16: return 1; default: return 0; } }
int errno_may_be_non_empty(unsigned long a0) { unsigned int v1; if (30 < a0) { v1 = 0; return v1; } else if (!((1 << (a0 & 63)) & 1073815554)) { v1 = 0; return v1; } else { v1 = 1; return v1; } }
coreutils
angr_sailr
region_t region_create(region_addr_t min, region_addr_t max) { region_t region; errcode_t retval; retval = ext2fs_get_memzero(sizeof(struct region_struct), &region); if (retval) return ((void *)0); region->min = min; region->max = max; region->last = ((void *)0); return region; }
long long region_create(unsigned long a0, unsigned long a1) { unsigned long long v0; unsigned long v1; unsigned long long v3; v1 = ext2fs_get_memzero(0x20, &v0); if (v1) { v3 = 0; return v3; } *(v0) = a0; *((v0 + 8)) = a1; *((v0 + 24)) = 0; v3 = v0; return v3; }
e2fsprogs-1.46.5
angr_sailr
void load_hostkeys_file(struct hostkeys *hostkeys, const char *host, const char *path, FILE *f, u_int note) { int r; struct load_callback_ctx ctx; ctx.host = host; ctx.num_loaded = 0; ctx.hostkeys = hostkeys; if ((r = hostkeys_foreach_file(path, f, record_hostkey, &ctx, host, ((void *)0), (1) | (1 << 1), note)) != 0) { if (r != -24 && (*__errno_location()) != 2) sshlog("hostfile.c", __func__, 279, 1, SYSLOG_LEVEL_DEBUG1, ssh_err(r), "hostkeys_foreach failed for %s", path); } if (ctx.num_loaded != 0) sshlog("hostfile.c", __func__, 282, 1, SYSLOG_LEVEL_DEBUG3, ((void *)0), "loaded %lu keys from %s", ctx.num_loaded, host); }
void load_hostkeys_file(undefined8 param_1, undefined8 param_2, ulong param_3, undefined8 param_4, uint param_5) { int iVar1; int *piVar2; undefined8 uVar3; long in_FS_OFFSET; ulong uVar4; undefined8 local_28; long local_20; undefined8 local_18; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); local_20 = 0; uVar4 = (ulong)param_5; local_28 = param_2; local_18 = param_1; iVar1 = hostkeys_foreach_file(param_3, param_4, record_hostkey, &local_28, param_2, 0, 3, uVar4); if ((iVar1 != 0) && (iVar1 != -0x18)) { uVar4 = 0x100aec; piVar2 = __errno_location(); if (*piVar2 != 2) { uVar3 = ssh_err(iVar1); sshlog("hostfile.c", "load_hostkeys_file", 0x117, 1, 5, uVar3, "hostkeys_foreach failed for %s", param_3); uVar4 = param_3; } } if (local_20 != 0) { sshlog("hostfile.c", "load_hostkeys_file", 0x11a, 1, 7, 0, "loaded %lu keys from %s", local_20, param_2, uVar4); } if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) { __stack_chk_fail(); } return; }
openssh-portable
ghidra
static void dump_cfg_int(OpCodes code, int val) { printf("%s %d\n", lookup_opcode_name(code), val); }
void dump_cfg_int(undefined4 param_1, uint param_2) { undefined8 uVar1; uVar1 = lookup_opcode_name(param_1); printf("%s %d\n", uVar1, (ulong)param_2); return; }
openssh-portable
ghidra
static int authmethod_is_enabled(Authmethod *method) { if (method == ((void *)0)) return 0; if (method->enabled == ((void *)0) || *method->enabled == 0) return 0; if (method->batch_flag != ((void *)0) && *method->batch_flag != 0) return 0; return 1; }
_BOOL8 authmethod_is_enabled(long a1) { if (!a1) return 0LL; if (!*(_QWORD *)(a1 + 24) || !**(_DWORD **)(a1 + 24)) return 0LL; return !*(_QWORD *)(a1 + 32) || !**(_DWORD **)(a1 + 32); }
openssh-portable
ida
void sh_invalidid(s) char *s; { builtin_error(gettext("`%s': not a valid identifier"), s); }
void sh_invalidid(unsigned long a0) { unsigned long v0; unsigned long long v2; v0 = a0; gettext("`%s': not a valid identifier"); v2 = builtin_error(); return; }
bash
angr_dream
char *redirection_expand(word) WORD_DESC *word; { char *result; WORD_LIST *tlist1, *tlist2; WORD_DESC *w; int old; w = copy_word(word); if (posixly_correct) w->flags |= (1 << 4); tlist1 = make_word_list(w, (WORD_LIST *)((void *)0)); expanding_redir = 1; sv_ifs("IFS"); tlist2 = expand_words_no_vars(tlist1); expanding_redir = 0; old = executing_builtin; executing_builtin = 1; sv_ifs("IFS"); executing_builtin = old; dispose_words(tlist1); if (tlist2 == 0 || tlist2->next) { if (tlist2) dispose_words(tlist2); return ((char *)((void *)0)); } result = string_list(tlist2); dispose_words(tlist2); return (result); }
long redirection_expand(long a1) { int v2; long v3; long word_list; _QWORD *v5; long v6; v3 = copy_word(a1); if (posixly_correct) *(_DWORD *)(v3 + 8) |= 0x10u; word_list = make_word_list(v3, 0LL); expanding_redir = 1; sv_ifs(&unk_28FC); v5 = (_QWORD *)expand_words_no_vars(word_list); expanding_redir = 0; v2 = executing_builtin; executing_builtin = 1; sv_ifs(&unk_28FC); executing_builtin = v2; dispose_words(word_list); if (v5 && !*v5) { v6 = string_list(v5); dispose_words(v5); return v6; } else { if (v5) dispose_words(v5); return 0LL; } }
bash
ida
int sshkey_to_certified(struct sshkey *k) { int newtype; switch (k->type) { case KEY_RSA: newtype = KEY_RSA_CERT; break; case KEY_DSA: newtype = KEY_DSA_CERT; break; case KEY_ECDSA: newtype = KEY_ECDSA_CERT; break; case KEY_ECDSA_SK: newtype = KEY_ECDSA_SK_CERT; break; case KEY_ED25519_SK: newtype = KEY_ED25519_SK_CERT; break; case KEY_ED25519: newtype = KEY_ED25519_CERT; break; default: return -10; } if ((k->cert = cert_new()) == ((void *)0)) return -2; k->type = newtype; return 0; }
undefined8 sshkey_to_certified(undefined4 *param_1) { undefined8 uVar1; undefined4 local_c; switch (*param_1) { case 0: local_c = 4; break; case 1: local_c = 5; break; case 2: local_c = 6; break; case 3: local_c = 7; break; default: return 0xfffffff6; case 10: local_c = 0xb; break; case 0xc: local_c = 0xd; } uVar1 = cert_new(); *(undefined8 *)(param_1 + 0x20) = uVar1; if (*(long *)(param_1 + 0x20) == 0) { uVar1 = 0xfffffffe; } else { *param_1 = local_c; uVar1 = 0; } return uVar1; }
openssh-portable
ghidra
static void ip6tunnel_print_help(struct link_util *lu, int argc, char **argv, FILE *f) { fprintf(f, "Usage: ... %-6s [ remote ADDR ]\n" " [ local ADDR ]\n" " [ encaplimit ELIM ]\n" " [ hoplimit HLIM ]\n" " [ tclass TCLASS ]\n" " [ flowlabel FLOWLABEL ]\n" " [ dscp inherit ]\n" " [ [no]allow-localremote ]\n" " [ dev PHYS_DEV ]\n" " [ fwmark MARK ]\n" " [ external ]\n" " [ noencap ]\n" " [ encap { fou | gue | none } ]\n" " [ encap-sport PORT ]\n" " [ encap-dport PORT ]\n" " [ [no]encap-csum ]\n" " [ [no]encap-csum6 ]\n" " [ [no]encap-remcsum ]\n" " [ mode { ip6ip6 | ipip6 | any } ]\n" "\n" "Where: ADDR := IPV6_ADDRESS\n" " ELIM := { none | 0..255 }(default=%d)\n" " HLIM := 0..255 (default=%d)\n" " TCLASS := { 0x0..0xff | inherit }\n" " FLOWLABEL := { 0x0..0xfffff | inherit }\n" " MARK := { 0x0..0xffffffff | inherit }\n", lu->id, 4, (64)); }
void ip6tunnel_print_help(struct_0 *a0, unsigned long a1, unsigned long a2, void *a3) { unsigned long v0; unsigned int v1; unsigned long long v3; v1 = a1; v0 = a2; v3 = fprintf( a3, "Usage: ... %-6s\t[ remote ADDR ]\n\t\t\t[ local ADDR ]\n\t\t\t[ " "encaplimit ELIM ]\n\t\t\t[ hoplimit HLIM ]\n\t\t\t[ tclass TCLASS " "]\n\t\t\t[ flowlabel FLOWLABEL ]\n\t\t\t[ dscp inherit ]\n\t\t\t[ " "[no]allow-localremote ]\n\t\t\t[ dev PHYS_DEV ]\n\t\t\t[ fwmark MARK " "]\n\t\t\t[ external ]\n\t\t\t[ noencap ]\n\t\t\t[ encap { fou | gue | " "none } ]\n\t\t\t[ encap-sport PORT ]\n\t\t\t[ encap-dport PORT " "]\n\t\t\t[ [no]encap-csum ]\n\t\t\t[ [no]encap-csum6 ]\n\t\t\t[ " "[no]encap-remcsum ]\n\t\t\t[ mode { ip6ip6 | ipip6 | any } " "]\n\nWhere:\tADDR\t := IPV6_ADDRESS\n\tELIM\t := { none | 0..255 " "}(default=%d)\n\tHLIM\t := 0..255 (default=%d)\n\tTCLASS := { " "0x0..0xff | inherit }\n\tFLOWLABEL := { 0x0..0xfffff | inherit " "}\n\tMARK\t := { 0x0..0xffffffff | inherit }\n", a0->field_8, 4); return; }
iproute2-6.0.0
angr_dream
static void passname(unsigned char const *data, char name[7]) { if (data) sprintf(name, "%02x%02x%02x", data[0], data[1], data[2]); else memcpy(name, "random", 7); }
int passname(unsigned char *a1, char *a2) { if (a1) return sprintf(a2, "%02x%02x%02x", *a1, a1[1], a1[2]); else return (unsigned int)memcpy(a2, "random", 7uLL); }
coreutils
ida
int mm_answer_term(struct ssh *ssh, int sock, struct sshbuf *req) { int res, status; sshlog("monitor.c", __func__, 1639, 1, SYSLOG_LEVEL_DEBUG3, ((void *)0), "tearing down sessions"); session_destroy_all(ssh, &mm_session_close); while (waitpid(pmonitor->m_pid, &status, 0) == -1) if ((*__errno_location()) != 4) exit(1); res = (((status) & 0x7f) == 0) ? (((status) & 0xff00) >> 8) : 1; exit(res); }
long long mm_answer_term(unsigned long long a0, unsigned long a1) { unsigned long long v0; unsigned long v1; unsigned int v2; char v3; unsigned int v4; unsigned long v5; unsigned long v7; unsigned long long *v8; v2 = a1; v1 = v7; v5 = v8[5]; v0 = "tearing down sessions"; sshlog("monitor.c", "mm_answer_term", 0x667, 0x1, 0x7, 0x0); session_destroy_all(a0, mm_session_close); while (true) { if (waitpid(*((pmonitor + 24)), &v3, 0x0) != -1) { v4 = (!(*(&v3) & 127) ? 1 : (*(&v3) >> 8)); exit(v4); } else if (*(__errno_location()) != 4) { exit(0x1); } } }
openssh-portable
angr_sailr
void rl_check_signals(void) { do { if (_rl_caught_signal) _rl_signal_handler(_rl_caught_signal); } while (0); }
void rl_check_signals(void) { if (_rl_caught_signal != 0) { _rl_signal_handler(_rl_caught_signal); } return; }
bash
ghidra
static int nh_dump_bucket_filter(struct nlmsghdr *nlh, int reqlen) { struct rtattr *nest; int err = 0; err = nh_dump_filter(nlh, reqlen); if (err) return err; if (filter.id) { err = addattr32(nlh, reqlen, NHA_ID, filter.id); if (err) return err; } if (filter.nhid) { nest = addattr_nest(nlh, reqlen, NHA_RES_BUCKET); nest->rta_type |= (1 << 15); err = addattr32(nlh, reqlen, NHA_RES_BUCKET_NH_ID, filter.nhid); if (err) return err; addattr_nest_end(nlh, nest); } return err; }
long nh_dump_bucket_filter(long a1, unsigned int a2) { unsigned int v3; long v4; v3 = nh_dump_filter(a1, a2); if (v3) return v3; if (dword_3A18) { v3 = addattr32(a1, a2, 1LL, (unsigned int)dword_3A18); if (v3) return v3; } if (dword_3A1C) { v4 = addattr_nest(a1, a2, 13LL); *(_WORD *)(v4 + 2) |= 0x8000u; v3 = addattr32(a1, a2, 3LL, (unsigned int)dword_3A1C); if (v3) return v3; addattr_nest_end(a1, v4); } return v3; }
iproute2-6.0.0
ida
static int check_super_value64(e2fsck_t ctx, const char *descr, __u64 value, int flags, __u64 min_val, __u64 max_val) { struct problem_context pctx; if ((flags & 1 && value < min_val) || (flags & 2 && value > max_val) || (flags & 4 && (value & (value - 1)) != 0)) { clear_problem_context(&pctx); pctx.num = value; pctx.str = descr; fix_problem(ctx, 0x00000B, &pctx); ctx->flags |= 0x0001; return 0; } return 1; }
int check_super_value64(struct_0 *a0, unsigned long a1, unsigned long a2, unsigned long a3, unsigned long a4, unsigned long a5) { char v0; unsigned long v1; unsigned long v2; unsigned int v4; if ((!(a3 & 1) || a2 >= a4) && (!(a3 & 2) || a2 <= a5)) { if (!(a3 & 4)) { v4 = 1; return v4; } else if (!(a2 - 1 & a2)) { v4 = 1; return v4; } } clear_problem_context(&v0); v1 = a2; v2 = a1; fix_problem(a0, 0xb, &v0); a0->field_48 = a0->field_48 | 1; v4 = 0; return v4; }
e2fsprogs-1.46.5
angr_sailr
void evalbackcmd(union node *n, struct backcmd *result) { int pip[2]; struct job *jp; result->fd = -1; result->buf = ((void *)0); result->nleft = 0; result->jp = ((void *)0); if (n == ((void *)0)) { goto out; } if (pipe(pip) < 0) sh_error("Pipe call failed"); jp = makejob(n, 1); if (forkshell(jp, n, 2) == 0) { ({ ({ __asm__ __volatile__("" : : : "memory"); }); suppressint = 0; if (intpending) onint(); 0; }); close(pip[0]); if (pip[1] != 1) { dup2(pip[1], 1); close(pip[1]); } ifsfree(); evaltreenr(n, 01); } close(pip[1]); result->fd = pip[0]; result->jp = jp; out: ; }
unsigned long evalbackcmd(long a1, long a2) { long v3; int pipedes[2]; unsigned long v5; v5 = __readfsqword(0x28u); *(_DWORD *)a2 = -1; *(_QWORD *)(a2 + 8) = 0LL; *(_DWORD *)(a2 + 16) = 0; *(_QWORD *)(a2 + 24) = 0LL; if (a1) { if (pipe(pipedes) < 0) sh_error("Pipe call failed"); v3 = makejob(a1, 1LL); if (!(unsigned int)forkshell(v3, a1, 2LL)) { suppressint = 0; if (intpending) onint(); close(pipedes[0]); if (pipedes[1] != 1) { dup2(pipedes[1], 1); close(pipedes[1]); } ifsfree(); evaltreenr(a1, 1u); } close(pipedes[1]); *(_DWORD *)a2 = pipedes[0]; *(_QWORD *)(a2 + 24) = v3; } return __readfsqword(0x28u) ^ v5; }
dash-0.5.11+git20210903+057cd650a4ed
ida
static char *uid_to_str(uid_t uid) { 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)]; return xstrdup((!((uid_t)0 < (uid_t)-1)) ? imaxtostr(uid, buf) : umaxtostr(uid, buf)); }
int uid_to_str(unsigned long a0) { char v0; return xstrdup(umaxtostr(a0, &v0, &v0)); }
coreutils
angr_sailr
void dispose_partial_redirects() { if (redirection_undo_list) { dispose_redirects(redirection_undo_list); redirection_undo_list = (REDIRECT *)((void *)0); } }
long long dispose_partial_redirects() { unsigned long long v1; v1 = redirection_undo_list; if (redirection_undo_list) { v1 = dispose_redirects(redirection_undo_list); redirection_undo_list = 0; } return v1; }
bash
angr_phoenix
static void sigchld_handler(int x __attribute__((__unused__))) { got_sigchld = 1; }
void sigchld_handler() { got_sigchld = 1; }
cronie
ida
void do_authentication2(struct ssh *ssh) { Authctxt *authctxt = ssh->authctxt; ssh_dispatch_init(ssh, &dispatch_protocol_error); ssh_dispatch_set(ssh, 5, &input_service_request); ssh_dispatch_run_fatal(ssh, DISPATCH_BLOCK, &authctxt->success); ssh->authctxt = ((void *)0); }
long long do_authentication2(struct_0 *a0) { unsigned long long v0; v0 = a0->field_860; ssh_dispatch_init(a0, got.dispatch_protocol_error, got.dispatch_protocol_error); ssh_dispatch_set(a0, 0x5, input_service_request); ssh_dispatch_run_fatal(a0, 0x0, v0); a0->field_860 = 0; return a0; }
openssh-portable
angr_dream
size_t strlcat(char *dst, const char *src, size_t siz) { char *d = dst; const char *s = src; size_t n = siz; size_t dlen; while (n-- != 0 && *d != '\0') d++; dlen = d - dst; n = siz - dlen; if (n == 0) return (dlen + strlen(s)); while (*s != '\0') { if (n != 1) { *d++ = *s; n--; } s++; } *d = '\0'; return (dlen + (s - src)); }
long long strlcat(unsigned long long a0, char *a1, unsigned long long a2) { char *v0; char *v1; unsigned long v2; unsigned long v3; unsigned long long v5; char *v6; unsigned long long v7; v0 = a0; v1 = a1; v2 = a2; while (true) { v5 = v2; v2 -= 1; if (!(v5) || !(*(v0))) break; v0 += 1; } v3 = __subvdi3(v0, a0); if (!v2) { v7 = strlen(v1) + v3; return v7; } for (v2 = a2 - v3; *(v1); v1 += 1) { if (v2 != 1) { v6 = v0; v0 += 1; *(v6) = *(v1); v2 -= 1; } } *(v0) = 0; v7 = v3 + __subvdi3(v1, a1); return v7; }
openssh-portable
angr_sailr
int ssh_set_verify_host_key_callback(struct ssh *ssh, int (*cb)(struct sshkey *, struct ssh *)) { if (cb == ((void *)0) || ssh->kex == ((void *)0)) return -10; ssh->kex->verify_host_key = cb; return 0; }
long long ssh_set_verify_host_key_callback(struct_0 *a0, unsigned long a1) { unsigned long long v1; if (!a1) { v1 = 4294967286; return v1; } else if (!a0->field_8) { v1 = 4294967286; return v1; } else { a0->field_8->field_a0 = a1; v1 = 0; return v1; } }
openssh-portable
angr_sailr
void doformat(struct output *dest, const char *f, va_list ap) { struct stackmark smark; char *s; int len; int olen; setstackmark(&smark); s = dest->nextc; olen = dest->end - dest->nextc; len = xvasprintf(&s, olen, f, ap); if (__builtin_expect(!!(olen > len), 1)) { dest->nextc += len; goto out; } outmem(s, len, dest); out: popstackmark(&smark); }
void doformat(unsigned long long a0[2], unsigned long long a1, unsigned long long a2) { unsigned long long v0[2]; unsigned int v1; unsigned int v2; void *v3; char v4; char v5; unsigned long long *v7; unsigned long long v8; v0[0] = a0; setstackmark(&v4); v3 = a0[0]; v1 = a0[1] - a0[0]; v2 = xvasprintf(&v3, v1, a1, a2); if (v2 < v1) a0[0] = a0[0] + v2; else outmem(v3, v2, a0); popstackmark(&v4); v8 = *(&v5) ^ v7[5]; return; }
dash-0.5.11+git20210903+057cd650a4ed
angr_dream
static float estimate_pattern_match_rate(const char *pattern, int is_regex) { if (strpbrk(pattern, "*?[") || (is_regex && strpbrk(pattern, "."))) { return 0.8f; } else { return 0.1f; } }
void estimate_pattern_match_rate(char *a0, unsigned long a1) { unsigned long long v2; if (!strpbrk(a0, "*?[") && a1) v2 = strpbrk(a0, "."); return; }
findutils
angr_dream
void pad_archive(off_t size_left) { union block *blk; while (size_left > 0) { blk = find_next_block(); memset(blk->buffer, 0, 512); set_next_block_after(blk); size_left -= 512; } }
void pad_archive(unsigned long a0) { unsigned long v0; void *v1; unsigned long long v3; for (v0 = a0; v0 > 0; v0 -= 0x200) { v1 = find_next_block(); memset(v1, 0x0, 0x200); v3 = set_next_block_after(v1); } return; }
tar
angr_phoenix
static void send_statvfs(u_int32_t id, struct statvfs *st) { struct sshbuf *msg; u_int64_t flag; int r; flag = (st->f_flag & ST_RDONLY) ? 0x00000001 : 0; flag |= (st->f_flag & ST_NOSUID) ? 0x00000002 : 0; if ((msg = sshbuf_new()) == ((void *)0)) sshfatal("sftp-server.c", __func__, 666, 1, SYSLOG_LEVEL_FATAL, ((void *)0), "sshbuf_new failed"); if ((r = sshbuf_put_u8(msg, 201)) != 0 || (r = sshbuf_put_u32(msg, id)) != 0 || (r = sshbuf_put_u64(msg, st->f_bsize)) != 0 || (r = sshbuf_put_u64(msg, st->f_frsize)) != 0 || (r = sshbuf_put_u64(msg, st->f_blocks)) != 0 || (r = sshbuf_put_u64(msg, st->f_bfree)) != 0 || (r = sshbuf_put_u64(msg, st->f_bavail)) != 0 || (r = sshbuf_put_u64(msg, st->f_files)) != 0 || (r = sshbuf_put_u64(msg, st->f_ffree)) != 0 || (r = sshbuf_put_u64(msg, st->f_favail)) != 0 || (r = sshbuf_put_u64(msg, ((st->f_fsid)))) != 0 || (r = sshbuf_put_u64(msg, flag)) != 0 || (r = sshbuf_put_u64(msg, st->f_namemax)) != 0) sshfatal("sftp-server.c", __func__, 680, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "compose"); send_msg(msg); sshbuf_free(msg); }
void send_statvfs(unsigned long a0, unsigned long long a1[11]) { unsigned long long v0; unsigned int v1; unsigned long long v2; unsigned long long v3; unsigned long long v5; v2 = a1[9] & 1; v2 |= a1[9] & 2; v3 = sshbuf_new(); if (!v3) { v0 = "sshbuf_new failed"; sshfatal("sftp-server.c", "send_statvfs", 0x29a, 0x1, 0x1, 0x0); } v1 = sshbuf_put_u8(v3, 0xc9); if (!v1) { v1 = sshbuf_put_u32(v3, a0, a0); if (!v1) { v1 = sshbuf_put_u64(v3, a1[0], a1[0]); if (!v1) { v1 = sshbuf_put_u64(v3, a1[1], a1[1]); if (!v1) { v1 = sshbuf_put_u64(v3, a1[2], a1[2]); if (!v1) { v1 = sshbuf_put_u64(v3, a1[3], a1[3]); if (!v1) { v1 = sshbuf_put_u64(v3, a1[4], a1[4]); if (!v1) { v1 = sshbuf_put_u64(v3, a1[5], a1[5]); if (!v1) { v1 = sshbuf_put_u64(v3, a1[6], a1[6]); if (!v1) { v1 = sshbuf_put_u64(v3, a1[7], a1[7]); if (!v1) { v1 = sshbuf_put_u64(v3, a1[8], a1[8]); if (!v1) { v1 = sshbuf_put_u64(v3, v2, v2); if (!v1) v1 = sshbuf_put_u64(v3, a1[10], a1[10]); } } } } } } } } } } } if (...) { v3 = "compose"; sshfatal("sftp-server.c", "send_statvfs", 0x2a8, 0x1, 0x1, ssh_err(v1)); } send_msg(v3); v5 = sshbuf_free(v3); return; }
openssh-portable
angr_dream
size_t ext2fs_get_refcount_size(ext2_refcount_t refcount) { if (!refcount) return 0; return refcount->size; }
long long ext2fs_get_refcount_size(struct_0 *a0) { void *v1; if (!a0) v1 = 0; else v1 = a0->field_8; return v1; }
e2fsprogs-1.46.5
angr_phoenix
int rl_vi_fword(int count, int ignore) { int opoint; while (count-- && rl_point < (rl_end - 1)) { if (((1 && ((*__ctype_b_loc())[( int)(((unsigned char)rl_line_buffer[rl_point]))] & (unsigned short int)_ISalnum)) || (rl_line_buffer[rl_point]) == '_')) { while (((1 && ((*__ctype_b_loc())[( int)(((unsigned char)rl_line_buffer[rl_point]))] & (unsigned short int)_ISalnum)) || (rl_line_buffer[rl_point]) == '_') && rl_point < rl_end) _rl_vi_advance_point(); } else { while (!((1 && ((*__ctype_b_loc())[( int)(((unsigned char)rl_line_buffer[rl_point]))] & (unsigned short int)_ISalnum)) || (rl_line_buffer[rl_point]) == '_') && !(((rl_line_buffer[rl_point]) == ' ') || ((rl_line_buffer[rl_point]) == '\t')) && rl_point < rl_end) _rl_vi_advance_point(); } opoint = rl_point; while ((((rl_line_buffer[rl_point]) == ' ') || ((rl_line_buffer[rl_point]) == '\t')) && rl_point < rl_end) opoint = _rl_vi_advance_point(); } return (0); }
undefined8 rl_vi_fword(int param_1) { int iVar1; ushort **ppuVar2; int local_1c; local_1c = param_1; while ((iVar1 = local_1c + -1, local_1c != 0 && (rl_point < rl_end + -1))) { ppuVar2 = __ctype_b_loc(); if ((((*ppuVar2)[*(byte *)(rl_point + rl_line_buffer)] & 8) == 0) && (*(char *)(rl_point + rl_line_buffer) != '_')) { while ((((ppuVar2 = __ctype_b_loc(), ((*ppuVar2)[*(byte *)(rl_point + rl_line_buffer)] & 8) == 0 && (*(char *)(rl_point + rl_line_buffer) != '_')) && (*(char *)(rl_point + rl_line_buffer) != ' ')) && ((*(char *)(rl_point + rl_line_buffer) != '\t' && (rl_point < rl_end))))) { _rl_vi_advance_point(); } } else { while (((ppuVar2 = __ctype_b_loc(), ((*ppuVar2)[*(byte *)(rl_point + rl_line_buffer)] & 8) != 0 || (*(char *)(rl_point + rl_line_buffer) == '_')) && (rl_point < rl_end))) { _rl_vi_advance_point(); } } while (((local_1c = iVar1, *(char *)(rl_point + rl_line_buffer) == ' ' || (*(char *)(rl_point + rl_line_buffer) == '\t')) && (rl_point < rl_end))) { _rl_vi_advance_point(); } } return 0; }
bash
ghidra
int do_ipl2tp(int argc, char **argv) { if (argc < 1 || !matches(*argv, "help")) usage(); if (genl_init_handle(&genl_rth, "l2tp", &genl_family)) exit(1); if (matches(*argv, "add") == 0) return do_add(argc - 1, argv + 1); if (matches(*argv, "delete") == 0) return do_del(argc - 1, argv + 1); if (matches(*argv, "show") == 0 || matches(*argv, "lst") == 0 || matches(*argv, "list") == 0) return do_show(argc - 1, argv + 1); fprintf(stderr, "Command \"%s\" is unknown, try \"ip l2tp help\".\n", *argv); exit(-1); }
long long do_ipl2tp(unsigned long a0, unsigned long long *a1) { char v1; unsigned long long v2; unsigned long long v3; if (a0 > 0) { v1 = matches(*(a1), "help") ^ 1; if (!v1) { v2 = genl_init_handle(&genl_rth, "l2tp", &genl_family); if (v2) exit(0x1); *(&v2) = matches(*(a1), "add") ^ 1; if (v2) { v3 = do_add(a0 - 1, a1 + 8); return v3; } *(&v2) = matches(*(a1), "delete") ^ 1; *(&v2) = matches(*(a1), "show") ^ 1; *(&v2) = matches(*(a1), "lst") ^ 1; *(&v2) = matches(*(a1), "list") ^ 1; fprintf(stderr, "Command \"%s\" is unknown, try \"ip l2tp help\".\n", *(a1)); exit(0xffffffff); if (false) { v3 = do_del(a0 - 1, a1 + 8); v3 = do_show(a0 - 1, a1 + 8); } } } if (a0 <= 0 || v1) usage(); }
iproute2-6.0.0
angr_dream
static void idname_free(struct idname *idname) { if (idname == ((void *)0)) return; free(idname->name); free(idname); }
void idname_free(void **a1) { if (a1) { free(a1[1]); free(a1); } }
openssh-portable
ida
static void readError(void) { fprintf(stderr, "%s: I/O error reading `%s', possible reason follows.\n", progName, inFileName); perror(progName); fprintf(stderr, "%s: warning: output file(s) may be incomplete.\n", progName); exit(1); }
void readError() { fprintf(stderr, "%s: I/O error reading `%s', possible reason follows.\n", &progName, &inFileName); perror(&progName); fprintf(stderr, "%s: warning: output file(s) may be incomplete.\n", &progName); exit(0x1); }
bzip2
angr_sailr
struct pidfh *pidfile_open(const char *path, mode_t mode, pid_t *pidptr) { struct pidfh *pfh; struct stat sb; int error, fd, len, count; struct timespec rqtp; pfh = malloc(sizeof(*pfh)); if (pfh == ((void *)0)) return (((void *)0)); if (path == ((void *)0)) { len = asprintf(&pfh->pf_path, "/var/run/%s.pid", getprogname()); if (len < 0) { free(pfh); return (((void *)0)); } } else pfh->pf_path = strdup(path); fd = flopen(pfh->pf_path, 01 | 0100 | 01000 | 04000, mode); if (fd == -1) { if ((*__errno_location()) == 11) { if (pidptr == ((void *)0)) { (*__errno_location()) = 17; } else { count = 20; rqtp.tv_sec = 0; rqtp.tv_nsec = 5000000; for (;;) { (*__errno_location()) = pidfile_read(pfh->pf_path, pidptr); if ((*__errno_location()) != 11 || --count == 0) break; nanosleep(&rqtp, 0); } if ((*__errno_location()) == 11) *pidptr = -1; if ((*__errno_location()) == 0 || (*__errno_location()) == 11) (*__errno_location()) = 17; } } error = (*__errno_location()); free(pfh->pf_path); free(pfh); (*__errno_location()) = error; return (((void *)0)); } if (fstat(fd, &sb) == -1) { error = (*__errno_location()); unlink(pfh->pf_path); free(pfh->pf_path); close(fd); free(pfh); (*__errno_location()) = error; return (((void *)0)); } pfh->pf_fd = fd; pfh->pf_dev = sb.st_dev; pfh->pf_ino = sb.st_ino; return (pfh); }
long long pidfile_open(char *a0, unsigned long a1, unsigned int *a2) { unsigned int v0; unsigned int v1; unsigned int v2; unsigned int v3; void *v4; void *v5; unsigned long long v6; char v7; char v8; void *v10; unsigned int v15; v4 = malloc(0x20); if (!v4) { v10 = 0; } else { if (!a0) { v1 = asprintf(v4 + 8, "/var/run/%s.pid", getprogname()); if (v1 < 0) { free(v4); v10 = 0; } } else { *(&v4[8]) = strdup(a0); } if (v1 >= 0 || a0) { v2 = flopen(v4[8], 0xa41, a1); if (v2 == -1) { if (*(__errno_location()) == 11) { if (!a2) { *(__errno_location()) = 17; } else { v0 = 20; v5 = 0; v6 = 5000000; while (true) { *(__errno_location()) = pidfile_read(v4[8], a2, a2); if (*(__errno_location()) != 11) break; v0 -= 1; if (!v0) break; nanosleep(&v5, NULL); } if (*(__errno_location()) == 11) *(a2) = -1; v15 = *(__errno_location()); if (!v15 || *(__errno_location()) == 11) *(__errno_location()) = 17; } } v3 = *(__errno_location()); free(v4[8]); free(v4); *(__errno_location()) = v3; v10 = 0; } else if (fstat(v2, &v7) == -1) { v3 = *(__errno_location()); unlink(v4[8]); free(v4[8]); close(v2); free(v4); *(__errno_location()) = v3; v10 = 0; } else { *(v4) = v2; *(&v4[16]) = *(&v7); *(&v4[24]) = *(&v8); v10 = v4; } } } return v10; }
libbsd-0.11.7
angr_dream
static void process_open(u_int32_t id) { u_int32_t pflags; Attrib a; char *name; int r, handle, fd, flags, mode, status = 4; if ((r = sshbuf_get_cstring(iqueue, &name, ((void *)0))) != 0 || (r = sshbuf_get_u32(iqueue, &pflags)) != 0 || (r = decode_attrib(iqueue, &a)) != 0) sshfatal("sftp-server.c", __func__, 752, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "parse"); sshlog("sftp-server.c", __func__, 754, 0, SYSLOG_LEVEL_DEBUG3, ((void *)0), "request %u: open flags %d", id, pflags); flags = flags_from_portable(pflags); mode = (a.flags & 0x00000004) ? a.perm : 0666; sshlog("sftp-server.c", __func__, 757, 0, SYSLOG_LEVEL_INFO, ((void *)0), "open \"%s\" flags %s mode 0%o", name, string_from_portable(pflags), mode); if (readonly && ((flags & 0003) != 00 || (flags & (0100 | 01000)) != 0)) { sshlog("sftp-server.c", __func__, 762, 0, SYSLOG_LEVEL_VERBOSE, ((void *)0), "Refusing open request in read-only mode"); status = 3; } else { fd = open(name, flags, mode); if (fd == -1) { status = errno_to_portable((*__errno_location())); } else { handle = handle_new(HANDLE_FILE, name, fd, flags, ((void *)0)); if (handle < 0) { close(fd); } else { send_handle(id, handle); status = 0; } } } if (status != 0) send_status(id, status); free(name); }
unsigned long process_open(unsigned int a1) { long v1; int v2; char *v3; int *v4; unsigned int v6; unsigned int cstring; unsigned int v8; int oflag; unsigned int v10; int fd; signed int v12; char *file; int v14[10]; unsigned long v15; v15 = __readfsqword(0x28u); v8 = 4; cstring = sshbuf_get_cstring(iqueue, &file, 0LL); if (cstring || (cstring = sshbuf_get_u32(iqueue, &v6)) != 0 || (cstring = decode_attrib(iqueue, v14)) != 0) { v1 = ssh_err(cstring); sshfatal("sftp-server.c", "process_open", 752LL, 1LL, 1LL, v1, "parse"); } sshlog("sftp-server.c", "process_open", 754LL, 0LL, 7LL, 0LL, "request %u: open flags %d", a1, v6); oflag = flags_from_portable(v6); if ((v14[0] & 4) != 0) v2 = v14[6]; else v2 = 438; v10 = v2; v3 = string_from_portable(v6); sshlog("sftp-server.c", "process_open", 757LL, 0LL, 3LL, 0LL, "open \"%s\" flags %s mode 0%o", file, v3, v10); if (readonly && ((oflag & 3) != 0 || (oflag & 0x240) != 0)) { sshlog("sftp-server.c", "process_open", 762LL, 0LL, 4LL, 0LL, "Refusing open request in read-only mode"); v8 = 3; } else { fd = open(file, oflag, v10); if (fd == -1) { v4 = _errno_location(); v8 = errno_to_portable(*v4); } else { v12 = handle_new(2, (long)file, fd, oflag, 0LL); if (v12 >= 0) { send_handle(a1, v12); v8 = 0; } else { close(fd); } } } if (v8) send_status(a1, v8); free(file); return __readfsqword(0x28u) ^ v15; }
openssh-portable
ida
int rl_restart_output(int count, int key) { int fildes = fileno(rl_outstream); tcflow(fildes, 1); return 0; }
long rl_restart_output() { int fd; fd = fileno(rl_outstream); tcflow(fd, 1); return 0LL; }
bash
ida
static void check_duparg(__u64 *attrs, int type, const char *key, const char *argv) { if (!(((*attrs) & (1L << (type))) != 0)) { *attrs |= (1L << type); return; } duparg2(key, argv); }
void check_duparg(unsigned long long *a0, unsigned long a1, unsigned long long a2, unsigned long long a3) { unsigned long long *v0; unsigned long long v2; unsigned long long *v3; v0 = a0; if ((1 << (a1 & 63) & *(a0))) { v2 = duparg2(a2, a3, a3); } else { v3 = a0; *(a0) = *(a0) | 1 << (a1 & 63); } return; }
iproute2-6.0.0
angr_phoenix
static char *parameter_brace_substring(varname, value, estatep, substr, quoted, pflags, flags) char *varname, *value; array_eltstate_t *estatep; char *substr; int quoted, pflags, flags; { intmax_t e1, e2; int vtype, r, starsub; char *temp, *val, *tt, *oname; SHELL_VAR *v; if (value == 0 && ((varname[0] != '@' && varname[0] != '*') || varname[1])) return ((char *)((void *)0)); oname = this_command_name; this_command_name = varname; vtype = get_var_and_type(varname, value, estatep, quoted, flags, &v, &val); if (vtype == -1) { this_command_name = oname; return ((char *)((void *)0)); } starsub = vtype & 128; vtype &= ~128; r = verify_substring_values(v, val, substr, vtype, &e1, &e2); this_command_name = oname; if (r <= 0) { if (vtype == 0) do { if (val) sh_xfree((val), "subst.c", 8804); } while (0); return ((r == 0) ? &expand_param_error : (char *)((void *)0)); } switch (vtype) { case 0: case 3: if ((__ctype_get_mb_cur_max()) > 1) tt = mb_substring(val, e1, e2); else tt = substring(val, e1, e2); if (vtype == 0) do { if (val) sh_xfree((val), "subst.c", 8820); } while (0); if (quoted & (0x001 | 0x002)) temp = quote_string(tt); else temp = tt ? quote_escapes(tt) : (char *)((void *)0); do { if (tt) sh_xfree((tt), "subst.c", 8825); } while (0); break; case 1: case 2: if (vtype == 1) tt = pos_params(varname, e1, e2, quoted, pflags); else if (((((v)->attributes) & (0x0000040)))) tt = assoc_subrange((HASH_TABLE *)((v)->value), e1, e2, starsub, quoted, pflags); else tt = array_subrange((ARRAY *)((v)->value), e1, e2, starsub, quoted, pflags); if (tt && quoted == 0 && ifs_is_null) { temp = tt; } else if (tt && quoted == 0 && (pflags & 0x08)) { temp = tt; } else if ((quoted & (0x001 | 0x002)) == 0) { temp = tt ? quote_escapes(tt) : (char *)((void *)0); do { if (tt) sh_xfree((tt), "subst.c", 8858); } while (0); } else temp = tt; break; default: temp = (char *)((void *)0); } return temp; }
undefined1 *parameter_brace_substring(char *param_1, long param_2, undefined8 param_3, undefined8 param_4, uint param_5, uint param_6, undefined4 param_7) { uint uVar1; uint uVar2; int iVar3; size_t sVar4; undefined1 *puVar5; long in_FS_OFFSET; ulong local_48; ulong local_40; long local_38; long local_30; undefined1 *local_28; undefined1 *local_20; undefined8 local_18; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); if ((param_2 == 0) && (((*param_1 != '@' && (*param_1 != '*')) || (param_1[1] != '\0')))) { puVar5 = (undefined1 *)0x0; goto LAB_001150a0; } local_18 = this_command_name; this_command_name = param_1; uVar2 = get_var_and_type(param_1, param_2, param_3, param_5, param_7, &local_30, &local_38); if (uVar2 == 0xffffffff) { this_command_name = (char *)local_18; puVar5 = (undefined1 *)0x0; goto LAB_001150a0; } uVar1 = uVar2 & 0xffffff7f; iVar3 = verify_substring_values(local_30, local_38, param_4, uVar1, &local_48, &local_40); this_command_name = (char *)local_18; if (iVar3 < 1) { if ((uVar1 == 0) && (local_38 != 0)) { sh_xfree(local_38, "subst.c", 0x2264); } if (iVar3 == 0) { puVar5 = &expand_param_error; } else { puVar5 = (undefined1 *)0x0; } goto LAB_001150a0; } if (uVar1 == 3) { LAB_00114e8c: sVar4 = __ctype_get_mb_cur_max(); if (sVar4 < 2) { local_20 = (undefined1 *)substring(local_38, local_48 & 0xffffffff, local_40 & 0xffffffff); } else { local_20 = (undefined1 *)mb_substring(local_38, local_48 & 0xffffffff, local_40 & 0xffffffff); } if ((uVar1 == 0) && (local_38 != 0)) { sh_xfree(local_38, "subst.c", 0x2274); } if ((param_5 & 3) == 0) { if (local_20 == (undefined1 *)0x0) { local_28 = (undefined1 *)0x0; } else { local_28 = (undefined1 *)quote_escapes(local_20); } } else { local_28 = (undefined1 *)quote_string(local_20); } puVar5 = local_28; if (local_20 != (undefined1 *)0x0) { sh_xfree(local_20, "subst.c", 0x2279); puVar5 = local_28; } } else { if ((int)uVar1 < 4) { if (uVar1 == 0) goto LAB_00114e8c; if ((-1 < (int)uVar1) && (uVar1 - 1 < 2)) { if (uVar1 == 1) { local_20 = (undefined1 *)pos_params(param_1, local_48 & 0xffffffff, local_40 & 0xffffffff, param_5, param_6); } else if ((*(uint *)(local_30 + 0x28) & 0x40) == 0) { local_20 = (undefined1 *)array_subrange( *(undefined8 *)(local_30 + 8), local_48, local_40, uVar2 & 0x80, param_5, param_6); } else { local_20 = (undefined1 *)assoc_subrange( *(undefined8 *)(local_30 + 8), local_48, local_40, uVar2 & 0x80, param_5, param_6); } puVar5 = local_20; if ((((local_20 == (undefined1 *)0x0) || (param_5 != 0)) || (ifs_is_null == 0)) && (((local_20 == (undefined1 *)0x0 || (param_5 != 0)) || ((param_6 & 8) == 0)))) { if ((param_5 & 3) == 0) { if (local_20 == (undefined1 *)0x0) { local_28 = (undefined1 *)0x0; } else { local_28 = (undefined1 *)quote_escapes(local_20); } puVar5 = local_28; if (local_20 != (undefined1 *)0x0) { sh_xfree(local_20, "subst.c", 0x229a); puVar5 = local_28; } } else { local_28 = local_20; } } else { local_28 = local_20; } goto LAB_001150a0; } } local_28 = (undefined1 *)0x0; puVar5 = local_28; } LAB_001150a0: if (local_10 == *(long *)(in_FS_OFFSET + 0x28)) { return puVar5; } __stack_chk_fail(); }
bash
ghidra
void set_working_directory(name) char *name; { do { if (the_current_working_directory) sh_xfree((the_current_working_directory), "common.c", 657); } while (0); the_current_working_directory = (char *)strcpy(sh_xmalloc((1 + strlen(name)), "common.c", 658), (name)); }
long long set_working_directory(char *a0) { if (the_current_working_directory) sh_xfree(the_current_working_directory, "common.c", 0x291); the_current_working_directory = strcpy(sh_xmalloc(strlen(a0) + 1, "common.c", 0x292), a0); return the_current_working_directory; }
bash
angr_phoenix
char *asnprintf(char *resultbuf, size_t *lengthp, const char *format, ...) { va_list args; char *result; __builtin_va_start(args, format); result = vasnprintf(resultbuf, lengthp, format, args); __builtin_va_end(args); return result; }
long long asnprintf() { unsigned long v0; unsigned int v1; unsigned int v2; unsigned long v3; unsigned long v4; unsigned long v5; char v6; unsigned long v7; unsigned long v8; unsigned long v9; int v10; int v11; int v12; int v13; int v14; int v15; int v16; int v17; unsigned long v18; unsigned long v19; unsigned long v20; unsigned long v21; char v22; int v23; int v24; int v25; int v26; int v27; int v28; int v29; int v30; unsigned long long *v31; unsigned long long v32; unsigned long long v33; unsigned long long v34; v7 = v19; v8 = v20; v9 = v21; if (v22) { v10 = v23; v11 = v24; v12 = v25; v13 = v26; v14 = v27; v15 = v28; v16 = v29; v17 = v30; } v5 = v31[5]; v1 = 24; v2 = 48; v3 = &v18; v4 = &v6; v0 = vasnprintf(v32, v33, v34, &v1); if ((v5 ^ v31[5])) __stack_chk_fail(); return v0; }
gnutls
angr_sailr
static int compare_nodes(void const *a, void const *b) { struct merge_node const *nodea = a; struct merge_node const *nodeb = b; if (nodea->level == nodeb->level) return (nodea->nlo + nodea->nhi) < (nodeb->nlo + nodeb->nhi); return nodea->level < nodeb->level; }
long long compare_nodes(struct_0 *a0, struct_0 *a1) { unsigned long v1; if (a0->field_50 == a1->field_50) v1 = a0->field_28 + a0->field_30 < a1->field_30 + a1->field_28; else v1 = a0->field_50 < a1->field_50; return v1; }
coreutils
angr_phoenix
void freeargs(arglist *args) { u_int i; if (args == ((void *)0)) return; if (args->list != ((void *)0) && args->num < args->nalloc) { for (i = 0; i < args->num; i++) free(args->list[i]); free(args->list); } args->nalloc = args->num = 0; args->list = ((void *)0); }
void freeargs(void **param_1) { uint local_c; if (param_1 != (void **)0x0) { if ((*param_1 != (void *)0x0) && (*(uint *)(param_1 + 1) < *(uint *)((long)param_1 + 0xc))) { for (local_c = 0; local_c < *(uint *)(param_1 + 1); local_c = local_c + 1) { free(*(void **)((long)*param_1 + (ulong)local_c * 8)); } free(*param_1); } *(undefined4 *)(param_1 + 1) = 0; *(undefined4 *)((long)param_1 + 0xc) = *(undefined4 *)(param_1 + 1); *param_1 = (void *)0x0; } return; }
openssh-portable
ghidra
errcode_t e2fsck_allocate_inode_bitmap(ext2_filsys fs, const char *descr, int deftype, const char *name, ext2fs_inode_bitmap *ret) { errcode_t retval; unsigned int save_type; e2fsck_set_bitmap_type(fs, deftype, name, &save_type); retval = ext2fs_allocate_inode_bitmap(fs, descr, ret); fs->default_bitmap_type = save_type; return retval; }
undefined8 e2fsck_allocate_inode_bitmap(long param_1, undefined8 param_2, undefined4 param_3, undefined8 param_4, undefined8 param_5) { long in_FS_OFFSET; undefined2 local_1c[2]; undefined8 local_18; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); e2fsck_set_bitmap_type(param_1, param_3, param_4, local_1c); local_18 = ext2fs_allocate_inode_bitmap(param_1, param_2, param_5); *(undefined2 *)(param_1 + 0xc4) = local_1c[0]; if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) { __stack_chk_fail(); } return local_18; }
e2fsprogs-1.46.5
ghidra
static void hold_file(COLUMN *p) { COLUMN *q; int i; if (!parallel_files) for (q = column_vector, i = columns; i; ++q, --i) { if (storing_columns) q->status = FF_FOUND; else q->status = ON_HOLD; } else p->status = ON_HOLD; p->lines_to_print = 0; --files_ready_to_read; }
void hold_file(long param_1) { int local_14; long local_10; if (parallel_files == '\x01') { *(undefined4 *)(param_1 + 0x10) = 2; } else { local_10 = column_vector; for (local_14 = columns; local_14 != 0; local_14 = local_14 + -1) { if (storing_columns == '\0') { *(undefined4 *)(local_10 + 0x10) = 2; } else { *(undefined4 *)(local_10 + 0x10) = 1; } local_10 = local_10 + 0x40; } } *(undefined4 *)(param_1 + 0x30) = 0; files_ready_to_read = files_ready_to_read + -1; return; }
coreutils
ghidra
void do_authenticated(struct ssh *ssh, Authctxt *authctxt) { setproctitle("%s", authctxt->pw->pw_name); auth_log_authopts("active", auth_opts, 0); set_fwdpermit_from_authopts(ssh, auth_opts); if (!auth_opts->permit_port_forwarding_flag || options.disable_forwarding) { channel_disable_admin(ssh, (1 << 1)); channel_disable_admin(ssh, (1)); } else { if ((options.allow_tcp_forwarding & (1 << 1)) == 0) channel_disable_admin(ssh, (1 << 1)); else channel_permit_all(ssh, (1 << 1)); if ((options.allow_tcp_forwarding & (1)) == 0) channel_disable_admin(ssh, (1)); else channel_permit_all(ssh, (1)); } auth_debug_send(ssh); prepare_auth_info_file(authctxt->pw, authctxt->session_info); do_authenticated2(ssh, authctxt); do_cleanup(ssh, authctxt); }
void do_authenticated(undefined8 param_1, long param_2) { setproctitle(&DAT_0010769b, **(undefined8 **)(param_2 + 0x30)); auth_log_authopts("active", auth_opts, 0); set_fwdpermit_from_authopts(param_1, auth_opts); if ((*auth_opts == 0) || (_DAT_0010a628 != 0)) { channel_disable_admin(param_1, 2); channel_disable_admin(param_1, 1); } else { if ((_DAT_0010a61c & 2) == 0) { channel_disable_admin(param_1, 2); } else { channel_permit_all(param_1, 2); } if ((_DAT_0010a61c & 1) == 0) { channel_disable_admin(param_1, 1); } else { channel_permit_all(param_1, 1); } } auth_debug_send(param_1); prepare_auth_info_file(*(undefined8 *)(param_2 + 0x30), *(undefined8 *)(param_2 + 0x88)); do_authenticated2(param_1, param_2); do_cleanup(param_1, param_2); return; }
openssh-portable
ghidra
static void systemkey_list(FILE *out) { int ret; gnutls_system_key_iter_t iter = ((void *)0); char *cert_url, *key_url, *label; do { ret = gnutls_system_key_iter_get_info(&iter, GNUTLS_CRT_X509, &cert_url, &key_url, &label, ((void *)0), 0); if (ret >= 0) { fprintf(out, "Label:\t%s\nCert:\t%s\nKey:\t%s\n\n", label, cert_url, key_url); } } while (ret >= 0); if (ret != -56) { if (ret == -1250) { fprintf( stderr, "Native key store is not supported, or not present on this system\n"); } else { fprintf(stderr, "Error: %s\n", gnutls_strerror(ret)); } app_exit(1); } gnutls_system_key_iter_deinit(iter); fputs("\n", out); }
void systemkey_list(void *a0) { void *v0; unsigned int v1; void *v2; char v3; char v4; char v5; char v6; unsigned long long *v8; unsigned long long v9; v2 = 0; do { v0 = 0; v1 = gnutls_system_key_iter_get_info(&v2, 0x1, &v3, &v4, &v5, 0x0); if (v1 >= 0) fprintf(a0, "Label:\t%s\nCert:\t%s\nKey:\t%s\n\n", *(&v5), *(&v3), *(&v4)); } while (v1 >= 0); if (v1 != -56) { if (v1 == -1250) fprintf( *(&stderr), "Native key store is not supported, or not present on this system\n"); else fprintf(*(&stderr), "Error: %s\n", gnutls_strerror(v1)); app_exit(0x1); } else { gnutls_system_key_iter_deinit(v2); fputs("\n", a0); v9 = *(&v6) ^ v8[5]; return; } }
gnutls
angr_dream
vdew_nonambig), ((void *)0) ); } else {
void maintscript_postinst(void) { halt_baddata(); }
dpkg
ghidra
static inline __u32 rta_getattr_u32(const struct rtattr *rta) { return *(__u32 *)(( void *)(((char *)(rta)) + ((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0)))); }
int rta_getattr_u32(struct_0 *a0) { return a0->field_4; }
iproute2-6.0.0
angr_sailr
static inline __u16 rta_getattr_u16(const struct rtattr *rta) { return *(__u16 *)(( void *)(((char *)(rta)) + ((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0)))); }
int rta_getattr_u16(struct_0 *a0) { return a0->field_4; }
iproute2-6.0.0
angr_phoenix
static void print_link_stats(FILE *fp, struct nlmsghdr *n) { struct ifinfomsg *ifi = ((void *)(((char *)n) + ((int)(((sizeof(struct nlmsghdr)) + 4U - 1) & ~(4U - 1))))); struct rtattr *tb[(__IFLA_MAX - 1) + 1]; parse_rtattr( tb, (__IFLA_MAX - 1), ((struct rtattr *)(((char *)(ifi)) + (((sizeof(struct ifinfomsg)) + 4U - 1) & ~(4U - 1)))), n->nlmsg_len - ((sizeof(*ifi)) + ((int)(((sizeof(struct nlmsghdr)) + 4U - 1) & ~(4U - 1))))); __print_link_stats(fp, tb); print_nl(); }
void print_link_stats(undefined8 param_1, int *param_2) { long in_FS_OFFSET; undefined local_1f8[488]; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); parse_rtattr(local_1f8, 0x3c, param_2 + 8, *param_2 + -0x20); __print_link_stats(param_1, local_1f8); print_nl(); if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) { __stack_chk_fail(); } return; }
iproute2-6.0.0
ghidra
static void load_public_identity_files(const struct ssh_conn_info *cinfo) { char *filename, *cp; struct sshkey *public; int i; u_int n_ids, n_certs; char *identity_files[100]; struct sshkey *identity_keys[100]; int identity_file_userprovided[100]; char *certificate_files[100]; struct sshkey *certificates[100]; int certificate_file_userprovided[100]; struct sshkey **keys = ((void *)0); char **comments = ((void *)0); int nkeys; n_ids = n_certs = 0; memset(identity_files, 0, sizeof(identity_files)); memset(identity_keys, 0, sizeof(identity_keys)); memset(identity_file_userprovided, 0, sizeof(identity_file_userprovided)); memset(certificate_files, 0, sizeof(certificate_files)); memset(certificates, 0, sizeof(certificates)); memset(certificate_file_userprovided, 0, sizeof(certificate_file_userprovided)); if (options.pkcs11_provider != ((void *)0) && options.num_identity_files < 100 && (pkcs11_init(!options.batch_mode) == 0) && (nkeys = pkcs11_add_provider(options.pkcs11_provider, ((void *)0), &keys, &comments)) > 0) { for (i = 0; i < nkeys; i++) { if (n_ids >= 100) { sshkey_free(keys[i]); free(comments[i]); continue; } identity_keys[n_ids] = keys[i]; identity_files[n_ids] = comments[i]; n_ids++; } free(keys); free(comments); } for (i = 0; i < options.num_identity_files; i++) { if (n_ids >= 100 || strcasecmp(options.identity_files[i], "none") == 0) { free(options.identity_files[i]); options.identity_files[i] = ((void *)0); continue; } cp = tilde_expand_filename(options.identity_files[i], getuid()); filename = default_client_percent_dollar_expand(cp, cinfo); free(cp); check_load(sshkey_load_public(filename, &public, ((void *)0)), &public, filename, "pubkey"); sshlog("ssh.c", __func__, 2278, 0, SYSLOG_LEVEL_DEBUG1, ((void *)0), "identity file %s type %d", filename, public ? public->type : -1); free(options.identity_files[i]); identity_files[n_ids] = filename; identity_keys[n_ids] = public; identity_file_userprovided[n_ids] = options.identity_file_userprovided[i]; if (++n_ids >= 100) continue; if (options.num_certificate_files != 0) continue; xasprintf(&cp, "%s-cert", filename); check_load(sshkey_load_public(cp, &public, ((void *)0)), &public, filename, "pubkey"); sshlog("ssh.c", __func__, 2297, 0, SYSLOG_LEVEL_DEBUG1, ((void *)0), "identity file %s type %d", cp, public ? public->type : -1); if (public == ((void *)0)) { free(cp); continue; } if (!sshkey_is_cert(public)) { sshlog("ssh.c", __func__, 2304, 1, SYSLOG_LEVEL_DEBUG1, ((void *)0), "key %s type %s is not a certificate", cp, sshkey_type(public)); sshkey_free(public); free(cp); continue; } identity_files[n_ids] = xstrdup(filename); identity_keys[n_ids] = public; identity_file_userprovided[n_ids] = options.identity_file_userprovided[i]; n_ids++; } if (options.num_certificate_files > 100) sshfatal("ssh.c", __func__, 2319, 1, SYSLOG_LEVEL_FATAL, ((void *)0), "too many certificates"); for (i = 0; i < options.num_certificate_files; i++) { cp = tilde_expand_filename(options.certificate_files[i], getuid()); filename = default_client_percent_dollar_expand(cp, cinfo); free(cp); check_load(sshkey_load_public(filename, &public, ((void *)0)), &public, filename, "certificate"); sshlog("ssh.c", __func__, 2328, 0, SYSLOG_LEVEL_DEBUG1, ((void *)0), "certificate file %s type %d", filename, public ? public->type : -1); free(options.certificate_files[i]); options.certificate_files[i] = ((void *)0); if (public == ((void *)0)) { free(filename); continue; } if (!sshkey_is_cert(public)) { sshlog("ssh.c", __func__, 2337, 1, SYSLOG_LEVEL_DEBUG1, ((void *)0), "key %s type %s is not a certificate", filename, sshkey_type(public)); sshkey_free(public); free(filename); continue; } certificate_files[n_certs] = filename; certificates[n_certs] = public; certificate_file_userprovided[n_certs] = options.certificate_file_userprovided[i]; ++n_certs; } options.num_identity_files = n_ids; memcpy(options.identity_files, identity_files, sizeof(identity_files)); memcpy(options.identity_keys, identity_keys, sizeof(identity_keys)); memcpy(options.identity_file_userprovided, identity_file_userprovided, sizeof(identity_file_userprovided)); options.num_certificate_files = n_certs; memcpy(options.certificate_files, certificate_files, sizeof(certificate_files)); memcpy(options.certificates, certificates, sizeof(certificates)); memcpy(options.certificate_file_userprovided, certificate_file_userprovided, sizeof(certificate_file_userprovided)); }
void load_public_identity_files(undefined8 param_1) { int iVar1; __uid_t _Var2; undefined4 uVar3; void *pvVar4; ulong uVar5; undefined8 uVar6; char **ppcVar7; long in_FS_OFFSET; char *pcStack4120; undefined8 uStack4112; undefined local_1008[8]; undefined8 local_1000; int local_ff0; uint local_fec; uint local_fe8; int local_fe4; void *local_fe0; uint *local_fd8; void *local_fd0; void *local_fc8; void *local_fc0; undefined4 local_fb8[100]; undefined4 local_e28[100]; void *local_c98[100]; uint *local_978[100]; void *local_658[100]; uint *local_338[101]; long local_10; ppcVar7 = (char **)local_1008; local_10 = *(long *)(in_FS_OFFSET + 0x28); local_fd0 = (void *)0x0; local_fc8 = (void *)0x0; local_fe8 = 0; local_fec = 0; uStack4112 = 0x107bde; local_1000 = param_1; memset(local_c98, 0, 800); uStack4112 = 0x107bf7; memset(local_978, 0, 800); uStack4112 = 0x107c10; memset(local_fb8, 0, 400); uStack4112 = 0x107c29; memset(local_658, 0, 800); uStack4112 = 0x107c42; memset(local_338, 0, 800); uStack4112 = 0x107c5b; memset(local_e28, 0, 400); if ((options._784_8_ != 0) && ((int)options._804_4_ < 100)) { uStack4112 = 0x107c8f; iVar1 = pkcs11_init(options._88_4_ == 0); if (iVar1 == 0) { uStack4112 = 0x107cb9; local_fe4 = pkcs11_add_provider(options._784_8_, 0, &local_fd0, &local_fc8); if (0 < local_fe4) { for (local_ff0 = 0; local_ff0 < local_fe4; local_ff0 = __addvsi3(local_ff0, 1)) { if (local_fec < 100) { local_978[local_fec] = *(uint **)((long)local_fd0 + (long)local_ff0 * 8); local_c98[local_fec] = *(void **)((long)local_fc8 + (long)local_ff0 * 8); local_fec = local_fec + 1; } else { uStack4112 = 0x107d06; sshkey_free(*(undefined8 *)((long)local_fd0 + (long)local_ff0 * 8)); uStack4112 = 0x107d28; free(*(void **)((long)local_fc8 + (long)local_ff0 * 8)); } uStack4112 = 0x107d91; } uStack4112 = 0x107db8; free(local_fd0); uStack4112 = 0x107dc7; free(local_fc8); } } } local_ff0 = 0; do { if ((int)options._804_4_ <= local_ff0) { if (100 < (int)options._2808_4_) { ppcVar7 = &pcStack4120; pcStack4120 = "too many certificates"; sshfatal("ssh.c", "load_public_identity_files", 0x90f, 1, 1, 0); } for (local_ff0 = 0; local_ff0 < (int)options._2808_4_; local_ff0 = __addvsi3(local_ff0)) { *(undefined8 *)((long)ppcVar7 + -8) = 0x10825c; _Var2 = getuid(); uVar6 = *(undefined8 *)(options + ((long)local_ff0 + 0x160) * 8); *(undefined8 *)((long)ppcVar7 + -8) = 0x108289; local_fe0 = (void *)tilde_expand_filename(uVar6, _Var2); *(undefined8 *)((long)ppcVar7 + -8) = 0x1082a9; local_fc0 = (void *)default_client_percent_dollar_expand(local_fe0, local_1000); *(undefined8 *)((long)ppcVar7 + -8) = 0x1082bf; free(local_fe0); *(undefined8 *)((long)ppcVar7 + -8) = 0x1082dd; uVar3 = sshkey_load_public(local_fc0, &local_fd8, 0); *(undefined8 *)((long)ppcVar7 + -8) = 0x1082fc; check_load(uVar3, &local_fd8, local_fc0, "certificate"); if (local_fd8 == (uint *)0x0) { uVar5 = 0xffffffff; } else { uVar5 = (ulong)*local_fd8; } *(ulong *)((long)ppcVar7 + -0x10) = uVar5; *(void **)((long)ppcVar7 + -0x18) = local_fc0; *(char **)((long)ppcVar7 + -0x20) = "certificate file %s type %d"; *(undefined8 *)((long)ppcVar7 + -0x28) = 0x108359; sshlog("ssh.c", "load_public_identity_files", 0x918, 0, 5, 0); pvVar4 = *(void **)(options + ((long)local_ff0 + 0x160) * 8); *(undefined8 *)((long)ppcVar7 + -8) = 0x108386; free(pvVar4); *(undefined8 *)(options + ((long)local_ff0 + 0x160) * 8) = 0; if (local_fd8 == (uint *)0x0) { *(undefined8 *)((long)ppcVar7 + -8) = 0x1083c6; free(local_fc0); } else { *(undefined8 *)((long)ppcVar7 + -8) = 0x1083da; iVar1 = sshkey_is_cert(local_fd8); if (iVar1 == 0) { *(undefined8 *)((long)ppcVar7 + -8) = 0x1083ed; uVar6 = sshkey_type(local_fd8); *(undefined8 *)((long)ppcVar7 + -0x10) = uVar6; *(void **)((long)ppcVar7 + -0x18) = local_fc0; *(char **)((long)ppcVar7 + -0x20) = "key %s type %s is not a certificate"; *(undefined8 *)((long)ppcVar7 + -0x28) = 0x10842e; sshlog("ssh.c", "load_public_identity_files", 0x921, 1, 5, 0); *(undefined8 *)((long)ppcVar7 + -8) = 0x108441; sshkey_free(local_fd8); *(undefined8 *)((long)ppcVar7 + -8) = 0x108450; free(local_fc0); } else { local_658[local_fe8] = local_fc0; local_338[local_fe8] = local_fd8; local_e28[local_fe8] = *(undefined4 *)(options + ((long)local_ff0 + 0x388) * 4); local_fe8 = local_fe8 + 1; } } *(undefined8 *)((long)ppcVar7 + -8) = 0x1084c0; } options._804_4_ = local_fec; *(undefined8 *)((long)ppcVar7 + -8) = 0x1084ff; memcpy(options + 0x328, local_c98, 800); *(undefined8 *)((long)ppcVar7 + -8) = 0x10851a; memcpy(options + 0x7d8, local_978, 800); *(undefined8 *)((long)ppcVar7 + -8) = 0x108535; memcpy(options + 0x648, local_fb8, 400); options._2808_4_ = local_fe8; *(undefined8 *)((long)ppcVar7 + -8) = 0x10855c; memcpy(options + 0xb00, local_658, 800); *(undefined8 *)((long)ppcVar7 + -8) = 0x108577; memcpy(options + 0xfb0, local_338, 800); *(undefined8 *)((long)ppcVar7 + -8) = 0x108592; memcpy(options + 0xe20, local_e28, 400); if (local_10 == *(long *)(in_FS_OFFSET + 0x28)) { return; } *(undefined8 *)((long)ppcVar7 + -8) = 0x1085a7; __stack_chk_fail(); } if (local_fec < 100) { uStack4112 = 0x107e0d; iVar1 = strcasecmp(*(char **)(options + ((long)local_ff0 + 100) * 8 + 8), "none"); if (iVar1 == 0) goto LAB_00107e11; uStack4112 = 0x107e65; _Var2 = getuid(); uStack4112 = 0x107e90; local_fe0 = (void *)tilde_expand_filename( *(undefined8 *)(options + ((long)local_ff0 + 100) * 8 + 8), _Var2); uStack4112 = 0x107eb0; local_fc0 = (void *)default_client_percent_dollar_expand(local_fe0, local_1000); uStack4112 = 0x107ec6; free(local_fe0); uStack4112 = 0x107ee4; uVar3 = sshkey_load_public(local_fc0, &local_fd8, 0); uStack4112 = 0x107f03; check_load(uVar3, &local_fd8, local_fc0, "pubkey"); if (local_fd8 == (uint *)0x0) { pcStack4120 = (char *)0xffffffff; } else { pcStack4120 = (char *)(ulong)*local_fd8; } sshlog("ssh.c", "load_public_identity_files", 0x8e6, 0, 5, 0, "identity file %s type %d", local_fc0); uStack4112 = 0x107f8b; free(*(void **)(options + ((long)local_ff0 + 100) * 8 + 8)); local_c98[local_fec] = local_fc0; local_978[local_fec] = local_fd8; local_fb8[local_fec] = *(undefined4 *)(options + ((long)local_ff0 + 400) * 4 + 8); local_fec = local_fec + 1; if ((local_fec < 100) && (options._2808_4_ == 0)) { uStack4112 = 0x108026; xasprintf(&local_fe0, "%s-cert", local_fc0); uStack4112 = 0x108044; uVar3 = sshkey_load_public(local_fe0, &local_fd8, 0); uStack4112 = 0x108063; check_load(uVar3, &local_fd8, local_fc0, "pubkey"); if (local_fd8 == (uint *)0x0) { pcStack4120 = (char *)0xffffffff; } else { pcStack4120 = (char *)(ulong)*local_fd8; } sshlog("ssh.c", "load_public_identity_files", 0x8f9, 0, 5, 0, "identity file %s type %d", local_fe0); if (local_fd8 == (uint *)0x0) { uStack4112 = 0x1080e1; free(local_fe0); } else { uStack4112 = 0x1080f5; iVar1 = sshkey_is_cert(local_fd8); if (iVar1 == 0) { uStack4112 = 0x108108; pcStack4120 = (char *)sshkey_type(local_fd8); sshlog("ssh.c", "load_public_identity_files", 0x900, 1, 5, 0, "key %s type %s is not a certificate", local_fe0); uStack4112 = 0x10815e; sshkey_free(local_fd8); uStack4112 = 0x10816d; free(local_fe0); } else { uStack4112 = 0x10817e; pvVar4 = (void *)xstrdup(local_fc0); local_c98[local_fec] = pvVar4; local_978[local_fec] = local_fd8; local_fb8[local_fec] = *(undefined4 *)(options + ((long)local_ff0 + 400) * 4 + 8); local_fec = local_fec + 1; } } } } else { LAB_00107e11: uStack4112 = 0x107e38; free(*(void **)(options + ((long)local_ff0 + 100) * 8 + 8)); *(undefined8 *)(options + ((long)local_ff0 + 100) * 8 + 8) = 0; } uStack4112 = 0x1081eb; local_ff0 = __addvsi3(local_ff0, 1); } while (true); }
openssh-portable
ghidra
static int can_output(void) { return (getpgrp() == tcgetpgrp(1)); }
bool can_output(void) { __pid_t _Var1; __pid_t _Var2; _Var1 = getpgrp(); _Var2 = tcgetpgrp(1); return _Var1 == _Var2; }
openssh-portable
ghidra
u_int sftp_proto_version(struct sftp_conn *conn) { return conn->version; }
long long sftp_proto_version(struct_0 *a0) { return a0->field_14; }
openssh-portable
angr_phoenix
void sv_ignoreeof(name) char *name; { SHELL_VAR *tmp_var; char *temp; eof_encountered = 0; tmp_var = find_variable(name); ignoreeof = tmp_var && ((tmp_var)->value != 0); temp = tmp_var ? ((tmp_var)->value) : (char *)((void *)0); if (temp) eof_encountered_limit = (*temp && all_digits(temp)) ? atoi(temp) : 10; set_shellopts(); }
void sv_ignoreeof(unsigned long long a0, unsigned long long a1, unsigned long long a2, unsigned long long a3, unsigned long long a4, unsigned long long a5) { struct_0 *v0; unsigned long v1; unsigned int v3; unsigned int v4; unsigned long long v5; eof_encountered = 0; v0 = find_variable(a0); if (!v0 || !v0->field_8) v3 = 0; else v3 = 1; ignoreeof = v3; v4 = (!v0 ? v0->field_8 : 0); *(&v1) = v4; if (v1) { if (!*(v1) || !all_digits(v1)) v4 = 10; else v4 = atoi(v1); eof_encountered_limit = v4; } v5 = set_shellopts(a0, a1, a2, a3, a4, a5); return; }
bash
angr_sailr
static int xfrm_acquire_print(struct nlmsghdr *n, void *arg) { FILE *fp = (FILE *)arg; struct xfrm_user_acquire *xacq = ((void *)(((char *)n) + ((int)(((sizeof(struct nlmsghdr)) + 4U - 1) & ~(4U - 1))))); int len = n->nlmsg_len; struct rtattr *tb[(__XFRMA_MAX - 1) + 1]; __u16 family; len -= ((sizeof(*xacq)) + ((int)(((sizeof(struct nlmsghdr)) + 4U - 1) & ~(4U - 1)))); if (len < 0) { fprintf(stderr, "BUG: wrong nlmsg len %d\n", len); return -1; } parse_rtattr( tb, (__XFRMA_MAX - 1), ((struct rtattr *)(((char *)(xacq)) + (((sizeof(struct xfrm_user_acquire)) + 4U - 1) & ~(4U - 1)))), len); family = xacq->sel.family; if (family == 0) family = xacq->policy.sel.family; if (family == 0) family = preferred_family; fprintf(fp, "acquire "); fprintf(fp, "proto %s ", strxf_xfrmproto(xacq->id.proto)); if (show_stats > 0 || xacq->id.spi) { __u32 spi = ntohl(xacq->id.spi); fprintf(fp, "spi 0x%08x", spi); if (show_stats > 0) fprintf(fp, "(%u)", spi); fprintf(fp, " "); } fprintf(fp, "%s", _SL_); xfrm_selector_print(&xacq->sel, family, fp, " sel "); xfrm_policy_info_print(&xacq->policy, tb, fp, " ", " policy "); if (show_stats > 0) fprintf(fp, " seq 0x%08u ", xacq->seq); if (show_stats > 0) { fprintf(fp, "%s-mask %s ", strxf_algotype(XFRMA_ALG_CRYPT), strxf_mask32(xacq->ealgos)); fprintf(fp, "%s-mask %s ", strxf_algotype(XFRMA_ALG_AUTH), strxf_mask32(xacq->aalgos)); fprintf(fp, "%s-mask %s", strxf_algotype(XFRMA_ALG_COMP), strxf_mask32(xacq->calgos)); } fprintf(fp, "%s", _SL_); if (oneline) fprintf(fp, "\n"); fflush(fp); return 0; }
void xfrm_acquire_print(unsigned int *a0, void *a1) { unsigned short v0; unsigned int v1; unsigned int v2; struct_0 *v3; char v4; unsigned long long v6; void *v7; v3 = &a0[4]; v1 = *(a0); v1 -= 296; if (v1 < 0) { fprintf(stderr, "BUG: wrong nlmsg len %d\n", v1); v6 = 4294967295; } else { parse_rtattr(&v4, 0x20, v3 + 1, v1); v0 = v3->field_50; if (!v0) v0 = v3->field_88; if (!v0) v0 = preferred_family; fprintf(a1, "acquire "); fprintf(a1, "proto %s ", strxf_xfrmproto(v3->field_14)); if (show_stats > 0 || v3->field_10) { v2 = ntohl(v3->field_10); fprintf(a1, "spi 0x%08x", v2); if (show_stats > 0) fprintf(a1, "(%u)", v2); fprintf(a1, " "); } fprintf(a1, "%s", _SL_); xfrm_selector_print(&v3->padding_15[19], v0, a1, " sel "); xfrm_policy_info_print(&v3->padding_52[14], &v4, a1, " ", " policy "); if (show_stats > 0) fprintf(a1, " seq 0x%08u ", v3->field_114); if (show_stats > 0) { fprintf(a1, "%s-mask %s ", strxf_algotype(0x2), strxf_mask32(v3->field_10c)); fprintf(a1, "%s-mask %s ", strxf_algotype(0x1), strxf_mask32(v3->field_108)); fprintf(a1, "%s-mask %s", strxf_algotype(0x3), strxf_mask32(v3->field_110)); } fprintf(a1, "%s", _SL_); if (oneline) fprintf(a1, "\n"); fflush(a1); v7 = 0; } return; }
iproute2-6.0.0
angr_dream
static void get_serial_value(unsigned char *serial, size_t *size, const unsigned char *config, size_t config_size, int(create_default)(unsigned char *, size_t *), const char *label, const char *rfc_section) { size_t max_size = *size; int ret; if (batch && config != ((void *)0)) { if (config_size > max_size) { fprintf(stderr, "maximum %zu octets allowed for %s!\n", max_size, label); exit(1); } memcpy(serial, config, config_size); *size = config_size; } else { ret = create_default(serial, size); if (ret < 0) { fprintf(stderr, "error generating default %s: %s\n", label, gnutls_strerror(ret)); exit(1); } } if (!batch) read_serial_value(serial, size, max_size, label, rfc_section); if ((*size == 20 && serial[0] & 0x80) || *size > 20) { fprintf(stderr, "%s would be encoded in more than 20 bytes," "see RFC 5280, section %s\n", label, rfc_section); exit(1); } }
unsigned long get_serial_value(char *a1, unsigned long *a2, const void *a3, size_t a4, long (*a5)(char *, unsigned long *), const char *a6, const char *a7) { const char *v7; unsigned long result; int v11; size_t v12; v12 = *a2; if (batch && a3) { if (a4 > v12) { fprintf(stderr, "maximum %zu octets allowed for %s!\n", v12, a6); exit(1); } memcpy(a1, a3, a4); *a2 = a4; } else { v11 = a5(a1, a2); if (v11 < 0) { v7 = (const char *)gnutls_strerror((unsigned int)v11); fprintf(stderr, "error generating default %s: %s\n", a6, v7); exit(1); } } if (!batch) read_serial_value(a1, a2, v12, a6, a7); if (*a2 == 20 && *a1 < 0 || (result = *a2, *a2 > 0x14)) { fprintf( stderr, "%s would be encoded in more than 20 bytes,see RFC 5280, section %s\n", a6, a7); exit(1); } return result; }
gnutls
ida
static void free_dns_response(struct dns_response *p) { if (p == ((void *)0)) return; free_dns_query(p->query); free_dns_rr(p->answer); free_dns_rr(p->authority); free_dns_rr(p->additional); free(p); }
void free_dns_response(long *a1) { if (a1) { free_dns_query(a1[2]); free_dns_rr(a1[3]); free_dns_rr(a1[4]); free_dns_rr(a1[5]); free(a1); } }
openssh-portable
ida
static void del_keys_by_name(char *name) { struct pkcs11_keyinfo *ki, *nxt; for (ki = ((&pkcs11_keylist)->tqh_first); ki; ki = nxt) { nxt = ((ki)->next.tqe_next); if (!strcmp(ki->providername, name)) { do { if (((ki)->next.tqe_next) != ((void *)0)) (ki)->next.tqe_next->next.tqe_prev = (ki)->next.tqe_prev; else (&pkcs11_keylist)->tqh_last = (ki)->next.tqe_prev; *(ki)->next.tqe_prev = (ki)->next.tqe_next; ; ; } while (0); free(ki->providername); free(ki->label); sshkey_free(ki->key); free(ki); } } }
void del_keys_by_name(char *a0) { unsigned long long v0; unsigned long long v1; unsigned long long v3; unsigned long long v5; v3 = 15588516631309289800; for (v0 = 15588516631309289800; v0; v0 = v1) { v1 = *((v0 + 24)); if (!strcmp(*((v0 + 8)), a0)) { if (*((v0 + 24))) *((*((v0 + 24)) + 32)) = *((v0 + 32)); else g_400018 = *((v0 + 32)); *(*((v0 + 32))) = *((v0 + 24)); free(*((v0 + 8))); free(*((v0 + 16))); sshkey_free(*(v0)); free(v0); } v5 = v1; } return; }
openssh-portable
angr_dream
int sshpkt_get_u8(struct ssh *ssh, u_char *valp) { return sshbuf_get_u8(ssh->state->incoming_packet, valp); }
void sshpkt_get_u8(long *param_1, undefined8 param_2) { sshbuf_get_u8(*(undefined8 *)(*param_1 + 0x38), param_2); return; }
openssh-portable
ghidra
static char const *find_int(char const *string) { char const *p; char const *number_start; for (p = string; ((*__ctype_b_loc())[(int)((to_uchar(*p)))] & (unsigned short int)_ISblank); p++) continue; if (*p == '+') { p++; number_start = p; } else { number_start = p; p += (*p == '-'); } if (((unsigned int)(*p++) - '0' <= 9)) { while (((unsigned int)(*p) - '0' <= 9)) p++; while (((*__ctype_b_loc())[(int)((to_uchar(*p)))] & (unsigned short int)_ISblank)) p++; if (!*p) return number_start; } test_syntax_error(gettext("invalid integer %s"), quote(string)); }
int find_int(unsigned long long a0) { char *v0; int tmp_12; char *v1; unsigned short v4; unsigned int v5; unsigned int v6; unsigned int v8; v0 = a0; while (true) { v4 = *((to_uchar(*(v0)) * 2 + *(__ctype_b_loc()))); v5 = v4 & 1; if (!v5) break; v0 += 1; } if (*(v0) == 43) { v0 += 1; v1 = v0; } else { v1 = v0; v0 = &v0[*(v0) == 45]; } tmp_12 = v0; v0 += 1; *(&v5) = *(tmp_12); if (v6 <= 9) { for (v6 = v5 - 48; *(v0)-48 <= 9; v0 += 1) ; while (true) { *(&v6) = *((to_uchar(*(v0)) * 2 + *(__ctype_b_loc()))); v8 = v6 & 1; if (!v8) break; v0 += 1; } if (!*(v0)) return v1; } if (v6 > 9 || *(v0)) test_syntax_error(gettext("invalid integer %s"), quote(a0)); }
coreutils
angr_dream
char **glob_filename(pathname, flags) char *pathname; int flags; { char **result, **new_result; unsigned int result_size; char *directory_name, *filename, *dname, *fn; unsigned int directory_len; int free_dirname; int dflags, hasglob; result = (char **)sh_malloc((sizeof(char *)), "glob.c", 1162); result_size = 1; if (result == ((void *)0)) return (((void *)0)); result[0] = ((void *)0); directory_name = ((void *)0); filename = strrchr(pathname, '/'); if (filename && extended_glob) { fn = glob_dirscan(pathname, '/'); filename = fn; } if (filename == ((void *)0)) { filename = pathname; directory_name = ""; directory_len = 0; free_dirname = 0; } else { directory_len = (filename - pathname) + 1; directory_name = (char *)sh_malloc((directory_len + 1), "glob.c", 1195); if (directory_name == 0) { sh_xfree((result), "glob.c", 1199); return (((void *)0)); } bcopy(pathname, directory_name, directory_len); directory_name[directory_len] = '\0'; ++filename; free_dirname = 1; } hasglob = 0; if (directory_len > 0 && (hasglob = glob_pattern_p(directory_name)) == 1) { char **directories, *d, *p; register unsigned int i; int all_starstar, last_starstar; all_starstar = last_starstar = 0; d = directory_name; dflags = flags & ~0x001; if ((flags & 0x400) && d[0] == '*' && d[1] == '*' && (d[2] == '/' || d[2] == '\0')) { p = d; while (d[0] == '*' && d[1] == '*' && (d[2] == '/' || d[2] == '\0')) { p = d; if (d[2]) { d += 3; while (*d == '/') d++; if (*d == 0) break; } } if (*d == 0) all_starstar = 1; d = p; dflags |= 0x010 | 0x200; directory_len = strlen(d); } if ((flags & 0x400) && all_starstar == 0) { int dl, prev; prev = dl = directory_len; while (dl >= 4 && d[dl - 1] == '/' && d[dl - 2] == '*' && d[dl - 3] == '*' && d[dl - 4] == '/') prev = dl, dl -= 3; if (dl != directory_len) last_starstar = 1; directory_len = prev; } if (last_starstar && directory_len > 4 && filename[0] == '*' && filename[1] == '*' && filename[2] == 0) { directory_len -= 3; } if (d[directory_len - 1] == '/') d[directory_len - 1] = '\0'; directories = glob_filename(d, dflags | 0x800); if (free_dirname) { sh_xfree((directory_name), "glob.c", 1281); directory_name = ((void *)0); } if (directories == ((void *)0)) goto memory_error; else if (directories == (char **)&glob_error_return) { sh_xfree(((char *)result), "glob.c", 1289); return ((char **)&glob_error_return); } else if (*directories == ((void *)0)) { sh_xfree(((char *)directories), "glob.c", 1294); sh_xfree(((char *)result), "glob.c", 1295); return ((char **)&glob_error_return); } if (all_starstar && filename[0] == '*' && filename[1] == '*' && filename[2] == 0) { sh_xfree(((char *)directories), "glob.c", 1303); sh_xfree((directory_name), "glob.c", 1304); directory_name = ((void *)0); directory_len = 0; goto only_filename; } for (i = 0; directories[i] != ((void *)0); ++i) { char **temp_results; int shouldbreak; shouldbreak = 0; dname = directories[i]; dflags = flags & ~(0x001 | 0x010 | 0x200); if ((flags & 0x400) && filename[0] == '*' && filename[1] == '*' && filename[2] == '\0') dflags |= 0x010 | 0x200; if (dname[0] == '\0' && filename[0]) { dflags |= 0x100; dname = "."; } if (all_starstar && (dflags & 0x100) == 0) { int dlen; if (glob_testdir(dname, flags | 0x010) == -2 && glob_testdir(dname, 0) == 0) { if (filename[0] != 0) temp_results = (char **)&glob_error_return; else { temp_results = (char **)sh_malloc((2 * sizeof(char *)), "glob.c", 1354); if (temp_results == ((void *)0)) goto memory_error; temp_results[0] = (char *)sh_malloc((1), "glob.c", 1357); if (temp_results[0] == 0) { sh_xfree((temp_results), "glob.c", 1360); goto memory_error; } **temp_results = '\0'; temp_results[1] = ((void *)0); dflags |= 0x1000; } } else temp_results = glob_vector(filename, dname, dflags); } else temp_results = glob_vector(filename, dname, dflags); if (temp_results == ((void *)0)) goto memory_error; else if (temp_results == (char **)&glob_error_return) ; else { char **array; register unsigned int l; if ((dflags & 0x010) && filename[0] == '*' && filename[1] == '*' && (filename[2] == '\0' || filename[2] == '/')) { if ((dflags & 0x100) && (flags & 0x100) == 0 && ((temp_results) && *(temp_results) && **(temp_results) == 0)) { register int i, n; for (n = 0; temp_results[n] && *temp_results[n] == 0; n++) ; i = n; do temp_results[i - n] = temp_results[i]; while (temp_results[i++] != 0); array = temp_results; shouldbreak = 1; } else array = temp_results; } else if (dflags & 0x1000) array = glob_dir_to_array(directories[i], temp_results, flags); else array = glob_dir_to_array(directories[i], temp_results, flags); l = 0; while (array[l] != ((void *)0)) ++l; new_result = (char **)realloc(result, (result_size + l) * sizeof(char *)); if (new_result == ((void *)0)) { for (l = 0; array[l]; ++l) sh_xfree((array[l]), "glob.c", 1433); sh_xfree(((char *)array), "glob.c", 1434); goto memory_error; } result = new_result; for (l = 0; array[l] != ((void *)0); ++l) result[result_size++ - 1] = array[l]; result[result_size - 1] = ((void *)0); if (array != temp_results) sh_xfree(((char *)array), "glob.c", 1446); else if ((dflags & 0x010) && filename[0] == '*' && filename[1] == '*' && filename[2] == '\0') sh_xfree((temp_results), "glob.c", 1448); if (shouldbreak) break; } } for (i = 0; directories[i]; i++) sh_xfree((directories[i]), "glob.c", 1456); sh_xfree(((char *)directories), "glob.c", 1458); return (result); } only_filename: if (*filename == '\0') { result = (char **)realloc((char *)result, 2 * sizeof(char *)); if (result == ((void *)0)) { if (free_dirname) sh_xfree((directory_name), "glob.c", 1471); return (((void *)0)); } if (directory_len > 0 && hasglob == 2 && (flags & 0x800) != 0) { dequote_pathname(directory_name); directory_len = strlen(directory_name); } if (directory_len > 0 && hasglob == 2 && (flags & 0x800) == 0) { dequote_pathname(directory_name); if (glob_testdir(directory_name, 0) < 0) { if (free_dirname) sh_xfree((directory_name), "glob.c", 1497); sh_xfree(((char *)result), "glob.c", 1498); return ((char **)&glob_error_return); } } result[0] = (char *)sh_malloc((directory_len + 1), "glob.c", 1504); if (result[0] == ((void *)0)) goto memory_error; bcopy(directory_name, result[0], directory_len + 1); if (free_dirname) sh_xfree((directory_name), "glob.c", 1509); result[1] = ((void *)0); return (result); } else { char **temp_results; if (directory_len > 0) dequote_pathname(directory_name); sh_xfree((result), "glob.c", 1525); dflags = flags & ~0x001; if (directory_len == 0) dflags |= 0x100; if ((flags & 0x400) && filename[0] == '*' && filename[1] == '*' && filename[2] == '\0') { dflags |= 0x010 | 0x200; if (directory_len == 0 && (flags & 0x010) == 0) dflags &= ~0x200; } temp_results = glob_vector( filename, (directory_len == 0 ? "." : directory_name), dflags); if (temp_results == ((void *)0) || temp_results == (char **)&glob_error_return) { if (free_dirname) sh_xfree((directory_name), "glob.c", 1554); do { if (terminating_signal) termsig_handler(terminating_signal); if (interrupt_state) throw_to_top_level(); } while (0); run_pending_traps(); return (temp_results); } result = glob_dir_to_array((dflags & 0x010) ? "" : directory_name, temp_results, flags); if (free_dirname) sh_xfree((directory_name), "glob.c", 1563); return (result); } memory_error: if (result != ((void *)0)) { register unsigned int i; for (i = 0; result[i] != ((void *)0); ++i) sh_xfree((result[i]), "glob.c", 1574); sh_xfree(((char *)result), "glob.c", 1575); } if (free_dirname && directory_name) sh_xfree((directory_name), "glob.c", 1579); do { if (terminating_signal) termsig_handler(terminating_signal); if (interrupt_state) throw_to_top_level(); } while (0); run_pending_traps(); return (((void *)0)); }
void **glob_filename(char *param_1, uint param_2) { int iVar1; bool bVar2; int iVar3; size_t sVar4; long *plVar5; char *pcVar6; long lVar7; void *pvVar8; void **ppvVar9; uint uVar10; ulong uVar11; ulong uVar12; bool bVar13; bool bVar14; int local_b0; uint local_ac; uint local_a4; int local_a0; uint local_94; uint local_90; void **local_88; char *local_80; char *local_78; char *local_70; char *local_68; char *local_60; char **local_58; char **local_50; local_88 = (void **)sh_malloc(8, &DAT_001035b8, 0x48a); local_b0 = 1; if (local_88 == (void **)0x0) { return (void **)0x0; } *local_88 = (void *)0x0; iVar3 = 0x2f; local_78 = strrchr(param_1, 0x2f); if ((local_78 != (char *)0x0) && (extended_glob != 0)) { iVar3 = 0x2f; local_78 = (char *)glob_dirscan(param_1); } if (local_78 == (char *)0x0) { local_80 = &DAT_001035bf; local_ac = 0; bVar2 = false; local_78 = param_1; } else { iVar3 = (int)local_78 - (int)param_1; local_ac = iVar3 + 1; local_80 = (char *)sh_malloc(iVar3 + 2, &DAT_001035b8, 0x4ab); if (local_80 == (char *)0x0) { sh_xfree(local_88, &DAT_001035b8, 0x4af); return (void **)0x0; } pcVar6 = local_80; bcopy(param_1, local_80, (ulong)local_ac); iVar3 = (int)pcVar6; local_80[local_ac] = '\0'; local_78 = local_78 + 1; bVar2 = true; } local_a0 = 0; if ((local_ac != 0) && (local_a0 = glob_pattern_p(local_80, iVar3), local_a0 == 1)) { bVar14 = false; bVar13 = false; local_68 = local_80; local_a4 = param_2 & 0xfffffffe; if ((((param_2 & 0x400) != 0) && ((*local_80 == '*' && (local_80[1] == '*')))) && ((local_80[2] == '/' || (local_80[2] == '\0')))) { local_60 = local_80; do { do { if (((*local_68 != '*') || (local_68[1] != '*')) || ((local_68[2] != '/' && (local_68[2] != '\0')))) goto LAB_00102686; local_60 = local_68; } while (local_68[2] == '\0'); for (local_68 = local_68 + 3; *local_68 == '/'; local_68 = local_68 + 1) { } } while (*local_68 != '\0'); LAB_00102686: bVar13 = *local_68 == '\0'; local_68 = local_60; local_a4 = local_a4 | 0x210; sVar4 = strlen(local_60); local_ac = (uint)sVar4; } if (((param_2 & 0x400) != 0) && (!bVar13)) { local_94 = local_ac; local_90 = local_ac; while (( ((3 < (int)local_94 && (local_68[(long)(int)local_94 + -1] == '/')) && (local_68[(long)(int)local_94 + -2] == '*')) && ((local_68[(long)(int)local_94 + -3] == '*' && (local_68[(long)(int)local_94 + -4] == '/'))))) { local_90 = local_94; local_94 = local_94 - 3; } bVar14 = local_ac != local_94; local_ac = local_90; } if (((bVar14) && (4 < local_ac)) && ((*local_78 == '*' && ((local_78[1] == '*' && (local_78[2] == '\0')))))) { local_ac = local_ac - 3; } if (local_68[local_ac - 1] == '/') { local_68[local_ac - 1] = '\0'; } plVar5 = (long *)glob_filename(local_68, local_a4 | 0x800); if (bVar2) { sh_xfree(local_80, &DAT_001035b8, 0x501); local_80 = (char *)0x0; } if (plVar5 == (long *)0x0) goto LAB_001032d5; if (plVar5 == &glob_error_return) { sh_xfree(local_88, &DAT_001035b8, 0x509); return (void **)&glob_error_return; } if (*plVar5 == 0) { sh_xfree(plVar5, &DAT_001035b8, 0x50e); sh_xfree(local_88, &DAT_001035b8, 0x50f); return (void **)&glob_error_return; } if ((((!bVar13) || (*local_78 != '*')) || (local_78[1] != '*')) || (local_78[2] != '\0')) { for (uVar12 = 0; plVar5[uVar12] != 0; uVar12 = (ulong)((int)uVar12 + 1)) { bVar14 = false; local_70 = (char *)plVar5[uVar12]; local_a4 = param_2 & 0xfffffdee; if ((((param_2 & 0x400) != 0) && (*local_78 == '*')) && ((local_78[1] == '*' && (local_78[2] == '\0')))) { local_a4 = local_a4 | 0x210; } if ((*local_70 == '\0') && (*local_78 != '\0')) { local_a4 = local_a4 | 0x100; local_70 = "."; } if ((bVar13) && ((local_a4 & 0x100) == 0)) { iVar3 = glob_testdir(local_70, param_2 | 0x10); if ((iVar3 == -2) && (iVar3 = glob_testdir(local_70, 0), iVar3 == 0)) { if (*local_78 == '\0') { local_58 = (char **)sh_malloc(0x10, &DAT_001035b8, 0x54a); if (local_58 == (char **)0x0) goto LAB_001032d5; pcVar6 = (char *)sh_malloc(1, &DAT_001035b8, 0x54d); *local_58 = pcVar6; if (*local_58 == (char *)0x0) { sh_xfree(local_58, &DAT_001035b8, 0x550); goto LAB_001032d5; } **local_58 = '\0'; local_58[1] = (char *)0x0; local_a4 = local_a4 | 0x1000; } else { local_58 = (char **)&glob_error_return; } } else { local_58 = (char **)glob_vector(local_78, local_70, local_a4); } } else { local_58 = (char **)glob_vector(local_78, local_70, local_a4); } if (local_58 == (char **)0x0) goto LAB_001032d5; if (local_58 != (char **)&glob_error_return) { if (((((local_a4 & 0x10) == 0) || (*local_78 != '*')) || (local_78[1] != '*')) || ((local_78[2] != '\0' && (local_78[2] != '/')))) { if ((local_a4 & 0x1000) == 0) { local_50 = (char **)glob_dir_to_array(plVar5[uVar12], local_58, param_2); } else { local_50 = (char **)glob_dir_to_array(plVar5[uVar12], local_58, param_2); } } else if ((((local_a4 & 0x100) == 0) || ((param_2 & 0x100) != 0)) || ((local_58 == (char **)0x0 || ((*local_58 == (char *)0x0 || (**local_58 != '\0')))))) { local_50 = local_58; } else { iVar3 = 0; while ((iVar1 = iVar3, local_58[iVar3] != (char *)0x0 && (*local_58[iVar3] == '\0'))) { iVar3 = iVar3 + 1; } do { local_58[iVar1 - iVar3] = local_58[iVar1]; lVar7 = (long)iVar1; iVar1 = iVar1 + 1; } while (local_58[lVar7] != (char *)0x0); local_50 = local_58; bVar14 = true; } for (uVar10 = 0; local_50[uVar10] != (char *)0x0; uVar10 = uVar10 + 1) { } ppvVar9 = (void **)realloc(local_88, (ulong)(local_b0 + uVar10) * 8); if (ppvVar9 == (void **)0x0) { for (uVar12 = 0; local_50[uVar12] != (char *)0x0; uVar12 = (ulong)((int)uVar12 + 1)) { sh_xfree(local_50[uVar12], &DAT_001035b8, 0x599); } sh_xfree(local_50, &DAT_001035b8, 0x59a); goto LAB_001032d5; } for (uVar11 = 0; local_50[uVar11] != (char *)0x0; uVar11 = (ulong)((int)uVar11 + 1)) { ppvVar9[local_b0 - 1] = local_50[uVar11]; local_b0 = local_b0 + 1; } ppvVar9[local_b0 - 1] = (void *)0x0; if (local_50 == local_58) { if (((((local_a4 & 0x10) != 0) && (*local_78 == '*')) && (local_78[1] == '*')) && (local_78[2] == '\0')) { sh_xfree(local_58, &DAT_001035b8, 0x5a8); } } else { sh_xfree(local_50, &DAT_001035b8, 0x5a6); } local_88 = ppvVar9; if (bVar14) break; } } for (uVar12 = 0; plVar5[uVar12] != 0; uVar12 = (ulong)((int)uVar12 + 1)) { sh_xfree(plVar5[uVar12], &DAT_001035b8, 0x5b0); } sh_xfree(plVar5, &DAT_001035b8, 0x5b2); return local_88; } sh_xfree(plVar5, &DAT_001035b8, 0x517); sh_xfree(local_80, &DAT_001035b8, 0x518); local_80 = (char *)0x0; local_ac = 0; } if (*local_78 != '\0') { if (local_ac != 0) { dequote_pathname(local_80); } sh_xfree(local_88, &DAT_001035b8, 0x5f5); local_a4 = param_2 & 0xfffffffe; if (local_ac == 0) { local_a4 = local_a4 | 0x100; } if (((((param_2 & 0x400) != 0) && (*local_78 == '*')) && ((local_78[1] == '*' && ((local_78[2] == '\0' && (local_a4 = local_a4 | 0x210, local_ac == 0)))))) && ((param_2 & 0x10) == 0)) { local_a4 = local_a4 & 0xfffffdff; } pcVar6 = local_80; if (local_ac == 0) { pcVar6 = "."; } ppvVar9 = (void **)glob_vector(local_78, pcVar6, local_a4); if ((ppvVar9 != (void **)0x0) && (ppvVar9 != (void **)&glob_error_return)) { pcVar6 = local_80; if ((local_a4 & 0x10) != 0) { pcVar6 = &DAT_001035bf; } ppvVar9 = (void **)glob_dir_to_array(pcVar6, ppvVar9, param_2); if (!bVar2) { return ppvVar9; } sh_xfree(local_80, &DAT_001035b8, 0x61b); return ppvVar9; } if (bVar2) { sh_xfree(local_80, &DAT_001035b8, 0x612); } if (terminating_signal != 0) { termsig_handler(terminating_signal); } if (interrupt_state != 0) { throw_to_top_level(); } run_pending_traps(); return ppvVar9; } local_88 = (void **)realloc(local_88, 0x10); if (local_88 == (void **)0x0) { if (bVar2) { sh_xfree(local_80, &DAT_001035b8, 0x5bf); } return (void **)0x0; } if (((local_ac != 0) && (local_a0 == 2)) && ((param_2 & 0x800) != 0)) { dequote_pathname(local_80); sVar4 = strlen(local_80); local_ac = (uint)sVar4; } if (((local_ac != 0) && (local_a0 == 2)) && ((param_2 & 0x800) == 0)) { dequote_pathname(local_80); iVar3 = glob_testdir(local_80, 0); if (iVar3 < 0) { if (bVar2) { sh_xfree(local_80, &DAT_001035b8, 0x5d9); } sh_xfree(local_88, &DAT_001035b8, 0x5da); return (void **)&glob_error_return; } } pvVar8 = (void *)sh_malloc(local_ac + 1, &DAT_001035b8, 0x5e0); *local_88 = pvVar8; if (*local_88 != (void *)0x0) { bcopy(local_80, *local_88, (ulong)(local_ac + 1)); if (bVar2) { sh_xfree(local_80, &DAT_001035b8, 0x5e5); } local_88[1] = (void *)0x0; return local_88; } LAB_001032d5: if (local_88 != (void **)0x0) { for (uVar12 = 0; local_88[uVar12] != (void *)0x0; uVar12 = (ulong)((int)uVar12 + 1)) { sh_xfree(local_88[uVar12], &DAT_001035b8, 0x626); } sh_xfree(local_88, &DAT_001035b8, 0x627); } if ((bVar2) && (local_80 != (char *)0x0)) { sh_xfree(local_80, &DAT_001035b8, 0x62b); } if (terminating_signal != 0) { termsig_handler(terminating_signal); } if (interrupt_state != 0) { throw_to_top_level(); } run_pending_traps(); return (void **)0x0; }
bash
ghidra
static void mux_session_confirm(struct ssh *ssh, int id, int success, void *arg) { struct mux_session_confirm_ctx *cctx = arg; const char *display; Channel *c, *cc; int i, r; struct sshbuf *reply; if (cctx == ((void *)0)) sshfatal("mux.c", __func__, 1351, 1, SYSLOG_LEVEL_FATAL, ((void *)0), "cctx == NULL"); if ((c = channel_by_id(ssh, id)) == ((void *)0)) sshfatal("mux.c", __func__, 1353, 1, SYSLOG_LEVEL_FATAL, ((void *)0), "no channel for id %d", id); if ((cc = channel_by_id(ssh, c->ctl_chan)) == ((void *)0)) sshfatal("mux.c", __func__, 1355, 1, SYSLOG_LEVEL_FATAL, ((void *)0), "channel %d lacks control channel %d", id, c->ctl_chan); if ((reply = sshbuf_new()) == ((void *)0)) sshfatal("mux.c", __func__, 1358, 1, SYSLOG_LEVEL_FATAL, ((void *)0), "sshbuf_new"); if (!success) { sshlog("mux.c", __func__, 1361, 1, SYSLOG_LEVEL_DEBUG3, ((void *)0), "sending failure reply"); reply_error(reply, 0x80000003, cctx->rid, "Session open refused by peer"); goto done; } display = getenv("DISPLAY"); if (cctx->want_x_fwd && options.forward_x11 && display != ((void *)0)) { char *proto, *data; if (client_x11_get_proto(ssh, display, options.xauth_location, options.forward_x11_trusted, options.forward_x11_timeout, &proto, &data) == 0) { sshlog("mux.c", __func__, 1376, 0, SYSLOG_LEVEL_DEBUG1, ((void *)0), "Requesting X11 forwarding with authentication " "spoofing."); x11_request_forwarding_with_spoofing(ssh, id, display, proto, data, 1); client_expect_confirm(ssh, id, "X11 forwarding", CONFIRM_WARN); } } if (cctx->want_agent_fwd && options.forward_agent) { sshlog("mux.c", __func__, 1387, 0, SYSLOG_LEVEL_DEBUG1, ((void *)0), "Requesting authentication agent forwarding."); channel_request_start(ssh, id, "auth-agent-req@openssh.com", 0); if ((r = sshpkt_send(ssh)) != 0) sshfatal("mux.c", __func__, 1390, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "send"); } client_session2_setup(ssh, id, cctx->want_tty, cctx->want_subsys, cctx->term, &cctx->tio, c->rfd, cctx->cmd, cctx->env); sshlog("mux.c", __func__, 1396, 1, SYSLOG_LEVEL_DEBUG3, ((void *)0), "sending success reply"); if ((r = sshbuf_put_u32(reply, 0x80000006)) != 0 || (r = sshbuf_put_u32(reply, cctx->rid)) != 0 || (r = sshbuf_put_u32(reply, c->self)) != 0) sshfatal("mux.c", __func__, 1401, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "reply"); done: if ((r = sshbuf_put_stringb(cc->output, reply)) != 0) sshfatal("mux.c", __func__, 1406, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "enqueue"); sshbuf_free(reply); if (cc->mux_pause <= 0) sshfatal("mux.c", __func__, 1410, 1, SYSLOG_LEVEL_FATAL, ((void *)0), "mux_pause %d", cc->mux_pause); cc->mux_pause = 0; c->open_confirm_ctx = ((void *)0); sshbuf_free(cctx->cmd); free(cctx->term); if (cctx->env != ((void *)0)) { for (i = 0; cctx->env[i] != ((void *)0); i++) free(cctx->env[i]); free(cctx->env); } free(cctx); }
unsigned long mux_session_confirm(long a1, unsigned int a2, int a3, void *a4) { long v4; long v5; long v6; int i; unsigned int v10; unsigned int v11; unsigned int v12; long v13; long v14; void *ptr; long v16; long v17; long v18; char *v19; unsigned long v20; v20 = __readfsqword(0x28u); ptr = a4; if (!a4) sshfatal("mux.c", "mux_session_confirm", 1351LL, 1LL, 1LL, 0LL, "cctx == NULL"); v16 = channel_by_id(a1, a2); if (!v16) sshfatal("mux.c", "mux_session_confirm", 1353LL, 1LL, 1LL, 0LL, "no channel for id %d", a2); v17 = channel_by_id(a1, *(unsigned int *)(v16 + 68)); if (!v17) sshfatal("mux.c", "mux_session_confirm", 1355LL, 1LL, 1LL, 0LL, "channel %d lacks control channel %d", a2, *(unsigned int *)(v16 + 68)); v18 = sshbuf_new(); if (!v18) sshfatal("mux.c", "mux_session_confirm", 1358LL, 1LL, 1LL, 0LL, "sshbuf_new"); if (a3) { v19 = getenv("DISPLAY"); if (*((_DWORD *)ptr + 2) && options[4] && v19 && !(unsigned int)client_x11_get_proto( a1, v19, *(_QWORD *)&options[8], (unsigned int)options[6], (unsigned int)options[5], &v13, &v14)) { sshlog("mux.c", "mux_session_confirm", 1376LL, 0LL, 5LL, 0LL, "Requesting X11 forwarding with authentication spoofing."); x11_request_forwarding_with_spoofing(a1, a2, v19, v13, v14, 1LL); client_expect_confirm(a1, a2, "X11 forwarding", 0LL); } if (*((_DWORD *)ptr + 3)) { if (options[0]) { sshlog("mux.c", "mux_session_confirm", 1387LL, 0LL, 5LL, 0LL, "Requesting authentication agent forwarding."); channel_request_start(a1, a2, "auth-agent-req@openssh.com", 0LL); v10 = sshpkt_send(a1); if (v10) { v4 = ssh_err(v10); sshfatal("mux.c", "mux_session_confirm", 1390LL, 1LL, 1LL, v4, "send"); } } } client_session2_setup(a1, a2, *(unsigned int *)ptr, *((unsigned int *)ptr + 1), *((_QWORD *)ptr + 3), (char *)ptr + 32, *(unsigned int *)(v16 + 28), *((_QWORD *)ptr + 2), *((_QWORD *)ptr + 12)); sshlog("mux.c", "mux_session_confirm", 1396LL, 1LL, 7LL, 0LL, "sending success reply"); v11 = sshbuf_put_u32(v18, 2147483654LL); if (v11 || (v11 = sshbuf_put_u32(v18, *((unsigned int *)ptr + 26))) != 0 || (v11 = sshbuf_put_u32(v18, *(unsigned int *)(v16 + 4))) != 0) { v5 = ssh_err(v11); sshfatal("mux.c", "mux_session_confirm", 1401LL, 1LL, 1LL, v5, "reply"); } } else { sshlog("mux.c", "mux_session_confirm", 1361LL, 1LL, 7LL, 0LL, "sending failure reply"); reply_error(v18, 0x80000003, *((_DWORD *)ptr + 26), (long)"Session open refused by peer"); } v12 = sshbuf_put_stringb(*(_QWORD *)(v17 + 112), v18); if (v12) { v6 = ssh_err(v12); sshfatal("mux.c", "mux_session_confirm", 1406LL, 1LL, 1LL, v6, "enqueue"); } sshbuf_free(v18); if (*(int *)(v17 + 344) <= 0) sshfatal("mux.c", "mux_session_confirm", 1410LL, 1LL, 1LL, 0LL, "mux_pause %d", *(unsigned int *)(v17 + 344)); *(_DWORD *)(v17 + 344) = 0; *(_QWORD *)(v16 + 216) = 0LL; sshbuf_free(*((_QWORD *)ptr + 2)); free(*((void **)ptr + 3)); if (*((_QWORD *)ptr + 12)) { for (i = 0; *(_QWORD *)(8LL * i + *((_QWORD *)ptr + 12)); ++i) free(*(void **)(8LL * i + *((_QWORD *)ptr + 12))); free(*((void **)ptr + 12)); } free(ptr); return __readfsqword(0x28u) ^ v20; }
openssh-portable
ida
static void writeline(struct linebuffer const *line, FILE *stream, int class) { switch (class) { case 1: if (!only_file_1) return; break; case 2: if (!only_file_2) return; if (only_file_1) fwrite_unlocked(col_sep, 1, col_sep_len, stream); break; case 3: if (!both) return; if (only_file_1) fwrite_unlocked(col_sep, 1, col_sep_len, stream); if (only_file_2) fwrite_unlocked(col_sep, 1, col_sep_len, stream); break; } fwrite_unlocked(line->buffer, sizeof(char), line->length, stream); }
void writeline(long param_1, FILE *param_2, int param_3) { if (param_3 == 3) { if (both != '\x01') { return; } if (only_file_1 != '\0') { fwrite_unlocked(col_sep, 1, col_sep_len, param_2); } if (only_file_2 != '\0') { fwrite_unlocked(col_sep, 1, col_sep_len, param_2); } } else if (param_3 < 4) { if (param_3 == 1) { if (only_file_1 != '\x01') { return; } } else if (param_3 == 2) { if (only_file_2 != '\x01') { return; } if (only_file_1 != '\0') { fwrite_unlocked(col_sep, 1, col_sep_len, param_2); } } } fwrite_unlocked(*(void **)(param_1 + 0x10), 1, *(size_t *)(param_1 + 8), param_2); return; }
coreutils
ghidra
int sshbuf_dtourlb64(const struct sshbuf *d, struct sshbuf *b64, int wrap) { int r = -1; u_char *p; struct sshbuf *b = ((void *)0); size_t i, l; if ((b = sshbuf_new()) == ((void *)0)) return -2; if ((r = sshbuf_dtob64(d, b, wrap)) != 0) goto out; for (;;) { l = sshbuf_len(b); if (l <= 1 || sshbuf_ptr(b) == ((void *)0)) { r = -1; goto out; } if (sshbuf_ptr(b)[l - 1] != '=') break; if ((r = sshbuf_consume_end(b, 1)) != 0) goto out; } l = sshbuf_len(b); if ((p = sshbuf_mutable_ptr(b)) == ((void *)0)) { r = -1; goto out; } for (i = 0; i < l; i++) { if (p[i] == '+') p[i] = '-'; else if (p[i] == '/') p[i] = '_'; } r = sshbuf_putb(b64, b); out: sshbuf_free(b); return r; }
long long sshbuf_dtourlb64(unsigned long long a0, unsigned long long a1, unsigned long a2) { unsigned int v0; void *v1; unsigned long long v2; unsigned long v3; void *v4; unsigned long long v6; unsigned long long v7; v0 = -1; v2 = 0; v2 = sshbuf_new(); if (!v2) { v6 = 4294967294; } else { v0 = sshbuf_dtob64(a0, v2, a2); if (!v0) { while (true) { v3 = sshbuf_len(v2); if (v3 > 1) { v7 = sshbuf_ptr(v2); if (v7) { *(&v7) = *((sshbuf_ptr(v2) + v3 - 1)); if (v7 == 61) { v0 = sshbuf_consume_end(v2, 0x1); if (v0) break; } else { v3 = sshbuf_len(v2); v4 = sshbuf_mutable_ptr(v2); if (!v4) { v0 = -1; break; } else { for (v1 = 0; v1 < v3; v1 += 1) { if (*((v1 + v4)) == 43) { *((v1 + v4)) = 45; } else if (*((v1 + v4)) == 47) { *((v1 + v4)) = 95; } } v0 = sshbuf_putb(a1, v2, v2); break; } } } } if (v3 <= 1 || !v7) { v0 = -1; break; } } } sshbuf_free(v2); v6 = v0; } return v6; }
openssh-portable
angr_dream
static _Bool parse_cnewer(const struct parser_table *entry, char **argv, int *arg_ptr) { struct stat stat_newer; const char *arg; set_stat_placeholders(&stat_newer); if (collect_arg_stat_info(argv, arg_ptr, &stat_newer, &arg)) { struct predicate *our_pred = insert_primary(entry, arg); our_pred->args.reftime.xval = XVAL_CTIME; our_pred->args.reftime.ts = get_stat_mtime(&stat_newer); our_pred->args.reftime.kind = COMP_GT; our_pred->est_success_rate = estimate_timestamp_success_rate(stat_newer.st_mtim.tv_sec); return 1; } return 0; }
long long parse_cnewer(unsigned long long a0, unsigned long long a1, unsigned long long a2) { char v0; unsigned int v1[16]; char v2; char v3; unsigned long long v5; struct_0 *v6; unsigned int v7; set_stat_placeholders(&v2); if (!collect_arg_stat_info(a1, a2, &v2, &v0)) { v5 = 0; } else { *(&v1[0]) = insert_primary(a0, *(&v0), *(&v0)); v1[14] = 2; v6 = v1; v6->field_40 = get_stat_mtime(&v2); v6->field_48 = a2; v1[15] = 0; estimate_timestamp_success_rate(*(&v3)); v1[9] = v7; v5 = 1; } return v5; }
findutils
angr_phoenix
const char *read_str(const char *input_str) { static char input[512]; ssize_t ret; char *lineptr = ((void *)0); size_t linesize = 0; fputs(input_str, stderr); ret = getline(&lineptr, &linesize, stdin); if (ret == -1) return ((void *)0); ret = copystr_without_nl(input, sizeof(input), lineptr, ret); free(lineptr); if (ret < 0) return ((void *)0); if (((input[0] == '\n') || (input[0] == '\r'))) return ((void *)0); if (input[0] == 0) return ((void *)0); return input; }
int read_str(char *a0) { void *v0; void *v1; unsigned long v2; unsigned int v4; v0 = 0; v1 = 0; fputs(a0, *(got.stderr)); v2 = getline(&v0, &v1, *(got.stdin)); if (v2 == -1) { v4 = 0; } else { v2 = copystr_without_nl(&input.11411, 0x200, v0, v2); free(v0); if ((v2 - 0 >> 63)) { v4 = 0; } else { if (input.11411 != 10 && input.11411 != 13) { if (!input.11411) v4 = 0; else v4 = &input.11411; } if (input.11411 == 10 || input.11411 == 13) v4 = 0; } } return v4; }
gnutls
angr_dream
static int ipneigh_get(int argc, char **argv) { struct { struct nlmsghdr n; struct ndmsg ndm; char buf[1024]; } req = { .n.nlmsg_len = ((sizeof(struct ndmsg)) + ((int)(((sizeof(struct nlmsghdr)) + 4U - 1) & ~(4U - 1)))), .n.nlmsg_flags = 0x01, .n.nlmsg_type = RTM_GETNEIGH, .ndm.ndm_family = preferred_family, }; struct nlmsghdr *answer; char *d = ((void *)0); int dst_ok = 0; int dev_ok = 0; inet_prefix dst; while (argc > 0) { if (strcmp(*argv, "dev") == 0) { do { argv++; if (--argc <= 0) incomplete_command(); } while (0); d = *argv; dev_ok = 1; } else if (matches(*argv, "proxy") == 0) { do { argv++; if (--argc <= 0) incomplete_command(); } while (0); if (matches(*argv, "help") == 0) usage(); if (dst_ok) duparg("address", *argv); get_addr(&dst, *argv, preferred_family); dst_ok = 1; dev_ok = 1; req.ndm.ndm_flags |= (1 << 3); } else { if (strcmp(*argv, "to") == 0) do { argv++; if (--argc <= 0) incomplete_command(); } while (0); if (matches(*argv, "help") == 0) usage(); if (dst_ok) duparg2("to", *argv); get_addr(&dst, *argv, preferred_family); dst_ok = 1; } argc--; argv++; } if (!dev_ok || !dst_ok || dst.family == 0) { fprintf(stderr, "Device and address are required arguments.\n"); return -1; } req.ndm.ndm_family = dst.family; if (addattr_l(&req.n, sizeof(req), NDA_DST, &dst.data, dst.bytelen) < 0) return -1; if (d) { req.ndm.ndm_ifindex = ll_name_to_index(d); if (!req.ndm.ndm_ifindex) { fprintf(stderr, "Cannot find device \"%s\"\n", d); return -1; } } if (rtnl_talk(&rth, &req.n, &answer) < 0) return -2; ipneigh_reset_filter(0); if (print_neigh(answer, stdout) < 0) { fprintf(stderr, "An error :-)\n"); free(answer); return -1; } free(answer); return 0; }
void ipneigh_get(unsigned long a0, unsigned long a1, unsigned long a2, unsigned long a3, unsigned long long a4, unsigned long long a5) { unsigned long long *v0; unsigned int v1; unsigned int v2; unsigned int v3; char v4; void *v5; char v6; char v7; char v8; char v9; char v10; unsigned short v11; unsigned short v12; char v13; unsigned int v14; char v15; unsigned long long v17; void *v18; unsigned long v19; unsigned long long v20; unsigned long long v21; unsigned long long v23; unsigned long long v24; unsigned long long v26; unsigned long long v27; void *v29; unsigned long long v30; v1 = a0; v0 = a1; v17 = 131; for (v18 = &v10; v17; v18 += v19 * 8) { v17 -= 1; v10 = 0; } *(v18) = 0; v10 = 28; v11 = 30; v12 = 1; v13 = preferred_family; v5 = 0; v2 = 0; for (v3 = 0; v1 > 0; v0 += 1) { v20 = strcmp(*(v0), "dev"); if (!v20) { v0 = v0 + 1; v1 -= 1; if (v1 <= 0) incomplete_command(); v5 = *(v0); v3 = 1; } else { *(&v20) = matches(*(v0), "proxy") ^ 1; if (v20) { v0 = v0 + 1; v1 -= 1; if (v1 <= 0) incomplete_command(); *(&v20) = matches(*(v0), "help") ^ 1; usage(); } else { v21 = strcmp(*(v0), "to"); if (!v21) { v0 = v0 + 1; v1 -= 1; if (v1 <= 0) incomplete_command(); } *(&v21) = matches(*(v0), "help") ^ 1; if (v21) usage(); if (v2) duparg2("to", *(v0)); get_addr(&v6, *(v0), preferred_family, *(v0)); v2 = 1; } } if (false) { if (v2) duparg("address", *(v0)); get_addr(&v6, *(v0), preferred_family, *(v0)); v2 = 1; v3 = 1; v15 |= 8; } if (!v20 || !v20 && !v21) v1 -= 1; } if (v3 && v2 && *(&v8)) { v13 = *(&v8); if (addattr_l(&v10, 0x41c, 0x1, &v9, *(&v7)) < 0) { v24 = 4294967295; } else { if (v5) { v14 = ll_name_to_index(v5); if (!v14) { fprintf(*(&stderr), "Cannot find device \"%s\"\n", v5); v26 = 4294967295; } } if (!v5 || v14) { if (rtnl_talk(0x500060, &v10, &v4) < 0) { v27 = 4294967294; } else { ipneigh_reset_filter(0x0); if (print_neigh(*(&v4), stdout, stdout, &v9, a4, a5) < 0) { fprintf(*(&stderr), "An error :-)\n"); free(*(&v4)); v30 = 4294967295; } else { free(*(&v4)); v29 = 0; } } } } } if (!*(&v8) || !v3 || !v2) { fprintf(*(&stderr), "Device and address are required arguments.\n"); v23 = 4294967295; } return; }
iproute2-6.0.0
angr_dream
static _Bool map_compare(void const *entry1, void const *entry2) { struct mapentry const *map1 = entry1; struct mapentry const *map2 = entry2; return map1->orig_id == map2->orig_id; }
long long map_compare(unsigned long long *a0, unsigned long long *a1) { unsigned long long v1; v1 = *(a1); *(&v1) = *(a0) == *(a1); return v1; }
tar
angr_phoenix
static void mux_client_request_terminate(int fd) { struct sshbuf *m; char *e; u_int type, rid; int r; sshlog("mux.c", __func__, 1695, 1, SYSLOG_LEVEL_DEBUG3, ((void *)0), "entering"); if ((m = sshbuf_new()) == ((void *)0)) sshfatal("mux.c", __func__, 1698, 1, SYSLOG_LEVEL_FATAL, ((void *)0), "sshbuf_new"); if ((r = sshbuf_put_u32(m, 0x10000005)) != 0 || (r = sshbuf_put_u32(m, muxclient_request_id)) != 0) sshfatal("mux.c", __func__, 1701, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "request"); if (mux_client_write_packet(fd, m) != 0) sshfatal("mux.c", __func__, 1704, 1, SYSLOG_LEVEL_FATAL, ((void *)0), "write packet: %s", strerror((*__errno_location()))); sshbuf_reset(m); if (mux_client_read_packet(fd, m) != 0) { if ((*__errno_location()) == 32) { sshbuf_free(m); return; } sshfatal("mux.c", __func__, 1715, 1, SYSLOG_LEVEL_FATAL, ((void *)0), "read from master failed: %s", strerror((*__errno_location()))); } if ((r = sshbuf_get_u32(m, &type)) != 0 || (r = sshbuf_get_u32(m, &rid)) != 0) sshfatal("mux.c", __func__, 1720, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "parse"); if (rid != muxclient_request_id) sshfatal("mux.c", __func__, 1722, 1, SYSLOG_LEVEL_FATAL, ((void *)0), "out of sequence reply: my id %u theirs %u", muxclient_request_id, rid); switch (type) { case 0x80000001: break; case 0x80000002: if ((r = sshbuf_get_cstring(m, &e, ((void *)0))) != 0) sshfatal("mux.c", __func__, 1729, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "parse error message"); sshfatal("mux.c", __func__, 1730, 0, SYSLOG_LEVEL_FATAL, ((void *)0), "Master refused termination request: %s", e); case 0x80000003: if ((r = sshbuf_get_cstring(m, &e, ((void *)0))) != 0) sshfatal("mux.c", __func__, 1733, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "parse error message"); sshfatal("mux.c", __func__, 1734, 1, SYSLOG_LEVEL_FATAL, ((void *)0), "termination request failed: %s", e); default: sshfatal("mux.c", __func__, 1736, 1, SYSLOG_LEVEL_FATAL, ((void *)0), "unexpected response from master 0x%08x", type); } sshbuf_free(m); muxclient_request_id++; }
void mux_client_request_terminate(undefined4 param_1) { int iVar1; undefined8 uVar2; int *piVar3; char *pcVar4; char **ppcVar5; undefined *puVar6; undefined *puVar7; long in_FS_OFFSET; char *apcStack272[2]; ulong uStack256; char *apcStack248[9]; ulong auStack176[3]; char *apcStack152[10]; undefined auStack72[12]; undefined4 local_3c; uint local_2c; uint local_28; int local_24; undefined8 local_20; long local_18; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); apcStack152[8] = "entering"; local_3c = param_1; sshlog("mux.c", "mux_client_request_terminate", 0x69f, 1, 7, 0); ppcVar5 = (char **)auStack72; apcStack152[9] = (char *)0x105a7f; local_18 = sshbuf_new(); if (local_18 == 0) { ppcVar5 = apcStack152 + 8; apcStack152[8] = "sshbuf_new"; sshfatal("mux.c", "mux_client_request_terminate", 0x6a2, 1, 1, 0); } *(undefined8 *)((long)ppcVar5 + -8) = 0x105ad5; local_24 = sshbuf_put_u32(local_18, 0x10000005); if (local_24 == 0) { *(undefined8 *)((long)ppcVar5 + -8) = 0x105af2; local_24 = sshbuf_put_u32(local_18, muxclient_request_id); puVar7 = (undefined *)ppcVar5; if (local_24 != 0) goto LAB_00105afb; } else { LAB_00105afb: *(undefined8 *)((long)ppcVar5 + -8) = 0x105b05; uVar2 = ssh_err(local_24); puVar7 = (undefined *)((long)ppcVar5 + -0x10); *(char **)((long)ppcVar5 + -0x10) = "request"; *(undefined8 *)((long)ppcVar5 + -0x18) = 0x105b3c; sshfatal("mux.c", "mux_client_request_terminate", 0x6a5, 1, 1, uVar2); } *(undefined8 *)(puVar7 + -8) = 0x105b4d; iVar1 = mux_client_write_packet(local_3c, local_18); puVar6 = puVar7; if (iVar1 != 0) { *(undefined8 *)(puVar7 + -8) = 0x105b56; piVar3 = __errno_location(); iVar1 = *piVar3; *(undefined8 *)(puVar7 + -8) = 0x105b5f; pcVar4 = strerror(iVar1); *(char **)(puVar7 + -8) = pcVar4; puVar6 = puVar7 + -0x10; *(char **)(puVar7 + -0x10) = "write packet: %s"; *(undefined8 *)(puVar7 + -0x18) = 0x105b96; sshfatal("mux.c", "mux_client_request_terminate", 0x6a8, 1, 1, 0); } *(undefined8 *)(puVar6 + -8) = 0x105ba2; sshbuf_reset(); *(undefined8 *)(puVar6 + -8) = 0x105bb3; iVar1 = mux_client_read_packet(local_3c, local_18); puVar7 = puVar6; if (iVar1 != 0) { *(undefined8 *)(puVar6 + -8) = 0x105bbc; piVar3 = __errno_location(); if (*piVar3 == 0x20) { *(undefined8 *)(puVar6 + -8) = 0x105bcf; sshbuf_free(local_18); goto LAB_00105ea3; } *(undefined8 *)(puVar6 + -8) = 0x105bd9; piVar3 = __errno_location(); iVar1 = *piVar3; *(undefined8 *)(puVar6 + -8) = 0x105be2; pcVar4 = strerror(iVar1); *(char **)(puVar6 + -8) = pcVar4; puVar7 = puVar6 + -0x10; *(char **)(puVar6 + -0x10) = "read from master failed: %s"; *(undefined8 *)(puVar6 + -0x18) = 0x105c19; sshfatal("mux.c", "mux_client_request_terminate", 0x6b3, 1, 1, 0); } *(undefined8 *)(puVar7 + -8) = 0x105c2c; local_24 = sshbuf_get_u32(local_18, &local_2c); if (local_24 == 0) { *(undefined8 *)(puVar7 + -8) = 0x105c48; local_24 = sshbuf_get_u32(local_18, &local_28); puVar6 = puVar7; if (local_24 != 0) goto LAB_00105c51; } else { LAB_00105c51: *(undefined8 *)(puVar7 + -8) = 0x105c5b; uVar2 = ssh_err(local_24); puVar6 = puVar7 + -0x10; *(char **)(puVar7 + -0x10) = "parse"; *(undefined8 *)(puVar7 + -0x18) = 0x105c92; sshfatal("mux.c", "mux_client_request_terminate", 0x6b8, 1, 1, uVar2); } puVar7 = puVar6; if (local_28 != muxclient_request_id) { *(ulong *)(puVar6 + -0x10) = (ulong)local_28; *(ulong *)(puVar6 + -0x18) = (ulong)muxclient_request_id; puVar7 = puVar6 + -0x20; *(char **)(puVar6 + -0x20) = "out of sequence reply: my id %u theirs %u"; *(undefined8 *)(puVar6 + -0x28) = 0x105ce4; sshfatal("mux.c", "mux_client_request_terminate", 0x6ba, 1, 1, 0); } if (local_2c == 0x80000003) { LAB_00105db0: *(undefined8 *)(puVar7 + -8) = 0x105dc8; local_24 = sshbuf_get_cstring(local_18, &local_20, 0); puVar6 = puVar7; if (local_24 != 0) { *(undefined8 *)(puVar7 + -8) = 0x105ddb; uVar2 = ssh_err(local_24); puVar6 = puVar7 + -0x10; *(char **)(puVar7 + -0x10) = "parse error message"; *(undefined8 *)(puVar7 + -0x18) = 0x105e12; sshfatal("mux.c", "mux_client_request_terminate", 0x6c5, 1, 1, uVar2); } *(undefined8 *)(puVar6 + -8) = local_20; puVar7 = puVar6 + -0x10; *(char **)(puVar6 + -0x10) = "termination request failed: %s"; *(undefined8 *)(puVar6 + -0x18) = 0x105e4d; sshfatal("mux.c", "mux_client_request_terminate", 0x6c6, 1, 1, 0); LAB_00105e4d: *(ulong *)(puVar7 + -8) = (ulong)local_2c; puVar6 = puVar7 + -0x10; *(char **)(puVar7 + -0x10) = "unexpected response from master 0x%08x"; *(undefined8 *)(puVar7 + -0x18) = 0x105e87; sshfatal("mux.c", "mux_client_request_terminate", 0x6c8, 1, 1, 0); } else { if (0x80000003 < local_2c) goto LAB_00105e4d; puVar6 = puVar7; if (local_2c != 0x80000001) { if (local_2c == 0x80000002) { *(undefined8 *)(puVar7 + -8) = 0x105d2b; local_24 = sshbuf_get_cstring(local_18, &local_20, 0); if (local_24 != 0) { *(undefined8 *)(puVar7 + -8) = 0x105d3e; uVar2 = ssh_err(local_24); puVar6 = puVar7 + -0x10; *(char **)(puVar7 + -0x10) = "parse error message"; *(undefined8 *)(puVar7 + -0x18) = 0x105d75; sshfatal("mux.c", "mux_client_request_terminate", 0x6c1, 1, 1, uVar2); } *(undefined8 *)(puVar6 + -8) = local_20; puVar7 = puVar6 + -0x10; *(char **)(puVar6 + -0x10) = "Master refused termination request: %s"; *(undefined8 *)(puVar6 + -0x18) = 0x105db0; sshfatal("mux.c", "mux_client_request_terminate", 0x6c2, 0, 1, 0); goto LAB_00105db0; } goto LAB_00105e4d; } } *(undefined8 *)(puVar6 + -8) = 0x105e94; sshbuf_free(local_18); muxclient_request_id = muxclient_request_id + 1; LAB_00105ea3: if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) { *(undefined8 *)(puVar6 + -8) = 0x105eb7; __stack_chk_fail(); } return; }
openssh-portable
ghidra
static void redo_utmp_wtmp(void) { struct stat ustat; const int ret = stat("/var/run/utmp", &ustat); if ((ret < 0) || (ustat.st_size == 0)) wrote_utmp_rlevel = wrote_utmp_reboot = 0; if ((wrote_wtmp_reboot == 0) || (wrote_utmp_reboot == 0)) write_utmp_wtmp("reboot", "~~", 0, 2, "~"); if ((wrote_wtmp_rlevel == 0) || (wrote_utmp_rlevel == 0)) write_utmp_wtmp("runlevel", "~~", thislevel + 256 * prevlevel, 1, "~"); }
unsigned long redo_utmp_wtmp() { struct stat v1; unsigned long v2; v2 = __readfsqword(0x28u); if (stat("/var/run/utmp", &v1) < 0 || !v1.st_size) { wrote_utmp_reboot = 0; wrote_utmp_rlevel = 0; } if (!wrote_wtmp_reboot || !wrote_utmp_reboot) write_utmp_wtmp("reboot", "~~", 0LL, 2LL, "~"); if (!wrote_wtmp_rlevel || !wrote_utmp_rlevel) write_utmp_wtmp("runlevel", "~~", (unsigned int)((prevlevel << 8) + thislevel), 1LL, "~"); return __readfsqword(0x28u) ^ v2; }
sysvinit
ida
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; } }
undefined8 cwrite(char param_1, long param_2, long param_3) { char cVar1; undefined8 uVar2; int *piVar3; long lVar4; if (param_1 != '\0') { if (((param_2 == 0) && (param_3 == 0)) && (elide_empty_files != '\0')) { return 1; } closeout(0, output_desc, filter_pid, outfile); next_file_name(); output_desc = create(outfile); if (output_desc < 0) { uVar2 = quotearg_n_style_colon(0, 3, outfile); piVar3 = __errno_location(); error(1, *piVar3, &DAT_0010507d, uVar2); } } lVar4 = full_write(output_desc, param_2, param_3); if (param_3 == lVar4) { uVar2 = 1; } else { piVar3 = __errno_location(); cVar1 = ignorable(*piVar3); if (cVar1 != '\x01') { uVar2 = quotearg_n_style_colon(0, 3, outfile); piVar3 = __errno_location(); error(1, *piVar3, &DAT_0010507d, uVar2); } uVar2 = 0; } return uVar2; }
coreutils
ghidra
static int do_download_sk(const char *skprovider, const char *device) { struct sshsk_resident_key **srks; size_t nsrks, i; int r, ret = -1; char *fp, *pin = ((void *)0), *pass = ((void *)0), *path, *pubpath; const char *ext; struct sshkey *key; if (skprovider == ((void *)0)) sshfatal("ssh-keygen.c", __func__, 3138, 0, SYSLOG_LEVEL_FATAL, ((void *)0), "Cannot download keys without provider"); pin = read_passphrase("Enter PIN for authenticator: ", 0x0002); if (!quiet) { printf("You may need to touch your authenticator " "to authorize key download.\n"); } if ((r = sshsk_load_resident(skprovider, device, pin, 0, &srks, &nsrks)) != 0) { if (pin != ((void *)0)) freezero(pin, strlen(pin)); sshlog("ssh-keygen.c", __func__, 3149, 0, SYSLOG_LEVEL_ERROR, ssh_err(r), "Unable to load resident keys"); return -1; } if (nsrks == 0) sshlog("ssh-keygen.c", __func__, 3153, 0, SYSLOG_LEVEL_INFO, ((void *)0), "No keys to download"); if (pin != ((void *)0)) freezero(pin, strlen(pin)); for (i = 0; i < nsrks; i++) { key = srks[i]->key; if (key->type != KEY_ECDSA_SK && key->type != KEY_ED25519_SK) { sshlog("ssh-keygen.c", __func__, 3160, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "Unsupported key type %s (%d)", sshkey_type(key), key->type); continue; } if ((fp = sshkey_fingerprint(key, fingerprint_hash, SSH_FP_DEFAULT)) == ((void *)0)) sshfatal("ssh-keygen.c", __func__, 3166, 1, SYSLOG_LEVEL_FATAL, ((void *)0), "sshkey_fingerprint failed"); sshlog("ssh-keygen.c", __func__, 3167, 1, SYSLOG_LEVEL_DEBUG1, ((void *)0), "key %zu: %s %s %s (flags 0x%02x)", i, sshkey_type(key), fp, key->sk_application, key->sk_flags); ext = sk_suffix(key->sk_application, srks[i]->user_id, srks[i]->user_id_len); xasprintf(&path, "id_%s_rk%s%s", key->type == KEY_ECDSA_SK ? "ecdsa_sk" : "ed25519_sk", *ext == '\0' ? "" : "_", ext); if (!confirm_overwrite(path)) { free(path); break; } if (pass == ((void *)0)) pass = private_key_passphrase(); if ((r = sshkey_save_private(key, path, pass, key->sk_application, private_key_format, openssh_format_cipher, rounds)) != 0) { sshlog("ssh-keygen.c", __func__, 3187, 0, SYSLOG_LEVEL_ERROR, ssh_err(r), "Saving key \"%s\" failed", path); free(path); break; } if (!quiet) { printf("Saved %s key%s%s to %s\n", sshkey_type(key), *ext != '\0' ? " " : "", *ext != '\0' ? key->sk_application : "", path); } xasprintf(&pubpath, "%s.pub", path); free(path); if ((r = sshkey_save_public(key, pubpath, key->sk_application)) != 0) { sshlog("ssh-keygen.c", __func__, 3203, 0, SYSLOG_LEVEL_ERROR, ssh_err(r), "Saving public key \"%s\" failed", pubpath); free(pubpath); break; } free(pubpath); } if (i >= nsrks) ret = 0; if (pass != ((void *)0)) freezero(pass, strlen(pass)); sshsk_free_resident_keys(srks, nsrks); return ret; }
long do_download_sk(long a1, long a2) { size_t v2; long v3; size_t v5; long v6; const char *v7; long v8; const char *v9; const char *v10; const char *v11; const char *v12; const char *v13; long v14; const char *v15; const char *v16; const char *v17; const char *v18; const char *v19; long v20; size_t v21; unsigned int v22; unsigned int v23; unsigned int v24; unsigned int v25; long v26; size_t v27; void *ptr; void *v29; size_t i; char *v31; char *s; unsigned int *v33; const char *v34; const char *v35; unsigned long v36; v36 = __readfsqword(0x28u); v22 = -1; s = 0LL; v31 = 0LL; if (!a1) sshfatal("ssh-keygen.c", "do_download_sk", 3138LL, 0LL, 1LL, 0LL, "Cannot download keys without provider"); s = (char *)read_passphrase("Enter PIN for authenticator: ", 2LL); if (!quiet) printf("You may need to touch your authenticator to authorize key " "download.\n"); v23 = sshsk_load_resident(a1, a2, s, 0LL, &v26, &v27); if (v23) { if (s) { v2 = strlen(s); freezero(s, v2); } v3 = ssh_err(v23); sshlog("ssh-keygen.c", "do_download_sk", 3149LL, 0LL, 2LL, v3, "Unable to load resident keys"); return 0xFFFFFFFFLL; } else { if (!v27) sshlog("ssh-keygen.c", "do_download_sk", 3153LL, 0LL, 3LL, 0LL, "No keys to download"); if (s) { v5 = strlen(s); freezero(s, v5); } for (i = 0LL; i < v27; ++i) { v33 = **(unsigned int ***)(8 * i + v26); if (*v33 == 10 || *v33 == 12) { v34 = (const char *)sshkey_fingerprint( v33, (unsigned int)fingerprint_hash, 0LL); if (!v34) sshfatal("ssh-keygen.c", "do_download_sk", 3166LL, 1LL, 1LL, 0LL, "sshkey_fingerprint failed"); v8 = *((unsigned char *)v33 + 104); v9 = (const char *)*((_QWORD *)v33 + 12); v10 = (const char *)sshkey_type(v33); sshlog("ssh-keygen.c", "do_download_sk", 3167LL, 1LL, 5LL, 0LL, "key %zu: %s %s %s (flags 0x%02x)", i, v10, v34, v9, v8); v35 = (const char *)sk_suffix( *((const char **)v33 + 12), *(const char **)(*(_QWORD *)(8 * i + v26) + 8LL), *(_QWORD *)(*(_QWORD *)(8 * i + v26) + 16LL)); if (*v35) v11 = "_"; else v11 = s2; if (*v33 == 10) v12 = "ecdsa_sk"; else v12 = "ed25519_sk"; xasprintf(&ptr, "id_%s_rk%s%s", v12, v11, v35); if (!confirm_overwrite((const char *)ptr)) { free(ptr); break; } if (!v31) v31 = private_key_passphrase(); v24 = sshkey_save_private(v33, ptr, v31, *((_QWORD *)v33 + 12), (unsigned int)private_key_format, openssh_format_cipher, (unsigned int)rounds); if (v24) { v13 = (const char *)ptr; v14 = ssh_err(v24); sshlog("ssh-keygen.c", "do_download_sk", 3187LL, 0LL, 2LL, v14, "Saving key \"%s\" failed", v13); free(ptr); break; } if (!quiet) { v15 = (const char *)ptr; if (*v35) v16 = (const char *)*((_QWORD *)v33 + 12); else v16 = s2; if (*v35) v17 = " "; else v17 = s2; v18 = (const char *)sshkey_type(v33); printf("Saved %s key%s%s to %s\n", v18, v17, v16, v15); } xasprintf(&v29, "%s.pub", (const char *)ptr); free(ptr); v25 = sshkey_save_public(v33, v29, *((_QWORD *)v33 + 12)); if (v25) { v19 = (const char *)v29; v20 = ssh_err(v25); sshlog("ssh-keygen.c", "do_download_sk", 3203LL, 0LL, 2LL, v20, "Saving public key \"%s\" failed", v19); free(v29); break; } free(v29); } else { v6 = *v33; v7 = (const char *)sshkey_type(v33); sshlog("ssh-keygen.c", "do_download_sk", 3160LL, 0LL, 2LL, 0LL, "Unsupported key type %s (%d)", v7, v6); } } if (i >= v27) v22 = 0; if (v31) { v21 = strlen(v31); freezero(v31, v21); } sshsk_free_resident_keys(v26, v27); return v22; } }
openssh-portable
ida
gnutls_datum_t *load_secret_key(int mand, common_info_st *info) { static char raw_key[64]; size_t raw_key_size = sizeof(raw_key); static gnutls_datum_t key; gnutls_datum_t hex_key; int ret; if (info->verbose) fprintf(stderr, "Loading secret key...\n"); if (info->secret_key == ((void *)0)) { if (mand) { fprintf(stderr, "missing --secret-key\n"); app_exit(1); } else return ((void *)0); } hex_key.data = (void *)info->secret_key; hex_key.size = strlen(info->secret_key); ret = gnutls_hex_decode(&hex_key, raw_key, &raw_key_size); if (ret < 0) { fprintf(stderr, "hex_decode: %s\n", gnutls_strerror(ret)); app_exit(1); } key.data = (void *)raw_key; key.size = raw_key_size; return &key; }
undefined1 *load_secret_key(int param_1, char **param_2) { int iVar1; undefined1 *puVar2; size_t sVar3; undefined8 uVar4; long in_FS_OFFSET; undefined8 local_30; char *local_28; undefined4 local_20; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); local_30 = 0x40; if (*(int *)((long)param_2 + 0xc4) != 0) { fprintf(stderr, "Loading secret key...\n"); } if (*param_2 == (char *)0x0) { if (param_1 != 0) { fprintf(stderr, "missing --secret-key\n"); app_exit(1); } puVar2 = (undefined1 *)0x0; } else { local_28 = *param_2; sVar3 = strlen(*param_2); local_20 = (undefined4)sVar3; iVar1 = gnutls_hex_decode(&local_28, raw_key_12448, &local_30); if (iVar1 < 0) { uVar4 = gnutls_strerror(iVar1); fprintf(stderr, "hex_decode: %s\n", uVar4); app_exit(1); } key_12450._0_8_ = raw_key_12448; key_12450._8_4_ = (undefined4)local_30; puVar2 = key_12450; } if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) { __stack_chk_fail(); } return puVar2; }
gnutls
ghidra
static _Bool parse_wholename(const struct parser_table *entry, char **argv, int *arg_ptr) { return insert_path_check(entry, argv, arg_ptr, "wholename", pred_path); }
long long parse_wholename(unsigned long long a0, unsigned long long a1, unsigned long long a2) { return insert_path_check(a0, a1, a2, "wholename", got.pred_path); }
findutils
angr_phoenix
int ssh_packet_process_incoming(struct ssh *ssh, const char *buf, u_int len) { struct session_state *state = ssh->state; int r; if (state->packet_discard) { state->keep_alive_timeouts = 0; if (len >= state->packet_discard) { if ((r = ssh_packet_stop_discard(ssh)) != 0) return r; } state->packet_discard -= len; return 0; } if ((r = sshbuf_put(state->input, buf, len)) != 0) return r; return 0; }
int ssh_packet_process_incoming(unsigned long long *a0, unsigned long long a1, unsigned long a2) { unsigned int v0; struct_0 *v1; unsigned int v3; v1 = *(a0); if (!v1->field_1c4) { v0 = sshbuf_put(v1->field_20, a1, a2, a1); if (!v0) v3 = 0; else v3 = v0; } else { v1->field_14c = 0; if (a2 >= v1->field_1c4) { v0 = ssh_packet_stop_discard(a0); if (v0) { v3 = v0; goto LABEL_40445e; } } v1->field_1c4 = v1->field_1c4 - a2; v3 = 0; } LABEL_40445e: return v3; }
openssh-portable
angr_phoenix
int main(int argc, char **argv) { const char *libbpf_version; char *batch_file = ((void *)0); char *basename; int color = 0; if (argc < 3 || strcmp(argv[1], "vrf") != 0 || strcmp(argv[2], "exec") != 0) drop_cap(); basename = strrchr(argv[0], '/'); if (basename == ((void *)0)) basename = argv[0]; else basename++; while (argc > 1) { char *opt = argv[1]; if (strcmp(opt, "--") == 0) { argc--; argv++; break; } if (opt[0] != '-') break; if (opt[1] == '-') opt++; if (matches(opt, "-loops") == 0) { argc--; argv++; if (argc <= 1) usage(); max_flush_loops = atoi(argv[1]); } else if (matches(opt, "-family") == 0) { argc--; argv++; if (argc <= 1) usage(); if (strcmp(argv[1], "help") == 0) usage(); else preferred_family = read_family(argv[1]); if (preferred_family == 0) invarg("invalid protocol family", argv[1]); } else if (strcmp(opt, "-4") == 0) { preferred_family = 2; } else if (strcmp(opt, "-6") == 0) { preferred_family = 10; } else if (strcmp(opt, "-0") == 0) { preferred_family = 17; } else if (strcmp(opt, "-M") == 0) { preferred_family = 28; } else if (strcmp(opt, "-B") == 0) { preferred_family = 7; } else if (matches(opt, "-human") == 0 || matches(opt, "-human-readable") == 0) { ++human_readable; } else if (matches(opt, "-iec") == 0) { ++use_iec; } else if (matches(opt, "-stats") == 0 || matches(opt, "-statistics") == 0) { ++show_stats; } else if (matches(opt, "-details") == 0) { ++show_details; } else if (matches(opt, "-resolve") == 0) { ++resolve_hosts; } else if (matches(opt, "-oneline") == 0) { ++oneline; } else if (matches(opt, "-timestamp") == 0) { ++timestamp; } else if (matches(opt, "-tshort") == 0) { ++timestamp; ++timestamp_short; } else if (matches(opt, "-Version") == 0) { printf("ip utility, iproute2-%s", version); libbpf_version = get_libbpf_version(); if (libbpf_version) printf(", libbpf %s", libbpf_version); printf("\n"); exit(0); } else if (matches(opt, "-force") == 0) { ++force; } else if (matches(opt, "-batch") == 0) { argc--; argv++; if (argc <= 1) usage(); batch_file = argv[1]; } else if (matches(opt, "-brief") == 0) { ++brief; } else if (matches(opt, "-json") == 0) { ++json; } else if (matches(opt, "-pretty") == 0) { ++pretty; } else if (matches(opt, "-rcvbuf") == 0) { unsigned int size; argc--; argv++; if (argc <= 1) usage(); if (get_unsigned(&size, argv[1], 0)) { fprintf(stderr, "Invalid rcvbuf size '%s'\n", argv[1]); exit(-1); } rcvbuf = size; } else if (matches_color(opt, &color)) { } else if (matches(opt, "-help") == 0) { usage(); } else if (matches(opt, "-netns") == 0) { do { argv++; if (--argc <= 0) incomplete_command(); } while (0); if (netns_switch(argv[1])) exit(-1); } else if (matches(opt, "-Numeric") == 0) { ++numeric; } else if (matches(opt, "-all") == 0) { do_all = 1; } else { fprintf(stderr, "Option \"%s\" is unknown, try \"ip -help\".\n", opt); exit(-1); } argc--; argv++; } _SL_ = oneline ? "\\" : "\n"; check_enable_color(color, json); if (batch_file) return batch(batch_file); if (rtnl_open(&rth, 0) < 0) exit(1); rtnl_set_strict_dump(&rth); if (strlen(basename) > 2) { int ret = do_cmd(basename + 2, argc, argv, 0); if (ret != 1) return ret; } if (argc > 1) return do_cmd(argv[1], argc - 1, argv + 1, 1); rtnl_close(&rth); usage(); }
int main(unsigned long a0, unsigned int a1, unsigned long long a2, unsigned long long a3, unsigned long long a4, unsigned long long a5) { unsigned long long v0[3]; unsigned int v1; unsigned int v2; char v3; unsigned long long v4; void *v5; char *v6; char v7[2]; unsigned long v8; char v22; unsigned long long v36; v1 = a0; *(&v0[0]) = a1; v5 = 0; v2 = 0; if (v1 <= 2 || strcmp(v0[1], "vrf") || strcmp(v0[2], "exec")) drop_cap(); v6 = strrchr(v0[0], 0x2f); if (!v6) v6 = v0[0]; else v6 += 1; while (true) { if (v1 <= 1) { v36 = (!1219493948222425173 ? "\\" : "\n"); goto LABEL_4009a1; } *(&v7) = v0[1]; if (!strcmp(v7, "--")) { v1 -= 1; v0[0] = &v0[1]; v36 = (!1219493948222425173 ? "\\" : "\n"); goto LABEL_4009a1; } if (v7[0] != 45) { v36 = (!1219493948222425173 ? "\\" : "\n"); LABEL_4009a1: _SL_ = v36; check_enable_color(v2, 0x10ec8348e5894855, 0x10ec8348e5894855); if (v5) { v36 = batch(v5); return v36; } if (rtnl_open(&rth, 0x0) < 0) exit(0x1); rtnl_set_strict_dump(&rth); if (strlen(v6) > 2) { *(&v4) = do_cmd(v6 + 2, v1, v0, 0x0); if (v4 != 1) { *(&v36) = v4; return v36; } } if (v1 <= 1) { rtnl_close(&rth); usage(); } v36 = do_cmd(v0[1], v1 - 1, &v0[1], 0x1); break; } if (v7[1] == 45) *(&v7) = &v7[1]; if ((matches(v7, "-loops", a2) ^ 1)) { v1 -= 1; v0[0] = &v0[1]; if (v1 <= 1) usage(); max_flush_loops = atoi(v0[1]); v1 -= 1; v0[0] = &v0[1]; continue; } if ((matches(v7, "-family", a2) ^ 1)) { v1 -= 1; v0[0] = &v0[1]; if (v1 <= 1) usage(); if (!strcmp(v0[1], "help")) usage(); preferred_family = read_family(v0[1]); if (!preferred_family) { invarg("invalid protocol family", v0[1]); } else { v1 -= 1; v0[0] = &v0[1]; continue; } } if (!strcmp(v7, "-4")) { preferred_family = 2; v1 -= 1; v0[0] = &v0[1]; continue; } if (!strcmp(v7, "-6")) { preferred_family = 10; v1 -= 1; v0[0] = &v0[1]; continue; } if (!strcmp(v7, "-0")) { preferred_family = 17; v1 -= 1; v0[0] = &v0[1]; continue; } if (!strcmp(v7, "-M")) { preferred_family = 28; v1 -= 1; v0[0] = &v0[1]; continue; } if (!strcmp(v7, "-B")) { preferred_family = 7; v1 -= 1; v0[0] = &v0[1]; continue; } if ((matches(v7, "-human", a2) ^ 1) || (matches(v7, "-human-readable", a2) ^ 1)) { batch_mode = 3850979414; v1 -= 1; v0[0] = &v0[1]; continue; } if ((matches(v7, "-iec", a2) ^ 1)) { batch_mode = 3850979414; v1 -= 1; v0[0] = &v0[1]; continue; } if ((matches(v7, "-stats", a2) ^ 1) || (matches(v7, "-statistics", a2) ^ 1)) { batch_mode = 3850979414; v1 -= 1; v0[0] = &v0[1]; continue; } if ((matches(v7, "-details", a2) ^ 1)) { batch_mode = 3850979414; v1 -= 1; v0[0] = &v0[1]; continue; } if ((matches(v7, "-resolve", a2) ^ 1)) { resolve_hosts = resolve_hosts + 1; v1 -= 1; v0[0] = &v0[1]; continue; } if ((matches(v7, "-oneline", a2) ^ 1)) { batch_mode = 3850979414; v1 -= 1; v0[0] = &v0[1]; continue; } if ((matches(v7, "-timestamp", a2) ^ 1)) { batch_mode = 3850979414; v1 -= 1; v0[0] = &v0[1]; continue; } LABEL_400635: v22 = matches(v7, "-tshort", a2) ^ 1; if (v22) { batch_mode = 3850979414; goto LABEL_400635; } else { if ((matches(v7, "-Version", a2) ^ 1)) { printf("ip utility, iproute2-%s", &version); v8 = get_libbpf_version("ip utility, iproute2-%s", "6.0.0", a2, a3, a4, a5); if (v8) printf(", libbpf %s", v8); printf("\n"); exit(0x0); } if ((matches(v7, "-force", a2) ^ 1)) { batch_mode = 3850979414; v1 -= 1; v0[0] = &v0[1]; continue; } if ((matches(v7, "-batch", a2) ^ 1)) { v1 -= 1; v0[0] = &v0[1]; if (v1 <= 1) usage(); v5 = v0[1]; v1 -= 1; v0[0] = &v0[1]; continue; } if ((matches(v7, "-brief", a2) ^ 1)) { batch_mode = 3850979414; v1 -= 1; v0[0] = &v0[1]; continue; } if ((matches(v7, "-json", a2) ^ 1)) { batch_mode = 3850979414; if (v22) { timestamp_short = timestamp_short + 1; v1 -= 1; v0[0] = &v0[1]; continue; } } else if ((matches(v7, "-pretty", a2) ^ 1)) { pretty = pretty + 1; v1 -= 1; v0[0] = &v0[1]; continue; } else if ((matches(v7, "-rcvbuf", a2) ^ 1)) { v1 -= 1; v0[0] = &v0[1]; if (v1 <= 1) usage(); if (get_unsigned(&v3, v0[1], 0x0, v0[1])) { fprintf(*(&stderr), "Invalid rcvbuf size '%s'\n", v0[1]); exit(0xffffffff); } rcvbuf = *(&v3); v1 -= 1; v0[0] = &v0[1]; continue; } else if (!matches_color(v7, &v2, &v2)) { if ((matches(v7, "-help", &v2) ^ 1)) usage(); if ((matches(v7, "-netns", &v2) ^ 1)) { v0[0] = &v0[1]; v1 -= 1; if (v1 <= 0) incomplete_command(); if (netns_switch(v0[1])) exit(0xffffffff); } else { if ((matches(v7, "-Numeric", &v2) ^ 1)) { numeric = numeric + 1; v1 -= 1; v0[0] = &v0[1]; continue; } else { if (!(matches(v7, "-all", &v2) ^ 1)) { fprintf(*(&stderr), "Option \"%s\" is unknown, try \"ip -help\".\n", v7); exit(0xffffffff); } do_all = 1; v1 -= 1; v0[0] = &v0[1]; } continue; } } v1 -= 1; v0[0] = &v0[1]; } } return v36; }
iproute2-6.0.0
angr_sailr