func
string | target
string | cwe
list | project
string | commit_id
string | hash
string | size
int64 | message
string | vul
int64 |
---|---|---|---|---|---|---|---|---|
EXPORTED int http_allow_noauth(struct transaction_t *txn __attribute__((unused)))
{
return 0;
}
|
Safe
|
[] |
cyrus-imapd
|
602f12ed2af0a49ac4a58affbfea57d0fc23dea5
|
3.0352548804215623e+38
| 4 |
httpd.c: only allow reuse of auth creds on a persistent connection against a backend server in a Murder
| 0 |
static void opj_pi_update_encode_poc_and_final(opj_cp_t *p_cp,
OPJ_UINT32 p_tileno,
OPJ_UINT32 p_tx0,
OPJ_UINT32 p_tx1,
OPJ_UINT32 p_ty0,
OPJ_UINT32 p_ty1,
OPJ_UINT32 p_max_prec,
OPJ_UINT32 p_max_res,
OPJ_UINT32 p_dx_min,
OPJ_UINT32 p_dy_min)
{
/* loop*/
OPJ_UINT32 pino;
/* tile coding parameter*/
opj_tcp_t *l_tcp = 00;
/* current poc being updated*/
opj_poc_t * l_current_poc = 00;
/* number of pocs*/
OPJ_UINT32 l_poc_bound;
OPJ_ARG_NOT_USED(p_max_res);
/* preconditions in debug*/
assert(p_cp != 00);
assert(p_tileno < p_cp->tw * p_cp->th);
/* initializations*/
l_tcp = &p_cp->tcps [p_tileno];
/* number of iterations in the loop */
l_poc_bound = l_tcp->numpocs + 1;
/* start at first element, and to make sure the compiler will not make a calculation each time in the loop
store a pointer to the current element to modify rather than l_tcp->pocs[i]*/
l_current_poc = l_tcp->pocs;
l_current_poc->compS = l_current_poc->compno0;
l_current_poc->compE = l_current_poc->compno1;
l_current_poc->resS = l_current_poc->resno0;
l_current_poc->resE = l_current_poc->resno1;
l_current_poc->layE = l_current_poc->layno1;
/* special treatment for the first element*/
l_current_poc->layS = 0;
l_current_poc->prg = l_current_poc->prg1;
l_current_poc->prcS = 0;
l_current_poc->prcE = p_max_prec;
l_current_poc->txS = (OPJ_UINT32)p_tx0;
l_current_poc->txE = (OPJ_UINT32)p_tx1;
l_current_poc->tyS = (OPJ_UINT32)p_ty0;
l_current_poc->tyE = (OPJ_UINT32)p_ty1;
l_current_poc->dx = p_dx_min;
l_current_poc->dy = p_dy_min;
++ l_current_poc;
for (pino = 1; pino < l_poc_bound ; ++pino) {
l_current_poc->compS = l_current_poc->compno0;
l_current_poc->compE = l_current_poc->compno1;
l_current_poc->resS = l_current_poc->resno0;
l_current_poc->resE = l_current_poc->resno1;
l_current_poc->layE = l_current_poc->layno1;
l_current_poc->prg = l_current_poc->prg1;
l_current_poc->prcS = 0;
/* special treatment here different from the first element*/
l_current_poc->layS = (l_current_poc->layE > (l_current_poc - 1)->layE) ?
l_current_poc->layE : 0;
l_current_poc->prcE = p_max_prec;
l_current_poc->txS = (OPJ_UINT32)p_tx0;
l_current_poc->txE = (OPJ_UINT32)p_tx1;
l_current_poc->tyS = (OPJ_UINT32)p_ty0;
l_current_poc->tyE = (OPJ_UINT32)p_ty1;
l_current_poc->dx = p_dx_min;
l_current_poc->dy = p_dy_min;
++ l_current_poc;
}
}
|
Safe
|
[
"CWE-122"
] |
openjpeg
|
00383e162ae2f8fc951f5745bf1011771acb8dce
|
1.2039172611203824e+38
| 78 |
pi.c: avoid out of bounds access with POC (refs https://github.com/uclouvain/openjpeg/issues/1293#issuecomment-737122836)
| 0 |
static int active_scan(struct hci_request *req, unsigned long opt)
{
uint16_t interval = opt;
struct hci_dev *hdev = req->hdev;
u8 own_addr_type;
/* White list is not used for discovery */
u8 filter_policy = 0x00;
/* Discovery doesn't require controller address resolution */
bool addr_resolv = false;
int err;
bt_dev_dbg(hdev, "");
/* If controller is scanning, it means the background scanning is
* running. Thus, we should temporarily stop it in order to set the
* discovery scanning parameters.
*/
if (hci_dev_test_flag(hdev, HCI_LE_SCAN)) {
hci_req_add_le_scan_disable(req, false);
cancel_interleave_scan(hdev);
}
/* All active scans will be done with either a resolvable private
* address (when privacy feature has been enabled) or non-resolvable
* private address.
*/
err = hci_update_random_address(req, true, scan_use_rpa(hdev),
&own_addr_type);
if (err < 0)
own_addr_type = ADDR_LE_DEV_PUBLIC;
hci_req_start_scan(req, LE_SCAN_ACTIVE, interval,
hdev->le_scan_window_discovery, own_addr_type,
filter_policy, addr_resolv);
return 0;
}
|
Safe
|
[
"CWE-362"
] |
linux
|
e2cb6b891ad2b8caa9131e3be70f45243df82a80
|
9.164907651201854e+37
| 36 |
bluetooth: eliminate the potential race condition when removing the HCI controller
There is a possible race condition vulnerability between issuing a HCI
command and removing the cont. Specifically, functions hci_req_sync()
and hci_dev_do_close() can race each other like below:
thread-A in hci_req_sync() | thread-B in hci_dev_do_close()
| hci_req_sync_lock(hdev);
test_bit(HCI_UP, &hdev->flags); |
... | test_and_clear_bit(HCI_UP, &hdev->flags)
hci_req_sync_lock(hdev); |
|
In this commit we alter the sequence in function hci_req_sync(). Hence,
the thread-A cannot issue th.
Signed-off-by: Lin Ma <linma@zju.edu.cn>
Cc: Marcel Holtmann <marcel@holtmann.org>
Fixes: 7c6a329e4447 ("[Bluetooth] Fix regression from using default link policy")
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| 0 |
static void atomic2gen (lua_State *L, global_State *g) {
/* sweep all elements making them old */
sweep2old(L, &g->allgc);
/* everything alive now is old */
g->reallyold = g->old = g->survival = g->allgc;
/* repeat for 'finobj' lists */
sweep2old(L, &g->finobj);
g->finobjrold = g->finobjold = g->finobjsur = g->finobj;
sweep2old(L, &g->tobefnz);
g->gckind = KGC_GEN;
g->lastatomic = 0;
g->GCestimate = gettotalbytes(g); /* base for memory control */
finishgencycle(L, g);
}
|
Vulnerable
|
[
"CWE-763"
] |
lua
|
a6da1472c0c5e05ff249325f979531ad51533110
|
9.802576295524423e+37
| 17 |
Fixed bug: barriers cannot be active during sweep
Barriers cannot be active during sweep, even in generational mode.
(Although gen. mode is not incremental, it can hit a barrier when
deleting a thread and closing its upvalues.) The colors of objects are
being changed during sweep and, therefore, cannot be trusted.
| 1 |
void kvm_put_guest_fpu(struct kvm_vcpu *vcpu)
{
kvm_put_guest_xcr0(vcpu);
if (!vcpu->guest_fpu_loaded) {
vcpu->fpu_counter = 0;
return;
}
vcpu->guest_fpu_loaded = 0;
copy_fpregs_to_fpstate(&vcpu->arch.guest_fpu);
__kernel_fpu_end();
++vcpu->stat.fpu_reload;
/*
* If using eager FPU mode, or if the guest is a frequent user
* of the FPU, just leave the FPU active for next time.
* Every 255 times fpu_counter rolls over to 0; a guest that uses
* the FPU in bursts will revert to loading it on demand.
*/
if (!vcpu->arch.eager_fpu) {
if (++vcpu->fpu_counter < 5)
kvm_make_request(KVM_REQ_DEACTIVATE_FPU, vcpu);
}
trace_kvm_fpu(0);
}
|
Safe
|
[
"CWE-369"
] |
linux
|
0185604c2d82c560dab2f2933a18f797e74ab5a8
|
2.8985036891476233e+38
| 25 |
KVM: x86: Reload pit counters for all channels when restoring state
Currently if userspace restores the pit counters with a count of 0
on channels 1 or 2 and the guest attempts to read the count on those
channels, then KVM will perform a mod of 0 and crash. This will ensure
that 0 values are converted to 65536 as per the spec.
This is CVE-2015-7513.
Signed-off-by: Andy Honig <ahonig@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
| 0 |
e_ews_connection_get_delegate (EEwsConnection *cnc,
gint pri,
const gchar *mail_id,
gboolean include_permissions,
GCancellable *cancellable,
GAsyncReadyCallback callback,
gpointer user_data)
{
ESoapMessage *msg;
GSimpleAsyncResult *simple;
EwsAsyncData *async_data;
g_return_if_fail (cnc != NULL);
msg = e_ews_message_new_with_header (
cnc->priv->settings,
cnc->priv->uri,
cnc->priv->impersonate_user,
"GetDelegate",
"IncludePermissions",
include_permissions ? "true" : "false",
cnc->priv->version,
E_EWS_EXCHANGE_2007_SP1,
FALSE,
TRUE);
e_soap_message_start_element (msg, "Mailbox", "messages", NULL);
e_ews_message_write_string_parameter (msg, "EmailAddress", NULL, mail_id ? mail_id : cnc->priv->email);
e_soap_message_end_element (msg);
e_ews_message_write_footer (msg);
simple = g_simple_async_result_new (
G_OBJECT (cnc), callback, user_data,
e_ews_connection_get_delegate);
async_data = g_new0 (EwsAsyncData, 1);
g_simple_async_result_set_op_res_gpointer (
simple, async_data, (GDestroyNotify) async_data_free);
e_ews_connection_queue_request (
cnc, msg, get_delegate_response_cb,
pri, cancellable, simple);
g_object_unref (simple);
}
|
Safe
|
[
"CWE-295"
] |
evolution-ews
|
915226eca9454b8b3e5adb6f2fff9698451778de
|
2.9675837672441013e+38
| 48 |
I#27 - SSL Certificates are not validated
This depends on https://gitlab.gnome.org/GNOME/evolution-data-server/commit/6672b8236139bd6ef41ecb915f4c72e2a052dba5 too.
Closes https://gitlab.gnome.org/GNOME/evolution-ews/issues/27
| 0 |
xsltParseStylesheetProcess(xsltStylesheetPtr ret, xmlDocPtr doc) {
xmlNodePtr cur;
xsltInitGlobals();
if (doc == NULL)
return(NULL);
if (ret == NULL)
return(ret);
/*
* First steps, remove blank nodes,
* locate the xsl:stylesheet element and the
* namespace declaration.
*/
cur = xmlDocGetRootElement(doc);
if (cur == NULL) {
xsltTransformError(NULL, ret, (xmlNodePtr) doc,
"xsltParseStylesheetProcess : empty stylesheet\n");
return(NULL);
}
if ((IS_XSLT_ELEM(cur)) &&
((IS_XSLT_NAME(cur, "stylesheet")) ||
(IS_XSLT_NAME(cur, "transform")))) {
#ifdef WITH_XSLT_DEBUG_PARSING
xsltGenericDebug(xsltGenericDebugContext,
"xsltParseStylesheetProcess : found stylesheet\n");
#endif
ret->literal_result = 0;
xsltParseStylesheetExcludePrefix(ret, cur, 1);
xsltParseStylesheetExtPrefix(ret, cur, 1);
} else {
xsltParseStylesheetExcludePrefix(ret, cur, 0);
xsltParseStylesheetExtPrefix(ret, cur, 0);
ret->literal_result = 1;
}
if (!ret->nopreproc) {
xsltPreprocessStylesheet(ret, cur);
}
if (ret->literal_result == 0) {
xsltParseStylesheetTop(ret, cur);
} else {
xmlChar *prop;
xsltTemplatePtr template;
/*
* the document itself might be the template, check xsl:version
*/
prop = xmlGetNsProp(cur, (const xmlChar *)"version", XSLT_NAMESPACE);
if (prop == NULL) {
xsltTransformError(NULL, ret, cur,
"xsltParseStylesheetProcess : document is not a stylesheet\n");
return(NULL);
}
#ifdef WITH_XSLT_DEBUG_PARSING
xsltGenericDebug(xsltGenericDebugContext,
"xsltParseStylesheetProcess : document is stylesheet\n");
#endif
if ((!xmlStrEqual(prop, (const xmlChar *)"1.0")) &&
(!xmlStrEqual(prop, (const xmlChar *)"1.1"))) {
xsltTransformError(NULL, ret, cur,
"xsl:version: only 1.1 features are supported\n");
ret->forwards_compatible = 1;
ret->warnings++;
}
xmlFree(prop);
/*
* Create and link the template
*/
template = xsltNewTemplate();
if (template == NULL) {
return(NULL);
}
template->next = ret->templates;
ret->templates = template;
template->match = xmlStrdup((const xmlChar *)"/");
/*
* parse the content and register the pattern
*/
xsltParseTemplateContent(ret, (xmlNodePtr) doc);
template->elem = (xmlNodePtr) doc;
template->content = doc->children;
xsltAddTemplate(ret, template, NULL, NULL);
ret->literal_result = 1;
}
return(ret);
}
|
Safe
|
[] |
libxslt
|
e03553605b45c88f0b4b2980adfbbb8f6fca2fd6
|
6.684448544549466e+37
| 93 |
Fix security framework bypass
xsltCheckRead and xsltCheckWrite return -1 in case of error but callers
don't check for this condition and allow access. With a specially
crafted URL, xsltCheckRead could be tricked into returning an error
because of a supposedly invalid URL that would still be loaded
succesfully later on.
Fixes #12.
Thanks to Felix Wilhelm for the report.
| 0 |
static void __exit ip6gre_fini(void)
{
rtnl_link_unregister(&ip6gre_tap_ops);
rtnl_link_unregister(&ip6gre_link_ops);
inet6_del_protocol(&ip6gre_protocol, IPPROTO_GRE);
unregister_pernet_device(&ip6gre_net_ops);
}
|
Safe
|
[
"CWE-125"
] |
net
|
7892032cfe67f4bde6fc2ee967e45a8fbaf33756
|
1.9054707525929254e+38
| 7 |
ip6_gre: fix ip6gre_err() invalid reads
Andrey Konovalov reported out of bound accesses in ip6gre_err()
If GRE flags contains GRE_KEY, the following expression
*(((__be32 *)p) + (grehlen / 4) - 1)
accesses data ~40 bytes after the expected point, since
grehlen includes the size of IPv6 headers.
Let's use a "struct gre_base_hdr *greh" pointer to make this
code more readable.
p[1] becomes greh->protocol.
grhlen is the GRE header length.
Fixes: c12b395a4664 ("gre: Support GRE over IPv6")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reported-by: Andrey Konovalov <andreyknvl@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
| 0 |
static struct dentry *proc_base_instantiate(struct inode *dir,
struct dentry *dentry, struct task_struct *task, const void *ptr)
{
const struct pid_entry *p = ptr;
struct inode *inode;
struct proc_inode *ei;
struct dentry *error = ERR_PTR(-EINVAL);
/* Allocate the inode */
error = ERR_PTR(-ENOMEM);
inode = new_inode(dir->i_sb);
if (!inode)
goto out;
/* Initialize the inode */
ei = PROC_I(inode);
inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME;
/*
* grab the reference to the task.
*/
ei->pid = get_task_pid(task, PIDTYPE_PID);
if (!ei->pid)
goto out_iput;
inode->i_mode = p->mode;
if (S_ISDIR(inode->i_mode))
inode->i_nlink = 2;
if (S_ISLNK(inode->i_mode))
inode->i_size = 64;
if (p->iop)
inode->i_op = p->iop;
if (p->fop)
inode->i_fop = p->fop;
ei->op = p->op;
dentry->d_op = &proc_base_dentry_operations;
d_add(dentry, inode);
error = NULL;
out:
return error;
out_iput:
iput(inode);
goto out;
}
|
Safe
|
[
"CWE-20",
"CWE-362",
"CWE-416"
] |
linux
|
86acdca1b63e6890540fa19495cfc708beff3d8b
|
3.0602973313984706e+38
| 44 |
fix autofs/afs/etc. magic mountpoint breakage
We end up trying to kfree() nd.last.name on open("/mnt/tmp", O_CREAT)
if /mnt/tmp is an autofs direct mount. The reason is that nd.last_type
is bogus here; we want LAST_BIND for everything of that kind and we
get LAST_NORM left over from finding parent directory.
So make sure that it *is* set properly; set to LAST_BIND before
doing ->follow_link() - for normal symlinks it will be changed
by __vfs_follow_link() and everything else needs it set that way.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
| 0 |
g_file_make_directory_finish (GFile *file,
GAsyncResult *result,
GError **error)
{
GFileIface *iface;
g_return_val_if_fail (G_IS_FILE (file), FALSE);
g_return_val_if_fail (G_IS_ASYNC_RESULT (result), FALSE);
iface = G_FILE_GET_IFACE (file);
return (* iface->make_directory_finish) (file, result, error);
}
|
Safe
|
[
"CWE-362"
] |
glib
|
d8f8f4d637ce43f8699ba94c9b7648beda0ca174
|
2.479889225603008e+38
| 12 |
gfile: Limit access to files when copying
file_copy_fallback creates new files with default permissions and
set the correct permissions after the operation is finished. This
might cause that the files can be accessible by more users during
the operation than expected. Use G_FILE_CREATE_PRIVATE for the new
files to limit access to those files.
| 0 |
ip6t_get_target_c(const struct ip6t_entry *e)
{
return ip6t_get_target((struct ip6t_entry *)e);
}
|
Safe
|
[
"CWE-200"
] |
linux-2.6
|
6a8ab060779779de8aea92ce3337ca348f973f54
|
2.977307649621863e+38
| 4 |
ipv6: netfilter: ip6_tables: fix infoleak to userspace
Structures ip6t_replace, compat_ip6t_replace, and xt_get_revision are
copied from userspace. Fields of these structs that are
zero-terminated strings are not checked. When they are used as argument
to a format string containing "%s" in request_module(), some sensitive
information is leaked to userspace via argument of spawned modprobe
process.
The first bug was introduced before the git epoch; the second was
introduced in 3bc3fe5e (v2.6.25-rc1); the third is introduced by
6b7d31fc (v2.6.15-rc1). To trigger the bug one should have
CAP_NET_ADMIN.
Signed-off-by: Vasiliy Kulikov <segoon@openwall.com>
Signed-off-by: Patrick McHardy <kaber@trash.net>
| 0 |
static int ldapsrv_check_packet_size(
struct ldapsrv_connection *conn,
size_t size)
{
bool is_anonymous = false;
size_t max_size = 0;
max_size = lpcfg_ldap_max_anonymous_request_size(conn->lp_ctx);
if (size <= max_size) {
return LDAP_SUCCESS;
}
/*
* Request is larger than the maximum unauthenticated request size.
* As this code is called frequently we avoid calling
* security_token_is_anonymous if possible
*/
if (conn->session_info != NULL &&
conn->session_info->security_token != NULL) {
is_anonymous = security_token_is_anonymous(
conn->session_info->security_token);
}
if (is_anonymous) {
DBG_WARNING(
"LDAP request size (%zu) exceeds (%zu)\n",
size,
max_size);
return LDAP_UNWILLING_TO_PERFORM;
}
max_size = lpcfg_ldap_max_authenticated_request_size(conn->lp_ctx);
if (size > max_size) {
DBG_WARNING(
"LDAP request size (%zu) exceeds (%zu)\n",
size,
max_size);
return LDAP_UNWILLING_TO_PERFORM;
}
return LDAP_SUCCESS;
}
|
Safe
|
[
"CWE-703"
] |
samba
|
f9b2267c6eb8138fc94df7a138ad5d87526f1d79
|
1.2531063731498353e+38
| 42 |
CVE-2021-3670 ldap_server: Ensure value of MaxQueryDuration is greater than zero
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14694
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
(cherry picked from commit e1ab0c43629686d1d2c0b0b2bcdc90057a792049)
| 0 |
create_custom_attr_data (MonoImage *image, MonoMethod *method, const guchar *data, guint32 len)
{
MonoArray *typedargs, *namedargs;
static MonoMethod *ctor;
MonoDomain *domain;
MonoObject *attr;
void *params [3];
CattrNamedArg *arginfo;
int i;
mono_class_init (method->klass);
if (!ctor)
ctor = mono_class_get_method_from_name (mono_defaults.customattribute_data_class, ".ctor", 3);
domain = mono_domain_get ();
if (len == 0) {
/* This is for Attributes with no parameters */
attr = mono_object_new (domain, mono_defaults.customattribute_data_class);
params [0] = mono_method_get_object (domain, method, NULL);
params [1] = params [2] = NULL;
mono_runtime_invoke (method, attr, params, NULL);
return attr;
}
mono_reflection_create_custom_attr_data_args (image, method, data, len, &typedargs, &namedargs, &arginfo);
if (!typedargs || !namedargs)
return NULL;
for (i = 0; i < mono_method_signature (method)->param_count; ++i) {
MonoObject *obj = mono_array_get (typedargs, MonoObject*, i);
MonoObject *typedarg;
typedarg = create_cattr_typed_arg (mono_method_signature (method)->params [i], obj);
mono_array_setref (typedargs, i, typedarg);
}
for (i = 0; i < mono_array_length (namedargs); ++i) {
MonoObject *obj = mono_array_get (namedargs, MonoObject*, i);
MonoObject *typedarg, *namedarg, *minfo;
if (arginfo [i].prop)
minfo = (MonoObject*)mono_property_get_object (domain, NULL, arginfo [i].prop);
else
minfo = (MonoObject*)mono_field_get_object (domain, NULL, arginfo [i].field);
typedarg = create_cattr_typed_arg (arginfo [i].type, obj);
namedarg = create_cattr_named_arg (minfo, typedarg);
mono_array_setref (namedargs, i, namedarg);
}
attr = mono_object_new (domain, mono_defaults.customattribute_data_class);
params [0] = mono_method_get_object (domain, method, NULL);
params [1] = typedargs;
params [2] = namedargs;
mono_runtime_invoke (ctor, attr, params, NULL);
return attr;
}
|
Safe
|
[
"CWE-20"
] |
mono
|
4905ef1130feb26c3150b28b97e4a96752e0d399
|
3.0750342389589197e+38
| 59 |
Handle invalid instantiation of generic methods.
* verify.c: Add new function to internal verifier API to check
method instantiations.
* reflection.c (mono_reflection_bind_generic_method_parameters):
Check the instantiation before returning it.
Fixes #655847
| 0 |
schemasOneTest(const char *sch,
const char *filename,
const char *result,
const char *err,
int options,
xmlSchemaPtr schemas) {
xmlDocPtr doc;
xmlSchemaValidCtxtPtr ctxt;
int ret = 0;
int validResult = 0;
char *temp;
FILE *schemasOutput;
doc = xmlReadFile(filename, NULL, options);
if (doc == NULL) {
fprintf(stderr, "failed to parse instance %s for %s\n", filename, sch);
return(-1);
}
temp = resultFilename(result, "", ".res");
if (temp == NULL) {
fprintf(stderr, "Out of memory\n");
fatalError();
}
schemasOutput = fopen(temp, "wb");
if (schemasOutput == NULL) {
fprintf(stderr, "failed to open output file %s\n", temp);
xmlFreeDoc(doc);
free(temp);
return(-1);
}
ctxt = xmlSchemaNewValidCtxt(schemas);
xmlSchemaSetValidErrors(ctxt,
(xmlSchemaValidityErrorFunc) testErrorHandler,
(xmlSchemaValidityWarningFunc) testErrorHandler,
ctxt);
validResult = xmlSchemaValidateDoc(ctxt, doc);
if (validResult == 0) {
fprintf(schemasOutput, "%s validates\n", filename);
} else if (validResult > 0) {
fprintf(schemasOutput, "%s fails to validate\n", filename);
} else {
fprintf(schemasOutput, "%s validation generated an internal error\n",
filename);
}
fclose(schemasOutput);
if (result) {
if (compareFiles(temp, result)) {
fprintf(stderr, "Result for %s on %s failed\n", filename, sch);
ret = 1;
}
}
if (temp != NULL) {
unlink(temp);
free(temp);
}
if ((validResult != 0) && (err != NULL)) {
if (compareFileMem(err, testErrors, testErrorsSize)) {
fprintf(stderr, "Error for %s on %s failed\n", filename, sch);
ret = 1;
}
}
xmlSchemaFreeValidCtxt(ctxt);
xmlFreeDoc(doc);
return(ret);
}
|
Safe
|
[
"CWE-125"
] |
libxml2
|
a820dbeac29d330bae4be05d9ecd939ad6b4aa33
|
7.875588625121513e+37
| 69 |
Bug 758605: Heap-based buffer overread in xmlDictAddString <https://bugzilla.gnome.org/show_bug.cgi?id=758605>
Reviewed by David Kilzer.
* HTMLparser.c:
(htmlParseName): Add bounds check.
(htmlParseNameComplex): Ditto.
* result/HTML/758605.html: Added.
* result/HTML/758605.html.err: Added.
* result/HTML/758605.html.sax: Added.
* runtest.c:
(pushParseTest): The input for the new test case was so small
(4 bytes) that htmlParseChunk() was never called after
htmlCreatePushParserCtxt(), thereby creating a false positive
test failure. Fixed by using a do-while loop so we always call
htmlParseChunk() at least once.
* test/HTML/758605.html: Added.
| 0 |
bool id_init(void)
{
if (g_ids == NULL)
g_ids = g_hash_table_new(NULL, NULL);
return g_ids != NULL;
}
|
Safe
|
[
"CWE-264"
] |
nspluginwrapper
|
7e4ab8e1189846041f955e6c83f72bc1624e7a98
|
2.869241849616998e+38
| 6 |
Support all the new variables added
| 0 |
drv_size(TERMINAL_CONTROL_BLOCK * TCB, int *linep, int *colp)
{
SCREEN *sp;
bool useEnv = TRUE;
bool useTioctl = TRUE;
AssertTCB();
sp = TCB->csp; /* can be null here */
if (sp) {
useEnv = sp->_use_env;
useTioctl = sp->use_tioctl;
} else {
useEnv = _nc_prescreen.use_env;
useTioctl = _nc_prescreen.use_tioctl;
}
/* figure out the size of the screen */
T(("screen size: terminfo lines = %d columns = %d", lines, columns));
*linep = (int) lines;
*colp = (int) columns;
if (useEnv || useTioctl) {
int value;
#ifdef __EMX__
{
int screendata[2];
_scrsize(screendata);
*colp = screendata[0];
*linep = ((sp != 0 && sp->_filtered)
? 1
: screendata[1]);
T(("EMX screen size: environment LINES = %d COLUMNS = %d",
*linep, *colp));
}
#endif
#if HAVE_SIZECHANGE
/* try asking the OS */
{
TERMINAL *termp = (TERMINAL *) TCB;
if (NC_ISATTY(termp->Filedes)) {
STRUCT_WINSIZE size;
errno = 0;
do {
if (ioctl(termp->Filedes, IOCTL_WINSIZE, &size) >= 0) {
*linep = ((sp != 0 && sp->_filtered)
? 1
: WINSIZE_ROWS(size));
*colp = WINSIZE_COLS(size);
T(("SYS screen size: environment LINES = %d COLUMNS = %d",
*linep, *colp));
break;
}
} while
(errno == EINTR);
}
}
#endif /* HAVE_SIZECHANGE */
if (useEnv) {
if (useTioctl) {
/*
* If environment variables are used, update them.
*/
if ((sp == 0 || !sp->_filtered) && _nc_getenv_num("LINES") > 0) {
_nc_setenv_num("LINES", *linep);
}
if (_nc_getenv_num("COLUMNS") > 0) {
_nc_setenv_num("COLUMNS", *colp);
}
}
/*
* Finally, look for environment variables.
*
* Solaris lets users override either dimension with an environment
* variable.
*/
if ((value = _nc_getenv_num("LINES")) > 0) {
*linep = value;
T(("screen size: environment LINES = %d", *linep));
}
if ((value = _nc_getenv_num("COLUMNS")) > 0) {
*colp = value;
T(("screen size: environment COLUMNS = %d", *colp));
}
}
/* if we can't get dynamic info about the size, use static */
if (*linep <= 0) {
*linep = (int) lines;
}
if (*colp <= 0) {
*colp = (int) columns;
}
/* the ultimate fallback, assume fixed 24x80 size */
if (*linep <= 0) {
*linep = 24;
}
if (*colp <= 0) {
*colp = 80;
}
/*
* Put the derived values back in the screen-size caps, so
* tigetnum() and tgetnum() will do the right thing.
*/
lines = (short) (*linep);
columns = (short) (*colp);
}
T(("screen size is %dx%d", *linep, *colp));
return OK;
}
|
Safe
|
[] |
ncurses
|
790a85dbd4a81d5f5d8dd02a44d84f01512ef443
|
2.8349310844527015e+38
| 118 |
ncurses 6.2 - patch 20200531
+ correct configure version-check/warnng for g++ to allow for 10.x
+ re-enable "bel" in konsole-base (report by Nia Huang)
+ add linux-s entry (patch by Alexandre Montaron).
+ drop long-obsolete convert_configure.pl
+ add test/test_parm.c, for checking tparm changes.
+ improve parameter-checking for tparm, adding function _nc_tiparm() to
handle the most-used case, which accepts only numeric parameters
(report/testcase by "puppet-meteor").
+ use a more conservative estimate of the buffer-size in lib_tparm.c's
save_text() and save_number(), in case the sprintf() function
passes-through unexpected characters from a format specifier
(report/testcase by "puppet-meteor").
+ add a check for end-of-string in cvtchar to handle a malformed
string in infotocap (report/testcase by "puppet-meteor").
| 0 |
int LZ4_decompress_safe_usingDict(const char* source, char* dest, int compressedSize, int maxOutputSize, const char* dictStart, int dictSize)
{
return LZ4_decompress_generic(source, dest, compressedSize, maxOutputSize, endOnInputSize, full, 0, usingExtDict, dictStart, dictSize);
}
|
Safe
|
[
"CWE-20"
] |
lz4
|
da5373197e84ee49d75b8334d4510689731d6e90
|
8.204794610635573e+37
| 4 |
Fixed : issue 52 (reported by Ludwig Strigeus)
| 0 |
struct socket *tun_get_socket(struct file *file)
{
struct tun_struct *tun;
if (file->f_op != &tun_fops)
return ERR_PTR(-EINVAL);
tun = tun_get(file);
if (!tun)
return ERR_PTR(-EBADFD);
tun_put(tun);
return &tun->socket;
}
|
Safe
|
[
"CWE-703",
"CWE-264"
] |
linux
|
550fd08c2cebad61c548def135f67aba284c6162
|
1.7662305110545877e+38
| 11 |
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 <nhorman@tuxdriver.com>
CC: Karsten Keil <isdn@linux-pingi.de>
CC: "David S. Miller" <davem@davemloft.net>
CC: Jay Vosburgh <fubar@us.ibm.com>
CC: Andy Gospodarek <andy@greyhouse.net>
CC: Patrick McHardy <kaber@trash.net>
CC: Krzysztof Halasa <khc@pm.waw.pl>
CC: "John W. Linville" <linville@tuxdriver.com>
CC: Greg Kroah-Hartman <gregkh@suse.de>
CC: Marcel Holtmann <marcel@holtmann.org>
CC: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
| 0 |
Status removeRoleDocuments(OperationContext* txn, const BSONObj& query, long long* numRemoved) {
Status status = removeAuthzDocuments(
txn, AuthorizationManager::rolesCollectionNamespace, query, numRemoved);
if (status.code() == ErrorCodes::UnknownError) {
return Status(ErrorCodes::RoleModificationFailed, status.reason());
}
return status;
}
|
Safe
|
[
"CWE-613"
] |
mongo
|
64d8e9e1b12d16b54d6a592bae8110226c491b4e
|
2.101963325089919e+38
| 8 |
SERVER-38984 Validate unique User ID on UserCache hit
(cherry picked from commit e55d6e2292e5dbe2f97153251d8193d1cc89f5d7)
| 0 |
TEST_CASE("Ordered choice count 2", "[general]")
{
parser parser(R"(
S <- ('a' / 'b')*
)");
parser["S"] = [](const SemanticValues& sv) {
REQUIRE(sv.choice() == 0);
REQUIRE(sv.choice_count() == 0);
};
parser.parse("b");
}
|
Vulnerable
|
[
"CWE-125"
] |
cpp-peglib
|
b3b29ce8f3acf3a32733d930105a17d7b0ba347e
|
4.233381975921811e+37
| 13 |
Fix #122
| 1 |
static char *next_line(multipart_buffer *self)
{
/* look for LF in the data */
char* line = self->buf_begin;
char* ptr = memchr(self->buf_begin, '\n', self->bytes_in_buffer);
if (ptr) { /* LF found */
/* terminate the string, remove CRLF */
if ((ptr - line) > 0 && *(ptr-1) == '\r') {
*(ptr-1) = 0;
} else {
*ptr = 0;
}
/* bump the pointer */
self->buf_begin = ptr + 1;
self->bytes_in_buffer -= (self->buf_begin - line);
} else { /* no LF found */
/* buffer isn't completely full, fail */
if (self->bytes_in_buffer < self->bufsize) {
return NULL;
}
/* return entire buffer as a partial line */
line[self->bufsize] = 0;
self->buf_begin = ptr;
self->bytes_in_buffer = 0;
}
return line;
}
|
Safe
|
[
"CWE-399"
] |
php-src
|
4605d536d23b00813d11cc906bb48d39bdcf5f25
|
2.2242334310097637e+38
| 33 |
Fixed bug #69364 - use smart_str to assemble strings
| 0 |
read_layer_block (FILE *f,
gint image_ID,
guint total_len,
PSPimage *ia)
{
gint i;
long block_start, sub_block_start, channel_start;
gint sub_id;
guint32 sub_init_len, sub_total_len;
gchar *name = NULL;
guint16 namelen;
guchar type, opacity, blend_mode, visibility, transparency_protected;
guchar link_group_id, mask_linked, mask_disabled;
guint32 image_rect[4], saved_image_rect[4], mask_rect[4], saved_mask_rect[4];
gboolean null_layer = FALSE;
guint16 bitmap_count, channel_count;
GimpImageType drawable_type;
guint32 layer_ID = 0;
GimpLayerModeEffects layer_mode;
guint32 channel_init_len, channel_total_len;
guint32 compressed_len, uncompressed_len;
guint16 bitmap_type, channel_type;
gint width, height, bytespp, offset;
guchar **pixels, *pixel;
GimpDrawable *drawable;
GimpPixelRgn pixel_rgn;
block_start = ftell (f);
while (ftell (f) < block_start + total_len)
{
/* Read the layer sub-block header */
sub_id = read_block_header (f, &sub_init_len, &sub_total_len);
if (sub_id == -1)
return -1;
if (sub_id != PSP_LAYER_BLOCK)
{
g_message ("Invalid layer sub-block %s, should be LAYER",
block_name (sub_id));
return -1;
}
sub_block_start = ftell (f);
/* Read layer information chunk */
if (psp_ver_major >= 4)
{
if (fseek (f, 4, SEEK_CUR) < 0
|| fread (&namelen, 2, 1, f) < 1
|| ((namelen = GUINT16_FROM_LE (namelen)) && FALSE)
|| (name = g_malloc (namelen + 1)) == NULL
|| fread (name, namelen, 1, f) < 1
|| fread (&type, 1, 1, f) < 1
|| fread (&image_rect, 16, 1, f) < 1
|| fread (&saved_image_rect, 16, 1, f) < 1
|| fread (&opacity, 1, 1, f) < 1
|| fread (&blend_mode, 1, 1, f) < 1
|| fread (&visibility, 1, 1, f) < 1
|| fread (&transparency_protected, 1, 1, f) < 1
|| fread (&link_group_id, 1, 1, f) < 1
|| fread (&mask_rect, 16, 1, f) < 1
|| fread (&saved_mask_rect, 16, 1, f) < 1
|| fread (&mask_linked, 1, 1, f) < 1
|| fread (&mask_disabled, 1, 1, f) < 1
|| fseek (f, 47, SEEK_CUR) < 0
|| fread (&bitmap_count, 2, 1, f) < 1
|| fread (&channel_count, 2, 1, f) < 1)
{
g_message ("Error reading layer information chunk");
g_free (name);
return -1;
}
name[namelen] = 0;
type = PSP_LAYER_NORMAL; /* ??? */
}
else
{
name = g_malloc (257);
name[256] = 0;
if (fread (name, 256, 1, f) < 1
|| fread (&type, 1, 1, f) < 1
|| fread (&image_rect, 16, 1, f) < 1
|| fread (&saved_image_rect, 16, 1, f) < 1
|| fread (&opacity, 1, 1, f) < 1
|| fread (&blend_mode, 1, 1, f) < 1
|| fread (&visibility, 1, 1, f) < 1
|| fread (&transparency_protected, 1, 1, f) < 1
|| fread (&link_group_id, 1, 1, f) < 1
|| fread (&mask_rect, 16, 1, f) < 1
|| fread (&saved_mask_rect, 16, 1, f) < 1
|| fread (&mask_linked, 1, 1, f) < 1
|| fread (&mask_disabled, 1, 1, f) < 1
|| fseek (f, 43, SEEK_CUR) < 0
|| fread (&bitmap_count, 2, 1, f) < 1
|| fread (&channel_count, 2, 1, f) < 1)
{
g_message ("Error reading layer information chunk");
g_free (name);
return -1;
}
}
if (type == PSP_LAYER_FLOATING_SELECTION)
g_message ("Floating selection restored as normal layer");
swab_rect (image_rect);
swab_rect (saved_image_rect);
swab_rect (mask_rect);
swab_rect (saved_mask_rect);
bitmap_count = GUINT16_FROM_LE (bitmap_count);
channel_count = GUINT16_FROM_LE (channel_count);
layer_mode = gimp_layer_mode_from_psp_blend_mode (blend_mode);
if ((int) layer_mode == -1)
{
g_message ("Unsupported PSP layer blend mode %s "
"for layer %s, setting layer invisible",
blend_mode_name (blend_mode), name);
layer_mode = GIMP_NORMAL_MODE;
visibility = FALSE;
}
width = saved_image_rect[2] - saved_image_rect[0];
height = saved_image_rect[3] - saved_image_rect[1];
if ((width < 0) || (width > GIMP_MAX_IMAGE_SIZE) /* w <= 2^18 */
|| (height < 0) || (height > GIMP_MAX_IMAGE_SIZE) /* h <= 2^18 */
|| ((width / 256) * (height / 256) >= 8192)) /* w * h < 2^29 */
{
g_message ("Invalid layer dimensions: %dx%d", width, height);
return -1;
}
IFDBG(2) g_message
("layer: %s %dx%d (%dx%d) @%d,%d opacity %d blend_mode %s "
"%d bitmaps %d channels",
name,
image_rect[2] - image_rect[0], image_rect[3] - image_rect[1],
width, height,
saved_image_rect[0], saved_image_rect[1],
opacity, blend_mode_name (blend_mode),
bitmap_count, channel_count);
IFDBG(2) g_message
("mask %dx%d (%dx%d) @%d,%d",
mask_rect[2] - mask_rect[0],
mask_rect[3] - mask_rect[1],
saved_mask_rect[2] - saved_mask_rect[0],
saved_mask_rect[3] - saved_mask_rect[1],
saved_mask_rect[0], saved_mask_rect[1]);
if (width == 0)
{
width++;
null_layer = TRUE;
}
if (height == 0)
{
height++;
null_layer = TRUE;
}
if (ia->greyscale)
if (!null_layer && bitmap_count == 1)
drawable_type = GIMP_GRAY_IMAGE, bytespp = 1;
else
drawable_type = GIMP_GRAYA_IMAGE, bytespp = 1;
else
if (!null_layer && bitmap_count == 1)
drawable_type = GIMP_RGB_IMAGE, bytespp = 3;
else
drawable_type = GIMP_RGBA_IMAGE, bytespp = 4;
layer_ID = gimp_layer_new (image_ID, name,
width, height,
drawable_type,
100.0 * opacity / 255.0,
layer_mode);
if (layer_ID == -1)
{
g_message ("Error creating layer");
return -1;
}
g_free (name);
gimp_image_insert_layer (image_ID, layer_ID, -1, -1);
if (saved_image_rect[0] != 0 || saved_image_rect[1] != 0)
gimp_layer_set_offsets (layer_ID,
saved_image_rect[0], saved_image_rect[1]);
if (!visibility)
gimp_item_set_visible (layer_ID, FALSE);
gimp_layer_set_lock_alpha (layer_ID, transparency_protected);
if (psp_ver_major < 4)
if (try_fseek (f, sub_block_start + sub_init_len, SEEK_SET) < 0)
{
return -1;
}
pixel = g_malloc0 (height * width * bytespp);
if (null_layer)
{
pixels = NULL;
}
else
{
pixels = g_new (guchar *, height);
for (i = 0; i < height; i++)
pixels[i] = pixel + width * bytespp * i;
}
drawable = gimp_drawable_get (layer_ID);
gimp_pixel_rgn_init (&pixel_rgn, drawable, 0, 0,
width, height, TRUE, FALSE);
gimp_tile_cache_size (gimp_tile_height () * width * bytespp);
/* Read the layer channel sub-blocks */
while (ftell (f) < sub_block_start + sub_total_len)
{
sub_id = read_block_header (f, &channel_init_len,
&channel_total_len);
if (sub_id == -1)
{
gimp_image_delete (image_ID);
return -1;
}
if (sub_id != PSP_CHANNEL_BLOCK)
{
g_message ("Invalid layer sub-block %s, should be CHANNEL",
block_name (sub_id));
return -1;
}
channel_start = ftell (f);
if (psp_ver_major == 4)
fseek (f, 4, SEEK_CUR); /* Unknown field */
if (fread (&compressed_len, 4, 1, f) < 1
|| fread (&uncompressed_len, 4, 1, f) < 1
|| fread (&bitmap_type, 2, 1, f) < 1
|| fread (&channel_type, 2, 1, f) < 1)
{
g_message ("Error reading channel information chunk");
return -1;
}
compressed_len = GUINT32_FROM_LE (compressed_len);
uncompressed_len = GUINT32_FROM_LE (uncompressed_len);
bitmap_type = GUINT16_FROM_LE (bitmap_type);
channel_type = GUINT16_FROM_LE (channel_type);
if (bitmap_type > PSP_DIB_USER_MASK)
{
g_message ("Invalid bitmap type %d in channel information chunk",
bitmap_type);
return -1;
}
if (channel_type > PSP_CHANNEL_BLUE)
{
g_message ("Invalid channel type %d in channel information chunk",
channel_type);
return -1;
}
IFDBG(2) g_message ("channel: %s %s %d (%d) bytes %d bytespp",
bitmap_type_name (bitmap_type),
channel_type_name (channel_type),
uncompressed_len, compressed_len,
bytespp);
if (bitmap_type == PSP_DIB_TRANS_MASK)
offset = 3;
else
offset = channel_type - PSP_CHANNEL_RED;
if (psp_ver_major < 4)
if (try_fseek (f, channel_start + channel_init_len, SEEK_SET) < 0)
{
return -1;
}
if (!null_layer)
if (read_channel_data (f, ia, pixels, bytespp,
offset, drawable, compressed_len) == -1)
{
return -1;
}
if (try_fseek (f, channel_start + channel_total_len, SEEK_SET) < 0)
{
return -1;
}
}
gimp_pixel_rgn_set_rect (&pixel_rgn, pixel, 0, 0, width, height);
gimp_drawable_flush (drawable);
gimp_drawable_detach (drawable);
g_free (pixels);
g_free (pixel);
}
if (try_fseek (f, block_start + total_len, SEEK_SET) < 0)
{
return -1;
}
return layer_ID;
}
|
Safe
|
[
"CWE-787"
] |
gimp
|
48ec15890e1751dede061f6d1f469b6508c13439
|
2.0882259949171023e+38
| 321 |
file-psp: fix for bogus input data. Fixes bug #639203
| 0 |
static int get_supplementary_groups(const ExecContext *c, const char *user,
const char *group, gid_t gid,
gid_t **supplementary_gids, int *ngids) {
char **i;
int r, k = 0;
int ngroups_max;
bool keep_groups = false;
gid_t *groups = NULL;
_cleanup_free_ gid_t *l_gids = NULL;
assert(c);
/*
* If user is given, then lookup GID and supplementary groups list.
* We avoid NSS lookups for gid=0. Also we have to initialize groups
* here and as early as possible so we keep the list of supplementary
* groups of the caller.
*/
if (user && gid_is_valid(gid) && gid != 0) {
/* First step, initialize groups from /etc/groups */
if (initgroups(user, gid) < 0)
return -errno;
keep_groups = true;
}
if (strv_isempty(c->supplementary_groups))
return 0;
/*
* If SupplementaryGroups= was passed then NGROUPS_MAX has to
* be positive, otherwise fail.
*/
errno = 0;
ngroups_max = (int) sysconf(_SC_NGROUPS_MAX);
if (ngroups_max <= 0) {
if (errno > 0)
return -errno;
else
return -EOPNOTSUPP; /* For all other values */
}
l_gids = new(gid_t, ngroups_max);
if (!l_gids)
return -ENOMEM;
if (keep_groups) {
/*
* Lookup the list of groups that the user belongs to, we
* avoid NSS lookups here too for gid=0.
*/
k = ngroups_max;
if (getgrouplist(user, gid, l_gids, &k) < 0)
return -EINVAL;
} else
k = 0;
STRV_FOREACH(i, c->supplementary_groups) {
const char *g;
if (k >= ngroups_max)
return -E2BIG;
g = *i;
r = get_group_creds(&g, l_gids+k, 0);
if (r < 0)
return r;
k++;
}
/*
* Sets ngids to zero to drop all supplementary groups, happens
* when we are under root and SupplementaryGroups= is empty.
*/
if (k == 0) {
*ngids = 0;
return 0;
}
/* Otherwise get the final list of supplementary groups */
groups = memdup(l_gids, sizeof(gid_t) * k);
if (!groups)
return -ENOMEM;
*supplementary_gids = groups;
*ngids = k;
groups = NULL;
return 0;
}
|
Safe
|
[
"CWE-269"
] |
systemd
|
f69567cbe26d09eac9d387c0be0fc32c65a83ada
|
3.0879406880257472e+38
| 92 |
core: expose SUID/SGID restriction as new unit setting RestrictSUIDSGID=
| 0 |
keyword_alloc_sub(vector_t *keywords_vec, const char *string, void (*handler) (vector_t *))
{
int i = 0;
keyword_t *keyword;
/* fetch last keyword */
keyword = vector_slot(keywords_vec, vector_size(keywords_vec) - 1);
/* Don't install subordinate keywords if configuration block inactive */
if (!keyword->active)
return;
/* position to last sub level */
for (i = 0; i < sublevel; i++)
keyword = vector_slot(keyword->sub, vector_size(keyword->sub) - 1);
/* First sub level allocation */
if (!keyword->sub)
keyword->sub = vector_alloc();
/* add new sub keyword */
keyword_alloc(keyword->sub, string, handler, true);
}
|
Safe
|
[
"CWE-59",
"CWE-61"
] |
keepalived
|
04f2d32871bb3b11d7dc024039952f2fe2750306
|
3.161168355355256e+37
| 23 |
When opening files for write, ensure they aren't symbolic links
Issue #1048 identified that if, for example, a non privileged user
created a symbolic link from /etc/keepalvied.data to /etc/passwd,
writing to /etc/keepalived.data (which could be invoked via DBus)
would cause /etc/passwd to be overwritten.
This commit stops keepalived writing to pathnames where the ultimate
component is a symbolic link, by setting O_NOFOLLOW whenever opening
a file for writing.
This might break some setups, where, for example, /etc/keepalived.data
was a symbolic link to /home/fred/keepalived.data. If this was the case,
instead create a symbolic link from /home/fred/keepalived.data to
/tmp/keepalived.data, so that the file is still accessible via
/home/fred/keepalived.data.
There doesn't appear to be a way around this backward incompatibility,
since even checking if the pathname is a symbolic link prior to opening
for writing would create a race condition.
Signed-off-by: Quentin Armitage <quentin@armitage.org.uk>
| 0 |
irc_server_get_nick_index (struct t_irc_server *server)
{
int i;
if (!server->nick)
return -1;
for (i = 0; i < server->nicks_count; i++)
{
if (strcmp (server->nick, server->nicks_array[i]) == 0)
{
return i;
}
}
/* nick not found */
return -1;
}
|
Safe
|
[
"CWE-120",
"CWE-787"
] |
weechat
|
40ccacb4330a64802b1f1e28ed9a6b6d3ca9197f
|
6.384421950417152e+37
| 18 |
irc: fix crash when a new message 005 is received with longer nick prefixes
Thanks to Stuart Nevans Locke for reporting the issue.
| 0 |
_copyTransactionStmt(const TransactionStmt *from)
{
TransactionStmt *newnode = makeNode(TransactionStmt);
COPY_SCALAR_FIELD(kind);
COPY_NODE_FIELD(options);
COPY_STRING_FIELD(gid);
return newnode;
}
|
Safe
|
[
"CWE-362"
] |
postgres
|
5f173040e324f6c2eebb90d86cf1b0cdb5890f0a
|
2.436358724021462e+38
| 10 |
Avoid repeated name lookups during table and index DDL.
If the name lookups come to different conclusions due to concurrent
activity, we might perform some parts of the DDL on a different table
than other parts. At least in the case of CREATE INDEX, this can be
used to cause the permissions checks to be performed against a
different table than the index creation, allowing for a privilege
escalation attack.
This changes the calling convention for DefineIndex, CreateTrigger,
transformIndexStmt, transformAlterTableStmt, CheckIndexCompatible
(in 9.2 and newer), and AlterTable (in 9.1 and older). In addition,
CheckRelationOwnership is removed in 9.2 and newer and the calling
convention is changed in older branches. A field has also been added
to the Constraint node (FkConstraint in 8.4). Third-party code calling
these functions or using the Constraint node will require updating.
Report by Andres Freund. Patch by Robert Haas and Andres Freund,
reviewed by Tom Lane.
Security: CVE-2014-0062
| 0 |
static void bond_set_lockdep_class_one(struct net_device *dev,
struct netdev_queue *txq,
void *_unused)
{
lockdep_set_class(&txq->_xmit_lock,
&bonding_netdev_xmit_lock_key);
}
|
Safe
|
[
"CWE-703",
"CWE-264"
] |
linux
|
550fd08c2cebad61c548def135f67aba284c6162
|
6.919411273961397e+37
| 7 |
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 <nhorman@tuxdriver.com>
CC: Karsten Keil <isdn@linux-pingi.de>
CC: "David S. Miller" <davem@davemloft.net>
CC: Jay Vosburgh <fubar@us.ibm.com>
CC: Andy Gospodarek <andy@greyhouse.net>
CC: Patrick McHardy <kaber@trash.net>
CC: Krzysztof Halasa <khc@pm.waw.pl>
CC: "John W. Linville" <linville@tuxdriver.com>
CC: Greg Kroah-Hartman <gregkh@suse.de>
CC: Marcel Holtmann <marcel@holtmann.org>
CC: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
| 0 |
int X509_STORE_CTX_set_trust(X509_STORE_CTX *ctx, int trust)
{
return X509_STORE_CTX_purpose_inherit(ctx, 0, 0, trust);
}
|
Safe
|
[
"CWE-119"
] |
openssl
|
370ac320301e28bb615cee80124c042649c95d14
|
1.0811752867080874e+38
| 4 |
Fix length checks in X509_cmp_time to avoid out-of-bounds reads.
Also tighten X509_cmp_time to reject more than three fractional
seconds in the time; and to reject trailing garbage after the offset.
CVE-2015-1789
Reviewed-by: Viktor Dukhovni <viktor@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
| 0 |
HttpHeader::getTimeOrTag(Http::HdrType id) const
{
TimeOrTag tot;
HttpHeaderEntry *e;
assert(Http::HeaderLookupTable.lookup(id).type == Http::HdrFieldType::ftDate_1123_or_ETag); /* must be of an appropriate type */
memset(&tot, 0, sizeof(tot));
if ((e = findEntry(id))) {
const char *str = e->value.termedBuf();
/* try as an ETag */
if (etagParseInit(&tot.tag, str)) {
tot.valid = tot.tag.str != NULL;
tot.time = -1;
} else {
/* or maybe it is time? */
tot.time = parse_rfc1123(str);
tot.valid = tot.time >= 0;
tot.tag.str = NULL;
}
}
assert(tot.time < 0 || !tot.tag.str); /* paranoid */
return tot;
}
|
Safe
|
[
"CWE-444"
] |
squid
|
9c8e2a71aa1d3c159a319d9365c346c48dc783a5
|
1.2318656263278962e+38
| 25 |
Enforce token characters for field-name (#700)
RFC 7230 defines field-name as a token. Request splitting and cache
poisoning attacks have used non-token characters to fool broken HTTP
agents behind or in front of Squid for years. This change should
significantly reduce that abuse.
If we discover exceptional situations that need special treatment, the
relaxed parser can allow them on a case-by-case basis (while being extra
careful about framing-related header fields), just like we already
tolerate some header whitespace (e.g., between the response header
field-name and colon).
| 0 |
static void vmx_get_exit_info(struct kvm_vcpu *vcpu, u64 *info1, u64 *info2,
u32 *intr_info, u32 *error_code)
{
struct vcpu_vmx *vmx = to_vmx(vcpu);
*info1 = vmx_get_exit_qual(vcpu);
if (!(vmx->exit_reason.failed_vmentry)) {
*info2 = vmx->idt_vectoring_info;
*intr_info = vmx_get_intr_info(vcpu);
if (is_exception_with_error_code(*intr_info))
*error_code = vmcs_read32(VM_EXIT_INTR_ERROR_CODE);
else
*error_code = 0;
} else {
*info2 = 0;
*intr_info = 0;
*error_code = 0;
}
}
|
Safe
|
[
"CWE-787"
] |
linux
|
04c4f2ee3f68c9a4bf1653d15f1a9a435ae33f7a
|
1.1106951379419853e+38
| 19 |
KVM: VMX: Don't use vcpu->run->internal.ndata as an array index
__vmx_handle_exit() uses vcpu->run->internal.ndata as an index for
an array access. Since vcpu->run is (can be) mapped to a user address
space with a writer permission, the 'ndata' could be updated by the
user process at anytime (the user process can set it to outside the
bounds of the array).
So, it is not safe that __vmx_handle_exit() uses the 'ndata' that way.
Fixes: 1aa561b1a4c0 ("kvm: x86: Add "last CPU" to some KVM_EXIT information")
Signed-off-by: Reiji Watanabe <reijiw@google.com>
Reviewed-by: Jim Mattson <jmattson@google.com>
Message-Id: <20210413154739.490299-1-reijiw@google.com>
Cc: stable@vger.kernel.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
| 0 |
static void MP4_FreeBox_stts( MP4_Box_t *p_box )
{
FREENULL( p_box->data.p_stts->pi_sample_count );
FREENULL( p_box->data.p_stts->pi_sample_delta );
}
|
Safe
|
[
"CWE-120",
"CWE-191",
"CWE-787"
] |
vlc
|
2e7c7091a61aa5d07e7997b393d821e91f593c39
|
2.3769642069592984e+38
| 5 |
demux: mp4: fix buffer overflow in parsing of string boxes.
We ensure that pbox->i_size is never smaller than 8 to avoid an
integer underflow in the third argument of the subsequent call to
memcpy. We also make sure no truncation occurs when passing values
derived from the 64 bit integer p_box->i_size to arguments of malloc
and memcpy that may be 32 bit integers on 32 bit platforms.
Signed-off-by: Jean-Baptiste Kempf <jb@videolan.org>
| 0 |
static inline double PerceptibleReciprocal(const double x)
{
double
sign;
/*
Return 1/x where x is perceptible (not unlimited or infinitesimal).
*/
sign=x < 0.0 ? -1.0 : 1.0;
if ((sign*x) >= MagickEpsilon)
return(1.0/x);
return(sign/MagickEpsilon);
}
|
Safe
|
[
"CWE-20",
"CWE-125"
] |
ImageMagick
|
8187d2d8fd010d2d6b1a3a8edd935beec404dddc
|
1.205105557299417e+38
| 13 |
https://github.com/ImageMagick/ImageMagick/issues/1610
| 0 |
static int cms_RecipientInfo_ktri_encrypt(CMS_ContentInfo *cms,
CMS_RecipientInfo *ri)
{
CMS_KeyTransRecipientInfo *ktri;
CMS_EncryptedContentInfo *ec;
EVP_PKEY_CTX *pctx;
unsigned char *ek = NULL;
size_t eklen;
int ret = 0;
if (ri->type != CMS_RECIPINFO_TRANS) {
CMSerr(CMS_F_CMS_RECIPIENTINFO_KTRI_ENCRYPT, CMS_R_NOT_KEY_TRANSPORT);
return 0;
}
ktri = ri->d.ktri;
ec = cms->d.envelopedData->encryptedContentInfo;
pctx = ktri->pctx;
if (pctx) {
if (!cms_env_asn1_ctrl(ri, 0))
goto err;
} else {
pctx = EVP_PKEY_CTX_new(ktri->pkey, NULL);
if (!pctx)
return 0;
if (EVP_PKEY_encrypt_init(pctx) <= 0)
goto err;
}
if (EVP_PKEY_CTX_ctrl(pctx, -1, EVP_PKEY_OP_ENCRYPT,
EVP_PKEY_CTRL_CMS_ENCRYPT, 0, ri) <= 0) {
CMSerr(CMS_F_CMS_RECIPIENTINFO_KTRI_ENCRYPT, CMS_R_CTRL_ERROR);
goto err;
}
if (EVP_PKEY_encrypt(pctx, NULL, &eklen, ec->key, ec->keylen) <= 0)
goto err;
ek = OPENSSL_malloc(eklen);
if (ek == NULL) {
CMSerr(CMS_F_CMS_RECIPIENTINFO_KTRI_ENCRYPT, ERR_R_MALLOC_FAILURE);
goto err;
}
if (EVP_PKEY_encrypt(pctx, ek, &eklen, ec->key, ec->keylen) <= 0)
goto err;
ASN1_STRING_set0(ktri->encryptedKey, ek, eklen);
ek = NULL;
ret = 1;
err:
if (pctx) {
EVP_PKEY_CTX_free(pctx);
ktri->pctx = NULL;
}
if (ek)
OPENSSL_free(ek);
return ret;
}
|
Safe
|
[
"CWE-327"
] |
openssl
|
e21f8cf78a125cd3c8c0d1a1a6c8bb0b901f893f
|
4.500048832127785e+37
| 66 |
Fix a padding oracle in PKCS7_dataDecode and CMS_decrypt_set1_pkey
An attack is simple, if the first CMS_recipientInfo is valid but the
second CMS_recipientInfo is chosen ciphertext. If the second
recipientInfo decodes to PKCS #1 v1.5 form plaintext, the correct
encryption key will be replaced by garbage, and the message cannot be
decoded, but if the RSA decryption fails, the correct encryption key is
used and the recipient will not notice the attack.
As a work around for this potential attack the length of the decrypted
key must be equal to the cipher default key length, in case the
certifiate is not given and all recipientInfo are tried out.
The old behaviour can be re-enabled in the CMS code by setting the
CMS_DEBUG_DECRYPT flag.
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/9777)
(cherry picked from commit 5840ed0cd1e6487d247efbc1a04136a41d7b3a37)
| 0 |
void get_current_position()
{
position = position_cursor.get_curr_rownum();
overflowed= false;
if (offset)
{
if (offset_value < 0 &&
position + offset_value > position)
{
overflowed= true;
}
if (offset_value > 0 &&
position + offset_value < position)
{
overflowed= true;
}
position += offset_value;
}
}
|
Safe
|
[] |
server
|
ba4927e520190bbad763bb5260ae154f29a61231
|
2.92517438279458e+38
| 19 |
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.
| 0 |
nautilus_file_get_parent (NautilusFile *file)
{
g_assert (NAUTILUS_IS_FILE (file));
if (nautilus_file_is_self_owned (file)) {
return NULL;
}
return nautilus_directory_get_corresponding_file (file->details->directory);
}
|
Safe
|
[] |
nautilus
|
7632a3e13874a2c5e8988428ca913620a25df983
|
3.1105673217930055e+38
| 10 |
Check for trusted desktop file launchers.
2009-02-24 Alexander Larsson <alexl@redhat.com>
* libnautilus-private/nautilus-directory-async.c:
Check for trusted desktop file launchers.
* libnautilus-private/nautilus-file-private.h:
* libnautilus-private/nautilus-file.c:
* libnautilus-private/nautilus-file.h:
Add nautilus_file_is_trusted_link.
Allow unsetting of custom display name.
* libnautilus-private/nautilus-mime-actions.c:
Display dialog when trying to launch a non-trusted desktop file.
svn path=/trunk/; revision=15003
| 0 |
static int vmx_get_msr(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
{
struct shared_msr_entry *msr;
switch (msr_info->index) {
#ifdef CONFIG_X86_64
case MSR_FS_BASE:
msr_info->data = vmcs_readl(GUEST_FS_BASE);
break;
case MSR_GS_BASE:
msr_info->data = vmcs_readl(GUEST_GS_BASE);
break;
case MSR_KERNEL_GS_BASE:
vmx_load_host_state(to_vmx(vcpu));
msr_info->data = to_vmx(vcpu)->msr_guest_kernel_gs_base;
break;
#endif
case MSR_EFER:
return kvm_get_msr_common(vcpu, msr_info);
case MSR_IA32_TSC:
msr_info->data = guest_read_tsc(vcpu);
break;
case MSR_IA32_SYSENTER_CS:
msr_info->data = vmcs_read32(GUEST_SYSENTER_CS);
break;
case MSR_IA32_SYSENTER_EIP:
msr_info->data = vmcs_readl(GUEST_SYSENTER_EIP);
break;
case MSR_IA32_SYSENTER_ESP:
msr_info->data = vmcs_readl(GUEST_SYSENTER_ESP);
break;
case MSR_IA32_BNDCFGS:
if (!kvm_mpx_supported())
return 1;
msr_info->data = vmcs_read64(GUEST_BNDCFGS);
break;
case MSR_IA32_MCG_EXT_CTL:
if (!msr_info->host_initiated &&
!(to_vmx(vcpu)->msr_ia32_feature_control &
FEATURE_CONTROL_LMCE))
return 1;
msr_info->data = vcpu->arch.mcg_ext_ctl;
break;
case MSR_IA32_FEATURE_CONTROL:
msr_info->data = to_vmx(vcpu)->msr_ia32_feature_control;
break;
case MSR_IA32_VMX_BASIC ... MSR_IA32_VMX_VMFUNC:
if (!nested_vmx_allowed(vcpu))
return 1;
return vmx_get_vmx_msr(vcpu, msr_info->index, &msr_info->data);
case MSR_IA32_XSS:
if (!vmx_xsaves_supported())
return 1;
msr_info->data = vcpu->arch.ia32_xss;
break;
case MSR_TSC_AUX:
if (!guest_cpuid_has_rdtscp(vcpu) && !msr_info->host_initiated)
return 1;
/* Otherwise falls through */
default:
msr = find_msr_entry(to_vmx(vcpu), msr_info->index);
if (msr) {
msr_info->data = msr->data;
break;
}
return kvm_get_msr_common(vcpu, msr_info);
}
return 0;
}
|
Safe
|
[
"CWE-388"
] |
linux
|
ef85b67385436ddc1998f45f1d6a210f935b3388
|
2.8370900643972847e+38
| 70 |
kvm: nVMX: Allow L1 to intercept software exceptions (#BP and #OF)
When L2 exits to L0 due to "exception or NMI", software exceptions
(#BP and #OF) for which L1 has requested an intercept should be
handled by L1 rather than L0. Previously, only hardware exceptions
were forwarded to L1.
Signed-off-by: Jim Mattson <jmattson@google.com>
Cc: stable@vger.kernel.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
| 0 |
int safe_index_read(JOIN_TAB *tab)
{
int error;
TABLE *table= tab->table;
if (unlikely((error=
table->file->ha_index_read_map(table->record[0],
tab->ref.key_buff,
make_prev_keypart_map(tab->ref.key_parts),
HA_READ_KEY_EXACT))))
return report_error(table, error);
return 0;
}
|
Safe
|
[] |
server
|
ff77a09bda884fe6bf3917eb29b9d3a2f53f919b
|
2.7314967578993167e+38
| 12 |
MDEV-22464 Server crash on UPDATE with nested subquery
Uninitialized ref_pointer_array[] because setup_fields() got empty
fields list. mysql_multi_update() for some reason does that by
substituting the fields list with empty total_list for the
mysql_select() call (looks like wrong merge since total_list is not
used anywhere else and is always empty). The fix would be to return
back the original fields list. But this fails update_use_source.test
case:
--error ER_BAD_FIELD_ERROR
update v1 set t1c1=2 order by 1;
Actually not failing the above seems to be ok.
The other fix would be to keep resolve_in_select_list false (and that
keeps outer context from being resolved in
Item_ref::fix_fields()). This fix is more consistent with how SELECT
behaves:
--error ER_SUBQUERY_NO_1_ROW
select a from t1 where a= (select 2 from t1 having (a = 3));
So this patch implements this fix.
| 0 |
static int zipfileClose(sqlite3_vtab_cursor *cur){
ZipfileCsr *pCsr = (ZipfileCsr*)cur;
ZipfileTab *pTab = (ZipfileTab*)(pCsr->base.pVtab);
ZipfileCsr **pp;
zipfileResetCursor(pCsr);
/* Remove this cursor from the ZipfileTab.pCsrList list. */
for(pp=&pTab->pCsrList; *pp!=pCsr; pp=&((*pp)->pCsrNext));
*pp = pCsr->pCsrNext;
sqlite3_free(pCsr);
return SQLITE_OK;
}
|
Safe
|
[
"CWE-434"
] |
sqlite
|
54d501092d88c0cf89bec4279951f548fb0b8618
|
1.3630841748918441e+38
| 13 |
Fix the zipfile extension so that INSERT works even if the pathname of
the file being inserted is a NULL. Bug discovered by the
Yongheng and Rui fuzzer.
FossilOrigin-Name: a80f84b511231204658304226de3e075a55afc2e3f39ac063716f7a57f585c06
| 0 |
static int mailbox_update_conversations(struct mailbox *mailbox,
const struct index_record *old,
struct index_record *new)
{
struct conversations_state *cstate = mailbox_get_cstate(mailbox);
if (!cstate)
return 0;
/* handle unlinked items as if they didn't exist */
if (old && (old->internal_flags & FLAG_INTERNAL_UNLINKED)) old = NULL;
if (new && (new->internal_flags & FLAG_INTERNAL_UNLINKED)) new = NULL;
if (!old && !new)
return 0;
int ignorelimits = new ? new->ignorelimits : 1;
return conversations_update_record(cstate, mailbox, old, new,
/*allowrenumber*/1, ignorelimits);
}
|
Safe
|
[] |
cyrus-imapd
|
1d6d15ee74e11a9bd745e80be69869e5fb8d64d6
|
2.4721725202167122e+38
| 20 |
mailbox.c/reconstruct.c: Add mailbox_mbentry_from_path()
| 0 |
static void muraster_lock(void *user, int lock)
{
mu_lock_mutex(&mutexes[lock]);
}
|
Safe
|
[
"CWE-369",
"CWE-22"
] |
mupdf
|
22c47acbd52949421f8c7cb46ea1556827d0fcbf
|
8.018996348550253e+37
| 4 |
Bug 704834: Fix division by zero for zero width pages in muraster.
| 0 |
ppp_do_recv(struct ppp *ppp, struct sk_buff *skb, struct channel *pch)
{
ppp_recv_lock(ppp);
if (!ppp->closing)
ppp_receive_frame(ppp, skb, pch);
else
kfree_skb(skb);
ppp_recv_unlock(ppp);
}
|
Safe
|
[] |
linux
|
4ab42d78e37a294ac7bc56901d563c642e03c4ae
|
2.363830848913314e+38
| 9 |
ppp, slip: Validate VJ compression slot parameters completely
Currently slhc_init() treats out-of-range values of rslots and tslots
as equivalent to 0, except that if tslots is too large it will
dereference a null pointer (CVE-2015-7799).
Add a range-check at the top of the function and make it return an
ERR_PTR() on error instead of NULL. Change the callers accordingly.
Compile-tested only.
Reported-by: 郭永刚 <guoyonggang@360.cn>
References: http://article.gmane.org/gmane.comp.security.oss.general/17908
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
| 0 |
static int selinux_secmark_relabel_packet(u32 sid)
{
const struct task_security_struct *__tsec;
u32 tsid;
__tsec = current_security();
tsid = __tsec->sid;
return avc_has_perm(tsid, sid, SECCLASS_PACKET, PACKET__RELABELTO, NULL);
}
|
Safe
|
[
"CWE-264"
] |
linux
|
259e5e6c75a910f3b5e656151dc602f53f9d7548
|
2.9237692605208544e+37
| 10 |
Add PR_{GET,SET}_NO_NEW_PRIVS to prevent execve from granting privs
With this change, calling
prctl(PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0)
disables privilege granting operations at execve-time. For example, a
process will not be able to execute a setuid binary to change their uid
or gid if this bit is set. The same is true for file capabilities.
Additionally, LSM_UNSAFE_NO_NEW_PRIVS is defined to ensure that
LSMs respect the requested behavior.
To determine if the NO_NEW_PRIVS bit is set, a task may call
prctl(PR_GET_NO_NEW_PRIVS, 0, 0, 0, 0);
It returns 1 if set and 0 if it is not set. If any of the arguments are
non-zero, it will return -1 and set errno to -EINVAL.
(PR_SET_NO_NEW_PRIVS behaves similarly.)
This functionality is desired for the proposed seccomp filter patch
series. By using PR_SET_NO_NEW_PRIVS, it allows a task to modify the
system call behavior for itself and its child tasks without being
able to impact the behavior of a more privileged task.
Another potential use is making certain privileged operations
unprivileged. For example, chroot may be considered "safe" if it cannot
affect privileged tasks.
Note, this patch causes execve to fail when PR_SET_NO_NEW_PRIVS is
set and AppArmor is in use. It is fixed in a subsequent patch.
Signed-off-by: Andy Lutomirski <luto@amacapital.net>
Signed-off-by: Will Drewry <wad@chromium.org>
Acked-by: Eric Paris <eparis@redhat.com>
Acked-by: Kees Cook <keescook@chromium.org>
v18: updated change desc
v17: using new define values as per 3.4
Signed-off-by: James Morris <james.l.morris@oracle.com>
| 0 |
usage(const char *prog)
{
fprintf(stderr, "Usage: %s [OPTION...]\n", prog);
fprintf(stderr, " -f, --use-file=FILE Use the specified configuration file\n");
#if defined _WITH_VRRP_ && defined _WITH_LVS_
fprintf(stderr, " -P, --vrrp Only run with VRRP subsystem\n");
fprintf(stderr, " -C, --check Only run with Health-checker subsystem\n");
#endif
#ifdef _WITH_BFD_
fprintf(stderr, " -B, --no_bfd Don't run BFD subsystem\n");
#endif
fprintf(stderr, " --all Force all child processes to run, even if have no configuration\n");
fprintf(stderr, " -l, --log-console Log messages to local console\n");
fprintf(stderr, " -D, --log-detail Detailed log messages\n");
fprintf(stderr, " -S, --log-facility=[0-7] Set syslog facility to LOG_LOCAL[0-7]\n");
fprintf(stderr, " -g, --log-file=FILE Also log to FILE (default /tmp/keepalived.log)\n");
fprintf(stderr, " --flush-log-file Flush log file on write\n");
fprintf(stderr, " -G, --no-syslog Don't log via syslog\n");
fprintf(stderr, " -u, --umask=MASK umask for file creation (in numeric form)\n");
#ifdef _WITH_VRRP_
fprintf(stderr, " -X, --release-vips Drop VIP on transition from signal.\n");
fprintf(stderr, " -V, --dont-release-vrrp Don't remove VRRP VIPs and VROUTEs on daemon stop\n");
#endif
#ifdef _WITH_LVS_
fprintf(stderr, " -I, --dont-release-ipvs Don't remove IPVS topology on daemon stop\n");
#endif
fprintf(stderr, " -R, --dont-respawn Don't respawn child processes\n");
fprintf(stderr, " -n, --dont-fork Don't fork the daemon process\n");
fprintf(stderr, " -d, --dump-conf Dump the configuration data\n");
fprintf(stderr, " -p, --pid=FILE Use specified pidfile for parent process\n");
#ifdef _WITH_VRRP_
fprintf(stderr, " -r, --vrrp_pid=FILE Use specified pidfile for VRRP child process\n");
#endif
#ifdef _WITH_LVS_
fprintf(stderr, " -c, --checkers_pid=FILE Use specified pidfile for checkers child process\n");
fprintf(stderr, " -a, --address-monitoring Report all address additions/deletions notified via netlink\n");
#endif
#ifdef _WITH_BFD_
fprintf(stderr, " -b, --bfd_pid=FILE Use specified pidfile for BFD child process\n");
#endif
#ifdef _WITH_SNMP_
fprintf(stderr, " -x, --snmp Enable SNMP subsystem\n");
fprintf(stderr, " -A, --snmp-agent-socket=FILE Use the specified socket for master agent\n");
#endif
#if HAVE_DECL_CLONE_NEWNET
fprintf(stderr, " -s, --namespace=NAME Run in network namespace NAME (overrides config)\n");
#endif
fprintf(stderr, " -m, --core-dump Produce core dump if terminate abnormally\n");
fprintf(stderr, " -M, --core-dump-pattern=PATN Also set /proc/sys/kernel/core_pattern to PATN (default 'core')\n");
#ifdef _MEM_CHECK_LOG_
fprintf(stderr, " -L, --mem-check-log Log malloc/frees to syslog\n");
#endif
fprintf(stderr, " -i, --config-id id Skip any configuration lines beginning '@' that don't match id\n"
" or any lines beginning @^ that do match.\n"
" The config-id defaults to the node name if option not used\n");
fprintf(stderr, " --signum=SIGFUNC Return signal number for STOP, RELOAD, DATA, STATS"
#ifdef _WITH_JSON_
", JSON"
#endif
"\n");
fprintf(stderr, " -t, --config-test[=LOG_FILE] Check the configuration for obvious errors, output to\n"
" stderr by default\n");
#ifdef _WITH_PERF_
fprintf(stderr, " --perf[=PERF_TYPE] Collect perf data, PERF_TYPE=all, run(default) or end\n");
#endif
#ifdef WITH_DEBUG_OPTIONS
fprintf(stderr, " --debug[=...] Enable debug options. p, b, c, v specify parent, bfd, checker and vrrp processes\n");
#ifdef _TIMER_CHECK_
fprintf(stderr, " T - timer debug\n");
#endif
#ifdef _SMTP_ALERT_DEBUG_
fprintf(stderr, " M - email alert debug\n");
#endif
#ifdef _EPOLL_DEBUG_
fprintf(stderr, " E - epoll debug\n");
#endif
#ifdef _EPOLL_THREAD_DUMP_
fprintf(stderr, " D - epoll thread dump debug\n");
#endif
#ifdef _VRRP_FD_DEBUG
fprintf(stderr, " F - vrrp fd dump debug\n");
#endif
#ifdef _REGEX_DEBUG_
fprintf(stderr, " R - regex debug\n");
#endif
#ifdef _WITH_REGEX_TIMERS_
fprintf(stderr, " X - regex timers\n");
#endif
#ifdef _TSM_DEBUG_
fprintf(stderr, " S - TSM debug\n");
#endif
#ifdef _NETLINK_TIMERS_
fprintf(stderr, " N - netlink timer debug\n");
#endif
fprintf(stderr, " Example --debug=TpMEvcp\n");
#endif
fprintf(stderr, " -v, --version Display the version number\n");
fprintf(stderr, " -h, --help Display this help message\n");
}
|
Vulnerable
|
[
"CWE-200"
] |
keepalived
|
26c8d6374db33bcfcdcd758b1282f12ceef4b94f
|
3.2682516612174847e+37
| 99 |
Disable fopen_safe() append mode by default
If a non privileged user creates /tmp/keepalived.log and has it open
for read (e.g. tail -f), then even though keepalived will change the
owner to root and remove all read/write permissions from non owners,
the application which already has the file open will be able to read
the added log entries.
Accordingly, opening a file in append mode is disabled by default, and
only enabled if --enable-smtp-alert-debug or --enable-log-file (which
are debugging options and unset by default) are enabled.
This should further alleviate security concerns related to CVE-2018-19046.
Signed-off-by: Quentin Armitage <quentin@armitage.org.uk>
| 1 |
static void test_conversion()
{
MYSQL_STMT *stmt;
const char *stmt_text;
int rc;
MYSQL_BIND my_bind[1];
char buff[4];
ulong length;
myheader("test_conversion");
stmt_text= "DROP TABLE IF EXISTS t1";
rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text));
myquery(rc);
stmt_text= "CREATE TABLE t1 (a TEXT) DEFAULT CHARSET latin1";
rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text));
myquery(rc);
stmt_text= "SET character_set_connection=utf8, character_set_client=utf8, "
" character_set_results=latin1";
rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text));
myquery(rc);
stmt= mysql_stmt_init(mysql);
stmt_text= "INSERT INTO t1 (a) VALUES (?)";
rc= mysql_stmt_prepare(stmt, stmt_text, strlen(stmt_text));
check_execute(stmt, rc);
memset(my_bind, 0, sizeof(my_bind));
my_bind[0].buffer= buff;
my_bind[0].length= &length;
my_bind[0].buffer_type= MYSQL_TYPE_STRING;
mysql_stmt_bind_param(stmt, my_bind);
buff[0]= (uchar) 0xC3;
buff[1]= (uchar) 0xA0;
length= 2;
rc= mysql_stmt_execute(stmt);
check_execute(stmt, rc);
stmt_text= "SELECT a FROM t1";
rc= mysql_stmt_prepare(stmt, stmt_text, strlen(stmt_text));
check_execute(stmt, rc);
rc= mysql_stmt_execute(stmt);
check_execute(stmt, rc);
my_bind[0].buffer_length= sizeof(buff);
mysql_stmt_bind_result(stmt, my_bind);
rc= mysql_stmt_fetch(stmt);
DIE_UNLESS(rc == 0);
DIE_UNLESS(length == 1);
DIE_UNLESS((uchar) buff[0] == 0xE0);
rc= mysql_stmt_fetch(stmt);
DIE_UNLESS(rc == MYSQL_NO_DATA);
mysql_stmt_close(stmt);
stmt_text= "DROP TABLE t1";
rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text));
myquery(rc);
stmt_text= "SET NAMES DEFAULT";
rc= mysql_real_query(mysql, stmt_text, strlen(stmt_text));
myquery(rc);
}
|
Safe
|
[
"CWE-284",
"CWE-295"
] |
mysql-server
|
3bd5589e1a5a93f9c224badf983cd65c45215390
|
2.8143403848746087e+38
| 66 |
WL#6791 : Redefine client --ssl option to imply enforced encryption
# Changed the meaning of the --ssl=1 option of all client binaries
to mean force ssl, not try ssl and fail over to eunecrypted
# Added a new MYSQL_OPT_SSL_ENFORCE mysql_options()
option to specify that an ssl connection is required.
# Added a new macro SSL_SET_OPTIONS() to the client
SSL handling headers that sets all the relevant SSL options at
once.
# Revamped all of the current native clients to use the new macro
# Removed some Windows line endings.
# Added proper handling of the new option into the ssl helper
headers.
# If SSL is mandatory assume that the media is secure enough
for the sha256 plugin to do unencrypted password exchange even
before establishing a connection.
# Set the default ssl cipher to DHE-RSA-AES256-SHA if none is
specified.
# updated test cases that require a non-default cipher to spawn
a mysql command line tool binary since mysqltest has no support
for specifying ciphers.
# updated the replication slave connection code to always enforce
SSL if any of the SSL config options is present.
# test cases added and updated.
# added a mysql_get_option() API to return mysql_options()
values. Used the new API inside the sha256 plugin.
# Fixed compilation warnings because of unused variables.
# Fixed test failures (mysql_ssl and bug13115401)
# Fixed whitespace issues.
# Fully implemented the mysql_get_option() function.
# Added a test case for mysql_get_option()
# fixed some trailing whitespace issues
# fixed some uint/int warnings in mysql_client_test.c
# removed shared memory option from non-windows get_options
tests
# moved MYSQL_OPT_LOCAL_INFILE to the uint options
| 0 |
static inline bool __should_serialize_io(struct inode *inode,
struct writeback_control *wbc)
{
if (!S_ISREG(inode->i_mode))
return false;
if (IS_NOQUOTA(inode))
return false;
/* to avoid deadlock in path of data flush */
if (F2FS_I(inode)->cp_task)
return false;
if (wbc->sync_mode != WB_SYNC_ALL)
return true;
if (get_dirty_pages(inode) >= SM_I(F2FS_I_SB(inode))->min_seq_blocks)
return true;
return false;
}
|
Safe
|
[
"CWE-476"
] |
linux
|
4969c06a0d83c9c3dc50b8efcdc8eeedfce896f6
|
1.3246852167130468e+37
| 16 |
f2fs: support swap file w/ DIO
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
| 0 |
Item * all_any_subquery_creator(THD *thd, Item *left_expr,
chooser_compare_func_creator cmp,
bool all,
SELECT_LEX *select_lex)
{
if ((cmp == &comp_eq_creator) && !all) // = ANY <=> IN
return new (thd->mem_root) Item_in_subselect(thd, left_expr, select_lex);
if ((cmp == &comp_ne_creator) && all) // <> ALL <=> NOT IN
return new (thd->mem_root) Item_func_not(thd,
new (thd->mem_root) Item_in_subselect(thd, left_expr, select_lex));
Item_allany_subselect *it=
new (thd->mem_root) Item_allany_subselect(thd, left_expr, cmp, select_lex,
all);
if (all) /* ALL */
return it->upper_item= new (thd->mem_root) Item_func_not_all(thd, it);
/* ANY/SOME */
return it->upper_item= new (thd->mem_root) Item_func_nop_all(thd, it);
}
|
Safe
|
[] |
server
|
ba4927e520190bbad763bb5260ae154f29a61231
|
1.877745810610262e+37
| 21 |
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.
| 0 |
const char *luaG_addinfo (lua_State *L, const char *msg, TString *src,
int line) {
char buff[LUA_IDSIZE];
if (src)
luaO_chunkid(buff, getstr(src), tsslen(src));
else { /* no source available; use "?" instead */
buff[0] = '?'; buff[1] = '\0';
}
return luaO_pushfstring(L, "%s:%d: %s", buff, line, msg);
}
|
Safe
|
[
"CWE-703"
] |
lua
|
a2195644d89812e5b157ce7bac35543e06db05e3
|
2.638870471221863e+38
| 10 |
Fixed bug: invalid 'oldpc' when returning to a function
The field 'L->oldpc' is not always updated when control returns to a
function; an invalid value can seg. fault when computing 'changedline'.
(One example is an error in a finalizer; control can return to
'luaV_execute' without executing 'luaD_poscall'.) Instead of trying to
fix all possible corner cases, it seems safer to be resilient to invalid
values for 'oldpc'. Valid but wrong values at most cause an extra call
to a line hook.
| 0 |
int ssl3_send_newsession_ticket(SSL *s)
{
if (s->state == SSL3_ST_SW_SESSION_TICKET_A)
{
unsigned char *p, *senc, *macstart;
const unsigned char *const_p;
int len, slen_full, slen;
SSL_SESSION *sess;
unsigned int hlen;
EVP_CIPHER_CTX ctx;
HMAC_CTX hctx;
SSL_CTX *tctx = s->initial_ctx;
unsigned char iv[EVP_MAX_IV_LENGTH];
unsigned char key_name[16];
/* get session encoding length */
slen_full = i2d_SSL_SESSION(s->session, NULL);
/* Some length values are 16 bits, so forget it if session is
* too long
*/
if (slen_full > 0xFF00)
return -1;
senc = OPENSSL_malloc(slen_full);
if (!senc)
return -1;
p = senc;
i2d_SSL_SESSION(s->session, &p);
/* create a fresh copy (not shared with other threads) to clean up */
const_p = senc;
sess = d2i_SSL_SESSION(NULL, &const_p, slen_full);
if (sess == NULL)
{
OPENSSL_free(senc);
return -1;
}
sess->session_id_length = 0; /* ID is irrelevant for the ticket */
slen = i2d_SSL_SESSION(sess, NULL);
if (slen > slen_full) /* shouldn't ever happen */
{
OPENSSL_free(senc);
return -1;
}
p = senc;
i2d_SSL_SESSION(sess, &p);
SSL_SESSION_free(sess);
/*-
* Grow buffer if need be: the length calculation is as
* follows handshake_header_length +
* 4 (ticket lifetime hint) + 2 (ticket length) +
* 16 (key name) + max_iv_len (iv length) +
* session_length + max_enc_block_size (max encrypted session
* length) + max_md_size (HMAC).
*/
if (!BUF_MEM_grow(s->init_buf,
SSL_HM_HEADER_LENGTH(s) + 22 + EVP_MAX_IV_LENGTH +
EVP_MAX_BLOCK_LENGTH + EVP_MAX_MD_SIZE + slen))
return -1;
p = ssl_handshake_start(s);
EVP_CIPHER_CTX_init(&ctx);
HMAC_CTX_init(&hctx);
/* Initialize HMAC and cipher contexts. If callback present
* it does all the work otherwise use generated values
* from parent ctx.
*/
if (tctx->tlsext_ticket_key_cb)
{
if (tctx->tlsext_ticket_key_cb(s, key_name, iv, &ctx,
&hctx, 1) < 0)
{
OPENSSL_free(senc);
return -1;
}
}
else
{
RAND_pseudo_bytes(iv, 16);
EVP_EncryptInit_ex(&ctx, EVP_aes_128_cbc(), NULL,
tctx->tlsext_tick_aes_key, iv);
HMAC_Init_ex(&hctx, tctx->tlsext_tick_hmac_key, 16,
tlsext_tick_md(), NULL);
memcpy(key_name, tctx->tlsext_tick_key_name, 16);
}
/* Ticket lifetime hint (advisory only):
* We leave this unspecified for resumed session (for simplicity),
* and guess that tickets for new sessions will live as long
* as their sessions. */
l2n(s->hit ? 0 : s->session->timeout, p);
/* Skip ticket length for now */
p += 2;
/* Output key name */
macstart = p;
memcpy(p, key_name, 16);
p += 16;
/* output IV */
memcpy(p, iv, EVP_CIPHER_CTX_iv_length(&ctx));
p += EVP_CIPHER_CTX_iv_length(&ctx);
/* Encrypt session data */
EVP_EncryptUpdate(&ctx, p, &len, senc, slen);
p += len;
EVP_EncryptFinal(&ctx, p, &len);
p += len;
EVP_CIPHER_CTX_cleanup(&ctx);
HMAC_Update(&hctx, macstart, p - macstart);
HMAC_Final(&hctx, p, &hlen);
HMAC_CTX_cleanup(&hctx);
p += hlen;
/* Now write out lengths: p points to end of data written */
/* Total length */
len = p - ssl_handshake_start(s);
ssl_set_handshake_header(s, SSL3_MT_NEWSESSION_TICKET, len);
/* Skip ticket lifetime hint */
p = ssl_handshake_start(s) + 4;
s2n(len - 6, p);
s->state=SSL3_ST_SW_SESSION_TICKET_B;
OPENSSL_free(senc);
}
/* SSL3_ST_SW_SESSION_TICKET_B */
return ssl_do_write(s);
}
|
Safe
|
[
"CWE-310"
] |
openssl
|
ce325c60c74b0fa784f5872404b722e120e5cab0
|
1.6795874597238043e+38
| 127 |
Only allow ephemeral RSA keys in export ciphersuites.
OpenSSL clients would tolerate temporary RSA keys in non-export
ciphersuites. It also had an option SSL_OP_EPHEMERAL_RSA which
enabled this server side. Remove both options as they are a
protocol violation.
Thanks to Karthikeyan Bhargavan for reporting this issue.
(CVE-2015-0204)
Reviewed-by: Matt Caswell <matt@openssl.org>
| 0 |
l2tp_proto_ver_print(netdissect_options *ndo, const uint16_t *dat, u_int length)
{
if (length < 2) {
ND_PRINT((ndo, "AVP too short"));
return;
}
ND_PRINT((ndo, "%u.%u", (EXTRACT_16BITS(dat) >> 8),
(EXTRACT_16BITS(dat) & 0xff)));
}
|
Safe
|
[
"CWE-125",
"CWE-787"
] |
tcpdump
|
cc4a7391c616be7a64ed65742ef9ed3f106eb165
|
6.813204852715454e+37
| 9 |
CVE-2017-13006/L2TP: Check whether an AVP's content exceeds the AVP length.
It's not good enough to check whether all the data specified by the AVP
length was captured - you also have to check whether that length is
large enough for all the required data in the AVP.
This fixes a buffer over-read discovered by Yannick Formaggio.
Add a test using the capture file supplied by the reporter(s).
| 0 |
trans2_qfsinfo(netdissect_options *ndo,
const u_char *param, const u_char *data, int pcnt, int dcnt)
{
static int level = 0;
const char *fmt="";
if (request) {
ND_TCHECK2(*param, 2);
level = EXTRACT_LE_16BITS(param);
fmt = "InfoLevel=[d]\n";
smb_fdata(ndo, param, fmt, param + pcnt, unicodestr);
} else {
switch (level) {
case 1:
fmt = "idFileSystem=[W]\nSectorUnit=[D]\nUnit=[D]\nAvail=[D]\nSectorSize=[d]\n";
break;
case 2:
fmt = "CreationTime=[T2]VolNameLength=[lb]\nVolumeLabel=[c]\n";
break;
case 0x105:
fmt = "Capabilities=[W]\nMaxFileLen=[D]\nVolNameLen=[lD]\nVolume=[C]\n";
break;
default:
fmt = "UnknownLevel\n";
break;
}
smb_fdata(ndo, data, fmt, data + dcnt, unicodestr);
}
if (dcnt) {
ND_PRINT((ndo, "data:\n"));
smb_print_data(ndo, data, dcnt);
}
return;
trunc:
ND_PRINT((ndo, "%s", tstr));
}
|
Safe
|
[
"CWE-125"
] |
tcpdump
|
96480ab95308cd9234b4f09b175ebf60e17792c6
|
2.055446333092067e+38
| 36 |
(for 4.9.3) SMB: Add two missing bounds checks
| 0 |
rb_str_include(str, arg)
VALUE str, arg;
{
long i;
if (FIXNUM_P(arg)) {
if (memchr(RSTRING(str)->ptr, FIX2INT(arg), RSTRING(str)->len))
return Qtrue;
return Qfalse;
}
StringValue(arg);
i = rb_str_index(str, arg, 0);
if (i == -1) return Qfalse;
return Qtrue;
}
|
Safe
|
[
"CWE-20"
] |
ruby
|
e926ef5233cc9f1035d3d51068abe9df8b5429da
|
4.988312311828118e+37
| 17 |
* random.c (rb_genrand_int32, rb_genrand_real), intern.h: Export.
* string.c (rb_str_tmp_new), intern.h: New function.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@16014 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
| 0 |
static int ZEND_FASTCALL ZEND_INIT_STATIC_METHOD_CALL_SPEC_VAR_CONST_HANDLER(ZEND_OPCODE_HANDLER_ARGS)
{
zend_op *opline = EX(opline);
zval *function_name;
zend_class_entry *ce;
zend_ptr_stack_3_push(&EG(arg_types_stack), EX(fbc), EX(object), EX(called_scope));
if (IS_VAR == IS_CONST) {
/* no function found. try a static method in class */
ce = zend_fetch_class(Z_STRVAL(opline->op1.u.constant), Z_STRLEN(opline->op1.u.constant), opline->extended_value TSRMLS_CC);
if (!ce) {
zend_error_noreturn(E_ERROR, "Class '%s' not found", Z_STRVAL(opline->op1.u.constant));
}
EX(called_scope) = ce;
} else {
ce = EX_T(opline->op1.u.var).class_entry;
if (opline->op1.u.EA.type == ZEND_FETCH_CLASS_PARENT || opline->op1.u.EA.type == ZEND_FETCH_CLASS_SELF) {
EX(called_scope) = EG(called_scope);
} else {
EX(called_scope) = ce;
}
}
if(IS_CONST != IS_UNUSED) {
char *function_name_strval = NULL;
int function_name_strlen = 0;
if (IS_CONST == IS_CONST) {
function_name_strval = Z_STRVAL(opline->op2.u.constant);
function_name_strlen = Z_STRLEN(opline->op2.u.constant);
} else {
function_name = &opline->op2.u.constant;
if (Z_TYPE_P(function_name) != IS_STRING) {
zend_error_noreturn(E_ERROR, "Function name must be a string");
} else {
function_name_strval = Z_STRVAL_P(function_name);
function_name_strlen = Z_STRLEN_P(function_name);
}
}
if (function_name_strval) {
if (ce->get_static_method) {
EX(fbc) = ce->get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC);
} else {
EX(fbc) = zend_std_get_static_method(ce, function_name_strval, function_name_strlen TSRMLS_CC);
}
if (!EX(fbc)) {
zend_error_noreturn(E_ERROR, "Call to undefined method %s::%s()", ce->name, function_name_strval);
}
}
if (IS_CONST != IS_CONST) {
}
} else {
if(!ce->constructor) {
zend_error_noreturn(E_ERROR, "Cannot call constructor");
}
if (EG(This) && Z_OBJCE_P(EG(This)) != ce->constructor->common.scope && (ce->constructor->common.fn_flags & ZEND_ACC_PRIVATE)) {
zend_error(E_COMPILE_ERROR, "Cannot call private %s::__construct()", ce->name);
}
EX(fbc) = ce->constructor;
}
if (EX(fbc)->common.fn_flags & ZEND_ACC_STATIC) {
EX(object) = NULL;
} else {
if (EG(This) &&
Z_OBJ_HT_P(EG(This))->get_class_entry &&
!instanceof_function(Z_OBJCE_P(EG(This)), ce TSRMLS_CC)) {
/* We are calling method of the other (incompatible) class,
but passing $this. This is done for compatibility with php-4. */
int severity;
char *verb;
if (EX(fbc)->common.fn_flags & ZEND_ACC_ALLOW_STATIC) {
severity = E_STRICT;
verb = "should not";
} else {
/* An internal function assumes $this is present and won't check that. So PHP would crash by allowing the call. */
severity = E_ERROR;
verb = "cannot";
}
zend_error(severity, "Non-static method %s::%s() %s be called statically, assuming $this from incompatible context", EX(fbc)->common.scope->name, EX(fbc)->common.function_name, verb);
}
if ((EX(object) = EG(This))) {
Z_ADDREF_P(EX(object));
EX(called_scope) = Z_OBJCE_P(EX(object));
}
}
ZEND_VM_NEXT_OPCODE();
}
|
Safe
|
[] |
php-src
|
ce96fd6b0761d98353761bf78d5bfb55291179fd
|
2.5981134152050597e+38
| 96 |
- fix #39863, do not accept paths with NULL in them. See http://news.php.net/php.internals/50191, trunk will have the patch later (adding a macro and/or changing (some) APIs. Patch by Rasmus
| 0 |
static void nfs4_state_start_reclaim_reboot(struct nfs_client *clp)
{
/* Mark all delegations for reclaim */
nfs_delegation_mark_reclaim(clp);
nfs4_state_mark_reclaim_helper(clp, nfs4_state_mark_reclaim_reboot);
}
|
Safe
|
[
"CWE-703"
] |
linux
|
dc0b027dfadfcb8a5504f7d8052754bf8d501ab9
|
2.234966917415891e+38
| 6 |
NFSv4: Convert the open and close ops to use fmode
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
| 0 |
static zend_bool ZEND_FASTCALL instanceof_interface(const zend_class_entry *instance_ce, const zend_class_entry *ce) /* {{{ */
{
uint32_t i;
if (instance_ce->num_interfaces) {
ZEND_ASSERT(instance_ce->ce_flags & ZEND_ACC_RESOLVED_INTERFACES);
for (i = 0; i < instance_ce->num_interfaces; i++) {
if (instance_ce->interfaces[i] == ce) {
return 1;
}
}
}
return instance_ce == ce;
}
|
Safe
|
[
"CWE-787"
] |
php-src
|
f1ce8d5f5839cb2069ea37ff424fb96b8cd6932d
|
2.5367555397933603e+38
| 14 |
Fix #73122: Integer Overflow when concatenating strings
We must avoid integer overflows in memory allocations, so we introduce
an additional check in the VM, and bail out in the rare case of an
overflow. Since the recent fix for bug #74960 still doesn't catch all
possible overflows, we fix that right away.
| 0 |
GF_Err sdp_box_write(GF_Box *s, GF_BitStream *bs)
{
GF_Err e;
GF_SDPBox *ptr = (GF_SDPBox *)s;
if (ptr == NULL) return GF_BAD_PARAM;
e = gf_isom_box_write_header(s, bs);
if (e) return e;
//don't write the NULL char!!!
if (ptr->sdpText)
gf_bs_write_data(bs, ptr->sdpText, (u32) strlen(ptr->sdpText));
return GF_OK;
}
|
Safe
|
[
"CWE-787"
] |
gpac
|
388ecce75d05e11fc8496aa4857b91245007d26e
|
3.0431447356578572e+38
| 12 |
fixed #1587
| 0 |
void input_set_classic_bonded_only(bool state)
{
classic_bonded_only = state;
}
|
Safe
|
[] |
bluez
|
3cccdbab2324086588df4ccf5f892fb3ce1f1787
|
2.242589752521804e+37
| 4 |
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
| 0 |
static void vmxnet3_setup_rx_filtering(VMXNET3State *s)
{
vmxnet3_update_rx_mode(s);
vmxnet3_update_vlan_filters(s);
vmxnet3_update_mcast_filters(s);
}
|
Safe
|
[
"CWE-20"
] |
qemu
|
a7278b36fcab9af469563bd7b9dadebe2ae25e48
|
5.671580278639667e+37
| 6 |
net/vmxnet3: Refine l2 header validation
Validation of l2 header length assumed minimal packet size as
eth_header + 2 * vlan_header regardless of the actual protocol.
This caused crash for valid non-IP packets shorter than 22 bytes, as
'tx_pkt->packet_type' hasn't been assigned for such packets, and
'vmxnet3_on_tx_done_update_stats()' expects it to be properly set.
Refine header length validation in 'vmxnet_tx_pkt_parse_headers'.
Check its return value during packet processing flow.
As a side effect, in case IPv4 and IPv6 header validation failure,
corrupt packets will be dropped.
Signed-off-by: Dana Rubin <dana.rubin@ravellosystems.com>
Signed-off-by: Shmulik Ladkani <shmulik.ladkani@ravellosystems.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
| 0 |
find_command(int cmdchar)
{
int i;
int idx;
int top, bot;
int c;
// A multi-byte character is never a command.
if (cmdchar >= 0x100)
return -1;
// We use the absolute value of the character. Special keys have a
// negative value, but are sorted on their absolute value.
if (cmdchar < 0)
cmdchar = -cmdchar;
// If the character is in the first part: The character is the index into
// nv_cmd_idx[].
if (cmdchar <= nv_max_linear)
return nv_cmd_idx[cmdchar];
// Perform a binary search.
bot = nv_max_linear + 1;
top = NV_CMDS_SIZE - 1;
idx = -1;
while (bot <= top)
{
i = (top + bot) / 2;
c = nv_cmds[nv_cmd_idx[i]].cmd_char;
if (c < 0)
c = -c;
if (cmdchar == c)
{
idx = nv_cmd_idx[i];
break;
}
if (cmdchar > c)
bot = i + 1;
else
top = i - 1;
}
return idx;
}
|
Safe
|
[
"CWE-416"
] |
vim
|
35a9a00afcb20897d462a766793ff45534810dc3
|
7.910225048452892e+37
| 43 |
patch 8.2.3428: using freed memory when replacing
Problem: Using freed memory when replacing. (Dhiraj Mishra)
Solution: Get the line pointer after calling ins_copychar().
| 0 |
x509_receive_delegation( const char *destination_file,
int (*recv_data_func)(void *, void **, size_t *),
void *recv_data_ptr,
int (*send_data_func)(void *, void *, size_t),
void *send_data_ptr,
void ** state_ptr )
{
#if !defined(HAVE_EXT_GLOBUS)
(void) destination_file; // Quiet compiler warnings
(void) recv_data_func; // Quiet compiler warnings
(void) recv_data_ptr; // Quiet compiler warnings
(void) send_data_func; // Quiet compiler warnings
(void) send_data_ptr; // Quiet compiler warnings
(void) state_ptr; // Quiet compiler warnings
_globus_error_message =
strdup( NOT_SUPPORTED_MSG );
return -1;
#else
int rc = 0;
int error_line = 0;
x509_delegation_state *st = new x509_delegation_state();
st->m_dest = strdup(destination_file);
globus_result_t result = GLOBUS_SUCCESS;
st->m_request_handle = NULL;
globus_gsi_proxy_handle_attrs_t handle_attrs = NULL;
char *buffer = NULL;
size_t buffer_len = 0;
BIO *bio = NULL;
if ( activate_globus_gsi() != 0 ) {
if ( st->m_dest ) { free(st->m_dest); }
delete st;
return -1;
}
// declare some vars we'll need
int globus_bits = 0;
int bits = 0;
int skew = 0;
// prepare any special attributes desired
result = (*globus_gsi_proxy_handle_attrs_init_ptr)( &handle_attrs );
if ( result != GLOBUS_SUCCESS ) {
rc = -1;
error_line = __LINE__;
goto cleanup;
}
// first, get the default that globus is using
result = (*globus_gsi_proxy_handle_attrs_get_keybits_ptr)( handle_attrs, &globus_bits );
if ( result != GLOBUS_SUCCESS ) {
rc = -1;
error_line = __LINE__;
goto cleanup;
}
// as of 2014-01-16, many various pieces of the OSG software stack no
// longer work with proxies less than 1024 bits, so make sure globus is
// defaulting to at least that large
if (globus_bits < 1024) {
globus_bits = 1024;
result = (*globus_gsi_proxy_handle_attrs_set_keybits_ptr)( handle_attrs, globus_bits );
if ( result != GLOBUS_SUCCESS ) {
rc = -1;
error_line = __LINE__;
goto cleanup;
}
}
// also allow the condor admin to increase it if they really feel the need
bits = param_integer("GSI_DELEGATION_KEYBITS", 0);
if (bits > globus_bits) {
result = (*globus_gsi_proxy_handle_attrs_set_keybits_ptr)( handle_attrs, bits );
if ( result != GLOBUS_SUCCESS ) {
rc = -1;
error_line = __LINE__;
goto cleanup;
}
}
// default for clock skew is currently (2013-03-27) 5 minutes, but allow
// that to be changed
skew = param_integer("GSI_DELEGATION_CLOCK_SKEW_ALLOWABLE", 0);
if (skew) {
result = (*globus_gsi_proxy_handle_attrs_set_clock_skew_allowable_ptr)( handle_attrs, skew );
if ( result != GLOBUS_SUCCESS ) {
rc = -1;
error_line = __LINE__;
goto cleanup;
}
}
// Note: inspecting the Globus implementation, globus_gsi_proxy_handle_init creates a copy
// of handle_attrs; hence, it's OK for handle_attrs to be destroyed before m_request_handle.
result = (*globus_gsi_proxy_handle_init_ptr)( &(st->m_request_handle), handle_attrs );
if ( result != GLOBUS_SUCCESS ) {
rc = -1;
error_line = __LINE__;
goto cleanup;
}
bio = BIO_new( BIO_s_mem() );
if ( bio == NULL ) {
rc = -1;
error_line = __LINE__;
goto cleanup;
}
result = (*globus_gsi_proxy_create_req_ptr)( st->m_request_handle, bio );
if ( result != GLOBUS_SUCCESS ) {
rc = -1;
error_line = __LINE__;
goto cleanup;
}
if ( bio_to_buffer( bio, &buffer, &buffer_len ) == FALSE ) {
rc = -1;
error_line = __LINE__;
goto cleanup;
}
BIO_free( bio );
bio = NULL;
if ( send_data_func( send_data_ptr, buffer, buffer_len ) != 0 ) {
rc = -1;
error_line = __LINE__;
goto cleanup;
}
free( buffer );
buffer = NULL;
cleanup:
/* TODO Extract Globus error message if result isn't GLOBUS_SUCCESS */
if ( error_line ) {
char buff[1024];
snprintf( buff, sizeof(buff), "x509_receive_delegation failed "
"at line %d", error_line );
buff[1023] = '\0';
set_error_string( buff );
}
if ( bio ) {
BIO_free( bio );
}
if ( buffer ) {
free( buffer );
}
if (handle_attrs) {
(*globus_gsi_proxy_handle_attrs_destroy_ptr)( handle_attrs );
}
// Error! Cleanup memory immediately and return.
if ( rc && st ) {
if ( st->m_request_handle ) {
(*globus_gsi_proxy_handle_destroy_ptr)( st->m_request_handle );
}
if ( st->m_dest ) { free(st->m_dest); }
delete st;
return rc;
}
// We were given a state pointer - caller will take care of monitoring the
// socket for more data and call delegation_finish later.
if (state_ptr != NULL) {
*state_ptr = st;
return 2;
}
// Else, we block and finish up immediately.
return x509_receive_delegation_finish(recv_data_func, recv_data_ptr, &st);
#endif
}
|
Safe
|
[
"CWE-20"
] |
htcondor
|
2f3c393feb819cf6c6d06fb0a2e9c4e171f3c26d
|
3.3414816662303104e+38
| 176 |
(#6455) Fix issue validating VOMS proxies
| 0 |
MagickExport const char *GetStringInfoPath(const StringInfo *string_info)
{
assert(string_info != (StringInfo *) NULL);
assert(string_info->signature == MagickCoreSignature);
return(string_info->path);
}
|
Safe
|
[
"CWE-190"
] |
ImageMagick
|
be90a5395695f0d19479a5d46b06c678be7f7927
|
3.3670408059611602e+38
| 6 |
https://github.com/ImageMagick/ImageMagick/issues/1721
| 0 |
static struct ip_options *tcp_v4_save_options(struct sock *sk,
struct sk_buff *skb)
{
struct ip_options *opt = &(IPCB(skb)->opt);
struct ip_options *dopt = NULL;
if (opt && opt->optlen) {
int opt_size = optlength(opt);
dopt = kmalloc(opt_size, GFP_ATOMIC);
if (dopt) {
if (ip_options_echo(dopt, skb)) {
kfree(dopt);
dopt = NULL;
}
}
}
return dopt;
}
|
Vulnerable
|
[
"CWE-362"
] |
linux-2.6
|
f6d8bd051c391c1c0458a30b2a7abcd939329259
|
3.2729987881169583e+38
| 18 |
inet: add RCU protection to inet->opt
We lack proper synchronization to manipulate inet->opt ip_options
Problem is ip_make_skb() calls ip_setup_cork() and
ip_setup_cork() possibly makes a copy of ipc->opt (struct ip_options),
without any protection against another thread manipulating inet->opt.
Another thread can change inet->opt pointer and free old one under us.
Use RCU to protect inet->opt (changed to inet->inet_opt).
Instead of handling atomic refcounts, just copy ip_options when
necessary, to avoid cache line dirtying.
We cant insert an rcu_head in struct ip_options since its included in
skb->cb[], so this patch is large because I had to introduce a new
ip_options_rcu structure.
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Cc: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
| 1 |
int imap_sync_message_for_copy (IMAP_DATA *idata, HEADER *hdr, BUFFER *cmd,
int *err_continue)
{
char flags[LONG_STRING];
char uid[11];
if (!compare_flags_for_copy (hdr))
{
if (hdr->deleted == HEADER_DATA(hdr)->deleted)
hdr->changed = 0;
return 0;
}
snprintf (uid, sizeof (uid), "%u", HEADER_DATA(hdr)->uid);
mutt_buffer_clear (cmd);
mutt_buffer_addstr (cmd, "UID STORE ");
mutt_buffer_addstr (cmd, uid);
flags[0] = '\0';
imap_set_flag (idata, MUTT_ACL_SEEN, hdr->read, "\\Seen ",
flags, sizeof (flags));
imap_set_flag (idata, MUTT_ACL_WRITE, hdr->old,
"Old ", flags, sizeof (flags));
imap_set_flag (idata, MUTT_ACL_WRITE, hdr->flagged,
"\\Flagged ", flags, sizeof (flags));
imap_set_flag (idata, MUTT_ACL_WRITE, hdr->replied,
"\\Answered ", flags, sizeof (flags));
imap_set_flag (idata, MUTT_ACL_DELETE, HEADER_DATA(hdr)->deleted,
"\\Deleted ", flags, sizeof (flags));
/* now make sure we don't lose custom tags */
if (mutt_bit_isset (idata->ctx->rights, MUTT_ACL_WRITE))
imap_add_keywords (flags, hdr, idata->flags, sizeof (flags));
mutt_remove_trailing_ws (flags);
/* UW-IMAP is OK with null flags, Cyrus isn't. The only solution is to
* explicitly revoke all system flags (if we have permission) */
if (!*flags)
{
imap_set_flag (idata, MUTT_ACL_SEEN, 1, "\\Seen ", flags, sizeof (flags));
imap_set_flag (idata, MUTT_ACL_WRITE, 1, "Old ", flags, sizeof (flags));
imap_set_flag (idata, MUTT_ACL_WRITE, 1, "\\Flagged ", flags, sizeof (flags));
imap_set_flag (idata, MUTT_ACL_WRITE, 1, "\\Answered ", flags, sizeof (flags));
imap_set_flag (idata, MUTT_ACL_DELETE, !HEADER_DATA(hdr)->deleted,
"\\Deleted ", flags, sizeof (flags));
mutt_remove_trailing_ws (flags);
mutt_buffer_addstr (cmd, " -FLAGS.SILENT (");
}
else
mutt_buffer_addstr (cmd, " FLAGS.SILENT (");
mutt_buffer_addstr (cmd, flags);
mutt_buffer_addstr (cmd, ")");
/* after all this it's still possible to have no flags, if you
* have no ACL rights */
if (*flags && (imap_exec (idata, cmd->data, 0) != 0) &&
err_continue && (*err_continue != MUTT_YES))
{
*err_continue = imap_continue ("imap_sync_message: STORE failed",
idata->buf);
if (*err_continue != MUTT_YES)
return -1;
}
if (hdr->deleted == HEADER_DATA(hdr)->deleted)
hdr->changed = 0;
return 0;
}
|
Safe
|
[
"CWE-200",
"CWE-319"
] |
mutt
|
3e88866dc60b5fa6aaba6fd7c1710c12c1c3cd01
|
2.27784161352878e+38
| 74 |
Prevent possible IMAP MITM via PREAUTH response.
This is similar to CVE-2014-2567 and CVE-2020-12398. STARTTLS is not
allowed in the Authenticated state, so previously Mutt would
implicitly mark the connection as authenticated and skip any
encryption checking/enabling.
No credentials are exposed, but it does allow messages to be sent to
an attacker, via postpone or fcc'ing for instance.
Reuse the $ssl_starttls quadoption "in reverse" to prompt to abort the
connection if it is unencrypted.
Thanks very much to Damian Poddebniak and Fabian Ising from the
Münster University of Applied Sciences for reporting this issue, and
their help in testing the fix.
| 0 |
poppler_layers_iter_free (PopplerLayersIter *iter)
{
if (G_UNLIKELY (iter == nullptr))
return;
g_object_unref (iter->document);
g_slice_free (PopplerLayersIter, iter);
}
|
Safe
|
[
"CWE-476"
] |
poppler
|
f162ecdea0dda5dbbdb45503c1d55d9afaa41d44
|
2.9448618489092465e+38
| 8 |
Fix crash on missing embedded file
Check whether an embedded file is actually present in the PDF
and show warning in that case.
https://bugs.freedesktop.org/show_bug.cgi?id=106137
https://gitlab.freedesktop.org/poppler/poppler/issues/236
| 0 |
static int getPRIi(msg_t *pM)
{
return (pM->iFacility << 3) + (pM->iSeverity);
}
|
Safe
|
[
"CWE-772"
] |
rsyslog
|
8083bd1433449fd2b1b79bf759f782e0f64c0cd2
|
1.586556079688305e+38
| 4 |
backporting abort condition fix from 5.7.7
| 0 |
subst_string(const char *s, const char *sub, int sublen, const char *repl) {
char *n;
n = (char *) xmalloc(strlen(s)-sublen+strlen(repl)+1);
strncpy (n, s, sub-s);
strcpy (n + (sub-s), repl);
strcat (n, sub+sublen);
return n;
}
|
Safe
|
[
"CWE-200"
] |
util-linux
|
0377ef91270d06592a0d4dd009c29e7b1ff9c9b8
|
1.6200095411567314e+38
| 9 |
mount: (deprecated) drop --guess-fstype
The option is undocumented and unnecessary.
Signed-off-by: Karel Zak <kzak@redhat.com>
| 0 |
static double mp_vector_map_vss(_cimg_math_parser& mp) { // Operator(vector,scalar,scalar)
unsigned int
siz = (unsigned int)mp.opcode[2],
ptrs = (unsigned int)mp.opcode[4] + 1;
double *ptrd = &_mp_arg(1) + 1;
mp_func op = (mp_func)mp.opcode[3];
CImg<ulongT> l_opcode(1,5);
l_opcode[3] = mp.opcode[5]; // Scalar argument2
l_opcode[4] = mp.opcode[6]; // Scalar argument3
l_opcode.swap(mp.opcode);
ulongT &argument1 = mp.opcode[2];
while (siz-->0) { argument1 = ptrs++; *(ptrd++) = (*op)(mp); }
l_opcode.swap(mp.opcode);
return cimg::type<double>::nan();
}
|
Safe
|
[
"CWE-770"
] |
cimg
|
619cb58dd90b4e03ac68286c70ed98acbefd1c90
|
3.3217552422232356e+38
| 15 |
CImg<>::load_bmp() and CImg<>::load_pandore(): Check that dimensions encoded in file does not exceed file size.
| 0 |
theora_type_find (GstTypeFind * tf, gpointer private)
{
const guint8 *data = gst_type_find_peek (tf, 0, 7); //42);
if (data) {
if (data[0] != 0x80)
return;
if (memcmp (&data[1], "theora", 6) != 0)
return;
/* FIXME: make this more reliable when specs are out */
gst_type_find_suggest (tf, GST_TYPE_FIND_MAXIMUM, THEORA_CAPS);
}
}
|
Safe
|
[
"CWE-125"
] |
gst-plugins-base
|
2fdccfd64fc609e44e9c4b8eed5bfdc0ab9c9095
|
4.014542925894183e+37
| 14 |
typefind: bounds check windows ico detection
Fixes out of bounds read
https://bugzilla.gnome.org/show_bug.cgi?id=774902
| 0 |
ews_ui_init_memos (GtkUIManager *ui_manager,
EShellView *shell_view,
gchar **ui_definition)
{
g_return_if_fail (ui_definition != NULL);
*ui_definition = g_strdup (ews_ui_memo_def);
setup_ews_source_actions (
shell_view, ui_manager,
memos_context_entries, G_N_ELEMENTS (memos_context_entries));
}
|
Safe
|
[
"CWE-295"
] |
evolution-ews
|
915226eca9454b8b3e5adb6f2fff9698451778de
|
1.9615928893694113e+38
| 12 |
I#27 - SSL Certificates are not validated
This depends on https://gitlab.gnome.org/GNOME/evolution-data-server/commit/6672b8236139bd6ef41ecb915f4c72e2a052dba5 too.
Closes https://gitlab.gnome.org/GNOME/evolution-ews/issues/27
| 0 |
static NTSTATUS pdb_samba_dsdb_delete_alias(struct pdb_methods *m,
const struct dom_sid *sid)
{
const char *attrs[] = { NULL };
struct pdb_samba_dsdb_state *state = talloc_get_type_abort(
m->private_data, struct pdb_samba_dsdb_state);
struct ldb_message *msg;
struct ldb_dn *dn;
int rc;
struct dom_sid_buf buf;
TALLOC_CTX *tmp_ctx = talloc_stackframe();
NT_STATUS_HAVE_NO_MEMORY(tmp_ctx);
dn = ldb_dn_new_fmt(
tmp_ctx,
state->ldb,
"<SID=%s>",
dom_sid_str_buf(sid, &buf));
if (!dn || !ldb_dn_validate(dn)) {
talloc_free(tmp_ctx);
return NT_STATUS_NO_MEMORY;
}
if (ldb_transaction_start(state->ldb) != LDB_SUCCESS) {
DEBUG(0, ("Failed to start transaction in dsdb_add_domain_alias(): %s\n", ldb_errstring(state->ldb)));
talloc_free(tmp_ctx);
return NT_STATUS_INTERNAL_ERROR;
}
rc = dsdb_search_one(state->ldb, tmp_ctx, &msg, dn, LDB_SCOPE_BASE, attrs, 0, "(objectclass=group)"
"(|(grouptype=%d)(grouptype=%d)))",
GTYPE_SECURITY_BUILTIN_LOCAL_GROUP,
GTYPE_SECURITY_DOMAIN_LOCAL_GROUP);
if (rc == LDB_ERR_NO_SUCH_OBJECT) {
talloc_free(tmp_ctx);
ldb_transaction_cancel(state->ldb);
return NT_STATUS_NO_SUCH_ALIAS;
}
rc = ldb_delete(state->ldb, dn);
if (rc == LDB_ERR_NO_SUCH_OBJECT) {
talloc_free(tmp_ctx);
ldb_transaction_cancel(state->ldb);
return NT_STATUS_NO_SUCH_ALIAS;
} else if (rc != LDB_SUCCESS) {
DEBUG(10, ("ldb_delete failed %s\n",
ldb_errstring(state->ldb)));
ldb_transaction_cancel(state->ldb);
talloc_free(tmp_ctx);
return NT_STATUS_LDAP(rc);
}
if (ldb_transaction_commit(state->ldb) != LDB_SUCCESS) {
DEBUG(0, ("Failed to commit transaction in pdb_samba_dsdb_delete_alias(): %s\n",
ldb_errstring(state->ldb)));
talloc_free(tmp_ctx);
return NT_STATUS_INTERNAL_ERROR;
}
talloc_free(tmp_ctx);
return NT_STATUS_OK;
}
|
Safe
|
[
"CWE-200"
] |
samba
|
0a3aa5f908e351201dc9c4d4807b09ed9eedff77
|
2.5392988727973708e+38
| 61 |
CVE-2022-32746 ldb: Make use of functions for appending to an ldb_message
This aims to minimise usage of the error-prone pattern of searching for
a just-added message element in order to make modifications to it (and
potentially finding the wrong element).
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15009
Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
| 0 |
evdev_tag_trackpoint(struct evdev_device *device,
struct udev_device *udev_device)
{
struct quirks_context *quirks;
struct quirks *q;
char *prop;
if (!libevdev_has_property(device->evdev,
INPUT_PROP_POINTING_STICK) &&
!parse_udev_flag(device, udev_device, "ID_INPUT_POINTINGSTICK"))
return;
device->tags |= EVDEV_TAG_TRACKPOINT;
quirks = evdev_libinput_context(device)->quirks;
q = quirks_fetch_for_device(quirks, device->udev_device);
if (q && quirks_get_string(q, QUIRK_ATTR_TRACKPOINT_INTEGRATION, &prop)) {
if (streq(prop, "internal")) {
/* noop, this is the default anyway */
} else if (streq(prop, "external")) {
device->tags |= EVDEV_TAG_EXTERNAL_MOUSE;
evdev_log_info(device,
"is an external pointing stick\n");
} else {
evdev_log_info(device,
"tagged with unknown value %s\n",
prop);
}
}
quirks_unref(q);
}
|
Safe
|
[
"CWE-134"
] |
libinput
|
a423d7d3269dc32a87384f79e29bb5ac021c83d1
|
2.442631300290967e+37
| 32 |
evdev: strip the device name of format directives
This fixes a format string vulnerabilty.
evdev_log_message() composes a format string consisting of a fixed
prefix (including the rendered device name) and the passed-in format
buffer. This format string is then passed with the arguments to the
actual log handler, which usually and eventually ends up being printf.
If the device name contains a printf-style format directive, these ended
up in the format string and thus get interpreted correctly, e.g. for a
device "Foo%sBar" the log message vs printf invocation ends up being:
evdev_log_message(device, "some message %s", "some argument");
printf("event9 - Foo%sBar: some message %s", "some argument");
This can enable an attacker to execute malicious code with the
privileges of the process using libinput.
To exploit this, an attacker needs to be able to create a kernel device
with a malicious name, e.g. through /dev/uinput or a Bluetooth device.
To fix this, convert any potential format directives in the device name
by duplicating percentages.
Pre-rendering the device to avoid the issue altogether would be nicer
but the current log level hooks do not easily allow for this. The device
name is the only user-controlled part of the format string.
A second potential issue is the sysname of the device which is also
sanitized.
This issue was found by Albin Eldstål-Ahrens and Benjamin Svensson from
Assured AB, and independently by Lukas Lamster.
Fixes #752
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
| 0 |
void *Type_LUT16_Read(struct _cms_typehandler_struct* self, cmsIOHANDLER* io, cmsUInt32Number* nItems, cmsUInt32Number SizeOfTag)
{
cmsUInt8Number InputChannels, OutputChannels, CLUTpoints;
cmsPipeline* NewLUT = NULL;
cmsStage *mpemat, *mpeclut;
cmsUInt32Number nTabSize;
cmsFloat64Number Matrix[3*3];
cmsUInt16Number InputEntries, OutputEntries;
*nItems = 0;
if (!_cmsReadUInt8Number(io, &InputChannels)) return NULL;
if (!_cmsReadUInt8Number(io, &OutputChannels)) return NULL;
if (!_cmsReadUInt8Number(io, &CLUTpoints)) return NULL; // 255 maximum
// Padding
if (!_cmsReadUInt8Number(io, NULL)) return NULL;
// Do some checking
if (InputChannels > cmsMAXCHANNELS) goto Error;
if (OutputChannels > cmsMAXCHANNELS) goto Error;
// Allocates an empty LUT
NewLUT = cmsPipelineAlloc(self ->ContextID, InputChannels, OutputChannels);
if (NewLUT == NULL) goto Error;
// Read the Matrix
if (!_cmsRead15Fixed16Number(io, &Matrix[0])) goto Error;
if (!_cmsRead15Fixed16Number(io, &Matrix[1])) goto Error;
if (!_cmsRead15Fixed16Number(io, &Matrix[2])) goto Error;
if (!_cmsRead15Fixed16Number(io, &Matrix[3])) goto Error;
if (!_cmsRead15Fixed16Number(io, &Matrix[4])) goto Error;
if (!_cmsRead15Fixed16Number(io, &Matrix[5])) goto Error;
if (!_cmsRead15Fixed16Number(io, &Matrix[6])) goto Error;
if (!_cmsRead15Fixed16Number(io, &Matrix[7])) goto Error;
if (!_cmsRead15Fixed16Number(io, &Matrix[8])) goto Error;
// Only operates on 3 channels
if ((InputChannels == 3) && !_cmsMAT3isIdentity((cmsMAT3*) Matrix)) {
mpemat = cmsStageAllocMatrix(self ->ContextID, 3, 3, Matrix, NULL);
if (mpemat == NULL) goto Error;
cmsPipelineInsertStage(NewLUT, cmsAT_END, mpemat);
}
if (!_cmsReadUInt16Number(io, &InputEntries)) goto Error;
if (!_cmsReadUInt16Number(io, &OutputEntries)) goto Error;
if (InputEntries > 0x7FFF || OutputEntries > 0x7FFF) goto Error;
if (CLUTpoints == 1) goto Error; // Impossible value, 0 for no CLUT and then 2 at least
// Get input tables
if (!Read16bitTables(self ->ContextID, io, NewLUT, InputChannels, InputEntries)) goto Error;
// Get 3D CLUT
nTabSize = uipow(OutputChannels, CLUTpoints, InputChannels);
if (nTabSize == (cmsUInt32Number) -1) goto Error;
if (nTabSize > 0) {
cmsUInt16Number *T;
T = (cmsUInt16Number*) _cmsCalloc(self ->ContextID, nTabSize, sizeof(cmsUInt16Number));
if (T == NULL) goto Error;
if (!_cmsReadUInt16Array(io, nTabSize, T)) {
_cmsFree(self ->ContextID, T);
goto Error;
}
mpeclut = cmsStageAllocCLut16bit(self ->ContextID, CLUTpoints, InputChannels, OutputChannels, T);
if (mpeclut == NULL) {
_cmsFree(self ->ContextID, T);
goto Error;
}
cmsPipelineInsertStage(NewLUT, cmsAT_END, mpeclut);
_cmsFree(self ->ContextID, T);
}
// Get output tables
if (!Read16bitTables(self ->ContextID, io, NewLUT, OutputChannels, OutputEntries)) goto Error;
*nItems = 1;
return NewLUT;
Error:
if (NewLUT != NULL) cmsPipelineFree(NewLUT);
return NULL;
cmsUNUSED_PARAMETER(SizeOfTag);
}
|
Vulnerable
|
[] |
Little-CMS
|
41d222df1bc6188131a8f46c32eab0a4d4cdf1b6
|
1.2968964964501204e+38
| 93 |
Memory squeezing fix: lcms2 cmsPipeline construction
When creating a new pipeline, lcms would often try to allocate a stage
and pass it to cmsPipelineInsertStage without checking whether the
allocation succeeded. cmsPipelineInsertStage would then assert (or crash)
if it had not.
The fix here is to change cmsPipelineInsertStage to check and return
an error value. All calling code is then checked to test this return
value and cope.
| 1 |
ModuleExport size_t RegisterPCXImage(void)
{
MagickInfo
*entry;
entry=SetMagickInfo("DCX");
entry->decoder=(DecodeImageHandler *) ReadPCXImage;
entry->encoder=(EncodeImageHandler *) WritePCXImage;
entry->seekable_stream=MagickTrue;
entry->magick=(IsImageFormatHandler *) IsDCX;
entry->description=ConstantString("ZSoft IBM PC multi-page Paintbrush");
entry->module=ConstantString("PCX");
(void) RegisterMagickInfo(entry);
entry=SetMagickInfo("PCX");
entry->decoder=(DecodeImageHandler *) ReadPCXImage;
entry->encoder=(EncodeImageHandler *) WritePCXImage;
entry->magick=(IsImageFormatHandler *) IsPCX;
entry->adjoin=MagickFalse;
entry->seekable_stream=MagickTrue;
entry->description=ConstantString("ZSoft IBM PC Paintbrush");
entry->module=ConstantString("PCX");
(void) RegisterMagickInfo(entry);
return(MagickImageCoderSignature);
}
|
Safe
|
[
"CWE-401"
] |
ImageMagick6
|
210474b2fac6a661bfa7ed563213920e93e76395
|
3.395666174280386e+38
| 24 |
Fix ultra rare but potential memory-leak
| 0 |
int tinfl_decompress_mem_to_callback(const void *pIn_buf, size_t *pIn_buf_size,
tinfl_put_buf_func_ptr pPut_buf_func,
void *pPut_buf_user, int flags) {
int result = 0;
tinfl_decompressor decomp;
mz_uint8 *pDict = (mz_uint8 *)MZ_MALLOC(TINFL_LZ_DICT_SIZE);
size_t in_buf_ofs = 0, dict_ofs = 0;
if (!pDict) return TINFL_STATUS_FAILED;
tinfl_init(&decomp);
for (;;) {
size_t in_buf_size = *pIn_buf_size - in_buf_ofs,
dst_buf_size = TINFL_LZ_DICT_SIZE - dict_ofs;
tinfl_status status =
tinfl_decompress(&decomp, (const mz_uint8 *)pIn_buf + in_buf_ofs,
&in_buf_size, pDict, pDict + dict_ofs, &dst_buf_size,
(flags & ~(TINFL_FLAG_HAS_MORE_INPUT |
TINFL_FLAG_USING_NON_WRAPPING_OUTPUT_BUF)));
in_buf_ofs += in_buf_size;
if ((dst_buf_size) &&
(!(*pPut_buf_func)(pDict + dict_ofs, (int)dst_buf_size, pPut_buf_user)))
break;
if (status != TINFL_STATUS_HAS_MORE_OUTPUT) {
result = (status == TINFL_STATUS_DONE);
break;
}
dict_ofs = (dict_ofs + dst_buf_size) & (TINFL_LZ_DICT_SIZE - 1);
}
MZ_FREE(pDict);
*pIn_buf_size = in_buf_ofs;
return result;
}
|
Safe
|
[
"CWE-20",
"CWE-190"
] |
tinyexr
|
a685e3332f61cd4e59324bf3f669d36973d64270
|
2.6323848851777268e+38
| 31 |
Make line_no with too large value(2**20) invalid. Fixes #124
| 0 |
explicit RemoveStackSliceSameAxis(const GraphOptimizerContext& ctx,
const ArithmeticOptimizerContext& ctx_ext)
: ArithmeticOptimizerStage("RemoveStackStridedSliceSameAxis", ctx,
ctx_ext) {}
|
Safe
|
[
"CWE-476"
] |
tensorflow
|
e6340f0665d53716ef3197ada88936c2a5f7a2d3
|
3.157531288506248e+38
| 4 |
Handle a special grappler case resulting in crash.
It might happen that a malformed input could be used to trick Grappler into trying to optimize a node with no inputs. This, in turn, would produce a null pointer dereference and a segfault.
PiperOrigin-RevId: 369242852
Change-Id: I2e5cbe7aec243d34a6d60220ac8ac9b16f136f6b
| 0 |
void kernel_restart_prepare(char *cmd)
{
blocking_notifier_call_chain(&reboot_notifier_list, SYS_RESTART, cmd);
system_state = SYSTEM_RESTART;
usermodehelper_disable();
device_shutdown();
syscore_shutdown();
}
|
Safe
|
[
"CWE-264"
] |
linux
|
259e5e6c75a910f3b5e656151dc602f53f9d7548
|
3.0973631481434507e+38
| 8 |
Add PR_{GET,SET}_NO_NEW_PRIVS to prevent execve from granting privs
With this change, calling
prctl(PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0)
disables privilege granting operations at execve-time. For example, a
process will not be able to execute a setuid binary to change their uid
or gid if this bit is set. The same is true for file capabilities.
Additionally, LSM_UNSAFE_NO_NEW_PRIVS is defined to ensure that
LSMs respect the requested behavior.
To determine if the NO_NEW_PRIVS bit is set, a task may call
prctl(PR_GET_NO_NEW_PRIVS, 0, 0, 0, 0);
It returns 1 if set and 0 if it is not set. If any of the arguments are
non-zero, it will return -1 and set errno to -EINVAL.
(PR_SET_NO_NEW_PRIVS behaves similarly.)
This functionality is desired for the proposed seccomp filter patch
series. By using PR_SET_NO_NEW_PRIVS, it allows a task to modify the
system call behavior for itself and its child tasks without being
able to impact the behavior of a more privileged task.
Another potential use is making certain privileged operations
unprivileged. For example, chroot may be considered "safe" if it cannot
affect privileged tasks.
Note, this patch causes execve to fail when PR_SET_NO_NEW_PRIVS is
set and AppArmor is in use. It is fixed in a subsequent patch.
Signed-off-by: Andy Lutomirski <luto@amacapital.net>
Signed-off-by: Will Drewry <wad@chromium.org>
Acked-by: Eric Paris <eparis@redhat.com>
Acked-by: Kees Cook <keescook@chromium.org>
v18: updated change desc
v17: using new define values as per 3.4
Signed-off-by: James Morris <james.l.morris@oracle.com>
| 0 |
format_SET_IP_DSCP(const struct ofpact_dscp *a,
const struct ofpact_format_params *fp)
{
ds_put_format(fp->s, "%smod_nw_tos:%s%d",
colors.param, colors.end, a->dscp);
}
|
Safe
|
[
"CWE-416"
] |
ovs
|
77cccc74deede443e8b9102299efc869a52b65b2
|
6.879945642562584e+37
| 6 |
ofp-actions: Fix use-after-free while decoding RAW_ENCAP.
While decoding RAW_ENCAP action, decode_ed_prop() might re-allocate
ofpbuf if there is no enough space left. However, function
'decode_NXAST_RAW_ENCAP' continues to use old pointer to 'encap'
structure leading to write-after-free and incorrect decoding.
==3549105==ERROR: AddressSanitizer: heap-use-after-free on address
0x60600000011a at pc 0x0000005f6cc6 bp 0x7ffc3a2d4410 sp 0x7ffc3a2d4408
WRITE of size 2 at 0x60600000011a thread T0
#0 0x5f6cc5 in decode_NXAST_RAW_ENCAP lib/ofp-actions.c:4461:20
#1 0x5f0551 in ofpact_decode ./lib/ofp-actions.inc2:4777:16
#2 0x5ed17c in ofpacts_decode lib/ofp-actions.c:7752:21
#3 0x5eba9a in ofpacts_pull_openflow_actions__ lib/ofp-actions.c:7791:13
#4 0x5eb9fc in ofpacts_pull_openflow_actions lib/ofp-actions.c:7835:12
#5 0x64bb8b in ofputil_decode_packet_out lib/ofp-packet.c:1113:17
#6 0x65b6f4 in ofp_print_packet_out lib/ofp-print.c:148:13
#7 0x659e3f in ofp_to_string__ lib/ofp-print.c:1029:16
#8 0x659b24 in ofp_to_string lib/ofp-print.c:1244:21
#9 0x65a28c in ofp_print lib/ofp-print.c:1288:28
#10 0x540d11 in ofctl_ofp_parse utilities/ovs-ofctl.c:2814:9
#11 0x564228 in ovs_cmdl_run_command__ lib/command-line.c:247:17
#12 0x56408a in ovs_cmdl_run_command lib/command-line.c:278:5
#13 0x5391ae in main utilities/ovs-ofctl.c:179:9
#14 0x7f6911ce9081 in __libc_start_main (/lib64/libc.so.6+0x27081)
#15 0x461fed in _start (utilities/ovs-ofctl+0x461fed)
Fix that by getting a new pointer before using.
Credit to OSS-Fuzz.
Fuzzer regression test will fail only with AddressSanitizer enabled.
Reported-at: https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=27851
Fixes: f839892a206a ("OF support and translation of generic encap and decap")
Acked-by: William Tu <u9012063@gmail.com>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
| 0 |
void Monitor::_finish_svc_election()
{
assert(state == STATE_LEADER || state == STATE_PEON);
for (auto p : paxos_service) {
// we already called election_finished() on monmon(); avoid callig twice
if (state == STATE_LEADER && p == monmon())
continue;
p->election_finished();
}
}
|
Safe
|
[
"CWE-287",
"CWE-284"
] |
ceph
|
5ead97120e07054d80623dada90a5cc764c28468
|
1.7001752898525333e+38
| 11 |
auth/cephx: add authorizer challenge
Allow the accepting side of a connection to reject an initial authorizer
with a random challenge. The connecting side then has to respond with an
updated authorizer proving they are able to decrypt the service's challenge
and that the new authorizer was produced for this specific connection
instance.
The accepting side requires this challenge and response unconditionally
if the client side advertises they have the feature bit. Servers wishing
to require this improved level of authentication simply have to require
the appropriate feature.
Signed-off-by: Sage Weil <sage@redhat.com>
(cherry picked from commit f80b848d3f830eb6dba50123e04385173fa4540b)
# Conflicts:
# src/auth/Auth.h
# src/auth/cephx/CephxProtocol.cc
# src/auth/cephx/CephxProtocol.h
# src/auth/none/AuthNoneProtocol.h
# src/msg/Dispatcher.h
# src/msg/async/AsyncConnection.cc
- const_iterator
- ::decode vs decode
- AsyncConnection ctor arg noise
- get_random_bytes(), not cct->random()
| 0 |
void CLASS ahd_interpolate_green_h_and_v(int top, int left, ushort (*out_rgb)[TS][TS][3])
{
int row, col;
int c, val;
ushort(*pix)[4];
const int rowlimit = MIN(top + TS, height - 2);
const int collimit = MIN(left + TS, width - 2);
for (row = top; row < rowlimit; row++)
{
col = left + (FC(row, left) & 1);
for (c = FC(row, col); col < collimit; col += 2)
{
pix = image + row * width + col;
val = ((pix[-1][1] + pix[0][c] + pix[1][1]) * 2 - pix[-2][c] - pix[2][c]) >> 2;
out_rgb[0][row - top][col - left][1] = ULIM(val, pix[-1][1], pix[1][1]);
val = ((pix[-width][1] + pix[0][c] + pix[width][1]) * 2 - pix[-2 * width][c] - pix[2 * width][c]) >> 2;
out_rgb[1][row - top][col - left][1] = ULIM(val, pix[-width][1], pix[width][1]);
}
}
}
|
Safe
|
[
"CWE-476",
"CWE-119"
] |
LibRaw
|
d7c3d2cb460be10a3ea7b32e9443a83c243b2251
|
2.3539114596339167e+38
| 21 |
Secunia SA75000 advisory: several buffer overruns
| 0 |
void __qdisc_run(struct net_device *dev)
{
do {
if (!qdisc_restart(dev))
break;
} while (!netif_queue_stopped(dev));
clear_bit(__LINK_STATE_QDISC_RUNNING, &dev->state);
}
|
Vulnerable
|
[
"CWE-399"
] |
linux-2.6
|
2ba2506ca7ca62c56edaa334b0fe61eb5eab6ab0
|
2.887847637519912e+38
| 9 |
[NET]: Add preemption point in qdisc_run
The qdisc_run loop is currently unbounded and runs entirely in a
softirq. This is bad as it may create an unbounded softirq run.
This patch fixes this by calling need_resched and breaking out if
necessary.
It also adds a break out if the jiffies value changes since that would
indicate we've been transmitting for too long which starves other
softirqs.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
| 1 |
ipmi_lan_set_vlan_id(struct ipmi_intf *intf, uint8_t chan, char *string)
{
struct lan_param *p;
uint8_t data[2];
int rc = -1;
if (!string) { /* request to disable VLAN */
lprintf(LOG_DEBUG, "Get current VLAN ID from BMC.");
p = get_lan_param(intf, chan, IPMI_LANP_VLAN_ID);
if (p && p->data && p->data_len > 1) {
int id = ((p->data[1] & 0x0f) << 8) + p->data[0];
if (IPMI_LANP_VLAN_DISABLE == id) {
printf("VLAN is already disabled for channel %"
PRIu8 "\n", chan);
rc = 0;
goto out;
}
if (!IPMI_LANP_IS_VLAN_VALID(id)) {
lprintf(LOG_ERR,
"Retrieved VLAN ID %i is out of "
"range <%d..%d>.",
id,
IPMI_LANP_VLAN_ID_MIN,
IPMI_LANP_VLAN_ID_MAX);
goto out;
}
data[0] = p->data[0];
data[1] = p->data[1] & 0x0F;
} else {
data[0] = 0;
data[1] = 0;
}
}
else {
int id = 0;
if (str2int(string, &id) != 0) {
lprintf(LOG_ERR,
"Given VLAN ID '%s' is invalid.",
string);
goto out;
}
if (!IPMI_LANP_IS_VLAN_VALID(id)) {
lprintf(LOG_NOTICE,
"VLAN ID must be between %d and %d.",
IPMI_LANP_VLAN_ID_MIN,
IPMI_LANP_VLAN_ID_MAX);
goto out;
}
else {
data[0] = (uint8_t)id;
data[1] = (uint8_t)(id >> 8) | 0x80;
}
}
rc = set_lan_param(intf, chan, IPMI_LANP_VLAN_ID, data, 2);
out:
return rc;
}
|
Safe
|
[
"CWE-120"
] |
ipmitool
|
d45572d71e70840e0d4c50bf48218492b79c1a10
|
2.95354406938704e+37
| 59 |
lanp: Fix buffer overflows in get_lan_param_select
Partial fix for CVE-2020-5208, see
https://github.com/ipmitool/ipmitool/security/advisories/GHSA-g659-9qxw-p7cp
The `get_lan_param_select` function is missing a validation check on the
response’s `data_len`, which it then returns to caller functions, where
stack buffer overflow can occur.
| 0 |
int vt_ioctl(struct tty_struct *tty,
unsigned int cmd, unsigned long arg)
{
struct vc_data *vc = tty->driver_data;
struct console_font_op op; /* used in multiple places here */
unsigned int console;
unsigned char ucval;
unsigned int uival;
void __user *up = (void __user *)arg;
int i, perm;
int ret = 0;
console = vc->vc_num;
if (!vc_cons_allocated(console)) { /* impossible? */
ret = -ENOIOCTLCMD;
goto out;
}
/*
* To have permissions to do most of the vt ioctls, we either have
* to be the owner of the tty, or have CAP_SYS_TTY_CONFIG.
*/
perm = 0;
if (current->signal->tty == tty || capable(CAP_SYS_TTY_CONFIG))
perm = 1;
switch (cmd) {
case TIOCLINUX:
ret = tioclinux(tty, arg);
break;
case KIOCSOUND:
if (!perm)
return -EPERM;
/*
* The use of PIT_TICK_RATE is historic, it used to be
* the platform-dependent CLOCK_TICK_RATE between 2.6.12
* and 2.6.36, which was a minor but unfortunate ABI
* change. kd_mksound is locked by the input layer.
*/
if (arg)
arg = PIT_TICK_RATE / arg;
kd_mksound(arg, 0);
break;
case KDMKTONE:
if (!perm)
return -EPERM;
{
unsigned int ticks, count;
/*
* Generate the tone for the appropriate number of ticks.
* If the time is zero, turn off sound ourselves.
*/
ticks = msecs_to_jiffies((arg >> 16) & 0xffff);
count = ticks ? (arg & 0xffff) : 0;
if (count)
count = PIT_TICK_RATE / count;
kd_mksound(count, ticks);
break;
}
case KDGKBTYPE:
/*
* this is naïve.
*/
ucval = KB_101;
ret = put_user(ucval, (char __user *)arg);
break;
/*
* These cannot be implemented on any machine that implements
* ioperm() in user level (such as Alpha PCs) or not at all.
*
* XXX: you should never use these, just call ioperm directly..
*/
#ifdef CONFIG_X86
case KDADDIO:
case KDDELIO:
/*
* KDADDIO and KDDELIO may be able to add ports beyond what
* we reject here, but to be safe...
*
* These are locked internally via sys_ioperm
*/
if (arg < GPFIRST || arg > GPLAST) {
ret = -EINVAL;
break;
}
ret = ksys_ioperm(arg, 1, (cmd == KDADDIO)) ? -ENXIO : 0;
break;
case KDENABIO:
case KDDISABIO:
ret = ksys_ioperm(GPFIRST, GPNUM,
(cmd == KDENABIO)) ? -ENXIO : 0;
break;
#endif
/* Linux m68k/i386 interface for setting the keyboard delay/repeat rate */
case KDKBDREP:
{
struct kbd_repeat kbrep;
if (!capable(CAP_SYS_TTY_CONFIG))
return -EPERM;
if (copy_from_user(&kbrep, up, sizeof(struct kbd_repeat))) {
ret = -EFAULT;
break;
}
ret = kbd_rate(&kbrep);
if (ret)
break;
if (copy_to_user(up, &kbrep, sizeof(struct kbd_repeat)))
ret = -EFAULT;
break;
}
case KDSETMODE:
/*
* currently, setting the mode from KD_TEXT to KD_GRAPHICS
* doesn't do a whole lot. i'm not sure if it should do any
* restoration of modes or what...
*
* XXX It should at least call into the driver, fbdev's definitely
* need to restore their engine state. --BenH
*/
if (!perm)
return -EPERM;
switch (arg) {
case KD_GRAPHICS:
break;
case KD_TEXT0:
case KD_TEXT1:
arg = KD_TEXT;
case KD_TEXT:
break;
default:
ret = -EINVAL;
goto out;
}
/* FIXME: this needs the console lock extending */
if (vc->vc_mode == (unsigned char) arg)
break;
vc->vc_mode = (unsigned char) arg;
if (console != fg_console)
break;
/*
* explicitly blank/unblank the screen if switching modes
*/
console_lock();
if (arg == KD_TEXT)
do_unblank_screen(1);
else
do_blank_screen(1);
console_unlock();
break;
case KDGETMODE:
uival = vc->vc_mode;
goto setint;
case KDMAPDISP:
case KDUNMAPDISP:
/*
* these work like a combination of mmap and KDENABIO.
* this could be easily finished.
*/
ret = -EINVAL;
break;
case KDSKBMODE:
if (!perm)
return -EPERM;
ret = vt_do_kdskbmode(console, arg);
if (ret == 0)
tty_ldisc_flush(tty);
break;
case KDGKBMODE:
uival = vt_do_kdgkbmode(console);
ret = put_user(uival, (int __user *)arg);
break;
/* this could be folded into KDSKBMODE, but for compatibility
reasons it is not so easy to fold KDGKBMETA into KDGKBMODE */
case KDSKBMETA:
ret = vt_do_kdskbmeta(console, arg);
break;
case KDGKBMETA:
/* FIXME: should review whether this is worth locking */
uival = vt_do_kdgkbmeta(console);
setint:
ret = put_user(uival, (int __user *)arg);
break;
case KDGETKEYCODE:
case KDSETKEYCODE:
if(!capable(CAP_SYS_TTY_CONFIG))
perm = 0;
ret = vt_do_kbkeycode_ioctl(cmd, up, perm);
break;
case KDGKBENT:
case KDSKBENT:
ret = vt_do_kdsk_ioctl(cmd, up, perm, console);
break;
case KDGKBSENT:
case KDSKBSENT:
ret = vt_do_kdgkb_ioctl(cmd, up, perm);
break;
/* Diacritical processing. Handled in keyboard.c as it has
to operate on the keyboard locks and structures */
case KDGKBDIACR:
case KDGKBDIACRUC:
case KDSKBDIACR:
case KDSKBDIACRUC:
ret = vt_do_diacrit(cmd, up, perm);
break;
/* the ioctls below read/set the flags usually shown in the leds */
/* don't use them - they will go away without warning */
case KDGKBLED:
case KDSKBLED:
case KDGETLED:
case KDSETLED:
ret = vt_do_kdskled(console, cmd, arg, perm);
break;
/*
* A process can indicate its willingness to accept signals
* generated by pressing an appropriate key combination.
* Thus, one can have a daemon that e.g. spawns a new console
* upon a keypress and then changes to it.
* See also the kbrequest field of inittab(5).
*/
case KDSIGACCEPT:
{
if (!perm || !capable(CAP_KILL))
return -EPERM;
if (!valid_signal(arg) || arg < 1 || arg == SIGKILL)
ret = -EINVAL;
else {
spin_lock_irq(&vt_spawn_con.lock);
put_pid(vt_spawn_con.pid);
vt_spawn_con.pid = get_pid(task_pid(current));
vt_spawn_con.sig = arg;
spin_unlock_irq(&vt_spawn_con.lock);
}
break;
}
case VT_SETMODE:
{
struct vt_mode tmp;
if (!perm)
return -EPERM;
if (copy_from_user(&tmp, up, sizeof(struct vt_mode))) {
ret = -EFAULT;
goto out;
}
if (tmp.mode != VT_AUTO && tmp.mode != VT_PROCESS) {
ret = -EINVAL;
goto out;
}
console_lock();
vc->vt_mode = tmp;
/* the frsig is ignored, so we set it to 0 */
vc->vt_mode.frsig = 0;
put_pid(vc->vt_pid);
vc->vt_pid = get_pid(task_pid(current));
/* no switch is required -- saw@shade.msu.ru */
vc->vt_newvt = -1;
console_unlock();
break;
}
case VT_GETMODE:
{
struct vt_mode tmp;
int rc;
console_lock();
memcpy(&tmp, &vc->vt_mode, sizeof(struct vt_mode));
console_unlock();
rc = copy_to_user(up, &tmp, sizeof(struct vt_mode));
if (rc)
ret = -EFAULT;
break;
}
/*
* Returns global vt state. Note that VT 0 is always open, since
* it's an alias for the current VT, and people can't use it here.
* We cannot return state for more than 16 VTs, since v_state is short.
*/
case VT_GETSTATE:
{
struct vt_stat __user *vtstat = up;
unsigned short state, mask;
/* Review: FIXME: Console lock ? */
if (put_user(fg_console + 1, &vtstat->v_active))
ret = -EFAULT;
else {
state = 1; /* /dev/tty0 is always open */
for (i = 0, mask = 2; i < MAX_NR_CONSOLES && mask;
++i, mask <<= 1)
if (VT_IS_IN_USE(i))
state |= mask;
ret = put_user(state, &vtstat->v_state);
}
break;
}
/*
* Returns the first available (non-opened) console.
*/
case VT_OPENQRY:
/* FIXME: locking ? - but then this is a stupid API */
for (i = 0; i < MAX_NR_CONSOLES; ++i)
if (! VT_IS_IN_USE(i))
break;
uival = i < MAX_NR_CONSOLES ? (i+1) : -1;
goto setint;
/*
* ioctl(fd, VT_ACTIVATE, num) will cause us to switch to vt # num,
* with num >= 1 (switches to vt 0, our console, are not allowed, just
* to preserve sanity).
*/
case VT_ACTIVATE:
if (!perm)
return -EPERM;
if (arg == 0 || arg > MAX_NR_CONSOLES)
ret = -ENXIO;
else {
arg--;
console_lock();
ret = vc_allocate(arg);
console_unlock();
if (ret)
break;
set_console(arg);
}
break;
case VT_SETACTIVATE:
{
struct vt_setactivate vsa;
if (!perm)
return -EPERM;
if (copy_from_user(&vsa, (struct vt_setactivate __user *)arg,
sizeof(struct vt_setactivate))) {
ret = -EFAULT;
goto out;
}
if (vsa.console == 0 || vsa.console > MAX_NR_CONSOLES)
ret = -ENXIO;
else {
vsa.console = array_index_nospec(vsa.console,
MAX_NR_CONSOLES + 1);
vsa.console--;
console_lock();
ret = vc_allocate(vsa.console);
if (ret == 0) {
struct vc_data *nvc;
/* This is safe providing we don't drop the
console sem between vc_allocate and
finishing referencing nvc */
nvc = vc_cons[vsa.console].d;
nvc->vt_mode = vsa.mode;
nvc->vt_mode.frsig = 0;
put_pid(nvc->vt_pid);
nvc->vt_pid = get_pid(task_pid(current));
}
console_unlock();
if (ret)
break;
/* Commence switch and lock */
/* Review set_console locks */
set_console(vsa.console);
}
break;
}
/*
* wait until the specified VT has been activated
*/
case VT_WAITACTIVE:
if (!perm)
return -EPERM;
if (arg == 0 || arg > MAX_NR_CONSOLES)
ret = -ENXIO;
else
ret = vt_waitactive(arg);
break;
/*
* If a vt is under process control, the kernel will not switch to it
* immediately, but postpone the operation until the process calls this
* ioctl, allowing the switch to complete.
*
* According to the X sources this is the behavior:
* 0: pending switch-from not OK
* 1: pending switch-from OK
* 2: completed switch-to OK
*/
case VT_RELDISP:
if (!perm)
return -EPERM;
console_lock();
if (vc->vt_mode.mode != VT_PROCESS) {
console_unlock();
ret = -EINVAL;
break;
}
/*
* Switching-from response
*/
if (vc->vt_newvt >= 0) {
if (arg == 0)
/*
* Switch disallowed, so forget we were trying
* to do it.
*/
vc->vt_newvt = -1;
else {
/*
* The current vt has been released, so
* complete the switch.
*/
int newvt;
newvt = vc->vt_newvt;
vc->vt_newvt = -1;
ret = vc_allocate(newvt);
if (ret) {
console_unlock();
break;
}
/*
* When we actually do the console switch,
* make sure we are atomic with respect to
* other console switches..
*/
complete_change_console(vc_cons[newvt].d);
}
} else {
/*
* Switched-to response
*/
/*
* If it's just an ACK, ignore it
*/
if (arg != VT_ACKACQ)
ret = -EINVAL;
}
console_unlock();
break;
/*
* Disallocate memory associated to VT (but leave VT1)
*/
case VT_DISALLOCATE:
if (arg > MAX_NR_CONSOLES) {
ret = -ENXIO;
break;
}
if (arg == 0)
vt_disallocate_all();
else
ret = vt_disallocate(--arg);
break;
case VT_RESIZE:
{
struct vt_sizes __user *vtsizes = up;
struct vc_data *vc;
ushort ll,cc;
if (!perm)
return -EPERM;
if (get_user(ll, &vtsizes->v_rows) ||
get_user(cc, &vtsizes->v_cols))
ret = -EFAULT;
else {
console_lock();
for (i = 0; i < MAX_NR_CONSOLES; i++) {
vc = vc_cons[i].d;
if (vc) {
vc->vc_resize_user = 1;
/* FIXME: review v tty lock */
vc_resize(vc_cons[i].d, cc, ll);
}
}
console_unlock();
}
break;
}
case VT_RESIZEX:
{
struct vt_consize v;
if (!perm)
return -EPERM;
if (copy_from_user(&v, up, sizeof(struct vt_consize)))
return -EFAULT;
/* FIXME: Should check the copies properly */
if (!v.v_vlin)
v.v_vlin = vc->vc_scan_lines;
if (v.v_clin) {
int rows = v.v_vlin/v.v_clin;
if (v.v_rows != rows) {
if (v.v_rows) /* Parameters don't add up */
return -EINVAL;
v.v_rows = rows;
}
}
if (v.v_vcol && v.v_ccol) {
int cols = v.v_vcol/v.v_ccol;
if (v.v_cols != cols) {
if (v.v_cols)
return -EINVAL;
v.v_cols = cols;
}
}
if (v.v_clin > 32)
return -EINVAL;
for (i = 0; i < MAX_NR_CONSOLES; i++) {
struct vc_data *vcp;
if (!vc_cons[i].d)
continue;
console_lock();
vcp = vc_cons[i].d;
if (vcp) {
if (v.v_vlin)
vcp->vc_scan_lines = v.v_vlin;
if (v.v_clin)
vcp->vc_font.height = v.v_clin;
vcp->vc_resize_user = 1;
vc_resize(vcp, v.v_cols, v.v_rows);
}
console_unlock();
}
break;
}
case PIO_FONT: {
if (!perm)
return -EPERM;
op.op = KD_FONT_OP_SET;
op.flags = KD_FONT_FLAG_OLD | KD_FONT_FLAG_DONT_RECALC; /* Compatibility */
op.width = 8;
op.height = 0;
op.charcount = 256;
op.data = up;
ret = con_font_op(vc_cons[fg_console].d, &op);
break;
}
case GIO_FONT: {
op.op = KD_FONT_OP_GET;
op.flags = KD_FONT_FLAG_OLD;
op.width = 8;
op.height = 32;
op.charcount = 256;
op.data = up;
ret = con_font_op(vc_cons[fg_console].d, &op);
break;
}
case PIO_CMAP:
if (!perm)
ret = -EPERM;
else
ret = con_set_cmap(up);
break;
case GIO_CMAP:
ret = con_get_cmap(up);
break;
case PIO_FONTX:
case GIO_FONTX:
ret = do_fontx_ioctl(cmd, up, perm, &op);
break;
case PIO_FONTRESET:
{
if (!perm)
return -EPERM;
#ifdef BROKEN_GRAPHICS_PROGRAMS
/* With BROKEN_GRAPHICS_PROGRAMS defined, the default
font is not saved. */
ret = -ENOSYS;
break;
#else
{
op.op = KD_FONT_OP_SET_DEFAULT;
op.data = NULL;
ret = con_font_op(vc_cons[fg_console].d, &op);
if (ret)
break;
console_lock();
con_set_default_unimap(vc_cons[fg_console].d);
console_unlock();
break;
}
#endif
}
case KDFONTOP: {
if (copy_from_user(&op, up, sizeof(op))) {
ret = -EFAULT;
break;
}
if (!perm && op.op != KD_FONT_OP_GET)
return -EPERM;
ret = con_font_op(vc, &op);
if (ret)
break;
if (copy_to_user(up, &op, sizeof(op)))
ret = -EFAULT;
break;
}
case PIO_SCRNMAP:
if (!perm)
ret = -EPERM;
else
ret = con_set_trans_old(up);
break;
case GIO_SCRNMAP:
ret = con_get_trans_old(up);
break;
case PIO_UNISCRNMAP:
if (!perm)
ret = -EPERM;
else
ret = con_set_trans_new(up);
break;
case GIO_UNISCRNMAP:
ret = con_get_trans_new(up);
break;
case PIO_UNIMAPCLR:
if (!perm)
return -EPERM;
con_clear_unimap(vc);
break;
case PIO_UNIMAP:
case GIO_UNIMAP:
ret = do_unimap_ioctl(cmd, up, perm, vc);
break;
case VT_LOCKSWITCH:
if (!capable(CAP_SYS_TTY_CONFIG))
return -EPERM;
vt_dont_switch = 1;
break;
case VT_UNLOCKSWITCH:
if (!capable(CAP_SYS_TTY_CONFIG))
return -EPERM;
vt_dont_switch = 0;
break;
case VT_GETHIFONTMASK:
ret = put_user(vc->vc_hi_font_mask,
(unsigned short __user *)arg);
break;
case VT_WAITEVENT:
ret = vt_event_wait_ioctl((struct vt_event __user *)arg);
break;
default:
ret = -ENOIOCTLCMD;
}
out:
return ret;
}
|
Safe
|
[
"CWE-362",
"CWE-703"
] |
linux
|
6cd1ed50efd88261298577cd92a14f2768eddeeb
|
1.8890163729873847e+38
| 701 |
vt: vt_ioctl: fix race in VT_RESIZEX
We need to make sure vc_cons[i].d is not NULL after grabbing
console_lock(), or risk a crash.
general protection fault, probably for non-canonical address 0xdffffc0000000068: 0000 [#1] PREEMPT SMP KASAN
KASAN: null-ptr-deref in range [0x0000000000000340-0x0000000000000347]
CPU: 1 PID: 19462 Comm: syz-executor.5 Not tainted 5.5.0-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
RIP: 0010:vt_ioctl+0x1f96/0x26d0 drivers/tty/vt/vt_ioctl.c:883
Code: 74 41 e8 bd a6 84 fd 48 89 d8 48 c1 e8 03 42 80 3c 28 00 0f 85 e4 04 00 00 48 8b 03 48 8d b8 40 03 00 00 48 89 fa 48 c1 ea 03 <42> 0f b6 14 2a 84 d2 74 09 80 fa 03 0f 8e b1 05 00 00 44 89 b8 40
RSP: 0018:ffffc900086d7bb0 EFLAGS: 00010202
RAX: 0000000000000000 RBX: ffffffff8c34ee88 RCX: ffffc9001415c000
RDX: 0000000000000068 RSI: ffffffff83f0e6e3 RDI: 0000000000000340
RBP: ffffc900086d7cd0 R08: ffff888054ce0100 R09: fffffbfff16a2f6d
R10: ffff888054ce0998 R11: ffff888054ce0100 R12: 000000000000001d
R13: dffffc0000000000 R14: 1ffff920010daf79 R15: 000000000000ff7f
FS: 00007f7d13c12700(0000) GS:ffff8880ae900000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007ffd477e3c38 CR3: 0000000095d0a000 CR4: 00000000001406e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
tty_ioctl+0xa37/0x14f0 drivers/tty/tty_io.c:2660
vfs_ioctl fs/ioctl.c:47 [inline]
ksys_ioctl+0x123/0x180 fs/ioctl.c:763
__do_sys_ioctl fs/ioctl.c:772 [inline]
__se_sys_ioctl fs/ioctl.c:770 [inline]
__x64_sys_ioctl+0x73/0xb0 fs/ioctl.c:770
do_syscall_64+0xfa/0x790 arch/x86/entry/common.c:294
entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x45b399
Code: ad b6 fb ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 0f 83 7b b6 fb ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007f7d13c11c78 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 00007f7d13c126d4 RCX: 000000000045b399
RDX: 0000000020000080 RSI: 000000000000560a RDI: 0000000000000003
RBP: 000000000075bf20 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00000000ffffffff
R13: 0000000000000666 R14: 00000000004c7f04 R15: 000000000075bf2c
Modules linked in:
---[ end trace 80970faf7a67eb77 ]---
RIP: 0010:vt_ioctl+0x1f96/0x26d0 drivers/tty/vt/vt_ioctl.c:883
Code: 74 41 e8 bd a6 84 fd 48 89 d8 48 c1 e8 03 42 80 3c 28 00 0f 85 e4 04 00 00 48 8b 03 48 8d b8 40 03 00 00 48 89 fa 48 c1 ea 03 <42> 0f b6 14 2a 84 d2 74 09 80 fa 03 0f 8e b1 05 00 00 44 89 b8 40
RSP: 0018:ffffc900086d7bb0 EFLAGS: 00010202
RAX: 0000000000000000 RBX: ffffffff8c34ee88 RCX: ffffc9001415c000
RDX: 0000000000000068 RSI: ffffffff83f0e6e3 RDI: 0000000000000340
RBP: ffffc900086d7cd0 R08: ffff888054ce0100 R09: fffffbfff16a2f6d
R10: ffff888054ce0998 R11: ffff888054ce0100 R12: 000000000000001d
R13: dffffc0000000000 R14: 1ffff920010daf79 R15: 000000000000ff7f
FS: 00007f7d13c12700(0000) GS:ffff8880ae900000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007ffd477e3c38 CR3: 0000000095d0a000 CR4: 00000000001406e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: stable <stable@vger.kernel.org>
Reported-by: syzbot <syzkaller@googlegroups.com>
Link: https://lore.kernel.org/r/20200210190721.200418-1-edumazet@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| 0 |
int OTHERNAME_cmp(OTHERNAME *a, OTHERNAME *b)
{
int result = -1;
if (!a || !b)
return -1;
/* Check their type first. */
if ((result = OBJ_cmp(a->type_id, b->type_id)) != 0)
return result;
/* Check the value. */
result = ASN1_TYPE_cmp(a->value, b->value);
return result;
}
|
Safe
|
[
"CWE-476"
] |
openssl
|
b33c48b75aaf33c93aeda42d7138616b9e6a64cb
|
4.9018174192832645e+37
| 13 |
Correctly compare EdiPartyName in GENERAL_NAME_cmp()
If a GENERAL_NAME field contained EdiPartyName data then it was
incorrectly being handled as type "other". This could lead to a
segmentation fault.
Many thanks to David Benjamin from Google for reporting this issue.
CVE-2020-1971
Reviewed-by: Tomas Mraz <tmraz@fedoraproject.org>
| 0 |
static PixelList **AcquirePixelListThreadSet(const size_t width,
const size_t height)
{
PixelList
**pixel_list;
register ssize_t
i;
size_t
number_threads;
number_threads=(size_t) GetMagickResourceLimit(ThreadResource);
pixel_list=(PixelList **) AcquireQuantumMemory(number_threads,
sizeof(*pixel_list));
if (pixel_list == (PixelList **) NULL)
return((PixelList **) NULL);
(void) memset(pixel_list,0,number_threads*sizeof(*pixel_list));
for (i=0; i < (ssize_t) number_threads; i++)
{
pixel_list[i]=AcquirePixelList(width,height);
if (pixel_list[i] == (PixelList *) NULL)
return(DestroyPixelListThreadSet(pixel_list));
}
return(pixel_list);
}
|
Safe
|
[
"CWE-119",
"CWE-787"
] |
ImageMagick6
|
91e58d967a92250439ede038ccfb0913a81e59fe
|
1.5707453213294031e+38
| 26 |
https://github.com/ImageMagick/ImageMagick/issues/1615
| 0 |
destroy_attr_val_fifo(
attr_val_fifo * av_fifo
)
{
attr_val * av;
if (av_fifo != NULL) {
for (;;) {
UNLINK_FIFO(av, *av_fifo, link);
if (av == NULL)
break;
if (T_String == av->type)
free(av->value.s);
free(av);
}
free(av_fifo);
}
}
|
Safe
|
[
"CWE-19"
] |
ntp
|
fe46889f7baa75fc8e6c0fcde87706d396ce1461
|
1.8774619807855337e+38
| 18 |
[Sec 2942]: Off-path DoS attack on auth broadcast mode. HStenn.
| 0 |
bool OSD::require_self_aliveness(const Message *m, epoch_t epoch)
{
epoch_t up_epoch = service.get_up_epoch();
if (epoch < up_epoch) {
dout(7) << "from pre-up epoch " << epoch << " < " << up_epoch << dendl;
return false;
}
if (!is_active()) {
dout(7) << "still in boot state, dropping message " << *m << dendl;
return false;
}
return true;
}
|
Safe
|
[
"CWE-287",
"CWE-284"
] |
ceph
|
5ead97120e07054d80623dada90a5cc764c28468
|
1.3881694743190213e+38
| 15 |
auth/cephx: add authorizer challenge
Allow the accepting side of a connection to reject an initial authorizer
with a random challenge. The connecting side then has to respond with an
updated authorizer proving they are able to decrypt the service's challenge
and that the new authorizer was produced for this specific connection
instance.
The accepting side requires this challenge and response unconditionally
if the client side advertises they have the feature bit. Servers wishing
to require this improved level of authentication simply have to require
the appropriate feature.
Signed-off-by: Sage Weil <sage@redhat.com>
(cherry picked from commit f80b848d3f830eb6dba50123e04385173fa4540b)
# Conflicts:
# src/auth/Auth.h
# src/auth/cephx/CephxProtocol.cc
# src/auth/cephx/CephxProtocol.h
# src/auth/none/AuthNoneProtocol.h
# src/msg/Dispatcher.h
# src/msg/async/AsyncConnection.cc
- const_iterator
- ::decode vs decode
- AsyncConnection ctor arg noise
- get_random_bytes(), not cct->random()
| 0 |
char *sccsid(void) { return (SCCSID); }
|
Safe
|
[
"CWE-125"
] |
sysstat
|
fbc691eaaa10d0bcea6741d5a223dc3906106548
|
2.773319667987821e+38
| 1 |
Fix #196 and #199: Out of bound reads security issues
Check args before calling memmove() and memset() in remap_struct()
function to avoid out of bound reads which would possibly lead to
unknown code execution and/or sadf command crash.
Signed-off-by: Sebastien GODARD <sysstat@users.noreply.github.com>
| 0 |
gdk_pixbuf__tiff_image_load_increment (gpointer data, const guchar *buf,
guint size, GError **error)
{
TiffData *context = (TiffData *) data;
g_return_val_if_fail (data != NULL, FALSE);
if (fwrite (buf, sizeof (guchar), size, context->file) != size) {
context->all_okay = FALSE;
g_set_error (error,
G_FILE_ERROR,
g_file_error_from_errno (errno),
_("Failed to write to temporary file when loading TIFF image"));
return FALSE;
}
return TRUE;
}
|
Vulnerable
|
[
"CWE-20"
] |
gdk-pixbuf
|
3bac204e0d0241a0d68586ece7099e6acf0e9bea
|
7.377872657445007e+37
| 18 |
Initial stab at getting the focus code to work.
Fri Jun 1 18:54:47 2001 Jonathan Blandford <jrb@redhat.com>
* gtk/gtktreeview.c: (gtk_tree_view_focus): Initial stab at
getting the focus code to work.
(gtk_tree_view_class_init): Add a bunch of keybindings.
* gtk/gtktreeviewcolumn.c
(gtk_tree_view_column_set_cell_data_func):
s/GtkCellDataFunc/GtkTreeCellDataFunc.
(_gtk_tree_view_column_set_tree_view): Use "notify::model" instead
of "properties_changed" to help justify the death of the latter
signal. (-:
* tests/testtreefocus.c (main): Let some columns be focussable to
test focus better.
| 1 |
ofputil_protocol_set_tid(enum ofputil_protocol protocol, bool enable)
{
switch (protocol) {
case OFPUTIL_P_OF10_STD:
case OFPUTIL_P_OF10_STD_TID:
return enable ? OFPUTIL_P_OF10_STD_TID : OFPUTIL_P_OF10_STD;
case OFPUTIL_P_OF10_NXM:
case OFPUTIL_P_OF10_NXM_TID:
return enable ? OFPUTIL_P_OF10_NXM_TID : OFPUTIL_P_OF10_NXM;
case OFPUTIL_P_OF11_STD:
return OFPUTIL_P_OF11_STD;
case OFPUTIL_P_OF12_OXM:
return OFPUTIL_P_OF12_OXM;
case OFPUTIL_P_OF13_OXM:
return OFPUTIL_P_OF13_OXM;
case OFPUTIL_P_OF14_OXM:
return OFPUTIL_P_OF14_OXM;
case OFPUTIL_P_OF15_OXM:
return OFPUTIL_P_OF15_OXM;
case OFPUTIL_P_OF16_OXM:
return OFPUTIL_P_OF16_OXM;
default:
OVS_NOT_REACHED();
}
}
|
Safe
|
[
"CWE-772"
] |
ovs
|
77ad4225d125030420d897c873e4734ac708c66b
|
1.2579882163985112e+38
| 33 |
ofp-util: Fix memory leaks on error cases in ofputil_decode_group_mod().
Found by libFuzzer.
Reported-by: Bhargava Shastry <bshastry@sec.t-labs.tu-berlin.de>
Signed-off-by: Ben Pfaff <blp@ovn.org>
Acked-by: Justin Pettit <jpettit@ovn.org>
| 0 |
static void output_summary(void)
{
if (INFO_GTE(STATS, 2)) {
rprintf(FCLIENT, "\n");
output_itemized_counts("Number of files", &stats.num_files);
if (protocol_version >= 29)
output_itemized_counts("Number of created files", &stats.created_files);
if (protocol_version >= 31)
output_itemized_counts("Number of deleted files", &stats.deleted_files);
rprintf(FINFO,"Number of regular files transferred: %s\n",
comma_num(stats.xferred_files));
rprintf(FINFO,"Total file size: %s bytes\n",
human_num(stats.total_size));
rprintf(FINFO,"Total transferred file size: %s bytes\n",
human_num(stats.total_transferred_size));
rprintf(FINFO,"Literal data: %s bytes\n",
human_num(stats.literal_data));
rprintf(FINFO,"Matched data: %s bytes\n",
human_num(stats.matched_data));
rprintf(FINFO,"File list size: %s\n",
human_num(stats.flist_size));
if (stats.flist_buildtime) {
rprintf(FINFO,
"File list generation time: %s seconds\n",
comma_dnum((double)stats.flist_buildtime / 1000, 3));
rprintf(FINFO,
"File list transfer time: %s seconds\n",
comma_dnum((double)stats.flist_xfertime / 1000, 3));
}
rprintf(FINFO,"Total bytes sent: %s\n",
human_num(total_written));
rprintf(FINFO,"Total bytes received: %s\n",
human_num(total_read));
}
if (INFO_GTE(STATS, 1)) {
rprintf(FCLIENT, "\n");
rprintf(FINFO,
"sent %s bytes received %s bytes %s bytes/sec\n",
human_num(total_written), human_num(total_read),
human_dnum((total_written + total_read)/(0.5 + (endtime - starttime)), 2));
rprintf(FINFO, "total size is %s speedup is %s%s\n",
human_num(stats.total_size),
comma_dnum((double)stats.total_size / (total_written+total_read), 2),
write_batch < 0 ? " (BATCH ONLY)" : dry_run ? " (DRY RUN)" : "");
}
fflush(stdout);
fflush(stderr);
}
|
Safe
|
[
"CWE-59"
] |
rsync
|
962f8b90045ab331fc04c9e65f80f1a53e68243b
|
3.1969687616177454e+38
| 50 |
Complain if an inc-recursive path is not right for its dir.
This ensures that a malicious sender can't use a just-sent
symlink as a trasnfer path.
| 0 |
static int mov_read_hdlr(MOVContext *c, AVIOContext *pb, MOVAtom atom)
{
AVStream *st;
uint32_t type;
uint32_t ctype;
int64_t title_size;
char *title_str;
int ret;
avio_r8(pb); /* version */
avio_rb24(pb); /* flags */
/* component type */
ctype = avio_rl32(pb);
type = avio_rl32(pb); /* component subtype */
av_log(c->fc, AV_LOG_TRACE, "ctype=%s\n", av_fourcc2str(ctype));
av_log(c->fc, AV_LOG_TRACE, "stype=%s\n", av_fourcc2str(type));
if (c->trak_index < 0) { // meta not inside a trak
if (type == MKTAG('m','d','t','a')) {
c->found_hdlr_mdta = 1;
}
return 0;
}
st = c->fc->streams[c->fc->nb_streams-1];
if (type == MKTAG('v','i','d','e'))
st->codecpar->codec_type = AVMEDIA_TYPE_VIDEO;
else if (type == MKTAG('s','o','u','n'))
st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO;
else if (type == MKTAG('m','1','a',' '))
st->codecpar->codec_id = AV_CODEC_ID_MP2;
else if ((type == MKTAG('s','u','b','p')) || (type == MKTAG('c','l','c','p')))
st->codecpar->codec_type = AVMEDIA_TYPE_SUBTITLE;
avio_rb32(pb); /* component manufacture */
avio_rb32(pb); /* component flags */
avio_rb32(pb); /* component flags mask */
title_size = atom.size - 24;
if (title_size > 0) {
if (title_size > FFMIN(INT_MAX, SIZE_MAX-1))
return AVERROR_INVALIDDATA;
title_str = av_malloc(title_size + 1); /* Add null terminator */
if (!title_str)
return AVERROR(ENOMEM);
ret = ffio_read_size(pb, title_str, title_size);
if (ret < 0) {
av_freep(&title_str);
return ret;
}
title_str[title_size] = 0;
if (title_str[0]) {
int off = (!c->isom && title_str[0] == title_size - 1);
av_dict_set(&st->metadata, "handler_name", title_str + off, 0);
}
av_freep(&title_str);
}
return 0;
}
|
Safe
|
[
"CWE-399",
"CWE-834"
] |
FFmpeg
|
9cb4eb772839c5e1de2855d126bf74ff16d13382
|
2.0229682667380772e+38
| 64 |
avformat/mov: Fix DoS in read_tfra()
Fixes: Missing EOF check in loop
No testcase
Found-by: Xiaohei and Wangchu from Alibaba Security Team
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
| 0 |
TEST_F(ExprMatchTest, GtWithRHSFieldPathMatchesCorrectly) {
createMatcher(fromjson("{$expr: {$gt: [3, '$x']}}"));
ASSERT_TRUE(matches(BSON("x" << 1)));
ASSERT_FALSE(matches(BSON("x" << 3)));
ASSERT_FALSE(matches(BSON("x" << 10)));
}
|
Safe
|
[] |
mongo
|
ee97c0699fd55b498310996ee002328e533681a3
|
2.80984711454571e+38
| 8 |
SERVER-36993 Fix crash due to incorrect $or pushdown for indexed $expr.
| 0 |
static int add_subprog(struct bpf_verifier_env *env, int off)
{
int insn_cnt = env->prog->len;
int ret;
if (off >= insn_cnt || off < 0) {
verbose(env, "call to invalid destination\n");
return -EINVAL;
}
ret = find_subprog(env, off);
if (ret >= 0)
return ret;
if (env->subprog_cnt >= BPF_MAX_SUBPROGS) {
verbose(env, "too many subprograms\n");
return -E2BIG;
}
/* determine subprog starts. The end is one before the next starts */
env->subprog_info[env->subprog_cnt++].start = off;
sort(env->subprog_info, env->subprog_cnt,
sizeof(env->subprog_info[0]), cmp_subprogs, NULL);
return env->subprog_cnt - 1;
}
|
Safe
|
[
"CWE-125"
] |
bpf
|
049c4e13714ecbca567b4d5f6d563f05d431c80e
|
7.8265243439231785e+37
| 22 |
bpf: Fix alu32 const subreg bound tracking on bitwise operations
Fix a bug in the verifier's scalar32_min_max_*() functions which leads to
incorrect tracking of 32 bit bounds for the simulation of and/or/xor bitops.
When both the src & dst subreg is a known constant, then the assumption is
that scalar_min_max_*() will take care to update bounds correctly. However,
this is not the case, for example, consider a register R2 which has a tnum
of 0xffffffff00000000, meaning, lower 32 bits are known constant and in this
case of value 0x00000001. R2 is then and'ed with a register R3 which is a
64 bit known constant, here, 0x100000002.
What can be seen in line '10:' is that 32 bit bounds reach an invalid state
where {u,s}32_min_value > {u,s}32_max_value. The reason is scalar32_min_max_*()
delegates 32 bit bounds updates to scalar_min_max_*(), however, that really
only takes place when both the 64 bit src & dst register is a known constant.
Given scalar32_min_max_*() is intended to be designed as closely as possible
to scalar_min_max_*(), update the 32 bit bounds in this situation through
__mark_reg32_known() which will set all {u,s}32_{min,max}_value to the correct
constant, which is 0x00000000 after the fix (given 0x00000001 & 0x00000002 in
32 bit space). This is possible given var32_off already holds the final value
as dst_reg->var_off is updated before calling scalar32_min_max_*().
Before fix, invalid tracking of R2:
[...]
9: R0_w=inv1337 R1=ctx(id=0,off=0,imm=0) R2_w=inv(id=0,smin_value=-9223372036854775807 (0x8000000000000001),smax_value=9223372032559808513 (0x7fffffff00000001),umin_value=1,umax_value=0xffffffff00000001,var_off=(0x1; 0xffffffff00000000),s32_min_value=1,s32_max_value=1,u32_min_value=1,u32_max_value=1) R3_w=inv4294967298 R10=fp0
9: (5f) r2 &= r3
10: R0_w=inv1337 R1=ctx(id=0,off=0,imm=0) R2_w=inv(id=0,smin_value=0,smax_value=4294967296 (0x100000000),umin_value=0,umax_value=0x100000000,var_off=(0x0; 0x100000000),s32_min_value=1,s32_max_value=0,u32_min_value=1,u32_max_value=0) R3_w=inv4294967298 R10=fp0
[...]
After fix, correct tracking of R2:
[...]
9: R0_w=inv1337 R1=ctx(id=0,off=0,imm=0) R2_w=inv(id=0,smin_value=-9223372036854775807 (0x8000000000000001),smax_value=9223372032559808513 (0x7fffffff00000001),umin_value=1,umax_value=0xffffffff00000001,var_off=(0x1; 0xffffffff00000000),s32_min_value=1,s32_max_value=1,u32_min_value=1,u32_max_value=1) R3_w=inv4294967298 R10=fp0
9: (5f) r2 &= r3
10: R0_w=inv1337 R1=ctx(id=0,off=0,imm=0) R2_w=inv(id=0,smin_value=0,smax_value=4294967296 (0x100000000),umin_value=0,umax_value=0x100000000,var_off=(0x0; 0x100000000),s32_min_value=0,s32_max_value=0,u32_min_value=0,u32_max_value=0) R3_w=inv4294967298 R10=fp0
[...]
Fixes: 3f50f132d840 ("bpf: Verifier, do explicit ALU32 bounds tracking")
Fixes: 2921c90d4718 ("bpf: Fix a verifier failure with xor")
Reported-by: Manfred Paul (@_manfp)
Reported-by: Thadeu Lima de Souza Cascardo <cascardo@canonical.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Reviewed-by: John Fastabend <john.fastabend@gmail.com>
Acked-by: Alexei Starovoitov <ast@kernel.org>
| 0 |
static GF_Err swf_svg_add_iso_sample(void *user, const u8 *data, u32 length, u64 timestamp, Bool isRap)
{
GF_FilterPacket *pck;
u8 *pck_data;
GF_TXTIn *ctx = (GF_TXTIn *)user;
if (ctx->seek_state==2) {
Double ts = (Double) timestamp;
ts/=1000;
if (ts<ctx->start_range) return GF_OK;
ctx->seek_state = 0;
}
pck = gf_filter_pck_new_alloc(ctx->opid, length, &pck_data);
if (pck) {
memcpy(pck_data, data, length);
gf_filter_pck_set_cts(pck, (u64) (ctx->timescale*timestamp/1000) );
gf_filter_pck_set_sap(pck, isRap ? GF_FILTER_SAP_1 : GF_FILTER_SAP_NONE);
gf_filter_pck_set_framing(pck, GF_TRUE, GF_FALSE);
gf_filter_pck_send(pck);
}
if (gf_filter_pid_would_block(ctx->opid))
ctx->do_suspend = GF_TRUE;
return GF_OK;
}
|
Safe
|
[
"CWE-276"
] |
gpac
|
96699aabae042f8f55cf8a85fa5758e3db752bae
|
9.537196209662374e+35
| 27 |
fixed #2061
| 0 |
R_API st64 r_buf_insert_bytes(RBuffer *b, ut64 addr, const ut8 *buf, ut64 length) {
r_return_val_if_fail (b && !b->readonly, -1);
st64 pos, r = r_buf_seek (b, 0, R_BUF_CUR);
if (r < 0) {
return r;
}
pos = r;
r = r_buf_seek (b, addr, R_BUF_SET);
if (r < 0) {
goto restore_pos;
}
ut64 sz = r_buf_size (b);
ut8 *tmp = R_NEWS (ut8, sz - addr);
r = r_buf_read (b, tmp, sz - addr);
if (r < 0) {
goto free_tmp;
}
st64 tmp_length = r;
if (!r_buf_resize (b, sz + length)) {
goto free_tmp;
}
r = r_buf_seek (b, addr + length, R_BUF_SET);
if (r < 0) {
goto free_tmp;
}
r = r_buf_write (b, tmp, tmp_length);
if (r < 0) {
goto free_tmp;
}
r = r_buf_seek (b, addr, R_BUF_SET);
if (r < 0) {
goto free_tmp;
}
r = r_buf_write (b, buf, length);
free_tmp:
free (tmp);
restore_pos:
r_buf_seek (b, pos, R_BUF_SET);
return r;
}
|
Safe
|
[
"CWE-400",
"CWE-703"
] |
radare2
|
634b886e84a5c568d243e744becc6b3223e089cf
|
8.210595784777767e+37
| 41 |
Fix DoS in PE/QNX/DYLDCACHE/PSX parsers ##crash
* Reported by lazymio
* Reproducer: AAA4AAAAAB4=
| 0 |
void ComputeAsync(OpKernelContext* c, DoneCallback done) final {
auto stream = c->op_device_context()->stream();
const Device& d = c->eigen_device<Device>();
const Tensor& indices_t = c->input(0);
const Tensor& values_t = c->input(1);
const Tensor& dense_shape_t = c->input(2);
const int rank = dense_shape_t.NumElements();
OP_REQUIRES_ASYNC(
c, rank == 2 || rank == 3,
errors::InvalidArgument("sparse tensor must have rank == 2 or 3; ",
"but indices has ", rank, " columns"),
done);
auto dense_shape = dense_shape_t.vec<int64_t>();
const int64_t batch_size = (rank == 2) ? 1 : dense_shape(0);
const int64_t rows = dense_shape((rank == 2) ? 0 : 1);
const int64_t cols = dense_shape((rank == 2) ? 1 : 2);
ScratchSpace<int32> nnz_per_batch_host(c, batch_size, /*on_host*/ true);
Tensor nnz_per_batch_device_t;
if (rank == 2) {
// Simple case.
nnz_per_batch_host.mutable_data()[0] = indices_t.dim_size(0);
} else {
OP_REQUIRES_OK_ASYNC(c,
c->allocate_temp(DT_INT32, TensorShape({batch_size}),
&nnz_per_batch_device_t),
done);
auto nnz_per_batch_device = nnz_per_batch_device_t.vec<int32>();
functor::CalculateNNZPerBatchMatrixFromIndices<Device>
calculate_nnz_from_indices;
auto indices = indices_t.matrix<int64_t>();
OP_REQUIRES_OK_ASYNC(
c, calculate_nnz_from_indices(c, indices, nnz_per_batch_device),
done);
perftools::gputools::DeviceMemoryBase nnz_per_batch_device_ptr(
static_cast<void*>(nnz_per_batch_device.data()));
OP_REQUIRES_ASYNC(
c,
stream
->ThenMemcpy(nnz_per_batch_host.mutable_data() /*host_dst*/,
nnz_per_batch_device_ptr /*gpu_src*/,
batch_size * sizeof(int32) /*size*/)
.ok(),
errors::Internal("SparseTensorToSparseMatrixGPUOp: failed to copy "
"nnz_per_batch from device"),
done);
}
TensorReference nnz_per_batch_device_ref(nnz_per_batch_device_t);
auto convert_to_csr = [this, c, batch_size, nnz_per_batch_host,
nnz_per_batch_device_ref, stream, &d, &values_t,
&indices_t, &dense_shape_t, dense_shape, rows, cols,
rank, done]() {
// The data has been copied out of the nnz_per_batch_device
// tensor by the time we get here; we can unreference it.
nnz_per_batch_device_ref.Unref();
auto nnz_per_batch = nnz_per_batch_host.tensor().vec<int32>();
// Ensure that within the callback, the proper GPU settings are
// configured.
ScopedActivateExecutorContext scoped_activation{stream->parent()};
Tensor batch_ptr_t(cpu_allocator(), DT_INT32,
TensorShape({batch_size + 1}));
auto batch_ptr = batch_ptr_t.vec<int32>();
auto indices = indices_t.matrix<int64_t>();
batch_ptr(0) = 0;
for (int i = 0; i < batch_size; ++i) {
batch_ptr(i + 1) = batch_ptr(i) + nnz_per_batch(i);
}
int total_nnz = batch_ptr(batch_size);
OP_REQUIRES_ASYNC(
c, total_nnz == values_t.NumElements(),
errors::Internal("nnz returned by "
"CalculateNNZPerBatchMatrixFromInd"
"ices != len(values): ",
total_nnz, " vs. ", values_t.NumElements()),
done);
Tensor coo_col_ind_t;
Tensor csr_row_ptr_t;
Tensor csr_values_t = values_t;
Tensor coo_row_ind_t;
OP_REQUIRES_OK_ASYNC(
c,
c->allocate_temp(DT_INT32, TensorShape({total_nnz}), &coo_row_ind_t),
done);
OP_REQUIRES_OK_ASYNC(
c,
c->allocate_temp(DT_INT32, TensorShape({total_nnz}), &coo_col_ind_t),
done);
OP_REQUIRES_OK_ASYNC(
c,
c->allocate_temp(DT_INT32, TensorShape({batch_size * (rows + 1)}),
&csr_row_ptr_t),
done);
auto coo_row_ind = coo_row_ind_t.vec<int32>();
auto coo_col_ind = coo_col_ind_t.vec<int32>();
auto csr_row_ptr = csr_row_ptr_t.vec<int32>();
// Convert SparseTensor rep to coo row ind, coo col ind.
if (total_nnz > 0) {
functor::SparseTensorToCOOSparseMatrix<Device> st_to_coo;
st_to_coo(d, dense_shape, indices, coo_row_ind, coo_col_ind);
}
// Set all csr row pointers to zero, so that when iterating over
// batches converting coo to csr, we do not have to perform an
// unaligned SetZero for any nnz == 0 minibatches. coo2csr has
// a bug if you have empty coo rows.
// TODO(ebrevdo): File bug w/ nvidia so coo2csr can handle
// zero-element input coo rows.
functor::SetZeroFunctor<Device, int32> set_zero;
set_zero(d, csr_row_ptr_t.flat<int32>());
functor::COOSparseMatrixToCSRSparseMatrix<Device> coo_to_csr;
for (int i = 0; i < batch_size; ++i) {
int nnz_i = batch_ptr(i + 1) - batch_ptr(i);
if (nnz_i == 0) {
// This is an empty minibatch; no call to coo2csr: it's
// handled by the SetZero above.
} else {
// Convert coo to csr.
auto coo_row_ind_i =
TTypes<int32>::UnalignedVec(&coo_row_ind(batch_ptr(i)), nnz_i);
auto csr_row_ptr_i = TTypes<int32>::UnalignedVec(
&csr_row_ptr((rows + 1) * i), rows + 1);
OP_REQUIRES_OK_ASYNC(
c, coo_to_csr(c, rows, cols, coo_row_ind_i, csr_row_ptr_i), done);
}
}
CSRSparseMatrix matrix;
OP_REQUIRES_OK_ASYNC(
c,
CSRSparseMatrix::CreateCSRSparseMatrix(
values_t.dtype(), dense_shape_t, batch_ptr_t, csr_row_ptr_t,
coo_col_ind_t, csr_values_t, &matrix),
done);
Tensor* matrix_t;
AllocatorAttributes cpu_alloc;
cpu_alloc.set_on_host(true);
OP_REQUIRES_OK_ASYNC(
c, c->allocate_output(0, TensorShape({}), &matrix_t, cpu_alloc),
done);
matrix_t->scalar<Variant>()() = std::move(matrix);
done();
};
if (rank == 2) {
convert_to_csr();
} else {
// Launch the GPU kernel to count nnz entries, then call convert_to_csr.
c->device()->tensorflow_accelerator_device_info()->event_mgr->ThenExecute(
stream, convert_to_csr);
}
}
|
Safe
|
[
"CWE-20",
"CWE-703"
] |
tensorflow
|
ea50a40e84f6bff15a0912728e35b657548cef11
|
1.743826719851479e+38
| 167 |
Fix failed check in SparseTensorToCSRSparseMatrix
Security vulnerability fix. A `CHECK` fails if inputing either an empty `dense_shape`,
or a non-rank-2 `indices`. Added appropriate checks and tests.
PiperOrigin-RevId: 446053984
| 0 |
struct brcmf_if *brcmf_add_if(struct brcmf_pub *drvr, s32 bsscfgidx, s32 ifidx,
bool is_p2pdev, const char *name, u8 *mac_addr)
{
struct brcmf_if *ifp;
struct net_device *ndev;
brcmf_dbg(TRACE, "Enter, bsscfgidx=%d, ifidx=%d\n", bsscfgidx, ifidx);
ifp = drvr->iflist[bsscfgidx];
/*
* Delete the existing interface before overwriting it
* in case we missed the BRCMF_E_IF_DEL event.
*/
if (ifp) {
if (ifidx) {
brcmf_err("ERROR: netdev:%s already exists\n",
ifp->ndev->name);
netif_stop_queue(ifp->ndev);
brcmf_net_detach(ifp->ndev, false);
drvr->iflist[bsscfgidx] = NULL;
} else {
brcmf_dbg(INFO, "netdev:%s ignore IF event\n",
ifp->ndev->name);
return ERR_PTR(-EINVAL);
}
}
if (!drvr->settings->p2p_enable && is_p2pdev) {
/* this is P2P_DEVICE interface */
brcmf_dbg(INFO, "allocate non-netdev interface\n");
ifp = kzalloc(sizeof(*ifp), GFP_KERNEL);
if (!ifp)
return ERR_PTR(-ENOMEM);
} else {
brcmf_dbg(INFO, "allocate netdev interface\n");
/* Allocate netdev, including space for private structure */
ndev = alloc_netdev(sizeof(*ifp), is_p2pdev ? "p2p%d" : name,
NET_NAME_UNKNOWN, ether_setup);
if (!ndev)
return ERR_PTR(-ENOMEM);
ndev->needs_free_netdev = true;
ifp = netdev_priv(ndev);
ifp->ndev = ndev;
/* store mapping ifidx to bsscfgidx */
if (drvr->if2bss[ifidx] == BRCMF_BSSIDX_INVALID)
drvr->if2bss[ifidx] = bsscfgidx;
}
ifp->drvr = drvr;
drvr->iflist[bsscfgidx] = ifp;
ifp->ifidx = ifidx;
ifp->bsscfgidx = bsscfgidx;
init_waitqueue_head(&ifp->pend_8021x_wait);
spin_lock_init(&ifp->netif_stop_lock);
if (mac_addr != NULL)
memcpy(ifp->mac_addr, mac_addr, ETH_ALEN);
brcmf_dbg(TRACE, " ==== pid:%x, if:%s (%pM) created ===\n",
current->pid, name, ifp->mac_addr);
return ifp;
}
|
Safe
|
[
"CWE-20"
] |
linux
|
a4176ec356c73a46c07c181c6d04039fafa34a9f
|
2.065977381033338e+38
| 65 |
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 <hante.meuleman@broadcom.com>
Reviewed-by: Pieter-Paul Giesberts <pieter-paul.giesberts@broadcom.com>
Reviewed-by: Franky Lin <franky.lin@broadcom.com>
Signed-off-by: Arend van Spriel <arend.vanspriel@broadcom.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
| 0 |
xfs_attr_leaf_order(
struct xfs_buf *leaf1_bp,
struct xfs_buf *leaf2_bp)
{
struct xfs_attr3_icleaf_hdr ichdr1;
struct xfs_attr3_icleaf_hdr ichdr2;
struct xfs_mount *mp = leaf1_bp->b_mount;
xfs_attr3_leaf_hdr_from_disk(mp->m_attr_geo, &ichdr1, leaf1_bp->b_addr);
xfs_attr3_leaf_hdr_from_disk(mp->m_attr_geo, &ichdr2, leaf2_bp->b_addr);
return xfs_attr3_leaf_order(leaf1_bp, &ichdr1, leaf2_bp, &ichdr2);
}
|
Safe
|
[
"CWE-131"
] |
linux
|
f4020438fab05364018c91f7e02ebdd192085933
|
1.6805660987181462e+38
| 12 |
xfs: fix boundary test in xfs_attr_shortform_verify
The boundary test for the fixed-offset parts of xfs_attr_sf_entry in
xfs_attr_shortform_verify is off by one, because the variable array
at the end is defined as nameval[1] not nameval[].
Hence we need to subtract 1 from the calculation.
This can be shown by:
# touch file
# setfattr -n root.a file
and verifications will fail when it's written to disk.
This only matters for a last attribute which has a single-byte name
and no value, otherwise the combination of namelen & valuelen will
push endp further out and this test won't fail.
Fixes: 1e1bbd8e7ee06 ("xfs: create structure verifier function for shortform xattrs")
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
| 0 |
ArgList() : types_(0) {}
|
Safe
|
[
"CWE-134",
"CWE-119",
"CWE-787"
] |
fmt
|
8cf30aa2be256eba07bb1cefb998c52326e846e7
|
6.806488377669411e+37
| 1 |
Fix segfault on complex pointer formatting (#642)
| 0 |
void dump_bucket(struct req_state *s, rgw::sal::RGWBucket& obj)
{
s->formatter->open_object_section("Bucket");
s->formatter->dump_string("Name", obj.get_name());
dump_time(s, "CreationDate", &obj.get_creation_time());
s->formatter->close_section();
}
|
Safe
|
[
"CWE-79"
] |
ceph
|
8f90658c731499722d5f4393c8ad70b971d05f77
|
2.776636616601427e+38
| 7 |
rgw: reject unauthenticated response-header actions
Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
Reviewed-by: Casey Bodley <cbodley@redhat.com>
(cherry picked from commit d8dd5e513c0c62bbd7d3044d7e2eddcd897bd400)
| 0 |
int32_t FASTCALL get_word (WavpackStream *wps, int chan, int32_t *correction)
{
register struct entropy_data *c = wps->w.c + chan;
uint32_t ones_count, low, mid, high;
int32_t value;
int sign;
if (!wps->wvbits.ptr)
return WORD_EOF;
if (correction)
*correction = 0;
if (!(wps->w.c [0].median [0] & ~1) && !wps->w.holding_zero && !wps->w.holding_one && !(wps->w.c [1].median [0] & ~1)) {
uint32_t mask;
int cbits;
if (wps->w.zeros_acc) {
if (--wps->w.zeros_acc) {
c->slow_level -= (c->slow_level + SLO) >> SLS;
return 0;
}
}
else {
for (cbits = 0; cbits < 33 && getbit (&wps->wvbits); ++cbits);
if (cbits == 33)
return WORD_EOF;
if (cbits < 2)
wps->w.zeros_acc = cbits;
else {
for (mask = 1, wps->w.zeros_acc = 0; --cbits; mask <<= 1)
if (getbit (&wps->wvbits))
wps->w.zeros_acc |= mask;
wps->w.zeros_acc |= mask;
}
if (wps->w.zeros_acc) {
c->slow_level -= (c->slow_level + SLO) >> SLS;
CLEAR (wps->w.c [0].median);
CLEAR (wps->w.c [1].median);
return 0;
}
}
}
if (wps->w.holding_zero)
ones_count = wps->w.holding_zero = 0;
else {
#ifdef USE_CTZ_OPTIMIZATION
while (wps->wvbits.bc < LIMIT_ONES) {
if (++(wps->wvbits.ptr) == wps->wvbits.end)
wps->wvbits.wrap (&wps->wvbits);
wps->wvbits.sr |= *(wps->wvbits.ptr) << wps->wvbits.bc;
wps->wvbits.bc += sizeof (*(wps->wvbits.ptr)) * 8;
}
#ifdef _WIN32
_BitScanForward (&ones_count, ~wps->wvbits.sr);
#else
ones_count = __builtin_ctz (~wps->wvbits.sr);
#endif
if (ones_count >= LIMIT_ONES) {
wps->wvbits.bc -= ones_count;
wps->wvbits.sr >>= ones_count;
for (; ones_count < (LIMIT_ONES + 1) && getbit (&wps->wvbits); ++ones_count);
if (ones_count == (LIMIT_ONES + 1))
return WORD_EOF;
if (ones_count == LIMIT_ONES) {
uint32_t mask;
int cbits;
for (cbits = 0; cbits < 33 && getbit (&wps->wvbits); ++cbits);
if (cbits == 33)
return WORD_EOF;
if (cbits < 2)
ones_count = cbits;
else {
for (mask = 1, ones_count = 0; --cbits; mask <<= 1)
if (getbit (&wps->wvbits))
ones_count |= mask;
ones_count |= mask;
}
ones_count += LIMIT_ONES;
}
}
else {
wps->wvbits.bc -= ones_count + 1;
wps->wvbits.sr >>= ones_count + 1;
}
#elif defined (USE_NEXT8_OPTIMIZATION)
int next8;
if (wps->wvbits.bc < 8) {
if (++(wps->wvbits.ptr) == wps->wvbits.end)
wps->wvbits.wrap (&wps->wvbits);
next8 = (wps->wvbits.sr |= *(wps->wvbits.ptr) << wps->wvbits.bc) & 0xff;
wps->wvbits.bc += sizeof (*(wps->wvbits.ptr)) * 8;
}
else
next8 = wps->wvbits.sr & 0xff;
if (next8 == 0xff) {
wps->wvbits.bc -= 8;
wps->wvbits.sr >>= 8;
for (ones_count = 8; ones_count < (LIMIT_ONES + 1) && getbit (&wps->wvbits); ++ones_count);
if (ones_count == (LIMIT_ONES + 1))
return WORD_EOF;
if (ones_count == LIMIT_ONES) {
uint32_t mask;
int cbits;
for (cbits = 0; cbits < 33 && getbit (&wps->wvbits); ++cbits);
if (cbits == 33)
return WORD_EOF;
if (cbits < 2)
ones_count = cbits;
else {
for (mask = 1, ones_count = 0; --cbits; mask <<= 1)
if (getbit (&wps->wvbits))
ones_count |= mask;
ones_count |= mask;
}
ones_count += LIMIT_ONES;
}
}
else {
wps->wvbits.bc -= (ones_count = ones_count_table [next8]) + 1;
wps->wvbits.sr >>= ones_count + 1;
}
#else
for (ones_count = 0; ones_count < (LIMIT_ONES + 1) && getbit (&wps->wvbits); ++ones_count);
if (ones_count >= LIMIT_ONES) {
uint32_t mask;
int cbits;
if (ones_count == (LIMIT_ONES + 1))
return WORD_EOF;
for (cbits = 0; cbits < 33 && getbit (&wps->wvbits); ++cbits);
if (cbits == 33)
return WORD_EOF;
if (cbits < 2)
ones_count = cbits;
else {
for (mask = 1, ones_count = 0; --cbits; mask <<= 1)
if (getbit (&wps->wvbits))
ones_count |= mask;
ones_count |= mask;
}
ones_count += LIMIT_ONES;
}
#endif
if (wps->w.holding_one) {
wps->w.holding_one = ones_count & 1;
ones_count = (ones_count >> 1) + 1;
}
else {
wps->w.holding_one = ones_count & 1;
ones_count >>= 1;
}
wps->w.holding_zero = ~wps->w.holding_one & 1;
}
if ((wps->wphdr.flags & HYBRID_FLAG) && !chan)
update_error_limit (wps);
if (ones_count == 0) {
low = 0;
high = GET_MED (0) - 1;
DEC_MED0 ();
}
else {
low = GET_MED (0);
INC_MED0 ();
if (ones_count == 1) {
high = low + GET_MED (1) - 1;
DEC_MED1 ();
}
else {
low += GET_MED (1);
INC_MED1 ();
if (ones_count == 2) {
high = low + GET_MED (2) - 1;
DEC_MED2 ();
}
else {
low += (ones_count - 2) * GET_MED (2);
high = low + GET_MED (2) - 1;
INC_MED2 ();
}
}
}
low &= 0x7fffffff;
high &= 0x7fffffff;
if (low > high) // make sure high and low make sense
high = low;
mid = (high + low + 1) >> 1;
if (!c->error_limit)
mid = read_code (&wps->wvbits, high - low) + low;
else while (high - low > c->error_limit) {
if (getbit (&wps->wvbits))
mid = (high + (low = mid) + 1) >> 1;
else
mid = ((high = mid - 1) + low + 1) >> 1;
}
sign = getbit (&wps->wvbits);
if (bs_is_open (&wps->wvcbits) && c->error_limit) {
value = read_code (&wps->wvcbits, high - low) + low;
if (correction)
*correction = sign ? (mid - value) : (value - mid);
}
if (wps->wphdr.flags & HYBRID_BITRATE) {
c->slow_level -= (c->slow_level + SLO) >> SLS;
c->slow_level += wp_log2 (mid);
}
return sign ? ~mid : mid;
}
|
Safe
|
[
"CWE-125"
] |
WavPack
|
4bc05fc490b66ef2d45b1de26abf1455b486b0dc
|
2.6808808372958845e+38
| 255 |
fixes for 4 fuzz failures posted to SourceForge mailing list
| 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.