func
stringlengths
0
484k
target
int64
0
1
cwe
listlengths
0
4
project
stringclasses
799 values
commit_id
stringlengths
40
40
hash
float64
1,215,700,430,453,689,100,000,000B
340,281,914,521,452,260,000,000,000,000B
size
int64
1
24k
message
stringlengths
0
13.3k
static void mon_text_read_isostat(struct mon_reader_text *rp, struct mon_text_ptr *p, const struct mon_event_text *ep) { if (ep->type == 'S') { p->cnt += snprintf(p->pbuf + p->cnt, p->limit - p->cnt, " %d:%d:%d", ep->status, ep->interval, ep->start_frame); } else { p->cnt += snprintf(p->pbuf + p->cnt, p->limit - p->cnt, " %d:%d:%d:%d", ep->status, ep->interval, ep->start_frame, ep->error_count); } }
0
[ "CWE-787" ]
linux
a5f596830e27e15f7a0ecd6be55e433d776986d8
234,424,430,981,050,770,000,000,000,000,000,000,000
12
usb: usbmon: Read text within supplied buffer size This change fixes buffer overflows and silent data corruption with the usbmon device driver text file read operations. Signed-off-by: Fredrik Noring <[email protected]> Signed-off-by: Pete Zaitcev <[email protected]> Cc: stable <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
std::string ElectronBrowserClient::GetProduct() { return "Chrome/" CHROME_VERSION_STRING; }
0
[]
electron
e9fa834757f41c0b9fe44a4dffe3d7d437f52d34
4,049,038,108,830,167,000,000,000,000,000,000,000
3
fix: ensure ElectronBrowser mojo service is only bound to appropriate render frames (#33344) * fix: ensure ElectronBrowser mojo service is only bound to authorized render frames Notes: no-notes * refactor: extract electron API IPC to its own mojo interface * fix: just check main frame not primary main frame Co-authored-by: Samuel Attard <[email protected]> Co-authored-by: Samuel Attard <[email protected]>
STATIC int S_ssc_is_cp_posixl_init(const RExC_state_t *pRExC_state, const regnode_ssc *ssc) { /* Returns TRUE if the SSC 'ssc' is in its initial state with regard only * to the list of code points matched, and locale posix classes; hence does * not check its flags) */ UV start, end; bool ret; PERL_ARGS_ASSERT_SSC_IS_CP_POSIXL_INIT; assert(is_ANYOF_SYNTHETIC(ssc)); invlist_iterinit(ssc->invlist); ret = invlist_iternext(ssc->invlist, &start, &end) && start == 0 && end == UV_MAX; invlist_iterfinish(ssc->invlist); if (! ret) { return FALSE; } if (RExC_contains_locale && ! ANYOF_POSIXL_SSC_TEST_ALL_SET(ssc)) { return FALSE; } return TRUE;
0
[ "CWE-190", "CWE-787" ]
perl5
897d1f7fd515b828e4b198d8b8bef76c6faf03ed
36,480,063,292,634,630,000,000,000,000,000,000,000
31
regcomp.c: Prevent integer overflow from nested regex quantifiers. (CVE-2020-10543) On 32bit systems the size calculations for nested regular expression quantifiers could overflow causing heap memory corruption. Fixes: Perl/perl5-security#125 (cherry picked from commit bfd31397db5dc1a5c5d3e0a1f753a4f89a736e71)
void isis_notif_corrupted_lsp(const struct isis_area *area, const uint8_t *lsp_id) { const char *xpath = "/frr-isisd:corrupted-lsp-detected"; struct list *arguments = yang_data_list_new(); char xpath_arg[XPATH_MAXLEN]; struct yang_data *data; notif_prep_instance_hdr(xpath, area, "default", arguments); snprintf(xpath_arg, sizeof(xpath_arg), "%s/lsp-id", xpath); data = yang_data_new_string(xpath_arg, rawlspid_print(lsp_id)); listnode_add(arguments, data); hook_call(isis_hook_corrupted_lsp, area); nb_notification_send(xpath, arguments); }
0
[ "CWE-119", "CWE-787" ]
frr
ac3133450de12ba86c051265fc0f1b12bc57b40c
93,645,027,279,480,660,000,000,000,000,000,000,000
17
isisd: fix #10505 using base64 encoding Using base64 instead of the raw string to encode the binary data. Signed-off-by: whichbug <[email protected]>
int apply_filter_to_req_headers(struct session *t, struct buffer *req, struct hdr_exp *exp) { char term; char *cur_ptr, *cur_end, *cur_next; int cur_idx, old_idx, last_hdr; struct http_txn *txn = &t->txn; struct hdr_idx_elem *cur_hdr; int len, delta; last_hdr = 0; cur_next = txn->req.sol + hdr_idx_first_pos(&txn->hdr_idx); old_idx = 0; while (!last_hdr) { if (unlikely(txn->flags & (TX_CLDENY | TX_CLTARPIT))) return 1; else if (unlikely(txn->flags & TX_CLALLOW) && (exp->action == ACT_ALLOW || exp->action == ACT_DENY || exp->action == ACT_TARPIT)) return 0; cur_idx = txn->hdr_idx.v[old_idx].next; if (!cur_idx) break; cur_hdr = &txn->hdr_idx.v[cur_idx]; cur_ptr = cur_next; cur_end = cur_ptr + cur_hdr->len; cur_next = cur_end + cur_hdr->cr + 1; /* Now we have one header between cur_ptr and cur_end, * and the next header starts at cur_next. */ /* The annoying part is that pattern matching needs * that we modify the contents to null-terminate all * strings before testing them. */ term = *cur_end; *cur_end = '\0'; if (regexec(exp->preg, cur_ptr, MAX_MATCH, pmatch, 0) == 0) { switch (exp->action) { case ACT_SETBE: /* It is not possible to jump a second time. * FIXME: should we return an HTTP/500 here so that * the admin knows there's a problem ? */ if (t->be != t->fe) break; /* Swithing Proxy */ session_set_backend(t, (struct proxy *)exp->replace); last_hdr = 1; break; case ACT_ALLOW: txn->flags |= TX_CLALLOW; last_hdr = 1; break; case ACT_DENY: txn->flags |= TX_CLDENY; last_hdr = 1; t->be->counters.denied_req++; if (t->listener->counters) t->listener->counters->denied_req++; break; case ACT_TARPIT: txn->flags |= TX_CLTARPIT; last_hdr = 1; t->be->counters.denied_req++; if (t->listener->counters) t->listener->counters->denied_req++; break; case ACT_REPLACE: len = exp_replace(trash, cur_ptr, exp->replace, pmatch); delta = buffer_replace2(req, cur_ptr, cur_end, trash, len); /* FIXME: if the user adds a newline in the replacement, the * index will not be recalculated for now, and the new line * will not be counted as a new header. */ cur_end += delta; cur_next += delta; cur_hdr->len += delta; http_msg_move_end(&txn->req, delta); break; case ACT_REMOVE: delta = buffer_replace2(req, cur_ptr, cur_next, NULL, 0); cur_next += delta; http_msg_move_end(&txn->req, delta); txn->hdr_idx.v[old_idx].next = cur_hdr->next; txn->hdr_idx.used--; cur_hdr->len = 0; cur_end = NULL; /* null-term has been rewritten */ cur_idx = old_idx; break; } } if (cur_end) *cur_end = term; /* restore the string terminator */ /* keep the link from this header to next one in case of later * removal of next header. */ old_idx = cur_idx; } return 0; }
0
[]
haproxy-1.4
dc80672211e085c211f1fc47e15cfe57ab587d38
54,936,543,612,138,480,000,000,000,000,000,000,000
122
BUG/CRITICAL: using HTTP information in tcp-request content may crash the process During normal HTTP request processing, request buffers are realigned if there are less than global.maxrewrite bytes available after them, in order to leave enough room for rewriting headers after the request. This is done in http_wait_for_request(). However, if some HTTP inspection happens during a "tcp-request content" rule, this realignment is not performed. In theory this is not a problem because empty buffers are always aligned and TCP inspection happens at the beginning of a connection. But with HTTP keep-alive, it also happens at the beginning of each subsequent request. So if a second request was pipelined by the client before the first one had a chance to be forwarded, the second request will not be realigned. Then, http_wait_for_request() will not perform such a realignment either because the request was already parsed and marked as such. The consequence of this, is that the rewrite of a sufficient number of such pipelined, unaligned requests may leave less room past the request been processed than the configured reserve, which can lead to a buffer overflow if request processing appends some data past the end of the buffer. A number of conditions are required for the bug to be triggered : - HTTP keep-alive must be enabled ; - HTTP inspection in TCP rules must be used ; - some request appending rules are needed (reqadd, x-forwarded-for) - since empty buffers are always realigned, the client must pipeline enough requests so that the buffer always contains something till the point where there is no more room for rewriting. While such a configuration is quite unlikely to be met (which is confirmed by the bug's lifetime), a few people do use these features together for very specific usages. And more importantly, writing such a configuration and the request to attack it is trivial. A quick workaround consists in forcing keep-alive off by adding "option httpclose" or "option forceclose" in the frontend. Alternatively, disabling HTTP-based TCP inspection rules enough if the application supports it. At first glance, this bug does not look like it could lead to remote code execution, as the overflowing part is controlled by the configuration and not by the user. But some deeper analysis should be performed to confirm this. And anyway, corrupting the process' memory and crashing it is quite trivial. Special thanks go to Yves Lafon from the W3C who reported this bug and deployed significant efforts to collect the relevant data needed to understand it in less than one week. CVE-2013-1912 was assigned to this issue. Note that 1.4 is also affected so the fix must be backported. (cherry picked from commit aae75e3279c6c9bd136413a72dafdcd4986bb89a)
mss_manifest_load_utf16 (gunichar2 * utf16_ne, const guint8 * utf16_data, gsize data_size, guint data_endianness) { memcpy (utf16_ne, utf16_data, data_size); if (data_endianness != G_BYTE_ORDER) { guint i; for (i = 0; i < data_size / 2; ++i) utf16_ne[i] = GUINT16_SWAP_LE_BE (utf16_ne[i]); } }
0
[ "CWE-125" ]
gst-plugins-base
2fdccfd64fc609e44e9c4b8eed5bfdc0ab9c9095
249,007,578,544,463,100,000,000,000,000,000,000,000
11
typefind: bounds check windows ico detection Fixes out of bounds read https://bugzilla.gnome.org/show_bug.cgi?id=774902
void gf_m2ts_reset_parsers_for_program(GF_M2TS_Demuxer *ts, GF_M2TS_Program *prog) { u32 i; for (i=0; i<GF_M2TS_MAX_STREAMS; i++) { GF_M2TS_ES *es = (GF_M2TS_ES *) ts->ess[i]; if (!es) continue; if (prog && (es->program != prog) ) continue; if (es->flags & GF_M2TS_ES_IS_SECTION) { GF_M2TS_SECTION_ES *ses = (GF_M2TS_SECTION_ES *)es; gf_m2ts_section_filter_reset(ses->sec); } else { GF_M2TS_PES *pes = (GF_M2TS_PES *)es; if (!pes || (pes->pid==pes->program->pmt_pid)) continue; pes->cc = -1; pes->frame_state = 0; pes->pck_data_len = 0; if (pes->prev_data) gf_free(pes->prev_data); pes->prev_data = NULL; pes->prev_data_len = 0; pes->PTS = pes->DTS = 0; // pes->prev_PTS = 0; // pes->first_dts = 0; pes->pes_len = pes->pes_end_packet_number = pes->pes_start_packet_number = 0; if (pes->buf) gf_free(pes->buf); pes->buf = NULL; if (pes->temi_tc_desc) gf_free(pes->temi_tc_desc); pes->temi_tc_desc = NULL; pes->temi_tc_desc_len = pes->temi_tc_desc_alloc_size = 0; pes->before_last_pcr_value = pes->before_last_pcr_value_pck_number = 0; pes->last_pcr_value = pes->last_pcr_value_pck_number = 0; if (pes->program->pcr_pid==pes->pid) { pes->program->last_pcr_value = pes->program->last_pcr_value_pck_number = 0; pes->program->before_last_pcr_value = pes->program->before_last_pcr_value_pck_number = 0; } } } }
0
[ "CWE-416", "CWE-125" ]
gpac
1ab4860609f2e7a35634930571e7d0531297e090
183,801,348,979,443,300,000,000,000,000,000,000,000
40
fixed potential crash on PMT IOD parse - cf #1268 #1269
int ssl3_client_hello(SSL *s) { unsigned char *buf; unsigned char *p, *d; int i; unsigned long l; int al = 0; #ifndef OPENSSL_NO_COMP int j; SSL_COMP *comp; #endif buf = (unsigned char *)s->init_buf->data; if (s->state == SSL3_ST_CW_CLNT_HELLO_A) { SSL_SESSION *sess = s->session; if ((sess == NULL) || (sess->ssl_version != s->version) || #ifdef OPENSSL_NO_TLSEXT !sess->session_id_length || #else /* * In the case of EAP-FAST, we can have a pre-shared * "ticket" without a session ID. */ (!sess->session_id_length && !sess->tlsext_tick) || #endif (sess->not_resumable)) { if (!ssl_get_new_session(s, 0)) goto err; } if (s->method->version == DTLS_ANY_VERSION) { /* Determine which DTLS version to use */ int options = s->options; /* If DTLS 1.2 disabled correct the version number */ if (options & SSL_OP_NO_DTLSv1_2) { if (tls1_suiteb(s)) { SSLerr(SSL_F_SSL3_CLIENT_HELLO, SSL_R_ONLY_DTLS_1_2_ALLOWED_IN_SUITEB_MODE); goto err; } /* * Disabling all versions is silly: return an error. */ if (options & SSL_OP_NO_DTLSv1) { SSLerr(SSL_F_SSL3_CLIENT_HELLO, SSL_R_WRONG_SSL_VERSION); goto err; } /* * Update method so we don't use any DTLS 1.2 features. */ s->method = DTLSv1_client_method(); s->version = DTLS1_VERSION; } else { /* * We only support one version: update method */ if (options & SSL_OP_NO_DTLSv1) s->method = DTLSv1_2_client_method(); s->version = DTLS1_2_VERSION; } s->client_version = s->version; } /* else use the pre-loaded session */ p = s->s3->client_random; /* * for DTLS if client_random is initialized, reuse it, we are * required to use same upon reply to HelloVerify */ if (SSL_IS_DTLS(s)) { size_t idx; i = 1; for (idx = 0; idx < sizeof(s->s3->client_random); idx++) { if (p[idx]) { i = 0; break; } } } else i = 1; if (i && ssl_fill_hello_random(s, 0, p, sizeof(s->s3->client_random)) <= 0) goto err; /* Do the message type and length last */ d = p = ssl_handshake_start(s); /*- * version indicates the negotiated version: for example from * an SSLv2/v3 compatible client hello). The client_version * field is the maximum version we permit and it is also * used in RSA encrypted premaster secrets. Some servers can * choke if we initially report a higher version then * renegotiate to a lower one in the premaster secret. This * didn't happen with TLS 1.0 as most servers supported it * but it can with TLS 1.1 or later if the server only supports * 1.0. * * Possible scenario with previous logic: * 1. Client hello indicates TLS 1.2 * 2. Server hello says TLS 1.0 * 3. RSA encrypted premaster secret uses 1.2. * 4. Handhaked proceeds using TLS 1.0. * 5. Server sends hello request to renegotiate. * 6. Client hello indicates TLS v1.0 as we now * know that is maximum server supports. * 7. Server chokes on RSA encrypted premaster secret * containing version 1.0. * * For interoperability it should be OK to always use the * maximum version we support in client hello and then rely * on the checking of version to ensure the servers isn't * being inconsistent: for example initially negotiating with * TLS 1.0 and renegotiating with TLS 1.2. We do this by using * client_version in client hello and not resetting it to * the negotiated version. */ #if 0 *(p++) = s->version >> 8; *(p++) = s->version & 0xff; s->client_version = s->version; #else *(p++) = s->client_version >> 8; *(p++) = s->client_version & 0xff; #endif /* Random stuff */ memcpy(p, s->s3->client_random, SSL3_RANDOM_SIZE); p += SSL3_RANDOM_SIZE; /* Session ID */ if (s->new_session) i = 0; else i = s->session->session_id_length; *(p++) = i; if (i != 0) { if (i > (int)sizeof(s->session->session_id)) { SSLerr(SSL_F_SSL3_CLIENT_HELLO, ERR_R_INTERNAL_ERROR); goto err; } memcpy(p, s->session->session_id, i); p += i; } /* cookie stuff for DTLS */ if (SSL_IS_DTLS(s)) { if (s->d1->cookie_len > sizeof(s->d1->cookie)) { SSLerr(SSL_F_SSL3_CLIENT_HELLO, ERR_R_INTERNAL_ERROR); goto err; } *(p++) = s->d1->cookie_len; memcpy(p, s->d1->cookie, s->d1->cookie_len); p += s->d1->cookie_len; } /* Ciphers supported */ i = ssl_cipher_list_to_bytes(s, SSL_get_ciphers(s), &(p[2]), 0); if (i == 0) { SSLerr(SSL_F_SSL3_CLIENT_HELLO, SSL_R_NO_CIPHERS_AVAILABLE); goto err; } #ifdef OPENSSL_MAX_TLS1_2_CIPHER_LENGTH /* * Some servers hang if client hello > 256 bytes as hack workaround * chop number of supported ciphers to keep it well below this if we * use TLS v1.2 */ if (TLS1_get_version(s) >= TLS1_2_VERSION && i > OPENSSL_MAX_TLS1_2_CIPHER_LENGTH) i = OPENSSL_MAX_TLS1_2_CIPHER_LENGTH & ~1; #endif s2n(i, p); p += i; /* COMPRESSION */ #ifdef OPENSSL_NO_COMP *(p++) = 1; #else if ((s->options & SSL_OP_NO_COMPRESSION) || !s->ctx->comp_methods) j = 0; else j = sk_SSL_COMP_num(s->ctx->comp_methods); *(p++) = 1 + j; for (i = 0; i < j; i++) { comp = sk_SSL_COMP_value(s->ctx->comp_methods, i); *(p++) = comp->id; } #endif *(p++) = 0; /* Add the NULL method */ #ifndef OPENSSL_NO_TLSEXT /* TLS extensions */ if (ssl_prepare_clienthello_tlsext(s) <= 0) { SSLerr(SSL_F_SSL3_CLIENT_HELLO, SSL_R_CLIENTHELLO_TLSEXT); goto err; } if ((p = ssl_add_clienthello_tlsext(s, p, buf + SSL3_RT_MAX_PLAIN_LENGTH, &al)) == NULL) { ssl3_send_alert(s, SSL3_AL_FATAL, al); SSLerr(SSL_F_SSL3_CLIENT_HELLO, ERR_R_INTERNAL_ERROR); goto err; } #endif l = p - d; ssl_set_handshake_header(s, SSL3_MT_CLIENT_HELLO, l); s->state = SSL3_ST_CW_CLNT_HELLO_B; } /* SSL3_ST_CW_CLNT_HELLO_B */ return ssl_do_write(s); err: s->state = SSL_ST_ERR; return (-1); }
0
[ "CWE-310" ]
openssl
10a70da729948bb573d27cef4459077c49f3eb46
214,411,070,105,184,360,000,000,000,000,000,000,000
220
client: reject handshakes with DH parameters < 768 bits. Since the client has no way of communicating her supported parameter range to the server, connections to servers that choose weak DH will simply fail. Reviewed-by: Kurt Roeckx <[email protected]>
static int check_cfg(struct bpf_verifier_env *env) { struct bpf_insn *insns = env->prog->insnsi; int insn_cnt = env->prog->len; int ret = 0; int i, t; insn_state = kcalloc(insn_cnt, sizeof(int), GFP_KERNEL); if (!insn_state) return -ENOMEM; insn_stack = kcalloc(insn_cnt, sizeof(int), GFP_KERNEL); if (!insn_stack) { kfree(insn_state); return -ENOMEM; } insn_state[0] = DISCOVERED; /* mark 1st insn as discovered */ insn_stack[0] = 0; /* 0 is the first instruction */ cur_stack = 1; peek_stack: if (cur_stack == 0) goto check_state; t = insn_stack[cur_stack - 1]; if (BPF_CLASS(insns[t].code) == BPF_JMP) { u8 opcode = BPF_OP(insns[t].code); if (opcode == BPF_EXIT) { goto mark_explored; } else if (opcode == BPF_CALL) { ret = push_insn(t, t + 1, FALLTHROUGH, env); if (ret == 1) goto peek_stack; else if (ret < 0) goto err_free; if (t + 1 < insn_cnt) env->explored_states[t + 1] = STATE_LIST_MARK; } else if (opcode == BPF_JA) { if (BPF_SRC(insns[t].code) != BPF_K) { ret = -EINVAL; goto err_free; } /* unconditional jump with single edge */ ret = push_insn(t, t + insns[t].off + 1, FALLTHROUGH, env); if (ret == 1) goto peek_stack; else if (ret < 0) goto err_free; /* tell verifier to check for equivalent states * after every call and jump */ if (t + 1 < insn_cnt) env->explored_states[t + 1] = STATE_LIST_MARK; } else { /* conditional jump with two edges */ ret = push_insn(t, t + 1, FALLTHROUGH, env); if (ret == 1) goto peek_stack; else if (ret < 0) goto err_free; ret = push_insn(t, t + insns[t].off + 1, BRANCH, env); if (ret == 1) goto peek_stack; else if (ret < 0) goto err_free; } } else { /* all other non-branch instructions with single * fall-through edge */ ret = push_insn(t, t + 1, FALLTHROUGH, env); if (ret == 1) goto peek_stack; else if (ret < 0) goto err_free; } mark_explored: insn_state[t] = EXPLORED; if (cur_stack-- <= 0) { verbose("pop stack internal bug\n"); ret = -EFAULT; goto err_free; } goto peek_stack; check_state: for (i = 0; i < insn_cnt; i++) { if (insn_state[i] != EXPLORED) { verbose("unreachable insn %d\n", i); ret = -EINVAL; goto err_free; } } ret = 0; /* cfg looks good */ err_free: kfree(insn_state); kfree(insn_stack); return ret; }
0
[ "CWE-200" ]
linux
0d0e57697f162da4aa218b5feafe614fb666db07
193,354,474,181,926,830,000,000,000,000,000,000,000
105
bpf: don't let ldimm64 leak map addresses on unprivileged The patch fixes two things at once: 1) It checks the env->allow_ptr_leaks and only prints the map address to the log if we have the privileges to do so, otherwise it just dumps 0 as we would when kptr_restrict is enabled on %pK. Given the latter is off by default and not every distro sets it, I don't want to rely on this, hence the 0 by default for unprivileged. 2) Printing of ldimm64 in the verifier log is currently broken in that we don't print the full immediate, but only the 32 bit part of the first insn part for ldimm64. Thus, fix this up as well; it's okay to access, since we verified all ldimm64 earlier already (including just constants) through replace_map_fd_with_map_ptr(). Fixes: 1be7f75d1668 ("bpf: enable non-root eBPF programs") Fixes: cbd357008604 ("bpf: verifier (add ability to receive verification log)") Reported-by: Jann Horn <[email protected]> Signed-off-by: Daniel Borkmann <[email protected]> Acked-by: Alexei Starovoitov <[email protected]> Signed-off-by: David S. Miller <[email protected]>
static char *theme_format_compress_colors(THEME_REC *theme, const char *format) { GString *str; char *ret; char last_fg, last_bg; str = g_string_new(NULL); last_fg = last_bg = '\0'; while (*format != '\0') { if (*format == '$') { /* $variable, skrip it entirely */ theme_format_append_variable(str, &format); last_fg = last_bg = '\0'; } else if (*format != '%') { /* a normal character */ g_string_append_c(str, *format); format++; } else { /* %format */ format++; if (IS_OLD_FORMAT(*format, last_fg, last_bg)) { /* active color set again */ } else if (IS_FGCOLOR_FORMAT(*format) && format[1] == '%' && IS_FGCOLOR_FORMAT(format[2]) && (*format != 'n' || format[2] == 'n')) { /* two fg colors in a row. bg colors are so rare that we don't bother checking them */ } else { /* some format, add it */ g_string_append_c(str, '%'); g_string_append_c(str, *format); if (IS_FGCOLOR_FORMAT(*format)) last_fg = *format; else if (*format == 'Z' || *format == 'X') last_fg = '\0'; if (IS_BGCOLOR_FORMAT(*format)) last_bg = *format; else if (*format == 'z' || *format == 'x') last_bg = '\0'; } format++; } } ret = str->str; g_string_free(str, FALSE); return ret; }
1
[ "CWE-416" ]
irssi
43e44d553d44e313003cee87e6ea5e24d68b84a1
69,901,498,732,086,660,000,000,000,000,000,000,000
52
Merge branch 'security' into 'master' Security Closes GL#12, GL#13, GL#14, GL#15, GL#16 See merge request irssi/irssi!23
void* Init(TfLiteContext* context, const char* buffer, size_t length) { auto* data = new TfLiteAudioSpectrogramParams; const uint8_t* buffer_t = reinterpret_cast<const uint8_t*>(buffer); const flexbuffers::Map& m = flexbuffers::GetRoot(buffer_t, length).AsMap(); data->window_size = m["window_size"].AsInt64(); data->stride = m["stride"].AsInt64(); data->magnitude_squared = m["magnitude_squared"].AsBool(); data->spectrogram = new internal::Spectrogram; return data; }
0
[ "CWE-125", "CWE-787" ]
tensorflow
1970c2158b1ffa416d159d03c3370b9a462aee35
5,039,246,355,995,622,000,000,000,000,000,000,000
14
[tflite]: Insert `nullptr` checks when obtaining tensors. As part of ongoing refactoring, `tflite::GetInput`, `tflite::GetOutput`, `tflite::GetTemporary` and `tflite::GetIntermediates` will return `nullptr` in some cases. Hence, we insert the `nullptr` checks on all usages. We also insert `nullptr` checks on usages of `tflite::GetVariableInput` and `tflite::GetOptionalInputTensor` but only in the cases where there is no obvious check that `nullptr` is acceptable (that is, we only insert the check for the output of these two functions if the tensor is accessed as if it is always not `nullptr`). PiperOrigin-RevId: 332521299 Change-Id: I29af455bcb48d0b92e58132d951a3badbd772d56
tls_getc(void) { if (ssl_xfer_buffer_lwm >= ssl_xfer_buffer_hwm) { int error; int inbytes; DEBUG(D_tls) debug_printf("Calling SSL_read(%p, %p, %u)\n", server_ssl, ssl_xfer_buffer, ssl_xfer_buffer_size); if (smtp_receive_timeout > 0) alarm(smtp_receive_timeout); inbytes = SSL_read(server_ssl, CS ssl_xfer_buffer, ssl_xfer_buffer_size); error = SSL_get_error(server_ssl, inbytes); alarm(0); /* SSL_ERROR_ZERO_RETURN appears to mean that the SSL session has been closed down, not that the socket itself has been closed down. Revert to non-SSL handling. */ if (error == SSL_ERROR_ZERO_RETURN) { DEBUG(D_tls) debug_printf("Got SSL_ERROR_ZERO_RETURN\n"); receive_getc = smtp_getc; receive_ungetc = smtp_ungetc; receive_feof = smtp_feof; receive_ferror = smtp_ferror; receive_smtp_buffered = smtp_buffered; SSL_free(server_ssl); server_ssl = NULL; tls_in.active = -1; tls_in.bits = 0; tls_in.cipher = NULL; tls_in.peerdn = NULL; tls_in.sni = NULL; return smtp_getc(); } /* Handle genuine errors */ else if (error == SSL_ERROR_SSL) { ERR_error_string(ERR_get_error(), ssl_errstring); log_write(0, LOG_MAIN, "TLS error (SSL_read): %s", ssl_errstring); ssl_xfer_error = 1; return EOF; } else if (error != SSL_ERROR_NONE) { DEBUG(D_tls) debug_printf("Got SSL error %d\n", error); ssl_xfer_error = 1; return EOF; } #ifndef DISABLE_DKIM dkim_exim_verify_feed(ssl_xfer_buffer, inbytes); #endif ssl_xfer_buffer_hwm = inbytes; ssl_xfer_buffer_lwm = 0; } /* Something in the buffer; return next uschar */ return ssl_xfer_buffer[ssl_xfer_buffer_lwm++]; }
0
[ "CWE-264" ]
exim
43ba2742c700d625dcdcdaf7bbadc2f72776854a
15,077,646,282,595,030,000,000,000,000,000,000,000
68
Fix CVE-2016-1531 Add keep_environment, add_environment. Change the working directory to "/" during the early startup phase. (cherry picked from commit bc3c7bb7d4aba3e563434e5627fe1f2176aa18c0) (cherry picked from commit 2b92b67bfc33efe05e6ff2ea3852731ac2273832) (cherry picked from commit 14b82c8b736c8ed24eda144f57703cb9feac6323) (cherry picked from commit 9ca92d0c6e9c6f161bd8111366c6952d3a9315e2) (cherry picked from commit 0020c6d9ecfd98ed7b2b337ed4f898fdc409784b) (cherry picked from commit e8f96966360ea8867ad6a8b5affda6c37fa4958c) (cherry picked from commit ef6fb807c1e1a665f444f644c60c77269f7c5209)
bool ServerDB::prepare(QSqlQuery &query, const QString &str, bool fatal, bool warn) { if (! db->isValid()) { qWarning("SQL [%s] rejected: Database is gone", qPrintable(str)); return false; } QString q; if (str.contains(QLatin1String("%1"))) q = str.arg(Meta::mp.qsDBPrefix); else q = str; if (query.prepare(q)) { return true; } else { db->close(); if (! db->open()) { qFatal("Lost connection to SQL Database: Reconnect: %s", qPrintable(db->lastError().text())); } query = QSqlQuery(); if (query.prepare(q)) { qWarning("SQL Connection lost, reconnection OK"); return true; } if (fatal) { *db = QSqlDatabase(); qFatal("SQL Prepare Error [%s]: %s", qPrintable(q), qPrintable(query.lastError().text())); } else if (warn) { qDebug("SQL Prepare Error [%s]: %s", qPrintable(q), qPrintable(query.lastError().text())); } return false; } }
0
[ "CWE-20" ]
mumble
6b33dda344f89e5a039b7d79eb43925040654242
109,167,529,018,394,400,000,000,000,000,000,000,000
33
Don't crash on long usernames
get4c(FILE *fd) { int c; // Use unsigned rather than int otherwise result is undefined // when left-shift sets the MSB. unsigned n; c = getc(fd); if (c == EOF) return -1; n = (unsigned)c; c = getc(fd); if (c == EOF) return -1; n = (n << 8) + (unsigned)c; c = getc(fd); if (c == EOF) return -1; n = (n << 8) + (unsigned)c; c = getc(fd); if (c == EOF) return -1; n = (n << 8) + (unsigned)c; return (int)n; }
0
[ "CWE-120" ]
vim
7ce5b2b590256ce53d6af28c1d203fb3bc1d2d97
131,971,921,555,845,100,000,000,000,000,000,000,000
21
patch 8.2.4969: changing text in Visual mode may cause invalid memory access Problem: Changing text in Visual mode may cause invalid memory access. Solution: Check the Visual position after making a change.
PHPAPI void php_fgetcsv(php_stream *stream, char delimiter, char enclosure, char escape_char, size_t buf_len, char *buf, zval *return_value TSRMLS_DC) /* {{{ */ { char *temp, *tptr, *bptr, *line_end, *limit; size_t temp_len, line_end_len; int inc_len; zend_bool first_field = 1; /* initialize internal state */ php_mblen(NULL, 0); /* Now into new section that parses buf for delimiter/enclosure fields */ /* Strip trailing space from buf, saving end of line in case required for enclosure field */ bptr = buf; tptr = (char *)php_fgetcsv_lookup_trailing_spaces(buf, buf_len, delimiter TSRMLS_CC); line_end_len = buf_len - (size_t)(tptr - buf); line_end = limit = tptr; /* reserve workspace for building each individual field */ temp_len = buf_len; temp = emalloc(temp_len + line_end_len + 1); /* Initialize return array */ array_init(return_value); /* Main loop to read CSV fields */ /* NB this routine will return a single null entry for a blank line */ do { char *comp_end, *hunk_begin; tptr = temp; /* 1. Strip any leading space */ for (;;) { inc_len = (bptr < limit ? (*bptr == '\0' ? 1: php_mblen(bptr, limit - bptr)): 0); switch (inc_len) { case -2: case -1: inc_len = 1; php_mblen(NULL, 0); break; case 0: goto quit_loop_1; case 1: if (!isspace((int)*(unsigned char *)bptr) || *bptr == delimiter) { goto quit_loop_1; } break; default: goto quit_loop_1; } bptr += inc_len; } quit_loop_1: if (first_field && bptr == line_end) { add_next_index_null(return_value); break; } first_field = 0; /* 2. Read field, leaving bptr pointing at start of next field */ if (inc_len != 0 && *bptr == enclosure) { int state = 0; bptr++; /* move on to first character in field */ hunk_begin = bptr; /* 2A. handle enclosure delimited field */ for (;;) { switch (inc_len) { case 0: switch (state) { case 2: memcpy(tptr, hunk_begin, bptr - hunk_begin - 1); tptr += (bptr - hunk_begin - 1); hunk_begin = bptr; goto quit_loop_2; case 1: memcpy(tptr, hunk_begin, bptr - hunk_begin); tptr += (bptr - hunk_begin); hunk_begin = bptr; /* break is omitted intentionally */ case 0: { char *new_buf; size_t new_len; char *new_temp; if (hunk_begin != line_end) { memcpy(tptr, hunk_begin, bptr - hunk_begin); tptr += (bptr - hunk_begin); hunk_begin = bptr; } /* add the embedded line end to the field */ memcpy(tptr, line_end, line_end_len); tptr += line_end_len; if (stream == NULL) { goto quit_loop_2; } else if ((new_buf = php_stream_get_line(stream, NULL, 0, &new_len)) == NULL) { /* we've got an unterminated enclosure, * assign all the data from the start of * the enclosure to end of data to the * last element */ if ((size_t)temp_len > (size_t)(limit - buf)) { goto quit_loop_2; } zval_dtor(return_value); RETVAL_FALSE; goto out; } temp_len += new_len; new_temp = erealloc(temp, temp_len); tptr = new_temp + (size_t)(tptr - temp); temp = new_temp; efree(buf); buf_len = new_len; bptr = buf = new_buf; hunk_begin = buf; line_end = limit = (char *)php_fgetcsv_lookup_trailing_spaces(buf, buf_len, delimiter TSRMLS_CC); line_end_len = buf_len - (size_t)(limit - buf); state = 0; } break; } break; case -2: case -1: php_mblen(NULL, 0); /* break is omitted intentionally */ case 1: /* we need to determine if the enclosure is * 'real' or is it escaped */ switch (state) { case 1: /* escaped */ bptr++; state = 0; break; case 2: /* embedded enclosure ? let's check it */ if (*bptr != enclosure) { /* real enclosure */ memcpy(tptr, hunk_begin, bptr - hunk_begin - 1); tptr += (bptr - hunk_begin - 1); hunk_begin = bptr; goto quit_loop_2; } memcpy(tptr, hunk_begin, bptr - hunk_begin); tptr += (bptr - hunk_begin); bptr++; hunk_begin = bptr; state = 0; break; default: if (*bptr == enclosure) { state = 2; } else if (*bptr == escape_char) { state = 1; } bptr++; break; } break; default: switch (state) { case 2: /* real enclosure */ memcpy(tptr, hunk_begin, bptr - hunk_begin - 1); tptr += (bptr - hunk_begin - 1); hunk_begin = bptr; goto quit_loop_2; case 1: bptr += inc_len; memcpy(tptr, hunk_begin, bptr - hunk_begin); tptr += (bptr - hunk_begin); hunk_begin = bptr; break; default: bptr += inc_len; break; } break; } inc_len = (bptr < limit ? (*bptr == '\0' ? 1: php_mblen(bptr, limit - bptr)): 0); } quit_loop_2: /* look up for a delimiter */ for (;;) { switch (inc_len) { case 0: goto quit_loop_3; case -2: case -1: inc_len = 1; php_mblen(NULL, 0); /* break is omitted intentionally */ case 1: if (*bptr == delimiter) { goto quit_loop_3; } break; default: break; } bptr += inc_len; inc_len = (bptr < limit ? (*bptr == '\0' ? 1: php_mblen(bptr, limit - bptr)): 0); } quit_loop_3: memcpy(tptr, hunk_begin, bptr - hunk_begin); tptr += (bptr - hunk_begin); bptr += inc_len; comp_end = tptr; } else { /* 2B. Handle non-enclosure field */ hunk_begin = bptr; for (;;) { switch (inc_len) { case 0: goto quit_loop_4; case -2: case -1: inc_len = 1; php_mblen(NULL, 0); /* break is omitted intentionally */ case 1: if (*bptr == delimiter) { goto quit_loop_4; } break; default: break; } bptr += inc_len; inc_len = (bptr < limit ? (*bptr == '\0' ? 1: php_mblen(bptr, limit - bptr)): 0); } quit_loop_4: memcpy(tptr, hunk_begin, bptr - hunk_begin); tptr += (bptr - hunk_begin); comp_end = (char *)php_fgetcsv_lookup_trailing_spaces(temp, tptr - temp, delimiter TSRMLS_CC); if (*bptr == delimiter) { bptr++; } } /* 3. Now pass our field back to php */ *comp_end = '\0'; add_next_index_stringl(return_value, temp, comp_end - temp, 1); } while (inc_len > 0); out: efree(temp); if (stream) { efree(buf); } }
0
[]
php-src
ce96fd6b0761d98353761bf78d5bfb55291179fd
323,176,820,151,095,000,000,000,000,000,000,000,000
268
- fix #39863, do not accept paths with NULL in them. See http://news.php.net/php.internals/50191, trunk will have the patch later (adding a macro and/or changing (some) APIs. Patch by Rasmus
getoid(FILE * fp, struct subid_s *id, /* an array of subids */ int length) { /* the length of the array */ register int count; int type; char token[MAXTOKEN]; if ((type = get_token(fp, token, MAXTOKEN)) != LEFTBRACKET) { print_error("Expected \"{\"", token, type); return 0; } type = get_token(fp, token, MAXTOKEN); for (count = 0; count < length; count++, id++) { id->label = NULL; id->modid = current_module; id->subid = -1; if (type == RIGHTBRACKET) return count; if (type == LABEL) { /* * this entry has a label */ id->label = strdup(token); type = get_token(fp, token, MAXTOKEN); if (type == LEFTPAREN) { type = get_token(fp, token, MAXTOKEN); if (type == NUMBER) { id->subid = strtoul(token, NULL, 10); if ((type = get_token(fp, token, MAXTOKEN)) != RIGHTPAREN) { print_error("Expected a closing parenthesis", token, type); return 0; } } else { print_error("Expected a number", token, type); return 0; } } else { continue; } } else if (type == NUMBER) { /* * this entry has just an integer sub-identifier */ id->subid = strtoul(token, NULL, 10); } else { print_error("Expected label or number", token, type); return 0; } type = get_token(fp, token, MAXTOKEN); } print_error("Too long OID", token, type); return 0; }
0
[ "CWE-59", "CWE-61" ]
net-snmp
4fd9a450444a434a993bc72f7c3486ccce41f602
215,358,730,819,436,700,000,000,000,000,000,000,000
55
CHANGES: snmpd: Stop reading and writing the mib_indexes/* files Caching directory contents is something the operating system should do and is not something Net-SNMP should do. Instead of storing a copy of the directory contents in ${tmp_dir}/mib_indexes/${n}, always scan a MIB directory.
parse_SET_IPV4_DST(char *arg, const struct ofpact_parse_params *pp) { return str_to_ip(arg, &ofpact_put_SET_IPV4_DST(pp->ofpacts)->ipv4); }
0
[ "CWE-416" ]
ovs
77cccc74deede443e8b9102299efc869a52b65b2
216,661,946,667,091,900,000,000,000,000,000,000,000
4
ofp-actions: Fix use-after-free while decoding RAW_ENCAP. While decoding RAW_ENCAP action, decode_ed_prop() might re-allocate ofpbuf if there is no enough space left. However, function 'decode_NXAST_RAW_ENCAP' continues to use old pointer to 'encap' structure leading to write-after-free and incorrect decoding. ==3549105==ERROR: AddressSanitizer: heap-use-after-free on address 0x60600000011a at pc 0x0000005f6cc6 bp 0x7ffc3a2d4410 sp 0x7ffc3a2d4408 WRITE of size 2 at 0x60600000011a thread T0 #0 0x5f6cc5 in decode_NXAST_RAW_ENCAP lib/ofp-actions.c:4461:20 #1 0x5f0551 in ofpact_decode ./lib/ofp-actions.inc2:4777:16 #2 0x5ed17c in ofpacts_decode lib/ofp-actions.c:7752:21 #3 0x5eba9a in ofpacts_pull_openflow_actions__ lib/ofp-actions.c:7791:13 #4 0x5eb9fc in ofpacts_pull_openflow_actions lib/ofp-actions.c:7835:12 #5 0x64bb8b in ofputil_decode_packet_out lib/ofp-packet.c:1113:17 #6 0x65b6f4 in ofp_print_packet_out lib/ofp-print.c:148:13 #7 0x659e3f in ofp_to_string__ lib/ofp-print.c:1029:16 #8 0x659b24 in ofp_to_string lib/ofp-print.c:1244:21 #9 0x65a28c in ofp_print lib/ofp-print.c:1288:28 #10 0x540d11 in ofctl_ofp_parse utilities/ovs-ofctl.c:2814:9 #11 0x564228 in ovs_cmdl_run_command__ lib/command-line.c:247:17 #12 0x56408a in ovs_cmdl_run_command lib/command-line.c:278:5 #13 0x5391ae in main utilities/ovs-ofctl.c:179:9 #14 0x7f6911ce9081 in __libc_start_main (/lib64/libc.so.6+0x27081) #15 0x461fed in _start (utilities/ovs-ofctl+0x461fed) Fix that by getting a new pointer before using. Credit to OSS-Fuzz. Fuzzer regression test will fail only with AddressSanitizer enabled. Reported-at: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=27851 Fixes: f839892a206a ("OF support and translation of generic encap and decap") Acked-by: William Tu <[email protected]> Signed-off-by: Ilya Maximets <[email protected]>
create_workers(verto_ctx *ctx, int num) { krb5_error_code retval; int i, status; pid_t pid, *pids; #ifdef POSIX_SIGNALS struct sigaction s_action; #endif /* POSIX_SIGNALS */ /* * Setup our signal handlers which will forward to the children. * These handlers will be overriden in the child processes. */ #ifdef POSIX_SIGNALS (void) sigemptyset(&s_action.sa_mask); s_action.sa_flags = 0; s_action.sa_handler = on_monitor_signal; (void) sigaction(SIGINT, &s_action, (struct sigaction *) NULL); (void) sigaction(SIGTERM, &s_action, (struct sigaction *) NULL); (void) sigaction(SIGQUIT, &s_action, (struct sigaction *) NULL); s_action.sa_handler = on_monitor_sighup; (void) sigaction(SIGHUP, &s_action, (struct sigaction *) NULL); #else /* POSIX_SIGNALS */ signal(SIGINT, on_monitor_signal); signal(SIGTERM, on_monitor_signal); signal(SIGQUIT, on_monitor_signal); signal(SIGHUP, on_monitor_sighup); #endif /* POSIX_SIGNALS */ /* Create child worker processes; return in each child. */ krb5_klog_syslog(LOG_INFO, _("creating %d worker processes"), num); pids = calloc(num, sizeof(pid_t)); if (pids == NULL) return ENOMEM; for (i = 0; i < num; i++) { pid = fork(); if (pid == 0) { if (!verto_reinitialize(ctx)) { krb5_klog_syslog(LOG_ERR, _("Unable to reinitialize main loop")); return ENOMEM; } retval = loop_setup_signals(ctx, NULL, reset_for_hangup); if (retval) { krb5_klog_syslog(LOG_ERR, _("Unable to initialize signal " "handlers in pid %d"), pid); return retval; } /* Avoid race condition */ if (signal_received) exit(0); /* Return control to main() in the new worker process. */ free(pids); return 0; } if (pid == -1) { /* Couldn't fork enough times. */ status = errno; terminate_workers(pids, i); free(pids); return status; } pids[i] = pid; } /* We're going to use our own main loop here. */ loop_free(ctx); /* Supervise the worker processes. */ while (!signal_received) { /* Wait until a worker process exits or we get a signal. */ pid = wait(&status); if (pid >= 0) { krb5_klog_syslog(LOG_ERR, _("worker %ld exited with status %d"), (long) pid, status); /* Remove the pid from the table. */ for (i = 0; i < num; i++) { if (pids[i] == pid) pids[i] = -1; } /* When one worker process exits, terminate them all, so that KDC * crashes behave similarly with or without worker processes. */ break; } /* Propagate HUP signal to worker processes if we received one. */ if (sighup_received) { sighup_received = 0; for (i = 0; i < num; i++) { if (pids[i] != -1) kill(pids[i], SIGHUP); } } } if (signal_received) krb5_klog_syslog(LOG_INFO, _("signal %d received in supervisor"), signal_received); terminate_workers(pids, num); free(pids); exit(0); }
0
[ "CWE-703" ]
krb5
c2ccf4197f697c4ff143b8a786acdd875e70a89d
324,498,770,357,427,560,000,000,000,000,000,000,000
106
Multi-realm KDC null deref [CVE-2013-1418] If a KDC serves multiple realms, certain requests can cause setup_server_realm() to dereference a null pointer, crashing the KDC. CVSSv2: AV:N/AC:M/Au:N/C:N/I:N/A:P/E:POC/RL:OF/RC:C A related but more minor vulnerability requires authentication to exploit, and is only present if a third-party KDC database module can dereference a null pointer under certain conditions. (back ported from commit 5d2d9a1abe46a2c1a8614d4672d08d9d30a5f8bf) ticket: 7757 (new) version_fixed: 1.10.7 status: resolved
int bcf_get_variant_types(bcf1_t *rec) { if ( rec->d.var_type==-1 ) bcf_set_variant_types(rec); return rec->d.var_type; }
0
[ "CWE-787" ]
htslib
dcd4b7304941a8832fba2d0fc4c1e716e7a4e72c
325,662,364,669,824,400,000,000,000,000,000,000,000
5
Fix check for VCF record size The check for excessive record size in vcf_parse_format() only looked at individual fields. It was therefore possible to exceed the limit and overflow fmt_aux_t::offset by having multiple fields with a combined size that went over INT_MAX. Fix by including the amount of memory used so far in the check. Credit to OSS-Fuzz Fixes oss-fuzz 24097
getprivs_ret * get_privs_2_svc(krb5_ui_4 *arg, struct svc_req *rqstp) { static getprivs_ret ret; gss_buffer_desc client_name, service_name; OM_uint32 minor_stat; kadm5_server_handle_t handle; const char *errmsg = NULL; xdr_free(xdr_getprivs_ret, &ret); if ((ret.code = new_server_handle(*arg, rqstp, &handle))) goto exit_func; if ((ret.code = check_handle((void *)handle))) goto exit_func; ret.api_version = handle->api_version; if (setup_gss_names(rqstp, &client_name, &service_name) < 0) { ret.code = KADM5_FAILURE; goto exit_func; } ret.code = kadm5_get_privs((void *)handle, &ret.privs); if( ret.code != 0 ) errmsg = krb5_get_error_message(handle->context, ret.code); log_done("kadm5_get_privs", client_name.value, errmsg, &client_name, &service_name, rqstp); if (errmsg != NULL) krb5_free_error_message(handle->context, errmsg); gss_release_buffer(&minor_stat, &client_name); gss_release_buffer(&minor_stat, &service_name); exit_func: free_server_handle(handle); return &ret; }
1
[ "CWE-119", "CWE-772", "CWE-401" ]
krb5
83ed75feba32e46f736fcce0d96a0445f29b96c2
25,108,696,959,963,006,000,000,000,000,000,000,000
39
Fix leaks in kadmin server stubs [CVE-2015-8631] In each kadmind server stub, initialize the client_name and server_name variables, and release them in the cleanup handler. Many of the stubs will otherwise leak the client and server name if krb5_unparse_name() fails. Also make sure to free the prime_arg variables in rename_principal_2_svc(), or we can leak the first one if unparsing the second one fails. Discovered by Simo Sorce. CVE-2015-8631: In all versions of MIT krb5, an authenticated attacker can cause kadmind to leak memory by supplying a null principal name in a request which uses one. Repeating these requests will eventually cause kadmind to exhaust all available memory. CVSSv2 Vector: AV:N/AC:L/Au:S/C:N/I:N/A:C/E:POC/RL:OF/RC:C ticket: 8343 (new) target_version: 1.14-next target_version: 1.13-next tags: pullup
int dev_queue_xmit_accel(struct sk_buff *skb, struct net_device *sb_dev) { return __dev_queue_xmit(skb, sb_dev);
0
[ "CWE-416" ]
linux
a4270d6795b0580287453ea55974d948393e66ef
160,737,157,371,186,630,000,000,000,000,000,000,000
4
net-gro: fix use-after-free read in napi_gro_frags() If a network driver provides to napi_gro_frags() an skb with a page fragment of exactly 14 bytes, the call to gro_pull_from_frag0() will 'consume' the fragment by calling skb_frag_unref(skb, 0), and the page might be freed and reused. Reading eth->h_proto at the end of napi_frags_skb() might read mangled data, or crash under specific debugging features. BUG: KASAN: use-after-free in napi_frags_skb net/core/dev.c:5833 [inline] BUG: KASAN: use-after-free in napi_gro_frags+0xc6f/0xd10 net/core/dev.c:5841 Read of size 2 at addr ffff88809366840c by task syz-executor599/8957 CPU: 1 PID: 8957 Comm: syz-executor599 Not tainted 5.2.0-rc1+ #32 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011 Call Trace: __dump_stack lib/dump_stack.c:77 [inline] dump_stack+0x172/0x1f0 lib/dump_stack.c:113 print_address_description.cold+0x7c/0x20d mm/kasan/report.c:188 __kasan_report.cold+0x1b/0x40 mm/kasan/report.c:317 kasan_report+0x12/0x20 mm/kasan/common.c:614 __asan_report_load_n_noabort+0xf/0x20 mm/kasan/generic_report.c:142 napi_frags_skb net/core/dev.c:5833 [inline] napi_gro_frags+0xc6f/0xd10 net/core/dev.c:5841 tun_get_user+0x2f3c/0x3ff0 drivers/net/tun.c:1991 tun_chr_write_iter+0xbd/0x156 drivers/net/tun.c:2037 call_write_iter include/linux/fs.h:1872 [inline] do_iter_readv_writev+0x5f8/0x8f0 fs/read_write.c:693 do_iter_write fs/read_write.c:970 [inline] do_iter_write+0x184/0x610 fs/read_write.c:951 vfs_writev+0x1b3/0x2f0 fs/read_write.c:1015 do_writev+0x15b/0x330 fs/read_write.c:1058 Fixes: a50e233c50db ("net-gro: restore frag0 optimization") Signed-off-by: Eric Dumazet <[email protected]> Reported-by: syzbot <[email protected]> Signed-off-by: David S. Miller <[email protected]>
f_uniq(typval_T *argvars, typval_T *rettv) { do_sort_uniq(argvars, rettv, FALSE); }
0
[ "CWE-78" ]
vim
8c62a08faf89663e5633dc5036cd8695c80f1075
52,941,930,300,029,320,000,000,000,000,000,000,000
4
patch 8.1.0881: can execute shell commands in rvim through interfaces Problem: Can execute shell commands in rvim through interfaces. Solution: Disable using interfaces in restricted mode. Allow for writing file with writefile(), histadd() and a few others.
static int ssl_resume_decrypt_pms( mbedtls_ssl_context *ssl, unsigned char *peer_pms, size_t *peer_pmslen, size_t peer_pmssize ) { int ret = ssl->conf->f_async_resume( ssl, peer_pms, peer_pmslen, peer_pmssize ); if( ret != MBEDTLS_ERR_SSL_ASYNC_IN_PROGRESS ) { ssl->handshake->async_in_progress = 0; mbedtls_ssl_set_async_operation_data( ssl, NULL ); } MBEDTLS_SSL_DEBUG_RET( 2, "ssl_decrypt_encrypted_pms", ret ); return( ret ); }
0
[ "CWE-787" ]
mbedtls
f333dfab4a6c2d8a604a61558a8f783145161de4
230,573,378,697,214,060,000,000,000,000,000,000,000
15
More SSL debug messages for ClientHello parsing In particular, be verbose when checking the ClientHello cookie in a possible DTLS reconnection. Signed-off-by: Gilles Peskine <[email protected]>
pixops_medialib_scale (guchar *dest_buf, int dest_width, int dest_height, int dest_rowstride, int dest_channels, int dest_has_alpha, const guchar *src_buf, int src_width, int src_height, int src_rowstride, int src_channels, int src_has_alpha, int dest_x, int dest_y, int dest_region_width, int dest_region_height, double offset_x, double offset_y, double scale_x, double scale_y, PixopsInterpType interp_type) { if (scale_x == 0 || scale_y == 0) return; if (!medialib_initialized) _pixops_use_medialib (); /* * We no longer support mediaLib 2.1 because it has a core dumping problem * in the mlib_ImageZoomTranslateTable function that has been corrected in * 2.2. Although the mediaLib_zoom function could be used, it does not * work properly if the source and destination images have different * values for "has_alpha" or "num_channels". The complicated if-logic * required to support both versions is not worth supporting * mediaLib 2.1 moving forward. */ if (!use_medialib) { _pixops_scale_real (dest_buf + dest_y * dest_rowstride + dest_x * dest_channels, dest_x - offset_x, dest_y - offset_y, dest_x + dest_region_width - offset_x, dest_y + dest_region_height - offset_y, dest_rowstride, dest_channels, dest_has_alpha, src_buf, src_width, src_height, src_rowstride, src_channels, src_has_alpha, scale_x, scale_y, interp_type); } else { mlInterp ml_interp; mlib_image img_orig_src, img_src, img_dest; double ml_offset_x, ml_offset_y; guchar *tmp_buf = NULL; mlib_ImageSetStruct (&img_orig_src, MLIB_BYTE, src_channels, src_width, src_height, src_rowstride, src_buf); if (dest_x == 0 && dest_y == 0 && dest_width == dest_region_width && dest_height == dest_region_height) { mlib_ImageSetStruct (&img_dest, MLIB_BYTE, dest_channels, dest_width, dest_height, dest_rowstride, dest_buf); } else { mlib_u8 *data = dest_buf + (dest_y * dest_rowstride) + (dest_x * dest_channels); mlib_ImageSetStruct (&img_dest, MLIB_BYTE, dest_channels, dest_region_width, dest_region_height, dest_rowstride, data); } ml_offset_x = floor (offset_x) - dest_x; ml_offset_y = floor (offset_y) - dest_y; /* * Note that zoomTranslate and zoomTranslateTable are faster * than zoomTranslateBlend and zoomTranslateTableBlend. However * the faster functions only work in the following case: * * if (src_channels == dest_channels && * (!src_alpha && interp_table != PIXOPS_INTERP_NEAREST)) * * We use the faster versions if we can. * * Note when the interp_type is BILINEAR and the interpolation * table will be size 2x2 (when both x/y scale factors > 1.0), * then we do not bother building the interpolation table. In * this case we can just use MLIB_BILINEAR, which is faster than * using a specified interpolation table. */ img_src = img_orig_src; if (!src_has_alpha) { if (src_channels > dest_channels) { int channels = 3; int rowstride = (channels * src_width + 3) & ~3; tmp_buf = g_malloc (src_rowstride * src_height); if (src_buf != NULL) { src_channels = channels; src_rowstride = rowstride; mlib_ImageSetStruct (&img_src, MLIB_BYTE, src_channels, src_width, src_height, src_rowstride, tmp_buf); mlib_ImageChannelExtract (&img_src, &img_orig_src, 0xE); } } } if (interp_type == PIXOPS_INTERP_NEAREST) { if (src_channels == dest_channels) { mlib_ImageZoomTranslate (&img_dest, &img_src, scale_x, scale_y, ml_offset_x, ml_offset_y, MLIB_NEAREST, MLIB_EDGE_SRC_EXTEND_INDEF); } else { mlib_ImageZoomTranslateBlend (&img_dest, &img_src, scale_x, scale_y, ml_offset_x, ml_offset_y, MLIB_NEAREST, MLIB_EDGE_SRC_EXTEND_INDEF, MLIB_BLEND_GTK_SRC, 1.0, 1); } } else if (src_channels == dest_channels && !src_has_alpha) { if (interp_type == PIXOPS_INTERP_BILINEAR && scale_x > 1.0 && scale_y > 1.0) { mlib_ImageZoomTranslate (&img_dest, &img_src, scale_x, scale_y, ml_offset_x, ml_offset_y, MLIB_BILINEAR, MLIB_EDGE_SRC_EXTEND_INDEF); } else { medialib_get_interpolation (&ml_interp, interp_type, scale_x, scale_y, 1.0); if (ml_interp.interp_table != NULL) { mlib_ImageZoomTranslateTable (&img_dest, &img_src, scale_x, scale_y, ml_offset_x + ml_interp.tx, ml_offset_y + ml_interp.ty, ml_interp.interp_table, MLIB_EDGE_SRC_EXTEND_INDEF); mlib_ImageInterpTableDelete (ml_interp.interp_table); } else { /* Should not happen. */ mlib_filter ml_filter; switch (interp_type) { case PIXOPS_INTERP_BILINEAR: ml_filter = MLIB_BILINEAR; break; case PIXOPS_INTERP_TILES: ml_filter = MLIB_BILINEAR; break; case PIXOPS_INTERP_HYPER: ml_filter = MLIB_BICUBIC; break; } mlib_ImageZoomTranslate (&img_dest, &img_src, scale_x, scale_y, ml_offset_x, ml_offset_y, ml_filter, MLIB_EDGE_SRC_EXTEND_INDEF); } } } /* Deal with case where src_channels != dest_channels || src_has_alpha */ else if (interp_type == PIXOPS_INTERP_BILINEAR && scale_x > 1.0 && scale_y > 1.0) { mlib_ImageZoomTranslateBlend (&img_dest, &img_src, scale_x, scale_y, ml_offset_x, ml_offset_y, MLIB_BILINEAR, MLIB_EDGE_SRC_EXTEND_INDEF, MLIB_BLEND_GTK_SRC, 1.0, 1); } else { medialib_get_interpolation (&ml_interp, interp_type, scale_x, scale_y, 1.0); if (ml_interp.interp_table != NULL) { mlib_ImageZoomTranslateTableBlend (&img_dest, &img_src, scale_x, scale_y, ml_offset_x + ml_interp.tx, ml_offset_y + ml_interp.ty, ml_interp.interp_table, MLIB_EDGE_SRC_EXTEND_INDEF, MLIB_BLEND_GTK_SRC, 1); mlib_ImageInterpTableDelete (ml_interp.interp_table); } else { mlib_filter ml_filter; switch (interp_type) { case PIXOPS_INTERP_BILINEAR: ml_filter = MLIB_BILINEAR; break; case PIXOPS_INTERP_TILES: ml_filter = MLIB_BILINEAR; break; case PIXOPS_INTERP_HYPER: ml_filter = MLIB_BICUBIC; break; } mlib_ImageZoomTranslate (&img_dest, &img_src, scale_x, scale_y, ml_offset_x, ml_offset_y, ml_filter, MLIB_EDGE_SRC_EXTEND_INDEF); } } if (tmp_buf != NULL) g_free (tmp_buf); } }
0
[]
gdk-pixbuf
ffec86ed5010c5a2be14f47b33bcf4ed3169a199
334,808,173,972,072,130,000,000,000,000,000,000,000
280
pixops: Be more careful about integer overflow Our loader code is supposed to handle out-of-memory and overflow situations gracefully, reporting errors instead of aborting. But if you load an image at a specific size, we also execute our scaling code, which was not careful enough about overflow in some places. This commit makes the scaling code silently return if it fails to allocate filter tables. This is the best we can do, since gdk_pixbuf_scale() is not taking a GError. https://bugzilla.gnome.org/show_bug.cgi?id=752297
static inline void sctp_ulpq_reap_ordered(struct sctp_ulpq *ulpq) { struct sk_buff *pos, *tmp; struct sctp_ulpevent *cevent; struct sctp_ulpevent *event; struct sctp_stream *in; struct sk_buff_head temp; __u16 csid, cssn; in = &ulpq->asoc->ssnmap->in; /* We are holding the chunks by stream, by SSN. */ skb_queue_head_init(&temp); event = NULL; sctp_skb_for_each(pos, &ulpq->lobby, tmp) { cevent = (struct sctp_ulpevent *) pos->cb; csid = cevent->stream; cssn = cevent->ssn; if (cssn != sctp_ssn_peek(in, csid)) break; /* Found it, so mark in the ssnmap. */ sctp_ssn_next(in, csid); __skb_unlink(pos, &ulpq->lobby); if (!event) { /* Create a temporary list to collect chunks on. */ event = sctp_skb2event(pos); __skb_queue_tail(&temp, sctp_event2skb(event)); } else { /* Attach all gathered skbs to the event. */ __skb_queue_tail(&temp, pos); } } /* Send event to the ULP. 'event' is the sctp_ulpevent for * very first SKB on the 'temp' list. */ if (event) sctp_ulpq_tail_event(ulpq, event); }
0
[]
linux-2.6
672e7cca17ed6036a1756ed34cf20dbd72d5e5f6
3,798,692,179,248,879,700,000,000,000,000,000,000
42
[SCTP]: Prevent possible infinite recursion with multiple bundled DATA. There is a rare situation that causes lksctp to go into infinite recursion and crash the system. The trigger is a packet that contains at least the first two DATA fragments of a message bundled together. The recursion is triggered when the user data buffer is smaller that the full data message. The problem is that we clone the skb for every fragment in the message. When reassembling the full message, we try to link skbs from the "first fragment" clone using the frag_list. However, since the frag_list is shared between two clones in this rare situation, we end up setting the frag_list pointer of the second fragment to point to itself. This causes sctp_skb_pull() to potentially recurse indefinitely. Proposed solution is to make a copy of the skb when attempting to link things using frag_list. Signed-off-by: Vladislav Yasevich <[email protected]> Signed-off-by: Sridhar Samudrala <[email protected]> Signed-off-by: David S. Miller <[email protected]>
int cil_resolve_blockinherit_link(struct cil_tree_node *current, void *extra_args) { struct cil_blockinherit *inherit = current->data; struct cil_symtab_datum *block_datum = NULL; struct cil_tree_node *node = NULL; int rc = SEPOL_ERR; rc = cil_resolve_name(current, inherit->block_str, CIL_SYM_BLOCKS, extra_args, &block_datum); if (rc != SEPOL_OK) { goto exit; } node = NODE(block_datum); if (node->flavor != CIL_BLOCK) { cil_log(CIL_ERR, "%s is not a block\n", cil_node_to_string(node)); rc = SEPOL_ERR; goto exit; } inherit->block = (struct cil_block *)block_datum; if (inherit->block->bi_nodes == NULL) { cil_list_init(&inherit->block->bi_nodes, CIL_NODE); } cil_list_append(inherit->block->bi_nodes, CIL_NODE, current); return SEPOL_OK; exit: return rc; }
0
[ "CWE-125" ]
selinux
340f0eb7f3673e8aacaf0a96cbfcd4d12a405521
13,558,447,735,051,973,000,000,000,000,000,000,000
32
libsepol/cil: Check for statements not allowed in optional blocks While there are some checks for invalid statements in an optional block when resolving the AST, there are no checks when building the AST. OSS-Fuzz found the following policy which caused a null dereference in cil_tree_get_next_path(). (blockinherit b3) (sid SID) (sidorder(SID)) (optional o (ibpkeycon :(1 0)s) (block b3 (filecon""block()) (filecon""block()))) The problem is that the blockinherit copies block b3 before the optional block is disabled. When the optional is disabled, block b3 is deleted along with everything else in the optional. Later, when filecon statements with the same path are found an error message is produced and in trying to find out where the block was copied from, the reference to the deleted block is used. The error handling code assumes (rightly) that if something was copied from a block then that block should still exist. It is clear that in-statements, blocks, and macros cannot be in an optional, because that allows nodes to be copied from the optional block to somewhere outside even though the optional could be disabled later. When optionals are disabled the AST is reset and the resolution is restarted at the point of resolving macro calls, so anything resolved before macro calls will never be re-resolved. This includes tunableifs, in-statements, blockinherits, blockabstracts, and macro definitions. Tunable declarations also cannot be in an optional block because they are needed to resolve tunableifs. It should be fine to allow blockinherit statements in an optional, because that is copying nodes from outside the optional to the optional and if the optional is later disabled, everything will be deleted anyway. Check and quit with an error if a tunable declaration, in-statement, block, blockabstract, or macro definition is found within an optional when either building or resolving the AST. Signed-off-by: James Carter <[email protected]>
static __be32 nfsd4_decode_share_access(struct nfsd4_compoundargs *argp, u32 *share_access, u32 *deleg_want, u32 *deleg_when) { __be32 *p; u32 w; READ_BUF(4); w = be32_to_cpup(p++); *share_access = w & NFS4_SHARE_ACCESS_MASK; *deleg_want = w & NFS4_SHARE_WANT_MASK; if (deleg_when) *deleg_when = w & NFS4_SHARE_WHEN_MASK; switch (w & NFS4_SHARE_ACCESS_MASK) { case NFS4_SHARE_ACCESS_READ: case NFS4_SHARE_ACCESS_WRITE: case NFS4_SHARE_ACCESS_BOTH: break; default: return nfserr_bad_xdr; } w &= ~NFS4_SHARE_ACCESS_MASK; if (!w) return nfs_ok; if (!argp->minorversion) return nfserr_bad_xdr; switch (w & NFS4_SHARE_WANT_MASK) { case NFS4_SHARE_WANT_NO_PREFERENCE: case NFS4_SHARE_WANT_READ_DELEG: case NFS4_SHARE_WANT_WRITE_DELEG: case NFS4_SHARE_WANT_ANY_DELEG: case NFS4_SHARE_WANT_NO_DELEG: case NFS4_SHARE_WANT_CANCEL: break; default: return nfserr_bad_xdr; } w &= ~NFS4_SHARE_WANT_MASK; if (!w) return nfs_ok; if (!deleg_when) /* open_downgrade */ return nfserr_inval; switch (w) { case NFS4_SHARE_SIGNAL_DELEG_WHEN_RESRC_AVAIL: case NFS4_SHARE_PUSH_DELEG_WHEN_UNCONTENDED: case (NFS4_SHARE_SIGNAL_DELEG_WHEN_RESRC_AVAIL | NFS4_SHARE_PUSH_DELEG_WHEN_UNCONTENDED): return nfs_ok; } xdr_error: return nfserr_bad_xdr; }
0
[ "CWE-20", "CWE-129" ]
linux
f961e3f2acae94b727380c0b74e2d3954d0edf79
59,070,989,375,691,480,000,000,000,000,000,000,000
52
nfsd: encoders mustn't use unitialized values in error cases In error cases, lgp->lg_layout_type may be out of bounds; so we shouldn't be using it until after the check of nfserr. This was seen to crash nfsd threads when the server receives a LAYOUTGET request with a large layout type. GETDEVICEINFO has the same problem. Reported-by: Ari Kauppi <[email protected]> Reviewed-by: Christoph Hellwig <[email protected]> Cc: [email protected] Signed-off-by: J. Bruce Fields <[email protected]>
PHP_FUNCTION(stream_context_get_default) { zval *params = NULL; php_stream_context *context; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "|a", &params) == FAILURE) { RETURN_FALSE; } if (FG(default_context) == NULL) { FG(default_context) = php_stream_context_alloc(TSRMLS_C); } context = FG(default_context); if (params) { parse_context_options(context, params TSRMLS_CC); } php_stream_context_to_zval(context, return_value); }
0
[ "CWE-20" ]
php-src
52b93f0cfd3cba7ff98cc5198df6ca4f23865f80
322,295,656,375,427,500,000,000,000,000,000,000,000
20
Fixed bug #69353 (Missing null byte checks for paths in various PHP extensions)
static int dnxhd_encode_thread(AVCodecContext *avctx, void *arg, int jobnr, int threadnr) { DNXHDEncContext *ctx = avctx->priv_data; int mb_y = jobnr, mb_x; ctx = ctx->thread[threadnr]; init_put_bits(&ctx->m.pb, (uint8_t *)arg + 640 + ctx->slice_offs[jobnr], ctx->slice_size[jobnr]); ctx->m.last_dc[0] = ctx->m.last_dc[1] = ctx->m.last_dc[2] = 1 << (ctx->cid_table->bit_depth + 2); for (mb_x = 0; mb_x < ctx->m.mb_width; mb_x++) { unsigned mb = mb_y * ctx->m.mb_width + mb_x; int qscale = ctx->mb_qscale[mb]; int i; put_bits(&ctx->m.pb, 12, qscale<<1); dnxhd_get_blocks(ctx, mb_x, mb_y); for (i = 0; i < 8; i++) { int16_t *block = ctx->blocks[i]; int overflow, n = dnxhd_switch_matrix(ctx, i); int last_index = ctx->m.dct_quantize(&ctx->m, block, 4&(2*i), qscale, &overflow); //START_TIMER; dnxhd_encode_block(ctx, block, last_index, n); //STOP_TIMER("encode_block"); } } if (put_bits_count(&ctx->m.pb)&31) put_bits(&ctx->m.pb, 32-(put_bits_count(&ctx->m.pb)&31), 0); flush_put_bits(&ctx->m.pb); return 0; }
0
[ "CWE-703" ]
FFmpeg
f1caaa1c61310beba705957e6366f0392a0b005b
308,484,901,002,482,520,000,000,000,000,000,000,000
33
dnxhdenc: fix mb_rc size Fixes out of array access with RC_VARIANCE set to 0 Signed-off-by: Michael Niedermayer <[email protected]>
static void file_change(struct diff_options *options, unsigned old_mode, unsigned new_mode, const unsigned char *old_sha1, const unsigned char *new_sha1, int old_sha1_valid, int new_sha1_valid, const char *fullpath, unsigned old_dirty_submodule, unsigned new_dirty_submodule) { tree_difference = REV_TREE_DIFFERENT; DIFF_OPT_SET(options, HAS_CHANGES); }
0
[]
git
a937b37e766479c8e780b17cce9c4b252fd97e40
190,318,786,923,156,430,000,000,000,000,000,000,000
11
revision: quit pruning diff more quickly when possible When the revision traversal machinery is given a pathspec, we must compute the parent-diff for each commit to determine which ones are TREESAME. We set the QUICK diff flag to avoid looking at more entries than we need; we really just care whether there are any changes at all. But there is one case where we want to know a bit more: if --remove-empty is set, we care about finding cases where the change consists only of added entries (in which case we may prune the parent in try_to_simplify_commit()). To cover that case, our file_add_remove() callback does not quit the diff upon seeing an added entry; it keeps looking for other types of entries. But this means when --remove-empty is not set (and it is not by default), we compute more of the diff than is necessary. You can see this in a pathological case where a commit adds a very large number of entries, and we limit based on a broad pathspec. E.g.: perl -e ' chomp(my $blob = `git hash-object -w --stdin </dev/null`); for my $a (1..1000) { for my $b (1..1000) { print "100644 $blob\t$a/$b\n"; } } ' | git update-index --index-info git commit -qm add git rev-list HEAD -- . This case takes about 100ms now, but after this patch only needs 6ms. That's not a huge improvement, but it's easy to get and it protects us against even more pathological cases (e.g., going from 1 million to 10 million files would take ten times as long with the current code, but not increase at all after this patch). This is reported to minorly speed-up pathspec limiting in real world repositories (like the 100-million-file Windows repository), but probably won't make a noticeable difference outside of pathological setups. This patch actually covers the case without --remove-empty, and the case where we see only deletions. See the in-code comment for details. Note that we have to add a new member to the diff_options struct so that our callback can see the value of revs->remove_empty_trees. This callback parameter could be passed to the "add_remove" and "change" callbacks, but there's not much point. They already receive the diff_options struct, and doing it this way avoids having to update the function signature of the other callbacks (arguably the format_callback and output_prefix functions could benefit from the same simplification). Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
static void kvm_load_guest_fpu(struct kvm_vcpu *vcpu) { preempt_disable(); copy_fpregs_to_fpstate(&vcpu->arch.user_fpu); /* PKRU is separately restored in kvm_x86_ops->run. */ __copy_kernel_to_fpregs(&vcpu->arch.guest_fpu.state, ~XFEATURE_MASK_PKRU); preempt_enable(); trace_kvm_fpu(1); }
0
[ "CWE-476" ]
linux
e97f852fd4561e77721bb9a4e0ea9d98305b1e93
269,897,393,911,256,480,000,000,000,000,000,000,000
10
KVM: X86: Fix scan ioapic use-before-initialization Reported by syzkaller: BUG: unable to handle kernel NULL pointer dereference at 00000000000001c8 PGD 80000003ec4da067 P4D 80000003ec4da067 PUD 3f7bfa067 PMD 0 Oops: 0000 [#1] PREEMPT SMP PTI CPU: 7 PID: 5059 Comm: debug Tainted: G OE 4.19.0-rc5 #16 RIP: 0010:__lock_acquire+0x1a6/0x1990 Call Trace: lock_acquire+0xdb/0x210 _raw_spin_lock+0x38/0x70 kvm_ioapic_scan_entry+0x3e/0x110 [kvm] vcpu_enter_guest+0x167e/0x1910 [kvm] kvm_arch_vcpu_ioctl_run+0x35c/0x610 [kvm] kvm_vcpu_ioctl+0x3e9/0x6d0 [kvm] do_vfs_ioctl+0xa5/0x690 ksys_ioctl+0x6d/0x80 __x64_sys_ioctl+0x1a/0x20 do_syscall_64+0x83/0x6e0 entry_SYSCALL_64_after_hwframe+0x49/0xbe The reason is that the testcase writes hyperv synic HV_X64_MSR_SINT6 msr and triggers scan ioapic logic to load synic vectors into EOI exit bitmap. However, irqchip is not initialized by this simple testcase, ioapic/apic objects should not be accessed. This can be triggered by the following program: #define _GNU_SOURCE #include <endian.h> #include <stdint.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <sys/syscall.h> #include <sys/types.h> #include <unistd.h> uint64_t r[3] = {0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff}; int main(void) { syscall(__NR_mmap, 0x20000000, 0x1000000, 3, 0x32, -1, 0); long res = 0; memcpy((void*)0x20000040, "/dev/kvm", 9); res = syscall(__NR_openat, 0xffffffffffffff9c, 0x20000040, 0, 0); if (res != -1) r[0] = res; res = syscall(__NR_ioctl, r[0], 0xae01, 0); if (res != -1) r[1] = res; res = syscall(__NR_ioctl, r[1], 0xae41, 0); if (res != -1) r[2] = res; memcpy( (void*)0x20000080, "\x01\x00\x00\x00\x00\x5b\x61\xbb\x96\x00\x00\x40\x00\x00\x00\x00\x01\x00" "\x08\x00\x00\x00\x00\x00\x0b\x77\xd1\x78\x4d\xd8\x3a\xed\xb1\x5c\x2e\x43" "\xaa\x43\x39\xd6\xff\xf5\xf0\xa8\x98\xf2\x3e\x37\x29\x89\xde\x88\xc6\x33" "\xfc\x2a\xdb\xb7\xe1\x4c\xac\x28\x61\x7b\x9c\xa9\xbc\x0d\xa0\x63\xfe\xfe" "\xe8\x75\xde\xdd\x19\x38\xdc\x34\xf5\xec\x05\xfd\xeb\x5d\xed\x2e\xaf\x22" "\xfa\xab\xb7\xe4\x42\x67\xd0\xaf\x06\x1c\x6a\x35\x67\x10\x55\xcb", 106); syscall(__NR_ioctl, r[2], 0x4008ae89, 0x20000080); syscall(__NR_ioctl, r[2], 0xae80, 0); return 0; } This patch fixes it by bailing out scan ioapic if ioapic is not initialized in kernel. Reported-by: Wei Wu <[email protected]> Cc: Paolo Bonzini <[email protected]> Cc: Radim Krčmář <[email protected]> Cc: Wei Wu <[email protected]> Signed-off-by: Wanpeng Li <[email protected]> Cc: [email protected] Signed-off-by: Paolo Bonzini <[email protected]>
template<typename tf, typename tc, typename te> CImg<floatT> get_elevation3d(CImgList<tf>& primitives, CImgList<tc>& colors, const CImg<te>& elevation) const { if (!is_sameXY(elevation) || elevation._depth>1 || elevation._spectrum>1) throw CImgArgumentException(_cimg_instance "get_elevation3d(): Instance and specified elevation (%u,%u,%u,%u,%p) " "have incompatible dimensions.", cimg_instance, elevation._width,elevation._height,elevation._depth, elevation._spectrum,elevation._data); if (is_empty()) return *this; float m, M = (float)max_min(m); if (M==m) ++M; colors.assign(); const unsigned int size_x1 = _width - 1, size_y1 = _height - 1; for (unsigned int y = 0; y<size_y1; ++y) for (unsigned int x = 0; x<size_x1; ++x) { const unsigned char r = (unsigned char)(((*this)(x,y,0) - m)*255/(M-m)), g = (unsigned char)(_spectrum>1?((*this)(x,y,1) - m)*255/(M-m):r), b = (unsigned char)(_spectrum>2?((*this)(x,y,2) - m)*255/(M-m):_spectrum>1?0:r); CImg<tc>::vector((tc)r,(tc)g,(tc)b).move_to(colors); } const typename CImg<te>::_functor2d_int func(elevation); return elevation3d(primitives,func,0,0,_width - 1.f,_height - 1.f,_width,_height);
0
[ "CWE-119", "CWE-787" ]
CImg
ac8003393569aba51048c9d67e1491559877b1d1
334,602,319,360,286,180,000,000,000,000,000,000,000
24
.
gs_interp_init(i_ctx_t **pi_ctx_p, const ref *psystem_dict, gs_dual_memory_t *dmem) { /* Create and initialize a context state. */ gs_context_state_t *pcst = 0; int code = context_state_alloc(&pcst, psystem_dict, dmem); if (code >= 0) { code = context_state_load(pcst); if (code < 0) { context_state_free(pcst); pcst = NULL; } } if (code < 0) lprintf1("Fatal error %d in gs_interp_init!\n", code); *pi_ctx_p = pcst; return code; }
0
[]
ghostpdl
b575e1ec42cc86f6a58c603f2a88fcc2af699cc8
255,010,852,570,856,080,000,000,000,000,000,000,000
20
Bug 699668: handle stack overflow during error handling When handling a Postscript error, we push the object throwing the error onto the operand stack for the error handling procedure to access - we were not checking the available stack before doing so, thus causing a crash. Basically, if we get a stack overflow when already handling an error, we're out of options, return to the caller with a fatal error.
void FreeDecodedCRL(DecodedCRL* dcrl) { RevokedCert* tmp = dcrl->certs; WOLFSSL_MSG("FreeDecodedCRL"); while(tmp) { RevokedCert* next = tmp->next; XFREE(tmp, dcrl->heap, DYNAMIC_TYPE_REVOKED); tmp = next; } }
0
[ "CWE-125", "CWE-345" ]
wolfssl
f93083be72a3b3d956b52a7ec13f307a27b6e093
196,184,821,627,861,750,000,000,000,000,000,000,000
12
OCSP: improve handling of OCSP no check extension
xmlRelaxNGValidateValueContent(xmlRelaxNGValidCtxtPtr ctxt, xmlRelaxNGDefinePtr defines) { int ret = 0; while (defines != NULL) { ret = xmlRelaxNGValidateValue(ctxt, defines); if (ret != 0) break; defines = defines->next; } return (ret); }
0
[ "CWE-134" ]
libxml2
502f6a6d08b08c04b3ddfb1cd21b2f699c1b7f5b
26,100,839,627,707,490,000,000,000,000,000,000,000
13
More format string warnings with possible format string vulnerability For https://bugzilla.gnome.org/show_bug.cgi?id=761029 adds a new xmlEscapeFormatString() function to escape composed format strings
int tcp_rcv_state_process(struct sock *sk, struct sk_buff *skb, const struct tcphdr *th, unsigned int len) { struct tcp_sock *tp = tcp_sk(sk); struct inet_connection_sock *icsk = inet_csk(sk); int queued = 0; int res; tp->rx_opt.saw_tstamp = 0; switch (sk->sk_state) { case TCP_CLOSE: goto discard; case TCP_LISTEN: if (th->ack) return 1; if (th->rst) goto discard; if (th->syn) { if (icsk->icsk_af_ops->conn_request(sk, skb) < 0) return 1; /* Now we have several options: In theory there is * nothing else in the frame. KA9Q has an option to * send data with the syn, BSD accepts data with the * syn up to the [to be] advertised window and * Solaris 2.1 gives you a protocol error. For now * we just ignore it, that fits the spec precisely * and avoids incompatibilities. It would be nice in * future to drop through and process the data. * * Now that TTCP is starting to be used we ought to * queue this data. * But, this leaves one open to an easy denial of * service attack, and SYN cookies can't defend * against this problem. So, we drop the data * in the interest of security over speed unless * it's still in use. */ kfree_skb(skb); return 0; } goto discard; case TCP_SYN_SENT: queued = tcp_rcv_synsent_state_process(sk, skb, th, len); if (queued >= 0) return queued; /* Do step6 onward by hand. */ tcp_urg(sk, skb, th); __kfree_skb(skb); tcp_data_snd_check(sk); return 0; } res = tcp_validate_incoming(sk, skb, th, 0); if (res <= 0) return -res; /* step 5: check the ACK field */ if (th->ack) { int acceptable = tcp_ack(sk, skb, FLAG_SLOWPATH) > 0; switch (sk->sk_state) { case TCP_SYN_RECV: if (acceptable) { tp->copied_seq = tp->rcv_nxt; smp_mb(); tcp_set_state(sk, TCP_ESTABLISHED); sk->sk_state_change(sk); /* Note, that this wakeup is only for marginal * crossed SYN case. Passively open sockets * are not waked up, because sk->sk_sleep == * NULL and sk->sk_socket == NULL. */ if (sk->sk_socket) sk_wake_async(sk, SOCK_WAKE_IO, POLL_OUT); tp->snd_una = TCP_SKB_CB(skb)->ack_seq; tp->snd_wnd = ntohs(th->window) << tp->rx_opt.snd_wscale; tcp_init_wl(tp, TCP_SKB_CB(skb)->seq); if (tp->rx_opt.tstamp_ok) tp->advmss -= TCPOLEN_TSTAMP_ALIGNED; /* Make sure socket is routed, for * correct metrics. */ icsk->icsk_af_ops->rebuild_header(sk); tcp_init_metrics(sk); tcp_init_congestion_control(sk); /* Prevent spurious tcp_cwnd_restart() on * first data packet. */ tp->lsndtime = tcp_time_stamp; tcp_mtup_init(sk); tcp_initialize_rcv_mss(sk); tcp_init_buffer_space(sk); tcp_fast_path_on(tp); } else { return 1; } break; case TCP_FIN_WAIT1: if (tp->snd_una == tp->write_seq) { tcp_set_state(sk, TCP_FIN_WAIT2); sk->sk_shutdown |= SEND_SHUTDOWN; dst_confirm(__sk_dst_get(sk)); if (!sock_flag(sk, SOCK_DEAD)) /* Wake up lingering close() */ sk->sk_state_change(sk); else { int tmo; if (tp->linger2 < 0 || (TCP_SKB_CB(skb)->end_seq != TCP_SKB_CB(skb)->seq && after(TCP_SKB_CB(skb)->end_seq - th->fin, tp->rcv_nxt))) { tcp_done(sk); NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_TCPABORTONDATA); return 1; } tmo = tcp_fin_time(sk); if (tmo > TCP_TIMEWAIT_LEN) { inet_csk_reset_keepalive_timer(sk, tmo - TCP_TIMEWAIT_LEN); } else if (th->fin || sock_owned_by_user(sk)) { /* Bad case. We could lose such FIN otherwise. * It is not a big problem, but it looks confusing * and not so rare event. We still can lose it now, * if it spins in bh_lock_sock(), but it is really * marginal case. */ inet_csk_reset_keepalive_timer(sk, tmo); } else { tcp_time_wait(sk, TCP_FIN_WAIT2, tmo); goto discard; } } } break; case TCP_CLOSING: if (tp->snd_una == tp->write_seq) { tcp_time_wait(sk, TCP_TIME_WAIT, 0); goto discard; } break; case TCP_LAST_ACK: if (tp->snd_una == tp->write_seq) { tcp_update_metrics(sk); tcp_done(sk); goto discard; } break; } } else goto discard; /* step 6: check the URG bit */ tcp_urg(sk, skb, th); /* step 7: process the segment text */ switch (sk->sk_state) { case TCP_CLOSE_WAIT: case TCP_CLOSING: case TCP_LAST_ACK: if (!before(TCP_SKB_CB(skb)->seq, tp->rcv_nxt)) break; case TCP_FIN_WAIT1: case TCP_FIN_WAIT2: /* RFC 793 says to queue data in these states, * RFC 1122 says we MUST send a reset. * BSD 4.4 also does reset. */ if (sk->sk_shutdown & RCV_SHUTDOWN) { if (TCP_SKB_CB(skb)->end_seq != TCP_SKB_CB(skb)->seq && after(TCP_SKB_CB(skb)->end_seq - th->fin, tp->rcv_nxt)) { NET_INC_STATS_BH(sock_net(sk), LINUX_MIB_TCPABORTONDATA); tcp_reset(sk); return 1; } } /* Fall through */ case TCP_ESTABLISHED: tcp_data_queue(sk, skb); queued = 1; break; } /* tcp_data could move socket to TIME-WAIT */ if (sk->sk_state != TCP_CLOSE) { tcp_data_snd_check(sk); tcp_ack_snd_check(sk); } if (!queued) { discard: __kfree_skb(skb); } return 0; }
1
[]
net-next
fdf5af0daf8019cec2396cdef8fb042d80fe71fa
207,768,355,915,391,150,000,000,000,000,000,000,000
215
tcp: drop SYN+FIN messages Denys Fedoryshchenko reported that SYN+FIN attacks were bringing his linux machines to their limits. Dont call conn_request() if the TCP flags includes SYN flag Reported-by: Denys Fedoryshchenko <[email protected]> Signed-off-by: Eric Dumazet <[email protected]> Signed-off-by: David S. Miller <[email protected]>
gegl_chant_class_init (GeglChantClass *klass) { GeglOperationClass *operation_class; GeglOperationSourceClass *source_class; operation_class = GEGL_OPERATION_CLASS (klass); source_class = GEGL_OPERATION_SOURCE_CLASS (klass); source_class->process = process; operation_class->get_bounding_box = get_bounding_box; operation_class->get_cached_region = get_cached_region; gegl_operation_class_set_keys (operation_class, "name" , "gegl:ppm-load", "categories" , "hidden", "description" , _("PPM image loader."), NULL); gegl_extension_handler_register (".ppm", "gegl:ppm-load"); }
0
[ "CWE-189" ]
gegl
1e92e5235ded0415d555aa86066b8e4041ee5a53
243,477,778,358,899,640,000,000,000,000,000,000,000
20
ppm-load: CVE-2012-4433: don't overflow memory allocation Carefully selected width/height values could cause the size of a later allocation to overflow, resulting in a buffer much too small to store the data which would then written beyond its end.
int krb5_auth_recv(struct tevent_req *req, int *pam_status, int *dp_err) { struct krb5_auth_state *state = tevent_req_data(req, struct krb5_auth_state); *pam_status = state->pam_status; *dp_err = state->dp_err; TEVENT_REQ_RETURN_ON_ERROR(req); return EOK; }
0
[ "CWE-287" ]
sssd
fffdae81651b460f3d2c119c56d5caa09b4de42a
165,203,246,134,210,920,000,000,000,000,000,000,000
11
Fix bad password caching when using automatic TGT renewal Fixes CVE-2011-1758, https://fedorahosted.org/sssd/ticket/856
CImg<T>& operator=(const CImg<T>& img) { return assign(img); }
0
[ "CWE-770" ]
cimg
619cb58dd90b4e03ac68286c70ed98acbefd1c90
326,274,196,335,712,900,000,000,000,000,000,000,000
3
CImg<>::load_bmp() and CImg<>::load_pandore(): Check that dimensions encoded in file does not exceed file size.
static int check_unshare_flags(unsigned long unshare_flags) { if (unshare_flags & ~(CLONE_THREAD|CLONE_FS|CLONE_NEWNS|CLONE_SIGHAND| CLONE_VM|CLONE_FILES|CLONE_SYSVSEM| CLONE_NEWUTS|CLONE_NEWIPC|CLONE_NEWNET| CLONE_NEWUSER|CLONE_NEWPID)) return -EINVAL; /* * Not implemented, but pretend it works if there is nothing to * unshare. Note that unsharing CLONE_THREAD or CLONE_SIGHAND * needs to unshare vm. */ if (unshare_flags & (CLONE_THREAD | CLONE_SIGHAND | CLONE_VM)) { /* FIXME: get_task_mm() increments ->mm_users */ if (atomic_read(&current->mm->mm_users) > 1) return -EINVAL; } return 0; }
0
[ "CWE-284", "CWE-264" ]
linux
e66eded8309ebf679d3d3c1f5820d1f2ca332c71
106,592,390,303,277,970,000,000,000,000,000,000,000
20
userns: Don't allow CLONE_NEWUSER | CLONE_FS Don't allowing sharing the root directory with processes in a different user namespace. There doesn't seem to be any point, and to allow it would require the overhead of putting a user namespace reference in fs_struct (for permission checks) and incrementing that reference count on practically every call to fork. So just perform the inexpensive test of forbidding sharing fs_struct acrosss processes in different user namespaces. We already disallow other forms of threading when unsharing a user namespace so this should be no real burden in practice. This updates setns, clone, and unshare to disallow multiple user namespaces sharing an fs_struct. Cc: [email protected] Signed-off-by: "Eric W. Biederman" <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
int inet6_sk_rebuild_header(struct sock *sk) { struct ipv6_pinfo *np = inet6_sk(sk); struct dst_entry *dst; dst = __sk_dst_check(sk, np->dst_cookie); if (!dst) { struct inet_sock *inet = inet_sk(sk); struct in6_addr *final_p, final; struct flowi6 fl6; memset(&fl6, 0, sizeof(fl6)); fl6.flowi6_proto = sk->sk_protocol; fl6.daddr = sk->sk_v6_daddr; fl6.saddr = np->saddr; fl6.flowlabel = np->flow_label; fl6.flowi6_oif = sk->sk_bound_dev_if; fl6.flowi6_mark = sk->sk_mark; fl6.fl6_dport = inet->inet_dport; fl6.fl6_sport = inet->inet_sport; security_sk_classify_flow(sk, flowi6_to_flowi(&fl6)); final_p = fl6_update_dst(&fl6, np->opt, &final); dst = ip6_dst_lookup_flow(sk, &fl6, final_p); if (IS_ERR(dst)) { sk->sk_route_caps = 0; sk->sk_err_soft = -PTR_ERR(dst); return PTR_ERR(dst); } __ip6_dst_store(sk, dst, NULL, NULL); } return 0; }
1
[ "CWE-416", "CWE-284", "CWE-264" ]
linux
45f6fad84cc305103b28d73482b344d7f5b76f39
241,384,101,630,172,880,000,000,000,000,000,000,000
37
ipv6: add complete rcu protection around np->opt This patch addresses multiple problems : UDP/RAW sendmsg() need to get a stable struct ipv6_txoptions while socket is not locked : Other threads can change np->opt concurrently. Dmitry posted a syzkaller (http://github.com/google/syzkaller) program desmonstrating use-after-free. Starting with TCP/DCCP lockless listeners, tcp_v6_syn_recv_sock() and dccp_v6_request_recv_sock() also need to use RCU protection to dereference np->opt once (before calling ipv6_dup_options()) This patch adds full RCU protection to np->opt Reported-by: Dmitry Vyukov <[email protected]> Signed-off-by: Eric Dumazet <[email protected]> Acked-by: Hannes Frederic Sowa <[email protected]> Signed-off-by: David S. Miller <[email protected]>
static void fastrpc_channel_ctx_put(struct fastrpc_channel_ctx *cctx) { kref_put(&cctx->refcount, fastrpc_channel_ctx_free); }
0
[ "CWE-400", "CWE-401" ]
linux
fc739a058d99c9297ef6bfd923b809d85855b9a9
276,252,490,571,553,800,000,000,000,000,000,000,000
4
misc: fastrpc: prevent memory leak in fastrpc_dma_buf_attach In fastrpc_dma_buf_attach if dma_get_sgtable fails the allocated memory for a should be released. Signed-off-by: Navid Emamdoost <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
VncInfo *qmp_query_vnc(Error **errp) { VncInfo *info = g_malloc0(sizeof(*info)); if (vnc_display == NULL || vnc_display->display == NULL) { info->enabled = false; } else { VncClientInfoList *cur_item = NULL; struct sockaddr_storage sa; socklen_t salen = sizeof(sa); char host[NI_MAXHOST]; char serv[NI_MAXSERV]; VncState *client; info->enabled = true; /* for compatibility with the original command */ info->has_clients = true; QTAILQ_FOREACH(client, &vnc_display->clients, next) { VncClientInfoList *cinfo = g_malloc0(sizeof(*info)); cinfo->value = qmp_query_vnc_client(client); /* XXX: waiting for the qapi to support GSList */ if (!cur_item) { info->clients = cur_item = cinfo; } else { cur_item->next = cinfo; cur_item = cinfo; } } if (vnc_display->lsock == -1) { return info; } if (getsockname(vnc_display->lsock, (struct sockaddr *)&sa, &salen) == -1) { error_set(errp, QERR_UNDEFINED_ERROR); goto out_error; } if (getnameinfo((struct sockaddr *)&sa, salen, host, sizeof(host), serv, sizeof(serv), NI_NUMERICHOST | NI_NUMERICSERV) < 0) { error_set(errp, QERR_UNDEFINED_ERROR); goto out_error; } info->has_host = true; info->host = g_strdup(host); info->has_service = true; info->service = g_strdup(serv); info->has_family = true; info->family = inet_netfamily(sa.ss_family); info->has_auth = true; info->auth = g_strdup(vnc_auth_name(vnc_display)); } return info; out_error: qapi_free_VncInfo(info); return NULL; }
0
[ "CWE-125" ]
qemu
bea60dd7679364493a0d7f5b54316c767cf894ef
32,350,580,058,023,746,000,000,000,000,000,000,000
69
ui/vnc: fix potential memory corruption issues this patch makes the VNC server work correctly if the server surface and the guest surface have different sizes. Basically the server surface is adjusted to not exceed VNC_MAX_WIDTH x VNC_MAX_HEIGHT and additionally the width is rounded up to multiple of VNC_DIRTY_PIXELS_PER_BIT. If we have a resolution whose width is not dividable by VNC_DIRTY_PIXELS_PER_BIT we now get a small black bar on the right of the screen. If the surface is too big to fit the limits only the upper left area is shown. On top of that this fixes 2 memory corruption issues: The first was actually discovered during playing around with a Windows 7 vServer. During resolution change in Windows 7 it happens sometimes that Windows changes to an intermediate resolution where server_stride % cmp_bytes != 0 (in vnc_refresh_server_surface). This happens only if width % VNC_DIRTY_PIXELS_PER_BIT != 0. The second is a theoretical issue, but is maybe exploitable by the guest. If for some reason the guest surface size is bigger than VNC_MAX_WIDTH x VNC_MAX_HEIGHT we end up in severe corruption since this limit is nowhere enforced. Signed-off-by: Peter Lieven <[email protected]> Signed-off-by: Gerd Hoffmann <[email protected]>
static inline int xfrm4_udp_encap_rcv(struct sock *sk, struct sk_buff *skb) { /* should not happen */ kfree_skb(skb); return 0; }
0
[ "CWE-416" ]
linux
dbb2483b2a46fbaf833cfb5deb5ed9cace9c7399
185,133,271,978,886,700,000,000,000,000,000,000,000
6
xfrm: clean up xfrm protocol checks In commit 6a53b7593233 ("xfrm: check id proto in validate_tmpl()") I introduced a check for xfrm protocol, but according to Herbert IPSEC_PROTO_ANY should only be used as a wildcard for lookup, so it should be removed from validate_tmpl(). And, IPSEC_PROTO_ANY is expected to only match 3 IPSec-specific protocols, this is why xfrm_state_flush() could still miss IPPROTO_ROUTING, which leads that those entries are left in net->xfrm.state_all before exit net. Fix this by replacing IPSEC_PROTO_ANY with zero. This patch also extracts the check from validate_tmpl() to xfrm_id_proto_valid() and uses it in parse_ipsecrequest(). With this, no other protocols should be added into xfrm. Fixes: 6a53b7593233 ("xfrm: check id proto in validate_tmpl()") Reported-by: [email protected] Cc: Steffen Klassert <[email protected]> Cc: Herbert Xu <[email protected]> Signed-off-by: Cong Wang <[email protected]> Acked-by: Herbert Xu <[email protected]> Signed-off-by: Steffen Klassert <[email protected]>
generate_empty_sequence(cms_context *cms, SECItem *encoded) { SECItem empty = {.type = SEC_ASN1_SEQUENCE, .data = NULL, .len = 0 }; void *ret; ret = SEC_ASN1EncodeItem(cms->arena, encoded, &empty, EmptySequenceTemplate); if (ret == NULL) cnreterr(-1, cms, "could not encode empty sequence"); return 0; }
0
[ "CWE-787" ]
pesign
b879dda52f8122de697d145977c285fb0a022d76
267,926,567,371,560,330,000,000,000,000,000,000,000
13
Handle NULL pwdata in cms_set_pw_data() When 12f16710ee44ef64ddb044a3523c3c4c4d90039a rewrote this function, it didn't handle the NULL pwdata invocation from daemon.c. This leads to a explicit NULL dereference and crash on all attempts to daemonize pesign. Signed-off-by: Robbie Harwood <[email protected]>
cmsPipeline* _cmsReadDevicelinkLUT(cmsHPROFILE hProfile, int Intent) { cmsPipeline* Lut; cmsTagTypeSignature OriginalType; cmsTagSignature tag16 = Device2PCS16[Intent]; cmsTagSignature tagFloat = Device2PCSFloat[Intent]; cmsContext ContextID = cmsGetProfileContextID(hProfile); // On named color, take the appropiate tag if (cmsGetDeviceClass(hProfile) == cmsSigNamedColorClass) { cmsNAMEDCOLORLIST* nc = (cmsNAMEDCOLORLIST*) cmsReadTag(hProfile, cmsSigNamedColor2Tag); if (nc == NULL) return NULL; Lut = cmsPipelineAlloc(ContextID, 0, 0); if (Lut == NULL) goto Error; if (!cmsPipelineInsertStage(Lut, cmsAT_BEGIN, _cmsStageAllocNamedColor(nc, FALSE))) goto Error; if (cmsGetColorSpace(hProfile) == cmsSigLabData) if (!cmsPipelineInsertStage(Lut, cmsAT_END, _cmsStageAllocLabV2ToV4(ContextID))) goto Error; return Lut; Error: cmsPipelineFree(Lut); cmsFreeNamedColorList(nc); return NULL; } if (cmsIsTag(hProfile, tagFloat)) { // Float tag takes precedence // Floating point LUT are always V return _cmsReadFloatDevicelinkTag(hProfile, tagFloat); } tagFloat = Device2PCSFloat[0]; if (cmsIsTag(hProfile, tagFloat)) { return cmsPipelineDup((cmsPipeline*) cmsReadTag(hProfile, tagFloat)); } if (!cmsIsTag(hProfile, tag16)) { // Is there any LUT-Based table? tag16 = Device2PCS16[0]; if (!cmsIsTag(hProfile, tag16)) return NULL; } // Check profile version and LUT type. Do the necessary adjustments if needed // Read the tag Lut = (cmsPipeline*) cmsReadTag(hProfile, tag16); if (Lut == NULL) return NULL; // The profile owns the Lut, so we need to copy it Lut = cmsPipelineDup(Lut); if (Lut == NULL) return NULL; // Now it is time for a controversial stuff. I found that for 3D LUTS using // Lab used as indexer space, trilinear interpolation should be used if (cmsGetColorSpace(hProfile) == cmsSigLabData) ChangeInterpolationToTrilinear(Lut); // After reading it, we have info about the original type OriginalType = _cmsGetTagTrueType(hProfile, tag16); // We need to adjust data for Lab16 on output if (OriginalType != cmsSigLut16Type) return Lut; // Here it is possible to get Lab on both sides if (cmsGetPCS(hProfile) == cmsSigLabData) { if(!cmsPipelineInsertStage(Lut, cmsAT_BEGIN, _cmsStageAllocLabV4ToV2(ContextID))) goto Error2; } if (cmsGetColorSpace(hProfile) == cmsSigLabData) { if(!cmsPipelineInsertStage(Lut, cmsAT_END, _cmsStageAllocLabV2ToV4(ContextID))) goto Error2; } return Lut; Error2: cmsPipelineFree(Lut); return NULL; }
0
[]
Little-CMS
41d222df1bc6188131a8f46c32eab0a4d4cdf1b6
231,978,892,231,102,950,000,000,000,000,000,000,000
88
Memory squeezing fix: lcms2 cmsPipeline construction When creating a new pipeline, lcms would often try to allocate a stage and pass it to cmsPipelineInsertStage without checking whether the allocation succeeded. cmsPipelineInsertStage would then assert (or crash) if it had not. The fix here is to change cmsPipelineInsertStage to check and return an error value. All calling code is then checked to test this return value and cope.
load_count(const void *val, const struct counted_info *counted, size_t *count_out) { const void *countptr = (const char *)val + counted->lenoff; assert(sizeof(size_t) <= sizeof(uintmax_t)); if (counted->lensigned) { intmax_t xlen = load_int(countptr, counted->lensize); if (xlen < 0 || (uintmax_t)xlen > SIZE_MAX) return EINVAL; *count_out = xlen; } else { uintmax_t xlen = load_uint(countptr, counted->lensize); if ((size_t)xlen != xlen || xlen > SIZE_MAX) return EINVAL; *count_out = xlen; } return 0; }
0
[ "CWE-674", "CWE-787" ]
krb5
57415dda6cf04e73ffc3723be518eddfae599bfd
178,555,235,750,789,140,000,000,000,000,000,000,000
19
Add recursion limit for ASN.1 indefinite lengths The libkrb5 ASN.1 decoder supports BER indefinite lengths. It computes the tag length using recursion; the lack of a recursion limit allows an attacker to overrun the stack and cause the process to crash. Reported by Demi Obenour. CVE-2020-28196: In MIT krb5 releases 1.11 and later, an unauthenticated attacker can cause a denial of service for any client or server to which it can send an ASN.1-encoded Kerberos message of sufficient length. ticket: 8959 (new) tags: pullup target_version: 1.18-next target_version: 1.17-next
__rds_conn_error(struct rds_connection *conn, const char *fmt, ...) { va_list ap; va_start(ap, fmt); vprintk(fmt, ap); va_end(ap); rds_conn_drop(conn); }
0
[ "CWE-703" ]
linux
74e98eb085889b0d2d4908f59f6e00026063014f
304,011,180,583,349,580,000,000,000,000,000,000,000
10
RDS: verify the underlying transport exists before creating a connection There was no verification that an underlying transport exists when creating a connection, this would cause dereferencing a NULL ptr. It might happen on sockets that weren't properly bound before attempting to send a message, which will cause a NULL ptr deref: [135546.047719] kasan: GPF could be caused by NULL-ptr deref or user memory accessgeneral protection fault: 0000 [#1] PREEMPT SMP DEBUG_PAGEALLOC KASAN [135546.051270] Modules linked in: [135546.051781] CPU: 4 PID: 15650 Comm: trinity-c4 Not tainted 4.2.0-next-20150902-sasha-00041-gbaa1222-dirty #2527 [135546.053217] task: ffff8800835bc000 ti: ffff8800bc708000 task.ti: ffff8800bc708000 [135546.054291] RIP: __rds_conn_create (net/rds/connection.c:194) [135546.055666] RSP: 0018:ffff8800bc70fab0 EFLAGS: 00010202 [135546.056457] RAX: dffffc0000000000 RBX: 0000000000000f2c RCX: ffff8800835bc000 [135546.057494] RDX: 0000000000000007 RSI: ffff8800835bccd8 RDI: 0000000000000038 [135546.058530] RBP: ffff8800bc70fb18 R08: 0000000000000001 R09: 0000000000000000 [135546.059556] R10: ffffed014d7a3a23 R11: ffffed014d7a3a21 R12: 0000000000000000 [135546.060614] R13: 0000000000000001 R14: ffff8801ec3d0000 R15: 0000000000000000 [135546.061668] FS: 00007faad4ffb700(0000) GS:ffff880252000000(0000) knlGS:0000000000000000 [135546.062836] CS: 0010 DS: 0000 ES: 0000 CR0: 000000008005003b [135546.063682] CR2: 000000000000846a CR3: 000000009d137000 CR4: 00000000000006a0 [135546.064723] Stack: [135546.065048] ffffffffafe2055c ffffffffafe23fc1 ffffed00493097bf ffff8801ec3d0008 [135546.066247] 0000000000000000 00000000000000d0 0000000000000000 ac194a24c0586342 [135546.067438] 1ffff100178e1f78 ffff880320581b00 ffff8800bc70fdd0 ffff880320581b00 [135546.068629] Call Trace: [135546.069028] ? __rds_conn_create (include/linux/rcupdate.h:856 net/rds/connection.c:134) [135546.069989] ? rds_message_copy_from_user (net/rds/message.c:298) [135546.071021] rds_conn_create_outgoing (net/rds/connection.c:278) [135546.071981] rds_sendmsg (net/rds/send.c:1058) [135546.072858] ? perf_trace_lock (include/trace/events/lock.h:38) [135546.073744] ? lockdep_init (kernel/locking/lockdep.c:3298) [135546.074577] ? rds_send_drop_to (net/rds/send.c:976) [135546.075508] ? __might_fault (./arch/x86/include/asm/current.h:14 mm/memory.c:3795) [135546.076349] ? __might_fault (mm/memory.c:3795) [135546.077179] ? rds_send_drop_to (net/rds/send.c:976) [135546.078114] sock_sendmsg (net/socket.c:611 net/socket.c:620) [135546.078856] SYSC_sendto (net/socket.c:1657) [135546.079596] ? SYSC_connect (net/socket.c:1628) [135546.080510] ? trace_dump_stack (kernel/trace/trace.c:1926) [135546.081397] ? ring_buffer_unlock_commit (kernel/trace/ring_buffer.c:2479 kernel/trace/ring_buffer.c:2558 kernel/trace/ring_buffer.c:2674) [135546.082390] ? trace_buffer_unlock_commit (kernel/trace/trace.c:1749) [135546.083410] ? trace_event_raw_event_sys_enter (include/trace/events/syscalls.h:16) [135546.084481] ? do_audit_syscall_entry (include/trace/events/syscalls.h:16) [135546.085438] ? trace_buffer_unlock_commit (kernel/trace/trace.c:1749) [135546.085515] rds_ib_laddr_check(): addr 36.74.25.172 ret -99 node type -1 Acked-by: Santosh Shilimkar <[email protected]> Signed-off-by: Sasha Levin <[email protected]> Signed-off-by: David S. Miller <[email protected]>
iprintf(struct iperf_test *test, const char* format, ...) { va_list argp; int r = -1; /* * There are roughly two use cases here. If we're the client, * want to print stuff directly to the output stream. * If we're the sender we might need to buffer up output to send * to the client. * * This doesn't make a whole lot of difference except there are * some chunks of output on the client (on particular the whole * of the server output with --get-server-output) that could * easily exceed the size of the line buffer, but which don't need * to be buffered up anyway. */ if (test->role == 'c') { if (test->title) printf("%s: ", test->title); va_start(argp, format); r = vprintf(format, argp); va_end(argp); } else if (test->role == 's') { char linebuffer[1024]; va_start(argp, format); r = vsnprintf(linebuffer, sizeof(linebuffer), format, argp); va_end(argp); printf("%s", linebuffer); if (test->role == 's' && iperf_get_test_get_server_output(test)) { struct iperf_textline *l = (struct iperf_textline *) malloc(sizeof(struct iperf_textline)); l->line = strdup(linebuffer); TAILQ_INSERT_TAIL(&(test->server_output_list), l, textlineentries); } } return r; }
0
[ "CWE-120", "CWE-119", "CWE-787" ]
iperf
91f2fa59e8ed80dfbf400add0164ee0e508e412a
261,990,720,217,712,040,000,000,000,000,000,000,000
39
Fix a buffer overflow / heap corruption issue that could occur if a malformed JSON string was passed on the control channel. This issue, present in the cJSON library, was already fixed upstream, so was addressed here in iperf3 by importing a newer version of cJSON (plus local ESnet modifications). Discovered and reported by Dave McDaniel, Cisco Talos. Based on a patch by @dopheide-esnet, with input from @DaveGamble. Cross-references: TALOS-CAN-0164, ESNET-SECADV-2016-0001, CVE-2016-4303 (cherry picked from commit ed94082be27d971a5e1b08b666e2c217cf470a40) Signed-off-by: Bruce A. Mah <[email protected]>
static int mov_write_ms_tag(AVFormatContext *s, AVIOContext *pb, MOVTrack *track) { int ret; int64_t pos = avio_tell(pb); avio_wb32(pb, 0); avio_wl32(pb, track->tag); // store it byteswapped track->par->codec_tag = av_bswap16(track->tag >> 16); if ((ret = ff_put_wav_header(s, pb, track->par, 0)) < 0) return ret; return update_size(pb, pos); }
0
[ "CWE-369" ]
FFmpeg
2c0e98a0b478284bdff6d7a4062522605a8beae5
228,461,495,281,366,700,000,000,000,000,000,000,000
11
avformat/movenc: Write version 2 of audio atom if channels is not known The version 1 needs the channel count and would divide by 0 Fixes: division by 0 Fixes: fpe_movenc.c_1108_1.ogg Fixes: fpe_movenc.c_1108_2.ogg Fixes: fpe_movenc.c_1108_3.wav Found-by: #CHEN HONGXU# <[email protected]> Signed-off-by: Michael Niedermayer <[email protected]> (cherry picked from commit fa19fbcf712a6a6cc5a5cfdc3254a97b9bce6582) Signed-off-by: Michael Niedermayer <[email protected]>
void __cleanup_sighand(struct sighand_struct *sighand) { if (atomic_dec_and_test(&sighand->count)) { signalfd_cleanup(sighand); /* * sighand_cachep is SLAB_TYPESAFE_BY_RCU so we can free it * without an RCU grace period, see __lock_task_sighand(). */ kmem_cache_free(sighand_cachep, sighand); } }
0
[ "CWE-416", "CWE-703" ]
linux
2b7e8665b4ff51c034c55df3cff76518d1a9ee3a
274,039,948,379,798,100,000,000,000,000,000,000,000
11
fork: fix incorrect fput of ->exe_file causing use-after-free Commit 7c051267931a ("mm, fork: make dup_mmap wait for mmap_sem for write killable") made it possible to kill a forking task while it is waiting to acquire its ->mmap_sem for write, in dup_mmap(). However, it was overlooked that this introduced an new error path before a reference is taken on the mm_struct's ->exe_file. Since the ->exe_file of the new mm_struct was already set to the old ->exe_file by the memcpy() in dup_mm(), it was possible for the mmput() in the error path of dup_mm() to drop a reference to ->exe_file which was never taken. This caused the struct file to later be freed prematurely. Fix it by updating mm_init() to NULL out the ->exe_file, in the same place it clears other things like the list of mmaps. This bug was found by syzkaller. It can be reproduced using the following C program: #define _GNU_SOURCE #include <pthread.h> #include <stdlib.h> #include <sys/mman.h> #include <sys/syscall.h> #include <sys/wait.h> #include <unistd.h> static void *mmap_thread(void *_arg) { for (;;) { mmap(NULL, 0x1000000, PROT_READ, MAP_POPULATE|MAP_ANONYMOUS|MAP_PRIVATE, -1, 0); } } static void *fork_thread(void *_arg) { usleep(rand() % 10000); fork(); } int main(void) { fork(); fork(); fork(); for (;;) { if (fork() == 0) { pthread_t t; pthread_create(&t, NULL, mmap_thread, NULL); pthread_create(&t, NULL, fork_thread, NULL); usleep(rand() % 10000); syscall(__NR_exit_group, 0); } wait(NULL); } } No special kernel config options are needed. It usually causes a NULL pointer dereference in __remove_shared_vm_struct() during exit, or in dup_mmap() (which is usually inlined into copy_process()) during fork. Both are due to a vm_area_struct's ->vm_file being used after it's already been freed. Google Bug Id: 64772007 Link: http://lkml.kernel.org/r/[email protected] Fixes: 7c051267931a ("mm, fork: make dup_mmap wait for mmap_sem for write killable") Signed-off-by: Eric Biggers <[email protected]> Tested-by: Mark Rutland <[email protected]> Acked-by: Michal Hocko <[email protected]> Cc: Dmitry Vyukov <[email protected]> Cc: Ingo Molnar <[email protected]> Cc: Konstantin Khlebnikov <[email protected]> Cc: Oleg Nesterov <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Vlastimil Babka <[email protected]> Cc: <[email protected]> [v4.7+] Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
void ring_buffer_record_off(struct trace_buffer *buffer) { unsigned int rd; unsigned int new_rd; do { rd = atomic_read(&buffer->record_disabled); new_rd = rd | RB_BUFFER_OFF; } while (atomic_cmpxchg(&buffer->record_disabled, rd, new_rd) != rd); }
0
[ "CWE-362" ]
linux
bbeb97464eefc65f506084fd9f18f21653e01137
288,362,401,785,427,640,000,000,000,000,000,000,000
10
tracing: Fix race in trace_open and buffer resize call Below race can come, if trace_open and resize of cpu buffer is running parallely on different cpus CPUX CPUY ring_buffer_resize atomic_read(&buffer->resize_disabled) tracing_open tracing_reset_online_cpus ring_buffer_reset_cpu rb_reset_cpu rb_update_pages remove/insert pages resetting pointer This race can cause data abort or some times infinte loop in rb_remove_pages and rb_insert_pages while checking pages for sanity. Take buffer lock to fix this. Link: https://lkml.kernel.org/r/[email protected] Cc: [email protected] Fixes: b23d7a5f4a07a ("ring-buffer: speed up buffer resets by avoiding synchronize_rcu for each CPU") Signed-off-by: Gaurav Kohli <[email protected]> Signed-off-by: Steven Rostedt (VMware) <[email protected]>
static double mp_find_seq(_cimg_math_parser& mp) { const int _step = (int)_mp_arg(7), step = _step?_step:-1; const ulongT siz1 = (ulongT)mp.opcode[3], siz2 = (ulongT)mp.opcode[5]; longT ind = (longT)(mp.opcode[6]!=_cimg_mp_slot_nan?_mp_arg(6):step>0?0:siz1 - 1); if (ind<0 || ind>=(longT)siz1) return -1.; const double *const ptr1b = &_mp_arg(2) + 1, *const ptr1e = ptr1b + siz1, *const ptr2b = &_mp_arg(4) + 1, *const ptr2e = ptr2b + siz2, *ptr1 = ptr1b + ind, *p1 = 0, *p2 = 0; // Forward search. if (step>0) { do { while (ptr1<ptr1e && *ptr1!=*ptr2b) ptr1+=step; if (ptr1>=ptr1e) return -1.; p1 = ptr1 + 1; p2 = ptr2b + 1; while (p1<ptr1e && p2<ptr2e && *p1==*p2) { ++p1; ++p2; } } while (p2<ptr2e && (ptr1+=step)<ptr1e); return p2<ptr2e?-1.:(double)(ptr1 - ptr1b); } // Backward search. do { while (ptr1>=ptr1b && *ptr1!=*ptr2b) ptr1+=step; if (ptr1<ptr1b) return -1.; p1 = ptr1 + 1; p2 = ptr2b + 1; while (p1<ptr1e && p2<ptr2e && *p1==*p2) { ++p1; ++p2; } } while (p2<ptr2e && (ptr1+=step)>=ptr1b); return p2<ptr2e?-1.:(double)(ptr1 - ptr1b); }
0
[ "CWE-770" ]
cimg
619cb58dd90b4e03ac68286c70ed98acbefd1c90
132,693,439,961,137,100,000,000,000,000,000,000,000
38
CImg<>::load_bmp() and CImg<>::load_pandore(): Check that dimensions encoded in file does not exceed file size.
mysql_store_result(MYSQL *mysql) { MYSQL_RES *result; if (!mysql->fields) return(0); if (mysql->status != MYSQL_STATUS_GET_RESULT) { SET_CLIENT_ERROR(mysql, CR_COMMANDS_OUT_OF_SYNC, SQLSTATE_UNKNOWN, 0); return(0); } mysql->status=MYSQL_STATUS_READY; /* server is ready */ if (!(result=(MYSQL_RES*) calloc(1, sizeof(MYSQL_RES)+ sizeof(ulong)*mysql->field_count))) { SET_CLIENT_ERROR(mysql, CR_OUT_OF_MEMORY, SQLSTATE_UNKNOWN, 0); return(0); } result->eof=1; /* Marker for buffered */ result->lengths=(ulong*) (result+1); if (!(result->data=mysql->methods->db_read_rows(mysql,mysql->fields,mysql->field_count))) { free(result); return(0); } mysql->affected_rows= result->row_count= result->data->rows; result->data_cursor= result->data->data; result->fields= mysql->fields; result->field_alloc= mysql->field_alloc; result->field_count= mysql->field_count; result->current_field=0; result->current_row=0; /* Must do a fetch first */ mysql->fields=0; /* fields is now in result */ return(result); /* Data fetched */ }
0
[]
mariadb-connector-c
27b2f3d1f1550dfaee0f63a331a406ab31c1b37e
65,346,089,857,949,120,000,000,000,000,000,000,000
35
various checks for corrupted packets in the protocol also: check the return value of unpack_fields()
*/ static inline int skb_clone_writable(const struct sk_buff *skb, unsigned int len) { return !skb_header_cloned(skb) && skb_headroom(skb) + len <= skb->hdr_len;
0
[ "CWE-20" ]
linux
2b16f048729bf35e6c28a40cbfad07239f9dcd90
11,372,219,364,303,307,000,000,000,000,000,000,000
5
net: create skb_gso_validate_mac_len() If you take a GSO skb, and split it into packets, will the MAC length (L2 + L3 + L4 headers + payload) of those packets be small enough to fit within a given length? Move skb_gso_mac_seglen() to skbuff.h with other related functions like skb_gso_network_seglen() so we can use it, and then create skb_gso_validate_mac_len to do the full calculation. Signed-off-by: Daniel Axtens <[email protected]> Signed-off-by: David S. Miller <[email protected]>
_tiffSizeProc(thandle_t fd) { struct stat sb; return (toff_t) (fstat((int) fd, &sb) < 0 ? 0 : sb.st_size); }
0
[ "CWE-369" ]
libtiff
3c5eb8b1be544e41d2c336191bc4936300ad7543
311,702,632,586,649,730,000,000,000,000,000,000,000
5
* libtiff/tif_{unix,vms,win32}.c (_TIFFmalloc): ANSI C does not require malloc() to return NULL pointer if requested allocation size is zero. Assure that _TIFFmalloc does.
GF_FileType get_file_type_by_ext(char *inName) { GF_FileType type = GF_FILE_TYPE_NOT_SUPPORTED; char *ext = strrchr(inName, '.'); if (ext) { char *sep; if (!strcmp(ext, ".gz")) ext = strrchr(ext-1, '.'); ext+=1; sep = strchr(ext, '.'); if (sep) sep[0] = 0; if (!stricmp(ext, "mp4") || !stricmp(ext, "3gp") || !stricmp(ext, "mov") || !stricmp(ext, "3g2") || !stricmp(ext, "3gs")) { type = GF_FILE_TYPE_ISO_MEDIA; } else if (!stricmp(ext, "bt") || !stricmp(ext, "wrl") || !stricmp(ext, "x3dv")) { type = GF_FILE_TYPE_BT_WRL_X3DV; } else if (!stricmp(ext, "xmt") || !stricmp(ext, "x3d")) { type = GF_FILE_TYPE_XMT_X3D; } else if (!stricmp(ext, "lsr") || !stricmp(ext, "saf")) { type = GF_FILE_TYPE_LSR_SAF; } else if (!stricmp(ext, "svg") || !stricmp(ext, "xsr") || !stricmp(ext, "xml")) { type = GF_FILE_TYPE_SVG; } else if (!stricmp(ext, "swf")) { type = GF_FILE_TYPE_SWF; } else if (!stricmp(ext, "jp2")) { if (sep) sep[0] = '.'; return GF_FILE_TYPE_NOT_SUPPORTED; } else type = GF_FILE_TYPE_NOT_SUPPORTED; if (sep) sep[0] = '.'; } /*try open file in read mode*/ if (!type && gf_isom_probe_file(inName)) type = GF_FILE_TYPE_ISO_MEDIA; return type; }
0
[ "CWE-476" ]
gpac
87afe070cd6866df7fe80f11b26ef75161de85e0
73,405,714,706,321,970,000,000,000,000,000,000,000
37
fixed #1734
void splice_from_pipe_end(struct pipe_inode_info *pipe, struct splice_desc *sd) { if (sd->need_wakeup) wakeup_pipe_writers(pipe); }
0
[ "CWE-284", "CWE-264" ]
linux
8d0207652cbe27d1f962050737848e5ad4671958
261,457,968,268,028,750,000,000,000,000,000,000,000
5
->splice_write() via ->write_iter() iter_file_splice_write() - a ->splice_write() instance that gathers the pipe buffers, builds a bio_vec-based iov_iter covering those and feeds it to ->write_iter(). A bunch of simple cases coverted to that... [AV: fixed the braino spotted by Cyrill] Signed-off-by: Al Viro <[email protected]>
static int nl80211_dump_interface(struct sk_buff *skb, struct netlink_callback *cb) { int wp_idx = 0; int if_idx = 0; int wp_start = cb->args[0]; int if_start = cb->args[1]; int filter_wiphy = -1; struct cfg80211_registered_device *rdev; struct wireless_dev *wdev; int ret; rtnl_lock(); if (!cb->args[2]) { struct nl80211_dump_wiphy_state state = { .filter_wiphy = -1, }; ret = nl80211_dump_wiphy_parse(skb, cb, &state); if (ret) goto out_unlock; filter_wiphy = state.filter_wiphy; /* * if filtering, set cb->args[2] to +1 since 0 is the default * value needed to determine that parsing is necessary. */ if (filter_wiphy >= 0) cb->args[2] = filter_wiphy + 1; else cb->args[2] = -1; } else if (cb->args[2] > 0) { filter_wiphy = cb->args[2] - 1; } list_for_each_entry(rdev, &cfg80211_rdev_list, list) { if (!net_eq(wiphy_net(&rdev->wiphy), sock_net(skb->sk))) continue; if (wp_idx < wp_start) { wp_idx++; continue; } if (filter_wiphy >= 0 && filter_wiphy != rdev->wiphy_idx) continue; if_idx = 0; list_for_each_entry(wdev, &rdev->wiphy.wdev_list, list) { if (if_idx < if_start) { if_idx++; continue; } if (nl80211_send_iface(skb, NETLINK_CB(cb->skb).portid, cb->nlh->nlmsg_seq, NLM_F_MULTI, rdev, wdev, NL80211_CMD_NEW_INTERFACE) < 0) { goto out; } if_idx++; } wp_idx++; } out: cb->args[0] = wp_idx; cb->args[1] = if_idx; ret = skb->len; out_unlock: rtnl_unlock(); return ret; }
0
[ "CWE-120" ]
linux
f88eb7c0d002a67ef31aeb7850b42ff69abc46dc
58,118,266,789,887,830,000,000,000,000,000,000,000
74
nl80211: validate beacon head We currently don't validate the beacon head, i.e. the header, fixed part and elements that are to go in front of the TIM element. This means that the variable elements there can be malformed, e.g. have a length exceeding the buffer size, but most downstream code from this assumes that this has already been checked. Add the necessary checks to the netlink policy. Cc: [email protected] Fixes: ed1b6cc7f80f ("cfg80211/nl80211: add beacon settings") Link: https://lore.kernel.org/r/1569009255-I7ac7fbe9436e9d8733439eab8acbbd35e55c74ef@changeid Signed-off-by: Johannes Berg <[email protected]>
static int __vxlan_dev_create(struct net *net, struct net_device *dev, struct vxlan_config *conf, struct netlink_ext_ack *extack) { struct vxlan_net *vn = net_generic(net, vxlan_net_id); struct vxlan_dev *vxlan = netdev_priv(dev); struct net_device *remote_dev = NULL; struct vxlan_fdb *f = NULL; bool unregister = false; struct vxlan_rdst *dst; int err; dst = &vxlan->default_dst; err = vxlan_dev_configure(net, dev, conf, false, extack); if (err) return err; dev->ethtool_ops = &vxlan_ethtool_ops; /* create an fdb entry for a valid default destination */ if (!vxlan_addr_any(&dst->remote_ip)) { err = vxlan_fdb_create(vxlan, all_zeros_mac, &dst->remote_ip, NUD_REACHABLE | NUD_PERMANENT, vxlan->cfg.dst_port, dst->remote_vni, dst->remote_vni, dst->remote_ifindex, NTF_SELF, &f); if (err) return err; } err = register_netdevice(dev); if (err) goto errout; unregister = true; if (dst->remote_ifindex) { remote_dev = __dev_get_by_index(net, dst->remote_ifindex); if (!remote_dev) goto errout; err = netdev_upper_dev_link(remote_dev, dev, extack); if (err) goto errout; } err = rtnl_configure_link(dev, NULL); if (err) goto unlink; if (f) { vxlan_fdb_insert(vxlan, all_zeros_mac, dst->remote_vni, f); /* notify default fdb entry */ err = vxlan_fdb_notify(vxlan, f, first_remote_rtnl(f), RTM_NEWNEIGH, true, extack); if (err) { vxlan_fdb_destroy(vxlan, f, false, false); if (remote_dev) netdev_upper_dev_unlink(remote_dev, dev); goto unregister; } } list_add(&vxlan->next, &vn->vxlan_list); if (remote_dev) dst->remote_dev = remote_dev; return 0; unlink: if (remote_dev) netdev_upper_dev_unlink(remote_dev, dev); errout: /* unregister_netdevice() destroys the default FDB entry with deletion * notification. But the addition notification was not sent yet, so * destroy the entry by hand here. */ if (f) __vxlan_fdb_free(f); unregister: if (unregister) unregister_netdevice(dev); return err; }
0
[]
net
6c8991f41546c3c472503dff1ea9daaddf9331c2
226,064,975,548,249,430,000,000,000,000,000,000,000
85
net: ipv6_stub: use ip6_dst_lookup_flow instead of ip6_dst_lookup ipv6_stub uses the ip6_dst_lookup function to allow other modules to perform IPv6 lookups. However, this function skips the XFRM layer entirely. All users of ipv6_stub->ip6_dst_lookup use ip_route_output_flow (via the ip_route_output_key and ip_route_output helpers) for their IPv4 lookups, which calls xfrm_lookup_route(). This patch fixes this inconsistent behavior by switching the stub to ip6_dst_lookup_flow, which also calls xfrm_lookup_route(). This requires some changes in all the callers, as these two functions take different arguments and have different return types. Fixes: 5f81bd2e5d80 ("ipv6: export a stub for IPv6 symbols used by vxlan") Reported-by: Xiumei Mu <[email protected]> Signed-off-by: Sabrina Dubroca <[email protected]> Signed-off-by: David S. Miller <[email protected]>
static void l2cap_sock_cleanup_listen(struct sock *parent) { struct sock *sk; BT_DBG("parent %p", parent); /* Close not yet accepted channels */ while ((sk = bt_accept_dequeue(parent, NULL))) l2cap_sock_close(sk); parent->sk_state = BT_CLOSED; sock_set_flag(parent, SOCK_ZAPPED); }
0
[ "CWE-200", "CWE-119", "CWE-787" ]
linux
f2fcfcd670257236ebf2088bbdf26f6a8ef459fe
73,990,770,799,403,110,000,000,000,000,000,000,000
13
Bluetooth: Add configuration support for ERTM and Streaming mode Add support to config_req and config_rsp to configure ERTM and Streaming mode. If the remote device specifies ERTM or Streaming mode, then the same mode is proposed. Otherwise ERTM or Basic mode is used. And in case of a state 2 device, the remote device should propose the same mode. If not, then the channel gets disconnected. Signed-off-by: Gustavo F. Padovan <[email protected]> Signed-off-by: Marcel Holtmann <[email protected]>
int bdrv_change_backing_file(BlockDriverState *bs, const char *backing_file, const char *backing_fmt) { BlockDriver *drv = bs->drv; int ret; /* Backing file format doesn't make sense without a backing file */ if (backing_fmt && !backing_file) { return -EINVAL; } if (drv->bdrv_change_backing_file != NULL) { ret = drv->bdrv_change_backing_file(bs, backing_file, backing_fmt); } else { ret = -ENOTSUP; } if (ret == 0) { pstrcpy(bs->backing_file, sizeof(bs->backing_file), backing_file ?: ""); pstrcpy(bs->backing_format, sizeof(bs->backing_format), backing_fmt ?: ""); } return ret; }
0
[ "CWE-190" ]
qemu
8f4754ede56e3f9ea3fd7207f4a7c4453e59285b
21,721,820,905,680,017,000,000,000,000,000,000,000
23
block: Limit request size (CVE-2014-0143) Limiting the size of a single request to INT_MAX not only fixes a direct integer overflow in bdrv_check_request() (which would only trigger bad behaviour with ridiculously huge images, as in close to 2^64 bytes), but can also prevent overflows in all block drivers. Signed-off-by: Kevin Wolf <[email protected]> Reviewed-by: Max Reitz <[email protected]> Signed-off-by: Stefan Hajnoczi <[email protected]>
cleanup_volume_info_contents(struct smb_vol *volume_info) { kfree(volume_info->username); kzfree(volume_info->password); kfree(volume_info->UNC); kfree(volume_info->domainname); kfree(volume_info->iocharset); kfree(volume_info->prepath); }
0
[ "CWE-703", "CWE-189" ]
linux
1fc29bacedeabb278080e31bb9c1ecb49f143c3b
241,853,358,551,893,180,000,000,000,000,000,000,000
9
cifs: fix off-by-one bug in build_unc_path_to_root commit 839db3d10a (cifs: fix up handling of prefixpath= option) changed the code such that the vol->prepath no longer contained a leading delimiter and then fixed up the places that accessed that field to account for that change. One spot in build_unc_path_to_root was missed however. When doing the pointer addition on pos, that patch failed to account for the fact that we had already incremented "pos" by one when adding the length of the prepath. This caused a buffer overrun by one byte. This patch fixes the problem by correcting the handling of "pos". Cc: <[email protected]> # v3.8+ Reported-by: Marcus Moeller <[email protected]> Reported-by: Ken Fallon <[email protected]> Signed-off-by: Jeff Layton <[email protected]> Signed-off-by: Steve French <[email protected]>
static struct crypto_alg *crypto_user_skcipher_alg(const char *name, u32 type, u32 mask) { int err; struct crypto_alg *alg; type = crypto_skcipher_type(type); mask = crypto_skcipher_mask(mask); for (;;) { alg = crypto_lookup_skcipher(name, type, mask); if (!IS_ERR(alg)) return alg; err = PTR_ERR(alg); if (err != -EAGAIN) break; if (signal_pending(current)) { err = -EINTR; break; } } return ERR_PTR(err); }
0
[ "CWE-264" ]
net
90f62cf30a78721641e08737bda787552428061e
286,082,665,534,734,500,000,000,000,000,000,000,000
25
net: Use netlink_ns_capable to verify the permisions of netlink messages It is possible by passing a netlink socket to a more privileged executable and then to fool that executable into writing to the socket data that happens to be valid netlink message to do something that privileged executable did not intend to do. To keep this from happening replace bare capable and ns_capable calls with netlink_capable, netlink_net_calls and netlink_ns_capable calls. Which act the same as the previous calls except they verify that the opener of the socket had the desired permissions as well. Reported-by: Andy Lutomirski <[email protected]> Signed-off-by: "Eric W. Biederman" <[email protected]> Signed-off-by: David S. Miller <[email protected]>
const HA_CREATE_INFO *get_create_info() { return create_info; };
0
[ "CWE-416" ]
server
4681b6f2d8c82b4ec5cf115e83698251963d80d5
118,055,922,252,642,940,000,000,000,000,000,000,000
1
MDEV-26281 ASAN use-after-poison when complex conversion is involved in blob the bug was that in_vector array in Item_func_in was allocated in the statement arena, not in the table->expr_arena. revert part of the 5acd391e8b2d. Instead, change the arena correctly in fix_all_session_vcol_exprs(). Remove TABLE_ARENA, that was introduced in 5acd391e8b2d to force item tree changes to be rolled back (because they were allocated in the wrong arena and didn't persist. now they do)
ossl_cipher_name(VALUE self) { EVP_CIPHER_CTX *ctx; GetCipher(self, ctx); return rb_str_new2(EVP_CIPHER_name(EVP_CIPHER_CTX_cipher(ctx))); }
0
[ "CWE-326", "CWE-310", "CWE-703" ]
openssl
8108e0a6db133f3375608303fdd2083eb5115062
133,374,412,865,782,100,000,000,000,000,000,000,000
8
cipher: don't set dummy encryption key in Cipher#initialize Remove the encryption key initialization from Cipher#initialize. This is effectively a revert of r32723 ("Avoid possible SEGV from AES encryption/decryption", 2011-07-28). r32723, which added the key initialization, was a workaround for Ruby Bug #2768. For some certain ciphers, calling EVP_CipherUpdate() before setting an encryption key caused segfault. It was not a problem until OpenSSL implemented GCM mode - the encryption key could be overridden by repeated calls of EVP_CipherInit_ex(). But, it is not the case for AES-GCM ciphers. Setting a key, an IV, a key, in this order causes the IV to be reset to an all-zero IV. The problem of Bug #2768 persists on the current versions of OpenSSL. So, make Cipher#update raise an exception if a key is not yet set by the user. Since encrypting or decrypting without key does not make any sense, this should not break existing applications. Users can still call Cipher#key= and Cipher#iv= multiple times with their own responsibility. Reference: https://bugs.ruby-lang.org/issues/2768 Reference: https://bugs.ruby-lang.org/issues/8221 Reference: https://github.com/ruby/openssl/issues/49
static int ext4_update_inline_data(handle_t *handle, struct inode *inode, unsigned int len) { int error; void *value = NULL; struct ext4_xattr_ibody_find is = { .s = { .not_found = -ENODATA, }, }; struct ext4_xattr_info i = { .name_index = EXT4_XATTR_INDEX_SYSTEM, .name = EXT4_XATTR_SYSTEM_DATA, }; /* If the old space is ok, write the data directly. */ if (len <= EXT4_I(inode)->i_inline_size) return 0; error = ext4_get_inode_loc(inode, &is.iloc); if (error) return error; error = ext4_xattr_ibody_find(inode, &i, &is); if (error) goto out; BUG_ON(is.s.not_found); len -= EXT4_MIN_INLINE_DATA_SIZE; value = kzalloc(len, GFP_NOFS); if (!value) { error = -ENOMEM; goto out; } error = ext4_xattr_ibody_get(inode, i.name_index, i.name, value, len); if (error == -ENODATA) goto out; BUFFER_TRACE(is.iloc.bh, "get_write_access"); error = ext4_journal_get_write_access(handle, is.iloc.bh); if (error) goto out; /* Update the xttr entry. */ i.value = value; i.value_len = len; error = ext4_xattr_ibody_inline_set(handle, inode, &i, &is); if (error) goto out; EXT4_I(inode)->i_inline_off = (u16)((void *)is.s.here - (void *)ext4_raw_inode(&is.iloc)); EXT4_I(inode)->i_inline_size = EXT4_MIN_INLINE_DATA_SIZE + le32_to_cpu(is.s.here->e_value_size); ext4_set_inode_state(inode, EXT4_STATE_MAY_INLINE_DATA); get_bh(is.iloc.bh); error = ext4_mark_iloc_dirty(handle, inode, &is.iloc); out: kfree(value); brelse(is.iloc.bh); return error; }
0
[ "CWE-416" ]
linux
117166efb1ee8f13c38f9e96b258f16d4923f888
175,683,131,920,801,800,000,000,000,000,000,000,000
65
ext4: do not allow external inodes for inline data The inline data feature was implemented before we added support for external inodes for xattrs. It makes no sense to support that combination, but the problem is that there are a number of extended attribute checks that are skipped if e_value_inum is non-zero. Unfortunately, the inline data code is completely e_value_inum unaware, and attempts to interpret the xattr fields as if it were an inline xattr --- at which point, Hilarty Ensues. This addresses CVE-2018-11412. https://bugzilla.kernel.org/show_bug.cgi?id=199803 Reported-by: Jann Horn <[email protected]> Reviewed-by: Andreas Dilger <[email protected]> Signed-off-by: Theodore Ts'o <[email protected]> Fixes: e50e5129f384 ("ext4: xattr-in-inode support") Cc: [email protected]
HeifContext::Image::Image(HeifContext* context, heif_item_id id) : m_heif_context(context), m_id(id) { memset(&m_depth_representation_info, 0, sizeof(m_depth_representation_info)); }
0
[ "CWE-125" ]
libheif
f7399b62d7fbc596f1b2871578c1d2053bedf1dd
174,418,373,408,588,100,000,000,000,000,000,000,000
6
Handle case where referenced "iref" box doesn't exist (fixes #138).
static bool shm_may_destroy(struct ipc_namespace *ns, struct shmid_kernel *shp) { return (shp->shm_nattch == 0) && (ns->shm_rmid_forced || (shp->shm_perm.mode & SHM_DEST)); }
0
[]
linux
95e91b831f87ac8e1f8ed50c14d709089b4e01b8
105,585,092,454,247,130,000,000,000,000,000,000,000
6
ipc/shm: Fix shmat mmap nil-page protection The issue is described here, with a nice testcase: https://bugzilla.kernel.org/show_bug.cgi?id=192931 The problem is that shmat() calls do_mmap_pgoff() with MAP_FIXED, and the address rounded down to 0. For the regular mmap case, the protection mentioned above is that the kernel gets to generate the address -- arch_get_unmapped_area() will always check for MAP_FIXED and return that address. So by the time we do security_mmap_addr(0) things get funky for shmat(). The testcase itself shows that while a regular user crashes, root will not have a problem attaching a nil-page. There are two possible fixes to this. The first, and which this patch does, is to simply allow root to crash as well -- this is also regular mmap behavior, ie when hacking up the testcase and adding mmap(... |MAP_FIXED). While this approach is the safer option, the second alternative is to ignore SHM_RND if the rounded address is 0, thus only having MAP_SHARED flags. This makes the behavior of shmat() identical to the mmap() case. The downside of this is obviously user visible, but does make sense in that it maintains semantics after the round-down wrt 0 address and mmap. Passes shm related ltp tests. Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Davidlohr Bueso <[email protected]> Reported-by: Gareth Evans <[email protected]> Cc: Manfred Spraul <[email protected]> Cc: Michael Kerrisk <[email protected]> Cc: <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
static int coroutine_fn fid_to_qid(V9fsPDU *pdu, V9fsFidState *fidp, V9fsQID *qidp) { struct stat stbuf; int err; err = v9fs_co_lstat(pdu, &fidp->path, &stbuf); if (err < 0) { return err; } err = stat_to_qid(pdu, &stbuf, qidp); if (err < 0) { return err; } return 0; }
0
[ "CWE-362" ]
qemu
89fbea8737e8f7b954745a1ffc4238d377055305
188,399,040,912,039,080,000,000,000,000,000,000,000
16
9pfs: Fully restart unreclaim loop (CVE-2021-20181) Depending on the client activity, the server can be asked to open a huge number of file descriptors and eventually hit RLIMIT_NOFILE. This is currently mitigated using a reclaim logic : the server closes the file descriptors of idle fids, based on the assumption that it will be able to re-open them later. This assumption doesn't hold of course if the client requests the file to be unlinked. In this case, we loop on the entire fid list and mark all related fids as unreclaimable (the reclaim logic will just ignore them) and, of course, we open or re-open their file descriptors if needed since we're about to unlink the file. This is the purpose of v9fs_mark_fids_unreclaim(). Since the actual opening of a file can cause the coroutine to yield, another client request could possibly add a new fid that we may want to mark as non-reclaimable as well. The loop is thus restarted if the re-open request was actually transmitted to the backend. This is achieved by keeping a reference on the first fid (head) before traversing the list. This is wrong in several ways: - a potential clunk request from the client could tear the first fid down and cause the reference to be stale. This leads to a use-after-free error that can be detected with ASAN, using a custom 9p client - fids are added at the head of the list : restarting from the previous head will always miss fids added by a some other potential request All these problems could be avoided if fids were being added at the end of the list. This can be achieved with a QSIMPLEQ, but this is probably too much change for a bug fix. For now let's keep it simple and just restart the loop from the current head. Fixes: CVE-2021-20181 Buglink: https://bugs.launchpad.net/qemu/+bug/1911666 Reported-by: Zero Day Initiative <[email protected]> Reviewed-by: Christian Schoenebeck <[email protected]> Reviewed-by: Stefano Stabellini <[email protected]> Message-Id: <[email protected]> Signed-off-by: Greg Kurz <[email protected]>
GF_Box *trgt_box_new() { ISOM_DECL_BOX_ALLOC(GF_TrackGroupTypeBox, GF_ISOM_BOX_TYPE_TRGT); return (GF_Box *)tmp; }
0
[ "CWE-787" ]
gpac
77510778516803b7f7402d7423c6d6bef50254c3
190,912,455,070,253,600,000,000,000,000,000,000,000
5
fixed #2255
tls_openssl_one_option_parse(uschar *name, long *value) { int first = 0; int last = exim_openssl_options_size; while (last > first) { int middle = (first + last)/2; int c = Ustrcmp(name, exim_openssl_options[middle].name); if (c == 0) { *value = exim_openssl_options[middle].value; return TRUE; } else if (c > 0) first = middle + 1; else last = middle; } return FALSE; }
0
[ "CWE-264" ]
exim
43ba2742c700d625dcdcdaf7bbadc2f72776854a
164,231,293,502,927,650,000,000,000,000,000,000,000
20
Fix CVE-2016-1531 Add keep_environment, add_environment. Change the working directory to "/" during the early startup phase. (cherry picked from commit bc3c7bb7d4aba3e563434e5627fe1f2176aa18c0) (cherry picked from commit 2b92b67bfc33efe05e6ff2ea3852731ac2273832) (cherry picked from commit 14b82c8b736c8ed24eda144f57703cb9feac6323) (cherry picked from commit 9ca92d0c6e9c6f161bd8111366c6952d3a9315e2) (cherry picked from commit 0020c6d9ecfd98ed7b2b337ed4f898fdc409784b) (cherry picked from commit e8f96966360ea8867ad6a8b5affda6c37fa4958c) (cherry picked from commit ef6fb807c1e1a665f444f644c60c77269f7c5209)
static const char *repr_timer(const struct timer_list *t) { if (!READ_ONCE(t->expires)) return "inactive"; if (timer_pending(t)) return "active"; return "expired"; }
0
[ "CWE-20", "CWE-190" ]
linux
c784e5249e773689e38d2bc1749f08b986621a26
195,429,615,411,161,800,000,000,000,000,000,000,000
10
drm/i915/guc: Update to use firmware v49.0.1 The latest GuC firmware includes a number of interface changes that require driver updates to match. * Starting from Gen11, the ID to be provided to GuC needs to contain the engine class in bits [0..2] and the instance in bits [3..6]. NOTE: this patch breaks pointer dereferences in some existing GuC functions that use the guc_id to dereference arrays but these functions are not used for now as we have GuC submission disabled and we will update these functions in follow up patch which requires new IDs. * The new GuC requires the additional data structure (ADS) and associated 'private_data' pointer to be setup. This is basically a scratch area of memory that the GuC owns. The size is read from the CSS header. * There is now a physical to logical engine mapping table in the ADS which needs to be configured in order for the firmware to load. For now, the table is initialised with a 1 to 1 mapping. * GUC_CTL_CTXINFO has been removed from the initialization params. * reg_state_buffer is maintained internally by the GuC as part of the private data. * The ADS layout has changed significantly. This patch updates the shared structure and also adds better documentation of the layout. * While i915 does not use GuC doorbells, the firmware now requires that some initialisation is done. * The number of engine classes and instances supported in the ADS has been increased. Signed-off-by: John Harrison <[email protected]> Signed-off-by: Matthew Brost <[email protected]> Signed-off-by: Daniele Ceraolo Spurio <[email protected]> Signed-off-by: Oscar Mateo <[email protected]> Signed-off-by: Michel Thierry <[email protected]> Signed-off-by: Rodrigo Vivi <[email protected]> Signed-off-by: Michal Wajdeczko <[email protected]> Cc: Michal Winiarski <[email protected]> Cc: Tomasz Lis <[email protected]> Cc: Joonas Lahtinen <[email protected]> Reviewed-by: Daniele Ceraolo Spurio <[email protected]> Signed-off-by: Joonas Lahtinen <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
explicit SparseMatMulOp(OpKernelConstruction* ctx) : OpKernel(ctx) { OP_REQUIRES_OK(ctx, ctx->GetAttr("transpose_a", &transpose_a_)); OP_REQUIRES_OK(ctx, ctx->GetAttr("transpose_b", &transpose_b_)); OP_REQUIRES_OK(ctx, ctx->GetAttr("a_is_sparse", &a_is_sparse_)); OP_REQUIRES_OK(ctx, ctx->GetAttr("b_is_sparse", &b_is_sparse_)); }
0
[ "CWE-125" ]
tensorflow
e6cf28c72ba2eb949ca950d834dd6d66bb01cfae
185,436,184,983,355,660,000,000,000,000,000,000,000
6
Validate that matrix dimension sizes in SparseMatMul are positive. PiperOrigin-RevId: 401149683 Change-Id: Ib33eafc561a39c8741ece80b2edce6d4aae9a57d
static int l2cap_move_channel_rsp(struct l2cap_conn *conn, struct l2cap_cmd_hdr *cmd, u16 cmd_len, void *data) { struct l2cap_move_chan_rsp *rsp = data; u16 icid, result; if (cmd_len != sizeof(*rsp)) return -EPROTO; icid = le16_to_cpu(rsp->icid); result = le16_to_cpu(rsp->result); BT_DBG("icid 0x%4.4x, result 0x%4.4x", icid, result); if (result == L2CAP_MR_SUCCESS || result == L2CAP_MR_PEND) l2cap_move_continue(conn, icid, result); else l2cap_move_fail(conn, cmd->ident, icid, result); return 0; }
0
[ "CWE-787" ]
linux
e860d2c904d1a9f38a24eb44c9f34b8f915a6ea3
316,980,757,078,258,700,000,000,000,000,000,000,000
22
Bluetooth: Properly check L2CAP config option output buffer length Validate the output buffer length for L2CAP config requests and responses to avoid overflowing the stack buffer used for building the option blocks. Cc: [email protected] Signed-off-by: Ben Seri <[email protected]> Signed-off-by: Marcel Holtmann <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
static void accumulate_thread_rusage(struct task_struct *t, struct rusage *r) { r->ru_nvcsw += t->nvcsw; r->ru_nivcsw += t->nivcsw; r->ru_minflt += t->min_flt; r->ru_majflt += t->maj_flt; r->ru_inblock += task_io_get_inblock(t); r->ru_oublock += task_io_get_oublock(t); }
0
[ "CWE-264" ]
linux
259e5e6c75a910f3b5e656151dc602f53f9d7548
64,962,982,175,020,930,000,000,000,000,000,000,000
9
Add PR_{GET,SET}_NO_NEW_PRIVS to prevent execve from granting privs With this change, calling prctl(PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0) disables privilege granting operations at execve-time. For example, a process will not be able to execute a setuid binary to change their uid or gid if this bit is set. The same is true for file capabilities. Additionally, LSM_UNSAFE_NO_NEW_PRIVS is defined to ensure that LSMs respect the requested behavior. To determine if the NO_NEW_PRIVS bit is set, a task may call prctl(PR_GET_NO_NEW_PRIVS, 0, 0, 0, 0); It returns 1 if set and 0 if it is not set. If any of the arguments are non-zero, it will return -1 and set errno to -EINVAL. (PR_SET_NO_NEW_PRIVS behaves similarly.) This functionality is desired for the proposed seccomp filter patch series. By using PR_SET_NO_NEW_PRIVS, it allows a task to modify the system call behavior for itself and its child tasks without being able to impact the behavior of a more privileged task. Another potential use is making certain privileged operations unprivileged. For example, chroot may be considered "safe" if it cannot affect privileged tasks. Note, this patch causes execve to fail when PR_SET_NO_NEW_PRIVS is set and AppArmor is in use. It is fixed in a subsequent patch. Signed-off-by: Andy Lutomirski <[email protected]> Signed-off-by: Will Drewry <[email protected]> Acked-by: Eric Paris <[email protected]> Acked-by: Kees Cook <[email protected]> v18: updated change desc v17: using new define values as per 3.4 Signed-off-by: James Morris <[email protected]>
option_env_cb (const gchar *option_name, const gchar *value, gpointer data, GError **error) { FlatpakContext *context = data; g_auto(GStrv) split = g_strsplit (value, "=", 2); if (split == NULL || split[0] == NULL || split[0][0] == 0 || split[1] == NULL) { g_set_error (error, G_OPTION_ERROR, G_OPTION_ERROR_FAILED, _("Invalid env format %s"), value); return FALSE; } flatpak_context_set_env_var (context, split[0], split[1]); return TRUE; }
0
[ "CWE-20" ]
flatpak
902fb713990a8f968ea4350c7c2a27ff46f1a6c4
11,818,103,766,517,184,000,000,000,000,000,000,000
19
Use seccomp to filter out TIOCSTI ioctl This would otherwise let the sandbox add input to the controlling tty.
static void lo_getlk(fuse_req_t req, fuse_ino_t ino, struct fuse_file_info *fi, struct flock *lock) { struct lo_data *lo = lo_data(req); struct lo_inode *inode; struct lo_inode_plock *plock; int ret, saverr = 0; fuse_log(FUSE_LOG_DEBUG, "lo_getlk(ino=%" PRIu64 ", flags=%d)" " owner=0x%lx, l_type=%d l_start=0x%lx" " l_len=0x%lx\n", ino, fi->flags, fi->lock_owner, lock->l_type, lock->l_start, lock->l_len); if (!lo->posix_lock) { fuse_reply_err(req, ENOSYS); return; } inode = lo_inode(req, ino); if (!inode) { fuse_reply_err(req, EBADF); return; } pthread_mutex_lock(&inode->plock_mutex); plock = lookup_create_plock_ctx(lo, inode, fi->lock_owner, lock->l_pid, &ret); if (!plock) { saverr = ret; goto out; } ret = fcntl(plock->fd, F_OFD_GETLK, lock); if (ret == -1) { saverr = errno; } out: pthread_mutex_unlock(&inode->plock_mutex); lo_inode_put(lo, &inode); if (saverr) { fuse_reply_err(req, saverr); } else { fuse_reply_lock(req, lock); } }
0
[ "CWE-281" ]
qemu
e586edcb410543768ef009eaa22a2d9dd4a53846
148,599,260,131,645,640,000,000,000,000,000,000,000
49
virtiofs: drop remapped security.capability xattr as needed On Linux, the 'security.capability' xattr holds a set of capabilities that can change when an executable is run, giving a limited form of privilege escalation to those programs that the writer of the file deemed worthy. Any write causes the 'security.capability' xattr to be dropped, stopping anyone from gaining privilege by modifying a blessed file. Fuse relies on the daemon to do this dropping, and in turn the daemon relies on the host kernel to drop the xattr for it. However, with the addition of -o xattrmap, the xattr that the guest stores its capabilities in is now not the same as the one that the host kernel automatically clears. Where the mapping changes 'security.capability', explicitly clear the remapped name to preserve the same behaviour. This bug is assigned CVE-2021-20263. Signed-off-by: Dr. David Alan Gilbert <[email protected]> Reviewed-by: Vivek Goyal <[email protected]>
pdf14_mark_fill_rectangle_ko_simple(gx_device * dev, int x, int y, int w, int h, gx_color_index color, const gx_device_color *pdc, bool devn) { pdf14_device *pdev = (pdf14_device *)dev; pdf14_buf *buf = pdev->ctx->stack; gs_blend_mode_t blend_mode = pdev->blend_mode; int i, j, k; byte *bline, *bg_ptr, *line, *dst_ptr; byte src[PDF14_MAX_PLANES]; byte dst[PDF14_MAX_PLANES] = { 0 }; int rowstride = buf->rowstride; int planestride = buf->planestride; int num_chan = buf->n_chan; int num_comp = num_chan - 1; int shape_off = num_chan * planestride; bool has_shape = buf->has_shape; bool has_alpha_g = buf->has_alpha_g; int alpha_g_off = shape_off + (has_shape ? planestride : 0); int tag_off = shape_off + (has_alpha_g ? planestride : 0) + (has_shape ? planestride : 0); bool has_tags = buf->has_tags; bool additive = pdev->ctx->additive; gs_graphics_type_tag_t curr_tag = GS_UNKNOWN_TAG; /* Quiet compiler */ gx_color_index mask = ((gx_color_index)1 << 8) - 1; int shift = 8; byte shape = 0; /* Quiet compiler. */ byte src_alpha; bool overprint = pdev->overprint; gx_color_index drawn_comps = pdev->drawn_comps; gx_color_index comps; if (buf->data == NULL) return 0; #if 0 if (sizeof(color) <= sizeof(ulong)) if_debug6m('v', dev->memory, "[v]pdf14_mark_fill_rectangle_ko_simple, (%d, %d), %d x %d color = %lx, nc %d,\n", x, y, w, h, (ulong)color, num_chan); else if_debug7m('v', dev->memory, "[v]pdf14_mark_fill_rectangle_ko_simple, (%d, %d), %d x %d color = %8lx%08lx, nc %d,\n", x, y, w, h, (ulong)(color >> 8*(sizeof(color) - sizeof(ulong))), (ulong)color, num_chan); #endif /* * Unpack the gx_color_index values. Complement the components for subtractive * color spaces. */ if (devn) { if (additive) { for (j = 0; j < num_comp; j++) { src[j] = ((pdc->colors.devn.values[j]) >> shift & mask); } } else { for (j = 0; j < num_comp; j++) { src[j] = 255 - ((pdc->colors.devn.values[j]) >> shift & mask); } } } else pdev->pdf14_procs->unpack_color(num_comp, color, pdev, src); src_alpha = src[num_comp] = (byte)floor (255 * pdev->alpha + 0.5); if (has_shape) { shape = (byte)floor (255 * pdev->shape + 0.5); } else { shape_off = 0; } if (has_tags) { curr_tag = (color >> (num_comp*8)) & 0xff; } else { tag_off = 0; } if (!has_alpha_g) alpha_g_off = 0; src_alpha = 255 - src_alpha; shape = 255 - shape; /* Fit the mark into the bounds of the buffer */ if (x < buf->rect.p.x) { w += x - buf->rect.p.x; x = buf->rect.p.x; } if (y < buf->rect.p.y) { h += y - buf->rect.p.y; y = buf->rect.p.y; } if (x + w > buf->rect.q.x) w = buf->rect.q.x - x; if (y + h > buf->rect.q.y) h = buf->rect.q.y - y; /* Update the dirty rectangle with the mark. */ if (x < buf->dirty.p.x) buf->dirty.p.x = x; if (y < buf->dirty.p.y) buf->dirty.p.y = y; if (x + w > buf->dirty.q.x) buf->dirty.q.x = x + w; if (y + h > buf->dirty.q.y) buf->dirty.q.y = y + h; /* composite with backdrop only */ bline = buf->backdrop + (x - buf->rect.p.x) + (y - buf->rect.p.y) * rowstride; line = buf->data + (x - buf->rect.p.x) + (y - buf->rect.p.y) * rowstride; for (j = 0; j < h; ++j) { bg_ptr = bline; dst_ptr = line; for (i = 0; i < w; ++i) { /* Complement the components for subtractive color spaces */ if (additive) { for (k = 0; k < num_chan; ++k) dst[k] = bg_ptr[k * planestride]; } else { for (k = 0; k < num_comp; ++k) dst[k] = 255 - bg_ptr[k * planestride]; } dst[num_comp] = bg_ptr[num_comp * planestride]; /* alpha doesn't invert */ if (buf->isolated) { art_pdf_knockoutisolated_group_8(dst, src, num_comp); } else { art_pdf_composite_knockout_8(dst, src, num_comp, blend_mode, pdev->blend_procs, pdev); } /* Complement the results for subtractive color spaces */ if (additive) { for (k = 0; k < num_chan; ++k) dst_ptr[k * planestride] = dst[k]; } else { if (overprint) { for (k = 0, comps = drawn_comps; comps != 0; ++k, comps >>= 1) { if ((comps & 0x1) != 0) { dst_ptr[k * planestride] = 255 - dst[k]; } } } else { for (k = 0; k < num_comp; ++k) dst_ptr[k * planestride] = 255 - dst[k]; } dst_ptr[num_comp * planestride] = dst[num_comp]; } if (tag_off) { /* If src alpha is 100% then set to curr_tag, else or */ /* other than Normal BM, we always OR */ if (src[num_comp] == 255 && blend_mode == BLEND_MODE_Normal) { dst_ptr[tag_off] = curr_tag; } else { dst_ptr[tag_off] |= curr_tag; } } if (alpha_g_off) { int tmp = (255 - dst_ptr[alpha_g_off]) * src_alpha + 0x80; dst_ptr[alpha_g_off] = 255 - ((tmp + (tmp >> 8)) >> 8); } if (shape_off) { int tmp = (255 - dst_ptr[shape_off]) * shape + 0x80; dst_ptr[shape_off] = 255 - ((tmp + (tmp >> 8)) >> 8); } ++dst_ptr; ++bg_ptr; } bline += rowstride; line += rowstride; } #if 0 /* #if RAW_DUMP */ /* Dump the current buffer to see what we have. */ dump_raw_buffer(pdev->ctx->stack->rect.q.y-pdev->ctx->stack->rect.p.y, pdev->ctx->stack->rect.q.x-pdev->ctx->stack->rect.p.x, pdev->ctx->stack->n_planes, pdev->ctx->stack->planestride, pdev->ctx->stack->rowstride, "Draw_Rect_KO",pdev->ctx->stack->data); global_index++; #endif return 0; }
0
[]
ghostpdl
ea1b3ef437f39e45874f821c06bd953196625ac5
202,103,788,107,165,950,000,000,000,000,000,000,000
171
Bug 700176: Use the actual output device for both devices in setdevice Also fixes bug 700189. The pdf14 compositor device, despite being a forwarding device, does not forward all spec_ops to it's target, only a select few are special cased for that. gxdso_current_output_device needs to be included in those special cases. The original commit (661e8d8fb8248) changed the code to use the spec_op to retrieve the output device, checking that for LockSafetyParams. If LockSafetyParams is set, it returns an invalidaccess error if the new device differs from the current device. When we do the comparison between the two devices, we need to check the output device in both cases. This is complicated by the fact that the new device may not have ever been set (and thus fully initialised), and may not have a spec_op method available at that point.
static struct link_encoder *dce120_link_encoder_create( const struct encoder_init_data *enc_init_data) { struct dce110_link_encoder *enc110 = kzalloc(sizeof(struct dce110_link_encoder), GFP_KERNEL); if (!enc110) return NULL; dce110_link_encoder_construct(enc110, enc_init_data, &link_enc_feature, &link_enc_regs[enc_init_data->transmitter], &link_enc_aux_regs[enc_init_data->channel - 1], &link_enc_hpd_regs[enc_init_data->hpd_source]); return &enc110->base; }
0
[ "CWE-400", "CWE-401" ]
linux
104c307147ad379617472dd91a5bcb368d72bd6d
212,110,739,858,479,800,000,000,000,000,000,000,000
18
drm/amd/display: prevent memory leak In dcn*_create_resource_pool the allocated memory should be released if construct pool fails. Reviewed-by: Harry Wentland <[email protected]> Signed-off-by: Navid Emamdoost <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
static krb5_deltat get_rc_clockskew(krb5_context context) { krb5_rcache rc; krb5_deltat clockskew; if (krb5_rc_default(context, &rc)) return KSSL_CLOCKSKEW; if (krb5_rc_initialize(context, rc, 0)) return KSSL_CLOCKSKEW; if (krb5_rc_get_lifespan(context, rc, &clockskew)) { clockskew = KSSL_CLOCKSKEW; } (void) krb5_rc_destroy(context, rc); return clockskew; }
0
[ "CWE-20" ]
openssl
cca1cd9a3447dd067503e4a85ebd1679ee78a48e
21,370,947,124,817,540,000,000,000,000,000,000,000
13
Submitted by: Tomas Hoger <[email protected]> Fix for CVE-2010-0433 where some kerberos enabled versions of OpenSSL could be crashed if the relevant tables were not present (e.g. chrooted).
LinkerOptHint* Binary::linker_opt_hint() { return const_cast<LinkerOptHint*>(static_cast<const Binary*>(this)->linker_opt_hint()); }
0
[ "CWE-703" ]
LIEF
7acf0bc4224081d4f425fcc8b2e361b95291d878
253,965,887,704,115,640,000,000,000,000,000,000,000
3
Resolve #764
int enc_untrusted_clock_gettime(clockid_t clk_id, struct timespec *tp) { clockid_t klinux_clk_id = TokLinuxClockId(clk_id); if (klinux_clk_id == -1) { errno = EINVAL; return -1; } MessageWriter input; input.Push<int64_t>(klinux_clk_id); MessageReader output; asylo::primitives::PrimitiveStatus status = asylo::host_call::NonSystemCallDispatcher( asylo::host_call::kClockGettimeHandler, &input, &output); CheckStatusAndParamCount(status, output, "enc_untrusted_clock_gettime", 3); int result = output.next<int>(); int klinux_errno = output.next<int>(); struct kLinux_timespec klinux_tp = output.next<struct kLinux_timespec>(); // clock_gettime returns -1 on error and sets the errno. if (result == -1) { errno = FromkLinuxErrorNumber(klinux_errno); return -1; } FromkLinuxtimespec(&klinux_tp, tp); return result; }
0
[ "CWE-125" ]
asylo
b1d120a2c7d7446d2cc58d517e20a1b184b82200
55,458,145,143,282,700,000,000,000,000,000,000,000
28
Check for return size in enc_untrusted_read Check return size does not exceed requested. The returned result and content still cannot be trusted, but it's expected behavior when not using a secure file system. PiperOrigin-RevId: 333827386 Change-Id: I0bdec0aec9356ea333dc8c647eba5d2772875f29
int ext4_xattr_ibody_inline_set(handle_t *handle, struct inode *inode, struct ext4_xattr_info *i, struct ext4_xattr_ibody_find *is) { struct ext4_xattr_ibody_header *header; struct ext4_xattr_search *s = &is->s; int error; if (EXT4_I(inode)->i_extra_isize == 0) return -ENOSPC; error = ext4_xattr_set_entry(i, s); if (error) { if (error == -ENOSPC && ext4_has_inline_data(inode)) { error = ext4_try_to_evict_inline_data(handle, inode, EXT4_XATTR_LEN(strlen(i->name) + EXT4_XATTR_SIZE(i->value_len))); if (error) return error; error = ext4_xattr_ibody_find(inode, i, is); if (error) return error; error = ext4_xattr_set_entry(i, s); } if (error) return error; } header = IHDR(inode, ext4_raw_inode(&is->iloc)); if (!IS_LAST_ENTRY(s->first)) { header->h_magic = cpu_to_le32(EXT4_XATTR_MAGIC); ext4_set_inode_state(inode, EXT4_STATE_XATTR); } else { header->h_magic = cpu_to_le32(0); ext4_clear_inode_state(inode, EXT4_STATE_XATTR); } return 0; }
0
[ "CWE-241", "CWE-19" ]
linux
82939d7999dfc1f1998c4b1c12e2f19edbdff272
29,549,387,594,660,940,000,000,000,000,000,000,000
37
ext4: convert to mbcache2 The conversion is generally straightforward. The only tricky part is that xattr block corresponding to found mbcache entry can get freed before we get buffer lock for that block. So we have to check whether the entry is still valid after getting buffer lock. Signed-off-by: Jan Kara <[email protected]> Signed-off-by: Theodore Ts'o <[email protected]>
static char *asn1time_to_string (ASN1_UTCTIME *tm) { static char buf[64]; BIO *bio; strfcpy (buf, _("[invalid date]"), sizeof (buf)); bio = BIO_new (BIO_s_mem()); if (bio) { if (ASN1_TIME_print (bio, tm)) (void) BIO_read (bio, buf, sizeof (buf)); BIO_free (bio); } return buf; }
0
[ "CWE-74" ]
mutt
c547433cdf2e79191b15c6932c57f1472bfb5ff4
1,203,938,856,863,390,800,000,000,000,000,000,000
17
Fix STARTTLS response injection attack. Thanks again to Damian Poddebniak and Fabian Ising from the Münster University of Applied Sciences for reporting this issue. Their summary in ticket 248 states the issue clearly: We found another STARTTLS-related issue in Mutt. Unfortunately, it affects SMTP, POP3 and IMAP. When the server responds with its "let's do TLS now message", e.g. A OK begin TLS\r\n in IMAP or +OK begin TLS\r\n in POP3, Mutt will also read any data after the \r\n and save it into some internal buffer for later processing. This is problematic, because a MITM attacker can inject arbitrary responses. There is a nice blogpost by Wietse Venema about a "command injection" in postfix (http://www.postfix.org/CVE-2011-0411.html). What we have here is the problem in reverse, i.e. not a command injection, but a "response injection." This commit fixes the issue by clearing the CONNECTION input buffer in mutt_ssl_starttls(). To make backporting this fix easier, the new functions only clear the top-level CONNECTION buffer; they don't handle nested buffering in mutt_zstrm.c or mutt_sasl.c. However both of those wrap the connection *after* STARTTLS, so this is currently okay. mutt_tunnel.c occurs before connecting, but it does not perform any nesting.
static void nfc_sock_unlink(struct nfc_sock_list *l, struct sock *sk) { write_lock(&l->lock); sk_del_node_init(sk); write_unlock(&l->lock); }
0
[ "CWE-276", "CWE-703" ]
linux
26896f01467a28651f7a536143fe5ac8449d4041
30,489,459,246,821,750,000,000,000,000,000,000,000
6
net/nfc/rawsock.c: add CAP_NET_RAW check. When creating a raw AF_NFC socket, CAP_NET_RAW needs to be checked first. Signed-off-by: Qingyu Li <[email protected]> Signed-off-by: David S. Miller <[email protected]>
static int dm_request_for_irq_injection(struct kvm_vcpu *vcpu) { return (!irqchip_in_kernel(vcpu->kvm) && !kvm_cpu_has_interrupt(vcpu) && vcpu->run->request_interrupt_window && kvm_arch_interrupt_allowed(vcpu)); }
0
[ "CWE-200" ]
kvm
831d9d02f9522e739825a51a11e3bc5aa531a905
196,634,733,914,928,720,000,000,000,000,000,000,000
6
KVM: x86: fix information leak to userland Structures kvm_vcpu_events, kvm_debugregs, kvm_pit_state2 and kvm_clock_data are copied to userland with some padding and reserved fields unitialized. It leads to leaking of contents of kernel stack memory. We have to initialize them to zero. In patch v1 Jan Kiszka suggested to fill reserved fields with zeros instead of memset'ting the whole struct. It makes sense as these fields are explicitly marked as padding. No more fields need zeroing. KVM-Stable-Tag. Signed-off-by: Vasiliy Kulikov <[email protected]> Signed-off-by: Marcelo Tosatti <[email protected]>
PackLinuxElf32::check_pt_dynamic(Elf32_Phdr const *const phdr) { unsigned t = get_te32(&phdr->p_offset), s = sizeof(Elf32_Dyn) + t; unsigned vaddr = get_te32(&phdr->p_vaddr); unsigned filesz = get_te32(&phdr->p_filesz), memsz = get_te32(&phdr->p_memsz); unsigned align = get_te32(&phdr->p_align); if (s < t || (u32_t)file_size < s || (3 & t) || (7 & (filesz | memsz)) // .balign 4; 8==sizeof(Elf32_Dyn) || (-1+ align) & (t ^ vaddr) || (unsigned long)file_size <= memsz || filesz < sizeof(Elf32_Dyn) || memsz < sizeof(Elf32_Dyn) || filesz < memsz) { char msg[50]; snprintf(msg, sizeof(msg), "bad PT_DYNAMIC phdr[%u]", (unsigned)(phdr - phdri)); throwCantPack(msg); } sz_dynseg = memsz; return t; }
1
[ "CWE-787" ]
upx
73b854874e723f38e84e5ff57a9eeb99653ca74c
221,719,513,168,164,470,000,000,000,000,000,000,000
20
Defend against junk PT_DYNAMIC https://github.com/upx/upx/issues/390 modified: p_lx_elf.cpp
cJSON *cJSON_CreateObject(void) {cJSON *item=cJSON_New_Item();if(item)item->type=cJSON_Object;return item;}
0
[ "CWE-120", "CWE-119", "CWE-787" ]
iperf
91f2fa59e8ed80dfbf400add0164ee0e508e412a
98,014,010,381,905,390,000,000,000,000,000,000,000
1
Fix a buffer overflow / heap corruption issue that could occur if a malformed JSON string was passed on the control channel. This issue, present in the cJSON library, was already fixed upstream, so was addressed here in iperf3 by importing a newer version of cJSON (plus local ESnet modifications). Discovered and reported by Dave McDaniel, Cisco Talos. Based on a patch by @dopheide-esnet, with input from @DaveGamble. Cross-references: TALOS-CAN-0164, ESNET-SECADV-2016-0001, CVE-2016-4303 (cherry picked from commit ed94082be27d971a5e1b08b666e2c217cf470a40) Signed-off-by: Bruce A. Mah <[email protected]>
struct sk_buff *sock_alloc_send_pskb(struct sock *sk, unsigned long header_len, unsigned long data_len, int noblock, int *errcode, int max_page_order) { struct sk_buff *skb = NULL; unsigned long chunk; gfp_t gfp_mask; long timeo; int err; int npages = (data_len + (PAGE_SIZE - 1)) >> PAGE_SHIFT; struct page *page; int i; err = -EMSGSIZE; if (npages > MAX_SKB_FRAGS) goto failure; timeo = sock_sndtimeo(sk, noblock); while (!skb) { err = sock_error(sk); if (err != 0) goto failure; err = -EPIPE; if (sk->sk_shutdown & SEND_SHUTDOWN) goto failure; if (atomic_read(&sk->sk_wmem_alloc) >= sk->sk_sndbuf) { set_bit(SOCK_ASYNC_NOSPACE, &sk->sk_socket->flags); set_bit(SOCK_NOSPACE, &sk->sk_socket->flags); err = -EAGAIN; if (!timeo) goto failure; if (signal_pending(current)) goto interrupted; timeo = sock_wait_for_wmem(sk, timeo); continue; } err = -ENOBUFS; gfp_mask = sk->sk_allocation; if (gfp_mask & __GFP_WAIT) gfp_mask |= __GFP_REPEAT; skb = alloc_skb(header_len, gfp_mask); if (!skb) goto failure; skb->truesize += data_len; for (i = 0; npages > 0; i++) { int order = max_page_order; while (order) { if (npages >= 1 << order) { page = alloc_pages(sk->sk_allocation | __GFP_COMP | __GFP_NOWARN | __GFP_NORETRY, order); if (page) goto fill_page; } order--; } page = alloc_page(sk->sk_allocation); if (!page) goto failure; fill_page: chunk = min_t(unsigned long, data_len, PAGE_SIZE << order); skb_fill_page_desc(skb, i, page, 0, chunk); data_len -= chunk; npages -= 1 << order; } } skb_set_owner_w(skb, sk); return skb; interrupted: err = sock_intr_errno(timeo); failure: kfree_skb(skb); *errcode = err; return NULL; }
0
[]
linux
7bced397510ab569d31de4c70b39e13355046387
296,851,497,144,620,500,000,000,000,000,000,000,000
87
net_dma: simple removal Per commit "77873803363c net_dma: mark broken" net_dma is no longer used and there is no plan to fix it. This is the mechanical removal of bits in CONFIG_NET_DMA ifdef guards. Reverting the remainder of the net_dma induced changes is deferred to subsequent patches. Marked for stable due to Roman's report of a memory leak in dma_pin_iovec_pages(): https://lkml.org/lkml/2014/9/3/177 Cc: Dave Jiang <[email protected]> Cc: Vinod Koul <[email protected]> Cc: David Whipple <[email protected]> Cc: Alexander Duyck <[email protected]> Cc: <[email protected]> Reported-by: Roman Gushchin <[email protected]> Acked-by: David S. Miller <[email protected]> Signed-off-by: Dan Williams <[email protected]>
command_height(void) { int h; frame_T *frp; int old_p_ch = curtab->tp_ch_used; // Use the value of p_ch that we remembered. This is needed for when the // GUI starts up, we can't be sure in what order things happen. And when // p_ch was changed in another tab page. curtab->tp_ch_used = p_ch; // Find bottom frame with width of screen. frp = lastwin->w_frame; while (frp->fr_width != Columns && frp->fr_parent != NULL) frp = frp->fr_parent; // Avoid changing the height of a window with 'winfixheight' set. while (frp->fr_prev != NULL && frp->fr_layout == FR_LEAF && frp->fr_win->w_p_wfh) frp = frp->fr_prev; if (starting != NO_SCREEN) { cmdline_row = Rows - p_ch; if (p_ch > old_p_ch) // p_ch got bigger { while (p_ch > old_p_ch) { if (frp == NULL) { emsg(_(e_not_enough_room)); p_ch = old_p_ch; curtab->tp_ch_used = p_ch; cmdline_row = Rows - p_ch; break; } h = frp->fr_height - frame_minheight(frp, NULL); if (h > p_ch - old_p_ch) h = p_ch - old_p_ch; old_p_ch += h; frame_add_height(frp, -h); frp = frp->fr_prev; } // Recompute window positions. (void)win_comp_pos(); // clear the lines added to cmdline if (full_screen) screen_fill((int)(cmdline_row), (int)Rows, 0, (int)Columns, ' ', ' ', 0); msg_row = cmdline_row; redraw_cmdline = TRUE; return; } if (msg_row < cmdline_row) msg_row = cmdline_row; redraw_cmdline = TRUE; } frame_add_height(frp, (int)(old_p_ch - p_ch)); // Recompute window positions. if (frp != lastwin->w_frame) (void)win_comp_pos(); }
0
[ "CWE-703", "CWE-125" ]
vim
05b27615481e72e3b338bb12990fb3e0c2ecc2a9
154,347,631,571,160,800,000,000,000,000,000,000,000
67
patch 8.2.4154: ml_get error when exchanging windows in Visual mode Problem: ml_get error when exchanging windows in Visual mode. Solution: Correct end of Visual area when entering another buffer.
static pj_status_t ssl_create(pj_ssl_sock_t *ssock) { ossl_sock_t *ossock = (ossl_sock_t *)ssock; #if !defined(OPENSSL_NO_DH) BIO *bio; DH *dh; long options; #endif SSL_METHOD *ssl_method = NULL; SSL_CTX *ctx; pj_uint32_t ssl_opt = 0; pj_ssl_cert_t *cert; int mode, rc; pj_status_t status; pj_assert(ssock); cert = ssock->cert; /* Make sure OpenSSL library has been initialized */ init_openssl(); set_entropy(ssock); if (ssock->param.proto == PJ_SSL_SOCK_PROTO_DEFAULT) ssock->param.proto = PJ_SSL_SOCK_PROTO_SSL23; /* Determine SSL method to use */ /* Specific version methods are deprecated since 1.1.0 */ #if (USING_LIBRESSL && LIBRESSL_VERSION_NUMBER < 0x2020100fL)\ || OPENSSL_VERSION_NUMBER < 0x10100000L switch (ssock->param.proto) { case PJ_SSL_SOCK_PROTO_TLS1: ssl_method = (SSL_METHOD*)TLSv1_method(); break; #ifndef OPENSSL_NO_SSL2 case PJ_SSL_SOCK_PROTO_SSL2: ssl_method = (SSL_METHOD*)SSLv2_method(); break; #endif #ifndef OPENSSL_NO_SSL3_METHOD case PJ_SSL_SOCK_PROTO_SSL3: ssl_method = (SSL_METHOD*)SSLv3_method(); #endif break; } #endif if (!ssl_method) { #if (USING_LIBRESSL && LIBRESSL_VERSION_NUMBER < 0x2020100fL)\ || OPENSSL_VERSION_NUMBER < 0x10100000L ssl_method = (SSL_METHOD*)SSLv23_method(); #else ssl_method = (SSL_METHOD*)TLS_method(); #endif #ifdef SSL_OP_NO_SSLv2 /** Check if SSLv2 is enabled */ ssl_opt |= ((ssock->param.proto & PJ_SSL_SOCK_PROTO_SSL2)==0)? SSL_OP_NO_SSLv2:0; #endif #ifdef SSL_OP_NO_SSLv3 /** Check if SSLv3 is enabled */ ssl_opt |= ((ssock->param.proto & PJ_SSL_SOCK_PROTO_SSL3)==0)? SSL_OP_NO_SSLv3:0; #endif #ifdef SSL_OP_NO_TLSv1 /** Check if TLSv1 is enabled */ ssl_opt |= ((ssock->param.proto & PJ_SSL_SOCK_PROTO_TLS1)==0)? SSL_OP_NO_TLSv1:0; #endif #ifdef SSL_OP_NO_TLSv1_1 /** Check if TLSv1_1 is enabled */ ssl_opt |= ((ssock->param.proto & PJ_SSL_SOCK_PROTO_TLS1_1)==0)? SSL_OP_NO_TLSv1_1:0; #endif #ifdef SSL_OP_NO_TLSv1_2 /** Check if TLSv1_2 is enabled */ ssl_opt |= ((ssock->param.proto & PJ_SSL_SOCK_PROTO_TLS1_2)==0)? SSL_OP_NO_TLSv1_2:0; #endif #ifdef SSL_OP_NO_TLSv1_3 /** Check if TLSv1_3 is enabled */ ssl_opt |= ((ssock->param.proto & PJ_SSL_SOCK_PROTO_TLS1_3)==0)? SSL_OP_NO_TLSv1_3:0; #endif } /* Create SSL context */ ctx = SSL_CTX_new(ssl_method); if (ctx == NULL) { return GET_SSL_STATUS(ssock); } ossock->ossl_ctx = ctx; if (ssl_opt) SSL_CTX_set_options(ctx, ssl_opt); /* Set cipher list */ status = set_cipher_list(ssock); if (status != PJ_SUCCESS) return status; /* Apply credentials */ if (cert) { /* Load CA list if one is specified. */ if (cert->CA_file.slen || cert->CA_path.slen) { rc = SSL_CTX_load_verify_locations( ctx, cert->CA_file.slen == 0 ? NULL : cert->CA_file.ptr, cert->CA_path.slen == 0 ? NULL : cert->CA_path.ptr); if (rc != 1) { status = GET_SSL_STATUS(ssock); if (cert->CA_file.slen) { PJ_PERROR(1,(ssock->pool->obj_name, status, "Error loading CA list file '%s'", cert->CA_file.ptr)); } if (cert->CA_path.slen) { PJ_PERROR(1,(ssock->pool->obj_name, status, "Error loading CA path '%s'", cert->CA_path.ptr)); } SSL_CTX_free(ctx); return status; } else { PJ_LOG(4,(ssock->pool->obj_name, "CA certificates loaded from '%s%s%s'", cert->CA_file.ptr, ((cert->CA_file.slen && cert->CA_path.slen)? " + ":""), cert->CA_path.ptr)); } } /* Set password callback */ if (cert->privkey_pass.slen) { SSL_CTX_set_default_passwd_cb(ctx, password_cb); SSL_CTX_set_default_passwd_cb_userdata(ctx, cert); } /* Load certificate if one is specified */ if (cert->cert_file.slen) { /* Load certificate chain from file into ctx */ rc = SSL_CTX_use_certificate_chain_file(ctx, cert->cert_file.ptr); if(rc != 1) { status = GET_SSL_STATUS(ssock); PJ_PERROR(1,(ssock->pool->obj_name, status, "Error loading certificate chain file '%s'", cert->cert_file.ptr)); SSL_CTX_free(ctx); return status; } else { PJ_LOG(4,(ssock->pool->obj_name, "Certificate chain loaded from '%s'", cert->cert_file.ptr)); } } /* Load private key if one is specified */ if (cert->privkey_file.slen) { /* Adds the first private key found in file to ctx */ rc = SSL_CTX_use_PrivateKey_file(ctx, cert->privkey_file.ptr, SSL_FILETYPE_PEM); if(rc != 1) { status = GET_SSL_STATUS(ssock); PJ_PERROR(1,(ssock->pool->obj_name, status, "Error adding private key from '%s'", cert->privkey_file.ptr)); SSL_CTX_free(ctx); return status; } else { PJ_LOG(4,(ssock->pool->obj_name, "Private key loaded from '%s'", cert->privkey_file.ptr)); } #if !defined(OPENSSL_NO_DH) if (ssock->is_server) { bio = BIO_new_file(cert->privkey_file.ptr, "r"); if (bio != NULL) { dh = PEM_read_bio_DHparams(bio, NULL, NULL, NULL); if (dh != NULL) { if (SSL_CTX_set_tmp_dh(ctx, dh)) { options = SSL_OP_CIPHER_SERVER_PREFERENCE | #if !defined(OPENSSL_NO_ECDH) && OPENSSL_VERSION_NUMBER >= 0x10000000L SSL_OP_SINGLE_ECDH_USE | #endif SSL_OP_SINGLE_DH_USE; options = SSL_CTX_set_options(ctx, options); PJ_LOG(4,(ssock->pool->obj_name, "SSL DH " "initialized, PFS cipher-suites enabled")); } DH_free(dh); } BIO_free(bio); } } #endif } /* Load from buffer. */ if (cert->cert_buf.slen) { BIO *cbio; X509 *xcert = NULL; cbio = BIO_new_mem_buf((void*)cert->cert_buf.ptr, cert->cert_buf.slen); if (cbio != NULL) { xcert = PEM_read_bio_X509(cbio, NULL, 0, NULL); if (xcert != NULL) { rc = SSL_CTX_use_certificate(ctx, xcert); if (rc != 1) { status = GET_SSL_STATUS(ssock); PJ_PERROR(1,(ssock->pool->obj_name, status, "Error loading chain certificate from buffer")); X509_free(xcert); BIO_free(cbio); SSL_CTX_free(ctx); return status; } else { PJ_LOG(4,(ssock->pool->obj_name, "Certificate chain loaded from buffer")); } X509_free(xcert); } BIO_free(cbio); } } if (cert->CA_buf.slen) { BIO *cbio = BIO_new_mem_buf((void*)cert->CA_buf.ptr, cert->CA_buf.slen); X509_STORE *cts = SSL_CTX_get_cert_store(ctx); if (cbio && cts) { STACK_OF(X509_INFO) *inf = PEM_X509_INFO_read_bio(cbio, NULL, NULL, NULL); if (inf != NULL) { int i = 0, cnt = 0; for (; i < sk_X509_INFO_num(inf); i++) { X509_INFO *itmp = sk_X509_INFO_value(inf, i); if (!itmp->x509) continue; rc = X509_STORE_add_cert(cts, itmp->x509); if (rc == 1) { ++cnt; } else { #if PJ_LOG_MAX_LEVEL >= 4 char buf[256]; PJ_LOG(4,(ssock->pool->obj_name, "Error adding CA cert: %s", X509_NAME_oneline( X509_get_subject_name(itmp->x509), buf, sizeof(buf)))); #endif } } PJ_LOG(4,(ssock->pool->obj_name, "CA certificates loaded from buffer (cnt=%d)", cnt)); } sk_X509_INFO_pop_free(inf, X509_INFO_free); BIO_free(cbio); } } if (cert->privkey_buf.slen) { BIO *kbio; EVP_PKEY *pkey = NULL; kbio = BIO_new_mem_buf((void*)cert->privkey_buf.ptr, cert->privkey_buf.slen); if (kbio != NULL) { pkey = PEM_read_bio_PrivateKey(kbio, NULL, &password_cb, cert); if (pkey) { rc = SSL_CTX_use_PrivateKey(ctx, pkey); if (rc != 1) { status = GET_SSL_STATUS(ssock); PJ_PERROR(1,(ssock->pool->obj_name, status, "Error adding private key from buffer")); EVP_PKEY_free(pkey); BIO_free(kbio); SSL_CTX_free(ctx); return status; } else { PJ_LOG(4,(ssock->pool->obj_name, "Private key loaded from buffer")); } EVP_PKEY_free(pkey); } else { PJ_LOG(1,(ssock->pool->obj_name, "Error reading private key from buffer")); } if (ssock->is_server) { dh = PEM_read_bio_DHparams(kbio, NULL, NULL, NULL); if (dh != NULL) { if (SSL_CTX_set_tmp_dh(ctx, dh)) { options = SSL_OP_CIPHER_SERVER_PREFERENCE | #if !defined(OPENSSL_NO_ECDH) && OPENSSL_VERSION_NUMBER >= 0x10000000L SSL_OP_SINGLE_ECDH_USE | #endif SSL_OP_SINGLE_DH_USE; options = SSL_CTX_set_options(ctx, options); PJ_LOG(4,(ssock->pool->obj_name, "SSL DH " "initialized, PFS cipher-suites enabled")); } DH_free(dh); } } BIO_free(kbio); } } } if (ssock->is_server) { char *p = NULL; /* If certificate file name contains "_rsa.", let's check if there are * ecc and dsa certificates too. */ if (cert && cert->cert_file.slen) { const pj_str_t RSA = {"_rsa.", 5}; p = pj_strstr(&cert->cert_file, &RSA); if (p) p++; /* Skip underscore */ } if (p) { /* Certificate type string length must be exactly 3 */ enum { CERT_TYPE_LEN = 3 }; const char* cert_types[] = { "ecc", "dsa" }; char *cf = cert->cert_file.ptr; int i; /* Check and load ECC & DSA certificates & private keys */ for (i = 0; i < PJ_ARRAY_SIZE(cert_types); ++i) { int err; pj_memcpy(p, cert_types[i], CERT_TYPE_LEN); if (!pj_file_exists(cf)) continue; err = SSL_CTX_use_certificate_chain_file(ctx, cf); if (err == 1) err = SSL_CTX_use_PrivateKey_file(ctx, cf, SSL_FILETYPE_PEM); if (err == 1) { PJ_LOG(4,(ssock->pool->obj_name, "Additional certificate '%s' loaded.", cf)); } else { PJ_PERROR(1,(ssock->pool->obj_name, GET_SSL_STATUS(ssock), "Error loading certificate file '%s'", cf)); ERR_clear_error(); } } /* Put back original name */ pj_memcpy(p, "rsa", CERT_TYPE_LEN); } #ifndef SSL_CTRL_SET_ECDH_AUTO #define SSL_CTRL_SET_ECDH_AUTO 94 #endif /* SSL_CTX_set_ecdh_auto(ctx,on) requires OpenSSL 1.0.2 which wraps: */ if (SSL_CTX_ctrl(ctx, SSL_CTRL_SET_ECDH_AUTO, 1, NULL)) { PJ_LOG(4,(ssock->pool->obj_name, "SSL ECDH initialized " "(automatic), faster PFS ciphers enabled")); #if !defined(OPENSSL_NO_ECDH) && OPENSSL_VERSION_NUMBER >= 0x10000000L && \ OPENSSL_VERSION_NUMBER < 0x10100000L } else { /* enables AES-128 ciphers, to get AES-256 use NID_secp384r1 */ EC_KEY *ecdh = EC_KEY_new_by_curve_name(NID_X9_62_prime256v1); if (ecdh != NULL) { if (SSL_CTX_set_tmp_ecdh(ctx, ecdh)) { PJ_LOG(4,(ssock->pool->obj_name, "SSL ECDH initialized " "(secp256r1), faster PFS cipher-suites enabled")); } EC_KEY_free(ecdh); } #endif } } else { X509_STORE *pkix_validation_store = SSL_CTX_get_cert_store(ctx); if (NULL != pkix_validation_store) { #if defined(X509_V_FLAG_TRUSTED_FIRST) X509_STORE_set_flags(pkix_validation_store, X509_V_FLAG_TRUSTED_FIRST); #endif #if defined(X509_V_FLAG_PARTIAL_CHAIN) X509_STORE_set_flags(pkix_validation_store, X509_V_FLAG_PARTIAL_CHAIN); #endif } } /* Add certificate authorities for clients from CA. * Needed for certificate request during handshake. */ if (cert && ssock->is_server) { STACK_OF(X509_NAME) *ca_dn = NULL; if (cert->CA_file.slen > 0) { ca_dn = SSL_load_client_CA_file(cert->CA_file.ptr); } else if (cert->CA_buf.slen > 0) { X509 *x = NULL; X509_NAME *xn = NULL; STACK_OF(X509_NAME) *sk = NULL; BIO *new_bio = BIO_new_mem_buf((void*)cert->CA_buf.ptr, cert->CA_buf.slen); sk = sk_X509_NAME_new(xname_cmp); if (sk != NULL && new_bio != NULL) { for (;;) { if (PEM_read_bio_X509(new_bio, &x, NULL, NULL) == NULL) break; if ((xn = X509_get_subject_name(x)) == NULL) break; if ((xn = X509_NAME_dup(xn)) == NULL ) break; if (sk_X509_NAME_find(sk, xn) >= 0) { X509_NAME_free(xn); } else { sk_X509_NAME_push(sk, xn); } X509_free(x); x = NULL; } } if (sk != NULL) ca_dn = sk; if (new_bio != NULL) BIO_free(new_bio); } if (ca_dn != NULL) { SSL_CTX_set_client_CA_list(ctx, ca_dn); PJ_LOG(4,(ssock->pool->obj_name, "CA certificates loaded from %s", (cert->CA_file.slen?cert->CA_file.ptr:"buffer"))); } else { PJ_LOG(1,(ssock->pool->obj_name, "Error reading CA certificates from %s", (cert->CA_file.slen?cert->CA_file.ptr:"buffer"))); } } /* Early sensitive data cleanup after OpenSSL context setup. However, * this cannot be done for listener sockets, as the data will still * be needed by accepted sockets. */ if (cert && (!ssock->is_server || ssock->parent)) { pj_ssl_cert_wipe_keys(cert); } /* Create SSL instance */ ossock->ossl_ssl = SSL_new(ossock->ossl_ctx); if (ossock->ossl_ssl == NULL) { return GET_SSL_STATUS(ssock); } /* Set SSL sock as application data of SSL instance */ SSL_set_ex_data(ossock->ossl_ssl, sslsock_idx, ssock); /* SSL verification options */ mode = SSL_VERIFY_PEER; if (ssock->is_server && ssock->param.require_client_cert) mode |= SSL_VERIFY_FAIL_IF_NO_PEER_CERT; SSL_set_verify(ossock->ossl_ssl, mode, &verify_cb); /* Set curve list */ status = set_curves_list(ssock); if (status != PJ_SUCCESS) return status; /* Set sigalg list */ status = set_sigalgs(ssock); if (status != PJ_SUCCESS) return status; /* Setup SSL BIOs */ ossock->ossl_rbio = BIO_new(BIO_s_mem()); ossock->ossl_wbio = BIO_new(BIO_s_mem()); (void)BIO_set_close(ossock->ossl_rbio, BIO_CLOSE); (void)BIO_set_close(ossock->ossl_wbio, BIO_CLOSE); SSL_set_bio(ossock->ossl_ssl, ossock->ossl_rbio, ossock->ossl_wbio); return PJ_SUCCESS; }
0
[ "CWE-362", "CWE-703" ]
pjproject
d5f95aa066f878b0aef6a64e60b61e8626e664cd
83,523,001,560,836,640,000,000,000,000,000,000,000
510
Merge pull request from GHSA-cv8x-p47p-99wr * - Avoid SSL socket parent/listener getting destroyed during handshake by increasing parent's reference count. - Add missing SSL socket close when the newly accepted SSL socket is discarded in SIP TLS transport. * - Fix silly mistake: accepted active socket created without group lock in SSL socket. - Replace assertion with normal validation check of SSL socket instance in OpenSSL verification callback (verify_cb()) to avoid crash, e.g: if somehow race condition with SSL socket destroy happens or OpenSSL application data index somehow gets corrupted.
static int validate_pae_over_nl80211(struct cfg80211_registered_device *rdev, struct genl_info *info) { if (!info->attrs[NL80211_ATTR_SOCKET_OWNER]) { GENL_SET_ERR_MSG(info, "SOCKET_OWNER not set"); return -EINVAL; } if (!rdev->ops->tx_control_port || !wiphy_ext_feature_isset(&rdev->wiphy, NL80211_EXT_FEATURE_CONTROL_PORT_OVER_NL80211)) return -EOPNOTSUPP; return 0; }
0
[ "CWE-120" ]
linux
f88eb7c0d002a67ef31aeb7850b42ff69abc46dc
115,339,068,164,622,730,000,000,000,000,000,000,000
15
nl80211: validate beacon head We currently don't validate the beacon head, i.e. the header, fixed part and elements that are to go in front of the TIM element. This means that the variable elements there can be malformed, e.g. have a length exceeding the buffer size, but most downstream code from this assumes that this has already been checked. Add the necessary checks to the netlink policy. Cc: [email protected] Fixes: ed1b6cc7f80f ("cfg80211/nl80211: add beacon settings") Link: https://lore.kernel.org/r/1569009255-I7ac7fbe9436e9d8733439eab8acbbd35e55c74ef@changeid Signed-off-by: Johannes Berg <[email protected]>
Interval IndexBoundsBuilder::makePointInterval(const BSONObj& obj) { Interval ret; ret._intervalData = obj; ret.startInclusive = ret.endInclusive = true; ret.start = ret.end = obj.firstElement(); return ret; }
0
[ "CWE-754" ]
mongo
f8f55e1825ee5c7bdb3208fc7c5b54321d172732
317,957,350,971,954,970,000,000,000,000,000,000,000
7
SERVER-44377 generate correct plan for indexed inequalities to null
static inline void vga_set_mem_top(struct vc_data *c) { write_vga(12, (c->vc_visible_origin - vga_vram_base) / 2); }
0
[ "CWE-125" ]
linux
973c096f6a85e5b5f2a295126ba6928d9a6afd45
234,695,802,227,779,530,000,000,000,000,000,000,000
4
vgacon: remove software scrollback support Yunhai Zhang recently fixed a VGA software scrollback bug in commit ebfdfeeae8c0 ("vgacon: Fix for missing check in scrollback handling"), but that then made people look more closely at some of this code, and there were more problems on the vgacon side, but also the fbcon software scrollback. We don't really have anybody who maintains this code - probably because nobody actually _uses_ it any more. Sure, people still use both VGA and the framebuffer consoles, but they are no longer the main user interfaces to the kernel, and haven't been for decades, so these kinds of extra features end up bitrotting and not really being used. So rather than try to maintain a likely unused set of code, I'll just aggressively remove it, and see if anybody even notices. Maybe there are people who haven't jumped on the whole GUI badnwagon yet, and think it's just a fad. And maybe those people use the scrollback code. If that turns out to be the case, we can resurrect this again, once we've found the sucker^Wmaintainer for it who actually uses it. Reported-by: NopNop Nop <[email protected]> Tested-by: Willy Tarreau <[email protected]> Cc: 张云海 <[email protected]> Acked-by: Andy Lutomirski <[email protected]> Acked-by: Willy Tarreau <[email protected]> Reviewed-by: Greg Kroah-Hartman <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
PostorderProcessor* child() {return child_; }
0
[]
node
fd80a31e0697d6317ce8c2d289575399f4e06d21
240,014,407,160,448,670,000,000,000,000,000,000,000
1
deps: backport 5f836c from v8 upstream Original commit message: Fix Hydrogen bounds check elimination When combining bounds checks, they must all be moved before the first load/store that they are guarding. BUG=chromium:344186 LOG=y [email protected] Review URL: https://codereview.chromium.org/172093002 git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@19475 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 fix #8070
static inline NPIdentifierInfo *npidentifier_cache_lookup(NPIdentifier ident) { if (G_UNLIKELY(g_npidentifier_cache == NULL)) return NULL; return g_hash_table_lookup(g_npidentifier_cache, ident); }
0
[ "CWE-264" ]
nspluginwrapper
7e4ab8e1189846041f955e6c83f72bc1624e7a98
286,563,359,036,598,280,000,000,000,000,000,000,000
6
Support all the new variables added
prepare_room(MBuf *mbuf, int block_len) { uint8 *newbuf; unsigned newlen; if (mbuf->data_end + block_len <= mbuf->buf_end) return; newlen = (mbuf->buf_end - mbuf->data) + ((block_len + STEP + STEP - 1) & -STEP); newbuf = px_realloc(mbuf->data, newlen); mbuf->buf_end = newbuf + newlen; mbuf->data_end = newbuf + (mbuf->data_end - mbuf->data); mbuf->read_pos = newbuf + (mbuf->read_pos - mbuf->data); mbuf->data = newbuf; return; }
0
[ "CWE-120" ]
postgres
1dc75515868454c645ded22d38054ec693e23ec6
71,739,845,602,153,400,000,000,000,000,000,000,000
20
Fix buffer overrun after incomplete read in pullf_read_max(). Most callers pass a stack buffer. The ensuing stack smash can crash the server, and we have not ruled out the viability of attacks that lead to privilege escalation. Back-patch to 9.0 (all supported versions). Marko Tiikkaja Security: CVE-2015-0243
handle_create_update_monitor (PortalFlatpak *object, GDBusMethodInvocation *invocation, GVariant *options) { GDBusConnection *connection = g_dbus_method_invocation_get_connection (invocation); g_autoptr(PortalFlatpakUpdateMonitorSkeleton) monitor = NULL; const char *sender; g_autofree char *sender_escaped = NULL; g_autofree char *obj_path = NULL; g_autofree char *token = NULL; g_autoptr(GError) error = NULL; int i; if (!g_variant_lookup (options, "handle_token", "s", &token)) token = g_strdup_printf ("%d", g_random_int_range (0, 1000)); sender = g_dbus_method_invocation_get_sender (invocation); g_debug ("handle CreateUpdateMonitor from %s", sender); sender_escaped = g_strdup (sender + 1); for (i = 0; sender_escaped[i]; i++) { if (sender_escaped[i] == '.') sender_escaped[i] = '_'; } obj_path = g_strdup_printf ("/org/freedesktop/portal/Flatpak/update_monitor/%s/%s", sender_escaped, token); monitor = (PortalFlatpakUpdateMonitorSkeleton *) create_update_monitor (invocation, obj_path, &error); if (monitor == NULL) { g_dbus_method_invocation_return_gerror (invocation, error); return G_DBUS_METHOD_INVOCATION_HANDLED; } g_signal_connect (monitor, "handle-close", G_CALLBACK (handle_close), NULL); g_signal_connect (monitor, "handle-update", G_CALLBACK (handle_update), NULL); g_signal_connect (monitor, "g-authorize-method", G_CALLBACK (authorize_method_handler), NULL); if (!g_dbus_interface_skeleton_export (G_DBUS_INTERFACE_SKELETON (monitor), connection, obj_path, &error)) { g_dbus_method_invocation_return_gerror (invocation, error); return G_DBUS_METHOD_INVOCATION_HANDLED; } register_update_monitor ((PortalFlatpakUpdateMonitor*)monitor, obj_path); portal_flatpak_complete_create_update_monitor (portal, invocation, obj_path); return G_DBUS_METHOD_INVOCATION_HANDLED; }
0
[ "CWE-94", "CWE-74" ]
flatpak
aeb6a7ab0abaac4a8f4ad98b3df476d9de6b8bd4
229,557,585,642,937,800,000,000,000,000,000,000,000
56
portal: Convert --env in extra-args into --env-fd This hides overridden variables from the command-line, which means processes running under other uids can't see them in /proc/*/cmdline, which might be important if they contain secrets. Signed-off-by: Simon McVittie <[email protected]> Part-of: https://github.com/flatpak/flatpak/security/advisories/GHSA-4ppf-fxf6-vxg2
rl_sigwinch_handler (sig) int sig; { SigHandler *oh; #if defined (MUST_REINSTALL_SIGHANDLERS) sighandler_cxt dummy_winch; /* We don't want to change old_winch -- it holds the state of SIGWINCH disposition set by the calling application. We need this state because we call the application's SIGWINCH handler after updating our own idea of the screen size. */ rl_set_sighandler (SIGWINCH, rl_sigwinch_handler, &dummy_winch); #endif RL_SETSTATE(RL_STATE_SIGHANDLER); _rl_caught_signal = sig; /* If another sigwinch handler has been installed, call it. */ oh = (SigHandler *)old_winch.sa_handler; if (oh && oh != (SigHandler *)SIG_IGN && oh != (SigHandler *)SIG_DFL) (*oh) (sig); RL_UNSETSTATE(RL_STATE_SIGHANDLER); SIGHANDLER_RETURN; }
0
[]
bash
955543877583837c85470f7fb8a97b7aa8d45e6c
110,466,728,412,600,560,000,000,000,000,000,000,000
26
bash-4.4-rc2 release