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
SPL_METHOD(SplFileInfo, getPath) { spl_filesystem_object *intern = Z_SPLFILESYSTEM_P(getThis()); char *path; size_t path_len; if (zend_parse_parameters_none() == FAILURE) { return; } path = spl_filesystem_object_get_path(intern, &path_len); RETURN_STRINGL(path, path_len); }
0
[ "CWE-74" ]
php-src
a5a15965da23c8e97657278fc8dfbf1dfb20c016
112,737,870,472,478,220,000,000,000,000,000,000,000
13
Fix #78863: DirectoryIterator class silently truncates after a null byte Since the constructor of DirectoryIterator and friends is supposed to accepts paths (i.e. strings without NUL bytes), we must not accept arbitrary strings.
void Item_param::reset() { DBUG_ENTER("Item_param::reset"); /* Shrink string buffer if it's bigger than max possible CHAR column */ if (str_value.alloced_length() > MAX_CHAR_WIDTH) str_value.free(); else str_value.length(0); str_value_ptr.length(0); /* We must prevent all charset conversions until data has been written to the binary log. */ str_value.set_charset(&my_charset_bin); collation.set(&my_charset_bin, DERIVATION_COERCIBLE); state= NO_VALUE; maybe_null= 1; null_value= 0; fixed= false; /* Don't reset item_type to PARAM_ITEM: it's only needed to guard us from item optimizations at prepare stage, when item doesn't yet contain a literal of some kind. In all other cases when this object is accessed its value is set (this assumption is guarded by 'state' and DBUG_ASSERTS(state != NO_VALUE) in all Item_param::get_* methods). */ DBUG_VOID_RETURN; }
0
[ "CWE-89" ]
server
b5e16a6e0381b28b598da80b414168ce9a5016e5
59,223,990,083,194,670,000,000,000,000,000,000,000
30
MDEV-26061 MariaDB server crash at Field::set_default * Item_default_value::fix_fields creates a copy of its argument's field. * Field::default_value is changed when its expression is prepared in unpack_vcol_info_from_frm() This means we must unpack any vcol expression that includes DEFAULT(x) strictly after unpacking x->default_value. To avoid building and solving this dependency graph on every table open, we update Item_default_value::field->default_value after all vcols are unpacked and fixed.
TEST_P(ProtocolIntegrationTest, HeaderAndBodyWireBytesCountReuseUpstream) { // We only care about the upstream protocol. if (downstreamProtocol() != Http::CodecType::HTTP2) { return; } useAccessLog("%UPSTREAM_WIRE_BYTES_SENT% %UPSTREAM_WIRE_BYTES_RECEIVED% " "%UPSTREAM_HEADER_BYTES_SENT% %UPSTREAM_HEADER_BYTES_RECEIVED%"); initialize(); codec_client_ = makeHttpConnection(makeClientConnection(lookupPort("http"))); auto second_client = makeHttpConnection(makeClientConnection(lookupPort("http"))); const int request_size = 100; const int response_size = 100; // Send to the same upstream from the two clients. auto response_one = sendRequestAndWaitForResponse(default_request_headers_, request_size, default_response_headers_, response_size, 0); expectUpstreamBytesSentAndReceived(BytesCountExpectation(298, 158, 156, 27), BytesCountExpectation(223, 122, 114, 13), BytesCountExpectation(223, 108, 114, 3), 0); // Swap clients so the other connection is used to send the request. std::swap(codec_client_, second_client); auto response_two = sendRequestAndWaitForResponse(default_request_headers_, request_size, default_response_headers_, response_size, 0); expectUpstreamBytesSentAndReceived(BytesCountExpectation(298, 158, 156, 27), BytesCountExpectation(167, 119, 58, 10), BytesCountExpectation(114, 108, 11, 3), 1); second_client->close(); }
0
[ "CWE-416" ]
envoy
148de954ed3585d8b4298b424aa24916d0de6136
150,349,321,144,914,000,000,000,000,000,000,000,000
31
CVE-2021-43825 Response filter manager crash Signed-off-by: Yan Avlasov <[email protected]>
int kvm_arch_vcpu_ioctl_get_fpu(struct kvm_vcpu *vcpu, struct kvm_fpu *fpu) { vcpu_load(vcpu); /* make sure we have the latest values */ save_fpu_regs(); if (MACHINE_HAS_VX) convert_vx_to_fp((freg_t *) fpu->fprs, (__vector128 *) vcpu->run->s.regs.vrs); else memcpy(fpu->fprs, vcpu->run->s.regs.fprs, sizeof(fpu->fprs)); fpu->fpc = vcpu->run->s.regs.fpc; vcpu_put(vcpu); return 0; }
0
[ "CWE-416" ]
linux
0774a964ef561b7170d8d1b1bfe6f88002b6d219
163,384,429,405,321,090,000,000,000,000,000,000,000
16
KVM: Fix out of range accesses to memslots Reset the LRU slot if it becomes invalid when deleting a memslot to fix an out-of-bounds/use-after-free access when searching through memslots. Explicitly check for there being no used slots in search_memslots(), and in the caller of s390's approximation variant. Fixes: 36947254e5f9 ("KVM: Dynamically size memslot array based on number of used slots") Reported-by: Qian Cai <[email protected]> Cc: Peter Xu <[email protected]> Signed-off-by: Sean Christopherson <[email protected]> Message-Id: <[email protected]> Acked-by: Christian Borntraeger <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]>
u32tochar (wc, s) wchar_t wc; char *s; { unsigned long x; int l; x = wc; l = (x <= UCHAR_MAX) ? 1 : ((x <= USHORT_MAX) ? 2 : 4); if (x <= UCHAR_MAX) s[0] = x & 0xFF; else if (x <= USHORT_MAX) /* assume unsigned short = 16 bits */ { s[0] = (x >> 8) & 0xFF; s[1] = x & 0xFF; } else { s[0] = (x >> 24) & 0xFF; s[1] = (x >> 16) & 0xFF; s[2] = (x >> 8) & 0xFF; s[3] = x & 0xFF; } s[l] = '\0'; return l; }
1
[]
bash
863d31ae775d56b785dc5b0105b6d251515d81d5
208,772,396,360,100,640,000,000,000,000,000,000,000
27
commit bash-20120224 snapshot
static apr_byte_t oidc_session_pass_tokens_and_save(request_rec *r, oidc_cfg *cfg, oidc_session_t *session, apr_byte_t needs_save) { int pass_headers = oidc_cfg_dir_pass_info_in_headers(r); int pass_envvars = oidc_cfg_dir_pass_info_in_envvars(r); /* set the refresh_token in the app headers/variables, if enabled for this location/directory */ const char *refresh_token = NULL; oidc_session_get(r, session, OIDC_REFRESHTOKEN_SESSION_KEY, &refresh_token); if ((oidc_cfg_dir_pass_refresh_token(r) != 0) && (refresh_token != NULL)) { /* pass it to the app in a header or environment variable */ oidc_util_set_app_info(r, "refresh_token", refresh_token, OIDC_DEFAULT_HEADER_PREFIX, pass_headers, pass_envvars); } /* set the access_token in the app headers/variables */ const char *access_token = NULL; oidc_session_get(r, session, OIDC_ACCESSTOKEN_SESSION_KEY, &access_token); if (access_token != NULL) { /* pass it to the app in a header or environment variable */ oidc_util_set_app_info(r, "access_token", access_token, OIDC_DEFAULT_HEADER_PREFIX, pass_headers, pass_envvars); } /* set the expiry timestamp in the app headers/variables */ const char *access_token_expires = NULL; oidc_session_get(r, session, OIDC_ACCESSTOKEN_EXPIRES_SESSION_KEY, &access_token_expires); if (access_token_expires != NULL) { /* pass it to the app in a header or environment variable */ oidc_util_set_app_info(r, "access_token_expires", access_token_expires, OIDC_DEFAULT_HEADER_PREFIX, pass_headers, pass_envvars); } /* * reset the session inactivity timer * but only do this once per 10% of the inactivity timeout interval (with a max to 60 seconds) * for performance reasons * * now there's a small chance that the session ends 10% (or a minute) earlier than configured/expected * cq. when there's a request after a recent save (so no update) and then no activity happens until * a request comes in just before the session should expire * ("recent" and "just before" refer to 10%-with-a-max-of-60-seconds of the inactivity interval after * the start/last-update and before the expiry of the session respectively) * * this is be deemed acceptable here because of performance gain */ apr_time_t interval = apr_time_from_sec(cfg->session_inactivity_timeout); apr_time_t now = apr_time_now(); apr_time_t slack = interval / 10; if (slack > apr_time_from_sec(60)) slack = apr_time_from_sec(60); if (session->expiry - now < interval - slack) { session->expiry = now + interval; needs_save = TRUE; } /* log message about session expiry */ oidc_log_session_expires(r, "session inactivity timeout", session->expiry); /* check if something was updated in the session and we need to save it again */ if (needs_save) if (oidc_session_save(r, session) == FALSE) return FALSE; return TRUE; }
0
[ "CWE-287" ]
mod_auth_openidc
21e3728a825c41ab41efa75e664108051bb9665e
202,891,029,486,824,100,000,000,000,000,000,000,000
67
release 2.1.6 : security fix: scrub headers for "AuthType oauth20" Signed-off-by: Hans Zandbelt <[email protected]>
rl_translate_keyseq (seq, array, len) const char *seq; char *array; int *len; { register int i, c, l, temp; for (i = l = 0; c = seq[i]; i++) { if (c == '\\') { c = seq[++i]; if (c == 0) break; /* Handle \C- and \M- prefixes. */ if ((c == 'C' || c == 'M') && seq[i + 1] == '-') { /* Handle special case of backwards define. */ if (strncmp (&seq[i], "C-\\M-", 5) == 0) { array[l++] = ESC; /* ESC is meta-prefix */ i += 5; array[l++] = CTRL (_rl_to_upper (seq[i])); if (seq[i] == '\0') i--; } else if (c == 'M') { i++; /* seq[i] == '-' */ /* XXX - obey convert-meta setting */ if (_rl_convert_meta_chars_to_ascii && _rl_keymap[ESC].type == ISKMAP) array[l++] = ESC; /* ESC is meta-prefix */ else if (seq[i+1] == '\\' && seq[i+2] == 'C' && seq[i+3] == '-') { i += 4; temp = (seq[i] == '?') ? RUBOUT : CTRL (_rl_to_upper (seq[i])); array[l++] = META (temp); } else { /* This doesn't yet handle things like \M-\a, which may or may not have any reasonable meaning. You're probably better off using straight octal or hex. */ i++; array[l++] = META (seq[i]); } } else if (c == 'C') { i += 2; /* Special hack for C-?... */ array[l++] = (seq[i] == '?') ? RUBOUT : CTRL (_rl_to_upper (seq[i])); } continue; } /* Translate other backslash-escaped characters. These are the same escape sequences that bash's `echo' and `printf' builtins handle, with the addition of \d -> RUBOUT. A backslash preceding a character that is not special is stripped. */ switch (c) { case 'a': array[l++] = '\007'; break; case 'b': array[l++] = '\b'; break; case 'd': array[l++] = RUBOUT; /* readline-specific */ break; case 'e': array[l++] = ESC; break; case 'f': array[l++] = '\f'; break; case 'n': array[l++] = NEWLINE; break; case 'r': array[l++] = RETURN; break; case 't': array[l++] = TAB; break; case 'v': array[l++] = 0x0B; break; case '\\': array[l++] = '\\'; break; case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': i++; for (temp = 2, c -= '0'; ISOCTAL ((unsigned char)seq[i]) && temp--; i++) c = (c * 8) + OCTVALUE (seq[i]); i--; /* auto-increment in for loop */ array[l++] = c & largest_char; break; case 'x': i++; for (temp = 2, c = 0; ISXDIGIT ((unsigned char)seq[i]) && temp--; i++) c = (c * 16) + HEXVALUE (seq[i]); if (temp == 2) c = 'x'; i--; /* auto-increment in for loop */ array[l++] = c & largest_char; break; default: /* backslashes before non-special chars just add the char */ array[l++] = c; break; /* the backslash is stripped */ } continue; } array[l++] = c; } *len = l; array[l] = '\0'; return (0); }
0
[]
bash
955543877583837c85470f7fb8a97b7aa8d45e6c
276,588,727,664,063,300,000,000,000,000,000,000,000
125
bash-4.4-rc2 release
static int __init init_sys32_ioctl(void) { int i; for (i = 0; i < ioctl_table_size; i++) { if (ioctl_start[i].next != 0) { printk("ioctl translation %d bad\n",i); return -1; } ioctl32_insert_translation(&ioctl_start[i]); } return 0; }
0
[]
linux-2.6
822191a2fa1584a29c3224ab328507adcaeac1ab
43,637,616,046,730,860,000,000,000,000,000,000,000
14
[PATCH] skip data conversion in compat_sys_mount when data_page is NULL OpenVZ Linux kernel team has found a problem with mounting in compat mode. Simple command "mount -t smbfs ..." on Fedora Core 5 distro in 32-bit mode leads to oops: Unable to handle kernel NULL pointer dereference at 0000000000000000 RIP: compat_sys_mount+0xd6/0x290 Process mount (pid: 14656, veid=300, threadinfo ffff810034d30000, task ffff810034c86bc0) Call Trace: ia32_sysret+0x0/0xa The problem is that data_page pointer can be NULL, so we should skip data conversion in this case. Signed-off-by: Andrey Mirkin <[email protected]> Cc: <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
int __sys_socketpair(int family, int type, int protocol, int __user *usockvec) { struct socket *sock1, *sock2; int fd1, fd2, err; struct file *newfile1, *newfile2; int flags; flags = type & ~SOCK_TYPE_MASK; if (flags & ~(SOCK_CLOEXEC | SOCK_NONBLOCK)) return -EINVAL; type &= SOCK_TYPE_MASK; if (SOCK_NONBLOCK != O_NONBLOCK && (flags & SOCK_NONBLOCK)) flags = (flags & ~SOCK_NONBLOCK) | O_NONBLOCK; /* * reserve descriptors and make sure we won't fail * to return them to userland. */ fd1 = get_unused_fd_flags(flags); if (unlikely(fd1 < 0)) return fd1; fd2 = get_unused_fd_flags(flags); if (unlikely(fd2 < 0)) { put_unused_fd(fd1); return fd2; } err = put_user(fd1, &usockvec[0]); if (err) goto out; err = put_user(fd2, &usockvec[1]); if (err) goto out; /* * Obtain the first socket and check if the underlying protocol * supports the socketpair call. */ err = sock_create(family, type, protocol, &sock1); if (unlikely(err < 0)) goto out; err = sock_create(family, type, protocol, &sock2); if (unlikely(err < 0)) { sock_release(sock1); goto out; } err = security_socket_socketpair(sock1, sock2); if (unlikely(err)) { sock_release(sock2); sock_release(sock1); goto out; } err = sock1->ops->socketpair(sock1, sock2); if (unlikely(err < 0)) { sock_release(sock2); sock_release(sock1); goto out; } newfile1 = sock_alloc_file(sock1, flags, NULL); if (IS_ERR(newfile1)) { err = PTR_ERR(newfile1); sock_release(sock2); goto out; } newfile2 = sock_alloc_file(sock2, flags, NULL); if (IS_ERR(newfile2)) { err = PTR_ERR(newfile2); fput(newfile1); goto out; } audit_fd_pair(fd1, fd2); fd_install(fd1, newfile1); fd_install(fd2, newfile2); return 0; out: put_unused_fd(fd2); put_unused_fd(fd1); return err; }
0
[ "CWE-362" ]
linux
6d8c50dcb029872b298eea68cc6209c866fd3e14
311,600,599,136,691,620,000,000,000,000,000,000,000
91
socket: close race condition between sock_close() and sockfs_setattr() fchownat() doesn't even hold refcnt of fd until it figures out fd is really needed (otherwise is ignored) and releases it after it resolves the path. This means sock_close() could race with sockfs_setattr(), which leads to a NULL pointer dereference since typically we set sock->sk to NULL in ->release(). As pointed out by Al, this is unique to sockfs. So we can fix this in socket layer by acquiring inode_lock in sock_close() and checking against NULL in sockfs_setattr(). sock_release() is called in many places, only the sock_close() path matters here. And fortunately, this should not affect normal sock_close() as it is only called when the last fd refcnt is gone. It only affects sock_close() with a parallel sockfs_setattr() in progress, which is not common. Fixes: 86741ec25462 ("net: core: Add a UID field to struct sock.") Reported-by: shankarapailoor <[email protected]> Cc: Tetsuo Handa <[email protected]> Cc: Lorenzo Colitti <[email protected]> Cc: Al Viro <[email protected]> Signed-off-by: Cong Wang <[email protected]> Signed-off-by: David S. Miller <[email protected]>
monitor_child_postauth(struct monitor *pmonitor) { close(pmonitor->m_recvfd); pmonitor->m_recvfd = -1; monitor_set_child_handler(pmonitor->m_pid); signal(SIGHUP, &monitor_child_handler); signal(SIGTERM, &monitor_child_handler); signal(SIGINT, &monitor_child_handler); #ifdef SIGXFSZ signal(SIGXFSZ, SIG_IGN); #endif if (compat20) { mon_dispatch = mon_dispatch_postauth20; /* Permit requests for moduli and signatures */ monitor_permit(mon_dispatch, MONITOR_REQ_MODULI, 1); monitor_permit(mon_dispatch, MONITOR_REQ_SIGN, 1); monitor_permit(mon_dispatch, MONITOR_REQ_TERM, 1); } else { mon_dispatch = mon_dispatch_postauth15; monitor_permit(mon_dispatch, MONITOR_REQ_TERM, 1); } if (!no_pty_flag) { monitor_permit(mon_dispatch, MONITOR_REQ_PTY, 1); monitor_permit(mon_dispatch, MONITOR_REQ_PTYCLEANUP, 1); } for (;;) monitor_read(pmonitor, mon_dispatch, NULL); }
0
[ "CWE-20", "CWE-200" ]
openssh-portable
d4697fe9a28dab7255c60433e4dd23cf7fce8a8b
52,429,805,456,127,080,000,000,000,000,000,000,000
32
Don't resend username to PAM; it already has it. Pointed out by Moritz Jodeit; ok dtucker@
QString Utility::ConvertLineEndings(const QString &text) { QString newtext(text); return newtext.replace("\x0D\x0A", "\x0A").replace("\x0D", "\x0A"); }
0
[ "CWE-22" ]
Sigil
0979ba8d10c96ebca330715bfd4494ea0e019a8f
188,344,026,628,701,160,000,000,000,000,000,000,000
5
harden plugin unzipping to zip-slip attacks
_public_ int sd_bus_open_with_description(sd_bus **ret, const char *description) { const char *e; _cleanup_(bus_freep) sd_bus *b = NULL; int r; assert_return(ret, -EINVAL); /* Let's connect to the starter bus if it is set, and * otherwise to the bus that is appropriate for the scope * we are running in */ e = secure_getenv("DBUS_STARTER_BUS_TYPE"); if (e) { if (streq(e, "system")) return sd_bus_open_system_with_description(ret, description); else if (STR_IN_SET(e, "session", "user")) return sd_bus_open_user_with_description(ret, description); } e = secure_getenv("DBUS_STARTER_ADDRESS"); if (!e) { if (cg_pid_get_owner_uid(0, NULL) >= 0) return sd_bus_open_user_with_description(ret, description); else return sd_bus_open_system_with_description(ret, description); } r = sd_bus_new(&b); if (r < 0) return r; r = sd_bus_set_address(b, e); if (r < 0) return r; b->bus_client = true; /* We don't know whether the bus is trusted or not, so better * be safe, and authenticate everything */ b->trusted = false; b->is_local = false; b->creds_mask |= SD_BUS_CREDS_UID | SD_BUS_CREDS_EUID | SD_BUS_CREDS_EFFECTIVE_CAPS; r = sd_bus_start(b); if (r < 0) return r; *ret = TAKE_PTR(b); return 0; }
0
[ "CWE-416" ]
systemd
1068447e6954dc6ce52f099ed174c442cb89ed54
7,724,856,896,444,203,000,000,000,000,000,000,000
50
sd-bus: introduce API for re-enqueuing incoming messages When authorizing via PolicyKit we want to process incoming method calls twice: once to process and figure out that we need PK authentication, and a second time after we aquired PK authentication to actually execute the operation. With this new call sd_bus_enqueue_for_read() we have a way to put an incoming message back into the read queue for this purpose. This might have other uses too, for example debugging.
int TDStretch::seekBestOverlapPositionFull(const SAMPLETYPE *refPos) { int bestOffs; double bestCorr; int i; double norm; bestCorr = -FLT_MAX; bestOffs = 0; // Scans for the best correlation value by testing each possible position // over the permitted range. bestCorr = calcCrossCorr(refPos, pMidBuffer, norm); bestCorr = (bestCorr + 0.1) * 0.75; #pragma omp parallel for for (i = 1; i < seekLength; i ++) { double corr; // Calculates correlation value for the mixing position corresponding to 'i' #ifdef _OPENMP // in parallel OpenMP mode, can't use norm accumulator version as parallel executor won't // iterate the loop in sequential order corr = calcCrossCorr(refPos + channels * i, pMidBuffer, norm); #else // In non-parallel version call "calcCrossCorrAccumulate" that is otherwise same // as "calcCrossCorr", but saves time by reusing & updating previously stored // "norm" value corr = calcCrossCorrAccumulate(refPos + channels * i, pMidBuffer, norm); #endif // heuristic rule to slightly favour values close to mid of the range double tmp = (double)(2 * i - seekLength) / (double)seekLength; corr = ((corr + 0.1) * (1.0 - 0.25 * tmp * tmp)); // Checks for the highest correlation value if (corr > bestCorr) { // For optimal performance, enter critical section only in case that best value found. // in such case repeat 'if' condition as it's possible that parallel execution may have // updated the bestCorr value in the mean time #pragma omp critical if (corr > bestCorr) { bestCorr = corr; bestOffs = i; } } } #ifdef SOUNDTOUCH_INTEGER_SAMPLES adaptNormalizer(); #endif // clear cross correlation routine state if necessary (is so e.g. in MMX routines). clearCrossCorrState(); return bestOffs; }
0
[ "CWE-617" ]
soundtouch
107f2c5d201a4dfea1b7f15c5957ff2ac9e5f260
194,754,641,762,578,900,000,000,000,000,000,000,000
58
Replaced illegal-number-of-channel assertions with run-time exception
Value ExpressionSubtract::evaluate(const Document& root, Variables* variables) const { Value lhs = _children[0]->evaluate(root, variables); Value rhs = _children[1]->evaluate(root, variables); BSONType diffType = Value::getWidestNumeric(rhs.getType(), lhs.getType()); if (diffType == NumberDecimal) { Decimal128 right = rhs.coerceToDecimal(); Decimal128 left = lhs.coerceToDecimal(); return Value(left.subtract(right)); } else if (diffType == NumberDouble) { double right = rhs.coerceToDouble(); double left = lhs.coerceToDouble(); return Value(left - right); } else if (diffType == NumberLong) { long long right = rhs.coerceToLong(); long long left = lhs.coerceToLong(); return Value(left - right); } else if (diffType == NumberInt) { long long right = rhs.coerceToLong(); long long left = lhs.coerceToLong(); return Value::createIntOrLong(left - right); } else if (lhs.nullish() || rhs.nullish()) { return Value(BSONNULL); } else if (lhs.getType() == Date) { if (rhs.getType() == Date) { return Value(durationCount<Milliseconds>(lhs.getDate() - rhs.getDate())); } else if (rhs.numeric()) { return Value(lhs.getDate() - Milliseconds(rhs.coerceToLong())); } else { uasserted(16613, str::stream() << "cant $subtract a " << typeName(rhs.getType()) << " from a Date"); } } else { uasserted(16556, str::stream() << "cant $subtract a" << typeName(rhs.getType()) << " from a " << typeName(lhs.getType())); } }
0
[]
mongo
1772b9a0393b55e6a280a35e8f0a1f75c014f301
39,404,024,400,022,814,000,000,000,000,000,000,000
40
SERVER-49404 Enforce additional checks in $arrayToObject
virtual void clip(GfxState *state) { }
0
[]
poppler
abf167af8b15e5f3b510275ce619e6fdb42edd40
167,829,536,500,618,240,000,000,000,000,000,000,000
1
Implement tiling/patterns in SplashOutputDev Fixes bug 13518
static int compat_do_ebt_set_ctl(struct sock *sk, int cmd, void __user *user, unsigned int len) { int ret; struct net *net = sock_net(sk); if (!ns_capable(net->user_ns, CAP_NET_ADMIN)) return -EPERM; switch (cmd) { case EBT_SO_SET_ENTRIES: ret = compat_do_replace(net, user, len); break; case EBT_SO_SET_COUNTERS: ret = compat_update_counters(net, user, len); break; default: ret = -EINVAL; } return ret; }
0
[ "CWE-787" ]
linux
b71812168571fa55e44cdd0254471331b9c4c4c6
186,948,825,852,165,770,000,000,000,000,000,000,000
21
netfilter: ebtables: CONFIG_COMPAT: don't trust userland offsets We need to make sure the offsets are not out of range of the total size. Also check that they are in ascending order. The WARN_ON triggered by syzkaller (it sets panic_on_warn) is changed to also bail out, no point in continuing parsing. Briefly tested with simple ruleset of -A INPUT --limit 1/s' --log plus jump to custom chains using 32bit ebtables binary. Reported-by: <[email protected]> Signed-off-by: Florian Westphal <[email protected]> Signed-off-by: Pablo Neira Ayuso <[email protected]>
static int ssl_parse_server_key_exchange( ssl_context *ssl ) { #if defined(POLARSSL_DHM_C) int ret; size_t n; unsigned char *p, *end; unsigned char hash[64]; md5_context md5; sha1_context sha1; int hash_id = SIG_RSA_RAW; unsigned int hashlen = 0; #endif SSL_DEBUG_MSG( 2, ( "=> parse server key exchange" ) ); if( ssl->session_negotiate->ciphersuite != TLS_DHE_RSA_WITH_DES_CBC_SHA && ssl->session_negotiate->ciphersuite != TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA && ssl->session_negotiate->ciphersuite != TLS_DHE_RSA_WITH_AES_128_CBC_SHA && ssl->session_negotiate->ciphersuite != TLS_DHE_RSA_WITH_AES_256_CBC_SHA && ssl->session_negotiate->ciphersuite != TLS_DHE_RSA_WITH_AES_128_CBC_SHA256 && ssl->session_negotiate->ciphersuite != TLS_DHE_RSA_WITH_AES_256_CBC_SHA256 && ssl->session_negotiate->ciphersuite != TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA && ssl->session_negotiate->ciphersuite != TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA && ssl->session_negotiate->ciphersuite != TLS_DHE_RSA_WITH_CAMELLIA_128_CBC_SHA256 && ssl->session_negotiate->ciphersuite != TLS_DHE_RSA_WITH_CAMELLIA_256_CBC_SHA256 && ssl->session_negotiate->ciphersuite != TLS_DHE_RSA_WITH_AES_128_GCM_SHA256 && ssl->session_negotiate->ciphersuite != TLS_DHE_RSA_WITH_AES_256_GCM_SHA384 ) { SSL_DEBUG_MSG( 2, ( "<= skip parse server key exchange" ) ); ssl->state++; return( 0 ); } #if !defined(POLARSSL_DHM_C) SSL_DEBUG_MSG( 1, ( "support for dhm in not available" ) ); return( POLARSSL_ERR_SSL_FEATURE_UNAVAILABLE ); #else if( ( ret = ssl_read_record( ssl ) ) != 0 ) { SSL_DEBUG_RET( 1, "ssl_read_record", ret ); return( ret ); } if( ssl->in_msgtype != SSL_MSG_HANDSHAKE ) { SSL_DEBUG_MSG( 1, ( "bad server key exchange message" ) ); return( POLARSSL_ERR_SSL_UNEXPECTED_MESSAGE ); } if( ssl->in_msg[0] != SSL_HS_SERVER_KEY_EXCHANGE ) { SSL_DEBUG_MSG( 1, ( "bad server key exchange message" ) ); return( POLARSSL_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE ); } SSL_DEBUG_BUF( 3, "server key exchange", ssl->in_msg + 4, ssl->in_hslen - 4 ); /* * Ephemeral DH parameters: * * struct { * opaque dh_p<1..2^16-1>; * opaque dh_g<1..2^16-1>; * opaque dh_Ys<1..2^16-1>; * } ServerDHParams; */ p = ssl->in_msg + 4; end = ssl->in_msg + ssl->in_hslen; if( ( ret = dhm_read_params( &ssl->handshake->dhm_ctx, &p, end ) ) != 0 ) { SSL_DEBUG_MSG( 2, ( "DHM Read Params returned -0x%x", -ret ) ); SSL_DEBUG_MSG( 1, ( "bad server key exchange message" ) ); return( POLARSSL_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE ); } if( ssl->minor_ver == SSL_MINOR_VERSION_3 ) { if( p[1] != SSL_SIG_RSA ) { SSL_DEBUG_MSG( 2, ( "server used unsupported SignatureAlgorithm %d", p[1] ) ); SSL_DEBUG_MSG( 1, ( "bad server key exchange message" ) ); return( POLARSSL_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE ); } switch( p[0] ) { #if defined(POLARSSL_MD5_C) case SSL_HASH_MD5: hash_id = SIG_RSA_MD5; break; #endif #if defined(POLARSSL_SHA1_C) case SSL_HASH_SHA1: hash_id = SIG_RSA_SHA1; break; #endif #if defined(POLARSSL_SHA2_C) case SSL_HASH_SHA224: hash_id = SIG_RSA_SHA224; break; case SSL_HASH_SHA256: hash_id = SIG_RSA_SHA256; break; #endif #if defined(POLARSSL_SHA4_C) case SSL_HASH_SHA384: hash_id = SIG_RSA_SHA384; break; case SSL_HASH_SHA512: hash_id = SIG_RSA_SHA512; break; #endif default: SSL_DEBUG_MSG( 2, ( "Server used unsupported HashAlgorithm %d", p[0] ) ); SSL_DEBUG_MSG( 1, ( "bad server key exchange message" ) ); return( POLARSSL_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE ); } SSL_DEBUG_MSG( 2, ( "Server used SignatureAlgorithm %d", p[1] ) ); SSL_DEBUG_MSG( 2, ( "Server used HashAlgorithm %d", p[0] ) ); p += 2; } n = ( p[0] << 8 ) | p[1]; p += 2; if( end != p + n ) { SSL_DEBUG_MSG( 1, ( "bad server key exchange message" ) ); return( POLARSSL_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE ); } if( (unsigned int)( end - p ) != ssl->session_negotiate->peer_cert->rsa.len ) { SSL_DEBUG_MSG( 1, ( "bad server key exchange message" ) ); return( POLARSSL_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE ); } if( ssl->handshake->dhm_ctx.len < 64 || ssl->handshake->dhm_ctx.len > 512 ) { SSL_DEBUG_MSG( 1, ( "bad server key exchange message" ) ); return( POLARSSL_ERR_SSL_BAD_HS_SERVER_KEY_EXCHANGE ); } SSL_DEBUG_MPI( 3, "DHM: P ", &ssl->handshake->dhm_ctx.P ); SSL_DEBUG_MPI( 3, "DHM: G ", &ssl->handshake->dhm_ctx.G ); SSL_DEBUG_MPI( 3, "DHM: GY", &ssl->handshake->dhm_ctx.GY ); if( ssl->minor_ver != SSL_MINOR_VERSION_3 ) { /* * digitally-signed struct { * opaque md5_hash[16]; * opaque sha_hash[20]; * }; * * md5_hash * MD5(ClientHello.random + ServerHello.random * + ServerParams); * sha_hash * SHA(ClientHello.random + ServerHello.random * + ServerParams); */ n = ssl->in_hslen - ( end - p ) - 6; md5_starts( &md5 ); md5_update( &md5, ssl->handshake->randbytes, 64 ); md5_update( &md5, ssl->in_msg + 4, n ); md5_finish( &md5, hash ); sha1_starts( &sha1 ); sha1_update( &sha1, ssl->handshake->randbytes, 64 ); sha1_update( &sha1, ssl->in_msg + 4, n ); sha1_finish( &sha1, hash + 16 ); hash_id = SIG_RSA_RAW; hashlen = 36; } else { sha2_context sha2; #if defined(POLARSSL_SHA4_C) sha4_context sha4; #endif n = ssl->in_hslen - ( end - p ) - 8; /* * digitally-signed struct { * opaque client_random[32]; * opaque server_random[32]; * ServerDHParams params; * }; */ switch( hash_id ) { #if defined(POLARSSL_MD5_C) case SIG_RSA_MD5: md5_starts( &md5 ); md5_update( &md5, ssl->handshake->randbytes, 64 ); md5_update( &md5, ssl->in_msg + 4, n ); md5_finish( &md5, hash ); hashlen = 16; break; #endif #if defined(POLARSSL_SHA1_C) case SIG_RSA_SHA1: sha1_starts( &sha1 ); sha1_update( &sha1, ssl->handshake->randbytes, 64 ); sha1_update( &sha1, ssl->in_msg + 4, n ); sha1_finish( &sha1, hash ); hashlen = 20; break; #endif #if defined(POLARSSL_SHA2_C) case SIG_RSA_SHA224: sha2_starts( &sha2, 1 ); sha2_update( &sha2, ssl->handshake->randbytes, 64 ); sha2_update( &sha2, ssl->in_msg + 4, n ); sha2_finish( &sha2, hash ); hashlen = 28; break; case SIG_RSA_SHA256: sha2_starts( &sha2, 0 ); sha2_update( &sha2, ssl->handshake->randbytes, 64 ); sha2_update( &sha2, ssl->in_msg + 4, n ); sha2_finish( &sha2, hash ); hashlen = 32; break; #endif #if defined(POLARSSL_SHA4_C) case SIG_RSA_SHA384: sha4_starts( &sha4, 1 ); sha4_update( &sha4, ssl->handshake->randbytes, 64 ); sha4_update( &sha4, ssl->in_msg + 4, n ); sha4_finish( &sha4, hash ); hashlen = 48; break; case SIG_RSA_SHA512: sha4_starts( &sha4, 0 ); sha4_update( &sha4, ssl->handshake->randbytes, 64 ); sha4_update( &sha4, ssl->in_msg + 4, n ); sha4_finish( &sha4, hash ); hashlen = 64; break; #endif } } SSL_DEBUG_BUF( 3, "parameters hash", hash, hashlen ); if( ( ret = rsa_pkcs1_verify( &ssl->session_negotiate->peer_cert->rsa, RSA_PUBLIC, hash_id, hashlen, hash, p ) ) != 0 ) { SSL_DEBUG_RET( 1, "rsa_pkcs1_verify", ret ); return( ret ); } ssl->state++; SSL_DEBUG_MSG( 2, ( "<= parse server key exchange" ) ); return( 0 ); #endif }
1
[ "CWE-310" ]
polarssl
43f9799ce61c6392a014d0a2ea136b4b3a9ee194
297,244,236,391,647,540,000,000,000,000,000,000,000
268
RSA blinding on CRT operations to counter timing attacks
seamless_init(void) { if (!g_seamless_rdp) return False; seamless_serial = 0; seamless_channel = channel_register("seamrdp", CHANNEL_OPTION_INITIALIZED | CHANNEL_OPTION_ENCRYPT_RDP, seamless_process); return (seamless_channel != NULL); }
0
[ "CWE-787" ]
rdesktop
766ebcf6f23ccfe8323ac10242ae6e127d4505d2
205,688,193,750,612,370,000,000,000,000,000,000,000
12
Malicious RDP server security fixes This commit includes fixes for a set of 21 vulnerabilities in rdesktop when a malicious RDP server is used. All vulnerabilities was identified and reported by Eyal Itkin. * Add rdp_protocol_error function that is used in several fixes * Refactor of process_bitmap_updates * Fix possible integer overflow in s_check_rem() on 32bit arch * Fix memory corruption in process_bitmap_data - CVE-2018-8794 * Fix remote code execution in process_bitmap_data - CVE-2018-8795 * Fix remote code execution in process_plane - CVE-2018-8797 * Fix Denial of Service in mcs_recv_connect_response - CVE-2018-20175 * Fix Denial of Service in mcs_parse_domain_params - CVE-2018-20175 * Fix Denial of Service in sec_parse_crypt_info - CVE-2018-20176 * Fix Denial of Service in sec_recv - CVE-2018-20176 * Fix minor information leak in rdpdr_process - CVE-2018-8791 * Fix Denial of Service in cssp_read_tsrequest - CVE-2018-8792 * Fix remote code execution in cssp_read_tsrequest - CVE-2018-8793 * Fix Denial of Service in process_bitmap_data - CVE-2018-8796 * Fix minor information leak in rdpsnd_process_ping - CVE-2018-8798 * Fix Denial of Service in process_secondary_order - CVE-2018-8799 * Fix remote code execution in in ui_clip_handle_data - CVE-2018-8800 * Fix major information leak in ui_clip_handle_data - CVE-2018-20174 * Fix memory corruption in rdp_in_unistr - CVE-2018-20177 * Fix Denial of Service in process_demand_active - CVE-2018-20178 * Fix remote code execution in lspci_process - CVE-2018-20179 * Fix remote code execution in rdpsnddbg_process - CVE-2018-20180 * Fix remote code execution in seamless_process - CVE-2018-20181 * Fix remote code execution in seamless_process_line - CVE-2018-20182
static int sas_ata_clear_pending(struct domain_device *dev, struct ex_phy *phy) { int res; /* we weren't pending, so successfully end the reset sequence now */ if (dev->dev_type != SAS_SATA_PENDING) return 1; /* hmmm, if this succeeds do we need to repost the domain_device to the * lldd so it can pick up new parameters? */ res = sas_get_ata_info(dev, phy); if (res) return 0; /* retry */ else return 1; }
0
[ "CWE-284" ]
linux
0558f33c06bb910e2879e355192227a8e8f0219d
187,646,559,742,610,700,000,000,000,000,000,000,000
17
scsi: libsas: direct call probe and destruct In commit 87c8331fcf72 ("[SCSI] libsas: prevent domain rediscovery competing with ata error handling") introduced disco mutex to prevent rediscovery competing with ata error handling and put the whole revalidation in the mutex. But the rphy add/remove needs to wait for the error handling which also grabs the disco mutex. This may leads to dead lock.So the probe and destruct event were introduce to do the rphy add/remove asynchronously and out of the lock. The asynchronously processed workers makes the whole discovery process not atomic, the other events may interrupt the process. For example, if a loss of signal event inserted before the probe event, the sas_deform_port() is called and the port will be deleted. And sas_port_delete() may run before the destruct event, but the port-x:x is the top parent of end device or expander. This leads to a kernel WARNING such as: [ 82.042979] sysfs group 'power' not found for kobject 'phy-1:0:22' [ 82.042983] ------------[ cut here ]------------ [ 82.042986] WARNING: CPU: 54 PID: 1714 at fs/sysfs/group.c:237 sysfs_remove_group+0x94/0xa0 [ 82.043059] Call trace: [ 82.043082] [<ffff0000082e7624>] sysfs_remove_group+0x94/0xa0 [ 82.043085] [<ffff00000864e320>] dpm_sysfs_remove+0x60/0x70 [ 82.043086] [<ffff00000863ee10>] device_del+0x138/0x308 [ 82.043089] [<ffff00000869a2d0>] sas_phy_delete+0x38/0x60 [ 82.043091] [<ffff00000869a86c>] do_sas_phy_delete+0x6c/0x80 [ 82.043093] [<ffff00000863dc20>] device_for_each_child+0x58/0xa0 [ 82.043095] [<ffff000008696f80>] sas_remove_children+0x40/0x50 [ 82.043100] [<ffff00000869d1bc>] sas_destruct_devices+0x64/0xa0 [ 82.043102] [<ffff0000080e93bc>] process_one_work+0x1fc/0x4b0 [ 82.043104] [<ffff0000080e96c0>] worker_thread+0x50/0x490 [ 82.043105] [<ffff0000080f0364>] kthread+0xfc/0x128 [ 82.043107] [<ffff0000080836c0>] ret_from_fork+0x10/0x50 Make probe and destruct a direct call in the disco and revalidate function, but put them outside the lock. The whole discovery or revalidate won't be interrupted by other events. And the DISCE_PROBE and DISCE_DESTRUCT event are deleted as a result of the direct call. Introduce a new list to destruct the sas_port and put the port delete after the destruct. This makes sure the right order of destroying the sysfs kobject and fix the warning above. In sas_ex_revalidate_domain() have a loop to find all broadcasted device, and sometimes we have a chance to find the same expander twice. Because the sas_port will be deleted at the end of the whole revalidate process, sas_port with the same name cannot be added before this. Otherwise the sysfs will complain of creating duplicate filename. Since the LLDD will send broadcast for every device change, we can only process one expander's revalidation. [mkp: kbuild test robot warning] Signed-off-by: Jason Yan <[email protected]> CC: John Garry <[email protected]> CC: Johannes Thumshirn <[email protected]> CC: Ewan Milne <[email protected]> CC: Christoph Hellwig <[email protected]> CC: Tomas Henzl <[email protected]> CC: Dan Williams <[email protected]> Reviewed-by: Hannes Reinecke <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
SemanticValues &push() { assert(value_stack_size <= value_stack.size()); if (value_stack_size == value_stack.size()) { value_stack.emplace_back(std::make_shared<SemanticValues>()); } else { auto &sv = *value_stack[value_stack_size]; if (!sv.empty()) { sv.clear(); if (!sv.tags.empty()) { sv.tags.clear(); } } sv.s_ = nullptr; sv.n_ = 0; sv.choice_count_ = 0; sv.choice_ = 0; if (!sv.tokens.empty()) { sv.tokens.clear(); } } auto &sv = *value_stack[value_stack_size++]; sv.path = path; sv.ss = s; sv.source_line_index = &source_line_index; return sv; }
0
[ "CWE-125" ]
cpp-peglib
b3b29ce8f3acf3a32733d930105a17d7b0ba347e
248,117,301,232,510,460,000,000,000,000,000,000,000
23
Fix #122
struct b43_dmadesc_generic *op32_idx2desc(struct b43_dmaring *ring, int slot, struct b43_dmadesc_meta **meta) { struct b43_dmadesc32 *desc; *meta = &(ring->meta[slot]); desc = ring->descbase; desc = &(desc[slot]); return (struct b43_dmadesc_generic *)desc; }
0
[ "CWE-119", "CWE-787" ]
linux
c85ce65ecac078ab1a1835c87c4a6319cf74660a
86,222,563,503,540,720,000,000,000,000,000,000,000
12
b43: allocate receive buffers big enough for max frame len + offset Otherwise, skb_put inside of dma_rx can fail... https://bugzilla.kernel.org/show_bug.cgi?id=32042 Signed-off-by: John W. Linville <[email protected]> Acked-by: Larry Finger <[email protected]> Cc: [email protected]
static int vxlan_fdb_info(struct sk_buff *skb, struct vxlan_dev *vxlan, const struct vxlan_fdb *fdb, u32 portid, u32 seq, int type, unsigned int flags, const struct vxlan_rdst *rdst) { unsigned long now = jiffies; struct nda_cacheinfo ci; struct nlmsghdr *nlh; struct ndmsg *ndm; bool send_ip, send_eth; nlh = nlmsg_put(skb, portid, seq, type, sizeof(*ndm), flags); if (nlh == NULL) return -EMSGSIZE; ndm = nlmsg_data(nlh); memset(ndm, 0, sizeof(*ndm)); send_eth = send_ip = true; if (type == RTM_GETNEIGH) { send_ip = !vxlan_addr_any(&rdst->remote_ip); send_eth = !is_zero_ether_addr(fdb->eth_addr); ndm->ndm_family = send_ip ? rdst->remote_ip.sa.sa_family : AF_INET; } else ndm->ndm_family = AF_BRIDGE; ndm->ndm_state = fdb->state; ndm->ndm_ifindex = vxlan->dev->ifindex; ndm->ndm_flags = fdb->flags; if (rdst->offloaded) ndm->ndm_flags |= NTF_OFFLOADED; ndm->ndm_type = RTN_UNICAST; if (!net_eq(dev_net(vxlan->dev), vxlan->net) && nla_put_s32(skb, NDA_LINK_NETNSID, peernet2id(dev_net(vxlan->dev), vxlan->net))) goto nla_put_failure; if (send_eth && nla_put(skb, NDA_LLADDR, ETH_ALEN, &fdb->eth_addr)) goto nla_put_failure; if (send_ip && vxlan_nla_put_addr(skb, NDA_DST, &rdst->remote_ip)) goto nla_put_failure; if (rdst->remote_port && rdst->remote_port != vxlan->cfg.dst_port && nla_put_be16(skb, NDA_PORT, rdst->remote_port)) goto nla_put_failure; if (rdst->remote_vni != vxlan->default_dst.remote_vni && nla_put_u32(skb, NDA_VNI, be32_to_cpu(rdst->remote_vni))) goto nla_put_failure; if ((vxlan->cfg.flags & VXLAN_F_COLLECT_METADATA) && fdb->vni && nla_put_u32(skb, NDA_SRC_VNI, be32_to_cpu(fdb->vni))) goto nla_put_failure; if (rdst->remote_ifindex && nla_put_u32(skb, NDA_IFINDEX, rdst->remote_ifindex)) goto nla_put_failure; ci.ndm_used = jiffies_to_clock_t(now - fdb->used); ci.ndm_confirmed = 0; ci.ndm_updated = jiffies_to_clock_t(now - fdb->updated); ci.ndm_refcnt = 0; if (nla_put(skb, NDA_CACHEINFO, sizeof(ci), &ci)) goto nla_put_failure; nlmsg_end(skb, nlh); return 0; nla_put_failure: nlmsg_cancel(skb, nlh); return -EMSGSIZE; }
0
[]
net
6c8991f41546c3c472503dff1ea9daaddf9331c2
135,230,931,081,847,050,000,000,000,000,000,000,000
73
net: ipv6_stub: use ip6_dst_lookup_flow instead of ip6_dst_lookup ipv6_stub uses the ip6_dst_lookup function to allow other modules to perform IPv6 lookups. However, this function skips the XFRM layer entirely. All users of ipv6_stub->ip6_dst_lookup use ip_route_output_flow (via the ip_route_output_key and ip_route_output helpers) for their IPv4 lookups, which calls xfrm_lookup_route(). This patch fixes this inconsistent behavior by switching the stub to ip6_dst_lookup_flow, which also calls xfrm_lookup_route(). This requires some changes in all the callers, as these two functions take different arguments and have different return types. Fixes: 5f81bd2e5d80 ("ipv6: export a stub for IPv6 symbols used by vxlan") Reported-by: Xiumei Mu <[email protected]> Signed-off-by: Sabrina Dubroca <[email protected]> Signed-off-by: David S. Miller <[email protected]>
virtual Key *clone(MEM_ROOT *mem_root) const { return new (mem_root) Key(*this, mem_root); }
0
[ "CWE-416" ]
server
4681b6f2d8c82b4ec5cf115e83698251963d80d5
290,744,890,160,730,700,000,000,000,000,000,000,000
2
MDEV-26281 ASAN use-after-poison when complex conversion is involved in blob the bug was that in_vector array in Item_func_in was allocated in the statement arena, not in the table->expr_arena. revert part of the 5acd391e8b2d. Instead, change the arena correctly in fix_all_session_vcol_exprs(). Remove TABLE_ARENA, that was introduced in 5acd391e8b2d to force item tree changes to be rolled back (because they were allocated in the wrong arena and didn't persist. now they do)
static int dtls1_add_cert_to_buf(BUF_MEM *buf, unsigned long *l, X509 *x) { int n; unsigned char *p; n = i2d_X509(x, NULL); if (!BUF_MEM_grow_clean(buf, (int)(n + (*l) + 3))) { SSLerr(SSL_F_DTLS1_ADD_CERT_TO_BUF, ERR_R_BUF_LIB); return 0; } p = (unsigned char *)&(buf->data[*l]); l2n3(n, p); i2d_X509(x, &p); *l += n + 3; return 1; }
0
[ "CWE-399" ]
openssl
00a4c1421407b6ac796688871b0a49a179c694d9
7,926,837,328,464,211,000,000,000,000,000,000,000
17
Fix DTLS buffered message DoS attack DTLS can handle out of order record delivery. Additionally since handshake messages can be bigger than will fit into a single packet, the messages can be fragmented across multiple records (as with normal TLS). That means that the messages can arrive mixed up, and we have to reassemble them. We keep a queue of buffered messages that are "from the future", i.e. messages we're not ready to deal with yet but have arrived early. The messages held there may not be full yet - they could be one or more fragments that are still in the process of being reassembled. The code assumes that we will eventually complete the reassembly and when that occurs the complete message is removed from the queue at the point that we need to use it. However, DTLS is also tolerant of packet loss. To get around that DTLS messages can be retransmitted. If we receive a full (non-fragmented) message from the peer after previously having received a fragment of that message, then we ignore the message in the queue and just use the non-fragmented version. At that point the queued message will never get removed. Additionally the peer could send "future" messages that we never get to in order to complete the handshake. Each message has a sequence number (starting from 0). We will accept a message fragment for the current message sequence number, or for any sequence up to 10 into the future. However if the Finished message has a sequence number of 2, anything greater than that in the queue is just left there. So, in those two ways we can end up with "orphaned" data in the queue that will never get removed - except when the connection is closed. At that point all the queues are flushed. An attacker could seek to exploit this by filling up the queues with lots of large messages that are never going to be used in order to attempt a DoS by memory exhaustion. I will assume that we are only concerned with servers here. It does not seem reasonable to be concerned about a memory exhaustion attack on a client. They are unlikely to process enough connections for this to be an issue. A "long" handshake with many messages might be 5 messages long (in the incoming direction), e.g. ClientHello, Certificate, ClientKeyExchange, CertificateVerify, Finished. So this would be message sequence numbers 0 to 4. Additionally we can buffer up to 10 messages in the future. Therefore the maximum number of messages that an attacker could send that could get orphaned would typically be 15. The maximum size that a DTLS message is allowed to be is defined by max_cert_list, which by default is 100k. Therefore the maximum amount of "orphaned" memory per connection is 1500k. Message sequence numbers get reset after the Finished message, so renegotiation will not extend the maximum number of messages that can be orphaned per connection. As noted above, the queues do get cleared when the connection is closed. Therefore in order to mount an effective attack, an attacker would have to open many simultaneous connections. Issue reported by Quan Luo. CVE-2016-2179 Reviewed-by: Richard Levitte <[email protected]>
static void line6_stop_listen(struct usb_line6 *line6) { usb_kill_urb(line6->urb_listen); }
0
[ "CWE-476" ]
linux
0b074ab7fc0d575247b9cc9f93bb7e007ca38840
3,791,554,923,857,954,000,000,000,000,000,000,000
4
ALSA: line6: Assure canceling delayed work at disconnection The current code performs the cancel of a delayed work at the late stage of disconnection procedure, which may lead to the access to the already cleared state. This patch assures to call cancel_delayed_work_sync() at the beginning of the disconnection procedure for avoiding that race. The delayed work object is now assigned in the common line6 object instead of its derivative, so that we can call cancel_delayed_work_sync(). Along with the change, the startup function is called via the new callback instead. This will make it easier to port other LINE6 drivers to use the delayed work for startup in later patches. Reported-by: [email protected] Fixes: 7f84ff68be05 ("ALSA: line6: toneport: Fix broken usage of timer for delayed execution") Cc: <[email protected]> Signed-off-by: Takashi Iwai <[email protected]>
nvmet_fc_rcv_fcp_abort(struct nvmet_fc_target_port *target_port, struct nvmefc_tgt_fcp_req *fcpreq) { struct nvmet_fc_fcp_iod *fod = fcpreq->nvmet_fc_private; struct nvmet_fc_tgt_queue *queue; unsigned long flags; if (!fod || fod->fcpreq != fcpreq) /* job appears to have already completed, ignore abort */ return; queue = fod->queue; spin_lock_irqsave(&queue->qlock, flags); if (fod->active) { /* * mark as abort. The abort handler, invoked upon completion * of any work, will detect the aborted status and do the * callback. */ spin_lock(&fod->flock); fod->abort = true; fod->aborted = true; spin_unlock(&fod->flock); } spin_unlock_irqrestore(&queue->qlock, flags); }
0
[ "CWE-119", "CWE-787" ]
linux
0c319d3a144d4b8f1ea2047fd614d2149b68f889
4,380,746,386,274,564,000,000,000,000,000,000,000
27
nvmet-fc: ensure target queue id within range. When searching for queue id's ensure they are within the expected range. Signed-off-by: James Smart <[email protected]> Signed-off-by: Christoph Hellwig <[email protected]> Signed-off-by: Jens Axboe <[email protected]>
ConnStateData::quitAfterError(HttpRequest *request) { // From HTTP p.o.v., we do not have to close after every error detected // at the client-side, but many such errors do require closure and the // client-side code is bad at handling errors so we play it safe. if (request) request->flags.proxyKeepalive = false; flags.readMore = false; debugs(33,4, HERE << "Will close after error: " << clientConnection); }
0
[ "CWE-444" ]
squid
fd68382860633aca92065e6c343cfd1b12b126e7
201,904,074,717,702,700,000,000,000,000,000,000,000
10
Improve Transfer-Encoding handling (#702) Reject messages containing Transfer-Encoding header with coding other than chunked or identity. Squid does not support other codings. For simplicity and security sake, also reject messages where Transfer-Encoding contains unnecessary complex values that are technically equivalent to "chunked" or "identity" (e.g., ",,chunked" or "identity, chunked"). RFC 7230 formally deprecated and removed identity coding, but it is still used by some agents.
static int set_msr_hyperv(struct kvm_vcpu *vcpu, u32 msr, u64 data) { switch (msr) { case HV_X64_MSR_APIC_ASSIST_PAGE: { unsigned long addr; if (!(data & HV_X64_MSR_APIC_ASSIST_PAGE_ENABLE)) { vcpu->arch.hv_vapic = data; break; } addr = gfn_to_hva(vcpu->kvm, data >> HV_X64_MSR_APIC_ASSIST_PAGE_ADDRESS_SHIFT); if (kvm_is_error_hva(addr)) return 1; if (clear_user((void __user *)addr, PAGE_SIZE)) return 1; vcpu->arch.hv_vapic = data; break; } case HV_X64_MSR_EOI: return kvm_hv_vapic_msr_write(vcpu, APIC_EOI, data); case HV_X64_MSR_ICR: return kvm_hv_vapic_msr_write(vcpu, APIC_ICR, data); case HV_X64_MSR_TPR: return kvm_hv_vapic_msr_write(vcpu, APIC_TASKPRI, data); default: pr_unimpl(vcpu, "HYPER-V unimplemented wrmsr: 0x%x " "data 0x%llx\n", msr, data); return 1; } return 0; }
0
[ "CWE-200" ]
kvm
831d9d02f9522e739825a51a11e3bc5aa531a905
108,751,909,670,355,550,000,000,000,000,000,000,000
33
KVM: x86: fix information leak to userland Structures kvm_vcpu_events, kvm_debugregs, kvm_pit_state2 and kvm_clock_data are copied to userland with some padding and reserved fields unitialized. It leads to leaking of contents of kernel stack memory. We have to initialize them to zero. In patch v1 Jan Kiszka suggested to fill reserved fields with zeros instead of memset'ting the whole struct. It makes sense as these fields are explicitly marked as padding. No more fields need zeroing. KVM-Stable-Tag. Signed-off-by: Vasiliy Kulikov <[email protected]> Signed-off-by: Marcelo Tosatti <[email protected]>
static int bio_zlib_new(BIO *bi) { BIO_ZLIB_CTX *ctx; #ifdef ZLIB_SHARED (void)COMP_zlib(); if (!zlib_loaded) { COMPerr(COMP_F_BIO_ZLIB_NEW, COMP_R_ZLIB_NOT_SUPPORTED); return 0; } #endif ctx = OPENSSL_malloc(sizeof(BIO_ZLIB_CTX)); if(!ctx) { COMPerr(COMP_F_BIO_ZLIB_NEW, ERR_R_MALLOC_FAILURE); return 0; } ctx->ibuf = NULL; ctx->obuf = NULL; ctx->ibufsize = ZLIB_DEFAULT_BUFSIZE; ctx->obufsize = ZLIB_DEFAULT_BUFSIZE; ctx->zin.zalloc = Z_NULL; ctx->zin.zfree = Z_NULL; ctx->zin.next_in = NULL; ctx->zin.avail_in = 0; ctx->zin.next_out = NULL; ctx->zin.avail_out = 0; ctx->zout.zalloc = Z_NULL; ctx->zout.zfree = Z_NULL; ctx->zout.next_in = NULL; ctx->zout.avail_in = 0; ctx->zout.next_out = NULL; ctx->zout.avail_out = 0; ctx->odone = 0; ctx->comp_level = Z_DEFAULT_COMPRESSION; bi->init = 1; bi->ptr = (char *)ctx; bi->flags = 0; return 1; }
0
[ "CWE-399" ]
openssl
1b31b5ad560b16e2fe1cad54a755e3e6b5e778a3
173,229,646,041,124,300,000,000,000,000,000,000,000
40
Modify compression code so it avoids using ex_data free functions. This stops applications that call CRYPTO_free_all_ex_data() prematurely leaking memory.
template<typename tc> CImg<T>& draw_triangle(int x0, int y0, int x1, int y1, int x2, int y2, const tc *const color, float bs0, float bs1, float bs2, const float opacity=1) { if (is_empty()) return *this; if (!color) throw CImgArgumentException(_cimg_instance "draw_triangle(): Specified color is (null).", cimg_instance); if (y0>y1) cimg::swap(x0,x1,y0,y1,bs0,bs1); if (y0>y2) cimg::swap(x0,x2,y0,y2,bs0,bs2); if (y1>y2) cimg::swap(x1,x2,y1,y2,bs1,bs2); if (y2<0 || y0>=height() || cimg::min(x0,x1,x2)>=width() || cimg::max(x0,x1,x2)<0 || !opacity) return *this; const int w1 = width() - 1, h1 = height() - 1, dx01 = x1 - x0, dx02 = x2 - x0, dx12 = x2 - x1, dy01 = std::max(1,y1 - y0), dy02 = std::max(1,y2 - y0), dy12 = std::max(1,y2 - y1), cy0 = cimg::cut(y0,0,h1), cy2 = cimg::cut(y2,0,h1), hdy01 = dy01*cimg::sign(dx01)/2, hdy02 = dy02*cimg::sign(dx02)/2, hdy12 = dy12*cimg::sign(dx12)/2; const float dbs01 = bs1 - bs0, dbs02 = bs2 - bs0, dbs12 = bs2 - bs1; cimg_init_scanline(opacity); for (int y = cy0; y<=cy2; ++y) { const int yy0 = y - y0, yy1 = y - y1; int xm = y<y1?x0 + (dx01*yy0 + hdy01)/dy01:x1 + (dx12*yy1 + hdy12)/dy12, xM = x0 + (dx02*yy0 + hdy02)/dy02; float bsm = y<y1?(bs0 + dbs01*yy0/dy01):(bs1 + dbs12*yy1/dy12), bsM = bs0 + dbs02*yy0/dy02; if (xm>xM) cimg::swap(xm,xM,bsm,bsM); if (xM>=0 || xm<=w1) { const int cxm = cimg::cut(xm,0,w1), cxM = cimg::cut(xM,0,w1); T *ptrd = data(cxm,y); const int dxmM = std::max(1,xM - xm); const float dbsmM = bsM - bsm; for (int x = cxm; x<=cxM; ++x) { const int xxm = x - xm; const float cbs = cimg::cut(bsm + dbsmM*xxm/dxmM,0,2); cimg_forC(*this,c) { const Tfloat val = cbs<=1?color[c]*cbs:(2 - cbs)*color[c] + (cbs - 1)*_sc_maxval; ptrd[c*_sc_whd] = (T)(opacity>=1?val:val*_sc_nopacity + ptrd[c*_sc_whd]*_sc_copacity); } ++ptrd; } } } return *this;
0
[ "CWE-119", "CWE-787" ]
CImg
ac8003393569aba51048c9d67e1491559877b1d1
130,917,076,172,813,290,000,000,000,000,000,000,000
59
.
JPEGPostEncode(TIFF* tif) { JPEGState *sp = JState(tif); if (sp->scancount > 0) { /* * Need to emit a partial bufferload of downsampled data. * Pad the data vertically. */ int ci, ypos, n; jpeg_component_info* compptr; for (ci = 0, compptr = sp->cinfo.c.comp_info; ci < sp->cinfo.c.num_components; ci++, compptr++) { int vsamp = compptr->v_samp_factor; tmsize_t row_width = compptr->width_in_blocks * DCTSIZE * sizeof(JSAMPLE); for (ypos = sp->scancount * vsamp; ypos < DCTSIZE * vsamp; ypos++) { _TIFFmemcpy((void*)sp->ds_buffer[ci][ypos], (void*)sp->ds_buffer[ci][ypos-1], row_width); } } n = sp->cinfo.c.max_v_samp_factor * DCTSIZE; if (TIFFjpeg_write_raw_data(sp, sp->ds_buffer, n) != n) return (0); } return (TIFFjpeg_finish_compress(JState(tif))); }
0
[ "CWE-369" ]
libtiff
47f2fb61a3a64667bce1a8398a8fcb1b348ff122
340,260,890,054,700,300,000,000,000,000,000,000
33
* libtiff/tif_jpeg.c: avoid integer division by zero in JPEGSetupEncode() when horizontal or vertical sampling is set to 0. Fixes http://bugzilla.maptools.org/show_bug.cgi?id=2653
int compat_get_timespec64(struct timespec64 *ts, const void __user *uts) { if (COMPAT_USE_64BIT_TIME) return copy_from_user(ts, uts, sizeof(*ts)) ? -EFAULT : 0; else return __compat_get_timespec64(ts, uts); }
0
[ "CWE-200" ]
linux
0a0b98734479aa5b3c671d5190e86273372cab95
302,630,473,006,535,940,000,000,000,000,000,000,000
7
compat: fix 4-byte infoleak via uninitialized struct field Commit 3a4d44b61625 ("ntp: Move adjtimex related compat syscalls to native counterparts") removed the memset() in compat_get_timex(). Since then, the compat adjtimex syscall can invoke do_adjtimex() with an uninitialized ->tai. If do_adjtimex() doesn't write to ->tai (e.g. because the arguments are invalid), compat_put_timex() then copies the uninitialized ->tai field to userspace. Fix it by adding the memset() back. Fixes: 3a4d44b61625 ("ntp: Move adjtimex related compat syscalls to native counterparts") Signed-off-by: Jann Horn <[email protected]> Acked-by: Kees Cook <[email protected]> Acked-by: Al Viro <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
static int crypto_user_rcv_msg(struct sk_buff *skb, struct nlmsghdr *nlh) { struct nlattr *attrs[CRYPTOCFGA_MAX+1]; const struct crypto_link *link; int type, err; type = nlh->nlmsg_type; if (type > CRYPTO_MSG_MAX) return -EINVAL; type -= CRYPTO_MSG_BASE; link = &crypto_dispatch[type]; if (!netlink_capable(skb, CAP_NET_ADMIN)) return -EPERM; if ((type == (CRYPTO_MSG_GETALG - CRYPTO_MSG_BASE) && (nlh->nlmsg_flags & NLM_F_DUMP))) { struct crypto_alg *alg; u16 dump_alloc = 0; if (link->dump == NULL) return -EINVAL; list_for_each_entry(alg, &crypto_alg_list, cra_list) dump_alloc += CRYPTO_REPORT_MAXSIZE; { struct netlink_dump_control c = { .dump = link->dump, .done = link->done, .min_dump_alloc = dump_alloc, }; return netlink_dump_start(crypto_nlsk, skb, nlh, &c); } } err = nlmsg_parse(nlh, crypto_msg_min[type], attrs, CRYPTOCFGA_MAX, crypto_policy); if (err < 0) return err; if (link->doit == NULL) return -EINVAL; return link->doit(skb, nlh, attrs); }
0
[ "CWE-264" ]
net
90f62cf30a78721641e08737bda787552428061e
29,086,140,491,489,570,000,000,000,000,000,000,000
47
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]>
StringRef alloc_header_name(BlockAllocator &balloc, const StringRef &name) { auto iov = make_byte_ref(balloc, name.size() + 1); auto p = iov.base; p = std::copy(std::begin(name), std::end(name), p); util::inp_strlower(iov.base, p); *p = '\0'; return StringRef{iov.base, p}; }
0
[]
nghttp2
319d5ab1c6d916b6b8a0d85b2ae3f01b3ad04f2c
111,015,213,491,190,550,000,000,000,000,000,000,000
9
nghttpx: Fix request stall Fix request stall if backend connection is reused and buffer is full.
extract_array_assignment_list (string, sindex) char *string; int *sindex; { int slen; char *ret; slen = strlen (string); /* ( */ if (string[slen - 1] == ')') { ret = substring (string, *sindex, slen - 1); *sindex = slen - 1; return ret; } return 0; }
0
[]
bash
955543877583837c85470f7fb8a97b7aa8d45e6c
330,940,614,315,151,700,000,000,000,000,000,000,000
16
bash-4.4-rc2 release
static int ctnetlink_stat_ct_cpu(struct net *net, struct sock *ctnl, struct sk_buff *skb, const struct nlmsghdr *nlh, const struct nlattr * const cda[], struct netlink_ext_ack *extack) { if (nlh->nlmsg_flags & NLM_F_DUMP) { struct netlink_dump_control c = { .dump = ctnetlink_ct_stat_cpu_dump, }; return netlink_dump_start(ctnl, skb, nlh, &c); } return 0; }
0
[ "CWE-120" ]
linux
1cc5ef91d2ff94d2bf2de3b3585423e8a1051cb6
272,228,707,052,859,200,000,000,000,000,000,000,000
15
netfilter: ctnetlink: add a range check for l3/l4 protonum The indexes to the nf_nat_l[34]protos arrays come from userspace. So check the tuple's family, e.g. l3num, when creating the conntrack in order to prevent an OOB memory access during setup. Here is an example kernel panic on 4.14.180 when userspace passes in an index greater than NFPROTO_NUMPROTO. Internal error: Oops - BUG: 0 [#1] PREEMPT SMP Modules linked in:... Process poc (pid: 5614, stack limit = 0x00000000a3933121) CPU: 4 PID: 5614 Comm: poc Tainted: G S W O 4.14.180-g051355490483 Hardware name: Qualcomm Technologies, Inc. SM8150 V2 PM8150 Google Inc. MSM task: 000000002a3dfffe task.stack: 00000000a3933121 pc : __cfi_check_fail+0x1c/0x24 lr : __cfi_check_fail+0x1c/0x24 ... Call trace: __cfi_check_fail+0x1c/0x24 name_to_dev_t+0x0/0x468 nfnetlink_parse_nat_setup+0x234/0x258 ctnetlink_parse_nat_setup+0x4c/0x228 ctnetlink_new_conntrack+0x590/0xc40 nfnetlink_rcv_msg+0x31c/0x4d4 netlink_rcv_skb+0x100/0x184 nfnetlink_rcv+0xf4/0x180 netlink_unicast+0x360/0x770 netlink_sendmsg+0x5a0/0x6a4 ___sys_sendmsg+0x314/0x46c SyS_sendmsg+0xb4/0x108 el0_svc_naked+0x34/0x38 This crash is not happening since 5.4+, however, ctnetlink still allows for creating entries with unsupported layer 3 protocol number. Fixes: c1d10adb4a521 ("[NETFILTER]: Add ctnetlink port for nf_conntrack") Signed-off-by: Will McVicker <[email protected]> [[email protected]: rebased original patch on top of nf.git] Signed-off-by: Pablo Neira Ayuso <[email protected]>
void __iscsi_get_task(struct iscsi_task *task) { refcount_inc(&task->refcount); }
0
[ "CWE-787" ]
linux
ec98ea7070e94cc25a422ec97d1421e28d97b7ee
139,092,123,083,094,470,000,000,000,000,000,000,000
4
scsi: iscsi: Ensure sysfs attributes are limited to PAGE_SIZE As the iSCSI parameters are exported back through sysfs, it should be enforcing that they never are more than PAGE_SIZE (which should be more than enough) before accepting updates through netlink. Change all iSCSI sysfs attributes to use sysfs_emit(). Cc: [email protected] Reported-by: Adam Nichols <[email protected]> Reviewed-by: Lee Duncan <[email protected]> Reviewed-by: Greg Kroah-Hartman <[email protected]> Reviewed-by: Mike Christie <[email protected]> Signed-off-by: Chris Leech <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
TRIO_PUBLIC_STRING char* trio_string_index_last TRIO_ARGS2((self, character), trio_string_t* self, int character) { assert(self); return trio_index_last(self->content, character); }
0
[ "CWE-190", "CWE-125" ]
FreeRDP
05cd9ea2290d23931f615c1b004d4b2e69074e27
72,468,306,471,131,925,000,000,000,000,000,000,000
7
Fixed TrioParse and trio_length limts. CVE-2020-4030 thanks to @antonio-morales for finding this.
static void addrconf_dad_start(struct inet6_ifaddr *ifp, u32 flags) { struct inet6_dev *idev = ifp->idev; struct net_device *dev = idev->dev; unsigned long rand_num; addrconf_join_solict(dev, &ifp->addr); if (ifp->prefix_len != 128 && (ifp->flags&IFA_F_PERMANENT)) addrconf_prefix_route(&ifp->addr, ifp->prefix_len, dev, 0, flags); net_srandom(ifp->addr.s6_addr32[3]); rand_num = net_random() % (idev->cnf.rtr_solicit_delay ? : 1); read_lock_bh(&idev->lock); if (ifp->dead) goto out; spin_lock_bh(&ifp->lock); if (dev->flags&(IFF_NOARP|IFF_LOOPBACK) || !(ifp->flags&IFA_F_TENTATIVE)) { ifp->flags &= ~IFA_F_TENTATIVE; spin_unlock_bh(&ifp->lock); read_unlock_bh(&idev->lock); addrconf_dad_completed(ifp); return; } ifp->probes = idev->cnf.dad_transmits; addrconf_mod_timer(ifp, AC_DAD, rand_num); spin_unlock_bh(&ifp->lock); out: read_unlock_bh(&idev->lock); }
0
[ "CWE-200" ]
linux-2.6
8a47077a0b5aa2649751c46e7a27884e6686ccbf
116,485,924,549,874,840,000,000,000,000,000,000,000
37
[NETLINK]: Missing padding fields in dumped structures Plug holes with padding fields and initialized them to zero. Signed-off-by: Patrick McHardy <[email protected]> Signed-off-by: David S. Miller <[email protected]>
static void tcg_commit(MemoryListener *listener) { CPUState *cpu; /* since each CPU stores ram addresses in its TLB cache, we must reset the modified entries */ /* XXX: slow ! */ CPU_FOREACH(cpu) { /* FIXME: Disentangle the cpu.h circular files deps so we can directly get the right CPU from listener. */ if (cpu->tcg_as_listener != listener) { continue; } cpu_reload_memory_map(cpu); } }
0
[]
qemu
c3c1bb99d1c11978d9ce94d1bdcf0705378c1459
13,773,743,693,796,672,000,000,000,000,000,000,000
16
exec: Respect as_tranlsate_internal length clamp address_space_translate_internal will clamp the *plen length argument based on the size of the memory region being queried. The iommu walker logic in addresss_space_translate was ignoring this by discarding the post fn call value of *plen. Fix by just always using *plen as the length argument throughout the fn, removing the len local variable. This fixes a bootloader bug when a single elf section spans multiple QEMU memory regions. Signed-off-by: Peter Crosthwaite <[email protected]> Message-Id: <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]>
init_pfm_fs(void) { int err = register_filesystem(&pfm_fs_type); if (!err) { pfmfs_mnt = kern_mount(&pfm_fs_type); err = PTR_ERR(pfmfs_mnt); if (IS_ERR(pfmfs_mnt)) unregister_filesystem(&pfm_fs_type); else err = 0; } return err; }
0
[]
linux-2.6
41d5e5d73ecef4ef56b7b4cde962929a712689b4
171,467,089,035,238,360,000,000,000,000,000,000,000
13
[IA64] permon use-after-free fix Perfmon associates vmalloc()ed memory with a file descriptor, and installs a vma mapping that memory. Unfortunately, the vm_file field is not filled in, so processes with mappings to that memory do not prevent the file from being closed and the memory freed. This results in use-after-free bugs and multiple freeing of pages, etc. I saw this bug on an Altix on SLES9. Haven't reproduced upstream but it looks like the same issue is there. Signed-off-by: Nick Piggin <[email protected]> Cc: Stephane Eranian <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Tony Luck <[email protected]>
// Custom random number generator (allow re-entrance). inline cimg_ulong& rng() { // Used as a shared global number for rng static cimg_ulong rng = 0xB16B00B5U; return rng;
0
[ "CWE-119", "CWE-787" ]
CImg
ac8003393569aba51048c9d67e1491559877b1d1
46,269,674,631,438,760,000,000,000,000,000,000,000
4
.
void fs_basic_fs(void) { uid_t uid = getuid(); // mount a new proc filesystem if (arg_debug) printf("Mounting /proc filesystem representing the PID namespace\n"); if (mount("proc", "/proc", "proc", MS_NOSUID | MS_NOEXEC | MS_NODEV | MS_REC, NULL) < 0) errExit("mounting /proc"); EUID_USER(); if (arg_debug) printf("Basic read-only filesystem:\n"); if (!arg_writable_etc) { fs_remount("/etc", MOUNT_READONLY, 1); if (uid) fs_remount("/etc", MOUNT_NOEXEC, 1); } if (!arg_writable_var) { fs_remount("/var", MOUNT_READONLY, 1); if (uid) fs_remount("/var", MOUNT_NOEXEC, 1); } fs_remount("/usr", MOUNT_READONLY, 1); fs_remount("/bin", MOUNT_READONLY, 1); fs_remount("/sbin", MOUNT_READONLY, 1); fs_remount("/lib", MOUNT_READONLY, 1); fs_remount("/lib64", MOUNT_READONLY, 1); fs_remount("/lib32", MOUNT_READONLY, 1); fs_remount("/libx32", MOUNT_READONLY, 1); EUID_ROOT(); // update /var directory in order to support multiple sandboxes running on the same root directory fs_var_lock(); if (!arg_keep_var_tmp) fs_var_tmp(); if (!arg_writable_var_log) fs_var_log(); else fs_remount("/var/log", MOUNT_RDWR_NOCHECK, 0); fs_var_lib(); fs_var_cache(); fs_var_utmp(); fs_machineid(); // don't leak user information restrict_users(); // when starting as root, firejail config is not disabled; if (uid) disable_config(); }
0
[ "CWE-269", "CWE-94" ]
firejail
27cde3d7d1e4e16d4190932347c7151dc2a84c50
187,109,812,524,851,000,000,000,000,000,000,000,000
52
fixing CVE-2022-31214
static int get_options(int *argc_ptr, char ***argv_ptr) { int ho_error; my_getopt_register_get_addr(mysql_getopt_value); my_getopt_error_reporter= option_error_reporter; /* prepare all_options array */ my_init_dynamic_array(&all_options, sizeof(my_option), array_elements(my_long_options), array_elements(my_long_options)/4); for (my_option *opt= my_long_options; opt < my_long_options + array_elements(my_long_options) - 1; opt++) insert_dynamic(&all_options, (uchar*) opt); sys_var_add_options(&all_options, 0); add_terminator(&all_options); /* Skip unknown options so that they may be processed later by plugins */ my_getopt_skip_unknown= TRUE; if ((ho_error= handle_options(argc_ptr, argv_ptr, (my_option*)(all_options.buffer), mysqld_get_one_option))) return ho_error; if (!opt_help) delete_dynamic(&all_options); else opt_abort= 1; /* Add back the program name handle_options removes */ (*argc_ptr)++; (*argv_ptr)--; /* Options have been parsed. Now some of them need additional special handling, like custom value checking, checking of incompatibilites between options, setting of multiple variables, etc. Do them here. */ if ((opt_log_slow_admin_statements || opt_log_queries_not_using_indexes || opt_log_slow_slave_statements) && !opt_slow_log) sql_print_warning("options --log-slow-admin-statements, --log-queries-not-using-indexes and --log-slow-slave-statements have no effect if --log_slow_queries is not set"); if (global_system_variables.net_buffer_length > global_system_variables.max_allowed_packet) { sql_print_warning("net_buffer_length (%lu) is set to be larger " "than max_allowed_packet (%lu). Please rectify.", global_system_variables.net_buffer_length, global_system_variables.max_allowed_packet); } if (log_error_file_ptr != disabled_my_option) opt_error_log= 1; else log_error_file_ptr= const_cast<char*>(""); opt_init_connect.length=strlen(opt_init_connect.str); opt_init_slave.length=strlen(opt_init_slave.str); if (global_system_variables.low_priority_updates) thr_upgraded_concurrent_insert_lock= TL_WRITE_LOW_PRIORITY; if (ft_boolean_check_syntax_string((uchar*) ft_boolean_syntax)) { sql_print_error("Invalid ft-boolean-syntax string: %s\n", ft_boolean_syntax); return 1; } if (opt_disable_networking) mysqld_port= mysqld_extra_port= 0; if (opt_skip_show_db) opt_specialflag|= SPECIAL_SKIP_SHOW_DB; if (myisam_flush) flush_time= 0; #ifdef HAVE_REPLICATION if (opt_slave_skip_errors) init_slave_skip_errors(opt_slave_skip_errors); #endif if (global_system_variables.max_join_size == HA_POS_ERROR) global_system_variables.option_bits|= OPTION_BIG_SELECTS; else global_system_variables.option_bits&= ~OPTION_BIG_SELECTS; // Synchronize @@global.autocommit on --autocommit const ulonglong turn_bit_on= opt_autocommit ? OPTION_AUTOCOMMIT : OPTION_NOT_AUTOCOMMIT; global_system_variables.option_bits= (global_system_variables.option_bits & ~(OPTION_NOT_AUTOCOMMIT | OPTION_AUTOCOMMIT)) | turn_bit_on; global_system_variables.sql_mode= expand_sql_mode(global_system_variables.sql_mode); #if defined(HAVE_BROKEN_REALPATH) my_use_symdir=0; my_disable_symlinks=1; have_symlink=SHOW_OPTION_NO; #else if (!my_use_symdir) { my_disable_symlinks=1; have_symlink=SHOW_OPTION_DISABLED; } #endif if (opt_debugging) { /* Allow break with SIGINT, no core or stack trace */ test_flags|= TEST_SIGINT; opt_stack_trace= 1; test_flags&= ~TEST_CORE_ON_SIGNAL; } /* Set global MyISAM variables from delay_key_write_options */ fix_delay_key_write(0, 0, OPT_GLOBAL); #ifndef EMBEDDED_LIBRARY if (mysqld_chroot) set_root(mysqld_chroot); #else thread_handling = SCHEDULER_NO_THREADS; max_allowed_packet= global_system_variables.max_allowed_packet; net_buffer_length= global_system_variables.net_buffer_length; #endif if (fix_paths()) return 1; /* Set some global variables from the global_system_variables In most cases the global variables will not be used */ my_disable_locking= myisam_single_user= test(opt_external_locking == 0); my_default_record_cache_size=global_system_variables.read_buff_size; /* Log mysys errors when we don't have a thd or thd->log_all_errors is set (recovery) to the log. This is mainly useful for debugging strange system errors. */ if (global_system_variables.log_warnings >= 10) my_global_flags= MY_WME | ME_JUST_INFO; /* Log all errors not handled by thd->handle_error() to my_message_sql() */ if (global_system_variables.log_warnings >= 11) my_global_flags|= ME_NOREFRESH; if (my_assert_on_error) debug_assert_if_crashed_table= 1; global_system_variables.long_query_time= (ulonglong) (global_system_variables.long_query_time_double * 1e6); if (opt_short_log_format) opt_specialflag|= SPECIAL_SHORT_LOG_FORMAT; if (init_global_datetime_format(MYSQL_TIMESTAMP_DATE, &global_date_format) || init_global_datetime_format(MYSQL_TIMESTAMP_TIME, &global_time_format) || init_global_datetime_format(MYSQL_TIMESTAMP_DATETIME, &global_datetime_format)) return 1; #ifdef EMBEDDED_LIBRARY one_thread_scheduler(thread_scheduler); one_thread_scheduler(extra_thread_scheduler); #else #ifdef _WIN32 /* workaround: disable thread pool on XP */ if (GetProcAddress(GetModuleHandle("kernel32"),"CreateThreadpool") == 0 && thread_handling > SCHEDULER_NO_THREADS) thread_handling = SCHEDULER_ONE_THREAD_PER_CONNECTION; #endif if (thread_handling <= SCHEDULER_ONE_THREAD_PER_CONNECTION) one_thread_per_connection_scheduler(thread_scheduler, &max_connections, &connection_count); else if (thread_handling == SCHEDULER_NO_THREADS) one_thread_scheduler(thread_scheduler); else pool_of_threads_scheduler(thread_scheduler, &max_connections, &connection_count); one_thread_per_connection_scheduler(extra_thread_scheduler, &extra_max_connections, &extra_connection_count); #endif global_system_variables.engine_condition_pushdown= test(global_system_variables.optimizer_switch & OPTIMIZER_SWITCH_ENGINE_CONDITION_PUSHDOWN); opt_readonly= read_only; /* If max_long_data_size is not specified explicitly use value of max_allowed_packet. */ if (!max_long_data_size_used) max_long_data_size= global_system_variables.max_allowed_packet; /* Rember if max_user_connections was 0 at startup */ max_user_connections_checking= global_system_variables.max_user_connections != 0; return 0; }
0
[ "CWE-362" ]
server
347eeefbfc658c8531878218487d729f4e020805
86,580,299,810,109,200,000,000,000,000,000,000,000
209
don't use my_copystat in the server it was supposed to be used in command-line tools only. Different fix for 4e5473862e: Bug#24388746: PRIVILEGE ESCALATION AND RACE CONDITION USING CREATE TABLE
static bool spd_can_coalesce(const struct splice_pipe_desc *spd, struct page *page, unsigned int offset) { return spd->nr_pages && spd->pages[spd->nr_pages - 1] == page && (spd->partial[spd->nr_pages - 1].offset + spd->partial[spd->nr_pages - 1].len == offset); }
0
[ "CWE-416" ]
net
36d5fe6a000790f56039afe26834265db0a3ad4c
1,129,746,107,362,003,900,000,000,000,000,000,000
9
core, nfqueue, openvswitch: Orphan frags in skb_zerocopy and handle errors skb_zerocopy can copy elements of the frags array between skbs, but it doesn't orphan them. Also, it doesn't handle errors, so this patch takes care of that as well, and modify the callers accordingly. skb_tx_error() is also added to the callers so they will signal the failed delivery towards the creator of the skb. Signed-off-by: Zoltan Kiss <[email protected]> Signed-off-by: David S. Miller <[email protected]>
void __fastcall TConsoleRunner::ScriptTerminalPromptUser(TTerminal * /*Terminal*/, TPromptKind /*Kind*/, UnicodeString Name, UnicodeString Instructions, TStrings * Prompts, TStrings * Results, bool & Result, void * /*Arg*/) { if (!Instructions.IsEmpty()) { PrintMessage(Instructions); } // if there are no prompts, success is default Result = true; for (int Index = 0; Index < Prompts->Count; Index++) { UnicodeString Prompt = Prompts->Strings[Index]; if (!Prompt.IsEmpty() && (Prompt[Prompt.Length()] != L' ')) { Prompt += L' '; } int P = Prompt.Pos(L'&'); if (P > 0) { Prompt.Delete(P, 1); } Print(Prompt); UnicodeString AResult = Results->Strings[Index]; // useless bool Echo = FLAGSET(int(Prompts->Objects[Index]), pupEcho); Result = DoInput(AResult, Echo, InputTimeout(), true); Results->Strings[Index] = AResult; } }
0
[ "CWE-787" ]
winscp
faa96e8144e6925a380f94a97aa382c9427f688d
150,805,580,090,328,070,000,000,000,000,000,000,000
32
Bug 1943: Prevent loading session settings that can lead to remote code execution from handled URLs https://winscp.net/tracker/1943 (cherry picked from commit ec584f5189a856cd79509f754722a6898045c5e0) Source commit: 0f4be408b3f01132b00682da72d925d6c4ee649b
static int get_swift_account_settings(req_state * const s, RGWRados * const store, RGWAccessControlPolicy_SWIFTAcct * const policy, bool * const has_policy) { *has_policy = false; const char * const acl_attr = s->info.env->get("HTTP_X_ACCOUNT_ACCESS_CONTROL"); if (acl_attr) { RGWAccessControlPolicy_SWIFTAcct swift_acct_policy(s->cct); const bool r = swift_acct_policy.create(store, s->user->user_id, s->user->display_name, string(acl_attr)); if (r != true) { return -EINVAL; } *policy = swift_acct_policy; *has_policy = true; } return 0; }
0
[ "CWE-617" ]
ceph
f44a8ae8aa27ecef69528db9aec220f12492810e
173,860,213,732,039,300,000,000,000,000,000,000,000
24
rgw: RGWSwiftWebsiteHandler::is_web_dir checks empty subdir_name checking for empty name avoids later assertion in RGWObjectCtx::set_atomic Fixes: CVE-2021-3531 Reviewed-by: Casey Bodley <[email protected]> Signed-off-by: Casey Bodley <[email protected]> (cherry picked from commit 7196a469b4470f3c8628489df9a41ec8b00a5610)
void swap(String &inout, bool set_read_value) { if (set_read_value) read_value.swap(inout); else value.swap(inout); }
0
[ "CWE-416", "CWE-703" ]
server
08c7ab404f69d9c4ca6ca7a9cf7eec74c804f917
246,077,817,369,029,660,000,000,000,000,000,000,000
7
MDEV-24176 Server crashes after insert in the table with virtual column generated using date_format() and if() vcol_info->expr is allocated on expr_arena at parsing stage. Since expr item is allocated on expr_arena all its containee items must be allocated on expr_arena too. Otherwise fix_session_expr() will encounter prematurely freed item. When table is reopened from cache vcol_info contains stale expression. We refresh expression via TABLE::vcol_fix_exprs() but first we must prepare a proper context (Vcol_expr_context) which meets some requirements: 1. As noted above expr update must be done on expr_arena as there may be new items created. It was a bug in fix_session_expr_for_read() and was just not reproduced because of no second refix. Now refix is done for more cases so it does reproduce. Tests affected: vcol.binlog 2. Also name resolution context must be narrowed to the single table. Tested by: vcol.update main.default vcol.vcol_syntax gcol.gcol_bugfixes 3. sql_mode must be clean and not fail expr update. sql_mode such as MODE_NO_BACKSLASH_ESCAPES, MODE_NO_ZERO_IN_DATE, etc must not affect vcol expression update. If the table was created successfully any further evaluation must not fail. Tests affected: main.func_like Reviewed by: Sergei Golubchik <[email protected]>
mymono_metadata_type_hash (MonoType *t1) { guint hash; hash = t1->type; hash |= t1->byref << 6; /* do not collide with t1->type values */ switch (t1->type) { case MONO_TYPE_VALUETYPE: case MONO_TYPE_CLASS: case MONO_TYPE_SZARRAY: /* check if the distribution is good enough */ return ((hash << 5) - hash) ^ mono_aligned_addr_hash (t1->data.klass); case MONO_TYPE_PTR: return ((hash << 5) - hash) ^ mymono_metadata_type_hash (t1->data.type); case MONO_TYPE_GENERICINST: { int i; MonoGenericInst *inst = t1->data.generic_class->context.class_inst; hash += g_str_hash (t1->data.generic_class->container_class->name); hash *= 13; for (i = 0; i < inst->type_argc; ++i) { hash += mymono_metadata_type_hash (inst->type_argv [i]); hash *= 13; } return hash; } case MONO_TYPE_VAR: case MONO_TYPE_MVAR: return ((hash << 5) - hash) ^ GPOINTER_TO_UINT (t1->data.generic_param); } return hash; }
0
[ "CWE-20" ]
mono
65292a69c837b8a5f7a392d34db63de592153358
110,168,896,293,198,730,000,000,000,000,000,000,000
32
Handle invalid instantiation of generic methods. * verify.c: Add new function to internal verifier API to check method instantiations. * reflection.c (mono_reflection_bind_generic_method_parameters): Check the instantiation before returning it. Fixes #655847
static ulonglong read_rand_seed(THD *thd) { return 0; }
0
[ "CWE-264" ]
mysql-server
48bd8b16fe382be302c6f0b45931be5aa6f29a0e
279,028,344,501,754,330,000,000,000,000,000,000,000
4
Bug#24388753: PRIVILEGE ESCALATION USING MYSQLD_SAFE [This is the 5.5/5.6 version of the bugfix]. The problem was that it was possible to write log files ending in .ini/.cnf that later could be parsed as an options file. This made it possible for users to specify startup options without the permissions to do so. This patch fixes the problem by disallowing general query log and slow query log to be written to files ending in .ini and .cnf.
static void ieee80211_set_wakeup(struct wiphy *wiphy, bool enabled) { drv_set_wakeup(wiphy_priv(wiphy), enabled); }
0
[ "CWE-287" ]
linux
3e493173b7841259a08c5c8e5cbe90adb349da7e
133,163,752,536,865,800,000,000,000,000,000,000,000
4
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]>
ves_icall_System_Reflection_AssemblyName_ParseName (MonoReflectionAssemblyName *name, MonoString *assname) { MonoAssemblyName aname; MonoDomain *domain = mono_object_domain (name); char *val; gboolean is_version_defined; gboolean is_token_defined; aname.public_key = NULL; val = mono_string_to_utf8 (assname); if (!mono_assembly_name_parse_full (val, &aname, TRUE, &is_version_defined, &is_token_defined)) { g_free ((guint8*) aname.public_key); g_free (val); return FALSE; } fill_reflection_assembly_name (domain, name, &aname, "", is_version_defined, FALSE, is_token_defined); mono_assembly_name_free (&aname); g_free ((guint8*) aname.public_key); g_free (val); return TRUE; }
0
[ "CWE-264" ]
mono
035c8587c0d8d307e45f1b7171a0d337bb451f1e
176,269,501,837,740,760,000,000,000,000,000,000,000
25
Allow only primitive types/enums in RuntimeHelpers.InitializeArray ().
int X509_REQ_add1_attr_by_txt(X509_REQ *req, const char *attrname, int type, const unsigned char *bytes, int len) { if (X509at_add1_attr_by_txt(&req->req_info->attributes, attrname, type, bytes, len)) return 1; return 0; }
0
[]
openssl
28a00bcd8e318da18031b2ac8778c64147cd54f9
51,172,662,309,785,770,000,000,000,000,000,000,000
9
Check public key is not NULL. CVE-2015-0288 PR#3708 Reviewed-by: Matt Caswell <[email protected]>
CJSON_PUBLIC(cJSON *) cJSON_Duplicate(const cJSON *item, cJSON_bool recurse) { cJSON *newitem = NULL; cJSON *child = NULL; cJSON *next = NULL; cJSON *newchild = NULL; /* Bail on bad ptr */ if (!item) { goto fail; } /* Create new item */ newitem = cJSON_New_Item(&global_hooks); if (!newitem) { goto fail; } /* Copy over all vars */ newitem->type = item->type & (~cJSON_IsReference); newitem->valueint = item->valueint; newitem->valuedouble = item->valuedouble; if (item->valuestring) { newitem->valuestring = (char*)cJSON_strdup((unsigned char*)item->valuestring, &global_hooks); if (!newitem->valuestring) { goto fail; } } if (item->string) { newitem->string = (item->type&cJSON_StringIsConst) ? item->string : (char*)cJSON_strdup((unsigned char*)item->string, &global_hooks); if (!newitem->string) { goto fail; } } /* If non-recursive, then we're done! */ if (!recurse) { return newitem; } /* Walk the ->next chain for the child. */ child = item->child; while (child != NULL) { newchild = cJSON_Duplicate(child, true); /* Duplicate (with recurse) each item in the ->next chain */ if (!newchild) { goto fail; } if (next != NULL) { /* If newitem->child already set, then crosswire ->prev and ->next and move on */ next->next = newchild; newchild->prev = next; next = newchild; } else { /* Set newitem->child and move to it */ newitem->child = newchild; next = newchild; } child = child->next; } return newitem; fail: if (newitem != NULL) { cJSON_Delete(newitem); } return NULL; }
0
[ "CWE-754", "CWE-787" ]
cJSON
be749d7efa7c9021da746e685bd6dec79f9dd99b
253,138,147,419,965,470,000,000,000,000,000,000,000
78
Fix crash of cJSON_GetObjectItemCaseSensitive when calling it on arrays
static inline int sock_recvmsg_nosec(struct socket *sock, struct msghdr *msg, size_t size, int flags) { return sock->ops->recvmsg(sock, msg, size, flags); }
0
[ "CWE-241", "CWE-19" ]
linux
34b88a68f26a75e4fded796f1a49c40f82234b7d
158,091,488,800,486,660,000,000,000,000,000,000,000
5
net: Fix use after free in the recvmmsg exit path The syzkaller fuzzer hit the following use-after-free: Call Trace: [<ffffffff8175ea0e>] __asan_report_load8_noabort+0x3e/0x40 mm/kasan/report.c:295 [<ffffffff851cc31a>] __sys_recvmmsg+0x6fa/0x7f0 net/socket.c:2261 [< inline >] SYSC_recvmmsg net/socket.c:2281 [<ffffffff851cc57f>] SyS_recvmmsg+0x16f/0x180 net/socket.c:2270 [<ffffffff86332bb6>] entry_SYSCALL_64_fastpath+0x16/0x7a arch/x86/entry/entry_64.S:185 And, as Dmitry rightly assessed, that is because we can drop the reference and then touch it when the underlying recvmsg calls return some packets and then hit an error, which will make recvmmsg to set sock->sk->sk_err, oops, fix it. Reported-and-Tested-by: Dmitry Vyukov <[email protected]> Cc: Alexander Potapenko <[email protected]> Cc: Eric Dumazet <[email protected]> Cc: Kostya Serebryany <[email protected]> Cc: Sasha Levin <[email protected]> Fixes: a2e2725541fa ("net: Introduce recvmmsg socket syscall") http://lkml.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]> Signed-off-by: David S. Miller <[email protected]>
valid_civil_sub(int argc, VALUE *argv, VALUE klass, int need_jd) { VALUE nth, y; int m, d, ry, rm, rd; double sg; y = argv[0]; m = NUM2INT(argv[1]); d = NUM2INT(argv[2]); sg = NUM2DBL(argv[3]); valid_sg(sg); if (!need_jd && (guess_style(y, sg) < 0)) { if (!valid_gregorian_p(y, m, d, &nth, &ry, &rm, &rd)) return Qnil; return INT2FIX(0); /* dummy */ } else { int rjd, ns; VALUE rjd2; if (!valid_civil_p(y, m, d, sg, &nth, &ry, &rm, &rd, &rjd, &ns)) return Qnil; if (!need_jd) return INT2FIX(0); /* dummy */ encode_jd(nth, rjd, &rjd2); return rjd2; } }
0
[]
date
3959accef8da5c128f8a8e2fd54e932a4fb253b0
87,802,291,435,684,430,000,000,000,000,000,000,000
35
Add length limit option for methods that parses date strings `Date.parse` now raises an ArgumentError when a given date string is longer than 128. You can configure the limit by giving `limit` keyword arguments like `Date.parse(str, limit: 1000)`. If you pass `limit: nil`, the limit is disabled. Not only `Date.parse` but also the following methods are changed. * Date._parse * Date.parse * DateTime.parse * Date._iso8601 * Date.iso8601 * DateTime.iso8601 * Date._rfc3339 * Date.rfc3339 * DateTime.rfc3339 * Date._xmlschema * Date.xmlschema * DateTime.xmlschema * Date._rfc2822 * Date.rfc2822 * DateTime.rfc2822 * Date._rfc822 * Date.rfc822 * DateTime.rfc822 * Date._jisx0301 * Date.jisx0301 * DateTime.jisx0301
static int ext4_mb_seq_groups_show(struct seq_file *seq, void *v) { struct super_block *sb = seq->private; ext4_group_t group = (ext4_group_t) ((unsigned long) v); int i; int err, buddy_loaded = 0; struct ext4_buddy e4b; struct ext4_group_info *grinfo; unsigned char blocksize_bits = min_t(unsigned char, sb->s_blocksize_bits, EXT4_MAX_BLOCK_LOG_SIZE); struct sg { struct ext4_group_info info; ext4_grpblk_t counters[EXT4_MAX_BLOCK_LOG_SIZE + 2]; } sg; group--; if (group == 0) seq_puts(seq, "#group: free frags first [" " 2^0 2^1 2^2 2^3 2^4 2^5 2^6 " " 2^7 2^8 2^9 2^10 2^11 2^12 2^13 ]\n"); i = (blocksize_bits + 2) * sizeof(sg.info.bb_counters[0]) + sizeof(struct ext4_group_info); grinfo = ext4_get_group_info(sb, group); /* Load the group info in memory only if not already loaded. */ if (unlikely(EXT4_MB_GRP_NEED_INIT(grinfo))) { err = ext4_mb_load_buddy(sb, group, &e4b); if (err) { seq_printf(seq, "#%-5u: I/O error\n", group); return 0; } buddy_loaded = 1; } memcpy(&sg, ext4_get_group_info(sb, group), i); if (buddy_loaded) ext4_mb_unload_buddy(&e4b); seq_printf(seq, "#%-5u: %-5u %-5u %-5u [", group, sg.info.bb_free, sg.info.bb_fragments, sg.info.bb_first_free); for (i = 0; i <= 13; i++) seq_printf(seq, " %-5u", i <= blocksize_bits + 1 ? sg.info.bb_counters[i] : 0); seq_printf(seq, " ]\n"); return 0; }
0
[ "CWE-416" ]
linux
8844618d8aa7a9973e7b527d038a2a589665002c
93,445,435,879,169,670,000,000,000,000,000,000,000
50
ext4: only look at the bg_flags field if it is valid The bg_flags field in the block group descripts is only valid if the uninit_bg or metadata_csum feature is enabled. We were not consistently looking at this field; fix this. Also block group #0 must never have uninitialized allocation bitmaps, or need to be zeroed, since that's where the root inode, and other special inodes are set up. Check for these conditions and mark the file system as corrupted if they are detected. This addresses CVE-2018-10876. https://bugzilla.kernel.org/show_bug.cgi?id=199403 Signed-off-by: Theodore Ts'o <[email protected]> Cc: [email protected]
xmlSetEntityReferenceFunc(xmlEntityReferenceFunc func) { xmlEntityRefFunc = func; }
0
[ "CWE-125" ]
libxml2
77404b8b69bc122d12231807abf1a837d121b551
82,374,666,445,300,310,000,000,000,000,000,000,000
4
Make sure the parser returns when getting a Stop order patch backported from chromiun bug fixes, assuming author is Chris
pthread_once(pthread_once_t *once, void (*cb) (void)) { BOOL rc = InitOnceExecuteOnce(&once->once, _pthread_once_win32_cb, cb, NULL); if (rc == 0) return -1; else return 0; }
0
[ "CWE-703", "CWE-125" ]
portable
17c88164016df821df2dff4b2b1291291ec4f28a
316,508,688,537,506,000,000,000,000,000,000,000,000
8
Make pthread_mutex static initialisation work on Windows. This takes the dynamic initialisation code added to CRYPTO_lock() in e5081719 and applies it to the Window's pthread_mutex implementation. This allows for PTHREAD_MUTEX_INITIALIZER to be used on Windows. bcook has agreed to place this code in the public domain (as per the rest of the code in pthread.h).
static int x509_check_wildcard( const char *cn, mbedtls_x509_buf *name ) { size_t i; size_t cn_idx = 0, cn_len = strlen( cn ); if( name->len < 3 || name->p[0] != '*' || name->p[1] != '.' ) return( 0 ); for( i = 0; i < cn_len; ++i ) { if( cn[i] == '.' ) { cn_idx = i; break; } } if( cn_idx == 0 ) return( -1 ); if( cn_len - cn_idx == name->len - 1 && x509_memcasecmp( name->p + 1, cn + cn_idx, name->len - 1 ) == 0 ) { return( 0 ); } return( -1 ); }
0
[ "CWE-287", "CWE-284" ]
mbedtls
d15795acd5074e0b44e71f7ede8bdfe1b48591fc
235,466,675,074,510,330,000,000,000,000,000,000,000
28
Improve behaviour on fatal errors If we didn't walk the whole chain, then there may be any kind of errors in the part of the chain we didn't check, so setting all flags looks like the safe thing to do.
module_from_sym(mrb_state *mrb, struct RClass *klass, mrb_sym id) { mrb_value c = mrb_const_get(mrb, mrb_obj_value(klass), id); mrb_check_type(mrb, c, MRB_TT_MODULE); return mrb_class_ptr(c); }
0
[ "CWE-476", "CWE-415" ]
mruby
faa4eaf6803bd11669bc324b4c34e7162286bfa3
15,697,245,050,179,706,000,000,000,000,000,000,000
7
`mrb_class_real()` did not work for `BasicObject`; fix #4037
MagickExport unsigned char *GetStringInfoDatum(const StringInfo *string_info) { assert(string_info != (StringInfo *) NULL); assert(string_info->signature == MagickCoreSignature); return(string_info->datum); }
0
[ "CWE-190" ]
ImageMagick
be90a5395695f0d19479a5d46b06c678be7f7927
207,361,252,778,315,260,000,000,000,000,000,000,000
6
https://github.com/ImageMagick/ImageMagick/issues/1721
const char *crypt_keyslot_get_encryption(struct crypt_device *cd, int keyslot, size_t *key_size) { const char *cipher; if (!cd || !isLUKS(cd->type) || !key_size) return NULL; if (isLUKS1(cd->type)) { if (keyslot != CRYPT_ANY_SLOT && LUKS_keyslot_info(&cd->u.luks1.hdr, keyslot) < CRYPT_SLOT_ACTIVE) return NULL; *key_size = crypt_get_volume_key_size(cd); return cd->u.luks1.cipher_spec; } if (keyslot != CRYPT_ANY_SLOT) return LUKS2_get_keyslot_cipher(&cd->u.luks2.hdr, keyslot, key_size); /* Keyslot encryption was set through crypt_keyslot_set_encryption() */ if (cd->u.luks2.keyslot_cipher) { *key_size = cd->u.luks2.keyslot_key_size; return cd->u.luks2.keyslot_cipher; } /* Try to reuse volume encryption parameters */ cipher = LUKS2_get_cipher(&cd->u.luks2.hdr, CRYPT_DEFAULT_SEGMENT); if (!LUKS2_keyslot_cipher_incompatible(cd, cipher)) { *key_size = crypt_get_volume_key_size(cd); if (*key_size) return cipher; } /* Fallback to default LUKS2 keyslot encryption */ *key_size = DEFAULT_LUKS2_KEYSLOT_KEYBITS / 8; return DEFAULT_LUKS2_KEYSLOT_CIPHER; }
0
[ "CWE-345" ]
cryptsetup
0113ac2d889c5322659ad0596d4cfc6da53e356c
125,548,204,825,461,360,000,000,000,000,000,000,000
36
Fix CVE-2021-4122 - LUKS2 reencryption crash recovery attack Fix possible attacks against data confidentiality through LUKS2 online reencryption extension crash recovery. An attacker can modify on-disk metadata to simulate decryption in progress with crashed (unfinished) reencryption step and persistently decrypt part of the LUKS device. This attack requires repeated physical access to the LUKS device but no knowledge of user passphrases. The decryption step is performed after a valid user activates the device with a correct passphrase and modified metadata. There are no visible warnings for the user that such recovery happened (except using the luksDump command). The attack can also be reversed afterward (simulating crashed encryption from a plaintext) with possible modification of revealed plaintext. The problem was caused by reusing a mechanism designed for actual reencryption operation without reassessing the security impact for new encryption and decryption operations. While the reencryption requires calculating and verifying both key digests, no digest was needed to initiate decryption recovery if the destination is plaintext (no encryption key). Also, some metadata (like encryption cipher) is not protected, and an attacker could change it. Note that LUKS2 protects visible metadata only when a random change occurs. It does not protect against intentional modification but such modification must not cause a violation of data confidentiality. The fix introduces additional digest protection of reencryption metadata. The digest is calculated from known keys and critical reencryption metadata. Now an attacker cannot create correct metadata digest without knowledge of a passphrase for used keyslots. For more details, see LUKS2 On-Disk Format Specification version 1.1.0.
TfLiteStatus Prepare(TfLiteContext* context, TfLiteNode* node) { TF_LITE_ENSURE(context, NumInputs(node) == 1 || NumInputs(node) == 2); TF_LITE_ENSURE_EQ(context, NumOutputs(node), 1); // Always postpone sizing string tensors, even if we could in principle // calculate their shapes now. String tensors don't benefit from having their // shapes precalculated because the actual memory can only be allocated after // we know all the content. TfLiteTensor* output; TF_LITE_ENSURE_OK(context, GetOutputSafe(context, node, kOutputTensor, &output)); if (output->type != kTfLiteString) { if (NumInputs(node) == 1 || IsConstantTensor(GetInput(context, node, kShapeTensor))) { TF_LITE_ENSURE_OK(context, ResizeOutput(context, node)); } else { SetTensorToDynamic(output); } } return kTfLiteOk; }
0
[ "CWE-125", "CWE-787" ]
tensorflow
1970c2158b1ffa416d159d03c3370b9a462aee35
156,789,231,000,335,080,000,000,000,000,000,000,000
21
[tflite]: Insert `nullptr` checks when obtaining tensors. As part of ongoing refactoring, `tflite::GetInput`, `tflite::GetOutput`, `tflite::GetTemporary` and `tflite::GetIntermediates` will return `nullptr` in some cases. Hence, we insert the `nullptr` checks on all usages. We also insert `nullptr` checks on usages of `tflite::GetVariableInput` and `tflite::GetOptionalInputTensor` but only in the cases where there is no obvious check that `nullptr` is acceptable (that is, we only insert the check for the output of these two functions if the tensor is accessed as if it is always not `nullptr`). PiperOrigin-RevId: 332521299 Change-Id: I29af455bcb48d0b92e58132d951a3badbd772d56
static int register_leaf_sysctl_tables(const char *path, char *pos, struct ctl_table_header ***subheader, struct ctl_table_set *set, struct ctl_table *table) { struct ctl_table *ctl_table_arg = NULL; struct ctl_table *entry, *files; int nr_files = 0; int nr_dirs = 0; int err = -ENOMEM; for (entry = table; entry->procname; entry++) { if (entry->child) nr_dirs++; else nr_files++; } files = table; /* If there are mixed files and directories we need a new table */ if (nr_dirs && nr_files) { struct ctl_table *new; files = kzalloc(sizeof(struct ctl_table) * (nr_files + 1), GFP_KERNEL); if (!files) goto out; ctl_table_arg = files; for (new = files, entry = table; entry->procname; entry++) { if (entry->child) continue; *new = *entry; new++; } } /* Register everything except a directory full of subdirectories */ if (nr_files || !nr_dirs) { struct ctl_table_header *header; header = __register_sysctl_table(set, path, files); if (!header) { kfree(ctl_table_arg); goto out; } /* Remember if we need to free the file table */ header->ctl_table_arg = ctl_table_arg; **subheader = header; (*subheader)++; } /* Recurse into the subdirectories. */ for (entry = table; entry->procname; entry++) { char *child_pos; if (!entry->child) continue; err = -ENAMETOOLONG; child_pos = append_path(path, pos, entry->procname); if (!child_pos) goto out; err = register_leaf_sysctl_tables(path, child_pos, subheader, set, entry->child); pos[0] = '\0'; if (err) goto out; } err = 0; out: /* On failure our caller will unregister all registered subheaders */ return err; }
0
[ "CWE-20", "CWE-399" ]
linux
93362fa47fe98b62e4a34ab408c4a418432e7939
52,242,753,930,892,310,000,000,000,000,000,000,000
73
sysctl: Drop reference added by grab_header in proc_sys_readdir Fixes CVE-2016-9191, proc_sys_readdir doesn't drop reference added by grab_header when return from !dir_emit_dots path. It can cause any path called unregister_sysctl_table will wait forever. The calltrace of CVE-2016-9191: [ 5535.960522] Call Trace: [ 5535.963265] [<ffffffff817cdaaf>] schedule+0x3f/0xa0 [ 5535.968817] [<ffffffff817d33fb>] schedule_timeout+0x3db/0x6f0 [ 5535.975346] [<ffffffff817cf055>] ? wait_for_completion+0x45/0x130 [ 5535.982256] [<ffffffff817cf0d3>] wait_for_completion+0xc3/0x130 [ 5535.988972] [<ffffffff810d1fd0>] ? wake_up_q+0x80/0x80 [ 5535.994804] [<ffffffff8130de64>] drop_sysctl_table+0xc4/0xe0 [ 5536.001227] [<ffffffff8130de17>] drop_sysctl_table+0x77/0xe0 [ 5536.007648] [<ffffffff8130decd>] unregister_sysctl_table+0x4d/0xa0 [ 5536.014654] [<ffffffff8130deff>] unregister_sysctl_table+0x7f/0xa0 [ 5536.021657] [<ffffffff810f57f5>] unregister_sched_domain_sysctl+0x15/0x40 [ 5536.029344] [<ffffffff810d7704>] partition_sched_domains+0x44/0x450 [ 5536.036447] [<ffffffff817d0761>] ? __mutex_unlock_slowpath+0x111/0x1f0 [ 5536.043844] [<ffffffff81167684>] rebuild_sched_domains_locked+0x64/0xb0 [ 5536.051336] [<ffffffff8116789d>] update_flag+0x11d/0x210 [ 5536.057373] [<ffffffff817cf61f>] ? mutex_lock_nested+0x2df/0x450 [ 5536.064186] [<ffffffff81167acb>] ? cpuset_css_offline+0x1b/0x60 [ 5536.070899] [<ffffffff810fce3d>] ? trace_hardirqs_on+0xd/0x10 [ 5536.077420] [<ffffffff817cf61f>] ? mutex_lock_nested+0x2df/0x450 [ 5536.084234] [<ffffffff8115a9f5>] ? css_killed_work_fn+0x25/0x220 [ 5536.091049] [<ffffffff81167ae5>] cpuset_css_offline+0x35/0x60 [ 5536.097571] [<ffffffff8115aa2c>] css_killed_work_fn+0x5c/0x220 [ 5536.104207] [<ffffffff810bc83f>] process_one_work+0x1df/0x710 [ 5536.110736] [<ffffffff810bc7c0>] ? process_one_work+0x160/0x710 [ 5536.117461] [<ffffffff810bce9b>] worker_thread+0x12b/0x4a0 [ 5536.123697] [<ffffffff810bcd70>] ? process_one_work+0x710/0x710 [ 5536.130426] [<ffffffff810c3f7e>] kthread+0xfe/0x120 [ 5536.135991] [<ffffffff817d4baf>] ret_from_fork+0x1f/0x40 [ 5536.142041] [<ffffffff810c3e80>] ? kthread_create_on_node+0x230/0x230 One cgroup maintainer mentioned that "cgroup is trying to offline a cpuset css, which takes place under cgroup_mutex. The offlining ends up trying to drain active usages of a sysctl table which apprently is not happening." The real reason is that proc_sys_readdir doesn't drop reference added by grab_header when return from !dir_emit_dots path. So this cpuset offline path will wait here forever. See here for details: http://www.openwall.com/lists/oss-security/2016/11/04/13 Fixes: f0c3b5093add ("[readdir] convert procfs") Cc: [email protected] Reported-by: CAI Qian <[email protected]> Tested-by: Yang Shukui <[email protected]> Signed-off-by: Zhou Chengming <[email protected]> Acked-by: Al Viro <[email protected]> Signed-off-by: Eric W. Biederman <[email protected]>
void Magick::Image::orientation(const Magick::OrientationType orientation_) { modifyImage(); image()->orientation=orientation_; }
0
[ "CWE-416" ]
ImageMagick
8c35502217c1879cb8257c617007282eee3fe1cc
265,878,243,562,911,080,000,000,000,000,000,000,000
5
Added missing return to avoid use after free.
u16 capi20_get_manufacturer(u32 contr, u8 buf[CAPI_MANUFACTURER_LEN]) { struct capi_ctr *ctr; u16 ret; if (contr == 0) { strncpy(buf, capi_manufakturer, CAPI_MANUFACTURER_LEN); return CAPI_NOERROR; } mutex_lock(&capi_controller_lock); ctr = get_capi_ctr_by_nr(contr); if (ctr && ctr->state == CAPI_CTR_RUNNING) { strncpy(buf, ctr->manu, CAPI_MANUFACTURER_LEN); ret = CAPI_NOERROR; } else ret = CAPI_REGNOTINSTALLED; mutex_unlock(&capi_controller_lock); return ret; }
0
[ "CWE-125" ]
linux
1f3e2e97c003f80c4b087092b225c8787ff91e4d
57,355,320,483,749,460,000,000,000,000,000,000,000
22
isdn: cpai: check ctr->cnr to avoid array index out of bound The cmtp_add_connection() would add a cmtp session to a controller and run a kernel thread to process cmtp. __module_get(THIS_MODULE); session->task = kthread_run(cmtp_session, session, "kcmtpd_ctr_%d", session->num); During this process, the kernel thread would call detach_capi_ctr() to detach a register controller. if the controller was not attached yet, detach_capi_ctr() would trigger an array-index-out-bounds bug. [ 46.866069][ T6479] UBSAN: array-index-out-of-bounds in drivers/isdn/capi/kcapi.c:483:21 [ 46.867196][ T6479] index -1 is out of range for type 'capi_ctr *[32]' [ 46.867982][ T6479] CPU: 1 PID: 6479 Comm: kcmtpd_ctr_0 Not tainted 5.15.0-rc2+ #8 [ 46.869002][ T6479] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.14.0-2 04/01/2014 [ 46.870107][ T6479] Call Trace: [ 46.870473][ T6479] dump_stack_lvl+0x57/0x7d [ 46.870974][ T6479] ubsan_epilogue+0x5/0x40 [ 46.871458][ T6479] __ubsan_handle_out_of_bounds.cold+0x43/0x48 [ 46.872135][ T6479] detach_capi_ctr+0x64/0xc0 [ 46.872639][ T6479] cmtp_session+0x5c8/0x5d0 [ 46.873131][ T6479] ? __init_waitqueue_head+0x60/0x60 [ 46.873712][ T6479] ? cmtp_add_msgpart+0x120/0x120 [ 46.874256][ T6479] kthread+0x147/0x170 [ 46.874709][ T6479] ? set_kthread_struct+0x40/0x40 [ 46.875248][ T6479] ret_from_fork+0x1f/0x30 [ 46.875773][ T6479] Signed-off-by: Xiaolong Huang <[email protected]> Acked-by: Arnd Bergmann <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
static char *oidc_make_sid_iss_unique(request_rec *r, const char *sid, const char *issuer) { return apr_psprintf(r->pool, "%s@%s", sid, issuer); }
0
[ "CWE-601" ]
mod_auth_openidc
5c15dfb08106c2451c2c44ce7ace6813c216ba75
326,905,977,568,244,840,000,000,000,000,000,000,000
4
improve validation of the post-logout URL; closes #449 - to avoid an open redirect; thanks AIMOTO Norihito - release 2.4.0.1 Signed-off-by: Hans Zandbelt <[email protected]>
static int ModuleInfoCompare(const void *x,const void *y) { const ModuleInfo **p, **q; p=(const ModuleInfo **) x, q=(const ModuleInfo **) y; if (LocaleCompare((*p)->path,(*q)->path) == 0) return(LocaleCompare((*p)->tag,(*q)->tag)); return(LocaleCompare((*p)->path,(*q)->path)); }
0
[ "CWE-200", "CWE-362" ]
ImageMagick
01faddbe2711a4156180c4a92837e2f23683cc68
63,817,263,523,530,700,000,000,000,000,000,000,000
12
Use the correct rights.
static apr_status_t ap_session_set(request_rec * r, session_rec * z, const char *key, const char *value) { if (!z) { apr_status_t rv; rv = ap_session_load(r, &z); if (APR_SUCCESS != rv) { return rv; } } if (z) { if (value) { apr_table_set(z->entries, key, value); } else { apr_table_unset(z->entries, key); } z->dirty = 1; } return APR_SUCCESS; }
0
[ "CWE-476" ]
httpd
67bd9bfe6c38831e14fe7122f1d84391472498f8
70,572,836,848,518,570,000,000,000,000,000,000,000
21
mod_session: save one apr_strtok() in session_identity_decode(). When the encoding is invalid (missing '='), no need to parse further. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1887050 13f79535-47bb-0310-9956-ffa450edef68
static void rose_destroy_timer(unsigned long data) { rose_destroy_socket((struct sock *)data); }
0
[ "CWE-200" ]
linux-2.6
17ac2e9c58b69a1e25460a568eae1b0dc0188c25
34,214,554,152,433,350,000,000,000,000,000,000,000
4
rose: Fix rose_getname() leak rose_getname() can leak kernel memory to user. Signed-off-by: Eric Dumazet <[email protected]> Signed-off-by: David S. Miller <[email protected]>
gdata_service_class_init (GDataServiceClass *klass) { GObjectClass *gobject_class = G_OBJECT_CLASS (klass); g_type_class_add_private (klass, sizeof (GDataServicePrivate)); gobject_class->set_property = gdata_service_set_property; gobject_class->get_property = gdata_service_get_property; gobject_class->dispose = gdata_service_dispose; gobject_class->finalize = gdata_service_finalize; klass->api_version = "2"; klass->feed_type = GDATA_TYPE_FEED; klass->append_query_headers = real_append_query_headers; klass->parse_error_response = real_parse_error_response; klass->get_authorization_domains = NULL; /* equivalent to returning an empty list of domains */ /** * GDataService:proxy-uri: * * The proxy URI used internally for all network requests. * * Note that if a #GDataAuthorizer is being used with this #GDataService, the authorizer might also need its proxy URI setting. * * Since: 0.2.0 **/ g_object_class_install_property (gobject_class, PROP_PROXY_URI, g_param_spec_boxed ("proxy-uri", "Proxy URI", "The proxy URI used internally for all network requests.", SOUP_TYPE_URI, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); /** * GDataService:timeout: * * A timeout, in seconds, for network operations. If the timeout is exceeded, the operation will be cancelled and * %GDATA_SERVICE_ERROR_NETWORK_ERROR will be returned. * * If the timeout is <code class="literal">0</code>, operations will never time out. * * Note that if a #GDataAuthorizer is being used with this #GDataService, the authorizer might also need its timeout setting. * * Since: 0.7.0 **/ g_object_class_install_property (gobject_class, PROP_TIMEOUT, g_param_spec_uint ("timeout", "Timeout", "A timeout, in seconds, for network operations.", 0, G_MAXUINT, 0, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); /** * GDataService:locale: * * The locale to use for network requests, in Unix locale format. (e.g. "en_GB", "cs", "de_DE".) Use %NULL for the default "C" locale * (typically "en_US"). * * Typically, this locale will be used by the server-side software to localise results, such as by translating category names, or by choosing * geographically relevant search results. This will vary from service to service. * * The server-side behaviour is undefined if it doesn't support a given locale. * * Since: 0.7.0 **/ g_object_class_install_property (gobject_class, PROP_LOCALE, g_param_spec_string ("locale", "Locale", "The locale to use for network requests, in Unix locale format.", NULL, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); /** * GDataService:authorizer: * * An object which implements #GDataAuthorizer. This should have previously been authenticated authorized against this service type (and * potentially other service types). The service will use the authorizer to add an authorization token to each request it performs. * * Your application should call methods on the #GDataAuthorizer object itself in order to authenticate with the Google accounts service and * authorize against this service type. See the documentation for the particular #GDataAuthorizer implementation being used for more details. * * The authorizer for a service can be changed at runtime for a different #GDataAuthorizer object or %NULL without affecting ongoing requests * and operations. * * Note that it's only necessary to set an authorizer on the service if your application is going to make requests of the service which * require authorization. For example, listing the current most popular videos on YouTube does not require authorization, but uploading a * video to YouTube does. It's an unnecessary overhead to require the user to authorize against a service when not strictly required. * * Since: 0.9.0 **/ g_object_class_install_property (gobject_class, PROP_AUTHORIZER, g_param_spec_object ("authorizer", "Authorizer", "An authorizer object to provide an authorization token for each request.", GDATA_TYPE_AUTHORIZER, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); }
0
[ "CWE-20" ]
libgdata
6799f2c525a584dc998821a6ce897e463dad7840
305,148,381,969,344,320,000,000,000,000,000,000,000
93
core: Validate SSL certificates for all connections This prevents MitM attacks which use spoofed SSL certificates. Note that this bumps our libsoup requirement to 2.37.91. Closes: https://bugzilla.gnome.org/show_bug.cgi?id=671535
static void test_store_result2() { MYSQL_STMT *stmt; int rc; int nData; ulong length; MYSQL_BIND my_bind[1]; char query[MAX_TEST_QUERY_LENGTH]; myheader("test_store_result2"); rc= mysql_query(mysql, "DROP TABLE IF EXISTS test_store_result"); myquery(rc); rc= mysql_query(mysql, "CREATE TABLE test_store_result(col1 int , col2 varchar(50))"); myquery(rc); rc= mysql_query(mysql, "INSERT INTO test_store_result VALUES(10, 'venu'), (20, 'mysql')"); myquery(rc); rc= mysql_query(mysql, "INSERT INTO test_store_result(col2) VALUES('monty')"); myquery(rc); rc= mysql_commit(mysql); myquery(rc); /* We need to bzero bind structure because mysql_stmt_bind_param checks all its members. */ bzero((char*) my_bind, sizeof(my_bind)); my_bind[0].buffer_type= MYSQL_TYPE_LONG; my_bind[0].buffer= (void *) &nData; /* integer data */ my_bind[0].length= &length; my_bind[0].is_null= 0; strmov((char *)query , "SELECT col1 FROM test_store_result where col1= ?"); stmt= mysql_simple_prepare(mysql, query); check_stmt(stmt); rc= mysql_stmt_bind_param(stmt, my_bind); check_execute(stmt, rc); rc= mysql_stmt_bind_result(stmt, my_bind); check_execute(stmt, rc); nData= 10; length= 0; rc= mysql_stmt_execute(stmt); check_execute(stmt, rc); nData= 0; rc= mysql_stmt_store_result(stmt); check_execute(stmt, rc); rc= mysql_stmt_fetch(stmt); check_execute(stmt, rc); if (!opt_silent) fprintf(stdout, "\n row 1: %d", nData); DIE_UNLESS(nData == 10); rc= mysql_stmt_fetch(stmt); DIE_UNLESS(rc == MYSQL_NO_DATA); nData= 20; rc= mysql_stmt_execute(stmt); check_execute(stmt, rc); nData= 0; rc= mysql_stmt_store_result(stmt); check_execute(stmt, rc); rc= mysql_stmt_fetch(stmt); check_execute(stmt, rc); if (!opt_silent) fprintf(stdout, "\n row 1: %d", nData); DIE_UNLESS(nData == 20); rc= mysql_stmt_fetch(stmt); DIE_UNLESS(rc == MYSQL_NO_DATA); mysql_stmt_close(stmt); }
0
[ "CWE-416" ]
server
eef21014898d61e77890359d6546d4985d829ef6
31,078,837,527,073,960,000,000,000,000,000,000,000
84
MDEV-11933 Wrong usage of linked list in mysql_prune_stmt_list mysql_prune_stmt_list() was walking the list following element->next pointers, but inside the loop it was invoking list_add(element) that modified element->next. So, mysql_prune_stmt_list() failed to visit and reset all elements, and some of them were left with pointers to invalid MYSQL.
void ConnectionManagerImpl::ActiveStream::traceRequest() { Tracing::Decision tracing_decision = Tracing::HttpTracerUtility::isTracing(stream_info_, *request_headers_); ConnectionManagerImpl::chargeTracingStats(tracing_decision.reason, connection_manager_.config_.tracingStats()); active_span_ = connection_manager_.tracer().startSpan(*this, *request_headers_, stream_info_, tracing_decision); if (!active_span_) { return; } // TODO: Need to investigate the following code based on the cached route, as may // be broken in the case a filter changes the route. // If a decorator has been defined, apply it to the active span. if (hasCachedRoute() && cached_route_.value()->decorator()) { cached_route_.value()->decorator()->apply(*active_span_); // Cache decorated operation. if (!cached_route_.value()->decorator()->getOperation().empty()) { decorated_operation_ = &cached_route_.value()->decorator()->getOperation(); } } if (connection_manager_.config_.tracingConfig()->operation_name_ == Tracing::OperationName::Egress) { // For egress (outbound) requests, pass the decorator's operation name (if defined) // as a request header to enable the receiving service to use it in its server span. if (decorated_operation_) { request_headers_->insertEnvoyDecoratorOperation().value(*decorated_operation_); } } else { const HeaderEntry* req_operation_override = request_headers_->EnvoyDecoratorOperation(); // For ingress (inbound) requests, if a decorator operation name has been provided, it // should be used to override the active span's operation. if (req_operation_override) { if (!req_operation_override->value().empty()) { active_span_->setOperation(req_operation_override->value().getStringView()); // Clear the decorated operation so won't be used in the response header, as // it has been overridden by the inbound decorator operation request header. decorated_operation_ = nullptr; } // Remove header so not propagated to service request_headers_->removeEnvoyDecoratorOperation(); } } }
0
[ "CWE-400", "CWE-703" ]
envoy
afc39bea36fd436e54262f150c009e8d72db5014
246,963,321,179,590,800,000,000,000,000,000,000,000
51
Track byteSize of HeaderMap internally. Introduces a cached byte size updated internally in HeaderMap. The value is stored as an optional, and is cleared whenever a non-const pointer or reference to a HeaderEntry is accessed. The cached value can be set with refreshByteSize() which performs an iteration over the HeaderMap to sum the size of each key and value in the HeaderMap. Signed-off-by: Asra Ali <[email protected]>
and_code_range_buf(BBuf* bbuf1, int not1, BBuf* bbuf2, int not2, BBuf** pbuf, ScanEnv* env) { int r; OnigCodePoint i, j, n1, n2, *data1, *data2; OnigCodePoint from, to, from1, to1, from2, to2; *pbuf = (BBuf* )NULL; if (IS_NULL(bbuf1)) { if (not1 != 0 && IS_NOT_NULL(bbuf2)) /* not1 != 0 -> not2 == 0 */ return bbuf_clone(pbuf, bbuf2); return 0; } else if (IS_NULL(bbuf2)) { if (not2 != 0) return bbuf_clone(pbuf, bbuf1); return 0; } if (not1 != 0) SWAP_BBUF_NOT(bbuf1, not1, bbuf2, not2); data1 = (OnigCodePoint* )(bbuf1->p); data2 = (OnigCodePoint* )(bbuf2->p); GET_CODE_POINT(n1, data1); GET_CODE_POINT(n2, data2); data1++; data2++; if (not2 == 0 && not1 == 0) { /* 1 AND 2 */ for (i = 0; i < n1; i++) { from1 = data1[i*2]; to1 = data1[i*2+1]; for (j = 0; j < n2; j++) { from2 = data2[j*2]; to2 = data2[j*2+1]; if (from2 > to1) break; if (to2 < from1) continue; from = MAX(from1, from2); to = MIN(to1, to2); r = add_code_range_to_buf(pbuf, env, from, to); if (r != 0) return r; } } } else if (not1 == 0) { /* 1 AND (not 2) */ for (i = 0; i < n1; i++) { from1 = data1[i*2]; to1 = data1[i*2+1]; r = and_code_range1(pbuf, env, from1, to1, data2, n2); if (r != 0) return r; } } return 0; }
0
[ "CWE-476" ]
Onigmo
00cc7e28a3ed54b3b512ef3b58ea737a57acf1f9
134,727,828,308,209,350,000,000,000,000,000,000,000
55
Fix SEGV in onig_error_code_to_str() (Fix #132) When onig_new(ONIG_SYNTAX_PERL) fails with ONIGERR_INVALID_GROUP_NAME, onig_error_code_to_str() crashes. onig_scan_env_set_error_string() should have been used when returning ONIGERR_INVALID_GROUP_NAME.
int ssl_set_hostname( ssl_context *ssl, const char *hostname ) { if( hostname == NULL ) return( POLARSSL_ERR_SSL_BAD_INPUT_DATA ); ssl->hostname_len = strlen( hostname ); if( ssl->hostname_len + 1 == 0 ) return( POLARSSL_ERR_SSL_BAD_INPUT_DATA ); ssl->hostname = polarssl_malloc( ssl->hostname_len + 1 ); if( ssl->hostname == NULL ) return( POLARSSL_ERR_SSL_MALLOC_FAILED ); memcpy( ssl->hostname, (const unsigned char *) hostname, ssl->hostname_len ); ssl->hostname[ssl->hostname_len] = '\0'; return( 0 ); }
1
[ "CWE-119" ]
mbedtls
c988f32adde62a169ba340fee0da15aecd40e76e
17,760,485,365,085,817,000,000,000,000,000,000,000
22
Added max length checking of hostname
xfs_vn_getattr( const struct path *path, struct kstat *stat, u32 request_mask, unsigned int query_flags) { struct inode *inode = d_inode(path->dentry); struct xfs_inode *ip = XFS_I(inode); struct xfs_mount *mp = ip->i_mount; trace_xfs_getattr(ip); if (XFS_FORCED_SHUTDOWN(mp)) return -EIO; stat->size = XFS_ISIZE(ip); stat->dev = inode->i_sb->s_dev; stat->mode = inode->i_mode; stat->nlink = inode->i_nlink; stat->uid = inode->i_uid; stat->gid = inode->i_gid; stat->ino = ip->i_ino; stat->atime = inode->i_atime; stat->mtime = inode->i_mtime; stat->ctime = inode->i_ctime; stat->blocks = XFS_FSB_TO_BB(mp, ip->i_d.di_nblocks + ip->i_delayed_blks); if (ip->i_d.di_version == 3) { if (request_mask & STATX_BTIME) { stat->result_mask |= STATX_BTIME; stat->btime.tv_sec = ip->i_d.di_crtime.t_sec; stat->btime.tv_nsec = ip->i_d.di_crtime.t_nsec; } } /* * Note: If you add another clause to set an attribute flag, please * update attributes_mask below. */ if (ip->i_d.di_flags & XFS_DIFLAG_IMMUTABLE) stat->attributes |= STATX_ATTR_IMMUTABLE; if (ip->i_d.di_flags & XFS_DIFLAG_APPEND) stat->attributes |= STATX_ATTR_APPEND; if (ip->i_d.di_flags & XFS_DIFLAG_NODUMP) stat->attributes |= STATX_ATTR_NODUMP; stat->attributes_mask |= (STATX_ATTR_IMMUTABLE | STATX_ATTR_APPEND | STATX_ATTR_NODUMP); switch (inode->i_mode & S_IFMT) { case S_IFBLK: case S_IFCHR: stat->blksize = BLKDEV_IOSIZE; stat->rdev = inode->i_rdev; break; default: if (XFS_IS_REALTIME_INODE(ip)) { /* * If the file blocks are being allocated from a * realtime volume, then return the inode's realtime * extent size or the realtime volume's extent size. */ stat->blksize = xfs_get_extsz_hint(ip) << mp->m_sb.sb_blocklog; } else stat->blksize = xfs_preferred_iosize(mp); stat->rdev = 0; break; } return 0; }
0
[ "CWE-400", "CWE-399", "CWE-703" ]
linux
1fb254aa983bf190cfd685d40c64a480a9bafaee
138,886,160,463,989,380,000,000,000,000,000,000,000
74
xfs: fix missing ILOCK unlock when xfs_setattr_nonsize fails due to EDQUOT Benjamin Moody reported to Debian that XFS partially wedges when a chgrp fails on account of being out of disk quota. I ran his reproducer script: # adduser dummy # adduser dummy plugdev # dd if=/dev/zero bs=1M count=100 of=test.img # mkfs.xfs test.img # mount -t xfs -o gquota test.img /mnt # mkdir -p /mnt/dummy # chown -c dummy /mnt/dummy # xfs_quota -xc 'limit -g bsoft=100k bhard=100k plugdev' /mnt (and then as user dummy) $ dd if=/dev/urandom bs=1M count=50 of=/mnt/dummy/foo $ chgrp plugdev /mnt/dummy/foo and saw: ================================================ WARNING: lock held when returning to user space! 5.3.0-rc5 #rc5 Tainted: G W ------------------------------------------------ chgrp/47006 is leaving the kernel with locks still held! 1 lock held by chgrp/47006: #0: 000000006664ea2d (&xfs_nondir_ilock_class){++++}, at: xfs_ilock+0xd2/0x290 [xfs] ...which is clearly caused by xfs_setattr_nonsize failing to unlock the ILOCK after the xfs_qm_vop_chown_reserve call fails. Add the missing unlock. Reported-by: [email protected] Fixes: 253f4911f297 ("xfs: better xfs_trans_alloc interface") Signed-off-by: Darrick J. Wong <[email protected]> Reviewed-by: Dave Chinner <[email protected]> Tested-by: Salvatore Bonaccorso <[email protected]>
void nfs_retry_commit(struct list_head *page_list, struct pnfs_layout_segment *lseg, struct nfs_commit_info *cinfo) { struct nfs_page *req; while (!list_empty(page_list)) { req = nfs_list_entry(page_list->next); nfs_list_remove_request(req); nfs_mark_request_commit(req, lseg, cinfo); if (!cinfo->dreq) { dec_zone_page_state(req->wb_page, NR_UNSTABLE_NFS); dec_bdi_stat(page_file_mapping(req->wb_page)->backing_dev_info, BDI_RECLAIMABLE); } nfs_unlock_and_release_request(req); } }
0
[]
linux
c7559663e42f4294ffe31fe159da6b6a66b35d61
119,747,259,383,663,740,000,000,000,000,000,000,000
18
NFS: Allow nfs_updatepage to extend a write under additional circumstances Currently nfs_updatepage allows a write to be extended to cover a full page only if we don't have a byte range lock lock on the file... but if we have a write delegation on the file or if we have the whole file locked for writing then we should be allowed to extend the write as well. Signed-off-by: Scott Mayhew <[email protected]> [Trond: fix up call to nfs_have_delegation()] Signed-off-by: Trond Myklebust <[email protected]>
ecb_ews_get_timezone_from_ical_component (ECalBackendEws *cbews, icalcomponent *icalcomp) { ETimezoneCache *timezone_cache; icalproperty *prop = NULL; const gchar *tzid = NULL; timezone_cache = E_TIMEZONE_CACHE (cbews); prop = icalcomponent_get_first_property (icalcomp, ICAL_DTSTART_PROPERTY); if (prop != NULL) { icalparameter *param = NULL; param = icalproperty_get_first_parameter (prop, ICAL_TZID_PARAMETER); if (param) { tzid = icalparameter_get_tzid (param); } else { struct icaltimetype dtstart; dtstart = icalproperty_get_dtstart (prop); if (icaltime_is_utc (dtstart)) tzid = "UTC"; } } if (tzid) return e_timezone_cache_get_timezone (timezone_cache, tzid); return NULL; }
0
[ "CWE-295" ]
evolution-ews
915226eca9454b8b3e5adb6f2fff9698451778de
82,290,324,826,346,995,000,000,000,000,000,000,000
30
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
__recover_probed_insn(kprobe_opcode_t *buf, unsigned long addr) { struct kprobe *kp; unsigned long faddr; kp = get_kprobe((void *)addr); faddr = ftrace_location(addr); /* * Addresses inside the ftrace location are refused by * arch_check_ftrace_location(). Something went terribly wrong * if such an address is checked here. */ if (WARN_ON(faddr && faddr != addr)) return 0UL; /* * Use the current code if it is not modified by Kprobe * and it cannot be modified by ftrace. */ if (!kp && !faddr) return addr; /* * Basically, kp->ainsn.insn has an original instruction. * However, RIP-relative instruction can not do single-stepping * at different place, __copy_instruction() tweaks the displacement of * that instruction. In that case, we can't recover the instruction * from the kp->ainsn.insn. * * On the other hand, in case on normal Kprobe, kp->opcode has a copy * of the first byte of the probed instruction, which is overwritten * by int3. And the instruction at kp->addr is not modified by kprobes * except for the first byte, we can recover the original instruction * from it and kp->opcode. * * In case of Kprobes using ftrace, we do not have a copy of * the original instruction. In fact, the ftrace location might * be modified at anytime and even could be in an inconsistent state. * Fortunately, we know that the original code is the ideal 5-byte * long NOP. */ memcpy(buf, (void *)addr, MAX_INSN_SIZE * sizeof(kprobe_opcode_t)); if (faddr) memcpy(buf, ideal_nops[NOP_ATOMIC5], 5); else buf[0] = kp->opcode; return (unsigned long)buf; }
0
[ "CWE-264" ]
linux
548acf19234dbda5a52d5a8e7e205af46e9da840
184,438,315,573,344,700,000,000,000,000,000,000,000
47
x86/mm: Expand the exception table logic to allow new handling options Huge amounts of help from Andy Lutomirski and Borislav Petkov to produce this. Andy provided the inspiration to add classes to the exception table with a clever bit-squeezing trick, Boris pointed out how much cleaner it would all be if we just had a new field. Linus Torvalds blessed the expansion with: ' I'd rather not be clever in order to save just a tiny amount of space in the exception table, which isn't really criticial for anybody. ' The third field is another relative function pointer, this one to a handler that executes the actions. We start out with three handlers: 1: Legacy - just jumps the to fixup IP 2: Fault - provide the trap number in %ax to the fixup code 3: Cleaned up legacy for the uaccess error hack Signed-off-by: Tony Luck <[email protected]> Reviewed-by: Borislav Petkov <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Thomas Gleixner <[email protected]> Link: http://lkml.kernel.org/r/f6af78fcbd348cf4939875cfda9c19689b5e50b8.1455732970.git.tony.luck@intel.com Signed-off-by: Ingo Molnar <[email protected]>
static LogInfo *GetLogInfo(const char *name,ExceptionInfo *exception) { register LogInfo *p; assert(exception != (ExceptionInfo *) NULL); if (IsLogCacheInstantiated(exception) == MagickFalse) return((LogInfo *) NULL); /* Search for log tag. */ LockSemaphoreInfo(log_semaphore); ResetLinkedListIterator(log_cache); p=(LogInfo *) GetNextValueInLinkedList(log_cache); if ((name == (const char *) NULL) || (LocaleCompare(name,"*") == 0)) { UnlockSemaphoreInfo(log_semaphore); return(p); } while (p != (LogInfo *) NULL) { if (LocaleCompare(name,p->name) == 0) break; p=(LogInfo *) GetNextValueInLinkedList(log_cache); } if (p != (LogInfo *) NULL) (void) InsertValueInLinkedList(log_cache,0, RemoveElementByValueFromLinkedList(log_cache,p)); UnlockSemaphoreInfo(log_semaphore); return(p); }
0
[ "CWE-476" ]
ImageMagick
107ce8577e818cf4801e5a59641cb769d645cc95
177,372,921,790,326,370,000,000,000,000,000,000,000
31
https://github.com/ImageMagick/ImageMagick/issues/1224
static int sieve_duplicate_track(void *dc, void *ic __attribute__((unused)), void *sc, void *mc __attribute__((unused)), const char **errmsg __attribute__((unused))) { sieve_duplicate_context_t *dtc = (sieve_duplicate_context_t *) dc; script_data_t *sd = (script_data_t *) sc; time_t now = time(NULL); duplicate_key_t dkey = DUPLICATE_INITIALIZER; dkey.id = dtc->id; dkey.to = make_sieve_db(mbname_userid(sd->mbname)); dkey.date = ""; /* no date on these, ID is custom */ duplicate_mark(&dkey, now + dtc->seconds, 0); return SIEVE_OK; }
0
[ "CWE-269" ]
cyrus-imapd
673ebd96e2efbb8895d08648983377262f35b3f7
139,281,509,965,111,220,000,000,000,000,000,000,000
18
lmtp_sieve: don't create mailbox with admin for sieve autocreate
routerset_union(routerset_t *target, const routerset_t *source) { char *s; tor_assert(target); if (!source || !source->list) return; s = routerset_to_string(source); routerset_parse(target, s, "other routerset"); tor_free(s); }
0
[ "CWE-399" ]
tor
308f6dad20675c42b29862f4269ad1fbfb00dc9a
14,869,194,185,642,110,000,000,000,000,000,000,000
10
Mitigate a side-channel leak of which relays Tor chooses for a circuit Tor's and OpenSSL's current design guarantee that there are other leaks, but this one is likely to be more easily exploitable, and is easy to fix.
static bool shadow_copy2_find_slashes(TALLOC_CTX *mem_ctx, const char *str, size_t **poffsets, unsigned *pnum_offsets) { unsigned num_offsets; size_t *offsets; const char *p; num_offsets = 0; p = str; while ((p = strchr(p, '/')) != NULL) { num_offsets += 1; p += 1; } offsets = talloc_array(mem_ctx, size_t, num_offsets); if (offsets == NULL) { return false; } p = str; num_offsets = 0; while ((p = strchr(p, '/')) != NULL) { offsets[num_offsets] = p-str; num_offsets += 1; p += 1; } *poffsets = offsets; *pnum_offsets = num_offsets; return true; }
0
[ "CWE-200" ]
samba
675fd8d771f9d43e354dba53ddd9b5483ae0a1d7
96,212,642,726,534,650,000,000,000,000,000,000,000
33
CVE-2015-5299: s3-shadow-copy2: fix missing access check on snapdir Fix originally from <[email protected]> https://bugzilla.samba.org/show_bug.cgi?id=11529 Signed-off-by: Jeremy Allison <[email protected]> Reviewed-by: David Disseldorp <[email protected]>
CtPtr ProtocolV2::handle_frame_payload() { ceph_assert(!rx_segments_data.empty()); auto& payload = rx_segments_data.back(); ldout(cct, 30) << __func__ << "\n"; payload.hexdump(*_dout); *_dout << dendl; switch (next_tag) { case Tag::HELLO: return handle_hello(payload); case Tag::AUTH_REQUEST: return handle_auth_request(payload); case Tag::AUTH_BAD_METHOD: return handle_auth_bad_method(payload); case Tag::AUTH_REPLY_MORE: return handle_auth_reply_more(payload); case Tag::AUTH_REQUEST_MORE: return handle_auth_request_more(payload); case Tag::AUTH_DONE: return handle_auth_done(payload); case Tag::AUTH_SIGNATURE: return handle_auth_signature(payload); case Tag::CLIENT_IDENT: return handle_client_ident(payload); case Tag::SERVER_IDENT: return handle_server_ident(payload); case Tag::IDENT_MISSING_FEATURES: return handle_ident_missing_features(payload); case Tag::SESSION_RECONNECT: return handle_reconnect(payload); case Tag::SESSION_RESET: return handle_session_reset(payload); case Tag::SESSION_RETRY: return handle_session_retry(payload); case Tag::SESSION_RETRY_GLOBAL: return handle_session_retry_global(payload); case Tag::SESSION_RECONNECT_OK: return handle_reconnect_ok(payload); case Tag::KEEPALIVE2: return handle_keepalive2(payload); case Tag::KEEPALIVE2_ACK: return handle_keepalive2_ack(payload); case Tag::ACK: return handle_message_ack(payload); case Tag::WAIT: return handle_wait(payload); default: ceph_abort(); } return nullptr; }
0
[ "CWE-323" ]
ceph
20b7bb685c5ea74c651ca1ea547ac66b0fee7035
158,258,190,830,288,970,000,000,000,000,000,000,000
52
msg/async/ProtocolV2: avoid AES-GCM nonce reuse vulnerabilities The secure mode uses AES-128-GCM with 96-bit nonces consisting of a 32-bit counter followed by a 64-bit salt. The counter is incremented after processing each frame, the salt is fixed for the duration of the session. Both are initialized from the session key generated during session negotiation, so the counter starts with essentially a random value. It is allowed to wrap, and, after 2**32 frames, it repeats, resulting in nonce reuse (the actual sequence numbers that the messenger works with are 64-bit, so the session continues on). Because of how GCM works, this completely breaks both confidentiality and integrity aspects of the secure mode. A single nonce reuse reveals the XOR of two plaintexts and almost completely reveals the subkey used for producing authentication tags. After a few nonces get used twice, all confidentiality and integrity goes out the window and the attacker can potentially encrypt-authenticate plaintext of their choice. We can't easily change the nonce format to extend the counter to 64 bits (and possibly XOR it with a longer salt). Instead, just remember the initial nonce and cut the session before it repeats, forcing renegotiation. Signed-off-by: Ilya Dryomov <[email protected]> Reviewed-by: Radoslaw Zarzynski <[email protected]> Reviewed-by: Sage Weil <[email protected]> Conflicts: src/msg/async/ProtocolV2.h [ context: commit ed3ec4c01d17 ("msg: Build target 'common' without using namespace in headers") not in octopus ]
static bool fix_server_id(sys_var *self, THD *thd, enum_var_type type) { server_id_supplied = 1; thd->server_id= server_id; return false; }
0
[ "CWE-264" ]
mysql-server
48bd8b16fe382be302c6f0b45931be5aa6f29a0e
179,556,702,429,566,430,000,000,000,000,000,000,000
6
Bug#24388753: PRIVILEGE ESCALATION USING MYSQLD_SAFE [This is the 5.5/5.6 version of the bugfix]. The problem was that it was possible to write log files ending in .ini/.cnf that later could be parsed as an options file. This made it possible for users to specify startup options without the permissions to do so. This patch fixes the problem by disallowing general query log and slow query log to be written to files ending in .ini and .cnf.
sbni_get_stats( struct net_device *dev ) { return &((struct net_local *) dev->priv)->stats; }
0
[ "CWE-264" ]
linux-2.6
f2455eb176ac87081bbfc9a44b21c7cd2bc1967e
49,894,935,740,525,400,000,000,000,000,000,000,000
4
wan: Missing capability checks in sbni_ioctl() There are missing capability checks in the following code: 1300 static int 1301 sbni_ioctl( struct net_device *dev, struct ifreq *ifr, int cmd) 1302 { [...] 1319 case SIOCDEVRESINSTATS : 1320 if( current->euid != 0 ) /* root only */ 1321 return -EPERM; [...] 1336 case SIOCDEVSHWSTATE : 1337 if( current->euid != 0 ) /* root only */ 1338 return -EPERM; [...] 1357 case SIOCDEVENSLAVE : 1358 if( current->euid != 0 ) /* root only */ 1359 return -EPERM; [...] 1372 case SIOCDEVEMANSIPATE : 1373 if( current->euid != 0 ) /* root only */ 1374 return -EPERM; Here's my proposed fix: Missing capability checks. Signed-off-by: Eugene Teo <[email protected]> Signed-off-by: David S. Miller <[email protected]>
sc_pkcs15emu_oberthur_add_cert(struct sc_pkcs15_card *p15card, unsigned int file_id) { struct sc_context *ctx = p15card->card->ctx; struct sc_pkcs15_cert_info cinfo; struct sc_pkcs15_object cobj; unsigned char *info_blob, *cert_blob; size_t info_len, cert_len, len, offs; unsigned flags; int rv; char ch_tmp[0x20]; LOG_FUNC_CALLED(ctx); sc_log(ctx, "add certificate(file-id:%04X)", file_id); memset(&cinfo, 0, sizeof(cinfo)); memset(&cobj, 0, sizeof(cobj)); snprintf(ch_tmp, sizeof(ch_tmp), "%s%04X", AWP_OBJECTS_DF_PUB, file_id | 0x100); rv = sc_oberthur_read_file(p15card, ch_tmp, &info_blob, &info_len, 1); LOG_TEST_RET(ctx, rv, "Failed to add certificate: read oberthur file error"); if (info_len < 2) LOG_TEST_RET(ctx, SC_ERROR_UNKNOWN_DATA_RECEIVED, "Failed to add certificate: no 'tag'"); flags = *(info_blob + 0) * 0x100 + *(info_blob + 1); offs = 2; /* Label */ if (offs + 2 > info_len) LOG_TEST_RET(ctx, SC_ERROR_UNKNOWN_DATA_RECEIVED, "Failed to add certificate: no 'CN'"); len = *(info_blob + offs + 1) + *(info_blob + offs) * 0x100; if (len) { if (len > sizeof(cobj.label) - 1) len = sizeof(cobj.label) - 1; memcpy(cobj.label, info_blob + offs + 2, len); } offs += 2 + len; /* ID */ if (offs > info_len) LOG_TEST_RET(ctx, SC_ERROR_UNKNOWN_DATA_RECEIVED, "Failed to add certificate: no 'ID'"); len = *(info_blob + offs + 1) + *(info_blob + offs) * 0x100; if (len > sizeof(cinfo.id.value)) LOG_TEST_RET(ctx, SC_ERROR_INVALID_DATA, "Failed to add certificate: invalid 'ID' length"); memcpy(cinfo.id.value, info_blob + offs + 2, len); cinfo.id.len = len; /* Ignore subject, issuer and serial */ snprintf(ch_tmp, sizeof(ch_tmp), "%s%04X", AWP_OBJECTS_DF_PUB, file_id); sc_format_path(ch_tmp, &cinfo.path); rv = sc_oberthur_read_file(p15card, ch_tmp, &cert_blob, &cert_len, 1); LOG_TEST_RET(ctx, rv, "Failed to add certificate: read certificate error"); cinfo.value.value = cert_blob; cinfo.value.len = cert_len; rv = sc_oberthur_get_certificate_authority(&cinfo.value, &cinfo.authority); LOG_TEST_RET(ctx, rv, "Failed to add certificate: get certificate attributes error"); if (flags & OBERTHUR_ATTR_MODIFIABLE) cobj.flags |= SC_PKCS15_CO_FLAG_MODIFIABLE; rv = sc_pkcs15emu_add_x509_cert(p15card, &cobj, &cinfo); LOG_FUNC_RETURN(p15card->card->ctx, rv); }
1
[]
OpenSC
40c50a3a4219308aae90f6efd7b10213794a8d86
305,479,436,409,453,800,000,000,000,000,000,000,000
66
oberthur: Handle more memory issues during initialization Thanks oss-fuzz https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=31540 https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=31448
int blkid_partlist_numof_partitions(blkid_partlist ls) { return ls->nparts; }
0
[]
util-linux
50d1594c2e6142a3b51d2143c74027480df082e0
192,311,774,170,730,300,000,000,000,000,000,000,000
4
libblkid: avoid non-empty recursion in EBR This is extension to the patch 7164a1c34d18831ac61c6744ad14ce916d389b3f. We also need to detect non-empty recursion in the EBR chain. It's possible to create standard valid logical partitions and in the last one points back to the EBR chain. In this case all offsets will be non-empty. Unfortunately, it's valid to create logical partitions that are not in the "disk order" (sorted by start offset). So link somewhere back is valid, but this link cannot points to already existing partition (otherwise we will see recursion). This patch forces libblkid to ignore duplicate logical partitions, the duplicate chain segment is interpreted as non-data segment, after 100 iterations with non-data segments it will break the loop -- no memory is allocated in this case by the loop. Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1349536 References: http://seclists.org/oss-sec/2016/q3/40 Signed-off-by: Karel Zak <[email protected]>
static int ipa_blob_seek(void* wand,long position) { return (int)SeekBlob((Image*)wand,(MagickOffsetType) position,SEEK_SET); }
0
[ "CWE-772" ]
ImageMagick
b2b48d50300a9fbcd0aa0d9230fd6d7a08f7671e
314,739,521,019,674,600,000,000,000,000,000,000,000
4
https://github.com/ImageMagick/ImageMagick/issues/544
BGD_DECLARE(void) gdImageSetClip (gdImagePtr im, int x1, int y1, int x2, int y2) { if (x1 < 0) { x1 = 0; } if (x1 >= im->sx) { x1 = im->sx - 1; } if (x2 < 0) { x2 = 0; } if (x2 >= im->sx) { x2 = im->sx - 1; } if (y1 < 0) { y1 = 0; } if (y1 >= im->sy) { y1 = im->sy - 1; } if (y2 < 0) { y2 = 0; } if (y2 >= im->sy) { y2 = im->sy - 1; } im->cx1 = x1; im->cy1 = y1; im->cx2 = x2; im->cy2 = y2; }
0
[ "CWE-190" ]
libgd
cfee163a5e848fc3e3fb1d05a30d7557cdd36457
106,001,433,400,872,700,000,000,000,000,000,000,000
39
- #18, Removed invalid gdFree call when overflow2 fails - #17, Free im->pixels as well on error
void *zmalloc_usable(size_t size, size_t *usable) { void *ptr = malloc(size+PREFIX_SIZE); if (!ptr) zmalloc_oom_handler(size); #ifdef HAVE_MALLOC_SIZE update_zmalloc_stat_alloc(*usable = zmalloc_size(ptr)); return ptr; #else *((size_t*)ptr) = *usable = size; update_zmalloc_stat_alloc(size+PREFIX_SIZE); return (char*)ptr+PREFIX_SIZE; #endif }
0
[ "CWE-787" ]
redis
9824fe3e392caa04dc1b4071886e9ac402dd6d95
10,176,998,440,229,533,000,000,000,000,000,000,000
13
Fix wrong zmalloc_size() assumption. (#7963) When using a system with no malloc_usable_size(), zmalloc_size() assumed that the heap allocator always returns blocks that are long-padded. This may not always be the case, and will result with zmalloc_size() returning a size that is bigger than allocated. At least in one case this leads to out of bound write, process crash and a potential security vulnerability. Effectively this does not affect the vast majority of users, who use jemalloc or glibc. This problem along with a (different) fix was reported by Drew DeVault.
PHP_FUNCTION(imagefilledarc) { zval *IM; long cx, cy, w, h, ST, E, col, style; gdImagePtr im; int e, st; if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "rllllllll", &IM, &cx, &cy, &w, &h, &ST, &E, &col, &style) == FAILURE) { return; } ZEND_FETCH_RESOURCE(im, gdImagePtr, &IM, -1, "Image", le_gd); e = E; if (e < 0) { e %= 360; } st = ST; if (st < 0) { st %= 360; } gdImageFilledArc(im, cx, cy, w, h, st, e, col, style); RETURN_TRUE; }
0
[ "CWE-20" ]
php-src
f7d7befae8bcc2db0093f8adaa9f72eeb7ad891e
146,617,952,183,993,670,000,000,000,000,000,000,000
27
Fix #69719 - more checks for nulls in paths
int usb_device_alloc_streams(USBDevice *dev, USBEndpoint **eps, int nr_eps, int streams) { USBDeviceClass *klass = USB_DEVICE_GET_CLASS(dev); if (klass->alloc_streams) { return klass->alloc_streams(dev, eps, nr_eps, streams); } return 0; }
0
[ "CWE-119" ]
qemu
9f8e9895c504149d7048e9fc5eb5cbb34b16e49a
165,978,042,123,805,600,000,000,000,000,000,000,000
9
usb: sanity check setup_index+setup_len in post_load CVE-2013-4541 s->setup_len and s->setup_index are fed into usb_packet_copy as size/offset into s->data_buf, it's possible for invalid state to exploit this to load arbitrary data. setup_len and setup_index should be checked to make sure they are not negative. Cc: Gerd Hoffmann <[email protected]> Signed-off-by: Michael S. Tsirkin <[email protected]> Reviewed-by: Gerd Hoffmann <[email protected]> Signed-off-by: Juan Quintela <[email protected]>
static int ldb_match_scope(struct ldb_context *ldb, struct ldb_dn *base, struct ldb_dn *dn, enum ldb_scope scope) { int ret = 0; if (base == NULL || dn == NULL) { return 1; } switch (scope) { case LDB_SCOPE_BASE: if (ldb_dn_compare(base, dn) == 0) { ret = 1; } break; case LDB_SCOPE_ONELEVEL: if (ldb_dn_get_comp_num(dn) == (ldb_dn_get_comp_num(base) + 1)) { if (ldb_dn_compare_base(base, dn) == 0) { ret = 1; } } break; case LDB_SCOPE_SUBTREE: default: if (ldb_dn_compare_base(base, dn) == 0) { ret = 1; } break; } return ret; }
0
[ "CWE-189" ]
samba
ec504dbf69636a554add1f3d5703dd6c3ad450b8
325,721,361,574,410,660,000,000,000,000,000,000,000
36
CVE-2015-3223: lib: ldb: Cope with canonicalise_fn returning string "", length 0. BUG: https://bugzilla.samba.org/show_bug.cgi?id=11325 Signed-off-by: Jeremy Allison <[email protected]> Reviewed-by: Ralph Boehme <[email protected]>
const Cues* Segment::GetCues() const { return m_pCues; }
0
[ "CWE-20" ]
libvpx
34d54b04e98dd0bac32e9aab0fbda0bf501bc742
144,850,662,458,060,400,000,000,000,000,000,000,000
1
update libwebm to libwebm-1.0.0.27-358-gdbf1d10 changelog: https://chromium.googlesource.com/webm/libwebm/+log/libwebm-1.0.0.27-351-g9f23fbc..libwebm-1.0.0.27-358-gdbf1d10 Change-Id: I28a6b3ae02a53fb1f2029eee11e9449afb94c8e3
rsvg_clip_path_parse (const RsvgDefs * defs, const char *str) { char *name; name = rsvg_get_url_string (str); if (name) { RsvgNode *val; val = rsvg_defs_lookup (defs, name); g_free (name); if (val && RSVG_NODE_TYPE (val) == RSVG_NODE_TYPE_CLIP_PATH) return val; } return NULL; }
0
[]
librsvg
34c95743ca692ea0e44778e41a7c0a129363de84
179,579,014,189,406,900,000,000,000,000,000,000,000
15
Store node type separately in RsvgNode The node name (formerly RsvgNode:type) cannot be used to infer the sub-type of RsvgNode that we're dealing with, since for unknown elements we put type = node-name. This lead to a (potentially exploitable) crash e.g. when the element name started with "fe" which tricked the old code into considering it as a RsvgFilterPrimitive. CVE-2011-3146 https://bugzilla.gnome.org/show_bug.cgi?id=658014
void CoreUserInputHandler::handleBan(const BufferInfo &bufferInfo, const QString &msg) { banOrUnban(bufferInfo, msg, true); }
0
[ "CWE-399" ]
quassel
b5e38970ffd55e2dd9f706ce75af9a8d7730b1b8
189,657,943,536,958,800,000,000,000,000,000,000,000
4
Improve the message-splitting algorithm for PRIVMSG and CTCP This introduces a new message splitting algorithm based on QTextBoundaryFinder. It works by first starting with the entire message to be sent, encoding it, and checking to see if it is over the maximum message length. If it is, it uses QTBF to find the word boundary most immediately preceding the maximum length. If no suitable boundary can be found, it falls back to searching for grapheme boundaries. It repeats this process until the entire message has been sent. Unlike what it replaces, the new splitting code is not recursive and cannot cause stack overflows. Additionally, if it is unable to split a string, it will give up gracefully and not crash the core or cause a thread to run away. This patch fixes two bugs. The first is garbage characters caused by accidentally splitting the string in the middle of a multibyte character. Since the new code splits at a character level instead of a byte level, this will no longer be an issue. The second is the core crash caused by sending an overlength CTCP query ("/me") containing only multibyte characters. This bug was caused by the old CTCP splitter using the byte index from lastParamOverrun() as a character index for a QString.
JVM_TraceInstructions(jboolean on) { Trc_SC_TraceInstructions(on); }
0
[ "CWE-119" ]
openj9
0971f22d88f42cf7332364ad7430e9bd8681c970
87,384,883,032,652,050,000,000,000,000,000,000,000
4
Clean up jio_snprintf and jio_vfprintf Fixes https://bugs.eclipse.org/bugs/show_bug.cgi?id=543659 Signed-off-by: Peter Bain <[email protected]>
static DNLI_t dnlInitIterator(rpmfiles fi, rpmfs fs, int reverse) { DNLI_t dnli; int i, j; int dc; if (fi == NULL) return NULL; dc = rpmfilesDC(fi); dnli = xcalloc(1, sizeof(*dnli)); dnli->fi = fi; dnli->reverse = reverse; dnli->i = (reverse ? dc : 0); if (dc) { dnli->active = xcalloc(dc, sizeof(*dnli->active)); int fc = rpmfilesFC(fi); /* Identify parent directories not skipped. */ for (i = 0; i < fc; i++) if (!XFA_SKIPPING(rpmfsGetAction(fs, i))) dnli->active[rpmfilesDI(fi, i)] = 1; /* Exclude parent directories that are explicitly included. */ for (i = 0; i < fc; i++) { int dil; size_t dnlen, bnlen; if (!S_ISDIR(rpmfilesFMode(fi, i))) continue; dil = rpmfilesDI(fi, i); dnlen = strlen(rpmfilesDN(fi, dil)); bnlen = strlen(rpmfilesBN(fi, i)); for (j = 0; j < dc; j++) { const char * dnl; size_t jlen; if (!dnli->active[j] || j == dil) continue; dnl = rpmfilesDN(fi, j); jlen = strlen(dnl); if (jlen != (dnlen+bnlen+1)) continue; if (!rstreqn(dnl, rpmfilesDN(fi, dil), dnlen)) continue; if (!rstreqn(dnl+dnlen, rpmfilesBN(fi, i), bnlen)) continue; if (dnl[dnlen+bnlen] != '/' || dnl[dnlen+bnlen+1] != '\0') continue; /* This directory is included in the package. */ dnli->active[j] = 0; break; } } /* Print only once per package. */ if (!reverse) { j = 0; for (i = 0; i < dc; i++) { if (!dnli->active[i]) continue; if (j == 0) { j = 1; rpmlog(RPMLOG_DEBUG, "========== Directories not explicitly included in package:\n"); } rpmlog(RPMLOG_DEBUG, "%10d %s\n", i, rpmfilesDN(fi, i)); } if (j) rpmlog(RPMLOG_DEBUG, "==========\n"); } } return dnli; }
0
[ "CWE-59", "CWE-61" ]
rpm
f2d3be2a8741234faaa96f5fd05fdfdc75779a79
141,136,472,753,518,810,000,000,000,000,000,000,000
75
Restrict following symlinks to directories by ownership (CVE-2017-7500) Only follow directory symlinks owned by target directory owner or root. This prevents privilege escalation from user-writable directories via directory symlinks to privileged directories on package upgrade, while still allowing admin to arrange disk usage with symlinks. The rationale is that if you can create symlinks owned by user X you *are* user X (or root), and if you also own directory Y you can do whatever with it already, including change permissions. So when you create a symlink to that directory, the link ownership acts as a simple stamp of authority that you indeed want rpm to treat this symlink as it were the directory that you own. Such a permission can only be given by you or root, which is just the way we want it. Plus it's almost ridiculously simple as far as rules go, compared to trying to calculate something from the source vs destination directory permissions etc. In the normal case, the user arranging diskspace with symlinks is indeed root so nothing changes, the only real change here is to links created by non-privileged users which should be few and far between in practise. Unfortunately our test-suite runs as a regular user via fakechroot and thus the testcase for this fails under the new rules. Adjust the testcase to get the ownership straight and add a second case for the illegal behavior, basically the same as the old one but with different expectations.