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 inline bool cpu_has_broken_vmx_preemption_timer(void)
{
u32 eax = cpuid_eax(0x00000001), i;
/* Clear the reserved bits */
eax &= ~(0x3U << 14 | 0xfU << 28);
for (i = 0; i < ARRAY_SIZE(vmx_preemption_cpu_tfms); i++)
if (eax == vmx_preemption_cpu_tfms[i])
return true;
return false;
}
| 0 |
[
"CWE-284"
] |
linux
|
727ba748e110b4de50d142edca9d6a9b7e6111d8
| 190,034,452,163,550,930,000,000,000,000,000,000,000 | 12 |
kvm: nVMX: Enforce cpl=0 for VMX instructions
VMX instructions executed inside a L1 VM will always trigger a VM exit
even when executed with cpl 3. This means we must perform the
privilege check in software.
Fixes: 70f3aac964ae("kvm: nVMX: Remove superfluous VMX instruction fault checks")
Cc: [email protected]
Signed-off-by: Felix Wilhelm <[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
|
explicit TProtocol(TTransport* ptrans)
: ptrans_(ptrans, [](TTransport*) {}) {}
| 0 |
[
"CWE-20",
"CWE-755"
] |
fbthrift
|
01686e15ec77ccb4d49a77d5bce3a01601e54d64
| 2,912,369,933,505,355,500,000,000,000,000,000,000 | 2 |
Throw on skipping an invalid type.
Summary:
Certain values (e.g.) T_STOP should not appear as a skip type. Allowing them to
can cause thrift to loop unboundedly.
Reviewed By: spalamarchuk
Differential Revision: D15102451
fbshipit-source-id: c08d52f44f37e9c212d3480233ac217105586c9f
|
CModule::EModRet CModule::OnUserPart(CString& sChannel, CString& sMessage) {
return CONTINUE;
}
| 0 |
[
"CWE-20",
"CWE-264"
] |
znc
|
8de9e376ce531fe7f3c8b0aa4876d15b479b7311
| 244,647,921,483,421,470,000,000,000,000,000,000,000 | 3 |
Fix remote code execution and privilege escalation vulnerability.
To trigger this, need to have a user already.
Thanks for Jeriko One <[email protected]> for finding and reporting this.
CVE-2019-12816
|
static int drbg_fini_sym_kernel(struct drbg_state *drbg)
{
struct crypto_cipher *tfm =
(struct crypto_cipher *)drbg->priv_data;
if (tfm)
crypto_free_cipher(tfm);
drbg->priv_data = NULL;
return 0;
}
| 0 |
[
"CWE-476"
] |
linux
|
8fded5925d0a733c46f8d0b5edd1c9b315882b1d
| 153,779,725,154,466,300,000,000,000,000,000,000,000 | 9 |
crypto: drbg - Convert to new rng interface
This patch converts the DRBG implementation to the new low-level
rng interface.
This allows us to get rid of struct drbg_gen by using the new RNG
API instead.
Signed-off-by: Herbert Xu <[email protected]>
Acked-by: Stephan Mueller <[email protected]>
|
static void ohci_pmac_off(struct pci_dev *dev)
{
if (machine_is(powermac)) {
struct device_node *ofn = pci_device_to_OF_node(dev);
if (ofn) {
pmac_call_feature(PMAC_FTR_1394_ENABLE, ofn, 0, 0);
pmac_call_feature(PMAC_FTR_1394_CABLE_POWER, ofn, 0, 0);
}
}
}
| 0 |
[
"CWE-399"
] |
linux-2.6
|
8c0c0cc2d9f4c523fde04bdfe41e4380dec8ee54
| 104,704,027,968,094,730,000,000,000,000,000,000,000 | 11 |
firewire: ohci: handle receive packets with a data length of zero
Queueing to receive an ISO packet with a payload length of zero
silently does nothing in dualbuffer mode, and crashes the kernel in
packet-per-buffer mode. Return an error in dualbuffer mode, because
the DMA controller won't let us do what we want, and work correctly in
packet-per-buffer mode.
Signed-off-by: Jay Fenlason <[email protected]>
Signed-off-by: Stefan Richter <[email protected]>
Cc: [email protected]
|
term_get_winpos(int *x, int *y, varnumber_T timeout)
{
int count = 0;
int prev_winpos_x = winpos_x;
int prev_winpos_y = winpos_y;
if (*T_CGP == NUL || !can_get_termresponse())
return FAIL;
winpos_x = -1;
winpos_y = -1;
++did_request_winpos;
termrequest_sent(&winpos_status);
OUT_STR(T_CGP);
out_flush();
// Try reading the result for "timeout" msec.
while (count++ <= timeout / 10 && !got_int)
{
(void)vpeekc_nomap();
if (winpos_x >= 0 && winpos_y >= 0)
{
*x = winpos_x;
*y = winpos_y;
return OK;
}
ui_delay(10L, FALSE);
}
// Do not reset "did_request_winpos", if we timed out the response might
// still come later and we must consume it.
winpos_x = prev_winpos_x;
winpos_y = prev_winpos_y;
if (timeout < 10 && prev_winpos_y >= 0 && prev_winpos_x >= 0)
{
// Polling: return previous values if we have them.
*x = winpos_x;
*y = winpos_y;
return OK;
}
return FALSE;
}
| 0 |
[
"CWE-125",
"CWE-787"
] |
vim
|
e178af5a586ea023622d460779fdcabbbfac0908
| 93,688,303,670,314,640,000,000,000,000,000,000,000 | 42 |
patch 8.2.5160: accessing invalid memory after changing terminal size
Problem: Accessing invalid memory after changing terminal size.
Solution: Adjust cmdline_row and msg_row to the value of Rows.
|
set_action_important (GtkUIManager *ui,
const char *action_name)
{
GtkAction *action;
action = gtk_ui_manager_get_action (ui, action_name);
g_object_set (action, "is_important", TRUE, NULL);
g_object_unref (action);
}
| 0 |
[
"CWE-22"
] |
file-roller
|
b147281293a8307808475e102a14857055f81631
| 300,082,451,394,327,040,000,000,000,000,000,000,000 | 9 |
libarchive: sanitize filenames before extracting
|
lexer_convert_push_number_to_push_literal (parser_context_t *context_p) /**< context */
{
ecma_integer_value_t value;
bool two_literals = context_p->last_cbc_opcode >= CBC_PUSH_LITERAL_PUSH_NUMBER_0;
if (context_p->last_cbc_opcode == CBC_PUSH_NUMBER_0 || context_p->last_cbc_opcode == CBC_PUSH_LITERAL_PUSH_NUMBER_0)
{
value = 0;
}
else if (context_p->last_cbc_opcode == CBC_PUSH_NUMBER_POS_BYTE
|| context_p->last_cbc_opcode == CBC_PUSH_LITERAL_PUSH_NUMBER_POS_BYTE)
{
value = ((ecma_integer_value_t) context_p->last_cbc.value) + 1;
}
else
{
JERRY_ASSERT (context_p->last_cbc_opcode == CBC_PUSH_NUMBER_NEG_BYTE
|| context_p->last_cbc_opcode == CBC_PUSH_LITERAL_PUSH_NUMBER_NEG_BYTE);
value = -((ecma_integer_value_t) context_p->last_cbc.value) - 1;
}
ecma_value_t lit_value = ecma_make_integer_value (value);
parser_list_iterator_t literal_iterator;
parser_list_iterator_init (&context_p->literal_pool, &literal_iterator);
context_p->last_cbc_opcode = two_literals ? CBC_PUSH_TWO_LITERALS : CBC_PUSH_LITERAL;
uint32_t literal_index = 0;
lexer_literal_t *literal_p;
while ((literal_p = (lexer_literal_t *) parser_list_iterator_next (&literal_iterator)) != NULL)
{
if (literal_p->type == LEXER_NUMBER_LITERAL && literal_p->u.value == lit_value)
{
if (two_literals)
{
context_p->last_cbc.value = (uint16_t) literal_index;
}
else
{
context_p->last_cbc.literal_index = (uint16_t) literal_index;
}
return;
}
literal_index++;
}
JERRY_ASSERT (literal_index == context_p->literal_count);
if (literal_index >= PARSER_MAXIMUM_NUMBER_OF_LITERALS)
{
parser_raise_error (context_p, PARSER_ERR_LITERAL_LIMIT_REACHED);
}
literal_p = (lexer_literal_t *) parser_list_append (context_p, &context_p->literal_pool);
literal_p->u.value = lit_value;
literal_p->prop.length = 0; /* Unused. */
literal_p->type = LEXER_NUMBER_LITERAL;
literal_p->status_flags = 0;
context_p->literal_count++;
if (two_literals)
{
context_p->last_cbc.value = (uint16_t) literal_index;
}
else
{
context_p->last_cbc.literal_index = (uint16_t) literal_index;
}
} /* lexer_convert_push_number_to_push_literal */
| 0 |
[
"CWE-288"
] |
jerryscript
|
f3a420b672927037beb4508d7bdd68fb25d2caf6
| 189,416,465,098,236,400,000,000,000,000,000,000,000 | 73 |
Fix class static block opening brace parsing (#4942)
The next character should not be consumed after finding the static block opening brace.
This patch fixes #4916.
JerryScript-DCO-1.0-Signed-off-by: Martin Negyokru [email protected]
|
static void kiocb_done(struct io_kiocb *req, ssize_t ret,
unsigned int issue_flags)
{
struct io_async_rw *io = req->async_data;
/* add previously done IO, if any */
if (req_has_async_data(req) && io->bytes_done > 0) {
if (ret < 0)
ret = io->bytes_done;
else
ret += io->bytes_done;
}
if (req->flags & REQ_F_CUR_POS)
req->file->f_pos = req->rw.kiocb.ki_pos;
if (ret >= 0 && (req->rw.kiocb.ki_complete == io_complete_rw))
__io_complete_rw(req, ret, issue_flags);
else
io_rw_done(&req->rw.kiocb, ret);
if (req->flags & REQ_F_REISSUE) {
req->flags &= ~REQ_F_REISSUE;
if (io_resubmit_prep(req))
io_req_task_queue_reissue(req);
else
io_req_task_queue_fail(req, ret);
}
}
| 0 |
[
"CWE-416"
] |
linux
|
e677edbcabee849bfdd43f1602bccbecf736a646
| 271,705,554,605,056,600,000,000,000,000,000,000,000 | 28 |
io_uring: fix race between timeout flush and removal
io_flush_timeouts() assumes the timeout isn't in progress of triggering
or being removed/canceled, so it unconditionally removes it from the
timeout list and attempts to cancel it.
Leave it on the list and let the normal timeout cancelation take care
of it.
Cc: [email protected] # 5.5+
Signed-off-by: Jens Axboe <[email protected]>
|
flatpak_deploy_data_get_string (GVariant *deploy_data, const char *key)
{
g_autoptr(GVariant) metadata = g_variant_get_child_value (deploy_data, 4);
const char *value = NULL;
g_variant_lookup (metadata, key, "&s", &value);
return value;
}
| 0 |
[
"CWE-668"
] |
flatpak
|
cd2142888fc4c199723a0dfca1f15ea8788a5483
| 300,025,231,630,742,900,000,000,000,000,000,000,000 | 9 |
Don't expose /proc when running apply_extra
As shown by CVE-2019-5736, it is sometimes possible for the sandbox
app to access outside files using /proc/self/exe. This is not
typically an issue for flatpak as the sandbox runs as the user which
has no permissions to e.g. modify the host files.
However, when installing apps using extra-data into the system repo
we *do* actually run a sandbox as root. So, in this case we disable mounting
/proc in the sandbox, which will neuter attacks like this.
|
static void _6502_anal_update_flags(RAnalOp *op, int flags) {
/* FIXME: $b9 instead of $b8 to prevent the bug triggered by: A = 0 - 0xff - 1 */
if (flags & _6502_FLAGS_B) r_strbuf_append (&op->esil, ",$b9,C,=");
if (flags & _6502_FLAGS_C) r_strbuf_append (&op->esil, ",$c7,C,=");
if (flags & _6502_FLAGS_Z) r_strbuf_append (&op->esil, ",$z,Z,=");
if (flags & _6502_FLAGS_N) r_strbuf_append (&op->esil, ",$s,N,=");
}
| 0 |
[
"CWE-190",
"CWE-125"
] |
radare2
|
bbb4af56003c1afdad67af0c4339267ca38b1017
| 41,757,974,845,205,630,000,000,000,000,000,000,000 | 7 |
Fix #10294 - crash in r2_hoobr__6502_op
|
TEST_F(AsStringGraphTest, FillWithSpace) {
TF_ASSERT_OK(Init(DT_INT64, /*fill=*/" ", /*width=*/4));
AddInputFromArray<int64>(TensorShape({3}), {-42, 0, 42});
TF_ASSERT_OK(RunOpKernel());
Tensor expected(allocator(), DT_STRING, TensorShape({3}));
test::FillValues<tstring>(&expected, {" -42", " 0", " 42"});
test::ExpectTensorEqual<tstring>(expected, *GetOutput(0));
}
| 0 |
[
"CWE-20",
"CWE-134",
"CWE-703"
] |
tensorflow
|
33be22c65d86256e6826666662e40dbdfe70ee83
| 301,774,215,974,638,440,000,000,000,000,000,000,000 | 9 |
Prevent format string vulnerability in `tf.strings.as_string`.
The `printf` format specifier only allows `#`, `0`, `-`, `+` and space as flag characters. Others are interpreted as width/precision/length modifier or conversion specifiers. If a character does not fit into any of these sets `printf` just displays it.
Also add a test suite for `tf.strings.as_string`. Also fix the issue where the flag character was used only if width was specified.
PiperOrigin-RevId: 332553548
Change-Id: Ie57cf2a7c14d1a36097642794c14329db669bbba
|
bool PM_io_parser<PMDEC>::read_face(Face_handle f)
{ // syntax: index { halfedge, fclist, ivlist, mark }
int n, ei, vi; Mark m;
if ( !(in >> n) || !check_sep("{") ) return false;
if ( !(in >> ei) || !check_sep(",") ) return false;
if (ei >= 0) f->set_halfedge(Halfedge_of[ei]);
while (in >> ei) {
CGAL_assertion_msg(ei >= 0 && (std::size_t) ei < en, "wrong index in face cycle list.");
f->store_fc(Halfedge_of[ei]);
} in.clear();
if (!check_sep(",")) { return false; }
while (in >> vi) {
CGAL_assertion_msg(vi >= 0 && (std::size_t) vi < vn, "wrong index in iso vertex list.");
f->store_iv(Vertex_of[vi]);
} in.clear();
if (!check_sep(",") || !(in >> m) || !check_sep("}") )
return false;
mark(f) = m;
return true;
}
| 1 |
[
"CWE-269"
] |
cgal
|
618b409b0fbcef7cb536a4134ae3a424ef5aae45
| 192,304,973,916,903,900,000,000,000,000,000,000,000 | 20 |
Fix Nef_2 and Nef_S2 IO
|
void InstanceKlass::set_package(ClassLoaderData* loader_data, PackageEntry* pkg_entry, TRAPS) {
// ensure java/ packages only loaded by boot or platform builtin loaders
// not needed for shared class since CDS does not archive prohibited classes.
if (!is_shared()) {
check_prohibited_package(name(), loader_data, CHECK);
}
if (is_shared() && _package_entry != NULL) {
if (MetaspaceShared::use_full_module_graph() && _package_entry == pkg_entry) {
// we can use the saved package
assert(MetaspaceShared::is_in_shared_metaspace(_package_entry), "must be");
return;
} else {
_package_entry = NULL;
}
}
// ClassLoader::package_from_class_name has already incremented the refcount of the symbol
// it returns, so we need to decrement it when the current function exits.
TempNewSymbol from_class_name =
(pkg_entry != NULL) ? NULL : ClassLoader::package_from_class_name(name());
Symbol* pkg_name;
if (pkg_entry != NULL) {
pkg_name = pkg_entry->name();
} else {
pkg_name = from_class_name;
}
if (pkg_name != NULL && loader_data != NULL) {
// Find in class loader's package entry table.
_package_entry = pkg_entry != NULL ? pkg_entry : loader_data->packages()->lookup_only(pkg_name);
// If the package name is not found in the loader's package
// entry table, it is an indication that the package has not
// been defined. Consider it defined within the unnamed module.
if (_package_entry == NULL) {
if (!ModuleEntryTable::javabase_defined()) {
// Before java.base is defined during bootstrapping, define all packages in
// the java.base module. If a non-java.base package is erroneously placed
// in the java.base module it will be caught later when java.base
// is defined by ModuleEntryTable::verify_javabase_packages check.
assert(ModuleEntryTable::javabase_moduleEntry() != NULL, JAVA_BASE_NAME " module is NULL");
_package_entry = loader_data->packages()->lookup(pkg_name, ModuleEntryTable::javabase_moduleEntry());
} else {
assert(loader_data->unnamed_module() != NULL, "unnamed module is NULL");
_package_entry = loader_data->packages()->lookup(pkg_name,
loader_data->unnamed_module());
}
// A package should have been successfully created
DEBUG_ONLY(ResourceMark rm(THREAD));
assert(_package_entry != NULL, "Package entry for class %s not found, loader %s",
name()->as_C_string(), loader_data->loader_name_and_id());
}
if (log_is_enabled(Debug, module)) {
ResourceMark rm(THREAD);
ModuleEntry* m = _package_entry->module();
log_trace(module)("Setting package: class: %s, package: %s, loader: %s, module: %s",
external_name(),
pkg_name->as_C_string(),
loader_data->loader_name_and_id(),
(m->is_named() ? m->name()->as_C_string() : UNNAMED_MODULE));
}
} else {
ResourceMark rm(THREAD);
log_trace(module)("Setting package: class: %s, package: unnamed, loader: %s, module: %s",
external_name(),
(loader_data != NULL) ? loader_data->loader_name_and_id() : "NULL",
UNNAMED_MODULE);
}
}
| 0 |
[] |
jdk17u
|
f8eb9abe034f7c6bea4da05a9ea42017b3f80730
| 270,194,484,612,566,740,000,000,000,000,000,000,000 | 76 |
8270386: Better verification of scan methods
Reviewed-by: coleenp
Backport-of: ac329cef45979bd0159ecd1347e36f7129bb2ce4
|
xmlCopyPropInternal(xmlDocPtr doc, xmlNodePtr target, xmlAttrPtr cur) {
xmlAttrPtr ret;
if (cur == NULL) return(NULL);
if ((target != NULL) && (target->type != XML_ELEMENT_NODE))
return(NULL);
if (target != NULL)
ret = xmlNewDocProp(target->doc, cur->name, NULL);
else if (doc != NULL)
ret = xmlNewDocProp(doc, cur->name, NULL);
else if (cur->parent != NULL)
ret = xmlNewDocProp(cur->parent->doc, cur->name, NULL);
else if (cur->children != NULL)
ret = xmlNewDocProp(cur->children->doc, cur->name, NULL);
else
ret = xmlNewDocProp(NULL, cur->name, NULL);
if (ret == NULL) return(NULL);
ret->parent = target;
if ((cur->ns != NULL) && (target != NULL)) {
xmlNsPtr ns;
ns = xmlSearchNs(target->doc, target, cur->ns->prefix);
if (ns == NULL) {
/*
* Humm, we are copying an element whose namespace is defined
* out of the new tree scope. Search it in the original tree
* and add it at the top of the new tree
*/
ns = xmlSearchNs(cur->doc, cur->parent, cur->ns->prefix);
if (ns != NULL) {
xmlNodePtr root = target;
xmlNodePtr pred = NULL;
while (root->parent != NULL) {
pred = root;
root = root->parent;
}
if (root == (xmlNodePtr) target->doc) {
/* correct possibly cycling above the document elt */
root = pred;
}
ret->ns = xmlNewNs(root, ns->href, ns->prefix);
}
} else {
/*
* we have to find something appropriate here since
* we cant be sure, that the namespce we found is identified
* by the prefix
*/
if (xmlStrEqual(ns->href, cur->ns->href)) {
/* this is the nice case */
ret->ns = ns;
} else {
/*
* we are in trouble: we need a new reconcilied namespace.
* This is expensive
*/
ret->ns = xmlNewReconciliedNs(target->doc, target, cur->ns);
}
}
} else
ret->ns = NULL;
if (cur->children != NULL) {
xmlNodePtr tmp;
ret->children = xmlStaticCopyNodeList(cur->children, ret->doc, (xmlNodePtr) ret);
ret->last = NULL;
tmp = ret->children;
while (tmp != NULL) {
/* tmp->parent = (xmlNodePtr)ret; */
if (tmp->next == NULL)
ret->last = tmp;
tmp = tmp->next;
}
}
/*
* Try to handle IDs
*/
if ((target!= NULL) && (cur!= NULL) &&
(target->doc != NULL) && (cur->doc != NULL) &&
(cur->doc->ids != NULL) && (cur->parent != NULL)) {
if (xmlIsID(cur->doc, cur->parent, cur)) {
xmlChar *id;
id = xmlNodeListGetString(cur->doc, cur->children, 1);
if (id != NULL) {
xmlAddID(NULL, target->doc, id, ret);
xmlFree(id);
}
}
}
return(ret);
}
| 0 |
[
"CWE-20"
] |
libxml2
|
bdd66182ef53fe1f7209ab6535fda56366bd7ac9
| 7,200,537,421,229,152,000,000,000,000,000,000,000 | 96 |
Avoid building recursive entities
For https://bugzilla.gnome.org/show_bug.cgi?id=762100
When we detect a recusive entity we should really not
build the associated data, moreover if someone bypass
libxml2 fatal errors and still tries to serialize a broken
entity make sure we don't risk to get ito a recursion
* parser.c: xmlParserEntityCheck() don't build if entity loop
were found and remove the associated text content
* tree.c: xmlStringGetNodeList() avoid a potential recursion
|
static void login_failed(pool *p, const char *user) {
#ifdef HAVE_LOGINFAILED
const char *host, *sess_ttyname;
int res, xerrno;
host = pr_netaddr_get_dnsstr(session.c->remote_addr);
sess_ttyname = pr_session_get_ttyname(p);
PRIVS_ROOT
res = loginfailed((char *) user, (char *) host, (char *) sess_ttyname,
AUDIT_FAIL);
xerrno = errno;
PRIVS_RELINQUISH
if (res < 0) {
pr_trace_msg("auth", 3, "AIX loginfailed() error for user '%s', "
"host '%s', tty '%s', reason %d: %s", user, host, sess_ttyname,
AUDIT_FAIL, strerror(errno));
}
#endif /* HAVE_LOGINFAILED */
}
| 0 |
[
"CWE-59",
"CWE-295"
] |
proftpd
|
349addc3be4fcdad9bd4ec01ad1ccd916c898ed8
| 267,989,670,144,159,160,000,000,000,000,000,000,000 | 21 |
Walk the entire DefaultRoot path, checking for symlinks of any component,
when AllowChrootSymlinks is disabled.
|
static int winbind_chauthtok_request(struct pwb_context *ctx,
const char *user,
const char *oldpass,
const char *newpass,
time_t pwd_last_set)
{
wbcErr wbc_status;
struct wbcChangePasswordParams params;
struct wbcAuthErrorInfo *error = NULL;
struct wbcUserPasswordPolicyInfo *policy = NULL;
enum wbcPasswordChangeRejectReason reject_reason = -1;
uint32_t flags = 0;
int i;
const char *codes[] = {
"NT_STATUS_BACKUP_CONTROLLER",
"NT_STATUS_DOMAIN_CONTROLLER_NOT_FOUND",
"NT_STATUS_NO_LOGON_SERVERS",
"NT_STATUS_ACCESS_DENIED",
"NT_STATUS_PWD_TOO_SHORT", /* TODO: tell the min pwd length ? */
"NT_STATUS_PWD_TOO_RECENT", /* TODO: tell the minage ? */
"NT_STATUS_PWD_HISTORY_CONFLICT" /* TODO: tell the history length ? */
};
int ret = PAM_AUTH_ERR;
ZERO_STRUCT(params);
if (ctx->ctrl & WINBIND_KRB5_AUTH) {
flags |= WBFLAG_PAM_KRB5 |
WBFLAG_PAM_CONTACT_TRUSTDOM;
}
if (ctx->ctrl & WINBIND_CACHED_LOGIN) {
flags |= WBFLAG_PAM_CACHED_LOGIN;
}
params.account_name = user;
params.level = WBC_CHANGE_PASSWORD_LEVEL_PLAIN;
params.old_password.plaintext = oldpass;
params.new_password.plaintext = newpass;
params.flags = flags;
wbc_status = wbcChangeUserPasswordEx(¶ms, &error, &reject_reason, &policy);
ret = wbc_auth_error_to_pam_error(ctx, error, wbc_status,
user, "wbcChangeUserPasswordEx");
if (WBC_ERROR_IS_OK(wbc_status)) {
_pam_log(ctx, LOG_NOTICE,
"user '%s' password changed", user);
return PAM_SUCCESS;
}
if (!error) {
wbcFreeMemory(policy);
return ret;
}
for (i=0; i<ARRAY_SIZE(codes); i++) {
int _ret = ret;
if (_pam_check_remark_auth_err(ctx, error, codes[i], &_ret)) {
ret = _ret;
goto done;
}
}
if (!strcasecmp(error->nt_string,
"NT_STATUS_PASSWORD_RESTRICTION")) {
char *pwd_restriction_string = NULL;
SMB_TIME_T min_pwd_age = 0;
if (policy) {
min_pwd_age = policy->min_passwordage;
}
/* FIXME: avoid to send multiple PAM messages after another */
switch (reject_reason) {
case -1:
break;
case WBC_PWD_CHANGE_NO_ERROR:
if ((min_pwd_age > 0) &&
(pwd_last_set + min_pwd_age > time(NULL))) {
PAM_WB_REMARK_DIRECT(ctx,
"NT_STATUS_PWD_TOO_RECENT");
}
break;
case WBC_PWD_CHANGE_PASSWORD_TOO_SHORT:
PAM_WB_REMARK_DIRECT(ctx,
"NT_STATUS_PWD_TOO_SHORT");
break;
case WBC_PWD_CHANGE_PWD_IN_HISTORY:
PAM_WB_REMARK_DIRECT(ctx,
"NT_STATUS_PWD_HISTORY_CONFLICT");
break;
case WBC_PWD_CHANGE_NOT_COMPLEX:
_make_remark(ctx, PAM_ERROR_MSG,
_("Password does not meet "
"complexity requirements"));
break;
default:
_pam_log_debug(ctx, LOG_DEBUG,
"unknown password change "
"reject reason: %d",
reject_reason);
break;
}
pwd_restriction_string =
_pam_compose_pwd_restriction_string(ctx, policy);
if (pwd_restriction_string) {
_make_remark(ctx, PAM_ERROR_MSG,
pwd_restriction_string);
TALLOC_FREE(pwd_restriction_string);
}
}
done:
wbcFreeMemory(error);
wbcFreeMemory(policy);
return ret;
}
| 0 |
[
"CWE-20"
] |
samba
|
f62683956a3b182f6a61cc7a2b4ada2e74cde243
| 316,557,875,878,466,270,000,000,000,000,000,000,000 | 121 |
fail authentication for single group name which cannot be converted to sid
furthermore if more than one name is supplied and no sid is converted
then also fail.
Bug: https://bugzilla.samba.org/show_bug.cgi?id=8598
Signed-off-by: Noel Power <[email protected]>
Reviewed-by: Andreas Schneider <[email protected]>
Reviewed-by: David Disseldorp <[email protected]>
Autobuild-User(master): David Disseldorp <[email protected]>
Autobuild-Date(master): Fri Nov 29 15:45:11 CET 2013 on sn-devel-104
|
static void addrconf_gre_config(struct net_device *dev)
{
struct inet6_dev *idev;
ASSERT_RTNL();
idev = ipv6_find_idev(dev);
if (idev == NULL) {
pr_debug("%s: add_dev failed\n", __func__);
return;
}
addrconf_addr_gen(idev, true);
}
| 0 |
[
"CWE-20"
] |
linux
|
77751427a1ff25b27d47a4c36b12c3c8667855ac
| 94,173,716,735,443,160,000,000,000,000,000,000,000 | 14 |
ipv6: addrconf: validate new MTU before applying it
Currently we don't check if the new MTU is valid or not and this allows
one to configure a smaller than minimum allowed by RFCs or even bigger
than interface own MTU, which is a problem as it may lead to packet
drops.
If you have a daemon like NetworkManager running, this may be exploited
by remote attackers by forging RA packets with an invalid MTU, possibly
leading to a DoS. (NetworkManager currently only validates for values
too small, but not for too big ones.)
The fix is just to make sure the new value is valid. That is, between
IPV6_MIN_MTU and interface's MTU.
Note that similar check is already performed at
ndisc_router_discovery(), for when kernel itself parses the RA.
Signed-off-by: Marcelo Ricardo Leitner <[email protected]>
Signed-off-by: Sabrina Dubroca <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
|
box_blur_line (gint box_width, gint even_offset,
guchar *src, guchar *dest,
gint len, gint bpp)
{
gint i;
gint lead; /* This marks the leading edge of the kernel */
gint output; /* This marks the center of the kernel */
gint trail; /* This marks the pixel BEHIND the last 1 in the
kernel; it's the pixel to remove from the accumulator. */
gint *ac; /* Accumulator for each channel */
ac = g_new (gint, bpp);
/* The algorithm differs for even and odd-sized kernels.
* With the output at the center,
* If odd, the kernel might look like this: 0011100
* If even, the kernel will either be centered on the boundary between
* the output and its left neighbor, or on the boundary between the
* output and its right neighbor, depending on even_lr.
* So it might be 0111100 or 0011110, where output is on the center
* of these arrays.
*/
lead = 0;
if (box_width % 2 != 0) {
/* Odd-width kernel */
output = lead - (box_width - 1) / 2;
trail = lead - box_width;
} else {
/* Even-width kernel. */
if (even_offset == 1) {
/* Right offset */
output = lead + 1 - box_width / 2;
trail = lead - box_width;
} else if (even_offset == -1) {
/* Left offset */
output = lead - box_width / 2;
trail = lead - box_width;
} else {
/* If even_offset isn't 1 or -1, there's some error. */
g_assert_not_reached ();
}
}
/* Initialize accumulator */
for (i = 0; i < bpp; i++)
ac[i] = 0;
/* As the kernel moves across the image, it has a leading edge and a
* trailing edge, and the output is in the middle. */
while (output < len) {
/* The number of pixels that are both in the image and
* currently covered by the kernel. This is necessary to
* handle edge cases. */
guint coverage = (lead < len ? lead : len - 1) - (trail >= 0 ? trail : -1);
#ifdef READABLE_BOXBLUR_CODE
/* The code here does the same as the code below, but the code below
* has been optimized by moving the if statements out of the tight for
* loop, and is harder to understand.
* Don't use both this code and the code below. */
for (i = 0; i < bpp; i++) {
/* If the leading edge of the kernel is still on the image,
* add the value there to the accumulator. */
if (lead < len)
ac[i] += src[bpp * lead + i];
/* If the trailing edge of the kernel is on the image,
* subtract the value there from the accumulator. */
if (trail >= 0)
ac[i] -= src[bpp * trail + i];
/* Take the averaged value in the accumulator and store
* that value in the output. The number of pixels currently
* stored in the accumulator can be less than the nominal
* width of the kernel because the kernel can go "over the edge"
* of the image. */
if (output >= 0)
dest[bpp * output + i] = (ac[i] + (coverage >> 1)) / coverage;
}
#endif
/* If the leading edge of the kernel is still on the image... */
if (lead < len) {
if (trail >= 0) {
/* If the trailing edge of the kernel is on the image. (Since
* the output is in between the lead and trail, it must be on
* the image. */
for (i = 0; i < bpp; i++) {
ac[i] += src[bpp * lead + i];
ac[i] -= src[bpp * trail + i];
dest[bpp * output + i] = (ac[i] + (coverage >> 1)) / coverage;
}
} else if (output >= 0) {
/* If the output is on the image, but the trailing edge isn't yet
* on the image. */
for (i = 0; i < bpp; i++) {
ac[i] += src[bpp * lead + i];
dest[bpp * output + i] = (ac[i] + (coverage >> 1)) / coverage;
}
} else {
/* If leading edge is on the image, but the output and trailing
* edge aren't yet on the image. */
for (i = 0; i < bpp; i++)
ac[i] += src[bpp * lead + i];
}
} else if (trail >= 0) {
/* If the leading edge has gone off the image, but the output and
* trailing edge are on the image. (The big loop exits when the
* output goes off the image. */
for (i = 0; i < bpp; i++) {
ac[i] -= src[bpp * trail + i];
dest[bpp * output + i] = (ac[i] + (coverage >> 1)) / coverage;
}
} else if (output >= 0) {
/* Leading has gone off the image and trailing isn't yet in it
* (small image) */
for (i = 0; i < bpp; i++)
dest[bpp * output + i] = (ac[i] + (coverage >> 1)) / coverage;
}
lead++;
output++;
trail++;
}
g_free (ac);
}
| 0 |
[] |
librsvg
|
a51919f7e1ca9c535390a746fbf6e28c8402dc61
| 88,484,071,694,117,850,000,000,000,000,000,000,000 | 129 |
rsvg: Add rsvg_acquire_node()
This function does proper recursion checks when looking up resources
from URLs and thereby helps avoiding infinite loops when cyclic
references span multiple types of elements.
|
\param y1 Ending Y-coordinates of image regions to read (~0U for max).
\param z1 Ending Z-coordinates of image regions to read (~0U for max).
\param c1 Ending C-coordinates of image regions to read (~0U for max).
**/
CImgList<T>& load_cimg(const char *const filename,
const unsigned int n0, const unsigned int n1,
const unsigned int x0, const unsigned int y0,
const unsigned int z0, const unsigned int c0,
| 0 |
[
"CWE-125"
] |
CImg
|
10af1e8c1ad2a58a0a3342a856bae63e8f257abb
| 84,939,751,007,623,350,000,000,000,000,000,000,000 | 8 |
Fix other issues in 'CImg<T>::load_bmp()'.
|
send_dbus_boolean_signal (GSListener *listener,
const char *name,
gboolean value)
{
DBusMessage *message;
DBusMessageIter iter;
g_return_if_fail (listener != NULL);
message = dbus_message_new_signal (GS_LISTENER_PATH,
GS_LISTENER_SERVICE,
name);
dbus_message_iter_init_append (message, &iter);
dbus_message_iter_append_basic (&iter, DBUS_TYPE_BOOLEAN, &value);
if (! send_dbus_message (listener->priv->connection, message)) {
gs_debug ("Could not send %s signal", name);
}
dbus_message_unref (message);
}
| 0 |
[] |
gnome-screensaver
|
284c9924969a49dbf2d5fae1d680d3310c4df4a3
| 154,740,305,313,031,400,000,000,000,000,000,000,000 | 22 |
Remove session inhibitors if the originator falls of the bus
This fixes a problem where totem leaves inhibitors behind, see
bug 600488.
|
bool val_native(THD *thd, Native *to)
{
return Time(thd, this).to_native(to, decimals);
}
| 0 |
[
"CWE-617"
] |
server
|
807945f2eb5fa22e6f233cc17b85a2e141efe2c8
| 282,761,323,918,606,000,000,000,000,000,000,000,000 | 4 |
MDEV-26402: A SEGV in Item_field::used_tables/update_depend_map_for_order...
When doing condition pushdown from HAVING into WHERE,
Item_equal::create_pushable_equalities() calls
item->set_extraction_flag(IMMUTABLE_FL) for constant items.
Then, Item::cleanup_excluding_immutables_processor() checks for this flag
to see if it should call item->cleanup() or leave the item as-is.
The failure happens when a constant item has a non-constant one inside it,
like:
(tbl.col=0 AND impossible_cond)
item->walk(cleanup_excluding_immutables_processor) works in a bottom-up
way so it
1. will call Item_func_eq(tbl.col=0)->cleanup()
2. will not call Item_cond_and->cleanup (as the AND is constant)
This creates an item tree where a fixed Item has an un-fixed Item inside
it which eventually causes an assertion failure.
Fixed by introducing this rule: instead of just calling
item->set_extraction_flag(IMMUTABLE_FL);
we call Item::walk() to set the flag for all sub-items of the item.
|
const Type_handler *type_handler() const { return (*ref)->type_handler(); }
| 0 |
[
"CWE-617"
] |
server
|
807945f2eb5fa22e6f233cc17b85a2e141efe2c8
| 103,879,598,283,428,740,000,000,000,000,000,000,000 | 1 |
MDEV-26402: A SEGV in Item_field::used_tables/update_depend_map_for_order...
When doing condition pushdown from HAVING into WHERE,
Item_equal::create_pushable_equalities() calls
item->set_extraction_flag(IMMUTABLE_FL) for constant items.
Then, Item::cleanup_excluding_immutables_processor() checks for this flag
to see if it should call item->cleanup() or leave the item as-is.
The failure happens when a constant item has a non-constant one inside it,
like:
(tbl.col=0 AND impossible_cond)
item->walk(cleanup_excluding_immutables_processor) works in a bottom-up
way so it
1. will call Item_func_eq(tbl.col=0)->cleanup()
2. will not call Item_cond_and->cleanup (as the AND is constant)
This creates an item tree where a fixed Item has an un-fixed Item inside
it which eventually causes an assertion failure.
Fixed by introducing this rule: instead of just calling
item->set_extraction_flag(IMMUTABLE_FL);
we call Item::walk() to set the flag for all sub-items of the item.
|
static int ieee80211_runtime_change_iftype(struct ieee80211_sub_if_data *sdata,
enum nl80211_iftype type)
{
struct ieee80211_local *local = sdata->local;
int ret, err;
enum nl80211_iftype internal_type = type;
bool p2p = false;
ASSERT_RTNL();
if (!local->ops->change_interface)
return -EBUSY;
switch (sdata->vif.type) {
case NL80211_IFTYPE_AP:
case NL80211_IFTYPE_STATION:
case NL80211_IFTYPE_ADHOC:
/*
* Could maybe also all others here?
* Just not sure how that interacts
* with the RX/config path e.g. for
* mesh.
*/
break;
default:
return -EBUSY;
}
switch (type) {
case NL80211_IFTYPE_AP:
case NL80211_IFTYPE_STATION:
case NL80211_IFTYPE_ADHOC:
/*
* Could probably support everything
* but WDS here (WDS do_open can fail
* under memory pressure, which this
* code isn't prepared to handle).
*/
break;
case NL80211_IFTYPE_P2P_CLIENT:
p2p = true;
internal_type = NL80211_IFTYPE_STATION;
break;
case NL80211_IFTYPE_P2P_GO:
p2p = true;
internal_type = NL80211_IFTYPE_AP;
break;
default:
return -EBUSY;
}
ret = ieee80211_check_concurrent_iface(sdata, internal_type);
if (ret)
return ret;
ieee80211_do_stop(sdata, false);
ieee80211_teardown_sdata(sdata->dev);
ret = drv_change_interface(local, sdata, internal_type, p2p);
if (ret)
type = sdata->vif.type;
ieee80211_setup_sdata(sdata, type);
err = ieee80211_do_open(sdata->dev, false);
WARN(err, "type change: do_open returned %d", err);
return ret;
}
| 0 |
[
"CWE-703",
"CWE-264"
] |
linux
|
550fd08c2cebad61c548def135f67aba284c6162
| 137,248,422,688,421,840,000,000,000,000,000,000,000 | 70 |
net: Audit drivers to identify those needing IFF_TX_SKB_SHARING cleared
After the last patch, We are left in a state in which only drivers calling
ether_setup have IFF_TX_SKB_SHARING set (we assume that drivers touching real
hardware call ether_setup for their net_devices and don't hold any state in
their skbs. There are a handful of drivers that violate this assumption of
course, and need to be fixed up. This patch identifies those drivers, and marks
them as not being able to support the safe transmission of skbs by clearning the
IFF_TX_SKB_SHARING flag in priv_flags
Signed-off-by: Neil Horman <[email protected]>
CC: Karsten Keil <[email protected]>
CC: "David S. Miller" <[email protected]>
CC: Jay Vosburgh <[email protected]>
CC: Andy Gospodarek <[email protected]>
CC: Patrick McHardy <[email protected]>
CC: Krzysztof Halasa <[email protected]>
CC: "John W. Linville" <[email protected]>
CC: Greg Kroah-Hartman <[email protected]>
CC: Marcel Holtmann <[email protected]>
CC: Johannes Berg <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
|
extract_task_thread_func (GTask *task,
gpointer source_object,
gpointer task_data,
GCancellable *cancellable)
{
ExtractJob *extract_job = task_data;
GList *l;
GList *existing_output_files = NULL;
gint total_files;
g_autofree guint64 *archive_compressed_sizes = NULL;
gint i;
g_timer_start (extract_job->common.time);
nautilus_progress_info_start (extract_job->common.progress);
nautilus_progress_info_set_details (extract_job->common.progress,
_("Preparing to extract"));
total_files = g_list_length (extract_job->source_files);
archive_compressed_sizes = g_malloc0_n (total_files, sizeof (guint64));
extract_job->total_compressed_size = 0;
for (l = extract_job->source_files, i = 0;
l != NULL && !job_aborted ((CommonJob *) extract_job);
l = l->next, i++)
{
GFile *source_file;
g_autoptr (GFileInfo) info = NULL;
source_file = G_FILE (l->data);
info = g_file_query_info (source_file,
G_FILE_ATTRIBUTE_STANDARD_SIZE,
G_FILE_QUERY_INFO_NOFOLLOW_SYMLINKS,
extract_job->common.cancellable,
NULL);
if (info)
{
archive_compressed_sizes[i] = g_file_info_get_size (info);
extract_job->total_compressed_size += archive_compressed_sizes[i];
}
}
extract_job->base_progress = 0;
for (l = extract_job->source_files, i = 0;
l != NULL && !job_aborted ((CommonJob *) extract_job);
l = l->next, i++)
{
g_autoptr (AutoarExtractor) extractor = NULL;
extractor = autoar_extractor_new (G_FILE (l->data),
extract_job->destination_directory);
autoar_extractor_set_notify_interval (extractor,
PROGRESS_NOTIFY_INTERVAL);
g_signal_connect (extractor, "error",
G_CALLBACK (extract_job_on_error),
extract_job);
g_signal_connect (extractor, "decide-destination",
G_CALLBACK (extract_job_on_decide_destination),
extract_job);
g_signal_connect (extractor, "progress",
G_CALLBACK (extract_job_on_progress),
extract_job);
g_signal_connect (extractor, "completed",
G_CALLBACK (extract_job_on_completed),
extract_job);
extract_job->archive_compressed_size = archive_compressed_sizes[i];
autoar_extractor_start (extractor,
extract_job->common.cancellable);
g_signal_handlers_disconnect_by_data (extractor,
extract_job);
extract_job->base_progress += (gdouble) extract_job->archive_compressed_size /
(gdouble) extract_job->total_compressed_size;
}
if (!job_aborted ((CommonJob *) extract_job))
{
report_extract_final_progress (extract_job, total_files);
}
for (l = extract_job->output_files; l != NULL; l = l->next)
{
GFile *output_file;
output_file = G_FILE (l->data);
if (g_file_query_exists (output_file, NULL))
{
existing_output_files = g_list_prepend (existing_output_files,
g_object_ref (output_file));
}
}
g_list_free_full (extract_job->output_files, g_object_unref);
extract_job->output_files = existing_output_files;
if (extract_job->common.undo_info)
{
if (extract_job->output_files)
{
NautilusFileUndoInfoExtract *undo_info;
undo_info = NAUTILUS_FILE_UNDO_INFO_EXTRACT (extract_job->common.undo_info);
nautilus_file_undo_info_extract_set_outputs (undo_info,
extract_job->output_files);
}
else
{
/* There is nothing to undo if there is no output */
g_clear_object (&extract_job->common.undo_info);
}
}
}
| 0 |
[
"CWE-20"
] |
nautilus
|
1630f53481f445ada0a455e9979236d31a8d3bb0
| 338,786,515,747,347,900,000,000,000,000,000,000,000 | 124 |
mime-actions: use file metadata for trusting desktop files
Currently we only trust desktop files that have the executable bit
set, and don't replace the displayed icon or the displayed name until
it's trusted, which prevents for running random programs by a malicious
desktop file.
However, the executable permission is preserved if the desktop file
comes from a compressed file.
To prevent this, add a metadata::trusted metadata to the file once the
user acknowledges the file as trusted. This adds metadata to the file,
which cannot be added unless it has access to the computer.
Also remove the SHEBANG "trusted" content we were putting inside the
desktop file, since that doesn't add more security since it can come
with the file itself.
https://bugzilla.gnome.org/show_bug.cgi?id=777991
|
static void rtl8139_MultiIntr_write(RTL8139State *s, uint32_t val)
{
DPRINTF("MultiIntr write(w) val=0x%04x\n", val);
/* mask unwritable bits */
val = SET_MASKED(val, 0xf000, s->MultiIntr);
s->MultiIntr = val;
}
| 0 |
[
"CWE-835"
] |
qemu
|
5311fb805a4403bba024e83886fa0e7572265de4
| 99,977,744,240,916,030,000,000,000,000,000,000,000 | 9 |
rtl8139: switch to use qemu_receive_packet() for loopback
This patch switches to use qemu_receive_packet() which can detect
reentrancy and return early.
This is intended to address CVE-2021-3416.
Cc: Prasad J Pandit <[email protected]>
Cc: [email protected]
Buglink: https://bugs.launchpad.net/qemu/+bug/1910826
Reviewed-by: Philippe Mathieu-Daudé <[email protected]
Signed-off-by: Alexander Bulekov <[email protected]>
Signed-off-by: Jason Wang <[email protected]>
|
FixedBuffer(Char *array, std::size_t size) : fmt::Buffer<Char>(array, size) {}
| 0 |
[
"CWE-134",
"CWE-119",
"CWE-787"
] |
fmt
|
8cf30aa2be256eba07bb1cefb998c52326e846e7
| 328,398,400,063,290,460,000,000,000,000,000,000,000 | 1 |
Fix segfault on complex pointer formatting (#642)
|
static unsigned interleave_nodes(struct mempolicy *policy)
{
unsigned next;
struct task_struct *me = current;
next = next_node_in(me->il_prev, policy->v.nodes);
if (next < MAX_NUMNODES)
me->il_prev = next;
return next;
}
| 0 |
[
"CWE-416"
] |
linux
|
73223e4e2e3867ebf033a5a8eb2e5df0158ccc99
| 149,195,202,327,445,060,000,000,000,000,000,000,000 | 10 |
mm/mempolicy: fix use after free when calling get_mempolicy
I hit a use after free issue when executing trinity and repoduced it
with KASAN enabled. The related call trace is as follows.
BUG: KASan: use after free in SyS_get_mempolicy+0x3c8/0x960 at addr ffff8801f582d766
Read of size 2 by task syz-executor1/798
INFO: Allocated in mpol_new.part.2+0x74/0x160 age=3 cpu=1 pid=799
__slab_alloc+0x768/0x970
kmem_cache_alloc+0x2e7/0x450
mpol_new.part.2+0x74/0x160
mpol_new+0x66/0x80
SyS_mbind+0x267/0x9f0
system_call_fastpath+0x16/0x1b
INFO: Freed in __mpol_put+0x2b/0x40 age=4 cpu=1 pid=799
__slab_free+0x495/0x8e0
kmem_cache_free+0x2f3/0x4c0
__mpol_put+0x2b/0x40
SyS_mbind+0x383/0x9f0
system_call_fastpath+0x16/0x1b
INFO: Slab 0xffffea0009cb8dc0 objects=23 used=8 fp=0xffff8801f582de40 flags=0x200000000004080
INFO: Object 0xffff8801f582d760 @offset=5984 fp=0xffff8801f582d600
Bytes b4 ffff8801f582d750: ae 01 ff ff 00 00 00 00 5a 5a 5a 5a 5a 5a 5a 5a ........ZZZZZZZZ
Object ffff8801f582d760: 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b 6b kkkkkkkkkkkkkkkk
Object ffff8801f582d770: 6b 6b 6b 6b 6b 6b 6b a5 kkkkkkk.
Redzone ffff8801f582d778: bb bb bb bb bb bb bb bb ........
Padding ffff8801f582d8b8: 5a 5a 5a 5a 5a 5a 5a 5a ZZZZZZZZ
Memory state around the buggy address:
ffff8801f582d600: fb fb fb fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff8801f582d680: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff8801f582d700: fc fc fc fc fc fc fc fc fc fc fc fc fb fb fb fc
!shared memory policy is not protected against parallel removal by other
thread which is normally protected by the mmap_sem. do_get_mempolicy,
however, drops the lock midway while we can still access it later.
Early premature up_read is a historical artifact from times when
put_user was called in this path see https://lwn.net/Articles/124754/
but that is gone since 8bccd85ffbaf ("[PATCH] Implement sys_* do_*
layering in the memory policy layer."). but when we have the the
current mempolicy ref count model. The issue was introduced
accordingly.
Fix the issue by removing the premature release.
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: zhong jiang <[email protected]>
Acked-by: Michal Hocko <[email protected]>
Cc: Minchan Kim <[email protected]>
Cc: Vlastimil Babka <[email protected]>
Cc: David Rientjes <[email protected]>
Cc: Mel Gorman <[email protected]>
Cc: <[email protected]> [2.6+]
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
|
int input_device_register(struct btd_service *service)
{
struct btd_device *device = btd_service_get_device(service);
const char *path = device_get_path(device);
struct input_device *idev;
DBG("%s", path);
idev = input_device_new(service);
if (!idev)
return -EINVAL;
if (uhid_enabled) {
idev->uhid = bt_uhid_new_default();
if (!idev->uhid) {
error("bt_uhid_new_default: failed");
input_device_free(idev);
return -EIO;
}
}
if (g_dbus_register_interface(btd_get_dbus_connection(),
idev->path, INPUT_INTERFACE,
NULL, NULL,
input_properties, idev,
NULL) == FALSE) {
error("Unable to register %s interface", INPUT_INTERFACE);
input_device_free(idev);
return -EINVAL;
}
btd_service_set_user_data(service, idev);
return 0;
}
| 0 |
[] |
bluez
|
3cccdbab2324086588df4ccf5f892fb3ce1f1787
| 86,585,095,734,637,960,000,000,000,000,000,000,000 | 35 |
HID accepts bonded device connections only.
This change adds a configuration for platforms to choose a more secure
posture for the HID profile. While some older mice are known to not
support pairing or encryption, some platform may choose a more secure
posture by requiring the device to be bonded and require the
connection to be encrypted when bonding is required.
Reference:
https://www.intel.com/content/www/us/en/security-center/advisory/intel-sa-00352.html
|
static int query_formats(AVFilterContext *ctx)
{
LutContext *s = ctx->priv;
const enum AVPixelFormat *pix_fmts = s->is_rgb ? rgb_pix_fmts :
s->is_yuv ? yuv_pix_fmts : all_pix_fmts;
ff_set_common_formats(ctx, ff_make_format_list(pix_fmts));
return 0;
}
| 0 |
[
"CWE-119",
"CWE-787"
] |
FFmpeg
|
e43a0a232dbf6d3c161823c2e07c52e76227a1bc
| 4,603,536,022,782,102,000,000,000,000,000,000,000 | 10 |
avfilter: fix plane validity checks
Fixes out of array accesses
Signed-off-by: Michael Niedermayer <[email protected]>
|
void CZNC::BackupConfigOnce(const CString& sSuffix) {
static bool didBackup = false;
if (didBackup) return;
didBackup = true;
CUtils::PrintAction("Creating a config backup");
CString sBackup = CDir::ChangeDir(m_sConfigFile, "../znc.conf." + sSuffix);
if (CFile::Copy(m_sConfigFile, sBackup))
CUtils::PrintStatus(true, sBackup);
else
CUtils::PrintStatus(false, strerror(errno));
}
| 0 |
[
"CWE-20"
] |
znc
|
64613bc8b6b4adf1e32231f9844d99cd512b8973
| 141,673,500,240,609,660,000,000,000,000,000,000,000 | 13 |
Don't crash if user specified invalid encoding.
This is CVE-2019-9917
|
int BN_is_one(const BIGNUM *a)
{
return BN_abs_is_word(a, 1) && !a->neg;
}
| 0 |
[
"CWE-310"
] |
openssl
|
aab7c770353b1dc4ba045938c8fb446dd1c4531e
| 222,841,968,349,573,250,000,000,000,000,000,000,000 | 4 |
Elliptic curve scalar multiplication with timing attack defenses
Co-authored-by: Nicola Tuveri <[email protected]>
Co-authored-by: Cesar Pereida Garcia <[email protected]>
Co-authored-by: Sohaib ul Hassan <[email protected]>
Reviewed-by: Andy Polyakov <[email protected]>
Reviewed-by: Matt Caswell <[email protected]>
(Merged from https://github.com/openssl/openssl/pull/6009)
(cherry picked from commit 40e48e54582e46c1a01e184ecf5bd31f4f7f8294)
|
void tcp_attach(struct socket *so)
{
so->so_tcpcb = tcp_newtcpcb(so);
insque(so, &so->slirp->tcb);
}
| 0 |
[
"CWE-787"
] |
libslirp
|
2655fffed7a9e765bcb4701dd876e9dab975f289
| 265,472,502,272,502,430,000,000,000,000,000,000,000 | 5 |
tcp_emu: Fix oob access
The main loop only checks for one available byte, while we sometimes
need two bytes.
|
int __get_unused_fd_flags(unsigned flags, unsigned long nofile)
{
return __alloc_fd(current->files, 0, nofile, flags);
}
| 0 |
[] |
linux
|
0f2122045b946241a9e549c2a76cea54fa58a7ff
| 10,246,009,562,625,573,000,000,000,000,000,000,000 | 4 |
io_uring: don't rely on weak ->files references
Grab actual references to the files_struct. To avoid circular references
issues due to this, we add a per-task note that keeps track of what
io_uring contexts a task has used. When the tasks execs or exits its
assigned files, we cancel requests based on this tracking.
With that, we can grab proper references to the files table, and no
longer need to rely on stashing away ring_fd and ring_file to check
if the ring_fd may have been closed.
Cc: [email protected] # v5.5+
Reviewed-by: Pavel Begunkov <[email protected]>
Signed-off-by: Jens Axboe <[email protected]>
|
explicit UnicodeDecodeOp(OpKernelConstruction* ctx)
: UnicodeDecodeBaseOp<SPLITS_TYPE>(ctx, false) {}
| 0 |
[
"CWE-824",
"CWE-787"
] |
tensorflow
|
2e0ee46f1a47675152d3d865797a18358881d7a6
| 36,864,342,802,887,346,000,000,000,000,000,000,000 | 2 |
Ensure non-empty input_splits in tf.raw_ops.UnicodeEncode
PiperOrigin-RevId: 387170080
Change-Id: I3b489acc51c5cb4124c535b9df7cc6e62ef21766
|
redisOptions get_redis_tcp_options(struct config config) {
redisOptions options = {0};
REDIS_OPTIONS_SET_TCP(&options, config.tcp.host, config.tcp.port);
return options;
}
| 0 |
[
"CWE-190",
"CWE-680"
] |
redis
|
0215324a66af949be39b34be2d55143232c1cb71
| 204,404,474,789,854,100,000,000,000,000,000,000,000 | 5 |
Fix redis-cli / redis-sential overflow on some platforms (CVE-2021-32762) (#9587)
The redis-cli command line tool and redis-sentinel service may be vulnerable
to integer overflow when parsing specially crafted large multi-bulk network
replies. This is a result of a vulnerability in the underlying hiredis
library which does not perform an overflow check before calling the calloc()
heap allocation function.
This issue only impacts systems with heap allocators that do not perform their
own overflow checks. Most modern systems do and are therefore not likely to
be affected. Furthermore, by default redis-sentinel uses the jemalloc allocator
which is also not vulnerable.
Co-authored-by: Yossi Gottlieb <[email protected]>
|
void ssl_calc_verify_tls_sha256( ssl_context *ssl, unsigned char hash[32] )
{
sha2_context sha2;
SSL_DEBUG_MSG( 2, ( "=> calc verify sha256" ) );
memcpy( &sha2, &ssl->handshake->fin_sha2, sizeof(sha2_context) );
sha2_finish( &sha2, hash );
SSL_DEBUG_BUF( 3, "calculated verify result", hash, 32 );
SSL_DEBUG_MSG( 2, ( "<= calc verify" ) );
return;
}
| 0 |
[
"CWE-310"
] |
polarssl
|
4582999be608c9794d4518ae336b265084db9f93
| 226,918,410,450,146,680,000,000,000,000,000,000,000 | 14 |
Fixed timing difference resulting from badly formatted padding.
|
fill_one_private_key (NMConnection *connection,
const char *pk_tag,
const char *pk_prop,
const char *cc_prop)
{
const char *filename;
NMSetting8021x *tmp;
NMSetting8021xCKType pk_type = NM_SETTING_802_1X_CK_TYPE_UNKNOWN;
gboolean need_client_cert = TRUE;
/* If the private key is PKCS#12, don't set the client cert */
filename = g_object_get_data (G_OBJECT (connection), pk_tag);
if (!filename)
return TRUE;
tmp = NM_SETTING_802_1X (nm_setting_802_1x_new ());
nm_setting_802_1x_set_private_key_from_file (tmp, filename, NULL, &pk_type, NULL);
if (pk_type == NM_SETTING_802_1X_CK_TYPE_PKCS12) {
GByteArray *array;
array = file_to_g_byte_array (filename);
if (array) {
NMSetting *s_8021x = nm_connection_get_setting (connection, NM_TYPE_SETTING_802_1X);
g_object_set (s_8021x,
pk_prop, array,
cc_prop, array,
NULL);
g_byte_array_free (array, TRUE);
need_client_cert = FALSE;
}
}
g_object_unref (tmp);
return need_client_cert;
}
| 0 |
[
"CWE-310"
] |
network-manager-applet
|
4020594dfbf566f1852f0acb36ad631a9e73a82b
| 211,052,175,286,128,250,000,000,000,000,000,000,000 | 35 |
core: fix CA cert mishandling after cert file deletion (deb #560067) (rh #546793)
If a connection was created with a CA certificate, but the user later
moved or deleted that CA certificate, the applet would simply provide the
connection to NetworkManager without any CA certificate. This could cause
NM to connect to the original network (or a network spoofing the original
network) without verifying the identity of the network as the user
expects.
In the future we can/should do better here by (1) alerting the user that
some connection is now no longer complete by flagging it in the connection
editor or notifying the user somehow, and (2) by using a freaking' cert
store already (not that Linux has one yet).
|
uint32_t virtio_config_readl(VirtIODevice *vdev, uint32_t addr)
{
VirtioDeviceClass *k = VIRTIO_DEVICE_GET_CLASS(vdev);
uint32_t val;
k->get_config(vdev, vdev->config);
if (addr > (vdev->config_len - sizeof(val)))
return (uint32_t)-1;
val = ldl_p(vdev->config + addr);
return val;
}
| 1 |
[
"CWE-269"
] |
qemu
|
5f5a1318653c08e435cfa52f60b6a712815b659d
| 242,956,484,040,927,100,000,000,000,000,000,000,000 | 13 |
virtio: properly validate address before accessing config
There are several several issues in the current checking:
- The check was based on the minus of unsigned values which can overflow
- It was done after .{set|get}_config() which can lead crash when config_len
is zero since vdev->config is NULL
Fix this by:
- Validate the address in virtio_pci_config_{read|write}() before
.{set|get}_config
- Use addition instead minus to do the validation
Cc: Michael S. Tsirkin <[email protected]>
Cc: Petr Matousek <[email protected]>
Signed-off-by: Jason Wang <[email protected]>
Acked-by: Michael S. Tsirkin <[email protected]>
Acked-by: Petr Matousek <[email protected]>
Message-id: [email protected]
Signed-off-by: Anthony Liguori <[email protected]>
|
static av_cold int rpza_decode_init(AVCodecContext *avctx)
{
RpzaContext *s = avctx->priv_data;
s->avctx = avctx;
avctx->pix_fmt = AV_PIX_FMT_RGB555;
avcodec_get_frame_defaults(&s->frame);
return 0;
}
| 0 |
[
"CWE-119",
"CWE-787"
] |
FFmpeg
|
3819db745da2ac7fb3faacb116788c32f4753f34
| 332,459,694,754,974,400,000,000,000,000,000,000,000 | 11 |
avcodec/rpza: Perform pointer advance and checks before using the pointers
Fixes out of array accesses
Fixes Ticket2850
Signed-off-by: Michael Niedermayer <[email protected]>
|
StringInputBuffer* objects_string_compare_buffer_a() {
return &objects_string_compare_buffer_a_;
}
| 0 |
[
"CWE-20",
"CWE-119"
] |
node
|
530af9cb8e700e7596b3ec812bad123c9fa06356
| 233,699,257,036,891,800,000,000,000,000,000,000,000 | 3 |
v8: Interrupts must not mask stack overflow.
Backport of https://codereview.chromium.org/339883002
|
static enum sas_device_type to_dev_type(struct discover_resp *dr)
{
/* This is detecting a failure to transmit initial dev to host
* FIS as described in section J.5 of sas-2 r16
*/
if (dr->attached_dev_type == SAS_PHY_UNUSED && dr->attached_sata_dev &&
dr->linkrate >= SAS_LINK_RATE_1_5_GBPS)
return SAS_SATA_PENDING;
else
return dr->attached_dev_type;
}
| 0 |
[
"CWE-399",
"CWE-772"
] |
linux
|
4a491b1ab11ca0556d2fda1ff1301e862a2d44c4
| 124,879,607,833,913,500,000,000,000,000,000,000,000 | 11 |
scsi: libsas: fix memory leak in sas_smp_get_phy_events()
We've got a memory leak with the following producer:
while true;
do cat /sys/class/sas_phy/phy-1:0:12/invalid_dword_count >/dev/null;
done
The buffer req is allocated and not freed after we return. Fix it.
Fixes: 2908d778ab3e ("[SCSI] aic94xx: new driver")
Signed-off-by: Jason Yan <[email protected]>
CC: John Garry <[email protected]>
CC: chenqilin <[email protected]>
CC: chenxiang <[email protected]>
Reviewed-by: Christoph Hellwig <[email protected]>
Reviewed-by: Hannes Reinecke <[email protected]>
Signed-off-by: Martin K. Petersen <[email protected]>
|
validate_proto_tree_add_bytes_ftype(const enum ftenum type)
{
return (type == FT_BYTES ||
type == FT_UINT_BYTES ||
type == FT_OID ||
type == FT_REL_OID ||
type == FT_SYSTEM_ID );
}
| 0 |
[
"CWE-401"
] |
wireshark
|
a9fc769d7bb4b491efb61c699d57c9f35269d871
| 1,410,015,719,840,519,700,000,000,000,000,000,000 | 8 |
epan: Fix a memory leak.
Make sure _proto_tree_add_bits_ret_val allocates a bits array using the
packet scope, otherwise we leak memory. Fixes #17032.
|
static void encode_wavelet_transform(VC2EncContext *s)
{
encode_transform_params(s);
avpriv_align_put_bits(&s->pb);
/* Continued after DWT in encode_transform_data() */
}
| 0 |
[
"CWE-125"
] |
FFmpeg
|
94e538aebbc9f9c529e8b1f2eda860cfb8c473b1
| 303,210,405,757,866,970,000,000,000,000,000,000,000 | 6 |
vc2enc_dwt: pad the temporary buffer by the slice size
Since non-Haar wavelets need to look into pixels outside the frame, we
need to pad the buffer. The old factor of two seemed to be a workaround
that fact and only padded to the left and bottom. This correctly pads
by the slice size and as such reduces memory usage and potential
exploits.
Reported by Liu Bingchang.
Ideally, there should be no temporary buffer but the encoder is designed
to deinterleave the coefficients into the classical wavelet structure
with the lower frequency values in the top left corner.
Signed-off-by: Rostislav Pehlivanov <[email protected]>
(cherry picked from commit 3228ac730c11eca49d5680d5550128e397061c85)
|
log_rr (const char server[4], const char *q, const char type[2],
const char *buf, unsigned int len, unsigned int ttl)
{
int i = 0;
string ("rr ");
ip (server);
space ();
number (ttl);
space ();
logtype (type);
space ();
name (q);
space ();
for (i = 0; i < len; ++i)
{
hex (buf[i]);
if (i > 30)
{
string ("...");
break;
}
}
line ();
}
| 0 |
[
"CWE-362"
] |
ndjbdns
|
847523271f3966cf4618c5689b905703c41dec1c
| 13,797,210,337,760,079,000,000,000,000,000,000,000 | 27 |
Merge identical outgoing requests.
This patch fixes dnscache to combine *same* client queries into one
single outgoing request, thus securing the server from possible cache
poisoning attacks. This fixes one of the cache poisoning vulnerability
reported by Mr Mark Johnson
-> https://bugzilla.redhat.com/show_bug.cgi?id=838965.
Nonetheless the original patch for this issue was created by
Mr Jeff king -> http://www.your.org/dnscache/
Sincere thanks to Mr Mark for reporting this issue and Mr Jeff for
creating the patch and releasing it under public domain.
|
QByteArray CoreNetwork::channelEncode(const QString &bufferName, const QString &string) const
{
if (!bufferName.isEmpty()) {
IrcChannel *channel = ircChannel(bufferName);
if (channel)
return channel->encodeString(string);
}
return encodeString(string);
}
| 0 |
[
"CWE-399"
] |
quassel
|
b5e38970ffd55e2dd9f706ce75af9a8d7730b1b8
| 90,087,315,020,331,440,000,000,000,000,000,000,000 | 9 |
Improve the message-splitting algorithm for PRIVMSG and CTCP
This introduces a new message splitting algorithm based on
QTextBoundaryFinder. It works by first starting with the entire
message to be sent, encoding it, and checking to see if it is over
the maximum message length. If it is, it uses QTBF to find the
word boundary most immediately preceding the maximum length. If no
suitable boundary can be found, it falls back to searching for
grapheme boundaries. It repeats this process until the entire
message has been sent.
Unlike what it replaces, the new splitting code is not recursive
and cannot cause stack overflows. Additionally, if it is unable
to split a string, it will give up gracefully and not crash the
core or cause a thread to run away.
This patch fixes two bugs. The first is garbage characters caused
by accidentally splitting the string in the middle of a multibyte
character. Since the new code splits at a character level instead
of a byte level, this will no longer be an issue. The second is
the core crash caused by sending an overlength CTCP query ("/me")
containing only multibyte characters. This bug was caused by the
old CTCP splitter using the byte index from lastParamOverrun() as
a character index for a QString.
|
void Filter::onUpstreamConnection() {
connecting_ = false;
// Re-enable downstream reads now that the upstream connection is established
// so we have a place to send downstream data to.
read_callbacks_->connection().readDisable(false);
read_callbacks_->upstreamHost()->outlierDetector().putResult(
Upstream::Outlier::Result::LocalOriginConnectSuccessFinal);
ENVOY_CONN_LOG(debug, "TCP:onUpstreamEvent(), requestedServerName: {}",
read_callbacks_->connection(),
getStreamInfo().downstreamAddressProvider().requestedServerName());
if (config_->idleTimeout()) {
// The idle_timer_ can be moved to a Drainer, so related callbacks call into
// the UpstreamCallbacks, which has the same lifetime as the timer, and can dispatch
// the call to either TcpProxy or to Drainer, depending on the current state.
idle_timer_ = read_callbacks_->connection().dispatcher().createTimer(
[upstream_callbacks = upstream_callbacks_]() { upstream_callbacks->onIdleTimeout(); });
resetIdleTimer();
read_callbacks_->connection().addBytesSentCallback([this](uint64_t) {
resetIdleTimer();
return true;
});
if (upstream_) {
upstream_->addBytesSentCallback([upstream_callbacks = upstream_callbacks_](uint64_t) -> bool {
upstream_callbacks->onBytesSent();
return true;
});
}
}
}
| 0 |
[
"CWE-416"
] |
envoy
|
ce0ae309057a216aba031aff81c445c90c6ef145
| 38,500,394,183,455,427,000,000,000,000,000,000,000 | 32 |
CVE-2021-43826
Signed-off-by: Yan Avlasov <[email protected]>
|
const char *unit_description(Unit *u) {
assert(u);
if (u->description)
return u->description;
return strna(u->id);
}
| 0 |
[
"CWE-269"
] |
systemd
|
bf65b7e0c9fc215897b676ab9a7c9d1c688143ba
| 337,463,749,969,755,760,000,000,000,000,000,000,000 | 8 |
core: imply NNP and SUID/SGID restriction for DynamicUser=yes service
Let's be safe, rather than sorry. This way DynamicUser=yes services can
neither take benefit of, nor create SUID/SGID binaries.
Given that DynamicUser= is a recent addition only we should be able to
get away with turning this on, even though this is strictly speaking a
binary compatibility breakage.
|
static void ssl_write_hostname_ext( ssl_context *ssl,
unsigned char *buf,
size_t *olen )
{
unsigned char *p = buf;
const unsigned char *end = ssl->out_msg + SSL_MAX_CONTENT_LEN;
*olen = 0;
if( ssl->hostname == NULL )
return;
SSL_DEBUG_MSG( 3, ( "client hello, adding server name extension: %s",
ssl->hostname ) );
if( (size_t)(end - p) < ssl->hostname_len + 9 )
{
SSL_DEBUG_MSG( 1, ( "buffer too small" ) );
return;
}
/*
* struct {
* NameType name_type;
* select (name_type) {
* case host_name: HostName;
* } name;
* } ServerName;
*
* enum {
* host_name(0), (255)
* } NameType;
*
* opaque HostName<1..2^16-1>;
*
* struct {
* ServerName server_name_list<1..2^16-1>
* } ServerNameList;
*/
*p++ = (unsigned char)( ( TLS_EXT_SERVERNAME >> 8 ) & 0xFF );
*p++ = (unsigned char)( ( TLS_EXT_SERVERNAME ) & 0xFF );
*p++ = (unsigned char)( ( (ssl->hostname_len + 5) >> 8 ) & 0xFF );
*p++ = (unsigned char)( ( (ssl->hostname_len + 5) ) & 0xFF );
*p++ = (unsigned char)( ( (ssl->hostname_len + 3) >> 8 ) & 0xFF );
*p++ = (unsigned char)( ( (ssl->hostname_len + 3) ) & 0xFF );
*p++ = (unsigned char)( ( TLS_EXT_SERVERNAME_HOSTNAME ) & 0xFF );
*p++ = (unsigned char)( ( ssl->hostname_len >> 8 ) & 0xFF );
*p++ = (unsigned char)( ( ssl->hostname_len ) & 0xFF );
memcpy( p, ssl->hostname, ssl->hostname_len );
*olen = ssl->hostname_len + 9;
}
| 1 |
[
"CWE-119"
] |
mbedtls
|
643a922c56b77235e88f106fb1b41c1a764cea5f
| 21,560,836,709,804,590,000,000,000,000,000,000,000 | 56 |
Reordered extension fields and added to ChangeLog
Reordered the transmission sequence of TLS extension fields in client hello
and added to ChangeLog.
|
void ESTreeIRGen::initCaptureStateInES5FunctionHelper() {
// Capture "this", "new.target" and "arguments" if there are inner arrows.
if (!curFunction()->getSemInfo()->containsArrowFunctions)
return;
auto *scope = curFunction()->function->getFunctionScope();
// "this".
curFunction()->capturedThis = Builder.createVariable(
scope, Variable::DeclKind::Var, genAnonymousLabelName("this"));
emitStore(
Builder,
Builder.getFunction()->getThisParameter(),
curFunction()->capturedThis,
true);
// "new.target".
curFunction()->capturedNewTarget = Builder.createVariable(
scope, Variable::DeclKind::Var, genAnonymousLabelName("new.target"));
emitStore(
Builder,
Builder.createGetNewTargetInst(),
curFunction()->capturedNewTarget,
true);
// "arguments".
if (curFunction()->getSemInfo()->containsArrowFunctionsUsingArguments) {
curFunction()->capturedArguments = Builder.createVariable(
scope, Variable::DeclKind::Var, genAnonymousLabelName("arguments"));
emitStore(
Builder,
curFunction()->createArgumentsInst,
curFunction()->capturedArguments,
true);
}
}
| 0 |
[
"CWE-125",
"CWE-787"
] |
hermes
|
091835377369c8fd5917d9b87acffa721ad2a168
| 274,022,340,102,903,600,000,000,000,000,000,000,000 | 36 |
Correctly restore whether or not a function is an inner generator
Summary:
If a generator was large enough to be lazily compiled, we would lose
that information when reconstituting the function's context. This meant
the function was generated as a regular function instead of a generator.
#utd-hermes-ignore-android
Reviewed By: tmikov
Differential Revision: D23580247
fbshipit-source-id: af5628bf322cbdc7c7cdfbb5f8d0756328518ea1
|
rhn_int_t r_jwe_get_header_int_value(jwe_t * jwe, const char * key) {
if (jwe != NULL) {
return _r_json_get_int_value(jwe->j_header, key);
}
return 0;
}
| 0 |
[
"CWE-787"
] |
rhonabwy
|
b4c2923a1ba4fabf9b55a89244127e153a3e549b
| 180,306,169,963,112,460,000,000,000,000,000,000,000 | 6 |
Fix buffer overflow on r_jwe_aesgcm_key_unwrap
|
static void mon_text_read_isodesc(struct mon_reader_text *rp,
struct mon_text_ptr *p, const struct mon_event_text *ep)
{
int ndesc; /* Display this many */
int i;
const struct mon_iso_desc *dp;
p->cnt += snprintf(p->pbuf + p->cnt, p->limit - p->cnt,
" %d", ep->numdesc);
ndesc = ep->numdesc;
if (ndesc > ISODESC_MAX)
ndesc = ISODESC_MAX;
if (ndesc < 0)
ndesc = 0;
dp = ep->isodesc;
for (i = 0; i < ndesc; i++) {
p->cnt += snprintf(p->pbuf + p->cnt, p->limit - p->cnt,
" %d:%u:%u", dp->status, dp->offset, dp->length);
dp++;
}
}
| 0 |
[
"CWE-787"
] |
linux
|
a5f596830e27e15f7a0ecd6be55e433d776986d8
| 317,750,948,704,422,160,000,000,000,000,000,000,000 | 21 |
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]>
|
int mnt_fs_get_tag(struct libmnt_fs *fs, const char **name, const char **value)
{
if (fs == NULL || !fs->tagname)
return -EINVAL;
if (name)
*name = fs->tagname;
if (value)
*value = fs->tagval;
return 0;
}
| 0 |
[
"CWE-552",
"CWE-703"
] |
util-linux
|
166e87368ae88bf31112a30e078cceae637f4cdb
| 62,050,271,884,812,300,000,000,000,000,000,000,000 | 10 |
libmount: remove support for deleted mount table entries
The "(deleted)" suffix has been originally used by kernel for deleted
mountpoints. Since kernel commit 9d4d65748a5ca26ea8650e50ba521295549bf4e3
(Dec 2014) kernel does not use this suffix for mount stuff in /proc at
all. Let's remove this support from libmount too.
Signed-off-by: Karel Zak <[email protected]>
|
static inline void SetPageHugeTemporary(struct page *page)
{
page[2].mapping = (void *)-1U;
}
| 0 |
[
"CWE-362"
] |
linux
|
17743798d81238ab13050e8e2833699b54e15467
| 254,907,091,934,071,440,000,000,000,000,000,000,000 | 4 |
mm/hugetlb: fix a race between hugetlb sysctl handlers
There is a race between the assignment of `table->data` and write value
to the pointer of `table->data` in the __do_proc_doulongvec_minmax() on
the other thread.
CPU0: CPU1:
proc_sys_write
hugetlb_sysctl_handler proc_sys_call_handler
hugetlb_sysctl_handler_common hugetlb_sysctl_handler
table->data = &tmp; hugetlb_sysctl_handler_common
table->data = &tmp;
proc_doulongvec_minmax
do_proc_doulongvec_minmax sysctl_head_finish
__do_proc_doulongvec_minmax unuse_table
i = table->data;
*i = val; // corrupt CPU1's stack
Fix this by duplicating the `table`, and only update the duplicate of
it. And introduce a helper of proc_hugetlb_doulongvec_minmax() to
simplify the code.
The following oops was seen:
BUG: kernel NULL pointer dereference, address: 0000000000000000
#PF: supervisor instruction fetch in kernel mode
#PF: error_code(0x0010) - not-present page
Code: Bad RIP value.
...
Call Trace:
? set_max_huge_pages+0x3da/0x4f0
? alloc_pool_huge_page+0x150/0x150
? proc_doulongvec_minmax+0x46/0x60
? hugetlb_sysctl_handler_common+0x1c7/0x200
? nr_hugepages_store+0x20/0x20
? copy_fd_bitmaps+0x170/0x170
? hugetlb_sysctl_handler+0x1e/0x20
? proc_sys_call_handler+0x2f1/0x300
? unregister_sysctl_table+0xb0/0xb0
? __fd_install+0x78/0x100
? proc_sys_write+0x14/0x20
? __vfs_write+0x4d/0x90
? vfs_write+0xef/0x240
? ksys_write+0xc0/0x160
? __ia32_sys_read+0x50/0x50
? __close_fd+0x129/0x150
? __x64_sys_write+0x43/0x50
? do_syscall_64+0x6c/0x200
? entry_SYSCALL_64_after_hwframe+0x44/0xa9
Fixes: e5ff215941d5 ("hugetlb: multiple hstates for multiple page sizes")
Signed-off-by: Muchun Song <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Reviewed-by: Mike Kravetz <[email protected]>
Cc: Andi Kleen <[email protected]>
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Linus Torvalds <[email protected]>
|
__gdata_service_query (GDataService *self, GDataAuthorizationDomain *domain, const gchar *feed_uri, GDataQuery *query, GType entry_type,
GCancellable *cancellable, GDataQueryProgressCallback progress_callback, gpointer progress_user_data, GError **error,
gboolean is_async)
{
GDataServiceClass *klass;
GDataFeed *feed;
SoupMessage *message;
message = _gdata_service_query (self, domain, feed_uri, query, cancellable, error);
if (message == NULL)
return NULL;
g_assert (message->response_body->data != NULL);
klass = GDATA_SERVICE_GET_CLASS (self);
feed = _gdata_feed_new_from_xml (klass->feed_type, message->response_body->data, message->response_body->length, entry_type,
progress_callback, progress_user_data, is_async, error);
g_object_unref (message);
if (feed == NULL)
return NULL;
/* Update the query with the feed's ETag */
if (query != NULL && feed != NULL && gdata_feed_get_etag (feed) != NULL)
gdata_query_set_etag (query, gdata_feed_get_etag (feed));
/* Update the query with the next and previous URIs from the feed */
if (query != NULL && feed != NULL) {
GDataLink *_link;
_link = gdata_feed_look_up_link (feed, "next");
if (_link != NULL)
_gdata_query_set_next_uri (query, gdata_link_get_uri (_link));
_link = gdata_feed_look_up_link (feed, "previous");
if (_link != NULL)
_gdata_query_set_previous_uri (query, gdata_link_get_uri (_link));
}
return feed;
}
| 0 |
[
"CWE-20"
] |
libgdata
|
6799f2c525a584dc998821a6ce897e463dad7840
| 125,754,757,836,788,830,000,000,000,000,000,000,000 | 39 |
core: Validate SSL certificates for all connections
This prevents MitM attacks which use spoofed SSL certificates.
Note that this bumps our libsoup requirement to 2.37.91.
Closes: https://bugzilla.gnome.org/show_bug.cgi?id=671535
|
gst_rtsp_connection_write (GstRTSPConnection * conn, const guint8 * data,
guint size, GTimeVal * timeout)
{
guint offset;
GstClockTime to;
GstRTSPResult res;
g_return_val_if_fail (conn != NULL, GST_RTSP_EINVAL);
g_return_val_if_fail (data != NULL || size == 0, GST_RTSP_EINVAL);
g_return_val_if_fail (conn->output_stream != NULL, GST_RTSP_EINVAL);
offset = 0;
to = timeout ? GST_TIMEVAL_TO_TIME (*timeout) : 0;
g_socket_set_timeout (conn->write_socket, (to + GST_SECOND - 1) / GST_SECOND);
res =
write_bytes (conn->output_stream, data, &offset, size, TRUE,
conn->cancellable);
g_socket_set_timeout (conn->write_socket, 0);
return res;
}
| 0 |
[] |
gst-plugins-base
|
f672277509705c4034bc92a141eefee4524d15aa
| 29,488,283,473,599,914,000,000,000,000,000,000,000 | 23 |
gstrtspconnection: Security loophole making heap overflow
The former code allowed an attacker to create a heap overflow by
sending a longer than allowed session id in a response and including a
semicolon to change the maximum length. With this change, the parser
will never go beyond 512 bytes.
|
_gnutls_handshake_client (gnutls_session_t session)
{
int ret = 0;
#ifdef HANDSHAKE_DEBUG
char buf[64];
if (session->internals.resumed_security_parameters.session_id_size > 0)
_gnutls_handshake_log ("HSK[%x]: Ask to resume: %s\n", session,
_gnutls_bin2hex (session->internals.
resumed_security_parameters.
session_id,
session->internals.
resumed_security_parameters.
session_id_size, buf,
sizeof (buf)));
#endif
switch (STATE)
{
case STATE0:
case STATE1:
ret = _gnutls_send_hello (session, AGAIN (STATE1));
STATE = STATE1;
IMED_RET ("send hello", ret);
case STATE2:
/* receive the server hello */
ret =
_gnutls_recv_handshake (session, NULL, NULL,
GNUTLS_HANDSHAKE_SERVER_HELLO,
MANDATORY_PACKET);
STATE = STATE2;
IMED_RET ("recv hello", ret);
case STATE70:
if (session->security_parameters.extensions.do_recv_supplemental)
{
ret = _gnutls_recv_supplemental (session);
STATE = STATE70;
IMED_RET ("recv supplemental", ret);
}
case STATE3:
/* RECV CERTIFICATE */
if (session->internals.resumed == RESUME_FALSE) /* if we are not resuming */
ret = _gnutls_recv_server_certificate (session);
STATE = STATE3;
IMED_RET ("recv server certificate", ret);
case STATE4:
/* receive the server key exchange */
if (session->internals.resumed == RESUME_FALSE) /* if we are not resuming */
ret = _gnutls_recv_server_kx_message (session);
STATE = STATE4;
IMED_RET ("recv server kx message", ret);
case STATE5:
/* receive the server certificate request - if any
*/
if (session->internals.resumed == RESUME_FALSE) /* if we are not resuming */
ret = _gnutls_recv_server_certificate_request (session);
STATE = STATE5;
IMED_RET ("recv server certificate request message", ret);
case STATE6:
/* receive the server hello done */
if (session->internals.resumed == RESUME_FALSE) /* if we are not resuming */
ret =
_gnutls_recv_handshake (session, NULL, NULL,
GNUTLS_HANDSHAKE_SERVER_HELLO_DONE,
MANDATORY_PACKET);
STATE = STATE6;
IMED_RET ("recv server hello done", ret);
case STATE71:
if (session->security_parameters.extensions.do_send_supplemental)
{
ret = _gnutls_send_supplemental (session, AGAIN (STATE71));
STATE = STATE71;
IMED_RET ("send supplemental", ret);
}
case STATE7:
/* send our certificate - if any and if requested
*/
if (session->internals.resumed == RESUME_FALSE) /* if we are not resuming */
ret = _gnutls_send_client_certificate (session, AGAIN (STATE7));
STATE = STATE7;
IMED_RET ("send client certificate", ret);
case STATE8:
if (session->internals.resumed == RESUME_FALSE) /* if we are not resuming */
ret = _gnutls_send_client_kx_message (session, AGAIN (STATE8));
STATE = STATE8;
IMED_RET ("send client kx", ret);
case STATE9:
/* send client certificate verify */
if (session->internals.resumed == RESUME_FALSE) /* if we are not resuming */
ret =
_gnutls_send_client_certificate_verify (session, AGAIN (STATE9));
STATE = STATE9;
IMED_RET ("send client certificate verify", ret);
STATE = STATE0;
default:
break;
}
return 0;
}
| 0 |
[
"CWE-189"
] |
gnutls
|
bc8102405fda11ea00ca3b42acc4f4bce9d6e97b
| 251,332,432,924,244,000,000,000,000,000,000,000,000 | 114 |
Fix GNUTLS-SA-2008-1 security vulnerabilities.
See http://www.gnu.org/software/gnutls/security.html for updates.
|
static BOOL update_send_desktop_resize(rdpContext* context)
{
return rdp_server_reactivate(context->rdp);
}
| 0 |
[
"CWE-119",
"CWE-787"
] |
FreeRDP
|
445a5a42c500ceb80f8fa7f2c11f3682538033f3
| 75,396,790,086,508,050,000,000,000,000,000,000,000 | 4 |
Fixed CVE-2018-8786
Thanks to Eyal Itkin from Check Point Software Technologies.
|
POINTER_COLOR_UPDATE* update_read_pointer_color(rdpUpdate* update, wStream* s, BYTE xorBpp)
{
POINTER_COLOR_UPDATE* pointer_color = calloc(1, sizeof(POINTER_COLOR_UPDATE));
if (!pointer_color)
goto fail;
if (!_update_read_pointer_color(s, pointer_color, xorBpp))
goto fail;
return pointer_color;
fail:
free_pointer_color_update(update->context, pointer_color);
return NULL;
}
| 0 |
[
"CWE-119",
"CWE-787"
] |
FreeRDP
|
445a5a42c500ceb80f8fa7f2c11f3682538033f3
| 237,438,429,491,696,300,000,000,000,000,000,000,000 | 15 |
Fixed CVE-2018-8786
Thanks to Eyal Itkin from Check Point Software Technologies.
|
AppProto AppLayerProtoDetectGetProto(AppLayerProtoDetectThreadCtx *tctx,
Flow *f,
uint8_t *buf, uint32_t buflen,
uint8_t ipproto, uint8_t direction)
{
SCEnter();
SCLogDebug("buflen %u for %s direction", buflen,
(direction & STREAM_TOSERVER) ? "toserver" : "toclient");
AppProto alproto = ALPROTO_UNKNOWN;
AppProto pm_alproto = ALPROTO_UNKNOWN;
if (!FLOW_IS_PM_DONE(f, direction)) {
AppProto pm_results[ALPROTO_MAX];
uint16_t pm_matches = AppLayerProtoDetectPMGetProto(tctx, f,
buf, buflen,
direction,
ipproto,
pm_results);
if (pm_matches > 0) {
alproto = pm_results[0];
/* HACK: if detected protocol is dcerpc/udp, we run PP as well
* to avoid misdetecting DNS as DCERPC. */
if (!(ipproto == IPPROTO_UDP && alproto == ALPROTO_DCERPC))
goto end;
pm_alproto = alproto;
/* fall through */
}
}
if (!FLOW_IS_PP_DONE(f, direction)) {
alproto = AppLayerProtoDetectPPGetProto(f, buf, buflen,
ipproto, direction);
if (alproto != ALPROTO_UNKNOWN)
goto end;
}
/* Look if flow can be found in expectation list */
if (!FLOW_IS_PE_DONE(f, direction)) {
alproto = AppLayerProtoDetectPEGetProto(f, ipproto, direction);
}
end:
if (alproto == ALPROTO_UNKNOWN)
alproto = pm_alproto;
SCReturnUInt(alproto);
}
| 0 |
[
"CWE-20"
] |
suricata
|
8357ef3f8ffc7d99ef6571350724160de356158b
| 200,181,786,607,726,400,000,000,000,000,000,000,000 | 51 |
proto/detect: workaround dns misdetected as dcerpc
The DCERPC UDP detection would misfire on DNS with transaction
ID 0x0400. This would happen as the protocol detection engine
gives preference to pattern based detection over probing parsers for
performance reasons.
This hack/workaround fixes this specific case by still running the
probing parser if DCERPC has been detected on UDP. The probing
parser result will take precedence.
Bug #2736.
|
struct socket_context *tls_init_server(struct tls_params *params,
struct socket_context *socket,
struct tevent_fd *fde,
const char *plain_chars)
{
return NULL;
}
| 0 |
[] |
samba
|
22af043d2f20760f27150d7d469c7c7b944c6b55
| 145,681,383,664,071,300,000,000,000,000,000,000,000 | 7 |
CVE-2013-4476: s4:libtls: check for safe permissions of tls private key file (key.pem)
If the tls key is not owned by root or has not mode 0600 samba will not
start up.
Bug: https://bugzilla.samba.org/show_bug.cgi?id=10234
Pair-Programmed-With: Stefan Metzmacher <[email protected]>
Signed-off-by: Björn Baumbach <[email protected]>
Signed-off-by: Stefan Metzmacher <[email protected]>
Reviewed-by: Stefan Metzmacher <[email protected]>
Autobuild-User(master): Karolin Seeger <[email protected]>
Autobuild-Date(master): Mon Nov 11 13:07:16 CET 2013 on sn-devel-104
|
static void sctp_insert_list(struct list_head *head, struct list_head *new)
{
struct list_head *pos;
struct sctp_chunk *nchunk, *lchunk;
__u32 ntsn, ltsn;
int done = 0;
nchunk = list_entry(new, struct sctp_chunk, transmitted_list);
ntsn = ntohl(nchunk->subh.data_hdr->tsn);
list_for_each(pos, head) {
lchunk = list_entry(pos, struct sctp_chunk, transmitted_list);
ltsn = ntohl(lchunk->subh.data_hdr->tsn);
if (TSN_lt(ntsn, ltsn)) {
list_add(new, pos->prev);
done = 1;
break;
}
}
if (!done)
list_add_tail(new, head);
}
| 0 |
[] |
linux
|
196d67593439b03088913227093e374235596e33
| 181,439,910,975,091,730,000,000,000,000,000,000,000 | 22 |
sctp: Add support to per-association statistics via a new SCTP_GET_ASSOC_STATS call
The current SCTP stack is lacking a mechanism to have per association
statistics. This is an implementation modeled after OpenSolaris'
SCTP_GET_ASSOC_STATS.
Userspace part will follow on lksctp if/when there is a general ACK on
this.
V4:
- Move ipackets++ before q->immediate.func() for consistency reasons
- Move sctp_max_rto() at the end of sctp_transport_update_rto() to avoid
returning bogus RTO values
- return asoc->rto_min when max_obs_rto value has not changed
V3:
- Increase ictrlchunks in sctp_assoc_bh_rcv() as well
- Move ipackets++ to sctp_inq_push()
- return 0 when no rto updates took place since the last call
V2:
- Implement partial retrieval of stat struct to cope for future expansion
- Kill the rtxpackets counter as it cannot be precise anyway
- Rename outseqtsns to outofseqtsns to make it clearer that these are out
of sequence unexpected TSNs
- Move asoc->ipackets++ under a lock to avoid potential miscounts
- Fold asoc->opackets++ into the already existing asoc check
- Kill unneeded (q->asoc) test when increasing rtxchunks
- Do not count octrlchunks if sending failed (SCTP_XMIT_OK != 0)
- Don't count SHUTDOWNs as SACKs
- Move SCTP_GET_ASSOC_STATS to the private space API
- Adjust the len check in sctp_getsockopt_assoc_stats() to allow for
future struct growth
- Move association statistics in their own struct
- Update idupchunks when we send a SACK with dup TSNs
- return min_rto in max_rto when RTO has not changed. Also return the
transport when max_rto last changed.
Signed-off: Michele Baldessari <[email protected]>
Acked-by: Vlad Yasevich <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
|
static int _nfs4_open_expired(struct nfs_open_context *ctx, struct nfs4_state *state)
{
struct nfs4_opendata *opendata;
int ret;
opendata = nfs4_open_recoverdata_alloc(ctx, state,
NFS4_OPEN_CLAIM_FH);
if (IS_ERR(opendata))
return PTR_ERR(opendata);
ret = nfs4_open_recover(opendata, state);
if (ret == -ESTALE)
d_drop(ctx->dentry);
nfs4_opendata_put(opendata);
return ret;
}
| 0 |
[
"CWE-787"
] |
linux
|
b4487b93545214a9db8cbf32e86411677b0cca21
| 264,835,609,958,504,900,000,000,000,000,000,000,000 | 15 |
nfs: Fix getxattr kernel panic and memory overflow
Move the buffer size check to decode_attr_security_label() before memcpy()
Only call memcpy() if the buffer is large enough
Fixes: aa9c2669626c ("NFS: Client implementation of Labeled-NFS")
Signed-off-by: Jeffrey Mitchell <[email protected]>
[Trond: clean up duplicate test of label->len != 0]
Signed-off-by: Trond Myklebust <[email protected]>
|
struct mallinfo nedpmallinfo(nedpool *p) THROWSPEC
{
int n;
struct mallinfo ret={0};
if(!p) { p=&syspool; if(!syspool.threads) InitPool(&syspool, 0, -1); }
for(n=0; p->m[n]; n++)
{
struct mallinfo t=mspace_mallinfo(p->m[n]);
ret.arena+=t.arena;
ret.ordblks+=t.ordblks;
ret.hblkhd+=t.hblkhd;
ret.usmblks+=t.usmblks;
ret.uordblks+=t.uordblks;
ret.fordblks+=t.fordblks;
ret.keepcost+=t.keepcost;
}
return ret;
}
| 0 |
[
"CWE-119",
"CWE-787"
] |
git
|
34fa79a6cde56d6d428ab0d3160cb094ebad3305
| 186,175,417,581,917,180,000,000,000,000,000,000,000 | 18 |
prefer memcpy to strcpy
When we already know the length of a string (e.g., because
we just malloc'd to fit it), it's nicer to use memcpy than
strcpy, as it makes it more obvious that we are not going to
overflow the buffer (because the size we pass matches the
size in the allocation).
This also eliminates calls to strcpy, which make auditing
the code base harder.
Signed-off-by: Jeff King <[email protected]>
Signed-off-by: Junio C Hamano <[email protected]>
|
static int ntop_similar_host_activity(lua_State* vm) {
NetworkInterfaceView *ntop_interface = getCurrentInterface(vm);
char *host_ip;
u_int16_t vlan_id = 0;
char buf[64];
ntop->getTrace()->traceEvent(TRACE_INFO, "%s() called", __FUNCTION__);
if(ntop_lua_check(vm, __FUNCTION__, 1, LUA_TSTRING)) return(CONST_LUA_ERROR);
get_host_vlan_info((char*)lua_tostring(vm, 1), &host_ip, &vlan_id, buf, sizeof(buf));
/* Optional VLAN id */
if(lua_type(vm, 2) == LUA_TNUMBER) vlan_id = (u_int16_t)lua_tonumber(vm, 2);
if((!ntop_interface) || !ntop_interface->similarHostActivity(vm, get_allowed_nets(vm), host_ip, vlan_id))
return(CONST_LUA_ERROR);
else
return(CONST_LUA_OK);
}
| 0 |
[
"CWE-254"
] |
ntopng
|
2e0620be3410f5e22c9aa47e261bc5a12be692c6
| 46,777,882,262,476,210,000,000,000,000,000,000,000 | 19 |
Added security fix to avoid escalating privileges to non-privileged users
Many thanks to Dolev Farhi for reporting it
|
static void __dmar_remove_one_dev_info(struct device_domain_info *info)
{
struct intel_iommu *iommu;
unsigned long flags;
assert_spin_locked(&device_domain_lock);
if (WARN_ON(!info))
return;
iommu = info->iommu;
if (info->dev) {
if (dev_is_pci(info->dev) && sm_supported(iommu))
intel_pasid_tear_down_entry(iommu, info->dev,
PASID_RID2PASID);
iommu_disable_dev_iotlb(info);
domain_context_clear(iommu, info->dev);
intel_pasid_free_table(info->dev);
}
unlink_domain_info(info);
spin_lock_irqsave(&iommu->lock, flags);
domain_detach_iommu(info->domain, iommu);
spin_unlock_irqrestore(&iommu->lock, flags);
free_devinfo_mem(info);
}
| 0 |
[] |
linux
|
d8b8591054575f33237556c32762d54e30774d28
| 117,368,283,774,026,500,000,000,000,000,000,000,000 | 30 |
iommu/vt-d: Disable ATS support on untrusted devices
Commit fb58fdcd295b9 ("iommu/vt-d: Do not enable ATS for untrusted
devices") disables ATS support on the devices which have been marked
as untrusted. Unfortunately this is not enough to fix the DMA attack
vulnerabiltiies because IOMMU driver allows translated requests as
long as a device advertises the ATS capability. Hence a malicious
peripheral device could use this to bypass IOMMU.
This disables the ATS support on untrusted devices by clearing the
internal per-device ATS mark. As the result, IOMMU driver will block
any translated requests from any device marked as untrusted.
Cc: Jacob Pan <[email protected]>
Cc: Mika Westerberg <[email protected]>
Suggested-by: Kevin Tian <[email protected]>
Suggested-by: Ashok Raj <[email protected]>
Fixes: fb58fdcd295b9 ("iommu/vt-d: Do not enable ATS for untrusted devices")
Signed-off-by: Lu Baolu <[email protected]>
Signed-off-by: Joerg Roedel <[email protected]>
|
S_edit_distance(const UV* src,
const UV* tgt,
const STRLEN x, /* length of src[] */
const STRLEN y, /* length of tgt[] */
const SSize_t maxDistance
)
{
item *head = NULL;
UV swapCount,swapScore,targetCharCount,i,j;
UV *scores;
UV score_ceil = x + y;
PERL_ARGS_ASSERT_EDIT_DISTANCE;
/* intialize matrix start values */
Newxz(scores, ( (x + 2) * (y + 2)), UV);
scores[0] = score_ceil;
scores[1 * (y + 2) + 0] = score_ceil;
scores[0 * (y + 2) + 1] = score_ceil;
scores[1 * (y + 2) + 1] = 0;
head = uniquePush(uniquePush(head,src[0]),tgt[0]);
/* work loops */
/* i = src index */
/* j = tgt index */
for (i=1;i<=x;i++) {
if (i < x)
head = uniquePush(head,src[i]);
scores[(i+1) * (y + 2) + 1] = i;
scores[(i+1) * (y + 2) + 0] = score_ceil;
swapCount = 0;
for (j=1;j<=y;j++) {
if (i == 1) {
if(j < y)
head = uniquePush(head,tgt[j]);
scores[1 * (y + 2) + (j + 1)] = j;
scores[0 * (y + 2) + (j + 1)] = score_ceil;
}
targetCharCount = find(head,tgt[j-1])->value;
swapScore = scores[targetCharCount * (y + 2) + swapCount] + i - targetCharCount - 1 + j - swapCount;
if (src[i-1] != tgt[j-1]){
scores[(i+1) * (y + 2) + (j + 1)] = MIN(swapScore,(MIN(scores[i * (y + 2) + j], MIN(scores[(i+1) * (y + 2) + j], scores[i * (y + 2) + (j + 1)])) + 1));
}
else {
swapCount = j;
scores[(i+1) * (y + 2) + (j + 1)] = MIN(scores[i * (y + 2) + j], swapScore);
}
}
find(head,src[i-1])->value = i;
}
{
IV score = scores[(x+1) * (y + 2) + (y + 1)];
dict_free(head);
Safefree(scores);
return (maxDistance != 0 && maxDistance < score)?(-1):score;
}
}
| 0 |
[
"CWE-125"
] |
perl5
|
43b2f4ef399e2fd7240b4eeb0658686ad95f8e62
| 330,970,365,130,305,000,000,000,000,000,000,000,000 | 62 |
regcomp.c: Convert some strchr to memchr
This allows things to work properly in the face of embedded NULs.
See the branch merge message for more information.
|
static VirtioNetRscChain *virtio_net_rsc_lookup_chain(VirtIONet *n,
NetClientState *nc,
uint16_t proto)
{
VirtioNetRscChain *chain;
if ((proto != (uint16_t)ETH_P_IP) && (proto != (uint16_t)ETH_P_IPV6)) {
return NULL;
}
QTAILQ_FOREACH(chain, &n->rsc_chains, next) {
if (chain->proto == proto) {
return chain;
}
}
chain = g_malloc(sizeof(*chain));
chain->n = n;
chain->proto = proto;
if (proto == (uint16_t)ETH_P_IP) {
chain->max_payload = VIRTIO_NET_MAX_IP4_PAYLOAD;
chain->gso_type = VIRTIO_NET_HDR_GSO_TCPV4;
} else {
chain->max_payload = VIRTIO_NET_MAX_IP6_PAYLOAD;
chain->gso_type = VIRTIO_NET_HDR_GSO_TCPV6;
}
chain->drain_timer = timer_new_ns(QEMU_CLOCK_HOST,
virtio_net_rsc_purge, chain);
memset(&chain->stat, 0, sizeof(chain->stat));
QTAILQ_INIT(&chain->buffers);
QTAILQ_INSERT_TAIL(&n->rsc_chains, chain, next);
return chain;
}
| 0 |
[
"CWE-703"
] |
qemu
|
abe300d9d894f7138e1af7c8e9c88c04bfe98b37
| 115,282,812,654,953,020,000,000,000,000,000,000,000 | 35 |
virtio-net: fix map leaking on error during receive
Commit bedd7e93d0196 ("virtio-net: fix use after unmap/free for sg")
tries to fix the use after free of the sg by caching the virtqueue
elements in an array and unmap them at once after receiving the
packets, But it forgot to unmap the cached elements on error which
will lead to leaking of mapping and other unexpected results.
Fixing this by detaching the cached elements on error. This addresses
CVE-2022-26353.
Reported-by: Victor Tom <[email protected]>
Cc: [email protected]
Fixes: CVE-2022-26353
Fixes: bedd7e93d0196 ("virtio-net: fix use after unmap/free for sg")
Reviewed-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: Jason Wang <[email protected]>
|
sraClipRect2(int *x, int *y, int *x2, int *y2,
int cx, int cy, int cx2, int cy2) {
if (*x < cx)
*x = cx;
if (*y < cy)
*y = cy;
if (*x >= cx2)
*x = cx2-1;
if (*y >= cy2)
*y = cy2-1;
if (*x2 <= cx)
*x2 = cx+1;
if (*y2 <= cy)
*y2 = cy+1;
if (*x2 > cx2)
*x2 = cx2;
if (*y2 > cy2)
*y2 = cy2;
return (*x2>*x) && (*y2>*y);
}
| 0 |
[
"CWE-476"
] |
libvncserver
|
38e98ee61d74f5f5ab4aa4c77146faad1962d6d0
| 253,095,548,307,648,770,000,000,000,000,000,000,000 | 20 |
libvncserver: add missing NULL pointer checks
|
smtp_report_tx_reset(struct smtp_session *s, uint32_t msgid)
{
if (! SESSION_FILTERED(s))
return;
report_smtp_tx_reset("smtp-in", s->id, msgid);
}
| 0 |
[
"CWE-78",
"CWE-252"
] |
src
|
9dcfda045474d8903224d175907bfc29761dcb45
| 238,417,734,484,542,100,000,000,000,000,000,000,000 | 7 |
Fix a security vulnerability discovered by Qualys which can lead to a
privileges escalation on mbox deliveries and unprivileged code execution
on lmtp deliveries, due to a logic issue causing a sanity check to be
missed.
ok eric@, millert@
|
void brcmf_rx_frame(struct device *dev, struct sk_buff *skb, bool handle_event)
{
struct brcmf_if *ifp;
struct brcmf_bus *bus_if = dev_get_drvdata(dev);
struct brcmf_pub *drvr = bus_if->drvr;
brcmf_dbg(DATA, "Enter: %s: rxp=%p\n", dev_name(dev), skb);
if (brcmf_rx_hdrpull(drvr, skb, &ifp))
return;
if (brcmf_proto_is_reorder_skb(skb)) {
brcmf_proto_rxreorder(ifp, skb);
} else {
/* Process special event packets */
if (handle_event)
brcmf_fweh_process_skb(ifp->drvr, skb);
brcmf_netif_rx(ifp, skb);
}
}
| 1 |
[
"CWE-20"
] |
linux
|
a4176ec356c73a46c07c181c6d04039fafa34a9f
| 271,582,910,145,944,160,000,000,000,000,000,000,000 | 21 |
brcmfmac: add subtype check for event handling in data path
For USB there is no separate channel being used to pass events
from firmware to the host driver and as such are passed over the
data path. In order to detect mock event messages an additional
check is needed on event subtype. This check is added conditionally
using unlikely() keyword.
Reviewed-by: Hante Meuleman <[email protected]>
Reviewed-by: Pieter-Paul Giesberts <[email protected]>
Reviewed-by: Franky Lin <[email protected]>
Signed-off-by: Arend van Spriel <[email protected]>
Signed-off-by: Kalle Valo <[email protected]>
|
xmlFAParseCharRange(xmlRegParserCtxtPtr ctxt) {
int cur, len;
int start = -1;
int end = -1;
if (CUR == '\0') {
ERROR("Expecting ']'");
return;
}
cur = CUR;
if (cur == '\\') {
NEXT;
cur = CUR;
switch (cur) {
case 'n': start = 0xA; break;
case 'r': start = 0xD; break;
case 't': start = 0x9; break;
case '\\': case '|': case '.': case '-': case '^': case '?':
case '*': case '+': case '{': case '}': case '(': case ')':
case '[': case ']':
start = cur; break;
default:
ERROR("Invalid escape value");
return;
}
end = start;
len = 1;
} else if ((cur != 0x5B) && (cur != 0x5D)) {
end = start = CUR_SCHAR(ctxt->cur, len);
} else {
ERROR("Expecting a char range");
return;
}
/*
* Since we are "inside" a range, we can assume ctxt->cur is past
* the start of ctxt->string, and PREV should be safe
*/
if ((start == '-') && (NXT(1) != ']') && (PREV != '[') && (PREV != '^')) {
NEXTL(len);
return;
}
NEXTL(len);
cur = CUR;
if ((cur != '-') || (NXT(1) == ']')) {
xmlRegAtomAddRange(ctxt, ctxt->atom, ctxt->neg,
XML_REGEXP_CHARVAL, start, end, NULL);
return;
}
NEXT;
cur = CUR;
if (cur == '\\') {
NEXT;
cur = CUR;
switch (cur) {
case 'n': end = 0xA; break;
case 'r': end = 0xD; break;
case 't': end = 0x9; break;
case '\\': case '|': case '.': case '-': case '^': case '?':
case '*': case '+': case '{': case '}': case '(': case ')':
case '[': case ']':
end = cur; break;
default:
ERROR("Invalid escape value");
return;
}
len = 1;
} else if ((cur != 0x5B) && (cur != 0x5D)) {
end = CUR_SCHAR(ctxt->cur, len);
} else {
ERROR("Expecting the end of a char range");
return;
}
NEXTL(len);
/* TODO check that the values are acceptable character ranges for XML */
if (end < start) {
ERROR("End of range is before start of range");
} else {
xmlRegAtomAddRange(ctxt, ctxt->atom, ctxt->neg,
XML_REGEXP_CHARVAL, start, end, NULL);
}
return;
}
| 1 |
[
"CWE-119"
] |
libxml2
|
cbb271655cadeb8dbb258a64701d9a3a0c4835b4
| 196,571,993,590,706,900,000,000,000,000,000,000,000 | 83 |
Bug 757711: heap-buffer-overflow in xmlFAParsePosCharGroup <https://bugzilla.gnome.org/show_bug.cgi?id=757711>
* xmlregexp.c:
(xmlFAParseCharRange): Only advance to the next character if
there is no error. Advancing to the next character in case of
an error while parsing regexp leads to an out of bounds access.
|
SYSCALL_DEFINE2(pipe2, int __user *, fildes, int, flags)
{
return do_pipe2(fildes, flags);
}
| 0 |
[
"CWE-362"
] |
linux
|
189b0ddc245139af81198d1a3637cac74f96e13a
| 27,237,274,068,113,868,000,000,000,000,000,000,000 | 4 |
pipe: Fix missing lock in pipe_resize_ring()
pipe_resize_ring() needs to take the pipe->rd_wait.lock spinlock to
prevent post_one_notification() from trying to insert into the ring
whilst the ring is being replaced.
The occupancy check must be done after the lock is taken, and the lock
must be taken after the new ring is allocated.
The bug can lead to an oops looking something like:
BUG: KASAN: use-after-free in post_one_notification.isra.0+0x62e/0x840
Read of size 4 at addr ffff88801cc72a70 by task poc/27196
...
Call Trace:
post_one_notification.isra.0+0x62e/0x840
__post_watch_notification+0x3b7/0x650
key_create_or_update+0xb8b/0xd20
__do_sys_add_key+0x175/0x340
__x64_sys_add_key+0xbe/0x140
do_syscall_64+0x5c/0xc0
entry_SYSCALL_64_after_hwframe+0x44/0xae
Reported by Selim Enes Karaduman @Enesdex working with Trend Micro Zero
Day Initiative.
Fixes: c73be61cede5 ("pipe: Add general notification queue support")
Reported-by: [email protected] # ZDI-CAN-17291
Signed-off-by: David Howells <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
|
apply_cmdmod(cmdmod_T *cmod)
{
#ifdef HAVE_SANDBOX
if ((cmod->cmod_flags & CMOD_SANDBOX) && !cmod->cmod_did_sandbox)
{
++sandbox;
cmod->cmod_did_sandbox = TRUE;
}
#endif
if (cmod->cmod_verbose > 0)
{
if (cmod->cmod_verbose_save == 0)
cmod->cmod_verbose_save = p_verbose + 1;
p_verbose = cmod->cmod_verbose;
}
if ((cmod->cmod_flags & (CMOD_SILENT | CMOD_UNSILENT))
&& cmod->cmod_save_msg_silent == 0)
{
cmod->cmod_save_msg_silent = msg_silent + 1;
cmod->cmod_save_msg_scroll = msg_scroll;
}
if (cmod->cmod_flags & CMOD_SILENT)
++msg_silent;
if (cmod->cmod_flags & CMOD_UNSILENT)
msg_silent = 0;
if (cmod->cmod_flags & CMOD_ERRSILENT)
{
++emsg_silent;
++cmod->cmod_did_esilent;
}
if ((cmod->cmod_flags & CMOD_NOAUTOCMD) && cmod->cmod_save_ei == NULL)
{
// Set 'eventignore' to "all".
// First save the existing option value for restoring it later.
cmod->cmod_save_ei = vim_strsave(p_ei);
set_string_option_direct((char_u *)"ei", -1,
(char_u *)"all", OPT_FREE, SID_NONE);
}
}
| 0 |
[
"CWE-122"
] |
vim
|
35a319b77f897744eec1155b736e9372c9c5575f
| 166,058,179,750,195,700,000,000,000,000,000,000,000 | 42 |
patch 8.2.3489: ml_get error after search with range
Problem: ml_get error after search with range.
Solution: Limit the line number to the buffer line count.
|
int tipc_crypto_key_init(struct tipc_crypto *c, struct tipc_aead_key *ukey,
u8 mode, bool master_key)
{
struct tipc_aead *aead = NULL;
int rc = 0;
/* Initiate with the new user key */
rc = tipc_aead_init(&aead, ukey, mode);
/* Attach it to the crypto */
if (likely(!rc)) {
rc = tipc_crypto_key_attach(c, aead, 0, master_key);
if (rc < 0)
tipc_aead_free(&aead->rcu);
}
return rc;
}
| 0 |
[
"CWE-20"
] |
linux
|
fa40d9734a57bcbfa79a280189799f76c88f7bb0
| 56,980,621,520,606,860,000,000,000,000,000,000,000 | 18 |
tipc: fix size validations for the MSG_CRYPTO type
The function tipc_crypto_key_rcv is used to parse MSG_CRYPTO messages
to receive keys from other nodes in the cluster in order to decrypt any
further messages from them.
This patch verifies that any supplied sizes in the message body are
valid for the received message.
Fixes: 1ef6f7c9390f ("tipc: add automatic session key exchange")
Signed-off-by: Max VA <[email protected]>
Acked-by: Ying Xue <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Acked-by: Jon Maloy <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
|
Load_data_outvar *get_load_data_outvar()
{
return this;
}
| 0 |
[
"CWE-617"
] |
server
|
2e7891080667c59ac80f788eef4d59d447595772
| 113,894,527,382,861,270,000,000,000,000,000,000,000 | 4 |
MDEV-25635 Assertion failure when pushing from HAVING into WHERE of view
This bug could manifest itself after pushing a where condition over a
mergeable derived table / view / CTE DT into a grouping view / derived
table / CTE V whose item list contained set functions with constant
arguments such as MIN(2), SUM(1) etc. In such cases the field references
used in the condition pushed into the view V that correspond set functions
are wrapped into Item_direct_view_ref wrappers. Due to a wrong implementation
of the virtual method const_item() for the class Item_direct_view_ref the
wrapped set functions with constant arguments could be erroneously taken
for constant items. This could lead to a wrong result set returned by the
main select query in 10.2. In 10.4 where a possibility of pushing condition
from HAVING into WHERE had been added this could cause a crash.
Approved by Sergey Petrunya <[email protected]>
|
fr_clipboard_get (GtkClipboard *clipboard,
GtkSelectionData *selection_data,
guint info,
gpointer user_data_or_owner)
{
FrWindow *window = user_data_or_owner;
char *data;
if (gtk_selection_data_get_target (selection_data) != FR_SPECIAL_URI_LIST)
return;
data = get_selection_data_from_clipboard_data (window, window->priv->copy_data);
if (data != NULL) {
gtk_selection_data_set (selection_data,
gtk_selection_data_get_target (selection_data),
8,
(guchar *) data,
strlen (data));
g_free (data);
}
}
| 0 |
[
"CWE-22"
] |
file-roller
|
b147281293a8307808475e102a14857055f81631
| 128,195,403,340,598,900,000,000,000,000,000,000,000 | 21 |
libarchive: sanitize filenames before extracting
|
static int ehci_state_fetchsitd(EHCIState *ehci, int async)
{
uint32_t entry;
EHCIsitd sitd;
assert(!async);
entry = ehci_get_fetch_addr(ehci, async);
if (get_dwords(ehci, NLPTR_GET(entry), (uint32_t *)&sitd,
sizeof(EHCIsitd) >> 2) < 0) {
return 0;
}
ehci_trace_sitd(ehci, entry, &sitd);
if (!(sitd.results & SITD_RESULTS_ACTIVE)) {
/* siTD is not active, nothing to do */;
} else {
/* TODO: split transfers are not implemented */
fprintf(stderr, "WARNING: Skipping active siTD\n");
}
ehci_set_fetch_addr(ehci, async, sitd.next);
ehci_set_state(ehci, async, EST_FETCHENTRY);
return 1;
}
| 0 |
[] |
qemu
|
791f97758e223de3290592d169f8e6339c281714
| 205,342,562,555,129,670,000,000,000,000,000,000,000 | 25 |
usb: ehci: fix memory leak in ehci_init_transfer
In ehci_init_transfer function, if the 'cpage' is bigger than 4,
it doesn't free the 'p->sgl' once allocated previously thus leading
a memory leak issue. This patch avoid this.
Signed-off-by: Li Qiang <[email protected]>
Message-id: [email protected]
Signed-off-by: Gerd Hoffmann <[email protected]>
|
off_t enc_untrusted_lseek(int fd, off_t offset, int whence) {
return EnsureInitializedAndDispatchSyscall(asylo::system_call::kSYS_lseek, fd,
offset, whence);
}
| 0 |
[
"CWE-125"
] |
asylo
|
b1d120a2c7d7446d2cc58d517e20a1b184b82200
| 161,553,316,585,450,470,000,000,000,000,000,000,000 | 4 |
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 EC_GROUP_set_curve_GFp(EC_GROUP *group, const BIGNUM *p, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx)
{
if (group->meth->group_set_curve == 0)
{
ECerr(EC_F_EC_GROUP_SET_CURVE_GFP, ERR_R_SHOULD_NOT_HAVE_BEEN_CALLED);
return 0;
}
return group->meth->group_set_curve(group, p, a, b, ctx);
}
| 0 |
[
"CWE-320"
] |
openssl
|
8aed2a7548362e88e84a7feb795a3a97e8395008
| 263,346,785,891,699,900,000,000,000,000,000,000,000 | 9 |
Reserve option to use BN_mod_exp_mont_consttime in ECDSA.
Submitted by Shay Gueron, Intel Corp.
RT: 3149
Reviewed-by: Rich Salz <[email protected]>
(cherry picked from commit f54be179aa4cbbd944728771d7d59ed588158a12)
|
xmlGetMaxOccurs(xmlSchemaParserCtxtPtr ctxt, xmlNodePtr node,
int min, int max, int def, const char *expected)
{
const xmlChar *val, *cur;
int ret = 0;
xmlAttrPtr attr;
attr = xmlSchemaGetPropNode(node, "maxOccurs");
if (attr == NULL)
return (def);
val = xmlSchemaGetNodeContent(ctxt, (xmlNodePtr) attr);
if (xmlStrEqual(val, (const xmlChar *) "unbounded")) {
if (max != UNBOUNDED) {
xmlSchemaPSimpleTypeErr(ctxt,
XML_SCHEMAP_S4S_ATTR_INVALID_VALUE,
/* XML_SCHEMAP_INVALID_MINOCCURS, */
NULL, (xmlNodePtr) attr, NULL, expected,
val, NULL, NULL, NULL);
return (def);
} else
return (UNBOUNDED); /* encoding it with -1 might be another option */
}
cur = val;
while (IS_BLANK_CH(*cur))
cur++;
if (*cur == 0) {
xmlSchemaPSimpleTypeErr(ctxt,
XML_SCHEMAP_S4S_ATTR_INVALID_VALUE,
/* XML_SCHEMAP_INVALID_MINOCCURS, */
NULL, (xmlNodePtr) attr, NULL, expected,
val, NULL, NULL, NULL);
return (def);
}
while ((*cur >= '0') && (*cur <= '9')) {
ret = ret * 10 + (*cur - '0');
cur++;
}
while (IS_BLANK_CH(*cur))
cur++;
/*
* TODO: Restrict the maximal value to Integer.
*/
if ((*cur != 0) || (ret < min) || ((max != -1) && (ret > max))) {
xmlSchemaPSimpleTypeErr(ctxt,
XML_SCHEMAP_S4S_ATTR_INVALID_VALUE,
/* XML_SCHEMAP_INVALID_MINOCCURS, */
NULL, (xmlNodePtr) attr, NULL, expected,
val, NULL, NULL, NULL);
return (def);
}
return (ret);
}
| 0 |
[
"CWE-134"
] |
libxml2
|
4472c3a5a5b516aaf59b89be602fbce52756c3e9
| 305,243,997,853,470,520,000,000,000,000,000,000,000 | 54 |
Fix some format string warnings with possible format string vulnerability
For https://bugzilla.gnome.org/show_bug.cgi?id=761029
Decorate every method in libxml2 with the appropriate
LIBXML_ATTR_FORMAT(fmt,args) macro and add some cleanups
following the reports.
|
int ncp_get_directory_info(struct ncp_server* server, __u8 n,
struct ncp_volume_info* target) {
int result;
int len;
ncp_init_request_s(server, 45);
ncp_add_byte(server, n);
if ((result = ncp_request(server, 22)) != 0) {
goto out;
}
target->total_blocks = ncp_reply_dword_lh(server, 0);
target->free_blocks = ncp_reply_dword_lh(server, 4);
target->purgeable_blocks = 0;
target->not_yet_purgeable_blocks = 0;
target->total_dir_entries = ncp_reply_dword_lh(server, 8);
target->available_dir_entries = ncp_reply_dword_lh(server, 12);
target->sectors_per_block = ncp_reply_byte(server, 20);
memset(&(target->volume_name), 0, sizeof(target->volume_name));
result = -EIO;
len = ncp_reply_byte(server, 21);
if (len > NCP_VOLNAME_LEN) {
ncp_dbg(1, "volume name too long: %d\n", len);
goto out;
}
memcpy(&(target->volume_name), ncp_reply_data(server, 22), len);
result = 0;
out:
ncp_unlock_server(server);
return result;
}
| 0 |
[
"CWE-119"
] |
staging
|
4c41aa24baa4ed338241d05494f2c595c885af8f
| 84,215,624,838,807,695,000,000,000,000,000,000,000 | 33 |
staging: ncpfs: memory corruption in ncp_read_kernel()
If the server is malicious then *bytes_read could be larger than the
size of the "target" buffer. It would lead to memory corruption when we
do the memcpy().
Reported-by: Dr Silvio Cesare of InfoSect <Silvio Cesare <[email protected]>
Signed-off-by: Dan Carpenter <[email protected]>
Cc: stable <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
|
dirserv_have_any_microdesc(const smartlist_t *fps)
{
microdesc_cache_t *cache = get_microdesc_cache();
SMARTLIST_FOREACH(fps, const char *, fp,
if (microdesc_cache_lookup_by_digest256(cache, fp))
return 1);
return 0;
}
| 0 |
[
"CWE-264"
] |
tor
|
00fffbc1a15e2696a89c721d0c94dc333ff419ef
| 273,859,810,000,047,950,000,000,000,000,000,000,000 | 8 |
Don't give the Guard flag to relays without the CVE-2011-2768 fix
|
cib_ccm_msg_callback(oc_ed_t event, void *cookie, size_t size, const void *data)
{
gboolean update_id = FALSE;
const oc_ev_membership_t *membership = data;
CRM_ASSERT(membership != NULL);
crm_info("Processing CCM event=%s (id=%d)", ccm_event_name(event), membership->m_instance);
if (current_instance > membership->m_instance) {
crm_err("Membership instance ID went backwards! %d->%d",
current_instance, membership->m_instance);
CRM_ASSERT(current_instance <= membership->m_instance);
}
switch (event) {
case OC_EV_MS_NEW_MEMBERSHIP:
case OC_EV_MS_INVALID:
update_id = TRUE;
break;
case OC_EV_MS_PRIMARY_RESTORED:
update_id = TRUE;
break;
case OC_EV_MS_NOT_PRIMARY:
crm_trace("Ignoring transitional CCM event: %s", ccm_event_name(event));
break;
case OC_EV_MS_EVICTED:
crm_err("Evicted from CCM: %s", ccm_event_name(event));
break;
default:
crm_err("Unknown CCM event: %d", event);
}
if (update_id) {
unsigned int lpc = 0;
CRM_CHECK(membership != NULL, return);
current_instance = membership->m_instance;
for (lpc = 0; lpc < membership->m_n_out; lpc++) {
crm_update_ccm_node(membership, lpc + membership->m_out_idx, CRM_NODE_LOST,
current_instance);
}
for (lpc = 0; lpc < membership->m_n_member; lpc++) {
crm_update_ccm_node(membership, lpc + membership->m_memb_idx, CRM_NODE_ACTIVE,
current_instance);
}
}
if (ccm_api_callback_done == NULL) {
ccm_api_callback_done =
find_library_function(&ccm_library, CCM_LIBRARY, "oc_ev_callback_done", 1);
}
(*ccm_api_callback_done) (cookie);
return;
}
| 0 |
[
"CWE-399"
] |
pacemaker
|
564f7cc2a51dcd2f28ab12a13394f31be5aa3c93
| 301,951,682,564,682,050,000,000,000,000,000,000,000 | 58 |
High: core: Internal tls api improvements for reuse with future LRMD tls backend.
|
onig_parse_tree(Node** root, const UChar* pattern, const UChar* end,
regex_t* reg, ScanEnv* env)
{
int r;
UChar* p;
#ifdef USE_CALLOUT
RegexExt* ext;
#endif
names_clear(reg);
scan_env_clear(env);
env->options = reg->options;
env->case_fold_flag = reg->case_fold_flag;
env->enc = reg->enc;
env->syntax = reg->syntax;
env->pattern = (UChar* )pattern;
env->pattern_end = (UChar* )end;
env->reg = reg;
*root = NULL;
if (! ONIGENC_IS_VALID_MBC_STRING(env->enc, pattern, end))
return ONIGERR_INVALID_WIDE_CHAR_VALUE;
p = (UChar* )pattern;
r = parse_regexp(root, &p, (UChar* )end, env);
#ifdef USE_CALL
if (r != 0) return r;
if (env->has_call_zero != 0) {
Node* zero_node;
r = make_call_zero_body(*root, env, &zero_node);
if (r != 0) return r;
*root = zero_node;
}
#endif
reg->num_mem = env->num_mem;
#ifdef USE_CALLOUT
ext = reg->extp;
if (IS_NOT_NULL(ext) && ext->callout_num > 0) {
r = setup_ext_callout_list_values(reg);
}
#endif
return r;
}
| 0 |
[
"CWE-400",
"CWE-399",
"CWE-674"
] |
oniguruma
|
4097828d7cc87589864fecf452f2cd46c5f37180
| 194,609,602,944,492,660,000,000,000,000,000,000,000 | 51 |
fix #147: Stack Exhaustion Problem caused by some parsing functions in regcomp.c making recursive calls to themselves.
|
static void platform_drv_shutdown(struct device *_dev)
{
struct platform_driver *drv = to_platform_driver(_dev->driver);
struct platform_device *dev = to_platform_device(_dev);
if (drv->shutdown)
drv->shutdown(dev);
}
| 0 |
[
"CWE-362",
"CWE-284"
] |
linux
|
6265539776a0810b7ce6398c27866ddb9c6bd154
| 315,983,035,548,186,730,000,000,000,000,000,000,000 | 8 |
driver core: platform: fix race condition with driver_override
The driver_override implementation is susceptible to race condition when
different threads are reading vs storing a different driver override.
Add locking to avoid race condition.
Fixes: 3d713e0e382e ("driver core: platform: add device binding path 'driver_override'")
Cc: [email protected]
Signed-off-by: Adrian Salido <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
|
bool mysql_test_parse_for_slave(THD *thd, char *rawbuf, uint length)
{
LEX *lex= thd->lex;
bool error= 0;
DBUG_ENTER("mysql_test_parse_for_slave");
Parser_state parser_state;
if (!(error= parser_state.init(thd, rawbuf, length)))
{
lex_start(thd);
thd->reset_for_next_command();
if (!parse_sql(thd, & parser_state, NULL, true) &&
all_tables_not_ok(thd, lex->select_lex.table_list.first))
error= 1; /* Ignore question */
thd->end_statement();
}
thd->cleanup_after_query();
DBUG_RETURN(error);
}
| 0 |
[] |
server
|
ba4927e520190bbad763bb5260ae154f29a61231
| 142,447,705,563,062,760,000,000,000,000,000,000,000 | 20 |
MDEV-19398: Assertion `item1->type() == Item::FIELD_ITEM ...
Window Functions code tries to minimize the number of times it
needs to sort the select's resultset by finding "compatible"
OVER (PARTITION BY ... ORDER BY ...) clauses.
This employs compare_order_elements(). That function assumed that
the order expressions are Item_field-derived objects (that refer
to a temp.table). But this is not always the case: one can
construct queries order expressions are arbitrary item expressions.
Add handling for such expressions: sort them according to the window
specification they appeared in.
This means we cannot detect that two compatible PARTITION BY clauses
that use expressions can share the sorting step.
But at least we won't crash.
|
static SORT_KEY_BLOCKS *alloc_key_blocks(MI_CHECK *param, uint blocks,
uint buffer_length)
{
reg1 uint i;
SORT_KEY_BLOCKS *block;
DBUG_ENTER("alloc_key_blocks");
if (!(block=(SORT_KEY_BLOCKS*) my_malloc((sizeof(SORT_KEY_BLOCKS)+
buffer_length+IO_SIZE)*blocks,
MYF(0))))
{
mi_check_print_error(param,"Not enough memory for sort-key-blocks");
return(0);
}
for (i=0 ; i < blocks ; i++)
{
block[i].inited=0;
block[i].buff=(uchar*) (block+blocks)+(buffer_length+IO_SIZE)*i;
}
DBUG_RETURN(block);
} /* alloc_key_blocks */
| 0 |
[
"CWE-362"
] |
mysql-server
|
4e5473862e6852b0f3802b0cd0c6fa10b5253291
| 166,161,434,742,311,270,000,000,000,000,000,000,000 | 21 |
Bug#24388746: PRIVILEGE ESCALATION AND RACE CONDITION USING CREATE TABLE
During REPAIR TABLE of a MyISAM table, a temporary data file (.TMD)
is created. When repair finishes, this file is renamed to the original
.MYD file. The problem was that during this rename, we copied the
stats from the old file to the new file with chmod/chown. If a user
managed to replace the temporary file before chmod/chown was executed,
it was possible to get an arbitrary file with the privileges of the
mysql user.
This patch fixes the problem by not copying stats from the old
file to the new file. This is not needed as the new file was
created with the correct stats. This fix only changes server
behavior - external utilities such as myisamchk still does
chmod/chown.
No test case provided since the problem involves synchronization
with file system operations.
|
static uint8_t channel_pair_element(NeAACDecStruct *hDecoder, bitfile *ld,
uint8_t channels, uint8_t *tag)
{
ALIGN int16_t spec_data1[1024] = {0};
ALIGN int16_t spec_data2[1024] = {0};
element cpe = {0};
ic_stream *ics1 = &(cpe.ics1);
ic_stream *ics2 = &(cpe.ics2);
uint8_t result;
cpe.channel = channels;
cpe.paired_channel = channels+1;
cpe.element_instance_tag = (uint8_t)faad_getbits(ld, LEN_TAG
DEBUGVAR(1,39,"channel_pair_element(): element_instance_tag"));
*tag = cpe.element_instance_tag;
if ((cpe.common_window = faad_get1bit(ld
DEBUGVAR(1,40,"channel_pair_element(): common_window"))) & 1)
{
/* both channels have common ics information */
if ((result = ics_info(hDecoder, ics1, ld, cpe.common_window)) > 0)
return result;
ics1->ms_mask_present = (uint8_t)faad_getbits(ld, 2
DEBUGVAR(1,41,"channel_pair_element(): ms_mask_present"));
if (ics1->ms_mask_present == 3)
{
/* bitstream error */
return 32;
}
if (ics1->ms_mask_present == 1)
{
uint8_t g, sfb;
for (g = 0; g < ics1->num_window_groups; g++)
{
for (sfb = 0; sfb < ics1->max_sfb; sfb++)
{
ics1->ms_used[g][sfb] = faad_get1bit(ld
DEBUGVAR(1,42,"channel_pair_element(): faad_get1bit"));
}
}
}
#ifdef ERROR_RESILIENCE
if ((hDecoder->object_type >= ER_OBJECT_START) && (ics1->predictor_data_present))
{
if ((
#ifdef LTP_DEC
ics1->ltp.data_present =
#endif
faad_get1bit(ld DEBUGVAR(1,50,"channel_pair_element(): ltp.data_present"))) & 1)
{
#ifdef LTP_DEC
if ((result = ltp_data(hDecoder, ics1, &(ics1->ltp), ld)) > 0)
{
return result;
}
#else
return 26;
#endif
}
}
#endif
memcpy(ics2, ics1, sizeof(ic_stream));
} else {
ics1->ms_mask_present = 0;
}
if ((result = individual_channel_stream(hDecoder, &cpe, ld, ics1,
0, spec_data1)) > 0)
{
return result;
}
#ifdef ERROR_RESILIENCE
if (cpe.common_window && (hDecoder->object_type >= ER_OBJECT_START) &&
(ics1->predictor_data_present))
{
if ((
#ifdef LTP_DEC
ics1->ltp2.data_present =
#endif
faad_get1bit(ld DEBUGVAR(1,50,"channel_pair_element(): ltp.data_present"))) & 1)
{
#ifdef LTP_DEC
if ((result = ltp_data(hDecoder, ics1, &(ics1->ltp2), ld)) > 0)
{
return result;
}
#else
return 26;
#endif
}
}
#endif
if ((result = individual_channel_stream(hDecoder, &cpe, ld, ics2,
0, spec_data2)) > 0)
{
return result;
}
#ifdef SBR_DEC
/* check if next bitstream element is a fill element */
/* if so, read it now so SBR decoding can be done in case of a file with SBR */
if (faad_showbits(ld, LEN_SE_ID) == ID_FIL)
{
faad_flushbits(ld, LEN_SE_ID);
/* one sbr_info describes a channel_element not a channel! */
if ((result = fill_element(hDecoder, ld, hDecoder->drc, hDecoder->fr_ch_ele)) > 0)
{
return result;
}
}
#endif
/* noiseless coding is done, spectral reconstruction is done now */
if ((result = reconstruct_channel_pair(hDecoder, ics1, ics2, &cpe,
spec_data1, spec_data2)) > 0)
{
return result;
}
return 0;
}
| 0 |
[
"CWE-119",
"CWE-787"
] |
faad2
|
942c3e0aee748ea6fe97cb2c1aa5893225316174
| 135,802,193,814,216,600,000,000,000,000,000,000,000 | 128 |
Fix a couple buffer overflows
https://hackerone.com/reports/502816
https://hackerone.com/reports/507858
https://github.com/videolan/vlc/blob/master/contrib/src/faad2/faad2-fix-overflows.patch
|
void cluster_unintern(struct cluster_list *cluster)
{
if (cluster->refcnt)
cluster->refcnt--;
if (cluster->refcnt == 0) {
hash_release(cluster_hash, cluster);
cluster_free(cluster);
}
}
| 0 |
[
"CWE-20",
"CWE-436"
] |
frr
|
943d595a018e69b550db08cccba1d0778a86705a
| 59,214,677,665,201,960,000,000,000,000,000,000,000 | 10 |
bgpd: don't use BGP_ATTR_VNC(255) unless ENABLE_BGP_VNC_ATTR is defined
Signed-off-by: Lou Berger <[email protected]>
|
void nested_vmx_vmexit(struct kvm_vcpu *vcpu, u32 exit_reason,
u32 exit_intr_info, unsigned long exit_qualification)
{
struct vcpu_vmx *vmx = to_vmx(vcpu);
struct vmcs12 *vmcs12 = get_vmcs12(vcpu);
/* trying to cancel vmlaunch/vmresume is a bug */
WARN_ON_ONCE(vmx->nested.nested_run_pending);
leave_guest_mode(vcpu);
if (nested_cpu_has_preemption_timer(vmcs12))
hrtimer_cancel(&to_vmx(vcpu)->nested.preemption_timer);
if (vmcs12->cpu_based_vm_exec_control & CPU_BASED_USE_TSC_OFFSETING)
vcpu->arch.tsc_offset -= vmcs12->tsc_offset;
if (likely(!vmx->fail)) {
if (exit_reason == -1)
sync_vmcs12(vcpu, vmcs12);
else
prepare_vmcs12(vcpu, vmcs12, exit_reason, exit_intr_info,
exit_qualification);
/*
* Must happen outside of sync_vmcs12() as it will
* also be used to capture vmcs12 cache as part of
* capturing nVMX state for snapshot (migration).
*
* Otherwise, this flush will dirty guest memory at a
* point it is already assumed by user-space to be
* immutable.
*/
nested_flush_cached_shadow_vmcs12(vcpu, vmcs12);
} else {
/*
* The only expected VM-instruction error is "VM entry with
* invalid control field(s)." Anything else indicates a
* problem with L0. And we should never get here with a
* VMFail of any type if early consistency checks are enabled.
*/
WARN_ON_ONCE(vmcs_read32(VM_INSTRUCTION_ERROR) !=
VMXERR_ENTRY_INVALID_CONTROL_FIELD);
WARN_ON_ONCE(nested_early_check);
}
vmx_switch_vmcs(vcpu, &vmx->vmcs01);
/* Update any VMCS fields that might have changed while L2 ran */
vmcs_write32(VM_EXIT_MSR_LOAD_COUNT, vmx->msr_autoload.host.nr);
vmcs_write32(VM_ENTRY_MSR_LOAD_COUNT, vmx->msr_autoload.guest.nr);
vmcs_write64(TSC_OFFSET, vcpu->arch.tsc_offset);
if (kvm_has_tsc_control)
decache_tsc_multiplier(vmx);
if (vmx->nested.change_vmcs01_virtual_apic_mode) {
vmx->nested.change_vmcs01_virtual_apic_mode = false;
vmx_set_virtual_apic_mode(vcpu);
} else if (!nested_cpu_has_ept(vmcs12) &&
nested_cpu_has2(vmcs12,
SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES)) {
vmx_flush_tlb(vcpu, true);
}
/* Unpin physical memory we referred to in vmcs02 */
if (vmx->nested.apic_access_page) {
kvm_release_page_dirty(vmx->nested.apic_access_page);
vmx->nested.apic_access_page = NULL;
}
if (vmx->nested.virtual_apic_page) {
kvm_release_page_dirty(vmx->nested.virtual_apic_page);
vmx->nested.virtual_apic_page = NULL;
}
if (vmx->nested.pi_desc_page) {
kunmap(vmx->nested.pi_desc_page);
kvm_release_page_dirty(vmx->nested.pi_desc_page);
vmx->nested.pi_desc_page = NULL;
vmx->nested.pi_desc = NULL;
}
/*
* We are now running in L2, mmu_notifier will force to reload the
* page's hpa for L2 vmcs. Need to reload it for L1 before entering L1.
*/
kvm_make_request(KVM_REQ_APIC_PAGE_RELOAD, vcpu);
if ((exit_reason != -1) && (enable_shadow_vmcs || vmx->nested.hv_evmcs))
vmx->nested.need_vmcs12_sync = true;
/* in case we halted in L2 */
vcpu->arch.mp_state = KVM_MP_STATE_RUNNABLE;
if (likely(!vmx->fail)) {
/*
* TODO: SDM says that with acknowledge interrupt on
* exit, bit 31 of the VM-exit interrupt information
* (valid interrupt) is always set to 1 on
* EXIT_REASON_EXTERNAL_INTERRUPT, so we shouldn't
* need kvm_cpu_has_interrupt(). See the commit
* message for details.
*/
if (nested_exit_intr_ack_set(vcpu) &&
exit_reason == EXIT_REASON_EXTERNAL_INTERRUPT &&
kvm_cpu_has_interrupt(vcpu)) {
int irq = kvm_cpu_get_interrupt(vcpu);
WARN_ON(irq < 0);
vmcs12->vm_exit_intr_info = irq |
INTR_INFO_VALID_MASK | INTR_TYPE_EXT_INTR;
}
if (exit_reason != -1)
trace_kvm_nested_vmexit_inject(vmcs12->vm_exit_reason,
vmcs12->exit_qualification,
vmcs12->idt_vectoring_info_field,
vmcs12->vm_exit_intr_info,
vmcs12->vm_exit_intr_error_code,
KVM_ISA_VMX);
load_vmcs12_host_state(vcpu, vmcs12);
return;
}
/*
* After an early L2 VM-entry failure, we're now back
* in L1 which thinks it just finished a VMLAUNCH or
* VMRESUME instruction, so we need to set the failure
* flag and the VM-instruction error field of the VMCS
* accordingly, and skip the emulated instruction.
*/
(void)nested_vmx_failValid(vcpu, VMXERR_ENTRY_INVALID_CONTROL_FIELD);
/*
* Restore L1's host state to KVM's software model. We're here
* because a consistency check was caught by hardware, which
* means some amount of guest state has been propagated to KVM's
* model and needs to be unwound to the host's state.
*/
nested_vmx_restore_host_state(vcpu);
vmx->fail = 0;
}
| 0 |
[
"CWE-863"
] |
kvm
|
acff78477b9b4f26ecdf65733a4ed77fe837e9dc
| 49,744,348,699,105,230,000,000,000,000,000,000,000 | 143 |
KVM: x86: nVMX: close leak of L0's x2APIC MSRs (CVE-2019-3887)
The nested_vmx_prepare_msr_bitmap() function doesn't directly guard the
x2APIC MSR intercepts with the "virtualize x2APIC mode" MSR. As a
result, we discovered the potential for a buggy or malicious L1 to get
access to L0's x2APIC MSRs, via an L2, as follows.
1. L1 executes WRMSR(IA32_SPEC_CTRL, 1). This causes the spec_ctrl
variable, in nested_vmx_prepare_msr_bitmap() to become true.
2. L1 disables "virtualize x2APIC mode" in VMCS12.
3. L1 enables "APIC-register virtualization" in VMCS12.
Now, KVM will set VMCS02's x2APIC MSR intercepts from VMCS12, and then
set "virtualize x2APIC mode" to 0 in VMCS02. Oops.
This patch closes the leak by explicitly guarding VMCS02's x2APIC MSR
intercepts with VMCS12's "virtualize x2APIC mode" control.
The scenario outlined above and fix prescribed here, were verified with
a related patch in kvm-unit-tests titled "Add leak scenario to
virt_x2apic_mode_test".
Note, it looks like this issue may have been introduced inadvertently
during a merge---see 15303ba5d1cd.
Signed-off-by: Marc Orr <[email protected]>
Reviewed-by: Jim Mattson <[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
|
ct_error_string (long err)
{
switch (err)
{
case 0: return "okay";
case -1: return "invalid data";
case -8: return "ct error";
case -10: return "transmission error";
case -11: return "memory allocation error";
case -128: return "HTSI error";
default: return "unknown CT-API error";
}
}
| 0 |
[
"CWE-20"
] |
gnupg
|
2183683bd633818dd031b090b5530951de76f392
| 290,602,335,281,830,200,000,000,000,000,000,000,000 | 13 |
Use inline functions to convert buffer data to scalars.
* common/host2net.h (buf16_to_ulong, buf16_to_uint): New.
(buf16_to_ushort, buf16_to_u16): New.
(buf32_to_size_t, buf32_to_ulong, buf32_to_uint, buf32_to_u32): New.
--
Commit 91b826a38880fd8a989318585eb502582636ddd8 was not enough to
avoid all sign extension on shift problems. Hanno Böck found a case
with an invalid read due to this problem. To fix that once and for
all almost all uses of "<< 24" and "<< 8" are changed by this patch to
use an inline function from host2net.h.
Signed-off-by: Werner Koch <[email protected]>
|
winlink_stack_remove(struct winlink_stack *stack, struct winlink *wl)
{
struct winlink *wl2;
if (wl == NULL)
return;
TAILQ_FOREACH(wl2, stack, sentry) {
if (wl2 == wl) {
TAILQ_REMOVE(stack, wl, sentry);
return;
}
}
}
| 0 |
[] |
src
|
b32e1d34e10a0da806823f57f02a4ae6e93d756e
| 292,050,016,693,482,900,000,000,000,000,000,000,000 | 14 |
evbuffer_new and bufferevent_new can both fail (when malloc fails) and
return NULL. GitHub issue 1547.
|
static int vivid_fb_pan_display(struct fb_var_screeninfo *var, struct fb_info *info)
{
return 0;
}
| 0 |
[
"CWE-200"
] |
linux-next
|
eda98796aff0d9bf41094b06811f5def3b4c333c
| 100,650,961,489,204,040,000,000,000,000,000,000,000 | 4 |
[media] media/vivid-osd: fix info leak in ioctl
The vivid_fb_ioctl() code fails to initialize the 16 _reserved bytes of
struct fb_vblank after the ->hcount member. Add an explicit
memset(0) before filling the structure to avoid the info leak.
Signed-off-by: Salva Peiró <[email protected]>
Signed-off-by: Hans Verkuil <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
|
zzip_mem_disk_fdopen(int fd)
{
ZZIP_DISK *disk = zzip_disk_mmap(fd);
if (! disk)
{
debug2("can not open disk fd %i", fd);
return 0;
}
___ ZZIP_MEM_DISK *dir = zzip_mem_disk_new();
zzip_mem_disk_load(dir, disk);
return dir;
____;
}
| 1 |
[] |
zziplib
|
72ec933663f738d8e166979aa7fd5590b2104a07
| 36,708,080,456,019,545,000,000,000,000,000,000,000 | 13 |
need to check on endbuf for stored files #15
|
int ssl3_get_server_done(SSL *s)
{
int ok, ret = 0;
long n;
/* Second to last param should be very small, like 0 :-) */
n = s->method->ssl_get_message(s,
SSL3_ST_CR_SRVR_DONE_A,
SSL3_ST_CR_SRVR_DONE_B,
SSL3_MT_SERVER_DONE, 30, &ok);
if (!ok)
return ((int)n);
if (n > 0) {
/* should contain no data */
ssl3_send_alert(s, SSL3_AL_FATAL, SSL_AD_DECODE_ERROR);
SSLerr(SSL_F_SSL3_GET_SERVER_DONE, SSL_R_LENGTH_MISMATCH);
s->state = SSL_ST_ERR;
return -1;
}
ret = 1;
return (ret);
}
| 0 |
[
"CWE-310"
] |
openssl
|
63830384e90d9b36d2793d4891501ec024827433
| 63,530,359,408,585,540,000,000,000,000,000,000,000 | 23 |
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]>
|
char *mnt_fs_get_vfs_options_all(struct libmnt_fs *fs)
{
const struct libmnt_optmap *map = mnt_get_builtin_optmap(MNT_LINUX_MAP);
const struct libmnt_optmap *ent;
const char *opts = mnt_fs_get_options(fs);
char *result = NULL;
unsigned long flags = 0;
if (!opts || mnt_optstr_get_flags(opts, &flags, map))
return NULL;
for (ent = map ; ent && ent->name ; ent++){
if (ent->id & flags) { /* non-default value */
if (!(ent->mask & MNT_INVERT))
mnt_optstr_append_option(&result, ent->name, NULL);
else
continue;
} else if (ent->mask & MNT_INVERT)
mnt_optstr_append_option(&result, ent->name, NULL);
}
return result;
}
| 0 |
[
"CWE-552",
"CWE-703"
] |
util-linux
|
166e87368ae88bf31112a30e078cceae637f4cdb
| 42,903,738,322,395,460,000,000,000,000,000,000,000 | 23 |
libmount: remove support for deleted mount table entries
The "(deleted)" suffix has been originally used by kernel for deleted
mountpoints. Since kernel commit 9d4d65748a5ca26ea8650e50ba521295549bf4e3
(Dec 2014) kernel does not use this suffix for mount stuff in /proc at
all. Let's remove this support from libmount too.
Signed-off-by: Karel Zak <[email protected]>
|
static void call_trans2setfsinfo(connection_struct *conn,
struct smb_request *req,
char **pparams, int total_params,
char **ppdata, int total_data,
unsigned int max_data_bytes)
{
const struct loadparm_substitution *lp_sub =
loadparm_s3_global_substitution();
struct smbXsrv_connection *xconn = req->xconn;
char *pdata = *ppdata;
char *params = *pparams;
uint16_t info_level;
DEBUG(10,("call_trans2setfsinfo: for service [%s]\n",
lp_servicename(talloc_tos(), lp_sub, SNUM(conn))));
/* */
if (total_params < 4) {
DEBUG(0,("call_trans2setfsinfo: requires total_params(%d) >= 4 bytes!\n",
total_params));
reply_nterror(req, NT_STATUS_INVALID_PARAMETER);
return;
}
info_level = SVAL(params,2);
if (IS_IPC(conn)) {
if (info_level != SMB_REQUEST_TRANSPORT_ENCRYPTION &&
info_level != SMB_SET_CIFS_UNIX_INFO) {
DEBUG(0,("call_trans2setfsinfo: not an allowed "
"info level (0x%x) on IPC$.\n",
(unsigned int)info_level));
reply_nterror(req, NT_STATUS_ACCESS_DENIED);
return;
}
}
if (ENCRYPTION_REQUIRED(conn) && !req->encrypted) {
if (info_level != SMB_REQUEST_TRANSPORT_ENCRYPTION) {
DEBUG(0,("call_trans2setfsinfo: encryption required "
"and info level 0x%x sent.\n",
(unsigned int)info_level));
reply_nterror(req, NT_STATUS_ACCESS_DENIED);
return;
}
}
switch(info_level) {
case SMB_SET_CIFS_UNIX_INFO:
if (!lp_unix_extensions()) {
DEBUG(2,("call_trans2setfsinfo: "
"SMB_SET_CIFS_UNIX_INFO is invalid with "
"unix extensions off\n"));
reply_nterror(req,
NT_STATUS_INVALID_LEVEL);
return;
}
/* There should be 12 bytes of capabilities set. */
if (total_data < 12) {
reply_nterror(
req,
NT_STATUS_INVALID_PARAMETER);
return;
}
xconn->smb1.unix_info.client_major = SVAL(pdata,0);
xconn->smb1.unix_info.client_minor = SVAL(pdata,2);
xconn->smb1.unix_info.client_cap_low = IVAL(pdata,4);
xconn->smb1.unix_info.client_cap_high = IVAL(pdata,8);
/* Just print these values for now. */
DEBUG(10, ("call_trans2setfsinfo: set unix_info info. "
"major = %u, minor = %u cap_low = 0x%x, "
"cap_high = 0x%xn",
(unsigned int)xconn->
smb1.unix_info.client_major,
(unsigned int)xconn->
smb1.unix_info.client_minor,
(unsigned int)xconn->
smb1.unix_info.client_cap_low,
(unsigned int)xconn->
smb1.unix_info.client_cap_high));
/* Here is where we must switch to posix pathname processing... */
if (xconn->smb1.unix_info.client_cap_low & CIFS_UNIX_POSIX_PATHNAMES_CAP) {
lp_set_posix_pathnames();
mangle_change_to_posix();
}
if ((xconn->smb1.unix_info.client_cap_low & CIFS_UNIX_FCNTL_LOCKS_CAP) &&
!(xconn->smb1.unix_info.client_cap_low & CIFS_UNIX_POSIX_PATH_OPERATIONS_CAP)) {
/* Client that knows how to do posix locks,
* but not posix open/mkdir operations. Set a
* default type for read/write checks. */
lp_set_posix_default_cifsx_readwrite_locktype(POSIX_LOCK);
}
break;
case SMB_REQUEST_TRANSPORT_ENCRYPTION:
{
NTSTATUS status;
size_t param_len = 0;
size_t data_len = total_data;
if (!lp_unix_extensions()) {
reply_nterror(
req,
NT_STATUS_INVALID_LEVEL);
return;
}
if (lp_server_smb_encrypt(SNUM(conn)) ==
SMB_ENCRYPTION_OFF) {
reply_nterror(
req,
NT_STATUS_NOT_SUPPORTED);
return;
}
if (xconn->smb1.echo_handler.trusted_fde) {
DEBUG( 2,("call_trans2setfsinfo: "
"request transport encryption disabled"
"with 'fork echo handler = yes'\n"));
reply_nterror(
req,
NT_STATUS_NOT_SUPPORTED);
return;
}
DEBUG( 4,("call_trans2setfsinfo: "
"request transport encryption.\n"));
status = srv_request_encryption_setup(conn,
(unsigned char **)ppdata,
&data_len,
(unsigned char **)pparams,
¶m_len);
if (!NT_STATUS_EQUAL(status, NT_STATUS_MORE_PROCESSING_REQUIRED) &&
!NT_STATUS_IS_OK(status)) {
reply_nterror(req, status);
return;
}
send_trans2_replies(conn, req,
NT_STATUS_OK,
*pparams,
param_len,
*ppdata,
data_len,
max_data_bytes);
if (NT_STATUS_IS_OK(status)) {
/* Server-side transport
* encryption is now *on*. */
status = srv_encryption_start(conn);
if (!NT_STATUS_IS_OK(status)) {
char *reason = talloc_asprintf(talloc_tos(),
"Failure in setting "
"up encrypted transport: %s",
nt_errstr(status));
exit_server_cleanly(reason);
}
}
return;
}
case SMB_FS_QUOTA_INFORMATION:
{
NTSTATUS status;
DATA_BLOB qdata = {
.data = (uint8_t *)pdata,
.length = total_data
};
files_struct *fsp = NULL;
fsp = file_fsp(req, SVAL(params,0));
status = smb_set_fsquota(conn,
req,
fsp,
&qdata);
if (!NT_STATUS_IS_OK(status)) {
reply_nterror(req, status);
return;
}
break;
}
default:
DEBUG(3,("call_trans2setfsinfo: unknown level (0x%X) not implemented yet.\n",
info_level));
reply_nterror(req, NT_STATUS_INVALID_LEVEL);
return;
break;
}
/*
* sending this reply works fine,
* but I'm not sure it's the same
* like windows do...
* --metze
*/
reply_outbuf(req, 10, 0);
}
| 0 |
[
"CWE-787"
] |
samba
|
22b4091924977f6437b59627f33a8e6f02b41011
| 4,853,266,663,165,331,000,000,000,000,000,000,000 | 204 |
CVE-2021-44142: smbd: add Netatalk xattr used by vfs_fruit to the list of private Samba xattrs
This is an internal xattr that should not be user visible.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14914
Signed-off-by: Ralph Boehme <[email protected]>
Reviewed-by: Jeremy Allison <[email protected]>
|
static inline int security_inode_getsecurity(const struct inode *inode, const char *name, void **buffer, bool alloc)
{
return -EOPNOTSUPP;
}
| 0 |
[] |
linux-2.6
|
ee18d64c1f632043a02e6f5ba5e045bb26a5465f
| 293,504,869,468,623,100,000,000,000,000,000,000,000 | 4 |
KEYS: Add a keyctl to install a process's session keyring on its parent [try #6]
Add a keyctl to install a process's session keyring onto its parent. This
replaces the parent's session keyring. Because the COW credential code does
not permit one process to change another process's credentials directly, the
change is deferred until userspace next starts executing again. Normally this
will be after a wait*() syscall.
To support this, three new security hooks have been provided:
cred_alloc_blank() to allocate unset security creds, cred_transfer() to fill in
the blank security creds and key_session_to_parent() - which asks the LSM if
the process may replace its parent's session keyring.
The replacement may only happen if the process has the same ownership details
as its parent, and the process has LINK permission on the session keyring, and
the session keyring is owned by the process, and the LSM permits it.
Note that this requires alteration to each architecture's notify_resume path.
This has been done for all arches barring blackfin, m68k* and xtensa, all of
which need assembly alteration to support TIF_NOTIFY_RESUME. This allows the
replacement to be performed at the point the parent process resumes userspace
execution.
This allows the userspace AFS pioctl emulation to fully emulate newpag() and
the VIOCSETTOK and VIOCSETTOK2 pioctls, all of which require the ability to
alter the parent process's PAG membership. However, since kAFS doesn't use
PAGs per se, but rather dumps the keys into the session keyring, the session
keyring of the parent must be replaced if, for example, VIOCSETTOK is passed
the newpag flag.
This can be tested with the following program:
#include <stdio.h>
#include <stdlib.h>
#include <keyutils.h>
#define KEYCTL_SESSION_TO_PARENT 18
#define OSERROR(X, S) do { if ((long)(X) == -1) { perror(S); exit(1); } } while(0)
int main(int argc, char **argv)
{
key_serial_t keyring, key;
long ret;
keyring = keyctl_join_session_keyring(argv[1]);
OSERROR(keyring, "keyctl_join_session_keyring");
key = add_key("user", "a", "b", 1, keyring);
OSERROR(key, "add_key");
ret = keyctl(KEYCTL_SESSION_TO_PARENT);
OSERROR(ret, "KEYCTL_SESSION_TO_PARENT");
return 0;
}
Compiled and linked with -lkeyutils, you should see something like:
[dhowells@andromeda ~]$ keyctl show
Session Keyring
-3 --alswrv 4043 4043 keyring: _ses
355907932 --alswrv 4043 -1 \_ keyring: _uid.4043
[dhowells@andromeda ~]$ /tmp/newpag
[dhowells@andromeda ~]$ keyctl show
Session Keyring
-3 --alswrv 4043 4043 keyring: _ses
1055658746 --alswrv 4043 4043 \_ user: a
[dhowells@andromeda ~]$ /tmp/newpag hello
[dhowells@andromeda ~]$ keyctl show
Session Keyring
-3 --alswrv 4043 4043 keyring: hello
340417692 --alswrv 4043 4043 \_ user: a
Where the test program creates a new session keyring, sticks a user key named
'a' into it and then installs it on its parent.
Signed-off-by: David Howells <[email protected]>
Signed-off-by: James Morris <[email protected]>
|
void set_pfnblock_flags_mask(struct page *page, unsigned long flags,
unsigned long pfn,
unsigned long end_bitidx,
unsigned long mask)
{
unsigned long *bitmap;
unsigned long bitidx, word_bitidx;
unsigned long old_word, word;
BUILD_BUG_ON(NR_PAGEBLOCK_BITS != 4);
bitmap = get_pageblock_bitmap(page, pfn);
bitidx = pfn_to_bitidx(page, pfn);
word_bitidx = bitidx / BITS_PER_LONG;
bitidx &= (BITS_PER_LONG-1);
VM_BUG_ON_PAGE(!zone_spans_pfn(page_zone(page), pfn), page);
bitidx += end_bitidx;
mask <<= (BITS_PER_LONG - bitidx - 1);
flags <<= (BITS_PER_LONG - bitidx - 1);
word = READ_ONCE(bitmap[word_bitidx]);
for (;;) {
old_word = cmpxchg(&bitmap[word_bitidx], word, (word & ~mask) | flags);
if (word == old_word)
break;
word = old_word;
}
}
| 0 |
[] |
linux
|
400e22499dd92613821374c8c6c88c7225359980
| 190,512,676,998,026,600,000,000,000,000,000,000,000 | 30 |
mm: don't warn about allocations which stall for too long
Commit 63f53dea0c98 ("mm: warn about allocations which stall for too
long") was a great step for reducing possibility of silent hang up
problem caused by memory allocation stalls. But this commit reverts it,
for it is possible to trigger OOM lockup and/or soft lockups when many
threads concurrently called warn_alloc() (in order to warn about memory
allocation stalls) due to current implementation of printk(), and it is
difficult to obtain useful information due to limitation of synchronous
warning approach.
Current printk() implementation flushes all pending logs using the
context of a thread which called console_unlock(). printk() should be
able to flush all pending logs eventually unless somebody continues
appending to printk() buffer.
Since warn_alloc() started appending to printk() buffer while waiting
for oom_kill_process() to make forward progress when oom_kill_process()
is processing pending logs, it became possible for warn_alloc() to force
oom_kill_process() loop inside printk(). As a result, warn_alloc()
significantly increased possibility of preventing oom_kill_process()
from making forward progress.
---------- Pseudo code start ----------
Before warn_alloc() was introduced:
retry:
if (mutex_trylock(&oom_lock)) {
while (atomic_read(&printk_pending_logs) > 0) {
atomic_dec(&printk_pending_logs);
print_one_log();
}
// Send SIGKILL here.
mutex_unlock(&oom_lock)
}
goto retry;
After warn_alloc() was introduced:
retry:
if (mutex_trylock(&oom_lock)) {
while (atomic_read(&printk_pending_logs) > 0) {
atomic_dec(&printk_pending_logs);
print_one_log();
}
// Send SIGKILL here.
mutex_unlock(&oom_lock)
} else if (waited_for_10seconds()) {
atomic_inc(&printk_pending_logs);
}
goto retry;
---------- Pseudo code end ----------
Although waited_for_10seconds() becomes true once per 10 seconds,
unbounded number of threads can call waited_for_10seconds() at the same
time. Also, since threads doing waited_for_10seconds() keep doing
almost busy loop, the thread doing print_one_log() can use little CPU
resource. Therefore, this situation can be simplified like
---------- Pseudo code start ----------
retry:
if (mutex_trylock(&oom_lock)) {
while (atomic_read(&printk_pending_logs) > 0) {
atomic_dec(&printk_pending_logs);
print_one_log();
}
// Send SIGKILL here.
mutex_unlock(&oom_lock)
} else {
atomic_inc(&printk_pending_logs);
}
goto retry;
---------- Pseudo code end ----------
when printk() is called faster than print_one_log() can process a log.
One of possible mitigation would be to introduce a new lock in order to
make sure that no other series of printk() (either oom_kill_process() or
warn_alloc()) can append to printk() buffer when one series of printk()
(either oom_kill_process() or warn_alloc()) is already in progress.
Such serialization will also help obtaining kernel messages in readable
form.
---------- Pseudo code start ----------
retry:
if (mutex_trylock(&oom_lock)) {
mutex_lock(&oom_printk_lock);
while (atomic_read(&printk_pending_logs) > 0) {
atomic_dec(&printk_pending_logs);
print_one_log();
}
// Send SIGKILL here.
mutex_unlock(&oom_printk_lock);
mutex_unlock(&oom_lock)
} else {
if (mutex_trylock(&oom_printk_lock)) {
atomic_inc(&printk_pending_logs);
mutex_unlock(&oom_printk_lock);
}
}
goto retry;
---------- Pseudo code end ----------
But this commit does not go that direction, for we don't want to
introduce a new lock dependency, and we unlikely be able to obtain
useful information even if we serialized oom_kill_process() and
warn_alloc().
Synchronous approach is prone to unexpected results (e.g. too late [1],
too frequent [2], overlooked [3]). As far as I know, warn_alloc() never
helped with providing information other than "something is going wrong".
I want to consider asynchronous approach which can obtain information
during stalls with possibly relevant threads (e.g. the owner of
oom_lock and kswapd-like threads) and serve as a trigger for actions
(e.g. turn on/off tracepoints, ask libvirt daemon to take a memory dump
of stalling KVM guest for diagnostic purpose).
This commit temporarily loses ability to report e.g. OOM lockup due to
unable to invoke the OOM killer due to !__GFP_FS allocation request.
But asynchronous approach will be able to detect such situation and emit
warning. Thus, let's remove warn_alloc().
[1] https://bugzilla.kernel.org/show_bug.cgi?id=192981
[2] http://lkml.kernel.org/r/CAM_iQpWuPVGc2ky8M-9yukECtS+zKjiDasNymX7rMcBjBFyM_A@mail.gmail.com
[3] commit db73ee0d46379922 ("mm, vmscan: do not loop on too_many_isolated for ever"))
Link: http://lkml.kernel.org/r/1509017339-4802-1-git-send-email-penguin-kernel@I-love.SAKURA.ne.jp
Signed-off-by: Tetsuo Handa <[email protected]>
Reported-by: Cong Wang <[email protected]>
Reported-by: yuwang.yuwang <[email protected]>
Reported-by: Johannes Weiner <[email protected]>
Acked-by: Michal Hocko <[email protected]>
Acked-by: Johannes Weiner <[email protected]>
Cc: Vlastimil Babka <[email protected]>
Cc: Mel Gorman <[email protected]>
Cc: Dave Hansen <[email protected]>
Cc: Sergey Senozhatsky <[email protected]>
Cc: Petr Mladek <[email protected]>
Cc: Steven Rostedt <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
|
Subsets and Splits
CWE 416 & 19
The query filters records related to specific CWEs (Common Weakness Enumerations), providing a basic overview of entries with these vulnerabilities but without deeper analysis.
CWE Frequency in Train Set
Counts the occurrences of each CWE (Common Weakness Enumeration) in the dataset, providing a basic distribution but limited insight.