input
stringlengths
26
172k
output
stringlengths
18
318k
repo_name
stringclasses
23 values
decompiler
stringclasses
5 values
cv__isword(wint_t p) { if (iswalnum(p) || p == L'_') return 1; if (iswgraph(p)) return 2; return 0; }
long long cv__isword(unsigned long a0) { char v0; unsigned long long v2; if (iswalnum(a0)) { LABEL_400565: v2 = 1; } else { if (*(&v0) == 95) goto LABEL_400565; if (iswgraph(*(&v0))) v2 = 2; else v2 = 0; } return v2; }
libedit
angr_phoenix
static void R3_mult(small *h, const small *f, const small *g) { small fg[761 + 761 - 1]; small result; int i, j; for (i = 0; i < 761; ++i) { result = 0; for (j = 0; j <= i; ++j) result = F3_freeze(result + f[j] * g[i - j]); fg[i] = result; } for (i = 761; i < 761 + 761 - 1; ++i) { result = 0; for (j = i - 761 + 1; j < 761; ++j) result = F3_freeze(result + f[j] * g[i - j]); fg[i] = result; } for (i = 761 + 761 - 2; i >= 761; --i) { fg[i - 761] = F3_freeze(fg[i - 761] + fg[i]); fg[i - 761 + 1] = F3_freeze(fg[i - 761 + 1] + fg[i]); } for (i = 0; i < 761; ++i) h[i] = fg[i]; }
void R3_mult(char *a0, char *a1, char *a2) { char v0; unsigned int v1; unsigned int v2; char v3; char v4; unsigned short v6; unsigned long long v7; unsigned short v10; unsigned long long v11; unsigned long v14; char *v15; unsigned long long v16; unsigned long v18; char *v19; unsigned long long v20; unsigned long long *v21; unsigned long long v22; for (v1 = 0; v1 <= 760; v1 = __addvsi3(v1, 0x1, v0)) { v0 = 0; for (v2 = 0; v2 <= v1; v2 = __addvsi3(v2, 0x1, a2)) { v6 = v0; v7 = a2[__subvsi3(v1, v2, v2)]; v0 = F3_freeze(__mulvsi3(a1[v2], v7, v7) + reg_40, a1, a2); } (&v3)[v1] = v0; } for (v1 = 761; v1 <= 1520; v1 = __addvsi3(v1, 0x1, v0)) { v0 = 0; for (v2 = __addvsi3(v1, 0xfffffd08, a2); v2 <= 760; v2 = __addvsi3(v2, 0x1, a2)) { v10 = v0; v11 = a2[__subvsi3(v1, v2, v2)]; v0 = F3_freeze(__mulvsi3(a1[v2], v11, v11) + reg_40, a1, a2); } (&v3)[v1] = v0; } for (v1 = 1520; v1 > 760; v1 = __addvsi3(v1, 0xffffffff, v19)) { v14 = __addvsi3((&v3)[__addvsi3(v1, 0xfffffd07, (&v3)[v1])], (&v3)[v1], (&v3)[v1]); v15 = __addvsi3(v1, 0xfffffd07, (&v3)[v1]); v16 = F3_freeze(v14, 0xfffffd07, (&v3)[v1]); *((&v3 + v15)) = v16; v18 = __addvsi3((&v3)[__addvsi3(v1, 0xfffffd08, v15)], (&v3)[v1], (&v3)[v1]); v19 = __addvsi3(v1, 0xfffffd08, (&v3)[v1]); v20 = F3_freeze(v18, 0xfffffd08, (&v3)[v1]); *((&v3 + v19)) = v20; } for (v1 = 0; v1 <= 760; v1 = __addvsi3(v1, 0x1, &a0[v1])) { a0[v1] = (&v3)[v1]; } v22 = *(&v4) ^ v21[5]; return; }
openssh-portable
angr_phoenix
static int match_cfg_line(char **condition, int line, struct connection_info *ci) { int result = 1, attributes = 0, port; char *arg, *attrib, *cp = *condition; if (ci == ((void *)0)) sshlog("servconf.c", __func__, 1042, 0, SYSLOG_LEVEL_DEBUG3, ((void *)0), "checking syntax for 'Match %s'", cp); else sshlog("servconf.c", __func__, 1044, 0, SYSLOG_LEVEL_DEBUG3, ((void *)0), "checking match for '%s' user %s host %s addr %s " "laddr %s lport %d", cp, ci->user ? ci->user : "(null)", ci->host ? ci->host : "(null)", ci->address ? ci->address : "(null)", ci->laddress ? ci->laddress : "(null)", ci->lport) ; while ((attrib = strdelim(&cp)) && *attrib != '\0') { if (*attrib == '#') { cp = ((void *)0); break; } arg = ((void *)0); attributes++; if (strcasecmp(attrib, "all") == 0) { if (attributes > 1 || ((arg = strdelim(&cp)) != ((void *)0) && *arg != '\0' && *arg != '#')) { sshlog("servconf.c", __func__, 1062, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "'all' cannot be combined with other " "Match attributes"); return -1; } if (arg != ((void *)0) && *arg == '#') cp = ((void *)0); *condition = cp; return 1; } if ((arg = strdelim(&cp)) == ((void *)0) || *arg == '\0' || *arg == '#') { sshlog("servconf.c", __func__, 1074, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "Missing Match criteria for %s", attrib); return -1; } if (strcasecmp(attrib, "user") == 0) { if (ci == ((void *)0) || (ci->test && ci->user == ((void *)0))) { result = 0; continue; } if (ci->user == ((void *)0)) match_test_missing_fatal("User", "user"); if (match_usergroup_pattern_list(ci->user, arg) != 1) result = 0; else sshlog("servconf.c", __func__, 1087, 0, SYSLOG_LEVEL_DEBUG1, ((void *)0), "user %.100s matched 'User %.100s' at " "line %d", ci->user, arg, line); } else if (strcasecmp(attrib, "group") == 0) { if (ci == ((void *)0) || (ci->test && ci->user == ((void *)0))) { result = 0; continue; } if (ci->user == ((void *)0)) match_test_missing_fatal("Group", "user"); switch (match_cfg_line_group(arg, line, ci->user)) { case -1: return -1; case 0: result = 0; } } else if (strcasecmp(attrib, "host") == 0) { if (ci == ((void *)0) || (ci->test && ci->host == ((void *)0))) { result = 0; continue; } if (ci->host == ((void *)0)) match_test_missing_fatal("Host", "host"); if (match_hostname(ci->host, arg) != 1) result = 0; else sshlog("servconf.c", __func__, 1112, 0, SYSLOG_LEVEL_DEBUG1, ((void *)0), "connection from %.100s matched 'Host " "%.100s' at line %d", ci->host, arg, line); } else if (strcasecmp(attrib, "address") == 0) { if (ci == ((void *)0) || (ci->test && ci->address == ((void *)0))) { if (addr_match_list(((void *)0), arg) != 0) sshfatal("servconf.c", __func__, 1117, 0, SYSLOG_LEVEL_FATAL, ((void *)0), "Invalid Match address argument " "'%s' at line %d", arg, line); result = 0; continue; } if (ci->address == ((void *)0)) match_test_missing_fatal("Address", "addr"); switch (addr_match_list(ci->address, arg)) { case 1: sshlog("servconf.c", __func__, 1126, 0, SYSLOG_LEVEL_DEBUG1, ((void *)0), "connection from %.100s matched 'Address " "%.100s' at line %d", ci->address, arg, line); break; case 0: case -1: result = 0; break; case -2: return -1; } } else if (strcasecmp(attrib, "localaddress") == 0) { if (ci == ((void *)0) || (ci->test && ci->laddress == ((void *)0))) { if (addr_match_list(((void *)0), arg) != 0) sshfatal("servconf.c", __func__, 1139, 0, SYSLOG_LEVEL_FATAL, ((void *)0), "Invalid Match localaddress " "argument '%s' at line %d", arg, line) ; result = 0; continue; } if (ci->laddress == ((void *)0)) match_test_missing_fatal("LocalAddress", "laddr"); switch (addr_match_list(ci->laddress, arg)) { case 1: sshlog("servconf.c", __func__, 1150, 0, SYSLOG_LEVEL_DEBUG1, ((void *)0), "connection from %.100s matched " "'LocalAddress %.100s' at line %d", ci->laddress, arg, line) ; break; case 0: case -1: result = 0; break; case -2: return -1; } } else if (strcasecmp(attrib, "localport") == 0) { if ((port = a2port(arg)) == -1) { sshlog("servconf.c", __func__, 1163, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "Invalid LocalPort '%s' on Match line", arg); return -1; } if (ci == ((void *)0) || (ci->test && ci->lport == -1)) { result = 0; continue; } if (ci->lport == 0) match_test_missing_fatal("LocalPort", "lport"); if (port == ci->lport) sshlog("servconf.c", __func__, 1175, 0, SYSLOG_LEVEL_DEBUG1, ((void *)0), "connection from %.100s matched " "'LocalPort %d' at line %d", ci->laddress, port, line) ; else result = 0; } else if (strcasecmp(attrib, "rdomain") == 0) { if (ci == ((void *)0) || (ci->test && ci->rdomain == ((void *)0))) { result = 0; continue; } if (ci->rdomain == ((void *)0)) match_test_missing_fatal("RDomain", "rdomain"); if (match_pattern_list(ci->rdomain, arg, 0) != 1) result = 0; else sshlog("servconf.c", __func__, 1190, 0, SYSLOG_LEVEL_DEBUG1, ((void *)0), "user %.100s matched 'RDomain %.100s' at " "line %d", ci->rdomain, arg, line); } else { sshlog("servconf.c", __func__, 1193, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "Unsupported Match attribute %s", attrib); return -1; } } if (attributes == 0) { sshlog("servconf.c", __func__, 1198, 0, SYSLOG_LEVEL_ERROR, ((void *)0), "One or more attributes required for Match"); return -1; } if (ci != ((void *)0)) sshlog("servconf.c", __func__, 1202, 0, SYSLOG_LEVEL_DEBUG3, ((void *)0), "match %sfound", result ? "" : "not "); *condition = cp; return result; }
int match_cfg_line(unsigned long long *a0, unsigned long a1, unsigned long a2) { unsigned long long v0; unsigned long long v1; unsigned long long v2; char v3; struct_0 *v4; unsigned int v5; unsigned int v6; unsigned int v7; unsigned int v8; void *v9; unsigned long long v10; unsigned long v11; unsigned long long v12; char *v13; char v14; unsigned long long v15; char v16; unsigned long long v17; unsigned long long v18; unsigned long long v19; unsigned int v20; v5 = a1; v4 = a2; v6 = 1; v7 = 0; v9 = *(a0); if (!v4) { sshlog("servconf.c", "match_cfg_line", 0x412, 0x0, 0x7, 0x0, "checking syntax for 'Match %s'", v9, *(&v3)); } else { if (!v4->field_18) v17 = "(null)"; else v17 = v4->field_18; if (!v4->field_10) v18 = "(null)"; else v18 = v4->field_10; if (!v4->field_8) v19 = "(null)"; else v19 = v4->field_8; if (!v4->field_0) v20 = "(null)"; else v20 = v4->field_0; v2 = v17; v1 = v18; v0 = v19; sshlog("servconf.c", "match_cfg_line", 0x414, 0x0, 0x7, 0x0, "checking match for '%s' user %s host %s addr %s laddr %s lport %d", v9, v20); } while (true) { v10 = strdelim(&v9); if (!v10) { LABEL_403017: if (!v7) { v12 = "One or more attributes required for Match"; sshlog("servconf.c", "match_cfg_line", 0x4ae, 0x0, 0x2, 0x0, *(&v14), v15, *(&v16)); v20 = -1; break; } else { if (v4) { if (v6) v20 = &g_40b81a; else v20 = "not "; v13 = v20; v12 = "match %sfound"; sshlog("servconf.c", "match_cfg_line", 0x4b2, 0x0, 0x7, 0x0, *(&v14), v15, *(&v16)); } *(a0) = v9; v20 = v6; break; } } else { if (!*(v10)) goto LABEL_403017; if (*(v10) == 35) { v9 = 0; goto LABEL_403017; } else { v11 = 0; v7 = __addvsi3(v7, 0x1); if (!strcasecmp(v10, "all")) { if (v7 > 1) { LABEL_40279f: v12 = "'all' cannot be combined with other Match attributes"; sshlog("servconf.c", "match_cfg_line", 0x426, 0x0, 0x2, 0x0, *(&v14), v15, *(&v16)); v20 = -1; break; } else { v11 = strdelim(&v9); if (v11 && *(v11) && !(*(v11) == 35)) goto LABEL_40279f; if (v11 && *(v11) == 35) v9 = 0; *(a0) = v9; v20 = 1; break; } } v11 = strdelim(&v9); if (!v11) { LABEL_402843: v13 = v10; v12 = "Missing Match criteria for %s"; sshlog("servconf.c", "match_cfg_line", 0x432, 0x0, 0x2, 0x0, *(&v14), v15, *(&v16)); v20 = -1; break; } else { if (!*(v11)) goto LABEL_402843; if (*(v11) == 35) goto LABEL_402843; if (!strcasecmp(v10, "user")) { if (v4) { if (!v4->field_30) { LABEL_4028cf: if (!v4->field_0) match_test_missing_fatal("User", "user"); if (match_usergroup_pattern_list(v4->field_0, v11, v11) != 1) { v6 = 0; continue; } else { v13 = v5; v12 = v11; v11 = v4->field_0; v10 = "user %.100s matched 'User %.100s' at line %d"; sshlog("servconf.c", "match_cfg_line", 0x43f, 0x0, 0x5, 0x0, *(&v14), v15, *(&v16)); } continue; } else { if (!(!v4->field_0)) goto LABEL_4028cf; } } v6 = 0; } else if (!strcasecmp(v10, "group")) { if (v4) { if (!v4->field_30) { LABEL_4029a8: if (!v4->field_0) match_test_missing_fatal("Group", "user"); v20 = match_cfg_line_group(v11, v5, v4->field_0); if (v20 == -1) { v20 = -1; break; } else { if (!v20) v6 = 0; continue; } } else { if (!(!v4->field_0)) goto LABEL_4029a8; } } v6 = 0; } else if (!strcasecmp(v10, "host")) { if (v4) { if (!v4->field_30) { LABEL_402a49: if (!v4->field_8) match_test_missing_fatal("Host", "host"); if (match_hostname(v4->field_8, v11, v11) == 1) { v13 = v5; v12 = v11; v11 = v4->field_8; v10 = "connection from %.100s matched 'Host %.100s' at line %d"; sshlog("servconf.c", "match_cfg_line", 0x458, 0x0, 0x5, 0x0, *(&v14), v15, *(&v16)); continue; } else { v6 = 0; } continue; } else { if (!(!v4->field_8)) goto LABEL_402a49; } } v6 = 0; } else if (strcasecmp(v10, "address")) { if (strcasecmp(v10, "localaddress")) { if (!strcasecmp(v10, "localport")) { v8 = a2port(v11); if (v8 == -1) { v13 = v11; v12 = "Invalid LocalPort '%s' on Match line"; sshlog("servconf.c", "match_cfg_line", 0x48b, 0x0, 0x2, 0x0, *(&v14), v15, *(&v16)); v20 = -1; break; } if (v4) { if (!v4->field_30) { LABEL_402e45: if (!v4->field_20) match_test_missing_fatal("LocalPort", "lport"); if (v8 != v4->field_20) { v6 = 0; continue; } else { v13 = v5; v12 = v8; v11 = v4->field_18; v10 = "connection from %.100s matched 'LocalPort %d' at " "line %d"; sshlog("servconf.c", "match_cfg_line", 0x497, 0x0, 0x5, 0x0, *(&v14), v15, *(&v16)); } continue; } else if (!(v4->field_20 == -1)) { goto LABEL_402e45; } } v6 = 0; continue; } if (strcasecmp(v10, "rdomain")) { v13 = v10; v12 = "Unsupported Match attribute %s"; sshlog("servconf.c", "match_cfg_line", 0x4a9, 0x0, 0x2, 0x0, *(&v14), v15, *(&v16)); v20 = -1; break; } if (v4) { if (!v4->field_30) { LABEL_402f11: if (!v4->field_28) match_test_missing_fatal("RDomain", "rdomain"); if (match_pattern_list(v4->field_28, v11, 0x0, v11) != 1) { v6 = 0; continue; } else { v13 = v5; v12 = v11; v11 = v4->field_28; v10 = "user %.100s matched 'RDomain %.100s' at line %d"; sshlog("servconf.c", "match_cfg_line", 0x4a6, 0x0, 0x5, 0x0, *(&v14), v15, *(&v16)); } continue; } else if (!(!v4->field_28)) { goto LABEL_402f11; } } v6 = 0; continue; } if (!v4) { LABEL_402c7c: if (addr_match_list(0x0, v11)) { v12 = v5; v11 = v11; v10 = "Invalid Match localaddress argument '%s' at line %d"; sshfatal("servconf.c", "match_cfg_line", 0x473, 0x0, 0x1, 0x0, *(&v14)); } v6 = 0; } else if (!v4->field_30) { LABEL_402cde: if (!v4->field_18) match_test_missing_fatal("LocalAddress", "laddr"); v20 = addr_match_list(v4->field_18, v11); if (v20 == 1) { v13 = v5; v12 = v11; v11 = v4->field_18; v10 = "connection from %.100s matched 'LocalAddress %.100s' at " "line %d"; sshlog("servconf.c", "match_cfg_line", 0x47e, 0x0, 0x5, 0x0, *(&v14), v15, *(&v16)); } else { if (!(v20 <= 1)) continue; if (v20 == -2) { v20 = -1; break; } else if (v20 >= -2) { v20 += 1; if (v20 <= 1) v6 = 0; } } } else { if (!(!v4->field_18)) goto LABEL_402cde; goto LABEL_402c7c; } } else { if (v4) { if (!v4->field_30) { LABEL_402b7c: if (!v4->field_10) match_test_missing_fatal("Address", "addr"); v20 = addr_match_list(v4->field_10, v11); if (v20 == 1) { v13 = v5; v12 = v11; v11 = v4->field_10; v10 = "connection from %.100s matched 'Address %.100s' at " "line %d"; sshlog("servconf.c", "match_cfg_line", 0x466, 0x0, 0x5, 0x0, *(&v14), v15, *(&v16)); continue; } else { if (!(v20 <= 1)) continue; if (v20 == -2) { v20 = -1; break; } else { if (v20 >= -2) { v20 += 1; if (v20 <= 1) v6 = 0; } continue; } } } else if (!(!v4->field_10)) { goto LABEL_402b7c; } } if (addr_match_list(0x0, v11)) { v12 = v5; v11 = v11; v10 = "Invalid Match address argument '%s' at line %d"; sshfatal("servconf.c", "match_cfg_line", 0x45d, 0x0, 0x1, 0x0, *(&v14)); } v6 = 0; } } } } } return v20; }
openssh-portable
angr_phoenix
static void print_line(int userlen, char const *user, const char state, int linelen, char const *line, char const *time_str, char const *idle, char const *pid, char const *comment, char const *exitstr) { static char mesg[3] = {' ', 'x', '\0'}; char *buf; char x_idle[1 + 6 + 1]; char x_pid[1 + (((((sizeof(pid_t) * 8) - (!((__typeof__(pid_t))0 < (__typeof__(pid_t))-1))) * 146 + 484) / 485) + (!((__typeof__(pid_t))0 < (__typeof__(pid_t))-1))) + 1]; char *x_exitstr; int err; mesg[1] = state; if (include_idle && !short_output && strlen(idle) < sizeof x_idle - 1) sprintf(x_idle, " %-6s", idle); else *x_idle = '\0'; if (!short_output && strlen(pid) < sizeof x_pid - 1) sprintf(x_pid, " %10s", pid); else *x_pid = '\0'; x_exitstr = xmalloc( include_exit ? 1 + (((12) > (strlen(exitstr))) ? (12) : (strlen(exitstr))) + 1 : 1); if (include_exit) sprintf(x_exitstr, " %-12s", exitstr); else *x_exitstr = '\0'; err = asprintf(&buf, "%-8.*s" "%s" " %-12.*s" " %-*s" "%s" "%s" " %-8s" "%s", userlen, user ? user : " .", include_mesg ? mesg : "", linelen, line, time_format_width, time_str, x_idle, x_pid, comment, x_exitstr); if (err == -1) xalloc_die(); { char *p = buf + strlen(buf); while (*--p == ' ') ; *(p + 1) = '\0'; } puts(buf); free(buf); free(x_exitstr); }
void print_line(unsigned long a0, unsigned long a1, unsigned long a2, unsigned long a3, unsigned long a4, unsigned long a5, char *v18, char *a6, unsigned long a7, char *a8) { unsigned long v0; unsigned long v1; unsigned long v2; unsigned long v3; unsigned long v4; unsigned long v5; char *v6; char *v7; unsigned long v8; char *v9; char *v10; unsigned int v11; char v12; char v13[2]; char *v14; char v15; char v16; char v17; unsigned long v19; unsigned int v20; unsigned long long v21; unsigned long long v23; unsigned long long *v24; unsigned long long v25; v10 = v18; v9 = a6; v8 = a7; v7 = a8; g_401c01 = a2; if (include_idle && (short_output ^ 1) && strlen(v10) <= 6) { sprintf(&v15, " %-6s"); goto LABEL_40059f; } v15 = 0; LABEL_40059f: if ((short_output ^ 1) && strlen(v9) <= 11) { sprintf(&v16, " %10s", v9); goto LABEL_4005e7; } v16 = 0; LABEL_4005e7: if (!include_exit) { v19 = 1; } else if (strlen(v7) <= 11) { v19 = 14; } else { v19 = strlen(v7) + 2; } v14 = xmalloc(v19); if (!include_exit) *(v14) = 0; else sprintf(v14, " %-12s"); if (!include_mesg) v20 = &g_401de3; else v20 = " "; if (!a1) *(&v19) = &g_401eda; else *(&v19) = a1; v6 = v14; v5 = v8; v4 = &v16; v3 = &v15; v2 = a5; v1 = time_format_width; v0 = a4; v21 = asprintf(&v12, "%-8.*s%s %-12.*s %-*s%s%s %-8s%s", a0, v19, v20, a3); v11 = v21; if (v11 == -1) xalloc_die(); v23 = strlen(*(&v12)) + *(&v12); *(&v13) = v23; do { *(&v13) = &v13[1]; } while (v13[0] == 32); v13[1] = 0; puts(*(&v12)); free(*(&v12)); free(v14); v25 = *(&v17) ^ v24[5]; return; }
coreutils
angr_phoenix
int rl_vi_eword(int count, int ignore) { int opoint; while (count-- && rl_point < (rl_end - 1)) { if ((((rl_line_buffer[rl_point]) == ' ') || ((rl_line_buffer[rl_point]) == '\t')) == 0) _rl_vi_advance_point(); while (rl_point < rl_end && (((rl_line_buffer[rl_point]) == ' ') || ((rl_line_buffer[rl_point]) == '\t'))) _rl_vi_advance_point(); opoint = rl_point; if (rl_point < rl_end) { if (((1 && ((*__ctype_b_loc())[( int)(((unsigned char)rl_line_buffer[rl_point]))] & (unsigned short int)_ISalnum)) || (rl_line_buffer[rl_point]) == '_')) do { opoint = _rl_vi_advance_point(); } while (rl_point < rl_end && ((1 && ((*__ctype_b_loc())[( int)(((unsigned char)rl_line_buffer[rl_point]))] & (unsigned short int)_ISalnum)) || (rl_line_buffer[rl_point]) == '_')); else do { opoint = _rl_vi_advance_point(); } while (rl_point < rl_end && !((1 && ((*__ctype_b_loc())[( int)(((unsigned char)rl_line_buffer[rl_point]))] & (unsigned short int)_ISalnum)) || (rl_line_buffer[rl_point]) == '_') && !(((rl_line_buffer[rl_point]) == ' ') || ((rl_line_buffer[rl_point]) == '\t'))); } rl_point = opoint; } return (0); }
void rl_vi_eword(unsigned long a0, unsigned long a1) { unsigned int v0; int tmp_9; unsigned int v1; unsigned int v2; unsigned int v4; unsigned int v5; unsigned int v6; unsigned int v7; void *v8; v1 = a0; v0 = a1; while (true) { tmp_9 = v1; v1 -= 1; if (!tmp_9) break; if (rl_end - 1 <= rl_point) break; if (rl_end - 1 > rl_point) { if (*((rl_point + rl_line_buffer)) != 32 && *((rl_point + rl_line_buffer)) != 9) v4 = 0; if (*((rl_point + rl_line_buffer)) == 9 || *((rl_point + rl_line_buffer)) == 32) v4 = 1; if (!v4) _rl_vi_advance_point(); while (rl_point < rl_end) { if (*((rl_point + rl_line_buffer)) != 32) { if (*((rl_point + rl_line_buffer)) != 9) break; } _rl_vi_advance_point(); } v2 = rl_point; if (rl_point < rl_end) { *(&v4) = *((*(__ctype_b_loc()) + *((rl_point + rl_line_buffer)) * 2)); v5 = v4 & 8; if (!v5 && *((rl_point + rl_line_buffer)) != 95) { do { v2 = _rl_vi_advance_point(); if (rl_point >= rl_end) break; *(&v5) = *((*(__ctype_b_loc()) + *((rl_point + rl_line_buffer)) * 2)); v7 = v5 & 8; if (v7) break; if (!v7) { if (*((rl_point + rl_line_buffer)) == 95) break; if (*((rl_point + rl_line_buffer)) != 95) { if (*((rl_point + rl_line_buffer)) == 32) break; } } } while (*((rl_point + rl_line_buffer)) != 9); } if (*((rl_point + rl_line_buffer)) == 95 || v5) { do { v2 = _rl_vi_advance_point(); if (rl_point >= rl_end) break; *(&v5) = *((*(__ctype_b_loc()) + *((rl_point + rl_line_buffer)) * 2)); v6 = v5 & 8; if (v6) continue; } while (*((rl_point + rl_line_buffer)) == 95); } } } rl_point = v2; } v8 = 0; return; }
bash
angr_dream
static int gcd(int a, int b) { int c; c = a % b; while (c != 0) { a = b; b = c; c = a % b; } return (b); }
int gcd(unsigned long a0, unsigned long a1) { unsigned int v0; unsigned int v1; unsigned int v2; uint128_t v4; uint128_t v5; v1 = a0; v0 = a1; *(&v4) = (v1 >> 31 CONCAT v1) / m v0 >> 32; for (v2 = (v1 >> 31 CONCAT v1) / m v0 >> 32; v2; v2 = (v1 >> 31 CONCAT v1) / m v0 >> 32) { v1 = v0; v0 = v2; *(&v5) = (v1 >> 31 CONCAT v1) / m v0 >> 32; } return v0; }
openssh-portable
angr_sailr
static void apply_delayed_links(void) { struct delayed_link *ds; for (ds = delayed_link_head; ds;) { struct string_list *sources = ds->sources; char const *valid_source = 0; chdir_do(ds->change_dir); for (sources = ds->sources; sources; sources = sources->next) { char const *source = sources->string; struct stat st; if (fstatat(chdir_fd, source, &st, 0x100) == 0 && st.st_dev == ds->dev && st.st_ino == ds->ino && timespec_cmp(get_stat_birthtime(&st), ds->birthtime) == 0) { if (unlinkat(chdir_fd, source, 0) != 0) unlink_error(source); else if (valid_source && (linkat(chdir_fd, valid_source, chdir_fd, source, 0) == 0)) ; else if (!ds->is_symlink) { if (linkat(chdir_fd, ds->target, chdir_fd, source, 0) != 0) link_error(ds->target, source); } else if (symlinkat(ds->target, chdir_fd, source) != 0) symlink_error(ds->target, source); else { struct tar_stat_info st1; st1.stat.st_mode = ds->mode; st1.stat.st_uid = ds->uid; st1.stat.st_gid = ds->gid; st1.atime = ds->atime; st1.mtime = ds->mtime; st1.cntx_name = ds->cntx_name; st1.acls_a_ptr = ds->acls_a_ptr; st1.acls_a_len = ds->acls_a_len; st1.acls_d_ptr = ds->acls_d_ptr; st1.acls_d_len = ds->acls_d_len; st1.xattr_map = ds->xattr_map; st1.xattr_map_size = ds->xattr_map_size; set_stat(source, &st1, -1, 0, 0, '2', 0, 0x100); valid_source = source; } } } for (sources = ds->sources; sources;) { struct string_list *next = sources->next; free(sources); sources = next; } xheader_xattr_free(ds->xattr_map, ds->xattr_map_size); free(ds->cntx_name); { struct delayed_link *next = ds->next; free(ds); ds = next; } } delayed_link_head = 0; }
unsigned long apply_delayed_links() { long stat_birthtime; long v1; long v2; long v3; unsigned int *i; char *ptr; _QWORD *ptra; char *from; unsigned int *v9; _QWORD *v10; char *file; struct stat buf; char v13[48]; long v14; long v15; long v16; long v17; long v18; unsigned int v19; unsigned int v20; unsigned int v21; long v22; long v23; long v24; long v25; long v26; long v27; unsigned long v28; v28 = __readfsqword(0x28u); for (i = (unsigned int *)delayed_link_head; i; i = v9) { from = 0LL; chdir_do(i[22]); for (ptr = (char *)*((_QWORD *)i + 12); ptr; ptr = *(char **)ptr) { file = ptr + 8; if (!fstatat(chdir_fd, ptr + 8, &buf, 256) && buf.st_dev == *((_QWORD *)i + 1) && buf.st_ino == *((_QWORD *)i + 2)) { stat_birthtime = get_stat_birthtime(&buf); if (!(unsigned int)timespec_cmp(stat_birthtime, v1, *((_QWORD *)i + 3), *((_QWORD *)i + 4))) { if (unlinkat(chdir_fd, file, 0)) { unlink_error(file); } else if (!from || linkat(chdir_fd, from, chdir_fd, file, 0)) { if (*((_BYTE *)i + 40) != 1) { if (linkat(chdir_fd, (const char *)i + 160, chdir_fd, file, 0)) link_error(i + 40, file); } else if (symlinkat((const char *)i + 160, chdir_fd, file)) { symlink_error(i + 40, file); } else { v19 = i[11]; v20 = i[12]; v21 = i[13]; v2 = *((_QWORD *)i + 8); v22 = *((_QWORD *)i + 7); v23 = v2; v3 = *((_QWORD *)i + 10); v24 = *((_QWORD *)i + 9); v25 = v3; v14 = *((_QWORD *)i + 13); v15 = *((_QWORD *)i + 14); v16 = *((_QWORD *)i + 15); v17 = *((_QWORD *)i + 16); v18 = *((_QWORD *)i + 17); v27 = *((_QWORD *)i + 19); v26 = *((_QWORD *)i + 18); set_stat(file, (long)v13, -1, 0, 0, 50, 0, 256); from = ptr + 8; } } } } } for (ptra = (_QWORD *)*((_QWORD *)i + 12); ptra; ptra = v10) { v10 = (_QWORD *)*ptra; free(ptra); } xheader_xattr_free(*((_QWORD *)i + 19), *((_QWORD *)i + 18)); free(*((void **)i + 13)); v9 = *(unsigned int **)i; free(i); } delayed_link_head = 0LL; return __readfsqword(0x28u) ^ v28; }
tar
ida
int main(int argc, char **argv) { int optc; ; set_program_name(argv[0]); setlocale(6, ""); bindtextdomain("coreutils", "/usr/local/share/locale"); textdomain("coreutils"); initialize_exit_failure(TTY_WRITE_ERROR); atexit(close_stdout); silent = 0; while ((optc = getopt_long(argc, argv, "s", longopts, ((void *)0))) != -1) { switch (optc) { case 's': silent = 1; break; case GETOPT_HELP_CHAR: usage(0); break; ; case GETOPT_VERSION_CHAR: version_etc(stdout, "tty", "GNU coreutils", Version, ("David MacKenzie"), (char *)((void *)0)); exit(0); break; ; default: usage(TTY_FAILURE); } } if (optind < argc) { error(0, 0, gettext("extra operand %s"), quote(argv[optind])); usage(TTY_FAILURE); } (*__errno_location()) = 2; if (silent) return isatty(0) ? 0 : TTY_STDIN_NOTTY; int status = 0; char const *tty = ttyname(0); if (!tty) { tty = gettext("not a tty"); status = TTY_STDIN_NOTTY; } puts(tty); return status; }
int main(int argc, const char **argv, const char **envp) { long v3; char *v4; int v6; int v7; const char *s; set_program_name(*argv, argv, envp); setlocale(6, locale); bindtextdomain("coreutils", "/usr/local/share/locale"); textdomain("coreutils"); initialize_exit_failure(3u); atexit((void (*)(void))&close_stdout); for (silent = 0;; silent = 1) { v7 = getopt_long(argc, (char *const *)argv, "s", &longopts, 0LL); if (v7 == -1) break; if (v7 != 115) { if (v7 <= 115) { if (v7 == -131) { version_etc(stdout, "tty", "GNU coreutils", Version, "David MacKenzie", 0LL); exit(0); } if (v7 == -130) usage(0); } usage(2); } } if (argc > optind) { v3 = quote(argv[optind]); v4 = gettext("extra operand %s"); error(0, 0, v4, v3); usage(2); } *_errno_location() = 2; if (silent) return isatty(0) == 0; v6 = 0; s = ttyname(0); if (!s) { s = gettext("not a tty"); v6 = 1; } puts(s); return v6; }
coreutils
ida
void do_login(struct ssh *ssh, Session *s, const char *command) { socklen_t fromlen; struct sockaddr_storage from; struct passwd *pw = s->pw; pid_t pid = getpid(); memset(&from, 0, sizeof(from)); fromlen = sizeof(from); if (ssh_packet_connection_is_on_socket(ssh)) { if (getpeername(ssh_packet_get_connection_in(ssh), (struct sockaddr *)&from, &fromlen) == -1) { sshlog("session.c", __func__, 754, 0, SYSLOG_LEVEL_DEBUG1, ((void *)0), "getpeername: %.100s", strerror((*__errno_location()))); cleanup_exit(255); } } if (!use_privsep) record_login(pid, s->tty, pw->pw_name, pw->pw_uid, session_get_remote_name_or_ip(ssh, utmp_len, options.use_dns), (struct sockaddr *)&from, fromlen); if (check_quietlogin(s, command)) return; display_loginmsg(); do_motd(); }
void do_login(unsigned long long a0, struct_0 *a1, unsigned long long a2) { unsigned long v0; unsigned long v1; unsigned int v2; unsigned int v3; struct_1 *v4; char v5; char v6; unsigned long long *v11; unsigned long long v12; v4 = a1->field_10; v3 = getpid(); memset(&v5, 0x0, 0x80); v2 = 128; if (ssh_packet_connection_is_on_socket(a0) && getpeername(ssh_packet_get_connection_in(a0), &v5, &v2) == -1) { v1 = strerror(*(__errno_location())); v0 = "getpeername: %.100s"; sshlog("session.c", "do_login", 0x2f2, 0x0, 0x5, 0x0); cleanup_exit(0xff); } if (!use_privsep) { v0 = v2; record_login(v3, &a1[3].padding_0[4], v4->field_0, v4->field_10, session_get_remote_name_or_ip(a0, utmp_len, *(5250744)), &v5); } if (!check_quietlogin(a1, a2)) { display_loginmsg(); do_motd(); } v12 = *(&v6) ^ v11[5]; return; }
openssh-portable
angr_dream
static int statoverride_list(const char *const *argv) { struct fsys_hash_iter *iter; struct fsys_namenode *file; const char *thisarg; struct glob_node *glob_list = ((void *)0); int ret = 1; while ((thisarg = *argv++)) { char *pattern = path_cleanup(thisarg); glob_list_prepend(&glob_list, pattern); } if (glob_list == ((void *)0)) glob_list_prepend(&glob_list, m_strdup("*")); iter = fsys_hash_iter_new(); while ((file = fsys_hash_iter_next(iter))) { struct glob_node *g; for (g = glob_list; g; g = g->next) { if (fnmatch(g->pattern, file->name, 0) == 0) { statdb_node_print(stdout, file); ret = 0; break; } } } fsys_hash_iter_free(iter); glob_list_free(glob_list); return ret; }
undefined4 statoverride_list(long *param_1) { int iVar1; undefined8 uVar2; long in_FS_OFFSET; long *local_50; undefined4 local_44; undefined8 *local_40; undefined8 *local_38; long local_30; undefined8 local_28; long local_20; undefined8 local_18; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); local_40 = (undefined8 *)0x0; local_44 = 1; local_50 = param_1; while (true) { local_30 = *local_50; if (local_30 == 0) break; local_18 = path_cleanup(local_30); glob_list_prepend(&local_40, local_18); local_50 = local_50 + 1; } if (local_40 == (undefined8 *)0x0) { uVar2 = m_strdup(&DAT_001013a1); glob_list_prepend(&local_40, uVar2); } local_28 = fsys_hash_iter_new(); do { local_20 = fsys_hash_iter_next(local_28); if (local_20 == 0) { fsys_hash_iter_free(local_28); glob_list_free(local_40); if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) { __stack_chk_fail(); } return local_44; } for (local_38 = local_40; local_38 != (undefined8 *)0x0; local_38 = (undefined8 *)*local_38) { iVar1 = fnmatch((char *)local_38[1], *(char **)(local_20 + 8), 0); if (iVar1 == 0) { statdb_node_print(stdout, local_20); local_44 = 0; break; } } } while (true); }
dpkg
ghidra
static _Bool want_subgids(void) { if (get_subid_nss_handle() != ((void *)0)) return 0; if (getdef_ulong("SUB_GID_COUNT", 65536) == 0) return 0; return 1; }
int want_subgids() { unsigned int v1; v1 = get_subid_nss_handle(); if (v1) { v1 = 0; } else { v1 = getdef_ulong("SUB_GID_COUNT", 0x10000); if (!v1) v1 = 0; else v1 = 1; } return v1; }
shadow
angr_dream
static void addblanks() { register int i; unsigned char uc; for (i = 0; i < 256; i++) { uc = i; if (((*__ctype_b_loc())[(int)((uc))] & (unsigned short int)_ISblank)) lsyntax[uc] |= 0x2000; } }
void addblanks() { char v0; int tmp_48; unsigned int v2; unsigned long long v4; unsigned long long v5; unsigned long long v6; for (v2 = 0; v2 <= 255; v2 += 1) { v0 = 0; v4 = *((*(__ctype_b_loc()) + v0 * 2)) & 1; if (v4) { v5 = *((4 * v0 + &lsyntax)); *(&v5) = (*((4 * v0 + &lsyntax)) >> 8) | 32; v6 = &lsyntax; tmp_48 = v5; *((4 * v0 + &lsyntax)) = tmp_48; } } return; }
bash
angr_phoenix
u_int32_t sshkey_signatures_left(const struct sshkey *k) { return 0; }
long sshkey_signatures_left() { return 0LL; }
openssh-portable
ida
int jbd2_journal_init_revoke_table_cache(void) { do { if (!(!jbd2_revoke_table_cache)) { printf("Assertion failure in %s() at %s line %d: " "\"%s\"\n", __func__, "revoke.c", 208, "!jbd2_revoke_table_cache"); fatal_error(e2fsck_global_ctx, 0); } } while (0); jbd2_revoke_table_cache = do_cache_create(sizeof(struct jbd2_revoke_table_s)); if (!jbd2_revoke_table_cache) { ; return -12; } return 0; }
long long jbd2_journal_init_revoke_table_cache() { unsigned long long v1; if (jbd2_revoke_table_cache) { printf("Assertion failure in %s() at %s line %d: \"%s\"\n", &__func__ .9580, &g_40089a, 208, &g_4008d7); fatal_error(e2fsck_global_ctx, 0x0); } jbd2_revoke_table_cache = do_cache_create(0x10); if (!jbd2_revoke_table_cache) v1 = 4294967284; else v1 = 0; return v1; }
e2fsprogs-1.46.5
angr_dream
char **completion_matches(const char *s, rl_compentry_func_t *f) { return rl_completion_matches(s, f); }
long long completion_matches(unsigned long long a0, unsigned long long a1) { return rl_completion_matches(a0, a1, a1); }
bash
angr_sailr
static void file_rename(struct file *src, struct file *dst) { if (src->stat_state == FILE_STAT_NOFILE) return; if (dst->stat_state == FILE_STAT_VALID) { if (unlink(src->name)) ohshite(gettext("rename: remove duplicate old link '%s'"), src->name); } else { if (rename(src->name, dst->name) == 0) return; file_copy(src->name, dst->name); if (unlink(src->name)) ohshite(gettext("unable to remove copied source file '%s'"), src->name); } }
void file_rename(struct_0 *a0, struct_0 *a1) { unsigned long long v1; unsigned long long v2; unsigned long long v3; unsigned long long v4; unsigned long long v5; v1 = a0->field_8; if (a0->field_8 != 2) { if (a1->field_8 == 1) { v2 = unlink(a0->field_0); ohshite(gettext("rename: remove duplicate old link '%s'"), a0->field_0); } v3 = rename(a0->field_0, a1->field_0); file_copy(a0->field_0, a1->field_0, a1->field_0); v4 = unlink(a0->field_0); v5 = ohshite(gettext("unable to remove copied source file '%s'"), a0->field_0); } return; }
dpkg
angr_phoenix
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_phoenix
static inline __u32 rta_getattr_u32(const struct rtattr *rta) { return *(__u32 *)(( void *)(((char *)(rta)) + ((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0)))); }
int rta_getattr_u32(struct_0 *a0) { return a0->field_4; }
iproute2-6.0.0
angr_sailr
em_universal_argument(EditLine *el, wint_t c __attribute__((__unused__))) { if (el->el_state.argument > 1000000) return 6; el->el_state.doingarg = 1; el->el_state.argument *= 4; return 3; }
undefined8 em_universal_argument(long param_1) { undefined8 uVar1; if (*(int *)(param_1 + 0x78) < 0xf4241) { *(undefined4 *)(param_1 + 0x74) = 1; *(int *)(param_1 + 0x78) = *(int *)(param_1 + 0x78) * 4; uVar1 = 3; } else { uVar1 = 6; } return uVar1; }
libedit
ghidra
static void unwind_frame_discard_internal(tag, ignore) char *tag, *ignore; { UNWIND_ELT *elt; int found; found = 0; while (elt = unwind_protect_list) { unwind_protect_list = unwind_protect_list->head.next; if (elt->head.cleanup == 0 && (((elt->arg.v)[0] == (tag)[0] && strcmp(elt->arg.v, tag) == 0))) { do { if ((uwcache).nc < (uwcache).cs) { do { if ((sizeof(UNWIND_ELT)) <= 32) { register char *mzp = (char *)((elt)); unsigned long mctmp = (sizeof(UNWIND_ELT)); register long mcn; if (mctmp < 8) mcn = 0; else { mcn = (mctmp - 1) / 8; mctmp &= 7; } switch (mctmp) { case 0: for (;;) { *mzp++ = 0xdf; case 7: *mzp++ = 0xdf; case 6: *mzp++ = 0xdf; case 5: *mzp++ = 0xdf; case 4: *mzp++ = 0xdf; case 3: *mzp++ = 0xdf; case 2: *mzp++ = 0xdf; case 1: *mzp++ = 0xdf; if (mcn <= 0) break; mcn--; } } } else memset(((elt)), (0xdf), (sizeof(UNWIND_ELT))); } while (0); ((UNWIND_ELT **)((uwcache).data))[(uwcache).nc++] = (elt); } else sh_xfree((elt), "unwind_prot.c", 277); } while (0); found = 1; break; } else do { if ((uwcache).nc < (uwcache).cs) { do { if ((sizeof(UNWIND_ELT)) <= 32) { register char *mzp = (char *)((elt)); unsigned long mctmp = (sizeof(UNWIND_ELT)); register long mcn; if (mctmp < 8) mcn = 0; else { mcn = (mctmp - 1) / 8; mctmp &= 7; } switch (mctmp) { case 0: for (;;) { *mzp++ = 0xdf; case 7: *mzp++ = 0xdf; case 6: *mzp++ = 0xdf; case 5: *mzp++ = 0xdf; case 4: *mzp++ = 0xdf; case 3: *mzp++ = 0xdf; case 2: *mzp++ = 0xdf; case 1: *mzp++ = 0xdf; if (mcn <= 0) break; mcn--; } } } else memset(((elt)), (0xdf), (sizeof(UNWIND_ELT))); } while (0); ((UNWIND_ELT **)((uwcache).data))[(uwcache).nc++] = (elt); } else sh_xfree((elt), "unwind_prot.c", 282); } while (0); } if (found == 0) internal_warning(gettext("unwind_frame_discard: %s: frame not found"), tag); }
void unwind_frame_discard_internal(char *param_1) { char **ppcVar1; undefined *puVar2; bool bVar3; undefined8 *puVar4; int iVar5; long lVar6; undefined8 uVar7; undefined8 *puVar8; bVar3 = false; LAB_0010077b: puVar4 = unwind_protect_list; if (unwind_protect_list != (undefined8 *)0x0) { puVar8 = (undefined8 *)*unwind_protect_list; if (((unwind_protect_list[1] != 0) || (*(char *)unwind_protect_list[2] != *param_1)) || (ppcVar1 = (char **)(unwind_protect_list + 2), unwind_protect_list = puVar8, iVar5 = strcmp(*ppcVar1, param_1), puVar8 = unwind_protect_list, iVar5 != 0)) { unwind_protect_list = puVar8; if (uwcache._12_4_ < uwcache._8_4_) { lVar6 = 3; puVar8 = puVar4; while (true) { *(undefined *)puVar8 = 0xdf; *(undefined *)((long)puVar8 + 1) = 0xdf; *(undefined *)((long)puVar8 + 2) = 0xdf; *(undefined *)((long)puVar8 + 3) = 0xdf; *(undefined *)((long)puVar8 + 4) = 0xdf; *(undefined *)((long)puVar8 + 5) = 0xdf; puVar2 = (undefined *)((long)puVar8 + 7); *(undefined *)((long)puVar8 + 6) = 0xdf; puVar8 = puVar8 + 1; *puVar2 = 0xdf; if (lVar6 < 1) break; lVar6 = lVar6 + -1; } lVar6 = (long)uwcache._12_4_; uwcache._12_4_ = uwcache._12_4_ + 1; *(undefined8 **)(uwcache._0_8_ + lVar6 * 8) = puVar4; } else { sh_xfree(puVar4, "unwind_prot.c", 0x11a); } goto LAB_0010077b; } if (uwcache._12_4_ < uwcache._8_4_) { lVar6 = 3; puVar8 = puVar4; while (true) { *(undefined *)puVar8 = 0xdf; *(undefined *)((long)puVar8 + 1) = 0xdf; *(undefined *)((long)puVar8 + 2) = 0xdf; *(undefined *)((long)puVar8 + 3) = 0xdf; *(undefined *)((long)puVar8 + 4) = 0xdf; *(undefined *)((long)puVar8 + 5) = 0xdf; puVar2 = (undefined *)((long)puVar8 + 7); *(undefined *)((long)puVar8 + 6) = 0xdf; puVar8 = puVar8 + 1; *puVar2 = 0xdf; if (lVar6 < 1) break; lVar6 = lVar6 + -1; } lVar6 = (long)uwcache._12_4_; uwcache._12_4_ = uwcache._12_4_ + 1; *(undefined8 **)(uwcache._0_8_ + lVar6 * 8) = puVar4; } else { sh_xfree(puVar4, "unwind_prot.c", 0x115); } bVar3 = true; } if (!bVar3) { uVar7 = gettext("unwind_frame_discard: %s: frame not found"); internal_warning(uVar7, param_1); } return; }
bash
ghidra
static void print_stats(void) { if (status_level == STATUS_NONE) return; if (0 < progress_len) { fputc_unlocked('\n', stderr); progress_len = 0; } fprintf(stderr, gettext("%" "l" "d" "+%" "l" "d" " records in\n" "%" "l" "d" "+%" "l" "d" " records out\n"), r_full, r_partial, w_full, w_partial); if (r_truncate != 0) fprintf(stderr, ngettext("%" "l" "d" " truncated record\n", "%" "l" "d" " truncated records\n", select_plural(r_truncate)), r_truncate); if (status_level == STATUS_NOXFER) return; print_xfer_stats(0); }
void print_stats() { unsigned long long v1; unsigned long long v2; unsigned long long v3; v1 = status_level; if (status_level != 1) { if (progress_len > 0) { fputc_unlocked(0xa, stderr); progress_len = 0; } fprintf(stderr, gettext("%ld+%ld records in\n%ld+%ld records out\n")); if (r_truncate) fprintf(stderr, ngettext("%ld truncated record\n", "%ld truncated records\n", select_plural(r_truncate))); v2 = status_level; if (status_level != 2) v3 = print_xfer_stats(0x0); } return; }
coreutils
angr_dream
void rl_free_line_state(void) { register HIST_ENTRY *entry; rl_free_undo_list(); entry = current_history(); if (entry) entry->data = (char *)((void *)0); _rl_kill_kbd_macro(); rl_clear_message(); _rl_reset_argument(); }
void rl_free_line_state(unsigned long long a0, unsigned long long a1, unsigned long long a2, unsigned long long a3, unsigned long long a4, unsigned long long a5) { char v0; unsigned long long v1; struct_0 *v2; unsigned long long v3; rl_free_undo_list(); v2 = current_history(a0, a1, a2, a3, a4, a5, *(&v0), v1); if (v2) v2->field_10 = 0; _rl_kill_kbd_macro(); rl_clear_message(a0, a1, a2, a3, a4, a5); v3 = _rl_reset_argument(a0, a1, a2, a3, a4, a5); return; }
bash
angr_sailr
(r = sshpkt_put_cstring(ssh, service)) != 0 || (r = sshpkt_put_u8(ssh, wantconfirm)) != 0) { sshfatal("channels.c", __func__, 998, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "channel %i", c->self); }
void sshpkt_put_cstring(void) { halt_baddata(); }
openssh-portable
ghidra
static void send_attrib(u_int32_t id, const Attrib *a) { struct sshbuf *msg; int r; sshlog("sftp-server.c", __func__, 644, 0, SYSLOG_LEVEL_DEBUG1, ((void *)0), "request %u: sent attrib have 0x%x", id, a->flags); if ((msg = sshbuf_new()) == ((void *)0)) sshfatal("sftp-server.c", __func__, 646, 1, SYSLOG_LEVEL_FATAL, ((void *)0), "sshbuf_new failed"); if ((r = sshbuf_put_u8(msg, 105)) != 0 || (r = sshbuf_put_u32(msg, id)) != 0 || (r = encode_attrib(msg, a)) != 0) sshfatal("sftp-server.c", __func__, 650, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "compose"); send_msg(msg); sshbuf_free(msg); }
void send_attrib(undefined4 param_1, uint *param_2) { uint *puVar1; undefined8 uVar2; uint **ppuVar3; undefined *puVar4; char *pcStackY80; char *pcStack56; undefined8 uStack48; uint *puStack40; undefined4 local_1c; int local_14; long local_10; pcStack56 = (char *)(ulong)*param_2; puStack40 = param_2; local_1c = param_1; sshlog("sftp-server.c", "send_attrib", 0x284, 0, 5, 0, "request %u: sent attrib have 0x%x", param_1); ppuVar3 = (uint **)&stack0xffffffffffffffd8; uStack48 = 0x1016fa; local_10 = sshbuf_new(); if (local_10 == 0) { ppuVar3 = (uint **)&stack0xffffffffffffffc8; pcStack56 = "sshbuf_new failed"; sshfatal("sftp-server.c", "send_attrib", 0x286, 1, 1, 0); } *(undefined8 *)((long)ppuVar3 + -8) = 0x101750; local_14 = sshbuf_put_u8(local_10, 0x69); if (local_14 == 0) { *(undefined8 *)((long)ppuVar3 + -8) = 0x10176a; local_14 = sshbuf_put_u32(local_10, local_1c); puVar1 = puStack40; if (local_14 == 0) { *(undefined8 *)((long)ppuVar3 + -8) = 0x101786; local_14 = encode_attrib(local_10, puVar1); puVar4 = (undefined *)ppuVar3; if (local_14 == 0) goto LAB_001017d0; } } *(undefined8 *)((long)ppuVar3 + -8) = 0x101799; uVar2 = ssh_err(local_14); puVar4 = (undefined *)((long)ppuVar3 + -0x10); *(char **)((long)ppuVar3 + -0x10) = "compose"; *(undefined8 *)((long)ppuVar3 + -0x18) = 0x1017d0; sshfatal("sftp-server.c", "send_attrib", 0x28a, 1, 1, uVar2); LAB_001017d0: *(undefined8 *)(puVar4 + -8) = 0x1017dc; send_msg(local_10); *(undefined8 *)(puVar4 + -8) = 0x1017e8; sshbuf_free(local_10); return; }
openssh-portable
ghidra
static void proc_footer(void) { current_type = footer_type; current_regex = &footer_regex; reset_lineno(); putchar_unlocked('\n'); }
void proc_footer() { unsigned long long v1; current_type = footer_type; current_regex = &footer_regex; reset_lineno(); v1 = putchar_unlocked(0xa); return; }
coreutils
angr_dream
int sshkey_write(const struct sshkey *key, FILE *f) { struct sshbuf *b = ((void *)0); int r = -1; if ((b = sshbuf_new()) == ((void *)0)) return -2; if ((r = sshkey_format_text(key, b)) != 0) goto out; if (fwrite(sshbuf_ptr(b), sshbuf_len(b), 1, f) != 1) { if (feof(f)) (*__errno_location()) = 32; r = -24; goto out; } r = 0; out: sshbuf_free(b); return r; }
long sshkey_write(int *a1, FILE *a2) { size_t v3; const void *v4; unsigned int v5; long v6; v6 = sshbuf_new(a1); if (!v6) return 4294967294LL; v5 = sshkey_format_text(a1, v6); if (!v5) { v3 = sshbuf_len(v6); v4 = (const void *)sshbuf_ptr(v6); if (fwrite(v4, v3, 1uLL, a2) == 1) { v5 = 0; } else { if (feof(a2)) *_errno_location() = 32; v5 = -24; } } sshbuf_free(v6); return v5; }
openssh-portable
ida
void e2fsck_pass4(e2fsck_t ctx) { ext2_filsys fs = ctx->fs; ext2_ino_t i; struct ext2_inode_large *inode; int inode_size = (((fs->super)->s_rev_level == 0) ? 128 : (fs->super)->s_inode_size); struct resource_track rtrack; struct problem_context pctx; __u16 link_count, link_counted; int dir_nlink_fs; char *buf = 0; dgrp_t group, maxgroup; init_resource_track(&rtrack, ctx->fs->io); if (ctx->readahead_kb && (fs->block_map == ((void *)0) || fs->inode_map == ((void *)0))) e2fsck_readahead(fs, (0x04) | (0x08), 0, fs->group_desc_count); clear_problem_context(&pctx); if (!(ctx->options & 0x0002)) fix_problem(ctx, 0x040000, &pctx); dir_nlink_fs = ext2fs_has_feature_dir_nlink(fs->super); group = 0; maxgroup = fs->group_desc_count; if (ctx->progress) if ((ctx->progress)(ctx, 4, 0, maxgroup)) return; inode = e2fsck_allocate_memory(ctx, inode_size, "scratch inode"); for (i = 1; i <= fs->super->s_inodes_count && i > 0; i++) { int isdir; if (ctx->flags & (0x0001 | 0x0002)) goto errout; if ((i % fs->super->s_inodes_per_group) == 0) { group++; if (ctx->progress) if ((ctx->progress)(ctx, 4, group, maxgroup)) goto errout; } if (i == quota_type2inum(PRJQUOTA, ctx->fs->super) || i == 1 || (i > 2 && i < (((fs->super)->s_rev_level == 0) ? 11 : (fs->super)->s_first_ino))) continue; if (!(ext2fs_test_inode_bitmap2(ctx->inode_used_map, i)) || (ctx->inode_imagic_map && ext2fs_test_inode_bitmap2(ctx->inode_imagic_map, i)) || (ctx->inode_bb_map && ext2fs_test_inode_bitmap2(ctx->inode_bb_map, i))) continue; ext2fs_icount_fetch(ctx->inode_link_info, i, &link_count); ext2fs_icount_fetch(ctx->inode_count, i, &link_counted); if (link_counted == 0) { check_ea_inode(ctx, i, inode, &link_counted); } if (link_counted == 0) { if (!buf) buf = e2fsck_allocate_memory(ctx, fs->blocksize, "bad_inode buffer"); if (e2fsck_process_bad_inode(ctx, 0, i, buf)) continue; if (disconnect_inode(ctx, i, inode)) continue; ext2fs_icount_fetch(ctx->inode_link_info, i, &link_count); ext2fs_icount_fetch(ctx->inode_count, i, &link_counted); } isdir = ext2fs_test_inode_bitmap2(ctx->inode_dir_map, i); if (isdir && (link_counted > 65000)) { if (!dir_nlink_fs && fix_problem(ctx, 0x040006, &pctx)) { ext2fs_set_feature_dir_nlink(fs->super); ext2fs_mark_super_dirty(fs); dir_nlink_fs = 1; } link_counted = 1; } if (link_counted != link_count) { int fix_nlink = 0; e2fsck_read_inode_full(ctx, i, EXT2_INODE(inode), inode_size, "pass4"); pctx.ino = i; pctx.inode = EXT2_INODE(inode); if ((link_count != inode->i_links_count) && !isdir && (inode->i_links_count <= 65000)) { pctx.num = link_count; fix_problem(ctx, 0x040004, &pctx); } pctx.num = link_counted; if (isdir && link_counted > 1 && (inode->i_flags & 0x00001000) && link_count == 1) { if ((ctx->options & 0x0001) == 0) { fix_nlink = fix_problem(ctx, 0x040007, &pctx); } } else { fix_nlink = fix_problem(ctx, 0x040003, &pctx); } if (fix_nlink) { inode->i_links_count = link_counted; e2fsck_write_inode_full(ctx, i, EXT2_INODE(inode), inode_size, "pass4"); } } } ext2fs_free_icount(ctx->inode_link_info); ctx->inode_link_info = 0; ext2fs_free_icount(ctx->inode_count); ctx->inode_count = 0; ext2fs_free_inode_bitmap(ctx->inode_bb_map); ctx->inode_bb_map = 0; ea_refcount_free(ctx->ea_inode_refs); ctx->ea_inode_refs = 0; ext2fs_free_inode_bitmap(ctx->inode_imagic_map); ctx->inode_imagic_map = 0; errout: if (buf) ext2fs_free_mem(&buf); ext2fs_free_mem(&inode); print_resource_track(ctx, (gettext("Pass 4")), &rtrack, ctx->fs->io); }
long long e2fsck_pass4(struct_0 *a0) { char v0; unsigned short v1; unsigned int v2; unsigned int v3; unsigned int v4; unsigned int v5; unsigned int v6; unsigned int v7; unsigned int v8; struct_2 *v9; void *v10; struct_3 *v11; char v12; char v13; unsigned int v14; unsigned long v15; unsigned long v16; unsigned int v18; unsigned long long v20; unsigned int v21; unsigned long long v25; unsigned long long v26; v11 = &a0->field_0->padding_0; if (v11->field_20->field_4c) v18 = v11->field_20->field_58; else v18 = 128; v6 = v18; v10 = 0; init_resource_track(&v12, a0->field_0->field_8, a0->field_0->field_8); if (a0->field_398 && (!v11->field_50 || !v11->field_58)) e2fsck_readahead(v11, 0xc, 0x0, v11->field_30); clear_problem_context(&v13); if (!(a0->field_4c & 2)) fix_problem(a0, 0x40000, &v13); v3 = ext2fs_has_feature_dir_nlink(v11->field_20); v4 = 0; v7 = v11->field_30; if (!a0->field_160(a0, 4, 0, v7, a0->field_160) || !a0->field_160) { v9 = e2fsck_allocate_memory(a0, v6, "scratch inode", v6); v2 = 1; while (true) { if (v2 <= v11->field_20->field_0 && v2) { if ((a0->field_48 & 3)) break; if (!(a0->field_48 & 3)) { if (!(0 CONCAT v2) / m v11->field_20->field_28 >> 32) { v4 += 1; if (a0->field_160) { v20 = a0->field_160(a0, 4, v4, v7, a0->field_160); if (v20) break; } } if (!v20) { v21 = quota_type2inum(0x2, a0->field_0->field_20); if (v2 != v21 && v2 != 1) { if (v2 > 2) { if (v11->field_20->field_4c) v21 = v11->field_20->field_54; else v21 = 11; } if ((v2 <= 2 || v21 <= v2) && ext2fs_test_inode_bitmap2(a0->field_168, v2, v2) && (!ext2fs_test_inode_bitmap2(a0->field_188, v2, v2) || !a0->field_188) && (!a0->field_180 || !ext2fs_test_inode_bitmap2(a0->field_180, v2, v2))) { ext2fs_icount_fetch(a0->field_1c0, v2, &v0, v2); ext2fs_icount_fetch(a0->field_1b8, v2, &v1, v2); if (!v1) check_ea_inode(a0, v2, v9, &v1); if (!v1) { if (!v10) v10 = e2fsck_allocate_memory( a0, v11->field_28, "bad_inode buffer", v11->field_28); v25 = e2fsck_process_bad_inode(a0, 0x0, v2, v10); if (!v25) { v26 = disconnect_inode(a0, v2, v9); if (!v26) { ext2fs_icount_fetch(a0->field_1c0, v2, &v0, v2); ext2fs_icount_fetch(a0->field_1b8, v2, &v1, v2); } } } if (v1 || !v25 && !v26) { v8 = ext2fs_test_inode_bitmap2(a0->field_178, v2, v2); if (v8 && v1 > 65000) { if (!v3 && fix_problem(a0, 0x40006, &v13)) { ext2fs_set_feature_dir_nlink(v11->field_20); ext2fs_mark_super_dirty(v11); v3 = 1; } v1 = 1; } if (v1 != *(&v0)) { v5 = 0; e2fsck_read_inode_full(a0, v2, EXT2_INODE(v9), v6, "pass4"); v14 = v2; v15 = EXT2_INODE(v9); if (v9->field_1a != *(&v0) && !v8 && v9->field_1a <= 65000) { v16 = *(&v0); fix_problem(a0, 0x40004, &v13); } v16 = v1; if (v8 && v1 > 1 && (v9->field_20 & 0x1000) && *(&v0) == 1 && !(a0->field_4c & 1)) v5 = fix_problem(a0, 0x40007, &v13); if (!v8 || v1 <= 1 || !(v9->field_20 & 0x1000) || *(&v0) != 1) v5 = fix_problem(a0, 0x40003, &v13); if (v5) { v9->field_1a = v1; e2fsck_write_inode_full(a0, v2, EXT2_INODE(v9), v6, "pass4"); } } } } } v2 += 1; continue; } } } if (!v2 || v2 > v11->field_20->field_0) { ext2fs_free_icount(a0->field_1c0); a0->field_1c0 = 0; ext2fs_free_icount(a0->field_1b8); a0->field_1b8 = 0; ext2fs_free_inode_bitmap(a0->field_180); a0->field_180 = 0; ea_refcount_free(a0->field_1e8); a0->field_1e8 = 0; ext2fs_free_inode_bitmap(a0->field_188); a0->field_188 = 0; break; } } if (v10) ext2fs_free_mem(&v10); ext2fs_free_mem(&v9); print_resource_track(a0, gettext("Pass 4"), &v12, a0->field_0->field_8); } return 0; }
e2fsprogs-1.46.5
angr_dream
static void tarobject_extract(struct tarcontext *tc, struct tar_entry *te, const char *path, struct file_stat *st, struct fsys_namenode *namenode) { static struct varbuf hardlinkfn; static int fd; struct dpkg_error err; struct fsys_namenode *linknode; char fnamebuf[256]; char fnamenewbuf[256]; char *newhash; int rc; switch (te->type) { case TAR_FILETYPE_FILE: fd = open(path, 0100 | 0200 | 01, 0); if (fd < 0) ohshite(gettext("unable to create '%.255s' (while processing '%.255s')"), path, te->name); push_cleanup(cu_closefd, ehflag_bombout, 1, &fd); debug(dbg_eachfiledetail, "tarobject file open size=%jd", (intmax_t)te->size); fd_allocate_size(fd, 0, te->size); newhash = nfmalloc(32 + 1); if (buffer_copy_IntInt(tc->backendpipe, 0, newhash, 5, fd, 2, te->size, &err) < 0) ohshit(gettext("cannot copy extracted data for '%.255s' to '%.255s': %s"), path_quote_filename(fnamebuf, te->name, 256), path_quote_filename(fnamenewbuf, fnamenewvb.buf, 256), err.str); namenode->newhash = newhash; debug(dbg_eachfiledetail, "tarobject file hash=%s", namenode->newhash); tarobject_skip_padding(tc, te); fd_writeback_init(fd); if (namenode->statoverride) debug(dbg_eachfile, "tarobject ... stat override, uid=%d, gid=%d, mode=%04o", namenode->statoverride->uid, namenode->statoverride->gid, namenode->statoverride->mode); rc = fchown(fd, st->uid, st->gid); if (forcible_nonroot_error(rc)) ohshite(gettext("error setting ownership of '%.255s'"), te->name); rc = fchmod(fd, st->mode & ~0170000); if (forcible_nonroot_error(rc)) ohshite(gettext("error setting permissions of '%.255s'"), te->name); if (!in_force(FORCE_UNSAFE_IO)) namenode->flags |= FNNF_DEFERRED_FSYNC; pop_cleanup(ehflag_normaltidy); if (close(fd)) ohshite(gettext("error closing/writing '%.255s'"), te->name); break; case TAR_FILETYPE_FIFO: if (mkfifo(path, 0)) ohshite(gettext("error creating pipe '%.255s'"), te->name); debug(dbg_eachfiledetail, "tarobject fifo"); break; case TAR_FILETYPE_CHARDEV: if (mknod(path, 0020000, te->dev)) ohshite(gettext("error creating device '%.255s'"), te->name); debug(dbg_eachfiledetail, "tarobject chardev"); break; case TAR_FILETYPE_BLOCKDEV: if (mknod(path, 0060000, te->dev)) ohshite(gettext("error creating device '%.255s'"), te->name); debug(dbg_eachfiledetail, "tarobject blockdev"); break; case TAR_FILETYPE_HARDLINK: varbuf_reset(&hardlinkfn); varbuf_add_buf(&hardlinkfn, instdir, strlen(instdir)); linknode = fsys_hash_find_node(te->linkname, 0); varbuf_add_buf( &hardlinkfn, namenodetouse(linknode, tc->pkg, &tc->pkg->available)->name, strlen(namenodetouse(linknode, tc->pkg, &tc->pkg->available)->name)); if (linknode->flags & (FNNF_DEFERRED_RENAME | FNNF_NEW_CONFF)) varbuf_add_buf(&hardlinkfn, ".dpkg-new", strlen(".dpkg-new")); varbuf_end_str(&hardlinkfn); if (link(hardlinkfn.buf, path)) ohshite(gettext("error creating hard link '%.255s'"), te->name); namenode->newhash = linknode->newhash; debug(dbg_eachfiledetail, "tarobject hardlink hash=%s", namenode->newhash); break; case TAR_FILETYPE_SYMLINK: if (symlink(te->linkname, path)) ohshite(gettext("error creating symbolic link '%.255s'"), te->name); debug(dbg_eachfiledetail, "tarobject symlink creating"); break; case TAR_FILETYPE_DIR: if (mkdir(path, 0)) ohshite(gettext("error creating directory '%.255s'"), te->name); debug(dbg_eachfiledetail, "tarobject directory creating"); break; default: do_internerr("archives.c", 451, __func__, "unknown tar type '%d', but already checked", te->type); } }
void tarobject_extract(struct_2 *a0, struct_0 *a1, char *a2, unsigned long long a3, struct_1 *a4) { unsigned long v0; unsigned long v1; struct_3 *v2; unsigned long long v3; char v4; char v5; char v6; char v7; unsigned long long *v16; unsigned long long v17; v1 = a3; switch (a1->field_4) { case 48: fd.6104 = open(a2, 0xc1, 0x0); if (fd.6104 < 0) ohshite(gettext("unable to create '%.255s' (while processing '%.255s')")); push_cleanup(got.cu_closefd, 0x2, 0x1, &fd.6104); debug(0x40, "tarobject file open size=%jd", a1->field_18, &fd.6104); fd_allocate_size(fd.6104, 0x0, a1->field_18); v3 = nfmalloc(0x21); v0 = &v4; if (buffer_copy_IntInt(*(&a0->padding_0[0]), 0x0, v3, 0x5, fd.6104, 0x2, a1->field_18) < 0) ohshit(gettext("cannot copy extracted data for '%.255s' to '%.255s': %s"), path_quote_filename(&v5, a1->field_8, 0x100, a1->field_8), path_quote_filename(&v6, 0xf3c3c990000fffdc, 0x100, 0xf3c3c990000fffdc)); a4->field_40 = v3; debug(0x40, "tarobject file hash=%s", a4->field_40, a3); tarobject_skip_padding(a0, a1); fd_writeback_init(fd.6104); case 49: varbuf_reset(&hardlinkfn.6103); varbuf_add_buf(&hardlinkfn.6103, instdir, strlen(instdir)); v2 = fsys_hash_find_node(a1->field_10, 0x0); varbuf_add_buf( &hardlinkfn.6103, *((namenodetouse(v2, a0->field_8, a0->field_8 + 192, a0->field_8) + 8)), strlen( *((namenodetouse(v2, a0->field_8, a0->field_8 + 192, a0->field_8) + 8)))); if ((v2->field_30 & 257)) varbuf_add_buf(&hardlinkfn.6103, ".dpkg-new", strlen(".dpkg-new")); varbuf_end_str(&hardlinkfn.6103); if (link(g_405120, a2)) ohshite(gettext("error creating hard link '%.255s'")); a4->field_40 = v2->field_40; debug(0x40, "tarobject hardlink hash=%s", a4->field_40, a3); break; case 50: if (symlink(a1->field_10, a2)) ohshite(gettext("error creating symbolic link '%.255s'")); debug(0x40, "tarobject symlink creating", a2, a3); break; case 51: if (mknod(a2, 0x2000, a1->field_28)) ohshite(gettext("error creating device '%.255s'")); debug(0x40, "tarobject chardev", a2, a3); break; case 52: if (mknod(a2, 0x6000, a1->field_28)) ohshite(gettext("error creating device '%.255s'")); debug(0x40, "tarobject blockdev", a2, a3); break; case 53: if (mkdir(a2, 0x0)) ohshite(gettext("error creating directory '%.255s'")); debug(0x40, "tarobject directory creating", a2, a3); break; case 54: if (mkfifo(a2, 0x0)) ohshite(gettext("error creating pipe '%.255s'")); debug(0x40, "tarobject fifo", a2, a3); break; default: do_internerr("archives.c", 0x1c3, "tarobject_extract", "unknown tar type '%d', but already checked", a1->field_4); break; } v17 = *(&v7) ^ v16[5]; return; }
dpkg
angr_dream
int read_config_file(const char *filename, struct passwd *pw, const char *host, const char *original_host, Options *options, int flags, int *want_final_pass) { int active = 1; return read_config_file_depth(filename, pw, host, original_host, options, flags, &active, want_final_pass, 0); }
long long read_config_file(unsigned int a0, unsigned long long a1, unsigned long long a2, unsigned long long a3, void *a4, unsigned long a5, unsigned int v2) { unsigned int v0; unsigned int v1; *(&v0) = *(&v2); v1 = 1; return read_config_file_depth(a0, a1, a2, a3, a4, a5, &v1, *(&v0), 0x0); }
openssh-portable
angr_sailr
static inline struct ext2_inode * EXT2_INODE(struct ext2_inode_large *large_inode) { return (struct ext2_inode *)large_inode; }
int EXT2_INODE(unsigned long a0) { return a0; }
e2fsprogs-1.46.5
angr_dream
static void free_entry(Hash_table *table, struct hash_entry *entry) { entry->data = ((void *)0); entry->next = table->free_entry_list; table->free_entry_list = entry; }
long free_entry(long a1, _QWORD *a2) { long result; *a2 = 0LL; a2[1] = *(_QWORD *)(a1 + 72); result = a1; *(_QWORD *)(a1 + 72) = a2; return result; }
gnutls
ida
static inline _Bool is_range_start_index(uintmax_t k) { return k == current_rp->lo; }
bool is_range_start_index(long a1) { return a1 == *(_QWORD *)current_rp; }
coreutils
ida
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; }
int quote_compound_array_word(char *a0, unsigned long a1) { unsigned int v0; int tmp_33; int tmp_55; int tmp_16; int tmp_38; int tmp_23; int tmp_45; unsigned int v1; unsigned int v2; unsigned int v3; unsigned int v4; char v5[3]; char *v6; char *v7; unsigned long long v9; unsigned int v10; v0 = a1; if (*(a0) != 91) { v9 = sh_single_quote(a0); return v9; } v1 = skipsubscript(a0, 0x0, 0x0); if (a0[v1] != 93) { v9 = sh_single_quote(a0); return v9; } v3 = strlen(a0); a0[v1] = 0; if (!strchr(a0 + 1, 0x1)) v10 = a0 + 1; else v10 = quote_escapes(a0 + 1); v4 = v10; *(&v5) = sh_single_quote(*(&v4)); if (*(&v4) != a0 + 1) sh_xfree(*(&v4), "arrayfunc.c", 0x3ca); a0[v1] = 93; v6 = sh_xmalloc((v3 * 4) + 5, "arrayfunc.c", 0x3cd); *(v6) = 91; if (!v5 || !v5[0]) { v10 = 0; } else if (!v5[1]) { v10 = 1; } else if (!v5[2]) { v10 = 2; } else { v10 = strlen(v5); } v2 = v10; memcpy(v6 + 1, v5, v2); sh_xfree(v5, "arrayfunc.c", 0x3d1); v2 += 1; tmp_33 = v1; v1 += 1; tmp_55 = v2; v2 += 1; *(&v10) = a0[tmp_33]; v6[tmp_55] = v10; if (a0[v1] == 43) { tmp_16 = v1; v1 += 1; tmp_38 = v2; v2 += 1; *(&v10) = a0[tmp_16]; v6[tmp_38] = v10; } tmp_23 = v1; v1 += 1; tmp_45 = v2; v2 += 1; *(&v10) = a0[tmp_23]; v6[tmp_45] = v10; if (!strchr(&a0[v1], 0x1)) v9 = &a0[v1]; else v9 = quote_escapes(&a0[v1]); v4 = v9; v7 = sh_single_quote(v4); if (v4 != &a0[v1]) sh_xfree(v4, "arrayfunc.c", 0x3da); strcpy(&v6[v2], v7); *(&v9) = v6; return v9; }
bash
angr_sailr
static inline int ila_csum_name2mode(char *name) { if (strcmp(name, "adj-transport") == 0) return ILA_CSUM_ADJUST_TRANSPORT; else if (strcmp(name, "neutral-map") == 0) return ILA_CSUM_NEUTRAL_MAP; else if (strcmp(name, "neutral-map-auto") == 0) return ILA_CSUM_NEUTRAL_MAP_AUTO; else if (strcmp(name, "no-action") == 0) return ILA_CSUM_NO_ACTION; else if (strcmp(name, "neutral-map-auto") == 0) return ILA_CSUM_NEUTRAL_MAP_AUTO; else return -1; }
int ila_csum_name2mode(char *a0) { unsigned int v1; v1 = strcmp(a0, "adj-transport"); if (!v1) { v1 = 0; } else { v1 = strcmp(a0, "neutral-map"); if (!v1) { v1 = 1; } else { v1 = strcmp(a0, "neutral-map-auto"); if (!v1) { v1 = 3; } else { v1 = strcmp(a0, "no-action"); if (!v1) { v1 = 2; } else { v1 = strcmp(a0, "neutral-map-auto"); if (!v1) v1 = 3; else v1 = -1; } } } } return v1; }
iproute2-6.0.0
angr_dream
SHELL_VAR *set_if_not(name, value) char *name, *value; { SHELL_VAR *v; if (shell_variables == 0) create_variable_tables(); v = find_variable(name); if (v == 0) v = bind_variable_internal(name, value, global_variables->table, 0x01, 0); return (v); }
int set_if_not(unsigned long long a0, unsigned long long a1) { unsigned long v0; if (!shell_variables) create_variable_tables(); v0 = find_variable(a0); if (!v0) v0 = bind_variable_internal(a0, a1, *((global_variables + 32)), 0x1, 0x0); return v0; }
bash
angr_dream
) { fprintf(stderr, "Could not open %s\n", dh_params_file); exit(1); }
int fprintf(FILE *__stream, char *__format, ...) { halt_baddata(); }
gnutls
ghidra
int option_clear_or_none(const char *o) { return o == ((void *)0) || strcasecmp(o, "none") == 0; }
undefined8 option_clear_or_none(char *param_1) { int iVar1; if ((param_1 != (char *)0x0) && (iVar1 = strcasecmp(param_1, "none"), iVar1 != 0)) { return 0; } return 1; }
openssh-portable
ghidra
static int netns_filter_req(struct nlmsghdr *nlh, int reqlen) { int err; if (filter.target_nsid >= 0) { err = addattr32(nlh, reqlen, NETNSA_TARGET_NSID, filter.target_nsid); if (err) return err; } return 0; }
long netns_filter_req(long a1, unsigned int a2) { unsigned int v3; if (dword_2E68 >= 0 && (v3 = addattr32(a1, a2, 4LL, (unsigned int)dword_2E68)) != 0) return v3; else return 0LL; }
iproute2-6.0.0
ida
static int deserialise_nullable_string(struct sshbuf *m, char **sp) { int r; u_char flag; *sp = ((void *)0); if ((r = sshbuf_get_u8(m, &flag)) != 0 || (r = sshbuf_get_cstring(m, flag ? ((void *)0) : sp, ((void *)0))) != 0) return r; return 0; }
int deserialise_nullable_string(unsigned long long a0, unsigned long a1) { char v0; unsigned long long v1; unsigned long v3; *(a1) = 0; *(&v1) = sshbuf_get_u8(a0, &v0, &v0); if (!v1) { if (!v0) v3 = a1; else v3 = 0; *(&v1) = sshbuf_get_cstring(a0, v3, 0x0, a0); if (!v1) *(&v3) = 0; } if (v1 || v1) *(&v3) = v1; return v3; }
openssh-portable
angr_dream
int session_input_channel_req(struct ssh *ssh, Channel *c, const char *rtype) { int success = 0; Session *s; if ((s = session_by_channel(c->self)) == ((void *)0)) { sshlog("session.c", __func__, 2204, 1, SYSLOG_LEVEL_INFO, ((void *)0), "no session %d req %.100s", c->self, rtype); return 0; } sshlog("session.c", __func__, 2207, 1, SYSLOG_LEVEL_DEBUG1, ((void *)0), "session %d req %s", s->self, rtype); if (c->type == 10) { if (strcmp(rtype, "shell") == 0) { success = session_shell_req(ssh, s); } else if (strcmp(rtype, "exec") == 0) { success = session_exec_req(ssh, s); } else if (strcmp(rtype, "pty-req") == 0) { success = session_pty_req(ssh, s); } else if (strcmp(rtype, "x11-req") == 0) { success = session_x11_req(ssh, s); } else if (strcmp(rtype, "auth-agent-req@openssh.com") == 0) { success = session_auth_agent_req(ssh, s); } else if (strcmp(rtype, "subsystem") == 0) { success = session_subsystem_req(ssh, s); } else if (strcmp(rtype, "env") == 0) { success = session_env_req(ssh, s); } } if (strcmp(rtype, "window-change") == 0) { success = session_window_change_req(ssh, s); } else if (strcmp(rtype, "break") == 0) { success = session_break_req(ssh, s); } else if (strcmp(rtype, "signal") == 0) { success = session_signal_req(ssh, s); } return success; }
long long session_input_channel_req(unsigned long long a0, unsigned int a1[2], unsigned long a2) { unsigned long long v0; unsigned long v1; unsigned long v2; unsigned int v3; struct_0 *v4; void *v6; v3 = 0; v4 = session_by_channel(a1[1]); if (!v4) { v2 = a2; v1 = a1[1]; v0 = "no session %d req %.100s"; sshlog("session.c", "session_input_channel_req", 0x89c, 0x1, 0x3, 0x0); v6 = 0; } else { v2 = a2; v1 = v4->field_4; v0 = "session %d req %s"; sshlog("session.c", "session_input_channel_req", 0x89f, 0x1, 0x5, 0x0); if (a1[0] == 10) { if (!strcmp(a2, "shell")) { v3 = session_shell_req(a0, v4); } else if (!strcmp(a2, "exec")) { v3 = session_exec_req(a0, v4); } else if (!strcmp(a2, "pty-req")) { v3 = session_pty_req(a0, v4); } else if (!strcmp(a2, "x11-req")) { v3 = session_x11_req(a0, v4); } else if (!strcmp(a2, "auth-agent-req@openssh.com")) { v3 = session_auth_agent_req(a0, v4, v4, 0x1, 0x5, 0x0); } else if (!strcmp(a2, "subsystem")) { v3 = session_subsystem_req(a0, v4); } else if (!strcmp(a2, "env")) { v3 = session_env_req(a0, v4); } } if (!strcmp(a2, "window-change")) { v3 = session_window_change_req(a0, v4); } else if (!strcmp(a2, "break")) { v3 = session_break_req(a0, v4, v4); } else if (!strcmp(a2, "signal")) { v3 = session_signal_req(a0, v4); } v6 = v3; } return v6; }
openssh-portable
angr_dream
static void zero_pad(UINT8 *p, int nbytes) { if (nbytes >= (int)sizeof(UWORD)) { while ((ptrdiff_t)p % sizeof(UWORD)) { *p = 0; nbytes--; p++; } while (nbytes >= (int)sizeof(UWORD)) { *(UWORD *)p = 0; nbytes -= sizeof(UWORD); p += sizeof(UWORD); } } while (nbytes) { *p = 0; nbytes--; p++; } }
int zero_pad(_BYTE *a1, int a2) { int result; int v3; v3 = a2; if (a2 > 3) { while (1) { result = (unsigned char)a1 & 3; if (((unsigned char)a1 & 3) == 0) break; *a1 = 0; --v3; ++a1; } while (v3 > 3) { *(_DWORD *)a1 = 0; result = v3 - 4; v3 -= 4; a1 += 4; } } while (v3) { *a1 = 0; result = --v3; ++a1; } return result; }
openssh-portable
ida
void format_absolute_time(uint64_t t, char *buf, size_t len) { time_t tt = t > 0x7fffffffffffffffLL ? 0x7fffffffffffffffLL : t; struct tm tm; localtime_r(&tt, &tm); strftime(buf, len, "%Y-%m-%dT%H:%M:%S", &tm); }
long long format_absolute_time(unsigned long a0, char *a1, unsigned int a2) { unsigned long v0; char v1; *(&v0) = (a0 < 0 ? a0 : 9223372036854775807); localtime_r(&v0, &v1); strftime(a1, a2, "%Y-%", &v1); return 0; }
openssh-portable
angr_sailr
void donologin(int min) { FILE *fp; time_t t; time(&t); t += 60 * min; if ((fp = fopen("/etc/nologin", "w")) != ((void *)0)) { fprintf(fp, "\rThe system is going down on %s\r\n", ctime(&t)); if (message[0]) fputs(message, fp); fclose(fp); } }
void donologin(unsigned long a0) { char v0; void *v1; char v2; unsigned long long *v4; unsigned long long v5; time(&v0); v0 = *(&v0) + a0 * 60; v1 = fopen("/etc/nologin", "w"); if (v1) { fprintf(v1, "\rThe system is going down on %s\r\n", ctime(&v0)); fputs(&newstate, v1); fclose(v1); } v5 = *(&v2) ^ v4[5]; return; }
sysvinit
angr_sailr
void rl_deactivate_mark(void) { mark_active = 0; }
void rl_deactivate_mark() { mark_active = 0; }
bash
ida
(r = sshbuf_put_cstring(b, alg)) != 0 || (r = sshkey_puts(id->key, b)) != 0) { sshfatal("sshconnect2.c", __func__, 1452, 1, SYSLOG_LEVEL_FATAL, ssh_err(r), "assemble signed data"); }
void sshbuf_put_cstring(void) { halt_baddata(); }
openssh-portable
ghidra
static void print_tunnel(const struct l2tp_data *data) { const struct l2tp_parm *p = &data->config; char buf[46]; open_json_object(((void *)0)); print_uint(PRINT_ANY, "tunnel_id", "Tunnel %u,", p->tunnel_id); print_string(PRINT_ANY, "encap", " encap %s", p->encap == L2TP_ENCAPTYPE_UDP ? "UDP" : p->encap == L2TP_ENCAPTYPE_IP ? "IP" : "??"); print_nl(); print_string( PRINT_ANY, "local", " From %s ", inet_ntop(p->local_ip.family, p->local_ip.data, buf, sizeof(buf))); print_string(PRINT_ANY, "peer", "to %s", inet_ntop(p->peer_ip.family, p->peer_ip.data, buf, sizeof(buf))); print_nl(); print_uint(PRINT_ANY, "peer_tunnel", " Peer tunnel %u", p->peer_tunnel_id); print_nl(); if (p->encap == L2TP_ENCAPTYPE_UDP) { print_string(PRINT_FP, ((void *)0), " UDP source / dest ports:", ((void *)0)); print_hu(PRINT_ANY, "local_port", " %hu", p->local_udp_port); print_hu(PRINT_ANY, "peer_port", "/%hu", p->peer_udp_port); print_nl(); switch (p->local_ip.family) { case 2: print_bool(PRINT_JSON, "checksum", ((void *)0), p->udp_csum); print_string(PRINT_FP, ((void *)0), " UDP checksum: %s\n", p->udp_csum ? "enabled" : "disabled"); break; case 10: if (is_json_context()) { print_bool(PRINT_JSON, "checksum_tx", ((void *)0), p->udp6_csum_tx); print_bool(PRINT_JSON, "checksum_rx", ((void *)0), p->udp6_csum_rx); } else { printf(" UDP checksum: %s%s%s%s\n", p->udp6_csum_tx && p->udp6_csum_rx ? "enabled" : "", p->udp6_csum_tx && !p->udp6_csum_rx ? "tx" : "", !p->udp6_csum_tx && p->udp6_csum_rx ? "rx" : "", !p->udp6_csum_tx && !p->udp6_csum_rx ? "disabled" : ""); } break; } } close_json_object(); }
void print_tunnel(struct_0 *a0, unsigned int a1, unsigned int a2, unsigned long long a3, unsigned long long a4, unsigned long long a5) { char v0; char v1; unsigned long long v3; unsigned int v4; unsigned long long v5; unsigned int v6; unsigned long long *v7; unsigned long long v8; open_json_object(0x0); print_uint(0x4, "tunnel_id", "Tunnel %u,", a0->field_0); if (!a0->field_10) { v3 = "UDP"; } else if (a0->field_10 == 1) { v3 = "IP"; } else { v3 = "??"; } print_string(0x4, "encap", " encap %s", v3); print_nl(0x4, "encap", " encap %s", a3, a4, a5); print_string(0x4, "local", " From %s ", inet_ntop(a0->field_36, &a0->padding_38, &v0, 0x2e)); print_string(0x4, "peer", "to %s", inet_ntop(a0->field_13e, &a0->padding_140, &v0, 0x2e)); print_nl(0x4, "peer", "to %s", a3, a4, a5); print_uint(0x4, "peer_tunnel", " Peer tunnel %u", a0->field_4); print_nl(0x4, "peer_tunnel", " Peer tunnel %u", a3, a4, a5); if (!a0->field_10) { print_string(0x1, 0x0, " UDP source / dest ports:", 0x0); print_hu(0x4, "local_port", " %hu", a0->field_14); print_hu(0x4, "peer_port", "/%hu", a0->field_16); print_nl(0x4, "peer_port", "/%hu", a3, a4, a5); if (a0->field_36 == 2) { print_bool(0x2, "checksum", 0x0, (a0->field_242 & 4)); if ((a0->field_242 & 4)) v5 = "enabled"; else v5 = "disabled"; print_string(0x1, 0x0, " UDP checksum: %s\n", v5); } else if (a0->field_36 == 10) { v4 = is_json_context(); if (v4) { print_bool(0x2, "checksum_tx", 0x0, (a0->field_242 & 1)); print_bool(0x2, "checksum_rx", 0x0, (a0->field_242 & 2)); } else { if (!(a0->field_242 & 1) && !(a0->field_242 & 2)) a1 = "disabled"; if ((a0->field_242 & 1) || (a0->field_242 & 2)) a1 = &g_402f11; if (!(a0->field_242 & 1) && (a0->field_242 & 2)) v6 = &g_402f12; if (!(a0->field_242 & 2) || (a0->field_242 & 1)) v6 = &g_402f11; if ((a0->field_242 & 1) && !(a0->field_242 & 2)) a2 = &g_402f15; if (!(a0->field_242 & 1) || (a0->field_242 & 2)) a2 = &g_402f11; if ((a0->field_242 & 1) && (a0->field_242 & 2)) v4 = "enabled"; if (!(a0->field_242 & 1) || !(a0->field_242 & 2)) v4 = &g_402f11; printf(" UDP checksum: %s%s%s%s\n", v4, a2, v6, a1); } } } close_json_object(); v8 = *(&v1) ^ v7[5]; return; }
iproute2-6.0.0
angr_dream
static char *xmalloc(bytes) int bytes; { char *temp = (char *)malloc(bytes); if (!temp) memory_error_and_abort(); return (temp); }
int xmalloc(unsigned long a0) { unsigned long v0; v0 = malloc(a0); if (!v0) memory_error_and_abort(); return v0; }
bash
angr_sailr
static void transitional_interest_callback_ro(const char *trig, struct pkginfo *pkg, struct pkgbin *pkgbin, enum trig_options opts) { struct pkginfo *pend = pkg; struct pkgbin *pendbin = pkgbin; debug(dbg_triggersdetail, "trig_transitional_interest_callback trig=%s pend=%s", trig, pkgbin_name(pend, pendbin, pnaw_always)); if (pend->status >= PKG_STAT_TRIGGERSAWAITED) trig_note_pend(pend, nfstrsave(trig)); }
long transitional_interest_callback_ro(const char *a1, long a2, long a3) { const char *v3; long result; long v5; v3 = (const char *)pkgbin_name(a2, a3, 3LL); debug(0x2000LL, "trig_transitional_interest_callback trig=%s pend=%s", a1, v3); result = *(unsigned int *)(a2 + 24); if ((unsigned int)result > 4) { v5 = nfstrsave(a1); return trig_note_pend(a2, v5); } return result; }
dpkg
ida
static int check_if_fs_cluster(e2fsck_t ctx, blk64_t cluster) { ext2_filsys fs = ctx->fs; blk64_t first_block; dgrp_t i; first_block = fs->super->s_first_data_block; for (i = 0; i < fs->group_desc_count; i++) { if (ext2fs_bg_has_super(fs, i)) { if (cluster >= ((first_block) >> (fs)->cluster_ratio_bits) && (cluster <= ((first_block + fs->desc_blocks) >> (fs)->cluster_ratio_bits))) return 1; } if ((ext2fs_inode_table_loc(fs, i)) && (cluster >= ((ext2fs_inode_table_loc(fs, i)) >> (fs)->cluster_ratio_bits)) && (cluster <= ((ext2fs_inode_table_loc(fs, i) + fs->inode_blocks_per_group - 1) >> (fs)->cluster_ratio_bits) )) return 1; if ((cluster == ((ext2fs_block_bitmap_loc(fs, i)) >> (fs)->cluster_ratio_bits)) || (cluster == ((ext2fs_inode_bitmap_loc(fs, i)) >> (fs)->cluster_ratio_bits))) return 1; first_block += fs->super->s_blocks_per_group; } return 0; }
int check_if_fs_cluster(unsigned long long *a0, unsigned long a1) { unsigned int v0; unsigned long v1; struct_0 *v2; unsigned int v4; unsigned long long v5; unsigned long long v6; v2 = *(a0); v1 = v2->field_20->field_14; v0 = 0; while (true) { if (v0 < v2->field_30) { v4 = ext2fs_bg_has_super(v2, v0, v0); if (v4 && a1 >= v1 >> (v2->field_c0 & 63) && a1 <= v2->field_38 + v1 >> (v2->field_c0 & 63)) { v4 = 1; break; } if (!v4 || a1 < v1 >> (v2->field_c0 & 63) || a1 > v2->field_38 + v1 >> (v2->field_c0 & 63)) { v5 = ext2fs_inode_table_loc(v2, v0, v0); if (v5) { v6 = ext2fs_inode_table_loc(v2, v0, v0); if (a1 >= v6 >> (v2->field_c0 & 63)) { v4 = ext2fs_inode_table_loc(v2, v0, v0); if (a1 <= v4 + v2->field_48 - 1 >> (v2->field_c0 & 63)) { v4 = 1; break; } } } if (a1 < v6 >> (v2->field_c0 & 63) || !v5 || a1 > v4 + v2->field_48 - 1 >> (v2->field_c0 & 63)) { v4 = ext2fs_block_bitmap_loc(v2, v0, v0); if (a1 != v4 >> (v2->field_c0 & 63)) { v4 = ext2fs_inode_bitmap_loc(v2, v0, v0); if (a1 != v4 >> (v2->field_c0 & 63)) { v1 += v2->field_20->field_20; v0 += 1; continue; } } if (a1 == v4 >> (v2->field_c0 & 63) || a1 == v4 >> (v2->field_c0 & 63)) { v4 = 1; break; } } } } else { v4 = 0; break; } } return v4; }
e2fsprogs-1.46.5
angr_dream
int sshkey_shield_private(struct sshkey *k) { struct sshbuf *prvbuf = ((void *)0); u_char *prekey = ((void *)0), *enc = ((void *)0), keyiv[64]; struct sshcipher_ctx *cctx = ((void *)0); const struct sshcipher *cipher; size_t i, enclen = 0; struct sshkey *kswap = ((void *)0), tmp; int r = -1; if ((cipher = cipher_by_name("aes256-ctr")) == ((void *)0)) { r = -10; goto out; } if (cipher_keylen(cipher) + cipher_ivlen(cipher) > ssh_digest_bytes(4)) { r = -1; goto out; } if ((prekey = malloc((16 * 1024))) == ((void *)0)) { r = -2; goto out; } arc4random_buf(prekey, (16 * 1024)); if ((r = ssh_digest_memory(4, prekey, (16 * 1024), keyiv, 64)) != 0) goto out; if ((r = cipher_init(&cctx, cipher, keyiv, cipher_keylen(cipher), keyiv + cipher_keylen(cipher), cipher_ivlen(cipher), 1)) != 0) goto out; if ((prvbuf = sshbuf_new()) == ((void *)0)) { r = -2; goto out; } if (sshkey_is_shielded(k) && (r = sshkey_unshield_private(k)) != 0) goto out; if ((r = sshkey_private_serialize_opt(k, prvbuf, SSHKEY_SERIALIZE_SHIELD)) != 0) goto out; i = 0; while (sshbuf_len(prvbuf) % cipher_blocksize(cipher)) { if ((r = sshbuf_put_u8(prvbuf, ++i & 0xff)) != 0) goto out; } enclen = sshbuf_len(prvbuf); if ((enc = malloc(enclen)) == ((void *)0)) { r = -2; goto out; } if ((r = cipher_crypt(cctx, 0, enc, sshbuf_ptr(prvbuf), sshbuf_len(prvbuf), 0, 0)) != 0) goto out; if ((r = sshkey_from_private(k, &kswap)) != 0) goto out; tmp = *kswap; *kswap = *k; *k = tmp; k->shielded_private = enc; k->shielded_len = enclen; k->shield_prekey = prekey; k->shield_prekey_len = (16 * 1024); enc = prekey = ((void *)0); enclen = 0; k->sk_flags = kswap->sk_flags; r = 0; out: cipher_free(cctx); explicit_bzero(keyiv, sizeof(keyiv)); explicit_bzero(&tmp, sizeof(tmp)); freezero(enc, enclen); freezero(prekey, (16 * 1024)); sshkey_free(kswap); sshbuf_free(prvbuf); return r; }
int sshkey_shield_private(struct_0 *a0) { unsigned long long v0; int tmp_215; int tmp_225; int tmp_237; int tmp_249; int tmp_261; int tmp_273; int tmp_285; int tmp_297; int tmp_75; struct_0 *v1; unsigned int v2; void *v3; void *v4; void *v5; void *v6; void *v7; void *v8; void *v9; unsigned long long v10; unsigned long v11; unsigned long v12; unsigned long v13; unsigned long v14; unsigned long v15; unsigned long v16; unsigned long v17; unsigned long v18; unsigned long v19; unsigned long v20; unsigned long v21; unsigned long v22; unsigned long v23; unsigned long v24; unsigned long v25; unsigned long v26; unsigned long v27; unsigned long v28; unsigned long v29; unsigned long v30; unsigned long v31; char v32; unsigned long long v35; void *v36; struct_0 *v37; unsigned long long v38; v1 = a0; v5 = 0; v6 = 0; v7 = 0; v3 = 0; v9 = 0; v4 = 0; v2 = -1; v10 = cipher_by_name("aes256-ctr"); if (!v10) { v2 = -10; } else if (cipher_ivlen(v10) + cipher_keylen(v10) > ssh_digest_bytes(0x4)) { v2 = -1; } else { v6 = malloc(0x4000); if (!v6) { v2 = -2; } else { arc4random_buf(v6, 0x4000); v2 = ssh_digest_memory(0x4, v6, 0x4000, &v32, 0x40); if (!v2) { v35 = &(&v32)[cipher_keylen(v10)]; v0 = 1; v2 = cipher_init(&v3, v10, &v32, cipher_keylen(v10), v35, cipher_ivlen(v10)); if (!v2) { v5 = sshbuf_new(); if (!v5) { v2 = -2; } else if (!sshkey_is_shielded(a0) || (v2 = sshkey_unshield_private(a0), !v2)) { v2 = sshkey_private_serialize_opt(a0, v5, 0x3, v5); if (!v2) { v8 = 0; do { if (!(0 CONCAT sshbuf_len(v5)) / m cipher_blocksize(v10) >> 64) { v9 = sshbuf_len(v5); v7 = malloc(v9); if (!v7) { v2 = -2; break; } else { v0 = 0; v2 = cipher_crypt(v3, 0x0, v7, sshbuf_ptr(v5), sshbuf_len(v5), 0x0); if (!v2) { v2 = sshkey_from_private(a0, &v4); if (!v2) { v11 = *(v4); v12 = v4[8]; v13 = v4[16]; v14 = v4[24]; v15 = v4[32]; v16 = v4[40]; v17 = v4[48]; v18 = v4[56]; v19 = v4[64]; v20 = v4[72]; v21 = v4[80]; v22 = v4[88]; v23 = v4[96]; v24 = v4[104]; v25 = v4[112]; v26 = v4[120]; v27 = v4[128]; v28 = v4[136]; v29 = v4[144]; v30 = v4[152]; v31 = v4[160]; v36 = v4; v37 = a0; tmp_215 = a0->field_8; *(v4) = a0->field_0; *(&v4[8]) = tmp_215; tmp_225 = a0->field_18; *(&v4[16]) = a0->field_10; *(&v4[24]) = tmp_225; tmp_237 = a0->field_28; *(&v4[32]) = a0->field_20; *(&v4[40]) = tmp_237; tmp_249 = a0->field_38; *(&v4[48]) = a0->field_30; *(&v4[56]) = tmp_249; tmp_261 = a0->field_48; *(&v4[64]) = a0->field_40; *(&v4[72]) = tmp_261; tmp_273 = a0->field_58; *(&v4[80]) = a0->field_50; *(&v4[88]) = tmp_273; tmp_285 = *(&a0->field_68); *(&v4[96]) = a0->field_60; *(&v4[104]) = tmp_285; tmp_297 = a0->field_78; *(&v4[112]) = a0->field_70; *(&v4[120]) = tmp_297; v38 = a0->field_88; *(&v36[128]) = a0->field_80; *(&v36[136]) = v38; tmp_75 = v37->field_98; *(&v36[144]) = v37->field_90; *(&v36[152]) = tmp_75; *(&v36[160]) = v37->field_a0; a0->field_0 = v11; a0->field_8 = v12; a0->field_10 = v13; a0->field_18 = v14; a0->field_20 = v15; a0->field_28 = v16; a0->field_30 = v17; a0->field_38 = v18; a0->field_40 = v19; a0->field_48 = v20; a0->field_50 = v21; a0->field_58 = v22; a0->field_60 = v23; *(&a0->field_68) = v24; a0->field_70 = v25; a0->field_78 = v26; a0->field_80 = v27; a0->field_88 = v28; a0->field_90 = v29; a0->field_98 = v30; a0->field_a0 = v31; a0->field_88 = v7; a0->field_90 = v9; a0->field_98 = v6; a0->field_a0 = 0x4000; v6 = 0; v7 = v6; v9 = 0; a0->field_68 = v4[104]; v2 = 0; break; } } } } } while ((v8 += 1, v2 = sshbuf_put_u8(v5, v8, v8), !v2)); } } } } } } cipher_free(v3); explicit_bzero(&v32, 0x40); explicit_bzero(&v11, 0xa8); freezero(v7, v9); freezero(v6, 0x4000); sshkey_free(v4); sshbuf_free(v5); return v2; }
openssh-portable
angr_sailr
static void sort_found_occurs(void) { if (number_of_occurs[0]) qsort(occurs_table[0], number_of_occurs[0], sizeof **occurs_table, compare_occurs); }
void sort_found_occurs() { unsigned long long v1; unsigned long long v2; v1 = number_of_occurs; if (number_of_occurs) v2 = qsort(occurs_table, number_of_occurs, 0x30, compare_occurs); return; }
coreutils
angr_sailr
int rl_beginning_of_history(int count, int key) { return (rl_get_previous_history(1 + where_history(), key)); }
void rl_beginning_of_history(unsigned long a0, unsigned long a1) { unsigned int v0; unsigned long long v2; v0 = a0; v2 = rl_get_previous_history(where_history() + 1, a1); return; }
bash
angr_dream
static void poplocalvars(void) { struct localvar_list *ll; struct localvar *lvp, *next; struct var *vp; ({ suppressint++; ({ __asm__ __volatile__("" : : : "memory"); }); 0; }); ll = localvar_stack; localvar_stack = ll->next; next = ll->lv; free((pointer)(ll)); while ((lvp = next) != ((void *)0)) { next = lvp->next; vp = lvp->vp; ; if (vp == ((void *)0)) { memcpy(optlist, lvp->text, sizeof(optlist)); free((pointer)(lvp->text)); optschanged(); } else if (lvp->flags == 0x20) { vp->flags &= ~(0x04 | 0x02); unsetvar(vp->text); } else { if (vp->func) (*vp->func)(strchrnul(lvp->text, '=') + 1); if ((vp->flags & (0x08 | 0x10)) == 0) free((pointer)(vp->text)); vp->flags = lvp->flags; vp->text = lvp->text; } free((pointer)(lvp)); } ({ ({ __asm__ __volatile__("" : : : "memory"); }); if (--suppressint == 0 && intpending) onint(); 0; }); }
long poplocalvars() { void (*v0)(char *); char *v1; long result; _QWORD *v3; _QWORD *ptr; void *v5; long v6; ++suppressint; ptr = (_QWORD *)localvar_stack; localvar_stack = *(_QWORD *)localvar_stack; v3 = (_QWORD *)ptr[1]; free(ptr); while (1) { v5 = v3; if (!v3) break; v3 = (_QWORD *)*v3; v6 = *((_QWORD *)v5 + 1); if (v6) { if (*((_DWORD *)v5 + 4) == 32) { *(_DWORD *)(v6 + 8) &= 0xFFFFFFF9; unsetvar(*(char **)(v6 + 16)); } else { if (*(_QWORD *)(v6 + 24)) { v0 = *(void (**)(char *))(v6 + 24); v1 = strchrnul(*((const char **)v5 + 3), 61); v0(v1 + 1); } if ((*(_DWORD *)(v6 + 8) & 0x18) == 0) free(*(void **)(v6 + 16)); *(_DWORD *)(v6 + 8) = *((_DWORD *)v5 + 4); *(_QWORD *)(v6 + 16) = *((_QWORD *)v5 + 3); } } else { memcpy(optlist, *((const void **)v5 + 3), 0x11uLL); free(*((void **)v5 + 3)); optschanged(); } free(v5); } --suppressint; result = suppressint; if (!suppressint) { result = intpending; if (intpending) return onint(); } return result; }
dash-0.5.11+git20210903+057cd650a4ed
ida
int consolenames(struct real_cons *cons, int max_consoles) { unsigned int kdev; struct stat st, st2; char buf[4096]; char *p; int didmount = 0; int n; int fd; int considx, num_consoles = 0; stat("/", &st); if (stat("/proc", &st2) < 0) { perror("bootlogd: /proc"); return 0; } if (st.st_dev == st2.st_dev) { if (mount("proc", "/proc", "proc", 0, ((void *)0)) < 0) { perror("bootlogd: mount /proc"); return -1; } didmount = 1; } n = -1; if ((fd = open("/proc/cmdline", 00)) < 0) { perror("bootlogd: /proc/cmdline"); } else { buf[0] = 0; if ((n = read(fd, buf, 4096 - 1)) < 0) perror("bootlogd: /proc/cmdline"); close(fd); } if (didmount) umount("/proc"); if (n < 0) return 0; p = buf + n; *p-- = 0; while (p >= buf) { if (*p == ' ' || *p == '\t' || *p == '\r' || *p == '\n') { *p-- = 0; continue; } if (strncmp(p, "console=", 8) == 0 && isconsole(p + 8, cons[num_consoles].name, sizeof(cons[num_consoles].name))) { for (considx = 0; considx < num_consoles; considx++) { if (!strcmp(cons[num_consoles].name, cons[considx].name)) { goto dontuse; } } num_consoles++; if (num_consoles >= max_consoles) { break; } } dontuse: p--; } if (num_consoles > 0) return num_consoles; fstat(0, &st); if (gnu_dev_major(st.st_rdev) != 5 || gnu_dev_minor(st.st_rdev) != 1) { int r = findtty(cons[num_consoles].name, "/dev", sizeof(cons[num_consoles].name), st.st_rdev); if (!r) num_consoles++; } if (num_consoles > 0) return num_consoles; if (ioctl(0, (((2U) << (((0 + 8) + 8) + 14)) | ((('T')) << (0 + 8)) | (((0x32)) << 0) | ((((sizeof(unsigned int)))) << ((0 + 8) + 8))), &kdev) == 0) { int r = findtty(cons[num_consoles].name, "/dev", sizeof(cons[num_consoles].name), (dev_t)kdev); if (!r) num_consoles++; } if (num_consoles > 0) return num_consoles; for (n = 0; defcons[n]; n++) if (isconsole(defcons[n], cons[0].name, sizeof(cons[0].name))) return 1; fprintf(stderr, "bootlogd: cannot deduce real console device\n"); return 0; }
int consolenames(char *a0, unsigned long a1) { int tmp_24; char v0; unsigned int v1; unsigned int v2; unsigned int v3; unsigned int v4; unsigned int v5; unsigned int v6; unsigned int v7; char *v8; char v9; char v10; char v11; char v12; char v13; unsigned short v15; unsigned int v16; v13 = *(&v13); v1 = 0; v4 = 0; stat("/", &v9); if (stat("/proc", &v11) < 0) { perror("bootlogd: /proc"); v16 = 0; return v16; } v15 = *(&v9); if (*(&v9) == *(&v11)) { if (mount("proc", "/proc", "proc", 0x0, NULL) >= 0) { v1 = 1; } else { perror("bootlogd: mount /proc"); v16 = -1; return v16; } } v2 = -1; v5 = open("/proc/cmdline", 0x0, v15); if (v5 >= 0) { v12 = 0; v2 = read(v5, &v12, 0xfff); if (v2 < 0) perror("bootlogd: /proc/cmdline"); close(v5); } else { perror("bootlogd: /proc/cmdline"); } if (v1) umount("/proc"); if (v2 < 0) { v16 = 0; return v16; } v8 = &(&v12)[v2]; tmp_24 = v8; v8 += 1; *(tmp_24) = 0; while (true) { if (v8 < &v12) { LABEL_400a5a: if (v4 > 0) { *(&v16) = v4; return v16; } fstat(0x0, &v9); break; } else { switch (*(v8)) { case 9: case 10: case 13: case 32: v16 = v8; v8 += 1; *(v16) = 0; continue; default: if (!strncmp(v8, "console=", 0x8) && isconsole(v8 + 8, &a0[0x400 * v4 + 4 * v4], 0x400)) { v3 = 0; while (true) { if (v3 >= v4) { v4 += 1; if (v4 < a1) break; } else { if (!strcmp(&a0[0x400 * v4 + 4 * v4], &a0[0x400 * v3 + 4 * v3])) goto LABEL_0x400a3a; v3 += 1; } } goto LABEL_400a5a; } v8 += 1; break; } } } if (gnu_dev_major(*(&v10)) != 5 || gnu_dev_minor(*(&v10)) != 1) { v6 = findtty(&a0[1028 * v4], "/dev", 0x400, *(&v10)); if (!v6) v4 += 1; } if (v4 > 0) { *(&v16) = v4; return v16; } if (!ioctl(0x0, 0x80045432)) { v7 = findtty(&a0[1028 * v4], "/dev", 0x400, *(&v0)); if (!v7) v4 += 1; } if (v4 > 0) { *(&v16) = v4; return v16; } for (v2 = 0; defcons[v2]; v2 += 1) { if (isconsole(defcons[v2], a0, 0x400)) { *(&v16) = 1; return v16; } } fprintf(stderr, "bootlogd: cannot deduce real console device\n"); *(&v16) = 0; return v16; }
sysvinit
angr_sailr
static int handle_kmod_compat_commands(int argc, char *argv[]) { const char *cmd; size_t i; cmd = basename(argv[0]); for (i = 0; i < (sizeof(kmod_compat_cmds) / sizeof((kmod_compat_cmds)[0]) + ({ _Static_assert((!__builtin_types_compatible_p(typeof(kmod_compat_cmds), typeof(&(kmod_compat_cmds)[0]))), "!__builtin_types_compatible_p(typeof(kmod_compat_cmds), typeof(&(kmod_compat_cmds)[0]))"); 0; })); i++) { if ((strcmp((kmod_compat_cmds[i]->name), (cmd)) == 0)) return kmod_compat_cmds[i]->cmd(argc, argv); } return -2; }
long handle_kmod_compat_commands(unsigned int a1, const char **a2) { unsigned long i; const char *s2; s2 = basename(*a2); for (i = 0LL; i <= 5; ++i) { if (!strcmp(*(const char **)*(&kmod_compat_cmds + i), s2)) return (*((long (**)(_QWORD, const char **)) * (&kmod_compat_cmds + i) + 1))(a1, a2); } return 4294967294LL; }
kmod
ida
static void close_files(void) { if (is_shadow_pwd) { if (spw_close() == 0) { fprintf(stderr, gettext("%s: failure while writing changes to %s\n"), Prog, spw_dbname()); do { char *old_locale = setlocale(6, ((void *)0)); char *saved_locale = ((void *)0); if (((void *)0) != old_locale) { saved_locale = strdup(old_locale); } if (((void *)0) != saved_locale) { (void)setlocale(6, "C"); } syslog(3, "failure while writing changes to %s", spw_dbname()); if (((void *)0) != saved_locale) { (void)setlocale(6, saved_locale); free(saved_locale); } } while (0); fail_exit(1); } if (spw_unlock() == 0) { fprintf(stderr, gettext("%s: failed to unlock %s\n"), Prog, spw_dbname()); do { char *old_locale = setlocale(6, ((void *)0)); char *saved_locale = ((void *)0); if (((void *)0) != old_locale) { saved_locale = strdup(old_locale); } if (((void *)0) != saved_locale) { (void)setlocale(6, "C"); } syslog(3, "failed to unlock %s", spw_dbname()); if (((void *)0) != saved_locale) { (void)setlocale(6, saved_locale); free(saved_locale); } } while (0); } spw_locked = 0; } if (pw_close() == 0) { fprintf(stderr, gettext("%s: failure while writing changes to %s\n"), Prog, pw_dbname()); do { char *old_locale = setlocale(6, ((void *)0)); char *saved_locale = ((void *)0); if (((void *)0) != old_locale) { saved_locale = strdup(old_locale); } if (((void *)0) != saved_locale) { (void)setlocale(6, "C"); } syslog(3, "failure while writing changes to %s", pw_dbname()); if (((void *)0) != saved_locale) { (void)setlocale(6, saved_locale); free(saved_locale); } } while (0); fail_exit(1); } if (pw_unlock() == 0) { fprintf(stderr, gettext("%s: failed to unlock %s\n"), Prog, pw_dbname()); do { char *old_locale = setlocale(6, ((void *)0)); char *saved_locale = ((void *)0); if (((void *)0) != old_locale) { saved_locale = strdup(old_locale); } if (((void *)0) != saved_locale) { (void)setlocale(6, "C"); } syslog(3, "failed to unlock %s", pw_dbname()); if (((void *)0) != saved_locale) { (void)setlocale(6, saved_locale); free(saved_locale); } } while (0); } pw_locked = 0; }
void close_files() { void *v0; void *v1; void *v2; void *v3; char *v4; char *v5; char *v6; char *v7; unsigned long long v9; unsigned long long v10; unsigned long long v12; unsigned long long v13; unsigned long long v14; unsigned long long v15; if (is_shadow_pwd) { if (spw_close()) { if (!spw_unlock()) { v10 = spw_dbname(); fprintf(*(&stderr), gettext("%s: failed to unlock %s\n")); v5 = setlocale(0x6, NULL); v1 = 0; if (v5) v1 = strdup(v5); if (v1) setlocale(0x6, "C"); spw_dbname(); syslog(0x3, "failed to unlock %s"); if (v1) { setlocale(0x6, v1); free(v1); } } spw_locked = 0; } else { v9 = spw_dbname(); fprintf(*(&stderr), gettext("%s: failure while writing changes to %s\n")); v4 = setlocale(0x6, NULL); v0 = 0; if (v4) v0 = strdup(v4); if (v0) setlocale(0x6, "C"); spw_dbname(); syslog(0x3, "failure while writing changes to %s"); if (v0) { setlocale(0x6, v0); free(v0); } fail_exit(0x1); } } if (!pw_close()) { v12 = pw_dbname(); fprintf(*(&stderr), gettext("%s: failure while writing changes to %s\n")); v6 = setlocale(0x6, NULL); v2 = 0; if (v6) v2 = strdup(v6); if (v2) setlocale(0x6, "C"); pw_dbname(); syslog(0x3, "failure while writing changes to %s"); if (v2) { setlocale(0x6, v2); free(v2); } fail_exit(0x1); } else { if (!pw_unlock()) { v13 = pw_dbname(); fprintf(*(&stderr), gettext("%s: failed to unlock %s\n")); v7 = setlocale(0x6, NULL); v3 = 0; if (v7) v3 = strdup(v7); if (v3) setlocale(0x6, "C"); pw_dbname(); v14 = syslog(0x3, "failed to unlock %s"); if (v3) { setlocale(0x6, v3); v15 = free(v3); } } pw_locked = 0; return; } }
shadow
angr_sailr
_Bool name_match (const char *file_name) { size_t length = strlen(file_name); while (1) { struct name *cursor = namelist; if (!cursor) return 1; if (cursor->name[0] == 0) { chdir_do(cursor->change_dir); namelist = ((void *)0); nametail = ((void *)0); return 1; } cursor = namelist_match(file_name, length); if (starting_file_option) { if (cursor == namelist) starting_file_option = 0; else cursor = ((void *)0); } if (cursor) { if (!(((file_name[cursor->length]) == '/') && recursion_option) || cursor->found_count == 0) cursor->found_count++; chdir_do(cursor->change_dir); return (occurrence_option == 0 ? (cursor)->found_count != 0 : (cursor)->found_count == occurrence_option); } if (same_order_option && namelist->found_count) { name_gather(); if (namelist->found_count) return 0; } else return 0; } }
ulong name_match(char *param_1) { size_t sVar1; long local_18; sVar1 = strlen(param_1); while (true) { if (namelist == 0) { return 1; } if (**(char **)(namelist + 0x10) == '\0') break; local_18 = namelist_match(param_1, sVar1); if (starting_file_option != '\0') { if (local_18 == namelist) { starting_file_option = '\0'; } else { local_18 = 0; } } if (local_18 != 0) { if (((param_1[*(long *)(local_18 + 0x18)] != '/') || (recursion_option == 0)) || (*(long *)(local_18 + 0x30) == 0)) { *(long *)(local_18 + 0x30) = *(long *)(local_18 + 0x30) + 1; } chdir_do(*(undefined4 *)(local_18 + 0x28)); if (occurrence_option == 0) { return *(ulong *)(local_18 + 0x30) & 0xffffffffffffff00 | (ulong)(*(ulong *)(local_18 + 0x30) != 0); } return occurrence_option & 0xffffffffffffff00 | (ulong)(*(ulong *)(local_18 + 0x30) == occurrence_option); } if ((same_order_option == '\0') || (*(long *)(namelist + 0x30) == 0)) { return 0; } name_gather(); if (*(long *)(namelist + 0x30) != 0) { return 0; } } chdir_do(*(undefined4 *)(namelist + 0x28)); namelist = 0; nametail = 0; return 1; }
tar
ghidra
static int handle_to_flags(int handle) { if (handle_is_ok(handle, HANDLE_FILE)) return handles[handle].flags; return 0; }
long handle_to_flags(unsigned int a1) { if (handle_is_ok(a1, 2)) return *(unsigned int *)(handles + 56LL * (int)a1 + 20); else return 0LL; }
openssh-portable
ida
int check_backup_super_block(e2fsck_t ctx) { ext2_filsys fs = ctx->fs; errcode_t retval; dgrp_t g; blk64_t sb; int ret = 0; char buf[1024]; struct ext2_super_block *backup_sb; if (((fs->flags & 0x200) == 0) || !ext2fs_test_valid(fs) || (fs->super->s_state & 0x0002) || (ctx->flags & (0x0001 | 0x0002)) || (ctx->options & 0x0001)) return 0; for (g = 1; g < fs->group_desc_count; g++) { if (!ext2fs_bg_has_super(fs, g)) continue; sb = ext2fs_group_first_block2(fs, g); retval = ((fs->io)->manager->read_blk((fs->io), sb, -1024, buf)); if (retval) continue; backup_sb = (struct ext2_super_block *)buf; if ((backup_sb->s_magic != 0xEF53) || (backup_sb->s_rev_level > 1) || ((backup_sb->s_log_block_size + 10) > 16) || ((((backup_sb)->s_rev_level == 0) ? 128 : (backup_sb)->s_inode_size) < 128)) continue; if ((fs->super->s_feature_compat != backup_sb->s_feature_compat) || ((fs->super->s_feature_incompat & ~(0x0040 | 0x0004)) != (backup_sb->s_feature_incompat & ~(0x0040 | 0x0004))) || ((fs->super->s_feature_ro_compat & ~(0x0002 | 0x0020)) != (backup_sb->s_feature_ro_compat & ~(0x0002 | 0x0020))) || (fs->super->s_blocks_count != backup_sb->s_blocks_count) || (fs->super->s_blocks_count_hi != backup_sb->s_blocks_count_hi) || (fs->super->s_inodes_count != backup_sb->s_inodes_count) || memcmp(fs->super->s_uuid, backup_sb->s_uuid, sizeof(fs->super->s_uuid))) ret = 1; break; } return ret; }
long long check_backup_super_block(struct_0 *a0) { unsigned int v0; unsigned int v1; struct_2 *v2; unsigned long long v3; unsigned long v4; struct_1 *v5; char v6; void *v8; v2 = a0->field_0; v1 = 0; if (!(v2->field_10 & 0x200)) { LABEL_40394d: v8 = 0; } else { if (!ext2fs_test_valid(v2)) goto LABEL_40394d; if (!(!(v2->field_20->field_3a & 2))) goto LABEL_40394d; if (!(!(a0->field_48 & 3))) goto LABEL_40394d; if (!(!(a0->field_4c & 1))) goto LABEL_40394d; v0 = 1; while (true) { if (v0 >= v2->field_30) goto LABEL_403b63; if (ext2fs_bg_has_super(v2, v0, v0)) break; LABEL_403b64: v0 += 1; } v3 = ext2fs_group_first_block2(v2, v0, v0); v4 = v2->field_8->field_8->field_28(v2->field_8, v3, 0xfffffc00, &v6, v2->field_8->field_8->field_28); if (!(!v4)) goto LABEL_403b64; v5 = &v6; if (v5->field_38 == 61267 && v5->field_4c <= 1 && v5->field_18 + 10 <= 16) { if (!v5->field_4c) { LABEL_403a61: if (v2->field_20->field_5c == v5->field_5c && !((v5->field_60 ^ v2->field_20->field_60) & -69) && !((v5->field_64 ^ v2->field_20->field_64) & -35) && v2->field_20->field_4 == v5->field_4 && v2->field_20->field_150 == v5->field_150 && v2->field_20->field_0 == v5->field_0 && !memcmp(&v2->field_20->padding_68, &v5->padding_68, 0x10)) goto LABEL_403b83; v1 = 1; LABEL_403b83: } else if (!(v5->field_58 <= 127)) { goto LABEL_403a61; } } LABEL_403b63: v8 = v1; } return v8; }
e2fsprogs-1.46.5
angr_phoenix
_Bool pred_regex (const char *pathname, struct stat *stat_buf, struct predicate *pred_ptr) { int len = strlen(pathname); (void)stat_buf; if (re_match(pred_ptr->args.regex, pathname, len, 0, (struct re_registers *)((void *)0)) == len) return (1); return (0); }
long long pred_regex(char *a0, unsigned long a1, struct_0 *a2) { unsigned long v0; unsigned int v1; unsigned long long v4; v0 = a1; v1 = strlen(a0); if (v1 == re_match(a2->field_38, a0, v1, 0x0, 0x0)) v4 = 1; else v4 = 0; return v4; }
findutils
angr_dream
static int getentropy_getrandom(void *buf, size_t len) { int pre_errno = (*__errno_location()); int ret; if (len > 256) return (-1); do { ret = syscall(318, buf, len, 0x0001); } while (ret == -1 && (*__errno_location()) == 4); if (ret != (int)len) return (-1); (*__errno_location()) = pre_errno; return (0); }
int getentropy_getrandom(unsigned long a0, unsigned long a1) { unsigned long v0; unsigned int v1; unsigned int v2; unsigned int v5; v0 = a0; v1 = *(__errno_location()); if (a1 > 0x100) { v5 = -1; } else { while (true) { v2 = syscall(0x13e); if (v2 != -1) break; if (*(__errno_location()) != 4) break; } if (v2 != a1) { v5 = -1; } else { *(__errno_location()) = v1; v5 = 0; } } return v5; }
libbsd-0.11.7
angr_dream
static int it_init_arrayvars(itp) ITEMLIST *itp; { init_itemlist_from_varlist(itp, all_array_variables); return 1; }
long long it_init_arrayvars(unsigned long long a0) { init_itemlist_from_varlist(a0, got.all_array_variables); return 1; }
bash
angr_sailr
static int hostkeys_check_old(struct hostkey_foreach_line *l, void *_ctx) { struct hostkeys_update_ctx *ctx = (struct hostkeys_update_ctx *)_ctx; size_t i; int hashed; if (l->status == 3 || l->key == ((void *)0)) return 0; hashed = l->match & ((1 << 2) | (1 << 3)); for (i = 0; i < ctx->nold; i++) { if (!sshkey_equal(l->key, ctx->old_keys[i])) continue; sshlog("clientloop.c", __func__, 1958, 1, SYSLOG_LEVEL_DEBUG3, ((void *)0), "found deprecated %s key at %s:%ld as %s", sshkey_ssh_name(ctx->old_keys[i]), l->path, l->linenum, hashed ? "[HASHED]" : l->hosts) ; ctx->old_key_seen = 1; break; } return 0; }
long long hostkeys_check_old(struct_0 *a0, struct_1 *a1) { unsigned long long v0; unsigned long v1; unsigned long v2; unsigned long v3; unsigned long long v4; unsigned int v5; void *v6; unsigned long long v8; if (a0->field_10 == 3) { LABEL_4059af: } else { if (!a0->field_40) goto LABEL_4059af; v5 = a0->field_14 & 12; v6 = 0; while (true) { if (v6 >= a1->field_48) break; if (!sshkey_equal(a0->field_40, *((a1->field_40 + (v6 << 3))), *((a1->field_40 + (v6 << 3))))) { v6 += 1; } else { if (v5) v8 = "[HASHED]"; else v8 = a0->field_28; v4 = v8; v3 = a0->field_8; v2 = a0->field_0; v1 = sshkey_ssh_name(*((a1->field_40 + v6 * 8))); v0 = "found deprecated %s key at %s:%ld as %s"; sshlog("clientloop.c", "hostkeys_check_old", 0x7a6, 0x1, 0x7, 0x0); a1->field_58 = 1; break; } } } return 0; }
openssh-portable
angr_phoenix
static void wait_timeout(const sigset_t *sigmask) { struct timespec tvSelectTimeout; tvSelectTimeout.tv_sec = runConf->globals.janitorInterval * 60; tvSelectTimeout.tv_nsec = 0; pselect(0, ((void *)0), ((void *)0), ((void *)0), &tvSelectTimeout, sigmask); }
void wait_timeout(unsigned long long a0) { char v0; char v1; void *v2; char v3; unsigned long long *v5; unsigned long long v6; v2 = 0; pselect(0x0, 0x0, 0x0, 0x0, &v1, a0, *(&v0), a0, *((runConf + 188)) * 60); v6 = *(&v3) ^ v5[5]; return; }
rsyslog-8.2210.0
angr_dream
int main(int argc, char **argv) { char proc_dir_name[32]; char *target_str; pid_t target; int proc_dir_fd; int ranges; struct map_range *mappings; struct stat st; struct passwd *pw; int written; _Bool allow_setgroups = 0; Prog = Basename(argv[0]); log_set_progname(Prog); log_set_logfd(stderr); if (argc < 2) usage(); target_str = argv[1]; if (!get_pid(target_str, &target)) usage(); written = snprintf(proc_dir_name, sizeof(proc_dir_name), "/proc/%u/", target); if ((written <= 0) || (written >= sizeof(proc_dir_name))) { fprintf(stderr, "%s: snprintf of proc path failed: %s\n", Prog, strerror((*__errno_location()))); } proc_dir_fd = open(proc_dir_name, 0200000); if (proc_dir_fd < 0) { fprintf(stderr, gettext("%s: Could not open proc directory for target %u\n"), Prog, target); return 1; } pw = get_my_pwent(); if (((void *)0) == pw) { fprintf(stderr, gettext("%s: Cannot determine your user name.\n"), Prog); do { char *old_locale = setlocale(6, ((void *)0)); char *saved_locale = ((void *)0); if (((void *)0) != old_locale) { saved_locale = strdup(old_locale); } if (((void *)0) != saved_locale) { (void)setlocale(6, "C"); } syslog(4, "Cannot determine the user name of the caller (UID %lu)", (unsigned long)getuid()); if (((void *)0) != saved_locale) { (void)setlocale(6, saved_locale); free(saved_locale); } } while (0); return 1; } if (fstat(proc_dir_fd, &st) < 0) { fprintf(stderr, gettext("%s: Could not stat directory for target %u\n"), Prog, target); return 1; } if ((getuid() != pw->pw_uid) || (!getdef_bool("GRANT_AUX_GROUP_SUBIDS") && (getgid() != pw->pw_gid)) || (pw->pw_uid != st.st_uid) || (getgid() != st.st_gid)) { fprintf(stderr, gettext("%s: Target %u is owned by a different user: uid:%lu " "pw_uid:%lu st_uid:%lu, gid:%lu pw_gid:%lu st_gid:%lu\n"), Prog, target, (unsigned long int)getuid(), (unsigned long int)pw->pw_uid, (unsigned long int)st.st_uid, (unsigned long int)getgid(), (unsigned long int)pw->pw_gid, (unsigned long int)st.st_gid); return 1; } if (!sub_gid_open(00)) { return 1; } ranges = ((argc - 2) + 2) / 3; mappings = get_map_ranges(ranges, argc - 2, argv + 2); if (!mappings) usage(); verify_ranges(pw, ranges, mappings, &allow_setgroups); write_setgroups(proc_dir_fd, allow_setgroups); write_mapping(proc_dir_fd, ranges, mappings, "gid_map", pw->pw_uid); sub_gid_close(); return 0; }
int main(unsigned long a0, unsigned long long a1[2], unsigned long long a2, unsigned long a3, unsigned long long a4, unsigned long long a5) { unsigned long v0; unsigned long v1; unsigned long v2; unsigned long v3; unsigned long v4; unsigned long v5; unsigned long v6; char v7; char v8; unsigned int v9; unsigned int v10; unsigned int v11; void *v12; unsigned long long v13; unsigned int v14[6]; void *v15; char *v16; char v17; char v18; char v19; char v20; unsigned int v22; unsigned long long v23; v7 = 0; Prog = Basename(a1[0]); log_set_progname(0xf87d894820ec8348); log_set_logfd(stderr); if (a0 <= 1) usage(); v13 = a1[1]; v22 = get_pid(v13, &v8, &v8); if (!v22) usage(); v9 = snprintf(&v20, 0x20, "/proc/%u/", *(&v8)); if (v9 <= 0 || v9 > 31) fprintf(stderr, "%s: snprintf of proc path failed: %s\n", 552371016, strerror(*(__errno_location()))); v10 = open(&v20, 0x10000, 0x8348); if (v10 < 0) { fprintf(stderr, gettext("%s: Could not open proc directory for target %u\n")); v22 = 1; } else { *(&v14[0]) = get_my_pwent(); if (!v14) { fprintf(stderr, gettext("%s: Cannot determine your user name.\n")); v16 = setlocale(0x6, NULL); v12 = 0; if (v16) v12 = strdup(v16); if (v12) setlocale(0x6, "C"); getuid(); syslog(0x4, "Cannot determine the user name of the caller (UID %lu)"); if (v12) { setlocale(0x6, v12); free(v12); } v22 = 1; } else { v22 = fstat(v10, &v17); if (v22 < 0) { fprintf(stderr, gettext("%s: Could not stat directory for target %u\n")); v22 = 1; } else { v22 = getuid(); if (v22 == v14[4]) { *(&v22) = getdef_bool("GRANT_AUX_GROUP_SUBIDS") ^ 1; if (v22) v22 = getgid(); if ((v22 == v14[5] || !v22) && v14[4] == *(&v18)) { v22 = getgid(); if (v22 == *(&v19)) { v22 = sub_gid_open(0x0); if (!v22) { v22 = 1; } else { v11 = (a0 * 1431655766 >> 32) - (a0 >> 31); v15 = get_map_ranges(v11, a0 - 2, a1 + 1, a0 - 2); if (!v15) usage(); verify_ranges(v14, v11, v15, &v7); write_setgroups(v10, v7); write_mapping(v10, v11, v15, "gid_map", v14[4]); sub_gid_close(v10, v11, a2, "gid_map", a4, a5); v22 = 0; } } } } } } } if (v22 == v14[4] && v22 >= 0 && v14 && v10 >= 0 && (v22 == v14[5] || !v22) && v14[4] == *(&v18) && v22 != *(&v19) || v22 == v14[4] && v22 >= 0 && v14 && v10 >= 0 && v22 && v22 != v14[5] || v22 == v14[4] && v22 >= 0 && v14 && v10 >= 0 && (v22 == v14[5] || !v22) && v14[4] != *(&v18) || v22 >= 0 && v14 && v10 >= 0 && v22 != v14[4]) { v6 = *(&v19); v23 = *(&v18); v5 = v14[4]; v4 = getuid(); v3 = v6; v2 = v14[5]; v1 = getgid(); v0 = v23; fprintf(stderr, gettext("%s: Target %u is owned by a different user: uid:%lu " "pw_uid:%lu st_uid:%lu, gid:%lu pw_gid:%lu st_gid:%lu\n")); v22 = 1; } if (...) return v22; }
shadow
angr_dream
SHELL_VAR **all_local_variables(visible_only) int visible_only; { VARLIST *vlist; SHELL_VAR **ret; VAR_CONTEXT *vc; vc = shell_variables; for (vc = shell_variables; vc; vc = vc->down) if ((((vc)->flags & 0x04) != 0) && vc->scope == variable_context) break; if (vc == 0) { internal_error( gettext("all_local_variables: no function context at current scope")); return (SHELL_VAR **)((void *)0); } if (vc->table == 0 || ((vc->table) ? (vc->table)->nentries : 0) == 0 || (((vc)->flags & 0x01) != 0) == 0) return (SHELL_VAR **)((void *)0); vlist = vlist_alloc(((vc->table) ? (vc->table)->nentries : 0)); if (visible_only) flatten(vc->table, visible_variable_in_context, vlist, 0); else flatten(vc->table, variable_in_context, vlist, 0); ret = vlist->list; sh_xfree((vlist), "variables.c", 4461); if (ret) sort_variables(ret); return ret; }
void *all_local_variables(int a1) { char *v1; int v3; long i; void **v5; void *v6; for (i = shell_variables; i && ((*(_DWORD *)(i + 12) & 4) == 0 || *(_DWORD *)(i + 8) != variable_context); i = *(_QWORD *)(i + 24)) { ; } if (i) { if (*(_QWORD *)(i + 32) && *(_DWORD *)(*(_QWORD *)(i + 32) + 12LL) && (*(_DWORD *)(i + 12) & 1) != 0) { if (*(_QWORD *)(i + 32)) v3 = *(_DWORD *)(*(_QWORD *)(i + 32) + 12LL); else v3 = 0; v5 = (void **)vlist_alloc(v3); if (a1) flatten(*(_QWORD *)(i + 32), (long (*)(const char **))visible_variable_in_context, (long)v5); else flatten(*(_QWORD *)(i + 32), (long (*)(const char **))variable_in_context, (long)v5); v6 = *v5; sh_xfree(v5, "variables.c", 4461LL); if (v6) sort_variables(v6); return v6; } else { return 0LL; } } else { v1 = gettext("all_local_variables: no function context at current scope"); internal_error(v1); return 0LL; } }
bash
ida
static void xfrm_sec_ctx_print(FILE *fp, struct rtattr *attr) { struct xfrm_user_sec_ctx *sctx; fprintf(fp, "\tsecurity context "); if (((int)((attr)->rta_len) - ((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0))) < sizeof(*sctx)) fprintf(fp, "(ERROR truncated)"); sctx = ((void *)(((char *)(attr)) + ((((sizeof(struct rtattr)) + 4U - 1) & ~(4U - 1)) + (0)))); fprintf(fp, "%.*s %s", sctx->ctx_len, (char *)(sctx + 1), _SL_); }
int xfrm_sec_ctx_print(FILE *a1, const char *a2) { fprintf(a1, "\tsecurity context "); if ((unsigned long)*(unsigned short *)a2 - 4 <= 7) fprintf(a1, "(ERROR truncated)"); return fprintf(a1, "%.*s %s", *((unsigned short *)a2 + 5), a2 + 12, SL_); }
iproute2-6.0.0
ida
static void bad_time_notify(void) { (void)puts(gettext("Invalid login time")); (void)fflush(stdout); }
void bad_time_notify() { unsigned long long v1; puts(gettext("Invalid login time")); v1 = fflush(stdout); return; }
shadow
angr_phoenix
static void sig_alarm(int ignore) { alarm_fired = 1; alarm(1); }
void sig_alarm(void) { alarm_fired = 1; alarm(1); return; }
openssh-portable
ghidra
static int grow_dst(char **dst, size_t *sz, size_t maxsz, char **dp, size_t need) { char *tp; size_t tsz; if (*dp + need < *dst + *sz) return 0; tsz = *sz + 128; if (tsz > maxsz) tsz = maxsz; if ((tp = recallocarray(*dst, *sz, tsz, 1)) == ((void *)0)) return -1; *dp = tp + (*dp - *dst); *dst = tp; *sz = tsz; return 0; }
int grow_dst(unsigned long long *a0, unsigned long long *a1, unsigned long long a2, unsigned long long *a3, unsigned long a4) { unsigned long long v0; unsigned long v1; unsigned int v3; if (*(a3) + a4 < *(a1) + *(a0)) { v3 = 0; } else { v0 = *(a1) - -128; if (v0 > a2) v0 = a2; v1 = recallocarray(*(a0), *(a1), v0, 0x1); if (!v1) { v3 = -1; } else { *(a3) = __subvdi3(*(a3), *(a0), *(a0)) + v1; *(a0) = v1; *(a1) = v0; v3 = 0; } } return v3; }
openssh-portable
angr_dream
static struct diff3_block * using_to_diff3_block(struct diff_block *using[2], struct diff_block *last_using[2], int low_thread, int high_thread, struct diff3_block const *last_diff3) { lin low[2], high[2]; struct diff3_block *result; struct diff_block *ptr; int d; lin i; lin lowc = ((using[low_thread])->ranges[1][0]); lin highc = ((last_using[high_thread])->ranges[1][1]); for (d = 0; d < 2; d++) if (using[d]) { low[d] = ((lowc) - (((using[d]))->ranges[(1)][0]) + (((using[d]))->ranges[(0)][0])); high[d] = ((highc) - (((last_using[d]))->ranges[(1)][1]) + (((last_using[d]))->ranges[(0)][1])); } else { low[d] = ((lowc) - (((last_diff3))->ranges[(2)][1]) + (((last_diff3))->ranges[(0 + d)][1])); high[d] = ((highc) - (((last_diff3))->ranges[(2)][1]) + (((last_diff3))->ranges[(0 + d)][1])); } result = create_diff3_block(low[0], high[0], low[1], high[1], lowc, highc); for (d = 0; d < 2; d++) for (ptr = using[d]; ptr; ptr = ((ptr)->next)) { lin result_offset = ((ptr)->ranges[1][0]) - lowc; if (!copy_stringlist(((ptr)->lines[1]), ((ptr)->lengths[1]), ((result)->lines[2]) + result_offset, ((result)->lengths[2]) + result_offset, (((ptr)->ranges[1][1]) - ((ptr)->ranges[1][0]) + 1))) return 0; } for (d = 0; d < 2; d++) { struct diff_block *u = using[d]; lin lo = low[d], hi = high[d]; for (i = 0; i + lo < (u ? ((u)->ranges[0][0]) : hi + 1); i++) { ((result)->lines[0 + d][i]) = ((result)->lines[2][i]); ((result)->lengths[0 + d][i]) = ((result)->lengths[2][i]); } for (ptr = u; ptr; ptr = ((ptr)->next)) { lin result_offset = ((ptr)->ranges[0][0]) - lo; lin linec; if (!copy_stringlist(((ptr)->lines[0]), ((ptr)->lengths[0]), ((result)->lines[0 + d]) + result_offset, ((result)->lengths[0 + d]) + result_offset, (((ptr)->ranges[0][1]) - ((ptr)->ranges[0][0]) + 1))) return 0; linec = ((ptr)->ranges[1][1]) + 1 - lowc; for (i = ((ptr)->ranges[0][1]) + 1 - lo; i < (((ptr)->next) ? ((((ptr)->next))->ranges[0][0]) : hi + 1) - lo; i++) { ((result)->lines[0 + d][i]) = ((result)->lines[2][linec]); ((result)->lengths[0 + d][i]) = ((result)->lengths[2][linec]); linec++; } } } if (!using[0]) ((result)->correspond) = DIFF_2ND; else if (!using[1]) ((result)->correspond) = DIFF_1ST; else { lin nl0 = (((result)->ranges[0][1]) - ((result)->ranges[0][0]) + 1); lin nl1 = (((result)->ranges[1][1]) - ((result)->ranges[1][0]) + 1); if (nl0 != nl1 || !compare_line_list(((result)->lines[0]), ((result)->lengths[0]), ((result)->lines[1]), ((result)->lengths[1]), nl0)) ((result)->correspond) = DIFF_ALL; else ((result)->correspond) = DIFF_3RD; } return result; }
long using_to_diff3_block(_QWORD *a1, long a2, int a3, int a4, long a5) { long v5; long v7; long v8; int i; long v10; _BYTE v11[12]; long j; long k; long m; long v15; long v16; long v17; long diff3_block; long v19; _QWORD *v20; long v21; long v22; long v23[2]; long v24[4]; v24[3] = __readfsqword(0x28u); v16 = *(_QWORD *)(a1[a3] + 16LL); v17 = *(_QWORD *)(*(_QWORD *)(8LL * a4 + a2) + 24LL); for (i = 0; i <= 1; ++i) { if (a1[i]) { v23[i] = *(_QWORD *)a1[i] + v16 - *(_QWORD *)(a1[i] + 16LL); v5 = *(_QWORD *)(*(_QWORD *)(8LL * i + a2) + 8LL) + v17 - *(_QWORD *)(*(_QWORD *)(8LL * i + a2) + 24LL); } else { v23[i] = v16 - *(_QWORD *)(a5 + 48) + *(_QWORD *)(16LL * i + a5 + 16); v5 = v17 - *(_QWORD *)(a5 + 48) + *(_QWORD *)(16LL * i + a5 + 16); } v24[i] = v5; } diff3_block = create_diff3_block(v23[0], v24[0], v23[1], v24[1], v16, v17); LODWORD(v10) = 0; while ((int)v10 <= 1) { for (j = a1[(int)v10]; j; j = *(_QWORD *)(j + 64)) { if ((unsigned char)copy_stringlist( *(const void ***)(j + 40), *(size_t **)(j + 56), (const void **)(*(_QWORD *)(diff3_block + 72) + 8 * (*(_QWORD *)(j + 16) - v16)), (size_t *)(*(_QWORD *)(diff3_block + 96) + 8 * (*(_QWORD *)(j + 16) - v16)), *(_QWORD *)(j + 24) - *(_QWORD *)(j + 16) + 1LL) != 1) return 0LL; } v10 = (unsigned int)(v10 + 1); } *(_DWORD *)v11 = 0; while (*(int *)v11 <= 1) { v20 = (_QWORD *)a1[*(int *)v11]; v21 = v23[*(int *)v11]; v22 = v24[*(int *)v11]; for (k = 0LL;; ++k) { v7 = v20 ? *v20 : v22 + 1; if (v7 <= v21 + k) break; *(_QWORD *)(*(_QWORD *)(diff3_block + 8 * (*(int *)v11 + 6LL) + 8) + 8 * k) = *(_QWORD *)(*(_QWORD *)(diff3_block + 72) + 8 * k); *(_QWORD *)(*(_QWORD *)(diff3_block + 8 * (*(int *)v11 + 10LL)) + 8 * k) = *(_QWORD *)(*(_QWORD *)(diff3_block + 96) + 8 * k); } for (*(_QWORD *)&v11[4] = v20; *(_QWORD *)&v11[4]; *(_QWORD *)&v11[4] = *(_QWORD *)(*(_QWORD *)&v11[4] + 64LL)) { if ((unsigned char)copy_stringlist( *(const void ***)(*(_QWORD *)&v11[4] + 32LL), *(size_t **)(*(_QWORD *)&v11[4] + 48LL), (const void **)(*(_QWORD *)(diff3_block + 8 * (*(int *)v11 + 6LL) + 8) + 8 * (**(_QWORD **)&v11[4] - v21)), (size_t *)(*(_QWORD *)(diff3_block + 8 * (*(int *)v11 + 10LL)) + 8 * (**(_QWORD **)&v11[4] - v21)), *(_QWORD *)(*(_QWORD *)&v11[4] + 8LL) - **(_QWORD **)&v11[4] + 1LL) != 1) return 0LL; v15 = *(_QWORD *)(*(_QWORD *)&v11[4] + 24LL) + 1LL - v16; for (m = *(_QWORD *)(*(_QWORD *)&v11[4] + 8LL) + 1LL - v21;; ++m) { v8 = *(_QWORD *)(*(_QWORD *)&v11[4] + 64LL) ? **(_QWORD **)(*(_QWORD *)&v11[4] + 64LL) : v22 + 1; if (m >= v8 - v21) break; *(_QWORD *)(*(_QWORD *)(diff3_block + 8 * (*(int *)v11 + 6LL) + 8) + 8 * m) = *(_QWORD *)(*(_QWORD *)(diff3_block + 72) + 8 * v15); *(_QWORD *)(*(_QWORD *)(diff3_block + 8 * (*(int *)v11 + 10LL)) + 8 * m) = *(_QWORD *)(*(_QWORD *)(diff3_block + 96) + 8 * v15++); } } *(_QWORD *)v11 = (unsigned int)(*(_DWORD *)v11 + 1); } if (*a1) { if (a1[1]) { v19 = *(_QWORD *)(diff3_block + 16) - *(_QWORD *)(diff3_block + 8) + 1LL; if (v19 == *(_QWORD *)(diff3_block + 32) - *(_QWORD *)(diff3_block + 24) + 1LL && (unsigned char)compare_line_list(*(const void ***)(diff3_block + 56), *(size_t **)(diff3_block + 80), *(const void ***)(diff3_block + 64), *(_QWORD **)(diff3_block + 88), v19) == 1) { *(_DWORD *)diff3_block = 7; } else { *(_DWORD *)diff3_block = 4; } } else { *(_DWORD *)diff3_block = 5; } } else { *(_DWORD *)diff3_block = 6; } return diff3_block; }
diffutils
ida
c_delafter(EditLine *el, int num) { if (el->el_line.cursor + num > el->el_line.lastchar) num = (int)(el->el_line.lastchar - el->el_line.cursor); if (el->el_map.current != el->el_map.emacs) { cv_undo(el); cv_yank(el, el->el_line.cursor, num); } if (num > 0) { wchar_t *cp; for (cp = el->el_line.cursor; cp <= el->el_line.lastchar; cp++) *cp = cp[num]; el->el_line.lastchar -= num; } }
void c_delafter(unsigned long long a0[130], unsigned long a1) { unsigned int v0; unsigned int *v1; unsigned long long v4; unsigned long long v5; unsigned long long v7[130]; v0 = a1; if ((v0 << 2) + a0[11] > a0[12]) v0 = a0[12] - a0[11] >> 2; v4 = a0[129]; if (a0[128] != a0[129]) { cv_undo(a0); v5 = cv_yank(a0, a0[11], v0); } if (v0 > 0) { for (v1 = a0[11]; v1 <= a0[12]; v1 += 1) { *(v1) = v1[v0]; } v7 = a0; a0[12] = -(v0 << 2) + a0[12]; } return; }
libedit
angr_phoenix
void remove_trailing_whitespace(string) char *string; { register int i; i = strlen(string) - 1; while (i > 0 && (((string[i]) == ' ') || ((string[i]) == '\t'))) i--; string[++i] = '\0'; }
void remove_trailing_whitespace(char *a0) { char *v2; unsigned long long v3; v2 = strlen(a0) - 1; while (true) { if (v2 <= 0) break; switch (*((a0 + v2))) { case 9: case 32: v2 = v2 - 1; break; default: goto LABEL_401124; } } LABEL_401124: v3 = 1 + a0 + v2; *((1 + a0 + v2)) = 0; return; }
bash
angr_sailr
static int proposals_match(char *my[PROPOSAL_MAX], char *peer[PROPOSAL_MAX]) { static int check[] = {PROPOSAL_KEX_ALGS, PROPOSAL_SERVER_HOST_KEY_ALGS, -1}; int *idx; char *p; for (idx = &check[0]; *idx != -1; idx++) { if ((p = strchr(my[*idx], ',')) != ((void *)0)) *p = '\0'; if ((p = strchr(peer[*idx], ',')) != ((void *)0)) *p = '\0'; if (strcmp(my[*idx], peer[*idx]) != 0) { sshlog("kex.c", __func__, 894, 0, SYSLOG_LEVEL_DEBUG2, ((void *)0), "proposal mismatch: my %s peer %s", my[*idx], peer[*idx]); return (0); } } sshlog("kex.c", __func__, 899, 0, SYSLOG_LEVEL_DEBUG2, ((void *)0), "proposals match"); return (1); }
int proposals_match(unsigned long long *a0, unsigned long long *a1) { unsigned long v0; unsigned long long v1; char *v2; unsigned int v4; v1 = &check.19414; while (true) { if (*(v1) != -1) { v2 = strchr(a0[*(v1)], 0x2c); if (v2) *(v2) = 0; v2 = strchr(a1[*(v1)], 0x2c); if (v2) *(v2) = 0; v4 = strcmp(a0[*(v1)], a1[*(v1)]); if (v4) { v0 = a0[*(v1)]; sshlog("kex.c", "proposals_match", 0x37e, 0x0, 0x6, 0x0, "proposal mismatch: my %s peer %s"); v4 = 0; break; } else { v1 += 4; } } else { sshlog("kex.c", "proposals_match", 0x383, 0x0, 0x6, 0x0, "proposals match"); v4 = 1; break; } } return v4; }
openssh-portable
angr_dream
inline static void reset_buffers(void) { to_server_len = 0; to_client_len = 0; }
void reset_buffers() { char v0; unsigned long long v2; to_server_len = 0; to_client_len = 0; v2 = *(&v0); return; }
gnutls
angr_dream
char *last_history_line() { HIST_ENTRY *he; he = last_history_entry(); if (he == 0) return ((char *)((void *)0)); return he->line; }
long long last_history_line(unsigned long long a0, unsigned long long a1, unsigned long long a2, unsigned long long a3, unsigned long long a4, unsigned long long a5) { unsigned long long *v0; void *v2; v0 = last_history_entry(a0, a1, a2, a3, a4, a5); if (!v0) v2 = 0; else v2 = *(v0); return v2; }
bash
angr_phoenix
terminal_beep(EditLine *el) { if ((el->el_terminal.t_str[1] != ((void *)0) && el->el_terminal.t_str[1][0] != '\0')) terminal_tputs(el, el->el_terminal.t_str[1], 1); else terminal__putc(el, '\007'); }
long long terminal_beep(struct_0 *a0) { unsigned long long v1; if (a0->field_b0->field_8 && a0->field_b0->field_8->field_0) { v1 = terminal_tputs(a0, a0->field_b0->field_8, 0x1); goto LABEL_401d28; } v1 = terminal__putc(a0, 0x7); LABEL_401d28: return v1; }
libedit
angr_phoenix
static void do_rc_files(struct ssh *ssh, Session *s, const char *shell) { FILE *f = ((void *)0); char *cmd = ((void *)0), *user_rc = ((void *)0); int do_xauth; struct stat st; do_xauth = s->display != ((void *)0) && s->auth_proto != ((void *)0) && s->auth_data != ((void *)0); xasprintf(&user_rc, "%s/%s", s->pw->pw_dir, ".ssh" "/rc"); if (!s->is_subsystem && options.adm_forced_command == ((void *)0) && auth_opts->permit_user_rc && options.permit_user_rc && stat(user_rc, &st) >= 0) { if (xasprintf(&cmd, "%s -c '%s %s'", shell, "/bin/sh", user_rc) == -1) sshfatal("session.c", __func__, 1218, 1, SYSLOG_LEVEL_FATAL, ((void *)0), "xasprintf: %s", strerror((*__errno_location()))); if (debug_flag) fprintf(stderr, "Running %s\n", cmd); f = popen(cmd, "w"); if (f) { if (do_xauth) fprintf(f, "%s %s\n", s->auth_proto, s->auth_data); pclose(f); } else fprintf(stderr, "Could not run %s\n", user_rc); } else if (stat("/usr/local/etc" "/sshrc", &st) >= 0) { if (debug_flag) fprintf(stderr, "Running %s %s\n", "/bin/sh", "/usr/local/etc" "/sshrc"); f = popen("/bin/sh" " " "/usr/local/etc" "/sshrc", "w"); if (f) { if (do_xauth) fprintf(f, "%s %s\n", s->auth_proto, s->auth_data); pclose(f); } else fprintf(stderr, "Could not run %s\n", "/usr/local/etc" "/sshrc"); } else if (do_xauth && options.xauth_location != ((void *)0)) { if (debug_flag) { fprintf(stderr, "Running %.500s remove %.100s\n", options.xauth_location, s->auth_display); fprintf(stderr, "%.500s add %.100s %.100s %.100s\n", options.xauth_location, s->auth_display, s->auth_proto, s->auth_data); } if (xasprintf(&cmd, "%s -q -", options.xauth_location) == -1) sshfatal("session.c", __func__, 1255, 1, SYSLOG_LEVEL_FATAL, ((void *)0), "xasprintf: %s", strerror((*__errno_location()))); f = popen(cmd, "w"); if (f) { fprintf(f, "remove %s\n", s->auth_display); fprintf(f, "add %s %s %s\n", s->auth_display, s->auth_proto, s->auth_data); pclose(f); } else { fprintf(stderr, "Could not run %s\n", cmd); } } free(cmd); free(user_rc); }
void do_rc_files(unsigned long a0, struct_0 *a1, unsigned long long a2) { unsigned long long v0; unsigned long v1; unsigned long v2; unsigned int v3; void *v4; void *v5; void *v6; char v7; char v8; unsigned int v10; unsigned int v11; unsigned long long v12; unsigned long long *v14; unsigned long long v15; v2 = a0; v6 = 0; v4 = 0; v5 = 0; if (a1->field_90 && a1->field_a8 && a1->field_b0) { v10 = 1; goto LABEL_402511; } v10 = 0; LABEL_402511: v3 = v10; xasprintf(&v5, "%s/%s", a1->field_10->field_20, ".ssh/rc"); if (!a1->field_c8 && !*(5250768) && *((auth_opts + 16)) && g_500564 && stat(v5, &v7) >= 0) { if (xasprintf(&v4, "%s -c '%s %s'", a2, "/bin/sh") == -1) { v1 = strerror(*(__errno_location())); v0 = "xasprintf: %s"; sshfatal("session.c", "do_rc_files", 0x4c2, 0x1, 0x1, 0x0); } if (*(&debug_flag)) fprintf(*(&stderr), "Running %s\n", v4); v6 = popen(v4, "w"); if (!v6) { fprintf(*(&stderr), "Could not run %s\n", v5); goto LABEL_4029d1; } else { if (v3) fprintf(v6, "%s %s\n", a1->field_a8, a1->field_b0); pclose(v6); goto LABEL_4029d1; } } if (stat("/usr/local/etc/sshrc", &v7) >= 0) { if (*(&debug_flag)) fprintf(*(&stderr), "Running %s %s\n", &g_407aae, &g_407af9); v6 = popen("/bin/sh /usr/local/etc/sshrc", "w"); if (!v6) { fprintf(*(&stderr), "Could not run %s\n", &g_407af9); } else { if (v3) fprintf(v6, "%s %s\n", a1->field_a8, a1->field_b0); pclose(v6); } } else if (v3 && g_500558) { if (*(&debug_flag)) { fprintf(*(&stderr), "Running %.500s remove %.100s\n", g_500558, a1->field_a0); v11 = a1->field_a0; fprintf(*(&stderr), "%.500s add %.100s %.100s %.100s\n", g_500558, a1->field_a0, a1->field_a8, a1->field_b0); } if (xasprintf(&v4, "%s -q -", g_500558, v12) == -1) { v1 = strerror(*(__errno_location())); v0 = "xasprintf: %s"; sshfatal("session.c", "do_rc_files", 0x4e7, 0x1, 0x1, 0x0); } v6 = popen(v4, "w"); if (!v6) { fprintf(*(&stderr), "Could not run %s\n", v4); } else { fprintf(v6, "remove %s\n", a1->field_a0); fprintf(v6, "add %s %s %s\n", a1->field_a0, a1->field_a8, a1->field_b0); pclose(v6); } } LABEL_4029d1: free(v4); free(v5); v15 = *(&v8) ^ v14[5]; return; }
openssh-portable
angr_phoenix
static void file_name_free(struct file_name *p) { free(p->buf); free(p); }
void file_name_free(void **a1) { free(*a1); free(a1); }
coreutils
ida
static void console_stty(void) { struct termios tty; int fd; if ((fd = console_open(02 | 0400)) < 0) { initlog((1 | 2), "can't open %s", console_dev); return; } (void)tcgetattr(fd, &tty); tty.c_cflag &= 000000010017 | 000000010000 | 0000060 | 0000100 | 0000400 | 0001000; tty.c_cflag |= 0002000 | 0004000 | 0000200; tty.c_cc[0] = ('c' & 037); tty.c_cc[1] = 034; tty.c_cc[2] = 0177; tty.c_cc[3] = ('u' & 037); tty.c_cc[4] = ('d' & 037); tty.c_cc[5] = 0; tty.c_cc[6] = 1; tty.c_cc[7] = '\0'; tty.c_cc[8] = ('q' & 037); tty.c_cc[9] = ('s' & 037); tty.c_cc[10] = ('z' & 037); tty.c_cc[11] = '\0'; tty.c_cc[12] = ('r' & 037); tty.c_cc[13] = ('o' & 037); tty.c_cc[14] = ('w' & 037); tty.c_cc[15] = ('v' & 037); tty.c_cc[16] = '\0'; tty.c_iflag = 0000004 | 0000400 | 0002000 | 0004000 | (tty.c_iflag & 0040000) ; tty.c_oflag = 0000001 | 0000004; tty.c_lflag = 0000001 | 0000002 | 0000010 | 0001000 | 0000020 | 0004000; (void)tcsetattr(fd, 0, &tty); (void)tcflush(fd, 2); (void)close(fd); }
unsigned long console_stty() { int fd; struct termios termios_p; unsigned long v3; v3 = __readfsqword(0x28u); fd = console_open(0x102u); if (fd >= 0) { tcgetattr(fd, &termios_p); termios_p.c_cflag = termios_p.c_cflag & 0x137F; termios_p.c_cflag |= 0xC80u; termios_p.c_cc[0] = 3; termios_p.c_cc[1] = 28; termios_p.c_cc[2] = 127; termios_p.c_cc[3] = 21; termios_p.c_cc[4] = 4; termios_p.c_cc[5] = 0; termios_p.c_cc[6] = 1; termios_p.c_cc[7] = 0; termios_p.c_cc[8] = 17; termios_p.c_cc[9] = 19; termios_p.c_cc[10] = 26; termios_p.c_cc[11] = 0; termios_p.c_cc[12] = 18; termios_p.c_cc[13] = 15; termios_p.c_cc[14] = 23; termios_p.c_cc[15] = 22; termios_p.c_cc[16] = 0; termios_p.c_iflag = termios_p.c_iflag & 0x4000 | 0xD04; termios_p.c_oflag = 5; termios_p.c_lflag = 2587; tcsetattr(fd, 0, &termios_p); tcflush(fd, 2); close(fd); } else { initlog(3, "can't open %s", console_dev); } return __readfsqword(0x28u) ^ v3; }
sysvinit
ida
static int print_ila_mapping(struct nlmsghdr *n, void *arg) { struct genlmsghdr *ghdr; struct rtattr *tb[(__ILA_ATTR_MAX - 1) + 1]; int len = n->nlmsg_len; if (n->nlmsg_type != genl_family) return 0; len -= (((((sizeof(struct genlmsghdr)) + 4U - 1) & ~(4U - 1))) + ((int)(((sizeof(struct nlmsghdr)) + 4U - 1) & ~(4U - 1)))); if (len < 0) return -1; ghdr = ((void *)(((char *)n) + ((int)(((sizeof(struct nlmsghdr)) + 4U - 1) & ~(4U - 1))))); parse_rtattr( tb, (__ILA_ATTR_MAX - 1), (void *)ghdr + (((sizeof(struct genlmsghdr)) + 4U - 1) & ~(4U - 1)), len); open_json_object(((void *)0)); print_ila_locid("locator_match", ILA_ATTR_LOCATOR_MATCH, tb); print_ila_locid("locator", ILA_ATTR_LOCATOR, tb); if (tb[ILA_ATTR_IFINDEX]) { __u32 ifindex = rta_getattr_u32(tb[ILA_ATTR_IFINDEX]); print_color_string(PRINT_ANY, COLOR_IFNAME, "interface", "%-16s", ll_index_to_name(ifindex)); } else { print_string(PRINT_FP, ((void *)0), "%-10s ", "-"); } if (tb[ILA_ATTR_CSUM_MODE]) { __u8 csum = rta_getattr_u8(tb[ILA_ATTR_CSUM_MODE]); print_string(PRINT_ANY, "csum_mode", "%s", ila_csum_mode2name(csum)); } else print_string(PRINT_FP, ((void *)0), "%-10s ", "-"); if (tb[ILA_ATTR_IDENT_TYPE]) print_string(PRINT_ANY, "ident_type", "%s", ila_ident_type2name(rta_getattr_u8(tb[ILA_ATTR_IDENT_TYPE]))); else print_string(PRINT_FP, ((void *)0), "%s", "-"); print_nl(); close_json_object(); return 0; }
undefined8 print_ila_mapping(int *param_1, undefined8 param_2, undefined8 param_3, undefined8 param_4, undefined8 param_5, undefined8 param_6) { undefined uVar1; undefined4 uVar2; undefined8 uVar3; long in_FS_OFFSET; undefined local_68[32]; long local_48; long local_30; long local_28; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); if (*(ushort *)(param_1 + 1) == genl_family) { if (*param_1 + -0x14 < 0) { uVar3 = 0xffffffff; } else { parse_rtattr(local_68, 9, param_1 + 5, *param_1 + -0x14, param_5, param_6, param_2); open_json_object(0); print_ila_locid("locator_match", 3, local_68); print_ila_locid("locator", 1, local_68); if (local_48 == 0) { print_string(1, 0, "%-10s ", &DAT_00101195); } else { uVar2 = rta_getattr_u32(local_48); uVar3 = ll_index_to_name(uVar2); print_color_string(4, 0, "interface", "%-16s", uVar3); } if (local_30 == 0) { print_string(1, 0, "%-10s ", &DAT_00101195); } else { uVar1 = rta_getattr_u8(local_30); uVar3 = ila_csum_mode2name(uVar1); print_string(4, "csum_mode", &DAT_001011ca, uVar3); } if (local_28 == 0) { print_string(1, 0, &DAT_001011ca, &DAT_00101195); } else { uVar1 = rta_getattr_u8(local_28); uVar3 = ila_ident_type2name(uVar1); print_string(4, "ident_type", &DAT_001011ca, uVar3); } print_nl(); close_json_object(); uVar3 = 0; } } else { uVar3 = 0; } if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) { __stack_chk_fail(); } return uVar3; }
iproute2-6.0.0
ghidra
format_host(nhe->nh_family, nhe->nh_gateway_len, &nhe->nh_gateway)); if (nhe->nh_oif) print_rta_ifidx(fp, nhe->nh_oif, "dev"); if (nhe->nh_scope != RT_SCOPE_UNIVERSE || show_details > 0) { print_string(PRINT_ANY, "scope", "scope %s ", rtnl_rtscope_n2a(nhe->nh_scope, b1, sizeof(b1))); }
void format_host(void) { halt_baddata(); }
iproute2-6.0.0
ghidra
static size_t mbs_logical_cspn(char const *s, char const *accept) { size_t idx = 0; if (accept[0] == '\0') return 0; if ((__ctype_get_mb_cur_max()) > 1) { mbui_iterator_t iter; for (((iter).cur.ptr = (s), (iter).in_shift = 0, memset(&(iter).state, '\0', sizeof(mbstate_t)), (iter).next_done = 0); (mbuiter_multi_next(&(iter)), !(((iter).cur).wc_valid && ((iter).cur).wc == 0)); ((iter).cur.ptr += (iter).cur.bytes, (iter).next_done = 0)) { ++idx; if ((((iter).cur).bytes) == 1) { if (mbschr(accept, *(iter).cur.ptr)) return idx; } else { mbui_iterator_t aiter; for (((aiter).cur.ptr = (accept), (aiter).in_shift = 0, memset(&(aiter).state, '\0', sizeof(mbstate_t)), (aiter).next_done = 0); (mbuiter_multi_next(&(aiter)), !(((aiter).cur).wc_valid && ((aiter).cur).wc == 0)); ((aiter).cur.ptr += (aiter).cur.bytes, (aiter).next_done = 0)) if ((((aiter).cur).wc_valid && ((iter).cur).wc_valid ? ((aiter).cur).wc == ((iter).cur).wc : ((aiter).cur).bytes == ((iter).cur).bytes && memcmp(((aiter).cur).ptr, ((iter).cur).ptr, ((aiter).cur).bytes) == 0)) return idx; } } return 0; } else { size_t i = strcspn(s, accept); return (s[i] ? i + 1 : 0); } }
long mbs_logical_cspn(char *param_1, char *param_2) { int iVar1; size_t sVar2; long lVar3; long in_FS_OFFSET; bool bVar4; long local_a8; undefined local_98[4]; undefined auStack148[8]; undefined local_8c; char *local_88; size_t local_80; char local_78; int local_74; undefined local_58[4]; undefined auStack84[8]; undefined local_4c; char *local_48; size_t local_40; char local_38; int local_34; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); local_a8 = 0; if (*param_2 == '\0') { local_a8 = 0; } else { sVar2 = __ctype_get_mb_cur_max(); if (sVar2 < 2) { sVar2 = strcspn(param_1, param_2); if (param_1[sVar2] == '\0') { local_a8 = 0; } else { local_a8 = sVar2 + 1; } } else { local_98[0] = 0; local_88 = param_1; memset(auStack148, 0, 8); while (true) { local_8c = 0; mbuiter_multi_next(local_98); if ((local_78 == '\x01') && (local_74 == 0)) { bVar4 = false; } else { bVar4 = true; } if (!bVar4) break; local_a8 = local_a8 + 1; if (local_80 == 1) { lVar3 = mbschr(param_2, (int)*local_88); if (lVar3 != 0) goto LAB_001004e5; } else { local_58[0] = 0; local_48 = param_2; memset(auStack84, 0, 8); while (true) { local_4c = 0; mbuiter_multi_next(local_58); if ((local_38 == '\x01') && (local_34 == 0)) { bVar4 = false; } else { bVar4 = true; } if (!bVar4) break; if ((local_38 == '\0') || (local_78 == '\0')) { if ((local_40 == local_80) && (iVar1 = memcmp(local_48, local_88, local_40), iVar1 == 0)) { bVar4 = true; } else { bVar4 = false; } } else { bVar4 = local_34 == local_74; } if (bVar4) goto LAB_001004e5; local_48 = local_48 + local_40; } } local_88 = local_88 + local_80; } local_a8 = 0; } } LAB_001004e5: if (local_10 == *(long *)(in_FS_OFFSET + 0x28)) { return local_a8; } __stack_chk_fail(); }
coreutils
ghidra
int get_ocsp_sign_status(void) { if (batch) { return cfg.ocsp_sign_key; } else { return read_yesno( "Will the certificate be used to sign OCSP requests? (y/N): ", 0); } }
long get_ocsp_sign_status() { if (batch) return (unsigned int)cfg[147]; else return read_yesno( "Will the certificate be used to sign OCSP requests? (y/N): ", 0); }
gnutls
ida
static void specify_ignore_initial(int f, char **argptr, char delimiter) { intmax_t val; char const *arg = *argptr; strtol_error e = xstrtoimax(arg, argptr, 0, &val, valid_suffixes); if (!((e == LONGINT_OK || (e == LONGINT_INVALID_SUFFIX_CHAR && **argptr == delimiter)) && 0 <= val && val <= ((off_t)(!(!((off_t)0 < (off_t)-1)) ? (off_t)-1 : ((((off_t)1 << ((sizeof(off_t) * 8) - 2)) - 1) * 2 + 1))))) try_help("invalid --ignore-initial value '%s'", arg); if (ignore_initial[f] < val) ignore_initial[f] = val; }
void specify_ignore_initial(int param_1, char **param_2, char param_3) { int iVar1; long in_FS_OFFSET; long local_20; char *local_18; long local_10; local_10 = *(long *)(in_FS_OFFSET + 0x28); local_18 = *param_2; iVar1 = xstrtoimax(local_18, param_2, 0, &local_20, valid_suffixes); if (((iVar1 != 0) && ((iVar1 != 2 || (param_3 != **param_2)))) || (local_20 < 0)) { try_help("invalid --ignore-initial value \'%s\'", local_18); } if (*(long *)(ignore_initial + (long)param_1 * 8) < local_20) { *(long *)(ignore_initial + (long)param_1 * 8) = local_20; } if (local_10 != *(long *)(in_FS_OFFSET + 0x28)) { __stack_chk_fail(); } return; }
diffutils
ghidra
static void collect_ids_from_dirents(SFTP_DIRENT **d, int user, u_int **idsp, u_int *nidsp) { u_int id, i, n = 0, *ids = ((void *)0); for (i = 0; d[i] != ((void *)0); i++) { if (user) { if (ruser_name((uid_t)(d[i]->a.uid)) != ((void *)0)) continue; id = d[i]->a.uid; } else { if (rgroup_name((gid_t)(d[i]->a.gid)) != ((void *)0)) continue; id = d[i]->a.gid; } if (has_id(id, ids, n)) continue; ids = xrecallocarray(ids, n, n + 1, sizeof(*ids)); ids[n++] = id; } *idsp = ids; *nidsp = n; }
void collect_ids_from_dirents(unsigned int *a0[10], unsigned long a1, unsigned long long *a2, unsigned int *a3) { unsigned int v0; int tmp_16; unsigned int v1; unsigned int v2; void *v3; unsigned int *v5; v2 = 0; v3 = 0; v1 = 0; while (true) { if (!a0[v1]) break; if (a1) { if (!(!ruser_name(a0[v1 + 8]))) goto LABEL_401a12; v0 = a0[v1 + 8]; } else { if (!(!rgroup_name(a0[v1 + 9]))) goto LABEL_401a12; v0 = a0[v1 + 9]; } if (!has_id(v0, v3, v2)) { v3 = xrecallocarray(v3, v2, v2 + 1, 0x4); tmp_16 = v2; v2 += 1; v3[tmp_16] = v0; } LABEL_401a12: v1 += 1; } *(a2) = v3; v5 = a3; *(a3) = v2; return; }
openssh-portable
angr_phoenix
static int display_history(list) WORD_LIST *list; { register int i; intmax_t limit; HIST_ENTRY **hlist; char *histtimefmt, *timestr; if (list) { if (get_numeric_arg(list, 0, &limit) == 0) return (1); if (limit < 0) limit = -limit; } else limit = -1; hlist = history_list(); if (hlist) { for (i = 0; hlist[i]; i++) ; if (0 <= limit && limit < i) i -= limit; else i = 0; histtimefmt = get_string_value("HISTTIMEFORMAT"); while (hlist[i]) { do { if (terminating_signal) termsig_handler(terminating_signal); if (interrupt_state) throw_to_top_level(); } while (0); timestr = (histtimefmt && *histtimefmt) ? histtime(hlist[i], histtimefmt) : (char *)((void *)0); printf("%5d%c %s%s\n", i + history_base, (hlist[(i)]->data) ? '*' : ' ', ((timestr && *timestr) ? timestr : ""), (hlist[(i)]->line)); i++; } } return (0); }
int display_history(unsigned long long a0) { unsigned long v0; void *v1; char *v2; unsigned long v3; unsigned long v5; void *v6; unsigned int v7; void *v8; if (!a0) { v0 = -1; } else if (!get_numeric_arg(a0, 0x0, &v0)) { v5 = 1; return v5; } else if (v0 < 0) { v0 = -(v0); } v1 = history_list(); if (!v1) { *(&v5) = 0; return v5; } for (v6 = 0; *((v1 + 0x8 * v6)); v6 = v6 + 1) ; if (v0 < 0 || v6 <= v0) v8 = 0; else v8 = v6 - v0; for (v2 = get_string_value("HISTTIMEFORMAT"); *((v1 + 0x8 * v8)); v8 = v8 + 1) { if (terminating_signal) termsig_handler(terminating_signal); if (interrupt_state) throw_to_top_level(); if (!v2 || !*(v2)) v5 = 0; else v5 = histtime(*((v1 + 0x8 * v8)), v2); v3 = v5; if (!v3 || !*(v3)) *(&v5) = &g_400d10; else *(&v5) = v3; if (*((*((v1 + 0x8 * v8)) + 16))) v7 = 42; else v7 = 32; printf("%5d%c %s%s\n", (v8 + history_base), v7, v5, *(*((v1 + 0x8 * v8)))); } *(&v5) = 0; return v5; }
bash
angr_sailr
SHELL_VAR *find_variable_last_nameref(name, vflags) const char *name; int vflags; { SHELL_VAR *v, *nv; char *newname; int level, flags; nv = v = find_variable_noref(name); level = 0; while (v && ((((v)->attributes) & (0x0000800)))) { level++; if (level > 8) return ((SHELL_VAR *)0); newname = ((v)->value); if (newname == 0 || *newname == '\0') return ((vflags && ((((v)->attributes) & (0x0001000)))) ? v : (SHELL_VAR *)0); nv = v; flags = 0; if (expanding_redir == 0 && (assigning_in_environment || executing_builtin)) flags |= 0x01; v = find_variable_internal(newname, flags); } return nv; }
int find_variable_last_nameref(unsigned long long a0, unsigned long a1) { unsigned int v0; unsigned int v1; struct_0 *v2; struct_0 *v3; char *v4; unsigned int v6; v2 = find_variable_noref(a0); v3 = v2; v0 = 0; while (true) { if (v2 && (v2->field_28 & 0x800)) { v0 += 1; if (v0 > 8) { v6 = 0; break; } else { v4 = v2->field_8; if (v4 && *(v4)) { v3 = v2; v1 = 0; if (!expanding_redir && (assigning_in_environment || executing_builtin)) v1 |= 1; v2 = find_variable_internal(v4, v1); continue; } if (!v4 || !*(v4)) { if (a1 && (v2->field_28 & 0x1000)) { v6 = v2; break; } if (!a1 || !(v2->field_28 & 0x1000)) { v6 = 0; break; } } } } if (!v2 || !(v2->field_28 & 0x800)) { v6 = v3; break; } } return v6; }
bash
angr_dream
void el_deletestr(EditLine *el, int n) { if (n <= 0) return; if (el->el_line.cursor < &el->el_line.buffer[n]) return; c_delbefore(el, n); el->el_line.cursor -= n; if (el->el_line.cursor < el->el_line.buffer) el->el_line.cursor = el->el_line.buffer; }
long long el_deletestr(unsigned long long a0[12], unsigned long a1) { unsigned long long v1[12]; if (a1 > 0) { v1 = a0[10] + a1 * 4; if (a0[11] >= a0[10] + (a1 << 2)) { c_delbefore(a0, a1); a0[11] = -(a1 << 2) + a0[11]; v1 = a0[10]; if (a0[11] < a0[10]) { v1 = a0; a0[11] = a0[10]; } } } return v1; }
libedit
angr_phoenix
) { (void)fprintf(el->el_errfile, "%ls: Bad capability `%s'.\n", argv[0], what); return -1; }
int fprintf(FILE *__stream, char *__format, ...) { halt_baddata(); }
libedit
ghidra
void write_documentation(stream, documentation, indentation, flags) FILE *stream; char **documentation; int indentation, flags; { register int i, j; register char *line; int string_array, texinfo, base_indent, filename_p; if (stream == 0) return; string_array = flags & 0x01; filename_p = flags & 0x08; if (string_array) { fprintf(stream, " {\n#if defined (HELP_BUILTIN)\n"); if (single_longdoc_strings) { if (filename_p == 0) { if (documentation && documentation[0] && documentation[0][0]) fprintf(stream, "N_(\""); else fprintf(stream, "N_(\" "); } else fprintf(stream, "\""); } } base_indent = (string_array && single_longdoc_strings && filename_p == 0) ? 4 : 0; for (i = 0, texinfo = (flags & 0x02); documentation && (line = documentation[i]); i++) { if (*line == '#') { if (string_array && filename_p == 0 && single_longdoc_strings == 0) fprintf(stream, "%s\n", line); continue; } if (string_array && single_longdoc_strings == 0) { if (filename_p == 0) { if (line[0]) fprintf(stream, " N_(\""); else fprintf(stream, " N_(\" "); } else fprintf(stream, " \""); } if (indentation) for (j = 0; j < indentation; j++) fprintf(stream, " "); if (i == 0) indentation += base_indent; if (string_array) { for (j = 0; line[j]; j++) { switch (line[j]) { case '\\': case '"': fprintf(stream, "\\%c", line[j]); break; default: fprintf(stream, "%c", line[j]); } } if (single_longdoc_strings == 0) { if (filename_p == 0) fprintf(stream, "\"),\n"); else fprintf(stream, "\",\n"); } else if (documentation[i + 1]) fprintf(stream, "\\n\\\n"); } else if (texinfo) { for (j = 0; line[j]; j++) { switch (line[j]) { case '@': case '{': case '}': fprintf(stream, "@%c", line[j]); break; default: fprintf(stream, "%c", line[j]); } } fprintf(stream, "\n"); } else fprintf(stream, "%s\n", line); } if (string_array && single_longdoc_strings) { if (filename_p == 0) fprintf(stream, "\"),\n"); else fprintf(stream, "\",\n"); } if (string_array) fprintf(stream, "#endif \n (char *)NULL\n};\n"); }
void write_documentation(void *a0, void *a1, unsigned long a2, unsigned long a3) { unsigned int v0; unsigned int v1; unsigned int v2; unsigned int v3; unsigned int v4; unsigned int v6; void *v7; unsigned long v8; unsigned long long v9; void *v10; unsigned long long v11; unsigned long long v12; unsigned long long v13; unsigned int v14; void *v16; void *v17; unsigned long long 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 long v25; unsigned long long v26; unsigned long long v27; v0 = a2; if (!a0) return; v1 = a3 & 1; v2 = a3 & 8; if (v1) { fprintf(a0, " {\n#if defined (HELP_BUILTIN)\n"); if (single_longdoc_strings) { if (v2) { fprintf(a0, "\""); } else if (!a1 || !*(a1) || !*(*(a1))) { fprintf(a0, "N_(\" "); } else { fprintf(a0, "N_(\""); } } } if (!v1 || !single_longdoc_strings || v2) v6 = 0; else v6 = 4; v3 = v6; v7 = 0; v8 = a3 & 2; for (v4 = a3 & 2; a1 && (v9 = a1 + v7 * 8, v10 = *((a1 + 0x8 * v7)), *((a1 + 0x8 * v7))); v7 = v7 + 1) { v11 = *(v10); if (*(v10) != 35) { if (v1 && !single_longdoc_strings) { if (v2) { fprintf(a0, " \""); } else { if (*(*((a1 + 0x8 * v7)))) fprintf(a0, " N_(\""); else fprintf(a0, " N_(\" "); } } if (v0) { for (v14 = 0; v14 < v0; v14 += 1) { fprintf(a0, " "); } } if (!v7) v0 += v3; if (!v1) { if (!v4) { v18 = fprintf(a0, "%s\n", v10); } else { for (v17 = 0; *((v17 + v10)); v17 = v17 + 1) { if (61 < *((v17 + v10)) - 64 || !(2882303761517117441 & 1 << (*(v17 + *(a1)) - 64 & 63))) fprintf(a0, "%c", *(v17 + *(a1))); else fprintf(a0, "@%c", *(v17 + *(a1))); } v20 = fprintf(a0, "\n"); } } else { v16 = 0; while (true) { switch (*((v16 + v10))) { case 0: if (single_longdoc_strings) { v19 = a1[8]; if (a1[8]) { v23 = fprintf(a0, "\\n\\\n"); break; } } else { if (!v2) { v21 = fprintf(a0, "\"),\n"); break; } else { v22 = fprintf(a0, "\",\n"); break; } } case 34: fprintf(a0, "\\%c", *(v16 + *(a1))); v16 = v16 + 1; continue; default: if (*(v16 + *(a1)) != 92) { fprintf(a0, "%c", *(v16 + *(a1))); v16 = v16 + 1; continue; } } } } } else if (v1 && !v2) { v12 = single_longdoc_strings; if (!single_longdoc_strings) v13 = fprintf(a0, "%s\n", *((a1 + 0x8 * v7))); } } if (v1) { v24 = single_longdoc_strings; if (single_longdoc_strings) { if (v2) v26 = fprintf(a0, "\",\n"); else v25 = fprintf(a0, "\"),\n"); } } if (v1) { v27 = fprintf(a0, "#endif \n (char *)NULL\n};\n"); return; } return; }
bash
angr_sailr
static struct permission_set *permission_set_get(struct ssh *ssh, int where) { struct ssh_channels *sc = ssh->chanctxt; switch (where) { case (1 << 1): return &sc->local_perms; break; case (1): return &sc->remote_perms; break; default: sshfatal("channels.c", __func__, 522, 1, SYSLOG_LEVEL_FATAL, ((void *)0), "invalid forwarding direction %d", where); } }
int permission_set_get(struct_0 *a0, unsigned long a1) { unsigned long long v0; unsigned long v1; unsigned long v2; unsigned int v4; v2 = a0->field_868; if (a1 == 1) { v4 = v2 + 72; } else if (a1 == 2) { v4 = v2 + 32; } else { v1 = a1; v0 = "invalid forwarding direction %d"; v4 = sshfatal("channels.c", "permission_set_get", 0x20a, 0x1, 0x1, 0x0); } return v4; }
openssh-portable
angr_phoenix
int rl_character_len(int c, int pos) { unsigned char uc; uc = (unsigned char)c; if (((uc) > 0x07f && (uc) <= 255)) return ((_rl_output_meta_chars == 0) ? 4 : 1); if (uc == '\t') { return (((pos | 7) + 1) - pos); } if (((c) < 0x020 && (((c) & 0x80) == 0)) || c == 0x7f) return (2); return (((1 && ((*__ctype_b_loc())[(int)(((unsigned char)uc))] & (unsigned short int)_ISprint))) ? 1 : 2); }
long rl_character_len(int a1, int a2) { if ((a1 & 0x80u) == 0) { if ((_BYTE)a1 == 9) { return (a2 | 7u) + 1 - a2; } else if ((a1 > 31 || (a1 & 0x80) != 0) && a1 != 127) { if (((*_ctype_b_loc())[(unsigned char)a1] & 0x4000) != 0) return 1LL; else return 2LL; } else { return 2LL; } } else if (rl_output_meta_chars) { return 1LL; } else { return 4LL; } }
bash
ida
static void free_delayed_set_stat(struct delayed_set_stat *data) { free(data->file_name); xheader_xattr_free(data->xattr_map, data->xattr_map_size); free(data->cntx_name); free(data->acls_a_ptr); free(data->acls_d_ptr); free(data); }
void free_delayed_set_stat(long a1) { free(*(void **)(a1 + 160)); xheader_xattr_free(*(_QWORD *)(a1 + 144), *(_QWORD *)(a1 + 136)); free(*(void **)(a1 + 96)); free(*(void **)(a1 + 104)); free(*(void **)(a1 + 120)); free((void *)a1); }
tar
ida
void deferred_configure(struct pkginfo *pkg) { struct varbuf aemsgs = {0, 0, ((void *)0)}; struct conffile *conff; struct pkginfo *otherpkg; enum dep_check ok; if (pkg->status == PKG_STAT_NOTINSTALLED) ohshit(gettext("no package named '%s' is installed, cannot configure"), pkg_name(pkg, pnaw_nonambig)); if (pkg->status == PKG_STAT_INSTALLED) ohshit(gettext("package %.250s is already installed and configured"), pkg_name(pkg, pnaw_nonambig)); if (pkg->status != PKG_STAT_UNPACKED && pkg->status != PKG_STAT_HALFCONFIGURED) ohshit(gettext("package %.250s is not ready for configuration\n" " cannot configure (current status '%.250s')"), pkg_name(pkg, pnaw_nonambig), pkg_status_name(pkg)); for (otherpkg = &pkg->set->pkg; otherpkg; otherpkg = otherpkg->arch_next) { if (otherpkg == pkg) continue; if (otherpkg->status <= PKG_STAT_CONFIGFILES) continue; if (otherpkg->status < PKG_STAT_UNPACKED) ohshit(gettext("package %s cannot be configured because " "%s is not ready (current status '%s')"), pkg_name(pkg, pnaw_always), pkg_name(otherpkg, pnaw_always), pkg_status_name(otherpkg)); if (dpkg_version_compare(&pkg->installed.version, &otherpkg->installed.version)) ohshit(gettext("package %s %s cannot be configured because " "%s is at a different version (%s)"), pkg_name(pkg, pnaw_always), versiondescribe(&pkg->installed.version, vdew_nonambig), pkg_name(otherpkg, pnaw_always), versiondescribe(&otherpkg->installed.version, vdew_nonambig)); } if (dependtry >= DEPEND_TRY_CYCLES) if (findbreakcycle(pkg)) sincenothing = 0; ok = dependencies_ok(pkg, ((void *)0), &aemsgs); if (ok == DEP_CHECK_DEFER) { varbuf_destroy(&aemsgs); ensure_package_clientdata(pkg); pkg->clientdata->istobe = PKG_ISTOBE_INSTALLNEW; enqueue_package(pkg); return; } trigproc_reset_cycle(); ok = breakses_ok(pkg, &aemsgs) ? ok : DEP_CHECK_HALT; if (ok == DEP_CHECK_HALT) { sincenothing = 0; varbuf_end_str(&aemsgs); notice(gettext("dependency problems prevent configuration of %s:\n%s"), pkg_name(pkg, pnaw_nonambig), aemsgs.buf); varbuf_destroy(&aemsgs); ohshit(gettext("dependency problems - leaving unconfigured")); } else if (aemsgs.used) { varbuf_end_str(&aemsgs); notice(gettext("%s: dependency problems, but configuring anyway as you " "requested:\n%s"), pkg_name(pkg, pnaw_nonambig), aemsgs.buf); } varbuf_destroy(&aemsgs); sincenothing = 0; if (pkg->eflag & PKG_EFLAG_REINSTREQ) forcibleerr( FORCE_REMOVE_REINSTREQ, gettext("package is in a very bad inconsistent state; you should\n" " reinstall it before attempting configuration")); printf(gettext("Setting up %s (%s) ...\n"), pkg_name(pkg, pnaw_nonambig), versiondescribe(&pkg->installed.version, vdew_nonambig)); log_action("configure", pkg, &pkg->installed); trig_activate_packageprocessing(pkg); if (f_noact) { pkg_set_status(pkg, PKG_STAT_INSTALLED); ensure_package_clientdata(pkg); pkg->clientdata->istobe = PKG_ISTOBE_NORMAL; return; } if (pkg->status == PKG_STAT_UNPACKED) { debug(dbg_general, "deferred_configure updating conffiles"); modstatdb_note(pkg); for (conff = pkg->installed.conffiles; conff; conff = conff->next) { if (conff->obsolete || conff->remove_on_upgrade) continue; deferred_configure_conffile(pkg, conff); } pkg_set_status(pkg, PKG_STAT_HALFCONFIGURED); } if (pkg->status != PKG_STAT_HALFCONFIGURED) do_internerr("configure.c", 672, __func__, "package %s in state %s, instead of half-configured", pkg_name(pkg, pnaw_always), pkg_status_name(pkg)); modstatdb_note(pkg); maintscript_postinst(pkg, "configure", dpkg_version_is_informative(&pkg->configversion) ? versiondescribe(&pkg->configversion, vdew_nonambig) : "", ((void *)0)); pkg_reset_eflags(pkg); pkg->trigpend_head = ((void *)0); post_postinst_tasks(pkg, PKG_STAT_INSTALLED); }
long long deferred_configure(struct_0 *a0, unsigned long a1, unsigned long long a2, unsigned long long a3, unsigned long long a4, unsigned long long a5) { unsigned int v0; struct_2 *v1; struct_3 *v2; void *v3; void *v4; void *v5; unsigned int v7; unsigned long long v8; unsigned long long v9; unsigned long long v10; v3 = 0; v4 = 0; v5 = 0; if (!a0->field_18) { pkg_name(a0, 0x1); ohshit(gettext("no package named '%s' is installed, cannot configure")); } if (a0->field_18 == 7) { pkg_name(a0, 0x1); ohshit(gettext("package %.250s is already installed and configured")); } if (a0->field_18 != 3 && a0->field_18 != 4) { pkg_status_name(a0); pkg_name(a0, 0x1); ohshit(gettext("package %.250s is not ready for configuration\n cannot " "configure (current status '%.250s')")); } v2 = a0->field_0 + 16; while (true) { if (!v2) break; if (v2 != a0) { if (v2->field_18 <= 2) { pkg_status_name(v2); pkg_name(v2, 0x3); pkg_name(a0, 0x3); ohshit(gettext("package %s cannot be configured because %s is not " "ready (current status '%s')")); } versiondescribe(&v2[5].field_8 + 4, 0x1); pkg_name(v2, 0x3); versiondescribe(&a0->padding_1c[124], 0x1); pkg_name(a0, 0x3); ohshit(gettext("package %s %s cannot be configured because %s is at a " "different version (%s)")); } v2 = v2->field_8; } if (dependtry > 1 && findbreakcycle(a0)) sincenothing = 0; v0 = dependencies_ok(a0, 0x0, &v3); if (v0 == 1) { varbuf_destroy(&v3); ensure_package_clientdata(a0); a0->field_138->field_0 = 2; enqueue_package(a0); } else { trigproc_reset_cycle(); if (!breakses_ok(a0, &v3, &v3)) v7 = 0; else v7 = v0; v0 = v7; if (!v0) { sincenothing = 0; varbuf_end_str(&v3); notice(gettext("dependency problems prevent configuration of %s:\n%s"), pkg_name(a0, 0x1), v5); varbuf_destroy(&v3); ohshit(gettext("dependency problems - leaving unconfigured")); } if (v3) { varbuf_end_str(&v3); notice(gettext("%s: dependency problems, but configuring anyway as you " "requested:\n%s"), pkg_name(a0, 0x1), v5); } varbuf_destroy(&v3); sincenothing = 0; if ((a0->field_14 & 1)) forcibleerr( 0x200000, gettext("package is in a very bad inconsistent state; you should\n " "reinstall it before attempting configuration")); v8 = versiondescribe(&a0->padding_1c[124], 0x1); v9 = pkg_name(a0, 0x1); printf(gettext("Setting up %s (%s) ...\n")); log_action("configure", a0, &a0->padding_1c[44]); trig_activate_packageprocessing(a0); if (f_noact) { pkg_set_status(a0, 0x7); ensure_package_clientdata(a0); a0->field_138->field_0 = 0; } else { if (a0->field_18 == 3) { debug(0x1, "deferred_configure updating conffiles", a2, a3, a4, a5); modstatdb_note(a0); v1 = a0->field_b0; while (true) { if (!v1) break; if (!v1->field_18 && !v1->field_19) deferred_configure_conffile( a0, "deferred_configure updating conffiles", a2); v1 = v1->field_0; } pkg_set_status(a0, 0x4); } if (a0->field_18 != 4) { pkg_status_name(a0); do_internerr("configure.c", 0x2a0, "deferred_configure", "package %s in state %s, instead of half-configured", pkg_name(a0, 0x3)); } modstatdb_note(a0); if (!dpkg_version_is_informative(&a0->padding_1c[20])) v10 = &g_402e2b; else v10 = versiondescribe(&a0->padding_1c[20], 0x1); maintscript_postinst(a0, "configure", v10, 0x0); pkg_reset_eflags(a0); a0->field_160 = 0; post_postinst_tasks(a0, 0x7); } } return 0; }
dpkg
angr_phoenix
static void ensure_minimum_time_since(double start, double seconds) { struct timespec ts; double elapsed = monotime_double() - start, req = seconds, remain; while ((remain = seconds - elapsed) < 0.0) seconds *= 2; ts.tv_sec = remain; ts.tv_nsec = (remain - ts.tv_sec) * 1000000000; sshlog("auth2.c", __func__, 254, 1, SYSLOG_LEVEL_DEBUG3, ((void *)0), "elapsed %0.3lfms, delaying %0.3lfms (requested %0.3lfms)", elapsed * 1000, remain * 1000, req * 1000); nanosleep(&ts, ((void *)0)); }
void ensure_minimum_time_since() { unsigned long v0; unsigned long v1; unsigned long v2; unsigned long v3; unsigned long long v4; unsigned long long v5; char v7; unsigned long v9; unsigned long v10; int v11; unsigned long long v13; unsigned long long *v15; unsigned long long v16; v1 = v9; v0 = v10; monotime_double(); s_40 = L Conv(128->64, (xmm0<16> - Conv(64->128, Load(addr = stack_base - 80, size = 8, endness = Iend_LE))))<8> v3 = v0; while (true) { v4 = v0 - v2; if ((((BinaryOp CmpF & 69) | ((BinaryOp CmpF & 69) >> 6)) & 1) == 1) break; v0 += v0; } v5 = v4; v13 = v5; s_20 = L Conv(128->64, (0x41cdcd6500000000 < 128 > *(Conv(64->128, Load(addr = stack_base - 48, size = 8, endness = Iend_LE)) - xmm1<16>)))<8> sshlog("auth2.c", "ensure_minimum_time_since", 0xfe, 0x1, 0x7, 0x0, "elapsed %0.3lfms, delaying %0.3lfms (requested %0.3lfms)"); nanosleep(&v5, NULL); v16 = *(&v7) ^ v15[5]; return; }
openssh-portable
angr_dream
static void init_env(void) { const char *cp; char *tmp; tmp = getenv("LANG"); if (((void *)0) != tmp) { addenv("LANG", tmp); } tmp = getenv("TZ"); if (((void *)0) != tmp) { addenv("TZ", tmp); } else { cp = getdef_str("ENV_TZ"); if (((void *)0) != cp) { addenv(('/' == *cp) ? tz(cp) : cp, ((void *)0)); } } tmp = getenv("HZ"); if (((void *)0) != tmp) { addenv("HZ", tmp); } else { cp = getdef_str("ENV_HZ"); if (((void *)0) != cp) { addenv(cp, ((void *)0)); } } }
long init_env() { long v0; long result; char *v2; char *v3; char *v4; _BYTE *v5; v2 = getenv("LANG"); if (v2) addenv("LANG", v2); v3 = getenv("TZ"); if (v3) { addenv("TZ", v3); } else { v5 = (_BYTE *)getdef_str("ENV_TZ"); if (v5) { if (*v5 == 47) v0 = tz(v5); else v0 = (long)v5; addenv(v0, 0LL); } } v4 = getenv("HZ"); if (v4) return addenv("HZ", v4); result = getdef_str("ENV_HZ"); if (result) return addenv(result, 0LL); return result; }
shadow
ida
int ssh_digest_final(struct ssh_digest_ctx *ctx, u_char *d, size_t dlen) __attribute__(()); void ssh_digest_free(struct ssh_digest_ctx *ctx); const char *ssh_err(int n); struct ssh_digest_ctx { int alg; EVP_MD_CTX *mdctx; };
long ssh_digest_final(long a1, long a2, unsigned long a3) { int v5; char *v6; unsigned long v7; v7 = __readfsqword(0x28u); v6 = ssh_digest_by_alg(*(_DWORD *)a1); v5 = a3; if (!v6 || a3 > 0xFFFFFFFF) return 4294967286LL; if (a3 < *((_QWORD *)v6 + 2)) return 4294967286LL; if ((unsigned int)EVP_DigestFinal_ex(*(_QWORD *)(a1 + 8), a2, &v5) != 1) return 4294967274LL; if (v5 == *((_QWORD *)v6 + 2)) return 0LL; return 0xFFFFFFFFLL; }
openssh-portable
ida
static void freeConfigVars(void) { free(cs.pszStrmDrvr); cs.pszStrmDrvr = ((void *)0); free(cs.pszStrmDrvrAuthMode); cs.pszStrmDrvrAuthMode = ((void *)0); free(cs.pPermPeers); cs.pPermPeers = ((void *)0); }
void freeConfigVars(void) { free(cs._8_8_); cs._8_8_ = (void *)0x0; free(cs._24_8_); cs._24_8_ = (void *)0x0; free(cs._80_8_); cs._80_8_ = (void *)0x0; return; }
rsyslog-8.2210.0
ghidra
static int bash_filename_stat_hook(dirname) char **dirname; { char *local_dirname, *new_dirname, *t; int should_expand_dirname, return_value; int global_nounset; WORD_LIST *wl; local_dirname = *dirname; should_expand_dirname = return_value = 0; if (t = mbschr(local_dirname, '$')) should_expand_dirname = '$'; else if (t = mbschr(local_dirname, '`')) should_expand_dirname = '`'; if (should_expand_dirname && directory_exists(local_dirname, 0)) should_expand_dirname = 0; if (should_expand_dirname) { new_dirname = (char *)strcpy( sh_xmalloc((1 + strlen(local_dirname)), "bashline.c", 3395), (local_dirname)); global_nounset = unbound_vars_is_error; unbound_vars_is_error = 0; wl = expand_prompt_string(new_dirname, 0, (1 << 10) | (1 << 20) | (1 << 27)); unbound_vars_is_error = global_nounset; if (wl) { sh_xfree((new_dirname), "bashline.c", 3404); new_dirname = string_list(wl); if (new_dirname && *new_dirname) { sh_xfree((local_dirname), "bashline.c", 3411); local_dirname = *dirname = new_dirname; return_value = ((local_dirname)[0] == (*dirname)[0] && strcmp(local_dirname, *dirname) == 0) == 0; } else sh_xfree((new_dirname), "bashline.c", 3416); dispose_words(wl); } else sh_xfree((new_dirname), "bashline.c", 3420); } if (no_symbolic_links == 0 && (local_dirname[0] != '.' || local_dirname[1])) { char *temp1, *temp2; t = get_working_directory("symlink-hook"); temp1 = make_absolute(local_dirname, t); sh_xfree((t), "bashline.c", 3432); temp2 = sh_canonpath(temp1, 0x0001 | 0x0002); if (temp2 == 0) { sh_xfree((temp1), "bashline.c", 3438); return return_value; } sh_xfree((local_dirname), "bashline.c", 3442); *dirname = temp2; sh_xfree((temp1), "bashline.c", 3444); } return (return_value); }
bool bash_filename_stat_hook(char **param_1) { bool bVar1; undefined4 uVar2; int iVar3; long lVar4; size_t sVar5; char *pcVar6; undefined8 uVar7; undefined8 uVar8; int local_44; char *local_38; local_38 = *param_1; bVar1 = false; local_44 = 0; lVar4 = mbschr(local_38, 0x24); if (lVar4 == 0) { lVar4 = mbschr(local_38, 0x60); if (lVar4 != 0) { local_44 = 0x60; } } else { local_44 = 0x24; } if ((local_44 != 0) && (iVar3 = directory_exists(local_38, 0), iVar3 != 0)) { local_44 = 0; } if (local_44 != 0) { sVar5 = strlen(local_38); pcVar6 = (char *)sh_xmalloc(sVar5 + 1, "bashline.c", 0xd43); pcVar6 = strcpy(pcVar6, local_38); uVar2 = unbound_vars_is_error; unbound_vars_is_error = 0; lVar4 = expand_prompt_string(pcVar6, 0, 0x8100400); unbound_vars_is_error = uVar2; if (lVar4 == 0) { sh_xfree(pcVar6, "bashline.c", 0xd5c); } else { sh_xfree(pcVar6, "bashline.c", 0xd4c); pcVar6 = (char *)string_list(lVar4); if ((pcVar6 == (char *)0x0) || (*pcVar6 == '\0')) { sh_xfree(pcVar6, "bashline.c", 0xd58); } else { sh_xfree(local_38, "bashline.c", 0xd53); *param_1 = pcVar6; local_38 = *param_1; if ((*local_38 == **param_1) && (iVar3 = strcmp(local_38, *param_1), iVar3 == 0)) { bVar1 = true; } else { bVar1 = false; } bVar1 = !bVar1; } dispose_words(lVar4); } } if ((no_symbolic_links == 0) && ((*local_38 != '.' || (local_38[1] != '\0')))) { uVar7 = get_working_directory("symlink-hook"); uVar8 = make_absolute(local_38, uVar7); sh_xfree(uVar7, "bashline.c", 0xd68); pcVar6 = (char *)sh_canonpath(uVar8, 3); if (pcVar6 == (char *)0x0) { sh_xfree(uVar8, "bashline.c", 0xd6e); } else { sh_xfree(local_38, "bashline.c", 0xd72); *param_1 = pcVar6; sh_xfree(uVar8, "bashline.c", 0xd74); } } return bVar1; }
bash
ghidra