input
stringlengths
26
172k
output
stringlengths
18
318k
repo_name
stringclasses
23 values
decompiler
stringclasses
5 values
static inline void emit_stdin_note(void) { fputs_unlocked( gettext("\nWith no FILE, or when FILE is -, read standard input.\n"), stdout) ; }
int emit_stdin_note() { FILE *v0; char *v1; v0 = stdout; v1 = gettext("\nWith no FILE, or when FILE is -, read standard input.\n"); return fputs_unlocked(v1, v0); }
coreutils
ida
static int pkcs11_rsa_private_encrypt(int flen, const u_char *from, u_char *to, RSA *rsa, int padding) { struct pkcs11_key *k11; struct pkcs11_slotinfo *si; CK_FUNCTION_LIST *f; CK_ULONG tlen = 0; CK_RV rv; int rval = -1; if ((k11 = RSA_get_ex_data(rsa, rsa_idx)) == ((void *)0)) { sshlog("ssh-pkcs11.c", __func__, 433, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "RSA_get_ex_data failed"); return (-1); } if (pkcs11_get_key(k11, (1)) == -1) { sshlog("ssh-pkcs11.c", __func__, 438, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "pkcs11_get_key failed"); return (-1); } f = k11->provider->function_list; si = &k11->provider->slotinfo[k11->slotidx]; tlen = RSA_size(rsa); rv = f->C_Sign(si->session, (CK_BYTE *)from, flen, to, &tlen); if (rv == (0)) rval = tlen; else sshlog("ssh-pkcs11.c", __func__, 451, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "C_Sign failed: %lu", rv); return (rval); }
undefined4 pkcs11_rsa_private_encrypt(int param_1, undefined8 param_2, undefined8 param_3, RSA *param_4) { int iVar1; long in_FS_OFFSET; undefined8 uVar2; undefined4 local_3c; long local_38; long *local_30; long local_28; long local_20; long local_18; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); local_38 = 0; local_3c = 0xffffffff; uVar2 = 0x101415; local_30 = (long *)RSA_get_ex_data(param_4, rsa_idx); if (local_30 == (long *)0x0) { sshlog("ssh-pkcs11.c", "pkcs11_rsa_private_encrypt", 0x1b1, 0, 2, 0, "RSA_get_ex_data failed", uVar2); local_3c = 0xffffffff; } else { uVar2 = 0x101479; iVar1 = pkcs11_get_key(local_30, 1); if (iVar1 == -1) { sshlog("ssh-pkcs11.c", "pkcs11_rsa_private_encrypt", 0x1b6, 0, 2, 0, "pkcs11_get_key failed", uVar2); local_3c = 0xffffffff; } else { local_28 = *(long *)(*local_30 + 0x10); local_20 = local_30[1] * 0xe0 + *(long *)(*local_30 + 0x80); iVar1 = RSA_size(param_4); local_38 = (long)iVar1; local_18 = (**(code **)(local_28 + 0x160))( *(undefined8 *)(local_20 + 0xd0), param_2, (long)param_1, param_3, &local_38); if (local_18 == 0) { local_3c = (undefined4)local_38; } else { sshlog("ssh-pkcs11.c", "pkcs11_rsa_private_encrypt", 0x1c3, 0, 2, 0, "C_Sign failed: %lu", local_18); } } } if (local_10 == *(long *)(in_FS_OFFSET + 0x28)) { return local_3c; } __stack_chk_fail(); }
openssh-portable
ghidra
static int xfrm_spd_getdefault(int argc, char **argv) { struct rtnl_handle rth; struct { struct nlmsghdr n; struct xfrm_userpolicy_default up; } req = { .n.nlmsg_len = ((sizeof(struct xfrm_userpolicy_default)) + ((int)(((sizeof(struct nlmsghdr)) + 4U - 1) & ~(4U - 1)))), .n.nlmsg_flags = 0x01, .n.nlmsg_type = XFRM_MSG_GETDEFAULT, }; struct nlmsghdr *answer; if (rtnl_open_byproto(&rth, 0, 6) < 0) exit(1); if (rtnl_talk(&rth, &req.n, &answer) < 0) exit(2); xfrm_policy_default_print(answer, (FILE *)stdout); free(answer); rtnl_close(&rth); return 0; }
void xfrm_spd_getdefault(unsigned long a0, unsigned long a1) { unsigned long v0; unsigned int v1; char v2; void *v3; unsigned short v4; unsigned short v5; void *v6; unsigned int v7; char v8; void *v12; v1 = a0; v0 = a1; v3 = 0; v6 = 0; v7 = 0; v3 = 19; v4 = 40; v5 = 1; if (rtnl_open_byproto(&v8, 0x0, 0x6) < 0) { exit(0x1); } else if (rtnl_talk(&v8, &v3, &v2, &v3) < 0) { exit(0x2); } else { xfrm_policy_default_print(*(&v2), stdout); free(*(&v2)); rtnl_close(&v8); v12 = 0; return; } }
iproute2-6.0.0
angr_dream
0 ) do { fprintf(stderr, gettext("Try '%s --help' for more information.\n"), program_name); } while (0) ;
int fprintf(FILE *__stream, char *__format, ...) { halt_baddata(); }
coreutils
ghidra
SHELL_VAR **map_over(function, vc) sh_var_map_func_t *function; VAR_CONTEXT *vc; { VAR_CONTEXT *v; VARLIST *vlist; SHELL_VAR **ret; int nentries; for (nentries = 0, v = vc; v; v = v->down) nentries += ((v->table) ? (v->table)->nentries : 0); if (nentries == 0) return (SHELL_VAR **)((void *)0); vlist = vlist_alloc(nentries); for (v = vc; v; v = v->down) flatten(v->table, function, vlist, 0); ret = vlist->list; sh_xfree((vlist), "variables.c", 4241); return ret; }
long map_over(long (*a1)(const char **), long a2) { int v2; int v4; long i; long j; long *v7; long v8; v4 = 0; for (i = a2; i; i = *(_QWORD *)(i + 24)) { if (*(_QWORD *)(i + 32)) v2 = *(_DWORD *)(*(_QWORD *)(i + 32) + 12LL); else v2 = 0; v4 += v2; } if (!v4) return 0LL; v7 = (long *)vlist_alloc(v4); for (j = a2; j; j = *(_QWORD *)(j + 24)) flatten(*(_QWORD *)(j + 32), a1, (long)v7); v8 = *v7; sh_xfree(v7, "variables.c", 4241LL); return v8; }
bash
ida
void send_bits(value, length) int value; int length; { if (bi_valid > (int)(8 * 2 * sizeof(char)) - length) { bi_buf |= (value << bi_valid); { if (outcnt < 0x40000 - 2) { outbuf[outcnt++] = (uch)((bi_buf) & 0xff); outbuf[outcnt++] = (uch)((ush)(bi_buf) >> 8); } else { { outbuf[outcnt++] = (uch)((uch)((bi_buf) & 0xff)); if (outcnt == 0x40000) flush_outbuf(); }; { outbuf[outcnt++] = (uch)((uch)((ush)(bi_buf) >> 8)); if (outcnt == 0x40000) flush_outbuf(); }; } }; bi_buf = (ush)value >> ((8 * 2 * sizeof(char)) - bi_valid); bi_valid += length - (8 * 2 * sizeof(char)); } else { bi_buf |= value << bi_valid; bi_valid += length; } }
long long send_bits(unsigned long a0, unsigned long a1) { int tmp_22; int tmp_55; int tmp_13; int tmp_34; unsigned long long v1; if (16 - a1 >= bi_valid) { bi_buf = bi_buf | (a0 << (bi_valid & 31)); v1 = a1 + bi_valid; bi_valid = a1 + bi_valid; } else { bi_buf = bi_buf | (a0 << (bi_valid & 31)); if (outcnt <= 262141) { tmp_22 = outcnt; outcnt = outcnt + 1; (&outbuf)[tmp_22] = bi_buf; tmp_55 = outcnt; outcnt = outcnt + 1; (&outbuf)[tmp_55] = bi_buf >> 8; } else { tmp_13 = outcnt; outcnt = outcnt + 1; (&outbuf)[tmp_13] = bi_buf; if (outcnt == 0x40000) flush_outbuf(); tmp_34 = outcnt; outcnt = outcnt + 1; (&outbuf)[tmp_34] = bi_buf >> 8; if (outcnt == 0x40000) flush_outbuf(); } bi_buf = a0 >> ((16 - bi_valid) & 31); v1 = a1 + bi_valid - 16; bi_valid = a1 + bi_valid - 16; } return v1; }
gzip-1.12
angr_phoenix
static Authmethod *authmethod_lookup(Authctxt *authctxt, const char *name) { Authmethod *method; if ((method = authmethod_byname(name)) == ((void *)0)) return ((void *)0); if (method->enabled == ((void *)0) || *(method->enabled) == 0) { sshlog("auth2.c", __func__, 537, 1, SYSLOG_LEVEL_DEBUG3, ((void *)0), "method %s not enabled", name); return ((void *)0); } if (!auth2_method_allowed(authctxt, method->name, ((void *)0))) { sshlog("auth2.c", __func__, 541, 1, SYSLOG_LEVEL_DEBUG3, ((void *)0), "method %s not allowed " "by AuthenticationMethods", name); return ((void *)0); } return method; }
long *authmethod_lookup(long a1, const char *a2) { long v3; v3 = authmethod_byname(a2); if (!v3) return 0LL; if (*(_QWORD *)(v3 + 24) && **(_DWORD **)(v3 + 24)) { if ((unsigned int)auth2_method_allowed(a1, *(const char **)v3, 0LL)) { return (long *)v3; } else { sshlog("auth2.c", "authmethod_lookup", 541LL, 1LL, 7LL, 0LL, "method %s not allowed by AuthenticationMethods", a2); return 0LL; } } else { sshlog("auth2.c", "authmethod_lookup", 537LL, 1LL, 7LL, 0LL, "method %s not enabled", a2); return 0LL; } }
openssh-portable
ida
void print_cert_info(gnutls_session_t session, int verbose, int print_cert) { print_cert_info2(session, verbose, stdout, print_cert); }
long print_cert_info(long a1, int a2, int a3) { return print_cert_info2(a1, a2, stdout, a3); }
gnutls
ida
void set_pipestatus_from_exit(s) int s; { static int v[2] = {0, -1}; v[0] = s; set_pipestatus_array(v, 1); }
unsigned long set_pipestatus_from_exit(int a1) { v_11751 = a1; return set_pipestatus_array(&v_11751, 1); }
bash
ida
static _Bool parse_noop(const struct parser_table *entry, char **argv, int *arg_ptr) { (void)entry; return parse_true(get_noop(), argv, arg_ptr); }
void parse_noop(unsigned long a0, unsigned int a1, unsigned int a2) { unsigned long v0; unsigned long long v2; v0 = a0; v2 = parse_true(get_noop(), a1, a2); return; }
findutils
angr_dream
static UNDO_LIST *alloc_undo_entry(enum undo_code what, int start, int end, char *text) { UNDO_LIST *temp; temp = (UNDO_LIST *)xmalloc(sizeof(UNDO_LIST)); temp->what = what; temp->start = start; temp->end = end; temp->text = text; temp->next = (UNDO_LIST *)((void *)0); return temp; }
undefined8 *alloc_undo_entry(undefined4 param_1, undefined4 param_2, undefined4 param_3, undefined8 param_4) { undefined8 *puVar1; puVar1 = (undefined8 *)xmalloc(0x20); *(undefined4 *)(puVar1 + 3) = param_1; *(undefined4 *)(puVar1 + 1) = param_2; *(undefined4 *)((long)puVar1 + 0xc) = param_3; puVar1[2] = param_4; *puVar1 = 0; return puVar1; }
bash
ghidra
int findpty(int *master, int *slave, char *name) { char pty[16]; char tty[16]; int i, j; int found; if (openpty(master, slave, name, ((void *)0), ((void *)0)) >= 0) return 0; found = 0; for (i = 'p'; i <= 'z'; i++) { for (j = '0'; j <= 'f'; j++) { if (j == '9' + 1) j = 'a'; sprintf(pty, "/dev/pty%c%c", i, j); sprintf(tty, "/dev/tty%c%c", i, j); if ((*master = open(pty, 02 | 0400)) >= 0) { *slave = open(tty, 02 | 0400); if (*slave >= 0) { found = 1; break; } } } if (found) break; } if (!found) return -1; if (name) strcpy(name, tty); return 0; }
undefined8 findpty(int *param_1, int *param_2, char *param_3) { bool bVar1; int iVar2; undefined8 uVar3; long in_FS_OFFSET; uint local_44; uint local_40; char local_38[16]; char local_28[24]; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); iVar2 = openpty(param_1, param_2, param_3, 0, 0); if (iVar2 < 0) { bVar1 = false; for (local_44 = 0x70; (int)local_44 < 0x7b; local_44 = local_44 + 1) { for (local_40 = 0x30; (int)local_40 < 0x67; local_40 = local_40 + 1) { if (local_40 == 0x3a) { local_40 = 0x61; } sprintf(local_38, "/dev/pty%c%c", (ulong)local_44, (ulong)local_40); sprintf(local_28, "/dev/tty%c%c", (ulong)local_44); iVar2 = open(local_38, 0x102); *param_1 = iVar2; if (-1 < *param_1) { iVar2 = open(local_28, 0x102); *param_2 = iVar2; if (-1 < *param_2) { bVar1 = true; break; } } } if (bVar1) break; } if (bVar1) { if (param_3 != (char *)0x0) { strcpy(param_3, local_28); } uVar3 = 0; } else { uVar3 = 0xffffffff; } } else { uVar3 = 0; } if (local_10 == *(long *)(in_FS_OFFSET + 0x28)) { return uVar3; } __stack_chk_fail(); }
sysvinit
ghidra
void usage(int status) { if (status != 0) do { fprintf(stderr, gettext("Try '%s --help' for more information.\n"), program_name); } while (0); else { printf(gettext("Usage: %s [OPTION]... [INPUT [OUTPUT]]\n") , program_name); fputs_unlocked( gettext( "Filter adjacent matching lines from INPUT (or standard " "input),\nwriting to OUTPUT (or standard output).\n\nWith no " "options, matching lines are merged to the first occurrence.\n"), stdout) ; emit_mandatory_arg_note(); fputs_unlocked(gettext(" -c, --count prefix lines by the number " "of occurrences\n -d, --repeated only print " "duplicate lines, one for each group\n"), stdout) ; fputs_unlocked( gettext( " -D print all duplicate lines\n " "--all-repeated[=METHOD] like -D, but allow separating groups\n " " with an empty line;\n " " METHOD={none(default),prepend,separate}\n"), stdout) ; fputs_unlocked( gettext(" -f, --skip-fields=N avoid comparing the first N fields\n"), stdout) ; fputs_unlocked( gettext(" --group[=METHOD] show all items, separating groups " "with an empty line;\n " "METHOD={separate(default),prepend,append,both}\n"), stdout) ; fputs_unlocked( gettext( " -i, --ignore-case ignore differences in case when " "comparing\n -s, --skip-chars=N avoid comparing the first N " "characters\n -u, --unique only print unique lines\n"), stdout) ; fputs_unlocked( gettext( " -z, --zero-terminated line delimiter is NUL, not newline\n"), stdout) ; fputs_unlocked(gettext(" -w, --check-chars=N compare no more than N " "characters in lines\n"), stdout) ; fputs_unlocked(gettext(" --help display this help and exit\n"), stdout); fputs_unlocked( gettext(" --version output version information and exit\n"), stdout); fputs_unlocked( gettext( "\nA field is a run of blanks (usually spaces and/or TABs), then " "non-blank\ncharacters. Fields are skipped before chars.\n"), stdout) ; fputs_unlocked( gettext("\nNote: 'uniq' does not detect repeated lines unless they are " "adjacent.\nYou may want to sort the input first, or use 'sort " "-u' without 'uniq'.\n"), stdout) ; emit_ancillary_info("uniq"); } exit(status); }
void usage(unsigned long a0) { unsigned long v0; unsigned long v2; v0 = v2; if (a0) { fprintf(stderr, gettext("Try '%s --help' for more information.\n")); } else { printf(gettext("Usage: %s [OPTION]... [INPUT [OUTPUT]]\n")); fputs_unlocked( gettext( "Filter adjacent matching lines from INPUT (or standard " "input),\nwriting to OUTPUT (or standard output).\n\nWith no " "options, matching lines are merged to the first occurrence.\n"), stdout); emit_mandatory_arg_note(); fputs_unlocked(gettext(" -c, --count prefix lines by the number " "of occurrences\n -d, --repeated only print " "duplicate lines, one for each group\n"), stdout); fputs_unlocked( gettext( " -D print all duplicate lines\n " "--all-repeated[=METHOD] like -D, but allow separating groups\n " " with an empty line;\n " " METHOD={none(default),prepend,separate}\n"), stdout); fputs_unlocked( gettext(" -f, --skip-fields=N avoid comparing the first N fields\n"), stdout); fputs_unlocked( gettext(" --group[=METHOD] show all items, separating groups " "with an empty line;\n " "METHOD={separate(default),prepend,append,both}\n"), stdout); fputs_unlocked( gettext( " -i, --ignore-case ignore differences in case when " "comparing\n -s, --skip-chars=N avoid comparing the first N " "characters\n -u, --unique only print unique lines\n"), stdout); fputs_unlocked( gettext( " -z, --zero-terminated line delimiter is NUL, not newline\n"), stdout); fputs_unlocked(gettext(" -w, --check-chars=N compare no more than N " "characters in lines\n"), stdout); fputs_unlocked(gettext(" --help display this help and exit\n"), stdout); fputs_unlocked( gettext(" --version output version information and exit\n"), stdout); fputs_unlocked( gettext( "\nA field is a run of blanks (usually spaces and/or TABs), then " "non-blank\ncharacters. Fields are skipped before chars.\n"), stdout); fputs_unlocked( gettext("\nNote: 'uniq' does not detect repeated lines unless they are " "adjacent.\nYou may want to sort the input first, or use 'sort " "-u' without 'uniq'.\n"), stdout); emit_ancillary_info("uniq"); } exit(a0); }
coreutils
angr_dream
struct redirtab *pushredir(union node *redir) { struct redirtab *sv; struct redirtab *q; int i; q = redirlist; if (!redir) goto out; sv = ckmalloc(sizeof(struct redirtab)); sv->next = q; redirlist = sv; for (i = 0; i < 10; i++) sv->renamed[i] = -2; out: return q; }
long long pushredir(unsigned long a0) { unsigned int v0; unsigned long long v1; unsigned long long *v2; v1 = 399668583475215753; if (!a0) return v1; v2 = ckmalloc(0x30); *(v2) = v1; redirlist = v2; for (v0 = 0; v0 <= 9; v0 += 1) { *((8 + v2 + 4 * v0)) = -2; } return v1; }
dash-0.5.11+git20210903+057cd650a4ed
angr_sailr
int bash_delete_last_history() { register int i; HIST_ENTRY **hlist, *histent; int r; hlist = history_list(); if (hlist == ((void *)0)) return 0; for (i = 0; hlist[i]; i++) ; i--; histent = history_get(history_base + i); if (histent == ((void *)0)) return 0; r = bash_delete_histent(i); if (where_history() > history_length) history_set_pos(history_length); return r; }
undefined4 bash_delete_last_history(void) { undefined4 uVar1; int iVar2; long lVar3; lVar3 = history_list(); if (lVar3 == 0) { uVar1 = 0; } else { iVar2 = 0; while (*(long *)(lVar3 + (long)iVar2 * 8) != 0) { iVar2 = iVar2 + 1; } lVar3 = history_get(history_base + iVar2 + -1); if (lVar3 == 0) { uVar1 = 0; } else { uVar1 = bash_delete_histent(iVar2 + -1); iVar2 = where_history(); if (history_length < iVar2) { history_set_pos(history_length); } } } return uVar1; }
bash
ghidra
static void option_conflict_error(const char *a, const char *b) { do { if (error_hook) error_hook(); error(0, 0, gettext("'%s' cannot be used with '%s'"), a, b); usage(2); } while (0); }
void option_conflict_error(undefined8 param_1, undefined8 param_2) { undefined8 uVar1; if (error_hook != (code *)0x0) { (*error_hook)(); } uVar1 = gettext("\'%s\' cannot be used with \'%s\'"); error(0, 0, uVar1, param_1, param_2); usage(2); }
tar
ghidra
static void display_all(struct termios *mode, char const *device_name) { int i; tcflag_t *bitsp; unsigned long mask; enum mode_type prev_type = control; display_speed(mode, 1); display_window_size(1, device_name); wrapf("line = %d;", mode->c_line); putchar_unlocked('\n'); current_col = 0; for (i = 0; !(strcmp(control_info[i].name, "min") == 0); ++i) { if ((strcmp(control_info[i].name, "flush") == 0)) continue; wrapf("%s = %s;", control_info[i].name, visible(mode->c_cc[control_info[i].offset])); } wrapf("min = %lu; time = %lu;", (unsigned long int)mode->c_cc[6], (unsigned long int)mode->c_cc[5]); if (current_col != 0) putchar_unlocked('\n'); current_col = 0; for (i = 0; mode_info[i].name != ((void *)0); ++i) { if (mode_info[i].flags & 8) continue; if (mode_info[i].type != prev_type) { putchar_unlocked('\n'); current_col = 0; prev_type = mode_info[i].type; } bitsp = mode_type_flag(mode_info[i].type, mode); mask = mode_info[i].mask ? mode_info[i].mask : mode_info[i].bits; ((void)sizeof((bitsp) ? 1 : 0), __extension__({ if (bitsp) ; else __assert_fail("bitsp", "src/stty.c", 2037, __extension__ __PRETTY_FUNCTION__); })); if ((*bitsp & mask) == mode_info[i].bits) wrapf("%s", mode_info[i].name); else if (mode_info[i].flags & 4) wrapf("-%s", mode_info[i].name); } putchar_unlocked('\n'); current_col = 0; }
void display_all(unsigned long a0, unsigned long long a1) { unsigned int v0; unsigned int v1; unsigned int *v2; unsigned long v3; unsigned long long v6; v1 = 0; display_speed(a0, 0x1); display_window_size(0x1, a1); wrapf(); putchar_unlocked(0xa); current_col = 0; for (v0 = 0; strcmp(control_info[2 * v0 + v0], "min"); v0 += 1) { if (strcmp(control_info[2 * v0 + v0], "flush")) { visible(*((a0 + (&g_406ff0)[3 * v0] + 17))); wrapf(); } } wrapf(); if (current_col) putchar_unlocked(0xa); current_col = 0; for (v0 = 0; mode_info[4 * v0]; v0 += 1) { if (!(g_4064ac[32 * v0] & 8)) { if (v1 != g_4064a8[8 * v0]) { putchar_unlocked(0xa); current_col = 0; v1 = g_4064a8[8 * v0]; } v2 = mode_type_flag(g_4064a8[8 * v0], a0); *(&v3) = (!g_4064b8[4 * v0] ? g_4064b8[4 * v0] : g_4064b0[4 * v0]); if (!v2) { __assert_fail(); } else if ((*(v2)&v3) == g_4064b0[4 * v0]) { wrapf(); } else if ((g_4064ac[32 * v0] & 4)) { wrapf(); } } } v6 = putchar_unlocked(0xa); current_col = 0; return; }
coreutils
angr_sailr
static inline size_t xsum(size_t size1, size_t size2) { size_t sum = size1 + size2; return (sum >= size1 ? sum : (18446744073709551615UL)); }
int xsum(unsigned long a0, unsigned long a1) { unsigned long v0; unsigned int v2; v0 = a1 + a0; if (v0 < a0) v2 = -1; else v2 = v0; return v2; }
gnutls
angr_phoenix
static int displen(s) const char *s; { wchar_t *wcstr; size_t slen; int wclen; wcstr = 0; slen = mbstowcs(wcstr, s, 0); if (slen == -1) slen = 0; wcstr = (wchar_t *)sh_xmalloc((sizeof(wchar_t) * (slen + 1)), "execute_cmd.c", 3215); mbstowcs(wcstr, s, slen + 1); wclen = wcswidth(wcstr, slen); sh_xfree((wcstr), "execute_cmd.c", 3218); return (wclen < 0 ? (((s) && (s)[0]) ? ((s)[1] ? ((s)[2] ? strlen(s) : 2) : 1) : 0) : wclen); }
int displen(char a0[3]) { unsigned int v0; void *v1; void *v2; unsigned int v4; v2 = 0; v1 = mbstowcs(v2, a0, 0x0); if (v1 == -1) v1 = 0; v2 = sh_xmalloc((v1 + 1) * 4, "execute_cmd.c", 0xc8f); mbstowcs(v2, a0, v1 + 1); v0 = wcswidth(v2, v1, v1); sh_xfree(v2, "execute_cmd.c", 0xc92); if (v0 < 0) { if (a0 && a0[0]) { if (!a0[1]) { v4 = 1; } else if (a0[2]) { v4 = strlen(a0); } else { v4 = 2; } } if (!a0 || !a0[0]) v4 = 0; } else { v4 = v0; } return v4; }
bash
angr_dream
static rsRetVal writeFile(instanceData *__restrict__ const pData, const actWrkrIParams_t *__restrict__ const pParam, const int iMsg) { rsRetVal iRet = RS_RET_OK; if (GatherStats) ((void)__sync_fetch_and_add(&pData->ctrRequests, 1)); ; if (pData->bDynamicName) { if (Debug) { r_dbgprintf("omfile.c", "omfile: file to log to: %s\n", (pParam[(iMsg * pData->iNumTpls) + 1]).param); }; if ((iRet = prepareDynFile( pData, (pParam[(iMsg * pData->iNumTpls) + 1]).param)) != RS_RET_OK) goto finalize_it; } else { if (pData->pStrm == ((void *)0)) { if ((iRet = prepareFile(pData, pData->fname)) != RS_RET_OK) goto finalize_it; if (pData->pStrm == ((void *)0)) { parser_errmsg("Could not open output file '%s'", pData->fname); } } pData->nInactive = 0; } iRet = doWrite(pData, (pParam[(iMsg * pData->iNumTpls) + 0]).param, (pParam[(iMsg * pData->iNumTpls) + 0]).lenStr); finalize_it: return iRet; }
void writeFile(struct_0 *a0, unsigned long long *a1, unsigned long a2, unsigned long a3, unsigned long a4, unsigned long a5) { unsigned int v0; int tmp_6; int tmp_4; int tmp_2; unsigned long long v3; v0 = 0; if (GatherStats) { LABEL_401859: *(&a0[4].padding_30[4]) = *(&a0[4].padding_30[4]) + 1; tmp_6 = BinaryOp CasCmpNE; if (tmp_6) goto LABEL_401859; else goto LABEL_40185e; } LABEL_40185e: if (a0->field_42) { if (Debug) r_dbgprintf("omfile.c", "omfile: file to log to: %s\n"); v0 = prepareDynFile(a0, a1[2 + 2 * a2 * a0->field_54], a1[2 + 2 * a2 * a0->field_54], a3, a4, a5); if (!(!v0)) goto LABEL_4019bd; } else { if (!a0->field_38) { v0 = prepareFile(a0, a0->field_28); if (!(!v0)) goto LABEL_4019bd; if (!a0->field_38) parser_errmsg("Could not open output file '%s'"); } a0->field_40 = 0; } v0 = doWrite(a0, a1[2 * a2 * a0->field_54], *((&a1[1 + 2 * a2 * a0->field_54] + 4))); LABEL_4019bd: v3 = v0; return; }
rsyslog-8.2210.0
angr_phoenix
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; }
void do_download_sk(unsigned long long a0, unsigned long long a1) { unsigned int v0; unsigned int v1; char v2; char v3; char v4; char v5; unsigned long long v6; void *v7; char *v8; struct_0 *v9; unsigned long v10; char *v11; unsigned long long v12; unsigned long long v13; unsigned long v14; unsigned long v15; unsigned long long v16; unsigned long long v17; char v18; unsigned long long v19; unsigned long long v20; unsigned long long v21; unsigned long long v22; unsigned long long v23; unsigned long long v24; unsigned long v25; unsigned int v27; unsigned int v28; unsigned long long v31; unsigned long long v32; v0 = -1; v8 = 0; v7 = 0; if (!a0) sshfatal("ssh-keygen.c", "do_download_sk", 0xc42, 0x0, 0x1, 0x0, "Cannot download keys without provider"); v8 = read_passphrase("Enter PIN for authenticator: ", 0x2); if (!quiet) printf("You may need to touch your authenticator to authorize key " "download.\n"); v1 = sshsk_load_resident(a0, a1, v8, 0x0, &v2, &v3); if (v1) { if (v8) { v20 = strlen(v8); freezero(v8, v20, v20); } v16 = "Unable to load resident keys"; sshlog("ssh-keygen.c", "do_download_sk", 0xc4d, 0x0, 0x2, ssh_err(v1), *(&v18), v19); v22 = 4294967295; } else { if (!*(&v3)) { v16 = "No keys to download"; sshlog("ssh-keygen.c", "do_download_sk", 0xc51, 0x0, 0x3, 0x0, *(&v18), v19); } if (v8) { v21 = strlen(v8); freezero(v8, v21, v21); } v6 = 0; while (true) { if (v6 >= *(&v3)) break; v9 = *(*((*(&v2) + v6 * 8))); if (v9->field_0 != 10 && v9->field_0 != 12) { v16 = v9->field_0; v15 = sshkey_type(v9); v14 = "Unsupported key type %s (%d)"; sshlog("ssh-keygen.c", "do_download_sk", 0xc58, 0x0, 0x2, 0x0, *(&v18), v19); goto LABEL_40ce86; } v10 = sshkey_fingerprint(v9, fingerprint_hash, 0x0, fingerprint_hash); if (!v10) { v16 = "sshkey_fingerprint failed"; sshfatal("ssh-keygen.c", "do_download_sk", 0xc5e, 0x1, 0x1, 0x0, *(&v18)); } v17 = v9->field_68; v16 = v9->field_60; v15 = v10; v14 = sshkey_type(v9); v13 = v6; v12 = "key %zu: %s %s %s (flags 0x%02x)"; sshlog("ssh-keygen.c", "do_download_sk", 0xc5f, 0x1, 0x5, 0x0, *(&v18), v19); v11 = sk_suffix(v9->field_60, *((*((*(&v2) + v6 * 8)) + 8)), *((*((*(&v2) + v6 * 8)) + 16))); if (!*(v11)) v23 = &g_410d75; else v23 = "_"; if (v9->field_0 != 10) v24 = "ed25519_sk"; else v24 = "ecdsa_sk"; v25 = v23; xasprintf(&v4, "id_%s_rk%s%s", v24, v23); if (!confirm_overwrite(*(&v4))) { free(*(&v4)); break; } else { if (!v7) v7 = private_key_passphrase(); v16 = rounds; v1 = sshkey_save_private(v9, *(&v4), v7, v9->field_60, private_key_format, openssh_format_cipher); if (v1) { v17 = *(&v4); v16 = "Saving key \"%s\" failed"; sshlog("ssh-keygen.c", "do_download_sk", 0xc73, 0x0, 0x2, ssh_err(v1), *(&v18), v19); free(*(&v4)); break; } else { if (!quiet) { if (!*(v11)) v27 = &g_410d75; else v27 = v9->field_60; if (!*(v11)) v28 = &g_410d75; else v28 = " "; *(&v25) = v27; printf("Saved %s key%s%s to %s\n", sshkey_type(v9), v28, v27, *(&v4)); } xasprintf(&v5, "%s.pub", *(&v4), v25); free(*(&v4)); v1 = sshkey_save_public(v9, *(&v5), v9->field_60, *(&v5)); if (!v1) { free(*(&v5)); } else { v17 = *(&v5); v16 = "Saving public key \"%s\" failed"; sshlog("ssh-keygen.c", "do_download_sk", 0xc83, 0x0, 0x2, ssh_err(v1), *(&v18), v19); free(*(&v5)); break; } } } LABEL_40ce86: v6 += 1; } if (v6 >= *(&v3)) v0 = 0; if (v7) { v31 = strlen(v7); freezero(v7, v31, v31); } sshsk_free_resident_keys(*(&v2), *(&v3), *(&v3)); v32 = v0; } return; }
openssh-portable
angr_phoenix
static void add_literal_segment(struct transform *tf, const char *str, const char *end) { size_t len = end - str; if (len) { struct replace_segm *segm = add_segment(tf); segm->type = segm_literal; segm->v.literal.ptr = xmalloc(len + 1); memcpy(segm->v.literal.ptr, str, len); segm->v.literal.ptr[len] = 0; segm->v.literal.size = len; } }
_QWORD *add_literal_segment(long a1, _BYTE *a2, _BYTE *a3) { _QWORD *result; size_t n; _QWORD *v5; result = (_QWORD *)(a3 - a2); n = a3 - a2; if (a3 != a2) { v5 = add_segment(a1); *((_DWORD *)v5 + 2) = 0; v5[2] = xmalloc(n + 1); memcpy((void *)v5[2], a2, n); *(_BYTE *)(v5[2] + n) = 0; result = v5; v5[3] = n; } return result; }
tar
ida
void e2fsck_validate_quota_inodes(e2fsck_t ctx) { struct ext2_super_block *sb = ctx->fs->super; struct problem_context pctx; ext2_filsys fs = ctx->fs; enum quota_type qtype; clear_problem_context(&pctx); for (qtype = 0; qtype < MAXQUOTAS; qtype++) { pctx.ino = *quota_sb_inump(sb, qtype); pctx.num = qtype; if (pctx.ino && ((pctx.ino == 1) || (pctx.ino == 2) || (pctx.ino == 5) || (pctx.ino == 6) || (pctx.ino == 7) || (pctx.ino == 8) || (pctx.ino == 9) || (pctx.ino == 10) || (pctx.ino > fs->super->s_inodes_count)) && fix_problem(ctx, 0x00004F, &pctx)) { *quota_sb_inump(sb, qtype) = 0; ext2fs_mark_super_dirty(fs); } } }
long long e2fsck_validate_quota_inodes(struct struct_0 **a0) { unsigned int v0; unsigned int v1; struct_1 *v2; char v3; unsigned int v4; unsigned long v5; *(&v1) = *(a0)->field_20; v2 = &*(a0)->padding_0; clear_problem_context(&v3); for (v0 = 0; v0 <= 2; v0 += 1) { v4 = *(quota_sb_inump(*(&v1), v0)); v5 = v0; if (v4 && (v4 == 1 || v4 == 6 || v4 == 5 || v4 == 2 || v4 == 10 || v4 == 8 || v4 == 7 || v4 == 9 || v4 != 1 && v4 != 6 && v4 != 5 && v4 != 2 && v4 != 10 && v4 != 8 && v4 != 7 && v4 > v2->field_20->field_0 && v4 != 9) && fix_problem(a0, 0x4f, &v3)) { *(quota_sb_inump(*(&v1), v0)) = 0; ext2fs_mark_super_dirty(v2); } } return 0; }
e2fsprogs-1.46.5
angr_dream
static inline void emit_mandatory_arg_note(void) { fputs_unlocked(gettext("\nMandatory arguments to long options are mandatory " "for short options too.\n"), stdout) ; }
void emit_mandatory_arg_note(void) { char *__s; FILE *__stream; __stream = stdout; __s = (char *)gettext("\nMandatory arguments to long options are mandatory " "for short options too.\n"); fputs_unlocked(__s, __stream); return; }
coreutils
ghidra
int sh_contains_quotes(string) const char *string; { const char *s; for (s = string; s && *s; s++) { if (*s == '\'' || *s == '"' || *s == '\\') return 1; } return 0; }
undefined8 sh_contains_quotes(char *param_1) { char *local_10; local_10 = param_1; while (true) { if ((local_10 == (char *)0x0) || (*local_10 == '\0')) { return 0; } if (((*local_10 == '\'') || (*local_10 == '\"')) || (*local_10 == '\\')) break; local_10 = local_10 + 1; } return 1; }
bash
ghidra
void builtin_error (const char *format, ...) { va_list args; builtin_error_prolog(); __builtin_va_start(args, format); vfprintf(stderr, format, args); __builtin_va_end(args); fprintf(stderr, "\n"); }
unsigned long builtin_error(const char *a1, long a2, long a3, long a4, long a5, long a6, ...) { gcc_va_list arg; unsigned long v8; long v9; long v10; long v11; long v12; long v13; va_start(arg, a6); v9 = a2; v10 = a3; v11 = a4; v12 = a5; v13 = a6; v8 = __readfsqword(0x28u); builtin_error_prolog(); arg[0].gp_offset = 8; vfprintf(stderr, a1, arg); fprintf(stderr, "\n"); return __readfsqword(0x28u) ^ v8; }
bash
ida
void read_crq_set(gnutls_x509_crq_t crq, const char *input_str, const char *oid) { ssize_t ret; char *lineptr = ((void *)0); size_t linesize = 0; fputs(input_str, stderr); ret = getline(&lineptr, &linesize, stdin); if (ret == -1) return; if (((lineptr[0] == '\n') || (lineptr[0] == '\r'))) { free(lineptr); return; } linesize = strip_nl(lineptr, ret); ret = gnutls_x509_crq_set_dn_by_oid(crq, oid, 0, lineptr, linesize); if (ret < 0) { fprintf(stderr, "set_dn: %s\n", gnutls_strerror(ret)); exit(1); } free(lineptr); }
void read_crq_set(undefined8 param_1, char *param_2) { fputs(param_2, *ppFRam0000000000104509); }
gnutls
ghidra
static HostStatus check_hostkeys_by_key_or_type(struct hostkeys *hostkeys, struct sshkey *k, int keytype, int nid, const struct hostkey_entry **found) { u_int i; HostStatus end_return = HOST_NEW; int want_cert = sshkey_is_cert(k); HostkeyMarker want_marker = want_cert ? MRK_CA : MRK_NONE; if (found != ((void *)0)) *found = ((void *)0); for (i = 0; i < hostkeys->num_entries; i++) { if (hostkeys->entries[i].marker != want_marker) continue; if (k == ((void *)0)) { if (hostkeys->entries[i].key->type != keytype) continue; if (nid != -1 && sshkey_type_plain(keytype) == KEY_ECDSA && hostkeys->entries[i].key->ecdsa_nid != nid) continue; end_return = HOST_FOUND; if (found != ((void *)0)) *found = hostkeys->entries + i; k = hostkeys->entries[i].key; break; } if (want_cert) { if (sshkey_equal_public(k->cert->signature_key, hostkeys->entries[i].key)) { end_return = HOST_OK; if (found != ((void *)0)) *found = hostkeys->entries + i; break; } } else { if (sshkey_equal(k, hostkeys->entries[i].key)) { end_return = HOST_OK; if (found != ((void *)0)) *found = hostkeys->entries + i; break; } end_return = HOST_CHANGED; if (found != ((void *)0)) *found = hostkeys->entries + i; } } if (check_key_not_revoked(hostkeys, k) != 0) { end_return = HOST_REVOKED; if (found != ((void *)0)) *found = ((void *)0); } return end_return; }
long check_hostkeys_by_key_or_type(long a1, long a2, unsigned int a3, int a4, _QWORD *a5) { int v5; int v6; unsigned int i; unsigned int v12; int is_cert; int v14; v12 = 1; is_cert = sshkey_is_cert(a2); if (is_cert) v5 = 3; else v5 = 1; v14 = v5; if (a5) *a5 = 0LL; for (i = 0;; ++i) { if (i >= *(_DWORD *)(a1 + 8)) goto LABEL_27; if (v14 != *(_DWORD *)(*(_QWORD *)a1 + 40LL * i + 32)) continue; if (!a2) break; if (is_cert) { if (!(unsigned int)sshkey_equal_public( *(_QWORD *)(*(_QWORD *)(a2 + 128) + 80LL), *(_QWORD *)(*(_QWORD *)a1 + 40LL * i + 24))) continue; v12 = 0; if (a5) *a5 = *(_QWORD *)a1 + 40LL * i; LABEL_27: v6 = check_key_not_revoked(a1, a2); goto LABEL_28; } if ((unsigned int)sshkey_equal( a2, *(_QWORD *)(*(_QWORD *)a1 + 40LL * i + 24))) { v12 = 0; if (a5) *a5 = *(_QWORD *)a1 + 40LL * i; goto LABEL_27; } v12 = 2; if (a5) *a5 = *(_QWORD *)a1 + 40LL * i; LABEL_25:; } if (a3 != **(_DWORD **)(*(_QWORD *)a1 + 40LL * i + 24) || a4 != -1 && (unsigned int)sshkey_type_plain(a3) == 2 && a4 != *(_DWORD *)(*(_QWORD *)(*(_QWORD *)a1 + 40LL * i + 24) + 24LL)) { goto LABEL_25; } v12 = 4; if (a5) *a5 = *(_QWORD *)a1 + 40LL * i; v6 = check_key_not_revoked(a1, *(_QWORD *)(*(_QWORD *)a1 + 40LL * i + 24)); LABEL_28: if (v6) { v12 = 3; if (a5) *a5 = 0LL; } return v12; }
openssh-portable
ida
static void mtime_coder(struct tar_stat_info const *st, char const *keyword, struct xheader *xhdr, void const *data) { struct timespec const *mtime = data; code_time(mtime ? *mtime : st->mtime, keyword, xhdr); }
void mtime_coder(long param_1, undefined8 param_2, undefined8 param_3, undefined8 *param_4) { undefined8 uVar1; undefined8 uVar2; if (param_4 == (undefined8 *)0x0) { uVar2 = *(undefined8 *)(param_1 + 0x100); uVar1 = *(undefined8 *)(param_1 + 0xf8); } else { uVar2 = param_4[1]; uVar1 = *param_4; } code_time(uVar1, uVar2, param_2, param_3, uVar1, uVar2); return; }
tar
ghidra
static int channel_handle_efd_write(struct ssh *ssh, Channel *c) { int r; ssize_t len; if ((c->io_ready & 0x08) == 0) return 1; if (sshbuf_len(c->extended) == 0) return 1; len = write(c->efd, sshbuf_ptr(c->extended), sshbuf_len(c->extended)); sshlog("channels.c", __func__, 2112, 0, SYSLOG_LEVEL_DEBUG2, ((void *)0), "channel %d: written %zd to efd %d", c->self, len, c->efd); if (len == -1 && ((*__errno_location()) == 4 || (*__errno_location()) == 11 || (*__errno_location()) == 11)) return 1; if (len <= 0) { sshlog("channels.c", __func__, 2117, 0, SYSLOG_LEVEL_DEBUG2, ((void *)0), "channel %d: closing write-efd %d", c->self, c->efd); channel_close_fd(ssh, c, &c->efd); } else { if ((r = sshbuf_consume(c->extended, len)) != 0) sshfatal("channels.c", __func__, 2121, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "channel %i: consume", c->self); c->local_consumed += len; } return 1; }
void channel_handle_efd_write(unsigned int a0, struct_0 *a1) { unsigned long v0; unsigned long v1; unsigned long v2; unsigned int v3; unsigned long long v4; unsigned long long v6; unsigned long long v7; unsigned long long v8; unsigned long long v9; unsigned long long v10; if (!(a1->field_30 & 8)) { v6 = 1; } else { v7 = sshbuf_len(a1->field_78); if (!v7) { v8 = 1; } else { v4 = write(a1->field_24, sshbuf_ptr(a1->field_78), sshbuf_len(a1->field_78)); v2 = a1->field_24; v1 = v4; v0 = a1->field_4; sshlog("channels.c", "channel_handle_efd_write", 0x840, 0x0, 0x6, 0x0, "channel %d: written %zd to efd %d"); if (v4 == -1) { *(&v7) = *(__errno_location()); if (v7 != 4) { *(&v7) = *(__errno_location()); if (v7 != 11) *(&v7) = *(__errno_location()); } if (v7 == 11 || v7 == 4) v9 = 1; } if (v4 != -1 || v7 != 11 && v7 != 4) { if (v4 <= 0) { v1 = a1->field_24; v0 = a1->field_4; sshlog("channels.c", "channel_handle_efd_write", 0x845, 0x0, 0x6, 0x0, "channel %d: closing write-efd %d"); channel_close_fd(a0, a1, &a1->field_24); } else { v3 = sshbuf_consume(a1->field_78, v4, v4); if (v3) { v2 = a1->field_4; v1 = "channel %i: consume"; sshfatal("channels.c", "channel_handle_efd_write", 0x849, 0x1, 0x1, ssh_err(v3)); } a1->field_b8 = v4 + a1->field_b8; } v10 = 1; } } } return; }
openssh-portable
angr_dream
) { int devmajor = gnu_dev_major(st->stat.st_rdev); int devminor = gnu_dev_minor(st->stat.st_rdev); if (archive_format == POSIX_FORMAT && ((sizeof(header->header.devmajor) - 1) * (3) < sizeof(uintmax_t) * 8 ? ((uintmax_t)1 << ((sizeof(header->header .devmajor) - 1) * (3))) - 1 : (uintmax_t)-1) < devmajor) { xheader_store("devmajor", st, ((void *)0)); devmajor = 0; } if (!major_to_chars( devmajor, header->header.devmajor, sizeof(header->header.devmajor))) return ((void *)0); if (archive_format == POSIX_FORMAT && ((sizeof(header->header.devminor) - 1) * (3) < sizeof(uintmax_t) * 8 ? ((uintmax_t)1 << ((sizeof(header->header .devminor) - 1) * (3))) - 1 : (uintmax_t)-1) < devminor) { xheader_store("devminor", st, ((void *)0)); devminor = 0; } if (!minor_to_chars( devminor, header->header.devminor, sizeof(header->header.devminor))) return ((void *)0); }
uint gnu_dev_major(ulonglong __dev) { halt_baddata(); }
tar
ghidra
static void unconsumed_option_report(void) { if (unconsumed_option_tail) { struct name_elt *elt; do { if (error_hook) error_hook(); error(0, 0, gettext("The following options were used after any non-optional " "arguments in archive create or update mode. These " "options are positional and affect only arguments that " "follow them. Please, rearrange them properly.")); exit_status = 2; } while (0); elt = unconsumed_option_tail; while (elt->prev) elt = elt->prev; while (elt) { switch (elt->type) { case NELT_CHDIR: do { if (error_hook) error_hook(); error(0, 0, gettext("-C %s has no effect"), quote(elt->v.name)); exit_status = 2; } while (0); break; case NELT_OPTION: if (elt->v.opt.arg) do { if (error_hook) error_hook(); error(0, 0, gettext("--%s %s has no effect"), file_selection_option_name(elt->v.opt.rpl_option), quote(elt->v.opt.arg)); exit_status = 2; } while (0) ; else do { if (error_hook) error_hook(); error(0, 0, gettext("--%s has no effect"), file_selection_option_name(elt->v.opt.rpl_option)); exit_status = 2; } while (0); break; default: break; } elt = elt->next; } unconsumed_option_free(); } }
void unconsumed_option_report(void) { undefined8 uVar1; undefined8 uVar2; undefined8 uVar3; undefined8 *local_20; if (unconsumed_option_tail != (undefined8 *)0x0) { if (error_hook != (code *)0x0) { (*error_hook)(); } uVar1 = gettext("The following options were used after any non-optional " "arguments in archive create or update mode. These " "options are positional and affect only arguments that " "follow them. Please, rearrange them properly."); error(0, 0, uVar1); for (local_20 = unconsumed_option_tail; local_20[1] != 0; local_20 = (undefined8 *)local_20[1]) { } for (; _exit_status = 2, local_20 != (undefined8 *)0x0; local_20 = (undefined8 *)*local_20) { if (*(int *)(local_20 + 2) == 1) { if (error_hook != (code *)0x0) { (*error_hook)(); } uVar1 = quote(local_20[3]); uVar2 = gettext("-C %s has no effect"); error(0, 0, uVar2, uVar1); } else if (*(int *)(local_20 + 2) == 4) { if (local_20[4] == 0) { if (error_hook != (code *)0x0) { (*error_hook)(); } uVar1 = file_selection_option_name(*(undefined4 *)(local_20 + 3)); uVar2 = gettext("--%s has no effect"); error(0, 0, uVar2, uVar1); } else { if (error_hook != (code *)0x0) { (*error_hook)(); } uVar1 = quote(local_20[4]); uVar2 = file_selection_option_name(*(undefined4 *)(local_20 + 3)); uVar3 = gettext("--%s %s has no effect"); error(0, 0, uVar3, uVar2, uVar1); } } } unconsumed_option_free(); } return; }
tar
ghidra
void monitor_apply_keystate(struct ssh *ssh, struct monitor *pmonitor) { struct kex *kex; int r; sshlog("monitor.c", __func__, 1721, 1, SYSLOG_LEVEL_DEBUG3, ((void *)0), "packet_set_state"); if ((r = ssh_packet_set_state(ssh, child_state)) != 0) sshfatal("monitor.c", __func__, 1723, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "packet_set_state"); sshbuf_free(child_state); child_state = ((void *)0); if ((kex = ssh->kex) == ((void *)0)) sshfatal("monitor.c", __func__, 1727, 1, SYSLOG_LEVEL_FATAL, ((void *)0), "internal error: ssh->kex == NULL"); if (session_id2_len != sshbuf_len(ssh->kex->session_id)) { sshfatal("monitor.c", __func__, 1729, 1, SYSLOG_LEVEL_FATAL, ((void *)0), "incorrect session id length %zu (expected %u)", sshbuf_len(ssh->kex->session_id), session_id2_len); } if (memcmp(sshbuf_ptr(ssh->kex->session_id), session_id2, session_id2_len) != 0) sshfatal("monitor.c", __func__, 1734, 1, SYSLOG_LEVEL_FATAL, ((void *)0), "session ID mismatch"); kex->kex[KEX_DH_GRP1_SHA1] = kex_gen_server; kex->kex[KEX_DH_GRP14_SHA1] = kex_gen_server; kex->kex[KEX_DH_GRP14_SHA256] = kex_gen_server; kex->kex[KEX_DH_GRP16_SHA512] = kex_gen_server; kex->kex[KEX_DH_GRP18_SHA512] = kex_gen_server; kex->kex[KEX_DH_GEX_SHA1] = kexgex_server; kex->kex[KEX_DH_GEX_SHA256] = kexgex_server; kex->kex[KEX_ECDH_SHA2] = kex_gen_server; kex->kex[KEX_C25519_SHA256] = kex_gen_server; kex->kex[KEX_KEM_SNTRUP761X25519_SHA512] = kex_gen_server; kex->load_host_public_key = &get_hostkey_public_by_type; kex->load_host_private_key = &get_hostkey_private_by_type; kex->host_key_index = &get_hostkey_index; kex->sign = sshd_hostkey_sign; }
long long monitor_apply_keystate(struct_0 *a0, unsigned long a1) { unsigned long v0; unsigned int v1; unsigned long long v2; unsigned long v3; unsigned long long v4; char v5; v0 = a1; sshlog("monitor.c", "monitor_apply_keystate", 0x6b9, 0x1, 0x7, 0x0); v1 = ssh_packet_set_state(a0, child_state, child_state); if (v1) sshfatal("monitor.c", "monitor_apply_keystate", 0x6bb, 0x1, 0x1, ssh_err(v1), "packet_set_state"); sshbuf_free(child_state); child_state = 0; v2 = a0->field_8; if (!v2) { v4 = "internal error: ssh->kex == NULL"; sshfatal("monitor.c", "monitor_apply_keystate", 0x6bf, 0x1, 0x1, 0x0, *(&v5)); } if (session_id2_len != sshbuf_len(*((a0->field_8 + 112)))) { v4 = session_id2_len; v3 = sshbuf_len(*((a0->field_8 + 112))); v2 = "incorrect session id length %zu (expected %u)"; sshfatal("monitor.c", "monitor_apply_keystate", 0x6c1, 0x1, 0x1, 0x0, *(&v5)); } if (memcmp(sshbuf_ptr(*((a0->field_8 + 112))), session_id2, session_id2_len)) { v4 = "session ID mismatch"; sshfatal("monitor.c", "monitor_apply_keystate", 0x6c6, 0x1, 0x1, 0x0, *(&v5)); } *((v2 + 200)) = got.kex_gen_server; *((v2 + 208)) = got.kex_gen_server; *((v2 + 216)) = got.kex_gen_server; *((v2 + 224)) = got.kex_gen_server; *((v2 + 232)) = got.kex_gen_server; *((v2 + 240)) = got.kexgex_server; *((v2 + 248)) = got.kexgex_server; *((v2 + 0x100)) = got.kex_gen_server; *((v2 + 264)) = got.kex_gen_server; *((v2 + 272)) = got.kex_gen_server; *((v2 + 168)) = got.get_hostkey_public_by_type; *((v2 + 176)) = got.get_hostkey_private_by_type; *((v2 + 184)) = got.get_hostkey_index; *((v2 + 192)) = got.sshd_hostkey_sign; return v2; }
openssh-portable
angr_sailr
static void get_header(void) { size_t col; alloc_table_row(); for (col = 0; col < ncolumns; col++) { char *cell = ((void *)0); char const *header = gettext(columns[col]->caption); if (columns[col]->field == SIZE_FIELD && (header_mode == DEFAULT_MODE || (header_mode == OUTPUT_MODE && !(human_output_opts & human_autoscale)))) { char buf[((2 * sizeof(uintmax_t) * 8 * 146 / 485 + 1) * (16 + 1) - 16 + 1 + 3) + 1]; int opts = (human_suppress_point_zero | human_autoscale | human_SI | (human_output_opts & (human_group_digits | human_base_1024 | human_B))); uintmax_t q1000 = output_block_size; uintmax_t q1024 = output_block_size; _Bool divisible_by_1000; _Bool divisible_by_1024; do { divisible_by_1000 = q1000 % 1000 == 0; q1000 /= 1000; divisible_by_1024 = q1024 % 1024 == 0; q1024 /= 1024; } while (divisible_by_1000 & divisible_by_1024); if (divisible_by_1000 < divisible_by_1024) opts |= human_base_1024; if (divisible_by_1024 < divisible_by_1000) opts &= ~human_base_1024; if (!(opts & human_base_1024)) opts |= human_B; char *num = human_readable(output_block_size, buf, opts, 1, 1); header = gettext("blocks"); if (asprintf(&cell, gettext("%s-%s"), num, header) == -1) cell = ((void *)0); } else if (header_mode == POSIX_MODE && columns[col]->field == SIZE_FIELD) { char buf[((((((sizeof(uintmax_t) * 8) - (!((__typeof__(uintmax_t))0 < (__typeof__(uintmax_t))-1))) * 146 + 484) / 485) + (!((__typeof__(uintmax_t))0 < (__typeof__(uintmax_t))-1))) + 1)]; char *num = umaxtostr(output_block_size, buf); if (asprintf(&cell, gettext("%s-%s"), num, header) == -1) cell = ((void *)0); } else cell = strdup(header); if (!cell) xalloc_die(); replace_problematic_chars(cell); table[nrows - 1][col] = cell; size_t cell_width = gnu_mbswidth(cell, 0); columns[col]->width = (((columns[col]->width) > (cell_width)) ? (columns[col]->width) : (cell_width)); } }
void get_header() { char v0; char v1; unsigned int v2; void *v3; void *v4; unsigned long long v5; unsigned long long v6; char *v7; unsigned long v8; unsigned long v9; unsigned long long v10; char v11; char v12; unsigned int v14; unsigned long long v17; unsigned long long *v18; unsigned long long v19; alloc_table_row(); v4 = 0; while (true) { if (v4 < ncolumns) { v3 = 0; v7 = gettext(*((*((columns + v4 * 8)) + 24))); if (*(*((columns + (v4 << 3)))) == 2 && (!header_mode || header_mode == 4) && (!header_mode || !(human_output_opts & 16))) { v14 = human_output_opts & 292; *(&v14) = (human_output_opts & 292) | 152; v2 = v14; v5 = *(&output_block_size); v6 = *(&output_block_size); do { v0 = !v5 - ((v5 >> 3) * 2361183241434822607 >> 64 >> 4) * 1000; v5 = (v5 >> 3) * 2361183241434822607 >> 64 >> 4; v1 = !(v6 & 1023); v6 >>= 10; } while ((v1 & v0)); if (v0 < v1) v2 |= 32; if (v1 < v0) v2 &= -33; if (!(v2 & 32)) v2 |= 0x100; v8 = human_readable(*(&output_block_size), &v11, v2, 0x1, 0x1); v7 = gettext("blocks"); if (asprintf(&v3, gettext("%s-%s")) == -1) v3 = 0; } if (*(*((columns + (v4 << 3)))) != 2 || header_mode && header_mode != 4 || header_mode && (human_output_opts & 16)) { if (header_mode == 3 && *(*((columns + (v4 << 3)))) == 2) { v9 = umaxtostr(*(&output_block_size), &v11, &v11); if (asprintf(&v3, gettext("%s-%s")) == -1) v3 = 0; } if (*(*((columns + (v4 << 3)))) != 2 || header_mode != 3) v3 = strdup(v7); } if (!v3) xalloc_die(); replace_problematic_chars(v3); *((v4 * 8 + *((table + nrows * 8 - 8)))) = v3; v10 = gnu_mbswidth(v3, 0x0, v4 * 8 + *((table + nrows * 8 - 8))); v17 = *((*((columns + v4 * 8)) + 32)); if (*((*((columns + (v4 << 3))) + 32)) <= v10) v17 = v10; *((*((columns + v4 * 8)) + 32)) = v17; v4 += 1; } else { v19 = *(&v12) ^ v18[5]; return; } } }
coreutils
angr_dream
void log_close(void) { if (log_use_syslog) closelog(); }
void log_close(void) { if (log_use_syslog != '\0') { closelog(); } return; }
kmod
ghidra
static void merge_loop(struct merge_node_queue *queue, size_t total_lines, FILE *tfp, char const *temp_output) { while (1) { struct merge_node *node = queue_pop(queue); if (node->level == MERGE_END) { unlock_node(node); queue_insert(queue, node); break; } mergelines_node(node, total_lines, tfp, temp_output); queue_check_insert(queue, node); queue_check_insert_parent(queue, node); unlock_node(node); } }
void merge_loop(unsigned long long *a0, unsigned int a1, void *a2, unsigned long long a3) { struct_0 *v0; unsigned long long v2; while (true) { v0 = queue_pop(a0); if (!v0->field_50) break; mergelines_node(v0, a1, a2, a3); queue_check_insert(a0, v0); queue_check_insert_parent(a0, v0); unlock_node(v0); } unlock_node(v0); v2 = queue_insert(a0, v0); return; }
coreutils
angr_sailr
static int identity_permitted(Identity *id, SocketEntry *e, char *user, const char **forward_hostnamep, const char **last_hostnamep) { size_t i; const char **hp; struct hostkey_sid *hks; const struct sshkey *fromkey = ((void *)0); const char *test_user; char *fp1, *fp2; sshlog("ssh-agent.c", __func__, 384, 1, SYSLOG_LEVEL_DEBUG3, ((void *)0), "entering: key %s comment \"%s\", %zu socket bindings, " "%zu constraints", sshkey_type(id->key), id->comment, e->nsession_ids, id->ndest_constraints) ; if (id->ndest_constraints == 0) return 0; if (e->nsession_ids == 0) return 0; for (i = 0; i < e->nsession_ids; i++) { hks = e->session_ids + i; if (hks->key == ((void *)0)) sshfatal("ssh-agent.c", __func__, 398, 1, SYSLOG_LEVEL_FATAL, ((void *)0), "internal error: no bound key"); fp1 = fp2 = ((void *)0); if (fromkey != ((void *)0) && (fp1 = sshkey_fingerprint(fromkey, 2, SSH_FP_DEFAULT)) == ((void *)0)) sshfatal("ssh-agent.c", __func__, 404, 1, SYSLOG_LEVEL_FATAL, ((void *)0), "fingerprint failed"); if ((fp2 = sshkey_fingerprint(hks->key, 2, SSH_FP_DEFAULT)) == ((void *)0)) sshfatal("ssh-agent.c", __func__, 407, 1, SYSLOG_LEVEL_FATAL, ((void *)0), "fingerprint failed"); sshlog("ssh-agent.c", __func__, 408, 1, SYSLOG_LEVEL_DEBUG3, ((void *)0), "socketentry fd=%d, entry %zu %s, " "from hostkey %s %s to user %s hostkey %s %s", e->fd, i, hks->forwarded ? "FORWARD" : "AUTH", fromkey ? sshkey_type(fromkey) : "(ORIGIN)", fromkey ? fp1 : "", user ? user : "(ANY)", sshkey_type(hks->key), fp2) ; free(fp1); free(fp2); hp = ((void *)0); if (i == e->nsession_ids - 1) hp = last_hostnamep; else if (i == 0) hp = forward_hostnamep; test_user = ((void *)0); if (i == e->nsession_ids - 1) { test_user = user; if (hks->forwarded && user != ((void *)0)) { sshlog("ssh-agent.c", __func__, 436, 1, SYSLOG_LEVEL_ERROR, ((void *)0), "tried to sign on forwarding hop"); return -1; } } else if (!hks->forwarded) { sshlog("ssh-agent.c", __func__, 440, 1, SYSLOG_LEVEL_ERROR, ((void *)0), "tried to forward though signing bind"); return -1; } if (permitted_by_dest_constraints(fromkey, hks->key, id, test_user, hp) != 0) return -1; fromkey = hks->key; } hks = &e->session_ids[e->nsession_ids - 1]; if (hks->forwarded && user == ((void *)0) && permitted_by_dest_constraints(hks->key, ((void *)0), id, ((void *)0), ((void *)0)) != 0) { sshlog("ssh-agent.c", __func__, 460, 1, SYSLOG_LEVEL_DEBUG3, ((void *)0), "key permitted at host but not after"); return -1; } return 0; }
long identity_permitted(_QWORD *a1, unsigned int *a2, const char *a3, _QWORD *a4, _QWORD *a5) { long v5; long v6; const char *v7; const char *v8; const char *v10; const char *v11; const char *v12; const char *v13; const char *v14; unsigned long i; _QWORD *v19; long v20; const char *v21; char *ptr; long *v23; long v24; char *v25; v20 = 0LL; v5 = a1[9]; v6 = *((_QWORD *)a2 + 4); v7 = (const char *)a1[3]; v8 = (const char *)sshkey_type(a1[2]); sshlog( "ssh-agent.c", "identity_permitted", 384LL, 1LL, 7LL, 0LL, "entering: key %s comment \"%s\", %zu socket bindings, %zu constraints", v8, v7, v6, v5); if (!a1[9]) return 0LL; if (!*((_QWORD *)a2 + 4)) return 0LL; for (i = 0LL; i < *((_QWORD *)a2 + 4); ++i) { v23 = (long *)(*((_QWORD *)a2 + 5) + 24 * i); if (!*v23) sshfatal("ssh-agent.c", "identity_permitted", 398LL, 1LL, 1LL, 0LL, "internal error: no bound key"); ptr = 0LL; if (v20) { ptr = (char *)sshkey_fingerprint(v20, 2LL, 0LL); if (!ptr) sshfatal("ssh-agent.c", "identity_permitted", 404LL, 1LL, 1LL, 0LL, "fingerprint failed"); } v25 = (char *)sshkey_fingerprint(*v23, 2LL, 0LL); if (!v25) sshfatal("ssh-agent.c", "identity_permitted", 407LL, 1LL, 1LL, 0LL, "fingerprint failed"); v10 = (const char *)sshkey_type(*v23); if (a3) v11 = a3; else v11 = "(ANY)"; if (v20) v12 = ptr; else v12 = (const char *)&unk_7FB9; if (v20) v13 = (const char *)sshkey_type(v20); else v13 = "(ORIGIN)"; if (*((_DWORD *)v23 + 4)) v14 = "FORWARD"; else v14 = "AUTH"; sshlog("ssh-agent.c", "identity_permitted", 408LL, 1LL, 7LL, 0LL, "socketentry fd=%d, entry %zu %s, from hostkey %s %s to user %s " "hostkey %s %s", *a2, i, v14, v13, v12, v11, v10, v25); free(ptr); free(v25); v19 = 0LL; if (i == *((_QWORD *)a2 + 4) - 1LL) { v19 = a5; } else if (!i) { v19 = a4; } v21 = 0LL; if (i == *((_QWORD *)a2 + 4) - 1LL) { v21 = a3; if (*((_DWORD *)v23 + 4) && a3) { sshlog("ssh-agent.c", "identity_permitted", 436LL, 1LL, 2LL, 0LL, "tried to sign on forwarding hop"); return 0xFFFFFFFFLL; } } else if (!*((_DWORD *)v23 + 4)) { sshlog("ssh-agent.c", "identity_permitted", 440LL, 1LL, 2LL, 0LL, "tried to forward though signing bind"); return 0xFFFFFFFFLL; } if ((unsigned int)permitted_by_dest_constraints(v20, *v23, a1, (long)v21, v19)) return 0xFFFFFFFFLL; v20 = *v23; } v24 = *((_QWORD *)a2 + 5) + 24LL * *((_QWORD *)a2 + 4) - 24; if (!*(_DWORD *)(v24 + 16) || a3 || !(unsigned int)permitted_by_dest_constraints(*(_QWORD *)v24, 0LL, a1, 0LL, 0LL)) return 0LL; sshlog("ssh-agent.c", "identity_permitted", 460LL, 1LL, 7LL, 0LL, "key permitted at host but not after"); return 0xFFFFFFFFLL; }
openssh-portable
ida
int executing_line_number() { if (executing && showing_function_line == 0 && (variable_context == 0 || interactive_shell == 0) && currently_executing_command) { if (currently_executing_command->type == cm_cond) return currently_executing_command->value.Cond->line; if (currently_executing_command->type == cm_arith) return currently_executing_command->value.Arith->line; if (currently_executing_command->type == cm_arith_for) return currently_executing_command->value.ArithFor->line; return line_number; } else return line_number; }
int executing_line_number() { unsigned int v1; if (executing && !showing_function_line && (!interactive_shell || !variable_context) && currently_executing_command) { if (*(currently_executing_command) == 11) { v1 = *((*((currently_executing_command + 24)) + 4)); } else if (*(currently_executing_command) == 10) { v1 = *((*((currently_executing_command + 24)) + 4)); } else if (*(currently_executing_command) == 12) { v1 = *((*((currently_executing_command + 24)) + 4)); } else { v1 = *(&line_number); } } if (!currently_executing_command || !executing || showing_function_line || interactive_shell && variable_context) v1 = *(&line_number); return v1; }
bash
angr_dream
static int mptcp_addr_show(int argc, char **argv) { struct { struct nlmsghdr n; struct genlmsghdr g; char buf[(((0) + 4U - 1) & ~(4U - 1)) + (4096)]; } req = { .n = { .nlmsg_type = (genl_family), .nlmsg_flags = (0x01), .nlmsg_len = (((((sizeof(struct genlmsghdr)) + 4U - 1) & ~(4U - 1)) + (0)) + ((int)(((sizeof(struct nlmsghdr)) + 4U - 1) & ~(4U - 1)))), }, .g = { .cmd = (MPTCP_PM_CMD_GET_ADDR), .version = (0x1), }, }; struct nlmsghdr *answer; int ret; if (argc <= 0) return mptcp_addr_dump(); ret = mptcp_parse_opt(argc, argv, &req.n, MPTCP_PM_CMD_GET_ADDR); if (ret) return ret; if (rtnl_talk(&genl_rth, &req.n, &answer) < 0) return -2; new_json_obj(json); ret = print_mptcp_addr(answer, stdout); delete_json_obj(); free(answer); fflush(stdout); return ret; }
void mptcp_addr_show(unsigned long a0, unsigned long a1, unsigned long a2, unsigned long a3, unsigned long long a4, unsigned long long a5) { unsigned int v0; unsigned int v1; char v2; char v3; unsigned short v4; unsigned short v5; char v6; char v7; char v8; unsigned long long v10; void *v11; unsigned long v12; unsigned long long v13; unsigned long long v14; unsigned long long v16; unsigned long long v17; v8 = *(&v8); v0 = a0; v10 = 514; for (v11 = &v3; v10; v11 += v12 * 8) { v10 -= 1; v3 = 0; } *(v11) = 0; v3 = 20; v4 = genl_family; v5 = 1; v6 = 3; v7 = 1; if (v0 <= 0) { v13 = mptcp_addr_dump(v11, a1, v11 + 4, v10, a4, a5); } else { v1 = mptcp_parse_opt(v0, a1, &v3, 0x3); if (v1) { v14 = v1; } else if (rtnl_talk(&genl_rth, &v3, &v2) < 0) { v16 = 4294967294; } else { new_json_obj(json); v1 = print_mptcp_addr(*(&v2), stdout); delete_json_obj(v11, a1, &v2, 0x3, a4, a5); free(*(&v2)); fflush(stdout); v17 = v1; } } return; }
iproute2-6.0.0
angr_dream
static int print_netconf2(struct nlmsghdr *n, void *arg) { return print_netconf(((void *)0), n, arg); }
void print_netconf2(undefined8 param_1, undefined8 param_2) { print_netconf(0, param_1, param_2); return; }
iproute2-6.0.0
ghidra
static void mainloop(void) { time_t tTime; sigset_t origmask; sigset_t sigblockset; int need_free_mutex; sigemptyset(&sigblockset); sigaddset(&sigblockset, 15); sigaddset(&sigblockset, 17); sigaddset(&sigblockset, 1); do { pthread_sigmask(0, &sigblockset, &origmask); pthread_mutex_lock(&mutChildDied); need_free_mutex = 1; if (bChildDied) { bChildDied = 0; pthread_mutex_unlock(&mutChildDied); need_free_mutex = 0; reapChild(); } if (need_free_mutex) { pthread_mutex_unlock(&mutChildDied); } pthread_mutex_lock(&mutHadHUP); need_free_mutex = 1; if (bHadHUP) { bHadHUP = 0; need_free_mutex = 0; pthread_mutex_unlock(&mutHadHUP); doHUP(); } if (need_free_mutex) { pthread_mutex_unlock(&mutHadHUP); } processImInternal(); if (bFinished) break; wait_timeout(&origmask); pthread_sigmask(1, &sigblockset, ((void *)0)); janitorRun(); datetime.GetTime(&tTime); checkGoneAwaySenders(tTime); } while (!bFinished); }
void mainloop(void) { long in_FS_OFFSET; undefined8 local_120; __sigset_t local_118; sigset_t local_98; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); sigemptyset(&local_98); sigaddset(&local_98, 0xf); sigaddset(&local_98, 0x11); sigaddset(&local_98, 1); do { pthread_sigmask(0, &local_98, &local_118); pthread_mutex_lock((pthread_mutex_t *)mutChildDied); if (bChildDied == 0) { pthread_mutex_unlock((pthread_mutex_t *)mutChildDied); } else { bChildDied = 0; pthread_mutex_unlock((pthread_mutex_t *)mutChildDied); reapChild(); } pthread_mutex_lock((pthread_mutex_t *)mutHadHUP); if (bHadHUP == 0) { pthread_mutex_unlock((pthread_mutex_t *)mutHadHUP); } else { bHadHUP = 0; pthread_mutex_unlock((pthread_mutex_t *)mutHadHUP); doHUP(); } processImInternal(); if (bFinished != 0) break; wait_timeout(&local_118); pthread_sigmask(1, &local_98, (__sigset_t *)0x0); janitorRun(); (*datetime._72_8_)(&local_120); checkGoneAwaySenders(local_120); } while (bFinished == 0); if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) { __stack_chk_fail(); } return; }
rsyslog-8.2210.0
ghidra
int ssh_packet_process_read(struct ssh *ssh, int fd) { struct session_state *state = ssh->state; int r; size_t rlen; if ((r = sshbuf_read(fd, state->input, (256 * 1024), &rlen)) != 0) return r; if (state->packet_discard) { if ((r = sshbuf_consume_end(state->input, rlen)) != 0) return r; state->keep_alive_timeouts = 0; if (rlen >= state->packet_discard) { if ((r = ssh_packet_stop_discard(ssh)) != 0) return r; } state->packet_discard -= rlen; return 0; } return 0; }
long long ssh_packet_process_read(unsigned long long *a0, unsigned long a1) { unsigned int v0; char v1; struct_0 *v2; void *v4; v2 = *(a0); v0 = sshbuf_read(a1, v2->field_20, 0x40000, &v1); if (v0) { v4 = v0; } else if (v2->field_1c4) { v0 = sshbuf_consume_end(v2->field_20, *(&v1), *(&v1)); if (v0) { v4 = v0; } else { v2->field_14c = 0; if (v2->field_1c4 <= *(&v1)) { v0 = ssh_packet_stop_discard(a0); if (v0) v4 = v0; } if (!v0 || v2->field_1c4 > *(&v1)) { v2->field_1c4 = v2->field_1c4 - *(&v1); v4 = 0; } } } else { v4 = 0; } return v4; }
openssh-portable
angr_dream
void translate_range(struct file_data const *file, lin a, lin b, printint *aptr, printint *bptr) { *aptr = translate_line_number(file, a - 1) + 1; *bptr = translate_line_number(file, b + 1) - 1; }
void translate_range(void *a0, unsigned long a1, unsigned long a2, unsigned long long *a3, unsigned long long *a4) { unsigned long v0; unsigned long long *v3; v0 = a2; *(a3) = translate_line_number(a0, a1 - 1) + 1; v3 = a4; *(a4) = translate_line_number(a0, v0 + 1) - 1; return; }
diffutils
angr_phoenix
static void settimeout(double duration, _Bool warn) { struct timespec ts = dtotimespec(duration); struct itimerspec its = {{0, 0}, ts}; timer_t timerid; if (timer_create(0, ((void *)0), &timerid) == 0) { if (timer_settime(timerid, 0, &its, ((void *)0)) == 0) return; else { if (warn) error(0, (*__errno_location()), gettext("warning: timer_settime")); timer_delete(timerid); } } else if (warn && (*__errno_location()) != 38) error(0, (*__errno_location()), gettext("warning: timer_create")); unsigned int timeint; if ((0x7fffffff * 2U + 1U) <= duration) timeint = (0x7fffffff * 2U + 1U); else { unsigned int duration_floor = duration; timeint = duration_floor + (duration_floor < duration); } alarm(timeint); }
void settimeout(unsigned long a0, unsigned long a1, unsigned long a2) { unsigned long v0; unsigned int v1; unsigned int v2; char v3; unsigned long v4; void *v5; void *v6; unsigned long v7; unsigned long v8; char v9; unsigned long v11; unsigned long long v13; unsigned long long *v14; unsigned long long v15; v0 = v11; v4 = dtotimespec(); v5 = 0; v6 = 0; v7 = v4; v8 = a2; if (timer_create(0x0, 0x0, &v3)) { if (a0 && *(__errno_location()) != 38) error(0x0, *(__errno_location()), gettext("warning: timer_create")); } else { if (timer_settime(*(&v3), 0x0, &v5, 0x0)) { if (a0) error(0x0, *(__errno_location()), gettext("warning: timer_settime")); timer_delete(*(&v3)); } else { v15 = *(&v9) ^ v14[5]; return; } } if (!(BinaryOp CmpF & 1)) { v1 = -1; } else { v2 = v0; if (v2 >= 0) v13 = v2; else v13 = (0 CONCAT v2 >> 1 | v2 & 1) + (0 CONCAT v2 >> 1 | v2 & 1); v1 = v2 + (!((BinaryOp CmpF & 69 | (BinaryOp CmpF & 69) >> 6) & 1)); } alarm(v1); v15 = *(&v9) ^ v14[5]; return; }
coreutils
angr_sailr
static void usage(void) { fprintf( stderr, "Usage: ip [ OPTIONS ] OBJECT { COMMAND | help }\n" " ip [ -force ] -batch filename\n" "where OBJECT := { address | addrlabel | amt | fou | help | ila | ioam " "| l2tp |\n" " link | macsec | maddress | monitor | mptcp | mroute " "| mrule |\n" " neighbor | neighbour | netconf | netns | nexthop | " "ntable |\n" " ntbl | route | rule | sr | tap | tcpmetrics |\n" " token | tunnel | tuntap | vrf | xfrm }\n" " OPTIONS := { -V[ersion] | -s[tatistics] | -d[etails] | " "-r[esolve] |\n" " -h[uman-readable] | -iec | -j[son] | -p[retty] |\n" " -f[amily] { inet | inet6 | mpls | bridge | link } " "|\n" " -4 | -6 | -M | -B | -0 |\n" " -l[oops] { maximum-addr-flush-attempts } | -br[ief] " "|\n" " -o[neline] | -t[imestamp] | -ts[hort] | -b[atch] " "[filename] |\n" " -rc[vbuf] [size] | -n[etns] name | -N[umeric] | " "-a[ll] |\n" " -c[olor]}\n"); exit(-1); }
void usage() { fprintf(stderr, "Usage: ip [ OPTIONS ] OBJECT { COMMAND | help }\n ip [ -force " "] -batch filename\nwhere OBJECT := { address | addrlabel | amt | " "fou | help | ila | ioam | l2tp |\n link | macsec " "| maddress | monitor | mptcp | mroute | mrule |\n " "neighbor | neighbour | netconf | netns | nexthop | ntable |\n " " ntbl | route | rule | sr | tap | tcpmetrics |\n " " token | tunnel | tuntap | vrf | xfrm }\n OPTIONS := " "{ -V[ersion] | -s[tatistics] | -d[etails] | -r[esolve] |\n " " -h[uman-readable] | -iec | -j[son] | -p[retty] |\n " " -f[amily] { inet | inet6 | mpls | bridge | link } |\n " " -4 | -6 | -M | -B | -0 |\n " "-l[oops] { maximum-addr-flush-attempts } | -br[ief] |\n " " -o[neline] | -t[imestamp] | -ts[hort] | -b[atch] [filename] " "|\n -rc[vbuf] [size] | -n[etns] name | " "-N[umeric] | -a[ll] |\n -c[olor]}\n"); exit(0xffffffff); }
iproute2-6.0.0
angr_dream
static inline int ext4_hash_in_dirent(const struct ext2_inode *inode) { return (inode->i_flags & 0x00000800) && (inode->i_flags & 0x40000000); }
int ext4_hash_in_dirent(struct_0 *a0) { unsigned int v1; if ((a0->field_20 & 0x800) && (a0->field_20 & 0x40000000)) v1 = 1; if (!(a0->field_20 & 0x800) || !(a0->field_20 & 0x40000000)) v1 = 0; return v1; }
e2fsprogs-1.46.5
angr_dream
static int process_pass1b_block(ext2_filsys fs __attribute__((unused)), blk64_t *block_nr, e2_blkcnt_t blockcnt, blk64_t ref_blk __attribute__((unused)), int ref_offset __attribute__((unused)), void *priv_data) { struct process_block_struct *p; e2fsck_t ctx; blk64_t lc, pc; problem_t op; if (*block_nr == 0) return 0; p = (struct process_block_struct *)priv_data; ctx = p->ctx; lc = ((blockcnt) >> (fs)->cluster_ratio_bits); pc = ((*block_nr) >> (fs)->cluster_ratio_bits); if (!ext2fs_test_block_bitmap2(ctx->block_dup_map, *block_nr)) goto finish; if (p->ino != 1) { if (p->last_blk + 1 != *block_nr) { if (p->last_blk) { op = p->pctx->blk == p->pctx->blk2 ? 0x011002 : 0x011008; fix_problem(ctx, op, p->pctx); } p->pctx->blk = *block_nr; } p->pctx->blk2 = *block_nr; p->last_blk = *block_nr; } p->dup_blocks++; ext2fs_mark_inode_bitmap2(inode_dup_map, p->ino); if (blockcnt < 0 || lc != p->cur_cluster || pc != p->phys_cluster) add_dupe(ctx, p->ino, ((*block_nr) >> (fs)->cluster_ratio_bits), p->inode); finish: p->cur_cluster = lc; p->phys_cluster = pc; return 0; }
undefined8 process_pass1b_block(long param_1, ulong *param_2, long param_3, undefined8 param_4, undefined8 param_5, long *param_6) { long lVar1; int iVar2; undefined4 uVar3; long lVar4; ulong uVar5; if (*param_2 != 0) { lVar1 = *param_6; lVar4 = param_3 >> ((byte) * (undefined4 *)(param_1 + 0xc0) & 0x3f); uVar5 = *param_2 >> ((byte) * (undefined4 *)(param_1 + 0xc0) & 0x3f); iVar2 = ext2fs_test_block_bitmap2(*(undefined8 *)(lVar1 + 0x1a8), *param_2); if (iVar2 != 0) { if (*(int *)(param_6 + 1) != 1) { if (param_6[4] + 1U != *param_2) { if (param_6[4] != 0) { if (*(long *)(param_6[6] + 0x28) == *(long *)(param_6[6] + 0x30)) { uVar3 = 0x11002; } else { uVar3 = 0x11008; } fix_problem(lVar1, uVar3, param_6[6]); } *(ulong *)(param_6[6] + 0x28) = *param_2; } *(ulong *)(param_6[6] + 0x30) = *param_2; param_6[4] = *param_2; } *(int *)((long)param_6 + 0xc) = *(int *)((long)param_6 + 0xc) + 1; ext2fs_mark_inode_bitmap2(inode_dup_map, *(undefined4 *)(param_6 + 1)); if (((param_3 < 0) || (lVar4 != param_6[2])) || (uVar5 != param_6[3])) { add_dupe(lVar1, *(undefined4 *)(param_6 + 1), *param_2 >> ((byte) * (undefined4 *)(param_1 + 0xc0) & 0x3f), param_6[5]); } } param_6[2] = lVar4; param_6[3] = uVar5; } return 0; }
e2fsprogs-1.46.5
ghidra
gnutls_x509_crt_t load_cert(int mand, common_info_st *info) { gnutls_x509_crt_t *crt; gnutls_x509_crt_t ret_crt; size_t size, i; crt = load_cert_list(mand, &size, info); if (crt) { ret_crt = crt[0]; for (i = 1; i < size; i++) gnutls_x509_crt_deinit(crt[i]); gnutls_free((void *)(crt)), crt = ((void *)0); return ret_crt; } return ((void *)0); }
undefined8 load_cert(undefined4 param_1, undefined8 param_2) { undefined8 uVar1; long in_FS_OFFSET; ulong local_30; ulong local_28; undefined8 *local_20; undefined8 local_18; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); local_20 = (undefined8 *)load_cert_list(param_1, &local_30, param_2); if (local_20 == (undefined8 *)0x0) { uVar1 = 0; } else { local_18 = *local_20; for (local_28 = 1; local_28 < local_30; local_28 = local_28 + 1) { gnutls_x509_crt_deinit(local_20[local_28]); } (*gnutls_free)(local_20); local_20 = (undefined8 *)0x0; uVar1 = local_18; } if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) { __stack_chk_fail(); } return uVar1; }
gnutls
ghidra
static _Bool load_buffer(void) { struct buffer_record *b; idx_t bytes_wanted = 8191; idx_t bytes_avail; idx_t lines_found; char *p; if (have_read_eof) return 0; if (bytes_wanted <= hold_count) bytes_wanted = hold_count + 1; while (1) { b = get_new_buffer(bytes_wanted); bytes_avail = b->bytes_alloc; p = b->buffer; if (hold_count) { memcpy(p, hold_area, hold_count); p += hold_count; b->bytes_used += hold_count; bytes_avail -= hold_count; hold_count = 0; } b->bytes_used += read_input(p, bytes_avail - 1); lines_found = record_line_starts(b); if (lines_found || have_read_eof) break; if (__builtin_mul_overflow(b->bytes_alloc, 2, &bytes_wanted)) xalloc_die(); free_buffer(b); } if (lines_found) save_buffer(b); else free_buffer(b); return lines_found != 0; }
int load_buffer() { unsigned long long v0; unsigned long v1; void *v2; unsigned long long v3[6]; unsigned long v4; unsigned int v6; unsigned long v7; v0 = 8191; if (have_read_eof) { v6 = 0; } else { if (v0 <= hold_count) v0 = hold_count + 1; while (true) { v3[0] = get_new_buffer(v0); v1 = v3[0]; v2 = v3[5]; if (hold_count) { memcpy(v2, hold_area, hold_count); v2 += hold_count; v3[1] = v3[1] + hold_count; v1 -= hold_count; hold_count = 0; } v3[1] = v3[1] + read_input(v2, v1 - 1); v4 = record_line_starts(v3); if (v4) break; if (!v4) { if (have_read_eof) break; if (!have_read_eof) { v7 = 0; if ([D] amd64g_calculate_condition( 0x0 < 64 >, 0x34 < 64 >, Load(addr = Load(addr = stack_base - 32, size = 8, endness = Iend_LE), size = 8, endness = Iend_LE), 0x2 < 64 >, cc_ndep<8>)) *(&v7) = 1; } } v0 = v3[0] * 2; if ((v7 & 1)) xalloc_die(); free_buffer(v3); } if (v4) v6 = save_buffer(v3); else v6 = free_buffer(v3); *(&v6) = v4; } return v6; }
coreutils
angr_dream
void usage(int status) { if (status != 0) do { fprintf(stderr, gettext("Try '%s --help' for more information.\n"), program_name); } while (0); else { printf(gettext("Usage: %s [OPTION]... [FILE]...\n or: %s [OPTION]... " "--files0-from=F\n") , program_name, program_name); fputs_unlocked( gettext( "Write sorted concatenation of all FILE(s) to standard output.\n"), stdout) ; emit_stdin_note(); emit_mandatory_arg_note(); fputs_unlocked(gettext("Ordering options:\n\n"), stdout) ; fputs_unlocked( gettext(" -b, --ignore-leading-blanks ignore leading blanks\n -d, " "--dictionary-order consider only blanks and alphanumeric " "characters\n -f, --ignore-case fold lower case to " "upper case characters\n"), stdout) ; fputs_unlocked( gettext(" -g, --general-numeric-sort compare according to general " "numerical value\n -i, --ignore-nonprinting consider only " "printable characters\n -M, --month-sort compare " "(unknown) < 'JAN' < ... < 'DEC'\n"), stdout) ; fputs_unlocked(gettext(" -h, --human-numeric-sort compare human " "readable numbers (e.g., 2K 1G)\n"), stdout) ; fputs_unlocked( gettext(" -n, --numeric-sort compare according to string " "numerical value\n -R, --random-sort shuffle, but " "group identical keys. See shuf(1)\n " "--random-source=FILE get random bytes from FILE\n -r, " "--reverse reverse the result of comparisons\n"), stdout) ; fputs_unlocked( gettext(" --sort=WORD sort according to WORD:\n " " general-numeric -g, human-numeric " "-h, month -M,\n numeric -n, " "random -R, version -V\n -V, --version-sort natural " "sort of (version) numbers within text\n\n"), stdout) ; fputs_unlocked(gettext("Other options:\n\n"), stdout) ; fputs_unlocked( gettext(" --batch-size=NMERGE merge at most NMERGE inputs at " "once;\n for more use temp files\n"), stdout) ; fputs_unlocked( gettext(" -c, --check, --check=diagnose-first check for sorted " "input; do not sort\n -C, --check=quiet, --check=silent like " "-c, but do not report first bad line\n " "--compress-program=PROG compress temporaries with PROG;\n " " decompress them with PROG -d\n"), stdout) ; fputs_unlocked( gettext(" --debug annotate the part of the line " "used to sort,\n and warn about " "questionable usage to stderr\n --files0-from=F " "read input from the files specified by\n " " NUL-terminated names in file F;\n " " If F is - then read names from standard input\n"), stdout) ; fputs_unlocked(gettext(" -k, --key=KEYDEF sort via a key; KEYDEF " "gives location and type\n -m, --merge " " merge already sorted files; do not sort\n"), stdout) ; fputs_unlocked( gettext(" -o, --output=FILE write result to FILE instead of " "standard output\n -s, --stable stabilize sort " "by disabling last-resort comparison\n -S, --buffer-size=SIZE " " use SIZE for main memory buffer\n"), stdout) ; printf( gettext(" -t, --field-separator=SEP use SEP instead of non-blank to " "blank transition\n -T, --temporary-directory=DIR use DIR " "for temporaries, not $TMPDIR or %s;\n " " multiple options specify multiple directories\n " "--parallel=N change the number of sorts run " "concurrently to N\n -u, --unique with -c, check " "for strict ordering;\n without " "-c, output only the first of an equal run\n") , "/tmp"); fputs_unlocked( gettext( " -z, --zero-terminated line delimiter is NUL, not newline\n"), stdout) ; fputs_unlocked(gettext(" --help display this help and exit\n"), stdout); fputs_unlocked( gettext(" --version output version information and exit\n"), stdout); fputs_unlocked( gettext( "\nKEYDEF is F[.C][OPTS][,F[.C][OPTS]] for start and stop " "position, where F is a\nfield number and C a character position " "in the field; both are origin 1, and\nthe stop position defaults " "to the line's end. If neither -t nor -b is in\neffect, " "characters in a field are counted from the beginning of the " "preceding\nwhitespace. OPTS is one or more single-letter " "ordering options [bdfgiMhnRrV],\nwhich override global ordering " "options for that key. If no key is given, use\nthe entire line " "as the key. Use --debug to diagnose incorrect key usage.\n\nSIZE " "may be followed by the following multiplicative suffixes:\n"), stdout); fputs_unlocked( gettext("% 1% of memory, b 1, K 1024 (default), and so on for M, G, T, " "P, E, Z, Y.\n\n*** WARNING ***\nThe locale specified by the " "environment affects sort order.\nSet LC_ALL=C to get the " "traditional sort order that uses\nnative byte values.\n"), stdout) ; emit_ancillary_info("sort"); } exit(status); }
void usage(int a1) { long v1; char *v2; long v3; long v4; char *v5; FILE *v6; char *v7; FILE *v8; char *v9; FILE *v10; char *v11; FILE *v12; char *v13; FILE *v14; char *v15; FILE *v16; char *v17; FILE *v18; char *v19; FILE *v20; char *v21; FILE *v22; char *v23; FILE *v24; char *v25; FILE *v26; char *v27; FILE *v28; char *v29; FILE *v30; char *v31; char *v32; FILE *v33; char *v34; FILE *v35; char *v36; FILE *v37; char *v38; FILE *v39; char *v40; FILE *v41; char *v42; if (a1) { v1 = program_name; v2 = gettext("Try '%s --help' for more information.\n"); fprintf(stderr, v2, v1); } else { v3 = program_name; v4 = program_name; v5 = gettext("Usage: %s [OPTION]... [FILE]...\n or: %s [OPTION]... " "--files0-from=F\n"); printf(v5, v4, v3); v6 = stdout; v7 = gettext( "Write sorted concatenation of all FILE(s) to standard output.\n"); fputs_unlocked(v7, v6); emit_stdin_note(); emit_mandatory_arg_note(); v8 = stdout; v9 = gettext("Ordering options:\n\n"); fputs_unlocked(v9, v8); v10 = stdout; v11 = gettext(" -b, --ignore-leading-blanks ignore leading blanks\n" " -d, --dictionary-order consider only blanks and " "alphanumeric characters\n" " -f, --ignore-case fold lower case to upper case " "characters\n"); fputs_unlocked(v11, v10); v12 = stdout; v13 = gettext( " -g, --general-numeric-sort compare according to general numerical " "value\n" " -i, --ignore-nonprinting consider only printable characters\n" " -M, --month-sort compare (unknown) < 'JAN' < ... < " "'DEC'\n"); fputs_unlocked(v13, v12); v14 = stdout; v15 = gettext(" -h, --human-numeric-sort compare human readable " "numbers (e.g., 2K 1G)\n"); fputs_unlocked(v15, v14); v16 = stdout; v17 = gettext( " -n, --numeric-sort compare according to string numerical " "value\n" " -R, --random-sort shuffle, but group identical keys. See " "shuf(1)\n" " --random-source=FILE get random bytes from FILE\n" " -r, --reverse reverse the result of comparisons\n"); fputs_unlocked(v17, v16); v18 = stdout; v19 = gettext( " --sort=WORD sort according to WORD:\n" " general-numeric -g, human-numeric -h, " "month -M,\n" " numeric -n, random -R, version -V\n" " -V, --version-sort natural sort of (version) numbers " "within text\n" "\n"); fputs_unlocked(v19, v18); v20 = stdout; v21 = gettext("Other options:\n\n"); fputs_unlocked(v21, v20); v22 = stdout; v23 = gettext( " --batch-size=NMERGE merge at most NMERGE inputs at once;\n" " for more use temp files\n"); fputs_unlocked(v23, v22); v24 = stdout; v25 = gettext( " -c, --check, --check=diagnose-first check for sorted input; do not " "sort\n" " -C, --check=quiet, --check=silent like -c, but do not report first " "bad line\n" " --compress-program=PROG compress temporaries with PROG;\n" " decompress them with PROG -d\n"); fputs_unlocked(v25, v24); v26 = stdout; v27 = gettext( " --debug annotate the part of the line used to " "sort,\n" " and warn about questionable usage to " "stderr\n" " --files0-from=F read input from the files specified by\n" " NUL-terminated names in file F;\n" " If F is - then read names from standard " "input\n"); fputs_unlocked(v27, v26); v28 = stdout; v29 = gettext(" -k, --key=KEYDEF sort via a key; KEYDEF gives " "location and type\n" " -m, --merge merge already sorted files; do " "not sort\n"); fputs_unlocked(v29, v28); v30 = stdout; v31 = gettext( " -o, --output=FILE write result to FILE instead of standard " "output\n" " -s, --stable stabilize sort by disabling last-resort " "comparison\n" " -S, --buffer-size=SIZE use SIZE for main memory buffer\n"); fputs_unlocked(v31, v30); v32 = gettext( " -t, --field-separator=SEP use SEP instead of non-blank to blank " "transition\n" " -T, --temporary-directory=DIR use DIR for temporaries, not $TMPDIR " "or %s;\n" " multiple options specify multiple " "directories\n" " --parallel=N change the number of sorts run " "concurrently to N\n" " -u, --unique with -c, check for strict ordering;\n" " without -c, output only the first of an " "equal run\n"); printf(v32, "/tmp"); v33 = stdout; v34 = gettext( " -z, --zero-terminated line delimiter is NUL, not newline\n"); fputs_unlocked(v34, v33); v35 = stdout; v36 = gettext(" --help display this help and exit\n"); fputs_unlocked(v36, v35); v37 = stdout; v38 = gettext(" --version output version information and exit\n"); fputs_unlocked(v38, v37); v39 = stdout; v40 = gettext( "\n" "KEYDEF is F[.C][OPTS][,F[.C][OPTS]] for start and stop position, " "where F is a\n" "field number and C a character position in the field; both are origin " "1, and\n" "the stop position defaults to the line's end. If neither -t nor -b " "is in\n" "effect, characters in a field are counted from the beginning of the " "preceding\n" "whitespace. OPTS is one or more single-letter ordering options " "[bdfgiMhnRrV],\n" "which override global ordering options for that key. If no key is " "given, use\n" "the entire line as the key. Use --debug to diagnose incorrect key " "usage.\n" "\n" "SIZE may be followed by the following multiplicative suffixes:\n"); fputs_unlocked(v40, v39); v41 = stdout; v42 = gettext("% 1% of memory, b 1, K 1024 (default), and so on for M, G, T, " "P, E, Z, Y.\n" "\n" "*** WARNING ***\n" "The locale specified by the environment affects sort order.\n" "Set LC_ALL=C to get the traditional sort order that uses\n" "native byte values.\n"); fputs_unlocked(v42, v41); emit_ancillary_info("sort"); } exit(a1); }
coreutils
ida
static _Bool diversion_is_shared(struct pkgset *set, struct fsys_namenode *namenode) { const char *archname; struct pkginfo *pkg; struct dpkg_arch *arch; struct fsys_node_pkgs_iter *iter; _Bool shared = 0; if (set == ((void *)0)) return 0; archname = getenv("DPKG_MAINTSCRIPT_ARCH"); arch = dpkg_arch_find(archname); if (arch->type == DPKG_ARCH_NONE || arch->type == DPKG_ARCH_EMPTY) return 0; for (pkg = &set->pkg; pkg; pkg = pkg->arch_next) ensure_packagefiles_available(pkg); iter = fsys_node_pkgs_iter_new(namenode); while ((pkg = fsys_node_pkgs_iter_next(iter))) { if (pkg->set == set && pkg->installed.arch != arch) { shared = 1; break; } } fsys_node_pkgs_iter_free(iter); return shared; }
long diversion_is_shared(long a1, long a2) { _QWORD *j; unsigned char v4; long i; char *v6; long v7; long v8; v4 = 0; if (!a1) return 0LL; v6 = getenv("DPKG_MAINTSCRIPT_ARCH"); v7 = dpkg_arch_find(v6); if (*(_DWORD *)(v7 + 16) <= 1u) return 0LL; for (i = a1 + 16; i; i = *(_QWORD *)(i + 8)) ensure_packagefiles_available(i); v8 = fsys_node_pkgs_iter_new(a2); for (j = (_QWORD *)fsys_node_pkgs_iter_next(v8); j; j = (_QWORD *)fsys_node_pkgs_iter_next(v8)) { if (a1 == *j && v7 != j[11]) { v4 = 1; break; } } fsys_node_pkgs_iter_free(v8); return v4; }
dpkg
ida
static void control_persist_detach(void) { pid_t pid; sshlog("ssh.c", __func__, 1720, 1, SYSLOG_LEVEL_DEBUG1, ((void *)0), "backgrounding master process"); switch ((pid = fork())) { case -1: sshfatal("ssh.c", __func__, 1728, 1, SYSLOG_LEVEL_FATAL, ((void *)0), "fork: %s", strerror((*__errno_location()))); case 0: break; default: sshlog("ssh.c", __func__, 1734, 1, SYSLOG_LEVEL_DEBUG2, ((void *)0), "background process is %ld", (long)pid); options.stdin_null = ostdin_null_flag; options.request_tty = orequest_tty; tty_flag = otty_flag; options.session_type = osession_type; close(muxserver_sock); muxserver_sock = -1; options.control_master = 0; muxclient(options.control_path); sshfatal("ssh.c", __func__, 1744, 0, SYSLOG_LEVEL_FATAL, ((void *)0), "Failed to connect to new control master"); } if (stdfd_devnull(1, 1, !(log_is_on_stderr() && debug_flag)) == -1) sshlog("ssh.c", __func__, 1747, 1, SYSLOG_LEVEL_ERROR, ((void *)0), "stdfd_devnull failed"); daemon(1, 1); setproctitle("%s [mux]", options.control_path); }
void control_persist_detach(void) { int iVar1; undefined4 uVar2; int *piVar3; char **ppcVar4; undefined *puVar5; char *apcStack80[7]; undefined auStack24[12]; __pid_t local_c; apcStack80[5] = "backgrounding master process"; sshlog("ssh.c", "control_persist_detach", 0x6b8, 1, 5, 0); ppcVar4 = (char **)auStack24; puVar5 = auStack24; apcStack80[6] = (char *)0x105cfa; local_c = fork(); if (local_c == -1) { apcStack80[6] = (char *)0x105d14; piVar3 = __errno_location(); apcStack80[6] = (char *)0x105d1d; apcStack80[6] = strerror(*piVar3); ppcVar4 = apcStack80 + 5; apcStack80[5] = "fork: %s"; sshfatal("ssh.c", "control_persist_detach", 0x6c0, 1, 1, 0); } else if (local_c == 0) goto code_r0x00105e2f; *(long *)((long)ppcVar4 + -8) = (long)local_c; *(char **)((long)ppcVar4 + -0x10) = "background process is %ld"; *(undefined8 *)((long)ppcVar4 + -0x18) = 0x105d90; sshlog("ssh.c", "control_persist_detach", 0x6c6, 1, 6, 0); options._5036_4_ = ostdin_null_flag; options._5028_4_ = orequest_tty; tty_flag = otty_flag; options._5032_4_ = osession_type; *(undefined8 *)((long)ppcVar4 + -8) = 0x105dd1; close(muxserver_sock); muxserver_sock = -1; options._4968_4_ = 0; *(undefined8 *)((long)ppcVar4 + -8) = 0x105df4; muxclient(options._4960_8_); puVar5 = (undefined *)((long)ppcVar4 + -0x10); *(char **)((long)ppcVar4 + -0x10) = "Failed to connect to new control master"; *(undefined8 *)((long)ppcVar4 + -0x18) = 0x105e2e; sshfatal("ssh.c", "control_persist_detach", 0x6d0, 0, 1, 0); code_r0x00105e2f: *(undefined8 *)(puVar5 + -8) = 0x105e34; iVar1 = log_is_on_stderr(); if ((iVar1 == 0) || (debug_flag == 0)) { uVar2 = 1; } else { uVar2 = 0; } *(undefined8 *)(puVar5 + -8) = 0x105e5f; iVar1 = stdfd_devnull(1, 1, uVar2); if (iVar1 == -1) { *(char **)(puVar5 + -0x10) = "stdfd_devnull failed"; *(undefined8 *)(puVar5 + -0x18) = 0x105e9e; sshlog("ssh.c", "control_persist_detach", 0x6d3, 1, 2, 0); } *(undefined8 *)(puVar5 + -8) = 0x105eb1; daemon(1, 1); *(undefined8 *)(puVar5 + -8) = 0x105ecc; setproctitle("%s [mux]", options._4960_8_); return; }
openssh-portable
ghidra
void temporarily_use_uid(struct passwd *pw) { saved_euid = geteuid(); saved_egid = getegid(); sshlog("uidswap.c", __func__, 67, 0, SYSLOG_LEVEL_DEBUG1, ((void *)0), "temporarily_use_uid: %u/%u (e=%u/%u)", (u_int)pw->pw_uid, (u_int)pw->pw_gid, (u_int)saved_euid, (u_int)saved_egid) ; if (saved_euid != 0) { privileged = 0; return; } privileged = 1; temporarily_use_uid_effective = 1; saved_egroupslen = getgroups(0, ((void *)0)); if (saved_egroupslen == -1) sshfatal("uidswap.c", __func__, 88, 0, SYSLOG_LEVEL_FATAL, ((void *)0), "getgroups: %.100s", strerror((*__errno_location()))); if (saved_egroupslen > 0) { saved_egroups = xreallocarray(saved_egroups, saved_egroupslen, sizeof(gid_t)); if (getgroups(saved_egroupslen, saved_egroups) == -1) sshfatal("uidswap.c", __func__, 93, 0, SYSLOG_LEVEL_FATAL, ((void *)0), "getgroups: %.100s", strerror((*__errno_location()))); } else { free(saved_egroups); saved_egroups = ((void *)0); } if (user_groupslen == -1 || user_groups_uid != pw->pw_uid) { if (initgroups(pw->pw_name, pw->pw_gid) == -1) sshfatal("uidswap.c", __func__, 102, 0, SYSLOG_LEVEL_FATAL, ((void *)0), "initgroups: %s: %.100s", pw->pw_name, strerror((*__errno_location()))); user_groupslen = getgroups(0, ((void *)0)); if (user_groupslen == -1) sshfatal("uidswap.c", __func__, 107, 0, SYSLOG_LEVEL_FATAL, ((void *)0), "getgroups: %.100s", strerror((*__errno_location()))); if (user_groupslen > 0) { user_groups = xreallocarray(user_groups, user_groupslen, sizeof(gid_t)); if (getgroups(user_groupslen, user_groups) == -1) sshfatal("uidswap.c", __func__, 112, 0, SYSLOG_LEVEL_FATAL, ((void *)0), "getgroups: %.100s", strerror((*__errno_location()))); } else { free(user_groups); user_groups = ((void *)0); } user_groups_uid = pw->pw_uid; } if (setgroups(user_groupslen, user_groups) == -1) sshfatal("uidswap.c", __func__, 121, 0, SYSLOG_LEVEL_FATAL, ((void *)0), "setgroups: %.100s", strerror((*__errno_location()))); if (setegid(pw->pw_gid) == -1) sshfatal("uidswap.c", __func__, 131, 0, SYSLOG_LEVEL_FATAL, ((void *)0), "setegid %u: %.100s", (u_int)pw->pw_gid, strerror((*__errno_location()))); if (seteuid(pw->pw_uid) == -1) sshfatal("uidswap.c", __func__, 134, 0, SYSLOG_LEVEL_FATAL, ((void *)0), "seteuid %u: %.100s", (u_int)pw->pw_uid, strerror((*__errno_location()))); }
long long temporarily_use_uid(unsigned long a0) { unsigned long long v0; unsigned long v1; unsigned long long v2; unsigned long v3; char v4; unsigned long long v6; v2 = a0; saved_euid = geteuid(); saved_egid = getegid(); sshlog("uidswap.c", "temporarily_use_uid", 0x43, 0x0, 0x5, 0x0, "temporarily_use_uid: %u/%u (e=%u/%u)", v2->field_10, v2->field_14, saved_euid); v6 = saved_euid; if (saved_euid) { privileged = 0; return v6; } privileged = 1; temporarily_use_uid_effective = 1; saved_egroupslen = getgroups(0x0, NULL); if (saved_egroupslen == -1) { v0 = strerror(*(__errno_location())); sshfatal("uidswap.c", "temporarily_use_uid", 0x58, 0x0, 0x1, 0x0, "getgroups: %.100s"); } if (saved_egroupslen <= 0) { free(saved_egroups); saved_egroups = 0; } else { saved_egroups = xreallocarray(saved_egroups, saved_egroupslen, 0x4, saved_egroupslen); if (getgroups(saved_egroupslen, saved_egroups) == -1) { v3 = strerror(*(__errno_location())); v2 = "getgroups: %.100s"; sshfatal("uidswap.c", "temporarily_use_uid", 0x5d, 0x0, 0x1, 0x0, *(&v4)); free(saved_egroups); saved_egroups = 0; } } if (user_groupslen == -1 || v2->field_10 != user_groups_uid) { if (initgroups(v2->field_0, v2->field_14) == -1) { v2 = &strerror(*(__errno_location())); v1 = *(v2); v0 = "initgroups: %s: %.100s"; sshfatal("uidswap.c", "temporarily_use_uid", 0x66, 0x0, 0x1, 0x0, *(&v4)); } user_groupslen = getgroups(0x0, saved_egroups); if (user_groupslen == -1) { v3 = strerror(*(__errno_location())); v2 = "getgroups: %.100s"; sshfatal("uidswap.c", "temporarily_use_uid", 0x6b, 0x0, 0x1, 0x0, *(&v4)); } if (user_groupslen <= 0) { free(user_groups); user_groups = 0; } else { user_groups = xreallocarray(user_groups, user_groupslen, 0x4, user_groupslen); if (getgroups(user_groupslen, user_groups) == -1) { v3 = strerror(*(__errno_location())); v2 = "getgroups: %.100s"; sshfatal("uidswap.c", "temporarily_use_uid", 0x70, 0x0, 0x1, 0x0, *(&v4)); free(user_groups); user_groups = 0; } } user_groups_uid = v2->field_10; } if (setgroups(user_groupslen, user_groups) == -1) { v3 = strerror(*(__errno_location())); v2 = "setgroups: %.100s"; sshfatal("uidswap.c", "temporarily_use_uid", 0x79, 0x0, 0x1, 0x0, *(&v4)); } if (setegid(*((v2 + 20))) == -1) { v2 = strerror(*(__errno_location())); v1 = v2->field_14; v0 = "setegid %u: %.100s"; sshfatal("uidswap.c", "temporarily_use_uid", 0x83, 0x0, 0x1, 0x0, *(&v4)); } v6 = seteuid(*((v2 + 16))); if (v6 == -1) { v2 = &strerror(*(__errno_location())); v1 = v2->field_10; v0 = "seteuid %u: %.100s"; v6 = sshfatal("uidswap.c", "temporarily_use_uid", 0x86, 0x0, 0x1, 0x0, *(&v4)); return v6; } return v6; }
openssh-portable
angr_sailr
static void malloc_debug_dummy() { write(1, "malloc_debug_dummy\n", 19); }
long long malloc_debug_dummy() { return write(0x1, "malloc_debug_dummy\n", 0x13); }
bash
angr_phoenix
static void outputPageFooter(char *l, char *c, char *r) { out_html("<HR>\n"); outputPageHeader(l, c, r); }
void outputPageFooter(char *a1, char *a2, char *a3) { out_html("<HR>\n"); outputPageHeader(a1, a2, a3); }
bash
ida
static void print_horizontal(void) { size_t filesno; size_t pos = 0; size_t cols = calculate_columns(0); struct column_info const *line_fmt = &column_info[cols - 1]; struct fileinfo const *f = sorted_file[0]; size_t name_length = length_of_file_name_and_frills(f); size_t max_name_length = line_fmt->col_arr[0]; print_file_name_and_frills(f, 0); for (filesno = 1; filesno < cwd_n_used; ++filesno) { size_t col = filesno % cols; if (col == 0) { putchar_unlocked(eolbyte); pos = 0; } else { indent(pos + name_length, pos + max_name_length); pos += max_name_length; } f = sorted_file[filesno]; print_file_name_and_frills(f, pos); name_length = length_of_file_name_and_frills(f); max_name_length = line_fmt->col_arr[col]; } putchar_unlocked(eolbyte); }
void print_horizontal() { unsigned long long v0; void *v1; unsigned long v2; unsigned long v3; unsigned long v4; struct_0 *v5; void *v6; unsigned long long *v7; unsigned long long v9; v1 = 0; v4 = calculate_columns(0x0); v5 = v4 * 24 - 24 + column_info; v6 = *(sorted_file); v2 = length_of_file_name_and_frills(v6); v3 = v5->field_10->field_0; print_file_name_and_frills(v6, 0x0); for (v0 = 1; v0 < cwd_n_used; v0 += 1) { v7 = (0 CONCAT v0) / m v4 >> 64; if (!v7) { putchar_unlocked(eolbyte); v1 = 0; } else { indent(v2 + v1, v1 + v3); v1 += v3; } v6 = *((sorted_file + v0 * 8)); print_file_name_and_frills(v6, v1); v2 = length_of_file_name_and_frills(v6); v3 = *((&v5->field_10->field_0 + 0x8 * v7)); } v9 = putchar_unlocked(eolbyte); return; }
coreutils
angr_dream
static void copy_attr_free(__attribute__((__unused__)) struct error_context *ctx, __attribute__((__unused__)) char const *str) {}
void copy_attr_free(void) { return; }
coreutils
ghidra
void usage(void) { fprintf(stderr, "usage: %s [-n] [-w] [-d] [-f] [-h] [-i]%s\n", progname, strcmp(progname, "halt") ? "" : " [-p]"); fprintf(stderr, "\t-n: don't sync before halting the system\n"); fprintf(stderr, "\t-w: only write a wtmp reboot record and exit.\n"); fprintf(stderr, "\t-d: don't write a wtmp record.\n"); fprintf(stderr, "\t-f: force halt/reboot, don't call shutdown.\n"); fprintf(stderr, "\t-h: put harddisks in standby mode.\n"); fprintf(stderr, "\t-i: shut down all network interfaces.\n"); if (!strcmp(progname, "halt")) fprintf(stderr, "\t-p: power down the system (if possible, otherwise halt).\n"); exit(1); }
void usage() { unsigned int v1; if (!strcmp(0x48fffffff9058b48, "halt")) v1 = &g_40074d; else v1 = &g_40074c; fprintf(stderr, "usage: %s [-n] [-w] [-d] [-f] [-h] [-i]%s\n", -117077176, v1); fprintf(stderr, "\t-n: don't sync before halting the system\n"); fprintf(stderr, "\t-w: only write a wtmp reboot record and exit.\n"); fprintf(stderr, "\t-d: don't write a wtmp record.\n"); fprintf(stderr, "\t-f: force halt/reboot, don't call shutdown.\n"); fprintf(stderr, "\t-h: put harddisks in standby mode.\n"); fprintf(stderr, "\t-i: shut down all network interfaces.\n"); if (!strcmp(0x48fffffff9058b48, "halt")) fprintf(stderr, "\t-p: power down the system (if possible, otherwise halt).\n"); exit(0x1); }
sysvinit
angr_phoenix
static _Bool star_digits_closebracket(const struct E_string *es, size_t idx) { if (!es_match(es, idx, '*')) return 0; for (size_t i = idx + 1; i < es->len; i++) if (!((unsigned int)(to_uchar(es->s[i])) - '0' <= 9) || es->escaped[i]) return es_match(es, i, ']'); return 0; }
int star_digits_closebracket(unsigned long long a0[3], char *a1) { char *v0; unsigned int v3; unsigned int v4; if ((es_match(a0, a1, 0x2a) ^ 1)) { v3 = 0; } else { v0 = a1 + 1; while (true) { if (v0 < a0[2]) { v4 = to_uchar(v0[a0[0]]) - 48; if (v4 <= 9 && !v0[a0[1]]) { v0 += 1; continue; } if (v4 > 9 || v0[a0[1]]) { v3 = es_match(a0, v0, 0x5d); break; } } else { v3 = 0; break; } } } return v3; }
coreutils
angr_dream
static _Bool buf_has_encoding_errors(char *buf, idx_t size) { if (!unibyte_mask) return 0; mbstate_t mbs = {0}; ptrdiff_t clen; buf[size] = -1; for (char const *p = buf; (p = skip_easy_bytes(p)) < buf + size; p += clen) { clen = imbrlen(p, buf + size - p, &mbs); if (clen < 0) return 1; } return 0; }
int buf_has_encoding_errors(char *a0, char *a1) { char *v0; unsigned long v1; void *v2; unsigned int v4; if (!unibyte_mask) { v4 = 0; } else { v2 = 0; *((a0 + a1)) = 255; v0 = a0; while (true) { v0 = skip_easy_bytes(v0); if (v0 < a0 + a1) { v1 = imbrlen(v0, a0 + a1 - v0, &v2, a0 + a1 - v0); if ((v1 - 0 >> 63)) { v4 = 1; break; } else { v0 += v1; } } else { v4 = 0; break; } } } return v4; }
grep
angr_dream
void mm_request_receive_expect(int sock, enum monitor_reqtype type, struct sshbuf *m) { u_char rtype; int r; sshlog("monitor_wrap.c", __func__, 170, 1, SYSLOG_LEVEL_DEBUG3, ((void *)0), "entering, type %d", type); mm_request_receive(sock, m); if ((r = sshbuf_get_u8(m, &rtype)) != 0) sshfatal("monitor_wrap.c", __func__, 174, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "parse"); if (rtype != type) sshfatal("monitor_wrap.c", __func__, 176, 1, SYSLOG_LEVEL_FATAL, ((void *)0), "read: rtype %d != type %d", rtype, type); }
unsigned long mm_request_receive_expect(unsigned int a1, unsigned int a2, long a3) { long v3; unsigned char v6; unsigned int u8; unsigned long v8; v8 = __readfsqword(0x28u); sshlog("monitor_wrap.c", "mm_request_receive_expect", 170LL, 1LL, 7LL, 0LL, "entering, type %d", a2); mm_request_receive(a1, a3); u8 = sshbuf_get_u8(a3, &v6); if (u8) { v3 = ssh_err(u8); sshfatal("monitor_wrap.c", "mm_request_receive_expect", 174LL, 1LL, 1LL, v3, "parse"); } if (a2 != v6) sshfatal("monitor_wrap.c", "mm_request_receive_expect", 176LL, 1LL, 1LL, 0LL, "read: rtype %d != type %d", v6, a2); return __readfsqword(0x28u) ^ v8; }
openssh-portable
ida
static inline __u32 rta_getattr_u32(const struct rtattr *rta) { return *(__u32 *)(( void *)(((char *)(rta)) + ((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0)))); }
undefined4 rta_getattr_u32(long param_1) { return *(undefined4 *)(param_1 + 4); }
iproute2-6.0.0
ghidra
void maybe_make_export_env() { register char **temp_array; int new_size; VAR_CONTEXT *tcxt, *icxt; if (array_needs_making) { if (export_env) strvec_flush(export_env); new_size = n_shell_variables() + ((shell_functions) ? (shell_functions)->nentries : 0) + 1 + ((temporary_env) ? (temporary_env)->nentries : 0) + ((invalid_env) ? (invalid_env)->nentries : 0); if (new_size > export_env_size) { export_env_size = new_size; export_env = strvec_resize(export_env, export_env_size); environ = export_env; } export_env[export_env_index = 0] = (char *)((void *)0); if (temporary_env) { tcxt = new_var_context((char *)((void *)0), 0); tcxt->table = temporary_env; tcxt->down = shell_variables; } else tcxt = shell_variables; if (invalid_env) { icxt = new_var_context((char *)((void *)0), 0); icxt->table = invalid_env; icxt->down = tcxt; } else icxt = tcxt; temp_array = make_var_export_array(icxt); if (temp_array) add_temp_array_to_env(temp_array, 0, 0); if (icxt != tcxt) sh_xfree((icxt), "variables.c", 5161); if (tcxt != shell_variables) sh_xfree((tcxt), "variables.c", 5164); temp_array = restricted ? (char **)0 : make_func_export_array(); if (temp_array) add_temp_array_to_env(temp_array, 0, 0); array_needs_making = 0; } }
void maybe_make_export_env() { unsigned int v0; struct_0 *v1; struct_0 *v2; unsigned long long v4; void *v6; unsigned long long v7; void *v8; unsigned long long v9; void *v10; unsigned long long v11; void *v12; unsigned long long v13; v4 = array_needs_making; if (array_needs_making) { if (export_env) strvec_flush(export_env); if (shell_functions) v6 = *((shell_functions + 12)); else v6 = 0; v7 = n_shell_variables() + v6 + 1; if (temporary_env) v8 = *((temporary_env + 12)); else v8 = 0; v9 = v7 + v8; if (invalid_env) v10 = *((invalid_env + 12)); else v10 = 0; v0 = (v10 + v9); if (v0 > export_env_size) { export_env_size = v0; export_env = strvec_resize(export_env, export_env_size, export_env_size); environ = export_env; } export_env_index = 0; *(export_env) = 0; if (temporary_env) { v1 = new_var_context(NULL, 0x0); v1->field_20 = temporary_env; v1->field_18 = *(&shell_variables); } else { v1 = *(&shell_variables); } if (invalid_env) { v2 = new_var_context(NULL, 0x0); v2->field_20 = invalid_env; v2->field_18 = v1; } else { v2 = v1; } v11 = make_var_export_array(v2); if (v11) add_temp_array_to_env(v11, 0x0, 0x0); if (v2 != v1) sh_xfree(v2, "variables.c", 0x1429); if (v1 != *(&shell_variables)) sh_xfree(v1, "variables.c", 0x142c); if (!restricted) v12 = make_func_export_array(); else v12 = 0; if (v12) v13 = add_temp_array_to_env(v12, 0x0, 0x0); array_needs_making = 0; } return; }
bash
angr_dream
test_code_t test_dhe_group(gnutls_session_t session) { int ret, ret2; gnutls_datum_t gen, prime, pubkey2; const char *print; FILE *fp; (void)remove("debug-dh.out"); if (verbose == 0 || pubkey.data == ((void *)0)) return TEST_IGNORE; sprintf(prio_str, "NONE:" "+CIPHER-ALL:+ARCFOUR-128:+3DES-CBC" ":+GOST28147-TC26Z-CNT" ":" "+COMP-NULL" ":%s:" "+MAC-ALL:+MD5:+SHA1" ":+GOST28147-TC26Z-IMIT" ":+DHE-RSA:+DHE-DSS:%s", protocol_str, rest); { int _ret; if ((_ret = __gnutls_priority_set_direct(session, prio_str, 544)) != TEST_SUCCEED) { return _ret; } }; gnutls_credentials_set(session, GNUTLS_CRD_CERTIFICATE, xcred); ret = test_do_handshake(session); ret2 = gnutls_dh_get_group(session, &gen, &prime); if (ret2 >= 0) { fp = fopen("debug-dh.out", "w"); if (fp == ((void *)0)) return TEST_FAILED; ext_text = "saved in debug-dh.out"; print = raw_to_string(gen.data, gen.size); if (print) { fprintf(fp, " Generator [%d bits]: %s\n", gen.size * 8, print); } print = raw_to_string(prime.data, prime.size); if (print) { fprintf(fp, " Prime [%d bits]: %s\n", prime.size * 8, print); } gnutls_dh_get_pubkey(session, &pubkey2); print = raw_to_string(pubkey2.data, pubkey2.size); if (print) { fprintf(fp, " Pubkey [%d bits]: %s\n", pubkey2.size * 8, print); } if (pubkey2.data && pubkey2.size == pubkey.size && memcmp(pubkey.data, pubkey2.data, pubkey.size) == 0) { fprintf(fp, " (public key seems to be static among sessions)\n"); } { gnutls_dh_params_t dhp; gnutls_datum_t p3; ret2 = gnutls_dh_params_init(&dhp); if (ret2 < 0) { fclose(fp); return TEST_FAILED; } ret2 = gnutls_dh_params_import_raw(dhp, &prime, &gen); if (ret2 < 0) { gnutls_dh_params_deinit(dhp); fclose(fp); return TEST_FAILED; } ret2 = gnutls_dh_params_export2_pkcs3(dhp, GNUTLS_X509_FMT_PEM, &p3); if (ret2 < 0) { gnutls_dh_params_deinit(dhp); fclose(fp); return TEST_FAILED; } gnutls_dh_params_deinit(dhp); fprintf(fp, "\n%s\n", p3.data); gnutls_free((void *)(p3.data)), p3.data = ((void *)0); } fclose(fp); } return ret; }
long test_dhe_group(long a1) { unsigned int v2; unsigned int v3; long v4; FILE *stream; const char *v6; long v7; unsigned int v8; long v9; unsigned int v10; void *s2; unsigned int v12; const char *v13[4]; v13[3] = (const char *)__readfsqword(0x28u); remove("debug-dh.out"); if (!verbose || !pubkey) return 3LL; sprintf(prio_str, "NONE:+CIPHER-ALL:+ARCFOUR-128:+3DES-CBC:+GOST28147-TC26Z-CNT:+COMP-" "NULL:%s:+MAC-ALL:+MD5:+SHA1:+GOST28147-TC26Z-IMIT" ":+DHE-RSA:+DHE-DSS:%s", protocol_str, rest); v2 = _gnutls_priority_set_direct(a1, prio_str, 0x220u); if (v2) return v2; gnutls_credentials_set(a1, 1LL, xcred); v3 = test_do_handshake(a1); if ((int)gnutls_dh_get_group(a1, &v7, &v9) >= 0) { stream = fopen("debug-dh.out", "w"); if (!stream) return 1LL; ext_text = "saved in debug-dh.out"; v6 = (const char *)raw_to_string(v7, v8); if (v6) fprintf(stream, " Generator [%d bits]: %s\n", 8 * v8, v6); v6 = (const char *)raw_to_string(v9, v10); if (v6) fprintf(stream, " Prime [%d bits]: %s\n", 8 * v10, v6); gnutls_dh_get_pubkey(a1, &s2); v6 = (const char *)raw_to_string(s2, v12); if (v6) fprintf(stream, " Pubkey [%d bits]: %s\n", 8 * v12, v6); if (s2 && v12 == (_DWORD)n && !memcmp(pubkey, s2, (unsigned int)n)) fprintf(stream, " (public key seems to be static among sessions)\n"); if ((int)gnutls_dh_params_init(&v4) < 0) { fclose(stream); return 1LL; } if ((int)gnutls_dh_params_import_raw(v4, &v9, &v7) < 0 || (int)gnutls_dh_params_export2_pkcs3(v4, 1LL, v13) < 0) { gnutls_dh_params_deinit(v4); fclose(stream); return 1LL; } gnutls_dh_params_deinit(v4); fprintf(stream, "\n%s\n", v13[0]); gnutls_free(v13[0]); v13[0] = 0LL; fclose(stream); } return v3; }
gnutls
ida
static int find_mail_file(file) char *file; { register int i; for (i = 0; i < mailfiles_count; i++) if (((mailfiles[i]->name)[0] == (file)[0] && strcmp(mailfiles[i]->name, file) == 0)) return i; return -1; }
int find_mail_file(char *a0) { void *v1; unsigned int v2; v1 = 0; while (true) { if (v1 >= mailfiles_count) { v2 = -1; break; } else { if (*(*(*((mailfiles + (v1 << 3))))) == *(a0) && !strcmp(*(*((mailfiles + (v1 << 3)))), a0)) { v2 = v1; break; } v1 = v1 + 1; } } return v2; }
bash
angr_phoenix
int sys_auth_passwd(struct ssh *ssh, const char *password) { Authctxt *authctxt = ssh->authctxt; struct passwd *pw = authctxt->pw; char *encrypted_password, *salt = ((void *)0); char *pw_password = authctxt->valid ? shadow_pw(pw) : pw->pw_passwd; if (pw_password == ((void *)0)) return 0; if (strcmp(pw_password, "") == 0 && strcmp(password, "") == 0) return (1); if (authctxt->valid && pw_password[0] && pw_password[1]) salt = pw_password; encrypted_password = xcrypt(password, salt); return encrypted_password != ((void *)0) && strcmp(encrypted_password, pw_password) == 0; }
int sys_auth_passwd(struct_0 *a0, char *a1) { unsigned long v0; struct_1 *v1; struct_2 *v2; unsigned long v3; char *v4; unsigned long v6; v1 = a0->field_860; v2 = v1->field_30; v0 = 0; if (!v1->field_c) v6 = v2->field_8; else v6 = shadow_pw(v2); v3 = v6; if (!v3) { *(&v6) = 0; } else { if (!strcmp(v3, &g_40021c) && !strcmp(a1, &g_40021c)) { *(&v6) = 1; goto LABEL_400216; } if (v1->field_c && *(v3) && *((v3 + 1))) v0 = v3; v4 = xcrypt(a1, v0, v0); if (v4 && !strcmp(v4, v3)) { *(&v6) = 1; goto LABEL_400216; } *(&v6) = 0; } LABEL_400216: return v6; }
openssh-portable
angr_phoenix
static void print_mptcp_addr_flags(unsigned int flags) { unsigned int i; for (i = 0; i < (sizeof(mptcp_addr_flag_names) / sizeof((mptcp_addr_flag_names)[0])); i++) { unsigned long mask = mptcp_addr_flag_names[i].value; if (flags & mask) { print_string(PRINT_FP, ((void *)0), "%s ", mptcp_addr_flag_names[i].name); print_bool(PRINT_JSON, mptcp_addr_flag_names[i].name, ((void *)0), 1); } flags &= ~mask; } if (flags) { char b1[64]; snprintf(b1, sizeof(b1), "%02x", flags); print_string(PRINT_ANY, "rawflags", "rawflags %s ", b1); } }
void print_mptcp_addr_flags(uint param_1) { ulong uVar1; long in_FS_OFFSET; uint local_6c; uint local_64; char local_58[72]; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); local_6c = param_1; for (local_64 = 0; local_64 < 6; local_64 = local_64 + 1) { uVar1 = *(ulong *)(mptcp_addr_flag_names + (ulong)local_64 * 0x10 + 8); if ((local_6c & uVar1) != 0) { print_string( 1, 0, &DAT_00101f56, *(undefined8 *)(mptcp_addr_flag_names + (ulong)local_64 * 0x10)); print_bool( 2, *(undefined8 *)(mptcp_addr_flag_names + (ulong)local_64 * 0x10), 0, 1); } local_6c = local_6c & ~(uint)uVar1; } if (local_6c != 0) { snprintf(local_58, 0x40, "%02x", (ulong)local_6c); print_string(4, "rawflags", "rawflags %s ", local_58); } if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) { __stack_chk_fail(); } return; }
iproute2-6.0.0
ghidra
static void client_init_dispatch(struct ssh *ssh) { ssh_dispatch_init(ssh, &dispatch_protocol_error); ssh_dispatch_set(ssh, 97, &channel_input_oclose); ssh_dispatch_set(ssh, 94, &channel_input_data); ssh_dispatch_set(ssh, 96, &channel_input_ieof); ssh_dispatch_set(ssh, 95, &channel_input_extended_data); ssh_dispatch_set(ssh, 90, &client_input_channel_open); ssh_dispatch_set(ssh, 91, &channel_input_open_confirmation); ssh_dispatch_set(ssh, 92, &channel_input_open_failure); ssh_dispatch_set(ssh, 98, &client_input_channel_req); ssh_dispatch_set(ssh, 93, &channel_input_window_adjust); ssh_dispatch_set(ssh, 99, &channel_input_status_confirm); ssh_dispatch_set(ssh, 100, &channel_input_status_confirm); ssh_dispatch_set(ssh, 80, &client_input_global_request); ssh_dispatch_set(ssh, 20, &kex_input_kexinit); ssh_dispatch_set(ssh, 82, &client_global_request_reply); ssh_dispatch_set(ssh, 81, &client_global_request_reply); }
void client_init_dispatch(unsigned long long a0) { unsigned long long v1; ssh_dispatch_init(a0, got.dispatch_protocol_error, got.dispatch_protocol_error); ssh_dispatch_set(a0, 0x61, got.channel_input_oclose); ssh_dispatch_set(a0, 0x5e, got.channel_input_data); ssh_dispatch_set(a0, 0x60, got.channel_input_ieof); ssh_dispatch_set(a0, 0x5f, got.channel_input_extended_data); ssh_dispatch_set(a0, 0x5a, client_input_channel_open); ssh_dispatch_set(a0, 0x5b, got.channel_input_open_confirmation); ssh_dispatch_set(a0, 0x5c, got.channel_input_open_failure); ssh_dispatch_set(a0, 0x62, client_input_channel_req); ssh_dispatch_set(a0, 0x5d, got.channel_input_window_adjust); ssh_dispatch_set(a0, 0x63, got.channel_input_status_confirm); ssh_dispatch_set(a0, 0x64, got.channel_input_status_confirm); ssh_dispatch_set(a0, 0x50, client_input_global_request); ssh_dispatch_set(a0, 0x14, got.kex_input_kexinit); ssh_dispatch_set(a0, 0x52, client_global_request_reply); v1 = ssh_dispatch_set(a0, 0x51, client_global_request_reply); return; }
openssh-portable
angr_sailr
static void usage(int status) { FILE *usageout = (0 != status) ? stderr : stdout; (void)fprintf(usageout, gettext("Usage: %s [option] GROUP\n" "\n" "Options:\n") , Prog); (void)fputs(gettext(" -a, --add USER add USER to GROUP\n"), usageout); (void)fputs( gettext(" -d, --delete USER remove USER from GROUP\n"), usageout); (void)fputs(gettext(" -h, --help display this help " "message and exit\n"), usageout); (void)fputs( gettext(" -Q, --root CHROOT_DIR directory to chroot into\n"), usageout); (void)fputs( gettext(" -r, --remove-password remove the GROUP's password\n"), usageout); (void)fputs(gettext(" -R, --restrict restrict access to " "GROUP to its members\n"), usageout); (void)fputs( gettext( " -M, --members USER,... set the list of members of GROUP\n"), usageout); (void)fputs(gettext(" -A, --administrators ADMIN,...\n" " set the list of " "administrators for GROUP\n"), usageout); (void)fputs(gettext("Except for the -A and -M options, the options cannot be " "combined.\n"), usageout); exit(status); }
void usage(int a1) { struct _IO_FILE *v1; long v2; char *v3; char *v4; char *v5; char *v6; char *v7; char *v8; char *v9; char *v10; char *v11; char *v12; FILE *stream; if (a1) v1 = stderr; else v1 = stdout; stream = v1; v2 = Prog; v3 = gettext("Usage: %s [option] GROUP\n\nOptions:\n"); fprintf(stream, v3, v2); v4 = gettext(" -a, --add USER add USER to GROUP\n"); fputs(v4, stream); v5 = gettext(" -d, --delete USER remove USER from GROUP\n"); fputs(v5, stream); v6 = gettext( " -h, --help display this help message and exit\n"); fputs(v6, stream); v7 = gettext(" -Q, --root CHROOT_DIR directory to chroot into\n"); fputs(v7, stream); v8 = gettext(" -r, --remove-password remove the GROUP's password\n"); fputs(v8, stream); v9 = gettext(" -R, --restrict restrict access to GROUP to " "its members\n"); fputs(v9, stream); v10 = gettext( " -M, --members USER,... set the list of members of GROUP\n"); fputs(v10, stream); v11 = gettext(" -A, --administrators ADMIN,...\n " " set the list of administrators for GROUP\n"); fputs(v11, stream); v12 = gettext( "Except for the -A and -M options, the options cannot be combined.\n"); fputs(v12, stream); exit(a1); }
shadow
ida
int do_handshake(socket_st *socket) { int ret; if (fastopen && socket->connect_addrlen) { gnutls_transport_set_fastopen(socket->session, socket->fd, (struct sockaddr *)&socket->connect_addr, socket->connect_addrlen, 0); socket->connect_addrlen = 0; } else { ; } do { gnutls_handshake_set_timeout(socket->session, ((unsigned int)-1)); ret = gnutls_handshake(socket->session); if (ret < 0) { handle_error(socket, ret); } } while (ret < 0 && gnutls_error_is_fatal(ret) == 0); if (ret == 0) { print_info(socket->session, verbose, gnutls_cli_options.present.x509certfile ? (1 << 1) : 0); if (gnutls_cli_options.present.keymatexport) print_key_material(socket->session, gnutls_cli_options.arg.keymatexport, gnutls_cli_options.present.keymatexportsize ? gnutls_cli_options.value.keymatexportsize : 20); socket->secure = 1; } else { gnutls_alert_send_appropriate(socket->session, ret); shutdown(socket->fd, SHUT_RDWR); } return ret; }
int do_handshake(int *param_1) { int iVar1; int iVar2; long lVar3; undefined8 uVar4; if ((fastopen != 0) && (param_1[0x34] != 0)) { gnutls_transport_set_fastopen(*(undefined8 *)(param_1 + 2), *param_1, param_1 + 0x14, param_1[0x34], 0); param_1[0x34] = 0; } do { gnutls_handshake_set_timeout(*(undefined8 *)(param_1 + 2), 0xffffffff); iVar1 = gnutls_handshake(*(undefined8 *)(param_1 + 2)); if (iVar1 < 0) { handle_error(param_1, iVar1); } if (-1 < iVar1) break; iVar2 = gnutls_error_is_fatal(iVar1); } while (iVar2 == 0); if (iVar1 == 0) { if (DAT_00108117 == '\0') { uVar4 = 0; } else { uVar4 = 2; } print_info(*(undefined8 *)(param_1 + 2), verbose, uVar4); if (DAT_00108137 != '\0') { if (print_cert_info == (code)0x0) { lVar3 = 0x14; } else { lVar3 = (long)_gnutls_session_key_update; } print_key_material(*(undefined8 *)(param_1 + 2), _gnutls_alert_get_name, lVar3); } param_1[4] = 1; } else { gnutls_alert_send_appropriate(*(undefined8 *)(param_1 + 2), iVar1); shutdown(*param_1, 2); } return iVar1; }
gnutls
ghidra
static void print_stats(const char *prefix, const char *names[], unsigned int num, struct rtattr *stats[]) { if (is_json_context()) print_json_stats(names, num, stats); else print_fp_stats(prefix, names, num, stats); }
void print_stats(unsigned long a0, unsigned long long *a1, unsigned long a2, unsigned long long *a3, unsigned long long a4, unsigned long long a5) { unsigned long long v1; unsigned long long v2; if (!is_json_context(a0, a1, a2, a3, a4, a5)) v1 = print_fp_stats(a0, a1, a2, a3); else v2 = print_json_stats(a1, a2, a3); return; }
iproute2-6.0.0
angr_phoenix
int inflate(void) { int e; int r; unsigned h; outcnt = 0; bk = 0; bb = 0; h = 0; do { hufts = 0; if ((r = inflate_block(&e)) != 0) return r; if (hufts > h) h = hufts; } while (!e); while (bk >= 8) { bk -= 8; inptr--; } (outcnt = (outcnt), flush_window()); ; return 0; }
long long inflate() { char v0; unsigned int v1; unsigned int v2; void *v4; outcnt = 0; bk = 0; bb = 0; v1 = 0; while (true) { hufts = 0; v2 = inflate_block(&v0); if (v2) { v4 = v2; return v4; } if (v1 < hufts) v1 = hufts; if (*(&v0)) { for (; bk > 7; inptr = inptr - 1) { bk = bk - 8; } outcnt = outcnt; flush_window(); v4 = 0; return v4; } } }
gzip-1.12
angr_sailr
static char *quote_compound_array_word(w, type) char *w; int type; { char *nword, *sub, *value, *t; int ind, wlen, i; if (w[0] != '[') return (sh_single_quote(w)); ind = skipsubscript(w, 0, 0); if (w[ind] != ']') return (sh_single_quote(w)); wlen = strlen(w); w[ind] = '\0'; t = (strchr(w + 1, '\001')) ? quote_escapes(w + 1) : w + 1; sub = sh_single_quote(t); if (t != w + 1) sh_xfree((t), "arrayfunc.c", 970); w[ind] = ']'; nword = sh_xmalloc((wlen * 4 + 5), "arrayfunc.c", 973); nword[0] = '['; i = (((sub) && (sub)[0]) ? ((sub)[1] ? ((sub)[2] ? strlen(sub) : 2) : 1) : 0); memcpy(nword + 1, sub, i); sh_xfree((sub), "arrayfunc.c", 977); i++; nword[i++] = w[ind++]; if (w[ind] == '+') nword[i++] = w[ind++]; nword[i++] = w[ind++]; t = (strchr(w + ind, '\001')) ? quote_escapes(w + ind) : w + ind; value = sh_single_quote(t); if (t != w + ind) sh_xfree((t), "arrayfunc.c", 986); strcpy(nword + i, value); return nword; }
_BYTE *quote_compound_array_word(const char *a1) { const char *v2; int v3; int v4; const char *v5; int v6; int v7; const char *v8; int v9; int v10; const char *v11; int v12; const char *v13; int v14; int v15; int v16; int v17; int v18; int v19; int v20; const char *v21; const char *v22; char *v23; _BYTE *v24; char *src; if (*a1 != 91) return (_BYTE *)sh_single_quote(a1); v14 = skipsubscript(a1, 0LL, 0LL); if (a1[v14] != 93) return (_BYTE *)sh_single_quote(a1); v20 = strlen(a1); a1[v14] = 0; if (strchr(a1 + 1, 1)) v2 = (const char *)quote_escapes(a1 + 1); else v2 = a1 + 1; v21 = v2; v23 = (char *)sh_single_quote(v2); if (v21 != a1 + 1) sh_xfree(v21, "arrayfunc.c", 970LL); a1[v14] = 93; v24 = (_BYTE *)sh_xmalloc(4 * v20 + 5, "arrayfunc.c", 973LL); *v24 = 91; if (v23 && *v23) { if (v23[1]) { if (v23[2]) v3 = strlen(v23); else v3 = 2; } else { v3 = 1; } } else { v3 = 0; } v17 = v3; memcpy(v24 + 1, v23, v3); sh_xfree(v23, "arrayfunc.c", 977LL); v4 = v14; v15 = v14 + 1; v5 = &a1[v4]; v6 = v17 + 1; v18 = v17 + 2; v24[v6] = *v5; if (a1[v15] == 43) { v7 = v15++; v8 = &a1[v7]; v9 = v18++; v24[v9] = *v8; } v10 = v15; v16 = v15 + 1; v11 = &a1[v10]; v12 = v18; v19 = v18 + 1; v24[v12] = *v11; if (strchr(&a1[v16], 1)) v13 = (const char *)quote_escapes(&a1[v16]); else v13 = &a1[v16]; v22 = v13; src = (char *)sh_single_quote(v13); if (v22 != &a1[v16]) sh_xfree(v22, "arrayfunc.c", 986LL); strcpy(&v24[v19], src); return v24; }
bash
ida
int mac_check(struct sshmac *mac, u_int32_t seqno, const u_char *data, size_t dlen, const u_char *theirmac, size_t mlen) { u_char ourmac[64]; int r; if (mac->mac_len > mlen) return -10; if ((r = mac_compute(mac, seqno, data, dlen, ourmac, sizeof(ourmac))) != 0) return r; if (timingsafe_bcmp(ourmac, theirmac, mac->mac_len) != 0) return -30; return 0; }
long long mac_check(struct_0 *a0, unsigned long a1, unsigned long long a2, unsigned long long a3, unsigned long long a4, unsigned long a5) { unsigned int v0; char v1; unsigned long long v3; if (a5 < a0->field_c) { v3 = 4294967286; } else { v0 = mac_compute(a0, a1, a2, a3, &v1, 0x40); if (v0) { v3 = v0; } else if (timingsafe_bcmp(&v1, a4, a0->field_c, a4)) { v3 = 4294967266; } else { v3 = 0; } } return v3; }
openssh-portable
angr_phoenix
static int input_kex_gen_reply(int type, u_int32_t seq, struct ssh *ssh) { struct kex *kex = ssh->kex; struct sshkey *server_host_key = ((void *)0); struct sshbuf *shared_secret = ((void *)0); struct sshbuf *server_blob = ((void *)0); struct sshbuf *tmp = ((void *)0), *server_host_key_blob = ((void *)0); u_char *signature = ((void *)0); u_char hash[64]; size_t slen, hashlen; int r; sshlog("kexgen.c", __func__, 151, 0, SYSLOG_LEVEL_DEBUG1, ((void *)0), "SSH2_MSG_KEX_ECDH_REPLY received"); ssh_dispatch_set(ssh, 31, &kex_protocol_error); if ((r = sshpkt_getb_froms(ssh, &server_host_key_blob)) != 0) goto out; if ((tmp = sshbuf_fromb(server_host_key_blob)) == ((void *)0)) { r = -2; goto out; } if ((r = sshkey_fromb(tmp, &server_host_key)) != 0) goto out; if ((r = kex_verify_host_key(ssh, server_host_key)) != 0) goto out; if ((r = sshpkt_getb_froms(ssh, &server_blob)) != 0 || (r = sshpkt_get_string(ssh, &signature, &slen)) != 0 || (r = sshpkt_get_end(ssh)) != 0) goto out; switch (kex->kex_type) { case KEX_DH_GRP1_SHA1: case KEX_DH_GRP14_SHA1: case KEX_DH_GRP14_SHA256: case KEX_DH_GRP16_SHA512: case KEX_DH_GRP18_SHA512: r = kex_dh_dec(kex, server_blob, &shared_secret); break; case KEX_ECDH_SHA2: r = kex_ecdh_dec(kex, server_blob, &shared_secret); break; case KEX_C25519_SHA256: r = kex_c25519_dec(kex, server_blob, &shared_secret); break; case KEX_KEM_SNTRUP761X25519_SHA512: r = kex_kem_sntrup761x25519_dec(kex, server_blob, &shared_secret); break; default: r = -10; break; } if (r != 0) goto out; hashlen = sizeof(hash); if ((r = kex_gen_hash(kex->hash_alg, kex->client_version, kex->server_version, kex->my, kex->peer, server_host_key_blob, kex->client_pub, server_blob, shared_secret, hash, &hashlen)) != 0) goto out; if ((r = sshkey_verify(server_host_key, signature, slen, hash, hashlen, kex->hostkey_alg, ssh->compat, ((void *)0))) != 0) goto out; if ((r = kex_derive_keys(ssh, hash, hashlen, shared_secret)) != 0 || (r = kex_send_newkeys(ssh)) != 0) goto out; if ((kex->flags & 0x0002) != 0) { if (kex->initial_hostkey != ((void *)0) || kex->initial_sig != ((void *)0)) { r = -1; goto out; } if ((kex->initial_sig = sshbuf_new()) == ((void *)0)) { r = -2; goto out; } if ((r = sshbuf_put(kex->initial_sig, signature, slen)) != 0) goto out; kex->initial_hostkey = server_host_key; server_host_key = ((void *)0); } out: explicit_bzero(hash, sizeof(hash)); explicit_bzero(kex->c25519_client_key, sizeof(kex->c25519_client_key)); explicit_bzero(kex->sntrup761_client_key, sizeof(kex->sntrup761_client_key)); sshbuf_free(server_host_key_blob); free(signature); sshbuf_free(tmp); sshkey_free(server_host_key); sshbuf_free(server_blob); sshbuf_free(shared_secret); sshbuf_free(kex->client_pub); kex->client_pub = ((void *)0); return r; }
long long input_kex_gen_reply(unsigned long a0, unsigned long a1, struct_0 *a2) { void *v0; unsigned int v1; unsigned int v2; unsigned int v3; void *v4; void *v5; void *v6; void *v7; void *v8; char v9; unsigned long long v10; void *v11; struct_1 *v12; char v13; v2 = a0; v1 = a1; v12 = a2->field_8; v4 = 0; v5 = 0; v6 = 0; v11 = 0; v7 = 0; v8 = 0; sshlog("kexgen.c", "input_kex_gen_reply", 0x97, 0x0, 0x5, 0x0); ssh_dispatch_set(a2, 0x1f, got.kex_protocol_error); v3 = sshpkt_getb_froms(a2, &v7, &v7); if (!v3) { v11 = sshbuf_fromb(v7); if (!v11) { v3 = -2; } else { v3 = sshkey_fromb(v11, &v4, &v4); if (!v3) { v3 = kex_verify_host_key(a2, v4, v4); if (!v3) { v3 = sshpkt_getb_froms(a2, &v6, &v6); if (!v3) { v3 = sshpkt_get_string(a2, &v8, &v9, &v8); if (!v3) { v3 = sshpkt_get_end(a2); if (!v3) { if (v12->field_38 != 9) { if (v12->field_38 <= 9) { if (v12->field_38 == 8) { v3 = kex_c25519_dec(v12, v6, &v5, v6); } else if (v12->field_38 <= 8) { if (v12->field_38 <= 4) { v3 = kex_dh_dec(v12, v6, &v5, v6); } else if (v12->field_38 == 7) { v3 = kex_ecdh_dec(v12, v6, &v5, v6); } } } if (v12->field_38 > 9 || v12->field_38 > 8 && v12->field_38 != 8 || v12->field_38 != 7 && v12->field_38 != 8 && v12->field_38 > 4) v3 = -10; } else { v3 = kex_kem_sntrup761x25519_dec(v12, v6, &v5, v6); } if (!v3) { v10 = 64; v3 = kex_gen_hash(v12->field_90, v12->field_60, v12->field_68, v12->field_50, v12->field_58, v7, v12->field_868, v6, v5, &v13, &v10); if (!v3) { v0 = 0; v3 = sshkey_verify(v4, v8, *(&v9), &v13, v10, v12->field_28, a2->field_83c); if (!v3) { v3 = kex_derive_keys(a2, &v13, v10, v5); if (!v3) { v3 = kex_send_newkeys(a2); if (!v3 && (v12->field_8c & 2)) { if (!v12->field_80 && !v12->field_78) { v12->field_78 = sshbuf_new(); if (!v12->field_78) { v3 = -2; } else { v3 = sshbuf_put(v12->field_78, v8, *(&v9), v8); if (!v3) { v12->field_80 = v4; v4 = 0; } } } if (v12->field_80 || v12->field_78) v3 = -1; } } } } } } } } } } } } explicit_bzero(&v13, 0x40); explicit_bzero(&v12->padding_94[172], 0x20); explicit_bzero(&v12->padding_94[236], 0x6e3); sshbuf_free(v7); free(v8); sshbuf_free(v11); sshkey_free(v4); sshbuf_free(v6); sshbuf_free(v5); sshbuf_free(v12->field_868); v12->field_868 = 0; return v3; }
openssh-portable
angr_dream
static void ipstats_stat_desc_pack_l3_stats(struct ipstats_stat_dump_filters *filters, const struct ipstats_stat_desc *desc) { ipstats_stat_desc_enable_bit(filters, IFLA_STATS_LINK_OFFLOAD_XSTATS, IFLA_OFFLOAD_XSTATS_L3_STATS); ipstats_stat_desc_enable_bit(filters, IFLA_STATS_LINK_OFFLOAD_XSTATS, IFLA_OFFLOAD_XSTATS_HW_S_INFO); }
void ipstats_stat_desc_pack_l3_stats(undefined8 param_1) { ipstats_stat_desc_enable_bit(param_1, 4, 3); ipstats_stat_desc_enable_bit(param_1, 4, 2); return; }
iproute2-6.0.0
ghidra
static ssize_t send_line(socket_st *socket, const char *txt) { int len = strlen(txt); int ret; if (socket->verbose) fprintf(stderr, "starttls: sending: %s\n", txt); ret = send(socket->fd, txt, len, 0); if (ret == -1) { fprintf(stderr, "error sending \"%s\"\n", txt); exit(2); } return ret; }
void send_line(unsigned int a0[19], void *a1) { unsigned int v0; unsigned int v1; unsigned long long v3; v0 = strlen(a1); if (a0[18]) fprintf(stderr, "starttls: sending: %s\n", a1); v1 = send(a0[0], a1, v0, 0x0); if (v1 != -1) { v3 = v1; return; } fprintf(stderr, "error sending \"%s\"\n", a1); exit(0x2); }
gnutls
angr_phoenix
void ipmroute_reset_filter(int ifindex) { memset(&filter, 0, sizeof(filter)); filter.mdst.bitlen = -1; filter.msrc.bitlen = -1; filter.iif = ifindex; }
void ipmroute_reset_filter(unsigned long a0) { unsigned int v0; unsigned long v2; v0 = a0; memset(&filter, 0x0, 0x21c); g_401050 = 65535; g_401158 = 65535; v2 = a0; g_401048 = a0; return; }
iproute2-6.0.0
angr_sailr
static void netns_restore(void) { if (saved_netns == -1) return; if (setns(saved_netns, 0x40000000)) { perror("setns"); exit(1); } close(saved_netns); saved_netns = -1; }
void netns_restore() { unsigned long long v1; unsigned long long v2; v1 = saved_netns; if (saved_netns == -1) { return; } else if (!setns(saved_netns, 0x40000000)) { v2 = close(saved_netns); saved_netns = -1; return; } else { perror("setns"); exit(0x1); } }
iproute2-6.0.0
angr_sailr
static void process_extended_fsync(u_int32_t id) { int handle, fd, r, status = 8; if ((r = get_handle(iqueue, &handle)) != 0) sshfatal("sftp-server.c", __func__, 1455, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "parse"); sshlog("sftp-server.c", __func__, 1456, 0, SYSLOG_LEVEL_DEBUG3, ((void *)0), "request %u: fsync (handle %u)", id, handle); sshlog("sftp-server.c", __func__, 1457, 0, SYSLOG_LEVEL_VERBOSE, ((void *)0), "fsync \"%s\"", handle_to_name(handle)); if ((fd = handle_to_fd(handle)) < 0) status = 2; else if (handle_is_ok(handle, HANDLE_FILE)) { r = fsync(fd); status = (r == -1) ? errno_to_portable((*__errno_location())) : 0; } send_status(id, status); }
long long process_extended_fsync(unsigned long a0) { unsigned long long v0; char v1; unsigned int v2; unsigned int v3; unsigned int v4; unsigned long long v5; unsigned long v6; char v7; unsigned int v10; v2 = 8; v3 = get_handle(0xe87d894820ec8348, &v1); if (v3) { v0 = "parse"; sshfatal("sftp-server.c", "process_extended_fsync", 0x5af, 0x1, 0x1, ssh_err(v3)); } v5 = *(&v1); v3 = a0; v1 = "request %u: fsync (handle %u)"; sshlog("sftp-server.c", "process_extended_fsync", 0x5b0, 0x0, 0x7, 0x0, *(&v7)); *(&v6) = handle_to_name(*(&v1)); v5 = "fsync \"%s\""; sshlog("sftp-server.c", "process_extended_fsync", 0x5b1, 0x0, 0x4, 0x0, *(&v7)); v4 = handle_to_fd(*(&v1)); if (v4 < 0) { v2 = 2; } else { v10 = handle_is_ok(*(&v1), 0x2); if (v10) { v3 = fsync(v4); if (v3 == -1) v10 = errno_to_portable(*(__errno_location())); else v10 = 0; v2 = v10; } } send_status(a0, v2); return 0; }
openssh-portable
angr_dream
static char *evalvar(char *p, int flag) { int subtype; int varflags; char *var; int patloc; int startloc; ssize_t varlen; int discard; int quoted; varflags = *p++; subtype = varflags & 0x0f; quoted = flag & 0x100; var = p; startloc = expdest - (char *)((void *)stacknxt); p = strchr(p, '=') + 1; again: varlen = varvalue(var, varflags, flag, quoted); if (varflags & 0x10) varlen--; discard = varlen < 0 ? 0x400 : 0; switch (subtype) { case 0x3: discard ^= 0x400; case 0: case 0x2: p = argstr(p, flag | 0x2 | 0x80 | (discard ^ 0x400)); goto record; case 0x5: case 0x4: p = subevalvar(p, var, 0, startloc, varflags, (flag & ~(0x1 | 0x10)) | (discard ^ 0x400)); if ((flag | ~discard) & 0x400) goto record; varflags &= ~0x10; subtype = 0x1; goto again; } if ((discard & ~flag) && optlist[14]) varunset(p, var, 0, 0); if (subtype == 0xa) { p++; if (flag & 0x400) return p; cvtnum(varlen > 0 ? varlen : 0, flag); goto really_record; } if (subtype == 0x1) goto record; flag |= discard; if (!(flag & 0x400)) { ((expdest) = _STPUTC(('\0'), (expdest))); } patloc = expdest - (char *)((void *)stacknxt); p = subevalvar(p, ((void *)0), patloc, startloc, varflags, flag); record: if ((flag | discard) & 0x400) return p; really_record: if (quoted) { quoted = *var == '@' && shellparam.nparam; if (!quoted) return p; } recordregion(startloc, expdest - (char *)((void *)stacknxt), quoted); return p; }
int evalvar(unsigned long a0, unsigned long a1) { unsigned int v0; int tmp_45; int tmp_39; int tmp_19; int tmp_30; void *v1; unsigned int v2; unsigned int v3; unsigned int v4; unsigned int v5; unsigned int v6; unsigned int v7; unsigned long long v8; char *v9; unsigned long v12; unsigned long long v14; v1 = a0; v0 = a1; tmp_45 = v1; v1 += 1; v3 = *(tmp_45); v2 = v3 & 15; v5 = v0 & 0x100; v9 = v1; v6 = expdest - stacknxt; v12 = strchr(v1, 0x3d) + 1; v1 = v12; while (true) { v8 = varvalue(v9, v3, v0, v5); if ((v3 & 16)) v8 -= 1; v4 = (v8 >> 53) & 0x400; if (v2 > 5) { LABEL_4011cb: if ((!(v0)&v4) && g_5000f6) varunset(v1, v9, 0x0, 0x0); if (v2 != 10) { if (v2 != 1) { v0 |= v4; if (!(v0 & 0x400)) expdest = _STPUTC(0x0, expdest); v7 = expdest - stacknxt; v1 = subevalvar(v1, 0x0, v7, v6, v3, v0); } } else { v1 += 1; if (!(v0 & 0x400)) { if ((v8 - 0 >> 63 ^ 1)) v12 = v8; else v12 = 0; cvtnum(v12, v0); goto LABEL_4012ca; } else { *(&v12) = v1; break; } } LABEL_4012b4: if (((v0 | v4) & 0x400)) { *(&v12) = v1; break; } LABEL_4012ca: if (!v5) { recordregion(v6, expdest - stacknxt, v5); *(&v12) = v1; break; } if (*(v9) == 64 && shellparam) { *(&v12) = 1; goto LABEL_4012f1; } *(&v12) = 0; LABEL_4012f1: v5 = v12; if (!v5) { *(&v12) = v1; break; } } else if (v2 >= 4) { v12 = v4; *(&v12) = (v4 >> 8) ^ 4; tmp_39 = v12; v1 = subevalvar(v1, v9, 0x0, v6, v3, v0 & -18 | tmp_39); if (!(!((!(v4) | v0) & 0x400))) goto LABEL_4012b4; v3 &= -17; v2 = 1; } else if (v2 == 3) { v4 ^= 0x400; LABEL_401147: v14 = v0; *(&v14) = v0 | 130; tmp_19 = v14; v12 = v4; *(&v12) = (v4 >> 8) ^ 4; tmp_30 = v12; v1 = argstr(v1, tmp_19 | tmp_30); goto LABEL_4012b4; } else if (v2 <= 3 && v2) { if (!(v2 == 2)) goto LABEL_4011cb; goto LABEL_401147; } } return v12; }
dash-0.5.11+git20210903+057cd650a4ed
angr_phoenix
static inline int realeofmark(const char *eofmark) { return eofmark && eofmark != (char *)1; }
undefined8 realeofmark(long param_1) { undefined8 uVar1; if ((param_1 == 0) || (param_1 == 1)) { uVar1 = 0; } else { uVar1 = 1; } return uVar1; }
dash-0.5.11+git20210903+057cd650a4ed
ghidra
em_next_word(EditLine *el, wint_t c __attribute__((__unused__))) { if (el->el_line.cursor == el->el_line.lastchar) return 6; el->el_line.cursor = c__next_word(el->el_line.cursor, el->el_line.lastchar, el->el_state.argument, ce__isword); if (el->el_map.type == 1) if (el->el_chared.c_vcmd.action != 0x00) { cv_delfini(el); return 4; } return 5; }
long long em_next_word(struct_0 *a0, unsigned long a1) { unsigned int v0; unsigned long long v2; v0 = a1; if (a0->field_58 == a0->field_60) { v2 = 6; return v2; } a0->field_58 = c__next_word(a0->field_58, a0->field_60, a0->field_78, 0x500020); if (a0->field_420 != 1) { v2 = 5; return v2; } else if (!a0->field_3c0) { v2 = 5; return v2; } else { cv_delfini(a0); v2 = 4; return v2; } }
libedit
angr_sailr
static void connect_to_server(char *path, char **args, int *in, int *out) { int c_in, c_out; int inout[2]; if (socketpair(1, SOCK_STREAM, 0, inout) == -1) sshfatal("sftp.c", __func__, 2360, 0, SYSLOG_LEVEL_FATAL, ((void *)0), "socketpair: %s", strerror((*__errno_location()))); *in = *out = inout[0]; c_in = c_out = inout[1]; if ((sshpid = fork()) == -1) sshfatal("sftp.c", __func__, 2366, 0, SYSLOG_LEVEL_FATAL, ((void *)0), "fork: %s", strerror((*__errno_location()))); else if (sshpid == 0) { if ((dup2(c_in, 0) == -1) || (dup2(c_out, 1) == -1)) { fprintf(stderr, "dup2: %s\n", strerror((*__errno_location()))); _exit(1); } close(*in); close(*out); close(c_in); close(c_out); ssh_signal(2, ((__sighandler_t)1)); ssh_signal(15, ((__sighandler_t)0)); execvp(path, args); fprintf(stderr, "exec: %s: %s\n", path, strerror((*__errno_location()))); _exit(1); } ssh_signal(15, killchild); ssh_signal(2, killchild); ssh_signal(1, killchild); ssh_signal(20, suspchild); ssh_signal(21, suspchild); ssh_signal(22, suspchild); ssh_signal(17, sigchld_handler); close(c_in); close(c_out); }
unsigned long connect_to_server(const char *a1, char *const *a2, int *a3, int *a4) { int *v4; char *v5; int *v6; char *v7; int *v8; char *v9; int *v10; char *v11; int v15; int fd; int fds[2]; unsigned long v18; v18 = __readfsqword(0x28u); if (socketpair(1, 1, 0, fds) == -1) { v4 = _errno_location(); v5 = strerror(*v4); sshfatal("sftp.c", "connect_to_server", 2360LL, 0LL, 1LL, 0LL, "socketpair: %s", v5); } *a4 = fds[0]; *a3 = *a4; v15 = fds[1]; fd = fds[1]; sshpid = fork(); if (sshpid == -1) { v6 = _errno_location(); v7 = strerror(*v6); sshfatal("sftp.c", "connect_to_server", 2366LL, 0LL, 1LL, 0LL, "fork: %s", v7); } if (!sshpid) { if (dup2(fd, 0) != -1 && dup2(v15, 1) != -1) { close(*a3); close(*a4); close(fd); close(v15); ssh_signal(2LL, 1LL); ssh_signal(15LL, 0LL); execvp(a1, a2); v10 = _errno_location(); v11 = strerror(*v10); fprintf(stderr, "exec: %s: %s\n", a1, v11); exit(1); } v8 = _errno_location(); v9 = strerror(*v8); fprintf(stderr, "dup2: %s\n", v9); exit(1); } ssh_signal(15LL, killchild); ssh_signal(2LL, killchild); ssh_signal(1LL, killchild); ssh_signal(20LL, suspchild); ssh_signal(21LL, suspchild); ssh_signal(22LL, suspchild); ssh_signal(17LL, sigchld_handler); close(fd); close(v15); return __readfsqword(0x28u) ^ v18; }
openssh-portable
ida
static void mark_ignorable(struct change *script) { while (script) { struct change *next = script->link; lin first0, last0, first1, last1; script->link = ((void *)0); script->ignore = !analyze_hunk(script, &first0, &last0, &first1, &last1); script->link = next; script = next; } }
void mark_ignorable(unsigned long long a0) { struct_0 *v0; char v1; char v2; char v3; char v4; unsigned long long v5; char v6; unsigned long long *v8; unsigned long long v9; for (v0 = a0; v0; v0 = v5) { v5 = v0->field_0; v0->field_0 = 0; v0->field_28 = !analyze_hunk(v0, &v1, &v2, &v3, &v4); v0->field_0 = v5; } v9 = *(&v6) ^ v8[5]; return; }
diffutils
angr_sailr
int forkshell(struct job *jp, union node *n, int mode) { int pid; ; pid = fork(); if (pid == 0) forkchild(jp, n, mode); else forkparent(jp, n, mode, pid); return pid; }
long long forkshell(unsigned int a0, unsigned int a1, unsigned long a2) { unsigned int v0; v0 = fork(); if (v0) forkparent(a0, a1, a2, v0); else forkchild(a0, a1, a2); return v0; }
dash-0.5.11+git20210903+057cd650a4ed
angr_phoenix
static void do_log(LogLevel level, int force, const char *suffix, const char *fmt, va_list args) { char msgbuf[1024]; char fmtbuf[1024]; char *txt = ((void *)0); int pri = 6; int saved_errno = (*__errno_location()); log_handler_fn *tmp_handler; const char *progname = argv0 != ((void *)0) ? argv0 : __progname; if (!force && level > log_level) return; switch (level) { case SYSLOG_LEVEL_FATAL: if (!log_on_stderr) txt = "fatal"; pri = 2; break; case SYSLOG_LEVEL_ERROR: if (!log_on_stderr) txt = "error"; pri = 3; break; case SYSLOG_LEVEL_INFO: pri = 6; break; case SYSLOG_LEVEL_VERBOSE: pri = 6; break; case SYSLOG_LEVEL_DEBUG1: txt = "debug1"; pri = 7; break; case SYSLOG_LEVEL_DEBUG2: txt = "debug2"; pri = 7; break; case SYSLOG_LEVEL_DEBUG3: txt = "debug3"; pri = 7; break; default: txt = "internal error"; pri = 3; break; } if (txt != ((void *)0) && log_handler == ((void *)0)) { snprintf(fmtbuf, sizeof(fmtbuf), "%s: %s", txt, fmt); vsnprintf(msgbuf, sizeof(msgbuf), fmtbuf, args); } else { vsnprintf(msgbuf, sizeof(msgbuf), fmt, args); } if (suffix != ((void *)0)) { snprintf(fmtbuf, sizeof(fmtbuf), "%s: %s", msgbuf, suffix); strlcpy(msgbuf, fmtbuf, sizeof(msgbuf)); } strnvis(fmtbuf, msgbuf, sizeof(fmtbuf), log_on_stderr ? (0x20 | 0x01) : (0x02 | 0x10 | 0x08 | 0x01)); if (log_handler != ((void *)0)) { tmp_handler = log_handler; log_handler = ((void *)0); tmp_handler(level, force, fmtbuf, log_handler_ctx); log_handler = tmp_handler; } else if (log_on_stderr) { snprintf(msgbuf, sizeof msgbuf, "%s%s%.*s\r\n", (log_on_stderr > 1) ? progname : "", (log_on_stderr > 1) ? ": " : "", (int)sizeof msgbuf - 3, fmtbuf); (void)write(log_stderr_fd, msgbuf, strlen(msgbuf)); } else { openlog(progname, 0x01, log_facility); syslog(pri, "%.500s", fmtbuf); closelog(); } (*__errno_location()) = saved_errno; }
unsigned long do_log(unsigned int a1, unsigned int a2, const char *a3, const char *a4, void *a5) { char *v5; unsigned int v6; const char *v7; const char *v8; size_t v9; int pri; _BYTE v15[12]; char *ident; void (*v17)(_QWORD, _QWORD, char *, long); char buf[1024]; char s[1032]; unsigned long v20; v20 = __readfsqword(0x28u); *(_DWORD *)&v15[8] = 0; *(_QWORD *)v15 = (unsigned int)*_errno_location(); if (argv0) v5 = argv0; else v5 = (char *)_progname; ident = v5; if (a2 || (int)a1 <= log_level) { switch (a1) { case 1u: if (!log_on_stderr) *(_QWORD *)&v15[4] = "fatal"; pri = 2; break; case 2u: if (!log_on_stderr) *(_QWORD *)&v15[4] = "error"; pri = 3; break; case 3u: pri = 6; break; case 4u: pri = 6; break; case 5u: *(_QWORD *)&v15[4] = "debug1"; pri = 7; break; case 6u: *(_QWORD *)&v15[4] = "debug2"; pri = 7; break; case 7u: *(_QWORD *)&v15[4] = "debug3"; pri = 7; break; default: *(_QWORD *)&v15[4] = "internal error"; pri = 3; break; } if (!*(_QWORD *)&v15[4] || log_handler) { vsnprintf(buf, 0x400uLL, a4, a5); } else { snprintf(s, 0x400uLL, "%s: %s", *(const char **)&v15[4], a4); vsnprintf(buf, 0x400uLL, s, a5); } if (a3) { snprintf(s, 0x400uLL, "%s: %s", buf, a3); strlcpy(buf, s, 1024LL); } if (log_on_stderr) v6 = 33; else v6 = 27; strnvis(s, buf, 1024LL, v6); if (log_handler) { v17 = (void (*)(_QWORD, _QWORD, char *, long))log_handler; log_handler = 0LL; v17(a1, a2, s, log_handler_ctx); log_handler = (long)v17; } else if (log_on_stderr) { if (log_on_stderr <= 1) v7 = (const char *)&unk_11C0; else v7 = ": "; if (log_on_stderr <= 1) v8 = (const char *)&unk_11C0; else v8 = ident; snprintf(buf, 0x400uLL, "%s%s%.*s\r\n", v8, v7, 1021, s); v9 = strlen(buf); write(log_stderr_fd, buf, v9); } else { openlog(ident, 1, log_facility); syslog(pri, "%.500s", s); closelog(); } *_errno_location() = *(_DWORD *)v15; } return __readfsqword(0x28u) ^ v20; }
openssh-portable
ida
unsigned int get_urandom32() { unsigned int ret; if (getrandom((void *)&ret, sizeof(ret), 0x01) == sizeof(ret)) return (last_rand32 = ret); if (subshell_environment) perturb_rand32(); do ret = brand32(); while (ret == last_rand32); return (last_rand32 = ret); }
long get_urandom32() { unsigned int v1; unsigned long v2; v2 = __readfsqword(0x28u); if (getrandom(&v1, 4LL, 1LL) == 4) { last_rand32 = v1; return v1; } else { if (subshell_environment) perturb_rand32(); do v1 = brand32(); while (v1 == last_rand32); last_rand32 = v1; return v1; } }
bash
ida
void arc4random_addrandom(unsigned char *dat, int datlen) { pthread_mutex_lock(&arc4random_mtx); _rs_stir_if_needed(datlen); _rs_rekey(dat, datlen); pthread_mutex_unlock(&arc4random_mtx); }
int arc4random_addrandom(long a1, int a2) { pthread_mutex_lock(&arc4random_mtx); rs_stir_if_needed(a2); rs_rekey(a1, a2); return pthread_mutex_unlock(&arc4random_mtx); }
libbsd-0.11.7
ida
void bash_history_enable() { remember_on_history = enable_history_list = 1; history_expansion_inhibited = 0; history_inhibit_expansion_function = bash_history_inhibit_expansion; sv_history_control("HISTCONTROL"); sv_histignore("HISTIGNORE"); }
long long bash_history_enable() { enable_history_list = 1; remember_on_history = enable_history_list; dont_save_function_defs = 0; history_inhibit_expansion_function = bash_history_inhibit_expansion; sv_history_control("HISTCONTROL"); return sv_histignore("HISTIGNORE"); }
bash
angr_phoenix
static const char *BAGTYPE(gnutls_pkcs12_bag_type_t x) { switch (x) { case GNUTLS_BAG_PKCS8_ENCRYPTED_KEY: return "PKCS #8 Encrypted key"; case GNUTLS_BAG_EMPTY: return "Empty"; case GNUTLS_BAG_PKCS8_KEY: return "PKCS #8 Key"; case GNUTLS_BAG_CERTIFICATE: return "Certificate"; case GNUTLS_BAG_ENCRYPTED: return "Encrypted"; case GNUTLS_BAG_CRL: return "CRL"; case GNUTLS_BAG_SECRET: return "Secret"; default: return "Unknown"; } }
int BAGTYPE(unsigned long a0) { unsigned int v1; switch (a0) { case 0: v1 = &g_40be49; break; case 1: v1 = &g_40be33; break; case 2: v1 = &g_40be4f; break; case 3: v1 = &g_40be5b; break; case 4: v1 = &g_40be71; break; case 5: v1 = &g_40be75; break; case 10: v1 = &g_40be67; break; default: v1 = &g_40be7c; break; } return v1; }
gnutls
angr_phoenix
int el_wreplacestr(EditLine *el, const wchar_t *s) { size_t len; wchar_t *p; if (s == ((void *)0) || (len = wcslen(s)) == 0) return -1; if (el->el_line.buffer + len >= el->el_line.limit) { if (!ch_enlargebufs(el, len)) return -1; } p = el->el_line.buffer; for (size_t i = 0; i < len; i++) *p++ = *s++; el->el_line.buffer[len] = '\0'; el->el_line.lastchar = el->el_line.buffer + len; if (el->el_line.cursor > el->el_line.lastchar) el->el_line.cursor = el->el_line.lastchar; return 0; }
long long el_wreplacestr(unsigned long long a0[14], unsigned short *a1) { unsigned int *v0; int tmp_14; unsigned long long v1; void *v2; unsigned int *v3; unsigned long long v5; unsigned long long v6; unsigned int *v7; v0 = &a1; if (v0) { v3 = wcslen(v0); if (v3) { if ((v3 << 2) + a0[10] >= a0[13]) { v6 = ch_enlargebufs(a0, v3); if (!v6) v5 = 4294967295; } if ((v3 << 2) + a0[10] < a0[13] || v6) { v1 = a0[10]; for (v2 = 0; v2 < v3; v2 += 1) { tmp_14 = v0; v0 += 1; v7 = v1; v1 += 4; *(v7) = *(tmp_14); } *((a0[10] + v3 * 4)) = 0; a0[12] = v3 * 4 + a0[10]; if (a0[11] > a0[12]) a0[11] = a0[12]; v5 = 0; } } } if (!v0 || !v3) v5 = 4294967295; return v5; }
libedit
angr_dream
!matches(*argv, "hoplimit") || !matches(*argv, "hlim")) { do { argv++; if (--argc <= 0) incomplete_command(); } while (0); if (strcmp(*argv, "inherit") != 0) { if (get_u8(&hop_limit, *argv, 0)) invarg("invalid HLIM\n", *argv); } else hop_limit = 0; } else if (!matches(*argv, "tos") ||
(cVar1 = matches(*local_5b0,"hoplimit"), cVar1 == '\x01')) && (cVar1 = matches(*local_5b0,&DAT_001028ff), cVar1 == '\x01')) { cVar1 = matches( *local_5b0, &DAT_0010291a); if (((cVar1 == '\x01') && (cVar1 = matches( *local_5b0, "tclass"), cVar1 == '\x01')) && (cVar1 = matches( *local_5b0, "dsfield"), cVar1 == '\x01')) { iVar3 = strcmp(*local_5b0, "flowlabel"); if ((iVar3 == 0) || (iVar3 = strcmp( *local_5b0, "fl"), iVar3 == 0)) { local_5b0 = local_5b0 + 1; local_5a4 = local_5a4 + -1; if (local_5a4 < 1) { incomplete_command(); } uVar4 = htonl(0xfffff); local_584 = local_584 & ~uVar4; iVar3 = strcmp(*local_5b0, "inherit"); if (iVar3 == 0) { local_56c = local_56c | 4; } else { iVar3 = get_u32( &local_578, *local_5b0, 0x10); if (iVar3 != 0) { invarg( "invalid " "Flowlabel", *local_5b0); } if (0xfffff < local_578) { invarg( "invalid " "Flowlabel", *local_5b0); } uVar4 = htonl( local_578); uVar5 = htonl(0xfffff); local_584 = local_584 | uVar4 & uVar5; local_56c = local_56c & 0xfffffffb; } } else { iVar3 = strcmp(*local_5b0, "dscp"); if (iVar3 == 0) { local_5b0 = local_5b0 + 1; local_5a4 = local_5a4 + -1; if (local_5a4 < 1) { incomplete_command(); } iVar3 = strcmp( *local_5b0, "inherit"); if (iVar3 != 0) { invarg( "not inherit", *local_5b0); } local_56c = local_56c | 0x10; } else { iVar3 = strcmp( *local_5b0, "noencap"); if (iVar3 == 0) { local_588 = 0; } else { iVar3 = strcmp( *local_5b0, "encap"); if (iVar3 == 0) { local_5b0 = local_5b0 + 1; local_5a4 = local_5a4 + -1; if (local_5a4 < 1) { incomplete_command(); } iVar3 = strcmp( *local_5b0, "fou"); if (iVar3 == 0) { local_588 = 1; } else { iVar3 = strcmp( *local_5b0, "gue"); if (iVar3 == 0) { local_588 = 2; } else { iVar3 = strcmp( *local_5b0, "none"); if (iVar3 != 0) { invarg( "Inva" "lid " "enca" "p " "type" ".", *local_5b0); goto LAB_00101289; } local_588 = 0; } } } else { LAB_00101289: iVar3 = strcmp( *local_5b0, "encap-" "sport"); if (iVar3 == 0) { local_5b0 = local_5b0 + 1; local_5a4 = local_5a4 + -1; if (local_5a4 < 1) { incomplete_command(); } iVar3 = strcmp( *local_5b0, "auto"); if (iVar3 == 0) { local_58e = 0; } else { iVar3 = get_u16( &local_58e, *local_5b0, 0); if (iVar3 != 0) { invarg( "Inva" "lid " "sour" "ce " "port" ".", *local_5b0); goto LAB_00101334; } } } else { LAB_00101334: iVar3 = strcmp( *local_5b0, "encap-" "dport"); if (iVar3 == 0) { local_5b0 = local_5b0 + 1; local_5a4 = local_5a4 + -1; if (local_5a4 < 1) { incomplete_command(); } iVar3 = get_u16( &local_58c, *local_5b0, 0); if (iVar3 == 0) goto LAB_0010194b; invarg( "Invali" "d " "destin" "ation " "port.", *local_5b0); } iVar3 = strcmp( *local_5b0, "encap-" "csum"); if (iVar3 == 0) { local_586 = local_586 | 1; } else { iVar3 = strcmp( *local_5b0, "noenca" "p-" "csum"); if (iVar3 == 0) { local_586 = local_586 & 0xfffe; } else { iVar3 = strcmp( *local_5b0, "enca" "p-" "udp6" "-csu" "m"); if (iVar3 == 0) { local_586 = local_586 | 2; } else { iVar3 = strcmp( *local_5b0, "no" "en" "ca" "p-" "ud" "p6" "-c" "su" "m"); if (iVar3 == 0) { local_586 = local_586 & 0xfffd; } else { iVar3 = strcmp( *local_5b0, "encap-remcsum"); if (iVar3 == 0) { local_586 = local_586 | 4; } else { iVar3 = strcmp( *local_5b0, "noencap-remcsum"); if (iVar3 == 0) { local_586 = local_586 & 0xfffb; } else { iVar3 = strcmp( *local_5b0, "external"); if (iVar3 == 0) { local_594 = '\x01'; } else { iVar3 = strcmp( *local_5b0, "fwmark"); if (iVar3 == 0) { local_5b0 = local_5b0 + 1; local_5a4 = local_5a4 + -1; if (local_5a4 < 1) { incomplete_command(); } iVar3 = strcmp( *local_5b0, "inherit"); if (iVar3 == 0) { local_56c = local_56c | 0x20; local_580 = 0; } else { iVar3 = get_u32( &local_580, *local_5b0, 0); if (iVar3 != 0) { invarg( "invalid fwmark\n", *local_5b0); } local_56c = local_56c & 0xffffffdf; } } else { iVar3 = strcmp( *local_5b0, "allow-localremote"); if (iVar3 == 0) { local_56c = local_56c | 0x40; } else { iVar3 = strcmp( *local_5b0, "noallow-localremote"); if (iVar3 == 0) { local_56c = local_56c & 0xffffffbf; } else { iVar3 = strcmp( *local_5b0, "encaplimit"); if (iVar3 == 0) { local_5b0 = local_5b0 + 1; local_5a4 = local_5a4 + -1; if (local_5a4 < 1) { incomplete_command(); } iVar3 = strcmp( *local_5b0, "none"); if (iVar3 == 0) { local_56c = local_56c | 1; } else { iVar3 = get_u8( &local_578, *local_5b0, 0); if (iVar3 != 0) { invarg( "invalid ELIM", *local_5b0); } local_596 = (undefined) local_578; local_56c = local_56c & 0xfffffffe; } } else { iVar3 = strcmp( *local_5b0, "erspan"); if (iVar3 == 0) { local_5b0 = local_5b0 + 1; local_5a4 = local_5a4 + -1; if (local_5a4 < 1) { incomplete_command(); } iVar3 = get_u32( &local_57c, *local_5b0, 0); if (iVar3 != 0) { invarg( "invalid erspan index\n", *local_5b0); } if (((local_57c & 0xfff00000) == 0) && (local_57c != 0)) goto LAB_0010194b; invarg( "erspan index must be > 0 and <= 20-bit\n", *local_5b0); } iVar3 = strcmp( *local_5b0, "erspan_ver"); if (iVar3 == 0) { local_5b0 = local_5b0 + 1; local_5a4 = local_5a4 + -1; if (local_5a4 < 1) { incomplete_command(); } iVar3 = get_u8( &local_595, *local_5b0, 0); if (iVar3 != 0) { invarg( "invalid erspan version\n", *local_5b0); } if (local_595 < 3) goto LAB_0010194b; invarg( "erspan version must be 0/1/2\n", *local_5b0); } iVar3 = strcmp( *local_5b0, "erspan_dir"); if (iVar3 != 0) { LAB_001018a5: iVar3 = strcmp( *local_5b0, "erspan_hwid"); if (iVar3 == 0) { local_5b0 = local_5b0 + 1; local_5a4 = local_5a4 + -1; if (local_5a4 < 1) { incomplete_command(); } iVar3 = get_u16( &local_58a, *local_5b0, 0); if (iVar3 == 0) goto LAB_0010194b; invarg( "invalid erspan hwid\n", *local_5b0); } gre_print_help( param_1, local_5a4, local_5b0, stderr); uVar6 = 0xffffffff; goto LAB_00101d0c; } local_5b0 = local_5b0 + 1; local_5a4 = local_5a4 + -1; if (local_5a4 < 1) { incomplete_command(); } cVar1 = matches( *local_5b0, "ingress"); if (cVar1 == '\x01') { cVar1 = matches( *local_5b0, "egress"); if (cVar1 == '\x01') { invarg( "Invalid erspan direction.", *local_5b0); goto LAB_001018a5; } local_593 = 1; } else { local_593 = 0; } } } } } } } } } } } } } } } } } } else { local_5b0 = local_5b0 + 1; local_5a4 = local_5a4 + -1; if (local_5a4 < 1) { incomplete_command(); } uVar4 = htonl(0xff00000); local_584 = local_584 & ~uVar4; iVar3 = strcmp(*local_5b0, "inherit"); if (iVar3 == 0) { local_56c = local_56c | 2; } else { iVar3 = get_u8( &local_578, *local_5b0, 0x10); if (iVar3 != 0) { invarg("invalid " "TClass", *local_5b0); } uVar4 = htonl( (local_578 & 0xff) << 0x14); uVar5 = htonl(0xff00000); local_584 = local_584 | uVar4 & uVar5; local_56c = local_56c & 0xfffffffd; } } }
iproute2-6.0.0
ghidra
static void build_history_completion_array() { register int i, j; HIST_ENTRY **hlist; char **tokens; if (harry_size) { strvec_dispose(history_completion_array); history_completion_array = (char **)((void *)0); harry_size = 0; harry_len = 0; } hlist = history_list(); if (hlist) { for (i = 0; hlist[i]; i++) ; for (--i; i >= 0; i--) { tokens = history_tokenize(hlist[i]->line); for (j = 0; tokens && tokens[j]; j++) { if (harry_len + 2 > harry_size) history_completion_array = strvec_resize(history_completion_array, harry_size += 10); history_completion_array[harry_len++] = tokens[j]; history_completion_array[harry_len] = (char *)((void *)0); } sh_xfree((tokens), "bashline.c", 3633); } if (dabbrev_expand_active == 0) qsort(history_completion_array, harry_len, sizeof(char *), (QSFUNC *)strvec_strcmp); } }
void build_history_completion_array(unsigned long a0, unsigned long a1, unsigned long a2, unsigned long a3) { unsigned long long **v0; int tmp_47; void *v1; void *v4; void *v5; unsigned long long **v6; unsigned long long v7; unsigned long long v8; if (harry_size) { strvec_dispose(history_completion_array); history_completion_array = 0; harry_size = 0; harry_len = 0; } *(&v0) = history_list(); if (v0) { for (v4 = 0; *((v0 + 0x8 * v4)); v4 = v4 + 1) ; for (v6 = v4 - 1; v6 >= 0; v6 = v6 - 1) { v1 = history_tokenize(*(*((v0 + 0x8 * v6)))); v5 = 0; while (true) { if (!v1) break; if (!*((v1 + 0x8 * v5))) break; if (harry_len + 1 >= harry_size) { harry_size = harry_size + 10; history_completion_array = strvec_resize( history_completion_array, harry_size, harry_size, 0 + v1); } tmp_47 = harry_len; harry_len = harry_len + 1; *((history_completion_array + 8 * tmp_47)) = *((0x8 * v5 + v1)); *((history_completion_array + 8 * harry_len)) = 0; v5 = v5 + 1; } sh_xfree(v1, "bashline.c", 0xe31); } v7 = dabbrev_expand_active; if (!dabbrev_expand_active) v8 = qsort(history_completion_array, harry_len, 0x8, got.strvec_strcmp); } return; }
bash
angr_phoenix
int sshsig_check_allowed_keys(const char *path, const struct sshkey *sign_key, const char *principal, const char *sig_namespace, uint64_t verify_time) { FILE *f = ((void *)0); char *line = ((void *)0); size_t linesize = 0; u_long linenum = 0; int r = -1, oerrno; if ((f = fopen(path, "r")) == ((void *)0)) { oerrno = (*__errno_location()); sshlog("sshsig.c", __func__, 985, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "Unable to open allowed keys file \"%s\": %s", path, strerror((*__errno_location()))); (*__errno_location()) = oerrno; return -24; } while (getline(&line, &linesize, f) != -1) { linenum++; r = check_allowed_keys_line(path, linenum, line, sign_key, principal, sig_namespace, verify_time, ((void *)0)); free(line); line = ((void *)0); linesize = 0; if (r == -46) continue; else if (r == 0) { fclose(f); return 0; } else break; } fclose(f); free(line); return r == 0 ? -46 : r; }
long long sshsig_check_allowed_keys(char *a0, void *a1, unsigned long long a2, unsigned long long a3, unsigned long long a4) { unsigned long long v0; unsigned long v1; unsigned int v2; unsigned int v3; void *v4; void *v5; void *v6; void *v7; unsigned long long v9; v7 = 0; v4 = 0; v5 = 0; v6 = 0; v2 = -1; v7 = fopen(a0, "r"); if (!v7) { v3 = *(__errno_location()); strerror(*(__errno_location())); v1 = a0; v0 = "Unable to open allowed keys file \"%s\": %s"; sshlog("sshsig.c", "sshsig_check_allowed_keys", 0x3d9, 0x0, 0x2, 0x0); *(__errno_location()) = v3; v9 = 4294967272; } else { do { if (getline(&v4, &v5, v7) == -1) { fclose(v7); free(v4); if (v2) { v9 = v2; goto LABEL_403725; } else { v9 = 4294967250; goto LABEL_403725; } } v6 += 1; v2 = check_allowed_keys_line(a0, v6, v4, a1, a2, a3, a4, 0x0); free(v4); v4 = 0; v5 = 0; } while (v2 == -46); if (!v2) { fclose(v7); v9 = 0; } } LABEL_403725: return v9; }
openssh-portable
angr_phoenix
int rl_vi_goto_mark(int count, int key) { if ((rl_readline_state & (0x0080000))) { _rl_callback_data = 0; _rl_callback_func = _rl_vi_callback_goto_mark; return (0); } return (_rl_vi_goto_mark()); }
undefined8 rl_vi_goto_mark(void) { undefined8 uVar1; if ((rl_readline_state & 0x80000) == 0) { uVar1 = _rl_vi_goto_mark(); } else { _rl_callback_data = 0; _rl_callback_func = _rl_vi_callback_goto_mark; uVar1 = 0; } return uVar1; }
bash
ghidra
static struct sshbuf *process_enroll(struct sshbuf *req) { int r; u_int type; char *provider, *application, *pin, *device, *userid; uint8_t flags; struct sshbuf *challenge, *attest, *kbuf, *resp; struct sshkey *key; if ((attest = sshbuf_new()) == ((void *)0) || (kbuf = sshbuf_new()) == ((void *)0)) sshfatal("ssh-sk-helper.c", __func__, 161, 0, SYSLOG_LEVEL_FATAL, ((void *)0), "%s: sshbuf_new failed", __progname); if ((r = sshbuf_get_u32(req, &type)) != 0 || (r = sshbuf_get_cstring(req, &provider, ((void *)0))) != 0 || (r = sshbuf_get_cstring(req, &device, ((void *)0))) != 0 || (r = sshbuf_get_cstring(req, &application, ((void *)0))) != 0 || (r = sshbuf_get_cstring(req, &userid, ((void *)0))) != 0 || (r = sshbuf_get_u8(req, &flags)) != 0 || (r = sshbuf_get_cstring(req, &pin, ((void *)0))) != 0 || (r = sshbuf_froms(req, &challenge)) != 0) sshfatal("ssh-sk-helper.c", __func__, 171, 0, SYSLOG_LEVEL_FATAL, ssh_err(r), "%s: parse", __progname); if (sshbuf_len(req) != 0) sshfatal("ssh-sk-helper.c", __func__, 173, 0, SYSLOG_LEVEL_FATAL, ((void *)0), "%s: trailing data in request", __progname); if (type > 0x7fffffff) sshfatal("ssh-sk-helper.c", __func__, 176, 0, SYSLOG_LEVEL_FATAL, ((void *)0), "%s: bad type %u", __progname, type); if (sshbuf_len(challenge) == 0) { sshbuf_free(challenge); challenge = ((void *)0); } null_empty(&device); null_empty(&userid); null_empty(&pin); if ((r = sshsk_enroll((int)type, provider, device, application, userid, flags, pin, challenge, &key, attest)) != 0) { resp = reply_error(r, "Enrollment failed: %s", ssh_err(r)); goto out; } if ((resp = sshbuf_new()) == ((void *)0)) sshfatal("ssh-sk-helper.c", __func__, 192, 0, SYSLOG_LEVEL_FATAL, ((void *)0), "%s: sshbuf_new failed", __progname); if ((r = sshkey_private_serialize(key, kbuf)) != 0) sshfatal("ssh-sk-helper.c", __func__, 194, 0, SYSLOG_LEVEL_FATAL, ssh_err(r), "%s: encode key", __progname); if ((r = sshbuf_put_u32(resp, 2)) != 0 || (r = sshbuf_put_stringb(resp, kbuf)) != 0 || (r = sshbuf_put_stringb(resp, attest)) != 0) sshfatal("ssh-sk-helper.c", __func__, 198, 0, SYSLOG_LEVEL_FATAL, ssh_err(r), "%s: compose", __progname); out: sshkey_free(key); sshbuf_free(kbuf); sshbuf_free(attest); sshbuf_free(challenge); free(provider); free(application); if (pin != ((void *)0)) freezero(pin, strlen(pin)); return resp; }
int process_enroll(unsigned long long a0) { unsigned long v0; char v1; char v2; unsigned int v3; char v4; char v5; char v6; char v7; char v8; void *v9; char v10; unsigned long long v11; unsigned long long v12; unsigned long long v13; unsigned long long v14; void *v15; unsigned long long v16; unsigned long v17; char v18; unsigned long long v19; char v20; unsigned int v21; unsigned int v22; unsigned int v23; unsigned long long v24; v12 = sshbuf_new(); if (v12) { v13 = sshbuf_new(); if (!(!v13)) goto LABEL_4007c6; } v0 = __progname; sshfatal("ssh-sk-helper.c", "process_enroll", 0xa1, 0x0, 0x1, 0x0, "%s: sshbuf_new failed"); LABEL_4007c6: v3 = sshbuf_get_u32(a0, &v2, &v2); if (!v3) { v3 = sshbuf_get_cstring(a0, &v4, 0x0, &v4); if (!v3) { v3 = sshbuf_get_cstring(a0, &v7, 0x0, &v7); if (!v3) { v3 = sshbuf_get_cstring(a0, &v5, 0x0, &v5); if (!v3) { v3 = sshbuf_get_cstring(a0, &v8, 0x0, &v8); if (!v3) { v3 = sshbuf_get_u8(a0, &v1, &v1); if (!v3) { v3 = sshbuf_get_cstring(a0, &v6, 0x0, &v6); if (!v3) { v3 = sshbuf_froms(a0, &v9, &v9); if (!v3) goto LABEL_40092c; } } } } } } } v17 = __progname; v16 = "%s: parse"; sshfatal("ssh-sk-helper.c", "process_enroll", 0xab, 0x0, 0x1, ssh_err(v3), *(&v18)); LABEL_40092c: if (sshbuf_len(a0)) { v17 = __progname; v16 = "%s: trailing data in request"; sshfatal("ssh-sk-helper.c", "process_enroll", 0xad, 0x0, 0x1, 0x0, *(&v18)); } if (*(&v2) < 0) { v16 = *(&v2); v15 = __progname; v14 = "%s: bad type %u"; sshfatal("ssh-sk-helper.c", "process_enroll", 0xb0, 0x0, 0x1, 0x0, *(&v18)); } if (!sshbuf_len(v9)) { sshbuf_free(v9); v9 = 0; } null_empty(&v7); null_empty(&v8); null_empty(&v6); v17 = v12; v16 = &v10; v15 = v9; v14 = *(&v6); v3 = sshsk_enroll(*(&v2), *(&v4), *(&v7), *(&v5), *(&v8), v1, *(&v18), v19, *(&v20)); if (v3) { v11 = reply_error(v3, "Enrollment failed: %s", ssh_err(v3), v21, v22, v23); } else { v11 = sshbuf_new(); if (!v11) { v17 = __progname; v16 = "%s: sshbuf_new failed"; sshfatal("ssh-sk-helper.c", "process_enroll", 0xc0, 0x0, 0x1, 0x0, *(&v18)); } v3 = sshkey_private_serialize(*(&v10), v13, v13); if (v3) { v17 = __progname; v16 = "%s: encode key"; sshfatal("ssh-sk-helper.c", "process_enroll", 0xc2, 0x0, 0x1, ssh_err(v3), *(&v18)); } v3 = sshbuf_put_u32(v11, 0x2); if (!v3) { v3 = sshbuf_put_stringb(v11, v13, v13); if (!v3) { v3 = sshbuf_put_stringb(v11, v12, v12); if (!v3) goto LABEL_400bd3; } } v17 = __progname; v16 = "%s: compose"; sshfatal("ssh-sk-helper.c", "process_enroll", 0xc6, 0x0, 0x1, ssh_err(v3), *(&v18)); LABEL_400bd3: } sshkey_free(*(&v10)); sshbuf_free(v13); sshbuf_free(v12); sshbuf_free(v9); free(*(&v4)); free(*(&v5)); if (*(&v6)) { v24 = strlen(*(&v6)); freezero(*(&v6), v24, v24); } return v11; }
openssh-portable
angr_phoenix
void usage(int status) { if (status != 0) do { fprintf(stderr, gettext("Try '%s --help' for more information.\n"), program_name); } while (0); else { fputs_unlocked(gettext("Usage: test EXPRESSION\n or: test\n or: [ " "EXPRESSION ]\n or: [ ]\n or: [ OPTION\n"), stdout) ; fputs_unlocked( gettext("Exit with the status determined by EXPRESSION.\n\n"), stdout) ; fputs_unlocked(gettext(" --help display this help and exit\n"), stdout); fputs_unlocked( gettext(" --version output version information and exit\n"), stdout); fputs_unlocked(gettext("\nAn omitted EXPRESSION defaults to false. " "Otherwise,\nEXPRESSION is true or false and sets " "exit status. It is one of:\n"), stdout) ; fputs_unlocked( gettext("\n ( EXPRESSION ) EXPRESSION is true\n ! " "EXPRESSION EXPRESSION is false\n EXPRESSION1 " "-a EXPRESSION2 both EXPRESSION1 and EXPRESSION2 are true\n " "EXPRESSION1 -o EXPRESSION2 either EXPRESSION1 or " "EXPRESSION2 is true\n"), stdout) ; fputs_unlocked( gettext("\n -n STRING the length of STRING is nonzero\n " "STRING equivalent to -n STRING\n -z STRING " " the length of STRING is zero\n STRING1 = STRING2 " "the strings are equal\n STRING1 != STRING2 the strings are " "not equal\n"), stdout) ; fputs_unlocked( gettext("\n INTEGER1 -eq INTEGER2 INTEGER1 is equal to INTEGER2\n " "INTEGER1 -ge INTEGER2 INTEGER1 is greater than or equal to " "INTEGER2\n INTEGER1 -gt INTEGER2 INTEGER1 is greater than " "INTEGER2\n INTEGER1 -le INTEGER2 INTEGER1 is less than or " "equal to INTEGER2\n INTEGER1 -lt INTEGER2 INTEGER1 is less " "than INTEGER2\n INTEGER1 -ne INTEGER2 INTEGER1 is not " "equal to INTEGER2\n"), stdout) ; fputs_unlocked(gettext("\n FILE1 -ef FILE2 FILE1 and FILE2 have the " "same device and inode numbers\n FILE1 -nt FILE2 " "FILE1 is newer (modification date) than FILE2\n " "FILE1 -ot FILE2 FILE1 is older than FILE2\n"), stdout) ; fputs_unlocked( gettext("\n -b FILE FILE exists and is block special\n -c FILE " " FILE exists and is character special\n -d FILE FILE " "exists and is a directory\n -e FILE FILE exists\n"), stdout) ; fputs_unlocked( gettext(" -f FILE FILE exists and is a regular file\n -g FILE " " FILE exists and is set-group-ID\n -G FILE FILE exists " "and is owned by the effective group ID\n -h FILE FILE " "exists and is a symbolic link (same as -L)\n -k FILE " "FILE exists and has its sticky bit set\n"), stdout) ; fputs_unlocked( gettext( " -L FILE FILE exists and is a symbolic link (same as -h)\n " "-N FILE FILE exists and has been modified since it was last " "read\n -O FILE FILE exists and is owned by the effective " "user ID\n -p FILE FILE exists and is a named pipe\n -r FILE " " FILE exists and the user has read access\n -s FILE FILE " "exists and has a size greater than zero\n"), stdout) ; fputs_unlocked( gettext(" -S FILE FILE exists and is a socket\n -t FD file " "descriptor FD is opened on a terminal\n -u FILE FILE " "exists and its set-user-ID bit is set\n -w FILE FILE " "exists and the user has write access\n -x FILE FILE " "exists and the user has execute (or search) access\n"), stdout) ; fputs_unlocked( gettext("\nExcept for -h and -L, all FILE-related tests dereference " "symbolic links.\nBeware that parentheses need to be escaped " "(e.g., by backslashes) for shells.\nINTEGER may also be -l " "STRING, which evaluates to the length of STRING.\n"), stdout) ; fputs_unlocked( gettext( "\nNOTE: Binary -a and -o are inherently ambiguous. Use 'test " "EXPR1 && test\nEXPR2' or 'test EXPR1 || test EXPR2' instead.\n"), stdout) ; fputs_unlocked(gettext("\nNOTE: [ honors the --help and --version options, " "but test does not.\ntest treats each of those as " "it treats any other nonempty STRING.\n"), stdout) ; printf(gettext("\n" "NOTE: your shell may have its own version of %s, which " "usually supersedes\n" "the version described here. Please refer to your shell's " "documentation\n" "for details about the options it supports.\n"), gettext("test and/or [")); emit_ancillary_info("test"); } exit(status); }
long long usage(unsigned long a0) { unsigned long v0; unsigned long v2; unsigned long long v3; v0 = v2; if (a0) { fprintf(stderr, gettext("Try '%s --help' for more information.\n")); } else { fputs_unlocked(gettext("Usage: test EXPRESSION\n or: test\n or: [ " "EXPRESSION ]\n or: [ ]\n or: [ OPTION\n"), stdout); fputs_unlocked( gettext("Exit with the status determined by EXPRESSION.\n\n"), stdout); fputs_unlocked(gettext(" --help display this help and exit\n"), stdout); fputs_unlocked( gettext(" --version output version information and exit\n"), stdout); fputs_unlocked(gettext("\nAn omitted EXPRESSION defaults to false. " "Otherwise,\nEXPRESSION is true or false and sets " "exit status. It is one of:\n"), stdout); fputs_unlocked( gettext("\n ( EXPRESSION ) EXPRESSION is true\n ! " "EXPRESSION EXPRESSION is false\n EXPRESSION1 " "-a EXPRESSION2 both EXPRESSION1 and EXPRESSION2 are true\n " "EXPRESSION1 -o EXPRESSION2 either EXPRESSION1 or " "EXPRESSION2 is true\n"), stdout); fputs_unlocked( gettext("\n -n STRING the length of STRING is nonzero\n " "STRING equivalent to -n STRING\n -z STRING " " the length of STRING is zero\n STRING1 = STRING2 " "the strings are equal\n STRING1 != STRING2 the strings are " "not equal\n"), stdout); fputs_unlocked( gettext("\n INTEGER1 -eq INTEGER2 INTEGER1 is equal to INTEGER2\n " "INTEGER1 -ge INTEGER2 INTEGER1 is greater than or equal to " "INTEGER2\n INTEGER1 -gt INTEGER2 INTEGER1 is greater than " "INTEGER2\n INTEGER1 -le INTEGER2 INTEGER1 is less than or " "equal to INTEGER2\n INTEGER1 -lt INTEGER2 INTEGER1 is less " "than INTEGER2\n INTEGER1 -ne INTEGER2 INTEGER1 is not " "equal to INTEGER2\n"), stdout); fputs_unlocked(gettext("\n FILE1 -ef FILE2 FILE1 and FILE2 have the " "same device and inode numbers\n FILE1 -nt FILE2 " "FILE1 is newer (modification date) than FILE2\n " "FILE1 -ot FILE2 FILE1 is older than FILE2\n"), stdout); fputs_unlocked( gettext("\n -b FILE FILE exists and is block special\n -c FILE " " FILE exists and is character special\n -d FILE FILE " "exists and is a directory\n -e FILE FILE exists\n"), stdout); fputs_unlocked( gettext(" -f FILE FILE exists and is a regular file\n -g FILE " " FILE exists and is set-group-ID\n -G FILE FILE exists " "and is owned by the effective group ID\n -h FILE FILE " "exists and is a symbolic link (same as -L)\n -k FILE " "FILE exists and has its sticky bit set\n"), stdout); fputs_unlocked( gettext( " -L FILE FILE exists and is a symbolic link (same as -h)\n " "-N FILE FILE exists and has been modified since it was last " "read\n -O FILE FILE exists and is owned by the effective " "user ID\n -p FILE FILE exists and is a named pipe\n -r FILE " " FILE exists and the user has read access\n -s FILE FILE " "exists and has a size greater than zero\n"), stdout); fputs_unlocked( gettext(" -S FILE FILE exists and is a socket\n -t FD file " "descriptor FD is opened on a terminal\n -u FILE FILE " "exists and its set-user-ID bit is set\n -w FILE FILE " "exists and the user has write access\n -x FILE FILE " "exists and the user has execute (or search) access\n"), stdout); fputs_unlocked( gettext("\nExcept for -h and -L, all FILE-related tests dereference " "symbolic links.\nBeware that parentheses need to be escaped " "(e.g., by backslashes) for shells.\nINTEGER may also be -l " "STRING, which evaluates to the length of STRING.\n"), stdout); fputs_unlocked( gettext( "\nNOTE: Binary -a and -o are inherently ambiguous. Use 'test " "EXPR1 && test\nEXPR2' or 'test EXPR1 || test EXPR2' instead.\n"), stdout); fputs_unlocked(gettext("\nNOTE: [ honors the --help and --version options, " "but test does not.\ntest treats each of those as " "it treats any other nonempty STRING.\n"), stdout); v3 = gettext("test and/or ["); printf(gettext( "\nNOTE: your shell may have its own version of %s, which usually " "supersedes\nthe version described here. Please refer to your shell's " "documentation\nfor details about the options it supports.\n")); emit_ancillary_info("test"); } exit(a0); }
coreutils
angr_dream
static void ipvlan_print_help(struct link_util *lu, int argc, char **argv, FILE *f) { print_explain(lu, f); }
int ipvlan_print_help(long a1, long a2, long a3, FILE *a4) { return print_explain(a1, a4); }
iproute2-6.0.0
ida
static int ipstats_enable_check(struct ipstats_sel *sel, struct ipstats_stat_enabled *enabled) { int err; int i; err = ipstats_enable(sel, enabled); if (err == -2) { fprintf(stderr, "The request for"); for (i = 0; i < IPSTATS_LEVELS_COUNT; i++) if (sel->sel[i] != ((void *)0)) fprintf(stderr, " %s %s", ipstats_levels[i], sel->sel[i]); else break; fprintf(stderr, " did not match any known stats.\n"); } return err; }
int ipstats_enable_check(unsigned long long *a0, void *a1) { unsigned int v0; unsigned int v1; v1 = ipstats_enable(a0, a1); if (v1 == -2) { fprintf(stderr, "The request for"); v0 = 0; while (true) { if (v0 > 2) break; if (!a0[v0]) break; fprintf(stderr, " %s %s", (&ipstats_levels)[v0], a0[v0]); v0 += 1; } fprintf(stderr, " did not match any known stats.\n"); } return v1; }
iproute2-6.0.0
angr_phoenix