func
stringlengths 0
484k
| target
int64 0
1
| cwe
listlengths 0
4
| project
stringclasses 799
values | commit_id
stringlengths 40
40
| hash
float64 1,215,700,430,453,689,100,000,000B
340,281,914,521,452,260,000,000,000,000B
| size
int64 1
24k
| message
stringlengths 0
13.3k
|
---|---|---|---|---|---|---|---|
void tracing_stop(void)
{
struct ring_buffer *buffer;
unsigned long flags;
raw_spin_lock_irqsave(&global_trace.start_lock, flags);
if (global_trace.stop_count++)
goto out;
/* Prevent the buffers from switching */
arch_spin_lock(&global_trace.max_lock);
buffer = global_trace.trace_buffer.buffer;
if (buffer)
ring_buffer_record_disable(buffer);
#ifdef CONFIG_TRACER_MAX_TRACE
buffer = global_trace.max_buffer.buffer;
if (buffer)
ring_buffer_record_disable(buffer);
#endif
arch_spin_unlock(&global_trace.max_lock);
out:
raw_spin_unlock_irqrestore(&global_trace.start_lock, flags);
}
| 0 |
[
"CWE-415"
] |
linux
|
4397f04575c44e1440ec2e49b6302785c95fd2f8
| 191,521,756,748,611,250,000,000,000,000,000,000,000 | 27 |
tracing: Fix possible double free on failure of allocating trace buffer
Jing Xia and Chunyan Zhang reported that on failing to allocate part of the
tracing buffer, memory is freed, but the pointers that point to them are not
initialized back to NULL, and later paths may try to free the freed memory
again. Jing and Chunyan fixed one of the locations that does this, but
missed a spot.
Link: http://lkml.kernel.org/r/[email protected]
Cc: [email protected]
Fixes: 737223fbca3b1 ("tracing: Consolidate buffer allocation code")
Reported-by: Jing Xia <[email protected]>
Reported-by: Chunyan Zhang <[email protected]>
Signed-off-by: Steven Rostedt (VMware) <[email protected]>
|
static MagickBooleanType TIFFGetGPSProperties(TIFF *tiff,Image *image)
{
#if defined(MAGICKCORE_HAVE_TIFFREADGPSDIRECTORY)
MagickBooleanType
status;
tdir_t
directory;
#if defined(TIFF_VERSION_BIG)
uint64
#else
uint32
#endif
offset;
/*
Read GPS properties.
*/
offset=0;
if (TIFFGetField(tiff,TIFFTAG_GPSIFD,&offset) != 1)
return(MagickFalse);
directory=TIFFCurrentDirectory(tiff);
if (TIFFReadGPSDirectory(tiff,offset) != 1)
{
TIFFSetDirectory(tiff,directory);
return(MagickFalse);
}
status=TIFFSetImageProperties(tiff,image,"exif:GPS");
TIFFSetDirectory(tiff,directory);
return(status);
#else
(void) tiff;
(void) image;
return(MagickTrue);
#endif
}
| 0 |
[
"CWE-401"
] |
ImageMagick6
|
cd7f9fb7751b0d59d5a74b12d971155caad5a792
| 330,653,155,226,919,360,000,000,000,000,000,000,000 | 37 |
https://github.com/ImageMagick/ImageMagick/issues/3540
|
static __net_exit void pppoe_exit_net(struct net *net)
{
remove_proc_entry("pppoe", net->proc_net);
}
| 0 |
[
"CWE-20",
"CWE-269"
] |
linux
|
f3d3342602f8bcbf37d7c46641cb9bca7618eb1c
| 109,151,204,635,625,390,000,000,000,000,000,000,000 | 4 |
net: rework recvmsg handler msg_name and msg_namelen logic
This patch now always passes msg->msg_namelen as 0. recvmsg handlers must
set msg_namelen to the proper size <= sizeof(struct sockaddr_storage)
to return msg_name to the user.
This prevents numerous uninitialized memory leaks we had in the
recvmsg handlers and makes it harder for new code to accidentally leak
uninitialized memory.
Optimize for the case recvfrom is called with NULL as address. We don't
need to copy the address at all, so set it to NULL before invoking the
recvmsg handler. We can do so, because all the recvmsg handlers must
cope with the case a plain read() is called on them. read() also sets
msg_name to NULL.
Also document these changes in include/linux/net.h as suggested by David
Miller.
Changes since RFC:
Set msg->msg_name = NULL if user specified a NULL in msg_name but had a
non-null msg_namelen in verify_iovec/verify_compat_iovec. This doesn't
affect sendto as it would bail out earlier while trying to copy-in the
address. It also more naturally reflects the logic by the callers of
verify_iovec.
With this change in place I could remove "
if (!uaddr || msg_sys->msg_namelen == 0)
msg->msg_name = NULL
".
This change does not alter the user visible error logic as we ignore
msg_namelen as long as msg_name is NULL.
Also remove two unnecessary curly brackets in ___sys_recvmsg and change
comments to netdev style.
Cc: David Miller <[email protected]>
Suggested-by: Eric Dumazet <[email protected]>
Signed-off-by: Hannes Frederic Sowa <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
|
void avpriv_color_frame(AVFrame *frame, const int c[4])
{
const AVPixFmtDescriptor *desc = av_pix_fmt_desc_get(frame->format);
int p, y, x;
av_assert0(desc->flags & AV_PIX_FMT_FLAG_PLANAR);
for (p = 0; p<desc->nb_components; p++) {
uint8_t *dst = frame->data[p];
int is_chroma = p == 1 || p == 2;
int bytes = is_chroma ? FF_CEIL_RSHIFT(frame->width, desc->log2_chroma_w) : frame->width;
int height = is_chroma ? FF_CEIL_RSHIFT(frame->height, desc->log2_chroma_h) : frame->height;
for (y = 0; y < height; y++) {
if (desc->comp[0].depth_minus1 >= 8) {
for (x = 0; x<bytes; x++)
((uint16_t*)dst)[x] = c[p];
}else
memset(dst, c[p], bytes);
dst += frame->linesize[p];
}
}
}
| 0 |
[
"CWE-703"
] |
FFmpeg
|
e5c7229999182ad1cef13b9eca050dba7a5a08da
| 242,357,499,405,082,350,000,000,000,000,000,000,000 | 22 |
avcodec/utils: set AVFrame format unconditional
Fixes inconsistency and out of array accesses
Fixes: 10cdd7e63e7f66e3e66273939e0863dd-asan_heap-oob_1a4ff32_7078_cov_4056274555_mov_h264_aac__mp4box_frag.mp4
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <[email protected]>
|
static struct sc_card_driver * sc_get_driver(void)
{
/* Inherit most of the things from the CAC driver */
struct sc_card_driver *cac_drv = sc_get_cac_driver();
cac_ops = *cac_drv->ops;
cac_ops.match_card = cac_match_card;
cac_ops.init = cac_init;
cac_ops.finish = cac_finish;
cac_ops.select_file = cac_select_file; /* need to record object type */
cac_ops.read_binary = cac_read_binary;
return &cac1_drv;
}
| 0 |
[
"CWE-119",
"CWE-787"
] |
OpenSC
|
b75c002cfb1fd61cd20ec938ff4937d7b1a94278
| 323,552,297,020,414,850,000,000,000,000,000,000,000 | 15 |
cac1: Correctly handle the buffer limits
Found by oss-fuzz
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=18618
and others
|
PJ_DEF(pj_status_t) pjmedia_sdp_attr_remove( unsigned *count,
pjmedia_sdp_attr *attr_array[],
pjmedia_sdp_attr *attr )
{
unsigned i, removed=0;
PJ_ASSERT_RETURN(count && attr_array && attr, PJ_EINVAL);
PJ_ASSERT_RETURN(*count <= PJMEDIA_MAX_SDP_ATTR, PJ_ETOOMANY);
for (i=0; i<*count; ) {
if (attr_array[i] == attr) {
pj_array_erase(attr_array, sizeof(pjmedia_sdp_attr*),
*count, i);
--(*count);
++removed;
} else {
++i;
}
}
return removed ? PJ_SUCCESS : PJ_ENOTFOUND;
}
| 0 |
[
"CWE-121",
"CWE-120",
"CWE-787"
] |
pjproject
|
560a1346f87aabe126509bb24930106dea292b00
| 245,418,101,735,688,180,000,000,000,000,000,000,000 | 22 |
Merge pull request from GHSA-f5qg-pqcg-765m
|
int kvm_deassign_device(struct kvm *kvm,
struct kvm_assigned_dev_kernel *assigned_dev)
{
struct iommu_domain *domain = kvm->arch.iommu_domain;
struct pci_dev *pdev = NULL;
/* check if iommu exists and in use */
if (!domain)
return 0;
pdev = assigned_dev->dev;
if (pdev == NULL)
return -ENODEV;
iommu_detach_device(domain, &pdev->dev);
pci_clear_dev_assigned(pdev);
dev_info(&pdev->dev, "kvm deassign device\n");
return 0;
}
| 0 |
[
"CWE-119"
] |
kvm
|
3d32e4dbe71374a6780eaf51d719d76f9a9bf22f
| 289,197,569,723,313,740,000,000,000,000,000,000,000 | 22 |
kvm: fix excessive pages un-pinning in kvm_iommu_map error path.
The third parameter of kvm_unpin_pages() when called from
kvm_iommu_map_pages() is wrong, it should be the number of pages to un-pin
and not the page size.
This error was facilitated with an inconsistent API: kvm_pin_pages() takes
a size, but kvn_unpin_pages() takes a number of pages, so fix the problem
by matching the two.
This was introduced by commit 350b8bd ("kvm: iommu: fix the third parameter
of kvm_iommu_put_pages (CVE-2014-3601)"), which fixes the lack of
un-pinning for pages intended to be un-pinned (i.e. memory leak) but
unfortunately potentially aggravated the number of pages we un-pin that
should have stayed pinned. As far as I understand though, the same
practical mitigations apply.
This issue was found during review of Red Hat 6.6 patches to prepare
Ksplice rebootless updates.
Thanks to Vegard for his time on a late Friday evening to help me in
understanding this code.
Fixes: 350b8bd ("kvm: iommu: fix the third parameter of... (CVE-2014-3601)")
Cc: [email protected]
Signed-off-by: Quentin Casasnovas <[email protected]>
Signed-off-by: Vegard Nossum <[email protected]>
Signed-off-by: Jamie Iles <[email protected]>
Reviewed-by: Sasha Levin <[email protected]>
Signed-off-by: Paolo Bonzini <[email protected]>
|
static int sst_donate_other(const char *method, const char *addr,
const wsrep::gtid >id, bool bypass,
char **env) // carries auth info
{
int const cmd_len = 4096;
wsp::string cmd_str(cmd_len);
if (!cmd_str()) {
WSREP_ERROR(
"sst_donate_other(): "
"could not allocate cmd buffer of %d bytes",
cmd_len);
return -ENOMEM;
}
const char *binlog_opt = "";
char *binlog_opt_val = NULL;
int ret;
if ((ret = generate_binlog_opt_val(&binlog_opt_val))) {
WSREP_ERROR("sst_donate_other(): generate_binlog_opt_val() failed: %d",
ret);
return ret;
}
if (strlen(binlog_opt_val)) binlog_opt = WSREP_SST_OPT_BINLOG;
std::ostringstream uuid_oss;
uuid_oss << gtid.id();
ret = snprintf(
cmd_str(), cmd_len,
"wsrep_sst_%s " WSREP_SST_OPT_ROLE " 'donor' " WSREP_SST_OPT_ADDR
" '%s' " WSREP_SST_OPT_SOCKET " '%s' " WSREP_SST_OPT_DATA
" '%s' " WSREP_SST_OPT_BASEDIR " '%s' " WSREP_SST_OPT_PLUGINDIR
" '%s' " WSREP_SST_OPT_CONF " '%s' " WSREP_SST_OPT_CONF_SUFFIX
" '%s' " WSREP_SST_OPT_VERSION
" '%s' "
" %s '%s' " WSREP_SST_OPT_GTID
" '%s:%lld' "
"%s",
method, addr, mysqld_unix_port, mysql_real_data_home,
mysql_home_ptr ? mysql_home_ptr : "",
opt_plugin_dir_ptr ? opt_plugin_dir_ptr : "", wsrep_defaults_file,
wsrep_defaults_group_suffix, MYSQL_SERVER_VERSION MYSQL_SERVER_SUFFIX_DEF,
binlog_opt, binlog_opt_val, uuid_oss.str().c_str(), gtid.seqno().get(),
bypass ? " " WSREP_SST_OPT_BYPASS : "");
my_free(binlog_opt_val);
if (ret < 0 || ret >= cmd_len) {
WSREP_ERROR("sst_donate_other(): snprintf() failed: %d", ret);
return (ret < 0 ? ret : -EMSGSIZE);
}
if (!bypass && wsrep_sst_donor_rejects_queries) sst_reject_queries(false);
pthread_t tmp;
sst_thread_arg arg(cmd_str(), env);
mysql_mutex_lock(&arg.LOCK_wsrep_sst_thread);
ret = pthread_create(&tmp, NULL, sst_donor_thread, &arg);
if (ret) {
WSREP_ERROR("sst_donate_other(): pthread_create() failed: %d (%s)", ret,
strerror(ret));
return ret;
}
mysql_cond_wait(&arg.COND_wsrep_sst_thread, &arg.LOCK_wsrep_sst_thread);
WSREP_INFO("DONOR thread signaled with %d", arg.err);
pthread_detach(tmp);
return arg.err;
}
| 0 |
[
"CWE-77"
] |
percona-xtradb-cluster
|
8a338477c9184dd0e03a5c661e9c3a79456de8a4
| 198,827,302,373,064,200,000,000,000,000,000,000,000 | 70 |
PXC-3392: Donor uses invalid SST methods
|
static st32 getregmemstartend(const char *input) {
st32 res;
if (!input || (strlen (input) < 2) || (*input != '[') || !r_str_endswith (input, "]")) {
return -1;
}
input++;
char *temp = r_str_ndup (input, strlen (input) - 1);
if (!temp) {
return -1;
}
res = getreg (temp);
free (temp);
return res;
}
| 0 |
[
"CWE-125",
"CWE-787"
] |
radare2
|
e5c14c167b0dcf0a53d76bd50bacbbcc0dfc1ae7
| 183,135,126,341,797,900,000,000,000,000,000,000,000 | 14 |
Fix #12417/#12418 (arm assembler heap overflows)
|
void nl80211_send_roamed(struct cfg80211_registered_device *rdev,
struct net_device *netdev, const u8 *bssid,
const u8 *req_ie, size_t req_ie_len,
const u8 *resp_ie, size_t resp_ie_len, gfp_t gfp)
{
struct sk_buff *msg;
void *hdr;
msg = nlmsg_new(NLMSG_GOODSIZE, gfp);
if (!msg)
return;
hdr = nl80211hdr_put(msg, 0, 0, 0, NL80211_CMD_ROAM);
if (!hdr) {
nlmsg_free(msg);
return;
}
NLA_PUT_U32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx);
NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX, netdev->ifindex);
NLA_PUT(msg, NL80211_ATTR_MAC, ETH_ALEN, bssid);
if (req_ie)
NLA_PUT(msg, NL80211_ATTR_REQ_IE, req_ie_len, req_ie);
if (resp_ie)
NLA_PUT(msg, NL80211_ATTR_RESP_IE, resp_ie_len, resp_ie);
if (genlmsg_end(msg, hdr) < 0) {
nlmsg_free(msg);
return;
}
genlmsg_multicast_netns(wiphy_net(&rdev->wiphy), msg, 0,
nl80211_mlme_mcgrp.id, gfp);
return;
nla_put_failure:
genlmsg_cancel(msg, hdr);
nlmsg_free(msg);
| 0 |
[
"CWE-362",
"CWE-119"
] |
linux
|
208c72f4fe44fe09577e7975ba0e7fa0278f3d03
| 162,930,249,591,474,520,000,000,000,000,000,000,000 | 40 |
nl80211: fix check for valid SSID size in scan operations
In both trigger_scan and sched_scan operations, we were checking for
the SSID length before assigning the value correctly. Since the
memory was just kzalloc'ed, the check was always failing and SSID with
over 32 characters were allowed to go through.
This was causing a buffer overflow when copying the actual SSID to the
proper place.
This bug has been there since 2.6.29-rc4.
Cc: [email protected]
Signed-off-by: Luciano Coelho <[email protected]>
Signed-off-by: John W. Linville <[email protected]>
|
static int aesni_cbc_hmac_sha1_cipher(EVP_CIPHER_CTX *ctx, unsigned char *out,
const unsigned char *in, size_t len)
{
EVP_AES_HMAC_SHA1 *key = data(ctx);
unsigned int l;
size_t plen = key->payload_length, iv = 0, /* explicit IV in TLS 1.1 and
* later */
sha_off = 0;
# if defined(STITCHED_CALL)
size_t aes_off = 0, blocks;
sha_off = SHA_CBLOCK - key->md.num;
# endif
key->payload_length = NO_PAYLOAD_LENGTH;
if (len % AES_BLOCK_SIZE)
return 0;
if (ctx->encrypt) {
if (plen == NO_PAYLOAD_LENGTH)
plen = len;
else if (len !=
((plen + SHA_DIGEST_LENGTH +
AES_BLOCK_SIZE) & -AES_BLOCK_SIZE))
return 0;
else if (key->aux.tls_ver >= TLS1_1_VERSION)
iv = AES_BLOCK_SIZE;
# if defined(STITCHED_CALL)
if (plen > (sha_off + iv)
&& (blocks = (plen - (sha_off + iv)) / SHA_CBLOCK)) {
SHA1_Update(&key->md, in + iv, sha_off);
aesni_cbc_sha1_enc(in, out, blocks, &key->ks,
ctx->iv, &key->md, in + iv + sha_off);
blocks *= SHA_CBLOCK;
aes_off += blocks;
sha_off += blocks;
key->md.Nh += blocks >> 29;
key->md.Nl += blocks <<= 3;
if (key->md.Nl < (unsigned int)blocks)
key->md.Nh++;
} else {
sha_off = 0;
}
# endif
sha_off += iv;
SHA1_Update(&key->md, in + sha_off, plen - sha_off);
if (plen != len) { /* "TLS" mode of operation */
if (in != out)
memcpy(out + aes_off, in + aes_off, plen - aes_off);
/* calculate HMAC and append it to payload */
SHA1_Final(out + plen, &key->md);
key->md = key->tail;
SHA1_Update(&key->md, out + plen, SHA_DIGEST_LENGTH);
SHA1_Final(out + plen, &key->md);
/* pad the payload|hmac */
plen += SHA_DIGEST_LENGTH;
for (l = len - plen - 1; plen < len; plen++)
out[plen] = l;
/* encrypt HMAC|padding at once */
aesni_cbc_encrypt(out + aes_off, out + aes_off, len - aes_off,
&key->ks, ctx->iv, 1);
} else {
aesni_cbc_encrypt(in + aes_off, out + aes_off, len - aes_off,
&key->ks, ctx->iv, 1);
}
} else {
union {
unsigned int u[SHA_DIGEST_LENGTH / sizeof(unsigned int)];
unsigned char c[32 + SHA_DIGEST_LENGTH];
} mac, *pmac;
/* arrange cache line alignment */
pmac = (void *)(((size_t)mac.c + 31) & ((size_t)0 - 32));
if (plen != NO_PAYLOAD_LENGTH) { /* "TLS" mode of operation */
size_t inp_len, mask, j, i;
unsigned int res, maxpad, pad, bitlen;
int ret = 1;
union {
unsigned int u[SHA_LBLOCK];
unsigned char c[SHA_CBLOCK];
} *data = (void *)key->md.data;
# if defined(STITCHED_DECRYPT_CALL)
unsigned char tail_iv[AES_BLOCK_SIZE];
int stitch = 0;
# endif
if ((key->aux.tls_aad[plen - 4] << 8 | key->aux.tls_aad[plen - 3])
>= TLS1_1_VERSION) {
if (len < (AES_BLOCK_SIZE + SHA_DIGEST_LENGTH + 1))
return 0;
/* omit explicit iv */
memcpy(ctx->iv, in, AES_BLOCK_SIZE);
in += AES_BLOCK_SIZE;
out += AES_BLOCK_SIZE;
len -= AES_BLOCK_SIZE;
} else if (len < (SHA_DIGEST_LENGTH + 1))
return 0;
# if defined(STITCHED_DECRYPT_CALL)
if (len >= 1024 && ctx->key_len == 32) {
/* decrypt last block */
memcpy(tail_iv, in + len - 2 * AES_BLOCK_SIZE,
AES_BLOCK_SIZE);
aesni_cbc_encrypt(in + len - AES_BLOCK_SIZE,
out + len - AES_BLOCK_SIZE, AES_BLOCK_SIZE,
&key->ks, tail_iv, 0);
stitch = 1;
} else
# endif
/* decrypt HMAC|padding at once */
aesni_cbc_encrypt(in, out, len, &key->ks, ctx->iv, 0);
/* figure out payload length */
pad = out[len - 1];
maxpad = len - (SHA_DIGEST_LENGTH + 1);
maxpad |= (255 - maxpad) >> (sizeof(maxpad) * 8 - 8);
maxpad &= 255;
ret &= constant_time_ge(maxpad, pad);
inp_len = len - (SHA_DIGEST_LENGTH + pad + 1);
mask = (0 - ((inp_len - len) >> (sizeof(inp_len) * 8 - 1)));
inp_len &= mask;
ret &= (int)mask;
key->aux.tls_aad[plen - 2] = inp_len >> 8;
key->aux.tls_aad[plen - 1] = inp_len;
/* calculate HMAC */
key->md = key->head;
SHA1_Update(&key->md, key->aux.tls_aad, plen);
# if defined(STITCHED_DECRYPT_CALL)
if (stitch) {
blocks = (len - (256 + 32 + SHA_CBLOCK)) / SHA_CBLOCK;
aes_off = len - AES_BLOCK_SIZE - blocks * SHA_CBLOCK;
sha_off = SHA_CBLOCK - plen;
aesni_cbc_encrypt(in, out, aes_off, &key->ks, ctx->iv, 0);
SHA1_Update(&key->md, out, sha_off);
aesni256_cbc_sha1_dec(in + aes_off,
out + aes_off, blocks, &key->ks,
ctx->iv, &key->md, out + sha_off);
sha_off += blocks *= SHA_CBLOCK;
out += sha_off;
len -= sha_off;
inp_len -= sha_off;
key->md.Nl += (blocks << 3); /* at most 18 bits */
memcpy(ctx->iv, tail_iv, AES_BLOCK_SIZE);
}
# endif
# if 1
len -= SHA_DIGEST_LENGTH; /* amend mac */
if (len >= (256 + SHA_CBLOCK)) {
j = (len - (256 + SHA_CBLOCK)) & (0 - SHA_CBLOCK);
j += SHA_CBLOCK - key->md.num;
SHA1_Update(&key->md, out, j);
out += j;
len -= j;
inp_len -= j;
}
/* but pretend as if we hashed padded payload */
bitlen = key->md.Nl + (inp_len << 3); /* at most 18 bits */
# ifdef BSWAP4
bitlen = BSWAP4(bitlen);
# else
mac.c[0] = 0;
mac.c[1] = (unsigned char)(bitlen >> 16);
mac.c[2] = (unsigned char)(bitlen >> 8);
mac.c[3] = (unsigned char)bitlen;
bitlen = mac.u[0];
# endif
pmac->u[0] = 0;
pmac->u[1] = 0;
pmac->u[2] = 0;
pmac->u[3] = 0;
pmac->u[4] = 0;
for (res = key->md.num, j = 0; j < len; j++) {
size_t c = out[j];
mask = (j - inp_len) >> (sizeof(j) * 8 - 8);
c &= mask;
c |= 0x80 & ~mask & ~((inp_len - j) >> (sizeof(j) * 8 - 8));
data->c[res++] = (unsigned char)c;
if (res != SHA_CBLOCK)
continue;
/* j is not incremented yet */
mask = 0 - ((inp_len + 7 - j) >> (sizeof(j) * 8 - 1));
data->u[SHA_LBLOCK - 1] |= bitlen & mask;
sha1_block_data_order(&key->md, data, 1);
mask &= 0 - ((j - inp_len - 72) >> (sizeof(j) * 8 - 1));
pmac->u[0] |= key->md.h0 & mask;
pmac->u[1] |= key->md.h1 & mask;
pmac->u[2] |= key->md.h2 & mask;
pmac->u[3] |= key->md.h3 & mask;
pmac->u[4] |= key->md.h4 & mask;
res = 0;
}
for (i = res; i < SHA_CBLOCK; i++, j++)
data->c[i] = 0;
if (res > SHA_CBLOCK - 8) {
mask = 0 - ((inp_len + 8 - j) >> (sizeof(j) * 8 - 1));
data->u[SHA_LBLOCK - 1] |= bitlen & mask;
sha1_block_data_order(&key->md, data, 1);
mask &= 0 - ((j - inp_len - 73) >> (sizeof(j) * 8 - 1));
pmac->u[0] |= key->md.h0 & mask;
pmac->u[1] |= key->md.h1 & mask;
pmac->u[2] |= key->md.h2 & mask;
pmac->u[3] |= key->md.h3 & mask;
pmac->u[4] |= key->md.h4 & mask;
memset(data, 0, SHA_CBLOCK);
j += 64;
}
data->u[SHA_LBLOCK - 1] = bitlen;
sha1_block_data_order(&key->md, data, 1);
mask = 0 - ((j - inp_len - 73) >> (sizeof(j) * 8 - 1));
pmac->u[0] |= key->md.h0 & mask;
pmac->u[1] |= key->md.h1 & mask;
pmac->u[2] |= key->md.h2 & mask;
pmac->u[3] |= key->md.h3 & mask;
pmac->u[4] |= key->md.h4 & mask;
# ifdef BSWAP4
pmac->u[0] = BSWAP4(pmac->u[0]);
pmac->u[1] = BSWAP4(pmac->u[1]);
pmac->u[2] = BSWAP4(pmac->u[2]);
pmac->u[3] = BSWAP4(pmac->u[3]);
pmac->u[4] = BSWAP4(pmac->u[4]);
# else
for (i = 0; i < 5; i++) {
res = pmac->u[i];
pmac->c[4 * i + 0] = (unsigned char)(res >> 24);
pmac->c[4 * i + 1] = (unsigned char)(res >> 16);
pmac->c[4 * i + 2] = (unsigned char)(res >> 8);
pmac->c[4 * i + 3] = (unsigned char)res;
}
# endif
len += SHA_DIGEST_LENGTH;
# else
SHA1_Update(&key->md, out, inp_len);
res = key->md.num;
SHA1_Final(pmac->c, &key->md);
{
unsigned int inp_blocks, pad_blocks;
/* but pretend as if we hashed padded payload */
inp_blocks =
1 + ((SHA_CBLOCK - 9 - res) >> (sizeof(res) * 8 - 1));
res += (unsigned int)(len - inp_len);
pad_blocks = res / SHA_CBLOCK;
res %= SHA_CBLOCK;
pad_blocks +=
1 + ((SHA_CBLOCK - 9 - res) >> (sizeof(res) * 8 - 1));
for (; inp_blocks < pad_blocks; inp_blocks++)
sha1_block_data_order(&key->md, data, 1);
}
# endif
key->md = key->tail;
SHA1_Update(&key->md, pmac->c, SHA_DIGEST_LENGTH);
SHA1_Final(pmac->c, &key->md);
/* verify HMAC */
out += inp_len;
len -= inp_len;
# if 1
{
unsigned char *p = out + len - 1 - maxpad - SHA_DIGEST_LENGTH;
size_t off = out - p;
unsigned int c, cmask;
maxpad += SHA_DIGEST_LENGTH;
for (res = 0, i = 0, j = 0; j < maxpad; j++) {
c = p[j];
cmask =
((int)(j - off - SHA_DIGEST_LENGTH)) >> (sizeof(int) *
8 - 1);
res |= (c ^ pad) & ~cmask; /* ... and padding */
cmask &= ((int)(off - 1 - j)) >> (sizeof(int) * 8 - 1);
res |= (c ^ pmac->c[i]) & cmask;
i += 1 & cmask;
}
maxpad -= SHA_DIGEST_LENGTH;
res = 0 - ((0 - res) >> (sizeof(res) * 8 - 1));
ret &= (int)~res;
}
# else
for (res = 0, i = 0; i < SHA_DIGEST_LENGTH; i++)
res |= out[i] ^ pmac->c[i];
res = 0 - ((0 - res) >> (sizeof(res) * 8 - 1));
ret &= (int)~res;
/* verify padding */
pad = (pad & ~res) | (maxpad & res);
out = out + len - 1 - pad;
for (res = 0, i = 0; i < pad; i++)
res |= out[i] ^ pad;
res = (0 - res) >> (sizeof(res) * 8 - 1);
ret &= (int)~res;
# endif
return ret;
} else {
# if defined(STITCHED_DECRYPT_CALL)
if (len >= 1024 && ctx->key_len == 32) {
if (sha_off %= SHA_CBLOCK)
blocks = (len - 3 * SHA_CBLOCK) / SHA_CBLOCK;
else
blocks = (len - 2 * SHA_CBLOCK) / SHA_CBLOCK;
aes_off = len - blocks * SHA_CBLOCK;
aesni_cbc_encrypt(in, out, aes_off, &key->ks, ctx->iv, 0);
SHA1_Update(&key->md, out, sha_off);
aesni256_cbc_sha1_dec(in + aes_off,
out + aes_off, blocks, &key->ks,
ctx->iv, &key->md, out + sha_off);
sha_off += blocks *= SHA_CBLOCK;
out += sha_off;
len -= sha_off;
key->md.Nh += blocks >> 29;
key->md.Nl += blocks <<= 3;
if (key->md.Nl < (unsigned int)blocks)
key->md.Nh++;
} else
# endif
/* decrypt HMAC|padding at once */
aesni_cbc_encrypt(in, out, len, &key->ks, ctx->iv, 0);
SHA1_Update(&key->md, out, len);
}
}
return 1;
}
| 0 |
[
"CWE-310"
] |
openssl
|
68595c0c2886e7942a14f98c17a55a88afb6c292
| 212,410,700,239,398,340,000,000,000,000,000,000,000 | 356 |
Check that we have enough padding characters.
Reviewed-by: Emilia Käsper <[email protected]>
CVE-2016-2107
MR: #2572
|
static int vt_bind(struct con_driver *con)
{
const struct consw *defcsw = NULL, *csw = NULL;
int i, more = 1, first = -1, last = -1, deflt = 0;
if (!con->con || !(con->flag & CON_DRIVER_FLAG_MODULE))
goto err;
csw = con->con;
for (i = 0; i < MAX_NR_CON_DRIVER; i++) {
struct con_driver *con = ®istered_con_driver[i];
if (con->con && !(con->flag & CON_DRIVER_FLAG_MODULE)) {
defcsw = con->con;
break;
}
}
if (!defcsw)
goto err;
while (more) {
more = 0;
for (i = con->first; i <= con->last; i++) {
if (con_driver_map[i] == defcsw) {
if (first == -1)
first = i;
last = i;
more = 1;
} else if (first != -1)
break;
}
if (first == 0 && last == MAX_NR_CONSOLES -1)
deflt = 1;
if (first != -1)
do_bind_con_driver(csw, first, last, deflt);
first = -1;
last = -1;
deflt = 0;
}
err:
return 0;
}
| 0 |
[
"CWE-125"
] |
linux
|
3c4e0dff2095c579b142d5a0693257f1c58b4804
| 319,372,505,925,923,180,000,000,000,000,000,000,000 | 49 |
vt: Disable KD_FONT_OP_COPY
It's buggy:
On Fri, Nov 06, 2020 at 10:30:08PM +0800, Minh Yuan wrote:
> We recently discovered a slab-out-of-bounds read in fbcon in the latest
> kernel ( v5.10-rc2 for now ). The root cause of this vulnerability is that
> "fbcon_do_set_font" did not handle "vc->vc_font.data" and
> "vc->vc_font.height" correctly, and the patch
> <https://lkml.org/lkml/2020/9/27/223> for VT_RESIZEX can't handle this
> issue.
>
> Specifically, we use KD_FONT_OP_SET to set a small font.data for tty6, and
> use KD_FONT_OP_SET again to set a large font.height for tty1. After that,
> we use KD_FONT_OP_COPY to assign tty6's vc_font.data to tty1's vc_font.data
> in "fbcon_do_set_font", while tty1 retains the original larger
> height. Obviously, this will cause an out-of-bounds read, because we can
> access a smaller vc_font.data with a larger vc_font.height.
Further there was only one user ever.
- Android's loadfont, busybox and console-tools only ever use OP_GET
and OP_SET
- fbset documentation only mentions the kernel cmdline font: option,
not anything else.
- systemd used OP_COPY before release 232 published in Nov 2016
Now unfortunately the crucial report seems to have gone down with
gmane, and the commit message doesn't say much. But the pull request
hints at OP_COPY being broken
https://github.com/systemd/systemd/pull/3651
So in other words, this never worked, and the only project which
foolishly every tried to use it, realized that rather quickly too.
Instead of trying to fix security issues here on dead code by adding
missing checks, fix the entire thing by removing the functionality.
Note that systemd code using the OP_COPY function ignored the return
value, so it doesn't matter what we're doing here really - just in
case a lone server somewhere happens to be extremely unlucky and
running an affected old version of systemd. The relevant code from
font_copy_to_all_vcs() in systemd was:
/* copy font from active VT, where the font was uploaded to */
cfo.op = KD_FONT_OP_COPY;
cfo.height = vcs.v_active-1; /* tty1 == index 0 */
(void) ioctl(vcfd, KDFONTOP, &cfo);
Note this just disables the ioctl, garbage collecting the now unused
callbacks is left for -next.
v2: Tetsuo found the old mail, which allowed me to find it on another
archive. Add the link too.
Acked-by: Peilin Ye <[email protected]>
Reported-by: Minh Yuan <[email protected]>
References: https://lists.freedesktop.org/archives/systemd-devel/2016-June/036935.html
References: https://github.com/systemd/systemd/pull/3651
Cc: Greg KH <[email protected]>
Cc: Peilin Ye <[email protected]>
Cc: Tetsuo Handa <[email protected]>
Signed-off-by: Daniel Vetter <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Greg Kroah-Hartman <[email protected]>
|
void LibRaw::copy_bayer(unsigned short cblack[4],unsigned short *dmaxp)
{
// Both cropped and uncropped
int row;
#if defined(LIBRAW_USE_OPENMP)
#pragma omp parallel for default(shared)
#endif
for (row=0; row < S.height; row++)
{
int col;
unsigned short ldmax = 0;
for (col=0; col < S.width; col++)
{
unsigned short val = imgdata.rawdata.raw_image[(row+S.top_margin)*S.raw_pitch/2+(col+S.left_margin)];
int cc = fcol(row,col);
if(val>cblack[cc])
{
val-=cblack[cc];
if(val>ldmax)ldmax = val;
}
else
val = 0;
imgdata.image[((row) >> IO.shrink)*S.iwidth + ((col) >> IO.shrink)][cc] = val;
}
#if defined(LIBRAW_USE_OPENMP)
#pragma omp critical(dataupdate)
#endif
{
if(*dmaxp < ldmax)
*dmaxp = ldmax;
}
}
}
| 0 |
[
"CWE-119",
"CWE-787"
] |
LibRaw
|
2f912f5b33582961b1cdbd9fd828589f8b78f21d
| 332,653,337,447,867,200,000,000,000,000,000,000,000 | 34 |
fixed wrong data_maximum calcluation; prevent out-of-buffer in exp_bef
|
nfs4_find_client_ident(struct net *net, int cb_ident)
{
struct nfs_client *clp;
struct nfs_net *nn = net_generic(net, nfs_net_id);
spin_lock(&nn->nfs_client_lock);
clp = idr_find(&nn->cb_ident_idr, cb_ident);
if (clp)
refcount_inc(&clp->cl_count);
spin_unlock(&nn->nfs_client_lock);
return clp;
}
| 0 |
[
"CWE-703"
] |
linux
|
dd99e9f98fbf423ff6d365b37a98e8879170f17c
| 276,910,641,059,349,030,000,000,000,000,000,000,000 | 12 |
NFSv4: Initialise connection to the server in nfs4_alloc_client()
Set up the connection to the NFSv4 server in nfs4_alloc_client(), before
we've added the struct nfs_client to the net-namespace's nfs_client_list
so that a downed server won't cause other mounts to hang in the trunking
detection code.
Reported-by: Michael Wakabayashi <[email protected]>
Fixes: 5c6e5b60aae4 ("NFS: Fix an Oops in the pNFS files and flexfiles connection setup to the DS")
Signed-off-by: Trond Myklebust <[email protected]>
|
NICState *qemu_get_nic(NetClientState *nc)
{
NetClientState *nc0 = nc - nc->queue_index;
return (NICState *)((void *)nc0 - nc->info->size);
}
| 0 |
[
"CWE-190"
] |
qemu
|
25c01bd19d0e4b66f357618aeefda1ef7a41e21a
| 246,563,926,595,963,430,000,000,000,000,000,000,000 | 6 |
net: drop too large packet early
We try to detect and drop too large packet (>INT_MAX) in 1592a9947036
("net: ignore packet size greater than INT_MAX") during packet
delivering. Unfortunately, this is not sufficient as we may hit
another integer overflow when trying to queue such large packet in
qemu_net_queue_append_iov():
- size of the allocation may overflow on 32bit
- packet->size is integer which may overflow even on 64bit
Fixing this by moving the check to qemu_sendv_packet_async() which is
the entrance of all networking codes and reduce the limit to
NET_BUFSIZE to be more conservative. This works since:
- For the callers that call qemu_sendv_packet_async() directly, they
only care about if zero is returned to determine whether to prevent
the source from producing more packets. A callback will be triggered
if peer can accept more then source could be enabled. This is
usually used by high speed networking implementation like virtio-net
or netmap.
- For the callers that call qemu_sendv_packet() that calls
qemu_sendv_packet_async() indirectly, they often ignore the return
value. In this case qemu will just the drop packets if peer can't
receive.
Qemu will copy the packet if it was queued. So it was safe for both
kinds of the callers to assume the packet was sent.
Since we move the check from qemu_deliver_packet_iov() to
qemu_sendv_packet_async(), it would be safer to make
qemu_deliver_packet_iov() static to prevent any external user in the
future.
This is a revised patch of CVE-2018-17963.
Cc: [email protected]
Cc: Li Qiang <[email protected]>
Fixes: 1592a9947036 ("net: ignore packet size greater than INT_MAX")
Reported-by: Li Qiang <[email protected]>
Reviewed-by: Li Qiang <[email protected]>
Signed-off-by: Jason Wang <[email protected]>
Reviewed-by: Thomas Huth <[email protected]>
Message-id: [email protected]
Signed-off-by: Peter Maydell <[email protected]>
|
char *getPROCID(msg_t *pM, sbool bLockMutex)
{
ISOBJ_TYPE_assert(pM, msg);
preparePROCID(pM, bLockMutex);
return (pM->pCSPROCID == NULL) ? "-" : (char*) cstrGetSzStrNoNULL(pM->pCSPROCID);
}
| 0 |
[
"CWE-772"
] |
rsyslog
|
8083bd1433449fd2b1b79bf759f782e0f64c0cd2
| 52,836,559,374,690,530,000,000,000,000,000,000,000 | 6 |
backporting abort condition fix from 5.7.7
|
static void setautogain(struct gspca_dev *gspca_dev, s32 val)
{
struct sd *sd = (struct sd *) gspca_dev;
i2c_w_mask(sd, 0x13, val ? 0x05 : 0x00, 0x05);
}
| 0 |
[
"CWE-476"
] |
linux
|
998912346c0da53a6dbb71fab3a138586b596b30
| 201,847,218,580,452,000,000,000,000,000,000,000,000 | 6 |
media: ov519: add missing endpoint sanity checks
Make sure to check that we have at least one endpoint before accessing
the endpoint array to avoid dereferencing a NULL-pointer on stream
start.
Note that these sanity checks are not redundant as the driver is mixing
looking up altsettings by index and by number, which need not coincide.
Fixes: 1876bb923c98 ("V4L/DVB (12079): gspca_ov519: add support for the ov511 bridge")
Fixes: b282d87332f5 ("V4L/DVB (12080): gspca_ov519: Fix ov518+ with OV7620AE (Trust spacecam 320)")
Cc: stable <[email protected]> # 2.6.31
Cc: Hans de Goede <[email protected]>
Signed-off-by: Johan Hovold <[email protected]>
Signed-off-by: Hans Verkuil <[email protected]>
Signed-off-by: Mauro Carvalho Chehab <[email protected]>
|
static bool sdhci_can_issue_command(SDHCIState *s)
{
if (!SDHC_CLOCK_IS_ON(s->clkcon) ||
(((s->prnsts & SDHC_DATA_INHIBIT) || s->stopped_state) &&
((s->cmdreg & SDHC_CMD_DATA_PRESENT) ||
((s->cmdreg & SDHC_CMD_RESPONSE) == SDHC_CMD_RSP_WITH_BUSY &&
!(SDHC_COMMAND_TYPE(s->cmdreg) == SDHC_CMD_ABORT))))) {
return false;
}
return true;
}
| 0 |
[
"CWE-119"
] |
qemu
|
dfba99f17feb6d4a129da19d38df1bcd8579d1c3
| 319,798,672,163,476,900,000,000,000,000,000,000,000 | 12 |
hw/sd/sdhci: Fix DMA Transfer Block Size field
The 'Transfer Block Size' field is 12-bit wide.
See section '2.2.2. Block Size Register (Offset 004h)' in datasheet.
Two different bug reproducer available:
- https://bugs.launchpad.net/qemu/+bug/1892960
- https://ruhr-uni-bochum.sciebo.de/s/NNWP2GfwzYKeKwE?path=%2Fsdhci_oob_write1
Cc: [email protected]
Buglink: https://bugs.launchpad.net/qemu/+bug/1892960
Fixes: d7dfca0807a ("hw/sdhci: introduce standard SD host controller")
Reported-by: Alexander Bulekov <[email protected]>
Signed-off-by: Philippe Mathieu-Daudé <[email protected]>
Reviewed-by: Prasad J Pandit <[email protected]>
Tested-by: Alexander Bulekov <[email protected]>
Message-Id: <[email protected]>
|
static inline bool rt_is_expired(const struct rtable *rth)
{
return rth->rt_genid != rt_genid_ipv4(dev_net(rth->dst.dev));
}
| 0 |
[
"CWE-17"
] |
linux
|
df4d92549f23e1c037e83323aff58a21b3de7fe0
| 282,011,075,469,902,150,000,000,000,000,000,000,000 | 4 |
ipv4: try to cache dst_entries which would cause a redirect
Not caching dst_entries which cause redirects could be exploited by hosts
on the same subnet, causing a severe DoS attack. This effect aggravated
since commit f88649721268999 ("ipv4: fix dst race in sk_dst_get()").
Lookups causing redirects will be allocated with DST_NOCACHE set which
will force dst_release to free them via RCU. Unfortunately waiting for
RCU grace period just takes too long, we can end up with >1M dst_entries
waiting to be released and the system will run OOM. rcuos threads cannot
catch up under high softirq load.
Attaching the flag to emit a redirect later on to the specific skb allows
us to cache those dst_entries thus reducing the pressure on allocation
and deallocation.
This issue was discovered by Marcelo Leitner.
Cc: Julian Anastasov <[email protected]>
Signed-off-by: Marcelo Leitner <[email protected]>
Signed-off-by: Florian Westphal <[email protected]>
Signed-off-by: Hannes Frederic Sowa <[email protected]>
Signed-off-by: Julian Anastasov <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
|
static struct dir *squashfs_opendir(unsigned int block_start, unsigned int offset,
struct inode **i)
{
squashfs_dir_header_2 dirh;
char buffer[sizeof(squashfs_dir_entry_2) + SQUASHFS_NAME_LEN + 1]
__attribute__((aligned));
squashfs_dir_entry_2 *dire = (squashfs_dir_entry_2 *) buffer;
long long start;
int bytes;
int dir_count, size;
struct dir_ent *new_dir;
struct dir *dir;
TRACE("squashfs_opendir: inode start block %d, offset %d\n",
block_start, offset);
*i = read_inode(block_start, offset);
dir = malloc(sizeof(struct dir));
if(dir == NULL)
EXIT_UNSQUASH("squashfs_opendir: malloc failed!\n");
dir->dir_count = 0;
dir->cur_entry = 0;
dir->mode = (*i)->mode;
dir->uid = (*i)->uid;
dir->guid = (*i)->gid;
dir->mtime = (*i)->time;
dir->xattr = (*i)->xattr;
dir->dirs = NULL;
if ((*i)->data == 0)
/*
* if the directory is empty, skip the unnecessary
* lookup_entry, this fixes the corner case with
* completely empty filesystems where lookup_entry correctly
* returning -1 is incorrectly treated as an error
*/
return dir;
start = sBlk.s.directory_table_start + (*i)->start;
bytes = lookup_entry(directory_table_hash, start);
if(bytes == -1)
EXIT_UNSQUASH("squashfs_opendir: directory block %d not "
"found!\n", block_start);
bytes += (*i)->offset;
size = (*i)->data + bytes;
while(bytes < size) {
if(swap) {
squashfs_dir_header_2 sdirh;
memcpy(&sdirh, directory_table + bytes, sizeof(sdirh));
SQUASHFS_SWAP_DIR_HEADER_2(&dirh, &sdirh);
} else
memcpy(&dirh, directory_table + bytes, sizeof(dirh));
dir_count = dirh.count + 1;
TRACE("squashfs_opendir: Read directory header @ byte position "
"%d, %d directory entries\n", bytes, dir_count);
bytes += sizeof(dirh);
/* dir_count should never be larger than SQUASHFS_DIR_COUNT */
if(dir_count > SQUASHFS_DIR_COUNT) {
ERROR("File system corrupted: too many entries in directory\n");
goto corrupted;
}
while(dir_count--) {
if(swap) {
squashfs_dir_entry_2 sdire;
memcpy(&sdire, directory_table + bytes,
sizeof(sdire));
SQUASHFS_SWAP_DIR_ENTRY_2(dire, &sdire);
} else
memcpy(dire, directory_table + bytes,
sizeof(*dire));
bytes += sizeof(*dire);
/* size should never be SQUASHFS_NAME_LEN or larger */
if(dire->size >= SQUASHFS_NAME_LEN) {
ERROR("File system corrupted: filename too long\n");
goto corrupted;
}
memcpy(dire->name, directory_table + bytes,
dire->size + 1);
dire->name[dire->size + 1] = '\0';
/* check name for invalid characters (i.e /, ., ..) */
if(check_name(dire->name, dire->size + 1) == FALSE) {
ERROR("File system corrupted: invalid characters in name\n");
goto corrupted;
}
TRACE("squashfs_opendir: directory entry %s, inode "
"%d:%d, type %d\n", dire->name,
dirh.start_block, dire->offset, dire->type);
if((dir->dir_count % DIR_ENT_SIZE) == 0) {
new_dir = realloc(dir->dirs, (dir->dir_count +
DIR_ENT_SIZE) * sizeof(struct dir_ent));
if(new_dir == NULL)
EXIT_UNSQUASH("squashfs_opendir: "
"realloc failed!\n");
dir->dirs = new_dir;
}
strcpy(dir->dirs[dir->dir_count].name, dire->name);
dir->dirs[dir->dir_count].start_block =
dirh.start_block;
dir->dirs[dir->dir_count].offset = dire->offset;
dir->dirs[dir->dir_count].type = dire->type;
dir->dir_count ++;
bytes += dire->size + 1;
}
}
return dir;
corrupted:
free(dir->dirs);
free(dir);
return NULL;
}
| 0 |
[
"CWE-22"
] |
squashfs-tools
|
79b5a555058eef4e1e7ff220c344d39f8cd09646
| 11,333,009,479,078,924,000,000,000,000,000,000,000 | 123 |
Unsquashfs: fix write outside destination directory exploit
An issue on Github (https://github.com/plougher/squashfs-tools/issues/72)
shows how some specially crafted Squashfs filesystems containing
invalid file names (with '/' and ..) can cause Unsquashfs to write
files outside of the destination directory.
This commit fixes this exploit by checking all names for
validity.
In doing so I have also added checks for '.' and for names that
are shorter than they should be (names in the file system should
not have '\0' terminators).
Signed-off-by: Phillip Lougher <[email protected]>
|
static inline void deshufflePalette(Image *image,PixelInfo* oldColormap)
{
const size_t
pages=image->colors/32, /* Pages per CLUT */
blocks=4, /* Blocks per page */
colors=8; /* Colors per block */
int
page;
size_t
i=0;
(void) memcpy(oldColormap,image->colormap,(size_t)image->colors*
sizeof(*oldColormap));
/*
* Swap the 2nd and 3rd block in each page
*/
for (page=0; page < (ssize_t) pages; page++)
{
memcpy(&(image->colormap[i+1*colors]),&(oldColormap[i+2*colors]),colors*
sizeof(PixelInfo));
memcpy(&(image->colormap[i+2*colors]),&(oldColormap[i+1*colors]),colors*
sizeof(PixelInfo));
i+=blocks*colors;
}
}
| 0 |
[
"CWE-617"
] |
ImageMagick
|
716496e6df0add89e9679d6da9c0afca814cfe49
| 116,356,806,419,684,930,000,000,000,000,000,000,000 | 29 |
do not attempt to write a null image list (thanks to Vinay Rohila)
|
static int coolkey_read_binary(sc_card_t *card, unsigned int idx,
u8 *buf, size_t count, unsigned long flags)
{
coolkey_private_data_t * priv = COOLKEY_DATA(card);
int r = 0, len;
u8 *data = NULL;
SC_FUNC_CALLED(card->ctx, SC_LOG_DEBUG_VERBOSE);
if (idx > priv->obj->length) {
LOG_FUNC_RETURN(card->ctx, SC_ERROR_FILE_END_REACHED);
}
/* if we've already read the data, just return it */
if (priv->obj->data) {
sc_log(card->ctx,
"returning cached value idx=%u count=%"SC_FORMAT_LEN_SIZE_T"u",
idx, count);
len = MIN(count, priv->obj->length-idx);
memcpy(buf, &priv->obj->data[idx], len);
LOG_FUNC_RETURN(card->ctx, len);
}
sc_log(card->ctx,
"clearing cache idx=%u count=%"SC_FORMAT_LEN_SIZE_T"u",
idx, count);
data = malloc(priv->obj->length);
if (data == NULL) {
r = SC_ERROR_OUT_OF_MEMORY;
goto done;
}
r = coolkey_read_object(card, priv->obj->id, 0, data, priv->obj->length,
priv->nonce, sizeof(priv->nonce));
if (r < 0)
goto done;
if ((size_t) r != priv->obj->length) {
priv->obj->length = r;
}
/* OK we've read the data, now copy the required portion out to the callers buffer */
len = MIN(count, priv->obj->length-idx);
memcpy(buf, &data[idx], len);
r = len;
/* cache the data in the object */
priv->obj->data=data;
data = NULL;
done:
if (data)
free(data);
LOG_FUNC_RETURN(card->ctx, r);
}
| 0 |
[
"CWE-415"
] |
OpenSC
|
c246f6f69a749d4f68626b40795a4f69168008f4
| 323,101,607,731,229,100,000,000,000,000,000,000,000 | 56 |
coolkey: Make sure the object ID is unique when filling list
Thanks to oss-fuzz
https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=19208
|
SetFieldNames(matvar_t *matvar, char *buf, size_t nfields, mat_uint32_t fieldname_length)
{
size_t i;
matvar->internal->num_fields = nfields;
matvar->internal->fieldnames =
(char**)calloc(nfields,sizeof(*matvar->internal->fieldnames));
if ( NULL != matvar->internal->fieldnames ) {
for ( i = 0; i < nfields; i++ ) {
matvar->internal->fieldnames[i] = (char*)malloc(fieldname_length);
if ( NULL != matvar->internal->fieldnames[i] ) {
memcpy(matvar->internal->fieldnames[i], buf+i*fieldname_length, fieldname_length);
matvar->internal->fieldnames[i][fieldname_length-1] = '\0';
}
}
}
}
| 0 |
[
"CWE-190",
"CWE-401"
] |
matio
|
5fa49ef9fc4368fe3d19b5fdaa36d8fa5e7f4606
| 207,986,747,634,565,400,000,000,000,000,000,000,000 | 16 |
Fix integer addition overflow
As reported by https://github.com/tbeu/matio/issues/121
|
auto GetTargetAndAlsoCheckForProxy() -> Local<Object> {
auto object = Local<Object>::Cast(Deref(target));
if (HasProxy(object)) {
throw RuntimeTypeError("Object is or has proxy");
}
return object;
}
| 0 |
[
"CWE-913"
] |
isolated-vm
|
2646e6c1558bac66285daeab54c7d490ed332b15
| 172,241,845,715,242,950,000,000,000,000,000,000,000 | 7 |
Don't invoke accessors or proxies via Reference functions
|
uint check_join_cache_usage(JOIN_TAB *tab,
ulonglong options,
uint no_jbuf_after,
uint table_index,
JOIN_TAB *prev_tab)
{
Cost_estimate cost;
uint flags= 0;
ha_rows rows= 0;
uint bufsz= 4096;
JOIN_CACHE *prev_cache=0;
JOIN *join= tab->join;
MEM_ROOT *root= join->thd->mem_root;
uint cache_level= tab->used_join_cache_level;
bool force_unlinked_cache=
!(join->allowed_join_cache_types & JOIN_CACHE_INCREMENTAL_BIT);
bool no_hashed_cache=
!(join->allowed_join_cache_types & JOIN_CACHE_HASHED_BIT);
bool no_bka_cache=
!(join->allowed_join_cache_types & JOIN_CACHE_BKA_BIT);
join->return_tab= 0;
/*
Don't use join cache if @@join_cache_level==0 or this table is the first
one join suborder (either at top level or inside a bush)
*/
if (cache_level == 0 || !prev_tab)
return 0;
if (force_unlinked_cache && (cache_level%2 == 0))
cache_level--;
if (options & SELECT_NO_JOIN_CACHE)
goto no_join_cache;
if (tab->use_quick == 2)
goto no_join_cache;
if (tab->table->map & join->complex_firstmatch_tables)
goto no_join_cache;
/*
Don't use join cache if we're inside a join tab range covered by LooseScan
strategy (TODO: LooseScan is very similar to FirstMatch so theoretically it
should be possible to use join buffering in the same way we're using it for
multi-table firstmatch ranges).
*/
if (tab->inside_loosescan_range)
goto no_join_cache;
if (tab->is_inner_table_of_semijoin() &&
!join->allowed_semijoin_with_cache)
goto no_join_cache;
if (tab->is_inner_table_of_outer_join() &&
!join->allowed_outer_join_with_cache)
goto no_join_cache;
/*
Non-linked join buffers can't guarantee one match
*/
if (tab->is_nested_inner())
{
if (force_unlinked_cache || cache_level == 1)
goto no_join_cache;
if (cache_level & 1)
cache_level--;
}
/*
Don't use BKA for materialized tables. We could actually have a
meaningful use of BKA when linked join buffers are used.
The problem is, the temp.table is not filled (actually not even opened
properly) yet, and this doesn't let us call
handler->multi_range_read_info(). It is possible to come up with
estimates, etc. without acessing the table, but it seems not to worth the
effort now.
*/
if (tab->table->pos_in_table_list->is_materialized_derived())
{
no_bka_cache= true;
/*
Don't use hash join algorithm if the temporary table for the rows
of the derived table will be created with an equi-join key.
*/
if (tab->table->s->keys)
no_hashed_cache= true;
}
/*
Don't use join buffering if we're dictated not to by no_jbuf_after
(This is not meaningfully used currently)
*/
if (table_index > no_jbuf_after)
goto no_join_cache;
/*
TODO: BNL join buffer should be perfectly ok with tab->bush_children.
*/
if (tab->loosescan_match_tab || tab->bush_children)
goto no_join_cache;
for (JOIN_TAB *first_inner= tab->first_inner; first_inner;
first_inner= first_inner->first_upper)
{
if (first_inner != tab &&
(!first_inner->use_join_cache || !(tab-1)->use_join_cache))
goto no_join_cache;
}
if (tab->first_sj_inner_tab && tab->first_sj_inner_tab != tab &&
(!tab->first_sj_inner_tab->use_join_cache || !(tab-1)->use_join_cache))
goto no_join_cache;
if (!prev_tab->use_join_cache)
{
/*
Check whether table tab and the previous one belong to the same nest of
inner tables and if so do not use join buffer when joining table tab.
*/
if (tab->first_inner && tab != tab->first_inner)
{
for (JOIN_TAB *first_inner= tab[-1].first_inner;
first_inner;
first_inner= first_inner->first_upper)
{
if (first_inner == tab->first_inner)
goto no_join_cache;
}
}
else if (tab->first_sj_inner_tab && tab != tab->first_sj_inner_tab &&
tab->first_sj_inner_tab == tab[-1].first_sj_inner_tab)
goto no_join_cache;
}
prev_cache= prev_tab->cache;
switch (tab->type) {
case JT_ALL:
if (cache_level == 1)
prev_cache= 0;
if ((tab->cache= new (root) JOIN_CACHE_BNL(join, tab, prev_cache)))
{
tab->icp_other_tables_ok= FALSE;
return (2 - MY_TEST(!prev_cache));
}
goto no_join_cache;
case JT_SYSTEM:
case JT_CONST:
case JT_REF:
case JT_EQ_REF:
if (cache_level <=2 || (no_hashed_cache && no_bka_cache))
goto no_join_cache;
if (tab->ref.is_access_triggered())
goto no_join_cache;
if (!tab->is_ref_for_hash_join() && !no_bka_cache)
{
flags= HA_MRR_NO_NULL_ENDPOINTS | HA_MRR_SINGLE_POINT;
if (tab->table->covering_keys.is_set(tab->ref.key))
flags|= HA_MRR_INDEX_ONLY;
rows= tab->table->file->multi_range_read_info(tab->ref.key, 10, 20,
tab->ref.key_parts,
&bufsz, &flags, &cost);
}
if ((cache_level <=4 && !no_hashed_cache) || no_bka_cache ||
tab->is_ref_for_hash_join() ||
((flags & HA_MRR_NO_ASSOCIATION) && cache_level <=6))
{
if (!tab->hash_join_is_possible() ||
tab->make_scan_filter())
goto no_join_cache;
if (cache_level == 3)
prev_cache= 0;
if ((tab->cache= new (root) JOIN_CACHE_BNLH(join, tab, prev_cache)))
{
tab->icp_other_tables_ok= FALSE;
return (4 - MY_TEST(!prev_cache));
}
goto no_join_cache;
}
if (cache_level > 4 && no_bka_cache)
goto no_join_cache;
if ((flags & HA_MRR_NO_ASSOCIATION) &&
(cache_level <= 6 || no_hashed_cache))
goto no_join_cache;
if ((rows != HA_POS_ERROR) && !(flags & HA_MRR_USE_DEFAULT_IMPL))
{
if (cache_level <= 6 || no_hashed_cache)
{
if (cache_level == 5)
prev_cache= 0;
if ((tab->cache= new (root) JOIN_CACHE_BKA(join, tab, flags, prev_cache)))
return (6 - MY_TEST(!prev_cache));
goto no_join_cache;
}
else
{
if (cache_level == 7)
prev_cache= 0;
if ((tab->cache= new (root) JOIN_CACHE_BKAH(join, tab, flags, prev_cache)))
{
tab->idx_cond_fact_out= FALSE;
return (8 - MY_TEST(!prev_cache));
}
goto no_join_cache;
}
}
goto no_join_cache;
default : ;
}
no_join_cache:
if (tab->type != JT_ALL && tab->is_ref_for_hash_join())
{
tab->type= JT_ALL;
tab->ref.key_parts= 0;
}
revise_cache_usage(tab);
return 0;
}
| 0 |
[
"CWE-89"
] |
server
|
5ba77222e9fe7af8ff403816b5338b18b342053c
| 58,426,122,578,017,760,000,000,000,000,000,000,000 | 223 |
MDEV-21028 Server crashes in Query_arena::set_query_arena upon SELECT from view
if the view has algorithm=temptable it is not updatable,
so DEFAULT() for its fields is meaningless,
and thus it's NULL or 0/'' for NOT NULL columns.
|
static inline u32 perc(u32 count, u32 total)
{
return (count * 100 + (total / 2)) / total;
}
| 0 |
[
"CWE-200"
] |
net
|
5d2be1422e02ccd697ccfcd45c85b4a26e6178e2
| 109,013,780,597,734,000,000,000,000,000,000,000,000 | 4 |
tipc: fix an infoleak in tipc_nl_compat_link_dump
link_info.str is a char array of size 60. Memory after the NULL
byte is not initialized. Sending the whole object out can cause
a leak.
Signed-off-by: Kangjie Lu <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
|
static float* _mp_memcopy_float(_cimg_math_parser& mp, const ulongT *const p_ref,
const longT siz, const long inc) {
const unsigned ind = (unsigned int)p_ref[1];
const CImg<T> &img = ind==~0U?mp.imgin:mp.listin[cimg::mod((int)mp.mem[ind],mp.listin.width())];
const bool is_relative = (bool)p_ref[2];
int ox, oy, oz, oc;
longT off = 0;
if (is_relative) {
ox = (int)mp.mem[_cimg_mp_slot_x];
oy = (int)mp.mem[_cimg_mp_slot_y];
oz = (int)mp.mem[_cimg_mp_slot_z];
oc = (int)mp.mem[_cimg_mp_slot_c];
off = img.offset(ox,oy,oz,oc);
}
if ((*p_ref)%2) {
const int
x = (int)mp.mem[p_ref[3]],
y = (int)mp.mem[p_ref[4]],
z = (int)mp.mem[p_ref[5]],
c = *p_ref==5?0:(int)mp.mem[p_ref[6]];
off+=img.offset(x,y,z,c);
} else off+=(longT)mp.mem[p_ref[3]];
const longT eoff = off + (siz - 1)*inc;
if (off<0 || eoff>=(longT)img.size())
throw CImgArgumentException("[" cimg_appname "_math_parser] CImg<%s>: Function 'copy()': "
"Out-of-bounds image pointer "
"(length: %ld, increment: %ld, offset start: %ld, "
"offset end: %ld, offset max: %lu).",
mp.imgin.pixel_type(),siz,inc,off,eoff,img.size() - 1);
return (float*)&img[off];
| 0 |
[
"CWE-125"
] |
CImg
|
10af1e8c1ad2a58a0a3342a856bae63e8f257abb
| 94,218,741,660,298,240,000,000,000,000,000,000,000 | 31 |
Fix other issues in 'CImg<T>::load_bmp()'.
|
struct tty_struct *alloc_tty_struct(struct tty_driver *driver, int idx)
{
struct tty_struct *tty;
tty = kzalloc(sizeof(*tty), GFP_KERNEL);
if (!tty)
return NULL;
kref_init(&tty->kref);
tty->magic = TTY_MAGIC;
if (tty_ldisc_init(tty)) {
kfree(tty);
return NULL;
}
tty->session = NULL;
tty->pgrp = NULL;
mutex_init(&tty->legacy_mutex);
mutex_init(&tty->throttle_mutex);
init_rwsem(&tty->termios_rwsem);
mutex_init(&tty->winsize_mutex);
init_ldsem(&tty->ldisc_sem);
init_waitqueue_head(&tty->write_wait);
init_waitqueue_head(&tty->read_wait);
INIT_WORK(&tty->hangup_work, do_tty_hangup);
mutex_init(&tty->atomic_write_lock);
spin_lock_init(&tty->ctrl_lock);
spin_lock_init(&tty->flow_lock);
spin_lock_init(&tty->files_lock);
INIT_LIST_HEAD(&tty->tty_files);
INIT_WORK(&tty->SAK_work, do_SAK_work);
tty->driver = driver;
tty->ops = driver->ops;
tty->index = idx;
tty_line_name(driver, idx, tty->name);
tty->dev = tty_get_device(tty);
return tty;
}
| 0 |
[
"CWE-416"
] |
linux
|
c8bcd9c5be24fb9e6132e97da5a35e55a83e36b9
| 263,364,311,731,158,950,000,000,000,000,000,000,000 | 39 |
tty: Fix ->session locking
Currently, locking of ->session is very inconsistent; most places
protect it using the legacy tty mutex, but disassociate_ctty(),
__do_SAK(), tiocspgrp() and tiocgsid() don't.
Two of the writers hold the ctrl_lock (because they already need it for
->pgrp), but __proc_set_tty() doesn't do that yet.
On a PREEMPT=y system, an unprivileged user can theoretically abuse
this broken locking to read 4 bytes of freed memory via TIOCGSID if
tiocgsid() is preempted long enough at the right point. (Other things
might also go wrong, especially if root-only ioctls are involved; I'm
not sure about that.)
Change the locking on ->session such that:
- tty_lock() is held by all writers: By making disassociate_ctty()
hold it. This should be fine because the same lock can already be
taken through the call to tty_vhangup_session().
The tricky part is that we need to shorten the area covered by
siglock to be able to take tty_lock() without ugly retry logic; as
far as I can tell, this should be fine, since nothing in the
signal_struct is touched in the `if (tty)` branch.
- ctrl_lock is held by all writers: By changing __proc_set_tty() to
hold the lock a little longer.
- All readers that aren't holding tty_lock() hold ctrl_lock: By
adding locking to tiocgsid() and __do_SAK(), and expanding the area
covered by ctrl_lock in tiocspgrp().
Cc: [email protected]
Signed-off-by: Jann Horn <[email protected]>
Reviewed-by: Jiri Slaby <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
|
static PixelChannels **AcquirePixelThreadSet(const Image *image)
{
PixelChannels
**pixels;
register ssize_t
i;
size_t
number_threads;
number_threads=(size_t) GetMagickResourceLimit(ThreadResource);
pixels=(PixelChannels **) AcquireQuantumMemory(number_threads,
sizeof(*pixels));
if (pixels == (PixelChannels **) NULL)
return((PixelChannels **) NULL);
(void) memset(pixels,0,number_threads*sizeof(*pixels));
for (i=0; i < (ssize_t) number_threads; i++)
{
register ssize_t
j;
pixels[i]=(PixelChannels *) AcquireQuantumMemory(image->columns,
sizeof(**pixels));
if (pixels[i] == (PixelChannels *) NULL)
return(DestroyPixelThreadSet(pixels));
for (j=0; j < (ssize_t) image->columns; j++)
{
register ssize_t
k;
for (k=0; k < MaxPixelChannels; k++)
pixels[i][j].channel[k]=0.0;
}
}
return(pixels);
}
| 1 |
[
"CWE-476",
"CWE-119",
"CWE-787"
] |
ImageMagick
|
a906fe9298bf89e01d5272023db687935068849a
| 38,109,702,095,962,666,000,000,000,000,000,000,000 | 37 |
https://github.com/ImageMagick/ImageMagick/issues/1586
|
int migrate_misplaced_transhuge_page(struct mm_struct *mm,
struct vm_area_struct *vma,
pmd_t *pmd, pmd_t entry,
unsigned long address,
struct page *page, int node)
{
spinlock_t *ptl;
pg_data_t *pgdat = NODE_DATA(node);
int isolated = 0;
struct page *new_page = NULL;
int page_lru = page_is_file_cache(page);
unsigned long mmun_start = address & HPAGE_PMD_MASK;
unsigned long mmun_end = mmun_start + HPAGE_PMD_SIZE;
/*
* Rate-limit the amount of data that is being migrated to a node.
* Optimal placement is no good if the memory bus is saturated and
* all the time is being spent migrating!
*/
if (numamigrate_update_ratelimit(pgdat, HPAGE_PMD_NR))
goto out_dropref;
new_page = alloc_pages_node(node,
(GFP_TRANSHUGE_LIGHT | __GFP_THISNODE),
HPAGE_PMD_ORDER);
if (!new_page)
goto out_fail;
prep_transhuge_page(new_page);
isolated = numamigrate_isolate_page(pgdat, page);
if (!isolated) {
put_page(new_page);
goto out_fail;
}
/* Prepare a page as a migration target */
__SetPageLocked(new_page);
if (PageSwapBacked(page))
__SetPageSwapBacked(new_page);
/* anon mapping, we can simply copy page->mapping to the new page: */
new_page->mapping = page->mapping;
new_page->index = page->index;
migrate_page_copy(new_page, page);
WARN_ON(PageLRU(new_page));
/* Recheck the target PMD */
mmu_notifier_invalidate_range_start(mm, mmun_start, mmun_end);
ptl = pmd_lock(mm, pmd);
if (unlikely(!pmd_same(*pmd, entry) || !page_ref_freeze(page, 2))) {
spin_unlock(ptl);
mmu_notifier_invalidate_range_end(mm, mmun_start, mmun_end);
/* Reverse changes made by migrate_page_copy() */
if (TestClearPageActive(new_page))
SetPageActive(page);
if (TestClearPageUnevictable(new_page))
SetPageUnevictable(page);
unlock_page(new_page);
put_page(new_page); /* Free it */
/* Retake the callers reference and putback on LRU */
get_page(page);
putback_lru_page(page);
mod_node_page_state(page_pgdat(page),
NR_ISOLATED_ANON + page_lru, -HPAGE_PMD_NR);
goto out_unlock;
}
entry = mk_huge_pmd(new_page, vma->vm_page_prot);
entry = maybe_pmd_mkwrite(pmd_mkdirty(entry), vma);
/*
* Clear the old entry under pagetable lock and establish the new PTE.
* Any parallel GUP will either observe the old page blocking on the
* page lock, block on the page table lock or observe the new page.
* The SetPageUptodate on the new page and page_add_new_anon_rmap
* guarantee the copy is visible before the pagetable update.
*/
flush_cache_range(vma, mmun_start, mmun_end);
page_add_anon_rmap(new_page, vma, mmun_start, true);
pmdp_huge_clear_flush_notify(vma, mmun_start, pmd);
set_pmd_at(mm, mmun_start, pmd, entry);
update_mmu_cache_pmd(vma, address, &entry);
page_ref_unfreeze(page, 2);
mlock_migrate_page(new_page, page);
page_remove_rmap(page, true);
set_page_owner_migrate_reason(new_page, MR_NUMA_MISPLACED);
spin_unlock(ptl);
mmu_notifier_invalidate_range_end(mm, mmun_start, mmun_end);
/* Take an "isolate" reference and put new page on the LRU. */
get_page(new_page);
putback_lru_page(new_page);
unlock_page(new_page);
unlock_page(page);
put_page(page); /* Drop the rmap reference */
put_page(page); /* Drop the LRU isolation reference */
count_vm_events(PGMIGRATE_SUCCESS, HPAGE_PMD_NR);
count_vm_numa_events(NUMA_PAGE_MIGRATE, HPAGE_PMD_NR);
mod_node_page_state(page_pgdat(page),
NR_ISOLATED_ANON + page_lru,
-HPAGE_PMD_NR);
return isolated;
out_fail:
count_vm_events(PGMIGRATE_FAIL, HPAGE_PMD_NR);
out_dropref:
ptl = pmd_lock(mm, pmd);
if (pmd_same(*pmd, entry)) {
entry = pmd_modify(entry, vma->vm_page_prot);
set_pmd_at(mm, mmun_start, pmd, entry);
update_mmu_cache_pmd(vma, address, &entry);
}
spin_unlock(ptl);
out_unlock:
unlock_page(page);
put_page(page);
return 0;
}
| 0 |
[
"CWE-200"
] |
linux
|
197e7e521384a23b9e585178f3f11c9fa08274b9
| 102,033,336,772,894,000,000,000,000,000,000,000,000 | 128 |
Sanitize 'move_pages()' permission checks
The 'move_paghes()' system call was introduced long long ago with the
same permission checks as for sending a signal (except using
CAP_SYS_NICE instead of CAP_SYS_KILL for the overriding capability).
That turns out to not be a great choice - while the system call really
only moves physical page allocations around (and you need other
capabilities to do a lot of it), you can check the return value to map
out some the virtual address choices and defeat ASLR of a binary that
still shares your uid.
So change the access checks to the more common 'ptrace_may_access()'
model instead.
This tightens the access checks for the uid, and also effectively
changes the CAP_SYS_NICE check to CAP_SYS_PTRACE, but it's unlikely that
anybody really _uses_ this legacy system call any more (we hav ebetter
NUMA placement models these days), so I expect nobody to notice.
Famous last words.
Reported-by: Otto Ebeling <[email protected]>
Acked-by: Eric W. Biederman <[email protected]>
Cc: Willy Tarreau <[email protected]>
Cc: [email protected]
Signed-off-by: Linus Torvalds <[email protected]>
|
Perl_ckwarn(pTHX_ U32 w)
{
/* If lexical warnings have not been set, use $^W. */
if (isLEXWARN_off)
return PL_dowarn & G_WARN_ON;
return ckwarn_common(w);
}
| 0 |
[
"CWE-119",
"CWE-703",
"CWE-787"
] |
perl5
|
34716e2a6ee2af96078d62b065b7785c001194be
| 77,151,179,599,572,690,000,000,000,000,000,000,000 | 8 |
Perl_my_setenv(); handle integer wrap
RT #133204
Wean this function off int/I32 and onto UV/Size_t.
Also, replace all malloc-ish calls with a wrapper that does
overflow checks,
In particular, it was doing (nlen + vlen + 2) which could wrap when
the combined length of the environment variable name and value
exceeded around 0x7fffffff.
The wrapper check function is probably overkill, but belt and braces...
NB this function has several variant parts, #ifdef'ed by platform
type; I have blindly changed the parts that aren't compiled under linux.
|
static void php_wddx_serialize_array(wddx_packet *packet, zval *arr)
{
zval **ent;
char *key;
uint key_len;
int is_struct = 0, ent_type;
ulong idx;
HashTable *target_hash;
char tmp_buf[WDDX_BUF_LEN];
ulong ind = 0;
int type;
TSRMLS_FETCH();
target_hash = HASH_OF(arr);
for (zend_hash_internal_pointer_reset(target_hash);
zend_hash_get_current_data(target_hash, (void**)&ent) == SUCCESS;
zend_hash_move_forward(target_hash)) {
type = zend_hash_get_current_key(target_hash, &key, &idx, 0);
if (type == HASH_KEY_IS_STRING) {
is_struct = 1;
break;
}
if (idx != ind) {
is_struct = 1;
break;
}
ind++;
}
if (is_struct) {
php_wddx_add_chunk_static(packet, WDDX_STRUCT_S);
} else {
snprintf(tmp_buf, sizeof(tmp_buf), WDDX_ARRAY_S, zend_hash_num_elements(target_hash));
php_wddx_add_chunk(packet, tmp_buf);
}
for (zend_hash_internal_pointer_reset(target_hash);
zend_hash_get_current_data(target_hash, (void**)&ent) == SUCCESS;
zend_hash_move_forward(target_hash)) {
if (*ent == arr) {
continue;
}
if (is_struct) {
ent_type = zend_hash_get_current_key_ex(target_hash, &key, &key_len, &idx, 0, NULL);
if (ent_type == HASH_KEY_IS_STRING) {
php_wddx_serialize_var(packet, *ent, key, key_len TSRMLS_CC);
} else {
key_len = slprintf(tmp_buf, sizeof(tmp_buf), "%ld", idx);
php_wddx_serialize_var(packet, *ent, tmp_buf, key_len TSRMLS_CC);
}
} else {
php_wddx_serialize_var(packet, *ent, NULL, 0 TSRMLS_CC);
}
}
if (is_struct) {
php_wddx_add_chunk_static(packet, WDDX_STRUCT_E);
} else {
php_wddx_add_chunk_static(packet, WDDX_ARRAY_E);
}
}
| 1 |
[] |
php-src
|
1785d2b805f64eaaacf98c14c9e13107bf085ab1
| 322,511,741,448,191,520,000,000,000,000,000,000,000 | 68 |
Fixed bug #70741: Session WDDX Packet Deserialization Type Confusion Vulnerability
|
u32 parse_bs_switch(char *arg_val, u32 opt)
{
if (!stricmp(arg_val, "no") || !stricmp(arg_val, "off")) bitstream_switching_mode = GF_DASH_BSMODE_NONE;
else if (!stricmp(arg_val, "merge")) bitstream_switching_mode = GF_DASH_BSMODE_MERGED;
else if (!stricmp(arg_val, "multi")) bitstream_switching_mode = GF_DASH_BSMODE_MULTIPLE_ENTRIES;
else if (!stricmp(arg_val, "single")) bitstream_switching_mode = GF_DASH_BSMODE_SINGLE;
else if (!stricmp(arg_val, "inband")) bitstream_switching_mode = GF_DASH_BSMODE_INBAND;
else if (!stricmp(arg_val, "pps")) bitstream_switching_mode = GF_DASH_BSMODE_INBAND_PPS;
else {
M4_LOG(GF_LOG_ERROR, ("Unrecognized bitstream switching mode \"%s\" - please check usage\n", arg_val));
return 2;
}
return 0;
| 0 |
[
"CWE-787"
] |
gpac
|
4e56ad72ac1afb4e049a10f2d99e7512d7141f9d
| 56,312,564,084,487,520,000,000,000,000,000,000,000 | 14 |
fixed #2216
|
static int attach_aead(struct xfrm_algo_aead **algpp, u8 *props,
struct nlattr *rta)
{
struct xfrm_algo_aead *p, *ualg;
struct xfrm_algo_desc *algo;
if (!rta)
return 0;
ualg = nla_data(rta);
algo = xfrm_aead_get_byname(ualg->alg_name, ualg->alg_icv_len, 1);
if (!algo)
return -ENOSYS;
*props = algo->desc.sadb_alg_id;
p = kmemdup(ualg, aead_len(ualg), GFP_KERNEL);
if (!p)
return -ENOMEM;
strcpy(p->alg_name, algo->name);
*algpp = p;
return 0;
}
| 0 |
[
"CWE-264"
] |
net
|
90f62cf30a78721641e08737bda787552428061e
| 89,907,038,047,295,570,000,000,000,000,000,000,000 | 24 |
net: Use netlink_ns_capable to verify the permisions of netlink messages
It is possible by passing a netlink socket to a more privileged
executable and then to fool that executable into writing to the socket
data that happens to be valid netlink message to do something that
privileged executable did not intend to do.
To keep this from happening replace bare capable and ns_capable calls
with netlink_capable, netlink_net_calls and netlink_ns_capable calls.
Which act the same as the previous calls except they verify that the
opener of the socket had the desired permissions as well.
Reported-by: Andy Lutomirski <[email protected]>
Signed-off-by: "Eric W. Biederman" <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
|
void vmx_set_rflags(struct kvm_vcpu *vcpu, unsigned long rflags)
{
struct vcpu_vmx *vmx = to_vmx(vcpu);
unsigned long old_rflags;
if (is_unrestricted_guest(vcpu)) {
kvm_register_mark_available(vcpu, VCPU_EXREG_RFLAGS);
vmx->rflags = rflags;
vmcs_writel(GUEST_RFLAGS, rflags);
return;
}
old_rflags = vmx_get_rflags(vcpu);
vmx->rflags = rflags;
if (vmx->rmode.vm86_active) {
vmx->rmode.save_rflags = rflags;
rflags |= X86_EFLAGS_IOPL | X86_EFLAGS_VM;
}
vmcs_writel(GUEST_RFLAGS, rflags);
if ((old_rflags ^ vmx->rflags) & X86_EFLAGS_VM)
vmx->emulation_required = emulation_required(vcpu);
}
| 0 |
[
"CWE-787"
] |
linux
|
04c4f2ee3f68c9a4bf1653d15f1a9a435ae33f7a
| 237,418,935,500,092,350,000,000,000,000,000,000,000 | 23 |
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 <[email protected]>
Reviewed-by: Jim Mattson <[email protected]>
Message-Id: <[email protected]>
Cc: [email protected]
Signed-off-by: Paolo Bonzini <[email protected]>
|
NTSTATUS smbd_do_setfilepathinfo(connection_struct *conn,
struct smb_request *req,
TALLOC_CTX *mem_ctx,
uint16_t info_level,
files_struct *fsp,
struct smb_filename *smb_fname,
char **ppdata, int total_data,
int *ret_data_size)
{
char *pdata = *ppdata;
NTSTATUS status = NT_STATUS_OK;
int data_return_size = 0;
if (INFO_LEVEL_IS_UNIX(info_level)) {
if (!lp_unix_extensions()) {
return NT_STATUS_INVALID_LEVEL;
}
status = smbd_do_posix_setfilepathinfo(conn,
req,
req,
info_level,
smb_fname,
fsp,
ppdata,
total_data,
&data_return_size);
if (!NT_STATUS_IS_OK(status)) {
return status;
}
*ret_data_size = data_return_size;
return NT_STATUS_OK;
}
*ret_data_size = 0;
DEBUG(3,("smbd_do_setfilepathinfo: %s (%s) info_level=%d "
"totdata=%d\n", smb_fname_str_dbg(smb_fname),
fsp_fnum_dbg(fsp),
info_level, total_data));
switch (info_level) {
case SMB_INFO_STANDARD:
{
status = smb_set_info_standard(conn,
pdata,
total_data,
fsp,
smb_fname);
break;
}
case SMB_INFO_SET_EA:
{
status = smb_info_set_ea(conn,
pdata,
total_data,
fsp,
smb_fname);
break;
}
case SMB_SET_FILE_BASIC_INFO:
case SMB_FILE_BASIC_INFORMATION:
{
status = smb_set_file_basic_info(conn,
pdata,
total_data,
fsp,
smb_fname);
break;
}
case SMB_FILE_ALLOCATION_INFORMATION:
case SMB_SET_FILE_ALLOCATION_INFO:
{
status = smb_set_file_allocation_info(conn, req,
pdata,
total_data,
fsp,
smb_fname);
break;
}
case SMB_FILE_END_OF_FILE_INFORMATION:
case SMB_SET_FILE_END_OF_FILE_INFO:
{
/*
* XP/Win7 both fail after the createfile with
* SMB_SET_FILE_END_OF_FILE_INFO but not
* SMB_FILE_END_OF_FILE_INFORMATION (pass-through).
* The level is known here, so pass it down
* appropriately.
*/
bool should_fail =
(info_level == SMB_SET_FILE_END_OF_FILE_INFO);
status = smb_set_file_end_of_file_info(conn, req,
pdata,
total_data,
fsp,
smb_fname,
should_fail);
break;
}
case SMB_FILE_DISPOSITION_INFORMATION:
case SMB_SET_FILE_DISPOSITION_INFO: /* Set delete on close for open file. */
{
#if 0
/* JRA - We used to just ignore this on a path ?
* Shouldn't this be invalid level on a pathname
* based call ?
*/
if (tran_call != TRANSACT2_SETFILEINFO) {
return ERROR_NT(NT_STATUS_INVALID_LEVEL);
}
#endif
status = smb_set_file_disposition_info(conn,
pdata,
total_data,
fsp,
smb_fname);
break;
}
case SMB_FILE_POSITION_INFORMATION:
{
status = smb_file_position_information(conn,
pdata,
total_data,
fsp);
break;
}
case SMB_FILE_FULL_EA_INFORMATION:
{
status = smb_set_file_full_ea_info(conn,
pdata,
total_data,
fsp);
break;
}
/* From tridge Samba4 :
* MODE_INFORMATION in setfileinfo (I have no
* idea what "mode information" on a file is - it takes a value of 0,
* 2, 4 or 6. What could it be?).
*/
case SMB_FILE_MODE_INFORMATION:
{
status = smb_file_mode_information(conn,
pdata,
total_data);
break;
}
/* [MS-SMB2] 3.3.5.21.1 states we MUST fail with STATUS_NOT_SUPPORTED. */
case SMB_FILE_VALID_DATA_LENGTH_INFORMATION:
case SMB_FILE_SHORT_NAME_INFORMATION:
return NT_STATUS_NOT_SUPPORTED;
case SMB_FILE_RENAME_INFORMATION:
{
status = smb_file_rename_information(conn, req,
pdata, total_data,
fsp, smb_fname);
break;
}
case SMB2_FILE_RENAME_INFORMATION_INTERNAL:
{
/* SMB2 rename information. */
status = smb2_file_rename_information(conn, req,
pdata, total_data,
fsp, smb_fname);
break;
}
case SMB_FILE_LINK_INFORMATION:
{
status = smb_file_link_information(conn, req,
pdata, total_data,
fsp, smb_fname);
break;
}
default:
return NT_STATUS_INVALID_LEVEL;
}
if (!NT_STATUS_IS_OK(status)) {
return status;
}
*ret_data_size = data_return_size;
return NT_STATUS_OK;
}
| 0 |
[
"CWE-787"
] |
samba
|
22b4091924977f6437b59627f33a8e6f02b41011
| 127,589,543,993,219,100,000,000,000,000,000,000,000 | 200 |
CVE-2021-44142: smbd: add Netatalk xattr used by vfs_fruit to the list of private Samba xattrs
This is an internal xattr that should not be user visible.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14914
Signed-off-by: Ralph Boehme <[email protected]>
Reviewed-by: Jeremy Allison <[email protected]>
|
static cJSON *cJSON_New_Item( void )
{
cJSON* node = (cJSON*) cJSON_malloc( sizeof(cJSON) );
if ( node )
memset( node, 0, sizeof(cJSON) );
return node;
}
| 1 |
[
"CWE-120",
"CWE-119",
"CWE-787"
] |
iperf
|
91f2fa59e8ed80dfbf400add0164ee0e508e412a
| 337,156,629,260,410,870,000,000,000,000,000,000,000 | 7 |
Fix a buffer overflow / heap corruption issue that could occur if a
malformed JSON string was passed on the control channel. This issue,
present in the cJSON library, was already fixed upstream, so was
addressed here in iperf3 by importing a newer version of cJSON (plus
local ESnet modifications).
Discovered and reported by Dave McDaniel, Cisco Talos.
Based on a patch by @dopheide-esnet, with input from @DaveGamble.
Cross-references: TALOS-CAN-0164, ESNET-SECADV-2016-0001,
CVE-2016-4303
(cherry picked from commit ed94082be27d971a5e1b08b666e2c217cf470a40)
Signed-off-by: Bruce A. Mah <[email protected]>
|
static int rio_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
{
struct netdev_private *np = netdev_priv(dev);
netif_carrier_off(dev);
if (cmd->autoneg == AUTONEG_ENABLE) {
if (np->an_enable)
return 0;
else {
np->an_enable = 1;
mii_set_media(dev);
return 0;
}
} else {
np->an_enable = 0;
if (np->speed == 1000) {
ethtool_cmd_speed_set(cmd, SPEED_100);
cmd->duplex = DUPLEX_FULL;
printk("Warning!! Can't disable Auto negotiation in 1000Mbps, change to Manual 100Mbps, Full duplex.\n");
}
switch (ethtool_cmd_speed(cmd)) {
case SPEED_10:
np->speed = 10;
np->full_duplex = (cmd->duplex == DUPLEX_FULL);
break;
case SPEED_100:
np->speed = 100;
np->full_duplex = (cmd->duplex == DUPLEX_FULL);
break;
case SPEED_1000: /* not supported */
default:
return -EINVAL;
}
mii_set_media(dev);
}
return 0;
}
| 0 |
[
"CWE-284",
"CWE-264"
] |
linux
|
1bb57e940e1958e40d51f2078f50c3a96a9b2d75
| 152,244,598,053,314,670,000,000,000,000,000,000,000 | 36 |
dl2k: Clean up rio_ioctl
The dl2k driver's rio_ioctl call has a few issues:
- No permissions checking
- Implements SIOCGMIIREG and SIOCGMIIREG using the SIOCDEVPRIVATE numbers
- Has a few ioctls that may have been used for debugging at one point
but have no place in the kernel proper.
This patch removes all but the MII ioctls, renumbers them to use the
standard ones, and adds the proper permission check for SIOCSMIIREG.
We can also get rid of the dl2k-specific struct mii_data in favor of
the generic struct mii_ioctl_data.
Since we have the phyid on hand, we can add the SIOCGMIIPHY ioctl too.
Most of the MII code for the driver could probably be converted to use
the generic MII library but I don't have a device to test the results.
Reported-by: Stephan Mueller <[email protected]>
Signed-off-by: Jeff Mahoney <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
|
xfs_buf_ioerror_alert(
struct xfs_buf *bp,
const char *func)
{
xfs_alert(bp->b_target->bt_mount,
"metadata I/O error: block 0x%llx (\"%s\") error %d numblks %d",
(__uint64_t)XFS_BUF_ADDR(bp), func, bp->b_error, bp->b_length);
}
| 0 |
[
"CWE-20",
"CWE-703"
] |
linux
|
eb178619f930fa2ba2348de332a1ff1c66a31424
| 98,137,761,905,594,880,000,000,000,000,000,000,000 | 8 |
xfs: fix _xfs_buf_find oops on blocks beyond the filesystem end
When _xfs_buf_find is passed an out of range address, it will fail
to find a relevant struct xfs_perag and oops with a null
dereference. This can happen when trying to walk a filesystem with a
metadata inode that has a partially corrupted extent map (i.e. the
block number returned is corrupt, but is otherwise intact) and we
try to read from the corrupted block address.
In this case, just fail the lookup. If it is readahead being issued,
it will simply not be done, but if it is real read that fails we
will get an error being reported. Ideally this case should result
in an EFSCORRUPTED error being reported, but we cannot return an
error through xfs_buf_read() or xfs_buf_get() so this lookup failure
may result in ENOMEM or EIO errors being reported instead.
Signed-off-by: Dave Chinner <[email protected]>
Reviewed-by: Brian Foster <[email protected]>
Reviewed-by: Ben Myers <[email protected]>
Signed-off-by: Ben Myers <[email protected]>
|
managesieve_parser_read_string(struct managesieve_parser *parser,
const unsigned char *data, size_t data_size)
{
size_t i;
/* QUOTED-CHAR = SAFE-UTF8-CHAR / "\" QUOTED-SPECIALS
* quoted = <"> *QUOTED-CHAR <">
* ;; limited to 1024 octets between the <">s
*/
/* read until we've found non-escaped ", CR or LF */
for (i = parser->cur_pos; i < data_size; i++) {
if (data[i] == '"') {
if ( !uni_utf8_data_is_valid(data+1, i-1) ) {
parser->error = "Invalid UTF-8 character in quoted-string.";
return FALSE;
}
managesieve_parser_save_arg(parser, data, i);
i++; /* skip the trailing '"' too */
break;
}
if (data[i] == '\0') {
parser->error = "NULs not allowed in strings";
return FALSE;
}
if (data[i] == '\\') {
if (i+1 == data_size) {
/* known data ends with '\' - leave it to
next time as well if it happens to be \" */
break;
}
/* save the first escaped char */
if (parser->str_first_escape < 0)
parser->str_first_escape = i;
/* skip the escaped char */
i++;
if ( !IS_QUOTED_SPECIAL(data[i]) ) {
parser->error =
"Escaped quoted-string character is not a QUOTED-SPECIAL.";
return FALSE;
}
continue;
}
if ( (data[i] & 0x80) == 0 && !IS_SAFE_CHAR(data[i]) ) {
parser->error = "String contains invalid character.";
return FALSE;
}
}
parser->cur_pos = i;
return ( parser->cur_type == ARG_PARSE_NONE );
}
| 0 |
[
"CWE-787"
] |
pigeonhole
|
7ce9990a5e6ba59e89b7fe1c07f574279aed922c
| 28,370,593,624,038,890,000,000,000,000,000,000,000 | 61 |
lib-managesieve: Don't accept strings with NULs
ManageSieve doesn't allow NULs in strings.
This fixes a bug with unescaping a string with NULs: str_unescape() could
have been called for memory that points outside the allocated string,
causing heap corruption. This could cause crashes or theoretically even
result in remote code execution exploit.
Found by Nick Roessler and Rafi Rubin
|
uint32_t writeListBegin(const TType elemType, const uint32_t size) {
T_VIRTUAL_CALL();
return writeListBegin_virt(elemType, size);
}
| 0 |
[
"CWE-20"
] |
thrift
|
cfaadcc4adcfde2a8232c62ec89870b73ef40df1
| 248,312,995,197,703,360,000,000,000,000,000,000,000 | 4 |
THRIFT-3231 CPP: Limit recursion depth to 64
Client: cpp
Patch: Ben Craig <[email protected]>
|
get_bkc_value(buf_T *buf)
{
return buf->b_bkc_flags ? buf->b_bkc_flags : bkc_flags;
}
| 0 |
[
"CWE-20"
] |
vim
|
d0b5138ba4bccff8a744c99836041ef6322ed39a
| 319,857,157,716,557,070,000,000,000,000,000,000,000 | 4 |
patch 8.0.0056
Problem: When setting 'filetype' there is no check for a valid name.
Solution: Only allow valid characters in 'filetype', 'syntax' and 'keymap'.
|
static ssize_t _consolefs_readv(
oe_fd_t* desc,
const struct oe_iovec* iov,
int iovcnt)
{
ssize_t ret = -1;
file_t* file = _cast_file(desc);
void* buf = NULL;
size_t buf_size = 0;
if (!file || !iov || iovcnt < 0 || iovcnt > OE_IOV_MAX)
OE_RAISE_ERRNO(OE_EINVAL);
/* Flatten the IO vector into contiguous heap memory. */
if (oe_iov_pack(iov, iovcnt, &buf, &buf_size) != 0)
OE_RAISE_ERRNO(OE_ENOMEM);
/* Call the host. */
if (oe_syscall_readv_ocall(&ret, file->host_fd, buf, iovcnt, buf_size) !=
OE_OK)
{
OE_RAISE_ERRNO(OE_EINVAL);
}
/* Synchronize data read with IO vector. */
if (oe_iov_sync(iov, iovcnt, buf, buf_size) != 0)
OE_RAISE_ERRNO(OE_EINVAL);
done:
if (buf)
oe_free(buf);
return ret;
}
| 1 |
[
"CWE-200",
"CWE-552"
] |
openenclave
|
bcac8e7acb514429fee9e0b5d0c7a0308fd4d76b
| 125,376,126,933,687,200,000,000,000,000,000,000,000 | 35 |
Merge pull request from GHSA-525h-wxcc-f66m
Signed-off-by: Ming-Wei Shih <[email protected]>
|
static int fuse_get_tree(struct fs_context *fc)
{
struct fuse_fs_context *ctx = fc->fs_private;
if (!ctx->fd_present || !ctx->rootmode_present ||
!ctx->user_id_present || !ctx->group_id_present)
return -EINVAL;
#ifdef CONFIG_BLOCK
if (ctx->is_bdev)
return get_tree_bdev(fc, fuse_fill_super);
#endif
return get_tree_nodev(fc, fuse_fill_super);
}
| 0 |
[
"CWE-459"
] |
linux
|
5d069dbe8aaf2a197142558b6fb2978189ba3454
| 26,744,266,151,248,405,000,000,000,000,000,000,000 | 15 |
fuse: fix bad inode
Jan Kara's analysis of the syzbot report (edited):
The reproducer opens a directory on FUSE filesystem, it then attaches
dnotify mark to the open directory. After that a fuse_do_getattr() call
finds that attributes returned by the server are inconsistent, and calls
make_bad_inode() which, among other things does:
inode->i_mode = S_IFREG;
This then confuses dnotify which doesn't tear down its structures
properly and eventually crashes.
Avoid calling make_bad_inode() on a live inode: switch to a private flag on
the fuse inode. Also add the test to ops which the bad_inode_ops would
have caught.
This bug goes back to the initial merge of fuse in 2.6.14...
Reported-by: [email protected]
Signed-off-by: Miklos Szeredi <[email protected]>
Tested-by: Jan Kara <[email protected]>
Cc: <[email protected]>
|
void Monitor::forward_request_leader(MonOpRequestRef op)
{
op->mark_event(__func__);
int mon = get_leader();
MonSession *session = op->get_session();
PaxosServiceMessage *req = op->get_req<PaxosServiceMessage>();
if (req->get_source().is_mon() && req->get_source_addr() != messenger->get_myaddr()) {
dout(10) << "forward_request won't forward (non-local) mon request " << *req << dendl;
} else if (session->proxy_con) {
dout(10) << "forward_request won't double fwd request " << *req << dendl;
} else if (!session->closed) {
RoutedRequest *rr = new RoutedRequest;
rr->tid = ++routed_request_tid;
rr->client_inst = req->get_source_inst();
rr->con = req->get_connection();
rr->con_features = rr->con->get_features();
encode_message(req, CEPH_FEATURES_ALL, rr->request_bl); // for my use only; use all features
rr->session = static_cast<MonSession *>(session->get());
rr->op = op;
routed_requests[rr->tid] = rr;
session->routed_request_tids.insert(rr->tid);
dout(10) << "forward_request " << rr->tid << " request " << *req
<< " features " << rr->con_features << dendl;
MForward *forward = new MForward(rr->tid,
req,
rr->con_features,
rr->session->caps);
forward->set_priority(req->get_priority());
if (session->auth_handler) {
forward->entity_name = session->entity_name;
} else if (req->get_source().is_mon()) {
forward->entity_name.set_type(CEPH_ENTITY_TYPE_MON);
}
messenger->send_message(forward, monmap->get_inst(mon));
op->mark_forwarded();
assert(op->get_req()->get_type() != 0);
} else {
dout(10) << "forward_request no session for request " << *req << dendl;
}
}
| 0 |
[
"CWE-287",
"CWE-284"
] |
ceph
|
5ead97120e07054d80623dada90a5cc764c28468
| 315,952,961,199,139,680,000,000,000,000,000,000,000 | 44 |
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 <[email protected]>
(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()
|
static inline void handle_socket_receive_known(
fastd_socket_t *sock, const fastd_peer_address_t *local_addr, const fastd_peer_address_t *remote_addr,
fastd_peer_t *peer, fastd_buffer_t *buffer) {
if (!fastd_peer_may_connect(peer)) {
fastd_buffer_free(buffer);
return;
}
const uint8_t *packet_type = buffer->data;
switch (*packet_type) {
case PACKET_DATA:
if (!fastd_peer_is_established(peer) || !fastd_peer_address_equal(&peer->local_address, local_addr)) {
fastd_buffer_free(buffer);
if (!backoff_unknown(remote_addr)) {
pr_debug("unexpectedly received payload data from %P[%I]", peer, remote_addr);
conf.protocol->handshake_init(sock, local_addr, remote_addr, NULL);
}
return;
}
conf.protocol->handle_recv(peer, buffer);
break;
case PACKET_HANDSHAKE:
fastd_handshake_handle(sock, local_addr, remote_addr, peer, buffer);
}
}
| 1 |
[
"CWE-617",
"CWE-119",
"CWE-284"
] |
fastd
|
737925113363b6130879729cdff9ccc46c33eaea
| 6,537,855,003,078,053,000,000,000,000,000,000,000 | 29 |
receive: fix buffer leak when receiving invalid packets
For fastd versions before v20, this was just a memory leak (which could
still be used for DoS, as it's remotely triggerable). With the new
buffer management of fastd v20, this will trigger an assertion failure
instead as soon as the buffer pool is empty.
|
static struct pattern *SFDParsePattern(FILE *sfd,char *tok) {
struct pattern *pat = chunkalloc(sizeof(struct pattern));
int ch;
getname(sfd,tok);
pat->pattern = copy(tok);
getreal(sfd,&pat->width);
while ( isspace(ch=nlgetc(sfd)));
if ( ch!=';' ) ungetc(ch,sfd);
getreal(sfd,&pat->height);
while ( isspace(ch=nlgetc(sfd)));
if ( ch!='[' ) ungetc(ch,sfd);
getreal(sfd,&pat->transform[0]);
getreal(sfd,&pat->transform[1]);
getreal(sfd,&pat->transform[2]);
getreal(sfd,&pat->transform[3]);
getreal(sfd,&pat->transform[4]);
getreal(sfd,&pat->transform[5]);
while ( isspace(ch=nlgetc(sfd)));
if ( ch!=']' ) ungetc(ch,sfd);
return( pat );
}
| 0 |
[
"CWE-416"
] |
fontforge
|
048a91e2682c1a8936ae34dbc7bd70291ec05410
| 330,813,908,873,309,650,000,000,000,000,000,000,000 | 24 |
Fix for #4084 Use-after-free (heap) in the SFD_GetFontMetaData() function
Fix for #4086 NULL pointer dereference in the SFDGetSpiros() function
Fix for #4088 NULL pointer dereference in the SFD_AssignLookups() function
Add empty sf->fontname string if it isn't set, fixing #4089 #4090 and many
other potential issues (many downstream calls to strlen() on the value).
|
dissect_kafka_fetch_request_forgottent_topic_partition(tvbuff_t *tvb, packet_info *pinfo _U_, proto_tree *tree, int offset,
kafka_api_version_t api_version _U_)
{
proto_tree_add_item(tree, hf_kafka_forgotten_topic_partition, tvb, offset, 4, ENC_BIG_ENDIAN);
offset += 4;
return offset;
}
| 0 |
[
"CWE-401"
] |
wireshark
|
f4374967bbf9c12746b8ec3cd54dddada9dd353e
| 151,784,690,089,652,130,000,000,000,000,000,000,000 | 7 |
Kafka: Limit our decompression size.
Don't assume that the Internet has our best interests at heart when it
gives us the size of our decompression buffer. Assign an arbitrary limit
of 50 MB.
This fixes #16739 in that it takes care of
** (process:17681): WARNING **: 20:03:07.440: Dissector bug, protocol Kafka, in packet 31: ../epan/proto.c:7043: failed assertion "end >= fi->start"
which is different from the original error output. It looks like *that*
might have taken care of in one of the other recent Kafka bug fixes.
The decompression routines return a success or failure status. Use
gbooleans instead of ints for that.
|
bool execute_query(const char **query, unsigned int length)
{
if (!mysql_real_query(&mysql, (const char *) *query, length))
return FALSE;
else if (mysql_errno(&mysql) == CR_SERVER_GONE_ERROR)
{
fprintf(stdout, " ... Failed! Error: %s\n", mysql_error(&mysql));
free_resources();
exit(1);
}
if ((mysql_errno(&mysql) == ER_PROCACCESS_DENIED_ERROR) ||
(mysql_errno(&mysql) == ER_TABLEACCESS_DENIED_ERROR) ||
(mysql_errno(&mysql) == ER_COLUMNACCESS_DENIED_ERROR))
{
fprintf(stdout, "The user provided does not have enough permissions "
"to continue.\nmysql_secure_installation is exiting.\n");
free_resources();
exit(1);
}
return TRUE;
}
| 0 |
[
"CWE-284",
"CWE-295"
] |
mysql-server
|
3bd5589e1a5a93f9c224badf983cd65c45215390
| 184,698,494,107,454,140,000,000,000,000,000,000,000 | 21 |
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
|
virtual ~QPDFWordTokenFinder()
{
}
| 0 |
[
"CWE-787"
] |
qpdf
|
d71f05ca07eb5c7cfa4d6d23e5c1f2a800f52e8e
| 324,162,363,152,068,800,000,000,000,000,000,000,000 | 3 |
Fix sign and conversion warnings (major)
This makes all integer type conversions that have potential data loss
explicit with calls that do range checks and raise an exception. After
this commit, qpdf builds with no warnings when -Wsign-conversion
-Wconversion is used with gcc or clang or when -W3 -Wd4800 is used
with MSVC. This significantly reduces the likelihood of potential
crashes from bogus integer values.
There are some parts of the code that take int when they should take
size_t or an offset. Such places would make qpdf not support files
with more than 2^31 of something that usually wouldn't be so large. In
the event that such a file shows up and is valid, at least qpdf would
raise an error in the right spot so the issue could be legitimately
addressed rather than failing in some weird way because of a silent
overflow condition.
|
#define GETS_FETCH_SIZE 8196LU
static char *php_mail_gets(readfn_t f, void *stream, unsigned long size, GETS_DATA *md) /* {{{ */
{
/* write to the gets stream if it is set,
otherwise forward to c-clients gets */
if (IMAPG(gets_stream)) {
char buf[GETS_FETCH_SIZE];
while (size) {
unsigned long read;
if (size > GETS_FETCH_SIZE) {
read = GETS_FETCH_SIZE;
size -=GETS_FETCH_SIZE;
} else {
read = size;
size = 0;
}
if (!f(stream, read, buf)) {
php_error_docref(NULL, E_WARNING, "Failed to read from socket");
break;
} else if (read != php_stream_write(IMAPG(gets_stream), buf, read)) {
php_error_docref(NULL, E_WARNING, "Failed to write to stream");
break;
}
}
return NULL;
} else {
char *buf = pemalloc(size + 1, 1);
if (f(stream, size, buf)) {
buf[size] = '\0';
} else {
php_error_docref(NULL, E_WARNING, "Failed to read from socket");
free(buf);
buf = NULL;
}
return buf;
}
| 0 |
[
"CWE-88"
] |
php-src
|
336d2086a9189006909ae06c7e95902d7d5ff77e
| 7,234,116,450,131,043,000,000,000,000,000,000,000 | 41 |
Disable rsh/ssh functionality in imap by default (bug #77153)
|
struct hsts *Curl_hsts_init(void)
{
struct hsts *h = calloc(sizeof(struct hsts), 1);
if(h) {
Curl_llist_init(&h->list, NULL);
}
return h;
}
| 0 |
[] |
curl
|
fae6fea209a2d4db1582f608bd8cc8000721733a
| 275,762,001,068,014,300,000,000,000,000,000,000,000 | 8 |
hsts: ignore trailing dots when comparing hosts names
CVE-2022-30115
Reported-by: Axel Chong
Bug: https://curl.se/docs/CVE-2022-30115.html
Closes #8821
|
static void rwpng_error_handler(png_structp png_ptr, png_const_charp msg)
{
rwpng_png_image *mainprog_ptr;
/* This function, aside from the extra step of retrieving the "error
* pointer" (below) and the fact that it exists within the application
* rather than within libpng, is essentially identical to libpng's
* default error handler. The second point is critical: since both
* setjmp() and longjmp() are called from the same code, they are
* guaranteed to have compatible notions of how big a jmp_buf is,
* regardless of whether _BSD_SOURCE or anything else has (or has not)
* been defined. */
fprintf(stderr, " error: %s (libpng failed)\n", msg);
fflush(stderr);
mainprog_ptr = png_get_error_ptr(png_ptr);
if (mainprog_ptr == NULL) abort();
longjmp(mainprog_ptr->jmpbuf, 1);
}
| 0 |
[
"CWE-190",
"CWE-787"
] |
pngquant
|
b7c217680cda02dddced245d237ebe8c383be285
| 26,121,836,529,349,590,000,000,000,000,000,000,000 | 21 |
Fix integer overflow in rwpng.h (CVE-2016-5735)
Reported by Choi Jaeseung
Found with Sparrow (http://ropas.snu.ac.kr/sparrow)
|
char* oidc_util_html_escape(apr_pool_t *pool, const char *s) {
// TODO: this has performance/memory issues for large chunks of HTML
const char chars[6] = { '&', '\'', '\"', '>', '<', '\0' };
const char *const replace[] =
{ "&", "'", """, ">", "<", };
unsigned int i, j = 0, k, n = 0, len = strlen(chars);
unsigned int m = 0;
char *r = apr_pcalloc(pool, strlen(s) * 6);
for (i = 0; i < strlen(s); i++) {
for (n = 0; n < len; n++) {
if (s[i] == chars[n]) {
m = (unsigned int) strlen(replace[n]);
for (k = 0; k < m; k++)
r[j + k] = replace[n][k];
j += m;
break;
}
}
if (n == len) {
r[j] = s[i];
j++;
}
}
r[j] = '\0';
return apr_pstrdup(pool, r);
}
| 0 |
[
"CWE-79"
] |
mod_auth_openidc
|
55ea0a085290cd2c8cdfdd960a230cbc38ba8b56
| 244,273,995,394,530,900,000,000,000,000,000,000,000 | 26 |
Add a function to escape Javascript characters
|
_fill32_spans (void *abstract_renderer, int y, int h,
const cairo_half_open_span_t *spans, unsigned num_spans)
{
cairo_image_span_renderer_t *r = abstract_renderer;
if (num_spans == 0)
return CAIRO_STATUS_SUCCESS;
if (likely(h == 1)) {
do {
if (spans[0].coverage) {
int len = spans[1].x - spans[0].x;
if (len > 32) {
pixman_fill ((uint32_t *)r->u.fill.data, r->u.fill.stride / sizeof(uint32_t), r->bpp,
spans[0].x, y, len, 1, r->u.fill.pixel);
} else {
uint32_t *d = (uint32_t*)(r->u.fill.data + r->u.fill.stride*y + spans[0].x*4);
while (len-- > 0)
*d++ = r->u.fill.pixel;
}
}
spans++;
} while (--num_spans > 1);
} else {
do {
if (spans[0].coverage) {
if (spans[1].x - spans[0].x > 16) {
pixman_fill ((uint32_t *)r->u.fill.data, r->u.fill.stride / sizeof(uint32_t), r->bpp,
spans[0].x, y, spans[1].x - spans[0].x, h,
r->u.fill.pixel);
} else {
int yy = y, hh = h;
do {
int len = spans[1].x - spans[0].x;
uint32_t *d = (uint32_t*)(r->u.fill.data + r->u.fill.stride*yy + spans[0].x*4);
while (len-- > 0)
*d++ = r->u.fill.pixel;
yy++;
} while (--hh);
}
}
spans++;
} while (--num_spans > 1);
}
return CAIRO_STATUS_SUCCESS;
}
| 0 |
[] |
cairo
|
03a820b173ed1fdef6ff14b4468f5dbc02ff59be
| 261,628,816,586,847,320,000,000,000,000,000,000,000 | 47 |
Fix mask usage in image-compositor
|
void reset(bool is_change_master)
{
if (unlikely(is_change_master))
{
delete_dynamic(&repl_ignore_server_ids);
/* Free all the array elements. */
delete_dynamic(&repl_do_domain_ids);
delete_dynamic(&repl_ignore_domain_ids);
}
host= user= password= log_file_name= ssl_key= ssl_cert= ssl_ca=
ssl_capath= ssl_cipher= ssl_crl= ssl_crlpath= relay_log_name= NULL;
pos= relay_log_pos= server_id= port= connect_retry= 0;
heartbeat_period= 0;
ssl= ssl_verify_server_cert= heartbeat_opt=
repl_ignore_server_ids_opt= repl_do_domain_ids_opt=
repl_ignore_domain_ids_opt= LEX_MI_UNCHANGED;
gtid_pos_str= null_clex_str;
use_gtid_opt= LEX_GTID_UNCHANGED;
sql_delay= -1;
}
| 0 |
[
"CWE-703"
] |
server
|
39feab3cd31b5414aa9b428eaba915c251ac34a2
| 209,553,189,655,629,060,000,000,000,000,000,000,000 | 21 |
MDEV-26412 Server crash in Item_field::fix_outer_field for INSERT SELECT
IF an INSERT/REPLACE SELECT statement contained an ON expression in the top
level select and this expression used a subquery with a column reference
that could not be resolved then an attempt to resolve this reference as
an outer reference caused a crash of the server. This happened because the
outer context field in the Name_resolution_context structure was not set
to NULL for such references. Rather it pointed to the first element in
the select_stack.
Note that starting from 10.4 we cannot use the SELECT_LEX::outer_select()
method when parsing a SELECT construct.
Approved by Oleksandr Byelkin <[email protected]>
|
bytes_find(PyBytesObject *self, PyObject *args)
{
Py_ssize_t result = bytes_find_internal(self, args, +1);
if (result == -2)
return NULL;
return PyLong_FromSsize_t(result);
}
| 0 |
[
"CWE-190"
] |
cpython
|
6c004b40f9d51872d848981ef1a18bb08c2dfc42
| 85,160,646,854,216,100,000,000,000,000,000,000,000 | 7 |
bpo-30657: Fix CVE-2017-1000158 (#4758)
Fixes possible integer overflow in PyBytes_DecodeEscape.
Co-Authored-By: Jay Bosamiya <[email protected]>
|
void raw6_proc_exit(void)
{
unregister_pernet_subsys(&raw6_net_ops);
}
| 0 |
[
"CWE-20"
] |
net
|
bceaa90240b6019ed73b49965eac7d167610be69
| 243,910,463,438,149,800,000,000,000,000,000,000,000 | 4 |
inet: prevent leakage of uninitialized memory to user in recv syscalls
Only update *addr_len when we actually fill in sockaddr, otherwise we
can return uninitialized memory from the stack to the caller in the
recvfrom, recvmmsg and recvmsg syscalls. Drop the the (addr_len == NULL)
checks because we only get called with a valid addr_len pointer either
from sock_common_recvmsg or inet_recvmsg.
If a blocking read waits on a socket which is concurrently shut down we
now return zero and set msg_msgnamelen to 0.
Reported-by: mpb <[email protected]>
Suggested-by: Eric Dumazet <[email protected]>
Signed-off-by: Hannes Frederic Sowa <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
|
static int net_read(struct wif *wi, unsigned char *h80211, int len,
struct rx_info *ri)
{
struct priv_net *pn = wi_priv(wi);
uint32_t buf[512]; // 512 * 4 = 2048
unsigned char *bufc = (unsigned char*)buf;
int cmd;
int sz = sizeof(*ri);
int l;
int ret;
/* try queue */
l = queue_get(pn, buf, sizeof(buf));
if (!l) {
/* try reading form net */
l = sizeof(buf);
cmd = net_get(pn->pn_s, buf, &l);
if (cmd == -1)
return -1;
if (cmd == NET_RC)
{
ret = ntohl((buf[0]));
return ret;
}
assert(cmd == NET_PACKET);
}
/* XXX */
if (ri) {
// re-assemble 64-bit integer
ri->ri_mactime = __be64_to_cpu(((uint64_t)buf[0] << 32 || buf[1] ));
ri->ri_power = __be32_to_cpu(buf[2]);
ri->ri_noise = __be32_to_cpu(buf[3]);
ri->ri_channel = __be32_to_cpu(buf[4]);
ri->ri_rate = __be32_to_cpu(buf[5]);
ri->ri_antenna = __be32_to_cpu(buf[6]);
}
l -= sz;
assert(l > 0);
if (l > len)
l = len;
memcpy(h80211, &bufc[sz], l);
return l;
}
| 0 |
[
"CWE-20",
"CWE-787"
] |
aircrack-ng
|
88702a3ce4c28a973bf69023cd0312f412f6193e
| 270,260,748,169,587,870,000,000,000,000,000,000,000 | 46 |
OSdep: Fixed segmentation fault that happens with a malicious server sending a negative length (Closes #16 on GitHub).
git-svn-id: http://svn.aircrack-ng.org/trunk@2419 28c6078b-6c39-48e3-add9-af49d547ecab
|
static int setCompDefaults(struct jpeg_compress_struct *cinfo, int pixelFormat,
int subsamp, int jpegQual, int flags)
{
int retval = 0;
char *env = NULL;
cinfo->in_color_space = pf2cs[pixelFormat];
cinfo->input_components = tjPixelSize[pixelFormat];
jpeg_set_defaults(cinfo);
#ifndef NO_GETENV
if ((env = getenv("TJ_OPTIMIZE")) != NULL && strlen(env) > 0 &&
!strcmp(env, "1"))
cinfo->optimize_coding = TRUE;
if ((env = getenv("TJ_ARITHMETIC")) != NULL && strlen(env) > 0 &&
!strcmp(env, "1"))
cinfo->arith_code = TRUE;
if ((env = getenv("TJ_RESTART")) != NULL && strlen(env) > 0) {
int temp = -1;
char tempc = 0;
if (sscanf(env, "%d%c", &temp, &tempc) >= 1 && temp >= 0 &&
temp <= 65535) {
if (toupper(tempc) == 'B') {
cinfo->restart_interval = temp;
cinfo->restart_in_rows = 0;
} else
cinfo->restart_in_rows = temp;
}
}
#endif
if (jpegQual >= 0) {
jpeg_set_quality(cinfo, jpegQual, TRUE);
if (jpegQual >= 96 || flags & TJFLAG_ACCURATEDCT)
cinfo->dct_method = JDCT_ISLOW;
else
cinfo->dct_method = JDCT_FASTEST;
}
if (subsamp == TJSAMP_GRAY)
jpeg_set_colorspace(cinfo, JCS_GRAYSCALE);
else if (pixelFormat == TJPF_CMYK)
jpeg_set_colorspace(cinfo, JCS_YCCK);
else
jpeg_set_colorspace(cinfo, JCS_YCbCr);
if (flags & TJFLAG_PROGRESSIVE)
jpeg_simple_progression(cinfo);
#ifndef NO_GETENV
else if ((env = getenv("TJ_PROGRESSIVE")) != NULL && strlen(env) > 0 &&
!strcmp(env, "1"))
jpeg_simple_progression(cinfo);
#endif
cinfo->comp_info[0].h_samp_factor = tjMCUWidth[subsamp] / 8;
cinfo->comp_info[1].h_samp_factor = 1;
cinfo->comp_info[2].h_samp_factor = 1;
if (cinfo->num_components > 3)
cinfo->comp_info[3].h_samp_factor = tjMCUWidth[subsamp] / 8;
cinfo->comp_info[0].v_samp_factor = tjMCUHeight[subsamp] / 8;
cinfo->comp_info[1].v_samp_factor = 1;
cinfo->comp_info[2].v_samp_factor = 1;
if (cinfo->num_components > 3)
cinfo->comp_info[3].v_samp_factor = tjMCUHeight[subsamp] / 8;
return retval;
}
| 0 |
[
"CWE-787"
] |
libjpeg-turbo
|
3d9c64e9f8aa1ee954d1d0bb3390fc894bb84da3
| 13,811,566,000,443,690,000,000,000,000,000,000,000 | 67 |
tjLoadImage(): Fix int overflow/segfault w/big BMP
Fixes #304
|
static void clear_dead_task(struct k_itimer *timer, union cpu_time_count now)
{
/*
* That's all for this thread or process.
* We leave our residual in expires to be reported.
*/
put_task_struct(timer->it.cpu.task);
timer->it.cpu.task = NULL;
timer->it.cpu.expires = cpu_time_sub(timer->it_clock,
timer->it.cpu.expires,
now);
}
| 0 |
[
"CWE-189"
] |
linux
|
f8bd2258e2d520dff28c855658bd24bdafb5102d
| 75,773,115,077,526,890,000,000,000,000,000,000,000 | 12 |
remove div_long_long_rem
x86 is the only arch right now, which provides an optimized for
div_long_long_rem and it has the downside that one has to be very careful that
the divide doesn't overflow.
The API is a little akward, as the arguments for the unsigned divide are
signed. The signed version also doesn't handle a negative divisor and
produces worse code on 64bit archs.
There is little incentive to keep this API alive, so this converts the few
users to the new API.
Signed-off-by: Roman Zippel <[email protected]>
Cc: Ralf Baechle <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: john stultz <[email protected]>
Cc: Christoph Lameter <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
|
_outJoinExpr(StringInfo str, const JoinExpr *node)
{
WRITE_NODE_TYPE("JOINEXPR");
WRITE_ENUM_FIELD(jointype, JoinType);
WRITE_BOOL_FIELD(isNatural);
WRITE_NODE_FIELD(larg);
WRITE_NODE_FIELD(rarg);
WRITE_NODE_FIELD(usingClause);
WRITE_NODE_FIELD(quals);
WRITE_NODE_FIELD(alias);
WRITE_INT_FIELD(rtindex);
}
| 0 |
[
"CWE-362"
] |
postgres
|
5f173040e324f6c2eebb90d86cf1b0cdb5890f0a
| 153,058,538,760,422,080,000,000,000,000,000,000,000 | 13 |
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
|
static bool sta_info_cleanup_expire_buffered_ac(struct ieee80211_local *local,
struct sta_info *sta, int ac)
{
unsigned long flags;
struct sk_buff *skb;
/*
* First check for frames that should expire on the filtered
* queue. Frames here were rejected by the driver and are on
* a separate queue to avoid reordering with normal PS-buffered
* frames. They also aren't accounted for right now in the
* total_ps_buffered counter.
*/
for (;;) {
spin_lock_irqsave(&sta->tx_filtered[ac].lock, flags);
skb = skb_peek(&sta->tx_filtered[ac]);
if (sta_info_buffer_expired(sta, skb))
skb = __skb_dequeue(&sta->tx_filtered[ac]);
else
skb = NULL;
spin_unlock_irqrestore(&sta->tx_filtered[ac].lock, flags);
/*
* Frames are queued in order, so if this one
* hasn't expired yet we can stop testing. If
* we actually reached the end of the queue we
* also need to stop, of course.
*/
if (!skb)
break;
ieee80211_free_txskb(&local->hw, skb);
}
/*
* Now also check the normal PS-buffered queue, this will
* only find something if the filtered queue was emptied
* since the filtered frames are all before the normal PS
* buffered frames.
*/
for (;;) {
spin_lock_irqsave(&sta->ps_tx_buf[ac].lock, flags);
skb = skb_peek(&sta->ps_tx_buf[ac]);
if (sta_info_buffer_expired(sta, skb))
skb = __skb_dequeue(&sta->ps_tx_buf[ac]);
else
skb = NULL;
spin_unlock_irqrestore(&sta->ps_tx_buf[ac].lock, flags);
/*
* frames are queued in order, so if this one
* hasn't expired yet (or we reached the end of
* the queue) we can stop testing
*/
if (!skb)
break;
local->total_ps_buffered--;
ps_dbg(sta->sdata, "Buffered frame expired (STA %pM)\n",
sta->sta.addr);
ieee80211_free_txskb(&local->hw, skb);
}
/*
* Finally, recalculate the TIM bit for this station -- it might
* now be clear because the station was too slow to retrieve its
* frames.
*/
sta_info_recalc_tim(sta);
/*
* Return whether there are any frames still buffered, this is
* used to check whether the cleanup timer still needs to run,
* if there are no frames we don't need to rearm the timer.
*/
return !(skb_queue_empty(&sta->ps_tx_buf[ac]) &&
skb_queue_empty(&sta->tx_filtered[ac]));
}
| 0 |
[
"CWE-287"
] |
linux
|
3e493173b7841259a08c5c8e5cbe90adb349da7e
| 15,508,315,503,858,274,000,000,000,000,000,000,000 | 77 |
mac80211: Do not send Layer 2 Update frame before authorization
The Layer 2 Update frame is used to update bridges when a station roams
to another AP even if that STA does not transmit any frames after the
reassociation. This behavior was described in IEEE Std 802.11F-2003 as
something that would happen based on MLME-ASSOCIATE.indication, i.e.,
before completing 4-way handshake. However, this IEEE trial-use
recommended practice document was published before RSN (IEEE Std
802.11i-2004) and as such, did not consider RSN use cases. Furthermore,
IEEE Std 802.11F-2003 was withdrawn in 2006 and as such, has not been
maintained amd should not be used anymore.
Sending out the Layer 2 Update frame immediately after association is
fine for open networks (and also when using SAE, FT protocol, or FILS
authentication when the station is actually authenticated by the time
association completes). However, it is not appropriate for cases where
RSN is used with PSK or EAP authentication since the station is actually
fully authenticated only once the 4-way handshake completes after
authentication and attackers might be able to use the unauthenticated
triggering of Layer 2 Update frame transmission to disrupt bridge
behavior.
Fix this by postponing transmission of the Layer 2 Update frame from
station entry addition to the point when the station entry is marked
authorized. Similarly, send out the VLAN binding update only if the STA
entry has already been authorized.
Signed-off-by: Jouni Malinen <[email protected]>
Reviewed-by: Johannes Berg <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
|
process_postgres_switches(int argc, char *argv[], GucContext ctx,
const char **dbname)
{
bool secure = (ctx == PGC_POSTMASTER);
int errs = 0;
GucSource gucsource;
int flag;
if (secure)
{
gucsource = PGC_S_ARGV; /* switches came from command line */
/* Ignore the initial --single argument, if present */
if (argc > 1 && strcmp(argv[1], "--single") == 0)
{
argv++;
argc--;
}
}
else
{
gucsource = PGC_S_CLIENT; /* switches came from client */
}
#ifdef HAVE_INT_OPTERR
/*
* Turn this off because it's either printed to stderr and not the log
* where we'd want it, or argv[0] is now "--single", which would make for
* a weird error message. We print our own error message below.
*/
opterr = 0;
#endif
/*
* Parse command-line options. CAUTION: keep this in sync with
* postmaster/postmaster.c (the option sets should not conflict) and with
* the common help() function in main/main.c.
*/
while ((flag = getopt(argc, argv, "B:bc:C:D:d:EeFf:h:ijk:lN:nOo:Pp:r:S:sTt:v:W:-:")) != -1)
{
switch (flag)
{
case 'B':
SetConfigOption("shared_buffers", optarg, ctx, gucsource);
break;
case 'b':
/* Undocumented flag used for binary upgrades */
if (secure)
IsBinaryUpgrade = true;
break;
case 'C':
/* ignored for consistency with the postmaster */
break;
case 'D':
if (secure)
userDoption = strdup(optarg);
break;
case 'd':
set_debug_options(atoi(optarg), ctx, gucsource);
break;
case 'E':
if (secure)
EchoQuery = true;
break;
case 'e':
SetConfigOption("datestyle", "euro", ctx, gucsource);
break;
case 'F':
SetConfigOption("fsync", "false", ctx, gucsource);
break;
case 'f':
if (!set_plan_disabling_options(optarg, ctx, gucsource))
errs++;
break;
case 'h':
SetConfigOption("listen_addresses", optarg, ctx, gucsource);
break;
case 'i':
SetConfigOption("listen_addresses", "*", ctx, gucsource);
break;
case 'j':
if (secure)
UseNewLine = 0;
break;
case 'k':
SetConfigOption("unix_socket_directories", optarg, ctx, gucsource);
break;
case 'l':
SetConfigOption("ssl", "true", ctx, gucsource);
break;
case 'N':
SetConfigOption("max_connections", optarg, ctx, gucsource);
break;
case 'n':
/* ignored for consistency with postmaster */
break;
case 'O':
SetConfigOption("allow_system_table_mods", "true", ctx, gucsource);
break;
case 'o':
errs++;
break;
case 'P':
SetConfigOption("ignore_system_indexes", "true", ctx, gucsource);
break;
case 'p':
SetConfigOption("port", optarg, ctx, gucsource);
break;
case 'r':
/* send output (stdout and stderr) to the given file */
if (secure)
strlcpy(OutputFileName, optarg, MAXPGPATH);
break;
case 'S':
SetConfigOption("work_mem", optarg, ctx, gucsource);
break;
case 's':
SetConfigOption("log_statement_stats", "true", ctx, gucsource);
break;
case 'T':
/* ignored for consistency with the postmaster */
break;
case 't':
{
const char *tmp = get_stats_option_name(optarg);
if (tmp)
SetConfigOption(tmp, "true", ctx, gucsource);
else
errs++;
break;
}
case 'v':
/*
* -v is no longer used in normal operation, since
* FrontendProtocol is already set before we get here. We keep
* the switch only for possible use in standalone operation,
* in case we ever support using normal FE/BE protocol with a
* standalone backend.
*/
if (secure)
FrontendProtocol = (ProtocolVersion) atoi(optarg);
break;
case 'W':
SetConfigOption("post_auth_delay", optarg, ctx, gucsource);
break;
case 'c':
case '-':
{
char *name,
*value;
ParseLongOption(optarg, &name, &value);
if (!value)
{
if (flag == '-')
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("--%s requires a value",
optarg)));
else
ereport(ERROR,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("-c %s requires a value",
optarg)));
}
SetConfigOption(name, value, ctx, gucsource);
free(name);
if (value)
free(value);
break;
}
default:
errs++;
break;
}
if (errs)
break;
}
/*
* Optional database name should be there only if *dbname is NULL.
*/
if (!errs && dbname && *dbname == NULL && argc - optind >= 1)
*dbname = strdup(argv[optind++]);
if (errs || argc != optind)
{
if (errs)
optind--; /* complain about the previous argument */
/* spell the error message a bit differently depending on context */
if (IsUnderPostmaster)
ereport(FATAL,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("invalid command-line argument for server process: %s", argv[optind]),
errhint("Try \"%s --help\" for more information.", progname)));
else
ereport(FATAL,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("%s: invalid command-line argument: %s",
progname, argv[optind]),
errhint("Try \"%s --help\" for more information.", progname)));
}
/*
* Reset getopt(3) library so that it will work correctly in subprocesses
* or when this function is called a second time with another array.
*/
optind = 1;
#ifdef HAVE_INT_OPTRESET
optreset = 1; /* some systems need this too */
#endif
}
| 0 |
[
"CWE-89"
] |
postgres
|
2b3a8b20c2da9f39ffecae25ab7c66974fbc0d3b
| 242,203,474,577,770,600,000,000,000,000,000,000,000 | 245 |
Be more careful to not lose sync in the FE/BE protocol.
If any error occurred while we were in the middle of reading a protocol
message from the client, we could lose sync, and incorrectly try to
interpret a part of another message as a new protocol message. That will
usually lead to an "invalid frontend message" error that terminates the
connection. However, this is a security issue because an attacker might
be able to deliberately cause an error, inject a Query message in what's
supposed to be just user data, and have the server execute it.
We were quite careful to not have CHECK_FOR_INTERRUPTS() calls or other
operations that could ereport(ERROR) in the middle of processing a message,
but a query cancel interrupt or statement timeout could nevertheless cause
it to happen. Also, the V2 fastpath and COPY handling were not so careful.
It's very difficult to recover in the V2 COPY protocol, so we will just
terminate the connection on error. In practice, that's what happened
previously anyway, as we lost protocol sync.
To fix, add a new variable in pqcomm.c, PqCommReadingMsg, that is set
whenever we're in the middle of reading a message. When it's set, we cannot
safely ERROR out and continue running, because we might've read only part
of a message. PqCommReadingMsg acts somewhat similarly to critical sections
in that if an error occurs while it's set, the error handler will force the
connection to be terminated, as if the error was FATAL. It's not
implemented by promoting ERROR to FATAL in elog.c, like ERROR is promoted
to PANIC in critical sections, because we want to be able to use
PG_TRY/CATCH to recover and regain protocol sync. pq_getmessage() takes
advantage of that to prevent an OOM error from terminating the connection.
To prevent unnecessary connection terminations, add a holdoff mechanism
similar to HOLD/RESUME_INTERRUPTS() that can be used hold off query cancel
interrupts, but still allow die interrupts. The rules on which interrupts
are processed when are now a bit more complicated, so refactor
ProcessInterrupts() and the calls to it in signal handlers so that the
signal handlers always call it if ImmediateInterruptOK is set, and
ProcessInterrupts() can decide to not do anything if the other conditions
are not met.
Reported by Emil Lenngren. Patch reviewed by Noah Misch and Andres Freund.
Backpatch to all supported versions.
Security: CVE-2015-0244
|
lys_leaf_check_leafref(struct lys_node_leaf *leafref_target, struct lys_node *leafref)
{
struct lys_node_leaf *iter;
struct lys_node *op;
struct ly_ctx *ctx = leafref_target->module->ctx;
if (!(leafref_target->nodetype & (LYS_LEAF | LYS_LEAFLIST))) {
LOGINT(ctx);
return -1;
}
/* find the operation node if we are in one */
for (op = leafref; op && !(op->nodetype & (LYS_RPC | LYS_ACTION | LYS_NOTIF)); op = lys_parent(op));
/* check for config flag */
if (!op && ((struct lys_node_leaf*)leafref)->type.info.lref.req != -1 &&
(leafref->flags & LYS_CONFIG_W) && (leafref_target->flags & LYS_CONFIG_R)) {
LOGVAL(ctx, LYE_SPEC, LY_VLOG_LYS, leafref,
"The leafref %s is config but refers to a non-config %s.",
strnodetype(leafref->nodetype), strnodetype(leafref_target->nodetype));
return -1;
}
/* check for cycles */
for (iter = leafref_target; iter && iter->type.base == LY_TYPE_LEAFREF; iter = iter->type.info.lref.target) {
if ((void *)iter == (void *)leafref) {
/* cycle detected */
LOGVAL(ctx, LYE_CIRC_LEAFREFS, LY_VLOG_LYS, leafref);
return -1;
}
}
return 0;
}
| 0 |
[
"CWE-617"
] |
libyang
|
5ce30801f9ccc372bbe9b7c98bb5324b15fb010a
| 184,314,898,449,870,870,000,000,000,000,000,000,000 | 33 |
schema tree BUGFIX freeing nodes with no module set
Context must be passed explicitly for these cases.
Fixes #1452
|
e_ews_connection_find_folder_finish (EEwsConnection *cnc,
GAsyncResult *result,
gboolean *includes_last_item,
GSList **folders,
GError **error)
{
GSimpleAsyncResult *simple;
EwsAsyncData *async_data;
g_return_val_if_fail (cnc != NULL, FALSE);
g_return_val_if_fail (
g_simple_async_result_is_valid (
result, G_OBJECT (cnc), e_ews_connection_find_folder),
FALSE);
simple = G_SIMPLE_ASYNC_RESULT (result);
async_data = g_simple_async_result_get_op_res_gpointer (simple);
if (g_simple_async_result_propagate_error (simple, error))
return FALSE;
*includes_last_item = async_data->includes_last_item;
*folders = async_data->items;
return TRUE;
}
| 0 |
[
"CWE-295"
] |
evolution-ews
|
915226eca9454b8b3e5adb6f2fff9698451778de
| 82,079,209,474,624,865,000,000,000,000,000,000,000 | 26 |
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
|
TIFFNumberOfStrips(TIFF* tif)
{
TIFFDirectory *td = &tif->tif_dir;
uint32 nstrips;
/* If the value was already computed and store in td_nstrips, then return it,
since ChopUpSingleUncompressedStrip might have altered and resized the
since the td_stripbytecount and td_stripoffset arrays to the new value
after the initial affectation of td_nstrips = TIFFNumberOfStrips() in
tif_dirread.c ~line 3612.
See http://bugzilla.maptools.org/show_bug.cgi?id=2587 */
if( td->td_nstrips )
return td->td_nstrips;
nstrips = (td->td_rowsperstrip == (uint32) -1 ? 1 :
TIFFhowmany_32(td->td_imagelength, td->td_rowsperstrip));
if (td->td_planarconfig == PLANARCONFIG_SEPARATE)
nstrips = _TIFFMultiply32(tif, nstrips, (uint32)td->td_samplesperpixel,
"TIFFNumberOfStrips");
return (nstrips);
}
| 1 |
[
"CWE-125"
] |
libtiff
|
9a72a69e035ee70ff5c41541c8c61cd97990d018
| 184,825,093,869,389,800,000,000,000,000,000,000,000 | 21 |
* libtiff/tif_dirread.c: modify ChopUpSingleUncompressedStrip() to
instanciate compute ntrips as TIFFhowmany_32(td->td_imagelength, rowsperstrip),
instead of a logic based on the total size of data. Which is faulty is
the total size of data is not sufficient to fill the whole image, and thus
results in reading outside of the StripByCounts/StripOffsets arrays when
using TIFFReadScanline().
Reported by Agostino Sarubbo.
Fixes http://bugzilla.maptools.org/show_bug.cgi?id=2608.
* libtiff/tif_strip.c: revert the change in TIFFNumberOfStrips() done
for http://bugzilla.maptools.org/show_bug.cgi?id=2587 / CVE-2016-9273 since
the above change is a better fix that makes it unnecessary.
|
static int do_show_master_status(MYSQL *mysql_con)
{
MYSQL_ROW row;
MYSQL_RES *master;
const char *comment_prefix=
(opt_master_data == MYSQL_OPT_MASTER_DATA_COMMENTED_SQL) ? "-- " : "";
if (mysql_query_with_error_report(mysql_con, &master, "SHOW MASTER STATUS"))
{
return 1;
}
else
{
row= mysql_fetch_row(master);
if (row && row[0] && row[1])
{
/* SHOW MASTER STATUS reports file and position */
print_comment(md_result_file, 0,
"\n--\n-- Position to start replication or point-in-time "
"recovery from\n--\n\n");
fprintf(md_result_file,
"%sCHANGE MASTER TO MASTER_LOG_FILE='%s', MASTER_LOG_POS=%s;\n",
comment_prefix, row[0], row[1]);
check_io(md_result_file);
}
else if (!ignore_errors)
{
/* SHOW MASTER STATUS reports nothing and --force is not enabled */
my_printf_error(0, "Error: Binlogging on server not active",
MYF(0));
mysql_free_result(master);
maybe_exit(EX_MYSQLERR);
return 1;
}
mysql_free_result(master);
}
return 0;
}
| 0 |
[
"CWE-295"
] |
mysql-server
|
b3e9211e48a3fb586e88b0270a175d2348935424
| 199,316,712,039,993,200,000,000,000,000,000,000,000 | 37 |
WL#9072: Backport WL#8785 to 5.5
|
static void ssl_mac( md_context_t *md_ctx, unsigned char *secret,
unsigned char *buf, size_t len,
unsigned char *ctr, int type )
{
unsigned char header[11];
unsigned char padding[48];
int padlen;
int md_size = md_get_size( md_ctx->md_info );
int md_type = md_get_type( md_ctx->md_info );
/* Only MD5 and SHA-1 supported */
if( md_type == POLARSSL_MD_MD5 )
padlen = 48;
else
padlen = 40;
memcpy( header, ctr, 8 );
header[ 8] = (unsigned char) type;
header[ 9] = (unsigned char)( len >> 8 );
header[10] = (unsigned char)( len );
memset( padding, 0x36, padlen );
md_starts( md_ctx );
md_update( md_ctx, secret, md_size );
md_update( md_ctx, padding, padlen );
md_update( md_ctx, header, 11 );
md_update( md_ctx, buf, len );
md_finish( md_ctx, buf + len );
memset( padding, 0x5C, padlen );
md_starts( md_ctx );
md_update( md_ctx, secret, md_size );
md_update( md_ctx, padding, padlen );
md_update( md_ctx, buf + len, md_size );
md_finish( md_ctx, buf + len );
}
| 0 |
[
"CWE-119"
] |
mbedtls
|
c988f32adde62a169ba340fee0da15aecd40e76e
| 88,047,398,770,833,370,000,000,000,000,000,000,000 | 36 |
Added max length checking of hostname
|
dirvote_perform_vote(void)
{
crypto_pk_t *key = get_my_v3_authority_signing_key();
authority_cert_t *cert = get_my_v3_authority_cert();
networkstatus_t *ns;
char *contents;
pending_vote_t *pending_vote;
time_t now = time(NULL);
int status;
const char *msg = "";
if (!cert || !key) {
log_warn(LD_NET, "Didn't find key/certificate to generate v3 vote");
return -1;
} else if (cert->expires < now) {
log_warn(LD_NET, "Can't generate v3 vote with expired certificate");
return -1;
}
if (!(ns = dirserv_generate_networkstatus_vote_obj(key, cert)))
return -1;
contents = format_networkstatus_vote(key, ns);
networkstatus_vote_free(ns);
if (!contents)
return -1;
pending_vote = dirvote_add_vote(contents, &msg, &status);
tor_free(contents);
if (!pending_vote) {
log_warn(LD_DIR, "Couldn't store my own vote! (I told myself, '%s'.)",
msg);
return -1;
}
directory_post_to_dirservers(DIR_PURPOSE_UPLOAD_VOTE,
ROUTER_PURPOSE_GENERAL,
V3_DIRINFO,
pending_vote->vote_body->dir,
pending_vote->vote_body->dir_len, 0);
log_notice(LD_DIR, "Vote posted.");
return 0;
}
| 0 |
[] |
tor
|
a0ef3cf0880e3cd343977b3fcbd0a2e7572f0cb4
| 212,529,994,554,060,050,000,000,000,000,000,000,000 | 43 |
Prevent int underflow in dirvote.c compare_vote_rs_.
This should be "impossible" without making a SHA1 collision, but
let's not keep the assumption that SHA1 collisions are super-hard.
This prevents another case related to 21278. There should be no
behavioral change unless -ftrapv is on.
|
char sqlite3ExprAffinity(Expr *pExpr){
int op;
while( ExprHasProperty(pExpr, EP_Skip) ){
assert( pExpr->op==TK_COLLATE );
pExpr = pExpr->pLeft;
assert( pExpr!=0 );
}
op = pExpr->op;
if( op==TK_SELECT ){
assert( pExpr->flags&EP_xIsSelect );
return sqlite3ExprAffinity(pExpr->x.pSelect->pEList->a[0].pExpr);
}
if( op==TK_REGISTER ) op = pExpr->op2;
#ifndef SQLITE_OMIT_CAST
if( op==TK_CAST ){
assert( !ExprHasProperty(pExpr, EP_IntValue) );
return sqlite3AffinityType(pExpr->u.zToken, 0);
}
#endif
if( (op==TK_AGG_COLUMN || op==TK_COLUMN) && pExpr->y.pTab ){
return sqlite3TableColumnAffinity(pExpr->y.pTab, pExpr->iColumn);
}
if( op==TK_SELECT_COLUMN ){
assert( pExpr->pLeft->flags&EP_xIsSelect );
return sqlite3ExprAffinity(
pExpr->pLeft->x.pSelect->pEList->a[pExpr->iColumn].pExpr
);
}
if( op==TK_VECTOR ){
return sqlite3ExprAffinity(pExpr->x.pList->a[0].pExpr);
}
return pExpr->affExpr;
}
| 0 |
[
"CWE-476"
] |
sqlite
|
57f7ece78410a8aae86aa4625fb7556897db384c
| 144,458,355,292,365,340,000,000,000,000,000,000,000 | 33 |
Fix a problem that comes up when using generated columns that evaluate to a
constant in an index and then making use of that index in a join.
FossilOrigin-Name: 8b12e95fec7ce6e0de82a04ca3dfcf1a8e62e233b7382aa28a8a9be6e862b1af
|
static int audit_match_filetype(struct audit_context *ctx, int val)
{
struct audit_names *n;
umode_t mode = (umode_t)val;
if (unlikely(!ctx))
return 0;
list_for_each_entry(n, &ctx->names_list, list) {
if ((n->ino != AUDIT_INO_UNSET) &&
((n->mode & S_IFMT) == mode))
return 1;
}
return 0;
}
| 0 |
[
"CWE-362"
] |
linux
|
43761473c254b45883a64441dd0bc85a42f3645c
| 321,612,115,610,142,600,000,000,000,000,000,000,000 | 16 |
audit: fix a double fetch in audit_log_single_execve_arg()
There is a double fetch problem in audit_log_single_execve_arg()
where we first check the execve(2) argumnets for any "bad" characters
which would require hex encoding and then re-fetch the arguments for
logging in the audit record[1]. Of course this leaves a window of
opportunity for an unsavory application to munge with the data.
This patch reworks things by only fetching the argument data once[2]
into a buffer where it is scanned and logged into the audit
records(s). In addition to fixing the double fetch, this patch
improves on the original code in a few other ways: better handling
of large arguments which require encoding, stricter record length
checking, and some performance improvements (completely unverified,
but we got rid of some strlen() calls, that's got to be a good
thing).
As part of the development of this patch, I've also created a basic
regression test for the audit-testsuite, the test can be tracked on
GitHub at the following link:
* https://github.com/linux-audit/audit-testsuite/issues/25
[1] If you pay careful attention, there is actually a triple fetch
problem due to a strnlen_user() call at the top of the function.
[2] This is a tiny white lie, we do make a call to strnlen_user()
prior to fetching the argument data. I don't like it, but due to the
way the audit record is structured we really have no choice unless we
copy the entire argument at once (which would require a rather
wasteful allocation). The good news is that with this patch the
kernel no longer relies on this strnlen_user() value for anything
beyond recording it in the log, we also update it with a trustworthy
value whenever possible.
Reported-by: Pengfei Wang <[email protected]>
Cc: <[email protected]>
Signed-off-by: Paul Moore <[email protected]>
|
dnParent(
struct berval *dn,
struct berval *pdn )
{
char *p;
p = ber_bvchr( dn, ',' );
/* one-level dn */
if ( p == NULL ) {
pdn->bv_val = dn->bv_val + dn->bv_len;
pdn->bv_len = 0;
return;
}
assert( DN_SEPARATOR( p[ 0 ] ) );
p++;
assert( ATTR_LEADCHAR( p[ 0 ] ) );
pdn->bv_len = dn->bv_len - (p - dn->bv_val);
pdn->bv_val = p;
return;
}
| 0 |
[
"CWE-763"
] |
openldap
|
5a2017d4e61a6ddc4dcb4415028e0d08eb6bca26
| 323,730,981,044,050,840,000,000,000,000,000,000,000 | 24 |
ITS#9412 fix AVA_Sort on invalid RDN
|
void audit_filter_inodes(struct task_struct *tsk, struct audit_context *ctx)
{
struct audit_names *n;
if (audit_pid && tsk->tgid == audit_pid)
return;
rcu_read_lock();
list_for_each_entry(n, &ctx->names_list, list) {
if (audit_filter_inode_name(tsk, n, ctx))
break;
}
rcu_read_unlock();
}
| 0 |
[
"CWE-362"
] |
linux
|
43761473c254b45883a64441dd0bc85a42f3645c
| 50,085,032,017,689,140,000,000,000,000,000,000,000 | 15 |
audit: fix a double fetch in audit_log_single_execve_arg()
There is a double fetch problem in audit_log_single_execve_arg()
where we first check the execve(2) argumnets for any "bad" characters
which would require hex encoding and then re-fetch the arguments for
logging in the audit record[1]. Of course this leaves a window of
opportunity for an unsavory application to munge with the data.
This patch reworks things by only fetching the argument data once[2]
into a buffer where it is scanned and logged into the audit
records(s). In addition to fixing the double fetch, this patch
improves on the original code in a few other ways: better handling
of large arguments which require encoding, stricter record length
checking, and some performance improvements (completely unverified,
but we got rid of some strlen() calls, that's got to be a good
thing).
As part of the development of this patch, I've also created a basic
regression test for the audit-testsuite, the test can be tracked on
GitHub at the following link:
* https://github.com/linux-audit/audit-testsuite/issues/25
[1] If you pay careful attention, there is actually a triple fetch
problem due to a strnlen_user() call at the top of the function.
[2] This is a tiny white lie, we do make a call to strnlen_user()
prior to fetching the argument data. I don't like it, but due to the
way the audit record is structured we really have no choice unless we
copy the entire argument at once (which would require a rather
wasteful allocation). The good news is that with this patch the
kernel no longer relies on this strnlen_user() value for anything
beyond recording it in the log, we also update it with a trustworthy
value whenever possible.
Reported-by: Pengfei Wang <[email protected]>
Cc: <[email protected]>
Signed-off-by: Paul Moore <[email protected]>
|
static void complete_update_bin(conn *c) {
protocol_binary_response_status eno = PROTOCOL_BINARY_RESPONSE_EINVAL;
enum store_item_type ret = NOT_STORED;
assert(c != NULL);
item *it = c->item;
pthread_mutex_lock(&c->thread->stats.mutex);
c->thread->stats.slab_stats[ITEM_clsid(it)].set_cmds++;
pthread_mutex_unlock(&c->thread->stats.mutex);
/* We don't actually receive the trailing two characters in the bin
* protocol, so we're going to just set them here */
if ((it->it_flags & ITEM_CHUNKED) == 0) {
*(ITEM_data(it) + it->nbytes - 2) = '\r';
*(ITEM_data(it) + it->nbytes - 1) = '\n';
} else {
assert(c->ritem);
item_chunk *ch = (item_chunk *) c->ritem;
if (ch->size == ch->used)
ch = ch->next;
assert(ch->size - ch->used >= 2);
ch->data[ch->used] = '\r';
ch->data[ch->used + 1] = '\n';
ch->used += 2;
}
ret = store_item(it, c->cmd, c);
#ifdef ENABLE_DTRACE
uint64_t cas = ITEM_get_cas(it);
switch (c->cmd) {
case NREAD_ADD:
MEMCACHED_COMMAND_ADD(c->sfd, ITEM_key(it), it->nkey,
(ret == STORED) ? it->nbytes : -1, cas);
break;
case NREAD_REPLACE:
MEMCACHED_COMMAND_REPLACE(c->sfd, ITEM_key(it), it->nkey,
(ret == STORED) ? it->nbytes : -1, cas);
break;
case NREAD_APPEND:
MEMCACHED_COMMAND_APPEND(c->sfd, ITEM_key(it), it->nkey,
(ret == STORED) ? it->nbytes : -1, cas);
break;
case NREAD_PREPEND:
MEMCACHED_COMMAND_PREPEND(c->sfd, ITEM_key(it), it->nkey,
(ret == STORED) ? it->nbytes : -1, cas);
break;
case NREAD_SET:
MEMCACHED_COMMAND_SET(c->sfd, ITEM_key(it), it->nkey,
(ret == STORED) ? it->nbytes : -1, cas);
break;
}
#endif
switch (ret) {
case STORED:
/* Stored */
write_bin_response(c, NULL, 0, 0, 0);
break;
case EXISTS:
write_bin_error(c, PROTOCOL_BINARY_RESPONSE_KEY_EEXISTS, NULL, 0);
break;
case NOT_FOUND:
write_bin_error(c, PROTOCOL_BINARY_RESPONSE_KEY_ENOENT, NULL, 0);
break;
case NOT_STORED:
case TOO_LARGE:
case NO_MEMORY:
if (c->cmd == NREAD_ADD) {
eno = PROTOCOL_BINARY_RESPONSE_KEY_EEXISTS;
} else if(c->cmd == NREAD_REPLACE) {
eno = PROTOCOL_BINARY_RESPONSE_KEY_ENOENT;
} else {
eno = PROTOCOL_BINARY_RESPONSE_NOT_STORED;
}
write_bin_error(c, eno, NULL, 0);
}
item_remove(c->item); /* release the c->item reference */
c->item = 0;
}
| 0 |
[
"CWE-20",
"CWE-703",
"CWE-400"
] |
memcached
|
dbb7a8af90054bf4ef51f5814ef7ceb17d83d974
| 168,628,082,373,880,110,000,000,000,000,000,000,000 | 82 |
disable UDP port by default
As reported, UDP amplification attacks have started to use insecure
internet-exposed memcached instances. UDP used to be a lot more popular as a
transport for memcached many years ago, but I'm not aware of many recent
users.
Ten years ago, the TCP connection overhead from many clients was relatively
high (dozens or hundreds per client server), but these days many clients are
batched, or user fewer processes, or simply anre't worried about it.
While changing the default to listen on localhost only would also help, the
true culprit is UDP. There are many more use cases for using memcached over
the network than there are for using the UDP protocol.
|
static bool rand_enough(void)
{
return (0 != RAND_status()) ? TRUE : FALSE;
}
| 0 |
[
"CWE-290"
] |
curl
|
b09c8ee15771c614c4bf3ddac893cdb12187c844
| 48,588,551,662,150,690,000,000,000,000,000,000,000 | 4 |
vtls: add 'isproxy' argument to Curl_ssl_get/addsessionid()
To make sure we set and extract the correct session.
Reported-by: Mingtao Yang
Bug: https://curl.se/docs/CVE-2021-22890.html
CVE-2021-22890
|
static int decode_block(AVCodecContext *avctx, void *tdata,
int jobnr, int threadnr)
{
EXRContext *s = avctx->priv_data;
AVFrame *const p = s->picture;
EXRThreadData *td = &s->thread_data[threadnr];
const uint8_t *channel_buffer[4] = { 0 };
const uint8_t *buf = s->buf;
uint64_t line_offset, uncompressed_size;
uint8_t *ptr;
uint32_t data_size;
int line, col = 0;
uint64_t tile_x, tile_y, tile_level_x, tile_level_y;
const uint8_t *src;
int step = s->desc->flags & AV_PIX_FMT_FLAG_FLOAT ? 4 : 2 * s->desc->nb_components;
int bxmin = 0, axmax = 0, window_xoffset = 0;
int window_xmin, window_xmax, window_ymin, window_ymax;
int data_xoffset, data_yoffset, data_window_offset, xsize, ysize;
int i, x, buf_size = s->buf_size;
int c, rgb_channel_count;
float one_gamma = 1.0f / s->gamma;
avpriv_trc_function trc_func = avpriv_get_trc_function_from_trc(s->apply_trc_type);
int ret;
line_offset = AV_RL64(s->gb.buffer + jobnr * 8);
if (s->is_tile) {
if (buf_size < 20 || line_offset > buf_size - 20)
return AVERROR_INVALIDDATA;
src = buf + line_offset + 20;
tile_x = AV_RL32(src - 20);
tile_y = AV_RL32(src - 16);
tile_level_x = AV_RL32(src - 12);
tile_level_y = AV_RL32(src - 8);
data_size = AV_RL32(src - 4);
if (data_size <= 0 || data_size > buf_size - line_offset - 20)
return AVERROR_INVALIDDATA;
if (tile_level_x || tile_level_y) { /* tile level, is not the full res level */
avpriv_report_missing_feature(s->avctx, "Subres tile before full res tile");
return AVERROR_PATCHWELCOME;
}
line = s->ymin + s->tile_attr.ySize * tile_y;
col = s->tile_attr.xSize * tile_x;
if (line < s->ymin || line > s->ymax ||
s->xmin + col < s->xmin || s->xmin + col > s->xmax)
return AVERROR_INVALIDDATA;
td->ysize = FFMIN(s->tile_attr.ySize, s->ydelta - tile_y * s->tile_attr.ySize);
td->xsize = FFMIN(s->tile_attr.xSize, s->xdelta - tile_x * s->tile_attr.xSize);
if (td->xsize * (uint64_t)s->current_channel_offset > INT_MAX)
return AVERROR_INVALIDDATA;
td->channel_line_size = td->xsize * s->current_channel_offset;/* uncompress size of one line */
uncompressed_size = td->channel_line_size * (uint64_t)td->ysize;/* uncompress size of the block */
} else {
if (buf_size < 8 || line_offset > buf_size - 8)
return AVERROR_INVALIDDATA;
src = buf + line_offset + 8;
line = AV_RL32(src - 8);
if (line < s->ymin || line > s->ymax)
return AVERROR_INVALIDDATA;
data_size = AV_RL32(src - 4);
if (data_size <= 0 || data_size > buf_size - line_offset - 8)
return AVERROR_INVALIDDATA;
td->ysize = FFMIN(s->scan_lines_per_block, s->ymax - line + 1); /* s->ydelta - line ?? */
td->xsize = s->xdelta;
if (td->xsize * (uint64_t)s->current_channel_offset > INT_MAX)
return AVERROR_INVALIDDATA;
td->channel_line_size = td->xsize * s->current_channel_offset;/* uncompress size of one line */
uncompressed_size = td->channel_line_size * (uint64_t)td->ysize;/* uncompress size of the block */
if ((s->compression == EXR_RAW && (data_size != uncompressed_size ||
line_offset > buf_size - uncompressed_size)) ||
(s->compression != EXR_RAW && (data_size > uncompressed_size ||
line_offset > buf_size - data_size))) {
return AVERROR_INVALIDDATA;
}
}
window_xmin = FFMIN(avctx->width, FFMAX(0, s->xmin + col));
window_xmax = FFMIN(avctx->width, FFMAX(0, s->xmin + col + td->xsize));
window_ymin = FFMIN(avctx->height, FFMAX(0, line ));
window_ymax = FFMIN(avctx->height, FFMAX(0, line + td->ysize));
xsize = window_xmax - window_xmin;
ysize = window_ymax - window_ymin;
/* tile or scanline not visible skip decoding */
if (xsize <= 0 || ysize <= 0)
return 0;
/* is the first tile or is a scanline */
if(col == 0) {
window_xmin = 0;
/* pixels to add at the left of the display window */
window_xoffset = FFMAX(0, s->xmin);
/* bytes to add at the left of the display window */
bxmin = window_xoffset * step;
}
/* is the last tile or is a scanline */
if(col + td->xsize == s->xdelta) {
window_xmax = avctx->width;
/* bytes to add at the right of the display window */
axmax = FFMAX(0, (avctx->width - (s->xmax + 1))) * step;
}
if (data_size < uncompressed_size || s->is_tile) { /* td->tmp is use for tile reorganization */
av_fast_padded_malloc(&td->tmp, &td->tmp_size, uncompressed_size);
if (!td->tmp)
return AVERROR(ENOMEM);
}
if (data_size < uncompressed_size) {
av_fast_padded_malloc(&td->uncompressed_data,
&td->uncompressed_size, uncompressed_size + 64);/* Force 64 padding for AVX2 reorder_pixels dst */
if (!td->uncompressed_data)
return AVERROR(ENOMEM);
ret = AVERROR_INVALIDDATA;
switch (s->compression) {
case EXR_ZIP1:
case EXR_ZIP16:
ret = zip_uncompress(s, src, data_size, uncompressed_size, td);
break;
case EXR_PIZ:
ret = piz_uncompress(s, src, data_size, uncompressed_size, td);
break;
case EXR_PXR24:
ret = pxr24_uncompress(s, src, data_size, uncompressed_size, td);
break;
case EXR_RLE:
ret = rle_uncompress(s, src, data_size, uncompressed_size, td);
break;
case EXR_B44:
case EXR_B44A:
ret = b44_uncompress(s, src, data_size, uncompressed_size, td);
break;
}
if (ret < 0) {
av_log(avctx, AV_LOG_ERROR, "decode_block() failed.\n");
return ret;
}
src = td->uncompressed_data;
}
/* offsets to crop data outside display window */
data_xoffset = FFABS(FFMIN(0, s->xmin + col)) * (s->pixel_type == EXR_HALF ? 2 : 4);
data_yoffset = FFABS(FFMIN(0, line));
data_window_offset = (data_yoffset * td->channel_line_size) + data_xoffset;
if (!s->is_luma) {
channel_buffer[0] = src + (td->xsize * s->channel_offsets[0]) + data_window_offset;
channel_buffer[1] = src + (td->xsize * s->channel_offsets[1]) + data_window_offset;
channel_buffer[2] = src + (td->xsize * s->channel_offsets[2]) + data_window_offset;
rgb_channel_count = 3;
} else { /* put y data in the first channel_buffer */
channel_buffer[0] = src + (td->xsize * s->channel_offsets[1]) + data_window_offset;
rgb_channel_count = 1;
}
if (s->channel_offsets[3] >= 0)
channel_buffer[3] = src + (td->xsize * s->channel_offsets[3]) + data_window_offset;
if (s->desc->flags & AV_PIX_FMT_FLAG_FLOAT) {
/* todo: change this when a floating point pixel format with luma with alpha is implemented */
int channel_count = s->channel_offsets[3] >= 0 ? 4 : rgb_channel_count;
if (s->is_luma) {
channel_buffer[1] = channel_buffer[0];
channel_buffer[2] = channel_buffer[0];
}
for (c = 0; c < channel_count; c++) {
int plane = s->desc->comp[c].plane;
ptr = p->data[plane] + window_ymin * p->linesize[plane] + (window_xmin * 4);
for (i = 0; i < ysize; i++, ptr += p->linesize[plane]) {
const uint8_t *src;
union av_intfloat32 *ptr_x;
src = channel_buffer[c];
ptr_x = (union av_intfloat32 *)ptr;
// Zero out the start if xmin is not 0
memset(ptr_x, 0, bxmin);
ptr_x += window_xoffset;
if (s->pixel_type == EXR_FLOAT) {
// 32-bit
union av_intfloat32 t;
if (trc_func && c < 3) {
for (x = 0; x < xsize; x++) {
t.i = bytestream_get_le32(&src);
t.f = trc_func(t.f);
*ptr_x++ = t;
}
} else {
for (x = 0; x < xsize; x++) {
t.i = bytestream_get_le32(&src);
if (t.f > 0.0f && c < 3) /* avoid negative values */
t.f = powf(t.f, one_gamma);
*ptr_x++ = t;
}
}
} else if (s->pixel_type == EXR_HALF) {
// 16-bit
if (c < 3 || !trc_func) {
for (x = 0; x < xsize; x++) {
*ptr_x++ = s->gamma_table[bytestream_get_le16(&src)];
}
} else {
for (x = 0; x < xsize; x++) {
*ptr_x++ = exr_half2float(bytestream_get_le16(&src));;
}
}
}
// Zero out the end if xmax+1 is not w
memset(ptr_x, 0, axmax);
channel_buffer[c] += td->channel_line_size;
}
}
} else {
av_assert1(s->pixel_type == EXR_UINT);
ptr = p->data[0] + window_ymin * p->linesize[0] + (window_xmin * s->desc->nb_components * 2);
for (i = 0; i < ysize; i++, ptr += p->linesize[0]) {
const uint8_t * a;
const uint8_t *rgb[3];
uint16_t *ptr_x;
for (c = 0; c < rgb_channel_count; c++) {
rgb[c] = channel_buffer[c];
}
if (channel_buffer[3])
a = channel_buffer[3];
ptr_x = (uint16_t *) ptr;
// Zero out the start if xmin is not 0
memset(ptr_x, 0, bxmin);
ptr_x += window_xoffset * s->desc->nb_components;
for (x = 0; x < xsize; x++) {
for (c = 0; c < rgb_channel_count; c++) {
*ptr_x++ = bytestream_get_le32(&rgb[c]) >> 16;
}
if (channel_buffer[3])
*ptr_x++ = bytestream_get_le32(&a) >> 16;
}
// Zero out the end if xmax+1 is not w
memset(ptr_x, 0, axmax);
channel_buffer[0] += td->channel_line_size;
channel_buffer[1] += td->channel_line_size;
channel_buffer[2] += td->channel_line_size;
if (channel_buffer[3])
channel_buffer[3] += td->channel_line_size;
}
}
return 0;
}
| 0 |
[
"CWE-787"
] |
FFmpeg
|
b0a8b40294ea212c1938348ff112ef1b9bf16bb3
| 270,772,191,651,297,900,000,000,000,000,000,000,000 | 281 |
avcodec/exr: skip bottom clearing loop when its outside the image
Fixes: signed integer overflow: 1633771809 * 32960 cannot be represented in type 'int'
Fixes: 26532/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_EXR_fuzzer-5613925708857344
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <[email protected]>
|
cdf_read_header(const cdf_info_t *info, cdf_header_t *h)
{
char buf[512];
(void)memcpy(cdf_bo.s, "\01\02\03\04", 4);
if (cdf_read(info, (off_t)0, buf, sizeof(buf)) == -1)
return -1;
cdf_unpack_header(h, buf);
cdf_swap_header(h);
if (h->h_magic != CDF_MAGIC) {
DPRINTF(("Bad magic 0x%" INT64_T_FORMAT "x != 0x%"
INT64_T_FORMAT "x\n",
(unsigned long long)h->h_magic,
(unsigned long long)CDF_MAGIC));
goto out;
}
if (h->h_sec_size_p2 > 20) {
DPRINTF(("Bad sector size 0x%u\n", h->h_sec_size_p2));
goto out;
}
if (h->h_short_sec_size_p2 > 20) {
DPRINTF(("Bad short sector size 0x%u\n",
h->h_short_sec_size_p2));
goto out;
}
return 0;
out:
errno = EFTYPE;
return -1;
}
| 0 |
[
"CWE-119"
] |
file
|
1859fdb4e67c49c463c4e0078054335cd46ba295
| 206,513,663,757,675,700,000,000,000,000,000,000,000 | 30 |
add more check found by cert's fuzzer.
|
static int do_memory_failure(struct mce *m)
{
int flags = MF_ACTION_REQUIRED;
int ret;
pr_err("Uncorrected hardware memory error in user-access at %llx", m->addr);
if (!(m->mcgstatus & MCG_STATUS_RIPV))
flags |= MF_MUST_KILL;
ret = memory_failure(m->addr >> PAGE_SHIFT, flags);
if (ret)
pr_err("Memory error not recovered");
else
mce_unmap_kpfn(m->addr >> PAGE_SHIFT);
return ret;
}
| 0 |
[
"CWE-362"
] |
linux
|
b3b7c4795ccab5be71f080774c45bbbcc75c2aaf
| 216,043,296,528,614,740,000,000,000,000,000,000,000 | 15 |
x86/MCE: Serialize sysfs changes
The check_interval file in
/sys/devices/system/machinecheck/machinecheck<cpu number>
directory is a global timer value for MCE polling. If it is changed by one
CPU, mce_restart() broadcasts the event to other CPUs to delete and restart
the MCE polling timer and __mcheck_cpu_init_timer() reinitializes the
mce_timer variable.
If more than one CPU writes a specific value to the check_interval file
concurrently, mce_timer is not protected from such concurrent accesses and
all kinds of explosions happen. Since only root can write to those sysfs
variables, the issue is not a big deal security-wise.
However, concurrent writes to these configuration variables is void of
reason so the proper thing to do is to serialize the access with a mutex.
Boris:
- Make store_int_with_restart() use device_store_ulong() to filter out
negative intervals
- Limit min interval to 1 second
- Correct locking
- Massage commit message
Signed-off-by: Seunghun Han <[email protected]>
Signed-off-by: Borislav Petkov <[email protected]>
Signed-off-by: Thomas Gleixner <[email protected]>
Cc: Greg Kroah-Hartman <[email protected]>
Cc: Tony Luck <[email protected]>
Cc: linux-edac <[email protected]>
Cc: [email protected]
Link: http://lkml.kernel.org/r/[email protected]
|
finish_writing_to_file_impl(open_file_t *file_data, int abort_write)
{
int r = 0;
tor_assert(file_data && file_data->filename);
if (file_data->stdio_file) {
if (fclose(file_data->stdio_file)) {
log_warn(LD_FS, "Error closing \"%s\": %s", file_data->filename,
strerror(errno));
abort_write = r = -1;
}
} else if (file_data->fd >= 0 && close(file_data->fd) < 0) {
log_warn(LD_FS, "Error flushing \"%s\": %s", file_data->filename,
strerror(errno));
abort_write = r = -1;
}
if (file_data->rename_on_close) {
tor_assert(file_data->tempname && file_data->filename);
if (abort_write) {
unlink(file_data->tempname);
} else {
tor_assert(strcmp(file_data->filename, file_data->tempname));
if (replace_file(file_data->tempname, file_data->filename)) {
log_warn(LD_FS, "Error replacing \"%s\": %s", file_data->filename,
strerror(errno));
r = -1;
}
}
}
tor_free(file_data->filename);
tor_free(file_data->tempname);
tor_free(file_data);
return r;
}
| 0 |
[] |
tor
|
973c18bf0e84d14d8006a9ae97fde7f7fb97e404
| 225,189,842,730,355,740,000,000,000,000,000,000,000 | 36 |
Fix assertion failure in tor_timegm.
Fixes bug 6811.
|
PHP_MINIT_FUNCTION(snmp)
{
netsnmp_log_handler *logh;
zend_class_entry ce, cex;
le_snmp_session = zend_register_list_destructors_ex(php_snmp_session_destructor, NULL, PHP_SNMP_SESSION_RES_NAME, module_number);
init_snmp("snmpapp");
#ifdef NETSNMP_DS_LIB_DONT_PERSIST_STATE
/* Prevent update of the snmpapp.conf file */
netsnmp_ds_set_boolean(NETSNMP_DS_LIBRARY_ID, NETSNMP_DS_LIB_DONT_PERSIST_STATE, 1);
#endif
/* Disable logging, use exit status'es and related variabled to detect errors */
shutdown_snmp_logging();
logh = netsnmp_register_loghandler(NETSNMP_LOGHANDLER_NONE, LOG_ERR);
if (logh) {
logh->pri_max = LOG_ERR;
}
memcpy(&php_snmp_object_handlers, zend_get_std_object_handlers(), sizeof(zend_object_handlers));
php_snmp_object_handlers.read_property = php_snmp_read_property;
php_snmp_object_handlers.write_property = php_snmp_write_property;
php_snmp_object_handlers.has_property = php_snmp_has_property;
php_snmp_object_handlers.get_properties = php_snmp_get_properties;
/* Register SNMP Class */
INIT_CLASS_ENTRY(ce, "SNMP", php_snmp_class_methods);
ce.create_object = php_snmp_object_new;
php_snmp_object_handlers.offset = XtOffsetOf(php_snmp_object, zo);
php_snmp_object_handlers.clone_obj = NULL;
php_snmp_object_handlers.free_obj = php_snmp_object_free_storage;
php_snmp_ce = zend_register_internal_class(&ce);
/* Register SNMP Class properties */
zend_hash_init(&php_snmp_properties, 0, NULL, free_php_snmp_properties, 1);
PHP_SNMP_ADD_PROPERTIES(&php_snmp_properties, php_snmp_property_entries);
REGISTER_LONG_CONSTANT("SNMP_OID_OUTPUT_SUFFIX", NETSNMP_OID_OUTPUT_SUFFIX, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("SNMP_OID_OUTPUT_MODULE", NETSNMP_OID_OUTPUT_MODULE, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("SNMP_OID_OUTPUT_FULL", NETSNMP_OID_OUTPUT_FULL, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("SNMP_OID_OUTPUT_NUMERIC", NETSNMP_OID_OUTPUT_NUMERIC, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("SNMP_OID_OUTPUT_UCD", NETSNMP_OID_OUTPUT_UCD, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("SNMP_OID_OUTPUT_NONE", NETSNMP_OID_OUTPUT_NONE, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("SNMP_VALUE_LIBRARY", SNMP_VALUE_LIBRARY, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("SNMP_VALUE_PLAIN", SNMP_VALUE_PLAIN, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("SNMP_VALUE_OBJECT", SNMP_VALUE_OBJECT, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("SNMP_BIT_STR", ASN_BIT_STR, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("SNMP_OCTET_STR", ASN_OCTET_STR, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("SNMP_OPAQUE", ASN_OPAQUE, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("SNMP_NULL", ASN_NULL, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("SNMP_OBJECT_ID", ASN_OBJECT_ID, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("SNMP_IPADDRESS", ASN_IPADDRESS, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("SNMP_COUNTER", ASN_GAUGE, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("SNMP_UNSIGNED", ASN_UNSIGNED, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("SNMP_TIMETICKS", ASN_TIMETICKS, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("SNMP_UINTEGER", ASN_UINTEGER, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("SNMP_INTEGER", ASN_INTEGER, CONST_CS | CONST_PERSISTENT);
REGISTER_LONG_CONSTANT("SNMP_COUNTER64", ASN_COUNTER64, CONST_CS | CONST_PERSISTENT);
REGISTER_SNMP_CLASS_CONST_LONG("VERSION_1", SNMP_VERSION_1);
REGISTER_SNMP_CLASS_CONST_LONG("VERSION_2c", SNMP_VERSION_2c);
REGISTER_SNMP_CLASS_CONST_LONG("VERSION_2C", SNMP_VERSION_2c);
REGISTER_SNMP_CLASS_CONST_LONG("VERSION_3", SNMP_VERSION_3);
REGISTER_SNMP_CLASS_CONST_LONG("ERRNO_NOERROR", PHP_SNMP_ERRNO_NOERROR);
REGISTER_SNMP_CLASS_CONST_LONG("ERRNO_ANY", PHP_SNMP_ERRNO_ANY);
REGISTER_SNMP_CLASS_CONST_LONG("ERRNO_GENERIC", PHP_SNMP_ERRNO_GENERIC);
REGISTER_SNMP_CLASS_CONST_LONG("ERRNO_TIMEOUT", PHP_SNMP_ERRNO_TIMEOUT);
REGISTER_SNMP_CLASS_CONST_LONG("ERRNO_ERROR_IN_REPLY", PHP_SNMP_ERRNO_ERROR_IN_REPLY);
REGISTER_SNMP_CLASS_CONST_LONG("ERRNO_OID_NOT_INCREASING", PHP_SNMP_ERRNO_OID_NOT_INCREASING);
REGISTER_SNMP_CLASS_CONST_LONG("ERRNO_OID_PARSING_ERROR", PHP_SNMP_ERRNO_OID_PARSING_ERROR);
REGISTER_SNMP_CLASS_CONST_LONG("ERRNO_MULTIPLE_SET_QUERIES", PHP_SNMP_ERRNO_MULTIPLE_SET_QUERIES);
/* Register SNMPException class */
INIT_CLASS_ENTRY(cex, "SNMPException", NULL);
#ifdef HAVE_SPL
php_snmp_exception_ce = zend_register_internal_class_ex(&cex, spl_ce_RuntimeException);
#else
php_snmp_exception_ce = zend_register_internal_class_ex(&cex, zend_ce_exception);
#endif
return SUCCESS;
}
| 0 |
[
"CWE-20"
] |
php-src
|
6e25966544fb1d2f3d7596e060ce9c9269bbdcf8
| 256,987,834,974,404,740,000,000,000,000,000,000,000 | 87 |
Fixed bug #71704 php_snmp_error() Format String Vulnerability
|
return empty.eval(expression,x,y,z,c);
}
template<typename t>
| 0 |
[
"CWE-125"
] |
CImg
|
10af1e8c1ad2a58a0a3342a856bae63e8f257abb
| 251,119,198,551,874,000,000,000,000,000,000,000,000 | 4 |
Fix other issues in 'CImg<T>::load_bmp()'.
|
static char *get_buf_asm(RCore *core, ut64 from, ut64 addr, RAnalFunction *fcn, bool color) {
int has_color = core->print->flags & R_PRINT_FLAGS_COLOR;
char str[512];
const int size = 12;
ut8 buf[12];
RAsmOp asmop = {0};
char *buf_asm = NULL;
bool asm_varsub = r_config_get_i (core->config, "asm.var.sub");
core->parser->pseudo = r_config_get_i (core->config, "asm.pseudo");
core->parser->relsub = r_config_get_i (core->config, "asm.relsub");
core->parser->localvar_only = r_config_get_i (core->config, "asm.var.subonly");
if (core->parser->relsub) {
core->parser->relsub_addr = from;
}
r_io_read_at (core->io, addr, buf, size);
r_asm_set_pc (core->assembler, addr);
r_asm_disassemble (core->assembler, &asmop, buf, size);
int ba_len = r_strbuf_length (&asmop.buf_asm) + 128;
char *ba = malloc (ba_len);
strcpy (ba, r_strbuf_get (&asmop.buf_asm));
if (asm_varsub) {
r_parse_varsub (core->parser, fcn, addr, asmop.size,
ba, ba, sizeof (asmop.buf_asm));
}
r_parse_filter (core->parser, addr, core->flags,
ba, str, sizeof (str), core->print->big_endian);
r_asm_op_set_asm (&asmop, ba);
free (ba);
if (color && has_color) {
buf_asm = r_print_colorize_opcode (core->print, str,
core->cons->pal.reg, core->cons->pal.num, false, fcn ? fcn->addr : 0);
} else {
buf_asm = r_str_new (str);
}
return buf_asm;
}
| 0 |
[
"CWE-125",
"CWE-787"
] |
radare2
|
a1bc65c3db593530775823d6d7506a457ed95267
| 115,080,630,022,476,230,000,000,000,000,000,000,000 | 37 |
Fix #12375 - Crash in bd+ao (#12382)
|
TEST(OverflowArithmetic, SignedAdditionTests) {
using T = int64_t;
static constexpr auto f = polyAdd;
ASSERT(test<T>(f, 0, kMax<T>, kMax<T>));
ASSERT(test<T>(f, -1, kMax<T>, kMax<T> - 1));
ASSERT(test<T>(f, 1, kMax<T> - 1, kMax<T>));
ASSERT(test<T>(f, 0, kMin<T>, kMin<T>));
ASSERT(test<T>(f, 1, kMin<T>, kMin<T> + 1));
ASSERT(test<T>(f, -1, kMin<T> + 1, kMin<T>));
ASSERT(test<T>(f, kMax<T>, kMin<T>, -1));
ASSERT(test<T>(f, 1, 1, 2));
ASSERT(test<T>(f, -1, -1, -2));
ASSERT(testOflow<T>(f, kMax<T>, 1));
ASSERT(testOflow<T>(f, kMax<T>, kMax<T>));
ASSERT(testOflow<T>(f, kMin<T>, -1));
ASSERT(testOflow<T>(f, kMin<T>, kMin<T>));
}
| 0 |
[
"CWE-190"
] |
mongo
|
21d8699ed6c517b45e1613e20231cd8eba894985
| 291,479,607,840,820,700,000,000,000,000,000,000,000 | 17 |
SERVER-43699 $mod should not overflow for large negative values
|
void resetServerStats(void) {
int j;
server.stat_numcommands = 0;
server.stat_numconnections = 0;
server.stat_expiredkeys = 0;
server.stat_expired_stale_perc = 0;
server.stat_expired_time_cap_reached_count = 0;
server.stat_expire_cycle_time_used = 0;
server.stat_evictedkeys = 0;
server.stat_keyspace_misses = 0;
server.stat_keyspace_hits = 0;
server.stat_active_defrag_hits = 0;
server.stat_active_defrag_misses = 0;
server.stat_active_defrag_key_hits = 0;
server.stat_active_defrag_key_misses = 0;
server.stat_active_defrag_scanned = 0;
server.stat_fork_time = 0;
server.stat_fork_rate = 0;
server.stat_rejected_conn = 0;
server.stat_sync_full = 0;
server.stat_sync_partial_ok = 0;
server.stat_sync_partial_err = 0;
server.stat_io_reads_processed = 0;
server.stat_total_reads_processed = 0;
server.stat_io_writes_processed = 0;
server.stat_total_writes_processed = 0;
for (j = 0; j < STATS_METRIC_COUNT; j++) {
server.inst_metric[j].idx = 0;
server.inst_metric[j].last_sample_time = mstime();
server.inst_metric[j].last_sample_count = 0;
memset(server.inst_metric[j].samples,0,
sizeof(server.inst_metric[j].samples));
}
server.stat_net_input_bytes = 0;
server.stat_net_output_bytes = 0;
server.stat_unexpected_error_replies = 0;
server.aof_delayed_fsync = 0;
}
| 0 |
[
"CWE-770"
] |
redis
|
5674b0057ff2903d43eaff802017eddf37c360f8
| 106,208,575,005,719,400,000,000,000,000,000,000,000 | 39 |
Prevent unauthenticated client from easily consuming lots of memory (CVE-2021-32675)
This change sets a low limit for multibulk and bulk length in the
protocol for unauthenticated connections, so that they can't easily
cause redis to allocate massive amounts of memory by sending just a few
characters on the network.
The new limits are 10 arguments of 16kb each (instead of 1m of 512mb)
|
BOOL security_fips_decrypt(BYTE* data, size_t length, rdpRdp* rdp)
{
size_t olen;
if (!rdp || !rdp->fips_decrypt)
return FALSE;
if (!winpr_Cipher_Update(rdp->fips_decrypt, data, length, data, &olen))
return FALSE;
return TRUE;
}
| 0 |
[
"CWE-125",
"CWE-787"
] |
FreeRDP
|
d6cd14059b257318f176c0ba3ee0a348826a9ef8
| 147,502,996,667,298,540,000,000,000,000,000,000,000 | 12 |
Fixed GHSL-2020-101 missing NULL check
(cherry picked from commit b207dbba35c505bbc3ad5aadc10b34980c6b7e8e)
|
ZEND_API int zend_set_local_var(zend_string *name, zval *value, int force) /* {{{ */
{
zend_execute_data *execute_data = EG(current_execute_data);
while (execute_data && (!execute_data->func || !ZEND_USER_CODE(execute_data->func->common.type))) {
execute_data = execute_data->prev_execute_data;
}
if (execute_data) {
if (!execute_data->symbol_table) {
zend_ulong h = zend_string_hash_val(name);
zend_op_array *op_array = &execute_data->func->op_array;
if (EXPECTED(op_array->last_var)) {
zend_string **str = op_array->vars;
zend_string **end = str + op_array->last_var;
do {
if (ZSTR_H(*str) == h &&
ZSTR_LEN(*str) == ZSTR_LEN(name) &&
memcmp(ZSTR_VAL(*str), ZSTR_VAL(name), ZSTR_LEN(name)) == 0) {
zval *var = EX_VAR_NUM(str - op_array->vars);
ZVAL_COPY_VALUE(var, value);
return SUCCESS;
}
str++;
} while (str != end);
}
if (force) {
zend_array *symbol_table = zend_rebuild_symbol_table();
if (symbol_table) {
return zend_hash_update(symbol_table, name, value) ? SUCCESS : FAILURE;;
}
}
} else {
return (zend_hash_update_ind(execute_data->symbol_table, name, value) != NULL) ? SUCCESS : FAILURE;
}
}
return FAILURE;
}
| 0 |
[
"CWE-134"
] |
php-src
|
b101a6bbd4f2181c360bd38e7683df4a03cba83e
| 240,182,214,257,191,400,000,000,000,000,000,000,000 | 40 |
Use format string
|
PHPAPI char *php_pcre_replace(char *regex, int regex_len,
char *subject, int subject_len,
zval *replace_val, int is_callable_replace,
int *result_len, int limit, int *replace_count TSRMLS_DC)
{
pcre_cache_entry *pce; /* Compiled regular expression */
/* Compile regex or get it from cache. */
if ((pce = pcre_get_compiled_regex_cache(regex, regex_len TSRMLS_CC)) == NULL) {
return NULL;
}
return php_pcre_replace_impl(pce, subject, subject_len, replace_val,
is_callable_replace, result_len, limit, replace_count TSRMLS_CC);
}
| 1 |
[] |
php-src
|
03964892c054d0c736414c10b3edc7a40318b975
| 72,942,431,786,513,610,000,000,000,000,000,000,000 | 15 |
Fix bug #70345 (Multiple vulnerabilities related to PCRE functions)
|
unescape_gstring_inplace (GMarkupParseContext *context,
GString *string,
gboolean *is_ascii,
GError **error)
{
char mask, *to;
const char *from;
gboolean normalize_attribute;
*is_ascii = FALSE;
/* are we unescaping an attribute or not ? */
if (context->state == STATE_INSIDE_ATTRIBUTE_VALUE_SQ ||
context->state == STATE_INSIDE_ATTRIBUTE_VALUE_DQ)
normalize_attribute = TRUE;
else
normalize_attribute = FALSE;
/*
* Meeks' theorem: unescaping can only shrink text.
* for < etc. this is obvious, for  more
* thought is required, but this is patently so.
*/
mask = 0;
for (from = to = string->str; *from != '\0'; from++, to++)
{
*to = *from;
mask |= *to;
if (normalize_attribute && (*to == '\t' || *to == '\n'))
*to = ' ';
if (*to == '\r')
{
*to = normalize_attribute ? ' ' : '\n';
if (from[1] == '\n')
from++;
}
if (*from == '&')
{
from++;
if (*from == '#')
{
gint base = 10;
gulong l;
gchar *end = NULL;
from++;
if (*from == 'x')
{
base = 16;
from++;
}
errno = 0;
l = strtoul (from, &end, base);
if (end == from || errno != 0)
{
set_unescape_error (context, error,
from, G_MARKUP_ERROR_PARSE,
_("Failed to parse “%-.*s”, which "
"should have been a digit "
"inside a character reference "
"(ê for example) — perhaps "
"the digit is too large"),
(int)(end - from), from);
return FALSE;
}
else if (*end != ';')
{
set_unescape_error (context, error,
from, G_MARKUP_ERROR_PARSE,
_("Character reference did not end with a "
"semicolon; "
"most likely you used an ampersand "
"character without intending to start "
"an entity — escape ampersand as &"));
return FALSE;
}
else
{
/* characters XML 1.1 permits */
if ((0 < l && l <= 0xD7FF) ||
(0xE000 <= l && l <= 0xFFFD) ||
(0x10000 <= l && l <= 0x10FFFF))
{
gchar buf[8];
char_str (l, buf);
strcpy (to, buf);
to += strlen (buf) - 1;
from = end;
if (l >= 0x80) /* not ascii */
mask |= 0x80;
}
else
{
set_unescape_error (context, error,
from, G_MARKUP_ERROR_PARSE,
_("Character reference “%-.*s” does not "
"encode a permitted character"),
(int)(end - from), from);
return FALSE;
}
}
}
else if (strncmp (from, "lt;", 3) == 0)
{
*to = '<';
from += 2;
}
else if (strncmp (from, "gt;", 3) == 0)
{
*to = '>';
from += 2;
}
else if (strncmp (from, "amp;", 4) == 0)
{
*to = '&';
from += 3;
}
else if (strncmp (from, "quot;", 5) == 0)
{
*to = '"';
from += 4;
}
else if (strncmp (from, "apos;", 5) == 0)
{
*to = '\'';
from += 4;
}
else
{
if (*from == ';')
set_unescape_error (context, error,
from, G_MARKUP_ERROR_PARSE,
_("Empty entity “&;” seen; valid "
"entities are: & " < > '"));
else
{
const char *end = strchr (from, ';');
if (end)
set_unescape_error (context, error,
from, G_MARKUP_ERROR_PARSE,
_("Entity name “%-.*s” is not known"),
(int)(end - from), from);
else
set_unescape_error (context, error,
from, G_MARKUP_ERROR_PARSE,
_("Entity did not end with a semicolon; "
"most likely you used an ampersand "
"character without intending to start "
"an entity — escape ampersand as &"));
}
return FALSE;
}
}
}
g_assert (to - string->str <= string->len);
if (to - string->str != string->len)
g_string_truncate (string, to - string->str);
*is_ascii = !(mask & 0x80);
return TRUE;
}
| 0 |
[
"CWE-476"
] |
glib
|
fccef3cc822af74699cca84cd202719ae61ca3b9
| 139,281,316,765,987,540,000,000,000,000,000,000,000 | 168 |
gmarkup: Fix crash in error handling path for closing elements
If something which looks like a closing tag is left unfinished, but
isn’t paired to an opening tag in the document, the error handling code
would do a null pointer dereference. Avoid that, at the cost of
introducing a new translatable error message.
Includes a test case, courtesy of pdknsk.
Signed-off-by: Philip Withnall <[email protected]>
https://gitlab.gnome.org/GNOME/glib/issues/1461
|
struct winsdb_addr *winsdb_addr_list_check(struct winsdb_addr **addresses, const char *address)
{
size_t i;
for (i=0; addresses[i]; i++) {
if (strcmp(addresses[i]->address, address) == 0) {
return addresses[i];
}
}
return NULL;
}
| 0 |
[
"CWE-200"
] |
samba
|
0a3aa5f908e351201dc9c4d4807b09ed9eedff77
| 197,906,917,113,556,200,000,000,000,000,000,000,000 | 12 |
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 <[email protected]>
|
piv_check_protected_objects(sc_card_t *card)
{
int r = 0;
int i;
piv_private_data_t * priv = PIV_DATA(card);
u8 buf[8]; /* tag of 53 with 82 xx xx will fit in 4 */
u8 * rbuf;
size_t buf_len;
static int protected_objects[] = {PIV_OBJ_PI, PIV_OBJ_CHF, PIV_OBJ_IRIS_IMAGE};
LOG_FUNC_CALLED(card->ctx);
/*
* routine only called from piv_pin_cmd after verify lc=0 did not return 90 00
* We will test for a protected object using GET DATA.
*
* Based on observations, of cards using the GET DATA APDU,
* SC_ERROR_SECURITY_STATUS_NOT_SATISFIED means the PIN not verified,
* SC_SUCCESS means PIN has been verified even if it has length 0
* SC_ERROR_FILE_NOT_FOUND (which is the bug) does not tell us anything
* about the state of the PIN and we will try the next object.
*
* If we can't determine the security state from this process,
* set card_issues CI_CANT_USE_GETDATA_FOR_STATE
* and return SC_ERROR_PIN_CODE_INCORRECT
* The circumvention is to add a dummy Printed Info object in the card.
* so we will have an object to test.
*
* We save the object's number to use in the future.
*
*/
if (priv->object_test_verify == 0) {
for (i = 0; i < (int)(sizeof(protected_objects)/sizeof(int)); i++) {
buf_len = sizeof(buf);
rbuf = buf;
r = piv_get_data(card, protected_objects[i], &rbuf, &buf_len);
/* TODO may need to check sw1 and sw2 to see what really happened */
if (r >= 0 || r == SC_ERROR_SECURITY_STATUS_NOT_SATISFIED) {
/* we can use this object next time if needed */
priv->object_test_verify = protected_objects[i];
break;
}
}
if (priv->object_test_verify == 0) {
/*
* none of the objects returned acceptable sw1, sw2
*/
sc_log(card->ctx, "No protected objects found, setting CI_CANT_USE_GETDATA_FOR_STATE");
priv->card_issues |= CI_CANT_USE_GETDATA_FOR_STATE;
r = SC_ERROR_PIN_CODE_INCORRECT;
}
} else {
/* use the one object we found earlier. Test is security status has changed */
buf_len = sizeof(buf);
rbuf = buf;
r = piv_get_data(card, priv->object_test_verify, &rbuf, &buf_len);
}
if (r == SC_ERROR_FILE_NOT_FOUND)
r = SC_ERROR_PIN_CODE_INCORRECT;
else if (r == SC_ERROR_SECURITY_STATUS_NOT_SATISFIED)
r = SC_ERROR_PIN_CODE_INCORRECT;
else if (r > 0)
r = SC_SUCCESS;
sc_log(card->ctx, "object_test_verify=%d, card_issues = 0x%08x", priv->object_test_verify, priv->card_issues);
LOG_FUNC_RETURN(card->ctx, r);
}
| 0 |
[] |
OpenSC
|
456ac566938a1da774db06126a2fa6c0cba514b3
| 227,551,257,909,866,450,000,000,000,000,000,000,000 | 67 |
PIV Improved parsing of data from the card
Based on Fuzz testing, many of the calls to sc_asn1_find_tag were replaced
with sc_asn1_read_tag. The input is also tested that the
expected tag is the first byte. Additional tests are also add.
sc_asn1_find_tag will skip 0X00 or 0Xff if found. NIST sp800-73-x specs
do not allow these extra bytes.
On branch PIV-improved-parsing
Changes to be committed:
modified: card-piv.c
|
void Tag::Clear() {
while (simple_tags_count_ > 0) {
SimpleTag& st = simple_tags_[--simple_tags_count_];
st.Clear();
}
delete[] simple_tags_;
simple_tags_ = NULL;
simple_tags_size_ = 0;
}
| 0 |
[
"CWE-20"
] |
libvpx
|
f00890eecdf8365ea125ac16769a83aa6b68792d
| 21,670,663,148,359,724,000,000,000,000,000,000,000 | 11 |
update libwebm to libwebm-1.0.0.27-352-g6ab9fcf
https://chromium.googlesource.com/webm/libwebm/+log/af81f26..6ab9fcf
Change-Id: I9d56e1fbaba9b96404b4fbabefddc1a85b79c25d
|
vmxnet3_dump_virt_hdr(struct virtio_net_hdr *vhdr)
{
VMW_PKPRN("VHDR: flags 0x%x, gso_type: 0x%x, hdr_len: %d, gso_size: %d, "
"csum_start: %d, csum_offset: %d",
vhdr->flags, vhdr->gso_type, vhdr->hdr_len, vhdr->gso_size,
vhdr->csum_start, vhdr->csum_offset);
}
| 0 |
[
"CWE-20"
] |
qemu
|
a7278b36fcab9af469563bd7b9dadebe2ae25e48
| 147,603,669,294,927,770,000,000,000,000,000,000,000 | 7 |
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 <[email protected]>
Signed-off-by: Shmulik Ladkani <[email protected]>
Signed-off-by: Jason Wang <[email protected]>
|
int vm_sockets_get_local_cid(void)
{
return transport->get_local_cid();
}
| 0 |
[
"CWE-20",
"CWE-269"
] |
linux
|
f3d3342602f8bcbf37d7c46641cb9bca7618eb1c
| 310,854,214,844,617,600,000,000,000,000,000,000,000 | 4 |
net: rework recvmsg handler msg_name and msg_namelen logic
This patch now always passes msg->msg_namelen as 0. recvmsg handlers must
set msg_namelen to the proper size <= sizeof(struct sockaddr_storage)
to return msg_name to the user.
This prevents numerous uninitialized memory leaks we had in the
recvmsg handlers and makes it harder for new code to accidentally leak
uninitialized memory.
Optimize for the case recvfrom is called with NULL as address. We don't
need to copy the address at all, so set it to NULL before invoking the
recvmsg handler. We can do so, because all the recvmsg handlers must
cope with the case a plain read() is called on them. read() also sets
msg_name to NULL.
Also document these changes in include/linux/net.h as suggested by David
Miller.
Changes since RFC:
Set msg->msg_name = NULL if user specified a NULL in msg_name but had a
non-null msg_namelen in verify_iovec/verify_compat_iovec. This doesn't
affect sendto as it would bail out earlier while trying to copy-in the
address. It also more naturally reflects the logic by the callers of
verify_iovec.
With this change in place I could remove "
if (!uaddr || msg_sys->msg_namelen == 0)
msg->msg_name = NULL
".
This change does not alter the user visible error logic as we ignore
msg_namelen as long as msg_name is NULL.
Also remove two unnecessary curly brackets in ___sys_recvmsg and change
comments to netdev style.
Cc: David Miller <[email protected]>
Suggested-by: Eric Dumazet <[email protected]>
Signed-off-by: Hannes Frederic Sowa <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
|
host_in_pool_p (hostinfo_t hi, int tblidx)
{
int i, pidx;
for (i = 0; i < hi->pool_len && (pidx = hi->pool[i]) != -1; i++)
if (pidx == tblidx && hosttable[pidx])
return 1;
return 0;
}
| 0 |
[
"CWE-352"
] |
gnupg
|
4a4bb874f63741026bd26264c43bb32b1099f060
| 300,779,817,388,299,300,000,000,000,000,000,000,000 | 9 |
dirmngr: Avoid possible CSRF attacks via http redirects.
* dirmngr/http.h (parsed_uri_s): Add fields off_host and off_path.
(http_redir_info_t): New.
* dirmngr/http.c (do_parse_uri): Set new fields.
(same_host_p): New.
(http_prepare_redirect): New.
* dirmngr/t-http-basic.c: New test.
* dirmngr/ks-engine-hkp.c (send_request): Use http_prepare_redirect
instead of the open code.
* dirmngr/ks-engine-http.c (ks_http_fetch): Ditto.
--
With this change a http query will not follow a redirect unless the
Location header gives the same host. If the host is different only
the host and port is taken from the Location header and the original
path and query parts are kept.
Signed-off-by: Werner Koch <[email protected]>
(cherry picked from commit fa1b1eaa4241ff3f0634c8bdf8591cbc7c464144)
|
Field_str::Field_str(uchar *ptr_arg,uint32 len_arg, uchar *null_ptr_arg,
uchar null_bit_arg, utype unireg_check_arg,
const char *field_name_arg, CHARSET_INFO *charset_arg)
:Field(ptr_arg, len_arg, null_ptr_arg, null_bit_arg,
unireg_check_arg, field_name_arg)
{
field_charset= charset_arg;
if (charset_arg->state & MY_CS_BINSORT)
flags|=BINARY_FLAG;
field_derivation= DERIVATION_IMPLICIT;
field_repertoire= my_charset_repertoire(charset_arg);
}
| 0 |
[
"CWE-120"
] |
server
|
eca207c46293bc72dd8d0d5622153fab4d3fccf1
| 274,096,335,771,905,400,000,000,000,000,000,000,000 | 12 |
MDEV-25317 Assertion `scale <= precision' failed in decimal_bin_size And Assertion `scale >= 0 && precision > 0 && scale <= precision' failed in decimal_bin_size_inline/decimal_bin_size.
Precision should be kept below DECIMAL_MAX_SCALE for computations.
It can be bigger in Item_decimal. I'd fix this too but it changes the
existing behaviour so problemmatic to ix.
|
int fuse_write_inode(struct inode *inode, struct writeback_control *wbc)
{
struct fuse_conn *fc = get_fuse_conn(inode);
struct fuse_inode *fi = get_fuse_inode(inode);
struct fuse_file *ff;
int err;
ff = __fuse_write_file_get(fc, fi);
err = fuse_flush_times(inode, ff);
if (ff)
fuse_file_put(ff, 0);
return err;
}
| 0 |
[
"CWE-399",
"CWE-835"
] |
linux
|
3ca8138f014a913f98e6ef40e939868e1e9ea876
| 206,724,428,384,064,760,000,000,000,000,000,000,000 | 14 |
fuse: break infinite loop in fuse_fill_write_pages()
I got a report about unkillable task eating CPU. Further
investigation shows, that the problem is in the fuse_fill_write_pages()
function. If iov's first segment has zero length, we get an infinite
loop, because we never reach iov_iter_advance() call.
Fix this by calling iov_iter_advance() before repeating an attempt to
copy data from userspace.
A similar problem is described in 124d3b7041f ("fix writev regression:
pan hanging unkillable and un-straceable"). If zero-length segmend
is followed by segment with invalid address,
iov_iter_fault_in_readable() checks only first segment (zero-length),
iov_iter_copy_from_user_atomic() skips it, fails at second and
returns zero -> goto again without skipping zero-length segment.
Patch calls iov_iter_advance() before goto again: we'll skip zero-length
segment at second iteraction and iov_iter_fault_in_readable() will detect
invalid address.
Special thanks to Konstantin Khlebnikov, who helped a lot with the commit
description.
Cc: Andrew Morton <[email protected]>
Cc: Maxim Patlasov <[email protected]>
Cc: Konstantin Khlebnikov <[email protected]>
Signed-off-by: Roman Gushchin <[email protected]>
Signed-off-by: Miklos Szeredi <[email protected]>
Fixes: ea9b9907b82a ("fuse: implement perform_write")
Cc: <[email protected]>
|
void ldb_req_mark_trusted(struct ldb_request *req)
{
req->handle->flags &= ~LDB_HANDLE_FLAG_UNTRUSTED;
}
| 0 |
[
"CWE-476"
] |
samba
|
d8b9bb274b7e7a390cf3bda9cd732cb2227bdbde
| 11,304,316,170,892,243,000,000,000,000,000,000,000 | 4 |
CVE-2020-10730: lib ldb: Check if ldb_lock_backend_callback called twice
Prevent use after free issues if ldb_lock_backend_callback is called
twice, usually due to ldb_module_done being called twice. This can happen if a
module ignores the return value from function a function that calls
ldb_module_done as part of it's error handling.
BUG: https://bugzilla.samba.org/show_bug.cgi?id=14364
Signed-off-by: Gary Lockyer <[email protected]>
Reviewed-by: Andrew Bartlett <[email protected]>
|
decode_bitmap4(struct xdr_stream *xdr, uint32_t *bitmap, size_t sz)
{
ssize_t ret;
ret = xdr_stream_decode_uint32_array(xdr, bitmap, sz);
if (likely(ret >= 0))
return ret;
if (ret != -EMSGSIZE)
return -EIO;
return sz;
}
| 0 |
[
"CWE-787"
] |
linux
|
b4487b93545214a9db8cbf32e86411677b0cca21
| 308,792,670,737,333,100,000,000,000,000,000,000,000 | 11 |
nfs: Fix getxattr kernel panic and memory overflow
Move the buffer size check to decode_attr_security_label() before memcpy()
Only call memcpy() if the buffer is large enough
Fixes: aa9c2669626c ("NFS: Client implementation of Labeled-NFS")
Signed-off-by: Jeffrey Mitchell <[email protected]>
[Trond: clean up duplicate test of label->len != 0]
Signed-off-by: Trond Myklebust <[email protected]>
|
STATIC void
S_parse_lparen_question_flags(pTHX_ RExC_state_t *pRExC_state)
{
/* This parses the flags that are in either the '(?foo)' or '(?foo:bar)'
* constructs, and updates RExC_flags with them. On input, RExC_parse
* should point to the first flag; it is updated on output to point to the
* final ')' or ':'. There needs to be at least one flag, or this will
* abort */
/* for (?g), (?gc), and (?o) warnings; warning
about (?c) will warn about (?g) -- japhy */
#define WASTED_O 0x01
#define WASTED_G 0x02
#define WASTED_C 0x04
#define WASTED_GC (WASTED_G|WASTED_C)
I32 wastedflags = 0x00;
U32 posflags = 0, negflags = 0;
U32 *flagsp = &posflags;
char has_charset_modifier = '\0';
regex_charset cs;
bool has_use_defaults = FALSE;
const char* const seqstart = RExC_parse - 1; /* Point to the '?' */
int x_mod_count = 0;
PERL_ARGS_ASSERT_PARSE_LPAREN_QUESTION_FLAGS;
/* '^' as an initial flag sets certain defaults */
if (UCHARAT(RExC_parse) == '^') {
RExC_parse++;
has_use_defaults = TRUE;
STD_PMMOD_FLAGS_CLEAR(&RExC_flags);
cs = (RExC_uni_semantics)
? REGEX_UNICODE_CHARSET
: REGEX_DEPENDS_CHARSET;
set_regex_charset(&RExC_flags, cs);
}
else {
cs = get_regex_charset(RExC_flags);
if ( cs == REGEX_DEPENDS_CHARSET
&& RExC_uni_semantics)
{
cs = REGEX_UNICODE_CHARSET;
}
}
while (RExC_parse < RExC_end) {
/* && strchr("iogcmsx", *RExC_parse) */
/* (?g), (?gc) and (?o) are useless here
and must be globally applied -- japhy */
switch (*RExC_parse) {
/* Code for the imsxn flags */
CASE_STD_PMMOD_FLAGS_PARSE_SET(flagsp, x_mod_count);
case LOCALE_PAT_MOD:
if (has_charset_modifier) {
goto excess_modifier;
}
else if (flagsp == &negflags) {
goto neg_modifier;
}
cs = REGEX_LOCALE_CHARSET;
has_charset_modifier = LOCALE_PAT_MOD;
break;
case UNICODE_PAT_MOD:
if (has_charset_modifier) {
goto excess_modifier;
}
else if (flagsp == &negflags) {
goto neg_modifier;
}
cs = REGEX_UNICODE_CHARSET;
has_charset_modifier = UNICODE_PAT_MOD;
break;
case ASCII_RESTRICT_PAT_MOD:
if (flagsp == &negflags) {
goto neg_modifier;
}
if (has_charset_modifier) {
if (cs != REGEX_ASCII_RESTRICTED_CHARSET) {
goto excess_modifier;
}
/* Doubled modifier implies more restricted */
cs = REGEX_ASCII_MORE_RESTRICTED_CHARSET;
}
else {
cs = REGEX_ASCII_RESTRICTED_CHARSET;
}
has_charset_modifier = ASCII_RESTRICT_PAT_MOD;
break;
case DEPENDS_PAT_MOD:
if (has_use_defaults) {
goto fail_modifiers;
}
else if (flagsp == &negflags) {
goto neg_modifier;
}
else if (has_charset_modifier) {
goto excess_modifier;
}
/* The dual charset means unicode semantics if the
* pattern (or target, not known until runtime) are
* utf8, or something in the pattern indicates unicode
* semantics */
cs = (RExC_uni_semantics)
? REGEX_UNICODE_CHARSET
: REGEX_DEPENDS_CHARSET;
has_charset_modifier = DEPENDS_PAT_MOD;
break;
excess_modifier:
RExC_parse++;
if (has_charset_modifier == ASCII_RESTRICT_PAT_MOD) {
vFAIL2("Regexp modifier \"%c\" may appear a maximum of twice", ASCII_RESTRICT_PAT_MOD);
}
else if (has_charset_modifier == *(RExC_parse - 1)) {
vFAIL2("Regexp modifier \"%c\" may not appear twice",
*(RExC_parse - 1));
}
else {
vFAIL3("Regexp modifiers \"%c\" and \"%c\" are mutually exclusive", has_charset_modifier, *(RExC_parse - 1));
}
NOT_REACHED; /*NOTREACHED*/
neg_modifier:
RExC_parse++;
vFAIL2("Regexp modifier \"%c\" may not appear after the \"-\"",
*(RExC_parse - 1));
NOT_REACHED; /*NOTREACHED*/
case ONCE_PAT_MOD: /* 'o' */
case GLOBAL_PAT_MOD: /* 'g' */
if (ckWARN(WARN_REGEXP)) {
const I32 wflagbit = *RExC_parse == 'o'
? WASTED_O
: WASTED_G;
if (! (wastedflags & wflagbit) ) {
wastedflags |= wflagbit;
/* diag_listed_as: Useless (?-%s) - don't use /%s modifier in regex; marked by <-- HERE in m/%s/ */
vWARN5(
RExC_parse + 1,
"Useless (%s%c) - %suse /%c modifier",
flagsp == &negflags ? "?-" : "?",
*RExC_parse,
flagsp == &negflags ? "don't " : "",
*RExC_parse
);
}
}
break;
case CONTINUE_PAT_MOD: /* 'c' */
if (ckWARN(WARN_REGEXP)) {
if (! (wastedflags & WASTED_C) ) {
wastedflags |= WASTED_GC;
/* diag_listed_as: Useless (?-%s) - don't use /%s modifier in regex; marked by <-- HERE in m/%s/ */
vWARN3(
RExC_parse + 1,
"Useless (%sc) - %suse /gc modifier",
flagsp == &negflags ? "?-" : "?",
flagsp == &negflags ? "don't " : ""
);
}
}
break;
case KEEPCOPY_PAT_MOD: /* 'p' */
if (flagsp == &negflags) {
ckWARNreg(RExC_parse + 1,"Useless use of (?-p)");
} else {
*flagsp |= RXf_PMf_KEEPCOPY;
}
break;
case '-':
/* A flag is a default iff it is following a minus, so
* if there is a minus, it means will be trying to
* re-specify a default which is an error */
if (has_use_defaults || flagsp == &negflags) {
goto fail_modifiers;
}
flagsp = &negflags;
wastedflags = 0; /* reset so (?g-c) warns twice */
x_mod_count = 0;
break;
case ':':
case ')':
if ((posflags & (RXf_PMf_EXTENDED|RXf_PMf_EXTENDED_MORE)) == RXf_PMf_EXTENDED) {
negflags |= RXf_PMf_EXTENDED_MORE;
}
RExC_flags |= posflags;
if (negflags & RXf_PMf_EXTENDED) {
negflags |= RXf_PMf_EXTENDED_MORE;
}
RExC_flags &= ~negflags;
set_regex_charset(&RExC_flags, cs);
return;
default:
fail_modifiers:
RExC_parse += SKIP_IF_CHAR(RExC_parse, RExC_end);
/* diag_listed_as: Sequence (?%s...) not recognized in regex; marked by <-- HERE in m/%s/ */
vFAIL2utf8f("Sequence (%" UTF8f "...) not recognized",
UTF8fARG(UTF, RExC_parse-seqstart, seqstart));
NOT_REACHED; /*NOTREACHED*/
}
RExC_parse += UTF ? UTF8SKIP(RExC_parse) : 1;
}
vFAIL("Sequence (?... not terminated");
| 0 |
[
"CWE-190",
"CWE-787"
] |
perl5
|
897d1f7fd515b828e4b198d8b8bef76c6faf03ed
| 303,574,670,843,358,700,000,000,000,000,000,000,000 | 210 |
regcomp.c: Prevent integer overflow from nested regex quantifiers.
(CVE-2020-10543) On 32bit systems the size calculations for nested regular
expression quantifiers could overflow causing heap memory corruption.
Fixes: Perl/perl5-security#125
(cherry picked from commit bfd31397db5dc1a5c5d3e0a1f753a4f89a736e71)
|
Subsets and Splits
CWE 416 & 19
The query filters records related to specific CWEs (Common Weakness Enumerations), providing a basic overview of entries with these vulnerabilities but without deeper analysis.
CWE Frequency in Train Set
Counts the occurrences of each CWE (Common Weakness Enumeration) in the dataset, providing a basic distribution but limited insight.